text: /*!
        * i2djs v3.6.0
        * (c) 2021 Narayana Swamy (narayanaswamy14@gmail.com)
        * @license BSD-3-Clause
        */
  let t=null,e=[];const i={},n=[];let r,o,s,a=[];function h(t,e,i){this.executable=e,this.duration=e.duration?e.duration:0,this.delay=e.delay?e.delay:0,this.lastTime=0-(e.delay?e.delay:0),this.loopTracker=0,this.loop=e.loop?e.loop:0,this.direction=e.direction,this.easying=i,this.end=e.end?e.end:null,"reverse"===this.direction?this.factor=1:this.factor=0}function c(){}"undefined"==typeof window&&(global.window={setTimeout:setTimeout,clearTimeout:clearTimeout},global.performance={now:function(){return Date.now()}},global.document={}),window.requestAnimationFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t,e){return window.setTimeout(t,1e3/60)},window.cancelAnimFrame=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||function(t){return window.clearTimeout(t)},h.prototype.execute=function(t){this.executable.run(t)},h.prototype.resetCallBack=function(t){"function"==typeof t&&(this.callBack=t)},c.prototype={startAnimeFrames:function(){r||(r=window.requestAnimationFrame(f))},stopAnimeFrame:function(){r&&(window.cancelAnimFrame(r),r=null)},add:function(t,i,n){const r=new h(t,i,n);r.currTime=performance.now(),i.target&&(i.target.animList||(i.target.animList=[]),i.target.animList[i.target.animList.length]=r),e[e.length]=r,this.startAnimeFrames()},remove:function(t){const i=e.indexOf(t);-1!==i&&e.splice(i,1)},onRequestFrame:function(t){if("function"!=typeof t)throw new Error("Wrong input");a.push(t),a.length>0&&!r&&this.startAnimeFrames()},removeRequestFrameCall:function(t){if("function"!=typeof t)throw new Error("Wrong input");const e=a.indexOf(t);-1!==e&&a.splice(e,1)},clearAll:function(){e=[],a=[]}},c.prototype.addVdom=function(t){const e=n.length+1;return i[e]=t,n.push(e),this.startAnimeFrames(),e},c.prototype.removeVdom=function(t){const r=n.indexOf(t);-1!==r&&(n.splice(r,1),i[t].root.destroy(),delete i[t]),0===n.length&&0===e.length&&0===a.length&&this.stopAnimeFrame()},c.prototype.vDomChanged=function(t){if(i[t]&&void 0!==i[t].stateModified)i[t].stateModified=!0,i[t].root.stateModified=!0;else if("string"==typeof t){const e=t.split(":");if(i[e[0]]&&void 0!==i[e[0]].stateModified){i[e[0]].stateModified=!0,i[e[0]].root.stateModified=!0;const t=i[e[0]].root.fetchEl("#"+e[1]);t&&(t.stateModified=!0)}}},c.prototype.execute=function(){this.startAnimeFrames()},c.prototype.vDomUpdates=function(){for(let t=0,e=n.length;t<e;t+=1)if(n[t]&&i[n[t]]&&i[n[t]].stateModified)i[n[t]].execute(),i[n[t]].stateModified=!1;else if(n[t]&&i[n[t]]&&i[n[t]].root&&"NODE"!==i[n[t]].root.ENV){document.getElementById(i[n[t]].root.container.id)||this.removeVdom(n[t])}};const l=Math.abs;let p=0,d=[];function f(){try{d=[],p=0,s=performance.now();for(let t=0;t<e.length;t+=1)o=e[t],o.lastTime+=s-o.currTime,o.currTime=s,o.lastTime<o.duration&&o.lastTime>=0?(o.execute(l(o.factor-o.easying(o.lastTime,o.duration))),d[p++]=o):o.lastTime>o.duration?u(o):d[p++]=o;e=d,a.length>0&&function(){for(let t=0;t<a.length;t+=1)a[t](s)}(),t.vDomUpdates()}catch(t){console.error(t)}finally{r=window.requestAnimationFrame(f)}}function u(t){if(t.loopTracker>=t.loop-1){if(t.execute(1-t.factor),t.end&&t.end(),t.executable.target){const e=t.executable.target.animList;if(e&&e.length>0)if(1===e.length)t.executable.target.animList=[];else if(e.length>1){const i=e.indexOf(t);-1!==i&&e.splice(i,1)}}}else t.loopTracker+=1,t.lastTime=t.lastTime-t.duration,t.lastTime=t.lastTime%t.duration,"alternate"===t.direction?t.factor=1-t.factor:"reverse"===t.direction?t.factor=1:t.factor=0,t.execute(l(t.factor-t.easying(t.lastTime,t.duration))),d[p++]=t}t=new c;var y=t;function x(){}function m(t,e){let i=0,n=0,r=1,o=1;const s=e;if(t.attr.transform&&t.attr.transform.translate&&([i,n]=t.attr.transform.translate,s.x-=i,s.y-=n),t.attr.transform&&t.attr.transform.scale&&(r=void 0!==t.attr.transform.scale[0]?t.attr.transform.scale[0]:1,o=void 0!==t.attr.transform.scale[1]?t.attr.transform.scale[1]:r,s.x/=r,s.y/=o),t.attr.transform&&t.attr.transform.rotate){const e=t.attr.transform.rotate[0],i={x:t.attr.transform.rotate[1],y:t.attr.transform.rotate[2]},n=s.x,r=s.y,o=i.x,l=i.y;var a=Math.PI/180*e,h=Math.cos(a),c=Math.sin(a);s.x=h*(n-o)+c*(r-l)+o,s.y=h*(r-l)-c*(n-o)+l}}x.prototype.execute=function(){this.root.execute(),this.stateModified=!1},x.prototype.rootNode=function(t){this.root=t,this.stateModified=!0},x.prototype.eventsCheck=function(t,e,i){const n=this;let r,o;for(var s=0;s<=t.length-1;s+=1){var a=t[s],h={x:e.x,y:e.y};m(a,h),a.in({x:h.x,y:h.y})&&(a.children&&a.children.length>0?(o=n.eventsCheck(a.children,{x:h.x,y:h.y},i),o&&(r=o)):r=a)}return r},x.prototype.transformCoOr=m;const g=Math.sqrt,v=Math.sin,b=Math.cos,w=Math.abs,B=Math.atan2,A=Math.tan,T=Math.PI,k=Math.ceil,E=Math.max;function S(t,e){let i=1;if(0===e)return i;for(let n=1;n<=e;n+=1)i*=t;return i}function C(t,e){let i=0;for(const n in t)i+=S(e[n]-t[n],2);if(isNaN(i))throw new Error("error");return g(i)}function D(t,e,i){const n=S(i,3),r=S(i,2);return{x:e.ax*n+e.bx*r+e.cx*i+t.x,y:e.ay*n+e.by*r+e.cy*i+t.y}}const M=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){const i=[];let n,r=!0,o=!1;try{for(var s,a=t[Symbol.iterator]();!(r=(s=a.next()).done)&&(i.push(s.value),!e||i.length!==e);r=!0);}catch(t){o=!0,n=t}finally{try{!r&&a.return&&a.return()}finally{o&&console.log("Error -"+n)}}return i}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},_=2*T,z=function(t,e,i,n,r,o,s){let{x:a,y:h}=t;a*=e,h*=i;return{x:n*a-r*h+o,y:r*a+n*h+s}},I=function(t,e){const i=4/3*A(e/4),n=b(t),r=v(t),o=b(t+e),s=v(t+e);return[{x:n-r*i,y:r+n*i},{x:o+s*i,y:s-o*i},{x:o,y:s}]},P=function(t,e,i,n){const r=t*n-e*i<0?-1:1;let o=(t*i+e*n)/(g(t*t+e*e)*g(t*t+e*e));return o>1&&(o=1),o<-1&&(o=-1),r*Math.acos(o)};function O(t,e,i,n){const r=t.x,o=t.y,s=e.x,a=e.y;var h=T/180*i,c=b(-h),l=v(-h);return{x:c*(r-s)+l*(o-a)+s,y:c*(o-a)-l*(r-s)+a}}function L(){}L.prototype={pow:S,getAngle:function(t,e){return B(e.x-t.x,e.y-t.y)},getDistance:C,scaleAlongOrigin:function(t,e){const i={};for(const n in t)i[n]=t[n]*e;return i},scaleAlongPoint:function(t,e,i){const n=(t.y-e.y)/(t.x-e.x),r=t.x*i;return{x:r,y:(n*(r-e.x)+e.y)*i}},linearTransitionBetweenPoints:function(t,e,i){return{x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i}},bezierTransition:function(t,e,i,n){return{x:(t.x-2*e.x+i.x)*n*n+(2*e.x-2*t.x)*n+t.x,y:(t.y-2*e.y+i.y)*n*n+(2*e.y-2*t.y)*n+t.y}},bezierLength:function(t,e,i){const n={},r={};n.x=t.x+i.x-2*e.x,n.y=t.y+i.y-2*e.y,r.x=2*e.x-2*t.x,r.y=2*e.y-2*t.y;const o=4*(n.x*n.x+n.y*n.y),s=4*(n.x*r.x+n.y*r.y),a=r.x*r.x+r.y*r.y,h=2*g(o+s+a),c=g(o),l=2*o*c,p=2*g(a),d=s/c;let f=(2*c+d+h)/(d+p);return f=isNaN(f)||w(f)===1/0?1:f,(l*h+c*s*(h-p)+(4*a*o-s*s)*Math.log(f))/(4*l)},cubicBezierTransition:D,cubicBezierLength:function(t,e){const i=.001;let n=0;const r=D.bind(null,t,e);let o,s;for(let t=0;t<=1;t+=i)o=r(t),s=r(t+i),n+=g(S((s.x-o.x)/i,2)+S((s.y-o.y)/i,2))*i;return n},cubicBezierCoefficients:function(t){const e=3*(t.cntrl1.x-t.p0.x),i=3*(t.cntrl2.x-t.cntrl1.x)-e,n=t.p1.x-t.p0.x-e-i,r=3*(t.cntrl1.y-t.p0.y),o=3*(t.cntrl2.y-t.cntrl1.y)-r;return{cx:e,bx:i,ax:n,cy:r,by:o,ay:t.p1.y-t.p0.y-r-o}},arcToBezier:function(t){let{px:e,py:i,cx:n,cy:r,rx:o,ry:s}=t;const a=t.xAxisRotation,h=void 0===a?0:a,c=t.largeArcFlag,l=void 0===c?0:c,p=t.sweepFlag,d=void 0===p?0:p,f=[];if(0===o||0===s)return[];const u=v(h*_/360),y=b(h*_/360),x=y*(e-n)/2+u*(i-r)/2,m=-u*(e-n)/2+y*(i-r)/2;if(0===x&&0===m)return[];o=w(o),s=w(s);const B=S(x,2)/S(o,2)+S(m,2)/S(s,2);B>1&&(o*=g(B),s*=g(B));const A=function(t,e,i,n,r,o,s,a,h,c,l,p){const d=S(r,2),f=S(o,2),u=S(l,2),y=S(p,2);let x=d*f-d*y-f*u;x<0&&(x=0),x/=d*y+f*u,x=g(x)*(s===a?-1:1);const m=x*r/o*p,v=x*-o/r*l,b=c*m-h*v+(t+i)/2,w=h*m+c*v+(e+n)/2,B=(l-m)/r,A=(p-v)/o,T=(-l-m)/r,k=(-p-v)/o,E=P(1,0,B,A);let C=P(B,A,T,k);return 0===a&&C>0&&(C-=_),1===a&&C<0&&(C+=_),[b,w,E,C]}(e,i,n,r,o,s,l,d,u,y,x,m),T=M(A,4),C=T[0],D=T[1];let O=T[2],L=T[3];const N=E(k(w(L)/(_/4)),1);L/=N;for(let t=0;t<N;t++)f.push(I(O,L)),O+=L;return f.map((t=>{const e=z(t[0],o,s,y,u,C,D),i=e.x,n=e.y,r=z(t[1],o,s,y,u,C,D),a=r.x,h=r.y,c=z(t[2],o,s,y,u,C,D);return{x1:i,y1:n,x2:a,y2:h,x:c.x,y:c.y}}))},intermediateValue:function(t,e,i){return t+(e-t)*i},toCubicCurves:function(t){if(!t.length)return;const e=t,i=[];for(let t=0;t<e.length;t+=1)if(-1!==["M","C","S","Q"].indexOf(e[t].type))i.push(e[t]);else if(-1!==["V","H","L","Z"].indexOf(e[t].type)){const n={x:(e[t].p0.x+e[t].p1.x)/2,y:(e[t].p0.y+e[t].p1.y)/2};i.push({p0:e[t].p0,cntrl1:n,cntrl2:n,p1:e[t].p1,type:"C",length:e[t].length})}else console.log("wrong cmd type");return i},rotatePoint:O,rotateBBox:function(t,e){let i={x:t.x,y:t.y},n={x:t.x+t.width,y:t.y},r={x:t.x,y:t.y+t.height},o={x:t.x+t.width,y:t.y+t.height};const{translate:s,rotate:a}=e,h={x:a[1]||0,y:a[2]||0},c=a[0];s&&s.length>0&&(h.x+=s[0],h.y+=s[1]),i=O(i,h,c,C(i,h)),n=O(n,h,c,C(n,h)),r=O(r,h,c,C(r,h)),o=O(o,h,c,C(o,h));const l=[i.x,n.x,r.x,o.x].sort(((t,e)=>t-e)),p=[i.y,n.y,r.y,o.y].sort(((t,e)=>t-e));return{x:l[0],y:p[0],width:l[3]-l[0],height:p[3]-p[0]}}};var N=new L;const F=N;function R(t,e){return t/e}function j(t,e){const i=t/e;return 1-(1-i)*Math.sin(i*e*.002*Math.PI*2+Math.PI/2)/Math.exp(8*i)}function X(t,e){const i=t/e,n=i/100;return 1-(1-i)*Math.abs(Math.sin(i*e*n*Math.PI*2+Math.PI/2))/Math.exp(10*i)}function G(t,e){const i=t/e;return i*i}function Y(t,e){const i=t/e;return i*(2-i)}function U(t,e){const i=t/e;return i<.5?2*i*i:(4-2*i)*i-1}function H(t,e){const i=t/e;return F.pow(i,3)}function V(t,e){let i=t/e;return i-=1,i*i*i+1}function q(t,e){const i=t/e;return i<.5?4*F.pow(i,3):(i-1)*(2*i-2)*(2*i-2)+1}function Z(t,e){const i=t/e;return 1-Math.cos(i*Math.PI/2)}function W(t,e){const i=t/e;return Math.cos(i*Math.PI/2)}function $(t,e){const i=t/e;return(1-Math.cos(Math.PI*i))/2}function Q(t){let e;if("function"==typeof t)return function(e,i){return t(e/i)};switch(t){case"easeOutQuad":e=Y;break;case"easeInQuad":e=G;break;case"easeInOutQuad":e=U;break;case"easeInCubic":e=H;break;case"easeOutCubic":e=V;break;case"easeInOutCubic":e=q;break;case"easeInSin":e=Z;break;case"easeOutSin":e=W;break;case"easeInOutSin":e=$;break;case"bounce":e=X;break;case"linear":e=R;break;case"elastic":e=j;break;default:e=R}return e}let J=0,K=0;function tt(){return J+=1,J}function et(){return K+=1,K}const it=Q;function nt(t){return this.easying=it(t),this.transition=t,this}function rt(t){if(1!==arguments.length)throw new Error("arguments mis match");return this.durationP=t,this}function ot(t){if(1!==arguments.length)throw new Error("arguments mis match");return this.loopValue=t,this}function st(t){if(1!==arguments.length)throw new Error("arguments mis match");return this.directionV=t,this}function at(t){if(1!==arguments.length)throw new Error("arguments mis match");return this.data=t,"CANVAS"===this.data.nodeName&&(this.canvasStack=[]),this}function ht(t){return"function"!=typeof t?null:(this.callbckExe=t,this)}function ct(t){return this.end=t,this}function lt(t){return this.endExe=t,this}function pt(){this.start()}function dt(){this.queue=y,this.sequenceQueue=[],this.lengthV=0,this.currPos=0,this.ID=tt(),this.loopCounter=0}function ft(){this.queue=y,this.group=[],this.currPos=0,this.ID=tt(),this.loopCounter=1}dt.prototype={duration:rt,loop:ot,callbck:ht,bind:at,child:ct,ease:nt,end:lt,commit:pt,reset:function(t){return this.resetV=t,this},direction:st},dt.prototype.add=function(t){const e=this;return Array.isArray(t)||"function"==typeof t||(t=[t]),Array.isArray(t)&&t.map((t=>(e.lengthV+=t.length?t.length:0,t))),this.sequenceQueue=this.sequenceQueue.concat(t),this},dt.prototype.easyingGlobal=function(t,e){return t/e},dt.prototype.start=function(){const t=this;if("alternate"===t.directionV)t.factor=t.factor?-1*t.factor:1,t.currPos=t.factor<0?this.sequenceQueue.length-1:0;else if("reverse"===t.directionV){for(let e=0;e<this.sequenceQueue.length;e+=1){const i=this.sequenceQueue[e];i instanceof dt||i instanceof ft||i.run(1),t.currPos=e}t.factor=-1}else t.currPos=0,t.factor=1;this.execute()},dt.prototype.execute=function(){const t=this;let e=this.sequenceQueue[t.currPos];if(e="function"==typeof e?e():e,e)return e instanceof dt||e instanceof ft?e.end(t.triggerEnd.bind(t,e)).commit():(this.currObj=e,this.queue.add(et(),{run(t){e.run(t)},target:e.target,delay:void 0!==e.delay?e.delay:0,duration:void 0!==e.duration?e.duration:t.durationP,loop:e.loop?e.loop:1,direction:t.factor<0?"reverse":"default",end:t.triggerEnd.bind(t,e)},((t,e)=>t/e))),this},dt.prototype.triggerEnd=function(t){const e=this;if(e.currPos+=e.factor,t.end&&e.triggerChild(t),e.sequenceQueue.length===e.currPos||e.currPos<0)return e.endExe&&e.endExe(),e.loopCounter+=1,void(e.loopCounter<e.loopValue&&e.start());this.execute()},dt.prototype.triggerChild=function(t){t.end instanceof ft||t.end instanceof dt?setTimeout((()=>{t.end.commit()}),0):t.end()},ft.prototype={duration:rt,loop:ot,callbck:ht,bind:at,child:ct,ease:nt,end:lt,commit:pt,direction:st},ft.prototype.add=function(t){const e=this;return Array.isArray(t)||(t=[t]),this.group=this.group.concat(t),this.group.forEach((t=>{t.durationP=t.durationP?t.durationP:e.durationP})),this},ft.prototype.execute=function(){const t=this;t.currPos=0;for(let e=0,i=t.group.length;e<i;e++){const i=t.group[e];i instanceof dt||i instanceof ft?i.end(t.triggerEnd.bind(t,i)).commit():t.queue.add(et(),{run(t){i.run(t)},target:i.target,delay:void 0!==i.delay?i.delay:0,duration:void 0!==i.duration?i.duration:t.durationP,loop:i.loop?i.loop:1,direction:i.direction?i.direction:"default",end:t.triggerEnd.bind(t,i)},i.ease?it(i.ease):t.easying)}return t},ft.prototype.start=function(){const t=this;"alternate"===t.directionV?t.factor=t.factor?-1*t.factor:1:"reverse"===t.directionV?t.factor=-1:t.factor=1,this.execute()},ft.prototype.triggerEnd=function(t){const e=this;this.currPos+=1,t.end&&this.triggerChild(t.end),this.currPos===this.group.length&&(this.endExe&&this.triggerChild(this.endExe),e.loopCounter+=1,e.loopCounter<e.loopValue&&e.start())},ft.prototype.triggerChild=function(t){t instanceof ft||t instanceof dt?t.commit():"function"==typeof t?t():console.log("wrong type")};var ut={sequenceChain:function(){return new dt},parallelChain:function(){return new ft}};let yt=0;const xt=N,mt=y,gt=Q;function vt(t,e,i,n){let{minX:r,minY:o,maxX:s,maxY:a}=i;if(-1!==["V","H","L","v","h","l"].indexOf(t.type))[t.p0?t.p0:e.p1,t.p1].forEach((function(t){t.x<r&&(r=t.x),t.x>s&&(s=t.x),t.y<o&&(o=t.y),t.y>a&&(a=t.y)}));else if(-1!==["Q","C","q","c"].indexOf(t.type)){const e=xt.cubicBezierCoefficients(t),i=xt.cubicBezierTransition.bind(null,t.p0,e);let n,h=0;for(;h<1;)n=i(h),h+=.05,n.x<r&&(r=n.x),n.x>s&&(s=n.x),n.y<o&&(o=n.y),n.y>a&&(a=n.y)}else{const e=t.p0;e.x<r&&(r=e.x),e.x>s&&(s=e.x),e.y<o&&(o=e.y),e.y>a&&(a=e.y)}i.minX=r,i.minY=o,i.maxX=s,i.maxY=a,n.x=r,n.y=o,n.width=s-r,n.height=a-o}function bt(t,e){return{x:t.x+e.x,y:t.y+e.y}}function wt(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Bt(t,e,i){return t?i:e}function At(t){this.stack=[],this.length=0,this.stackGroup=[],this.BBox={x:0,y:0,width:0,height:0},this.minMax={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},t&&this.parse(t)}function Tt(t){return["S","C","V","L","H","Q"].indexOf(t)>-1}At.prototype={z:function(){return this.cp=this.start,this.segmentLength=xt.getDistance(this.pp,this.cp),this.stack.push({p0:this.pp,p1:this.cp,type:"Z",length:this.segmentLength,pointAt(t){return xt.linearTransitionBetweenPoints(this.p0,this.p1,t)}}),this.length+=this.segmentLength,this.pp=this.cp,vt(this.stack[this.stack.length-1],this.stack[this.stack.length-2],this.minMax,this.BBox),this},m:function(t,e){const i=Bt(t,this.pp?this.pp:{x:0,y:0},{x:0,y:0});return this.cntrl=null,this.cp=bt(e,i),this.start=this.cp,this.segmentLength=0,this.length=this.segmentLength,0!==this.currPathArr&&this.pp?(this.stackGroup.push(this.stack),this.stack=[]):this.stackGroup.push(this.stack),this.stack.push({type:"M",p0:this.cp,length:this.segmentLength,pointAt(t){return this.p0}}),this.pp=this.cp,vt(this.stack[this.stack.length-1],this.stack[this.stack.length-2],this.minMax,this.BBox),this},v:function(t,e){const i=Bt(t,this.pp,{x:this.pp.x,y:0});return this.cntrl=null,this.cp=bt(e,i),this.segmentLength=xt.getDistance(this.pp,this.cp),this.stack.push({type:"V",p0:this.pp,p1:this.cp,length:this.segmentLength,pointAt(t){return xt.linearTransitionBetweenPoints(this.p0,this.p1,t)}}),this.length+=this.segmentLength,this.pp=this.cp,vt(this.stack[this.stack.length-1],this.stack[this.stack.length-2],this.minMax,this.BBox),this},h:function(t,e){const i=Bt(t,this.pp,{x:0,y:this.pp.y});return this.cp=bt(e,i),this.cntrl=null,this.segmentLength=xt.getDistance(this.pp,this.cp),this.stack.push({type:t?"H":"h",p0:this.pp,p1:this.cp,length:this.segmentLength,relative:{p1:e},pointAt(t){return xt.linearTransitionBetweenPoints(this.p0,this.p1,t)}}),this.length+=this.segmentLength,this.pp=this.cp,vt(this.stack[this.stack.length-1],this.stack[this.stack.length-2],this.minMax,this.BBox),this},l:function(t,e){const i=Bt(t,this.pp,{x:0,y:0});return this.cntrl=null,this.cp=bt(e,i),this.segmentLength=xt.getDistance(this.pp,this.cp),this.stack.push({type:t?"L":"l",p0:this.pp,p1:this.cp,relative:{p1:e},length:this.segmentLength,pointAt(t){return xt.linearTransitionBetweenPoints(this.p0,this.p1,t)}}),this.length+=this.segmentLength,this.pp=this.cp,vt(this.stack[this.stack.length-1],this.stack[this.stack.length-2],this.minMax,this.BBox),this},q:function(t,e,i){const n=Bt(t,this.pp,{x:0,y:0}),r=bt(e,n),o=bt(i,n);return this.cp=o,this.segmentLength=xt.bezierLength(this.pp,r,this.cp),this.cp=o,this.stack.push({type:t?"Q":"q",p0:this.pp,cntrl1:r,cntrl2:r,p1:this.cp,relative:{cntrl1:e,p1:i},length:this.segmentLength,pointAt(t){return xt.bezierTransition(this.p0,this.cntrl1,this.p1,t)}}),this.length+=this.segmentLength,this.pp=this.cp,this.cntrl=r,vt(this.stack[this.stack.length-1],this.stack[this.stack.length-2],this.minMax,this.BBox),this},s:function(t,e,i){const n=Bt(t,this.pp,{x:0,y:0}),r=bt(e,n),o=this.cntrl?bt(this.pp,wt(this.pp,this.cntrl?this.cntrl:this.pp)):r,s=bt(i,n);this.cp=s;const a=xt.cubicBezierCoefficients({p0:this.pp,cntrl1:o,cntrl2:r,p1:s});return this.segmentLength=xt.cubicBezierLength(this.pp,a),this.stack.push({type:t?"S":"s",p0:this.pp,cntrl1:o,cntrl2:r,p1:this.cp,co:a,length:this.segmentLength,relative:{cntrl2:e,p1:i},pointAt(t){return xt.cubicBezierTransition(this.p0,this.co,t)}}),vt(this.stack[this.stack.length-1],this.stack[this.stack.length-2],this.minMax,this.BBox),this.length+=this.segmentLength,this.pp=this.cp,this.cntrl=r,this},c:function(t,e,i,n){const r=this,o=Bt(t,this.pp,{x:0,y:0}),s=bt(e,o),a=bt(i,o),h=bt(n,o),c=xt.cubicBezierCoefficients({p0:this.pp,cntrl1:s,cntrl2:a,p1:h});return this.cntrl=a,this.cp=h,this.segmentLength=xt.cubicBezierLength(this.pp,c),this.stack.push({type:t?"C":"c",p0:this.pp,cntrl1:s,cntrl2:a,p1:this.cp,length:this.segmentLength,co:c,relative:{cntrl1:e,cntrl2:i,p1:n},pointAt(t){return xt.cubicBezierTransition(this.p0,this.co,t)}}),this.length+=this.segmentLength,this.pp=this.cp,vt(r.stack[r.stack.length-1],r.stack[r.stack.length-2],r.minMax,r.BBox),this},a:function(t,e,i,n,r,o,s){const a=Bt(t,this.pp,{x:0,y:0}),h=this,c=bt(s,a);this.cp=c;const l=xt.arcToBezier({px:this.pp.x,py:this.pp.y,cx:c.x,cy:c.y,rx:e,ry:i,xAxisRotation:n,largeArcFlag:r,sweepFlag:o});return l.forEach(((t,e)=>{const i=0===e?h.pp:{x:l[0].x,y:l[0].y},n={x:t.x1,y:t.y1},r={x:t.x2,y:t.y2},o={x:t.x,y:t.y},s=xt.cubicBezierLength(i,xt.cubicBezierCoefficients({p0:i,cntrl1:n,cntrl2:r,p1:o}));h.stack.push({type:"C",p0:i,cntrl1:n,cntrl2:r,p1:o,length:s,pointAt(t){return xt.bezierTransition(this.p0,this.cntrl1,this.cntrl2,this.p1,t)}}),h.length+=s,vt(h.stack[h.stack.length-1],h.stack[h.stack.length-2],h.minMax,h.BBox)})),this.pp=this.cp,this.cntrl=null,this},fetchXY:function(){return{x:parseFloat(this.pathArr[this.currPathArr+=1]),y:parseFloat(this.pathArr[this.currPathArr+=1])}}},At.prototype.points=function(t){if(void 0===this.f&&(this.f=.3),void 0===this.t&&(this.t=.6),0===t.length)return;this.m(!0,{x:t[0].x,y:t[0].y});var e=0,i=0,n=0;let r=0,o=0;for(var s=t[0],a=1;a<t.length;a++){var h=t[a],c=t[a+1];r=0,o=0,c&&(e=(c.y-s.y)/(c.x-s.x),r=(c.x-h.x)*-this.f,o=r*e*this.t),this.c(!0,{x:s.x-i,y:s.y-n},{x:h.x+r,y:h.y+o},{x:h.x,y:h.y}),i=r,n=o,s=h}},At.prototype.curveFfactor=function(t){this.f=t},At.prototype.curveTfactor=function(t){this.t=t},At.prototype.parse=function(t){for(this.path=t,this.currPathArr=-1,this.stack=[],this.length=0,this.pathArr=function(t){let e=t.replace(/e-/g,"$");e=e.replace(/ /g,","),e=e.replace(/-/g,",-"),e=e.split(/([a-zA-Z,])/g).filter((t=>""!==t&&","!==t)).map((t=>t.replace(/\$/g,"e-")));for(let t=0;t<e.length;t+=1)if(e[t].split(".").length>2){const i=e[t].split("."),n=[`${i[0]}.${i[1]}`];for(let t=2;t<i.length;t+=1)n.push("."+i[t]);e.splice(t,1,n[0],n[1])}return e}(this.path),this.stackGroup=[];this.currPathArr<this.pathArr.length-1;)this.case(this.pathArr[this.currPathArr+=1]);return this.stack},At.prototype.fetchPathString=function(){let t,e="";for(let i=0;i<this.stack.length;i++)t=this.stack[i],"M"===t.type||"m"===t.type?e+=t.type+" "+t.p0.x+","+t.p0.y+" ":"Z"===t.type||"z"===t.type?e+="z":"C"===t.type?e+=t.type+" "+t.cntrl1.x+","+t.cntrl1.y+" "+t.cntrl2.x+","+t.cntrl2.y+" "+t.p1.x+","+t.p1.y+" ":"c"===t.type?e+=t.type+" "+t.relative.cntrl1.x+","+t.relative.cntrl1.y+" "+t.relative.cntrl2.x+","+t.relative.cntrl2.y+" "+t.relative.p1.x+","+t.relative.p1.y+" ":"Q"===t.type?e+=t.type+" "+t.cntrl1.x+","+t.cntrl1.y+" "+t.p1.x+","+t.p1.y+" ":"q"===t.type?e+=t.type+" "+t.relative.cntrl1.x+","+t.relative.cntrl1.y+" "+t.relative.p1.x+","+t.relative.p1.y+" ":"S"===t.type?e+=t.type+" "+t.cntrl2.x+","+t.cntrl2.y+" "+t.p1.x+","+t.p1.y+" ":"s"===t.type?e+=t.type+" "+t.relative.cntrl2.x+","+t.relative.cntrl2.y+" "+t.relative.p1.x+","+t.relative.p1.y+" ":"V"===t.type?e+=t.type+" "+t.p1.y+" ":"v"===t.type?e+=t.type+" "+t.relative.p1.y+" ":"H"===t.type?e+=t.type+" "+t.p1.x+" ":"h"===t.type?e+=t.type+" "+t.relative.p1.x+" ":"L"===t.type?e+=t.type+" "+t.p1.x+","+t.p1.y+" ":"l"===t.type&&(e+=t.type+" "+t.relative.p1.x+","+t.relative.p1.y+" ");return e},At.prototype.getTotalLength=function(){return this.length},At.prototype.getAngleAtLength=function(t,e){if(t>this.length)return null;const i=this.getPointAtLength(t),n=this.getPointAtLength(t+("src"===e?-1*t*.01:.01*t));return Math.atan2(n.y-i.y,n.x-i.x)},At.prototype.getPointAtLength=function(t){let e={x:0,y:0},i=t;return this.stack.every(((t,n)=>(i-=t.length,Math.floor(i)>=0||(e=t.pointAt((t.length+i)/(0===t.length?1:t.length)),!1)))),e},At.prototype.execute=function(t,e){let i;e||t.beginPath();for(let e=0;e<this.stack.length;e++)switch(i=this.stack[e],i.type){case"M":case"m":t.moveTo(i.p0.x,i.p0.y);break;case"Z":case"z":t.lineTo(i.p1.x,i.p1.y);break;case"L":case"l":case"V":case"v":case"H":case"h":t.lineTo(i.p1.x,i.p1.y);break;case"C":case"c":case"S":case"s":t.bezierCurveTo(i.cntrl1.x,i.cntrl1.y,i.cntrl2.x,i.cntrl2.y,i.p1.x,i.p1.y);break;case"Q":case"q":t.quadraticCurveTo(i.cntrl1.x,i.cntrl1.y,i.p1.x,i.p1.y)}e||t.closePath()},At.prototype.getPoints=function(t=.01){const e=[];let i;for(let t=0;t<this.stack.length;t++){i=this.stack[t];const n=.05;let r=0;switch(i.type){case"M":case"m":e[e.length]=i.p0.x,e[e.length]=i.p0.y;break;case"Z":case"z":e[e.length]=i.p1.x,e[e.length]=i.p1.y;break;case"L":case"l":case"V":case"v":case"H":case"h":e[e.length]=i.p1.x,e[e.length]=i.p1.y;break;case"C":case"c":case"S":case"s":case"Q":case"q":for(;r<=1;){const t=i.pointAt(r);e[e.length]=t.x,e[e.length]=t.y,r+=n}}}return e},At.prototype.case=function(t){let e,i,n,r,o,s=t;switch(-1!==["m","M","v","V","l","L","h","H","q","Q","c","C","s","S","a","A","z","Z"].indexOf(s)?this.PC=s:(s=this.PC,this.currPathArr=this.currPathArr-1),s){case"m":this.m(!1,this.fetchXY());break;case"M":this.m(!0,this.fetchXY());break;case"v":this.v(!1,{x:0,y:parseFloat(this.pathArr[this.currPathArr+=1])});break;case"V":this.v(!0,{x:0,y:parseFloat(this.pathArr[this.currPathArr+=1])});break;case"l":this.l(!1,this.fetchXY());break;case"L":this.l(!0,this.fetchXY());break;case"h":this.h(!1,{x:parseFloat(this.pathArr[this.currPathArr+=1]),y:0});break;case"H":this.h(!0,{x:parseFloat(this.pathArr[this.currPathArr+=1]),y:0});break;case"q":this.q(!1,this.fetchXY(),this.fetchXY());break;case"Q":this.q(!0,this.fetchXY(),this.fetchXY());break;case"c":this.c(!1,this.fetchXY(),this.fetchXY(),this.fetchXY());break;case"C":this.c(!0,this.fetchXY(),this.fetchXY(),this.fetchXY());break;case"s":this.s(!1,this.fetchXY(),this.fetchXY());break;case"S":this.s(!0,this.fetchXY(),this.fetchXY());break;case"a":e=parseFloat(this.pathArr[this.currPathArr+=1]),i=parseFloat(this.pathArr[this.currPathArr+=1]),n=parseFloat(this.pathArr[this.currPathArr+=1]),r=parseFloat(this.pathArr[this.currPathArr+=1]),o=parseFloat(this.pathArr[this.currPathArr+=1]),this.a(!1,e,i,n,r,o,this.fetchXY());break;case"A":e=parseFloat(this.pathArr[this.currPathArr+=1]),i=parseFloat(this.pathArr[this.currPathArr+=1]),n=parseFloat(this.pathArr[this.currPathArr+=1]),r=parseFloat(this.pathArr[this.currPathArr+=1]),o=parseFloat(this.pathArr[this.currPathArr+=1]),this.a(!0,e,i,n,r,o,this.fetchXY());break;case"z":case"Z":this.z()}};const kt=function(t,e,i,n,r,o){this.type=t,this.p0=e,this.c1_src=i,this.c2_src=n,this.co=r,this.length_src=o};kt.prototype.execute=function(t){const e=this.co,i=this.p0,n=this.c1_src,r=this.c2_src,o={x:i.x+(n.x-i.x)*t,y:i.y+(n.y-i.y)*t},s=n.x+(r.x-n.x)*t,a=n.y+(r.y-n.y)*t;return this.cntrl1=o,this.cntrl2={x:o.x+(s-o.x)*t,y:o.y+(a-o.y)*t},this.p1={x:e.ax*xt.pow(t,3)+e.bx*xt.pow(t,2)+e.cx*t+i.x,y:e.ay*xt.pow(t,3)+e.by*xt.pow(t,2)+e.cy*t+i.y},this.length=this.length_src*t,this.relative={cntrl1:Tt(this.type)?this.cntrl1:wt(this.cntrl1,this.p0),cntrl2:Tt(this.type)?this.cntrl2:wt(this.cntrl2,this.p0),p1:Tt(this.type)?this.p1:wt(this.p1,this.p0)},this},kt.prototype.pointAt=function(t){return xt.cubicBezierTransition(this.p0,this.co,t)};const Et=function(t,e,i,n,r,o){this.type=t,this.p0=e,this.p1_src=i,this.p2_src=n,this.length_src=r,this.length=0};Et.prototype.execute=function(t){const e=this.p0,i=this.p1_src,n=this.p2_src;return this.length=this.length_src*t,this.cntrl1={x:e.x+(i.x-e.x)*t,y:e.y+(i.y-e.y)*t},this.cntrl2=this.cntrl1,this.p1={x:(e.x-2*i.x+n.x)*t*t+(2*i.x-2*e.x)*t+e.x,y:(e.y-2*i.y+n.y)*t*t+(2*i.y-2*e.y)*t+e.y},this.relative={cntrl1:Tt(this.type)?this.cntrl1:wt(this.cntrl1,this.p0),p1:Tt(this.type)?this.p1:wt(this.p1,this.p0)},this},Et.prototype.pointAt=function(t){return xt.bezierTransition(this.p0,this.cntrl1,this.p1,t)};const St=function(t,e,i,n,r){this.type=t,this.p0=e,this.p1=e,this.p2_src=i,this.length_src=n,this.length=0};function Ct(t){return t instanceof At}St.prototype.execute=function(t){const e=this.p0,i=this.p2_src;return this.p1={x:e.x+(i.x-e.x)*t,y:e.y+(i.y-e.y)*t},this.length=this.length_src*t,this.relative={p1:Tt(this.type)?this.p1:wt(this.p1,this.p0)},this},St.prototype.pointAt=function(t){return xt.linearTransitionBetweenPoints(this.p0,this.p1,t)};var Dt={instance:function(t){return new At(t)},isTypePath:Ct,animatePathTo:function(t){const e=this,{duration:i,ease:n,end:r,loop:o,direction:s,d:a}=t,h=a||e.attr.d;let c=0;if(e.arrayStack=[],!h)throw Error("Path Not defined");const l=ut.sequenceChain(),p=Ct(h)?h:new At(h),d=p.stackGroup.reduce(((t,e)=>t=t.concat(e)),[]),f=[];for(let t=0;t<d.length;t+=1)if("Z"===d[t].type||"z"===d[t].type)f.push({run(t){p.stack.length=this.id+1,p.stack[this.id]=this.render.execute(t),e.setAttr("d",p)},target:e,id:t,render:new St(d[t].type,d[t].p0,d[0].p0,d[t].segmentLength),length:d[t].length}),c+=0;else if(-1!==["V","v","H","h","L","l"].indexOf(d[t].type))f.push({run(t){p.stack.length=this.id+1,p.stack[this.id]=this.render.execute(t),e.setAttr("d",p)},target:e,id:t,render:new St(d[t].type,d[t].p0,d[t].p1,d[t].length),length:d[t].length}),c+=d[t].length;else if("Q"===d[t].type||"q"===d[t].type)f.push({run(t){p.stack.length=this.id+1,p.stack[this.id]=this.render.execute(t),e.setAttr("d",p)},target:e,id:t,render:new Et(d[t].type,d[t].p0,d[t].cntrl1,d[t].p1,d[t].length),length:d[t].length}),c+=d[t].length;else if("C"===d[t].type||"S"===d[t].type||"c"===d[t].type||"s"===d[t].type){const i=xt.cubicBezierCoefficients(d[t]);f.push({run(t){p.stack.length=this.id+1,p.stack[this.id]=this.render.execute(t),e.setAttr("d",p)},target:e,id:t,co:i,render:new kt(d[t].type,d[t].p0,d[t].cntrl1,d[t].cntrl2,i,d[t].length),length:d[t].length}),c+=d[t].length}else"M"!==d[t].type&&"m"!==d[t].type||(f.push({run(){p.stack.length=this.id+1,p.stack[this.id]={type:"M",p0:d[t].p0,length:0,pointAt(t){return this.p0}}},target:e,id:t,length:0}),c+=0);return f.forEach((function(t){t.duration=t.length/c*i})),l.add(f).ease(n).loop(o||0).direction(s||"default"),"function"==typeof r&&l.end(r.bind(e)),l.commit(),this},morphTo:function(t){const e=this,{duration:i}=t,{ease:n}=t,r=t.loop?t.loop:0,o=t.direction?t.direction:"default",s=t.attr.d?t.attr.d:e.attr.d;let a=Ct(e.attr.d)?e.attr.d.stackGroup:new At(e.attr.d).stackGroup,h=Ct(s)?s.stackGroup:new At(s).stackGroup;const c=[];e.arrayStack=[],a.length>1&&(a=a.sort(((t,e)=>e.segmentLength-t.segmentLength))),h.length>1&&(h=h.sort(((t,e)=>e.segmentLength-t.segmentLength)));const l=a.length>h.length?a.length:h.length;b(p(a[0]),p(h[0]));for(let t=1;t<l;t+=1)a[t]&&b(p(a[t]),[{type:"M",p0:a[t][0].p0}]),h[t]&&b([{type:"M",p0:h[t][0].p0}],p(h[t]));function p(t){if(!t.length)return;const e=t,i=[];for(let t=0;t<e.length;t+=1)if(-1!==["M","C","S","Q"].indexOf(e[t].type))i.push(e[t]);else if(-1!==["V","H","L","Z"].indexOf(e[t].type)){const n={x:(e[t].p0.x+e[t].p1.x)/2,y:(e[t].p0.y+e[t].p1.y)/2};i.push({p0:e[t].p0,cntrl1:n,cntrl2:n,p1:e[t].p1,type:"C",length:e[t].length})}return i}function d(t,e){c.push({run(t,e){const i=this,n=i.ctrl1Transition(e),r=i.ctrl2Transition(e),o=i.destTransition(e);t.c(!0,{x:n.x,y:n.y},{x:r.x,y:r.y},{x:o.x,y:o.y})},srcTransition:xt.linearTransitionBetweenPoints.bind(null,t.p0,e.p0),ctrl1Transition:xt.linearTransitionBetweenPoints.bind(null,t.cntrl1,e.cntrl1),ctrl2Transition:xt.linearTransitionBetweenPoints.bind(null,t.cntrl2,e.cntrl2),destTransition:xt.linearTransitionBetweenPoints.bind(null,t.p1,e.p1)})}function f(t,e){if(t.length===e)return t;const i=t.reduce(((t,e)=>t+e.length),0),n=[];for(let r=0;r<t.length;r+=1){const o=t[r].length;let s=Math.floor(e/i*o);if(s<=1)n.push(t[r]);else{let e,i=t[r];for(;s>1;){const t=i;e=u([t.p0,t.cntrl1,t.cntrl2,t.p1].slice(0),1/s),n.push({p0:t.p0,cntrl1:e.b1[0],cntrl2:e.b1[1],p1:e.b1[2],type:"C"}),i={p0:e.b1[2],cntrl1:e.b2[0],cntrl2:e.b2[1],p1:e.b2[2],type:"C"},s-=1}n.push(i)}}return n}function u(t,e){const i=[],n=t;for(;n.length>0;){for(let t=0;t<n.length-1;t+=1)i.unshift(n[t]),n[t]=(r=n[t],o=n[t+1],s=e,{x:r.x+(o.x-r.x)*(void 0!==s?s:.5),y:r.y+(o.y-r.y)*(void 0!==s?s:.5)});i.unshift(n.pop())}var r,o,s;return{b1:[{x:i[5].x,y:i[5].y},{x:i[2].x,y:i[2].y},{x:i[0].x,y:i[0].y}],b2:[{x:i[1].x,y:i[1].y},{x:i[3].x,y:i[3].y},{x:i[6].x,y:i[6].y}]}}function y(t){let e=0;for(let i=0;i<t.length;i+=1)"M"!==t[i].type&&(e+=(t[i].p1.x-t[i].p0.x)*(t[i].p1.y+t[i].p0.y));return e}function x(t){const e=t.reverse(),i=[{type:"M",p0:e[0].p1}];return e.forEach((t=>{if("C"===t.type){const e=t,n=e.p0,r=e.cntrl1;e.p0=t.p1,e.p1=n,e.cntrl1=t.cntrl2,e.cntrl2=r,i.push(e)}})),i}function m(t){let e=0,i=0,n=0,r=0;return t.forEach((t=>{t.p0&&(e+=t.p0.x,i+=t.p0.y,n+=1,r+=1),t.p1&&(e+=t.p1.x,i+=t.p1.y,n+=1,r+=1)})),{x:e/n,y:i/r}}function g(t,e){return e.x>=t.x&&e.y<=t.y?1:e.x<=t.x&&e.y<=t.y?2:e.x<=t.x&&e.y>=t.y?3:4}function v(t,e){if(e<=0)return t;let i=t;const n=i.splice(0,e);return n.shift(),i=i.concat(n),i.unshift({type:"M",p0:i[0].p0}),i.push({type:"M",p0:i[0].p0}),i}function b(t,e){let i,n,r=t.length>e.length?t.length:e.length;e.length>2&&t.length>2?(r>50?r+=30:r=r>=20?r+15:r+4,i=f(t,r),n=f(e,r)):(i=t,n=e),y(i)<0&&(i=x(i)),y(n)<0&&(n=x(n));const o=function(t,e){const i=m(t),n=m(e),r=t,o=e;for(let e=0;e<t.length;e+=1)r[e].quad=g(i,t[e].p0);for(let t=0;t<e.length;t+=1)o[t].quad=g(n,e[t].p0);let s=0;return t.forEach(((t,e)=>{const n=xt.getDistance(t.p0,i);1===t.quad&&n>=s&&(s=n)})),s=0,e.forEach(((t,e)=>{const i=xt.getDistance(t.p0,n);1===t.quad&&i>s&&(s=i)})),{src:v(t,0),dest:v(e,0),srcCentroid:i,destCentroid:n}}(i,n);i=o.src.length>1?o.src:[{type:"M",p0:o.destCentroid}],n=o.dest.length>1?o.dest:[{type:"M",p0:o.srcCentroid}];const s=n.length<i.length?i.length:n.length;for(let t=0;t<i.length;t+=1)i[t].index=t;for(let t=0;t<n.length;t+=1)n[t].index=t;for(let t=0;t<s;t+=1){const e=i[i.length-1].p0?i[i.length-1].p0:i[i.length-1].p1,r=n[n.length-1].p0?n[n.length-1].p0:n[n.length-1].p1,o=i[t]?i[t]:{type:"C",p0:e,p1:e,cntrl1:e,cntrl2:e,length:0},s=n[t]?n[t]:{type:"C",p0:r,p1:r,cntrl1:r,cntrl2:r,length:0};"M"===o.type&&"M"===s.type?(a=o,h=s,c.push({run(t,e){const i=this.pointTansition(e);t.m(!0,{x:i.x,y:i.y})},pointTansition:xt.linearTransitionBetweenPoints.bind(null,a.p0,h.p0)})):"M"===o.type||"M"===s.type?"M"===o.type?d({type:"C",p0:o.p0,p1:o.p0,cntrl1:o.p0,cntrl2:o.p0,length:0},s):d(o,{type:"C",p0:s.p0,p1:s.p0,cntrl1:s.p0,cntrl2:s.p0,length:0}):d(o,s)}var a,h}mt.add((yt+=1,"morph_"+yt),{run(t){const i=new At;for(let e=0,n=c.length;e<n;e++)c[e].run(i,t);e.setAttr("d",i)},target:e,duration:i,loop:r,direction:o},gt(n))}};const Mt={AliceBlue:"f0f8ff",AntiqueWhite:"faebd7",Aqua:"00ffff",Aquamarine:"7fffd4",Azure:"f0ffff",Beige:"f5f5dc",Bisque:"ffe4c4",Black:"000000",BlanchedAlmond:"ffebcd",Blue:"0000ff",BlueViolet:"8a2be2",Brown:"a52a2a",BurlyWood:"deb887",CadetBlue:"5f9ea0",Chartreuse:"7fff00",Chocolate:"d2691e",Coral:"ff7f50",CornflowerBlue:"6495ed",Cornsilk:"fff8dc",Crimson:"dc143c",Cyan:"00ffff",DarkBlue:"00008b",DarkCyan:"008b8b",DarkGoldenRod:"b8860b",DarkGray:"a9a9a9",DarkGrey:"a9a9a9",DarkGreen:"006400",DarkKhaki:"bdb76b",DarkMagenta:"8b008b",DarkOliveGreen:"556b2f",DarkOrange:"ff8c00",DarkOrchid:"9932cc",DarkRed:"8b0000",DarkSalmon:"e9967a",DarkSeaGreen:"8fbc8f",DarkSlateBlue:"483d8b",DarkSlateGray:"2f4f4f",DarkSlateGrey:"2f4f4f",DarkTurquoise:"00ced1",DarkViolet:"9400d3",DeepPink:"ff1493",DeepSkyBlue:"00bfff",DimGray:"696969",DimGrey:"696969",DodgerBlue:"1e90ff",FireBrick:"b22222",FloralWhite:"fffaf0",ForestGreen:"228b22",Fuchsia:"ff00ff",Gainsboro:"dcdcdc",GhostWhite:"f8f8ff",Gold:"ffd700",GoldenRod:"daa520",Gray:"808080",Grey:"808080",Green:"008000",GreenYellow:"adff2f",HoneyDew:"f0fff0",HotPink:"ff69b4",IndianRed:"cd5c5c",Indigo:"4b0082",Ivory:"fffff0",Khaki:"f0e68c",Lavender:"e6e6fa",LavenderBlush:"fff0f5",LawnGreen:"7cfc00",LemonChiffon:"fffacd",LightBlue:"add8e6",LightCoral:"f08080",LightCyan:"e0ffff",LightGoldenRodYellow:"fafad2",LightGray:"d3d3d3",LightGrey:"d3d3d3",LightGreen:"90ee90",LightPink:"ffb6c1",LightSalmon:"ffa07a",LightSeaGreen:"20b2aa",LightSkyBlue:"87cefa",LightSlateGray:"778899",LightSlateGrey:"778899",LightSteelBlue:"b0c4de",LightYellow:"ffffe0",Lime:"00ff00",LimeGreen:"32cd32",Linen:"faf0e6",Magenta:"ff00ff",Maroon:"800000",MediumAquaMarine:"66cdaa",MediumBlue:"0000cd",MediumOrchid:"ba55d3",MediumPurple:"9370db",MediumSeaGreen:"3cb371",MediumSlateBlue:"7b68ee",MediumSpringGreen:"00fa9a",MediumTurquoise:"48d1cc",MediumVioletRed:"c71585",MidnightBlue:"191970",MintCream:"f5fffa",MistyRose:"ffe4e1",Moccasin:"ffe4b5",NavajoWhite:"ffdead",Navy:"000080",OldLace:"fdf5e6",Olive:"808000",OliveDrab:"6b8e23",Orange:"ffa500",OrangeRed:"ff4500",Orchid:"da70d6",PaleGoldenRod:"eee8aa",PaleGreen:"98fb98",PaleTurquoise:"afeeee",PaleVioletRed:"db7093",PapayaWhip:"ffefd5",PeachPuff:"ffdab9",Peru:"cd853f",Pink:"ffc0cb",Plum:"dda0dd",PowderBlue:"b0e0e6",Purple:"800080",RebeccaPurple:"663399",Red:"ff0000",RosyBrown:"bc8f8f",RoyalBlue:"4169e1",SaddleBrown:"8b4513",Salmon:"fa8072",SandyBrown:"f4a460",SeaGreen:"2e8b57",SeaShell:"fff5ee",Sienna:"a0522d",Silver:"c0c0c0",SkyBlue:"87ceeb",SlateBlue:"6a5acd",SlateGray:"708090",SlateGrey:"708090",Snow:"fffafa",SpringGreen:"00ff7f",SteelBlue:"4682b4",Tan:"d2b48c",Teal:"008080",Thistle:"d8bfd8",Tomato:"ff6347",Turquoise:"40e0d0",Violet:"ee82ee",Wheat:"f5deb3",White:"ffffff",WhiteSmoke:"f5f5f5",Yellow:"ffff00",YellowGreen:"9acd32"},_t=Math.round;function zt(t,e,i,n){this.r=t,this.g=e,this.b=i,this.a=void 0===n?255:n,this.rgba=`rgba(${t},${e},${i},${n})`}function It(t){t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,((t,e,i,n)=>e+e+i+i+n+n));const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return new zt(parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16),255)}function Pt(t){var e,i,n,r,o,s,a;const h=t.replace(/[^0-9.,]+/g,"").split(",").map((function(t){return parseFloat(t)}));if(o=h[0]/360,s=h[1]/100,a=h[2]/100,r=h[3],0===s)e=i=n=a;else{var c=function(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t},l=a<.5?a*(1+s):a+s-a*s,p=2*a-l;e=255*c(p,l,o+1/3),i=255*c(p,l,o),n=255*c(p,l,o-1/3)}return new zt(e,i,n,r)}function Ot(t){return t instanceof zt?t:t.startsWith("#")?It(t):t.startsWith("rgb")?function(t){const e=t.replace(/[^0-9.,]+/g,"").split(","),i={},n=["r","g","b","a"];for(let t=0;t<e.length;t+=1)i[n[t]]=parseFloat(e[t]);return new zt(i.r,i.g,i.b,i.a)}(t):t.startsWith("hsl")?Pt(t):{r:0,g:0,b:0,a:255}}zt.prototype.normalize=function(){return this.normalFlag||(this.r/=255,this.g/=255,this.b/=255,this.a/=255,this.normalFlag=!0),this};var Lt={nameToHex:function(t){return Mt[t]?"#"+Mt[t]:"#000"},hexToRgb:It,rgbToHex:function(t){const e=t.substring(t.lastIndexOf("(")+1,t.lastIndexOf(")")).split(",");return"#"+((1<<24)+(parseInt(e[0],10)<<16)+(parseInt(e[1],10)<<8)+parseInt(e[2],10)).toString(16).slice(1)},hslToRgb:Pt,transition:function(t,e){return e=e||"rgba(0,0,0,0)",t=Ot(t=t||"rgba(0,0,0,0)"),e=Ot(e),function(i){return new zt(_t(t.r+(e.r-t.r)*i),_t(t.g+(e.g-t.g)*i),_t(t.b+(e.b-t.b)*i),_t(t.a+(e.a-t.a)*i))}},colorToRGB:Ot,rgba:function(t,e,i,n){return new zt(t,e,i,n)},isTypeColor:function(t){return t instanceof zt||t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")},RGBAInstanceCheck:function(t){return t instanceof zt}};function Nt(t){this.vDom=t,this.disable=!1,this.dragNode=null,this.touchNode=null,this.wheelNode=null,this.pointers=[]}function Ft(t,e,i){if(t.dom.parent)return t.dom.parent.events[e]&&t.dom.parent.events[e](t.dom.parent,i),Ft(t.dom.parent,e,i)}let Rt;Nt.prototype.getNode=function(t){},Nt.prototype.addPointer=function(t){this.pointers.push(t)},Nt.prototype.removePointer=function(t){const e=this,i=this.pointers;let n=-1;for(var r=0;r<i.length;r++)if(t.pointerId===i[r].pointerId){n=r;break}-1!==n&&(e.pointers=[],e.distance=0,this.pointerNode&&this.pointerNode.node.events.zoom&&this.pointerNode.node.events.zoom.onZoomEnd(this.pointerNode.node,t,e))},Nt.prototype.clickCheck=function(t){Gt([this.vDom],{x:t.offsetX,y:t.offsetY},t,"click")},Nt.prototype.dblclickCheck=function(t){Gt([this.vDom],{x:t.offsetX,y:t.offsetY},t,"dblclick")},Nt.prototype.pointerdownCheck=function(t){const e=this,i=Gt([this.vDom],{x:t.offsetX,y:t.offsetY},t,"pointerdown");!i||this.pointerNode&&this.pointerNode.node===i?this.pointerNode&&(this.pointerNode.clickCounter+=1):this.pointerNode={node:i,clickCounter:1,dragCounter:0},i&&(i.events.zoom||i.events.drag)?(i.events.zoom&&i.events.zoom.panFlag&&i.events.zoom.panExecute(i,t,"pointerdown",e),i.events.drag&&i.events.drag.execute(i,t,"pointerdown",e)):i&&"touch"===t.pointerType&&i.events.mouseover.call(i,t)},Nt.prototype.pointermoveCheck=function(t){const e=this,i=this.pointerNode?this.pointerNode.node:null;i?(this.pointerNode.dragCounter+=1,i.events.zoom&&(i.events.zoom.panFlag&&i.events.zoom.panExecute(i,t,"pointermove",e),i.events.zoom.zoomPinch(i,t,e)),i.events.drag&&i.events.drag.execute(i,t,"pointermove",e),i.events.mousemove&&i.events.mousemove.call(i,t)):i&&"touch"===t.pointerType&&i.events.mousemove.call(i,t),t.preventDefault()},Nt.prototype.pointerupCheck=function(t){const e=this,i=this.pointerNode?this.pointerNode.node:null;i&&(i.events.drag&&i.events.drag.execute(i,t,"pointerup",e),i.events.zoom&&i.events.zoom.panFlag&&i.events.zoom.panExecute(i,t,"pointerup",e),this.pointerNode.dragCounter<=2||"touch"===t.pointerType&&this.pointerNode.dragCounter<=5?(i.events.click&&i.events.click.call(i,t),Ft(i,"click",t),2===this.pointerNode.clickCounter&&(i.events.dblclick&&i.events.dblclick.call(i,t),Ft(i,"dblclick",t)),Rt&&clearTimeout(Rt),Rt=setTimeout((function(){e.pointerNode=null,Rt=null}),200)):this.pointerNode=null,"touch"===t.pointerType&&i.events.mouseup.call(i,t))},Nt.prototype.mousedownCheck=function(t){Gt([this.vDom],{x:t.offsetX,y:t.offsetY},t,"mousedown")},Nt.prototype.mousemoveCheck=function(t){const e=Gt([this.vDom],{x:t.offsetX,y:t.offsetY},t,"mousemove");this.selectedNode&&this.selectedNode!==e&&(this.selectedNode.events.mouseout&&this.selectedNode.events.mouseout.call(this.selectedNode,t),this.selectedNode.events.mouseleave&&this.selectedNode.events.mouseleave.call(this.selectedNode,t)),e&&(e.events.mouseover||e.events.mousein)&&this.selectedNode!==e&&(e.events.mouseover&&e.events.mouseover.call(e,t),e.events.mousein&&e.events.mousein.call(e,t)),this.selectedNode=e,t.preventDefault()},Nt.prototype.mouseupCheck=function(t){Gt([this.vDom],{x:t.offsetX,y:t.offsetY},t,"mouseup")},Nt.prototype.mouseleaveCheck=function(t){Gt([this.vDom],{x:t.offsetX,y:t.offsetY},t,"mouseleave")},Nt.prototype.contextmenuCheck=function(t){Gt([this.vDom],{x:t.offsetX,y:t.offsetY},t,"contextmenu")},Nt.prototype.touchstartCheck=function(t){Gt([this.vDom],{x:t.offsetX,y:t.offsetY},t,"touchstart")},Nt.prototype.touchendCheck=function(t){Gt([this.vDom],{x:t.offsetX,y:t.offsetY},t,"touchend")},Nt.prototype.touchmoveCheck=function(t){const e=t.touches;0!==e.length&&Gt([this.vDom],{x:e[0].clientX,y:e[0].clientY},t,"touchmove")},Nt.prototype.touchcancelCheck=function(t){Gt([this.vDom],{x:t.x,y:t.y},t,"touchcacel")};let jt=0,Xt=0;function Gt(t,e,i,n){let r,o;for(var s=t.length-1;s>=0;s-=1){var a=t[s],h={x:e.x,y:e.y};if(a.bbox&&(Yt(a,h),a.in({x:h.x,y:h.y})&&(a.children&&a.children.length>0?(o=Gt(a.children,{x:h.x,y:h.y},i,n),o&&(r=o)):r=a,a.events[n]&&"function"==typeof a.events[n]&&a.events[n](i),r)))break}return r||"rootNode"!==a.attr.id||(r=a,a.events[n]&&"function"==typeof a.events[n]&&a.events[n](i)),r}function Yt(t,e){let i=0,n=0,r=1,o=1;const s=e;if(t.attr.transform&&t.attr.transform.translate&&([i,n]=t.attr.transform.translate,s.x-=i,s.y-=n),t.attr.transform&&t.attr.transform.scale&&(r=void 0!==t.attr.transform.scale[0]?t.attr.transform.scale[0]:1,o=void 0!==t.attr.transform.scale[1]?t.attr.transform.scale[1]:r,s.x/=r,s.y/=o),t.attr.transform&&t.attr.transform.rotate){const e=t.attr.transform.rotate[0],i={x:t.attr.transform.rotate[1],y:t.attr.transform.rotate[2]},n=s.x,r=s.y,o=i.x,l=i.y;var a=Math.PI/180*e,h=Math.cos(a),c=Math.sin(a);s.x=h*(n-o)+c*(r-l)+o,s.y=h*(r-l)-c*(n-o)+l}}Nt.prototype.wheelEventCheck=function(t){const e=this;if(this.wheelNode)this.wheelNode.events.zoom.zoomExecute(this.wheelNode,t,e),jt+=1,this.wheelHndl&&(clearTimeout(this.wheelHndl),this.wheelHndl=null,Xt=jt),this.wheelHndl=setTimeout((function(){Xt!==jt?Xt=jt:(e.wheelHndl=null,e.wheelNode.events.zoom.onZoomEnd(e.wheelNode,t,e),e.wheelNode=null,jt=0)}),100);else{let i=Gt([this.vDom],{x:t.offsetX,y:t.offsetY},t,"wheel");i=i||this.vDom,i&&i.events.zoom&&(i.events.zoom.disableWheel||(i.events.zoom.zoomExecute(i,t,e),this.wheelNode=i))}};var Ut,Ht=[],Vt="ResizeObserver loop completed with undelivered notifications.";!function(t){t.BORDER_BOX="border-box",t.CONTENT_BOX="content-box",t.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"}(Ut||(Ut={}));var qt,Zt=function(){function t(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Object.freeze(this)}return t.prototype.toJSON=function(){var t=this;return{x:t.x,y:t.y,top:t.top,right:t.right,bottom:t.bottom,left:t.left,width:t.width,height:t.height}},t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t}(),Wt=function(t){return t instanceof SVGElement&&"getBBox"in t},$t=function(t){if(Wt(t)){var e=t.getBBox(),i=e.width,n=e.height;return!i&&!n}var r=t,o=r.offsetWidth,s=r.offsetHeight;return!(o||s||t.getClientRects().length)},Qt=function(t){var e,i,n=null===(i=null===(e=t)||void 0===e?void 0:e.ownerDocument)||void 0===i?void 0:i.defaultView;return!!(n&&t instanceof n.Element)},Jt="undefined"!=typeof window?window:{},Kt=new WeakMap,te=/auto|scroll/,ee=/^tb|vertical/,ie=/msie|trident/i.test(Jt.navigator&&Jt.navigator.userAgent),ne=function(t){return parseFloat(t||"0")},re=function(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=!1),Object.freeze({inlineSize:(i?e:t)||0,blockSize:(i?t:e)||0})},oe=Object.freeze({devicePixelContentBoxSize:re(),borderBoxSize:re(),contentBoxSize:re(),contentRect:new Zt(0,0,0,0)}),se=function(t,e){if(void 0===e&&(e=!1),Kt.has(t)&&!e)return Kt.get(t);if($t(t))return Kt.set(t,oe),oe;var i=getComputedStyle(t),n=Wt(t)&&t.ownerSVGElement&&t.getBBox(),r=!ie&&"border-box"===i.boxSizing,o=ee.test(i.writingMode||""),s=!n&&te.test(i.overflowY||""),a=!n&&te.test(i.overflowX||""),h=n?0:ne(i.paddingTop),c=n?0:ne(i.paddingRight),l=n?0:ne(i.paddingBottom),p=n?0:ne(i.paddingLeft),d=n?0:ne(i.borderTopWidth),f=n?0:ne(i.borderRightWidth),u=n?0:ne(i.borderBottomWidth),y=p+c,x=h+l,m=(n?0:ne(i.borderLeftWidth))+f,g=d+u,v=a?t.offsetHeight-g-t.clientHeight:0,b=s?t.offsetWidth-m-t.clientWidth:0,w=r?y+m:0,B=r?x+g:0,A=n?n.width:ne(i.width)-w-b,T=n?n.height:ne(i.height)-B-v,k=A+y+b+m,E=T+x+v+g,S=Object.freeze({devicePixelContentBoxSize:re(Math.round(A*devicePixelRatio),Math.round(T*devicePixelRatio),o),borderBoxSize:re(k,E,o),contentBoxSize:re(A,T,o),contentRect:new Zt(p,h,A,T)});return Kt.set(t,S),S},ae=function(t,e,i){var n=se(t,i),r=n.borderBoxSize,o=n.contentBoxSize,s=n.devicePixelContentBoxSize;switch(e){case Ut.DEVICE_PIXEL_CONTENT_BOX:return s;case Ut.BORDER_BOX:return r;default:return o}},he=function(t){var e=se(t);this.target=t,this.contentRect=e.contentRect,this.borderBoxSize=[e.borderBoxSize],this.contentBoxSize=[e.contentBoxSize],this.devicePixelContentBoxSize=[e.devicePixelContentBoxSize]},ce=function(t){if($t(t))return 1/0;for(var e=0,i=t.parentNode;i;)e+=1,i=i.parentNode;return e},le=function(){var t=1/0,e=[];Ht.forEach((function(i){if(0!==i.activeTargets.length){var n=[];i.activeTargets.forEach((function(e){var i=new he(e.target),r=ce(e.target);n.push(i),e.lastReportedSize=ae(e.target,e.observedBox),r<t&&(t=r)})),e.push((function(){i.callback.call(i.observer,n,i.observer)})),i.activeTargets.splice(0,i.activeTargets.length)}}));for(var i=0,n=e;i<n.length;i++){(0,n[i])()}return t},pe=function(t){Ht.forEach((function(e){e.activeTargets.splice(0,e.activeTargets.length),e.skippedTargets.splice(0,e.skippedTargets.length),e.observationTargets.forEach((function(i){i.isActive()&&(ce(i.target)>t?e.activeTargets.push(i):e.skippedTargets.push(i))}))}))},de=function(){var t=0;for(pe(t);Ht.some((function(t){return t.activeTargets.length>0}));)t=le(),pe(t);return Ht.some((function(t){return t.skippedTargets.length>0}))&&function(){var t;"function"==typeof ErrorEvent?t=new ErrorEvent("error",{message:Vt}):((t=document.createEvent("Event")).initEvent("error",!1,!1),t.message=Vt),window.dispatchEvent(t)}(),t>0},fe=[],ue=function(t){if(!qt){var e=0,i=document.createTextNode("");new MutationObserver((function(){return fe.splice(0).forEach((function(t){return t()}))})).observe(i,{characterData:!0}),qt=function(){i.textContent=""+(e?e--:e++)}}fe.push(t),qt()},ye=0,xe={attributes:!0,characterData:!0,childList:!0,subtree:!0},me=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],ge=function(t){return void 0===t&&(t=0),Date.now()+t},ve=!1,be=new(function(){function t(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return t.prototype.run=function(t){var e=this;if(void 0===t&&(t=250),!ve){ve=!0;var i,n=ge(t);i=function(){var i=!1;try{i=de()}finally{if(ve=!1,t=n-ge(),!ye)return;i?e.run(1e3):t>0?e.run(t):e.start()}},ue((function(){requestAnimationFrame(i)}))}},t.prototype.schedule=function(){this.stop(),this.run()},t.prototype.observe=function(){var t=this,e=function(){return t.observer&&t.observer.observe(document.body,xe)};document.body?e():Jt.addEventListener("DOMContentLoaded",e)},t.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),me.forEach((function(e){return Jt.addEventListener(e,t.listener,!0)})))},t.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),me.forEach((function(e){return Jt.removeEventListener(e,t.listener,!0)})),this.stopped=!0)},t}()),we=function(t){!ye&&t>0&&be.start(),!(ye+=t)&&be.stop()},Be=function(){function t(t,e){this.target=t,this.observedBox=e||Ut.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return t.prototype.isActive=function(){var t,e=ae(this.target,this.observedBox,!0);return t=this.target,Wt(t)||function(t){switch(t.tagName){case"INPUT":if("image"!==t.type)break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1}(t)||"inline"!==getComputedStyle(t).display||(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},t}(),Ae=function(t,e){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=e},Te=new WeakMap,ke=function(t,e){for(var i=0;i<t.length;i+=1)if(t[i].target===e)return i;return-1},Ee=function(){function t(){}return t.connect=function(t,e){var i=new Ae(t,e);Te.set(t,i)},t.observe=function(t,e,i){var n=Te.get(t),r=0===n.observationTargets.length;ke(n.observationTargets,e)<0&&(r&&Ht.push(n),n.observationTargets.push(new Be(e,i&&i.box)),we(1),be.schedule())},t.unobserve=function(t,e){var i=Te.get(t),n=ke(i.observationTargets,e),r=1===i.observationTargets.length;n>=0&&(r&&Ht.splice(Ht.indexOf(i),1),i.observationTargets.splice(n,1),we(-1))},t.disconnect=function(t){var e=this,i=Te.get(t);i.observationTargets.slice().forEach((function(i){return e.unobserve(t,i.target)})),i.activeTargets.splice(0,i.activeTargets.length)},t}(),Se=function(){function t(t){if(0===arguments.length)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if("function"!=typeof t)throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");Ee.connect(this,t)}return t.prototype.observe=function(t,e){if(0===arguments.length)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Qt(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Ee.observe(this,t,e)},t.prototype.unobserve=function(t){if(0===arguments.length)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Qt(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Ee.unobserve(this,t)},t.prototype.disconnect=function(){Ee.disconnect(this)},t.toString=function(){return"function ResizeObserver () { [polyfill code] }"},t}();let Ce=0;const De=N,Me=Q,_e=y,ze=window.ResizeObserver||Se;const Ie=function(t,e,i){return function(n){t.setAttr(e,i.call(t,n))}},Pe=function(t,e,i){const n=[],r=t.attr.transform;return"function"==typeof i?function(n){t[e](i.call(t,n))}:(i.forEach(((t,i)=>{let o;o=r[e]&&void 0!==r[e][i]?r[e][i]:"scale"===e?1:0,n.push(De.intermediateValue.bind(null,o,t))})),function(i){t[e](n.map((t=>t(i))))})},Oe=function(t,e,i){const n=t.attr[e];return function(r){t.setAttr(e,De.intermediateValue(n,i,r))}},Le=function(t,e,i){let n,r,o;if("function"==typeof i)return function(n){t.setStyle(e,i.call(t,t.dataObj,n))};if(n=t.style[e],isNaN(i)){if(Lt.isTypeColor(i)){const r=Lt.transition(n,i);return function(i){t.setStyle(e,r(i))}}n=n.match(/(\d+)/g),o=i.match(/(\d+)/g),r=i.match(/\D+$/),n=parseInt(n.length>0?n[0]:0,10),o=parseInt(o.length>0?o[0]:0,10),r=r.length>0?r[0]:"px"}else n=void 0!==t.style[e]?t.style[e]:1,o=i,r=0;return function(i){t.setStyle(e,De.intermediateValue(n,o,i)+r)}},Ne=function(t,e){const i=e.attr?e.attr:{},n=e.style?e.style:{},r=[];let o;if("function"!=typeof i)for(const n in i)if("transform"!==n){const o=i[n];"function"==typeof o?r[r.length]=function(e){t.setAttr(n,o.call(t,e))}:"d"===n?t.morphTo(e):r[r.length]=Oe(t,n,i[n])}else if(o=i[n],"function"==typeof o)r[r.length]=Ie(t,n,o);else{t.attr.transform||(t.attr.transform={});const e=Object.keys(i.transform);for(let n=0,o=e.length;n<o;n+=1)r[r.length]=Pe(t,e[n],i.transform[e[n]])}else r[r.length]=i.bind(t);if("function"!=typeof n)for(const e in n)r[r.length]=Le(t,e,n[e]);else r[r.length]=n.bind(t);return{run(t){for(let e=0,i=r.length;e<i;e+=1)r[e](t)},target:t,duration:e.duration,delay:e.delay?e.delay:0,end:e.end?e.end.bind(t,t.dataObj):null,loop:e.loop?e.loop:0,direction:e.direction?e.direction:"default",ease:e.ease?e.ease:"default"}};function Fe(t,e,i){const n=t.map(i),r={new:[],update:[],old:[]};for(let o=0;o<e.length;o+=1){const s=n.indexOf(i(e[o].dataObj,o));-1!==s?(e[o].dataObj=t[s],r.update.push(e[o]),n[s]=null):r.old.push(e[o])}return r.new=t.filter(((t,e)=>{const r=n.indexOf(i(t,e));return-1!==r&&(n[r]=null,!0)})),r}const Re={};Re.push={value:function(t){"[object Array]"!==Object.prototype.toString.call(t)&&(t=[t]);for(let e=0,i=t.length;e<i;e++)this.data.push(t[e]);if(this.config.action.enter){const e={};this.selector.split(",").forEach((function(i){e[i]=t})),this.config.action.enter.call(this,e)}},enumerable:!1,configurable:!1,writable:!1},Re.pop={value:function(){const t=this,e=this.data.pop();if(this.config.action.exit){const i={};this.selector.split(",").forEach((function(n){i[n]=t.fetchEls(n,[e])})),this.config.action.exit.call(this,i)}},enumerable:!1,configurable:!1,writable:!1},Re.remove={value:function(t){"[object Array]"!==Object.prototype.toString.call(t)&&(t=[t]);const e=this;for(let e=0,i=t.length;e<i;e++)-1!==this.data.indexOf(t[e])&&this.data.splice(this.data.indexOf(t[e]),1);if(this.config.action.exit){const i={};this.selector.split(",").forEach((function(n){i[n]=e.fetchEls(n,t)})),this.config.action.exit.call(this,i)}},enumerable:!1,configurable:!0,writable:!1},Re.update={value:function(){const t=this;if(this.config.action.update){const e={};this.selector.split(",").forEach((function(i){e[i]=t.fetchEls(i,t.data)})),this.config.action.update.call(this,e)}},enumerable:!1,configurable:!0,writable:!1},Re.join={value:function(t){this.data=t,Xe.call(this,t,this.selector,this.config)},enumerable:!1,configurable:!0,writable:!1};var je=function(){};function Xe(t,e,i){const n=this,r=e.split(",");let{joinOn:o}=i;const s={new:{},update:{},old:{}};o||(o=function(t,e){return e});for(let e=0,i=r.length;e<i;e++){const i=r[e],a=Fe(t,n.fetchEls(i).stack,o);s.new[i]=a.new,s.update[i]=(new Ye).wrapper(a.update),s.old[i]=(new Ye).wrapper(a.old)}return i.action&&(i.action.enter&&i.action.enter.call(n,s.new),i.action.exit&&i.action.exit.call(n,s.old),i.action.update&&i.action.update.call(n,s.update)),Re.config={value:i,enumerable:!1,configurable:!0,writable:!0},Re.selector={value:e,enumerable:!1,configurable:!0,writable:!1},Re.data={value:t,enumerable:!1,configurable:!0,writable:!0},Object.create(n,Re)}function Ge(t,e,i){const n={};let r;for(r in t)"end"!==r&&("function"==typeof t[r]?n[r]=t[r].call(e,e.dataObj,i):n[r]=t[r]);return n}je.prototype.getAttr=function(t){return this.attr[t]},je.prototype.getStyle=function(t){return this.style[t]},je.prototype.exec=function(t){return"function"!=typeof t&&console.error("Wrong Exe type"),t.call(this,this.dataObj),this},je.prototype.fetchEls=function(t,e){const i=[],n=new Ye;if(this.children.length>0)if("."===t.charAt(0)){const n=t.substring(1,t.length);this.children.forEach((t=>{if(!t)return;const r=e&&t.dataObj&&-1!==e.indexOf(t.dataObj)&&t.attr.class===n,o=!e&&t.attr.class===n;(r||o)&&i.push(t)}))}else if("#"===t.charAt(0)){const n=t.substring(1,t.length);this.children.every((t=>{if(!t)return;const r=e&&t.dataObj&&-1!==e.indexOf(t.dataObj)&&t.attr.id===n,o=!e&&t.attr.id===n;return!r&&!o||(i.push(t),!1)}))}else t="group"===t?"g":t,this.children.forEach((n=>{if(!n)return;const r=e&&n.dataObj&&-1!==e.indexOf(n.dataObj)&&n.nodeName===t,o=!e&&n.nodeName===t;(r||o)&&i.push(n)}));return n.wrapper(i)},je.prototype.fetchEl=function(t,e){let i;if(this.children.length>0)if("."===t.charAt(0)){const n=t.substring(1,t.length);this.children.every((t=>{if(!t)return;const r=e&&t.dataObj&&e===t.dataObj&&t.attr.class===n,o=!e&&t.attr.class===n;return!r&&!o||(i=t,!1)}))}else if("#"===t.charAt(0)){const n=t.substring(1,t.length);this.children.every((t=>{if(!t)return;const r=e&&t.dataObj&&e===t.dataObj&&t.attr.id===n,o=!e&&t.attr.id===n;return!r&&!o||(i=t,!1)}))}else t="group"===t?"g":t,this.children.forEach((n=>{if(!n)return;const r=e&&n.dataObj&&e===n.dataObj&&n.nodeName===t,o=!e&&n.nodeName===t;(r||o)&&(i=n)}));return i},je.prototype.join=Xe,je.prototype.data=function(t){return t?(this.dataObj=t,this):this.dataObj},je.prototype.interrupt=function(){if(this.animList&&this.animList.length>0)for(var t=this.animList.length-1;t>=0;t--)_e.remove(this.animList[t]);return this.animList=[],this},je.prototype.animateTo=function(t){return _e.add((Ce+=1,Ce),Ne(this,t),Me(t.ease)),this},je.prototype.animateExe=function(t){return Ne(this,t)};function Ye(t,e,i,n){let r,o;e||(e=[]);const s=i&&i.attr?Object.keys(i.attr):[],a=i&&i.style?Object.keys(i.style):[],h=!i||(void 0===i.bbox||i.bbox);return this.stack=e.map(((e,c)=>{const l=this.createNode(t.ctx,{el:i.el,bbox:h},n);for(let t=0,n=a.length;t<n;t+=1)if(o=a[t],"function"==typeof i.style[o]){const t=i.style[o].call(l,e,c);l.setStyle(o,t)}else l.setStyle(o,i.style[o]);for(let t=0,n=s.length;t<n;t+=1)if(o=s[t],"transform"!==o)if("function"==typeof i.attr[o]){const t=i.attr[o].call(l,e,c);l.setAttr(o,t)}else l.setAttr(o,i.attr[o]);else{"function"==typeof i.attr.transform?r=i.attr[o].call(l,e,c):({transform:r}=i.attr);for(const t in r)l[t](r[t])}return l.dataObj=e,l})),this}Ye.prototype={createEls:function(t,e){let i;const n=[];let r=t;for(let o=0,s=this.stack.length;o<s;o+=1){let s={};if(i=this.stack[o],"function"==typeof t&&(r=t.call(i,i.dataObj,o)),"function"==typeof e)s=e.call(i,i.dataObj,o);else{const t=Object.keys(e);for(let i=0,n=t.length;i<n;i+=1){const n=t[i];s[n]=e[n]}}n.push(i.createEls(r,s))}const o=new Ye;return o.wrapper(n),o},createEl:function(t){let e;const i=[];for(let n=0,r=this.stack.length;n<r;n+=1){let r={};if(e=this.stack[n],"function"==typeof t)r=t.call(e,e.dataObj,n);else{const e=Object.keys(t);for(let i=0,n=e.length;i<n;i+=1){const n=e[i];"object"!=typeof t[n]?r[n]=t[n]:r[n]=JSON.parse(JSON.stringify(t[n]))}}i.push(e.createEl(r))}const n=new Ye;return n.wrapper(i),n},forEach:function(t){for(let e=0,i=this.stack.length;e<i;e+=1)t.call(this.stack[e],this.stack[e].dataObj,e);return this},setAttr:function(t,e){let i;for(let n=0,r=this.stack.length;n<r;n+=1)if(i=this.stack[n],arguments.length>1)"function"==typeof e?i.setAttr(t,e.call(i,i.dataObj,n)):i.setAttr(t,e);else if("function"==typeof t)i.setAttr(t.call(i,i.dataObj,n));else{const e=Object.keys(t);for(let r=0,o=e.length;r<o;r+=1){const o=e[r];"function"==typeof t[o]?i.setAttr(o,t[o].call(i,i.dataObj,n)):i.setAttr(o,t[o])}}return this},fetchEls:function(t,e){let i;const n=[];for(let r=0;r<this.stack.length;r+=1)i=this.stack[r],n.push(i.fetchEls(t,e));const r=new Ye;return r.wrapper(n),r},setStyle:function(t,e){let i;for(let n=0,r=this.stack.length;n<r;n+=1)if(i=this.stack[n],arguments.length>1)"function"==typeof e?i.setStyle(t,e.call(i,i.dataObj,n)):i.setStyle(t,e);else{if("function"==typeof t)i.setStyle(t.call(i,i.dataObj,n));else{const e=Object.keys(t);for(let r=0,o=e.length;r<o;r+=1){const o=e[r];"function"==typeof t[o]?i.setStyle(o,t[o].call(i,i.dataObj,n)):i.setStyle(o,t[o])}}"function"==typeof t?i.setStyle(t.call(i,i.dataObj,n)):i.setStyle(t)}return this},translate:function(t){let e;for(let i=0,n=this.stack.length;i<n;i+=1)e=this.stack[i],"function"==typeof t?e.translate(t.call(e,e.dataObj,i)):e.translate(t);return this},rotate:function(t){let e;for(let i=0,n=this.stack.length;i<n;i+=1)e=this.stack[i],"function"==typeof t?e.rotate(t.call(e,e.dataObj,i)):e.rotate(t);return this},scale:function(t){let e;for(let i=0,n=this.stack.length;i<n;i+=1)e=this.stack[i],"function"==typeof t?e.scale(t.call(e,e.dataObj,i)):e.scale(t);return this},exec:function(t){let e;if("function"==typeof t){for(let i=0,n=this.stack.length;i<n;i+=1)e=this.stack[i],t.call(e,e.dataObj,i);return this}},animateTo:function(t){let e,i;for(let n=0;n<this.stack.length;n+=1)i={},e=this.stack[n],i=Ge(t,e,n),t.attr&&"function"!=typeof t.attr&&(i.attr=Ge(t.attr,e,n)),t.style&&"function"!=typeof t.style&&(i.style=Ge(t.style,e,n)),t.end&&(i.end=t.end),t.ease&&(i.ease=t.ease),e.animateTo(i);return this},animateExe:function(t){let e,i;const n=[];for(let r=0;r<this.stack.length;r+=1)i={},e=this.stack[r],i=Ge(t,e,r),t.attr&&"function"!=typeof t.attr&&(i.attr=Ge(t.attr,e,r)),t.style&&"function"!=typeof t.style&&(i.style=Ge(t.style,e,r)),t.end&&(i.end=t.end),t.ease&&(i.ease=t.ease),n.push(e.animateExe(i));return n},animatePathTo:function(t){let e;const i=Object.keys(t);for(let n=0,r=this.stack.length;n<r;n+=1){e=this.stack[n];const r={};for(let o=0;o<i.length;o++){let s=t[i[o]];"function"==typeof s&&(s=s.call(e,e.dataObj,n)),r[i[o]]=s}e.animatePathTo(r)}return this},remove:function(){for(let t=0,e=this.stack.length;t<e;t+=1)this.stack[t].remove();return this},interrupt:function(){for(let t=0,e=this.stack.length;t<e;t+=1)this.stack[t].interrupt();return this},text:function(t){let e;if("function"!=typeof t)for(let i=0;i<this.stack.length;i+=1)e=this.stack[i],e.text(t);else for(let i=0;i<this.stack.length;i+=1)e=this.stack[i],e.text(t.call(e,e.dataObj,i));return this},join:function(t,e,i){let n;const r=[];for(let o=0;o<this.stack.length;o+=1)n=this.stack[o],r.push(n.join(t,e,i));const o=new Ye;return o.wrapper(r),o},on:function(t,e){for(let i=0,n=this.stack.length;i<n;i+=1)this.stack[i].on(t,e);return this}},Ye.prototype.createNode=function(){},Ye.prototype.wrapper=function(t){const e=this;if(t)for(let i=0,n=t.length;i<n;i++){const n=t[i];e.stack.push(n)}return this};const Ue=function(t){for(const e in t){const i=t[e],n=i.contentRect;i.target.resizeHandler&&i.target.resizeHandler.forEach((function(t){t(n)}))}};function He(t,e){t.ro||(t.ro=new ze(Ue),t.ro.observe(t.container)),t.container.resizeHandler||(t.container.resizeHandler=[]),t.container.resizeHandler.push(e)}function Ve(t,e){if(!t.container.resizeHandler)return;const i=t.container.resizeHandler.indexOf(e);-1!==i&&t.container.resizeHandler.splice(i,1),0===t.container.resizeHandler.length&&t.ro&&t.ro.disconnect()}const qe=y;let Ze=0;function We(){return Ze+=1,Ze}const $e=function(){Ye.apply(this,arguments)};function Qe(t,e={}){this.pDom=t;const i=e.id?e.id:"mask-"+Math.ceil(1e3*Math.random());this.id=e.id||i,e.id=i,this.defs||(this.defs=t.createEl({el:"defs"})),this.mask=this.defs.createEl({el:"mask",attr:e,style:{}})}function Je(t,e={}){this.pDom=t;const i=e.id?e.id:"clip-"+Math.ceil(1e3*Math.random());this.id=e.id||i,e.id=i,this.defs||(this.defs=t.createEl({el:"defs"})),this.clip=this.defs.createEl({el:"clipPath",attr:e,style:{}})}function Ke(t,e={}){this.pDom=t;const i=e.id?e.id:"pattern-"+Math.ceil(1e3*Math.random());this.id=e.id||i,e.id=i,this.defs||(this.defs=t.createEl({el:"defs"})),this.pattern=this.defs.createEl({el:"pattern",attr:e,style:{}})}function ti(t){let e="";for(const i in t)e+="rotate"===i?`${i}(${t.rotate[0]+" "+(t.rotate[1]||0)+" "+(t.rotate[2]||0)}) `:`${i}(${t[i].join(" ")}) `;return e}function ei(t,e,i){this.config=t,this.type=e||"linear",this.pDom=i,this.defs=this.pDom.createEl({el:"defs"})}($e.prototype=new Ye).constructor=$e,$e.prototype.createNode=function(t,e,i){return ri(e,i)},Qe.prototype.exe=function(){return`url(#${this.id})`},Je.prototype.exe=function(){return`url(#${this.id})`},Ke.prototype.exe=function(){return`url(#${this.id})`},ei.prototype.exe=function(){return`url(#${this.config.id})`},ei.prototype.linearGradient=function(){const t=this;return this.linearEl=this.defs.join([1],"linearGradient",{action:{enter(e){const i=this.createEls(e.linearGradient,{el:"linearGradient"}).setAttr({id:t.config.id,x1:t.config.x1+"%",y1:t.config.y1+"%",x2:t.config.x2+"%",y2:t.config.y2+"%",spreadMethod:t.config.spreadMethod||"pad",gradientUnits:t.config.gradientUnits||"objectBoundingBox"});t.config.gradientTransform&&i.setAttr("gradientTransform",ti(t.config.gradientTransform))},exit(t){t.linearGradient.remove()},update(e){e.linearGradient.setAttr({id:t.config.id,x1:t.config.x1+"%",y1:t.config.y1+"%",x2:t.config.x2+"%",y2:t.config.y2+"%",spreadMethod:t.config.spreadMethod||"pad",gradientUnits:t.config.gradientUnits||"objectBoundingBox"}),t.config.gradientTransform&&e.linearGradient.setAttr("gradientTransform",ti(t.config.gradientTransform))}}}),this.linearEl=this.linearEl.fetchEl("linearGradient"),this.linearEl.fetchEls("stop").remove(),this.linearEl.createEls(this.config.colorStops,{el:"stop",attr:{offset:(t,e)=>t.value+"%","stop-color":function(t,e){return t.color}}}),this},ei.prototype.radialGradient=function(){const t=this;return this.defs||(this.defs=this.pDom.createEl({el:"defs"})),this.radialEl=this.defs.join([1],"radialGradient",{action:{enter(e){const i=this.createEls(e.radialGradient,{el:"radialGradient"}).setAttr({id:t.config.id,cx:t.config.innerCircle.x+"%",cy:t.config.innerCircle.y+"%",r:t.config.outerCircle.r+"%",fx:t.config.outerCircle.x+"%",fy:t.config.outerCircle.y+"%",spreadMethod:t.config.spreadMethod||"pad",gradientUnits:t.config.gradientUnits||"objectBoundingBox"});t.config.gradientTransform&&i.setAttr("gradientTransform",ti(t.config.gradientTransform))},exit(t){t.radialGradient.remove()},update(e){e.radialGradient.setAttr({id:t.config.id,cx:t.config.innerCircle.x+"%",cy:t.config.innerCircle.y+"%",r:t.config.outerCircle.r+"%",fx:t.config.outerCircle.x+"%",fy:t.config.outerCircle.y+"%",spreadMethod:t.config.spreadMethod||"pad",gradientUnits:t.config.gradientUnits||"objectBoundingBox"}),t.config.gradientTransform&&e.radialGradient.setAttr("gradientTransform",ti(t.config.gradientTransform))}}}),this.radialEl=this.radialEl.fetchEl("radialGradient"),this.radialEl.fetchEls("stop").remove(),this.radialEl.createEls(this.config.colorStops,{el:"stop",attr:{offset:(t,e)=>t.value+"%","stop-color":function(t,e){return t.color}}}),this},ei.prototype.colorStops=function(t){return"[object Array]"===Object.prototype.toString.call(t)&&(this.config.colorStops=t,"linear"===this.type?this.linearGradient():"radial"===this.type&&this.radialGradient())};const ii={svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",xhtml:"http://www.w3.org/1999/xhtml"},ni=function(t){return document.createElementNS(ii.svg,t)};function ri(t,e){let i=null;const n=t.el.indexOf(":");if(n>=0)r=t.el.slice(0,n),o=t.el.slice(n+1),i=document.createElementNS(ii[r],o);else switch(t.el){case"group":i=ni("g");break;default:i=ni(t.el)}var r,o;const s=new oi(i,t,We(),e);return t.dataObj&&(i.dataObj=t.dataObj),s}const oi=function(t,e,i,n){this.dom=t,this.nodeName=t.nodeName,this.attr={},this.style={},this.changedAttribute={},this.changedStyles={},this.id=i,this.nodeType="svg",this.dom.nodeId=i,this.children=[],this.vDomIndex=n,this.events={},e.style&&this.setStyle(e.style),e.attr&&this.setAttr(e.attr)};function si(t,e){const i=e.indexOf(":"),n=t.changedAttribute[e];i>=0?t.dom.setAttributeNS(ii[e.slice(0,i)],e.slice(i+1),n):"text"===e?t.dom.textContent=n:"d"===e?Dt.isTypePath(n)?t.dom.setAttribute(e,n.fetchPathString()):t.dom.setAttribute(e,n):"onerror"===e||"onload"===e?t.dom[e]=function(e){n.call(t,e)}:t.dom.setAttribute(e,n)}function ai(t){let e="";for(const i in t.attr.transform)e+="rotate"===i?`${i}(${t.attr.transform.rotate[0]+" "+(t.attr.transform.rotate[1]||0)+" "+(t.attr.transform.rotate[2]||0)}) `:`${i}(${t.attr.transform[i].join(" ")}) `;t.dom.setAttribute("transform",e)}function hi(t){if("[object Array]"===Object.prototype.toString.call(t))return t.reduce((function(t,e){return t+e.x+","+e.y+" "}),"")}function ci(t,e={}){const i=document.querySelector(t);let n=i.clientHeight,r=i.clientWidth;const{autoUpdate:o=!0,enableResize:s=!0}=e,a=document.createElementNS(ii.svg,"svg");let h;a.setAttribute("height",n),a.setAttribute("width",r),a.style.position="absolute";let c,l,p,d,f=999999;i&&(i.appendChild(a),h=new x,o&&(f=qe.addVdom(h)));const u=new oi(a,{},We(),f);u.container=i,u.type="SVG",u.width=r,u.height=n,u.domEl=a;const y=new Nt(u);h&&h.rootNode(u),u.setLayerId=function(t){a.setAttribute("id",t)};const m=function(e){document.querySelector(t)?(n=c||e.height,r=l||e.width,a.setAttribute("height",n),a.setAttribute("width",r),u.width=r,u.height=n,p&&p(),u.update()):Ve(u)};u.onResize=function(t){p=t},u.onChange=function(t){d=t},u.invokeOnChange=function(){d&&d()},u.setSize=function(t,e){this.dom.setAttribute("height",e),this.dom.setAttribute("width",t),this.width=t,this.height=e,c=e,l=t},u.update=function(){this.execute()},u.setViewBox=function(t,e,i,n){this.dom.setAttribute("viewBox",t+","+e+","+n+","+i)},u.destroy=function(){const e=document.querySelector(t);e&&e.contains(a)&&e.removeChild(a),qe.removeVdom(f)},u.createPattern=function(t){return new Ke(this,t)},u.createClip=function(t){return new Je(this,t)},u.createMask=function(t){return new Qe(this,t)};let g=null;return u.dom.addEventListener("pointerdown",(t=>{y.addPointer(t),t.target.drag_&&(t.target.drag_(t,"pointerdown",y),g=t.target)})),u.dom.addEventListener("pointerup",(t=>{g&&(g.drag_(t,"pointerup",y),g=null),y.removePointer(t)})),u.dom.addEventListener("pointermove",(t=>{t.preventDefault(),g&&g.drag_(t,"pointermove",y)})),qe.execute(),s&&He(u,m),u}oi.prototype=new je,oi.prototype.node=function(){return this.execute(),this.dom},oi.prototype.transFormAttributes=function(){const t=this;for(const e in t.changedAttribute)"transform"!==e?si(t,e):ai(t);this.changedAttribute={}},oi.prototype.scale=function(t){return this.attr.transform||(this.attr.transform={}),this.attr.transform.scale=t,this.changedAttribute.transform=this.attr.transform,this.attrChanged=!0,qe.vDomChanged(this.vDomIndex),this},oi.prototype.skewX=function(t){return this.attr.transform||(this.attr.transform={}),this.attr.transform.skewX=[t],this.changedAttribute.transform=this.attr.transform,this.attrChanged=!0,qe.vDomChanged(this.vDomIndex),this},oi.prototype.skewY=function(t){return this.attr.transform||(this.attr.transform={}),this.attr.transform.skewY=[t],this.changedAttribute.transform=this.attr.transform,this.attrChanged=!0,qe.vDomChanged(this.vDomIndex),this},oi.prototype.translate=function(t){return this.attr.transform||(this.attr.transform={}),this.attr.transform.translate=t,this.changedAttribute.transform=this.attr.transform,this.attrChanged=!0,qe.vDomChanged(this.vDomIndex),this},oi.prototype.rotate=function(t,e,i){return this.attr.transform||(this.attr.transform={}),"[object Array]"===Object.prototype.toString.call(t)&&t.length>0?this.attr.transform.rotate=[t[0]||0,t[1]||0,t[2]||0]:this.attr.transform.rotate=[t,e||0,i||0],this.changedAttribute.transform=this.attr.transform,this.attrChanged=!0,qe.vDomChanged(this.vDomIndex),this},oi.prototype.setStyle=function(t,e){if(2===arguments.length)null==e&&null!=this.style[t]?delete this.style[t]:("function"==typeof e&&(e=e.call(this,this.dataObj)),Lt.RGBAInstanceCheck(e)&&(e=e.rgba),this.style[t]=e),this.changedStyles[t]=e;else if(1===arguments.length&&"object"==typeof t)for(const e in t)null==t[e]&&null!=this.style[t]?delete this.style[e]:this.style[e]=t[e],this.changedStyles[e]=t[e];return this.styleChanged=!0,qe.vDomChanged(this.vDomIndex),this},oi.prototype.setAttr=function(t,e){if(2===arguments.length)"points"===t&&(e=hi(e)),this.attr[t]=e,this.changedAttribute[t]=e;else if(1===arguments.length&&"object"==typeof t)for(const e in t)"points"===e&&(t[e]=hi(t[e])),this.attr[e]=t[e],this.changedAttribute[e]=t[e];return this.attrChanged=!0,qe.vDomChanged(this.vDomIndex),this},oi.prototype.execute=function(){if(this.styleChanged||this.attrChanged){this.transFormAttributes();for(let t=0,e=this.children.length;t<e;t+=1)this.children[t].execute();for(const t in this.changedStyles)"object"==typeof this.changedStyles[t]&&(this.changedStyles[t]instanceof ei||this.changedStyles[t]instanceof Ke||this.changedStyles[t]instanceof Je||this.changedStyles[t]instanceof Qe)&&(this.changedStyles[t]=this.changedStyles[t].exe()),this.dom.style.setProperty(t,this.changedStyles[t],"");this.changedStyles={}}else for(let t=0,e=this.children.length;t<e;t+=1)this.children[t].execute()},oi.prototype.child=function(t){const e=this.dom,i=this;if(t instanceof $e){var n=document.createDocumentFragment();for(let e=0,r=t.stack.length;e<r;e++)n.appendChild(t.stack[e].dom),t.stack[e].parentNode=i,this.children[this.children.length]=t.stack[e];e.appendChild(n)}else t instanceof oi?(e.appendChild(t.dom),t.parentNode=i,this.children.push(t)):console.log("wrong node type");return this},oi.prototype.animatePathTo=Dt.animatePathTo,oi.prototype.morphTo=Dt.morphTo,oi.prototype.createRadialGradient=function(t){const e=new ei(t,"radial",this);return e.radialGradient(),e},oi.prototype.createLinearGradient=function(t){const e=new ei(t,"linear",this);return e.linearGradient(),e},oi.prototype.on=function(t,e){const i=this;if(i.events[t]&&"drag"!==t&&"zoom"!==t&&(i.dom.removeEventListener(t,i.events[t]),delete i.events[t]),"drag"===t&&delete i.dom.drag_,"zoom"===t&&(i.dom.removeEventListener("wheel",i.events[t]),delete i.dom.drag_),e){if("drag"===t)i.dom.drag_=function(t,n){e.execute(i,t,n)};else if("zoom"===t){let n,r=0,o=0;i.events[t]=function(t){e.disableWheel||(e.zoomExecute(i,t),r+=1,n&&(clearTimeout(n),n=null,o=r),n=setTimeout((function(){o!==r?o=r:(n=null,e.onZoomEnd(i,t),r=0)}),100))},i.dom.addEventListener("wheel",i.events[t]),i.dom.drag_=function(t,n,r){e.panFlag&&e.panExecute(i,t,n,r)}}else{const n=e.bind(i);i.events[t]=function(t){n(t)},i.dom.addEventListener(t,i.events[t])}return this}},oi.prototype.html=function(t){return arguments.length?(this.dom.innerHTML(t),this):this.dom.innerHTML},oi.prototype.text=function(t){return arguments.length?(this.attr.text=t,this.changedAttribute.text=t,this):this.attr.text},oi.prototype.remove=function(){this.parentNode.removeChild(this)},oi.prototype.createEls=function(t,e){const i=new $e({type:"SVG"},t,e,this.vDomIndex);return this.child(i),qe.vDomChanged(this.vDomIndex),i},oi.prototype.createEl=function(t){const e=ri(t,this.vDomIndex);return this.child(e),qe.vDomChanged(this.vDomIndex),e},oi.prototype.removeChild=function(t){const{children:e}=this,i=e.indexOf(t);if(-1!==i){const t=e.splice(i,1)[0].dom;if(!this.dom.contains(t))return;this.dom.removeChild(t)}};const li=y,pi=Q;let di=0;function fi(){return di+=1,di}function ui(t,{dx:e=0,dy:i=0},n){const r=t.transform.translate,[o,s=o]=t.transform.scale;return function(t,[e,i],n){return n[0]>=t[0][0]*e&&n[0]<=t[1][0]*e&&n[1]>=t[0][1]*i&&n[1]<=t[1][1]*i}(n,[o,s],[r[0]+e,r[1]+i])&&(e/=o,i/=s,t.dx=e,t.dy=i,r[0]/=o,r[1]/=s,r[0]+=e,r[1]+=i,r[0]*=o,r[1]*=s),t}const yi=function(){const t=this;this.dragStartFlag=!1,this.dragExtent=[[-1/0,-1/0],[1/0,1/0]],this.event={x:0,y:0,dx:0,dy:0,transform:{translate:[0,0],scale:[1,1]}},this.onDragStart=function(e,i){t.event.x=i.offsetX,t.event.y=i.offsetY,t.event.dx=0,t.event.dy=0,t.dragStartFlag=!0},this.onDrag=function(){},this.onDragEnd=function(){t.event.x=event.offsetX,t.event.y=event.offsetY,t.event.dx=0,t.event.dy=0,t.dragStartFlag=!1}};function xi(t,e){return e<=t[0]?t[0]:e>=t[1]?t[1]:e}function mi(t,e,i,n){return t.translate[0]/=e,t.translate[1]/=e,t.translate[0]-=n[0]/e-n[0]/i,t.translate[1]-=n[1]/e-n[1]/i,t.scale=[i,i],t.translate[0]*=i,t.translate[1]*=i,t}yi.prototype={dragExtent:function(t){return this.dragExtent=t,this},dragStart:function(t){const e=this;return"function"==typeof t&&(this.onDragStart=function(i,n){e.event.x=n.offsetX,e.event.y=n.offsetY,e.event.dx=0,e.event.dy=0,t.call(i,e.event),e.dragStartFlag=!0}),this},drag:function(t){const e=this;return"function"==typeof t&&(this.onDrag=function(i,n){const r=n.offsetX-e.event.x,o=n.offsetY-e.event.y;e.event.x=n.offsetX,e.event.y=n.offsetY,e.event=ui(this.event,{dx:r,dy:o},e.dragExtent),t.call(i,e.event)}),this},dragEnd:function(t){const e=this;return"function"==typeof t&&(this.onDragEnd=function(i,n){e.dragStartFlag=!1,e.event.x=n.offsetX,e.event.y=n.offsetY,e.event.dx=0,e.event.dy=0,t.call(i,e.event)}),this},bindMethods:function(t){const e=this;t.dragTo=function(i,n){e.dragTo(t,i,n)}},execute:function(t,e,i){const n=this;this.event.e=e,e.preventDefault&&e.preventDefault(),this.dragStartFlag||"mousedown"!==i&&"pointerdown"!==i?!this.onDragEnd||"mouseup"!==i&&"mouseleave"!==i&&"pointerleave"!==i&&"pointerup"!==i?this.onDrag&&n.onDrag(t,e):n.onDragEnd(t,e):n.onDragStart(t,e)}};const gi=function(){const t=this;this.event={x:0,y:0,dx:0,dy:0,distance:0},this.event.pointers=[],this.event.transform={translate:[0,0],scale:[1,1]},this.zoomBy_=.001,this.zoomExtent_=[0,1/0],this.zoomStartFlag=!1,this.zoomDuration=250,this.onZoomStart=function(e,i){t.event.x=i.offsetX,t.event.y=i.offsetY,t.event.dx=0,t.event.dy=0,t.zoomStartFlag=!0,t.event.distance=0},this.onZoom=function(e,i){t.event.x=i.offsetX,t.event.y=i.offsetY},this.onZoomEnd=function(e,i){t.event.x=i.offsetX,t.event.y=i.offsetY,t.event.dx=0,t.event.dy=0,t.zoomStartFlag=!1,t.event.distance=0},this.onPanStart=function(t,e){},this.onPan=function(t,e){},this.onPanEnd=function(){},this.disableWheel=!1,this.disableDbclick=!1};gi.prototype.zoomStart=function(t){const e=this;return"function"==typeof t&&(this.zoomStartExe=t,this.onZoomStart=function(i,n,r){if(r.pointers&&2===r.pointers.length){const t=r.pointers;n={x:t[0].offsetX+.5*(t[1].offsetX-t[0].offsetX),y:t[0].offsetY+.5*(t[1].offsetY-t[0].offsetY)}}e.event.x=n.offsetX,e.event.y=n.offsetY,e.event.dx=0,e.event.dy=0,e.zoomStartFlag||t.call(i,e.event),e.zoomStartFlag=!0,e.event.distance=0}),this},gi.prototype.zoom=function(t){const e=this;return"function"==typeof t&&(this.zoomExe=t,this.onZoom=function(i,n){const r=e.event.transform,o=r.scale[0];let s=o;const a=n.deltaY,h=n.offsetX,c=n.offsetY;s=xi(e.zoomExtent_,s+-1*a*e.zoomBy_),e.event.transform=mi(r,o,s,[h,c]),e.event.x=h,e.event.y=c,t.call(i,e.event)}),this},gi.prototype.zoomEnd=function(t){const e=this;return"function"==typeof t&&(this.zoomEndExe=t,this.onZoomEnd=function(i,n){e.event.x=n.offsetX,e.event.y=n.offsetY,e.event.dx=0,e.event.dy=0,e.zoomStartFlag=!1,t.call(i,e.event),e.event.distance=0}),this},gi.prototype.zoomTransition=function(){},gi.prototype.zoomExecute=function(t,e,i){this.eventType="zoom",e.preventDefault&&e.preventDefault(),this.zoomStartFlag?this.onZoom(t,e):this.onZoomStart(t,e,i)},gi.prototype.zoomPinch=function(t,e,i){const n=i.pointers;if(e.preventDefault&&e.preventDefault(),2===i.pointers.length)if(this.zoomStartFlag){const i=this.event.distance;for(var r=0;r<n.length;r++)if(e.pointerId===n[r].pointerId){n[r]=e;break}const o=N.getDistance({x:n[0].offsetX,y:n[0].offsetY},{x:n[1].offsetX,y:n[1].offsetY}),s={offsetX:this.event.x,offsetY:this.event.y,deltaY:i?i-o:0};this.event.distance=o,this.onZoom(t,s)}else this.onZoomStart(t,e,i)},gi.prototype.scaleBy=function(t,e,i){const n=this,r=n.event.transform,o=e*r.scale[0],s=r.scale[0],a=this.zoomTarget_||i,h=(a[0]-i[0])*s,c=(a[1]-i[1])*s;let l=0;const p={run(e){const a=r.scale[0],p=xi(n.zoomExtent_,s+(o-s)*e);n.event.transform=mi(r,a,p,i),n.event.transform.translate[0]+=h*(e-l)/p,n.event.transform.translate[1]+=c*(e-l)/p,l=e,n.zoomExe&&n.zoomExe.call(t,n.event)},target:t,duration:n.zoomDuration,delay:0,end:function(){n.onZoomEnd&&n.onZoomEnd(t,{})},loop:1,direction:"default",ease:"default"};li.add(fi(),p,pi(p.ease))},gi.prototype.zoomTarget=function(t){this.zoomTarget_=t},gi.prototype.scaleTo=function(t,e,i){const n=this,r=n.event.transform,o=r.scale[0],s=this.zoomTarget_||i,a=(s[0]-i[0])*o,h=(s[1]-i[1])*o;let c=0;const l={run(s){const l=r.scale[0],p=xi(n.zoomExtent_,o+(e-o)*s);n.event.transform=mi(r,l,p,i),n.event.transform.translate[0]+=a*(s-c)/p,n.event.transform.translate[1]+=h*(s-c)/p,c=s,n.zoomStartFlag||n.onZoomStart(t,{offsetX:i[0],offsetY:i[1]},{}),n.zoomExe&&n.zoomExe.call(t,n.event)},target:t,duration:n.zoomDuration,delay:0,end:function(){n.onZoomEnd&&n.onZoomEnd(t,n.event)},loop:1,direction:"default",ease:"default"};li.add(fi(),l,pi(l.ease))},gi.prototype.panTo=function(t,e){const i=this,n=i.event.transform,r=e[0]-i.event.x,o=e[1]-i.event.y;let s=0;const a={run(e){const[a]=n.scale;n.translate[0]+=r*(e-s)/a,n.translate[1]+=o*(e-s)/a,s=e,i.zoomExe&&i.zoomExe.call(t,i.event)},target:t,duration:i.zoomDuration,delay:0,end:function(){i.onZoomEnd&&i.onZoomEnd(t,i.event)},loop:1,direction:"default",ease:"default"};li.add(fi(),a,pi(a.ease))},gi.prototype.bindMethods=function(t){const e=this;t.scaleTo=function(i,n){e.scaleTo(t,i,n)},t.scaleBy=function(i,n){return e.scaleBy(t,i,n),t},t.panTo=function(i,n){return e.panTo(t,i,n),t}},gi.prototype.zoomFactor=function(t){return this.zoomBy_=t,this},gi.prototype.scaleExtent=function(t){return this.zoomExtent_=t,this},gi.prototype.duration=function(t){return this.zoomDuration=t||250,this},gi.prototype.panExtent=function(t){return this.panExtent_=t,this.panFlag=!0,this},gi.prototype.panExecute=function(t,e,i,n){if(1===n.pointers.length){if(this.event.e=e,this.eventType="pan",e.preventDefault&&e.preventDefault(),"touchstart"!==e.type&&"touchmove"!==e.type&&"touchend"!==e.type&&"touchcancel"!==e.type||(e.offsetX=e.touches[0].clientX,e.offsetY=e.touches[0].clientY),this.zoomStartFlag||"mousedown"!==i&&"pointerdown"!==i)if(!this.onZoomEnd||"mouseup"!==i&&"mouseleave"!==i&&"pointerup"!==i&&"pointerleave"!==i){if(this.zoomExe){const i=e.offsetX-this.event.x,n=e.offsetY-this.event.y;this.event.x=e.offsetX,this.event.y=e.offsetY,this.event=ui(this.event,{dx:i,dy:n},this.panExtent_),this.zoomExe.call(t,this.event)}}else this.onZoomEnd(t,e);else this.onZoomStart(t,e,{});e.preventDefault&&e.preventDefault()}};var vi={drag:function(){return new yi},zoom:function(){return new gi}};const bi=N,wi=y;let Bi=0;const Ai=vi.zoom(),Ti=vi.drag();function ki(){return Bi+=1,Bi}const Ei=function(){Ye.apply(this,arguments)};function Si(t){const e=(window.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1);return e<1?1:e}function Ci(t){const e={translateX:0,translateY:0,scaleX:1,scaleY:1};return t&&(t.translate&&t.translate.length>0&&(e.translateX=t.translate[0],e.translateY=t.translate[1]),t.scale&&t.scale.length>0&&(e.scaleX=t.scale[0],e.scaleY=t.scale[1]||e.scaleX)),e}function Di(){const t=this,{transform:e,points:i=[]}=t.attr,{translateX:n,translateY:r,scaleX:o,scaleY:s}=Ci(e);if(i&&i.length>0){let e=i[0].x,a=i[0].x,h=i[0].y,c=i[0].y;for(let t=1;t<i.length;t+=1)e>i[t].x&&(e=i[t].x),a<i[t].x&&(a=i[t].x),h>i[t].y&&(h=i[t].y),c<i[t].y&&(c=i[t].y);t.BBox={x:n+e*o,y:r+h*s,width:(a-e)*o,height:(c-h)*s}}else t.BBox={x:0,y:0,width:0,height:0};e&&e.rotate?t.BBoxHit=bi.rotateBBox(this.BBox,e):t.BBoxHit=this.BBox}function Mi(t,e){this.config=t,this.type=e||"linear",this.mode=this.config.mode&&"percent"!==this.config.mode?"absolute":"percent"}function _i(t,e,i){this.imageData=t,this.width=e,this.height=i}function zi(t,e={}){const i=e.id?e.id:"mask-"+Math.ceil(1e3*Math.random());this.config=e,this.mask=new Qi(t.dom.ctx,{el:"g",attr:{id:i}},ki(),t.vDomIndex)}function Ii(t){return new zi(this,t)}function Pi(t,e={}){const i=e.id?e.id:"clip-"+Math.ceil(1e3*Math.random());this.clip=new Qi(t.dom.ctx,{el:"g",attr:{id:i}},ki(),t.vDomIndex)}function Oi(t){return new Pi(this,t)}function Li(t,e={},i=0,n=0){const r=this,o=e.id?e.id:"pattern-"+Math.ceil(1e3*Math.random());this.repeatInd=e.repeat?e.repeat:"repeat","NODE"===t.ENV?r.pattern=on({},n,i):(r.pattern=Ki(null,{},{enableEvents:!1,enableResize:!1}),r.pattern.setSize(i,n)),r.pattern.setAttr("id",o),t.prependChild([r.pattern]),r.pattern.vDomIndex=t.vDomIndex+":"+o,r.pattern.onChange((function(){r.patternObj=t.ctx.createPattern(r.pattern.domEl,r.repeatInd)}))}function Ni(t,e=0,i=0){return new Li(this,t,e,i)}function Fi(){this.BBox={x:0,y:0,width:0,height:0},this.BBoxHit={x:0,y:0,width:0,height:0}}function Ri(t,e,i,n,r,o){const s=this;s.ctx=t,s.attr=e,s.style=i,s.nodeName="Image",s.nodeExe=o;for(const t in e)this.setAttr(t,e[t]);wi.vDomChanged(o.vDomIndex),s.stack=[s]}function ji(t,e,i){const n=this;n.ctx=t,n.attr=e,n.style=i,n.nodeName="text",n.stack=[n]}(Ei.prototype=new Ye).constructor=Ei,Ei.prototype.createNode=function(t,e,i){return new Qi(t,e,ki(),i)},Mi.prototype.exe=function(t,e){return"linear"===this.type&&"percent"===this.mode?this.linearGradient(t,e):"linear"===this.type&&"absolute"===this.mode?this.absoluteLinearGradient(t):"radial"===this.type&&"percent"===this.mode?this.radialGradient(t,e):"radial"===this.type&&"absolute"===this.mode?this.absoluteRadialGradient(t):void console.error("wrong Gradiant type")},Mi.prototype.linearGradient=function(t,e){const i=t.createLinearGradient(e.x+e.width*(this.config.x1/100),e.y+e.height*(this.config.y1/100),e.x+e.width*(this.config.x2/100),e.y+e.height*(this.config.y2/100));return this.config.colorStops.forEach((t=>{i.addColorStop(t.value/100,t.color)})),i},Mi.prototype.absoluteLinearGradient=function(t){const e=t.createLinearGradient(this.config.x1,this.config.y1,this.config.x2,this.config.y2);return this.config.colorStops.forEach((t=>{e.addColorStop(t.value,t.color)})),e},Mi.prototype.radialGradient=function(t,e){const i=t.createRadialGradient(e.x+e.width*(this.config.innerCircle.x/100),e.y+e.height*(this.config.innerCircle.y/100),e.width>e.height?e.width*this.config.innerCircle.r/100:e.height*this.config.innerCircle.r/100,e.x+e.width*(this.config.outerCircle.x/100),e.y+e.height*(this.config.outerCircle.y/100),e.width>e.height?e.width*this.config.outerCircle.r/100:e.height*this.config.outerCircle.r/100);return this.config.colorStops.forEach((t=>{i.addColorStop(t.value/100,t.color)})),i},Mi.prototype.absoluteRadialGradient=function(t,e){const i=t.createRadialGradient(this.config.innerCircle.x,this.config.innerCircle.y,this.config.innerCircle.r,this.config.outerCircle.x,this.config.outerCircle.y,this.config.outerCircle.r);return this.config.colorStops.forEach((t=>{i.addColorStop(t.value/100,t.color)})),i},Mi.prototype.colorStops=function(t){return"[object Array]"===Object.prototype.toString.call(t)&&(this.config.colorStops=t,this)},_i.prototype.get=function(t){const e=this.imageData?this.imageData.pixels:[],i=(t.y-1)*(4*this.width)+4*(t.x-1);return"rgba("+e[i]+", "+e[i+1]+", "+e[i+2]+", "+e[i+3]+")"},_i.prototype.put=function(t,e){const i=(t.y-1)*(4*this.width)+4*(t.x-1);return this.imageData.pixels[i]=e[0],this.imageData.pixels[i+1]=e[1],this.imageData.pixels[i+2]=e[2],this.imageData.pixels[i+3]=e[3],this},zi.prototype.setAttr=function(t,e){this.config[t]=e},zi.prototype.exe=function(){return this.mask.execute(),this.mask.dom.ctx.globalCompositeOperation=this.config.globalCompositeOperation||"destination-atop",!0},Pi.prototype.exe=function(){return this.clip.execute(),this.clip.dom.ctx.clip(),!0},Li.prototype.repeat=function(t){this.repeatInd=t},Li.prototype.exe=function(){return this.patternObj},Fi.prototype={render:function(t){const e=this;if(t.transform){const{transform:i}=t,{scale:n=[1,1],skew:r=[0,0],translate:o=[0,0]}=i,[s=1,a=s]=n,[h=0,c=h]=r,[l=0,p=l]=o;e.ctx.transform(s,h,c,a,l,p),i.rotate&&i.rotate.length>0&&(e.ctx.translate(i.rotate[1]||0,i.rotate[2]||0),e.ctx.rotate(i.rotate[0]*(Math.PI/180)),e.ctx.translate(-i.rotate[1]||0,-i.rotate[2]||0))}for(let t=0;t<e.stack.length;t+=1)e.stack[t].execute()},setAttr:function(t,e){null==e&&null!=this.attr[t]?delete this.attr[t]:this.attr[t]=e},setStyle:function(t,e){null==e&&null!=this.style[t]?delete this.style[t]:this.style[t]=e},applyStyles:function(){"#000000"!==this.ctx.fillStyle&&this.ctx.fill(),"#000000"!==this.ctx.strokeStyle&&this.ctx.stroke()}},Ri.prototype=new Fi,Ri.prototype.constructor=Ri,Ri.prototype.setAttr=function(t,e){const i=this;"src"===t&&("string"==typeof e?(i.image=i.image?i.image:function(t){const e=new Image;return e.crossOrigin="anonymous",e.onload=function(){t.attr.height=t.attr.height?t.attr.height:this.height,t.attr.width=t.attr.width?t.attr.width:this.width,t.imageObj=this,t.nodeExe.attr.onload&&"function"==typeof t.nodeExe.attr.onload&&t.nodeExe.attr.onload.call(t.nodeExe,t.image),t.nodeExe.BBoxUpdate=!0,wi.vDomChanged(t.nodeExe.vDomIndex)},e.onerror=function(e){t.nodeExe.attr.onerror&&"function"==typeof t.nodeExe.attr.onerror&&t.nodeExe.attr.onerror.call(t.nodeExe,e)},e}(i),i.image.src!==e&&(i.image.src=e)):e instanceof HTMLImageElement||e instanceof SVGImageElement||e instanceof HTMLCanvasElement?(i.imageObj=e,i.attr.height=i.attr.height?i.attr.height:e.height,i.attr.width=i.attr.width?i.attr.width:e.width):(e instanceof Qi||e instanceof rn)&&(i.imageObj=e.domEl,i.attr.height=i.attr.height?i.attr.height:e.attr.height,i.attr.width=i.attr.width?i.attr.width:e.attr.width)),this.attr[t]=e,wi.vDomChanged(this.nodeExe.vDomIndex)},Ri.prototype.updateBBox=function(){const t=this,{transform:e,x:i=0,y:n=0,width:r=0,height:o=0}=t.attr,{translateX:s,translateY:a,scaleX:h,scaleY:c}=Ci(e);t.BBox={x:(s+i)*h,y:(a+n)*c,width:r*h,height:o*c},e&&e.rotate?t.BBoxHit=bi.rotateBBox(this.BBox,e):t.BBoxHit=this.BBox},Ri.prototype.execute=function(){const{width:t=0,height:e=0,x:i=0,y:n=0}=this.attr;this.imageObj&&this.ctx.drawImage(this.imageObj,i,n,t,e)},Ri.prototype.applyStyles=function(){},Ri.prototype.in=function(t){const{width:e=0,height:i=0,x:n=0,y:r=0}=this.attr;return t.x>=n&&t.x<=n+e&&t.y>=r&&t.y<=r+i},ji.prototype=new Fi,ji.prototype.constructor=ji,ji.prototype.text=function(t){this.attr.text=t},ji.prototype.updateBBox=function(){const t=this;let e=1,i=0,{x:n=0,y:r=0,transform:o}=t.attr;const{translateX:s,translateY:a,scaleX:h,scaleY:c}=Ci(o);this.style.font&&(this.ctx.font=this.style.font,e=parseInt(this.style.font.replace(/[^\d.]/g,""),10)||1),i=this.ctx.measureText(this.attr.text).width,"center"===this.style.textAlign?n-=i/2:"right"===this.style.textAlign&&(n-=i),t.width=i,t.height=e,t.x=n,t.y=r,t.BBox={x:(s+n)*h,y:(a+r)*c,width:i*h,height:e*c},o&&o.rotate?t.BBoxHit=bi.rotateBBox(this.BBox,o):t.BBoxHit=this.BBox},ji.prototype.execute=function(){void 0!==this.attr.text&&null!==this.attr.text&&("#000000"!==this.ctx.fillStyle&&this.ctx.fillText(this.attr.text,this.attr.x,this.attr.y+this.height),"#000000"!==this.ctx.strokeStyle&&this.ctx.strokeText(this.attr.text,this.attr.x,this.attr.y+this.height))},ji.prototype.applyStyles=function(){},ji.prototype.in=function(t){const{x:e=0,y:i=0,width:n=0,height:r=0}=this;return t.x>=e&&t.x<=e+n&&t.y>=i&&t.y<=i+r};const Xi=function(t,e,i){const n=this;n.ctx=t,n.attr=e,n.style=i,n.nodeName="circle",n.stack=[n]};(Xi.prototype=new Fi).constructor=Xi,Xi.prototype.updateBBox=function(){const t=this,{transform:e,r:i=0,cx:n=0,cy:r=0}=t.attr,{translateX:o,translateY:s,scaleX:a,scaleY:h}=Ci(e);t.BBox={x:o+(n-i)*a,y:s+(r-i)*h,width:2*i*a,height:2*i*h},e&&e.rotate?t.BBoxHit=bi.rotateBBox(this.BBox,e):t.BBoxHit=this.BBox},Xi.prototype.execute=function(){const{r:t=0,cx:e=0,cy:i=0}=this.attr;this.ctx.beginPath(),this.ctx.arc(e,i,t,0,2*Math.PI,!1),this.applyStyles(),this.ctx.closePath()},Xi.prototype.in=function(t,e){const{r:i=0,cx:n=0,cy:r=0}=this.attr;return Math.sqrt((t.x-n)*(t.x-n)+(t.y-r)*(t.y-r))<=i};const Gi=function(t,e,i){const n=this;n.ctx=t,n.attr=e,n.style=i,n.nodeName="line",n.stack=[n]};function Yi(t,e,i){const n=this;n.ctx=t,n.attr=e,n.style=i,n.nodeName="polyline",n.stack=[n]}(Gi.prototype=new Fi).constructor=Gi,Gi.prototype.updateBBox=function(){const t=this,{transform:e,x1:i=0,y1:n=0,x2:r=0,y2:o=0}=t.attr,{translateX:s,translateY:a,scaleX:h,scaleY:c}=Ci(e);t.BBox={x:s+(i<r?i:r)*h,y:a+(n<o?n:o)*c,width:Math.abs(r-i)*h,height:Math.abs(o-n)*c},e&&e.rotate?t.BBoxHit=bi.rotateBBox(this.BBox,e):t.BBoxHit=this.BBox},Gi.prototype.execute=function(){const{ctx:t}=this,{x1:e=0,y1:i=0,x2:n=0,y2:r=0}=this.attr;t.beginPath(),t.moveTo(e,i),t.lineTo(n,r),this.applyStyles(),t.closePath()},Gi.prototype.in=function(t){const{x1:e=0,y1:i=0,x2:n=0,y2:r=0}=this.attr;return parseFloat(bi.getDistance({x:e,y:i},t)+bi.getDistance(t,{x:n,y:r})).toFixed(1)===parseFloat(bi.getDistance({x:e,y:i},{x:n,y:r})).toFixed(1)},Yi.prototype=new Fi,Yi.constructor=Yi,Yi.prototype.execute=function(){const t=this;let e;if(this.attr.points&&0!==this.attr.points.length){this.ctx.beginPath(),t.ctx.moveTo(this.attr.points[0].x,this.attr.points[0].y);for(var i=1;i<this.attr.points.length;i++)e=this.attr.points[i],t.ctx.lineTo(e.x,e.y);this.applyStyles(),this.ctx.closePath()}},Yi.prototype.updateBBox=Di,Yi.prototype.in=function(t){let e=!1;for(let i=0,n=this.attr.points.length;i<=n-2;i++){const n=this.attr.points[i],r=this.attr.points[i+1];e=e||parseFloat(bi.getDistance({x:n.x,y:n.y},t)+bi.getDistance(t,{x:r.x,y:r.y})).toFixed(1)===parseFloat(bi.getDistance({x:n.x,y:n.y},{x:r.x,y:r.y})).toFixed(1)}return e};const Ui=function(t,e,i){const n=this;return n.ctx=t,n.angle=0,n.nodeName="path",n.attr=e,n.style=i,n.attr.d&&(Dt.isTypePath(n.attr.d)?(n.path=n.attr.d,n.attr.d=n.attr.d.fetchPathString()):n.path=Dt.instance(n.attr.d),n.pathNode=new Path2D(n.attr.d)),n.stack=[n],n};function Hi(t){if("[object Array]"!==Object.prototype.toString.call(t))return void console.error("Points expected as array [{x: , y:}]");if(t&&0===t.length)return;const e=new Path2D;e.moveTo(t[0].x,t[0].y);for(let i=1;i<t.length;i++)e.lineTo(t[i].x,t[i].y);return e.closePath(),{path:e,points:t,execute:function(t){t.beginPath();const e=this.points;t.moveTo(e[0].x,e[0].y);for(let i=1;i<e.length;i++)t.lineTo(e[i].x,e[i].y);t.closePath()}}}(Ui.prototype=new Fi).constructor=Ui,Ui.prototype.updateBBox=function(){const t=this,{transform:e}=t.attr,{translateX:i,translateY:n,scaleX:r,scaleY:o}=Ci(e);t.BBox=t.path?t.path.BBox:{x:0,y:0,width:0,height:0},t.BBox.x=i+t.BBox.x*r,t.BBox.y=n+t.BBox.y*o,t.BBox.width*=r,t.BBox.height*=o,e&&e.rotate?t.BBoxHit=bi.rotateBBox(this.BBox,e):t.BBoxHit=this.BBox},Ui.prototype.setAttr=function(t,e){this.attr[t]=e,"d"===t&&(Dt.isTypePath(e)?(this.path=e,this.attr.d=e.fetchPathString()):this.path=Dt.instance(this.attr.d),this.pathNode=new Path2D(this.attr.d))},Ui.prototype.getPointAtLength=function(t){return this.path?this.path.getPointAtLength(t):{x:0,y:0}},Ui.prototype.getAngleAtLength=function(t){return this.path?this.path.getAngleAtLength(t):0},Ui.prototype.getTotalLength=function(){return this.path?this.path.getTotalLength():0},Ui.prototype.execute=function(){this.attr.d&&("#000000"!==this.ctx.fillStyle||"#000000"!==this.ctx.strokeStyle?("#000000"!==this.ctx.fillStyle&&this.ctx.fill(this.pathNode),"#000000"!==this.ctx.strokeStyle&&this.ctx.stroke(this.pathNode)):this.path.execute(this.ctx))},Ui.prototype.applyStyles=function(){},Ui.prototype.in=function(t){let e=!1;return this.attr.d&&this.pathNode?(this.ctx.save(),this.ctx.scale(1/this.ctx.pixelRatio,1/this.ctx.pixelRatio),e=this.ctx.isPointInPath(this.pathNode,t.x,t.y),this.ctx.restore(),e):e};const Vi=function(t,e,i){const n=this;return n.ctx=t,n.nodeName="polygon",n.attr=e,n.style=i,n.stack=[n],n.attr.points&&(n.polygon=Hi(n.attr.points)),this};(Vi.prototype=new Fi).constructor=Vi,Vi.prototype.setAttr=function(t,e){this.attr[t]=e,"points"===t&&(this.polygon=Hi(this.attr.points),this.polygon&&(this.attr.points=this.polygon.points))},Vi.prototype.updateBBox=Di,Vi.prototype.execute=function(){this.polygon&&("#000000"!==this.ctx.fillStyle||"#000000"!==this.ctx.strokeStyle?("#000000"!==this.ctx.fillStyle&&this.ctx.fill(this.polygon.path),"#000000"!==this.ctx.strokeStyle&&this.ctx.stroke(this.polygon.path)):this.polygon.execute(this.ctx))},Vi.prototype.applyStyles=function(){},Vi.prototype.in=function(t){let e=!1;return!!this.polygon&&(this.ctx.save(),this.ctx.scale(1/this.ctx.pixelRatio,1/this.ctx.pixelRatio),e=this.style.fillStyle?this.ctx.isPointInPath(this.polygon.path,t.x,t.y):e,this.ctx.restore(),e)};const qi=function(t,e,i){const n=this;return n.ctx=t,n.nodeName="ellipse",n.attr=e,n.style=i,n.stack=[n],this};(qi.prototype=new Fi).constructor=qi,qi.prototype.updateBBox=function(){const t=this,{transform:e,cx:i=0,cy:n=0,rx:r=0,ry:o=0}=t.attr,{translateX:s,translateY:a,scaleX:h,scaleY:c}=Ci(e);t.BBox={x:s+(i-r)*h,y:a+(n-o)*c,width:2*r*h,height:2*o*c},e&&e.rotate?t.BBoxHit=bi.rotateBBox(this.BBox,e):t.BBoxHit=this.BBox},qi.prototype.execute=function(){const t=this.ctx,{cx:e=0,cy:i=0,rx:n=0,ry:r=0}=this.attr;t.beginPath(),t.ellipse(e,i,n,r,0,0,2*Math.PI),this.applyStyles(),t.closePath()},qi.prototype.in=function(t){const{cx:e=0,cy:i=0,rx:n=0,ry:r=0}=this.attr;return(t.x-e)*(t.x-e)/(n*n)+(t.y-i)*(t.y-i)/(r*r)<=1};const Zi=function(t,e,i){const n=this;return n.ctx=t,n.nodeName="rect",n.attr=e,n.style=i,n.stack=[n],this};function Wi(t,e){const{x:i=0,y:n=0,width:r=0,height:o=0,rx:s=0,ry:a=0}=e;t.beginPath(),t.moveTo(i+s,n),t.lineTo(i+r-s,n),t.quadraticCurveTo(i+r,n,i+r,n+a),t.lineTo(i+r,n+o-a),t.quadraticCurveTo(i+r,n+o,i+r-s,n+o),t.lineTo(i+s,n+o),t.quadraticCurveTo(i,n+o,i,n+o-a),t.lineTo(i,n+a),t.quadraticCurveTo(i,n,i+s,n),t.closePath()}(Zi.prototype=new Fi).constructor=Zi,Zi.prototype.updateBBox=function(){const t=this,{transform:e,x:i=0,y:n=0,width:r=0,height:o=0}=t.attr,{translateX:s,translateY:a,scaleX:h,scaleY:c}=Ci(e);t.BBox={x:s+i*h,y:a+n*c,width:r*h,height:o*c},e&&e.rotate?t.BBoxHit=bi.rotateBBox(this.BBox,e):t.BBoxHit=this.BBox},Zi.prototype.applyStyles=function(){},Zi.prototype.execute=function(){const t=this.ctx,{x:e=0,y:i=0,width:n=0,height:r=0,rx:o=0,ry:s=0}=this.attr;"#000000"!==t.fillStyle||"#000000"!==t.strokeStyle?("#000000"!==t.fillStyle&&(o||s?(Wi(t,{x:e,y:i,width:n,height:r,rx:o,ry:s}),t.fill()):t.fillRect(e,i,n,r)),"#000000"!==t.strokeStyle&&(o||s?(Wi(t,{x:e,y:i,width:n,height:r,rx:o,ry:s}),t.stroke()):t.strokeRect(e,i,n,r))):t.rect(e,i,n,r)},Zi.prototype.in=function(t){const{x:e=0,y:i=0,width:n=0,height:r=0}=this.attr;return t.x>=e&&t.x<=e+n&&t.y>=i&&t.y<=i+r};const $i=function(t,e,i){const n=this;return n.nodeName="g",n.ctx=t,n.attr=e,n.style=i,n.stack=new Array(0),this};($i.prototype=new Fi).constructor=$i,$i.prototype.updateBBox=function(t){const e=this;let i,n,r,o;const{transform:s}=e.attr,{translateX:a,translateY:h,scaleX:c,scaleY:l}=Ci(s);if(e.BBox={},t&&t.length>0){let e,s,a;for(let h=0;h<t.length;h+=1)e=t[h],s=e.dom.BBoxHit.x,a=e.dom.BBoxHit.y,i=void 0===i||i>s?s:i,r=void 0===r||r>a?a:r,n=void 0===n||n<s+e.dom.BBoxHit.width?s+e.dom.BBoxHit.width:n,o=void 0===o||o<a+e.dom.BBoxHit.height?a+e.dom.BBoxHit.height:o}i=void 0===i?0:i,r=void 0===r?0:r,n=void 0===n?0:n,o=void 0===o?0:o,e.BBox.x=a+i*c,e.BBox.y=h+r*l,e.BBox.width=Math.abs(n-i)*c,e.BBox.height=Math.abs(o-r)*l,e.attr.transform&&e.attr.transform.rotate?e.BBoxHit=bi.rotateBBox(this.BBox,this.attr.transform):e.BBoxHit=this.BBox},$i.prototype.child=function(t){const e=this,i=t;i instanceof Qi?(i.dom.parent=e,e.stack[e.stack.length]=i):i instanceof Ei?i.stack.forEach((t=>{t.dom.parent=e,e.stack[e.stack.length]=t})):console.log("wrong Object")},$i.prototype.in=function(t){const e=t.x,i=t.y,{BBox:n}=this,{transform:r}=this.attr,{translateX:o,translateY:s,scaleX:a,scaleY:h}=Ci(r);return e>=(n.x-o)/a&&e<=(n.x-o+n.width)/a&&i>=(n.y-s)/h&&i<=(n.y-s+n.height)/h};const Qi=function(t,e,i,n){switch(this.style=e.style||{},this.setStyle(e.style),this.attr=e.attr||{},this.id=i,this.nodeName=e.el,this.nodeType="CANVAS",this.children=[],this.events={},this.ctx=t,this.vDomIndex=n,this.bbox=void 0===e.bbox||e.bbox,e.el){case"circle":this.dom=new Xi(this.ctx,this.attr,this.style);break;case"rect":this.dom=new Zi(this.ctx,this.attr,this.style);break;case"line":this.dom=new Gi(this.ctx,this.attr,this.style);break;case"polyline":this.dom=new Yi(this.ctx,this.attr,this.style);break;case"path":this.dom=new Ui(this.ctx,this.attr,this.style);break;case"group":case"g":this.dom=new $i(this.ctx,this.attr,this.style);break;case"text":this.dom=new ji(this.ctx,this.attr,this.style);break;case"image":this.dom=new Ri(this.ctx,this.attr,this.style,e.onload,e.onerror,this);break;case"polygon":this.dom=new Vi(this.ctx,this.attr,this.style,this);break;case"ellipse":this.dom=new qi(this.ctx,this.attr,this.style,this);break;default:this.dom=null}this.dom.nodeExe=this,this.BBoxUpdate=!0};function Ji(t){return Lt.RGBAInstanceCheck(t)&&(t=t.rgba),"#000"===t||"#000000"===t||"black"===t?"rgb(1, 1, 1)":t}function Ki(t,e={},i={}){const n=t?document.querySelector(t):null;let r=n?n.clientHeight:0,o=n?n.clientWidth:0;const s=document.createElement("canvas"),a=s.getContext("2d",e);let{enableEvents:h=!0,autoUpdate:c=!0,enableResize:l=!0}=i,p=Si(a);a.pixelRatio=p;let d,f=function(t){t.clearRect(0,0,o*p,r*p)};s.setAttribute("height",r*p),s.setAttribute("width",o*p),s.style.height=r+"px",s.style.width=o+"px",s.style.position="absolute";let u,y,m,g,v=999999;n?(n.appendChild(s),d=new x,c&&(v=wi.addVdom(d))):h=!1;const b=new Qi(a,{el:"g",attr:{id:"rootNode"}},ki(),v);d&&d.rootNode(b);const w=b.execute.bind(b);b.container=n,b.domEl=s,b.height=r,b.width=o,b.type="CANVAS",b.ctx=a,b.setClear=function(t){f=t},b.setAttr=function(t,e){"viewBox"===t&&this.setViewBox.apply(this,e.split(",")),s.setAttribute(t,e),this.attr[t]=e},b.enableEvents=function(t){h=t},b.setStyle=function(t,e){this.domEl.style[t]=e},b.addDependentLayer=function(t){if(!(t instanceof Qi))return;const e=t.attr.id?t.attr.id:"dep-"+Math.ceil(1e3*Math.random());t.setAttr("id",e),t.vDomIndex=this.vDomIndex+":"+e,this.prependChild([t])};const B=function(e){document.querySelector(t)?(r=u||e.height,o=y||e.width,b.width=o,b.height=r,A(b.domEl,o,r),m&&m(),b.execute()):Ve(b)},A=function(t,e,i){t.setAttribute("height",i*p),t.setAttribute("width",e*p),t.style.height=i+"px",t.style.width=e+"px"};if(b.setPixelRatio=function(t){p=t,this.ctx.pixelRatio=p,A(this.domEl,this.width,this.height)},b.onResize=function(t){m=t},b.onChange=function(t){g=t},b.toDataURL=function(t){return this.domEl.toDataURL(t)},b.invokeOnChange=function(){},b.setSize=function(t,e){u=e,y=t,o=t,r=e,this.width=o,this.height=r,A(this.domEl,o,r),this.execute()},b.setViewBox=function(t,e,i,n){},b.getPixels=function(t,e,i,n){return new _i(this.ctx.getImageData(t,e,i,n),i,n)},b.putPixels=function(t,e,i){if(t instanceof _i)return this.ctx.putImageData(t.imageData,e,i)},b.clear=function(){f()},b.setContext=function(t,e){this.ctx[t]&&"function"==typeof this.ctx[t]?this.ctx[t].apply(null,e):this.ctx[t]&&(this.ctx[t]=e)},b.createPattern=Ni,b.createClip=Oi,b.createMask=Ii,b.execute=function(){f(a),a.setTransform(p,0,0,p,0,0),this.updateBBox(),w(),g&&this.stateModified&&g(),this.stateModified=!1},b.update=function(){this.execute()},b.createTexture=function(t){return new rn(this,t)},b.createAsyncTexture=function(t){return new Promise(((e,i)=>{const n=new rn(this,t);n.onLoad((function(){e(n)}))}))},b.destroy=function(){const e=document.querySelector(t);e&&e.contains(s)&&e.removeChild(s),wi.removeVdom(v),Ve(b,B)},h){const t=new Nt(b);s.addEventListener("mousemove",(e=>{e.preventDefault(),t.mousemoveCheck(e)})),s.addEventListener("mousedown",(e=>{t.mousedownCheck(e)})),s.addEventListener("mouseup",(e=>{t.mouseupCheck(e)})),s.addEventListener("mouseleave",(e=>{t.mouseleaveCheck(e)})),s.addEventListener("contextmenu",(e=>{t.contextmenuCheck(e)})),s.addEventListener("touchstart",(e=>{t.touchstartCheck(e)})),s.addEventListener("touchend",(e=>{t.touchendCheck(e)})),s.addEventListener("touchmove",(e=>{e.preventDefault(),t.touchmoveCheck(e)})),s.addEventListener("touchcancel",(e=>{t.touchcancelCheck(e)})),s.addEventListener("wheel",(e=>{t.wheelEventCheck(e)})),s.addEventListener("pointerdown",(e=>{t.addPointer(e),t.pointerdownCheck(e)})),s.addEventListener("pointerup",(e=>{t.removePointer(e),t.pointerupCheck(e)})),s.addEventListener("pointermove",(e=>{e.preventDefault(),t.pointermoveCheck(e)}))}return wi.execute(),l&&b.container&&He(b,B),b}function tn(t,e){const i=document.createElement("canvas");i.setAttribute("height",e),i.setAttribute("width",t),this.canvas=i,this.context=this.canvas.getContext("2d")}function en(t,e){const i=new Image;return i.crossOrigin="anonymous",i.src=e,t?(i.onload=function(){t&&(t.attr&&(t.attr.height=t.attr.height?t.attr.height:this.naturalHeight,t.attr.width=t.attr.width?t.attr.width:this.naturalWidth),t instanceof rn&&t.setSize(t.attr.width,t.attr.height),t.imageObj=this,t.attr&&t.attr.onload&&"function"==typeof t.attr.onload&&t.attr.onload.call(t,t.image),t.asyncOnLoad&&"function"==typeof t.asyncOnLoad&&t.asyncOnLoad(t.image),nn(t))},i.onerror=function(e){console.error(e),t.nodeExe.attr.onerror&&"function"==typeof t.nodeExe.attr.onerror&&t.nodeExe.attr.onerror.call(t.nodeExe,e),t.asyncOnLoad&&"function"==typeof t.asyncOnLoad&&t.asyncOnLoad(t.image)},i):i}function nn(t){t.imageObj&&(t.attr&&t.attr.clip?function(t){const e=t.ctx,{clip:i,width:n=0,height:r=0}=t.attr,{sx:o=0,sy:s=0,swidth:a=n,sheight:h=r}=i;e.clearRect(0,0,n,r),e.drawImage(t.imageObj,o,s,a,h,0,0,n,r)}(t):t.execute(),t.attr&&t.attr.filter&&function(t){const e=t.ctx,{width:i=0,height:n=0}=t.attr,r=e.getImageData(0,0,i,n);e.putImageData(t.attr.filter(r),0,0)}(t),wi.vDomChanged(t.nodeExe.vDomIndex))}function rn(t,e={}){const i=this;i.attr=Object.assign({},e.attr)||{},i.style=Object.assign({},e.style)||{};const n=i.attr.scale||1;i.rImageObj=new tn((i.attr.width||1)*n,(i.attr.height||1)*n),i.ctx=i.rImageObj.context,i.domEl=i.rImageObj.canvas,i.imageArray=[],i.seekIndex=0,i.nodeName="Sprite",i.nodeExe=t;for(const t in i.attr)i.setAttr(t,i.attr[t]);wi.vDomChanged(t.vDomIndex)}function on(t,e=0,i=0){if(!Canvas)return console.error("Canvas missing from node"),console.error('Install "Canvas" "canvas-5-polyfill" node modules'),void console.error('Make "Canvas" "Image" "Path2D" objects global from the above modules');let n;const r=new Canvas(i,e);let o=r.getContext("2d",t);const s=Si(o);let a=function(t){t.clearRect(0,0,i*s,e*s)};const h=new x,c=wi.addVdom(h),l=new Qi(o,{el:"g",attr:{id:"rootNode"}},ki(),c);h.rootNode(l);const p=l.execute.bind(l);return l.domEl=r,l.height=e,l.width=i,l.type="CANVAS",l.ENV="NODE",l.setClear=function(t){a=t},l.onChange=function(t){n=t},l.getPixels=function(t,e,i,n){return this.ctx.getImageData(t,e,i,n)},l.putPixels=function(t,e,i){return this.ctx.putImageData(t,e,i)},l.clear=function(){a()},l.setContext=function(t,e){this.ctx[t]&&"function"==typeof this.ctx[t]?this.ctx[t].apply(null,e):this.ctx[t]&&(this.ctx[t]=e)},l.setSize=function(n,r){i=n,e=r,this.domEl=new Canvas(i,e),o=this.domEl.getContext("2d",t),this.width=i,this.height=e,this.ctx=o,this.execute()},l.execute=function(){a(o),o.setTransform(s,0,0,s,0,0),l.updateBBox(),p()},l.execute=function(){a(o),o.setTransform(s,0,0,s,0,0),this.updateBBox(),p(),n&&this.stateModified&&n(),this.stateModified=!1},l.update=function(){this.execute()},l.toDataURL=function(t){return this.domEl.toDataURL(t)},l.getPixels=function(t,e,i,n){return new _i(this.ctx.getImageData(t,e,i,n),i,n)},l.putPixels=function(t,e,i){if(t instanceof _i)return this.ctx.putImageData(t.imageData,e,i)},l.clear=function(){a()},l.createTexture=function(t){return new rn(this,t)},l.createAsyncTexture=function(t){return new Promise(((e,i)=>{const n=new rn(this,t);n.onLoad((function(){e(n)}))}))},l.setContext=function(t,e){this.ctx[t]&&"function"==typeof this.ctx[t]?this.ctx[t].apply(null,e):this.ctx[t]&&(this.ctx[t]=e)},l.createPattern=Ni,l.createClip=Oi,l.createMask=Ii,l}Qi.prototype=new je,Qi.prototype.node=function(){return this.updateBBox(),this.dom},Qi.prototype.stylesExe=function(){let t,e;const i=this.style;for(e in i)"string"==typeof i[e]||"number"==typeof i[e]?t=i[e]:"object"==typeof i[e]?t=i[e]instanceof Mi||i[e]instanceof Li||i[e]instanceof Pi||i[e]instanceof zi?i[e].exe(this.ctx,this.dom.BBox):i[e]:"function"==typeof i[e]?(i[e]=i[e].call(this,this.dataObj),t=i[e]):console.log("unkonwn Style"),"function"!=typeof this.ctx[e]?this.ctx[e]=t:"function"==typeof this.ctx[e]?this.ctx[e](t):console.log("junk comp")},Qi.prototype.remove=function(){const{children:t}=this.dom.parent,e=t.indexOf(this);-1!==e&&t.splice(e,1),this.dom.parent.BBoxUpdate=!0,wi.vDomChanged(this.vDomIndex)},Qi.prototype.attributesExe=function(){this.dom.render(this.attr)},Qi.prototype.setStyle=function(t,e){if(2===arguments.length)null==e&&null!=this.style[t]?delete this.style[t]:this.style[t]=Ji(e);else if(1===arguments.length&&"object"==typeof t){const e=Object.keys(t);for(let i=0,n=e.length;i<n;i+=1)null==t[e[i]]&&null!=this.style[e[i]]?delete this.style[e[i]]:this.style[e[i]]=Ji(t[e[i]])}return wi.vDomChanged(this.vDomIndex),this},Qi.prototype.setAttr=function(t,e){if(2===arguments.length)null==e&&null!=this.attr[t]?delete this.attr[t]:this.attr[t]=e,this.dom.setAttr(t,e);else if(1===arguments.length&&"object"==typeof t){const e=Object.keys(t);for(let i=0;i<e.length;i+=1)null==t[e[i]]&&null!=this.attr[e[i]]?delete this.attr[e[i]]:this.attr[e[i]]=t[e[i]],this.dom.setAttr(e[i],t[e[i]])}return this.BBoxUpdate=!0,wi.vDomChanged(this.vDomIndex),this},Qi.prototype.rotate=function(t,e,i){return this.attr.transform||(this.attr.transform={}),"[object Array]"===Object.prototype.toString.call(t)?this.attr.transform.rotate=[t[0]||0,t[1]||0,t[2]||0]:this.attr.transform.rotate=[t,e||0,i||0],this.dom.setAttr("transform",this.attr.transform),this.BBoxUpdate=!0,wi.vDomChanged(this.vDomIndex),this},Qi.prototype.scale=function(t){return this.attr.transform||(this.attr.transform={}),t.length<1?null:(this.attr.transform.scale=[t[0],t[1]?t[1]:t[0]],this.dom.setAttr("transform",this.attr.transform),this.BBoxUpdate=!0,wi.vDomChanged(this.vDomIndex),this)},Qi.prototype.translate=function(t){return this.attr.transform||(this.attr.transform={}),this.attr.transform.translate=t,this.dom.setAttr("transform",this.attr.transform),this.BBoxUpdate=!0,wi.vDomChanged(this.vDomIndex),this},Qi.prototype.skewX=function(t){return this.attr.transform||(this.attr.transform={}),this.attr.transform.skew||(this.attr.transform.skew=[]),this.attr.transform.skew[0]=t,this.dom.setAttr("transform",this.attr.transform),this.BBoxUpdate=!0,wi.vDomChanged(this.vDomIndex),this},Qi.prototype.skewY=function(t){return this.attr.transform||(this.attr.transform={}),this.attr.transform.skew||(this.attr.transform.skew=[]),this.attr.transform.skew[1]=t,this.dom.setAttr("transform",this.attr.transform),this.BBoxUpdate=!0,wi.vDomChanged(this.vDomIndex),this},Qi.prototype.execute=function(){if("none"!==this.style.display){if(this.ctx.save(),this.stylesExe(),this.attributesExe(),this.dom instanceof $i)for(let t=0,e=this.children.length;t<e;t+=1)this.children[t].execute();this.ctx.restore()}},Qi.prototype.prependChild=function(t){const e=this,i=t;if(e.dom instanceof $i)for(let t=0;t<i.length;t+=1)i[t].dom.parent=e,e.children.unshift(i[t]);else console.error("Trying to insert child to nonGroup Element");return this.BBoxUpdate=!0,wi.vDomChanged(this.vDomIndex),e},Qi.prototype.child=function(t){const e=this,i=t;if(e.dom instanceof $i)for(let t=0;t<i.length;t+=1)i[t].dom.parent=e,e.children[e.children.length]=i[t];else console.error("Trying to insert child to nonGroup Element");return this.BBoxUpdate=!0,wi.vDomChanged(this.vDomIndex),e},Qi.prototype.updateBBox=function(){let t;if(this.bbox){for(let e=0,i=this.children.length;e<i;e+=1)this.children[e]&&(t=this.children[e].updateBBox()||t);if(this.BBoxUpdate||t)return this.dom.updateBBox(this.children),this.BBoxUpdate=!1,!0}return!1},Qi.prototype.in=function(t){return this.dom.in(t)},Qi.prototype.on=function(t,e){const i=this;if(this.events||(this.events={}),!e&&this.events[t])delete this.events[t];else if(e)if("function"==typeof e){const n=e.bind(i);this.events[t]=function(t){n(t)}}else"object"==typeof e&&(this.events[t]=e,e.constructor!==Ai.constructor&&e.constructor!==Ti.constructor||e.bindMethods(this));return this},Qi.prototype.animatePathTo=Dt.animatePathTo,Qi.prototype.morphTo=Dt.morphTo,Qi.prototype.vDomIndex=null,Qi.prototype.createRadialGradient=function(t){return new Mi(t,"radial")},Qi.prototype.createLinearGradient=function(t){return new Mi(t,"linear")},Qi.prototype.createEls=function(t,e){const i=new Ei({type:"CANVAS",ctx:this.dom.ctx},t,e,this.vDomIndex);return this.child(i.stack),wi.vDomChanged(this.vDomIndex),i},Qi.prototype.text=function(t){return this.dom instanceof ji&&this.dom.text(t),wi.vDomChanged(this.vDomIndex),this},Qi.prototype.createEl=function(t){const e=new Qi(this.dom.ctx,t,ki(),this.vDomIndex);return this.child([e]),wi.vDomChanged(this.vDomIndex),e},Qi.prototype.removeChild=function(t){let e=-1;if(this.children.forEach(((i,n)=>{i===t&&(e=n)})),-1!==e){const t=this.children.splice(e,1)[0];this.dom.removeChild(t.dom)}this.BBoxUpdate=!0,wi.vDomChanged(this.vDomIndex)},Qi.prototype.getBBox=function(){return{x:this.dom.BBox.x,y:this.dom.BBox.y,width:this.dom.BBox.width,height:this.dom.BBox.height}},Qi.prototype.getPixels=function(){return new _i(this.ctx.getImageData(this.dom.BBox.x,this.dom.BBox.y,this.dom.BBox.width,this.dom.BBox.height),this.dom.BBox.width,this.dom.BBox.height)},Qi.prototype.putPixels=function(t){if(t instanceof _i)return this.ctx.putImageData(t.imageData,this.dom.BBox.x,this.dom.BBox.y)},tn.prototype.setAttr=function(t,e){"height"===t?this.canvas.setAttribute("height",e):"width"===t&&this.canvas.setAttribute("width",e)},rn.prototype=new je,rn.prototype.constructor=rn,rn.prototype.setSize=function(t,e){const i=this.attr.scale||1;this.rImageObj.setAttr("width",t*i),this.rImageObj.setAttr("height",e*i),nn(this)},rn.prototype.setAttr=function(t,e){const i=this;if("src"===t)if(Array.isArray(e)){const t=e.map((function(t){return new Promise(((e,i)=>{const n=en(null,t);n.onload=function(){e(this)},n.onerror=function(t){i(t)}}))}));Promise.all(t).then((function(t){i.image=t,i.imageObj=t[i.seekIndex],i.attr&&i.attr.onload&&"function"==typeof i.attr.onload&&i.attr.onload.call(i,t),i.asyncOnLoad&&"function"==typeof i.asyncOnLoad&&i.asyncOnLoad(t),nn(i)}))}else"string"==typeof e?(i.image||(i.image=en(i,e)),i.image.src!==e&&(i.image.src=e)):e instanceof HTMLImageElement||e instanceof SVGImageElement||e instanceof HTMLCanvasElement?(i.imageObj=e,i.attr.height=i.attr.height?i.attr.height:e.height,i.attr.width=i.attr.width?i.attr.width:e.width,nn(i)):(e instanceof Qi||e instanceof rn)&&(i.imageObj=e.domEl,i.attr.height=i.attr.height?i.attr.height:e.attr.height,i.attr.width=i.attr.width?i.attr.width:e.attr.width,nn(i));this.attr[t]=e,"height"!==t&&"width"!==t||(this.rImageObj.setAttr(t,e),nn(i)),"clip"!==t&&"filter"!==t||nn(i)},rn.prototype.onLoad=function(t){this.asyncOnLoad=t},rn.prototype.clone=function(){const t=Object.assign({},this.attr),e=Object.assign({},this.style);return t.src=this,new rn(this.nodeExe,{attr:t,style:e})},rn.prototype.execute=function(){const{width:t=0,height:e=0}=this.attr,i=this.attr.draw||{},n=this.attr.scale||1;this.ctx.clearRect(0,0,t*n,e*n),this.ctx.drawImage(this.imageObj,i.x||0,i.y||0,(i.width||t)*n,(i.height||e)*n)},rn.prototype.next=function(t){Array.isArray(this.image)&&(t<this.image.length&&t>=0?this.seekIndex=t:this.seekIndex<this.image.length-1&&this.seekIndex++,this.imageObj=this.image[this.seekIndex],nn(this))};var sn=Ki,an=on;function hn(t){let e;switch(t){case"point":e={vertexShader:"\n          precision highp float;\n          attribute vec2 a_position;\n          attribute vec4 a_color;\n          attribute float a_size;\n          \n          attribute mat3 a_transformMatrix;\n          \n          varying vec4 v_color;\n          void main() {\n            gl_Position = vec4(a_transformMatrix * vec3(a_position, 1), 1);\n            gl_PointSize = a_size;\n            v_color = a_color;\n          }\n          ",fragmentShader:"\n                    precision mediump float;\n                    varying vec4 v_color;\n                    void main() {\n                        gl_FragColor = v_color;\n                    }\n                    "};break;case"circle":e={vertexShader:"\n                  precision highp float;\n                    attribute vec2 a_position;\n                    attribute vec4 a_color;\n                    attribute float a_radius;\n                    attribute mat3 a_transformMatrix;\n                    varying vec4 v_color;\n\n                    void main() {\n                      gl_Position = vec4(a_transformMatrix * vec3(a_position, 1), 1);\n                      gl_PointSize = a_radius; // * a_transform.z * u_transform.z;\n                      v_color = a_color;\n                    }\n                    ",fragmentShader:"\n                    precision mediump float;\n                    varying vec4 v_color;\n                    void main() {\n                      float r = 0.0, delta = 0.0, alpha = 1.0;\n                      vec2 cxy = 2.0 * gl_PointCoord - 1.0;\n                      r = dot(cxy, cxy);\n                      if(r > 1.0) {\n                        discard;\n                      }\n                      delta = 0.09;\n                      alpha = 1.0 - smoothstep(1.0 - delta, 1.0 + delta, r);\n                      gl_FragColor = v_color * alpha;\n                    }\n                    "};break;case"image":e={vertexShader:"\n                    precision highp float;\n                    attribute vec2 a_position;\n                    attribute vec2 a_texCoord;\n                    uniform mat3 u_transformMatrix;\n                    varying vec2 v_texCoord;\n\n                    void main() {\n                      gl_Position = vec4(u_transformMatrix * vec3(a_position, 1), 1);\n                      v_texCoord = a_texCoord;\n                    }\n          ",fragmentShader:"\n                    precision mediump float;\n                    uniform sampler2D u_image;\n                    uniform float u_opacity;\n                    varying vec2 v_texCoord;\n                    void main() {\n                      vec4 col = texture2D(u_image, v_texCoord);\n                      if (col.a == 0.0) {\n                        discard;\n                      } else {\n                        gl_FragColor = col;\n                        gl_FragColor.a *= u_opacity;\n                      }\n                    }\n                    "};break;case"polyline":case"polygon":e={vertexShader:"\n                    precision highp float;\n                    attribute vec2 a_position;\n                    uniform mat3 u_transformMatrix;\n\n                    void main() {\n                      gl_Position = vec4(u_transformMatrix * vec3(a_position, 1), 1);\n                    }\n                    ",fragmentShader:"\n                    precision mediump float;\n                    uniform vec4 u_color;\n                    void main() {\n                        gl_FragColor = u_color;\n                    }\n                    "};break;case"rect":case"line":e={vertexShader:"\n                    precision highp float;\n                    attribute vec2 a_position;\n                    attribute vec4 a_color;\n                    attribute mat3 a_transformMatrix;\n                    varying vec4 v_color;\n\n                    void main() {\n                      gl_Position = vec4(a_transformMatrix * vec3(a_position, 1), 1);\n                      v_color = a_color;\n                    }\n                    ",fragmentShader:"\n                    precision mediump float;\n                    varying vec4 v_color;\n                    void main() {\n                        gl_FragColor = v_color;\n                    }\n                    "};break;default:e={vertexShader:"\n                    precision highp float;\n                    attribute vec2 a_position;\n                    attribute vec4 a_color;\n                    attribute mat3 a_transformMatrix;\n                    varying vec4 v_color;\n\n                    void main() {\n                      gl_Position = vec4(a_transformMatrix * vec3(a_position, 1), 1);\n                      v_color = a_color;\n                    }\n                    ",fragmentShader:"\n                    precision mediump float;\n                    varying vec4 v_color;\n                    void main() {\n                        gl_FragColor = v_color;\n                    }\n                    "}}return e}var cn=pn,ln=pn;function pn(t,e,i){i=i||2;var n,r,o,s,a,h,c,l=e&&e.length,p=l?e[0]*i:t.length,d=dn(t,0,p,i,!0),f=[];if(!d||d.next===d.prev)return f;if(l&&(d=function(t,e,i,n){var r,o,s,a=[];for(r=0,o=e.length;r<o;r++)(s=dn(t,e[r]*n,r<o-1?e[r+1]*n:t.length,n,!1))===s.next&&(s.steiner=!0),a.push(An(s));for(a.sort(vn),r=0;r<a.length;r++)bn(a[r],i),i=fn(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=o=t[0],r=s=t[1];for(var u=i;u<p;u+=i)(a=t[u])<n&&(n=a),(h=t[u+1])<r&&(r=h),a>o&&(o=a),h>s&&(s=h);c=0!==(c=Math.max(o-n,s-r))?1/c:0}return un(d,f,i,n,r,c),f}function dn(t,e,i,n,r){var o,s;if(r===Ln(t,e,i,n)>0)for(o=e;o<i;o+=n)s=In(o,t[o],t[o+1],s);else for(o=i-n;o>=e;o-=n)s=In(o,t[o],t[o+1],s);return s&&Sn(s,s.next)&&(Pn(s),s=s.next),s}function fn(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!Sn(n,n.next)&&0!==En(n.prev,n,n.next))n=n.next;else{if(Pn(n),(n=e=n.prev)===n.next)break;i=!0}}while(i||n!==e);return e}function un(t,e,i,n,r,o,s){if(t){!s&&o&&function(t,e,i,n){var r=t;do{null===r.z&&(r.z=Bn(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,i,n,r,o,s,a,h,c=1;do{for(i=t,t=null,o=null,s=0;i;){for(s++,n=i,a=0,e=0;e<c&&(a++,n=n.nextZ);e++);for(h=c;a>0||h>0&&n;)0!==a&&(0===h||!n||i.z<=n.z)?(r=i,i=i.nextZ,a--):(r=n,n=n.nextZ,h--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;i=n}o.nextZ=null,c*=2}while(s>1)}(r)}(t,n,r,o);for(var a,h,c=t;t.prev!==t.next;)if(a=t.prev,h=t.next,o?xn(t,n,r,o):yn(t))e.push(a.i/i),e.push(t.i/i),e.push(h.i/i),Pn(t),t=h.next,c=h.next;else if((t=h)===c){s?1===s?un(t=mn(fn(t),e,i),e,i,n,r,o,2):2===s&&gn(t,e,i,n,r,o):un(fn(t),e,i,n,r,o,1);break}}}function yn(t){var e=t.prev,i=t,n=t.next;if(En(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(Tn(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&En(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function xn(t,e,i,n){var r=t.prev,o=t,s=t.next;if(En(r,o,s)>=0)return!1;for(var a=r.x<o.x?r.x<s.x?r.x:s.x:o.x<s.x?o.x:s.x,h=r.y<o.y?r.y<s.y?r.y:s.y:o.y<s.y?o.y:s.y,c=r.x>o.x?r.x>s.x?r.x:s.x:o.x>s.x?o.x:s.x,l=r.y>o.y?r.y>s.y?r.y:s.y:o.y>s.y?o.y:s.y,p=Bn(a,h,e,i,n),d=Bn(c,l,e,i,n),f=t.prevZ,u=t.nextZ;f&&f.z>=p&&u&&u.z<=d;){if(f!==t.prev&&f!==t.next&&Tn(r.x,r.y,o.x,o.y,s.x,s.y,f.x,f.y)&&En(f.prev,f,f.next)>=0)return!1;if(f=f.prevZ,u!==t.prev&&u!==t.next&&Tn(r.x,r.y,o.x,o.y,s.x,s.y,u.x,u.y)&&En(u.prev,u,u.next)>=0)return!1;u=u.nextZ}for(;f&&f.z>=p;){if(f!==t.prev&&f!==t.next&&Tn(r.x,r.y,o.x,o.y,s.x,s.y,f.x,f.y)&&En(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;u&&u.z<=d;){if(u!==t.prev&&u!==t.next&&Tn(r.x,r.y,o.x,o.y,s.x,s.y,u.x,u.y)&&En(u.prev,u,u.next)>=0)return!1;u=u.nextZ}return!0}function mn(t,e,i){var n=t;do{var r=n.prev,o=n.next.next;!Sn(r,o)&&Cn(r,n,n.next,o)&&_n(r,o)&&_n(o,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(o.i/i),Pn(n),Pn(n.next),n=t=o),n=n.next}while(n!==t);return fn(n)}function gn(t,e,i,n,r,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&kn(s,a)){var h=zn(s,a);return s=fn(s,s.next),h=fn(h,h.next),un(s,e,i,n,r,o),void un(h,e,i,n,r,o)}a=a.next}s=s.next}while(s!==t)}function vn(t,e){return t.x-e.x}function bn(t,e){if(e=function(t,e){var i,n=e,r=t.x,o=t.y,s=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var a=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=r&&a>s){if(s=a,a===r){if(o===n.y)return n;if(o===n.next.y)return n.next}i=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!i)return null;if(r===s)return i;var h,c=i,l=i.x,p=i.y,d=1/0;n=i;do{r>=n.x&&n.x>=l&&r!==n.x&&Tn(o<p?r:s,o,l,p,o<p?s:r,o,n.x,n.y)&&(h=Math.abs(o-n.y)/(r-n.x),_n(n,t)&&(h<d||h===d&&(n.x>i.x||n.x===i.x&&wn(i,n)))&&(i=n,d=h)),n=n.next}while(n!==c);return i}(t,e)){var i=zn(e,t);fn(e,e.next),fn(i,i.next)}}function wn(t,e){return En(t.prev,t,e.prev)<0&&En(e.next,t,t.next)<0}function Bn(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function An(t){var e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function Tn(t,e,i,n,r,o,s,a){return(r-s)*(e-a)-(t-s)*(o-a)>=0&&(t-s)*(n-a)-(i-s)*(e-a)>=0&&(i-s)*(o-a)-(r-s)*(n-a)>=0}function kn(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Cn(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(_n(t,e)&&_n(e,t)&&function(t,e){var i=t,n=!1,r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&r<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(En(t.prev,t,e.prev)||En(t,e.prev,e))||Sn(t,e)&&En(t.prev,t,t.next)>0&&En(e.prev,e,e.next)>0)}function En(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Sn(t,e){return t.x===e.x&&t.y===e.y}function Cn(t,e,i,n){var r=Mn(En(t,e,i)),o=Mn(En(t,e,n)),s=Mn(En(i,n,t)),a=Mn(En(i,n,e));return r!==o&&s!==a||(!(0!==r||!Dn(t,i,e))||(!(0!==o||!Dn(t,n,e))||(!(0!==s||!Dn(i,t,n))||!(0!==a||!Dn(i,e,n)))))}function Dn(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Mn(t){return t>0?1:t<0?-1:0}function _n(t,e){return En(t.prev,t,t.next)<0?En(t,e,t.next)>=0&&En(t,t.prev,e)>=0:En(t,e,t.prev)<0||En(t,t.next,e)<0}function zn(t,e){var i=new On(t.i,t.x,t.y),n=new On(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,o.next=n,n.prev=o,n}function In(t,e,i,n){var r=new On(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Pn(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function On(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ln(t,e,i,n){for(var r=0,o=e,s=i-n;o<i;o+=n)r+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return r}pn.deviation=function(t,e,i,n){var r=e&&e.length,o=r?e[0]*i:t.length,s=Math.abs(Ln(t,0,o,i));if(r)for(var a=0,h=e.length;a<h;a++){var c=e[a]*i,l=a<h-1?e[a+1]*i:t.length;s-=Math.abs(Ln(t,c,l,i))}var p=0;for(a=0;a<n.length;a+=3){var d=n[a]*i,f=n[a+1]*i,u=n[a+2]*i;p+=Math.abs((t[d]-t[u])*(t[f+1]-t[d+1])-(t[d]-t[f])*(t[u+1]-t[d+1]))}return 0===s&&0===p?0:Math.abs((p-s)/s)},pn.flatten=function(t){for(var e=t[0][0].length,i={vertices:[],holes:[],dimensions:e},n=0,r=0;r<t.length;r++){for(var o=0;o<t[r].length;o++)for(var s=0;s<e;s++)i.vertices.push(t[r][o][s]);r>0&&(n+=t[r-1].length,i.holes.push(n))}return i},cn.default=ln;const Nn=N;let Fn;const Rn=y,jn=vi.zoom(),Xn=vi.drag();let Gn=0;function Yn(){return Gn+=1,Gn}function Un(t){const e={translateX:0,translateY:0,scaleX:1,scaleY:1,angle:0};return t&&(t.translate&&t.translate.length>0&&(e.translateX=t.translate[0],e.translateY=t.translate[1]),t.scale&&t.scale.length>0&&(e.scaleX=t.scale[0],e.scaleY=t.scale[1]||e.scaleX),t.rotate&&t.rotate.length>0&&(e.angle=t.rotate[0])),e}function Hn(){const t=this,{transform:e,points:i=[]}=t.attr,{translateX:n,translateY:r,scaleX:o,scaleY:s}=Un(e);if(i&&i.length>0){let e=i[0].x,a=i[0].x,h=i[0].y,c=i[0].y;for(let t=1;t<i.length;t+=1)e>i[t].x&&(e=i[t].x),a<i[t].x&&(a=i[t].x),h>i[t].y&&(h=i[t].y),c<i[t].y&&(c=i[t].y);t.BBox={x:n+e*o,y:r+h*s,width:(a-e)*o,height:(c-h)*s}}else t.BBox={x:0,y:0,width:0,height:0};e&&e.rotate?t.BBoxHit=Nn.rotateBBox(this.BBox,e):t.BBoxHit=this.BBox}var Vn=function(t,e){var i=t[0],n=t[1],r=t[2],o=t[3],s=t[4],a=t[5],h=t[6],c=t[7],l=t[8],p=e[0],d=e[1],f=e[2],u=e[3],y=e[4],x=e[5],m=e[6],g=e[7],v=e[8];return[p*i+d*o+f*h,p*n+d*s+f*c,p*r+d*a+f*l,u*i+y*o+x*h,u*n+y*s+x*c,u*r+y*a+x*l,m*i+g*o+v*h,m*n+g*s+v*c,m*r+g*a+v*l]},qn=function(t,e,i){return i&&i[6]===t&&i[7]===e?i:[1,0,0,0,1,0,t,e,1]},Zn=function(t){var e=Math.cos(t),i=Math.sin(t);return[e,-i,0,i,e,0,0,0,1]},Wn=function(t,e){return[t,0,0,0,e,0,0,0,1]},$n=function(){return[1,0,0,0,1,0,0,0,1]},Qn=function(t,e){return[2/t,0,0,0,-2/e,0,-1,1,1]};function Jn(t){const e=this.attr.transform;let i=t||this.projectionMatrix;if(e&&e.translate&&(this.translationMatrix=qn(e.translate[0],e.translate[1],this.translationMatrix),i=Vn(i,this.translationMatrix)),e&&e.rotate){const t=Math.PI/180*e.rotate[0];this.rotationMatrix=Zn(t),this.rotationCentric=qn(e.rotate[1]||0,e.rotate[2]||0,this.rotationCentric),i=Vn(i,this.rotationMatrix)}e&&e.scale&&(this.scaleMatrix=Wn(e.scale[0],e.scale[1]),i=Vn(i,this.scaleMatrix)),this.rotationCentric&&(i=Vn(i,this.rotationCentric)),this.transformMatrix=i}const Kn=function(){Ye.apply(this,arguments)};function tr(t,e,i){var n=t.createShader(i);if(t.shaderSource(n,e),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS)){var r=t.getShaderInfoLog(n);return console.error("*** Error compiling shader '"+n+"':"+r),t.deleteShader(n),null}return n}function er(t,e){return function(t,e){var i=t.createProgram();if(e.forEach((function(e){t.attachShader(i,e)})),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS)){var n=t.getProgramInfoLog(i);return console.error("Error in program linking:"+n),t.deleteProgram(i),null}return i}(t,[tr(t,e.vertexShader,t.VERTEX_SHADER),tr(t,e.fragmentShader,t.FRAGMENT_SHADER)])}function ir(){this.BBox={x:0,y:0,width:0,height:0},this.BBoxHit={x:0,y:0,width:0,height:0}}function nr(t,e,i){this.ctx=t,this.attr=e||{},this.style=i||{},this.projectionMatrix=Qn(this.ctx.canvas.width/Fn,this.ctx.canvas.height/Fn),this.transformMatrix=Vn(this.projectionMatrix,$n()),this.attr.transform&&this.exec(Jn,null)}function rr(t,e,i){this.ctx=t,this.attr=e||{},this.style=i||{},this.projectionMatrix=Qn(this.ctx.canvas.width/Fn,this.ctx.canvas.height/Fn),this.transformMatrix=Vn(this.projectionMatrix,$n()),this.attr.transform&&this.exec(Jn,null)}function or(t,e,i){const n=this;this.ctx=t,this.attr=e,this.style=i,this.pointsGeometry=[],this.transform=[0,0,1,1],this.projectionMatrix=Qn(this.ctx.canvas.width/Fn,this.ctx.canvas.height/Fn),n.attr.d&&(Dt.isTypePath(n.attr.d)?(n.path=n.attr.d,n.attr.d=n.attr.d.fetchPathString()):n.path=Dt.instance(n.attr.d),this.points=new Float32Array(this.path.getPoints())),this.style.stroke&&(this.color=new Float32Array([this.style.stroke.r/255,this.style.stroke.g/255,this.style.stroke.b/255,void 0===this.style.stroke.a?1:this.style.stroke.a/255])),this.transformMatrix=Vn(this.projectionMatrix,$n()),this.attr.transform&&this.exec(Jn,null)}function sr(t,e,i){this.ctx=t,this.attr=e||{},this.style=i||{},this.points=[],this.transform=[0,0,1,1];const n=[];if(this.projectionMatrix=Qn(this.ctx.canvas.width/Fn,this.ctx.canvas.height/Fn),this.attr.points){const t=this.attr.points;for(let e=0,i=t.length;e<i;e++)n[2*e]=t[e].x,n[2*e+1]=t[e].y;this.points=new Float32Array(n)}this.style.stroke&&(this.color=new Float32Array([this.style.stroke.r/255,this.style.stroke.g/255,this.style.stroke.b/255,void 0===this.style.stroke.a?1:this.style.stroke.a/255])),this.transformMatrix=Vn(this.projectionMatrix,$n()),this.attr.transform&&this.exec(Jn,null)}function ar(t,e,i){this.ctx=t,this.attr=e||{},this.style=i||{},this.projectionMatrix=Qn(this.ctx.canvas.width/Fn,this.ctx.canvas.height/Fn),this.transformMatrix=Vn(this.projectionMatrix,$n()),this.attr.transform&&this.exec(Jn,null)}function hr(t){return cn(t.reduce((function(t,e){return t[t.length]=e.x,t[t.length]=e.y,t}),[])).map((function(e){return t[e]}))}function cr(t,e,i){this.ctx=t,this.attr=e,this.style=i,this.positionArray=[],this.transform=[0,0,1,1];const n=[];if(this.projectionMatrix=Qn(this.ctx.canvas.width/Fn,this.ctx.canvas.height/Fn),this.attr.points){const t=hr(this.attr.points);for(let e=0,i=t.length;e<i;e++)n[2*e]=t[e].x,n[2*e+1]=t[e].y;this.points=new Float32Array(n)}this.style.fill&&(this.color=new Float32Array([this.style.stroke.r/255,this.style.stroke.g/255,this.style.stroke.b/255,void 0===this.style.stroke.a?1:this.style.stroke.a/255])),this.transformMatrix=Vn(this.projectionMatrix,$n()),this.attr.transform&&this.exec(Jn,null)}function lr(t,e,i){this.ctx=t,this.attr=e,this.style=i,this.projectionMatrix=Qn(this.ctx.canvas.width/Fn,this.ctx.canvas.height/Fn),this.transformMatrix=Vn(this.projectionMatrix,$n()),this.attr.transform&&this.exec(Jn,null)}(Kn.prototype=new Ye).constructor=Kn,Kn.prototype.createNode=function(t,e,i){return new Gr(t,e,Yn(),i)},ir.prototype.exec=function(t,e){"function"!=typeof t&&console.error("Wrong Exe type"),t.call(this,e)},ir.prototype.setStyle=function(t,e){e?(this.style[t]=e,this.shader&&"fill"===t&&(void 0!==this.style.opacity&&(e.a*=this.style.opacity),this.shader.indexBased&&this.shader.updateColor(this.pindex,e)),this.shader&&"opacity"===t&&(void 0!==this.style.fill&&(this.style.fill.a*=this.style.opacity),this.shader.updateColor(this.pindex,this.style.fill))):this.style[t]&&delete this.style[t]},ir.prototype.getAttr=function(t){return this.attr[t]},ir.prototype.getStyle=function(t){return this.style[t]},nr.prototype=new ir,nr.prototype.constructor=nr,nr.prototype.setShader=function(t){this.shader=t,this.shader&&(this.shader.addVertex(this.attr.x||0,this.attr.y||0,this.pindex),this.shader.addColors(this.style.fill||mr,this.pindex),this.shader.addSize(this.attr.size||0,this.pindex),this.shader.addTransform(this.transformMatrix,this.pindex))},nr.prototype.setAttr=function(t,e){this.attr[t]=e,"transform"===t&&this.exec(Jn,this.p_matrix),this.shader&&("x"===t||"y"===t?this.shader.updateVertex(this.pindex,this.attr.x,this.attr.y):"size"===t?this.shader.updateSize(this.pindex,this.attr.size||0):"transform"===t&&this.shader.updateTransform(this.pindex,this.transformMatrix))},nr.prototype.applyTransformationMatrix=function(t){this.p_matrix=t,this.exec(Jn,t),this.shader&&this.shader.addTransform(this.transformMatrix,this.pindex)},nr.prototype.in=function(t){const{x:e=0,y:i=0,size:n=0}=this.attr;return t.x>=e&&t.x<=e+n&&t.y>=i&&t.y<=i+n},nr.prototype.updateBBox=function(){const t=this,{transform:e,x:i=0,y:n=0,size:r=0}=t.attr,{translateX:o,translateY:s,scaleX:a,scaleY:h}=Un(e);t.BBox={x:o+i*a,y:s+n*h,width:r*a,height:r*h},e&&e.rotate?t.BBoxHit=Nn.rotateBBox(this.BBox,e):t.BBoxHit=this.BBox},rr.prototype=new ir,rr.prototype.constructor=rr,rr.prototype.setShader=function(t){this.shader=t,this.shader&&(this.shader.addVertex(this.attr.x||0,this.attr.y||0,this.attr.width||0,this.attr.height||0,this.pindex),this.shader.addColors(this.style.fill||mr,this.pindex),this.shader.addTransform(this.transformMatrix,this.pindex))},rr.prototype.applyTransformationMatrix=function(t){this.p_matrix=t,this.exec(Jn,t),this.shader&&this.shader.addTransform(this.transformMatrix,this.pindex)},rr.prototype.setAttr=function(t,e){this.attr[t]=e,"transform"===t&&this.exec(Jn,this.p_matrix),this.shader&&("x"===t||"width"===t||"y"===t||"height"===t?this.shader.updateVertex(this.pindex,this.attr.x||0,this.attr.y||0,this.attr.width||0,this.attr.height||0):"transform"===t&&this.shader.updateTransform(this.pindex,this.transformMatrix))},rr.prototype.in=function(t){const{x:e=0,y:i=0,width:n=0,height:r=0}=this.attr;return t.x>=e&&t.x<=e+n&&t.y>=i&&t.y<=i+r},rr.prototype.updateBBox=function(){const t=this,{transform:e,x:i=0,y:n=0,width:r=0,height:o=0}=t.attr,{translateX:s,translateY:a,scaleX:h,scaleY:c}=Un(e);t.BBox={x:s+i*h,y:a+n*c,width:r*h,height:o*c},e&&e.rotate?t.BBoxHit=Nn.rotateBBox(this.BBox,e):t.BBoxHit=this.BBox},or.prototype=new ir,or.prototype.constructor=or,or.prototype.setShader=function(t){this.shader=t},or.prototype.applyTransformationMatrix=function(t){this.p_matrix=t,this.exec(Jn,t)},or.prototype.setAttr=function(t,e){this.attr[t]=e,null!==e?"d"===t?(Dt.isTypePath(e)?(this.path=e,this.attr.d=e.fetchPathString()):this.path=Dt.instance(this.attr.d),this.points=new Float32Array(this.path.getPoints())):"transform"===t&&this.exec(Jn,this.p_matrix):delete this.attr[t]},or.prototype.updateBBox=function(){const t=this,{transform:e}=t.attr,{translateX:i,translateY:n,scaleX:r,scaleY:o}=Un(e);t.BBox=t.path?t.path.BBox:{x:0,y:0,width:0,height:0},t.BBox.x=i+t.BBox.x*r,t.BBox.y=n+t.BBox.y*o,t.BBox.width*=r,t.BBox.height*=o,e&&e.rotate?t.BBoxHit=Nn.rotateBBox(this.BBox,e):t.BBoxHit=this.BBox},sr.prototype=new ir,sr.prototype.constructor=sr,sr.prototype.setShader=function(t){this.shader=t},sr.prototype.applyTransformationMatrix=function(t){this.p_matrix=t,this.exec(Jn,t)},sr.prototype.setAttr=function(t,e){if(this.attr[t]=e,"points"===t){const t=this.attr.points,e=[];for(let i=0,n=t.length;i<n;i++)e[2*i]=t[i].x,e[2*i+1]=t[i].y;this.points=new Float32Array(e)}else"transform"===t&&this.exec(Jn,this.p_matrix)},sr.prototype.updateBBox=Hn,sr.prototype.setStyle=function(t,e){this.style[t]=e,"stroke"===t&&(this.color=new Float32Array([this.style.stroke.r/255,this.style.stroke.g/255,this.style.stroke.b/255,void 0===this.style.stroke.a?1:this.style.stroke.a/255]))},ar.prototype=new ir,ar.prototype.constructor=ar,ar.prototype.setShader=function(t){this.shader=t;const{x1:e=0,y1:i=0,x2:n=e,y2:r=i}=this.attr;this.shader&&(this.shader.addVertex(e,i,n,r,this.pindex),this.shader.addColors(this.style.stroke||mr,this.pindex),this.shader.addTransform(this.transformMatrix,this.pindex))},ar.prototype.applyTransformationMatrix=function(t){this.p_matrix=t,this.exec(Jn,t),this.shader&&this.shader.addTransform(this.transformMatrix,this.pindex)},ar.prototype.setAttr=function(t,e){this.attr[t]=e,null!==e||null===this.attr[t]?("transform"===t&&this.exec(Jn,this.p_matrix),!this.shader||"x1"!==t&&"y1"!==t&&"x2"!==t&&"y2"!==t?this.shader&&"transform"===t&&this.shader.updateTransform(this.pindex,this.transformMatrix):this.shader.updateVertex(this.pindex,this.attr.x1,this.attr.y1,this.attr.x2,this.attr.y2)):delete this.attr[t]},ar.prototype.updateBBox=function(){const t=this,{transform:e,x1:i=0,y1:n=0,x2:r=0,y2:o=0}=t.attr,{translateX:s,translateY:a,scaleX:h,scaleY:c}=Un(e);t.BBox={x:s+(i<r?i:r)*h,y:a+(n<o?n:o)*c,width:Math.abs(r-i)*h,height:Math.abs(o-n)*c},e&&e.rotate?t.BBoxHit=Nn.rotateBBox(this.BBox,e):t.BBoxHit=this.BBox},cr.prototype=new ir,cr.prototype.constructor=cr,cr.prototype.setShader=function(t){this.shader=t},cr.prototype.applyTransformationMatrix=function(t){this.p_matrix=t,this.exec(Jn,t)},cr.prototype.setAttr=function(t,e){if(this.attr[t]=e,null!==e)if("points"===t){const t=[],i=hr(e);for(let e=0,n=i.length;e<n;e++)t[2*e]=i[e].x,t[2*e+1]=i[e].y;this.points=new Float32Array(t)}else"transform"===t&&this.exec(Jn,this.p_matrix);else delete this.attr[t]},cr.prototype.setStyle=function(t,e){this.style[t]=e,"fill"===t&&(this.color=new Float32Array([this.style.fill.r/255,this.style.fill.g/255,this.style.fill.b/255,void 0===this.style.fill.a?1:this.style.fill.a/255]))},cr.prototype.updateBBox=Hn,lr.prototype=new ir,lr.prototype.constructor=lr,lr.prototype.setShader=function(t){this.shader=t,this.shader&&(this.shader.addVertex(this.attr.cx||0,this.attr.cy||0,this.pindex),this.shader.addColors(this.style.fill||mr,this.pindex),this.shader.addSize(this.attr.r||0,this.pindex),this.shader.addTransform(this.transformMatrix,this.pindex))},lr.prototype.applyTransformationMatrix=function(t){this.p_matrix=t,this.exec(Jn,t),this.shader&&this.shader.addTransform(this.transformMatrix,this.pindex)},lr.prototype.setAttr=function(t,e){this.attr[t]=e,null!==e?("transform"===t&&this.exec(Jn,this.p_matrix),"cx"!==t&&"cy"!==t||!this.shader?"r"===t&&this.shader?this.shader.updateSize(this.pindex,this.attr.r||0):"transform"===t&&this.shader&&this.shader.updateTransform(this.pindex,this.transformMatrix):this.shader.updateVertex(this.pindex,this.attr.cx,this.attr.cy)):delete this.attr[t]},lr.prototype.in=function(t,e){const{r:i=0,cx:n=0,cy:r=0}=this.attr;return Math.sqrt((t.x-n)*(t.x-n)+(t.y-r)*(t.y-r))<=i},lr.prototype.updateBBox=function(){const t=this,{transform:e,r:i=0,cx:n=0,cy:r=0}=t.attr,{translateX:o,translateY:s,scaleX:a,scaleY:h}=Un(e);t.BBox={x:o+(n-i)*a,y:s+(r-i)*h,width:2*i*a,height:2*i*h},e&&e.rotate?t.BBoxHit=Nn.rotateBBox(this.BBox,e):t.BBoxHit=this.BBox};const pr={};function dr(t){return 0==(t&t-1)}function fr(t,e){const i=document.createElement("canvas"),n=i.getContext("2d");(e=e||{fill:"#fff"}).font||(e.font="10px Arial");const r=parseFloat(e.font,10)||12;n.font=e.font;const o=n.measureText(t).width,s=r;i.setAttribute("height",s*Fn),i.setAttribute("width",o*Fn),i.style.width=o,i.style.height=s,e.font=r*Fn+(isNaN(parseFloat(e.font,10))?e.font:e.font.substring(r.toString().length));for(const t in e)n[t]=e[t];return n.fillText(t,0,.75*s*Fn),{dom:i,ctx:n,width:o,height:s,ratio:Fn,style:e,str:t,updateText:function(){!function(t,e,i,n){t.clearRect(0,0,e*n,i*n)}(this.ctx,this.width,this.height,this.ratio);for(const t in this.style)this.ctx[t]=this.style[t];this.ctx.fillText(this.str,0,.75*this.height)}}}function ur(t,e,i,n){const r=this;this.ctx=t,this.attr=e,this.style=i,this.vDomIndex=n,this.positionArray=new Float32Array(12),this.transform=[0,0,1,1],this.projectionMatrix=Qn(this.ctx.canvas.width/Fn,this.ctx.canvas.height/Fn),this.transformMatrix=Vn(this.projectionMatrix,$n()),this.attr.transform&&this.exec(Jn,null),r.attr.text&&"string"==typeof r.attr.text&&(this.text=fr(r.attr.text,r.style),this.attr.width=this.text.width,this.attr.height=this.text.height),this.text&&(this.textureNode=new Vr(t,{src:this.text.dom},this.vDomIndex))}function yr(t,e,i,n){const r=this;if(this.ctx=t,this.attr=e,this.style=i,this.vDomIndex=n,this.positionArray=new Float32Array(12),this.transform=[0,0,1,1],this.projectionMatrix=Qn(this.ctx.canvas.width/Fn,this.ctx.canvas.height/Fn),this.transformMatrix=Vn(this.projectionMatrix,$n()),this.attr.transform&&this.exec(Jn,null),r.attr.src&&"string"==typeof r.attr.src&&!pr[r.attr.src]?(this.textureNode=new Vr(t,{src:this.attr.src},this.vDomIndex),pr[r.attr.src]=this.textureNode):r.attr.src&&r.attr.src instanceof je?this.textureNode=new Vr(t,{src:this.attr.src},this.vDomIndex):"string"==typeof r.attr.src&&pr[r.attr.src]?this.textureNode=pr[r.attr.src]:r.attr.src&&r.attr.src instanceof Vr&&(this.textureNode=r.attr.src),this.attr.x||this.attr.y||this.attr.width||this.attr.height){const t=this.attr.x||0,e=this.attr.y||0,i=t+(this.attr.width||0),n=e+(this.attr.height||0);this.positionArray[0]=this.positionArray[4]=this.positionArray[6]=t,this.positionArray[1]=this.positionArray[3]=this.positionArray[9]=e,this.positionArray[2]=this.positionArray[8]=this.positionArray[10]=i,this.positionArray[5]=this.positionArray[7]=this.positionArray[11]=n}}function xr(t,e,i,n,r){this.ctx=t,this.attr=e,this.style=i,this.renderTarget=n,this.vDomIndex=r,e.shaderType&&(this.shader=Xr(t,e,i,e.shaderType,this.renderTarget,r)),this.projectionMatrix=Qn(this.ctx.canvas.width/Fn,this.ctx.canvas.height/Fn),this.transformMatrix=Vn(this.projectionMatrix,$n()),this.attr.transform&&this.exec(Jn,null)}ur.prototype=new ir,ur.prototype.constructor=ur,ur.prototype.setShader=function(t){this.shader=t},ur.prototype.setAttr=function(t,e){if(this.attr[t]=e,null!==e){if("text"===t&&"string"==typeof e&&(this.text?this.text=fr(this.attr.text,this.style):this.text=fr(e,this.style),this.attr.width=this.text.width,this.attr.height=this.text.height,this.textureNode?this.textureNode.setAttr("src",this.text.dom):this.textureNode=new Vr(this.ctx,{src:this.text.dom},this.vDomIndex)),"transform"===t)this.exec(Jn,this.p_matrix);else if("x"===t||"y"===t){const t=this.attr.x||0,e=this.attr.y||0,i=t+(this.attr.width||0),n=e+(this.attr.height||0);this.positionArray[0]=this.positionArray[4]=this.positionArray[6]=t,this.positionArray[1]=this.positionArray[3]=this.positionArray[9]=e,this.positionArray[2]=this.positionArray[8]=this.positionArray[10]=i,this.positionArray[5]=this.positionArray[7]=this.positionArray[11]=n}}else delete this.attr[t]},ur.prototype.applyTransformationMatrix=function(t){this.p_matrix=t,this.exec(Jn,t)},ur.prototype.setStyle=function(t,e){if(this.style[t]=e,this.text)if(this.text.style[t]=e,"font"===t){const t=parseFloat(e,10)||12;this.text.ctx.font=e;const i=this.text.ctx.measureText(this.attr.text).width,n=t;this.text.style.font=t*Fn+(isNaN(parseFloat(e,10))?this.style.font:this.style.font.substring(t.toString().length)),this.text.updateText(),this.text.dom.setAttribute("height",n*Fn),this.text.dom.setAttribute("width",i*Fn),this.attr.width=i,this.attr.height=n,this.shader.updateVertexX(this.pindex,this.attr.x||0,this.attr.width||0),this.shader.updateVertexY(this.pindex,this.attr.y||0,this.attr.height||0)}else this.text.style[t]=e,this.text.updateText(),this.textureNode.setAttr("src",this.text.dom)},ur.prototype.getAttr=function(t){return this.attr[t]},ur.prototype.getStyle=function(t){return this.style[t]},ur.prototype.in=function(t){const{width:e=0,height:i=0,x:n=0,y:r=0}=this.attr;return t.x>=n&&t.x<=n+e&&t.y>=r&&t.y<=r+i},ur.prototype.updateBBox=function(){const t=this,{transform:e,x:i=0,y:n=0,width:r=0,height:o=0}=t.attr,{translateX:s,translateY:a,scaleX:h,scaleY:c}=Un(e);t.BBox={x:(s+i)*h,y:(a+n)*c,width:r*h,height:o*c},e&&e.rotate?t.BBoxHit=Nn.rotateBBox(this.BBox,e):t.BBoxHit=this.BBox},yr.prototype=new ir,yr.prototype.constructor=yr,yr.prototype.setShader=function(t){this.shader=t},yr.prototype.applyTransformationMatrix=function(t){this.p_matrix=t,this.exec(Jn,t)},yr.prototype.setAttr=function(t,e){if(this.attr[t]=e,null!==e)if("src"===t&&"string"==typeof e)e&&!pr[e]?(this.textureNode=new Vr(this.ctx,{src:e},this.vDomIndex),pr[e]=this.textureNode):e&&pr[e]&&(this.textureNode=pr[e]);else if("src"===t&&e instanceof je)this.textureNode=new Vr(this.ctx,{src:e},this.vDomIndex);else if("src"===t&&e instanceof Vr)this.textureNode=e;else if("x"===t||"width"===t||"y"===t||"height"===t){const t=this.attr.x||0,e=this.attr.y||0,i=t+(this.attr.width||0),n=e+(this.attr.height||0);this.positionArray[0]=this.positionArray[4]=this.positionArray[6]=t,this.positionArray[1]=this.positionArray[3]=this.positionArray[9]=e,this.positionArray[2]=this.positionArray[8]=this.positionArray[10]=i,this.positionArray[5]=this.positionArray[7]=this.positionArray[11]=n}else"transform"===t&&this.exec(Jn,this.p_matrix);else delete this.attr[t]},yr.prototype.setStyle=function(t,e){e?this.style[t]=e:this.style[t]&&delete this.style[t]},yr.prototype.getAttr=function(t){return this.attr[t]},yr.prototype.getStyle=function(t){return this.style[t]},yr.prototype.in=function(t){const{width:e=0,height:i=0,x:n=0,y:r=0}=this.attr;return t.x>=n&&t.x<=n+e&&t.y>=r&&t.y<=r+i},yr.prototype.updateBBox=function(){const t=this,{transform:e,x:i=0,y:n=0,width:r=0,height:o=0}=t.attr,{translateX:s,translateY:a,scaleX:h,scaleY:c}=Un(e);t.BBox={x:(s+i)*h,y:(a+n)*c,width:r*h,height:o*c},e&&e.rotate?t.BBoxHit=Nn.rotateBBox(this.BBox,e):t.BBoxHit=this.BBox},xr.prototype=new ir,xr.prototype.constructor=xr,xr.prototype.applyTransformationMatrix=function(t){this.p_matrix=t,this.exec(Jn,t),this.transformMatrix=Vn(this.transformMatrix,t)},xr.prototype.setAttr=function(t,e){this.attr[t]=e,"shaderType"===t&&(this.shader=Xr(this.ctx,this.attr,this.style,e,this.renderTarget,this.vDomIndex)),"transform"===t&&this.exec(Jn,this.p_matrix)},xr.prototype.setShader=function(){},xr.prototype.in=function(t){const e=t.x,i=t.y,{BBox:n}=this,{transform:r}=this.attr,{translateX:o,translateY:s,scaleX:a,scaleY:h}=Un(r);return e>=(n.x-o)/a&&e<=(n.x-o+n.width)/a&&i>=(n.y-s)/h&&i<=(n.y-s+n.height)/h},xr.prototype.updateBBox=function(t){const e=this;let i,n,r,o;const{transform:s}=e.attr,{translateX:a,translateY:h,scaleX:c,scaleY:l}=Un(s);if(e.BBox={},t&&t.length>0){let e,s,a;for(let h=0;h<t.length;h+=1)e=t[h],e&&(s=e.dom.BBoxHit.x,a=e.dom.BBoxHit.y,i=void 0===i||i>s?s:i,r=void 0===r||r>a?a:r,n=void 0===n||n<s+e.dom.BBoxHit.width?s+e.dom.BBoxHit.width:n,o=void 0===o||o<a+e.dom.BBoxHit.height?a+e.dom.BBoxHit.height:o)}i=void 0===i?0:i,r=void 0===r?0:r,n=void 0===n?0:n,o=void 0===o?0:o,e.BBox.x=a+i*c,e.BBox.y=h+r*l,e.BBox.width=Math.abs(n-i)*c,e.BBox.height=Math.abs(o-r)*l,e.attr.transform&&e.attr.transform.rotate?e.BBoxHit=Nn.rotateBBox(this.BBox,this.attr.transform):e.BBoxHit=this.BBox};const mr=Lt.rgba(0,0,0,255);function gr(t,e,i,n){let r=n.type;r||(r="FLOAT",n.value instanceof Float32Array?r="FLOAT":n.value instanceof Int8Array?r="BYTE":n.value instanceof Int16Array?r="SHORT":n.value instanceof Uint8Array?r="UNSIGNED_BYTE":n.value instanceof Uint16Array&&(r="UNSIGNED_SHORT"));const o=t.createBuffer(),s={bufferType:t.ARRAY_BUFFER,buffer:o,drawType:t.STATIC_DRAW,valueType:t[r],size:n.size,attributeLocation:t.getAttribLocation(e,i),value:n.value,attr:i};return t.bindBuffer(s.bufferType,s.buffer),t.bufferData(s.bufferType,s.value,s.drawType),s}function vr(t,e,i,n){let r;const o=n.size?n.size:n.value.length;return n.matrix?Number.isInteger(Math.sqrt(n.value.length))?r="uniformMatrix"+Math.sqrt(n.value.length)+"fv":console.error("Not Square Matrix"):n.value instanceof Vr?r="uniform1i":n.value instanceof Float32Array?r="uniform"+o+"fv":n.value instanceof Int8Array||n.value instanceof Int16Array||n.value instanceof Uint8Array?r="uniform"+o+"iv":Number.isInteger(n.value)?Number.isInteger(n.value)&&(r="uniform1i"):r="uniform1f",{matrix:n.matrix,transpose:void 0!==n.transpose&&n.transpose,type:r,value:n.value,uniformLocation:t.getUniformLocation(e,i)}}function br(t,e,i){this.ctx=t,this.dom={BBoxHit:{x:0,y:0,height:0,width:0}},this.shader=e,this.vDomIndex=i,this.program=er(t,e),this.uniforms={},this.attr={},this.attrObjs={},this.indexesObj=null,this.preDraw=e.preDraw,this.postDraw=e.postDraw,this.geometry=e.geometry,this.renderTarget=e.renderTarget;for(const i in e.uniforms)this.uniforms[i]=vr(t,this.program,i,e.uniforms[i]);this.geometry&&(this.geometry instanceof Wr||this.geometry instanceof $r||this.geometry instanceof Qr?(this.attributes=this.geometry.attributes,this.indexes=this.geometry.indexes):console.error("Wrong Geometry type"));for(const e in this.attributes)this.attrObjs[e]=gr(t,this.program,e,this.attributes[e]);this.indexes&&(this.indexesObj=function(t,e,i){let n="FLOAT";return i.value instanceof Float32Array?n="FLOAT":i.value instanceof Int8Array?n="BYTE":i.value instanceof Int16Array?n="SHORT":i.value instanceof Uint8Array?n="UNSIGNED_BYTE":i.value instanceof Uint16Array&&(n="UNSIGNED_SHORT"),{bufferType:t.ELEMENT_ARRAY_BUFFER,buffer:t.createBuffer(),drawType:t.STATIC_DRAW,valueType:t[n],value:i.value,count:i.count,offset:i.offset}}(t,this.program,this.indexes))}function wr(){}function Br(t,e,i,n){t.transform=t.transformTyped&&t.transformTyped.length>0?Array.from(t.transformTyped):t.transform,t.transformTyped=null;const r=e*i*9;let o=0;for(;o<i;)t.transform[r+9*o]=n[0],t.transform[r+9*o+1]=n[1],t.transform[r+9*o+2]=n[2],t.transform[r+9*o+3]=n[3],t.transform[r+9*o+4]=n[4],t.transform[r+9*o+5]=n[5],t.transform[r+9*o+6]=n[6],t.transform[r+9*o+7]=n[7],t.transform[r+9*o+8]=n[8],o++;t.addTransform_=!0,t.transformUpdate=!0}function Ar(t,e,i,n){const r=t.addTransform_?t.transform:t.transformTyped,o=e*i*9;let s=0;for(;s<i;)r[o+9*s]=n[0],r[o+9*s+1]=n[1],r[o+9*s+2]=n[2],r[o+9*s+3]=n[3],r[o+9*s+4]=n[4],r[o+9*s+5]=n[5],r[o+9*s+6]=n[6],r[o+9*s+7]=n[7],r[o+9*s+8]=n[8],s++;t.updateTransform_=!0}function Tr(t,e,i){const n=t.addTransform_?t.transform:t.transformTyped,r=e*i*9;let o=0;for(;o<i;)n[r+9*o]=void 0,n[r+9*o+1]=void 0,n[r+9*o+2]=void 0,n[r+9*o+3]=void 0,n[r+9*o+4]=void 0,n[r+9*o+5]=void 0,n[r+9*o+6]=void 0,n[r+9*o+7]=void 0,n[r+9*o+8]=void 0,o++;t.clearTransform_=!0,t.filterTransformUpdate=!0}function kr(t){t.addTransform_&&(t.clearTransform_&&(t.transform=t.transform.filter((function(t){return!isNaN(t)})),t.clearTransform_=!1),t.transformTyped=new Float32Array(t.transform),t.transform=[],t.addTransform_=!1,t.updateTransform_=!1,t.shaderInstance.setAttributeData("a_transformMatrix",t.transformTyped)),t.clearTransform_&&(t.transformTyped=t.transformTyped.filter((function(t){return!isNaN(t)})),t.clearTransform_=!1,t.shaderInstance.setAttributeData("a_transformMatrix",t.transformTyped)),t.updateTransform_&&(t.shaderInstance.setAttributeData("a_transformMatrix",t.transformTyped),t.updateTransform_=!1)}function Er(t,e,i,n){t.positionArray=t.typedPositionArray&&t.typedPositionArray.length>0?Array.from(t.typedPositionArray):t.positionArray,t.typedPositionArray=null;const r=e*i*2;let o=0;for(;o<n.length;)t.positionArray[r+o]=n[o],o++;t.addVertex_=!0}function Sr(t,e,i,n){const r=t.addVertex_?t.positionArray:t.typedPositionArray,o=e*i*2;let s=0;for(isNaN(r[o])&&console.log("overriding Nan");s<n.length;)r[o+s]=n[s],s++;t.updateVertex_=!0}function Cr(t,e,i){const n=t.addVertex_?t.positionArray:t.typedPositionArray,r=e*i*2;let o=0;for(;o<i;)n[r+2*o]=void 0,n[r+2*o+1]=void 0,o++;t.filterVertex_=!0}function Dr(t){t.addVertex_&&(t.filterVertex_&&(t.positionArray=t.positionArray.filter((function(t){return!isNaN(t)})),t.filterVertex_=!1),t.typedPositionArray=new Float32Array(t.positionArray),t.positionArray=[],t.addVertex_=!1,t.updateVertex_=!1,t.shaderInstance.setAttributeData("a_position",t.typedPositionArray)),t.filterVertex_&&(t.typedPositionArray=t.typedPositionArray.filter((function(t){return!isNaN(t)})),t.filterVertex_=!1,t.shaderInstance.setAttributeData("a_position",t.typedPositionArray)),t.updateVertex_&&(t.shaderInstance.setAttributeData("a_position",t.typedPositionArray),t.updateVertex_=!1)}function Mr(t,e,i,n){t.colorArray=t.typedColorArray&&t.typedColorArray.length>0?Array.from(t.typedColorArray):t.colorArray,t.typedColorArray=null;const r=e*i*4;let o=0;for(n=Lt.colorToRGB(n);o<i;)t.colorArray[r+4*o]=n.r/255,t.colorArray[r+4*o+1]=n.g/255,t.colorArray[r+4*o+2]=n.b/255,t.colorArray[r+4*o+3]=void 0===n.a?1:n.a/255,o++;t.addColor_=!0}function _r(t,e,i,n){const r=t.addColor_?t.colorArray:t.typedColorArray;isNaN(r[e*i*4])&&console.log("overriding Nan");const o=e*i*4;let s=0;for(;s<i;)r[o+4*s]=n.r/255,r[o+4*s+1]=n.g/255,r[o+4*s+2]=n.b/255,r[o+4*s+3]=void 0===n.a?1:n.a/255,s++;t.updateColor_=!0}function zr(t,e,i){const n=t.addColor_?t.colorArray:t.typedColorArray;isNaN(n[e*i*4])&&console.log("overriding Nan");const r=e*i*4;let o=0;for(;o<i;)n[r+4*o]=void 0,n[r+4*o+1]=void 0,n[r+4*o+2]=void 0,n[r+4*o+3]=void 0,o++;t.filterColor_=!0}function Ir(t){t.addColor_&&(t.filterColor_&&(t.colorArray=t.colorArray.filter((function(t){return!isNaN(t)})),t.filterColor_=!1),t.typedColorArray=new Float32Array(t.colorArray),t.colorArray=[],t.addColor_=!1,t.updateColor_=!1,t.shaderInstance.setAttributeData("a_color",t.typedColorArray)),t.filterColor_&&(t.typedColorArray=t.typedColorArray.filter((function(t){return!isNaN(t)})),t.shaderInstance.setAttributeData("a_color",t.typedColorArray),t.filterColor_=!1),t.updateColor_&&(t.shaderInstance.setAttributeData("a_color",t.typedColorArray),t.updateColor_=!1)}function Pr(t,e,i,n){this.ctx=t,this.dom={},this.attr=e||{},this.style=i||{},this.vDomIndex=n,this.indexBased=!0,this.transform=[],this.selftransform=[0,0,1,1],this.attr.transform||(this.attr.transform={translate:[0,0],scale:[1,1]}),this.geometry=new $r,this.geometry.setAttr("a_color",{value:new Float32Array([]),size:4}),this.geometry.setAttr("a_size",{value:new Float32Array([]),size:1}),this.geometry.setAttr("a_position",{value:new Float32Array([]),size:2}),this.geometry.setAttr("a_transformMatrix",{value:new Float32Array(this.transform),size:3}),this.shaderInstance=new br(t,{fragmentShader:hn("point").fragmentShader,vertexShader:hn("point").vertexShader,uniforms:{},geometry:this.geometry},n),this.positionArray=[],this.colorArray=[],this.pointsSize=[],this.transform=[],this.vertexUpdate=!0,this.colorUpdate=!0,this.sizeUpdate=!0,this.transformUpdate=!0}function Or(t,e,i,n,r){this.ctx=t,this.dom={},this.positionArray=[],this.colorArray=[],this.transform=[],this.rotate=[],this.attr=e||{},this.style=i||{},this.vDomIndex=r,this.renderTarget=n,this.indexBased=!0,this.selftransform=[0,0,1,1],this.attr.transform||(this.attr.transform={translate:[0,0],scale:[1,1]}),this.geometry=new Wr,this.geometry.setAttr("a_transformMatrix",{value:new Float32Array(this.transform),size:3}),this.geometry.setAttr("a_color",{value:new Float32Array(this.colorArray),size:4}),this.geometry.setAttr("a_position",{value:new Float32Array(this.positionArray),size:2}),this.geometry.setDrawRange(0,this.positionArray.length/2),this.shaderInstance=new br(t,{fragmentShader:hn("rect").fragmentShader,vertexShader:hn("rect").vertexShader,uniforms:{},geometry:this.geometry},r)}function Lr(t,e,i,n,r){this.ctx=t,this.dom={},this.attr=e||{},this.style=i||{},this.vDomIndex=r,this.positionArray=[],this.colorArray=[],this.transform=[],this.vertexUpdate=!0,this.colorUpdate=!0,this.renderTarget=n,this.indexBased=!0,this.selftransform=new Float32Array([0,0,1,1]),this.attr.transform||(this.attr.transform={translate:[0,0],scale:[1,1]}),this.geometry=new Qr,this.geometry.setAttr("a_color",{value:new Float32Array(this.colorArray),size:4}),this.geometry.setAttr("a_position",{value:new Float32Array(this.positionArray),size:2}),this.geometry.setAttr("a_transformMatrix",{value:new Float32Array(this.transform),size:3}),this.geometry.setDrawRange(0,this.positionArray.length/2),this.shaderInstance=new br(t,{fragmentShader:hn("line").fragmentShader,vertexShader:hn("line").vertexShader,uniforms:{},geometry:this.geometry},r)}function Nr(t,e,i,n,r){this.ctx=t,this.dom={},this.attr=e||{},this.style=i||{},this.vDomIndex=r,this.positionArray=[],this.colorArray=[],this.renderTarget=n,this.indexBased=!1,this.attr.transform||(this.attr.transform={translate:[0,0],scale:[1,1]});const{translateX:o,translateY:s,scaleX:a,scaleY:h}=Un(this.attr.transform);this.transform=new Float32Array([o,s,a,h]),this.geometry=new Qr,this.geometry.drawType="LINE_STRIP",this.geometry.setAttr("a_position",{value:new Float32Array(this.positionArray),size:2}),this.geometry.setDrawRange(0,this.positionArray.length/2),this.shaderInstance=new br(t,{fragmentShader:hn("polyline").fragmentShader,vertexShader:hn("polyline").vertexShader,uniforms:{u_transformMatrix:{value:new Float32Array($n()),matrix:!0},u_color:{value:new Float32Array(4)}},geometry:this.geometry},r)}function Fr(t,e,i,n,r){this.ctx=t,this.dom={},this.attr=e||{},this.style=i||{},this.vDomIndex=r,this.colorArray=[],this.positionArray=[],this.renderTarget=n,this.indexBased=!1,this.attr.transform||(this.attr.transform={translate:[0,0],scale:[1,1]});const{translateX:o,translateY:s,scaleX:a,scaleY:h}=Un(this.attr.transform);this.transform=new Float32Array([o,s,a,h]),this.geometry=new Wr,this.geometry.setAttr("a_position",{value:new Float32Array([]),size:2}),this.shaderInstance=new br(t,{fragmentShader:hn("polygon").fragmentShader,vertexShader:hn("polygon").vertexShader,uniforms:{u_transformMatrix:{value:new Float32Array($n()),matrix:!0},u_color:{value:new Float32Array(4)}},geometry:this.geometry},r)}function Rr(t,e,i,n,r){this.ctx=t,this.dom={},this.attr=e||{},this.style=i||{},this.vDomIndex=r,this.positionArray=[],this.colorArray=[],this.transform=[],this.pointsSize=[],this.renderTarget=n,this.indexBased=!0,this.attr.transform||(this.attr.transform={translate:[0,0],scale:[1,1]}),this.geometry=new $r,this.geometry.setAttr("a_transformMatrix",{value:new Float32Array(this.transform),size:3}),this.geometry.setAttr("a_color",{value:new Float32Array(this.colorArray),size:4}),this.geometry.setAttr("a_radius",{value:new Float32Array(this.pointsSize),size:1}),this.geometry.setAttr("a_position",{value:new Float32Array(this.positionArray),size:2}),this.geometry.setDrawRange(0,0),this.shaderInstance=new br(t,{fragmentShader:hn("circle").fragmentShader,vertexShader:hn("circle").vertexShader,uniforms:{},geometry:this.geometry},r)}function jr(t,e,i,n,r){this.ctx=t,this.dom={},this.attr=e||{},this.style=i||{},this.vDomIndex=r,this.textCoor=new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),this.renderTarget=n,this.indexBased=!1,this.attr.transform||(this.attr.transform={translate:[0,0],scale:[1,1]}),this.geometry=new Wr,this.geometry.setAttr("a_texCoord",{value:this.textCoor,size:2}),this.geometry.setAttr("a_position",{value:new Float32Array([0,0]),size:2}),this.geometry.setDrawRange(0,6),this.shaderInstance=new br(t,{fragmentShader:hn("image").fragmentShader,vertexShader:hn("image").vertexShader,uniforms:{u_transformMatrix:{value:new Float32Array($n()),matrix:!0},u_image:{value:new Vr(this.ctx,{},this.vDomIndex)},u_opacity:{value:1..toFixed(2)}},geometry:this.geometry},r),this.positionArray=[],this.vertexUpdate=!0}function Xr(t,e,i,n,r,o){let s;switch(n){case"rect":s=new Or(t,e,i,r,o);break;case"point":s=new Pr(t,e,i,r,o);break;case"line":s=new Lr(t,e,i,r,o);break;case"polyline":case"path":s=new Nr(t,e,i,r,o);break;case"polygon":s=new Fr(t,e,i,r,o);break;case"circle":s=new Rr(t,e,i,r,o);break;case"image":case"text":s=new jr(t,e,i,r,o);break;default:s=null}return s}function Gr(t,e,i,n){switch(this.ctx=t,this.style=e.style||{},this.attr=e.attr||{},this.id=i,this.nodeName=e.el,this.nodeType="WEBGL",this.children=[],this.ctx=t,this.vDomIndex=n,this.el=e.el,this.shaderType=e.shaderType,this.exeCtx=e.ctx,this.bbox=void 0===e.bbox||e.bbox,this.events={},e.el){case"point":this.dom=new nr(this.ctx,this.attr,this.style);break;case"rect":this.dom=new rr(this.ctx,this.attr,this.style);break;case"line":this.dom=new ar(this.ctx,this.attr,this.style);break;case"polyline":this.dom=new sr(this.ctx,this.attr,this.style);break;case"polygon":this.dom=new cr(this.ctx,this.attr,this.style);break;case"path":this.dom=new or(this.ctx,this.attr,this.style);break;case"circle":this.dom=new lr(this.ctx,this.attr,this.style);break;case"image":this.dom=new yr(this.ctx,this.attr,this.style,n);break;case"text":this.dom=new ur(this.ctx,this.attr,this.style,n);break;case"group":this.dom=new xr(this.ctx,this.attr,this.style,e.renderTarget,n);break;default:this.dom=null}this.dom.nodeExe=this,this.dom instanceof xr||(delete this.createEl,delete this.createEls)}function Yr(t,e={},i={}){const n=t?document.querySelector(t):null;let r=n?n.clientHeight:0,o=n?n.clientWidth:0,s=Lt.rgba(0,0,0,0);const{enableEvents:a=!1,autoUpdate:h=!0,enableResize:c=!1}=i;(e=e||{premultipliedAlpha:!1,depth:!1,antialias:!1,alpha:!0}).premultipliedAlpha=void 0!==e.premultipliedAlpha&&e.premultipliedAlpha,e.depth=void 0!==e.depth&&e.depth,e.antialias=void 0!==e.antialias&&e.antialias,e.alpha=void 0===e.alpha||e.alpha;const l=document.createElement("canvas"),p=l.getContext("webgl",e),d=function(t){const e=(window.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1);return e<1?1:e}(p);let f;Fn=d>=2?2:Math.floor(d),l.setAttribute("height",r*Fn),l.setAttribute("width",o*Fn),l.style.height=r+"px",l.style.width=o+"px",l.style.position="absolute";let u,y,m=999999;n&&(n.appendChild(l),f=new x,h&&(m=Rn.addVdom(f)));const g=new Gr(p,{el:"group",attr:{id:"rootNode"},ctx:function(t){t.enable(t.BLEND),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA),t.clearColor(s.r,s.g,s.b,s.a)}},Yn(),m);f&&f.rootNode(g);const v=g.execute.bind(g);g.container=n,g.domEl=l,g.height=r,g.width=o,g.type="WEBGL",g.ctx.pixelRatio=Fn;let b=function(t){t.viewport(0,0,t.canvas.width,t.canvas.height),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)};g.execute=function(){b(this.ctx),this.updateBBox(),this.ctx.enable(this.ctx.BLEND),this.ctx.blendFunc(this.ctx.SRC_ALPHA,this.ctx.ONE_MINUS_SRC_ALPHA),v()},g.update=function(){this.execute()},g.destroy=function(){const e=document.querySelector(t);e&&e.contains(l)&&e.removeChild(l),Rn.removeVdom(m)},g.getPixels=function(t,e,i,n){const r=new Uint8Array(i*n*4);return this.ctx.readPixels(t,e,i,n,this.ctx.RGBA,this.ctx.UNSIGNED_BYTE,r),r},g.putPixels=function(t,e,i){return this.ctx.putImageData(t,e,i)},g.clear=function(){b(this.ctx)},g.setClearColor=function(t){s=t},g.setClear=function(t){b=t};const w=function(e){document.querySelector(t)?(r=e.height,o=e.width,g.width=o,g.height=r,B(g.domEl,o,r),b(g.ctx),u&&u(),g.execute(),l.style.height=r+"px",l.style.width=o+"px"):Ve(g)},B=function(t,e,i){t.width=Math.floor(e*Fn),t.height=Math.floor(i*Fn),t.style.height=i+"px",t.style.width=e+"px"};if(g.onResize=function(t){u=t},g.onChange=function(t){y=t},g.invokeOnChange=function(){y&&y()},g.setPixelRatio=function(t){Fn=t,this.ctx.pixelRatio=Fn,B(this.domEl,this.width,this.height)},g.setSize=function(t,e){this.width=t,this.height=e,r=e,o=t,B(this.domEl,this.width,this.height),this.execute()},g.setViewBox=function(t,e,i,n){},g.setStyle=function(t,e){this.domEl.style[t]=e},g.setAttr=function(t,e){"viewBox"===t&&this.setViewBox.apply(this,e.split(",")),l.setAttribute(t,e)},g.setContext=function(t,e){this.ctx[t]&&"function"==typeof this.ctx[t]?this.ctx[t].apply(null,e):this.ctx[t]&&(this.ctx[t]=e)},g.MeshGeometry=function(){return new Wr(this.ctx)},g.PointsGeometry=function(){return new $r(this.ctx)},g.LineGeometry=function(){return new Qr(this.ctx)},g.createWebglTexture=function(t){return new Vr(this.ctx,t,this.vDomIndex)},g.RenderTarget=function(t){return new qr(this.ctx,t,this.vDomIndex)},a){const t=new Nt(g);l.addEventListener("mousemove",(e=>{e.preventDefault(),t.mousemoveCheck(e)})),l.addEventListener("mousedown",(e=>{t.mousedownCheck(e)})),l.addEventListener("mouseup",(e=>{t.mouseupCheck(e)})),l.addEventListener("mouseleave",(e=>{t.mouseleaveCheck(e)})),l.addEventListener("contextmenu",(e=>{t.contextmenuCheck(e)})),l.addEventListener("touchstart",(e=>{t.touchstartCheck(e)})),l.addEventListener("touchend",(e=>{t.touchendCheck(e)})),l.addEventListener("touchmove",(e=>{e.preventDefault(),t.touchmoveCheck(e)})),l.addEventListener("touchcancel",(e=>{t.touchcancelCheck(e)})),l.addEventListener("wheel",(e=>{t.wheelEventCheck(e)})),l.addEventListener("pointerdown",(e=>{t.addPointer(e),t.pointerdownCheck(e)})),l.addEventListener("pointerup",(e=>{t.removePointer(e),t.pointerupCheck(e)})),l.addEventListener("pointermove",(e=>{e.preventDefault(),t.pointermoveCheck(e)}))}return Rn.execute(),c&&g.container&&He(g,w),g}function Ur(t){const e=new Image;return e.crossOrigin="anonymous",e.onload=function(){t.update(),t.updated=!0,Rn.vDomChanged(t.vDomIndex)},e.onerror=function(t){},e}function Hr(t,e){return new Uint8Array(new ArrayBuffer(t*e*4))}function Vr(t,e,i){const n=this,r=t.getParameter(t.MAX_TEXTURE_SIZE);this.ctx=t,this.texture=t.createTexture(),this.type="TEXTURE_2D",this.width=e.width>r?r:e.width,this.height=e.height>r?r:e.height,this.border=e.border?e.border:0,this.format=e.format?e.format:"RGBA",this.type=e.type?e.type:"UNSIGNED_BYTE",this.warpS=e.warpS?e.warpS:"CLAMP_TO_EDGE",this.warpT=e.warpT?e.warpT:"CLAMP_TO_EDGE",this.magFilter=e.magFilter?e.magFilter:"LINEAR",this.minFilter=e.minFilter?e.minFilter:"LINEAR",this.mipMap=e.mipMap,this.updated=!1,this.image=null,this.vDomIndex=i,"string"==typeof e.src?(n.image=Ur(n),n.image.src=e.src):e.src instanceof HTMLImageElement||e.src instanceof SVGImageElement||e.src instanceof HTMLCanvasElement||e.src instanceof Uint8Array?(n.image=e.src,n.update(),n.updated=!0):e.src instanceof je?(n.image=e.src.domEl,n.update(),n.updated=!0):(this.width&&this.height&&(n.image=Hr(this.width,this.height),n.update()),n.updated=!0),Rn.vDomChanged(n.vDomIndex)}function qr(t,e){this.ctx=t,this.fbo=t.createFramebuffer(),this.texture=e.texture,this.texture.updated||this.texture.update()}function Zr(){}function Wr(t){this.attributes={},this.drawType="TRIANGLES",this.indexes=null,this.drawRange=[0,0]}function $r(t){this.attributes={},this.drawType="POINTS",this.indexes=null,this.drawRange=[0,0]}function Qr(t){this.attributes={},this.drawType="LINES",this.indexes=null,this.drawRange=[0,0]}br.prototype=new wr,br.prototype.constructor=br,br.prototype.useProgram=function(){this.ctx.useProgram(this.program)},br.prototype.applyUniforms=function(){for(const t in this.uniforms)this.uniforms[t].matrix?this.ctx[this.uniforms[t].type](this.uniforms[t].uniformLocation,this.uniforms[t].transpose,this.uniforms[t].value):this.uniforms[t].value instanceof Vr?(this.ctx[this.uniforms[t].type](this.uniforms[t].uniformLocation,this.uniforms[t].value.texture),this.uniforms[t].value.loadTexture()):this.ctx[this.uniforms[t].type](this.uniforms[t].uniformLocation,this.uniforms[t].value)},br.prototype.applyAttributes=function(){let t;for(const e in this.attrObjs)t=this.attrObjs[e],"a_transformMatrix"===e?(this.ctx.enableVertexAttribArray(t.attributeLocation+0),this.ctx.enableVertexAttribArray(t.attributeLocation+1),this.ctx.enableVertexAttribArray(t.attributeLocation+2),this.ctx.bindBuffer(t.bufferType,t.buffer),this.ctx.vertexAttribPointer(t.attributeLocation+0,t.size,t.valueType,!1,4*t.size*3,0),this.ctx.vertexAttribPointer(t.attributeLocation+1,t.size,t.valueType,!1,4*t.size*3,12),this.ctx.vertexAttribPointer(t.attributeLocation+2,t.size,t.valueType,!1,4*t.size*3,24)):(this.ctx.enableVertexAttribArray(t.attributeLocation),this.ctx.bindBuffer(t.bufferType,t.buffer),this.ctx.vertexAttribPointer(t.attributeLocation,t.size,t.valueType,!1,0,0))},br.prototype.applyIndexes=function(){const t=this.indexesObj;this.ctx.bindBuffer(t.bufferType,t.buffer),this.ctx.bufferData(t.bufferType,t.value,t.drawType)},br.prototype.draw=function(){this.ctx.drawArrays(this.ctx[this.geometry.drawType],this.geometry.drawRange[0],this.geometry.drawRange[1])},br.prototype.drawElements=function(){this.ctx.drawElements(this.ctx[this.geometry.drawType],this.indexesObj.count,this.indexesObj.type?this.indexesObj.type:this.ctx.UNSIGNED_SHORT,this.indexesObj.offset)},br.prototype.updateBBox=function(t){return!0},br.prototype.execute=function(){this.ctx.useProgram(this.program),this.applyUniforms(),this.applyAttributes(),this.renderTarget&&this.renderTarget instanceof qr&&this.renderTarget.update(),this.indexesObj?(this.applyIndexes(),this.drawElements()):this.draw(),this.renderTarget&&this.renderTarget instanceof qr&&this.renderTarget.clear()},br.prototype.addUniform=function(t,e){this.uniforms[t]=vr(this.ctx,this.program,t,e),Rn.vDomChanged(this.vDomIndex)},br.prototype.addAttribute=function(t,e){this.attributes[t]=e,this.attrObjs[t]=gr(this.ctx,this.program,t,e),Rn.vDomChanged(this.vDomIndex)},br.prototype.setAttributeData=function(t,e){const i=this.attrObjs[t];this.attributes[t].value=e,this.attrObjs[t].value=e,this.ctx.bindBuffer(i.bufferType,i.buffer),this.ctx.bufferData(i.bufferType,i.value,i.drawType),Rn.vDomChanged(this.vDomIndex)},br.prototype.applyAttributeData=function(t,e){this.attributes[t].value=e,this.attrObjs[t].value=e;const i=this.attrObjs[t];this.ctx.bindBuffer(i.bufferType,i.buffer),this.ctx.bufferData(i.bufferType,this.attributes[i.attr].value,i.drawType),this.ctx.enableVertexAttribArray(i.attributeLocation),this.ctx.vertexAttribPointer(i.attributeLocation,i.size,i.valueType,!1,0,0)},br.prototype.setUniformData=function(t,e){this.uniforms[t].value=e,Rn.vDomChanged(this.vDomIndex)},br.prototype.applyUniformData=function(t,e){this.uniforms[t].value=e,this.uniforms[t].matrix?this.ctx[this.uniforms[t].type](this.uniforms[t].uniformLocation,this.uniforms[t].transpose,this.uniforms[t].value):this.ctx[this.uniforms[t].type](this.uniforms[t].uniformLocation,this.uniforms[t].value)},wr.prototype.setAttr=function(t,e){if(this.attr[t]=e,"transform"===t){const{translateX:t,translateY:e,scaleX:i,scaleY:n}=Un(this.attr.transform);this.selftransform=new Float32Array([t,e,i,n])}},wr.prototype.translate=function(t){this.attr.transform.translate=t},wr.prototype.scale=function(t){this.attr.transform.scale=t},wr.prototype.rotate=function(t){this.attr.transform.rotate=t},Pr.prototype=new wr,Pr.prototype.constructor=Pr,Pr.prototype.clear=function(t){zr(this,t,1),Cr(this,t,1),Tr(this,t,1);(this.sizeUpdate?this.pointsSize:this.typedSizeArray)[t]=void 0,this.filterSizeFlag=!0},Pr.prototype.addTransform=function(t,e){Br(this,e,1,t)},Pr.prototype.updateTransform=function(t,e){Ar(this,t,1,e)},Pr.prototype.updateVertex=function(t,e,i){Sr(this,t,1,[e,i])},Pr.prototype.updateSize=function(t,e){(this.sizeUpdate?this.pointsSize:this.typedSizeArray)[t]=e},Pr.prototype.updateColor=function(t,e){_r(this,t,1,e)},Pr.prototype.addVertex=function(t,e,i){Er(this,i,1,[t,e])},Pr.prototype.addSize=function(t,e){this.pointsSize=this.typedSizeArray&&this.typedSizeArray.length>0?Array.from(this.typedSizeArray):this.pointsSize,this.pointsSize[e]=t,this.sizeUpdate=!0},Pr.prototype.addColors=function(t,e){Mr(this,e,1,t)},Pr.prototype.execute=function(t){this.renderTarget&&this.renderTarget instanceof qr&&this.renderTarget.update(),Dr(this),Ir(this),kr(this),this.sizeUpdate&&(this.filterSizeFlag&&(this.pointsSize=this.pointsSize.filter((function(t){return!isNaN(t)})),this.filterSizeFlag=!1),this.typedSizeArray=new Float32Array(this.pointsSize),this.pointsSize=[],this.sizeUpdate=!1),this.filterSizeFlag&&(this.typedSizeArray=this.typedSizeArray.filter((function(t){return!isNaN(t)})),this.filterSizeFlag=!1),this.shaderInstance.setAttributeData("a_size",this.typedSizeArray),this.geometry.setDrawRange(0,this.typedPositionArray.length/2),this.shaderInstance.execute(),this.renderTarget&&this.renderTarget instanceof qr&&this.renderTarget.update()},Or.prototype=new wr,Or.prototype.constructor=Or,Or.prototype.clear=function(t){zr(this,t,6),Cr(this,t,6),Tr(this,t,6)},Or.prototype.updateVertex=function(t,e,i,n,r){const o=e+n,s=i+r;Sr(this,t,6,[e,i,o,i,e,s,e,s,o,i,o,s])},Or.prototype.updateTransform=function(t,e){Ar(this,t,6,e)},Or.prototype.addTransform=function(t,e){Br(this,e,6,t)},Or.prototype.updateColor=function(t,e){_r(this,t,6,e)},Or.prototype.addVertex=function(t,e,i,n,r){const o=t+i,s=e+n;Er(this,r,6,[t,e,o,e,t,s,t,s,o,e,o,s])},Or.prototype.addColors=function(t,e){Mr(this,e,6,t)},Or.prototype.execute=function(t){this.renderTarget&&this.renderTarget instanceof qr&&this.renderTarget.update(),Ir(this),kr(this),Dr(this),this.geometry.setDrawRange(0,this.typedPositionArray.length/2),this.shaderInstance.execute(),this.renderTarget&&this.renderTarget instanceof qr&&this.renderTarget.clear()},Lr.prototype=new wr,Lr.prototype.constructor=Lr,Lr.prototype.clear=function(t){zr(this,t,2),Cr(this,t,2)},Lr.prototype.updateTransform=function(t,e){Ar(this,t,2,e)},Lr.prototype.addTransform=function(t,e){Br(this,e,2,t)},Lr.prototype.updateVertex=function(t,e,i,n,r){Sr(this,t,2,[e,i,n,r])},Lr.prototype.updateColor=function(t,e){_r(this,t,2,e)},Lr.prototype.addVertex=function(t,e,i,n,r){Er(this,r,2,[t,e,i,n])},Lr.prototype.addColors=function(t,e){Mr(this,e,2,t)},Lr.prototype.execute=function(t){this.renderTarget&&this.renderTarget instanceof qr&&this.renderTarget.update(),Dr(this),Ir(this),kr(this),this.geometry.setDrawRange(0,this.typedPositionArray.length/2),this.shaderInstance.execute(),this.renderTarget&&this.renderTarget instanceof qr&&this.renderTarget.clear()},Nr.prototype=new wr,Nr.prototype.constructor=Nr,Nr.prototype.execute=function(t){this.renderTarget&&this.renderTarget instanceof qr&&this.renderTarget.update();for(let e=0,i=t.length;e<i;e++)this.shaderInstance.setUniformData("u_transformMatrix",t[e].dom.transformMatrix),this.shaderInstance.setAttributeData("a_position",t[e].dom.points),this.shaderInstance.setUniformData("u_color",t[e].dom.color),this.geometry.setDrawRange(0,t[e].dom.points.length/2),this.shaderInstance.execute();this.renderTarget&&this.renderTarget instanceof qr&&this.renderTarget.clear()},Fr.prototype=new wr,Fr.prototype.constructor=Fr,Fr.prototype.execute=function(t){this.renderTarget&&this.renderTarget instanceof qr&&this.renderTarget.update(),this.shaderInstance.useProgram();for(let e=0,i=t.length;e<i;e++)this.shaderInstance.setUniformData("u_transformMatrix",t[e].dom.transformMatrix),this.shaderInstance.setAttributeData("a_position",t[e].dom.points),this.shaderInstance.setUniformData("u_color",t[e].dom.color),this.geometry.setDrawRange(0,t[e].dom.points.length/2),this.shaderInstance.execute();this.renderTarget&&this.renderTarget instanceof qr&&this.renderTarget.clear()},Rr.prototype=new wr,Rr.prototype.constructor=Rr,Rr.prototype.clear=function(t){zr(this,t,1),Cr(this,t,1),Tr(this,t,1);(this.sizeUpdate?this.pointsSize:this.typedSizeArray)[t]=void 0,this.filterSizeFlag=!0},Rr.prototype.updateTransform=function(t,e){Ar(this,t,1,e)},Rr.prototype.addTransform=function(t,e){Br(this,e,1,t)},Rr.prototype.updateVertex=function(t,e,i){Sr(this,t,1,[e,i])},Rr.prototype.updateColor=function(t,e){_r(this,t,1,e)},Rr.prototype.updateSize=function(t,e){(this.sizeUpdate?this.pointsSize:this.typedSizeArray)[t]=e},Rr.prototype.addVertex=function(t,e,i){Er(this,i,1,[t,e])},Rr.prototype.addSize=function(t,e){this.pointsSize=this.typedSizeArray&&this.typedSizeArray.length>0?Array.from(this.typedSizeArray):this.pointsSize,this.pointsSize[e]=t,this.sizeUpdate=!0},Rr.prototype.addColors=function(t,e){Mr(this,e,1,t)},Rr.prototype.execute=function(t){this.renderTarget&&this.renderTarget instanceof qr&&this.renderTarget.update(),Dr(this),Ir(this),kr(this),this.sizeUpdate&&(this.filterSizeFlag&&(this.pointsSize=this.pointsSize.filter((function(t){return!isNaN(t)})),this.filterSizeFlag=!1),this.typedSizeArray=new Float32Array(this.pointsSize),this.pointsSize=[],this.sizeUpdate=!1),this.filterSizeFlag&&(this.typedSizeArray=this.typedSizeArray.filter((function(t){return!isNaN(t)})),this.filterSizeFlag=!1),this.shaderInstance.setAttributeData("a_radius",this.typedSizeArray),this.geometry.setDrawRange(0,this.typedPositionArray.length/2),this.shaderInstance.execute(),this.renderTarget&&this.renderTarget instanceof qr&&this.renderTarget.clear()},jr.prototype=new wr,jr.prototype.constructor=jr,jr.prototype.execute=function(t){this.renderTarget&&this.renderTarget instanceof qr&&this.renderTarget.update(),this.shaderInstance.useProgram(),this.shaderInstance.applyAttributeData("a_texCoord",this.textCoor);const e=void 0!==this.style.opacity?this.style.opacity:1;let i;for(let n=0,r=t.length;n<r;n++){const r=t[n];r.dom.textureNode&&r.dom.textureNode.updated&&("none"!==r.style.display&&(this.shaderInstance.applyUniformData("u_transformMatrix",r.dom.transformMatrix),r.dom.textureNode!==i&&(r.dom.textureNode.loadTexture(),i=r.dom.textureNode,this.shaderInstance.applyUniformData("u_image",r.dom.textureNode)),this.shaderInstance.applyAttributeData("a_position",r.dom.positionArray),this.shaderInstance.applyUniformData("u_opacity",((void 0!==r.style.opacity?r.style.opacity:1)*e).toFixed(2)),this.shaderInstance.draw()))}this.renderTarget&&this.renderTarget instanceof qr&&this.renderTarget.clear()},Gr.prototype=new je,Gr.prototype.reIndexChildren=function(t){const e=t||this;let i=e.children;i=i.filter((function(t){return t}));for(var n=0,r=i.length;n<r;n++)i[n].dom.pindex=n;e.children=i},Gr.prototype.applyTransformationMatrix=function(t){this.dom.applyTransformationMatrix(t),this.children.forEach((function(t){t.applyTransformationMatrix(self.dom.transformMatrix)}))},Gr.prototype.setAttr=function(t,e){const i=this;if(2===arguments.length)null===e&&null!==this.attr[t]?delete this.attr[t]:this.attr[t]=e,this.dom.setAttr(t,e),"transform"===t&&this.children.length>0&&this.children.forEach((function(t){t.applyTransformationMatrix(i.dom.transformMatrix)}));else if(1===arguments.length&&"object"==typeof t)for(const e in t)null===t[e]&&null!==this.attr[t]?delete this.attr[e]:this.attr[e]=t[e],this.dom.setAttr(e,t[e]),"transform"===t&&this.children.length>0&&this.children.forEach((function(t){t.applyTransformationMatrix(i.dom.transformMatrix)}));return this.BBoxUpdate=!0,Rn.vDomChanged(this.vDomIndex),this},Gr.prototype.scale=function(t){return this.attr.transform||(this.attr.transform={}),t.length<1?null:(this.attr.transform.scale=[t[0],t[1]?t[1]:t[0]],this.dom.setAttr("transform",this.attr.transform),this.BBoxUpdate=!0,Rn.vDomChanged(this.vDomIndex),this)},Gr.prototype.translate=function(t){return this.attr.transform||(this.attr.transform={}),this.attr.transform.translate=t,this.dom.setAttr("transform",this.attr.transform),this.BBoxUpdate=!0,Rn.vDomChanged(this.vDomIndex),this},Gr.prototype.rotate=function(t,e,i){return this.attr.transform||(this.attr.transform={}),"[object Array]"===Object.prototype.toString.call(t)?this.attr.transform.rotate=[t[0]||0,t[1]||0,t[2]||0]:this.attr.transform.rotate=[t,e||0,i||0],this.dom.setAttr("transform",this.attr.transform),this.BBoxUpdate=!0,Rn.vDomChanged(this.vDomIndex),this},Gr.prototype.setStyle=function(t,e){if(2===arguments.length)null===e&&null!=this.style[t]?delete this.style[t]:("fill"!==t&&"stroke"!==t||(e=Lt.colorToRGB(e)),this.style[t]=e),this.dom.setStyle(t,e);else if(1===arguments.length&&"object"==typeof t)for(const i in t)null===(e=t[i])&&null!=this.style[i]?delete this.style[i]:("fill"!==i&&"stroke"!==i||(e=Lt.colorToRGB(e)),this.style[i]=e),this.dom.setStyle(i,e);return Rn.vDomChanged(this.vDomIndex),this},Gr.prototype.setReIndex=function(){this.reindex=!0},Gr.prototype.updateBBox=function(){let t;if(this.bbox){for(let e=0,i=this.children.length;e<i;e+=1)this.children[e]&&(t=this.children[e].updateBBox()||t);if(this.BBoxUpdate||t)return this.dom.updateBBox(this.children),this.BBoxUpdate=!1,!0}return!1},Gr.prototype.in=function(t){return this.dom.in(t)},Gr.prototype.on=function(t,e){const i=this;if(this.events||(this.events={}),null===e&&null!==this.events[t])delete this.events[t];else if(e)if("function"==typeof e){const n=e.bind(i);this.events[t]=function(t){n(t)}}else"object"==typeof e&&(this.events[t]=e,e.constructor!==jn.constructor&&e.constructor!==Xn.constructor||e.bindMethods(this));return this},Gr.prototype.execute=function(){if("none"!==this.style.display)if(!this.dom.shader&&!this.dom.shaderGroup&&this.dom instanceof xr)for(let t=0,e=this.children.length;t<e;t+=1)this.children[t].execute();else if(this.dom.shader&&this.dom instanceof xr)this.reindex&&(this.reIndexChildren(),this.reindex=!1),this.exeCtx&&this.exeCtx(this.ctx),this.dom.shader.execute(this.children);else if(this.dom.shaderGroup&&this.dom instanceof xr){this.exeCtx&&this.exeCtx(this.ctx);for(const t in this.dom.shaderGroup){const e=this.dom.shaderGroup[t];e.reindex&&(this.reIndexChildren(e),e.reindex=!1),e.shader.execute(e.children)}}},Gr.prototype.child=function(t){const e=this;let i;if(e.dom instanceof xr)for(let n=0;n<t.length;n+=1)i=t[n],i.dom.parent=e,e.children[e.children.length]=i,i.dom.pindex=e.children.length-1,i instanceof br||i.dom instanceof xr||(this.dom.shader?i.el===this.dom.shader.attr.shaderType?i.dom.setShader(this.dom.shader):(console.warn("wrong el type '"+i.el+"' being added to shader group - '"+this.dom.shader.attr.shaderType+"'"),e.children.pop()):(this.dom.shaderGroup||(this.dom.shaderGroup={}),this.dom.shaderGroup[i.el]||(this.dom.shaderGroup[i.el]={children:[],shader:Xr(e.ctx,e.attr,e.style,i.el,e.renderTarget,e.vDomIndex)}),this.dom.shaderGroup[i.el].children[this.dom.shaderGroup[i.el].children.length]=i,i.dom.pindex=this.dom.shaderGroup[i.el].children.length-1,i.dom.setShader(this.dom.shaderGroup[i.el].shader))),e.dom.attr&&e.dom.attr.transform&&i.applyTransformationMatrix(e.dom.transformMatrix);else console.log("Error");return this.BBoxUpdate=!0,Rn.vDomChanged(this.vDomIndex),e},Gr.prototype.createEls=function(t,e){const i=new Kn({type:"WEBGL",ctx:this.dom.ctx},t,e,this.vDomIndex);return this.child(i.stack),Rn.vDomChanged(this.vDomIndex),i},Gr.prototype.createEl=function(t){const e=new Gr(this.ctx,t,Yn(),this.vDomIndex);return this.child([e]),Rn.vDomChanged(this.vDomIndex),e},Gr.prototype.createShaderEl=function(t){const e=new br(this.ctx,t,this.vDomIndex);return this.child([e]),Rn.vDomChanged(this.vDomIndex),e},Gr.prototype.remove=function(){const{children:t}=this.dom.parent,e=t.indexOf(this);if(-1!==e)if(this.dom.parent.dom.shader)this.dom.parent.dom.shader.indexBased&&this.dom.parent.dom.shader.clear(this.dom.pindex),this.dom.parent.setReIndex(),t[this.dom.pindex]=void 0;else if(this.dom.parent.dom.shaderGroup){const i=this.dom.parent.dom.shaderGroup[this.el];if(i){const t=i.children.indexOf(this);i.reindex=!0,i.shader.indexBased&&(i.shader.clear(this.dom.pindex),this.dom.parent.setReIndex()),i.children[t]=void 0}t[e]=void 0}else t.splice(e,1);this.BBoxUpdate=!0,Rn.vDomChanged(this.vDomIndex)},Gr.prototype.removeChild=function(t){let e=-1;if(this.children.forEach(((i,n)=>{i===t&&(e=n)})),-1!==e){const t=this.children.splice(e,1)[0];this.dom.removeChild(t.dom)}this.BBoxUpdate=!0,Rn.vDomChanged(this.vDomIndex)},Vr.prototype.setAttr=function(t,e){if(1===arguments.length)for(const i in t)this[i]=t[i],"src"===i&&("string"==typeof e?(this.image&&this.image instanceof Image||(this.image=Ur(this)),this.image.src=e):e instanceof HTMLImageElement||e instanceof SVGImageElement||e instanceof HTMLCanvasElement||e instanceof Uint8Array?(this.image=e,this.update()):e instanceof je&&(this.image=e.domEl,this.update())),(t.height||t.width)&&(self.image=Hr(this.width,this.height));else this[t]=e,console.warning("Instead of key, value, pass Object of key,value for optimal rendering"),"src"===t&&("string"==typeof e?(this.image&&this.image instanceof Image||(this.image=Ur(this)),this.image.src=e):e instanceof HTMLImageElement||e instanceof SVGImageElement||e instanceof HTMLCanvasElement||e instanceof Uint8Array?(this.image=e,this.update()):e instanceof je&&(this.image=e.domEl,this.update()))},Vr.prototype.loadTexture=function(){this.updated&&(this.ctx.activeTexture(this.ctx.TEXTURE0),this.ctx.bindTexture(this.ctx.TEXTURE_2D,this.texture))},Vr.prototype.clear=function(t){},Vr.prototype.update=function(){const t=this.ctx;t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.texture),!this.image||this.image instanceof Uint8Array?t.texImage2D(t.TEXTURE_2D,this.border,t[this.format],this.width,this.height,0,t[this.format],t[this.type],this.image):t.texImage2D(t.TEXTURE_2D,this.border,t[this.format],t[this.format],t[this.type],this.image),this.mipMap?(dr(self.image.width)&&dr(self.image.height)||console.warn("Image dimension not in power of 2"),t.generateMipmap(t.TEXTURE_2D),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t[this.minFilter]),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t[this.magFilter])):(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t[this.warpS]),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t[this.warpT]),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t[this.minFilter]),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t[this.minFilter])),this.updated=!0},qr.prototype.setAttr=function(t,e){this[t]=e},qr.prototype.update=function(){this.texture&&this.texture instanceof Vr&&(this.ctx.bindFramebuffer(this.ctx.FRAMEBUFFER,this.fbo),this.ctx.framebufferTexture2D(this.ctx.FRAMEBUFFER,this.ctx.COLOR_ATTACHMENT0,this.ctx.TEXTURE_2D,this.texture.texture,0),this.ctx.clearColor(0,0,0,0),this.ctx.clear(this.ctx.COLOR_BUFFER_BIT|this.ctx.DEPTH_BUFFER_BIT))},qr.prototype.clear=function(){this.ctx.bindFramebuffer(this.ctx.FRAMEBUFFER,null)},Zr.prototype.setAttr=function(t,e){!e&&this.attributes[t]?delete this.attributes[t]:this.attributes[t]=e},Zr.prototype.setDrawRange=function(t,e){this.drawRange=[t,e]},Zr.prototype.setDrawType=function(t){this.drawType=t},Zr.prototype.setIndex=function(t){this.indexes=t},Wr.prototype=new Zr,Wr.constructor=Wr,$r.prototype=new Zr,$r.constructor=$r,Qr.prototype=new Zr,Qr.constructor=Qr;var Jr=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],Kr=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];var to=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.r=0,this.g=0,this.b=0,this.a=0,this.next=null},eo={blur:function(t=1){return function(e){return function(t,e,i,n,r,o){for(var s,a=t.data,h=2*o+1,c=n-1,l=r-1,p=o+1,d=p*(p+1)/2,f=new to,u=f,y=1;y<h;y++)u=u.next=new to,y===p&&(s=u);u.next=f;for(var x=null,m=null,g=0,v=0,b=Jr[o],w=Kr[o],B=0;B<r;B++){u=f;for(var A=a[v],T=a[v+1],k=a[v+2],E=a[v+3],S=0;S<p;S++)u.r=A,u.g=T,u.b=k,u.a=E,u=u.next;for(var C=0,D=0,M=0,_=0,z=p*A,I=p*T,P=p*k,O=p*E,L=d*A,N=d*T,F=d*k,R=d*E,j=1;j<p;j++){var X=v+((c<j?c:j)<<2),G=a[X],Y=a[X+1],U=a[X+2],H=a[X+3],V=p-j;L+=(u.r=G)*V,N+=(u.g=Y)*V,F+=(u.b=U)*V,R+=(u.a=H)*V,C+=G,D+=Y,M+=U,_+=H,u=u.next}x=f,m=s;for(var q=0;q<n;q++){var Z=R*b>>w;if(a[v+3]=Z,0!==Z){var W=255/Z;a[v]=(L*b>>w)*W,a[v+1]=(N*b>>w)*W,a[v+2]=(F*b>>w)*W}else a[v]=a[v+1]=a[v+2]=0;L-=z,N-=I,F-=P,R-=O,z-=x.r,I-=x.g,P-=x.b,O-=x.a;var $=q+o+1;$=g+($<c?$:c)<<2,L+=C+=x.r=a[$],N+=D+=x.g=a[$+1],F+=M+=x.b=a[$+2],R+=_+=x.a=a[$+3],x=x.next;var Q=m,J=Q.r,K=Q.g,tt=Q.b,et=Q.a;z+=J,I+=K,P+=tt,O+=et,C-=J,D-=K,M-=tt,_-=et,m=m.next,v+=4}g+=n}for(var it=0;it<n;it++){var nt=a[v=it<<2],rt=a[v+1],ot=a[v+2],st=a[v+3],at=p*nt,ht=p*rt,ct=p*ot,lt=p*st,pt=d*nt,dt=d*rt,ft=d*ot,ut=d*st;u=f;for(var yt=0;yt<p;yt++)u.r=nt,u.g=rt,u.b=ot,u.a=st,u=u.next;for(var xt=n,mt=0,gt=0,vt=0,bt=0,wt=1;wt<=o;wt++){v=xt+it<<2;var Bt=p-wt;pt+=(u.r=nt=a[v])*Bt,dt+=(u.g=rt=a[v+1])*Bt,ft+=(u.b=ot=a[v+2])*Bt,ut+=(u.a=st=a[v+3])*Bt,bt+=nt,mt+=rt,gt+=ot,vt+=st,u=u.next,wt<l&&(xt+=n)}v=it,x=f,m=s;for(var At=0;At<r;At++){var Tt=v<<2;a[Tt+3]=st=ut*b>>w,st>0?(st=255/st,a[Tt]=(pt*b>>w)*st,a[Tt+1]=(dt*b>>w)*st,a[Tt+2]=(ft*b>>w)*st):a[Tt]=a[Tt+1]=a[Tt+2]=0,pt-=at,dt-=ht,ft-=ct,ut-=lt,at-=x.r,ht-=x.g,ct-=x.b,lt-=x.a,Tt=it+((Tt=At+p)<l?Tt:l)*n<<2,pt+=bt+=x.r=a[Tt],dt+=mt+=x.g=a[Tt+1],ft+=gt+=x.b=a[Tt+2],ut+=vt+=x.a=a[Tt+3],x=x.next,at+=nt=m.r,ht+=rt=m.g,ct+=ot=m.b,lt+=st=m.a,bt-=nt,mt-=rt,gt-=ot,vt-=st,m=m.next,v+=n}}return t}(e,0,0,e.width,e.height,t)}},greyScale:function(){}};const io=Dt.instance,no=sn,ro=an;export{io as Path,vi as behaviour,no as canvasLayer,ro as canvasNodeLayer,ut as chain,Lt as color,Q as ease,N as geometry,y as queue,ci as svgLayer,eo as utility,Yr as webglLayer};