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