UNPKG

@leafer/core

Version:
1 lines 98.1 kB
const t={toURL(t,e){let s=encodeURIComponent(t);return"text"===e?s="data:text/plain;charset=utf-8,"+s:"svg"===e&&(s="data:image/svg+xml,"+s),s},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(e){const{prefix:s,suffix:r}=t.image;return!r||e.startsWith("data:")||e.startsWith("blob:")||(e+=(e.includes("?")?"&":"?")+r),s&&"/"===e[0]&&(e=s+e),e}}},e={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=s;return e[t]?e[t]++:(e[t]=1,0)}},s=e;var r;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(r||(r={}));const i={};function n(t){return void 0===t}function o(t){return null==t}function a(t){return"string"==typeof t}const{isFinite:h}=Number;function l(t){return"number"==typeof t}const d=/^-?\d+(?:\.\d+)?$/;function u(t){return"string"==typeof t&&d.test(t)?+t:t}const{isArray:c}=Array;function _(t){return t&&"object"==typeof t}function p(t){return _(t)&&!c(t)}function f(t){return"{}"===JSON.stringify(t)}const g={default:(t,e)=>(y(e,t),y(t,e),t),assign(t,e,s){let r;Object.keys(e).forEach(i=>{var n,o;if(r=e[i],(null==r?void 0:r.constructor)===Object&&(null===(n=t[i])||void 0===n?void 0:n.constructor)===Object)return y(t[i],e[i],s&&s[i]);s&&i in s?(null===(o=s[i])||void 0===o?void 0:o.constructor)===Object&&y(t[i]={},e[i],s[i]):t[i]=e[i]})},copyAttrs:(t,e,s)=>(s.forEach(s=>{n(e[s])||(t[s]=e[s])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let s=0,r=t.length;s<r;s++)e[t[s]]=!0;return e},stintSet(t,e,s){s||(s=void 0),t[e]!==s&&(t[e]=s)}},{assign:y}=g;class m{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!n(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s;for(let r in this)"_"!==r[0]&&(s=e?e[r]:void 0,t[r]=n(s)?this[r]:s);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!n(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!n(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const s={};if(t)if(c(t))for(let e of t)s[e]=this.__getInput(e);else for(let e in t)s[e]=this.__getInput(e);else{let t,e,{__input:r}=this;s.tag=this.__leaf.tag;for(let i in this)if("_"!==i[0]&&(t=this["_"+i],!n(t))){if("path"===i&&!this.__pathInputed)continue;e=r?r[i]:void 0,s[i]=n(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:r,d:i,e:n,f:o}=this.__leaf.__localMatrix;s.matrix={a:t,b:e,c:r,d:i,e:n,f:o}}return s}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const{round:x,pow:w,PI:b}=Math,B={within:(t,e,s)=>(_(e)&&(s=e.max,e=e.min),!n(e)&&t<e&&(t=e),!n(s)&&t>s&&(t=s),t),fourNumber(t,e){let s;if(c(t))switch(t.length){case 4:s=n(e)?t:[...t];break;case 2:s=[t[0],t[1],t[0],t[1]];break;case 3:s=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(s||(s=[t,t,t,t]),e)for(let t=0;t<4;t++)s[t]>e&&(s[t]=e);return s},formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),B.float(t)),getGapRotation(t,e,s=0){let r=t+s;if(e>1){const t=Math.abs(r%e);(t<1||t>e-1)&&(r=Math.round(r/e)*e)}return r-s},float(t,e){const s=n(e)?1e12:w(10,e);return-0===(t=x(t*s)/s)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,s,r){if(r||(r={}),e){const t=(l(e)?e:e.width||0)/s.width,i=(l(e)?e:e.height||0)/s.height;r.scaleX=t||i||1,r.scaleY=i||t||1}else t&&B.assignScale(r,t);return r},assignScale(t,e){l(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:v,randColor:t=>`rgba(${v(255)},${v(255)},${v(255)},${t||1})`};function v(t){return Math.round(Math.random()*t)}const k=b/180,C=2*b,O=b/2;function P(){return{x:0,y:0}}function T(){return{x:0,y:0,width:0,height:0}}function S(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:R,cos:L,acos:E,sqrt:I}=Math,{float:M}=B,A={};function W(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const N={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:W(),tempMatrix:{},set(t,e=1,s=0,r=0,i=1,n=0,o=0){t.a=e,t.b=s,t.c=r,t.d=i,t.e=n,t.f=o},get:S,getWorld:W,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s,r){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s,r&&(t.e-=e,t.f-=s)},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},scaleOfOuter(t,e,s,r){Y.toInnerPoint(t,e,A),Y.scaleOfInner(t,A,s,r)},scaleOfInner(t,e,s,r=s){Y.translateInner(t,e.x,e.y),Y.scale(t,s,r),Y.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:r,c:i,d:n}=t,o=L(e*=k),a=R(e);t.a=s*o-r*a,t.b=s*a+r*o,t.c=i*o-n*a,t.d=i*a+n*o},rotateOfOuter(t,e,s){Y.toInnerPoint(t,e,A),Y.rotateOfInner(t,A,s)},rotateOfInner(t,e,s){Y.translateInner(t,e.x,e.y),Y.rotate(t,s),Y.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:r,b:i,c:n,d:o}=t;s&&(s*=k,t.a=r+n*s,t.b=i+o*s),e&&(e*=k,t.c=n+r*e,t.d=o+i*e)},skewOfOuter(t,e,s,r){Y.toInnerPoint(t,e,A),Y.skewOfInner(t,A,s,r)},skewOfInner(t,e,s,r=0){Y.translateInner(t,e.x,e.y),Y.skew(t,s,r),Y.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:r,c:i,d:n,e:o,f:a}=t;t.a=e.a*s+e.b*i,t.b=e.a*r+e.b*n,t.c=e.c*s+e.d*i,t.d=e.c*r+e.d*n,t.e=e.e*s+e.f*i+o,t.f=e.e*r+e.f*n+a},multiplyParent(t,e,s,r,i){const{e:o,f:a}=t;if(s||(s=t),n(r)&&(r=1!==t.a||t.b||t.c||1!==t.d),r){const{a:r,b:n,c:o,d:a}=t;s.a=r*e.a+n*e.c,s.b=r*e.b+n*e.d,s.c=o*e.a+a*e.c,s.d=o*e.b+a*e.d,i&&(s.scaleX=e.scaleX*i.scaleX,s.scaleY=e.scaleY*i.scaleY)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,i&&(s.scaleX=e.scaleX,s.scaleY=e.scaleY);s.e=o*e.a+a*e.c+e.e,s.f=o*e.b+a*e.d+e.f},divide(t,e){Y.multiply(t,Y.tempInvert(e))},divideParent(t,e){Y.multiplyParent(t,Y.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=Y;return Y.copy(e,t),Y.invert(e),e},invert(t){const{a:e,b:s,c:r,d:i,e:n,f:o}=t;if(s||r){const a=1/(e*i-s*r);t.a=i*a,t.b=-s*a,t.c=-r*a,t.d=e*a,t.e=-(n*i-o*r)*a,t.f=-(o*e-n*s)*a}else if(1===e&&1===i)t.e=-n,t.f=-o;else{const s=1/(e*i);t.a=i*s,t.d=e*s,t.e=-n*i*s,t.f=-o*e*s}},toOuterPoint(t,e,s,r){const{x:i,y:n}=e;s||(s=e),s.x=i*t.a+n*t.c,s.y=i*t.b+n*t.d,r||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,r){const{a:i,b:n,c:o,d:a}=t,h=1/(i*a-n*o),{x:l,y:d}=e;if(s||(s=e),s.x=(l*a-d*o)*h,s.y=(d*i-l*n)*h,!r){const{e:e,f:r}=t;s.x-=(e*a-r*o)*h,s.y-=(r*i-e*n)*h}},setLayout(t,e,s,r,i){const{x:o,y:a,scaleX:h,scaleY:l}=e;if(n(i)&&(i=e.rotation||e.skewX||e.skewY),i){const{rotation:s,skewX:r,skewY:i}=e,n=s*k,o=L(n),a=R(n);if(r||i){const e=r*k,s=i*k;t.a=(o+s*-a)*h,t.b=(a+s*o)*h,t.c=(e*o-a)*l,t.d=(o+e*a)*l}else t.a=o*h,t.b=a*h,t.c=-a*l,t.d=o*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=o,t.f=a,(s=s||r)&&Y.translateInner(t,-s.x,-s.y,!r)},getLayout(t,e,s,r){const{a:i,b:n,c:o,d:a,e:h,f:l}=t;let d,u,c,_,p,f=h,g=l;if(n||o){const t=i*a-n*o;if(o&&!r){d=I(i*i+n*n),u=t/d;const e=i/d;c=n>0?E(e):-E(e)}else{u=I(o*o+a*a),d=t/u;const e=o/u;c=O-(a>0?E(-e):-E(e))}const e=M(L(c)),s=R(c);d=M(d),u=M(u),_=e?M((o/u+s)/e/k,9):0,p=e?M((n/d-s)/e/k,9):0,c=M(c/k)}else d=i,u=a,c=_=p=0;return(e=s||e)&&(f+=e.x*i+e.y*o,g+=e.x*n+e.y*a,s||(f-=e.x,g-=e.y)),{x:f,y:g,scaleX:d,scaleY:u,rotation:c,skewX:_,skewY:p}},withScale(t,e,s=e){const r=t;if(!e||!s){const{a:r,b:i,c:n,d:o}=t;i||n?s=(r*o-i*n)/(e=I(r*r+i*i)):(e=r,s=o)}return r.scaleX=e,r.scaleY=s,r},reset(t){Y.set(t)}},Y=N,{toInnerPoint:X,toOuterPoint:D}=N,{sin:z,cos:F,abs:j,sqrt:U,atan2:H,min:G,round:V}=Math,q={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,s){t.radiusX=e,t.radiusY=n(s)?e:s},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,s){t.x=e,t.y=s},round(t,e){t.x=e?V(t.x-.5)+.5:V(t.x),t.y=e?V(t.y-.5)+.5:V(t.y)},move(t,e,s){_(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=s)},scale(t,e,s=e){t.x&&(t.x*=e),t.y&&(t.y*=s)},scaleOf(t,e,s,r=s){t.x+=(t.x-e.x)*(s-1),t.y+=(t.y-e.y)*(r-1)},rotate(t,e,s){s||(s=Q.defaultPoint);const r=F(e*=k),i=z(e),n=t.x-s.x,o=t.y-s.y;t.x=s.x+n*r-o*i,t.y=s.y+n*i+o*r},tempToInnerOf(t,e){const{tempPoint:s}=Q;return Z(s,t),X(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=Q;return Z(s,t),D(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=Q;return Z(s,t),Q.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),X(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){X(e,t,s)},toOuterOf(t,e,s){D(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>J(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,r){const i=j(s-t),n=j(r-e);return U(i*i+n*n)},getMinDistanceFrom:(t,e,s,r,i,n)=>G(J(t,e,s,r),J(s,r,i,n)),getAngle:(t,e)=>$(t,e)/k,getRotation:(t,e,s,r)=>(r||(r=e),Q.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,r.x,r.y)/k),getRadianFrom(t,e,s,r,i,o,a,h){n(a)&&(a=s,h=r);const l=t-s,d=e-r,u=i-a,c=o-h;return Math.atan2(l*c-d*u,l*u+d*c)},getAtan2:(t,e)=>H(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,r){const i=$(t,e);return(e=r?e:{}).x=t.x+F(i)*s,e.y=t.y+z(i)*s,e},toNumberPoints(t){let e=t;return _(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){Q.reset(t)}},Q=q,{getDistanceFrom:J,copy:Z,getAtan2:$}=Q;class K{constructor(t,e){this.set(t,e)}set(t,e){return _(t)?q.copy(this,t):q.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new K(this)}move(t,e){return q.move(this,t,e),this}scale(t,e){return q.scale(this,t,e),this}scaleOf(t,e,s){return q.scaleOf(this,t,e,s),this}rotate(t,e){return q.rotate(this,t,e),this}rotateOf(t,e){return q.rotate(this,e,t),this}getRotation(t,e,s){return q.getRotation(this,t,e,s)}toInnerOf(t,e){return q.toInnerOf(this,t,e),this}toOuterOf(t,e){return q.toOuterOf(this,t,e),this}getCenter(t){return new K(q.getCenter(this,t))}getDistance(t){return q.getDistance(this,t)}getDistancePoint(t,e,s){return new K(q.getDistancePoint(this,t,e,s))}getAngle(t){return q.getAngle(this,t)}getAtan2(t){return q.getAtan2(this,t)}reset(){return q.reset(this),this}}const tt=new K;class et{constructor(t,e,s,r,i,n){this.set(t,e,s,r,i,n)}set(t,e,s,r,i,n){return _(t)?N.copy(this,t):N.set(this,t,e,s,r,i,n),this}setWith(t){return N.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:s,d:r,e:i,f:n}=this;return{a:t,b:e,c:s,d:r,e:i,f:n}}clone(){return new et(this)}translate(t,e){return N.translate(this,t,e),this}translateInner(t,e){return N.translateInner(this,t,e),this}scale(t,e){return N.scale(this,t,e),this}scaleWith(t,e){return N.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,s){return N.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return N.scaleOfInner(this,t,e,s),this}rotate(t){return N.rotate(this,t),this}rotateOfOuter(t,e){return N.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return N.rotateOfInner(this,t,e),this}skew(t,e){return N.skew(this,t,e),this}skewOfOuter(t,e,s){return N.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return N.skewOfInner(this,t,e,s),this}multiply(t){return N.multiply(this,t),this}multiplyParent(t){return N.multiplyParent(this,t),this}divide(t){return N.divide(this,t),this}divideParent(t){return N.divideParent(this,t),this}invert(){return N.invert(this),this}invertWith(){return N.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){N.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){N.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return N.setLayout(this,t,e,s),this}getLayout(t,e,s){return N.getLayout(this,t,e,s)}withScale(t,e){return N.withScale(this,t,e)}reset(){N.reset(this)}}const st=new et,rt={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,r,i){it(t,e,s),it(t,e+r,s+i)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:it}=rt;var nt,ot;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(nt||(nt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(ot||(ot={}));const at=[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:1,y:.5},{x:1,y:1},{x:.5,y:1},{x:0,y:1},{x:0,y:.5},{x:.5,y:.5}];at.forEach(t=>t.type="percent");const ht={directionData:at,tempPoint:{},get:lt,toPoint(t,e,s,r,i,n){const o=lt(t);s.x=o.x,s.y=o.y,"percent"===o.type&&(s.x*=e.width,s.y*=e.height,i&&(n||(s.x-=i.x,s.y-=i.y),o.x&&(s.x-=1===o.x?i.width:.5===o.x?o.x*i.width:0),o.y&&(s.y-=1===o.y?i.height:.5===o.y?o.y*i.height:0))),r||(s.x+=e.x,s.y+=e.y)},getPoint:(t,e,s)=>(s||(s={}),ht.toPoint(t,e,s,!0),s)};function lt(t){return a(t)?at[ot[t]]:t}const{toPoint:dt}=ht,ut={toPoint(t,e,s,r,i,n){dt(t,s,r,i,e,n)}},{tempPointBounds:ct,setPoint:_t,addPoint:pt,toBounds:ft}=rt,{toOuterPoint:gt}=N,{float:yt,fourNumber:mt}=B,{floor:xt,ceil:wt}=Math;let bt,Bt,vt,kt;const Ct={},Ot={},Pt={},Tt={tempBounds:Pt,set(t,e=0,s=0,r=0,i=0){t.x=e,t.y=s,t.width=r,t.height=i},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s,r,i){const{x:n,y:o,width:a,height:h}=e;if(c(s)){const e=mt(s);r?St.set(t,n+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):St.set(t,n-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else r&&(s=-s),St.set(t,n-s,o-s,a+2*s,h+2*s);i&&("width"===i?(t.y=o,t.height=h):(t.x=n,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,s){t.x+=e,t.y+=s},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,s)=>(t=Object.assign({},t),St.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?Lt(e,t):e=t,s?(e.offsetX=-(St.maxX(s)-t.x),e.offsetY=-(St.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),St.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e,r){r||q.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,r=s){q.scaleOf(t,e,s,r),t.width*=s,t.height*=r},tempToOuterOf:(t,e)=>(St.copy(Pt,t),St.toOuterOf(Pt,e),Pt),getOuterOf:(t,e)=>(t=Object.assign({},t),St.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:r,d:i}=e;r>0?(s.width=t.width*r,s.x=e.e+t.x*r):(s.width=t.width*-r,s.x=e.e+t.x*r-s.width),i>0?(s.height=t.height*i,s.y=e.f+t.y*i):(s.height=t.height*-i,s.y=e.f+t.y*i-s.height)}else Ct.x=t.x,Ct.y=t.y,gt(e,Ct,Ot),_t(ct,Ot.x,Ot.y),Ct.x=t.x+t.width,gt(e,Ct,Ot),pt(ct,Ot.x,Ot.y),Ct.y=t.y+t.height,gt(e,Ct,Ot),pt(ct,Ot.x,Ot.y),Ct.x=t.x,gt(e,Ct,Ot),pt(ct,Ot.x,Ot.y),ft(ct,s)},toInnerOf(t,e,s){s||(s=t),St.move(s,-e.e,-e.f),St.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const r=Math.min(s,St.getFitScale(t,e));return new et(r,0,0,r,-e.x*r,-e.y*r)},getFitScale(t,e,s){const r=t.width/e.width,i=t.height/e.height;return s?Math.max(r,i):Math.min(r,i)},put(t,e,s="center",r=1,i=!0,n){n||(n=e),a(r)&&(r=St.getFitScale(t,e,"cover"===r)),Pt.width=i?e.width*=r:e.width*r,Pt.height=i?e.height*=r:e.height*r,ut.toPoint(s,Pt,t,n,!0,!0)},getSpread(t,e,s){const r={};return St.copyAndSpread(r,t,e,!1,s),r},spread(t,e,s){St.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){St.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=xt(t.x),t.y=xt(t.y),t.width=e>t.x?wt(t.width+e-t.x):wt(t.width),t.height=s>t.y?wt(t.height+s-t.y):wt(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=yt(t.x,e),t.y=yt(t.y,e),t.width=yt(t.width,e),t.height=yt(t.height,e)},add(t,e,s){bt=t.x+t.width,Bt=t.y+t.height,vt=e.x,kt=e.y,s||(vt+=e.width,kt+=e.height),bt=bt>vt?bt:vt,Bt=Bt>kt?Bt:kt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=bt-t.x,t.height=Bt-t.y},addList(t,e){St.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){St.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){St.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,r=!1){let i,n=!0;for(let o=0,a=e.length;o<a;o++)i=s?s(e[o],o):e[o],i&&(i.width||i.height)&&(n?(n=!1,r||Lt(t,i)):Rt(t,i));n&&St.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?_t(ct,t.x,t.y):pt(ct,t.x,t.y)),ft(ct,t)},setPoint(t,e){St.set(t,e.x,e.y)},addPoint(t,e){Rt(t,e,!0)},getPoints(t){const{x:e,y:s,width:r,height:i}=t;return[{x:e,y:s},{x:e+r,y:s},{x:e+r,y:s+i},{x:e,y:s+i}]},hitRadiusPoint:(t,e,s)=>(s&&(e=q.tempToInnerRadiusPointOf(e,s)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,s)=>(s&&(e=q.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=St.tempToOuterOf(e,s)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,s)=>(s&&(e=St.tempToOuterOf(e,s)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,s){if(s&&(e=St.tempToOuterOf(e,s)),!St.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:r,y:i,width:n,height:o}=e;return bt=r+n,Bt=i+o,vt=t.x+t.width,kt=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,bt=bt<vt?bt:vt,Bt=Bt<kt?Bt:kt,n=bt-r,o=Bt-i,{x:r,y:i,width:n,height:o}},intersect(t,e,s){St.copy(t,St.getIntersectData(t,e,s))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){St.set(t)}},St=Tt,{add:Rt,copy:Lt}=St;class Et{get minX(){return Tt.minX(this)}get minY(){return Tt.minY(this)}get maxX(){return Tt.maxX(this)}get maxY(){return Tt.maxY(this)}constructor(t,e,s,r){this.set(t,e,s,r)}set(t,e,s,r){return _(t)?Tt.copy(this,t):Tt.set(this,t,e,s,r),this}get(){const{x:t,y:e,width:s,height:r}=this;return{x:t,y:e,width:s,height:r}}clone(){return new Et(this)}move(t,e){return Tt.move(this,t,e),this}scale(t,e,s){return Tt.scale(this,t,e,s),this}scaleOf(t,e,s){return Tt.scaleOf(this,t,e,s),this}toOuterOf(t,e){return Tt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Tt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Tt.getFitMatrix(this,t,e)}put(t,e,s){Tt.put(this,t,e,s)}spread(t,e){return Tt.spread(this,t,e),this}shrink(t,e){return Tt.shrink(this,t,e),this}ceil(){return Tt.ceil(this),this}unsign(){return Tt.unsign(this),this}float(t){return Tt.float(this,t),this}add(t){return Tt.add(this,t),this}addList(t){return Tt.setList(this,t,!0),this}setList(t){return Tt.setList(this,t),this}addListWithFn(t,e){return Tt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Tt.setListWithFn(this,t,e),this}setPoint(t){return Tt.setPoint(this,t),this}setPoints(t){return Tt.setPoints(this,t),this}addPoint(t){return Tt.addPoint(this,t),this}getPoints(){return Tt.getPoints(this)}hitPoint(t,e){return Tt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Tt.hitRadiusPoint(this,t,e)}hit(t,e){return Tt.hit(this,t,e)}includes(t,e){return Tt.includes(this,t,e)}intersect(t,e){return Tt.intersect(this,t,e),this}getIntersect(t,e){return new Et(Tt.getIntersectData(this,t,e))}isSame(t){return Tt.isSame(this,t)}isEmpty(){return Tt.isEmpty(this)}reset(){Tt.reset(this)}}const It=new Et;class Mt{constructor(t,e,s,r,i,n){_(t)?this.copy(t):this.set(t,e,s,r,i,n)}set(t=0,e=0,s=0,r=0,i=0,n=0){this.top=t,this.right=e,this.bottom=s,this.left=r,this.width=i,this.height=n}copy(t){const{top:e,right:s,bottom:r,left:i,width:n,height:o}=t;this.set(e,s,r,i,n,o)}getBoundsFrom(t){const{top:e,right:s,bottom:r,left:i,width:n,height:o}=this;return new Et(i,e,n||t.width-i-s,o||t.height-e-r)}}const At={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:Wt}=B;class Nt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Nt(t)}static set filter(t){this.filterList=Yt(t)}static set exclude(t){this.excludeList=Yt(t)}static drawRepaint(t,e){const s=Wt();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const r="hit"===Nt.showBounds,i=t.__nowWorld,n=Wt();r&&(e.setWorld(i),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),r?e.stroke():e.strokeWorld(i,n)}log(...t){if(Xt.enable){if(Xt.filterList.length&&Xt.filterList.every(t=>t!==this.name))return;if(Xt.excludeList.length&&Xt.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Xt.enable&&this.warn(...t)}warn(...t){Xt.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function Yt(t){return t?a(t)&&(t=[t]):t=[],t}Nt.filterList=[],Nt.excludeList=[],Nt.showWarn=!0;const Xt=Nt,Dt=Nt.get("RunTime"),zt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,s){const r=e.create(e.RUNTIME);return Ft.currentId=Ft.idMap[r]=s?performance.now():Date.now(),Ft.currentName=Ft.nameMap[r]=t,Ft.nameToIdMap[t]=r,r},end(t,e){const s=Ft.idMap[t],r=Ft.nameMap[t],i=e?(performance.now()-s)/1e3:Date.now()-s;Ft.idMap[t]=Ft.nameMap[t]=Ft.nameToIdMap[r]=void 0,Dt.log(r,i,"ms")},endOfName(t,e){const s=Ft.nameToIdMap[t];n(s)||Ft.end(s,e)}},Ft=zt,jt=[],Ut={list:{},add(t,...e){this.list[t]=!0,jt.push(...e)},has(t,e){const s=this.list[t];return!s&&e&&this.need(t),s},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>jt.forEach(t=>Ut.has(t,!0)));const Ht={editor:t=>Ut.need("editor")},Gt=Nt.get("UICreator"),Vt={list:{},register(t){const{__tag:e}=t.prototype;qt[e]&&Gt.repeat(e),qt[e]=t},get(t,e,s,r,i,o){qt[t]||Gt.error("not register "+t);const a=new qt[t](e);return n(s)||(a.x=s,r&&(a.y=r),i&&(a.width=i),o&&(a.height=o)),a}},{list:qt}=Vt,Qt=Nt.get("EventCreator"),Jt={nameList:{},register(t){let e;Object.keys(t).forEach(s=>{e=t[s],a(e)&&(Zt[e]&&Qt.repeat(e),Zt[e]=t)})},changeName(t,e){const s=Zt[t];if(s){const r=Object.keys(s).find(e=>s[e]===t);r&&(s[r]=e,Zt[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Zt[t](...e)},{nameList:Zt}=Jt;class $t{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let r=0,i=s.length;r<i;r++)if(e=s[r],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const r=Ht.canvas(t);return this.add(r),r}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let s=0,r=this.list.length;s<r;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function Kt(t,e,s,r){var i,n=arguments.length,o=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,s,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(o=(n<3?i(o):n>3?i(e,s,o):i(e,s))||o);return n>3&&o&&Object.defineProperty(e,s,o),o}function te(t,e,s,r){return new(s||(s=Promise))(function(i,n){function o(t){try{h(r.next(t))}catch(t){n(t)}}function a(t){try{h(r.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}h((r=r.apply(t,e||[])).next())})}function ee(t){return(e,s)=>{t||(t=s);const r={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===s&&(r.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,s,r)}}"function"==typeof SuppressedError&&SuppressedError;const se=[];function re(){return(t,e)=>{se.push(e)}}const ie=[];class ne{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||ie)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;se.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,s,r,i,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,r,i,n){_(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,r,i,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,r){}strokeRect(t,e,s,r){}clearRect(t,e,s,r){}drawImage(t,e,s,r,i,n,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/r*a;r+=e,e=0,n+=t,a-=t}if(s<0){const t=-s/i*h;i+=s,s=0,o+=t,h-=t}this.context.drawImage(t,e,s,r,i,n,o,a,h);break;case 5:this.context.drawImage(t,e,s,r,i);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,r,i,n){}quadraticCurveTo(t,e,s,r){}closePath(){}arc(t,e,s,r,i,n){}arcTo(t,e,s,r,i){}ellipse(t,e,s,r,i,n,o,a){}rect(t,e,s,r){}roundRect(t,e,s,r,i){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,r){}createPattern(t,e){}createRadialGradient(t,e,s,r,i,n){}fillText(t,e,s,r){}measureText(t){}strokeText(t,e,s,r){}destroy(){this.context=null}}Kt([ee("imageSmoothingEnabled")],ne.prototype,"smooth",void 0),Kt([ee("imageSmoothingQuality")],ne.prototype,"smoothLevel",void 0),Kt([ee("globalAlpha")],ne.prototype,"opacity",void 0),Kt([ee()],ne.prototype,"fillStyle",void 0),Kt([ee()],ne.prototype,"strokeStyle",void 0),Kt([ee("lineWidth")],ne.prototype,"strokeWidth",void 0),Kt([ee("lineCap")],ne.prototype,"strokeCap",void 0),Kt([ee("lineJoin")],ne.prototype,"strokeJoin",void 0),Kt([ee("lineDashOffset")],ne.prototype,"dashOffset",void 0),Kt([ee()],ne.prototype,"miterLimit",void 0),Kt([ee()],ne.prototype,"shadowBlur",void 0),Kt([ee()],ne.prototype,"shadowColor",void 0),Kt([ee()],ne.prototype,"shadowOffsetX",void 0),Kt([ee()],ne.prototype,"shadowOffsetY",void 0),Kt([ee()],ne.prototype,"filter",void 0),Kt([ee()],ne.prototype,"font",void 0),Kt([ee()],ne.prototype,"fontKerning",void 0),Kt([ee()],ne.prototype,"fontStretch",void 0),Kt([ee()],ne.prototype,"fontVariantCaps",void 0),Kt([ee()],ne.prototype,"textAlign",void 0),Kt([ee()],ne.prototype,"textBaseline",void 0),Kt([ee()],ne.prototype,"textRendering",void 0),Kt([ee()],ne.prototype,"wordSpacing",void 0),Kt([ee()],ne.prototype,"letterSpacing",void 0),Kt([ee()],ne.prototype,"direction",void 0),Kt([re()],ne.prototype,"setTransform",null),Kt([re()],ne.prototype,"resetTransform",null),Kt([re()],ne.prototype,"getTransform",null),Kt([re()],ne.prototype,"save",null),Kt([re()],ne.prototype,"restore",null),Kt([re()],ne.prototype,"translate",null),Kt([re()],ne.prototype,"scale",null),Kt([re()],ne.prototype,"rotate",null),Kt([re()],ne.prototype,"fill",null),Kt([re()],ne.prototype,"stroke",null),Kt([re()],ne.prototype,"clip",null),Kt([re()],ne.prototype,"fillRect",null),Kt([re()],ne.prototype,"strokeRect",null),Kt([re()],ne.prototype,"clearRect",null),Kt([re()],ne.prototype,"beginPath",null),Kt([re()],ne.prototype,"moveTo",null),Kt([re()],ne.prototype,"lineTo",null),Kt([re()],ne.prototype,"bezierCurveTo",null),Kt([re()],ne.prototype,"quadraticCurveTo",null),Kt([re()],ne.prototype,"closePath",null),Kt([re()],ne.prototype,"arc",null),Kt([re()],ne.prototype,"arcTo",null),Kt([re()],ne.prototype,"ellipse",null),Kt([re()],ne.prototype,"rect",null),Kt([re()],ne.prototype,"roundRect",null),Kt([re()],ne.prototype,"createConicGradient",null),Kt([re()],ne.prototype,"createLinearGradient",null),Kt([re()],ne.prototype,"createPattern",null),Kt([re()],ne.prototype,"createRadialGradient",null),Kt([re()],ne.prototype,"fillText",null),Kt([re()],ne.prototype,"measureText",null),Kt([re()],ne.prototype,"strokeText",null);const{copy:oe,multiplyParent:ae}=N,{round:he}=Math,le=new Et,de=new Et,ue={width:1,height:1,pixelRatio:1},ce=["width","height","pixelRatio"];class _e extends ne{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(s,r){super(),this.size={},this.worldTransform={},s||(s=ue),this.manager=r,this.innerId=e.create(e.CNAVAS);const{width:i,height:n,pixelRatio:o}=s;this.autoLayout=!i||!n,this.size.pixelRatio=o||t.devicePixelRatio,this.config=s,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let s;this.context&&!this.unreal&&e&&this.width&&(s=this.getSameCanvas(),s.copyWorld(this));const r=this.size;g.copyAttrs(r,t,ce),ce.forEach(t=>r[t]||(r[t]=1)),this.bounds=new Et(0,0,this.width,this.height),this.context&&!this.unreal&&(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&s&&(this.clearWorld(s.bounds),this.copyWorld(s),s.recycle())}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:s,pixelSnap:r}=this,i=this.worldTransform;e&&ae(t,e,i),i.a=t.a*s,i.b=t.b*s,i.c=t.c*s,i.d=t.d*s,i.e=t.e*s,i.f=t.f*s,r&&(t.half&&t.half*s%2?(i.e=he(i.e-.5)+.5,i.f=he(i.f-.5)+.5):(i.e=he(i.e),i.f=he(i.f))),this.setTransform(i.a,i.b,i.c,i.d,i.e,i.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,s,r){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s,r)}setStrokeOptions(t,e){let{strokeCap:s,strokeJoin:r,dashPattern:i,dashOffset:o,miterLimit:a}=t;e&&(e.strokeCap&&(s=e.strokeCap),e.strokeJoin&&(r=e.strokeJoin),n(e.dashPattern)||(i=e.dashPattern),n(e.dashOffset)||(o=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=s,this.strokeJoin=r,this.dashPattern=i,this.dashOffset=o,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,s=1){return!0}setWorldShadow(t,e,s,r){const{pixelRatio:i}=this;this.shadowOffsetX=t*i,this.shadowOffsetY=e*i,this.shadowBlur=s*i,this.shadowColor=r||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,r,i=!0){r&&(this.blendMode=r),e?(this.setTempPixelBounds(e,i),s?(this.setTempPixelBounds2(s,i),s=de):s=le,this.drawImage(t.view,le.x,le.y,le.width,le.height,s.x,s.y,s.width,s.height)):this.drawImage(t.view,0,0),r&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,r,i=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Tt.tempToOuterOf(s,e),r,i),this.restore()):(r&&(this.blendMode=r),this.setTempPixelBounds(e,i),this.drawImage(t.view,le.x,le.y,le.width,le.height,s.x,s.y,s.width,s.height),r&&(this.blendMode="source-over"))}copyWorldByReset(t,e,s,r,i,n=!0){this.resetTransform(),this.copyWorld(t,e,s,r,n),i||this.useWorldTransform()}useGrayscaleAlpha(t){let e,s;this.setTempPixelBounds(t,!0,!0);const{context:r}=this,i=r.getImageData(le.x,le.y,le.width,le.height),{data:n}=i;for(let t=0,r=n.length;t<r;t+=4)s=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?s:e*(s/255));r.putImageData(i,le.x,le.y)}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s,r){s&&(this.blendMode=s),this.fillStyle=e,this.setTempPixelBounds(t,r),this.fillRect(le.x,le.y,le.width,le.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s,r){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempPixelBounds(t,r),this.strokeRect(le.x,le.y,le.width,le.height),s&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(le.x,le.y,le.width,le.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(le.x,le.y,le.width,le.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,s){this.copyToPixelBounds(le,t,e,s)}setTempPixelBounds2(t,e,s){this.copyToPixelBounds(de,t,e,s)}copyToPixelBounds(t,e,s,r){t.set(e),r&&t.intersect(this.bounds),t.scale(this.pixelRatio),s&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:s,pixelSnap:r}=this,i=this.manager?this.manager.get(s):Ht.canvas(Object.assign({},s));return i.save(),t&&(oe(i.worldTransform,this.worldTransform),i.useWorldTransform()),e&&(i.smooth=this.smooth),i.pixelSnap!==r&&(i.pixelSnap=r),i}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const pe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},fe={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},ge=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},fe),ye={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},me={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},xe=Object.assign(Object.assign({},me),fe),we=ge,be={};for(let t in we)be[we[t]]=t;const Be={};for(let t in we)Be[we[t]]=ye[t];const ve={drawRoundRect(t,e,s,r,i,n){const o=B.fourNumber(n,Math.min(r/2,i/2)),a=e+r,h=s+i;o[0]?t.moveTo(e+o[0],s):t.moveTo(e,s),o[1]?t.arcTo(a,s,a,h,o[1]):t.lineTo(a,s),o[2]?t.arcTo(a,h,e,h,o[2]):t.lineTo(a,h),o[3]?t.arcTo(e,h,e,s,o[3]):t.lineTo(e,h),o[0]?t.arcTo(e,s,a,s,o[0]):t.lineTo(e,s)}},{sin:ke,cos:Ce,atan2:Oe,ceil:Pe,abs:Te,PI:Se,sqrt:Re,pow:Le}=Math,{setPoint:Ee,addPoint:Ie}=rt,{set:Me,toNumberPoints:Ae}=q,{M:We,L:Ne,C:Ye,Q:Xe,Z:De}=ge,ze={},Fe={points(t,e,s,r){let i=Ae(e);if(t.push(We,i[0],i[1]),s&&i.length>5){let e,n,o,a,h,l,d,u,c,_,p,f,g,y=i.length;const m=!0===s?.5:s;r&&(i=[i[y-2],i[y-1],...i,i[0],i[1],i[2],i[3]],y=i.length);for(let s=2;s<y-2;s+=2)e=i[s-2],n=i[s-1],o=i[s],a=i[s+1],h=i[s+2],l=i[s+3],p=Re(Le(o-e,2)+Le(a-n,2)),f=Re(Le(h-o,2)+Le(l-a,2)),(p||f)&&(g=p+f,p=m*p/g,f=m*f/g,h-=e,l-=n,d=o-p*h,u=a-p*l,2===s?r||t.push(Xe,d,u,o,a):t.push(Ye,c,_,d,u,o,a),c=o+f*h,_=a+f*l);r||t.push(Xe,c,_,i[y-2],i[y-1])}else for(let e=2,s=i.length;e<s;e+=2)t.push(Ne,i[e],i[e+1]);r&&t.push(De)},rect(t,e,s,r,i){pe.creator.path=t,pe.creator.moveTo(e,s).lineTo(e+r,s).lineTo(e+r,s+i).lineTo(e,s+i).lineTo(e,s)},roundRect(t,e,s,r,i,n){pe.creator.path=[],ve.drawRoundRect(pe.creator,e,s,r,i,n),t.push(...pe.convertToCanvasData(pe.creator.path,!0))},arcTo(t,e,s,r,i,n,o,a,h,l,d){const u=r-e,c=i-s,_=n-r,p=o-i;let f=Oe(c,u),g=Oe(p,_),y=g-f;if(y<0&&(y+=C),y===Se||Te(u+c)<1e-12||Te(_+p)<1e-12)return t&&t.push(Ne,r,i),h&&(Ee(h,e,s),Ie(h,r,i)),d&&Me(d,e,s),void(l&&Me(l,r,i));const m=u*p-_*c<0,x=m?-1:1,w=a/Ce(y/2),b=r+w*Ce(f+y/2+O*x),B=i+w*ke(f+y/2+O*x);return f-=O*x,g-=O*x,He(t,b,B,a,a,0,f/k,g/k,m,h,l,d)},arc:(t,e,s,r,i,n,o,a,h,l)=>He(t,e,s,r,r,0,i,n,o,a,h,l),ellipse(t,e,s,r,i,n,o,a,h,l,d,u){const c=n*k,_=ke(c),p=Ce(c);let f=o*k,g=a*k;f>Se&&(f-=C),g<0&&(g+=C);let y=g-f;y<0?y+=C:y>C&&(y-=C),h&&(y-=C);const m=Pe(Te(y/O)),x=y/m,w=ke(x/4),b=8/3*w*w/ke(x/2);g=f+x;let B,v,P,T,S,R,L,E,I=Ce(f),M=ke(f),A=P=p*r*I-_*i*M,W=T=_*r*I+p*i*M,N=e+P,Y=s+T;t&&t.push(t.length?Ne:We,N,Y),l&&Ee(l,N,Y),u&&Me(u,N,Y);for(let n=0;n<m;n++)B=Ce(g),v=ke(g),P=p*r*B-_*i*v,T=_*r*B+p*i*v,S=e+A-b*(p*r*M+_*i*I),R=s+W-b*(_*r*M-p*i*I),L=e+P+b*(p*r*v+_*i*B),E=s+T+b*(_*r*v-p*i*B),t&&t.push(Ye,S,R,L,E,e+P,s+T),l&&Ue(e+A,s+W,S,R,L,E,e+P,s+T,l,!0),A=P,W=T,I=B,M=v,f=g,g+=x;d&&Me(d,e+P,s+T)},quadraticCurveTo(t,e,s,r,i,n,o){t.push(Ye,(e+2*r)/3,(s+2*i)/3,(n+2*r)/3,(o+2*i)/3,n,o)},toTwoPointBoundsByQuadraticCurve(t,e,s,r,i,n,o,a){Ue(t,e,(t+2*s)/3,(e+2*r)/3,(i+2*s)/3,(n+2*r)/3,i,n,o,a)},toTwoPointBounds(t,e,s,r,i,n,o,a,h,l){const d=[];let u,c,_,p,f,g,y,m,x=t,w=s,b=i,B=o;for(let t=0;t<2;++t)if(1==t&&(x=e,w=r,b=n,B=a),u=-3*x+9*w-9*b+3*B,c=6*x-12*w+6*b,_=3*w-3*x,Math.abs(u)<1e-12){if(Math.abs(c)<1e-12)continue;p=-_/c,0<p&&p<1&&d.push(p)}else y=c*c-4*_*u,m=Math.sqrt(y),y<0||(f=(-c+m)/(2*u),0<f&&f<1&&d.push(f),g=(-c-m)/(2*u),0<g&&g<1&&d.push(g));l?Ie(h,t,e):Ee(h,t,e),Ie(h,o,a);for(let l=0,u=d.length;l<u;l++)je(d[l],t,e,s,r,i,n,o,a,ze),Ie(h,ze.x,ze.y)},getPointAndSet(t,e,s,r,i,n,o,a,h,l){const d=1-t,u=d*d*d,c=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=u*e+c*r+_*n+p*a,l.y=u*s+c*i+_*o+p*h},getPoint(t,e,s,r,i,n,o,a,h){const l={};return je(t,e,s,r,i,n,o,a,h,l),l},getDerivative(t,e,s,r,i){const n=1-t;return 3*n*n*(s-e)+6*n*t*(r-s)+3*t*t*(i-r)}},{getPointAndSet:je,toTwoPointBounds:Ue,ellipse:He}=Fe,{sin:Ge,cos:Ve,sqrt:qe,atan2:Qe}=Math,{ellipse:Je}=Fe,Ze={ellipticalArc(e,s,r,i,n,o,a,h,l,d,u){const c=(l-s)/2,_=(d-r)/2,p=o*k,f=Ge(p),g=Ve(p),y=-g*c-f*_,m=-g*_+f*c,x=i*i,w=n*n,b=m*m,B=y*y,v=x*w-x*b-w*B;let O=0;if(v<0){const t=qe(1-v/(x*w));i*=t,n*=t}else O=(a===h?-1:1)*qe(v/(x*b+w*B));const P=O*i*m/n,T=-O*n*y/i,S=Qe((m-T)/n,(y-P)/i),R=Qe((-m-T)/n,(-y-P)/i);let L=R-S;0===h&&L>0?L-=C:1===h&&L<0&&(L+=C);const E=s+c+g*P-f*T,I=r+_+f*P+g*T,M=L<0?1:0;u||t.ellipseToCurve?Je(e,E,I,i,n,o,S/k,R/k,M):i!==n||o?e.push(ge.G,E,I,i,n,o,S/k,R/k,M):e.push(ge.O,E,I,i,S/k,R/k,M)}},{M:$e,m:Ke,L:ts,l:es,H:ss,h:rs,V:is,v:ns,C:os,c:as,S:hs,s:ls,Q:ds,q:us,T:cs,t:_s,A:ps,a:fs,Z:gs,z:ys,N:ms,D:xs,X:ws,G:bs,F:Bs,O:vs,P:ks,U:Cs}=ge,{rect:Os,roundRect:Ps,arcTo:Ts,arc:Ss,ellipse:Rs,quadraticCurveTo:Ls}=Fe,{ellipticalArc:Es}=Ze,Is=Nt.get("PathConvert"),Ms={},As={current:{dot:0},stringify(t,e){let s,r,i,n=0,o=t.length,a="";for(;n<o;){r=t[n],s=Be[r],a+=r===i?" ":be[r];for(let r=1;r<s;r++)a+=B.float(t[n+r],e),r===s-1||(a+=" ");i=r,n+=s}return a},parse(t,e){let s,r,i,n="";const o=[],a=e?xe:me;for(let e=0,h=t.length;e<h;e++)r=t[e],At[r]?("."===r&&(Ws.dot&&(Ns(o,n),n=""),Ws.dot++),"0"===n&&"."!==r&&(Ns(o,n),n=""),n+=r):ge[r]?(n&&(Ns(o,n),n=""),Ws.name=ge[r],Ws.length=ye[r],Ws.index=0,Ns(o,Ws.name),!s&&a[r]&&(s=!0)):"-"===r||"+"===r?"e"===i||"E"===i?n+=r:(n&&Ns(o,n),n=r):n&&(Ns(o,n),n=""),i=r;return n&&Ns(o,n),s?As.toCanvasData(o,e):o},toCanvasData(t,e){let s,r,i,n,o,a=0,h=0,l=0,d=0,u=0,c=t.length;const _=[];for(;u<c;){switch(i=t[u],i){case Ke:t[u+1]+=a,t[u+2]+=h;case $e:a=t[u+1],h=t[u+2],_.push($e,a,h),u+=3;break;case rs:t[u+1]+=a;case ss:a=t[u+1],_.push(ts,a,h),u+=2;break;case ns:t[u+1]+=h;case is:h=t[u+1],_.push(ts,a,h),u+=2;break;case es:t[u+1]+=a,t[u+2]+=h;case ts:a=t[u+1],h=t[u+2],_.push(ts,a,h),u+=3;break;case ls:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=hs;case hs:o=n===os||n===hs,l=o?2*a-s:t[u+1],d=o?2*h-r:t[u+2],s=t[u+1],r=t[u+2],a=t[u+3],h=t[u+4],_.push(os,l,d,s,r,a,h),u+=5;break;case as:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,t[u+5]+=a,t[u+6]+=h,i=os;case os:s=t[u+3],r=t[u+4],a=t[u+5],h=t[u+6],_.push(os,t[u+1],t[u+2],s,r,a,h),u+=7;break;case _s:t[u+1]+=a,t[u+2]+=h,i=cs;case cs:o=n===ds||n===cs,s=o?2*a-s:t[u+1],r=o?2*h-r:t[u+2],e?Ls(_,a,h,s,r,t[u+1],t[u+2]):_.push(ds,s,r,t[u+1],t[u+2]),a=t[u+1],h=t[u+2],u+=3;break;case us:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=ds;case ds:s=t[u+1],r=t[u+2],e?Ls(_,a,h,s,r,t[u+3],t[u+4]):_.push(ds,s,r,t[u+3],t[u+4]),a=t[u+3],h=t[u+4],u+=5;break;case fs:t[u+6]+=a,t[u+7]+=h;case ps:Es(_,a,h,t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],t[u+7],e),a=t[u+6],h=t[u+7],u+=8;break;case ys:case gs:_.push(gs),u++;break;case ms:a=t[u+1],h=t[u+2],e?Os(_,a,h,t[u+3],t[u+4]):Ys(_,t,u,5),u+=5;break;case xs:a=t[u+1],h=t[u+2],e?Ps(_,a,h,t[u+3],t[u+4],[t[u+5],t[u+6],t[u+7],t[u+8]]):Ys(_,t,u,9),u+=9;break;case ws:a=t[u+1],h=t[u+2],e?Ps(_,a,h,t[u+3],t[u+4],t[u+5]):Ys(_,t,u,6),u+=6;break;case bs:Rs(e?_:Ys(_,t,u,9),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],t[u+7],t[u+8],null,Ms),a=Ms.x,h=Ms.y,u+=9;break;case Bs:e?Rs(_,t[u+1],t[u+2],t[u+3],t[u+4],0,0,360,!1):Ys(_,t,u,5),a=t[u+1]+t[u+3],h=t[u+2],u+=5;break;case vs:Ss(e?_:Ys(_,t,u,7),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],null,Ms),a=Ms.x,h=Ms.y,u+=7;break;case ks:e?Ss(_,t[u+1],t[u+2],t[u+3],0,360,!1):Ys(_,t,u,4),a=t[u+1]+t[u+3],h=t[u+2],u+=4;break;case Cs:Ts(e?_:Ys(_,t,u,6),a,h,t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],null,Ms),a=Ms.x,h=Ms.y,u+=6;break;default:return Is.error(`command: ${i} [index:${u}]`,t),_}n=i}return _},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push($e,t.x,t.y);break;case"L":e.push(ts,t.x,t.y);break;case"C":e.push(os,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(ds,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(gs)}}),e},copyData(t,e,s,r){for(let i=s,n=s+r;i<n;i++)t.push(e[i])},pushData(t,e){Ws.index===Ws.length&&(Ws.index=1,t.push(Ws.name)),t.push(Number(e)),Ws.index++,Ws.dot=0}},{current:Ws,pushData:Ns,copyData:Ys}=As,{M:Xs,L:Ds,C:zs,Q:Fs,Z:js,N:Us,D:Hs,X:Gs,G:Vs,F:qs,O:Qs,P:Js,U:Zs}=ge,{getMinDistanceFrom:$s,getRadianFrom:Ks}=q,{tan:tr,min:er,abs:sr}=Math,rr={},ir={beginPath(t){t.length=0},moveTo(t,e,s){t.push(Xs,e,s)},lineTo(t,e,s){t.push(Ds,e,s)},bezierCurveTo(t,e,s,r,i,n,o){t.push(zs,e,s,r,i,n,o)},quadraticCurveTo(t,e,s,r,i){t.push(Fs,e,s,r,i)},closePath(t){t.push(js)},rect(t,e,s,r,i){t.push(Us,e,s,r,i)},roundRect(t,e,s,r,i,n){if(l(n))t.push(Gs,e,s,r,i,n);else{const o=B.fourNumber(n);o?t.push(Hs,e,s,r,i,...o):t.push(Us,e,s,r,i)}},ellipse(t,e,s,r,i,n,a,h,l){o(n)?t.push(qs,e,s,r,i):(o(a)&&(a=0),o(h)&&(h=360),t.push(Vs,e,s,r,i,n,a,h,l?1:0))},arc(t,e,s,r,i,n,a){o(i)?t.push(Js,e,s,r):(o(n)&&(n=360),t.push(Qs,e,s,r,i,n,a?1:0))},arcTo(t,e,s,r,i,o,a,h){if(!n(a)){const t=$s(a,h,e,s,r,i);o=er(o,er(t/2,t/2*sr(tr(Ks(a,h,e,s,r,i)/2))))}t.push(Zs,e,s,r,i,o)},drawEllipse(t,e,s,r,i,n,a,h,l){Fe.ellipse(null,e,s,r,i,o(n)?0:n,o(a)?0:a,o(h)?360:h,l,null,null,rr),t.push(Xs,rr.x,rr.y),nr(t,e,s,r,i,n,a,h,l)},drawArc(t,e,s,r,i,n,a){Fe.arc(null,e,s,r,o(i)?0:i,o(n)?360:n,a,null,null,rr),t.push(Xs,rr.x,rr.y),or(t,e,s,r,i,n,a)},drawPoints(t,e,s,r){Fe.points(t,e,s,r)}},{ellipse:nr,arc:or}=ir,{moveTo:ar,lineTo:hr,quadraticCurveTo:lr,bezierCurveTo:dr,closePath:ur,beginPath:cr,rect:_r,roundRect:pr,ellipse:fr,arc:gr,arcTo:yr,drawEllipse:mr,drawArc:xr,drawPoints:wr}=ir;class br{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?pe.parse(t):t:[],this}beginPath(){return cr(this.__path),this.paint(),this}moveTo(t,e){return ar(this.__path,t,e),this.paint(),this}lineTo(t,e){return hr(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,r,i,n){return dr(this.__path,t,e,s,r,i,n),this.paint(),this}quadraticCurveTo(t,e,s,r){return lr(this.__path,t,e,s,r),this.paint(),this}closePath(){return ur(this.__path),this.paint(),this}rect(t,e,s,r){return _r(this.__path,t,e,s,r),this.paint(),this}roundRect(t,e,s,r,i){return pr(this.__path,t,e,s,r,i),this.paint(),this}ellipse(t,e,s,r,i,n,o,a){return fr(this.__path,t,e,s,r,i,n,o,a),this.paint(),this}arc(t,e,s,r,i,n){return gr(this.__path,t,e,s,r,i,n),this.paint(),this}arcTo(t,e,s,r,i){return yr(this.__path,t,e,s,r,i),this.paint(),this}drawEllipse(t,e,s,r,i,n,o,a){return mr(this.__path,t,e,s,r,i,n,o,a),this.paint(),this}drawArc(t,e,s,r,i,n){return xr(this.__path,t,e,s,r,i,n),this.paint(),this}drawPoints(t,e,s){return wr(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Br,L:vr,C:kr,Q:Cr,Z:Or,N:Pr,D:Tr,X:Sr,G:Rr,F:Lr,O:Er,P:Ir,U:Mr}=ge,Ar=Nt.get("PathDrawer"),Wr={drawPathByData(t,e){if(!e)return;let s,r=0,i=e.length;for(;r<i;)switch(s=e[r],s){case Br:t.moveTo(e[r+1],e[r+2]),r+=3;break;case vr:t.lineTo(e[r+1],e[r+2]),r+=3;break;case kr:t.bezierCurveTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5],e[r+6]),r+=7;break;case Cr:t.quadraticCurveTo(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case Or:t.closePath(),r+=1;break;case Pr:t.rect(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case Tr:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],[e[r+5],e[r+6],e[r+7],e[r+8]]),r+=9;break;case Sr:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;case Rr:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]*k,e[r+6]*k,e[r+7]*k,e[r+8]),r+=9;break;case Lr:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,C,!1),r+=5;break;case Er:t.arc(e[r+1],e[r+2],e[r+3],e[r+4]*k,e[r+5]*k,e[r+6]),r+=7;break;case Ir:t.arc(e[r+1],e[r+2],e[r+3],0,C,!1),r+=4;break;case Mr:t.arcTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;default:return void Ar.error(`command: ${s} [index:${r}]`,e)}}},{M:Nr,L:Yr,C:Xr,Q:Dr,Z:zr,N:Fr,D:jr,X:Ur,G:Hr,F:Gr,O:Vr,P:qr,U:Qr}=ge,{toTwoPointBounds:Jr,toTwoPointBoundsByQuadraticCurve:Zr,arcTo:$r,arc:Kr,ellipse:ti}=Fe,{addPointBounds:ei,copy:si,addPoint:ri,setPoint:ii,addBounds:ni,toBounds:oi}=rt,ai=Nt.get("PathBounds");let hi,li,di;const ui={},ci={},_i={},pi={toBounds(t,e){pi.toTwoPointBounds(t,ci),oi(ci,e)},toTwoPointBounds(t,e){if(!t||!t.length)return ii(e,0,0);let s,r,i,n,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===zr||o===Xr||o===Dr?ii(e,h,l):ii(e,t[a+1],t[a+2])),o){case Nr:case Yr:h=t[a+1],l=t[a+2],ri(e,h,l),a+=3;break;case Xr:i=t[a+5],n=t[a+6],Jr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,n,ui),ei(e,ui),h=i,l=n,a+=7;break;case Dr:s=t[a+1],r=t[a+2],i=t[a+3],n=t[a+4],Zr(h,l,s,r,i,n,ui),ei(e,ui),h=i,l=n,a+=5;break;case zr:a+=1;break;case Fr:h=t[a+1],l=t[a+2],ni(e,h,l,t[a+3],t[a+4]),a+=5;break;case jr:case Ur:h=t[a+1],l=t[a+2],ni(e,h,l,t[a+3],t[a+4]),a+=o===jr?9:6;break;case Hr:ti(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],t[a+7],t[a+8],ui,_i),0===a?si(e,ui):ei(e,ui),h=_i.x,l=_i.y,a+=9;break;case Gr:h=t[a+1],l=t[a+2],li=t[a+3],di=t[a+4],ni(e,h-li,l-di,2*li,2*di),h+=li,a+=5;break;case Vr:Kr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],ui,_i),0===a?si(e,ui):ei(e,ui),h=_i.x,l=_i.y,a+=7;break;case qr:h=t[a+1],l=t[a+2],hi=t[a+3],ni(e,h-hi,l-hi,2*hi,2*hi),h+=hi,a+=4;break;case Qr:$r(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],ui,_i),0===a?si(e,ui):ei(e,ui),h=_i.x,l=_i.y,a+=6;break;default:return void ai.error(`command: ${o} [index:${a}]`,t)}}},{M:fi,L:gi,Z:yi}=ge,{getCenterX:mi,getCenterY:xi}=q,{arcTo:wi}=ir,bi={smooth(t,e,s){let r,i,n,o=0,a=0,h=0,l=0,d=0,u=0,c=0,_=0,p=0;const f=t.length,g=[];for(;o<f;){switch(r=t[o],r){case fi:l=_=t[o+1],d=p=t[o+2],o+=3,t[o]===gi?(u=t[o+1],c=t[o+2],g.push(fi,mi(l,u),xi(d,c))):g.push(fi,l,d);break;case gi:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case gi:wi(g,a,h,t[o+1],t[o+2],e,_,p);break;case yi:wi(g,a,h,l,d,e,_,p);break;default:g.push(gi,a,h)}_=a,p=h;break;case yi:i!==yi&&(wi(g,l,d,u,c,e,_,p),g.push(yi)),o+=1;break;default:n=Be[r];for(let e=0;e<n;e++)g.push(t[o+e]);o+=n}i=r}return r!==yi&&(g[1]=l,g[2]=d),g}};pe.creator=new br,pe.parse=As.parse,pe.convertToCanvasData=As.toCanvasData;const Bi=new br,{drawRoundRect:vi}=ve;function ki(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,r,i){vi(this,t,e,s,r,i)})}(t)}const Ci={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Oi.fileType(t);return["jpg","jpeg"].some(t=>t===e)},getExportOptions(t){switch(typeof t){case"object":return t;case"number":return{quality:t};case"boolean":return{blob:t};default:return{}}}},Oi=Ci;Oi.alphaPixelTypes.forEach(t=>Oi.upperCaseTypeMap[t]=t.toUpperCase());const Pi=Nt.get("TaskProcessor");class Ti{constructor(t){this.parallel=!0,this.time=1,this.id=e.create(e.TASK),this.task=t}run(){return te(this,void 0,void 0,function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){Pi.error(t)}})}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class Si{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,s=0;for(let r=0;r<t;r++)r<=this.finishedIndex?(s+=this.list[r].time,r===this.finishedIndex&&(e=s)):e+=this.list[r].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&g.assign(this.config,t),this.empty()}add(t,e){let s,r,i,o;const a=new Ti(t);return a.parent=this,l(e)?o=e:e&&(r=e.parallel,s=e.start,i=e.time,o=e.delay),i&&(a.time=i),!1===r&&(a.parallel=!1),n(o)?this.push(a,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(a,s))},o)),this.isComplete=!1,a}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,this.nextTask()}).catch(t=>{this.onError(t)}):this.nextTask()}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run(