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