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