578 lines
956 KiB
JavaScript
578 lines
956 KiB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BVzr2LGs-BlZuKJ8g.js","assets/index-D4mISQVM.js","assets/index-BbYcdrlh.js","assets/index-D6m9WDyY.css","assets/index-D8hG3RCP.css","assets/eventemitter2-BZbyr5yF.js"])))=>i.map(i=>d[i]);
|
||
import{_ as ya}from"./index-BbYcdrlh.js";import{g as fr,r as un,a as _n,w as Bt,l as St}from"./index-D4mISQVM.js";import{y as Vn}from"./eventemitter2-BZbyr5yF.js";var ee=(function(o){var t={};function e(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return o[r].call(n.exports,n,n.exports,e),n.l=!0,n.exports}return e.m=o,e.c=t,e.d=function(r,n,i){e.o(r,n)||Object.defineProperty(r,n,{enumerable:!0,get:i})},e.r=function(r){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},e.t=function(r,n){if(n&1&&(r=e(r)),n&8||n&4&&typeof r=="object"&&r&&r.__esModule)return r;var i=Object.create(null);if(e.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:r}),n&2&&typeof r!="string")for(var a in r)e.d(i,a,(function(s){return r[s]}).bind(null,a));return i},e.n=function(r){var n=r&&r.__esModule?(function(){return r.default}):(function(){return r});return e.d(n,"a",n),n},e.o=function(r,n){return Object.prototype.hasOwnProperty.call(r,n)},e.p="/js/",e(e.s=0)})([(function(o,t,e){e.r(t),e.d(t,"version",function(){return Z}),e.d(t,"helpers",function(){return Y}),e.d(t,"createElement",function(){return j}),e.d(t,"isSpriteNode",function(){return b}),e.d(t,"registerNode",function(){return O});var r=e(12);e.d(t,"ENV",function(){return r.ENV});var n=e(68);e.d(t,"requestAnimationFrame",function(){return n.requestAnimationFrame}),e.d(t,"cancelAnimationFrame",function(){return n.cancelAnimationFrame});var i=e(70);e.d(t,"Node",function(){return i.default});var a=e(217);e.d(t,"Cloud",function(){return a.default});var s=e(219);e.d(t,"Block",function(){return s.default});var u=e(224);e.d(t,"Sprite",function(){return u.default});var d=e(226);e.d(t,"Path",function(){return d.default});var M=e(229);e.d(t,"Rect",function(){return M.default});var c=e(231);e.d(t,"Triangle",function(){return c.default});var v=e(236);e.d(t,"Parallel",function(){return v.default});var p=e(238);e.d(t,"Regular",function(){return p.default});var T=e(240);e.d(t,"Star",function(){return T.default});var x=e(242);e.d(t,"Ellipse",function(){return x.default});var y=e(244);e.d(t,"Arc",function(){return y.default});var C=e(246);e.d(t,"Ring",function(){return C.default});var h=e(232);e.d(t,"Polyline",function(){return h.default});var g=e(248);e.d(t,"Label",function(){return g.default});var f=e(250);e.d(t,"Group",function(){return f.default});var m=e(286);e.d(t,"Layer",function(){return m.default});var S=e(287);e.d(t,"SpriteSvg",function(){return S.default});var A=e(289);e.d(t,"LayerWorker",function(){return A.default});var P=e(290);e.d(t,"Scene",function(){return P.default});var R=e(213),D=e(221);e.d(t,"Color",function(){return D.Color}),e.d(t,"Gradient",function(){return D.Gradient});var L=e(72);e(1).glMatrix.setMatrixArrayType(Array);const j=R.default.createElement,b=R.default.isSpriteNode,O=R.default.registerNode,Y={parseColor:D.parseColor,sizeToPixel:L.sizeToPixel,toArray:L.toArray,toString:L.toString,toNumber:L.toNumber};let X;X="3.8.3";const Z=X}),(function(o,t,e){e.r(t);var r=e(2);e.d(t,"glMatrix",function(){return r});var n=e(3);e.d(t,"mat2",function(){return n});var i=e(4);e.d(t,"mat2d",function(){return i});var a=e(5);e.d(t,"mat3",function(){return a});var s=e(6);e.d(t,"mat4",function(){return s});var u=e(7);e.d(t,"quat",function(){return u});var d=e(10);e.d(t,"quat2",function(){return d});var M=e(11);e.d(t,"vec2",function(){return M});var c=e(8);e.d(t,"vec3",function(){return c});var v=e(9);e.d(t,"vec4",function(){return v})}),(function(o,t,e){e.r(t),e.d(t,"EPSILON",function(){return r}),e.d(t,"ARRAY_TYPE",function(){return n}),e.d(t,"RANDOM",function(){return i}),e.d(t,"setMatrixArrayType",function(){return a}),e.d(t,"toRadian",function(){return u}),e.d(t,"equals",function(){return d});var r=1e-6,n=typeof Float32Array<"u"?Float32Array:Array,i=Math.random;function a(M){n=M}var s=Math.PI/180;function u(M){return M*s}function d(M,c){return Math.abs(M-c)<=r*Math.max(1,Math.abs(M),Math.abs(c))}Math.hypot||(Math.hypot=function(){for(var M=0,c=arguments.length;c--;)M+=arguments[c]*arguments[c];return Math.sqrt(M)})}),(function(o,t,e){e.r(t),e.d(t,"create",function(){return n}),e.d(t,"clone",function(){return i}),e.d(t,"copy",function(){return a}),e.d(t,"identity",function(){return s}),e.d(t,"fromValues",function(){return u}),e.d(t,"set",function(){return d}),e.d(t,"transpose",function(){return M}),e.d(t,"invert",function(){return c}),e.d(t,"adjoint",function(){return v}),e.d(t,"determinant",function(){return p}),e.d(t,"multiply",function(){return T}),e.d(t,"rotate",function(){return x}),e.d(t,"scale",function(){return y}),e.d(t,"fromRotation",function(){return C}),e.d(t,"fromScaling",function(){return h}),e.d(t,"str",function(){return g}),e.d(t,"frob",function(){return f}),e.d(t,"LDU",function(){return m}),e.d(t,"add",function(){return S}),e.d(t,"subtract",function(){return A}),e.d(t,"exactEquals",function(){return P}),e.d(t,"equals",function(){return R}),e.d(t,"multiplyScalar",function(){return D}),e.d(t,"multiplyScalarAndAdd",function(){return L}),e.d(t,"mul",function(){return j}),e.d(t,"sub",function(){return b});var r=e(2);function n(){var O=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(O[1]=0,O[2]=0),O[0]=1,O[3]=1,O}function i(O){var Y=new r.ARRAY_TYPE(4);return Y[0]=O[0],Y[1]=O[1],Y[2]=O[2],Y[3]=O[3],Y}function a(O,Y){return O[0]=Y[0],O[1]=Y[1],O[2]=Y[2],O[3]=Y[3],O}function s(O){return O[0]=1,O[1]=0,O[2]=0,O[3]=1,O}function u(O,Y,X,Z){var $=new r.ARRAY_TYPE(4);return $[0]=O,$[1]=Y,$[2]=X,$[3]=Z,$}function d(O,Y,X,Z,$){return O[0]=Y,O[1]=X,O[2]=Z,O[3]=$,O}function M(O,Y){if(O===Y){var X=Y[1];O[1]=Y[2],O[2]=X}else O[0]=Y[0],O[1]=Y[2],O[2]=Y[1],O[3]=Y[3];return O}function c(O,Y){var X=Y[0],Z=Y[1],$=Y[2],rt=Y[3],F=X*rt-$*Z;return F?(F=1/F,O[0]=rt*F,O[1]=-Z*F,O[2]=-$*F,O[3]=X*F,O):null}function v(O,Y){var X=Y[0];return O[0]=Y[3],O[1]=-Y[1],O[2]=-Y[2],O[3]=X,O}function p(O){return O[0]*O[3]-O[2]*O[1]}function T(O,Y,X){var Z=Y[0],$=Y[1],rt=Y[2],F=Y[3],Q=X[0],tt=X[1],lt=X[2],ct=X[3];return O[0]=Z*Q+rt*tt,O[1]=$*Q+F*tt,O[2]=Z*lt+rt*ct,O[3]=$*lt+F*ct,O}function x(O,Y,X){var Z=Y[0],$=Y[1],rt=Y[2],F=Y[3],Q=Math.sin(X),tt=Math.cos(X);return O[0]=Z*tt+rt*Q,O[1]=$*tt+F*Q,O[2]=Z*-Q+rt*tt,O[3]=$*-Q+F*tt,O}function y(O,Y,X){var Z=Y[0],$=Y[1],rt=Y[2],F=Y[3],Q=X[0],tt=X[1];return O[0]=Z*Q,O[1]=$*Q,O[2]=rt*tt,O[3]=F*tt,O}function C(O,Y){var X=Math.sin(Y),Z=Math.cos(Y);return O[0]=Z,O[1]=X,O[2]=-X,O[3]=Z,O}function h(O,Y){return O[0]=Y[0],O[1]=0,O[2]=0,O[3]=Y[1],O}function g(O){return"mat2("+O[0]+", "+O[1]+", "+O[2]+", "+O[3]+")"}function f(O){return Math.hypot(O[0],O[1],O[2],O[3])}function m(O,Y,X,Z){return O[2]=Z[2]/Z[0],X[0]=Z[0],X[1]=Z[1],X[3]=Z[3]-O[2]*X[1],[O,Y,X]}function S(O,Y,X){return O[0]=Y[0]+X[0],O[1]=Y[1]+X[1],O[2]=Y[2]+X[2],O[3]=Y[3]+X[3],O}function A(O,Y,X){return O[0]=Y[0]-X[0],O[1]=Y[1]-X[1],O[2]=Y[2]-X[2],O[3]=Y[3]-X[3],O}function P(O,Y){return O[0]===Y[0]&&O[1]===Y[1]&&O[2]===Y[2]&&O[3]===Y[3]}function R(O,Y){var X=O[0],Z=O[1],$=O[2],rt=O[3],F=Y[0],Q=Y[1],tt=Y[2],lt=Y[3];return Math.abs(X-F)<=r.EPSILON*Math.max(1,Math.abs(X),Math.abs(F))&&Math.abs(Z-Q)<=r.EPSILON*Math.max(1,Math.abs(Z),Math.abs(Q))&&Math.abs($-tt)<=r.EPSILON*Math.max(1,Math.abs($),Math.abs(tt))&&Math.abs(rt-lt)<=r.EPSILON*Math.max(1,Math.abs(rt),Math.abs(lt))}function D(O,Y,X){return O[0]=Y[0]*X,O[1]=Y[1]*X,O[2]=Y[2]*X,O[3]=Y[3]*X,O}function L(O,Y,X,Z){return O[0]=Y[0]+X[0]*Z,O[1]=Y[1]+X[1]*Z,O[2]=Y[2]+X[2]*Z,O[3]=Y[3]+X[3]*Z,O}var j=T,b=A}),(function(o,t,e){e.r(t),e.d(t,"create",function(){return n}),e.d(t,"clone",function(){return i}),e.d(t,"copy",function(){return a}),e.d(t,"identity",function(){return s}),e.d(t,"fromValues",function(){return u}),e.d(t,"set",function(){return d}),e.d(t,"invert",function(){return M}),e.d(t,"determinant",function(){return c}),e.d(t,"multiply",function(){return v}),e.d(t,"rotate",function(){return p}),e.d(t,"scale",function(){return T}),e.d(t,"translate",function(){return x}),e.d(t,"fromRotation",function(){return y}),e.d(t,"fromScaling",function(){return C}),e.d(t,"fromTranslation",function(){return h}),e.d(t,"str",function(){return g}),e.d(t,"frob",function(){return f}),e.d(t,"add",function(){return m}),e.d(t,"subtract",function(){return S}),e.d(t,"multiplyScalar",function(){return A}),e.d(t,"multiplyScalarAndAdd",function(){return P}),e.d(t,"exactEquals",function(){return R}),e.d(t,"equals",function(){return D}),e.d(t,"mul",function(){return L}),e.d(t,"sub",function(){return j});var r=e(2);function n(){var b=new r.ARRAY_TYPE(6);return r.ARRAY_TYPE!=Float32Array&&(b[1]=0,b[2]=0,b[4]=0,b[5]=0),b[0]=1,b[3]=1,b}function i(b){var O=new r.ARRAY_TYPE(6);return O[0]=b[0],O[1]=b[1],O[2]=b[2],O[3]=b[3],O[4]=b[4],O[5]=b[5],O}function a(b,O){return b[0]=O[0],b[1]=O[1],b[2]=O[2],b[3]=O[3],b[4]=O[4],b[5]=O[5],b}function s(b){return b[0]=1,b[1]=0,b[2]=0,b[3]=1,b[4]=0,b[5]=0,b}function u(b,O,Y,X,Z,$){var rt=new r.ARRAY_TYPE(6);return rt[0]=b,rt[1]=O,rt[2]=Y,rt[3]=X,rt[4]=Z,rt[5]=$,rt}function d(b,O,Y,X,Z,$,rt){return b[0]=O,b[1]=Y,b[2]=X,b[3]=Z,b[4]=$,b[5]=rt,b}function M(b,O){var Y=O[0],X=O[1],Z=O[2],$=O[3],rt=O[4],F=O[5],Q=Y*$-X*Z;return Q?(Q=1/Q,b[0]=$*Q,b[1]=-X*Q,b[2]=-Z*Q,b[3]=Y*Q,b[4]=(Z*F-$*rt)*Q,b[5]=(X*rt-Y*F)*Q,b):null}function c(b){return b[0]*b[3]-b[1]*b[2]}function v(b,O,Y){var X=O[0],Z=O[1],$=O[2],rt=O[3],F=O[4],Q=O[5],tt=Y[0],lt=Y[1],ct=Y[2],Mt=Y[3],st=Y[4],Tt=Y[5];return b[0]=X*tt+$*lt,b[1]=Z*tt+rt*lt,b[2]=X*ct+$*Mt,b[3]=Z*ct+rt*Mt,b[4]=X*st+$*Tt+F,b[5]=Z*st+rt*Tt+Q,b}function p(b,O,Y){var X=O[0],Z=O[1],$=O[2],rt=O[3],F=O[4],Q=O[5],tt=Math.sin(Y),lt=Math.cos(Y);return b[0]=X*lt+$*tt,b[1]=Z*lt+rt*tt,b[2]=X*-tt+$*lt,b[3]=Z*-tt+rt*lt,b[4]=F,b[5]=Q,b}function T(b,O,Y){var X=O[0],Z=O[1],$=O[2],rt=O[3],F=O[4],Q=O[5],tt=Y[0],lt=Y[1];return b[0]=X*tt,b[1]=Z*tt,b[2]=$*lt,b[3]=rt*lt,b[4]=F,b[5]=Q,b}function x(b,O,Y){var X=O[0],Z=O[1],$=O[2],rt=O[3],F=O[4],Q=O[5],tt=Y[0],lt=Y[1];return b[0]=X,b[1]=Z,b[2]=$,b[3]=rt,b[4]=X*tt+$*lt+F,b[5]=Z*tt+rt*lt+Q,b}function y(b,O){var Y=Math.sin(O),X=Math.cos(O);return b[0]=X,b[1]=Y,b[2]=-Y,b[3]=X,b[4]=0,b[5]=0,b}function C(b,O){return b[0]=O[0],b[1]=0,b[2]=0,b[3]=O[1],b[4]=0,b[5]=0,b}function h(b,O){return b[0]=1,b[1]=0,b[2]=0,b[3]=1,b[4]=O[0],b[5]=O[1],b}function g(b){return"mat2d("+b[0]+", "+b[1]+", "+b[2]+", "+b[3]+", "+b[4]+", "+b[5]+")"}function f(b){return Math.hypot(b[0],b[1],b[2],b[3],b[4],b[5],1)}function m(b,O,Y){return b[0]=O[0]+Y[0],b[1]=O[1]+Y[1],b[2]=O[2]+Y[2],b[3]=O[3]+Y[3],b[4]=O[4]+Y[4],b[5]=O[5]+Y[5],b}function S(b,O,Y){return b[0]=O[0]-Y[0],b[1]=O[1]-Y[1],b[2]=O[2]-Y[2],b[3]=O[3]-Y[3],b[4]=O[4]-Y[4],b[5]=O[5]-Y[5],b}function A(b,O,Y){return b[0]=O[0]*Y,b[1]=O[1]*Y,b[2]=O[2]*Y,b[3]=O[3]*Y,b[4]=O[4]*Y,b[5]=O[5]*Y,b}function P(b,O,Y,X){return b[0]=O[0]+Y[0]*X,b[1]=O[1]+Y[1]*X,b[2]=O[2]+Y[2]*X,b[3]=O[3]+Y[3]*X,b[4]=O[4]+Y[4]*X,b[5]=O[5]+Y[5]*X,b}function R(b,O){return b[0]===O[0]&&b[1]===O[1]&&b[2]===O[2]&&b[3]===O[3]&&b[4]===O[4]&&b[5]===O[5]}function D(b,O){var Y=b[0],X=b[1],Z=b[2],$=b[3],rt=b[4],F=b[5],Q=O[0],tt=O[1],lt=O[2],ct=O[3],Mt=O[4],st=O[5];return Math.abs(Y-Q)<=r.EPSILON*Math.max(1,Math.abs(Y),Math.abs(Q))&&Math.abs(X-tt)<=r.EPSILON*Math.max(1,Math.abs(X),Math.abs(tt))&&Math.abs(Z-lt)<=r.EPSILON*Math.max(1,Math.abs(Z),Math.abs(lt))&&Math.abs($-ct)<=r.EPSILON*Math.max(1,Math.abs($),Math.abs(ct))&&Math.abs(rt-Mt)<=r.EPSILON*Math.max(1,Math.abs(rt),Math.abs(Mt))&&Math.abs(F-st)<=r.EPSILON*Math.max(1,Math.abs(F),Math.abs(st))}var L=v,j=S}),(function(o,t,e){e.r(t),e.d(t,"create",function(){return n}),e.d(t,"fromMat4",function(){return i}),e.d(t,"clone",function(){return a}),e.d(t,"copy",function(){return s}),e.d(t,"fromValues",function(){return u}),e.d(t,"set",function(){return d}),e.d(t,"identity",function(){return M}),e.d(t,"transpose",function(){return c}),e.d(t,"invert",function(){return v}),e.d(t,"adjoint",function(){return p}),e.d(t,"determinant",function(){return T}),e.d(t,"multiply",function(){return x}),e.d(t,"translate",function(){return y}),e.d(t,"rotate",function(){return C}),e.d(t,"scale",function(){return h}),e.d(t,"fromTranslation",function(){return g}),e.d(t,"fromRotation",function(){return f}),e.d(t,"fromScaling",function(){return m}),e.d(t,"fromMat2d",function(){return S}),e.d(t,"fromQuat",function(){return A}),e.d(t,"normalFromMat4",function(){return P}),e.d(t,"projection",function(){return R}),e.d(t,"str",function(){return D}),e.d(t,"frob",function(){return L}),e.d(t,"add",function(){return j}),e.d(t,"subtract",function(){return b}),e.d(t,"multiplyScalar",function(){return O}),e.d(t,"multiplyScalarAndAdd",function(){return Y}),e.d(t,"exactEquals",function(){return X}),e.d(t,"equals",function(){return Z}),e.d(t,"mul",function(){return $}),e.d(t,"sub",function(){return rt});var r=e(2);function n(){var F=new r.ARRAY_TYPE(9);return r.ARRAY_TYPE!=Float32Array&&(F[1]=0,F[2]=0,F[3]=0,F[5]=0,F[6]=0,F[7]=0),F[0]=1,F[4]=1,F[8]=1,F}function i(F,Q){return F[0]=Q[0],F[1]=Q[1],F[2]=Q[2],F[3]=Q[4],F[4]=Q[5],F[5]=Q[6],F[6]=Q[8],F[7]=Q[9],F[8]=Q[10],F}function a(F){var Q=new r.ARRAY_TYPE(9);return Q[0]=F[0],Q[1]=F[1],Q[2]=F[2],Q[3]=F[3],Q[4]=F[4],Q[5]=F[5],Q[6]=F[6],Q[7]=F[7],Q[8]=F[8],Q}function s(F,Q){return F[0]=Q[0],F[1]=Q[1],F[2]=Q[2],F[3]=Q[3],F[4]=Q[4],F[5]=Q[5],F[6]=Q[6],F[7]=Q[7],F[8]=Q[8],F}function u(F,Q,tt,lt,ct,Mt,st,Tt,xt){var W=new r.ARRAY_TYPE(9);return W[0]=F,W[1]=Q,W[2]=tt,W[3]=lt,W[4]=ct,W[5]=Mt,W[6]=st,W[7]=Tt,W[8]=xt,W}function d(F,Q,tt,lt,ct,Mt,st,Tt,xt,W){return F[0]=Q,F[1]=tt,F[2]=lt,F[3]=ct,F[4]=Mt,F[5]=st,F[6]=Tt,F[7]=xt,F[8]=W,F}function M(F){return F[0]=1,F[1]=0,F[2]=0,F[3]=0,F[4]=1,F[5]=0,F[6]=0,F[7]=0,F[8]=1,F}function c(F,Q){if(F===Q){var tt=Q[1],lt=Q[2],ct=Q[5];F[1]=Q[3],F[2]=Q[6],F[3]=tt,F[5]=Q[7],F[6]=lt,F[7]=ct}else F[0]=Q[0],F[1]=Q[3],F[2]=Q[6],F[3]=Q[1],F[4]=Q[4],F[5]=Q[7],F[6]=Q[2],F[7]=Q[5],F[8]=Q[8];return F}function v(F,Q){var tt=Q[0],lt=Q[1],ct=Q[2],Mt=Q[3],st=Q[4],Tt=Q[5],xt=Q[6],W=Q[7],k=Q[8],q=k*st-Tt*W,_=-k*Mt+Tt*xt,U=W*Mt-st*xt,H=tt*q+lt*_+ct*U;return H?(H=1/H,F[0]=q*H,F[1]=(-k*lt+ct*W)*H,F[2]=(Tt*lt-ct*st)*H,F[3]=_*H,F[4]=(k*tt-ct*xt)*H,F[5]=(-Tt*tt+ct*Mt)*H,F[6]=U*H,F[7]=(-W*tt+lt*xt)*H,F[8]=(st*tt-lt*Mt)*H,F):null}function p(F,Q){var tt=Q[0],lt=Q[1],ct=Q[2],Mt=Q[3],st=Q[4],Tt=Q[5],xt=Q[6],W=Q[7],k=Q[8];return F[0]=st*k-Tt*W,F[1]=ct*W-lt*k,F[2]=lt*Tt-ct*st,F[3]=Tt*xt-Mt*k,F[4]=tt*k-ct*xt,F[5]=ct*Mt-tt*Tt,F[6]=Mt*W-st*xt,F[7]=lt*xt-tt*W,F[8]=tt*st-lt*Mt,F}function T(F){var Q=F[0],tt=F[1],lt=F[2],ct=F[3],Mt=F[4],st=F[5],Tt=F[6],xt=F[7],W=F[8];return Q*(W*Mt-st*xt)+tt*(-W*ct+st*Tt)+lt*(xt*ct-Mt*Tt)}function x(F,Q,tt){var lt=Q[0],ct=Q[1],Mt=Q[2],st=Q[3],Tt=Q[4],xt=Q[5],W=Q[6],k=Q[7],q=Q[8],_=tt[0],U=tt[1],H=tt[2],E=tt[3],w=tt[4],B=tt[5],G=tt[6],K=tt[7],et=tt[8];return F[0]=_*lt+U*st+H*W,F[1]=_*ct+U*Tt+H*k,F[2]=_*Mt+U*xt+H*q,F[3]=E*lt+w*st+B*W,F[4]=E*ct+w*Tt+B*k,F[5]=E*Mt+w*xt+B*q,F[6]=G*lt+K*st+et*W,F[7]=G*ct+K*Tt+et*k,F[8]=G*Mt+K*xt+et*q,F}function y(F,Q,tt){var lt=Q[0],ct=Q[1],Mt=Q[2],st=Q[3],Tt=Q[4],xt=Q[5],W=Q[6],k=Q[7],q=Q[8],_=tt[0],U=tt[1];return F[0]=lt,F[1]=ct,F[2]=Mt,F[3]=st,F[4]=Tt,F[5]=xt,F[6]=_*lt+U*st+W,F[7]=_*ct+U*Tt+k,F[8]=_*Mt+U*xt+q,F}function C(F,Q,tt){var lt=Q[0],ct=Q[1],Mt=Q[2],st=Q[3],Tt=Q[4],xt=Q[5],W=Q[6],k=Q[7],q=Q[8],_=Math.sin(tt),U=Math.cos(tt);return F[0]=U*lt+_*st,F[1]=U*ct+_*Tt,F[2]=U*Mt+_*xt,F[3]=U*st-_*lt,F[4]=U*Tt-_*ct,F[5]=U*xt-_*Mt,F[6]=W,F[7]=k,F[8]=q,F}function h(F,Q,tt){var lt=tt[0],ct=tt[1];return F[0]=lt*Q[0],F[1]=lt*Q[1],F[2]=lt*Q[2],F[3]=ct*Q[3],F[4]=ct*Q[4],F[5]=ct*Q[5],F[6]=Q[6],F[7]=Q[7],F[8]=Q[8],F}function g(F,Q){return F[0]=1,F[1]=0,F[2]=0,F[3]=0,F[4]=1,F[5]=0,F[6]=Q[0],F[7]=Q[1],F[8]=1,F}function f(F,Q){var tt=Math.sin(Q),lt=Math.cos(Q);return F[0]=lt,F[1]=tt,F[2]=0,F[3]=-tt,F[4]=lt,F[5]=0,F[6]=0,F[7]=0,F[8]=1,F}function m(F,Q){return F[0]=Q[0],F[1]=0,F[2]=0,F[3]=0,F[4]=Q[1],F[5]=0,F[6]=0,F[7]=0,F[8]=1,F}function S(F,Q){return F[0]=Q[0],F[1]=Q[1],F[2]=0,F[3]=Q[2],F[4]=Q[3],F[5]=0,F[6]=Q[4],F[7]=Q[5],F[8]=1,F}function A(F,Q){var tt=Q[0],lt=Q[1],ct=Q[2],Mt=Q[3],st=tt+tt,Tt=lt+lt,xt=ct+ct,W=tt*st,k=lt*st,q=lt*Tt,_=ct*st,U=ct*Tt,H=ct*xt,E=Mt*st,w=Mt*Tt,B=Mt*xt;return F[0]=1-q-H,F[3]=k-B,F[6]=_+w,F[1]=k+B,F[4]=1-W-H,F[7]=U-E,F[2]=_-w,F[5]=U+E,F[8]=1-W-q,F}function P(F,Q){var tt=Q[0],lt=Q[1],ct=Q[2],Mt=Q[3],st=Q[4],Tt=Q[5],xt=Q[6],W=Q[7],k=Q[8],q=Q[9],_=Q[10],U=Q[11],H=Q[12],E=Q[13],w=Q[14],B=Q[15],G=tt*Tt-lt*st,K=tt*xt-ct*st,et=tt*W-Mt*st,at=lt*xt-ct*Tt,ut=lt*W-Mt*Tt,gt=ct*W-Mt*xt,yt=k*E-q*H,Ct=k*w-_*H,vt=k*B-U*H,mt=q*w-_*E,It=q*B-U*E,wt=_*B-U*w,bt=G*wt-K*It+et*mt+at*vt-ut*Ct+gt*yt;return bt?(bt=1/bt,F[0]=(Tt*wt-xt*It+W*mt)*bt,F[1]=(xt*vt-st*wt-W*Ct)*bt,F[2]=(st*It-Tt*vt+W*yt)*bt,F[3]=(ct*It-lt*wt-Mt*mt)*bt,F[4]=(tt*wt-ct*vt+Mt*Ct)*bt,F[5]=(lt*vt-tt*It-Mt*yt)*bt,F[6]=(E*gt-w*ut+B*at)*bt,F[7]=(w*et-H*gt-B*K)*bt,F[8]=(H*ut-E*et+B*G)*bt,F):null}function R(F,Q,tt){return F[0]=2/Q,F[1]=0,F[2]=0,F[3]=0,F[4]=-2/tt,F[5]=0,F[6]=-1,F[7]=1,F[8]=1,F}function D(F){return"mat3("+F[0]+", "+F[1]+", "+F[2]+", "+F[3]+", "+F[4]+", "+F[5]+", "+F[6]+", "+F[7]+", "+F[8]+")"}function L(F){return Math.hypot(F[0],F[1],F[2],F[3],F[4],F[5],F[6],F[7],F[8])}function j(F,Q,tt){return F[0]=Q[0]+tt[0],F[1]=Q[1]+tt[1],F[2]=Q[2]+tt[2],F[3]=Q[3]+tt[3],F[4]=Q[4]+tt[4],F[5]=Q[5]+tt[5],F[6]=Q[6]+tt[6],F[7]=Q[7]+tt[7],F[8]=Q[8]+tt[8],F}function b(F,Q,tt){return F[0]=Q[0]-tt[0],F[1]=Q[1]-tt[1],F[2]=Q[2]-tt[2],F[3]=Q[3]-tt[3],F[4]=Q[4]-tt[4],F[5]=Q[5]-tt[5],F[6]=Q[6]-tt[6],F[7]=Q[7]-tt[7],F[8]=Q[8]-tt[8],F}function O(F,Q,tt){return F[0]=Q[0]*tt,F[1]=Q[1]*tt,F[2]=Q[2]*tt,F[3]=Q[3]*tt,F[4]=Q[4]*tt,F[5]=Q[5]*tt,F[6]=Q[6]*tt,F[7]=Q[7]*tt,F[8]=Q[8]*tt,F}function Y(F,Q,tt,lt){return F[0]=Q[0]+tt[0]*lt,F[1]=Q[1]+tt[1]*lt,F[2]=Q[2]+tt[2]*lt,F[3]=Q[3]+tt[3]*lt,F[4]=Q[4]+tt[4]*lt,F[5]=Q[5]+tt[5]*lt,F[6]=Q[6]+tt[6]*lt,F[7]=Q[7]+tt[7]*lt,F[8]=Q[8]+tt[8]*lt,F}function X(F,Q){return F[0]===Q[0]&&F[1]===Q[1]&&F[2]===Q[2]&&F[3]===Q[3]&&F[4]===Q[4]&&F[5]===Q[5]&&F[6]===Q[6]&&F[7]===Q[7]&&F[8]===Q[8]}function Z(F,Q){var tt=F[0],lt=F[1],ct=F[2],Mt=F[3],st=F[4],Tt=F[5],xt=F[6],W=F[7],k=F[8],q=Q[0],_=Q[1],U=Q[2],H=Q[3],E=Q[4],w=Q[5],B=Q[6],G=Q[7],K=Q[8];return Math.abs(tt-q)<=r.EPSILON*Math.max(1,Math.abs(tt),Math.abs(q))&&Math.abs(lt-_)<=r.EPSILON*Math.max(1,Math.abs(lt),Math.abs(_))&&Math.abs(ct-U)<=r.EPSILON*Math.max(1,Math.abs(ct),Math.abs(U))&&Math.abs(Mt-H)<=r.EPSILON*Math.max(1,Math.abs(Mt),Math.abs(H))&&Math.abs(st-E)<=r.EPSILON*Math.max(1,Math.abs(st),Math.abs(E))&&Math.abs(Tt-w)<=r.EPSILON*Math.max(1,Math.abs(Tt),Math.abs(w))&&Math.abs(xt-B)<=r.EPSILON*Math.max(1,Math.abs(xt),Math.abs(B))&&Math.abs(W-G)<=r.EPSILON*Math.max(1,Math.abs(W),Math.abs(G))&&Math.abs(k-K)<=r.EPSILON*Math.max(1,Math.abs(k),Math.abs(K))}var $=x,rt=b}),(function(o,t,e){e.r(t),e.d(t,"create",function(){return n}),e.d(t,"clone",function(){return i}),e.d(t,"copy",function(){return a}),e.d(t,"fromValues",function(){return s}),e.d(t,"set",function(){return u}),e.d(t,"identity",function(){return d}),e.d(t,"transpose",function(){return M}),e.d(t,"invert",function(){return c}),e.d(t,"adjoint",function(){return v}),e.d(t,"determinant",function(){return p}),e.d(t,"multiply",function(){return T}),e.d(t,"translate",function(){return x}),e.d(t,"scale",function(){return y}),e.d(t,"rotate",function(){return C}),e.d(t,"rotateX",function(){return h}),e.d(t,"rotateY",function(){return g}),e.d(t,"rotateZ",function(){return f}),e.d(t,"fromTranslation",function(){return m}),e.d(t,"fromScaling",function(){return S}),e.d(t,"fromRotation",function(){return A}),e.d(t,"fromXRotation",function(){return P}),e.d(t,"fromYRotation",function(){return R}),e.d(t,"fromZRotation",function(){return D}),e.d(t,"fromRotationTranslation",function(){return L}),e.d(t,"fromQuat2",function(){return j}),e.d(t,"getTranslation",function(){return b}),e.d(t,"getScaling",function(){return O}),e.d(t,"getRotation",function(){return Y}),e.d(t,"fromRotationTranslationScale",function(){return X}),e.d(t,"fromRotationTranslationScaleOrigin",function(){return Z}),e.d(t,"fromQuat",function(){return $}),e.d(t,"frustum",function(){return rt}),e.d(t,"perspective",function(){return F}),e.d(t,"perspectiveFromFieldOfView",function(){return Q}),e.d(t,"ortho",function(){return tt}),e.d(t,"lookAt",function(){return lt}),e.d(t,"targetTo",function(){return ct}),e.d(t,"str",function(){return Mt}),e.d(t,"frob",function(){return st}),e.d(t,"add",function(){return Tt}),e.d(t,"subtract",function(){return xt}),e.d(t,"multiplyScalar",function(){return W}),e.d(t,"multiplyScalarAndAdd",function(){return k}),e.d(t,"exactEquals",function(){return q}),e.d(t,"equals",function(){return _}),e.d(t,"mul",function(){return U}),e.d(t,"sub",function(){return H});var r=e(2);function n(){var E=new r.ARRAY_TYPE(16);return r.ARRAY_TYPE!=Float32Array&&(E[1]=0,E[2]=0,E[3]=0,E[4]=0,E[6]=0,E[7]=0,E[8]=0,E[9]=0,E[11]=0,E[12]=0,E[13]=0,E[14]=0),E[0]=1,E[5]=1,E[10]=1,E[15]=1,E}function i(E){var w=new r.ARRAY_TYPE(16);return w[0]=E[0],w[1]=E[1],w[2]=E[2],w[3]=E[3],w[4]=E[4],w[5]=E[5],w[6]=E[6],w[7]=E[7],w[8]=E[8],w[9]=E[9],w[10]=E[10],w[11]=E[11],w[12]=E[12],w[13]=E[13],w[14]=E[14],w[15]=E[15],w}function a(E,w){return E[0]=w[0],E[1]=w[1],E[2]=w[2],E[3]=w[3],E[4]=w[4],E[5]=w[5],E[6]=w[6],E[7]=w[7],E[8]=w[8],E[9]=w[9],E[10]=w[10],E[11]=w[11],E[12]=w[12],E[13]=w[13],E[14]=w[14],E[15]=w[15],E}function s(E,w,B,G,K,et,at,ut,gt,yt,Ct,vt,mt,It,wt,bt){var Nt=new r.ARRAY_TYPE(16);return Nt[0]=E,Nt[1]=w,Nt[2]=B,Nt[3]=G,Nt[4]=K,Nt[5]=et,Nt[6]=at,Nt[7]=ut,Nt[8]=gt,Nt[9]=yt,Nt[10]=Ct,Nt[11]=vt,Nt[12]=mt,Nt[13]=It,Nt[14]=wt,Nt[15]=bt,Nt}function u(E,w,B,G,K,et,at,ut,gt,yt,Ct,vt,mt,It,wt,bt,Nt){return E[0]=w,E[1]=B,E[2]=G,E[3]=K,E[4]=et,E[5]=at,E[6]=ut,E[7]=gt,E[8]=yt,E[9]=Ct,E[10]=vt,E[11]=mt,E[12]=It,E[13]=wt,E[14]=bt,E[15]=Nt,E}function d(E){return E[0]=1,E[1]=0,E[2]=0,E[3]=0,E[4]=0,E[5]=1,E[6]=0,E[7]=0,E[8]=0,E[9]=0,E[10]=1,E[11]=0,E[12]=0,E[13]=0,E[14]=0,E[15]=1,E}function M(E,w){if(E===w){var B=w[1],G=w[2],K=w[3],et=w[6],at=w[7],ut=w[11];E[1]=w[4],E[2]=w[8],E[3]=w[12],E[4]=B,E[6]=w[9],E[7]=w[13],E[8]=G,E[9]=et,E[11]=w[14],E[12]=K,E[13]=at,E[14]=ut}else E[0]=w[0],E[1]=w[4],E[2]=w[8],E[3]=w[12],E[4]=w[1],E[5]=w[5],E[6]=w[9],E[7]=w[13],E[8]=w[2],E[9]=w[6],E[10]=w[10],E[11]=w[14],E[12]=w[3],E[13]=w[7],E[14]=w[11],E[15]=w[15];return E}function c(E,w){var B=w[0],G=w[1],K=w[2],et=w[3],at=w[4],ut=w[5],gt=w[6],yt=w[7],Ct=w[8],vt=w[9],mt=w[10],It=w[11],wt=w[12],bt=w[13],Nt=w[14],Yt=w[15],$t=B*ut-G*at,Gt=B*gt-K*at,kt=B*yt-et*at,Kt=G*gt-K*ut,Zt=G*yt-et*ut,de=K*yt-et*gt,le=Ct*bt-vt*wt,he=Ct*Nt-mt*wt,fe=Ct*Yt-It*wt,ge=vt*Nt-mt*bt,pe=vt*Yt-It*bt,Me=mt*Yt-It*Nt,te=$t*Me-Gt*pe+kt*ge+Kt*fe-Zt*he+de*le;return te?(te=1/te,E[0]=(ut*Me-gt*pe+yt*ge)*te,E[1]=(K*pe-G*Me-et*ge)*te,E[2]=(bt*de-Nt*Zt+Yt*Kt)*te,E[3]=(mt*Zt-vt*de-It*Kt)*te,E[4]=(gt*fe-at*Me-yt*he)*te,E[5]=(B*Me-K*fe+et*he)*te,E[6]=(Nt*kt-wt*de-Yt*Gt)*te,E[7]=(Ct*de-mt*kt+It*Gt)*te,E[8]=(at*pe-ut*fe+yt*le)*te,E[9]=(G*fe-B*pe-et*le)*te,E[10]=(wt*Zt-bt*kt+Yt*$t)*te,E[11]=(vt*kt-Ct*Zt-It*$t)*te,E[12]=(ut*he-at*ge-gt*le)*te,E[13]=(B*ge-G*he+K*le)*te,E[14]=(bt*Gt-wt*Kt-Nt*$t)*te,E[15]=(Ct*Kt-vt*Gt+mt*$t)*te,E):null}function v(E,w){var B=w[0],G=w[1],K=w[2],et=w[3],at=w[4],ut=w[5],gt=w[6],yt=w[7],Ct=w[8],vt=w[9],mt=w[10],It=w[11],wt=w[12],bt=w[13],Nt=w[14],Yt=w[15];return E[0]=ut*(mt*Yt-It*Nt)-vt*(gt*Yt-yt*Nt)+bt*(gt*It-yt*mt),E[1]=-(G*(mt*Yt-It*Nt)-vt*(K*Yt-et*Nt)+bt*(K*It-et*mt)),E[2]=G*(gt*Yt-yt*Nt)-ut*(K*Yt-et*Nt)+bt*(K*yt-et*gt),E[3]=-(G*(gt*It-yt*mt)-ut*(K*It-et*mt)+vt*(K*yt-et*gt)),E[4]=-(at*(mt*Yt-It*Nt)-Ct*(gt*Yt-yt*Nt)+wt*(gt*It-yt*mt)),E[5]=B*(mt*Yt-It*Nt)-Ct*(K*Yt-et*Nt)+wt*(K*It-et*mt),E[6]=-(B*(gt*Yt-yt*Nt)-at*(K*Yt-et*Nt)+wt*(K*yt-et*gt)),E[7]=B*(gt*It-yt*mt)-at*(K*It-et*mt)+Ct*(K*yt-et*gt),E[8]=at*(vt*Yt-It*bt)-Ct*(ut*Yt-yt*bt)+wt*(ut*It-yt*vt),E[9]=-(B*(vt*Yt-It*bt)-Ct*(G*Yt-et*bt)+wt*(G*It-et*vt)),E[10]=B*(ut*Yt-yt*bt)-at*(G*Yt-et*bt)+wt*(G*yt-et*ut),E[11]=-(B*(ut*It-yt*vt)-at*(G*It-et*vt)+Ct*(G*yt-et*ut)),E[12]=-(at*(vt*Nt-mt*bt)-Ct*(ut*Nt-gt*bt)+wt*(ut*mt-gt*vt)),E[13]=B*(vt*Nt-mt*bt)-Ct*(G*Nt-K*bt)+wt*(G*mt-K*vt),E[14]=-(B*(ut*Nt-gt*bt)-at*(G*Nt-K*bt)+wt*(G*gt-K*ut)),E[15]=B*(ut*mt-gt*vt)-at*(G*mt-K*vt)+Ct*(G*gt-K*ut),E}function p(E){var w=E[0],B=E[1],G=E[2],K=E[3],et=E[4],at=E[5],ut=E[6],gt=E[7],yt=E[8],Ct=E[9],vt=E[10],mt=E[11],It=E[12],wt=E[13],bt=E[14],Nt=E[15],Yt=w*at-B*et,$t=w*ut-G*et,Gt=w*gt-K*et,kt=B*ut-G*at,Kt=B*gt-K*at,Zt=G*gt-K*ut,de=yt*wt-Ct*It,le=yt*bt-vt*It,he=yt*Nt-mt*It,fe=Ct*bt-vt*wt,ge=Ct*Nt-mt*wt,pe=vt*Nt-mt*bt;return Yt*pe-$t*ge+Gt*fe+kt*he-Kt*le+Zt*de}function T(E,w,B){var G=w[0],K=w[1],et=w[2],at=w[3],ut=w[4],gt=w[5],yt=w[6],Ct=w[7],vt=w[8],mt=w[9],It=w[10],wt=w[11],bt=w[12],Nt=w[13],Yt=w[14],$t=w[15],Gt=B[0],kt=B[1],Kt=B[2],Zt=B[3];return E[0]=Gt*G+kt*ut+Kt*vt+Zt*bt,E[1]=Gt*K+kt*gt+Kt*mt+Zt*Nt,E[2]=Gt*et+kt*yt+Kt*It+Zt*Yt,E[3]=Gt*at+kt*Ct+Kt*wt+Zt*$t,Gt=B[4],kt=B[5],Kt=B[6],Zt=B[7],E[4]=Gt*G+kt*ut+Kt*vt+Zt*bt,E[5]=Gt*K+kt*gt+Kt*mt+Zt*Nt,E[6]=Gt*et+kt*yt+Kt*It+Zt*Yt,E[7]=Gt*at+kt*Ct+Kt*wt+Zt*$t,Gt=B[8],kt=B[9],Kt=B[10],Zt=B[11],E[8]=Gt*G+kt*ut+Kt*vt+Zt*bt,E[9]=Gt*K+kt*gt+Kt*mt+Zt*Nt,E[10]=Gt*et+kt*yt+Kt*It+Zt*Yt,E[11]=Gt*at+kt*Ct+Kt*wt+Zt*$t,Gt=B[12],kt=B[13],Kt=B[14],Zt=B[15],E[12]=Gt*G+kt*ut+Kt*vt+Zt*bt,E[13]=Gt*K+kt*gt+Kt*mt+Zt*Nt,E[14]=Gt*et+kt*yt+Kt*It+Zt*Yt,E[15]=Gt*at+kt*Ct+Kt*wt+Zt*$t,E}function x(E,w,B){var G=B[0],K=B[1],et=B[2],at,ut,gt,yt,Ct,vt,mt,It,wt,bt,Nt,Yt;return w===E?(E[12]=w[0]*G+w[4]*K+w[8]*et+w[12],E[13]=w[1]*G+w[5]*K+w[9]*et+w[13],E[14]=w[2]*G+w[6]*K+w[10]*et+w[14],E[15]=w[3]*G+w[7]*K+w[11]*et+w[15]):(at=w[0],ut=w[1],gt=w[2],yt=w[3],Ct=w[4],vt=w[5],mt=w[6],It=w[7],wt=w[8],bt=w[9],Nt=w[10],Yt=w[11],E[0]=at,E[1]=ut,E[2]=gt,E[3]=yt,E[4]=Ct,E[5]=vt,E[6]=mt,E[7]=It,E[8]=wt,E[9]=bt,E[10]=Nt,E[11]=Yt,E[12]=at*G+Ct*K+wt*et+w[12],E[13]=ut*G+vt*K+bt*et+w[13],E[14]=gt*G+mt*K+Nt*et+w[14],E[15]=yt*G+It*K+Yt*et+w[15]),E}function y(E,w,B){var G=B[0],K=B[1],et=B[2];return E[0]=w[0]*G,E[1]=w[1]*G,E[2]=w[2]*G,E[3]=w[3]*G,E[4]=w[4]*K,E[5]=w[5]*K,E[6]=w[6]*K,E[7]=w[7]*K,E[8]=w[8]*et,E[9]=w[9]*et,E[10]=w[10]*et,E[11]=w[11]*et,E[12]=w[12],E[13]=w[13],E[14]=w[14],E[15]=w[15],E}function C(E,w,B,G){var K=G[0],et=G[1],at=G[2],ut=Math.hypot(K,et,at),gt,yt,Ct,vt,mt,It,wt,bt,Nt,Yt,$t,Gt,kt,Kt,Zt,de,le,he,fe,ge,pe,Me,te,De;return ut<r.EPSILON?null:(ut=1/ut,K*=ut,et*=ut,at*=ut,gt=Math.sin(B),yt=Math.cos(B),Ct=1-yt,vt=w[0],mt=w[1],It=w[2],wt=w[3],bt=w[4],Nt=w[5],Yt=w[6],$t=w[7],Gt=w[8],kt=w[9],Kt=w[10],Zt=w[11],de=K*K*Ct+yt,le=et*K*Ct+at*gt,he=at*K*Ct-et*gt,fe=K*et*Ct-at*gt,ge=et*et*Ct+yt,pe=at*et*Ct+K*gt,Me=K*at*Ct+et*gt,te=et*at*Ct-K*gt,De=at*at*Ct+yt,E[0]=vt*de+bt*le+Gt*he,E[1]=mt*de+Nt*le+kt*he,E[2]=It*de+Yt*le+Kt*he,E[3]=wt*de+$t*le+Zt*he,E[4]=vt*fe+bt*ge+Gt*pe,E[5]=mt*fe+Nt*ge+kt*pe,E[6]=It*fe+Yt*ge+Kt*pe,E[7]=wt*fe+$t*ge+Zt*pe,E[8]=vt*Me+bt*te+Gt*De,E[9]=mt*Me+Nt*te+kt*De,E[10]=It*Me+Yt*te+Kt*De,E[11]=wt*Me+$t*te+Zt*De,w!==E&&(E[12]=w[12],E[13]=w[13],E[14]=w[14],E[15]=w[15]),E)}function h(E,w,B){var G=Math.sin(B),K=Math.cos(B),et=w[4],at=w[5],ut=w[6],gt=w[7],yt=w[8],Ct=w[9],vt=w[10],mt=w[11];return w!==E&&(E[0]=w[0],E[1]=w[1],E[2]=w[2],E[3]=w[3],E[12]=w[12],E[13]=w[13],E[14]=w[14],E[15]=w[15]),E[4]=et*K+yt*G,E[5]=at*K+Ct*G,E[6]=ut*K+vt*G,E[7]=gt*K+mt*G,E[8]=yt*K-et*G,E[9]=Ct*K-at*G,E[10]=vt*K-ut*G,E[11]=mt*K-gt*G,E}function g(E,w,B){var G=Math.sin(B),K=Math.cos(B),et=w[0],at=w[1],ut=w[2],gt=w[3],yt=w[8],Ct=w[9],vt=w[10],mt=w[11];return w!==E&&(E[4]=w[4],E[5]=w[5],E[6]=w[6],E[7]=w[7],E[12]=w[12],E[13]=w[13],E[14]=w[14],E[15]=w[15]),E[0]=et*K-yt*G,E[1]=at*K-Ct*G,E[2]=ut*K-vt*G,E[3]=gt*K-mt*G,E[8]=et*G+yt*K,E[9]=at*G+Ct*K,E[10]=ut*G+vt*K,E[11]=gt*G+mt*K,E}function f(E,w,B){var G=Math.sin(B),K=Math.cos(B),et=w[0],at=w[1],ut=w[2],gt=w[3],yt=w[4],Ct=w[5],vt=w[6],mt=w[7];return w!==E&&(E[8]=w[8],E[9]=w[9],E[10]=w[10],E[11]=w[11],E[12]=w[12],E[13]=w[13],E[14]=w[14],E[15]=w[15]),E[0]=et*K+yt*G,E[1]=at*K+Ct*G,E[2]=ut*K+vt*G,E[3]=gt*K+mt*G,E[4]=yt*K-et*G,E[5]=Ct*K-at*G,E[6]=vt*K-ut*G,E[7]=mt*K-gt*G,E}function m(E,w){return E[0]=1,E[1]=0,E[2]=0,E[3]=0,E[4]=0,E[5]=1,E[6]=0,E[7]=0,E[8]=0,E[9]=0,E[10]=1,E[11]=0,E[12]=w[0],E[13]=w[1],E[14]=w[2],E[15]=1,E}function S(E,w){return E[0]=w[0],E[1]=0,E[2]=0,E[3]=0,E[4]=0,E[5]=w[1],E[6]=0,E[7]=0,E[8]=0,E[9]=0,E[10]=w[2],E[11]=0,E[12]=0,E[13]=0,E[14]=0,E[15]=1,E}function A(E,w,B){var G=B[0],K=B[1],et=B[2],at=Math.hypot(G,K,et),ut,gt,yt;return at<r.EPSILON?null:(at=1/at,G*=at,K*=at,et*=at,ut=Math.sin(w),gt=Math.cos(w),yt=1-gt,E[0]=G*G*yt+gt,E[1]=K*G*yt+et*ut,E[2]=et*G*yt-K*ut,E[3]=0,E[4]=G*K*yt-et*ut,E[5]=K*K*yt+gt,E[6]=et*K*yt+G*ut,E[7]=0,E[8]=G*et*yt+K*ut,E[9]=K*et*yt-G*ut,E[10]=et*et*yt+gt,E[11]=0,E[12]=0,E[13]=0,E[14]=0,E[15]=1,E)}function P(E,w){var B=Math.sin(w),G=Math.cos(w);return E[0]=1,E[1]=0,E[2]=0,E[3]=0,E[4]=0,E[5]=G,E[6]=B,E[7]=0,E[8]=0,E[9]=-B,E[10]=G,E[11]=0,E[12]=0,E[13]=0,E[14]=0,E[15]=1,E}function R(E,w){var B=Math.sin(w),G=Math.cos(w);return E[0]=G,E[1]=0,E[2]=-B,E[3]=0,E[4]=0,E[5]=1,E[6]=0,E[7]=0,E[8]=B,E[9]=0,E[10]=G,E[11]=0,E[12]=0,E[13]=0,E[14]=0,E[15]=1,E}function D(E,w){var B=Math.sin(w),G=Math.cos(w);return E[0]=G,E[1]=B,E[2]=0,E[3]=0,E[4]=-B,E[5]=G,E[6]=0,E[7]=0,E[8]=0,E[9]=0,E[10]=1,E[11]=0,E[12]=0,E[13]=0,E[14]=0,E[15]=1,E}function L(E,w,B){var G=w[0],K=w[1],et=w[2],at=w[3],ut=G+G,gt=K+K,yt=et+et,Ct=G*ut,vt=G*gt,mt=G*yt,It=K*gt,wt=K*yt,bt=et*yt,Nt=at*ut,Yt=at*gt,$t=at*yt;return E[0]=1-(It+bt),E[1]=vt+$t,E[2]=mt-Yt,E[3]=0,E[4]=vt-$t,E[5]=1-(Ct+bt),E[6]=wt+Nt,E[7]=0,E[8]=mt+Yt,E[9]=wt-Nt,E[10]=1-(Ct+It),E[11]=0,E[12]=B[0],E[13]=B[1],E[14]=B[2],E[15]=1,E}function j(E,w){var B=new r.ARRAY_TYPE(3),G=-w[0],K=-w[1],et=-w[2],at=w[3],ut=w[4],gt=w[5],yt=w[6],Ct=w[7],vt=G*G+K*K+et*et+at*at;return vt>0?(B[0]=(ut*at+Ct*G+gt*et-yt*K)*2/vt,B[1]=(gt*at+Ct*K+yt*G-ut*et)*2/vt,B[2]=(yt*at+Ct*et+ut*K-gt*G)*2/vt):(B[0]=(ut*at+Ct*G+gt*et-yt*K)*2,B[1]=(gt*at+Ct*K+yt*G-ut*et)*2,B[2]=(yt*at+Ct*et+ut*K-gt*G)*2),L(E,w,B),E}function b(E,w){return E[0]=w[12],E[1]=w[13],E[2]=w[14],E}function O(E,w){var B=w[0],G=w[1],K=w[2],et=w[4],at=w[5],ut=w[6],gt=w[8],yt=w[9],Ct=w[10];return E[0]=Math.hypot(B,G,K),E[1]=Math.hypot(et,at,ut),E[2]=Math.hypot(gt,yt,Ct),E}function Y(E,w){var B=new r.ARRAY_TYPE(3);O(B,w);var G=1/B[0],K=1/B[1],et=1/B[2],at=w[0]*G,ut=w[1]*K,gt=w[2]*et,yt=w[4]*G,Ct=w[5]*K,vt=w[6]*et,mt=w[8]*G,It=w[9]*K,wt=w[10]*et,bt=at+Ct+wt,Nt=0;return bt>0?(Nt=Math.sqrt(bt+1)*2,E[3]=.25*Nt,E[0]=(vt-It)/Nt,E[1]=(mt-gt)/Nt,E[2]=(ut-yt)/Nt):at>Ct&&at>wt?(Nt=Math.sqrt(1+at-Ct-wt)*2,E[3]=(vt-It)/Nt,E[0]=.25*Nt,E[1]=(ut+yt)/Nt,E[2]=(mt+gt)/Nt):Ct>wt?(Nt=Math.sqrt(1+Ct-at-wt)*2,E[3]=(mt-gt)/Nt,E[0]=(ut+yt)/Nt,E[1]=.25*Nt,E[2]=(vt+It)/Nt):(Nt=Math.sqrt(1+wt-at-Ct)*2,E[3]=(ut-yt)/Nt,E[0]=(mt+gt)/Nt,E[1]=(vt+It)/Nt,E[2]=.25*Nt),E}function X(E,w,B,G){var K=w[0],et=w[1],at=w[2],ut=w[3],gt=K+K,yt=et+et,Ct=at+at,vt=K*gt,mt=K*yt,It=K*Ct,wt=et*yt,bt=et*Ct,Nt=at*Ct,Yt=ut*gt,$t=ut*yt,Gt=ut*Ct,kt=G[0],Kt=G[1],Zt=G[2];return E[0]=(1-(wt+Nt))*kt,E[1]=(mt+Gt)*kt,E[2]=(It-$t)*kt,E[3]=0,E[4]=(mt-Gt)*Kt,E[5]=(1-(vt+Nt))*Kt,E[6]=(bt+Yt)*Kt,E[7]=0,E[8]=(It+$t)*Zt,E[9]=(bt-Yt)*Zt,E[10]=(1-(vt+wt))*Zt,E[11]=0,E[12]=B[0],E[13]=B[1],E[14]=B[2],E[15]=1,E}function Z(E,w,B,G,K){var et=w[0],at=w[1],ut=w[2],gt=w[3],yt=et+et,Ct=at+at,vt=ut+ut,mt=et*yt,It=et*Ct,wt=et*vt,bt=at*Ct,Nt=at*vt,Yt=ut*vt,$t=gt*yt,Gt=gt*Ct,kt=gt*vt,Kt=G[0],Zt=G[1],de=G[2],le=K[0],he=K[1],fe=K[2],ge=(1-(bt+Yt))*Kt,pe=(It+kt)*Kt,Me=(wt-Gt)*Kt,te=(It-kt)*Zt,De=(1-(mt+Yt))*Zt,_e=(Nt+$t)*Zt,tr=(wt+Gt)*de,zr=(Nt-$t)*de,Br=(1-(mt+bt))*de;return E[0]=ge,E[1]=pe,E[2]=Me,E[3]=0,E[4]=te,E[5]=De,E[6]=_e,E[7]=0,E[8]=tr,E[9]=zr,E[10]=Br,E[11]=0,E[12]=B[0]+le-(ge*le+te*he+tr*fe),E[13]=B[1]+he-(pe*le+De*he+zr*fe),E[14]=B[2]+fe-(Me*le+_e*he+Br*fe),E[15]=1,E}function $(E,w){var B=w[0],G=w[1],K=w[2],et=w[3],at=B+B,ut=G+G,gt=K+K,yt=B*at,Ct=G*at,vt=G*ut,mt=K*at,It=K*ut,wt=K*gt,bt=et*at,Nt=et*ut,Yt=et*gt;return E[0]=1-vt-wt,E[1]=Ct+Yt,E[2]=mt-Nt,E[3]=0,E[4]=Ct-Yt,E[5]=1-yt-wt,E[6]=It+bt,E[7]=0,E[8]=mt+Nt,E[9]=It-bt,E[10]=1-yt-vt,E[11]=0,E[12]=0,E[13]=0,E[14]=0,E[15]=1,E}function rt(E,w,B,G,K,et,at){var ut=1/(B-w),gt=1/(K-G),yt=1/(et-at);return E[0]=et*2*ut,E[1]=0,E[2]=0,E[3]=0,E[4]=0,E[5]=et*2*gt,E[6]=0,E[7]=0,E[8]=(B+w)*ut,E[9]=(K+G)*gt,E[10]=(at+et)*yt,E[11]=-1,E[12]=0,E[13]=0,E[14]=at*et*2*yt,E[15]=0,E}function F(E,w,B,G,K){var et=1/Math.tan(w/2),at;return E[0]=et/B,E[1]=0,E[2]=0,E[3]=0,E[4]=0,E[5]=et,E[6]=0,E[7]=0,E[8]=0,E[9]=0,E[11]=-1,E[12]=0,E[13]=0,E[15]=0,K!=null&&K!==1/0?(at=1/(G-K),E[10]=(K+G)*at,E[14]=2*K*G*at):(E[10]=-1,E[14]=-2*G),E}function Q(E,w,B,G){var K=Math.tan(w.upDegrees*Math.PI/180),et=Math.tan(w.downDegrees*Math.PI/180),at=Math.tan(w.leftDegrees*Math.PI/180),ut=Math.tan(w.rightDegrees*Math.PI/180),gt=2/(at+ut),yt=2/(K+et);return E[0]=gt,E[1]=0,E[2]=0,E[3]=0,E[4]=0,E[5]=yt,E[6]=0,E[7]=0,E[8]=-((at-ut)*gt*.5),E[9]=(K-et)*yt*.5,E[10]=G/(B-G),E[11]=-1,E[12]=0,E[13]=0,E[14]=G*B/(B-G),E[15]=0,E}function tt(E,w,B,G,K,et,at){var ut=1/(w-B),gt=1/(G-K),yt=1/(et-at);return E[0]=-2*ut,E[1]=0,E[2]=0,E[3]=0,E[4]=0,E[5]=-2*gt,E[6]=0,E[7]=0,E[8]=0,E[9]=0,E[10]=2*yt,E[11]=0,E[12]=(w+B)*ut,E[13]=(K+G)*gt,E[14]=(at+et)*yt,E[15]=1,E}function lt(E,w,B,G){var K,et,at,ut,gt,yt,Ct,vt,mt,It,wt=w[0],bt=w[1],Nt=w[2],Yt=G[0],$t=G[1],Gt=G[2],kt=B[0],Kt=B[1],Zt=B[2];return Math.abs(wt-kt)<r.EPSILON&&Math.abs(bt-Kt)<r.EPSILON&&Math.abs(Nt-Zt)<r.EPSILON?d(E):(Ct=wt-kt,vt=bt-Kt,mt=Nt-Zt,It=1/Math.hypot(Ct,vt,mt),Ct*=It,vt*=It,mt*=It,K=$t*mt-Gt*vt,et=Gt*Ct-Yt*mt,at=Yt*vt-$t*Ct,It=Math.hypot(K,et,at),It?(It=1/It,K*=It,et*=It,at*=It):(K=0,et=0,at=0),ut=vt*at-mt*et,gt=mt*K-Ct*at,yt=Ct*et-vt*K,It=Math.hypot(ut,gt,yt),It?(It=1/It,ut*=It,gt*=It,yt*=It):(ut=0,gt=0,yt=0),E[0]=K,E[1]=ut,E[2]=Ct,E[3]=0,E[4]=et,E[5]=gt,E[6]=vt,E[7]=0,E[8]=at,E[9]=yt,E[10]=mt,E[11]=0,E[12]=-(K*wt+et*bt+at*Nt),E[13]=-(ut*wt+gt*bt+yt*Nt),E[14]=-(Ct*wt+vt*bt+mt*Nt),E[15]=1,E)}function ct(E,w,B,G){var K=w[0],et=w[1],at=w[2],ut=G[0],gt=G[1],yt=G[2],Ct=K-B[0],vt=et-B[1],mt=at-B[2],It=Ct*Ct+vt*vt+mt*mt;It>0&&(It=1/Math.sqrt(It),Ct*=It,vt*=It,mt*=It);var wt=gt*mt-yt*vt,bt=yt*Ct-ut*mt,Nt=ut*vt-gt*Ct;return It=wt*wt+bt*bt+Nt*Nt,It>0&&(It=1/Math.sqrt(It),wt*=It,bt*=It,Nt*=It),E[0]=wt,E[1]=bt,E[2]=Nt,E[3]=0,E[4]=vt*Nt-mt*bt,E[5]=mt*wt-Ct*Nt,E[6]=Ct*bt-vt*wt,E[7]=0,E[8]=Ct,E[9]=vt,E[10]=mt,E[11]=0,E[12]=K,E[13]=et,E[14]=at,E[15]=1,E}function Mt(E){return"mat4("+E[0]+", "+E[1]+", "+E[2]+", "+E[3]+", "+E[4]+", "+E[5]+", "+E[6]+", "+E[7]+", "+E[8]+", "+E[9]+", "+E[10]+", "+E[11]+", "+E[12]+", "+E[13]+", "+E[14]+", "+E[15]+")"}function st(E){return Math.hypot(E[0],E[1],E[2],E[3],E[4],E[5],E[6],E[7],E[8],E[9],E[10],E[11],E[12],E[13],E[14],E[15])}function Tt(E,w,B){return E[0]=w[0]+B[0],E[1]=w[1]+B[1],E[2]=w[2]+B[2],E[3]=w[3]+B[3],E[4]=w[4]+B[4],E[5]=w[5]+B[5],E[6]=w[6]+B[6],E[7]=w[7]+B[7],E[8]=w[8]+B[8],E[9]=w[9]+B[9],E[10]=w[10]+B[10],E[11]=w[11]+B[11],E[12]=w[12]+B[12],E[13]=w[13]+B[13],E[14]=w[14]+B[14],E[15]=w[15]+B[15],E}function xt(E,w,B){return E[0]=w[0]-B[0],E[1]=w[1]-B[1],E[2]=w[2]-B[2],E[3]=w[3]-B[3],E[4]=w[4]-B[4],E[5]=w[5]-B[5],E[6]=w[6]-B[6],E[7]=w[7]-B[7],E[8]=w[8]-B[8],E[9]=w[9]-B[9],E[10]=w[10]-B[10],E[11]=w[11]-B[11],E[12]=w[12]-B[12],E[13]=w[13]-B[13],E[14]=w[14]-B[14],E[15]=w[15]-B[15],E}function W(E,w,B){return E[0]=w[0]*B,E[1]=w[1]*B,E[2]=w[2]*B,E[3]=w[3]*B,E[4]=w[4]*B,E[5]=w[5]*B,E[6]=w[6]*B,E[7]=w[7]*B,E[8]=w[8]*B,E[9]=w[9]*B,E[10]=w[10]*B,E[11]=w[11]*B,E[12]=w[12]*B,E[13]=w[13]*B,E[14]=w[14]*B,E[15]=w[15]*B,E}function k(E,w,B,G){return E[0]=w[0]+B[0]*G,E[1]=w[1]+B[1]*G,E[2]=w[2]+B[2]*G,E[3]=w[3]+B[3]*G,E[4]=w[4]+B[4]*G,E[5]=w[5]+B[5]*G,E[6]=w[6]+B[6]*G,E[7]=w[7]+B[7]*G,E[8]=w[8]+B[8]*G,E[9]=w[9]+B[9]*G,E[10]=w[10]+B[10]*G,E[11]=w[11]+B[11]*G,E[12]=w[12]+B[12]*G,E[13]=w[13]+B[13]*G,E[14]=w[14]+B[14]*G,E[15]=w[15]+B[15]*G,E}function q(E,w){return E[0]===w[0]&&E[1]===w[1]&&E[2]===w[2]&&E[3]===w[3]&&E[4]===w[4]&&E[5]===w[5]&&E[6]===w[6]&&E[7]===w[7]&&E[8]===w[8]&&E[9]===w[9]&&E[10]===w[10]&&E[11]===w[11]&&E[12]===w[12]&&E[13]===w[13]&&E[14]===w[14]&&E[15]===w[15]}function _(E,w){var B=E[0],G=E[1],K=E[2],et=E[3],at=E[4],ut=E[5],gt=E[6],yt=E[7],Ct=E[8],vt=E[9],mt=E[10],It=E[11],wt=E[12],bt=E[13],Nt=E[14],Yt=E[15],$t=w[0],Gt=w[1],kt=w[2],Kt=w[3],Zt=w[4],de=w[5],le=w[6],he=w[7],fe=w[8],ge=w[9],pe=w[10],Me=w[11],te=w[12],De=w[13],_e=w[14],tr=w[15];return Math.abs(B-$t)<=r.EPSILON*Math.max(1,Math.abs(B),Math.abs($t))&&Math.abs(G-Gt)<=r.EPSILON*Math.max(1,Math.abs(G),Math.abs(Gt))&&Math.abs(K-kt)<=r.EPSILON*Math.max(1,Math.abs(K),Math.abs(kt))&&Math.abs(et-Kt)<=r.EPSILON*Math.max(1,Math.abs(et),Math.abs(Kt))&&Math.abs(at-Zt)<=r.EPSILON*Math.max(1,Math.abs(at),Math.abs(Zt))&&Math.abs(ut-de)<=r.EPSILON*Math.max(1,Math.abs(ut),Math.abs(de))&&Math.abs(gt-le)<=r.EPSILON*Math.max(1,Math.abs(gt),Math.abs(le))&&Math.abs(yt-he)<=r.EPSILON*Math.max(1,Math.abs(yt),Math.abs(he))&&Math.abs(Ct-fe)<=r.EPSILON*Math.max(1,Math.abs(Ct),Math.abs(fe))&&Math.abs(vt-ge)<=r.EPSILON*Math.max(1,Math.abs(vt),Math.abs(ge))&&Math.abs(mt-pe)<=r.EPSILON*Math.max(1,Math.abs(mt),Math.abs(pe))&&Math.abs(It-Me)<=r.EPSILON*Math.max(1,Math.abs(It),Math.abs(Me))&&Math.abs(wt-te)<=r.EPSILON*Math.max(1,Math.abs(wt),Math.abs(te))&&Math.abs(bt-De)<=r.EPSILON*Math.max(1,Math.abs(bt),Math.abs(De))&&Math.abs(Nt-_e)<=r.EPSILON*Math.max(1,Math.abs(Nt),Math.abs(_e))&&Math.abs(Yt-tr)<=r.EPSILON*Math.max(1,Math.abs(Yt),Math.abs(tr))}var U=T,H=xt}),(function(o,t,e){e.r(t),e.d(t,"create",function(){return s}),e.d(t,"identity",function(){return u}),e.d(t,"setAxisAngle",function(){return d}),e.d(t,"getAxisAngle",function(){return M}),e.d(t,"getAngle",function(){return c}),e.d(t,"multiply",function(){return v}),e.d(t,"rotateX",function(){return p}),e.d(t,"rotateY",function(){return T}),e.d(t,"rotateZ",function(){return x}),e.d(t,"calculateW",function(){return y}),e.d(t,"exp",function(){return C}),e.d(t,"ln",function(){return h}),e.d(t,"pow",function(){return g}),e.d(t,"slerp",function(){return f}),e.d(t,"random",function(){return m}),e.d(t,"invert",function(){return S}),e.d(t,"conjugate",function(){return A}),e.d(t,"fromMat3",function(){return P}),e.d(t,"fromEuler",function(){return R}),e.d(t,"str",function(){return D}),e.d(t,"clone",function(){return L}),e.d(t,"fromValues",function(){return j}),e.d(t,"copy",function(){return b}),e.d(t,"set",function(){return O}),e.d(t,"add",function(){return Y}),e.d(t,"mul",function(){return X}),e.d(t,"scale",function(){return Z}),e.d(t,"dot",function(){return $}),e.d(t,"lerp",function(){return rt}),e.d(t,"length",function(){return F}),e.d(t,"len",function(){return Q}),e.d(t,"squaredLength",function(){return tt}),e.d(t,"sqrLen",function(){return lt}),e.d(t,"normalize",function(){return ct}),e.d(t,"exactEquals",function(){return Mt}),e.d(t,"equals",function(){return st}),e.d(t,"rotationTo",function(){return Tt}),e.d(t,"sqlerp",function(){return xt}),e.d(t,"setAxes",function(){return W});var r=e(2),n=e(5),i=e(8),a=e(9);function s(){var k=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(k[0]=0,k[1]=0,k[2]=0),k[3]=1,k}function u(k){return k[0]=0,k[1]=0,k[2]=0,k[3]=1,k}function d(k,q,_){_=_*.5;var U=Math.sin(_);return k[0]=U*q[0],k[1]=U*q[1],k[2]=U*q[2],k[3]=Math.cos(_),k}function M(k,q){var _=Math.acos(q[3])*2,U=Math.sin(_/2);return U>r.EPSILON?(k[0]=q[0]/U,k[1]=q[1]/U,k[2]=q[2]/U):(k[0]=1,k[1]=0,k[2]=0),_}function c(k,q){var _=$(k,q);return Math.acos(2*_*_-1)}function v(k,q,_){var U=q[0],H=q[1],E=q[2],w=q[3],B=_[0],G=_[1],K=_[2],et=_[3];return k[0]=U*et+w*B+H*K-E*G,k[1]=H*et+w*G+E*B-U*K,k[2]=E*et+w*K+U*G-H*B,k[3]=w*et-U*B-H*G-E*K,k}function p(k,q,_){_*=.5;var U=q[0],H=q[1],E=q[2],w=q[3],B=Math.sin(_),G=Math.cos(_);return k[0]=U*G+w*B,k[1]=H*G+E*B,k[2]=E*G-H*B,k[3]=w*G-U*B,k}function T(k,q,_){_*=.5;var U=q[0],H=q[1],E=q[2],w=q[3],B=Math.sin(_),G=Math.cos(_);return k[0]=U*G-E*B,k[1]=H*G+w*B,k[2]=E*G+U*B,k[3]=w*G-H*B,k}function x(k,q,_){_*=.5;var U=q[0],H=q[1],E=q[2],w=q[3],B=Math.sin(_),G=Math.cos(_);return k[0]=U*G+H*B,k[1]=H*G-U*B,k[2]=E*G+w*B,k[3]=w*G-E*B,k}function y(k,q){var _=q[0],U=q[1],H=q[2];return k[0]=_,k[1]=U,k[2]=H,k[3]=Math.sqrt(Math.abs(1-_*_-U*U-H*H)),k}function C(k,q){var _=q[0],U=q[1],H=q[2],E=q[3],w=Math.sqrt(_*_+U*U+H*H),B=Math.exp(E),G=w>0?B*Math.sin(w)/w:0;return k[0]=_*G,k[1]=U*G,k[2]=H*G,k[3]=B*Math.cos(w),k}function h(k,q){var _=q[0],U=q[1],H=q[2],E=q[3],w=Math.sqrt(_*_+U*U+H*H),B=w>0?Math.atan2(w,E)/w:0;return k[0]=_*B,k[1]=U*B,k[2]=H*B,k[3]=.5*Math.log(_*_+U*U+H*H+E*E),k}function g(k,q,_){return h(k,q),Z(k,k,_),C(k,k),k}function f(k,q,_,U){var H=q[0],E=q[1],w=q[2],B=q[3],G=_[0],K=_[1],et=_[2],at=_[3],ut,gt,yt,Ct,vt;return gt=H*G+E*K+w*et+B*at,gt<0&&(gt=-gt,G=-G,K=-K,et=-et,at=-at),1-gt>r.EPSILON?(ut=Math.acos(gt),yt=Math.sin(ut),Ct=Math.sin((1-U)*ut)/yt,vt=Math.sin(U*ut)/yt):(Ct=1-U,vt=U),k[0]=Ct*H+vt*G,k[1]=Ct*E+vt*K,k[2]=Ct*w+vt*et,k[3]=Ct*B+vt*at,k}function m(k){var q=r.RANDOM(),_=r.RANDOM(),U=r.RANDOM(),H=Math.sqrt(1-q),E=Math.sqrt(q);return k[0]=H*Math.sin(2*Math.PI*_),k[1]=H*Math.cos(2*Math.PI*_),k[2]=E*Math.sin(2*Math.PI*U),k[3]=E*Math.cos(2*Math.PI*U),k}function S(k,q){var _=q[0],U=q[1],H=q[2],E=q[3],w=_*_+U*U+H*H+E*E,B=w?1/w:0;return k[0]=-_*B,k[1]=-U*B,k[2]=-H*B,k[3]=E*B,k}function A(k,q){return k[0]=-q[0],k[1]=-q[1],k[2]=-q[2],k[3]=q[3],k}function P(k,q){var _=q[0]+q[4]+q[8],U;if(_>0)U=Math.sqrt(_+1),k[3]=.5*U,U=.5/U,k[0]=(q[5]-q[7])*U,k[1]=(q[6]-q[2])*U,k[2]=(q[1]-q[3])*U;else{var H=0;q[4]>q[0]&&(H=1),q[8]>q[H*3+H]&&(H=2);var E=(H+1)%3,w=(H+2)%3;U=Math.sqrt(q[H*3+H]-q[E*3+E]-q[w*3+w]+1),k[H]=.5*U,U=.5/U,k[3]=(q[E*3+w]-q[w*3+E])*U,k[E]=(q[E*3+H]+q[H*3+E])*U,k[w]=(q[w*3+H]+q[H*3+w])*U}return k}function R(k,q,_,U){var H=.5*Math.PI/180;q*=H,_*=H,U*=H;var E=Math.sin(q),w=Math.cos(q),B=Math.sin(_),G=Math.cos(_),K=Math.sin(U),et=Math.cos(U);return k[0]=E*G*et-w*B*K,k[1]=w*B*et+E*G*K,k[2]=w*G*K-E*B*et,k[3]=w*G*et+E*B*K,k}function D(k){return"quat("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+")"}var L=a.clone,j=a.fromValues,b=a.copy,O=a.set,Y=a.add,X=v,Z=a.scale,$=a.dot,rt=a.lerp,F=a.length,Q=F,tt=a.squaredLength,lt=tt,ct=a.normalize,Mt=a.exactEquals,st=a.equals,Tt=(function(){var k=i.create(),q=i.fromValues(1,0,0),_=i.fromValues(0,1,0);return function(U,H,E){var w=i.dot(H,E);return w<-.999999?(i.cross(k,q,H),i.len(k)<1e-6&&i.cross(k,_,H),i.normalize(k,k),d(U,k,Math.PI),U):w>.999999?(U[0]=0,U[1]=0,U[2]=0,U[3]=1,U):(i.cross(k,H,E),U[0]=k[0],U[1]=k[1],U[2]=k[2],U[3]=1+w,ct(U,U))}})(),xt=(function(){var k=s(),q=s();return function(_,U,H,E,w,B){return f(k,U,w,B),f(q,H,E,B),f(_,k,q,2*B*(1-B)),_}})(),W=(function(){var k=n.create();return function(q,_,U,H){return k[0]=U[0],k[3]=U[1],k[6]=U[2],k[1]=H[0],k[4]=H[1],k[7]=H[2],k[2]=-_[0],k[5]=-_[1],k[8]=-_[2],ct(q,P(q,k))}})()}),(function(o,t,e){e.r(t),e.d(t,"create",function(){return n}),e.d(t,"clone",function(){return i}),e.d(t,"length",function(){return a}),e.d(t,"fromValues",function(){return s}),e.d(t,"copy",function(){return u}),e.d(t,"set",function(){return d}),e.d(t,"add",function(){return M}),e.d(t,"subtract",function(){return c}),e.d(t,"multiply",function(){return v}),e.d(t,"divide",function(){return p}),e.d(t,"ceil",function(){return T}),e.d(t,"floor",function(){return x}),e.d(t,"min",function(){return y}),e.d(t,"max",function(){return C}),e.d(t,"round",function(){return h}),e.d(t,"scale",function(){return g}),e.d(t,"scaleAndAdd",function(){return f}),e.d(t,"distance",function(){return m}),e.d(t,"squaredDistance",function(){return S}),e.d(t,"squaredLength",function(){return A}),e.d(t,"negate",function(){return P}),e.d(t,"inverse",function(){return R}),e.d(t,"normalize",function(){return D}),e.d(t,"dot",function(){return L}),e.d(t,"cross",function(){return j}),e.d(t,"lerp",function(){return b}),e.d(t,"hermite",function(){return O}),e.d(t,"bezier",function(){return Y}),e.d(t,"random",function(){return X}),e.d(t,"transformMat4",function(){return Z}),e.d(t,"transformMat3",function(){return $}),e.d(t,"transformQuat",function(){return rt}),e.d(t,"rotateX",function(){return F}),e.d(t,"rotateY",function(){return Q}),e.d(t,"rotateZ",function(){return tt}),e.d(t,"angle",function(){return lt}),e.d(t,"zero",function(){return ct}),e.d(t,"str",function(){return Mt}),e.d(t,"exactEquals",function(){return st}),e.d(t,"equals",function(){return Tt}),e.d(t,"sub",function(){return xt}),e.d(t,"mul",function(){return W}),e.d(t,"div",function(){return k}),e.d(t,"dist",function(){return q}),e.d(t,"sqrDist",function(){return _}),e.d(t,"len",function(){return U}),e.d(t,"sqrLen",function(){return H}),e.d(t,"forEach",function(){return E});var r=e(2);function n(){var w=new r.ARRAY_TYPE(3);return r.ARRAY_TYPE!=Float32Array&&(w[0]=0,w[1]=0,w[2]=0),w}function i(w){var B=new r.ARRAY_TYPE(3);return B[0]=w[0],B[1]=w[1],B[2]=w[2],B}function a(w){var B=w[0],G=w[1],K=w[2];return Math.hypot(B,G,K)}function s(w,B,G){var K=new r.ARRAY_TYPE(3);return K[0]=w,K[1]=B,K[2]=G,K}function u(w,B){return w[0]=B[0],w[1]=B[1],w[2]=B[2],w}function d(w,B,G,K){return w[0]=B,w[1]=G,w[2]=K,w}function M(w,B,G){return w[0]=B[0]+G[0],w[1]=B[1]+G[1],w[2]=B[2]+G[2],w}function c(w,B,G){return w[0]=B[0]-G[0],w[1]=B[1]-G[1],w[2]=B[2]-G[2],w}function v(w,B,G){return w[0]=B[0]*G[0],w[1]=B[1]*G[1],w[2]=B[2]*G[2],w}function p(w,B,G){return w[0]=B[0]/G[0],w[1]=B[1]/G[1],w[2]=B[2]/G[2],w}function T(w,B){return w[0]=Math.ceil(B[0]),w[1]=Math.ceil(B[1]),w[2]=Math.ceil(B[2]),w}function x(w,B){return w[0]=Math.floor(B[0]),w[1]=Math.floor(B[1]),w[2]=Math.floor(B[2]),w}function y(w,B,G){return w[0]=Math.min(B[0],G[0]),w[1]=Math.min(B[1],G[1]),w[2]=Math.min(B[2],G[2]),w}function C(w,B,G){return w[0]=Math.max(B[0],G[0]),w[1]=Math.max(B[1],G[1]),w[2]=Math.max(B[2],G[2]),w}function h(w,B){return w[0]=Math.round(B[0]),w[1]=Math.round(B[1]),w[2]=Math.round(B[2]),w}function g(w,B,G){return w[0]=B[0]*G,w[1]=B[1]*G,w[2]=B[2]*G,w}function f(w,B,G,K){return w[0]=B[0]+G[0]*K,w[1]=B[1]+G[1]*K,w[2]=B[2]+G[2]*K,w}function m(w,B){var G=B[0]-w[0],K=B[1]-w[1],et=B[2]-w[2];return Math.hypot(G,K,et)}function S(w,B){var G=B[0]-w[0],K=B[1]-w[1],et=B[2]-w[2];return G*G+K*K+et*et}function A(w){var B=w[0],G=w[1],K=w[2];return B*B+G*G+K*K}function P(w,B){return w[0]=-B[0],w[1]=-B[1],w[2]=-B[2],w}function R(w,B){return w[0]=1/B[0],w[1]=1/B[1],w[2]=1/B[2],w}function D(w,B){var G=B[0],K=B[1],et=B[2],at=G*G+K*K+et*et;return at>0&&(at=1/Math.sqrt(at)),w[0]=B[0]*at,w[1]=B[1]*at,w[2]=B[2]*at,w}function L(w,B){return w[0]*B[0]+w[1]*B[1]+w[2]*B[2]}function j(w,B,G){var K=B[0],et=B[1],at=B[2],ut=G[0],gt=G[1],yt=G[2];return w[0]=et*yt-at*gt,w[1]=at*ut-K*yt,w[2]=K*gt-et*ut,w}function b(w,B,G,K){var et=B[0],at=B[1],ut=B[2];return w[0]=et+K*(G[0]-et),w[1]=at+K*(G[1]-at),w[2]=ut+K*(G[2]-ut),w}function O(w,B,G,K,et,at){var ut=at*at,gt=ut*(2*at-3)+1,yt=ut*(at-2)+at,Ct=ut*(at-1),vt=ut*(3-2*at);return w[0]=B[0]*gt+G[0]*yt+K[0]*Ct+et[0]*vt,w[1]=B[1]*gt+G[1]*yt+K[1]*Ct+et[1]*vt,w[2]=B[2]*gt+G[2]*yt+K[2]*Ct+et[2]*vt,w}function Y(w,B,G,K,et,at){var ut=1-at,gt=ut*ut,yt=at*at,Ct=gt*ut,vt=3*at*gt,mt=3*yt*ut,It=yt*at;return w[0]=B[0]*Ct+G[0]*vt+K[0]*mt+et[0]*It,w[1]=B[1]*Ct+G[1]*vt+K[1]*mt+et[1]*It,w[2]=B[2]*Ct+G[2]*vt+K[2]*mt+et[2]*It,w}function X(w,B){B=B||1;var G=r.RANDOM()*2*Math.PI,K=r.RANDOM()*2-1,et=Math.sqrt(1-K*K)*B;return w[0]=Math.cos(G)*et,w[1]=Math.sin(G)*et,w[2]=K*B,w}function Z(w,B,G){var K=B[0],et=B[1],at=B[2],ut=G[3]*K+G[7]*et+G[11]*at+G[15];return ut=ut||1,w[0]=(G[0]*K+G[4]*et+G[8]*at+G[12])/ut,w[1]=(G[1]*K+G[5]*et+G[9]*at+G[13])/ut,w[2]=(G[2]*K+G[6]*et+G[10]*at+G[14])/ut,w}function $(w,B,G){var K=B[0],et=B[1],at=B[2];return w[0]=K*G[0]+et*G[3]+at*G[6],w[1]=K*G[1]+et*G[4]+at*G[7],w[2]=K*G[2]+et*G[5]+at*G[8],w}function rt(w,B,G){var K=G[0],et=G[1],at=G[2],ut=G[3],gt=B[0],yt=B[1],Ct=B[2],vt=et*Ct-at*yt,mt=at*gt-K*Ct,It=K*yt-et*gt,wt=et*It-at*mt,bt=at*vt-K*It,Nt=K*mt-et*vt,Yt=ut*2;return vt*=Yt,mt*=Yt,It*=Yt,wt*=2,bt*=2,Nt*=2,w[0]=gt+vt+wt,w[1]=yt+mt+bt,w[2]=Ct+It+Nt,w}function F(w,B,G,K){var et=[],at=[];return et[0]=B[0]-G[0],et[1]=B[1]-G[1],et[2]=B[2]-G[2],at[0]=et[0],at[1]=et[1]*Math.cos(K)-et[2]*Math.sin(K),at[2]=et[1]*Math.sin(K)+et[2]*Math.cos(K),w[0]=at[0]+G[0],w[1]=at[1]+G[1],w[2]=at[2]+G[2],w}function Q(w,B,G,K){var et=[],at=[];return et[0]=B[0]-G[0],et[1]=B[1]-G[1],et[2]=B[2]-G[2],at[0]=et[2]*Math.sin(K)+et[0]*Math.cos(K),at[1]=et[1],at[2]=et[2]*Math.cos(K)-et[0]*Math.sin(K),w[0]=at[0]+G[0],w[1]=at[1]+G[1],w[2]=at[2]+G[2],w}function tt(w,B,G,K){var et=[],at=[];return et[0]=B[0]-G[0],et[1]=B[1]-G[1],et[2]=B[2]-G[2],at[0]=et[0]*Math.cos(K)-et[1]*Math.sin(K),at[1]=et[0]*Math.sin(K)+et[1]*Math.cos(K),at[2]=et[2],w[0]=at[0]+G[0],w[1]=at[1]+G[1],w[2]=at[2]+G[2],w}function lt(w,B){var G=w[0],K=w[1],et=w[2],at=B[0],ut=B[1],gt=B[2],yt=Math.sqrt(G*G+K*K+et*et),Ct=Math.sqrt(at*at+ut*ut+gt*gt),vt=yt*Ct,mt=vt&&L(w,B)/vt;return Math.acos(Math.min(Math.max(mt,-1),1))}function ct(w){return w[0]=0,w[1]=0,w[2]=0,w}function Mt(w){return"vec3("+w[0]+", "+w[1]+", "+w[2]+")"}function st(w,B){return w[0]===B[0]&&w[1]===B[1]&&w[2]===B[2]}function Tt(w,B){var G=w[0],K=w[1],et=w[2],at=B[0],ut=B[1],gt=B[2];return Math.abs(G-at)<=r.EPSILON*Math.max(1,Math.abs(G),Math.abs(at))&&Math.abs(K-ut)<=r.EPSILON*Math.max(1,Math.abs(K),Math.abs(ut))&&Math.abs(et-gt)<=r.EPSILON*Math.max(1,Math.abs(et),Math.abs(gt))}var xt=c,W=v,k=p,q=m,_=S,U=a,H=A,E=(function(){var w=n();return function(B,G,K,et,at,ut){var gt,yt;for(G||(G=3),K||(K=0),et?yt=Math.min(et*G+K,B.length):yt=B.length,gt=K;gt<yt;gt+=G)w[0]=B[gt],w[1]=B[gt+1],w[2]=B[gt+2],at(w,w,ut),B[gt]=w[0],B[gt+1]=w[1],B[gt+2]=w[2];return B}})()}),(function(o,t,e){e.r(t),e.d(t,"create",function(){return n}),e.d(t,"clone",function(){return i}),e.d(t,"fromValues",function(){return a}),e.d(t,"copy",function(){return s}),e.d(t,"set",function(){return u}),e.d(t,"add",function(){return d}),e.d(t,"subtract",function(){return M}),e.d(t,"multiply",function(){return c}),e.d(t,"divide",function(){return v}),e.d(t,"ceil",function(){return p}),e.d(t,"floor",function(){return T}),e.d(t,"min",function(){return x}),e.d(t,"max",function(){return y}),e.d(t,"round",function(){return C}),e.d(t,"scale",function(){return h}),e.d(t,"scaleAndAdd",function(){return g}),e.d(t,"distance",function(){return f}),e.d(t,"squaredDistance",function(){return m}),e.d(t,"length",function(){return S}),e.d(t,"squaredLength",function(){return A}),e.d(t,"negate",function(){return P}),e.d(t,"inverse",function(){return R}),e.d(t,"normalize",function(){return D}),e.d(t,"dot",function(){return L}),e.d(t,"cross",function(){return j}),e.d(t,"lerp",function(){return b}),e.d(t,"random",function(){return O}),e.d(t,"transformMat4",function(){return Y}),e.d(t,"transformQuat",function(){return X}),e.d(t,"zero",function(){return Z}),e.d(t,"str",function(){return $}),e.d(t,"exactEquals",function(){return rt}),e.d(t,"equals",function(){return F}),e.d(t,"sub",function(){return Q}),e.d(t,"mul",function(){return tt}),e.d(t,"div",function(){return lt}),e.d(t,"dist",function(){return ct}),e.d(t,"sqrDist",function(){return Mt}),e.d(t,"len",function(){return st}),e.d(t,"sqrLen",function(){return Tt}),e.d(t,"forEach",function(){return xt});var r=e(2);function n(){var W=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(W[0]=0,W[1]=0,W[2]=0,W[3]=0),W}function i(W){var k=new r.ARRAY_TYPE(4);return k[0]=W[0],k[1]=W[1],k[2]=W[2],k[3]=W[3],k}function a(W,k,q,_){var U=new r.ARRAY_TYPE(4);return U[0]=W,U[1]=k,U[2]=q,U[3]=_,U}function s(W,k){return W[0]=k[0],W[1]=k[1],W[2]=k[2],W[3]=k[3],W}function u(W,k,q,_,U){return W[0]=k,W[1]=q,W[2]=_,W[3]=U,W}function d(W,k,q){return W[0]=k[0]+q[0],W[1]=k[1]+q[1],W[2]=k[2]+q[2],W[3]=k[3]+q[3],W}function M(W,k,q){return W[0]=k[0]-q[0],W[1]=k[1]-q[1],W[2]=k[2]-q[2],W[3]=k[3]-q[3],W}function c(W,k,q){return W[0]=k[0]*q[0],W[1]=k[1]*q[1],W[2]=k[2]*q[2],W[3]=k[3]*q[3],W}function v(W,k,q){return W[0]=k[0]/q[0],W[1]=k[1]/q[1],W[2]=k[2]/q[2],W[3]=k[3]/q[3],W}function p(W,k){return W[0]=Math.ceil(k[0]),W[1]=Math.ceil(k[1]),W[2]=Math.ceil(k[2]),W[3]=Math.ceil(k[3]),W}function T(W,k){return W[0]=Math.floor(k[0]),W[1]=Math.floor(k[1]),W[2]=Math.floor(k[2]),W[3]=Math.floor(k[3]),W}function x(W,k,q){return W[0]=Math.min(k[0],q[0]),W[1]=Math.min(k[1],q[1]),W[2]=Math.min(k[2],q[2]),W[3]=Math.min(k[3],q[3]),W}function y(W,k,q){return W[0]=Math.max(k[0],q[0]),W[1]=Math.max(k[1],q[1]),W[2]=Math.max(k[2],q[2]),W[3]=Math.max(k[3],q[3]),W}function C(W,k){return W[0]=Math.round(k[0]),W[1]=Math.round(k[1]),W[2]=Math.round(k[2]),W[3]=Math.round(k[3]),W}function h(W,k,q){return W[0]=k[0]*q,W[1]=k[1]*q,W[2]=k[2]*q,W[3]=k[3]*q,W}function g(W,k,q,_){return W[0]=k[0]+q[0]*_,W[1]=k[1]+q[1]*_,W[2]=k[2]+q[2]*_,W[3]=k[3]+q[3]*_,W}function f(W,k){var q=k[0]-W[0],_=k[1]-W[1],U=k[2]-W[2],H=k[3]-W[3];return Math.hypot(q,_,U,H)}function m(W,k){var q=k[0]-W[0],_=k[1]-W[1],U=k[2]-W[2],H=k[3]-W[3];return q*q+_*_+U*U+H*H}function S(W){var k=W[0],q=W[1],_=W[2],U=W[3];return Math.hypot(k,q,_,U)}function A(W){var k=W[0],q=W[1],_=W[2],U=W[3];return k*k+q*q+_*_+U*U}function P(W,k){return W[0]=-k[0],W[1]=-k[1],W[2]=-k[2],W[3]=-k[3],W}function R(W,k){return W[0]=1/k[0],W[1]=1/k[1],W[2]=1/k[2],W[3]=1/k[3],W}function D(W,k){var q=k[0],_=k[1],U=k[2],H=k[3],E=q*q+_*_+U*U+H*H;return E>0&&(E=1/Math.sqrt(E)),W[0]=q*E,W[1]=_*E,W[2]=U*E,W[3]=H*E,W}function L(W,k){return W[0]*k[0]+W[1]*k[1]+W[2]*k[2]+W[3]*k[3]}function j(W,k,q,_){var U=q[0]*_[1]-q[1]*_[0],H=q[0]*_[2]-q[2]*_[0],E=q[0]*_[3]-q[3]*_[0],w=q[1]*_[2]-q[2]*_[1],B=q[1]*_[3]-q[3]*_[1],G=q[2]*_[3]-q[3]*_[2],K=k[0],et=k[1],at=k[2],ut=k[3];return W[0]=et*G-at*B+ut*w,W[1]=-(K*G)+at*E-ut*H,W[2]=K*B-et*E+ut*U,W[3]=-(K*w)+et*H-at*U,W}function b(W,k,q,_){var U=k[0],H=k[1],E=k[2],w=k[3];return W[0]=U+_*(q[0]-U),W[1]=H+_*(q[1]-H),W[2]=E+_*(q[2]-E),W[3]=w+_*(q[3]-w),W}function O(W,k){k=k||1;var q,_,U,H,E,w;do q=r.RANDOM()*2-1,_=r.RANDOM()*2-1,E=q*q+_*_;while(E>=1);do U=r.RANDOM()*2-1,H=r.RANDOM()*2-1,w=U*U+H*H;while(w>=1);var B=Math.sqrt((1-E)/w);return W[0]=k*q,W[1]=k*_,W[2]=k*U*B,W[3]=k*H*B,W}function Y(W,k,q){var _=k[0],U=k[1],H=k[2],E=k[3];return W[0]=q[0]*_+q[4]*U+q[8]*H+q[12]*E,W[1]=q[1]*_+q[5]*U+q[9]*H+q[13]*E,W[2]=q[2]*_+q[6]*U+q[10]*H+q[14]*E,W[3]=q[3]*_+q[7]*U+q[11]*H+q[15]*E,W}function X(W,k,q){var _=k[0],U=k[1],H=k[2],E=q[0],w=q[1],B=q[2],G=q[3],K=G*_+w*H-B*U,et=G*U+B*_-E*H,at=G*H+E*U-w*_,ut=-E*_-w*U-B*H;return W[0]=K*G+ut*-E+et*-B-at*-w,W[1]=et*G+ut*-w+at*-E-K*-B,W[2]=at*G+ut*-B+K*-w-et*-E,W[3]=k[3],W}function Z(W){return W[0]=0,W[1]=0,W[2]=0,W[3]=0,W}function $(W){return"vec4("+W[0]+", "+W[1]+", "+W[2]+", "+W[3]+")"}function rt(W,k){return W[0]===k[0]&&W[1]===k[1]&&W[2]===k[2]&&W[3]===k[3]}function F(W,k){var q=W[0],_=W[1],U=W[2],H=W[3],E=k[0],w=k[1],B=k[2],G=k[3];return Math.abs(q-E)<=r.EPSILON*Math.max(1,Math.abs(q),Math.abs(E))&&Math.abs(_-w)<=r.EPSILON*Math.max(1,Math.abs(_),Math.abs(w))&&Math.abs(U-B)<=r.EPSILON*Math.max(1,Math.abs(U),Math.abs(B))&&Math.abs(H-G)<=r.EPSILON*Math.max(1,Math.abs(H),Math.abs(G))}var Q=M,tt=c,lt=v,ct=f,Mt=m,st=S,Tt=A,xt=(function(){var W=n();return function(k,q,_,U,H,E){var w,B;for(q||(q=4),_||(_=0),U?B=Math.min(U*q+_,k.length):B=k.length,w=_;w<B;w+=q)W[0]=k[w],W[1]=k[w+1],W[2]=k[w+2],W[3]=k[w+3],H(W,W,E),k[w]=W[0],k[w+1]=W[1],k[w+2]=W[2],k[w+3]=W[3];return k}})()}),(function(o,t,e){e.r(t),e.d(t,"create",function(){return a}),e.d(t,"clone",function(){return s}),e.d(t,"fromValues",function(){return u}),e.d(t,"fromRotationTranslationValues",function(){return d}),e.d(t,"fromRotationTranslation",function(){return M}),e.d(t,"fromTranslation",function(){return c}),e.d(t,"fromRotation",function(){return v}),e.d(t,"fromMat4",function(){return p}),e.d(t,"copy",function(){return T}),e.d(t,"identity",function(){return x}),e.d(t,"set",function(){return y}),e.d(t,"getReal",function(){return C}),e.d(t,"getDual",function(){return h}),e.d(t,"setReal",function(){return g}),e.d(t,"setDual",function(){return f}),e.d(t,"getTranslation",function(){return m}),e.d(t,"translate",function(){return S}),e.d(t,"rotateX",function(){return A}),e.d(t,"rotateY",function(){return P}),e.d(t,"rotateZ",function(){return R}),e.d(t,"rotateByQuatAppend",function(){return D}),e.d(t,"rotateByQuatPrepend",function(){return L}),e.d(t,"rotateAroundAxis",function(){return j}),e.d(t,"add",function(){return b}),e.d(t,"multiply",function(){return O}),e.d(t,"mul",function(){return Y}),e.d(t,"scale",function(){return X}),e.d(t,"dot",function(){return Z}),e.d(t,"lerp",function(){return $}),e.d(t,"invert",function(){return rt}),e.d(t,"conjugate",function(){return F}),e.d(t,"length",function(){return Q}),e.d(t,"len",function(){return tt}),e.d(t,"squaredLength",function(){return lt}),e.d(t,"sqrLen",function(){return ct}),e.d(t,"normalize",function(){return Mt}),e.d(t,"str",function(){return st}),e.d(t,"exactEquals",function(){return Tt}),e.d(t,"equals",function(){return xt});var r=e(2),n=e(7),i=e(6);function a(){var W=new r.ARRAY_TYPE(8);return r.ARRAY_TYPE!=Float32Array&&(W[0]=0,W[1]=0,W[2]=0,W[4]=0,W[5]=0,W[6]=0,W[7]=0),W[3]=1,W}function s(W){var k=new r.ARRAY_TYPE(8);return k[0]=W[0],k[1]=W[1],k[2]=W[2],k[3]=W[3],k[4]=W[4],k[5]=W[5],k[6]=W[6],k[7]=W[7],k}function u(W,k,q,_,U,H,E,w){var B=new r.ARRAY_TYPE(8);return B[0]=W,B[1]=k,B[2]=q,B[3]=_,B[4]=U,B[5]=H,B[6]=E,B[7]=w,B}function d(W,k,q,_,U,H,E){var w=new r.ARRAY_TYPE(8);w[0]=W,w[1]=k,w[2]=q,w[3]=_;var B=U*.5,G=H*.5,K=E*.5;return w[4]=B*_+G*q-K*k,w[5]=G*_+K*W-B*q,w[6]=K*_+B*k-G*W,w[7]=-B*W-G*k-K*q,w}function M(W,k,q){var _=q[0]*.5,U=q[1]*.5,H=q[2]*.5,E=k[0],w=k[1],B=k[2],G=k[3];return W[0]=E,W[1]=w,W[2]=B,W[3]=G,W[4]=_*G+U*B-H*w,W[5]=U*G+H*E-_*B,W[6]=H*G+_*w-U*E,W[7]=-_*E-U*w-H*B,W}function c(W,k){return W[0]=0,W[1]=0,W[2]=0,W[3]=1,W[4]=k[0]*.5,W[5]=k[1]*.5,W[6]=k[2]*.5,W[7]=0,W}function v(W,k){return W[0]=k[0],W[1]=k[1],W[2]=k[2],W[3]=k[3],W[4]=0,W[5]=0,W[6]=0,W[7]=0,W}function p(W,k){var q=n.create();i.getRotation(q,k);var _=new r.ARRAY_TYPE(3);return i.getTranslation(_,k),M(W,q,_),W}function T(W,k){return W[0]=k[0],W[1]=k[1],W[2]=k[2],W[3]=k[3],W[4]=k[4],W[5]=k[5],W[6]=k[6],W[7]=k[7],W}function x(W){return W[0]=0,W[1]=0,W[2]=0,W[3]=1,W[4]=0,W[5]=0,W[6]=0,W[7]=0,W}function y(W,k,q,_,U,H,E,w,B){return W[0]=k,W[1]=q,W[2]=_,W[3]=U,W[4]=H,W[5]=E,W[6]=w,W[7]=B,W}var C=n.copy;function h(W,k){return W[0]=k[4],W[1]=k[5],W[2]=k[6],W[3]=k[7],W}var g=n.copy;function f(W,k){return W[4]=k[0],W[5]=k[1],W[6]=k[2],W[7]=k[3],W}function m(W,k){var q=k[4],_=k[5],U=k[6],H=k[7],E=-k[0],w=-k[1],B=-k[2],G=k[3];return W[0]=(q*G+H*E+_*B-U*w)*2,W[1]=(_*G+H*w+U*E-q*B)*2,W[2]=(U*G+H*B+q*w-_*E)*2,W}function S(W,k,q){var _=k[0],U=k[1],H=k[2],E=k[3],w=q[0]*.5,B=q[1]*.5,G=q[2]*.5,K=k[4],et=k[5],at=k[6],ut=k[7];return W[0]=_,W[1]=U,W[2]=H,W[3]=E,W[4]=E*w+U*G-H*B+K,W[5]=E*B+H*w-_*G+et,W[6]=E*G+_*B-U*w+at,W[7]=-_*w-U*B-H*G+ut,W}function A(W,k,q){var _=-k[0],U=-k[1],H=-k[2],E=k[3],w=k[4],B=k[5],G=k[6],K=k[7],et=w*E+K*_+B*H-G*U,at=B*E+K*U+G*_-w*H,ut=G*E+K*H+w*U-B*_,gt=K*E-w*_-B*U-G*H;return n.rotateX(W,k,q),_=W[0],U=W[1],H=W[2],E=W[3],W[4]=et*E+gt*_+at*H-ut*U,W[5]=at*E+gt*U+ut*_-et*H,W[6]=ut*E+gt*H+et*U-at*_,W[7]=gt*E-et*_-at*U-ut*H,W}function P(W,k,q){var _=-k[0],U=-k[1],H=-k[2],E=k[3],w=k[4],B=k[5],G=k[6],K=k[7],et=w*E+K*_+B*H-G*U,at=B*E+K*U+G*_-w*H,ut=G*E+K*H+w*U-B*_,gt=K*E-w*_-B*U-G*H;return n.rotateY(W,k,q),_=W[0],U=W[1],H=W[2],E=W[3],W[4]=et*E+gt*_+at*H-ut*U,W[5]=at*E+gt*U+ut*_-et*H,W[6]=ut*E+gt*H+et*U-at*_,W[7]=gt*E-et*_-at*U-ut*H,W}function R(W,k,q){var _=-k[0],U=-k[1],H=-k[2],E=k[3],w=k[4],B=k[5],G=k[6],K=k[7],et=w*E+K*_+B*H-G*U,at=B*E+K*U+G*_-w*H,ut=G*E+K*H+w*U-B*_,gt=K*E-w*_-B*U-G*H;return n.rotateZ(W,k,q),_=W[0],U=W[1],H=W[2],E=W[3],W[4]=et*E+gt*_+at*H-ut*U,W[5]=at*E+gt*U+ut*_-et*H,W[6]=ut*E+gt*H+et*U-at*_,W[7]=gt*E-et*_-at*U-ut*H,W}function D(W,k,q){var _=q[0],U=q[1],H=q[2],E=q[3],w=k[0],B=k[1],G=k[2],K=k[3];return W[0]=w*E+K*_+B*H-G*U,W[1]=B*E+K*U+G*_-w*H,W[2]=G*E+K*H+w*U-B*_,W[3]=K*E-w*_-B*U-G*H,w=k[4],B=k[5],G=k[6],K=k[7],W[4]=w*E+K*_+B*H-G*U,W[5]=B*E+K*U+G*_-w*H,W[6]=G*E+K*H+w*U-B*_,W[7]=K*E-w*_-B*U-G*H,W}function L(W,k,q){var _=k[0],U=k[1],H=k[2],E=k[3],w=q[0],B=q[1],G=q[2],K=q[3];return W[0]=_*K+E*w+U*G-H*B,W[1]=U*K+E*B+H*w-_*G,W[2]=H*K+E*G+_*B-U*w,W[3]=E*K-_*w-U*B-H*G,w=q[4],B=q[5],G=q[6],K=q[7],W[4]=_*K+E*w+U*G-H*B,W[5]=U*K+E*B+H*w-_*G,W[6]=H*K+E*G+_*B-U*w,W[7]=E*K-_*w-U*B-H*G,W}function j(W,k,q,_){if(Math.abs(_)<r.EPSILON)return T(W,k);var U=Math.hypot(q[0],q[1],q[2]);_=_*.5;var H=Math.sin(_),E=H*q[0]/U,w=H*q[1]/U,B=H*q[2]/U,G=Math.cos(_),K=k[0],et=k[1],at=k[2],ut=k[3];W[0]=K*G+ut*E+et*B-at*w,W[1]=et*G+ut*w+at*E-K*B,W[2]=at*G+ut*B+K*w-et*E,W[3]=ut*G-K*E-et*w-at*B;var gt=k[4],yt=k[5],Ct=k[6],vt=k[7];return W[4]=gt*G+vt*E+yt*B-Ct*w,W[5]=yt*G+vt*w+Ct*E-gt*B,W[6]=Ct*G+vt*B+gt*w-yt*E,W[7]=vt*G-gt*E-yt*w-Ct*B,W}function b(W,k,q){return W[0]=k[0]+q[0],W[1]=k[1]+q[1],W[2]=k[2]+q[2],W[3]=k[3]+q[3],W[4]=k[4]+q[4],W[5]=k[5]+q[5],W[6]=k[6]+q[6],W[7]=k[7]+q[7],W}function O(W,k,q){var _=k[0],U=k[1],H=k[2],E=k[3],w=q[4],B=q[5],G=q[6],K=q[7],et=k[4],at=k[5],ut=k[6],gt=k[7],yt=q[0],Ct=q[1],vt=q[2],mt=q[3];return W[0]=_*mt+E*yt+U*vt-H*Ct,W[1]=U*mt+E*Ct+H*yt-_*vt,W[2]=H*mt+E*vt+_*Ct-U*yt,W[3]=E*mt-_*yt-U*Ct-H*vt,W[4]=_*K+E*w+U*G-H*B+et*mt+gt*yt+at*vt-ut*Ct,W[5]=U*K+E*B+H*w-_*G+at*mt+gt*Ct+ut*yt-et*vt,W[6]=H*K+E*G+_*B-U*w+ut*mt+gt*vt+et*Ct-at*yt,W[7]=E*K-_*w-U*B-H*G+gt*mt-et*yt-at*Ct-ut*vt,W}var Y=O;function X(W,k,q){return W[0]=k[0]*q,W[1]=k[1]*q,W[2]=k[2]*q,W[3]=k[3]*q,W[4]=k[4]*q,W[5]=k[5]*q,W[6]=k[6]*q,W[7]=k[7]*q,W}var Z=n.dot;function $(W,k,q,_){var U=1-_;return Z(k,q)<0&&(_=-_),W[0]=k[0]*U+q[0]*_,W[1]=k[1]*U+q[1]*_,W[2]=k[2]*U+q[2]*_,W[3]=k[3]*U+q[3]*_,W[4]=k[4]*U+q[4]*_,W[5]=k[5]*U+q[5]*_,W[6]=k[6]*U+q[6]*_,W[7]=k[7]*U+q[7]*_,W}function rt(W,k){var q=lt(k);return W[0]=-k[0]/q,W[1]=-k[1]/q,W[2]=-k[2]/q,W[3]=k[3]/q,W[4]=-k[4]/q,W[5]=-k[5]/q,W[6]=-k[6]/q,W[7]=k[7]/q,W}function F(W,k){return W[0]=-k[0],W[1]=-k[1],W[2]=-k[2],W[3]=k[3],W[4]=-k[4],W[5]=-k[5],W[6]=-k[6],W[7]=k[7],W}var Q=n.length,tt=Q,lt=n.squaredLength,ct=lt;function Mt(W,k){var q=lt(k);if(q>0){q=Math.sqrt(q);var _=k[0]/q,U=k[1]/q,H=k[2]/q,E=k[3]/q,w=k[4],B=k[5],G=k[6],K=k[7],et=_*w+U*B+H*G+E*K;W[0]=_,W[1]=U,W[2]=H,W[3]=E,W[4]=(w-_*et)/q,W[5]=(B-U*et)/q,W[6]=(G-H*et)/q,W[7]=(K-E*et)/q}return W}function st(W){return"quat2("+W[0]+", "+W[1]+", "+W[2]+", "+W[3]+", "+W[4]+", "+W[5]+", "+W[6]+", "+W[7]+")"}function Tt(W,k){return W[0]===k[0]&&W[1]===k[1]&&W[2]===k[2]&&W[3]===k[3]&&W[4]===k[4]&&W[5]===k[5]&&W[6]===k[6]&&W[7]===k[7]}function xt(W,k){var q=W[0],_=W[1],U=W[2],H=W[3],E=W[4],w=W[5],B=W[6],G=W[7],K=k[0],et=k[1],at=k[2],ut=k[3],gt=k[4],yt=k[5],Ct=k[6],vt=k[7];return Math.abs(q-K)<=r.EPSILON*Math.max(1,Math.abs(q),Math.abs(K))&&Math.abs(_-et)<=r.EPSILON*Math.max(1,Math.abs(_),Math.abs(et))&&Math.abs(U-at)<=r.EPSILON*Math.max(1,Math.abs(U),Math.abs(at))&&Math.abs(H-ut)<=r.EPSILON*Math.max(1,Math.abs(H),Math.abs(ut))&&Math.abs(E-gt)<=r.EPSILON*Math.max(1,Math.abs(E),Math.abs(gt))&&Math.abs(w-yt)<=r.EPSILON*Math.max(1,Math.abs(w),Math.abs(yt))&&Math.abs(B-Ct)<=r.EPSILON*Math.max(1,Math.abs(B),Math.abs(Ct))&&Math.abs(G-vt)<=r.EPSILON*Math.max(1,Math.abs(G),Math.abs(vt))}}),(function(o,t,e){e.r(t),e.d(t,"create",function(){return n}),e.d(t,"clone",function(){return i}),e.d(t,"fromValues",function(){return a}),e.d(t,"copy",function(){return s}),e.d(t,"set",function(){return u}),e.d(t,"add",function(){return d}),e.d(t,"subtract",function(){return M}),e.d(t,"multiply",function(){return c}),e.d(t,"divide",function(){return v}),e.d(t,"ceil",function(){return p}),e.d(t,"floor",function(){return T}),e.d(t,"min",function(){return x}),e.d(t,"max",function(){return y}),e.d(t,"round",function(){return C}),e.d(t,"scale",function(){return h}),e.d(t,"scaleAndAdd",function(){return g}),e.d(t,"distance",function(){return f}),e.d(t,"squaredDistance",function(){return m}),e.d(t,"length",function(){return S}),e.d(t,"squaredLength",function(){return A}),e.d(t,"negate",function(){return P}),e.d(t,"inverse",function(){return R}),e.d(t,"normalize",function(){return D}),e.d(t,"dot",function(){return L}),e.d(t,"cross",function(){return j}),e.d(t,"lerp",function(){return b}),e.d(t,"random",function(){return O}),e.d(t,"transformMat2",function(){return Y}),e.d(t,"transformMat2d",function(){return X}),e.d(t,"transformMat3",function(){return Z}),e.d(t,"transformMat4",function(){return $}),e.d(t,"rotate",function(){return rt}),e.d(t,"angle",function(){return F}),e.d(t,"zero",function(){return Q}),e.d(t,"str",function(){return tt}),e.d(t,"exactEquals",function(){return lt}),e.d(t,"equals",function(){return ct}),e.d(t,"len",function(){return Mt}),e.d(t,"sub",function(){return st}),e.d(t,"mul",function(){return Tt}),e.d(t,"div",function(){return xt}),e.d(t,"dist",function(){return W}),e.d(t,"sqrDist",function(){return k}),e.d(t,"sqrLen",function(){return q}),e.d(t,"forEach",function(){return _});var r=e(2);function n(){var U=new r.ARRAY_TYPE(2);return r.ARRAY_TYPE!=Float32Array&&(U[0]=0,U[1]=0),U}function i(U){var H=new r.ARRAY_TYPE(2);return H[0]=U[0],H[1]=U[1],H}function a(U,H){var E=new r.ARRAY_TYPE(2);return E[0]=U,E[1]=H,E}function s(U,H){return U[0]=H[0],U[1]=H[1],U}function u(U,H,E){return U[0]=H,U[1]=E,U}function d(U,H,E){return U[0]=H[0]+E[0],U[1]=H[1]+E[1],U}function M(U,H,E){return U[0]=H[0]-E[0],U[1]=H[1]-E[1],U}function c(U,H,E){return U[0]=H[0]*E[0],U[1]=H[1]*E[1],U}function v(U,H,E){return U[0]=H[0]/E[0],U[1]=H[1]/E[1],U}function p(U,H){return U[0]=Math.ceil(H[0]),U[1]=Math.ceil(H[1]),U}function T(U,H){return U[0]=Math.floor(H[0]),U[1]=Math.floor(H[1]),U}function x(U,H,E){return U[0]=Math.min(H[0],E[0]),U[1]=Math.min(H[1],E[1]),U}function y(U,H,E){return U[0]=Math.max(H[0],E[0]),U[1]=Math.max(H[1],E[1]),U}function C(U,H){return U[0]=Math.round(H[0]),U[1]=Math.round(H[1]),U}function h(U,H,E){return U[0]=H[0]*E,U[1]=H[1]*E,U}function g(U,H,E,w){return U[0]=H[0]+E[0]*w,U[1]=H[1]+E[1]*w,U}function f(U,H){var E=H[0]-U[0],w=H[1]-U[1];return Math.hypot(E,w)}function m(U,H){var E=H[0]-U[0],w=H[1]-U[1];return E*E+w*w}function S(U){var H=U[0],E=U[1];return Math.hypot(H,E)}function A(U){var H=U[0],E=U[1];return H*H+E*E}function P(U,H){return U[0]=-H[0],U[1]=-H[1],U}function R(U,H){return U[0]=1/H[0],U[1]=1/H[1],U}function D(U,H){var E=H[0],w=H[1],B=E*E+w*w;return B>0&&(B=1/Math.sqrt(B)),U[0]=H[0]*B,U[1]=H[1]*B,U}function L(U,H){return U[0]*H[0]+U[1]*H[1]}function j(U,H,E){var w=H[0]*E[1]-H[1]*E[0];return U[0]=U[1]=0,U[2]=w,U}function b(U,H,E,w){var B=H[0],G=H[1];return U[0]=B+w*(E[0]-B),U[1]=G+w*(E[1]-G),U}function O(U,H){H=H||1;var E=r.RANDOM()*2*Math.PI;return U[0]=Math.cos(E)*H,U[1]=Math.sin(E)*H,U}function Y(U,H,E){var w=H[0],B=H[1];return U[0]=E[0]*w+E[2]*B,U[1]=E[1]*w+E[3]*B,U}function X(U,H,E){var w=H[0],B=H[1];return U[0]=E[0]*w+E[2]*B+E[4],U[1]=E[1]*w+E[3]*B+E[5],U}function Z(U,H,E){var w=H[0],B=H[1];return U[0]=E[0]*w+E[3]*B+E[6],U[1]=E[1]*w+E[4]*B+E[7],U}function $(U,H,E){var w=H[0],B=H[1];return U[0]=E[0]*w+E[4]*B+E[12],U[1]=E[1]*w+E[5]*B+E[13],U}function rt(U,H,E,w){var B=H[0]-E[0],G=H[1]-E[1],K=Math.sin(w),et=Math.cos(w);return U[0]=B*et-G*K+E[0],U[1]=B*K+G*et+E[1],U}function F(U,H){var E=U[0],w=U[1],B=H[0],G=H[1],K=Math.sqrt(E*E+w*w)*Math.sqrt(B*B+G*G),et=K&&(E*B+w*G)/K;return Math.acos(Math.min(Math.max(et,-1),1))}function Q(U){return U[0]=0,U[1]=0,U}function tt(U){return"vec2("+U[0]+", "+U[1]+")"}function lt(U,H){return U[0]===H[0]&&U[1]===H[1]}function ct(U,H){var E=U[0],w=U[1],B=H[0],G=H[1];return Math.abs(E-B)<=r.EPSILON*Math.max(1,Math.abs(E),Math.abs(B))&&Math.abs(w-G)<=r.EPSILON*Math.max(1,Math.abs(w),Math.abs(G))}var Mt=S,st=M,Tt=c,xt=v,W=f,k=m,q=A,_=(function(){var U=n();return function(H,E,w,B,G,K){var et,at;for(E||(E=2),w||(w=0),B?at=Math.min(B*E+w,H.length):at=H.length,et=w;et<at;et+=E)U[0]=H[et],U[1]=H[et+1],G(U,U,K),H[et]=U[0],H[et+1]=U[1];return H}})()}),(function(o,t,e){e.r(t);var r=e(13);e.d(t,"Renderer",function(){return r.default});var n=e(40);e.d(t,"Figure2D",function(){return n.default});var i=e(56);e.d(t,"Mesh2D",function(){return i.default});var a=e(29);e.d(t,"MeshCloud",function(){return a.default});var s=e(23);e.d(t,"parseFont",function(){return s.default});var u=e(31);e.d(t,"parseColor",function(){return u.default});var d=e(21);e.d(t,"ENV",function(){return d.default}),e(1).glMatrix.setMatrixArrayType(Array)}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return R});var r=e(14),n=e(1),i=e(20),a=e(27),s=e(25),u=e(40),d=e(56),M=e(29),c=e(59),v=e(21),p=e(63);e(1).glMatrix.setMatrixArrayType(Array);const T={autoUpdate:!1,preserveDrawingBuffer:!1,bufferSize:1500},x=`attribute vec3 a_vertexPosition;
|
||
attribute vec3 a_vertexTextureCoord;
|
||
varying vec3 vTextureCoord;
|
||
uniform mat3 viewMatrix;
|
||
uniform mat3 projectionMatrix;
|
||
|
||
void main() {
|
||
gl_PointSize = 1.0;
|
||
vec3 pos = projectionMatrix * viewMatrix * vec3(a_vertexPosition.xy, 1.0);
|
||
gl_Position = vec4(pos.xy, 1.0, 1.0);
|
||
vTextureCoord = a_vertexTextureCoord;
|
||
}
|
||
`,y=`precision mediump float;
|
||
varying vec3 vTextureCoord;
|
||
uniform sampler2D u_texSampler;
|
||
void main() {
|
||
gl_FragColor = texture2D(u_texSampler, vTextureCoord.xy);
|
||
}
|
||
`,C=Symbol("glRenderer"),h=Symbol("canvasRenderer"),g=Symbol("options"),f=Symbol("globalTransform"),m=Symbol("applyGlobalTransform"),S=Symbol("canvas");function A(D){const L=D.gl,j=D.fbo;j&&L.bindFramebuffer(L.FRAMEBUFFER,j),D._draw(),j&&L.bindFramebuffer(L.FRAMEBUFFER,null)}function P(D,L,j,b){const O=D.createTexture(L.canvas),Y=[[[0,0],[j,0],[j,b],[0,b],[0,0]]];Y.closed=!0;const X=new d.default({contours:Y});X.setTexture(O),D.setMeshData([X.meshData]),A(D),O.delete(),L.clearRect(0,0,j,b),delete L._filter}class R{constructor(L,j={}){let b=j.contextType;if(b||(typeof WebGL2RenderingContext=="function"?b="webgl2":typeof WebGLRenderingContext=="function"?b="webgl":b="2d"),!L.getContext){const O=L;L={getContext(){return O},width:j.width,height:j.height},O.canvas=L,b="2d"}if(this[S]=L,b!=="webgl"&&b!=="webgl2"&&b!=="2d")throw new Error(`Unknown context type ${b}`);if(j.contextType=b,this[g]=Object.assign({},T,j),b==="webgl"||b==="webgl2"){b==="webgl2"&&(this[g].webgl2=!0);const O=new r.default(L,this[g]);b==="webgl2"&&!O.isWebGL2&&(j.contextType="webgl"),Object(p.createShaders)(O),Object(p.applyShader)(O),Object(p.createCloudShaders)(O);const Y=O.gl;Y.clearColor(0,0,0,0),Y.blendFuncSeparate(Y.SRC_ALPHA,Y.ONE_MINUS_SRC_ALPHA,Y.ONE,Y.ONE_MINUS_SRC_ALPHA),this[C]=O}else this[h]=new i.default(L,this[g]);this[f]=[1,0,0,0,1,0,0,0,1],this.updateResolution()}get canvas(){return this[S]}get canvasRenderer(){return this[h]}get glRenderer(){return this[C]}get isWebGL2(){return this[C]&&this[C].isWebGL2}get options(){return this[g]}get globalTransformMatrix(){const L=this[f];return[L[0],L[1],L[3],L[4],L[6],L[7]]}get viewMatrix(){return this[f]}[m](){const L=this[C]||this[h];if(this[C]){const{width:j,height:b}=this.canvas;L.uniforms.viewMatrix=this.viewMatrix,L.uniforms.projectionMatrix=this.projectionMatrix,L.uniforms.u_resolution=[j,b]}}updateResolution(){const{width:L,height:j}=this.canvas,b=[1,0,0,0,1,0,-L/2,-j/2,1],O=[2/L,0,0,0,-2/j,0,0,0,1],Y=n.mat3.multiply(Array.of(0,0,0,0,0,0,0,0,0),O,b);this.projectionMatrix=Y,this[C]&&this[C].gl.viewport(0,0,L,j)}createTexture(L,j){return(this[C]||this[h]).createTexture(L,j)}loadTexture(L,{useImageBitmap:j=!1}={}){return(this[C]||this[h]).loadTexture(L,{useImageBitmap:j})}createText(L,{font:j="16px arial",fillColor:b=null,strokeColor:O=null,strokeWidth:Y=1}={}){if(this[C]){const X=v.default.createText(L,{font:j,fillColor:b,strokeColor:O,strokeWidth:Y});return{image:this.createTexture(X.image),rect:X.rect}}return{_img:{font:j,fillColor:b,strokeColor:O,strokeWidth:Y,text:L}}}createProgram({vertex:L,fragment:j,options:b}={}){if(this[C]){const O=this[C].compileSync(j,L);return O._attribOpts=b,O}throw new Error("Context 2D cannot create webgl program.")}createPassProgram({vertex:L=x,fragment:j=y,options:b}={}){return this.createProgram({vertex:L,fragment:j,options:b})}useProgram(L,j={}){if(this[C]){const b=Object.assign({},L._attribOpts,j);return this[C].useProgram(L,b)}throw new Error("Context 2D cannot use webgl program.")}deleteTexture(L){return(this[C]||this[h]).deleteTexture(L)}clear(...L){if(this[C]){const j=this[C].gl;j.clear(j.COLOR_BUFFER_BIT)}else this[h].clear(...L)}drawMeshCloud(L,{clear:j=!1,program:b=null}={}){const O=this[C]||this[h],Y=b||L.program;if(this[C]){const X=O.gl;if(j&&X.clear(X.COLOR_BUFFER_BIT),Y)O.program!==Y&&this.useProgram(Y,{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{const Z=L.mesh.meshData,$=!!Z.uniforms.u_texSampler,rt=!!Z.uniforms.u_filterFlag,F=!!Z.uniforms.u_radialGradientVector,Q=L.hasCloudColor,tt=L.hasCloudFilter,lt=!!Z.uniforms.u_clipSampler;Object(p.applyCloudShader)(O,{hasTexture:$,hasFilter:rt,hasGradient:F,hasCloudColor:Q,hasCloudFilter:tt,hasClipPath:lt})}this[m](),O.setMeshData([L.meshData]),L.beforeRender&&L.beforeRender(X,L),A(O),L.afterRender&&L.afterRender(X,L)}else O.setTransform(this.globalTransformMatrix),O.drawMeshCloud(L,{clear:j,hook:!1})}drawMeshes(L,{clear:j=!1,program:b=null}={}){const O=this[C]||this[h];if(this[C]){const Y=O.fbo,X=Object(a.default)(this,L,b==null),Z=O.gl;j&&Z.clear(Z.COLOR_BUFFER_BIT);const $=!Object(c.isUnitTransform)(this.globalTransformMatrix);this._drawCalls=0;for(const rt of X){this._drawCalls++;const F=b||rt.program;if(rt instanceof M.default)this.drawMeshCloud(rt,{clear:j,program:F});else{const{width:Q,height:tt}=this.canvas;if(rt.beforeRender&&rt.beforeRender(Z,rt),rt.pass.length&&((!this.fbo||this.fbo.width!==Q||this.fbo.height!==tt)&&(this.fbo={width:Q,height:tt,target:O.createFBO(),buffer:O.createFBO(),swap(){[this.target,this.buffer]=[this.buffer,this.target]}}),O.bindFBO(this.fbo.target)),!F&&rt.filterCanvas){Object(p.applyShader)(O,{hasTexture:!0});let lt=this.filterContext;lt||(lt=v.default.createCanvas(Q,tt).getContext("2d"),this.filterContext=lt);const ct=L[rt.packIndex],Mt=ct.filter,st=L[rt.packIndex+1],Tt=L[rt.packIndex-1];(!Tt||!Tt.filterCanvas||Tt.filter!==Mt)&&(!st||!st.filterCanvas||st.filter!==Mt)?($?(lt.save(),Object(s.drawMesh2D)(ct,lt,!1),lt.restore(),Object(s.applyFilter)(lt,Mt)):Object(s.drawMesh2D)(ct,lt,!0),this[m](),P(O,lt,Q,tt)):($&<.save(),Object(s.drawMesh2D)(ct,lt,!1),$&<.restore(),(!st||!st.filterCanvas||ct.filter!==st.filter)&&(Object(s.applyFilter)(lt,Mt),this[m](),P(O,lt,Q,tt)))}else{if(F)O.program!==F&&this.useProgram(F,{a_color:{type:"UNSIGNED_BYTE",normalize:!0}});else{const lt=!!rt.uniforms.u_texSampler,ct=!!rt.uniforms.u_filterFlag,Mt=!!rt.uniforms.u_radialGradientVector,st=!!rt.uniforms.u_clipSampler;Object(p.applyShader)(O,{hasTexture:lt,hasFilter:ct,hasGradient:Mt,hasClipPath:st})}rt.filterCanvas&&console.warn("User program ignored some filter effects."),this[m](),O.setMeshData([rt]),A(O)}if(rt.pass.length){const lt=rt.pass.length;rt.pass.forEach((ct,Mt)=>{ct.blend=rt.enableBlend,ct.setTexture(O.fbo.texture),Mt===lt-1?O.bindFBO(Y):(this.fbo.swap(),O.bindFBO(this.fbo.target)),ct.program?O.useProgram(ct.program):(this.defaultPassProgram=this.defaultPassProgram||this.createPassProgram(),O.useProgram(this.defaultPassProgram)),O.setMeshData([ct.meshData]),Z.clear(Z.COLOR_BUFFER_BIT),A(O)})}rt.afterRender&&rt.afterRender(Z,rt)}}}else O.setTransform(this.globalTransformMatrix),O.drawMeshes(L,{clear:j})}drawImage(L,...j){const b=j.length;if(b<2)throw new TypeError(`Failed to execute 'drawImage' on 'Renderer': 3 arguments required, but only ${j.length+1} present.`);if(b!==2&&b!==4&&b!==8)throw new TypeError(`Failed to execute 'drawImage' on 'Renderer': Valid arities are: [3, 5, 9], but ${j.length+1} arguments provided.`);let O=null,Y=null;b===2?O=[j[0],j[1],L.width,L.height]:b===4?O=j:b===8&&(Y=j.slice(0,4),O=j.slice(4));const X=this.createTexture(L),{width:Z,height:$}=this.canvas,rt=new u.default;rt.rect(O[0],O[1],Z,$);const F=new d.default(rt,{width:Z,height:$});F.setTexture(X,{rect:O,srcRect:Y}),this.drawMeshes([F]),this.deleteTexture(X)}setGlobalTransform(...L){return this[f]=[L[0],L[1],0,L[2],L[3],0,L[4],L[5],1],this}globalTransform(...L){const j=this[f];return this[f]=n.mat3.multiply(Array.of(0,0,0,0,0,0,0,0,0),j,L),this}globalTranslate(L,j){let b=n.mat3.create();return b=n.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),b,[L,j]),this.globalTransform(...b)}globalRotate(L,[j,b]=[0,0]){let O=n.mat3.create();return O=n.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),O,[j,b]),O=n.mat3.rotate(Array.of(0,0,0,0,0,0,0,0,0),O,L),O=n.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),O,[-j,-b]),this.globalTransform(...O)}globalScale(L,j=L,[b,O]=[0,0]){let Y=n.mat3.create();return Y=n.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),Y,[b,O]),Y=n.mat3.scale(Array.of(0,0,0,0,0,0,0,0,0),Y,[L,j]),Y=n.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),Y,[-b,-O]),this.globalTransform(...Y)}globalSkew(L,j=L,[b,O]=[0,0]){let Y=n.mat3.create();return Y=n.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),Y,[b,O]),Y=n.mat3.multiply(Array.of(0,0,0,0,0,0,0,0,0),Y,n.mat3.fromValues(1,Math.tan(j),Math.tan(L),1,0,0)),Y=n.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),Y,[-b,-O]),this.globalTransform(...Y)}transformPoint(L,j,b){let O=this.globalTransformMatrix;b&&(O=n.mat3.multiply(Array.of(0,0,0,0,0,0,0,0,0),O,b));const Y=L*O[0]+j*O[2]+O[4],X=L*O[1]+j*O[3]+O[5];return[Y,X]}}}),(function(o,t,e){e.r(t);var r=e(15);e(1).glMatrix.setMatrixArrayType(Array),t.default=r.default}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return p});var r=e(16),n=e(17),i=e(18),a=e(19);e(1).glMatrix.setMatrixArrayType(Array);function s(T,x,y){return x in T?Object.defineProperty(T,x,{value:y,enumerable:!0,configurable:!0,writable:!0}):T[x]=y,T}const u={};function d(T,x=3){const y=[],C=T.length;for(let h=0;h<C;h++)h%x<2&&y.push(.5*(T[h]+1));return y}function M(T,x){const y=x._buffers;Object.values(y).forEach(C=>{T.deleteBuffer(C)}),x._buffers={}}function c(T,x,y){return T.activeTexture(T.TEXTURE0+y),Array.isArray(x._img)?T.bindTexture(T.TEXTURE_CUBE_MAP,x):T.bindTexture(T.TEXTURE_2D,x),x}const v={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"};class p{static addLibs(x={}){Object.assign(u,x)}static FLOAT(x,y){return Object(r.pointsToBuffer)(x,Float32Array,y)}static UNSIGNED_BYTE(x,y){return Object(r.pointsToBuffer)(x,Uint8Array,y)}static UNSIGNED_SHORT(x,y){return Object(r.pointsToBuffer)(x,Uint16Array,y)}static BYTE(x,y){return Object(r.pointsToBuffer)(x,Int8Array,y)}static SHORT(x,y){return Object(r.pointsToBuffer)(x,Int16Array,y)}constructor(x,y={}){this.options=Object.assign({},p.defaultOptions,y),this.canvas=x;let C;this.options.webgl2&&(C=x.getContext("webgl2",this.options)),C==null&&(C=Object(r.setupWebGL)(x,this.options),this.aia_ext=C.getExtension("ANGLE_instanced_arrays")),this.gl=C,C.viewport(0,0,x.width,x.height),C.clearColor(0,0,0,0),C.blendFuncSeparate(C.SRC_ALPHA,C.ONE_MINUS_SRC_ALPHA,C.ONE,C.ONE_MINUS_SRC_ALPHA),this.programs=[],this._events={}}get program(){const x=this.gl;return x.getParameter(x.CURRENT_PROGRAM)}_declareUniform(x,y,C="1f"){const h=this.gl,g=h.getUniformLocation(x,y);let f;const m=this;if(/^sampler/.test(C)){const S=x._samplerMap,A=x._bindTextures;Object.defineProperty(x.uniforms,y,{get(){return f},set(P){f=P;const R=S[y]!=null?S[y]:A.length;A[R]=P,c(h,P,R),S[y]||(S[y]=R,h.uniform1i(g,R)),m.options.autoUpdate&&m.update()},configurable:!1,enumerable:!0})}else{const S=C.indexOf("Matrix")===0,A=!S&&/v$/.test(C),P=h[`uniform${C}`].bind(h);Object.defineProperty(x.uniforms,y,{get(){return f},set(R){f=R,typeof R=="number"&&(R=[R]),S?P(g,!1,R):A?P(g,R):P(g,...R),m.options.autoUpdate&&m.update()},configurable:!1,enumerable:!0})}}_draw(){const x=this.program;x.meshData.forEach((y,C)=>{const{positions:h,cells:g,instanceCount:f,cellsCount:m,attributes:S,uniforms:A,textureCoord:P,enableBlend:R}=y,D=this.gl;let L=y.mode!=null?y.mode:D.TRIANGLES;typeof L=="string"&&(L=D[L]),R?D.enable(D.BLEND):D.disable(D.BLEND),D.bindBuffer(D.ARRAY_BUFFER,x._buffers.verticesBuffer),D.bufferData(D.ARRAY_BUFFER,h,D.STATIC_DRAW),g&&(D.bindBuffer(D.ELEMENT_ARRAY_BUFFER,x._buffers.cellsBuffer),D.bufferData(D.ELEMENT_ARRAY_BUFFER,g,D.STATIC_DRAW));const j=[];S&&Object.values(S).forEach(({name:O,data:Y,divisor:X})=>{if(D.bindBuffer(D.ARRAY_BUFFER,x._buffers[O]),D.bufferData(D.ARRAY_BUFFER,Y,D.STATIC_DRAW),X!=null){const Z=D.getAttribLocation(x,O);Z>=0&&(D.enableVertexAttribArray(Z),j.push(Z),D.vertexAttribDivisor?D.vertexAttribDivisor(Z,X):this.aia_ext&&this.aia_ext.vertexAttribDivisorANGLE(Z,X))}}),A&&Object.entries(A).forEach(([O,Y])=>{this.uniforms[O]=Y});let b;if(!g){const O=x._dimension;b=h.length/O}if(x._enableTextures&&x._buffers.texCoordBuffer){const O=P||d(h,x._dimension);D.bindBuffer(D.ARRAY_BUFFER,x._buffers.texCoordBuffer),D.bufferData(D.ARRAY_BUFFER,p.FLOAT(O),D.STATIC_DRAW)}f!=null?(g?D.drawElementsInstanced?D.drawElementsInstanced(L,m,D.UNSIGNED_SHORT,0,f):this.aia_ext&&this.aia_ext.drawElementsInstancedANGLE(L,m,D.UNSIGNED_SHORT,0,f):D.drawArraysInstanced?D.drawArraysInstanced(L,0,b,f):this.aia_ext.drawArraysInstancedANGLE(L,0,b,f),j.forEach(O=>{D.vertexAttribDivisor?D.vertexAttribDivisor(O,null):this.aia_ext&&this.aia_ext.vertexAttribDivisorANGLE(O,null)})):g?D.drawElements(L,m,D.UNSIGNED_SHORT,0):D.drawArrays(L,0,b)})}get isWebGL2(){return typeof WebGL2RenderingContext<"u"&&this.gl instanceof WebGL2RenderingContext}get enableTextures(){return this.program&&this.program._enableTextures}get uniforms(){const x=this.program;if(!x||!x.uniforms)throw Error("No avaliable program.");return x.uniforms}deleteProgram(x){const y=this.gl;this.program===x&&(this.startRender=!1,this._renderFrameID&&(cancelAnimationFrame(this._renderFrameID),delete this._renderFrameID),y.useProgram(null));const C=this.programs.indexOf(x);C>=0&&this.programs.splice(C,1),M(y,x),y.deleteProgram(x)}setMeshData(x){Array.isArray(x)||(x=[x]);const y=this.program;y.meshData=x.map(({mode:C,positions:h,instanceCount:g,cells:f,cellsCount:m,attributes:S,uniforms:A,textureCoord:P,enableBlend:R})=>{const D={positions:p.FLOAT(h),uniforms:A,enableBlend:!!R,textureCoord:p.FLOAT(P)};if(f&&(D.cells=p.USHORT(f),D.cellsCount=m||D.cells.length),C!=null&&(D.mode=C),g!=null){if(!this.isWebGL2&&!this.aia_ext)throw new Error("Cannot use instanceCount in this rendering context, use webgl2 context instead.");D.instanceCount=g}if(S){const L={};Object.entries(S).forEach(([j,b])=>{if(!y._attribute[j])y._attribute[j]="ignored";else if(y._attribute[j]!=="ignored"){const{name:O,type:Y}=y._attribute[j];let X=b.data||b;if(Array.isArray(X)&&(X=p[Y](X)),L[j]={name:O,data:X},b.divisor!=null){if(!this.isWebGL2&&!this.aia_ext)throw new Error("Cannot use divisor in this rendering context, use webgl2 context instead.");L[j].divisor=b.divisor}}}),D.attributes=L}return D}),this.options.autoUpdate&&this.update()}createProgram(x,y){const C=/^\s*uniform\s+sampler/mg.test(x);x==null&&(x=i.default),y==null&&(y=C?a.default:n.default);const h=this.gl,g=Object(r.createProgram)(h,y,x);g.shaderText={vertexShader:y,fragmentShader:x},g._buffers={},g._attribute={},g.uniforms={},g._samplerMap={},g._bindTextures=[];const f=new RegExp(`(?:attribute|in) vec(\\d) ${this.options.vertexPosition}`,"im");let m=y.match(f);m&&(g._dimension=Number(m[1]));const S=new RegExp(`(?:attribute|in) vec(\\d) ${this.options.vertexTextureCoord}`,"im");m=y.match(S),m&&(g._texCoordSize=Number(m[1]));const A=/^\s*(?:attribute|in) (\w+?)(\d*) (\w+)/gim;if(m=y.match(A),m)for(let D=0;D<m.length;D++){const L=/^\s*(?:attribute|in) (\w+?)(\d*) (\w+)/im,j=m[D].match(L);if(j&&j[3]!==this.options.vertexPosition&&j[3]!==this.options.vertexTextureCoord){let[,b,O,Y]=j;b==="mat"&&(O**=2),g._buffers[Y]=h.createBuffer(),g._attribute[Y]={name:Y,type:b,size:Number(O)||1}}}const P=/^\s*uniform\s+(\w+)\s+(\w+)(\[\d+\])?/mg;m=y.match(P)||[],m=m.concat(x.match(P)||[]),m.forEach(D=>{const L=D.match(/^\s*uniform\s+(\w+)\s+(\w+)(\[\d+\])?/);let[j,b,O]=L.slice(1);j=v[j],O=!!O,j.indexOf("Matrix")!==0&&O&&(j+="v"),this._declareUniform(g,b,j)}),g._buffers.verticesBuffer=h.createBuffer(),g._buffers.cellsBuffer=h.createBuffer();const R=h.getAttribLocation(g,this.options.vertexTextureCoord);return g._enableTextures=R>=0,g._enableTextures&&(g._buffers.texCoordBuffer=h.createBuffer()),this.programs.push(g),g}useProgram(x,y={}){this.startRender=!1,this._renderFrameID&&(cancelAnimationFrame(this._renderFrameID),delete this._renderFrameID);const C=this.gl;C.useProgram(x);const h=x._dimension;C.bindBuffer(C.ARRAY_BUFFER,x._buffers.verticesBuffer);const g=C.getAttribLocation(x,this.options.vertexPosition);if(C.vertexAttribPointer(g,h,C.FLOAT,!1,0,0),C.enableVertexAttribArray(g),x._enableTextures){C.bindBuffer(C.ARRAY_BUFFER,x._buffers.texCoordBuffer);const f=C.getAttribLocation(x,this.options.vertexTextureCoord);C.vertexAttribPointer(f,x._texCoordSize||2,C.FLOAT,!1,0,0),C.enableVertexAttribArray(f)}if(Object.entries(x._attribute).forEach(([f,m])=>{if(m!=="ignored"){const S=m.size,A=y[f]||{},P=!!A.normalize;let R=A.type||"FLOAT";const D=A.key||f;R==="UBYTE"&&(R="UNSIGNED_BYTE"),R==="USHORT"&&(R="UNSIGNED_SHORT"),m.type=R,D&&D!==f&&(x._attribute[D]=m),C.bindBuffer(C.ARRAY_BUFFER,x._buffers[f]);const L=C.getAttribLocation(x,f);L>=0&&(C.vertexAttribPointer(L,S,C[R],P,0,0),C.enableVertexAttribArray(L))}}),!x.meshData){const f=[[-1,-1,0,1].slice(0,h),[1,-1,0,1].slice(0,h),[1,1,0,1].slice(0,h),[-1,1,0,1].slice(0,h)],m=[[0,1,3],[3,1,2]];this.setMeshData({positions:f,cells:m})}return x}compileSync(x,y){x=x||i.default;const C={};function h(S){S=S.replace(/^\s*/mg,"");const A=[],P=S.match(/^#pragma\s+include\s+.*/mg);if(P){for(let R=0;R<P.length;R++){const L=P[R].match(/(?:<|")(.*)(?:>|")/);if(L){const j=L[0].indexOf("<")===0?"lib":"link";let b=L[1];if(b==="graph"&&(b="graphics"),C[b])A.push(`/* included ${b} */`);else if(C[b]=!0,j==="lib"){const O=h(u[b]);A.push(O)}else if(j==="link")throw new Error("Cannot load external links synchronously. Use compile instead of compileSync.")}}A.forEach(R=>{S=S.replace(/^#pragma\s+include\s+.*/m,R)})}return S}const g=h(x),f=y?h(y):null;return this.createProgram(g,f)}async compile(x,y){x=x||i.default;const C={};async function h(S){S=S.replace(/^\s*/mg,"");const A=[],P=S.match(/^#pragma\s+include\s+.*/mg);if(P){for(let R=0;R<P.length;R++){const L=P[R].match(/(?:<|")(.*)(?:>|")/);if(L){const j=L[0].indexOf("<")===0?"lib":"link";let b=L[1];if(b==="graph"&&(b="graphics"),C[b])A.push(`/* included ${b} */`);else if(C[b]=!0,j==="lib"){const O=await h(u[b]);A.push(O)}else if(j==="link"){let O=await p.fetchShader(b);O=await h(O),A.push(O)}}}A.forEach(R=>{S=S.replace(/^#pragma\s+include\s+.*/m,R)})}return S}const g=await h(x),f=y?await h(y):null;return this.createProgram(g,f)}async load(x,y=null){return x=await p.fetchShader(x),y&&(y=await p.fetchShader(y)),this.compile(x,y)}createTexture(x=null,{wrapS:y=this.gl.CLAMP_TO_EDGE,wrapT:C=this.gl.CLAMP_TO_EDGE,minFilter:h=this.gl.LINEAR,magFilter:g=this.gl.LINEAR}={}){const f=this.gl,m=Array.isArray(x)?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);const S=f.createTexture();f.bindTexture(m,S),f.pixelStorei(f.UNPACK_FLIP_Y_WEBGL,!0);const{width:A,height:P}=this.canvas;if(x)if(m===f.TEXTURE_CUBE_MAP)for(let R=0;R<6;R++)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+R,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,x[R]);else f.texImage2D(m,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,x);else if(m===f.TEXTURE_CUBE_MAP)for(let R=0;R<6;R++)this.gl.texImage2D(this.gl.TEXTURE_CUBE_MAP_POSITIVE_X+R,0,f.RGBA,A,P,0,f.RGBA,f.UNSIGNED_BYTE,null);else f.texImage2D(m,0,f.RGBA,A,P,0,f.RGBA,f.UNSIGNED_BYTE,null);return f.texParameteri(m,f.TEXTURE_MIN_FILTER,h),f.texParameteri(m,f.TEXTURE_MAG_FILTER,g),f.texParameteri(m,f.TEXTURE_WRAP_S,y),f.texParameteri(m,f.TEXTURE_WRAP_T,C),m===f.TEXTURE_CUBE_MAP&&(x.width=x[0].width,x.height=x[0].height),f.bindTexture(m,null),S._img=x||{width:A,height:P},S.delete=()=>{this.deleteTexture(S)},S}deleteTexture(x){const y=x._img;this.gl.deleteTexture(x),typeof y.close=="function"&&y.close()}async loadTexture(x,{useImageBitmap:y=!0}={}){const C=await p.loadImage(x,{useImageBitmap:y});return this.createTexture(C)}createFBO({color:x=1,blend:y=!1,depth:C=this.options.depth!==!1,stencil:h=!!this.options.stencil}={}){const g=this.gl,f=g.createFramebuffer();g.bindFramebuffer(g.FRAMEBUFFER,f);const m=[];for(let P=0;P<x;P++){const R=this.createTexture();g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0+P,g.TEXTURE_2D,R,0),m.push(R)}f.textures=m,f.texture=m[0],f.blend=y;const{width:S,height:A}=this.canvas;return C&&!h&&(f.depthBuffer=g.createRenderbuffer(),g.bindRenderbuffer(g.RENDERBUFFER,f.depthBuffer),g.renderbufferStorage(g.RENDERBUFFER,g.DEPTH_COMPONENT16,S,A),g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_ATTACHMENT,g.RENDERBUFFER,f.depthBuffer)),h&&!C&&(f.stencilBuffer=g.createRenderbuffer(),g.bindRenderbuffer(g.RENDERBUFFER,f.stencilBuffer),g.renderbufferStorage(g.RENDERBUFFER,g.STENCIL_INDEX8,S,A),g.framebufferRenderbuffer(g.FRAMEBUFFER,g.STENCIL_ATTACHMENT,g.RENDERBUFFER,f.stencilBuffer)),C&&h&&(f.depthStencilBuffer=g.createRenderbuffer(),g.bindRenderbuffer(g.RENDERBUFFER,f.depthStencilBuffer),g.renderbufferStorage(g.RENDERBUFFER,g.DEPTH_STENCIL,S,A),g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_STENCIL_ATTACHMENT,g.RENDERBUFFER,f.depthStencilBuffer)),g.bindFramebuffer(g.FRAMEBUFFER,null),f}bindFBO(x=null){this.fbo=x}render({clearBuffer:x=!0}={}){this.startRender=!0;const y=this.gl;let C=this.program;C||(C=this.createProgram(),this.useProgram(C)),this.fbo&&y.bindFramebuffer(y.FRAMEBUFFER,this.fbo);const h=this.options.depth;h&&y.enable(y.DEPTH_TEST),this.gl.clear(this.gl.COLOR_BUFFER_BIT|(h?this.gl.DEPTH_BUFFER_BIT:0)|(this.options.stencil?this.gl.STENCIL_BUFFER_BIT:0));const g=this._renderFrameID;this._draw(),this.fbo&&y.bindFramebuffer(y.FRAMEBUFFER,null),this._renderFrameID===g&&(this._renderFrameID=null)}update(){this.startRender&&this._renderFrameID==null&&(this._renderFrameID=requestAnimationFrame(this.render.bind(this)))}}s(p,"defaultOptions",{preserveDrawingBuffer:!0,autoUpdate:!0,vertexPosition:"a_vertexPosition",vertexTextureCoord:"a_vertexTextureCoord",webgl2:!1}),s(p,"UBYTE",p.UNSIGNED_BYTE),s(p,"USHORT",p.UNSIGNED_SHORT),s(p,"fetchShader",r.fetchShader),s(p,"loadImage",r.loadImage)}),(function(o,t,e){e.r(t),e.d(t,"setupWebGL",function(){return n}),e.d(t,"createProgram",function(){return i}),e.d(t,"pointsToBuffer",function(){return a}),e.d(t,"loadImage",function(){return u}),e.d(t,"fetchShader",function(){return M}),e(1).glMatrix.setMatrixArrayType(Array);function r(c,v){const p=["webgl","experimental-webgl","webkit-3d","moz-webgl"];let T=null;for(let x=0;x<p.length;++x){try{T=c.getContext(p[x],v)}catch{}if(T)break}return T}function n(c,v){const p=r(c,v);if(!p)throw new Error("Sorry, your browser doesn't support WebGL.");return p}function i(c,v,p){const T=c.createShader(c.VERTEX_SHADER);if(c.shaderSource(T,v),c.compileShader(T),!c.getShaderParameter(T,c.COMPILE_STATUS)){const C=`Vertex shader failed to compile. The error log is:${c.getShaderInfoLog(T)}`;throw new Error(C)}const x=c.createShader(c.FRAGMENT_SHADER);if(c.shaderSource(x,p),c.compileShader(x),!c.getShaderParameter(x,c.COMPILE_STATUS)){const C=`Fragment shader failed to compile. The error log is:${c.getShaderInfoLog(x)}`;throw new Error(C)}const y=c.createProgram();if(c.attachShader(y,T),c.attachShader(y,x),c.linkProgram(y),!c.getProgramParameter(y,c.LINK_STATUS)){const C=`Shader program failed to link. The error log is:${c.getProgramInfoLog(y)}`;throw new Error(C)}return c.deleteShader(T),c.deleteShader(x),y}function a(c,v=Float32Array,p=null){if(p&&!(p instanceof v))throw new TypeError("Wrong buffer type.");if(c==null||c instanceof v)return c;if(c[0]==null||c[0].length==null)return p?(p.set(c,0),p):new v(c);const T=c[0].length,x=c.length;p||(p=new v(T*x));let y=0;for(let C=0;C<x;C++)for(let h=0;h<T;h++)p[y++]=c[C][h];return p}const s={};function u(c,{useImageBitmap:v=!0,alias:p=null}={}){if(!s[c]){if(typeof Image=="function"){const T=new Image;typeof c=="string"&&!(typeof location=="object"&&/^file:/.test(location.href))&&!/^data:/.test(c)&&(T.crossOrigin="anonymous"),s[c]=new Promise(x=>{T.onload=function(){v&&typeof createImageBitmap=="function"?createImageBitmap(T,{imageOrientation:"flipY"}).then(y=>{s[c]=y,p&&(s[p]=y),x(y)}):(s[c]=T,p&&(s[p]=T),x(T))},T.src=c}),p&&(s[p]=s[c])}else if(typeof fetch=="function")return fetch(c,{method:"GET",mode:"cors",cache:"default"}).then(T=>T.blob()).then(T=>createImageBitmap(T,{imageOrientation:"flipY"}).then(x=>(s[c]=x,p&&(s[p]=x),x)))}return s[c]}const d={};async function M(c){if(d[c])return d[c];const v=await fetch(c);if(v.status>=200&&v.status<300){const p=await v.text();return d[c]=p,p}throw new Error("Shader loaded error.")}}),(function(o,t,e){e.r(t),t.default=`attribute vec3 a_vertexPosition;
|
||
|
||
void main() {
|
||
gl_PointSize = 1.0;
|
||
gl_Position = vec4(a_vertexPosition, 1);
|
||
}`}),(function(o,t,e){e.r(t),t.default=`#ifdef GL_ES
|
||
precision mediump float;
|
||
#endif
|
||
|
||
void main() {
|
||
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.1);
|
||
}`}),(function(o,t,e){e.r(t),t.default=`attribute vec4 a_vertexPosition;
|
||
attribute vec2 a_vertexTextureCoord;
|
||
varying vec2 vTextureCoord;
|
||
|
||
void main() {
|
||
gl_PointSize = 1.0;
|
||
gl_Position = a_vertexPosition;
|
||
vTextureCoord = a_vertexTextureCoord;
|
||
}`}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return a});var r=e(21),n=e(25);e(1).glMatrix.setMatrixArrayType(Array);const i=Symbol("transform");class a{constructor(u,d){this.context=u.getContext("2d"),this.options=d,this[i]=[1,0,0,1,0,0]}createTexture(u){return{_img:u}}async loadTexture(u){const d=await r.default.loadImage(u,{useImageBitmap:!1});return this.createTexture(d)}deleteTexture(u){return u}clear(u,d,M,c){const v=this.context;u=u||0,d=d||0,M=M||v.canvas.width-u,c=c||v.canvas.height-d,v.clearRect(u,d,M,c)}drawMeshCloud(u,{clear:d=!1}={}){const M=[];for(let c=0;c<u.amount;c++){const v=u.getTransform(c);let p=u.getTextureFrame(c);p&&(p=p._img);const T=u.getFilter(c),{fill:x,stroke:y}=u.getCloudRGBA(c);M.push({mesh:u.mesh,_cloudOptions:[x,y,p,v,T]})}u.beforeRender&&u.beforeRender(this.context,u),this.drawMeshes(M,{clear:d,hook:!1}),u.afterRender&&u.afterRender(this.context,u)}drawMeshes(u,{clear:d=!1,hook:M=!0}={}){const c=this.context;d&&c.clearRect(0,0,c.canvas.width,c.canvas.height);let v=null;const{width:p,height:T}=c.canvas,x=u.length;u.forEach((y,C)=>{let h,g,f,m,S;M&&y.beforeRender&&y.beforeRender(c,y),y._cloudOptions&&([h,g,f,m,S]=y._cloudOptions,y=y.mesh);let A=y.filter;if(S&&(A=A?`${A} ${S}`:S),A&&!this.filterBuffer&&this.filterBuffer!==!1){const P=r.default.createCanvas(p,T);P?this.filterBuffer=P.getContext("2d"):this.filterBuffer=!1}v&&v!==A&&(Object(n.applyFilter)(this.filterBuffer,v),c.drawImage(this.filterBuffer.canvas,0,0,p,T),this.filterBuffer.clearRect(0,0,p,T),v=null),A&&this.filterBuffer?(this.filterBuffer.save(),this.filterBuffer.transform(...this[i]),Object(n.drawMesh2D)(y,this.filterBuffer,!1,h,g,f,m),this.filterBuffer.restore(),C===x-1?(Object(n.applyFilter)(this.filterBuffer,A),c.drawImage(this.filterBuffer.canvas,0,0,p,T),this.filterBuffer.clearRect(0,0,p,T)):v=A):(c.save(),c.transform(...this[i]),Object(n.drawMesh2D)(y,c,!1,h,g,f,m),c.restore()),M&&y.afterRender&&y.afterRender(c,y)})}setTransform(u){this[i]=u}}}),(function(o,t,e){e.r(t),(function(r){var n=e(14),i=e(23),a=e(24);e(1).glMatrix.setMatrixArrayType(Array);const s={};function u(p,T){const{style:x,variant:y,weight:C,stretch:h,size:g,pxLineHeight:f,family:m}=p;return h==="normal"?`${x} ${y} ${C} ${g*T}px/${f*T}px ${m}`:`${x} ${y} ${C} ${h} ${g*T}px/${f*T}px ${m}`}function d(p,{font:T,fillColor:x,strokeColor:y,strokeWidth:C,ratio:h=1,textCanvas:g,cachable:f=!1}){let m;if(f){m=[p,T,String(x),String(y),String(C)].join("###");const X=s[m];if(X)return X}g||(g=c(1,1));const S=g.getContext("2d");S.save(),S.font=T;let{width:A}=S.measureText(p);S.restore();const P=Object(i.default)(T),R=Math.max(P.pxLineHeight,P.pxHeight*1.13);/italic|oblique/.test(T)&&(A+=R*Math.tan(15*Math.PI/180)),!x&&!y&&(x="#000");const D=S.canvas,L=Math.ceil(A),j=Math.ceil(R);D.width=Math.round(L*h),D.height=Math.round(j*h),S.save(),S.font=u(P,h),S.textAlign="center",S.textBaseline="middle";const b=D.height*.5+P.pxHeight*.05*h,O=D.width*.5;if(x){if(Array.isArray(x))x=Object(a.default)(x);else if(x.vector){let X;const{vector:Z,colors:$}=x;Z.length===6?X=S.createRadialGradient(...Z):X=S.createLinearGradient(...Z),$.forEach(({offset:rt,color:F})=>{X.addColorStop(rt,F)}),x=X}S.fillStyle=x,S.fillText(p,O,b)}if(y){if(S.lineWidth=C*h,Array.isArray(y))y=Object(a.default)(y);else if(y.vector){let X;const{vector:Z,colors:$}=y;Z.length===6?X=S.createRadialGradient(...Z):X=S.createLinearGradient(...Z),$.forEach(({offset:rt,color:F})=>{X.addColorStop(rt,F)}),y=X}S.strokeStyle=y,S.strokeText(p,O,b)}S.restore();const Y={image:g,rect:[0,0,L,j]};return f&&(s[m]=Y),Y}let M=!1;if(typeof navigator=="object"&&typeof navigator.userAgent=="string"){const p=navigator.userAgent.toLowerCase().match(/chrome\/(\d+)/);p&&(M=Number(p[1])<70)}function c(p,T,x={}){const y=x.offscreen||!M&&x.offscreen!==!1;let C;return typeof r<"u"&&typeof r.createCanvas=="function"?C=r.createCanvas(p,T,x):y&&typeof OffscreenCanvas=="function"?C=new OffscreenCanvas(p,T):(C=document.createElement("canvas"),C.width=p,C.height=T),C}const v={createCanvas:c,createText:d,loadImage:n.default.loadImage};t.default=v}).call(this,e(22))}),(function(o,t){var e;e=(function(){return this})();try{e=e||new Function("return this")()}catch{typeof window=="object"&&(e=window)}o.exports=e}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return x}),e(1).glMatrix.setMatrixArrayType(Array);function r(y,C){if(typeof y=="string"){const f=y.trim().match(/^([\d.]+)(px|pt|pc|in|cm|mm|em|ex|rem|q|vw|vh|vmax|vmin|%)$/);f?y={size:parseFloat(f[1]),unit:f[2]}:y={size:parseInt(y,10),unit:"px"}}let{size:h,unit:g}=y;if(g==="pt")h/=.75;else if(g==="pc")h*=16;else if(g==="in")h*=96;else if(g==="cm")h*=96/2.54;else if(g==="mm")h*=96/25.4;else if(g==="em"||g==="rem"||g==="ex"){if(!C&&typeof getComputedStyle=="function"&&typeof document<"u"){const f=getComputedStyle(document.documentElement).fontSize;C=r(f,16)}h*=C,g==="ex"&&(h/=2)}else if(g==="q")h*=96/25.4/4;else if(g==="vw"||g==="vh"){if(typeof document<"u"){const f=g==="vw"?document.documentElement.clientWidth:document.documentElement.clientHeight;h*=f/100}}else if((g==="vmax"||g==="vmin")&&typeof document<"u"){const f=document.documentElement.clientWidth,m=document.documentElement.clientHeight;g==="vmax"?h*=Math.max(f,m)/100:h*=Math.min(f,m)/100}return h}const n="bold|bolder|lighter|[1-9]00",i="italic|oblique",a="small-caps",s="ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded",u="px|pt|pc|in|cm|mm|em|ex|rem|q|vw|vh|vmax|vmin|%",d=`'([^']+)'|"([^"]+)"|([\\w-]|[一-龥])+`,M=new RegExp(`(${n}) +`,"i"),c=new RegExp(`(${i}) +`,"i"),v=new RegExp(`(${a}) +`,"i"),p=new RegExp(`(${s}) +`,"i"),T=new RegExp("([\\d\\.]+)("+u+")(?:\\/([\\d\\.]+)("+u+"))? *((?:"+d+")( *, *(?:"+d+"))*)");function x(y,C){const h=T.exec(y);if(!h)return;const g=parseFloat(h[3]),f={weight:"normal",style:"normal",stretch:"normal",variant:"normal",size:parseFloat(h[1]),unit:h[2],lineHeight:Number.isFinite(g)?g:void 0,lineHeightUnit:h[4],family:h[5].replace(/ *, */g,",")},m=y.substring(0,h.index),S=M.exec(m),A=c.exec(m),P=v.exec(m),R=p.exec(m);return S&&(f.weight=S[1]),A&&(f.style=A[1]),P&&(f.variant=P[1]),R&&(f.stretch=R[1]),f.pxHeight=r({size:f.size,unit:f.unit},C),f.pxLineHeight=r({size:f.lineHeight||f.size,unit:f.lineHeightUnit||f.unit},C),f}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return r}),e(1).glMatrix.setMatrixArrayType(Array);function r(n){return`rgba(${n.map((i,a)=>a<3?Math.round(i*255):i).join()})`}}),(function(o,t,e){e.r(t),e.d(t,"applyFilter",function(){return s}),e.d(t,"drawMesh2D",function(){return d});var r=e(1),n=e(24),i=e(23),a=e(26);e(1).glMatrix.setMatrixArrayType(Array);function s(M,c){const v=M.canvas;M.save(),M.filter=c,M.drawImage(v,0,0,v.width,v.height),M.restore()}function u(M,c){const v=/rgba\((\d+),(\d+),(\d+),(\d+)\)/;M=M.match(v).slice(1,5).map(Number),c=c.match(v).slice(1,5).map(Number);const p=[],T=c[3];for(let x=0;x<4;x++)p[x]=Object(a.mix)(M[x],c[x],T);return`rgba(${p.join()})`}function d(M,c,v=!0,p=null,T=null,x=null,y=null){c.save();let C=!1,h=!1;if(c.globalAlpha=M.getOpacity(),M._updateMatrix&&M.transformScale/M.contours.scale>1.5&&M.accurate(M.transformScale),M.lineWidth){let m=M.gradient&&M.gradient.stroke;if(m){const{vector:S,colors:A}=m;if(S.length===6)m=c.createRadialGradient(...S);else if(S.length===4)m=c.createLinearGradient(...S);else if(S.length===3)m=c.createCircularGradient(...S);else throw new TypeError("Invalid vector dimension.");A.forEach(({offset:P,color:R})=>{let D=Object(n.default)(R);T&&(D=u(D,T)),m.addColorStop(P,D)}),c.strokeStyle=m,C=!0}else M.strokeStyle&&(T?c.strokeStyle=u(M.strokeStyle,T):c.strokeStyle=M.strokeStyle,C=!0)}C&&(c.lineWidth=M.lineWidth,c.lineJoin=M.lineJoin,c.lineCap=M.lineCap,c.miterLimit=M.miterLimit,M.lineDash&&(c.setLineDash(M.lineDash),M.lineDashOffset&&(c.lineDashOffset=M.lineDashOffset)));let g=M.gradient&&M.gradient.fill;if(g){const{vector:m,colors:S}=g;if(m.length===6)g=c.createRadialGradient(...m);else if(m.length===4)g=c.createLinearGradient(...m);else if(m.length===3)g=c.createCircularGradient(...m);else throw new TypeError("Invalid vector dimension.");S.forEach(({offset:A,color:P})=>{let R=Object(n.default)(P);T&&(R=u(R,T)),g.addColorStop(A,R)}),c.fillStyle=g,h=!0}else M.fillStyle&&(p?c.fillStyle=u(M.fillStyle,p):c.fillStyle=M.fillStyle,h=!0);if(y&&c.transform(...y),c.transform(...M.transformMatrix),M.clipPath){const m=M.clipPath,S=new Path2D(m);c.clip(S)}const f=M.contours.length;if(M.contours.forEach((m,S)=>{const A=m.length,P=A>1&&r.vec2.equals(m[0],m[A-1]),R=S===f-1&&M.texture;if(m&&A>0){if(h||C||R){c.beginPath(),c.moveTo(...m[0]);for(let D=1;D<A;D++)D===A-1&&P?c.closePath():c.lineTo(...m[D])}if(h&&c.fill(M.fillRule),R){c.save(),c.clip();let{image:D,options:L}=M.texture;if(x&&(D=x),L.repeat&&console.warn("Context 2D not supported image repeat yet."),D.font){L.scale&&console.warn("Context 2D not supported text scale yet."),L.srcRect&&console.warn("Context 2D not supported text srcRect yet.");let{font:j,fillColor:b,strokeColor:O,strokeWidth:Y,text:X}=D;!b&&!O&&(b="#000"),Array.isArray(b)&&(b=Object(n.default)(b)),Array.isArray(O)&&(O=Object(n.default)(O)),c.font=j;const{width:Z}=c.measureText(X),$=Object(i.default)(j),rt=Math.max($.pxLineHeight,$.pxHeight*1.13);c.textAlign="center",c.textBaseline="middle";const F=L.rect,Q=F[0]+rt*.5+$.pxHeight*.06,tt=F[1]+Z*.5;F[2]!=null&&c.scale(F[2]/Z,F[3]/rt),b&&(c.fillStyle=b,c.fillText(X,tt,Q)),O&&(c.lineWidth=Y,c.strokeStyle=O,c.strokeText(X,tt,Q))}else{let j=L.rect;const b=L.srcRect;L.scale&&(j=[0,0,c.canvas.width,c.canvas.height]),L.rotated&&j&&(j=[-j[1],j[0],j[3],j[2]]),b&&(j=j||[0,0,b[2],b[3]]),L.rotated&&(c.translate(0,j?j[2]:D.width),c.rotate(-.5*Math.PI)),b?c.drawImage(D,...b,...j):j?c.drawImage(D,...j):c.drawImage(D,0,0)}c.restore()}C&&c.stroke()}}),c.restore(),v){const m=M.filter;m&&s(c,m)}}}),(function(o,t,e){e.r(t),e.d(t,"clamp",function(){return r}),e.d(t,"mix",function(){return n}),e.d(t,"transformPoint",function(){return i}),e(1).glMatrix.setMatrixArrayType(Array);function r(a,s,u){return s>u&&([s,u]=[u,s]),a<s?s:a>u?u:a}function n(a,s,u){return a*(1-u)+s*u}function i(a,s){const[u,d]=a;return[u*s[0]+d*s[2]+s[4],u*s[1]+d*s[3]+s[5]]}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return u});var r=e(28),n=e(29);e(1).glMatrix.setMatrixArrayType(Array);function i(d,M,c){const v=d.uniforms||{},p=M.uniforms||{};if(v.u_texSampler&&p.u_texSampler&&v.u_texSampler!==p.u_texSampler)return!1;const T=Object.keys(v),x=Object.keys(p),y=T.indexOf("u_texSampler"),C=x.indexOf("u_texSampler");if(y>=0&&T.splice(y,1),C>=0&&x.splice(C,1),T.length!==x.length)return!1;const h=T.every(g=>{const f=v[g],m=p[g];if(f===m)return!0;if(f.length&&m.length&&f.length===m.length){for(let S=0;S<f.length;S++)if(f[S]!==m[S])return!1;return!0}return!1});if(h){if(v.u_texSampler&&!p.u_texSampler)M.setTexture(v.u_texSampler,{hidden:!0});else if(!v.u_texSampler&&p.u_texSampler)for(let g=0;g<c.length;g++)c[g].setTexture(p.u_texSampler,{hidden:!0})}return h}const a={};function s(d,M){if(d.length){const c=Object(r.default)(d,a);return c.enableBlend=M,d[0].filterCanvas&&(c.filterCanvas=!0),c.packIndex=d[0].packIndex,c.packLength=d.length,c.beforeRender=d[0].beforeRender,c.pass=d[0].pass,c.afterRender=d[d.length-1].afterRender,d.length=0,c}}function*u(d,M,c=!1){const v=[],p=d.options.bufferSize;let T=0,x=!1;for(let y=0;y<M.length;y++){const C=M[y];if(C instanceof n.default)v.length&&(yield s(v,x)),T=0,x=!1,yield C;else{const h=C.meshData;if(h.clipPath&&!h.uniforms.u_clipSampler){const f=d.createTexture(h.clipPath);h.uniforms.u_clipSampler=f}let g=0;if((!c||!C.canIgnore())&&h&&h.positions.length){C.packIndex=y;const f=C.filterCanvas;if(g=h.positions.length,f||T+g>p)v.length&&(yield s(v,x)),T=0,x=!1;else if(T){const m=v[v.length-1];m&&(m.filterCanvas||m.afterRender||C.beforeRender||m.pass.length||C.pass.length||m.program!==C.program||!i(m,C,v))&&(yield s(v,x),T=0,x=!1)}v.push(C),x=x||C.enableBlend,T+=g}y===M.length-1&&v.length&&(yield s(v,x))}}}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return i}),e(1).glMatrix.setMatrixArrayType(Array);const r={UNSIGNED_BYTE:Uint8Array,UNSIGNED_SHORT:Uint16Array,BYTE:Int8Array,SHORT:Int16Array,FLOAT:Float32Array};function n(a,s){let u=0,d=0,M=0,c=0,v=0,p=0,T=0;const x=a[0].program;for(let y=0;y<a.length;y++){const C=a[y].meshData;if(C){T+=C.positions.length;const h=C.positions[0].length;u+=C.positions.length*h,d+=C.cells.length*3,p+=C.attributes.a_color.length*4;const g=C.textureCoord;g&&(M+=g.length*g[0].length);const f=C.attributes.a_sourceRect;f&&(c+=f.length*4);const m=C.attributes.a_clipUV;m&&(v+=m.length*2)}}if((!s.positions||s.positions.length<u)&&(s.positions=new Float32Array(u)),(!s.cells||s.cells.length<d)&&(s.cells=new Uint16Array(d)),M&&(!s.textureCoord||s.textureCoord.length<M)&&(s.textureCoord=new Float32Array(M)),(!s.a_color||s.a_color.length<p)&&(s.a_color=new Uint8Array(p)),c&&(!s.a_sourceRect||s.a_sourceRect.length<c)&&(s.a_sourceRect=new Float32Array(c)),v&&(!s.a_clipUV||s.a_clipUV.length<v)&&(s.a_clipUV=new Float32Array(v)),x){const y=Object.entries(x._attribute),C=x._attribOpts||{};for(let h=0;h<y.length;h++){const[g,f]=y[h];if(g!=="a_color"&&g!=="a_sourceRect"&&f!=="ignored"){const m=C[g]?C[g].type:"FLOAT",S=r[m],A=f.size*T;(!s[g]||s[g].length<A)&&(s[g]=new S(A))}}}return s}function i(a,s){let u=[],d=[],M=[],c=[],v=[],p=[],T=0,x=0;const y=a[0]?a[0].uniforms||{}:{},C=a[0]?a[0].program:null;s&&(n(a,s),d=s.cells,u=s.positions,M=s.textureCoord,c=s.a_color,v=s.a_sourceRect,p=s.a_clipUV);let h=!1,g=!1;const f={};for(let S=0;S<a.length;S++){let A=a[S];if(A){if(A.meshData&&(A=A.meshData),s){const R=A.positions;for(let D=0;D<R.length;D++){const L=R[D],j=3*(T+D);for(let b=0;b<L.length;b++)u[j+b]=L[b]}}else u.push(...A.positions);const P=A.cells;for(let R=0;R<P.length;R++){const D=P[R];if(s){const L=3*(x+R);d[L]=D[0]+T,d[L+1]=D[1]+T,d[L+2]=D[2]+T}else d.push([D[0]+T,D[1]+T,D[2]+T])}if(s){const R=A.attributes.a_color;for(let D=0;D<R.length;D++){const L=R[D],j=4*(T+D);c[j]=L[0],c[j+1]=L[1],c[j+2]=L[2],c[j+3]=L[3]}}else c.push(...A.attributes.a_color);if(A.attributes.a_sourceRect)if(h=!0,s){const R=A.attributes.a_sourceRect;for(let D=0;D<R.length;D++){const L=R[D],j=4*(T+D);v[j]=L[0],v[j+1]=L[1],v[j+2]=L[2],v[j+3]=L[3]}}else v.push(...A.attributes.a_sourceRect);if(A.attributes.a_clipUV)if(g=!0,s){const R=A.attributes.a_clipUV;for(let D=0;D<R.length;D++){const L=R[D],j=2*(T+D);p[j]=L[0],p[j+1]=L[1]}}else p.push(...A.attributes.a_clipUV);if(A.textureCoord)if(s){const R=A.textureCoord;for(let D=0;D<R.length;D++){const L=R[D],j=3*(T+D);for(let b=0;b<L.length;b++)M[j+b]=L[b]}}else M.push(...A.textureCoord);if(C){const R=Object.entries(C._attribute);for(let D=0;D<R.length;D++){const[L,j]=R[D];if(L!=="a_color"&&L!=="a_sourceRect"&&j!=="ignored")if(f[L]=[],s){f[L]=s[L];const b=A.attributes[L],O=b[0].length;for(let Y=0;Y<b.length;Y++){const X=b[Y],Z=O*(T+Y);for(let $=0;$<X.length;$++)f[L][Z+$]=X[$]}}else f[L].push(...A.attributes[L])}}T+=A.positions.length,x+=A.cells.length}}f.a_color=c,h&&v&&v.length>0&&(f.a_sourceRect=v);const m={positions:u,cells:d,attributes:f,uniforms:y,cellsCount:x*3,program:C};return M&&M.length&&(m.textureCoord=M),g&&p.length>0&&(f.a_clipUV=p),m}}),(function(o,t,e){e.r(t);var r=e(1),n=e(30),i=e(26),a=e(31);e(1).glMatrix.setMatrixArrayType(Array);function s(f,m){var S=Object.keys(f);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(f);m&&(A=A.filter(function(P){return Object.getOwnPropertyDescriptor(f,P).enumerable})),S.push.apply(S,A)}return S}function u(f){for(var m=1;m<arguments.length;m++){var S=arguments[m]!=null?arguments[m]:{};m%2?s(Object(S),!0).forEach(function(A){d(f,A,S[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(f,Object.getOwnPropertyDescriptors(S)):s(Object(S)).forEach(function(A){Object.defineProperty(f,A,Object.getOwnPropertyDescriptor(S,A))})}return f}function d(f,m,S){return m in f?Object.defineProperty(f,m,{value:S,enumerable:!0,configurable:!0,writable:!0}):f[m]=S,f}const M=Symbol("mesh"),c=Symbol("count"),v=Symbol("blend"),p=Symbol("filter"),T=Symbol("textures"),x=Symbol("textureOptions"),y=Symbol("cloudColor"),C=Symbol("cloudFilter"),h=Symbol("buffer");function g(f,m=null){const S=new Float32Array(3*f),A=new Float32Array(3*f),P=new Float32Array(4*f),R=new Float32Array(4*f),D=new Float32Array(4*f),L=new Float32Array(4*f),j=new Float32Array(4*f),b=new Uint8Array(f),O=new Uint8Array(4*f),Y=new Uint8Array(4*f);return m&&(S.set(m.transform0,0),A.set(m.transform1,0),P.set(m.color0,0),R.set(m.color1,0),D.set(m.color2,0),L.set(m.color3,0),j.set(m.color4,0),b.set(m.frameIndex,0),O.set(m.fillColor,0),Y.set(m.strokeColor,0)),{bufferSize:f,transform0:S,transform1:A,color0:P,color1:R,color2:D,color3:L,color4:j,frameIndex:b,fillColor:O,strokeColor:Y}}t.default=class{constructor(f,m=1,{buffer:S=1e3}={}){S=Math.max(S,m),this[c]=m,this[M]=f,this[h]=g(S),this[T]=[],this[p]=[],this[y]=!1,this[C]=!1,this[v]=!1,this.initBuffer()}initBuffer(f=0){const m=this[c];for(let S=f;S<m;S++)this[h].transform0.set([1,0,0],S*3),this[h].transform1.set([0,1,0],S*3),this[h].frameIndex.set([-1],S),this[h].fillColor.set([0,0,0,0],S*4),this[h].strokeColor.set([0,0,0,0],S*4),this.setColorTransform(S,null)}get bufferSize(){return this[h].bufferSize}get mesh(){return this[M]}set mesh(f){this[M]=f,this[T]&&this.setTextureFrames(this[T],this[x])}get hasCloudColor(){return this[y]}get hasCloudFilter(){return this[C]}_getFilter(f){return this[p][f]=this[p][f]||[],this[p][f]}getFilter(f){return this._getFilter(f).join(" ")}get enableBlend(){return this[M].enableBlend||this[v]}canIgnore(){return this[M].canIgnore()}delete(f){if(f>=this[c]||f<0)throw new Error("Out of range.");const{transform0:m,transform1:S,color0:A,color1:P,color2:R,color3:D,color4:L,frameIndex:j,fillColor:b,strokeColor:O}=this[h];m.set(m.subarray(3*(f+1)),3*f),S.set(S.subarray(3*(f+1)),3*f),A.set(A.subarray(4*(f+1)),4*f),P.set(P.subarray(4*(f+1)),4*f),R.set(R.subarray(4*(f+1)),4*f),D.set(D.subarray(4*(f+1)),4*f),L.set(L.subarray(4*(f+1)),4*f),j.set(j.subarray(f+1),f),b.set(b.subarray(4*(f+1)),4*f),O.set(O.subarray(4*(f+1)),4*f);for(const Y in this[p])Y===f?delete this[p][Y]:Y>f&&(this[p][Y-1]=this[p][Y],delete this[p][Y]);this[c]--}setColorTransform(f,m){if(f>=this[c]||f<0)throw new Error("Out of range.");f*=4;const{color0:S,color1:A,color2:P,color3:R,color4:D}=this[h];return m!=null?(S.set([m[0],m[5],m[10],m[15]],f),A.set([m[1],m[6],m[11],m[16]],f),P.set([m[2],m[7],m[12],m[17]],f),R.set([m[3],m[8],m[13],m[18]],f),D.set([m[4],m[9],m[14],m[19]],f),this[v]=this[v]||m[18]<1,this[C]=!0):(S.set([1,0,0,0],f),A.set([0,1,0,0],f),P.set([0,0,1,0],f),R.set([0,0,0,1],f),D.set([0,0,0,0],f)),this}getColorTransform(f){if(f>=this[c]||f<0)throw new Error("Out of range.");f*=4;const{color0:m,color1:S,color2:A,color3:P,color4:R}=this[h];return[m[f],S[f],A[f],P[f],R[f],m[f+1],S[f+1],A[f+1],P[f+1],R[f+1],m[f+2],S[f+2],A[f+2],P[f+2],R[f+2],m[f+3],S[f+3],A[f+3],P[f+3],R[f+3]]}transformColor(f,m){let S=this.getColorTransform(f);return S=Object(n.multiply)(S,m),this.setColorTransform(f,S),this}setFillColor(f,m){if(f>=this[c]||f<0)throw new Error("Out of range.");typeof m=="string"&&(m=Object(a.default)(m)),m[3]>0&&(this[y]=!0),this[h].fillColor.set(m.map(S=>Math.round(255*S)),4*f)}setStrokeColor(f,m){if(f>=this[c]||f<0)throw new Error("Out of range.");typeof m=="string"&&(m=Object(a.default)(m)),m[3]>0&&(this[y]=!0),this[h].strokeColor.set(m.map(S=>Math.round(255*S)),4*f)}getCloudRGBA(f){if(f>=this[c]||f<0)throw new Error("Out of range.");f*=4;const{fillColor:m,strokeColor:S}=this[h],A=[m[f],m[f+1],m[f+2],m[f+3]],P=[S[f],S[f+1],S[f+2],S[f+3]];return A[3]/=255,P[3]/=255,{fill:`rgba(${A.join()})`,stroke:`rgba(${P.join()})`}}grayscale(f,m){this.transformColor(f,Object(n.grayscale)(m)),this._getFilter(f).push(`grayscale(${100*m}%)`)}brightness(f,m){this.transformColor(f,Object(n.brightness)(m)),this._getFilter(f).push(`brightness(${100*m}%)`)}saturate(f,m){this.transformColor(f,Object(n.saturate)(m)),this._getFilter(f).push(`saturate(${100*m}%)`)}contrast(f,m){this.transformColor(f,Object(n.contrast)(m)),this._getFilter(f).push(`contrast(${100*m}%)`)}invert(f,m){this.transformColor(f,Object(n.invert)(m)),this._getFilter(f).push(`invert(${100*m}%)`)}sepia(f,m){this.transformColor(f,Object(n.sepia)(m)),this._getFilter(f).push(`sepia(${100*m}%)`)}opacity(f,m){this.transformColor(f,Object(n.opacity)(m)),this._getFilter(f).push(`opacity(${100*m}%)`)}hueRotate(f,m){this.transformColor(f,Object(n.hueRotate)(m)),this._getFilter(f).push(`hue-rotate(${m}deg)`)}setTransform(f,m){if(f>=this[c]||f<0)throw new Error("Out of range.");f*=3,m==null&&(m=[1,0,0,1,0,0]);const{transform0:S,transform1:A}=this[h];return S.set([m[0],m[2],m[4]],f),A.set([m[1],m[3],m[5]],f),this}getTransform(f){if(f>=this[c]||f<0)throw new Error("Out of range.");f*=3;const{transform0:m,transform1:S}=this[h];return[m[f],S[f],m[f+1],S[f+1],m[f+2],S[f+2]]}getTextureFrame(f){return this[T][this[h].frameIndex[f]]}setTextureFrames(f=[],m={}){if(f.length>12)throw new Error("Max frames exceed. Allow 12 frames.");f.length&&this[M].setTexture(f[0],m),this[T]=f,this[x]=m}setFrameIndex(f,m){if(f>=this[c]||f<0)throw new Error("Out of range.");const S=this[T].length;if(S<=0)throw new Error("No frames");this[h].frameIndex[f]=m%S}get amount(){return this[c]}set amount(f){const m=this[c];f!==m&&(f>this[h].bufferSize&&(this[h]=g(Math.max(f,this[h].bufferSize+1e3),this[h])),this[c]=f,f>m&&this.initBuffer(m))}get meshData(){const{attributes:f,cells:m,positions:S,textureCoord:A,uniforms:P}=this[M].meshData,R=this[T],D={attributes:u({},f),cells:m,positions:S,textureCoord:A,uniforms:u({},P),instanceCount:this[c],enableBlend:this.enableBlend};R.length&&R.forEach((Q,tt)=>{D.uniforms[`u_texFrame${tt}`]=Q});const{transform0:L,transform1:j,color0:b,color1:O,color2:Y,color3:X,color4:Z,fillColor:$,strokeColor:rt,frameIndex:F}=this[h];return this[M].uniforms.u_texSampler&&(D.attributes.a_frameIndex={data:F,divisor:1}),D.attributes.a_transform0={data:L,divisor:1},D.attributes.a_transform1={data:j,divisor:1},D.attributes.a_colorCloud0={data:b,divisor:1},D.attributes.a_colorCloud1={data:O,divisor:1},D.attributes.a_colorCloud2={data:Y,divisor:1},D.attributes.a_colorCloud3={data:X,divisor:1},D.attributes.a_colorCloud4={data:Z,divisor:1},this.hasCloudColor&&(D.attributes.a_fillCloudColor={data:$,divisor:1},D.attributes.a_strokeCloudColor={data:rt,divisor:1}),D}setProgram(f){this[M].setProgram(f)}get program(){return this[M].program}transform(f,m){const S=this.getTransform(f);return m=r.mat2d.multiply(Array.of(0,0,0,0,0,0),S,m),this.setTransform(f,m),this}translate(f,[m,S]){let A=r.mat2d.create();return A=r.mat2d.translate(Array.of(0,0,0,0,0,0),A,[m,S]),this.transform(f,A)}rotate(f,m,[S,A]=[0,0]){let P=r.mat2d.create();return P=r.mat2d.translate(Array.of(0,0,0,0,0,0),P,[S,A]),P=r.mat2d.rotate(Array.of(0,0,0,0,0,0),P,m),P=r.mat2d.translate(Array.of(0,0,0,0,0,0),P,[-S,-A]),this.transform(f,P)}scale(f,[m,S=m],[A,P]=[0,0]){let R=r.mat2d.create();return R=r.mat2d.translate(Array.of(0,0,0,0,0,0),R,[A,P]),R=r.mat2d.scale(Array.of(0,0,0,0,0,0),R,[m,S]),R=r.mat2d.translate(Array.of(0,0,0,0,0,0),R,[-A,-P]),this.transform(f,R)}skew(f,[m,S=m],[A,P]=[0,0]){let R=r.mat2d.create();return R=r.mat2d.translate(Array.of(0,0,0,0,0,0),R,[A,P]),R=r.mat2d.multiply(Array.of(0,0,0,0,0,0),R,r.mat2d.fromValues(1,Math.tan(S),Math.tan(m),1,0,0)),R=r.mat2d.translate(Array.of(0,0,0,0,0,0),R,[-A,-P]),this.transform(f,R)}isPointCollision(f,[m,S],A="both"){const P=this.getTransform(f),R=Object(i.transformPoint)([m,S],r.mat2d.invert(Array.of(0,0,0,0,0,0),P));return this[M].isPointCollision(...R,A)}isPointInFill(f,[m,S]){return this.isPointCollision(f,[m,S],"fill")}isPointInStroke(f,[m,S]){return this.isPointCollision(f,[m,S],"stroke")}}}),(function(o,t,e){e.r(t),e.d(t,"multiply",function(){return n}),e.d(t,"grayscale",function(){return i}),e.d(t,"brightness",function(){return a}),e.d(t,"saturate",function(){return s}),e.d(t,"contrast",function(){return u}),e.d(t,"invert",function(){return d}),e.d(t,"sepia",function(){return M}),e.d(t,"opacity",function(){return c}),e.d(t,"hueRotate",function(){return v});var r=e(26);e(1).glMatrix.setMatrixArrayType(Array);function n(p,T){const x=[],y=p[0],C=p[1],h=p[2],g=p[3],f=p[4],m=p[5],S=p[6],A=p[7],P=p[8],R=p[9],D=p[10],L=p[11],j=p[12],b=p[13],O=p[14],Y=p[15],X=p[16],Z=p[17],$=p[18],rt=p[19];let F=T[0],Q=T[1],tt=T[2],lt=T[3],ct=T[4];return x[0]=F*y+Q*m+tt*D+lt*Y,x[1]=F*C+Q*S+tt*L+lt*X,x[2]=F*h+Q*A+tt*j+lt*Z,x[3]=F*g+Q*P+tt*b+lt*$,x[4]=F*f+Q*R+tt*O+lt*rt+ct,F=T[5],Q=T[6],tt=T[7],lt=T[8],ct=T[9],x[5]=F*y+Q*m+tt*D+lt*Y,x[6]=F*C+Q*S+tt*L+lt*X,x[7]=F*h+Q*A+tt*j+lt*Z,x[8]=F*g+Q*P+tt*b+lt*$,x[9]=F*f+Q*R+tt*O+lt*rt+ct,F=T[10],Q=T[11],tt=T[12],lt=T[13],ct=T[14],x[10]=F*y+Q*m+tt*D+lt*Y,x[11]=F*C+Q*S+tt*L+lt*X,x[12]=F*h+Q*A+tt*j+lt*Z,x[13]=F*g+Q*P+tt*b+lt*$,x[14]=F*f+Q*R+tt*O+lt*rt+ct,F=T[15],Q=T[16],tt=T[17],lt=T[18],ct=T[19],x[15]=F*y+Q*m+tt*D+lt*Y,x[16]=F*C+Q*S+tt*L+lt*X,x[17]=F*h+Q*A+tt*j+lt*Z,x[18]=F*g+Q*P+tt*b+lt*$,x[19]=F*f+Q*R+tt*O+lt*rt+ct,x}function i(p){p=Object(r.clamp)(0,1,p);const T=.2126*p,x=.7152*p,y=.0722*p;return[T+1-p,x,y,0,0,T,x+1-p,y,0,0,T,x,y+1-p,0,0,0,0,0,1,0]}function a(p){return[p,0,0,0,0,0,p,0,0,0,0,0,p,0,0,0,0,0,1,0]}function s(p){const T=.2126*(1-p),x=.7152*(1-p),y=.0722*(1-p);return[T+p,x,y,0,0,T,x+p,y,0,0,T,x,y+p,0,0,0,0,0,1,0]}function u(p){const T=.5*(1-p);return[p,0,0,0,T,0,p,0,0,T,0,0,p,0,T,0,0,0,1,0]}function d(p){const T=1-2*p;return[T,0,0,0,p,0,T,0,0,p,0,0,T,0,p,0,0,0,1,0]}function M(p){return[1-.607*p,.769*p,.189*p,0,0,.349*p,1-.314*p,.168*p,0,0,.272*p,.534*p,1-.869*p,0,0,0,0,0,1,0]}function c(p){return[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,p,0]}function v(p){const T=p/180*Math.PI,x=Math.cos(T),y=Math.sin(T),C=.2126,h=.7152,g=.0722;return[C+x*(1-C)+y*-C,h+x*-h+y*-h,g+x*-g+y*(1-g),0,0,C+x*-C+y*.143,h+x*(1-h)+y*.14,g+x*-g+y*-.283,0,0,C+x*-C+y*-.7874,h+x*-h+y*h,g+x*(1-g)+y*g,0,0,0,0,0,1,0]}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return i});var r=e(32),n=e.n(r);e(1).glMatrix.setMatrixArrayType(Array);function i(a){const s=n()(a);if(!s||!s.length)throw new TypeError("Invalid color value.");return[s[0]/255,s[1]/255,s[2]/255,s[3]]}}),(function(o,t,e){var r=e(33),n=e(37),i=e(39);o.exports=function(s){var u,d=r(s);return d.space?(u=Array(3),u[0]=i(d.values[0],0,255),u[1]=i(d.values[1],0,255),u[2]=i(d.values[2],0,255),d.space[0]==="h"&&(u=n.rgb(u)),u.push(i(d.alpha,0,1)),u):[]}}),(function(o,t,e){(function(r){var n=e(34),i=e(35),a=e(36);o.exports=u;var s={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function u(d){var M,c=[],v=1,p;if(typeof d=="string")if(n[d])c=n[d].slice(),p="rgb";else if(d==="transparent")v=0,p="rgb",c=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(d)){var T=d.slice(1),x=T.length,y=x<=4;v=1,y?(c=[parseInt(T[0]+T[0],16),parseInt(T[1]+T[1],16),parseInt(T[2]+T[2],16)],x===4&&(v=parseInt(T[3]+T[3],16)/255)):(c=[parseInt(T[0]+T[1],16),parseInt(T[2]+T[3],16),parseInt(T[4]+T[5],16)],x===8&&(v=parseInt(T[6]+T[7],16)/255)),c[0]||(c[0]=0),c[1]||(c[1]=0),c[2]||(c[2]=0),p="rgb"}else if(M=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(d)){var C=M[1],h=C==="rgb",T=C.replace(/a$/,"");p=T;var x=T==="cmyk"?4:T==="gray"?1:3;c=M[2].trim().split(/\s*,\s*/).map(function(S,A){if(/%$/.test(S))return A===x?parseFloat(S)/100:T==="rgb"?parseFloat(S)*255/100:parseFloat(S);if(T[A]==="h"){if(/deg$/.test(S))return parseFloat(S);if(s[S]!==void 0)return s[S]}return parseFloat(S)}),C===T&&c.push(1),v=h||c[x]===void 0?1:c[x],c=c.slice(0,x)}else d.length>10&&/[0-9](?:\s|\/)/.test(d)&&(c=d.match(/([0-9]+)/g).map(function(f){return parseFloat(f)}),p=d.match(/([a-z])/ig).join("").toLowerCase());else if(!isNaN(d))p="rgb",c=[d>>>16,(d&65280)>>>8,d&255];else if(i(d)){var g=a(d.r,d.red,d.R,null);g!==null?(p="rgb",c=[g,a(d.g,d.green,d.G),a(d.b,d.blue,d.B)]):(p="hsl",c=[a(d.h,d.hue,d.H),a(d.s,d.saturation,d.S),a(d.l,d.lightness,d.L,d.b,d.brightness)]),v=a(d.a,d.alpha,d.opacity,1),d.opacity!=null&&(v/=100)}else(Array.isArray(d)||r.ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(d))&&(c=[d[0],d[1],d[2]],p="rgb",v=d.length===4?d[3]:1);return{space:p,values:c,alpha:v}}}).call(this,e(22))}),(function(o,t,e){o.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(o,t,e){var r=Object.prototype.toString;o.exports=function(n){var i;return r.call(n)==="[object Object]"&&(i=Object.getPrototypeOf(n),i===null||i===Object.getPrototypeOf({}))}}),(function(o,t){o.exports=function(){for(var e=0;e<arguments.length;e++)if(arguments[e]!==void 0)return arguments[e]}}),(function(o,t,e){var r=e(38);o.exports={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(n){var i=n[0]/360,a=n[1]/100,s=n[2]/100,u,d,M,c,v;if(a===0)return v=s*255,[v,v,v];s<.5?d=s*(1+a):d=s+a-s*a,u=2*s-d,c=[0,0,0];for(var p=0;p<3;p++)M=i+1/3*-(p-1),M<0?M++:M>1&&M--,6*M<1?v=u+(d-u)*6*M:2*M<1?v=d:3*M<2?v=u+(d-u)*(2/3-M)*6:v=u,c[p]=v*255;return c}},r.hsl=function(n){var i=n[0]/255,a=n[1]/255,s=n[2]/255,u=Math.min(i,a,s),d=Math.max(i,a,s),M=d-u,c,v,p;return d===u?c=0:i===d?c=(a-s)/M:a===d?c=2+(s-i)/M:s===d&&(c=4+(i-a)/M),c=Math.min(c*60,360),c<0&&(c+=360),p=(u+d)/2,d===u?v=0:p<=.5?v=M/(d+u):v=M/(2-d-u),[c,v*100,p*100]}}),(function(o,t,e){o.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}}),(function(o,t){o.exports=e;function e(r,n,i){return n<i?r<n?n:r>i?i:r:r<i?i:r>n?n:r}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return g});var r=e(41),n=e.n(r),i=e(42),a=e.n(i),s=e(43),u=e.n(s),d=e(44),M=e(46),c=e.n(M),v=e(53),p=e(55);e(1).glMatrix.setMatrixArrayType(Array);const T=Symbol("contours"),x=Symbol("path"),y=Symbol("simplify"),C=Symbol("scale"),h=2*Math.PI;class g{constructor(m={}){typeof m=="string"&&(m={path:m}),m.path?this[x]=n()(m.path):this[x]=[],this[T]=null,this[y]=m.simplify!=null?m.simplify:0,this[C]=m.scale!=null?m.scale:2}get contours(){let m=null;if(!this[T]&&this[x]){const S=Object(d.default)(u()(this[x]));this[T]=c()(S,this[C],this[y]),this[T].path=S,this[T].simplify=this[y],this[T].scale=this[C]}return this[T]&&(m=this[T].map(S=>[...S]),m.path=this[T].path,m.simplify=this[T].simplify,m.scale=this[T].scale),m}get path(){return this[x]}get simplify(){return this[y]}get boundingBox(){const m=this.contours;if(m&&m.length){const S=m.reduce((A,P)=>[...A,...P]);return a()(S)}return[[0,0],[0,0]]}get boundingCenter(){const m=this.boundingBox;return m?[.5*(m[0][0]+m[1][0]),.5*(m[0][1]+m[1][1])]:[0,0]}normalize(m=0,S=0){const A=Object(d.default)(u()(this[x])).map(([P,...R])=>{const D=[P];for(let L=0;L<R.length;L+=2){const j=R[L]-m,b=R[L+1]-S;D.push(j,b)}return D});return this.beginPath(),this[x].push(...A),this}getPointAtLength(m){return this.contours?Object(v.getPointAtLength)(this[T],m):null}getTotalLength(){return this.contours?Object(v.getTotalLength)(this[T]):0}addPath(m){this[T]=null,typeof m=="string"&&(m=n()(m)),this[x].push(...m)}beginPath(){this[x]=[],this[T]=null}clear(){this.beginPath()}ellipse(m,S,A,P,R,D,L,j=0){if(D+=R,L+=R,A<=0||P<=0||L===D)return;L<D&&(L=D+h+(L-D)%h),L-D>h&&(L=D+h);const b=L-D;b>=h&&(L-=.001);let O=this[x].length>0&&b<h?"L":"M";const Y=Object(p.getPoint)(m,S,A,P,D),X=Object(p.getPoint)(m,S,A,P,L),Z=+!j;let $=b>Math.PI?1:0;j&&($=1-$),O+=Y.join(" "),O+=`A${A} ${P} 0 ${$} ${Z} ${X.join(" ")}`,b>=h&&(O+="Z"),this.addPath(O)}arc(m,S,A,P,R,D=0){return this.ellipse(m,S,A,A,0,P,R,D)}arcTo(m,S,A,P,R,D,L){this[T]=null,this[x].push(["A",m,S,A,P,R,D,L])}moveTo(m,S){this[T]=null,this[x].push(["M",m,S])}lineTo(m,S){this[T]=null,this[x].push(["L",m,S])}bezierCurveTo(m,S,A,P,R,D){this[T]=null,this[x].push(["C",m,S,A,P,R,D])}quadraticCurveTo(m,S,A,P){this[T]=null,this[x].push(["Q",m,S,A,P])}rect(m,S,A,P){const R=`M${m} ${S}L${m+A} ${S}L${m+A} ${S+P}L${m} ${S+P}Z`;this.addPath(R)}closePath(){this[T]=null;let m=[];const S=this[x].length;S>0&&(m=this[x][S-1]),m[0]!=="Z"&&m[0]!=="z"&&this[x].push(["Z"])}}}),(function(o,t){o.exports=n;var e={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},r=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function n(s){var u=[];return s.replace(r,function(d,M,c){var v=M.toLowerCase();for(c=a(c),v=="m"&&c.length>2&&(u.push([M].concat(c.splice(0,2))),v="l",M=M=="m"?"l":"L");;){if(c.length==e[v])return c.unshift(M),u.push(c);if(c.length<e[v])throw new Error("malformed path data");u.push([M].concat(c.splice(0,e[v])))}}),u}var i=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function a(s){var u=s.match(i);return u?u.map(Number):[]}}),(function(o,t,e){o.exports=r;function r(n){var i=n.length;if(i===0)return[[],[]];for(var a=n[0].length,s=n[0].slice(),u=n[0].slice(),d=1;d<i;++d)for(var M=n[d],c=0;c<a;++c){var v=M[c];s[c]=Math.min(s[c],v),u[c]=Math.max(u[c],v)}return[s,u]}}),(function(o,t){o.exports=e;function e(r){var n=0,i=0,a=0,s=0;return r.map(function(u){u=u.slice();var d=u[0],M=d.toUpperCase();if(d!=M)switch(u[0]=M,d){case"a":u[6]+=a,u[7]+=s;break;case"v":u[1]+=s;break;case"h":u[1]+=a;break;default:for(var c=1;c<u.length;)u[c++]+=a,u[c++]+=s}switch(M){case"Z":a=n,s=i;break;case"H":a=u[1];break;case"V":s=u[1];break;case"M":a=n=u[1],s=i=u[2];break;default:a=u[u.length-2],s=u[u.length-1]}return u})}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return n});var r=e(45);e(1).glMatrix.setMatrixArrayType(Array);function n(s){for(var u,d=[],M=0,c=0,v=0,p=0,T=null,x=null,y=0,C=0,h=0,g=s.length;h<g;h++){var f=s[h],m=f[0];switch(m){case"M":v=f[1],p=f[2];break;case"A":var S=Object(r.default)(y,C,f[6],f[7],f[4],f[5],f[1],f[2],f[3]);if(!S.length)continue;S=S.map(L=>{const[j,b,O,Y,X,Z,$,rt]=L;return{x1:O,y1:Y,x2:X,y2:Z,x:$,y:rt}});for(var A=0,P;A<S.length;A++)P=S[A],f=["C",P.x1,P.y1,P.x2,P.y2,P.x,P.y],A<S.length-1&&d.push(f);break;case"S":var R=y,D=C;(u=="C"||u=="S")&&(R+=R-M,D+=D-c),f=["C",R,D,f[1],f[2],f[3],f[4]];break;case"T":u=="Q"||u=="T"?(T=y*2-T,x=C*2-x):(T=y,x=C),f=a(y,C,T,x,f[1],f[2]);break;case"Q":T=f[1],x=f[2],f=a(y,C,f[1],f[2],f[3],f[4]);break;case"L":f=i(y,C,f[1],f[2]);break;case"H":f=i(y,C,f[1],C);break;case"V":f=i(y,C,y,f[1]);break;case"Z":f=i(y,C,v,p);break}u=m,y=f[f.length-2],C=f[f.length-1],f.length>4?(M=f[f.length-4],c=f[f.length-3]):(M=y,c=C),d.push(f)}return d}function i(s,u,d,M){return["C",s,u,d,M,d,M]}function a(s,u,d,M,c,v){return["C",s/3+2/3*d,u/3+2/3*M,c/3+2/3*d,v/3+2/3*M,c,v]}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return s}),e(1).glMatrix.setMatrixArrayType(Array);const r=Math.PI*2;function n(u,d,M,c){const v=u*c-d*M<0?-1:1;let p=u*M+d*c;return p>1&&(p=1),p<-1&&(p=-1),v*Math.acos(p)}function i(u,d,M,c,v,p,T,x,y,C){const h=C*(u-M)/2+y*(d-c)/2,g=-y*(u-M)/2+C*(d-c)/2,f=T*T,m=x*x,S=h*h,A=g*g;let P=f*m-f*A-m*S;P<0&&(P=0),P/=f*A+m*S,P=Math.sqrt(P)*(v===p?-1:1);const R=P*T/x*g,D=P*-x/T*h,L=C*R-y*D+(u+M)/2,j=y*R+C*D+(d+c)/2,b=(h-R)/T,O=(g-D)/x,Y=(-h-R)/T,X=(-g-D)/x,Z=n(1,0,b,O);let $=n(b,O,Y,X);return p===0&&$>0&&($-=r),p===1&&$<0&&($+=r),[L,j,Z,$]}function a(u,d){const M=1.3333333333333333*Math.tan(d/4),c=Math.cos(u),v=Math.sin(u),p=Math.cos(u+d),T=Math.sin(u+d);return[c,v,c-v*M,v+c*M,p+T*M,T-p*M,p,T]}function s(u,d,M,c,v,p,T,x,y){const C=Math.sin(y*r/360),h=Math.cos(y*r/360),g=h*(u-M)/2+C*(d-c)/2,f=-C*(u-M)/2+h*(d-c)/2;if(g===0&&f===0)return[];if(T===0||x===0)return[];T=Math.abs(T),x=Math.abs(x);const m=g*g/(T*T)+f*f/(x*x);m>1&&(T*=Math.sqrt(m),x*=Math.sqrt(m));const S=i(u,d,M,c,v,p,T,x,C,h),A=[];let P=S[2],R=S[3];const D=Math.max(Math.ceil(Math.abs(R)/(r/4)),1);R/=D;for(let L=0;L<D;L++)A.push(a(P,R)),P+=R;return A.map(L=>{for(let j=0;j<L.length;j+=2){let b=L[j+0],O=L[j+1];b*=T,O*=x;const Y=h*b-C*O,X=C*b+h*O;L[j+0]=Y+S[0],L[j+1]=X+S[1]}return L})}}),(function(o,t,e){e(1).glMatrix.setMatrixArrayType(Array);var r=e(47),{copy:n}=e(49),i=e(50);function a(c,v,p){return c[0]=v,c[1]=p,c}var s=[0,0],u=[0,0],d=[0,0];function M(c,v,p,T){r(p,a(s,T[1],T[2]),a(u,T[3],T[4]),a(d,T[5],T[6]),v,c)}o.exports=function(v,p,T){var x=[],y=[],C=[0,0];return v.forEach(function(h,g,f){if(h[0]==="M")n(C,h.slice(1)),y.length>0&&(x.push(y),y=[]);else if(h[0]==="C")M(y,p,C,h),a(C,h[5],h[6]);else throw new Error("illegal type in SVG: "+h[0])}),y.length>0&&x.push(y),x.map(function(h){return i(h,T||0)})}}),(function(o,t,e){o.exports=e(48)()}),(function(o,t){function e(n){return[n[0],n[1]]}function r(n,i){return[n,i]}o.exports=function(i){i=i||{};var a=typeof i.recursion=="number"?i.recursion:8,s=typeof i.epsilon=="number"?i.epsilon:11920929e-14,u=typeof i.pathEpsilon=="number"?i.pathEpsilon:1,d=typeof i.angleEpsilon=="number"?i.angleEpsilon:.01,M=i.angleTolerance||0,c=i.cuspLimit||0;return function(x,y,C,h,g,f){f||(f=[]),g=typeof g=="number"?g:1;var m=u/g;return m*=m,v(x,y,C,h,f,m),f};function v(T,x,y,C,h,g){h.push(e(T));var f=T[0],m=T[1],S=x[0],A=x[1],P=y[0],R=y[1],D=C[0],L=C[1];p(f,m,S,A,P,R,D,L,h,g,0),h.push(e(C))}function p(T,x,y,C,h,g,f,m,S,A,P){if(!(P>a)){var R=Math.PI,D=(T+y)/2,L=(x+C)/2,j=(y+h)/2,b=(C+g)/2,O=(h+f)/2,Y=(g+m)/2,X=(D+j)/2,Z=(L+b)/2,$=(j+O)/2,rt=(b+Y)/2,F=(X+$)/2,Q=(Z+rt)/2;if(P>0){var tt=f-T,lt=m-x,ct=Math.abs((y-f)*lt-(C-m)*tt),Mt=Math.abs((h-f)*lt-(g-m)*tt),st,Tt;if(ct>s&&Mt>s){if((ct+Mt)*(ct+Mt)<=A*(tt*tt+lt*lt)){if(M<d){S.push(r(F,Q));return}var xt=Math.atan2(g-C,h-y);if(st=Math.abs(xt-Math.atan2(C-x,y-T)),Tt=Math.abs(Math.atan2(m-g,f-h)-xt),st>=R&&(st=2*R-st),Tt>=R&&(Tt=2*R-Tt),st+Tt<M){S.push(r(F,Q));return}if(c!==0){if(st>c){S.push(r(y,C));return}if(Tt>c){S.push(r(h,g));return}}}}else if(ct>s){if(ct*ct<=A*(tt*tt+lt*lt)){if(M<d){S.push(r(F,Q));return}if(st=Math.abs(Math.atan2(g-C,h-y)-Math.atan2(C-x,y-T)),st>=R&&(st=2*R-st),st<M){S.push(r(y,C)),S.push(r(h,g));return}if(c!==0&&st>c){S.push(r(y,C));return}}}else if(Mt>s){if(Mt*Mt<=A*(tt*tt+lt*lt)){if(M<d){S.push(r(F,Q));return}if(st=Math.abs(Math.atan2(m-g,f-h)-Math.atan2(g-C,h-y)),st>=R&&(st=2*R-st),st<M){S.push(r(y,C)),S.push(r(h,g));return}if(c!==0&&st>c){S.push(r(h,g));return}}}else if(tt=F-(T+f)/2,lt=Q-(x+m)/2,tt*tt+lt*lt<=A){S.push(r(F,Q));return}}p(T,x,D,L,X,Z,F,Q,S,A,P+1),p(F,Q,$,rt,O,Y,f,m,S,A,P+1)}}}}),(function(o,t,e){e.r(t),e.d(t,"create",function(){return i}),e.d(t,"clone",function(){return n}),e.d(t,"copy",function(){return a}),e.d(t,"scaleAndAdd",function(){return s}),e.d(t,"dot",function(){return u}),e.d(t,"rotate",function(){return d}),e.d(t,"cross",function(){return M}),e.d(t,"sub",function(){return c}),e.d(t,"add",function(){return v}),e.d(t,"computeMiter",function(){return y}),e.d(t,"normal",function(){return C}),e.d(t,"direction",function(){return h});var r=e(1);e(1).glMatrix.setMatrixArrayType(Array);function n(g){return[g[0],g[1]]}function i(){return[0,0]}const a=r.vec2.copy,s=r.vec2.scaleAndAdd,u=r.vec2.dot,d=r.vec2.rotate,M=r.vec2.cross,c=r.vec2.sub,v=r.vec2.add,p=r.vec2.normalize,T=r.vec2.set,x=i();function y(g,f,m,S,A){v(g,m,S),p(g,g),T(f,-g[1],g[0]),T(x,-m[1],m[0]);const P=A/u(f,x);return Math.abs(P)}function C(g,f){return T(g,-f[1],f[0]),g}function h(g,f,m){return c(g,f,m),p(g,g),g}}),(function(o,t,e){var r=e(51),n=e(52);o.exports=function(a,s){return a=r(a,s),a=n(a,s),a},o.exports.radialDistance=r,o.exports.douglasPeucker=n}),(function(o,t){function e(r,n){var i=r[0]-n[0],a=r[1]-n[1];return i*i+a*a}o.exports=function(n,i){if(n.length<=1)return n;i=typeof i=="number"?i:1;for(var a=i*i,s=n[0],u=[s],d,M=1,c=n.length;M<c;M++)d=n[M],e(d,s)>a&&(u.push(d),s=d);return s!==d&&u.push(d),u}}),(function(o,t){function e(n,i,a){var s=i[0],u=i[1],d=a[0]-s,M=a[1]-u;if(d!==0||M!==0){var c=((n[0]-s)*d+(n[1]-u)*M)/(d*d+M*M);c>1?(s=a[0],u=a[1]):c>0&&(s+=d*c,u+=M*c)}return d=n[0]-s,M=n[1]-u,d*d+M*M}function r(n,i,a,s,u){for(var d=s,M,c=i+1;c<a;c++){var v=e(n[c],n[i],n[a]);v>d&&(M=c,d=v)}d>s&&(M-i>1&&r(n,i,M,s,u),u.push(n[M]),a-M>1&&r(n,M,a,s,u))}o.exports=function(i,a){if(i.length<=1)return i;a=typeof a=="number"?a:1;var s=a*a,u=i.length-1,d=[i[0]];return r(i,0,u,s,d),d.push(i[u]),d}}),(function(o,t,e){e.r(t),e.d(t,"getTotalLength",function(){return n}),e.d(t,"getPointAtLength",function(){return a}),e.d(t,"getDashContours",function(){return s});var r=e(54);e(1).glMatrix.setMatrixArrayType(Array);function n(u){if(u.totalLength!=null)return u.totalLength;let d=0;return u.forEach(M=>{let c=M[0];for(let v=1;v<M.length;v++){const p=M[v];d+=Object(r.distance)(c,p),c=p}}),u.totalLength=d,d}function i(u,d,M=!0){if(d=Number(d),!Number.isFinite(d))throw new TypeError("Failed to execute 'getPointAtLength' on figure: The provided float value is non-finite.");if(d<=0)throw new TypeError("Length must > 0");const c=n(u);if(d>=c){const p=u[u.length-1],T=p[p.length-2],x=p[p.length-1],y=Math.atan2(x[1]-T[1],x[0]-T[0]);return{current:u.map(C=>[...C]),point:{x:x[0],y:x[1],angle:y}}}const v=[];for(let p=0;p<u.length;p++){v[p]=[];const T=u[p];let x=T[0];for(let y=1;y<T.length;y++){const C=T[y],h=Object(r.distance)(x,C);if(d<h){const g=d/h,f=Math.atan2(C[1]-x[1],C[0]-x[0]),m={x:x[0]*(1-g)+C[0]*g,y:x[1]*(1-g)+C[1]*g,angle:f};if(v[p].push(x),d>0&&v[p].push([m.x,m.y]),!M)return{current:v,point:m};const S=[],A=p;for(;p<u.length;p++){for(S[p-A]=[],p===A&&S[0].push([m.x,m.y]);y<T.length;y++)S[p-A].push(T[y]);y=0}return{current:v,point:m,rest:S}}d-=h,v[p].push(x),x=C}}}function a(u,d){if(d=Number(d),!Number.isFinite(d))throw new TypeError("Failed to execute 'getPointAtLength' on figure: The provided float value is non-finite.");if(u.length<=0)return{x:0,y:0,angle:0};if(d<=0){const M=u[0][0],c=u[0][1],v=Math.atan2(c[1]-M[1],c[0]-M[0]);return{x:M[0],y:M[1],angle:v}}return i(u,d,!1).point}function s(u,d,M){let c=0,v=d[0],p=u;const T=[],x=d.length;if(M>0){do M-=d[c%x],c++;while(M>0);M<0&&(v=-M,c--)}else if(M<0){c=-1;do M+=d[c%x+x-1],c--;while(M<0);M>=0&&(c++,v=d[c%x+x-1]-M)}do{const y=i(p,v);p=y.rest,++c%2&&T.push(...y.current);let C=c%x;C<0&&(C+=x),v=d[C]}while(p);return T}}),(function(o,t,e){e.r(t),e.d(t,"normalize",function(){return r}),e.d(t,"distance",function(){return n}),e(1).glMatrix.setMatrixArrayType(Array);function r([i,a,s],u,d,M){return i=i*2/u-1,a=1-a*2/d,Number.isFinite(M)?(s=s*2/M-1,[i,a,s]):[i,a]}function n([i,a,s=0],[u,d,M=0]){return Math.hypot(u-i,d-a,M-s)}}),(function(o,t,e){e.r(t),e.d(t,"getPoint",function(){return n}),e(1).glMatrix.setMatrixArrayType(Array);const r=Math.PI*2;function n(i,a,s,u,d){d%=r,d<0&&(d+=r);const M=Math.tan(d);if(Math.abs(M)<1e5){const c=a-M*i,v=1/s**2+M**2/u**2;let p=-1;(d<=Math.PI/2||d>3*Math.PI/2)&&(p=1);const T=p*Math.sqrt(1/v)+i,x=M*T+c;return[T,x]}return d<Math.PI?[i,a+u]:[i,a-u]}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return q});var r=e(1),n=e(42),i=e.n(n),a=e(57),s=e(28),u=e(24),d=e(30),M=e(59),c=e(53),v=e(60),p=e.n(v),T=e(46),x=e.n(T),y=e(31),C=e(40),h=e(21);e(1).glMatrix.setMatrixArrayType(Array);function g(_,U){if(_==null)return{};var H=f(_,U),E,w;if(Object.getOwnPropertySymbols){var B=Object.getOwnPropertySymbols(_);for(w=0;w<B.length;w++)E=B[w],!(U.indexOf(E)>=0)&&Object.prototype.propertyIsEnumerable.call(_,E)&&(H[E]=_[E])}return H}function f(_,U){if(_==null)return{};var H={},E=Object.keys(_),w,B;for(B=0;B<E.length;B++)w=E[B],!(U.indexOf(w)>=0)&&(H[w]=_[w]);return H}const m=Symbol("mesh"),S=Symbol("contours"),A=Symbol("stroke"),P=Symbol("fill"),R=Symbol("strokeColor"),D=Symbol("fillColor"),L=Symbol("transform"),j=Symbol("invertTransform"),b=Symbol("uniforms"),O=Symbol("texOptions"),Y=Symbol("blend"),X=Symbol("applyTexture"),Z=Symbol("applyTransform"),$=Symbol("applyGradientTransform"),rt=Symbol("applyProgram"),F=Symbol("gradient"),Q=Symbol("filter"),tt=Symbol("opacity"),lt=Symbol("program"),ct=Symbol("attributes"),Mt=Symbol("pass"),st=Symbol("clipContext"),Tt=Symbol("applyClipPath");function xt(_,U){const[H,E]=[_[1][0]-_[0][0],_[1][1]-_[0][1]],w=[];for(let B=0;B<U.length;B++){const G=U[B],K=[(G[0]-_[0][0])/H,1-(G[1]-_[0][1])/E];w.push(K)}return w}function W([_,U],[H,E,w,B],{scale:G}){return G||(_/=w,U=1-U/B,_-=H,U+=E),[_,U,0]}function k(_,U,H){const E=x()(_,U,H);return E.path=_,E.simplify=H,E.scale=U,E}class q{constructor(U){this[A]=null,this[P]=null,this[L]=[1,0,0,1,0,0],this[tt]=1,this[b]={},this[Q]=[],this[Y]=null,this[O]={},this.contours=U.contours,this[lt]=null,this[ct]={},this[Mt]=[]}get contours(){return this[S]}set contours(U){this[m]=null,this[S]=U;const H=U.scale;this.transformScale/H>1.5&&this.accurate(this.transformScale)}setProgram(U){this[lt]=U,this[m]&&this[rt](U)}get program(){return this[lt]}setAttribute(U,H){H==null?delete this[ct][U]:this[ct][U]=H}getOpacity(){return this[tt]}setOpacity(U){if(U<0||U>1)throw new TypeError("Invalid opacity value.");this[m]&&this[m].positions.forEach(H=>{H[2]=1/H[2]>0?U:-U}),this[tt]=U}setClipPath(U){this.clipPath=U,this[b].u_clipSampler&&this[b].u_clipSampler.delete(),this.setUniforms({u_clipSampler:null}),this[m]&&delete this[m].attributes.a_clipUV,U&&this[m]&&this[Tt]()}[Tt](){if(this.clipPath){this[st]||(this[st]=h.default.createCanvas(1,1));const[[U,H],[E,w]]=this.boundingBox;E&&w&&(this[st].width=E-U,this[st].height=w-H);const B=this[st].getContext("2d"),G=new Path2D(this.clipPath);B.clearRect(0,0,this[st].width,this[st].height),B.save(),B.translate(-U,-H),B.fillStyle="white",B.fill(G),B.restore(),this[m].clipPath=this[st];const K=xt(this.boundingBox,this[m].position0);this[m].attributes.a_clipUV=K}}getPointAtLength(U){return Object(c.getPointAtLength)(this[S],U)}getTotalLength(){return Object(c.getTotalLength)(this[S])}get blend(){return this[Y]==null?"auto":this[Y]}set blend(U){this[Y]=U,this[m]&&(this[m].enableBlend=this.enableBlend)}get boundingBox(){if(this[m]&&this[m].boundingBox)return this[m].boundingBox;const U=this.meshData;if(U){const H=U.position0;if(H.length)U.boundingBox=i()(H);else return[[0,0],[0,0]];return U.boundingBox}return[[0,0],[0,0]]}get boundingCenter(){const U=this.boundingBox;return U?[.5*(U[0][0]+U[1][0]),.5*(U[0][1]+U[1][1])]:[0,0]}get fillRule(){return this[P]?this[P].rule:"nonzero"}get lineWidth(){return this[A]?this[A].lineWidth:0}get lineCap(){return this[A]?this[A].lineCap:""}get lineJoin(){return this[A]?this[A].lineJoin:""}get miterLimit(){return this[A]?this[A].miterLimit:0}get strokeStyle(){return this[R]&&this[R][3]!==0?Object(u.default)(this[R]):""}get lineDash(){return this[A]?this[A].lineDash:null}get lineDashOffset(){return this[A]?this[A].lineDashOffset:0}get fillStyle(){return this[D]&&this[D][3]!==0?Object(u.default)(this[D]):""}get gradient(){return this[F]}get texture(){return this[b].u_texSampler?{image:this[b].u_texSampler._img,options:this[O]}:null}get enableBlend(){return this[Y]===!0||this[Y]===!1?this[Y]:this[tt]<1||this[R]!=null&&this[R][3]<1||this[D]!=null&&this[D][3]<1||this[b].u_colorMatrix!=null&&this[b].u_colorMatrix[18]<1||this[b].u_radialGradientVector!=null||this.beforeRender||this.afterRender}get filterCanvas(){return/blur|drop-shadow|url/.test(this.filter)}get filter(){return this[Q].join(" ")}get transformMatrix(){return this[L]}get invertMatrix(){if(!this[j]){const U=r.mat2d.invert(Array.of(0,0,0,0,0,0),this[L]);this[j]=U}return this[j]}get transformScale(){const U=this[L];return Math.max(Math.hypot(U[0],U[1]),Math.hypot(U[2],U[3]))}get uniforms(){return this[b]}get pass(){return this[Mt]}[rt](U){const H=this[ct],E=this[m].position0,w=Object.entries(U._attribute);for(let B=0;B<w.length;B++){const[G,K]=w[B];if(G!=="a_color"&&G!=="a_sourceRect"&&K!=="ignored"){const et=H[G];if(G==="uv"&&!et){const at=this[m].boundingBox||i()(E);this[m].attributes[G]=xt(at,E)}else{this[m].attributes[G]=[];for(let at=0;at<E.length;at++){const ut=E[at];this[m].attributes[G].push(et?et(ut,B,E):Array(K.size).fill(0))}}}}}get meshData(){if(this._updateMatrix&&this.transformScale/this.contours.scale>1.5&&this.accurate(this.transformScale),!this[m]){!this[P]&&!this[A]&&this.setFill();const U=this[S],H={};if(U&&U.length){if(this[P])try{const B=p()(U,this[P]);B.positions=B.positions.map(G=>(G.push(this[tt]),G)),B.attributes={a_color:Array.from({length:B.positions.length}).map(()=>this[D].map(G=>Math.round(255*G)))},H.fill=B}catch{}if(this[A]){const B=this[A].lineDash;let G=U;if(B){const et=this[A].lineDashOffset;G=Object(c.getDashContours)(U,B,et)}const K=G.map((et,at)=>{const ut=et.length>1&&r.vec2.equals(et[0],et[et.length-1]),gt=this[A].build(et,ut);return p()([gt])});K.forEach(et=>{et.positions=et.positions.map(at=>(at.push(-this[tt]),at)),et.attributes={a_color:Array.from({length:et.positions.length}).map(()=>this[R].map(at=>Math.round(255*at)))}}),H.stroke=Object(s.default)(K)}}const E=Object(s.default)([H.fill,H.stroke]);E.fillPointCount=H.fill?H.fill.positions.length:0,E.enableBlend=this.enableBlend,E.position0=E.positions.map(([B,G,K])=>[B,G,K]),E.uniforms=this[b],this[m]=E,this[b].u_texSampler&&this[X](E,this[O]);const w=this[L];Object(M.isUnitTransform)(w)||(this[Z](E,w),this[b].u_radialGradientVector&&this[$]()),this.clipPath&&this[Tt](),this[lt]&&this[rt](this[lt])}return this._updateMatrix&&(this[m].matrix=this[L],this[Z](this[m],this[L]),this[b].u_radialGradientVector&&this[$]()),this[m]}[Z](U,H){const{positions:E,position0:w}=U;for(let B=0;B<E.length;B++){const[G,K]=w[B],et=E[B];et[0]=G*H[0]+K*H[2]+H[4],et[1]=G*H[1]+K*H[3]+H[5]}this._updateMatrix=!1}[$](){const U=this[L],H=[...this._radialGradientVector];if(H){const[E,w,,B,G]=H;H[0]=E*U[0]+w*U[2]+U[4],H[1]=E*U[1]+w*U[3]+U[5],H[3]=B*U[0]+G*U[2]+U[4],H[4]=B*U[1]+G*U[3]+U[5],this[b].u_radialGradientVector=H}}[X](U,H){function E(at,ut){return at==null&&ut==null?!0:at==null||ut==null?!1:at[0]===ut[0]&&at[1]===ut[1]&&at[2]===ut[2]&&at[3]===ut[3]}const w=this[b].u_texSampler;if(!w)return;const{width:B,height:G}=w._img,K=H.srcRect;let et=H.rect||[0,0];if(H.rotated&&(et=[-et[1],et[0],et[3],et[2]]),et[2]==null&&(et[2]=K?K[2]:B),et[3]==null&&(et[3]=K?K[3]:G),H.hidden)U.textureCoord=U.positions.map(()=>[-1,-1,-1]);else if(!U.textureCoord||!E(this[O].rect,H.rect)||this[O].hidden!==H.hidden||this[O].rotated!==H.rotated){let at=null;H.rotated&&(at=r.mat2d.rotate(Array.of(0,0,0,0,0,0),r.mat2d.fromValues(1,0,0,1,0,0),.5*Math.PI),at=r.mat2d.translate(Array.of(0,0,0,0,0,0),at,[0,-et[2]])),U.textureCoord=U.position0.map(([ut,gt,yt])=>{if(1/yt>0){if(H.rotated){const vt=ut*at[0]+gt*at[2]+at[4],mt=ut*at[1]+gt*at[3]+at[5];[ut,gt]=[vt,mt]}const Ct=W([ut,gt],[et[0]/et[2],et[1]/et[3],et[2],et[3]],H);return H.repeat&&(Ct[2]=1),Ct}return[-1,-1,-1]})}if(K){const at=[K[0]/B,K[1]/G,K[2]/B,K[3]/G];U.attributes.a_sourceRect=U.positions.map(()=>[...at])}else U.attributes.a_sourceRect=U.positions.map(()=>[0,0,0,0])}accurate(U){if(!this.contours)return;if(this.contours.path){const E=this.contours.simplify,w=k(this.contours.path,2*U,E);this[m]=null,this[S]=w}}canIgnore(){const U=this[A]==null||this[A].lineWidth===0||this[R][3]===0,H=this[P]==null||this[D][3]===0,E=this[b].u_radialGradientVector==null,w=this[b].u_texSampler==null;return this[tt]===0||this[lt]==null&&U&&H&&E&&w&&!this.beforeRender&&!this.afterRender}setStroke({thickness:U=1,cap:H="butt",join:E="miter",miterLimit:w=10,color:B=[0,0,0,0],lineDash:G=null,lineDashOffset:K=0,roundSegments:et=20}={}){return this[m]=null,this[A]=new a.default({lineWidth:U,lineCap:H,lineJoin:E,miterLimit:w,roundSegments:et}),typeof B=="string"&&(B=Object(y.default)(B)),this[R]=B,this[A].lineDash=G,this[A].lineDashOffset=K,this}setFill({rule:U=this.fillRule,color:H=[0,0,0,0]}={}){return this[m]=null,this[P]={rule:U},typeof H=="string"&&(H=Object(y.default)(H)),this[D]=H,this}setTexture(U,H={}){if(U&&U.image){const{image:E,rect:w}=U;if(U=E,H.rect)for(let B=0;B<H.rect.length;B++)w[B]=H.rect[B];H.rect=w}return this[P]||this.setFill(),this.setUniforms({u_texSampler:U}),this[m]&&this[X](this[m],H),this[O]=H,this}setCircularGradient({vector:U,colors:H,type:E="fill"}={}){if(U.length!==3)throw new TypeError("Invalid linearGradient.");this.setGradient({vector:U,colors:H,type:E})}setLinearGradient({vector:U,colors:H,type:E="fill"}={}){if(U.length!==4)throw new TypeError("Invalid linearGradient.");this.setGradient({vector:U,colors:H,type:E})}setRadialGradient({vector:U,colors:H,type:E="fill"}={}){if(U.length!==6)throw new TypeError("Invalid radialGradient.");this.setGradient({vector:U,colors:H,type:E})}setGradient({vector:U,colors:H,type:E="fill"}={}){H=H.map(({offset:G,color:K})=>(typeof K=="string"&&(K=Object(y.default)(K)),{offset:G,color:K})),this[F]=this[F]||{},this[F][E]={vector:U,colors:H},H.sort((G,K)=>G.offset-K.offset);const w=[];H.forEach(({offset:G,color:K})=>{w.push(G,...K)});let B;if(U.length===4?B=[U[0],U[1],0,U[2],U[3],0]:B=[...U],w.length<40&&w.push(-1),w.length>40)throw new Error("Too many colors, should be less than 8 colors");return this._radialGradientVector=B,this[b].u_colorSteps=w,E==="fill"?this[b].u_gradientType=1:this[b].u_gradientType=0,this[$](),this}setUniforms(U={}){return Object.assign(this[b],U),this}setTransform(...U){const H=this[L];return r.mat2d.equals(U,H)||(this[L]=U,delete this[j],this._updateMatrix=!0),this}transform(...U){const H=this[L];return this[L]=r.mat2d.multiply(Array.of(0,0,0,0,0,0),H,U),delete this[j],this._updateMatrix=!0,this}translate(U,H){let E=r.mat2d.create();return E=r.mat2d.translate(Array.of(0,0,0,0,0,0),E,[U,H]),this.transform(...E)}rotate(U,[H,E]=[0,0]){let w=r.mat2d.create();return w=r.mat2d.translate(Array.of(0,0,0,0,0,0),w,[H,E]),w=r.mat2d.rotate(Array.of(0,0,0,0,0,0),w,U),w=r.mat2d.translate(Array.of(0,0,0,0,0,0),w,[-H,-E]),this.transform(...w)}scale(U,H=U,[E,w]=[0,0]){let B=r.mat2d.create();return B=r.mat2d.translate(Array.of(0,0,0,0,0,0),B,[E,w]),B=r.mat2d.scale(Array.of(0,0,0,0,0,0),B,[U,H]),B=r.mat2d.translate(Array.of(0,0,0,0,0,0),B,[-E,-w]),this.transform(...B)}skew(U,H=U,[E,w]=[0,0]){let B=r.mat2d.create();return B=r.mat2d.translate(Array.of(0,0,0,0,0,0),B,[E,w]),B=r.mat2d.multiply(Array.of(0,0,0,0,0,0),B,r.mat2d.fromValues(1,Math.tan(H),Math.tan(U),1,0,0)),B=r.mat2d.translate(Array.of(0,0,0,0,0,0),B,[-E,-w]),this.transform(...B)}clearFilter(){return this.setColorTransform(null),this[Q].length=0,this}setColorTransform(...U){return U[0]===null?this.setUniforms({u_filterFlag:0,u_colorMatrix:0}):this.setUniforms({u_filterFlag:1,u_colorMatrix:U}),this}transformColor(...U){let H=this.uniforms.u_colorMatrix;return H?H=Object(d.multiply)(H,U):H=U,this.setColorTransform(...H),this}blur(U){return this[Q].push(`blur(${U}px)`),this}brightness(U=1){return this[Q].push(`brightness(${100*U}%)`),this.transformColor(...Object(d.brightness)(U))}contrast(U=1){return this[Q].push(`contrast(${100*U}%)`),this.transformColor(...Object(d.contrast)(U))}dropShadow(U,H,E=0,w=[0,0,0,1]){return Array.isArray(w)&&(w=Object(u.default)(w)),this[Q].push(`drop-shadow(${U}px ${H}px ${E}px ${w})`),this}grayscale(U=1){return this[Q].push(`grayscale(${100*U}%)`),this.transformColor(...Object(d.grayscale)(U))}hueRotate(U=0){return this[Q].push(`hue-rotate(${U}deg)`),this.transformColor(...Object(d.hueRotate)(U))}invert(U=1){return this[Q].push(`invert(${100*U}%)`),this.transformColor(...Object(d.invert)(U))}opacity(U=1){return this[Q].push(`opacity(${100*U}%)`),this.transformColor(...Object(d.opacity)(U))}saturate(U=1){return this[Q].push(`saturate(${100*U}%)`),this.transformColor(...Object(d.saturate)(U))}sepia(U=1){return this[Q].push(`sepia(${100*U}%)`),this.transformColor(...Object(d.sepia)(U))}url(U){return this[Q].push(`url(${U})`),this}isPointCollision(U,H,E="both"){const w=this.meshData,{positions:B,cells:G}=w,K=this.invertMatrix,et=K[0]*U+K[2]*H+K[4],at=K[1]*U+K[3]*H+K[5],ut=this.boundingBox;if(et<ut[0][0]||et>ut[1][0]||at<ut[0][1]||at>ut[1][1])return!1;function gt([yt,Ct],[vt,mt],[It,wt]){const bt=It-vt,Nt=wt-mt,Yt=((yt-vt)*bt+(Ct-mt)*Nt)/(bt**2+Nt**2);return Yt>=0&&Yt<=1}for(let yt=0;yt<G.length;yt++){const Ct=G[yt];if(E==="fill"&&Ct[0]>=w.fillPointCount)break;if(E==="stroke"&&Ct[0]<w.fillPointCount)continue;const[[vt,mt],[It,wt],[bt,Nt]]=Ct.map(kt=>B[kt]),Yt=Math.sign((U-vt)*(wt-mt)-(It-vt)*(H-mt));if(Yt===0&>([U,H],[vt,mt],[It,wt]))return!0;const $t=Math.sign((U-It)*(Nt-wt)-(bt-It)*(H-wt));if($t===0&>([U,H],[It,wt],[bt,Nt]))return!0;const Gt=Math.sign((U-bt)*(mt-Nt)-(vt-bt)*(H-Nt));if(Gt===0&>([U,H],[bt,Nt],[vt,mt])||Yt===1&&$t===1&&Gt===1||Yt===-1&&$t===-1&&Gt===-1)return!0}return!1}isPointInFill(U,H){return this.isPointCollision(U,H,"fill")}isPointInStroke(U,H){return this.isPointCollision(U,H,"stroke")}addPass(U,H={}){let{width:E,height:w}=H,B=g(H,["width","height"]);const G=new C.default;G.rect(0,0,E,w);const K=new q(G,{width:E,height:w});K.setUniforms(B),K.setProgram(U),this[Mt].push(K)}}}),(function(o,t,e){e.r(t);var r=e(58);e(1).glMatrix.setMatrixArrayType(Array),t.default=r.Stroke}),(function(o,t,e){e.r(t),e.d(t,"Stroke",function(){return M});var r=e(49);e(1).glMatrix.setMatrixArrayType(Array);const n=Object(r.create)(),i=Object(r.create)(),a=Object(r.create)(),s=Object(r.create)(),u=Object(r.create)(),d=1e20;class M{constructor({lineWidth:x=1,lineJoin:y="miter",miterLimit:C=10,lineCap:h="butt",roundSegments:g=20}={}){this.lineWidth=x,this.lineJoin=y,this.miterLimit=C,this.lineCap=h,this.roundSegments=g,this._normal=null}build(x,y=!1){let C=x.length;if(x=[...x],C<2)return x;y&&((x[0][0]!==x[C-1][0]||x[0][1]!==x[C-1][1])&&x.push([...x[0]]),x.push([...x[1]])),C=x.length,this._normal=null;const h={left:[],right:[]},g=this.lineWidth/2,f=this.lineCap;if(!y&&f==="square"){Object(r.direction)(i,x[0],x[1]),Object(r.scaleAndAdd)(x[0],x[0],i,g);const S=x.length-1;Object(r.direction)(i,x[S],x[S-1]),Object(r.scaleAndAdd)(x[S],x[S],i,g)}for(let S=1;S<C;S++){const A=x[S-1],P=x[S],R=x[S+1];this._seg(h,A,P,R,g,y)}return!y&&f==="round"&&p(h,this.roundSegments),[...h.left,...h.right.reverse()]}_seg(x,y,C,h,g,f){const m=this.lineJoin==="bevel",S=this.lineJoin==="round";if(Object(r.direction)(i,C,y),this._normal||(this._normal=Object(r.create)(),Object(r.normal)(this._normal,i)),x.left.length||v(x,y,this._normal,g),!h)Object(r.normal)(this._normal,i),f?v(x,y,this._normal,g):v(x,C,this._normal,g);else{Object(r.direction)(a,h,C);let A=Object(r.computeMiter)(s,u,i,a,g);A=Math.min(A,d);const P=Object(r.dot)(s,this._normal)<0?-1:1;let R=m||S;if(!R&&this.lineJoin==="miter"&&A/g>this.miterLimit&&(R=!0),R){Object(r.scaleAndAdd)(n,C,this._normal,-g*P),c(x,n,P);let D=1/0;y&&(D=Math.min(D,Math.hypot(C[0]-y[0],C[1]-y[1]))),h&&(D=Math.min(D,Math.hypot(h[0]-C[0],h[1]-C[1])));const L=Math.max(g,Math.min(A,D));if(Object(r.scaleAndAdd)(n,C,u,L*P),c(x,n,-P),h)if(Object(r.normal)(n,a),Object(r.copy)(this._normal,n),Object(r.scaleAndAdd)(n,C,n,-g*P),S){const j=Object(r.clone)(n),b=P>0?x.left[x.left.length-1]:x.right[x.right.length-1],O=Object(r.clone)(C),Y=Object(r.sub)(Object(r.create)(),b,O),X=Object(r.sub)(Object(r.create)(),j,O),Z=Math.PI/this.roundSegments;for(let $=0;$<this.roundSegments&&(Object(r.rotate)(Y,Y,[0,0],P*Z),Math.sign(Object(r.cross)(n,Y,X)[2])===P);$++)Object(r.add)(n,Y,O),c(x,n,P);c(x,j,P)}else c(x,n,P)}else v(x,C,u,A),Object(r.copy)(this._normal,u)}}}function c(T,x,y){y>0?T.left.push(Object(r.clone)(x)):T.right.push(Object(r.clone)(x))}function v(T,x,y,C,h=-1){Object(r.scaleAndAdd)(n,x,y,-C),c(T,n,-h),Object(r.scaleAndAdd)(n,x,y,C),c(T,n,h)}function p({left:T,right:x},y){const C=Object(r.create)(),h=Object(r.create)();let g=T[0],f=x[0],m=[.5*(g[0]+f[0]),.5*(g[1]+f[1])];Object(r.sub)(h,g,m);for(let S=1;S<=y;S++){const A=-1*Math.PI*S/y;Object(r.rotate)(C,h,[0,0],A),Object(r.add)(n,m,C),T.unshift(Object(r.clone)(n))}g=x[x.length-1],f=T[T.length-1],m=[.5*(g[0]+f[0]),.5*(g[1]+f[1])],Object(r.sub)(h,g,m);for(let S=1;S<=y;S++){const A=-1*Math.PI*S/y;Object(r.rotate)(C,h,[0,0],A),Object(r.add)(n,m,C),x.push(Object(r.clone)(n))}}}),(function(o,t,e){e.r(t),e.d(t,"isUnitTransform",function(){return r}),e(1).glMatrix.setMatrixArrayType(Array);function r(n){return n[0]===1&&n[1]===0&&n[2]===0&&n[3]===1&&n[4]===0&&n[5]===0}}),(function(o,t,e){e(1).glMatrix.setMatrixArrayType(Array);var r=e(61),n=e(62);o.exports=function(i,a){if(a=a||{},i=i.filter(function(y){return y.length>2}),i.length===0)return{positions:[],cells:[]};typeof a.vertexSize!="number"&&(a.vertexSize=i[0][0].length),i=i.map(function(y){return y.reduce(function(C,h){return C.concat(h)})});const s=a.rule==="evenodd"?r.WINDING_ODD:r.WINDING_NONZERO;for(var u=r.tesselate(n({contours:i,windingRule:s,elementType:r.POLYGONS,polySize:3,vertexSize:2},a)),d=[],M=0;M<u.vertices.length;M+=a.vertexSize){var c=u.vertices.slice(M,M+a.vertexSize);d.push(c)}var v=[];for(M=0;M<u.elements.length;M+=3){var p=u.elements[M],T=u.elements[M+1],x=u.elements[M+2];v.push([p,T,x])}return{positions:d,cells:v}}}),(function(o,t,e){e(1).glMatrix.setMatrixArrayType(Array);var r={},n={};o.exports=r,r.WINDING_ODD=0,r.WINDING_NONZERO=1,r.WINDING_POSITIVE=2,r.WINDING_NEGATIVE=3,r.WINDING_ABS_GEQ_TWO=4,r.POLYGONS=0,r.CONNECTED_POLYGONS=1,r.BOUNDARY_CONTOURS=2,r.tesselate=function(h){for(var g=h.debug||!1,f=new C,m=0;m<h.contours.length;m++)f.addContour(h.vertexSize||2,h.contours[m]);return f.tesselate(h.windingRule||r.WINDING_ODD,h.elementType||r.POLYGONS,h.polySize||3,h.vertexSize||2,h.normal||[0,0,1]),{vertices:f.vertices,vertexIndices:f.vertexIndices,vertexCount:f.vertexCount,elements:f.elements,elementCount:f.elementCount,mesh:g?f.mesh:void 0}};var i=function(h){if(!h)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 s(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1}function u(h){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=h}u.prototype={get Rface(){return this.Sym.Lface},set Rface(h){this.Sym.Lface=h},get Dst(){return this.Sym.Org},set Dst(h){this.Sym.Org=h},get Oprev(){return this.Sym.Lnext},set Oprev(h){this.Sym.Lnext=h},get Lprev(){return this.Onext.Sym},set Lprev(h){this.Onext.Sym=h},get Dprev(){return this.Lnext.Sym},set Dprev(h){this.Lnext.Sym=h},get Rprev(){return this.Sym.Onext},set Rprev(h){this.Sym.Onext=h},get Dnext(){return this.Sym.Onext.Sym},set Dnext(h){this.Sym.Onext.Sym=h},get Rnext(){return this.Sym.Lnext.Sym},set Rnext(h){this.Sym.Lnext.Sym=h}};function d(){var h=new a,g=new s,f=new u(0),m=new u(1);h.next=h.prev=h,h.anEdge=null,g.next=g.prev=g,g.anEdge=null,g.trail=null,g.marked=!1,g.inside=!1,f.next=f,f.Sym=m,f.Onext=null,f.Lnext=null,f.Org=null,f.Lface=null,f.winding=0,f.activeRegion=null,m.next=m,m.Sym=f,m.Onext=null,m.Lnext=null,m.Org=null,m.Lface=null,m.winding=0,m.activeRegion=null,this.vHead=h,this.fHead=g,this.eHead=f,this.eHeadSym=m}d.prototype={makeEdge_:function(h){var g=new u(0),f=new u(1);h.Sym.side<h.side&&(h=h.Sym);var m=h.Sym.next;return f.next=m,m.Sym.next=g,g.next=h,h.Sym.next=f,g.Sym=f,g.Onext=g,g.Lnext=f,g.Org=null,g.Lface=null,g.winding=0,g.activeRegion=null,f.Sym=g,f.Onext=f,f.Lnext=g,f.Org=null,f.Lface=null,f.winding=0,f.activeRegion=null,g},splice_:function(h,g){var f=h.Onext,m=g.Onext;f.Sym.Lnext=g,m.Sym.Lnext=h,h.Onext=m,g.Onext=f},makeVertex_:function(h,g,f){var m=h;i(m!==null);var S=f.prev;m.prev=S,S.next=m,m.next=f,f.prev=m,m.anEdge=g;var A=g;do A.Org=m,A=A.Onext;while(A!==g)},makeFace_:function(h,g,f){var m=h;i(m!==null);var S=f.prev;m.prev=S,S.next=m,m.next=f,f.prev=m,m.anEdge=g,m.trail=null,m.marked=!1,m.inside=f.inside;var A=g;do A.Lface=m,A=A.Lnext;while(A!==g)},killEdge_:function(h){h.Sym.side<h.side&&(h=h.Sym);var g=h.next,f=h.Sym.next;g.Sym.next=f,f.Sym.next=g},killVertex_:function(h,g){var f=h.anEdge,m=f;do m.Org=g,m=m.Onext;while(m!==f);var S=h.prev,A=h.next;A.prev=S,S.next=A},killFace_:function(h,g){var f=h.anEdge,m=f;do m.Lface=g,m=m.Lnext;while(m!==f);var S=h.prev,A=h.next;A.prev=S,S.next=A},makeEdge:function(){var h=new a,g=new a,f=new s,m=this.makeEdge_(this.eHead);return this.makeVertex_(h,m,this.vHead),this.makeVertex_(g,m.Sym,this.vHead),this.makeFace_(f,m,this.fHead),m},splice:function(h,g){var f=!1,m=!1;if(h!==g){if(g.Org!==h.Org&&(m=!0,this.killVertex_(g.Org,h.Org)),g.Lface!==h.Lface&&(f=!0,this.killFace_(g.Lface,h.Lface)),this.splice_(g,h),!m){var S=new a;this.makeVertex_(S,g,h.Org),h.Org.anEdge=h}if(!f){var A=new s;this.makeFace_(A,g,h.Lface),h.Lface.anEdge=h}}},delete:function(h){var g=h.Sym,f=!1;if(h.Lface!==h.Rface&&(f=!0,this.killFace_(h.Lface,h.Rface)),h.Onext===h)this.killVertex_(h.Org,null);else if(h.Rface.anEdge=h.Oprev,h.Org.anEdge=h.Onext,this.splice_(h,h.Oprev),!f){var m=new s;this.makeFace_(m,h,h.Lface)}g.Onext===g?(this.killVertex_(g.Org,null),this.killFace_(g.Lface,null)):(h.Lface.anEdge=g.Oprev,g.Org.anEdge=g.Onext,this.splice_(g,g.Oprev)),this.killEdge_(h)},addEdgeVertex:function(h){var g=this.makeEdge_(h),f=g.Sym;this.splice_(g,h.Lnext),g.Org=h.Dst;var m=new a;return this.makeVertex_(m,f,g.Org),g.Lface=f.Lface=h.Lface,g},splitEdge:function(h,g){var f=this.addEdgeVertex(h),m=f.Sym;return this.splice_(h.Sym,h.Sym.Oprev),this.splice_(h.Sym,m),h.Dst=m.Org,m.Dst.anEdge=m.Sym,m.Rface=h.Rface,m.winding=h.winding,m.Sym.winding=h.Sym.winding,m},connect:function(h,g){var f=!1,m=this.makeEdge_(h),S=m.Sym;if(g.Lface!==h.Lface&&(f=!0,this.killFace_(g.Lface,h.Lface)),this.splice_(m,h.Lnext),this.splice_(S,g),m.Org=h.Dst,S.Org=g.Org,m.Lface=S.Lface=h.Lface,h.Lface.anEdge=S,!f){var A=new s;this.makeFace_(A,m,h.Lface)}return m},zapFace:function(h){var g=h.anEdge,f,m,S,A,P;m=g.Lnext;do f=m,m=f.Lnext,f.Lface=null,f.Rface===null&&(f.Onext===f?this.killVertex_(f.Org,null):(f.Org.anEdge=f.Onext,this.splice_(f,f.Oprev)),S=f.Sym,S.Onext===S?this.killVertex_(S.Org,null):(S.Org.anEdge=S.Onext,this.splice_(S,S.Oprev)),this.killEdge_(f));while(f!=g);A=h.prev,P=h.next,P.prev=A,A.next=P},countFaceVerts_:function(h){var g=h.anEdge,f=0;do f++,g=g.Lnext;while(g!==h.anEdge);return f},mergeConvexFaces:function(h){var g,f,m,S,A,P,R;for(g=this.fHead.next;g!==this.fHead;g=g.next)if(g.inside)for(f=g.anEdge,A=f.Org;m=f.Lnext,S=f.Sym,S&&S.Lface&&S.Lface.inside&&(P=this.countFaceVerts_(g),R=this.countFaceVerts_(S.Lface),P+R-2<=h&&n.vertCCW(f.Lprev.Org,f.Org,S.Lnext.Lnext.Org)&&n.vertCCW(S.Lprev.Org,S.Org,f.Lnext.Lnext.Org)&&(m=S.Lnext,this.delete(S),f=null,S=null)),!(f&&f.Lnext.Org===A);)f=m;return!0},check:function(){var h=this.fHead,g=this.vHead,f=this.eHead,m,S,A,P,R,D;for(S=h,S=h;(m=S.next)!==h;S=m){i(m.prev===S),R=m.anEdge;do i(R.Sym!==R),i(R.Sym.Sym===R),i(R.Lnext.Onext.Sym===R),i(R.Onext.Sym.Lnext===R),i(R.Lface===m),R=R.Lnext;while(R!==m.anEdge)}for(i(m.prev===S&&m.anEdge===null),P=g,P=g;(A=P.next)!==g;P=A){i(A.prev===P),R=A.anEdge;do i(R.Sym!==R),i(R.Sym.Sym===R),i(R.Lnext.Onext.Sym===R),i(R.Onext.Sym.Lnext===R),i(R.Org===A),R=R.Onext;while(R!==A.anEdge)}for(i(A.prev===P&&A.anEdge===null),D=f,D=f;(R=D.next)!==f;D=R)i(R.Sym.next===D.Sym),i(R.Sym!==R),i(R.Sym.Sym===R),i(R.Org!==null),i(R.Dst!==null),i(R.Lnext.Onext.Sym===R),i(R.Onext.Sym.Lnext===R);i(R.Sym.next===D.Sym&&R.Sym===this.eHeadSym&&R.Sym.Sym===R&&R.Org===null&&R.Dst===null&&R.Lface===null&&R.Rface===null)}},n.vertEq=function(h,g){return h.s===g.s&&h.t===g.t},n.vertLeq=function(h,g){return h.s<g.s||h.s===g.s&&h.t<=g.t},n.transLeq=function(h,g){return h.t<g.t||h.t===g.t&&h.s<=g.s},n.edgeGoesLeft=function(h){return n.vertLeq(h.Dst,h.Org)},n.edgeGoesRight=function(h){return n.vertLeq(h.Org,h.Dst)},n.vertL1dist=function(h,g){return Math.abs(h.s-g.s)+Math.abs(h.t-g.t)},n.edgeEval=function(h,g,f){i(n.vertLeq(h,g)&&n.vertLeq(g,f));var m=g.s-h.s,S=f.s-g.s;return m+S>0?m<S?g.t-h.t+(h.t-f.t)*(m/(m+S)):g.t-f.t+(f.t-h.t)*(S/(m+S)):0},n.edgeSign=function(h,g,f){i(n.vertLeq(h,g)&&n.vertLeq(g,f));var m=g.s-h.s,S=f.s-g.s;return m+S>0?(g.t-f.t)*m+(g.t-h.t)*S:0},n.transEval=function(h,g,f){i(n.transLeq(h,g)&&n.transLeq(g,f));var m=g.t-h.t,S=f.t-g.t;return m+S>0?m<S?g.s-h.s+(h.s-f.s)*(m/(m+S)):g.s-f.s+(f.s-h.s)*(S/(m+S)):0},n.transSign=function(h,g,f){i(n.transLeq(h,g)&&n.transLeq(g,f));var m=g.t-h.t,S=f.t-g.t;return m+S>0?(g.s-f.s)*m+(g.s-h.s)*S:0},n.vertCCW=function(h,g,f){return h.s*(g.t-f.t)+g.s*(f.t-h.t)+f.s*(h.t-g.t)>=0},n.interpolate=function(h,g,f,m){return h=h<0?0:h,f=f<0?0:f,h<=f?f===0?(g+m)/2:g+(m-g)*(h/(h+f)):m+(g-m)*(f/(h+f))},n.intersect=function(h,g,f,m,S){var A,P,R;n.vertLeq(h,g)||(R=h,h=g,g=R),n.vertLeq(f,m)||(R=f,f=m,m=R),n.vertLeq(h,f)||(R=h,h=f,f=R,R=g,g=m,m=R),n.vertLeq(f,g)?n.vertLeq(g,m)?(A=n.edgeEval(h,f,g),P=n.edgeEval(f,g,m),A+P<0&&(A=-A,P=-P),S.s=n.interpolate(A,f.s,P,g.s)):(A=n.edgeSign(h,f,g),P=-n.edgeSign(h,m,g),A+P<0&&(A=-A,P=-P),S.s=n.interpolate(A,f.s,P,m.s)):S.s=(f.s+g.s)/2,n.transLeq(h,g)||(R=h,h=g,g=R),n.transLeq(f,m)||(R=f,f=m,m=R),n.transLeq(h,f)||(R=h,h=f,f=R,R=g,g=m,m=R),n.transLeq(f,g)?n.transLeq(g,m)?(A=n.transEval(h,f,g),P=n.transEval(f,g,m),A+P<0&&(A=-A,P=-P),S.t=n.interpolate(A,f.t,P,g.t)):(A=n.transSign(h,f,g),P=-n.transSign(h,m,g),A+P<0&&(A=-A,P=-P),S.t=n.interpolate(A,f.t,P,m.t)):S.t=(f.t+g.t)/2};function M(){this.key=null,this.next=null,this.prev=null}function c(h,g){this.head=new M,this.head.next=this.head,this.head.prev=this.head,this.frame=h,this.leq=g}c.prototype={min:function(){return this.head.next},max:function(){return this.head.prev},insert:function(h){return this.insertBefore(this.head,h)},search:function(h){var g=this.head;do g=g.next;while(g.key!==null&&!this.leq(this.frame,h,g.key));return g},insertBefore:function(h,g){do h=h.prev;while(h.key!==null&&!this.leq(this.frame,h.key,g));var f=new M;return f.key=g,f.next=h.next,h.next.prev=f,f.prev=h,h.next=f,f},delete:function(h){h.next.prev=h.prev,h.prev.next=h.next}};function v(){this.handle=null}function p(){this.key=null,this.node=null}function T(h,g){this.size=0,this.max=h,this.nodes=[],this.nodes.length=h+1;var f;for(f=0;f<this.nodes.length;f++)this.nodes[f]=new v;for(this.handles=[],this.handles.length=h+1,f=0;f<this.handles.length;f++)this.handles[f]=new p;this.initialized=!1,this.freeList=0,this.leq=g,this.nodes[1].handle=1,this.handles[1].key=null}T.prototype={floatDown_:function(h){var g=this.nodes,f=this.handles,m,S,A;for(m=g[h].handle;;){if(A=h<<1,A<this.size&&this.leq(f[g[A+1].handle].key,f[g[A].handle].key)&&++A,i(A<=this.max),S=g[A].handle,A>this.size||this.leq(f[m].key,f[S].key)){g[h].handle=m,f[m].node=h;break}g[h].handle=S,f[S].node=h,h=A}},floatUp_:function(h){var g=this.nodes,f=this.handles,m,S,A;for(m=g[h].handle;;){if(A=h>>1,S=g[A].handle,A===0||this.leq(f[S].key,f[m].key)){g[h].handle=m,f[m].node=h;break}g[h].handle=S,f[S].node=h,h=A}},init:function(){for(var h=this.size;h>=1;--h)this.floatDown_(h);this.initialized=!0},min:function(){return this.handles[this.nodes[1].handle].key},insert:function(h){var g,f;if(g=++this.size,g*2>this.max){this.max*=2;var m,S;for(S=this.nodes.length,this.nodes.length=this.max+1,m=S;m<this.nodes.length;m++)this.nodes[m]=new v;for(S=this.handles.length,this.handles.length=this.max+1,m=S;m<this.handles.length;m++)this.handles[m]=new p}return this.freeList===0?f=g:(f=this.freeList,this.freeList=this.handles[f].node),this.nodes[g].handle=f,this.handles[f].node=g,this.handles[f].key=h,this.initialized&&this.floatUp_(g),f},extractMin:function(){var h=this.nodes,g=this.handles,f=h[1].handle,m=g[f].key;return this.size>0&&(h[1].handle=h[this.size].handle,g[h[1].handle].node=1,g[f].key=null,g[f].node=this.freeList,this.freeList=f,--this.size,this.size>0&&this.floatDown_(1)),m},delete:function(h){var g=this.nodes,f=this.handles,m;i(h>=1&&h<=this.max&&f[h].key!==null),m=f[h].node,g[m].handle=g[this.size].handle,f[g[m].handle].node=m,--this.size,m<=this.size&&(m<=1||this.leq(f[g[m>>1].handle].key,f[g[m].handle].key)?this.floatDown_(m):this.floatUp_(m)),f[h].key=null,f[h].node=this.freeList,this.freeList=h}};function x(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1}var y={};y.regionBelow=function(h){return h.nodeUp.prev.key},y.regionAbove=function(h){return h.nodeUp.next.key},y.debugEvent=function(h){},y.addWinding=function(h,g){h.winding+=g.winding,h.Sym.winding+=g.Sym.winding},y.edgeLeq=function(h,g,f){var m=h.event,P,R,S=g.eUp,A=f.eUp;if(S.Dst===m)return A.Dst===m?n.vertLeq(S.Org,A.Org)?n.edgeSign(A.Dst,S.Org,A.Org)<=0:n.edgeSign(S.Dst,A.Org,S.Org)>=0:n.edgeSign(A.Dst,m,A.Org)<=0;if(A.Dst===m)return n.edgeSign(S.Dst,m,S.Org)>=0;var P=n.edgeEval(S.Dst,m,S.Org),R=n.edgeEval(A.Dst,m,A.Org);return P>=R},y.deleteRegion=function(h,g){g.fixUpperEdge&&i(g.eUp.winding===0),g.eUp.activeRegion=null,h.dict.delete(g.nodeUp)},y.fixUpperEdge=function(h,g,f){i(g.fixUpperEdge),h.mesh.delete(g.eUp),g.fixUpperEdge=!1,g.eUp=f,f.activeRegion=g},y.topLeftRegion=function(h,g){var f=g.eUp.Org,m;do g=y.regionAbove(g);while(g.eUp.Org===f);if(g.fixUpperEdge){if(m=h.mesh.connect(y.regionBelow(g).eUp.Sym,g.eUp.Lnext),m===null)return null;y.fixUpperEdge(h,g,m),g=y.regionAbove(g)}return g},y.topRightRegion=function(h){var g=h.eUp.Dst;do h=y.regionAbove(h);while(h.eUp.Dst===g);return h},y.addRegionBelow=function(h,g,f){var m=new x;return m.eUp=f,m.nodeUp=h.dict.insertBefore(g.nodeUp,m),m.fixUpperEdge=!1,m.sentinel=!1,m.dirty=!1,f.activeRegion=m,m},y.isWindingInside=function(h,g){switch(h.windingRule){case r.WINDING_ODD:return(g&1)!==0;case r.WINDING_NONZERO:return g!==0;case r.WINDING_POSITIVE:return g>0;case r.WINDING_NEGATIVE:return g<0;case r.WINDING_ABS_GEQ_TWO:return g>=2||g<=-2}return i(!1),!1},y.computeWinding=function(h,g){g.windingNumber=y.regionAbove(g).windingNumber+g.eUp.winding,g.inside=y.isWindingInside(h,g.windingNumber)},y.finishRegion=function(h,g){var f=g.eUp,m=f.Lface;m.inside=g.inside,m.anEdge=f,y.deleteRegion(h,g)},y.finishLeftRegions=function(h,g,f){for(var m,P,S=null,A=g,P=g.eUp;A!==f;){if(A.fixUpperEdge=!1,S=y.regionBelow(A),m=S.eUp,m.Org!=P.Org){if(!S.fixUpperEdge){y.finishRegion(h,A);break}m=h.mesh.connect(P.Lprev,m.Sym),y.fixUpperEdge(h,S,m)}P.Onext!==m&&(h.mesh.splice(m.Oprev,m),h.mesh.splice(P,m)),y.finishRegion(h,A),P=S.eUp,A=S}return P},y.addRightEdges=function(h,g,f,m,S,A){var P,R,D,L,j=!0;D=f;do i(n.vertLeq(D.Org,D.Dst)),y.addRegionBelow(h,g,D.Sym),D=D.Onext;while(D!==m);for(S===null&&(S=y.regionBelow(g).eUp.Rprev),R=g,L=S;P=y.regionBelow(R),D=P.eUp.Sym,D.Org===L.Org;)D.Onext!==L&&(h.mesh.splice(D.Oprev,D),h.mesh.splice(L.Oprev,D)),P.windingNumber=R.windingNumber-D.winding,P.inside=y.isWindingInside(h,P.windingNumber),R.dirty=!0,!j&&y.checkForRightSplice(h,R)&&(y.addWinding(D,L),y.deleteRegion(h,R),h.mesh.delete(L)),j=!1,R=P,L=D;R.dirty=!0,i(R.windingNumber-D.winding===P.windingNumber),A&&y.walkDirtyRegions(h,R)},y.spliceMergeVertices=function(h,g,f){h.mesh.splice(g,f)},y.vertexWeights=function(h,g,f){var m=n.vertL1dist(g,h),S=n.vertL1dist(f,h),A=.5*S/(m+S),P=.5*m/(m+S);h.coords[0]+=A*g.coords[0]+P*f.coords[0],h.coords[1]+=A*g.coords[1]+P*f.coords[1],h.coords[2]+=A*g.coords[2]+P*f.coords[2]},y.getIntersectData=function(h,g,f,m,S,A){g.coords[0]=g.coords[1]=g.coords[2]=0,g.idx=-1,y.vertexWeights(g,f,m),y.vertexWeights(g,S,A)},y.checkForRightSplice=function(h,g){var f=y.regionBelow(g),m=g.eUp,S=f.eUp;if(n.vertLeq(m.Org,S.Org)){if(n.edgeSign(S.Dst,m.Org,S.Org)>0)return!1;n.vertEq(m.Org,S.Org)?m.Org!==S.Org&&(h.pq.delete(m.Org.pqHandle),y.spliceMergeVertices(h,S.Oprev,m)):(h.mesh.splitEdge(S.Sym),h.mesh.splice(m,S.Oprev),g.dirty=f.dirty=!0)}else{if(n.edgeSign(m.Dst,S.Org,m.Org)<0)return!1;y.regionAbove(g).dirty=g.dirty=!0,h.mesh.splitEdge(m.Sym),h.mesh.splice(S.Oprev,m)}return!0},y.checkForLeftSplice=function(h,g){var f=y.regionBelow(g),m=g.eUp,S=f.eUp,A;if(i(!n.vertEq(m.Dst,S.Dst)),n.vertLeq(m.Dst,S.Dst)){if(n.edgeSign(m.Dst,S.Dst,m.Org)<0)return!1;y.regionAbove(g).dirty=g.dirty=!0,A=h.mesh.splitEdge(m),h.mesh.splice(S.Sym,A),A.Lface.inside=g.inside}else{if(n.edgeSign(S.Dst,m.Dst,S.Org)>0)return!1;g.dirty=f.dirty=!0,A=h.mesh.splitEdge(S),h.mesh.splice(m.Lnext,S.Sym),A.Rface.inside=g.inside}return!0},y.checkForIntersect=function(h,g){var f=y.regionBelow(g),m=g.eUp,S=f.eUp,A=m.Org,P=S.Org,R=m.Dst,D=S.Dst,L,j,b=new a,O,Y;if(i(!n.vertEq(D,R)),i(n.edgeSign(R,h.event,A)<=0),i(n.edgeSign(D,h.event,P)>=0),i(A!==h.event&&P!==h.event),i(!g.fixUpperEdge&&!f.fixUpperEdge),A===P||(L=Math.min(A.t,R.t),j=Math.max(P.t,D.t),L>j))return!1;if(n.vertLeq(A,P)){if(n.edgeSign(D,A,P)>0)return!1}else if(n.edgeSign(R,P,A)<0)return!1;return y.debugEvent(h),n.intersect(R,A,D,P,b),i(Math.min(A.t,R.t)<=b.t),i(b.t<=Math.max(P.t,D.t)),i(Math.min(D.s,R.s)<=b.s),i(b.s<=Math.max(P.s,A.s)),n.vertLeq(b,h.event)&&(b.s=h.event.s,b.t=h.event.t),O=n.vertLeq(A,P)?A:P,n.vertLeq(O,b)&&(b.s=O.s,b.t=O.t),n.vertEq(b,A)||n.vertEq(b,P)?(y.checkForRightSplice(h,g),!1):!n.vertEq(R,h.event)&&n.edgeSign(R,h.event,b)>=0||!n.vertEq(D,h.event)&&n.edgeSign(D,h.event,b)<=0?D===h.event?(h.mesh.splitEdge(m.Sym),h.mesh.splice(S.Sym,m),g=y.topLeftRegion(h,g),m=y.regionBelow(g).eUp,y.finishLeftRegions(h,y.regionBelow(g),f),y.addRightEdges(h,g,m.Oprev,m,m,!0),!0):R===h.event?(h.mesh.splitEdge(S.Sym),h.mesh.splice(m.Lnext,S.Oprev),f=g,g=y.topRightRegion(g),Y=y.regionBelow(g).eUp.Rprev,f.eUp=S.Oprev,S=y.finishLeftRegions(h,f,null),y.addRightEdges(h,g,S.Onext,m.Rprev,Y,!0),!0):(n.edgeSign(R,h.event,b)>=0&&(y.regionAbove(g).dirty=g.dirty=!0,h.mesh.splitEdge(m.Sym),m.Org.s=h.event.s,m.Org.t=h.event.t),n.edgeSign(D,h.event,b)<=0&&(g.dirty=f.dirty=!0,h.mesh.splitEdge(S.Sym),S.Org.s=h.event.s,S.Org.t=h.event.t),!1):(h.mesh.splitEdge(m.Sym),h.mesh.splitEdge(S.Sym),h.mesh.splice(S.Oprev,m),m.Org.s=b.s,m.Org.t=b.t,m.Org.pqHandle=h.pq.insert(m.Org),y.getIntersectData(h,m.Org,A,R,P,D),y.regionAbove(g).dirty=g.dirty=f.dirty=!0,!1)},y.walkDirtyRegions=function(h,g){for(var f=y.regionBelow(g),m,S;;){for(;f.dirty;)g=f,f=y.regionBelow(f);if(!g.dirty&&(f=g,g=y.regionAbove(g),g===null||!g.dirty))return;if(g.dirty=!1,m=g.eUp,S=f.eUp,m.Dst!==S.Dst&&y.checkForLeftSplice(h,g)&&(f.fixUpperEdge?(y.deleteRegion(h,f),h.mesh.delete(S),f=y.regionBelow(g),S=f.eUp):g.fixUpperEdge&&(y.deleteRegion(h,g),h.mesh.delete(m),g=y.regionAbove(f),m=g.eUp)),m.Org!==S.Org)if(m.Dst!==S.Dst&&!g.fixUpperEdge&&!f.fixUpperEdge&&(m.Dst===h.event||S.Dst===h.event)){if(y.checkForIntersect(h,g))return}else y.checkForRightSplice(h,g);m.Org===S.Org&&m.Dst===S.Dst&&(y.addWinding(S,m),y.deleteRegion(h,g),h.mesh.delete(m),g=y.regionAbove(f))}},y.connectRightVertex=function(h,g,f){var m,S=f.Onext,A=y.regionBelow(g),P=g.eUp,R=A.eUp,D=!1;if(P.Dst!==R.Dst&&y.checkForIntersect(h,g),n.vertEq(P.Org,h.event)&&(h.mesh.splice(S.Oprev,P),g=y.topLeftRegion(h,g),S=y.regionBelow(g).eUp,y.finishLeftRegions(h,y.regionBelow(g),A),D=!0),n.vertEq(R.Org,h.event)&&(h.mesh.splice(f,R.Oprev),f=y.finishLeftRegions(h,A,null),D=!0),D){y.addRightEdges(h,g,f.Onext,S,S,!0);return}n.vertLeq(R.Org,P.Org)?m=R.Oprev:m=P,m=h.mesh.connect(f.Lprev,m),y.addRightEdges(h,g,m,m.Onext,m.Onext,!1),m.Sym.activeRegion.fixUpperEdge=!0,y.walkDirtyRegions(h,g)},y.connectLeftDegenerate=function(h,g,f){var m,S,A,P,R;if(m=g.eUp,n.vertEq(m.Org,f)){i(!1),y.spliceMergeVertices(h,m,f.anEdge);return}if(!n.vertEq(m.Dst,f)){h.mesh.splitEdge(m.Sym),g.fixUpperEdge&&(h.mesh.delete(m.Onext),g.fixUpperEdge=!1),h.mesh.splice(f.anEdge,m),y.sweepEvent(h,f);return}i(!1),g=y.topRightRegion(g),R=y.regionBelow(g),A=R.eUp.Sym,S=P=A.Onext,R.fixUpperEdge&&(i(S!==A),y.deleteRegion(h,R),h.mesh.delete(A),A=S.Oprev),h.mesh.splice(f.anEdge,A),n.edgeGoesLeft(S)||(S=null),y.addRightEdges(h,g,A.Onext,P,S,!0)},y.connectLeftVertex=function(h,g){var f,m,S,A,P,R,D=new x;if(D.eUp=g.anEdge.Sym,f=h.dict.search(D).key,m=y.regionBelow(f),!!m){if(A=f.eUp,P=m.eUp,n.edgeSign(A.Dst,g,A.Org)===0){y.connectLeftDegenerate(h,f,g);return}if(S=n.vertLeq(P.Dst,A.Dst)?f:m,f.inside||S.fixUpperEdge){if(S===f)R=h.mesh.connect(g.anEdge.Sym,A.Lnext);else{var L=h.mesh.connect(P.Dnext,g.anEdge);R=L.Sym}S.fixUpperEdge?y.fixUpperEdge(h,S,R):y.computeWinding(h,y.addRegionBelow(h,f,R)),y.sweepEvent(h,g)}else y.addRightEdges(h,f,g.anEdge,g.anEdge,null,!0)}},y.sweepEvent=function(h,g){h.event=g,y.debugEvent(h);for(var f=g.anEdge;f.activeRegion===null;)if(f=f.Onext,f===g.anEdge){y.connectLeftVertex(h,g);return}var m=y.topLeftRegion(h,f.activeRegion);i(m!==null);var S=y.regionBelow(m),A=S.eUp,P=y.finishLeftRegions(h,S,null);P.Onext===A?y.connectRightVertex(h,m,P):y.addRightEdges(h,m,P.Onext,A,A,!0)},y.addSentinel=function(h,g,f,m){var S=new x,A=h.mesh.makeEdge();A.Org.s=f,A.Org.t=m,A.Dst.s=g,A.Dst.t=m,h.event=A.Dst,S.eUp=A,S.windingNumber=0,S.inside=!1,S.fixUpperEdge=!1,S.sentinel=!0,S.dirty=!1,S.nodeUp=h.dict.insert(S)},y.initEdgeDict=function(h){h.dict=new c(h,y.edgeLeq);var g=h.bmax[0]-h.bmin[0],f=h.bmax[1]-h.bmin[1],m=h.bmin[0]-g,S=h.bmax[0]+g,A=h.bmin[1]-f,P=h.bmax[1]+f;y.addSentinel(h,m,S,A),y.addSentinel(h,m,S,P)},y.doneEdgeDict=function(h){for(var g,f=0;(g=h.dict.min().key)!==null;)g.sentinel||(i(g.fixUpperEdge),i(++f===1)),i(g.windingNumber===0),y.deleteRegion(h,g)},y.removeDegenerateEdges=function(h){var g,f,m,S=h.mesh.eHead;for(g=S.next;g!==S;g=f)f=g.next,m=g.Lnext,n.vertEq(g.Org,g.Dst)&&g.Lnext.Lnext!==g&&(y.spliceMergeVertices(h,m,g),h.mesh.delete(g),g=m,m=g.Lnext),m.Lnext===g&&(m!==g&&((m===f||m===f.Sym)&&(f=f.next),h.mesh.delete(m)),(g===f||g===f.Sym)&&(f=f.next),h.mesh.delete(g))},y.initPriorityQ=function(h){var g,f,m,S=0;for(m=h.mesh.vHead,f=m.next;f!==m;f=f.next)S++;for(S+=8,g=h.pq=new T(S,n.vertLeq),m=h.mesh.vHead,f=m.next;f!==m;f=f.next)f.pqHandle=g.insert(f);return f!==m?!1:(g.init(),!0)},y.donePriorityQ=function(h){h.pq=null},y.removeDegenerateFaces=function(h,g){var f,m,S;for(f=g.fHead.next;f!==g.fHead;f=m)m=f.next,S=f.anEdge,i(S.Lnext!==S),S.Lnext.Lnext===S&&(y.addWinding(S.Onext,S),h.mesh.delete(S));return!0},y.computeInterior=function(h){var g,f;if(y.removeDegenerateEdges(h),!y.initPriorityQ(h))return!1;for(y.initEdgeDict(h);(g=h.pq.extractMin())!==null;){for(;f=h.pq.min(),!(f===null||!n.vertEq(f,g));)f=h.pq.extractMin(),y.spliceMergeVertices(h,g.anEdge,f.anEdge);y.sweepEvent(h,g)}return h.event=h.dict.min().key.eUp.Org,y.debugEvent(h),y.doneEdgeDict(h),y.donePriorityQ(h),y.removeDegenerateFaces(h,h.mesh)?(h.mesh.check(),!0):!1};function C(){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=r.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}C.prototype={dot_:function(h,g){return h[0]*g[0]+h[1]*g[1]+h[2]*g[2]},normalize_:function(h){var g=h[0]*h[0]+h[1]*h[1]+h[2]*h[2];i(g>0),g=Math.sqrt(g),h[0]/=g,h[1]/=g,h[2]/=g},longAxis_:function(h){var g=0;return Math.abs(h[1])>Math.abs(h[0])&&(g=1),Math.abs(h[2])>Math.abs(h[g])&&(g=2),g},computeNormal_:function(h){var g,f,m,S,A,P,R=[0,0,0],D=[0,0,0],L=[0,0,0],j=[0,0,0],b=[0,0,0],O=[null,null,null],Y=[null,null,null],X=this.mesh.vHead,Z;for(g=X.next,Z=0;Z<3;++Z)S=g.coords[Z],D[Z]=S,Y[Z]=g,R[Z]=S,O[Z]=g;for(g=X.next;g!==X;g=g.next)for(Z=0;Z<3;++Z)S=g.coords[Z],S<D[Z]&&(D[Z]=S,Y[Z]=g),S>R[Z]&&(R[Z]=S,O[Z]=g);if(Z=0,R[1]-D[1]>R[0]-D[0]&&(Z=1),R[2]-D[2]>R[Z]-D[Z]&&(Z=2),D[Z]>=R[Z]){h[0]=0,h[1]=0,h[2]=1;return}for(P=0,f=Y[Z],m=O[Z],L[0]=f.coords[0]-m.coords[0],L[1]=f.coords[1]-m.coords[1],L[2]=f.coords[2]-m.coords[2],g=X.next;g!==X;g=g.next)j[0]=g.coords[0]-m.coords[0],j[1]=g.coords[1]-m.coords[1],j[2]=g.coords[2]-m.coords[2],b[0]=L[1]*j[2]-L[2]*j[1],b[1]=L[2]*j[0]-L[0]*j[2],b[2]=L[0]*j[1]-L[1]*j[0],A=b[0]*b[0]+b[1]*b[1]+b[2]*b[2],A>P&&(P=A,h[0]=b[0],h[1]=b[1],h[2]=b[2]);P<=0&&(h[0]=h[1]=h[2]=0,h[this.longAxis_(L)]=1)},checkOrientation_:function(){var h,g,f=this.mesh.fHead,m,S=this.mesh.vHead,A;for(h=0,g=f.next;g!==f;g=g.next)if(A=g.anEdge,!(A.winding<=0))do h+=(A.Org.s-A.Dst.s)*(A.Org.t+A.Dst.t),A=A.Lnext;while(A!==g.anEdge);if(h<0){for(m=S.next;m!==S;m=m.next)m.t=-m.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},projectPolygon_:function(){var h,g=this.mesh.vHead,f=[0,0,0],m,S,A,P,R=!1;for(f[0]=this.normal[0],f[1]=this.normal[1],f[2]=this.normal[2],f[0]===0&&f[1]===0&&f[2]===0&&(this.computeNormal_(f),R=!0),m=this.sUnit,S=this.tUnit,A=this.longAxis_(f),m[A]=0,m[(A+1)%3]=1,m[(A+2)%3]=0,S[A]=0,S[(A+1)%3]=0,S[(A+2)%3]=f[A]>0?1:-1,h=g.next;h!==g;h=h.next)h.s=this.dot_(h.coords,m),h.t=this.dot_(h.coords,S);for(R&&this.checkOrientation_(),P=!0,h=g.next;h!==g;h=h.next)P?(this.bmin[0]=this.bmax[0]=h.s,this.bmin[1]=this.bmax[1]=h.t,P=!1):(h.s<this.bmin[0]&&(this.bmin[0]=h.s),h.s>this.bmax[0]&&(this.bmax[0]=h.s),h.t<this.bmin[1]&&(this.bmin[1]=h.t),h.t>this.bmax[1]&&(this.bmax[1]=h.t))},addWinding_:function(h,g){h.winding+=g.winding,h.Sym.winding+=g.Sym.winding},tessellateMonoRegion_:function(h,g){var f,m;for(f=g.anEdge,i(f.Lnext!==f&&f.Lnext.Lnext!==f);n.vertLeq(f.Dst,f.Org);f=f.Lprev);for(;n.vertLeq(f.Org,f.Dst);f=f.Lnext);for(m=f.Lprev;f.Lnext!==m;)if(n.vertLeq(f.Dst,m.Org)){for(;m.Lnext!==f&&(n.edgeGoesLeft(m.Lnext)||n.edgeSign(m.Org,m.Dst,m.Lnext.Dst)<=0);){var S=h.connect(m.Lnext,m);m=S.Sym}m=m.Lprev}else{for(;m.Lnext!==f&&(n.edgeGoesRight(f.Lprev)||n.edgeSign(f.Dst,f.Org,f.Lprev.Org)>=0);){var S=h.connect(f,f.Lprev);f=S.Sym}f=f.Lnext}for(i(m.Lnext!==f);m.Lnext.Lnext!==f;){var S=h.connect(m.Lnext,m);m=S.Sym}return!0},tessellateInterior_:function(h){var g,f;for(g=h.fHead.next;g!==h.fHead;g=f)if(f=g.next,g.inside&&!this.tessellateMonoRegion_(h,g))return!1;return!0},discardExterior_:function(h){var g,f;for(g=h.fHead.next;g!==h.fHead;g=f)f=g.next,g.inside||h.zapFace(g)},setWindingNumber_:function(h,g,f){var m,S;for(m=h.eHead.next;m!==h.eHead;m=S)S=m.next,m.Rface.inside!==m.Lface.inside?m.winding=m.Lface.inside?g:-g:f?h.delete(m):m.winding=0},getNeighbourFace_:function(h){return!h.Rface||!h.Rface.inside?-1:h.Rface.n},outputPolymesh_:function(h,g,f,m){var S,A,P,R=0,D=0,L,j;for(f>3&&h.mergeConvexFaces(f),S=h.vHead.next;S!==h.vHead;S=S.next)S.n=-1;for(A=h.fHead.next;A!==h.fHead;A=A.next)if(A.n=-1,!!A.inside){P=A.anEdge,L=0;do S=P.Org,S.n===-1&&(S.n=D,D++),L++,P=P.Lnext;while(P!==A.anEdge);i(L<=f),A.n=R,++R}for(this.elementCount=R,g===r.CONNECTED_POLYGONS&&(R*=2),this.elements=[],this.elements.length=R*f,this.vertexCount=D,this.vertices=[],this.vertices.length=D*m,this.vertexIndices=[],this.vertexIndices.length=D,S=h.vHead.next;S!==h.vHead;S=S.next)if(S.n!==-1){var b=S.n*m;this.vertices[b+0]=S.coords[0],this.vertices[b+1]=S.coords[1],m>2&&(this.vertices[b+2]=S.coords[2]),this.vertexIndices[S.n]=S.idx}var O=0;for(A=h.fHead.next;A!==h.fHead;A=A.next)if(A.inside){P=A.anEdge,L=0;do S=P.Org,this.elements[O++]=S.n,L++,P=P.Lnext;while(P!==A.anEdge);for(j=L;j<f;++j)this.elements[O++]=-1;if(g===r.CONNECTED_POLYGONS){P=A.anEdge;do this.elements[O++]=this.getNeighbourFace_(P),P=P.Lnext;while(P!==A.anEdge);for(j=L;j<f;++j)this.elements[O++]=-1}}},outputContours_:function(h,g){var f,m,S,A=0,P=0;for(this.vertexCount=0,this.elementCount=0,f=h.fHead.next;f!==h.fHead;f=f.next)if(f.inside){S=m=f.anEdge;do this.vertexCount++,m=m.Lnext;while(m!==S);this.elementCount++}this.elements=[],this.elements.length=this.elementCount*2,this.vertices=[],this.vertices.length=this.vertexCount*g,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var R=0,D=0,L=0;for(A=0,f=h.fHead.next;f!==h.fHead;f=f.next)if(f.inside){P=0,S=m=f.anEdge;do this.vertices[R++]=m.Org.coords[0],this.vertices[R++]=m.Org.coords[1],g>2&&(this.vertices[R++]=m.Org.coords[2]),this.vertexIndices[D++]=m.Org.idx,P++,m=m.Lnext;while(m!==S);this.elements[L++]=A,this.elements[L++]=P,A+=P}},addContour:function(h,g){var f,m;for(this.mesh===null&&(this.mesh=new d),h<2&&(h=2),h>3&&(h=3),f=null,m=0;m<g.length;m+=h)f===null?(f=this.mesh.makeEdge(),this.mesh.splice(f,f.Sym)):(this.mesh.splitEdge(f),f=f.Lnext),f.Org.coords[0]=g[m+0],f.Org.coords[1]=g[m+1],h>2?f.Org.coords[2]=g[m+2]:f.Org.coords[2]=0,f.Org.idx=this.vertexIndexCounter++,f.winding=1,f.Sym.winding=-1},tesselate:function(h,g,f,m,S){if(this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,S&&(this.normal[0]=S[0],this.normal[1]=S[1],this.normal[2]=S[2]),this.windingRule=h,m<2&&(m=2),m>3&&(m=3),!this.mesh)return!1;this.projectPolygon_(),y.computeInterior(this);var A=this.mesh;return g===r.BOUNDARY_CONTOURS?this.setWindingNumber_(A,1,!0):this.tessellateInterior_(A),A.check(),g===r.BOUNDARY_CONTOURS?this.outputContours_(A,m):this.outputPolymesh_(A,g,f,m),!0}}}),(function(o,t){o.exports=r;var e=Object.prototype.hasOwnProperty;function r(){for(var n={},i=0;i<arguments.length;i++){var a=arguments[i];for(var s in a)e.call(a,s)&&(n[s]=a[s])}return n}}),(function(o,t,e){e.r(t),e.d(t,"createShaders",function(){return u}),e.d(t,"applyShader",function(){return d}),e.d(t,"createCloudShaders",function(){return c}),e.d(t,"applyCloudShader",function(){return v});var r=e(64),n=e(65),i=e(66),a=e(67);e(1).glMatrix.setMatrixArrayType(Array);const s=Symbol("shaders");function u(p){p[s]=[];for(let T=0;T<16;T++){const x=[],y=!!(T&1),C=!!(T&2),h=!!(T&4),g=!!(T&8);y&&x.push("#define TEXTURE 1"),C&&x.push("#define FILTER 1"),h&&x.push("#define GRADIENT 1"),g&&x.push("#define CLIPPATH 1");const f=`${x.join(`
|
||
`)}
|
||
`,m=[];y&&m.push("uniform sampler2D u_texSampler;"),g&&m.push("uniform sampler2D u_clipSampler;"),p[s][T]=[f+m.join(`
|
||
`)+n.default,f+r.default]}}function d(p,{hasTexture:T=!1,hasFilter:x=!1,hasGradient:y=!1,hasClipPath:C=!1}={}){const h=T|x<<1|y<<2|C<<3;let g=p[s][h];Array.isArray(g)&&(g=p.createProgram(...g),p[s][h]=g),p.program!==g&&p.useProgram(g,{a_color:{type:"UNSIGNED_BYTE",normalize:!0}})}const M=[];function c(p){for(let T=0;T<64;T++){const x=[],y=!!(T&1),C=!!(T&2),h=!!(T&4),g=!!(T&8),f=!!(T&16),m=!!(T&32);y&&x.push("#define TEXTURE 1"),C&&x.push("#define FILTER 1"),h&&x.push("#define GRADIENT 1"),g&&x.push("#define CLOUDCOLOR 1"),f&&x.push("#define CLOUDFILTER 1"),m&&x.push("#define CLIPPATH 1");const S=`${x.join(`
|
||
`)}
|
||
`,A=[];if(y){A.push("uniform sampler2D u_texSampler;");for(let P=0;P<12;P++)A.push(`uniform sampler2D u_texFrame${P};`)}m&&A.push("uniform sampler2D u_clipSampler;"),M[T]=[S+A.join(`
|
||
`)+a.default,S+i.default]}}function v(p,{hasTexture:T=!1,hasFilter:x=!1,hasGradient:y=!1,hasCloudColor:C=!1,hasCloudFilter:h=!1,hasClipPath:g=!1}={}){const f=T|x<<1|y<<2|C<<3|h<<4|g<<5;let m=M[f];Array.isArray(m)&&(m=p.createProgram(...m),M[f]=m),p.program!==m&&p.useProgram(m,{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(o,t,e){e.r(t),t.default=`attribute vec3 a_vertexPosition;
|
||
attribute vec4 a_color;
|
||
varying vec4 vColor;
|
||
varying float flagBackground;
|
||
uniform vec2 u_resolution;
|
||
uniform mat3 viewMatrix;
|
||
uniform mat3 projectionMatrix;
|
||
|
||
#ifdef TEXTURE
|
||
attribute vec3 a_vertexTextureCoord;
|
||
varying vec3 vTextureCoord;
|
||
attribute vec4 a_sourceRect;
|
||
varying vec4 vSourceRect;
|
||
#endif
|
||
|
||
#ifdef CLIPPATH
|
||
attribute vec2 a_clipUV;
|
||
varying vec2 vClipUV;
|
||
#endif
|
||
|
||
#ifdef GRADIENT
|
||
uniform float u_radialGradientVector[6];
|
||
varying vec3 vGradientVector1;
|
||
varying vec3 vGradientVector2;
|
||
#endif
|
||
|
||
void main() {
|
||
gl_PointSize = 1.0;
|
||
|
||
vec3 pos = projectionMatrix * viewMatrix * vec3(a_vertexPosition.xy, 1.0);
|
||
gl_Position = vec4(pos.xy, 1.0, 1.0);
|
||
|
||
#ifdef GRADIENT
|
||
vec3 vg1 = viewMatrix * vec3(u_radialGradientVector[0], u_radialGradientVector[1], 1.0);
|
||
vec3 vg2 = viewMatrix * vec3(u_radialGradientVector[3], u_radialGradientVector[4], 1.0);
|
||
float h = u_resolution.y;
|
||
vg1.y = h - vg1.y;
|
||
vg2.y = h - vg2.y;
|
||
vGradientVector1 = vec3(vg1.xy, u_radialGradientVector[2]);
|
||
vGradientVector2 = vec3(vg2.xy, u_radialGradientVector[5]);
|
||
#endif
|
||
|
||
flagBackground = a_vertexPosition.z;
|
||
vColor = a_color;
|
||
|
||
#ifdef TEXTURE
|
||
vTextureCoord = a_vertexTextureCoord;
|
||
vSourceRect = a_sourceRect;
|
||
#endif
|
||
|
||
#ifdef CLIPPATH
|
||
vClipUV = a_clipUV;
|
||
#endif
|
||
}`}),(function(o,t,e){e.r(t),t.default=`precision mediump float;
|
||
|
||
varying vec4 vColor;
|
||
varying float flagBackground;
|
||
|
||
#ifdef TEXTURE
|
||
varying vec3 vTextureCoord;
|
||
varying vec4 vSourceRect;
|
||
#endif
|
||
|
||
#ifdef CLIPPATH
|
||
varying vec2 vClipUV;
|
||
#endif
|
||
|
||
#ifdef FILTER
|
||
uniform int u_filterFlag;
|
||
uniform float u_colorMatrix[20];
|
||
#endif
|
||
|
||
#ifdef GRADIENT
|
||
varying vec3 vGradientVector1;
|
||
varying vec3 vGradientVector2;
|
||
uniform float u_colorSteps[40];
|
||
uniform int u_gradientType;
|
||
// uniform float u_radialGradientVector[6];
|
||
|
||
void gradient(inout vec4 color, vec3 gv1, vec3 gv2, float colorSteps[40]) {
|
||
float t;
|
||
// center circle radius
|
||
float cr = gv1.z;
|
||
// focal circle radius
|
||
float fr = gv2.z;
|
||
|
||
if(cr > 0.0 || fr > 0.0) {
|
||
// radial gradient
|
||
vec2 center = gv1.xy;
|
||
vec2 focal = gv2.xy;
|
||
float x = focal.x - gl_FragCoord.x;
|
||
float y = focal.y - gl_FragCoord.y;
|
||
float dx = focal.x - center.x;
|
||
float dy = focal.y - center.y;
|
||
float dr = cr - fr;
|
||
float a = dx * dx + dy * dy - dr * dr;
|
||
float b = -2.0 * (y * dy + x * dx + fr * dr);
|
||
float c = x * x + y * y - fr * fr;
|
||
t = 1.0 - 0.5 * (1.0 / a) * (-b + sqrt(b * b - 4.0 * a * c));
|
||
} else {
|
||
// linear gradient
|
||
vec2 v1 = gl_FragCoord.xy - gv1.xy;
|
||
vec2 v2 = gv2.xy - gv1.xy;
|
||
t = (v1.x * v2.x + v1.y * v2.y) / (v2.x * v2.x + v2.y * v2.y);
|
||
}
|
||
|
||
vec4 colors[8];
|
||
colors[0] = vec4(colorSteps[1], colorSteps[2], colorSteps[3], colorSteps[4]);
|
||
colors[1] = vec4(colorSteps[6], colorSteps[7], colorSteps[8], colorSteps[9]);
|
||
colors[2] = vec4(colorSteps[11], colorSteps[12], colorSteps[13], colorSteps[14]);
|
||
colors[3] = vec4(colorSteps[16], colorSteps[17], colorSteps[18], colorSteps[19]);
|
||
colors[4] = vec4(colorSteps[21], colorSteps[22], colorSteps[23], colorSteps[24]);
|
||
colors[5] = vec4(colorSteps[26], colorSteps[27], colorSteps[28], colorSteps[29]);
|
||
colors[6] = vec4(colorSteps[31], colorSteps[32], colorSteps[33], colorSteps[34]);
|
||
colors[7] = vec4(colorSteps[36], colorSteps[37], colorSteps[38], colorSteps[39]);
|
||
|
||
float steps[8];
|
||
steps[0] = colorSteps[0];
|
||
steps[1] = colorSteps[5];
|
||
steps[2] = colorSteps[10];
|
||
steps[3] = colorSteps[15];
|
||
steps[4] = colorSteps[20];
|
||
steps[5] = colorSteps[25];
|
||
steps[6] = colorSteps[30];
|
||
steps[7] = colorSteps[35];
|
||
|
||
color = colors[0];
|
||
for (int i = 1; i < 8; i++) {
|
||
if (steps[i] < 0.0 || steps[i] > 1.0) {
|
||
break;
|
||
}
|
||
if(steps[i] == steps[i - 1]) {
|
||
color = colors[i];
|
||
} else {
|
||
color = mix(color, colors[i], clamp((t - steps[i - 1]) / (steps[i] - steps[i - 1]), 0.0, 1.0));
|
||
}
|
||
if (steps[i] >= t) {
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
#endif
|
||
|
||
#ifdef FILTER
|
||
void transformColor(inout vec4 color, in float colorMatrix[20]) {
|
||
float r = color.r, g = color.g, b = color.b, a = color.a;
|
||
color[0] = colorMatrix[0] * r + colorMatrix[1] * g + colorMatrix[2] * b + colorMatrix[3] * a + colorMatrix[4];
|
||
color[1] = colorMatrix[5] * r + colorMatrix[6] * g + colorMatrix[7] * b + colorMatrix[8] * a + colorMatrix[9];
|
||
color[2] = colorMatrix[10] * r + colorMatrix[11] * g + colorMatrix[12] * b + colorMatrix[13] * a + colorMatrix[14];
|
||
color[3] = colorMatrix[15] * r + colorMatrix[16] * g + colorMatrix[17] * b + colorMatrix[18] * a + colorMatrix[19];
|
||
}
|
||
#endif
|
||
|
||
void main() {
|
||
vec4 color = vColor;
|
||
float opacity = abs(flagBackground);
|
||
|
||
#ifdef GRADIENT
|
||
if(u_gradientType > 0 && flagBackground > 0.0 || u_gradientType == 0 && flagBackground <= 0.0) {
|
||
gradient(color, vGradientVector1, vGradientVector2, u_colorSteps);
|
||
}
|
||
#endif
|
||
|
||
if(opacity < 1.0) {
|
||
color.a *= opacity;
|
||
}
|
||
|
||
#ifdef TEXTURE
|
||
if(flagBackground > 0.0) {
|
||
vec3 texCoord = vTextureCoord;
|
||
|
||
if(texCoord.z == 1.0) {
|
||
texCoord = fract(texCoord);
|
||
}
|
||
|
||
if(texCoord.x <= 1.0 && texCoord.x >= 0.0
|
||
&& texCoord.y <= 1.0 && texCoord.y >= 0.0) {
|
||
if(vSourceRect.z > 0.0) {
|
||
texCoord.x = vSourceRect.x + texCoord.x * vSourceRect.z;
|
||
texCoord.y = 1.0 - (vSourceRect.y + (1.0 - texCoord.y) * vSourceRect.w);
|
||
}
|
||
vec4 texColor = texture2D(u_texSampler, texCoord.xy);
|
||
float alpha = texColor.a;
|
||
if(opacity < 1.0) {
|
||
texColor.a *= opacity;
|
||
alpha *= mix(0.465, 1.0, opacity);
|
||
}
|
||
// color = mix(color, texColor, texColor.a);
|
||
color.rgb = mix(color.rgb, texColor.rgb, alpha);
|
||
// color.rgb = mix(texColor.rgb, color.rgb, color.a);
|
||
color.rgb = mix(texColor.rgb, color.rgb, clamp(color.a / max(0.0001, texColor.a), 0.0, 1.0));
|
||
color.a = texColor.a + (1.0 - texColor.a) * color.a;
|
||
}
|
||
}
|
||
#endif
|
||
|
||
#ifdef FILTER
|
||
if(u_filterFlag > 0) {
|
||
transformColor(color, u_colorMatrix);
|
||
}
|
||
#endif
|
||
|
||
#ifdef CLIPPATH
|
||
float clip = texture2D(u_clipSampler, vClipUV).r;
|
||
color *= clip;
|
||
#endif
|
||
|
||
gl_FragColor = color;
|
||
}`}),(function(o,t,e){e.r(t),t.default=`attribute vec3 a_vertexPosition;
|
||
attribute vec4 a_color;
|
||
varying vec4 vColor;
|
||
varying float flagBackground;
|
||
attribute vec3 a_transform0;
|
||
attribute vec3 a_transform1;
|
||
uniform vec2 u_resolution;
|
||
uniform mat3 viewMatrix;
|
||
uniform mat3 projectionMatrix;
|
||
|
||
#ifdef TEXTURE
|
||
attribute vec3 a_vertexTextureCoord;
|
||
varying vec3 vTextureCoord;
|
||
attribute float a_frameIndex;
|
||
varying float frameIndex;
|
||
attribute vec4 a_sourceRect;
|
||
varying vec4 vSourceRect;
|
||
#endif
|
||
|
||
#ifdef CLIPPATH
|
||
attribute vec2 a_clipUV;
|
||
varying vec2 vClipUV;
|
||
#endif
|
||
|
||
#ifdef CLOUDFILTER
|
||
attribute vec4 a_colorCloud0;
|
||
attribute vec4 a_colorCloud1;
|
||
attribute vec4 a_colorCloud2;
|
||
attribute vec4 a_colorCloud3;
|
||
attribute vec4 a_colorCloud4;
|
||
varying vec4 colorCloud0;
|
||
varying vec4 colorCloud1;
|
||
varying vec4 colorCloud2;
|
||
varying vec4 colorCloud3;
|
||
varying vec4 colorCloud4;
|
||
#endif
|
||
|
||
#ifdef CLOUDCOLOR
|
||
attribute vec4 a_fillCloudColor;
|
||
attribute vec4 a_strokeCloudColor;
|
||
#endif
|
||
|
||
#ifdef GRADIENT
|
||
uniform float u_radialGradientVector[6];
|
||
varying vec3 vGradientVector1;
|
||
varying vec3 vGradientVector2;
|
||
#endif
|
||
|
||
void main() {
|
||
gl_PointSize = 1.0;
|
||
|
||
mat3 modelMatrix = mat3(
|
||
a_transform0.x, a_transform1.x, 0,
|
||
a_transform0.y, a_transform1.y, 0,
|
||
a_transform0.z, a_transform1.z, 1
|
||
);
|
||
|
||
vec3 pos = projectionMatrix * viewMatrix * modelMatrix * vec3(a_vertexPosition.xy, 1.0);
|
||
gl_Position = vec4(pos.xy, 1.0, 1.0);
|
||
|
||
#ifdef GRADIENT
|
||
vec3 vg1 = viewMatrix * vec3(u_radialGradientVector[0], u_radialGradientVector[1], 1.0);
|
||
vec3 vg2 = viewMatrix * vec3(u_radialGradientVector[3], u_radialGradientVector[4], 1.0);
|
||
float h = u_resolution.y;
|
||
vg1.y = h - vg1.y;
|
||
vg2.y = h - vg2.y;
|
||
vGradientVector1 = vec3(vg1.xy, u_radialGradientVector[2]);
|
||
vGradientVector2 = vec3(vg2.xy, u_radialGradientVector[5]);
|
||
#endif
|
||
|
||
flagBackground = a_vertexPosition.z;
|
||
|
||
#ifdef CLOUDCOLOR
|
||
if(flagBackground > 0.0) {
|
||
vColor = mix(a_color, a_fillCloudColor, a_fillCloudColor.a);
|
||
} else {
|
||
vColor = mix(a_color, a_strokeCloudColor, a_strokeCloudColor.a);
|
||
}
|
||
#else
|
||
vColor = a_color;
|
||
#endif
|
||
|
||
#ifdef TEXTURE
|
||
vTextureCoord = a_vertexTextureCoord;
|
||
frameIndex = a_frameIndex;
|
||
vSourceRect = a_sourceRect;
|
||
#endif
|
||
|
||
#ifdef CLIPPATH
|
||
vClipUV = a_clipUV;
|
||
#endif
|
||
|
||
#ifdef CLOUDFILTER
|
||
colorCloud0 = a_colorCloud0;
|
||
colorCloud1 = a_colorCloud1;
|
||
colorCloud2 = a_colorCloud2;
|
||
colorCloud3 = a_colorCloud3;
|
||
colorCloud4 = a_colorCloud4;
|
||
#endif
|
||
}`}),(function(o,t,e){e.r(t),t.default=`precision mediump float;
|
||
|
||
varying vec4 vColor;
|
||
varying float flagBackground;
|
||
|
||
#ifdef TEXTURE
|
||
varying float frameIndex;
|
||
varying vec3 vTextureCoord;
|
||
varying vec4 vSourceRect;
|
||
#endif
|
||
|
||
#ifdef CLIPPATH
|
||
varying vec2 vClipUV;
|
||
#endif
|
||
|
||
#ifdef FILTER
|
||
uniform int u_filterFlag;
|
||
uniform float u_colorMatrix[20];
|
||
#endif
|
||
|
||
#ifdef CLOUDFILTER
|
||
varying vec4 colorCloud0;
|
||
varying vec4 colorCloud1;
|
||
varying vec4 colorCloud2;
|
||
varying vec4 colorCloud3;
|
||
varying vec4 colorCloud4;
|
||
#endif
|
||
|
||
#ifdef GRADIENT
|
||
varying vec3 vGradientVector1;
|
||
varying vec3 vGradientVector2;
|
||
uniform float u_colorSteps[40];
|
||
uniform int u_gradientType;
|
||
|
||
void gradient(inout vec4 color, vec3 gv1, vec3 gv2, float colorSteps[40]) {
|
||
float t;
|
||
// center circle radius
|
||
float cr = gv1.z;
|
||
// focal circle radius
|
||
float fr = gv2.z;
|
||
|
||
if(cr > 0.0 || fr > 0.0) {
|
||
// radial gradient
|
||
vec2 center = gv1.xy;
|
||
vec2 focal = gv2.xy;
|
||
float x = focal.x - gl_FragCoord.x;
|
||
float y = focal.y - gl_FragCoord.y;
|
||
float dx = focal.x - center.x;
|
||
float dy = focal.y - center.y;
|
||
float dr = cr - fr;
|
||
float a = dx * dx + dy * dy - dr * dr;
|
||
float b = -2.0 * (y * dy + x * dx + fr * dr);
|
||
float c = x * x + y * y - fr * fr;
|
||
t = 1.0 - 0.5 * (1.0 / a) * (-b + sqrt(b * b - 4.0 * a * c));
|
||
} else {
|
||
// linear gradient
|
||
vec2 v1 = gl_FragCoord.xy - gv1.xy;
|
||
vec2 v2 = gv2.xy - gv1.xy;
|
||
t = (v1.x * v2.x + v1.y * v2.y) / (v2.x * v2.x + v2.y * v2.y);
|
||
}
|
||
|
||
vec4 colors[8];
|
||
colors[0] = vec4(colorSteps[1], colorSteps[2], colorSteps[3], colorSteps[4]);
|
||
colors[1] = vec4(colorSteps[6], colorSteps[7], colorSteps[8], colorSteps[9]);
|
||
colors[2] = vec4(colorSteps[11], colorSteps[12], colorSteps[13], colorSteps[14]);
|
||
colors[3] = vec4(colorSteps[16], colorSteps[17], colorSteps[18], colorSteps[19]);
|
||
colors[4] = vec4(colorSteps[21], colorSteps[22], colorSteps[23], colorSteps[24]);
|
||
colors[5] = vec4(colorSteps[26], colorSteps[27], colorSteps[28], colorSteps[29]);
|
||
colors[6] = vec4(colorSteps[31], colorSteps[32], colorSteps[33], colorSteps[34]);
|
||
colors[7] = vec4(colorSteps[36], colorSteps[37], colorSteps[38], colorSteps[39]);
|
||
|
||
float steps[8];
|
||
steps[0] = colorSteps[0];
|
||
steps[1] = colorSteps[5];
|
||
steps[2] = colorSteps[10];
|
||
steps[3] = colorSteps[15];
|
||
steps[4] = colorSteps[20];
|
||
steps[5] = colorSteps[25];
|
||
steps[6] = colorSteps[30];
|
||
steps[7] = colorSteps[35];
|
||
|
||
color = colors[0];
|
||
for (int i = 1; i < 8; i++) {
|
||
if (steps[i] < 0.0 || steps[i] > 1.0) {
|
||
break;
|
||
}
|
||
if(steps[i] == steps[i - 1]) {
|
||
color = colors[i];
|
||
} else {
|
||
color = mix(color, colors[i], clamp((t - steps[i - 1]) / (steps[i] - steps[i - 1]), 0.0, 1.0));
|
||
}
|
||
if (steps[i] >= t) {
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
#endif
|
||
|
||
void transformColor(inout vec4 color, in float colorMatrix[20]) {
|
||
float r = color.r, g = color.g, b = color.b, a = color.a;
|
||
color[0] = colorMatrix[0] * r + colorMatrix[1] * g + colorMatrix[2] * b + colorMatrix[3] * a + colorMatrix[4];
|
||
color[1] = colorMatrix[5] * r + colorMatrix[6] * g + colorMatrix[7] * b + colorMatrix[8] * a + colorMatrix[9];
|
||
color[2] = colorMatrix[10] * r + colorMatrix[11] * g + colorMatrix[12] * b + colorMatrix[13] * a + colorMatrix[14];
|
||
color[3] = colorMatrix[15] * r + colorMatrix[16] * g + colorMatrix[17] * b + colorMatrix[18] * a + colorMatrix[19];
|
||
}
|
||
|
||
#ifdef CLOUDFILTER
|
||
void buildCloudColor(inout float colorCloudMatrix[20]) {
|
||
colorCloudMatrix[0] = colorCloud0[0];
|
||
colorCloudMatrix[1] = colorCloud1[0];
|
||
colorCloudMatrix[2] = colorCloud2[0];
|
||
colorCloudMatrix[3] = colorCloud3[0];
|
||
colorCloudMatrix[4] = colorCloud4[0];
|
||
|
||
colorCloudMatrix[5] = colorCloud0[1];
|
||
colorCloudMatrix[6] = colorCloud1[1];
|
||
colorCloudMatrix[7] = colorCloud2[1];
|
||
colorCloudMatrix[8] = colorCloud3[1];
|
||
colorCloudMatrix[9] = colorCloud4[1];
|
||
|
||
colorCloudMatrix[10] = colorCloud0[2];
|
||
colorCloudMatrix[11] = colorCloud1[2];
|
||
colorCloudMatrix[12] = colorCloud2[2];
|
||
colorCloudMatrix[13] = colorCloud3[2];
|
||
colorCloudMatrix[14] = colorCloud4[2];
|
||
|
||
colorCloudMatrix[15] = colorCloud0[3];
|
||
colorCloudMatrix[16] = colorCloud1[3];
|
||
colorCloudMatrix[17] = colorCloud2[3];
|
||
colorCloudMatrix[18] = colorCloud3[3];
|
||
colorCloudMatrix[19] = colorCloud4[3];
|
||
}
|
||
#endif
|
||
|
||
void main() {
|
||
vec4 color = vColor;
|
||
float opacity = abs(flagBackground);
|
||
|
||
#ifdef GRADIENT
|
||
if(u_gradientType > 0 && flagBackground > 0.0 || u_gradientType == 0 && flagBackground <= 0.0) {
|
||
gradient(color, vGradientVector1, vGradientVector2, u_colorSteps);
|
||
}
|
||
#endif
|
||
|
||
if(opacity < 1.0) {
|
||
color.a *= opacity;
|
||
}
|
||
|
||
#ifdef TEXTURE
|
||
if(flagBackground > 0.0) {
|
||
vec3 texCoord = vTextureCoord;
|
||
|
||
if(texCoord.z == 1.0) {
|
||
texCoord = fract(texCoord);
|
||
}
|
||
|
||
if(texCoord.x <= 1.0 && texCoord.x >= 0.0
|
||
&& texCoord.y <= 1.0 && texCoord.y >= 0.0) {
|
||
if(vSourceRect.z > 0.0) {
|
||
texCoord.x = vSourceRect.x + texCoord.x * vSourceRect.z;
|
||
texCoord.y = 1.0 - (vSourceRect.y + (1.0 - texCoord.y) * vSourceRect.w);
|
||
}
|
||
if(frameIndex < 0.0) {
|
||
vec4 texColor = texture2D(u_texSampler, texCoord.xy);
|
||
color = mix(color, texColor, texColor.a);
|
||
} else {
|
||
int index = int(floor(clamp(0.0, 11.0, frameIndex)));
|
||
vec4 texColor;
|
||
if(index == 0) texColor = texture2D(u_texFrame0, texCoord.xy);
|
||
else if(index == 1) texColor = texture2D(u_texFrame1, texCoord.xy);
|
||
else if(index == 2) texColor = texture2D(u_texFrame2, texCoord.xy);
|
||
else if(index == 3) texColor = texture2D(u_texFrame3, texCoord.xy);
|
||
else if(index == 4) texColor = texture2D(u_texFrame4, texCoord.xy);
|
||
else if(index == 5) texColor = texture2D(u_texFrame5, texCoord.xy);
|
||
else if(index == 6) texColor = texture2D(u_texFrame6, texCoord.xy);
|
||
else if(index == 7) texColor = texture2D(u_texFrame7, texCoord.xy);
|
||
else if(index == 8) texColor = texture2D(u_texFrame8, texCoord.xy);
|
||
else if(index == 9) texColor = texture2D(u_texFrame9, texCoord.xy);
|
||
else if(index == 10) texColor = texture2D(u_texFrame10, texCoord.xy);
|
||
else texColor = texture2D(u_texFrame11, texCoord.xy);
|
||
float alpha = texColor.a;
|
||
if(opacity < 1.0) {
|
||
texColor.a *= opacity;
|
||
alpha *= mix(0.465, 1.0, opacity);
|
||
}
|
||
// color = mix(color, texColor, texColor.a);
|
||
color.rgb = mix(color.rgb, texColor.rgb, alpha);
|
||
// color.rgb = mix(texColor.rgb, color.rgb, color.a);
|
||
color.rgb = mix(texColor.rgb, color.rgb, clamp(color.a / max(0.0001, texColor.a), 0.0, 1.0));
|
||
color.a = texColor.a + (1.0 - texColor.a) * color.a;
|
||
}
|
||
}
|
||
}
|
||
#endif
|
||
|
||
#ifdef FILTER
|
||
if(u_filterFlag > 0) {
|
||
transformColor(color, u_colorMatrix);
|
||
}
|
||
#endif
|
||
|
||
#ifdef CLOUDFILTER
|
||
float colorCloudMatrix[20];
|
||
buildCloudColor(colorCloudMatrix);
|
||
transformColor(color, colorCloudMatrix);
|
||
#endif
|
||
|
||
#ifdef CLIPPATH
|
||
float clip = texture2D(u_clipSampler, vClipUV).r;
|
||
color *= clip;
|
||
#endif
|
||
|
||
gl_FragColor = color;
|
||
}`}),(function(o,t,e){e.r(t),(function(r,n){e.d(t,"requestAnimationFrame",function(){return a}),e.d(t,"cancelAnimationFrame",function(){return s}),e(1).glMatrix.setMatrixArrayType(Array);function i(){if(typeof performance<"u"&&performance.now)return performance.now();if(typeof r<"u"&&r.hrtime){const[u,d]=r.hrtime();return u*1e3+d*1e-6}return Date.now?Date.now():new Date().getTime()}let a,s;typeof n<"u"&&typeof n.requestAnimationFrame=="function"?(a=n.requestAnimationFrame,s=n.cancelAnimationFrame):(a=function(u){return setTimeout(()=>{u(i())},16)},s=function(u){return clearTimeout(u)})}).call(this,e(69),e(22))}),(function(o,t){var e=o.exports={},r,n;function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?r=setTimeout:r=i}catch{r=i}try{typeof clearTimeout=="function"?n=clearTimeout:n=a}catch{n=a}})();function s(C){if(r===setTimeout)return setTimeout(C,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(C,0);try{return r(C,0)}catch{try{return r.call(null,C,0)}catch{return r.call(this,C,0)}}}function u(C){if(n===clearTimeout)return clearTimeout(C);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(C);try{return n(C)}catch{try{return n.call(null,C)}catch{return n.call(this,C)}}}var d=[],M=!1,c,v=-1;function p(){!M||!c||(M=!1,c.length?d=c.concat(d):v=-1,d.length&&T())}function T(){if(!M){var C=s(p);M=!0;for(var h=d.length;h;){for(c=d,d=[];++v<h;)c&&c[v].run();v=-1,h=d.length}c=null,M=!1,u(C)}}e.nextTick=function(C){var h=new Array(arguments.length-1);if(arguments.length>1)for(var g=1;g<arguments.length;g++)h[g-1]=arguments[g];d.push(new x(C,h)),d.length===1&&!M&&s(T)};function x(C,h){this.fun=C,this.array=h}x.prototype.run=function(){this.fun.apply(null,this.array)},e.title="browser",e.browser=!0,e.env={},e.argv=[],e.version="",e.versions={};function y(){}e.on=y,e.addListener=y,e.once=y,e.off=y,e.removeListener=y,e.removeAllListeners=y,e.emit=y,e.prependListener=y,e.prependOnceListener=y,e.listeners=function(C){return[]},e.binding=function(C){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(C){throw new Error("process.chdir is not supported")},e.umask=function(){return 0}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return P});var r=e(1),n=e(71),i=e(73),a=e(213),s=e(214),u=e(215),d=e(216);e(1).glMatrix.setMatrixArrayType(Array);function M(R,D){var L=Object.keys(R);if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(R);D&&(j=j.filter(function(b){return Object.getOwnPropertyDescriptor(R,b).enumerable})),L.push.apply(L,j)}return L}function c(R){for(var D=1;D<arguments.length;D++){var L=arguments[D]!=null?arguments[D]:{};D%2?M(Object(L),!0).forEach(function(j){v(R,j,L[j])}):Object.getOwnPropertyDescriptors?Object.defineProperties(R,Object.getOwnPropertyDescriptors(L)):M(Object(L)).forEach(function(j){Object.defineProperty(R,j,Object.getOwnPropertyDescriptor(L,j))})}return R}function v(R,D,L){return D in R?Object.defineProperty(R,D,{value:L,enumerable:!0,configurable:!0,writable:!0}):R[D]=L,R}const p=Symbol.for("spritejs_changedAttrs"),T=Symbol.for("spritejs_attributes"),x=Symbol("resolution"),y=Symbol("animations"),C=Symbol("eventListeners"),h=Symbol("captureEventListeners"),g=Symbol("filters"),f=Symbol("display"),m=Symbol("program"),S=Symbol("shaderAttrs"),A=Symbol("uniforms");class P{constructor(D={}){this.attributes=new this.constructor.Attr(this),this[x]={width:300,height:150},Object.assign(this.attributes,D),this[y]=new Set,this[C]={},this[h]={}}get ancestors(){let D=this.parent;const L=[];for(;D;)L.push(D),D=D.parent;return L}get animations(){return this[y]}get filters(){return this[g]||this.parent&&this.parent.filters}get isVisible(){return!1}get layer(){return this.parent?this.parent.layer:null}get localMatrix(){const D=this.transformMatrix,{x:L,y:j}=this.attributes;return D[4]+=L,D[5]+=j,D}get opacity(){let D=this.attributes.opacity;return this.parent&&this.parent.opacity!=null&&(D*=this.parent.opacity),D}get parentNode(){return this.parent}get nextSibling(){return this.getNodeNearBy(1)}get previousSibling(){return this.getNodeNearBy(-1)}get program(){return this[m]}get renderer(){return this.parent?this.parent.renderer:null}get renderMatrix(){if(this.__cacheRenderMatrix)return this.__cacheRenderMatrix;let D=this.localMatrix;const L=this.parent;if(L){const j=L.__cacheRenderMatrix||L.renderMatrix;j&&(D=r.mat2d.multiply(Array.of(0,0,0,0,0,0),j,D))}return D}get worldScaling(){const D=this.renderMatrix;return[Math.hypot(D[0],D[1]),Math.hypot(D[2],D[3])]}get worldRotation(){const D=this.renderMatrix;return Math.atan2(D[1],D[3])}get worldPosition(){const D=this.renderMatrix;return[D[4],D[5]]}get uniforms(){return this[A]}get className(){return this.attributes.className}set className(D){this.attributes.className=D}get id(){return this.attributes.id}set id(D){this.attributes.id=D}get name(){return this.attributes.name}set name(D){this.attributes.name=D}get zIndex(){return this.attributes.zIndex}set zIndex(D){this.attributes.zIndex=D}get mesh(){return null}get shaderAttrs(){return this[S]||{}}activateAnimations(){const D=this.layer;if(D){const L=this[y];L.forEach(b=>{b.baseTimeline=D.timeline,b.play(),b.finished.then(()=>{L.delete(b)})});const j=this.children;j&&j.forEach(b=>{b.activateAnimations&&b.activateAnimations()})}}addEventListener(D,L,j={}){D==="mousewheel"&&(D="wheel"),typeof j=="boolean"&&(j={capture:j});const{capture:b,once:O}=j,Y=b?h:C;return this[Y][D]=this[Y][D]||[],this[Y][D].push({listener:L,once:O}),this}animate(D,L){const j=new i.default(this,D,L);return this.effects&&j.applyEffects(this.effects),this.layer&&(j.baseTimeline=this.layer.timeline,j.play(),j.finished.then(()=>{this[y].delete(j)})),this[y].add(j),j}attr(...D){if(D.length===0)return this.attributes[T];if(D.length>1){let[L,j]=D;return typeof j=="function"&&(j=j(this.attr(L))),this.setAttribute(L,j),this}return typeof D[0]=="string"?this.getAttribute(D[0]):(Object.assign(this.attributes,D[0]),this)}cloneNode(){const D=new this.constructor,L=this.attributes[p];return D.attr(L),D}connect(D,L){Object.defineProperty(this,"parent",{value:D,writable:!1,configurable:!0}),Object.defineProperty(this,"zOrder",{value:L,writable:!1,configurable:!0}),D.timeline&&this.activateAnimations(),this.setResolution(D.getResolution()),this.forceUpdate(),this.dispatchEvent({type:"append",detail:{parent:D,zOrder:L}})}contains(D){for(;D&&this!==D;)D=D.parent;return!!D}deactivateAnimations(){this[y].forEach(L=>L.cancel());const D=this.children;D&&D.forEach(L=>{L.deactivateAnimations&&L.deactivateAnimations()})}disconnect(){const{parent:D,zOrder:L}=this;delete this.parent,delete this.zOrder,this.deactivateAnimations(),this.dispatchEvent({type:"remove",detail:{parent:D,zOrder:L}}),D&&D.forceUpdate()}dispatchEvent(D){D instanceof s.default||(D=new s.default(D)),D.target=this;let L=D.type;L==="mousewheel"&&(L="wheel");const j=[this];let b=this.parent;for(;D.bubbles&&b;)j.push(b),b=b.parent;for(let O=j.length-1;O>=0;O--){const Y=j[O],X=Y[h]&&Y[h][L];if(X&&X.length&&(D.currentTarget=Y,X.forEach(({listener:Z,once:$})=>{Z.call(this,D),$&&j.removeEventListener(Z)}),delete D.currentTarget),!D.bubbles&&D.cancelBubble)break}if(!D.cancelBubble)for(let O=0;O<j.length;O++){const Y=j[O],X=Y[C]&&Y[C][L];if(X&&X.length&&(D.currentTarget=Y,X.forEach(({listener:Z,once:$})=>{Z.call(this,D),$&&j.removeEventListener(Z)}),delete D.currentTarget),!D.bubbles||D.cancelBubble)break}}dispatchPointerEvent(D){const{layerX:L,layerY:j}=D;return this.isPointCollision(L,j)?(this.dispatchEvent(D),!0):!1}draw(D=[]){const L=this.mesh;if(L){if(Object(u.applyFilters)(L,this.filters),D.push(L),this[m]){L.setProgram(this[m]);const j=this[S];j&&Object.entries(j).forEach(([O,Y])=>{L.setAttribute(O,Y)});const b=this[A];if(this[A]){const O={};Object.entries(b).forEach(([Y,X])=>{typeof X=="function"&&(X=X(this,Y)),O[Y]=X}),L.setUniforms(O)}}Object(d.default)(this,L)}return D}forceUpdate(){this.parent&&this.parent.forceUpdate()}getAttribute(D){return this.attributes[D]}getListeners(D,{capture:L=!1}={}){return[...this[L?h:C][D]||[]]}getNodeNearBy(D=1){if(!this.parent)return null;if(D===0)return this;const L=this.parent.children,j=L.indexOf(this);return L[j+D]}getWorldPosition(D,L){const j=this.renderMatrix,b=D*j[0]+L*j[2]+j[4],O=D*j[1]+L*j[3]+j[5];return[b,O]}getOffsetPosition(D,L){const j=r.mat2d.invert(Array.of(0,0,0,0,0,0),this.renderMatrix),b=D*j[0]+L*j[2]+j[4],O=D*j[1]+L*j[3]+j[5];return[b,O]}getResolution(){return c({},this[x])}isPointCollision(D,L){if(!this.mesh)return!1;const j=this.attributes.pointerEvents;if(j==="none"||j!=="all"&&!this.isVisible)return!1;let b="both";return j==="visibleFill"&&(b="fill"),j==="visibleStroke"&&(b="stroke"),this.mesh.isPointCollision(D,L,b)}onPropertyChange(D,L,j){D!=="id"&&D!=="name"&&D!=="className"&&D!=="pointerEvents"&&D!=="passEvents"&&this.forceUpdate(),D==="filter"&&(this[g]=Object(u.parseFilterString)(L)),D==="zIndex"&&this.parent&&this.parent.reorder()}setAttribute(D,L){D==="attrs"&&this.attr(L),this.attributes[D]=L}setMouseCapture(){this.layer&&(this.layer.__mouseCapturedTarget=this)}setProgram(D){this[m]=D,this.forceUpdate()}setShaderAttribute(D,L){this[S]=this[S]||{},this[S][D]=L,this.forceUpdate()}setUniforms(D){this[A]=this[A]||{},Object.assign(this[A],D),this.forceUpdate()}setResolution({width:D,height:L}){const{width:j,height:b}=this[x];(j!==D||b!==L)&&(this[x]={width:D,height:L},this.forceUpdate(),this.dispatchEvent({type:"resolutionchange",detail:{width:D,height:L}}))}show(){this.attributes.display==="none"&&(this.attributes.display=this[f]||"")}hide(){this.attributes.display!=="none"&&(this[f]=this.attributes.display,this.attributes.display="none")}releaseMouseCapture(){this.layer&&this.layer.__mouseCapturedTarget===this&&(this.layer.__mouseCapturedTarget=null)}remove(){return this.parent&&this.parent.removeChild?(this.parent.removeChild(this),!0):!1}removeAllListeners(D,L={}){typeof L=="boolean"&&(L={capture:L});const b=L.capture?h:C;return this[b][D]&&(this[b][D]=[]),this}removeAttribute(D){this.setAttribute(D,null)}removeEventListener(D,L,j={}){typeof j=="boolean"&&(j={capture:j});const O=j.capture?h:C;if(this[O][D]){const Y=this[O][D];if(Y)for(let X=0;X<Y.length;X++){const{listener:Z}=Y[X];if(Z===L){this[O][D].splice(X,1);break}}}return this}transition(D,L="linear"){const j=this,b=Symbol("animation");L=L||"linear";let O=0;return typeof D=="object"&&(O=D.delay||0,D=D.duration),{[b]:null,cancel(Y=!1){const X=this[b];X&&X.cancel(Y)},end(){const Y=this[b];Y&&(Y.playState==="running"||Y.playState==="pending")&&Y.finish()},reverse(){const Y=this[b];if(Y)if(Y.playState==="running"||Y.playState==="pending")Y.playbackRate=-Y.playbackRate;else{const X=Y.timing.direction;Y.timing.direction=X==="reverse"?"normal":"reverse",Y.play()}return Y.finished},attr(Y,X){return this.end(),typeof Y=="string"&&(Y={[Y]:X}),Object.entries(Y).forEach(([Z,$])=>{typeof $=="function"&&(Y[Z]=$(j.attr(Z)))}),this[b]=j.animate([Y],{duration:D*1e3,delay:O*1e3,fill:"forwards",easing:L}),this[b].finished}}}updateContours(){}}v(P,"Attr",n.default),a.default.registerNode(P,"node")}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return P});var r=e(1),n=e(12),i=e(72);e(1).glMatrix.setMatrixArrayType(Array);const a=Symbol.for("spritejs_setAttributeDefault"),s=Symbol.for("spritejs_declareAlias"),u=Symbol.for("spritejs_setAttribute"),d=Symbol.for("spritejs_getAttribute"),M=Symbol.for("spritejs_attributes"),c=Symbol.for("spritejs_changedAttrs"),v=Symbol("subject"),p=Symbol("attr"),T=Symbol("default"),x=Symbol("alias");function y(R,[D,L]){let j=r.mat2d.fromValues(1,0,0,1,0,0);return[...R].forEach(([b,O])=>{if((D||L)&&(j=r.mat2d.translate(Array.of(0,0,0,0,0,0),j,[D,L])),b==="matrix")j=r.mat2d.multiply(j,j,O);else if(b==="offsetTranslate")j[4]+=O[0],j[5]+=O[1];else if(b==="offsetRotate")j=r.mat2d.rotate(Array.of(0,0,0,0,0,0),j,O);else if(b==="skew"){const[Y,X]=O;j=r.mat2d.multiply(j,j,r.mat2d.fromValues(1,Math.tan(X),Math.tan(Y),1,0,0))}else r.mat2d[b](j,j,O);(D||L)&&(j=r.mat2d.translate(Array.of(0,0,0,0,0,0),j,[-D,-L]))}),j}const C=Symbol("transformMatrix"),h=Symbol("transforms"),g=Symbol("changedAttrs"),f=Symbol("lastChangedAttr"),m=Symbol("offsetFigure");function S(R,D,L){const j=R[p][D];if(R[u](D,L,!1)||R[f]!==D){const O=R[h];O.has(D)&&O.delete(D),L&&(D==="rotate"&&(L=Math.PI*L/180),D==="scale"&&(L=L.map(Y=>Math.abs(Y)>1e-5?Y:1/Y>0?1e-5:-1e-5)),O.set(D,L)),R[C]=null,R[v].onPropertyChange(D,L,j,R)}}function A(R){const D=R[m],L=R.offsetDistance*D.getTotalLength(),j=D.getPointAtLength(L);if(j){const b=R[h];let O=R.offsetRotate;O==="auto"?O=j.angle:O==="reverse"?O=Math.PI+j.angle:O=Math.PI*O/180,b.set("offsetRotate",O),b.set("offsetTranslate",[j.x,j.y]),R[C]=null}}class P{static setDefault(D,...L){return D[a](...L)}static declareAlias(D,...L){return D[s](...L)}static setAttribute(D,...L){return D[u](...L)}static getAttribute(D,...L){return D[d](...L)}static getAttributes(D){return D[M]}static getChangedAttributes(D){return D[c]}constructor(D){this[v]=D,this[p]={},this[C]=r.mat2d.fromValues(1,0,0,1,0,0),this[h]=new Map,this[T]={},this[x]=[],Object.defineProperty(D,"transformMatrix",{get:()=>(this[C]||(this[C]=y(this[h],this.transformOrigin)),[...this[C]])}),this[a]({id:"",name:"",className:"",x:0,y:0,transformOrigin:[0,0],transform:"",translate:[0,0],rotate:0,scale:[1,1],skew:[0,0],opacity:1,zIndex:0,offsetPath:void 0,offsetDistance:0,offsetRotate:"auto",pointerEvents:"visible",filter:"none",display:""}),this[s]("class","pos"),this[g]=new Set,this[m]=new n.Figure2D({scale:5,simplify:0})}get[c](){const D={};return[...this[g]].forEach(L=>{D[L]=this[p][L]}),D}get[M](){const D=Object.assign({},this[p]);for(let L=0;L<this[x].length;L++){const j=this[x][L];D[j]=this[j]}return D}[a](D){Object.assign(this[T],D),Object.assign(this[p],D)}[s](...D){this[x].push(...D)}[u](D,L,j=!0){const b=this[p][D],O=this[v];return L==null&&(L=this[T][D]),Object(i.compareValue)(b,L)?!1:(this[p][D]=L,this[g].has(D)&&this[g].delete(D),this[g].add(D),this[f]=D,j&&O.onPropertyChange(D,L,b,this),!0)}[d](D){return this[p][D]}set id(D){this[u]("id",D)}get id(){return this[d]("id")}set name(D){this[u]("name",D)}get name(){return this[d]("name")}set className(D){this[u]("className",D)}get className(){return this[d]("className")}set class(D){this.className=D}get class(){return this.className}get x(){return this[d]("x")}set x(D){this[u]("x",Object(i.toNumber)(D))}get y(){return this[d]("y")}set y(D){this[u]("y",Object(i.toNumber)(D))}get pos(){return[this.x,this.y]}set pos(D){D=Object(i.toArray)(D),Array.isArray(D)||(D=[D,D]),this.x=D[0],this.y=D[1]}get transform(){return this[d]("transform")}set transform(D){let L=null;if(Array.isArray(D)&&(L=D,D=`matrix(${D.map(i.toNumber).join()})`),typeof D=="string")D=D.replace(/\s*,\s*/g,",");else if(D!=null)throw new TypeError("Invalid transform value.");const j=this[p].transform;if(this[u]("transform",D,!1)){const b=this[h];if(b.has("matrix")&&b.delete("matrix"),L)b.set("matrix",L);else if(D){const O=D.match(/(matrix|translate|rotate|scale|skew)\([^()]+\)/g);if(O){let Y=r.mat2d.fromValues(1,0,0,1,0,0);for(let X=0;X<O.length;X++){const $=O[X].match(/^(matrix|translate|rotate|scale|skew)\(([^()]+)\)/);if($){let[,rt,F]=$;rt==="rotate"?F=Math.PI*parseFloat(F)/180:F=F.trim().split(/[\s,]+/).map(Q=>Object(i.toNumber)(Q)),rt==="matrix"?Y=r.mat2d.multiply(Y,Y,F):rt==="skew"?Y=r.mat2d.multiply(Y,Y,r.mat2d.fromValues(1,Math.tan(F[1]),Math.tan(F[0]),1,0,0)):r.mat2d[rt](Y,Y,F),b.set("matrix",Y)}}}else throw new TypeError("Invalid transform value.")}this[C]=null,this[v].onPropertyChange("transform",D,j,this)}}get transformOrigin(){return this[d]("transformOrigin")}set transformOrigin(D){D=Object(i.toArray)(D,!0),D!=null&&!Array.isArray(D)&&(D=[D,D]),this[u]("transformOrigin",D)&&(this[C]=null)}get rotate(){return this[d]("rotate")}set rotate(D){S(this,"rotate",D)}get translate(){return this[d]("translate")}set translate(D){D=Object(i.toArray)(D,!0),D!=null&&!Array.isArray(D)&&(D=[D,D]),S(this,"translate",D)}get scale(){return this[d]("scale")}set scale(D){D=Object(i.toArray)(D,!0),D!=null&&!Array.isArray(D)&&(D=[D,D]),S(this,"scale",D)}get skew(){return this[d]("skew")}set skew(D){D=Object(i.toArray)(D,!0),D!=null&&!Array.isArray(D)&&(D=[D,D]),S(this,"skew",D)}get opacity(){return this[d]("opacity")}set opacity(D){D!=null&&(D=Number(D)),this[u]("opacity",D)}get zIndex(){return this[d]("zIndex")}set zIndex(D){D!=null&&(D=Number(D)),this[u]("zIndex",D)}get offsetPath(){return this[d]("offsetPath")}set offsetPath(D){this[u]("offsetPath",D)&&(this[m].beginPath(),D!=null&&this[m].addPath(D),A(this))}get offsetDistance(){return this[d]("offsetDistance")}set offsetDistance(D){this[u]("offsetDistance",Object(i.toNumber)(D))&&A(this)}get offsetRotate(){return this[d]("offsetRotate")}set offsetRotate(D){this[u]("offsetRotate",D),A(this)}get pointerEvents(){return this[d]("pointerEvents")}set pointerEvents(D){if(D!=null&&D!=="none"&&D!=="visible"&&D!=="visibleFill"&&D!=="visibleStroke"&&D!=="all")throw new TypeError("Invalid pointerEvents type.");this[u]("pointerEvents",D)}get filter(){return this[d]("filter")}set filter(D){this[u]("filter",D)}get display(){return this[d]("display")}set display(D){this[u]("display",D)}set offset(D){}}}),(function(o,t,e){e.r(t),e.d(t,"sizeToPixel",function(){return r}),e.d(t,"toString",function(){return n}),e.d(t,"toNumber",function(){return i}),e.d(t,"toArray",function(){return a}),e.d(t,"compareValue",function(){return s}),e(1).glMatrix.setMatrixArrayType(Array);function r(u,d){const M=u.trim().match(/^([\d.]+)(px|pt|pc|in|cm|mm|em|ex|rem|q|vw|vh|vmax|vmin)$/);M?u={size:parseFloat(M[1]),unit:M[2]}:u={size:parseFloat(u),unit:"px"};let{size:c,unit:v}=u;if(v==="pt")c/=.75;else if(v==="pc")c*=16;else if(v==="in")c*=96;else if(v==="cm")c*=96/2.54;else if(v==="mm")c*=96/25.4;else if(v==="em"||v==="rem"||v==="ex"){if(!d&&typeof getComputedStyle=="function"&&typeof document<"u"){const p=getComputedStyle(document.documentElement).fontSize;p?d=r(p,16):d=16}c*=d,v==="ex"&&(c/=2)}else if(v==="q")c*=96/25.4/4;else if(v==="vw"||v==="vh"){if(typeof document<"u"){const p=v==="vw"?window.innerWidth||document.documentElement.clientWidth:window.innerHeight||document.documentElement.clientHeight;c*=p/100}}else if((v==="vmax"||v==="vmin")&&typeof document<"u"){const p=window.innerWidth||document.documentElement.clientWidth,T=window.innerHeight||document.documentElement.clientHeight;v==="vmax"?c*=Math.max(p,T)/100:c*=Math.min(p,T)/100}return c}function n(u){return u==null?u:String(u)}function i(u){if(u==null)return u;if(typeof u=="string"&&(u=r(u)),!Number.isFinite(u))throw new TypeError("Invalid value");return u}function a(u,d=!1){return u===""?null:(typeof u=="string"&&(u=u.split(/[\s,]+/g)),Array.isArray(u)&&(d&&(u=u.map(i)),u.length===1)?u[0]:u)}function s(u,d){if(Array.isArray(u)&&Array.isArray(d)){if(u.length!==d.length)return!1;for(let M=0;M<u.length;M++)if(u[M]!==d[M])return!1;return!0}return u==null&&d==null||u===d}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return v});var r=e(74),n=e(32),i=e.n(n),a=e(68),s=e(72);e(1).glMatrix.setMatrixArrayType(Array);function u(){return u=Object.assign||function(p){for(var T=1;T<arguments.length;T++){var x=arguments[T];for(var y in x)Object.prototype.hasOwnProperty.call(x,y)&&(p[y]=x[y])}return p},u.apply(this,arguments)}function d(p){if(typeof p=="string"){if(p=p.trim(),/^[0-9.]+%$/.test(p))return parseFloat(p)/100;if(/^([\d.]+)(px|pt|pc|in|cm|mm|em|ex|rem|q|vw|vh|vmax|vmin)$/.test(p))return Object(s.sizeToPixel)(p)}return p}function M(p,T,x,y,C){return typeof p=="string"&&(p=i()(p)),typeof T=="string"&&(T=i()(T)),r.Effects.default(p,T,x,y,C)}function c(p,T,x,y,C){return r.Effects.default(p,T,x,y,C)}r.Effects.default=function(p,T,x,y,C){return Array.isArray(p)&&Array.isArray(T)?p.map((h,g)=>h+(x-y)/(C-y)*(T[g]-h)):typeof p=="number"&&typeof T=="number"?p+(x-y)/(C-y)*(T-p):x-y>C-x?T:p},r.Effects.fillColor=M,r.Effects.strokeColor=M,r.Effects.bgcolor=M,r.Effects.borderColor=M,r.Effects.text=c;class v extends r.Animator{constructor(T,x,y){const C=T.attr();Object.entries(C).forEach(([h,g])=>{C[h]=r.Effects[h]?g:d(g)}),x=x.map(h=>{let g=u({},h);const f={};return Object.entries(g).forEach(([m,S])=>{f[m]=r.Effects[m]?S:d(S)}),f}),super(C,x,y),this.target=T,this.setter=function(h,g){g.attr(h)}}get playState(){return this.target.parent?super.playState:"idle"}get finished(){return super.finished.then(()=>{const T=this;return new Promise(x=>{function y(){T.setter(T.frame,T.target);const C=T.playState;C==="finished"||C==="idle"?(Object(a.cancelAnimationFrame)(T.requestId),x()):Object(a.requestAnimationFrame)(y)}y()})})}finish(){super.finish(),Object(a.cancelAnimationFrame)(this.requestId),this.setter(this.frame,this.target)}play(){if(!this.target.parent||this.playState==="running")return;super.play(),this.setter(this.frame,this.target);const T=this;this.ready.then(()=>{T.setter(T.frame,T.target),T.requestId=Object(a.requestAnimationFrame)(function x(){const y=T.target;if(typeof document<"u"&&document.documentElement&&document.documentElement.contains&&y.layer&&y.layer.canvas&&!document.documentElement.contains(y.layer.canvas)){T.cancel();return}const C=T.playState;T.setter(T.frame,T.target),C!=="idle"&&(C==="running"?T.requestId=Object(a.requestAnimationFrame)(x):(C==="paused"||C==="pending"&&T.timeline.currentTime<0)&&T.ready.then(()=>{T.setter(T.frame,T.target),T.requestId=Object(a.requestAnimationFrame)(x)}))})})}cancel(T=!1){Object(a.cancelAnimationFrame)(this.requestId),T?(this.setter(this.frame,this.target),super.cancel()):(super.cancel(),this.setter(this.frame,this.target))}}}),(function(o,t,e){Object.defineProperty(t,"__esModule",{value:!0}),t.Timeline=t.Effects=t.Easings=t.Animator=void 0;var r=e(75),n=M(r),i=e(187),a=M(i),s=e(188),u=e(190),d=M(u);function M(c){return c&&c.__esModule?c:{default:c}}t.Animator=d.default,t.Easings=s.Easings,t.Effects=a.default,t.Timeline=n.default}),(function(o,t,e){Object.defineProperty(t,"__esModule",{value:!0});var r=e(76),n=h(r),i=e(133),a=h(i),s=e(141),u=h(s),d=e(164),M=h(d),c=e(170),v=h(c),p=e(171),T=h(p),x=e(175),y=h(x),C=e(186);function h(j){return j&&j.__esModule?j:{default:j}}var g=(0,C.createNowTime)(),f={originTime:0,playbackRate:1},m=(0,y.default)("timeMark"),S=(0,y.default)("playbackRate"),A=(0,y.default)("timers"),P=(0,y.default)("originTime"),R=(0,y.default)("setTimer"),D=(0,y.default)("parent"),L=(function(){function j(b,O){(0,v.default)(this,j),b instanceof j&&(O=b,b={}),b=(0,M.default)({},f,b),O&&(this[D]=O);var Y=b.nowtime||g;if(O)Object.defineProperty(this,"globalTime",{get:function(){return O.currentTime}});else{var X=Y();Object.defineProperty(this,"globalTime",{get:function(){return Y()-X}})}this[m]=[{globalTime:this.globalTime,localTime:-b.originTime,entropy:-b.originTime,playbackRate:b.playbackRate,globalEntropy:0}],this[D]&&(this[m][0].globalEntropy=this[D].entropy),this[P]=b.originTime,this[S]=b.playbackRate,this[A]=new u.default}return(0,T.default)(j,[{key:"markTime",value:function(){var O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Y=O.time,X=Y===void 0?this.currentTime:Y,Z=O.entropy,$=Z===void 0?this.entropy:Z,rt=O.playbackRate,F=rt===void 0?this.playbackRate:rt,Q={globalTime:this.globalTime,localTime:X,entropy:$,playbackRate:F,globalEntropy:this.globalEntropy};this[m].push(Q)}},{key:"fork",value:function(O){return new j(O,this)}},{key:"seekGlobalTime",value:function(O){var Y=this.seekTimeMark(O),X=this[m][Y],Z=X.entropy,$=X.playbackRate,rt=X.globalTime;return rt+(O-Z)/Math.abs($)}},{key:"seekLocalTime",value:function(O){var Y=this.seekTimeMark(O),X=this[m][Y],Z=X.localTime,$=X.entropy,rt=X.playbackRate;return rt>0?Z+(O-$):Z-(O-$)}},{key:"seekTimeMark",value:function(O){var Y=this[m],X=0,Z=Y.length-1;if(O<=Y[X].entropy)return X;if(O>=Y[Z].entropy)return Z;for(var $=Math.floor((X+Z)/2);$>X&&$<Z;){if(O===Y[$].entropy)return $;O<Y[$].entropy?Z=$:O>Y[$].entropy&&(X=$),$=Math.floor((X+Z)/2)}return X}},{key:"updateTimers",value:function(){var O=this,Y=[].concat((0,a.default)(this[A]));Y.forEach(function(X){var Z=(0,n.default)(X,2),$=Z[0],rt=Z[1];O[R](rt.handler,rt.time,$)})}},{key:"clearTimeout",value:(function(b){function O(Y){return b.apply(this,arguments)}return O.toString=function(){return b.toString()},O})(function(b){var O=this[A].get(b);O&&O.timerID!=null&&(this[D]?this[D].clearTimeout(O.timerID):clearTimeout(O.timerID)),this[A].delete(b)})},{key:"clearInterval",value:function(O){return this.clearTimeout(O)}},{key:"clear",value:function(){var O=this,Y=this[A];[].concat((0,a.default)(Y.keys())).forEach(function(X){O.clearTimeout(X)})}},{key:"setTimeout",value:function(O){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{delay:0};return this[R](O,Y)}},{key:"setInterval",value:function(O){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{delay:0},X=this,Z=this[R](function $(){X[R]($,Y,Z),O()},Y);return Z}},{key:R,value:function(O,Y){var X=this,Z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(0,y.default)("timerID");Y=(0,C.formatDelay)(Y);var $=this[A].get(Z),rt=void 0,F=null,Q=void 0,tt=void 0;$?(this.clearTimeout(Z),Y.isEntropy?rt=(Y.delay-(this.entropy-$.startEntropy))/Math.abs(this.playbackRate):rt=(Y.delay-(this.currentTime-$.startTime))/this.playbackRate,Q=$.startTime,tt=$.startEntropy):(rt=Y.delay/(Y.isEntropy?Math.abs(this.playbackRate):this.playbackRate),Q=this.currentTime,tt=this.entropy);var lt=this[D],ct=lt?lt.setTimeout.bind(lt):setTimeout,Mt=Y.heading;return!lt&&Mt===!1&&rt<0&&(rt=1/0),(isFinite(rt)||lt)&&(rt=Math.ceil(rt),ct!==setTimeout&&(rt={delay:rt,heading:Mt}),F=ct(function(){X[A].delete(Z),O()},rt)),this[A].set(Z,{timerID:F,handler:O,time:Y,startTime:Q,startEntropy:tt}),Z}},{key:"parent",get:function(){return this[D]}},{key:"lastTimeMark",get:function(){return this[m][this[m].length-1]}},{key:"currentTime",get:function(){var O=this.lastTimeMark,Y=O.localTime,X=O.globalTime;return Y+(this.globalTime-X)*this.playbackRate},set:function(O){var Y=this,X=this.currentTime,Z=O,$=this[A];this.markTime({time:O}),[].concat((0,a.default)($)).forEach(function(rt){var F=(0,n.default)(rt,2),Q=F[0],tt=F[1];if($.has(Q)){var lt=tt.time,ct=lt.isEntropy,Mt=lt.delay,st=lt.heading,Tt=tt.handler,xt=tt.startTime;if(ct)Mt===0&&(Tt(),Y.clearTimeout(Q));else{var W=xt+Mt;(Mt===0||st!==!1&&(Z-X)*Mt<=0||X<=W&&W<=Z||X>=W&&W>=Z)&&(Tt(),Y.clearTimeout(Q))}}}),this.updateTimers()}},{key:"entropy",get:function(){var O=this.lastTimeMark,Y=O.entropy,X=O.globalEntropy;return Y+Math.abs((this.globalEntropy-X)*this.playbackRate)},set:function(O){if(this.entropy>O){var Y=this.seekTimeMark(O);this[m].length=Y+1}this.markTime({entropy:O}),this.updateTimers()}},{key:"globalEntropy",get:function(){return this[D]?this[D].entropy:this.globalTime}},{key:"playbackRate",get:function(){return this[S]},set:function(O){O!==this.playbackRate&&(this.markTime({playbackRate:O}),this[S]=O,this.updateTimers())}},{key:"paused",get:function(){if(this.playbackRate===0)return!0;for(var O=this.parent;O;){if(O.playbackRate===0)return!0;O=O.parent}return!1}}]),j})();t.default=L}),(function(o,t,e){t.__esModule=!0;var r=e(77),n=s(r),i=e(129),a=s(i);function s(u){return u&&u.__esModule?u:{default:u}}t.default=(function(){function u(d,M){var c=[],v=!0,p=!1,T=void 0;try{for(var x=(0,a.default)(d),y;!(v=(y=x.next()).done)&&(c.push(y.value),!(M&&c.length===M));v=!0);}catch(C){p=!0,T=C}finally{try{!v&&x.return&&x.return()}finally{if(p)throw T}}return c}return function(d,M){if(Array.isArray(d))return d;if((0,n.default)(Object(d)))return u(d,M);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})()}),(function(o,t,e){o.exports={default:e(78),__esModule:!0}}),(function(o,t,e){e(79),e(125),o.exports=e(127)}),(function(o,t,e){e(80);for(var r=e(91),n=e(95),i=e(83),a=e(122)("toStringTag"),s="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),u=0;u<s.length;u++){var d=s[u],M=r[d],c=M&&M.prototype;c&&!c[a]&&n(c,a,d),i[d]=i.Array}}),(function(o,t,e){var r=e(81),n=e(82),i=e(83),a=e(84);o.exports=e(88)(Array,"Array",function(s,u){this._t=a(s),this._i=0,this._k=u},function(){var s=this._t,u=this._k,d=this._i++;return!s||d>=s.length?(this._t=void 0,n(1)):u=="keys"?n(0,d):u=="values"?n(0,s[d]):n(0,[d,s[d]])},"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")}),(function(o,t){o.exports=function(){}}),(function(o,t){o.exports=function(e,r){return{value:r,done:!!e}}}),(function(o,t){o.exports={}}),(function(o,t,e){var r=e(85),n=e(87);o.exports=function(i){return r(n(i))}}),(function(o,t,e){var r=e(86);o.exports=Object("z").propertyIsEnumerable(0)?Object:function(n){return r(n)=="String"?n.split(""):Object(n)}}),(function(o,t){var e={}.toString;o.exports=function(r){return e.call(r).slice(8,-1)}}),(function(o,t){o.exports=function(e){if(e==null)throw TypeError("Can't call method on "+e);return e}}),(function(o,t,e){var r=e(89),n=e(90),i=e(106),a=e(95),s=e(83),u=e(107),d=e(121),M=e(123),c=e(122)("iterator"),v=!([].keys&&"next"in[].keys()),p="@@iterator",T="keys",x="values",y=function(){return this};o.exports=function(C,h,g,f,m,S,A){u(g,h,f);var P=function(F){if(!v&&F in j)return j[F];switch(F){case T:return function(){return new g(this,F)};case x:return function(){return new g(this,F)}}return function(){return new g(this,F)}},R=h+" Iterator",D=m==x,L=!1,j=C.prototype,b=j[c]||j[p]||m&&j[m],O=b||P(m),Y=m?D?P("entries"):O:void 0,X=h=="Array"&&j.entries||b,Z,$,rt;if(X&&(rt=M(X.call(new C)),rt!==Object.prototype&&rt.next&&(d(rt,R,!0),!r&&typeof rt[c]!="function"&&a(rt,c,y))),D&&b&&b.name!==x&&(L=!0,O=function(){return b.call(this)}),(!r||A)&&(v||L||!j[c])&&a(j,c,O),s[h]=O,s[R]=y,m)if(Z={values:D?O:P(x),keys:S?O:P(T),entries:Y},A)for($ in Z)$ in j||i(j,$,Z[$]);else n(n.P+n.F*(v||L),h,Z);return Z}}),(function(o,t){o.exports=!0}),(function(o,t,e){var r=e(91),n=e(92),i=e(93),a=e(95),s=e(105),u="prototype",d=function(M,c,v){var p=M&d.F,T=M&d.G,x=M&d.S,y=M&d.P,C=M&d.B,h=M&d.W,g=T?n:n[c]||(n[c]={}),f=g[u],m=T?r:x?r[c]:(r[c]||{})[u],S,A,P;T&&(v=c);for(S in v)A=!p&&m&&m[S]!==void 0,!(A&&s(g,S))&&(P=A?m[S]:v[S],g[S]=T&&typeof m[S]!="function"?v[S]:C&&A?i(P,r):h&&m[S]==P?(function(R){var D=function(L,j,b){if(this instanceof R){switch(arguments.length){case 0:return new R;case 1:return new R(L);case 2:return new R(L,j)}return new R(L,j,b)}return R.apply(this,arguments)};return D[u]=R[u],D})(P):y&&typeof P=="function"?i(Function.call,P):P,y&&((g.virtual||(g.virtual={}))[S]=P,M&d.R&&f&&!f[S]&&a(f,S,P)))};d.F=1,d.G=2,d.S=4,d.P=8,d.B=16,d.W=32,d.U=64,d.R=128,o.exports=d}),(function(o,t){var e=o.exports=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=e)}),(function(o,t){var e=o.exports={version:"2.6.11"};typeof __e=="number"&&(__e=e)}),(function(o,t,e){var r=e(94);o.exports=function(n,i,a){if(r(n),i===void 0)return n;switch(a){case 1:return function(s){return n.call(i,s)};case 2:return function(s,u){return n.call(i,s,u)};case 3:return function(s,u,d){return n.call(i,s,u,d)}}return function(){return n.apply(i,arguments)}}}),(function(o,t){o.exports=function(e){if(typeof e!="function")throw TypeError(e+" is not a function!");return e}}),(function(o,t,e){var r=e(96),n=e(104);o.exports=e(100)?function(i,a,s){return r.f(i,a,n(1,s))}:function(i,a,s){return i[a]=s,i}}),(function(o,t,e){var r=e(97),n=e(99),i=e(103),a=Object.defineProperty;t.f=e(100)?Object.defineProperty:function(u,d,M){if(r(u),d=i(d,!0),r(M),n)try{return a(u,d,M)}catch{}if("get"in M||"set"in M)throw TypeError("Accessors not supported!");return"value"in M&&(u[d]=M.value),u}}),(function(o,t,e){var r=e(98);o.exports=function(n){if(!r(n))throw TypeError(n+" is not an object!");return n}}),(function(o,t){o.exports=function(e){return typeof e=="object"?e!==null:typeof e=="function"}}),(function(o,t,e){o.exports=!e(100)&&!e(101)(function(){return Object.defineProperty(e(102)("div"),"a",{get:function(){return 7}}).a!=7})}),(function(o,t,e){o.exports=!e(101)(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7})}),(function(o,t){o.exports=function(e){try{return!!e()}catch{return!0}}}),(function(o,t,e){var r=e(98),n=e(91).document,i=r(n)&&r(n.createElement);o.exports=function(a){return i?n.createElement(a):{}}}),(function(o,t,e){var r=e(98);o.exports=function(n,i){if(!r(n))return n;var a,s;if(i&&typeof(a=n.toString)=="function"&&!r(s=a.call(n))||typeof(a=n.valueOf)=="function"&&!r(s=a.call(n))||!i&&typeof(a=n.toString)=="function"&&!r(s=a.call(n)))return s;throw TypeError("Can't convert object to primitive value")}}),(function(o,t){o.exports=function(e,r){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:r}}}),(function(o,t){var e={}.hasOwnProperty;o.exports=function(r,n){return e.call(r,n)}}),(function(o,t,e){o.exports=e(95)}),(function(o,t,e){var r=e(108),n=e(104),i=e(121),a={};e(95)(a,e(122)("iterator"),function(){return this}),o.exports=function(s,u,d){s.prototype=r(a,{next:n(1,d)}),i(s,u+" Iterator")}}),(function(o,t,e){var r=e(97),n=e(109),i=e(119),a=e(116)("IE_PROTO"),s=function(){},u="prototype",d=function(){var M=e(102)("iframe"),c=i.length,v="<",p=">",T;for(M.style.display="none",e(120).appendChild(M),M.src="javascript:",T=M.contentWindow.document,T.open(),T.write(v+"script"+p+"document.F=Object"+v+"/script"+p),T.close(),d=T.F;c--;)delete d[u][i[c]];return d()};o.exports=Object.create||function(c,v){var p;return c!==null?(s[u]=r(c),p=new s,s[u]=null,p[a]=c):p=d(),v===void 0?p:n(p,v)}}),(function(o,t,e){var r=e(96),n=e(97),i=e(110);o.exports=e(100)?Object.defineProperties:function(s,u){n(s);for(var d=i(u),M=d.length,c=0,v;M>c;)r.f(s,v=d[c++],u[v]);return s}}),(function(o,t,e){var r=e(111),n=e(119);o.exports=Object.keys||function(a){return r(a,n)}}),(function(o,t,e){var r=e(105),n=e(84),i=e(112)(!1),a=e(116)("IE_PROTO");o.exports=function(s,u){var d=n(s),M=0,c=[],v;for(v in d)v!=a&&r(d,v)&&c.push(v);for(;u.length>M;)r(d,v=u[M++])&&(~i(c,v)||c.push(v));return c}}),(function(o,t,e){var r=e(84),n=e(113),i=e(115);o.exports=function(a){return function(s,u,d){var M=r(s),c=n(M.length),v=i(d,c),p;if(a&&u!=u){for(;c>v;)if(p=M[v++],p!=p)return!0}else for(;c>v;v++)if((a||v in M)&&M[v]===u)return a||v||0;return!a&&-1}}}),(function(o,t,e){var r=e(114),n=Math.min;o.exports=function(i){return i>0?n(r(i),9007199254740991):0}}),(function(o,t){var e=Math.ceil,r=Math.floor;o.exports=function(n){return isNaN(n=+n)?0:(n>0?r:e)(n)}}),(function(o,t,e){var r=e(114),n=Math.max,i=Math.min;o.exports=function(a,s){return a=r(a),a<0?n(a+s,0):i(a,s)}}),(function(o,t,e){var r=e(117)("keys"),n=e(118);o.exports=function(i){return r[i]||(r[i]=n(i))}}),(function(o,t,e){var r=e(92),n=e(91),i="__core-js_shared__",a=n[i]||(n[i]={});(o.exports=function(s,u){return a[s]||(a[s]=u!==void 0?u:{})})("versions",[]).push({version:r.version,mode:e(89)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})}),(function(o,t){var e=0,r=Math.random();o.exports=function(n){return"Symbol(".concat(n===void 0?"":n,")_",(++e+r).toString(36))}}),(function(o,t){o.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")}),(function(o,t,e){var r=e(91).document;o.exports=r&&r.documentElement}),(function(o,t,e){var r=e(96).f,n=e(105),i=e(122)("toStringTag");o.exports=function(a,s,u){a&&!n(a=u?a:a.prototype,i)&&r(a,i,{configurable:!0,value:s})}}),(function(o,t,e){var r=e(117)("wks"),n=e(118),i=e(91).Symbol,a=typeof i=="function",s=o.exports=function(u){return r[u]||(r[u]=a&&i[u]||(a?i:n)("Symbol."+u))};s.store=r}),(function(o,t,e){var r=e(105),n=e(124),i=e(116)("IE_PROTO"),a=Object.prototype;o.exports=Object.getPrototypeOf||function(s){return s=n(s),r(s,i)?s[i]:typeof s.constructor=="function"&&s instanceof s.constructor?s.constructor.prototype:s instanceof Object?a:null}}),(function(o,t,e){var r=e(87);o.exports=function(n){return Object(r(n))}}),(function(o,t,e){var r=e(126)(!0);e(88)(String,"String",function(n){this._t=String(n),this._i=0},function(){var n=this._t,i=this._i,a;return i>=n.length?{value:void 0,done:!0}:(a=r(n,i),this._i+=a.length,{value:a,done:!1})})}),(function(o,t,e){var r=e(114),n=e(87);o.exports=function(i){return function(a,s){var u=String(n(a)),d=r(s),M=u.length,c,v;return d<0||d>=M?i?"":void 0:(c=u.charCodeAt(d),c<55296||c>56319||d+1===M||(v=u.charCodeAt(d+1))<56320||v>57343?i?u.charAt(d):c:i?u.slice(d,d+2):(c-55296<<10)+(v-56320)+65536)}}}),(function(o,t,e){var r=e(128),n=e(122)("iterator"),i=e(83);o.exports=e(92).isIterable=function(a){var s=Object(a);return s[n]!==void 0||"@@iterator"in s||i.hasOwnProperty(r(s))}}),(function(o,t,e){var r=e(86),n=e(122)("toStringTag"),i=r((function(){return arguments})())=="Arguments",a=function(s,u){try{return s[u]}catch{}};o.exports=function(s){var u,d,M;return s===void 0?"Undefined":s===null?"Null":typeof(d=a(u=Object(s),n))=="string"?d:i?r(u):(M=r(u))=="Object"&&typeof u.callee=="function"?"Arguments":M}}),(function(o,t,e){o.exports={default:e(130),__esModule:!0}}),(function(o,t,e){e(79),e(125),o.exports=e(131)}),(function(o,t,e){var r=e(97),n=e(132);o.exports=e(92).getIterator=function(i){var a=n(i);if(typeof a!="function")throw TypeError(i+" is not iterable!");return r(a.call(i))}}),(function(o,t,e){var r=e(128),n=e(122)("iterator"),i=e(83);o.exports=e(92).getIteratorMethod=function(a){if(a!=null)return a[n]||a["@@iterator"]||i[r(a)]}}),(function(o,t,e){t.__esModule=!0;var r=e(134),n=i(r);function i(a){return a&&a.__esModule?a:{default:a}}t.default=function(a){if(Array.isArray(a)){for(var s=0,u=Array(a.length);s<a.length;s++)u[s]=a[s];return u}else return(0,n.default)(a)}}),(function(o,t,e){o.exports={default:e(135),__esModule:!0}}),(function(o,t,e){e(125),e(136),o.exports=e(92).Array.from}),(function(o,t,e){var r=e(93),n=e(90),i=e(124),a=e(137),s=e(138),u=e(113),d=e(139),M=e(132);n(n.S+n.F*!e(140)(function(c){Array.from(c)}),"Array",{from:function(v){var p=i(v),T=typeof this=="function"?this:Array,x=arguments.length,y=x>1?arguments[1]:void 0,C=y!==void 0,h=0,g=M(p),f,m,S,A;if(C&&(y=r(y,x>2?arguments[2]:void 0,2)),g!=null&&!(T==Array&&s(g)))for(A=g.call(p),m=new T;!(S=A.next()).done;h++)d(m,h,C?a(A,y,[S.value,h],!0):S.value);else for(f=u(p.length),m=new T(f);f>h;h++)d(m,h,C?y(p[h],h):p[h]);return m.length=h,m}})}),(function(o,t,e){var r=e(97);o.exports=function(n,i,a,s){try{return s?i(r(a)[0],a[1]):i(a)}catch(d){var u=n.return;throw u!==void 0&&r(u.call(n)),d}}}),(function(o,t,e){var r=e(83),n=e(122)("iterator"),i=Array.prototype;o.exports=function(a){return a!==void 0&&(r.Array===a||i[n]===a)}}),(function(o,t,e){var r=e(96),n=e(104);o.exports=function(i,a,s){a in i?r.f(i,a,n(0,s)):i[a]=s}}),(function(o,t,e){var r=e(122)("iterator"),n=!1;try{var i=[7][r]();i.return=function(){n=!0},Array.from(i,function(){throw 2})}catch{}o.exports=function(a,s){if(!s&&!n)return!1;var u=!1;try{var d=[7],M=d[r]();M.next=function(){return{done:u=!0}},d[r]=function(){return M},a(d)}catch{}return u}}),(function(o,t,e){o.exports={default:e(142),__esModule:!0}}),(function(o,t,e){e(143),e(125),e(79),e(144),e(157),e(160),e(162),o.exports=e(92).Map}),(function(o,t){}),(function(o,t,e){var r=e(145),n=e(151),i="Map";o.exports=e(152)(i,function(a){return function(){return a(this,arguments.length>0?arguments[0]:void 0)}},{get:function(s){var u=r.getEntry(n(this,i),s);return u&&u.v},set:function(s,u){return r.def(n(this,i),s===0?0:s,u)}},r,!0)}),(function(o,t,e){var r=e(96).f,n=e(108),i=e(146),a=e(93),s=e(147),u=e(148),d=e(88),M=e(82),c=e(149),v=e(100),p=e(150).fastKey,T=e(151),x=v?"_s":"size",y=function(C,h){var g=p(h),f;if(g!=="F")return C._i[g];for(f=C._f;f;f=f.n)if(f.k==h)return f};o.exports={getConstructor:function(C,h,g,f){var m=C(function(S,A){s(S,m,h,"_i"),S._t=h,S._i=n(null),S._f=void 0,S._l=void 0,S[x]=0,A!=null&&u(A,g,S[f],S)});return i(m.prototype,{clear:function(){for(var A=T(this,h),P=A._i,R=A._f;R;R=R.n)R.r=!0,R.p&&(R.p=R.p.n=void 0),delete P[R.i];A._f=A._l=void 0,A[x]=0},delete:function(S){var A=T(this,h),P=y(A,S);if(P){var R=P.n,D=P.p;delete A._i[P.i],P.r=!0,D&&(D.n=R),R&&(R.p=D),A._f==P&&(A._f=R),A._l==P&&(A._l=D),A[x]--}return!!P},forEach:function(A){T(this,h);for(var P=a(A,arguments.length>1?arguments[1]:void 0,3),R;R=R?R.n:this._f;)for(P(R.v,R.k,this);R&&R.r;)R=R.p},has:function(A){return!!y(T(this,h),A)}}),v&&r(m.prototype,"size",{get:function(){return T(this,h)[x]}}),m},def:function(C,h,g){var f=y(C,h),m,S;return f?f.v=g:(C._l=f={i:S=p(h,!0),k:h,v:g,p:m=C._l,n:void 0,r:!1},C._f||(C._f=f),m&&(m.n=f),C[x]++,S!=="F"&&(C._i[S]=f)),C},getEntry:y,setStrong:function(C,h,g){d(C,h,function(f,m){this._t=T(f,h),this._k=m,this._l=void 0},function(){for(var f=this,m=f._k,S=f._l;S&&S.r;)S=S.p;return!f._t||!(f._l=S=S?S.n:f._t._f)?(f._t=void 0,M(1)):m=="keys"?M(0,S.k):m=="values"?M(0,S.v):M(0,[S.k,S.v])},g?"entries":"values",!g,!0),c(h)}}}),(function(o,t,e){var r=e(95);o.exports=function(n,i,a){for(var s in i)a&&n[s]?n[s]=i[s]:r(n,s,i[s]);return n}}),(function(o,t){o.exports=function(e,r,n,i){if(!(e instanceof r)||i!==void 0&&i in e)throw TypeError(n+": incorrect invocation!");return e}}),(function(o,c,e){var r=e(93),n=e(137),i=e(138),a=e(97),s=e(113),u=e(132),d={},M={},c=o.exports=function(v,p,T,x,y){var C=y?function(){return v}:u(v),h=r(T,x,p?2:1),g=0,f,m,S,A;if(typeof C!="function")throw TypeError(v+" is not iterable!");if(i(C)){for(f=s(v.length);f>g;g++)if(A=p?h(a(m=v[g])[0],m[1]):h(v[g]),A===d||A===M)return A}else for(S=C.call(v);!(m=S.next()).done;)if(A=n(S,h,m.value,p),A===d||A===M)return A};c.BREAK=d,c.RETURN=M}),(function(o,t,e){var r=e(91),n=e(92),i=e(96),a=e(100),s=e(122)("species");o.exports=function(u){var d=typeof n[u]=="function"?n[u]:r[u];a&&d&&!d[s]&&i.f(d,s,{configurable:!0,get:function(){return this}})}}),(function(o,t,e){var r=e(118)("meta"),n=e(98),i=e(105),a=e(96).f,s=0,u=Object.isExtensible||function(){return!0},d=!e(101)(function(){return u(Object.preventExtensions({}))}),M=function(x){a(x,r,{value:{i:"O"+ ++s,w:{}}})},c=function(x,y){if(!n(x))return typeof x=="symbol"?x:(typeof x=="string"?"S":"P")+x;if(!i(x,r)){if(!u(x))return"F";if(!y)return"E";M(x)}return x[r].i},v=function(x,y){if(!i(x,r)){if(!u(x))return!0;if(!y)return!1;M(x)}return x[r].w},p=function(x){return d&&T.NEED&&u(x)&&!i(x,r)&&M(x),x},T=o.exports={KEY:r,NEED:!1,fastKey:c,getWeak:v,onFreeze:p}}),(function(o,t,e){var r=e(98);o.exports=function(n,i){if(!r(n)||n._t!==i)throw TypeError("Incompatible receiver, "+i+" required!");return n}}),(function(o,t,e){var r=e(91),n=e(90),i=e(150),a=e(101),s=e(95),u=e(146),d=e(148),M=e(147),c=e(98),v=e(121),p=e(96).f,T=e(153)(0),x=e(100);o.exports=function(y,C,h,g,f,m){var S=r[y],A=S,P=f?"set":"add",R=A&&A.prototype,D={};return!x||typeof A!="function"||!(m||R.forEach&&!a(function(){new A().entries().next()}))?(A=g.getConstructor(C,y,f,P),u(A.prototype,h),i.NEED=!0):(A=C(function(L,j){M(L,A,y,"_c"),L._c=new S,j!=null&&d(j,f,L[P],L)}),T("add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON".split(","),function(L){var j=L=="add"||L=="set";L in R&&!(m&&L=="clear")&&s(A.prototype,L,function(b,O){if(M(this,A,L),!j&&m&&!c(b))return L=="get"?void 0:!1;var Y=this._c[L](b===0?0:b,O);return j?this:Y})}),m||p(A.prototype,"size",{get:function(){return this._c.size}})),v(A,y),D[y]=A,n(n.G+n.W+n.F,D),m||g.setStrong(A,y,f),A}}),(function(o,t,e){var r=e(93),n=e(85),i=e(124),a=e(113),s=e(154);o.exports=function(u,d){var M=u==1,c=u==2,v=u==3,p=u==4,T=u==6,x=u==5||T,y=d||s;return function(C,h,g){for(var f=i(C),m=n(f),S=r(h,g,3),A=a(m.length),P=0,R=M?y(C,A):c?y(C,0):void 0,D,L;A>P;P++)if((x||P in m)&&(D=m[P],L=S(D,P,f),u)){if(M)R[P]=L;else if(L)switch(u){case 3:return!0;case 5:return D;case 6:return P;case 2:R.push(D)}else if(p)return!1}return T?-1:v||p?p:R}}}),(function(o,t,e){var r=e(155);o.exports=function(n,i){return new(r(n))(i)}}),(function(o,t,e){var r=e(98),n=e(156),i=e(122)("species");o.exports=function(a){var s;return n(a)&&(s=a.constructor,typeof s=="function"&&(s===Array||n(s.prototype))&&(s=void 0),r(s)&&(s=s[i],s===null&&(s=void 0))),s===void 0?Array:s}}),(function(o,t,e){var r=e(86);o.exports=Array.isArray||function(i){return r(i)=="Array"}}),(function(o,t,e){var r=e(90);r(r.P+r.R,"Map",{toJSON:e(158)("Map")})}),(function(o,t,e){var r=e(128),n=e(159);o.exports=function(i){return function(){if(r(this)!=i)throw TypeError(i+"#toJSON isn't generic");return n(this)}}}),(function(o,t,e){var r=e(148);o.exports=function(n,i){var a=[];return r(n,!1,a.push,a,i),a}}),(function(o,t,e){e(161)("Map")}),(function(o,t,e){var r=e(90);o.exports=function(n){r(r.S,n,{of:function(){for(var a=arguments.length,s=new Array(a);a--;)s[a]=arguments[a];return new this(s)}})}}),(function(o,t,e){e(163)("Map")}),(function(o,t,e){var r=e(90),n=e(94),i=e(93),a=e(148);o.exports=function(s){r(r.S,s,{from:function(d){var M=arguments[1],c,v,p,T;return n(this),c=M!==void 0,c&&n(M),d==null?new this:(v=[],c?(p=0,T=i(M,arguments[2],2),a(d,!1,function(x){v.push(T(x,p++))})):a(d,!1,v.push,v),new this(v))}})}}),(function(o,t,e){o.exports={default:e(165),__esModule:!0}}),(function(o,t,e){e(166),o.exports=e(92).Object.assign}),(function(o,t,e){var r=e(90);r(r.S+r.F,"Object",{assign:e(167)})}),(function(o,t,e){var r=e(100),n=e(110),i=e(168),a=e(169),s=e(124),u=e(85),d=Object.assign;o.exports=!d||e(101)(function(){var M={},c={},v=Symbol(),p="abcdefghijklmnopqrst";return M[v]=7,p.split("").forEach(function(T){c[T]=T}),d({},M)[v]!=7||Object.keys(d({},c)).join("")!=p})?function(c,v){for(var p=s(c),T=arguments.length,x=1,y=i.f,C=a.f;T>x;)for(var h=u(arguments[x++]),g=y?n(h).concat(y(h)):n(h),f=g.length,m=0,S;f>m;)S=g[m++],(!r||C.call(h,S))&&(p[S]=h[S]);return p}:d}),(function(o,t){t.f=Object.getOwnPropertySymbols}),(function(o,t){t.f={}.propertyIsEnumerable}),(function(o,t,e){t.__esModule=!0,t.default=function(r,n){if(!(r instanceof n))throw new TypeError("Cannot call a class as a function")}}),(function(o,t,e){t.__esModule=!0;var r=e(172),n=i(r);function i(a){return a&&a.__esModule?a:{default:a}}t.default=(function(){function a(s,u){for(var d=0;d<u.length;d++){var M=u[d];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),(0,n.default)(s,M.key,M)}}return function(s,u,d){return u&&a(s.prototype,u),d&&a(s,d),s}})()}),(function(o,t,e){o.exports={default:e(173),__esModule:!0}}),(function(o,t,e){e(174);var r=e(92).Object;o.exports=function(i,a,s){return r.defineProperty(i,a,s)}}),(function(o,t,e){var r=e(90);r(r.S+r.F*!e(100),"Object",{defineProperty:e(96).f})}),(function(o,t,e){o.exports={default:e(176),__esModule:!0}}),(function(o,t,e){e(177),e(143),e(184),e(185),o.exports=e(92).Symbol}),(function(o,t,e){var r=e(91),n=e(105),i=e(100),a=e(90),s=e(106),u=e(150).KEY,d=e(101),M=e(117),c=e(121),v=e(118),p=e(122),T=e(178),x=e(179),y=e(180),C=e(156),h=e(97),g=e(98),f=e(124),m=e(84),S=e(103),A=e(104),P=e(108),R=e(181),D=e(183),L=e(168),j=e(96),b=e(110),O=D.f,Y=j.f,X=R.f,Z=r.Symbol,$=r.JSON,rt=$&&$.stringify,F="prototype",Q=p("_hidden"),tt=p("toPrimitive"),lt={}.propertyIsEnumerable,ct=M("symbol-registry"),Mt=M("symbols"),st=M("op-symbols"),Tt=Object[F],xt=typeof Z=="function"&&!!L.f,W=r.QObject,k=!W||!W[F]||!W[F].findChild,q=i&&d(function(){return P(Y({},"a",{get:function(){return Y(this,"a",{value:7}).a}})).a!=7})?function(vt,mt,It){var wt=O(Tt,mt);wt&&delete Tt[mt],Y(vt,mt,It),wt&&vt!==Tt&&Y(Tt,mt,wt)}:Y,_=function(vt){var mt=Mt[vt]=P(Z[F]);return mt._k=vt,mt},U=xt&&typeof Z.iterator=="symbol"?function(vt){return typeof vt=="symbol"}:function(vt){return vt instanceof Z},H=function(mt,It,wt){return mt===Tt&&H(st,It,wt),h(mt),It=S(It,!0),h(wt),n(Mt,It)?(wt.enumerable?(n(mt,Q)&&mt[Q][It]&&(mt[Q][It]=!1),wt=P(wt,{enumerable:A(0,!1)})):(n(mt,Q)||Y(mt,Q,A(1,{})),mt[Q][It]=!0),q(mt,It,wt)):Y(mt,It,wt)},E=function(mt,It){h(mt);for(var wt=y(It=m(It)),bt=0,Nt=wt.length,Yt;Nt>bt;)H(mt,Yt=wt[bt++],It[Yt]);return mt},w=function(mt,It){return It===void 0?P(mt):E(P(mt),It)},B=function(mt){var It=lt.call(this,mt=S(mt,!0));return this===Tt&&n(Mt,mt)&&!n(st,mt)?!1:It||!n(this,mt)||!n(Mt,mt)||n(this,Q)&&this[Q][mt]?It:!0},G=function(mt,It){if(mt=m(mt),It=S(It,!0),!(mt===Tt&&n(Mt,It)&&!n(st,It))){var wt=O(mt,It);return wt&&n(Mt,It)&&!(n(mt,Q)&&mt[Q][It])&&(wt.enumerable=!0),wt}},K=function(mt){for(var It=X(m(mt)),wt=[],bt=0,Nt;It.length>bt;)!n(Mt,Nt=It[bt++])&&Nt!=Q&&Nt!=u&&wt.push(Nt);return wt},et=function(mt){for(var It=mt===Tt,wt=X(It?st:m(mt)),bt=[],Nt=0,Yt;wt.length>Nt;)n(Mt,Yt=wt[Nt++])&&(!It||n(Tt,Yt))&&bt.push(Mt[Yt]);return bt};xt||(Z=function(){if(this instanceof Z)throw TypeError("Symbol is not a constructor!");var mt=v(arguments.length>0?arguments[0]:void 0),It=function(wt){this===Tt&&It.call(st,wt),n(this,Q)&&n(this[Q],mt)&&(this[Q][mt]=!1),q(this,mt,A(1,wt))};return i&&k&&q(Tt,mt,{configurable:!0,set:It}),_(mt)},s(Z[F],"toString",function(){return this._k}),D.f=G,j.f=H,e(182).f=R.f=K,e(169).f=B,L.f=et,i&&!e(89)&&s(Tt,"propertyIsEnumerable",B,!0),T.f=function(vt){return _(p(vt))}),a(a.G+a.W+a.F*!xt,{Symbol:Z});for(var at="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ut=0;at.length>ut;)p(at[ut++]);for(var gt=b(p.store),yt=0;gt.length>yt;)x(gt[yt++]);a(a.S+a.F*!xt,"Symbol",{for:function(vt){return n(ct,vt+="")?ct[vt]:ct[vt]=Z(vt)},keyFor:function(mt){if(!U(mt))throw TypeError(mt+" is not a symbol!");for(var It in ct)if(ct[It]===mt)return It},useSetter:function(){k=!0},useSimple:function(){k=!1}}),a(a.S+a.F*!xt,"Object",{create:w,defineProperty:H,defineProperties:E,getOwnPropertyDescriptor:G,getOwnPropertyNames:K,getOwnPropertySymbols:et});var Ct=d(function(){L.f(1)});a(a.S+a.F*Ct,"Object",{getOwnPropertySymbols:function(mt){return L.f(f(mt))}}),$&&a(a.S+a.F*(!xt||d(function(){var vt=Z();return rt([vt])!="[null]"||rt({a:vt})!="{}"||rt(Object(vt))!="{}"})),"JSON",{stringify:function(mt){for(var It=[mt],wt=1,bt,Nt;arguments.length>wt;)It.push(arguments[wt++]);if(Nt=bt=It[1],!(!g(bt)&&mt===void 0||U(mt)))return C(bt)||(bt=function(Yt,$t){if(typeof Nt=="function"&&($t=Nt.call(this,Yt,$t)),!U($t))return $t}),It[1]=bt,rt.apply($,It)}}),Z[F][tt]||e(95)(Z[F],tt,Z[F].valueOf),c(Z,"Symbol"),c(Math,"Math",!0),c(r.JSON,"JSON",!0)}),(function(o,t,e){t.f=e(122)}),(function(o,t,e){var r=e(91),n=e(92),i=e(89),a=e(178),s=e(96).f;o.exports=function(u){var d=n.Symbol||(n.Symbol=i?{}:r.Symbol||{});u.charAt(0)!="_"&&!(u in d)&&s(d,u,{value:a.f(u)})}}),(function(o,t,e){var r=e(110),n=e(168),i=e(169);o.exports=function(a){var s=r(a),u=n.f;if(u)for(var d=u(a),M=i.f,c=0,v;d.length>c;)M.call(a,v=d[c++])&&s.push(v);return s}}),(function(o,t,e){var r=e(84),n=e(182).f,i={}.toString,a=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],s=function(u){try{return n(u)}catch{return a.slice()}};o.exports.f=function(d){return a&&i.call(d)=="[object Window]"?s(d):n(r(d))}}),(function(o,t,e){var r=e(111),n=e(119).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(a){return r(a,n)}}),(function(o,t,e){var r=e(169),n=e(104),i=e(84),a=e(103),s=e(105),u=e(99),d=Object.getOwnPropertyDescriptor;t.f=e(100)?d:function(c,v){if(c=i(c),v=a(v,!0),u)try{return d(c,v)}catch{}if(s(c,v))return n(!r.f.call(c,v),c[v])}}),(function(o,t,e){e(179)("asyncIterator")}),(function(o,t,e){e(179)("observable")}),(function(o,t,e){Object.defineProperty(t,"__esModule",{value:!0}),t.createNowTime=r,t.formatDelay=n;function r(){var i=null;return Date.now?i=Date.now:i=function(){return new Date().getTime()},i}function n(i){return typeof i=="number"?i={delay:i}:"entropy"in i&&(i={delay:i.entropy,isEntropy:!0}),i}}),(function(o,t,e){Object.defineProperty(t,"__esModule",{value:!0}),t.default={default:function(n,i,a,s,u){return typeof n=="number"&&typeof i=="number"?n+(a-s)/(u-s)*(i-n):a-s>u-a?i:n}}}),(function(o,t,e){Object.defineProperty(t,"__esModule",{value:!0}),t.parseEasing=t.Easings=void 0;var r=e(76),n=d(r),i=e(133),a=d(i),s=e(141),u=d(s);function d(C){return C&&C.__esModule?C:{default:C}}var M=e(189),c=new u.default;function v(){for(var C=arguments.length,h=Array(C),g=0;g<C;g++)h[g]=arguments[g];var f=c.get(h);return f||(f=M.apply(void 0,h),c.set(h,f),f)}function p(C){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"end";return function(g,f){for(var m=1;m<f.length;m++){var S=f[m].offset;if(g<=S){var A=f[m-1].offset,P=S,R=(g-A)/(P-A),D=1/C,L=R/D;return h==="end"?L=Math.floor(L):L=Math.ceil(L),D*L*(P-A)+A}}return 0}}function T(C){var h=/^cubic-bezier\((.*)\)/,g=C.match(h);if(g){var f=g[1].trim();return f=f.split(",").map(function(D){return parseFloat(D.trim())}),v.apply(void 0,(0,a.default)(f))}if(h=/^steps\((.*)\)/,g=C.match(h),g){var m=g[1].trim();m=m.split(",").map(function(D){return D.trim()});var S=m,A=(0,n.default)(S,2),P=A[0],R=A[1];return p(parseInt(P,10),R)}return C}var x={linear:function(h){return h},ease:v(.25,.1,.25,1),"ease-in":v(.42,0,1,1),"ease-out":v(0,0,.58,1),"ease-in-out":v(.42,0,.58,1),"step-start":p(1,"start"),"step-end":p(1,"end")};function y(C){return typeof C=="string"?x[C]?C=x[C]:C=T(C):C.type==="cubic-bezier"?C=v.apply(void 0,(0,a.default)(C.value)):C.type==="steps"&&(C=p(C.step,C.pos)),C}t.Easings=x,t.parseEasing=y}),(function(o,t){var e=4,r=.001,n=1e-7,i=10,a=11,s=1/(a-1),u=typeof Float32Array=="function";function d(C,h){return 1-3*h+3*C}function M(C,h){return 3*h-6*C}function c(C){return 3*C}function v(C,h,g){return((d(h,g)*C+M(h,g))*C+c(h))*C}function p(C,h,g){return 3*d(h,g)*C*C+2*M(h,g)*C+c(h)}function T(C,h,g,f,m){var S,A,P=0;do A=h+(g-h)/2,S=v(A,f,m)-C,S>0?g=A:h=A;while(Math.abs(S)>n&&++P<i);return A}function x(C,h,g,f){for(var m=0;m<e;++m){var S=p(h,g,f);if(S===0)return h;var A=v(h,g,f)-C;h-=A/S}return h}function y(C){return C}o.exports=function(h,g,f,m){if(!(0<=h&&h<=1&&0<=f&&f<=1))throw new Error("bezier x values must be in [0, 1] range");if(h===g&&f===m)return y;for(var S=u?new Float32Array(a):new Array(a),A=0;A<a;++A)S[A]=v(A*s,h,f);function P(R){for(var D=0,L=1,j=a-1;L!==j&&S[L]<=R;++L)D+=s;--L;var b=(R-S[L])/(S[L+1]-S[L]),O=D+b*s,Y=p(O,h,f);return Y>=r?x(R,O,h,f):Y===0?O:T(R,D,D+s,h,f)}return function(D){return D===0?0:D===1?1:v(P(D),g,m)}}}),(function(o,t,e){Object.defineProperty(t,"__esModule",{value:!0});var r=e(191),n=g(r),i=e(204),a=g(i),s=e(164),u=g(s),d=e(170),M=g(d),c=e(171),v=g(c),p=e(175),T=g(p),x=e(75),y=g(x),C=e(208),h=e(188);function g(Y){return Y&&Y.__esModule?Y:{default:Y}}var f=(0,T.default)("timing"),m=(0,T.default)("keyframes"),S=(0,T.default)("initState"),A=(0,T.default)("readyDefer"),P=(0,T.default)("finishedDefer"),R=(0,T.default)("effects"),D=(0,T.default)("activeReadyTimer"),L=(0,T.default)("activeFinishTimer"),j=(0,T.default)("removeDefer"),b={delay:0,endDelay:0,fill:"auto",iterations:1,playbackRate:1,direction:"normal",easing:"linear",effect:null},O=(function(){function Y(X,Z,$){var rt=this;if((0,M.default)(this,Y),Array.isArray(X)){var F=[X[0],X,Z];X=F[0],Z=F[1],$=F[2]}typeof $=="number"&&($={duration:$}),this[f]=(0,u.default)({},b,$),this[f].easing=(0,h.parseEasing)(this[f].easing),this[m]=(0,C.calculateFramesOffset)(Z);var Q=this[m][this[m].length-1];this[S]={},(0,a.default)(Q).forEach(function(tt){Object.prototype.hasOwnProperty.call(X,tt)&&tt!=="easing"&&tt!=="offset"&&(rt[S][tt]=X[tt])}),this[m]=this[m].map(function(tt){return(0,u.default)({},rt[S],tt)}),this[m][0].offset!==0&&this[m].unshift((0,u.default)({},this[S],{offset:0})),Q.offset<1&&this[m].push((0,u.default)({},Q,{offset:1})),this[R]={},this.timeline=null}return(0,v.default)(Y,[{key:"pause",value:function(){this.timeline.playbackRate=0}},{key:D,value:function(){var Z=this;this[A]&&!this[A].timerID&&(this.timeline.currentTime<0?this[A].timerID=this.timeline.setTimeout(function(){Z[A].resolve(),delete Z[A]},{delay:-this.timeline.currentTime,heading:!1}):this[A].timerID=this.timeline.setTimeout(function(){Z[A].resolve(),delete Z[A]},{delay:0,isEntropy:!0}))}},{key:L,value:function(){var Z=this,$=this[f],rt=$.duration,F=$.iterations,Q=$.endDelay,tt=Math.ceil(rt*F+Q-this.timeline.currentTime)+1;this[P]&&!this[P].timerID&&(this[P].timerID=this.timeline.setTimeout(function(){Z[P].resolve(),Z[j](A),Z[j](P)},{delay:tt,heading:!1}),this[P].reverseTimerID=this.timeline.setTimeout(function(){Z[P].resolve(),Z[j](A),Z[j](P),Z.timeline=null},{delay:-this[f].delay-1,heading:!1}))}},{key:"play",value:function(){if(this.playState==="finished"&&this.cancel(),this.playState==="idle"){if(this.playbackRate<=0)return;var Z=this[f],$=Z.delay,rt=Z.playbackRate,F=Z.timeline;this.timeline=new y.default({originTime:$,playbackRate:rt},F),this[D](),this[L]()}else this.playState==="paused"&&(this.timeline.playbackRate=this.playbackRate,this[D]())}},{key:j,value:function(Z){var $=this[Z],rt=this.timeline;$&&rt&&(rt.clearTimeout($.timerID),$.reverseTimerID&&rt.clearTimeout($.reverseTimerID)),delete this[Z]}},{key:"cancel",value:function(){this[j](A),this[j](P),this.timeline=null}},{key:"finish",value:function(){this.timeline&&(this.timeline.currentTime=1/0/this.playbackRate),this[j](A),this[j](P)}},{key:"applyEffects",value:function(Z){return(0,u.default)(this[R],Z)}},{key:"playbackRate",get:function(){return this[f].playbackRate},set:function(Z){this.timeline&&(this.timeline.playbackRate=Z),this[f].playbackRate=Z}},{key:"playState",get:function(){var Z=this.timeline,$=this[f],rt=$.iterations,F=$.duration,Q=$.endDelay,tt="running";if(Z==null)tt="idle";else if(Z.paused)tt="paused";else if(Z.currentTime<0)tt="pending";else{var lt=Z.currentTime-rt*F;lt>0&<<Q?tt="pending":lt>=Q&&(tt="finished")}return tt}},{key:"progress",get:function(){if(!this.timeline)return 0;var Z=this[f],$=Z.duration,rt=Z.iterations,F=this.timeline,Q=this.playState,tt=void 0;if(Q==="idle")tt=0;else if(Q==="paused"&&F.currentTime<0)tt=0;else if(Q==="pending")if(F.currentTime<0)tt=0;else{var lt=F.seekLocalTime(rt*$);tt=(0,C.periodicity)(lt,$)[1]/$}else(Q==="running"||Q==="paused")&&(tt=(0,C.periodicity)(F.currentTime,$)[1]/$);return Q==="finished"&&(tt=(0,C.periodicity)(rt,1)[1]),tt}},{key:"frame",get:function(){var Z=this.playState,$=this[S],rt=this[f].fill;if(Z==="idle")return $;var F=this.timeline.currentTime,Q=this[m].slice(0),tt=(0,C.getProgress)(this.timeline,this[f],this.progress),lt=tt.p,ct=tt.inverted,Mt=$;return F<0&&Z==="pending"?(rt==="backwards"||rt==="both")&&(Mt=ct?Q[Q.length-1]:Q[0]):(Z!=="pending"&&Z!=="finished"||rt==="forwards"||rt==="both")&&(Mt=(0,C.getCurrentFrame)(this[f],Q,this[R],lt)),Mt}},{key:"timing",get:function(){return this[f]}},{key:"effects",get:function(){return this[R]}},{key:"baseTimeline",set:function(Z){this[f].timeline=Z},get:function(){return this[f].timeline}},{key:"ready",get:function(){return this[A]?this[A].promise:this.timeline&&this.timeline.currentTime>=0&&this.playState!=="paused"?n.default.resolve():(this[A]=(0,C.defer)(),this.timeline&&this[D](),this[A]?this[A].promise:n.default.resolve())}},{key:"finished",get:function(){return this.playState==="finished"?n.default.resolve():(this[P]||(this[P]=(0,C.defer)(),this.timeline&&this[L]()),this[P].promise)}}]),Y})();t.default=O}),(function(o,t,e){o.exports={default:e(192),__esModule:!0}}),(function(o,t,e){e(143),e(125),e(79),e(193),e(202),e(203),o.exports=e(92).Promise}),(function(o,t,e){var r=e(89),n=e(91),i=e(93),a=e(128),s=e(90),u=e(98),d=e(94),M=e(147),c=e(148),v=e(194),p=e(195).set,T=e(197)(),x=e(198),y=e(199),C=e(200),h=e(201),g="Promise",f=n.TypeError,m=n.process,S=m&&m.versions,A=S&&S.v8||"",P=n[g],R=a(m)=="process",D=function(){},L,j,b,O,Y=j=x.f,X=!!(function(){try{var ct=P.resolve(1),Mt=(ct.constructor={})[e(122)("species")]=function(st){st(D,D)};return(R||typeof PromiseRejectionEvent=="function")&&ct.then(D)instanceof Mt&&A.indexOf("6.6")!==0&&C.indexOf("Chrome/66")===-1}catch{}})(),Z=function(ct){var Mt;return u(ct)&&typeof(Mt=ct.then)=="function"?Mt:!1},$=function(ct,Mt){if(!ct._n){ct._n=!0;var st=ct._c;T(function(){for(var Tt=ct._v,xt=ct._s==1,W=0,k=function(q){var _=xt?q.ok:q.fail,U=q.resolve,H=q.reject,E=q.domain,w,B,G;try{_?(xt||(ct._h==2&&Q(ct),ct._h=1),_===!0?w=Tt:(E&&E.enter(),w=_(Tt),E&&(E.exit(),G=!0)),w===q.promise?H(f("Promise-chain cycle")):(B=Z(w))?B.call(w,U,H):U(w)):H(Tt)}catch(K){E&&!G&&E.exit(),H(K)}};st.length>W;)k(st[W++]);ct._c=[],ct._n=!1,Mt&&!ct._h&&rt(ct)})}},rt=function(ct){p.call(n,function(){var Mt=ct._v,st=F(ct),Tt,xt,W;if(st&&(Tt=y(function(){R?m.emit("unhandledRejection",Mt,ct):(xt=n.onunhandledrejection)?xt({promise:ct,reason:Mt}):(W=n.console)&&W.error&&W.error("Unhandled promise rejection",Mt)}),ct._h=R||F(ct)?2:1),ct._a=void 0,st&&Tt.e)throw Tt.v})},F=function(ct){return ct._h!==1&&(ct._a||ct._c).length===0},Q=function(ct){p.call(n,function(){var Mt;R?m.emit("rejectionHandled",ct):(Mt=n.onrejectionhandled)&&Mt({promise:ct,reason:ct._v})})},tt=function(ct){var Mt=this;Mt._d||(Mt._d=!0,Mt=Mt._w||Mt,Mt._v=ct,Mt._s=2,Mt._a||(Mt._a=Mt._c.slice()),$(Mt,!0))},lt=function(ct){var Mt=this,st;if(!Mt._d){Mt._d=!0,Mt=Mt._w||Mt;try{if(Mt===ct)throw f("Promise can't be resolved itself");(st=Z(ct))?T(function(){var Tt={_w:Mt,_d:!1};try{st.call(ct,i(lt,Tt,1),i(tt,Tt,1))}catch(xt){tt.call(Tt,xt)}}):(Mt._v=ct,Mt._s=1,$(Mt,!1))}catch(Tt){tt.call({_w:Mt,_d:!1},Tt)}}};X||(P=function(Mt){M(this,P,g,"_h"),d(Mt),L.call(this);try{Mt(i(lt,this,1),i(tt,this,1))}catch(st){tt.call(this,st)}},L=function(Mt){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},L.prototype=e(146)(P.prototype,{then:function(Mt,st){var Tt=Y(v(this,P));return Tt.ok=typeof Mt=="function"?Mt:!0,Tt.fail=typeof st=="function"&&st,Tt.domain=R?m.domain:void 0,this._c.push(Tt),this._a&&this._a.push(Tt),this._s&&$(this,!1),Tt.promise},catch:function(ct){return this.then(void 0,ct)}}),b=function(){var ct=new L;this.promise=ct,this.resolve=i(lt,ct,1),this.reject=i(tt,ct,1)},x.f=Y=function(ct){return ct===P||ct===O?new b(ct):j(ct)}),s(s.G+s.W+s.F*!X,{Promise:P}),e(121)(P,g),e(149)(g),O=e(92)[g],s(s.S+s.F*!X,g,{reject:function(Mt){var st=Y(this),Tt=st.reject;return Tt(Mt),st.promise}}),s(s.S+s.F*(r||!X),g,{resolve:function(Mt){return h(r&&this===O?P:this,Mt)}}),s(s.S+s.F*!(X&&e(140)(function(ct){P.all(ct).catch(D)})),g,{all:function(Mt){var st=this,Tt=Y(st),xt=Tt.resolve,W=Tt.reject,k=y(function(){var q=[],_=0,U=1;c(Mt,!1,function(H){var E=_++,w=!1;q.push(void 0),U++,st.resolve(H).then(function(B){w||(w=!0,q[E]=B,--U||xt(q))},W)}),--U||xt(q)});return k.e&&W(k.v),Tt.promise},race:function(Mt){var st=this,Tt=Y(st),xt=Tt.reject,W=y(function(){c(Mt,!1,function(k){st.resolve(k).then(Tt.resolve,xt)})});return W.e&&xt(W.v),Tt.promise}})}),(function(o,t,e){var r=e(97),n=e(94),i=e(122)("species");o.exports=function(a,s){var u=r(a).constructor,d;return u===void 0||(d=r(u)[i])==null?s:n(d)}}),(function(o,t,e){var r=e(93),n=e(196),i=e(120),a=e(102),s=e(91),u=s.process,d=s.setImmediate,M=s.clearImmediate,c=s.MessageChannel,v=s.Dispatch,p=0,T={},x="onreadystatechange",y,C,h,g=function(){var m=+this;if(T.hasOwnProperty(m)){var S=T[m];delete T[m],S()}},f=function(m){g.call(m.data)};(!d||!M)&&(d=function(S){for(var A=[],P=1;arguments.length>P;)A.push(arguments[P++]);return T[++p]=function(){n(typeof S=="function"?S:Function(S),A)},y(p),p},M=function(S){delete T[S]},e(86)(u)=="process"?y=function(m){u.nextTick(r(g,m,1))}:v&&v.now?y=function(m){v.now(r(g,m,1))}:c?(C=new c,h=C.port2,C.port1.onmessage=f,y=r(h.postMessage,h,1)):s.addEventListener&&typeof postMessage=="function"&&!s.importScripts?(y=function(m){s.postMessage(m+"","*")},s.addEventListener("message",f,!1)):x in a("script")?y=function(m){i.appendChild(a("script"))[x]=function(){i.removeChild(this),g.call(m)}}:y=function(m){setTimeout(r(g,m,1),0)}),o.exports={set:d,clear:M}}),(function(o,t){o.exports=function(e,r,n){var i=n===void 0;switch(r.length){case 0:return i?e():e.call(n);case 1:return i?e(r[0]):e.call(n,r[0]);case 2:return i?e(r[0],r[1]):e.call(n,r[0],r[1]);case 3:return i?e(r[0],r[1],r[2]):e.call(n,r[0],r[1],r[2]);case 4:return i?e(r[0],r[1],r[2],r[3]):e.call(n,r[0],r[1],r[2],r[3])}return e.apply(n,r)}}),(function(o,t,e){var r=e(91),n=e(195).set,i=r.MutationObserver||r.WebKitMutationObserver,a=r.process,s=r.Promise,u=e(86)(a)=="process";o.exports=function(){var d,M,c,v=function(){var y,C;for(u&&(y=a.domain)&&y.exit();d;){C=d.fn,d=d.next;try{C()}catch(h){throw d?c():M=void 0,h}}M=void 0,y&&y.enter()};if(u)c=function(){a.nextTick(v)};else if(i&&!(r.navigator&&r.navigator.standalone)){var p=!0,T=document.createTextNode("");new i(v).observe(T,{characterData:!0}),c=function(){T.data=p=!p}}else if(s&&s.resolve){var x=s.resolve(void 0);c=function(){x.then(v)}}else c=function(){n.call(r,v)};return function(y){var C={fn:y,next:void 0};M&&(M.next=C),d||(d=C,c()),M=C}}}),(function(o,t,e){var r=e(94);function n(i){var a,s;this.promise=new i(function(u,d){if(a!==void 0||s!==void 0)throw TypeError("Bad Promise constructor");a=u,s=d}),this.resolve=r(a),this.reject=r(s)}o.exports.f=function(i){return new n(i)}}),(function(o,t){o.exports=function(e){try{return{e:!1,v:e()}}catch(r){return{e:!0,v:r}}}}),(function(o,t,e){var r=e(91),n=r.navigator;o.exports=n&&n.userAgent||""}),(function(o,t,e){var r=e(97),n=e(98),i=e(198);o.exports=function(a,s){if(r(a),n(s)&&s.constructor===a)return s;var u=i.f(a),d=u.resolve;return d(s),u.promise}}),(function(o,t,e){var r=e(90),n=e(92),i=e(91),a=e(194),s=e(201);r(r.P+r.R,"Promise",{finally:function(u){var d=a(this,n.Promise||i.Promise),M=typeof u=="function";return this.then(M?function(c){return s(d,u()).then(function(){return c})}:u,M?function(c){return s(d,u()).then(function(){throw c})}:u)}})}),(function(o,t,e){var r=e(90),n=e(198),i=e(199);r(r.S,"Promise",{try:function(a){var s=n.f(this),u=i(a);return(u.e?s.reject:s.resolve)(u.v),s.promise}})}),(function(o,t,e){o.exports={default:e(205),__esModule:!0}}),(function(o,t,e){e(206),o.exports=e(92).Object.keys}),(function(o,t,e){var r=e(124),n=e(110);e(207)("keys",function(){return function(a){return n(r(a))}})}),(function(o,t,e){var r=e(90),n=e(92),i=e(101);o.exports=function(a,s){var u=(n.Object||{})[a]||Object[a],d={};d[a]=s(u),r(r.S+r.F*i(function(){u(1)}),"Object",d)}}),(function(o,t,e){Object.defineProperty(t,"__esModule",{value:!0});var r=e(76),n=T(r),i=e(209),a=T(i),s=e(164),u=T(s),d=e(191),M=T(d);t.defer=x,t.periodicity=y,t.calculateFramesOffset=C,t.getProgress=h,t.getCurrentFrame=f;var c=e(188),v=e(187),p=T(v);function T(m){return m&&m.__esModule?m:{default:m}}function x(){var m={};return m.promise=new M.default(function(S,A){m.resolve=S,m.reject=A}),m}function y(m,S){var A=Math.floor(m/S),P=m-A*S;return P===0&&A>0&&(P=S,A--),[A,P]}function C(m){m=m.slice(0);var S=m[0],A=m[m.length-1];A.offset=A.offset||1,S.offset=S.offset||0;for(var P=0,R=-1,D=0;D<m.length;D++){var L=m[D];if(L.offset!=null){var j=D-R;if(j>1)for(var b=(L.offset-P)/j,O=0;O<j-1;O++)m[R+O+1].offset=P+b*(O+1);P=L.offset,R=D}if(L.easing!=null&&(L.easing=(0,c.parseEasing)(L.easing)),D>0){var Y=m[D].easing!=null;m[D]=(0,u.default)({},m[D-1],m[D]),Y||delete m[D].easing}}return m}function h(m,S,A){var P=m.currentTime,R=S.direction,D=S.duration,L=!1;if(R==="reverse")A=1-A,L=!0;else if(R==="alternate"||R==="alternate-reverse"){var j=Math.floor(P/D);A===1&&j--,j%2^R==="alternate-reverse"&&(A=1-A,L=!0)}return{p:A,inverted:L}}function g(m,S,A,P){var R={};return(0,a.default)(S).forEach(function(D){var L=(0,n.default)(D,2),j=L[0],b=L[1];if(j!=="offset"&&j!=="easing"){var O=A[j]||A.default,Y=O(m[j],b,P,m.offset,S.offset);Y!=null&&(R[j]=Y)}}),R}function f(m,S,A,P){var R=m.easing,D=m.effect;D||(A=(0,u.default)({},p.default,A));var L={};P=R(P,S);for(var j=1;j<S.length;j++){var b=S[j],O=b.offset;if(O>=P||j===S.length-1){var Y=S[j-1],X=Y.offset,Z=Y.easing,$=P;if(Z){var rt=O-X;$=Z((P-X)/rt)*rt+X}D?L=D(Y,b,$,X,O):L=g(Y,b,A,$);break}}return L}}),(function(o,t,e){o.exports={default:e(210),__esModule:!0}}),(function(o,t,e){e(211),o.exports=e(92).Object.entries}),(function(o,t,e){var r=e(90),n=e(212)(!0);r(r.S,"Object",{entries:function(a){return n(a)}})}),(function(o,t,e){var r=e(100),n=e(110),i=e(84),a=e(169).f;o.exports=function(s){return function(u){for(var d=i(u),M=n(d),c=M.length,v=0,p=[],T;c>v;)T=M[v++],(!r||a.call(d,T))&&p.push(s?[T,d[T]]:d[T]);return p}}}),(function(o,t,e){e.r(t),e(1).glMatrix.setMatrixArrayType(Array);const r=new Map;function n(a,s={},u=[]){a=a.toLowerCase();const d=r.get(a);if(!d)throw new TypeError(`Invalid node: ${a}`);const M=new d(s);return u.forEach(c=>{M.appendChild(c)}),M}const i={registerNode(a,s,u=100){if(s=s.toLowerCase(),r.has(s))throw new TypeError(`Cannot registerNode, ${s} has been taken.`);r.set(s,a),Object.defineProperties(a.prototype,{nodeType:{value:u},tagName:{value:s.toUpperCase()},nodeName:{value:s},ownerDocument:{value:i},namespaceURI:{value:`http://spritejs.com/${s}`}})},createElement:n,createElementNS(a,s){return n(s)},isSpriteNode(a){return r.has(a.toLowerCase())}};t.default=i}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return s}),e(1).glMatrix.setMatrixArrayType(Array);const r=Symbol("type"),n=Symbol("bubbles"),i=Symbol("originalEvent"),a=Symbol("detail");class s{constructor(d,{bubbles:M=null}={}){if(typeof d=="string"?(this[r]=d,this[n]=!!M):(this[r]=d.type,this[i]=d,this[n]=M!=null?!!M:!!d.bubbles,d.detail&&(this[a]=d.detail)),!this[r])throw new TypeError("Invalid event type.");this.cancelBubble=!1}setOriginalEvent(d){this[i]=d}get originalEvent(){return this[i]}get type(){return this[r]}get bubbles(){return this[n]}get detail(){return this[a]}stopPropagation(){this.cancelBubble=!0}}}),(function(o,t,e){e.r(t),e.d(t,"parseFilterString",function(){return n}),e.d(t,"applyFilters",function(){return i});var r=e(72);e(1).glMatrix.setMatrixArrayType(Array);function n(a){if(a=a.trim(),!a||a==="none")return null;const s=/^(?:(url|blur|brightness|contrast|drop-shadow|grayscale|hue-rotate|invert|opacity|saturate|sepia)\(([^()]*(?:\(.*\))*[^()]*)\))+$/i,u=a.match(/(?:(url|blur|brightness|contrast|drop-shadow|grayscale|hue-rotate|invert|opacity|saturate|sepia)\(([^()]*(?:\(.*\))*[^()]*)\))+?/ig),d=[];return u&&u.forEach(M=>{const c=M.match(s);if(!c)throw new TypeError("Invalid fitler string.");let[,v,p]=c;v=v.toLowerCase(),p=p.trim().match(/([^( )]+|([^( )]+\(.*\)))(?=\s|$)/g).map((T,x)=>{let y;return v==="url"||v==="drop-shadow"&&x===3?y=T:y=Object(r.toNumber)(T),/%$/.test(T)&&(y/=100),y}),d.push({type:v,args:p})}),d}function i(a,s){a.clearFilter(),s&&s.forEach(({type:u,args:d})=>{let M=u;M==="drop-shadow"?M="dropShadow":M==="hue-rotate"&&(M="hueRotate"),a[M](...d)})}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return r}),e(1).glMatrix.setMatrixArrayType(Array);function r(n,i){if(!i)return;const a=n.getListeners("beforerender"),s=n.getListeners("afterrender");a.length&&!i.beforeRender?i.beforeRender=u=>{n.dispatchEvent({type:"beforerender",detail:{context:u}})}:a.length||(i.beforeRender=null),s.length&&!i.afterRender?i.afterRender=u=>{n.dispatchEvent({type:"afterrender",detail:{context:u}})}:s.length||(i.afterRender=null)}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return d});var r=e(12),n=e(218),i=e(70),a=e(213);e(1).glMatrix.setMatrixArrayType(Array);const s=Symbol("amount"),u=Symbol("meshCloud");class d extends i.default{constructor(c,v=1){super(),this.meshNode=c,c.connect(this),this[s]=v,this[u]=null}get meshCloud(){const c=this.meshNode,v=this[s];return!this[u]&&c.mesh&&(this[u]=new r.MeshCloud(c.mesh,v)),this[u]}get isVisible(){return!!this.meshNode&&this.meshNode.isVisible}get amount(){return this[s]}set amount(c){this[s]=c,this[u]&&(this[u].amount=c)}brightness(c,v){this.meshCloud&&(this.meshCloud.brightness(c,v),this.forceUpdate())}contrast(c,v){this.meshCloud&&(this.meshCloud.contrast(c,v),this.forceUpdate())}delete(c){this.meshCloud&&(this.meshCloud.delete(c),this[s]--,this.forceUpdate())}draw(c=[]){if(super.draw(c),this.meshCloud){if(this.program){this.meshCloud.setProgram(this.program);const v=this.shaderAttrs;v&&Object.entries(v).forEach(([T,x])=>{this.meshCloud.mesh.setAttribute(T,x)});const p=this.uniforms;if(this.uniforms){const T={};Object.entries(p).forEach(([x,y])=>{typeof y=="function"&&(y=y(this,x)),T[x]=y}),this.meshCloud.mesh.setUniforms(T)}}this.meshNode.textureImage&&Object(n.drawTexture)(this.meshNode,this.meshNode.mesh),c.push(this.meshCloud)}return c}getTransform(c){if(this.meshCloud)return this.meshCloud.getTransform(c)}grayscale(c,v){this.meshCloud&&(this.meshCloud.grayscale(c,v),this.forceUpdate())}hueRotate(c,v){this.meshCloud&&(this.meshCloud.hueRotate(c,v),this.forceUpdate())}invert(c,v){this.meshCloud&&(this.meshCloud.invert(c,v),this.forceUpdate())}isPointCollision(c,v){if(!this.meshCloud)return!1;const p=this.attributes.pointerEvents;if(p==="none"||p!=="all"&&!this.isVisible)return!1;let T="both";p==="visibleFill"&&(T="fill"),p==="visibleStroke"&&(T="stroke");for(let x=0;x<this[s];x++)if(!this.meshCloud.isPointCollision(x,[c,v],T))return!1;return!0}setOpacity(c,v){this.meshCloud&&(this.meshCloud.opacity(c,v),this.forceUpdate())}rotate(c,v,[p,T]=[0,0]){const x=Math.PI*v/180;if(this.meshCloud){const{x:y,y:C}=this.meshNode.attributes;this.meshCloud.rotate(c,x,[p+y,T+C]),this.forceUpdate()}}saturate(c,v){this.meshCloud&&(this.meshCloud.saturate(c,v),this.forceUpdate())}scale(c,[v,p=v],[T,x]=[0,0]){if(this.meshCloud){const{x:y,y:C}=this.meshNode.attributes,h=1e-5;Math.abs(v)<h&&(v=1/v>0?h:-h),Math.abs(p)<h&&(p=1/p>0?h:-h),this.meshCloud.scale(c,[v,p],[T+y,x+C]),this.forceUpdate()}}setColorTransform(c,v){this.meshCloud&&(this.meshCloud.setColorTransform(c,v),this.forceUpdate())}setFillColor(c,v){this.meshCloud&&(Array.isArray(v)&&(v=[...v],v[0]/=255,v[1]/=255,v[2]/=255),this.meshCloud.setFillColor(c,v),this.forceUpdate())}sepia(c,v){this.meshCloud&&(this.meshCloud.sepia(c,v),this.forceUpdate())}setResolution({width:c,height:v}){super.setResolution({width:c,height:v}),this.meshNode.setResolution({width:c,height:v})}setStrokeColor(c,v){this.meshCloud&&(Array.isArray(v)&&(v=[...v],v[0]/=255,v[1]/=255,v[2]/=255),this.meshCloud.setStrokeColor(c,v),this.forceUpdate())}setTransform(c,v){this.meshCloud&&(this.meshCloud.setTransform(c,v),this.forceUpdate())}skew(c,[v,p=v],[T,x]=[0,0]){if(this.meshCloud){const{x:y,y:C}=this.meshNode.attributes;this.meshCloud.skew(c,[v,p],[T+y,x+C]),this.forceUpdate()}}transform(c,v){this.meshCloud&&(this.meshCloud.transform(c,v),this.forceUpdate())}transformColor(c,v){this.meshCloud&&(this.meshCloud.transformColor(c,v),this.forceUpdate())}translate(c,[v,p]){this.meshCloud&&(this.meshCloud.translate(c,[v,p]),this.forceUpdate())}updateMesh(){this[u]&&(this[u].mesh=this.meshNode.mesh,this.forceUpdate())}}a.default.registerNode(d,"cloud")}),(function(o,t,e){e.r(t),e.d(t,"loadTexture",function(){return a}),e.d(t,"applyTexture",function(){return s}),e.d(t,"createTexture",function(){return d}),e.d(t,"deleteTexture",function(){return M}),e.d(t,"drawTexture",function(){return v}),e.d(t,"loadFrames",function(){return p});var r=e(12),n=e(72);e(1).glMatrix.setMatrixArrayType(Array);const i={};function a(T,x){if(i[T])return i[T];const y=r.ENV.loadImage(T,{alias:x,useImageBitmap:!1});return y??T}async function s(T,x,y){let C=x;if(typeof x=="string"&&(C=a(x)),C&&typeof C.then=="function"&&(C=await C),x===T.attributes.texture){C&&C.image&&(C.sourceRect&&(T.attributes.sourceRect=C.sourceRect),T.textureImageRotated=!!C.rotated,C=C.image);const{width:h,height:g,textureRect:f}=T.attributes,m=T.textureImage;T.textureImage=C,y&&m!==C&&!f&&(h==null||g==null)&&T.updateContours(),T.forceUpdate()}return C}const u=Symbol("textureMap");function d(T,x){if(x[u]=x[u]||new Map,x[u].has(T))return x[u].get(T);const y=x.createTexture(T);return!/^blob:/.test(T.src)&&typeof T.getContext!="function"&&x[u].set(T,y),y}function M(T,x){if(x[u]&&x[u].has(T)){const y=x[u].get(T);return x.deleteTexture(y),x[u].delete(T),!0}return!1}const c=Symbol("textureContext");function v(T,x){const y=T.textureImage instanceof String?String(T.textureImage):T.textureImage,C=T.textureImageRotated,h=x.texture,g=T.renderer;if(y){const f=T.originalContentRect;let m=T.attributes.textureRect;const S=T.attributes.textureRepeat,A=T.attributes.sourceRect;if(!h||T[c]&&T[c]!==g||h.image!==y||h.options.repeat!==S||!Object(n.compareValue)(h.options.rect,m)||!Object(n.compareValue)(h.options.srcRect,A)){const P=d(y,g);m?(m[0]+=f[0],m[1]+=f[1]):m=f;let R=null;h&&!g[u].has(h.image)&&(!h.options||!h.options.hidden)&&(R=x.uniforms.u_texSampler),x.setTexture(P,{rect:m,repeat:S,srcRect:A,rotated:C}),R&&R.delete&&R.delete(),T[c]=g}}else if(h){let f=null;!g[u].has(h.image)&&(!h.options||!h.options.hidden)&&(f=x.uniforms.u_texSampler),x.setTexture(null),f&&f.delete&&f.delete()}}async function p(T,x){typeof x=="string"&&(x=await(await fetch(x,{method:"GET",mode:"cors",cache:"default"})).json());const y=await a(T),C=x.frames;return Object.entries(C).forEach(([h,g])=>{const{x:f,y:m,w:S,h:A}=g.frame;let P=[f,m,S,A];const R=g.rotated;R&&(P=[P[0],P[1],P[3],P[2]]),i[h]={image:y,sourceRect:P,rotated:R}}),y}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return p});var r=e(1),n=e(12),i=e(70),a=e(220),s=e(221),u=e(222),d=e(213),M=e(223);e(1).glMatrix.setMatrixArrayType(Array);function c(T,x,y){return x in T?Object.defineProperty(T,x,{value:y,enumerable:!0,configurable:!0,writable:!0}):T[x]=y,T}const v=Symbol("mesh");class p extends i.default{constructor(x={}){super(x)}get borderSize(){const{paddingTop:x,paddingRight:y,paddingBottom:C,paddingLeft:h,borderWidth:g}=this.attributes,[f,m]=this.contentSize;return[h+f+y+g,x+m+C+g]}get clientSize(){const{paddingTop:x,paddingRight:y,paddingBottom:C,paddingLeft:h}=this.attributes,[g,f]=this.contentSize;return[h+g+y,x+f+C]}get contentSize(){let{width:x,height:y,boxSizing:C,paddingTop:h,paddingRight:g,paddingBottom:f,paddingLeft:m}=this.attributes;if(x=x||0,y=y||0,C==="border-box"){const S=2*this.attributes.borderWidth;x-=S+g+m,y-=S+h+f,x=Math.max(0,x),y=Math.max(0,y)}return[x,y]}get hasBorder(){return this.attributes.borderWidth>0}get isVisible(){const[x,y]=this.borderSize;return x>0&&y>0}get mesh(){if(this.attributes.display==="none")return null;const x=this.clientBox;if(x){let y=this[v];if(y)y.box!==x&&(y.contours=x.contours,y.box=x);else{y=new n.Mesh2D(x),y.box=x;const h=this.attributes.bgcolor;if(Object(s.setFillColor)(y,{color:h}),this.hasBorder){const{borderColor:f,borderWidth:m,borderDash:S,borderDashOffset:A}=this.attributes;Object(s.setStrokeColor)(y,{color:f,lineWidth:m,lineDash:S,lineDashOffset:A})}this[v]=y;const g=this.attributes.clipPath;g&&this[v].setClipPath(g)}const C=this.opacity;return y.getOpacity()!==C&&y.setOpacity(C),y.setTransform(...this.renderMatrix),y}return null}get offsetSize(){const{paddingTop:x,paddingRight:y,paddingBottom:C,paddingLeft:h,borderWidth:g}=this.attributes,[f,m]=this.contentSize,S=2*g;return[h+f+y+S,x+m+C+S]}get originalClientRect(){if(this.mesh){const x=this.mesh.boundingBox;return[x[0][0],x[0][1],x[1][0]-x[0][0],x[1][1]-x[0][1]]}return[0,0,0,0]}get originalContentRect(){const[x,y,C,h]=this.originalClientRect,g=this.attributes.padding;return[x+g[0],y+g[1],C-g[0]-g[2],h-g[1]-g[3]]}getBoundingClientRect(){let x=this.renderMatrix;this.layer&&this.layer.layerTransformInvert&&(x=r.mat2d.multiply(Array.of(0,0,0,0,0,0),this.layer.transformMatrix,x));let y=null;if(this.mesh){y=[...this.mesh.boundingBox];const C=this.attributes.borderWidth;C&&(y[0]=[y[0][0]-C,y[0][1]-C],y[1]=[y[1][0]+C,y[1][1]+C])}return Object(M.default)(y,x)}onPropertyChange(x,y,C){if(super.onPropertyChange(x,y,C),(x==="anchorX"||x==="anchorY"||x==="boxSizing"||x==="width"||x==="height"||x==="borderWidth"||x==="paddingLeft"||x==="paddingRight"||x==="paddingTop"||x==="paddingBottom"||/^border(TopLeft|TopRight|BottomRight|BottomLeft)Radius$/.test(x))&&this.updateContours(),this[v]&&x==="clipPath"&&this[v].setClipPath(y),this[v]&&x==="bgcolor"&&Object(s.setFillColor)(this[v],{color:y}),this[v]&&(x==="borderColor"||x==="borderWidth"||x==="borderDash"||x==="borderDashOffset")){const{borderColor:h,borderWidth:g,borderDash:f,borderDashOffset:m}=this.attributes;Object(s.setStrokeColor)(this[v],{color:h,lineWidth:g,lineDash:g?f:0,lineDashOffset:m})}}updateContours(){const{anchorX:x,anchorY:y,borderWidth:C,borderRadius:h}=this.attributes,[g,f]=this.borderSize,m=this.offsetSize,S=.5*C,A=-x*m[0]+S,P=-y*m[1]+S;this.clientBox=new n.Figure2D,Object(u.createRadiusBox)(this.clientBox,[A,P,g,f],h)}}c(p,"Attr",a.default),d.default.registerNode(p,"block")}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return M});var r=e(71),n=e(72),i=e(221);e(1).glMatrix.setMatrixArrayType(Array);const a=Symbol.for("spritejs_setAttribute"),s=Symbol.for("spritejs_getAttribute"),u=Symbol.for("spritejs_setAttributeDefault"),d=Symbol.for("spritejs_declareAlias");class M extends r.default{constructor(v){super(v),this[u]({anchorX:0,anchorY:0,width:void 0,height:void 0,borderWidth:0,borderColor:"rgba(0,0,0,1)",borderDash:void 0,borderDashOffset:0,borderTopLeftRadius:[0,0],borderTopRightRadius:[0,0],borderBottomRightRadius:[0,0],borderBottomLeftRadius:[0,0],bgcolor:"rgba(0,0,0,0)",paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,boxSizing:"content-box",clipPath:void 0}),this[d]("anchor","size","border","borderRadius","padding")}get anchorX(){return this[s]("anchorX")}set anchorX(v){this[a]("anchorX",Object(n.toNumber)(v))}get anchorY(){return this[s]("anchorY")}set anchorY(v){this[a]("anchorY",Object(n.toNumber)(v))}get anchor(){return[this.anchorX,this.anchorY]}set anchor(v){v=Object(n.toArray)(v),Array.isArray(v)||(v=[v,v]),this.anchorX=v[0],this.anchorY=v[1]}get width(){return this[s]("width")}set width(v){this[a]("width",Object(n.toNumber)(v))}get height(){return this[s]("height")}set height(v){this[a]("height",Object(n.toNumber)(v))}get size(){return[this.width,this.height]}set size(v){v=Object(n.toArray)(v),Array.isArray(v)||(v=[v,v]),this.width=v[0],this.height=v[1]}get borderWidth(){return this[s]("borderWidth")}set borderWidth(v){this[a]("borderWidth",Object(n.toNumber)(v))}get borderColor(){return this[s]("borderColor")}set borderColor(v){this[a]("borderColor",Object(i.parseColor)(v))}get border(){return[this.borderWidth,this.borderColor]}set border(v){v=Object(n.toArray)(v),Array.isArray(v)||(v=[v]),this.borderWidth=v[0],v[1]!=null&&(this.borderColor=v[1])}get borderDash(){return this[s]("borderDash")}set borderDash(v){v=Object(n.toArray)(v,!0),v!=null&&!Array.isArray(v)&&(v=[v]),this[a]("borderDash",v?v.map(n.toNumber):null)}get borderDashOffset(){return this[s]("borderDashOffset")}set borderDashOffset(v){this[a]("borderDashOffset",Object(n.toNumber)(v))}get borderTopLeftRadius(){return this[s]("borderTopLeftRadius")}set borderTopLeftRadius(v){v=Object(n.toArray)(v,!0),Array.isArray(v)||(v=[v,v]),this[a]("borderTopLeftRadius",v.map(n.toNumber))}get borderTopRightRadius(){return this[s]("borderTopRightRadius")}set borderTopRightRadius(v){v=Object(n.toArray)(v,!0),Array.isArray(v)||(v=[v,v]),this[a]("borderTopRightRadius",v.map(n.toNumber))}get borderBottomRightRadius(){return this[s]("borderBottomRightRadius")}set borderBottomRightRadius(v){v=Object(n.toArray)(v,!0),Array.isArray(v)||(v=[v,v]),this[a]("borderBottomRightRadius",v.map(n.toNumber))}get borderBottomLeftRadius(){return this[s]("borderBottomLeftRadius")}set borderBottomLeftRadius(v){v=Object(n.toArray)(v,!0),Array.isArray(v)||(v=[v,v]),this[a]("borderBottomLeftRadius",v.map(n.toNumber))}get borderRadius(){return[...this.borderTopLeftRadius,...this.borderTopRightRadius,...this.borderBottomRightRadius,...this.borderBottomLeftRadius]}set borderRadius(v){if(v=Object(n.toArray)(v),!Array.isArray(v))v=Array(8).fill(v);else if(v.length===2)v=[v[0],v[1],v[0],v[1],v[0],v[1],v[0],v[1]];else if(v.length===4)v=[v[0],v[1],v[2],v[3],v[0],v[1],v[2],v[3]];else if(v.length===6)v=[v[0],v[1],v[2],v[3],v[4],v[5],v[2],v[3]];else if(v.length!==8)throw new TypeError("Invalid borderRadius value.");this.borderTopLeftRadius=[v[0],v[1]],this.borderTopRightRadius=[v[2],v[3]],this.borderBottomRightRadius=[v[4],v[5]],this.borderBottomLeftRadius=[v[6],v[7]]}get bgcolor(){return this[s]("bgcolor")}set bgcolor(v){this[a]("bgcolor",Object(i.parseColor)(v))}get paddingTop(){return this[s]("paddingTop")}set paddingTop(v){this[a]("paddingTop",Object(n.toNumber)(v))}get paddingRight(){return this[s]("paddingRight")}set paddingRight(v){this[a]("paddingRight",Object(n.toNumber)(v))}get paddingBottom(){return this[s]("paddingBottom")}set paddingBottom(v){this[a]("paddingBottom",Object(n.toNumber)(v))}get paddingLeft(){return this[s]("paddingLeft")}set paddingLeft(v){this[a]("paddingLeft",Object(n.toNumber)(v))}get padding(){return[this.paddingTop,this.paddingRight,this.paddingBottom,this.paddingLeft]}set padding(v){v=Object(n.toArray)(v),Array.isArray(v)?v.length===2?v=[v[0],v[1],v[0],v[1]]:v.length===3&&(v=[v[0],v[1],v[2],v[1]]):v=[v,v,v,v],this.paddingTop=v[0],this.paddingRight=v[1],this.paddingBottom=v[2],this.paddingLeft=v[3]}get clipPath(){return this[s]("clipPath")}set clipPath(v){this[a]("clipPath",v)}get boxSizing(){return this[s]("boxSizing")}set boxSizing(v){if(v!=null&&v!=="border-box"&&v!=="content-box")throw new TypeError("Invalid boxSizing type.");this[a]("boxSizing",v)}}}),(function(o,t,e){e.r(t),e.d(t,"Gradient",function(){return i}),e.d(t,"isTransparent",function(){return a}),e.d(t,"parseColor",function(){return s}),e.d(t,"setFillColor",function(){return d}),e.d(t,"setStrokeColor",function(){return M}),e.d(t,"Color",function(){return c});var r=e(32),n=e.n(r);e(1).glMatrix.setMatrixArrayType(Array);class i{constructor({vector:p,colors:T}){if(!Array.isArray(p)||p.length!==4&&p.length!==6&&p.length!==3)throw new TypeError("Invalid gradient");this.vector=p,this.colors=T.map(({offset:x,color:y})=>({offset:x,color:s(y)}))}toString(){return JSON.stringify({vector:this.vector,colors:this.colors})}}function a(v){return v instanceof i?!1:v==null?!0:n()(v)[3]===0}function s(v){if(v==null||(v||(v="transparent"),v instanceof i))return v;const p=n()(v);if(!p||!p.length)throw new TypeError("Invalid color value.");return`rgba(${p.join()})`}function u(v,p,T){const x=v.boundingBox[0];if(T.vector){let{vector:y,colors:C}=T;y.length===4?(y=[y[0]+x[0],y[1]+x[1],y[2]+x[0],y[3]+x[1]],v.setLinearGradient({vector:y,colors:C,type:p})):y.length===3?(y=[y[0]+x[0],y[1]+x[1],y[2]],v.setCircularGradient({vector:y,colors:C,type:p})):(y=[y[0]+x[0],y[1]+x[1],y[2],y[3]+x[0],y[4]+x[1],y[5]],v.setRadialGradient({vector:y,colors:C,type:p}))}else v.gradient&&v.gradient[p]&&(delete v.gradient[p],delete v.uniforms.u_radialGradientVector)}function d(v,{color:p,rule:T="nonzero"}){return u(v,"fill",p),p.vector||v.setFill({color:p,rule:T}),v}function M(v,{color:p,lineWidth:T,lineCap:x,lineJoin:y,lineDash:C,lineDashOffset:h,miterLimit:g,roundSegments:f}){u(v,"stroke",p),p.vector&&(p=[0,0,0,1]),v.setStroke({color:p,thickness:T,cap:x,join:y,miterLimit:g,lineDash:C,lineDashOffset:h,roundSegments:f})}class c extends Array{constructor(p=0,T=0,x=0,y=0){return Array.isArray(p)&&([p,T,x,y]=p),typeof p=="string"&&([p,T,x,y]=n()(p),p/=255,T/=255,x/=255),super(p,T,x,y),this}get r(){return Math.round(this[0]*255)}set r(p){this[0]=p/255}get g(){return Math.round(this[1]*255)}set g(p){this[1]=p/255}get b(){return Math.round(this[2]*255)}set b(p){this[2]=p/255}get a(){return this[3]}set a(p){this[3]=p}get hex(){const p=`0${this.r.toString(16)}`.slice(-2),T=`0${this.g.toString(16)}`.slice(-2),x=`0${this.b.toString(16)}`.slice(-2);let y;return this.a<1&&(y=Math.round(this[3]*255),y=`0${y.toString(16)}`.slice(-2)),`#${p}${T}${x}${y||""}`}get rgba(){return`rgba(${this.r},${this.g},${this.b},${this.a})`}fromColor(p){return typeof p=="string"&&(p=n()(p),p[0]/=255,p[1]/=255,p[2]/=255),this[0]=p[0],this[1]=p[1],this[2]=p[2],this[3]=p[3],this}}}),(function(o,t,e){e.r(t),e.d(t,"createRadiusBox",function(){return n}),e(1).glMatrix.setMatrixArrayType(Array);function r(i,a,s,u,d,M="leftTop"){const c=.5522848,v=u/2*c,p=d/2*c,T=a+u,x=s+d,y=a+u/2,C=s+d/2;M==="leftTop"?(i.moveTo(a,C),i.bezierCurveTo(a,C-p,y-v,s,y,s)):M==="rightTop"?i.bezierCurveTo(y+v,s,T,C-p,T,C):M==="rightBottom"?i.bezierCurveTo(T,C+p,y+v,x,y,x):M==="leftBottom"&&i.bezierCurveTo(y-v,x,a,C+p,a,C)}function n(i,[a,s,u,d],M){if(!M||Array.isArray(M)&&M.every(c=>c===0))i.beginPath(),i.rect(a,s,u,d);else{typeof M=="number"&&(M=Array(8).fill(M));const[c,v,p,T,x,y,C,h]=M.map((g,f)=>f%2?Math.min(g,d/2):Math.min(g,u/2));i.beginPath(),i.moveTo(a,s+v),r(i,a,s,c*2,v*2,"leftTop"),i.lineTo(a+u-p,s),r(i,a+u-p*2,s,p*2,T*2,"rightTop"),i.lineTo(a+u,s+d-y),r(i,a+u-x*2,s+d-y*2,x*2,y*2,"rightBottom"),i.lineTo(a+C,s+d),r(i,a,s+d-h*2,C*2,h*2,"leftBottom"),i.closePath()}return i}}),(function(o,t,e){e.r(t),e(1).glMatrix.setMatrixArrayType(Array),t.default=(function(r,n){if(!r)return{x:0,y:0,width:0,height:0,left:0,top:0,right:0,bottom:0};const[[i,a],[s,u]]=r,d=i*n[0]+a*n[2]+n[4],M=i*n[1]+a*n[3]+n[5],c=s*n[0]+a*n[2]+n[4],v=s*n[1]+a*n[3]+n[5],p=s*n[0]+u*n[2]+n[4],T=s*n[1]+u*n[3]+n[5],x=i*n[0]+u*n[2]+n[4],y=i*n[1]+u*n[3]+n[5],C=Math.min(d,c,p,x),h=Math.min(M,v,T,y),g=Math.max(d,c,p,x),f=Math.max(M,v,T,y);return{x:C,y:h,width:g-C,height:f-h,left:C,top:h,right:g,bottom:f}})}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return d});var r=e(218),n=e(219),i=e(225),a=e(213);e(1).glMatrix.setMatrixArrayType(Array);function s(M,c,v){return c in M?Object.defineProperty(M,c,{value:v,enumerable:!0,configurable:!0,writable:!0}):M[c]=v,M}const u=Symbol("textureTask");class d extends n.default{constructor(c={}){typeof c=="string"&&(c={texture:c}),super(c)}get contentSize(){let[c,v]=super.contentSize;const{width:p,height:T}=this.attributes;if(p==null||T==null){const x=this.textureImage,y=this.attributes.textureRect,C=this.attributes.sourceRect;if(y)p==null&&(c=y[0]+y[2]),T==null&&(v=y[1]+y[3]);else if(C){const h=this.layer?this.layer.displayRatio:1;p==null&&(c=C[2]/h),T==null&&(v=C[3]/h)}else if(x){const h=this.layer?this.layer.displayRatio:1;p==null&&(c=x.width/h),T==null&&(v=x.height/h)}}return[c,v]}get textureImageReady(){return this[u]||Promise.resolve()}draw(c=[]){super.draw(c);const v=this.mesh;return v&&Object(r.drawTexture)(this,v),c}onPropertyChange(c,v,p){if(super.onPropertyChange(c,v,p),c==="texture"&&(this[u]=Object(r.applyTexture)(this,v,!0)),c==="textureRect"){const{width:T,height:x}=this.attributes;(T==null||x==null)&&this.updateContours()}}}s(d,"Attr",i.default),a.default.registerNode(d,"sprite")}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return s});var r=e(220);e(1).glMatrix.setMatrixArrayType(Array);const n=Symbol.for("spritejs_setAttributeDefault"),i=Symbol.for("spritejs_setAttribute"),a=Symbol.for("spritejs_getAttribute");class s extends r.default{constructor(d){super(d),this[n]({texture:void 0,textureRect:void 0,textureRepeat:!1,sourceRect:void 0})}get texture(){return this[a]("texture")}set texture(d){this[i]("texture",d)}get textureRect(){return this[a]("textureRect")}set textureRect(d){this[i]("textureRect",d)}get sourceRect(){return this[a]("sourceRect")}set sourceRect(d){this[i]("sourceRect",d)}get textureRepeat(){return this[a]("textureRepeat")}set textureRepeat(d){this[i]("textureRepeat",!!d)}}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return T});var r=e(12),n=e(227),i=e.n(n),a=e(70),s=e(228),u=e(221),d=e(218),M=e(213),c=e(223);e(1).glMatrix.setMatrixArrayType(Array);function v(x,y,C){return y in x?Object.defineProperty(x,y,{value:C,enumerable:!0,configurable:!0,writable:!0}):x[y]=C,x}const p=Symbol("mesh");class T extends a.default{constructor(y={}){typeof y=="string"&&(y={d:y}),super(y),this.effects={d(C,h,g,f,m){const S=(g-f)/(m-f);if(S<=0)return C;if(S>=1)return h;const A=i.a._preprocessing(i.a.path2shapes(C),i.a.path2shapes(h)),P=i.a._lerp(...A,S)[0];return P.reduce((D,L)=>`${D}${L.slice(2).join(" ")} `,`M${P[0][0]} ${P[0][1]}C`).trim()}}}get isVisible(){return!!this.d}get mesh(){if(this.attributes.display==="none")return null;const y=this.path;if(y){let C=this[p];if(C)C.path!==y&&(C.contours=y.contours,C.path=y);else{C=new r.Mesh2D(this.path),C.path=y;const g=this.attributes.fillColor,f=this.attributes.fillRule;g&&Object(u.setFillColor)(C,{color:g,rule:f});const m=this.attributes.lineWidth,S=this.attributes.strokeColor;if(S&&m>0){const{lineCap:P,lineJoin:R,miterLimit:D,lineDash:L,lineDashOffset:j,roundSegments:b}=this.attributes;Object(u.setStrokeColor)(C,{color:S,lineWidth:m,lineCap:P,lineJoin:R,miterLimit:D,lineDash:L,lineDashOffset:j,roundSegments:b})}this[p]=C;const A=this.attributes.clipPath;A&&this[p].setClipPath(A)}const h=this.opacity;return C.getOpacity()!==h&&C.setOpacity(h),C.setTransform(...this.renderMatrix),C}return null}get originalContentRect(){if(this.path){const y=this.path.boundingBox;return[y[0][0],y[0][1],y[1][0]-y[0][0],y[1][1]-y[0][1]]}return[0,0,0,0]}get originalClientRect(){if(this.mesh){const y=this.mesh.boundingBox;return[y[0][0],y[0][1],y[1][0]-y[0][0],y[1][1]-y[0][1]]}return[0,0,0,0]}get originalClientCenter(){return this.mesh?this.mesh.boundingCenter:[0,0]}set d(y){this.attributes.d=y}get d(){return this.attributes.d}draw(y=[]){super.draw(y);const C=this.mesh;return C&&Object(d.drawTexture)(this,C),y}getBoundingClientRect(){let y=null;return this.mesh&&(y=this.mesh.boundingBox),Object(c.default)(y,this.renderMatrix)}getPathLength(){return this.mesh?this.mesh.getTotalLength():0}getPointAtLength(y){if(this.mesh){const C=this.mesh.getPointAtLength(y);if(C)return[C.x,C.y]}return[0,0]}onPropertyChange(y,C,h){if(super.onPropertyChange(y,C,h),(y==="d"||y==="normalize")&&this.updateContours(),this[p]&&(y==="fillColor"||y==="fillRule")){const{fillColor:g,fillRule:f}=this.attributes;Object(u.setFillColor)(this[p],{color:g,rule:f})}if(this[p]&&(y==="strokeColor"||y==="lineWidth"||y==="lineCap"||y==="lineJoin"||y==="lineDash"||y==="lineDashOffset"||y==="roundSegments")){const{strokeColor:g,lineWidth:f}=this.attributes;if(g&&f>0){const{lineCap:m,lineJoin:S,lineDash:A,lineDashOffset:P,miterLimit:R,roundSegments:D}=this.attributes;Object(u.setStrokeColor)(this[p],{color:g,lineCap:m,lineJoin:S,lineWidth:f,lineDash:A,lineDashOffset:P,miterLimit:R,roundSegments:D})}}this[p]&&y==="clipPath"&&this[p].setClipPath(C),y==="texture"&&Object(d.applyTexture)(this,C)}updateContours(){this.path=new r.Figure2D,this.path.addPath(this.attributes.d),this.attributes.normalize&&this.path.normalize(...this.path.boundingCenter)}}v(T,"Attr",s.default),M.default.registerNode(T,"path")}),(function(o,t,e){(function(r,n){o.exports=n()})(this,(function(){var r=(function(){function L(j,b){var O=[],Y=!0,X=!1,Z=void 0;try{for(var $=j[Symbol.iterator](),rt;!(Y=(rt=$.next()).done)&&(O.push(rt.value),!(b&&O.length===b));Y=!0);}catch(F){X=!0,Z=F}finally{try{!Y&&$.return&&$.return()}finally{if(X)throw Z}}return O}return function(j,b){if(Array.isArray(j))return j;if(Symbol.iterator in Object(j))return L(j,b);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),n=Math.PI*2,i=function(j,b,O,Y,X,Z,$){var rt=j.x,F=j.y;rt*=b,F*=O;var Q=Y*rt-X*F,tt=X*rt+Y*F;return{x:Q+Z,y:tt+$}},a=function(j,b){var O=1.3333333333333333*Math.tan(b/4),Y=Math.cos(j),X=Math.sin(j),Z=Math.cos(j+b),$=Math.sin(j+b);return[{x:Y-X*O,y:X+Y*O},{x:Z+$*O,y:$-Z*O},{x:Z,y:$}]},s=function(j,b,O,Y){var X=j*Y-b*O<0?-1:1,Z=Math.sqrt(j*j+b*b),$=Math.sqrt(j*j+b*b),rt=j*O+b*Y,F=rt/(Z*$);return F>1&&(F=1),F<-1&&(F=-1),X*Math.acos(F)},u=function(j,b,O,Y,X,Z,$,rt,F,Q,tt,lt){var ct=Math.pow(X,2),Mt=Math.pow(Z,2),st=Math.pow(tt,2),Tt=Math.pow(lt,2),xt=ct*Mt-ct*Tt-Mt*st;xt<0&&(xt=0),xt/=ct*Tt+Mt*st,xt=Math.sqrt(xt)*($===rt?-1:1);var W=xt*X/Z*lt,k=xt*-Z/X*tt,q=Q*W-F*k+(j+O)/2,_=F*W+Q*k+(b+Y)/2,U=(tt-W)/X,H=(lt-k)/Z,E=(-tt-W)/X,w=(-lt-k)/Z,B=s(1,0,U,H),G=s(U,H,E,w);return rt===0&&G>0&&(G-=n),rt===1&&G<0&&(G+=n),[q,_,B,G]},d=function(j){var b=j.px,O=j.py,Y=j.cx,X=j.cy,Z=j.rx,$=j.ry,rt=j.xAxisRotation,F=rt===void 0?0:rt,Q=j.largeArcFlag,tt=Q===void 0?0:Q,lt=j.sweepFlag,ct=lt===void 0?0:lt,Mt=[];if(Z===0||$===0)return[];var st=Math.sin(F*n/360),Tt=Math.cos(F*n/360),xt=Tt*(b-Y)/2+st*(O-X)/2,W=-st*(b-Y)/2+Tt*(O-X)/2;if(xt===0&&W===0)return[];Z=Math.abs(Z),$=Math.abs($);var k=Math.pow(xt,2)/Math.pow(Z,2)+Math.pow(W,2)/Math.pow($,2);k>1&&(Z*=Math.sqrt(k),$*=Math.sqrt(k));var q=u(b,O,Y,X,Z,$,tt,ct,st,Tt,xt,W),_=r(q,4),U=_[0],H=_[1],E=_[2],w=_[3],B=Math.max(Math.ceil(Math.abs(w)/(n/4)),1);w/=B;for(var G=0;G<B;G++)Mt.push(a(E,w)),E+=w;return Mt.map(function(K){var et=i(K[0],Z,$,Tt,st,U,H),at=et.x,ut=et.y,gt=i(K[1],Z,$,Tt,st,U,H),yt=gt.x,Ct=gt.y,vt=i(K[2],Z,$,Tt,st,U,H),mt=vt.x,It=vt.y;return{x1:at,y1:ut,x2:yt,y2:Ct,x:mt,y:It}})},M={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},c=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function v(L){var j=[];return L.replace(c,function(b,O,Y){var X=O.toLowerCase();for(Y=T(Y),X=="m"&&Y.length>2&&(j.push([O].concat(Y.splice(0,2))),X="l",O=O=="m"?"l":"L");;){if(Y.length==M[X])return Y.unshift(O),j.push(Y);if(Y.length<M[X])throw new Error("malformed path data");j.push([O].concat(Y.splice(0,M[X])))}}),j}var p=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function T(L){var j=L.match(p);return j?j.map(Number):[]}function x(L){var j=L[0][0],b=L[0][1],O=j,Y=b;return L.forEach(function(X){var Z=X[0],$=X[2],rt=X[4],F=X[6],Q=X[1],tt=X[3],lt=X[5],ct=X[7];j=Math.min(j,Z,$,rt,F),b=Math.min(b,Q,tt,lt,ct),O=Math.max(O,Z,$,rt,F),Y=Math.max(Y,Q,tt,lt,ct)}),[j,b,O,Y]}function y(L,j){return Math.sqrt(Math.pow(L[0]-j[0],2)+Math.pow(L[1]-j[1],2))+Math.sqrt(Math.pow(L[2]-j[2],2)+Math.pow(L[3]-j[3],2))}function C(L,j){var b=L[0],O=L[2],Y=L[4],X=L[6],Z=L[1],$=L[3],rt=L[5],F=L[7],Q=j[0],tt=j[2],lt=j[4],ct=j[6],Mt=j[1],st=j[3],Tt=j[5],xt=j[7];return Math.sqrt(Math.pow(Q-b,2)+Math.pow(Mt-Z,2))+Math.sqrt(Math.pow(tt-O,2)+Math.pow(st-$,2))+Math.sqrt(Math.pow(lt-Y,2)+Math.pow(Tt-rt,2))+Math.sqrt(Math.pow(ct-X,2)+Math.pow(xt-F,2))}function h(L,j){var b=f(L.length),O=[];b.forEach(function(X){var Z=0,$=0;X.forEach(function(rt){Z+=C(L[rt],j[$++])}),O.push({index:X,distance:Z})}),O.sort(function(X,Z){return X.distance-Z.distance});var Y=[];return O[0].index.forEach(function(X){Y.push(L[X])}),Y}function g(L,j){var b=m(L.length),O=[];b.forEach(function(X){var Z=0;X.forEach(function($){Z+=y(x(L[$]),x(j[$]))}),O.push({index:X,distance:Z})}),O.sort(function(X,Z){return X.distance-Z.distance});var Y=[];return O[0].index.forEach(function(X){Y.push(L[X])}),Y}function f(L){for(var j=[],b=0;b<L;b++){for(var O=[],Y=0;Y<L;Y++){var X=Y+b;X>L-1&&(X-=L),O[X]=Y}j.push(O)}return j}function m(L){for(var j=[],b=0;b<L;b++)j.push(b);return S(j)}function S(L){var j=[],b=[];function O(Y){var X,Z;for(X=0;X<Y.length;X++)Z=Y.splice(X,1)[0],b.push(Z),Y.length==0&&j.push(b.slice()),O(Y),Y.splice(X,0,Z),b.pop();return j}return O(L)}var A={};A.parser=v,A.lerpCurve=function(L,j,b){return A.lerpPoints(L[0],L[1],j[0],j[1],b).concat(A.lerpPoints(L[2],L[3],j[2],j[3],b)).concat(A.lerpPoints(L[4],L[5],j[4],j[5],b)).concat(A.lerpPoints(L[6],L[7],j[6],j[7],b))},A.lerpPoints=function(L,j,b,O,Y){return[L+(b-L)*Y,j+(O-j)*Y]},A.q2b=function(L,j,b,O,Y,X){return[L,j,(L+2*b)/3,(j+2*O)/3,(Y+2*b)/3,(X+2*O)/3,Y,X]},A.path2shapes=function(L){for(var j=A.parser(L),b=0,O=0,Y=0,X=j.length,Z=[],$=null,rt=void 0,F=void 0,Q=void 0,tt=void 0,lt=void 0,ct=void 0,Mt=void 0;Y<X;Y++){var st=j[Y],Tt=st[0],xt=j[Y-1];switch(Tt){case"m":lt=Z.length,Z[lt]=[],$=Z[lt],b=b+st[1],O=O+st[2];break;case"M":lt=Z.length,Z[lt]=[],$=Z[lt],b=st[1],O=st[2];break;case"l":$.push([b,O,b,O,b,O,b+st[1],O+st[2]]),b+=st[1],O+=st[2];break;case"L":$.push([b,O,st[1],st[2],st[1],st[2],st[1],st[2]]),b=st[1],O=st[2];break;case"h":$.push([b,O,b,O,b,O,b+st[1],O]),b+=st[1];break;case"H":$.push([b,O,st[1],O,st[1],O,st[1],O]),b=st[1];break;case"v":$.push([b,O,b,O,b,O,b,O+st[1]]),O+=st[1];break;case"V":$.push([b,O,b,st[1],b,st[1],b,st[1]]),O=st[1];break;case"C":$.push([b,O,st[1],st[2],st[3],st[4],st[5],st[6]]),b=st[5],O=st[6];break;case"S":xt[0]==="C"||xt[0]==="c"?$.push([b,O,b+xt[5]-xt[3],O+xt[6]-xt[4],st[1],st[2],st[3],st[4]]):(xt[0]==="S"||xt[0]==="s")&&$.push([b,O,b+xt[3]-xt[1],O+xt[4]-xt[2],st[1],st[2],st[3],st[4]]),b=st[3],O=st[4];break;case"c":$.push([b,O,b+st[1],O+st[2],b+st[3],O+st[4],b+st[5],O+st[6]]),b=b+st[5],O=O+st[6];break;case"s":xt[0]==="C"||xt[0]==="c"?$.push([b,O,b+xt[5]-xt[3],O+xt[6]-xt[4],b+st[1],O+st[2],b+st[3],O+st[4]]):(xt[0]==="S"||xt[0]==="s")&&$.push([b,O,b+xt[3]-xt[1],O+xt[4]-xt[2],b+st[1],O+st[2],b+st[3],O+st[4]]),b=b+st[3],O=O+st[4];break;case"a":ct=d({rx:st[1],ry:st[2],px:b,py:O,xAxisRotation:st[3],largeArcFlag:st[4],sweepFlag:st[5],cx:b+st[6],cy:O+st[7]}),Mt=ct[ct.length-1],ct.forEach(function(W,k){k===0?$.push([b,O,W.x1,W.y1,W.x2,W.y2,W.x,W.y]):$.push([ct[k-1].x,ct[k-1].y,W.x1,W.y1,W.x2,W.y2,W.x,W.y])}),b=Mt.x,O=Mt.y;break;case"A":ct=d({rx:st[1],ry:st[2],px:b,py:O,xAxisRotation:st[3],largeArcFlag:st[4],sweepFlag:st[5],cx:st[6],cy:st[7]}),Mt=ct[ct.length-1],ct.forEach(function(W,k){k===0?$.push([b,O,W.x1,W.y1,W.x2,W.y2,W.x,W.y]):$.push([ct[k-1].x,ct[k-1].y,W.x1,W.y1,W.x2,W.y2,W.x,W.y])}),b=Mt.x,O=Mt.y;break;case"Q":$.push(A.q2b(b,O,st[1],st[2],st[3],st[4])),b=st[3],O=st[4];break;case"q":$.push(A.q2b(b,O,b+st[1],O+st[2],st[3]+b,st[4]+O)),b+=st[3],O+=st[4];break;case"T":xt[0]==="Q"||xt[0]==="q"?(Q=b+xt[3]-xt[1],tt=O+xt[4]-xt[2],$.push(A.q2b(b,O,Q,tt,st[1],st[2]))):(xt[0]==="T"||xt[0]==="t")&&($.push(A.q2b(b,O,b+b-Q,O+O-tt,st[1],st[2])),Q=b+b-Q,tt=O+O-tt),b=st[1],O=st[2];break;case"t":xt[0]==="Q"||xt[0]==="q"?(Q=b+xt[3]-xt[1],tt=O+xt[4]-xt[2],$.push(A.q2b(b,O,Q,tt,b+st[1],O+st[2]))):(xt[0]==="T"||xt[0]==="t")&&($.push(A.q2b(b,O,b+b-Q,O+O-tt,b+st[1],O+st[2])),Q=b+b-Q,tt=O+O-tt),b+=st[1],O+=st[2];break;case"Z":rt=$[0][0],F=$[0][1],$.push([b,O,rt,F,rt,F,rt,F]);break;case"z":rt=$[0][0],F=$[0][1],$.push([b,O,rt,F,rt,F,rt,F]);break}}return Z},A._upCurves=function(L,j){for(var b=0,O=0,Y=L.length;b<j;b++)L.push(L[O].slice(0)),O++,O>Y-1&&(O-=Y)};function P(L,j,b,O,Y,X,Z,$,rt){return{left:R(L,j,b,O,Y,X,Z,$,rt),right:R(Z,$,Y,X,b,O,L,j,1-rt,!0)}}function R(L,j,b,O,Y,X,Z,$,rt,F){var Q=(b-L)*rt+L,tt=(O-j)*rt+j,lt=(Y-b)*rt+b,ct=(X-O)*rt+O,Mt=(Z-Y)*rt+Y,st=($-X)*rt+X,Tt=(lt-Q)*rt+Q,xt=(ct-tt)*rt+tt,W=(Mt-lt)*rt+lt,k=(st-ct)*rt+ct,q=(W-Tt)*rt+Tt,_=(k-xt)*rt+xt;return F?[q,_,Tt,xt,Q,tt,L,j]:[L,j,Q,tt,Tt,xt,q,_]}A._splitCurves=function(L,j){for(var b=0,O=0;b<j;b++){var Y=L[O],X=P(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5],Y[6],Y[7],.5);L.splice(O,1),L.splice(O,0,X.left,X.right),O+=2,O>=L.length-1&&(O=0)}};function D(L,j){for(var b=function(X){var Z=L[L.length-1],$=[];Z.forEach(function(rt){$.push(rt.slice(0))}),L.push($)},O=0;O<j;O++)b()}return A.lerp=function(L,j,b){return A._lerp(A.path2shapes(L),A.path2shapes(j),b)},A.MIM_CURVES_COUNT=100,A._preprocessing=function(L,j){var b=L.length,O=j.length,Y=JSON.parse(JSON.stringify(L)),X=JSON.parse(JSON.stringify(j));return b>O?D(X,b-O):b<O&&D(Y,O-b),Y=g(Y,X),Y.forEach(function(Z,$){var rt=Z.length,F=X[$].length;rt>F?rt<A.MIM_CURVES_COUNT?(A._splitCurves(Z,A.MIM_CURVES_COUNT-rt),A._splitCurves(X[$],A.MIM_CURVES_COUNT-F)):A._splitCurves(X[$],rt-F):rt<F&&(F<A.MIM_CURVES_COUNT?(A._splitCurves(Z,A.MIM_CURVES_COUNT-rt),A._splitCurves(X[$],A.MIM_CURVES_COUNT-F)):A._splitCurves(Z,F-rt))}),Y.forEach(function(Z,$){Y[$]=h(Z,X[$])}),[Y,X]},A._lerp=function(L,j,b){var O=[];return L.forEach(function(Y,X){var Z=[];Y.forEach(function($,rt){Z.push(A.lerpCurve($,j[X][rt],b))}),O.push(Z)}),O},A.animate=function(L){var j=A.path2shapes(L.from),b=A.path2shapes(L.to),O=A._preprocessing(j,b),Y=new Date,X=L.end||function(){},Z=L.progress||function(){},$=L.begin||function(){},rt=L.easing||function(ct){return ct},F=null,Q=null,tt=L.time;$(j);var lt=function ct(){var Mt=new Date-Y;if(Mt>=tt){Q=b,Z(Q,1),X(Q),cancelAnimationFrame(F);return}var st=rt(Mt/tt);Q=A._lerp(O[0],O[1],st),Z(Q,st),F=requestAnimationFrame(ct)};lt()},A}))}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return d});var r=e(71),n=e(221),i=e(72);e(1).glMatrix.setMatrixArrayType(Array);const a=Symbol.for("spritejs_setAttributeDefault"),s=Symbol.for("spritejs_setAttribute"),u=Symbol.for("spritejs_getAttribute");class d extends r.default{constructor(c){super(c),this[a]({d:"",normalize:!1,fillColor:void 0,fillRule:"nonzero",strokeColor:void 0,lineWidth:1,lineJoin:"miter",lineCap:"butt",roundSegments:20,lineDash:void 0,lineDashOffset:0,miterLimit:10,texture:void 0,textureRect:void 0,textureRepeat:!1,sourceRect:void 0,clipPath:void 0})}get d(){return this[u]("d")}set d(c){this[s]("d",c)}get normalize(){return this[u]("normalize")}set normalize(c){this[s]("normalize",!!c)}get fillColor(){return this[u]("fillColor")}set fillColor(c){this[s]("fillColor",Object(n.parseColor)(c))}get fillRule(){return this[u]("fillRule")}set fillRule(c){if(c!=null&&c!=="nonzero"&&c!=="evenodd")throw new TypeError("Invalid fill rule.");this[s]("fillRule",c)}get strokeColor(){return this[u]("strokeColor")}set strokeColor(c){this[s]("strokeColor",Object(n.parseColor)(c))}get lineWidth(){return this[u]("lineWidth")}set lineWidth(c){this[s]("lineWidth",Object(i.toNumber)(c))}get lineJoin(){return this[u]("lineJoin")}set lineJoin(c){if(c!=null&&c!=="miter"&&c!=="bevel"&&c!=="round")throw new TypeError("Invalid lineJoin type.");this[s]("lineJoin",c)}get lineCap(){return this[u]("lineCap")}set lineCap(c){if(c!=null&&c!=="butt"&&c!=="square"&&c!=="round")throw new TypeError("Invalid lineCap type.");this[s]("lineCap",c)}get lineDash(){return this[u]("lineDash")}set lineDash(c){c=Object(i.toArray)(c,!0),c!=null&&!Array.isArray(c)&&(c=[c]),this[s]("lineDash",c?c.map(i.toNumber):null)}get lineDashOffset(){return this[u]("lineDashOffset")}set lineDashOffset(c){this[s]("lineDashOffset",Object(i.toNumber)(c))}get miterLimit(){return this[u]("miterLimit")}set miterLimit(c){this[s]("miterLimit",Object(i.toNumber)(c))}get roundSegments(){return this[u]("roundSegments")}set roundSegments(c){this[s]("roundSegments",c)}get texture(){return this[u]("texture")}set texture(c){this[s]("texture",c)}get textureRect(){return this[u]("textureRect")}set textureRect(c){this[s]("textureRect",c)}get sourceRect(){return this[u]("sourceRect")}set sourceRect(c){this[s]("sourceRect",c)}get textureRepeat(){return this[u]("textureRepeat")}set textureRepeat(c){this[s]("textureRepeat",!!c)}get clipPath(){return this[u]("clipPath")}set clipPath(c){this[s]("clipPath",c)}}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return s});var r=e(226),n=e(213),i=e(230);e(1).glMatrix.setMatrixArrayType(Array);function a(u,d,M){return d in u?Object.defineProperty(u,d,{value:M,enumerable:!0,configurable:!0,writable:!0}):u[d]=M,u}class s extends r.default{get isVisible(){const{width:d,height:M}=this.attributes;return d>0&&M>0&&super.isVisible}}a(s,"Attr",i.default),n.default.registerNode(s,"rect")}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return M});var r=e(228),n=e(72);e(1).glMatrix.setMatrixArrayType(Array);const i=Symbol.for("spritejs_setAttributeDefault"),a=Symbol.for("spritejs_setAttribute"),s=Symbol.for("spritejs_getAttribute"),u=Symbol.for("spritejs_declareAlias");function d(c){const{width:v,height:p}=c;return`M0 0L${v} 0L${v} ${p}L0 ${p}Z`}class M extends r.default{constructor(v){super(v),this[i]({width:0,height:0}),this[u]("size")}get d(){return this[s]("d")}set d(v){}get width(){return this[s]("width")}set width(v){if(v=Object(n.toNumber)(v),this[a]("width",v)){const p=d(this);this[a]("d",p)}}get height(){return this[s]("height")}set height(v){if(v=Object(n.toNumber)(v),this[a]("height",v)){const p=d(this);this[a]("d",p)}}get size(){return[this.width,this.height]}set size(v){v=Object(n.toArray)(v),Array.isArray(v)||(v=[v,v]),this.width=v[0],this.height=v[1]}}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return s});var r=e(232),n=e(213),i=e(235);e(1).glMatrix.setMatrixArrayType(Array);function a(u,d,M){return d in u?Object.defineProperty(u,d,{value:M,enumerable:!0,configurable:!0,writable:!0}):u[d]=M,u}class s extends r.default{get isVisible(){const{sides:d}=this.attributes;return d[0]>0&&d[1]>0&&super.isVisible}}a(s,"Attr",i.default),n.default.registerNode(s,"triangle")}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return s});var r=e(226),n=e(213),i=e(233);e(1).glMatrix.setMatrixArrayType(Array);function a(u,d,M){return d in u?Object.defineProperty(u,d,{value:M,enumerable:!0,configurable:!0,writable:!0}):u[d]=M,u}class s extends r.default{get isVisible(){const{points:d}=this.attributes;return d.length>0&&super.isVisible}}a(s,"Attr",i.default),n.default.registerNode(s,"polyline")}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return c});var r=e(228),n=e(72),i=e(234);e(1).glMatrix.setMatrixArrayType(Array);const a=Symbol.for("spritejs_setAttributeDefault"),s=Symbol.for("spritejs_setAttribute"),u=Symbol.for("spritejs_getAttribute"),d=Symbol.for("spritejs_declareAlias");function M(v){const{points:p,smooth:T,smoothRange:x,close:y}=v,C=[];for(let g=0;g<p.length;g+=2)C.push([p[g],p[g+1]]);let h="";return T?h=Object(i.makeSmoothCurveLine)(C,x):C.length&&(h=`M${C.map(g=>g.join(" ")).join("L")}`),h&&y&&(h+="Z"),h}class c extends r.default{constructor(p){super(p),this[a]({points:[],smooth:!1,smoothRange:[0],closeType:"none"}),this[d]("close")}get d(){return this[u]("d")}set d(p){}get close(){return this.closeType!=="none"}set close(p){p=p?"normal":"none",this.closeType=p}get closeType(){return this[u]("closeType")}set closeType(p){if(p!=null&&p!=="none"&&p!=="normal")throw new TypeError("Invalid closeType type.");if(this[s]("closeType",p)){const T=M(this);this[s]("d",T)}}get smooth(){return this[u]("smooth")}set smooth(p){if(this[s]("smooth",p)){const T=M(this);this[s]("d",T)}}get smoothRange(){return this[u]("smoothRange")}set smoothRange(p){if(p&&!Array.isArray(p)&&(p=[p]),this[s]("smoothRange",p)&&this.smooth){const T=M(this);this[s]("d",T)}}get points(){return this[u]("points")}set points(p){if(p=Object(n.toArray)(p),Array.isArray(p)&&(p=p.reduce((T,x)=>Array.isArray(x)?[...T,...x.map(y=>Object(n.toNumber)(y))]:[...T,Object(n.toNumber)(x)],[])),this[s]("points",p)){const T=M(this);this[s]("d",T)}}}}),(function(o,t,e){e.r(t),e.d(t,"makeSmoothCurveLine",function(){return r}),e(1).glMatrix.setMatrixArrayType(Array);function r(n,i=[0]){function a(d,M=.168,c=.168){let v,p,T,x;if((n[d].x===n[d+1].x||n[d].y===n[d+1].y)&&(M=0,c=0),d<1?(v=n[0].x+(n[1].x-n[0].x)*M,p=n[0].y+(n[1].y-n[0].y)*M):(v=n[d].x+(n[d+1].x-n[d-1].x)*M,p=n[d].y+(n[d+1].y-n[d-1].y)*M),d>n.length-3){const y=n.length-1;T=n[y].x-(n[y].x-n[y-1].x)*c,x=n[y].y-(n[y].y-n[y-1].y)*c}else T=n[d+1].x-(n[d+2].x-n[d].x)*c,x=n[d+1].y-(n[d+2].y-n[d].y)*c;return[{x:v,y:p},{x:T,y:x}]}n=n.map(([d,M])=>({x:d,y:M}));let s="",u=0;return n.forEach((d,M)=>{if(M===0)s+=`M${d.x} ${d.y}`;else{for(;M>i[u];)u++;if(u%2){const[c,v]=a(M-1);s+=`C${[c.x,c.y,v.x,v.y,d.x,d.y].join(" ")}`}else s+=`L${d.x} ${d.y}`}}),s}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return d});var r=e(233),n=e(72);e(1).glMatrix.setMatrixArrayType(Array);const i=Symbol.for("spritejs_setAttributeDefault"),a=Symbol.for("spritejs_setAttribute"),s=Symbol.for("spritejs_getAttribute");function u(M){const[c,v]=M.sides;let p=M.angle%360;return p<0&&(p+=360),p=Math.PI*p/180,[0,0,c,0,v*Math.cos(p),v*Math.sin(p)]}class d extends r.default{constructor(c){super(c),this[i]({sides:[0,0],angle:60,closeType:"normal"})}get points(){return super.points}set points(c){}get sides(){return this[s]("sides")}set sides(c){if(c=Object(n.toArray)(c,!0),c!=null&&!Array.isArray(c)&&(c=[c,c]),this[a]("sides",c)){const v=u(this);super.points=v}}get angle(){return this[s]("angle")}set angle(c){if(c=Object(n.toNumber)(c),this[a]("angle",c)){const v=u(this);super.points=v}}}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return s});var r=e(232),n=e(213),i=e(237);e(1).glMatrix.setMatrixArrayType(Array);function a(u,d,M){return d in u?Object.defineProperty(u,d,{value:M,enumerable:!0,configurable:!0,writable:!0}):u[d]=M,u}class s extends r.default{get isVisible(){const{sides:d}=this.attributes;return d[0]>0&&d[1]>0&&super.isVisible}}a(s,"Attr",i.default),n.default.registerNode(s,"parallel")}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return d});var r=e(233),n=e(72);e(1).glMatrix.setMatrixArrayType(Array);const i=Symbol.for("spritejs_setAttributeDefault"),a=Symbol.for("spritejs_setAttribute"),s=Symbol.for("spritejs_getAttribute");function u(M){const[c,v]=M.sides;let p=M.angle%360;p<0&&(p+=360),p=Math.PI*p/180;const T=v*Math.cos(p),x=v*Math.sin(p);return[0,0,c,0,T+c,x,T,x]}class d extends r.default{constructor(c){super(c),this[i]({sides:[0,0],angle:90,closeType:"normal"})}get points(){return super.points}set points(c){}get sides(){return this[s]("sides")}set sides(c){if(c=Object(n.toArray)(c,!0),c!=null&&!Array.isArray(c)&&(c=[c,c]),this[a]("sides",c)){const v=u(this);super.points=v}}get angle(){return this[s]("angle")}set angle(c){if(c=Object(n.toNumber)(c),this[a]("angle",c)){const v=u(this);super.points=v}}}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return s});var r=e(232),n=e(213),i=e(239);e(1).glMatrix.setMatrixArrayType(Array);function a(u,d,M){return d in u?Object.defineProperty(u,d,{value:M,enumerable:!0,configurable:!0,writable:!0}):u[d]=M,u}class s extends r.default{}a(s,"Attr",i.default),n.default.registerNode(s,"regular")}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return d});var r=e(233),n=e(72);e(1).glMatrix.setMatrixArrayType(Array);const i=Symbol.for("spritejs_setAttributeDefault"),a=Symbol.for("spritejs_setAttribute"),s=Symbol.for("spritejs_getAttribute");function u(M){const{edges:c,radius:v,offsetAngle:p}=M,T=Math.PI*p/180-.5*Math.PI;if(c<3||v<=0)return[];const x=[];for(let y=0;y<c;y++){const C=y*2*Math.PI/c+T,h=v*Math.cos(C),g=v*Math.sin(C);x.push(h,g)}return x}class d extends r.default{constructor(c){super(c),this[i]({edges:3,radius:0,offsetAngle:0,closeType:"normal"})}get points(){return super.points}set points(c){}get edges(){return this[s]("edges")}set edges(c){if(c=Object(n.toNumber)(c),this[a]("edges",c)){const v=u(this);super.points=v}}get radius(){return this[s]("radius")}set radius(c){if(c=Object(n.toNumber)(c),this[a]("radius",c)){const v=u(this);super.points=v}}get offsetAngle(){return this[s]("offsetAngle")}set offsetAngle(c){if(c=Object(n.toNumber)(c),this[a]("offsetAngle",c)){const v=u(this);super.points=v}}}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return s});var r=e(232),n=e(213),i=e(241);e(1).glMatrix.setMatrixArrayType(Array);function a(u,d,M){return d in u?Object.defineProperty(u,d,{value:M,enumerable:!0,configurable:!0,writable:!0}):u[d]=M,u}class s extends r.default{}a(s,"Attr",i.default),n.default.registerNode(s,"star")}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return d});var r=e(233),n=e(72);e(1).glMatrix.setMatrixArrayType(Array);const i=Symbol.for("spritejs_setAttributeDefault"),a=Symbol.for("spritejs_setAttribute"),s=Symbol.for("spritejs_getAttribute");function u(M){const{angles:c,innerRadius:v,outerRadius:p,offsetAngle:T}=M,x=Math.PI*T/180-.5*Math.PI;if(c<3||v<=0||p<=0)return[];const y=[];for(let C=0;C<c*2;C++){const h=C*Math.PI/c+x,g=C%2?v:p,f=g*Math.cos(h),m=g*Math.sin(h);y.push(f,m)}return y}class d extends r.default{constructor(c){super(c),this[i]({angles:5,innerRadius:0,outerRadius:0,offsetAngle:0,closeType:"normal"})}get points(){return super.points}set points(c){}get angles(){return this[s]("angles")}set angles(c){if(c=Object(n.toNumber)(c),this[a]("angles",c)){const v=u(this);super.points=v}}get innerRadius(){return this[s]("innerRadius")}set innerRadius(c){if(c=Object(n.toNumber)(c),this[a]("innerRadius",c)){const v=u(this);super.points=v}}get outerRadius(){return this[s]("outerRadius")}set outerRadius(c){if(c=Object(n.toNumber)(c),this[a]("outerRadius",c)){const v=u(this);super.points=v}}get radius(){return[this.innerRadius,this.outerRadius]}set radius(c){c=Object(n.toArray)(c,!0),Array.isArray(c)||(c=[c,c]),this.innerRadius=c[0],this.outerRadius=c[1]}get offsetAngle(){return this[s]("offsetAngle")}set offsetAngle(c){if(c=Object(n.toNumber)(c),this[a]("offsetAngle",c)){const v=u(this);super.points=v}}}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return s});var r=e(226),n=e(213),i=e(243);e(1).glMatrix.setMatrixArrayType(Array);function a(u,d,M){return d in u?Object.defineProperty(u,d,{value:M,enumerable:!0,configurable:!0,writable:!0}):u[d]=M,u}class s extends r.default{get isVisible(){const{radiusX:d,radiusY:M,startAngle:c,endAngle:v}=this.attributes;return d>0&&M>0&&c!==v&&super.isVisible}}a(s,"Attr",i.default),n.default.registerNode(s,"ellipse")}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return c});var r=e(12),n=e(228),i=e(72);e(1).glMatrix.setMatrixArrayType(Array);const a=Symbol.for("spritejs_setAttributeDefault"),s=Symbol.for("spritejs_setAttribute"),u=Symbol.for("spritejs_getAttribute"),d=Symbol.for("spritejs_declareAlias");function M(v){const{radiusX:p,radiusY:T,startAngle:x,endAngle:y,direction:C,closeType:h}=v,g=C==="anitclockwise",f=new r.Figure2D;return h==="sector"&&f.moveTo(0,0),f.ellipse(0,0,p,T,0,Math.PI*x/180,Math.PI*y/180,g),h!=="none"&&f.closePath(),f.path.reduce((A,P)=>A+P.join(" "),"")}class c extends n.default{constructor(p){super(p),this[a]({radiusX:0,radiusY:0,startAngle:0,endAngle:360,direction:"clockwise",closeType:"none"}),this[d]("radius","angle")}get d(){return this[u]("d")}set d(p){}get radiusX(){return this[u]("radiusX")}set radiusX(p){if(p=Object(i.toNumber)(p),this[s]("radiusX",p)){const T=M(this);this[s]("d",T)}}get radiusY(){return this[u]("radiusY")}set radiusY(p){if(p=Object(i.toNumber)(p),this[s]("radiusY",p)){const T=M(this);this[s]("d",T)}}get radius(){return[this.radiusX,this.radiusY]}set radius(p){p=Object(i.toArray)(p,!0),Array.isArray(p)||(p=[p,p]),this.radiusX=p[0],this.radiusY=p[1]}get angle(){return[this.startAngle,this.endAngle]}set angle(p){p=Object(i.toArray)(p),Array.isArray(p)||(p=[p,p]),this.startAngle=p[0],this.endAngle=p[1]}get direction(){return this[u]("direction")}set direction(p){if(p!=null&&p!=="clockwise"&&p!=="anticlockwise")throw new TypeError("Invalid direction type.");this[s]("direction",p)}get startAngle(){return this[u]("startAngle")}set startAngle(p){if(p=Object(i.toNumber)(p),this[s]("startAngle",p)){const T=M(this);this[s]("d",T)}}get endAngle(){return this[u]("endAngle")}set endAngle(p){if(p=Object(i.toNumber)(p),this[s]("endAngle",p)){const T=M(this);this[s]("d",T)}}get closeType(){return this[u]("closeType")}set closeType(p){if(p!=null&&p!=="none"&&p!=="sector"&&p!=="normal")throw new TypeError("Invalid closeType type.");if(this[s]("closeType",p)){const T=M(this);this[s]("d",T)}}}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return s});var r=e(242),n=e(213),i=e(245);e(1).glMatrix.setMatrixArrayType(Array);function a(u,d,M){return d in u?Object.defineProperty(u,d,{value:M,enumerable:!0,configurable:!0,writable:!0}):u[d]=M,u}class s extends r.default{}a(s,"Attr",i.default),n.default.registerNode(s,"arc")}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return i});var r=e(243),n=e(72);e(1).glMatrix.setMatrixArrayType(Array);class i extends r.default{get radius(){return super.radiusX}set radius(s){s=Object(n.toNumber)(s),super.radiusX=s,super.radiusY=s}}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return s});var r=e(226),n=e(213),i=e(247);e(1).glMatrix.setMatrixArrayType(Array);function a(u,d,M){return d in u?Object.defineProperty(u,d,{value:M,enumerable:!0,configurable:!0,writable:!0}):u[d]=M,u}class s extends r.default{get isVisible(){const{innerRadius:d,outerRadius:M,startAngle:c,endAngle:v}=this.attributes;return(d>0||M>0)&&c!==v&&super.isVisible}}a(s,"Attr",i.default),n.default.registerNode(s,"ring")}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return c});var r=e(12),n=e(228),i=e(72);e(1).glMatrix.setMatrixArrayType(Array);const a=Symbol.for("spritejs_setAttributeDefault"),s=Symbol.for("spritejs_setAttribute"),u=Symbol.for("spritejs_getAttribute"),d=Symbol.for("spritejs_declareAlias");function M(v){let{innerRadius:p,outerRadius:T,startAngle:x,endAngle:y}=v;const C=new r.Figure2D;if(x=Math.PI*x/180,y=Math.PI*y/180,p>T&&([p,T]=[T,p]),p<=0&&C.moveTo(0,0),C.arc(0,0,T,x,y,!1),p>0){const f=Math.PI*2;y<x&&(y=x+f+(y-x)%f),y-x>=f&&(y=x+f-1e-6),C.arc(0,0,p,y,x,!0)}return C.closePath(),C.path.reduce((f,m)=>f+m.join(" "),"")}class c extends n.default{constructor(p){super(p),this[a]({innerRadius:0,outerRadius:0,startAngle:0,endAngle:360}),this[d]("radius","angle")}get d(){return this[u]("d")}set d(p){}get innerRadius(){return this[u]("innerRadius")}set innerRadius(p){if(p=Object(i.toNumber)(p),this[s]("innerRadius",p)){const T=M(this);this[s]("d",T)}}get outerRadius(){return this[u]("outerRadius")}set outerRadius(p){if(p=Object(i.toNumber)(p),this[s]("outerRadius",p)){const T=M(this);this[s]("d",T)}}get radius(){return[this.innerRadius,this.outerRadius]}set radius(p){p=Object(i.toArray)(p,!0),Array.isArray(p)||(p=[p,p]),this.innerRadius=p[0],this.outerRadius=p[1]}get startAngle(){return this[u]("startAngle")}set startAngle(p){if(p=Object(i.toNumber)(p),this[s]("startAngle",p)){const T=M(this);this[s]("d",T)}}get endAngle(){return this[u]("endAngle")}set endAngle(p){if(p=Object(i.toNumber)(p),this[s]("endAngle",p)){const T=M(this);this[s]("d",T)}}get angle(){return[this.startAngle,this.endAngle]}set angle(p){p=Object(i.toArray)(p),Array.isArray(p)||(p=[p,p]),this.startAngle=p[0],this.endAngle=p[1]}}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return T});var r=e(12),n=e(218),i=e(219),a=e(249),s=e(213);e(1).glMatrix.setMatrixArrayType(Array);function u(x,y,C){return y in x?Object.defineProperty(x,y,{value:C,enumerable:!0,configurable:!0,writable:!0}):x[y]=C,x}const d=Symbol("textImage"),M=Symbol("textImageTask"),c=Symbol("textureContext"),v=Symbol("updateTextureRect"),p=Symbol("textCanvas");class T extends i.default{constructor(y={}){typeof y=="string"&&(y={text:y}),super(y)}get contentSize(){let[y,C]=super.contentSize;const{width:h,height:g}=this.attributes;if(h==null||g==null){const f=this[d];f&&(h==null&&(y=f.rect[2]),g==null&&(C=f.rect[3]))}return[y,C]}get text(){return this.attributes.text}set text(y){this.attributes.text=y}get textContent(){return this.attributes.text}set textContent(y){this.attributes.text=y}get textImage(){return this[d]||{}}get textImageReady(){return this[M]||Promise.resolve()}draw(y){super.draw(y);const C=this.mesh;if(C){const h=this[d];if(h){let g=C.texture;if(!g||this[c]&&this[c]!==this.renderer||h.needsUpdate?(h.needsUpdate=!1,Object(n.deleteTexture)(h.image,this.renderer),g=Object(n.createTexture)(h.image,this.renderer),this[v]=!0):g=C.uniforms.u_texSampler,this[v]){const[f,m]=h.rect.slice(2),[S,A]=this.contentSize,P=this.attributes.textAlign,R=this.attributes.verticalAlign;let D=0;P==="center"?D=(S-f)/2:(P==="right"||P==="end")&&(D=S-f);const L=this.attributes.fontSize,j=this.attributes.lineHeight;let b=0;R==="top"?b=(L-j)/2:R==="bottom"&&(b=(j-L)/2);const{paddingLeft:O,paddingTop:Y}=this.attributes,{borderWidth:X}=this.attributes;D+=O+X,b+=Y+X;const{anchorX:Z,anchorY:$}=this.attributes;D-=this.offsetSize[0]*Z,b-=this.offsetSize[1]*$,C.setTexture(g,{rect:[D,b,f,m]}),this[v]=!1,this[c]=this.renderer}}}return y}onPropertyChange(y,C,h){y==="text"||y==="fontSize"||y==="fontFamily"||y==="fontStyle"||y==="fontVariant"||y==="fontWeight"||y==="fontStretch"||y==="lineHeight"||y==="strokeColor"||y==="fillColor"||y==="strokeWidth"?this.updateText():((y==="textAlign"||y==="verticalAlign")&&(this[v]=!0),super.onPropertyChange(y,C,h))}updateContours(){super.updateContours(),this[v]=!0}updateText(){this[M]||(this[M]=Promise.resolve().then(()=>{this[M]=null;const{text:y,font:C,fillColor:h,strokeColor:g,strokeWidth:f}=this.attributes,m=this.layer?this.layer.displayRatio:1;return this[p]=this[p]||r.ENV.createCanvas(1,1),this[d]=r.ENV.createText(y,{font:C,fillColor:h,strokeColor:g,strokeWidth:f,parseFont:r.parseFont,ratio:m,textCanvas:this[p]}),this[d].needsUpdate=!0,this.updateContours(),this.forceUpdate(),this[d]}))}}u(T,"Attr",a.default),s.default.registerNode(T,"label")}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return c});var r=e(12),n=e(72),i=e(221),a=e(220);e(1).glMatrix.setMatrixArrayType(Array);const s=Symbol.for("spritejs_setAttributeDefault"),u=Symbol.for("spritejs_setAttribute"),d=Symbol.for("spritejs_getAttribute"),M=Symbol.for("spritejs_declareAlias");class c extends a.default{constructor(p){super(p),this[s]({text:"",fontSize:16,fontFamily:"Helvetica,Arial,sans-serif",fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",fontStretch:"normal",lineHeight:"",textAlign:"left",strokeColor:void 0,strokeWidth:1,fillColor:void 0,verticalAlign:"middle"}),this[M]("font")}get text(){return this[d]("text")||" "}set text(p){this[u]("text",p)}get fontSize(){return this[d]("fontSize")}set fontSize(p){this[u]("fontSize",Object(n.toNumber)(p))}get fontFamily(){return this[d]("fontFamily")}set fontFamily(p){this[u]("fontFamily",p)}get fontStyle(){return this[d]("fontStyle")}set fontStyle(p){this[u]("fontStyle",p)}get fontVariant(){return this[d]("fontVariant")}set fontVariant(p){this[u]("fontVariant",p)}get fontWeight(){return this[d]("fontWeight")}set fontWeight(p){this[u]("fontWeight",p)}get fontStretch(){return this[d]("fontStretch")}set fontStretch(p){this[u]("fontStretch",p)}get lineHeight(){return this[d]("lineHeight")||this.fontSize}set lineHeight(p){this[u]("lineHeight",Object(n.toNumber)(p))}get textAlign(){return this[d]("textAlign")}set textAlign(p){this[u]("textAlign",p)}get strokeColor(){return this[d]("strokeColor")}set strokeColor(p){this[u]("strokeColor",Object(i.parseColor)(p))}get strokeWidth(){return this[d]("strokeWidth")}set strokeWidth(p){this[u]("strokeWidth",Object(n.toNumber)(p))}get verticalAlign(){return this[d]("verticalAlign")}set verticalAlign(p){this[u]("verticalAlign",p)}get fillColor(){return this[d]("fillColor")}set fillColor(p){this[u]("fillColor",Object(i.parseColor)(p))}get font(){const{fontStyle:p,fontVariant:T,fontWeight:x,fontStretch:y,fontSize:C,lineHeight:h,fontFamily:g}=this;return`${p} ${T} ${x} ${y} ${C}px/${h}px ${g}`}set font(p){if(p==null)this.fontStyle=null,this.fontVariant=null,this.fontWeight=null,this.fontStretch=null,this.fontSize=null,this.lineHeight=null,this.fontFamily=null;else{const T=Object(r.parseFont)(p);this.fontStyle=T.style,this.fontVariant=T.variant,this.fontWeight=T.weight,this.fontStretch=T.stretch,this.fontSize=Object(n.toNumber)(`${T.size}${T.unit}`),T.lineHeight&&(this.lineHeight=T.pxLineHeight),this.fontFamily=T.family}}}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return p});var r=e(12),n=e(219),i=e(251),a=e(213),s=e(252);e(1).glMatrix.setMatrixArrayType(Array);function u(T,x,y){return x in T?Object.defineProperty(T,x,{value:y,enumerable:!0,configurable:!0,writable:!0}):T[x]=y,T}const d=Symbol("zOrder"),M=Symbol("ordered"),c=Symbol("children"),v=Symbol("sealed");class p extends n.default{constructor(x={}){super(x),this[c]=[],this[M]=null,this[d]=0}get childNodes(){return this[c]}get children(){return this[c]}get orderedChildren(){return this[M]||(this[M]=[...this[c]],this[M].sort((x,y)=>x.zIndex-y.zIndex||x.zOrder-y.zOrder)),this[M]}append(...x){return x.map(y=>this.appendChild(y))}appendChild(x){return x.remove(),this[c].push(x),x.connect(this,this[d]++),this[M]&&(this[M].length&&x.zIndex<this[M][this[M].length-1].zIndex?this.reorder():this[M].push(x)),x}cloneNode(x=!1){const y=super.cloneNode();return x&&this[c].forEach(C=>{const h=C.cloneNode(x);y.appendChild(h)}),y}dispatchPointerEvent(x){const y=this.orderedChildren;for(let C=y.length-1;C>=0;C--)if(y[C].dispatchPointerEvent(x))return!0;return super.dispatchPointerEvent(x)}draw(x=[]){if(this.__cacheRenderMatrix=this.renderMatrix,super.draw(x),!this[v]&&this.attributes.display!=="none"){const y=this.orderedChildren;for(let C=0;C<y.length;C++)y[C].draw(x)}return this.__cacheRenderMatrix=null,x}getElementById(x){return Object(s.querySelector)(`#${x}`,this)}getElementsByClassName(x){return Object(s.querySelectorAll)(`.${x}`,this)}getElementsByName(x){return Object(s.querySelectorAll)(`[name="${x}"]`,this)}getElementsByTagName(x){return Object(s.querySelectorAll)(x,this)}insertBefore(x,y){if(y==null)return this.appendChild(x);x.remove();const C=this[c].indexOf(y);if(C<0)throw new Error("Invalid reference node.");const h=y.zOrder;for(let g=C;g<this[c].length;g++){const f=this[c][g].zOrder,m=this[c][g];delete m.zOrder,Object.defineProperty(m,"zOrder",{value:f+1,writable:!1,configurable:!0})}if(this[c].splice(C,0,x),x.connect(this,h),this[M])if(x.zIndex!==y.zIndex)this.reorder();else{const g=this[M].indexOf(y);this[M].splice(g,0,x)}return x}querySelector(x){return Object(s.querySelector)(x,this)}querySelectorAll(x){return Object(s.querySelectorAll)(x,this)}replaceChild(x,y){x.remove();const C=this[c].indexOf(y);if(C<0)throw new Error("Invalid reference node.");if(this[c][C]=x,x.connect(this,y.zOrder),this[M])if(x.zIndex!==y.zIndex)this.reorder();else{const h=this[M].indexOf(y);this[M][h]=x}return y.disconnect(this),x}removeAllChildren(){const x=this[c];for(let y=x.length-1;y>=0;y--)x[y].remove()}removeChild(x){const y=this[c].indexOf(x);if(y>=0){if(this[c].splice(y,1),this[M]){const C=this[M].indexOf(x);this[M].splice(C,1)}return x.disconnect(this),x}return null}reorder(){this[M]=null}seal(){function x(g,f){const m=[];for(let S=0;S<g.length;S++){const A=[...g[S]];for(let P=1;P<A.length;P+=2){const R=A[P],D=A[P+1];A[P]=R*f[0]+D*f[2]+f[4],A[P+1]=R*f[1]+D*f[3]+f[5]}m.push(A)}return m}const y=this.orderedChildren,C=new r.Figure2D,h=this.localMatrix;for(let g=0;g<y.length;g++){let f=y[g];if(f instanceof p&&(f=f.seal()),f.clientBox){let m=f.clientBox.contours.path;m=x(m,f.localMatrix),C.addPath(m)}if(f.path){let m=f.path.contours.path;m=x(m,f.localMatrix),C.addPath(m)}}return this[v]=!0,this.clientBox=C,{clientBox:C,localMatrix:h}}setResolution({width:x,height:y}){super.setResolution({width:x,height:y}),this[c].forEach(C=>{C.setResolution({width:x,height:y})})}updateContours(){this[v]||super.updateContours()}}u(p,"Attr",i.default),a.default.registerNode(p,"group")}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return n});var r=e(220);e(1).glMatrix.setMatrixArrayType(Array);class n extends r.default{}}),(function(o,t,e){e.r(t),e.d(t,"querySelectorAll",function(){return v}),e.d(t,"querySelector",function(){return p}),e.d(t,"isMatched",function(){return T}),e.d(t,"compile",function(){return x});var r=e(221),n=e(213);e(1).glMatrix.setMatrixArrayType(Array);const i=e(253);function a(y){return y.nodeType===1||n.default.isSpriteNode(y.nodeName)}function s(y){return Array.from(y.childNodes||[])}function u(y){return n.default.isSpriteNode(y.nodeName)?y.parent||y.canvas||y.container:y.parentElement}function d(y){let C=y.length,h,g,f;for(;--C>-1;){for(h=g=y[C],y[C]=null,f=!0;g;){if(y.indexOf(g)>-1){f=!1,y.splice(C,1);break}g=u(g)}f&&(y[C]=h)}return y}const M={isTag:a,existsOne(y,C){return C.some(h=>a(h)?y(h)||M.existsOne(y,s(h)):!1)},getSiblings(y){const C=u(y);return C&&s(C)},getChildren:s,getParent:u,getAttributeValue(y,C){if(y.nodeType===1&&C==="class"||C==="id")return y[C];if(this.hasAttrib(y,C)){let h=y.attributes[C];return Array.isArray(h)&&(h=`[${h.join()}]`),String(h)}},hasAttrib(y,C){return y.attributes[C]!=null},removeSubsets:d,getName(y){return y.tagName?y.tagName.toLowerCase():null},findOne:function y(C,h){let g=null;for(let f=0,m=h.length;f<m&&!g;f++)if(C(h[f]))g=h[f];else{const S=s(h[f]);S&&S.length>0&&(g=y(C,S))}return g},findAll:function y(C,h){let g=[];for(let f=0,m=h.length;f<m;f++){if(!a(h[f]))continue;C(h[f])&&g.push(h[f]);const S=s(h[f]);S&&(g=g.concat(y(C,S)))}return g},getText:function y(C){return Array.isArray(C)?C.map(y).join(""):a(C)?y(s(C)):C.nodeType===3?C.nodeValue:n.default.isSpriteNode(C.nodeName)?C.text:""}};function c(y){if(typeof y!="string")return y;let C=y.match(/\[(bgcolor|fillColor|strokeColor|color)\s*=\s*['"]?\w+['"]?\]/g);return C&&(C=C.map(h=>{const g=h.slice(1,-1).split("="),f=Object(r.parseColor)(g[1].replace(/['"]/g,""));return[h,`[${g[0]}="${f}"]`]}),C.forEach(([h,g])=>{y=y.replace(h,g)})),C=y.match(/\[\w+\s*=\s*['"]\[.+?\]['"]\]/g),C&&(C=C.map(h=>{const g=h.slice(1,-1).split("="),f=g[1].slice(2,-2).split(/,/g).map(m=>m.trim());return[h,`[${g[0]}="[${f}]"]`]}),C.forEach(([h,g])=>{y=y.replace(h,g)})),y}function v(y,C){return i.selectAll(c(y),C,{adapter:M})}function p(y,C){return i.selectOne(c(y),C,{adapter:M})}function T(y,C){return i.is(y,c(C),{adapter:M})}function x(y){return i.compile(c(y),{adapter:M})}}),(function(o,t,e){o.exports=x;var r=e(254),n=e(273).falseFunc,i=e(274);function a(y){return function(h,g,f){return g=g||{},g.adapter=g.adapter||r,y(h,g,f)}}var s=a(i),u=a(i.compileUnsafe);function d(y){return function(h,g,f){return f=f||{},f.adapter=f.adapter||r,typeof h!="function"&&(h=u(h,f,g)),h.shouldTestNextSiblings&&(g=c(f&&f.context||g,f.adapter)),Array.isArray(g)?g=f.adapter.removeSubsets(g):g=f.adapter.getChildren(g),y(h,g,f)}}function M(y,C){var h=C.getSiblings(y);if(!Array.isArray(h))return[];for(h=h.slice(0);h.shift()!==y;);return h}function c(y,C){Array.isArray(y)||(y=[y]);for(var h=y.slice(0),g=0,f=y.length;g<f;g++){var m=M(h[g],C);h.push.apply(h,m)}return h}var v=d(function(C,h,g){return C===n||!h||h.length===0?[]:g.adapter.findAll(C,h)}),p=d(function(C,h,g){return C===n||!h||h.length===0?null:g.adapter.findOne(C,h)});function T(y,C,h){return h=h||{},h.adapter=h.adapter||r,(typeof C=="function"?C:s(C,h))(y)}function x(y,C,h){return v(y,C,h)}x.compile=s,x.filters=i.Pseudos.filters,x.pseudos=i.Pseudos.pseudos,x.selectAll=v,x.selectOne=p,x.is=T,x.parse=s,x.iterate=v,x._compileUnsafe=u,x._compileToken=i.compileToken}),(function(o,t,e){var r=o.exports;[e(255),e(268),e(269),e(270),e(271),e(272)].forEach(function(n){Object.keys(n).forEach(function(i){r[i]=n[i].bind(r)})})}),(function(o,t,e){var r=e(256),n=e(257),i=r.isTag;o.exports={getInnerHTML:a,getOuterHTML:n,getText:s};function a(u,d){return u.children?u.children.map(function(M){return n(M,d)}).join(""):""}function s(u){return Array.isArray(u)?u.map(s).join(""):i(u)?u.name==="br"?`
|
||
`:s(u.children):u.type===r.CDATA?s(u.children):u.type===r.Text?u.data:""}}),(function(o,t){o.exports={Text:"text",Directive:"directive",Comment:"comment",Script:"script",Style:"style",Tag:"tag",CDATA:"cdata",Doctype:"doctype",isTag:function(e){return e.type==="tag"||e.type==="script"||e.type==="style"}}}),(function(o,t,e){var r=e(258),n=e(259),i=e(267);i.elementNames.__proto__=null,i.attributeNames.__proto__=null;var a={__proto__:null,style:!0,script:!0,xmp:!0,iframe:!0,noembed:!0,noframes:!0,plaintext:!0,noscript:!0};function s(y,C){if(y){var h="",g;for(var f in y)g=y[f],h&&(h+=" "),C.xmlMode==="foreign"&&(f=i.attributeNames[f]||f),h+=f,(g!==null&&g!==""||C.xmlMode)&&(h+='="'+(C.decodeEntities?n.encodeXML(g):g.replace(/\"/g,"""))+'"');return h}}var u={__proto__:null,area:!0,base:!0,basefont:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,isindex:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},d=o.exports=function(y,C){!Array.isArray(y)&&!y.cheerio&&(y=[y]),C=C||{};for(var h="",g=0;g<y.length;g++){var f=y[g];f.type==="root"?h+=d(f.children,C):r.isTag(f)?h+=c(f,C):f.type===r.Directive?h+=v(f):f.type===r.Comment?h+=x(f):f.type===r.CDATA?h+=T(f):h+=p(f,C)}return h},M=["mi","mo","mn","ms","mtext","annotation-xml","foreignObject","desc","title"];function c(y,C){C.xmlMode==="foreign"&&(y.name=i.elementNames[y.name]||y.name,y.parent&&M.indexOf(y.parent.name)>=0&&(C=Object.assign({},C,{xmlMode:!1}))),!C.xmlMode&&["svg","math"].indexOf(y.name)>=0&&(C=Object.assign({},C,{xmlMode:"foreign"}));var h="<"+y.name,g=s(y.attribs,C);return g&&(h+=" "+g),C.xmlMode&&(!y.children||y.children.length===0)?h+="/>":(h+=">",y.children&&(h+=d(y.children,C)),(!u[y.name]||C.xmlMode)&&(h+="</"+y.name+">")),h}function v(y){return"<"+y.data+">"}function p(y,C){var h=y.data||"";return C.decodeEntities&&!(y.parent&&y.parent.name in a)&&(h=n.encodeXML(h)),h}function T(y){return"<![CDATA["+y.children[0].data+"]]>"}function x(y){return"<!--"+y.data+"-->"}}),(function(o,t,e){Object.defineProperty(t,"__esModule",{value:!0});function r(n){return n.type==="tag"||n.type==="script"||n.type==="style"}t.isTag=r,t.Text="text",t.Directive="directive",t.Comment="comment",t.Script="script",t.Style="style",t.Tag="tag",t.CDATA="cdata",t.Doctype="doctype"}),(function(o,t,e){Object.defineProperty(t,"__esModule",{value:!0}),t.encode=t.decodeStrict=t.decode=void 0;var r=e(260),n=e(266);function i(M,c){return(!c||c<=0?r.decodeXML:r.decodeHTML)(M)}t.decode=i;function a(M,c){return(!c||c<=0?r.decodeXML:r.decodeHTMLStrict)(M)}t.decodeStrict=a;function s(M,c){return(!c||c<=0?n.encodeXML:n.encodeHTML)(M)}t.encode=s;var u=e(266);Object.defineProperty(t,"encodeXML",{enumerable:!0,get:function(){return u.encodeXML}}),Object.defineProperty(t,"encodeHTML",{enumerable:!0,get:function(){return u.encodeHTML}}),Object.defineProperty(t,"escape",{enumerable:!0,get:function(){return u.escape}}),Object.defineProperty(t,"encodeHTML4",{enumerable:!0,get:function(){return u.encodeHTML}}),Object.defineProperty(t,"encodeHTML5",{enumerable:!0,get:function(){return u.encodeHTML}});var d=e(260);Object.defineProperty(t,"decodeXML",{enumerable:!0,get:function(){return d.decodeXML}}),Object.defineProperty(t,"decodeHTML",{enumerable:!0,get:function(){return d.decodeHTML}}),Object.defineProperty(t,"decodeHTMLStrict",{enumerable:!0,get:function(){return d.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTML4",{enumerable:!0,get:function(){return d.decodeHTML}}),Object.defineProperty(t,"decodeHTML5",{enumerable:!0,get:function(){return d.decodeHTML}}),Object.defineProperty(t,"decodeHTML4Strict",{enumerable:!0,get:function(){return d.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTML5Strict",{enumerable:!0,get:function(){return d.decodeHTMLStrict}}),Object.defineProperty(t,"decodeXMLStrict",{enumerable:!0,get:function(){return d.decodeXML}})}),(function(o,t,e){var r=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(t,"__esModule",{value:!0}),t.decodeHTML=t.decodeHTMLStrict=t.decodeXML=void 0;var n=r(e(261)),i=r(e(262)),a=r(e(263)),s=r(e(264));t.decodeXML=u(a.default),t.decodeHTMLStrict=u(n.default);function u(c){var v=Object.keys(c).join("|"),p=M(c);v+="|#[xX][\\da-fA-F]+|#\\d+";var T=new RegExp("&(?:"+v+");","g");return function(x){return String(x).replace(T,p)}}var d=function(c,v){return c<v?1:-1};t.decodeHTML=(function(){for(var c=Object.keys(i.default).sort(d),v=Object.keys(n.default).sort(d),p=0,T=0;p<v.length;p++)c[T]===v[p]?(v[p]+=";?",T++):v[p]+=";";var x=new RegExp("&(?:"+v.join("|")+"|#[xX][\\da-fA-F]+;?|#\\d+;?)","g"),y=M(n.default);function C(h){return h.substr(-1)!==";"&&(h+=";"),y(h)}return function(h){return String(h).replace(x,C)}})();function M(c){return function(p){if(p.charAt(1)==="#"){var T=p.charAt(2);return T==="X"||T==="x"?s.default(parseInt(p.substr(3),16)):s.default(parseInt(p.substr(2),10))}return c[p.slice(1,-1)]}}}),(function(o){o.exports=JSON.parse('{"Aacute":"Á","aacute":"á","Abreve":"Ă","abreve":"ă","ac":"∾","acd":"∿","acE":"∾̳","Acirc":"Â","acirc":"â","acute":"´","Acy":"А","acy":"а","AElig":"Æ","aelig":"æ","af":"","Afr":"𝔄","afr":"𝔞","Agrave":"À","agrave":"à","alefsym":"ℵ","aleph":"ℵ","Alpha":"Α","alpha":"α","Amacr":"Ā","amacr":"ā","amalg":"⨿","amp":"&","AMP":"&","andand":"⩕","And":"⩓","and":"∧","andd":"⩜","andslope":"⩘","andv":"⩚","ang":"∠","ange":"⦤","angle":"∠","angmsdaa":"⦨","angmsdab":"⦩","angmsdac":"⦪","angmsdad":"⦫","angmsdae":"⦬","angmsdaf":"⦭","angmsdag":"⦮","angmsdah":"⦯","angmsd":"∡","angrt":"∟","angrtvb":"⊾","angrtvbd":"⦝","angsph":"∢","angst":"Å","angzarr":"⍼","Aogon":"Ą","aogon":"ą","Aopf":"𝔸","aopf":"𝕒","apacir":"⩯","ap":"≈","apE":"⩰","ape":"≊","apid":"≋","apos":"\'","ApplyFunction":"","approx":"≈","approxeq":"≊","Aring":"Å","aring":"å","Ascr":"𝒜","ascr":"𝒶","Assign":"≔","ast":"*","asymp":"≈","asympeq":"≍","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","awconint":"∳","awint":"⨑","backcong":"≌","backepsilon":"϶","backprime":"‵","backsim":"∽","backsimeq":"⋍","Backslash":"∖","Barv":"⫧","barvee":"⊽","barwed":"⌅","Barwed":"⌆","barwedge":"⌅","bbrk":"⎵","bbrktbrk":"⎶","bcong":"≌","Bcy":"Б","bcy":"б","bdquo":"„","becaus":"∵","because":"∵","Because":"∵","bemptyv":"⦰","bepsi":"϶","bernou":"ℬ","Bernoullis":"ℬ","Beta":"Β","beta":"β","beth":"ℶ","between":"≬","Bfr":"𝔅","bfr":"𝔟","bigcap":"⋂","bigcirc":"◯","bigcup":"⋃","bigodot":"⨀","bigoplus":"⨁","bigotimes":"⨂","bigsqcup":"⨆","bigstar":"★","bigtriangledown":"▽","bigtriangleup":"△","biguplus":"⨄","bigvee":"⋁","bigwedge":"⋀","bkarow":"⤍","blacklozenge":"⧫","blacksquare":"▪","blacktriangle":"▴","blacktriangledown":"▾","blacktriangleleft":"◂","blacktriangleright":"▸","blank":"␣","blk12":"▒","blk14":"░","blk34":"▓","block":"█","bne":"=⃥","bnequiv":"≡⃥","bNot":"⫭","bnot":"⌐","Bopf":"𝔹","bopf":"𝕓","bot":"⊥","bottom":"⊥","bowtie":"⋈","boxbox":"⧉","boxdl":"┐","boxdL":"╕","boxDl":"╖","boxDL":"╗","boxdr":"┌","boxdR":"╒","boxDr":"╓","boxDR":"╔","boxh":"─","boxH":"═","boxhd":"┬","boxHd":"╤","boxhD":"╥","boxHD":"╦","boxhu":"┴","boxHu":"╧","boxhU":"╨","boxHU":"╩","boxminus":"⊟","boxplus":"⊞","boxtimes":"⊠","boxul":"┘","boxuL":"╛","boxUl":"╜","boxUL":"╝","boxur":"└","boxuR":"╘","boxUr":"╙","boxUR":"╚","boxv":"│","boxV":"║","boxvh":"┼","boxvH":"╪","boxVh":"╫","boxVH":"╬","boxvl":"┤","boxvL":"╡","boxVl":"╢","boxVL":"╣","boxvr":"├","boxvR":"╞","boxVr":"╟","boxVR":"╠","bprime":"‵","breve":"˘","Breve":"˘","brvbar":"¦","bscr":"𝒷","Bscr":"ℬ","bsemi":"⁏","bsim":"∽","bsime":"⋍","bsolb":"⧅","bsol":"\\\\","bsolhsub":"⟈","bull":"•","bullet":"•","bump":"≎","bumpE":"⪮","bumpe":"≏","Bumpeq":"≎","bumpeq":"≏","Cacute":"Ć","cacute":"ć","capand":"⩄","capbrcup":"⩉","capcap":"⩋","cap":"∩","Cap":"⋒","capcup":"⩇","capdot":"⩀","CapitalDifferentialD":"ⅅ","caps":"∩︀","caret":"⁁","caron":"ˇ","Cayleys":"ℭ","ccaps":"⩍","Ccaron":"Č","ccaron":"č","Ccedil":"Ç","ccedil":"ç","Ccirc":"Ĉ","ccirc":"ĉ","Cconint":"∰","ccups":"⩌","ccupssm":"⩐","Cdot":"Ċ","cdot":"ċ","cedil":"¸","Cedilla":"¸","cemptyv":"⦲","cent":"¢","centerdot":"·","CenterDot":"·","cfr":"𝔠","Cfr":"ℭ","CHcy":"Ч","chcy":"ч","check":"✓","checkmark":"✓","Chi":"Χ","chi":"χ","circ":"ˆ","circeq":"≗","circlearrowleft":"↺","circlearrowright":"↻","circledast":"⊛","circledcirc":"⊚","circleddash":"⊝","CircleDot":"⊙","circledR":"®","circledS":"Ⓢ","CircleMinus":"⊖","CirclePlus":"⊕","CircleTimes":"⊗","cir":"○","cirE":"⧃","cire":"≗","cirfnint":"⨐","cirmid":"⫯","cirscir":"⧂","ClockwiseContourIntegral":"∲","CloseCurlyDoubleQuote":"”","CloseCurlyQuote":"’","clubs":"♣","clubsuit":"♣","colon":":","Colon":"∷","Colone":"⩴","colone":"≔","coloneq":"≔","comma":",","commat":"@","comp":"∁","compfn":"∘","complement":"∁","complexes":"ℂ","cong":"≅","congdot":"⩭","Congruent":"≡","conint":"∮","Conint":"∯","ContourIntegral":"∮","copf":"𝕔","Copf":"ℂ","coprod":"∐","Coproduct":"∐","copy":"©","COPY":"©","copysr":"℗","CounterClockwiseContourIntegral":"∳","crarr":"↵","cross":"✗","Cross":"⨯","Cscr":"𝒞","cscr":"𝒸","csub":"⫏","csube":"⫑","csup":"⫐","csupe":"⫒","ctdot":"⋯","cudarrl":"⤸","cudarrr":"⤵","cuepr":"⋞","cuesc":"⋟","cularr":"↶","cularrp":"⤽","cupbrcap":"⩈","cupcap":"⩆","CupCap":"≍","cup":"∪","Cup":"⋓","cupcup":"⩊","cupdot":"⊍","cupor":"⩅","cups":"∪︀","curarr":"↷","curarrm":"⤼","curlyeqprec":"⋞","curlyeqsucc":"⋟","curlyvee":"⋎","curlywedge":"⋏","curren":"¤","curvearrowleft":"↶","curvearrowright":"↷","cuvee":"⋎","cuwed":"⋏","cwconint":"∲","cwint":"∱","cylcty":"⌭","dagger":"†","Dagger":"‡","daleth":"ℸ","darr":"↓","Darr":"↡","dArr":"⇓","dash":"‐","Dashv":"⫤","dashv":"⊣","dbkarow":"⤏","dblac":"˝","Dcaron":"Ď","dcaron":"ď","Dcy":"Д","dcy":"д","ddagger":"‡","ddarr":"⇊","DD":"ⅅ","dd":"ⅆ","DDotrahd":"⤑","ddotseq":"⩷","deg":"°","Del":"∇","Delta":"Δ","delta":"δ","demptyv":"⦱","dfisht":"⥿","Dfr":"𝔇","dfr":"𝔡","dHar":"⥥","dharl":"⇃","dharr":"⇂","DiacriticalAcute":"´","DiacriticalDot":"˙","DiacriticalDoubleAcute":"˝","DiacriticalGrave":"`","DiacriticalTilde":"˜","diam":"⋄","diamond":"⋄","Diamond":"⋄","diamondsuit":"♦","diams":"♦","die":"¨","DifferentialD":"ⅆ","digamma":"ϝ","disin":"⋲","div":"÷","divide":"÷","divideontimes":"⋇","divonx":"⋇","DJcy":"Ђ","djcy":"ђ","dlcorn":"⌞","dlcrop":"⌍","dollar":"$","Dopf":"𝔻","dopf":"𝕕","Dot":"¨","dot":"˙","DotDot":"⃜","doteq":"≐","doteqdot":"≑","DotEqual":"≐","dotminus":"∸","dotplus":"∔","dotsquare":"⊡","doublebarwedge":"⌆","DoubleContourIntegral":"∯","DoubleDot":"¨","DoubleDownArrow":"⇓","DoubleLeftArrow":"⇐","DoubleLeftRightArrow":"⇔","DoubleLeftTee":"⫤","DoubleLongLeftArrow":"⟸","DoubleLongLeftRightArrow":"⟺","DoubleLongRightArrow":"⟹","DoubleRightArrow":"⇒","DoubleRightTee":"⊨","DoubleUpArrow":"⇑","DoubleUpDownArrow":"⇕","DoubleVerticalBar":"∥","DownArrowBar":"⤓","downarrow":"↓","DownArrow":"↓","Downarrow":"⇓","DownArrowUpArrow":"⇵","DownBreve":"̑","downdownarrows":"⇊","downharpoonleft":"⇃","downharpoonright":"⇂","DownLeftRightVector":"⥐","DownLeftTeeVector":"⥞","DownLeftVectorBar":"⥖","DownLeftVector":"↽","DownRightTeeVector":"⥟","DownRightVectorBar":"⥗","DownRightVector":"⇁","DownTeeArrow":"↧","DownTee":"⊤","drbkarow":"⤐","drcorn":"⌟","drcrop":"⌌","Dscr":"𝒟","dscr":"𝒹","DScy":"Ѕ","dscy":"ѕ","dsol":"⧶","Dstrok":"Đ","dstrok":"đ","dtdot":"⋱","dtri":"▿","dtrif":"▾","duarr":"⇵","duhar":"⥯","dwangle":"⦦","DZcy":"Џ","dzcy":"џ","dzigrarr":"⟿","Eacute":"É","eacute":"é","easter":"⩮","Ecaron":"Ě","ecaron":"ě","Ecirc":"Ê","ecirc":"ê","ecir":"≖","ecolon":"≕","Ecy":"Э","ecy":"э","eDDot":"⩷","Edot":"Ė","edot":"ė","eDot":"≑","ee":"ⅇ","efDot":"≒","Efr":"𝔈","efr":"𝔢","eg":"⪚","Egrave":"È","egrave":"è","egs":"⪖","egsdot":"⪘","el":"⪙","Element":"∈","elinters":"⏧","ell":"ℓ","els":"⪕","elsdot":"⪗","Emacr":"Ē","emacr":"ē","empty":"∅","emptyset":"∅","EmptySmallSquare":"◻","emptyv":"∅","EmptyVerySmallSquare":"▫","emsp13":" ","emsp14":" ","emsp":" ","ENG":"Ŋ","eng":"ŋ","ensp":" ","Eogon":"Ę","eogon":"ę","Eopf":"𝔼","eopf":"𝕖","epar":"⋕","eparsl":"⧣","eplus":"⩱","epsi":"ε","Epsilon":"Ε","epsilon":"ε","epsiv":"ϵ","eqcirc":"≖","eqcolon":"≕","eqsim":"≂","eqslantgtr":"⪖","eqslantless":"⪕","Equal":"⩵","equals":"=","EqualTilde":"≂","equest":"≟","Equilibrium":"⇌","equiv":"≡","equivDD":"⩸","eqvparsl":"⧥","erarr":"⥱","erDot":"≓","escr":"ℯ","Escr":"ℰ","esdot":"≐","Esim":"⩳","esim":"≂","Eta":"Η","eta":"η","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","euro":"€","excl":"!","exist":"∃","Exists":"∃","expectation":"ℰ","exponentiale":"ⅇ","ExponentialE":"ⅇ","fallingdotseq":"≒","Fcy":"Ф","fcy":"ф","female":"♀","ffilig":"ffi","fflig":"ff","ffllig":"ffl","Ffr":"𝔉","ffr":"𝔣","filig":"fi","FilledSmallSquare":"◼","FilledVerySmallSquare":"▪","fjlig":"fj","flat":"♭","fllig":"fl","fltns":"▱","fnof":"ƒ","Fopf":"𝔽","fopf":"𝕗","forall":"∀","ForAll":"∀","fork":"⋔","forkv":"⫙","Fouriertrf":"ℱ","fpartint":"⨍","frac12":"½","frac13":"⅓","frac14":"¼","frac15":"⅕","frac16":"⅙","frac18":"⅛","frac23":"⅔","frac25":"⅖","frac34":"¾","frac35":"⅗","frac38":"⅜","frac45":"⅘","frac56":"⅚","frac58":"⅝","frac78":"⅞","frasl":"⁄","frown":"⌢","fscr":"𝒻","Fscr":"ℱ","gacute":"ǵ","Gamma":"Γ","gamma":"γ","Gammad":"Ϝ","gammad":"ϝ","gap":"⪆","Gbreve":"Ğ","gbreve":"ğ","Gcedil":"Ģ","Gcirc":"Ĝ","gcirc":"ĝ","Gcy":"Г","gcy":"г","Gdot":"Ġ","gdot":"ġ","ge":"≥","gE":"≧","gEl":"⪌","gel":"⋛","geq":"≥","geqq":"≧","geqslant":"⩾","gescc":"⪩","ges":"⩾","gesdot":"⪀","gesdoto":"⪂","gesdotol":"⪄","gesl":"⋛︀","gesles":"⪔","Gfr":"𝔊","gfr":"𝔤","gg":"≫","Gg":"⋙","ggg":"⋙","gimel":"ℷ","GJcy":"Ѓ","gjcy":"ѓ","gla":"⪥","gl":"≷","glE":"⪒","glj":"⪤","gnap":"⪊","gnapprox":"⪊","gne":"⪈","gnE":"≩","gneq":"⪈","gneqq":"≩","gnsim":"⋧","Gopf":"𝔾","gopf":"𝕘","grave":"`","GreaterEqual":"≥","GreaterEqualLess":"⋛","GreaterFullEqual":"≧","GreaterGreater":"⪢","GreaterLess":"≷","GreaterSlantEqual":"⩾","GreaterTilde":"≳","Gscr":"𝒢","gscr":"ℊ","gsim":"≳","gsime":"⪎","gsiml":"⪐","gtcc":"⪧","gtcir":"⩺","gt":">","GT":">","Gt":"≫","gtdot":"⋗","gtlPar":"⦕","gtquest":"⩼","gtrapprox":"⪆","gtrarr":"⥸","gtrdot":"⋗","gtreqless":"⋛","gtreqqless":"⪌","gtrless":"≷","gtrsim":"≳","gvertneqq":"≩︀","gvnE":"≩︀","Hacek":"ˇ","hairsp":" ","half":"½","hamilt":"ℋ","HARDcy":"Ъ","hardcy":"ъ","harrcir":"⥈","harr":"↔","hArr":"⇔","harrw":"↭","Hat":"^","hbar":"ℏ","Hcirc":"Ĥ","hcirc":"ĥ","hearts":"♥","heartsuit":"♥","hellip":"…","hercon":"⊹","hfr":"𝔥","Hfr":"ℌ","HilbertSpace":"ℋ","hksearow":"⤥","hkswarow":"⤦","hoarr":"⇿","homtht":"∻","hookleftarrow":"↩","hookrightarrow":"↪","hopf":"𝕙","Hopf":"ℍ","horbar":"―","HorizontalLine":"─","hscr":"𝒽","Hscr":"ℋ","hslash":"ℏ","Hstrok":"Ħ","hstrok":"ħ","HumpDownHump":"≎","HumpEqual":"≏","hybull":"⁃","hyphen":"‐","Iacute":"Í","iacute":"í","ic":"","Icirc":"Î","icirc":"î","Icy":"И","icy":"и","Idot":"İ","IEcy":"Е","iecy":"е","iexcl":"¡","iff":"⇔","ifr":"𝔦","Ifr":"ℑ","Igrave":"Ì","igrave":"ì","ii":"ⅈ","iiiint":"⨌","iiint":"∭","iinfin":"⧜","iiota":"℩","IJlig":"IJ","ijlig":"ij","Imacr":"Ī","imacr":"ī","image":"ℑ","ImaginaryI":"ⅈ","imagline":"ℐ","imagpart":"ℑ","imath":"ı","Im":"ℑ","imof":"⊷","imped":"Ƶ","Implies":"⇒","incare":"℅","in":"∈","infin":"∞","infintie":"⧝","inodot":"ı","intcal":"⊺","int":"∫","Int":"∬","integers":"ℤ","Integral":"∫","intercal":"⊺","Intersection":"⋂","intlarhk":"⨗","intprod":"⨼","InvisibleComma":"","InvisibleTimes":"","IOcy":"Ё","iocy":"ё","Iogon":"Į","iogon":"į","Iopf":"𝕀","iopf":"𝕚","Iota":"Ι","iota":"ι","iprod":"⨼","iquest":"¿","iscr":"𝒾","Iscr":"ℐ","isin":"∈","isindot":"⋵","isinE":"⋹","isins":"⋴","isinsv":"⋳","isinv":"∈","it":"","Itilde":"Ĩ","itilde":"ĩ","Iukcy":"І","iukcy":"і","Iuml":"Ï","iuml":"ï","Jcirc":"Ĵ","jcirc":"ĵ","Jcy":"Й","jcy":"й","Jfr":"𝔍","jfr":"𝔧","jmath":"ȷ","Jopf":"𝕁","jopf":"𝕛","Jscr":"𝒥","jscr":"𝒿","Jsercy":"Ј","jsercy":"ј","Jukcy":"Є","jukcy":"є","Kappa":"Κ","kappa":"κ","kappav":"ϰ","Kcedil":"Ķ","kcedil":"ķ","Kcy":"К","kcy":"к","Kfr":"𝔎","kfr":"𝔨","kgreen":"ĸ","KHcy":"Х","khcy":"х","KJcy":"Ќ","kjcy":"ќ","Kopf":"𝕂","kopf":"𝕜","Kscr":"𝒦","kscr":"𝓀","lAarr":"⇚","Lacute":"Ĺ","lacute":"ĺ","laemptyv":"⦴","lagran":"ℒ","Lambda":"Λ","lambda":"λ","lang":"⟨","Lang":"⟪","langd":"⦑","langle":"⟨","lap":"⪅","Laplacetrf":"ℒ","laquo":"«","larrb":"⇤","larrbfs":"⤟","larr":"←","Larr":"↞","lArr":"⇐","larrfs":"⤝","larrhk":"↩","larrlp":"↫","larrpl":"⤹","larrsim":"⥳","larrtl":"↢","latail":"⤙","lAtail":"⤛","lat":"⪫","late":"⪭","lates":"⪭︀","lbarr":"⤌","lBarr":"⤎","lbbrk":"❲","lbrace":"{","lbrack":"[","lbrke":"⦋","lbrksld":"⦏","lbrkslu":"⦍","Lcaron":"Ľ","lcaron":"ľ","Lcedil":"Ļ","lcedil":"ļ","lceil":"⌈","lcub":"{","Lcy":"Л","lcy":"л","ldca":"⤶","ldquo":"“","ldquor":"„","ldrdhar":"⥧","ldrushar":"⥋","ldsh":"↲","le":"≤","lE":"≦","LeftAngleBracket":"⟨","LeftArrowBar":"⇤","leftarrow":"←","LeftArrow":"←","Leftarrow":"⇐","LeftArrowRightArrow":"⇆","leftarrowtail":"↢","LeftCeiling":"⌈","LeftDoubleBracket":"⟦","LeftDownTeeVector":"⥡","LeftDownVectorBar":"⥙","LeftDownVector":"⇃","LeftFloor":"⌊","leftharpoondown":"↽","leftharpoonup":"↼","leftleftarrows":"⇇","leftrightarrow":"↔","LeftRightArrow":"↔","Leftrightarrow":"⇔","leftrightarrows":"⇆","leftrightharpoons":"⇋","leftrightsquigarrow":"↭","LeftRightVector":"⥎","LeftTeeArrow":"↤","LeftTee":"⊣","LeftTeeVector":"⥚","leftthreetimes":"⋋","LeftTriangleBar":"⧏","LeftTriangle":"⊲","LeftTriangleEqual":"⊴","LeftUpDownVector":"⥑","LeftUpTeeVector":"⥠","LeftUpVectorBar":"⥘","LeftUpVector":"↿","LeftVectorBar":"⥒","LeftVector":"↼","lEg":"⪋","leg":"⋚","leq":"≤","leqq":"≦","leqslant":"⩽","lescc":"⪨","les":"⩽","lesdot":"⩿","lesdoto":"⪁","lesdotor":"⪃","lesg":"⋚︀","lesges":"⪓","lessapprox":"⪅","lessdot":"⋖","lesseqgtr":"⋚","lesseqqgtr":"⪋","LessEqualGreater":"⋚","LessFullEqual":"≦","LessGreater":"≶","lessgtr":"≶","LessLess":"⪡","lesssim":"≲","LessSlantEqual":"⩽","LessTilde":"≲","lfisht":"⥼","lfloor":"⌊","Lfr":"𝔏","lfr":"𝔩","lg":"≶","lgE":"⪑","lHar":"⥢","lhard":"↽","lharu":"↼","lharul":"⥪","lhblk":"▄","LJcy":"Љ","ljcy":"љ","llarr":"⇇","ll":"≪","Ll":"⋘","llcorner":"⌞","Lleftarrow":"⇚","llhard":"⥫","lltri":"◺","Lmidot":"Ŀ","lmidot":"ŀ","lmoustache":"⎰","lmoust":"⎰","lnap":"⪉","lnapprox":"⪉","lne":"⪇","lnE":"≨","lneq":"⪇","lneqq":"≨","lnsim":"⋦","loang":"⟬","loarr":"⇽","lobrk":"⟦","longleftarrow":"⟵","LongLeftArrow":"⟵","Longleftarrow":"⟸","longleftrightarrow":"⟷","LongLeftRightArrow":"⟷","Longleftrightarrow":"⟺","longmapsto":"⟼","longrightarrow":"⟶","LongRightArrow":"⟶","Longrightarrow":"⟹","looparrowleft":"↫","looparrowright":"↬","lopar":"⦅","Lopf":"𝕃","lopf":"𝕝","loplus":"⨭","lotimes":"⨴","lowast":"∗","lowbar":"_","LowerLeftArrow":"↙","LowerRightArrow":"↘","loz":"◊","lozenge":"◊","lozf":"⧫","lpar":"(","lparlt":"⦓","lrarr":"⇆","lrcorner":"⌟","lrhar":"⇋","lrhard":"⥭","lrm":"","lrtri":"⊿","lsaquo":"‹","lscr":"𝓁","Lscr":"ℒ","lsh":"↰","Lsh":"↰","lsim":"≲","lsime":"⪍","lsimg":"⪏","lsqb":"[","lsquo":"‘","lsquor":"‚","Lstrok":"Ł","lstrok":"ł","ltcc":"⪦","ltcir":"⩹","lt":"<","LT":"<","Lt":"≪","ltdot":"⋖","lthree":"⋋","ltimes":"⋉","ltlarr":"⥶","ltquest":"⩻","ltri":"◃","ltrie":"⊴","ltrif":"◂","ltrPar":"⦖","lurdshar":"⥊","luruhar":"⥦","lvertneqq":"≨︀","lvnE":"≨︀","macr":"¯","male":"♂","malt":"✠","maltese":"✠","Map":"⤅","map":"↦","mapsto":"↦","mapstodown":"↧","mapstoleft":"↤","mapstoup":"↥","marker":"▮","mcomma":"⨩","Mcy":"М","mcy":"м","mdash":"—","mDDot":"∺","measuredangle":"∡","MediumSpace":" ","Mellintrf":"ℳ","Mfr":"𝔐","mfr":"𝔪","mho":"℧","micro":"µ","midast":"*","midcir":"⫰","mid":"∣","middot":"·","minusb":"⊟","minus":"−","minusd":"∸","minusdu":"⨪","MinusPlus":"∓","mlcp":"⫛","mldr":"…","mnplus":"∓","models":"⊧","Mopf":"𝕄","mopf":"𝕞","mp":"∓","mscr":"𝓂","Mscr":"ℳ","mstpos":"∾","Mu":"Μ","mu":"μ","multimap":"⊸","mumap":"⊸","nabla":"∇","Nacute":"Ń","nacute":"ń","nang":"∠⃒","nap":"≉","napE":"⩰̸","napid":"≋̸","napos":"ʼn","napprox":"≉","natural":"♮","naturals":"ℕ","natur":"♮","nbsp":" ","nbump":"≎̸","nbumpe":"≏̸","ncap":"⩃","Ncaron":"Ň","ncaron":"ň","Ncedil":"Ņ","ncedil":"ņ","ncong":"≇","ncongdot":"⩭̸","ncup":"⩂","Ncy":"Н","ncy":"н","ndash":"–","nearhk":"⤤","nearr":"↗","neArr":"⇗","nearrow":"↗","ne":"≠","nedot":"≐̸","NegativeMediumSpace":"","NegativeThickSpace":"","NegativeThinSpace":"","NegativeVeryThinSpace":"","nequiv":"≢","nesear":"⤨","nesim":"≂̸","NestedGreaterGreater":"≫","NestedLessLess":"≪","NewLine":"\\n","nexist":"∄","nexists":"∄","Nfr":"𝔑","nfr":"𝔫","ngE":"≧̸","nge":"≱","ngeq":"≱","ngeqq":"≧̸","ngeqslant":"⩾̸","nges":"⩾̸","nGg":"⋙̸","ngsim":"≵","nGt":"≫⃒","ngt":"≯","ngtr":"≯","nGtv":"≫̸","nharr":"↮","nhArr":"⇎","nhpar":"⫲","ni":"∋","nis":"⋼","nisd":"⋺","niv":"∋","NJcy":"Њ","njcy":"њ","nlarr":"↚","nlArr":"⇍","nldr":"‥","nlE":"≦̸","nle":"≰","nleftarrow":"↚","nLeftarrow":"⇍","nleftrightarrow":"↮","nLeftrightarrow":"⇎","nleq":"≰","nleqq":"≦̸","nleqslant":"⩽̸","nles":"⩽̸","nless":"≮","nLl":"⋘̸","nlsim":"≴","nLt":"≪⃒","nlt":"≮","nltri":"⋪","nltrie":"⋬","nLtv":"≪̸","nmid":"∤","NoBreak":"","NonBreakingSpace":" ","nopf":"𝕟","Nopf":"ℕ","Not":"⫬","not":"¬","NotCongruent":"≢","NotCupCap":"≭","NotDoubleVerticalBar":"∦","NotElement":"∉","NotEqual":"≠","NotEqualTilde":"≂̸","NotExists":"∄","NotGreater":"≯","NotGreaterEqual":"≱","NotGreaterFullEqual":"≧̸","NotGreaterGreater":"≫̸","NotGreaterLess":"≹","NotGreaterSlantEqual":"⩾̸","NotGreaterTilde":"≵","NotHumpDownHump":"≎̸","NotHumpEqual":"≏̸","notin":"∉","notindot":"⋵̸","notinE":"⋹̸","notinva":"∉","notinvb":"⋷","notinvc":"⋶","NotLeftTriangleBar":"⧏̸","NotLeftTriangle":"⋪","NotLeftTriangleEqual":"⋬","NotLess":"≮","NotLessEqual":"≰","NotLessGreater":"≸","NotLessLess":"≪̸","NotLessSlantEqual":"⩽̸","NotLessTilde":"≴","NotNestedGreaterGreater":"⪢̸","NotNestedLessLess":"⪡̸","notni":"∌","notniva":"∌","notnivb":"⋾","notnivc":"⋽","NotPrecedes":"⊀","NotPrecedesEqual":"⪯̸","NotPrecedesSlantEqual":"⋠","NotReverseElement":"∌","NotRightTriangleBar":"⧐̸","NotRightTriangle":"⋫","NotRightTriangleEqual":"⋭","NotSquareSubset":"⊏̸","NotSquareSubsetEqual":"⋢","NotSquareSuperset":"⊐̸","NotSquareSupersetEqual":"⋣","NotSubset":"⊂⃒","NotSubsetEqual":"⊈","NotSucceeds":"⊁","NotSucceedsEqual":"⪰̸","NotSucceedsSlantEqual":"⋡","NotSucceedsTilde":"≿̸","NotSuperset":"⊃⃒","NotSupersetEqual":"⊉","NotTilde":"≁","NotTildeEqual":"≄","NotTildeFullEqual":"≇","NotTildeTilde":"≉","NotVerticalBar":"∤","nparallel":"∦","npar":"∦","nparsl":"⫽⃥","npart":"∂̸","npolint":"⨔","npr":"⊀","nprcue":"⋠","nprec":"⊀","npreceq":"⪯̸","npre":"⪯̸","nrarrc":"⤳̸","nrarr":"↛","nrArr":"⇏","nrarrw":"↝̸","nrightarrow":"↛","nRightarrow":"⇏","nrtri":"⋫","nrtrie":"⋭","nsc":"⊁","nsccue":"⋡","nsce":"⪰̸","Nscr":"𝒩","nscr":"𝓃","nshortmid":"∤","nshortparallel":"∦","nsim":"≁","nsime":"≄","nsimeq":"≄","nsmid":"∤","nspar":"∦","nsqsube":"⋢","nsqsupe":"⋣","nsub":"⊄","nsubE":"⫅̸","nsube":"⊈","nsubset":"⊂⃒","nsubseteq":"⊈","nsubseteqq":"⫅̸","nsucc":"⊁","nsucceq":"⪰̸","nsup":"⊅","nsupE":"⫆̸","nsupe":"⊉","nsupset":"⊃⃒","nsupseteq":"⊉","nsupseteqq":"⫆̸","ntgl":"≹","Ntilde":"Ñ","ntilde":"ñ","ntlg":"≸","ntriangleleft":"⋪","ntrianglelefteq":"⋬","ntriangleright":"⋫","ntrianglerighteq":"⋭","Nu":"Ν","nu":"ν","num":"#","numero":"№","numsp":" ","nvap":"≍⃒","nvdash":"⊬","nvDash":"⊭","nVdash":"⊮","nVDash":"⊯","nvge":"≥⃒","nvgt":">⃒","nvHarr":"⤄","nvinfin":"⧞","nvlArr":"⤂","nvle":"≤⃒","nvlt":"<⃒","nvltrie":"⊴⃒","nvrArr":"⤃","nvrtrie":"⊵⃒","nvsim":"∼⃒","nwarhk":"⤣","nwarr":"↖","nwArr":"⇖","nwarrow":"↖","nwnear":"⤧","Oacute":"Ó","oacute":"ó","oast":"⊛","Ocirc":"Ô","ocirc":"ô","ocir":"⊚","Ocy":"О","ocy":"о","odash":"⊝","Odblac":"Ő","odblac":"ő","odiv":"⨸","odot":"⊙","odsold":"⦼","OElig":"Œ","oelig":"œ","ofcir":"⦿","Ofr":"𝔒","ofr":"𝔬","ogon":"˛","Ograve":"Ò","ograve":"ò","ogt":"⧁","ohbar":"⦵","ohm":"Ω","oint":"∮","olarr":"↺","olcir":"⦾","olcross":"⦻","oline":"‾","olt":"⧀","Omacr":"Ō","omacr":"ō","Omega":"Ω","omega":"ω","Omicron":"Ο","omicron":"ο","omid":"⦶","ominus":"⊖","Oopf":"𝕆","oopf":"𝕠","opar":"⦷","OpenCurlyDoubleQuote":"“","OpenCurlyQuote":"‘","operp":"⦹","oplus":"⊕","orarr":"↻","Or":"⩔","or":"∨","ord":"⩝","order":"ℴ","orderof":"ℴ","ordf":"ª","ordm":"º","origof":"⊶","oror":"⩖","orslope":"⩗","orv":"⩛","oS":"Ⓢ","Oscr":"𝒪","oscr":"ℴ","Oslash":"Ø","oslash":"ø","osol":"⊘","Otilde":"Õ","otilde":"õ","otimesas":"⨶","Otimes":"⨷","otimes":"⊗","Ouml":"Ö","ouml":"ö","ovbar":"⌽","OverBar":"‾","OverBrace":"⏞","OverBracket":"⎴","OverParenthesis":"⏜","para":"¶","parallel":"∥","par":"∥","parsim":"⫳","parsl":"⫽","part":"∂","PartialD":"∂","Pcy":"П","pcy":"п","percnt":"%","period":".","permil":"‰","perp":"⊥","pertenk":"‱","Pfr":"𝔓","pfr":"𝔭","Phi":"Φ","phi":"φ","phiv":"ϕ","phmmat":"ℳ","phone":"☎","Pi":"Π","pi":"π","pitchfork":"⋔","piv":"ϖ","planck":"ℏ","planckh":"ℎ","plankv":"ℏ","plusacir":"⨣","plusb":"⊞","pluscir":"⨢","plus":"+","plusdo":"∔","plusdu":"⨥","pluse":"⩲","PlusMinus":"±","plusmn":"±","plussim":"⨦","plustwo":"⨧","pm":"±","Poincareplane":"ℌ","pointint":"⨕","popf":"𝕡","Popf":"ℙ","pound":"£","prap":"⪷","Pr":"⪻","pr":"≺","prcue":"≼","precapprox":"⪷","prec":"≺","preccurlyeq":"≼","Precedes":"≺","PrecedesEqual":"⪯","PrecedesSlantEqual":"≼","PrecedesTilde":"≾","preceq":"⪯","precnapprox":"⪹","precneqq":"⪵","precnsim":"⋨","pre":"⪯","prE":"⪳","precsim":"≾","prime":"′","Prime":"″","primes":"ℙ","prnap":"⪹","prnE":"⪵","prnsim":"⋨","prod":"∏","Product":"∏","profalar":"⌮","profline":"⌒","profsurf":"⌓","prop":"∝","Proportional":"∝","Proportion":"∷","propto":"∝","prsim":"≾","prurel":"⊰","Pscr":"𝒫","pscr":"𝓅","Psi":"Ψ","psi":"ψ","puncsp":" ","Qfr":"𝔔","qfr":"𝔮","qint":"⨌","qopf":"𝕢","Qopf":"ℚ","qprime":"⁗","Qscr":"𝒬","qscr":"𝓆","quaternions":"ℍ","quatint":"⨖","quest":"?","questeq":"≟","quot":"\\"","QUOT":"\\"","rAarr":"⇛","race":"∽̱","Racute":"Ŕ","racute":"ŕ","radic":"√","raemptyv":"⦳","rang":"⟩","Rang":"⟫","rangd":"⦒","range":"⦥","rangle":"⟩","raquo":"»","rarrap":"⥵","rarrb":"⇥","rarrbfs":"⤠","rarrc":"⤳","rarr":"→","Rarr":"↠","rArr":"⇒","rarrfs":"⤞","rarrhk":"↪","rarrlp":"↬","rarrpl":"⥅","rarrsim":"⥴","Rarrtl":"⤖","rarrtl":"↣","rarrw":"↝","ratail":"⤚","rAtail":"⤜","ratio":"∶","rationals":"ℚ","rbarr":"⤍","rBarr":"⤏","RBarr":"⤐","rbbrk":"❳","rbrace":"}","rbrack":"]","rbrke":"⦌","rbrksld":"⦎","rbrkslu":"⦐","Rcaron":"Ř","rcaron":"ř","Rcedil":"Ŗ","rcedil":"ŗ","rceil":"⌉","rcub":"}","Rcy":"Р","rcy":"р","rdca":"⤷","rdldhar":"⥩","rdquo":"”","rdquor":"”","rdsh":"↳","real":"ℜ","realine":"ℛ","realpart":"ℜ","reals":"ℝ","Re":"ℜ","rect":"▭","reg":"®","REG":"®","ReverseElement":"∋","ReverseEquilibrium":"⇋","ReverseUpEquilibrium":"⥯","rfisht":"⥽","rfloor":"⌋","rfr":"𝔯","Rfr":"ℜ","rHar":"⥤","rhard":"⇁","rharu":"⇀","rharul":"⥬","Rho":"Ρ","rho":"ρ","rhov":"ϱ","RightAngleBracket":"⟩","RightArrowBar":"⇥","rightarrow":"→","RightArrow":"→","Rightarrow":"⇒","RightArrowLeftArrow":"⇄","rightarrowtail":"↣","RightCeiling":"⌉","RightDoubleBracket":"⟧","RightDownTeeVector":"⥝","RightDownVectorBar":"⥕","RightDownVector":"⇂","RightFloor":"⌋","rightharpoondown":"⇁","rightharpoonup":"⇀","rightleftarrows":"⇄","rightleftharpoons":"⇌","rightrightarrows":"⇉","rightsquigarrow":"↝","RightTeeArrow":"↦","RightTee":"⊢","RightTeeVector":"⥛","rightthreetimes":"⋌","RightTriangleBar":"⧐","RightTriangle":"⊳","RightTriangleEqual":"⊵","RightUpDownVector":"⥏","RightUpTeeVector":"⥜","RightUpVectorBar":"⥔","RightUpVector":"↾","RightVectorBar":"⥓","RightVector":"⇀","ring":"˚","risingdotseq":"≓","rlarr":"⇄","rlhar":"⇌","rlm":"","rmoustache":"⎱","rmoust":"⎱","rnmid":"⫮","roang":"⟭","roarr":"⇾","robrk":"⟧","ropar":"⦆","ropf":"𝕣","Ropf":"ℝ","roplus":"⨮","rotimes":"⨵","RoundImplies":"⥰","rpar":")","rpargt":"⦔","rppolint":"⨒","rrarr":"⇉","Rrightarrow":"⇛","rsaquo":"›","rscr":"𝓇","Rscr":"ℛ","rsh":"↱","Rsh":"↱","rsqb":"]","rsquo":"’","rsquor":"’","rthree":"⋌","rtimes":"⋊","rtri":"▹","rtrie":"⊵","rtrif":"▸","rtriltri":"⧎","RuleDelayed":"⧴","ruluhar":"⥨","rx":"℞","Sacute":"Ś","sacute":"ś","sbquo":"‚","scap":"⪸","Scaron":"Š","scaron":"š","Sc":"⪼","sc":"≻","sccue":"≽","sce":"⪰","scE":"⪴","Scedil":"Ş","scedil":"ş","Scirc":"Ŝ","scirc":"ŝ","scnap":"⪺","scnE":"⪶","scnsim":"⋩","scpolint":"⨓","scsim":"≿","Scy":"С","scy":"с","sdotb":"⊡","sdot":"⋅","sdote":"⩦","searhk":"⤥","searr":"↘","seArr":"⇘","searrow":"↘","sect":"§","semi":";","seswar":"⤩","setminus":"∖","setmn":"∖","sext":"✶","Sfr":"𝔖","sfr":"𝔰","sfrown":"⌢","sharp":"♯","SHCHcy":"Щ","shchcy":"щ","SHcy":"Ш","shcy":"ш","ShortDownArrow":"↓","ShortLeftArrow":"←","shortmid":"∣","shortparallel":"∥","ShortRightArrow":"→","ShortUpArrow":"↑","shy":"","Sigma":"Σ","sigma":"σ","sigmaf":"ς","sigmav":"ς","sim":"∼","simdot":"⩪","sime":"≃","simeq":"≃","simg":"⪞","simgE":"⪠","siml":"⪝","simlE":"⪟","simne":"≆","simplus":"⨤","simrarr":"⥲","slarr":"←","SmallCircle":"∘","smallsetminus":"∖","smashp":"⨳","smeparsl":"⧤","smid":"∣","smile":"⌣","smt":"⪪","smte":"⪬","smtes":"⪬︀","SOFTcy":"Ь","softcy":"ь","solbar":"⌿","solb":"⧄","sol":"/","Sopf":"𝕊","sopf":"𝕤","spades":"♠","spadesuit":"♠","spar":"∥","sqcap":"⊓","sqcaps":"⊓︀","sqcup":"⊔","sqcups":"⊔︀","Sqrt":"√","sqsub":"⊏","sqsube":"⊑","sqsubset":"⊏","sqsubseteq":"⊑","sqsup":"⊐","sqsupe":"⊒","sqsupset":"⊐","sqsupseteq":"⊒","square":"□","Square":"□","SquareIntersection":"⊓","SquareSubset":"⊏","SquareSubsetEqual":"⊑","SquareSuperset":"⊐","SquareSupersetEqual":"⊒","SquareUnion":"⊔","squarf":"▪","squ":"□","squf":"▪","srarr":"→","Sscr":"𝒮","sscr":"𝓈","ssetmn":"∖","ssmile":"⌣","sstarf":"⋆","Star":"⋆","star":"☆","starf":"★","straightepsilon":"ϵ","straightphi":"ϕ","strns":"¯","sub":"⊂","Sub":"⋐","subdot":"⪽","subE":"⫅","sube":"⊆","subedot":"⫃","submult":"⫁","subnE":"⫋","subne":"⊊","subplus":"⪿","subrarr":"⥹","subset":"⊂","Subset":"⋐","subseteq":"⊆","subseteqq":"⫅","SubsetEqual":"⊆","subsetneq":"⊊","subsetneqq":"⫋","subsim":"⫇","subsub":"⫕","subsup":"⫓","succapprox":"⪸","succ":"≻","succcurlyeq":"≽","Succeeds":"≻","SucceedsEqual":"⪰","SucceedsSlantEqual":"≽","SucceedsTilde":"≿","succeq":"⪰","succnapprox":"⪺","succneqq":"⪶","succnsim":"⋩","succsim":"≿","SuchThat":"∋","sum":"∑","Sum":"∑","sung":"♪","sup1":"¹","sup2":"²","sup3":"³","sup":"⊃","Sup":"⋑","supdot":"⪾","supdsub":"⫘","supE":"⫆","supe":"⊇","supedot":"⫄","Superset":"⊃","SupersetEqual":"⊇","suphsol":"⟉","suphsub":"⫗","suplarr":"⥻","supmult":"⫂","supnE":"⫌","supne":"⊋","supplus":"⫀","supset":"⊃","Supset":"⋑","supseteq":"⊇","supseteqq":"⫆","supsetneq":"⊋","supsetneqq":"⫌","supsim":"⫈","supsub":"⫔","supsup":"⫖","swarhk":"⤦","swarr":"↙","swArr":"⇙","swarrow":"↙","swnwar":"⤪","szlig":"ß","Tab":"\\t","target":"⌖","Tau":"Τ","tau":"τ","tbrk":"⎴","Tcaron":"Ť","tcaron":"ť","Tcedil":"Ţ","tcedil":"ţ","Tcy":"Т","tcy":"т","tdot":"⃛","telrec":"⌕","Tfr":"𝔗","tfr":"𝔱","there4":"∴","therefore":"∴","Therefore":"∴","Theta":"Θ","theta":"θ","thetasym":"ϑ","thetav":"ϑ","thickapprox":"≈","thicksim":"∼","ThickSpace":" ","ThinSpace":" ","thinsp":" ","thkap":"≈","thksim":"∼","THORN":"Þ","thorn":"þ","tilde":"˜","Tilde":"∼","TildeEqual":"≃","TildeFullEqual":"≅","TildeTilde":"≈","timesbar":"⨱","timesb":"⊠","times":"×","timesd":"⨰","tint":"∭","toea":"⤨","topbot":"⌶","topcir":"⫱","top":"⊤","Topf":"𝕋","topf":"𝕥","topfork":"⫚","tosa":"⤩","tprime":"‴","trade":"™","TRADE":"™","triangle":"▵","triangledown":"▿","triangleleft":"◃","trianglelefteq":"⊴","triangleq":"≜","triangleright":"▹","trianglerighteq":"⊵","tridot":"◬","trie":"≜","triminus":"⨺","TripleDot":"⃛","triplus":"⨹","trisb":"⧍","tritime":"⨻","trpezium":"⏢","Tscr":"𝒯","tscr":"𝓉","TScy":"Ц","tscy":"ц","TSHcy":"Ћ","tshcy":"ћ","Tstrok":"Ŧ","tstrok":"ŧ","twixt":"≬","twoheadleftarrow":"↞","twoheadrightarrow":"↠","Uacute":"Ú","uacute":"ú","uarr":"↑","Uarr":"↟","uArr":"⇑","Uarrocir":"⥉","Ubrcy":"Ў","ubrcy":"ў","Ubreve":"Ŭ","ubreve":"ŭ","Ucirc":"Û","ucirc":"û","Ucy":"У","ucy":"у","udarr":"⇅","Udblac":"Ű","udblac":"ű","udhar":"⥮","ufisht":"⥾","Ufr":"𝔘","ufr":"𝔲","Ugrave":"Ù","ugrave":"ù","uHar":"⥣","uharl":"↿","uharr":"↾","uhblk":"▀","ulcorn":"⌜","ulcorner":"⌜","ulcrop":"⌏","ultri":"◸","Umacr":"Ū","umacr":"ū","uml":"¨","UnderBar":"_","UnderBrace":"⏟","UnderBracket":"⎵","UnderParenthesis":"⏝","Union":"⋃","UnionPlus":"⊎","Uogon":"Ų","uogon":"ų","Uopf":"𝕌","uopf":"𝕦","UpArrowBar":"⤒","uparrow":"↑","UpArrow":"↑","Uparrow":"⇑","UpArrowDownArrow":"⇅","updownarrow":"↕","UpDownArrow":"↕","Updownarrow":"⇕","UpEquilibrium":"⥮","upharpoonleft":"↿","upharpoonright":"↾","uplus":"⊎","UpperLeftArrow":"↖","UpperRightArrow":"↗","upsi":"υ","Upsi":"ϒ","upsih":"ϒ","Upsilon":"Υ","upsilon":"υ","UpTeeArrow":"↥","UpTee":"⊥","upuparrows":"⇈","urcorn":"⌝","urcorner":"⌝","urcrop":"⌎","Uring":"Ů","uring":"ů","urtri":"◹","Uscr":"𝒰","uscr":"𝓊","utdot":"⋰","Utilde":"Ũ","utilde":"ũ","utri":"▵","utrif":"▴","uuarr":"⇈","Uuml":"Ü","uuml":"ü","uwangle":"⦧","vangrt":"⦜","varepsilon":"ϵ","varkappa":"ϰ","varnothing":"∅","varphi":"ϕ","varpi":"ϖ","varpropto":"∝","varr":"↕","vArr":"⇕","varrho":"ϱ","varsigma":"ς","varsubsetneq":"⊊︀","varsubsetneqq":"⫋︀","varsupsetneq":"⊋︀","varsupsetneqq":"⫌︀","vartheta":"ϑ","vartriangleleft":"⊲","vartriangleright":"⊳","vBar":"⫨","Vbar":"⫫","vBarv":"⫩","Vcy":"В","vcy":"в","vdash":"⊢","vDash":"⊨","Vdash":"⊩","VDash":"⊫","Vdashl":"⫦","veebar":"⊻","vee":"∨","Vee":"⋁","veeeq":"≚","vellip":"⋮","verbar":"|","Verbar":"‖","vert":"|","Vert":"‖","VerticalBar":"∣","VerticalLine":"|","VerticalSeparator":"❘","VerticalTilde":"≀","VeryThinSpace":" ","Vfr":"𝔙","vfr":"𝔳","vltri":"⊲","vnsub":"⊂⃒","vnsup":"⊃⃒","Vopf":"𝕍","vopf":"𝕧","vprop":"∝","vrtri":"⊳","Vscr":"𝒱","vscr":"𝓋","vsubnE":"⫋︀","vsubne":"⊊︀","vsupnE":"⫌︀","vsupne":"⊋︀","Vvdash":"⊪","vzigzag":"⦚","Wcirc":"Ŵ","wcirc":"ŵ","wedbar":"⩟","wedge":"∧","Wedge":"⋀","wedgeq":"≙","weierp":"℘","Wfr":"𝔚","wfr":"𝔴","Wopf":"𝕎","wopf":"𝕨","wp":"℘","wr":"≀","wreath":"≀","Wscr":"𝒲","wscr":"𝓌","xcap":"⋂","xcirc":"◯","xcup":"⋃","xdtri":"▽","Xfr":"𝔛","xfr":"𝔵","xharr":"⟷","xhArr":"⟺","Xi":"Ξ","xi":"ξ","xlarr":"⟵","xlArr":"⟸","xmap":"⟼","xnis":"⋻","xodot":"⨀","Xopf":"𝕏","xopf":"𝕩","xoplus":"⨁","xotime":"⨂","xrarr":"⟶","xrArr":"⟹","Xscr":"𝒳","xscr":"𝓍","xsqcup":"⨆","xuplus":"⨄","xutri":"△","xvee":"⋁","xwedge":"⋀","Yacute":"Ý","yacute":"ý","YAcy":"Я","yacy":"я","Ycirc":"Ŷ","ycirc":"ŷ","Ycy":"Ы","ycy":"ы","yen":"¥","Yfr":"𝔜","yfr":"𝔶","YIcy":"Ї","yicy":"ї","Yopf":"𝕐","yopf":"𝕪","Yscr":"𝒴","yscr":"𝓎","YUcy":"Ю","yucy":"ю","yuml":"ÿ","Yuml":"Ÿ","Zacute":"Ź","zacute":"ź","Zcaron":"Ž","zcaron":"ž","Zcy":"З","zcy":"з","Zdot":"Ż","zdot":"ż","zeetrf":"ℨ","ZeroWidthSpace":"","Zeta":"Ζ","zeta":"ζ","zfr":"𝔷","Zfr":"ℨ","ZHcy":"Ж","zhcy":"ж","zigrarr":"⇝","zopf":"𝕫","Zopf":"ℤ","Zscr":"𝒵","zscr":"𝓏","zwj":"","zwnj":""}')}),(function(o){o.exports=JSON.parse('{"Aacute":"Á","aacute":"á","Acirc":"Â","acirc":"â","acute":"´","AElig":"Æ","aelig":"æ","Agrave":"À","agrave":"à","amp":"&","AMP":"&","Aring":"Å","aring":"å","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","brvbar":"¦","Ccedil":"Ç","ccedil":"ç","cedil":"¸","cent":"¢","copy":"©","COPY":"©","curren":"¤","deg":"°","divide":"÷","Eacute":"É","eacute":"é","Ecirc":"Ê","ecirc":"ê","Egrave":"È","egrave":"è","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","frac12":"½","frac14":"¼","frac34":"¾","gt":">","GT":">","Iacute":"Í","iacute":"í","Icirc":"Î","icirc":"î","iexcl":"¡","Igrave":"Ì","igrave":"ì","iquest":"¿","Iuml":"Ï","iuml":"ï","laquo":"«","lt":"<","LT":"<","macr":"¯","micro":"µ","middot":"·","nbsp":" ","not":"¬","Ntilde":"Ñ","ntilde":"ñ","Oacute":"Ó","oacute":"ó","Ocirc":"Ô","ocirc":"ô","Ograve":"Ò","ograve":"ò","ordf":"ª","ordm":"º","Oslash":"Ø","oslash":"ø","Otilde":"Õ","otilde":"õ","Ouml":"Ö","ouml":"ö","para":"¶","plusmn":"±","pound":"£","quot":"\\"","QUOT":"\\"","raquo":"»","reg":"®","REG":"®","sect":"§","shy":"","sup1":"¹","sup2":"²","sup3":"³","szlig":"ß","THORN":"Þ","thorn":"þ","times":"×","Uacute":"Ú","uacute":"ú","Ucirc":"Û","ucirc":"û","Ugrave":"Ù","ugrave":"ù","uml":"¨","Uuml":"Ü","uuml":"ü","Yacute":"Ý","yacute":"ý","yen":"¥","yuml":"ÿ"}')}),(function(o){o.exports=JSON.parse(`{"amp":"&","apos":"'","gt":">","lt":"<","quot":"\\""}`)}),(function(o,t,e){var r=this&&this.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(t,"__esModule",{value:!0});var n=r(e(265));function i(a){if(a>=55296&&a<=57343||a>1114111)return"<22>";a in n.default&&(a=n.default[a]);var s="";return a>65535&&(a-=65536,s+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),s+=String.fromCharCode(a),s}t.default=i}),(function(o){o.exports=JSON.parse('{"0":65533,"128":8364,"130":8218,"131":402,"132":8222,"133":8230,"134":8224,"135":8225,"136":710,"137":8240,"138":352,"139":8249,"140":338,"142":381,"145":8216,"146":8217,"147":8220,"148":8221,"149":8226,"150":8211,"151":8212,"152":732,"153":8482,"154":353,"155":8250,"156":339,"158":382,"159":376}')}),(function(o,t,e){var r=this&&this.__importDefault||function(C){return C&&C.__esModule?C:{default:C}};Object.defineProperty(t,"__esModule",{value:!0}),t.escape=t.encodeHTML=t.encodeXML=void 0;var n=r(e(263)),i=M(n.default),a=c(i);t.encodeXML=T(i,a);var s=r(e(261)),u=M(s.default),d=c(u);t.encodeHTML=T(u,d);function M(C){return Object.keys(C).sort().reduce(function(h,g){return h[C[g]]="&"+g+";",h},{})}function c(C){for(var h=[],g=[],f=0,m=Object.keys(C);f<m.length;f++){var S=m[f];S.length===1?h.push("\\"+S):g.push(S)}h.sort();for(var A=0;A<h.length-1;A++){for(var P=A;P<h.length-1&&h[P].charCodeAt(1)+1===h[P+1].charCodeAt(1);)P+=1;var R=1+P-A;R<3||h.splice(A,R,h[A]+"-"+h[P])}return g.unshift("["+h.join("")+"]"),new RegExp(g.join("|"),"g")}var v=/(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g;function p(C){return"&#x"+C.codePointAt(0).toString(16).toUpperCase()+";"}function T(C,h){return function(g){return g.replace(h,function(f){return C[f]}).replace(v,p)}}var x=c(i);function y(C){return C.replace(x,p).replace(v,p)}t.escape=y}),(function(o){o.exports=JSON.parse('{"elementNames":{"altglyph":"altGlyph","altglyphdef":"altGlyphDef","altglyphitem":"altGlyphItem","animatecolor":"animateColor","animatemotion":"animateMotion","animatetransform":"animateTransform","clippath":"clipPath","feblend":"feBlend","fecolormatrix":"feColorMatrix","fecomponenttransfer":"feComponentTransfer","fecomposite":"feComposite","feconvolvematrix":"feConvolveMatrix","fediffuselighting":"feDiffuseLighting","fedisplacementmap":"feDisplacementMap","fedistantlight":"feDistantLight","fedropshadow":"feDropShadow","feflood":"feFlood","fefunca":"feFuncA","fefuncb":"feFuncB","fefuncg":"feFuncG","fefuncr":"feFuncR","fegaussianblur":"feGaussianBlur","feimage":"feImage","femerge":"feMerge","femergenode":"feMergeNode","femorphology":"feMorphology","feoffset":"feOffset","fepointlight":"fePointLight","fespecularlighting":"feSpecularLighting","fespotlight":"feSpotLight","fetile":"feTile","feturbulence":"feTurbulence","foreignobject":"foreignObject","glyphref":"glyphRef","lineargradient":"linearGradient","radialgradient":"radialGradient","textpath":"textPath"},"attributeNames":{"definitionurl":"definitionURL","attributename":"attributeName","attributetype":"attributeType","basefrequency":"baseFrequency","baseprofile":"baseProfile","calcmode":"calcMode","clippathunits":"clipPathUnits","diffuseconstant":"diffuseConstant","edgemode":"edgeMode","filterunits":"filterUnits","glyphref":"glyphRef","gradienttransform":"gradientTransform","gradientunits":"gradientUnits","kernelmatrix":"kernelMatrix","kernelunitlength":"kernelUnitLength","keypoints":"keyPoints","keysplines":"keySplines","keytimes":"keyTimes","lengthadjust":"lengthAdjust","limitingconeangle":"limitingConeAngle","markerheight":"markerHeight","markerunits":"markerUnits","markerwidth":"markerWidth","maskcontentunits":"maskContentUnits","maskunits":"maskUnits","numoctaves":"numOctaves","pathlength":"pathLength","patterncontentunits":"patternContentUnits","patterntransform":"patternTransform","patternunits":"patternUnits","pointsatx":"pointsAtX","pointsaty":"pointsAtY","pointsatz":"pointsAtZ","preservealpha":"preserveAlpha","preserveaspectratio":"preserveAspectRatio","primitiveunits":"primitiveUnits","refx":"refX","refy":"refY","repeatcount":"repeatCount","repeatdur":"repeatDur","requiredextensions":"requiredExtensions","requiredfeatures":"requiredFeatures","specularconstant":"specularConstant","specularexponent":"specularExponent","spreadmethod":"spreadMethod","startoffset":"startOffset","stddeviation":"stdDeviation","stitchtiles":"stitchTiles","surfacescale":"surfaceScale","systemlanguage":"systemLanguage","tablevalues":"tableValues","targetx":"targetX","targety":"targetY","textlength":"textLength","viewbox":"viewBox","viewtarget":"viewTarget","xchannelselector":"xChannelSelector","ychannelselector":"yChannelSelector","zoomandpan":"zoomAndPan"}}')}),(function(o,t){var e=t.getChildren=function(n){return n.children},r=t.getParent=function(n){return n.parent};t.getSiblings=function(n){var i=r(n);return i?e(i):[n]},t.getAttributeValue=function(n,i){return n.attribs&&n.attribs[i]},t.hasAttrib=function(n,i){return!!n.attribs&&hasOwnProperty.call(n.attribs,i)},t.getName=function(n){return n.name}}),(function(o,t){t.removeElement=function(e){if(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e.parent){var r=e.parent.children;r.splice(r.lastIndexOf(e),1)}},t.replaceElement=function(e,r){var n=r.prev=e.prev;n&&(n.next=r);var i=r.next=e.next;i&&(i.prev=r);var a=r.parent=e.parent;if(a){var s=a.children;s[s.lastIndexOf(e)]=r}},t.appendChild=function(e,r){if(r.parent=e,e.children.push(r)!==1){var n=e.children[e.children.length-2];n.next=r,r.prev=n,r.next=null}},t.append=function(e,r){var n=e.parent,i=e.next;if(r.next=i,r.prev=e,e.next=r,r.parent=n,i){if(i.prev=r,n){var a=n.children;a.splice(a.lastIndexOf(i),0,r)}}else n&&n.children.push(r)},t.prepend=function(e,r){var n=e.parent;if(n){var i=n.children;i.splice(i.lastIndexOf(e),0,r)}e.prev&&(e.prev.next=r),r.parent=n,r.prev=e.prev,r.next=e,e.prev=r}}),(function(o,t,e){var r=e(256).isTag;o.exports={filter:n,find:i,findOneChild:a,findOne:s,existsOne:u,findAll:d};function n(M,c,v,p){return Array.isArray(c)||(c=[c]),(typeof p!="number"||!isFinite(p))&&(p=1/0),i(M,c,v!==!1,p)}function i(M,c,v,p){for(var T=[],x,y=0,C=c.length;y<C&&!(M(c[y])&&(T.push(c[y]),--p<=0)||(x=c[y].children,v&&x&&x.length>0&&(x=i(M,x,v,p),T=T.concat(x),p-=x.length,p<=0)));y++);return T}function a(M,c){for(var v=0,p=c.length;v<p;v++)if(M(c[v]))return c[v];return null}function s(M,c){for(var v=null,p=0,T=c.length;p<T&&!v;p++)if(r(c[p]))M(c[p])?v=c[p]:c[p].children.length>0&&(v=s(M,c[p].children));else continue;return v}function u(M,c){for(var v=0,p=c.length;v<p;v++)if(r(c[v])&&(M(c[v])||c[v].children.length>0&&u(M,c[v].children)))return!0;return!1}function d(M,c){for(var v=[],p=c.slice();p.length;){var T=p.shift();r(T)&&(T.children&&T.children.length>0&&p.unshift.apply(p,T.children),M(T)&&v.push(T))}return v}}),(function(o,t,e){var r=e(256),n=t.isTag=r.isTag;t.testElement=function(u,d){for(var M in u)if(u.hasOwnProperty(M)){if(M==="tag_name"){if(!n(d)||!u.tag_name(d.name))return!1}else if(M==="tag_type"){if(!u.tag_type(d.type))return!1}else if(M==="tag_contains"){if(n(d)||!u.tag_contains(d.data))return!1}else if(!d.attribs||!u[M](d.attribs[M]))return!1}return!0};var i={tag_name:function(u){return typeof u=="function"?function(d){return n(d)&&u(d.name)}:u==="*"?n:function(d){return n(d)&&d.name===u}},tag_type:function(u){return typeof u=="function"?function(d){return u(d.type)}:function(d){return d.type===u}},tag_contains:function(u){return typeof u=="function"?function(d){return!n(d)&&u(d.data)}:function(d){return!n(d)&&d.data===u}}};function a(u,d){return typeof d=="function"?function(M){return M.attribs&&d(M.attribs[u])}:function(M){return M.attribs&&M.attribs[u]===d}}function s(u,d){return function(M){return u(M)||d(M)}}t.getElements=function(u,d,M,c){var v=Object.keys(u).map(function(p){var T=u[p];return p in i?i[p](T):a(p,T)});return v.length===0?[]:this.filter(v.reduce(s),d,M,c)},t.getElementById=function(u,d,M){return Array.isArray(d)||(d=[d]),this.findOne(a("id",u),d,M!==!1)},t.getElementsByTagName=function(u,d,M,c){return this.filter(i.tag_name(u),d,M,c)},t.getElementsByTagType=function(u,d,M,c){return this.filter(i.tag_type(u),d,M,c)}}),(function(o,t){t.removeSubsets=function(n){for(var i=n.length,a,s,u;--i>-1;){for(a=s=n[i],n[i]=null,u=!0;s;){if(n.indexOf(s)>-1){u=!1,n.splice(i,1);break}s=s.parent}u&&(n[i]=a)}return n};var e={DISCONNECTED:1,PRECEDING:2,FOLLOWING:4,CONTAINS:8,CONTAINED_BY:16},r=t.compareDocumentPosition=function(n,i){var a=[],s=[],u,d,M,c,v,p;if(n===i)return 0;for(u=n;u;)a.unshift(u),u=u.parent;for(u=i;u;)s.unshift(u),u=u.parent;for(p=0;a[p]===s[p];)p++;return p===0?e.DISCONNECTED:(d=a[p-1],M=d.children,c=a[p],v=s[p],M.indexOf(c)>M.indexOf(v)?d===i?e.FOLLOWING|e.CONTAINED_BY:e.FOLLOWING:d===n?e.PRECEDING|e.CONTAINS:e.PRECEDING)};t.uniqueSort=function(n){var i=n.length,a,s;for(n=n.slice();--i>-1;)a=n[i],s=n.indexOf(a),s>-1&&s<i&&n.splice(i,1);return n.sort(function(u,d){var M=r(u,d);return M&e.PRECEDING?-1:M&e.FOLLOWING?1:0}),n}}),(function(o,t){o.exports={trueFunc:function(){return!0},falseFunc:function(){return!1}}}),(function(o,t,e){o.exports=v;var r=e(275).parse,n=e(273),i=e(278),a=e(279),s=e(280),u=e(282),d=n.trueFunc,M=n.falseFunc,c=u.filters;function v(D,L,j){var b=T(D,L,j);return p(b,L)}function p(D,L){var j=L.adapter;return function(O){return j.isTag(O)&&D(O)}}function T(D,L,j){var b=r(D,L);return m(b,L,j)}function x(D){return D.type==="pseudo"&&(D.name==="scope"||Array.isArray(D.data)&&D.data.some(function(L){return L.some(x)}))}var y={type:"descendant"},C={type:"_flexibleDescendant"},h={type:"pseudo",name:"scope"},g={};function f(D,L,j){var b=L.adapter,O=!!j&&!!j.length&&j.every(function(Y){return Y===g||!!b.getParent(Y)});D.forEach(function(Y){if(!(Y.length>0&&S(Y[0])&&Y[0].type!=="descendant"))if(O&&!(Array.isArray(Y)?Y.some(x):x(Y)))Y.unshift(y);else return;Y.unshift(h)})}function m(D,L,j){D=D.filter(function(X){return X.length>0}),D.forEach(i);var b=Array.isArray(j);j=L&&L.context||j,j&&!b&&(j=[j]),f(D,L,j);var O=!1,Y=D.map(function(X){if(X[0]&&X[1]&&X[0].name==="scope"){var Z=X[1].type;b&&Z==="descendant"?X[1]=C:(Z==="adjacent"||Z==="sibling")&&(O=!0)}return A(X,L,j)}).reduce(P,M);return Y.shouldTestNextSiblings=O,Y}function S(D){return a[D.type]<0}function A(D,L,j){return D.reduce(function(b,O){if(b===M)return b;if(!(O.type in s))throw new Error("Rule type "+O.type+" is not supported by css-select");return s[O.type](b,O,L,j)},L&&L.rootFunc||d)}function P(D,L){return L===M||D===d?D:D===M||L===d?L:function(b){return D(b)||L(b)}}function R(D){return D.some(S)}c.not=function(D,L,j,b){var O={xmlMode:!!(j&&j.xmlMode),strict:!!(j&&j.strict),adapter:j.adapter};if(O.strict&&(L.length>1||L.some(R)))throw new Error("complex selectors in :not aren't allowed in strict mode");var Y=m(L,O,b);return Y===M?D:Y===d?M:function(Z){return!Y(Z)&&D(Z)}},c.has=function(D,L,j){var b=j.adapter,O={xmlMode:!!(j&&j.xmlMode),strict:!!(j&&j.strict),adapter:b},Y=L.some(R)?[g]:null,X=m(L,O,Y);return X===M?M:X===d?function($){return b.getChildren($).some(b.isTag)&&D($)}:(X=p(X,j),Y?function($){return D($)&&(Y[0]=$,b.existsOne(X,b.getChildren($)))}:function($){return D($)&&b.existsOne(X,b.getChildren($))})},c.matches=function(D,L,j,b){var O={xmlMode:!!(j&&j.xmlMode),strict:!!(j&&j.strict),rootFunc:D,adapter:j.adapter};return m(L,O,b)},v.compileToken=m,v.compileUnsafe=T,v.Pseudos=u}),(function(o,t,e){var r=this&&this.__createBinding||(Object.create?(function(s,u,d,M){M===void 0&&(M=d),Object.defineProperty(s,M,{enumerable:!0,get:function(){return u[d]}})}):(function(s,u,d,M){M===void 0&&(M=d),s[M]=u[d]})),n=this&&this.__exportStar||function(s,u){for(var d in s)d!=="default"&&!u.hasOwnProperty(d)&&r(u,s,d)};Object.defineProperty(t,"__esModule",{value:!0}),n(e(276),t);var i=e(276);Object.defineProperty(t,"parse",{enumerable:!0,get:function(){return i.default}});var a=e(277);Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return a.default}})}),(function(o,t,e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=x;var r=/^[^\\]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\-\u00b0-\uFFFF])+/,n=/\\([\da-f]{1,6}\s?|(\s)|.)/gi,i=/^\s*((?:\\.|[\w\u00b0-\uFFFF-])+)\s*(?:(\S?)=\s*(?:(['"])([^]*?)\3|(#?(?:\\.|[\w\u00b0-\uFFFF-])*)|)|)\s*(i)?\]/,a={undefined:"exists","":"equals","~":"element","^":"start",$:"end","*":"any","!":"not","|":"hyphen"},s={">":"child","<":"parent","~":"sibling","+":"adjacent"},u={"#":["id","equals"],".":["class","element"]},d=new Set(["has","not","matches"]),M=new Set(["contains","icontains"]),c=new Set(['"',"'"]);function v(h,g,f){var m=parseInt(g,16)-65536;return m!==m||f?g:m<0?String.fromCharCode(m+65536):String.fromCharCode(m>>10|55296,m&1023|56320)}function p(h){return h.replace(n,v)}function T(h){return h===" "||h===`
|
||
`||h===" "||h==="\f"||h==="\r"}function x(h,g){var f=[];if(h=y(f,""+h,g),h!=="")throw new Error("Unmatched selector: "+h);return f}function y(h,g,f){var m=[],S=!1;function A(){var tt=g.match(r);if(!tt)throw new Error("Expected name, found "+g);var lt=tt[0];return g=g.substr(lt.length),p(lt)}function P(tt){for(;T(g.charAt(tt));)tt++;g=g.substr(tt)}function R(tt){for(var lt=0;g.charAt(--tt)==="\\";)lt++;return(lt&1)===1}for(P(0);g!=="";){var D=g.charAt(0);if(T(D))S=!0,P(1);else if(D in s)m.push({type:s[D]}),S=!1,P(1);else if(D===","){if(m.length===0)throw new Error("Empty sub-selector");h.push(m),m=[],S=!1,P(1)}else if(S&&(m.length>0&&m.push({type:"descendant"}),S=!1),D==="*")g=g.substr(1),m.push({type:"universal"});else if(D in u){var L=u[D],j=L[0],b=L[1];g=g.substr(1),m.push({type:"attribute",name:j,action:b,value:A(),ignoreCase:!1})}else if(D==="["){g=g.substr(1);var O=g.match(i);if(!O)throw new Error("Malformed attribute selector: "+g);g=g.substr(O[0].length);var Y=p(O[1]);(!f||("lowerCaseAttributeNames"in f?f.lowerCaseAttributeNames:!f.xmlMode))&&(Y=Y.toLowerCase()),m.push({type:"attribute",name:Y,action:a[O[2]],value:p(O[4]||O[5]||""),ignoreCase:!!O[6]})}else if(D===":"){if(g.charAt(1)===":"){g=g.substr(2),m.push({type:"pseudo-element",name:A().toLowerCase()});continue}g=g.substr(1);var X=A().toLowerCase(),O=null;if(g.charAt(0)==="(")if(d.has(X)){var Z=g.charAt(1),$=c.has(Z);if(g=g.substr($?2:1),O=[],g=y(O,g,f),$){if(g.charAt(0)!==Z)throw new Error("Unmatched quotes in :"+X);g=g.substr(1)}if(g.charAt(0)!==")")throw new Error("Missing closing parenthesis in :"+X+" ("+g+")");g=g.substr(1)}else{for(var rt=1,F=1;F>0&&rt<g.length;rt++)g.charAt(rt)==="("&&!R(rt)?F++:g.charAt(rt)===")"&&!R(rt)&&F--;if(F)throw new Error("Parenthesis not matched");if(O=g.substr(1,rt-2),g=g.substr(rt),M.has(X)){var Z=O.charAt(0);Z===O.slice(-1)&&c.has(Z)&&(O=O.slice(1,-1)),O=p(O)}}m.push({type:"pseudo",name:X,data:O})}else if(r.test(g)){var Q=A();(!f||("lowerCaseTags"in f?f.lowerCaseTags:!f.xmlMode))&&(Q=Q.toLowerCase()),m.push({type:"tag",name:Q})}else return m.length&&m[m.length-1].type==="descendant"&&m.pop(),C(h,m),g}return C(h,m),g}function C(h,g){if(h.length>0&&g.length===0)throw new Error("Empty sub-selector");h.push(g)}}),(function(o,t,e){Object.defineProperty(t,"__esModule",{value:!0});var r={equals:"",element:"~",start:"^",end:"$",any:"*",not:"!",hyphen:"|"};function n(u){return u.map(i).join(", ")}t.default=n;function i(u){return u.map(a).join("")}function a(u){switch(u.type){case"child":return" > ";case"parent":return" < ";case"sibling":return" ~ ";case"adjacent":return" + ";case"descendant":return" ";case"universal":return"*";case"tag":return u.name;case"pseudo-element":return"::"+u.name;case"pseudo":return u.data===null?":"+u.name:typeof u.data=="string"?":"+u.name+"("+u.data+")":":"+u.name+"("+n(u.data)+")";case"attribute":return u.action==="exists"?"["+u.name+"]":u.name==="id"&&u.action==="equals"&&!u.ignoreCase?"#"+u.value:u.name==="class"&&u.action==="element"&&!u.ignoreCase?"."+u.value:"["+u.name+r[u.action]+"='"+u.value+"'"+(u.ignoreCase?"i":"")+"]";default:throw new Error("Unknown type")}}function s(u){return u}}),(function(o,t,e){o.exports=i;var r=e(279),n={__proto__:null,exists:10,equals:8,not:7,start:6,end:6,any:5,hyphen:4,element:4};function i(s){for(var u=s.map(a),d=1;d<s.length;d++){var M=u[d];if(!(M<0))for(var c=d-1;c>=0&&M<u[c];c--){var v=s[c+1];s[c+1]=s[c],s[c]=v,u[c+1]=u[c],u[c]=M}}}function a(s){var u=r[s.type];if(u===r.attribute)u=n[s.action],u===n.equals&&s.name==="id"&&(u=9),s.ignoreCase&&(u>>=1);else if(u===r.pseudo)if(!s.data)u=3;else if(s.name==="has"||s.name==="contains")u=0;else if(s.name==="matches"||s.name==="not"){u=0;for(var d=0;d<s.data.length;d++)if(s.data[d].length===1){var M=a(s.data[d][0]);if(M===0){u=0;break}M>u&&(u=M)}s.data.length>1&&u>0&&(u-=1)}else u=1;return u}}),(function(o){o.exports=JSON.parse('{"universal":50,"tag":30,"attribute":1,"pseudo":0,"descendant":-1,"child":-1,"parent":-1,"sibling":-1,"adjacent":-1}')}),(function(o,t,e){var r=e(281),n=e(282);o.exports={__proto__:null,attribute:r.compile,pseudo:n.compile,tag:function(i,a,s){var u=a.name,d=s.adapter;return function(c){return d.getName(c)===u&&i(c)}},descendant:function(i,a,s){var u=typeof WeakSet<"u"?new WeakSet:null,d=s.adapter;return function(c){for(var v=!1;!v&&(c=d.getParent(c));)(!u||!u.has(c))&&(v=i(c),!v&&u&&u.add(c));return v}},_flexibleDescendant:function(i,a,s){var u=s.adapter;return function(M){for(var c=i(M);!c&&(M=u.getParent(M));)c=i(M);return c}},parent:function(i,a,s){if(s&&s.strict)throw new Error("Parent selector isn't part of CSS3");var u=s.adapter;return function(c){return u.getChildren(c).some(d)};function d(M){return u.isTag(M)&&i(M)}},child:function(i,a,s){var u=s.adapter;return function(M){var c=u.getParent(M);return!!c&&i(c)}},sibling:function(i,a,s){var u=s.adapter;return function(M){for(var c=u.getSiblings(M),v=0;v<c.length;v++)if(u.isTag(c[v])){if(c[v]===M)break;if(i(c[v]))return!0}return!1}},adjacent:function(i,a,s){var u=s.adapter;return function(M){for(var c=u.getSiblings(M),v,p=0;p<c.length;p++)if(u.isTag(c[p])){if(c[p]===M)break;v=c[p]}return!!v&&i(v)}},universal:function(i){return i}}}),(function(o,t,e){var r=e(273).falseFunc,n=/[-[\]{}()*+?.,\\^$|#\s]/g,i={__proto__:null,equals:function(a,s,u){var d=s.name,M=s.value,c=u.adapter;return s.ignoreCase?(M=M.toLowerCase(),function(p){var T=c.getAttributeValue(p,d);return T!=null&&T.toLowerCase()===M&&a(p)}):function(p){return c.getAttributeValue(p,d)===M&&a(p)}},hyphen:function(a,s,u){var d=s.name,M=s.value,c=M.length,v=u.adapter;return s.ignoreCase?(M=M.toLowerCase(),function(T){var x=v.getAttributeValue(T,d);return x!=null&&(x.length===c||x.charAt(c)==="-")&&x.substr(0,c).toLowerCase()===M&&a(T)}):function(T){var x=v.getAttributeValue(T,d);return x!=null&&x.substr(0,c)===M&&(x.length===c||x.charAt(c)==="-")&&a(T)}},element:function(a,s,u){var d=s.name,M=s.value,c=u.adapter;if(/\s/.test(M))return r;M=M.replace(n,"\\$&");var v="(?:^|\\s)"+M+"(?:$|\\s)",p=s.ignoreCase?"i":"",T=new RegExp(v,p);return function(y){var C=c.getAttributeValue(y,d);return C!=null&&T.test(C)&&a(y)}},exists:function(a,s,u){var d=s.name,M=u.adapter;return function(v){return M.hasAttrib(v,d)&&a(v)}},start:function(a,s,u){var d=s.name,M=s.value,c=M.length,v=u.adapter;return c===0?r:s.ignoreCase?(M=M.toLowerCase(),function(T){var x=v.getAttributeValue(T,d);return x!=null&&x.substr(0,c).toLowerCase()===M&&a(T)}):function(T){var x=v.getAttributeValue(T,d);return x!=null&&x.substr(0,c)===M&&a(T)}},end:function(a,s,u){var d=s.name,M=s.value,c=-M.length,v=u.adapter;return c===0?r:s.ignoreCase?(M=M.toLowerCase(),function(T){var x=v.getAttributeValue(T,d);return x!=null&&x.substr(c).toLowerCase()===M&&a(T)}):function(T){var x=v.getAttributeValue(T,d);return x!=null&&x.substr(c)===M&&a(T)}},any:function(a,s,u){var d=s.name,M=s.value,c=u.adapter;if(M==="")return r;if(s.ignoreCase){var v=new RegExp(M.replace(n,"\\$&"),"i");return function(T){var x=c.getAttributeValue(T,d);return x!=null&&v.test(x)&&a(T)}}return function(T){var x=c.getAttributeValue(T,d);return x!=null&&x.indexOf(M)>=0&&a(T)}},not:function(a,s,u){var d=s.name,M=s.value,c=u.adapter;return M===""?function(p){return!!c.getAttributeValue(p,d)&&a(p)}:s.ignoreCase?(M=M.toLowerCase(),function(p){var T=c.getAttributeValue(p,d);return T!=null&&T.toLowerCase()!==M&&a(p)}):function(p){return c.getAttributeValue(p,d)!==M&&a(p)}}};o.exports={compile:function(a,s,u){if(u&&u.strict&&(s.ignoreCase||s.action==="not"))throw new Error("Unsupported attribute selector");return i[s.action](a,s,u)},rules:i}}),(function(o,t,e){var r=e(283),n=e(273),i=e(281),a=n.trueFunc,s=n.falseFunc,u=i.rules.equals;function d(C,h){var g={name:C,value:h};return function(m,S,A){return u(m,g,A)}}function M(C,h){return function(g){return!!h.getParent(g)&&C(g)}}var c={contains:function(C,h,g){var f=g.adapter;return function(S){return C(S)&&f.getText(S).indexOf(h)>=0}},icontains:function(C,h,g){var f=h.toLowerCase(),m=g.adapter;return function(A){return C(A)&&m.getText(A).toLowerCase().indexOf(f)>=0}},"nth-child":function(C,h,g){var f=r(h),m=g.adapter;return f===s?f:f===a?M(C,m):function(A){for(var P=m.getSiblings(A),R=0,D=0;R<P.length;R++)if(m.isTag(P[R])){if(P[R]===A)break;D++}return f(D)&&C(A)}},"nth-last-child":function(C,h,g){var f=r(h),m=g.adapter;return f===s?f:f===a?M(C,m):function(A){for(var P=m.getSiblings(A),R=0,D=P.length-1;D>=0;D--)if(m.isTag(P[D])){if(P[D]===A)break;R++}return f(R)&&C(A)}},"nth-of-type":function(C,h,g){var f=r(h),m=g.adapter;return f===s?f:f===a?M(C,m):function(A){for(var P=m.getSiblings(A),R=0,D=0;D<P.length;D++)if(m.isTag(P[D])){if(P[D]===A)break;m.getName(P[D])===m.getName(A)&&R++}return f(R)&&C(A)}},"nth-last-of-type":function(C,h,g){var f=r(h),m=g.adapter;return f===s?f:f===a?M(C,m):function(A){for(var P=m.getSiblings(A),R=0,D=P.length-1;D>=0;D--)if(m.isTag(P[D])){if(P[D]===A)break;m.getName(P[D])===m.getName(A)&&R++}return f(R)&&C(A)}},root:function(C,h,g){var f=g.adapter;return function(m){return!f.getParent(m)&&C(m)}},scope:function(C,h,g,f){var m=g.adapter;if(!f||f.length===0)return c.root(C,h,g);function S(A,P){return typeof m.equals=="function"?m.equals(A,P):A===P}return f.length===1?function(A){return S(f[0],A)&&C(A)}:function(A){return f.indexOf(A)>=0&&C(A)}},checkbox:d("type","checkbox"),file:d("type","file"),password:d("type","password"),radio:d("type","radio"),reset:d("type","reset"),image:d("type","image"),submit:d("type","submit"),hover:function(C,h,g){var f=g.adapter;return typeof f.isHovered=="function"?function(S){return C(S)&&f.isHovered(S)}:s},visited:function(C,h,g){var f=g.adapter;return typeof f.isVisited=="function"?function(S){return C(S)&&f.isVisited(S)}:s},active:function(C,h,g){var f=g.adapter;return typeof f.isActive=="function"?function(S){return C(S)&&f.isActive(S)}:s}};function v(C,h){for(var g=0;C&&g<C.length;g++)if(h.isTag(C[g]))return C[g]}var p={empty:function(C,h){return!h.getChildren(C).some(function(g){return h.isTag(g)||g.type==="text"})},"first-child":function(C,h){return v(h.getSiblings(C),h)===C},"last-child":function(C,h){for(var g=h.getSiblings(C),f=g.length-1;f>=0;f--){if(g[f]===C)return!0;if(h.isTag(g[f]))break}return!1},"first-of-type":function(C,h){for(var g=h.getSiblings(C),f=0;f<g.length;f++)if(h.isTag(g[f])){if(g[f]===C)return!0;if(h.getName(g[f])===h.getName(C))break}return!1},"last-of-type":function(C,h){for(var g=h.getSiblings(C),f=g.length-1;f>=0;f--)if(h.isTag(g[f])){if(g[f]===C)return!0;if(h.getName(g[f])===h.getName(C))break}return!1},"only-of-type":function(C,h){for(var g=h.getSiblings(C),f=0,m=g.length;f<m;f++)if(h.isTag(g[f])){if(g[f]===C)continue;if(h.getName(g[f])===h.getName(C))return!1}return!0},"only-child":function(C,h){for(var g=h.getSiblings(C),f=0;f<g.length;f++)if(h.isTag(g[f])&&g[f]!==C)return!1;return!0},link:function(C,h){return h.hasAttrib(C,"href")},selected:function(C,h){if(h.hasAttrib(C,"selected"))return!0;if(h.getName(C)!=="option")return!1;var g=h.getParent(C);if(!g||h.getName(g)!=="select"||h.hasAttrib(g,"multiple"))return!1;for(var f=h.getChildren(g),m=!1,S=0;S<f.length;S++)if(h.isTag(f[S]))if(f[S]===C)m=!0;else if(m){if(h.hasAttrib(f[S],"selected"))return!1}else return!1;return m},disabled:function(C,h){return h.hasAttrib(C,"disabled")},enabled:function(C,h){return!h.hasAttrib(C,"disabled")},checked:function(C,h){return h.hasAttrib(C,"checked")||p.selected(C,h)},required:function(C,h){return h.hasAttrib(C,"required")},optional:function(C,h){return!h.hasAttrib(C,"required")},parent:function(C,h){return!p.empty(C,h)},header:T(["h1","h2","h3","h4","h5","h6"]),button:function(C,h){var g=h.getName(C);return g==="button"||g==="input"&&h.getAttributeValue(C,"type")==="button"},input:T(["input","textarea","select","button"]),text:function(C,h){var g;return h.getName(C)==="input"&&(!(g=h.getAttributeValue(C,"type"))||g.toLowerCase()==="text")}};function T(C){if(typeof Set<"u"){var h=new Set(C);return function(g,f){return h.has(f.getName(g))}}return function(g,f){return C.indexOf(f.getName(g))>=0}}function x(C,h,g){if(g===null){if(C.length>2&&h!=="scope")throw new Error("pseudo-selector :"+h+" requires an argument")}else if(C.length===2)throw new Error("pseudo-selector :"+h+" doesn't have any arguments")}var y=/^(?:(?:nth|last|first|only)-(?:child|of-type)|root|empty|(?:en|dis)abled|checked|not)$/;o.exports={compile:function(C,h,g,f){var m=h.name,S=h.data,A=g.adapter;if(g&&g.strict&&!y.test(m))throw new Error(":"+m+" isn't part of CSS3");if(typeof c[m]=="function")return c[m](C,S,g,f);if(typeof p[m]=="function"){var P=p[m];return x(P,m,S),P===s?P:C===a?function(D){return P(D,A,S)}:function(D){return P(D,A,S)&&C(D)}}else throw new Error("unmatched pseudo-class :"+m)},filters:c,pseudos:p}}),(function(o,t,e){var r=e(284),n=e(285);o.exports=function(a){return n(r(a))},o.exports.parse=r,o.exports.compile=n}),(function(o,t){o.exports=r;var e=/^([+\-]?\d*n)?\s*(?:([+\-]?)\s*(\d+))?$/;function r(n){if(n=n.trim().toLowerCase(),n==="even")return[2,0];if(n==="odd")return[2,1];var i=n.match(e);if(!i)throw new SyntaxError("n-th rule couldn't be parsed ('"+n+"')");var a;return i[1]?(a=parseInt(i[1],10),isNaN(a)&&(i[1].charAt(0)==="-"?a=-1:a=1)):a=0,[a,i[3]?parseInt((i[2]||"")+i[3],10):0]}}),(function(o,t,e){o.exports=a;var r=e(273),n=r.trueFunc,i=r.falseFunc;function a(s){var u=s[0],d=s[1]-1;if(d<0&&u<=0)return i;if(u===-1)return function(c){return c<=d};if(u===0)return function(c){return c===d};if(u===1)return d<0?n:function(c){return c>=d};var M=d%u;return M<0&&(M+=u),u>1?function(c){return c>=d&&c%u===M}:(u*=-1,function(c){return c<=d&&c%u===M})}}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return S});var r=e(12),n=e(74),i=e(1),a=e(68),s=e(250),u=e(213),d=e(218);e(1).glMatrix.setMatrixArrayType(Array);function M(A,P){if(A==null)return{};var R=c(A,P),D,L;if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(A);for(L=0;L<j.length;L++)D=j[L],!(P.indexOf(D)>=0)&&Object.prototype.propertyIsEnumerable.call(A,D)&&(R[D]=A[D])}return R}function c(A,P){if(A==null)return{};var R={},D=Object.keys(A),L,j;for(j=0;j<D.length;j++)L=D[j],!(P.indexOf(L)>=0)&&(R[L]=A[L]);return R}const v={antialias:!0,autoRender:!0,alpha:!0},p=Symbol("autoRender"),T=Symbol("renderer"),x=Symbol("timeline"),y=Symbol("prepareRender"),C=Symbol("tickRender"),h=Symbol("pass"),g=Symbol("fbo"),f=Symbol("tickers"),m=Symbol("layerTransformInvert");class S extends s.default{constructor(P={}){if(super(),!P.canvas){const{width:j,height:b}=this.getResolution(),O=r.ENV.createCanvas(j,b,{offscreen:!!P.offscreen,id:P.id,extra:P.extra});O.style&&(O.style.position="absolute"),O.dataset&&(O.dataset.layerId=P.id),O.contextType&&(P.contextType=O.contextType),P.canvas=O}const R=P.canvas,D=Object.assign({},v,P);this[p]=D.autoRender,delete P.autoRender;const L=D.Renderer||r.Renderer;this[T]=new L(R,D),this.options=P,this.id=P.id,this[h]=[],this.setResolution(R),this.canvas=R,this[x]=new n.Timeline,this.__mouseCapturedTarget=null,this[m]=null}get autoRender(){return this[p]}get displayRatio(){return this.parent&&this.parent.options?this.parent.options.displayRatio:1}get height(){const{height:P}=this.getResolution();return P/this.displayRatio}get gl(){return this.renderer.glRenderer?this.renderer.glRenderer.gl:null}get layer(){return this}get offscreen(){return!!this.options.offscreen||this.canvas._offscreen}get pass(){return this[h]}get prepareRender(){return this[y]?this[y]:Promise.resolve()}get renderer(){return this[T]}get renderOffset(){if(this.parent&&this.parent.options){const{left:P,top:R}=this.parent.options;return[P,R]}return[this.options.left|0,this.options.top|0]}get timeline(){return this[x]}get width(){const{width:P}=this.getResolution();return P/this.displayRatio}get localMatrix(){const{x:P,y:R}=this.attributes;return[1,0,0,1,P,R]}get layerTransformInvert(){if(this[m])return this[m];const P=this.transformMatrix;return P[0]===1&&P[1]===0&&P[2]===0&&P[3]===1&&P[4]===0&&P[5]===0?null:(this[m]=i.mat2d.invert(Array.of(0,0,0,0,0,0),P),this[m])}forceContextLoss(){const P=this.renderer.glRenderer;if(P){const R=P.getExtension("WEBGL_lose_context");if(R)return R.loseContext(),!0}return!1}addPass({vertex:P,fragment:R,options:D,uniforms:L}={}){if(this.renderer.glRenderer){const{width:j,height:b}=this.getResolution(),O=this.renderer.createPassProgram({vertex:P,fragment:R,options:D}),Y=new r.Figure2D;Y.rect(0,0,j/this.displayRatio,b/this.displayRatio);const X=new r.Mesh2D(Y);return X.setUniforms(L),X.setProgram(O),this[h].push(X),this.forceUpdate(),X}return null}deleteTexture(P){return Object(d.deleteTexture)(P,this.renderer)}dispatchPointerEvent(P){const R=P.type;if(R==="mousedown"||R==="mouseup"||R==="mousemove"){const O=this.__mouseCapturedTarget;if(O){if(O.layer===this)return O.dispatchEvent(P),!0;this.__mouseCapturedTarget=null}}let D,L;const j=this.layerTransformInvert;if(j){D=P.x,L=P.y;const O=j,Y=O[0]*D+O[2]*L+O[4],X=O[1]*D+O[3]*L+O[5];delete P.x,delete P.y,delete P.layerX,delete P.layerY,Object.defineProperties(P,{layerX:{value:Y,configurable:!0},layerY:{value:X,configurable:!0},x:{value:Y,configurable:!0},y:{value:X,configurable:!0}})}const b=super.dispatchPointerEvent(P);return j&&Object.defineProperties(P,{layerX:{value:D,configurable:!0},layerY:{value:L,configurable:!0},x:{value:D,configurable:!0},y:{value:L,configurable:!0}}),b}forceUpdate(){if(!this[y])if(this.parent&&this.parent.hasOffscreenCanvas){this.parent.forceUpdate();let P=null;const R=new Promise(D=>{P=D});R._resolve=P,this[y]=R}else{let P=null,R=null;const D=new Promise(L=>{P=L,this[p]&&(R=Object(a.requestAnimationFrame)(()=>{delete D._requestID,this.render()}))});D._resolve=P,D._requestID=R,this[y]=D}}getFBO(){const P=this.renderer.glRenderer,{width:R,height:D}=this.getResolution();return P&&(!this[g]||this[g].width!==R||this[g].height!==D)?(this[g]={width:R,height:D,target:P.createFBO(),buffer:P.createFBO(),swap(){[this.target,this.buffer]=[this.buffer,this.target]}},this[g]):this[g]?this[g]:null}updateGlobalTransform(){if(this.layerTransformInvert){const P=this.renderer,R=P.__globalTransformMatrix||P.globalTransformMatrix;P.__globalTransformMatrix=R;const D=i.mat2d.fromValues(1,0,0,1,0,0);P.setGlobalTransform(...i.mat2d.multiply(D,R,this.transformMatrix))}}onPropertyChange(P,R,D){if(super.onPropertyChange(P,R,D),P==="zIndex"&&(this.canvas.style.zIndex=R),P==="transform"||P==="translate"||P==="rotate"||P==="scale"||P==="skew"){const L=this[m];if(this[m]=null,this.updateGlobalTransform(),L&&!this.layerTransformInvert){const j=this.renderer,b=j.__globalTransformMatrix||j.globalTransformMatrix;j.setGlobalTransform(...b)}}}_prepareRenderFinished(){this[y]&&(this[y]._requestID&&Object(a.cancelAnimationFrame)(this[y]._requestID),this[y]._resolve(),delete this[y])}render({clear:P=!0}={}){const R=this[h].length?this.getFBO():null;R&&this.renderer.glRenderer.bindFBO(R.target),P&&this[T].clear();const D=this.draw();if(D&&D.length&&(this.renderer.drawMeshes(D),this.canvas.draw&&this.canvas.draw()),R){const L=this.renderer.glRenderer,j=this[h].length,{width:b,height:O}=this.getResolution(),Y=[0,0,b/this.displayRatio,O/this.displayRatio];this[h].forEach((X,Z)=>{X.blend=!0,X.setTexture(R.target.texture,{rect:Y}),Z===j-1?L.bindFBO(null):(R.swap(),L.bindFBO(R.target)),this[T].clear(),this.renderer.drawMeshes([X])})}this._prepareRenderFinished()}setResolution({width:P,height:R}){const D=this.renderer,L=D.__globalTransformMatrix||D.globalTransformMatrix,j=L[4],b=L[5],O=L[0],{width:Y,height:X}=this.getResolution();(Y!==P||X!==R)&&(super.setResolution({width:P,height:R}),this.canvas&&(this.canvas.width=P,this.canvas.height=R,D.updateResolution&&D.updateResolution()),this.attributes.size=[P,R],this[h].length&&this[h].forEach(F=>{const Q=new r.Figure2D;Q.rect(0,0,P/this.displayRatio,R/this.displayRatio),F.contours=Q.contours}));const[Z,$]=this.renderOffset,rt=this.displayRatio;(j!==Z||b!==$||O!==rt)&&(D.setGlobalTransform(rt,0,0,rt,Z,$),D.__globalTransformMatrix=null,this[m]=null,this.updateGlobalTransform(),this.forceUpdate())}tick(P=null,R={}){let{duration:D=1/0}=R,L=M(R,["duration"]);const j=this.timeline.fork(L),b=this;this[f]=this[f]||[],this[f].push({handler:P,duration:D});const O=()=>{let Y=null,X=null;const Z=()=>{const $=this[f].map(({handler:rt,duration:F})=>{const Q=Math.min(1,j.currentTime/F);return{value:rt?rt(j.currentTime,Q):null,p:Q}});b[C]||(b[C]=Promise.resolve().then(()=>{b[p]&&b.render(),delete b[C];for(let rt=$.length-1;rt>=0;rt--){const{value:F,p:Q}=$[rt];(F===!1||Q>=1)&&this[f].splice(rt,1)}this[f].length>0&&O()}))};if(this[y]&&this[y]._type!=="ticker"&&(Object(a.cancelAnimationFrame)(this[y]._requestID),delete this[y]),!this[y]){const $=new Promise(rt=>{Y=rt,X=Object(a.requestAnimationFrame)(Z)});$._resolve=Y,$._requestID=X,$._type="ticker",this[y]=$}};O()}toGlobalPos(P,R){if(this.layerTransformInvert){const Y=this.transformMatrix;P=Y[0]*P+Y[2]*R+Y[4],R=Y[1]*P+Y[3]*R+Y[5]}const{width:D,height:L}=this.getResolution(),j=this.renderOffset,b=[this.canvas.clientWidth,this.canvas.clientHeight];P=P*b[0]/D+j[0],R=R*b[1]/L+j[1];const O=this.displayRatio;return P*=O,R*=O,[P,R]}toLocalPos(P,R){const{width:D,height:L}=this.getResolution(),j=this.renderOffset,b=[this.canvas.clientWidth,this.canvas.clientHeight];P=P*D/b[0]-j[0],R=R*L/b[1]-j[1];const O=this.displayRatio;P/=O,R/=O;const Y=this.layerTransformInvert;return Y&&(P=Y[0]*P+Y[2]*R+Y[4],R=Y[1]*P+Y[3]*R+Y[5]),[P,R]}}u.default.registerNode(S,"layer")}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return y});var r=e(224),n=e(288),i=e(213),a=e(252),s=e(72);e(1).glMatrix.setMatrixArrayType(Array);function u(C,h){if(C==null)return{};var g=d(C,h),f,m;if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(C);for(m=0;m<S.length;m++)f=S[m],!(h.indexOf(f)>=0)&&Object.prototype.propertyIsEnumerable.call(C,f)&&(g[f]=C[f])}return g}function d(C,h){if(C==null)return{};var g={},f=Object.keys(C),m,S;for(S=0;S<f.length;S++)m=f[S],!(h.indexOf(m)>=0)&&(g[m]=C[m]);return g}function M(C,h,g){return h in C?Object.defineProperty(C,h,{value:g,enumerable:!0,configurable:!0,writable:!0}):C[h]=g,C}const c="http://www.w3.org/2000/svg",v=Symbol.for("spritejs_setAttribute"),p=Symbol("root"),T=Symbol("task");function x(C,h=!0){const g=C[p];if(g&&g.children[0]){const f=C.svg,m=C.layer?C.layer.displayRatio:1;if(!f.hasAttribute("data-original-width")){let P=f.getAttribute("width");P=P?Object(s.sizeToPixel)(P):300;let R=f.getAttribute("height");R=R?Object(s.sizeToPixel)(R):150,f.hasAttribute("viewBox")||f.setAttribute("viewBox",`0 0 ${Math.round(P)} ${Math.round(R)}`),f.setAttribute("data-original-width",P),f.setAttribute("data-original-height",R)}let S=C.attributes.width||Number(f.getAttribute("data-original-width")),A=C.attributes.height||Number(f.getAttribute("data-original-height"));if(S*=m,A*=m,h&&C.attributes.flexible){const P=C.attributes.scale[0];if(S*=P,A*=P,f.setAttribute("width",S),f.setAttribute("height",A),S&&A&&C.textureImage){const R=C.textureImage.width,D=C.textureImage.height,L=C.clientSize;C.attributes.textureRect=[0,0,Math.round(L[0]*R/S),Math.round(L[1]*D/A)]}}else C[T]||(f.setAttribute("width",S),f.setAttribute("height",A),C[T]=Promise.resolve().then(()=>{delete C[T];const P=g.innerHTML,R=new Blob([P],{type:"image/svg+xml"}),D=URL.createObjectURL(R),L=new Image;L.onload=function(){L.width&&L.height?(C.attributes[v]("texture",L),C.attributes.flexible&&(C.attributes.textureRect=null)):C.attributes[v]("texture",null)},L.src=D}))}}class y extends r.default{constructor(h={}){typeof h=="string"&&(h={svgText:h});let{svgText:g}=h,f=u(h,["svgText"]);if(super(f),this[p]=document.createElement("div"),g){this[p].innerHTML=g;const m=this[p].children[0];m?m.setAttribute("xmlns",c):(fetch(g).then(S=>S.text()).then(S=>{this[p].innerHTML=S,(!this.observer||this.attributes.flexible)&&x(this)}),g=null)}if(!g){const m=document.createElementNS(c,"svg");m.setAttribute("xmlns",c),this[p].appendChild(m)}if(typeof MutationObserver=="function"){const m=new MutationObserver(S=>{x(this,!1)});m.observe(this[p],{attributes:!0,subtree:!0,characterData:!0,childList:!0}),this.observer=m}}get children(){return[this.svg]}get childNodes(){return[this.svg]}get svg(){return this[p]?this[p].children[0]:null}setResolution({width:h,height:g}){super.setResolution({width:h,height:g}),x(this)}dispatchPointerEvent(h){const g=super.dispatchPointerEvent(h);if(g&&this.attributes.passEvents&&typeof MouseEvent=="function"){const{x:f,y:m}=h;let[S,A]=this.getOffsetPosition(f,m);const P=h.originalEvent,R=this.attributes.anchor,D=this.clientSize;S=(S+R[0]*D[0])/2,A=(A+R[1]*D[1])/2;const L=h.type;if(L===P.type){let j=null;if(P instanceof MouseEvent)j=new MouseEvent(L,{screenX:S,screenY:A,clientX:S,clientY:A,bubbles:P.bubbles,button:P.button,buttons:P.buttons,cancelBubble:P.cancelBubble,cancelable:P.cancelable,currentTarget:P.currentTarget,fromElement:P.fromElement,relatedTarget:P.relatedTarget,returnValue:P.returnValue,srcElement:P.srcElement,target:P.target,toElement:P.toElement,which:P.witch});else if(P instanceof TouchEvent){let b=null;const O=P.changedTouches||[P];for(let Y=0;Y<O.length;Y++){const X=O[Y];if(h.identifier===X.identifier){b=X;break}}if(b){const Y=new Touch({identifier:b.identifier,target:b.target,clientX:S,clientY:A,screenX:S,screenY:A,pageX:S,pageY:A,radiusX:b.radiusX,radiusY:b.radiusY,rotationAngle:b.rotationAngle,force:b.force});j=new TouchEvent(L,{cancelable:P.cancelable,bubbles:P.bubbles,composed:P.composed,touches:[Y],targetTouches:[Y],changedTouches:[Y]})}}else j=P;j&&this.svg.dispatchEvent(j)}}return g}getElementById(h){return Object(a.querySelector)(`#${h}`,this)}getElementsByClassName(h){return Object(a.querySelectorAll)(`.${h}`,this)}getElementsByName(h){return Object(a.querySelectorAll)(`[name="${h}"]`,this)}getElementsByTagName(h){return Object(a.querySelectorAll)(h,this)}querySelector(h){return Object(a.querySelector)(h,this)}querySelectorAll(h){return Object(a.querySelectorAll)(h,this)}onPropertyChange(h,g,f){super.onPropertyChange(h,g,f),h==="flexible"&&x(this),this.attributes.flexible&&(h==="width"||h==="height"||h==="scale"||h==="transform")&&x(this)}}M(y,"Attr",n.default),i.default.registerNode(y,"spritesvg")}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return s});var r=e(225);e(1).glMatrix.setMatrixArrayType(Array);const n=Symbol.for("spritejs_getAttribute"),i=Symbol.for("spritejs_setAttribute"),a=Symbol.for("spritejs_setAttributeDefault");class s extends r.default{constructor(d){super(d),this[a]({passEvents:!1,flexible:!1})}get texture(){return this[n]("texture")}set texture(d){}get passEvents(){return this[n]("passEvents")}set passEvents(d){return this[i]("passEvents",d)}get flexible(){return this[n]("flexible")}set flexible(d){return this[i]("flexible",d)}}}),(function(o,t,e){e.r(t);var r=e(12);e(1).glMatrix.setMatrixArrayType(Array);function n(d,M){var c=Object.keys(d);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(d);M&&(v=v.filter(function(p){return Object.getOwnPropertyDescriptor(d,p).enumerable})),c.push.apply(c,v)}return c}function i(d){for(var M=1;M<arguments.length;M++){var c=arguments[M]!=null?arguments[M]:{};M%2?n(Object(c),!0).forEach(function(v){a(d,v,c[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(c)):n(Object(c)).forEach(function(v){Object.defineProperty(d,v,Object.getOwnPropertyDescriptor(c,v))})}return d}function a(d,M,c){return M in d?Object.defineProperty(d,M,{value:c,enumerable:!0,configurable:!0,writable:!0}):d[M]=c,d}const s=Symbol("inited");let u=null;typeof Worker=="function"&&(u=class extends Worker{constructor(d){if(d.worker===!0&&(d.worker=`./${d.id}.worker.js`),super(d.worker),this.options=d,!d.canvas){const{width:M,height:c}=this.getResolution(),v=r.ENV.createCanvas(M,c,{offscreen:!1});v.style&&(v.style.position="absolute"),v.dataset&&(v.dataset.layerId=d.id),d.canvas=v}this.canvas=d.canvas}get id(){return this.options.id}setResolution({width:d,height:M}){if(this[s])this.postMessage({type:"resolution_change",width:d,height:M});else{this.canvas.width=d,this.canvas.height=M;const c=this.options,v=c.canvas.transferControlToOffscreen(),p=i({},c);delete p.container,p.canvas=v,this.postMessage({type:"create",options:p},[v]),this[s]=!0}}getResolution(){if(this.canvas){const{width:d,height:M}=this.canvas;return{width:d,height:M}}return{width:300,height:150}}remove(){return this.parent&&this.parent.removeChild?(this.parent.removeChild(this),!0):!1}connect(d,M){Object.defineProperty(this,"parent",{value:d,writable:!1,configurable:!0}),Object.defineProperty(this,"zOrder",{value:M,writable:!1,configurable:!0})}disconnect(){delete this.parent,delete this.zOrder}dispatchPointerEvent(d){this.postMessage({type:"event",event:{cancelBubble:d.cancelBubble,bubbles:d.bubbles,detail:d.detail,identifier:d.identifier,layerX:d.layerX,layerY:d.layerY,originalX:d.originalX,originalY:d.originalY,type:d.type,x:d.x,y:d.y}})}}),t.default=u}),(function(o,t,e){e.r(t),(function(r){e.d(t,"default",function(){return S});var n=e(12),i=e(68),a=e(70),s=e(286),u=e(289),d=e(250),M=e(291),c=e(214),v=e(218),p=e(213);e(1).glMatrix.setMatrixArrayType(Array);const T=Symbol("enteredTargets");function x(A){return A.id=A.id||`_layer${Math.random().toString(36).slice(2,12)}`,A.dataset||(A.dataset={}),A.dataset.layerId=A.id,A.connect=(P,R)=>{A.parent=P,Object.defineProperty(A,"zOrder",{value:R,writable:!1,configurable:!0})},A.disconnect=P=>{delete A.zOrder},A.canvas=A,A.getResolution=()=>({width:0,height:0}),A.setResolution=()=>!1,A.options={handleEvent:!1},A}function y(A,P){const R=A.children;let D=null;for(let L=0;L<R.length;L++){const j=R[L];if((P===j||D!=null)&&(D=j),D&&D!==P&&!D.offscreen)return D.canvas}return null}function C(A,P){const[R,D]=A.renderOffset,{width:L,height:j}=A.getResolution(),b=A.displayRatio;A.renderer.drawImage(P.canvas,-R/b,-D/b,L/b,j/b)}const h={};function g(A){const P=["mousedown","mouseup","mousemove","mousewheel","wheel","touchstart","touchend","touchmove","touchcancel","click","dblclick","longpress","tap","contextmenu"],R=A.container;R.addEventListener("mouseleave",D=>{const L=A[T];if(L.size){const j=new c.default("mouseleave");j.setOriginalEvent(D),[...L].forEach(b=>{b.dispatchEvent(j)}),A[T].clear()}},{passive:!0}),P.forEach(D=>{R.addEventListener(D,L=>{const{left:j,top:b,displayRatio:O}=A.options,Y=A.orderedChildren;Object(M.default)(L,{offsetLeft:j,offsetTop:b,displayRatio:O}).forEach(Z=>{const $=Z.identifier;if(Z.type==="touchmove"||Z.type==="touchend"){const F=h[$];F&&F.dispatchEvent(Z),Z.type==="touchend"&&delete h[$]}else{for(let F=Y.length-1;F>=0;F--){const Q=Y[F];if(Q.options.handleEvent!==!1){if(Q.dispatchPointerEvent(Z)&&Z.target!==Q)break;Z.cancelBubble=!1}}if(Z.target===Y[0])for(let F=Y.length-1;F>=0;F--){const Q=Y[F];if(Q.options.handleEvent!==!1){Z.target=Q;break}}}const rt=Z.target;if(Z.type==="touchstart"&&(h[$]=Z.target),Z.type==="mousemove"){const F=A[T];let Q;if(rt){const ct=rt.ancestors||[];Q=new Set([rt,...ct])}else Q=new Set;const tt=Object.entries(L);if(!F.has(rt)&&rt){const ct=new c.default("mouseenter");ct.setOriginalEvent(L),tt.forEach(([st,Tt])=>{ct[st]=Tt}),F.add(rt),rt.dispatchEvent(ct);const Mt=rt.ancestors;Mt&&Mt.forEach(st=>{st instanceof a.default&&!F.has(st)&&(F.add(st),st.dispatchEvent(ct))})}const lt=new c.default("mouseleave");lt.setOriginalEvent(L),tt.forEach(([ct,Mt])=>{lt[ct]=Mt}),[...F].forEach(ct=>{Q.has(ct)||(F.delete(ct),ct.dispatchEvent(lt))})}})},{passive:D!=="contextmenu"})})}function f(A,P){if(P&&P.style){let{width:R,height:D,mode:L,container:j}=A;const{clientWidth:b,clientHeight:O}=j;R=R||b,D=D||O,L==="static"?(P.style.width=`${R}px`,P.style.height=`${D}px`):(P.style.top="0",P.style.left="0",P.style.width=`${b}px`,P.style.height=`${O}px`,P.style.transform="",P.style.webkitTransform="")}}const m=Symbol("offscreenLayerCount");class S extends d.default{constructor(P={}){if(super(),!P.container)if(typeof n.ENV.Container=="function")P.container=new n.ENV.Container(P.width||300,P.height||150);else throw new Error("No container specified.");if(this.container=P.container,this.container.style&&(this.container.style.overflow||(this.container.style.overflow="hidden"),this.container.style.position||(this.container.style.position="relative")),this.options=P,P.displayRatio=P.displayRatio||1,P.mode=P.mode||"scale",P.left=0,P.top=0,P.autoResize=P.autoResize!==!1,P.autoResize){let R;if(typeof globalThis<"u"?R=globalThis:R=typeof window<"u"?window:r,R.addEventListener){const D=this;R.addEventListener("resize",function L(){typeof document<"u"&&document.contains(D.container)?D.resize():R.removeEventListener("resize",L)})}}this[T]=new Set,this.setResolution(P),g(this),this[m]=0}get hasOffscreenCanvas(){return this[m]>0}set displayRatio(P){this.options.displayRatio!==P&&(this.options.displayRatio=P,this.resize())}get displayRatio(){return this.options.displayRatio}set height(P){this.options.height!==P&&(this.options.height=P,this.resize())}get height(){return this.options.height}set mode(P){this.options.mode!==P&&(this.options.mode=P,this.resize())}get mode(){return this.options.mode}set width(P){this.options.width!==P&&(this.options.width=P,this.resize())}get width(){return this.options.width}appendChild(P){!(P instanceof s.default)&&!(P instanceof u.default)&&x(P);const R=super.appendChild(P),D=P.canvas;return P.offscreen?this[m]++:this.container.appendChild(D),f(this.options,D),P.setResolution(this.getResolution()),R}forceUpdate(){this.hasOffscreenCanvas&&!this._requestID&&(this._requestID=Object(i.requestAnimationFrame)(()=>{delete this._requestID,this.render()}))}insertBefore(P,R){!(P instanceof s.default)&&!(P instanceof u.default)&&x(P);const D=super.insertBefore(P,R),L=P.canvas;if(!P.offscreen){const j=y(this,P);this.container.insertBefore(L,j)}return f(this.options,L),P.setResolution(this.getResolution()),D}layer(P="default",R={}){R=Object.assign({},this.options,R),R.id=P;const D=this.orderedChildren;for(let b=0;b<D.length;b++)if(D[b].id===P)return D[b];const L=R.worker;let j;return L?j=new u.default(R):j=new s.default(R),this.appendChild(j),j}async preload(...P){const R=[],D=[],L=[];for(let j=0;j<P.length;j++){const b=P[j];let O;if(typeof b=="string")O=Object(v.loadTexture)(b);else if(Array.isArray(b))O=Object(v.loadFrames)(...b);else{const{id:Y,src:X}=b;O=Object(v.loadTexture)(X,Y)}O instanceof Promise||(O=Promise.resolve(O)),D.push(O.then(Y=>{R.push(Y),L[j]=Y;const X=new c.default({type:"preload",detail:{current:Y,loaded:R,resources:P}});this.dispatchEvent(X)}))}return await Promise.all(D),L}removeChild(P){const R=super.removeChild(P);if(R){P._prepareRenderFinished&&P._prepareRenderFinished();const D=P.canvas;D&&D.remove&&D.remove(),P.offscreen&&this[m]--}return R}render(){const P=this.orderedChildren;let R=null;const D=[];for(let L=0;L<P.length;L++){const j=P[L],b=D.length>0;if(j instanceof s.default&&!j.offscreen)if(!j.autoRender)b&&(console.warn("Some offscreen canvas will not be rendered."),D.length=0);else if(R=j,b){j.renderer.clear();for(let O=0;O<D.length;O++){const Y=D[O];Y.render(),C(j,Y)}D.length=0,j.render({clear:!1})}else j.prepareRender&&j.render();else j.offscreen?R?(j.prepareRender&&j.render(),C(R,j)):D.push(j):j instanceof u.default&&b&&(console.warn("Some offscreen canvas will not be rendered."),D.length=0)}}replaceChild(P,R){const D=super.replaceChild(P,R);R.canvas.remove&&R.canvas.remove(),R.offscreen&&this[m]--;const L=P.canvas;if(!P.offscreen){const j=y(this,P);this.container.insertBefore(L,j)}return f(this.options,L),P.setResolution(this.getResolution()),D}resize(){const P=this.options;this.children.forEach(R=>{f(P,R.canvas)}),this.setResolution(P),this.dispatchEvent({type:"resize"})}setResolution({width:P,height:R}={}){const D=this.container,{clientWidth:L,clientHeight:j}=D;(P==null||R==null)&&(P=P??L,R=R??j);const{mode:b,displayRatio:O}=this.options;if(P*=O,R*=O,this.options.left=0,this.options.top=0,b==="stickyHeight"||b==="stickyLeft"||b==="stickyRight"){const Y=P;P=L*R/j,b==="stickyHeight"&&(this.options.left=.5*(P-Y)),b==="stickyRight"&&(this.options.left=P-Y)}else if(b==="stickyWidth"||b==="stickyTop"||b==="stickyBottom"){const Y=R;R=j*P/L,b==="stickyWidth"&&(this.options.top=.5*(R-Y)),b==="stickyBottom"&&(this.options.top=R-Y)}super.setResolution({width:P,height:R})}snapshot({offscreen:P=!1,layers:R}={}){const D=P?"snapshotOffScreenCanvas":"snapshotCanvas",{width:L,height:j}=this.getResolution();this[D]=this[D]||n.ENV.createCanvas(L,j,{offscreen:P});const b=this[D].getContext("2d");R=R||this.orderedChildren,this[D].width=L,this[D].height=j;for(let O=0;O<R.length;O++){const Y=R[O];if(!Y.options.ignoreSnapshot){Y.render&&Y.render();const X=Y.canvas;X&&X!==Y&&b.drawImage(X,0,0,L,j)}}return this[D]}}typeof document<"u"&&(S.prototype.layer3d=function(A,P={}){const R=P.url||"https://unpkg.com/sprite-extend-3d/dist/sprite-extend-3d.min.js";return new Promise((D,L)=>{const j=document.createElement("script");j.async=!1,j.src=R,j.onload=()=>{try{D(this.layer3d(A,P))}catch(b){L(b)}},document.documentElement.appendChild(j)})}),p.default.registerNode(S,"scene")}).call(this,e(22))}),(function(o,t,e){e.r(t),e.d(t,"default",function(){return n});var r=e(214);e(1).glMatrix.setMatrixArrayType(Array);function n(i,{offsetTop:a=0,offsetLeft:s=0,displayRatio:u=1}={}){let d,M;const c=[],{left:v,top:p,width:T,height:x}=i.target.getBoundingClientRect(),y=i.target.width,C=i.target.height,h=i.changedTouches||[i];for(let f=0;f<h.length;f++){const m=h[f],S=m.identifier,{clientX:A,clientY:P}=m;A!=null&&P!=null&&c.push({x:Math.round((A|0)-v),y:Math.round((P|0)-p),identifier:S})}c.length<=0&&c.push({x:d,y:M});const g=[];return c.forEach(f=>{f.x!=null&&f.y!=null&&(d=(f.x*y/T-s)/u,M=(f.y*C/x-a)/u);const m=new r.default(i);Object.defineProperties(m,{layerX:{value:d,configurable:!0},layerY:{value:M,configurable:!0},originalX:{value:f.x},originalY:{value:f.y},x:{value:d,configurable:!0},y:{value:M,configurable:!0},identifier:{value:f.identifier}}),g.push(m)}),g}})]);ee.version;ee.Arc;ee.Block;ee.Cloud;ee.Color;const p1=ee.Ellipse;ee.Gradient;const v1=ee.Group,m1=ee.Label,y1=ee.Layer;ee.LayerWorker;ee.Node;ee.Parallel;const M1=ee.Path,I1=ee.Polyline,T1=ee.Rect;ee.Regular;ee.Ring;const C1=ee.Scene,x1=ee.Sprite;ee.SpriteSvg;ee.Star;ee.Triangle;ee.helpers;ee.createElement;ee.isSpriteNode;ee.registerNode;ee.requestAnimationFrame;ee.cancelAnimationFrame;ee.ENV;var xn={exports:{}},Si;function Ma(){return Si||(Si=1,(function(o){var t=(function(){var e=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",i={};function a(u,d){if(!i[u]){i[u]={};for(var M=0;M<u.length;M++)i[u][u.charAt(M)]=M}return i[u][d]}var s={compressToBase64:function(u){if(u==null)return"";var d=s._compress(u,6,function(M){return r.charAt(M)});switch(d.length%4){default:case 0:return d;case 1:return d+"===";case 2:return d+"==";case 3:return d+"="}},decompressFromBase64:function(u){return u==null?"":u==""?null:s._decompress(u.length,32,function(d){return a(r,u.charAt(d))})},compressToUTF16:function(u){return u==null?"":s._compress(u,15,function(d){return e(d+32)})+" "},decompressFromUTF16:function(u){return u==null?"":u==""?null:s._decompress(u.length,16384,function(d){return u.charCodeAt(d)-32})},compressToUint8Array:function(u){for(var d=s.compress(u),M=new Uint8Array(d.length*2),c=0,v=d.length;c<v;c++){var p=d.charCodeAt(c);M[c*2]=p>>>8,M[c*2+1]=p%256}return M},decompressFromUint8Array:function(u){if(u==null)return s.decompress(u);for(var d=new Array(u.length/2),M=0,c=d.length;M<c;M++)d[M]=u[M*2]*256+u[M*2+1];var v=[];return d.forEach(function(p){v.push(e(p))}),s.decompress(v.join(""))},compressToEncodedURIComponent:function(u){return u==null?"":s._compress(u,6,function(d){return n.charAt(d)})},decompressFromEncodedURIComponent:function(u){return u==null?"":u==""?null:(u=u.replace(/ /g,"+"),s._decompress(u.length,32,function(d){return a(n,u.charAt(d))}))},compress:function(u){return s._compress(u,16,function(d){return e(d)})},_compress:function(u,d,M){if(u==null)return"";var c,v,p={},T={},x="",y="",C="",h=2,g=3,f=2,m=[],S=0,A=0,P;for(P=0;P<u.length;P+=1)if(x=u.charAt(P),Object.prototype.hasOwnProperty.call(p,x)||(p[x]=g++,T[x]=!0),y=C+x,Object.prototype.hasOwnProperty.call(p,y))C=y;else{if(Object.prototype.hasOwnProperty.call(T,C)){if(C.charCodeAt(0)<256){for(c=0;c<f;c++)S=S<<1,A==d-1?(A=0,m.push(M(S)),S=0):A++;for(v=C.charCodeAt(0),c=0;c<8;c++)S=S<<1|v&1,A==d-1?(A=0,m.push(M(S)),S=0):A++,v=v>>1}else{for(v=1,c=0;c<f;c++)S=S<<1|v,A==d-1?(A=0,m.push(M(S)),S=0):A++,v=0;for(v=C.charCodeAt(0),c=0;c<16;c++)S=S<<1|v&1,A==d-1?(A=0,m.push(M(S)),S=0):A++,v=v>>1}h--,h==0&&(h=Math.pow(2,f),f++),delete T[C]}else for(v=p[C],c=0;c<f;c++)S=S<<1|v&1,A==d-1?(A=0,m.push(M(S)),S=0):A++,v=v>>1;h--,h==0&&(h=Math.pow(2,f),f++),p[y]=g++,C=String(x)}if(C!==""){if(Object.prototype.hasOwnProperty.call(T,C)){if(C.charCodeAt(0)<256){for(c=0;c<f;c++)S=S<<1,A==d-1?(A=0,m.push(M(S)),S=0):A++;for(v=C.charCodeAt(0),c=0;c<8;c++)S=S<<1|v&1,A==d-1?(A=0,m.push(M(S)),S=0):A++,v=v>>1}else{for(v=1,c=0;c<f;c++)S=S<<1|v,A==d-1?(A=0,m.push(M(S)),S=0):A++,v=0;for(v=C.charCodeAt(0),c=0;c<16;c++)S=S<<1|v&1,A==d-1?(A=0,m.push(M(S)),S=0):A++,v=v>>1}h--,h==0&&(h=Math.pow(2,f),f++),delete T[C]}else for(v=p[C],c=0;c<f;c++)S=S<<1|v&1,A==d-1?(A=0,m.push(M(S)),S=0):A++,v=v>>1;h--,h==0&&(h=Math.pow(2,f),f++)}for(v=2,c=0;c<f;c++)S=S<<1|v&1,A==d-1?(A=0,m.push(M(S)),S=0):A++,v=v>>1;for(;;)if(S=S<<1,A==d-1){m.push(M(S));break}else A++;return m.join("")},decompress:function(u){return u==null?"":u==""?null:s._decompress(u.length,32768,function(d){return u.charCodeAt(d)})},_decompress:function(u,d,M){var c=[],v=4,p=4,T=3,x="",y=[],C,h,g,f,m,S,A,P={val:M(0),position:d,index:1};for(C=0;C<3;C+=1)c[C]=C;for(g=0,m=Math.pow(2,2),S=1;S!=m;)f=P.val&P.position,P.position>>=1,P.position==0&&(P.position=d,P.val=M(P.index++)),g|=(f>0?1:0)*S,S<<=1;switch(g){case 0:for(g=0,m=Math.pow(2,8),S=1;S!=m;)f=P.val&P.position,P.position>>=1,P.position==0&&(P.position=d,P.val=M(P.index++)),g|=(f>0?1:0)*S,S<<=1;A=e(g);break;case 1:for(g=0,m=Math.pow(2,16),S=1;S!=m;)f=P.val&P.position,P.position>>=1,P.position==0&&(P.position=d,P.val=M(P.index++)),g|=(f>0?1:0)*S,S<<=1;A=e(g);break;case 2:return""}for(c[3]=A,h=A,y.push(A);;){if(P.index>u)return"";for(g=0,m=Math.pow(2,T),S=1;S!=m;)f=P.val&P.position,P.position>>=1,P.position==0&&(P.position=d,P.val=M(P.index++)),g|=(f>0?1:0)*S,S<<=1;switch(A=g){case 0:for(g=0,m=Math.pow(2,8),S=1;S!=m;)f=P.val&P.position,P.position>>=1,P.position==0&&(P.position=d,P.val=M(P.index++)),g|=(f>0?1:0)*S,S<<=1;c[p++]=e(g),A=p-1,v--;break;case 1:for(g=0,m=Math.pow(2,16),S=1;S!=m;)f=P.val&P.position,P.position>>=1,P.position==0&&(P.position=d,P.val=M(P.index++)),g|=(f>0?1:0)*S,S<<=1;c[p++]=e(g),A=p-1,v--;break;case 2:return y.join("")}if(v==0&&(v=Math.pow(2,T),T++),c[A])x=c[A];else if(A===p)x=h+h.charAt(0);else return null;y.push(x),c[p++]=h+x.charAt(0),v--,h=x,v==0&&(v=Math.pow(2,T),T++)}}};return s})();o!=null?o.exports=t:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return t})})(xn)),xn.exports}var ks=Ma(),En={exports:{}},Ai;function Ia(){return Ai||(Ai=1,(function(o){(function(){var t={};t.version="6.4.2.2",t.use_lines=!0,t.use_xyz=!1;var e=!1;o.exports?(o.exports=t,e=!0):typeof document<"u"?window.ClipperLib=t:self.ClipperLib=t;var r;if(e){var n="chrome";r="Netscape"}else{var n=navigator.userAgent.toString().toLowerCase();r=navigator.appName}var i={};n.indexOf("chrome")!=-1&&n.indexOf("chromium")==-1?i.chrome=1:i.chrome=0,n.indexOf("chromium")!=-1?i.chromium=1:i.chromium=0,n.indexOf("safari")!=-1&&n.indexOf("chrome")==-1&&n.indexOf("chromium")==-1?i.safari=1:i.safari=0,n.indexOf("firefox")!=-1?i.firefox=1:i.firefox=0,n.indexOf("firefox/17")!=-1?i.firefox17=1:i.firefox17=0,n.indexOf("firefox/15")!=-1?i.firefox15=1:i.firefox15=0,n.indexOf("firefox/3")!=-1?i.firefox3=1:i.firefox3=0,n.indexOf("opera")!=-1?i.opera=1:i.opera=0,n.indexOf("msie 10")!=-1?i.msie10=1:i.msie10=0,n.indexOf("msie 9")!=-1?i.msie9=1:i.msie9=0,n.indexOf("msie 8")!=-1?i.msie8=1:i.msie8=0,n.indexOf("msie 7")!=-1?i.msie7=1:i.msie7=0,n.indexOf("msie ")!=-1?i.msie=1:i.msie=0,t.biginteger_used=null;var a;function s(l,I,N){t.biginteger_used=1,l!=null&&(typeof l=="number"&&typeof I>"u"?this.fromInt(l):typeof l=="number"?this.fromNumber(l,I,N):I==null&&typeof l!="string"?this.fromString(l,256):this.fromString(l,I))}function u(){return new s(null,void 0,void 0)}function d(l,I,N,z,V,J){for(;--J>=0;){var nt=I*this[l++]+N[z]+V;V=Math.floor(nt/67108864),N[z++]=nt&67108863}return V}function M(l,I,N,z,V,J){for(var nt=I&32767,ft=I>>15;--J>=0;){var dt=this[l]&32767,At=this[l++]>>15,zt=ft*dt+At*nt;dt=nt*dt+((zt&32767)<<15)+N[z]+(V&1073741823),V=(dt>>>30)+(zt>>>15)+ft*At+(V>>>30),N[z++]=dt&1073741823}return V}function c(l,I,N,z,V,J){for(var nt=I&16383,ft=I>>14;--J>=0;){var dt=this[l]&16383,At=this[l++]>>14,zt=ft*dt+At*nt;dt=nt*dt+((zt&16383)<<14)+N[z]+V,V=(dt>>28)+(zt>>14)+ft*At,N[z++]=dt&268435455}return V}r=="Microsoft Internet Explorer"?(s.prototype.am=M,a=30):r!="Netscape"?(s.prototype.am=d,a=26):(s.prototype.am=c,a=28),s.prototype.DB=a,s.prototype.DM=(1<<a)-1,s.prototype.DV=1<<a;var v=52;s.prototype.FV=Math.pow(2,v),s.prototype.F1=v-a,s.prototype.F2=2*a-v;var p="0123456789abcdefghijklmnopqrstuvwxyz",T=new Array,x,y;for(x=48,y=0;y<=9;++y)T[x++]=y;for(x=97,y=10;y<36;++y)T[x++]=y;for(x=65,y=10;y<36;++y)T[x++]=y;function C(l){return p.charAt(l)}function h(l,I){var N=T[l.charCodeAt(I)];return N??-1}function g(l){for(var I=this.t-1;I>=0;--I)l[I]=this[I];l.t=this.t,l.s=this.s}function f(l){this.t=1,this.s=l<0?-1:0,l>0?this[0]=l:l<-1?this[0]=l+this.DV:this.t=0}function m(l){var I=u();return I.fromInt(l),I}function S(l,I){var N;if(I==16)N=4;else if(I==8)N=3;else if(I==256)N=8;else if(I==2)N=1;else if(I==32)N=5;else if(I==4)N=2;else{this.fromRadix(l,I);return}this.t=0,this.s=0;for(var z=l.length,V=!1,J=0;--z>=0;){var nt=N==8?l[z]&255:h(l,z);if(nt<0){l.charAt(z)=="-"&&(V=!0);continue}V=!1,J==0?this[this.t++]=nt:J+N>this.DB?(this[this.t-1]|=(nt&(1<<this.DB-J)-1)<<J,this[this.t++]=nt>>this.DB-J):this[this.t-1]|=nt<<J,J+=N,J>=this.DB&&(J-=this.DB)}N==8&&(l[0]&128)!=0&&(this.s=-1,J>0&&(this[this.t-1]|=(1<<this.DB-J)-1<<J)),this.clamp(),V&&s.ZERO.subTo(this,this)}function A(){for(var l=this.s&this.DM;this.t>0&&this[this.t-1]==l;)--this.t}function P(l){if(this.s<0)return"-"+this.negate().toString(l);var I;if(l==16)I=4;else if(l==8)I=3;else if(l==2)I=1;else if(l==32)I=5;else if(l==4)I=2;else return this.toRadix(l);var N=(1<<I)-1,z,V=!1,J="",nt=this.t,ft=this.DB-nt*this.DB%I;if(nt-- >0)for(ft<this.DB&&(z=this[nt]>>ft)>0&&(V=!0,J=C(z));nt>=0;)ft<I?(z=(this[nt]&(1<<ft)-1)<<I-ft,z|=this[--nt]>>(ft+=this.DB-I)):(z=this[nt]>>(ft-=I)&N,ft<=0&&(ft+=this.DB,--nt)),z>0&&(V=!0),V&&(J+=C(z));return V?J:"0"}function R(){var l=u();return s.ZERO.subTo(this,l),l}function D(){return this.s<0?this.negate():this}function L(l){var I=this.s-l.s;if(I!=0)return I;var N=this.t;if(I=N-l.t,I!=0)return this.s<0?-I:I;for(;--N>=0;)if((I=this[N]-l[N])!=0)return I;return 0}function j(l){var I=1,N;return(N=l>>>16)!=0&&(l=N,I+=16),(N=l>>8)!=0&&(l=N,I+=8),(N=l>>4)!=0&&(l=N,I+=4),(N=l>>2)!=0&&(l=N,I+=2),(N=l>>1)!=0&&(l=N,I+=1),I}function b(){return this.t<=0?0:this.DB*(this.t-1)+j(this[this.t-1]^this.s&this.DM)}function O(l,I){var N;for(N=this.t-1;N>=0;--N)I[N+l]=this[N];for(N=l-1;N>=0;--N)I[N]=0;I.t=this.t+l,I.s=this.s}function Y(l,I){for(var N=l;N<this.t;++N)I[N-l]=this[N];I.t=Math.max(this.t-l,0),I.s=this.s}function X(l,I){var N=l%this.DB,z=this.DB-N,V=(1<<z)-1,J=Math.floor(l/this.DB),nt=this.s<<N&this.DM,ft;for(ft=this.t-1;ft>=0;--ft)I[ft+J+1]=this[ft]>>z|nt,nt=(this[ft]&V)<<N;for(ft=J-1;ft>=0;--ft)I[ft]=0;I[J]=nt,I.t=this.t+J+1,I.s=this.s,I.clamp()}function Z(l,I){I.s=this.s;var N=Math.floor(l/this.DB);if(N>=this.t){I.t=0;return}var z=l%this.DB,V=this.DB-z,J=(1<<z)-1;I[0]=this[N]>>z;for(var nt=N+1;nt<this.t;++nt)I[nt-N-1]|=(this[nt]&J)<<V,I[nt-N]=this[nt]>>z;z>0&&(I[this.t-N-1]|=(this.s&J)<<V),I.t=this.t-N,I.clamp()}function $(l,I){for(var N=0,z=0,V=Math.min(l.t,this.t);N<V;)z+=this[N]-l[N],I[N++]=z&this.DM,z>>=this.DB;if(l.t<this.t){for(z-=l.s;N<this.t;)z+=this[N],I[N++]=z&this.DM,z>>=this.DB;z+=this.s}else{for(z+=this.s;N<l.t;)z-=l[N],I[N++]=z&this.DM,z>>=this.DB;z-=l.s}I.s=z<0?-1:0,z<-1?I[N++]=this.DV+z:z>0&&(I[N++]=z),I.t=N,I.clamp()}function rt(l,I){var N=this.abs(),z=l.abs(),V=N.t;for(I.t=V+z.t;--V>=0;)I[V]=0;for(V=0;V<z.t;++V)I[V+N.t]=N.am(0,z[V],I,V,0,N.t);I.s=0,I.clamp(),this.s!=l.s&&s.ZERO.subTo(I,I)}function F(l){for(var I=this.abs(),N=l.t=2*I.t;--N>=0;)l[N]=0;for(N=0;N<I.t-1;++N){var z=I.am(N,I[N],l,2*N,0,1);(l[N+I.t]+=I.am(N+1,2*I[N],l,2*N+1,z,I.t-N-1))>=I.DV&&(l[N+I.t]-=I.DV,l[N+I.t+1]=1)}l.t>0&&(l[l.t-1]+=I.am(N,I[N],l,2*N,0,1)),l.s=0,l.clamp()}function Q(l,I,N){var z=l.abs();if(!(z.t<=0)){var V=this.abs();if(V.t<z.t){I?.fromInt(0),N!=null&&this.copyTo(N);return}N==null&&(N=u());var J=u(),nt=this.s,ft=l.s,dt=this.DB-j(z[z.t-1]);dt>0?(z.lShiftTo(dt,J),V.lShiftTo(dt,N)):(z.copyTo(J),V.copyTo(N));var At=J.t,zt=J[At-1];if(zt!=0){var Ot=zt*(1<<this.F1)+(At>1?J[At-2]>>this.F2:0),Ut=this.FV/Ot,Ht=(1<<this.F1)/Ot,qt=1<<this.F2,_t=N.t,re=_t-At,Pe=I??u();for(J.dlShiftTo(re,Pe),N.compareTo(Pe)>=0&&(N[N.t++]=1,N.subTo(Pe,N)),s.ONE.dlShiftTo(At,Pe),Pe.subTo(J,J);J.t<At;)J[J.t++]=0;for(;--re>=0;){var Be=N[--_t]==zt?this.DM:Math.floor(N[_t]*Ut+(N[_t-1]+qt)*Ht);if((N[_t]+=J.am(0,Be,N,re,0,At))<Be)for(J.dlShiftTo(re,Pe),N.subTo(Pe,N);N[_t]<--Be;)N.subTo(Pe,N)}I!=null&&(N.drShiftTo(At,I),nt!=ft&&s.ZERO.subTo(I,I)),N.t=At,N.clamp(),dt>0&&N.rShiftTo(dt,N),nt<0&&s.ZERO.subTo(N,N)}}}function tt(l){var I=u();return this.abs().divRemTo(l,null,I),this.s<0&&I.compareTo(s.ZERO)>0&&l.subTo(I,I),I}function lt(l){this.m=l}function ct(l){return l.s<0||l.compareTo(this.m)>=0?l.mod(this.m):l}function Mt(l){return l}function st(l){l.divRemTo(this.m,null,l)}function Tt(l,I,N){l.multiplyTo(I,N),this.reduce(N)}function xt(l,I){l.squareTo(I),this.reduce(I)}lt.prototype.convert=ct,lt.prototype.revert=Mt,lt.prototype.reduce=st,lt.prototype.mulTo=Tt,lt.prototype.sqrTo=xt;function W(){if(this.t<1)return 0;var l=this[0];if((l&1)==0)return 0;var I=l&3;return I=I*(2-(l&15)*I)&15,I=I*(2-(l&255)*I)&255,I=I*(2-((l&65535)*I&65535))&65535,I=I*(2-l*I%this.DV)%this.DV,I>0?this.DV-I:-I}function k(l){this.m=l,this.mp=l.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<l.DB-15)-1,this.mt2=2*l.t}function q(l){var I=u();return l.abs().dlShiftTo(this.m.t,I),I.divRemTo(this.m,null,I),l.s<0&&I.compareTo(s.ZERO)>0&&this.m.subTo(I,I),I}function _(l){var I=u();return l.copyTo(I),this.reduce(I),I}function U(l){for(;l.t<=this.mt2;)l[l.t++]=0;for(var I=0;I<this.m.t;++I){var N=l[I]&32767,z=N*this.mpl+((N*this.mph+(l[I]>>15)*this.mpl&this.um)<<15)&l.DM;for(N=I+this.m.t,l[N]+=this.m.am(0,z,l,I,0,this.m.t);l[N]>=l.DV;)l[N]-=l.DV,l[++N]++}l.clamp(),l.drShiftTo(this.m.t,l),l.compareTo(this.m)>=0&&l.subTo(this.m,l)}function H(l,I){l.squareTo(I),this.reduce(I)}function E(l,I,N){l.multiplyTo(I,N),this.reduce(N)}k.prototype.convert=q,k.prototype.revert=_,k.prototype.reduce=U,k.prototype.mulTo=E,k.prototype.sqrTo=H;function w(){return(this.t>0?this[0]&1:this.s)==0}function B(l,I){if(l>4294967295||l<1)return s.ONE;var N=u(),z=u(),V=I.convert(this),J=j(l)-1;for(V.copyTo(N);--J>=0;)if(I.sqrTo(N,z),(l&1<<J)>0)I.mulTo(z,V,N);else{var nt=N;N=z,z=nt}return I.revert(N)}function G(l,I){var N;return l<256||I.isEven()?N=new lt(I):N=new k(I),this.exp(l,N)}s.prototype.copyTo=g,s.prototype.fromInt=f,s.prototype.fromString=S,s.prototype.clamp=A,s.prototype.dlShiftTo=O,s.prototype.drShiftTo=Y,s.prototype.lShiftTo=X,s.prototype.rShiftTo=Z,s.prototype.subTo=$,s.prototype.multiplyTo=rt,s.prototype.squareTo=F,s.prototype.divRemTo=Q,s.prototype.invDigit=W,s.prototype.isEven=w,s.prototype.exp=B,s.prototype.toString=P,s.prototype.negate=R,s.prototype.abs=D,s.prototype.compareTo=L,s.prototype.bitLength=b,s.prototype.mod=tt,s.prototype.modPowInt=G,s.ZERO=m(0),s.ONE=m(1);function K(){var l=u();return this.copyTo(l),l}function et(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function at(){return this.t==0?this.s:this[0]<<24>>24}function ut(){return this.t==0?this.s:this[0]<<16>>16}function gt(l){return Math.floor(Math.LN2*this.DB/Math.log(l))}function yt(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function Ct(l){if(l==null&&(l=10),this.signum()==0||l<2||l>36)return"0";var I=this.chunkSize(l),N=Math.pow(l,I),z=m(N),V=u(),J=u(),nt="";for(this.divRemTo(z,V,J);V.signum()>0;)nt=(N+J.intValue()).toString(l).substr(1)+nt,V.divRemTo(z,V,J);return J.intValue().toString(l)+nt}function vt(l,I){this.fromInt(0),I==null&&(I=10);for(var N=this.chunkSize(I),z=Math.pow(I,N),V=!1,J=0,nt=0,ft=0;ft<l.length;++ft){var dt=h(l,ft);if(dt<0){l.charAt(ft)=="-"&&this.signum()==0&&(V=!0);continue}nt=I*nt+dt,++J>=N&&(this.dMultiply(z),this.dAddOffset(nt,0),J=0,nt=0)}J>0&&(this.dMultiply(Math.pow(I,J)),this.dAddOffset(nt,0)),V&&s.ZERO.subTo(this,this)}function mt(l,I,N){if(typeof I=="number")if(l<2)this.fromInt(1);else for(this.fromNumber(l,N),this.testBit(l-1)||this.bitwiseTo(s.ONE.shiftLeft(l-1),kt,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(I);)this.dAddOffset(2,0),this.bitLength()>l&&this.subTo(s.ONE.shiftLeft(l-1),this);else{var z=new Array,V=l&7;z.length=(l>>3)+1,I.nextBytes(z),V>0?z[0]&=(1<<V)-1:z[0]=0,this.fromString(z,256)}}function It(){var l=this.t,I=new Array;I[0]=this.s;var N=this.DB-l*this.DB%8,z,V=0;if(l-- >0)for(N<this.DB&&(z=this[l]>>N)!=(this.s&this.DM)>>N&&(I[V++]=z|this.s<<this.DB-N);l>=0;)N<8?(z=(this[l]&(1<<N)-1)<<8-N,z|=this[--l]>>(N+=this.DB-8)):(z=this[l]>>(N-=8)&255,N<=0&&(N+=this.DB,--l)),(z&128)!=0&&(z|=-256),V==0&&(this.s&128)!=(z&128)&&++V,(V>0||z!=this.s)&&(I[V++]=z);return I}function wt(l){return this.compareTo(l)==0}function bt(l){return this.compareTo(l)<0?this:l}function Nt(l){return this.compareTo(l)>0?this:l}function Yt(l,I,N){var z,V,J=Math.min(l.t,this.t);for(z=0;z<J;++z)N[z]=I(this[z],l[z]);if(l.t<this.t){for(V=l.s&this.DM,z=J;z<this.t;++z)N[z]=I(this[z],V);N.t=this.t}else{for(V=this.s&this.DM,z=J;z<l.t;++z)N[z]=I(V,l[z]);N.t=l.t}N.s=I(this.s,l.s),N.clamp()}function $t(l,I){return l&I}function Gt(l){var I=u();return this.bitwiseTo(l,$t,I),I}function kt(l,I){return l|I}function Kt(l){var I=u();return this.bitwiseTo(l,kt,I),I}function Zt(l,I){return l^I}function de(l){var I=u();return this.bitwiseTo(l,Zt,I),I}function le(l,I){return l&~I}function he(l){var I=u();return this.bitwiseTo(l,le,I),I}function fe(){for(var l=u(),I=0;I<this.t;++I)l[I]=this.DM&~this[I];return l.t=this.t,l.s=~this.s,l}function ge(l){var I=u();return l<0?this.rShiftTo(-l,I):this.lShiftTo(l,I),I}function pe(l){var I=u();return l<0?this.lShiftTo(-l,I):this.rShiftTo(l,I),I}function Me(l){if(l==0)return-1;var I=0;return(l&65535)==0&&(l>>=16,I+=16),(l&255)==0&&(l>>=8,I+=8),(l&15)==0&&(l>>=4,I+=4),(l&3)==0&&(l>>=2,I+=2),(l&1)==0&&++I,I}function te(){for(var l=0;l<this.t;++l)if(this[l]!=0)return l*this.DB+Me(this[l]);return this.s<0?this.t*this.DB:-1}function De(l){for(var I=0;l!=0;)l&=l-1,++I;return I}function _e(){for(var l=0,I=this.s&this.DM,N=0;N<this.t;++N)l+=De(this[N]^I);return l}function tr(l){var I=Math.floor(l/this.DB);return I>=this.t?this.s!=0:(this[I]&1<<l%this.DB)!=0}function zr(l,I){var N=s.ONE.shiftLeft(l);return this.bitwiseTo(N,I,N),N}function Br(l){return this.changeBit(l,kt)}function Bo(l){return this.changeBit(l,le)}function Yo(l){return this.changeBit(l,Zt)}function Uo(l,I){for(var N=0,z=0,V=Math.min(l.t,this.t);N<V;)z+=this[N]+l[N],I[N++]=z&this.DM,z>>=this.DB;if(l.t<this.t){for(z+=l.s;N<this.t;)z+=this[N],I[N++]=z&this.DM,z>>=this.DB;z+=this.s}else{for(z+=this.s;N<l.t;)z+=l[N],I[N++]=z&this.DM,z>>=this.DB;z+=l.s}I.s=z<0?-1:0,z>0?I[N++]=z:z<-1&&(I[N++]=this.DV+z),I.t=N,I.clamp()}function Wo(l){var I=u();return this.addTo(l,I),I}function Fo(l){var I=u();return this.subTo(l,I),I}function Vo(l){var I=u();return this.multiplyTo(l,I),I}function ko(){var l=u();return this.squareTo(l),l}function Xo(l){var I=u();return this.divRemTo(l,I,null),I}function Go(l){var I=u();return this.divRemTo(l,null,I),I}function Ho(l){var I=u(),N=u();return this.divRemTo(l,I,N),new Array(I,N)}function Zo(l){this[this.t]=this.am(0,l-1,this,0,0,this.t),++this.t,this.clamp()}function Qo(l,I){if(l!=0){for(;this.t<=I;)this[this.t++]=0;for(this[I]+=l;this[I]>=this.DV;)this[I]-=this.DV,++I>=this.t&&(this[this.t++]=0),++this[I]}}function Mr(){}function xi(l){return l}function Ko(l,I,N){l.multiplyTo(I,N)}function $o(l,I){l.squareTo(I)}Mr.prototype.convert=xi,Mr.prototype.revert=xi,Mr.prototype.mulTo=Ko,Mr.prototype.sqrTo=$o;function Jo(l){return this.exp(l,new Mr)}function qo(l,I,N){var z=Math.min(this.t+l.t,I);for(N.s=0,N.t=z;z>0;)N[--z]=0;var V;for(V=N.t-this.t;z<V;++z)N[z+this.t]=this.am(0,l[z],N,z,0,this.t);for(V=Math.min(l.t,I);z<V;++z)this.am(0,l[z],N,z,0,I-z);N.clamp()}function _o(l,I,N){--I;var z=N.t=this.t+l.t-I;for(N.s=0;--z>=0;)N[z]=0;for(z=Math.max(I-this.t,0);z<l.t;++z)N[this.t+z-I]=this.am(I-z,l[z],N,0,0,this.t+z-I);N.clamp(),N.drShiftTo(1,N)}function sr(l){this.r2=u(),this.q3=u(),s.ONE.dlShiftTo(2*l.t,this.r2),this.mu=this.r2.divide(l),this.m=l}function ta(l){if(l.s<0||l.t>2*this.m.t)return l.mod(this.m);if(l.compareTo(this.m)<0)return l;var I=u();return l.copyTo(I),this.reduce(I),I}function ea(l){return l}function ra(l){for(l.drShiftTo(this.m.t-1,this.r2),l.t>this.m.t+1&&(l.t=this.m.t+1,l.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);l.compareTo(this.r2)<0;)l.dAddOffset(1,this.m.t+1);for(l.subTo(this.r2,l);l.compareTo(this.m)>=0;)l.subTo(this.m,l)}function na(l,I){l.squareTo(I),this.reduce(I)}function ia(l,I,N){l.multiplyTo(I,N),this.reduce(N)}sr.prototype.convert=ta,sr.prototype.revert=ea,sr.prototype.reduce=ra,sr.prototype.mulTo=ia,sr.prototype.sqrTo=na;function sa(l,I){var N=l.bitLength(),z,V=m(1),J;if(N<=0)return V;N<18?z=1:N<48?z=3:N<144?z=4:N<768?z=5:z=6,N<8?J=new lt(I):I.isEven()?J=new sr(I):J=new k(I);var nt=new Array,ft=3,dt=z-1,At=(1<<z)-1;if(nt[1]=J.convert(this),z>1){var zt=u();for(J.sqrTo(nt[1],zt);ft<=At;)nt[ft]=u(),J.mulTo(zt,nt[ft-2],nt[ft]),ft+=2}var Ot=l.t-1,Ut,Ht=!0,qt=u(),_t;for(N=j(l[Ot])-1;Ot>=0;){for(N>=dt?Ut=l[Ot]>>N-dt&At:(Ut=(l[Ot]&(1<<N+1)-1)<<dt-N,Ot>0&&(Ut|=l[Ot-1]>>this.DB+N-dt)),ft=z;(Ut&1)==0;)Ut>>=1,--ft;if((N-=ft)<0&&(N+=this.DB,--Ot),Ht)nt[Ut].copyTo(V),Ht=!1;else{for(;ft>1;)J.sqrTo(V,qt),J.sqrTo(qt,V),ft-=2;ft>0?J.sqrTo(V,qt):(_t=V,V=qt,qt=_t),J.mulTo(qt,nt[Ut],V)}for(;Ot>=0&&(l[Ot]&1<<N)==0;)J.sqrTo(V,qt),_t=V,V=qt,qt=_t,--N<0&&(N=this.DB-1,--Ot)}return J.revert(V)}function oa(l){var I=this.s<0?this.negate():this.clone(),N=l.s<0?l.negate():l.clone();if(I.compareTo(N)<0){var z=I;I=N,N=z}var V=I.getLowestSetBit(),J=N.getLowestSetBit();if(J<0)return I;for(V<J&&(J=V),J>0&&(I.rShiftTo(J,I),N.rShiftTo(J,N));I.signum()>0;)(V=I.getLowestSetBit())>0&&I.rShiftTo(V,I),(V=N.getLowestSetBit())>0&&N.rShiftTo(V,N),I.compareTo(N)>=0?(I.subTo(N,I),I.rShiftTo(1,I)):(N.subTo(I,N),N.rShiftTo(1,N));return J>0&&N.lShiftTo(J,N),N}function aa(l){if(l<=0)return 0;var I=this.DV%l,N=this.s<0?l-1:0;if(this.t>0)if(I==0)N=this[0]%l;else for(var z=this.t-1;z>=0;--z)N=(I*N+this[z])%l;return N}function la(l){var I=l.isEven();if(this.isEven()&&I||l.signum()==0)return s.ZERO;for(var N=l.clone(),z=this.clone(),V=m(1),J=m(0),nt=m(0),ft=m(1);N.signum()!=0;){for(;N.isEven();)N.rShiftTo(1,N),I?((!V.isEven()||!J.isEven())&&(V.addTo(this,V),J.subTo(l,J)),V.rShiftTo(1,V)):J.isEven()||J.subTo(l,J),J.rShiftTo(1,J);for(;z.isEven();)z.rShiftTo(1,z),I?((!nt.isEven()||!ft.isEven())&&(nt.addTo(this,nt),ft.subTo(l,ft)),nt.rShiftTo(1,nt)):ft.isEven()||ft.subTo(l,ft),ft.rShiftTo(1,ft);N.compareTo(z)>=0?(N.subTo(z,N),I&&V.subTo(nt,V),J.subTo(ft,J)):(z.subTo(N,z),I&&nt.subTo(V,nt),ft.subTo(J,ft))}if(z.compareTo(s.ONE)!=0)return s.ZERO;if(ft.compareTo(l)>=0)return ft.subtract(l);if(ft.signum()<0)ft.addTo(l,ft);else return ft;return ft.signum()<0?ft.add(l):ft}var Ae=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],ca=(1<<26)/Ae[Ae.length-1];function ua(l){var I,N=this.abs();if(N.t==1&&N[0]<=Ae[Ae.length-1]){for(I=0;I<Ae.length;++I)if(N[0]==Ae[I])return!0;return!1}if(N.isEven())return!1;for(I=1;I<Ae.length;){for(var z=Ae[I],V=I+1;V<Ae.length&&z<ca;)z*=Ae[V++];for(z=N.modInt(z);I<V;)if(z%Ae[I++]==0)return!1}return N.millerRabin(l)}function ha(l){var I=this.subtract(s.ONE),N=I.getLowestSetBit();if(N<=0)return!1;var z=I.shiftRight(N);l=l+1>>1,l>Ae.length&&(l=Ae.length);for(var V=u(),J=0;J<l;++J){V.fromInt(Ae[Math.floor(Math.random()*Ae.length)]);var nt=V.modPow(z,this);if(nt.compareTo(s.ONE)!=0&&nt.compareTo(I)!=0){for(var ft=1;ft++<N&&nt.compareTo(I)!=0;)if(nt=nt.modPowInt(2,this),nt.compareTo(s.ONE)==0)return!1;if(nt.compareTo(I)!=0)return!1}}return!0}s.prototype.chunkSize=gt,s.prototype.toRadix=Ct,s.prototype.fromRadix=vt,s.prototype.fromNumber=mt,s.prototype.bitwiseTo=Yt,s.prototype.changeBit=zr,s.prototype.addTo=Uo,s.prototype.dMultiply=Zo,s.prototype.dAddOffset=Qo,s.prototype.multiplyLowerTo=qo,s.prototype.multiplyUpperTo=_o,s.prototype.modInt=aa,s.prototype.millerRabin=ha,s.prototype.clone=K,s.prototype.intValue=et,s.prototype.byteValue=at,s.prototype.shortValue=ut,s.prototype.signum=yt,s.prototype.toByteArray=It,s.prototype.equals=wt,s.prototype.min=bt,s.prototype.max=Nt,s.prototype.and=Gt,s.prototype.or=Kt,s.prototype.xor=de,s.prototype.andNot=he,s.prototype.not=fe,s.prototype.shiftLeft=ge,s.prototype.shiftRight=pe,s.prototype.getLowestSetBit=te,s.prototype.bitCount=_e,s.prototype.testBit=tr,s.prototype.setBit=Br,s.prototype.clearBit=Bo,s.prototype.flipBit=Yo,s.prototype.add=Wo,s.prototype.subtract=Fo,s.prototype.multiply=Vo,s.prototype.divide=Xo,s.prototype.remainder=Go,s.prototype.divideAndRemainder=Ho,s.prototype.modPow=sa,s.prototype.modInverse=la,s.prototype.pow=Jo,s.prototype.gcd=oa,s.prototype.isProbablePrime=ua,s.prototype.square=ko;var Jt=s;Jt.prototype.IsNegative=function(){return this.compareTo(Jt.ZERO)==-1},Jt.op_Equality=function(l,I){return l.compareTo(I)==0},Jt.op_Inequality=function(l,I){return l.compareTo(I)!=0},Jt.op_GreaterThan=function(l,I){return l.compareTo(I)>0},Jt.op_LessThan=function(l,I){return l.compareTo(I)<0},Jt.op_Addition=function(l,I){return new Jt(l,void 0,void 0).add(new Jt(I,void 0,void 0))},Jt.op_Subtraction=function(l,I){return new Jt(l,void 0,void 0).subtract(new Jt(I,void 0,void 0))},Jt.Int128Mul=function(l,I){return new Jt(l,void 0,void 0).multiply(new Jt(I,void 0,void 0))},Jt.op_Division=function(l,I){return l.divide(I)},Jt.prototype.ToDouble=function(){return parseFloat(this.toString())};var Ei=function(l,I){var N;if(typeof Object.getOwnPropertyNames>"u"){for(N in I.prototype)(typeof l.prototype[N]>"u"||l.prototype[N]===Object.prototype[N])&&(l.prototype[N]=I.prototype[N]);for(N in I)typeof l[N]>"u"&&(l[N]=I[N]);l.$baseCtor=I}else{for(var z=Object.getOwnPropertyNames(I.prototype),V=0;V<z.length;V++)typeof Object.getOwnPropertyDescriptor(l.prototype,z[V])>"u"&&Object.defineProperty(l.prototype,z[V],Object.getOwnPropertyDescriptor(I.prototype,z[V]));for(N in I)typeof l[N]>"u"&&(l[N]=I[N]);l.$baseCtor=I}};t.Path=function(){return[]},t.Path.prototype.push=Array.prototype.push,t.Paths=function(){return[]},t.Paths.prototype.push=Array.prototype.push,t.DoublePoint=function(){var l=arguments;this.X=0,this.Y=0,l.length===1?(this.X=l[0].X,this.Y=l[0].Y):l.length===2&&(this.X=l[0],this.Y=l[1])},t.DoublePoint0=function(){this.X=0,this.Y=0},t.DoublePoint0.prototype=t.DoublePoint.prototype,t.DoublePoint1=function(l){this.X=l.X,this.Y=l.Y},t.DoublePoint1.prototype=t.DoublePoint.prototype,t.DoublePoint2=function(l,I){this.X=l,this.Y=I},t.DoublePoint2.prototype=t.DoublePoint.prototype,t.PolyNode=function(){this.m_Parent=null,this.m_polygon=new t.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1},t.PolyNode.prototype.IsHoleNode=function(){for(var l=!0,I=this.m_Parent;I!==null;)l=!l,I=I.m_Parent;return l},t.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length},t.PolyNode.prototype.Contour=function(){return this.m_polygon},t.PolyNode.prototype.AddChild=function(l){var I=this.m_Childs.length;this.m_Childs.push(l),l.m_Parent=this,l.m_Index=I},t.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()},t.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index===this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]},t.PolyNode.prototype.Childs=function(){return this.m_Childs},t.PolyNode.prototype.Parent=function(){return this.m_Parent},t.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()},t.PolyTree=function(){this.m_AllPolys=[],t.PolyNode.call(this)},t.PolyTree.prototype.Clear=function(){for(var l=0,I=this.m_AllPolys.length;l<I;l++)this.m_AllPolys[l]=null;this.m_AllPolys.length=0,this.m_Childs.length=0},t.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null},t.PolyTree.prototype.Total=function(){var l=this.m_AllPolys.length;return l>0&&this.m_Childs[0]!==this.m_AllPolys[0]&&l--,l},Ei(t.PolyTree,t.PolyNode),t.Math_Abs_Int64=t.Math_Abs_Int32=t.Math_Abs_Double=function(l){return Math.abs(l)},t.Math_Max_Int32_Int32=function(l,I){return Math.max(l,I)},i.msie||i.opera||i.safari?t.Cast_Int32=function(l){return l|0}:t.Cast_Int32=function(l){return~~l},typeof Number.toInteger>"u"&&(Number.toInteger=null),i.chrome?t.Cast_Int64=function(l){return l<-2147483648||l>2147483647?l<0?Math.ceil(l):Math.floor(l):~~l}:i.firefox&&typeof Number.toInteger=="function"?t.Cast_Int64=function(l){return Number.toInteger(l)}:i.msie7||i.msie8?t.Cast_Int64=function(l){return parseInt(l,10)}:i.msie?t.Cast_Int64=function(l){return l<-2147483648||l>2147483647?l<0?Math.ceil(l):Math.floor(l):l|0}:t.Cast_Int64=function(l){return l<0?Math.ceil(l):Math.floor(l)},t.Clear=function(l){l.length=0},t.PI=3.141592653589793,t.PI2=2*3.141592653589793,t.IntPoint=function(){var l=arguments,I=l.length;if(this.X=0,this.Y=0,t.use_xyz)if(this.Z=0,I===3)this.X=l[0],this.Y=l[1],this.Z=l[2];else if(I===2)this.X=l[0],this.Y=l[1],this.Z=0;else if(I===1)if(l[0]instanceof t.DoublePoint){var N=l[0];this.X=t.Clipper.Round(N.X),this.Y=t.Clipper.Round(N.Y),this.Z=0}else{var z=l[0];typeof z.Z>"u"&&(z.Z=0),this.X=z.X,this.Y=z.Y,this.Z=z.Z}else this.X=0,this.Y=0,this.Z=0;else if(I===2)this.X=l[0],this.Y=l[1];else if(I===1)if(l[0]instanceof t.DoublePoint){var N=l[0];this.X=t.Clipper.Round(N.X),this.Y=t.Clipper.Round(N.Y)}else{var z=l[0];this.X=z.X,this.Y=z.Y}else this.X=0,this.Y=0},t.IntPoint.op_Equality=function(l,I){return l.X===I.X&&l.Y===I.Y},t.IntPoint.op_Inequality=function(l,I){return l.X!==I.X||l.Y!==I.Y},t.IntPoint0=function(){this.X=0,this.Y=0,t.use_xyz&&(this.Z=0)},t.IntPoint0.prototype=t.IntPoint.prototype,t.IntPoint1=function(l){this.X=l.X,this.Y=l.Y,t.use_xyz&&(typeof l.Z>"u"?this.Z=0:this.Z=l.Z)},t.IntPoint1.prototype=t.IntPoint.prototype,t.IntPoint1dp=function(l){this.X=t.Clipper.Round(l.X),this.Y=t.Clipper.Round(l.Y),t.use_xyz&&(this.Z=0)},t.IntPoint1dp.prototype=t.IntPoint.prototype,t.IntPoint2=function(l,I,N){this.X=l,this.Y=I,t.use_xyz&&(typeof N>"u"?this.Z=0:this.Z=N)},t.IntPoint2.prototype=t.IntPoint.prototype,t.IntRect=function(){var l=arguments,I=l.length;if(I===4)this.left=l[0],this.top=l[1],this.right=l[2],this.bottom=l[3];else if(I===1){var N=l[0];this.left=N.left,this.top=N.top,this.right=N.right,this.bottom=N.bottom}else this.left=0,this.top=0,this.right=0,this.bottom=0},t.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0},t.IntRect0.prototype=t.IntRect.prototype,t.IntRect1=function(l){this.left=l.left,this.top=l.top,this.right=l.right,this.bottom=l.bottom},t.IntRect1.prototype=t.IntRect.prototype,t.IntRect4=function(l,I,N,z){this.left=l,this.top=I,this.right=N,this.bottom=z},t.IntRect4.prototype=t.IntRect.prototype,t.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3},t.PolyType={ptSubject:0,ptClip:1},t.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3},t.JoinType={jtSquare:0,jtRound:1,jtMiter:2},t.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4},t.EdgeSide={esLeft:0,esRight:1},t.Direction={dRightToLeft:0,dLeftToRight:1},t.TEdge=function(){this.Bot=new t.IntPoint0,this.Curr=new t.IntPoint0,this.Top=new t.IntPoint0,this.Delta=new t.IntPoint0,this.Dx=0,this.PolyTyp=t.PolyType.ptSubject,this.Side=t.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null},t.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new t.IntPoint0},t.MyIntersectNodeSort=function(){},t.MyIntersectNodeSort.Compare=function(l,I){var N=I.Pt.Y-l.Pt.Y;return N>0?1:N<0?-1:0},t.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null},t.Scanbeam=function(){this.Y=0,this.Next=null},t.Maxima=function(){this.X=0,this.Next=null,this.Prev=null},t.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null},t.OutPt=function(){this.Idx=0,this.Pt=new t.IntPoint0,this.Next=null,this.Prev=null},t.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new t.IntPoint0},t.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_Scanbeam=null,this.m_PolyOuts=null,this.m_ActiveEdges=null},t.ClipperBase.horizontal=-9007199254740992,t.ClipperBase.Skip=-2,t.ClipperBase.Unassigned=-1,t.ClipperBase.tolerance=1e-20,t.ClipperBase.loRange=47453132,t.ClipperBase.hiRange=0xfffffffffffff,t.ClipperBase.near_zero=function(l){return l>-t.ClipperBase.tolerance&&l<t.ClipperBase.tolerance},t.ClipperBase.IsHorizontal=function(l){return l.Delta.Y===0},t.ClipperBase.prototype.PointIsVertex=function(l,I){var N=I;do{if(t.IntPoint.op_Equality(N.Pt,l))return!0;N=N.Next}while(N!==I);return!1},t.ClipperBase.prototype.PointOnLineSegment=function(l,I,N,z){return z?l.X===I.X&&l.Y===I.Y||l.X===N.X&&l.Y===N.Y||l.X>I.X==l.X<N.X&&l.Y>I.Y==l.Y<N.Y&&Jt.op_Equality(Jt.Int128Mul(l.X-I.X,N.Y-I.Y),Jt.Int128Mul(N.X-I.X,l.Y-I.Y)):l.X===I.X&&l.Y===I.Y||l.X===N.X&&l.Y===N.Y||l.X>I.X==l.X<N.X&&l.Y>I.Y==l.Y<N.Y&&(l.X-I.X)*(N.Y-I.Y)===(N.X-I.X)*(l.Y-I.Y)},t.ClipperBase.prototype.PointOnPolygon=function(l,I,N){for(var z=I;;){if(this.PointOnLineSegment(l,z.Pt,z.Next.Pt,N))return!0;if(z=z.Next,z===I)break}return!1},t.ClipperBase.prototype.SlopesEqual=t.ClipperBase.SlopesEqual=function(){var l=arguments,I=l.length,N,z,V,J,nt,ft,dt;return I===3?(N=l[0],z=l[1],dt=l[2],dt?Jt.op_Equality(Jt.Int128Mul(N.Delta.Y,z.Delta.X),Jt.Int128Mul(N.Delta.X,z.Delta.Y)):t.Cast_Int64(N.Delta.Y*z.Delta.X)===t.Cast_Int64(N.Delta.X*z.Delta.Y)):I===4?(V=l[0],J=l[1],nt=l[2],dt=l[3],dt?Jt.op_Equality(Jt.Int128Mul(V.Y-J.Y,J.X-nt.X),Jt.Int128Mul(V.X-J.X,J.Y-nt.Y)):t.Cast_Int64((V.Y-J.Y)*(J.X-nt.X))-t.Cast_Int64((V.X-J.X)*(J.Y-nt.Y))===0):(V=l[0],J=l[1],nt=l[2],ft=l[3],dt=l[4],dt?Jt.op_Equality(Jt.Int128Mul(V.Y-J.Y,nt.X-ft.X),Jt.Int128Mul(V.X-J.X,nt.Y-ft.Y)):t.Cast_Int64((V.Y-J.Y)*(nt.X-ft.X))-t.Cast_Int64((V.X-J.X)*(nt.Y-ft.Y))===0)},t.ClipperBase.SlopesEqual3=function(l,I,N){return N?Jt.op_Equality(Jt.Int128Mul(l.Delta.Y,I.Delta.X),Jt.Int128Mul(l.Delta.X,I.Delta.Y)):t.Cast_Int64(l.Delta.Y*I.Delta.X)===t.Cast_Int64(l.Delta.X*I.Delta.Y)},t.ClipperBase.SlopesEqual4=function(l,I,N,z){return z?Jt.op_Equality(Jt.Int128Mul(l.Y-I.Y,I.X-N.X),Jt.Int128Mul(l.X-I.X,I.Y-N.Y)):t.Cast_Int64((l.Y-I.Y)*(I.X-N.X))-t.Cast_Int64((l.X-I.X)*(I.Y-N.Y))===0},t.ClipperBase.SlopesEqual5=function(l,I,N,z,V){return V?Jt.op_Equality(Jt.Int128Mul(l.Y-I.Y,N.X-z.X),Jt.Int128Mul(l.X-I.X,N.Y-z.Y)):t.Cast_Int64((l.Y-I.Y)*(N.X-z.X))-t.Cast_Int64((l.X-I.X)*(N.Y-z.Y))===0},t.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var l=0,I=this.m_edges.length;l<I;++l){for(var N=0,z=this.m_edges[l].length;N<z;++N)this.m_edges[l][N]=null;t.Clear(this.m_edges[l])}t.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1},t.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;this.m_MinimaList!==null;){var l=this.m_MinimaList.Next;this.m_MinimaList=null,this.m_MinimaList=l}this.m_CurrentLM=null},t.ClipperBase.prototype.RangeTest=function(l,I){I.Value?(l.X>t.ClipperBase.hiRange||l.Y>t.ClipperBase.hiRange||-l.X>t.ClipperBase.hiRange||-l.Y>t.ClipperBase.hiRange)&&t.Error("Coordinate outside allowed range in RangeTest()."):(l.X>t.ClipperBase.loRange||l.Y>t.ClipperBase.loRange||-l.X>t.ClipperBase.loRange||-l.Y>t.ClipperBase.loRange)&&(I.Value=!0,this.RangeTest(l,I))},t.ClipperBase.prototype.InitEdge=function(l,I,N,z){l.Next=I,l.Prev=N,l.Curr.X=z.X,l.Curr.Y=z.Y,t.use_xyz&&(l.Curr.Z=z.Z),l.OutIdx=-1},t.ClipperBase.prototype.InitEdge2=function(l,I){l.Curr.Y>=l.Next.Curr.Y?(l.Bot.X=l.Curr.X,l.Bot.Y=l.Curr.Y,t.use_xyz&&(l.Bot.Z=l.Curr.Z),l.Top.X=l.Next.Curr.X,l.Top.Y=l.Next.Curr.Y,t.use_xyz&&(l.Top.Z=l.Next.Curr.Z)):(l.Top.X=l.Curr.X,l.Top.Y=l.Curr.Y,t.use_xyz&&(l.Top.Z=l.Curr.Z),l.Bot.X=l.Next.Curr.X,l.Bot.Y=l.Next.Curr.Y,t.use_xyz&&(l.Bot.Z=l.Next.Curr.Z)),this.SetDx(l),l.PolyTyp=I},t.ClipperBase.prototype.FindNextLocMin=function(l){for(var I;;){for(;t.IntPoint.op_Inequality(l.Bot,l.Prev.Bot)||t.IntPoint.op_Equality(l.Curr,l.Top);)l=l.Next;if(l.Dx!==t.ClipperBase.horizontal&&l.Prev.Dx!==t.ClipperBase.horizontal)break;for(;l.Prev.Dx===t.ClipperBase.horizontal;)l=l.Prev;for(I=l;l.Dx===t.ClipperBase.horizontal;)l=l.Next;if(l.Top.Y!==l.Prev.Bot.Y){I.Prev.Bot.X<l.Bot.X&&(l=I);break}}return l},t.ClipperBase.prototype.ProcessBound=function(l,I){var N,z=l,V;if(z.OutIdx===t.ClipperBase.Skip){if(l=z,I){for(;l.Top.Y===l.Next.Bot.Y;)l=l.Next;for(;l!==z&&l.Dx===t.ClipperBase.horizontal;)l=l.Prev}else{for(;l.Top.Y===l.Prev.Bot.Y;)l=l.Prev;for(;l!==z&&l.Dx===t.ClipperBase.horizontal;)l=l.Next}if(l===z)I?z=l.Next:z=l.Prev;else{I?l=z.Next:l=z.Prev;var J=new t.LocalMinima;J.Next=null,J.Y=l.Bot.Y,J.LeftBound=null,J.RightBound=l,l.WindDelta=0,z=this.ProcessBound(l,I),this.InsertLocalMinima(J)}return z}if(l.Dx===t.ClipperBase.horizontal&&(I?N=l.Prev:N=l.Next,N.Dx===t.ClipperBase.horizontal?N.Bot.X!==l.Bot.X&&N.Top.X!==l.Bot.X&&this.ReverseHorizontal(l):N.Bot.X!==l.Bot.X&&this.ReverseHorizontal(l)),N=l,I){for(;z.Top.Y===z.Next.Bot.Y&&z.Next.OutIdx!==t.ClipperBase.Skip;)z=z.Next;if(z.Dx===t.ClipperBase.horizontal&&z.Next.OutIdx!==t.ClipperBase.Skip){for(V=z;V.Prev.Dx===t.ClipperBase.horizontal;)V=V.Prev;V.Prev.Top.X>z.Next.Top.X&&(z=V.Prev)}for(;l!==z;)l.NextInLML=l.Next,l.Dx===t.ClipperBase.horizontal&&l!==N&&l.Bot.X!==l.Prev.Top.X&&this.ReverseHorizontal(l),l=l.Next;l.Dx===t.ClipperBase.horizontal&&l!==N&&l.Bot.X!==l.Prev.Top.X&&this.ReverseHorizontal(l),z=z.Next}else{for(;z.Top.Y===z.Prev.Bot.Y&&z.Prev.OutIdx!==t.ClipperBase.Skip;)z=z.Prev;if(z.Dx===t.ClipperBase.horizontal&&z.Prev.OutIdx!==t.ClipperBase.Skip){for(V=z;V.Next.Dx===t.ClipperBase.horizontal;)V=V.Next;(V.Next.Top.X===z.Prev.Top.X||V.Next.Top.X>z.Prev.Top.X)&&(z=V.Next)}for(;l!==z;)l.NextInLML=l.Prev,l.Dx===t.ClipperBase.horizontal&&l!==N&&l.Bot.X!==l.Next.Top.X&&this.ReverseHorizontal(l),l=l.Prev;l.Dx===t.ClipperBase.horizontal&&l!==N&&l.Bot.X!==l.Next.Top.X&&this.ReverseHorizontal(l),z=z.Prev}return z},t.ClipperBase.prototype.AddPath=function(l,I,N){t.use_lines?!N&&I===t.PolyType.ptClip&&t.Error("AddPath: Open paths must be subject."):N||t.Error("AddPath: Open paths have been disabled.");var z=l.length-1;if(N)for(;z>0&&t.IntPoint.op_Equality(l[z],l[0]);)--z;for(;z>0&&t.IntPoint.op_Equality(l[z],l[z-1]);)--z;if(N&&z<2||!N&&z<1)return!1;for(var V=new Array,J=0;J<=z;J++)V.push(new t.TEdge);var nt=!0;V[1].Curr.X=l[1].X,V[1].Curr.Y=l[1].Y,t.use_xyz&&(V[1].Curr.Z=l[1].Z);var ft={Value:this.m_UseFullRange};this.RangeTest(l[0],ft),this.m_UseFullRange=ft.Value,ft.Value=this.m_UseFullRange,this.RangeTest(l[z],ft),this.m_UseFullRange=ft.Value,this.InitEdge(V[0],V[1],V[z],l[0]),this.InitEdge(V[z],V[0],V[z-1],l[z]);for(var J=z-1;J>=1;--J)ft.Value=this.m_UseFullRange,this.RangeTest(l[J],ft),this.m_UseFullRange=ft.Value,this.InitEdge(V[J],V[J+1],V[J-1],l[J]);for(var dt=V[0],At=dt,zt=dt;;){if(At.Curr===At.Next.Curr&&(N||At.Next!==dt)){if(At===At.Next)break;At===dt&&(dt=At.Next),At=this.RemoveEdge(At),zt=At;continue}if(At.Prev===At.Next)break;if(N&&t.ClipperBase.SlopesEqual4(At.Prev.Curr,At.Curr,At.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(At.Prev.Curr,At.Curr,At.Next.Curr))){At===dt&&(dt=At.Next),At=this.RemoveEdge(At),At=At.Prev,zt=At;continue}if(At=At.Next,At===zt||!N&&At.Next===dt)break}if(!N&&At===At.Next||N&&At.Prev===At.Next)return!1;N||(this.m_HasOpenPaths=!0,dt.Prev.OutIdx=t.ClipperBase.Skip),At=dt;do this.InitEdge2(At,I),At=At.Next,nt&&At.Curr.Y!==dt.Curr.Y&&(nt=!1);while(At!==dt);if(nt){if(N)return!1;At.Prev.OutIdx=t.ClipperBase.Skip;var Ot=new t.LocalMinima;for(Ot.Next=null,Ot.Y=At.Bot.Y,Ot.LeftBound=null,Ot.RightBound=At,Ot.RightBound.Side=t.EdgeSide.esRight,Ot.RightBound.WindDelta=0;At.Bot.X!==At.Prev.Top.X&&this.ReverseHorizontal(At),At.Next.OutIdx!==t.ClipperBase.Skip;)At.NextInLML=At.Next,At=At.Next;return this.InsertLocalMinima(Ot),this.m_edges.push(V),!0}this.m_edges.push(V);var Ut,Ht=null;for(t.IntPoint.op_Equality(At.Prev.Bot,At.Prev.Top)&&(At=At.Next);At=this.FindNextLocMin(At),At!==Ht;){Ht===null&&(Ht=At);var Ot=new t.LocalMinima;Ot.Next=null,Ot.Y=At.Bot.Y,At.Dx<At.Prev.Dx?(Ot.LeftBound=At.Prev,Ot.RightBound=At,Ut=!1):(Ot.LeftBound=At,Ot.RightBound=At.Prev,Ut=!0),Ot.LeftBound.Side=t.EdgeSide.esLeft,Ot.RightBound.Side=t.EdgeSide.esRight,N?Ot.LeftBound.Next===Ot.RightBound?Ot.LeftBound.WindDelta=-1:Ot.LeftBound.WindDelta=1:Ot.LeftBound.WindDelta=0,Ot.RightBound.WindDelta=-Ot.LeftBound.WindDelta,At=this.ProcessBound(Ot.LeftBound,Ut),At.OutIdx===t.ClipperBase.Skip&&(At=this.ProcessBound(At,Ut));var qt=this.ProcessBound(Ot.RightBound,!Ut);qt.OutIdx===t.ClipperBase.Skip&&(qt=this.ProcessBound(qt,!Ut)),Ot.LeftBound.OutIdx===t.ClipperBase.Skip?Ot.LeftBound=null:Ot.RightBound.OutIdx===t.ClipperBase.Skip&&(Ot.RightBound=null),this.InsertLocalMinima(Ot),Ut||(At=qt)}return!0},t.ClipperBase.prototype.AddPaths=function(l,I,N){for(var z=!1,V=0,J=l.length;V<J;++V)this.AddPath(l[V],I,N)&&(z=!0);return z},t.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(l,I,N){return t.IntPoint.op_Equality(l,N)||t.IntPoint.op_Equality(l,I)||t.IntPoint.op_Equality(N,I)?!1:l.X!==N.X?I.X>l.X==I.X<N.X:I.Y>l.Y==I.Y<N.Y},t.ClipperBase.prototype.RemoveEdge=function(l){l.Prev.Next=l.Next,l.Next.Prev=l.Prev;var I=l.Next;return l.Prev=null,I},t.ClipperBase.prototype.SetDx=function(l){l.Delta.X=l.Top.X-l.Bot.X,l.Delta.Y=l.Top.Y-l.Bot.Y,l.Delta.Y===0?l.Dx=t.ClipperBase.horizontal:l.Dx=l.Delta.X/l.Delta.Y},t.ClipperBase.prototype.InsertLocalMinima=function(l){if(this.m_MinimaList===null)this.m_MinimaList=l;else if(l.Y>=this.m_MinimaList.Y)l.Next=this.m_MinimaList,this.m_MinimaList=l;else{for(var I=this.m_MinimaList;I.Next!==null&&l.Y<I.Next.Y;)I=I.Next;l.Next=I.Next,I.Next=l}},t.ClipperBase.prototype.PopLocalMinima=function(l,I){return I.v=this.m_CurrentLM,this.m_CurrentLM!==null&&this.m_CurrentLM.Y===l?(this.m_CurrentLM=this.m_CurrentLM.Next,!0):!1},t.ClipperBase.prototype.ReverseHorizontal=function(l){var I=l.Top.X;l.Top.X=l.Bot.X,l.Bot.X=I,t.use_xyz&&(I=l.Top.Z,l.Top.Z=l.Bot.Z,l.Bot.Z=I)},t.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!==null){this.m_Scanbeam=null;for(var l=this.m_MinimaList;l!==null;){this.InsertScanbeam(l.Y);var I=l.LeftBound;I!==null&&(I.Curr.X=I.Bot.X,I.Curr.Y=I.Bot.Y,t.use_xyz&&(I.Curr.Z=I.Bot.Z),I.OutIdx=t.ClipperBase.Unassigned),I=l.RightBound,I!==null&&(I.Curr.X=I.Bot.X,I.Curr.Y=I.Bot.Y,t.use_xyz&&(I.Curr.Z=I.Bot.Z),I.OutIdx=t.ClipperBase.Unassigned),l=l.Next}this.m_ActiveEdges=null}},t.ClipperBase.prototype.InsertScanbeam=function(l){if(this.m_Scanbeam===null)this.m_Scanbeam=new t.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=l;else if(l>this.m_Scanbeam.Y){var I=new t.Scanbeam;I.Y=l,I.Next=this.m_Scanbeam,this.m_Scanbeam=I}else{for(var N=this.m_Scanbeam;N.Next!==null&&l<=N.Next.Y;)N=N.Next;if(l===N.Y)return;var z=new t.Scanbeam;z.Y=l,z.Next=N.Next,N.Next=z}},t.ClipperBase.prototype.PopScanbeam=function(l){return this.m_Scanbeam===null?(l.v=0,!1):(l.v=this.m_Scanbeam.Y,this.m_Scanbeam=this.m_Scanbeam.Next,!0)},t.ClipperBase.prototype.LocalMinimaPending=function(){return this.m_CurrentLM!==null},t.ClipperBase.prototype.CreateOutRec=function(){var l=new t.OutRec;return l.Idx=t.ClipperBase.Unassigned,l.IsHole=!1,l.IsOpen=!1,l.FirstLeft=null,l.Pts=null,l.BottomPt=null,l.PolyNode=null,this.m_PolyOuts.push(l),l.Idx=this.m_PolyOuts.length-1,l},t.ClipperBase.prototype.DisposeOutRec=function(l){var I=this.m_PolyOuts[l];I.Pts=null,I=null,this.m_PolyOuts[l]=null},t.ClipperBase.prototype.UpdateEdgeIntoAEL=function(l){l.NextInLML===null&&t.Error("UpdateEdgeIntoAEL: invalid call");var I=l.PrevInAEL,N=l.NextInAEL;return l.NextInLML.OutIdx=l.OutIdx,I!==null?I.NextInAEL=l.NextInLML:this.m_ActiveEdges=l.NextInLML,N!==null&&(N.PrevInAEL=l.NextInLML),l.NextInLML.Side=l.Side,l.NextInLML.WindDelta=l.WindDelta,l.NextInLML.WindCnt=l.WindCnt,l.NextInLML.WindCnt2=l.WindCnt2,l=l.NextInLML,l.Curr.X=l.Bot.X,l.Curr.Y=l.Bot.Y,l.PrevInAEL=I,l.NextInAEL=N,t.ClipperBase.IsHorizontal(l)||this.InsertScanbeam(l.Top.Y),l},t.ClipperBase.prototype.SwapPositionsInAEL=function(l,I){if(!(l.NextInAEL===l.PrevInAEL||I.NextInAEL===I.PrevInAEL)){if(l.NextInAEL===I){var N=I.NextInAEL;N!==null&&(N.PrevInAEL=l);var z=l.PrevInAEL;z!==null&&(z.NextInAEL=I),I.PrevInAEL=z,I.NextInAEL=l,l.PrevInAEL=I,l.NextInAEL=N}else if(I.NextInAEL===l){var V=l.NextInAEL;V!==null&&(V.PrevInAEL=I);var J=I.PrevInAEL;J!==null&&(J.NextInAEL=l),l.PrevInAEL=J,l.NextInAEL=I,I.PrevInAEL=l,I.NextInAEL=V}else{var nt=l.NextInAEL,ft=l.PrevInAEL;l.NextInAEL=I.NextInAEL,l.NextInAEL!==null&&(l.NextInAEL.PrevInAEL=l),l.PrevInAEL=I.PrevInAEL,l.PrevInAEL!==null&&(l.PrevInAEL.NextInAEL=l),I.NextInAEL=nt,I.NextInAEL!==null&&(I.NextInAEL.PrevInAEL=I),I.PrevInAEL=ft,I.PrevInAEL!==null&&(I.PrevInAEL.NextInAEL=I)}l.PrevInAEL===null?this.m_ActiveEdges=l:I.PrevInAEL===null&&(this.m_ActiveEdges=I)}},t.ClipperBase.prototype.DeleteFromAEL=function(l){var I=l.PrevInAEL,N=l.NextInAEL;I===null&&N===null&&l!==this.m_ActiveEdges||(I!==null?I.NextInAEL=N:this.m_ActiveEdges=N,N!==null&&(N.PrevInAEL=I),l.NextInAEL=null,l.PrevInAEL=null)},t.Clipper=function(l){typeof l>"u"&&(l=0),this.m_PolyOuts=null,this.m_ClipType=t.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=t.PolyFillType.pftEvenOdd,this.m_SubjFillType=t.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,t.ClipperBase.call(this),this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=t.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array,this.m_Joins=new Array,this.m_GhostJoins=new Array,this.ReverseSolution=(1&l)!==0,this.StrictlySimple=(2&l)!==0,this.PreserveCollinear=(4&l)!==0,t.use_xyz&&(this.ZFillFunction=null)},t.Clipper.ioReverseSolution=1,t.Clipper.ioStrictlySimple=2,t.Clipper.ioPreserveCollinear=4,t.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),t.ClipperBase.prototype.Clear.call(this))},t.Clipper.prototype.InsertMaxima=function(l){var I=new t.Maxima;if(I.X=l,this.m_Maxima===null)this.m_Maxima=I,this.m_Maxima.Next=null,this.m_Maxima.Prev=null;else if(l<this.m_Maxima.X)I.Next=this.m_Maxima,I.Prev=null,this.m_Maxima=I;else{for(var N=this.m_Maxima;N.Next!==null&&l>=N.Next.X;)N=N.Next;if(l===N.X)return;I.Next=N.Next,I.Prev=N,N.Next!==null&&(N.Next.Prev=I),N.Next=I}},t.Clipper.prototype.Execute=function(){var l=arguments,I=l.length,N=l[1]instanceof t.PolyTree;if(I===4&&!N){var z=l[0],V=l[1],J=l[2],nt=l[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&t.Error("Error: PolyTree struct is needed for open path clipping."),this.m_ExecuteLocked=!0,t.Clear(V),this.m_SubjFillType=J,this.m_ClipFillType=nt,this.m_ClipType=z,this.m_UsingPolyTree=!1;try{var ft=this.ExecuteInternal();ft&&this.BuildResult(V)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return ft}else if(I===4&&N){var z=l[0],dt=l[1],J=l[2],nt=l[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=J,this.m_ClipFillType=nt,this.m_ClipType=z,this.m_UsingPolyTree=!0;try{var ft=this.ExecuteInternal();ft&&this.BuildResult2(dt)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return ft}else if(I===2&&!N){var z=l[0],V=l[1];return this.Execute(z,V,t.PolyFillType.pftEvenOdd,t.PolyFillType.pftEvenOdd)}else if(I===2&&N){var z=l[0],dt=l[1];return this.Execute(z,dt,t.PolyFillType.pftEvenOdd,t.PolyFillType.pftEvenOdd)}},t.Clipper.prototype.FixHoleLinkage=function(l){if(!(l.FirstLeft===null||l.IsHole!==l.FirstLeft.IsHole&&l.FirstLeft.Pts!==null)){for(var I=l.FirstLeft;I!==null&&(I.IsHole===l.IsHole||I.Pts===null);)I=I.FirstLeft;l.FirstLeft=I}},t.Clipper.prototype.ExecuteInternal=function(){try{this.Reset(),this.m_SortedEdges=null,this.m_Maxima=null;var l={},I={};if(!this.PopScanbeam(l))return!1;for(this.InsertLocalMinimaIntoAEL(l.v);this.PopScanbeam(I)||this.LocalMinimaPending();){if(this.ProcessHorizontals(),this.m_GhostJoins.length=0,!this.ProcessIntersections(I.v))return!1;this.ProcessEdgesAtTopOfScanbeam(I.v),l.v=I.v,this.InsertLocalMinimaIntoAEL(l.v)}var N,z,V;for(z=0,V=this.m_PolyOuts.length;z<V;z++)N=this.m_PolyOuts[z],!(N.Pts===null||N.IsOpen)&&(N.IsHole^this.ReverseSolution)==this.Area$1(N)>0&&this.ReversePolyPtLinks(N.Pts);for(this.JoinCommonEdges(),z=0,V=this.m_PolyOuts.length;z<V;z++)N=this.m_PolyOuts[z],N.Pts!==null&&(N.IsOpen?this.FixupOutPolyline(N):this.FixupOutPolygon(N));return this.StrictlySimple&&this.DoSimplePolygons(),!0}finally{this.m_Joins.length=0,this.m_GhostJoins.length=0}},t.Clipper.prototype.DisposeAllPolyPts=function(){for(var l=0,I=this.m_PolyOuts.length;l<I;++l)this.DisposeOutRec(l);t.Clear(this.m_PolyOuts)},t.Clipper.prototype.AddJoin=function(l,I,N){var z=new t.Join;z.OutPt1=l,z.OutPt2=I,z.OffPt.X=N.X,z.OffPt.Y=N.Y,t.use_xyz&&(z.OffPt.Z=N.Z),this.m_Joins.push(z)},t.Clipper.prototype.AddGhostJoin=function(l,I){var N=new t.Join;N.OutPt1=l,N.OffPt.X=I.X,N.OffPt.Y=I.Y,t.use_xyz&&(N.OffPt.Z=I.Z),this.m_GhostJoins.push(N)},t.Clipper.prototype.SetZ=function(l,I,N){if(this.ZFillFunction!==null){if(l.Z!==0||this.ZFillFunction===null)return;t.IntPoint.op_Equality(l,I.Bot)?l.Z=I.Bot.Z:t.IntPoint.op_Equality(l,I.Top)?l.Z=I.Top.Z:t.IntPoint.op_Equality(l,N.Bot)?l.Z=N.Bot.Z:t.IntPoint.op_Equality(l,N.Top)?l.Z=N.Top.Z:this.ZFillFunction(I.Bot,I.Top,N.Bot,N.Top,l)}},t.Clipper.prototype.InsertLocalMinimaIntoAEL=function(l){for(var I={},N,z;this.PopLocalMinima(l,I);){N=I.v.LeftBound,z=I.v.RightBound;var V=null;if(N===null?(this.InsertEdgeIntoAEL(z,null),this.SetWindingCount(z),this.IsContributing(z)&&(V=this.AddOutPt(z,z.Bot))):z===null?(this.InsertEdgeIntoAEL(N,null),this.SetWindingCount(N),this.IsContributing(N)&&(V=this.AddOutPt(N,N.Bot)),this.InsertScanbeam(N.Top.Y)):(this.InsertEdgeIntoAEL(N,null),this.InsertEdgeIntoAEL(z,N),this.SetWindingCount(N),z.WindCnt=N.WindCnt,z.WindCnt2=N.WindCnt2,this.IsContributing(N)&&(V=this.AddLocalMinPoly(N,z,N.Bot)),this.InsertScanbeam(N.Top.Y)),z!==null&&(t.ClipperBase.IsHorizontal(z)?(z.NextInLML!==null&&this.InsertScanbeam(z.NextInLML.Top.Y),this.AddEdgeToSEL(z)):this.InsertScanbeam(z.Top.Y)),!(N===null||z===null)){if(V!==null&&t.ClipperBase.IsHorizontal(z)&&this.m_GhostJoins.length>0&&z.WindDelta!==0)for(var J=0,nt=this.m_GhostJoins.length;J<nt;J++){var ft=this.m_GhostJoins[J];this.HorzSegmentsOverlap(ft.OutPt1.Pt.X,ft.OffPt.X,z.Bot.X,z.Top.X)&&this.AddJoin(ft.OutPt1,V,ft.OffPt)}if(N.OutIdx>=0&&N.PrevInAEL!==null&&N.PrevInAEL.Curr.X===N.Bot.X&&N.PrevInAEL.OutIdx>=0&&t.ClipperBase.SlopesEqual5(N.PrevInAEL.Curr,N.PrevInAEL.Top,N.Curr,N.Top,this.m_UseFullRange)&&N.WindDelta!==0&&N.PrevInAEL.WindDelta!==0){var dt=this.AddOutPt(N.PrevInAEL,N.Bot);this.AddJoin(V,dt,N.Top)}if(N.NextInAEL!==z){if(z.OutIdx>=0&&z.PrevInAEL.OutIdx>=0&&t.ClipperBase.SlopesEqual5(z.PrevInAEL.Curr,z.PrevInAEL.Top,z.Curr,z.Top,this.m_UseFullRange)&&z.WindDelta!==0&&z.PrevInAEL.WindDelta!==0){var dt=this.AddOutPt(z.PrevInAEL,z.Bot);this.AddJoin(V,dt,z.Top)}var At=N.NextInAEL;if(At!==null)for(;At!==z;)this.IntersectEdges(z,At,N.Curr),At=At.NextInAEL}}}},t.Clipper.prototype.InsertEdgeIntoAEL=function(l,I){if(this.m_ActiveEdges===null)l.PrevInAEL=null,l.NextInAEL=null,this.m_ActiveEdges=l;else if(I===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,l))l.PrevInAEL=null,l.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=l,this.m_ActiveEdges=l;else{for(I===null&&(I=this.m_ActiveEdges);I.NextInAEL!==null&&!this.E2InsertsBeforeE1(I.NextInAEL,l);)I=I.NextInAEL;l.NextInAEL=I.NextInAEL,I.NextInAEL!==null&&(I.NextInAEL.PrevInAEL=l),l.PrevInAEL=I,I.NextInAEL=l}},t.Clipper.prototype.E2InsertsBeforeE1=function(l,I){return I.Curr.X===l.Curr.X?I.Top.Y>l.Top.Y?I.Top.X<t.Clipper.TopX(l,I.Top.Y):l.Top.X>t.Clipper.TopX(I,l.Top.Y):I.Curr.X<l.Curr.X},t.Clipper.prototype.IsEvenOddFillType=function(l){return l.PolyTyp===t.PolyType.ptSubject?this.m_SubjFillType===t.PolyFillType.pftEvenOdd:this.m_ClipFillType===t.PolyFillType.pftEvenOdd},t.Clipper.prototype.IsEvenOddAltFillType=function(l){return l.PolyTyp===t.PolyType.ptSubject?this.m_ClipFillType===t.PolyFillType.pftEvenOdd:this.m_SubjFillType===t.PolyFillType.pftEvenOdd},t.Clipper.prototype.IsContributing=function(l){var I,N;switch(l.PolyTyp===t.PolyType.ptSubject?(I=this.m_SubjFillType,N=this.m_ClipFillType):(I=this.m_ClipFillType,N=this.m_SubjFillType),I){case t.PolyFillType.pftEvenOdd:if(l.WindDelta===0&&l.WindCnt!==1)return!1;break;case t.PolyFillType.pftNonZero:if(Math.abs(l.WindCnt)!==1)return!1;break;case t.PolyFillType.pftPositive:if(l.WindCnt!==1)return!1;break;default:if(l.WindCnt!==-1)return!1;break}switch(this.m_ClipType){case t.ClipType.ctIntersection:switch(N){case t.PolyFillType.pftEvenOdd:case t.PolyFillType.pftNonZero:return l.WindCnt2!==0;case t.PolyFillType.pftPositive:return l.WindCnt2>0;default:return l.WindCnt2<0}case t.ClipType.ctUnion:switch(N){case t.PolyFillType.pftEvenOdd:case t.PolyFillType.pftNonZero:return l.WindCnt2===0;case t.PolyFillType.pftPositive:return l.WindCnt2<=0;default:return l.WindCnt2>=0}case t.ClipType.ctDifference:if(l.PolyTyp===t.PolyType.ptSubject)switch(N){case t.PolyFillType.pftEvenOdd:case t.PolyFillType.pftNonZero:return l.WindCnt2===0;case t.PolyFillType.pftPositive:return l.WindCnt2<=0;default:return l.WindCnt2>=0}else switch(N){case t.PolyFillType.pftEvenOdd:case t.PolyFillType.pftNonZero:return l.WindCnt2!==0;case t.PolyFillType.pftPositive:return l.WindCnt2>0;default:return l.WindCnt2<0}case t.ClipType.ctXor:if(l.WindDelta===0)switch(N){case t.PolyFillType.pftEvenOdd:case t.PolyFillType.pftNonZero:return l.WindCnt2===0;case t.PolyFillType.pftPositive:return l.WindCnt2<=0;default:return l.WindCnt2>=0}else return!0}return!0},t.Clipper.prototype.SetWindingCount=function(l){for(var I=l.PrevInAEL;I!==null&&(I.PolyTyp!==l.PolyTyp||I.WindDelta===0);)I=I.PrevInAEL;if(I===null){var N=l.PolyTyp===t.PolyType.ptSubject?this.m_SubjFillType:this.m_ClipFillType;l.WindDelta===0?l.WindCnt=N===t.PolyFillType.pftNegative?-1:1:l.WindCnt=l.WindDelta,l.WindCnt2=0,I=this.m_ActiveEdges}else if(l.WindDelta===0&&this.m_ClipType!==t.ClipType.ctUnion)l.WindCnt=1,l.WindCnt2=I.WindCnt2,I=I.NextInAEL;else if(this.IsEvenOddFillType(l)){if(l.WindDelta===0){for(var z=!0,V=I.PrevInAEL;V!==null;)V.PolyTyp===I.PolyTyp&&V.WindDelta!==0&&(z=!z),V=V.PrevInAEL;l.WindCnt=z?0:1}else l.WindCnt=l.WindDelta;l.WindCnt2=I.WindCnt2,I=I.NextInAEL}else I.WindCnt*I.WindDelta<0?Math.abs(I.WindCnt)>1?I.WindDelta*l.WindDelta<0?l.WindCnt=I.WindCnt:l.WindCnt=I.WindCnt+l.WindDelta:l.WindCnt=l.WindDelta===0?1:l.WindDelta:l.WindDelta===0?l.WindCnt=I.WindCnt<0?I.WindCnt-1:I.WindCnt+1:I.WindDelta*l.WindDelta<0?l.WindCnt=I.WindCnt:l.WindCnt=I.WindCnt+l.WindDelta,l.WindCnt2=I.WindCnt2,I=I.NextInAEL;if(this.IsEvenOddAltFillType(l))for(;I!==l;)I.WindDelta!==0&&(l.WindCnt2=l.WindCnt2===0?1:0),I=I.NextInAEL;else for(;I!==l;)l.WindCnt2+=I.WindDelta,I=I.NextInAEL},t.Clipper.prototype.AddEdgeToSEL=function(l){this.m_SortedEdges===null?(this.m_SortedEdges=l,l.PrevInSEL=null,l.NextInSEL=null):(l.NextInSEL=this.m_SortedEdges,l.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=l,this.m_SortedEdges=l)},t.Clipper.prototype.PopEdgeFromSEL=function(l){if(l.v=this.m_SortedEdges,l.v===null)return!1;var I=l.v;return this.m_SortedEdges=l.v.NextInSEL,this.m_SortedEdges!==null&&(this.m_SortedEdges.PrevInSEL=null),I.NextInSEL=null,I.PrevInSEL=null,!0},t.Clipper.prototype.CopyAELToSEL=function(){var l=this.m_ActiveEdges;for(this.m_SortedEdges=l;l!==null;)l.PrevInSEL=l.PrevInAEL,l.NextInSEL=l.NextInAEL,l=l.NextInAEL},t.Clipper.prototype.SwapPositionsInSEL=function(l,I){if(!(l.NextInSEL===null&&l.PrevInSEL===null)&&!(I.NextInSEL===null&&I.PrevInSEL===null)){if(l.NextInSEL===I){var N=I.NextInSEL;N!==null&&(N.PrevInSEL=l);var z=l.PrevInSEL;z!==null&&(z.NextInSEL=I),I.PrevInSEL=z,I.NextInSEL=l,l.PrevInSEL=I,l.NextInSEL=N}else if(I.NextInSEL===l){var N=l.NextInSEL;N!==null&&(N.PrevInSEL=I);var z=I.PrevInSEL;z!==null&&(z.NextInSEL=l),l.PrevInSEL=z,l.NextInSEL=I,I.PrevInSEL=l,I.NextInSEL=N}else{var N=l.NextInSEL,z=l.PrevInSEL;l.NextInSEL=I.NextInSEL,l.NextInSEL!==null&&(l.NextInSEL.PrevInSEL=l),l.PrevInSEL=I.PrevInSEL,l.PrevInSEL!==null&&(l.PrevInSEL.NextInSEL=l),I.NextInSEL=N,I.NextInSEL!==null&&(I.NextInSEL.PrevInSEL=I),I.PrevInSEL=z,I.PrevInSEL!==null&&(I.PrevInSEL.NextInSEL=I)}l.PrevInSEL===null?this.m_SortedEdges=l:I.PrevInSEL===null&&(this.m_SortedEdges=I)}},t.Clipper.prototype.AddLocalMaxPoly=function(l,I,N){this.AddOutPt(l,N),I.WindDelta===0&&this.AddOutPt(I,N),l.OutIdx===I.OutIdx?(l.OutIdx=-1,I.OutIdx=-1):l.OutIdx<I.OutIdx?this.AppendPolygon(l,I):this.AppendPolygon(I,l)},t.Clipper.prototype.AddLocalMinPoly=function(l,I,N){var z,V,J;if(t.ClipperBase.IsHorizontal(I)||l.Dx>I.Dx?(z=this.AddOutPt(l,N),I.OutIdx=l.OutIdx,l.Side=t.EdgeSide.esLeft,I.Side=t.EdgeSide.esRight,V=l,V.PrevInAEL===I?J=I.PrevInAEL:J=V.PrevInAEL):(z=this.AddOutPt(I,N),l.OutIdx=I.OutIdx,l.Side=t.EdgeSide.esRight,I.Side=t.EdgeSide.esLeft,V=I,V.PrevInAEL===l?J=l.PrevInAEL:J=V.PrevInAEL),J!==null&&J.OutIdx>=0&&J.Top.Y<N.Y&&V.Top.Y<N.Y){var nt=t.Clipper.TopX(J,N.Y),ft=t.Clipper.TopX(V,N.Y);if(nt===ft&&V.WindDelta!==0&&J.WindDelta!==0&&t.ClipperBase.SlopesEqual5(new t.IntPoint2(nt,N.Y),J.Top,new t.IntPoint2(ft,N.Y),V.Top,this.m_UseFullRange)){var dt=this.AddOutPt(J,N);this.AddJoin(z,dt,V.Top)}}return z},t.Clipper.prototype.AddOutPt=function(l,I){if(l.OutIdx<0){var N=this.CreateOutRec();N.IsOpen=l.WindDelta===0;var z=new t.OutPt;return N.Pts=z,z.Idx=N.Idx,z.Pt.X=I.X,z.Pt.Y=I.Y,t.use_xyz&&(z.Pt.Z=I.Z),z.Next=z,z.Prev=z,N.IsOpen||this.SetHoleState(l,N),l.OutIdx=N.Idx,z}else{var N=this.m_PolyOuts[l.OutIdx],V=N.Pts,J=l.Side===t.EdgeSide.esLeft;if(J&&t.IntPoint.op_Equality(I,V.Pt))return V;if(!J&&t.IntPoint.op_Equality(I,V.Prev.Pt))return V.Prev;var z=new t.OutPt;return z.Idx=N.Idx,z.Pt.X=I.X,z.Pt.Y=I.Y,t.use_xyz&&(z.Pt.Z=I.Z),z.Next=V,z.Prev=V.Prev,z.Prev.Next=z,V.Prev=z,J&&(N.Pts=z),z}},t.Clipper.prototype.GetLastOutPt=function(l){var I=this.m_PolyOuts[l.OutIdx];return l.Side===t.EdgeSide.esLeft?I.Pts:I.Pts.Prev},t.Clipper.prototype.SwapPoints=function(l,I){var N=new t.IntPoint1(l.Value);l.Value.X=I.Value.X,l.Value.Y=I.Value.Y,t.use_xyz&&(l.Value.Z=I.Value.Z),I.Value.X=N.X,I.Value.Y=N.Y,t.use_xyz&&(I.Value.Z=N.Z)},t.Clipper.prototype.HorzSegmentsOverlap=function(l,I,N,z){var V;return l>I&&(V=l,l=I,I=V),N>z&&(V=N,N=z,z=V),l<z&&N<I},t.Clipper.prototype.SetHoleState=function(l,I){for(var N=l.PrevInAEL,z=null;N!==null;)N.OutIdx>=0&&N.WindDelta!==0&&(z===null?z=N:z.OutIdx===N.OutIdx&&(z=null)),N=N.PrevInAEL;z===null?(I.FirstLeft=null,I.IsHole=!1):(I.FirstLeft=this.m_PolyOuts[z.OutIdx],I.IsHole=!I.FirstLeft.IsHole)},t.Clipper.prototype.GetDx=function(l,I){return l.Y===I.Y?t.ClipperBase.horizontal:(I.X-l.X)/(I.Y-l.Y)},t.Clipper.prototype.FirstIsBottomPt=function(l,I){for(var N=l.Prev;t.IntPoint.op_Equality(N.Pt,l.Pt)&&N!==l;)N=N.Prev;var z=Math.abs(this.GetDx(l.Pt,N.Pt));for(N=l.Next;t.IntPoint.op_Equality(N.Pt,l.Pt)&&N!==l;)N=N.Next;var V=Math.abs(this.GetDx(l.Pt,N.Pt));for(N=I.Prev;t.IntPoint.op_Equality(N.Pt,I.Pt)&&N!==I;)N=N.Prev;var J=Math.abs(this.GetDx(I.Pt,N.Pt));for(N=I.Next;t.IntPoint.op_Equality(N.Pt,I.Pt)&&N!==I;)N=N.Next;var nt=Math.abs(this.GetDx(I.Pt,N.Pt));return Math.max(z,V)===Math.max(J,nt)&&Math.min(z,V)===Math.min(J,nt)?this.Area(l)>0:z>=J&&z>=nt||V>=J&&V>=nt},t.Clipper.prototype.GetBottomPt=function(l){for(var I=null,N=l.Next;N!==l;)N.Pt.Y>l.Pt.Y?(l=N,I=null):N.Pt.Y===l.Pt.Y&&N.Pt.X<=l.Pt.X&&(N.Pt.X<l.Pt.X?(I=null,l=N):N.Next!==l&&N.Prev!==l&&(I=N)),N=N.Next;if(I!==null)for(;I!==N;)for(this.FirstIsBottomPt(N,I)||(l=I),I=I.Next;t.IntPoint.op_Inequality(I.Pt,l.Pt);)I=I.Next;return l},t.Clipper.prototype.GetLowermostRec=function(l,I){l.BottomPt===null&&(l.BottomPt=this.GetBottomPt(l.Pts)),I.BottomPt===null&&(I.BottomPt=this.GetBottomPt(I.Pts));var N=l.BottomPt,z=I.BottomPt;return N.Pt.Y>z.Pt.Y?l:N.Pt.Y<z.Pt.Y?I:N.Pt.X<z.Pt.X?l:N.Pt.X>z.Pt.X||N.Next===N?I:z.Next===z||this.FirstIsBottomPt(N,z)?l:I},t.Clipper.prototype.OutRec1RightOfOutRec2=function(l,I){do if(l=l.FirstLeft,l===I)return!0;while(l!==null);return!1},t.Clipper.prototype.GetOutRec=function(l){for(var I=this.m_PolyOuts[l];I!==this.m_PolyOuts[I.Idx];)I=this.m_PolyOuts[I.Idx];return I},t.Clipper.prototype.AppendPolygon=function(l,I){var N=this.m_PolyOuts[l.OutIdx],z=this.m_PolyOuts[I.OutIdx],V;this.OutRec1RightOfOutRec2(N,z)?V=z:this.OutRec1RightOfOutRec2(z,N)?V=N:V=this.GetLowermostRec(N,z);var J=N.Pts,nt=J.Prev,ft=z.Pts,dt=ft.Prev;l.Side===t.EdgeSide.esLeft?I.Side===t.EdgeSide.esLeft?(this.ReversePolyPtLinks(ft),ft.Next=J,J.Prev=ft,nt.Next=dt,dt.Prev=nt,N.Pts=dt):(dt.Next=J,J.Prev=dt,ft.Prev=nt,nt.Next=ft,N.Pts=ft):I.Side===t.EdgeSide.esRight?(this.ReversePolyPtLinks(ft),nt.Next=dt,dt.Prev=nt,ft.Next=J,J.Prev=ft):(nt.Next=ft,ft.Prev=nt,J.Prev=dt,dt.Next=J),N.BottomPt=null,V===z&&(z.FirstLeft!==N&&(N.FirstLeft=z.FirstLeft),N.IsHole=z.IsHole),z.Pts=null,z.BottomPt=null,z.FirstLeft=N;var At=l.OutIdx,zt=I.OutIdx;l.OutIdx=-1,I.OutIdx=-1;for(var Ot=this.m_ActiveEdges;Ot!==null;){if(Ot.OutIdx===zt){Ot.OutIdx=At,Ot.Side=l.Side;break}Ot=Ot.NextInAEL}z.Idx=N.Idx},t.Clipper.prototype.ReversePolyPtLinks=function(l){if(l!==null){var I,N;I=l;do N=I.Next,I.Next=I.Prev,I.Prev=N,I=N;while(I!==l)}},t.Clipper.SwapSides=function(l,I){var N=l.Side;l.Side=I.Side,I.Side=N},t.Clipper.SwapPolyIndexes=function(l,I){var N=l.OutIdx;l.OutIdx=I.OutIdx,I.OutIdx=N},t.Clipper.prototype.IntersectEdges=function(l,I,N){var z=l.OutIdx>=0,V=I.OutIdx>=0;if(t.use_xyz&&this.SetZ(N,l,I),t.use_lines&&(l.WindDelta===0||I.WindDelta===0)){if(l.WindDelta===0&&I.WindDelta===0)return;l.PolyTyp===I.PolyTyp&&l.WindDelta!==I.WindDelta&&this.m_ClipType===t.ClipType.ctUnion?l.WindDelta===0?V&&(this.AddOutPt(l,N),z&&(l.OutIdx=-1)):z&&(this.AddOutPt(I,N),V&&(I.OutIdx=-1)):l.PolyTyp!==I.PolyTyp&&(l.WindDelta===0&&Math.abs(I.WindCnt)===1&&(this.m_ClipType!==t.ClipType.ctUnion||I.WindCnt2===0)?(this.AddOutPt(l,N),z&&(l.OutIdx=-1)):I.WindDelta===0&&Math.abs(l.WindCnt)===1&&(this.m_ClipType!==t.ClipType.ctUnion||l.WindCnt2===0)&&(this.AddOutPt(I,N),V&&(I.OutIdx=-1)));return}if(l.PolyTyp===I.PolyTyp)if(this.IsEvenOddFillType(l)){var J=l.WindCnt;l.WindCnt=I.WindCnt,I.WindCnt=J}else l.WindCnt+I.WindDelta===0?l.WindCnt=-l.WindCnt:l.WindCnt+=I.WindDelta,I.WindCnt-l.WindDelta===0?I.WindCnt=-I.WindCnt:I.WindCnt-=l.WindDelta;else this.IsEvenOddFillType(I)?l.WindCnt2=l.WindCnt2===0?1:0:l.WindCnt2+=I.WindDelta,this.IsEvenOddFillType(l)?I.WindCnt2=I.WindCnt2===0?1:0:I.WindCnt2-=l.WindDelta;var nt,ft,dt,At;l.PolyTyp===t.PolyType.ptSubject?(nt=this.m_SubjFillType,dt=this.m_ClipFillType):(nt=this.m_ClipFillType,dt=this.m_SubjFillType),I.PolyTyp===t.PolyType.ptSubject?(ft=this.m_SubjFillType,At=this.m_ClipFillType):(ft=this.m_ClipFillType,At=this.m_SubjFillType);var zt,Ot;switch(nt){case t.PolyFillType.pftPositive:zt=l.WindCnt;break;case t.PolyFillType.pftNegative:zt=-l.WindCnt;break;default:zt=Math.abs(l.WindCnt);break}switch(ft){case t.PolyFillType.pftPositive:Ot=I.WindCnt;break;case t.PolyFillType.pftNegative:Ot=-I.WindCnt;break;default:Ot=Math.abs(I.WindCnt);break}if(z&&V)zt!==0&&zt!==1||Ot!==0&&Ot!==1||l.PolyTyp!==I.PolyTyp&&this.m_ClipType!==t.ClipType.ctXor?this.AddLocalMaxPoly(l,I,N):(this.AddOutPt(l,N),this.AddOutPt(I,N),t.Clipper.SwapSides(l,I),t.Clipper.SwapPolyIndexes(l,I));else if(z)(Ot===0||Ot===1)&&(this.AddOutPt(l,N),t.Clipper.SwapSides(l,I),t.Clipper.SwapPolyIndexes(l,I));else if(V)(zt===0||zt===1)&&(this.AddOutPt(I,N),t.Clipper.SwapSides(l,I),t.Clipper.SwapPolyIndexes(l,I));else if((zt===0||zt===1)&&(Ot===0||Ot===1)){var Ut,Ht;switch(dt){case t.PolyFillType.pftPositive:Ut=l.WindCnt2;break;case t.PolyFillType.pftNegative:Ut=-l.WindCnt2;break;default:Ut=Math.abs(l.WindCnt2);break}switch(At){case t.PolyFillType.pftPositive:Ht=I.WindCnt2;break;case t.PolyFillType.pftNegative:Ht=-I.WindCnt2;break;default:Ht=Math.abs(I.WindCnt2);break}if(l.PolyTyp!==I.PolyTyp)this.AddLocalMinPoly(l,I,N);else if(zt===1&&Ot===1)switch(this.m_ClipType){case t.ClipType.ctIntersection:Ut>0&&Ht>0&&this.AddLocalMinPoly(l,I,N);break;case t.ClipType.ctUnion:Ut<=0&&Ht<=0&&this.AddLocalMinPoly(l,I,N);break;case t.ClipType.ctDifference:(l.PolyTyp===t.PolyType.ptClip&&Ut>0&&Ht>0||l.PolyTyp===t.PolyType.ptSubject&&Ut<=0&&Ht<=0)&&this.AddLocalMinPoly(l,I,N);break;case t.ClipType.ctXor:this.AddLocalMinPoly(l,I,N);break}else t.Clipper.SwapSides(l,I)}},t.Clipper.prototype.DeleteFromSEL=function(l){var I=l.PrevInSEL,N=l.NextInSEL;I===null&&N===null&&l!==this.m_SortedEdges||(I!==null?I.NextInSEL=N:this.m_SortedEdges=N,N!==null&&(N.PrevInSEL=I),l.NextInSEL=null,l.PrevInSEL=null)},t.Clipper.prototype.ProcessHorizontals=function(){for(var l={};this.PopEdgeFromSEL(l);)this.ProcessHorizontal(l.v)},t.Clipper.prototype.GetHorzDirection=function(l,I){l.Bot.X<l.Top.X?(I.Left=l.Bot.X,I.Right=l.Top.X,I.Dir=t.Direction.dLeftToRight):(I.Left=l.Top.X,I.Right=l.Bot.X,I.Dir=t.Direction.dRightToLeft)},t.Clipper.prototype.ProcessHorizontal=function(l){var I={Dir:null,Left:null,Right:null};this.GetHorzDirection(l,I);for(var N=I.Dir,z=I.Left,V=I.Right,J=l.WindDelta===0,nt=l,ft=null;nt.NextInLML!==null&&t.ClipperBase.IsHorizontal(nt.NextInLML);)nt=nt.NextInLML;nt.NextInLML===null&&(ft=this.GetMaximaPair(nt));var dt=this.m_Maxima;if(dt!==null)if(N===t.Direction.dLeftToRight){for(;dt!==null&&dt.X<=l.Bot.X;)dt=dt.Next;dt!==null&&dt.X>=nt.Top.X&&(dt=null)}else{for(;dt.Next!==null&&dt.Next.X<l.Bot.X;)dt=dt.Next;dt.X<=nt.Top.X&&(dt=null)}for(var At=null;;){for(var zt=l===nt,Ot=this.GetNextInAEL(l,N);Ot!==null;){if(dt!==null)if(N===t.Direction.dLeftToRight)for(;dt!==null&&dt.X<Ot.Curr.X;)l.OutIdx>=0&&!J&&this.AddOutPt(l,new t.IntPoint2(dt.X,l.Bot.Y)),dt=dt.Next;else for(;dt!==null&&dt.X>Ot.Curr.X;)l.OutIdx>=0&&!J&&this.AddOutPt(l,new t.IntPoint2(dt.X,l.Bot.Y)),dt=dt.Prev;if(N===t.Direction.dLeftToRight&&Ot.Curr.X>V||N===t.Direction.dRightToLeft&&Ot.Curr.X<z||Ot.Curr.X===l.Top.X&&l.NextInLML!==null&&Ot.Dx<l.NextInLML.Dx)break;if(l.OutIdx>=0&&!J){t.use_xyz&&(N===t.Direction.dLeftToRight?this.SetZ(Ot.Curr,l,Ot):this.SetZ(Ot.Curr,Ot,l)),At=this.AddOutPt(l,Ot.Curr);for(var Ut=this.m_SortedEdges;Ut!==null;){if(Ut.OutIdx>=0&&this.HorzSegmentsOverlap(l.Bot.X,l.Top.X,Ut.Bot.X,Ut.Top.X)){var Ht=this.GetLastOutPt(Ut);this.AddJoin(Ht,At,Ut.Top)}Ut=Ut.NextInSEL}this.AddGhostJoin(At,l.Bot)}if(Ot===ft&&zt){l.OutIdx>=0&&this.AddLocalMaxPoly(l,ft,l.Top),this.DeleteFromAEL(l),this.DeleteFromAEL(ft);return}if(N===t.Direction.dLeftToRight){var qt=new t.IntPoint2(Ot.Curr.X,l.Curr.Y);this.IntersectEdges(l,Ot,qt)}else{var qt=new t.IntPoint2(Ot.Curr.X,l.Curr.Y);this.IntersectEdges(Ot,l,qt)}var _t=this.GetNextInAEL(Ot,N);this.SwapPositionsInAEL(l,Ot),Ot=_t}if(l.NextInLML===null||!t.ClipperBase.IsHorizontal(l.NextInLML))break;l=this.UpdateEdgeIntoAEL(l),l.OutIdx>=0&&this.AddOutPt(l,l.Bot),I={Dir:N,Left:z,Right:V},this.GetHorzDirection(l,I),N=I.Dir,z=I.Left,V=I.Right}if(l.OutIdx>=0&&At===null){At=this.GetLastOutPt(l);for(var Ut=this.m_SortedEdges;Ut!==null;){if(Ut.OutIdx>=0&&this.HorzSegmentsOverlap(l.Bot.X,l.Top.X,Ut.Bot.X,Ut.Top.X)){var Ht=this.GetLastOutPt(Ut);this.AddJoin(Ht,At,Ut.Top)}Ut=Ut.NextInSEL}this.AddGhostJoin(At,l.Top)}if(l.NextInLML!==null)if(l.OutIdx>=0){if(At=this.AddOutPt(l,l.Top),l=this.UpdateEdgeIntoAEL(l),l.WindDelta===0)return;var re=l.PrevInAEL,_t=l.NextInAEL;if(re!==null&&re.Curr.X===l.Bot.X&&re.Curr.Y===l.Bot.Y&&re.WindDelta===0&&re.OutIdx>=0&&re.Curr.Y>re.Top.Y&&t.ClipperBase.SlopesEqual3(l,re,this.m_UseFullRange)){var Ht=this.AddOutPt(re,l.Bot);this.AddJoin(At,Ht,l.Top)}else if(_t!==null&&_t.Curr.X===l.Bot.X&&_t.Curr.Y===l.Bot.Y&&_t.WindDelta!==0&&_t.OutIdx>=0&&_t.Curr.Y>_t.Top.Y&&t.ClipperBase.SlopesEqual3(l,_t,this.m_UseFullRange)){var Ht=this.AddOutPt(_t,l.Bot);this.AddJoin(At,Ht,l.Top)}}else l=this.UpdateEdgeIntoAEL(l);else l.OutIdx>=0&&this.AddOutPt(l,l.Top),this.DeleteFromAEL(l)},t.Clipper.prototype.GetNextInAEL=function(l,I){return I===t.Direction.dLeftToRight?l.NextInAEL:l.PrevInAEL},t.Clipper.prototype.IsMinima=function(l){return l!==null&&l.Prev.NextInLML!==l&&l.Next.NextInLML!==l},t.Clipper.prototype.IsMaxima=function(l,I){return l!==null&&l.Top.Y===I&&l.NextInLML===null},t.Clipper.prototype.IsIntermediate=function(l,I){return l.Top.Y===I&&l.NextInLML!==null},t.Clipper.prototype.GetMaximaPair=function(l){return t.IntPoint.op_Equality(l.Next.Top,l.Top)&&l.Next.NextInLML===null?l.Next:t.IntPoint.op_Equality(l.Prev.Top,l.Top)&&l.Prev.NextInLML===null?l.Prev:null},t.Clipper.prototype.GetMaximaPairEx=function(l){var I=this.GetMaximaPair(l);return I===null||I.OutIdx===t.ClipperBase.Skip||I.NextInAEL===I.PrevInAEL&&!t.ClipperBase.IsHorizontal(I)?null:I},t.Clipper.prototype.ProcessIntersections=function(l){if(this.m_ActiveEdges===null)return!0;try{if(this.BuildIntersectList(l),this.m_IntersectList.length===0)return!0;if(this.m_IntersectList.length===1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1}catch{this.m_SortedEdges=null,this.m_IntersectList.length=0,t.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0},t.Clipper.prototype.BuildIntersectList=function(l){if(this.m_ActiveEdges!==null){var I=this.m_ActiveEdges;for(this.m_SortedEdges=I;I!==null;)I.PrevInSEL=I.PrevInAEL,I.NextInSEL=I.NextInAEL,I.Curr.X=t.Clipper.TopX(I,l),I=I.NextInAEL;for(var N=!0;N&&this.m_SortedEdges!==null;){for(N=!1,I=this.m_SortedEdges;I.NextInSEL!==null;){var z=I.NextInSEL,V=new t.IntPoint0;if(I.Curr.X>z.Curr.X){this.IntersectPoint(I,z,V),V.Y<l&&(V=new t.IntPoint2(t.Clipper.TopX(I,l),l));var J=new t.IntersectNode;J.Edge1=I,J.Edge2=z,J.Pt.X=V.X,J.Pt.Y=V.Y,t.use_xyz&&(J.Pt.Z=V.Z),this.m_IntersectList.push(J),this.SwapPositionsInSEL(I,z),N=!0}else I=z}if(I.PrevInSEL!==null)I.PrevInSEL.NextInSEL=null;else break}this.m_SortedEdges=null}},t.Clipper.prototype.EdgesAdjacent=function(l){return l.Edge1.NextInSEL===l.Edge2||l.Edge1.PrevInSEL===l.Edge2},t.Clipper.IntersectNodeSort=function(l,I){return I.Pt.Y-l.Pt.Y},t.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var l=this.m_IntersectList.length,I=0;I<l;I++){if(!this.EdgesAdjacent(this.m_IntersectList[I])){for(var N=I+1;N<l&&!this.EdgesAdjacent(this.m_IntersectList[N]);)N++;if(N===l)return!1;var z=this.m_IntersectList[I];this.m_IntersectList[I]=this.m_IntersectList[N],this.m_IntersectList[N]=z}this.SwapPositionsInSEL(this.m_IntersectList[I].Edge1,this.m_IntersectList[I].Edge2)}return!0},t.Clipper.prototype.ProcessIntersectList=function(){for(var l=0,I=this.m_IntersectList.length;l<I;l++){var N=this.m_IntersectList[l];this.IntersectEdges(N.Edge1,N.Edge2,N.Pt),this.SwapPositionsInAEL(N.Edge1,N.Edge2)}this.m_IntersectList.length=0};var fa=function(l){return l<0?Math.ceil(l-.5):Math.round(l)},da=function(l){return l<0?Math.ceil(l-.5):Math.floor(l+.5)},ga=function(l){return l<0?-Math.round(Math.abs(l)):Math.round(l)},pa=function(l){return l<0?(l-=.5,l<-2147483648?Math.ceil(l):l|0):(l+=.5,l>2147483647?Math.floor(l):l|0)};i.msie?t.Clipper.Round=fa:i.chromium?t.Clipper.Round=ga:i.safari?t.Clipper.Round=pa:t.Clipper.Round=da,t.Clipper.TopX=function(l,I){return I===l.Top.Y?l.Top.X:l.Bot.X+t.Clipper.Round(l.Dx*(I-l.Bot.Y))},t.Clipper.prototype.IntersectPoint=function(l,I,N){N.X=0,N.Y=0;var z,V;if(l.Dx===I.Dx){N.Y=l.Curr.Y,N.X=t.Clipper.TopX(l,N.Y);return}if(l.Delta.X===0)N.X=l.Bot.X,t.ClipperBase.IsHorizontal(I)?N.Y=I.Bot.Y:(V=I.Bot.Y-I.Bot.X/I.Dx,N.Y=t.Clipper.Round(N.X/I.Dx+V));else if(I.Delta.X===0)N.X=I.Bot.X,t.ClipperBase.IsHorizontal(l)?N.Y=l.Bot.Y:(z=l.Bot.Y-l.Bot.X/l.Dx,N.Y=t.Clipper.Round(N.X/l.Dx+z));else{z=l.Bot.X-l.Bot.Y*l.Dx,V=I.Bot.X-I.Bot.Y*I.Dx;var J=(V-z)/(l.Dx-I.Dx);N.Y=t.Clipper.Round(J),Math.abs(l.Dx)<Math.abs(I.Dx)?N.X=t.Clipper.Round(l.Dx*J+z):N.X=t.Clipper.Round(I.Dx*J+V)}if(N.Y<l.Top.Y||N.Y<I.Top.Y){if(l.Top.Y>I.Top.Y)return N.Y=l.Top.Y,N.X=t.Clipper.TopX(I,l.Top.Y),N.X<l.Top.X;N.Y=I.Top.Y,Math.abs(l.Dx)<Math.abs(I.Dx)?N.X=t.Clipper.TopX(l,N.Y):N.X=t.Clipper.TopX(I,N.Y)}N.Y>l.Curr.Y&&(N.Y=l.Curr.Y,Math.abs(l.Dx)>Math.abs(I.Dx)?N.X=t.Clipper.TopX(I,N.Y):N.X=t.Clipper.TopX(l,N.Y))},t.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(l){for(var I=this.m_ActiveEdges;I!==null;){var N=this.IsMaxima(I,l);if(N){var z=this.GetMaximaPairEx(I);N=z===null||!t.ClipperBase.IsHorizontal(z)}if(N){this.StrictlySimple&&this.InsertMaxima(I.Top.X);var V=I.PrevInAEL;this.DoMaxima(I),V===null?I=this.m_ActiveEdges:I=V.NextInAEL}else{if(this.IsIntermediate(I,l)&&t.ClipperBase.IsHorizontal(I.NextInLML)?(I=this.UpdateEdgeIntoAEL(I),I.OutIdx>=0&&this.AddOutPt(I,I.Bot),this.AddEdgeToSEL(I)):(I.Curr.X=t.Clipper.TopX(I,l),I.Curr.Y=l),t.use_xyz&&(I.Top.Y===l?I.Curr.Z=I.Top.Z:I.Bot.Y===l?I.Curr.Z=I.Bot.Z:I.Curr.Z=0),this.StrictlySimple){var V=I.PrevInAEL;if(I.OutIdx>=0&&I.WindDelta!==0&&V!==null&&V.OutIdx>=0&&V.Curr.X===I.Curr.X&&V.WindDelta!==0){var J=new t.IntPoint1(I.Curr);t.use_xyz&&this.SetZ(J,V,I);var nt=this.AddOutPt(V,J),ft=this.AddOutPt(I,J);this.AddJoin(nt,ft,J)}}I=I.NextInAEL}}for(this.ProcessHorizontals(),this.m_Maxima=null,I=this.m_ActiveEdges;I!==null;){if(this.IsIntermediate(I,l)){var nt=null;I.OutIdx>=0&&(nt=this.AddOutPt(I,I.Top)),I=this.UpdateEdgeIntoAEL(I);var V=I.PrevInAEL,dt=I.NextInAEL;if(V!==null&&V.Curr.X===I.Bot.X&&V.Curr.Y===I.Bot.Y&&nt!==null&&V.OutIdx>=0&&V.Curr.Y===V.Top.Y&&t.ClipperBase.SlopesEqual5(I.Curr,I.Top,V.Curr,V.Top,this.m_UseFullRange)&&I.WindDelta!==0&&V.WindDelta!==0){var ft=this.AddOutPt(ePrev2,I.Bot);this.AddJoin(nt,ft,I.Top)}else if(dt!==null&&dt.Curr.X===I.Bot.X&&dt.Curr.Y===I.Bot.Y&&nt!==null&&dt.OutIdx>=0&&dt.Curr.Y===dt.Top.Y&&t.ClipperBase.SlopesEqual5(I.Curr,I.Top,dt.Curr,dt.Top,this.m_UseFullRange)&&I.WindDelta!==0&&dt.WindDelta!==0){var ft=this.AddOutPt(dt,I.Bot);this.AddJoin(nt,ft,I.Top)}}I=I.NextInAEL}},t.Clipper.prototype.DoMaxima=function(l){var I=this.GetMaximaPairEx(l);if(I===null){l.OutIdx>=0&&this.AddOutPt(l,l.Top),this.DeleteFromAEL(l);return}for(var N=l.NextInAEL;N!==null&&N!==I;)this.IntersectEdges(l,N,l.Top),this.SwapPositionsInAEL(l,N),N=l.NextInAEL;l.OutIdx===-1&&I.OutIdx===-1?(this.DeleteFromAEL(l),this.DeleteFromAEL(I)):l.OutIdx>=0&&I.OutIdx>=0?(l.OutIdx>=0&&this.AddLocalMaxPoly(l,I,l.Top),this.DeleteFromAEL(l),this.DeleteFromAEL(I)):t.use_lines&&l.WindDelta===0?(l.OutIdx>=0&&(this.AddOutPt(l,l.Top),l.OutIdx=t.ClipperBase.Unassigned),this.DeleteFromAEL(l),I.OutIdx>=0&&(this.AddOutPt(I,l.Top),I.OutIdx=t.ClipperBase.Unassigned),this.DeleteFromAEL(I)):t.Error("DoMaxima error")},t.Clipper.ReversePaths=function(l){for(var I=0,N=l.length;I<N;I++)l[I].reverse()},t.Clipper.Orientation=function(l){return t.Clipper.Area(l)>=0},t.Clipper.prototype.PointCount=function(l){if(l===null)return 0;var I=0,N=l;do I++,N=N.Next;while(N!==l);return I},t.Clipper.prototype.BuildResult=function(l){t.Clear(l);for(var I=0,N=this.m_PolyOuts.length;I<N;I++){var z=this.m_PolyOuts[I];if(z.Pts!==null){var V=z.Pts.Prev,J=this.PointCount(V);if(!(J<2)){for(var nt=new Array(J),ft=0;ft<J;ft++)nt[ft]=V.Pt,V=V.Prev;l.push(nt)}}}},t.Clipper.prototype.BuildResult2=function(l){l.Clear();for(var I=0,N=this.m_PolyOuts.length;I<N;I++){var z=this.m_PolyOuts[I],V=this.PointCount(z.Pts);if(!(z.IsOpen&&V<2||!z.IsOpen&&V<3)){this.FixHoleLinkage(z);var J=new t.PolyNode;l.m_AllPolys.push(J),z.PolyNode=J,J.m_polygon.length=V;for(var nt=z.Pts.Prev,ft=0;ft<V;ft++)J.m_polygon[ft]=nt.Pt,nt=nt.Prev}}for(var I=0,N=this.m_PolyOuts.length;I<N;I++){var z=this.m_PolyOuts[I];z.PolyNode!==null&&(z.IsOpen?(z.PolyNode.IsOpen=!0,l.AddChild(z.PolyNode)):z.FirstLeft!==null&&z.FirstLeft.PolyNode!==null?z.FirstLeft.PolyNode.AddChild(z.PolyNode):l.AddChild(z.PolyNode))}},t.Clipper.prototype.FixupOutPolyline=function(l){for(var I=l.Pts,N=I.Prev;I!==N;)if(I=I.Next,t.IntPoint.op_Equality(I.Pt,I.Prev.Pt)){I===N&&(N=I.Prev);var z=I.Prev;z.Next=I.Next,I.Next.Prev=z,I=z}I===I.Prev&&(l.Pts=null)},t.Clipper.prototype.FixupOutPolygon=function(l){var I=null;l.BottomPt=null;for(var N=l.Pts,z=this.PreserveCollinear||this.StrictlySimple;;){if(N.Prev===N||N.Prev===N.Next){l.Pts=null;return}if(t.IntPoint.op_Equality(N.Pt,N.Next.Pt)||t.IntPoint.op_Equality(N.Pt,N.Prev.Pt)||t.ClipperBase.SlopesEqual4(N.Prev.Pt,N.Pt,N.Next.Pt,this.m_UseFullRange)&&(!z||!this.Pt2IsBetweenPt1AndPt3(N.Prev.Pt,N.Pt,N.Next.Pt)))I=null,N.Prev.Next=N.Next,N.Next.Prev=N.Prev,N=N.Prev;else{if(N===I)break;I===null&&(I=N),N=N.Next}}l.Pts=N},t.Clipper.prototype.DupOutPt=function(l,I){var N=new t.OutPt;return N.Pt.X=l.Pt.X,N.Pt.Y=l.Pt.Y,t.use_xyz&&(N.Pt.Z=l.Pt.Z),N.Idx=l.Idx,I?(N.Next=l.Next,N.Prev=l,l.Next.Prev=N,l.Next=N):(N.Prev=l.Prev,N.Next=l,l.Prev.Next=N,l.Prev=N),N},t.Clipper.prototype.GetOverlap=function(l,I,N,z,V){return l<I?N<z?(V.Left=Math.max(l,N),V.Right=Math.min(I,z)):(V.Left=Math.max(l,z),V.Right=Math.min(I,N)):N<z?(V.Left=Math.max(I,N),V.Right=Math.min(l,z)):(V.Left=Math.max(I,z),V.Right=Math.min(l,N)),V.Left<V.Right},t.Clipper.prototype.JoinHorz=function(l,I,N,z,V,J){var nt=l.Pt.X>I.Pt.X?t.Direction.dRightToLeft:t.Direction.dLeftToRight,ft=N.Pt.X>z.Pt.X?t.Direction.dRightToLeft:t.Direction.dLeftToRight;if(nt===ft)return!1;if(nt===t.Direction.dLeftToRight){for(;l.Next.Pt.X<=V.X&&l.Next.Pt.X>=l.Pt.X&&l.Next.Pt.Y===V.Y;)l=l.Next;J&&l.Pt.X!==V.X&&(l=l.Next),I=this.DupOutPt(l,!J),t.IntPoint.op_Inequality(I.Pt,V)&&(l=I,l.Pt.X=V.X,l.Pt.Y=V.Y,t.use_xyz&&(l.Pt.Z=V.Z),I=this.DupOutPt(l,!J))}else{for(;l.Next.Pt.X>=V.X&&l.Next.Pt.X<=l.Pt.X&&l.Next.Pt.Y===V.Y;)l=l.Next;!J&&l.Pt.X!==V.X&&(l=l.Next),I=this.DupOutPt(l,J),t.IntPoint.op_Inequality(I.Pt,V)&&(l=I,l.Pt.X=V.X,l.Pt.Y=V.Y,t.use_xyz&&(l.Pt.Z=V.Z),I=this.DupOutPt(l,J))}if(ft===t.Direction.dLeftToRight){for(;N.Next.Pt.X<=V.X&&N.Next.Pt.X>=N.Pt.X&&N.Next.Pt.Y===V.Y;)N=N.Next;J&&N.Pt.X!==V.X&&(N=N.Next),z=this.DupOutPt(N,!J),t.IntPoint.op_Inequality(z.Pt,V)&&(N=z,N.Pt.X=V.X,N.Pt.Y=V.Y,t.use_xyz&&(N.Pt.Z=V.Z),z=this.DupOutPt(N,!J))}else{for(;N.Next.Pt.X>=V.X&&N.Next.Pt.X<=N.Pt.X&&N.Next.Pt.Y===V.Y;)N=N.Next;!J&&N.Pt.X!==V.X&&(N=N.Next),z=this.DupOutPt(N,J),t.IntPoint.op_Inequality(z.Pt,V)&&(N=z,N.Pt.X=V.X,N.Pt.Y=V.Y,t.use_xyz&&(N.Pt.Z=V.Z),z=this.DupOutPt(N,J))}return nt===t.Direction.dLeftToRight===J?(l.Prev=N,N.Next=l,I.Next=z,z.Prev=I):(l.Next=N,N.Prev=l,I.Prev=z,z.Next=I),!0},t.Clipper.prototype.JoinPoints=function(l,I,N){var z=l.OutPt1,V=new t.OutPt,J=l.OutPt2,nt=new t.OutPt,ft=l.OutPt1.Pt.Y===l.OffPt.Y;if(ft&&t.IntPoint.op_Equality(l.OffPt,l.OutPt1.Pt)&&t.IntPoint.op_Equality(l.OffPt,l.OutPt2.Pt)){if(I!==N)return!1;for(V=l.OutPt1.Next;V!==z&&t.IntPoint.op_Equality(V.Pt,l.OffPt);)V=V.Next;var dt=V.Pt.Y>l.OffPt.Y;for(nt=l.OutPt2.Next;nt!==J&&t.IntPoint.op_Equality(nt.Pt,l.OffPt);)nt=nt.Next;var At=nt.Pt.Y>l.OffPt.Y;return dt===At?!1:dt?(V=this.DupOutPt(z,!1),nt=this.DupOutPt(J,!0),z.Prev=J,J.Next=z,V.Next=nt,nt.Prev=V,l.OutPt1=z,l.OutPt2=V,!0):(V=this.DupOutPt(z,!0),nt=this.DupOutPt(J,!1),z.Next=J,J.Prev=z,V.Prev=nt,nt.Next=V,l.OutPt1=z,l.OutPt2=V,!0)}else if(ft){for(V=z;z.Prev.Pt.Y===z.Pt.Y&&z.Prev!==V&&z.Prev!==J;)z=z.Prev;for(;V.Next.Pt.Y===V.Pt.Y&&V.Next!==z&&V.Next!==J;)V=V.Next;if(V.Next===z||V.Next===J)return!1;for(nt=J;J.Prev.Pt.Y===J.Pt.Y&&J.Prev!==nt&&J.Prev!==V;)J=J.Prev;for(;nt.Next.Pt.Y===nt.Pt.Y&&nt.Next!==J&&nt.Next!==z;)nt=nt.Next;if(nt.Next===J||nt.Next===z)return!1;var zt={Left:null,Right:null};if(!this.GetOverlap(z.Pt.X,V.Pt.X,J.Pt.X,nt.Pt.X,zt))return!1;var Ot=zt.Left,Ut=zt.Right,Ht=new t.IntPoint0,qt;return z.Pt.X>=Ot&&z.Pt.X<=Ut?(Ht.X=z.Pt.X,Ht.Y=z.Pt.Y,t.use_xyz&&(Ht.Z=z.Pt.Z),qt=z.Pt.X>V.Pt.X):J.Pt.X>=Ot&&J.Pt.X<=Ut?(Ht.X=J.Pt.X,Ht.Y=J.Pt.Y,t.use_xyz&&(Ht.Z=J.Pt.Z),qt=J.Pt.X>nt.Pt.X):V.Pt.X>=Ot&&V.Pt.X<=Ut?(Ht.X=V.Pt.X,Ht.Y=V.Pt.Y,t.use_xyz&&(Ht.Z=V.Pt.Z),qt=V.Pt.X>z.Pt.X):(Ht.X=nt.Pt.X,Ht.Y=nt.Pt.Y,t.use_xyz&&(Ht.Z=nt.Pt.Z),qt=nt.Pt.X>J.Pt.X),l.OutPt1=z,l.OutPt2=J,this.JoinHorz(z,V,J,nt,Ht,qt)}else{for(V=z.Next;t.IntPoint.op_Equality(V.Pt,z.Pt)&&V!==z;)V=V.Next;var _t=V.Pt.Y>z.Pt.Y||!t.ClipperBase.SlopesEqual4(z.Pt,V.Pt,l.OffPt,this.m_UseFullRange);if(_t){for(V=z.Prev;t.IntPoint.op_Equality(V.Pt,z.Pt)&&V!==z;)V=V.Prev;if(V.Pt.Y>z.Pt.Y||!t.ClipperBase.SlopesEqual4(z.Pt,V.Pt,l.OffPt,this.m_UseFullRange))return!1}for(nt=J.Next;t.IntPoint.op_Equality(nt.Pt,J.Pt)&&nt!==J;)nt=nt.Next;var re=nt.Pt.Y>J.Pt.Y||!t.ClipperBase.SlopesEqual4(J.Pt,nt.Pt,l.OffPt,this.m_UseFullRange);if(re){for(nt=J.Prev;t.IntPoint.op_Equality(nt.Pt,J.Pt)&&nt!==J;)nt=nt.Prev;if(nt.Pt.Y>J.Pt.Y||!t.ClipperBase.SlopesEqual4(J.Pt,nt.Pt,l.OffPt,this.m_UseFullRange))return!1}return V===z||nt===J||V===nt||I===N&&_t===re?!1:_t?(V=this.DupOutPt(z,!1),nt=this.DupOutPt(J,!0),z.Prev=J,J.Next=z,V.Next=nt,nt.Prev=V,l.OutPt1=z,l.OutPt2=V,!0):(V=this.DupOutPt(z,!0),nt=this.DupOutPt(J,!1),z.Next=J,J.Prev=z,V.Prev=nt,nt.Next=V,l.OutPt1=z,l.OutPt2=V,!0)}},t.Clipper.GetBounds=function(l){for(var I=0,N=l.length;I<N&&l[I].length===0;)I++;if(I===N)return new t.IntRect(0,0,0,0);var z=new t.IntRect;for(z.left=l[I][0].X,z.right=z.left,z.top=l[I][0].Y,z.bottom=z.top;I<N;I++)for(var V=0,J=l[I].length;V<J;V++)l[I][V].X<z.left?z.left=l[I][V].X:l[I][V].X>z.right&&(z.right=l[I][V].X),l[I][V].Y<z.top?z.top=l[I][V].Y:l[I][V].Y>z.bottom&&(z.bottom=l[I][V].Y);return z},t.Clipper.prototype.GetBounds2=function(l){var I=l,N=new t.IntRect;for(N.left=l.Pt.X,N.right=l.Pt.X,N.top=l.Pt.Y,N.bottom=l.Pt.Y,l=l.Next;l!==I;)l.Pt.X<N.left&&(N.left=l.Pt.X),l.Pt.X>N.right&&(N.right=l.Pt.X),l.Pt.Y<N.top&&(N.top=l.Pt.Y),l.Pt.Y>N.bottom&&(N.bottom=l.Pt.Y),l=l.Next;return N},t.Clipper.PointInPolygon=function(l,I){var N=0,z=I.length;if(z<3)return 0;for(var V=I[0],J=1;J<=z;++J){var nt=J===z?I[0]:I[J];if(nt.Y===l.Y&&(nt.X===l.X||V.Y===l.Y&&nt.X>l.X==V.X<l.X))return-1;if(V.Y<l.Y!=nt.Y<l.Y){if(V.X>=l.X)if(nt.X>l.X)N=1-N;else{var ft=(V.X-l.X)*(nt.Y-l.Y)-(nt.X-l.X)*(V.Y-l.Y);if(ft===0)return-1;ft>0==nt.Y>V.Y&&(N=1-N)}else if(nt.X>l.X){var ft=(V.X-l.X)*(nt.Y-l.Y)-(nt.X-l.X)*(V.Y-l.Y);if(ft===0)return-1;ft>0==nt.Y>V.Y&&(N=1-N)}}V=nt}return N},t.Clipper.prototype.PointInPolygon=function(l,I){var N=0,z=I,V=l.X,J=l.Y,nt=I.Pt.X,ft=I.Pt.Y;do{I=I.Next;var dt=I.Pt.X,At=I.Pt.Y;if(At===J&&(dt===V||ft===J&&dt>V==nt<V))return-1;if(ft<J!=At<J){if(nt>=V)if(dt>V)N=1-N;else{var zt=(nt-V)*(At-J)-(dt-V)*(ft-J);if(zt===0)return-1;zt>0==At>ft&&(N=1-N)}else if(dt>V){var zt=(nt-V)*(At-J)-(dt-V)*(ft-J);if(zt===0)return-1;zt>0==At>ft&&(N=1-N)}}nt=dt,ft=At}while(z!==I);return N},t.Clipper.prototype.Poly2ContainsPoly1=function(l,I){var N=l;do{var z=this.PointInPolygon(N.Pt,I);if(z>=0)return z>0;N=N.Next}while(N!==l);return!0},t.Clipper.prototype.FixupFirstLefts1=function(l,I){for(var N,z,V=0,J=this.m_PolyOuts.length;V<J;V++)N=this.m_PolyOuts[V],z=t.Clipper.ParseFirstLeft(N.FirstLeft),N.Pts!==null&&z===l&&this.Poly2ContainsPoly1(N.Pts,I.Pts)&&(N.FirstLeft=I)},t.Clipper.prototype.FixupFirstLefts2=function(l,I){for(var N=I.FirstLeft,z,V,J=0,nt=this.m_PolyOuts.length;J<nt;J++)z=this.m_PolyOuts[J],!(z.Pts===null||z===I||z===l)&&(V=t.Clipper.ParseFirstLeft(z.FirstLeft),!(V!==N&&V!==l&&V!==I)&&(this.Poly2ContainsPoly1(z.Pts,l.Pts)?z.FirstLeft=l:this.Poly2ContainsPoly1(z.Pts,I.Pts)?z.FirstLeft=I:(z.FirstLeft===l||z.FirstLeft===I)&&(z.FirstLeft=N)))},t.Clipper.prototype.FixupFirstLefts3=function(l,I){for(var N,z,V=0,J=this.m_PolyOuts.length;V<J;V++)N=this.m_PolyOuts[V],z=t.Clipper.ParseFirstLeft(N.FirstLeft),N.Pts!==null&&z===l&&(N.FirstLeft=I)},t.Clipper.ParseFirstLeft=function(l){for(;l!==null&&l.Pts===null;)l=l.FirstLeft;return l},t.Clipper.prototype.JoinCommonEdges=function(){for(var l=0,I=this.m_Joins.length;l<I;l++){var N=this.m_Joins[l],z=this.GetOutRec(N.OutPt1.Idx),V=this.GetOutRec(N.OutPt2.Idx);if(!(z.Pts===null||V.Pts===null)&&!(z.IsOpen||V.IsOpen)){var J;z===V?J=z:this.OutRec1RightOfOutRec2(z,V)?J=V:this.OutRec1RightOfOutRec2(V,z)?J=z:J=this.GetLowermostRec(z,V),this.JoinPoints(N,z,V)&&(z===V?(z.Pts=N.OutPt1,z.BottomPt=null,V=this.CreateOutRec(),V.Pts=N.OutPt2,this.UpdateOutPtIdxs(V),this.Poly2ContainsPoly1(V.Pts,z.Pts)?(V.IsHole=!z.IsHole,V.FirstLeft=z,this.m_UsingPolyTree&&this.FixupFirstLefts2(V,z),(V.IsHole^this.ReverseSolution)==this.Area$1(V)>0&&this.ReversePolyPtLinks(V.Pts)):this.Poly2ContainsPoly1(z.Pts,V.Pts)?(V.IsHole=z.IsHole,z.IsHole=!V.IsHole,V.FirstLeft=z.FirstLeft,z.FirstLeft=V,this.m_UsingPolyTree&&this.FixupFirstLefts2(z,V),(z.IsHole^this.ReverseSolution)==this.Area$1(z)>0&&this.ReversePolyPtLinks(z.Pts)):(V.IsHole=z.IsHole,V.FirstLeft=z.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(z,V))):(V.Pts=null,V.BottomPt=null,V.Idx=z.Idx,z.IsHole=J.IsHole,J===V&&(z.FirstLeft=V.FirstLeft),V.FirstLeft=z,this.m_UsingPolyTree&&this.FixupFirstLefts3(V,z)))}}},t.Clipper.prototype.UpdateOutPtIdxs=function(l){var I=l.Pts;do I.Idx=l.Idx,I=I.Prev;while(I!==l.Pts)},t.Clipper.prototype.DoSimplePolygons=function(){for(var l=0;l<this.m_PolyOuts.length;){var I=this.m_PolyOuts[l++],N=I.Pts;if(!(N===null||I.IsOpen))do{for(var z=N.Next;z!==I.Pts;){if(t.IntPoint.op_Equality(N.Pt,z.Pt)&&z.Next!==N&&z.Prev!==N){var V=N.Prev,J=z.Prev;N.Prev=J,J.Next=N,z.Prev=V,V.Next=z,I.Pts=N;var nt=this.CreateOutRec();nt.Pts=z,this.UpdateOutPtIdxs(nt),this.Poly2ContainsPoly1(nt.Pts,I.Pts)?(nt.IsHole=!I.IsHole,nt.FirstLeft=I,this.m_UsingPolyTree&&this.FixupFirstLefts2(nt,I)):this.Poly2ContainsPoly1(I.Pts,nt.Pts)?(nt.IsHole=I.IsHole,I.IsHole=!nt.IsHole,nt.FirstLeft=I.FirstLeft,I.FirstLeft=nt,this.m_UsingPolyTree&&this.FixupFirstLefts2(I,nt)):(nt.IsHole=I.IsHole,nt.FirstLeft=I.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(I,nt)),z=N}z=z.Next}N=N.Next}while(N!==I.Pts)}},t.Clipper.Area=function(l){if(!Array.isArray(l))return 0;var I=l.length;if(I<3)return 0;for(var N=0,z=0,V=I-1;z<I;++z)N+=(l[V].X+l[z].X)*(l[V].Y-l[z].Y),V=z;return-N*.5},t.Clipper.prototype.Area=function(l){var I=l;if(l===null)return 0;var N=0;do N=N+(l.Prev.Pt.X+l.Pt.X)*(l.Prev.Pt.Y-l.Pt.Y),l=l.Next;while(l!==I);return N*.5},t.Clipper.prototype.Area$1=function(l){return this.Area(l.Pts)},t.Clipper.SimplifyPolygon=function(l,I){var N=new Array,z=new t.Clipper(0);return z.StrictlySimple=!0,z.AddPath(l,t.PolyType.ptSubject,!0),z.Execute(t.ClipType.ctUnion,N,I,I),N},t.Clipper.SimplifyPolygons=function(l,I){typeof I>"u"&&(I=t.PolyFillType.pftEvenOdd);var N=new Array,z=new t.Clipper(0);return z.StrictlySimple=!0,z.AddPaths(l,t.PolyType.ptSubject,!0),z.Execute(t.ClipType.ctUnion,N,I,I),N},t.Clipper.DistanceSqrd=function(l,I){var N=l.X-I.X,z=l.Y-I.Y;return N*N+z*z},t.Clipper.DistanceFromLineSqrd=function(l,I,N){var z=I.Y-N.Y,V=N.X-I.X,J=z*I.X+V*I.Y;return J=z*l.X+V*l.Y-J,J*J/(z*z+V*V)},t.Clipper.SlopesNearCollinear=function(l,I,N,z){return Math.abs(l.X-I.X)>Math.abs(l.Y-I.Y)?l.X>I.X==l.X<N.X?t.Clipper.DistanceFromLineSqrd(l,I,N)<z:I.X>l.X==I.X<N.X?t.Clipper.DistanceFromLineSqrd(I,l,N)<z:t.Clipper.DistanceFromLineSqrd(N,l,I)<z:l.Y>I.Y==l.Y<N.Y?t.Clipper.DistanceFromLineSqrd(l,I,N)<z:I.Y>l.Y==I.Y<N.Y?t.Clipper.DistanceFromLineSqrd(I,l,N)<z:t.Clipper.DistanceFromLineSqrd(N,l,I)<z},t.Clipper.PointsAreClose=function(l,I,N){var z=l.X-I.X,V=l.Y-I.Y;return z*z+V*V<=N},t.Clipper.ExcludeOp=function(l){var I=l.Prev;return I.Next=l.Next,l.Next.Prev=I,I.Idx=0,I},t.Clipper.CleanPolygon=function(l,I){typeof I>"u"&&(I=1.415);var N=l.length;if(N===0)return new Array;for(var z=new Array(N),V=0;V<N;++V)z[V]=new t.OutPt;for(var V=0;V<N;++V)z[V].Pt=l[V],z[V].Next=z[(V+1)%N],z[V].Next.Prev=z[V],z[V].Idx=0;for(var J=I*I,nt=z[0];nt.Idx===0&&nt.Next!==nt.Prev;)t.Clipper.PointsAreClose(nt.Pt,nt.Prev.Pt,J)?(nt=t.Clipper.ExcludeOp(nt),N--):t.Clipper.PointsAreClose(nt.Prev.Pt,nt.Next.Pt,J)?(t.Clipper.ExcludeOp(nt.Next),nt=t.Clipper.ExcludeOp(nt),N-=2):t.Clipper.SlopesNearCollinear(nt.Prev.Pt,nt.Pt,nt.Next.Pt,J)?(nt=t.Clipper.ExcludeOp(nt),N--):(nt.Idx=1,nt=nt.Next);N<3&&(N=0);for(var ft=new Array(N),V=0;V<N;++V)ft[V]=new t.IntPoint1(nt.Pt),nt=nt.Next;return z=null,ft},t.Clipper.CleanPolygons=function(l,I){for(var N=new Array(l.length),z=0,V=l.length;z<V;z++)N[z]=t.Clipper.CleanPolygon(l[z],I);return N},t.Clipper.Minkowski=function(l,I,N,z){var V=z?1:0,J=l.length,nt=I.length,ft=new Array;if(N)for(var dt=0;dt<nt;dt++){for(var At=new Array(J),zt=0,Ot=l.length,Ut=l[zt];zt<Ot;zt++,Ut=l[zt])At[zt]=new t.IntPoint2(I[dt].X+Ut.X,I[dt].Y+Ut.Y);ft.push(At)}else for(var dt=0;dt<nt;dt++){for(var At=new Array(J),zt=0,Ot=l.length,Ut=l[zt];zt<Ot;zt++,Ut=l[zt])At[zt]=new t.IntPoint2(I[dt].X-Ut.X,I[dt].Y-Ut.Y);ft.push(At)}for(var Ht=new Array,dt=0;dt<nt-1+V;dt++)for(var zt=0;zt<J;zt++){var qt=new Array;qt.push(ft[dt%nt][zt%J]),qt.push(ft[(dt+1)%nt][zt%J]),qt.push(ft[(dt+1)%nt][(zt+1)%J]),qt.push(ft[dt%nt][(zt+1)%J]),t.Clipper.Orientation(qt)||qt.reverse(),Ht.push(qt)}return Ht},t.Clipper.MinkowskiSum=function(l,I,N){if(I[0]instanceof Array){for(var V=I,nt=new t.Paths,J=new t.Clipper,ft=0;ft<V.length;++ft){var dt=t.Clipper.Minkowski(l,V[ft],!0,N);if(J.AddPaths(dt,t.PolyType.ptSubject,!0),N){var z=t.Clipper.TranslatePath(V[ft],l[0]);J.AddPath(z,t.PolyType.ptClip,!0)}}return J.Execute(t.ClipType.ctUnion,nt,t.PolyFillType.pftNonZero,t.PolyFillType.pftNonZero),nt}else{var z=I,V=t.Clipper.Minkowski(l,z,!0,N),J=new t.Clipper;return J.AddPaths(V,t.PolyType.ptSubject,!0),J.Execute(t.ClipType.ctUnion,V,t.PolyFillType.pftNonZero,t.PolyFillType.pftNonZero),V}},t.Clipper.TranslatePath=function(l,I){for(var N=new t.Path,z=0;z<l.length;z++)N.push(new t.IntPoint2(l[z].X+I.X,l[z].Y+I.Y));return N},t.Clipper.MinkowskiDiff=function(l,I){var N=t.Clipper.Minkowski(l,I,!1,!0),z=new t.Clipper;return z.AddPaths(N,t.PolyType.ptSubject,!0),z.Execute(t.ClipType.ctUnion,N,t.PolyFillType.pftNonZero,t.PolyFillType.pftNonZero),N},t.Clipper.PolyTreeToPaths=function(l){var I=new Array;return t.Clipper.AddPolyNodeToPaths(l,t.Clipper.NodeType.ntAny,I),I},t.Clipper.AddPolyNodeToPaths=function(l,I,N){var z=!0;switch(I){case t.Clipper.NodeType.ntOpen:return;case t.Clipper.NodeType.ntClosed:z=!l.IsOpen;break}l.m_polygon.length>0&&z&&N.push(l.m_polygon);for(var V=0,J=l.Childs(),nt=J.length,ft=J[V];V<nt;V++,ft=J[V])t.Clipper.AddPolyNodeToPaths(ft,I,N)},t.Clipper.OpenPathsFromPolyTree=function(l){for(var I=new t.Paths,N=0,z=l.ChildCount();N<z;N++)l.Childs()[N].IsOpen&&I.push(l.Childs()[N].m_polygon);return I},t.Clipper.ClosedPathsFromPolyTree=function(l){var I=new t.Paths;return t.Clipper.AddPolyNodeToPaths(l,t.Clipper.NodeType.ntClosed,I),I},Ei(t.Clipper,t.ClipperBase),t.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2},t.ClipperOffset=function(l,I){typeof l>"u"&&(l=2),typeof I>"u"&&(I=t.ClipperOffset.def_arc_tolerance),this.m_destPolys=new t.Paths,this.m_srcPoly=new t.Path,this.m_destPoly=new t.Path,this.m_normals=new Array,this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new t.IntPoint0,this.m_polyNodes=new t.PolyNode,this.MiterLimit=l,this.ArcTolerance=I,this.m_lowest.X=-1},t.ClipperOffset.two_pi=6.28318530717959,t.ClipperOffset.def_arc_tolerance=.25,t.ClipperOffset.prototype.Clear=function(){t.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1},t.ClipperOffset.Round=t.Clipper.Round,t.ClipperOffset.prototype.AddPath=function(l,I,N){var z=l.length-1;if(!(z<0)){var V=new t.PolyNode;if(V.m_jointype=I,V.m_endtype=N,N===t.EndType.etClosedLine||N===t.EndType.etClosedPolygon)for(;z>0&&t.IntPoint.op_Equality(l[0],l[z]);)z--;V.m_polygon.push(l[0]);for(var J=0,nt=0,ft=1;ft<=z;ft++)t.IntPoint.op_Inequality(V.m_polygon[J],l[ft])&&(J++,V.m_polygon.push(l[ft]),(l[ft].Y>V.m_polygon[nt].Y||l[ft].Y===V.m_polygon[nt].Y&&l[ft].X<V.m_polygon[nt].X)&&(nt=J));if(!(N===t.EndType.etClosedPolygon&&J<2)&&(this.m_polyNodes.AddChild(V),N===t.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new t.IntPoint2(this.m_polyNodes.ChildCount()-1,nt);else{var dt=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(V.m_polygon[nt].Y>dt.Y||V.m_polygon[nt].Y===dt.Y&&V.m_polygon[nt].X<dt.X)&&(this.m_lowest=new t.IntPoint2(this.m_polyNodes.ChildCount()-1,nt))}}},t.ClipperOffset.prototype.AddPaths=function(l,I,N){for(var z=0,V=l.length;z<V;z++)this.AddPath(l[z],I,N)},t.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!t.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var l=0;l<this.m_polyNodes.ChildCount();l++){var I=this.m_polyNodes.Childs()[l];(I.m_endtype===t.EndType.etClosedPolygon||I.m_endtype===t.EndType.etClosedLine&&t.Clipper.Orientation(I.m_polygon))&&I.m_polygon.reverse()}else for(var l=0;l<this.m_polyNodes.ChildCount();l++){var I=this.m_polyNodes.Childs()[l];I.m_endtype===t.EndType.etClosedLine&&!t.Clipper.Orientation(I.m_polygon)&&I.m_polygon.reverse()}},t.ClipperOffset.GetUnitNormal=function(l,I){var N=I.X-l.X,z=I.Y-l.Y;if(N===0&&z===0)return new t.DoublePoint2(0,0);var V=1/Math.sqrt(N*N+z*z);return N*=V,z*=V,new t.DoublePoint2(z,-N)},t.ClipperOffset.prototype.DoOffset=function(l){if(this.m_destPolys=new Array,this.m_delta=l,t.ClipperBase.near_zero(l)){for(var I=0;I<this.m_polyNodes.ChildCount();I++){var N=this.m_polyNodes.Childs()[I];N.m_endtype===t.EndType.etClosedPolygon&&this.m_destPolys.push(N.m_polygon)}return}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var z;this.ArcTolerance<=0?z=t.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(l)*t.ClipperOffset.def_arc_tolerance?z=Math.abs(l)*t.ClipperOffset.def_arc_tolerance:z=this.ArcTolerance;var V=3.14159265358979/Math.acos(1-z/Math.abs(l));this.m_sin=Math.sin(t.ClipperOffset.two_pi/V),this.m_cos=Math.cos(t.ClipperOffset.two_pi/V),this.m_StepsPerRad=V/t.ClipperOffset.two_pi,l<0&&(this.m_sin=-this.m_sin);for(var I=0;I<this.m_polyNodes.ChildCount();I++){var N=this.m_polyNodes.Childs()[I];this.m_srcPoly=N.m_polygon;var J=this.m_srcPoly.length;if(!(J===0||l<=0&&(J<3||N.m_endtype!==t.EndType.etClosedPolygon))){if(this.m_destPoly=new Array,J===1){if(N.m_jointype===t.JoinType.jtRound)for(var nt=1,ft=0,dt=1;dt<=V;dt++){this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[0].X+nt*l),t.ClipperOffset.Round(this.m_srcPoly[0].Y+ft*l)));var At=nt;nt=nt*this.m_cos-this.m_sin*ft,ft=At*this.m_sin+ft*this.m_cos}else for(var nt=-1,ft=-1,dt=0;dt<4;++dt)this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[0].X+nt*l),t.ClipperOffset.Round(this.m_srcPoly[0].Y+ft*l))),nt<0?nt=1:ft<0?ft=1:nt=-1;this.m_destPolys.push(this.m_destPoly);continue}this.m_normals.length=0;for(var dt=0;dt<J-1;dt++)this.m_normals.push(t.ClipperOffset.GetUnitNormal(this.m_srcPoly[dt],this.m_srcPoly[dt+1]));if(N.m_endtype===t.EndType.etClosedLine||N.m_endtype===t.EndType.etClosedPolygon?this.m_normals.push(t.ClipperOffset.GetUnitNormal(this.m_srcPoly[J-1],this.m_srcPoly[0])):this.m_normals.push(new t.DoublePoint1(this.m_normals[J-2])),N.m_endtype===t.EndType.etClosedPolygon){for(var zt=J-1,dt=0;dt<J;dt++)zt=this.OffsetPoint(dt,zt,N.m_jointype);this.m_destPolys.push(this.m_destPoly)}else if(N.m_endtype===t.EndType.etClosedLine){for(var zt=J-1,dt=0;dt<J;dt++)zt=this.OffsetPoint(dt,zt,N.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array;for(var Ot=this.m_normals[J-1],dt=J-1;dt>0;dt--)this.m_normals[dt]=new t.DoublePoint2(-this.m_normals[dt-1].X,-this.m_normals[dt-1].Y);this.m_normals[0]=new t.DoublePoint2(-Ot.X,-Ot.Y),zt=0;for(var dt=J-1;dt>=0;dt--)zt=this.OffsetPoint(dt,zt,N.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var zt=0,dt=1;dt<J-1;++dt)zt=this.OffsetPoint(dt,zt,N.m_jointype);var Ut;if(N.m_endtype===t.EndType.etOpenButt){var dt=J-1;Ut=new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[dt].X+this.m_normals[dt].X*l),t.ClipperOffset.Round(this.m_srcPoly[dt].Y+this.m_normals[dt].Y*l)),this.m_destPoly.push(Ut),Ut=new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[dt].X-this.m_normals[dt].X*l),t.ClipperOffset.Round(this.m_srcPoly[dt].Y-this.m_normals[dt].Y*l)),this.m_destPoly.push(Ut)}else{var dt=J-1;zt=J-2,this.m_sinA=0,this.m_normals[dt]=new t.DoublePoint2(-this.m_normals[dt].X,-this.m_normals[dt].Y),N.m_endtype===t.EndType.etOpenSquare?this.DoSquare(dt,zt):this.DoRound(dt,zt)}for(var dt=J-1;dt>0;dt--)this.m_normals[dt]=new t.DoublePoint2(-this.m_normals[dt-1].X,-this.m_normals[dt-1].Y);this.m_normals[0]=new t.DoublePoint2(-this.m_normals[1].X,-this.m_normals[1].Y),zt=J-1;for(var dt=zt-1;dt>0;--dt)zt=this.OffsetPoint(dt,zt,N.m_jointype);N.m_endtype===t.EndType.etOpenButt?(Ut=new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*l),t.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*l)),this.m_destPoly.push(Ut),Ut=new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*l),t.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*l)),this.m_destPoly.push(Ut)):(zt=1,this.m_sinA=0,N.m_endtype===t.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}},t.ClipperOffset.prototype.Execute=function(){var l=arguments,I=l[0]instanceof t.PolyTree;if(I){var N=l[0],z=l[1];N.Clear(),this.FixOrientations(),this.DoOffset(z);var V=new t.Clipper(0);if(V.AddPaths(this.m_destPolys,t.PolyType.ptSubject,!0),z>0)V.Execute(t.ClipType.ctUnion,N,t.PolyFillType.pftPositive,t.PolyFillType.pftPositive);else{var J=t.Clipper.GetBounds(this.m_destPolys),nt=new t.Path;if(nt.push(new t.IntPoint2(J.left-10,J.bottom+10)),nt.push(new t.IntPoint2(J.right+10,J.bottom+10)),nt.push(new t.IntPoint2(J.right+10,J.top-10)),nt.push(new t.IntPoint2(J.left-10,J.top-10)),V.AddPath(nt,t.PolyType.ptSubject,!0),V.ReverseSolution=!0,V.Execute(t.ClipType.ctUnion,N,t.PolyFillType.pftNegative,t.PolyFillType.pftNegative),N.ChildCount()===1&&N.Childs()[0].ChildCount()>0){var ft=N.Childs()[0];N.Childs()[0]=ft.Childs()[0],N.Childs()[0].m_Parent=N;for(var dt=1;dt<ft.ChildCount();dt++)N.AddChild(ft.Childs()[dt])}else N.Clear()}}else{var N=l[0],z=l[1];t.Clear(N),this.FixOrientations(),this.DoOffset(z);var V=new t.Clipper(0);if(V.AddPaths(this.m_destPolys,t.PolyType.ptSubject,!0),z>0)V.Execute(t.ClipType.ctUnion,N,t.PolyFillType.pftPositive,t.PolyFillType.pftPositive);else{var J=t.Clipper.GetBounds(this.m_destPolys),nt=new t.Path;nt.push(new t.IntPoint2(J.left-10,J.bottom+10)),nt.push(new t.IntPoint2(J.right+10,J.bottom+10)),nt.push(new t.IntPoint2(J.right+10,J.top-10)),nt.push(new t.IntPoint2(J.left-10,J.top-10)),V.AddPath(nt,t.PolyType.ptSubject,!0),V.ReverseSolution=!0,V.Execute(t.ClipType.ctUnion,N,t.PolyFillType.pftNegative,t.PolyFillType.pftNegative),N.length>0&&N.splice(0,1)}}},t.ClipperOffset.prototype.OffsetPoint=function(l,I,N){if(this.m_sinA=this.m_normals[I].X*this.m_normals[l].Y-this.m_normals[l].X*this.m_normals[I].Y,Math.abs(this.m_sinA*this.m_delta)<1){var z=this.m_normals[I].X*this.m_normals[l].X+this.m_normals[l].Y*this.m_normals[I].Y;if(z>0)return this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[l].X+this.m_normals[I].X*this.m_delta),t.ClipperOffset.Round(this.m_srcPoly[l].Y+this.m_normals[I].Y*this.m_delta))),I}else this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1);if(this.m_sinA*this.m_delta<0)this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[l].X+this.m_normals[I].X*this.m_delta),t.ClipperOffset.Round(this.m_srcPoly[l].Y+this.m_normals[I].Y*this.m_delta))),this.m_destPoly.push(new t.IntPoint1(this.m_srcPoly[l])),this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[l].X+this.m_normals[l].X*this.m_delta),t.ClipperOffset.Round(this.m_srcPoly[l].Y+this.m_normals[l].Y*this.m_delta)));else switch(N){case t.JoinType.jtMiter:{var V=1+(this.m_normals[l].X*this.m_normals[I].X+this.m_normals[l].Y*this.m_normals[I].Y);V>=this.m_miterLim?this.DoMiter(l,I,V):this.DoSquare(l,I);break}case t.JoinType.jtSquare:this.DoSquare(l,I);break;case t.JoinType.jtRound:this.DoRound(l,I);break}return I=l,I},t.ClipperOffset.prototype.DoSquare=function(l,I){var N=Math.tan(Math.atan2(this.m_sinA,this.m_normals[I].X*this.m_normals[l].X+this.m_normals[I].Y*this.m_normals[l].Y)/4);this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[l].X+this.m_delta*(this.m_normals[I].X-this.m_normals[I].Y*N)),t.ClipperOffset.Round(this.m_srcPoly[l].Y+this.m_delta*(this.m_normals[I].Y+this.m_normals[I].X*N)))),this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[l].X+this.m_delta*(this.m_normals[l].X+this.m_normals[l].Y*N)),t.ClipperOffset.Round(this.m_srcPoly[l].Y+this.m_delta*(this.m_normals[l].Y-this.m_normals[l].X*N))))},t.ClipperOffset.prototype.DoMiter=function(l,I,N){var z=this.m_delta/N;this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[l].X+(this.m_normals[I].X+this.m_normals[l].X)*z),t.ClipperOffset.Round(this.m_srcPoly[l].Y+(this.m_normals[I].Y+this.m_normals[l].Y)*z)))},t.ClipperOffset.prototype.DoRound=function(l,I){for(var N=Math.atan2(this.m_sinA,this.m_normals[I].X*this.m_normals[l].X+this.m_normals[I].Y*this.m_normals[l].Y),z=Math.max(t.Cast_Int32(t.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(N))),1),V=this.m_normals[I].X,J=this.m_normals[I].Y,nt,ft=0;ft<z;++ft)this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[l].X+V*this.m_delta),t.ClipperOffset.Round(this.m_srcPoly[l].Y+J*this.m_delta))),nt=V,V=V*this.m_cos-this.m_sin*J,J=nt*this.m_sin+J*this.m_cos;this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[l].X+this.m_normals[l].X*this.m_delta),t.ClipperOffset.Round(this.m_srcPoly[l].Y+this.m_normals[l].Y*this.m_delta)))},t.Error=function(l){try{throw new Error(l)}catch(I){alert(I.message)}},t.JS={},t.JS.AreaOfPolygon=function(l,I){return I||(I=1),t.Clipper.Area(l)/(I*I)},t.JS.AreaOfPolygons=function(l,I){I||(I=1);for(var N=0,z=0;z<l.length;z++)N+=t.Clipper.Area(l[z]);return N/(I*I)},t.JS.BoundsOfPath=function(l,I){return t.JS.BoundsOfPaths([l],I)},t.JS.BoundsOfPaths=function(l,I){I||(I=1);var N=t.Clipper.GetBounds(l);return N.left/=I,N.bottom/=I,N.right/=I,N.top/=I,N},t.JS.Clean=function(z,I){if(!(z instanceof Array))return[];var N=z[0]instanceof Array,z=t.JS.Clone(z);if(typeof I!="number"||I===null)return t.Error("Delta is not a number in Clean()."),z;if(z.length===0||z.length===1&&z[0].length===0||I<0)return z;N||(z=[z]);for(var V=z.length,J,nt,ft,dt,At,zt,Ot,Ut=[],Ht=0;Ht<V;Ht++)if(nt=z[Ht],J=nt.length,J!==0){if(J<3){ft=nt,Ut.push(ft);continue}for(ft=nt,dt=I*I,At=nt[0],zt=1,Ot=1;Ot<J;Ot++)(nt[Ot].X-At.X)*(nt[Ot].X-At.X)+(nt[Ot].Y-At.Y)*(nt[Ot].Y-At.Y)<=dt||(ft[zt]=nt[Ot],At=nt[Ot],zt++);At=nt[zt-1],(nt[0].X-At.X)*(nt[0].X-At.X)+(nt[0].Y-At.Y)*(nt[0].Y-At.Y)<=dt&&zt--,zt<J&&ft.splice(zt,J-zt),ft.length&&Ut.push(ft)}return!N&&Ut.length?Ut=Ut[0]:!N&&Ut.length===0?Ut=[]:N&&Ut.length===0&&(Ut=[[]]),Ut},t.JS.Clone=function(l){if(!(l instanceof Array))return[];if(l.length===0)return[];if(l.length===1&&l[0].length===0)return[[]];var I=l[0]instanceof Array;I||(l=[l]);var N=l.length,z,V,J,nt,ft=new Array(N);for(V=0;V<N;V++){for(z=l[V].length,nt=new Array(z),J=0;J<z;J++)nt[J]={X:l[V][J].X,Y:l[V][J].Y};ft[V]=nt}return I||(ft=ft[0]),ft},t.JS.Lighten=function(l,I){if(!(l instanceof Array))return[];if(typeof I!="number"||I===null)return t.Error("Tolerance is not a number in Lighten()."),t.JS.Clone(l);if(l.length===0||l.length===1&&l[0].length===0||I<0)return t.JS.Clone(l);var N=l[0]instanceof Array;N||(l=[l]);var z,V,J,nt,ft,dt,At,zt,Ot,Ut,Ht,qt,_t,re,Pe,Be,or,va=l.length,ma=I*I,ar=[];for(z=0;z<va;z++)if(J=l[z],dt=J.length,dt!==0){for(nt=0;nt<1e6;nt++){for(ft=[],dt=J.length,J[dt-1].X!==J[0].X||J[dt-1].Y!==J[0].Y?(qt=1,J.push({X:J[0].X,Y:J[0].Y}),dt=J.length):qt=0,Ht=[],V=0;V<dt-2;V++)At=J[V],Ot=J[V+1],zt=J[V+2],Be=At.X,or=At.Y,_t=zt.X-Be,re=zt.Y-or,(_t!==0||re!==0)&&(Pe=((Ot.X-Be)*_t+(Ot.Y-or)*re)/(_t*_t+re*re),Pe>1?(Be=zt.X,or=zt.Y):Pe>0&&(Be+=_t*Pe,or+=re*Pe)),_t=Ot.X-Be,re=Ot.Y-or,Ut=_t*_t+re*re,Ut<=ma&&(Ht[V+1]=1,V++);for(ft.push({X:J[0].X,Y:J[0].Y}),V=1;V<dt-1;V++)Ht[V]||ft.push({X:J[V].X,Y:J[V].Y});if(ft.push({X:J[dt-1].X,Y:J[dt-1].Y}),qt&&J.pop(),Ht.length)J=ft;else break}dt=ft.length,ft[dt-1].X===ft[0].X&&ft[dt-1].Y===ft[0].Y&&ft.pop(),ft.length>2&&ar.push(ft)}return N||(ar=ar[0]),typeof ar>"u"&&(ar=[]),ar},t.JS.PerimeterOfPath=function(l,I,N){if(typeof l>"u")return 0;var z=Math.sqrt,V=0,J,nt,ft=0,dt=0,At=0,zt=0,Ot=l.length;if(Ot<2)return 0;for(I&&(l[Ot]=l[0],Ot++);--Ot;)J=l[Ot],ft=J.X,dt=J.Y,nt=l[Ot-1],At=nt.X,zt=nt.Y,V+=z((ft-At)*(ft-At)+(dt-zt)*(dt-zt));return I&&l.pop(),V/N},t.JS.PerimeterOfPaths=function(l,I,N){N||(N=1);for(var z=0,V=0;V<l.length;V++)z+=t.JS.PerimeterOfPath(l[V],I,N);return z},t.JS.ScaleDownPath=function(l,I){var N,z;for(I||(I=1),N=l.length;N--;)z=l[N],z.X=z.X/I,z.Y=z.Y/I},t.JS.ScaleDownPaths=function(l,I){var N,z,V;for(I||(I=1),N=l.length;N--;)for(z=l[N].length;z--;)V=l[N][z],V.X=V.X/I,V.Y=V.Y/I},t.JS.ScaleUpPath=function(l,I){var N,z,V=Math.round;for(I||(I=1),N=l.length;N--;)z=l[N],z.X=V(z.X*I),z.Y=V(z.Y*I)},t.JS.ScaleUpPaths=function(l,I){var N,z,V,J=Math.round;for(I||(I=1),N=l.length;N--;)for(z=l[N].length;z--;)V=l[N][z],V.X=J(V.X*I),V.Y=J(V.Y*I)},t.ExPolygons=function(){return[]},t.ExPolygon=function(){this.outer=null,this.holes=null},t.JS.AddOuterPolyNodeToExPolygons=function(l,I){var N=new t.ExPolygon;N.outer=l.Contour();var z=l.Childs(),V=z.length;N.holes=new Array(V);var J,nt,ft,dt,At,zt;for(ft=0;ft<V;ft++)for(J=z[ft],N.holes[ft]=J.Contour(),dt=0,At=J.Childs(),zt=At.length;dt<zt;dt++)nt=At[dt],t.JS.AddOuterPolyNodeToExPolygons(nt,I);I.push(N)},t.JS.ExPolygonsToPaths=function(l){var I,N,z,V,J=new t.Paths;for(I=0,z=l.length;I<z;I++)for(J.push(l[I].outer),N=0,V=l[I].holes.length;N<V;N++)J.push(l[I].holes[N]);return J},t.JS.PolyTreeToExPolygons=function(l){var I=new t.ExPolygons,N,z,V,J;for(z=0,V=l.Childs(),J=V.length;z<J;z++)N=V[z],t.JS.AddOuterPolyNodeToExPolygons(N,I);return I}})()})(En)),En.exports}var Ta=Ia();const E1=fr(Ta);var Sn,Ni;function Ca(){if(Ni)return Sn;Ni=1,Sn=o,o.polyline=o,o.polygon=t;function o(n,i,a){var s=n.length,u=r(n[0],i),d=[],M,c,v,p,T;for(a||(a=[]),M=1;M<s;M++){for(c=n[M-1],v=n[M],p=T=r(v,i);;)if(u|p){if(u&p)break;u?(c=e(c,v,u,i),u=r(c,i)):(v=e(c,v,p,i),p=r(v,i))}else{d.push(c),p!==T?(d.push(v),M<s-1&&(a.push(d),d=[])):M===s-1&&d.push(v);break}u=T}return d.length&&a.push(d),a}function t(n,i){var a,s,u,d,M,c,v;for(s=1;s<=8;s*=2){for(a=[],u=n[n.length-1],d=!(r(u,i)&s),M=0;M<n.length;M++)c=n[M],v=!(r(c,i)&s),v!==d&&a.push(e(u,c,s,i)),v&&a.push(c),u=c,d=v;if(n=a,!n.length)break}return a}function e(n,i,a,s){return a&8?[n[0]+(i[0]-n[0])*(s[3]-n[1])/(i[1]-n[1]),s[3]]:a&4?[n[0]+(i[0]-n[0])*(s[1]-n[1])/(i[1]-n[1]),s[1]]:a&2?[s[2],n[1]+(i[1]-n[1])*(s[2]-n[0])/(i[0]-n[0])]:a&1?[s[0],n[1]+(i[1]-n[1])*(s[0]-n[0])/(i[0]-n[0])]:null}function r(n,i){var a=0;return n[0]<i[0]?a|=1:n[0]>i[2]&&(a|=2),n[1]<i[1]?a|=4:n[1]>i[3]&&(a|=8),a}return Sn}var xa=Ca();const S1=fr(xa);var Yr={exports:{}},ce={},Ur={exports:{}},er={},Pi;function Xs(){if(Pi)return er;Pi=1;function o(){var i={};return i["align-content"]=!1,i["align-items"]=!1,i["align-self"]=!1,i["alignment-adjust"]=!1,i["alignment-baseline"]=!1,i.all=!1,i["anchor-point"]=!1,i.animation=!1,i["animation-delay"]=!1,i["animation-direction"]=!1,i["animation-duration"]=!1,i["animation-fill-mode"]=!1,i["animation-iteration-count"]=!1,i["animation-name"]=!1,i["animation-play-state"]=!1,i["animation-timing-function"]=!1,i.azimuth=!1,i["backface-visibility"]=!1,i.background=!0,i["background-attachment"]=!0,i["background-clip"]=!0,i["background-color"]=!0,i["background-image"]=!0,i["background-origin"]=!0,i["background-position"]=!0,i["background-repeat"]=!0,i["background-size"]=!0,i["baseline-shift"]=!1,i.binding=!1,i.bleed=!1,i["bookmark-label"]=!1,i["bookmark-level"]=!1,i["bookmark-state"]=!1,i.border=!0,i["border-bottom"]=!0,i["border-bottom-color"]=!0,i["border-bottom-left-radius"]=!0,i["border-bottom-right-radius"]=!0,i["border-bottom-style"]=!0,i["border-bottom-width"]=!0,i["border-collapse"]=!0,i["border-color"]=!0,i["border-image"]=!0,i["border-image-outset"]=!0,i["border-image-repeat"]=!0,i["border-image-slice"]=!0,i["border-image-source"]=!0,i["border-image-width"]=!0,i["border-left"]=!0,i["border-left-color"]=!0,i["border-left-style"]=!0,i["border-left-width"]=!0,i["border-radius"]=!0,i["border-right"]=!0,i["border-right-color"]=!0,i["border-right-style"]=!0,i["border-right-width"]=!0,i["border-spacing"]=!0,i["border-style"]=!0,i["border-top"]=!0,i["border-top-color"]=!0,i["border-top-left-radius"]=!0,i["border-top-right-radius"]=!0,i["border-top-style"]=!0,i["border-top-width"]=!0,i["border-width"]=!0,i.bottom=!1,i["box-decoration-break"]=!0,i["box-shadow"]=!0,i["box-sizing"]=!0,i["box-snap"]=!0,i["box-suppress"]=!0,i["break-after"]=!0,i["break-before"]=!0,i["break-inside"]=!0,i["caption-side"]=!1,i.chains=!1,i.clear=!0,i.clip=!1,i["clip-path"]=!1,i["clip-rule"]=!1,i.color=!0,i["color-interpolation-filters"]=!0,i["column-count"]=!1,i["column-fill"]=!1,i["column-gap"]=!1,i["column-rule"]=!1,i["column-rule-color"]=!1,i["column-rule-style"]=!1,i["column-rule-width"]=!1,i["column-span"]=!1,i["column-width"]=!1,i.columns=!1,i.contain=!1,i.content=!1,i["counter-increment"]=!1,i["counter-reset"]=!1,i["counter-set"]=!1,i.crop=!1,i.cue=!1,i["cue-after"]=!1,i["cue-before"]=!1,i.cursor=!1,i.direction=!1,i.display=!0,i["display-inside"]=!0,i["display-list"]=!0,i["display-outside"]=!0,i["dominant-baseline"]=!1,i.elevation=!1,i["empty-cells"]=!1,i.filter=!1,i.flex=!1,i["flex-basis"]=!1,i["flex-direction"]=!1,i["flex-flow"]=!1,i["flex-grow"]=!1,i["flex-shrink"]=!1,i["flex-wrap"]=!1,i.float=!1,i["float-offset"]=!1,i["flood-color"]=!1,i["flood-opacity"]=!1,i["flow-from"]=!1,i["flow-into"]=!1,i.font=!0,i["font-family"]=!0,i["font-feature-settings"]=!0,i["font-kerning"]=!0,i["font-language-override"]=!0,i["font-size"]=!0,i["font-size-adjust"]=!0,i["font-stretch"]=!0,i["font-style"]=!0,i["font-synthesis"]=!0,i["font-variant"]=!0,i["font-variant-alternates"]=!0,i["font-variant-caps"]=!0,i["font-variant-east-asian"]=!0,i["font-variant-ligatures"]=!0,i["font-variant-numeric"]=!0,i["font-variant-position"]=!0,i["font-weight"]=!0,i.grid=!1,i["grid-area"]=!1,i["grid-auto-columns"]=!1,i["grid-auto-flow"]=!1,i["grid-auto-rows"]=!1,i["grid-column"]=!1,i["grid-column-end"]=!1,i["grid-column-start"]=!1,i["grid-row"]=!1,i["grid-row-end"]=!1,i["grid-row-start"]=!1,i["grid-template"]=!1,i["grid-template-areas"]=!1,i["grid-template-columns"]=!1,i["grid-template-rows"]=!1,i["hanging-punctuation"]=!1,i.height=!0,i.hyphens=!1,i.icon=!1,i["image-orientation"]=!1,i["image-resolution"]=!1,i["ime-mode"]=!1,i["initial-letters"]=!1,i["inline-box-align"]=!1,i["justify-content"]=!1,i["justify-items"]=!1,i["justify-self"]=!1,i.left=!1,i["letter-spacing"]=!0,i["lighting-color"]=!0,i["line-box-contain"]=!1,i["line-break"]=!1,i["line-grid"]=!1,i["line-height"]=!1,i["line-snap"]=!1,i["line-stacking"]=!1,i["line-stacking-ruby"]=!1,i["line-stacking-shift"]=!1,i["line-stacking-strategy"]=!1,i["list-style"]=!0,i["list-style-image"]=!0,i["list-style-position"]=!0,i["list-style-type"]=!0,i.margin=!0,i["margin-bottom"]=!0,i["margin-left"]=!0,i["margin-right"]=!0,i["margin-top"]=!0,i["marker-offset"]=!1,i["marker-side"]=!1,i.marks=!1,i.mask=!1,i["mask-box"]=!1,i["mask-box-outset"]=!1,i["mask-box-repeat"]=!1,i["mask-box-slice"]=!1,i["mask-box-source"]=!1,i["mask-box-width"]=!1,i["mask-clip"]=!1,i["mask-image"]=!1,i["mask-origin"]=!1,i["mask-position"]=!1,i["mask-repeat"]=!1,i["mask-size"]=!1,i["mask-source-type"]=!1,i["mask-type"]=!1,i["max-height"]=!0,i["max-lines"]=!1,i["max-width"]=!0,i["min-height"]=!0,i["min-width"]=!0,i["move-to"]=!1,i["nav-down"]=!1,i["nav-index"]=!1,i["nav-left"]=!1,i["nav-right"]=!1,i["nav-up"]=!1,i["object-fit"]=!1,i["object-position"]=!1,i.opacity=!1,i.order=!1,i.orphans=!1,i.outline=!1,i["outline-color"]=!1,i["outline-offset"]=!1,i["outline-style"]=!1,i["outline-width"]=!1,i.overflow=!1,i["overflow-wrap"]=!1,i["overflow-x"]=!1,i["overflow-y"]=!1,i.padding=!0,i["padding-bottom"]=!0,i["padding-left"]=!0,i["padding-right"]=!0,i["padding-top"]=!0,i.page=!1,i["page-break-after"]=!1,i["page-break-before"]=!1,i["page-break-inside"]=!1,i["page-policy"]=!1,i.pause=!1,i["pause-after"]=!1,i["pause-before"]=!1,i.perspective=!1,i["perspective-origin"]=!1,i.pitch=!1,i["pitch-range"]=!1,i["play-during"]=!1,i.position=!1,i["presentation-level"]=!1,i.quotes=!1,i["region-fragment"]=!1,i.resize=!1,i.rest=!1,i["rest-after"]=!1,i["rest-before"]=!1,i.richness=!1,i.right=!1,i.rotation=!1,i["rotation-point"]=!1,i["ruby-align"]=!1,i["ruby-merge"]=!1,i["ruby-position"]=!1,i["shape-image-threshold"]=!1,i["shape-outside"]=!1,i["shape-margin"]=!1,i.size=!1,i.speak=!1,i["speak-as"]=!1,i["speak-header"]=!1,i["speak-numeral"]=!1,i["speak-punctuation"]=!1,i["speech-rate"]=!1,i.stress=!1,i["string-set"]=!1,i["tab-size"]=!1,i["table-layout"]=!1,i["text-align"]=!0,i["text-align-last"]=!0,i["text-combine-upright"]=!0,i["text-decoration"]=!0,i["text-decoration-color"]=!0,i["text-decoration-line"]=!0,i["text-decoration-skip"]=!0,i["text-decoration-style"]=!0,i["text-emphasis"]=!0,i["text-emphasis-color"]=!0,i["text-emphasis-position"]=!0,i["text-emphasis-style"]=!0,i["text-height"]=!0,i["text-indent"]=!0,i["text-justify"]=!0,i["text-orientation"]=!0,i["text-overflow"]=!0,i["text-shadow"]=!0,i["text-space-collapse"]=!0,i["text-transform"]=!0,i["text-underline-position"]=!0,i["text-wrap"]=!0,i.top=!1,i.transform=!1,i["transform-origin"]=!1,i["transform-style"]=!1,i.transition=!1,i["transition-delay"]=!1,i["transition-duration"]=!1,i["transition-property"]=!1,i["transition-timing-function"]=!1,i["unicode-bidi"]=!1,i["vertical-align"]=!1,i.visibility=!1,i["voice-balance"]=!1,i["voice-duration"]=!1,i["voice-family"]=!1,i["voice-pitch"]=!1,i["voice-range"]=!1,i["voice-rate"]=!1,i["voice-stress"]=!1,i["voice-volume"]=!1,i.volume=!1,i["white-space"]=!1,i.widows=!1,i.width=!0,i["will-change"]=!1,i["word-break"]=!0,i["word-spacing"]=!0,i["word-wrap"]=!0,i["wrap-flow"]=!1,i["wrap-through"]=!1,i["writing-mode"]=!1,i["z-index"]=!1,i}function t(i,a,s){}function e(i,a,s){}var r=/javascript\s*\:/img;function n(i,a){return r.test(a)?"":a}return er.whiteList=o(),er.getDefaultWhiteList=o,er.onAttr=t,er.onIgnoreAttr=e,er.safeAttrValue=n,er}var An,Di;function Gs(){return Di||(Di=1,An={indexOf:function(o,t){var e,r;if(Array.prototype.indexOf)return o.indexOf(t);for(e=0,r=o.length;e<r;e++)if(o[e]===t)return e;return-1},forEach:function(o,t,e){var r,n;if(Array.prototype.forEach)return o.forEach(t,e);for(r=0,n=o.length;r<n;r++)t.call(e,o[r],r,o)},trim:function(o){return String.prototype.trim?o.trim():o.replace(/(^\s*)|(\s*$)/g,"")},trimRight:function(o){return String.prototype.trimRight?o.trimRight():o.replace(/(\s*$)/g,"")}}),An}var Nn,wi;function Ea(){if(wi)return Nn;wi=1;var o=Gs();function t(e,r){e=o.trimRight(e),e[e.length-1]!==";"&&(e+=";");var n=e.length,i=!1,a=0,s=0,u="";function d(){if(!i){var v=o.trim(e.slice(a,s)),p=v.indexOf(":");if(p!==-1){var T=o.trim(v.slice(0,p)),x=o.trim(v.slice(p+1));if(T){var y=r(a,u.length,T,x,v);y&&(u+=y+"; ")}}}a=s+1}for(;s<n;s++){var M=e[s];if(M==="/"&&e[s+1]==="*"){var c=e.indexOf("*/",s+2);if(c===-1)break;s=c+1,a=s+1,i=!1}else M==="("?i=!0:M===")"?i=!1:M===";"?i||d():M===`
|
||
`&&d()}return o.trim(u)}return Nn=t,Nn}var Pn,bi;function Sa(){if(bi)return Pn;bi=1;var o=Xs(),t=Ea();Gs();function e(i){return i==null}function r(i){var a={};for(var s in i)a[s]=i[s];return a}function n(i){i=r(i||{}),i.whiteList=i.whiteList||o.whiteList,i.onAttr=i.onAttr||o.onAttr,i.onIgnoreAttr=i.onIgnoreAttr||o.onIgnoreAttr,i.safeAttrValue=i.safeAttrValue||o.safeAttrValue,this.options=i}return n.prototype.process=function(i){if(i=i||"",i=i.toString(),!i)return"";var a=this,s=a.options,u=s.whiteList,d=s.onAttr,M=s.onIgnoreAttr,c=s.safeAttrValue,v=t(i,function(p,T,x,y,C){var h=u[x],g=!1;if(h===!0?g=h:typeof h=="function"?g=h(y):h instanceof RegExp&&(g=h.test(y)),g!==!0&&(g=!1),y=c(x,y),!!y){var f={position:T,sourcePosition:p,source:C,isWhite:g};if(g){var m=d(x,y,f);return e(m)?x+":"+y:m}else{var m=M(x,y,f);if(!e(m))return m}}});return v},Pn=n,Pn}var Oi;function kn(){return Oi||(Oi=1,(function(o,t){var e=Xs(),r=Sa();function n(a,s){var u=new r(s);return u.process(a)}t=o.exports=n,t.FilterCSS=r;for(var i in e)t[i]=e[i];typeof window<"u"&&(window.filterCSS=o.exports)})(Ur,Ur.exports)),Ur.exports}var Dn,Li;function ti(){return Li||(Li=1,Dn={indexOf:function(o,t){var e,r;if(Array.prototype.indexOf)return o.indexOf(t);for(e=0,r=o.length;e<r;e++)if(o[e]===t)return e;return-1},forEach:function(o,t,e){var r,n;if(Array.prototype.forEach)return o.forEach(t,e);for(r=0,n=o.length;r<n;r++)t.call(e,o[r],r,o)},trim:function(o){return String.prototype.trim?o.trim():o.replace(/(^\s*)|(\s*$)/g,"")},spaceIndex:function(o){var t=/\s|\n|\t/,e=t.exec(o);return e?e.index:-1}}),Dn}var ji;function Hs(){if(ji)return ce;ji=1;var o=kn().FilterCSS,t=kn().getDefaultWhiteList,e=ti();function r(){return{a:["target","href","title"],abbr:["title"],address:[],area:["shape","coords","href","alt"],article:[],aside:[],audio:["autoplay","controls","crossorigin","loop","muted","preload","src"],b:[],bdi:["dir"],bdo:["dir"],big:[],blockquote:["cite"],br:[],caption:[],center:[],cite:[],code:[],col:["align","valign","span","width"],colgroup:["align","valign","span","width"],dd:[],del:["datetime"],details:["open"],div:[],dl:[],dt:[],em:[],figcaption:[],figure:[],font:["color","size","face"],footer:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],hr:[],i:[],img:["src","alt","title","width","height","loading"],ins:["datetime"],kbd:[],li:[],mark:[],nav:[],ol:[],p:[],pre:[],s:[],section:[],small:[],span:[],sub:[],summary:[],sup:[],strong:[],strike:[],table:["width","border","align","valign"],tbody:["align","valign"],td:["width","rowspan","colspan","align","valign"],tfoot:["align","valign"],th:["width","rowspan","colspan","align","valign"],thead:["align","valign"],tr:["rowspan","align","valign"],tt:[],u:[],ul:[],video:["autoplay","controls","crossorigin","loop","muted","playsinline","poster","preload","src","height","width"]}}var n=new o;function i(X,Z,$){}function a(X,Z,$){}function s(X,Z,$){}function u(X,Z,$){}function d(X){return X.replace(c,"<").replace(v,">")}function M(X,Z,$,rt){if($=D($),Z==="href"||Z==="src"){if($=e.trim($),$==="#")return"#";if(!($.substr(0,7)==="http://"||$.substr(0,8)==="https://"||$.substr(0,7)==="mailto:"||$.substr(0,4)==="tel:"||$.substr(0,11)==="data:image/"||$.substr(0,6)==="ftp://"||$.substr(0,2)==="./"||$.substr(0,3)==="../"||$[0]==="#"||$[0]==="/"))return""}else if(Z==="background"){if(h.lastIndex=0,h.test($))return""}else if(Z==="style"){if(g.lastIndex=0,g.test($)||(f.lastIndex=0,f.test($)&&(h.lastIndex=0,h.test($))))return"";rt!==!1&&(rt=rt||n,$=rt.process($))}return $=L($),$}var c=/</g,v=/>/g,p=/"/g,T=/"/g,x=/&#([a-zA-Z0-9]*);?/gim,y=/:?/gim,C=/&newline;?/gim,h=/((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi,g=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,f=/u\s*r\s*l\s*\(.*/gi;function m(X){return X.replace(p,""")}function S(X){return X.replace(T,'"')}function A(X){return X.replace(x,function($,rt){return rt[0]==="x"||rt[0]==="X"?String.fromCharCode(parseInt(rt.substr(1),16)):String.fromCharCode(parseInt(rt,10))})}function P(X){return X.replace(y,":").replace(C," ")}function R(X){for(var Z="",$=0,rt=X.length;$<rt;$++)Z+=X.charCodeAt($)<32?" ":X.charAt($);return e.trim(Z)}function D(X){return X=S(X),X=A(X),X=P(X),X=R(X),X}function L(X){return X=m(X),X=d(X),X}function j(){return""}function b(X,Z){typeof Z!="function"&&(Z=function(){});var $=!Array.isArray(X);function rt(tt){return $?!0:e.indexOf(X,tt)!==-1}var F=[],Q=!1;return{onIgnoreTag:function(tt,lt,ct){if(rt(tt))if(ct.isClosing){var Mt="[/removed]",st=ct.position+Mt.length;return F.push([Q!==!1?Q:ct.position,st]),Q=!1,Mt}else return Q||(Q=ct.position),"[removed]";else return Z(tt,lt,ct)},remove:function(tt){var lt="",ct=0;return e.forEach(F,function(Mt){lt+=tt.slice(ct,Mt[0]),ct=Mt[1]}),lt+=tt.slice(ct),lt}}}function O(X){for(var Z="",$=0;$<X.length;){var rt=X.indexOf("<!--",$);if(rt===-1){Z+=X.slice($);break}Z+=X.slice($,rt);var F=X.indexOf("-->",rt);if(F===-1)break;$=F+3}return Z}function Y(X){var Z=X.split("");return Z=Z.filter(function($){var rt=$.charCodeAt(0);return rt===127?!1:rt<=31?rt===10||rt===13:!0}),Z.join("")}return ce.whiteList=r(),ce.getDefaultWhiteList=r,ce.onTag=i,ce.onIgnoreTag=a,ce.onTagAttr=s,ce.onIgnoreTagAttr=u,ce.safeAttrValue=M,ce.escapeHtml=d,ce.escapeQuote=m,ce.unescapeQuote=S,ce.escapeHtmlEntities=A,ce.escapeDangerHtml5Entities=P,ce.clearNonPrintableCharacter=R,ce.friendlyAttrValue=D,ce.escapeAttrValue=L,ce.onIgnoreTagStripAll=j,ce.StripTagBody=b,ce.stripCommentTag=O,ce.stripBlankChar=Y,ce.attributeWrapSign='"',ce.cssFilter=n,ce.getDefaultCSSWhiteList=t,ce}var Wr={},Ri;function Zs(){if(Ri)return Wr;Ri=1;var o=ti();function t(c){var v=o.spaceIndex(c),p;return v===-1?p=c.slice(1,-1):p=c.slice(1,v+1),p=o.trim(p).toLowerCase(),p.slice(0,1)==="/"&&(p=p.slice(1)),p.slice(-1)==="/"&&(p=p.slice(0,-1)),p}function e(c){return c.slice(0,2)==="</"}function r(c,v,p){var T="",x=0,y=!1,C=!1,h=0,g=c.length,f="",m="";t:for(h=0;h<g;h++){var S=c.charAt(h);if(y===!1){if(S==="<"){y=h;continue}}else if(C===!1){if(S==="<"){T+=p(c.slice(x,h)),y=h,x=h;continue}if(S===">"||h===g-1){T+=p(c.slice(x,y)),m=c.slice(y,h+1),f=t(m),T+=v(y,T.length,f,m,e(m)),x=h+1,y=!1;continue}if(S==='"'||S==="'")for(var A=1,P=c.charAt(h-A);P.trim()===""||P==="=";){if(P==="="){C=S;continue t}P=c.charAt(h-++A)}}else if(S===C){C=!1;continue}}return x<g&&(T+=p(c.substr(x))),T}var n=/[^a-zA-Z0-9\\_:.-]/gim;function i(c,v){var p=0,T=0,x=[],y=!1,C=c.length;function h(A,P){if(A=o.trim(A),A=A.replace(n,"").toLowerCase(),!(A.length<1)){var R=v(A,P||"");R&&x.push(R)}}for(var g=0;g<C;g++){var f=c.charAt(g),m,S;if(y===!1&&f==="="){y=c.slice(p,g),p=g+1,T=c.charAt(p)==='"'||c.charAt(p)==="'"?p:s(c,g+1);continue}if(y!==!1&&g===T){if(S=c.indexOf(f,g+1),S===-1)break;m=o.trim(c.slice(T+1,S)),h(y,m),y=!1,g=S,p=g+1;continue}if(/\s|\n|\t/.test(f))if(c=c.replace(/\s|\n|\t/g," "),y===!1)if(S=a(c,g),S===-1){m=o.trim(c.slice(p,g)),h(m),y=!1,p=g+1;continue}else{g=S-1;continue}else if(S=u(c,g-1),S===-1){m=o.trim(c.slice(p,g)),m=M(m),h(y,m),y=!1,p=g+1;continue}else continue}return p<c.length&&(y===!1?h(c.slice(p)):h(y,M(o.trim(c.slice(p))))),o.trim(x.join(" "))}function a(c,v){for(;v<c.length;v++){var p=c[v];if(p!==" ")return p==="="?v:-1}}function s(c,v){for(;v<c.length;v++){var p=c[v];if(p!==" ")return p==="'"||p==='"'?v:-1}}function u(c,v){for(;v>0;v--){var p=c[v];if(p!==" ")return p==="="?v:-1}}function d(c){return c[0]==='"'&&c[c.length-1]==='"'||c[0]==="'"&&c[c.length-1]==="'"}function M(c){return d(c)?c.substr(1,c.length-2):c}return Wr.parseTag=r,Wr.parseAttr=i,Wr}var wn,zi;function Aa(){if(zi)return wn;zi=1;var o=kn().FilterCSS,t=Hs(),e=Zs(),r=e.parseTag,n=e.parseAttr,i=ti();function a(c){return c==null}function s(c){var v=i.spaceIndex(c);if(v===-1)return{html:"",closing:c[c.length-2]==="/"};c=i.trim(c.slice(v+1,-1));var p=c[c.length-1]==="/";return p&&(c=i.trim(c.slice(0,-1))),{html:c,closing:p}}function u(c){var v={};for(var p in c)v[p]=c[p];return v}function d(c){var v={};for(var p in c)Array.isArray(c[p])?v[p.toLowerCase()]=c[p].map(function(T){return T.toLowerCase()}):v[p.toLowerCase()]=c[p];return v}function M(c){c=u(c||{}),c.stripIgnoreTag&&(c.onIgnoreTag&&console.error('Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'),c.onIgnoreTag=t.onIgnoreTagStripAll),c.whiteList||c.allowList?c.whiteList=d(c.whiteList||c.allowList):c.whiteList=t.whiteList,this.attributeWrapSign=c.singleQuotedAttributeValue===!0?"'":t.attributeWrapSign,c.onTag=c.onTag||t.onTag,c.onTagAttr=c.onTagAttr||t.onTagAttr,c.onIgnoreTag=c.onIgnoreTag||t.onIgnoreTag,c.onIgnoreTagAttr=c.onIgnoreTagAttr||t.onIgnoreTagAttr,c.safeAttrValue=c.safeAttrValue||t.safeAttrValue,c.escapeHtml=c.escapeHtml||t.escapeHtml,this.options=c,c.css===!1?this.cssFilter=!1:(c.css=c.css||{},this.cssFilter=new o(c.css))}return M.prototype.process=function(c){if(c=c||"",c=c.toString(),!c)return"";var v=this,p=v.options,T=p.whiteList,x=p.onTag,y=p.onIgnoreTag,C=p.onTagAttr,h=p.onIgnoreTagAttr,g=p.safeAttrValue,f=p.escapeHtml,m=v.attributeWrapSign,S=v.cssFilter;p.stripBlankChar&&(c=t.stripBlankChar(c)),p.allowCommentTag||(c=t.stripCommentTag(c));var A=!1;p.stripIgnoreTagBody&&(A=t.StripTagBody(p.stripIgnoreTagBody,y),y=A.onIgnoreTag);var P=r(c,function(R,D,L,j,b){var O={sourcePosition:R,position:D,isClosing:b,isWhite:Object.prototype.hasOwnProperty.call(T,L)},Y=x(L,j,O);if(!a(Y))return Y;if(O.isWhite){if(O.isClosing)return"</"+L+">";var X=s(j),Z=T[L],$=n(X.html,function(rt,F){var Q=i.indexOf(Z,rt)!==-1,tt=C(L,rt,F,Q);return a(tt)?Q?(F=g(L,rt,F,S),F?rt+"="+m+F+m:rt):(tt=h(L,rt,F,Q),a(tt)?void 0:tt):tt});return j="<"+L,$&&(j+=" "+$),X.closing&&(j+=" /"),j+=">",j}else return Y=y(L,j,O),a(Y)?f(j):Y},f);return A&&(P=A.remove(P)),P},wn=M,wn}var Bi;function Na(){return Bi||(Bi=1,(function(o,t){var e=Hs(),r=Zs(),n=Aa();function i(s,u){var d=new n(u);return d.process(s)}t=o.exports=i,t.filterXSS=i,t.FilterXSS=n,(function(){for(var s in e)t[s]=e[s];for(var u in r)t[u]=r[u]})(),typeof window<"u"&&(window.filterXSS=o.exports);function a(){return typeof self<"u"&&typeof DedicatedWorkerGlobalScope<"u"&&self instanceof DedicatedWorkerGlobalScope}a()&&(self.filterXSS=o.exports)})(Yr,Yr.exports)),Yr.exports}var Pa=Na();const Xn=fr(Pa);var pt=un();const ot=fr(pt);var ei=_n();const ri=fr(ei);var Ir={exports:{}},bn={},On={exports:{}},Ln,Yi;function Da(){if(Yi)return Ln;Yi=1;var o="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ln=o,Ln}var jn,Ui;function wa(){if(Ui)return jn;Ui=1;var o=Da();function t(){}function e(){}return e.resetWarningCache=t,jn=function(){function r(a,s,u,d,M,c){if(c!==o){var v=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw v.name="Invariant Violation",v}}r.isRequired=r;function n(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:n,element:r,elementType:r,instanceOf:n,node:r,objectOf:n,oneOf:n,oneOfType:n,shape:n,exact:n,checkPropTypes:e,resetWarningCache:t};return i.PropTypes=i,i},jn}var Wi;function Qs(){return Wi||(Wi=1,On.exports=wa()()),On.exports}var Fr={exports:{}},Fi;function ba(){if(Fi)return Fr.exports;Fi=1;function o(e){var r,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(r=0;r<a;r++)e[r]&&(n=o(e[r]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function t(){for(var e,r,n=0,i="",a=arguments.length;n<a;n++)(e=arguments[n])&&(r=o(e))&&(i&&(i+=" "),i+=r);return i}return Fr.exports=t,Fr.exports.clsx=t,Fr.exports}var ve={},Ke={},Vi;function hn(){if(Vi)return Ke;Vi=1,Object.defineProperty(Ke,"__esModule",{value:!0}),Ke.dontSetMe=n,Ke.findInArray=o,Ke.int=r,Ke.isFunction=t,Ke.isNum=e;function o(i,a){for(let s=0,u=i.length;s<u;s++)if(a.apply(a,[i[s],s,i]))return i[s]}function t(i){return typeof i=="function"||Object.prototype.toString.call(i)==="[object Function]"}function e(i){return typeof i=="number"&&!isNaN(i)}function r(i){return parseInt(i,10)}function n(i,a,s){if(i[a])return new Error(`Invalid prop ${a} passed to ${s} - do not set this, set it on the child.`)}return Ke}var $e={},ki;function Oa(){if(ki)return $e;ki=1,Object.defineProperty($e,"__esModule",{value:!0}),$e.browserPrefixToKey=e,$e.browserPrefixToStyle=r,$e.default=void 0,$e.getPrefix=t;const o=["Moz","Webkit","O","ms"];function t(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const a=window.document?.documentElement?.style;if(!a||i in a)return"";for(let s=0;s<o.length;s++)if(e(i,o[s])in a)return o[s];return""}function e(i,a){return a?`${a}${n(i)}`:i}function r(i,a){return a?`-${a.toLowerCase()}-${i}`:i}function n(i){let a="",s=!0;for(let u=0;u<i.length;u++)s?(a+=i[u].toUpperCase(),s=!1):i[u]==="-"?s=!0:a+=i[u];return a}return $e.default=t(),$e}var Xi;function ni(){if(Xi)return ve;Xi=1,Object.defineProperty(ve,"__esModule",{value:!0}),ve.addClassName=m,ve.addEvent=a,ve.addUserSelectStyles=h,ve.createCSSTransform=p,ve.createSVGTransform=T,ve.getTouch=y,ve.getTouchIdentifier=C,ve.getTranslation=x,ve.innerHeight=M,ve.innerWidth=c,ve.matchesSelector=n,ve.matchesSelectorAndParentsTo=i,ve.offsetXYFromParent=v,ve.outerHeight=u,ve.outerWidth=d,ve.removeClassName=S,ve.removeEvent=s,ve.scheduleRemoveUserSelectStyles=g;var o=hn(),t=e(Oa());function e(A,P){if(typeof WeakMap=="function")var R=new WeakMap,D=new WeakMap;return(e=function(L,j){if(!j&&L&&L.__esModule)return L;var b,O,Y={__proto__:null,default:L};if(L===null||typeof L!="object"&&typeof L!="function")return Y;if(b=j?D:R){if(b.has(L))return b.get(L);b.set(L,Y)}for(const X in L)X!=="default"&&{}.hasOwnProperty.call(L,X)&&((O=(b=Object.defineProperty)&&Object.getOwnPropertyDescriptor(L,X))&&(O.get||O.set)?b(Y,X,O):Y[X]=L[X]);return Y})(A,P)}let r="";function n(A,P){return r||(r=(0,o.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(R){return(0,o.isFunction)(A[R])})),(0,o.isFunction)(A[r])?A[r](P):!1}function i(A,P,R){let D=A;do{if(n(D,P))return!0;if(D===R)return!1;D=D.parentNode}while(D);return!1}function a(A,P,R,D){if(!A)return;const L={capture:!0,...D};A.addEventListener?A.addEventListener(P,R,L):A.attachEvent?A.attachEvent("on"+P,R):A["on"+P]=R}function s(A,P,R,D){if(!A)return;const L={capture:!0,...D};A.removeEventListener?A.removeEventListener(P,R,L):A.detachEvent?A.detachEvent("on"+P,R):A["on"+P]=null}function u(A){let P=A.clientHeight;const R=A.ownerDocument.defaultView.getComputedStyle(A);return P+=(0,o.int)(R.borderTopWidth),P+=(0,o.int)(R.borderBottomWidth),P}function d(A){let P=A.clientWidth;const R=A.ownerDocument.defaultView.getComputedStyle(A);return P+=(0,o.int)(R.borderLeftWidth),P+=(0,o.int)(R.borderRightWidth),P}function M(A){let P=A.clientHeight;const R=A.ownerDocument.defaultView.getComputedStyle(A);return P-=(0,o.int)(R.paddingTop),P-=(0,o.int)(R.paddingBottom),P}function c(A){let P=A.clientWidth;const R=A.ownerDocument.defaultView.getComputedStyle(A);return P-=(0,o.int)(R.paddingLeft),P-=(0,o.int)(R.paddingRight),P}function v(A,P,R){const L=P===P.ownerDocument.body?{left:0,top:0}:P.getBoundingClientRect(),j=(A.clientX+P.scrollLeft-L.left)/R,b=(A.clientY+P.scrollTop-L.top)/R;return{x:j,y:b}}function p(A,P){const R=x(A,P,"px");return{[(0,t.browserPrefixToKey)("transform",t.default)]:R}}function T(A,P){return x(A,P,"")}function x(A,P,R){let{x:D,y:L}=A,j=`translate(${D}${R},${L}${R})`;if(P){const b=`${typeof P.x=="string"?P.x:P.x+R}`,O=`${typeof P.y=="string"?P.y:P.y+R}`;j=`translate(${b}, ${O})`+j}return j}function y(A,P){return A.targetTouches&&(0,o.findInArray)(A.targetTouches,R=>P===R.identifier)||A.changedTouches&&(0,o.findInArray)(A.changedTouches,R=>P===R.identifier)}function C(A){if(A.targetTouches&&A.targetTouches[0])return A.targetTouches[0].identifier;if(A.changedTouches&&A.changedTouches[0])return A.changedTouches[0].identifier}function h(A){if(!A)return;let P=A.getElementById("react-draggable-style-el");P||(P=A.createElement("style"),P.type="text/css",P.id="react-draggable-style-el",P.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
||
`,P.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
|
||
`,A.getElementsByTagName("head")[0].appendChild(P)),A.body&&m(A.body,"react-draggable-transparent-selection")}function g(A){window.requestAnimationFrame?window.requestAnimationFrame(()=>{f(A)}):f(A)}function f(A){if(A)try{if(A.body&&S(A.body,"react-draggable-transparent-selection"),A.selection)A.selection.empty();else{const P=(A.defaultView||window).getSelection();P&&P.type!=="Caret"&&P.removeAllRanges()}}catch{}}function m(A,P){A.classList?A.classList.add(P):A.className.match(new RegExp(`(?:^|\\s)${P}(?!\\S)`))||(A.className+=` ${P}`)}function S(A,P){A.classList?A.classList.remove(P):A.className=A.className.replace(new RegExp(`(?:^|\\s)${P}(?!\\S)`,"g"),"")}return ve}var Ye={},Gi;function Ks(){if(Gi)return Ye;Gi=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.canDragX=n,Ye.canDragY=i,Ye.createCoreData=s,Ye.createDraggableData=u,Ye.getBoundPosition=e,Ye.getControlPosition=a,Ye.snapToGrid=r;var o=hn(),t=ni();function e(c,v,p){if(!c.props.bounds)return[v,p];let{bounds:T}=c.props;T=typeof T=="string"?T:d(T);const x=M(c);if(typeof T=="string"){const{ownerDocument:y}=x,C=y.defaultView;let h;if(T==="parent"?h=x.parentNode:h=x.getRootNode().querySelector(T),!(h instanceof C.HTMLElement))throw new Error('Bounds selector "'+T+'" could not find an element.');const g=h,f=C.getComputedStyle(x),m=C.getComputedStyle(g);T={left:-x.offsetLeft+(0,o.int)(m.paddingLeft)+(0,o.int)(f.marginLeft),top:-x.offsetTop+(0,o.int)(m.paddingTop)+(0,o.int)(f.marginTop),right:(0,t.innerWidth)(g)-(0,t.outerWidth)(x)-x.offsetLeft+(0,o.int)(m.paddingRight)-(0,o.int)(f.marginRight),bottom:(0,t.innerHeight)(g)-(0,t.outerHeight)(x)-x.offsetTop+(0,o.int)(m.paddingBottom)-(0,o.int)(f.marginBottom)}}return(0,o.isNum)(T.right)&&(v=Math.min(v,T.right)),(0,o.isNum)(T.bottom)&&(p=Math.min(p,T.bottom)),(0,o.isNum)(T.left)&&(v=Math.max(v,T.left)),(0,o.isNum)(T.top)&&(p=Math.max(p,T.top)),[v,p]}function r(c,v,p){const T=Math.round(v/c[0])*c[0],x=Math.round(p/c[1])*c[1];return[T,x]}function n(c){return c.props.axis==="both"||c.props.axis==="x"}function i(c){return c.props.axis==="both"||c.props.axis==="y"}function a(c,v,p){const T=typeof v=="number"?(0,t.getTouch)(c,v):null;if(typeof v=="number"&&!T)return null;const x=M(p),y=p.props.offsetParent||x.offsetParent||x.ownerDocument.body;return(0,t.offsetXYFromParent)(T||c,y,p.props.scale)}function s(c,v,p){const T=!(0,o.isNum)(c.lastX),x=M(c);return T?{node:x,deltaX:0,deltaY:0,lastX:v,lastY:p,x:v,y:p}:{node:x,deltaX:v-c.lastX,deltaY:p-c.lastY,lastX:c.lastX,lastY:c.lastY,x:v,y:p}}function u(c,v){const p=c.props.scale;return{node:v.node,x:c.state.x+v.deltaX/p,y:c.state.y+v.deltaY/p,deltaX:v.deltaX/p,deltaY:v.deltaY/p,lastX:c.state.x,lastY:c.state.y}}function d(c){return{left:c.left,top:c.top,right:c.right,bottom:c.bottom}}function M(c){const v=c.findDOMNode();if(!v)throw new Error("<DraggableCore>: Unmounted during event!");return v}return Ye}var Tr={},Vr={},Hi;function $s(){if(Hi)return Vr;Hi=1,Object.defineProperty(Vr,"__esModule",{value:!0}),Vr.default=o;function o(){}return Vr}var Zi;function La(){if(Zi)return Tr;Zi=1,Object.defineProperty(Tr,"__esModule",{value:!0}),Tr.default=void 0;var o=u(un()),t=s(Qs()),e=s(_n()),r=ni(),n=Ks(),i=hn(),a=s($s());function s(x){return x&&x.__esModule?x:{default:x}}function u(x,y){if(typeof WeakMap=="function")var C=new WeakMap,h=new WeakMap;return(u=function(g,f){if(!f&&g&&g.__esModule)return g;var m,S,A={__proto__:null,default:g};if(g===null||typeof g!="object"&&typeof g!="function")return A;if(m=f?h:C){if(m.has(g))return m.get(g);m.set(g,A)}for(const P in g)P!=="default"&&{}.hasOwnProperty.call(g,P)&&((S=(m=Object.defineProperty)&&Object.getOwnPropertyDescriptor(g,P))&&(S.get||S.set)?m(A,P,S):A[P]=g[P]);return A})(x,y)}function d(x,y,C){return(y=M(y))in x?Object.defineProperty(x,y,{value:C,enumerable:!0,configurable:!0,writable:!0}):x[y]=C,x}function M(x){var y=c(x,"string");return typeof y=="symbol"?y:y+""}function c(x,y){if(typeof x!="object"||!x)return x;var C=x[Symbol.toPrimitive];if(C!==void 0){var h=C.call(x,y);if(typeof h!="object")return h;throw new TypeError("@@toPrimitive must return a primitive value.")}return(y==="string"?String:Number)(x)}const v={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let p=v.mouse,T=class extends o.Component{constructor(){super(...arguments),d(this,"dragging",!1),d(this,"lastX",NaN),d(this,"lastY",NaN),d(this,"touchIdentifier",null),d(this,"mounted",!1),d(this,"handleDragStart",y=>{if(this.props.onMouseDown(y),!this.props.allowAnyClick&&typeof y.button=="number"&&y.button!==0)return!1;const C=this.findDOMNode();if(!C||!C.ownerDocument||!C.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:h}=C;if(this.props.disabled||!(y.target instanceof h.defaultView.Node)||this.props.handle&&!(0,r.matchesSelectorAndParentsTo)(y.target,this.props.handle,C)||this.props.cancel&&(0,r.matchesSelectorAndParentsTo)(y.target,this.props.cancel,C))return;y.type==="touchstart"&&!this.props.allowMobileScroll&&y.preventDefault();const g=(0,r.getTouchIdentifier)(y);this.touchIdentifier=g;const f=(0,n.getControlPosition)(y,g,this);if(f==null)return;const{x:m,y:S}=f,A=(0,n.createCoreData)(this,m,S);(0,a.default)("DraggableCore: handleDragStart: %j",A),(0,a.default)("calling",this.props.onStart),!(this.props.onStart(y,A)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,r.addUserSelectStyles)(h),this.dragging=!0,this.lastX=m,this.lastY=S,(0,r.addEvent)(h,p.move,this.handleDrag),(0,r.addEvent)(h,p.stop,this.handleDragStop))}),d(this,"handleDrag",y=>{const C=(0,n.getControlPosition)(y,this.touchIdentifier,this);if(C==null)return;let{x:h,y:g}=C;if(Array.isArray(this.props.grid)){let S=h-this.lastX,A=g-this.lastY;if([S,A]=(0,n.snapToGrid)(this.props.grid,S,A),!S&&!A)return;h=this.lastX+S,g=this.lastY+A}const f=(0,n.createCoreData)(this,h,g);if((0,a.default)("DraggableCore: handleDrag: %j",f),this.props.onDrag(y,f)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const A=document.createEvent("MouseEvents");A.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(A)}return}this.lastX=h,this.lastY=g}),d(this,"handleDragStop",y=>{if(!this.dragging)return;const C=(0,n.getControlPosition)(y,this.touchIdentifier,this);if(C==null)return;let{x:h,y:g}=C;if(Array.isArray(this.props.grid)){let A=h-this.lastX||0,P=g-this.lastY||0;[A,P]=(0,n.snapToGrid)(this.props.grid,A,P),h=this.lastX+A,g=this.lastY+P}const f=(0,n.createCoreData)(this,h,g);if(this.props.onStop(y,f)===!1||this.mounted===!1)return!1;const S=this.findDOMNode();S&&this.props.enableUserSelectHack&&(0,r.scheduleRemoveUserSelectStyles)(S.ownerDocument),(0,a.default)("DraggableCore: handleDragStop: %j",f),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,S&&((0,a.default)("DraggableCore: Removing handlers"),(0,r.removeEvent)(S.ownerDocument,p.move,this.handleDrag),(0,r.removeEvent)(S.ownerDocument,p.stop,this.handleDragStop))}),d(this,"onMouseDown",y=>(p=v.mouse,this.handleDragStart(y))),d(this,"onMouseUp",y=>(p=v.mouse,this.handleDragStop(y))),d(this,"onTouchStart",y=>(p=v.touch,this.handleDragStart(y))),d(this,"onTouchEnd",y=>(p=v.touch,this.handleDragStop(y)))}componentDidMount(){this.mounted=!0;const y=this.findDOMNode();y&&(0,r.addEvent)(y,v.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const y=this.findDOMNode();if(y){const{ownerDocument:C}=y;(0,r.removeEvent)(C,v.mouse.move,this.handleDrag),(0,r.removeEvent)(C,v.touch.move,this.handleDrag),(0,r.removeEvent)(C,v.mouse.stop,this.handleDragStop),(0,r.removeEvent)(C,v.touch.stop,this.handleDragStop),(0,r.removeEvent)(y,v.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,r.scheduleRemoveUserSelectStyles)(C)}}findDOMNode(){return this.props?.nodeRef?this.props?.nodeRef?.current:e.default.findDOMNode(this)}render(){return o.cloneElement(o.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};return Tr.default=T,d(T,"displayName","DraggableCore"),d(T,"propTypes",{allowAnyClick:t.default.bool,allowMobileScroll:t.default.bool,children:t.default.node.isRequired,disabled:t.default.bool,enableUserSelectHack:t.default.bool,offsetParent:function(x,y){if(x[y]&&x[y].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:t.default.arrayOf(t.default.number),handle:t.default.string,cancel:t.default.string,nodeRef:t.default.object,onStart:t.default.func,onDrag:t.default.func,onStop:t.default.func,onMouseDown:t.default.func,scale:t.default.number,className:i.dontSetMe,style:i.dontSetMe,transform:i.dontSetMe}),d(T,"defaultProps",{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),Tr}var Qi;function ja(){return Qi||(Qi=1,(function(o){Object.defineProperty(o,"__esModule",{value:!0}),Object.defineProperty(o,"DraggableCore",{enumerable:!0,get:function(){return u.default}}),o.default=void 0;var t=c(un()),e=M(Qs()),r=M(_n()),n=ba(),i=ni(),a=Ks(),s=hn(),u=M(La()),d=M($s());function M(C){return C&&C.__esModule?C:{default:C}}function c(C,h){if(typeof WeakMap=="function")var g=new WeakMap,f=new WeakMap;return(c=function(m,S){if(!S&&m&&m.__esModule)return m;var A,P,R={__proto__:null,default:m};if(m===null||typeof m!="object"&&typeof m!="function")return R;if(A=S?f:g){if(A.has(m))return A.get(m);A.set(m,R)}for(const D in m)D!=="default"&&{}.hasOwnProperty.call(m,D)&&((P=(A=Object.defineProperty)&&Object.getOwnPropertyDescriptor(m,D))&&(P.get||P.set)?A(R,D,P):R[D]=m[D]);return R})(C,h)}function v(){return v=Object.assign?Object.assign.bind():function(C){for(var h=1;h<arguments.length;h++){var g=arguments[h];for(var f in g)({}).hasOwnProperty.call(g,f)&&(C[f]=g[f])}return C},v.apply(null,arguments)}function p(C,h,g){return(h=T(h))in C?Object.defineProperty(C,h,{value:g,enumerable:!0,configurable:!0,writable:!0}):C[h]=g,C}function T(C){var h=x(C,"string");return typeof h=="symbol"?h:h+""}function x(C,h){if(typeof C!="object"||!C)return C;var g=C[Symbol.toPrimitive];if(g!==void 0){var f=g.call(C,h);if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(h==="string"?String:Number)(C)}class y extends t.Component{static getDerivedStateFromProps(h,g){let{position:f}=h,{prevPropsPosition:m}=g;return f&&(!m||f.x!==m.x||f.y!==m.y)?((0,d.default)("Draggable: getDerivedStateFromProps %j",{position:f,prevPropsPosition:m}),{x:f.x,y:f.y,prevPropsPosition:{...f}}):null}constructor(h){super(h),p(this,"onDragStart",(g,f)=>{if((0,d.default)("Draggable: onDragStart: %j",f),this.props.onStart(g,(0,a.createDraggableData)(this,f))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),p(this,"onDrag",(g,f)=>{if(!this.state.dragging)return!1;(0,d.default)("Draggable: onDrag: %j",f);const m=(0,a.createDraggableData)(this,f),S={x:m.x,y:m.y,slackX:0,slackY:0};if(this.props.bounds){const{x:P,y:R}=S;S.x+=this.state.slackX,S.y+=this.state.slackY;const[D,L]=(0,a.getBoundPosition)(this,S.x,S.y);S.x=D,S.y=L,S.slackX=this.state.slackX+(P-S.x),S.slackY=this.state.slackY+(R-S.y),m.x=S.x,m.y=S.y,m.deltaX=S.x-this.state.x,m.deltaY=S.y-this.state.y}if(this.props.onDrag(g,m)===!1)return!1;this.setState(S)}),p(this,"onDragStop",(g,f)=>{if(!this.state.dragging||this.props.onStop(g,(0,a.createDraggableData)(this,f))===!1)return!1;(0,d.default)("Draggable: onDragStop: %j",f);const S={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:P,y:R}=this.props.position;S.x=P,S.y=R}this.setState(S)}),this.state={dragging:!1,dragged:!1,x:h.position?h.position.x:h.defaultPosition.x,y:h.position?h.position.y:h.defaultPosition.y,prevPropsPosition:{...h.position},slackX:0,slackY:0,isElementSVG:!1},h.position&&!(h.onDrag||h.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){return this.props?.nodeRef?.current??r.default.findDOMNode(this)}render(){const{axis:h,bounds:g,children:f,defaultPosition:m,defaultClassName:S,defaultClassNameDragging:A,defaultClassNameDragged:P,position:R,positionOffset:D,scale:L,...j}=this.props;let b={},O=null;const X=!!!R||this.state.dragging,Z=R||m,$={x:(0,a.canDragX)(this)&&X?this.state.x:Z.x,y:(0,a.canDragY)(this)&&X?this.state.y:Z.y};this.state.isElementSVG?O=(0,i.createSVGTransform)($,D):b=(0,i.createCSSTransform)($,D);const rt=(0,n.clsx)(f.props.className||"",S,{[A]:this.state.dragging,[P]:this.state.dragged});return t.createElement(u.default,v({},j,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(f),{className:rt,style:{...f.props.style,...b},transform:O}))}}o.default=y,p(y,"displayName","Draggable"),p(y,"propTypes",{...u.default.propTypes,axis:e.default.oneOf(["both","x","y","none"]),bounds:e.default.oneOfType([e.default.shape({left:e.default.number,right:e.default.number,top:e.default.number,bottom:e.default.number}),e.default.string,e.default.oneOf([!1])]),defaultClassName:e.default.string,defaultClassNameDragging:e.default.string,defaultClassNameDragged:e.default.string,defaultPosition:e.default.shape({x:e.default.number,y:e.default.number}),positionOffset:e.default.shape({x:e.default.oneOfType([e.default.number,e.default.string]),y:e.default.oneOfType([e.default.number,e.default.string])}),position:e.default.shape({x:e.default.number,y:e.default.number}),className:s.dontSetMe,style:s.dontSetMe,transform:s.dontSetMe}),p(y,"defaultProps",{...u.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(bn)),bn}var Ki;function Ra(){if(Ki)return Ir.exports;Ki=1;const{default:o,DraggableCore:t}=ja();return Ir.exports=o,Ir.exports.default=o,Ir.exports.DraggableCore=t,Ir.exports}var za=Ra();const dr=fr(za);var Rn={exports:{}},lr={};/** @license React v16.14.0
|
||
* react-jsx-runtime.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var $i;function Ba(){if($i)return lr;$i=1;var o=un(),t=60103;if(lr.Fragment=60107,typeof Symbol=="function"&&Symbol.for){var e=Symbol.for;t=e("react.element"),lr.Fragment=e("react.fragment")}var r=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n=Object.prototype.hasOwnProperty,i={key:!0,ref:!0,__self:!0,__source:!0};function a(s,u,d){var M,c={},v=null,p=null;d!==void 0&&(v=""+d),u.key!==void 0&&(v=""+u.key),u.ref!==void 0&&(p=u.ref);for(M in u)n.call(u,M)&&!i.hasOwnProperty(M)&&(c[M]=u[M]);if(s&&s.defaultProps)for(M in u=s.defaultProps,u)c[M]===void 0&&(c[M]=u[M]);return{$$typeof:t,type:s,key:v,ref:p,props:c,_owner:r.current}}return lr.jsx=a,lr.jsxs=a,lr}var Ji;function Ya(){return Ji||(Ji=1,Rn.exports=Ba()),Rn.exports}var Sr=Ya(),ye=function(){return ye=Object.assign||function(o){for(var t,e=1,r=arguments.length;e<r;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(o[n]=t[n])}return o},ye.apply(this,arguments)},qi={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},_i={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},kr={width:"20px",height:"20px",position:"absolute",zIndex:1},Ua={top:ye(ye({},qi),{top:"-5px"}),right:ye(ye({},_i),{left:void 0,right:"-5px"}),bottom:ye(ye({},qi),{top:void 0,bottom:"-5px"}),left:ye(ye({},_i),{left:"-5px"}),topRight:ye(ye({},kr),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:ye(ye({},kr),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:ye(ye({},kr),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:ye(ye({},kr),{left:"-10px",top:"-10px",cursor:"nw-resize"})},Wa=pt.memo(function(o){var t=o.onResizeStart,e=o.direction,r=o.children,n=o.replaceStyles,i=o.className,a=pt.useCallback(function(d){t(d,e)},[t,e]),s=pt.useCallback(function(d){t(d,e)},[t,e]),u=pt.useMemo(function(){return ye(ye({position:"absolute",userSelect:"none"},Ua[e]),n??{})},[n,e]);return Sr.jsx("div",{className:i||void 0,style:u,onMouseDown:a,onTouchStart:s,children:r})}),Fa=(function(){var o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},o(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");o(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}})(),Fe=function(){return Fe=Object.assign||function(o){for(var t,e=1,r=arguments.length;e<r;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(o[n]=t[n])}return o},Fe.apply(this,arguments)},Va={width:"auto",height:"auto"},Xr=function(o,t,e){return Math.max(Math.min(o,e),t)},ts=function(o,t,e){var r=Math.round(o/t);return r*t+e*(r-1)},cr=function(o,t){return new RegExp(o,"i").test(t)},Gr=function(o){return!!(o.touches&&o.touches.length)},ka=function(o){return!!((o.clientX||o.clientX===0)&&(o.clientY||o.clientY===0))},es=function(o,t,e){e===void 0&&(e=0);var r=t.reduce(function(i,a,s){return Math.abs(a-o)<Math.abs(t[i]-o)?s:i},0),n=Math.abs(t[r]-o);return e===0||n<e?t[r]:o},zn=function(o){return o=o.toString(),o==="auto"||o.endsWith("px")||o.endsWith("%")||o.endsWith("vh")||o.endsWith("vw")||o.endsWith("vmax")||o.endsWith("vmin")?o:"".concat(o,"px")},Hr=function(o,t,e,r){if(o&&typeof o=="string"){if(o.endsWith("px"))return Number(o.replace("px",""));if(o.endsWith("%")){var n=Number(o.replace("%",""))/100;return t*n}if(o.endsWith("vw")){var n=Number(o.replace("vw",""))/100;return e*n}if(o.endsWith("vh")){var n=Number(o.replace("vh",""))/100;return r*n}}return o},Xa=function(o,t,e,r,n,i,a){return r=Hr(r,o.width,t,e),n=Hr(n,o.height,t,e),i=Hr(i,o.width,t,e),a=Hr(a,o.height,t,e),{maxWidth:typeof r>"u"?void 0:Number(r),maxHeight:typeof n>"u"?void 0:Number(n),minWidth:typeof i>"u"?void 0:Number(i),minHeight:typeof a>"u"?void 0:Number(a)}},Ga=function(o){return Array.isArray(o)?o:[o,o]},Ha=["as","ref","style","className","grid","gridGap","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],rs="__resizable_base__",Za=(function(o){Fa(t,o);function t(e){var r,n,i,a,s=o.call(this,e)||this;return s.ratio=1,s.resizable=null,s.parentLeft=0,s.parentTop=0,s.resizableLeft=0,s.resizableRight=0,s.resizableTop=0,s.resizableBottom=0,s.targetLeft=0,s.targetTop=0,s.delta={width:0,height:0},s.appendBase=function(){if(!s.resizable||!s.window)return null;var u=s.parentNode;if(!u)return null;var d=s.window.document.createElement("div");return d.style.width="100%",d.style.height="100%",d.style.position="absolute",d.style.transform="scale(0, 0)",d.style.left="0",d.style.flex="0 0 100%",d.classList?d.classList.add(rs):d.className+=rs,u.appendChild(d),d},s.removeBase=function(u){var d=s.parentNode;d&&d.removeChild(u)},s.state={isResizing:!1,width:(n=(r=s.propsSize)===null||r===void 0?void 0:r.width)!==null&&n!==void 0?n:"auto",height:(a=(i=s.propsSize)===null||i===void 0?void 0:i.height)!==null&&a!==void 0?a:"auto",direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},s.onResizeStart=s.onResizeStart.bind(s),s.onMouseMove=s.onMouseMove.bind(s),s.onMouseUp=s.onMouseUp.bind(s),s}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||Va},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var e=0,r=0;if(this.resizable&&this.window){var n=this.resizable.offsetWidth,i=this.resizable.offsetHeight,a=this.resizable.style.position;a!=="relative"&&(this.resizable.style.position="relative"),e=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:n,r=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:i,this.resizable.style.position=a}return{width:e,height:r}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var e=this,r=this.props.size,n=function(s){var u;if(typeof e.state[s]>"u"||e.state[s]==="auto")return"auto";if(e.propsSize&&e.propsSize[s]&&(!((u=e.propsSize[s])===null||u===void 0)&&u.toString().endsWith("%"))){if(e.state[s].toString().endsWith("%"))return e.state[s].toString();var d=e.getParentSize(),M=Number(e.state[s].toString().replace("px","")),c=M/d[s]*100;return"".concat(c,"%")}return zn(e.state[s])},i=r&&typeof r.width<"u"&&!this.state.isResizing?zn(r.width):n("width"),a=r&&typeof r.height<"u"&&!this.state.isResizing?zn(r.height):n("height");return{width:i,height:a}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var e=this.appendBase();if(!e)return{width:0,height:0};var r=!1,n=this.parentNode.style.flexWrap;n!=="wrap"&&(r=!0,this.parentNode.style.flexWrap="wrap"),e.style.position="relative",e.style.minWidth="100%",e.style.minHeight="100%";var i={width:e.offsetWidth,height:e.offsetHeight};return r&&(this.parentNode.style.flexWrap=n),this.removeBase(e),i},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var e=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:e.flexBasis!=="auto"?e.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(e,r){var n=this.propsSize&&this.propsSize[r];return this.state[r]==="auto"&&this.state.original[r]===e&&(typeof n>"u"||n==="auto")?"auto":e},t.prototype.calculateNewMaxFromBoundary=function(e,r){var n=this.props.boundsByDirection,i=this.state.direction,a=n&&cr("left",i),s=n&&cr("top",i),u,d;if(this.props.bounds==="parent"){var M=this.parentNode;M&&(u=a?this.resizableRight-this.parentLeft:M.offsetWidth+(this.parentLeft-this.resizableLeft),d=s?this.resizableBottom-this.parentTop:M.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(u=a?this.resizableRight:this.window.innerWidth-this.resizableLeft,d=s?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(u=a?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),d=s?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return u&&Number.isFinite(u)&&(e=e&&e<u?e:u),d&&Number.isFinite(d)&&(r=r&&r<d?r:d),{maxWidth:e,maxHeight:r}},t.prototype.calculateNewSizeFromDirection=function(e,r){var n=this.props.scale||1,i=Ga(this.props.resizeRatio||1),a=i[0],s=i[1],u=this.state,d=u.direction,M=u.original,c=this.props,v=c.lockAspectRatio,p=c.lockAspectRatioExtraHeight,T=c.lockAspectRatioExtraWidth,x=M.width,y=M.height,C=p||0,h=T||0;return cr("right",d)&&(x=M.width+(e-M.x)*a/n,v&&(y=(x-h)/this.ratio+C)),cr("left",d)&&(x=M.width-(e-M.x)*a/n,v&&(y=(x-h)/this.ratio+C)),cr("bottom",d)&&(y=M.height+(r-M.y)*s/n,v&&(x=(y-C)*this.ratio+h)),cr("top",d)&&(y=M.height-(r-M.y)*s/n,v&&(x=(y-C)*this.ratio+h)),{newWidth:x,newHeight:y}},t.prototype.calculateNewSizeFromAspectRatio=function(e,r,n,i){var a=this.props,s=a.lockAspectRatio,u=a.lockAspectRatioExtraHeight,d=a.lockAspectRatioExtraWidth,M=typeof i.width>"u"?10:i.width,c=typeof n.width>"u"||n.width<0?e:n.width,v=typeof i.height>"u"?10:i.height,p=typeof n.height>"u"||n.height<0?r:n.height,T=u||0,x=d||0;if(s){var y=(v-T)*this.ratio+x,C=(p-T)*this.ratio+x,h=(M-x)/this.ratio+T,g=(c-x)/this.ratio+T,f=Math.max(M,y),m=Math.min(c,C),S=Math.max(v,h),A=Math.min(p,g);e=Xr(e,f,m),r=Xr(r,S,A)}else e=Xr(e,M,c),r=Xr(r,v,p);return{newWidth:e,newHeight:r}},t.prototype.setBoundingClientRect=function(){var e=1/(this.props.scale||1);if(this.props.bounds==="parent"){var r=this.parentNode;if(r){var n=r.getBoundingClientRect();this.parentLeft=n.left*e,this.parentTop=n.top*e}}if(this.props.bounds&&typeof this.props.bounds!="string"){var i=this.props.bounds.getBoundingClientRect();this.targetLeft=i.left*e,this.targetTop=i.top*e}if(this.resizable){var a=this.resizable.getBoundingClientRect(),s=a.left,u=a.top,d=a.right,M=a.bottom;this.resizableLeft=s*e,this.resizableRight=d*e,this.resizableTop=u*e,this.resizableBottom=M*e}},t.prototype.onResizeStart=function(e,r){if(!(!this.resizable||!this.window)){var n=0,i=0;if(e.nativeEvent&&ka(e.nativeEvent)?(n=e.nativeEvent.clientX,i=e.nativeEvent.clientY):e.nativeEvent&&Gr(e.nativeEvent)&&(n=e.nativeEvent.touches[0].clientX,i=e.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var a=this.props.onResizeStart(e,r,this.resizable);if(a===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var s,u=this.window.getComputedStyle(this.resizable);if(u.flexBasis!=="auto"){var d=this.parentNode;if(d){var M=this.window.getComputedStyle(d).flexDirection;this.flexDir=M.startsWith("row")?"row":"column",s=u.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var c={original:{x:n,y:i,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:Fe(Fe({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(e.target).cursor||"auto"}),direction:r,flexBasis:s};this.setState(c)}},t.prototype.onMouseMove=function(e){var r=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&Gr(e))try{e.preventDefault(),e.stopPropagation()}catch{}var n=this.props,i=n.maxWidth,a=n.maxHeight,s=n.minWidth,u=n.minHeight,d=Gr(e)?e.touches[0].clientX:e.clientX,M=Gr(e)?e.touches[0].clientY:e.clientY,c=this.state,v=c.direction,p=c.original,T=c.width,x=c.height,y=this.getParentSize(),C=Xa(y,this.window.innerWidth,this.window.innerHeight,i,a,s,u);i=C.maxWidth,a=C.maxHeight,s=C.minWidth,u=C.minHeight;var h=this.calculateNewSizeFromDirection(d,M),g=h.newHeight,f=h.newWidth,m=this.calculateNewMaxFromBoundary(i,a);this.props.snap&&this.props.snap.x&&(f=es(f,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(g=es(g,this.props.snap.y,this.props.snapGap));var S=this.calculateNewSizeFromAspectRatio(f,g,{width:m.maxWidth,height:m.maxHeight},{width:s,height:u});if(f=S.newWidth,g=S.newHeight,this.props.grid){var A=ts(f,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),P=ts(g,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),R=this.props.snapGap||0,D=R===0||Math.abs(A-f)<=R?A:f,L=R===0||Math.abs(P-g)<=R?P:g;f=D,g=L}var j={width:f-p.width,height:g-p.height};if(this.delta=j,T&&typeof T=="string"){if(T.endsWith("%")){var b=f/y.width*100;f="".concat(b,"%")}else if(T.endsWith("vw")){var O=f/this.window.innerWidth*100;f="".concat(O,"vw")}else if(T.endsWith("vh")){var Y=f/this.window.innerHeight*100;f="".concat(Y,"vh")}}if(x&&typeof x=="string"){if(x.endsWith("%")){var b=g/y.height*100;g="".concat(b,"%")}else if(x.endsWith("vw")){var O=g/this.window.innerWidth*100;g="".concat(O,"vw")}else if(x.endsWith("vh")){var Y=g/this.window.innerHeight*100;g="".concat(Y,"vh")}}var X={width:this.createSizeForCssProperty(f,"width"),height:this.createSizeForCssProperty(g,"height")};this.flexDir==="row"?X.flexBasis=X.width:this.flexDir==="column"&&(X.flexBasis=X.height);var Z=this.state.width!==X.width,$=this.state.height!==X.height,rt=this.state.flexBasis!==X.flexBasis,F=Z||$||rt;F&&ei.flushSync(function(){r.setState(X)}),this.props.onResize&&F&&this.props.onResize(e,v,this.resizable,j)}},t.prototype.onMouseUp=function(e){var r,n,i=this.state,a=i.isResizing,s=i.direction;i.original,!(!a||!this.resizable)&&(this.props.onResizeStop&&this.props.onResizeStop(e,s,this.resizable,this.delta),this.props.size&&this.setState({width:(r=this.props.size.width)!==null&&r!==void 0?r:"auto",height:(n=this.props.size.height)!==null&&n!==void 0?n:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:Fe(Fe({},this.state.backgroundStyle),{cursor:"auto"})}))},t.prototype.updateSize=function(e){var r,n;this.setState({width:(r=e.width)!==null&&r!==void 0?r:"auto",height:(n=e.height)!==null&&n!==void 0?n:"auto"})},t.prototype.renderResizer=function(){var e=this,r=this.props,n=r.enable,i=r.handleStyles,a=r.handleClasses,s=r.handleWrapperStyle,u=r.handleWrapperClass,d=r.handleComponent;if(!n)return null;var M=Object.keys(n).map(function(c){return n[c]!==!1?Sr.jsx(Wa,{direction:c,onResizeStart:e.onResizeStart,replaceStyles:i&&i[c],className:a&&a[c],children:d&&d[c]?d[c]:null},c):null});return Sr.jsx("div",{className:u,style:s,children:M})},t.prototype.render=function(){var e=this,r=Object.keys(this.props).reduce(function(a,s){return Ha.indexOf(s)!==-1||(a[s]=e.props[s]),a},{}),n=Fe(Fe(Fe({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(n.flexBasis=this.state.flexBasis);var i=this.props.as||"div";return Sr.jsxs(i,Fe({style:n,className:this.props.className},r,{ref:function(a){a&&(e.resizable=a)},children:[this.state.isResizing&&Sr.jsx("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer()]}))},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],gridGap:[0,0],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t})(pt.PureComponent),Qa=Object.defineProperty,Ka=(o,t,e)=>t in o?Qa(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,it=(o,t,e)=>Ka(o,typeof t!="symbol"?t+"":t,e),Xt=(o=>(o.selector="selector",o.clicker="clicker",o.laserPointer="laserPointer",o.pencil="pencil",o.rectangle="rectangle",o.ellipse="ellipse",o.shape="shape",o.eraser="eraser",o.pencilEraser="pencilEraser",o.text="text",o.straight="straight",o.arrow="arrow",o.hand="hand",o.laserPen="laserPen",o))(Xt||{}),se=(o=>(o.Normal="Normal",o.Stroke="Stroke",o.Dotted="Dotted",o.LongDotted="LongDotted",o))(se||{}),Le=(o=>(o.Triangle="triangle",o.Rhombus="rhombus",o.Pentagram="pentagram",o.SpeechBalloon="speechBalloon",o.Star="star",o.Polygon="polygon",o))(Le||{}),jt=(o=>(o.None="None",o.ShowFloatBar="ShowFloatBar",o.ZIndexFloatBar="ZIndexFloatBar",o.DeleteNode="DeleteNode",o.CopyNode="CopyNode",o.ZIndexActive="ZIndexActive",o.ZIndexNode="ZIndexNode",o.RotateNode="RotateNode",o.SetColorNode="SetColorNode",o.TranslateNode="TranslateNode",o.ScaleNode="ScaleNode",o.OriginalEvent="OriginalEvent",o.CreateScene="CreateScene",o.ActiveCursor="ActiveCursor",o.MoveCursor="MoveCursor",o.CommandEditor="CommandEditor",o.SetEditorData="SetEditorData",o.SetFontStyle="SetFontStyle",o.SetPoint="SetPoint",o.SetLock="SetLock",o.SetShapeOpt="SetShapeOpt",o.CameraChange="CameraChange",o.ActiveMethod="ActiveMethod",o.HidFloatBarBtn="HidFloatBarBtn",o))(jt||{}),Vt=(o=>(o.DisplayState="DisplayState",o.MainEngine="MainEngine",o.Cursor="Cursor",o.BindMainView="BindMainView",o))(Vt||{}),ii=(o=>(o.longPencil="longPencil",o))(ii||{}),ht=(o=>(o[o.Pencil=1]="Pencil",o[o.Eraser=2]="Eraser",o[o.PencilEraser=3]="PencilEraser",o[o.BitMapEraser=4]="BitMapEraser",o[o.Selector=5]="Selector",o[o.Clicker=6]="Clicker",o[o.Arrow=7]="Arrow",o[o.Hand=8]="Hand",o[o.LaserPen=9]="LaserPen",o[o.Text=10]="Text",o[o.Straight=11]="Straight",o[o.Rectangle=12]="Rectangle",o[o.Ellipse=13]="Ellipse",o[o.Star=14]="Star",o[o.Triangle=15]="Triangle",o[o.Rhombus=16]="Rhombus",o[o.Polygon=17]="Polygon",o[o.SpeechBalloon=18]="SpeechBalloon",o[o.Image=19]="Image",o))(ht||{}),Ft=(o=>(o[o.Local=1]="Local",o[o.Service=2]="Service",o[o.Worker=3]="Worker",o))(Ft||{}),Et=(o=>(o[o.Pending=0]="Pending",o[o.Start=1]="Start",o[o.Doing=2]="Doing",o[o.Done=3]="Done",o[o.Unwritable=4]="Unwritable",o))(Et||{}),Rt=(o=>(o[o.None=0]="None",o[o.Init=1]="Init",o[o.UpdateCamera=2]="UpdateCamera",o[o.UpdateTools=3]="UpdateTools",o[o.CreateWork=4]="CreateWork",o[o.DrawWork=5]="DrawWork",o[o.FullWork=6]="FullWork",o[o.UpdateNode=7]="UpdateNode",o[o.RemoveNode=8]="RemoveNode",o[o.Clear=9]="Clear",o[o.Select=10]="Select",o[o.Destroy=11]="Destroy",o[o.Snapshot=12]="Snapshot",o[o.BoundingBox=13]="BoundingBox",o[o.Cursor=14]="Cursor",o[o.TextUpdate=15]="TextUpdate",o[o.GetTextActive=16]="GetTextActive",o[o.TasksQueue=17]="TasksQueue",o[o.CursorHover=18]="CursorHover",o[o.CursorBlur=19]="CursorBlur",o[o.Console=20]="Console",o[o.GetImageBitMap=23]="GetImageBitMap",o[o.AuthWriter=24]="AuthWriter",o[o.AuthReader=25]="AuthReader",o[o.AuthClear=26]="AuthClear",o[o.AuthPage=27]="AuthPage",o[o.GetVNodeInfo=28]="GetVNodeInfo",o[o.UpdateDpr=29]="UpdateDpr",o[o.SetFontFace=30]="SetFontFace",o))(Rt||{}),Ve=(o=>(o[o.None=0]="None",o[o.Bg=1]="Bg",o[o.ServiceFloat=2]="ServiceFloat",o[o.Float=3]="Float",o[o.TopFloat=4]="TopFloat",o))(Ve||{}),Nr=(o=>(o[o.Cursor=1]="Cursor",o[o.TextCreate=2]="TextCreate",o))(Nr||{}),br=(o=>(o[o.Top=1]="Top",o[o.Bottom=2]="Bottom",o))(br||{}),Ne=(o=>(o[o.none=1]="none",o[o.all=2]="all",o[o.both=3]="both",o[o.proportional=4]="proportional",o))(Ne||{}),Pr=(o=>(o[o.inside=0]="inside",o[o.outside=1]="outside",o[o.intersect=2]="intersect",o))(Pr||{}),Se=(o=>(o.renderPage="renderPage",o.addPage="addPage",o.deletePage="deletePage",o.addElement="addElement",o.deleteElement="deleteElement",o.clearPage="clearPage",o.clearViewScenePath="clearViewScenePath",o.clearView="clearView",o))(Se||{}),je=(o=>(o.setAuth="setAuth",o.setShow="addShow",o.setHide="setHide",o.setClear="setClear",o))(je||{}),Dr=(o=>(o.Image="image",o.Iconify="iconify",o))(Dr||{});const $a={linear:o=>o,easeInQuad:o=>o*o,easeOutQuad:o=>o*(2-o),easeInOutQuad:o=>o<.5?2*o*o:-1+(4-2*o)*o,easeInCubic:o=>o*o*o,easeOutCubic:o=>--o*o*o+1,easeInOutCubic:o=>o<.5?4*o*o*o:(o-1)*(2*o-2)*(2*o-2)+1,easeInQuart:o=>o*o*o*o,easeOutQuart:o=>1- --o*o*o*o,easeInOutQuart:o=>o<.5?8*o*o*o*o:1-8*--o*o*o*o,easeInQuint:o=>o*o*o*o*o,easeOutQuint:o=>1+--o*o*o*o*o,easeInOutQuint:o=>o<.5?16*o*o*o*o*o:1+16*--o*o*o*o*o,easeInSine:o=>1-Math.cos(o*Math.PI/2),easeOutSine:o=>Math.sin(o*Math.PI/2),easeInOutSine:o=>-(Math.cos(Math.PI*o)-1)/2,easeInExpo:o=>o<=0?0:Math.pow(2,10*o-10),easeOutExpo:o=>o>=1?1:1-Math.pow(2,-10*o),easeInOutExpo:o=>o<=0?0:o>=1?1:o<.5?Math.pow(2,20*o-10)/2:(2-Math.pow(2,-20*o+10))/2};class Lt{constructor(t=0,e=0,r=1){this.x=t,this.y=e,this.z=r}get XY(){return[this.x,this.y]}setz(t){return this.z=t,this}setXY(t=this.x,e=this.y){return this.x=t,this.y=e,this}set(t=this.x,e=this.y,r=this.z){return this.x=t,this.y=e,this.z=r,this}setTo({x:t=0,y:e=0,z:r=1}){return this.x=t,this.y=e,this.z=r,this}rot(t){if(t===0)return this;const{x:e,y:r}=this,n=Math.sin(t),i=Math.cos(t);return this.x=e*i-r*n,this.y=e*n+r*i,this}rotWith(t,e){if(e===0)return this;const r=this.x-t.x,n=this.y-t.y,i=Math.sin(e),a=Math.cos(e);return this.x=t.x+(r*a-n*i),this.y=t.y+(r*i+n*a),this}clone(){const{x:t,y:e,z:r}=this;return new Lt(t,e,r)}sub(t){return this.x-=t.x,this.y-=t.y,this}subXY(t,e){return this.x-=t,this.y-=e,this}subScalar(t){return this.x-=t,this.y-=t,this}add(t){return this.x+=t.x,this.y+=t.y,this}addXY(t,e){return this.x+=t,this.y+=e,this}addScalar(t){return this.x+=t,this.y+=t,this}clamp(t,e){return this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),e!==void 0&&(this.x=Math.min(this.x,e),this.y=Math.min(this.y,e)),this}div(t){return this.x/=t,this.y/=t,this}divV(t){return this.x/=t.x,this.y/=t.y,this}mul(t){return this.x*=t,this.y*=t,this}mulV(t){return this.x*=t.x,this.y*=t.y,this}abs(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this}nudge(t,e){const r=Lt.Tan(t,this);return this.add(r.mul(e))}neg(){return this.x*=-1,this.y*=-1,this}cross(t){return this.x=this.y*t.z-this.z*t.y,this.y=this.z*t.x-this.x*t.z,this}dpr(t){return Lt.Dpr(this,t)}cpr(t){return Lt.Cpr(this,t)}len2(){return Lt.Len2(this)}len(){return Lt.Len(this)}pry(t){return Lt.Pry(this,t)}per(){const{x:t,y:e}=this;return this.x=e,this.y=-t,this}uni(){return Lt.Uni(this)}tan(t){return Lt.Tan(this,t)}dist(t){return Lt.Dist(this,t)}distanceToLineSegment(t,e){return Lt.DistanceToLineSegment(t,e,this)}slope(t){return Lt.Slope(this,t)}snapToGrid(t){return this.x=Math.round(this.x/t)*t,this.y=Math.round(this.y/t)*t,this}angle(t){return Lt.Angle(this,t)}toAngle(){return Lt.ToAngle(this)}lrp(t,e){return this.x=this.x+(t.x-this.x)*e,this.y=this.y+(t.y-this.y)*e,this}equals(t,e){return Lt.Equals(this,t,e)}equalsXY(t,e){return Lt.EqualsXY(this,t,e)}norm(){const t=this.len();return this.x=t===0?0:this.x/t,this.y=t===0?0:this.y/t,this}toFixed(){return Lt.ToFixed(this)}toString(){return Lt.ToString(Lt.ToFixed(this))}toJson(){return Lt.ToJson(this)}toArray(){return Lt.ToArray(this)}static Add(t,e){return new Lt(t.x+e.x,t.y+e.y)}static AddXY(t,e,r){return new Lt(t.x+e,t.y+r)}static Sub(t,e){return new Lt(t.x-e.x,t.y-e.y)}static SubXY(t,e,r){return new Lt(t.x-e,t.y-r)}static AddScalar(t,e){return new Lt(t.x+e,t.y+e)}static SubScalar(t,e){return new Lt(t.x-e,t.y-e)}static Div(t,e){return new Lt(t.x/e,t.y/e)}static Mul(t,e){return new Lt(t.x*e,t.y*e)}static DivV(t,e){return new Lt(t.x/e.x,t.y/e.y)}static MulV(t,e){return new Lt(t.x*e.x,t.y*e.y)}static Neg(t){return new Lt(-t.x,-t.y)}static Per(t){return new Lt(t.y,-t.x)}static Dist2(t,e){return Lt.Sub(t,e).len2()}static Abs(t){return new Lt(Math.abs(t.x),Math.abs(t.y))}static Dist(t,e){return Math.hypot(t.y-e.y,t.x-e.x)}static Dpr(t,e){return t.x*e.x+t.y*e.y}static Cross(t,e){return new Lt(t.y*e.z-t.z*e.y,t.z*e.x-t.x*e.z)}static Cpr(t,e){return t.x*e.y-e.x*t.y}static Len2(t){return t.x*t.x+t.y*t.y}static Len(t){return Math.hypot(t.x,t.y)}static Pry(t,e){return Lt.Dpr(t,e)/Lt.Len(e)}static Uni(t){return Lt.Div(t,Lt.Len(t))}static Tan(t,e){return Lt.Uni(Lt.Sub(t,e))}static Min(t,e){return new Lt(Math.min(t.x,e.x),Math.min(t.y,e.y))}static Max(t,e){return new Lt(Math.max(t.x,e.x),Math.max(t.y,e.y))}static From(t){return new Lt().add(t)}static FromArray(t){return new Lt(t[0],t[1])}static Rot(t,e=0){const r=Math.sin(e),n=Math.cos(e);return new Lt(t.x*n-t.y*r,t.x*r+t.y*n)}static RotWith(t,e,r){const n=t.x-e.x,i=t.y-e.y,a=Math.sin(r),s=Math.cos(r);return new Lt(e.x+(n*s-i*a),e.y+(n*a+i*s))}static NearestPointOnLineThroughPoint(t,e,r){return Lt.Mul(e,Lt.Sub(r,t).pry(e)).add(t)}static NearestPointOnLineSegment(t,e,r,n=!0){const i=Lt.Tan(e,t),a=Lt.Add(t,Lt.Mul(i,Lt.Sub(r,t).pry(i)));if(n){if(a.x<Math.min(t.x,e.x))return Lt.Cast(t.x<e.x?t:e);if(a.x>Math.max(t.x,e.x))return Lt.Cast(t.x>e.x?t:e);if(a.y<Math.min(t.y,e.y))return Lt.Cast(t.y<e.y?t:e);if(a.y>Math.max(t.y,e.y))return Lt.Cast(t.y>e.y?t:e)}return a}static DistanceToLineThroughPoint(t,e,r){return Lt.Dist(r,Lt.NearestPointOnLineThroughPoint(t,e,r))}static DistanceToLineSegment(t,e,r,n=!0){return Lt.Dist(r,Lt.NearestPointOnLineSegment(t,e,r,n))}static Snap(t,e=1){return new Lt(Math.round(t.x/e)*e,Math.round(t.y/e)*e)}static Cast(t){return t instanceof Lt?t:Lt.From(t)}static Slope(t,e){return t.x===e.y?NaN:(t.y-e.y)/(t.x-e.x)}static Angle(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}static Lrp(t,e,r){return Lt.Sub(e,t).mul(r).add(t)}static Med(t,e){return new Lt((t.x+e.x)/2,(t.y+e.y)/2)}static Equals(t,e,r=1e-4){return Math.abs(t.x-e.x)<r&&Math.abs(t.y-e.y)<r}static EqualsXY(t,e,r){return t.x===e&&t.y===r}static EqualsXYZ(t,e,r=1e-4){return Lt.Equals(t,e,r)&&Math.abs((t.z||0)-(e.z||0))<r}static Clockwise(t,e,r){return(r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y)<0}static Rescale(t,e){const r=Lt.Len(t);return new Lt(e*t.x/r,e*t.y/r)}static ScaleWithOrigin(t,e,r){return Lt.Sub(t,r).mul(e).add(r)}static ScaleWOrigin(t,e,r){return Lt.Sub(t,r).mulV(e).add(r)}static ToFixed(t,e=2){return new Lt(+t.x.toFixed(e),+t.y.toFixed(e),+t.z.toFixed(e))}static Nudge(t,e,r){return Lt.Add(t,Lt.Tan(e,t).mul(r))}static ToString(t){return`${t.x}, ${t.y}`}static ToAngle(t){let e=Math.atan2(t.y,t.x);return e<0&&(e+=Math.PI*2),e}static FromAngle(t,e=1){return new Lt(Math.cos(t)*e,Math.sin(t)*e)}static ToArray(t){return[t.x,t.y,t.z]}static ToJson(t){const{x:e,y:r,z:n}=t;return{x:e,y:r,z:n}}static Average(t){const e=t.length,r=new Lt(0,0);for(let n=0;n<e;n++)r.add(t[n]);return r.div(e)}static Clamp(t,e,r){return r===void 0?new Lt(Math.min(Math.max(t.x,e)),Math.min(Math.max(t.y,e))):new Lt(Math.min(Math.max(t.x,e),r),Math.min(Math.max(t.y,e),r))}static PointsBetween(t,e,r=6){const n=[];for(let i=0;i<r;i++){const a=$a.easeInQuad(i/(r-1)),s=Lt.Lrp(t,e,a);s.z=Math.min(1,.5+Math.abs(.5-Ja(a))*.65),n.push(s)}return n}static SnapToGrid(t,e=8){return new Lt(Math.round(t.x/e)*e,Math.round(t.y/e)*e)}}const Ja=o=>o<.5?2*o*o:-1+(4-2*o)*o;class ue extends Lt{constructor(t=0,e=0,r=0,n={x:0,y:0},i=0,a=0){super(t,e,r),this.x=t,this.y=e,this.z=r,this.v=n,this.t=i,this.a=a}get timestamp(){return this.t}get pressure(){return this.z}get angleNum(){return this.a}get XY(){return[this.x,this.y]}setA(t){this.a=t}setT(t){this.t=t}setv(t){return this.v={x:t.x,y:t.y},this}set(t=this.x,e=this.y,r=this.z,n=this.v,i=this.t,a=this.a){return this.x=t,this.y=e,this.z=r,this.v=n,this.t=i,this.a=a,this}clone(){const{x:t,y:e,z:r,v:n,t:i,a}=this,s={x:n.x,y:n.y};return new ue(t,e,r,s,i,a)}distance(t){return ue.GetDistance(this,t)}isNear(t,e){return ue.IsNear(this,t,e)}getAngleByPoints(t,e){return ue.GetAngleByPoints(t,this,e)}static Sub(t,e){return new ue(t.x-e.x,t.y-e.y)}static Add(t,e){return new ue(t.x+e.x,t.y+e.y)}static GetDistance(t,e){return ue.Len(t.clone().sub(e))}static GetAngleByPoints(t,e,r){const n=e.x-t.x,i=r.x-e.x,a=e.y-t.y,s=r.y-e.y;let u=0;const d=Math.sqrt(n*n+a*a),M=Math.sqrt(i*i+s*s);if(d&&M){const c=n*i+a*s;u=Math.acos(c/(d*M)),u=u/Math.PI*180;let v=n*s-a*i;v=v>0?1:-1,u=180+v*u}return u}static IsNear(t,e,r){return ue.Len(t.clone().sub(e))<r}static RotWith(t,e,r,n=2){const i=t.x-e.x,a=t.y-e.y,s=Math.sin(r),u=Math.cos(r),d=Math.pow(10,n),M=Math.floor((e.x+(i*u-a*s))*d)/d,c=Math.floor((e.y+(i*s+a*u))*d)/d;return new ue(M,c)}static GetDotStroke(t,e,r=16){const n=new Lt(1,1),i=Math.PI+.001,a=ue.Add(t,ue.Sub(t,n).uni().per().mul(-e)),s=[];for(let u=1/r,d=u;d<=1;d+=u)s.push(ue.RotWith(a,t,i*2*d));return s}static GetSemicircleStroke(t,e,r=-1,n=8){const i=r*(Math.PI+.001),a=[];for(let s=1/n,u=s;u<=1;u+=s)a.push(ue.RotWith(e,t,i*u));return a}}var Zr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function si(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var qa=typeof Zr=="object"&&Zr&&Zr.Object===Object&&Zr,Js=qa,_a=Js,tl=typeof self=="object"&&self&&self.Object===Object&&self,el=_a||tl||Function("return this")(),ze=el,rl=ze,nl=rl.Symbol,Or=nl,ns=Or,qs=Object.prototype,il=qs.hasOwnProperty,sl=qs.toString,Cr=ns?ns.toStringTag:void 0;function ol(o){var t=il.call(o,Cr),e=o[Cr];try{o[Cr]=void 0;var r=!0}catch{}var n=sl.call(o);return r&&(t?o[Cr]=e:delete o[Cr]),n}var al=ol,ll=Object.prototype,cl=ll.toString;function ul(o){return cl.call(o)}var hl=ul,is=Or,fl=al,dl=hl,gl="[object Null]",pl="[object Undefined]",ss=is?is.toStringTag:void 0;function vl(o){return o==null?o===void 0?pl:gl:ss&&ss in Object(o)?fl(o):dl(o)}var Lr=vl;function ml(o){return o!=null&&typeof o=="object"}var nr=ml;function yl(){this.__data__=[],this.size=0}var Ml=yl;function Il(o,t){return o===t||o!==o&&t!==t}var oi=Il,Tl=oi;function Cl(o,t){for(var e=o.length;e--;)if(Tl(o[e][0],t))return e;return-1}var fn=Cl,xl=fn,El=Array.prototype,Sl=El.splice;function Al(o){var t=this.__data__,e=xl(t,o);if(e<0)return!1;var r=t.length-1;return e==r?t.pop():Sl.call(t,e,1),--this.size,!0}var Nl=Al,Pl=fn;function Dl(o){var t=this.__data__,e=Pl(t,o);return e<0?void 0:t[e][1]}var wl=Dl,bl=fn;function Ol(o){return bl(this.__data__,o)>-1}var Ll=Ol,jl=fn;function Rl(o,t){var e=this.__data__,r=jl(e,o);return r<0?(++this.size,e.push([o,t])):e[r][1]=t,this}var zl=Rl,Bl=Ml,Yl=Nl,Ul=wl,Wl=Ll,Fl=zl;function gr(o){var t=-1,e=o==null?0:o.length;for(this.clear();++t<e;){var r=o[t];this.set(r[0],r[1])}}gr.prototype.clear=Bl;gr.prototype.delete=Yl;gr.prototype.get=Ul;gr.prototype.has=Wl;gr.prototype.set=Fl;var dn=gr,Vl=dn;function kl(){this.__data__=new Vl,this.size=0}var Xl=kl;function Gl(o){var t=this.__data__,e=t.delete(o);return this.size=t.size,e}var Hl=Gl;function Zl(o){return this.__data__.get(o)}var Ql=Zl;function Kl(o){return this.__data__.has(o)}var $l=Kl;function Jl(o){var t=typeof o;return o!=null&&(t=="object"||t=="function")}var qe=Jl,ql=Lr,_l=qe,tc="[object AsyncFunction]",ec="[object Function]",rc="[object GeneratorFunction]",nc="[object Proxy]";function ic(o){if(!_l(o))return!1;var t=ql(o);return t==ec||t==rc||t==tc||t==nc}var _s=ic,sc=ze,oc=sc["__core-js_shared__"],ac=oc,Bn=ac,os=(function(){var o=/[^.]+$/.exec(Bn&&Bn.keys&&Bn.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""})();function lc(o){return!!os&&os in o}var cc=lc,uc=Function.prototype,hc=uc.toString;function fc(o){if(o!=null){try{return hc.call(o)}catch{}try{return o+""}catch{}}return""}var to=fc,dc=_s,gc=cc,pc=qe,vc=to,mc=/[\\^$.*+?()[\]{}|]/g,yc=/^\[object .+?Constructor\]$/,Mc=Function.prototype,Ic=Object.prototype,Tc=Mc.toString,Cc=Ic.hasOwnProperty,xc=RegExp("^"+Tc.call(Cc).replace(mc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ec(o){if(!pc(o)||gc(o))return!1;var t=dc(o)?xc:yc;return t.test(vc(o))}var Sc=Ec;function Ac(o,t){return o?.[t]}var Nc=Ac,Pc=Sc,Dc=Nc;function wc(o,t){var e=Dc(o,t);return Pc(e)?e:void 0}var ir=wc,bc=ir,Oc=ze,Lc=bc(Oc,"Map"),ai=Lc,jc=ir,Rc=jc(Object,"create"),gn=Rc,as=gn;function zc(){this.__data__=as?as(null):{},this.size=0}var Bc=zc;function Yc(o){var t=this.has(o)&&delete this.__data__[o];return this.size-=t?1:0,t}var Uc=Yc,Wc=gn,Fc="__lodash_hash_undefined__",Vc=Object.prototype,kc=Vc.hasOwnProperty;function Xc(o){var t=this.__data__;if(Wc){var e=t[o];return e===Fc?void 0:e}return kc.call(t,o)?t[o]:void 0}var Gc=Xc,Hc=gn,Zc=Object.prototype,Qc=Zc.hasOwnProperty;function Kc(o){var t=this.__data__;return Hc?t[o]!==void 0:Qc.call(t,o)}var $c=Kc,Jc=gn,qc="__lodash_hash_undefined__";function _c(o,t){var e=this.__data__;return this.size+=this.has(o)?0:1,e[o]=Jc&&t===void 0?qc:t,this}var tu=_c,eu=Bc,ru=Uc,nu=Gc,iu=$c,su=tu;function pr(o){var t=-1,e=o==null?0:o.length;for(this.clear();++t<e;){var r=o[t];this.set(r[0],r[1])}}pr.prototype.clear=eu;pr.prototype.delete=ru;pr.prototype.get=nu;pr.prototype.has=iu;pr.prototype.set=su;var ou=pr,ls=ou,au=dn,lu=ai;function cu(){this.size=0,this.__data__={hash:new ls,map:new(lu||au),string:new ls}}var uu=cu;function hu(o){var t=typeof o;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?o!=="__proto__":o===null}var fu=hu,du=fu;function gu(o,t){var e=o.__data__;return du(t)?e[typeof t=="string"?"string":"hash"]:e.map}var pn=gu,pu=pn;function vu(o){var t=pu(this,o).delete(o);return this.size-=t?1:0,t}var mu=vu,yu=pn;function Mu(o){return yu(this,o).get(o)}var Iu=Mu,Tu=pn;function Cu(o){return Tu(this,o).has(o)}var xu=Cu,Eu=pn;function Su(o,t){var e=Eu(this,o),r=e.size;return e.set(o,t),this.size+=e.size==r?0:1,this}var Au=Su,Nu=uu,Pu=mu,Du=Iu,wu=xu,bu=Au;function vr(o){var t=-1,e=o==null?0:o.length;for(this.clear();++t<e;){var r=o[t];this.set(r[0],r[1])}}vr.prototype.clear=Nu;vr.prototype.delete=Pu;vr.prototype.get=Du;vr.prototype.has=wu;vr.prototype.set=bu;var eo=vr,Ou=dn,Lu=ai,ju=eo,Ru=200;function zu(o,t){var e=this.__data__;if(e instanceof Ou){var r=e.__data__;if(!Lu||r.length<Ru-1)return r.push([o,t]),this.size=++e.size,this;e=this.__data__=new ju(r)}return e.set(o,t),this.size=e.size,this}var Bu=zu,Yu=dn,Uu=Xl,Wu=Hl,Fu=Ql,Vu=$l,ku=Bu;function mr(o){var t=this.__data__=new Yu(o);this.size=t.size}mr.prototype.clear=Uu;mr.prototype.delete=Wu;mr.prototype.get=Fu;mr.prototype.has=Vu;mr.prototype.set=ku;var Xu=mr;function Gu(o,t){for(var e=-1,r=o==null?0:o.length;++e<r&&t(o[e],e,o)!==!1;);return o}var Hu=Gu,Zu=ir,Qu=(function(){try{var o=Zu(Object,"defineProperty");return o({},"",{}),o}catch{}})(),ro=Qu,cs=ro;function Ku(o,t,e){t=="__proto__"&&cs?cs(o,t,{configurable:!0,enumerable:!0,value:e,writable:!0}):o[t]=e}var no=Ku,$u=no,Ju=oi,qu=Object.prototype,_u=qu.hasOwnProperty;function th(o,t,e){var r=o[t];(!(_u.call(o,t)&&Ju(r,e))||e===void 0&&!(t in o))&&$u(o,t,e)}var io=th,eh=io,rh=no;function nh(o,t,e,r){var n=!e;e||(e={});for(var i=-1,a=t.length;++i<a;){var s=t[i],u=r?r(e[s],o[s],s,e,o):void 0;u===void 0&&(u=o[s]),n?rh(e,s,u):eh(e,s,u)}return e}var vn=nh;function ih(o,t){for(var e=-1,r=Array(o);++e<o;)r[e]=t(e);return r}var sh=ih,oh=Lr,ah=nr,lh="[object Arguments]";function ch(o){return ah(o)&&oh(o)==lh}var uh=ch,us=uh,hh=nr,so=Object.prototype,fh=so.hasOwnProperty,dh=so.propertyIsEnumerable,gh=us((function(){return arguments})())?us:function(o){return hh(o)&&fh.call(o,"callee")&&!dh.call(o,"callee")},oo=gh,ph=Array.isArray,mn=ph,nn={exports:{}};function vh(){return!1}var mh=vh;nn.exports;(function(o,t){var e=ze,r=mh,n=t&&!t.nodeType&&t,i=n&&!0&&o&&!o.nodeType&&o,a=i&&i.exports===n,s=a?e.Buffer:void 0,u=s?s.isBuffer:void 0,d=u||r;o.exports=d})(nn,nn.exports);var ao=nn.exports,yh=9007199254740991,Mh=/^(?:0|[1-9]\d*)$/;function Ih(o,t){var e=typeof o;return t=t??yh,!!t&&(e=="number"||e!="symbol"&&Mh.test(o))&&o>-1&&o%1==0&&o<t}var Th=Ih,Ch=9007199254740991;function xh(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=Ch}var lo=xh,Eh=Lr,Sh=lo,Ah=nr,Nh="[object Arguments]",Ph="[object Array]",Dh="[object Boolean]",wh="[object Date]",bh="[object Error]",Oh="[object Function]",Lh="[object Map]",jh="[object Number]",Rh="[object Object]",zh="[object RegExp]",Bh="[object Set]",Yh="[object String]",Uh="[object WeakMap]",Wh="[object ArrayBuffer]",Fh="[object DataView]",Vh="[object Float32Array]",kh="[object Float64Array]",Xh="[object Int8Array]",Gh="[object Int16Array]",Hh="[object Int32Array]",Zh="[object Uint8Array]",Qh="[object Uint8ClampedArray]",Kh="[object Uint16Array]",$h="[object Uint32Array]",oe={};oe[Vh]=oe[kh]=oe[Xh]=oe[Gh]=oe[Hh]=oe[Zh]=oe[Qh]=oe[Kh]=oe[$h]=!0;oe[Nh]=oe[Ph]=oe[Wh]=oe[Dh]=oe[Fh]=oe[wh]=oe[bh]=oe[Oh]=oe[Lh]=oe[jh]=oe[Rh]=oe[zh]=oe[Bh]=oe[Yh]=oe[Uh]=!1;function Jh(o){return Ah(o)&&Sh(o.length)&&!!oe[Eh(o)]}var qh=Jh;function _h(o){return function(t){return o(t)}}var yn=_h,sn={exports:{}};sn.exports;(function(o,t){var e=Js,r=t&&!t.nodeType&&t,n=r&&!0&&o&&!o.nodeType&&o,i=n&&n.exports===r,a=i&&e.process,s=(function(){try{var u=n&&n.require&&n.require("util").types;return u||a&&a.binding&&a.binding("util")}catch{}})();o.exports=s})(sn,sn.exports);var li=sn.exports,tf=qh,ef=yn,hs=li,fs=hs&&hs.isTypedArray,rf=fs?ef(fs):tf,nf=rf,sf=sh,of=oo,af=mn,lf=ao,cf=Th,uf=nf,hf=Object.prototype,ff=hf.hasOwnProperty;function df(o,t){var e=af(o),r=!e&&of(o),n=!e&&!r&&lf(o),i=!e&&!r&&!n&&uf(o),a=e||r||n||i,s=a?sf(o.length,String):[],u=s.length;for(var d in o)(t||ff.call(o,d))&&!(a&&(d=="length"||n&&(d=="offset"||d=="parent")||i&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||cf(d,u)))&&s.push(d);return s}var co=df,gf=Object.prototype;function pf(o){var t=o&&o.constructor,e=typeof t=="function"&&t.prototype||gf;return o===e}var ci=pf;function vf(o,t){return function(e){return o(t(e))}}var uo=vf,mf=uo,yf=mf(Object.keys,Object),Mf=yf,If=ci,Tf=Mf,Cf=Object.prototype,xf=Cf.hasOwnProperty;function Ef(o){if(!If(o))return Tf(o);var t=[];for(var e in Object(o))xf.call(o,e)&&e!="constructor"&&t.push(e);return t}var Sf=Ef,Af=_s,Nf=lo;function Pf(o){return o!=null&&Nf(o.length)&&!Af(o)}var ui=Pf,Df=co,wf=Sf,bf=ui;function Of(o){return bf(o)?Df(o):wf(o)}var hi=Of,Lf=vn,jf=hi;function Rf(o,t){return o&&Lf(t,jf(t),o)}var zf=Rf;function Bf(o){var t=[];if(o!=null)for(var e in Object(o))t.push(e);return t}var Yf=Bf,Uf=qe,Wf=ci,Ff=Yf,Vf=Object.prototype,kf=Vf.hasOwnProperty;function Xf(o){if(!Uf(o))return Ff(o);var t=Wf(o),e=[];for(var r in o)r=="constructor"&&(t||!kf.call(o,r))||e.push(r);return e}var Gf=Xf,Hf=co,Zf=Gf,Qf=ui;function Kf(o){return Qf(o)?Hf(o,!0):Zf(o)}var fi=Kf,$f=vn,Jf=fi;function qf(o,t){return o&&$f(t,Jf(t),o)}var _f=qf,on={exports:{}};on.exports;(function(o,t){var e=ze,r=t&&!t.nodeType&&t,n=r&&!0&&o&&!o.nodeType&&o,i=n&&n.exports===r,a=i?e.Buffer:void 0,s=a?a.allocUnsafe:void 0;function u(d,M){if(M)return d.slice();var c=d.length,v=s?s(c):new d.constructor(c);return d.copy(v),v}o.exports=u})(on,on.exports);var td=on.exports;function ed(o,t){var e=-1,r=o.length;for(t||(t=Array(r));++e<r;)t[e]=o[e];return t}var rd=ed;function nd(o,t){for(var e=-1,r=o==null?0:o.length,n=0,i=[];++e<r;){var a=o[e];t(a,e,o)&&(i[n++]=a)}return i}var ho=nd;function id(){return[]}var fo=id,sd=ho,od=fo,ad=Object.prototype,ld=ad.propertyIsEnumerable,ds=Object.getOwnPropertySymbols,cd=ds?function(o){return o==null?[]:(o=Object(o),sd(ds(o),function(t){return ld.call(o,t)}))}:od,di=cd,ud=vn,hd=di;function fd(o,t){return ud(o,hd(o),t)}var dd=fd;function gd(o,t){for(var e=-1,r=t.length,n=o.length;++e<r;)o[n+e]=t[e];return o}var gi=gd,pd=uo,vd=pd(Object.getPrototypeOf,Object),go=vd,md=gi,yd=go,Md=di,Id=fo,Td=Object.getOwnPropertySymbols,Cd=Td?function(o){for(var t=[];o;)md(t,Md(o)),o=yd(o);return t}:Id,po=Cd,xd=vn,Ed=po;function Sd(o,t){return xd(o,Ed(o),t)}var Ad=Sd,Nd=gi,Pd=mn;function Dd(o,t,e){var r=t(o);return Pd(o)?r:Nd(r,e(o))}var vo=Dd,wd=vo,bd=di,Od=hi;function Ld(o){return wd(o,Od,bd)}var jd=Ld,Rd=vo,zd=po,Bd=fi;function Yd(o){return Rd(o,Bd,zd)}var Ud=Yd,Wd=ir,Fd=ze,Vd=Wd(Fd,"DataView"),kd=Vd,Xd=ir,Gd=ze,Hd=Xd(Gd,"Promise"),Zd=Hd,Qd=ir,Kd=ze,$d=Qd(Kd,"Set"),mo=$d,Jd=ir,qd=ze,_d=Jd(qd,"WeakMap"),tg=_d,Gn=kd,Hn=ai,Zn=Zd,Qn=mo,Kn=tg,yo=Lr,yr=to,gs="[object Map]",eg="[object Object]",ps="[object Promise]",vs="[object Set]",ms="[object WeakMap]",ys="[object DataView]",rg=yr(Gn),ng=yr(Hn),ig=yr(Zn),sg=yr(Qn),og=yr(Kn),rr=yo;(Gn&&rr(new Gn(new ArrayBuffer(1)))!=ys||Hn&&rr(new Hn)!=gs||Zn&&rr(Zn.resolve())!=ps||Qn&&rr(new Qn)!=vs||Kn&&rr(new Kn)!=ms)&&(rr=function(o){var t=yo(o),e=t==eg?o.constructor:void 0,r=e?yr(e):"";if(r)switch(r){case rg:return ys;case ng:return gs;case ig:return ps;case sg:return vs;case og:return ms}return t});var pi=rr,ag=Object.prototype,lg=ag.hasOwnProperty;function cg(o){var t=o.length,e=new o.constructor(t);return t&&typeof o[0]=="string"&&lg.call(o,"index")&&(e.index=o.index,e.input=o.input),e}var ug=cg,hg=ze,fg=hg.Uint8Array,Mo=fg,Ms=Mo;function dg(o){var t=new o.constructor(o.byteLength);return new Ms(t).set(new Ms(o)),t}var vi=dg,gg=vi;function pg(o,t){var e=t?gg(o.buffer):o.buffer;return new o.constructor(e,o.byteOffset,o.byteLength)}var vg=pg,mg=/\w*$/;function yg(o){var t=new o.constructor(o.source,mg.exec(o));return t.lastIndex=o.lastIndex,t}var Mg=yg,Is=Or,Ts=Is?Is.prototype:void 0,Cs=Ts?Ts.valueOf:void 0;function Ig(o){return Cs?Object(Cs.call(o)):{}}var Tg=Ig,Cg=vi;function xg(o,t){var e=t?Cg(o.buffer):o.buffer;return new o.constructor(e,o.byteOffset,o.length)}var Eg=xg,Sg=vi,Ag=vg,Ng=Mg,Pg=Tg,Dg=Eg,wg="[object Boolean]",bg="[object Date]",Og="[object Map]",Lg="[object Number]",jg="[object RegExp]",Rg="[object Set]",zg="[object String]",Bg="[object Symbol]",Yg="[object ArrayBuffer]",Ug="[object DataView]",Wg="[object Float32Array]",Fg="[object Float64Array]",Vg="[object Int8Array]",kg="[object Int16Array]",Xg="[object Int32Array]",Gg="[object Uint8Array]",Hg="[object Uint8ClampedArray]",Zg="[object Uint16Array]",Qg="[object Uint32Array]";function Kg(o,t,e){var r=o.constructor;switch(t){case Yg:return Sg(o);case wg:case bg:return new r(+o);case Ug:return Ag(o,e);case Wg:case Fg:case Vg:case kg:case Xg:case Gg:case Hg:case Zg:case Qg:return Dg(o,e);case Og:return new r;case Lg:case zg:return new r(o);case jg:return Ng(o);case Rg:return new r;case Bg:return Pg(o)}}var $g=Kg,Jg=qe,xs=Object.create,qg=(function(){function o(){}return function(t){if(!Jg(t))return{};if(xs)return xs(t);o.prototype=t;var e=new o;return o.prototype=void 0,e}})(),_g=qg,tp=_g,ep=go,rp=ci;function np(o){return typeof o.constructor=="function"&&!rp(o)?tp(ep(o)):{}}var ip=np,sp=pi,op=nr,ap="[object Map]";function lp(o){return op(o)&&sp(o)==ap}var cp=lp,up=cp,hp=yn,Es=li,Ss=Es&&Es.isMap,fp=Ss?hp(Ss):up,dp=fp,gp=pi,pp=nr,vp="[object Set]";function mp(o){return pp(o)&&gp(o)==vp}var yp=mp,Mp=yp,Ip=yn,As=li,Ns=As&&As.isSet,Tp=Ns?Ip(Ns):Mp,Io=Tp;const N1=si(Io);var Cp=Xu,xp=Hu,Ep=io,Sp=zf,Ap=_f,Np=td,Pp=rd,Dp=dd,wp=Ad,bp=jd,Op=Ud,Lp=pi,jp=ug,Rp=$g,zp=ip,Bp=mn,Yp=ao,Up=dp,Wp=qe,Fp=Io,Vp=hi,kp=fi,Xp=1,Gp=2,Hp=4,To="[object Arguments]",Zp="[object Array]",Qp="[object Boolean]",Kp="[object Date]",$p="[object Error]",Co="[object Function]",Jp="[object GeneratorFunction]",qp="[object Map]",_p="[object Number]",xo="[object Object]",tv="[object RegExp]",ev="[object Set]",rv="[object String]",nv="[object Symbol]",iv="[object WeakMap]",sv="[object ArrayBuffer]",ov="[object DataView]",av="[object Float32Array]",lv="[object Float64Array]",cv="[object Int8Array]",uv="[object Int16Array]",hv="[object Int32Array]",fv="[object Uint8Array]",dv="[object Uint8ClampedArray]",gv="[object Uint16Array]",pv="[object Uint32Array]",ie={};ie[To]=ie[Zp]=ie[sv]=ie[ov]=ie[Qp]=ie[Kp]=ie[av]=ie[lv]=ie[cv]=ie[uv]=ie[hv]=ie[qp]=ie[_p]=ie[xo]=ie[tv]=ie[ev]=ie[rv]=ie[nv]=ie[fv]=ie[dv]=ie[gv]=ie[pv]=!0;ie[$p]=ie[Co]=ie[iv]=!1;function $r(o,t,e,r,n,i){var a,s=t&Xp,u=t&Gp,d=t&Hp;if(e&&(a=n?e(o,r,n,i):e(o)),a!==void 0)return a;if(!Wp(o))return o;var M=Bp(o);if(M){if(a=jp(o),!s)return Pp(o,a)}else{var c=Lp(o),v=c==Co||c==Jp;if(Yp(o))return Np(o,s);if(c==xo||c==To||v&&!n){if(a=u||v?{}:zp(o),!s)return u?wp(o,Ap(a,o)):Dp(o,Sp(a,o))}else{if(!ie[c])return n?o:{};a=Rp(o,c,s)}}i||(i=new Cp);var p=i.get(o);if(p)return p;i.set(o,a),Fp(o)?o.forEach(function(y){a.add($r(y,t,e,y,o,i))}):Up(o)&&o.forEach(function(y,C){a.set(C,$r(y,t,e,C,o,i))});var T=d?u?Op:bp:u?kp:Vp,x=M?void 0:T(o);return xp(x||o,function(y,C){x&&(C=y,y=o[C]),Ep(a,C,$r(y,t,e,C,o,i))}),a}var vv=$r,mv=vv,yv=1,Mv=4;function Iv(o){return mv(o,yv|Mv)}var Tv=Iv;const Mn=si(Tv),Eo="1.1.22",Cv="@netless/appliance-plugin",Ps=typeof OffscreenCanvas=="function"?"worker":"mainThread";if(typeof window<"u"){let o=window.__netlessUA||"";o+=` ${Cv}@${Eo}`,window.__netlessUA=o}const me={useWorker:"auto",useSimple:!1,syncOpt:{interval:300,smoothSync:!0},cursor:{enable:!0,expirationTime:5e3,moveDelayTime:100},bufferSize:{full:2e4,sub:600},bezier:{enable:!0,maxDrawCount:1/0,combineUnitTime:300},pencilEraser:{useBitMap:!0,maxImageWidth:1920,maxImageHeight:1920,maxCombineTime:500},strokeWidth:{min:1,max:10},textEditor:{showFloatBar:!0,canSelectorSwitch:!0,rightBoundBreak:!1,extendFontFaces:[],loadFontFacesTimeout:1e4},longDottedStroke:{lineCap:"round",segment:1,gap:2},dottedStroke:{lineCap:"round",segment:1,gap:2},normalStroke:{lineCap:"round"}};function mi(o){return JSON.parse(ks.decompress(o))}function an(o){return ks.compress(JSON.stringify(o))}const xe=Object.keys,Qe="++",Wt="selector",xv="all";var Ev="__lodash_hash_undefined__";function Sv(o){return this.__data__.set(o,Ev),this}var Av=Sv;function Nv(o){return this.__data__.has(o)}var Pv=Nv,Dv=eo,wv=Av,bv=Pv;function ln(o){var t=-1,e=o==null?0:o.length;for(this.__data__=new Dv;++t<e;)this.add(o[t])}ln.prototype.add=ln.prototype.push=wv;ln.prototype.has=bv;var yi=ln;function Ov(o,t){for(var e=-1,r=o==null?0:o.length;++e<r;)if(t(o[e],e,o))return!0;return!1}var Lv=Ov;function jv(o,t){return o.has(t)}var Mi=jv,Rv=yi,zv=Lv,Bv=Mi,Yv=1,Uv=2;function Wv(o,t,e,r,n,i){var a=e&Yv,s=o.length,u=t.length;if(s!=u&&!(a&&u>s))return!1;var d=i.get(o),M=i.get(t);if(d&&M)return d==t&&M==o;var c=-1,v=!0,p=e&Uv?new Rv:void 0;for(i.set(o,t),i.set(t,o);++c<s;){var T=o[c],x=t[c];if(r)var y=a?r(x,T,c,t,o,i):r(T,x,c,o,t,i);if(y!==void 0){if(y)continue;v=!1;break}if(p){if(!zv(t,function(C,h){if(!Bv(p,h)&&(T===C||n(T,C,e,r,i)))return p.push(h)})){v=!1;break}}else if(!(T===x||n(T,x,e,r,i))){v=!1;break}}return i.delete(o),i.delete(t),v}var Fv=Wv;function Vv(o){var t=-1,e=Array(o.size);return o.forEach(function(r,n){e[++t]=[n,r]}),e}var kv=Vv;function Xv(o){var t=-1,e=Array(o.size);return o.forEach(function(r){e[++t]=r}),e}var Ii=Xv,Ds=Or,ws=Mo,Gv=oi,Hv=Fv,Zv=kv,Qv=Ii,Kv=1,$v=2,Jv="[object Boolean]",qv="[object Date]",_v="[object Error]",tm="[object Map]",em="[object Number]",rm="[object RegExp]",nm="[object Set]",im="[object String]",sm="[object Symbol]",om="[object ArrayBuffer]",am="[object DataView]",bs=Ds?Ds.prototype:void 0,Yn=bs?bs.valueOf:void 0;function lm(o,t,e,r,n,i,a){switch(e){case am:if(o.byteLength!=t.byteLength||o.byteOffset!=t.byteOffset)return!1;o=o.buffer,t=t.buffer;case om:return!(o.byteLength!=t.byteLength||!i(new ws(o),new ws(t)));case Jv:case qv:case em:return Gv(+o,+t);case _v:return o.name==t.name&&o.message==t.message;case rm:case im:return o==t+"";case tm:var s=Zv;case nm:var u=r&Kv;if(s||(s=Qv),o.size!=t.size&&!u)return!1;var d=a.get(o);if(d)return d==t;r|=$v,a.set(o,t);var M=Hv(s(o),s(t),r,n,i,a);return a.delete(o),M;case sm:if(Yn)return Yn.call(o)==Yn.call(t)}return!1}var P1=lm;function jr(o,t,e){return"#"+((o<<16)+(t<<8)+e).toString(16).padStart(6,"0")}function Ie(o,t=1){return"rgba("+parseInt("0x"+o.slice(1,3))+","+parseInt("0x"+o.slice(3,5))+","+parseInt("0x"+o.slice(5,7))+","+t+")"}function xr(o,t,e,r=1){return`rgba(${o},${t},${e},${r})`}function In(o){const t=o.split(","),e=parseInt(t[0].split("(")[1]),r=parseInt(t[1]),n=parseInt(t[2]),i=Number(t[3].split(")")[0]);return[jr(e,r,n),i]}function Qr(o){const t=o.split(","),e=parseInt(t[0].split("(")[1]),r=parseInt(t[1]),n=parseInt(t[2]),i=Number(t[3].split(")")[0]);return[e,r,n,i]}function Kr(o){return o==="transparent"}var Re=(o=>(o[o.Text=1]="Text",o[o.Shape=2]="Shape",o))(Re||{});const D1="cursorhover",So=20,ne="mainView",Ue=class Jr{createProxy(t){const e=new Proxy(t,{get(r,n,i){const a=Jr.interceptors.hasOwnProperty(n)?Jr.interceptors:r;return Reflect.get(a,n,i)}});return Jr.proxyToRaw.set(e,t),e}};it(Ue,"proxyToRaw",new WeakMap),it(Ue,"interceptors",{entries(...o){return Ue.proxyToRaw.get(this).entries(...o)},forEach(...o){return Ue.proxyToRaw.get(this).forEach(...o)},size(){return Ue.proxyToRaw.get(this).size},get(o){return Ue.proxyToRaw.get(this).get(o)},set(o,t){return Ue.proxyToRaw.get(this).set(o,t)},delete(o){return Ue.proxyToRaw.get(this).delete(o)},clear(){return Ue.proxyToRaw.get(this).clear()}});let Er=Ue;const Os=5;class cm{constructor(t){it(this,"internalMsgEmitter"),it(this,"publicMsgEmitter"),it(this,"control"),it(this,"editors"),it(this,"activeId"),it(this,"proxyMap"),it(this,"taskqueue",new Map),it(this,"checkLocalTextBlur",St.debounce(()=>{if(this.collector)for(const[d,M]of this.editors.entries())M.opt.workState!==Et.Done&&this.collector.isLocalId(d)&&this.activeId!==d&&(M.opt.text&&M.opt.text.replace(/\s*,/g,"")?this.unActive(d):this.delete(d,!0,!0))},100));const{control:e,internalMsgEmitter:r,publicMsgEmitter:n}=t;this.control=e,this.internalMsgEmitter=r,this.publicMsgEmitter=n;const i=new Map;this.proxyMap=new Er;const a=this,s=Er.interceptors.set;Er.interceptors.set=function(d,M){return a.interceptors.set(d,M),s.call(this,d,M)};const u=Er.interceptors.delete;Er.interceptors.delete=function(d){return a.interceptors.delete(d),u.call(this,d)},this.editors=this.proxyMap.createProxy(i)}get collector(){return this.control.collector}filterEditor(t){const e=new Map;return this.editors.forEach((r,n)=>{r.viewId===t&&e.set(n,r)}),e}get interceptors(){return{set:(t,e)=>{var r,n,i,a,s,u,d,M;if(!this.collector)return!0;const{viewId:c,scenePath:v,canSync:p,canWorker:T,type:x,opt:y,dataType:C,updateNodeOpt:h}=e;if(!T&&!p)return!0;const g=(r=this.collector)!=null&&r.isLocalId(t)?(n=this.collector)==null?void 0:n.transformKey(t):t,f=((i=this.collector)==null?void 0:i.storage[c])&&this.collector.storage[c][v]&&this.collector.storage[c][v][g]||void 0;f?f.toolsType===ht.Text&&(T&&(this.control.worker.queryTaskBatchData({workId:t,msgType:Rt.UpdateNode}).forEach(m=>{var S;(S=this.control.worker)==null||S.taskBatchData.delete(m)}),(d=this.control.worker)==null||d.taskBatchData.add({workId:t,msgType:Rt.UpdateNode,dataType:C||Ft.Local,toolsType:ht.Text,opt:y,viewId:c,scenePath:v,willRefresh:!0}),(M=this.control.worker)==null||M.runAnimation()),p&&(ke(()=>{var m;(m=this.collector)==null||m.dispatch({type:Rt.UpdateNode,workId:t,toolsType:ht.Text,opt:y,viewId:c,scenePath:v,updateNodeOpt:h})},this.control.worker.maxLastSyncTime,this.control.hasPolyfillMethod("requestIdleCallback")),y.workState===Et.Done&&this.control.runEffectWork(()=>{this.control.worker.setShapeSelectorByWorkId(t,c)}))):x===Re.Text&&(p&&((a=this.collector)==null||a.dispatch({type:y.text&&Rt.FullWork||Rt.CreateWork,workId:t,toolsType:ht.Text,opt:y,isSync:!0,viewId:c,scenePath:v,updateNodeOpt:h})),T&&((s=this.control.worker)==null||s.taskBatchData.add({workId:t,msgType:y.text&&Rt.FullWork||Rt.CreateWork,dataType:C||Ft.Local,toolsType:ht.Text,opt:y,viewId:c,scenePath:v,willRefresh:!0}),(u=this.control.worker)==null||u.runAnimation()))},delete:t=>{var e,r;if(!this.collector)return!0;const n=this.editors.get(t);if(!n)return!0;const{viewId:i,scenePath:a,canSync:s,canWorker:u}=n;if(!u&&!s)return!0;u&&((e=this.control.worker)==null||e.taskBatchData.add({workId:t,toolsType:ht.Text,msgType:Rt.RemoveNode,dataType:Ft.Local,viewId:i,scenePath:a,willRefresh:!0}),(r=this.control.worker)==null||r.runAnimation()),s&&ke(()=>{var d;(d=this.collector)==null||d.dispatch({type:Rt.RemoveNode,removeIds:[t],toolsType:ht.Text,viewId:i,scenePath:a})},this.control.worker.maxLastSyncTime,this.control.hasPolyfillMethod("requestIdleCallback"))},clear(){return!0}}}computeTextActive(t,e){var r,n,i,a;const s=(r=this.control.viewContainerManager)==null?void 0:r.transformToScenePoint(t,e),u=(n=this.control.viewContainerManager)==null?void 0:n.getCurScenePath(e);e&&u&&((i=this.control.worker)==null||i.taskBatchData.add({msgType:Rt.GetTextActive,dataType:Ft.Local,op:s,viewId:e,scenePath:u}),(a=this.control.worker)==null||a.runAnimation())}checkEmptyTextBlur(){var t;let e=this.activeId;for(const[r,n]of this.editors.entries())if(n.opt.uid&&n.opt.uid===((t=this.collector)==null?void 0:t.uid)){e=r;break}if(e){const r=this.editors.get(e);r?.opt.text&&r?.opt.text.replace(/\s*,/g,"")?this.unActive(e):this.delete(e,!0,!0)}this.checkLocalTextBlur()}onCameraChange(t,e){var r,n;for(const[i,a]of this.editors.entries())if(a.viewId===e){const{boxPoint:s,boxSize:u}=a.opt,d=s&&((r=this.control.viewContainerManager)==null?void 0:r.transformToOriginPoint(s,a.viewId)),M=(n=this.control.viewContainerManager)==null?void 0:n.getCurScenePath(e);if(M&&e){const c={x:d&&d[0]||0,y:d&&d[1]||0,w:u&&u[0]||0,h:u&&u[1]||0,opt:a.opt,scale:t.scale,type:Re.Text,viewId:e,scenePath:M,canWorker:!1,canSync:!1};this.editors.set(i,c),this.control.viewContainerManager.updateTextEditorInfo(e,this.activeId)}}}onServiceDerive(t){var e,r,n;const{workId:i,opt:a,msgType:s,viewId:u,scenePath:d,dataType:M,updateNodeOpt:c}=t;if(!i||!u||!d)return;const v=i.toString();if(s===Rt.RemoveNode){this.delete(v,!0,!0);return}const{boxPoint:p,boxSize:T}=a,x=p&&((e=this.control.viewContainerManager)==null?void 0:e.transformToOriginPoint(p,u)),y=this.control.viewContainerManager.getView(u),C={x:x&&x[0]||0,y:x&&x[1]||0,w:T&&T[0]||0,h:T&&T[1]||0,opt:a,type:Re.Text,canWorker:!0,canSync:!1,dataType:M,scale:((r=y?.cameraOpt)==null?void 0:r.scale)||1,viewId:u,scenePath:d};if(a&&a.workState===Et.Done&&!this.control.cursor.isEnableCursor&&p&&T){let h=c?.uid;if(!h){const g=this.editors.get(v);h=g&&((n=g.opt)==null?void 0:n.uid)}h&&this.control.cursor.collectServiceCursor({op:p&&[p[0]+T[0],p[1]+T[1]],uid:h,workState:Et.Done,viewId:u,type:Rt.Cursor})}this.editors.set(v,C),M===Ft.Service&&a.workState===Et.Done&&this.activeId===v&&(this.activeId=void 0),this.control.viewContainerManager.updateTextEditorInfo(u,this.activeId)}updateForViewEdited(t,e){var r;this.editors.set(t,e);const n=(r=this.taskqueue.get(t))==null?void 0:r.resolve;n&&n(e)}active(t){var e;const r=this.editors.get(t);r&&r.viewId&&(r.opt.workState=Et.Start,r.opt.uid=(e=this.collector)==null?void 0:e.uid,this.activeId=t,r.canWorker=!0,r.canSync=!0,this.editors.set(t,r),this.control.viewContainerManager.updateTextEditorInfo(r.viewId,this.activeId))}unActive(t){const e=this.editors.get(t);e&&e.viewId&&(e.opt.workState=Et.Done,e.opt.uid=void 0,e.canWorker=!0,e.canSync=!0,this.editors.set(t,e),this.activeId=void 0,this.control.viewContainerManager.updateTextEditorInfo(e.viewId,this.activeId))}createTextForMasterController(t,e){var r;const{workId:n,isActive:i,...a}=t;e&&this.internalMsgEmitter.emit("addUndoTicker",e,a.viewId),a.opt.uid=(r=this.collector)==null?void 0:r.uid,i&&(this.activeId=n),a.dataType=Ft.Local,a.canWorker=!0,a.canSync=!0,this.editors.set(n,a),this.control.viewContainerManager.updateTextEditorInfo(a.viewId,this.activeId)}updateTextForMasterController(t,e){var r;const{workId:n,...i}=t;e&&this.internalMsgEmitter.emit("addUndoTicker",e,i.viewId);const a=this.editors.get(n)||{};i.opt&&(i.opt.uid=(r=this.collector)==null?void 0:r.uid),i.dataType=Ft.Local,this.editors.set(n,{...a,...i}),this.control.viewContainerManager.updateTextEditorInfo(i.viewId,this.activeId)}async updateTextControllerWithEffectAsync(t,e){var r;const{workId:n,...i}=t;e&&this.internalMsgEmitter.emit("addUndoTicker",e,i.viewId);const a=this.editors.get(n)||{};i.opt&&(i.opt.uid=(r=this.collector)==null?void 0:r.uid),i.dataType=Ft.Local;const s={...a,...i};if(this.editors.set(n,s),this.control.viewContainerManager.updateTextEditorInfo(i.viewId,this.activeId),this.taskqueue.has(n)){const c=this.taskqueue.get(n);return c&&(c.clocker&&clearTimeout(c.clocker),this.taskqueue.delete(n)),await this.updateTextControllerWithEffectAsync(t)}const u=setTimeout(()=>{var c;const v=(c=this.taskqueue.get(n))==null?void 0:c.resolve;v&&v(s)},50),d=await new Promise(c=>{this.taskqueue.set(n,{resolve:c,clocker:u})}),M=this.taskqueue.get(n);return M&&(M.clocker&&clearTimeout(M.clocker),this.taskqueue.delete(n)),d}updateTextForWorker(t,e){const{workId:r,isActive:n,...i}=t,a={...this.editors.get(r)||{},...i};if(n){a.canWorker=!1,a.canSync=!1,this.editors.set(r,a),this.active(r);return}this.editors.set(r,a),this.control.viewContainerManager.updateTextEditorInfo(i.viewId,this.activeId),e&&this.internalMsgEmitter.emit("addUndoTicker",e,i.viewId)}get(t){return this.editors.get(t)}delete(t,e,r){const n=this.editors.get(t);if(n){const i=n.viewId;n.canSync=e,n.canWorker=r,this.editors.delete(t),this.activeId===t&&(this.activeId=void 0),this.control.viewContainerManager.updateTextEditorInfo(i,this.activeId)}}deleteBatch(t,e,r){const n=new Set;for(const i of t){const a=this.editors.get(i);if(a){const s=a.viewId;a.canSync=e,a.canWorker=r,this.editors.delete(i),this.activeId===i&&(this.activeId=void 0),n.add(s)}}for(const i of n)this.control.viewContainerManager.updateTextEditorInfo(i,this.activeId)}clear(t,e){this.editors.forEach((r,n)=>{r.viewId===t&&(e&&(r.canSync=!1),r.canWorker=!1,this.editors.delete(n))}),this.activeId=void 0,this.control.viewContainerManager.updateTextEditorInfo(t,this.activeId)}destory(){this.editors.clear(),this.activeId=void 0}insertText(t,e,r,n){var i,a;const s=(i=this.control.room)==null?void 0:i.state.memberState;if(!s)return;const u=this.control.viewContainerManager.getView(t);if(!(u!=null&&u.focusScenePath))return;const d=u?.cameraOpt,M=this.control.getToolsOpt(ht.Text,s);if(!M)return;const c=(a=this.control.viewContainerManager)==null?void 0:a.transformToOriginPoint([e,r],t),v=Xn(n,{whiteList:{},stripIgnoreTag:!0,stripIgnoreTagBody:["script"]}).split(/\n/),p=M.toolsOpt;p.text=an(v),p.workState=Et.Doing,p.boxPoint=[Math.round(e),Math.round(r)],p.boxSize=[p.fontSize,p.fontSize];const T=this.control.worker.now;return this.control.textEditorManager.checkEmptyTextBlur(),this.control.textEditorManager.createTextForMasterController({workId:T.toString(),x:c&&c[0]||0,y:c&&c[1]||0,scale:d?.scale||1,opt:p,type:Re.Text,isActive:!0,viewId:t,scenePath:u.focusScenePath},T),T.toString()}updateText(t,e){const r=this.editors.get(t.toString());if(!r)return;const n=Xn(e,{whiteList:{},stripIgnoreTag:!0,stripIgnoreTagBody:["script"]}).split(/\n/);r.opt.text=an(n),this.control.textEditorManager.updateTextForMasterController({workId:t,opt:r.opt,viewId:r.viewId,canSync:!0,canWorker:!0},this.control.worker.now)}}function um(o){return o}var Ao=um;function hm(o,t,e){switch(e.length){case 0:return o.call(t);case 1:return o.call(t,e[0]);case 2:return o.call(t,e[0],e[1]);case 3:return o.call(t,e[0],e[1],e[2])}return o.apply(t,e)}var fm=hm,dm=fm,Ls=Math.max;function gm(o,t,e){return t=Ls(t===void 0?o.length-1:t,0),function(){for(var r=arguments,n=-1,i=Ls(r.length-t,0),a=Array(i);++n<i;)a[n]=r[t+n];n=-1;for(var s=Array(t+1);++n<t;)s[n]=r[n];return s[t]=e(a),dm(o,this,s)}}var pm=gm;function vm(o){return function(){return o}}var mm=vm,ym=mm,js=ro,Mm=Ao,Im=js?function(o,t){return js(o,"toString",{configurable:!0,enumerable:!1,value:ym(t),writable:!0})}:Mm,Tm=Im,Cm=800,xm=16,Em=Date.now;function Sm(o){var t=0,e=0;return function(){var r=Em(),n=xm-(r-e);if(e=r,n>0){if(++t>=Cm)return arguments[0]}else t=0;return o.apply(void 0,arguments)}}var Am=Sm,Nm=Tm,Pm=Am,Dm=Pm(Nm),wm=Dm,bm=Ao,Om=pm,Lm=wm;function jm(o,t){return Lm(Om(o,t,bm),o+"")}var Rm=jm;function zm(o,t,e,r){for(var n=o.length,i=e+(r?1:-1);r?i--:++i<n;)if(t(o[i],i,o))return i;return-1}var Bm=zm;function Ym(o){return o!==o}var Um=Ym;function Wm(o,t,e){for(var r=e-1,n=o.length;++r<n;)if(o[r]===t)return r;return-1}var Fm=Wm,Vm=Bm,km=Um,Xm=Fm;function Gm(o,t,e){return t===t?Xm(o,t,e):Vm(o,km,e)}var Hm=Gm,Zm=Hm;function Qm(o,t){var e=o==null?0:o.length;return!!e&&Zm(o,t,0)>-1}var No=Qm;function Km(o,t,e){for(var r=-1,n=o==null?0:o.length;++r<n;)if(e(t,o[r]))return!0;return!1}var Po=Km;function $m(o,t){for(var e=-1,r=o==null?0:o.length,n=Array(r);++e<r;)n[e]=t(o[e],e,o);return n}var Jm=$m,qm=yi,_m=No,t0=Po,e0=Jm,r0=yn,n0=Mi,i0=200;function s0(o,t,e,r){var n=-1,i=_m,a=!0,s=o.length,u=[],d=t.length;if(!s)return u;e&&(t=e0(t,r0(e))),r?(i=t0,a=!1):t.length>=i0&&(i=n0,a=!1,t=new qm(t));t:for(;++n<s;){var M=o[n],c=e==null?M:e(M);if(M=r||M!==0?M:0,a&&c===c){for(var v=d;v--;)if(t[v]===c)continue t;u.push(M)}else i(t,c,r)||u.push(M)}return u}var o0=s0,Rs=Or,a0=oo,l0=mn,zs=Rs?Rs.isConcatSpreadable:void 0;function c0(o){return l0(o)||a0(o)||!!(zs&&o&&o[zs])}var u0=c0,h0=gi,f0=u0;function Do(o,t,e,r,n){var i=-1,a=o.length;for(e||(e=f0),n||(n=[]);++i<a;){var s=o[i];t>0&&e(s)?t>1?Do(s,t-1,e,r,n):h0(n,s):r||(n[n.length]=s)}return n}var d0=Do;function g0(){}var p0=g0,Un=mo,v0=p0,m0=Ii,y0=1/0,M0=Un&&1/m0(new Un([,-0]))[1]==y0?function(o){return new Un(o)}:v0,I0=M0,T0=yi,C0=No,x0=Po,E0=Mi,S0=I0,A0=Ii,N0=200;function P0(o,t,e){var r=-1,n=C0,i=o.length,a=!0,s=[],u=s;if(e)a=!1,n=x0;else if(i>=N0){var d=t?null:S0(o);if(d)return A0(d);a=!1,n=E0,u=new T0}else u=t?[]:s;t:for(;++r<i;){var M=o[r],c=t?t(M):M;if(M=e||M!==0?M:0,a&&c===c){for(var v=u.length;v--;)if(u[v]===c)continue t;t&&u.push(c),s.push(M)}else n(u,c,e)||(u!==s&&u.push(c),s.push(M))}return s}var D0=P0,w0=o0,b0=d0,Bs=D0;function O0(o,t,e){var r=o.length;if(r<2)return r?Bs(o[0]):[];for(var n=-1,i=Array(r);++n<r;)for(var a=o[n],s=-1;++s<r;)s!=n&&(i[n]=w0(i[n]||a,o[s],t,e));return Bs(b0(i,1),t,e)}var L0=O0,j0=ui,R0=nr;function z0(o){return R0(o)&&j0(o)}var B0=z0,Y0=ho,U0=Rm,W0=L0,F0=B0;U0(function(o){return W0(Y0(o,F0))});function w1(o,t){if(o&&t){const e=Math.min(o.x,t.x),r=Math.min(o.y,t.y),n=Math.max(o.x+o.w,t.x+t.w),i=Math.max(o.y+o.h,t.y+t.h),a=n-e,s=i-r;return{x:e,y:r,w:a,h:s}}return t||o}function Ti(o,t){if(o&&t){const e=Math.min(o.originX,t.originX),r=Math.min(o.originY,t.originY),n=Math.max(o.originX+o.width,t.originX+t.width),i=Math.max(o.originY+o.height,t.originY+t.height),a=n-e,s=i-r;return{originX:e,originY:r,width:a,height:s}}return t||o}function wo(o,t=0){const e={x:0,y:0,w:0,h:0};let r=1/0,n=1/0,i=-1/0,a=-1/0;return o.forEach(s=>{const[u,d]=s.XY;r=Math.min(r,u-t),n=Math.min(n,d-t),i=Math.max(i,u+t),a=Math.max(a,d+t)}),e.x=r,e.y=n,e.w=i-r,e.h=a-n,e}function b1(o,t){return!(o.x+o.w<t.x||o.x>t.x+t.w||o.y+o.h<t.y||o.y>t.y+t.h)}function O1(o,t=10){return{x:Math.floor(o.x-t),y:Math.floor(o.y-t),w:Math.ceil(o.w+t*2),h:Math.ceil(o.h+t*2)}}function L1(o,t){return{x:o.x+t[0],y:o.y+t[1],w:o.w,h:o.h}}function V0(o,t){const e=new Lt(o.x,o.y),r=new Lt(o.x+o.w,o.y),n=new Lt(o.x+o.w,o.y+o.h),i=new Lt(o.x,o.y+o.h),a=new Lt(o.x+o.w/2,o.y+o.h/2),s=Math.PI*t/180,u=Lt.RotWith(e,a,s),d=Lt.RotWith(r,a,s),M=Lt.RotWith(n,a,s),c=Lt.RotWith(i,a,s);return[u,d,M,c]}function j1(o,t){const e=V0(o,t);return wo(e)}function R1(o,t,e){const r=new Lt(o.x,o.y),n=new Lt(o.x+o.w,o.y),i=new Lt(o.x+o.w,o.y+o.h),a=new Lt(o.x,o.y+o.h),s=new Lt(e[0],e[1]),u=new Lt(t[0],t[1]),d=Lt.ScaleWOrigin(r,u,s),M=Lt.ScaleWOrigin(n,u,s),c=Lt.ScaleWOrigin(i,u,s),v=Lt.ScaleWOrigin(a,u,s);return wo([d,M,c,v])}function z1(o,t,e){const r=new Lt(t[0],t[1]);for(let n=0;n<o.length;n+=3){const i=new Lt(o[n],o[n+1]),a=Math.PI*e/180,s=Lt.RotWith(i,r,a);o[n]=s.x,o[n+1]=s.y}}function B1(o,t,e){const r=new Lt(t[0],t[1]);for(let n=0;n<o.length;n+=2){const i=new Lt(o[n],o[n+1]),a=Math.PI*e/180,s=Lt.RotWith(i,r,a);o[n]=s.x,o[n+1]=s.y}}function Y1(o,t,e,r=[0,0]){const n=new Lt(t[0],t[1]);for(let i=0;i<o.length;i+=3){const a=new Lt(o[i],o[i+1]),s=new Lt(e[0],e[1]),u=Lt.ScaleWOrigin(a,s,n);o[i]=u.x+r[0],o[i+1]=u.y+r[1]}}function U1(o,t,e,r=[0,0]){const n=new Lt(t[0],t[1]);for(let i=0;i<o.length;i+=2){const a=new Lt(o[i],o[i+1]),s=new Lt(e[0],e[1]),u=Lt.ScaleWOrigin(a,s,n);o[i]=u.x+r[0],o[i+1]=u.y+r[1]}}function k0(o,t){return o[0]>=t.x&&o[0]<=t.x+t.w&&o[1]>=t.y&&o[1]<=t.y+t.h}function W1(o,t){const e=o<=t?1:o/t,r=t<=o?1:t/o;return[e,r]}function F1(o){for(const t of o)if(isNaN(t)||t===1/0||t===-1/0)return!1;return!0}function V1(o){return o!==Math.floor(o)}function k1(o){const t=o.toString();return t.indexOf(".")!==-1?t.split(".")[1].length:0}function X1(o,t){for(;t!==0;)[o,t]=[t,o%t];return o}function G1(o){return`${cn(o.x)},${cn(o.y)} `}function H1(o,t){return`${cn((o.x+t.x)/2)},${cn((o.y+t.y)/2)} `}function cn(o){return+o.toFixed(4)}const ke=async(o,t,e=!1)=>{let r,n;return new Promise(function(i){if(e&&requestIdleCallback)requestIdleCallback(()=>{i(1)},{timeout:t});else{if(typeof window.requestIdleCallback=="function"){const a=typeof t=="number"&&!isNaN(t)&&t>0?t:0;n=window.requestIdleCallback(()=>{clearTimeout(r),i(1)},{timeout:a})}r=setTimeout(()=>{n&&window.cancelIdleCallback(n),i(1)},t||0)}}).then(function(){o()}).catch(function(){o()})},hr=o=>Math.max(1,(window.devicePixelRatio||1)/1),Z1=(o,t)=>o.x+o.w<t.x||o.x>t.x+t.w||o.y+o.h<t.y||o.y>t.y+t.h?Pr.outside:o.x>=t.x&&o.y>=t.y&&o.x+o.w<=t.x+t.w&&o.y+o.h<=t.y+t.h?Pr.inside:Pr.intersect;function Q1(o){let t=0;for(let e=0;e<o.length;e++){const r=o.charCodeAt(e);r>=1&&r<=126||65376<=r&&r<=65439?t++:t+=2}return t}class X0{constructor(t,e){it(this,"plugin"),it(this,"uid"),it(this,"control"),this.control=t,this.plugin=e,this.uid=e.displayer.uid}getNamespaceData(){var t;return Bt.toJS((t=this.plugin)==null?void 0:t.attributes[this.namespace])||{}}getAuthSpaceData(){var t;return Bt.toJS((t=this.plugin)==null?void 0:t.attributes[this.authSpace])||{}}getUidFromKey(t){return t.split(Qe).length===2&&t.split(Qe)[0]||this.uid}isLocalId(t){return t.split(Qe).length===1}getLocalId(t){return t.split(Qe)[1]}isSelector(t){return this.getLocalId(t)===Wt}}const qr=class Ge extends X0{constructor(t,e,r){super(t,e),it(this,"authSpace"),it(this,"namespace"),it(this,"serviceStorage",{}),it(this,"storage",{}),it(this,"authStorage",{}),it(this,"stateDisposer"),it(this,"authDisposer"),it(this,"asyncClockState",!1),it(this,"limitNums",new Map),it(this,"syncInterval"),it(this,"limitComponents",St.debounce((n,i)=>{var a,s,u,d,M,c,v,p;const T=((s=(a=this.storage)==null?void 0:a[n])==null?void 0:s[i])&&Object.keys(this.storage[n][i]).length||0;if(T===0)return;let x=this.limitNums.get(`${n}/${i}`);if(!x){const y=this.getLimitNum(T);this.limitNums.set(`${n}/${i}`,y),x=y}if(x>0&&T>=x){const y=Ge.componentsLimits.indexOf(x),C=y>=0&&y<Ge.componentsLimits.length-1;if((M=(d=(u=this.control.room)==null?void 0:u.callbacks)==null?void 0:d.listeners)!=null&&M.map.onObjectsLimit&&((v=(c=this.control.room)==null?void 0:c.callbacks)==null||v.dispatch("onObjectsLimit",g=>g(x,C))),!C){this.control.room.logger.error(`exceeds the limit of ${x} components, current: ${T}`),(p=this.control.room)==null||p.disconnect().then(()=>{var g,f,m,S,A;(m=(f=(g=this.control.room)==null?void 0:g.callbacks)==null?void 0:f.listeners)!=null&&m.map.onKickedWithReason&&((A=(S=this.control.room)==null?void 0:S.callbacks)==null||A.dispatch("onKickedWithReason",P=>P("kickByAdmin")))});return}console.warn(`exceeds the limit of ${x} components, current: ${T}`);const h=C?Ge.componentsLimits[y+1]:0;this.limitNums.set(`${n}/${i}`,h)}},2e3,{maxWait:5e3})),it(this,"clearLimitComponents",(n,i)=>{if(i)this.limitNums.delete(`${n}/${i}`);else for(const a of this.limitNums.keys())`${n}/`.indexOf(a)===0&&this.limitNums.delete(a)}),this.syncInterval=r,this.namespace=Ge.namespace,this.authSpace=Ge.authSpace,this.serviceStorage=this.getNamespaceData(),this.storage=St.cloneDeep(this.serviceStorage),this.authStorage=this.getAuthSpaceData(),this.getLimitNums()}getLimitNum(t){return t>=Ge.componentsLimits[0]?Ge.componentsLimits[1]:Ge.componentsLimits[0]}getLimitNums(){for(const[t,e]of Object.entries(this.storage))if(t&&e){for(const[r,n]of Object.entries(e))if(r&&n){const i=this.getLimitNum(Object.keys(n).length);this.limitNums.set(`${t}/${r}`,i)}}}getViewIdBySecenPath(t){const e=this.getNamespaceData();for(const[r,n]of Object.entries(e))if(n){for(const i of Object.keys(n))if(i===t)return r}}getScenePathData(t){const e=this.getNamespaceData();for(const r of Object.values(e))if(r){for(const n of Object.keys(r))if(n===t)return St.cloneDeep(r[n])}}getStorageData(t,e){const r=this.getNamespaceData();return r&&r[t]&&St.cloneDeep(r[t][e])||void 0}hasSelector(t,e){const r=this.storage&&this.storage[t]&&this.storage[t][e];return!!(r&&Object.keys(r).find(n=>this.isOwn(n)&&this.getLocalId(n)===Wt))}hasIncludeSelector(t,e,r){for(const n of Object.keys(this.storage))if(!(e&&n!==e)){for(const i of Object.keys(this.storage[n]))if(!(r&&i!==r)){for(const a of Object.keys(this.storage[n][i]))if(this.getLocalId(a)===Wt){const s=this.storage[n][i][a],u=this.isLocalId(t)?this.transformKey(t):t;if(s&&s.selectIds&&s.selectIds.length&&s.selectIds.includes(u))return!0}}}return!1}addStorageStateListener(t){this.stateDisposer=Bt.autorun(async()=>{var e,r,n,i,a,s;const u=this.getNamespaceData(),{diffView:d,diffScenePath:M,diffData:c}=this.diffFunByView(this.serviceStorage,u);this.serviceStorage=u;const v={};if(Object.keys(d).length>0)for(const[p,T]of Object.entries(d))T&&!St.isEqual((e=this.storage)==null?void 0:e[p],T.newValue)&&(v.diffView||(v.diffView={}),v.diffView[p]=T,this.storage||(this.storage={}),T.newValue===void 0?delete this.storage[p]:this.storage[p]=St.cloneDeep(T.newValue));if(Object.keys(M).length>0){for(const[p,T]of Object.entries(M))if(T){const{viewId:x,newValue:y}=T;T&&!St.isEqual((n=(r=this.storage)==null?void 0:r[x])==null?void 0:n[p],y)&&(v.diffScenePath||(v.diffScenePath={}),v.diffScenePath[p]=T,this.storage||(this.storage={}),this.storage[x]||(this.storage[x]={}),T.newValue===void 0?delete this.storage[x][p]:this.storage[x][p]=St.cloneDeep(T.newValue))}}if(Object.keys(c).length>0){for(const[p,T]of Object.entries(c))if(T){const{viewId:x,scenePath:y,newValue:C}=T;T&&!St.isEqual((s=(a=(i=this.storage)==null?void 0:i[x])==null?void 0:a[y])==null?void 0:s[p],C)&&(v.diffData||(v.diffData={}),v.diffData[p]=T,this.storage||(this.storage={}),this.storage[x]||(this.storage[x]={}),this.storage[x][y]||(this.storage[x][y]={}),T.newValue===void 0?delete this.storage[x][y][p]:this.storage[x][y][p]=St.cloneDeep(T.newValue))}}Object.keys(v).length>0&&t(v),this.control.worker.publicMsgEmitter.emit("syncStorageChange",this.serviceStorage)})}removeStorageStateListener(){this.stateDisposer&&this.stateDisposer()}diffFunByView(t,e){const r=xe(t),n=xe(e),i={},a={},s={};for(const u of n)if(!r.includes(u)||t[u]===void 0){i[u]={newValue:e[u],oldValue:void 0};continue}for(const u of r){if(St.isEqual(t[u],e[u]))continue;if(!n.includes(u)||e[u]===void 0){i[u]={newValue:void 0,oldValue:t[u]};continue}const d=this.diffFunByScenePath(t[u],e[u],u);Object.assign(a,d.diffScenePath),Object.assign(s,d.diffData)}return{diffData:s,diffScenePath:a,diffView:i}}diffFunByScenePath(t,e,r){const n=xe(t),i=xe(e),a={},s={};for(const u of i)if(!n.includes(u)||t[u]===void 0){a[u]={newValue:e[u],oldValue:void 0,viewId:r};continue}for(const u of n){if(St.isEqual(t[u],e[u]))continue;if(!i.includes(u)||e[u]===void 0){a[u]={newValue:void 0,oldValue:t[u],viewId:r};continue}const d=this.diffFunByKeys(t[u],e[u],u,r);Object.assign(s,d)}return{diffScenePath:a,diffData:s}}diffFunByKeys(t,e,r,n){const i=xe(t),a=xe(e),s={};for(const u of a)(!i.includes(u)||t[u]===void 0)&&(s[u]={oldValue:void 0,newValue:e[u],viewId:n,scenePath:r});for(const u of i)if(!St.isEqual(t[u],e[u])){if(!a.includes(u)||e[u]===void 0){s[u]={newValue:void 0,oldValue:t[u],viewId:n,scenePath:r};continue}a.includes(u)&&(s[u]={oldValue:t[u],newValue:e[u],viewId:n,scenePath:r})}return s}transformKey(t){return this.uid+Qe+t}isOwn(t){return t.split(Qe)[0]===this.uid}dispatch(t){const{type:e,workId:r,ops:n,index:i,opt:a,toolsType:s,removeIds:u,updateNodeOpt:d,op:M,selectIds:c,isSync:v,scenePath:p,viewId:T}=t;if(T)switch(e){case Rt.Clear:const x={};p&&this.storage[T]&&this.storage[T][p]?(delete this.storage[T][p],this.setState(x,{isSync:v,viewId:T,scenePath:p})):this.storage[T]&&(delete this.storage[T],this.setState(x,{isSync:v,viewId:T,scenePath:""})),ke(()=>{var f,m;this.control.isUseSimple||((f=this.control.pluginManager)==null||f.dispatchPluginEvent("syncStorage",T,p),(m=this.control.miniMapManager)==null||m.updateMiniMapCamera(T)),this.clearLimitComponents(T,p)},this.syncInterval,this.control.hasPolyfillMethod("requestIdleCallback"));break;case Rt.CreateWork:if(p&&r&&s&&a){const f=this.isLocalId(r.toString())?this.transformKey(r):r;this.control.renderControl.isUsePageAuth(T)&&this.control.renderControl.addRenderPageElementId({viewId:T,scenePath:p,elementId:f.toString()}),this.updateValue(f.toString(),{type:Rt.CreateWork,workId:r,toolsType:s,opt:a},{isSync:v,viewId:T,scenePath:p})}break;case Rt.DrawWork:if(p&&r&&typeof i=="number"&&M!=null&&M.length){const f=this.isLocalId(r.toString())?this.transformKey(r):r,m=this.storage[T]&&this.storage[T][p]&&this.storage[T][p][f]||void 0;if(m!=null&&m.ops||m?.type===Rt.FullWork)return;const S=i?(m?.op||[]).slice(0,i).concat(M):M||m?.op,A=s||m?.toolsType,P=a||m?.opt,R=d||m?.updateNodeOpt;r&&A&&P&&S&&(this.control.renderControl.isUsePageAuth(T)&&this.control.renderControl.addRenderPageElementId({viewId:T,scenePath:p,elementId:f.toString()}),this.updateValue(f.toString(),{...m,type:Rt.DrawWork,workId:r,updateNodeOpt:R,toolsType:A,opt:P,op:S,index:i},{isSync:v,viewId:T,scenePath:p}))}break;case Rt.FullWork:if(p&&r){const f=this.isLocalId(r.toString())?this.transformKey(r):r,m=this.storage[T]&&this.storage[T][p]&&this.storage[T][p][f]||void 0,S=d||m?.updateNodeOpt,A=s||m?.toolsType,P=a||m?.opt,R=n||m?.ops;A&&P&&(this.control.renderControl.isUsePageAuth(T)&&this.control.renderControl.addRenderPageElementId({viewId:T,scenePath:p,elementId:f.toString()}),this.updateValue(f.toString(),{type:Rt.FullWork,updateNodeOpt:S,workId:f,toolsType:A,opt:P,ops:R},{isSync:v,viewId:T,scenePath:p}),ke(()=>{var D,L;this.control.isUseSimple||((D=this.control.pluginManager)==null||D.dispatchPluginEvent("syncStorage",T,p),(L=this.control.miniMapManager)==null||L.updateMiniMapCamera(T)),this.limitComponents(T,p)},this.syncInterval,this.control.hasPolyfillMethod("requestIdleCallback")))}break;case Rt.RemoveNode:if(p&&u!=null&&u.length){const f=u.map(m=>this.isLocalId(m+"")?this.transformKey(m):m);this.storage[T]&&this.storage[T][p]&&(Object.keys(this.storage[T][p]).map(m=>{f!=null&&f.includes(m)&&(this.control.renderControl.isUsePageAuth(T)&&this.control.renderControl.delRenderPageElementId({viewId:T,scenePath:p,elementId:m}),this.updateValue(m,void 0,{isSync:v,viewId:T,scenePath:p}))}),this.control.isUseSimple||ke(()=>{var m,S;(m=this.control.pluginManager)==null||m.dispatchPluginEvent("syncStorage",T,p),(S=this.control.miniMapManager)==null||S.updateMiniMapCamera(T)},this.syncInterval,this.control.hasPolyfillMethod("requestIdleCallback")))}break;case Rt.UpdateNode:if(p&&r&&(d||n||a)){const f=this.isLocalId(r.toString())?this.transformKey(r):r,m=this.storage[T]&&this.storage[T][p]&&this.storage[T][p][f]||void 0;m&&(m.updateNodeOpt=d,(n||M)&&(m.ops=n,m.op=M),a&&(m.opt=a),m.type=Rt.FullWork,this.updateValue(f.toString(),m,{isSync:v,viewId:T,scenePath:p}),this.control.isUseSimple||ke(()=>{var S;(S=this.control.miniMapManager)==null||S.updateMiniMapCamera(T)},this.syncInterval,this.control.hasPolyfillMethod("requestIdleCallback")))}break;case Rt.Select:if(!p)return;let y;c!=null&&c.length&&(y=c.map(f=>this.isLocalId(f+"")?this.transformKey(f):f));const C=this.transformKey(Wt),h=this.storage[T]&&this.storage[T][p]&&this.storage[T][p][C]||void 0,g=a||h?.opt;y&&this.checkOtherSelector(C,y,{isSync:v,viewId:T,scenePath:p}),this.updateValue(C,y&&{type:Rt.Select,toolsType:ht.Selector,opt:g,selectIds:y},{isSync:v,viewId:T,scenePath:p});break}}checkOtherSelector(t,e,r){const{viewId:n,scenePath:i}=r;for(const a of Object.keys(this.storage[n][i]))if(a!==t&&this.getLocalId(a)===Wt){const s=this.storage[n][i][a];if(s&&s.selectIds){const u=s.selectIds.filter(d=>!e.includes(d));u.length>0&&(s.selectIds=u),this.updateValue(a,u.length&&s||void 0,r)}}}setState(t,e){const{viewId:r,scenePath:n}=e,i=xe(t);for(let a=0;a<i.length;a++){const s=i[a],u=t[s];typeof u<"u"?(this.storage[r]||(this.storage[r]={}),this.storage[r][n]||(this.storage[r][n]={}),this.storage[r][n][s]=u):delete this.storage[r][n][s]}this.runSyncService(e)}updateValue(t,e,r){const{viewId:n,scenePath:i,storage:a}=r,s=a||this.storage;e===void 0?delete s[n][i][t]:(s[n]||(s[n]={}),s[n][i]||(s[n][i]={}),s[n][i][t]=e),this.runSyncService(r)}runSyncService(t){if(!this.control.renderControl.isWritable){this.control.room&&this.control.room.logger?this.control.room.logger.error("The current state is not writable and synchronization cannot be synchronized"):console.error("The current state is not writable and synchronization cannot be synchronized");return}this.asyncClockState||(this.asyncClockState=!0,t.isSync?(this.asyncClockState=!1,this.syncSerivice(t)):ke(()=>{this.asyncClockState=!1,this.syncSerivice(t)},this.syncInterval,this.control.hasPolyfillMethod("requestIdleCallback")))}syncSerivice(t={storage:this.storage}){const{storage:e}=t,r=e||this.storage,n=xe(this.serviceStorage),i=xe(r),a=new Map;for(const s of n){if(!i.includes(s)){a.set(s,void 0);continue}St.isEqual(this.serviceStorage[s],r[s])||this.syncViewData(r,s)}for(const s of i)n.includes(s)||a.set(s,r[s]);if(a.size>5)this.syncStorageView(r);else for(const[s,u]of a.entries())this.syncUpdataView(r,s,u)}syncViewData(t,e){const r=xe(this.serviceStorage[e]),n=xe(t[e]),i=new Map;for(const a of r){if(!n.includes(a)){i.set(a,void 0);continue}St.isEqual(this.serviceStorage[e][a],t[e][a])||this.syncScenePathData(t,e,a)}for(const a of n)r.includes(a)||i.set(a,t[e][a]);if(i.size>5)this.syncStorageScenePath(e,t[e]);else for(const[a,s]of i.entries())this.syncUpdataScenePath(t,e,a,s)}syncScenePathData(t,e,r){const n=xe(this.serviceStorage[e][r]),i=xe(t[e][r]),a=new Map;for(const s of n){if(!i.includes(s)){a.set(s,void 0);continue}St.isEqual(this.serviceStorage[e][r][s],t[e][r][s])||a.set(s,t[e][r][s])}for(const s of i)n.includes(s)||a.set(s,t[e][r][s]);if(a.size>5)this.syncStorageKey(e,r,t[e][r]);else for(const[s,u]of a.entries())this.syncUpdataKey(t,e,r,s,u)}syncUpdataView(t,e,r){var n;Object.keys(this.serviceStorage).length?(n=this.plugin)==null||n.updateAttributes([this.namespace,e],r):this.syncStorageView(t)}syncStorageView(t){var e;(e=this.plugin)==null||e.updateAttributes([this.namespace],t)}syncUpdataScenePath(t,e,r,n){var i;Object.keys(this.serviceStorage[e]).length?(i=this.plugin)==null||i.updateAttributes([this.namespace,e,r],n):this.syncStorageScenePath(e,t[e])}syncStorageScenePath(t,e){var r;(r=this.plugin)==null||r.updateAttributes([this.namespace,t],e)}syncUpdataKey(t,e,r,n,i){var a;Object.keys(this.serviceStorage[e][r]).length?(a=this.plugin)==null||a.updateAttributes([this.namespace,e,r,n],i):this.syncStorageKey(e,r,t[e][r])}syncStorageKey(t,e,r){var n;(n=this.plugin)==null||n.updateAttributes([this.namespace,t,e],r)}keyTransformWorkId(t){const e=t.split(Qe);return e.length===2?e[1]:t}destroy(){this.removeStorageStateListener(),this.serviceStorage={},this.storage={},this.removeAuthStateListener(),this.authStorage={}}dispatchPageAuth(t,e=!0){var r,n,i,a,s,u,d,M,c,v,p,T,x,y,C,h,g,f,m,S,A,P,R,D,L,j,b,O,Y,X,Z,$,rt,F,Q,tt,lt,ct;const{operation:Mt,viewId:st,scenePath:Tt,pageId:xt,pageData:W}=t;switch(Mt){case Se.addPage:{if(!st||!Tt||!xt)return;const k=[this.authSpace];Object.keys(this.authStorage).length&&k.push("pageAuth");const q=this.authStorage.pageAuth||{};this.authStorage.pageAuth=q,Object.keys(q).length&&k.push(st),q[st]=q[st]||{},Object.keys(q[st]).length&&k.push(Tt),q[st][Tt]=q[st][Tt]||{render:W?.render||"localSelf",pages:{}},Object.keys(q[st][Tt].pages).length&&k.push("pages",xt);const _={};if(W!=null&&W.elementIds)for(const U of W.elementIds.keys())_[U]=!0;q[st][Tt].pages[xt]=_,e&&(k.length===1?(r=this.plugin)==null||r.updateAttributes(k,St.cloneDeep(this.authStorage)):k.length===2?(n=this.plugin)==null||n.updateAttributes(k,St.cloneDeep(q)):k.length===3?(i=this.plugin)==null||i.updateAttributes(k,St.cloneDeep(q[st])):k.length===4?(a=this.plugin)==null||a.updateAttributes(k,St.cloneDeep(q[st][Tt])):(s=this.plugin)==null||s.updateAttributes(k,St.cloneDeep(_)));return}case Se.renderPage:{if(!st||!Tt||!(W!=null&&W.render))return;this.authStorage.pageAuth&&this.authStorage.pageAuth[st]&&this.authStorage.pageAuth[st][Tt]&&W.render!==this.authStorage.pageAuth[st][Tt].render&&(this.authStorage.pageAuth[st][Tt].render=W.render,e&&((u=this.plugin)==null||u.updateAttributes([this.authSpace,"pageAuth",st,Tt,"render"],W.render)));return}case Se.deletePage:{if(!st||!Tt||!xt)return;(p=(v=(c=(M=(d=this.authStorage)==null?void 0:d.pageAuth)==null?void 0:M[st])==null?void 0:c[Tt])==null?void 0:v.pages)!=null&&p[xt]&&(delete this.authStorage.pageAuth[st][Tt].pages[xt],e&&((T=this.plugin)==null||T.updateAttributes([this.authSpace,"pageAuth",st,Tt,"pages",xt],void 0)));return}case Se.clearPage:{if(!st||!Tt||!xt)return;(g=(h=(C=(y=(x=this.authStorage)==null?void 0:x.pageAuth)==null?void 0:y[st])==null?void 0:C[Tt])==null?void 0:h.pages)!=null&&g[xt]&&(delete this.authStorage.pageAuth[st][Tt].pages[xt],e&&((f=this.plugin)==null||f.updateAttributes([this.authSpace,"pageAuth",st,Tt,"pages",xt],{})));return}case Se.addElement:{if(!st||!Tt||!xt||!(W!=null&&W.elementId))return;(R=(P=(A=(S=(m=this.authStorage)==null?void 0:m.pageAuth)==null?void 0:S[st])==null?void 0:A[Tt])==null?void 0:P.pages)!=null&&R[xt]&&(this.authStorage.pageAuth[st][Tt].pages[xt][W.elementId]=!0,e&&((D=this.plugin)==null||D.updateAttributes([this.authSpace,"pageAuth",st,Tt,"pages",xt,W.elementId],!0)));return}case Se.deleteElement:{if(!st||!Tt||!xt||!(W!=null&&W.elementId))return;(X=(Y=(O=(b=(j=(L=this.authStorage)==null?void 0:L.pageAuth)==null?void 0:j[st])==null?void 0:b[Tt])==null?void 0:O.pages)==null?void 0:Y[xt])!=null&&X[W.elementId]&&(delete this.authStorage.pageAuth[st][Tt].pages[xt][W.elementId],e&&((Z=this.plugin)==null||Z.updateAttributes([this.authSpace,"pageAuth",st,Tt,"pages",xt,W.elementId],void 0)));return}case Se.clearViewScenePath:{if(!st||!Tt)return;(F=(rt=($=this.authStorage)==null?void 0:$.pageAuth)==null?void 0:rt[st])!=null&&F[Tt]&&(delete this.authStorage.pageAuth[st][Tt],e&&((Q=this.plugin)==null||Q.updateAttributes([this.authSpace,"pageAuth",st,Tt],void 0)));return}case Se.clearView:{if(!st)return;(lt=(tt=this.authStorage)==null?void 0:tt.pageAuth)!=null&<[st]&&(delete this.authStorage.pageAuth[st],e&&((ct=this.plugin)==null||ct.updateAttributes([this.authSpace,"pageAuth",st],void 0)));return}}}dispatchRenderAuth(t,e=!0){var r,n,i,a,s,u,d,M,c,v,p,T,x,y,C,h,g,f,m,S;const{operation:A,viewId:P,uid:R,renderData:D,isClear:L}=t;if(P)switch(A){case je.setAuth:{if(!D||D.render===void 0&&D.hide===void 0&&D.clear===void 0){this.authStorage.renderAuth&&this.authStorage.renderAuth[P]&&(delete this.authStorage.renderAuth[P],e&&((r=this.plugin)==null||r.updateAttributes([this.authSpace,"renderAuth",P],void 0)));return}const j=[this.authSpace];Object.keys(this.authStorage).length&&j.push("renderAuth");const b=this.authStorage.renderAuth||{};Object.keys(b).length&&j.push(P),b[P]={},this.authStorage.renderAuth=b;const{render:O,hide:Y,clear:X}=D;if(O===!0)b[P].render=!0;else if(St.isSet(O)){b[P].render={};for(const Z of O.keys())b[P].render[Z]=!0}if(Y===!0)b[P].hide=!0;else if(St.isSet(Y)){b[P].hide={};for(const Z of Y.keys())b[P].hide[Z]=!0}if(X===!0)b[P].clear=!0;else if(St.isSet(X)){b[P].clear={};for(const Z of X.keys())b[P].clear[Z]=!0}e&&(j.length===1?(n=this.plugin)==null||n.updateAttributes(j,St.cloneDeep(this.authStorage)):j.length===2?(i=this.plugin)==null||i.updateAttributes(j,St.cloneDeep(b)):(a=this.plugin)==null||a.updateAttributes(j,St.cloneDeep(b[P])));return}case je.setShow:{if(!R)return;const j=[this.authSpace];Object.keys(this.authStorage).length&&j.push("renderAuth");const b=this.authStorage.renderAuth||{};Object.keys(b).length&&j.push(P),b[P]=b[P]||{},this.authStorage.renderAuth=b,Object.keys(b[P]).length&&j.push("render"),b[P].render=b[P].render||{},b[P].render!==!0&&(Object.keys(b[P].render).length&&j.push(R),b[P].render[R]=!0),b[P].hide!==!0&&(s=b[P].hide)!=null&&s[R]&&(delete b[P].hide[R],e&&((u=this.plugin)==null||u.updateAttributes([this.authSpace,"renderAuth",P,"hide",R],void 0))),e&&(j.length===1?(d=this.plugin)==null||d.updateAttributes(j,St.cloneDeep(this.authStorage)):j.length===2?(M=this.plugin)==null||M.updateAttributes(j,St.cloneDeep(b)):j.length===3?(c=this.plugin)==null||c.updateAttributes(j,St.cloneDeep(b[P])):(v=this.plugin)==null||v.updateAttributes(j,!0));return}case je.setHide:{if(!R)return;const j=[this.authSpace];Object.keys(this.authStorage).length&&j.push("renderAuth");const b=this.authStorage.renderAuth||{};Object.keys(b).length&&j.push(P),b[P]=b[P]||{},this.authStorage.renderAuth=b,Object.keys(b[P]).length&&j.push("hide"),b[P].hide=b[P].hide||{},b[P].hide!==!0&&(Object.keys(b[P].hide).length&&j.push(R),b[P].hide[R]=!0),b[P].render!==!0&&(p=b[P].render)!=null&&p[R]&&(delete b[P].render[R],e&&((T=this.plugin)==null||T.updateAttributes([this.authSpace,"renderAuth",P,"render",R],void 0))),e&&(j.length===1?(x=this.plugin)==null||x.updateAttributes(j,St.cloneDeep(this.authStorage)):j.length===2?(y=this.plugin)==null||y.updateAttributes(j,St.cloneDeep(b)):j.length===3?(C=this.plugin)==null||C.updateAttributes(j,St.cloneDeep(b[P])):(h=this.plugin)==null||h.updateAttributes(j,!0));return}case je.setClear:{if(!R)return;const j=[this.authSpace];Object.keys(this.authStorage).length&&j.push("renderAuth");const b=this.authStorage.renderAuth||{};Object.keys(b).length&&j.push(P),b[P]=b[P]||{},this.authStorage.renderAuth=b,Object.keys(b[P]).length&&j.push("clear"),b[P].clear=b[P].clear||{},b[P].clear!==!0&&(Object.keys(b[P].clear).length&&j.push(R),L?b[P].clear[R]=!0:delete b[P].clear[R]),e&&(j.length===1?(g=this.plugin)==null||g.updateAttributes(j,St.cloneDeep(this.authStorage)):j.length===2?(f=this.plugin)==null||f.updateAttributes(j,St.cloneDeep(b)):j.length===3?(m=this.plugin)==null||m.updateAttributes(j,St.cloneDeep(b[P])):(S=this.plugin)==null||S.updateAttributes(j,L?!0:void 0));return}}}addAuthStateListener(t){this.authDisposer=Bt.autorun(async()=>{const e=this.getAuthSpaceData(),{renderAuth:r,pageAuth:n}=e;let i,a;St.isEqual(r,this.authStorage.renderAuth)||(i=this.diffAuthFun(this.authStorage.renderAuth||{},r||{}),this.authStorage.renderAuth=r),St.isEqual(n,this.authStorage.pageAuth)||(a=this.diffAuthPageFun(this.authStorage.pageAuth||{},n||{}),this.authStorage.pageAuth=n),(i||a)&&t(i,a)})}removeAuthStateListener(){this.authDisposer&&this.authDisposer()}diffAuthFun(t,e){const r=xe(t),n=xe(e),i={};for(const a of n)if(!r.includes(a)||t[a]===void 0){i[a]={newValue:e[a],oldValue:void 0};continue}for(const a of r)if(!St.isEqual(t[a],e[a])){if(!n.includes(a)||e[a]===void 0){i[a]={newValue:void 0,oldValue:t[a]};continue}i[a]={newValue:e[a],oldValue:t[a]}}return i}diffAuthPageFun(t,e){const r=xe(t),n=xe(e),i={};for(const a of n)if(!r.includes(a)||t[a]===void 0){i[a]={newValue:e[a],oldValue:void 0};continue}for(const a of r)if(!St.isEqual(t[a],e[a])){if(!n.includes(a)||e[a]===void 0){i[a]={newValue:void 0,oldValue:t[a]};continue}i[a]={newValue:e[a],oldValue:t[a]}}return i}};it(qr,"namespace","PluginState"),it(qr,"authSpace","PluginAuth"),it(qr,"componentsLimits",[500,1e3]);let G0=qr;class H0{constructor(){it(this,"roomMembers",[]),it(this,"onChangeHooks",new Set)}setRoomMembers(t){this.executChangeUidHook(this.roomMembers,t),this.roomMembers=t}executChangeUidHook(t,e){const r={online:e.map(n=>{var i;return((i=n.payload)==null?void 0:i.uid)||n.session}),offline:t.map(n=>{var i;return((i=n.payload)==null?void 0:i.uid)||n.session})};this.onChangeHooks.forEach(n=>n(r))}getAllRoomMembers(){return this.roomMembers}getRoomMember(t){return this.roomMembers.find(e=>{var r;return((r=e.payload)==null?void 0:r.uid)===t})}isOnLine(t){return!!this.getRoomMember(t)}onUidChangeHook(t){this.onChangeHooks.add(t)}destroy(){this.onChangeHooks.clear()}}class Z0{constructor(t){it(this,"expirationTime",me.cursor.expirationTime),it(this,"isEnableCursor"),it(this,"internalMsgEmitter"),it(this,"publicMsgEmitter"),it(this,"control"),it(this,"eventName","applianc-cursor"),it(this,"displayer"),it(this,"roomMember"),it(this,"animationId"),it(this,"maxLastSyncTime"),it(this,"willSendEventWorkers",[]),it(this,"willConsumeEventWorkers",new Map),it(this,"sendEventTimerId"),it(this,"animationDrawWorkers",new Map),it(this,"animationEventWorkers",new Map),it(this,"cursorInfoMap",new Map),it(this,"doneRenderCursorInfoMap",new Map);const{control:e,internalMsgEmitter:r,publicMsgEmitter:n}=t;this.internalMsgEmitter=r,this.publicMsgEmitter=n,this.expirationTime=St.isNumber(e.pluginOptions.extras.cursor.expirationTime)?e.pluginOptions.extras.cursor.expirationTime:this.expirationTime,this.control=e,this.roomMember=e.roomMember,this.maxLastSyncTime=this.control.pluginOptions.extras.syncOpt.interval,this.isEnableCursor=this.control.pluginOptions.extras.cursor.enable}activeCollector(){this.control.plugin&&this.isEnableCursor&&(this.displayer=this.control.room||this.control.play,this.displayer.addMagixEventListener(this.eventName,this.mainMagixEventListener.bind(this)))}mainMagixEventListener(t){var e;const{event:r,payload:n}=t;if(r!==this.eventName)return;const{uid:i,op:a,type:s}=n;if(((e=this.control.collector)==null?void 0:e.uid)!==i&&s===Nr.Cursor&&a!=null&&a.length){const u=this.willConsumeEventWorkers.get(i)||[];for(const d of a){const{viewId:M}=d;St.isNumber(d.consumPoint[0])&&St.isNumber(d.consumPoint[1])&&(d.consumPoint=this.control.viewContainerManager.transformToOriginPoint(d.consumPoint,M)),this.control.renderControl.isFilterCursor(M)&&u.unshift({...d,timestamp:this.control.worker.now})}this.willConsumeEventWorkers.set(i,u),this.runAnimation()}}onFocusViewChange(){this.isEnableCursor&&(this.checkDrawWorks(),this.runAnimation())}updateRoomMembers(t){const{offline:e}=t;for(const r of this.cursorInfoMap.keys())r&&e.includes(r)&&this.cursorInfoMap.delete(r)}getKey(t,e){return`${t}${Qe}${e}`}getUidAndviewId(t){const[e,r]=t.split(Qe);return{uid:e,viewId:r}}runAnimation(){this.animationId||(this.animationId=requestAnimationFrame(this.animationCursor.bind(this)))}checkDrawWorks(){var t;const e=this.control.viewContainerManager.focuedViewId;for(const[r,n]of this.animationDrawWorkers.entries()){const{viewId:i,uid:a}=this.getUidAndviewId(r);a!==((t=this.control.collector)==null?void 0:t.uid)&&i!==e&&n.workState===Et.Done&&(n.consumPoint=[void 0,void 0])}}animationCursor(){this.animationId=void 0;const t=this.control.worker.now;for(const[r,n]of this.animationDrawWorkers.entries()){const{uid:i,viewId:a}=this.getUidAndviewId(r),s=this.roomMember.getRoomMember(i);if(!s){this.animationDrawWorkers.delete(r);continue}const{consumPoint:u,timestamp:d,workState:M}=n,c=this.cursorInfoMap.get(a)||new Map;u&&St.isNumber(u[0])&&St.isNumber(u[1])&&d+this.expirationTime>t?c.set(s.memberId,{x:u[0],y:u[1],roomMember:s,timestamp:d,type:1,workState:M}):c.delete(s.memberId),c.size?this.cursorInfoMap.set(a,c):this.cursorInfoMap.delete(a),this.animationDrawWorkers.delete(r)}const e=new Set;for(const[r,n]of this.cursorInfoMap.entries())if(n)for(const[i,a]of n.entries())a.type===1&&a.workState!==Et.Done&&e.add(i);else this.cursorInfoMap.delete(r);for(const[r,n]of this.willConsumeEventWorkers.entries()){const i=this.roomMember.getRoomMember(r);if(St.isNumber(i?.memberId)&&!e.has(i.memberId)){const a=n.pop();a?this.animationEventWorkers.set(r,a):this.willConsumeEventWorkers.delete(r)}}for(const[r,n]of this.animationEventWorkers.entries()){const i=this.roomMember.getRoomMember(r);if(!i){this.animationEventWorkers.delete(r);continue}const{viewId:a,consumPoint:s,timestamp:u}=n,d=this.cursorInfoMap.get(a)||new Map;s&&St.isNumber(s[0])&&St.isNumber(s[1])&&u+this.expirationTime>t?d.set(i.memberId,{x:s[0],y:s[1],roomMember:i,timestamp:u,type:0}):d.delete(i.memberId),d.size?this.cursorInfoMap.set(a,d):this.cursorInfoMap.delete(a),this.animationEventWorkers.delete(r)}for(const r of this.doneRenderCursorInfoMap.keys())this.cursorInfoMap.has(r)||(this.doneRenderCursorInfoMap.delete(r),this.internalMsgEmitter.emit([Vt.Cursor,r],[]));for(const[r,n]of this.cursorInfoMap.entries())if(n!=null&&n.size){const i=[];for(const[s,u]of n.entries()){const{timestamp:d,...M}=u;d+this.expirationTime>t?i.push(M):(n.delete(s),n.size===0&&(this.cursorInfoMap.delete(r),this.doneRenderCursorInfoMap.delete(r),this.internalMsgEmitter.emit([Vt.Cursor,r],[])))}const a=this.doneRenderCursorInfoMap.get(r);St.isEqual(a,i)||(this.doneRenderCursorInfoMap.set(r,i),this.internalMsgEmitter.emit([Vt.Cursor,r],i))}else this.cursorInfoMap.delete(r),this.doneRenderCursorInfoMap.delete(r),this.internalMsgEmitter.emit([Vt.Cursor,r],[]);(this.willConsumeEventWorkers.size||this.cursorInfoMap.size)&&this.runAnimation()}sendEvent(t,e){if(this.displayer&&Bt.isRoom(this.displayer)){const r=St.isNumber(t[0])&&St.isNumber(t[1])&&this.control.viewContainerManager.transformToScenePoint(t,e)||[void 0,void 0];this.willSendEventWorkers.push({consumPoint:r,viewId:e}),this.sendEventTimerId||(this.sendEventTimerId=setTimeout(()=>{this.dispatchMagixEvent()},this.maxLastSyncTime))}}dispatchMagixEvent(){var t;this.displayer&&Bt.isRoom(this.displayer)&&this.displayer.isWritable&&this.displayer.dispatchMagixEvent(this.eventName,{type:Nr.Cursor,op:St.cloneDeep(this.willSendEventWorkers),uid:(t=this.control.collector)==null?void 0:t.uid}),this.willSendEventWorkers.length=0,this.sendEventTimerId&&(clearTimeout(this.sendEventTimerId),this.sendEventTimerId=void 0)}collectServiceCursor(t){var e;if(!this.isEnableCursor&&!this.control.renderControl.isWritable)return;const{op:r,uid:n,workState:i,viewId:a}=t;if(n&&r&&i&&a){const s=this.roomMember.getRoomMember(n);if(!s||n===((e=this.control.collector)==null?void 0:e.uid))return;const u=this.getKey(n,a);let d=[void 0,void 0];if(St.isNumber(r[0])&&St.isNumber(r[1])){const[c,v]=this.control.viewContainerManager.transformToOriginPoint(r,a);d=[c,v]}if(i===Et.Start){for(const c of this.cursorInfoMap.values())if(c!=null&&c.size)for(const v of c.keys())v===s.memberId&&c.delete(v)}const M={consumPoint:d,workState:i,viewId:a,timestamp:this.control.worker.now};if(i===Et.Start||i===Et.Done){const c=this.willConsumeEventWorkers.get(n);i===Et.Start&&c&&this.willConsumeEventWorkers.delete(n),c&&i===Et.Done&&(M.timestamp=M.timestamp-this.expirationTime)}this.animationDrawWorkers.set(u,M),this.runAnimation()}}unabled(){var t;this.displayer&&Bt.isRoom(this.displayer)&&(this.willSendEventWorkers.length=0,this.displayer.dispatchMagixEvent(this.eventName,{type:Nr.Cursor,op:[{viewId:this.control.viewContainerManager.focuedViewId,consumPoint:[void 0,void 0]}],uid:(t=this.control.collector)==null?void 0:t.uid}),this.sendEventTimerId&&(clearTimeout(this.sendEventTimerId),this.sendEventTimerId=void 0)),this.isEnableCursor||this.stopAnimation()}clearViewCursor(t){var e,r,n;for(const[i]of this.animationDrawWorkers.entries()){const{uid:a}=this.getUidAndviewId(i);a===((e=this.control.collector)==null?void 0:e.uid)&&t===t&&this.animationDrawWorkers.delete(i)}for(const[i]of this.willConsumeEventWorkers.entries())i===((r=this.control.collector)==null?void 0:r.uid)&&this.willConsumeEventWorkers.delete(i);for(const[i]of this.animationEventWorkers.entries())i===((n=this.control.collector)==null?void 0:n.uid)&&this.animationEventWorkers.delete(i);for(const[i]of this.cursorInfoMap.entries())i===i&&(this.cursorInfoMap.delete(i),this.doneRenderCursorInfoMap.delete(i),this.internalMsgEmitter.emit([Vt.Cursor,i],[]))}stopAnimation(){this.animationDrawWorkers.clear(),this.willConsumeEventWorkers.clear(),this.cursorInfoMap.clear()}destroy(){var t;(t=this.displayer)==null||t.removeMagixEventListener(this.eventName),this.stopAnimation()}}class Oe{constructor(){it(this,"useEmtMsg"),it(this,"emtType"),it(this,"control"),it(this,"mainEngine"),it(this,"collectListener",(t,e)=>{this.collect(t,e)})}static dispatch(t,e,r){var n;(n=Te.InternalMsgEmitter)==null||n.emit([t,e],r)}get serviceColloctor(){return this.control.collector}registerForMainEngine(t,e){return this.emtType=t,this.control=e,this.mainEngine=e.worker,this.mainEngine.internalMsgEmitter.on([this.emtType,this.emitEventType],this.collectListener),this}destroy(){this.emtType&&this.mainEngine&&this.mainEngine.internalMsgEmitter.off([this.emtType,this.emitEventType],this.collectListener)}collectForLocalWorker(t,e){var r,n,i;for(const[a,s]of t)(r=this.mainEngine)==null||r.queryTaskBatchData(s).forEach(u=>{var d;(d=this.mainEngine)==null||d.taskBatchData.delete(u)}),(n=this.mainEngine)==null||n.taskBatchData.add(a);if(e){this.mainEngine.consume();return}(i=this.mainEngine)==null||i.runAnimation()}collectForServiceWorker(t){ke(()=>{t.forEach(e=>{var r;(r=this.serviceColloctor)==null||r.dispatch(e)})},this.mainEngine.maxLastSyncTime,this.control.hasPolyfillMethod("requestIdleCallback"))}pause(){var t;if(this.lastEmtData){this.useEmtMsg=!0;const e={...this.lastEmtData,workState:Et.Done};this.collect(e,!0),(t=Te.InternalMsgEmitter)==null||t.emit(jt.ActiveMethod,!1)}}recover(){var t;this.useEmtMsg&&Te.InternalMsgEmitter.hasListeners(jt.ActiveMethod)&&((t=Te.InternalMsgEmitter)==null||t.emit(jt.ActiveMethod,!0))}}class Q0 extends Oe{constructor(){super(...arguments),it(this,"lastEmtData"),it(this,"emitEventType",jt.CopyNode)}collect(t){var e;if(!this.serviceColloctor||!this.mainEngine)return;const{workIds:r,viewId:n}=t,i=this.control.viewContainerManager.getView(n);if(!(i!=null&&i.displayer))return;const a=i.focusScenePath,s=this.mainEngine.now;this.mainEngine.internalMsgEmitter.emit("addUndoTicker",s,n);for(const u of r){const d=u.toString(),M=this.serviceColloctor.isLocalId(d)?this.serviceColloctor.transformKey(u):d,c=(e=this.serviceColloctor.getStorageData(n,a))==null?void 0:e[M];if(c){if(u===Wt){const v=c&&this.copySelector({viewId:n,store:c});v&&this.pasteSelector({...v,viewId:n,scenePath:a,undoTickerId:s});break}if(c.toolsType===ht.Text&&c.opt&&c.opt.workState&&c.opt.workState!==Et.Done){const v=c&&this.copyText({viewId:n,store:c});v&&this.pasteText({...v,viewId:n,scenePath:a,key:M,store:c,undoTickerId:s});break}}}}copyText(t){const{viewId:e,store:r}=t,n=this.control.viewContainerManager.getView(e);if(!this.serviceColloctor||!n)return;const i=n?.cameraOpt,a=i&&[i.centerX,i.centerY],s=r.opt,u=s.boxPoint&&s.boxSize&&[s.boxPoint[0]+s.boxSize[0]/2,s.boxPoint[1]+s.boxSize[1]/2];return{bgCenter:a,textCenter:u}}pasteText(t){var e,r;const{bgCenter:n,textCenter:i,store:a,key:s,viewId:u,scenePath:d,undoTickerId:M}=t,c=this.control.viewContainerManager.getView(u);if(!this.serviceColloctor||!c)return;const v=Math.floor(Math.random()*30+1),p=((e=c.cameraOpt)==null?void 0:e.scale)||1,T=n&&i&&[n[0]-i[0]+v,n[1]-i[1]+v]||[v/p,v/p],x=(this.serviceColloctor.isLocalId(s)?s:this.serviceColloctor.getLocalId(s.toString()))+"-"+M;if(a.toolsType===ht.Text&&a.opt){const y=a.opt;if(y&&y.boxPoint&&y.text){y.workState=Et.Done;const C=y.boxPoint;y.boxPoint=[Math.round(C[0]+T[0]),Math.round(C[1]+T[1])],y.workState=Et.Done;const h=this.control.viewContainerManager.transformToOriginPoint(y.boxPoint,u);this.control.textEditorManager.createTextForMasterController({workId:x,x:h[0],y:h[1],opt:y,scale:((r=c.cameraOpt)==null?void 0:r.scale)||1,type:Re.Text,isActive:!1,viewId:u,scenePath:d}),this.collectForServiceWorker([{...a,opt:y,type:Rt.FullWork,workId:x,viewId:u,scenePath:d}])}}}copySelector(t){var e,r,n,i,a,s,u,d,M;const{viewId:c,store:v}=t,p=this.control.viewContainerManager.getView(c),T=v.selectIds;if(!this.serviceColloctor||!(T!=null&&T.length)||!p)return;const x=new Map,y={offset:{x:0,y:0},cameraOpt:{centerX:((e=p.cameraOpt)==null?void 0:e.centerX)||0,centerY:((r=p.cameraOpt)==null?void 0:r.centerY)||0,scale:((n=p.cameraOpt)==null?void 0:n.scale)||1}},C=this.control.hasOffscreenCanvas&&((i=p.displayer.canvasBgRef.current)==null?void 0:i.getBoundingClientRect())||((a=p.displayer.canvasContainerRef.current)==null?void 0:a.getBoundingClientRect()),h=(u=(s=p.displayer)==null?void 0:s.floatBarRef.current)==null?void 0:u.getBoundingClientRect(),g=C&&[C.x+C.width/2,C.y+C.height/2],f=h&&[h.x+h.width/2,h.y+h.height/2],m=g&&p.viewData&&p.viewData.convertToPointInWorld({x:g[0],y:g[1]}),S=f&&p.viewData&&p.viewData.convertToPointInWorld({x:f[0],y:f[1]});m&&S&&(y.offset={x:m.x-S.x,y:m.y-S.y});for(const A of T){const P=(M=(d=this.serviceColloctor)==null?void 0:d.getStorageData(p.id,p.focusScenePath))==null?void 0:M[A];P&&x.set(A,P)}return{copyStores:x,copyCoordInfo:y}}pasteSelector(t){var e,r,n,i;const{copyStores:a,copyCoordInfo:s,viewId:u,scenePath:d,undoTickerId:M}=t,c=this.control.viewContainerManager.getView(u);if(!a.size||!this.serviceColloctor||!c)return;const{offset:v,cameraOpt:p}=s,{scale:T}=p,x=Math.floor(Math.random()*30+1),y=v&&[v.x+x,v.y+x]||[x/T,x/T],C=[],h=[];for(const[g,f]of a.entries()){const m=(this.serviceColloctor.isLocalId(g)?g:this.serviceColloctor.getLocalId(g.toString()))+"-"+M,S={useAnimation:!1};if(f.toolsType===ht.Text&&f.opt){const A=f.opt;if(A&&A.boxPoint&&A.text){A.workState=Et.Done;const P=A.boxPoint;A.boxPoint=[Math.round(P[0]+y[0]),Math.round(P[1]+y[1])],A.workState=Et.Done;const R=this.control.viewContainerManager.transformToOriginPoint(A.boxPoint,u);this.control.textEditorManager.createTextForMasterController({workId:m,x:R[0],y:R[1],opt:A,scale:((e=c.cameraOpt)==null?void 0:e.scale)||1,type:Re.Text,isActive:!1,viewId:u,scenePath:d})}h.push({...f,opt:A,type:Rt.FullWork,workId:m,viewId:u,scenePath:d});continue}if(f.toolsType===ht.Image&&(f.opt.uuid=m,f.opt.centerX=f.opt.centerX+y[0],f.opt.centerY=f.opt.centerY+y[1]),f.ops){const A=mi(f.ops).map((R,D)=>{const L=D%3;return L===0?R+y[0]:L===1?R+y[1]:R}),P=an(A);f.ops=P}if((r=f?.opt)!=null&&r.eraserlines&&(n=f?.opt)!=null&&n.eraserlines.length)for(const A of(i=f?.opt)==null?void 0:i.eraserlines){const{op:P}=A;for(let R=0;R<P.length;R++){const D=P[R].map((L,j)=>j%2?L+y[1]:L+y[0]);A.op[R]=D}}h.push({...f,updateNodeOpt:S,type:Rt.FullWork,workId:m,viewId:u,scenePath:d}),C.push([{...f,updateNodeOpt:S,workId:m,msgType:Rt.FullWork,dataType:Ft.Local,emitEventType:jt.CopyNode,willSyncService:!1,willRefresh:!0,viewId:u},{workId:m,msgType:Rt.FullWork,emitEventType:jt.CopyNode}])}C.length&&this.collectForLocalWorker(C),h.length&&this.collectForServiceWorker(h)}}class K0 extends Oe{constructor(){super(...arguments),it(this,"lastEmtData"),it(this,"emitEventType",jt.SetColorNode),it(this,"undoTickerId")}setTextColor(t,e,r,n){const{fontColor:i,fontBgColor:a}=r;e.opt&&(i&&(e.opt.fontColor=i),a&&(e.opt.fontBgColor=a),this.control.textEditorManager.updateTextForMasterController({workId:t,opt:e.opt,viewId:n,canSync:!0,canWorker:!0}))}collect(t){var e,r;if(!this.serviceColloctor||!this.mainEngine)return;const{workIds:n,strokeColor:i,fillColor:a,fontColor:s,fontBgColor:u,viewId:d,workState:M,thickness:c,strokeType:v}=t,p=this.control.viewContainerManager.getView(d);if(!(p!=null&&p.displayer))return;const T=p.focusScenePath,x=[...n],y=this.serviceColloctor.storage,C=[],h={};for((M===Et.Start||!this.undoTickerId&&M===Et.Done)&&(this.undoTickerId=this.mainEngine.now,this.mainEngine.internalMsgEmitter.emit("addUndoTicker",this.undoTickerId,d));x.length;){const g=x.pop();if(!g)continue;const f=g.toString(),m=this.serviceColloctor.isLocalId(f),S=m?this.serviceColloctor.transformKey(g):f;let A=f;!m&&this.serviceColloctor.isOwn(A)&&(A=this.serviceColloctor.getLocalId(A));const P=(r=(e=y?.[d])==null?void 0:e[T])==null?void 0:r[S];if(P){const R=P.updateNodeOpt||{};if(s||u){if(s){R.fontColor=s;const[L,j,b,O]=Qr(s);h.textColor=[L,j,b],h.textOpacity=O}if(u)if(R.fontBgColor=Kr(u)?"transparent":u,Kr(u))h.textBgColor=void 0,h.textBgOpacity=void 0;else{const[L,j,b,O]=Qr(u);h.textBgColor=[L,j,b],h.textBgOpacity=O}if(P.toolsType===ht.Text&&P.opt&&M!==Et.Start){this.setTextColor(A,Mn(P),R,d),M===Et.Done&&(this.undoTickerId=void 0);continue}}if(i){R.strokeColor=i;const[L,j,b,O]=Qr(i);h.strokeColor=[L,j,b],h.strokeOpacity=O}if(a)if(R.fillColor=Kr(a)?"transparent":a,Kr(a))h.fillColor=void 0,h.fillOpacity=void 0;else{const[L,j,b,O]=Qr(a);h.fillColor=[L,j,b],h.fillOpacity=O}c&&(R.thickness=c,h.strokeWidth=c),v&&(R.strokeType=v,h.strokeType=v);const D={workId:A,msgType:Rt.UpdateNode,dataType:Ft.Local,updateNodeOpt:R,emitEventType:this.emitEventType,willRefresh:!0,willRefreshSelector:!0,willSyncService:!0,textUpdateForWoker:!0,viewId:d};C.push([D,{workId:A,msgType:Rt.UpdateNode,emitEventType:this.emitEventType}])}}C.length&&(M===Et.Done&&(this.undoTickerId=void 0),this.collectForLocalWorker(C)),Object.keys(h).length&&setTimeout(()=>{var g;(g=this.control.room)==null||g.setMemberState(h)},0)}}class $0 extends Oe{constructor(){super(...arguments),it(this,"lastEmtData"),it(this,"emitEventType",jt.ZIndexNode),it(this,"zIndexMap",new Map)}clearZIndex(t){this.zIndexMap.delete(t)}getMinZIndex(t){var e;return((e=this.zIndexMap.get(t))==null?void 0:e.min)||0}getMaxZIndex(t){var e;return((e=this.zIndexMap.get(t))==null?void 0:e.max)||0}setMaxZIndex(t,e){const r=this.getMinZIndex(e);this.zIndexMap.set(e,{min:r,max:t})}setMinZIndex(t,e){const r=this.getMaxZIndex(e);this.zIndexMap.set(e,{min:t,max:r})}addMaxLayer(t){const e=this.getMaxZIndex(t)+1;this.setMaxZIndex(e,t)}addMinLayer(t){const e=this.getMinZIndex(t)-1;this.setMinZIndex(e,t)}correct(t){const e=t.sort((r,n)=>r[1]-n[1]);for(let r=1;r<e.length;r++){const n=e[r][1],i=e[r-1][1];n<=i&&(e[r][1]=i+1)}return e}collect(t){if(!this.serviceColloctor||!this.mainEngine)return;const{workIds:e,layer:r,viewId:n}=t,i=this.control.viewContainerManager.getView(n);if(!(i!=null&&i.displayer))return;const a=i.focusScenePath,s=[...e],u=this.serviceColloctor.storage,d=[],M=[];for(;s.length;){const v=s.pop();if(!v)continue;const p=v.toString(),T=this.serviceColloctor.isLocalId(p),x=T?this.serviceColloctor.transformKey(v):p;let y=p;!T&&this.serviceColloctor.isOwn(y)&&(y=this.serviceColloctor.getLocalId(y));const C=Mn(u[n][a][x]);let h;if(C&&y===Wt){if(C.selectIds){M.push(...C.selectIds),M.sort((S,A)=>{var P,R,D,L;const j=((R=(P=u[c(S,this.serviceColloctor)])==null?void 0:P.opt)==null?void 0:R.zIndex)||0,b=((L=(D=u[c(S,this.serviceColloctor)])==null?void 0:D.opt)==null?void 0:L.zIndex)||0;return j>b?1:S<A?-1:0});const g=C.updateNodeOpt||{};g.zIndexLayer=r;const f={workId:v,msgType:Rt.UpdateNode,dataType:Ft.Local,updateNodeOpt:g,emitEventType:this.emitEventType,willRefreshSelector:!0,willSyncService:!0,viewId:n},m=new Map;r===br.Top?(this.addMaxLayer(n),h=this.getMaxZIndex(n)):(this.addMinLayer(n),h=this.getMinZIndex(n)),M.forEach(S=>{var A,P,R,D,L;const j=(A=this.serviceColloctor)==null?void 0:A.isLocalId(S);let b=j&&((P=this.serviceColloctor)==null?void 0:P.transformKey(S))||S;const O=(D=(R=u?.[n])==null?void 0:R[a])==null?void 0:D[b];O&&(!j&&(L=this.serviceColloctor)!=null&&L.isOwn(b)&&(b=this.serviceColloctor.getLocalId(b)),g.zIndex=h,O!=null&&O.opt&&(O.opt.zIndex=h),O!=null&&O.opt&&m.set(b,{updateNodeOpt:O.updateNodeOpt,opt:O.opt}))}),f.selectStore=m,f.willSerializeData=!0,d.push([f,{workId:v,msgType:Rt.UpdateNode,emitEventType:this.emitEventType}])}continue}}d.length&&this.collectForLocalWorker(d);function c(v,p){return p.isLocalId(v)&&p.transformKey(v)||v}}}class J0 extends Oe{constructor(){super(...arguments),it(this,"lastEmtData"),it(this,"emitEventType",jt.TranslateNode),it(this,"cachePosition")}collect(t,e){var r,n,i;if(!this.serviceColloctor||!this.mainEngine)return;const{workIds:a,position:s,workState:u,viewId:d}=t;this.lastEmtData=t;const M=this.control.viewContainerManager.getView(d);if(!(M!=null&&M.displayer))return;const c=M.focusScenePath,v=[...a],p=(r=this.serviceColloctor)==null?void 0:r.storage,T=[],x=u===Et.Start&&this.mainEngine.now||void 0;for(x&&this.mainEngine.internalMsgEmitter.emit("addUndoTicker",x,d);v.length;){const y=v.pop();if(!y)continue;const C=y.toString(),h=this.serviceColloctor.isLocalId(C),g=h&&this.serviceColloctor.transformKey(y)||C;let f=C;!h&&this.serviceColloctor.isOwn(f)&&(f=this.serviceColloctor.getLocalId(f));const m=(i=(n=p?.[d])==null?void 0:n[c])==null?void 0:i[g];if(m&&f===Wt){if(m.selectIds){const S=this.control.viewContainerManager.transformToScenePoint([s.x,s.y],d);if(u===Et.Start&&(this.cachePosition=S),this.cachePosition){const A=m.updateNodeOpt||{};A.translate=[S[0]-this.cachePosition[0],S[1]-this.cachePosition[1]],A.workState=u,this.control.cursor.isEnableCursor?A.useAnimation=!1:(A.uid=this.serviceColloctor.uid,u===Et.Start?A.useAnimation=!1:u===Et.Done&&(A.useAnimation=!0));const P={workId:y,msgType:Rt.UpdateNode,dataType:Ft.Local,updateNodeOpt:A,emitEventType:this.emitEventType,willSyncService:!0,textUpdateForWoker:!0,viewId:d,smoothSync:this.mainEngine.smoothSync};u===Et.Done&&(P.textUpdateForWoker=!0,P.willSerializeData=!0,this.cachePosition=void 0),T.push([P,{workId:y,msgType:Rt.UpdateNode,emitEventType:this.emitEventType,workState:u}])}}continue}}u===Et.Start?this.mainEngine.unWritable():u===Et.Done&&(this.mainEngine.abled(),this.lastEmtData=void 0),T.length&&this.collectForLocalWorker(T,e)}}class q0 extends Oe{constructor(){super(...arguments),it(this,"lastEmtData"),it(this,"emitEventType",jt.DeleteNode)}collect(t){var e,r;if(!this.serviceColloctor||!this.mainEngine)return;const{workIds:n,viewId:i}=t,a=this.control.viewContainerManager.getView(i);if(!(a!=null&&a.displayer))return;const s=a.focusScenePath,u=this.serviceColloctor.storage,d=[...n],M=[],c=[],v=this.mainEngine.now;for(;d.length;){const p=d.pop();if(!p)continue;const T=p.toString(),x=this.serviceColloctor.isLocalId(T),y=x?this.serviceColloctor.transformKey(p):T,C=(r=(e=u?.[i])==null?void 0:e[s])==null?void 0:r[y];if(C){let h=T;if(!x&&this.serviceColloctor.isOwn(h)&&(h=this.serviceColloctor.getLocalId(h)),C.toolsType===ht.Text){this.control.textEditorManager.delete(h,!0,!0);continue}c.push(h)}}c.length&&(M.push([{msgType:Rt.RemoveNode,emitEventType:jt.DeleteNode,removeIds:c,dataType:Ft.Local,willSyncService:!0,willRefresh:!0,viewId:i},void 0]),this.mainEngine.internalMsgEmitter.emit("addUndoTicker",v,i),this.collectForLocalWorker(M))}}class _0 extends Oe{constructor(){super(...arguments),it(this,"lastEmtData"),it(this,"emitEventType",jt.ScaleNode),it(this,"targetText",new Map),it(this,"cacheTextInfo",new Map)}async setTextStyle(t,e,r){const n=await this.control.textEditorManager.updateTextControllerWithEffectAsync({workId:t,opt:e,viewId:r,canSync:!1,canWorker:!1});return{key:t,textInfo:n}}async collect(t,e){var r,n,i,a,s,u,d;if(!this.serviceColloctor||!this.mainEngine)return;const{workIds:M,workState:c,viewId:v,originPoint:p,scenePoint:T,dir:x,scale:y,translate:C}=t;this.lastEmtData=t;const h=this.control.viewContainerManager.getView(v);if(!(h!=null&&h.displayer))return;const g=h.focusScenePath,f=[...M],m=(r=this.serviceColloctor)==null?void 0:r.storage,S=[],A=c===Et.Start&&this.mainEngine.now||void 0;for(A&&this.mainEngine.internalMsgEmitter.emit("addUndoTicker",A,v);f.length;){const P=f.pop();if(!P)continue;const R=P.toString(),D=this.serviceColloctor.isLocalId(R),L=D&&this.serviceColloctor.transformKey(P)||R;let j=R;!D&&this.serviceColloctor.isOwn(j)&&(j=this.serviceColloctor.getLocalId(j));const b=(i=(n=m?.[v])==null?void 0:n[g])==null?void 0:i[L];if(b&&j===Wt&&b.selectIds){const O=b.updateNodeOpt||{};if(O.dir=x,O.originPoint=p,O.scenePoint=T,O.workState=c,O.scale=y,O.translate=C,c===Et.Start){this.cacheTextInfo.clear();for(const X of b.selectIds){const Z=(a=this.serviceColloctor)==null?void 0:a.isLocalId(X),$=Z&&((s=this.serviceColloctor)==null?void 0:s.transformKey(X))||X;let rt=$;!Z&&(u=this.serviceColloctor)!=null&&u.isOwn($)&&(rt=this.serviceColloctor.getLocalId($));const F=this.control.textEditorManager.get(rt);F&&c===Et.Start&&this.targetText.set(rt,Mn(F))}}if(this.targetText.size&&c!==Et.Start&&y){const X=[];for(const[$,rt]of this.targetText.entries()){const{opt:F}=rt,Q=Math.floor(F.fontSize*y[0]),tt=this.cacheTextInfo.get($),lt=!tt&&F.fontSize!==Q||tt&&tt.fontSize!==Q||!1,ct=(d=this.control.textEditorManager.get($))==null?void 0:d.opt;if(lt&&ct&&F.boxSize&&F.boxPoint){const Mt=this.setTextStyle($,{...ct,fontSize:Q},v);X.push(Mt)}}const Z=await Promise.all(X);for(const $ of Z)if($){const{key:rt,textInfo:F}=$;this.cacheTextInfo.set(rt,{fontSize:F.opt.fontSize,boxSize:F.opt.boxSize,boxPoint:F.opt.boxPoint})}O.textInfos=this.cacheTextInfo}this.control.cursor.isEnableCursor?O.useAnimation=!1:(O.uid=this.serviceColloctor.uid,c===Et.Start?O.useAnimation=!1:c===Et.Done&&(O.useAnimation=!0));const Y={workId:P,msgType:Rt.UpdateNode,dataType:Ft.Local,updateNodeOpt:O,emitEventType:this.emitEventType,willRefreshSelector:!0,willSyncService:!0,viewId:v,smoothSync:this.mainEngine.smoothSync};c===Et.Done&&(Y.willSerializeData=!0,this.targetText.clear()),S.push([Y,{workId:P,msgType:Rt.UpdateNode,emitEventType:this.emitEventType,workState:c}]);continue}}c===Et.Start?this.mainEngine.unWritable():c===Et.Done&&(this.mainEngine.abled(),this.lastEmtData=void 0),S.length&&this.collectForLocalWorker(S,e)}}class ty extends Oe{constructor(){super(...arguments),it(this,"lastEmtData"),it(this,"emitEventType",jt.RotateNode),it(this,"cacheOriginRotate",0)}collect(t,e){var r,n,i,a,s,u,d;if(!this.serviceColloctor||!this.mainEngine)return;const{workIds:M,angle:c,workState:v,viewId:p}=t;this.lastEmtData=t;const T=this.control.viewContainerManager.getView(p);if(!(T!=null&&T.displayer))return;const x=T.focusScenePath,y=[...M],C=(r=this.serviceColloctor)==null?void 0:r.storage,h=[],g=v===Et.Start&&this.mainEngine.now||void 0;for(g&&this.mainEngine.internalMsgEmitter.emit("addUndoTicker",g,p);y.length;){const f=y.pop();if(!f)continue;const m=f.toString(),S=this.serviceColloctor.isLocalId(m),A=S&&this.serviceColloctor.transformKey(f)||m;let P=m;!S&&this.serviceColloctor.isOwn(P)&&(P=this.serviceColloctor.getLocalId(P));const R=(i=(n=C?.[p])==null?void 0:n[x])==null?void 0:i[A];if(R&&P===Wt){if(((a=R.selectIds)==null?void 0:a.length)===1){const D=R.selectIds[0];if(v===Et.Start){const b=((s=this.serviceColloctor)==null?void 0:s.isLocalId(D))&&((u=this.serviceColloctor)==null?void 0:u.transformKey(D))||D,O=C[p][x][b];this.cacheOriginRotate=((d=O?.opt)==null?void 0:d.rotate)||0}const L=R.updateNodeOpt||{};L.angle=(c+this.cacheOriginRotate)%360,L.workState=v,this.control.cursor.isEnableCursor?L.useAnimation=!1:(L.uid=this.serviceColloctor.uid,v===Et.Start?L.useAnimation=!1:v===Et.Done&&(L.useAnimation=!0));const j={workId:f,msgType:Rt.UpdateNode,dataType:Ft.Local,updateNodeOpt:L,emitEventType:this.emitEventType,willRefreshSelector:!1,willSyncService:!0,viewId:p,smoothSync:this.mainEngine.smoothSync};v===Et.Done&&(j.willRefreshSelector=!0,j.willSerializeData=!0,this.cacheOriginRotate=0),h.push([j,{workId:f,msgType:Rt.UpdateNode,emitEventType:this.emitEventType,workState:v}])}continue}}v===Et.Start?this.mainEngine.unWritable():v===Et.Done&&(this.mainEngine.abled(),this.lastEmtData=void 0),h.length&&this.collectForLocalWorker(h,e)}}function ey(o){switch(o){case ht.Text:return Re.Text;case ht.SpeechBalloon:case ht.Star:case ht.Ellipse:case ht.Rectangle:case ht.Triangle:case ht.Rhombus:case ht.Polygon:return Re.Shape}}class ry extends Oe{constructor(){super(...arguments),it(this,"lastEmtData"),it(this,"emitEventType",jt.SetFontStyle),it(this,"timerId")}async setTextStyle(t,e,r,n){const{bold:i,underline:a,lineThrough:s,italic:u,fontSize:d}=r;if(e.toolsType&&ey(e.toolsType)===Re.Text){e.opt&&(i&&(e.opt.bold=i),St.isBoolean(a)&&(e.opt.underline=a),St.isBoolean(s)&&(e.opt.lineThrough=s),u&&(e.opt.italic=u),d&&(e.opt.fontSize=d));const M=await this.control.textEditorManager.updateTextControllerWithEffectAsync({workId:t,opt:e.opt,viewId:n,canSync:!1,canWorker:!1});return{key:t,textInfo:M}}}async collect(t){var e,r,n,i,a,s;if(!this.serviceColloctor||!this.mainEngine)return;const{workIds:u,bold:d,italic:M,lineThrough:c,underline:v,viewId:p,fontSize:T}=t,x=this.control.viewContainerManager.getView(p);if(!(x!=null&&x.displayer))return;const y=x.focusScenePath,C=[...u],h=this.serviceColloctor.storage,g={},f=this.mainEngine.now;this.mainEngine.internalMsgEmitter.emit("addUndoTicker",f,p);const m=[];for(;C.length;){const A=C.pop();if(!A)continue;const P=A.toString(),R=this.serviceColloctor.isLocalId(P),D=R?this.serviceColloctor.transformKey(A):P;let L=P;!R&&this.serviceColloctor.isOwn(L)&&(L=this.serviceColloctor.getLocalId(L));const j=(r=(e=h?.[p])==null?void 0:e[y])==null?void 0:r[D];if(j){const b=j.updateNodeOpt||{};if(d&&(b.bold=d,g.bold=d==="bold"),M&&(b.italic=M,g.italic=M==="italic"),St.isBoolean(c)&&(b.lineThrough=c,g.lineThrough=c),St.isBoolean(v)&&(b.underline=v,g.underline=v),T&&(b.fontSize=T,g.textSize=T),j.toolsType===ht.Text&&j.opt){const O=this.setTextStyle(L,St.cloneDeep(j),b,p);m.push(O);continue}if(j&&L===Wt&&(n=j.selectIds)!=null&&n.length)for(const O of j.selectIds){const Y=(i=this.serviceColloctor)==null?void 0:i.isLocalId(O);let X=Y&&((a=this.serviceColloctor)==null?void 0:a.transformKey(O))||O;const Z=h[p][y][X]||void 0;if(!Y&&(s=this.serviceColloctor)!=null&&s.isOwn(X)&&(X=this.serviceColloctor.getLocalId(X)),Z&&Z.toolsType===ht.Text&&j.opt){const $=this.setTextStyle(X,St.cloneDeep(Z),b,p);m.push($);continue}}}}const S=await Promise.all(m);for(const A of S)if(A){const{key:P,textInfo:R}=A;R&&(R.canSync=!0,R.canWorker=!0,this.control.textEditorManager.updateForViewEdited(P,R))}Object.keys(g).length&&(this.timerId&&(clearTimeout(this.timerId),this.timerId=void 0),this.timerId=setTimeout(()=>{var A;this.timerId=void 0,(A=this.control.room)==null||A.setMemberState(g)},0))}}class ny extends Oe{constructor(){super(...arguments),it(this,"lastEmtData"),it(this,"emitEventType",jt.SetPoint),it(this,"undoTickerId")}collect(t){var e,r,n;if(!this.serviceColloctor||!this.mainEngine)return;const{workId:i,pointMap:a,workState:s,viewId:u}=t,d=this.control.viewContainerManager.getView(u);if(!(d!=null&&d.displayer))return;const M=d.focusScenePath,c=(e=this.serviceColloctor)==null?void 0:e.storage,v=[],p=s===Et.Start&&this.mainEngine.now||void 0;p&&(this.undoTickerId=p,this.mainEngine.internalMsgEmitter.emit("addUndoTicker",p,u));const T=i;if(!T)return;const x=T.toString(),y=this.serviceColloctor.isLocalId(x),C=y&&this.serviceColloctor.transformKey(T)||x;let h=x;!y&&this.serviceColloctor.isOwn(h)&&(h=this.serviceColloctor.getLocalId(h));const g=(n=(r=c?.[u])==null?void 0:r[M])==null?void 0:n[C];if(g&&h===Wt&&g.selectIds){const f=g.updateNodeOpt||{};f.pointMap=a,f.workState=s;const m={workId:T,msgType:Rt.UpdateNode,dataType:Ft.Local,updateNodeOpt:f,emitEventType:this.emitEventType,willRefreshSelector:!0,willSyncService:!0,viewId:u};s===Et.Done&&(m.undoTickerId=this.undoTickerId),v.push([m,{workId:T,msgType:Rt.UpdateNode,emitEventType:this.emitEventType}])}s===Et.Start?this.mainEngine.unWritable():s===Et.Done&&this.mainEngine.abled(),v.length&&this.collectForLocalWorker(v)}}class iy extends Oe{constructor(){super(...arguments),it(this,"lastEmtData"),it(this,"emitEventType",jt.SetLock)}collect(t){var e,r;if(!this.serviceColloctor||!this.mainEngine)return;const{workIds:n,isLocked:i,viewId:a}=t,s=this.control.viewContainerManager.getView(a);if(!(s!=null&&s.displayer))return;const u=s.focusScenePath,d=[...n],M=this.serviceColloctor.storage,c=[],v=this.mainEngine.now;for(;d.length;){const p=d.pop();if(!p)continue;const T=p.toString(),x=this.serviceColloctor.isLocalId(T),y=x?this.serviceColloctor.transformKey(p):T;let C=T;!x&&this.serviceColloctor.isOwn(C)&&(C=this.serviceColloctor.getLocalId(C));const h=(r=(e=M?.[a])==null?void 0:e[u])==null?void 0:r[y];if(h){const g=h.updateNodeOpt||{};g.isLocked=i;const f={workId:C,msgType:Rt.UpdateNode,dataType:Ft.Local,updateNodeOpt:g,emitEventType:this.emitEventType,willRefresh:!0,willRefreshSelector:!0,willSyncService:!0,viewId:a};c.push([f,{workId:C,msgType:Rt.UpdateNode,emitEventType:this.emitEventType}])}}this.mainEngine.internalMsgEmitter.emit("addUndoTicker",v,a),c.length&&this.collectForLocalWorker(c)}}class sy extends Oe{constructor(){super(...arguments),it(this,"lastEmtData"),it(this,"emitEventType",jt.SetShapeOpt)}collect(t){var e,r;if(!this.serviceColloctor||!this.mainEngine)return;const{workIds:n,viewId:i,...a}=t,s=this.control.viewContainerManager.getView(i);if(!(s!=null&&s.displayer))return;const u=s.focusScenePath,d=[...n],M=this.serviceColloctor.storage,c=[],v=this.mainEngine.now;for(;d.length;){const p=d.pop();if(!p)continue;const T=p.toString(),x=this.serviceColloctor.isLocalId(T),y=x?this.serviceColloctor.transformKey(p):T;let C=T;!x&&this.serviceColloctor.isOwn(C)&&(C=this.serviceColloctor.getLocalId(C));const h=(r=(e=M?.[i])==null?void 0:e[u])==null?void 0:r[y];if(h){const g={...h.updateNodeOpt,...a,willRefresh:!0};if(h&&C===Wt){const f={workId:C,msgType:Rt.UpdateNode,dataType:Ft.Local,updateNodeOpt:g,emitEventType:this.emitEventType,willRefresh:!0,willRefreshSelector:!0,willSyncService:!0,viewId:i};c.push([f,{workId:C,msgType:Rt.UpdateNode,emitEventType:this.emitEventType}])}}}c.length&&(this.mainEngine.internalMsgEmitter.emit("addUndoTicker",v,i),this.collectForLocalWorker(c))}}class Qt{constructor(t){it(this,"builders",new Map),this.builders=new Map(t.map(e=>[e,this.build(e)]))}build(t){switch(t){case jt.TranslateNode:return new J0;case jt.ZIndexNode:return new $0;case jt.CopyNode:return new Q0;case jt.SetColorNode:return new K0;case jt.DeleteNode:return new q0;case jt.ScaleNode:return new _0;case jt.RotateNode:return new ty;case jt.SetFontStyle:return new ry;case jt.SetPoint:return new ny;case jt.SetLock:return new iy;case jt.SetShapeOpt:return new sy}}getBuilder(t){return this.builders.get(t)}registerForMainEngine(t,e){return this.builders.forEach(r=>{r&&r.registerForMainEngine(t,e)}),this}destroy(){this.builders.forEach(t=>{t&&t.destroy()}),this.builders.clear()}pause(){return this.builders.forEach(t=>{t&&t.pause()}),this}recover(){return this.builders.forEach(t=>{t&&t.recover()}),this}static emitMethod(t,e,r){Oe.dispatch(t,e,r)}static activeListener(t){Te.InternalMsgEmitter.on(jt.ActiveMethod,t)}static unmountActiveListener(t){Te.InternalMsgEmitter.off(jt.ActiveMethod,t)}}const oy=async(o,t)=>{const{src:e,isgl:r}=o;if(typeof Image=="function"){const n=new Image;return typeof e=="string"&&(n.crossOrigin="anonymous"),new Promise(i=>{n.onload=function(){createImageBitmap(n,{imageOrientation:r?"flipY":"none"}).then(a=>{i(a)})},n.onerror=function(){i(void 0)},n.src=e})}else return fetch(e,{method:"GET",mode:"cors",cache:"default"}).then(n=>n.blob()).then(n=>createImageBitmap(n,{imageOrientation:r?"flipY":"none"}).then(i=>i))},bo=class Ar{constructor(){it(this,"fontDB"),it(this,"FONT_DB_NAME","__APPLIANCE_PLUGIN_FONT_DB"),it(this,"FONT_STORE_NAME","fonts"),it(this,"FONT_DB_VERSION",1)}static getInstance(){return Ar.instance||(Ar.instance=new Ar),Ar.instance}async initFontDB(){return this.fontDB?this.fontDB:new Promise((t,e)=>{const r=indexedDB.open(this.FONT_DB_NAME,this.FONT_DB_VERSION);r.onerror=()=>{e(new Error(`Failed to open font database: ${r.error}`))},r.onsuccess=()=>{this.fontDB=r.result,t(r.result)},r.onupgradeneeded=n=>{const i=n.target.result;i.objectStoreNames.contains(this.FONT_STORE_NAME)||i.createObjectStore(this.FONT_STORE_NAME,{keyPath:"fontFamily"}).createIndex("url","url",{unique:!1})}})}async getFontFromDB(t){try{return this.fontDB||(this.fontDB=await this.initFontDB()),new Promise((e,r)=>{const n=this.fontDB.transaction([this.FONT_STORE_NAME],"readonly").objectStore(this.FONT_STORE_NAME).get(t);n.onsuccess=()=>{n.result&&n.result.buffer?e(n.result.buffer):e(null)},n.onerror=()=>{r(n.error)}})}catch(e){return console.error(`Failed to get font from database for ${t}:`,e),null}}async saveFontToDB(t,e,r){try{return this.fontDB||(this.fontDB=await this.initFontDB()),new Promise((n,i)=>{const a=this.fontDB.transaction([this.FONT_STORE_NAME],"readwrite").objectStore(this.FONT_STORE_NAME),s={fontFamily:t,url:e,buffer:r,timestamp:Date.now()},u=a.put(s);u.onsuccess=()=>{n(!0)},u.onerror=()=>{i(u.error)}})}catch(n){return console.error(`Failed to save font to database for ${t}:`,n),!1}}async clearFontCache(){try{return this.fontDB||(this.fontDB=await this.initFontDB()),new Promise((t,e)=>{const r=this.fontDB.transaction([this.FONT_STORE_NAME],"readwrite").objectStore(this.FONT_STORE_NAME).clear();r.onsuccess=()=>{console.log("Font cache cleared successfully"),t(!0)},r.onerror=()=>{e(r.error)}})}catch(t){return console.error("Failed to clear font cache:",t),!1}}async getFontCacheStatus(){try{return this.fontDB||(this.fontDB=await this.initFontDB()),new Promise((t,e)=>{const r=this.fontDB.transaction([this.FONT_STORE_NAME],"readonly").objectStore(this.FONT_STORE_NAME).getAll();r.onsuccess=()=>{const n=r.result||[],i=n.reduce((a,s)=>a+(s.buffer?s.buffer.byteLength:0),0);t({count:n.length,totalSize:i})},r.onerror=()=>{e(r.error)}})}catch(t){return console.error("Failed to get font cache status:",t),{count:0,totalSize:0}}}};it(bo,"instance");let ay=bo;class ly{get now(){var t;return((t=this.control.room)==null?void 0:t.calibrationTimestamp)||Date.now()}get newWorkId(){return this.now.toString()}setCurrentToolsData(t){this.currentToolsData=t}getCurrentToolsData(){return this.currentToolsData}setCurrentLocalWorkData(t){this.currentLocalWorkData=t}getWorkId(){return this.currentLocalWorkData.workId}get workState(){return this.currentLocalWorkData.workState}}class cy extends ly{constructor(t){super(),it(this,"maxLastSyncTime",me.syncOpt.interval),it(this,"combineUnitTime",me.bezier.combineUnitTime),it(this,"maxCombineEraserTime",me.pencilEraser.maxCombineTime),it(this,"smoothSync",me.syncOpt.smoothSync),it(this,"isActive",!1),it(this,"currentToolsData"),it(this,"currentLocalWorkData"),it(this,"control"),it(this,"internalMsgEmitter"),it(this,"publicMsgEmitter"),it(this,"taskBatchData",new Set),it(this,"fullWorker"),it(this,"subWorker"),it(this,"fullWorkerUrl"),it(this,"subWorkerUrl"),it(this,"methodBuilder"),it(this,"zIndexNodeMethod"),it(this,"subWorkerDrawCount",0),it(this,"fullWorkerDrawCount",0),it(this,"maxDrawCount",0),it(this,"_consumeCount",0),it(this,"_postCount",0),it(this,"reRenders",new Map),it(this,"localWorkViewId"),it(this,"localPointsBatchData",new Map),it(this,"tasksqueue",new Map),it(this,"useTasksqueue",!1),it(this,"useTasksClockId"),it(this,"mainTasksqueueCount"),it(this,"workerTasksqueueCount"),it(this,"snapshotMap",new Map),it(this,"boundingRectMap",new Map),it(this,"clearAllResolveMap",new Map),it(this,"delayWorkStateToDoneResolve"),it(this,"animationId"),it(this,"tmpImageConfigMap",new Map),it(this,"mainThread"),it(this,"willSelectorWorkId"),it(this,"isLockSentEventCursor",!1),it(this,"getVNodeInfoResolveMap",new Map),it(this,"setFontFacesResolve",{}),it(this,"isLocalWorkActive",!1),it(this,"indexDBUtils",ay.getInstance());const{control:e,internalMsgEmitter:r,publicMsgEmitter:n}=t;this.control=e,this.maxLastSyncTime=this.control.pluginOptions.extras.syncOpt.interval,this.combineUnitTime=this.control.pluginOptions.extras.bezier.combineUnitTime||this.combineUnitTime,this.smoothSync=St.isBoolean(this.control.pluginOptions.extras.syncOpt.smoothSync)?this.control.pluginOptions.extras.syncOpt.smoothSync:this.smoothSync,this.maxCombineEraserTime=this.control.pluginOptions.extras.pencilEraser.maxCombineTime||this.maxCombineEraserTime,this.fullWorkerUrl=this.control.pluginOptions.cdn.fullWorkerUrl||"",this.subWorkerUrl=this.control.pluginOptions.cdn.subWorkerUrl||"",this.internalMsgEmitter=r,this.publicMsgEmitter=n,this.currentLocalWorkData={workState:Et.Pending}}get isBezier(){return this.control.pluginOptions.extras.bezier.enable}destroy(){var t,e,r;(t=this.methodBuilder)==null||t.destroy(),this.unWritable(),this.taskBatchData.clear(),this.tasksqueue.clear(),this.tmpImageConfigMap.clear(),this.localPointsBatchData.clear(),this.isActive=!1,this.clearAllResolveMap.clear(),this.snapshotMap.clear(),this.boundingRectMap.clear(),(e=this.fullWorker)==null||e.terminate(),(r=this.subWorker)==null||r.terminate()}get consumeCount(){return this._consumeCount}set consumeCount(t){this._consumeCount=t}get postCount(){return this._postCount}set postCount(t){this._postCount=t}get viewContainerManager(){return this.control.viewContainerManager}get collector(){return this.control.collector}get isRunSubWork(){var t;const e=(t=this.currentToolsData)==null?void 0:t.toolsType;return e===ht.Pencil||e===ht.PencilEraser||e===ht.BitMapEraser||e===ht.LaserPen||e===ht.Arrow||e===ht.Straight||e===ht.Ellipse||e===ht.Rectangle||e===ht.Star||e===ht.Polygon||e===ht.SpeechBalloon||e===ht.Selector}get isCanDrawWork(){var t;const e=(t=this.currentToolsData)==null?void 0:t.toolsType;return e===ht.Pencil||e===ht.LaserPen||e===ht.Arrow||e===ht.Straight||e===ht.Ellipse||e===ht.Rectangle||e===ht.Star||e===ht.Polygon||e===ht.SpeechBalloon||e===ht.Triangle||e===ht.Rhombus||e===ht.BitMapEraser||e===ht.PencilEraser}get isUseZIndex(){var t;const e=(t=this.currentToolsData)==null?void 0:t.toolsType;return e===ht.Pencil||e===ht.Arrow||e===ht.Straight||e===ht.Ellipse||e===ht.Rectangle||e===ht.Star||e===ht.Polygon||e===ht.SpeechBalloon||e===ht.Text||e===ht.Image}get isCanRecordUndoRedo(){var t;const e=(t=this.currentToolsData)==null?void 0:t.toolsType;return e===ht.Pencil||e===ht.Eraser||e===ht.PencilEraser||e===ht.BitMapEraser||e===ht.Arrow||e===ht.Straight||e===ht.Ellipse||e===ht.Rectangle||e===ht.Star||e===ht.Polygon||e===ht.SpeechBalloon||e===ht.Text||e===ht.Image}get isCanSentCursor(){var t;const e=(t=this.currentToolsData)==null?void 0:t.toolsType;return e===ht.Pencil||e===ht.Text||e===ht.LaserPen||e===ht.Arrow||e===ht.Straight||e===ht.Ellipse||e===ht.Rectangle||e===ht.Star||e===ht.Polygon||e===ht.SpeechBalloon||e===ht.Triangle||e===ht.Rhombus||e===ht.Eraser||e===ht.PencilEraser||e===ht.BitMapEraser||e===ht.Selector}get isPostCountType(){var t;const e=(t=this.currentToolsData)==null?void 0:t.toolsType;return e===ht.Pencil||e===ht.Arrow||e===ht.Straight||e===ht.Ellipse||e===ht.Rectangle||e===ht.Star||e===ht.Polygon||e===ht.SpeechBalloon||e===ht.Triangle||e===ht.Rhombus||e===ht.Eraser||e===ht.PencilEraser||e===ht.BitMapEraser||e===ht.Selector}get isCanPostDraw(){var t;const e=(t=this.currentToolsData)==null?void 0:t.toolsType;return e===ht.Pencil||e===ht.PencilEraser||e===ht.BitMapEraser}get isCanStartEventConsum(){var t;const e=(t=this.currentToolsData)==null?void 0:t.toolsType;return e===ht.Selector||e===ht.Eraser||e===ht.PencilEraser||e===ht.BitMapEraser}async init(){this.destroy(),await this.on(),this.internalMsgEmitterListener(),this.isActive=!0}async useMainThread(){console.info("no OffscreenCanvas"),this.control.hasExtendFontFaces&&await document.fonts.ready.then(()=>{this.control.room&&this.control.room.logger.info("set font faces in main thread success")});const{MainThreadManagerImpl:t}=await ya(async()=>{const{MainThreadManagerImpl:e}=await import("./index-BVzr2LGs-BlZuKJ8g.js");return{MainThreadManagerImpl:e}},__vite__mapDeps([0,1,2,3,4,5]));this.mainThread=new t(this)}async on(){if(!this.control.hasOffscreenCanvas){await this.useMainThread();return}if(!this.fullWorkerUrl||!this.subWorkerUrl){console.error("no worker url config");return}if(this.fullWorker=new Worker(this.fullWorkerUrl,{type:"classic"}),this.control.isUseSimple||(this.subWorker=new Worker(this.subWorkerUrl,{type:"classic"})),this.fullWorker.onmessage=t=>{if(t.data){const{render:e,sp:r,fullWorkerDrawCount:n,workerTasksqueueCount:i,viewId:a,consumeCount:s}=t.data;if(s&&(this.consumeCount=s),this.isBusy&&i&&this.setWorkerTasksqueueCount(i),r!=null&&r.length&&this.collectorSyncData(r),this.control.isUseSimple){if(this.control.isUseOffscreenTransfer)return;e&&e!=null&&e.length&&this.viewContainerManager.render(e);return}const u=e?.length&&e||[];if(n&&a){if(this.fullWorkerDrawCount=n,this.fullWorkerDrawCount<1/0){const d=Math.max(this.maxDrawCount,this.fullWorkerDrawCount);this.setMaxDrawCount(d),this.clearReRenders(this.fullWorkerDrawCount)}else this.setMaxDrawCount(0),this.clearReRenders(1/0);if(this.reRenders.size)for(const d of this.reRenders.values())u.push(...d)}u.length&&this.viewContainerManager.render(u)}},this.subWorker&&(this.subWorker.onmessage=t=>{if(t.data){const{render:e,sp:r,subWorkerDrawCount:n,consumeCount:i}=t.data;i&&(this.consumeCount=i),r!=null&&r.length&&this.collectorSyncData(r);const a=e?.length&&e||[];if(St.isNumber(n)){if(this.subWorkerDrawCount=n,this.fullWorkerDrawCount<1/0){const s=Math.max(this.maxDrawCount,this.subWorkerDrawCount);this.setMaxDrawCount(s)}if(e!=null&&e.length)if(this.subWorkerDrawCount>this.fullWorkerDrawCount){const s=[];for(const u of e)u.imageBitmap&&(u.isUnClose=!0,s.push(u));this.reRenders.set(this.subWorkerDrawCount,s)}else this.reRenders.size&&this.clearReRenders(this.subWorkerDrawCount)}a.length&&this.viewContainerManager.render(a)}}),this.control.hasExtendFontFaces){const t=this.control.extendFontFaces,e=[],r=[];this.control.room&&this.control.room.logger.info(`load before font faces ${JSON.stringify(t)}`),await new Promise(async n=>{this.setFontFacesResolve.resolve=n,this.setFontFacesResolve.timer=setTimeout(()=>{this.setFontFacesResolve.resolve&&(this.control.room?this.control.room.logger.error("set font faces timeout"):console.warn("set font faces timeout"),this.setFontFacesResolve.resolve(!1))},this.control.loadFontFacesTimeout);try{for(const i of t){let a;a=await this.indexDBUtils.getFontFromDB(i.fontFamily)||void 0,a||(a=await this.loadFontInMainThread(i.src),a&&a.byteLength>0&&(await this.indexDBUtils.saveFontToDB(i.fontFamily,i.src,a)||(this.control.room?this.control.room.logger.warn(`Failed to save font ${i.fontFamily} to IndexedDB, but continuing with font loading`):console.warn(`Failed to save font ${i.fontFamily} to IndexedDB, but continuing with font loading`)))),a&&a.byteLength>0?(r.push({fontFamily:i.fontFamily,buffer:a}),e.push(a)):this.control.room?this.control.room.logger.warn(`Font ${i.fontFamily} could not be loaded from any source`):console.warn(`Font ${i.fontFamily} could not be loaded from any source`)}this.control.room&&this.control.room.logger.info("load end font faces"),r.length?this.fullWorker.postMessage(new Set([{type:Rt.SetFontFace,fontBuffers:r}]),e):this.setFontFacesResolve.resolve(!0)}catch(i){this.setFontFacesResolve.timer&&(clearTimeout(this.setFontFacesResolve.timer),this.setFontFacesResolve.timer=void 0),this.setFontFacesResolve.resolve&&(this.setFontFacesResolve.resolve(!1),this.control.room?this.control.room.logger.error(`set font faces error: ${i}`):console.error(`set font faces error: ${i}`))}}).then(n=>{this.setFontFacesResolve.resolve=void 0,this.setFontFacesResolve.timer=void 0,this.control.room?n?this.control.room.logger.info("set font faces in web worker success"):this.control.room.logger.error("set font faces in web worker error"):n||console.error("set font faces in web worker error")})}}async clearFontCache(){return await this.indexDBUtils.clearFontCache()}async getFontCacheStatus(){return await this.indexDBUtils.getFontCacheStatus()}async loadFontInMainThread(t){try{const e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);const r=await e.arrayBuffer();if(!r||r.byteLength===0)throw new Error("Empty font data received");const n=new Uint8Array(r);if(!this.validateFontData(n))throw new Error("Invalid font data format: not a valid font file");return r}catch(e){this.control.room?this.control.room.logger.error(`Failed to load font from ${t}: ${e}`):console.error(`Failed to load font from ${t}: ${e}`);return}}validateFontData(t){return t.length<4?!1:t[0]===119&&t[1]===79&&t[2]===70&&t[3]===50||t[0]===119&&t[1]===79&&t[2]===70&&t[3]===70||t[0]===0&&t[1]===1&&t[2]===0&&t[3]===0||t[0]===79&&t[1]===84&&t[2]===84&&t[3]===79||t.length>36&&t[36]===0&&t[37]===1&&t[38]===0&&t[39]===0}clearReRenders(t=1/0){for(const e of this.reRenders.keys())if(St.isNumber(Number(e))&&Number(e)<=t){const r=this.reRenders.get(Number(e));r?.forEach(n=>{var i;(i=n.imageBitmap)==null||i.close()}),this.reRenders.delete(e)}}get isBusy(){return this.getTasksqueueState()===Et.Doing}getLockSentEventCursor(){return this.isLockSentEventCursor}setLockSentEventCursor(t){this.isLockSentEventCursor=t}getTasksqueueState(){return this.useTasksqueue&&Et.Doing||Et.Done}setMaxDrawCount(t){this.maxDrawCount=t}getFullWorkDrawCount(){return this.fullWorkerDrawCount}getMaxDrawCount(){return this.maxDrawCount}setSubWorkerDrawCount(t){this.subWorkerDrawCount=t}setConsumeCount(t){this.consumeCount=t}getConsumeCount(){return this.consumeCount}setWorkerTasksqueueCount(t){const e=Math.max(this.workerTasksqueueCount||0,t);this.workerTasksqueueCount=e}collectorSyncData(t){var e,r,n,i;let a=!1;for(const s of t){const{type:u,selectIds:d,opt:M,selectRect:c,strokeColor:v,fillColor:p,willSyncService:T,isSync:x,imageBitmap:y,canvasHeight:C,canvasWidth:h,rect:g,op:f,canTextEdit:m,points:S,selectorColor:A,canRotate:P,scaleType:R,textOpt:D,toolsType:L,workId:j,viewId:b,dataType:O,canLock:Y,isLocked:X,shapeOpt:Z,toolsTypes:$,thickness:rt,strokeType:F,useStroke:Q,isgl:tt,imageSrc:lt,isSubWorker:ct,updateNodeOpt:Mt,setFontFaceResult:st,failedFonts:Tt}=s;if(u===Rt.SetFontFace){st&&this.setFontFacesResolve.resolve&&(Tt&&Tt.length>0&&(this.control.room?this.control.room.logger.info("set font face has failed fonts: "+Tt.join(", ")):console.info("set font face has failed fonts: "+Tt.join(", "))),this.setFontFacesResolve.resolve(st));return}if(!b)return;const xt=s.scenePath||this.viewContainerManager.getCurScenePath(b);switch(u){case Rt.Select:{const W=d!=null&&d.length?{...c,selectIds:d,canvasHeight:C,canvasWidth:h,points:S}:void 0;W&&M!=null&&M.strokeColor&&(W.selectorColor=M.strokeColor),W&&A&&(W.selectorColor=A),W&&v&&(W.strokeColor=v),W&&M!=null&&M.fillColor&&(W.fillColor=M.fillColor),W&&p&&(W.fillColor=p),W&&St.isBoolean(P)&&(W.canRotate=P),W&&R&&(W.scaleType=R),W&&m&&(W.canTextEdit=m),W&&D&&(W.textOpt=D),W&&St.isBoolean(Y)&&(W.canLock=Y),W&&St.isBoolean(X)&&(W.isLocked=X),W&&Z&&(W.shapeOpt=Z),W&&$&&(W.toolsTypes=$),W&&rt&&(W.thickness=rt),W&&F&&(W.strokeType=F),W&&St.isBoolean(Q)&&(W.useStroke=Q),b&&this.viewContainerManager.showFloatBar(b,!!W,W),T&&((e=this.collector)==null||e.dispatch({type:u,selectIds:d,opt:M,isSync:x,viewId:b,scenePath:xt}));break}case Rt.Snapshot:if(y&&xt){const W=this.snapshotMap.get(xt);W&&W(y)}break;case Rt.BoundingBox:if(g&&xt){const W=this.boundingRectMap.get(xt);W&&W(g)}break;case Rt.Cursor:f&&this.control.cursor.collectServiceCursor({...s});break;case Rt.Clear:if(b){this.viewContainerManager.showFloatBar(b,!1);const W=(r=this.clearAllResolveMap.get(b))==null?void 0:r.resolve;W&&W(b)}break;case Rt.TextUpdate:if(L===ht.Text&&j&&b){const W=this.viewContainerManager.transformToOriginPoint(M?.boxPoint||[0,0],b),k=M?.boxSize||[0,0],q=(n=this.viewContainerManager.getView(b))==null?void 0:n.cameraOpt;M?this.control.textEditorManager.updateTextForWorker({x:W[0],y:W[1],w:k[0],h:k[1],scale:q?.scale||1,workId:j,opt:M,dataType:O,viewId:b,canSync:T||!1,canWorker:!1,updateNodeOpt:Mt}):this.control.textEditorManager.delete(j,T||!1,!1)}break;case Rt.GetTextActive:L===ht.Text&&j&&b&&this.control.textEditorManager.updateTextForWorker({workId:j,isActive:!0,viewId:b,dataType:Ft.Local,canWorker:!1,canSync:!0},this.now);break;case Rt.GetImageBitMap:lt&&b&&j&&oy({src:lt,isgl:tt}).then(W=>{var k;const q=new Set;if(q.add({msgType:Rt.GetImageBitMap,dataType:Ft.Local,workId:j,viewId:b,imageSrc:lt,isSubWorker:ct,imageBitmap:W}),!this.control.hasOffscreenCanvas)(k=this.mainThread)==null||k.consume(q);else{const _=ct&&this.subWorker?this.subWorker:this.fullWorker;W?_.postMessage(q,[W]):_.postMessage(q)}});break;case Rt.GetVNodeInfo:if(j){const W=j.toString(),k=(i=this.getVNodeInfoResolveMap.get(W))==null?void 0:i.resolve,q={...s,uuid:W};k&&k(q)}break;default:a=!0;break}}a&&this.collectorAsyncData(t)}collectorAsyncData(t){var e,r,n,i;for(const a of t){const{type:s,op:u,workId:d,index:M,removeIds:c,ops:v,opt:p,updateNodeOpt:T,toolsType:x,isSync:y,viewId:C,isLockSentEventCursor:h,nextTasks:g}=a;if(!C){console.error("[MasterControlForWorker] collectorAsyncData on viewId in",a);return}const f=a.scenePath||this.viewContainerManager.getCurScenePath(C);switch(s){case Rt.None:{h&&ke(()=>{this.setLockSentEventCursor(!1)},this.maxLastSyncTime);break}case Rt.DrawWork:{(e=this.collector)==null||e.dispatch({type:s,op:u,opt:p,toolsType:x,workId:d,index:M,isSync:y,viewId:C,scenePath:f,updateNodeOpt:T});break}case Rt.FullWork:{(r=this.collector)==null||r.dispatch({type:s,ops:v,workId:d,updateNodeOpt:T,opt:p,toolsType:x,isSync:y,viewId:C,scenePath:f}),this.willSelectorWorkId&&d&&d.toString()===this.willSelectorWorkId&&this.control.runEffectWork(()=>{this.setShapeSelectorByWorkId(this.willSelectorWorkId,C),this.willSelectorWorkId=void 0});break}case Rt.UpdateNode:{(n=this.collector)==null||n.dispatch({type:s,updateNodeOpt:T,workId:d,opt:p,ops:v,op:u,isSync:y,viewId:C,scenePath:f});break}case Rt.RemoveNode:{c&&this.control.textEditorManager.deleteBatch(c,!1,!1),(i=this.collector)==null||i.dispatch({type:s,removeIds:c,isSync:y,viewId:C,scenePath:f}),this.willSelectorWorkId&&c!=null&&c.includes(this.willSelectorWorkId)&&(this.willSelectorWorkId=void 0);break}}g&&this.collectorAsyncData(g)}}async onLocalEventEnd(t,e){var r;const n=this.viewContainerManager.getView(e);if(!n)return;const{focusScenePath:i,cameraOpt:a}=n,s=this.viewContainerManager.transformToScenePoint(t,e),u=[];for(const d of this.localPointsBatchData.keys())if(((r=this.currentToolsData)==null?void 0:r.toolsType)===ht.Text){const M=this.getLocalPointInfo(d),c=M?.state;if(c&&c===Et.Start){const v=this.currentLocalWorkData.toolsOpt;v.workState=Et.Doing,v.boxPoint=[Math.round(s[0]),Math.round(s[1])],v.boxSize=[v.fontSize,v.fontSize],this.control.textEditorManager.checkEmptyTextBlur(),this.control.textEditorManager.createTextForMasterController({workId:this.newWorkId,x:t[0],y:t[1],scale:a?.scale||1,opt:v,type:Re.Text,isActive:!0,viewId:e,scenePath:i},this.now)}this.deleteLocalPoint(d);continue}else this.pushLocalPoint(d,s,Et.Done,e),u.push(d);if(u.length){try{if(await new Promise(d=>{setTimeout(async()=>{u.forEach(M=>{this.setLocalPointIsFullWork(M)}),this.delayWorkStateToDoneResolve=d,this.consume()},0)})&&u[0]){const d=u[0];u.forEach(M=>{this.deleteLocalPoint(M)}),this.willSelectorWorkId=d.toString()}}catch(d){console.error("[MasterControlForWorker] onLocalEventEnd error:",d)}this.delayWorkStateToDoneResolve=void 0,u.length=0}}onLocalEventDoing(t,e){var r;if(((r=this.currentToolsData)==null?void 0:r.toolsType)===ht.Text)return;this.currentLocalWorkData.workState===Et.Start&&this.setCurrentLocalWorkData({...this.currentLocalWorkData,workState:Et.Doing});let n=!1;for(const[i,{state:a}]of this.localPointsBatchData.entries())if(this.isAbled()&&a!==Et.Pending){const s=this.viewContainerManager.transformToScenePoint(t,e);this.pushLocalPoint(i,s,a===Et.Start?Et.Doing:a,e),n=!0}if(n){this.runAnimation();return}}onLocalEventStart(t,e){var r,n;this.viewContainerManager.focuedViewId!==e&&this.viewContainerManager.setFocuedViewId(e),this.isCanDrawWork&&this.control.room&&!this.control.room.disableDeviceInputs&&(this.control.room.disableDeviceInputs=!0);const i=(r=this.currentToolsData)==null?void 0:r.toolsType,a=i===ht.Selector?Wt:this.newWorkId,s=this.setZIndex(e);this.setCurrentLocalWorkData({workState:Et.Start,toolsOpt:s,viewId:e});const u=this.viewContainerManager.transformToScenePoint(t,e);if(this.pushLocalPoint(a,u,Et.Start,e,s),i!==ht.Text){if(this.control.textEditorManager.checkEmptyTextBlur(),this.isCanRecordUndoRedo&&this.internalMsgEmitter.emit("addUndoTicker",a,e),a&&s&&i&&this.isCanStartEventConsum&&this.prepareOnceWork({workId:a,toolsOpt:s,viewId:e},i),this.consumeCount=0,this.postCount=0,this.maxDrawCount=0,this.fullWorkerDrawCount=0,this.subWorkerDrawCount=0,this.clearReRenders(1/0),this.isCanDrawWork){const d=this.viewContainerManager.getCurScenePath(e);d&&(n=this.collector)!=null&&n.hasSelector(e,d)&&this.blurSelector(e,d)}this.consume()}}setLocalPointIsFullWork(t){const e=this.getLocalPointInfo(t);e&&(e.isFullWork=!0,this.localPointsBatchData.set(t,e))}pushLocalPoint(t,e,r,n,i){let a=this.getLocalPointInfo(t);r===Et.Start?a={state:Et.Start,points:e,opt:i||this.currentLocalWorkData.toolsOpt,isFullWork:!1,viewId:n}:a&&(a.state=r,a.points.push(e[0],e[1])),a&&this.localPointsBatchData.set(t,a)}deleteLocalPoint(t){this.localPointsBatchData.delete(t)}getLocalPointInfo(t){return this.localPointsBatchData.get(t)}getLocalPointsInfo(){return this.localPointsBatchData}correctStorage(t,e,r){var n;const i=new Map,a=[];Object.keys(t).forEach(u=>{var d,M;const c=(M=(d=t[u])==null?void 0:d.opt)==null?void 0:M.zIndex;St.isNumber(c)&&a.push([u,c])});const s=a.length&&((n=this.zIndexNodeMethod)==null?void 0:n.correct(a))||[];this.zIndexNodeMethod&&s.length&&(this.zIndexNodeMethod.setMinZIndex(s[0][1]||0,e),this.zIndexNodeMethod.setMaxZIndex(s[s.length-1][1]||0,e));for(const[u,d]of s){if(!t[u])continue;const M=t[u];M.opt&&St.isNumber(M.opt.zIndex)&&M.opt.zIndex!==d&&(M.opt.zIndex=d,i.set(u,M))}return i.size&&i.forEach((u,d)=>{var M;(M=this.collector)==null||M.updateValue(d,u,{viewId:e,scenePath:r,isSync:!0}),t[d]=u}),t}async originalEventLintener(t,e,r){var n,i,a;if(!this.isAbled())return;const s=(n=this.collector)==null?void 0:n.uid,u=this.viewContainerManager.getCurScenePath(r);if(s&&!this.control.renderControl.isWritable)return;const d=((i=this.currentToolsData)==null?void 0:i.toolsType)===ht.Selector;switch((a=this.currentToolsData)==null?void 0:a.toolsType){case ht.Eraser:case ht.PencilEraser:case ht.BitMapEraser:{if(s&&!this.control.renderControl.isClearAble({uid:s,viewId:r,scenePath:u}))return;break}default:{if(s&&!this.control.renderControl.isRenderAble({uid:s,viewId:r,scenePath:u}))return;break}}switch(this.control.isUseSimple||ke(()=>{var M;(M=this.control.pluginManager)==null||M.dispatchPluginEvent("localEvent",r,t,e)},So,this.control.hasPolyfillMethod("requestIdleCallback")),t){case Et.Start:this.isLocalWorkActive=!0,this.setLocalWorkViewId(r),r&&this.onLocalEventStart(e,r),d&&this.viewContainerManager.showFloatBarBtn(r,!1);break;case Et.Doing:r&&r===this.getLocalWorkViewId()&&this.onLocalEventDoing(e,r);break;case Et.Done:r&&r===this.getLocalWorkViewId()&&(this.setCurrentLocalWorkData({...this.currentLocalWorkData,workState:Et.Done}),await this.onLocalEventEnd(e,r),setTimeout(()=>{this.isLocalWorkActive=!1,this.setCurrentLocalWorkData({workState:Et.Pending}),d&&this.viewContainerManager.showFloatBarBtn(r,!0),this.setLocalWorkViewId(void 0)},0));break}this.isLocalWorkActive&&this.viewContainerManager.focuedViewId===r&&this.publicMsgEmitter.emit("workState",t,r)}getLocalWorkViewId(){return this.localWorkViewId}setLocalWorkViewId(t){this.localWorkViewId=t}setCurrentToolsData(t){var e,r,n;const i=t.toolsType,a=((e=this.currentToolsData)==null?void 0:e.toolsType)!==t.toolsType;if(super.setCurrentToolsData(t),a){const s=(r=this.viewContainerManager)==null?void 0:r.getAllViews();for(const u of s)if(u){const{id:d,focusScenePath:M}=u;a&&d&&M&&((n=this.collector)!=null&&n.hasSelector(d,M)&&this.blurSelector(d,M),this.control.textEditorManager.checkEmptyTextBlur())}this.taskBatchData.add({msgType:Rt.UpdateTools,dataType:Ft.Local,toolsType:i,opt:{...t.toolsOpt,syncUnitTime:this.maxLastSyncTime},combineUnitTime:this.isBezier?this.combineUnitTime:1/0,maxCombineEraserTime:this.maxCombineEraserTime,isRunSubWork:this.isRunSubWork,viewId:xv}),this.runAnimation()}}prepareOnceWork(t,e){const{workId:r,toolsOpt:n,viewId:i}=t,a={msgType:Rt.CreateWork,dataType:Ft.Local,viewId:i,toolsType:e};this.queryTaskBatchData(a).forEach(s=>{this.taskBatchData.delete(s)}),this.taskBatchData.add({...a,workId:r,opt:{...n,syncUnitTime:this.maxLastSyncTime},dataType:Ft.Local,isRunSubWork:this.isRunSubWork}),this.runAnimation()}createViewWorker(t,e,r){const{offscreenCanvasOpt:n,layerOpt:i,dpr:a,cameraOpt:s}=e,u={msgType:Rt.Init,dataType:Ft.Local,viewId:t,offscreenCanvasOpt:n,layerOpt:i,dpr:a,cameraOpt:s,isRunSubWork:!0,isSafari:navigator.userAgent.indexOf("Safari")!==-1&&navigator.userAgent.indexOf("Chrome")===-1,combineUnitTime:this.isBezier?this.combineUnitTime:1/0,maxCombineEraserTime:this.maxCombineEraserTime,syncUnitTime:this.maxLastSyncTime,isUseSimple:this.control.isUseSimple,offscreenCanvas:r.transferControlToOffscreenCanvas};this.taskBatchData.add(u),this.isBusy&&this.destroyTaskQueue(),this.consume()}destroyViewWorker(t,e=!1){var r;this.getLocalWorkViewId()===t&&this.setLocalWorkViewId(void 0),this.zIndexNodeMethod&&this.zIndexNodeMethod.clearZIndex(t),this.taskBatchData.add({msgType:Rt.Destroy,dataType:Ft.Local,viewId:t,isRunSubWork:!0}),this.consume(),e||(r=this.collector)==null||r.dispatch({type:Rt.Clear,viewId:t}),this.control.renderControl.destoryByViewId(t,e)}onServiceDerive(t,e){var r,n,i,a,s,u,d,M;const{newValue:c,oldValue:v,viewId:p,scenePath:T}=e,x=St.cloneDeep(c)||{},y=t;let C=x.type;if(!c&&v){if(y&&((r=this.collector)==null?void 0:r.getLocalId(y))===Wt){this.collector.isOwn(y)?this.blurSelector(p,T):this.blurSelector(p,T,y);return}if(C=Rt.RemoveNode,v.toolsType===ht.LaserPen)return}const h=(n=this.viewContainerManager.getView(p))==null?void 0:n.focusScenePath;if(h&&h!==T)return;if((i=this.collector)!=null&&i.isSelector(t)){const f=(a=this.collector)==null?void 0:a.getUidFromKey(t);if(f&&!this.control.roomMember.isOnLine(f))return}if(C&&y){if(!this.control.renderControl.isFilterAble({viewId:p,elementId:t,scenePath:T},C))return;const f=x;if(f.workId=(s=this.collector)!=null&&s.isOwn(y)?(u=this.collector)==null?void 0:u.getLocalId(y):y,f.msgType=C,f.toolsType===ht.LaserPen&&(f.isRunSubWork=!0),f.dataType=Ft.Service,f.viewId=p,f.scenePath=T,f.useAnimation=this.smoothSync&&((d=f.updateNodeOpt)==null?void 0:d.useAnimation)||!1,f.selectIds&&(f.selectIds=f.selectIds.map(m=>{var S,A;return(S=this.collector)!=null&&S.isOwn(m)?(A=this.collector)==null?void 0:A.getLocalId(m):m})),f&&f.toolsType===ht.Text||v?.toolsType===ht.Text){this.control.textEditorManager.onServiceDerive(f);return}f.isEnableCursor=this.control.cursor.isEnableCursor,this.taskBatchData.add(f)}this.runAnimation();const g=e.newValue&&((M=e.newValue.opt)==null?void 0:M.zIndex);if(this.zIndexNodeMethod&&St.isNumber(g)){const f=this.zIndexNodeMethod.getMinZIndex(p);this.zIndexNodeMethod.getMaxZIndex(p)<g&&this.zIndexNodeMethod.setMaxZIndex(g,p),f>g&&this.zIndexNodeMethod.setMinZIndex(g,p)}}pullServiceData(t,e,r={isAsync:!1,useAnimation:!1}){var n,i,a,s,u,d,M;let c=(n=this.collector)==null?void 0:n.getStorageData(t,e);const{isAsync:v,useAnimation:p}=r;if(c){this.control.renderControl.isWritable&&(c=this.correctStorage(c,t,e));const T=Object.keys(c);for(const x of T){if((i=this.collector)!=null&&i.isSelector(x)){const C=(a=this.collector)==null?void 0:a.getUidFromKey(x);if(C&&!this.control.roomMember.isOnLine(C))continue}const y=(s=c[x])==null?void 0:s.type;if(y&&x){if(!this.control.renderControl.isFilterAble({viewId:t,elementId:x,scenePath:e},y))continue;const C=c[x];if(C.workId=(u=this.collector)!=null&&u.isOwn(x)?(d=this.collector)==null?void 0:d.getLocalId(x):x,C.msgType=y,C.dataType=Ft.Service,C.viewId=t,C.scenePath=e,C.useAnimation=this.smoothSync&&(C.ops?!!p:(M=C.updateNodeOpt)==null?void 0:M.useAnimation)||!1,C.selectIds&&(C.selectIds=C.selectIds.map(h=>{var g,f;return(g=this.collector)!=null&&g.isOwn(h)?(f=this.collector)==null?void 0:f.getLocalId(h):h})),C.toolsType===ht.Text){this.control.textEditorManager.onServiceDerive(C);continue}v&&C.updateNodeOpt&&C.updateNodeOpt.useAnimation&&(C.updateNodeOpt.useAnimation=!1),C.isEnableCursor=this.control.cursor.isEnableCursor,this.taskBatchData.add(C)}this.internalMsgEmitter.emit("excludeIds",T,t)}v?this.consume():this.runAnimation()}}runAnimation(){!this.animationId&&!this.isBusy&&(this.animationId=requestAnimationFrame(this.consume.bind(this)))}consume(){var t;this.animationId=void 0;const{viewId:e}=this.currentLocalWorkData;if(this.tasksqueue.size){const r=this.consumeQueue(),n=!!r.size;if(this.taskBatchData.size)for(const i of this.taskBatchData.values())i.dataType===Ft.Service&&(r.add(i),this.taskBatchData.delete(i));r.size?(this.post(r),n&&this.tasksqueue.clear()):this.tasksqueue.size&&(this.animationId=requestAnimationFrame(this.consume.bind(this)));return}if(this.isAbled()&&this.localPointsBatchData.size&&e)for(const[r,{state:n,isFullWork:i,points:a,opt:s}]of this.localPointsBatchData.entries()){if(n===Et.Done&&!i||n===Et.Start&&!this.isCanStartEventConsum)continue;const u=a.map(d=>d);if(u.length){if(this.isPostCountType&&n===Et.Doing){if(this.postCount>this.consumeCount)continue;this.postCount++}this.delayWorkStateToDoneResolve&&n===Et.Done&&(this.delayWorkStateToDoneResolve(!0),this.setLockSentEventCursor(!0)),this.taskBatchData.add({op:u,workState:n,workId:r,dataType:Ft.Local,msgType:Rt.DrawWork,isRunSubWork:this.isRunSubWork,toolsType:(t=this.currentToolsData)==null?void 0:t.toolsType,viewId:e,scenePath:e&&this.viewContainerManager.getCurScenePath(e),opt:s,smoothSync:this.smoothSync,isLockSentEventCursor:this.getLockSentEventCursor(),syncUnitTime:this.maxLastSyncTime,disableEraseImage:this.control.disableEraseImage,disableEraseText:this.control.disableEraseText,postCount:this.isPostCountType&&this.postCount||void 0,fullWorkerDrawCount:this.isCanPostDraw&&this.fullWorkerDrawCount||void 0}),a.length=0}}this.taskBatchData.size&&(this.post(this.taskBatchData),this.taskBatchData.clear()),this.taskBatchData.size&&(this.animationId=requestAnimationFrame(this.consume.bind(this)))}unWritable(){this.setCurrentLocalWorkData({workState:Et.Unwritable}),this.setLockSentEventCursor(!0)}abled(){this.setCurrentLocalWorkData({workState:Et.Pending}),this.setLockSentEventCursor(!1)}isAbled(){return this.currentLocalWorkData.workState!==Et.Unwritable}post(t){if(!this.control.hasOffscreenCanvas){if(!this.mainThread){let e=[];e=St.cloneDeep([...t]),setTimeout(()=>{for(const r of e)this.taskBatchData.add(r)},0);return}this.mainThread.consume(t);return}if(this.control.isUseSimple){const e=[...t].find(r=>r.msgType===Rt.Init&&r.offscreenCanvas);e!=null&&e.offscreenCanvas?this.fullWorker.postMessage(t,[e.offscreenCanvas.bgCanvas,e.offscreenCanvas.localCanvas,e.offscreenCanvas.serviceCanvas]):this.fullWorker.postMessage(t);return}else if(this.subWorker){this.fullWorker.postMessage(t);const e=new Set;for(const r of t.values()){const n=r.msgType;(n===Rt.Init||n===Rt.Clear||n===Rt.Destroy||n===Rt.UpdateCamera||r.isRunSubWork)&&e.add(r)}e.size&&this.subWorker.postMessage(e)}}updateNode(t,e,r,n){this.taskBatchData.add({msgType:Rt.UpdateNode,workId:t,updateNodeOpt:e,viewId:r,scenePath:n,dataType:Ft.Local}),this.runAnimation()}destroyTaskQueue(){this.useTasksqueue=!1,this.useTasksClockId&&(clearTimeout(this.useTasksClockId),this.useTasksClockId=void 0),this.mainTasksqueueCount=void 0,this.workerTasksqueueCount=void 0}updateDpr(t,e){this.queryTaskBatchData({msgType:Rt.UpdateDpr,dataType:Ft.Local,viewId:t}).forEach(r=>{this.taskBatchData.delete(r)}),this.taskBatchData.add({dataType:Ft.Local,msgType:Rt.UpdateDpr,viewId:t,dpr:e,isRunSubWork:!0}),this.runAnimation()}updateCamera(t,e){var r;this.useTasksqueue||((r=this.methodBuilder)==null||r.pause(),this.blurCursor(t),this.checkDrawingWork(t),this.useTasksqueue=!0,this.mainTasksqueueCount=1,this.workerTasksqueueCount=1),this.useTasksqueue&&(this.tasksqueue.set(t,{msgType:Rt.UpdateCamera,dataType:Ft.Local,cameraOpt:{...e,width:e.width,height:e.height},scenePath:this.viewContainerManager.getCurScenePath(t),isRunSubWork:!0,viewId:t}),this.consume(),this.useTasksClockId&&clearTimeout(this.useTasksClockId),this.updateCameraDone())}updateCameraDone(){this.useTasksClockId=setTimeout(()=>{var t;this.useTasksClockId=void 0,this.mainTasksqueueCount===this.workerTasksqueueCount?(this.tasksqueue.size&&this.consume(),this.useTasksqueue=!1,this.mainTasksqueueCount=void 0,this.workerTasksqueueCount=void 0,(t=this.methodBuilder)==null||t.recover(),this.runAnimation()):this.updateCameraDone()},this.maxLastSyncTime)}consumeQueue(){const t=new Set;let e=!this.isBusy;if(this.isBusy&&this.mainTasksqueueCount&&this.workerTasksqueueCount&&this.mainTasksqueueCount<=this.workerTasksqueueCount&&(e=!0),e){this.mainTasksqueueCount&&this.workerTasksqueueCount&&this.mainTasksqueueCount++,t.add({msgType:Rt.TasksQueue,dataType:Ft.Local,isRunSubWork:!0,mainTasksqueueCount:this.mainTasksqueueCount,tasksqueue:this.tasksqueue,viewId:""});for(const[r,n]of this.tasksqueue.entries())n.cameraOpt&&this.control.textEditorManager.onCameraChange(n.cameraOpt,r)}return t}async clearViewScenePath(t,e,r){var n,i;const a=this.viewContainerManager.getCurScenePath(t);if(r){const s=(n=this.collector)==null?void 0:n.uid;if(s&&!this.control.renderControl.isClearAble({uid:s,viewId:t,scenePath:a}))return}this.control.textEditorManager.clear(t,e),this.queryTaskBatchData({msgType:Rt.Clear,dataType:Ft.Local,viewId:t}).forEach(s=>{this.taskBatchData.delete(s)}),this.taskBatchData.add({dataType:Ft.Local,msgType:Rt.Clear,viewId:t}),this.runAnimation(),e||(this.control.renderControl.isUsePageAuth(t)&&a?this.control.renderControl.clearRenderPage(t,a):(i=this.collector)==null||i.dispatch({type:Rt.Clear,viewId:t,scenePath:a})),this.zIndexNodeMethod&&this.zIndexNodeMethod.clearZIndex(t);for(const[s,u]of this.localPointsBatchData.entries())u.viewId===t&&this.localPointsBatchData.delete(s);await new Promise(s=>{const u=this.clearAllResolveMap.get(t)||{resolve:void 0,timer:void 0};u.timer&&clearTimeout(u.timer),u.resolve=s,u.timer=setTimeout(()=>{const d=this.clearAllResolveMap.get(t);d!=null&&d.resolve&&d.resolve(t)},this.maxLastSyncTime),this.clearAllResolveMap.set(t,u)}).then(s=>{this.clearAllResolveMap.delete(s)})}internalMsgEmitterListener(){var t;this.methodBuilder=new Qt([jt.CopyNode,jt.SetColorNode,jt.DeleteNode,jt.RotateNode,jt.ScaleNode,jt.TranslateNode,jt.ZIndexNode,jt.SetFontStyle,jt.SetPoint,jt.SetLock,jt.SetShapeOpt]).registerForMainEngine(Vt.MainEngine,this.control),this.zIndexNodeMethod=(t=this.methodBuilder)==null?void 0:t.getBuilder(jt.ZIndexNode)}setZIndex(t){const e=this.currentToolsData&&St.cloneDeep(this.currentToolsData.toolsOpt);return e&&this.zIndexNodeMethod&&this.isUseZIndex&&(this.zIndexNodeMethod.addMaxLayer(t),e.zIndex=this.zIndexNodeMethod.getMaxZIndex(t)),e}checkDrawingWork(t){var e,r,n;let i=!1;const a=[];for(const[s,{state:u,viewId:d,points:M,opt:c}]of this.localPointsBatchData.entries())if(t===d&&u===Et.Start||u===Et.Doing){if(u===Et.Doing&&this.isCanDrawWork){Number(s)&&Number(s)+60>this.now&&(a.push(s.toString()),this.taskBatchData.add({msgType:Rt.RemoveNode,workId:s,viewId:d,dataType:Ft.Local,isRunSubWork:!0}));const v=M.map(p=>p);this.taskBatchData.add({op:v,workState:Et.Done,workId:s,dataType:Ft.Local,msgType:Rt.DrawWork,isRunSubWork:this.isRunSubWork,toolsType:(e=this.currentToolsData)==null?void 0:e.toolsType,viewId:d,opt:c,scenePath:d&&this.viewContainerManager.getCurScenePath(d)}),i=!0}this.deleteLocalPoint(s)}if((i||a.length)&&(this.consume(),a.length)){const s=(r=this.viewContainerManager.getView(t))==null?void 0:r.focusScenePath;(n=this.collector)==null||n.dispatch({type:Rt.RemoveNode,removeIds:a,viewId:t,scenePath:s})}}removeDrawingWork(t){var e,r;const n=[];for(const[i,{state:a,viewId:s}]of this.localPointsBatchData.entries())(t===s&&a===Et.Start||a===Et.Doing)&&(this.deleteLocalPoint(i),a===Et.Doing&&this.isCanDrawWork&&(n.push(i.toString()),this.taskBatchData.add({msgType:Rt.RemoveNode,workId:i,viewId:s,dataType:Ft.Local,isRunSubWork:!0})));if(n.length){this.consume();const i=(e=this.viewContainerManager.getView(t))==null?void 0:e.focusScenePath;(r=this.collector)==null||r.dispatch({type:Rt.RemoveNode,removeIds:n,viewId:t,scenePath:i})}}removeNodes(t,e){var r,n;const i=(r=this.viewContainerManager.getView(t))==null?void 0:r.focusScenePath;if(i&&e.length){for(const a of e)this.taskBatchData.add({msgType:Rt.RemoveNode,workId:a,viewId:t,dataType:Ft.Local,isRunSubWork:!1});this.consume(),(n=this.collector)==null||n.dispatch({type:Rt.RemoveNode,removeIds:e,viewId:t,scenePath:i})}}hoverCursor(t,e){var r;if(((r=this.currentToolsData)==null?void 0:r.toolsType)===ht.Selector&&!this.isBusy){const n=this.viewContainerManager.getView(e);if(n&&n.displayer&&n.displayer.vDom){const s=n.displayer.vDom.state.floatBarData;if(s){const{x:u,y:d,w:M,h:c}=s;if(k0(t,{x:u,y:d,w:M,h:c}))return}}const i=this.viewContainerManager.transformToScenePoint(t,e),a={msgType:Rt.CursorHover,dataType:Ft.Local,point:i,toolsType:this.currentToolsData.toolsType,opt:this.currentToolsData.toolsOpt,isRunSubWork:!1,viewId:e};this.queryTaskBatchData({msgType:Rt.CursorHover,dataType:Ft.Local,toolsType:this.currentToolsData.toolsType,viewId:e}).forEach(s=>{this.taskBatchData.delete(s)}),this.taskBatchData.add(a),this.runAnimation()}}blurCursor(t){var e;if(((e=this.currentToolsData)==null?void 0:e.toolsType)!==ht.Selector)return;const r={msgType:Rt.CursorBlur,dataType:Ft.Local,isRunSubWork:!1,viewId:t};this.queryTaskBatchData({msgType:Rt.CursorHover,dataType:Ft.Local,viewId:t}).forEach(n=>{this.taskBatchData.delete(n)}),this.taskBatchData.add(r),this.consume()}sendCursorEvent(t,e){var r,n,i;if(!this.currentLocalWorkData||this.currentLocalWorkData.workState===Et.Unwritable||this.isBusy)return;const a=(r=this.currentToolsData)==null?void 0:r.toolsType;if(!this.useTasksqueue&&this.workState===Et.Pending&&a===ht.Selector&&(St.isNumber(t[0])&&St.isNumber(t[1])?this.hoverCursor(t,e):t[0]===void 0&&t[1]===void 0&&this.blurCursor(e)),!this.currentToolsData||!this.isCanSentCursor||!this.control.pluginOptions.extras.cursor.enable)return;const s=(n=this.collector)==null?void 0:n.uid,u=this.viewContainerManager.getCurScenePath(e);switch((i=this.currentToolsData)==null?void 0:i.toolsType){case ht.Eraser:case ht.PencilEraser:case ht.BitMapEraser:{if(s&&!this.control.renderControl.isClearAble({uid:s,viewId:e,filterLocalSelf:!1,scenePath:u}))return;break}default:if(s&&!this.control.renderControl.isWritable||s&&!this.control.renderControl.isRenderAble({uid:s,viewId:e,filterLocalSelf:!1,scenePath:u}))return;break}let d=[void 0,void 0];this.currentToolsData&&this.isCanSentCursor&&!this.localPointsBatchData.size&&!this.getLockSentEventCursor()&&(d=t,this.control.cursor.sendEvent(d,e))}getBoundingRect(t){var e,r;if(!((e=this.boundingRectMap)!=null&&e.get(t))){const n=(r=this.collector)==null?void 0:r.getScenePathData(t);if(!n)return;if(Object.keys(n).forEach(i=>{var a;((a=this.collector)==null?void 0:a.getLocalId(i))===Wt&&delete n[i]}),Object.keys(n).length&&this.viewContainerManager.mainView&&this.viewContainerManager.mainView.cameraOpt){const i={msgType:Rt.BoundingBox,dataType:Ft.Local,scenePath:t,scenes:n,cameraOpt:{...this.viewContainerManager.mainView.cameraOpt},isRunSubWork:!0,viewId:this.viewContainerManager.mainView.id};return this.taskBatchData.add(i),this.runAnimation(),new Promise(a=>{this.boundingRectMap.set(t,a)}).then(a=>(this.boundingRectMap.delete(t),a))}}}getSnapshot(t,e,r,n){var i,a,s,u,d;if(!((i=this.snapshotMap)!=null&&i.get(t))){const M=(a=this.collector)==null?void 0:a.getViewIdBySecenPath(t);if(!M)return;const c=(s=this.collector)==null?void 0:s.getStorageData(M,t);if(!c)return;if(Object.keys(c).forEach(v=>{var p;((p=this.collector)==null?void 0:p.getLocalId(v))===Wt&&delete c[v]}),Object.keys(c).length){const v=this.viewContainerManager.mainView;if(!v)return;const p=e||((u=v.cameraOpt)==null?void 0:u.width),T=r||((d=v.cameraOpt)==null?void 0:d.height),x={msgType:Rt.Snapshot,dataType:Ft.Local,scenePath:t,scenes:c,w:p,h:T,cameraOpt:n&&{...n,width:p,height:T}||v.cameraOpt,isRunSubWork:!0,viewId:M};return this.taskBatchData.add(x),this.runAnimation(),new Promise(y=>{this.snapshotMap.set(t,y)}).then(y=>(this.snapshotMap.delete(t),y))}}}queryTaskBatchData(t){const e=[];if(t)for(const r of this.taskBatchData.values()){let n=!0;for(const[i,a]of Object.entries(t))if(r[i]!==a){n=!1;break}n&&e.push(r)}return e}insertIconify(t,e){var r;const n=this.viewContainerManager.getView(t);if(!n)throw new Error("insertIconify viewId is not exist");if(!e.src)throw new Error("iconify src must be required");if(!/^(http|https):\/\//.test(e.src))throw new Error("iconify src must be http or https");e.strokeColor||(e.strokeColor=(r=this.currentLocalWorkData.toolsOpt)==null?void 0:r.strokeColor);const i=n?.focusScenePath;if(t&&i){const a=this.now;Te.InternalMsgEmitter.emit("addUndoTicker",a,t);const s={...e,type:Dr.Iconify};this.zIndexNodeMethod&&(this.zIndexNodeMethod.addMaxLayer(t),s.zIndex=this.zIndexNodeMethod.getMaxZIndex(t)),this.taskBatchData.add({msgType:Rt.FullWork,dataType:Ft.Local,toolsType:ht.Image,workId:e.uuid,opt:s,viewId:t,willRefresh:!0,willSyncService:!0}),this.runAnimation()}}insertImage(t,e){const r=this.viewContainerManager.getView(t);if(!r)throw new Error("insertImage viewId is not exist");if(e.src&&!/^(http|https):\/\//.test(e.src))throw new Error("Image src must be http or https");const n=r?.focusScenePath;if(t&&n){const{src:i,uuid:a}=e;if(a&&!i){this.tmpImageConfigMap.set(a,e);return}const s=this.now;Te.InternalMsgEmitter.emit("addUndoTicker",s,t);const u={...e,type:Dr.Image};this.zIndexNodeMethod&&(this.zIndexNodeMethod.addMaxLayer(t),u.zIndex=this.zIndexNodeMethod.getMaxZIndex(t)),this.taskBatchData.add({msgType:Rt.FullWork,dataType:Ft.Local,toolsType:ht.Image,workId:e.uuid,opt:u,viewId:t,willRefresh:!0,willSyncService:!0}),this.runAnimation()}}lockImage(t,e,r){var n,i;const a=this.viewContainerManager.getView(t);if(!a)throw new Error("insertImage viewId is not exist");const s=a?.focusScenePath;if(t&&s&&this.collector){const u=this.collector.getStorageData(t,s);if(!u)return;for(const[d,M]of Object.entries(u))if(M&&M.toolsType===ht.Image&&M.opt.uuid===e){const c=this.now;Te.InternalMsgEmitter.emit("addUndoTicker",c,t);const v=(n=this.collector)!=null&&n.isOwn(d)?(i=this.collector)==null?void 0:i.getLocalId(d):d,p={...M.opt,locked:r,type:Dr.Image};this.taskBatchData.add({msgType:Rt.FullWork,dataType:Ft.Local,toolsType:ht.Image,workId:v,opt:p,viewId:t,willRefresh:!0,willSyncService:!0}),this.runAnimation();return}}}completeImageUpload(t,e,r){const n=this.viewContainerManager.getView(t);if(!n)throw new Error("insertImage viewId is not exist");const i=n?.focusScenePath;if(t&&i){const a=this.tmpImageConfigMap.get(e);a&&(a.src=r,this.insertImage(t,a),this.tmpImageConfigMap.delete(e));return}}getImagesInformation(t){const e=[];if(this.collector){const r=this.collector.getScenePathData(t);if(!r)return e;for(const n of Object.values(r))if(n&&n.toolsType===ht.Image){const i=n.opt;e.push({uuid:i.uuid,centerX:i.centerX,centerY:i.centerY,width:i.width,height:i.height,locked:i.locked,uniformScale:i.uniformScale,crossOrigin:i.crossOrigin})}}return e}setShapeSelectorByWorkId(t,e){this.taskBatchData.add({workId:Wt,selectIds:[t],msgType:Rt.Select,dataType:Ft.Local,viewId:e,willSyncService:!0}),this.runAnimation()}blurSelector(t,e,r){this.taskBatchData.add({workId:r||Wt,selectIds:[],msgType:Rt.Select,dataType:Ft.Service,viewId:t,scenePath:e}),this.runAnimation()}consoleWorkerInfo(){this.taskBatchData.add({msgType:Rt.Console,dataType:Ft.Local,isRunSubWork:!0,viewId:""}),this.consume()}sendClearUids(t,e){var r,n;const i=new Set;i.add({msgType:Rt.AuthClear,dataType:Ft.Local,viewId:t,clearUids:e,localUid:(r=this.collector)==null?void 0:r.uid}),this.control.hasOffscreenCanvas?this.fullWorker.postMessage(i):(n=this.mainThread)==null||n.consume(i)}async getVNodeInfo(t,e,r){if(!this.getVNodeInfoResolveMap.has(t))return this.taskBatchData.add({msgType:Rt.GetVNodeInfo,dataType:Ft.Local,isRunSubWork:!0,viewId:e,workIds:r,workId:t}),this.consume(),await new Promise(n=>{const i=this.getVNodeInfoResolveMap.get(t)||{resolve:void 0,timer:void 0};i.timer&&clearTimeout(i.timer),i.resolve=n,i.timer=setTimeout(()=>{const a=this.getVNodeInfoResolveMap.get(t);a!=null&&a.resolve&&a.resolve({uuid:t})},this.maxLastSyncTime*5),this.getVNodeInfoResolveMap.set(t,i)}).then(n=>{const{uuid:i}=n;return this.getVNodeInfoResolveMap.delete(i),n})}}class uy{constructor(t){it(this,"internalMsgEmitter"),it(this,"control"),it(this,"roomHotkeyCheckers"),it(this,"tmpCopyStore",new Map),it(this,"tmpCopyCoordInfo");var e;const{control:r,internalMsgEmitter:n}=t;this.control=r,this.internalMsgEmitter=n,this.roomHotkeyCheckers=((e=this.control.room)==null?void 0:e.viewsParams.hotKeys.nodes)||[]}get isUseSelf(){var t,e;return((e=(t=this.control)==null?void 0:t.room)==null?void 0:e.disableDeviceInputs)||!1}get isSelector(){var t;return((t=this.control.worker.currentToolsData)==null?void 0:t.toolsType)===ht.Selector}get collector(){return this.control.collector}get mainEngine(){return this.control.worker}get keyboardKind(){return/^Mac/i.test(navigator.platform)?"mac":"windows"}getEventKey(t){switch(t.type){case"keydown":return"KeyDown"}return"KeyUp"}onActiveHotkey(t){var e,r,n;const i=this.control.viewContainerManager.focuedViewId,a=(e=this.control.viewContainerManager.focuedView)==null?void 0:e.focusScenePath;if(i&&a)switch(t){case"delete":this.isSelector&&(r=this.collector)!=null&&r.hasSelector(i,a)&&Qt.emitMethod(Vt.MainEngine,jt.DeleteNode,{workIds:[Wt],viewId:i});break;case"copy":this.isSelector&&(n=this.collector)!=null&&n.hasSelector(i,a)&&this.copySelectorToTemp(i,a);break;case"paste":this.tmpCopyStore.size&&this.pasteTempToFocusView(i,a);break}(t==="changeToPencil"||t==="redo"||t==="undo")&&this.onSelfActiveHotkey(t)}colloctHotkey(t){if(this.isUseSelf){const e=this.checkHotkey(t);e&&this.onSelfActiveHotkey(e)}}onSelfActiveHotkey(t){switch(t){case"changeToPencil":this.setMemberState({currentApplianceName:Xt.pencil,useNewPencil:!0});break;case"changeToArrow":this.setMemberState({currentApplianceName:Xt.arrow});break;case"changeToClick":this.setMemberState({currentApplianceName:Xt.clicker});break;case"changeToEllipse":this.setMemberState({currentApplianceName:Xt.ellipse});break;case"changeToEraser":this.setMemberState({currentApplianceName:Xt.eraser});break;case"changeToHand":this.setMemberState({currentApplianceName:Xt.hand});break;case"changeToLaserPointer":this.setMemberState({currentApplianceName:Xt.laserPointer});break;case"changeToSelector":this.setMemberState({currentApplianceName:Xt.selector});break;case"changeToRectangle":this.setMemberState({currentApplianceName:Xt.rectangle});break;case"changeToStraight":this.setMemberState({currentApplianceName:Xt.straight});break;case"redo":this.control.room&&!this.control.room.disableSerialization&&this.control.viewContainerManager.redo();break;case"undo":this.control.room&&!this.control.room.disableSerialization&&this.control.viewContainerManager.undo();break;case"changeToText":this.setMemberState({currentApplianceName:Xt.text});break;case"changeToPencilEraser":this.setMemberState({currentApplianceName:Xt.pencilEraser});break;case"delete":case"copy":case"paste":this.onActiveHotkey(t);break}}checkHotkey(t){for(const e of this.roomHotkeyCheckers){const{kind:r,checker:n}=e;if(n({nativeEvent:t,kind:this.getEventKey(t),key:t.key,altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey},this.keyboardKind))return r}}copySelectorToTemp(t,e){var r,n;const i=this.control.viewContainerManager.getView(t),a=(n=(r=this.mainEngine)==null?void 0:r.methodBuilder)==null?void 0:n.getBuilder(jt.CopyNode);if(!i||!this.collector||!a)return;const s=this.collector.transformKey(Wt),u=this.collector.getStorageData(t,e);if(!u)return;const d=u[s],M=d&&a.copySelector({viewId:t,store:d});M&&(this.tmpCopyCoordInfo=M?.copyCoordInfo,this.tmpCopyStore=M?.copyStores)}pasteTempToFocusView(t,e){var r,n;const i=this.control.viewContainerManager.getView(t),a=(n=(r=this.mainEngine)==null?void 0:r.methodBuilder)==null?void 0:n.getBuilder(jt.CopyNode);if(!(!i||!this.tmpCopyCoordInfo||!this.tmpCopyStore.size||!this.collector||!a)&&i.viewData&&this.tmpCopyCoordInfo){const s=St.cloneDeep(this.tmpCopyCoordInfo.offset),u=this.tmpCopyCoordInfo.cameraOpt,d=i.viewData.camera;s.x=s.x+d.centerX-u.centerX,s.y=s.y+d.centerY-u.centerY;const M=this.control.worker.now;this.control.worker.internalMsgEmitter.emit("addUndoTicker",M,t),a.pasteSelector({viewId:t,scenePath:e,copyStores:St.cloneDeep(this.tmpCopyStore),copyCoordInfo:{offset:s,cameraOpt:d},undoTickerId:M})}}setMemberState(t){var e;(e=this.control.room)==null||e.setMemberState(t)}}class hy{constructor(t){it(this,"control"),it(this,"roomMemberManager"),it(this,"worker"),it(this,"publicMsgEmitter"),it(this,"renderUids",new Map),it(this,"pageAuth",new Map),it(this,"isLocalRender",!1),it(this,"isCurWritable",!1);var e;const{control:r,publicMsgEmitter:n}=t;this.control=r,this.publicMsgEmitter=n,this.roomMemberManager=r.roomMember,this.worker=r.worker,this.isCurWritable=((e=this.control.room)==null?void 0:e.isWritable)||!1}get isWritable(){return this.isCurWritable}onWritableChange(t){this.isCurWritable=t}addPage(t,e=!0){var r,n;const{viewId:i,render:a="localSelf",elementIds:s,pageId:u=(r=this.control.collector)==null?void 0:r.uid}=t,d=this.pageAuth.get(i)||new Map,M=this.control.viewContainerManager.getCurScenePath(i);if(M&&u){const c=d.get(M)||{render:"localSelf",pages:new Map};e&&(c.render=a);const v=s&&this.cloneElementIds(i,M,s,u)||new Set;c.pages.set(u,v),d.set(M,c),this.pageAuth.set(i,d),e&&this.pageAuthEffect(i),this.isLocalRender=!1,(n=this.control.collector)==null||n.dispatchPageAuth({operation:Se.addPage,viewId:i,scenePath:M,pageId:u,pageData:{render:a,elementIds:v}},!0)}}delPage(t,e){var r,n;const i=this.pageAuth.get(e);if(!i)return;const a=[...i.keys()].find(u=>{const d=i.get(u);return!!(d&&d.pages.has(t))});if(!a)return;const s=i.get(a);if(s){const{render:u,pages:d}=s,M=u==="localSelf"?(r=this.control.collector)==null?void 0:r.uid:u,c=d.get(t);c!=null&&c.size&&this.delElementIds(e,a,c),d.delete(t),M===t&&this.pageAuthEffect(e)}(n=this.control.collector)==null||n.dispatchPageAuth({operation:Se.deletePage,viewId:e,scenePath:a,pageId:t},!0)}delViewPage(t,e=!0){var r;this.pageAuth.get(t)&&(this.pageAuth.delete(t),e&&((r=this.control.collector)==null||r.dispatchPageAuth({operation:Se.clearView,viewId:t},e)))}clearRenderPage(t,e,r=!0){var n,i;const a=this.pageAuth.get(t);if(!a)return;const s=a.get(e);let u;if(s){const{render:d,pages:M}=s,c=d==="localSelf"?(n=this.control.collector)==null?void 0:n.uid:d;if(c){if(r){const v=M.get(c);v&&this.delElementIds(t,e,v)}M.set(c,new Set),u=c}}r&&u&&((i=this.control.collector)==null||i.dispatchPageAuth({operation:Se.clearPage,viewId:t,scenePath:e,pageId:u},r))}hasPage(t,e,r){const n=this.pageAuth.get(e);if(!n)return!1;const i=n.get(r);return i?i.pages.has(t):!1}getPageInfo(t,e,r){const n=this.pageAuth.get(e);if(!n)return;const i=n.get(r);if(i)return i.pages.get(t)}addRenderPageElementId(t,e=!0,r=!1){var n,i;const{viewId:a,elementId:s,scenePath:u}=t,d=this.pageAuth.get(a);if(!d)throw new Error(`no view info in viewId: ${a}`);const M=d.get(u);let c;if(M){const{render:v,pages:p}=M,T=v==="localSelf"?(n=this.control.collector)==null?void 0:n.uid:v;if(T&&p.has(T)){const x=p.get(T)||new Set;x.add(s),p.set(T,x),c=T}}r&&this.pageAuthEffect(a),e&&c&&((i=this.control.collector)==null||i.dispatchPageAuth({operation:Se.addElement,viewId:a,scenePath:u,pageId:c,pageData:{elementId:s}},e))}delRenderPageElementId(t,e=!0,r=!1){var n,i;const{viewId:a,elementId:s,scenePath:u}=t,d=this.pageAuth.get(a);if(!d)throw new Error(`no view info in viewId: ${a}`);const M=d.get(u);let c;if(M){const{render:v,pages:p}=M,T=v==="localSelf"?(n=this.control.collector)==null?void 0:n.uid:v;if(T&&p.has(T)){const x=p.get(T);x&&(x.delete(s),p.set(T,x),c=T)}}r&&this.pageAuthEffect(a),e&&c&&((i=this.control.collector)==null||i.dispatchPageAuth({operation:Se.deleteElement,viewId:a,scenePath:u,pageId:c,pageData:{elementId:s}},e))}setPageRender(t,e,r,n=!0){var i;const a=this.pageAuth.get(t);if(!a)throw new Error(`no view info in viewId: ${t}`);const s=a.get(e);s&&(s.render=r),e===this.control.viewContainerManager.getCurScenePath(t)&&this.pageAuthEffect(t),n||(this.isLocalRender=!0),n&&(this.isLocalRender=!1,(i=this.control.collector)==null||i.dispatchPageAuth({operation:Se.renderPage,viewId:t,scenePath:e,pageData:{render:r}},n))}isRenderAble(t){var e,r;const{uid:n,viewId:i,filterLocalSelf:a=!0,scenePath:s}=t,u=this.renderUids.get(i);if(u){const{render:M,hide:c}=u;if(M===void 0&&c===void 0)return!0;if(St.isSet(M)){if(M.has(n)||a&&((e=this.control.collector)==null?void 0:e.uid)===n&&M.has("localSelf"))return!0}else if(M===!0&&(!c||St.isSet(c)&&!c.has(n)&&!(a&&c.has("localSelf")&&((r=this.control.collector)==null?void 0:r.uid)===n)))return!0;return!1}const d=this.pageAuth.get(i);if(d&&s){const M=d.get(s);if(M){const{render:c}=M;if(c)return!(c==="localSelf"&&!a)}}return!0}isClearAble(t){var e;const{uid:r,viewId:n,filterLocalSelf:i=!0,scenePath:a}=t,s=this.renderUids.get(n);if(s){const{clear:d}=s;return!!(d===void 0||d===!0||St.isSet(d)&&(d.has(r)||i&&((e=this.control.collector)==null?void 0:e.uid)===r&&d.has("localSelf")))}const u=this.pageAuth.get(n);if(u&&a){const d=u.get(a);if(d){const{render:M}=d;if(M)return!(M==="localSelf"&&!i)}}return!0}isFilterAble(t,e){var r,n,i,a;const{viewId:s,scenePath:u,elementId:d}=t,M=this.renderUids.get(s);if(M&&d){const{render:v,hide:p}=M;if(v===void 0&&p===void 0)return!0;const T=(r=this.control.collector)==null?void 0:r.getUidFromKey(d);return T?!!(St.isSet(v)&&(v.has(T)||v.has("localSelf")&&((n=this.control.collector)==null?void 0:n.uid)===T)||v===!0&&(!p||St.isSet(p)&&!p.has(T)&&!(p.has("localSelf")&&((i=this.control.collector)==null?void 0:i.uid)===T))):!1}const c=this.pageAuth.get(s);if(c&&u&&d){const v=c.get(u);if(v){const{render:p,pages:T}=v;if(!p)return!0;const x=(a=this.control.collector)==null?void 0:a.uid,y=p==="localSelf"?x:p,C=y&&T.get(y)||void 0;if(C)switch(e){case Rt.RemoveNode:return!0;default:return C.has(d)}return!1}}return!0}isFilterCursor(t){if(this.isUsePageAuth(t)){const e=this.control.viewContainerManager.getCurScenePath(t),r=this.pageAuth.get(t);if(e&&r){const n=r.get(e);if(n){const{render:i}=n;return i!=="localSelf"}}}return!0}isUsePageAuth(t){var e;if(!this.pageAuth.has(t))return!1;const r=this.control.viewContainerManager.getCurScenePath(t);return r&&((e=this.pageAuth.get(t))==null?void 0:e.has(r))||!1}publishRender(t){var e;const{viewId:r,option:n,isSync:i=!0}=t,a={};if(n){const{render:s,hide:u,clear:d}=n;s&&(a.render=s===!0&&!0||new Set(s)),u&&(a.hide=u===!0&&!0||new Set(u)),d&&(a.clear=d===!0&&!0||new Set(d)),this.renderUids.set(r,a)}else this.renderUids.delete(r);i&&((e=this.control.collector)==null||e.dispatchRenderAuth({operation:je.setAuth,viewId:r,renderData:a},i)),this.renderEffect(r)}publishOneRender(t,e,r,n=!0){var i;const a=this.renderUids.get(t);let s;switch(r){case"show":a?(a.render||(a.render=new Set),St.isSet(a.render)&&a.render.add(e),St.isSet(a.hide)&&a.hide.delete(e)):this.renderUids.set(t,{render:new Set([e])}),s=je.setShow;break;case"hide":a?(a.hide||(a.hide=new Set),St.isSet(a.hide)&&a.hide.add(e),St.isSet(a.render)&&a.render.delete(e)):this.renderUids.set(t,{hide:new Set([e])}),s=je.setHide;break}a?this.renderUids.set(t,a):this.renderUids.delete(t),n&&s&&((i=this.control.collector)==null||i.dispatchRenderAuth({operation:s,viewId:t,uid:e},n)),this.renderEffect(t)}publishOneClear(t,e,r,n=!0){var i;const a=this.renderUids.get(t);r?a?(a.clear||(a.clear=new Set),St.isSet(a.clear)&&a.clear.add(e)):this.renderUids.set(t,{clear:new Set([e])}):a&&St.isSet(a.clear)&&a.clear.has(e)&&a.clear.delete(e),a?this.renderUids.set(t,a):this.renderUids.delete(t),n&&((i=this.control.collector)==null||i.dispatchRenderAuth({operation:je.setClear,viewId:t,uid:e,isClear:r},n)),this.renderEffect(t)}syncRenderUids(t,e,r,n){const i=e===!0?!0:e&&Object.keys(e)?new Set(Object.keys(e)):void 0,a=r===!0?!0:r&&Object.keys(r)?new Set(Object.keys(r)):void 0,s=n===!0?!0:n&&Object.keys(n)?new Set(Object.keys(n)):void 0;i||a||s?this.renderUids.set(t,{render:i,hide:a,clear:s}):this.renderUids.delete(t),this.renderEffect(t),this.publicMsgEmitter.emit("syncRenderUids",t,{render:i,hide:a,clear:s})}syncPageAuth(t,e,r=!1){let n=!1;if(!e)this.pageAuth.delete(t);else{const i=this.pageAuth.get(t)||new Map;for(const[a,s]of Object.entries(e)){const{render:u,pages:d}=s,M=i.get(a),c=this.isLocalRender?M?.render:u;if(c){c!==M?.render&&(n=!0);const v=new Map;for(const[T,x]of Object.entries(d))v.set(T,new Set(Object.keys(x)));const p={render:c,pages:v};v.size&&i.set(a,p)}}i.size&&(this.pageAuth.set(t,i),this.publicMsgEmitter.emit("syncPageAuth",t,i))}(r||n)&&this.pageAuthEffect(t)}destoryByViewId(t,e=!1){var r;this.renderUids.has(t)&&(this.renderUids.delete(t),e||(r=this.control.collector)==null||r.dispatchRenderAuth({operation:je.setAuth,viewId:t})),this.pageAuth.has(t)&&this.control.renderControl.delViewPage(t,!e)}renderEffect(t){var e;const r=(e=this.control.viewContainerManager.getView(t))==null?void 0:e.focusScenePath;r&&this.worker.clearViewScenePath(t,!0).then(()=>{var n;this.worker.pullServiceData(t,r,{isAsync:!0,useAnimation:!1}),this.worker.sendClearUids(t,(n=this.renderUids.get(t))==null?void 0:n.clear)})}pageAuthEffect(t){var e;const r=(e=this.control.viewContainerManager.getView(t))==null?void 0:e.focusScenePath;r&&this.worker.clearViewScenePath(t,!0).then(()=>{this.worker.pullServiceData(t,r,{isAsync:!0,useAnimation:!1}),this.worker.sendClearUids(t,!0)})}cloneElementIds(t,e,r,n){var i,a;const s=(i=this.control.collector)==null?void 0:i.getStorageData(t,e),u=new Set;if(s){for(const d of Object.keys(s))if(r.has(d)){const M=`${d}_${n}`;if(u.add(M),!Object.keys(s).includes(M)){const c=St.cloneDeep(s[d]);(a=this.control.collector)==null||a.updateValue(M,{type:Rt.FullWork,...c,workId:M},{isSync:!0,viewId:t,scenePath:e})}}}return u}delElementIds(t,e,r){var n,i;const a=(n=this.control.collector)==null?void 0:n.getStorageData(t,e);if(a)for(const s of Object.keys(a))r.has(s)&&Object.keys(a).includes(s)&&((i=this.control.collector)==null||i.updateValue(s,void 0,{isSync:!0,viewId:t,scenePath:e}))}}class fy{constructor(t){it(this,"internalMsgEmitter"),it(this,"control"),it(this,"maps",new Map),it(this,"showId"),it(this,"color"),it(this,"timer"),it(this,"updateMiniMapCamera",St.debounce(async i=>{const a=this.maps.get(i);if(a){const s=await this.getMiniMapCamera(i);if(s){const u=s.width/s.scale,d=s.height/s.scale,M=a.miniMapCamera.width/a.miniMapCamera.scale,c=a.miniMapCamera.height/a.miniMapCamera.scale;(u>=M||d>=c)&&(a.miniMapCamera=s);const v=a.miniMapCanvas.current;if(v){const p=v.getContext("2d");if(p){const T=this.control.viewContainerManager.getView(i);if(!(T!=null&&T.focusScenePath))return;const{miniMapCamera:x,contianer:y}=a,{width:C,height:h}=y.getBoundingClientRect(),g=Math.min(C/x.width,h/x.height);p.clearRect(0,0,v.width,v.height),v.width=x.width,v.height=x.height,v.style.width=`${x.width*g}px`,v.style.height=`${x.height*g}px`,await this.control.screenshotToCanvas(p,T.focusScenePath,x.width,x.height,x),this.listener.emitAsync([i,"viewCameraUpate"],1)}}}}},2e3,{maxWait:5e3}));var e;const{control:r,internalMsgEmitter:n}=t;this.control=r,this.internalMsgEmitter=n,this.color=((e=this.control.worker.currentToolsData)==null?void 0:e.toolsOpt.strokeColor)||"#000"}get listener(){return this.internalMsgEmitter}get activeViewId(){return this.showId}get highlightColor(){return this.color}setHighlightColor(t){this.color=t}async createMiniMap(t,e,r){const n=this.control.viewContainerManager.getView(t);if(!n)throw new Error("view not found");const i=n.cameraOpt;if(!i)throw new Error("view camera not found");const{width:a,height:s}=e.getBoundingClientRect();if(!a||!s)throw new Error("contianer width or height is 0");const u=ot.createRef();this.maps.set(t,{contianer:e,miniMapCanvas:u,miniMapCamera:r,viewCamera:i}),this.showId=t,this.control.viewContainerManager.setActiveMiniMap(this.showId,!0);const d=Math.min(a/r.width,s/r.height),M=await new Promise(c=>{this.listener.once([t,"miniMapCreate"],()=>{const v=u.current;v&&(v.width=r.width,v.height=r.height,v.style.width=`${r.width*d}px`,v.style.height=`${r.height*d}px`),c(!0)}),this.timer=setTimeout(()=>{c(!1)},2e3)});return this.timer&&clearTimeout(this.timer),M}async getMiniMapCamera(t){const e=this.control.viewContainerManager.getView(t);if(!e)return;const{cameraOpt:r,focusScenePath:n}=e;if(!r||!n)return;const i={originX:r.centerX-r.width/r.scale/2,originY:r.centerY-r.height/r.scale/2,width:r.width/r.scale,height:r.height/r.scale};let a=await this.control.getBoundingRect(n)||i;a=Ti(a,i)||i;let s=a.width,u=a.height,d=1;const M=s>r.width&&Math.min(r.width/s,d)||d,c=u>r.height&&Math.min(r.height/u,d)||d;return M<=c?(s=M<1&&r.width||s,u=Math.floor(u*M)+1,d=M):M>c&&(u=c<1&&r.height||u,s=Math.floor(s*c)+1,d=c),{scale:d,centerX:a.originX+a.width/2,centerY:a.originY+a.height/2,width:s,height:u}}getMiniMapCanvas(t){const e=this.maps.get(t);return e?.miniMapCanvas.current||null}updateViewCamera(t,e){const r=this.maps.get(t);r&&(r.viewCamera=e,this.listener.emitAsync([t,"viewCameraUpate"],1))}destroyMiniMap(t){const e=t||this.showId;e&&(this.maps.delete(e),this.control.viewContainerManager.setActiveMiniMap(e,!1))}}class dy{constructor(t){it(this,"control"),it(this,"worker"),it(this,"publicMsgEmitter"),it(this,"plugins",new Map);const{control:e,publicMsgEmitter:r}=t;this.control=e,this.publicMsgEmitter=r,this.worker=e.worker}use(t){this.plugins.set(t.kind,t),t._inject(this.control),t.onCreate()}destroy(){this.plugins.forEach(t=>{this.plugins.delete(t.kind),t.onDestroy()})}dispatchPluginEvent(t,...e){this.plugins.forEach(r=>{r._onEvent(t,e)})}}const $n=class _r{constructor(t){it(this,"version",Eo),it(this,"plugin"),it(this,"room"),it(this,"play"),it(this,"collector"),it(this,"hasSwitchToSelectorEffect"),it(this,"snapshootStateMap"),it(this,"_disableDeviceInputs"),it(this,"_disableEraseImage"),it(this,"_disableEraseText"),it(this,"_disableCameraTransform"),it(this,"_disableUseWorker",!1),it(this,"effectResolve"),it(this,"hotkeyManager"),it(this,"pluginOptions"),it(this,"roomMember"),it(this,"cursor"),it(this,"textEditorManager"),it(this,"worker"),it(this,"renderControl"),it(this,"miniMapManager"),it(this,"pluginManager"),it(this,"_isPolyfill",{requestIdleCallback:!1,cancelIdleCallback:!1}),it(this,"onSceneChange",async(s,u)=>{var d;const M=this.viewContainerManager.getView(u);M!=null&&M.focusScenePath&&(d=this.collector)!=null&&d.hasSelector(u,M.focusScenePath)&&this.worker.blurSelector(u,M.focusScenePath),this.textEditorManager.checkEmptyTextBlur();const c=M?.displayer;c&&(c.setActive(!1),await c.stopEventHandler());const v=s;v&&this.viewContainerManager.setViewScenePath(u,v),c?.setActive(!0)}),it(this,"onRoomMembersChange",s=>{this.roomMember.setRoomMembers(Bt.toJS(s))}),it(this,"onMemberChange",St.throttle(s=>{var u,d;if(!this.room||!this.worker||!s||!this.room.isWritable)return;const M=this.getToolsKey(s),c=(u=this.worker.getCurrentToolsData())==null?void 0:u.toolsType,v=this.viewContainerManager.focuedViewId;v&&c===ht.Selector&&M!==ht.Selector&&this.worker.blurCursor(v);const p=this.getToolsOpt(M,s);this.worker.setCurrentToolsData(p),(d=this.pluginManager)==null||d.dispatchPluginEvent("setToolkey",M),this.effectViewContainer(M),this.effectResolve&&this.effectResolve(!0)},100,{leading:!1})),it(this,"internalSceneChange",(s,u)=>{var d,M,c,v;this.isUseSimple||((d=this.miniMapManager)==null?void 0:d.activeViewId)===s&&((M=this.miniMapManager)==null||M.destroyMiniMap(s)),(c=this.pluginManager)==null||c.dispatchPluginEvent("sceneChange",s,u),(v=this.worker)==null||v.clearViewScenePath(s,!0).then(()=>{var p;(p=this.worker)==null||p.pullServiceData(s,u,{isAsync:!0,useAnimation:!1})})}),it(this,"internalCameraChange",(s,u)=>{var d,M;(d=this.worker)==null||d.updateCamera(s,u),this.isUseSimple||(M=this.miniMapManager)==null||M.updateViewCamera(s,u)});var e;const{displayer:r,plugin:n,options:i}=t;this.plugin=n,this.room=Bt.isRoom(r)?r:void 0,this.play=Bt.isPlayer(r)?r:void 0,this.room&&(this._disableDeviceInputs=this.room.disableDeviceInputs,this._disableEraseImage=this.room.disableEraseImage,this._disableEraseText=!1),this.pluginOptions=i,((e=i.extras)==null?void 0:e.useWorker)==="mainThread"?this._disableUseWorker=!0:this._disableUseWorker=Ps!=="worker",this.roomMember=new H0;const a={control:this,internalMsgEmitter:_r.InternalMsgEmitter,publicMsgEmitter:_r.PublicMsgEmitter};this.cursor=new Z0(a),this.textEditorManager=new cm(a),this.worker=new cy(a),this.hotkeyManager=new uy(a),this.renderControl=new hy(a),this.isUseSimple||(this.miniMapManager=new fy(a),this.pluginManager=new dy(a))}hasPolyfillMethod(t){return this._isPolyfill[t]}registerPolyfillMethod(t){this._isPolyfill[t]=!0}get hasExtendFontFaces(){return this.extendFontFaces.length>0}get extendFontFaces(){var t;return((t=this.pluginOptions.extras.textEditor)==null?void 0:t.extendFontFaces)??me.textEditor.extendFontFaces}get loadFontFacesTimeout(){var t;return((t=this.pluginOptions.extras.textEditor)==null?void 0:t.loadFontFacesTimeout)??me.textEditor.loadFontFacesTimeout}get disableEraseText(){return this._disableEraseText||!1}set disableEraseText(t){this._disableEraseText=t}get disableEraseImage(){return this._disableEraseImage||!1}set disableEraseImage(t){this._disableEraseImage=t}get disableDeviceInputs(){return this._disableDeviceInputs||!1}set disableDeviceInputs(t){var e;this._disableDeviceInputs=t;const r=(e=this.worker.getCurrentToolsData())==null?void 0:e.toolsType;r&&this.effectViewContainer(r)}get disableCameraTransform(){return this._disableCameraTransform||!1}set disableCameraTransform(t){this._disableCameraTransform=t}get disableUseWorker(){return this._disableUseWorker||!1}set disableUseWorker(t){this._disableUseWorker=t}get hasOffscreenCanvas(){return this._disableUseWorker?!1:Ps==="worker"}get canUseTransferControlToOffscreen(){return this._disableUseWorker?!1:!!HTMLCanvasElement.prototype.transferControlToOffscreen}get isUseOffscreenTransfer(){return this.isUseSimple&&this.hasOffscreenCanvas&&this.canUseTransferControlToOffscreen}get isUseSimple(){return this.pluginOptions.extras.useSimple}bindPlugin(t){this.plugin=t,this.collector&&(this.collector.removeStorageStateListener(),this.collector.removeAuthStateListener()),this.collector=new G0(this,t,this.pluginOptions.extras.syncOpt.interval),this.activePlugin()}destroy(){var t,e,r,n,i,a,s;this.roomMember.destroy(),(t=this.collector)==null||t.destroy(),(e=this.worker)==null||e.destroy(),(r=this.viewContainerManager)==null||r.destroy(),(n=this.cursor)==null||n.destroy(),(i=this.textEditorManager)==null||i.destory(),(a=this.pluginManager)==null||a.destroy(),(s=this.miniMapManager)==null||s.destroyMiniMap()}cleanCurrentScene(){const t=this.worker.now,e=this.worker.getLocalWorkViewId()||this.viewContainerManager.focuedViewId;e&&(_r.InternalMsgEmitter.emit("addUndoTicker",t,e),this.worker.clearViewScenePath(e,!1,!0))}async setWritable(t){var e,r;if(!t){(e=this.cursor)==null||e.unabled(),this.textEditorManager.checkEmptyTextBlur();const n=this.viewContainerManager.getAllViews();for(const i of n){i!=null&&i.focusScenePath&&(r=this.collector)!=null&&r.hasSelector(i.id,i.focusScenePath)&&this.worker.blurSelector(i.id,i.focusScenePath);const a=i?.displayer;a&&(a.setActive(!1),await a.stopEventHandler())}}await new Promise(n=>{setTimeout(()=>{n()},500)})}onWritableChange(t){var e;t?this.worker.abled():this.worker.unWritable(),((e=this.worker.getCurrentToolsData())==null?void 0:e.toolsType)===ht.Text&&this.viewContainerManager.focuedViewId&&(t?this.viewContainerManager.activeTextEditor(this.viewContainerManager.focuedViewId):this.viewContainerManager.unActiveTextEditor(this.viewContainerManager.focuedViewId)),this.renderControl.onWritableChange(t),this.viewContainerManager.getAllViews().forEach(r=>{const n=r?.displayer;n&&(n.bindToolsClass(),t?n.setActive(!0):n.setActive(!1))})}getToolsKey(t){const e=t.currentApplianceName;switch(this.hasSwitchToSelectorEffect=!1,e){case Xt.text:return t.textCompleteToSelector&&(this.hasSwitchToSelectorEffect=!0),ht.Text;case Xt.pencil:return t.useLaserPen?ht.LaserPen:ht.Pencil;case Xt.eraser:return ht.Eraser;case Xt.pencilEraser:return this.pluginOptions.extras.pencilEraser.useBitMap===!1?ht.PencilEraser:ht.BitMapEraser;case Xt.selector:return ht.Selector;case Xt.arrow:return t.arrowCompleteToSelector&&(this.hasSwitchToSelectorEffect=!0),ht.Arrow;case Xt.straight:return t.straightCompleteToSelector&&(this.hasSwitchToSelectorEffect=!0),ht.Straight;case Xt.ellipse:return t.ellipseCompleteToSelector&&(this.hasSwitchToSelectorEffect=!0),ht.Ellipse;case Xt.rectangle:return t.rectangleCompleteToSelector&&(this.hasSwitchToSelectorEffect=!0),ht.Rectangle;case Xt.shape:if(t.shapeCompleteToSelector&&(this.hasSwitchToSelectorEffect=!0),t.shapeType===Le.Pentagram||t.shapeType===Le.Star)return ht.Star;if(t.shapeType===Le.Polygon||t.shapeType===Le.Triangle||t.shapeType===Le.Rhombus)return ht.Polygon;if(t.shapeType===Le.SpeechBalloon)return ht.SpeechBalloon;break}return ht.Clicker}getToolsOpt(t,e){if(t===ht.Clicker)return{toolsType:t,toolsOpt:{}};const r={strokeColor:xr(e.strokeColor[0],e.strokeColor[1],e.strokeColor[2],e.strokeOpacity||1),thickness:e.strokeWidth,isOpacity:e?.strokeOpacity&&e.strokeOpacity<1||e?.fillOpacity&&e.fillOpacity<1||e?.textOpacity&&e.textOpacity<1||e?.textBgOpacity&&e.textBgOpacity<1||!1};switch(t){case ht.Text:r.fontFamily=window.getComputedStyle(document.documentElement).getPropertyValue("font-family"),r.fontSize=e?.textSizeOverride||e?.textSize||Number(window.getComputedStyle(document.body).fontSize),r.textAlign=e?.textAlign||"left",r.verticalAlign=e?.verticalAlign||"middle",r.fontColor=e?.textColor&&xr(e.textColor[0],e.textColor[1],e.textColor[2],e.textOpacity||1)||r.strokeColor||"rgba(0,0,0,1)",r.fontBgColor=Array.isArray(e?.textBgColor)&&xr(e.textBgColor[0],e.textBgColor[1],e.textBgColor[2],e.textBgOpacity||1)||"transparent",r.bold=e?.bold&&"bold"||void 0,r.italic=e?.italic&&"italic"||void 0,r.underline=e?.underline||void 0,r.lineThrough=e?.lineThrough||void 0,r.text="",r.strokeColor=void 0;break;case ht.Pencil:{const n=e?.strokeType||se.Normal;r.strokeType=n,r.lineCap=this.getLineCap(n),r.lineDash=this.getLineDash(n);break}case ht.PencilEraser:case ht.BitMapEraser:case ht.Eraser:r.thickness=Math.min(4,Math.max(1,Math.floor(e.pencilEraserSize||1)))-1;break;case ht.LaserPen:{r.duration=e?.duration||1,e!=null&&e.strokeType&&e?.strokeType===se.Stroke?r.strokeType=se.Normal:r.strokeType=e?.strokeType||se.Normal;const n=r.strokeType;r.lineCap=this.getLineCap(n),r.lineDash=this.getLineDash(n);break}case ht.Arrow:case ht.Straight:{e!=null&&e.strokeType&&e?.strokeType===se.Stroke?r.strokeType=se.Normal:r.strokeType=e?.strokeType||se.Normal;const n=r.strokeType;r.strokeType=n,r.lineCap=this.getLineCap(n),r.lineDash=this.getLineDash(n);break}case ht.Ellipse:case ht.Rectangle:case ht.Star:case ht.Polygon:case ht.SpeechBalloon:{e!=null&&e.strokeType&&e?.strokeType===se.Stroke?r.strokeType=se.Normal:r.strokeType=e?.strokeType||se.Normal;const n=r.strokeType;r.lineCap=this.getLineCap(n),r.lineDash=this.getLineDash(n),t===ht.Star&&(e.shapeType===Le.Pentagram?(r.vertices=10,r.innerVerticeStep=2,r.innerRatio=.4):e!=null&&e.vertices&&e!=null&&e.innerVerticeStep&&e!=null&&e.innerRatio&&(r.vertices=e.vertices,r.innerVerticeStep=e.innerVerticeStep,r.innerRatio=e.innerRatio)),t===ht.Polygon&&(e.shapeType===Le.Triangle?r.vertices=3:e.shapeType===Le.Rhombus?r.vertices=4:e.vertices&&(r.vertices=e.vertices)),r.fillColor=e?.fillColor&&xr(e.fillColor[0],e.fillColor[1],e.fillColor[2],e?.fillOpacity)||"transparent",t===ht.SpeechBalloon&&(r.placement=e.placement||"bottomLeft");break}}return{toolsType:t,toolsOpt:r}}getLineCap(t){switch(t){case se.Normal:return this.pluginOptions.extras.normalStroke.lineCap||me.normalStroke.lineCap;case se.Dotted:return this.pluginOptions.extras.dottedStroke.lineCap||me.dottedStroke.lineCap;case se.LongDotted:return this.pluginOptions.extras.longDottedStroke.lineCap||me.longDottedStroke.lineCap;default:return}}getLineDash(t){switch(t){case se.Normal:return;case se.Dotted:{const{segment:e,gap:r}=this.pluginOptions.extras.dottedStroke||me.dottedStroke;return[e,r]}case se.LongDotted:{const{segment:e,gap:r}=this.pluginOptions.extras.longDottedStroke||me.longDottedStroke;return[e,r]}default:return}}effectViewContainer(t){var e,r,n,i,a;if(this.disableDeviceInputs===!0)this.room.disableDeviceInputs=!0,(e=this.worker)==null||e.unWritable(),(r=this.cursor)==null||r.unabled();else switch(t!==ht.Text&&this.viewContainerManager.focuedViewId&&this.viewContainerManager.unActiveTextEditor(this.viewContainerManager.focuedViewId),t){case ht.Text:case ht.Pencil:case ht.LaserPen:case ht.Arrow:case ht.Straight:case ht.Rectangle:case ht.Ellipse:case ht.Star:case ht.Polygon:case ht.SpeechBalloon:case ht.Triangle:case ht.Rhombus:case ht.Eraser:case ht.PencilEraser:case ht.BitMapEraser:case ht.Selector:this.room.disableDeviceInputs=!0,(n=this.worker)==null||n.abled(),t===ht.Text&&this.viewContainerManager.focuedViewId&&this.viewContainerManager.activeTextEditor(this.viewContainerManager.focuedViewId);break;default:this.room.disableDeviceInputs=!1,(i=this.worker)==null||i.unWritable(),(a=this.cursor)==null||a.unabled();break}setTimeout(()=>{this.viewContainerManager.getAllViews().forEach(s=>{s!=null&&s.displayer&&s.displayer.bindToolsClass()})},0)}async getBoundingRect(t){var e,r,n,i,a;const s=await((e=this.worker)==null?void 0:e.getBoundingRect(t));if(s){const u=((n=(r=this.viewContainerManager.mainView)==null?void 0:r.viewData)==null?void 0:n.convertToPointInWorld({x:s.x,y:s.y}))||{x:s.x,y:s.y},d=((a=(i=this.viewContainerManager.mainView)==null?void 0:i.viewData)==null?void 0:a.camera.scale)||1;return{width:Math.floor(s.w/d)+1,height:Math.floor(s.h/d)+1,originX:u.x,originY:u.y}}}async screenshotToCanvas(t,e,r,n,i,a,s){const u=await this.worker.getSnapshot(e,r,n,i);u&&(t.drawImage(u,a||0,s||0),u.close())}async scenePreview(t,e){var r,n,i,a;const s=(r=this.collector)==null?void 0:r.getViewIdBySecenPath(t);if(!s)return;const u=this.viewContainerManager.getView(s);if(!u||!((n=u.cameraOpt)!=null&&n.width)||!((i=u.cameraOpt)!=null&&i.height))return;const d=await((a=this.worker)==null?void 0:a.getSnapshot(t));if(d&&this.worker){const M=document.createElement("canvas"),c=M.getContext("2d"),{width:v,height:p}=u.cameraOpt;M.width=v,M.height=p,c&&(c.drawImage(d,0,0),e.crossOrigin="anonymous",e.src=M.toDataURL(),e.onload=()=>{M.remove()},e.onerror=()=>{M.remove(),e.remove()}),d.close()}}switchToText(){var t;(t=this.room)==null||t.setMemberState({currentApplianceName:Xt.text})}switchToSelector(){var t;(t=this.room)==null||t.setMemberState({currentApplianceName:Xt.selector})}async runEffectWork(t){if(this.hasSwitchToSelectorEffect){const e=await new Promise(r=>{this.switchToSelector(),this.effectResolve=r});this.effectResolve=void 0,e&&t&&t()}}setSnapshootData(){var t;this.room&&(this.snapshootStateMap=new Map,this.snapshootStateMap.set("memberState",(t=this.room)==null?void 0:t.state.memberState))}getSnapshootData(t){var e;return(e=this.snapshootStateMap)==null?void 0:e.get(t)}clearSnapshootData(){var t;(t=this.snapshootStateMap)==null||t.clear(),this.snapshootStateMap=void 0}useBitMapEraser(t){this.pluginOptions.extras.pencilEraser.useBitMap=t}consoleWorkerInfo(){var t;(t=this.worker)==null||t.consoleWorkerInfo()}filterRenderByUid(t,e,r=!0){var n;this.viewContainerManager.getView(t)&&((n=this.renderControl)==null||n.publishRender({viewId:t,option:e,isSync:r}))}cancelFilterRender(t,e=!0){var r;(r=this.renderControl)==null||r.publishRender({viewId:t,isSync:e})}async createMiniMap(t,e){var r,n,i;if(this.isUseSimple)throw new Error("simple mode not support createMiniMap");const a=await((r=this.miniMapManager)==null?void 0:r.getMiniMapCamera(t));if(a&&await((n=this.miniMapManager)==null?void 0:n.createMiniMap(t,e,a))){const s=(i=this.miniMapManager)==null?void 0:i.getMiniMapCanvas(t);if(s){const u=s.getContext("2d");if(u){const d=this.viewContainerManager.getView(t);d!=null&&d.focusScenePath&&this.screenshotToCanvas(u,d.focusScenePath,a.width,a.height,a)}}}}async destroyMiniMap(t){var e;(e=this.miniMapManager)==null||e.destroyMiniMap(t)}insertIconify(t,e){var r;if(this.viewContainerManager.getView(t)&&this.room){const n=this.room.state.memberState,i=xr(n.strokeColor[0],n.strokeColor[1],n.strokeColor[2],n.strokeOpacity||1);(r=this.worker)==null||r.insertIconify(t,{...e,strokeColor:i})}}usePlugin(t){var e;if(this.isUseSimple)throw new Error("simple mode not support usePlugin");return(e=this.pluginManager)==null?void 0:e.use(t)}async stopDraw(t){var e;const r=this.viewContainerManager.getView(t);r&&await((e=r.displayer)==null?void 0:e.stopEventHandler())}};it($n,"InternalMsgEmitter",new Vn),it($n,"PublicMsgEmitter",new Vn);let Te=$n;const tn=class Jn{constructor(t){it(this,"emitter",new Vn),it(this,"undoStack"),it(this,"redoStack"),it(this,"worker"),it(this,"control"),it(this,"room"),it(this,"isTicking"),it(this,"undoTickerId"),it(this,"viewId"),it(this,"scenePath"),it(this,"tickStartStorerCache"),it(this,"excludeIds",new Set),it(this,"onChangeScene",St.debounce(()=>{const i=this.control.viewContainerManager.getCurScenePath(this.viewId);if(i){let a=this.undoStack.filter(u=>u.scenePath===i).length;const s=this.redoStack.filter(u=>u.scenePath===i).length;a===0&&s===0&&this.tickStartStorerCache&&this.scenePath===i&&(a=1),this.emitter.emit("onCanUndoStepsUpdate",a),this.emitter.emit("onCanRedoStepsUpdate",s)}},Jn.waitTime));const{control:e,internalMsgEmitter:r,viewId:n}=t;this.control=e,this.emitter=r,this.undoStack=[],this.redoStack=[],this.room=e.room,this.worker=e.worker,this.isTicking=!1,this.viewId=n}get collector(){return this.control.collector}addExcludeIds(t){if(this.isTicking)for(const e of t)this.excludeIds.add(e)}undoTickerStart(t,e){var r,n;if(this.collector&&(this.undoTickerId!==t||this.scenePath!==e)){!this.undoTickerId&&!this.tickStartStorerCache&&!this.scenePath&&this.emitter.emit("onCanUndoStepsUpdate",1),this.undoTickerId&&this.viewId&&this.scenePath&&this.undoTickerEndSync(this.undoTickerId,this.viewId,this.scenePath),this.isTicking=!0;const i=this.collector.transformKey(Wt);this.excludeIds.add(i),this.undoTickerId=t,this.scenePath=e;const a=((r=this.collector)==null?void 0:r.storage[this.viewId])&&((n=this.collector)==null?void 0:n.storage[this.viewId][this.scenePath])||{};this.tickStartStorerCache=new Map(Object.entries(St.cloneDeep(a)))}}undoTickerEndSync(t,e,r,n=!0){var i,a;if(t===this.undoTickerId&&r===this.scenePath&&e===this.viewId&&this.tickStartStorerCache){const s=((i=this.collector)==null?void 0:i.storage[e])&&((a=this.collector)==null?void 0:a.storage[e][r])||{},u=this.diffFun(this.tickStartStorerCache,new Map(Object.entries(s)));u.size&&(this.undoStack.push({id:t,type:2,data:St.cloneDeep(u),scenePath:r}),this.undoStack.length>Jn.MaxStackLength&&this.undoStack.shift(),n&&this.emitter.emit("onCanUndoStepsUpdate",this.undoStack.length+1)),this.redoStack.length&&(this.redoStack.length=0,this.emitter.emit("onCanRedoStepsUpdate",this.redoStack.length)),this.isTicking=!1,this.scenePath=void 0,this.tickStartStorerCache=void 0,this.undoTickerId=void 0,this.excludeIds.clear()}}undo(t){this.undoTickerId&&this.tickStartStorerCache&&this.scenePath&&this.undoTickerEndSync(this.undoTickerId,this.viewId,this.scenePath,!1);let e=this.undoStack.length-1;for(;e>=0;){if(this.undoStack[e].scenePath===t){const i=this.undoStack[e];i&&(this.redoStack.push(i),i.type===2&&i.data&&this.refreshPlugin(i)),this.undoStack.splice(e,1);break}e--}const r=this.undoStack.filter(i=>i.scenePath===t).length,n=this.redoStack.filter(i=>i.scenePath===t).length;return this.emitter.emit("onCanUndoStepsUpdate",r),this.emitter.emit("onCanRedoStepsUpdate",n),r}redo(t){let e=this.redoStack.length-1;for(;e>=0;){if(this.redoStack[e].scenePath===t){const i=this.redoStack[e];i&&(!this.undoTickerId&&i.tickStartStorerCache?(this.undoTickerId=i.id,this.tickStartStorerCache=i.tickStartStorerCache,this.scenePath=i.scenePath):this.undoStack.push(i),i.type===2&&i.data&&this.refreshPlugin(i,!0)),this.redoStack.splice(e,1);break}e--}const r=this.undoStack.filter(i=>i.scenePath===t).length,n=this.redoStack.filter(i=>i.scenePath===t).length;return this.emitter.emit("onCanUndoStepsUpdate",r),this.emitter.emit("onCanRedoStepsUpdate",n),n}clear(){this.clearUndo(),this.clearRedo()}clearUndo(){this.undoStack.length=0,this.emitter.emit("onCanUndoStepsUpdate",this.undoStack.length)}clearRedo(){this.redoStack.length=0,this.emitter.emit("onCanRedoStepsUpdate",this.redoStack.length)}canUndo(){return!!this.undoStack.length}canRedo(){return!!this.redoStack.length}onFocusView(){const t=this.control.viewContainerManager.getCurScenePath(this.viewId);if(t){let e=this.undoStack.filter(n=>n.scenePath===t).length;const r=this.redoStack.filter(n=>n.scenePath===t).length;e===0&&r===0&&this.tickStartStorerCache&&this.scenePath===t&&(e=1),this.emitter.emit("onCanUndoStepsUpdate",e),this.emitter.emit("onCanRedoStepsUpdate",r)}}diffFun(t,e){const r=new Set,n=t.keys(),i=e.keys();for(const a of n){if(this.excludeIds.has(a))continue;const s=t.get(a),u=e.get(a);if(s&&u){if(St.isEqual(u,s))continue;r.add({dataType:3,key:a,data:[s,u]});continue}s&&r.add({dataType:2,key:a,data:s})}for(const a of i){if(this.excludeIds.has(a))continue;const s=e.get(a);s&&!t.has(a)&&r.add({dataType:1,key:a,data:s})}return r}isDrawEffectiveScene(t,e){const{key:r}=t;return!e.includes(r)}isDeleteEffectiveScene(t,e,r){var n;const{key:i}=t;if(!e.includes(i))return!1;const a=e.filter(s=>{var u,d;return((u=this.collector)==null?void 0:u.getLocalId(s))===Wt&&!((d=this.collector)!=null&&d.isOwn(s))}).map(s=>{var u;return(u=this.collector)==null?void 0:u.storage[this.viewId][r][s]});for(const s of a)if((n=s?.selectIds)!=null&&n.includes(i))return!1;return!0}isOldEffectiveScene(t,e,r){var n;const{key:i}=t;if(!e.includes(i))return!1;const a=e.filter(s=>{var u,d;return((u=this.collector)==null?void 0:u.getLocalId(s))===Wt&&!((d=this.collector)!=null&&d.isOwn(s))}).map(s=>{var u;return(u=this.collector)==null?void 0:u.storage[this.viewId][r][s]});for(const s of a)if((n=s?.selectIds)!=null&&n.includes(i))return!1;return!0}isNewEffectiveScene(t,e){const{key:r}=t;return!!e.includes(r)}refreshPlugin(t,e=!1){var r,n,i,a,s,u,d,M,c,v,p,T,x,y,C,h,g,f,m,S,A;let P;const{scenePath:R}=t,D=t.data;if(!D||!this.collector)return;const L=St.cloneDeep(this.collector.storage);for(const j of D.values()){const{dataType:b,data:O,key:Y}=j,X=this.collector.getStorageData(this.viewId,R),Z=X&&Object.keys(X)||[];switch(b){case 1:if(P=e?this.isDrawEffectiveScene(j,Z):this.isDeleteEffectiveScene(j,Z,R),P)if(e&&!Array.isArray(O)){if((r=O.updateNodeOpt)!=null&&r.useAnimation&&(O.updateNodeOpt.useAnimation=!1),((n=this.collector)==null?void 0:n.getLocalId(Y))===Wt&&(i=this.collector)!=null&&i.isOwn(j.key)){const $=O.selectIds;if($){const rt=Z.filter(Q=>{var tt,lt;return((tt=this.collector)==null?void 0:tt.getLocalId(Q))===Wt&&!((lt=this.collector)!=null&<.isOwn(Q))}).map(Q=>{var tt;return(tt=this.collector)==null?void 0:tt.storage[this.viewId][R][Q]});let F=!1;for(const Q of rt)for(let tt=0;tt<$.length;tt++)(a=Q?.selectIds)!=null&&a.includes($[tt])&&(delete $[tt],F=!0);F&&(O.selectIds=$.filter(Q=>!!Q))}}(s=this.collector)==null||s.updateValue(j.key,O,{viewId:this.viewId,scenePath:R,isSync:!0,storage:L})}else!e&&!Array.isArray(j.data)&&((u=this.collector)==null||u.updateValue(j.key,void 0,{viewId:this.viewId,scenePath:R,isSync:!0,storage:L}));break;case 2:if(P=e?this.isDeleteEffectiveScene(j,Z,R):this.isDrawEffectiveScene(j,Z),P){if(e&&!Array.isArray(O))(d=this.collector)==null||d.updateValue(Y,void 0,{viewId:this.viewId,scenePath:R,isSync:!0,storage:L});else if(!e&&!Array.isArray(O)){if((M=O.updateNodeOpt)!=null&&M.useAnimation&&(O.updateNodeOpt.useAnimation=!1),((c=this.collector)==null?void 0:c.getLocalId(j.key))===Wt&&(v=this.collector)!=null&&v.isOwn(j.key)){const $=O.selectIds;if($){const rt=Z.filter(Q=>{var tt,lt;return((tt=this.collector)==null?void 0:tt.getLocalId(Q))===Wt&&!((lt=this.collector)!=null&<.isOwn(Q))}).map(Q=>{var tt;return(tt=this.collector)==null?void 0:tt.storage[this.viewId][R][Q]});let F=!1;for(const Q of rt)for(let tt=0;tt<$.length;tt++)(p=Q?.selectIds)!=null&&p.includes($[tt])&&(delete $[tt],F=!0);F&&(O.selectIds=$.filter(Q=>!!Q))}}(T=this.collector)==null||T.updateValue(j.key,j.data,{viewId:this.viewId,scenePath:R,isSync:!0,storage:L})}}break;case 3:if(P=e?this.isNewEffectiveScene(j,Z):this.isOldEffectiveScene(j,Z,R),P){if(e&&Array.isArray(O)&&O.length===2){const $=O[1];if((x=$.updateNodeOpt)!=null&&x.useAnimation&&($.updateNodeOpt.useAnimation=!1),((y=this.collector)==null?void 0:y.getLocalId(j.key))===Wt&&(C=this.collector)!=null&&C.isOwn(j.key)){const rt=$.selectIds;if(rt){const F=Z.filter(tt=>{var lt,ct;return((lt=this.collector)==null?void 0:lt.getLocalId(tt))===Wt&&!((ct=this.collector)!=null&&ct.isOwn(tt))}).map(tt=>{var lt;return(lt=this.collector)==null?void 0:lt.storage[this.viewId][R][tt]});let Q=!1;for(const tt of F)for(let lt=0;lt<rt.length;lt++)tt!=null&&tt.selectIds&&(h=tt.selectIds)!=null&&h.includes(rt[lt])&&(delete rt[lt],Q=!0);Q&&($.selectIds=rt.filter(tt=>!!tt))}}(g=this.collector)==null||g.updateValue(Y,$,{viewId:this.viewId,scenePath:R,isSync:!0,storage:L})}else if(!e&&Array.isArray(O)&&O.length===2){const $=O[0];if((f=$.updateNodeOpt)!=null&&f.useAnimation&&($.updateNodeOpt.useAnimation=!1),((m=this.collector)==null?void 0:m.getLocalId(j.key))===Wt&&(S=this.collector)!=null&&S.isOwn(j.key)){const rt=$.selectIds;if(rt){const F=Z.filter(tt=>{var lt,ct;return((lt=this.collector)==null?void 0:lt.getLocalId(tt))===Wt&&!((ct=this.collector)!=null&&ct.isOwn(tt))}).map(tt=>{var lt;return(lt=this.collector)==null?void 0:lt.storage[this.viewId][R][tt]});let Q=!1;for(const tt of F)for(let lt=0;lt<rt.length;lt++)tt!=null&&tt.selectIds&&tt.selectIds.includes(rt[lt])&&(delete rt[lt],Q=!0);Q&&($.selectIds=rt.filter(tt=>!!tt))}}(A=this.collector)==null||A.updateValue(j.key,$,{viewId:this.viewId,scenePath:R,isSync:!0,storage:L})}}break}}}};it(tn,"sdkCallBack"),it(tn,"MaxStackLength",20),it(tn,"waitTime",100);let gy=tn;function py(o){return o instanceof TouchEvent||o instanceof window.TouchEvent||o?.touches&&o?.touches.length||o?.changedTouches&&o?.changedTouches.length}function en(o){return py(o)&&(o.touches&&o.touches.length===1||o.changedTouches&&o.changedTouches.length===1)}function Oo(o){return o.touches&&o.touches.length?{x:o.touches[0].pageX,y:o.touches[0].pageY}:o.changedTouches&&o.changedTouches.length?{x:o.changedTouches[0].pageX,y:o.changedTouches[0].pageY}:{x:o.pageX,y:o.pageY}}class wr{constructor(t){it(this,"internalMsgEmitter"),it(this,"control"),it(this,"mainView"),it(this,"appViews",new Map),it(this,"undoTickerStart",(n,i)=>{const a=this.getView(i);a&&a.displayer&&a.focusScenePath&&a.displayer.commiter.undoTickerStart(n,a.focusScenePath)}),it(this,"addExcludeIds",(n,i)=>{const a=this.getView(i);a&&a.displayer&&a.focusScenePath&&a.displayer.commiter.addExcludeIds(n)});const{control:e,internalMsgEmitter:r}=t;this.control=e,this.internalMsgEmitter=r,this.internalMsgEmitter.on("addUndoTicker",this.undoTickerStart),this.internalMsgEmitter.on("excludeIds",this.addExcludeIds)}get worker(){return this.control.worker}undo(){const t=this.focuedView;let e=0;if(t){const r=t.focusScenePath;e=t.displayer.commiter.undo(r)||0}return e}redo(){const t=this.focuedView;let e=0;if(t){const r=t.focusScenePath;e=t.displayer.commiter.redo(r)||0}return e}validator(t,e,r){var n;const i=St.clone(t[e]),a=St.clone(r);e==="focusScenePath"&&r&&!St.isEqual(i,a)&&(this.control.internalSceneChange(t.id,a),(n=this.focuedView)==null||n.displayer.commiter.onChangeScene()),e==="cameraOpt"&&!St.isEqual(i,a)&&this.control.internalCameraChange(t.id,a)}destroyAppView(t,e=!1){const r=this.appViews.get(t);r&&(this.control.textEditorManager.clear(t,e),r.displayer.destroy(),this.appViews.delete(t))}createMianView(t){this.mainView=new Proxy(t,{set:(e,r,n)=>(this.worker.isActive&&this.validator(e,r,n),e[r]=n,!0)})}createAppView(t){const e=t.id,r=new Proxy(t,{set:(n,i,a)=>(this.worker.isActive&&this.validator(n,i,a),n[i]=a,!0)});this.appViews.set(e,r)}isAppView(t){return t!==ne&&this.appViews.has(t)}getView(t){var e;return t===ne?this.mainView:(e=this.appViews)==null?void 0:e.get(t)}getCurScenePath(t){const e=this.getView(t);if(e)return e.focusScenePath}getAllViews(){return[this.mainView,...this.appViews.values()]}setViewScenePath(t,e){var r;if(t===ne&&this.mainView)this.mainView.focusScenePath=e;else{const n=t&&((r=this.appViews)==null?void 0:r.get(t))||void 0;n&&(n.focusScenePath=e)}}setViewData(t,e){var r;if(t===ne&&this.mainView)this.mainView.viewData=e;else{const n=t&&((r=this.appViews)==null?void 0:r.get(t))||void 0;n&&(n.viewData=e)}}setFocuedViewId(t){var e;this.focuedViewId=t,t===ne?this.focuedView=this.mainView:this.focuedView=t&&((e=this.appViews)==null?void 0:e.get(t))||void 0,this.worker.currentToolsData&&this.worker.currentToolsData.toolsType===ht.Text&&this.activeTextEditor(t),this.control.cursor.onFocusViewChange(),this.focuedView&&this.focuedView.displayer.commiter.onFocusView()}setViewFocusScenePath(t,e){var r;let n;t===ne?n=this.mainView:n=(r=this.appViews)==null?void 0:r.get(t),n&&(n.focusScenePath=e)}destroy(){var t;this.internalMsgEmitter.off("addUndoTicker",this.undoTickerStart),this.internalMsgEmitter.off("excludeIds",this.addExcludeIds),(t=this.mainView)==null||t.displayer.destroy(),this.control.destroyMiniMap(ne),this.appViews.forEach(e=>{this.destroyAppView(e.id,!0),this.worker.destroyViewWorker(e.id),this.control.destroyMiniMap(e.id)})}setFocuedViewCameraOpt(t){if(this.focuedView){const e=this.focuedView.cameraOpt;St.isEqual(e,t)||(this.focuedView.cameraOpt=t)}}transformToOriginPoint(t,e){const r=this.getView(e);if(r!=null&&r.viewData){const n=r.viewData.convertToPointOnScreen(t[0],t[1]);return[n.x,n.y]}return t}transformToScenePoint(t,e){const r=this.getView(e);if(r!=null&&r.viewData){const n=r.viewData.convertToPointInWorld({x:t[0],y:t[1]});return[n.x,n.y]}return t}render(t){var e,r,n,i,a,s,u,d,M,c,v,p,T,x,y,C,h;for(const g of t){const{rect:f,imageBitmap:m,isClear:S,isUnClose:A,drawCanvas:P,clearCanvas:R,viewId:D}=g,L=(e=this.getView(D))==null?void 0:e.displayer;if(L&&f){const{dpr:j,canvasBgRef:b,canvasFloatRef:O,canvasServiceFloatRef:Y,canvasTopRef:X}=L,Z=Math.floor(f.w*j),$=Math.floor(f.h*j),rt=f.x*j,F=f.y*j;if(S){switch(R){case Ve.TopFloat:(n=(r=X?.current)==null?void 0:r.getContext("2d"))==null||n.clearRect(rt,F,Z,$);break;case Ve.Float:(a=(i=O.current)==null?void 0:i.getContext("2d"))==null||a.clearRect(rt,F,Z,$);break;case Ve.ServiceFloat:(u=(s=Y.current)==null?void 0:s.getContext("2d"))==null||u.clearRect(rt,F,Z,$);break;case Ve.Bg:(M=(d=b.current)==null?void 0:d.getContext("2d"))==null||M.clearRect(rt,F,Z,$);break}continue}if(P&&m)switch(P){case Ve.TopFloat:(v=(c=X?.current)==null?void 0:c.getContext("2d"))==null||v.drawImage(m,0,0,Z,$,rt,F,Z,$);break;case Ve.Float:{(T=(p=O.current)==null?void 0:p.getContext("2d"))==null||T.drawImage(m,0,0,Z,$,rt,F,Z,$);break}case Ve.ServiceFloat:{(y=(x=Y.current)==null?void 0:x.getContext("2d"))==null||y.drawImage(m,0,0,Z,$,rt,F,Z,$);break}case Ve.Bg:{(h=(C=b.current)==null?void 0:C.getContext("2d"))==null||h.drawImage(m,0,0,Z,$,rt,F,Z,$);break}}if(A)continue;m?.close()}}}showFloatBar(t,e,r){const n=this.getView(t),i=n?.displayer.vDom;i&&i.showFloatBar(e,r)}activeTextEditor(t){const e=this.getView(t),r=e?.displayer.vDom;r&&r.activeTextEditor()}unActiveTextEditor(t){const e=this.getView(t),r=e?.displayer.vDom;r&&r.unActiveTextEditor()}showFloatBarBtn(t,e){const r=this.getView(t),n=r?.displayer.vDom;n&&n.showFloatBarBtn(e)}updateTextEditorInfo(t,e){const r=this.getView(t),n=r?.displayer.vDom;n&&n.updateTextEditorInfo(e)}setActiveMiniMap(t,e){const r=this.getView(t),n=r?.displayer.vDom;n&&n.setActiveMiniMap(e&&t||void 0)}}it(wr,"defaultCameraOpt",{centerX:0,centerY:0,scale:1}),it(wr,"defaultScreenCanvasOpt",{autoRender:!1,contextType:"webgl2"}),it(wr,"defaultLayerOpt",{offscreen:!0,handleEvent:!1,depth:!1});class Lo{constructor(t,e,r){it(this,"control"),it(this,"internalMsgEmitter"),it(this,"commiter"),it(this,"cachePoint"),it(this,"cacheCursorPoint"),it(this,"active",!0),it(this,"toolsKey"),it(this,"cursorMouseMove"),it(this,"cursorMouseMoveDebounced"),it(this,"cursorMouseMoveThrottled"),it(this,"cursorMouseMoveFun"),it(this,"_transferControlToOffscreenCanvas"),it(this,"cursorMouseLeave",()=>{this.control.pluginOptions.extras.cursor.enable?this.cursorMouseMoveThrottled.cancel():this.cursorMouseMoveDebounced.cancel(),this.cacheCursorPoint=[void 0,void 0],this.worker.sendCursorEvent(this.cacheCursorPoint,this.viewId)}),it(this,"mousedown",i=>{var a;if(this.active&&i.button===0&&this.viewId){this.toolsKey=(a=this.worker.getCurrentToolsData())==null?void 0:a.toolsType,!this.worker.isAbled()&&this.toolsKey&&this.control.effectViewContainer(this.toolsKey),this.worker.checkDrawingWork(this.viewId),this.reflashContainerOffset();const s=this.getPoint(i);this.cachePoint=s,s&&(this.worker.originalEventLintener(Et.Start,s,this.viewId),document.addEventListener("mousemove",this.mousemove,!1),document.addEventListener("mouseleave",this.mouseup,!1),document.addEventListener("mouseup",this.mouseup,!1))}}),it(this,"mousemove",i=>{if(this.active&&this.viewId){const a=this.getPoint(i);if(this.cachePoint=a,this.checkConsumeCount())return;a&&this.worker.originalEventLintener(Et.Doing,a,this.viewId)}}),it(this,"mouseup",i=>{if(this.active&&i.button===0&&this.viewId){const a=this.getPoint(i)||this.cachePoint;a?(this.worker.originalEventLintener(Et.Done,a,this.viewId).finally(()=>{document.removeEventListener("mouseleave",this.mouseup,!1),document.removeEventListener("mousemove",this.mousemove,!1),document.removeEventListener("mouseup",this.mouseup,!1)}),this.cachePoint=void 0):(document.removeEventListener("mouseleave",this.mouseup,!1),document.removeEventListener("mousemove",this.mousemove,!1),document.removeEventListener("mouseup",this.mouseup,!1))}}),it(this,"touchstart",i=>{var a;if(this.active){if(!en(i)){this.worker.unWritable(),this.viewId&&this.worker.removeDrawingWork(this.viewId);return}if(this.viewId){this.toolsKey=(a=this.worker.getCurrentToolsData())==null?void 0:a.toolsType,!this.worker.isAbled()&&this.toolsKey&&this.control.effectViewContainer(this.toolsKey),this.worker.checkDrawingWork(this.viewId),this.reflashContainerOffset();const s=this.getPoint(i);this.cachePoint=s,s&&(this.worker.originalEventLintener(Et.Start,s,this.viewId),document.addEventListener("touchmove",this.touchmove,!1),document.addEventListener("touchend",this.touchend,!1))}}}),it(this,"touchmove",i=>{if(this.active){if(!en(i)){this.worker.unWritable(),this.worker.removeDrawingWork(this.viewId);return}if(this.viewId){const a=this.getPoint(i);if(this.cachePoint=a,this.checkConsumeCount())return;a&&this.worker.originalEventLintener(Et.Doing,a,this.viewId)}}}),it(this,"touchend",i=>{if(this.active){if(!en(i)||!this.worker.isAbled()){this.worker.unWritable(),this.worker.removeDrawingWork(this.viewId);return}if(this.viewId){const a=this.getPoint(i)||this.cachePoint;a?(this.worker.originalEventLintener(Et.Done,a,this.viewId).finally(()=>{document.removeEventListener("touchmove",this.touchmove,!1),document.removeEventListener("touchend",this.touchend,!1)}),this.cachePoint=void 0):(document.removeEventListener("touchmove",this.touchmove,!1),document.removeEventListener("touchend",this.touchend,!1))}}}),it(this,"keydown",i=>{this.control.hotkeyManager.colloctHotkey(i)}),this.control=t,this.internalMsgEmitter=e;const n={control:this.control,internalMsgEmitter:this.internalMsgEmitter,viewId:r};this.commiter=new gy(n),this.cursorMouseMoveFun=i=>{const a=this.getPoint(i);this.cacheCursorPoint&&St.isEqual(a,this.cacheCursorPoint)||(this.cacheCursorPoint=a,a&&this.worker.sendCursorEvent(a,this.viewId))},this.cursorMouseMoveDebounced=St.debounce(this.cursorMouseMoveFun,this.moveDelayTime,{trailing:!0}),this.cursorMouseMoveThrottled=St.throttle(this.cursorMouseMoveFun,this.moveDelayTime,{leading:!0}),this.cursorMouseMove=i=>{this.control.pluginOptions.extras.cursor.enable?this.cursorMouseMoveThrottled(i):this.cursorMouseMoveDebounced(i)}}get moveDelayTime(){var t,e;return((e=(t=this.control.pluginOptions.extras)==null?void 0:t.cursor)==null?void 0:e.moveDelayTime)??me.cursor.moveDelayTime}setTransferControlToOffscreenCanvas(t){this._transferControlToOffscreenCanvas={bgCanvas:t.bgCanvas.transferControlToOffscreen(),serviceCanvas:t.serviceCanvas.transferControlToOffscreen(),localCanvas:t.localCanvas.transferControlToOffscreen()}}get transferControlToOffscreenCanvas(){return this._transferControlToOffscreenCanvas}get worker(){return this.control.worker}bindToolsClass(){var t,e;const r=(e=(t=this.worker)==null?void 0:t.currentToolsData)==null?void 0:e.toolsType,n=this.control.renderControl.isWritable,i=this.worker.isAbled();switch(r){case ht.Text:case ht.Pencil:case ht.LaserPen:case ht.Arrow:case ht.Straight:case ht.Rectangle:case ht.Ellipse:case ht.Star:case ht.Polygon:case ht.SpeechBalloon:case ht.Eraser:case ht.PencilEraser:case ht.BitMapEraser:case ht.Selector:this.eventTragetElement&&(this.eventTragetElement.className=n&&i?`netless-whiteboard ${r===ht.Selector?"cursor-selector":r===ht.Text?"cursor-text":r===ht.Eraser||r===ht.PencilEraser||r===ht.BitMapEraser?"cursor-eraser":r===ht.Pencil||r===ht.LaserPen?"cursor-pencil":"cursor-arrow"}`:"netless-whiteboard");break}}mountView(){this.setCanvassStyle(),this.control.viewContainerManager.mountView(this.viewId)}updateSize(){this.setCanvassStyle(),this.reflashContainerOffset()}reflashContainerOffset(){this.eventTragetElement&&(this.containerOffset=this.getContainerOffset(this.eventTragetElement,{x:0,y:0}))}get parentElement(){var t;return(t=this.eventTragetElement)==null?void 0:t.parentElement}destroy(){this.eventTragetElement&&this.removeDisplayerEvent(this.eventTragetElement),this.vDom=void 0,this.control.cursor.clearViewCursor(this.viewId),this.internalMsgEmitter.removeAllListeners([Vt.Cursor,this.viewId])}getPoint(t){const e=Oo(t);if(e&&St.isNumber(e.x)&&St.isNumber(e.y))return[e.x-this.containerOffset.x,e.y-this.containerOffset.y]}getActive(){return this.active}setActive(t){this.active=t}focusElement(){var t;(t=this.eventTragetElement)==null||t.focus()}async stopEventHandler(){this.cachePoint&&(await this.worker.originalEventLintener(Et.Done,this.cachePoint,this.viewId).finally(()=>{document.removeEventListener("mouseleave",this.mouseup,!1),document.removeEventListener("mousemove",this.mousemove,!1),document.removeEventListener("mouseup",this.mouseup,!1),document.removeEventListener("touchmove",this.touchmove,!1),document.removeEventListener("touchend",this.touchend,!1)}),this.cachePoint=void 0)}getTranslate(t){const e=(t.style.WebkitTransform||getComputedStyle(t,"").getPropertyValue("-webkit-transform")||t.style.transform||getComputedStyle(t,"").getPropertyValue("transform")).match(/-?[0-9]+\.?[0-9]*/g),r=e&&parseInt(e[0])||0,n=e&&parseInt(e[1])||0;return[r,n]}getContainerOffset(t,e){var r;const n=this.getTranslate(t);let i={x:e.x+t.offsetLeft-t.scrollLeft+n[0],y:e.y+t.offsetTop-t.scrollTop+n[1]};return(r=t.offsetParent)!=null&&r.nodeName&&t.offsetParent.nodeName!=="BODY"&&(i=this.getContainerOffset(t.offsetParent,i)),i}bindDisplayerEvent(t){t.addEventListener("mousedown",this.mousedown,!1),t.addEventListener("touchstart",this.touchstart,!1),t.addEventListener("mousemove",this.cursorMouseMove,!1),t.addEventListener("mouseleave",this.cursorMouseLeave,!1),t.addEventListener("keydown",this.keydown,!0)}removeDisplayerEvent(t){t.removeEventListener("mousedown",this.mousedown,!1),t.removeEventListener("touchstart",this.touchstart,!1),document.removeEventListener("mouseleave",this.mouseup,!1),document.removeEventListener("mousemove",this.mousemove,!1),document.removeEventListener("mouseup",this.mouseup,!1),document.removeEventListener("touchmove",this.touchmove,!1),document.removeEventListener("touchend",this.touchend,!1),t.removeEventListener("mousemove",this.cursorMouseMove,!1),t.removeEventListener("mouseleave",this.cursorMouseLeave,!1),t.removeEventListener("keydown",this.keydown,!0)}get isBezier(){return this.control.pluginOptions.extras.bezier.enable}get maxDrawCount(){return this.control.pluginOptions.extras.bezier.maxDrawCount||me.bezier.maxDrawCount}checkConsumeCount(){const t=this.worker.getConsumeCount();return this.cachePoint&&this.toolsKey&&this.toolsKey===ht.Pencil&&t>this.maxDrawCount?(this.stopEventHandler().finally(()=>{this.worker.publicMsgEmitter.emit("forceStop",ii.longPencil,this.viewId)}),!0):!1}}class vy extends Lo{constructor(t,e,r){super(e,r,t),it(this,"_viewId"),this._viewId=t}get viewId(){return this._viewId}setViewId(t){this._viewId=t}}class jo extends Lo{constructor(t,e){super(t,e,ne)}get viewId(){return ne}updateSize(){this.setCanvassStyle()}destroy(){super.destroy(),this.control.cursor.destroy()}}const my="index-module__Container__nLsM3",yy="index-module__CanvasBox__j2Xe-",My="index-module__FloatCanvas__d1YR7",Iy="index-module__TopFloatCanvas__7IaCw",Ty="index-module__CanvasBoxSub__hcMeK",Cy="index-module__SnapshotBox__--eeE",xy="index-module__FloatBar__cm-EL",Ey="index-module__RotateBtn__HSSkf",Sy="index-module__ResizeBtn__yjvda",Ay="index-module__CursorBox__2UHvI",Ny="index-module__TextEditorContainer__Qm8KC",Py="index-module__ResizeTowBox__HOllX",Dy="index-module__FloatBarBtn__FJrOG",Ee={Container:my,CanvasBox:yy,FloatCanvas:My,TopFloatCanvas:Iy,CanvasBoxSub:Ty,SnapshotBox:Cy,FloatBar:xy,RotateBtn:Ey,ResizeBtn:Sy,CursorBox:Ay,TextEditorContainer:Ny,ResizeTowBox:Py,FloatBarBtn:Dy},wy={delete:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDZ2NmEyIDIgMCAwIDEtMiAySDZhMiAyIDAgMCAxLTItMlY2aDBtMS0yYTIgMiAwIDAgMSAyLTJoMmEyIDIgMCAwIDEgMiAyaDBNMyA0aDEwIiBzdHJva2U9IiM0NDRFNjAiIGZpbGw9Im5vbmUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjwvc3ZnPg==",duplicate:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgc3Ryb2tlPSIjNDQ0RTYwIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxwYXRoIGQ9Ik0xMSAySDZhMSAxIDAgMCAwLTEgMXY4YTEgMSAwIDAgMCAxIDFoNmExIDEgMCAwIDAgMS0xVjRoMGwtMi0yeiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+PHBhdGggZD0iTTExIDJ2MWExIDEgMCAwIDAgMSAxaDFsLTItMnoiLz48cGF0aCBkPSJNOSAxNEg0YTEgMSAwIDAgMS0xLTFWNWgwIiBzdHJva2UtbGluZWNhcD0icm91bmQiLz48L2c+PC9zdmc+","layer-pressed":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0ibTE2IDEwLTYgNCA2IDQgNi00em0tNiA4IDYgNCA2LTQiIHN0cm9rZT0iIzMzODFGRiIgZmlsbD0ibm9uZSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+PC9zdmc+",layer:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0ibTE2IDEwLTYgNCA2IDQgNi00em0tNiA4IDYgNCA2LTQiIHN0cm9rZT0iIzQ0NEU2MCIgZmlsbD0ibm9uZSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+PC9zdmc+",rotate:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjUiIGhlaWdodD0iMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgc3Ryb2tlPSIjNDQ0RTYwIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PHBhdGggZD0iTTEzIDZhNiA2IDAgMSAxLTMuNzA5IDEuMjgzIi8+PHBhdGggZD0ibTEzIDYgMS40MTQgMi40NUwxMyA2bDIuNDUtMS40MTQiLz48L2c+PC9zdmc+","rotation-button":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iI0ZGRiIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBvcGFjaXR5PSIuMDEiIGQ9Ik0wIDI0VjBoMjR2MjR6Ii8+PHBhdGggZD0iTTUuNzI0IDUuNzI0QTguODQ3IDguODQ3IDAgMCAxIDEyIDMuMTI1YzIuMjcxIDAgNC41NDMuODY2IDYuMjc2IDIuNmE4Ljg0NiA4Ljg0NiAwIDAgMSAyLjU5OCA2LjE0IDguODQ5IDguODQ5IDAgMCAxLTIuNTU5IDYuMzdsLTEuNS0uOTgzQTcuMTA1IDcuMTA1IDAgMCAwIDE5LjEyNSAxMmE3LjEwMyA3LjEwMyAwIDAgMC0yLjA4Ny01LjAzOEE3LjEwMyA3LjEwMyAwIDAgMCAxMiA0Ljg3NWE3LjEwMyA3LjEwMyAwIDAgMC01LjAzOCAyLjA4NyA3LjEwMSA3LjEwMSAwIDAgMC0yLjA4NiA0LjkyIDcuMTAzIDcuMTAzIDAgMCAwIDEuNzY2IDQuODE1bDEuOTQ1LTEuNTg0IDIuMzk0IDcuMTgyLTcuMjIyLTIuNDA4IDEuNzkxLTEuNzlBOC44NDYgOC44NDYgMCAwIDEgMy4xMjUgMTJjMC0yLjI3MS44NjYtNC41NDMgMi42LTYuMjc2eiIgc3Ryb2tlPSIjRkZGIiBzdHJva2Utd2lkdGg9Ii41IiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L2c+PC9zdmc+",rotation:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBmaWxsPSIjRkZGIiBvcGFjaXR5PSIuMDEiIGQ9Ik0wIDI0VjBoMjR2MjR6Ii8+PHBhdGggZD0iTTUuNzI0IDUuNzI0QTguODQ3IDguODQ3IDAgMCAxIDEyIDMuMTI1YzIuMjcxIDAgNC41NDMuODY2IDYuMjc2IDIuNmE4Ljg0NiA4Ljg0NiAwIDAgMSAyLjU5OCA2LjE0IDguODQ5IDguODQ5IDAgMCAxLTIuNTU5IDYuMzdsLTEuNS0uOTgzQTcuMTA1IDcuMTA1IDAgMCAwIDE5LjEyNSAxMmE3LjEwMyA3LjEwMyAwIDAgMC0yLjA4Ny01LjAzOEE3LjEwMyA3LjEwMyAwIDAgMCAxMiA0Ljg3NWE3LjEwMyA3LjEwMyAwIDAgMC01LjAzOCAyLjA4NyA3LjEwMSA3LjEwMSAwIDAgMC0yLjA4NiA0LjkyIDcuMTAzIDcuMTAzIDAgMCAwIDEuNzY2IDQuODE1bDEuOTQ1LTEuNTg0IDIuMzk0IDcuMTgyLTcuMjIyLTIuNDA4IDEuNzkxLTEuNzlBOC44NDYgOC44NDYgMCAwIDEgMy4xMjUgMTJjMC0yLjI3MS44NjYtNC41NDMgMi42LTYuMjc2eiIgc3Ryb2tlPSIjRkZGIiBzdHJva2Utd2lkdGg9Ii41IiBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L2c+PC9zdmc+","font-colors-active":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0ibTQgMTEgNC05IDQgOU02IDdoNCIgc3Ryb2tlPSIjMzM4MUZGIiBmaWxsPSJub25lIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=","font-colors":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0ibTQgMTEgNC05IDQgOU02IDdoNCIgc3Ryb2tlPSIjNDQ0RTYwIiBmaWxsPSJub25lIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=","to-bottom":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDEwdjhtMCAwLTItMm0yIDIgMi0ybS00IDZoMTJtLTYtNGg2bS02LTRoNm0tNi00aDYiIHN0cm9rZT0iIzQ0NEU2MCIgZmlsbD0ibm9uZSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+PC9zdmc+","to-top":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDIydi04bTAgMC0yIDJtMi0yIDIgMm0tNC02aDEybS02IDRoNm0tNiA0aDZtLTYgNGg2IiBzdHJva2U9IiM0NDRFNjAiIGZpbGw9Im5vbmUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjwvc3ZnPg==","bold-active":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTQuNSAySDhhMi41IDIuNSAwIDAgMSAwIDVINS41aDBtLTEgMGg0YTMgMyAwIDAgMSAwIDZoLTQgMG0wIDFWMiIgc3Ryb2tlPSIjMzM4MUZGIiBmaWxsPSJub25lIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=",bold:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTQuNSAySDhhMi41IDIuNSAwIDAgMSAwIDVINS41aDBtLTEgMGg0YTMgMyAwIDAgMSAwIDZoLTQgMG0wIDFWMiIgc3Ryb2tlPSIjNDQ0RTYwIiBmaWxsPSJub25lIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=","underline-active":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDJ2NWE0IDQgMCAxIDEtOCAwVjJoME0zIDE0aDEwIiBzdHJva2U9IiMzMzgxRkYiIGZpbGw9Im5vbmUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjwvc3ZnPg==",underline:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDJ2NWE0IDQgMCAxIDEtOCAwVjJoME0zIDE0aDEwIiBzdHJva2U9IiM0NDRFNjAiIGZpbGw9Im5vbmUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjwvc3ZnPg==","line-through-active":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTQgOGg4bS0xLTNhMyAzIDAgMCAwLTMtM2gtLjkzOEEyLjY0IDIuNjQgMCAwIDAgNC41IDRhMi41NyAyLjU3IDAgMCAwIDEuMzQ0IDIuOTIybDQuMzEyIDIuMTU2QTIuNTcgMi41NyAwIDAgMSAxMS41IDEyYTIuNjQgMi42NCAwIDAgMS0yLjU2MiAySDdhMyAzIDAgMCAxLTMtM2gwIiBzdHJva2U9IiMzMzgxRkYiIGZpbGw9Im5vbmUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjwvc3ZnPg==","line-through":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTQgOGg4bS0xLTNhMyAzIDAgMCAwLTMtM2gtLjkzOEEyLjY0IDIuNjQgMCAwIDAgNC41IDRhMi41NyAyLjU3IDAgMCAwIDEuMzQ0IDIuOTIybDQuMzEyIDIuMTU2QTIuNTcgMi41NyAwIDAgMSAxMS41IDEyYTIuNjQgMi42NCAwIDAgMS0yLjU2MiAySDdhMyAzIDAgMCAxLTMtM2gwIiBzdHJva2U9IiM0NDRFNjAiIGZpbGw9Im5vbmUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjwvc3ZnPg==","italic-active":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTcgMTQgOSAyTTUgMTRoNE03IDJoNCIgc3Ryb2tlPSIjMzM4MUZGIiBmaWxsPSJub25lIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=",italic:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTcgMTQgOSAyTTUgMTRoNE03IDJoNCIgc3Ryb2tlPSIjNDQ0RTYwIiBmaWxsPSJub25lIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=","unlock-new":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48Y2lyY2xlIGZpbGw9IiMzMzgxRkYiIGN4PSIxNiIgY3k9IjE3IiByPSIxIi8+PHJlY3Qgc3Ryb2tlPSIjMzM4MUZGIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHg9IjExIiB5PSIxNCIgd2lkdGg9IjEwIiBoZWlnaHQ9IjgiIHJ4PSIyIi8+PHBhdGggZD0iTTEzIDE0di0xYTMgMyAwIDAgMSA2IDB2MWgwbS0zIDN2MyIgc3Ryb2tlPSIjMzM4MUZGIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L2c+PC9zdmc+","lock-new":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48Y2lyY2xlIGZpbGw9IiM0NDRFNjAiIGN4PSIxNiIgY3k9IjE3IiByPSIxIi8+PHJlY3Qgc3Ryb2tlPSIjNDQ0RTYwIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHg9IjExIiB5PSIxNCIgd2lkdGg9IjEwIiBoZWlnaHQ9IjgiIHJ4PSIyIi8+PHBhdGggZD0iTTEzIDE0di0zYTMgMyAwIDAgMSA2IDB2MWgwbS0zIDV2MyIgc3Ryb2tlPSIjNDQ0RTYwIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L2c+PC9zdmc+",shapes:"data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHBhdGggZD0iTTY4Mi42NjY2NjcgMTAyNEM2ODIuNjY2NjY3IDEwMjQgNjgyLjY2NjY2NyAxMDI0IDY4Mi42NjY2NjcgMTAyNEwxNzAuNjY2NjY3IDEwMjRjLTE3LjA2NjY2NyAwLTI5Ljg2NjY2Ny04LjUzMzMzMy0zOC40LTIxLjMzMzMzMy04LjUzMzMzMy0xMi44LTguNTMzMzMzLTI5Ljg2NjY2NyAwLTQyLjY2NjY2N2wyNTYtMzg0YzE3LjA2NjY2Ny0yNS42IDU1LjQ2NjY2Ny0yNS42IDcyLjUzMzMzMyAwbDI1MS43MzMzMzMgMzc5LjczMzMzM2M4LjUzMzMzMyA4LjUzMzMzMyAxMi44IDE3LjA2NjY2NyAxMi44IDI5Ljg2NjY2N0M3MjUuMzMzMzMzIDEwMDYuOTMzMzMzIDcwOC4yNjY2NjcgMTAyNCA2ODIuNjY2NjY3IDEwMjR6TTI1MS43MzMzMzMgOTM4LjY2NjY2N2wzNTQuMTMzMzMzIDBMNDI2LjY2NjY2NyA2NzQuMTMzMzMzIDI1MS43MzMzMzMgOTM4LjY2NjY2N3oiIGZpbGw9IiM0NDRFNjAiPjwvcGF0aD48cGF0aCBkPSJNOTgxLjMzMzMzMyA3MjUuMzMzMzMzbC0zNDEuMzMzMzMzIDBjLTI1LjYgMC00Mi42NjY2NjctMTcuMDY2NjY3LTQyLjY2NjY2Ny00Mi42NjY2NjdMNTk3LjMzMzMzMyAzNDEuMzMzMzMzYzAtMjUuNiAxNy4wNjY2NjctNDIuNjY2NjY3IDQyLjY2NjY2Ny00Mi42NjY2NjdsMzQxLjMzMzMzMyAwYzI1LjYgMCA0Mi42NjY2NjcgMTcuMDY2NjY3IDQyLjY2NjY2NyA0Mi42NjY2NjdsMCAzNDEuMzMzMzMzQzEwMjQgNzA4LjI2NjY2NyAxMDA2LjkzMzMzMyA3MjUuMzMzMzMzIDk4MS4zMzMzMzMgNzI1LjMzMzMzM3pNNjgyLjY2NjY2NyA2NDBsMjU2IDBMOTM4LjY2NjY2NyAzODRsLTI1NiAwTDY4Mi42NjY2NjcgNjQweiIgZmlsbD0iIzQ0NEU2MCI+PC9wYXRoPjxwYXRoIGQ9Ik0yNzcuMzMzMzMzIDU1NC42NjY2NjdDMTIzLjczMzMzMyA1NTQuNjY2NjY3IDAgNDMwLjkzMzMzMyAwIDI3Ny4zMzMzMzNTMTIzLjczMzMzMyAwIDI3Ny4zMzMzMzMgMCA1NTQuNjY2NjY3IDEyMy43MzMzMzMgNTU0LjY2NjY2NyAyNzcuMzMzMzMzIDQzMC45MzMzMzMgNTU0LjY2NjY2NyAyNzcuMzMzMzMzIDU1NC42NjY2Njd6TTI3Ny4zMzMzMzMgODUuMzMzMzMzQzE3MC42NjY2NjcgODUuMzMzMzMzIDg1LjMzMzMzMyAxNzAuNjY2NjY3IDg1LjMzMzMzMyAyNzcuMzMzMzMzUzE3MC42NjY2NjcgNDY5LjMzMzMzMyAyNzcuMzMzMzMzIDQ2OS4zMzMzMzMgNDY5LjMzMzMzMyAzODQgNDY5LjMzMzMzMyAyNzcuMzMzMzMzIDM4NCA4NS4zMzMzMzMgMjc3LjMzMzMzMyA4NS4zMzMzMzN6IiBmaWxsPSIjNDQ0RTYwIj48L3BhdGg+PC9zdmc+","shapes-active":"data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHBhdGggZD0iTTY4Mi42NjY2NjcgMTAyNEM2ODIuNjY2NjY3IDEwMjQgNjgyLjY2NjY2NyAxMDI0IDY4Mi42NjY2NjcgMTAyNEwxNzAuNjY2NjY3IDEwMjRjLTE3LjA2NjY2NyAwLTI5Ljg2NjY2Ny04LjUzMzMzMy0zOC40LTIxLjMzMzMzMy04LjUzMzMzMy0xMi44LTguNTMzMzMzLTI5Ljg2NjY2NyAwLTQyLjY2NjY2N2wyNTYtMzg0YzE3LjA2NjY2Ny0yNS42IDU1LjQ2NjY2Ny0yNS42IDcyLjUzMzMzMyAwbDI1MS43MzMzMzMgMzc5LjczMzMzM2M4LjUzMzMzMyA4LjUzMzMzMyAxMi44IDE3LjA2NjY2NyAxMi44IDI5Ljg2NjY2N0M3MjUuMzMzMzMzIDEwMDYuOTMzMzMzIDcwOC4yNjY2NjcgMTAyNCA2ODIuNjY2NjY3IDEwMjR6TTI1MS43MzMzMzMgOTM4LjY2NjY2N2wzNTQuMTMzMzMzIDBMNDI2LjY2NjY2NyA2NzQuMTMzMzMzIDI1MS43MzMzMzMgOTM4LjY2NjY2N3oiIGZpbGw9IiMzMzgxRkYiPjwvcGF0aD48cGF0aCBkPSJNOTgxLjMzMzMzMyA3MjUuMzMzMzMzbC0zNDEuMzMzMzMzIDBjLTI1LjYgMC00Mi42NjY2NjctMTcuMDY2NjY3LTQyLjY2NjY2Ny00Mi42NjY2NjdMNTk3LjMzMzMzMyAzNDEuMzMzMzMzYzAtMjUuNiAxNy4wNjY2NjctNDIuNjY2NjY3IDQyLjY2NjY2Ny00Mi42NjY2NjdsMzQxLjMzMzMzMyAwYzI1LjYgMCA0Mi42NjY2NjcgMTcuMDY2NjY3IDQyLjY2NjY2NyA0Mi42NjY2NjdsMCAzNDEuMzMzMzMzQzEwMjQgNzA4LjI2NjY2NyAxMDA2LjkzMzMzMyA3MjUuMzMzMzMzIDk4MS4zMzMzMzMgNzI1LjMzMzMzM3pNNjgyLjY2NjY2NyA2NDBsMjU2IDBMOTM4LjY2NjY2NyAzODRsLTI1NiAwTDY4Mi42NjY2NjcgNjQweiIgZmlsbD0iIzMzODFGRiI+PC9wYXRoPjxwYXRoIGQ9Ik0yNzcuMzMzMzMzIDU1NC42NjY2NjdDMTIzLjczMzMzMyA1NTQuNjY2NjY3IDAgNDMwLjkzMzMzMyAwIDI3Ny4zMzMzMzNTMTIzLjczMzMzMyAwIDI3Ny4zMzMzMzMgMCA1NTQuNjY2NjY3IDEyMy43MzMzMzMgNTU0LjY2NjY2NyAyNzcuMzMzMzMzIDQzMC45MzMzMzMgNTU0LjY2NjY2NyAyNzcuMzMzMzMzIDU1NC42NjY2Njd6TTI3Ny4zMzMzMzMgODUuMzMzMzMzQzE3MC42NjY2NjcgODUuMzMzMzMzIDg1LjMzMzMzMyAxNzAuNjY2NjY3IDg1LjMzMzMzMyAyNzcuMzMzMzMzUzE3MC42NjY2NjcgNDY5LjMzMzMzMyAyNzcuMzMzMzMzIDQ2OS4zMzMzMzMgNDY5LjMzMzMzMyAzODQgNDY5LjMzMzMzMyAyNzcuMzMzMzMzIDM4NCA4NS4zMzMzMzMgMjc3LjMzMzMzMyA4NS4zMzMzMzN6IiBmaWxsPSIjMzM4MUZGIj48L3BhdGg+PC9zdmc+","font-style-active":"data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHBhdGggZD0iTTM2MC4yMzQ2NjcgMjEzLjMzMzMzM0w1NTQuNjY2NjY3IDc3Ni4yNzczMzNoLTc2LjU0NGwtNTQuNjEzMzM0LTE3Mi4wMzJIMjE0LjE4NjY2N2wtNTUuNDY2NjY3IDE3Mi4wMzJIODUuMzMzMzMzTDI3OS43NjUzMzMgMjEzLjMzMzMzM2g4MC40NjkzMzR6IG00MTAuMDI2NjY2IDE3My44MjRjOTAuMTEyIDAgMTI4LjM0MTMzMyA2MC43NTczMzMgMTI4LjM0MTMzNCAxNTIuMjM0NjY3djIyOC4wMTA2NjdoLTUxLjJsLTUuNDYxMzM0LTQ0LjM3MzMzNGgtMi4wNDhjLTM1LjQ5ODY2NyAyOS4zNTQ2NjctNzcuMTQxMzMzIDUzLjI0OC0xMjIuODggNTMuMjQ4LTYyLjEyMjY2NyAwLTEwOC41NDQtMzguMjI5MzMzLTEwOC41NDQtMTA1LjEzMDY2NiAwLTgwLjU1NDY2NyA3MC4zMTQ2NjctMTIwLjgzMiAyMjguMDEwNjY3LTEzOC41ODEzMzQgMC00Ny43ODY2NjctMTUuNzAxMzMzLTkzLjUyNTMzMy03Ni40NTg2NjctOTMuNTI1MzMzLTQzLjAwOCAwLTgxLjkyIDE5Ljc5NzMzMy0xMTEuMjc0NjY2IDM5LjU5NDY2N2wtMjQuNTc2LTQzLjAwOGMzNC4xMzMzMzMtMjEuODQ1MzMzIDg2LjY5ODY2Ny00OC40NjkzMzMgMTQ2LjA5MDY2Ni00OC40NjkzMzR6IG02Ni4yMTg2NjcgMTg2LjM2OGMtMTI0LjkyOCAxNS4wMTg2NjctMTY3LjI1MzMzMyA0NS43Mzg2NjctMTY3LjI1MzMzMyA5My41MjUzMzQgMCA0Mi4zMjUzMzMgMjguNjcyIDU5LjM5MiA2NS41MzYgNTkuMzkyIDM2LjE4MTMzMyAwIDY1LjUzNi0xNy4wNjY2NjcgMTAxLjcxNzMzMy00OS4xNTJ6TTMyMC4zODQgMjcwLjkzMzMzM2gtMy4xMTQ2NjdjLTE3Ljk2MjY2NyA2Ni4wNDgtMzYuNjkzMzMzIDEyNi43Mi01Ny4wMDI2NjYgMTkwLjQ2NGwtMjguMTYgODYuMDE2aDE3My4zOTczMzNsLTI3LjMwNjY2Ny04Ni4wMTZBNDkxMy40OTMzMzMgNDkxMy40OTMzMzMgMCAwIDEgMzIwLjM4NCAyNzAuOTMzMzMzeiIgZmlsbD0iIzMzODFGRiI+PC9wYXRoPjwvc3ZnPg==","font-style":"data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHBhdGggZD0iTTM2MC4yMzQ2NjcgMjEzLjMzMzMzM0w1NTQuNjY2NjY3IDc3Ni4yNzczMzNoLTc2LjU0NGwtNTQuNjEzMzM0LTE3Mi4wMzJIMjE0LjE4NjY2N2wtNTUuNDY2NjY3IDE3Mi4wMzJIODUuMzMzMzMzTDI3OS43NjUzMzMgMjEzLjMzMzMzM2g4MC40NjkzMzR6IG00MTAuMDI2NjY2IDE3My44MjRjOTAuMTEyIDAgMTI4LjM0MTMzMyA2MC43NTczMzMgMTI4LjM0MTMzNCAxNTIuMjM0NjY3djIyOC4wMTA2NjdoLTUxLjJsLTUuNDYxMzM0LTQ0LjM3MzMzNGgtMi4wNDhjLTM1LjQ5ODY2NyAyOS4zNTQ2NjctNzcuMTQxMzMzIDUzLjI0OC0xMjIuODggNTMuMjQ4LTYyLjEyMjY2NyAwLTEwOC41NDQtMzguMjI5MzMzLTEwOC41NDQtMTA1LjEzMDY2NiAwLTgwLjU1NDY2NyA3MC4zMTQ2NjctMTIwLjgzMiAyMjguMDEwNjY3LTEzOC41ODEzMzQgMC00Ny43ODY2NjctMTUuNzAxMzMzLTkzLjUyNTMzMy03Ni40NTg2NjctOTMuNTI1MzMzLTQzLjAwOCAwLTgxLjkyIDE5Ljc5NzMzMy0xMTEuMjc0NjY2IDM5LjU5NDY2N2wtMjQuNTc2LTQzLjAwOGMzNC4xMzMzMzMtMjEuODQ1MzMzIDg2LjY5ODY2Ny00OC40NjkzMzMgMTQ2LjA5MDY2Ni00OC40NjkzMzR6IG02Ni4yMTg2NjcgMTg2LjM2OGMtMTI0LjkyOCAxNS4wMTg2NjctMTY3LjI1MzMzMyA0NS43Mzg2NjctMTY3LjI1MzMzMyA5My41MjUzMzQgMCA0Mi4zMjUzMzMgMjguNjcyIDU5LjM5MiA2NS41MzYgNTkuMzkyIDM2LjE4MTMzMyAwIDY1LjUzNi0xNy4wNjY2NjcgMTAxLjcxNzMzMy00OS4xNTJ6TTMyMC4zODQgMjcwLjkzMzMzM2gtMy4xMTQ2NjdjLTE3Ljk2MjY2NyA2Ni4wNDgtMzYuNjkzMzMzIDEyNi43Mi01Ny4wMDI2NjYgMTkwLjQ2NGwtMjguMTYgODYuMDE2aDE3My4zOTczMzNsLTI3LjMwNjY2Ny04Ni4wMTZBNDkxMy40OTMzMzMgNDkxMy40OTMzMzMgMCAwIDEgMzIwLjM4NCAyNzAuOTMzMzMzeiIgZmlsbD0iIzQ0NEU2MCI+PC9wYXRoPjwvc3ZnPg==",polygon:"data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHBhdGggZD0iTTkzMy4xMiA0OTAuNjY2NjY3bC0xOTItMzMyLjM3MzMzNGE0Mi42NjY2NjcgNDIuNjY2NjY3IDAgMCAwLTM3LjEyLTIxLjMzMzMzM2gtMzg0YTQyLjY2NjY2NyA0Mi42NjY2NjcgMCAwIDAtMzcuMTIgMjEuMzMzMzMzbC0xOTIgMzMyLjM3MzMzNGE0Mi42NjY2NjcgNDIuNjY2NjY3IDAgMCAwIDAgNDIuNjY2NjY2bDE5MiAzMzIuMzczMzM0YTQyLjY2NjY2NyA0Mi42NjY2NjcgMCAwIDAgMzcuMTIgMjEuMzMzMzMzaDM4NGE0Mi42NjY2NjcgNDIuNjY2NjY3IDAgMCAwIDM3LjEyLTIxLjMzMzMzM2wxOTItMzMyLjM3MzMzNGE0Mi42NjY2NjcgNDIuNjY2NjY3IDAgMCAwIDAtNDIuNjY2NjY2eiBtLTI1NiAzMTEuMDRIMzQ0Ljc0NjY2N0wxNzcuMDY2NjY3IDUxMmwxNjcuNjgtMjg5LjcwNjY2N2gzMzQuNTA2NjY2TDg0Ni45MzMzMzMgNTEyeiIgZmlsbD0iIzQ0NEU2MCI+PC9wYXRoPjwvc3ZnPg==","polygon-active":"data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHBhdGggZD0iTTkzMy4xMiA0OTAuNjY2NjY3bC0xOTItMzMyLjM3MzMzNGE0Mi42NjY2NjcgNDIuNjY2NjY3IDAgMCAwLTM3LjEyLTIxLjMzMzMzM2gtMzg0YTQyLjY2NjY2NyA0Mi42NjY2NjcgMCAwIDAtMzcuMTIgMjEuMzMzMzMzbC0xOTIgMzMyLjM3MzMzNGE0Mi42NjY2NjcgNDIuNjY2NjY3IDAgMCAwIDAgNDIuNjY2NjY2bDE5MiAzMzIuMzczMzM0YTQyLjY2NjY2NyA0Mi42NjY2NjcgMCAwIDAgMzcuMTIgMjEuMzMzMzMzaDM4NGE0Mi42NjY2NjcgNDIuNjY2NjY3IDAgMCAwIDM3LjEyLTIxLjMzMzMzM2wxOTItMzMyLjM3MzMzNGE0Mi42NjY2NjcgNDIuNjY2NjY3IDAgMCAwIDAtNDIuNjY2NjY2eiBtLTI1NiAzMTEuMDRIMzQ0Ljc0NjY2N0wxNzcuMDY2NjY3IDUxMmwxNjcuNjgtMjg5LjcwNjY2N2gzMzQuNTA2NjY2TDg0Ni45MzMzMzMgNTEyeiIgZmlsbD0iIzMzODFGRiI+PC9wYXRoPjwvc3ZnPg==","polygon-vertex":"data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTA3NyAxMDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHBhdGggZD0iTTU0My40NzQ1MjYgNDIuMzA3MzY4YTExOS4zNzY4NDIgMTE5LjM3Njg0MiAwIDAgMSAxMTAuODA3NTc5IDE2My44NGwxOTAuNTcxNzkgMTM4LjYxNzI2NGExMTkuMzc2ODQyIDExOS4zNzY4NDIgMCAxIDEgODMuMzc1MTU4IDIxOC43MDQ4NDJsLTc0LjMyMDg0MiAyMjguODM3MDUyYTExOS4zMjI5NDcgMTE5LjMyMjk0NyAwIDAgMS02MS4yNzgzMTYgMjIxLjg4NDYzMmMtNDYuNzgwNjMyIDAtODcuMzA5NDc0LTI2Ljk0NzM2OC0xMDYuODczMjYzLTY2LjEyODg0MmgtMjg5LjQxNDczN2ExMTkuMzc2ODQyIDExOS4zNzY4NDIgMCAxIDEtMTc5LjczODk0OC0xNDcuODMzMjYzbC03Mi4yNzI4NDItMjIyLjY5MzA1My0zLjM5NTM2OCAwLjEwNzc4OUExMTkuMzc2ODQyIDExOS4zNzY4NDIgMCAwIDEgMjEuODI3MzY4IDQ2Ni43Mjg0MjFMMjEuNTU3ODk1IDQ1OC4yMTMwNTNhMTE5LjM3Njg0MiAxMTkuMzc2ODQyIDAgMCAxIDE4My44MzQ5NDctMTAwLjUxMzY4NWwyMjMuNTAxNDc0LTE2Mi4zODQ4NDJhMTE5LjQzMDczNyAxMTkuNDMwNzM3IDAgMCAxIDExNC41ODAyMS0xNTMuMDYxMDUyek0yODkuNDE0NzM3IDg0MC4wNTcyNjNhNTQuNzAzMTU4IDU0LjcwMzE1OCAwIDEgMCAwIDEwOS40MDYzMTYgNTQuNzAzMTU4IDU0LjcwMzE1OCAwIDAgMCAwLTEwOS40MDYzMTZ6IG01MDMuMTYxMjYzIDBhNTQuNzAzMTU4IDU0LjcwMzE1OCAwIDEgMCAwIDEwOS40MDYzMTYgNTQuNzAzMTU4IDU0LjcwMzE1OCAwIDAgMCAwLTEwOS40MDYzMTZ6TTQ2Mi42ODYzMTYgMjQ5LjU4NjUyNkwyNDguMTMxMzY4IDQwNS41NTc4OTVhMTE5LjMyMjk0NyAxMTkuMzIyOTQ3IDAgMCAxLTQyLjg0NjMxNSAxNTMuMjIyNzM3bDcwLjcwOTg5NCAyMTcuMzU3NDczYTExOS40MzA3MzcgMTE5LjQzMDczNyAwIDAgMSAxMzIuNDE5MzY5IDEwOC4yMjA2MzJINjczLjY4NDIxMWExMTkuNDMwNzM3IDExOS40MzA3MzcgMCAwIDEgMTE5LjE2MTI2My0xMDguOTc1MTU4bDcxLjE0MTA1Mi0yMTguOTc0MzE2YTExOS40MzA3MzcgMTE5LjQzMDczNyAwIDAgMS02Mi4wODY3MzctMTY0LjIxNzI2M2wtMTg2LjM2OC0xMzUuMjc1Nzg5Yy0xOS45OTQ5NDcgMTUuMDkwNTI2LTQ1LjAwMjEwNSAyNC4xNDQ4NDItNzIuMDU3MjYzIDI0LjE0NDg0MmExMTguOTQ1Njg0IDExOC45NDU2ODQgMCAwIDEtODAuNzg4MjEtMzEuNDc0NTI3eiBtLTMyMS43NTE1NzkgMTUzLjkyMzM2OWE1NC43MDMxNTggNTQuNzAzMTU4IDAgMSAwIDAgMTA5LjQwNjMxNiA1NC43MDMxNTggNTQuNzAzMTU4IDAgMCAwIDAtMTA5LjQwNjMxNnogbTc2Ny43MzA1MjYtMTIuNTU3NDc0YTU0LjcwMzE1OCA1NC43MDMxNTggMCAxIDAgMCAxMDkuNDA2MzE2IDU0LjcwMzE1OCA1NC43MDMxNTggMCAwIDAgMC0xMDkuNDA2MzE2eiBtLTM2NS4xOTA3MzctMjg0LjAyNTI2M2E1NC43MDMxNTggNTQuNzAzMTU4IDAgMSAwIDAgMTA5LjQ2MDIxIDU0LjcwMzE1OCA1NC43MDMxNTggMCAwIDAgMC0xMDkuNDA2MzE1eiIgZmlsbD0iIzQ0NEU2MCI+PC9wYXRoPjwvc3ZnPg==",star:"data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHBhdGggZD0iTTkwOC4xIDM1My4xbC0yNTMuOS0zNi45TDU0MC43IDg2LjFjLTMuMS02LjMtOC4yLTExLjQtMTQuNS0xNC41LTE1LjgtNy44LTM1LTEuMy00Mi45IDE0LjVMMzY5LjggMzE2LjJsLTI1My45IDM2LjljLTcgMS0xMy40IDQuMy0xOC4zIDkuMy0xMi4zIDEyLjctMTIuMSAzMi45IDAuNiA0NS4zbDE4My43IDE3OS4xLTQzLjQgMjUyLjljLTEuMiA2LjktMC4xIDE0LjEgMy4yIDIwLjMgOC4yIDE1LjYgMjcuNiAyMS43IDQzLjIgMTMuNEw1MTIgNzU0bDIyNy4xIDExOS40YzYuMiAzLjMgMTMuNCA0LjQgMjAuMyAzLjIgMTcuNC0zIDI5LjEtMTkuNSAyNi4xLTM2LjlsLTQzLjQtMjUyLjkgMTgzLjctMTc5LjFjNS00LjkgOC4zLTExLjMgOS4zLTE4LjMgMi43LTE3LjUtOS41LTMzLjctMjctMzYuM3pNNjY0LjggNTYxLjZsMzYuMSAyMTAuM0w1MTIgNjcyLjcgMzIzLjEgNzcybDM2LjEtMjEwLjMtMTUyLjgtMTQ5TDQxNy42IDM4MiA1MTIgMTkwLjcgNjA2LjQgMzgybDIxMS4yIDMwLjctMTUyLjggMTQ4Ljl6IiBmaWxsPSIjNDQ0RTYwIj48L3BhdGg+PC9zdmc+","star-active":"data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHBhdGggZD0iTTkwOC4xIDM1My4xbC0yNTMuOS0zNi45TDU0MC43IDg2LjFjLTMuMS02LjMtOC4yLTExLjQtMTQuNS0xNC41LTE1LjgtNy44LTM1LTEuMy00Mi45IDE0LjVMMzY5LjggMzE2LjJsLTI1My45IDM2LjljLTcgMS0xMy40IDQuMy0xOC4zIDkuMy0xMi4zIDEyLjctMTIuMSAzMi45IDAuNiA0NS4zbDE4My43IDE3OS4xLTQzLjQgMjUyLjljLTEuMiA2LjktMC4xIDE0LjEgMy4yIDIwLjMgOC4yIDE1LjYgMjcuNiAyMS43IDQzLjIgMTMuNEw1MTIgNzU0bDIyNy4xIDExOS40YzYuMiAzLjMgMTMuNCA0LjQgMjAuMyAzLjIgMTcuNC0zIDI5LjEtMTkuNSAyNi4xLTM2LjlsLTQzLjQtMjUyLjkgMTgzLjctMTc5LjFjNS00LjkgOC4zLTExLjMgOS4zLTE4LjMgMi43LTE3LjUtOS41LTMzLjctMjctMzYuM3pNNjY0LjggNTYxLjZsMzYuMSAyMTAuM0w1MTIgNjcyLjcgMzIzLjEgNzcybDM2LjEtMjEwLjMtMTUyLjgtMTQ5TDQxNy42IDM4MiA1MTIgMTkwLjcgNjA2LjQgMzgybDIxMS4yIDMwLjctMTUyLjggMTQ4Ljl6IiBmaWxsPSIjMzM4MUZGIj48L3BhdGg+PC9zdmc+","star-innerVertex":"data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHBhdGggZD0iTTg1LjMzMzMzMyAwYTg1LjMzMzMzMyA4NS4zMzMzMzMgMCAwIDEgODEuNDA4IDU5LjczMzMzM2g0OC4yMTMzMzR2ODUuMzMzMzM0TDE3MC42NjY2NjcgMTQ0Ljk4MTMzM1Y4NTMuMzMzMzMzaDY5My4zMzMzMzNsLTI2LjQ1MzMzMy02My40ODggNzguNzYyNjY2LTMyLjc2OCAzMi44NTMzMzQgNzguNzYyNjY3LTQyLjI0IDE3LjQ5MzMzM0g5MzguNjY2NjY3YTg1LjMzMzMzMyA4NS4zMzMzMzMgMCAwIDEgODQuNzM2IDc1LjM0OTMzNEwxMDI0IDkzOC42NjY2NjdhODUuMzMzMzMzIDg1LjMzMzMzMyAwIDAgMS0xNzAuNjY2NjY3IDBIMTcwLjY2NjY2N2E4NS4zMzMzMzMgODUuMzMzMzMzIDAgMSAxLTg1LjMzMzMzNC04NS4zMzMzMzRWMTcwLjY2NjY2N2E4NS4zMzMzMzMgODUuMzMzMzMzIDAgMSAxIDAtMTcwLjY2NjY2N3ogbTc2NS4zNTQ2NjcgNTk5LjQ2NjY2N2wzMi44NTMzMzMgNzguNzYyNjY2LTc4Ljg0OCAzMi44NTMzMzQtMzIuNzY4LTc4Ljc2MjY2NyA3OC43NjI2NjctMzIuODUzMzMzeiBtLTY1LjcwNjY2Ny0xNTcuNTI1MzM0bDMyLjg1MzMzNCA3OC43NjI2NjctNzguNzYyNjY3IDMyLjg1MzMzMy0zMi43NjgtNzguNzYyNjY2IDc4Ljc2MjY2Ny0zMi44NTMzMzR6TTcxOS4zNiAyODQuNDE2bDMyLjg1MzMzMyA3OC43NjI2NjctNzguNzYyNjY2IDMyLjg1MzMzMy0zMi44NTMzMzQtNzguNzYyNjY3IDc4Ljc2MjY2Ny0zMi44NTMzMzN6IG0tNjUuNjIxMzMzLTE1Ny41MjUzMzNsMzIuODUzMzMzIDc4Ljc2MjY2Ni03OC43NjI2NjcgMzIuODUzMzM0LTMyLjg1MzMzMy03OC43NjI2NjcgNzguNzYyNjY3LTMyLjg1MzMzM3pNMzg1LjcwNjY2NyA1OS43MzMzMzN2ODUuMzMzMzM0aC04NS4zMzMzMzR2LTg1LjMzMzMzNGg4NS4zMzMzMzR6IG0xNzAuNjY2NjY2IDB2ODUuMzMzMzM0aC04NS4zMzMzMzN2LTg1LjMzMzMzNGg4NS4zMzMzMzN6IiBmaWxsPSIjNDQ0RTYwIiA+PC9wYXRoPjwvc3ZnPg==","star-innerRatio":"data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHBhdGggZD0iTTU2OS4zNDQgNDQ5LjUzNmwxNDYuOTQ0IDI4LjY3MiAxLjAyNC00LjYwOHY0LjYwOGgxLjAyNGM5LjcyOCAwIDE2Ljg5Ni03LjY4IDIwLjQ4LTE0Ljg0OGwxLjAyNC0yLjA0OHYtMi41NmMwLTUuNjMyIDAtMTEuMjY0LTUuMTItMTYuMzg0LTMuMDcyLTMuMDcyLTcuMTY4LTcuMTY4LTEyLjgtNy42OGwtMTI0LjkyOC0yNC4wNjRMNTQxLjY5NiAyODYuNzJjLTIuMDQ4LTQuNjA4LTYuNjU2LTguMTkyLTExLjc3Ni05LjcyOC01LjEyLTEuNTM2LTEwLjc1Mi0xLjUzNi0xNS4zNiAxLjAyNGwtMS41MzYgMC41MTItMS4wMjQgMS4wMjRjLTguMTkyIDguMTkyLTEwLjc1MiAxOS40NTYtNi42NTYgMjcuMTM2bDY0IDE0Mi44NDh6IiBmaWxsPSIjMzM4MUZGIj48L3BhdGg+PHBhdGggZD0iTTkzMS4zMjggNDAzLjQ1NmMtMTAuMjQtMzUuMzI4LTM4LjQtNjEuNDQtNzEuNjgtNjYuNTZsLTE4NC44MzItMzUuODQtODIuNDMyLTE4Mi43ODRjLTEyLjgtMzMuMjgtNDYuMDgtNTYuMzItODAuMzg0LTU2LjMyLTMzLjc5MiAwLTY0LjUxMiAyMC40OC03OS44NzIgNTMuNzZMMzQ5LjE4NCAyOTkuMDA4bC0xODQuMzIgMzUuMzI4Yy0zMy43OTIgNS4xMi02MS45NTIgMzEuMjMyLTcyLjE5MiA2Ni41Ni05LjcyOCAzNC4zMDQtMS4wMjQgNzIuMTkyIDIzLjA0IDk4LjgxNmwxMzEuNTg0IDEzMy42MzItMzUuODQgMTk2LjYwOGMtNS42MzIgMzQuODE2IDguNzA0IDcxLjY4IDM1Ljg0IDk0LjIwOCAxMy44MjQgMTEuMjY0IDM0LjMwNCAxOC40MzIgNTIuMjI0IDE4LjQzMiAxNi44OTYgMCAyOS42OTYtMy4wNzIgNDEuNDcyLTEwLjI0bDE2OC45Ni05MS4xMzYgMTY2LjkxMiA5MS4xMzYgMS4wMjQgMC41MTJjMTYuODk2IDYuNjU2IDI5LjY5NiA5LjcyOCA0MC40NDggOS43MjggMTQuMzM2IDAgMjcuNjQ4LTQuMDk2IDQwLjQ0OC03LjY4IDQuNjA4LTEuNTM2IDkuNzI4LTMuMDcyIDE0Ljg0OC00LjA5NmwyLjU2LTAuNTEyIDIuMDQ4LTEuNTM2YzI1LjA4OC0yMy4wNCAzNy44ODgtNTguODggMzIuNzY4LTkzLjY5NmwtMzMuMjgtMTk2LjYwOCAxMzEuNTg0LTEzNi4xOTJjMjQuMDY0LTI3LjY0OCAzMi4yNTYtNjIuOTc2IDIyLjAxNi05OC44MTZ6TTI3Ni45OTIgODM2LjA5Nmw0MS45ODQtMjMxLjkzNi0xNTcuMTg0LTE1OS4yMzJjLTUuNjMyLTUuNjMyLTguMTkyLTE3LjQwOC02LjY1Ni0yOS4xODQgMy41ODQtMTAuMjQgMTAuMjQtMTYuMzg0IDE5LjQ1Ni0xNy45MmwyMTguMTEyLTQxLjk4NCA5Ni4yNTYtMjE1LjU1MmMzLjA3Mi03LjE2OCAxMi44LTE0LjMzNiAyMC40OC0xNC4zMzZzMTcuNDA4IDcuMTY4IDIwLjQ4IDE0Ljg0OGw5OC4zMDQgMjE1LjA0IDIxOC4xMTIgNDEuOTg0YzcuMTY4IDEuNTM2IDE1LjM2IDcuMTY4IDE2Ljg5NiAxNi4zODR2My4wNzJjMi4wNDggMTEuNzc2LTAuNTEyIDIyLjUyOC02LjY1NiAzMC43Mkw2OTkuOTA0IDYwOS4yOGwzOS45MzYgMjMxLjQyNGMxLjUzNiAxMC43NTItMi4wNDggMjAuNDgtMTAuMjQgMjcuMTM2bC0xLjAyNCAwLjUxMmMtMi41NiAyLjU2LTYuNjU2IDQuMDk2LTExLjI2NCA0LjA5Ni0yLjA0OCAwLTcuMTY4LTEuNTM2LTExLjI2NC0zLjU4NGwtMTk3LjEyLTEwOC4wMzItMTk5LjE2OCAxMDIuOTEyYy00LjA5NiAyLjA0OC05LjIxNiAzLjU4NC0xMS43NzYgMy41ODQtNC42MDggMC04LjcwNC0xLjUzNi0xMS4yNjQtNC4wOTZsLTEuMDI0LTAuNTEyYy02LjY1Ni02LjE0NC0xMC43NTItMTYuMzg0LTguNzA0LTI2LjYyNHoiIGZpbGw9IiM0NDRFNjAiPjwvcGF0aD48L3N2Zz4=",speechBallon:"data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHBhdGggZD0iTTgzMiA4MzJINDQ4bC0xMjggMTkyLTEyOC0xOTJjLTEwNi4wNDggMC0xOTItODYuMDE2LTE5Mi0xOTJWMTkyYTE5MiAxOTIgMCAwIDEgMTkyLTE5Mmg2NDBjMTA1Ljk4NCAwIDE5MiA4NS45NTIgMTkyIDE5MnY0NDhjMCAxMDUuOTg0LTg2LjAxNiAxOTItMTkyIDE5MnogbTY0LTY0MGE2NCA2NCAwIDAgMC02NC02NEgxOTJDMTU2LjY3MiAxMjggMTI4IDE1Ni42NzIgMTI4IDE5MnY0NDhhNjQgNjQgMCAwIDAgNjQgNjRoNDIuNjg4TDMyMCA4MzJsODUuMzEyLTEyOEg4MzJjMzUuMzkyIDAgNjQtMjguNjA4IDY0LTY0VjE5MnoiIGZpbGw9IiM0NDRFNjAiPjwvcGF0aD48L3N2Zz4=","speechBallon-active":"data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHBhdGggZD0iTTgzMiA4MzJINDQ4bC0xMjggMTkyLTEyOC0xOTJjLTEwNi4wNDggMC0xOTItODYuMDE2LTE5Mi0xOTJWMTkyYTE5MiAxOTIgMCAwIDEgMTkyLTE5Mmg2NDBjMTA1Ljk4NCAwIDE5MiA4NS45NTIgMTkyIDE5MnY0NDhjMCAxMDUuOTg0LTg2LjAxNiAxOTItMTkyIDE5MnogbTY0LTY0MGE2NCA2NCAwIDAgMC02NC02NEgxOTJDMTU2LjY3MiAxMjggMTI4IDE1Ni42NzIgMTI4IDE5MnY0NDhhNjQgNjQgMCAwIDAgNjQgNjRoNDIuNjg4TDMyMCA4MzJsODUuMzEyLTEyOEg4MzJjMzUuMzkyIDAgNjQtMjguNjA4IDY0LTY0VjE5MnoiIGZpbGw9IiMzMzgxRkYiPjwvcGF0aD48L3N2Zz4=","speechBallon-placement":"data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHBhdGggZD0iTTU3NiAyMTMuMzMzMzMzbDIyLjYxMzMzMyAyMi42MTMzMzRhMzIgMzIgMCAwIDAgMC00NS4yMjY2NjdMNTc2IDIxMy4zMzMzMzN6IG0tNjIuNzItMTA3Ljk0NjY2NmEzMiAzMiAwIDEgMC00NS4yMjY2NjcgNDUuMjI2NjY2bDQ1LjIyNjY2Ny00NS4yMjY2NjZ6IG0tNDUuMjI2NjY3IDE3MC42NjY2NjZhMzIgMzIgMCAwIDAgNDUuMjI2NjY3IDQ1LjIyNjY2N2wtNDUuMjI2NjY3LTQ1LjIyNjY2N3pNNDQ4IDgxMC42NjY2NjdsLTIyLjYxMzMzMy0yMi42MTMzMzRhMzIgMzIgMCAwIDAgMCA0NS4yMjY2NjdsMjIuNjEzMzMzLTIyLjYxMzMzM3ogbTEwNy45NDY2NjctNjIuNzJhMzIgMzIgMCAxIDAtNDUuMjI2NjY3LTQ1LjIyNjY2N2w0NS4yMjY2NjcgNDUuMjI2NjY3eiBtLTQ1LjIyNjY2NyAxNzAuNjY2NjY2YTMyIDMyIDAgMSAwIDQ1LjIyNjY2Ny00NS4yMjY2NjZsLTQ1LjIyNjY2NyA0NS4yMjY2NjZ6TTgxMC42NjY2NjcgNTc2bC0yMi42MTMzMzQgMjIuNjEzMzMzYTMyIDMyIDAgMCAwIDQ1LjIyNjY2NyAwTDgxMC42NjY2NjcgNTc2eiBtMTA3Ljk0NjY2Ni02Mi43MmEzMiAzMiAwIDEgMC00NS4yMjY2NjYtNDUuMjI2NjY3bDQ1LjIyNjY2NiA0NS4yMjY2Njd6IG0tMTcwLjY2NjY2Ni00NS4yMjY2NjdhMzIgMzIgMCAxIDAtNDUuMjI2NjY3IDQ1LjIyNjY2N2w0NS4yMjY2NjctNDUuMjI2NjY3ek0yMTMuMzMzMzMzIDQ0OGwyMi42MTMzMzQtMjIuNjEzMzMzYTMyIDMyIDAgMCAwLTQ1LjIyNjY2NyAwbDIyLjYxMzMzMyAyMi42MTMzMzN6IG02Mi43MiAxMDcuOTQ2NjY3YTMyIDMyIDAgMCAwIDQ1LjIyNjY2Ny00NS4yMjY2NjdsLTQ1LjIyNjY2NyA0NS4yMjY2Njd6IG0tMTcwLjY2NjY2Ni00NS4yMjY2NjdhMzIgMzIgMCAxIDAgNDUuMjI2NjY2IDQ1LjIyNjY2N2wtNDUuMjI2NjY2LTQ1LjIyNjY2N3pNMzA5LjMzMzMzMyAyMTMuMzMzMzMzQTc0LjY2NjY2NyA3NC42NjY2NjcgMCAwIDEgMjM0LjY2NjY2NyAyODh2NjRBMTM4LjY2NjY2NyAxMzguNjY2NjY3IDAgMCAwIDM3My4zMzMzMzMgMjEzLjMzMzMzM2gtNjR6TTIzNC42NjY2NjcgMjg4QTc0LjY2NjY2NyA3NC42NjY2NjcgMCAwIDEgMTYwIDIxMy4zMzMzMzNoLTY0QTEzOC42NjY2NjcgMTM4LjY2NjY2NyAwIDAgMCAyMzQuNjY2NjY3IDM1MnYtNjR6TTE2MCAyMTMuMzMzMzMzYzAtNDEuMjE2IDMzLjQ1MDY2Ny03NC42NjY2NjcgNzQuNjY2NjY3LTc0LjY2NjY2NnYtNjRBMTM4LjY2NjY2NyAxMzguNjY2NjY3IDAgMCAwIDk2IDIxMy4zMzMzMzNoNjR6TTIzNC42NjY2NjcgMTM4LjY2NjY2N2M0MS4yMTYgMCA3NC42NjY2NjcgMzMuNDUwNjY3IDc0LjY2NjY2NiA3NC42NjY2NjZoNjRBMTM4LjY2NjY2NyAxMzguNjY2NjY3IDAgMCAwIDIzNC42NjY2NjcgNzQuNjY2NjY3djY0ek0zNDEuMzMzMzMzIDI0NS4zMzMzMzNoMjM0LjY2NjY2N3YtNjRIMzQxLjMzMzMzM3Y2NHogbTI1Ny4yOC01NC42MTMzMzNsLTg1LjMzMzMzMy04NS4zMzMzMzMtNDUuMjI2NjY3IDQ1LjIyNjY2NiA4NS4zMzMzMzQgODUuMzMzMzM0IDQ1LjIyNjY2Ni00NS4yMjY2Njd6IG0tNDUuMjI2NjY2IDBsLTg1LjMzMzMzNCA4NS4zMzMzMzMgNDUuMjI2NjY3IDQ1LjIyNjY2NyA4NS4zMzMzMzMtODUuMzMzMzMzLTQ1LjIyNjY2Ni00NS4yMjY2Njd6TTY1MC42NjY2NjcgODEwLjY2NjY2N2ExMzguNjY2NjY3IDEzOC42NjY2NjcgMCAwIDAgMTM4LjY2NjY2NiAxMzguNjY2NjY2di02NEE3NC42NjY2NjcgNzQuNjY2NjY3IDAgMCAxIDcxNC42NjY2NjcgODEwLjY2NjY2N2gtNjR6IG0xMzguNjY2NjY2IDEzOC42NjY2NjZBMTM4LjY2NjY2NyAxMzguNjY2NjY3IDAgMCAwIDkyOCA4MTAuNjY2NjY3aC02NGE3NC42NjY2NjcgNzQuNjY2NjY3IDAgMCAxLTc0LjY2NjY2NyA3NC42NjY2NjZ2NjR6TTkyOCA4MTAuNjY2NjY3YTEzOC42NjY2NjcgMTM4LjY2NjY2NyAwIDAgMC0xMzguNjY2NjY3LTEzOC42NjY2Njd2NjRjNDEuMjE2IDAgNzQuNjY2NjY3IDMzLjQ1MDY2NyA3NC42NjY2NjcgNzQuNjY2NjY3aDY0eiBtLTEzOC42NjY2NjctMTM4LjY2NjY2N0ExMzguNjY2NjY3IDEzOC42NjY2NjcgMCAwIDAgNjUwLjY2NjY2NyA4MTAuNjY2NjY3aDY0YzAtNDEuMjE2IDMzLjQ1MDY2Ny03NC42NjY2NjcgNzQuNjY2NjY2LTc0LjY2NjY2N3YtNjR6IG0tMTA2LjY2NjY2NiAxMDYuNjY2NjY3aC0yMzQuNjY2NjY3djY0SDY4Mi42NjY2Njd2LTY0eiBtLTIxMi4wNTMzMzQgNTQuNjEzMzMzbDg1LjMzMzMzNC04NS4zMzMzMzMtNDUuMjI2NjY3LTQ1LjIyNjY2Ny04NS4zMzMzMzMgODUuMzMzMzMzIDQ1LjIyNjY2NiA0NS4yMjY2Njd6IG0tNDUuMjI2NjY2IDBsODUuMzMzMzMzIDg1LjMzMzMzMyA0NS4yMjY2NjctNDUuMjI2NjY2LTg1LjMzMzMzNC04NS4zMzMzMzQtNDUuMjI2NjY2IDQ1LjIyNjY2N3pNNjcyIDIzNC42NjY2NjdBMTM4LjY2NjY2NyAxMzguNjY2NjY3IDAgMCAwIDgxMC42NjY2NjcgMzczLjMzMzMzM3YtNjRhNzQuNjY2NjY3IDc0LjY2NjY2NyAwIDAgMS03NC42NjY2NjctNzQuNjY2NjY2aC02NHpNODEwLjY2NjY2NyAzNzMuMzMzMzMzYTEzOC42NjY2NjcgMTM4LjY2NjY2NyAwIDAgMCAxMzguNjY2NjY2LTEzOC42NjY2NjZoLTY0QTc0LjY2NjY2NyA3NC42NjY2NjcgMCAwIDEgODEwLjY2NjY2NyAzMDkuMzMzMzMzdjY0eiBtMTM4LjY2NjY2Ni0xMzguNjY2NjY2QTEzOC42NjY2NjcgMTM4LjY2NjY2NyAwIDAgMCA4MTAuNjY2NjY3IDk2djY0YzQxLjIxNiAwIDc0LjY2NjY2NyAzMy40NTA2NjcgNzQuNjY2NjY2IDc0LjY2NjY2N2g2NHpNODEwLjY2NjY2NyA5NmExMzguNjY2NjY3IDEzOC42NjY2NjcgMCAwIDAtMTM4LjY2NjY2NyAxMzguNjY2NjY3aDY0YzAtNDEuMjE2IDMzLjQ1MDY2Ny03NC42NjY2NjcgNzQuNjY2NjY3LTc0LjY2NjY2N3YtNjR6TTc3OC42NjY2NjcgMzQxLjMzMzMzM3YyMzQuNjY2NjY3aDY0VjM0MS4zMzMzMzNoLTY0eiBtNTQuNjEzMzMzIDI1Ny4yOGw4NS4zMzMzMzMtODUuMzMzMzMzLTQ1LjIyNjY2Ni00NS4yMjY2NjctODUuMzMzMzM0IDg1LjMzMzMzNCA0NS4yMjY2NjcgNDUuMjI2NjY2eiBtMC00NS4yMjY2NjZsLTg1LjMzMzMzMy04NS4zMzMzMzQtNDUuMjI2NjY3IDQ1LjIyNjY2NyA4NS4zMzMzMzMgODUuMzMzMzMzIDQ1LjIyNjY2Ny00NS4yMjY2NjZ6TTEzOC42NjY2NjcgNzg5LjMzMzMzM2MwLTQxLjIxNiAzMy40NTA2NjctNzQuNjY2NjY3IDc0LjY2NjY2Ni03NC42NjY2NjZ2LTY0YTEzOC42NjY2NjcgMTM4LjY2NjY2NyAwIDAgMC0xMzguNjY2NjY2IDEzOC42NjY2NjZoNjR6TTIxMy4zMzMzMzMgNzE0LjY2NjY2N2M0MS4yMTYgMCA3NC42NjY2NjcgMzMuNDUwNjY3IDc0LjY2NjY2NyA3NC42NjY2NjZoNjRBMTM4LjY2NjY2NyAxMzguNjY2NjY3IDAgMCAwIDIxMy4zMzMzMzMgNjUwLjY2NjY2N3Y2NHogbTc0LjY2NjY2NyA3NC42NjY2NjZBNzQuNjY2NjY3IDc0LjY2NjY2NyAwIDAgMSAyMTMuMzMzMzMzIDg2NHY2NGExMzguNjY2NjY3IDEzOC42NjY2NjcgMCAwIDAgMTM4LjY2NjY2Ny0xMzguNjY2NjY3aC02NHpNMjEzLjMzMzMzMyA4NjRhNzQuNjY2NjY3IDc0LjY2NjY2NyAwIDAgMS03NC42NjY2NjYtNzQuNjY2NjY3aC02NEExMzguNjY2NjY3IDEzOC42NjY2NjcgMCAwIDAgMjEzLjMzMzMzMyA5Mjh2LTY0ek0yNDUuMzMzMzMzIDY4Mi42NjY2Njd2LTIzNC42NjY2NjdoLTY0VjY4Mi42NjY2NjdoNjR6IG0tNTQuNjEzMzMzLTIxMi4wNTMzMzRsODUuMzMzMzMzIDg1LjMzMzMzNCA0NS4yMjY2NjctNDUuMjI2NjY3LTg1LjMzMzMzMy04NS4zMzMzMzMtNDUuMjI2NjY3IDQ1LjIyNjY2NnogbTAtNDUuMjI2NjY2bC04NS4zMzMzMzMgODUuMzMzMzMzIDQ1LjIyNjY2NiA0NS4yMjY2NjcgODUuMzMzMzM0LTg1LjMzMzMzNC00NS4yMjY2NjctNDUuMjI2NjY2eiIgIGZpbGw9IiM0NDRFNjAiPjwvcGF0aD48L3N2Zz4="};function Ce(o){return wy[o]}const by=o=>{const{workIds:t,mananger:e}=o;return ot.createElement("div",{className:"button normal-button",style:{touchAction:"none"},onPointerUp:r=>{r.cancelable&&r.preventDefault(),r.stopPropagation(),r.nativeEvent.stopImmediatePropagation(),Qt.emitMethod(Vt.MainEngine,jt.DeleteNode,{workIds:t||[Wt],viewId:e.viewId})}},ot.createElement("img",{alt:"icon",src:Ce("delete")}))},Oy=o=>{const{workIds:t,viewId:e}=o;return ot.createElement("div",{className:"button normal-button",onPointerUp:r=>{r.stopPropagation(),Qt.emitMethod(Vt.MainEngine,jt.CopyNode,{workIds:t||[Wt],viewId:e})}},ot.createElement("img",{alt:"icon",src:Ce("duplicate")}))},Ys=o=>{const{icon:t,onPointerUpHandler:e}=o;return ot.createElement("div",{className:"button normal-button",onPointerUp:e},ot.createElement("img",{src:Ce(t)}))},Ly=o=>{const{open:t,setOpen:e,floatBarRef:r}=o,{floatBarData:n,mananger:i}=pt.useContext(ae),[a,s]=pt.useState([]),u=pt.useMemo(()=>{if(r!=null&&r.current&&St.isNumber(n?.y)&&i!=null&&i.height){if(r.current.offsetTop&&r.current.offsetTop+n.y>180){const c={};return c.top="inherit",c.bottom=50,c}else if(!r.current.offsetTop&&i?.height-r.current.offsetTop-n.y<120){const c={};return c.top="inherit",c.bottom=50,c}}},[r?.current,n,i]),d=pt.useMemo(()=>t?ot.createElement("div",{className:"image-layer-menu",style:u},ot.createElement(Ys,{icon:"to-top",onPointerUpHandler:c=>{c.stopPropagation(),Qt.emitMethod(Vt.MainEngine,jt.ZIndexNode,{workIds:[Wt],layer:br.Top,viewId:i?.viewId})}}),ot.createElement(Ys,{icon:"to-bottom",onPointerUpHandler:c=>{c.stopPropagation(),Qt.emitMethod(Vt.MainEngine,jt.ZIndexNode,{workIds:[Wt],layer:br.Bottom,viewId:i?.viewId})}})):null,[t,u]),M=c=>{c.stopPropagation(),c.nativeEvent.stopImmediatePropagation(),e(!t)};return pt.useEffect(()=>{St.isEqual(n?.selectIds,a)||n!=null&&n.selectIds&&!St.isEqual(n?.selectIds,a)&&(s(n?.selectIds),e(!1))},[t,n,a,e]),ot.createElement("div",{className:`button normal-button ${t&&"active"}`,onPointerUp:M},d,ot.createElement("img",{alt:"icon",src:Ce(t?"layer-pressed":"layer")}))},Rr=o=>{o.stopPropagation(),o.nativeEvent.stopImmediatePropagation()},jy=()=>ot.createElement("svg",{style:{marginLeft:"2px"},viewBox:"0 0 1025 1024",width:"14",height:"14"},ot.createElement("path",{d:"M1016.5248 493.8752c-9.984-9.984-26.2144-9.984-36.1984 0l-183.6032 183.6032c-29.952 29.952-78.6944 29.952-108.5952 0l-239.2064-239.2064c-14.4384-14.4384-22.3744-33.6896-22.3744-54.3232s7.936-39.8848 22.3744-54.3232l183.6032-183.6032c9.984-9.984 9.984-26.2144 0-36.1984s-26.2144-9.984-36.1984 0l-183.6032 183.6032c-24.1152 24.1152-37.376 56.2176-37.376 90.5216 0 14.592 2.4576 28.8256 7.0656 42.1888l-374.8864 374.8864c-4.8128 4.8128-7.4752 11.3152-7.4752 18.1248l0 76.8c0 14.1312 11.4688 25.6 25.6 25.6l486.4 0c6.8096 0 13.312-2.7136 18.1248-7.4752l170.0864-170.0864c13.3632 4.6592 27.5968 7.0656 42.1888 7.0656 34.2528 0 66.4064-13.2608 90.5216-37.376l183.6032-183.6032c9.984-9.984 9.984-26.2144 0-36.1984zM501.4016 870.4l-450.2016 0 0-40.6016 358.5024-358.5024c1.024 1.0752 1.9968 2.1504 3.0208 3.1744l239.2064 239.2064c1.024 1.024 2.0992 2.048 3.1744 3.0208l-153.7024 153.7024z",fill:"#000000"})),Ro=o=>{const{activeColor:t,onPointerUpHandler:e}=o;return ot.createElement("div",{className:`font-color-button ${t==="transparent"?"active":""}`,onPointerUp:e},ot.createElement("div",{className:"circle none"}))},Tn=o=>{const{color:t,activeColor:e,onPointerUpHandler:r}=o;return ot.createElement("div",{className:`font-color-button ${t===e?"active":""}`,onPointerUp:r},ot.createElement("div",{className:"circle",style:{backgroundColor:Ie(t,1)}}))},Cn=o=>{const{opacity:t,activeColor:e,setCurOpacity:r}=o,[n,i]=pt.useState({x:108,y:0}),a=pt.useRef(0);if(pt.useEffect(()=>{i({x:t*100+8,y:0})},[]),!e)return null;const s=(c,v)=>{const p=Math.min(Math.max(c-8,0),100)/100;(t!==p||v===Et.Done)&&r(p,e,v)},u=(c,v)=>{v.x!==n?.x&&i({x:v.x,y:0}),!a.current&&(a.current=setTimeout(()=>{a.current=0,s(v.x,Et.Doing)},100))},d=()=>{r(t,e,Et.Start)},M=(c,v)=>{v.x!==n?.x&&i({x:v.x,y:0}),a.current&&(clearTimeout(a.current),a.current=0),s(v.x,Et.Done)};return ot.createElement("div",{className:"font-color-opacity",style:{marginLeft:"10px"},onPointerUp:c=>{a.current&&(clearTimeout(a.current),a.current=0);const v=c.nativeEvent.offsetX,p=Math.min(Math.max(v-12,0),100)/100;i({x:p*100+8,y:0}),r(p,e,Et.Done)}},ot.createElement("div",{className:"range-color",style:{background:`linear-gradient(to right, ${Ie(e,0)}, ${Ie(e,1)})`}}),ot.createElement("div",{className:"range-opacity"},ot.createElement(dr,{bounds:"parent",axis:"x",position:n,onDrag:u,onStart:d,onStop:M},ot.createElement("div",{className:"circle",style:{backgroundColor:Ie(e,t)},onPointerUp:Rr}))))},Ry=o=>{const{min:t,max:e,activeNumber:r,setActiveNumber:n,color:i}=o,[a,s]=pt.useState({x:108,y:0}),u=pt.useRef(0);if(pt.useEffect(()=>{const p=Math.ceil((r-t)/(e-t)*100)+8;s({x:p,y:0})},[]),!r)return null;const d=(p,T)=>{const x=Math.ceil(Math.max(p-8,0)/100*(e-t)+t);(r!==x||T===Et.Done)&&n(x,T)},M=(p,T)=>{T.x!==a?.x&&s({x:T.x,y:0}),!u.current&&(u.current=setTimeout(()=>{u.current=0,d(T.x,Et.Doing)},100))},c=()=>{n(r,Et.Start)},v=(p,T)=>{T.x!==a?.x&&s({x:T.x,y:0}),u.current&&(clearTimeout(u.current),u.current=0),d(T.x,Et.Done)};return ot.createElement("div",{className:"font-color-opacity",style:{marginLeft:"10px"},onPointerUp:p=>{u.current&&(clearTimeout(u.current),u.current=0);const T=p.nativeEvent.offsetX,x=Math.ceil(Math.max(T-12,0)/100*(e-t)+t),y=Math.ceil((x-t)/(e-t)*100)+8;s({x:y,y:0}),n(x,Et.Done)}},ot.createElement("div",{className:"range-color",style:{backgroundColor:i}}),ot.createElement("div",{className:"range-opacity"},ot.createElement(dr,{bounds:"parent",axis:"x",position:a,onDrag:M,onStart:c,onStop:v},ot.createElement("div",{className:"circle",style:{backgroundColor:i},onPointerUp:Rr},ot.createElement("div",{className:"range-opacity-data-icon"},r)))))},zy=o=>{const{useStroke:t,color:e,activeStrokeType:r,setStrokeType:n}=o;return ot.createElement("div",{className:"stroke-type-box"},!!t&&ot.createElement("div",{className:`stroke-type-box-item Stroke ${r===se.Stroke&&"active"}`,style:{backgroundColor:e},onPointerUp:()=>{n(se.Stroke)}}),ot.createElement("div",{className:`stroke-type-box-item Normal ${r===se.Normal&&"active"}`,style:{borderColor:e},onPointerUp:()=>{n(se.Normal)}}),ot.createElement("div",{className:`stroke-type-box-item Dotted ${r===se.Dotted&&"active"}`,style:{borderColor:e},onPointerUp:()=>{n(se.Dotted)}}),ot.createElement("div",{className:`stroke-type-box-item LongDotted ${r===se.LongDotted&&"active"}`,style:{borderColor:e},onPointerUp:()=>{n(se.LongDotted)}}))},By=o=>{const{open:t,setOpen:e,floatBarRef:r}=o,{floatBarData:n,floatBarColors:i,mananger:a,setFloatBarData:s}=pt.useContext(ae),[u,d]=pt.useState(),[M,c]=pt.useState(1);pt.useEffect(()=>{if(n!=null&&n.strokeColor){const[h,g]=In(n.strokeColor);d(h),c(g)}},[n]);const v=pt.useMemo(()=>{if(r!=null&&r.current&&n&&St.isNumber(n?.y)&&a!=null&&a.height){if(r.current.offsetTop&&r.current.offsetTop+n.y>180){const h={};return h.top="inherit",h.bottom=50,h}else if(!r.current.offsetTop&&a?.height-r.current.offsetTop-n.y<120){const h={};return h.top="inherit",h.bottom=50,h}}},[n,r,a?.height]),p=pt.useMemo(()=>ot.createElement(Cn,{key:"strokeColors",opacity:M,activeColor:u,setCurOpacity:(h,g,f)=>{c(h);const m=Ie(g,h);n!=null&&n.strokeColor&&s({strokeColor:m}),Qt.emitMethod(Vt.MainEngine,jt.SetColorNode,{workIds:[Wt],strokeColor:m,workState:f,viewId:a?.viewId})}}),[M,u,n?.strokeColor,a?.viewId,s]),T=pt.useMemo(()=>u&&n&&n.thickness?ot.createElement(Ry,{key:"strokeThickness",min:Math.min(n.thickness,a?.control.pluginOptions.extras.strokeWidth.min||me.strokeWidth.min),max:Math.max(n.thickness,a?.control.pluginOptions.extras.strokeWidth.max||me.strokeWidth.max),activeNumber:n.thickness,setActiveNumber:(h,g)=>{n!=null&&n.thickness&&s({thickness:h}),Qt.emitMethod(Vt.MainEngine,jt.SetColorNode,{workIds:[Wt],thickness:h,workState:g,viewId:a?.viewId})},color:u}):null,[u,n,a?.control.pluginOptions.extras.strokeWidth.max,a?.control.pluginOptions.extras.strokeWidth.min,a?.viewId,s]),x=pt.useMemo(()=>u&&n&&n!=null&&n.strokeType?ot.createElement(zy,{key:"strokeType",useStroke:n?.useStroke,activeStrokeType:n.strokeType,setStrokeType:h=>{n.strokeType&&s({strokeType:h}),Qt.emitMethod(Vt.MainEngine,jt.SetColorNode,{workIds:[Wt],strokeType:h,workState:Et.Done,viewId:a?.viewId})},color:u}):null,[u,n,a?.viewId,s]),y=pt.useMemo(()=>t?ot.createElement("div",{className:"font-colors-menu",style:v,onPointerUp:h=>{h.stopPropagation(),h.nativeEvent.stopImmediatePropagation()}},x,T,ot.createElement("div",{className:"font-colors-line"}),i.concat().map((h,g)=>{const f=jr(...h);return ot.createElement(Tn,{key:g,color:f,activeColor:u,onPointerUpHandler:m=>{m.stopPropagation(),d(f);const S=Ie(f,M);n!=null&&n.strokeColor&&(n.strokeColor=S,s({strokeColor:S})),Qt.emitMethod(Vt.MainEngine,jt.SetColorNode,{workIds:[Wt],workState:Et.Done,strokeColor:S,viewId:a?.viewId})}})}),p):null,[t,v,x,T,i,p,u,M,n,a?.viewId,s]),C=pt.useMemo(()=>u?ot.createElement("div",{className:"color-bar-ring",style:{backgroundColor:Ie(u,M)}},ot.createElement("div",{className:"circle"})):null,[u,M]);return ot.createElement("div",{className:`button normal-button font-colors-icon ${t&&"active"}`,onPointerUp:h=>{h.stopPropagation(),h.nativeEvent.stopImmediatePropagation(),e(!t)}},C,y)},Yy=o=>{const{open:t,setOpen:e,floatBarRef:r}=o,{floatBarData:n,floatBarColors:i,mananger:a,setFloatBarData:s}=pt.useContext(ae),[u,d]=pt.useState(),[M,c]=pt.useState(1);pt.useEffect(()=>{if(n!=null&&n.fillColor){const[y,C]=n?.fillColor==="transparent"&&["transparent",1]||In(n.fillColor);d(y),c(C)}},[n]);const v=pt.useMemo(()=>{if(r!=null&&r.current&&St.isNumber(n?.y)&&a!=null&&a.height){if(r.current.offsetTop&&r.current.offsetTop+n.y>200){const y={};return y.top="inherit",y.bottom=50,y}else if(!r.current.offsetTop&&a?.height-r.current.offsetTop-n.y<140){const y={};return y.top="inherit",y.bottom=50,y}}},[r,n,a?.height]),p=pt.useMemo(()=>u&&u!=="transparent"?ot.createElement(Cn,{key:"fillColors",opacity:M||0,activeColor:u,setCurOpacity:(y,C,h)=>{c(y);const g=Ie(C,y);n!=null&&n.fillColor&&(n.fillColor=g,s({fillColor:g})),Qt.emitMethod(Vt.MainEngine,jt.SetColorNode,{workIds:[Wt],fillColor:u&&Ie(C,y),workState:h,viewId:a?.viewId})}}):null,[u,M,n,a?.viewId,s]),T=pt.useMemo(()=>t?ot.createElement("div",{className:"font-colors-menu",style:v,onPointerUp:y=>{y.stopPropagation(),y.nativeEvent.stopImmediatePropagation()}},ot.createElement(Ro,{activeColor:u,onPointerUpHandler:y=>{y.stopPropagation(),d("transparent");const C="transparent";n!=null&&n.fillColor&&(n.fillColor=C,s({fillColor:C})),Qt.emitMethod(Vt.MainEngine,jt.SetColorNode,{workIds:[Wt],workState:Et.Done,fillColor:C,viewId:a?.viewId})}}),i.map((y,C)=>{const h=jr(...y);return ot.createElement(Tn,{key:C,color:h,activeColor:u,onPointerUpHandler:g=>{g.cancelable&&g.preventDefault(),g.stopPropagation(),d(h);const f=Ie(h,M);n!=null&&n.fillColor&&(n.fillColor=f,s({fillColor:f})),Qt.emitMethod(Vt.MainEngine,jt.SetColorNode,{workIds:[Wt],workState:Et.Done,fillColor:f,viewId:a?.viewId})}})}),p):null,[t,v,u,i,p,n,a?.viewId,s,M]),x=pt.useMemo(()=>{const y=u&&u!=="transparent"&&Ie(u,M)||"transparent";return ot.createElement("div",{className:"color-bar-fill"},ot.createElement("div",{className:"circle",style:{backgroundColor:y}}))},[u,M]);return ot.createElement("div",{className:`button normal-button font-colors-icon ${t&&"active"}`,onPointerUp:y=>{y.stopPropagation(),y.nativeEvent.stopImmediatePropagation(),e(!t)}},x,T)},Uy=o=>{const{open:t,setOpen:e,textOpt:r,workIds:n,floatBarRef:i}=o,{floatBarColors:a,mananger:s,setFloatBarData:u,floatBarData:d}=pt.useContext(ae),[M,c]=pt.useState(),[v,p]=pt.useState(1);pt.useEffect(()=>{if(r!=null&&r.fontColor){const[h,g]=r?.fontColor==="transparent"&&["transparent",0]||In(r.fontColor);c(h),p(g)}},[r?.fontColor]);const T=pt.useMemo(()=>{if(i!=null&&i.current&&d&&St.isNumber(d?.y)&&s!=null&&s.height){if(i.current.offsetTop&&i.current.offsetTop+d.y>180){const h={};return h.top="inherit",h.bottom=50,h}else if(!i.current.offsetTop&&s?.height-i.current.offsetTop-d.y<120){const h={};return h.top="inherit",h.bottom=50,h}}},[i,d,s?.height]),x=pt.useMemo(()=>M&&M!=="transparent"?ot.createElement(Cn,{key:"fontColors",opacity:v,activeColor:M,setCurOpacity:(h,g,f)=>{p(h);const m=Ie(g,h);d!=null&&d.textOpt&&(d.textOpt.fontColor=m,u({textOpt:d.textOpt})),Qt.emitMethod(Vt.MainEngine,jt.SetColorNode,{workIds:n||[Wt],fontColor:M&&m,workState:f,viewId:s?.viewId})}}):null,[u,M,v,s?.control.room,s?.viewId,d?.textOpt,n]),y=pt.useMemo(()=>t?ot.createElement("div",{className:"font-colors-menu",style:T,onPointerUp:h=>{h.stopPropagation(),h.nativeEvent.stopImmediatePropagation()}},a.map((h,g)=>{const f=jr(...h);return ot.createElement(Tn,{key:g,color:f,activeColor:M,onPointerUpHandler:m=>{m.stopPropagation(),c(f);const S=Ie(f,v);d!=null&&d.textOpt&&(d.textOpt.fontColor=S,u({textOpt:d.textOpt})),Qt.emitMethod(Vt.MainEngine,jt.SetColorNode,{workIds:n||[Wt],workState:Et.Done,fontColor:S,viewId:s?.viewId})}})}),x):null,[u,t,a,x,M,v,d?.textOpt,n,s?.viewId,T]),C=pt.useMemo(()=>{const h=M&&M!=="transparent"&&Ie(M,v)||"transparent";return ot.createElement("div",{className:"color-bar"},ot.createElement("div",{className:"color-bar-color",style:{backgroundColor:h}}))},[M,v]);return ot.createElement("div",{className:`button normal-button font-colors-icon ${t&&"active"}`,onPointerUp:h=>{h.stopPropagation(),h.nativeEvent.stopImmediatePropagation(),e(!t)}},ot.createElement("img",{alt:"icon",src:Ce("font-colors")}),C,y)},Wy=o=>{const{open:t,setOpen:e,textOpt:r,workIds:n,floatBarRef:i}=o,{floatBarColors:a,mananger:s,setFloatBarData:u,floatBarData:d}=pt.useContext(ae),[M,c]=pt.useState(),[v,p]=pt.useState(1);pt.useEffect(()=>{if(r!=null&&r.fontBgColor){const[h,g]=r?.fontBgColor==="transparent"&&["transparent",1]||In(r.fontBgColor);c(h),p(g)}},[r?.fontBgColor]);const T=pt.useMemo(()=>{if(i!=null&&i.current&&d&&St.isNumber(d?.y)&&s!=null&&s.height){if(i.current.offsetTop&&i.current.offsetTop+d.y>180){const h={};return h.top="inherit",h.bottom=50,h}else if(!i.current.offsetTop&&s?.height-i.current.offsetTop-d.y<120){const h={};return h.top="inherit",h.bottom=50,h}}},[i,d,s?.height]),x=pt.useMemo(()=>M&&M!=="transparent"?ot.createElement(Cn,{key:"fontBgColor",opacity:v||0,activeColor:M,setCurOpacity:(h,g,f)=>{p(h);const m=Ie(g,h);d!=null&&d.textOpt&&(d.textOpt.fontBgColor=m,u({textOpt:d.textOpt})),Qt.emitMethod(Vt.MainEngine,jt.SetColorNode,{workIds:n||[Wt],fontBgColor:M&&Ie(g,h),workState:f,viewId:s?.viewId})}}):null,[M,v,d?.textOpt,n,s?.viewId,u]),y=pt.useMemo(()=>t?ot.createElement("div",{className:"font-colors-menu",style:T,onPointerUp:h=>{h.stopPropagation(),h.nativeEvent.stopImmediatePropagation()}},ot.createElement(Ro,{activeColor:M,onPointerUpHandler:h=>{h.stopPropagation();const g="transparent";c(g),d!=null&&d.textOpt&&(d.textOpt.fontBgColor=g,u({textOpt:d.textOpt})),Qt.emitMethod(Vt.MainEngine,jt.SetColorNode,{workIds:n||[Wt],workState:Et.Done,fontBgColor:g,viewId:s?.viewId})}}),a.map((h,g)=>{const f=jr(...h);return ot.createElement(Tn,{key:g,color:f,activeColor:M,onPointerUpHandler:m=>{m.stopPropagation(),c(f);const S=Ie(f,v);d!=null&&d.textOpt&&(d.textOpt.fontBgColor=S,u({textOpt:d.textOpt})),Qt.emitMethod(Vt.MainEngine,jt.SetColorNode,{workIds:n||[Wt],workState:Et.Done,fontBgColor:Ie(f,v),viewId:s?.viewId})}})}),x):null,[u,t,a,x,v,M,d?.textOpt,n,s?.viewId,T]),C=pt.useMemo(()=>{const h=M&&M!=="transparent"&&Ie(M,v)||"transparent";return ot.createElement("div",{className:"color-bar",style:{marginTop:0}},ot.createElement("div",{className:"color-bar-color",style:{backgroundColor:h}}))},[M,v]);return ot.createElement("div",{className:`button normal-button font-colors-icon ${t&&"active"}`,onPointerUp:h=>{h.stopPropagation(),h.nativeEvent.stopImmediatePropagation(),e(!t)}},ot.createElement(jy,null),C,y)},Fy=o=>{const{bold:t,setBold:e,workIds:r,viewId:n}=o,i=a=>{const s=t==="bold"?"normal":"bold";a?.stopPropagation(),e(s),Qt.emitMethod(Vt.MainEngine,jt.SetFontStyle,{workIds:r,viewId:n,bold:s})};return ot.createElement("div",{className:"font-style-button",onPointerUp:i},ot.createElement("img",{alt:"icon",src:Ce(t==="bold"?"bold-active":"bold")}))},Vy=o=>{const{underline:t,setUnderline:e,workIds:r,viewId:n}=o,i=a=>{const s=!t;a?.stopPropagation(),e(s),Qt.emitMethod(Vt.MainEngine,jt.SetFontStyle,{workIds:r,viewId:n,underline:s})};return ot.createElement("div",{className:"font-style-button",onPointerUp:i},ot.createElement("img",{alt:"icon",src:Ce(t?"underline-active":"underline")}))},ky=o=>{const{lineThrough:t,setLineThrough:e,workIds:r,viewId:n}=o,i=a=>{const s=!t;a?.stopPropagation(),e(s),Qt.emitMethod(Vt.MainEngine,jt.SetFontStyle,{workIds:r,viewId:n,lineThrough:s})};return ot.createElement("div",{className:"font-style-button",onPointerUp:i},ot.createElement("img",{alt:"icon",src:Ce(t?"line-through-active":"line-through")}))},Xy=o=>{const{italic:t,setItalic:e,workIds:r,viewId:n}=o,i=a=>{const s=t==="italic"?"normal":"italic";a?.stopPropagation(),e(s),Qt.emitMethod(Vt.MainEngine,jt.SetFontStyle,{workIds:r,viewId:n,italic:s})};return ot.createElement("div",{className:"font-style-button",onPointerUp:i},ot.createElement("img",{alt:"icon",src:Ce(t==="italic"?"italic-active":"italic")}))},Gy=o=>{const{open:t,setOpen:e,textOpt:r,workIds:n,style:i,floatBarRef:a}=o,{mananger:s,floatBarData:u}=pt.useContext(ae),[d,M]=pt.useState("normal"),[c,v]=pt.useState("normal"),[p,T]=pt.useState(!1),[x,y]=pt.useState(!1);pt.useEffect(()=>{r!=null&&r.bold&&M(r.bold),St.isBoolean(r?.underline)&&T(r.underline||!1),St.isBoolean(r?.lineThrough)&&y(r.lineThrough||!1),r!=null&&r.italic&&v(r.italic)},[r]);const C=pt.useMemo(()=>{if(i&&a!=null&&a.current&&St.isNumber(u?.y)&&s!=null&&s.height){if(a.current.offsetTop&&a.current.offsetTop+u.y>180){const g={};return g.top="inherit",g.bottom=50,g}else if(!a.current.offsetTop&&s?.height-a.current.offsetTop-u.y<120){const g={};return g.top="inherit",g.bottom=50,g}}},[i,a?.current,u,s]),h=pt.useMemo(()=>t?ot.createElement("div",{className:"font-style-menu",style:C,onPointerUp:g=>{g.stopPropagation(),g.nativeEvent.stopImmediatePropagation()}},ot.createElement(Fy,{workIds:n||[Wt],bold:d,setBold:M,viewId:s?.viewId}),ot.createElement(Vy,{workIds:n||[Wt],underline:p,setUnderline:T,viewId:s?.viewId}),ot.createElement(ky,{workIds:n||[Wt],lineThrough:x,setLineThrough:y,viewId:s?.viewId}),ot.createElement(Xy,{workIds:n||[Wt],italic:c,setItalic:v,viewId:s?.viewId})):null,[t,n,d,s?.viewId,p,x,c,C]);return ot.createElement("div",{className:`button normal-button ${t&&"active"}`,onPointerUp:g=>{g.stopPropagation(),g.nativeEvent.stopImmediatePropagation(),e(!t)}},ot.createElement("img",{alt:"icon",src:Ce(t?"font-style-active":"font-style")}),h)},We=Object.freeze([12,14,18,24,36,48,64,80,144,288]),ur=["top","topLeft","topRight","bottom","bottomLeft","bottomRight","left","leftTop","leftBottom","right","rightTop","rightBottom"],Hy=new Map([["selector","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAKeSURBVHgB3VTLi1JhFD86zlQ4ysxSXAy1GWYZzMxmYAhHagRB/QN8FLqPFq4FIQhXkS6kTQ4t2ilIKEWgSS0SmVpIm0BdaBJSaOP78XU+PXey6+saburAD+73uL/feX0H4H81GQdj7D7ilrCGFRonk3c6nXvhcJiFQiGWy+Xy/X7/WbPZ1K1KkBOsl0qlO36/n+3t7Q1hs9kYF+WC3W73MTpxc1lBmej7KuJaoVDInZ6eqsWXDw4OwGKxwPHx8Se1Wn1Wr9cjW1tbOTxi9D9bJCJHXEFslsvlR263+246nYZZptPpQK/Xg8lkSvZ6vbNGo5EgQRCLiSPhIqpoNHobo3keCARgkalUKjg5ORlGuL+/n8T6PVAqlefjYmKRdYQSsZ3P5z8aDAYVLGFarRbi8fhbhUKhx2VPEJGP3eEbfTrs4MUwr4EU49FYrVbweDy1SqXyipy95FaI7g8QXS6SyWReHx4e2ubVBc+HtTk6OjqvVqtvvF7vi0gkUiSByyyJ21BGwpswJ2Vmsxlw/0Kj0bxMJBJJl8vFPWkhGogLQoeyMhEJo2jGUzYRjcPh+Op0Oq2pVOoHkXE0SahF/w+E+3KYNEaX2pSyiSiKxeJTFPiGyyriO6FKEUgSESLp4ht4bzQaf4pFYrHYO/ysEXGNyJtjKRqM/zNNhFuf0B7vst3dXdjZ2Yn4fL4vRFwn8jaMGqYPU179LBEGf3bZcNNutwPOtScwKnCLPJ9KLMWEh7mNuIFdVsNXzbBNP+D6Ou1vwAqm8hqMWlmbzWYf4mz6HAwGzbjWwGgqrEklmucJT+UGCfG3wiPjueeNwGvB0zkAid7OMmF8CyOck/I6NJcR4KZYcM6J2vCbUGhvyQIA0gonzCEZkQud9Fcd9W/bL57cJu3lkjuNAAAAAElFTkSuQmCC"],["pencil","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJ2SURBVHgB7ZXPqxJRFMfvjI4F+cqkTcrjge9B+B+0LJQ27lq4ijZprly6DaF1COKPjYRrVy0CF/aof6Baa6ChOPkLFcdMm1+dM93RafzxZuptgnfgC3ecO+dzz497JOTKNsZMp9OAoihvZFku4xp/I5dsbL/fP221Wl/D4bCKwnWn0znDd+SSDE/N6ZBgMKjJBNuKzC4dHTgQ5PF4bququn7R7XZJPB4/kSTpHcBOiQlmJ6cMpCvAcdz5ZDJhF4tF1u12v4jFYkc8z683+f1+Uq1W38K+x/AogVQ7ETF4SnB+Ho1GTxKJxDFC2u32q1KpJPh8vvVGjHK5XM4xahv+tYgRcranJrNarfay2WwKoVBIRTUajW42m70P390EOYmFrOEGdhfECEMIwur1Og+p5VOp1CP47piCOB3EXBBJAIuLRcZi7zKsSaVSEbxe70N4FEEL0AyE6VuBZEJD2wmyAkHDmoxGIwGW36ljBP2gUEXf5/wXCDZBsVjky+XyUwpCyBL0k0ai7gNp3WUVUigUvgHoWSaTaRoi2YJojk1r52q1eh2JRJ5YgUB3Pc/n83WyXRPV/A1rWrtgSAZsQL6Q3ynTI1F2QdCMqXNQEGsDMqMgrMt6ChwCaXcGYdBFjA3InELkQxBCtkcEI4riHyPFCMnlcnEKMbYzQhRi0TCKa6A76XT6wWAweD8ejz8Oh8PPcEc+9Xq9D8lkMgLv74Hugo5ALmJzlumG4+IG6BZ1dJ06wtPqN14gmza2FYljD1SljrCTsAaYpjnZFP7CmpADEel/ai4qffLiqSUKFSlEP8xfgYwwlmzyr1KYHoUtgBU4Y9D/Y78AxCeE/aWoyrkAAAAASUVORK5CYII="],["eraser","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAANKSURBVHgB1VTdS5NhFD/7iuXa8KNw7SK/IjBYo13soqvEITENtj9AwZiCOCTvQrNWF9rFFPGLrC1iF10Oiy68mBSUF2KB4YabhKKyTfFCc+3Lzb2ds72LsfbxCkZ04Mf7Puc5z/k95+M5AP+R8OAvCW9nZ6cyHo8/SSaTc4RQKKQ+S0JyxFtbW6va39//ZjKZmMbGRkar1TJOp5MhYtwXwBkQkgMROnyXIcmGw+FgYrHY00JkQm4cqYPCaDQ6ZrFY7i4sLPxhMDg4SJ8hTOOWRCJ5jf8npyUiEgE6eGy1Wk12u72gIZHJZDLr4eHhVnl5+YdsslL5pH1+JBIx22y2h9PT01BKpFIpLC4ufhKJRFpcxhEM6fmlSMLh8P35+XlOJCTBYBC2t7dr8fdctv+iRHjI4HK5LAMDA8BVFAoFyOVyH/6KIKsxCtVIgC188+Dg4CV2GJxGpqamYHR09AHklEWQY5d6K/gg67HD3huNRrlKpYLNzU3gIsPDw8Dn84fa29s/4zIK6Rol8xIhSUMikXB2dXXV4AHo6en5KhaLFcvLy0VJent7QaPRzKrV6le4DCEi2UTCnGgE1dXVj3Q6XY1er08drKiosK2urnbjnrFQQxBJU1PTC3y4kyxJGHEMWe2dTUSNIcLZVXl0dAStra3BiYmJOTqgVCqfu91uull3LhlFjbZv6urqiCTIElHaEsC2dq4QqXRlZeUePsrUDFtfX/eZzebbqL+GuIFks1js32OHRtHu7u5H3FMiahFViPNQYuZRO8oQVzY2NibJocFgYAKBgLuzs/M66hsQKuzELx0dHak9rKe3paXlFurrERdZEiGUGARkcAFxmSJAJ/aRkRGGnOKwdPn9/rG9vT0HXaC5uZnxer3+vr4+HdpeRVxClBWLJFuZqhF7gAjL0PGz8fFxvcfjSY0WevVUv5mZmQDWyog1/I52PyBdlxgUqUu+qMSQznVtW1ubBlP3dmlpicnA5/N5+vv770C6bhS9lEu6eHnWFP45NioJS5xxRLdNsrenKH5CusNOWH1BEeTRMTnI6MgZpYYeYhhOmS5eEX0mMhELPktGoBd/zCWSUkTAOs4QZqZ8JsokS8Kp8KWICtlwdv5P5BchBHaEIRURoQAAAABJRU5ErkJggg=="],["text","data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDdweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDcgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT50ZXh0LWN1cnNvcjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxwYXRoIGQ9Ik0xNiwyNi41IEMxNS43MjM4NTc2LDI2LjUgMTUuNSwyNi4yNzYxNDI0IDE1LjUsMjYgQzE1LjUsMjUuNzU0NTQwMSAxNS42NzY4NzUyLDI1LjU1MDM5MTYgMTUuOTEwMTI0NCwyNS41MDgwNTU3IEwxNiwyNS41IEwxOS41LDI1LjUgTDE5LjUsMTQuNSBMMTYsMTQuNSBDMTUuNzIzODU3NiwxNC41IDE1LjUsMTQuMjc2MTQyNCAxNS41LDE0IEMxNS41LDEzLjc1NDU0MDEgMTUuNjc2ODc1MiwxMy41NTAzOTE2IDE1LjkxMDEyNDQsMTMuNTA4MDU1NyBMMTYsMTMuNSBMMjQsMTMuNSBDMjQuMjc2MTQyNCwxMy41IDI0LjUsMTMuNzIzODU3NiAyNC41LDE0IEMyNC41LDE0LjI0NTQ1OTkgMjQuMzIzMTI0OCwxNC40NDk2MDg0IDI0LjA4OTg3NTYsMTQuNDkxOTQ0MyBMMjQsMTQuNSBMMjAuNSwxNC41IEwyMC41LDI1LjUgTDI0LDI1LjUgQzI0LjI3NjE0MjQsMjUuNSAyNC41LDI1LjcyMzg1NzYgMjQuNSwyNiBDMjQuNSwyNi4yNDU0NTk5IDI0LjMyMzEyNDgsMjYuNDQ5NjA4NCAyNC4wODk4NzU2LDI2LjQ5MTk0NDMgTDI0LDI2LjUgTDE2LDI2LjUgWiIgaWQ9InBhdGgtMSI+PC9wYXRoPgogICAgICAgIDxmaWx0ZXIgeD0iLTI4NC4wJSIgeT0iLTgxLjUlIiB3aWR0aD0iNjY4LjElIiBoZWlnaHQ9IjI5My45JSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0iZmlsdGVyLTIiPgogICAgICAgICAgICA8ZmVNb3JwaG9sb2d5IHJhZGl1cz0iMSIgb3BlcmF0b3I9ImRpbGF0ZSIgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd1NwcmVhZE91dGVyMSI+PC9mZU1vcnBob2xvZ3k+CiAgICAgICAgICAgIDxmZU9mZnNldCBkeD0iMCIgZHk9IjIiIGluPSJzaGFkb3dTcHJlYWRPdXRlcjEiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIj48L2ZlT2Zmc2V0PgogICAgICAgICAgICA8ZmVHYXVzc2lhbkJsdXIgc3RkRGV2aWF0aW9uPSIzIiBpbj0ic2hhZG93T2Zmc2V0T3V0ZXIxIiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgICAgIDxmZUNvbXBvc2l0ZSBpbj0ic2hhZG93Qmx1ck91dGVyMSIgaW4yPSJTb3VyY2VBbHBoYSIgb3BlcmF0b3I9Im91dCIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29tcG9zaXRlPgogICAgICAgICAgICA8ZmVDb2xvck1hdHJpeCB2YWx1ZXM9IjAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgMCAwIDAgMC4xNiAwIiB0eXBlPSJtYXRyaXgiIGluPSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29sb3JNYXRyaXg+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iLTQiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJXaGl0ZWJvYXJkLUd1aWRlbGluZXMiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zODguMDAwMDAwLCAtNjcyLjAwMDAwMCkiPgogICAgICAgICAgICA8ZyBpZD0idGV4dC1jdXJzb3IiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDM5Mi4wMDAwMDAsIDY3Mi4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaLlpIfku70tNDAiIGZpbGw9IiNGRkZGRkYiIG9wYWNpdHk9IjAuMDEiIHg9IjAiIHk9IjAiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcng9IjIiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgiIGZpbGwtcnVsZT0ibm9uemVybyI+CiAgICAgICAgICAgICAgICAgICAgPHVzZSBmaWxsPSJibGFjayIgZmlsbC1vcGFjaXR5PSIxIiBmaWx0ZXI9InVybCgjZmlsdGVyLTIpIiB4bGluazpocmVmPSIjcGF0aC0xIj48L3VzZT4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMSIgZD0iTTE5LDI1IEwxOSwxNSBMMTYsMTUgQzE1LjQ0NzcxNTMsMTUgMTUsMTQuNTUyMjg0NyAxNSwxNCBDMTUsMTMuNTE0NTg5NyAxNS4zNDc5OTkzLDEzLjEwMTkxNSAxNS44NjU0ODc3LDEzLjAxMDA1MjEgTDE2LDEzIEwyNCwxMyBDMjQuNTUyMjg0NywxMyAyNSwxMy40NDc3MTUzIDI1LDE0IEMyNSwxNC40ODU0MTAzIDI0LjY1MjAwMDcsMTQuODk4MDg1IDI0LjEzNDUxMjMsMTQuOTg5OTQ3OSBMMjQsMTUgTDIxLDE1IEwyMSwyNSBMMjQsMjUgQzI0LjU1MjI4NDcsMjUgMjUsMjUuNDQ3NzE1MyAyNSwyNiBDMjUsMjYuNDg1NDEwMyAyNC42NTIwMDA3LDI2Ljg5ODA4NSAyNC4xMzQ1MTIzLDI2Ljk4OTk0NzkgTDI0LDI3IEwxNiwyNyBDMTUuNDQ3NzE1MywyNyAxNSwyNi41NTIyODQ3IDE1LDI2IEMxNSwyNS41MTQ1ODk3IDE1LjM0Nzk5OTMsMjUuMTAxOTE1IDE1Ljg2NTQ4NzcsMjUuMDEwMDUyMSBMMTYsMjUgTDE5LDI1IFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4="],["shape","data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDBweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDAgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT5zaGFwZS1jdXJzb3I8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz4KICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0icGF0aC0xIj48L3BhdGg+CiAgICAgICAgPGZpbHRlciB4PSItNjQuNiUiIHk9Ii01OS41JSIgd2lkdGg9IjIyOS4zJSIgaGVpZ2h0PSIyNDYuMSUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0yIj4KICAgICAgICAgICAgPGZlTW9ycGhvbG9neSByYWRpdXM9IjEiIG9wZXJhdG9yPSJkaWxhdGUiIGluPSJTb3VyY2VBbHBoYSIgcmVzdWx0PSJzaGFkb3dTcHJlYWRPdXRlcjEiPjwvZmVNb3JwaG9sb2d5PgogICAgICAgICAgICA8ZmVPZmZzZXQgZHg9IjAiIGR5PSIyIiBpbj0ic2hhZG93U3ByZWFkT3V0ZXIxIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSI+PC9mZU9mZnNldD4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMyIgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlR2F1c3NpYW5CbHVyPgogICAgICAgICAgICA8ZmVDb21wb3NpdGUgaW49InNoYWRvd0JsdXJPdXRlcjEiIGluMj0iU291cmNlQWxwaGEiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbXBvc2l0ZT4KICAgICAgICAgICAgPGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDAgICAwIDAgMCAwIDAgICAwIDAgMCAwIDAgIDAgMCAwIDAuMTYgMCIgdHlwZT0ibWF0cml4IiBpbj0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbG9yTWF0cml4PgogICAgICAgIDwvZmlsdGVyPgogICAgPC9kZWZzPgogICAgPGcgaWQ9Iumhtemdoi00IiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0iV2hpdGVib2FyZC1HdWlkZWxpbmVzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMzQ0LjAwMDAwMCwgLTc1MS4wMDAwMDApIj4KICAgICAgICAgICAgPGcgaWQ9InNoYXBlLWN1cnNvciIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMzQ0LjAwMDAwMCwgNzUxLjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9ouWkh+S7vS00NCIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMC4wMSIgeD0iMCIgeT0iMCIgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIiByeD0iMiI+PC9yZWN0PgogICAgICAgICAgICAgICAgPGcgaWQ9IuW9oueKtue7k+WQiCIgZmlsbC1ydWxlPSJub256ZXJvIj4KICAgICAgICAgICAgICAgICAgICA8dXNlIGZpbGw9ImJsYWNrIiBmaWxsLW9wYWNpdHk9IjEiIGZpbHRlcj0idXJsKCNmaWx0ZXItMikiIHhsaW5rOmhyZWY9IiNwYXRoLTEiPjwvdXNlPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIxIiBkPSJNMjAsMjEgQzIwLjQ4NTQxMDMsMjEgMjAuODk4MDg1LDIxLjM0Nzk5OTMgMjAuOTg5OTQ3OSwyMS44NjU0ODc3IEwyMSwyMiBMMjEsMjcgQzIxLDI3LjU1MjI4NDcgMjAuNTUyMjg0NywyOCAyMCwyOCBDMTkuNTE0NTg5NywyOCAxOS4xMDE5MTUsMjcuNjUyMDAwNyAxOS4wMTAwNTIxLDI3LjEzNDUxMjMgTDE5LDI3IEwxOSwyMiBDMTksMjEuNDQ3NzE1MyAxOS40NDc3MTUzLDIxIDIwLDIxIFogTTI3LDE5IEMyNy41NTIyODQ3LDE5IDI4LDE5LjQ0NzcxNTMgMjgsMjAgQzI4LDIwLjQ4NTQxMDMgMjcuNjUyMDAwNywyMC44OTgwODUgMjcuMTM0NTEyMywyMC45ODk5NDc5IEwyNywyMSBMMjIsMjEgQzIxLjQ0NzcxNTMsMjEgMjEsMjAuNTUyMjg0NyAyMSwyMCBDMjEsMTkuNTE0NTg5NyAyMS4zNDc5OTkzLDE5LjEwMTkxNSAyMS44NjU0ODc3LDE5LjAxMDA1MjEgTDIyLDE5IEwyNywxOSBaIE0xOCwxOSBDMTguNTUyMjg0NywxOSAxOSwxOS40NDc3MTUzIDE5LDIwIEMxOSwyMC40ODU0MTAzIDE4LjY1MjAwMDcsMjAuODk4MDg1IDE4LjEzNDUxMjMsMjAuOTg5OTQ3OSBMMTgsMjEgTDEzLDIxIEMxMi40NDc3MTUzLDIxIDEyLDIwLjU1MjI4NDcgMTIsMjAgQzEyLDE5LjUxNDU4OTcgMTIuMzQ3OTk5MywxOS4xMDE5MTUgMTIuODY1NDg3NywxOS4wMTAwNTIxIEwxMywxOSBMMTgsMTkgWiBNMjAsMTIgQzIwLjQ4NTQxMDMsMTIgMjAuODk4MDg1LDEyLjM0Nzk5OTMgMjAuOTg5OTQ3OSwxMi44NjU0ODc3IEwyMSwxMyBMMjEsMTggQzIxLDE4LjU1MjI4NDcgMjAuNTUyMjg0NywxOSAyMCwxOSBDMTkuNTE0NTg5NywxOSAxOS4xMDE5MTUsMTguNjUyMDAwNyAxOS4wMTAwNTIxLDE4LjEzNDUxMjMgTDE5LDE4IEwxOSwxMyBDMTksMTIuNDQ3NzE1MyAxOS40NDc3MTUzLDEyIDIwLDEyIFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9oiIgZmlsbD0iI0ZGRkZGRiIgeD0iMTguNSIgeT0iMTciIHdpZHRoPSIzIiBoZWlnaHQ9IjYiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaIiIGZpbGw9IiNGRkZGRkYiIHg9IjE3IiB5PSIxOC41IiB3aWR0aD0iNiIgaGVpZ2h0PSIzIj48L3JlY3Q+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0i5b2i54q257uT5ZCIIiBmaWxsPSIjMjEyMzI0IiBmaWxsLXJ1bGU9Im5vbnplcm8iPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+"]]),Zy=o=>{const{style:t,onClickHandler:e}=o;return ot.createElement("div",{className:"font-size-menu",style:t,onPointerUp:r=>{r.stopPropagation(),r.nativeEvent.stopImmediatePropagation()}},We.map(r=>ot.createElement("div",{className:"font-size-btn",key:r,onPointerUp:()=>{e(r)}},r)))},Qy=o=>{const t=pt.useRef(null),{open:e,setOpen:r,textOpt:n,workIds:i,floatBarRef:a}=o,{mananger:s,floatBarData:u}=pt.useContext(ae),[d,M]=pt.useState(0),c=We.length-1;pt.useEffect(()=>{n!=null&&n.fontSize&&(M(n.fontSize),t.current&&(t.current.value=n.fontSize.toString()))},[n?.fontSize]);const v=pt.useMemo(()=>{if(a!=null&&a.current&&St.isNumber(u?.y)&&s!=null&&s.height){if(a.current.offsetTop&&a.current.offsetTop+u.y>180){const C={};return C.top="inherit",C.bottom=35,C}else if(!a.current.offsetTop&&s?.height-a.current.offsetTop-u.y<120){const C={};return C.top="inherit",C.bottom=35,C}}},[a?.current,u,s]);function p(C){M(C),C&&C>=We[0]&&C<=We[c]&&Qt.emitMethod(Vt.MainEngine,jt.SetFontStyle,{workIds:i||[Wt],fontSize:C,viewId:s?.viewId})}const T=C=>{var h;(h=t.current)==null||h.blur(),r(!1),y(C)},x=pt.useMemo(()=>e?ot.createElement(Zy,{onClickHandler:T,style:v}):null,[e,T,v]),y=C=>{C>We[c]&&(C=We[c]),C<We[0]&&(C=We[0]),p(C)};return ot.createElement("div",{className:"button normal-button font-size-barBtn",style:{width:50},onPointerUp:C=>{C.stopPropagation(),C.nativeEvent.stopImmediatePropagation()}},ot.createElement("input",{className:"font-size-input",ref:t,onTouchEnd:()=>{t.current&&t.current.focus()},onClick:()=>{r(!e),t.current&&t.current.focus()},onKeyDown:C=>{if(C.key==="Backspace"){const h=window.getSelection(),g=h?.getRangeAt(0);if(g!=null&&g.collapsed)return C.cancelable&&C.preventDefault(),document.execCommand("delete",!1),!1}return!1},onKeyUp:C=>{var h;if(t.current){const g=t.current.value,f=parseInt(g);isNaN(f)?t.current.value="0":t.current.value=f.toString(),f&&C.key==="Enter"&&(y(f),(h=t.current)==null||h.blur(),r(!1))}}}),ot.createElement("div",{className:"font-size-btns"},ot.createElement("div",{className:"font-size-add",onPointerUp:()=>{y(d+We[0])}}),ot.createElement("div",{className:"font-size-cut",onPointerUp:()=>{y(d-We[0])}})),x)},Ky=o=>{const{workIds:t,mananger:e,islocked:r}=o;return ot.createElement("div",{className:"button normal-button",onPointerUp:n=>{n.stopPropagation(),Qt.emitMethod(Vt.MainEngine,jt.SetLock,{workIds:t||[Wt],isLocked:!r,viewId:e?.viewId})}},ot.createElement("img",{alt:"icon",src:Ce(r?"unlock-new":"lock-new")}))},qn=o=>{const{icon:t,min:e,max:r,step:n,value:i,onInputHandler:a}=o,[s,u]=pt.useState(0),d=pt.useRef(null),M=c=>{c>r&&(c=r),c<e&&(c=e),u(c),a(c),d.current&&(d.current.value=c.toString())};return pt.useEffect(()=>{i&&(u(i),d.current&&(d.current.value=i.toString()))},[i]),ot.createElement("div",{className:"button input-button"},ot.createElement("img",{src:Ce(t)}),ot.createElement("input",{className:"input-number",type:"text",ref:d,onPointerUp:()=>{d.current&&d.current.focus()},onKeyDown:c=>{if(c.key==="Backspace"){const v=window.getSelection(),p=v?.getRangeAt(0);if(p!=null&&p.collapsed)return c.cancelable&&c.preventDefault(),document.execCommand("delete",!1),!1}},onKeyUp:()=>{if(d.current){const c=d.current.value,v=parseInt(c);isNaN(v)?d.current.value="0":d.current.value=v.toString()}},onChange:c=>{const v=c.target.value,p=parseInt(v);p&&p&&p>=e&&p<=r&&M(p)}}),ot.createElement("div",{className:"input-number-btns"},ot.createElement("div",{className:"input-number-add",onPointerUp:()=>{M(s+n)}}),ot.createElement("div",{className:"input-number-cut",onPointerUp:()=>{M(s-n)}})))},$y=o=>{const{icon:t,min:e,max:r,step:n,value:i,onInputHandler:a}=o;return ot.createElement("div",{className:"button input-button"},ot.createElement("img",{src:Ce(t)}),ot.createElement(Jy,{min:e,max:r,step:n,value:i,onInputHandler:a}))},Jy=o=>{const{value:t,min:e,max:r,onInputHandler:n}=o,[i,a]=pt.useState({x:0,y:0});pt.useEffect(()=>{a({x:t*100,y:0})},[]);const s=(M,c)=>{let v=Math.floor(Math.max(c.x,e*100));v=Math.floor(Math.min(v,r*100)),c.x!==i?.x&&a({x:v,y:0});const p=v/100;t!==p&&n(p)},u=()=>{},d=(M,c)=>{let v=Math.floor(Math.max(c.x,e*100));v=Math.floor(Math.min(v,r*100)),c.x!==i?.x&&a({x:v,y:0});const p=v/100;t!==p&&n(p)};return ot.createElement("div",{className:"range-number-container",onPointerUp:M=>{const c=M.nativeEvent.offsetX-6;let v=Math.floor(Math.max(c,e*100));v=Math.floor(Math.min(v,r*100)),a({x:v,y:0});const p=v/100;t!==p&&n(p)}},ot.createElement("div",{className:"range-number-color"}),ot.createElement("div",{className:"range-number"},ot.createElement(dr,{bounds:"parent",axis:"x",position:i,onDrag:s,onStart:u,onStop:d},ot.createElement("div",{className:"circle",onPointerUp:Rr}))))},qy=o=>{const{icon:t,value:e,onChangeHandler:r,style:n}=o,[i,a]=pt.useState(0),[s,u]=pt.useState(),d=pt.useRef(null),M=pt.useCallback(p=>{p>=ur.length&&(p=0),p<0&&(p=ur.length-1),a(p),r(ur[p]),u(!1),d.current&&(d.current.value=ur[p])},[r]),c=pt.useMemo(()=>{if(n&&n.bottom){const p={};return p.top="inherit",p.bottom=50,p}},[n]);pt.useEffect(()=>{e&&(a(ur.indexOf(e)),d.current&&(d.current.value=e))},[e]);const v=pt.useMemo(()=>s?ot.createElement(_y,{options:ur,onClickHandler:M,style:c}):null,[s,M,c]);return ot.createElement("div",{className:"button input-button"},ot.createElement("img",{src:Ce(t)}),ot.createElement("input",{readOnly:!0,className:"input-number",type:"text",ref:d,onPointerUp:()=>{d.current&&(d.current.focus(),u(!s))}}),ot.createElement("div",{className:"input-number-btns"},ot.createElement("div",{className:"input-number-add",onPointerUp:()=>{M(i+1)}}),ot.createElement("div",{className:"input-number-cut",onPointerUp:()=>{M(i-1)}})),v)},_y=o=>{const{options:t,style:e,onClickHandler:r}=o;return ot.createElement("div",{className:"select-option-menu",style:e},t.map((n,i)=>ot.createElement("div",{className:"select-option-btn",key:n,onPointerUp:()=>{r(i)}},n)))},tM=o=>{const{innerRatio:t,innerVerticeStep:e,vertices:r,mananger:n,setShapeOpt:i}=o,a=d=>{i({vertices:d}),Qt.emitMethod(Vt.MainEngine,jt.SetShapeOpt,{workIds:[Wt],toolsType:ht.Star,viewId:n.viewId,vertices:d})},s=d=>{i({innerVerticeStep:d}),Qt.emitMethod(Vt.MainEngine,jt.SetShapeOpt,{workIds:[Wt],toolsType:ht.Star,viewId:n.viewId,innerVerticeStep:d})},u=d=>{i({innerRatio:d}),Qt.emitMethod(Vt.MainEngine,jt.SetShapeOpt,{workIds:[Wt],toolsType:ht.Star,viewId:n.viewId,innerRatio:d})};return ot.createElement(ot.Fragment,null,ot.createElement(qn,{value:r,icon:"polygon-vertex",min:3,max:100,step:1,onInputHandler:a}),ot.createElement(qn,{value:e,icon:"star-innerVertex",min:1,max:100,step:1,onInputHandler:s}),ot.createElement($y,{value:t,icon:"star-innerRatio",min:.1,max:1,step:.1,onInputHandler:u}))},eM=o=>{const{mananger:t,vertices:e,setShapeOpt:r}=o,n=i=>{r({vertices:i}),Qt.emitMethod(Vt.MainEngine,jt.SetShapeOpt,{workIds:[Wt],toolsType:ht.Polygon,viewId:t.viewId,vertices:i})};return ot.createElement(qn,{value:e,icon:"polygon-vertex",min:3,max:100,step:1,onInputHandler:n})},rM=o=>{const{mananger:t,placement:e,setShapeOpt:r}=o,n=i=>{r({placement:i}),Qt.emitMethod(Vt.MainEngine,jt.SetShapeOpt,{workIds:[Wt],toolsType:ht.SpeechBalloon,viewId:t.viewId,placement:i})};return ot.createElement(qy,{value:e,icon:"speechBallon-placement",onChangeHandler:n})},Wn=o=>{const{icon:t,isActive:e,onPointerUpHandler:r}=o;return ot.createElement("div",{className:`button tab-button ${e?"active":""}`,onPointerUp:r},ot.createElement("img",{src:Ce(t)}))},nM=o=>{const{toolsTypes:t,style:e,mananger:r,shapeOpt:n,setShapeOpt:i}=o,[a,s]=pt.useState();pt.useEffect(()=>{t.includes(ht.Polygon)?s(ht.Polygon):t.includes(ht.Star)?s(ht.Star):s(ht.SpeechBalloon)},[t]);const u=v=>{s(v)},d=pt.useMemo(()=>a===ht.Polygon&&r&&n.vertices?ot.createElement(eM,{vertices:n.vertices,mananger:r,setShapeOpt:i}):null,[r,a,n,i]),M=pt.useMemo(()=>a===ht.Star&&r&&n.vertices&&n.innerVerticeStep&&n.innerRatio?ot.createElement(tM,{mananger:r,vertices:n.vertices,innerVerticeStep:n.innerVerticeStep,innerRatio:n.innerRatio,setShapeOpt:i}):null,[r,a,n,i]),c=pt.useMemo(()=>a===ht.SpeechBalloon&&r&&n.placement?ot.createElement(rM,{mananger:r,placement:n.placement,setShapeOpt:i}):null,[a,r,n.placement,i]);return ot.createElement("div",{className:"shapeOpt-sub-menu",style:e,onPointerUp:Rr},ot.createElement("div",{className:"shapeOpt-sub-menu-tabs"},t.includes(ht.Polygon)&&ot.createElement(Wn,{isActive:a===ht.Polygon,icon:a===ht.Polygon?"polygon-active":"polygon",onPointerUpHandler:u.bind(void 0,ht.Polygon)})||null,t.includes(ht.Star)&&ot.createElement(Wn,{isActive:a===ht.Star,icon:a===ht.Star?"star-active":"star",onPointerUpHandler:u.bind(void 0,ht.Star)})||null,t.includes(ht.SpeechBalloon)&&ot.createElement(Wn,{isActive:a===ht.SpeechBalloon,icon:a===ht.SpeechBalloon?"speechBallon-active":"speechBallon",onPointerUpHandler:u.bind(void 0,ht.SpeechBalloon)})||null),ot.createElement("div",{className:"shapeOpt-sub-menu-content"},d,M,c))},iM=o=>{const{open:t,setOpen:e,floatBarRef:r,toolsTypes:n,shapeOpt:i}=o,{floatBarData:a,mananger:s,setFloatBarData:u}=pt.useContext(ae),d=pt.useRef(null),M=pt.useMemo(()=>{if(r!=null&&r.current&&St.isNumber(a?.x)&&St.isNumber(a?.y)&&s!=null&&s.height){if(r.current.offsetTop&&r.current.offsetTop+a.y>200){const T={};return T.top="inherit",T.bottom=50,T}else if(!r.current.offsetTop&&s?.height-r.current.offsetTop-a?.y<140){const T={};return T.top="inherit",T.bottom=50,T}}},[r,a?.x,a?.y,s?.height]),c=pt.useCallback(T=>{u({shapeOpt:{...i,...T}})},[u,i]),v=pt.useMemo(()=>t&&n&&s&&i?ot.createElement(nM,{shapeOpt:i,style:M,toolsTypes:n,mananger:s,setShapeOpt:c}):null,[t,M,n,s,i,c]),p=()=>{e(!t)};return ot.createElement("div",{ref:d,className:`button normal-button ${t&&"active"}`,onPointerUp:p},v,ot.createElement("img",{alt:"icon",src:Ce(t?"shapes-active":"shapes")}))},zo=ot.memo(o=>{const{textOpt:t,workIds:e,noLayer:r,position:n,noDelete:i,noCopy:a}=o,{floatBarData:s,mananger:u}=pt.useContext(ae),[d,M]=ot.useState(0),[c,v]=ot.useState(),p=pt.useRef(null);pt.useEffect(()=>{var A,P,R,D;const L={},j=s?.w||((A=t?.boxSize)==null?void 0:A[0])||0,b=s?.h||((P=t?.boxSize)==null?void 0:P[1])||0;if(n&&j&&b&&u!=null&&u.width&&u!=null&&u.height){if(n.y<60?n.y+b<u.height-60?L.bottom=-120:n.y+b<u.height?L.bottom=-58:n.y>0?L.top=62:L.top=-n.y+62:L.top=0,n.x<0)L.left=-n.x+3;else if(n.x+(((R=p.current)==null?void 0:R.offsetWidth)||j)>u.width){const O=u.width-(((D=p.current)==null?void 0:D.offsetWidth)||j)-n.x;L.left=O}v(L);return}v(void 0)},[p,n,s?.w,s?.h,u?.width,u?.height,t?.boxSize]);const T=pt.useMemo(()=>s!=null&&s.fillColor?ot.createElement(Yy,{floatBarRef:p,open:d===3,setOpen:A=>{M(A===!0?3:0)}}):null,[s?.fillColor,d,p]),x=pt.useMemo(()=>s!=null&&s.strokeColor?ot.createElement(By,{floatBarRef:p,open:d===2,setOpen:A=>{M(A===!0?2:0)}}):null,[s?.strokeColor,d,p]),y=pt.useMemo(()=>t!=null&&t.fontColor&&u!=null&&u.viewId?ot.createElement(Uy,{floatBarRef:p,open:d===4,setOpen:A=>{M(A===!0?4:0)},textOpt:t,workIds:e}):null,[t,d,e,u,p]),C=pt.useMemo(()=>t!=null&&t.fontBgColor&&u!=null&&u.viewId?ot.createElement(Wy,{floatBarRef:p,open:d===5,setOpen:A=>{M(A===!0?5:0)},textOpt:t,workIds:e}):null,[t,d,e,u,p]),h=pt.useMemo(()=>t&&u!=null&&u.viewId?ot.createElement(Gy,{floatBarRef:p,open:d===6,setOpen:A=>{M(A===!0?6:0)},textOpt:t,workIds:e,style:c}):null,[t,d,e,u,c,p]),g=pt.useMemo(()=>t&&u!=null&&u.viewId?ot.createElement(Qy,{open:d===7,setOpen:A=>{M(A===!0?7:0)},textOpt:t,workIds:e,floatBarRef:p}):null,[t,d,e,u,p]),f=pt.useMemo(()=>r?null:ot.createElement(Ly,{open:d===1,setOpen:A=>{M(A===!0?1:0)},floatBarRef:p}),[r,d,p]),m=pt.useMemo(()=>s!=null&&s.canLock&&u?ot.createElement(Ky,{workIds:e,mananger:u,islocked:s.isLocked}):null,[s,u,e]),S=pt.useMemo(()=>u&&u!=null&&u.viewId&&c&&s!=null&&s.shapeOpt&&s!=null&&s.toolsTypes?ot.createElement(iM,{open:d===8,setOpen:A=>{M(A===!0?8:0)},floatBarRef:p,workIds:e,toolsTypes:s.toolsTypes,shapeOpt:s.shapeOpt}):null,[s,u,d,c,e,p]);return ot.createElement("div",{className:"appliance-plugin-floatbtns",style:c,ref:p},u&&!i&&ot.createElement(by,{workIds:e,mananger:u}),f,m,!!(u!=null&&u.viewId)&&!a&&ot.createElement(Oy,{workIds:e,viewId:u.viewId}),S,h,g,y,C,x,T)}),sM=o=>{const{data:t,workId:e,updateOptInfo:r,handlePointerDown:n,handlePointerUp:i}=o,{opt:a,scale:s,translate:u,x:d,y:M}=t,c=pt.useRef(null),{floatBarData:v}=pt.useContext(ae),p=pt.useMemo(()=>{const{fontSize:y,fontFamily:C,underline:h,fontColor:g,lineThrough:f,textAlign:m,strokeColor:S,lineHeight:A,bold:P,italic:R}=a,D=A||y*1.2,L={fontSize:`${y}px`,lineHeight:`${D}px`,color:"transparent",caretColor:g,borderColor:S,minHeight:`${D}px`,pointerEvents:"none",paddingRight:`${R==="italic"?Math.round(y*.3):5}px`};return C&&(L.fontFamily=`${C}`),(f||h)&&(L.textDecoration=`${f&&"line-through"||""}${h&&" underline"||""}`),m&&(L.textAlign=`${m}`),P&&(L.fontWeight=`${P}`),R&&(L.fontStyle=`${R}`),L},[a]),T=pt.useMemo(()=>{const y=[];if(a.text){const C=mi(a.text);for(let h=0;h<C.length;h++){const g=C[h];g===""?y.push(ot.createElement("div",{key:h})):y.push(ot.createElement("div",{key:h},g))}}return y.length?y:ot.createElement("div",null)},[a.text]),x=pt.useMemo(()=>{if(!v)return{};const y=`scale(${s||1}) ${u&&"translate("+u[0]+"px,"+u[1]+"px)"||""}`;return{left:`${d-v.x}px`,top:`${M-v.y}px`,zIndex:1,transform:y,transformOrigin:"left top",opacity:0,pointerEvents:"auto"}},[s,u,d,M,v]);return pt.useEffect(()=>{var y,C;if((y=c.current)!=null&&y.offsetWidth&&(C=c.current)!=null&&C.offsetHeight){const h=a.boxSize;if(h?.[0]!==c.current.offsetWidth||h[1]!==c.current.offsetHeight||!h){const g=[c.current.offsetWidth,c.current.offsetHeight];r({activeTextId:e,update:{boxSize:g,workState:Et.Done}})}}},[a.fontSize,a.italic,a.bold,a.boxSize,e,r]),ot.createElement("div",{className:"editor-box readonly",style:x,onPointerDown:()=>{n(e)},onPointerUp:()=>{i()}},ot.createElement("div",{className:"editor",ref:c,style:p},T))},oM=o=>{const{mananger:t}=pt.useContext(ae),e=pt.useMemo(()=>{var r;const n=i=>{var a,s;if(!t)return;const{activeTextId:u,update:d,syncData:M}=i,c=u&&St.cloneDeep(((a=t.control.textEditorManager)==null?void 0:a.get(u))||((s=o.editors)==null?void 0:s.get(u)));c&&c.opt&&(c.opt={...c.opt,...d},M&&(c.canSync=Object.keys(M).includes("canSync")&&M.canSync||c.canSync,c.canWorker=Object.keys(M).includes("canWorker")&&M.canWorker||c.canWorker),t.control.textEditorManager.updateForViewEdited(u,c))};if((r=o.editors)!=null&&r.size){const i=[];return o.editors.forEach((a,s)=>{if(o.selectIds&&o.selectIds.includes(s)){const u=ot.createElement(sM,{key:s,workId:s,data:a,updateOptInfo:n,handlePointerDown:o.handleTextEditorPointerDown,handlePointerUp:o.handleTextEditorPointerUp});i.push(u)}}),i}return null},[o.editors,o.selectIds,t,o.handleTextEditorPointerDown,o.handleTextEditorPointerUp]);return ot.createElement(ot.Fragment,null,e)},aM=o=>{const{position:t,textOpt:e,workIds:r,noLayer:n,noCopy:i,noDelete:a,style:s}=o,u=pt.useRef(null);return ot.createElement("div",{className:Ee.FloatBarBtn,ref:u,style:s},ot.createElement(zo,{position:t,textOpt:e,workIds:r,noLayer:n,noCopy:i,noDelete:a}))},lM=o=>{const{data:t,workId:e,showFloatBtns:r,handleKeyUp:n,handleFocus:i,runAnimation:a,updateSize:s,rightBoundBreak:u}=o,{activeTextEditor:d,activeTextId:M,mananger:c}=pt.useContext(ae),{opt:v,scale:p,translate:T,x,y}=t,{fontSize:C,fontFamily:h,underline:g,fontColor:f,lineThrough:m,textAlign:S,lineHeight:A,bold:P,italic:R}=v,D=pt.useRef(null),L=pt.useMemo(()=>{const _=C,U=A||_*1.2,H={fontSize:`${_}px`,lineHeight:`${U}px`,caretColor:f,color:"transparent",minHeight:`${U}px`,paddingRight:`${R==="italic"?Math.round(_*.3):5}px`,borderWidth:0};return h&&(H.fontFamily=`${h}`),(m||g)&&(H.textDecoration=`${m&&"line-through"||""} ${g&&" underline"||""}`),S&&(H.textAlign=`${S}`),P&&(H.fontWeight=`${P}`),R&&(H.fontStyle=`${R}`),H},[P,f,h,C,R,A,m,p,S,g]),j=pt.useRef(!1),b=pt.useRef(6),O=pt.useRef({fontSize:L.fontSize,lineHeight:L.lineHeight,fontStyle:L.fontStyle,fontWeight:L.fontWeight,fontFamily:L.fontFamily}),Y=pt.useMemo(()=>M===e?"hover":v.workState===Et.Doing||v.workState===Et.Start?"editing":d?"active":"none",[M,e,v.workState,d]);function X(_){if(D.current){const U=window?.getSelection(),H=D.current,E=(w,B)=>{var G;const K=document.createRange();if(B.childNodes.length>0){const et=B.lastChild;if(et){const at=et.lastChild;at&&at.nodeType===Node.TEXT_NODE?K.setStart(at,((G=at.textContent)==null?void 0:G.length)||0):K.setStart(et,0)}else K.setStart(B,0)}else K.setStart(B,0);K.collapse(!0),w.removeAllRanges(),w.addRange(K)};if(U&&H)if(_&&en(_.nativeEvent)){const{x:w,y:B}=Oo(_.nativeEvent);if(document.caretPositionFromPoint){const G=document.caretPositionFromPoint(w,B);if(G){const K=document.createRange();K.setStart(G.offsetNode,G.offset),K.collapse(!0),U.removeAllRanges(),U.addRange(K)}else E(U,H)}else if(document.caretRangeFromPoint){const G=document.caretRangeFromPoint(w,B);G?(U.removeAllRanges(),U.addRange(G)):E(U,H)}else E(U,H)}else E(U,H);D.current.focus()}}const Z=pt.useMemo(()=>{const _=`scale(${p||1}) ${T&&"translate("+T[0]+"px,"+T[1]+"px)"||""}`;return{left:`${x-Os*(p||1)}px`,top:`${y-Os*(p||1)}px`,zIndex:2,transform:_,transformOrigin:"left top",borderColor:Y==="editing"||Y==="hover"?f:"transparent"}},[p,T,x,y,f,Y]),$=pt.useMemo(()=>{let _="";const U=`<div style="background-color:${v.fontBgColor};"></div>`;if(v.text){const H=mi(v.text);for(let E=0;E<H.length;E++){const w=H[E];if(w==="")_=_+U;else{const B=w.replace(/[<>&]/g,G=>({"<":"<",">":">","&":"&"})[G]);_=_+`<div style="background-color:${v.fontBgColor}">${B}</div>`}}}else _=U;return _},[v.fontBgColor,v.text]),rt=pt.useMemo(()=>{var _,U;if(Y==="hover"){if(p&&r&&St.isNumber(x)&&St.isNumber(y)&&v.boxSize&&St.isNumber((_=v.boxSize)==null?void 0:_[0])&&St.isNumber((U=v.boxSize)==null?void 0:U[1])){const H={x,y},E={left:x,top:y,width:v.boxSize[0]*p,height:v.boxSize[1]*p};return ot.createElement(aM,{position:H,style:E,textOpt:v,workIds:[e],noLayer:!0,noCopy:!0,noDelete:!0})}return null}return null},[v,r,e,x,y,p,Y]);pt.useEffect(()=>{M===e&&D.current&&(document.activeElement!==D.current&&X(),i(D.current))},[M,i,e]),pt.useEffect(()=>{if(D.current){const _=parseInt(getComputedStyle(D.current).paddingRight,10)+parseInt(getComputedStyle(D.current).borderWidth,10);b.current=Number(_)}},[]),pt.useEffect(()=>{if(D.current){const _={fontSize:L.fontSize,lineHeight:L.lineHeight,fontStyle:L.fontStyle,fontWeight:L.fontWeight,fontFamily:L.fontFamily};if(!St.isEqual(O.current,_)){O.current=_;const U=[D.current.offsetWidth,D.current.offsetHeight];s(e,U)}}},[L,e,s]);const F=pt.useCallback(_=>{var U,H;const E=c?.parentElement;if(!E||!D.current||!u)return!1;const w=D.current.lastChild;if(!w||w instanceof Text)return!1;const B=w?.getBoundingClientRect(),G=E?.getBoundingClientRect();if(!B||!G)return!1;if(B.right+_>G.right){const K=w.lastChild;if(!(K instanceof Text))return!1;const et=K.length||0;let at=0,ut=0,gt=et;for(;ut<gt;){const yt=Math.floor((ut+gt)/2),Ct=document.createRange();Ct.setStart(K,0),Ct.setEnd(K,yt);const vt=Ct.getBoundingClientRect(),mt=G.right-vt.right;if(mt<_){if(yt>0){const It=document.createRange();It.setStart(K,0),It.setEnd(K,yt-1);const wt=It.getBoundingClientRect();if(G.right-wt.right>=_){at=yt-1;break}}gt=yt}else{const It=yt+1;if(It<et){const wt=document.createRange();wt.setStart(K,0),wt.setEnd(K,It);const bt=wt.getBoundingClientRect();if(G.right-bt.right<=_&&mt>_){at=yt;break}}ut=It}}if(!at){const yt=document.createRange();yt.setStart(K,0),yt.setEnd(K,ut);const Ct=yt.getBoundingClientRect();G.right-Ct.right>_?at=ut:ut>0&&(at=ut-1)}if(at>0){const yt=((U=K.textContent)==null?void 0:U.slice(0,at))||"",Ct=((H=K.textContent)==null?void 0:H.slice(at))||"";K.textContent=yt;const vt=document.createElement("div");return v.fontBgColor&&(vt.style.backgroundColor=v.fontBgColor),Ct&&(vt.textContent=Ct),D.current.appendChild(vt),F(_),!0}}return!1},[c?.parentElement,v.fontBgColor,u]);function Q(_){if(_.key==="Backspace"){const U=window.getSelection(),H=U?.getRangeAt(0);if(H!=null&&H.collapsed)return _.cancelable&&_.preventDefault(),document.execCommand("delete",!1),!1}return!1}function tt(_,U){const H=window?.getSelection();if(H!=null&&H.rangeCount&&_&&H&&H.anchorNode){const E=H.anchorOffset,w=H.anchorNode.textContent||"",B=w.slice(0,E)||"",G=w.slice(E)||"",K=B.concat(_)||"";lt(K,G,U)}}function lt(_,U,H){const E=window?.getSelection();if(!(E!=null&&E.rangeCount)||!E.anchorNode)return;const w=_.split(/\n/);let B=E.anchorNode.parentNode;B===H&&(B=E.anchorNode);const G=[...H.childNodes],K=[];let et,at=E.anchorOffset;for(;G.length;){const ut=G.pop();if(ut){if(ut===B){let gt=w[0];w.length===1&&(at=w[0].length,gt=w[0].concat(U)),B.nodeName==="#text"?(B.textContent=gt,et=B):B.nodeName==="DIV"&&(B.innerText=gt,et=B.childNodes[0]);break}K.push(ut),H.removeChild(ut)}}if(w.length>1)for(let ut=1;ut<w.length;ut++){let gt=w[ut];const yt=document.createElement("div");v.fontBgColor&&(yt.style.backgroundColor=v.fontBgColor),ut===w.length-1&&(at=gt.length,gt=gt.concat(U)),yt.innerText=gt,H.appendChild(yt),ut===w.length-1&&(et=yt.childNodes[0])}if(K.length){K.reverse();for(const ut of K)H.appendChild(ut)}if(et&&et.nodeName==="#text"){E.deleteFromDocument();const ut=document.createRange(),gt=Math.min(at,et?.length||0);ut.setStart(et,gt),ut.collapse(!0),E.removeAllRanges(),E.addRange(ut)}}function ct(_){if(_.cancelable&&_.preventDefault(),_.stopPropagation(),_.nativeEvent.stopImmediatePropagation(),D.current){const U=(_.clipboardData||window.clipboardData).getData("text"),H=window?.getSelection();if(!(H!=null&&H.rangeCount))return;if(U&&H&&H.anchorNode){const E=Xn(U,{whiteList:{},stripIgnoreTag:!0,stripIgnoreTagBody:["script"]});tt(E,D.current),F((p||1)*b.current),n(D.current)}a()}return!1}function Mt(_){var U;const H=_.querySelector("div");if(H){const E=document.createTreeWalker(_,NodeFilter.SHOW_TEXT,null);let w;const B=[];for(;(w=E.nextNode())!==null;)w.parentNode===_&&B.push(w);if(B.length>0){for(const K of B)H.appendChild(K);const G=window.getSelection();if(G){const K=document.createRange(),et=H.lastChild;et&&et.nodeType===Node.TEXT_NODE&&(K.setStart(et,((U=et.textContent)==null?void 0:U.length)||0),K.collapse(!0),G.removeAllRanges(),G.addRange(K))}}}}const st=pt.useCallback(()=>{const _=D.current;a(()=>{if(_){if(Mt(_),!j.current&&F((p||1)*b.current)){const U=window.getSelection();if(!(U!=null&&U.rangeCount))return!1;const H=document.createRange(),E=D.current.lastChild;H.selectNodeContents(E),H.collapse(!1),U.removeAllRanges(),U.addRange(H)}n(_)}})},[a,n,F,p]);function Tt(){j.current=!0,a()}function xt(){j.current=!1,st()}function W(){st(),a()}const k=pt.useCallback(()=>{if(Y==="active"&&D.current&&D.current.parentElement){const _=D.current.parentElement;_.style.borderColor=f}},[Y,f]),q=pt.useCallback(()=>{if(Y==="active"&&D.current&&D.current.parentElement){const _=D.current.parentElement;_.style.borderColor="transparent"}},[Y]);return ot.createElement(ot.Fragment,null,rt,ot.createElement("div",{className:`editor-box ${Y}`,style:Z,onPointerUp:()=>{var _;if(Y==="editing"){a(()=>{var U;(U=document.activeElement)==null||U.blur(),c?.control.textEditorManager.checkEmptyTextBlur()});return}if(Y==="active"&&c){if((_=c.control.collector)!=null&&_.hasIncludeSelector(e)){a(()=>{var U;(U=document.activeElement)==null||U.blur(),c?.control.textEditorManager.checkEmptyTextBlur()});return}if(c&&M!==e){c.control.textEditorManager.checkEmptyTextBlur(),c.control.textEditorManager.active(e);return}}},onMouseOver:k,onMouseLeave:q},ot.createElement("div",{id:e,suppressContentEditableWarning:!0,contentEditable:!0,className:"editor",ref:D,style:L,onKeyDown:Q,onPaste:ct,onTouchEnd:X,onInput:st,onCompositionStart:Tt,onCompositionUpdate:W,onCompositionEnd:xt,dangerouslySetInnerHTML:{__html:$}})))},cM=o=>{const t=pt.useRef(null),{mananger:e}=pt.useContext(ae),r=pt.useRef(),n=pt.useCallback(a=>{var s,u;const{activeTextId:d,update:M,syncData:c}=a;if(!e)return;const v=d&&St.cloneDeep(((s=e.control.textEditorManager)==null?void 0:s.get(d))||((u=o.editors)==null?void 0:u.get(d)));v&&v.opt&&(v.opt={...v.opt,...M},c&&(v.canSync=Object.keys(c).includes("canSync")&&c.canSync||v.canSync,v.canWorker=Object.keys(c).includes("canWorker")&&c.canWorker||v.canWorker),e.control.textEditorManager.updateForViewEdited(d,v))},[e,o.editors]),i=pt.useMemo(()=>{var a;const s=v=>{const p=[];for(let T=0;T<v.childNodes.length;T++){const x=v.childNodes[T];if(x.nodeName==="#text"&&T===0){const y=x.textContent.split(/\n/),C=y.pop();p.push(...y),C&&p.push(C)}else if(x.nodeName==="DIV"){const y=x.innerText.split(/\n/);if(y.length===2&&y[0]===""&&y[1]==="")p.push("");else{const C=y.shift();(C||C==="")&&p.push(C);const h=y.pop();p.push(...y),h&&p.push(h)}}}return p},u=v=>{if(!e)return;const p=v.id,T=e.control.textEditorManager.get(p),x=Et.Doing,y=[v.offsetWidth,v.offsetHeight];(!T||T&&(!St.isEqual(T.opt.boxSize,y)||!St.isEqual(T.opt.workState,x)))&&n({activeTextId:p,update:{boxSize:y,workState:x},syncData:{canSync:!0,canWorker:!0}})},d=v=>{var p,T;if(!e)return;const x=s(v),y=v.id,C=e.control.textEditorManager.get(y),h=an(x),g=Et.Doing,f=[v.offsetWidth,v.offsetHeight];if(!C||C&&(C.opt.text!==h||!St.isEqual(C.opt.boxSize,f)||!St.isEqual(C.opt.workState,g))){const m=y&&St.cloneDeep(((p=e.control.textEditorManager)==null?void 0:p.get(y))||((T=o.editors)==null?void 0:T.get(y)));m&&m.opt&&(m.opt={...m.opt,text:h,boxSize:f,workState:g},m.canSync=!0,m.canWorker=!0,e.control.textEditorManager.updateForViewEdited(y,m)),e.control.textEditorManager.publicMsgEmitter.emit("textChange",y,v,x,m)}},M=(v,p)=>{if(!e)return;const T=v,x=e.control.textEditorManager.get(T);if(x&&!St.isEqual(x.opt.boxSize,p)){const y=St.cloneDeep(x);y.opt={...y.opt,boxSize:p},y.canSync=!1,y.canWorker=!1,e.control.textEditorManager.updateForViewEdited(T,y)}},c=v=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{t!=null&&t.current&&(t?.current.scrollTo({left:0,behavior:"instant"}),v&&v(),r.current=void 0)})};if((a=o.editors)!=null&&a.size){const v=[];return o.editors.forEach((p,T)=>{v.push(ot.createElement(lM,{key:T,workId:T,data:p,showFloatBtns:o.showFloatBtns||!1,handleFocus:u,handleKeyUp:d,updateSize:M,runAnimation:c,rightBoundBreak:o.rightBoundBreak||!1}))}),v}return null},[o.editors,o.showFloatBtns,o.rightBoundBreak,e,n]);return ot.createElement("div",{className:`${o.className}`,ref:t},i)},uM=()=>{const{floatBarData:o}=pt.useContext(ae);return ot.createElement("div",{className:"appliance-plugin-hightlight-box",style:{borderColor:o?.selectorColor}},ot.createElement("div",{className:"point LT nwse-resize",style:{backgroundColor:o?.selectorColor}}),ot.createElement("div",{className:"point LC ew-resize",style:{backgroundColor:o?.selectorColor}}),ot.createElement("div",{className:"point LB nesw-resize",style:{backgroundColor:o?.selectorColor}}),ot.createElement("div",{className:"point TC ns-resize",style:{backgroundColor:o?.selectorColor}}),ot.createElement("div",{className:"point RT nesw-resize",style:{backgroundColor:o?.selectorColor}}),ot.createElement("div",{className:"point RC ew-resize",style:{backgroundColor:o?.selectorColor}}),ot.createElement("div",{className:"point RB nwse-resize",style:{backgroundColor:o?.selectorColor}}),ot.createElement("div",{className:"point BC ns-resize",style:{backgroundColor:o?.selectorColor}}))},hM=()=>{const{floatBarData:o,mananger:t}=pt.useContext(ae),[e,r]=pt.useState(),[n,i]=pt.useState();pt.useEffect(()=>{const u=[];if(t&&St.isNumber(o?.x)&&St.isNumber(o?.y)&&o!=null&&o.points){const d=t.viewId;if(t.control.viewContainerManager.getView(d))for(const M of o.points){const c=t.control.viewContainerManager.transformToOriginPoint(M,d);u.push(c)}u[0]&&r({x:u[0][0]-(o?.x||0),y:u[0][1]-(o?.y||0)}),u[1]&&i({x:u[1][0]-(o?.x||0),y:u[1][1]-(o?.y||0)})}},[t,o?.points,o?.x,o?.y]);const a=pt.useMemo(()=>e?ot.createElement("div",{className:"point point-dot",style:{borderColor:o?.selectorColor,left:e.x,top:e.y}}):null,[o?.selectorColor,e]),s=pt.useMemo(()=>n?ot.createElement("div",{className:"point point-dot",style:{borderColor:o?.selectorColor,left:n.x,top:n.y}}):null,[n,o?.selectorColor]);return ot.createElement("div",{className:"appliance-plugin-hightlight-box",style:{borderColor:o?.selectorColor}},a,s)},fM=()=>{const{floatBarData:o}=pt.useContext(ae);return ot.createElement("div",{className:"appliance-plugin-hightlight-box",style:{borderColor:o?.selectorColor}},ot.createElement("div",{className:"point LT nwse-resize",style:{backgroundColor:o?.selectorColor}}),ot.createElement("div",{className:"point LB nesw-resize",style:{backgroundColor:o?.selectorColor}}),ot.createElement("div",{className:"point RT nesw-resize",style:{backgroundColor:o?.selectorColor}}),ot.createElement("div",{className:"point RB nwse-resize",style:{backgroundColor:o?.selectorColor}}))},dM=()=>{const{floatBarData:o}=pt.useContext(ae);return ot.createElement("div",{className:"appliance-plugin-hightlight-box",style:{borderColor:o?.selectorColor}},ot.createElement("img",{className:"lock",alt:"lock",src:"https://sdk.netless.link/resource/icons/lock.svg"}))},gM=o=>{const{className:t}=o,{floatBarData:e,angle:r,setAngle:n,setOperationType:i,mananger:a}=pt.useContext(ae),[s,u]=pt.useState(Et.Pending),[d,M]=pt.useState(),[c,v]=pt.useState(!1),[p,T]=pt.useState(new ue),[x,y]=pt.useState(new ue),[C,h]=pt.useState(!1),g=pt.useRef(0),f=pt.useRef(null),m=D=>{if(!D){h(!0),v(!1),i(jt.None),u(Et.Pending);return}h(!1)},S=(D,L)=>{g.current&&(clearTimeout(g.current),g.current=0),u(Et.Done),v(!1);const j=Math.round(ue.GetAngleByPoints(p,x,new ue(L.x,L.y)))||0;n(j),i(jt.None),Qt.emitMethod(Vt.MainEngine,jt.RotateNode,{workIds:[Wt],angle:j,workState:Et.Done,viewId:a?.viewId}),a?.focusElement()};pt.useEffect(()=>(Qt.activeListener(m),()=>{Qt.unmountActiveListener(m)}),[]),pt.useEffect(()=>{if(e&&(s===Et.Pending||s===Et.Done)){const D={x:e?.x-20,y:e?.y+e?.h},L={x:e?.x+e?.w/2,y:e?.y+e?.h/2};y(new ue(L.x,L.y)),T(new ue(D.x,D.y)),M({x:D.x,y:D.y})}},[e,s]);const A=(D,L)=>{if(a!=null&&a.control.worker.isBusy){h(!0),u(Et.Pending);return}g.current&&(clearTimeout(g.current),g.current=0),u(Et.Start),v(!0);const j=Math.round(ue.GetAngleByPoints(p,x,new ue(L.x,L.y)))||0;n(j),i(jt.RotateNode),Qt.emitMethod(Vt.MainEngine,jt.RotateNode,{workIds:[Wt],angle:0,workState:Et.Start,viewId:a?.viewId})},P=(D,L)=>{if(a!=null&&a.control.worker.isBusy){h(!0),S(D,L);return}S(D,L)},R=(D,L)=>{if(a!=null&&a.control.worker.isBusy){h(!0),S(D,L);return}g.current||(M({x:L.x,y:L.y}),v(!0),g.current=setTimeout(()=>{g.current=0;const j=Math.round(ue.GetAngleByPoints(p,x,new ue(L.x,L.y)))||0;n(j),i(jt.RotateNode),u(Et.Doing),Qt.emitMethod(Vt.MainEngine,jt.RotateNode,{workIds:[Wt],angle:j,workState:Et.Doing,viewId:a?.viewId})},60))};return ot.createElement(dr,{disabled:C,position:d,onStart:A,onDrag:R,onStop:P},ot.createElement("div",{className:`${t}`,style:e?{left:0,top:0,touchAction:"none"}:void 0},!c&&ot.createElement("div",{className:"appliance-plugin-rotate-btn",style:{backgroundColor:e?.selectorColor}},ot.createElement("img",{alt:"icon",src:Ce("rotation-button")})),ot.createElement("div",{ref:f,className:`appliance-plugin-rotate-mouse-pointer ${c?"active":""}`},ot.createElement("img",{alt:"icon",src:Ce("rotation")}),ot.createElement("div",{className:"angle-icon"},r,"°"))))},pM=o=>{const{editors:t,canSelectorSwitch:e}=o,{floatBarData:r,setOperationType:n,mananger:i,isNoPointerEvents:a}=pt.useContext(ae),[s,u]=pt.useState(),[d,M]=pt.useState(!1),c=pt.useRef(0),v=pt.useRef(),p=pt.useRef(Et.Pending),T=pt.useMemo(()=>!!(r?.scaleType===Ne.none&&r!=null&&r.canLock),[r]),x=pt.useMemo(()=>r&&r.w&&r.h?{position:"absolute",left:0,top:0,width:r.w,height:r.h,zIndex:2,pointerEvents:T||a?"none":"auto",touchAction:"none"}:{display:"none",pointerEvents:"none"},[r,T,a]),y=S=>{if(!S||r!=null&&r.isLocked){M(!0),p.current=Et.Pending,n(jt.None);return}M(!1)},C=(S,A)=>{c.current&&(clearTimeout(c.current),c.current=0);const P={x:A.x,y:A.y};n(jt.None),p.current=Et.Done,u(P),Qt.emitMethod(Vt.MainEngine,jt.TranslateNode,{workIds:[Wt],position:P,workState:Et.Done,viewId:i?.viewId})};pt.useEffect(()=>(Qt.activeListener(y),()=>{Qt.unmountActiveListener(y)}),[]),pt.useEffect(()=>{if(r&&r!=null&&r.isLocked||i!=null&&i.control.worker.isBusy){M(!0);return}M(!1)},[r,i?.control.worker.isBusy]),pt.useEffect(()=>{(p.current===Et.Pending||p.current===Et.Done)&&St.isNumber(r?.x)&&St.isNumber(r?.y)&&u({x:r?.x,y:r?.y})},[r?.x,r?.y]);const h=()=>{if(i!=null&&i.control.worker.isBusy){M(!0);return}c.current&&(clearTimeout(c.current),c.current=0),St.isNumber(r?.x)&&St.isNumber(r?.y)&&(n(jt.TranslateNode),p.current=Et.Start,Qt.emitMethod(Vt.MainEngine,jt.TranslateNode,{workIds:[Wt],position:{x:r?.x,y:r?.y},workState:Et.Start,viewId:i?.viewId}))},g=(S,A)=>{var P;i!=null&&i.control.worker.isBusy&&M(!0);const R=p.current,D=v.current;if(C(S,A),v.current&&(v.current=void 0),R===Et.Start&&t!=null&&t.size&&D){const L=(P=i?.control.viewContainerManager.getView(i.viewId))==null?void 0:P.focusScenePath;L&&i?.control.worker.blurSelector(i.viewId,L)}i?.focusElement()},f=(S,A)=>{if(i!=null&&i.control.worker.isBusy){M(!0),C(S,A);return}if(c.current)return;const P={x:A.x,y:A.y};u(P),c.current=setTimeout(()=>{c.current=0,(P.x!==s?.x||P.y!==s?.y)&&(v.current&&(v.current=void 0),p.current=Et.Doing,Qt.emitMethod(Vt.MainEngine,jt.TranslateNode,{workIds:[Wt],position:P,workState:Et.Doing,viewId:i?.viewId}))},60)},m=pt.useMemo(()=>{if(t){const S=P=>{e&&(v.current=P)},A=()=>{i&&e&&p.current===Et.Start&&v.current&&i.control.textEditorManager.active(v.current)};return ot.createElement(oM,{editors:t,selectIds:r?.selectIds||[],handleTextEditorPointerDown:S,handleTextEditorPointerUp:A})}return null},[t,r?.selectIds,i,e]);return ot.createElement(dr,{disabled:d,position:s,onStart:h,onDrag:f,onStop:g},ot.createElement("div",{style:x},m))},vM=o=>{const{className:t}=o,[e,r]=pt.useState({x:0,y:0,h:0,w:0}),[n,i]=pt.useState(),[a,s]=pt.useState(),[u,d]=pt.useState(),{floatBarData:M,mananger:c,isNoPointerEvents:v,setOperationType:p}=pt.useContext(ae),[T,x]=pt.useState(),[y,C]=pt.useState(!1),h=pt.useRef(0);pt.useEffect(()=>{if(M&&c){const L={x:M.x,y:M.y,w:M.w,h:M.h};r(L)}return Qt.activeListener(f),()=>{Qt.unmountActiveListener(f)}},[]),pt.useEffect(()=>{if(c!=null&&c.control.worker.isBusy){C(!0);return}C(!1)},[c?.control.worker.isBusy]);const g=()=>{if(h.current&&(clearTimeout(h.current),h.current=0),T){const{scale:L,translate:j}=T;p(jt.None),Qt.emitMethod(Vt.MainEngine,jt.ScaleNode,{workIds:[Wt],scale:L,dir:u,translate:j,originPoint:n,scenePoint:a,workState:Et.Done,viewId:c?.viewId})}c?.focusElement()},f=L=>{if(!L){C(!0);return}C(!1)},m=L=>[[L.x,L.y],[L.x+L.w,L.y],[L.x+L.w,L.y+L.h],[L.x,L.y+L.h]],S=(L,j)=>{switch(j){case"top":case"topLeft":case"left":return L[2];case"topRight":return L[3];case"right":case"bottomRight":case"bottom":return L[0];case"bottomLeft":return L[1]}},A=(L,j,b,O)=>{let Y=!1,X=!1;const Z={x:e.x,y:e.y,w:e.w,h:e.h},$=[1,1],rt=[0,0];switch(L){case"top":{const tt=j.height+e.h;tt<0?(X=!0,Z.y=e.y+e.h,Z.h=Math.abs(tt)):(Z.y=e.y-j.height,Z.h=e.h+j.height);break}case"topLeft":{const tt=j.width+e.w;tt<0?(Y=!0,Z.x=e.x+e.w,Z.w=Math.abs(tt)):(Z.x=e.x-j.width,Z.w=e.w+j.width);const lt=j.height+e.h;lt<0?(X=!0,Z.y=e.y+e.h,Z.h=Math.abs(lt)):(Z.y=e.y-j.height,Z.h=e.h+j.height);break}case"topRight":{const tt=j.width+e.w;tt<0?(Y=!0,Z.x=e.x+tt,Z.w=Math.abs(tt)):Z.w=e.w+j.width;const lt=j.height+e.h;lt<0?(X=!0,Z.y=e.y+e.h,Z.h=Math.abs(lt)):(Z.y=e.y-j.height,Z.h=e.h+j.height);break}case"bottom":{const tt=j.height+e.h;tt<0?(X=!0,Z.y=e.y+tt,Z.h=Math.abs(tt)):Z.h=e.h+j.height;break}case"bottomLeft":{const tt=j.width+e.w;tt<0?(Y=!0,Z.x=e.x+e.w,Z.w=Math.abs(tt)):(Z.x=e.x-j.width,Z.w=e.w+j.width);const lt=j.height+e.h;lt<0?(X=!0,Z.y=e.y+lt,Z.h=Math.abs(lt)):Z.h=e.h+j.height;break}case"left":{const tt=j.width+e.w;tt<0?(Y=!0,Z.x=e.x+e.w,Z.w=Math.abs(tt)):(Z.x=e.x-j.width,Z.w=e.w+j.width);break}case"bottomRight":{const tt=j.width+e.w;tt<0?(Y=!0,Z.x=e.x+tt,Z.w=Math.abs(tt)):Z.w=e.w+j.width;const lt=j.height+e.h;lt<0?(X=!0,Z.y=e.y+lt,Z.h=Math.abs(lt)):Z.h=e.h+j.height;break}case"right":{const tt=j.width+e.w;tt<0?(Y=!0,Z.x=e.x+tt,Z.w=Math.abs(tt)):Z.w=e.w+j.width;break}}$[0]=Z.w/e.w,$[1]=Z.h/e.h;const F=m(Z).map(tt=>b.control.viewContainerManager.transformToScenePoint(tt,b.viewId)),Q=S(F,L);return X&&(rt[1]=Q[1]-O[1]),Y&&(rt[0]=Q[0]-O[0]),{scale:$,translate:rt}},P=(L,j)=>{if(h.current&&(clearTimeout(h.current),h.current=0),c!=null&&c.control.worker.isBusy){C(!0);return}if(M!=null&&M.w&&M!=null&&M.h&&c){const b={x:M.x,y:M.y,w:M.w,h:M.h},O=m(b),Y=O.map($=>c.control.viewContainerManager.transformToScenePoint($,c.viewId)),X=S(O,j),Z=S(Y,j);r(b),i(X),s(Z),d(j),p(jt.ScaleNode),Qt.emitMethod(Vt.MainEngine,jt.ScaleNode,{workIds:[Wt],originPoint:X,scenePoint:Z,workState:Et.Start,viewId:c.viewId})}},R=(L,j,b,O)=>{if(!(!c||!n||!a)){if(c!=null&&c.control.worker.isBusy){C(!0),g();return}h.current||(h.current=setTimeout(()=>{h.current=0;const{scale:Y,translate:X}=A(j,O,c,a);(!St.isEqual(Y,T?.scale)||!St.isEqual(X,T?.translate))&&(x({scale:Y,translate:X}),p(jt.ScaleNode),Qt.emitMethod(Vt.MainEngine,jt.ScaleNode,{workIds:[Wt],scale:Y,dir:j,translate:X,originPoint:n,scenePoint:a,workState:Et.Doing,viewId:c.viewId}))},60))}},D=()=>{c!=null&&c.control.worker.isBusy&&C(!0),g()};return ot.createElement(Za,{className:`${t}`,boundsByDirection:!0,minWidth:-((M?.x||0)+(M?.w||0)),minHeight:-((M?.y||0)+(M?.h||0)),size:{width:M?.w||0,height:M?.h||0},style:{position:"absolute",left:M?.x,top:M?.y,pointerEvents:v?"none":"auto"},enable:y?!1:{top:M?.scaleType===Ne.all&&!0||!1,right:M?.scaleType===Ne.all&&!0||!1,bottom:M?.scaleType===Ne.all&&!0||!1,left:M?.scaleType===Ne.all&&!0||!1,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},lockAspectRatio:M?.scaleType===Ne.proportional,onResizeStart:P,onResize:R,onResizeStop:D})},Us=o=>{const{id:t,pos:e,pointMap:r,type:n}=o,{setOperationType:i,mananger:a,floatBarData:s}=pt.useContext(ae),[u,d]=pt.useState({x:0,y:0}),[M,c]=pt.useState(Et.Pending),[v,p]=pt.useState(!1),T=pt.useRef(0),x=pt.useMemo(()=>s?{left:0,top:0}:{},[s]),y=m=>{if(!m||s!=null&&s.isLocked){p(!0),c(Et.Pending),i(jt.None);return}p(!1)};pt.useEffect(()=>(Qt.activeListener(y),()=>{Qt.unmountActiveListener(y)}),[]),pt.useEffect(()=>{St.isNumber(e.x)&&St.isNumber(e.y)&&(M===Et.Pending||M===Et.Done)&&d({x:e.x,y:e.y})},[e,M]),pt.useEffect(()=>{if(s&&s!=null&&s.isLocked||a!=null&&a.control.worker.isBusy){p(!0);return}p(!1)},[s,a?.control.worker.isBusy]);const C=(m,S)=>{T.current&&(clearTimeout(T.current),T.current=0),i(jt.None),c(Et.Done);const A={x:S.x,y:S.y};if(d(A),a!=null&&a.control.viewContainerManager){const P=a.control.viewContainerManager.transformToScenePoint([A.x,A.y],a.viewId),R=r.get(t);R&&n==="start"?R[0]=P:R&&n==="end"&&(R[1]=P),Qt.emitMethod(Vt.MainEngine,jt.SetPoint,{workId:Wt,pointMap:r,workState:Et.Done,viewId:a?.viewId})}a?.focusElement()},h=()=>{if(T.current&&(clearTimeout(T.current),T.current=0),a!=null&&a.control.worker.isBusy){p(!0);return}St.isNumber(e.x)&&St.isNumber(e.y)&&(i(jt.SetPoint),c(Et.Start),Qt.emitMethod(Vt.MainEngine,jt.SetPoint,{workId:Wt,pointMap:r,workState:Et.Start,viewId:a?.viewId}))},g=(m,S)=>{if(a!=null&&a.control.worker.isBusy){p(!0),C(m,S);return}if(T.current)return;const A={x:S.x,y:S.y};d(A),T.current=setTimeout(()=>{if(T.current=0,(A.x!==S?.x||A.y!==S?.y)&&a!=null&&a.control.viewContainerManager){const P=a.control.viewContainerManager.transformToScenePoint([A.x,A.y],a.viewId),R=r.get(t);R&&n==="start"?R[0]=P:R&&n==="end"&&(R[1]=P),c(Et.Doing),Qt.emitMethod(Vt.MainEngine,jt.SetPoint,{workId:Wt,pointMap:r,workState:Et.Doing,viewId:a?.viewId})}},60)},f=(m,S)=>{a!=null&&a.control.worker.isBusy&&p(!0),C(m,S)};return ot.createElement(dr,{disabled:v,position:u,onStart:h,onDrag:g,onStop:f},ot.createElement("div",{className:"appliance-plugin-point-draggable-btn",style:x}))},mM=o=>{const{className:t}=o,{floatBarData:e,mananger:r}=pt.useContext(ae),[n,i]=pt.useState(),[a,s]=pt.useState(),[u,d]=pt.useState(new Map);pt.useEffect(()=>{const v=[];if(r&&e!=null&&e.points){const p=r.viewId;if(r.control.viewContainerManager.getView(p))for(const T of e.points){const x=r.control.viewContainerManager.transformToOriginPoint(T,p);v.push(x)}e!=null&&e.selectIds&&e.selectIds.length===1&&(u.set(e.selectIds[0],e.points),d(u))}v[0]&&i({x:v[0][0],y:v[0][1]}),v[1]&&s({x:v[1][0],y:v[1][1]})},[r,e?.points,e?.selectIds,u]);const M=pt.useMemo(()=>n&&e!=null&&e.selectIds?ot.createElement(Us,{pos:n,type:"start",id:e.selectIds[0],pointMap:u}):null,[n,e?.selectIds,u]),c=pt.useMemo(()=>a&&e!=null&&e.selectIds?ot.createElement(Us,{pos:a,type:"end",id:e.selectIds[0],pointMap:u}):null,[a,e?.selectIds,u]);return ot.createElement("div",{className:`${t}`},M,c)},yM=ot.forwardRef((o,t)=>{const{floatBarData:e,operationType:r}=pt.useContext(ae),n=pt.useMemo(()=>e?.scaleType!==Ne.all||r===jt.RotateNode?null:ot.createElement(uM,null),[e,r]),i=pt.useMemo(()=>e?.scaleType!==Ne.both||r===jt.RotateNode?null:ot.createElement(hM,null),[e,r]),a=pt.useMemo(()=>e?.scaleType!==Ne.proportional||r===jt.RotateNode?null:ot.createElement(fM,null),[e,r]),s=pt.useMemo(()=>e?.scaleType===Ne.none&&e!=null&&e.canLock?ot.createElement(dM,null):null,[e]);return ot.createElement("div",{ref:t,style:e?{transform:`translate(${e.x}px,${e.y}px)`,width:e.w,height:e.h,pointerEvents:"none"}:void 0},s,n,i,a,o.children)}),MM=ot.forwardRef((o,t)=>{const{floatBarData:e,operationType:r,mananger:n}=pt.useContext(ae),{editors:i,isHide:a,canSelectorSwitch:s}=o,u=pt.useMemo(()=>{var v;return e!=null&&e.canRotate&&((v=e?.selectIds)==null?void 0:v.length)===1&&(r===jt.None||r===jt.RotateNode)?ot.createElement(gM,{className:Ee.RotateBtn}):null},[e,r]),d=pt.useMemo(()=>(e?.scaleType===Ne.all||e?.scaleType===Ne.proportional)&&(r===jt.None||r===jt.ScaleNode)&&St.isNumber(e?.x)&&St.isNumber(e?.y)?ot.createElement(vM,{className:Ee.ResizeBtn}):null,[e?.scaleType,r,e?.x,e?.y]),M=pt.useMemo(()=>e?.scaleType===Ne.both&&(r===jt.None||r===jt.SetPoint)?ot.createElement(mM,{className:Ee.ResizeTowBox}):null,[e?.scaleType,r]),c=pt.useMemo(()=>a&&r===jt.None&&St.isNumber(e?.x)&&St.isNumber(e?.y)&&St.isNumber(e?.w)&&St.isNumber(e?.h)?ot.createElement("div",{className:Ee.FloatBarBtn,style:{left:e?.x,top:e?.y,width:e.w,height:e.h}},ot.createElement(zo,{position:{x:e.x,y:e.y},textOpt:e?.textOpt,noLayer:e?.isLocked})):null,[e?.x,e?.y,e?.w,e?.h,e?.textOpt,e?.isLocked,r,a]);return ot.createElement("div",{className:Ee.FloatBar,onPointerOver:v=>(Rr(v),n?.control.worker.blurCursor(n.viewId),!1)},ot.createElement(yM,{ref:t}),ot.createElement(pM,{editors:i,canSelectorSwitch:s}),u,d,M,c)}),IM=ot.memo(MM,(o,t)=>!!St.isEqual(o,t));class TM extends ot.Component{constructor(t){super(t),it(this,"renderAvatar",e=>{var r;const n=`rgb(${e.memberState.strokeColor[0]}, ${e.memberState.strokeColor[1]}, ${e.memberState.strokeColor[2]})`;if(this.detectAvatar(e)){const i=this.getCursorName(e);return ot.createElement("img",{className:"cursor-selector-avatar",style:{width:i?19:28,height:i?19:28,position:i?"initial":"absolute",borderColor:i?"white":n,marginRight:i?4:0},src:(r=e.payload)==null?void 0:r.avatar,alt:"avatar"})}else return null}),it(this,"getOpacity",e=>{const r=this.getCursorName(e),n=this.detectAvatar(e);return r===void 0&&n===void 0?0:1}),it(this,"getCursorName",e=>{if(e.payload)return e.payload.nickName||e.payload.cursorName||e.payload.uid}),it(this,"getThemeClass",e=>e.payload&&e.payload.theme?"cursor-inner-mellow":"cursor-inner"),it(this,"getCursorBackgroundColor",e=>{const r=this.getCursorName(e);return e.payload&&e.payload.cursorBackgroundColor?e.payload.cursorBackgroundColor:r?`rgb(${e.memberState.strokeColor[0]}, ${e.memberState.strokeColor[1]}, ${e.memberState.strokeColor[2]})`:void 0}),it(this,"getCursorTextColor",e=>e.payload&&e.payload.cursorTextColor?e.payload.cursorTextColor:"#FFFFFF"),it(this,"getCursorTagBackgroundColor",e=>e.payload&&e.payload.cursorTagBackgroundColor?e.payload.cursorTagBackgroundColor:this.getCursorBackgroundColor(e)),it(this,"detectAvatar",e=>!!(e.payload&&e.payload.avatar)),it(this,"renderTag",e=>{if(e.payload&&e.payload.cursorTagName)return ot.createElement("span",{className:"cursor-tag-name",style:{backgroundColor:this.getCursorTagBackgroundColor(e)}},e.payload.cursorTagName)}),it(this,"renderCursor",e=>{const r=Hy.get(e);return r&&this.props.isEnableCursor?ot.createElement("img",{className:`cursor-${e}-image`,src:r,alt:`${e}Cursor`}):null})}render(){const{roomMember:t}=this.props,e=this.getCursorName(t);switch(t.memberState.currentApplianceName){case Xt.pencil:return ot.createElement("div",{className:"cursor-box"},ot.createElement("div",{className:"cursor-mid cursor-pencil-offset",style:{transform:"translate(-50%, -100%)",marginLeft:"5px",marginTop:"4px"}},ot.createElement("div",{className:"cursor-name"},ot.createElement("div",{style:{opacity:this.getOpacity(t),backgroundColor:this.getCursorBackgroundColor(t),color:this.getCursorTextColor(t)},className:this.getThemeClass(t)},this.renderAvatar(t),ot.createElement("span",{className:"cursor-name-text"},e),this.renderTag(t))),ot.createElement("div",null,this.renderCursor("pencil"))));case Xt.selector:return ot.createElement("div",{className:"cursor-box"},ot.createElement("div",{className:"cursor-mid cursor-selector-offset",style:{transform:"translate(-50%, -100%)",marginLeft:"3px",marginTop:"17px"}},ot.createElement("div",{className:"cursor-name"},ot.createElement("div",{style:{opacity:this.getOpacity(t),backgroundColor:this.getCursorBackgroundColor(t),color:this.getCursorTextColor(t)},className:this.getThemeClass(t)},this.renderAvatar(t),ot.createElement("span",{className:"cursor-name-text"},e),this.renderTag(t))),ot.createElement("div",null,this.renderCursor("selector"))));case Xt.eraser:case Xt.pencilEraser:return ot.createElement("div",{className:"cursor-box"},ot.createElement("div",{className:"cursor-mid cursor-eraser-offset",style:{transform:"translate(-50%, -100%)",marginLeft:"2px",marginTop:"8px"}},ot.createElement("div",{className:"cursor-name"},ot.createElement("div",{style:{opacity:this.getOpacity(t),backgroundColor:this.getCursorBackgroundColor(t),color:this.getCursorTextColor(t)},className:this.getThemeClass(t)},this.renderAvatar(t),ot.createElement("span",{className:"cursor-name-text"},e),this.renderTag(t))),ot.createElement("div",null,this.renderCursor("eraser"))));case Xt.text:return ot.createElement("div",{className:"cursor-box"},ot.createElement("div",{className:"cursor-mid cursor-text-offset",style:{transform:"translate(-50%, -100%)",marginLeft:"0px"}},ot.createElement("div",{className:"cursor-name"},ot.createElement("div",{style:{opacity:this.getOpacity(t),backgroundColor:this.getCursorBackgroundColor(t),color:this.getCursorTextColor(t)},className:this.getThemeClass(t)},this.renderAvatar(t),ot.createElement("span",{className:"cursor-name-text"},e),this.renderTag(t))),ot.createElement("div",null,this.renderCursor("text"))));case Xt.rectangle:case Xt.arrow:case Xt.straight:case Xt.shape:case Xt.ellipse:return ot.createElement("div",{className:"cursor-box"},ot.createElement("div",{className:"cursor-mid cursor-shape-offset",style:{transform:"translate(-50%, -100%)",marginLeft:"-3px",marginTop:"19px"}},ot.createElement("div",{className:"cursor-name"},ot.createElement("div",{style:{opacity:this.getOpacity(t),backgroundColor:this.getCursorBackgroundColor(t),color:this.getCursorTextColor(t)},className:this.getThemeClass(t)},this.renderAvatar(t),ot.createElement("span",{className:"cursor-name-text"},e),this.renderTag(t))),ot.createElement("div",null,this.renderCursor("shape"))));default:return null}}}const CM=o=>{var t;const{className:e,info:r,isEnableCursor:n}=o,{roomMember:i,...a}=r||{};return ot.createElement("div",{"data-cursor-uid":(t=i?.payload)==null?void 0:t.uid,className:`${e}`,style:a?{transform:`translate(${a.x}px, ${a.y}px)`}:{display:"none"}},i&&ot.createElement(TM,{roomMember:i,isEnableCursor:n}))},xM=o=>{const{className:t,manager:e}=o,[r,n]=pt.useState();pt.useEffect(()=>(e.internalMsgEmitter.on([Vt.Cursor,e.viewId],i),()=>{e.internalMsgEmitter.off([Vt.Cursor,e.viewId],i)}),[e]);function i(a){n(a)}return pt.useMemo(()=>{if(r!=null&&r.length){const a=r.map(s=>{var u;return s.roomMember?ot.createElement(CM,{key:(u=s.roomMember)==null?void 0:u.memberId,className:t,info:s,isEnableCursor:e.control.cursor.isEnableCursor}):null});return ot.createElement(ot.Fragment,null,a)}return null},[r])},EM=o=>{const{viewId:t,miniMapCanvas:e,highlightColor:r,miniMapManager:n,contianer:i}=o,[a,s]=pt.useState();pt.useEffect(()=>(u(),n.listener.addListener([t,"viewCameraUpate"],u),n.listener.emitAsync([t,"miniMapCreate"],!0),()=>{n.listener.removeListener([t,"viewCameraUpate"],u)}),[]);const u=()=>{const c=n.maps.get(t);c&&d(c.miniMapCamera,c.viewCamera)},d=(c,v)=>{const{width:p,height:T}=i.getBoundingClientRect(),x=Math.min(p/c.width,T/c.height),y=v.width/v.scale,C=v.height/v.scale,h=[v.centerX,v.centerY],g=[c.centerX,c.centerY],f=[h[0]-g[0],h[1]-g[1]],m=Math.min(c.scale*x,c.scale*x),S=[f[0]*m,f[1]*m,y,C,m];s(S)},M=c=>{var v;if(n.control.renderControl.isWritable){const p=c.nativeEvent.target||c.nativeEvent.srcElement;if(p&&c.nativeEvent&&a){const{width:T,height:x}=p.getBoundingClientRect(),[y,C]=[T/2,x/2],[h,g]=[(c.nativeEvent.offsetX-y)/a[4],(c.nativeEvent.offsetY-C)/a[4]],f=n.maps.get(t);if(f!=null&&f.viewCamera){const[m,S]=[f.miniMapCamera.centerX+h,f.miniMapCamera.centerY+g];(v=n.control.room)==null||v.moveCamera({centerX:m,centerY:S,animationMode:"immediately"})}}}};return ot.createElement("div",{style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",pointerEvents:"auto"},onClick:M},ot.createElement("canvas",{style:{pointerEvents:"none"},ref:e}),a&&ot.createElement("div",{className:"minimap-highlightBox",style:{position:"absolute",top:"50%",left:"50%",width:a[2]*a[4],height:a[3]*a[4],boxSizing:"content-box",border:`2px solid ${r}`,transform:`translate(calc(-50% + ${a[0]}px), calc(-50% + ${a[1]}px))`,pointerEvents:"none"}}))},SM=o=>{const{miniMapManager:t,active:e,className:r}=o,n=pt.useMemo(()=>{const i=t.maps;if(e){const a=i.get(e);if(a){const{miniMapCamera:s,viewCamera:u,...d}=a;if(d.contianer&&s&&u){const M=t.highlightColor;return ei.createPortal(ot.createElement(EM,{viewId:e,...d,highlightColor:M,miniMapManager:t}),d.contianer)}}}return null},[e,t]);return ot.createElement("div",{className:r},n)},ae=ot.createContext({viewId:"",mananger:void 0,floatBarColors:[],floatBarData:void 0,dpr:1,angle:0,operationType:jt.None,scale:[1,1],isNoPointerEvents:!1,activeTextEditor:!1,activeTextId:void 0,setAngle:()=>{},setOperationType:()=>{},setFloatBarData:()=>{}});class Ci extends ot.Component{constructor(t){var e,r;super(t),it(this,"showTextFloatBar"),it(this,"canSelectorSwitch"),it(this,"rightBoundBreak"),it(this,"setAngle",i=>{this.setState({angle:i})}),it(this,"setOperationType",i=>{this.setState({operationType:i})}),this.state={floatBarData:void 0,showFloatBar:!1,showFloatBarBtn:!0,dpr:1,angle:0,operationType:jt.None,scale:[1,1],editors:this.editors,activeTextId:(e=this.props.mananger.control.textEditorManager)==null?void 0:e.activeId,activeMiniMapViewId:(r=this.props.mananger.control.miniMapManager)==null?void 0:r.activeViewId};const n=this.props.mananger.control.pluginOptions.extras.textEditor;this.showTextFloatBar=St.isBoolean(n.showFloatBar)?n.showFloatBar:me.textEditor.showFloatBar,this.canSelectorSwitch=St.isBoolean(n?.canSelectorSwitch)?n.canSelectorSwitch:me.textEditor.canSelectorSwitch,this.rightBoundBreak=St.isBoolean(n?.rightBoundBreak)?n.rightBoundBreak:me.textEditor.rightBoundBreak}get editors(){return Mn(this.props.mananger.control.textEditorManager.filterEditor(this.props.mananger.viewId))}componentDidMount(){this.props.mananger.vDom=this,this.props.mananger.mountView(),this.setState({dpr:this.props.mananger.dpr})}componentWillUnmount(){}setActiveMiniMap(t){this.setState({activeMiniMapViewId:t})}showFloatBarBtn(t){this.setState({showFloatBarBtn:t})}showFloatBar(t,e){const r=t&&e&&{...this.state.floatBarData,...e}||void 0;this.setState({showFloatBar:t,floatBarData:r,angle:0})}activeTextEditor(){this.setState({activeTextEditor:!0})}unActiveTextEditor(){this.setState({activeTextEditor:!1})}updateTextEditorInfo(t){this.setState({activeTextId:t,editors:this.editors})}setFloatBarData(t){this.state.floatBarData&&this.setState({floatBarData:{...this.state.floatBarData,...t}})}render(){var t,e,r,n,i,a;const s=!!((e=(t=this.props.mananger.control)==null?void 0:t.room)!=null&&e.floatBarOptions);return ot.createElement("div",{className:Ee.Container},!this.props.mananger.control.hasOffscreenCanvas&&ot.createElement("div",{className:Ee.CanvasBox,ref:this.props.refs.canvasContainerRef})||ot.createElement("div",{className:Ee.CanvasBox},ot.createElement("canvas",{id:"bgCanvas",ref:this.props.refs.canvasBgRef,style:{width:"100%",height:"100%"}}),ot.createElement("canvas",{id:"serviceCanvas",className:Ee.FloatCanvas,ref:this.props.refs.canvasServiceFloatRef,style:{width:"100%",height:"100%"}}),ot.createElement("canvas",{id:"localCanvas",className:Ee.FloatCanvas,ref:this.props.refs.canvasFloatRef,style:{width:"100%",height:"100%"}}),!this.props.mananger.control.isUseSimple&&ot.createElement("div",{id:"subLocalCanvas",className:Ee.CanvasBoxSub,ref:this.props.refs.subLocalCanvasContainerRef}),!this.props.mananger.control.isUseSimple&&ot.createElement("canvas",{id:"topCanvas",className:Ee.TopFloatCanvas,ref:this.props.refs.canvasTopRef,style:{width:"100%",height:"100%"}})),!this.props.mananger.control.hasOffscreenCanvas&&this.props.refs.snapshotContainerRef&&ot.createElement("div",{className:Ee.SnapshotBox,ref:this.props.refs.snapshotContainerRef})||null,ot.createElement(ae.Provider,{value:{viewId:this.props.viewId,mananger:this.props.mananger,floatBarColors:s&&((i=(n=(r=this.props.mananger.control)==null?void 0:r.room)==null?void 0:n.floatBarOptions)==null?void 0:i.colors)||[],isNoPointerEvents:!this.state.showFloatBarBtn,floatBarData:this.state.floatBarData,dpr:this.state.dpr,angle:this.state.angle,operationType:this.state.operationType,scale:this.state.scale,activeTextEditor:this.state.activeTextEditor,activeTextId:this.state.activeTextId,setAngle:this.setAngle.bind(this),setOperationType:this.setOperationType.bind(this),setFloatBarData:this.setFloatBarData.bind(this)}},this.state.showFloatBar&&ot.createElement(IM,{ref:this.props.refs.floatBarRef,editors:this.state.editors,isHide:s&&this.state.showFloatBarBtn,canSelectorSwitch:this.canSelectorSwitch})||null,((a=this.state.editors)==null?void 0:a.size)&&ot.createElement(cM,{className:Ee.TextEditorContainer,showFloatBtns:this.showTextFloatBar&&s&&this.state.showFloatBarBtn||!1,editors:this.state.editors,rightBoundBreak:this.rightBoundBreak})||null),ot.createElement(xM,{className:Ee.CursorBox,manager:this.props.mananger}),!this.props.mananger.control.isUseSimple&&ot.createElement(SM,{className:Ee.MiniMapBox,active:this.state.activeMiniMapViewId,miniMapManager:this.props.mananger.control.miniMapManager}))}}class AM extends jo{constructor(t,e){super(t,e),it(this,"width",1e3),it(this,"height",1e3),it(this,"dpr",hr()),it(this,"vDom"),it(this,"eventTragetElement"),it(this,"snapshotContainerRef"),it(this,"canvasContainerRef",ot.createRef()),it(this,"subLocalCanvasContainerRef"),it(this,"canvasTopRef"),it(this,"canvasServiceFloatRef",ot.createRef()),it(this,"canvasFloatRef",ot.createRef()),it(this,"canvasBgRef",ot.createRef()),it(this,"floatBarRef",ot.createRef()),it(this,"containerOffset",{x:0,y:0}),this.control.hasOffscreenCanvas||(this.snapshotContainerRef=ot.createRef()),this.control.isUseSimple||(this.canvasTopRef=ot.createRef(),this.subLocalCanvasContainerRef=ot.createRef())}setCanvassStyle(){var t;if(this.eventTragetElement){const e=this.eventTragetElement.offsetWidth||this.width,r=this.eventTragetElement.offsetHeight||this.height,n=hr();n!==this.dpr&&(this.dpr=n,this.control.worker.updateDpr(this.viewId,this.dpr)),e&&r&&this.canvasContainerRef.current&&(e!==this.width||r!==this.height)&&(this.width=e,this.height=r,this.canvasContainerRef.current.style.width=`${e}px`,this.canvasContainerRef.current.style.height=`${r}px`),e&&r&&this.snapshotContainerRef&&this.snapshotContainerRef.current&&(e!==this.width||r!==this.height)&&(this.width=e,this.height=r),e&&r&&this.canvasBgRef.current&&(e!==this.width||r!==this.height)&&(this.width=e,this.height=r,this.control.isUseOffscreenTransfer||(this.canvasBgRef.current.width=e*this.dpr,this.canvasBgRef.current.height=r*this.dpr,this.canvasFloatRef.current&&(this.canvasFloatRef.current.width=e*this.dpr,this.canvasFloatRef.current.height=r*this.dpr),this.canvasServiceFloatRef.current&&(this.canvasServiceFloatRef.current.width=e*this.dpr,this.canvasServiceFloatRef.current.height=r*this.dpr),(t=this.canvasTopRef)!=null&&t.current&&(this.canvasTopRef.current.width=e*this.dpr,this.canvasTopRef.current.height=r*this.dpr)))}}destroy(){if(super.destroy(),this.eventTragetElement){const t=this.eventTragetElement.parentElement;if(t){const e=t.querySelectorAll(".appliance-plugin-main-view-displayer");for(const r of e)r.remove()}}}createMainViewDisplayer(t){const e=document.createElement("div");return e.className="appliance-plugin-main-view-displayer",t.appendChild(e),this.eventTragetElement=t.children[0],this.containerOffset=this.getContainerOffset(this.eventTragetElement,this.containerOffset),this.bindToolsClass(),ri.render(ot.createElement(Ci,{viewId:this.viewId,mananger:this,refs:{canvasServiceFloatRef:this.canvasServiceFloatRef,canvasFloatRef:this.canvasFloatRef,canvasBgRef:this.canvasBgRef,floatBarRef:this.floatBarRef,canvasTopRef:this.canvasTopRef,canvasContainerRef:this.canvasContainerRef,snapshotContainerRef:this.snapshotContainerRef,subLocalCanvasContainerRef:this.subLocalCanvasContainerRef}}),e),this.control.room&&this.bindDisplayerEvent(this.eventTragetElement),this}}class NM extends vy{constructor(t,e,r){super(t,e,r),it(this,"dpr",hr()),it(this,"width",1e3),it(this,"height",1e3),it(this,"vDom"),it(this,"eventTragetElement"),it(this,"canvasContainerRef",ot.createRef()),it(this,"subLocalCanvasContainerRef"),it(this,"canvasTopRef"),it(this,"canvasServiceFloatRef",ot.createRef()),it(this,"canvasFloatRef",ot.createRef()),it(this,"canvasBgRef",ot.createRef()),it(this,"floatBarRef",ot.createRef()),it(this,"containerOffset",{x:0,y:0}),this.control.isUseSimple||(this.canvasTopRef=ot.createRef(),this.subLocalCanvasContainerRef=ot.createRef())}setCanvassStyle(){var t;if(this.eventTragetElement){const e=hr();if(e!==this.dpr&&(this.dpr=e,this.control.worker.updateDpr(this.viewId,this.dpr)),this.canvasContainerRef.current){const r=this.eventTragetElement.offsetWidth||this.width,n=this.eventTragetElement.offsetHeight||this.height;r&&n&&(r!==this.width||n!==this.height)&&(this.width=r,this.height=n,this.canvasContainerRef.current.style.width=`${r}px`,this.canvasContainerRef.current.style.height=`${n}px`)}if(this.canvasBgRef.current){const r=this.eventTragetElement.offsetWidth||this.width,n=this.eventTragetElement.offsetHeight||this.height;r&&n&&(r!==this.width||n!==this.height)&&(this.width=r,this.height=n,this.control.isUseOffscreenTransfer||(this.canvasBgRef.current.width=r*this.dpr,this.canvasBgRef.current.height=n*this.dpr,this.canvasFloatRef.current&&(this.canvasFloatRef.current.width=r*this.dpr,this.canvasFloatRef.current.height=n*this.dpr),this.canvasServiceFloatRef.current&&(this.canvasServiceFloatRef.current.width=r*this.dpr,this.canvasServiceFloatRef.current.height=n*this.dpr),(t=this.canvasTopRef)!=null&&t.current&&(this.canvasTopRef.current.width=r*this.dpr,this.canvasTopRef.current.height=n*this.dpr)))}}}createAppViewDisplayer(t,e){const r=document.createElement("div");return r.className="appliance-plugin-app-view-displayer",e.appendChild(r),this.eventTragetElement=e.children[0],this.containerOffset=this.getContainerOffset(this.eventTragetElement,this.containerOffset),this.bindToolsClass(),ri.render(ot.createElement(Ci,{viewId:t,mananger:this,refs:{canvasServiceFloatRef:this.canvasServiceFloatRef,canvasFloatRef:this.canvasFloatRef,canvasBgRef:this.canvasBgRef,floatBarRef:this.floatBarRef,canvasTopRef:this.canvasTopRef,canvasContainerRef:this.canvasContainerRef,subLocalCanvasContainerRef:this.subLocalCanvasContainerRef}}),r),this.control.room&&this.bindDisplayerEvent(this.eventTragetElement),this}}class we extends wr{constructor(t){super(t),it(this,"focuedViewId"),it(this,"focuedView"),it(this,"control"),it(this,"tmpFocusedViewId"),it(this,"checkScaleTimer"),it(this,"onMainViewRelease",async e=>{this.control.textEditorManager.clear(ne,!0),this.mainViewDestroy(e),await new Promise(n=>{setTimeout(()=>{n(!0)},0)}),this.onMainViewMounted(e);const r=this.control.getSnapshootData("memberState");this.control.room&&this.control.onMemberChange(r),this.control.clearSnapshootData()}),it(this,"mainViewDestroy",e=>{var r;if(this.mainView&&this.mainView.displayer){this.mainView.displayer.destroy();const n=e.divElement;if(n){const i=n.getElementsByClassName("appliance-plugin-main-view-displayer");for(const a of i)a.remove()}if(this.mainView.container&&n!==this.mainView.container){const i=this.mainView.container.getElementsByClassName("appliance-plugin-main-view-displayer");for(const a of i)a.remove()}(r=this.control.worker)==null||r.destroyViewWorker(this.mainView.id,!0),this.mainView.displayer.destroy(),this.mainView=void 0}}),it(this,"onMainViewMounted",e=>{const r=e.divElement;if(!r||!e.focusScenePath||!(e.focusScenePath||e.scenePath))return;const n=new AM(this.control,Te.InternalMsgEmitter),i=e.size.width||n.width,a=e.size.height||n.height,s={dpr:n.dpr,offscreenCanvasOpt:{...we.defaultScreenCanvasOpt},layerOpt:{...we.defaultLayerOpt},cameraOpt:{...we.defaultCameraOpt,width:i,height:a}},{scale:u,...d}=e.camera;s.cameraOpt={...s.cameraOpt,...d,scale:u===1/0?1:u},this.createMianView({id:ne,container:r,displayer:n,focusScenePath:e.focusScenePath,cameraOpt:s.cameraOpt,viewData:e}),this.setFocuedViewId(ne),n.createMainViewDisplayer(r),e.callbacks.on("onSizeUpdated",this.onMainViewSizeUpdated),e.callbacks.on("onCameraUpdated",this.onMainViewCameraUpdated),e.callbacks.on("onActiveHotkey",this.onActiveHotkeyChange.bind(this))}),it(this,"onMainViewSizeUpdated",async()=>{await new Promise(e=>{setTimeout(()=>{e(!0)},0)}),this.mainView&&this.mainView.viewData&&this.updateMainViewCamera()}),it(this,"onMainViewCameraUpdated",async()=>{await new Promise(e=>{setTimeout(()=>{e(!0)},0)}),this.updateMainViewCamera()}),it(this,"updateMainViewCamera",()=>{if(this.mainView&&this.mainView.viewData){const e=this.mainView.viewData.camera;if(!St.isNumber(e.scale)||e.scale===1/0)return;const r=this.mainView.cameraOpt;if(r){const n=r.width,i=r.height,{width:a,height:s}=this.mainView.viewData.size;(a!==n||s!==i)&&this.mainView.displayer.updateSize();const u=e.scale===1/0?1:e.scale,d=e.centerX||0,M=e.centerY||0,c={...r,scale:u,centerX:d,centerY:M,width:a,height:s};St.isEqual(r,c)||(this.mainView.cameraOpt=c),this.checkScaleTimer&&e.scale==1/0&&(clearTimeout(this.checkScaleTimer),this.checkScaleTimer=void 0),!this.checkScaleTimer&&e.scale===1/0&&this.mainView.viewData&&this.mainView.viewData.camera.scale===1/0&&(this.checkScaleTimer=setTimeout(()=>{var v,p;(p=(v=this.mainView)==null?void 0:v.viewData)==null||p.moveCamera({scale:u,centerX:d,centerY:M,animationMode:"immediately"}),this.checkScaleTimer=void 0},500))}}}),it(this,"onAppViewMounted",async e=>{var r;const{appId:n,view:i}=e,a=i.divElement;if(!a||!i.focusScenePath)return;const s=this.appViews.get(n);if(s&&s.displayer){let v=a.getElementsByClassName("appliance-plugin-app-view-displayer");for(const p of v)p.remove();if(s.container&&s.container!==a){v=s.container.getElementsByClassName("appliance-plugin-app-view-displayer");for(const p of v)p.remove()}this.destroyAppView(e.appId,!0),(r=this.control.worker)==null||r.destroyViewWorker(n,!0),await new Promise(p=>{setTimeout(()=>{p(!0)},0)})}const u=new NM(n,this.control,Te.InternalMsgEmitter),d=i.size.width||u.width,M=i.size.height||u.height,c={dpr:u.dpr,offscreenCanvasOpt:{...we.defaultScreenCanvasOpt},layerOpt:{...we.defaultLayerOpt},cameraOpt:{...we.defaultCameraOpt,...i.camera,width:d,height:M}};if(this.createAppView({id:n,container:a,displayer:u,cameraOpt:c.cameraOpt,focusScenePath:i.focusScenePath,viewData:i}),u.createAppViewDisplayer(n,a),i.callbacks.on("onSizeUpdated",this.onAppViewSizeUpdated.bind(this,n)),i.callbacks.on("onCameraUpdated",this.onAppViewCameraUpdated.bind(this,n)),i.callbacks.on("onActiveHotkey",this.onActiveHotkeyChange.bind(this)),this.tmpFocusedViewId===n){const v=this.control.worker.getLocalWorkViewId();v&&v!==n?this.setFocuedViewId(v):this.setFocuedViewId(n),this.tmpFocusedViewId=void 0}setTimeout(()=>{this.onAppViewCameraUpdated(n)},0)}),it(this,"onAppViewSizeUpdated",async e=>{await new Promise(n=>{setTimeout(()=>{n(!0)},0)});const r=this.appViews.get(e);r&&r.viewData&&this.updateAppCamera(e)}),it(this,"onAppViewCameraUpdated",async e=>{await new Promise(r=>{setTimeout(()=>{r(!0)},0)}),this.updateAppCamera(e)}),it(this,"updateAppCamera",e=>{const r=this.appViews.get(e);if(r&&r.viewData){const n=r.viewData.camera,i=r.cameraOpt;if(i){const{width:a,height:s}=r.viewData.size,u=i.width,d=i.height;(a!==u||s!==d)&&r.displayer.updateSize();const M=n.scale===1/0?1:n.scale,c=n.centerX||0,v=n.centerY||0,p={...i,scale:M,centerX:c,centerY:v,width:a,height:s};St.isEqual(p,i)||(r.cameraOpt=p)}}}),this.control=t.control}getViewInitData(t){var e;const r=this.getView(t);if(r){const{width:n,height:i,dpr:a}=r.displayer;(e=this.control.pluginOptions.extras.canvasOpt)!=null&&e.contextType&&(we.defaultScreenCanvasOpt.contextType=this.control.pluginOptions.extras.canvasOpt.contextType);const s={dpr:a,originalPoint:[n/2,i/2],offscreenCanvasOpt:{...we.defaultScreenCanvasOpt,width:n,height:i},layerOpt:{...we.defaultLayerOpt,width:n,height:i},cameraOpt:{...we.defaultCameraOpt,width:n,height:i}};if(r.viewData){const{scale:u,...d}=r.viewData.camera;s.cameraOpt={...s.cameraOpt,...d,scale:u===1/0?1:u}}return s}}async mountView(t){var e,r;const n=this.getView(t);if(n){t===((e=this.mainView)==null?void 0:e.id)&&(this.control.cursor.activeCollector(),await this.control.activeWorker()),this.control.isUseOffscreenTransfer&&n.displayer.canvasBgRef.current&&n.displayer.canvasServiceFloatRef.current&&n.displayer.canvasFloatRef.current&&n.displayer.setTransferControlToOffscreenCanvas({bgCanvas:n.displayer.canvasBgRef.current,serviceCanvas:n.displayer.canvasServiceFloatRef.current,localCanvas:n.displayer.canvasFloatRef.current});const i=this.getViewInitData(t);if(i&&((r=this.control.worker)==null||r.createViewWorker(t,i,n.displayer)),n.focusScenePath&&this.control.collector){if(this.control.collector.authStorage){const{renderAuth:a,pageAuth:s}=this.control.collector.authStorage;if(a){const u=a[t];if(u){const{render:d,hide:M,clear:c}=u;this.control.renderControl.syncRenderUids(t,d,M,c);return}}if(s){const u=s[t];if(u){this.control.renderControl.syncPageAuth(t,u,!0);return}}}this.control.worker.pullServiceData(t,n.focusScenePath,{isAsync:!0,useAnimation:!1})}}}listenerWindowManager(t){t.emitter.on("focusedChange",e=>{const r=e||ne;if(this.focuedViewId!==r)if(this.getView(r)){const n=this.control.worker.getLocalWorkViewId();n&&n!==r?this.setFocuedViewId(n):this.setFocuedViewId(r)}else this.tmpFocusedViewId=r}),t.emitter.on("mainViewScenePathChange",e=>{this.control.onSceneChange(e,ne)}),t.emitter.on("onMainViewMounted",this.onMainViewMounted),t.emitter.on("onAppViewMounted",this.onAppViewMounted),t.emitter.on("onMainViewRebind",this.onMainViewRelease),t.emitter.on("onBoxClose",e=>{this.appViews.get(e.appId)&&(this.destroyAppView(e.appId),this.control.worker.destroyViewWorker(e.appId))}),t.emitter.on("onAppScenePathChange",e=>{const{appId:r,view:n}=e;this.control.onSceneChange(n.focusScenePath,r)}),t.emitter.on("appsChange",e=>{for(const r of this.appViews.keys())e.includes(r)||(this.destroyAppView(r),this.control.worker.destroyViewWorker(r,!0))})}onActiveHotkeyChange(t){this.control.hotkeyManager.onActiveHotkey(t)}}class Je extends Te{constructor(t){super(t),it(this,"windowManager"),it(this,"viewContainerManager");const e={control:this,internalMsgEmitter:Te.InternalMsgEmitter,publicMsgEmitter:Te.PublicMsgEmitter};this.viewContainerManager=new we(e)}init(){}activePlugin(){this.collector&&(this.collector.addAuthStateListener((t,e)=>{t&&Object.keys(t).forEach(r=>{var n;const i=(n=t[r])==null?void 0:n.newValue;this.renderControl.syncRenderUids(r,i?.render,i?.hide,i?.clear)}),e&&Object.keys(e).forEach(r=>{var n;const i=(n=e[r])==null?void 0:n.newValue;this.renderControl.syncPageAuth(r,i)})}),this.collector.addStorageStateListener(t=>{var e,r;if((e=this.collector)!=null&&e.storage&&Object.keys(this.collector.storage).length===0){(r=this.worker)==null||r.clearViewScenePath(ne,!0);return}const{diffView:n,diffScenePath:i,diffData:a}=t,s=new Map;if(n){let u;Object.keys(n).forEach(d=>{var M;const c=n[d];if(c&&!c.newValue)(M=this.worker)==null||M.clearViewScenePath(d,!0),c.oldValue&&(u=c.oldValue);else if(c&&c.newValue){for(const v of Object.keys(c.newValue))this.worker.pullServiceData(d,v,{isAsync:!1,useAnimation:!1});u=c.newValue}if(u)for(const v of Object.values(u)){const p=new Set;for(const T of Object.keys(v))T&&p.add(T);s.set(d,p)}})}if(i){let u;Object.keys(i).forEach(d=>{var M;const c=i[d];if(c&&c.viewId&&!c.newValue?((M=this.worker)==null||M.clearViewScenePath(c.viewId,!0),c.oldValue&&(u=c.oldValue)):c&&c.viewId&&c.newValue&&(this.worker.pullServiceData(c.viewId,d,{isAsync:!1,useAnimation:!1}),u=c.newValue),c!=null&&c.viewId&&u){const v=new Set;for(const p of Object.keys(u))p&&v.add(p),s.set(c.viewId,v)}})}a&&Object.keys(a).forEach(u=>{var d,M;const c=a[u];if(c){const{viewId:v}=c,p=s.get(v)||new Set;p.add(u),s.set(v,p),(d=this.worker)==null||d.onServiceDerive(u,c),(M=this.miniMapManager)==null||M.updateMiniMapCamera(v)}});for(const[u,d]of s.entries())Te.InternalMsgEmitter.emit("excludeIds",[...d],u)}),this.worker.isActive&&this.viewContainerManager.getAllViews().forEach(t=>{t&&t.focusScenePath&&this.worker.pullServiceData(t.id,t.focusScenePath,{isAsync:!0,useAnimation:!1})}),this.room&&this.roomMember.onUidChangeHook(t=>{var e,r;(e=this.collector)!=null&&e.serviceStorage&&this.viewContainerManager.getAllViews().forEach(n=>{var i,a,s,u;if(n&&n.focusScenePath&&(i=this.collector)!=null&&i.serviceStorage[n.id]&&this.collector.serviceStorage[n.id][n.focusScenePath]){const d=Object.keys(this.collector.serviceStorage[n.id][n.focusScenePath]);for(const M of d){const c=(a=this.collector)==null?void 0:a.getUidFromKey(M);if(c&&!t.online.includes(c))if((s=this.collector)!=null&&s.isSelector(M))this.renderControl.isWritable&&((u=this.collector)==null||u.updateValue(M,void 0,{viewId:n.id,scenePath:n.focusScenePath,isSync:!0})),this.worker.blurSelector(n.id,n.focusScenePath,M);else{const v=this.textEditorManager.editors.get(M);v&&v.opt&&(v.opt.workState===Et.Doing||v.opt.workState===Et.Start)&&(v.opt.text&&v.opt.text.replace(/\s*,/g,"")?this.textEditorManager.unActive(M):this.textEditorManager.delete(M))}}}}),(r=this.cursor)==null||r.updateRoomMembers(t)}))}async activeWorker(){await this.worker.init()}setWindowManager(t){var e,r,n,i,a;this.windowManager=t,(r=(e=this.windowManager)==null?void 0:e.mainView)!=null&&r.divElement&&this.viewContainerManager.onMainViewMounted(this.windowManager.mainView),(a=(i=(n=this.windowManager.appManager)==null?void 0:n.viewManager)==null?void 0:i.views)!=null&&a.size&&this.windowManager.appManager.viewManager.views.forEach((s,u)=>{this.viewContainerManager.onAppViewMounted({appId:u,view:s})}),this.viewContainerManager.listenerWindowManager(this.windowManager)}}const He=class Dt extends Bt.InvisiblePlugin{constructor(){super(...arguments),it(this,"onPhaseChanged",t=>{var e;t===Bt.RoomPhase.Reconnecting&&((e=Dt.currentManager)==null||e.setSnapshootData())}),it(this,"updateRoomWritable",()=>{var t;(t=Dt.currentManager)==null||t.onWritableChange(this.displayer.isWritable)}),it(this,"roomStateChangeListener",async t=>{var e,r;t!=null&&t.roomMembers&&((e=Dt.currentManager)==null||e.onRoomMembersChange(t.roomMembers)),!(Bt.isRoom(this.displayer)&&!this.displayer.isWritable)&&t.memberState&&((r=Dt.currentManager)==null||r.onMemberChange(t.memberState))})}static async getInstance(t,e){var r;e.options&&(((r=e.options.extras)==null?void 0:r.useWorker)==="mainThread"&&(e.options.cdn.fullWorkerUrl="",e.options.cdn.subWorkerUrl=""),(e.options.extras&&e.options.extras.useWorker!=="mainThread"||!e.options.extras)&&!e.options.cdn.fullWorkerUrl&&!e.options.cdn.subWorkerUrl&&Dt.logger.error("[ApplianceMultiPlugin] you must adaptor options cdn fullWorkerUrl and subWorkerUrl"));const n=t.displayer,i=n.callbacks.on,a=n.callbacks.off,s=n.callbacks.once,u=t.cleanCurrentScene,d=t.mainView.setMemberState;let M;Bt.isRoom(n)&&(M=n.setWritable),e!=null&&e.logger&&(Dt.logger=e.logger);let c=n.getInvisiblePlugin(Dt.kind);c||(c=await Dt.createApplianceMultiPlugin(n,Dt.kind)),n&&c&&Dt.createCurrentManager(t,{cdn:e.options.cdn,extras:{...me,...e.options.extras}},c),c&&Dt.currentManager&&(Dt.currentManager.bindPlugin(c),c.init(n));const v={displayer:n,windowManager:t,currentManager:Dt.currentManager,maxScreenshotWidth:10*1024,maxScreenshotHeight:10*1024,getBoundingRectAsync:async function(T){var x;Dt.logger.info("[ApplianceMultiPlugin] getBoundingRectAsync");const y=(t.mainView||n).getBoundingRect(T),C=await((x=Dt.currentManager)==null?void 0:x.getBoundingRect(T));return!y.width||!y.height?C:Ti(y,C)},screenshotToCanvasAsync:async function(T,x,y,C,h,g){var f;Dt.logger.info("[ApplianceMultiPlugin] screenshotToCanvasAsync");let m=y,S=C,A=h.scale;m>this.maxScreenshotWidth&&(A=this.maxScreenshotWidth/m*A,m=this.maxScreenshotWidth),S>this.maxScreenshotHeight&&(A=Math.min(this.maxScreenshotHeight/S*A,A),S=this.maxScreenshotHeight),h.scale=A;const P=document.createElement("canvas"),R=P.getContext("2d");P.width=m*(g||1),P.height=S*(g||1),R&&((t.mainView||n).screenshotToCanvas(R,x,m,S,h,g),T.drawImage(P,Math.floor((y-m)/2),Math.floor((C-S)/2),m*(g||1),S*(g||1),0,0,m,S),P.remove()),Dt.currentManager&&await((f=Dt.currentManager)==null?void 0:f.screenshotToCanvas(T,x,m,S,h,Math.floor((y-m)/2),Math.floor((C-S)/2)))},scenePreviewAsync:async function(T,x,y,C,h){Dt.logger.info("[ApplianceMultiPlugin] scenePreviewAsync"),(t.mainView||n).scenePreview(T,x,y,C,h);const g=document.createElement("img");g.className="appliance-plugin-fill-scene-snapshot-img",x.append(g),getComputedStyle(x).position||(x.style.position="relative"),Dt.currentManager&&await Dt.currentManager.scenePreview(T,g)},fillSceneSnapshotAsync:async function(T,x,y,C,h){Dt.logger.info("[ApplianceMultiPlugin] fillSceneSnapshotAsync"),x.innerHTML="",(t.mainView||n).fillSceneSnapshot(T,x,y,C,h);const g=y||t.mainView.size.width,f=C||t.mainView.size.height;let m=await this.getBoundingRectAsync(T);m||(m={originX:0,originY:0,width:g,height:f});let S=Math.max(m?.width,g),A=Math.max(m?.height,f),P=1;const R=S>g&&Math.min(g/S,P)||P,D=A>f&&Math.min(f/A,P)||P;R<=D?(S=R<1&&g||S,A=Math.floor(A*R)+1,P=R):R>D&&(A=D<1&&f||A,S=Math.floor(S*D)+1,P=D);const L={scale:P,centerX:m.originX+m.width/2,centerY:m.originY+m.height/2},j=document.createElement("canvas"),b=j.getContext("2d");j.width=S,j.height=A,b&&await this.screenshotToCanvasAsync(b,T,S,A,L,devicePixelRatio);const O=document.createElement("img");O.className="appliance-plugin-fill-scene-snapshot-img",O.src=j.toDataURL(),O.onload=()=>{j.remove()},O.onerror=()=>{j.remove(),O.remove()},x.append(O),getComputedStyle(x).position||(x.style.position="relative")},_callbacksOn:function(T,x){Dt.logger.info(`[ApplianceMultiPlugin] callbacks ${T}`),(T==="onCanUndoStepsUpdate"||T==="onCanRedoStepsUpdate")&&Bt.isRoom(n)&&n.isWritable?Je.InternalMsgEmitter.on(T,x):i.call(n.callbacks,T,x)},_callbacksOnce:function(T,x){Dt.logger.info(`[ApplianceMultiPlugin] callbacks ${T}`),(T==="onCanUndoStepsUpdate"||T==="onCanRedoStepsUpdate")&&Bt.isRoom(n)&&n.isWritable?Je.InternalMsgEmitter.on(T,x):s.call(n.callbacks,T,x)},_callbacksOff:function(T,x){Dt.logger.info(`[ApplianceMultiPlugin] callbacks ${T}`),(T==="onCanUndoStepsUpdate"||T==="onCanRedoStepsUpdate")&&Bt.isRoom(n)&&n.isWritable?Je.InternalMsgEmitter.off(T,x):a.call(n.callbacks,T,x)},canRedoSteps(){if(Dt.logger.info("[ApplianceMultiPlugin] canRedoSteps"),Dt.currentManager&&Bt.isRoom(n)&&!n.disableSerialization){const T=Dt.currentManager.viewContainerManager.focuedView,x=T?.focusScenePath;if(T&&x)return T.displayer.commiter.redoStack.filter(y=>y.scenePath===x).length}return 0},canUndoSteps(){if(Dt.logger.info("[ApplianceMultiPlugin] canUndoSteps"),Dt.currentManager&&Bt.isRoom(n)&&!n.disableSerialization){const T=Dt.currentManager.viewContainerManager.focuedView,x=T?.focusScenePath;if(T&&x)return T.displayer.commiter.undoStack.filter(y=>y.scenePath===x).length}return 0},undo:function(){return Dt.logger.info("[ApplianceMultiPlugin] undo"),Dt.currentManager&&Bt.isRoom(n)&&!n.disableSerialization?Dt.currentManager.viewContainerManager.undo():0},redo:function(){return Dt.logger.info("[ApplianceMultiPlugin] redo"),Dt.currentManager&&Bt.isRoom(n)&&!n.disableSerialization?Dt.currentManager.viewContainerManager.redo():0},cleanCurrentScene:function(){Dt.logger.info("[ApplianceMultiPlugin] cleanCurrentScene"),Dt.currentManager&&Bt.isRoom(n)&&n.isWritable&&(Dt.currentManager.cleanCurrentScene(),u.call(t))},insertImage:function(T){if(Dt.logger.info("[ApplianceMultiPlugin] insertImage"),Dt.currentManager&&Bt.isRoom(n)&&n.isWritable){const x=Dt.currentManager.viewContainerManager.focuedViewId||ne;Dt.currentManager.worker.insertImage(x,T)}},lockImage:function(T,x){if(Dt.logger.info("[ApplianceMultiPlugin] lockImage"),Dt.currentManager&&Bt.isRoom(n)&&n.isWritable){const y=Dt.currentManager.viewContainerManager.focuedViewId||ne;Dt.currentManager.worker.lockImage(y,T,x)}},completeImageUpload:function(T,x){if(Dt.logger.info("[ApplianceMultiPlugin] completeImageUpload"),Dt.currentManager&&Bt.isRoom(n)&&n.isWritable){const y=Dt.currentManager.viewContainerManager.focuedViewId||ne;Dt.currentManager.worker.completeImageUpload(y,T,x)}},getImagesInformation:function(T){return Dt.logger.info("[ApplianceMultiPlugin] completeImageUpload"),Dt.currentManager&&Bt.isRoom(n)&&n.isWritable?Dt.currentManager.worker.getImagesInformation(T):[]},insertText:function(T,x,y){if(Dt.logger.info("[ApplianceMultiPlugin] insertText"),Dt.currentManager&&Bt.isRoom(n)&&n.isWritable){const C=Dt.currentManager.viewContainerManager.focuedViewId||ne;return Dt.currentManager.textEditorManager.insertText(C,T,x,y)}},updateText:function(T,x){Dt.logger.info("[ApplianceMultiPlugin] updateText"),Dt.currentManager&&Bt.isRoom(n)&&n.isWritable&&Dt.currentManager.textEditorManager.updateText(T,x)},callbacks:()=>(Dt.logger.info("[ApplianceMultiPlugin] callbacks bind"),{...n.callbacks,on:v._callbacksOn.bind(v),once:v._callbacksOnce.bind(v),off:v._callbacksOff.bind(v)}),destroy(){Dt.currentManager&&(Dt.logger.info("[ApplianceMultiPlugin] destroy"),Dt.currentManager.destroy(),Dt.currentManager=void 0)},setMemberState(T){var x;Dt.logger.info(`[ApplianceMultiPlugin] setMemberState ${JSON.stringify(T)}`);const y=Object.keys(T);if(Bt.isRoom(n)&&n.isWritable){if(y.includes("currentApplianceName"))if(T.currentApplianceName&&T.currentApplianceName===Xt.laserPen){if((x=Dt.currentManager)!=null&&x.isUseSimple)throw new Error("[ApplianceMultiPlugin] laserPen must be not support in simple mode");T.currentApplianceName=Xt.pencil,T.useLaserPen=!0}else T.currentApplianceName&&T.currentApplianceName===Xt.pencil&&(T.useLaserPen=!1);d.call(t.mainView,T);return}throw new Error("[ApplianceMultiPlugin] setMemberState must be called in writable room")},createMiniMap:async function(T,x){if(Dt.logger.info("[ApplianceMultiPlugin] createMiniMap"),Dt.currentManager&&Bt.isRoom(n)&&n.isWritable)return Dt.currentManager.createMiniMap(T,x)},destroyMiniMap:async function(T){if(Dt.logger.info("[ApplianceMultiPlugin] destroyeMiniMap"),Dt.currentManager&&Bt.isRoom(n)&&n.isWritable)return Dt.currentManager.destroyMiniMap(T)},filterRenderByUid(T,x,y){if(Dt.logger.info("[ApplianceMultiPlugin] filterRenderByUid"),Dt.currentManager&&Bt.isRoom(n)&&n.isWritable)return Dt.currentManager.filterRenderByUid(T,x,y)},cancelFilterRender(T,x){if(Dt.logger.info("[ApplianceMultiPlugin] filterRenderByUid"),Dt.currentManager&&Bt.isRoom(n)&&n.isWritable)return Dt.currentManager.cancelFilterRender(T,x)},addListener:(T,x)=>{Dt.logger.info(`[ApplianceMultiPlugin] addListener ${T}`),Je.PublicMsgEmitter.on(T,x)},removeListener:(T,x)=>{Dt.logger.info(`[ApplianceMultiPlugin] removeListener ${T}`),Je.PublicMsgEmitter.off(T,x)},usePlugin:T=>{var x;Dt.logger.info("[ApplianceMultiPlugin] usePlugin",T.kind),(x=Dt.currentManager)==null||x.usePlugin(T)},getDisableDeviceInputs(){if(Dt.currentManager&&Bt.isRoom(n))return Dt.currentManager.disableDeviceInputs},setDisableDeviceInputs(T){Dt.logger.info(`[ApplianceMultiPlugin] setDisableDeviceInputs ${T}`),Dt.currentManager&&Bt.isRoom(n)&&(Dt.currentManager.disableDeviceInputs=T)},getDisableCameraTransform(){if(Dt.currentManager&&Bt.isRoom(n))return Dt.currentManager.disableCameraTransform},setDisableCameraTransform(T){Dt.logger.info(`[ApplianceMultiPlugin] setDisableCameraTransform ${T}`),Dt.currentManager&&Bt.isRoom(n)&&(Dt.currentManager.disableCameraTransform=T)},getDisableEraseImage(){if(Dt.currentManager&&Bt.isRoom(n))return Dt.currentManager.disableEraseImage},setDisableEraseImage(T){Dt.logger.info(`[ApplianceMultiPlugin] setDisableEraseImage ${T}`),Dt.currentManager&&Bt.isRoom(n)&&(Dt.currentManager.disableEraseImage=T)},setWritable:async function(T){var x;Dt.logger.info(`[ApplianceMultiPlugin] setWritable ${T}`),Bt.isRoom(n)&&M&&(await((x=Dt.currentManager)==null?void 0:x.setWritable(T)),await M.call(n,T))},requestIdleCallback:(T,x)=>{const y=x?.timeout||0,C=performance.now();let h;const g=new MessageChannel;let f;const m=S=>{try{T({didTimeout:S,timeRemaining:()=>{const A=performance.now()-C;return Math.max(0,y-A)}})}catch(A){Dt.logger.error("[ApplianceMultiPlugin] requestIdleCallback error:",A)}finally{g.port1.close(),g.port2.close(),h!==void 0&&cancelAnimationFrame(h),f!==void 0&&clearTimeout(f)}};return g.port1.onmessage=()=>{h=requestAnimationFrame(()=>{y>0&&performance.now()-C>=y?m(!0):m(!1)})},g.port2.postMessage(null),y>0&&(f=setTimeout(()=>{m(!0)},y)),f||h||0},cancelIdleCallback:T=>{try{clearTimeout(T),cancelAnimationFrame(T)}catch(x){Dt.logger.error("[ApplianceMultiPlugin] cancelIdleCallback error:",x)}},injectMethodToObject:(T,x)=>{if(Dt.logger.info(`[ApplianceMultiPlugin] injectMethodToObject ${x}`),typeof T[x]=="function"||typeof T[x]>"u"){(x==="requestIdleCallback"||x==="cancelIdleCallback")&&Dt.currentManager&&Dt.currentManager.registerPolyfillMethod(x),T[x]=v[x];return}x==="callbacks"&&(T.callbacks.on=v._callbacksOn.bind(v),T.callbacks.off=v._callbacksOff.bind(v),T.callbacks.once=v._callbacksOnce.bind(v))},blurText:()=>{Dt.logger.info("[ApplianceMultiPlugin] blurText"),Dt.currentManager&&Bt.isRoom(n)&&n.isWritable&&Dt.currentManager.textEditorManager.checkEmptyTextBlur()},hasElements:(T,x)=>{var y;if(Dt.logger.info(`[ApplianceMultiPlugin] hasElements ${T}`),Dt.currentManager&&Bt.isRoom(n)&&n.isWritable){let C=T;if(!C){const h=Dt.currentManager.viewContainerManager.focuedView;C=h?.focusScenePath}if(C){const h=(y=Dt.currentManager.collector)==null?void 0:y.getScenePathData(C);if(h){const g=Object.values(h);return g.length>0?x?g.some(f=>x(f.toolsType)):!0:!1}return!1}return!1}},getElements:(T,x)=>{var y;if(Dt.logger.info(`[ApplianceMultiPlugin] getElements ${T}`),Dt.currentManager&&Bt.isRoom(n)&&n.isWritable){let C=T;if(!C){const h=Dt.currentManager.viewContainerManager.focuedView;C=h?.focusScenePath}if(C){const h=(y=Dt.currentManager.collector)==null?void 0:y.getScenePathData(C),g=h&&Object.values(h)||[];return h&&g.length>0&&x?g.filter(f=>x(f.toolsType)):g}return[]}},stopDraw:T=>{if(Dt.logger.info(`[ApplianceMultiPlugin] stopDraw ${T}`),Dt.currentManager&&Bt.isRoom(n))return Dt.currentManager.stopDraw(T)}};v.injectMethodToObject(t,"undo"),v.injectMethodToObject(t,"redo"),v.injectMethodToObject(t,"cleanCurrentScene"),v.injectMethodToObject(t,"insertImage"),v.injectMethodToObject(t,"completeImageUpload"),v.injectMethodToObject(t,"lockImage"),v.injectMethodToObject(t,"insertText"),v.injectMethodToObject(t,"updateText"),v.injectMethodToObject(n,"getImagesInformation"),v.injectMethodToObject(n,"callbacks"),v.injectMethodToObject(n,"screenshotToCanvasAsync"),v.injectMethodToObject(n,"getBoundingRectAsync"),v.injectMethodToObject(n,"scenePreviewAsync"),v.injectMethodToObject(n,"fillSceneSnapshotAsync"),v.injectMethodToObject(t.mainView,"setMemberState"),Bt.isRoom(n)&&v.injectMethodToObject(n,"setWritable"),Object.defineProperty(t,"canUndoSteps",{get(){return v.canUndoSteps()}}),Object.defineProperty(t,"canRedoSteps",{get(){return v.canRedoSteps()}}),Je.InternalMsgEmitter.on("onCanUndoStepsUpdate",T=>{t.emitter.emit("canUndoStepsChange",T)}),Je.InternalMsgEmitter.on("onCanRedoStepsUpdate",T=>{t.emitter.emit("canRedoStepsChange",T)});const p={...v,callbacks:v.callbacks()};return Object.defineProperty(p,"disableDeviceInputs",{set(T){v.setDisableDeviceInputs(T)},get(){return v.getDisableDeviceInputs()}}),Object.defineProperty(p,"disableCameraTransform",{set(T){v.setDisableCameraTransform(T)},get(){return v.getDisableCameraTransform()}}),Object.defineProperty(p,"disableEraseImage",{set(T){v.setDisableEraseImage(T)},get(){return v.getDisableEraseImage()}}),t._appliancePlugin=p,t._appliancePlugin}static onCreate(t){t&&Dt.currentManager&&(Dt.currentManager.bindPlugin(t),t.init(t.displayer))}static async createApplianceMultiPlugin(t,e){try{await t.createInvisiblePlugin(Dt,{})}catch(n){if(!t.isWritable){await t.setWritable(!0);const i=await this.createApplianceMultiPlugin(t,e);return await t.setWritable(!1),i}throw n}let r=t.getInvisiblePlugin(e);return r||(r=await Dt.createApplianceMultiPlugin(t,e)),r}get isReplay(){return Bt.isPlayer(this.displayer)}get callbackName(){return this.isReplay?"onPlayerStateChanged":"onRoomStateChanged"}init(t){var e,r;const n=t.state;(e=Dt.currentManager)==null||e.onRoomMembersChange(n.roomMembers),Bt.isRoom(t)&&((r=Dt.currentManager)==null||r.onMemberChange(n.memberState)),this.displayer.callbacks.on(this.callbackName,this.roomStateChangeListener),this.displayer.callbacks.on("onEnableWriteNowChanged",this.updateRoomWritable),this.displayer.callbacks.on("onPhaseChanged",this.onPhaseChanged)}destroy(){var t;Dt.logger.info("[ApplianceMultiPlugin] passive destroy"),(t=Dt.currentManager)==null||t.destroy(),Dt.currentManager=void 0}};it(He,"kind","appliance-multi-plugin"),it(He,"currentManager"),it(He,"logger",{info:console.log,warn:console.warn,error:console.error}),it(He,"createCurrentManager",(o,t,e)=>{He.currentManager&&He.currentManager.destroy();const r={plugin:e,displayer:o.displayer,options:t},n=new Je(r);if(He.logger.info("[ApplianceMultiPlugin] refresh ApplianceMultiManager object"),n.setWindowManager(o),He.currentManager=n,o.room){const i=n.hasOffscreenCanvas;o.room.logger.info(`[ApplianceMultiPlugin] use ${i?"worker":"mainThread"}`)}});let PM=He;var DM=ze,wM=function(){return DM.Date.now()},bM=wM,OM=/\s/;function LM(o){for(var t=o.length;t--&&OM.test(o.charAt(t)););return t}var jM=LM,RM=jM,zM=/^\s+/;function BM(o){return o&&o.slice(0,RM(o)+1).replace(zM,"")}var YM=BM,UM=Lr,WM=nr,FM="[object Symbol]";function VM(o){return typeof o=="symbol"||WM(o)&&UM(o)==FM}var kM=VM,XM=YM,Ws=qe,GM=kM,Fs=NaN,HM=/^[-+]0x[0-9a-f]+$/i,ZM=/^0b[01]+$/i,QM=/^0o[0-7]+$/i,KM=parseInt;function $M(o){if(typeof o=="number")return o;if(GM(o))return Fs;if(Ws(o)){var t=typeof o.valueOf=="function"?o.valueOf():o;o=Ws(t)?t+"":t}if(typeof o!="string")return o===0?o:+o;o=XM(o);var e=ZM.test(o);return e||QM.test(o)?KM(o.slice(2),e?2:8):HM.test(o)?Fs:+o}var JM=$M,qM=qe,Fn=bM,Vs=JM,_M="Expected a function",t1=Math.max,e1=Math.min;function r1(o,t,e){var r,n,i,a,s,u,d=0,M=!1,c=!1,v=!0;if(typeof o!="function")throw new TypeError(_M);t=Vs(t)||0,qM(e)&&(M=!!e.leading,c="maxWait"in e,i=c?t1(Vs(e.maxWait)||0,t):i,v="trailing"in e?!!e.trailing:v);function p(S){var A=r,P=n;return r=n=void 0,d=S,a=o.apply(P,A),a}function T(S){return d=S,s=setTimeout(C,t),M?p(S):a}function x(S){var A=S-u,P=S-d,R=t-A;return c?e1(R,i-P):R}function y(S){var A=S-u,P=S-d;return u===void 0||A>=t||A<0||c&&P>=i}function C(){var S=Fn();if(y(S))return h(S);s=setTimeout(C,x(S))}function h(S){return s=void 0,v&&r?p(S):(r=n=void 0,a)}function g(){s!==void 0&&clearTimeout(s),d=0,r=u=n=s=void 0}function f(){return s===void 0?a:h(Fn())}function m(){var S=Fn(),A=y(S);if(r=arguments,n=this,u=S,A){if(s===void 0)return T(u);if(c)return clearTimeout(s),s=setTimeout(C,t),p(u)}return s===void 0&&(s=setTimeout(C,t)),a}return m.cancel=g,m.flush=f,m}var n1=r1,i1=n1,s1=qe,o1="Expected a function";function a1(o,t,e){var r=!0,n=!0;if(typeof o!="function")throw new TypeError(o1);return s1(e)&&(r="leading"in e?!!e.leading:r,n="trailing"in e?!!e.trailing:n),i1(o,t,{leading:r,maxWait:t,trailing:n})}var l1=a1;const c1=si(l1);class u1 extends jo{constructor(t,e){super(t,e),it(this,"width",1e3),it(this,"height",1e3),it(this,"dpr",hr()),it(this,"vDom"),it(this,"eventTragetElement"),it(this,"snapshotContainerRef"),it(this,"canvasContainerRef",ot.createRef()),it(this,"subLocalCanvasContainerRef"),it(this,"canvasTopRef"),it(this,"canvasServiceFloatRef",ot.createRef()),it(this,"canvasFloatRef",ot.createRef()),it(this,"canvasBgRef",ot.createRef()),it(this,"floatBarRef",ot.createRef()),it(this,"containerOffset",{x:0,y:0}),this.control.hasOffscreenCanvas||(this.snapshotContainerRef=ot.createRef()),this.control.isUseSimple||(this.canvasTopRef=ot.createRef(),this.subLocalCanvasContainerRef=ot.createRef())}setCanvassStyle(){var t;if(this.eventTragetElement){const e=this.eventTragetElement.offsetWidth,r=this.eventTragetElement.offsetHeight,n=hr();n!==this.dpr&&(this.dpr=n,this.control.worker.updateDpr(this.viewId,this.dpr)),e&&r&&this.canvasContainerRef.current&&(e!==this.width||r!==this.height)&&(this.width=e,this.height=r),e&&r&&this.canvasBgRef.current&&(e!==this.width||r!==this.height)&&(this.width=e,this.height=r,this.control.isUseOffscreenTransfer||(this.canvasBgRef.current.width=e*this.dpr,this.canvasBgRef.current.height=r*this.dpr,this.canvasFloatRef.current&&(this.canvasFloatRef.current.width=e*this.dpr,this.canvasFloatRef.current.height=r*this.dpr),this.canvasServiceFloatRef.current&&(this.canvasServiceFloatRef.current.width=e*this.dpr,this.canvasServiceFloatRef.current.height=r*this.dpr),(t=this.canvasTopRef)!=null&&t.current&&(this.canvasTopRef.current.width=e*this.dpr,this.canvasTopRef.current.height=r*this.dpr)))}}createMainViewDisplayer(t){return this.vDom||(this.containerOffset=this.getContainerOffset(t,this.containerOffset),this.eventTragetElement=t.parentElement.children[0],t.innerHTML="",ri.render(ot.createElement(Ci,{viewId:this.viewId,mananger:this,refs:{canvasServiceFloatRef:this.canvasServiceFloatRef,canvasFloatRef:this.canvasFloatRef,canvasBgRef:this.canvasBgRef,floatBarRef:this.floatBarRef,canvasTopRef:this.canvasTopRef,canvasContainerRef:this.canvasContainerRef,snapshotContainerRef:this.snapshotContainerRef,subLocalCanvasContainerRef:this.subLocalCanvasContainerRef}}),t),this.control.room&&this.bindDisplayerEvent(this.eventTragetElement)),this}}class Ze extends wr{constructor(t){super(t),it(this,"focuedViewId"),it(this,"control"),it(this,"focuedView"),this.control=t.control}bindMainView(){if(!this.control.divMainView)return;const t=new u1(this.control,Te.InternalMsgEmitter),{width:e,height:r,dpr:n}=t,i={offscreenCanvasOpt:{...Ze.defaultScreenCanvasOpt},layerOpt:{...Ze.defaultLayerOpt},cameraOpt:{...Ze.defaultCameraOpt,width:e,height:r}},a=this.control.room&&this.control.room.mainView||this.control.play&&this.control.play.mainView;if(a){const{scale:s,...u}=a.camera;i.cameraOpt={...i.cameraOpt,...u,scale:s===1/0?1:s},this.createMianView({id:ne,displayer:t,focusScenePath:a.focusScenePath||a.scenePath,cameraOpt:i.cameraOpt,viewData:a}),this.setFocuedViewId(ne),t.createMainViewDisplayer(this.control.divMainView)}}getViewInitData(t){var e;const r=this.getView(t);if(r){const{width:n,height:i,dpr:a}=r.displayer;(e=this.control.pluginOptions.extras.canvasOpt)!=null&&e.contextType&&(Ze.defaultScreenCanvasOpt.contextType=this.control.pluginOptions.extras.canvasOpt.contextType);const s={dpr:a,originalPoint:[n/2,i/2],offscreenCanvasOpt:{...Ze.defaultScreenCanvasOpt,width:n,height:i},layerOpt:{...Ze.defaultLayerOpt,width:n,height:i},cameraOpt:{...Ze.defaultCameraOpt,width:n,height:i}};if(r.viewData){const{scale:u,...d}=r.viewData.camera;s.cameraOpt={...s.cameraOpt,...d,scale:u===1/0?1:u}}return s}}async mountView(t){var e;const r=this.getView(t);if(r){this.control.worker.isActive||(this.control.cursor.activeCollector(),this.control.isUseOffscreenTransfer&&r.displayer.canvasBgRef.current&&r.displayer.canvasServiceFloatRef.current&&r.displayer.canvasFloatRef.current&&r.displayer.setTransferControlToOffscreenCanvas({bgCanvas:r.displayer.canvasBgRef.current,serviceCanvas:r.displayer.canvasServiceFloatRef.current,localCanvas:r.displayer.canvasFloatRef.current}),await this.control.activeWorker());const n=this.getViewInitData(t);n&&((e=this.control.worker)==null||e.createViewWorker(t,n,r.displayer)),r.focusScenePath&&this.control.collector&&this.control.worker.pullServiceData(t,r.focusScenePath,{isAsync:!0,useAnimation:!1})}}}class be extends Te{constructor(t){super(t),it(this,"viewContainerManager"),it(this,"divMainView"),it(this,"onCameraChange",c1(r=>{var n;const i=this.viewContainerManager.mainView;i&&i.cameraOpt&&(i.cameraOpt.width!==r.width||i.cameraOpt.height!==r.height)&&((n=this.viewContainerManager.mainView)==null||n.displayer.updateSize()),this.viewContainerManager.setFocuedViewCameraOpt(r)},So,{leading:!1}));const e={control:this,internalMsgEmitter:be.InternalMsgEmitter,publicMsgEmitter:be.PublicMsgEmitter};this.viewContainerManager=new Ze(e)}init(){be.InternalMsgEmitter.on(Vt.BindMainView,t=>{this.divMainView=t,this.plugin&&!this.viewContainerManager.mainView&&this.viewContainerManager.bindMainView()})}activePlugin(){this.plugin&&this.divMainView&&!this.viewContainerManager.mainView&&this.viewContainerManager.bindMainView(),this.collector&&(this.collector.addStorageStateListener(t=>{var e,r;if((e=this.collector)!=null&&e.storage&&Object.keys(this.collector.storage).length===0){(r=this.worker)==null||r.clearViewScenePath(ne,!0);return}const{diffView:n,diffScenePath:i,diffData:a}=t,s=new Map;if(n){let u;Object.keys(n).forEach(d=>{var M;const c=n[d];if(c&&!c.newValue)(M=this.worker)==null||M.clearViewScenePath(d,!0),c.oldValue&&(u=c.oldValue);else if(c&&c.newValue){for(const v of Object.keys(c.newValue))this.worker.pullServiceData(d,v,{isAsync:!1,useAnimation:!0});u=c.newValue}if(u)for(const v of Object.values(u)){const p=new Set;for(const T of Object.keys(v))T&&p.add(T);s.set(d,p)}})}if(i){let u;Object.keys(i).forEach(d=>{var M;const c=i[d];if(c&&c.viewId&&!c.newValue?((M=this.worker)==null||M.clearViewScenePath(c.viewId,!0),c.oldValue&&(u=c.oldValue)):c&&c.viewId&&c.newValue&&(this.worker.pullServiceData(c.viewId,d,{isAsync:!1,useAnimation:!0}),u=c.newValue),c!=null&&c.viewId&&u){const v=new Set;for(const p of Object.keys(u))p&&v.add(p),s.set(c.viewId,v)}})}a&&Object.keys(a).forEach(u=>{var d,M;const c=a[u];if(c){const{viewId:v}=c,p=s.get(v)||new Set;p.add(u),s.set(v,p),(d=this.worker)==null||d.onServiceDerive(u,c),(M=this.miniMapManager)==null||M.updateMiniMapCamera(v)}});for(const[u,d]of s.entries())Te.InternalMsgEmitter.emit("excludeIds",[...d],u)}),this.room&&(this.roomMember.onUidChangeHook(t=>{var e;(e=this.collector)!=null&&e.serviceStorage&&this.viewContainerManager.getAllViews().forEach(r=>{var n,i,a,s,u,d;if(r&&r.focusScenePath&&(n=this.collector)!=null&&n.serviceStorage[r.id]&&(i=this.collector)!=null&&i.serviceStorage[r.id][r.focusScenePath]){const M=Object.keys((a=this.collector)==null?void 0:a.serviceStorage[r.id][r.focusScenePath]);for(const c of M){const v=(s=this.collector)==null?void 0:s.getUidFromKey(c);if(v&&!t.online.includes(v))if((u=this.collector)!=null&&u.isSelector(c))this.renderControl.isWritable&&((d=this.collector)==null||d.updateValue(c,void 0,{viewId:r.id,scenePath:r.focusScenePath,isSync:!0})),this.worker.blurSelector(r.id,r.focusScenePath,c);else{const p=this.textEditorManager.editors.get(c);p&&p.opt&&(p.opt.workState===Et.Doing||p.opt.workState===Et.Start)&&(p.opt.text&&p.opt.text.replace(/\s*,/g,"")?this.textEditorManager.unActive(c):this.textEditorManager.delete(c))}}}})}),this.worker.isActive&&this.viewContainerManager.getAllViews().forEach(t=>{t&&t.focusScenePath&&this.worker.pullServiceData(t.id,t.focusScenePath,{isAsync:!0,useAnimation:!1})})))}async activeWorker(){await this.worker.init()}}const Xe=class Pt extends Bt.InvisiblePlugin{constructor(){super(...arguments),it(this,"onPhaseChanged",t=>{var e;t===Bt.RoomPhase.Reconnecting&&((e=Pt.currentManager)==null||e.setSnapshootData())}),it(this,"updateRoomWritable",()=>{var t;(t=Pt.currentManager)==null||t.onWritableChange(this.displayer.isWritable)}),it(this,"roomStateChangeListener",async t=>{var e,r;Pt.currentManager instanceof be&&(t.cameraState&&Pt.currentManager.onCameraChange(t.cameraState),t.sceneState&&Pt.currentManager.onSceneChange(t.sceneState.scenePath,ne)),t!=null&&t.roomMembers&&((e=Pt.currentManager)==null||e.onRoomMembersChange(t.roomMembers)),!(Bt.isRoom(this.displayer)&&!this.displayer.isWritable)&&t.memberState&&((r=Pt.currentManager)==null||r.onMemberChange(t.memberState))})}static async getInstance(t,e){var r;e.options&&(((r=e.options.extras)==null?void 0:r.useWorker)==="mainThread"&&(e.options.cdn.fullWorkerUrl="",e.options.cdn.subWorkerUrl=""),(e.options.extras&&e.options.extras.useWorker!=="mainThread"||!e.options.extras)&&!e.options.cdn.fullWorkerUrl&&!e.options.cdn.subWorkerUrl&&Pt.logger.error("[ApplianceSinglePlugin] you must adaptor options cdn fullWorkerUrl and subWorkerUrl"));const n=t.callbacks.on,i=t.callbacks.off,a=t.callbacks.once,s=t.cleanCurrentScene.bind(t),u=t.setMemberState.bind(t);let d;Bt.isRoom(t)&&(d=t.setWritable),e!=null&&e.logger&&(Pt.logger=e.logger);let M=t.getInvisiblePlugin(Pt.kind);M||(M=await Pt.createAppliancePlugin(t,Pt.kind)),t&&M&&Pt.createCurrentManager(t,{cdn:e.options.cdn,extras:{...me,...e.options.extras}},M),M&&Pt.currentManager&&(Pt.currentManager.bindPlugin(M),M.init(t)),e!=null&&e.cursorAdapter&&(Pt.cursorAdapter=e.cursorAdapter),Pt.effectInstance();const c={displayer:t,currentManager:Pt.currentManager,maxScreenshotWidth:10*1024,maxScreenshotHeight:10*1024,_injectTargetObject:void 0,getBoundingRectAsync:async function(p){var T;Pt.logger.info("[ApplianceSinglePlugin] getBoundingRectAsync");const x=t.getBoundingRect(p),y=await((T=Pt.currentManager)==null?void 0:T.getBoundingRect(p));return!x.width||!x.height?y:Ti(x,y)},screenshotToCanvasAsync:async function(p,T,x,y,C,h){var g;Pt.logger.info("[ApplianceSinglePlugin] screenshotToCanvasAsync");let f=x,m=y,S=C.scale;f>this.maxScreenshotWidth&&(S=this.maxScreenshotWidth/f*S,f=this.maxScreenshotWidth),m>this.maxScreenshotHeight&&(S=Math.min(this.maxScreenshotHeight/m*S,S),m=this.maxScreenshotHeight),C.scale=S;const A=document.createElement("canvas"),P=A.getContext("2d");A.width=f*(h||1),A.height=m*(h||1),P&&(t.screenshotToCanvas(P,T,f,m,C,h),p.drawImage(A,Math.floor((x-f)/2),Math.floor((y-m)/2),f*(h||1),m*(h||1),0,0,f,m),A.remove()),Pt.currentManager&&await((g=Pt.currentManager)==null?void 0:g.screenshotToCanvas(p,T,f,m,C,Math.floor((x-f)/2),Math.floor((y-m)/2)))},scenePreviewAsync:async function(p,T,x,y,C){Pt.logger.info("[ApplianceSinglePlugin] scenePreviewAsync"),t.scenePreview(p,T,x,y,C);const h=document.createElement("img");h.className="appliance-plugin-fill-scene-snapshot-img",T.append(h),getComputedStyle(T).position||(T.style.position="relative"),Pt.currentManager&&await Pt.currentManager.scenePreview(p,h)},fillSceneSnapshotAsync:async function(p,T,x,y,C){var h,g;Pt.logger.info("[ApplianceSinglePlugin] fillSceneSnapshotAsync"),T.innerHTML="",t.fillSceneSnapshot(p,T,x,y,C);const f=x||((h=t.state.cameraState)==null?void 0:h.width)||0,m=y||((g=t.state.cameraState)==null?void 0:g.height)||0;let S=await this.getBoundingRectAsync(p);S||(S={originX:0,originY:0,width:f,height:m});let A=Math.max(S?.width,f),P=Math.max(S?.height,m),R=1;const D=A>f&&Math.min(f/A,R)||R,L=P>m&&Math.min(m/P,R)||R;D<=L?(A=D<1&&f||A,P=Math.floor(P*D)+1,R=D):D>L&&(P=L<1&&m||P,A=Math.floor(A*L)+1,R=L);const j={scale:R,centerX:S.originX+S.width/2,centerY:S.originY+S.height/2},b=document.createElement("canvas"),O=b.getContext("2d");b.width=A,b.height=P,O&&await this.screenshotToCanvasAsync(O,p,A,P,j,devicePixelRatio);const Y=document.createElement("img");Y.className="appliance-plugin-fill-scene-snapshot-img",Y.src=b.toDataURL(),Y.onload=()=>{b.remove()},Y.onerror=()=>{b.remove(),Y.remove()},T.append(Y),getComputedStyle(T).position||(T.style.position="relative")},_callbacksOn:function(p,T){Pt.logger.info(`[ApplianceSinglePlugin] callbacks ${p}`),(p==="onCanUndoStepsUpdate"||p==="onCanRedoStepsUpdate")&&Bt.isRoom(t)&&t.isWritable?be.InternalMsgEmitter.on(p,T):n.call(t.callbacks,p,T)},_callbacksOnce:function(p,T){Pt.logger.info(`[ApplianceSinglePlugin] callbacks ${p}`),(p==="onCanUndoStepsUpdate"||p==="onCanRedoStepsUpdate")&&Bt.isRoom(t)&&t.isWritable?be.InternalMsgEmitter.on(p,T):a.call(t.callbacks,p,T)},_callbacksOff:function(p,T){Pt.logger.info(`[ApplianceSinglePlugin] callbacks ${p}`),(p==="onCanUndoStepsUpdate"||p==="onCanRedoStepsUpdate")&&Bt.isRoom(t)&&t.isWritable?be.InternalMsgEmitter.off(p,T):i.call(t.callbacks,p,T)},canRedoSteps(){if(Pt.logger.info("[ApplianceSinglePlugin] canRedoSteps"),Pt.currentManager&&Bt.isRoom(t)&&!t.disableSerialization){const p=Pt.currentManager.viewContainerManager.focuedView,T=p?.focusScenePath;if(p&&T)return p.displayer.commiter.redoStack.filter(x=>x.scenePath===T).length}return 0},canUndoSteps(){if(Pt.logger.info("[ApplianceSinglePlugin] canUndoSteps"),Pt.currentManager&&Bt.isRoom(t)&&!t.disableSerialization){const p=Pt.currentManager.viewContainerManager.focuedView,T=p?.focusScenePath;if(p&&T)return p.displayer.commiter.undoStack.filter(x=>x.scenePath===T).length}return 0},undo:function(){return Pt.logger.info("[ApplianceSinglePlugin] undo"),Pt.currentManager&&Bt.isRoom(t)&&!t.disableSerialization?Pt.currentManager.viewContainerManager.undo():0},redo:function(){return Pt.logger.info("[ApplianceSinglePlugin] redo"),Pt.currentManager&&Bt.isRoom(t)&&!t.disableSerialization?Pt.currentManager.viewContainerManager.redo():0},cleanCurrentScene:function(p){Pt.logger.info("[ApplianceSinglePlugin] cleanCurrentScene"),Pt.currentManager&&Bt.isRoom(t)&&t.isWritable&&(Pt.currentManager.cleanCurrentScene(),s.call(t,p))},insertImage:function(p){Pt.logger.info("[ApplianceSinglePlugin] insertImage"),Pt.currentManager&&Bt.isRoom(t)&&t.isWritable&&Pt.currentManager.worker.insertImage(ne,p)},lockImage:function(p,T){Pt.logger.info("[ApplianceSinglePlugin] lockImage"),Pt.currentManager&&Bt.isRoom(t)&&t.isWritable&&Pt.currentManager.worker.lockImage(ne,p,T)},completeImageUpload:function(p,T){Pt.logger.info("[ApplianceSinglePlugin] completeImageUpload"),Pt.currentManager&&Bt.isRoom(t)&&t.isWritable&&Pt.currentManager.worker.completeImageUpload(ne,p,T)},getImagesInformation:function(p){return Pt.logger.info("[ApplianceSinglePlugin] completeImageUpload"),Pt.currentManager&&Bt.isRoom(t)&&t.isWritable?Pt.currentManager.worker.getImagesInformation(p):[]},insertText:function(p,T,x){if(Pt.logger.info("[ApplianceSinglePlugin] insertText"),Pt.currentManager&&Bt.isRoom(t)&&t.isWritable)return Pt.currentManager.textEditorManager.insertText(ne,p,T,x)},updateText:function(p,T){Pt.logger.info("[ApplianceMultiPlugin] updateText"),Pt.currentManager&&Bt.isRoom(t)&&t.isWritable&&Pt.currentManager.textEditorManager.updateText(p,T)},callbacks:()=>({...t.callbacks,on:c._callbacksOn.bind(c),once:c._callbacksOnce.bind(c),off:c._callbacksOff.bind(c)}),destroy(){Pt.currentManager&&(Pt.logger.info("[ApplianceSinglePlugin] destroy"),Pt.currentManager.destroy(),Pt.currentManager=void 0,Pt.cursorAdapter=void 0)},setMemberState(p){var T;Pt.logger.info(`[ApplianceSinglePlugin] setMemberState ${JSON.stringify(p)}`);const x=Object.keys(p);if(Bt.isRoom(t)&&t.isWritable){if(x.includes("currentApplianceName"))if(p.currentApplianceName&&p.currentApplianceName===Xt.laserPen){if((T=Pt.currentManager)!=null&&T.isUseSimple)throw new Error("[ApplianceMultiPlugin] laserPen must be not support in simple mode");p.currentApplianceName=Xt.pencil,p.useLaserPen=!0}else p.currentApplianceName&&p.currentApplianceName===Xt.pencil&&(p.useLaserPen=!1);u(p);return}throw new Error("setMemberState must be called in writable room")},createMiniMap:async function(p,T){if(Pt.logger.info("[ApplianceSinglePlugin] createMiniMap"),Pt.currentManager&&Bt.isRoom(t)&&t.isWritable)return Pt.currentManager.createMiniMap(p,T)},destroyMiniMap:async function(p){if(Pt.logger.info("[ApplianceMultiPlugin] destroyeMiniMap"),Pt.currentManager&&Bt.isRoom(t)&&t.isWritable)return Pt.currentManager.destroyMiniMap(p)},filterRenderByUid(p,T,x){if(Pt.logger.info("[ApplianceSinglePlugin] filterRenderByUid"),Pt.currentManager&&Bt.isRoom(t)&&t.isWritable)return Pt.currentManager.filterRenderByUid(p,T,x)},cancelFilterRender(p,T){if(Pt.logger.info("[ApplianceSinglePlugin] filterRenderByUid"),Pt.currentManager&&Bt.isRoom(t)&&t.isWritable)return Pt.currentManager.cancelFilterRender(p,T)},addListener:(p,T)=>{Pt.logger.info(`[ApplianceSinglePlugin] addListener ${p}`),be.PublicMsgEmitter.on(p,T)},removeListener:(p,T)=>{Pt.logger.info(`[ApplianceSinglePlugin] removeListener ${p}`),be.PublicMsgEmitter.off(p,T)},usePlugin:p=>{var T;Pt.logger.info("[ApplianceSinglePlugin] usePlugin",p.kind),(T=Pt.currentManager)==null||T.usePlugin(p)},getDisableDeviceInputs(){if(Pt.currentManager&&Bt.isRoom(t))return Pt.currentManager.disableDeviceInputs},setDisableDeviceInputs(p){Pt.logger.info(`[ApplianceSinglePlugin] setDisableDeviceInputs ${p}`),Pt.currentManager&&Bt.isRoom(t)&&(Pt.currentManager.disableDeviceInputs=p)},getDisableCameraTransform(){if(Pt.currentManager&&Bt.isRoom(t))return Pt.currentManager.disableCameraTransform},setDisableCameraTransform(p){Pt.logger.info(`[ApplianceSinglePlugin] setDisableCameraTransform ${p}`),Pt.currentManager&&Bt.isRoom(t)&&(Pt.currentManager.disableCameraTransform=p)},getDisableEraseImage(){if(Pt.currentManager&&Bt.isRoom(t))return Pt.currentManager.disableEraseImage},setDisableEraseImage(p){Pt.logger.info(`[ApplianceSinglePlugin] setDisableEraseImage ${p}`),Pt.currentManager&&Bt.isRoom(t)&&(Pt.currentManager.disableEraseImage=p)},setWritable:async function(p){var T;Pt.logger.info(`[ApplianceSinglePlugin] setWritable ${p}`),Bt.isRoom(t)&&d&&(await((T=Pt.currentManager)==null?void 0:T.setWritable(p)),await d.call(t,p))},requestIdleCallback:(p,T)=>{const x=T?.timeout||0,y=performance.now();let C;const h=new MessageChannel;let g;const f=m=>{try{p({didTimeout:m,timeRemaining:()=>{const S=performance.now()-y;return Math.max(0,x-S)}})}catch(S){Pt.logger.error("[ApplianceSinglePlugin] requestIdleCallback error:",S)}finally{h.port1.close(),h.port2.close(),C!==void 0&&cancelAnimationFrame(C),g!==void 0&&clearTimeout(g)}};return h.port1.onmessage=()=>{C=requestAnimationFrame(()=>{x>0&&performance.now()-y>=x?f(!0):f(!1)})},h.port2.postMessage(null),x>0&&(g=setTimeout(()=>{f(!0)},x)),g||C||0},cancelIdleCallback:p=>{try{clearTimeout(p),cancelAnimationFrame(p)}catch(T){Pt.logger.error("[ApplianceSinglePlugin] cancelIdleCallback error:",T)}},injectMethodToObject:(p,T)=>{if(Pt.logger.info(`[ApplianceSinglePlugin] injectMethodToObject ${T}`),typeof p[T]=="function"||typeof p[T]>"u"){p[T]=c[T];return}T==="callbacks"&&(p.callbacks.on=c._callbacksOn.bind(c),p.callbacks.off=c._callbacksOff.bind(c),p.callbacks.once=c._callbacksOnce.bind(c))},blurText:()=>{Pt.logger.info("[ApplianceSinglePlugin] blurText"),Pt.currentManager&&Bt.isRoom(t)&&t.isWritable&&Pt.currentManager.textEditorManager.checkEmptyTextBlur()},hasElements:(p,T)=>{var x;if(Pt.logger.info(`[ApplianceSinglePlugin] hasElements ${p}`),Pt.currentManager&&Bt.isRoom(t)&&t.isWritable){let y=p;if(!y){const C=Pt.currentManager.viewContainerManager.focuedView;y=C?.focusScenePath}if(y){const C=(x=Pt.currentManager.collector)==null?void 0:x.getScenePathData(y);if(C){const h=Object.values(C);return h.length>0?T?h.some(g=>T(g.toolsType)):!0:!1}return!1}return!1}},getElements:(p,T)=>{var x;if(Pt.logger.info(`[ApplianceSinglePlugin] getElements ${p}`),Pt.currentManager&&Bt.isRoom(t)&&t.isWritable){let y=p;if(!y){const C=Pt.currentManager.viewContainerManager.focuedView;y=C?.focusScenePath}if(y){const C=(x=Pt.currentManager.collector)==null?void 0:x.getScenePathData(y),h=C&&Object.values(C)||[];return C&&h.length>0&&T?h.filter(g=>T(g.toolsType)):h}return[]}},stopDraw:p=>{if(Pt.logger.info(`[ApplianceSinglePlugin] stopDraw ${p}`),Pt.currentManager&&Bt.isRoom(t))return Pt.currentManager.stopDraw(p)}};c.injectMethodToObject(t,"undo"),c.injectMethodToObject(t,"redo"),c.injectMethodToObject(t,"cleanCurrentScene"),c.injectMethodToObject(t,"insertImage"),c.injectMethodToObject(t,"completeImageUpload"),c.injectMethodToObject(t,"lockImage"),c.injectMethodToObject(t,"getImagesInformation"),c.injectMethodToObject(t,"insertText"),c.injectMethodToObject(t,"updateText"),c.injectMethodToObject(t,"callbacks"),c.injectMethodToObject(t,"screenshotToCanvasAsync"),c.injectMethodToObject(t,"getBoundingRectAsync"),c.injectMethodToObject(t,"scenePreviewAsync"),c.injectMethodToObject(t,"fillSceneSnapshotAsync"),c.injectMethodToObject(t,"setMemberState"),Bt.isRoom(t)&&c.injectMethodToObject(t,"setWritable"),Object.defineProperty(t,"canUndoSteps",{get(){return c.canUndoSteps()}}),Object.defineProperty(t,"canRedoSteps",{get(){return c.canRedoSteps()}});const v={...c,callbacks:c.callbacks()};return Object.defineProperty(v,"disableDeviceInputs",{set(p){c.setDisableDeviceInputs(p)},get(){return c.getDisableDeviceInputs()}}),Object.defineProperty(v,"disableEraseImage",{set(p){c.setDisableEraseImage(p)},get(){return c.getDisableEraseImage()}}),Object.defineProperty(v,"disableCameraTransform",{set(p){c.setDisableCameraTransform(p)},get(){return c.getDisableCameraTransform()}}),t._appliancePlugin=v,t._appliancePlugin}static onCreate(t){t&&Pt.currentManager&&(Pt.currentManager.bindPlugin(t),t.init(t.displayer))}static async createAppliancePlugin(t,e){try{await t.createInvisiblePlugin(Pt,{})}catch(n){if(!t.isWritable){await t.setWritable(!0);const i=await this.createAppliancePlugin(t,e);return await t.setWritable(!1),i}throw n}let r=t.getInvisiblePlugin(e);return r||(r=await Pt.createAppliancePlugin(t,e)),r}static effectInstance(){if(Pt.cursorAdapter){const t=Pt.cursorAdapter.onAddedCursor;Pt.cursorAdapter.onAddedCursor=function(e){e.onCursorMemberChanged=r=>{try{r.appliance===Xt.pencil||r.appliance===Xt.shape||r.appliance===Xt.text||r.appliance===Xt.arrow||r.appliance===Xt.straight||r.appliance===Xt.rectangle||r.appliance===Xt.ellipse||r.appliance===Xt.eraser||r.appliance===Xt.selector?e!=null&&e.divElement&&(e.divElement.style.display="none"):e!=null&&e.divElement&&(e.divElement.style.display="block")}catch(n){throw n}},t.call(Pt.cursorAdapter,e)}}}get isReplay(){return Bt.isPlayer(this.displayer)}get callbackName(){return this.isReplay?"onPlayerStateChanged":"onRoomStateChanged"}init(t){var e,r;const n=t.state;(e=Pt.currentManager)==null||e.onRoomMembersChange(n.roomMembers),Bt.isRoom(t)&&n!=null&&n.memberState&&((r=Pt.currentManager)==null||r.onMemberChange(n.memberState)),this.displayer.callbacks.on(this.callbackName,this.roomStateChangeListener),this.displayer.callbacks.on("onEnableWriteNowChanged",this.updateRoomWritable),this.displayer.callbacks.on("onPhaseChanged",this.onPhaseChanged)}destroy(){var t;Pt.logger.info("[ApplianceSinglePlugin] passive destroy"),(t=Pt.currentManager)==null||t.destroy(),Pt.currentManager=void 0,Pt.cursorAdapter=void 0}};it(Xe,"kind","appliance-single-plugin"),it(Xe,"cursorAdapter"),it(Xe,"currentManager"),it(Xe,"logger",{info:console.log,warn:console.warn,error:console.error}),it(Xe,"createCurrentManager",(o,t,e)=>{Xe.currentManager&&Xe.currentManager.destroy();const r={plugin:e,displayer:o,options:t},n=new be(r);if(n.init(),Xe.logger.info("[ApplianceSinglePlugin] refresh ApplianceSingleManager object"),Xe.currentManager=n,Bt.isRoom(o)){const i=n.hasOffscreenCanvas,a=n.isUseOffscreenTransfer,s=n.pluginOptions,u=n.isUseSimple;o.logger.info(`[ApplianceSinglePlugin] use ${i?"worker":"mainThread"}, isUseSimple: ${u} ${a?"offscreenTransfer":""}, options: ${JSON.stringify(s)}`)}});const h1=class rn extends ot.Component{constructor(){super(...arguments),it(this,"mainViewRef",null)}componentDidMount(){rn.emiter||(rn.emiter=be.InternalMsgEmitter),rn.emiter.emit(Vt.BindMainView,this.mainViewRef)}render(){return ot.createElement(ot.Fragment,null,this.props.children,ot.createElement("div",{className:"appliance-plugin-main-view-displayer",ref:t=>this.mainViewRef=t}))}};it(h1,"emiter");const K1=Object.freeze(Object.defineProperty({__proto__:null,ApplianceMultiPlugin:PM,ApplianceNames:Xt,ECanvasShowType:Ve,EDataType:Ft,EForceStopReason:ii,EImageType:Dr,EMatrixrRelationType:Pr,EOperationType:Se,EPostMessageType:Rt,ERenderFilterType:je,EScaleType:Ne,EStrokeType:se,EToolsKey:ht,ElayerType:br,EmitEventType:jt,EventMessageType:Nr,EvevtWorkState:Et,InternalMsgEmitterType:Vt,ShapeType:Le},Symbol.toStringTag,{value:"Module"}));export{Lr as $,xr as A,Pr as B,ue as C,me as D,L1 as E,Dr as F,R1 as G,S1 as H,So as I,an as J,se as K,M1 as L,D1 as M,Os as N,Q1 as O,m1 as P,W1 as Q,jt as R,F1 as S,ht as T,Rt as U,Wt as V,mi as W,p1 as X,Lt as Y,nr as Z,C1 as _,Z1 as a,z1 as a0,B1 as a1,G1 as a2,H1 as a3,E1 as a4,y1 as a5,V1 as a6,k1 as a7,pi as a8,ao as a9,Fv as aa,P1 as ab,Xu as ac,nf as ad,X1 as ae,mn as af,jd as ag,K1 as ah,wr as b,v1 as c,si as d,N1 as e,b1 as f,k0 as g,ke as h,O1 as i,Ve as j,Ne as k,xv as l,x1 as m,Y1 as n,Qe as o,ne as p,Ft as q,Mn as r,j1 as s,wo as t,T1 as u,U1 as v,Qr as w,Et as x,I1 as y,w1 as z};
|