@leafer/core
Version:
1 lines • 101 kB
JavaScript
var t;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(t||(t={}));const e={};function s(t){return void 0===t}function r(t){return null==t}function i(t){return"string"==typeof t}const{isFinite:n}=Number;function o(t){return"number"==typeof t}const a=/^-?\d+(?:\.\d+)?$/;function h(t){return"string"==typeof t&&a.test(t)?+t:t}const{isArray:l}=Array;function d(t){return t&&"object"==typeof t}function c(t){return d(t)&&!l(t)}function u(t){return"{}"===JSON.stringify(t)}const _={default:(t,e)=>(p(e,t),p(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 p(t[i],e[i],s&&s[i]);s&&i in s?(null===(o=s[i])||void 0===o?void 0:o.constructor)===Object&&p(t[i]={},e[i],s[i]):t[i]=e[i]})},copyAttrs:(t,e,r)=>(r.forEach(r=>{s(e[r])||(t[r]=e[r])}),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:p}=_;class f{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}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(!s(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let r;for(let i in this)"_"!==i[0]&&(r=e?e[i]:void 0,t[i]=s(r)?this[i]:r);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!s(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!s(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const r={};if(t)if(l(t))for(let e of t)r[e]=this.__getInput(e);else for(let e in t)r[e]=this.__getInput(e);else{let t,e,{__input:i}=this;r.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!s(t))){if("path"===n&&!this.__pathInputed)continue;e=i?i[n]:void 0,r[n]=s(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:i,e:n,f:o}=this.__leaf.__localMatrix;r.matrix={a:t,b:e,c:s,d:i,e:n,f:o}}return r}__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{floor:g,max:y}=Math,m={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",isLarge:(t,e,s,r)=>t.width*t.height*(e?e*s:1)>(r||x.maxCacheSize),isSuperLarge:(t,e,s)=>x.isLarge(t,e,s,x.maxPatternSize),getRealURL(t){const{prefix:e,suffix:s}=m.image;return!s||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+s),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,s,r,i,n,o,a,h){const l=m.origin.createCanvas(y(g(e+(r||0)),1),y(g(s+(i||0)),1)),d=l.getContext("2d");if(a&&(d.globalAlpha=a),d.imageSmoothingEnabled=!1!==o,n){const r=e/n.width,i=s/n.height;d.setTransform(r,0,0,i,-n.x*r,-n.y*i),d.drawImage(t,0,0,t.width,t.height)}else d.drawImage(t,0,0,e,s);return l},setPatternTransform(t,e,s){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}s&&_.stintSet(s,"transform",e)}}},{image:x}=m,w={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=b;return e[t]?e[t]++:(e[t]=1,0)}},b=w;let B,v,k;const{max:C}=Math,O=[0,0,0,0],T={zero:[...O],tempFour:O,set:(t,e,s,r,i)=>(void 0===s&&(s=r=i=e),t[0]=e,t[1]=s,t[2]=r,t[3]=i,t),setTemp:(t,e,s,r)=>P(O,t,e,s,r),toTempAB(t,e,s){k=s?o(t)?e:t:[],o(t)?(B=L(t),v=e):o(e)?(B=t,v=L(e)):(B=t,v=e),4!==B.length&&(B=S(B)),4!==v.length&&(v=S(v))},get(t,e){let r;if(!o(t))switch(t.length){case 4:r=s(e)?t:[...t];break;case 2:r=[t[0],t[1],t[0],t[1]];break;case 3:r=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(r||(r=[t,t,t,t]),!s(e))for(let t=0;t<4;t++)r[t]>e&&(r[t]=e);return r},max:(t,e,s)=>o(t)&&o(e)?C(t,e):(R(t,e,s),P(k,C(B[0],v[0]),C(B[1],v[1]),C(B[2],v[2]),C(B[3],v[3]))),add:(t,e,s)=>o(t)&&o(e)?t+e:(R(t,e,s),P(k,B[0]+v[0],B[1]+v[1],B[2]+v[2],B[3]+v[3])),swapAndScale(t,e,s,r){if(o(t))return e===s?t*e:[t*s,t*e];const i=r?t:[],[n,a,h,l]=4===t.length?t:S(t);return P(i,h*s,l*e,n*s,a*e)}},{set:P,get:S,setTemp:L,toTempAB:R}=T,{round:E,pow:I,max:M,floor:A,PI:W}=Math,N={within:(t,e,r)=>(d(e)&&(r=e.max,e=e.min),!s(e)&&t<e&&(t=e),!s(r)&&t>r&&(t=r),t),fourNumber:T.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),N.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 r=s(e)?1e12:I(10,e);return-0===(t=E(t*r)/r)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,s,r){if(r||(r={}),e){const t=(o(e)?e:e.width||0)/s.width,i=(o(e)?e:e.height||0)/s.height;r.scaleX=t||i||1,r.scaleY=i||t||1}else t&&N.assignScale(r,t);return r},assignScale(t,e){o(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>M(A(t),e)/t,randInt:Y,randColor:t=>`rgba(${Y(255)},${Y(255)},${Y(255)},${t||1})`};function Y(t){return Math.round(Math.random()*t)}const D=W/180,X=2*W,z=W/2;function F(){return{x:0,y:0}}function U(){return{x:0,y:0,width:0,height:0}}function j(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:H,cos:G,acos:V,sqrt:q}=Math,{float:Q}=N,J={};function Z(){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 $={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:Z(),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:j,getWorld:Z,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},pixelScale(t,e,s){s||(s=t),s.a=t.a*e,s.b=t.b*e,s.c=t.c*e,s.d=t.d*e,s.e=t.e*e,s.f=t.f*e},scaleOfOuter(t,e,s,r){K.toInnerPoint(t,e,J),K.scaleOfInner(t,J,s,r)},scaleOfInner(t,e,s,r=s){K.translateInner(t,e.x,e.y),K.scale(t,s,r),K.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:r,c:i,d:n}=t,o=G(e*=D),a=H(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){K.toInnerPoint(t,e,J),K.rotateOfInner(t,J,s)},rotateOfInner(t,e,s){K.translateInner(t,e.x,e.y),K.rotate(t,s),K.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:r,b:i,c:n,d:o}=t;s&&(s*=D,t.a=r+n*s,t.b=i+o*s),e&&(e*=D,t.c=n+r*e,t.d=o+i*e)},skewOfOuter(t,e,s,r){K.toInnerPoint(t,e,J),K.skewOfInner(t,J,s,r)},skewOfInner(t,e,s,r=0){K.translateInner(t,e.x,e.y),K.skew(t,s,r),K.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,r,i,n){const{e:o,f:a}=t;if(r||(r=t),s(i)&&(i=1!==t.a||t.b||t.c||1!==t.d),i){const{a:s,b:i,c:o,d:a}=t;r.a=s*e.a+i*e.c,r.b=s*e.b+i*e.d,r.c=o*e.a+a*e.c,r.d=o*e.b+a*e.d,n&&(r.scaleX=e.scaleX*n.scaleX,r.scaleY=e.scaleY*n.scaleY)}else r.a=e.a,r.b=e.b,r.c=e.c,r.d=e.d,n&&(r.scaleX=e.scaleX,r.scaleY=e.scaleY);r.e=o*e.a+a*e.c+e.e,r.f=o*e.b+a*e.d+e.f},divide(t,e){K.multiply(t,K.tempInvert(e))},divideParent(t,e){K.multiplyParent(t,K.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=K;return K.copy(e,t),K.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,r,i,n){const{x:o,y:a,scaleX:h,scaleY:l}=e;if(s(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:s,skewX:r,skewY:i}=e,n=s*D,o=G(n),a=H(n);if(r||i){const e=r*D,s=i*D;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,(r=r||i)&&K.translateInner(t,-r.x,-r.y,!i)},getLayout(t,e,s,r){const{a:i,b:n,c:o,d:a,e:h,f:l}=t;let d,c,u,_,p,f=h,g=l;if(n||o){const t=i*a-n*o;if(o&&!r){d=q(i*i+n*n),c=t/d;const e=i/d;u=n>0?V(e):-V(e)}else{c=q(o*o+a*a),d=t/c;const e=o/c;u=z-(a>0?V(-e):-V(e))}const e=Q(G(u)),s=H(u);d=Q(d),c=Q(c),_=e?Q((o/c+s)/e/D,9):0,p=e?Q((n/d-s)/e/D,9):0,u=Q(u/D)}else d=i,c=a,u=_=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:c,rotation:u,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=q(r*r+i*i)):(e=r,s=o)}return r.scaleX=e,r.scaleY=s,r},reset(t){K.set(t)}},K=$,{float:tt}=N,{toInnerPoint:et,toOuterPoint:st}=$,{sin:rt,cos:it,abs:nt,sqrt:ot,atan2:at,min:ht,round:lt}=Math,dt={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,r){t.radiusX=e,t.radiusY=s(r)?e:r},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?lt(t.x-.5)+.5:lt(t.x),t.y=e?lt(t.y-.5)+.5:lt(t.y)},move(t,e,s){d(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=ct.defaultPoint);const r=it(e*=D),i=rt(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}=ct;return _t(s,t),et(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=ct;return _t(s,t),st(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=ct;return _t(s,t),ct.toInnerRadiusPointOf(t,e,s),s},copyRadiusPoint:(t,e,s,r)=>(_t(t,e),pt(t,s,r),t),toInnerRadiusPointOf(t,e,s){s||(s=t),et(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){et(e,t,s)},toOuterOf(t,e,s){st(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)=>ut(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,r){const i=nt(s-t),n=nt(r-e);return ot(i*i+n*n)},getMinDistanceFrom:(t,e,s,r,i,n)=>ht(ut(t,e,s,r),ut(s,r,i,n)),getAngle:(t,e)=>ft(t,e)/D,getRotation:(t,e,s,r)=>(r||(r=e),ct.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,r.x,r.y)/D),getRadianFrom(t,e,r,i,n,o,a,h){s(a)&&(a=r,h=i);const l=t-r,d=e-i,c=n-a,u=o-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>at(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,r,i){const n=ft(t,e);return i&&(t=e),r||(e={}),e.x=t.x+it(n)*s,e.y=t.y+rt(n)*s,e},toNumberPoints(t){let e=t;return d(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e)=>tt(t.x)===tt(e.x)&&tt(t.y)===tt(e.y),reset(t){ct.reset(t)}},ct=dt,{getDistanceFrom:ut,copy:_t,setRadius:pt,getAtan2:ft}=ct;class gt{constructor(t,e){this.set(t,e)}set(t,e){return d(t)?dt.copy(this,t):dt.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new gt(this)}move(t,e){return dt.move(this,t,e),this}scale(t,e){return dt.scale(this,t,e),this}scaleOf(t,e,s){return dt.scaleOf(this,t,e,s),this}rotate(t,e){return dt.rotate(this,t,e),this}rotateOf(t,e){return dt.rotate(this,e,t),this}getRotation(t,e,s){return dt.getRotation(this,t,e,s)}toInnerOf(t,e){return dt.toInnerOf(this,t,e),this}toOuterOf(t,e){return dt.toOuterOf(this,t,e),this}getCenter(t){return new gt(dt.getCenter(this,t))}getDistance(t){return dt.getDistance(this,t)}getDistancePoint(t,e,s,r){return new gt(dt.getDistancePoint(this,t,e,s,r))}getAngle(t){return dt.getAngle(this,t)}getAtan2(t){return dt.getAtan2(this,t)}isSame(t){return dt.isSame(this,t)}reset(){return dt.reset(this),this}}const yt=new gt;class mt{constructor(t,e,s,r,i,n){this.set(t,e,s,r,i,n)}set(t,e,s,r,i,n){return d(t)?$.copy(this,t):$.set(this,t,e,s,r,i,n),this}setWith(t){return $.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 mt(this)}translate(t,e){return $.translate(this,t,e),this}translateInner(t,e){return $.translateInner(this,t,e),this}scale(t,e){return $.scale(this,t,e),this}scaleWith(t,e){return $.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return $.pixelScale(this,t),this}scaleOfOuter(t,e,s){return $.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return $.scaleOfInner(this,t,e,s),this}rotate(t){return $.rotate(this,t),this}rotateOfOuter(t,e){return $.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return $.rotateOfInner(this,t,e),this}skew(t,e){return $.skew(this,t,e),this}skewOfOuter(t,e,s){return $.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return $.skewOfInner(this,t,e,s),this}multiply(t){return $.multiply(this,t),this}multiplyParent(t){return $.multiplyParent(this,t),this}divide(t){return $.divide(this,t),this}divideParent(t){return $.divideParent(this,t),this}invert(){return $.invert(this),this}invertWith(){return $.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){$.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){$.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return $.setLayout(this,t,e,s),this}getLayout(t,e,s){return $.getLayout(this,t,e,s)}withScale(t,e){return $.withScale(this,t,e)}reset(){$.reset(this)}}const xt=new mt,wt={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){bt(t,e,s),bt(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:bt}=wt;var Bt,vt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(Bt||(Bt={})),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"}(vt||(vt={}));const kt=[{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}];kt.forEach(t=>t.type="percent");const Ct={directionData:kt,tempPoint:{},get:Ot,toPoint(t,e,s,r,i,n){const o=Ot(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={}),Ct.toPoint(t,e,s,!0),s)};function Ot(t){return i(t)?kt[vt[t]]:t}const{toPoint:Tt}=Ct,Pt={toPoint(t,e,s,r,i,n){Tt(t,s,r,i,e,n)}},{tempPointBounds:St,setPoint:Lt,addPoint:Rt,toBounds:Et}=wt,{toOuterPoint:It}=$,{float:Mt,fourNumber:At}=N,{floor:Wt,ceil:Nt}=Math;let Yt,Dt,Xt,zt;const Ft={},Ut={},jt={},Ht={tempBounds:jt,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(l(s)){const e=At(s);r?Gt.set(t,n+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):Gt.set(t,n-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else r&&(s=-s),Gt.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),Gt.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?qt(e,t):e=t,s||(s=t),e.offsetX=Gt.maxX(s),e.offsetY=Gt.maxY(s),Gt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e,r){r||dt.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,r=s){dt.scaleOf(t,e,s,r),t.width*=s,t.height*=r},tempToOuterOf:(t,e)=>(Gt.copy(jt,t),Gt.toOuterOf(jt,e),jt),getOuterOf:(t,e)=>(t=Object.assign({},t),Gt.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:r,d:i,e:n,f:o}=e;r>0?(s.width=t.width*r,s.x=n+t.x*r):(s.width=t.width*-r,s.x=n+t.x*r-s.width),i>0?(s.height=t.height*i,s.y=o+t.y*i):(s.height=t.height*-i,s.y=o+t.y*i-s.height)}else Ft.x=t.x,Ft.y=t.y,It(e,Ft,Ut),Lt(St,Ut.x,Ut.y),Ft.x=t.x+t.width,It(e,Ft,Ut),Rt(St,Ut.x,Ut.y),Ft.y=t.y+t.height,It(e,Ft,Ut),Rt(St,Ut.x,Ut.y),Ft.x=t.x,It(e,Ft,Ut),Rt(St,Ut.x,Ut.y),Et(St,s)},toInnerOf(t,e,s){s||(s=t),Gt.move(s,-e.e,-e.f),Gt.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const r=Math.min(s,Gt.getFitScale(t,e));return new mt(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,n=!0,o){o||(o=e),i(r)&&(r=Gt.getFitScale(t,e,"cover"===r)),jt.width=n?e.width*=r:e.width*r,jt.height=n?e.height*=r:e.height*r,Pt.toPoint(s,jt,t,o,!0,!0)},getSpread(t,e,s){const r={};return Gt.copyAndSpread(r,t,e,!1,s),r},spread(t,e,s){Gt.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){Gt.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=Wt(t.x),t.y=Wt(t.y),t.width=e>t.x?Nt(t.width+e-t.x):Nt(t.width),t.height=s>t.y?Nt(t.height+s-t.y):Nt(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=Mt(t.x,e),t.y=Mt(t.y,e),t.width=Mt(t.width,e),t.height=Mt(t.height,e)},add(t,e,s){Yt=t.x+t.width,Dt=t.y+t.height,Xt=e.x,zt=e.y,s||(Xt+=e.width,zt+=e.height),Yt=Yt>Xt?Yt:Xt,Dt=Dt>zt?Dt:zt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Yt-t.x,t.height=Dt-t.y},addList(t,e){Gt.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){Gt.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){Gt.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||qt(t,i)):Vt(t,i));n&&Gt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Lt(St,t.x,t.y):Rt(St,t.x,t.y)),Et(St,t)},setPoint(t,e){Gt.set(t,e.x,e.y)},addPoint(t,e){Vt(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=dt.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=dt.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=Gt.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=Gt.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=Gt.tempToOuterOf(e,s)),!Gt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:r,y:i,width:n,height:o}=e;return Yt=r+n,Dt=i+o,Xt=t.x+t.width,zt=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,Yt=Yt<Xt?Yt:Xt,Dt=Dt<zt?Dt:zt,n=Yt-r,o=Dt-i,{x:r,y:i,width:n,height:o}},intersect(t,e,s){Gt.copy(t,Gt.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){Gt.set(t)}},Gt=Ht,{add:Vt,copy:qt}=Gt;class Qt{get minX(){return Ht.minX(this)}get minY(){return Ht.minY(this)}get maxX(){return Ht.maxX(this)}get maxY(){return Ht.maxY(this)}constructor(t,e,s,r){this.set(t,e,s,r)}set(t,e,s,r){return d(t)?Ht.copy(this,t):Ht.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 Qt(this)}move(t,e){return Ht.move(this,t,e),this}scale(t,e,s){return Ht.scale(this,t,e,s),this}scaleOf(t,e,s){return Ht.scaleOf(this,t,e,s),this}toOuterOf(t,e){return Ht.toOuterOf(this,t,e),this}toInnerOf(t,e){return Ht.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Ht.getFitMatrix(this,t,e)}put(t,e,s){Ht.put(this,t,e,s)}spread(t,e){return Ht.spread(this,t,e),this}shrink(t,e){return Ht.shrink(this,t,e),this}ceil(){return Ht.ceil(this),this}unsign(){return Ht.unsign(this),this}float(t){return Ht.float(this,t),this}add(t){return Ht.add(this,t),this}addList(t){return Ht.setList(this,t,!0),this}setList(t){return Ht.setList(this,t),this}addListWithFn(t,e){return Ht.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Ht.setListWithFn(this,t,e),this}setPoint(t){return Ht.setPoint(this,t),this}setPoints(t){return Ht.setPoints(this,t),this}addPoint(t){return Ht.addPoint(this,t),this}getPoints(){return Ht.getPoints(this)}hitPoint(t,e){return Ht.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Ht.hitRadiusPoint(this,t,e)}hit(t,e){return Ht.hit(this,t,e)}includes(t,e){return Ht.includes(this,t,e)}intersect(t,e){return Ht.intersect(this,t,e),this}getIntersect(t,e){return new Qt(Ht.getIntersectData(this,t,e))}isSame(t){return Ht.isSame(this,t)}isEmpty(){return Ht.isEmpty(this)}reset(){Ht.reset(this)}}const Jt=new Qt;class Zt{constructor(t,e,s,r,i,n){d(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 Qt(i,e,n||t.width-i-s,o||t.height-e-r)}}const $t={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:Kt}=N;class te{constructor(t){this.repeatMap={},this.name=t}static get(t){return new te(t)}static set filter(t){this.filterList=ee(t)}static set exclude(t){this.excludeList=ee(t)}static drawRepaint(t,e){const s=Kt();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const r="hit"===te.showBounds,i=t.__nowWorld,n=Kt();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(se.enable){if(se.filterList.length&&se.filterList.every(t=>t!==this.name))return;if(se.excludeList.length&&se.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){se.enable&&this.warn(...t)}warn(...t){se.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 ee(t){return t?i(t)&&(t=[t]):t=[],t}te.filterList=[],te.excludeList=[],te.showWarn=!0;const se=te,re=te.get("RunTime"),ie={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const s=w.create(w.RUNTIME);return ne.currentId=ne.idMap[s]=e?performance.now():Date.now(),ne.currentName=ne.nameMap[s]=t,ne.nameToIdMap[t]=s,s},end(t,e){const s=ne.idMap[t],r=ne.nameMap[t],i=e?(performance.now()-s)/1e3:Date.now()-s;ne.idMap[t]=ne.nameMap[t]=ne.nameToIdMap[r]=void 0,re.log(r,i,"ms")},endOfName(t,e){const r=ne.nameToIdMap[t];s(r)||ne.end(r,e)}},ne=ie,oe=[],ae={list:{},add(t,...e){this.list[t]=!0,oe.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(()=>oe.forEach(t=>ae.has(t,!0)));const he={editor:t=>ae.need("editor")},le=te.get("UICreator"),de={list:{},register(t){const{__tag:e}=t.prototype;ce[e]&&le.repeat(e),ce[e]=t},get(t,e,r,i,n,o){ce[t]||le.error("not register "+t);const a=new ce[t](e);return s(r)||(a.x=r,i&&(a.y=i),n&&(a.width=n),o&&(a.height=o)),a}},{list:ce}=de,ue=te.get("EventCreator"),_e={nameList:{},register(t){let e;Object.keys(t).forEach(s=>{e=t[s],i(e)&&(pe[e]&&ue.repeat(e),pe[e]=t)})},changeName(t,e){const s=pe[t];if(s){const r=Object.keys(s).find(e=>s[e]===t);r&&(s[r]=e,pe[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new pe[t](...e)},{nameList:pe}=_e;class fe{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=he.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 ge(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 ye(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 me(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 xe=[];function we(){return(t,e)=>{xe.push(e)}}const be=[];class Be{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||be)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;xe.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){d(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}}ge([me("imageSmoothingEnabled")],Be.prototype,"smooth",void 0),ge([me("imageSmoothingQuality")],Be.prototype,"smoothLevel",void 0),ge([me("globalAlpha")],Be.prototype,"opacity",void 0),ge([me()],Be.prototype,"fillStyle",void 0),ge([me()],Be.prototype,"strokeStyle",void 0),ge([me("lineWidth")],Be.prototype,"strokeWidth",void 0),ge([me("lineCap")],Be.prototype,"strokeCap",void 0),ge([me("lineJoin")],Be.prototype,"strokeJoin",void 0),ge([me("lineDashOffset")],Be.prototype,"dashOffset",void 0),ge([me()],Be.prototype,"miterLimit",void 0),ge([me()],Be.prototype,"shadowBlur",void 0),ge([me()],Be.prototype,"shadowColor",void 0),ge([me()],Be.prototype,"shadowOffsetX",void 0),ge([me()],Be.prototype,"shadowOffsetY",void 0),ge([me()],Be.prototype,"filter",void 0),ge([me()],Be.prototype,"font",void 0),ge([me()],Be.prototype,"fontKerning",void 0),ge([me()],Be.prototype,"fontStretch",void 0),ge([me()],Be.prototype,"fontVariantCaps",void 0),ge([me()],Be.prototype,"textAlign",void 0),ge([me()],Be.prototype,"textBaseline",void 0),ge([me()],Be.prototype,"textRendering",void 0),ge([me()],Be.prototype,"wordSpacing",void 0),ge([me()],Be.prototype,"letterSpacing",void 0),ge([me()],Be.prototype,"direction",void 0),ge([we()],Be.prototype,"setTransform",null),ge([we()],Be.prototype,"resetTransform",null),ge([we()],Be.prototype,"getTransform",null),ge([we()],Be.prototype,"save",null),ge([we()],Be.prototype,"restore",null),ge([we()],Be.prototype,"translate",null),ge([we()],Be.prototype,"scale",null),ge([we()],Be.prototype,"rotate",null),ge([we()],Be.prototype,"fill",null),ge([we()],Be.prototype,"stroke",null),ge([we()],Be.prototype,"clip",null),ge([we()],Be.prototype,"fillRect",null),ge([we()],Be.prototype,"strokeRect",null),ge([we()],Be.prototype,"clearRect",null),ge([we()],Be.prototype,"beginPath",null),ge([we()],Be.prototype,"moveTo",null),ge([we()],Be.prototype,"lineTo",null),ge([we()],Be.prototype,"bezierCurveTo",null),ge([we()],Be.prototype,"quadraticCurveTo",null),ge([we()],Be.prototype,"closePath",null),ge([we()],Be.prototype,"arc",null),ge([we()],Be.prototype,"arcTo",null),ge([we()],Be.prototype,"ellipse",null),ge([we()],Be.prototype,"rect",null),ge([we()],Be.prototype,"roundRect",null),ge([we()],Be.prototype,"createConicGradient",null),ge([we()],Be.prototype,"createLinearGradient",null),ge([we()],Be.prototype,"createPattern",null),ge([we()],Be.prototype,"createRadialGradient",null),ge([we()],Be.prototype,"fillText",null),ge([we()],Be.prototype,"measureText",null),ge([we()],Be.prototype,"strokeText",null);const{copy:ve,multiplyParent:ke,pixelScale:Ce}=$,{round:Oe}=Math,Te=new Qt,Pe=new Qt,Se={width:1,height:1,pixelRatio:1},Le=["width","height","pixelRatio"];class Re extends Be{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(t,e){super(),this.size={},this.worldTransform={},t||(t=Se),this.manager=e,this.innerId=w.create(w.CNAVAS);const{width:s,height:r,pixelRatio:i}=t;this.autoLayout=!s||!r,this.size.pixelRatio=i||m.devicePixelRatio,this.config=t,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;_.copyAttrs(r,t,Le),Le.forEach(t=>r[t]||(r[t]=1)),this.bounds=new Qt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!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&&ke(t,e,i),Ce(t,s,i),r&&!t.ignorePixelSnap&&(t.half&&t.half*s%2?(i.e=Oe(i.e-.5)+.5,i.f=Oe(i.f-.5)+.5):(i.e=Oe(i.e),i.f=Oe(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:r,strokeJoin:i,dashPattern:n,dashOffset:o,miterLimit:a}=t;e&&(e.strokeCap&&(r=e.strokeCap),e.strokeJoin&&(i=e.strokeJoin),s(e.dashPattern)||(n=e.dashPattern),s(e.dashOffset)||(o=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=r,this.strokeJoin=i,this.dashPattern=n,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){r&&(this.blendMode=r),e?(this.setTempPixelBounds(e,i),s?(this.setTempPixelBounds2(s,i),s=Pe):s=Te,this.drawImage(t.view,Te.x,Te.y,Te.width,Te.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){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Ht.tempToOuterOf(s,e),r,i),this.restore()):(r&&(this.blendMode=r),this.setTempPixelBounds(e,i),this.drawImage(t.view,Te.x,Te.y,Te.width,Te.height,s.x,s.y,s.width,s.height),r&&(this.blendMode="source-over"))}copyWorldByReset(t,e,s,r,i,n){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(Te.x,Te.y,Te.width,Te.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,Te.x,Te.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(Te.x,Te.y,Te.width,Te.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s,r){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempPixelBounds(t,r),this.strokeRect(Te.x,Te.y,Te.width,Te.height),s&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Te.x,Te.y,Te.width,Te.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Te.x,Te.y,Te.width,Te.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,s){this.copyToPixelBounds(Te,t,e,s)}setTempPixelBounds2(t,e,s){this.copyToPixelBounds(Pe,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):he.canvas(Object.assign({},s));return i.save(),t&&(ve(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 Ee={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Ie={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Me=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},Ie),Ae={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},We={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},Ne=Object.assign(Object.assign({},We),Ie),Ye=Me,De={};for(let t in Ye)De[Ye[t]]=t;const Xe={};for(let t in Ye)Xe[Ye[t]]=Ae[t];const ze={drawRoundRect(t,e,s,r,i,n){const o=N.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:Fe,cos:Ue,hypot:je,atan2:He,ceil:Ge,abs:Ve,PI:qe,sqrt:Qe,pow:Je}=Math,{setPoint:Ze,addPoint:$e}=wt,{set:Ke,toNumberPoints:ts}=dt,{M:es,L:ss,C:rs,Q:is,Z:ns}=Me,os={},as={points(t,e,s,r){let i=ts(e);if(t.push(es,i[0],i[1]),s&&i.length>5){let e,n,o,a,h,l,d,c,u,_,p,f,g,y,m,x=i.length;const w=!0===s?.5:s;r&&(i=[i[x-2],i[x-1],...i,i[0],i[1],i[2],i[3]],x=i.length);for(let s=2;s<x-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=o-e,f=a-n,g=Qe(Je(p,2)+Je(f,2)),y=Qe(Je(h-o,2)+Je(l-a,2)),(g||y)&&(m=g+y,g=w*g/m,y=w*y/m,h-=e,l-=n,d=o-g*h,c=a-g*l,2===s?r||t.push(is,d,c,o,a):(p||f)&&t.push(rs,u,_,d,c,o,a),u=o+y*h,_=a+y*l);r||t.push(is,u,_,i[x-2],i[x-1])}else for(let e=2,s=i.length;e<s;e+=2)t.push(ss,i[e],i[e+1]);r&&t.push(ns)},rect(t,e,s,r,i){Ee.creator.path=t,Ee.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){Ee.creator.path=[],ze.drawRoundRect(Ee.creator,e,s,r,i,n),t.push(...Ee.convertToCanvasData(Ee.creator.path,!0))},arcTo(t,e,s,r,i,n,o,a,h,l,d){const c=r-e,u=i-s,_=n-r,p=o-i;let f=He(u,c),g=He(p,_);const y=je(c,u),m=je(_,p);let x=g-f;if(x<0&&(x+=X),y<1e-12||m<1e-12||x<1e-12||Ve(x-qe)<1e-12)return t&&t.push(ss,r,i),h&&(Ze(h,e,s),$e(h,r,i)),d&&Ke(d,e,s),void(l&&Ke(l,r,i));const w=c*p-_*u<0,b=w?-1:1,B=a/Ue(x/2),v=r+B*Ue(f+x/2+z*b),k=i+B*Fe(f+x/2+z*b);return f-=z*b,g-=z*b,ds(t,v,k,a,a,0,f/D,g/D,w,h,l,d)},arc:(t,e,s,r,i,n,o,a,h,l)=>ds(t,e,s,r,r,0,i,n,o,a,h,l),ellipse(t,e,s,r,i,n,o,a,h,l,d,c){const u=n*D,_=Fe(u),p=Ue(u);let f=o*D,g=a*D;f>qe&&(f-=X),g<0&&(g+=X);let y=g-f;y<0?y+=X:y>X&&(y-=X),h&&(y-=X);const m=Ge(Ve(y/z)),x=y/m,w=Fe(x/4),b=8/3*w*w/Fe(x/2);g=f+x;let B,v,k,C,O,T,P,S,L=Ue(f),R=Fe(f),E=k=p*r*L-_*i*R,I=C=_*r*L+p*i*R,M=e+k,A=s+C;t&&t.push(t.length?ss:es,M,A),l&&Ze(l,M,A),c&&Ke(c,M,A);for(let n=0;n<m;n++)B=Ue(g),v=Fe(g),k=p*r*B-_*i*v,C=_*r*B+p*i*v,O=e+E-b*(p*r*R+_*i*L),T=s+I-b*(_*r*R-p*i*L),P=e+k+b*(p*r*v+_*i*B),S=s+C+b*(_*r*v-p*i*B),t&&t.push(rs,O,T,P,S,e+k,s+C),l&&ls(e+E,s+I,O,T,P,S,e+k,s+C,l,!0),E=k,I=C,L=B,R=v,f=g,g+=x;d&&Ke(d,e+k,s+C)},quadraticCurveTo(t,e,s,r,i,n,o){t.push(rs,(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){ls(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 c,u,_,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),c=-3*x+9*w-9*b+3*B,u=6*x-12*w+6*b,_=3*w-3*x,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(f=(-u+m)/(2*c),0<f&&f<1&&d.push(f),g=(-u-m)/(2*c),0<g&&g<1&&d.push(g));l?$e(h,t,e):Ze(h,t,e),$e(h,o,a);for(let l=0,c=d.length;l<c;l++)hs(d[l],t,e,s,r,i,n,o,a,os),$e(h,os.x,os.y)},getPointAndSet(t,e,s,r,i,n,o,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*r+_*n+p*a,l.y=c*s+u*i+_*o+p*h},getPoint(t,e,s,r,i,n,o,a,h){const l={};return hs(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:hs,toTwoPointBounds:ls,ellipse:ds}=as,{sin:cs,cos:us,sqrt:_s,atan2:ps}=Math,{ellipse:fs}=as,gs={ellipticalArc(t,e,s,r,i,n,o,a,h,l,d){const c=(h-e)/2,u=(l-s)/2,_=n*D,p=cs(_),f=us(_),g=-f*c-p*u,y=-f*u+p*c,x=r*r,w=i*i,b=y*y,B=g*g,v=x*w-x*b-w*B;let k=0;if(v<0){const t=_s(1-v/(x*w));r*=t,i*=t}else k=(o===a?-1:1)*_s(v/(x*b+w*B));const C=k*r*y/i,O=-k*i*g/r,T=ps((y-O)/i,(g-C)/r),P=ps((-y-O)/i,(-g-C)/r);let S=P-T;0===a&&S>0?S-=X:1===a&&S<0&&(S+=X);const L=e+c+f*C-p*O,R=s+u+p*C+f*O,E=S<0?1:0;d||m.ellipseToCurve?fs(t,L,R,r,i,n,T/D,P/D,E):r!==i||n?t.push(Me.G,L,R,r,i,n,T/D,P/D,E):t.push(Me.O,L,R,r,T/D,P/D,E)}},ys={toCommand:t=>[],toNode:t=>[]},{M:ms,m:xs,L:ws,l:bs,H:Bs,h:vs,V:ks,v:Cs,C:Os,c:Ts,S:Ps,s:Ss,Q:Ls,q:Rs,T:Es,t:Is,A:Ms,a:As,Z:Ws,z:Ns,N:Ys,D:Ds,X:Xs,G:zs,F:Fs,O:Us,P:js,U:Hs}=Me,{rect:Gs,roundRect:Vs,arcTo:qs,arc:Qs,ellipse:Js,quadraticCurveTo:Zs}=as,{ellipticalArc:$s}=gs,Ks=te.get("PathConvert"),tr={},er={current:{dot:0},stringify(t,e){let s,r,i,n=0,o=t.length,a="";for(;n<o;){r=t[n],s=Xe[r],a+=r===i?" ":De[r];for(let r=1;r<s;r++)a+=N.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?Ne:We;for(let e=0,h=t.length;e<h;e++)r=t[e],$t[r]?("."===r&&(sr.dot&&(rr(o,n),n=""),sr.dot++),"0"===n&&"."!==r&&(rr(o,n),n=""),n+=r):Me[r]?(n&&(rr(o,n),n=""),sr.name=Me[r],sr.length=Ae[r],sr.index=0,rr(o,sr.name),!s&&a[r]&&(s=!0)):"-"===r||"+"===r?"e"===i||"E"===i?n+=r:(n&&rr(o,n),n=r):n&&(rr(o,n),n=""),i=r;return n&&rr(o,n),s?er.toCanvasData(o,e):o},toCanvasData(t,e){let s,r,i,n,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(i=t[c],i){case xs:t[c+1]+=a,t[c+2]+=h;case ms:a=t[c+1],h=t[c+2],_.push(ms,a,h),c+=3;break;case vs:t[c+1]+=a;case Bs:a=t[c+1],_.push(ws,a,h),c+=2;break;case Cs:t[c+1]+=h;case ks:h=t[c+1],_.push(ws,a,h),c+=2;break;case bs:t[c+1]+=a,t[c+2]+=h;case ws:a=t[c+1],h=t[c+2],_.push(ws,a,h),c+=3;break;case Ss:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,i=Ps;case Ps:o=n===Os||n===Ps,l=o?2*a-s:t[c+1],d=o?2*h-r:t[c+2],s=t[c+1],r=t[c+2],a=t[c+3],h=t[c+4],_.push(Os,l,d,s,r,a,h),c+=5;break;case Ts:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,i=Os;case Os:s=t[c+3],r=t[c+4],a=t[c+5],h=t[c+6],_.push(Os,t[c+1],t[c+2],s,r,a,h),c+=7;break;case Is:t[c+1]+=a,t[c+2]+=h,i=Es;case Es:o=n===Ls||n===Es,s=o?2*a-s:t[c+1],r=o?2*h-r:t[c+2],e?Zs(_,a,h,s,r,t[c+1],t[c+2]):_.push(Ls,s,r,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Rs:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,i=Ls;case Ls:s=t[c+1],r=t[c+2],e?Zs(_,a,h,s,r,t[c+3],t[c+4]):_.push(Ls,s,r,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case As:t[c+6]+=a,t[c+7]+=h;case Ms:$s(_,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case Ns:case Ws:_.push(Ws),c++;break;case Ys:a=t[c+1],h=t[c+2],e?Gs(_,a,h,t[c+3],t[c+4]):ir(_,t,c,5),c+=5;break;case Ds:a=t[c+1],h=t[c+2],e?Vs(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):ir(_,t,c,9),c+=9;break;case Xs:a=t[c+1],h=t[c+2],e?Vs(_,a,h,t[c+3],t[c+4],t[c+5]):ir(_,t,c,6),c+=6;break;case zs:Js(e?_:ir(_,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,tr),a=tr.x,h=tr.y,c+=9;break;case Fs:e?Js(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):ir(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Us:Qs(e?_:ir(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,tr),a=tr.x,h=tr.y,c+=7;break;case js:e?Qs(_,t[c+1],t[c+2],t[c+3],0,360,!1):ir(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Hs:qs(e?_:ir(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,tr),a=tr.x,h=tr.y,c+=6;break;default:return Ks.error(`command: ${i} [index:${c}]`,t),_}n=i}return _},objectToCanvasData(t){if(t[0].name.length>1)return ys.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(ms,t.x,t.y);break;case"L":e.push(ws,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(Ls,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Ws)}}),e}},copyData(t,e,s,r){for(let i=s,n=s+r;i<n;i++)t.push(e[i])},pushData(t,e){sr.index===sr.length&&(sr.index=1,t.push(sr.name)),t.push(Number(e)),sr.index++,sr.dot=0}},{current:sr,pushData:rr,copyData:ir}=er,{M:nr,L:or,C:ar,Q:hr,Z:lr,N:dr,D:cr,X:ur,G:_r,F:pr,O:fr,P:gr,U:yr}=Me,{getMinDistanceFrom:mr,getRadianFrom:xr}=dt,{tan:wr,min:br,abs:Br}=Math,vr={},kr={beginPath(t){t.length=0},moveTo(t,e,s){t.push(nr,e,s)},lineTo(t,e,s){t.push(or,e,s)},bezierCurveTo(t,e,s,r,i,n,o){t.push(ar,e,s,r,i,n,o)},quadraticCurveTo(t,e,s,r,i){t.push(hr,e,s,r,i)},closePath(t){t.push(lr)},rect(t,e,s,r,i){t.push(dr,e,s,r,i)},roundRect(t,e,s,r,i,n){if(o(n))t.push(ur,e,s,r,i,n);else{const o=N.fourNumber(n);o?t.push(cr,e,s,r,i,...o):t.push(dr,e,s,r,i)}},ellipse(t,e,s,i,n,o,a,h,l){if(i===n)return Or(t,e,s,i,a,h,l);r(o)?t.push(pr,e,s,i,n):(r(a)&&(a=0),r(h)&&(h=360),t.push(_r,e,s,i,n,o,a,h,l?1:0))},arc(t,e,s,i,n,o,a){r(n)?t.push(gr,e,s,i):(r(n)&&(n=0),r(o)&&(o=360),t.push(fr,e,s,i,n,o,a?1:0))},arcTo(t,e,r,i,n,o,a,h){if(!s(a)){const t=mr(a,h,e,r,i,n);o=br(o,br(t/2,t/2*Br(wr(xr(a,h,e,r,i,n)/2))))}t.push(yr,e,r,i,n,o)},drawEllipse(t,e,s,i,n,o,a,h,l){as.ellipse(null,e,s,i,n,r(o)?0:o,r(a)?0:a,r(h)?360:h,l,null,null,vr),t.push(nr,vr.x,vr.y),Cr(t,e,s,i,n,o,a,h,l)},drawArc(t,e,s,i,n,o,a){as.arc(null,e,s,i,r(n)?0:n,r(o)?360:o,a,null,null,vr),t.push(nr,vr.x,vr.y),Or(t,e,s,i,n,o,a)},drawPoints(t,e,s,r){as.points(t,e,s,r)}},{ellipse:Cr,arc:Or}=kr,{moveTo:Tr,lineTo:Pr,quadraticCurveTo:Sr,bezierCurveTo:Lr,closePath:Rr,beginPath:Er,rect:Ir,roundRect:Mr,ellipse:Ar,arc:Wr,arcTo:Nr,drawEllipse:Yr,drawArc:Dr,drawPoints:Xr}=kr;class zr{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?i(t)?Ee.parse(t):t:[],this}beginPath(){return Er(this.__path),this.paint(),this}moveTo(t,e){return Tr(this.__path,t,e),this.paint(),this}lineTo(t,e){return Pr(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,r,i,n){return Lr(this.__path,t,e,s,r,i,n),this.paint(),this}quadraticCurveTo(t,e,s,r){return Sr(this.__path,t,e,s,r),this.paint(),this}closePath(){return Rr(this.__path),this.paint(),this}rect(t,e,s,r){return Ir(this.__path,t,e,s,r),this.paint(),this}roundRect(t,e,s,r,i){return Mr(this.__path,t,e,s,r,i),this.paint(),this}ellipse(t,e,s,r,i,n,o,a){return Ar(this.__path,t,e,s,r,i,n,o,a),this.paint(),this}arc(t,e,s,r,i,n){return Wr(this.__path,t,e,s,r,i,n),this.paint(),this}arcTo(t,e,s,r,i){return Nr(this.__path,t,e,s,r,i),this.paint(),this}drawEllipse(t,e,s,r,i,n,o,a){return Yr(this.__path,t,e,s,r,i,n,o,a),this.paint(),this}drawArc(t,e,s,r,i,n){return Dr(this.__path,t,e,s,r,i,n),this.paint(),this}drawPoints(t,e,s){return Xr(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Fr,L:Ur,C:jr,Q:Hr,Z:Gr,N:Vr,D:qr,X:Qr,G:Jr,F:Zr,O:$r,P:Kr,U:ti}=Me,ei=te.get("PathDrawer"),si={drawPathByData(t,e){if(!e)return;let s,r=0,i=e.length;for(;r<i;)switch(s=e[r],s){case Fr:t.moveTo(e[r+1],e[r+2]),r+=3;break;case Ur:t.lineTo(e[r+1],e[r+2]),r+=3;break;case jr:t.bezierCurveTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5],e[r+6]),r+=7;break;case Hr:t.quadraticCurveTo(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case Gr:t.closePath(),r+=1;break;case Vr:t.rect(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case qr: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 Qr:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;case Jr:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]*D,e[r+6]*D,e[r+7]*D,e[r+8]),r+=9;break;case Zr:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,X,!1),r+=5;break;case $r:t.arc(e[r+1],e[r+2],e[r+3],e[r+4]*D,e[r+5]*D,e[r+6]),r+=7;break;case Kr:t.arc(e[r+1],e[r+2],e[r+3],0,X,!1),r+=4;break;case ti:t.arcTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;default:return void ei.error(`command: ${s} [index:${r}]`,e)}}},{M:ri,L:ii,C:ni,Q:oi,Z:ai,N:hi,D:li,X:di,G:ci,F:ui,O:_i,P:pi,U:fi}=Me,{toTwoPointBounds:gi,toTwoPointBoundsByQuadraticCurve:yi,arcTo:mi,arc:xi,ellipse:wi}=as,{addPointBounds:bi,copy:Bi,addPoint:vi,setPoint:ki,addBounds:Ci,toBounds:Oi}=wt,Ti=te.get("PathBounds");let Pi,Si,Li;const Ri={},Ei={},Ii={},Mi={toBounds(t,e){Mi.toTwoPointBounds(t,Ei),Oi(Ei,e)},toTwoPointBounds(t,e){if(!t||!t.length)return ki(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===ai||o===ni||o===oi?ki(e,h,l):ki(e,t[a+1],t[a+2])),o){case ri:case ii:h=t[a+1],l=t[a+2],vi(e,h,l),a+=3;break;case ni:i=t[a+5],n=t[a+6],gi(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,n,Ri),bi(e,Ri),h=i,l=n,a+=7;break;case oi:s=t[a+1],r=t[a+2],i=t[a+3],n=t[a+4],yi(h,l,s,r,i,n,Ri),bi(e,Ri),h=i,l=n,a+=5;break;case ai:a+=1;break;case hi:h=t[a+1],l=t[a+2],Ci(e,h,l,t[a+3],t[a+4]),a+=5;break;case li:case di:h=t[a+1],l=t[a+2],Ci(e,h,l,t[a+3],t[a+4]),a+=o===li?9:6;break;case ci:wi(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],Ri,Ii),0===a?Bi(e,Ri):bi(e,Ri),h=Ii.x,l=Ii.y,a+=9;break;case ui:h=t[a+1],l=t[a+2],Si=t[a+3],Li=t[a+4],Ci(e,h-Si,l-Li,2*Si,2*Li),h+=Si,a+=5;break;case _i:xi(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Ri,Ii),0===a?Bi(e,Ri):bi(e,Ri),h=Ii.x,l=Ii.y,a+=7;break;case pi:h=t[a+1],l=t[a+2],Pi=t[a+3],Ci(e,h-Pi,l-Pi,2*Pi,2*Pi),h+=Pi,a+=4;break;case fi:mi(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Ri,Ii),0===a?Bi(e,Ri):bi(e,Ri),h=Ii.x,l=Ii.y,a+=6;break;default:return void Ti.error(`command: ${o} [index:${a}]`,t)}}},{M:Ai,L:Wi,Z:Ni}=Me,{getCenterX:Yi,getCenterY:Di}=dt,{arcTo:Xi}=kr,zi={smooth(t,e,s){let r,i,n,o=0,a=0,h=0,d=0,c=0,u=0,_=0,p=0,f=0;l(e)&&(e=e[0]||0);const g=t.length,y=[];for(;o<g;){switch(r=t[o],r){case Ai:d=p=t[o+1],c=f=t[o+2],o+=3,t[o]===Wi?(u=t[o+1],_=t[o+2],y.push(Ai,Yi(d,u),Di(c,_))):y.push(Ai,d,c);break;case Wi:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case Wi:Xi(y,a,h,t[o+1],t[o+2],e,p,f);break;case Ni:Xi(y,a,h,d,c,e,p,f);break;default:y.push(Wi,a,h)}p=a,f=h;break;case Ni:i!==Ni&&(Xi(y,d,c,u,_,e,p,f),y.push(Ni)),o+=1;break;default:n=Xe[r];for(let e=0;e<n;e++)y.push(t[o+e]);o+=n}i=r}return r!==Ni&&(y[1]=d,y[2]=c),y}};function Fi(t){return new zr(t)}const Ui=Fi();Ee.creator=Fi(),Ee.parse=er.parse,Ee.convertToCanvasData=er.toCanvasData;const{drawRoundRect:ji}=ze;function Hi(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,r,i){ji(this,t,e,s,r,i)})}(t)}const Gi={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=Vi.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{}}}},Vi=Gi;Vi.alphaPixelTypes.forEach(t=>Vi.upperCaseTypeMap[t]=t.toUpperCase());const qi=te.get("TaskProcessor");class Qi{constructor(t){this.parallel=!0,this.time=1,this.id=w.create(w.TASK),this.task=t}run(){return ye(this,void 0,void 0,function*(){try{if(this.isComplete)return;if(this.canUse&&!this.canUse())return this.cancel();this.task&&this.parent.running&&(yield this.task())}catch(t){qi.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.comple