@leafer/core 1.0.0-rc.9 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{dist → lib}/core.cjs +1536 -2299
- package/{dist → lib}/core.esm.js +1519 -2287
- package/lib/core.esm.min.js +1 -0
- package/lib/core.min.cjs +1 -0
- package/package.json +22 -25
- package/src/index.ts +6 -4
- package/types/index.d.ts +6 -3
- package/dist/core.esm.min.js +0 -1
- package/dist/core.min.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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)=>(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=e?n(10,e):1e12;return-0===(t=i(t*s)/s)?0:t}},h=o/180,l=2*o,d=o/2;function u(){return{x:0,y:0}}function c(){return{x:0,y:0,width:0,height:0}}function _(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:p,cos:f,acos:g,sqrt:y}=Math,{float:m}=a,x={};function w(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const b={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:w(),tempMatrix:{},set(t,e=1,s=0,r=0,i=1,n=0,o=0){t.a=e,t.b=s,t.c=r,t.d=i,t.e=n,t.f=o},get:_,getWorld:w,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s,r){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s,r&&(t.e-=e,t.f-=s)},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},scaleOfOuter(t,e,s,r){v.toInnerPoint(t,e,x),v.scaleOfInner(t,x,s,r)},scaleOfInner(t,e,s,r=s){v.translateInner(t,e.x,e.y),v.scale(t,s,r),v.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:r,c:i,d:n}=t,o=f(e*=h),a=p(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){v.toInnerPoint(t,e,x),v.rotateOfInner(t,x,s)},rotateOfInner(t,e,s){v.translateInner(t,e.x,e.y),v.rotate(t,s),v.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:r,b:i,c:n,d:o}=t;s&&(s*=h,t.a=r+n*s,t.b=i+o*s),e&&(e*=h,t.c=n+r*e,t.d=o+i*e)},skewOfOuter(t,e,s,r){v.toInnerPoint(t,e,x),v.skewOfInner(t,x,s,r)},skewOfInner(t,e,s,r=0){v.translateInner(t,e.x,e.y),v.skew(t,s,r),v.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){v.multiply(t,v.tempInvert(e))},divideParent(t,e){v.multiplyParent(t,v.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=v;return v.copy(e,t),v.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){const{x:i,y:n,scaleX:o,scaleY:a}=e;if(void 0===r&&(r=e.rotation||e.skewX||e.skewY),r){const{rotation:s,skewX:r,skewY:i}=e,n=s*h,l=f(n),d=p(n);if(r||i){const e=r*h,s=i*h;t.a=(l+s*-d)*o,t.b=(d+s*l)*o,t.c=(e*l-d)*a,t.d=(l+e*d)*a}else t.a=l*o,t.b=d*o,t.c=-d*a,t.d=l*a}else t.a=o,t.b=0,t.c=0,t.d=a;t.e=i,t.f=n,s&&v.translateInner(t,-s.x,-s.y,!0)},getLayout(t,e,s){const{a:r,b:i,c:n,d:o,e:a,f:l}=t;let u,c,_,x,w,b=a,v=l;if(i||n){const t=r*o-i*n;if(n&&!s){u=y(r*r+i*i),c=t/u;const e=r/u;_=i>0?g(e):-g(e)}else{c=y(n*n+o*o),u=t/c;const e=n/c;_=d-(o>0?g(-e):-g(e))}const e=m(f(_)),a=p(_);u=m(u),c=m(c),x=e?m((n/c+a)/e/h,9):0,w=e?m((i/u-a)/e/h,9):0,_=m(_/h)}else u=r,c=o,_=x=w=0;return e&&(b+=e.x*r+e.y*n,v+=e.x*i+e.y*o),{x:b,y:v,scaleX:u,scaleY:c,rotation:_,skewX:x,skewY:w}},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=y(r*r+i*i)):(e=r,s=o)}return r.scaleX=e,r.scaleY=s,r},reset(t){v.set(t)}},v=b,{toInnerPoint:B,toOuterPoint:k}=b,{sin:C,cos:O,abs:T,sqrt:R,atan2:P,min:S,PI:L}=Math,I={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},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=M.defaultPoint);const r=O(e*=h),i=C(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}=M;return E(s,t),B(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=M;return E(s,t),k(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=M;return E(s,t),M.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),B(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){B(e,t,s)},toOuterOf(t,e,s){k(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)=>A(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,r){const i=T(s-t),n=T(r-e);return R(i*i+n*n)},getMinDistanceFrom:(t,e,s,r,i,n)=>S(A(t,e,s,r),A(s,r,i,n)),getAngle:(t,e)=>W(t,e)/h,getRotation:(t,e,s,r)=>(r||(r=e),M.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,r.x,r.y)/h),getRadianFrom(t,e,s,r,i,n,o,a){void 0===o&&(o=s,a=r);let h=P(e-r,t-s);const d=P(n-a,i-o)-h;return d<-L?d+l:d},getAtan2:(t,e)=>P(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,r){const i=W(t,e);return(e=r?e:{}).x=t.x+O(i)*s,e.y=t.y+C(i)*s,e},reset(t){M.reset(t)}},M=I,{getDistanceFrom:A,copy:E,getAtan2:W}=M;class N{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?I.copy(this,t):I.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new N(this)}move(t,e){return I.move(this,t,e),this}scale(t,e){return I.scale(this,t,e),this}scaleOf(t,e,s){return I.scaleOf(this,t,e,s),this}rotate(t,e){return I.rotate(this,t,e),this}rotateOf(t,e){return I.rotate(this,e,t),this}getRotation(t,e,s){return I.getRotation(this,t,e,s)}toInnerOf(t,e){return I.toInnerOf(this,t,e),this}toOuterOf(t,e){return I.toOuterOf(this,t,e),this}getCenter(t){return new N(I.getCenter(this,t))}getDistance(t){return I.getDistance(this,t)}getDistancePoint(t,e,s){return new N(I.getDistancePoint(this,t,e,s))}getAngle(t){return I.getAngle(this,t)}getAtan2(t){return I.getAtan2(this,t)}reset(){return I.reset(this),this}}const Y=new N;class X{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?b.copy(this,t):b.set(this,t,e,s,r,i,n),this}setWith(t){return b.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 X(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,s){return b.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return b.scaleOfInner(this,t,e,s),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,s){return b.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return b.skewOfInner(this,t,e,s),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,s){b.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){b.toInnerPoint(this,t,e,s)}setLayout(t,e){return b.setLayout(this,t,e),this}getLayout(t,e){return b.getLayout(this,t,e)}withScale(t,e){return b.withScale(this,t,e)}reset(){b.reset(this)}}const D=new X,z={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){F(t,e,s),F(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:F}=z,{tempPointBounds:j,setPoint:U,addPoint:G,toBounds:H}=z,{toOuterPoint:q}=b,{float:V,fourNumber:Q}=a,{floor:J,ceil:Z}=Math;let $,K,tt,et;const st={},rt={},it={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){if(s instanceof Array){const i=Q(s);r?nt.set(t,e.x+i[3],e.y+i[0],e.width-i[1]-i[3],e.height-i[2]-i[0]):nt.set(t,e.x-i[3],e.y-i[0],e.width+i[1]+i[3],e.height+i[2]+i[0])}else r&&(s=-s),nt.set(t,e.x-s,e.y-s,e.width+2*s,e.height+2*s)},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),nt.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?at(e,t):e=t,s?(e.offsetX=-(nt.maxX(s)-t.x),e.offsetY=-(nt.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),nt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e){I.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,r=s){I.scaleOf(t,e,s,r),t.width*=s,t.height*=r},tempToOuterOf:(t,e)=>(nt.copy(nt.tempBounds,t),nt.toOuterOf(nt.tempBounds,e),nt.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),nt.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 st.x=t.x,st.y=t.y,q(e,st,rt),U(j,rt.x,rt.y),st.x=t.x+t.width,q(e,st,rt),G(j,rt.x,rt.y),st.y=t.y+t.height,q(e,st,rt),G(j,rt.x,rt.y),st.x=t.x,q(e,st,rt),G(j,rt.x,rt.y),H(j,s)},toInnerOf(t,e,s){s||(s=t),nt.move(s,-e.e,-e.f),nt.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 X(r,0,0,r,-e.x*r,-e.y*r)},getSpread(t,e){const s={};return nt.copyAndSpread(s,t,e),s},spread(t,e){nt.copyAndSpread(t,t,e)},shrink(t,e){nt.copyAndSpread(t,t,e,!0)},ceil(t){const{x:e,y:s}=t;t.x=J(t.x),t.y=J(t.y),t.width=e>t.x?Z(t.width+e-t.x):Z(t.width),t.height=s>t.y?Z(t.height+s-t.y):Z(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=V(t.x,e),t.y=V(t.y,e),t.width=V(t.width,e),t.height=V(t.height,e)},add(t,e,s){$=t.x+t.width,K=t.y+t.height,tt=e.x,et=e.y,s||(tt+=e.width,et+=e.height),$=$>tt?$:tt,K=K>et?K:et,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=$-t.x,t.height=K-t.y},addList(t,e){nt.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){nt.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){nt.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||at(t,i)):ot(t,i));n&&nt.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?U(j,t.x,t.y):G(j,t.x,t.y))),H(j,t)},setPoint(t,e){nt.set(t,e.x,e.y)},addPoint(t,e){ot(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=I.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=I.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=nt.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=nt.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=nt.tempToOuterOf(e,s)),!nt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:r,y:i,width:n,height:o}=e;return $=r+n,K=i+o,tt=t.x+t.width,et=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,$=$<tt?$:tt,K=K<et?K:et,n=$-r,o=K-i,{x:r,y:i,width:n,height:o}},intersect(t,e,s){nt.copy(t,nt.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){nt.set(t)}},nt=it,{add:ot,copy:at}=nt;class ht{get minX(){return it.minX(this)}get minY(){return it.minY(this)}get maxX(){return it.maxX(this)}get maxY(){return it.maxY(this)}constructor(t,e,s,r){this.set(t,e,s,r)}set(t,e,s,r){return"object"==typeof t?it.copy(this,t):it.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 ht(this)}move(t,e){return it.move(this,t,e),this}scale(t,e){return it.scale(this,t,e),this}scaleOf(t,e,s){return it.scaleOf(this,t,e,s),this}toOuterOf(t,e){return it.toOuterOf(this,t,e),this}toInnerOf(t,e){return it.toInnerOf(this,t,e),this}getFitMatrix(t,e){return it.getFitMatrix(this,t,e)}spread(t){return it.spread(this,t),this}shrink(t){return it.shrink(this,t),this}ceil(){return it.ceil(this),this}unsign(){return it.unsign(this),this}float(t){return it.float(this,t),this}add(t){return it.add(this,t),this}addList(t){return it.setList(this,t,!0),this}setList(t){return it.setList(this,t),this}addListWithFn(t,e){return it.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return it.setListWithFn(this,t,e),this}setPoint(t){return it.setPoint(this,t),this}setPoints(t){return it.setPoints(this,t),this}addPoint(t){return it.addPoint(this,t),this}getPoints(){return it.getPoints(this)}hitPoint(t,e){return it.hitPoint(this,t,e)}hitRadiusPoint(t,e){return it.hitRadiusPoint(this,t,e)}hit(t,e){return it.hit(this,t,e)}includes(t,e){return it.includes(this,t,e)}intersect(t,e){return it.intersect(this,t,e),this}getIntersect(t,e){return new ht(it.getIntersectData(this,t,e))}isSame(t){return it.isSame(this,t)}isEmpty(){return it.isEmpty(this)}reset(){it.reset(this)}}const lt=new ht;class dt{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 ht(i,e,n||t.width-i-s,o||t.height-e-r)}}var ut,ct;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(ut||(ut={})),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"}(ct||(ct={}));const _t=[{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}];_t.forEach((t=>t.type="percent"));const pt={directionData:_t,tempPoint:{},get:ft,toPoint(t,e,s,r,i){s||(s={});const n=ft(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 ft(t){return"string"==typeof t?_t[ct[t]]:t}const{toPoint:gt}=pt,yt={toPoint(t,e,s,r,i){gt(t,s,r,i,e)}},mt={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};class xt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new xt(t)}static set filter(t){this.filterList=wt(t)}static set exclude(t){this.excludeList=wt(t)}log(...t){if(bt.enable){if(bt.filterList.length&&bt.filterList.every((t=>t!==this.name)))return;if(bt.excludeList.length&&bt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){bt.enable&&this.warn(...t)}warn(...t){bt.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 wt(t){return t?"string"==typeof t&&(t=[t]):t=[],t}xt.filterList=[],xt.excludeList=[],xt.showWarn=!0;const bt=xt,vt=xt.get("RunTime"),Bt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const r=s.create(s.RUNTIME);return kt.currentId=kt.idMap[r]=e?performance.now():Date.now(),kt.currentName=kt.nameMap[r]=t,kt.nameToIdMap[t]=r,r},end(t,e){const s=kt.idMap[t],r=kt.nameMap[t],i=e?(performance.now()-s)/1e3:Date.now()-s;kt.idMap[t]=kt.nameMap[t]=kt.nameToIdMap[r]=void 0,vt.log(r,i,"ms")},endOfName(t,e){const s=kt.nameToIdMap[t];void 0!==s&&kt.end(s,e)}},kt=Bt,Ct=xt.get("UICreator"),Ot={list:{},register(t){const{__tag:e}=t.prototype;Tt[e]?Ct.repeat(e):Tt[e]=t},get(t,e,s,r,i,n){const o=new Tt[t](e);return void 0!==s&&(o.x=s,r&&(o.y=r),i&&(o.width=i),n&&(o.height=n)),o}},{list:Tt}=Ot,Rt=xt.get("EventCreator"),Pt={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(St[e]?Rt.repeat(e):St[e]=t)}))},changeName(t,e){const s=St[t];if(s){const r=Object.keys(s).find((e=>s[e]===t));r&&(s[r]=e,St[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new St[t](...e)},{nameList:St}=Pt;class Lt{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 It={default:(t,e)=>(Mt(e,t),Mt(t,e),t),assign(t,e){let s;Object.keys(e).forEach((r=>{var i;s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(i=t[r])||void 0===i?void 0:i.constructor)===Object?Mt(t[r],e[r]):t[r]=e[r]}))},copyAttrs:(t,e,s)=>(s.forEach((s=>{void 0!==e[s]&&(t[s]=e[s])})),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let s=0,r=t.length;s<r;s++)e[t[s]]=!0;return e}},{assign:Mt}=It;class At{get __useNaturalRatio(){return!0}get __isLinePath(){return this.path&&6===this.path.length}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||e.__hasEraser||t.eraser?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 Et;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(Et||(Et={}));const Wt={};function Nt(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 Yt(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 Xt(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 Dt=[];function zt(){return(t,e)=>{Dt.push(e)}}const Ft=[];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||Ft)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;Dt.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}}Nt([Xt("imageSmoothingEnabled")],jt.prototype,"smooth",void 0),Nt([Xt("imageSmoothingQuality")],jt.prototype,"smoothLevel",void 0),Nt([Xt("globalAlpha")],jt.prototype,"opacity",void 0),Nt([Xt()],jt.prototype,"fillStyle",void 0),Nt([Xt()],jt.prototype,"strokeStyle",void 0),Nt([Xt("lineWidth")],jt.prototype,"strokeWidth",void 0),Nt([Xt("lineCap")],jt.prototype,"strokeCap",void 0),Nt([Xt("lineJoin")],jt.prototype,"strokeJoin",void 0),Nt([Xt("lineDashOffset")],jt.prototype,"dashOffset",void 0),Nt([Xt()],jt.prototype,"miterLimit",void 0),Nt([Xt()],jt.prototype,"shadowBlur",void 0),Nt([Xt()],jt.prototype,"shadowColor",void 0),Nt([Xt()],jt.prototype,"shadowOffsetX",void 0),Nt([Xt()],jt.prototype,"shadowOffsetY",void 0),Nt([Xt()],jt.prototype,"filter",void 0),Nt([Xt()],jt.prototype,"font",void 0),Nt([Xt()],jt.prototype,"fontKerning",void 0),Nt([Xt()],jt.prototype,"fontStretch",void 0),Nt([Xt()],jt.prototype,"fontVariantCaps",void 0),Nt([Xt()],jt.prototype,"textAlign",void 0),Nt([Xt()],jt.prototype,"textBaseline",void 0),Nt([Xt()],jt.prototype,"textRendering",void 0),Nt([Xt()],jt.prototype,"wordSpacing",void 0),Nt([Xt()],jt.prototype,"letterSpacing",void 0),Nt([Xt()],jt.prototype,"direction",void 0),Nt([zt()],jt.prototype,"setTransform",null),Nt([zt()],jt.prototype,"resetTransform",null),Nt([zt()],jt.prototype,"getTransform",null),Nt([zt()],jt.prototype,"save",null),Nt([zt()],jt.prototype,"restore",null),Nt([zt()],jt.prototype,"translate",null),Nt([zt()],jt.prototype,"scale",null),Nt([zt()],jt.prototype,"rotate",null),Nt([zt()],jt.prototype,"fill",null),Nt([zt()],jt.prototype,"stroke",null),Nt([zt()],jt.prototype,"clip",null),Nt([zt()],jt.prototype,"fillRect",null),Nt([zt()],jt.prototype,"strokeRect",null),Nt([zt()],jt.prototype,"clearRect",null),Nt([zt()],jt.prototype,"beginPath",null),Nt([zt()],jt.prototype,"moveTo",null),Nt([zt()],jt.prototype,"lineTo",null),Nt([zt()],jt.prototype,"bezierCurveTo",null),Nt([zt()],jt.prototype,"quadraticCurveTo",null),Nt([zt()],jt.prototype,"closePath",null),Nt([zt()],jt.prototype,"arc",null),Nt([zt()],jt.prototype,"arcTo",null),Nt([zt()],jt.prototype,"ellipse",null),Nt([zt()],jt.prototype,"rect",null),Nt([zt()],jt.prototype,"roundRect",null),Nt([zt()],jt.prototype,"createConicGradient",null),Nt([zt()],jt.prototype,"createLinearGradient",null),Nt([zt()],jt.prototype,"createPattern",null),Nt([zt()],jt.prototype,"createRadialGradient",null),Nt([zt()],jt.prototype,"fillText",null),Nt([zt()],jt.prototype,"measureText",null),Nt([zt()],jt.prototype,"strokeText",null);const{copy:Ut}=b,Gt={width:1,height:1,pixelRatio:1},Ht=["width","height","pixelRatio"];class qt 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 allowBackgroundColor(){return this.view&&this.parentView}constructor(e,r){super(),this.size={},this.worldTransform={},e||(e=Gt),e.pixelRatio||(e.pixelRatio=t.devicePixelRatio),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,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){if(this.isSameSize(t))return;let e;this.context&&!this.unreal&&this.width&&(e=this.getSameCanvas(),e.copyWorld(this)),It.copyAttrs(this.size,t,Ht),this.size.pixelRatio||(this.size.pixelRatio=1),this.bounds=new ht(0,0,this.width,this.height),this.unreal||(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&e&&(this.clearWorld(e.bounds),this.copyWorld(e),e.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}=this,r=this.worldTransform;if(e){const{a:i,b:n,c:o,d:a,e:h,f:l}=e;this.setTransform(r.a=(t.a*i+t.b*o)*s,r.b=(t.a*n+t.b*a)*s,r.c=(t.c*i+t.d*o)*s,r.d=(t.c*n+t.d*a)*s,r.e=(t.e*i+t.f*o+h)*s,r.f=(t.e*n+t.f*a+l)*s)}else this.setTransform(r.a=t.a*s,r.b=t.b*s,r.c=t.c*s,r.d=t.d*s,r.e=t.e*s,r.f=t.f*s)}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,it.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()}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,lt.set(t).scale(this.pixelRatio),this.fillRect(lt.x,lt.y,lt.width,lt.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,lt.set(t).scale(this.pixelRatio),this.strokeRect(lt.x,lt.y,lt.width,lt.height),s&&(this.blendMode="source-over")}clearWorld(t,e){lt.set(t).scale(this.pixelRatio),e&<.ceil(),this.clearRect(lt.x,lt.y,lt.width,lt.height)}clipWorld(t,e){this.beginPath(),lt.set(t).scale(this.pixelRatio),e&<.ceil(),this.rect(lt.x,lt.y,lt.width,lt.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}isSameSize(t){return this.width===t.width&&this.height===t.height&&this.pixelRatio===t.pixelRatio}getSameCanvas(t,s){const r=this.manager?this.manager.get(this.size):e.canvas(Object.assign({},this.size));return r.save(),t&&(Ut(r.worldTransform,this.worldTransform),r.useWorldTransform()),s&&(r.smooth=this.smooth),r}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t,!0):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Vt={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Qt={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Jt=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},Qt),Zt={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},$t={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},Kt=Object.assign(Object.assign({},$t),Qt),te=Jt,ee={};for(let t in te)ee[te[t]]=t;const se={};for(let t in te)se[te[t]]=Zt[t];const re={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:ie,cos:ne,atan2:oe,ceil:ae,abs:he,PI:le,sqrt:de,pow:ue}=Math,{setPoint:ce,addPoint:_e}=z,{set:pe}=I,{M:fe,L:ge,C:ye,Q:me,Z:xe}=Jt,we={},be={points(t,e,s,r){if(t.push(fe,e[0],e[1]),s&&e.length>5){let i,n,o,a,h,l,d,u,c,_,p,f,g,y=e.length;const m=!0===s?.5:s;r&&(y=(e=[e[y-2],e[y-1],...e,e[0],e[1],e[2],e[3]]).length);for(let s=2;s<y-2;s+=2)i=e[s-2],n=e[s-1],o=e[s],a=e[s+1],h=e[s+2],l=e[s+3],p=de(ue(o-i,2)+ue(a-n,2)),f=de(ue(h-o,2)+ue(l-a,2)),g=p+f,p=m*p/g,f=m*f/g,h-=i,l-=n,d=o-p*h,u=a-p*l,2===s?r||t.push(me,d,u,o,a):t.push(ye,c,_,d,u,o,a),c=o+f*h,_=a+f*l;r||t.push(me,c,_,e[y-2],e[y-1])}else for(let s=2,r=e.length;s<r;s+=2)t.push(ge,e[s],e[s+1]);r&&t.push(xe)},rect(t,e,s,r,i){Vt.creator.path=t,Vt.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){Vt.creator.path=[],re.drawRoundRect(Vt.creator,e,s,r,i,n),t.push(...Vt.convertToCanvasData(Vt.creator.path,!0))},arcTo(t,e,s,r,i,n,o,a,u,c,_){const p=r-e,f=i-s,g=n-r,y=o-i;let m=oe(f,p),x=oe(y,g),w=x-m;if(w<0&&(w+=l),w===le||he(p+f)<1e-12||he(g+y)<1e-12)return t&&t.push(ge,r,i),u&&(ce(u,e,s),_e(u,r,i)),_&&pe(_,e,s),void(c&&pe(c,r,i));const b=p*y-g*f<0,v=b?-1:1,B=a/ne(w/2),k=r+B*ne(m+w/2+d*v),C=i+B*ie(m+w/2+d*v);return m-=d*v,x-=d*v,ke(t,k,C,a,a,0,m/h,x/h,b,u,c,_)},arc:(t,e,s,r,i,n,o,a,h,l)=>ke(t,e,s,r,r,0,i,n,o,a,h,l),ellipse(t,e,s,r,i,n,o,a,u,c,_,p){const f=n*h,g=ie(f),y=ne(f);let m=o*h,x=a*h;m>le&&(m-=l),x<0&&(x+=l);let w=x-m;w<0?w+=l:w>l&&(w-=l),u&&(w-=l);const b=ae(he(w/d)),v=w/b,B=ie(v/4),k=8/3*B*B/ie(v/2);x=m+v;let C,O,T,R,P,S,L,I,M=ne(m),A=ie(m),E=T=y*r*M-g*i*A,W=R=g*r*M+y*i*A,N=e+T,Y=s+R;t&&t.push(ge,N,Y),c&&ce(c,N,Y),p&&pe(p,N,Y);for(let n=0;n<b;n++)C=ne(x),O=ie(x),T=y*r*C-g*i*O,R=g*r*C+y*i*O,P=e+E-k*(y*r*A+g*i*M),S=s+W-k*(g*r*A-y*i*M),L=e+T+k*(y*r*O+g*i*C),I=s+R+k*(g*r*O-y*i*C),t&&t.push(ye,P,S,L,I,e+T,s+R),c&&Be(e+E,s+W,P,S,L,I,e+T,s+R,c,!0),E=T,W=R,M=C,A=O,m=x,x+=v;_&&pe(_,e+T,s+R)},quadraticCurveTo(t,e,s,r,i,n,o){t.push(ye,(e+2*r)/3,(s+2*i)/3,(n+2*r)/3,(o+2*i)/3,n,o)},toTwoPointBoundsByQuadraticCurve(t,e,s,r,i,n,o,a){Be(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?_e(h,t,e):ce(h,t,e),_e(h,o,a);for(let l=0,u=d.length;l<u;l++)ve(d[l],t,e,s,r,i,n,o,a,we),_e(h,we.x,we.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 ve(t,e,s,r,i,n,o,a,h,l),l}},{getPointAndSet:ve,toTwoPointBounds:Be,ellipse:ke}=be,{sin:Ce,cos:Oe,sqrt:Te,atan2:Re}=Math,{ellipse:Pe}=be,Se={ellipticalArc(e,s,r,i,n,o,a,d,u,c,_){const p=(u-s)/2,f=(c-r)/2,g=o*h,y=Ce(g),m=Oe(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=Te(1-C/(b*v));i*=t,n*=t}else O=(a===d?-1:1)*Te(C/(b*B+v*k));const T=O*i*w/n,R=-O*n*x/i,P=Re((w-R)/n,(x-T)/i),S=Re((-w-R)/n,(-x-T)/i);let L=S-P;0===d&&L>0?L-=l:1===d&&L<0&&(L+=l);const I=s+p+m*T-y*R,M=r+f+y*T+m*R,A=L<0?1:0;_||t.ellipseToCurve?Pe(e,I,M,i,n,o,P/h,S/h,A):i!==n||o?e.push(Jt.G,I,M,i,n,o,P/h,S/h,A):e.push(Jt.O,I,M,i,P/h,S/h,A)}},{M:Le,m:Ie,L:Me,l:Ae,H:Ee,h:We,V:Ne,v:Ye,C:Xe,c:De,S:ze,s:Fe,Q:je,q:Ue,T:Ge,t:He,A:qe,a:Ve,Z:Qe,z:Je,N:Ze,D:$e,X:Ke,G:ts,F:es,O:ss,P:rs,U:is}=Jt,{rect:ns,roundRect:os,arcTo:as,arc:hs,ellipse:ls,quadraticCurveTo:ds}=be,{ellipticalArc:us}=Se,cs=xt.get("PathConvert"),_s={},ps={current:{dot:0},stringify(t,e){let s,r,i,n=0,o=t.length,h="";for(;n<o;){r=t[n],s=se[r],h+=r===i?" ":ee[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?Kt:$t;for(let e=0,h=t.length;e<h;e++)r=t[e],mt[r]?("."===r&&(fs.dot&&(gs(o,n),n=""),fs.dot++),"0"===n&&"."!==r&&(gs(o,n),n=""),n+=r):Jt[r]?(n&&(gs(o,n),n=""),fs.name=Jt[r],fs.length=Zt[r],fs.index=0,gs(o,fs.name),!s&&a[r]&&(s=!0)):"-"===r||"+"===r?"e"===i||"E"===i?n+=r:(n&&gs(o,n),n=r):n&&(gs(o,n),n=""),i=r;return n&&gs(o,n),s?ps.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 Ie:t[u+1]+=a,t[u+2]+=h;case Le:a=t[u+1],h=t[u+2],_.push(Le,a,h),u+=3;break;case We:t[u+1]+=a;case Ee:a=t[u+1],_.push(Me,a,h),u+=2;break;case Ye:t[u+1]+=h;case Ne:h=t[u+1],_.push(Me,a,h),u+=2;break;case Ae:t[u+1]+=a,t[u+2]+=h;case Me:a=t[u+1],h=t[u+2],_.push(Me,a,h),u+=3;break;case Fe:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=ze;case ze:o=n===Xe||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(Xe,l,d,s,r,a,h),u+=5;break;case De: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=Xe;case Xe:s=t[u+3],r=t[u+4],a=t[u+5],h=t[u+6],_.push(Xe,t[u+1],t[u+2],s,r,a,h),u+=7;break;case He:t[u+1]+=a,t[u+2]+=h,i=Ge;case Ge:o=n===je||n===Ge,s=o?2*a-s:t[u+1],r=o?2*h-r:t[u+2],e?ds(_,a,h,s,r,t[u+1],t[u+2]):_.push(je,s,r,t[u+1],t[u+2]),a=t[u+1],h=t[u+2],u+=3;break;case Ue:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=je;case je:s=t[u+1],r=t[u+2],e?ds(_,a,h,s,r,t[u+3],t[u+4]):_.push(je,s,r,t[u+3],t[u+4]),a=t[u+3],h=t[u+4],u+=5;break;case Ve:t[u+6]+=a,t[u+7]+=h;case qe:us(_,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 Je:case Qe:_.push(Qe),u++;break;case Ze:a=t[u+1],h=t[u+2],e?ns(_,a,h,t[u+3],t[u+4]):ys(_,t,u,5),u+=5;break;case $e:a=t[u+1],h=t[u+2],e?os(_,a,h,t[u+3],t[u+4],[t[u+5],t[u+6],t[u+7],t[u+8]]):ys(_,t,u,9),u+=9;break;case Ke:a=t[u+1],h=t[u+2],e?os(_,a,h,t[u+3],t[u+4],t[u+5]):ys(_,t,u,6),u+=6;break;case ts:ls(e?_:ys(_,t,u,9),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],t[u+7],t[u+8],null,_s),a=_s.x,h=_s.y,u+=9;break;case es:e?ls(_,t[u+1],t[u+2],t[u+3],t[u+4],0,0,360,!1):ys(_,t,u,5),a=t[u+1]+t[u+3],h=t[u+2],u+=5;break;case ss:hs(e?_:ys(_,t,u,7),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],null,_s),a=_s.x,h=_s.y,u+=7;break;case rs:e?hs(_,t[u+1],t[u+2],t[u+3],0,360,!1):ys(_,t,u,4),a=t[u+1]+t[u+3],h=t[u+2],u+=4;break;case is:as(e?_:ys(_,t,u,6),a,h,t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],null,_s),a=_s.x,h=_s.y,u+=6;break;default:return cs.error(`command: ${i} [index:${u}]`,t),_}n=i}return _},copyData(t,e,s,r){for(let i=s,n=s+r;i<n;i++)t.push(e[i])},pushData(t,e){fs.index===fs.length&&(fs.index=1,t.push(fs.name)),t.push(Number(e)),fs.index++,fs.dot=0}},{current:fs,pushData:gs,copyData:ys}=ps,{M:ms,L:xs,C:ws,Q:bs,Z:vs,N:Bs,D:ks,X:Cs,G:Os,F:Ts,O:Rs,P:Ps,U:Ss}=Jt,{getMinDistanceFrom:Ls,getRadianFrom:Is}=I,{tan:Ms,min:As,abs:Es}=Math,Ws={},Ns={beginPath(t){t.length=0},moveTo(t,e,s){t.push(ms,e,s)},lineTo(t,e,s){t.push(xs,e,s)},bezierCurveTo(t,e,s,r,i,n,o){t.push(ws,e,s,r,i,n,o)},quadraticCurveTo(t,e,s,r,i){t.push(bs,e,s,r,i)},closePath(t){t.push(vs)},rect(t,e,s,r,i){t.push(Bs,e,s,r,i)},roundRect(t,e,s,r,i,n){if("number"==typeof n)t.push(Cs,e,s,r,i,n);else{const o=a.fourNumber(n);o?t.push(ks,e,s,r,i,...o):t.push(Bs,e,s,r,i)}},ellipse(t,e,s,r,i,n,o,a,h){void 0===n?t.push(Ts,e,s,r,i):(void 0===o&&(o=0),void 0===a&&(a=360),t.push(Os,e,s,r,i,n,o,a,h?1:0))},arc(t,e,s,r,i,n,o){void 0===i?t.push(Ps,e,s,r):(void 0===n&&(n=360),t.push(Rs,e,s,r,i,n,o?1:0))},arcTo(t,e,s,r,i,n,o,a){if(void 0!==o){const h=Ms(Is(o,a,e,s,r,i)/2)*(Ls(o,a,e,s,r,i)/2);t.push(Ss,e,s,r,i,As(n,Es(h)))}else t.push(Ss,e,s,r,i,n)},drawEllipse(t,e,s,r,i,n,o,a,h){be.ellipse(null,e,s,r,i,void 0===n?0:n,void 0===o?0:o,void 0===a?360:a,h,null,null,Ws),t.push(ms,Ws.x,Ws.y),Ys(t,e,s,r,i,n,o,a,h)},drawArc(t,e,s,r,i,n,o){be.arc(null,e,s,r,void 0===i?0:i,void 0===n?360:n,o,null,null,Ws),t.push(ms,Ws.x,Ws.y),Xs(t,e,s,r,i,n,o)},drawPoints(t,e,s,r){be.points(t,e,s,r)}},{ellipse:Ys,arc:Xs}=Ns,{moveTo:Ds,lineTo:zs,quadraticCurveTo:Fs,bezierCurveTo:js,closePath:Us,beginPath:Gs,rect:Hs,roundRect:qs,ellipse:Vs,arc:Qs,arcTo:Js,drawEllipse:Zs,drawArc:$s,drawPoints:Ks}=Ns;class tr{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.clearPath=this.beginPath,this.set(t)}set(t){return this.__path=t?"string"==typeof t?Vt.parse(t):t:[],this}beginPath(){return Gs(this.__path),this}moveTo(t,e){return Ds(this.__path,t,e),this}lineTo(t,e){return zs(this.__path,t,e),this}bezierCurveTo(t,e,s,r,i,n){return js(this.__path,t,e,s,r,i,n),this}quadraticCurveTo(t,e,s,r){return Fs(this.__path,t,e,s,r),this}closePath(){return Us(this.__path),this}rect(t,e,s,r){return Hs(this.__path,t,e,s,r),this}roundRect(t,e,s,r,i){return qs(this.__path,t,e,s,r,i),this}ellipse(t,e,s,r,i,n,o,a){return Vs(this.__path,t,e,s,r,i,n,o,a),this}arc(t,e,s,r,i,n){return Qs(this.__path,t,e,s,r,i,n),this}arcTo(t,e,s,r,i){return Js(this.__path,t,e,s,r,i),this}drawEllipse(t,e,s,r,i,n,o,a){return Zs(this.__path,t,e,s,r,i,n,o,a),this}drawArc(t,e,s,r,i,n){return $s(this.__path,t,e,s,r,i,n),this}drawPoints(t,e,s){return Ks(this.__path,t,e,s),this}}const{M:er,L:sr,C:rr,Q:ir,Z:nr,N:or,D:ar,X:hr,G:lr,F:dr,O:ur,P:cr,U:_r}=Jt,pr=xt.get("PathDrawer"),fr={drawPathByData(t,e){if(!e)return;let s,r=0,i=e.length;for(;r<i;)switch(s=e[r],s){case er:t.moveTo(e[r+1],e[r+2]),r+=3;break;case sr:t.lineTo(e[r+1],e[r+2]),r+=3;break;case rr:t.bezierCurveTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5],e[r+6]),r+=7;break;case ir:t.quadraticCurveTo(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case nr:t.closePath(),r+=1;break;case or:t.rect(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case ar: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 hr:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;case lr:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]*h,e[r+6]*h,e[r+7]*h,e[r+8]),r+=9;break;case dr:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,l,!1),r+=5;break;case ur:t.arc(e[r+1],e[r+2],e[r+3],e[r+4]*h,e[r+5]*h,e[r+6]),r+=7;break;case cr:t.arc(e[r+1],e[r+2],e[r+3],0,l,!1),r+=4;break;case _r:t.arcTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;default:return void pr.error(`command: ${s} [index:${r}]`,e)}}},{M:gr,L:yr,C:mr,Q:xr,Z:wr,N:br,D:vr,X:Br,G:kr,F:Cr,O:Or,P:Tr,U:Rr}=Jt,{toTwoPointBounds:Pr,toTwoPointBoundsByQuadraticCurve:Sr,arcTo:Lr,arc:Ir,ellipse:Mr}=be,{addPointBounds:Ar,copy:Er,addPoint:Wr,setPoint:Nr,addBounds:Yr,toBounds:Xr}=z,Dr=xt.get("PathBounds");let zr,Fr,jr;const Ur={},Gr={},Hr={},qr={toBounds(t,e){qr.toTwoPointBounds(t,Gr),Xr(Gr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Nr(e,0,0);let s,r,i,n,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(s=t[a],0===a&&(s===wr||s===mr||s===xr?Nr(e,h,l):Nr(e,t[a+1],t[a+2])),s){case gr:case yr:h=t[a+1],l=t[a+2],Wr(e,h,l),a+=3;break;case mr:n=t[a+5],o=t[a+6],Pr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,Ur),Ar(e,Ur),h=n,l=o,a+=7;break;case xr:r=t[a+1],i=t[a+2],n=t[a+3],o=t[a+4],Sr(h,l,r,i,n,o,Ur),Ar(e,Ur),h=n,l=o,a+=5;break;case wr:a+=1;break;case br:h=t[a+1],l=t[a+2],Yr(e,h,l,t[a+3],t[a+4]),a+=5;break;case vr:case Br:h=t[a+1],l=t[a+2],Yr(e,h,l,t[a+3],t[a+4]),a+=s===vr?9:6;break;case kr:Mr(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],Ur,Hr),0===a?Er(e,Ur):Ar(e,Ur),h=Hr.x,l=Hr.y,a+=9;break;case Cr:h=t[a+1],l=t[a+2],Fr=t[a+3],jr=t[a+4],Yr(e,h-Fr,l-jr,2*Fr,2*jr),h+=Fr,a+=5;break;case Or:Ir(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Ur,Hr),0===a?Er(e,Ur):Ar(e,Ur),h=Hr.x,l=Hr.y,a+=7;break;case Tr:h=t[a+1],l=t[a+2],zr=t[a+3],Yr(e,h-zr,l-zr,2*zr,2*zr),h+=zr,a+=4;break;case Rr:Lr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Ur,Hr),0===a?Er(e,Ur):Ar(e,Ur),h=Hr.x,l=Hr.y,a+=6;break;default:return void Dr.error(`command: ${s} [index:${a}]`,t)}}},{M:Vr,L:Qr,C:Jr,Z:Zr}=Jt,{getCenterX:$r,getCenterY:Kr}=I,{arcTo:ti}=Ns,ei={smooth(t,e,s){let r,i=0,n=0,o=0,a=0,h=0,l=0,d=0,u=0,c=0;const _=t.length,p=[];for(;i<_;)switch(r=t[i],r){case Vr:a=u=t[i+1],h=c=t[i+2],i+=3,t[i]===Qr?(l=t[i+1],d=t[i+2],p.push(Vr,$r(a,l),Kr(h,d))):p.push(Vr,a,h);break;case Qr:switch(n=t[i+1],o=t[i+2],i+=3,t[i]){case Qr:ti(p,n,o,t[i+1],t[i+2],e,u,c);break;case Zr:ti(p,n,o,a,h,e,u,c);break;default:p.push(Qr,n,o)}u=n,c=o;break;case Jr:p.push(Jr,t[i+1],t[i+2],t[i+3],t[i+4],t[i+5],t[i+6]),i+=7;break;case Zr:ti(p,a,h,l,d,e,u,c),p.push(Zr),i+=1}return r!==Zr&&(p[1]=a,p[2]=h),p}};Vt.creator=new tr,Vt.parse=ps.parse,Vt.convertToCanvasData=ps.toCanvasData;const si=new tr,{drawRoundRect:ri}=re;function ii(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,r,i){ri(this,t,e,s,r,i)})}(t)}const ni={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=oi.fileType(t);return["jpg","jpeg"].some((t=>t===e))},getExportOptions(t){switch(typeof t){case"object":return t;case"number":return{quality:t};case"boolean":return{blob:t};default:return{}}}},oi=ni;oi.opacityTypes.forEach((t=>oi.upperCaseTypeMap[t]=t.toUpperCase()));const ai=xt.get("TaskProcessor");class hi{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return Yt(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){ai.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class li{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&&It.assign(this.config,t),this.empty()}add(t,e){let s,r,i,n;const o=new hi(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)}destroy(){this.stop()}}const di={map:{},recycledList:[],tasker:new li,patternTasker:new li,get isComplete(){return ui.tasker.isComplete},get(t){let s=ui.map[t.url];return s||(s=e.image(t),ui.map[t.url]=s),s.use++,s},recycle(t){t.use--,setTimeout((()=>{t.use||ui.recycledList.push(t)}))},clearRecycled(){const t=ui.recycledList;t.length>100&&(t.forEach((t=>{!t.use&&t.url&&(delete ui.map[t.url],t.destroy())})),t.length=0)},hasOpacityPixel:t=>ni.opacityTypes.some((e=>ui.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+ni.mineType(t)))return!0}else if(s.includes("."+t)||s.includes("."+ni.upperCaseTypeMap[t]))return!0;return!1},destroy(){ui.map={},ui.recycledList=[]}},ui=di,{IMAGE:ci,create:_i}=s;class pi{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){this.use=0,this.waitComplete=[],this.innerId=_i(ci),this.config=t||{url:""},this.isSVG=di.isFormat("svg",t),this.hasOpacityPixel=di.hasOpacityPixel(t)}load(e,s){return this.loading||(this.loading=!0,di.tasker.add((()=>Yt(this,void 0,void 0,(function*(){return yield t.origin.loadImage(this.url).then((t=>{this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)})).catch((t=>{this.error=t,this.onComplete(!1)}))}))))),this.waitComplete.push(e,s),this.waitComplete.length-2}unload(t,e){const s=this.waitComplete;if(e){const e=s[t+1];e&&e({type:"stop"})}s[t]=s[t+1]=void 0}onComplete(t){let e;this.waitComplete.forEach(((s,r)=>{e=r%2,s&&(t?e||s(this):e&&s(this.error))})),this.waitComplete.length=0,this.loading=!1}getCanvas(e,s,r,i){if(e||(e=this.width),s||(s=this.height),this.cache){let{params:t,data:e}=this.cache;for(let s in t)if(t[s]!==arguments[s]){e=null;break}if(e)return e}const n=t.origin.createCanvas(e,s),o=n.getContext("2d");return r&&(o.globalAlpha=r),o.drawImage(this.view,0,0,e,s),this.cache=this.use>1?{data:n,params:arguments}:null,n}getPattern(e,s,r,i){const n=t.canvas.createPattern(e,s);try{r&&n.setTransform&&(n.setTransform(r),r=null)}catch(t){}return i&&(i.transform=r),n}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function fi(t,e,s,r){r||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function gi(t,e){return Object.getOwnPropertyDescriptor(t,e)}function yi(t,e){return(s,r)=>xi(s,r,t,e&&e(r))}function mi(t){return t}function xi(t,e,s,r){const i={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};fi(t,e,Object.assign(i,r||{})),Ui(t,e,s)}function wi(t){return yi(t)}function bi(t,e){return yi(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})))}function vi(t){return yi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__hasAutoLayout=!!e,this.__local||this.__layout.createLocal())}})))}function Bi(t,e){return yi(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}})))}function ki(t,e){return yi(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}})))}function Ci(t,e){return yi(t,(t=>({set(s){this.__setAttr(t,s,e)&&Ti(this)}})))}function Oi(t){return yi(t,(t=>({set(e){this.__setAttr(t,e)&&(Ti(this),this.__.__removeNaturalSize())}})))}function Ti(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Ri(t){return yi(t,(t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),Ti(this)}})))}const Pi=Ci;function Si(t){return yi(t,(t=>({set(e){this.__setAttr(t,e)&&Li(this)}})))}function Li(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Ti(t)}const Ii=Si;function Mi(t){return yi(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))}function Ai(t){return yi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})))}function Ei(t){return yi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange())}})))}function Wi(t){return yi(t,(t=>({set(e){const s=this.visible;this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange(),0!==s&&0!==e||Ti(this))}})))}function Ni(t){return yi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()})))}})))}function Yi(t){return yi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(e)})))}})))}function Xi(t){return yi(t,(t=>({set(e){this.__setAttr(t,e)&&this.waitParent((()=>{this.parent.__updateEraser(e)}))}})))}function Di(t){return yi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,xt.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}})))}function zi(t){return yi(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}})))}function Fi(t){return(e,s)=>{fi(e,"__DataProcessor",{get:()=>t})}}function ji(t){return(e,s)=>{fi(e,"__LayoutProcessor",{get:()=>t})}}function Ui(t,e,s){const r=t.__DataProcessor.prototype,i="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),o={get(){const t=this[i];return void 0===t?s:t},set(t){this[i]=t}};void 0===s?o.get=function(){return this[i]}:"width"===e?o.get=function(){const t=this[i];if(void 0===t){const t=this;return t._height&&t.__naturalWidth&&t.__useNaturalRatio?t._height*t.__naturalWidth/t.__naturalHeight:t.__naturalWidth||s}return t}:"height"===e&&(o.get=function(){const t=this[i];if(void 0===t){const t=this;return t._width&&t.__naturalHeight&&t.__useNaturalRatio?t._width*t.__naturalHeight/t.__naturalWidth:t.__naturalHeight||s}return t});let a,h=r;for(;!a&&h;)a=gi(h,e),h=h.__proto__;a&&a.set&&(o.set=a.set),r[n]&&(o.set=r[n],delete r[n]),fi(r,e,o)}const Gi=new xt("rewrite"),Hi=[],qi=["destroy","constructor"];function Vi(t){return(e,s)=>{Hi.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function Qi(){return t=>{Ji()}}function Ji(t){Hi.length&&(Hi.forEach((e=>{t&&Gi.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Hi.length=0)}function Zi(t,e){return s=>{var r;(t.prototype?(r=t.prototype,Object.getOwnPropertyNames(r)):Object.keys(t)).forEach((r=>{if(!(qi.includes(r)||e&&e.includes(r)))if(t.prototype){gi(t.prototype,r).writable&&(s.prototype[r]=t.prototype[r])}else s.prototype[r]=t[r]}))}}function $i(){return t=>{Ot.register(t)}}function Ki(){return t=>{Pt.register(t)}}setTimeout((()=>Ji(!0)));const{copy:tn,toInnerPoint:en,scaleOfOuter:sn,rotateOfOuter:rn,skewOfOuter:nn,multiplyParent:on,divideParent:an,getLayout:hn}=b,ln={},dn={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),_n(t,e,s),t.isBranch){const{children:r}=t;for(let t=0,i=r.length;t<i;t++)cn(r[t],e,s)}},updateMatrix(t,e,s){const r=t.__layout;e?s&&(r.waitAutoLayout=!0,t.__hasAutoLayout&&(r.matrixChanged=!1)):r.waitAutoLayout&&(r.waitAutoLayout=!1),r.matrixChanged&&t.__updateLocalMatrix(),r.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)pn(e[t])}},updateAllChange(t){if(pn(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)fn(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},moveWorld(t,e,s=0){const r="object"==typeof e?Object.assign({},e):{x:e,y:s};t.parent&&en(t.parent.worldTransform,r,r,!0),un.moveLocal(t,r.x,r.y)},moveLocal(t,e,s=0){"object"==typeof e?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=s)},zoomOfWorld(t,e,s,r,i){un.zoomOfLocal(t,yn(t,e),s,r,i)},zoomOfLocal(t,e,s,r=s,i){tn(ln,t.__localMatrix),sn(ln,e,s,r),gn(t,ln),t.scaleResize(s,r,!0!==i)},rotateOfWorld(t,e,s){un.rotateOfLocal(t,yn(t,e),s)},rotateOfLocal(t,e,s){tn(ln,t.__localMatrix),rn(ln,e,s),gn(t,ln),t.rotation=a.formatRotation(t.rotation+s)},skewOfWorld(t,e,s,r,i){un.skewOfLocal(t,yn(t,e),s,r,i)},skewOfLocal(t,e,s,r=0,i){tn(ln,t.__localMatrix),nn(ln,e,s,r),un.setTransform(t,ln,i)},transformWorld(t,e,s){tn(ln,t.worldTransform),on(ln,e),t.parent&&an(ln,t.parent.worldTransform),un.setTransform(t,ln,s)},transform(t,e,s){tn(ln,t.localTransform),on(ln,e),un.setTransform(t,ln,s)},setTransform(t,e,s){const r=hn(e);if(s){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;delete r.scaleX,delete r.scaleY,t.set(r),t.scaleResize(e,i,!0!==s)}else t.set(r)},getLocalOrigin:(t,e)=>I.tempToOuterOf(un.getInnerOrigin(t,e),t.localTransform),getInnerOrigin:(t,e)=>("string"==typeof e&&pt.toPoint(e,t.boxBounds,e={}),e),getRelativeWorld:(t,e,s)=>(tn(ln,t.worldTransform),an(ln,e.worldTransform),s?ln:Object.assign({},ln)),drop(t,e,s,r){t.setTransform(un.getRelativeWorld(t,e,!0),r),e.add(t,s)},hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}}},un=dn,{updateAllMatrix:cn,updateMatrix:_n,updateAllWorldOpacity:pn,updateAllChange:fn}=un;function gn(t,e){const{e:s,f:r}=t.__localMatrix;t.x+=e.e-s,t.y+=e.f-r}function yn(t,e){return t.__layout.update(),t.parent?I.tempToInnerOf(e,t.parent.__world):e}const mn={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:t=>t.__.mask?t.__localBoxBounds:null,maskLocalStrokeBounds:t=>t.__.mask?t.__layout.localStrokeBounds:null,maskLocalRenderBounds:t=>t.__.mask?t.__layout.localRenderBounds:null,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))},{updateBounds:xn}=dn,wn={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:s}=t;for(let r=0,i=s.length;r<i;r++)(t=s[r]).isBranch&&(t.__tempNumber=1,e.add(t),bn(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&void 0===s[t.parent.innerId];)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let s=e.length;const{children:r}=t;for(let t=0,s=r.length;t<s;t++)r[t].isBranch&&e.push(r[t]);for(let t=s,r=e.length;t<r;t++)vn(e[t],e)},updateBounds(t,e){const s=[t];vn(t,s),Bn(s,e)},updateBoundsByBranchStack(t,e){let s,r;for(let i=t.length-1;i>-1;i--){s=t[i],r=s.children;for(let t=0,e=r.length;t<e;t++)xn(r[t]);e&&e===s||xn(s)}}},{pushAllChildBranch:bn,pushAllBranchStack:vn,updateBoundsByBranchStack:Bn}=wn,kn={run(t){if(t&&t.length){const e=t.length;for(let s=0;s<e;s++)t[s]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:Cn}=dn,{toOuterOf:On,getPoints:Tn,copy:Rn}=it,Pn="_localContentBounds",Sn="_worldContentBounds",Ln="_worldBoxBounds",In="_worldStrokeBounds";class Mn{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}get localContentBounds(){return On(this.contentBounds,this.leaf.__localMatrix,this[Pn]||(this[Pn]={})),this[Pn]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return On(this.contentBounds,this.leaf.__world,this[Sn]||(this[Sn]={})),this[Sn]}get worldBoxBounds(){return On(this.boxBounds,this.leaf.__world,this[Ln]||(this[Ln]={})),this[Ln]}get worldStrokeBounds(){return On(this.strokeBounds,this.leaf.__world,this[In]||(this[In]={})),this[In]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.boxBounds={x:0,y:0,width:0,height:0},this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),this.boxChange(),this.matrixChange()}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leafer:e}=this.leaf;if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=this.leaf;for(;e.parent&&!e.parent.leafer;)e=e.parent;t.layout(e)}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return b.defaultMatrix;case"page":t=e.zoomLayer;default:return Cn(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new ht(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",s){const{leaf:r}=this;let i,n,o=this.getInnerBounds(t);switch(e){case"world":i=r.getWorldPoint(o),n=r.__world;break;case"local":i=r.getLocalPointByInner(o),n=r.__localMatrix;break;case"inner":i=o,n=b.defaultMatrix;break;case"page":e=r.zoomLayer;default:i=r.getWorldPoint(o,e),n=Cn(r,e,!0)}const a=b.getLayout(n);if(Rn(a,o),I.copy(a,i),s){const{scaleX:t,scaleY:e}=a,s=Math.abs(t),r=Math.abs(e);1===s&&1===r||(a.scaleX/=s,a.scaleY/=r,a.width*=s,a.height*=r)}return a}getLayoutPoints(t,e="world"){const{leaf:s}=this,r=Tn(this.getInnerBounds(t));let i;switch(e){case"world":i=null;break;case"local":i=s.parent;break;case"inner":break;case"page":e=s.zoomLayer;default:i=e}return void 0!==i&&r.forEach((t=>s.innerToWorld(t,null,!1,i))),r}shrinkContent(){const{x:t,y:e,width:s,height:r}=this.boxBounds;this._contentBounds={x:t,y:e,width:s,height:r}}spreadStroke(){const{x:t,y:e,width:s,height:r}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:s,height:r},this._localStrokeBounds={x:t,y:e,width:s,height:r},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:r}=this.renderBounds;this._renderBounds={x:t,y:e,width:s,height:r},this._localRenderBounds={x:t,y:e,width:s,height:r}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged||this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=!0,this.leaf.forceUpdate("surface"))}destroy(){}}const An={},En={on(t,e,s){let r,i,n;s&&("boolean"==typeof s?r=s:(r=s.capture,i=s.once));const o=Wn(this,r,!0),a="string"==typeof t?t.split(" "):t,h=i?{listener:e,once:i}:{listener:e};a.forEach((t=>{t&&(n=o[t],n?-1===n.findIndex((t=>t.listener===e))&&n.push(h):o[t]=[h])}))},off(t,e,s){if(t){const r="string"==typeof t?t.split(" "):t;if(e){let t,i,n;s&&(t="boolean"==typeof s?s:s.capture);const o=Wn(this,t);r.forEach((t=>{t&&(i=o[t],i&&(n=i.findIndex((t=>t.listener===e)),n>-1&&i.splice(n,1),i.length||delete o[t]))}))}else{const{__bubbleMap:t,__captureMap:e}=this;r.forEach((s=>{t&&delete t[s],e&&delete e[s]}))}}else this.__bubbleMap=this.__captureMap=void 0},on_(t,e,s,r){return s&&(e=e.bind(s)),this.on(t,e,r),{type:t,current:this,listener:e,options:r}},off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>t.current.off(t.type,t.listener,t.options))),e.length=0},once(t,e,s){this.on(t,e,{once:!0,capture:s})},emit(t,e,s){!e&&Pt.has(t)&&(e=Pt.get(t,{type:t,target:this,current:this}));const r=Wn(this,s)[t];if(r){let i;for(let n=0,o=r.length;n<o&&(i=r[n],i.listener(e),i.once&&(this.off(t,i.listener,s),n--,o--),!e||!e.isStopNow);n++);}this.syncEventer&&this.syncEventer.emitEvent(e,s)},emitEvent(t,e){t.current=this,this.emit(t.type,t,e)},hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:s,__captureMap:r}=this,i=s&&s[t],n=r&&r[t];return!!(void 0===e?i||n:e?n:i)}};function Wn(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:An)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:An)}}class Nn{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&t.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&t.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&t.event.stop(this.origin)}}class Yn extends Nn{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}Yn.ADD="child.add",Yn.REMOVE="child.remove",Yn.DESTROY="child.destroy";class Xn extends Nn{constructor(t,e,s,r,i){super(t,e),this.attrName=s,this.oldValue=r,this.newValue=i}}Xn.CHANGE="property.change",Xn.LEAFER_CHANGE="property.leafer_change";class Dn extends Nn{constructor(t,e){super(t),Object.assign(this,e)}}Dn.LOAD="image.load",Dn.LOADED="image.loaded",Dn.ERROR="image.error";class zn extends Nn{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){"object"==typeof t?(super(zn.RESIZE),Object.assign(this,t)):super(t),this.old=e}}zn.RESIZE="resize";class Fn extends Nn{constructor(t,e){super(t),this.data=e}}Fn.REQUEST="watch.request",Fn.DATA="watch.data";class jn extends Nn{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}jn.CHECK_UPDATE="layout.check_update",jn.REQUEST="layout.request",jn.START="layout.start",jn.BEFORE="layout.before",jn.LAYOUT="layout",jn.AFTER="layout.after",jn.AGAIN="layout.again",jn.END="layout.end";class Un extends Nn{}Un.FRAME="animate.frame";class Gn extends Nn{constructor(t,e,s,r){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=r)}}Gn.REQUEST="render.request",Gn.START="render.start",Gn.BEFORE="render.before",Gn.RENDER="render",Gn.AFTER="render.after",Gn.AGAIN="render.again",Gn.END="render.end",Gn.NEXT="render.next";class Hn extends Nn{}Hn.START="leafer.start",Hn.BEFORE_READY="leafer.before_ready",Hn.READY="leafer.ready",Hn.AFTER_READY="leafer.after_ready",Hn.VIEW_READY="leafer.view_ready",Hn.VIEW_COMPLETED="leafer.view_completed",Hn.STOP="leafer.stop",Hn.RESTART="leafer.restart",Hn.END="leafer.end";const{isFinite:qn}=Number,Vn=xt.get("setAttr"),Qn={__setAttr(t,e,s){if(this.leafer&&this.leafer.created){const r=this.__.__getInput(t);if(s&&!qn(e)&&void 0!==e&&(Vn.warn(this.innerName,t,e),e=void 0),"object"==typeof e||r!==e){this.__[t]=e,this.__proxyData&&this.setProxyAttr(t,e);const{CHANGE:s}=Xn,i=new Xn(s,this,t,r,e);return this.isLeafer?this.emitEvent(new Xn(Xn.LEAFER_CHANGE,this,t,r,e)):this.hasEvent(s)&&this.emitEvent(i),this.leafer.emitEvent(i),!0}return!1}return this.__[t]=e,this.__proxyData&&this.setProxyAttr(t,e),!0},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Jn,multiplyParent:Zn,translateInner:$n,defaultWorld:Kn}=b,{toPoint:to,tempPoint:eo}=pt,so={__updateWorldMatrix(){Zn(this.__local||this.__layout,this.parent?this.parent.__world:Kn,this.__world,!!this.__layout.affectScaleOrRotation,this.__,this.parent&&this.parent.__)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged||t.rotationChanged)&&(Jn(e,s,null,t.affectRotation),t.scaleChanged=t.rotationChanged=!1),e.e=s.x+s.offsetX,e.f=s.y+s.offsetY,(s.around||s.origin)&&(to(s.around||s.origin,t.boxBounds,eo),$n(e,-eo.x,-eo.y,s.origin))}this.__layout.matrixChanged=!1}},{updateMatrix:ro,updateAllMatrix:io}=dn,{updateBounds:no}=wn,{toOuterOf:oo,copyAndSpread:ao,copy:ho}=it,{toBounds:lo}=qr,uo={__updateWorldBounds(){oo(this.__layout.renderBounds,this.__world,this.__world),this.__layout.resized&&(this.__onUpdateSize(),this.__layout.resized=!1)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized=!0),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=!1,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=!1,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=!1,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized=!0),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=!1,this.parent&&this.parent.__layout.renderChange()),t.boundsChanged=!1},__updateLocalBoxBounds(){this.__hasAutoLayout&&this.__updateAutoLayout(),oo(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){oo(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){oo(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?lo(e.__pathForRender,t):(t.x=0,t.y=0,t.width=e.width,t.height=e.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.leafer&&this.leafer.ready&&this.leafer.layouter.addExtra(this),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),io(this),no(this,this),this.__.__autoSide&&this.__updateBoxBounds()):(io(this),no(this,this))):ro(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;ao(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?ao(t.renderBounds,t.boxBounds,t.renderSpread):ho(t.renderBounds,t.strokeBounds)}},co={__render(t,e){if(this.__worldOpacity)if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=this.__.opacity,this.__.__single){if("path"===this.__.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e),this.__worldFlipped?t.copyWorldByReset(s,this.__nowWorld,null,this.__.__blendMode,!0):t.copyWorldToInner(s,this.__nowWorld,this.__layout.renderBounds,this.__.__blendMode),s.recycle(this.__nowWorld)}else this.__draw(t,e)},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),this.__.windingRule?t.clip(this.__.windingRule):t.clip())},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:_o}=mn,po={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__worldOpacity)if(this.__.__single){if("path"===this.__.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const r=this.__getNowWorld(e);t.opacity=this.__.opacity,t.copyWorldByReset(s,r,r,this.__.__blendMode,!0),s.recycle(r)}else this.__renderBranch(t,e)},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:s}=this;for(let r=0,i=s.length;r<i;r++)_o(s[r],e)||s[r].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:s}=this;for(let r=0,i=s.length;r<i;r++)_o(s[r],e)||s[r].__clip(t,e)}}},{LEAF:fo,create:go}=s,{toInnerPoint:yo,toOuterPoint:mo,multiplyParent:xo}=b,{toOuterOf:wo}=it,{copy:bo}=I,{moveLocal:vo,zoomOfLocal:Bo,rotateOfLocal:ko,skewOfLocal:Co,moveWorld:Oo,zoomOfWorld:To,rotateOfWorld:Ro,skewOfWorld:Po,transform:So,transformWorld:Lo,setTransform:Io,getLocalOrigin:Mo,getRelativeWorld:Ao,drop:Eo}=dn;let Wo=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return At}get __LayoutProcessor(){return Mn}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.__layout.update(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){const{leafer:t}=this;return t&&t.created&&t.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}constructor(t){this.innerId=go(fo),this.reset(t)}reset(t){this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0}),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.__leaferWait?this.__leaferWait.push(t):this.__leaferWait=[t]}nextRender(t,e,s){this.leafer?this.leafer.nextRender(t,e,s):this.waitLeafer((()=>this.leafer.nextRender(t,e,s)))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t&&(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.__leaferWait&&kn.run(this.__leaferWait)),this.isBranch){const{children:e}=this;for(let s=0,r=e.length;s<r;s++)e[s].__bindLeafer(t)}}set(t){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateLayout(){this.__layout.update()}forceUpdate(t){void 0===t?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=void 0===e?null:void 0,this[t]=e}forceRender(t){this.forceUpdate("surface")}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateContentBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some((t=>t.__.eraser))}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:s}=this.__layout;t.clearRect(s.x,s.y,s.width,s.height),t.restore()}__updateMask(t){this.__hasMask=!!t||this.children.some((t=>t.__.mask))}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld;return xo(this.__world,t.matrix,e,void 0,this.__world),wo(this.__layout.renderBounds,e,e),e}return this.__world}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,s){return this.__layout.getLayoutBounds(t,e,s)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,s){const r=e?Ao(this,e):this.worldTransform,i=s?t:{};return wo(t,r,i),i}worldToLocal(t,e,s,r){this.parent?this.parent.worldToInner(t,e,s,r):e&&bo(e,t)}localToWorld(t,e,s,r){this.parent?this.parent.innerToWorld(t,e,s,r):e&&bo(e,t)}worldToInner(t,e,s,r){r&&(r.innerToWorld(t,e,s),t=e||t),yo(this.worldTransform,t,e,s)}innerToWorld(t,e,s,r){mo(this.worldTransform,t,e,s),r&&r.worldToInner(e||t,null,s)}getInnerPoint(t,e,s,r){const i=r?t:{};return this.worldToInner(t,i,s,e),i}getInnerPointByLocal(t,e,s,r){return this.getInnerPoint(t,this.parent,s,r)}getLocalPoint(t,e,s,r){const i=r?t:{};return this.worldToLocal(t,i,s,e),i}getLocalPointByInner(t,e,s,r){return this.getWorldPoint(t,this.parent,s,r)}getWorldPoint(t,e,s,r){const i=r?t:{};return this.innerToWorld(t,i,s,e),i}getWorldPointByLocal(t,e,s,r){const i=r?t:{};return this.localToWorld(t,i,s,e),i}getPagePoint(t,e,s,r){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,s,r)}getWorldPointByPage(t,e,s,r){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,s,r)}setTransform(t,e){Io(this,t,e)}transform(t,e){So(this,t,e)}move(t,e){vo(this,t,e)}scaleOf(t,e,s,r){Bo(this,Mo(this,t),e,s,r)}rotateOf(t,e){ko(this,Mo(this,t),e)}skewOf(t,e,s,r){Co(this,Mo(this,t),e,s,r)}transformWorld(t,e){Lo(this,t,e)}moveWorld(t,e){Oo(this,t,e)}scaleOfWorld(t,e,s,r){To(this,t,e,s,r)}rotateOfWorld(t,e){Ro(this,t,e)}skewOfWorld(t,e,s,r){Po(this,t,e,s,r)}scaleResize(t,e=t,s){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e){}__clip(t,e){}__renderShape(t,e,s,r){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,s){Eo(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,r){}off_(t){}once(t,e,s){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,s){s?this.addAttr(t,e,s):Ui(this.prototype,t,e)}static addAttr(t,e,s){s||(s=Ci),s(e)(this.prototype,t)}destroy(){if(!this.destroyed){const{parent:t}=this;t&&this.remove(),this.children&&this.removeAll(!0),this.hasEvent(Yn.DESTROY)&&this.emitEvent(new Yn(Yn.DESTROY,this,t)),this.__.destroy(),this.__layout.destroy(),this.__captureMap=this.__bubbleMap=this.__parentWait=this.__leaferWait=null,this.destroyed=!0}}};Wo=Nt([Zi(Qn),Zi(so),Zi(uo),Zi(En),Zi(co)],Wo);const{setListWithFn:No}=it,{sort:Yo}=wn,{localBoxBounds:Xo,localStrokeBounds:Do,localRenderBounds:zo,maskLocalBoxBounds:Fo,maskLocalStrokeBounds:jo,maskLocalRenderBounds:Uo}=mn;let Go=class extends Wo{__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(){No(this.__layout.boxBounds,this.children,this.__hasMask?Fo:Xo)}__updateStrokeBounds(){No(this.__layout.strokeBounds,this.children,this.__hasMask?jo:Do)}__updateRenderBounds(){No(this.__layout.renderBounds,this.children,this.__hasMask?Uo:zo)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,r=e.length;s<r;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(Yo),this.__layout.affectChildrenSort=t}}add(t,e){t!==this&&(t.parent&&t.parent.remove(t),t.parent=this,void 0===e?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1),t.__layout.boxChanged||t.__layout.boxChange(),t.__layout.matrixChanged||t.__layout.matrixChange(),t.__parentWait&&kn.run(t.__parentWait),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Yn.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange())}addMany(...t){t.forEach((t=>this.add(t)))}remove(t,e){if(t){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}else void 0===t&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach((e=>{this.__realRemoveChild(e),t&&e.destroy()})))}clear(){this.removeAll(!0)}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Yn.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new Yn(t,e,this);e.hasEvent(t)&&e.emitEvent(s),this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}};Go=Nt([Zi(po)],Go);class Ho{get length(){return this.list.length}constructor(t){this.reset(),t&&(t instanceof Array?this.addList(t):this.add(t))}has(t){return t&&void 0!==this.keys[t.innerId]}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return void 0===e?-1:e}add(t){const{list:e,keys:s}=this;void 0===s[t.innerId]&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(void 0===s[t.innerId]){const{list:r}=this;for(let t=e,i=r.length;t<i;t++)s[r[t].innerId]++;0===e?r.unshift(t):(e>r.length&&(e=r.length),r.splice(e,0,t)),s[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let s;for(let r=0,i=e.length;r<i;r++)void 0!==s?this.keys[e[r].innerId]=r-1:e[r].innerId===t.innerId&&(s=r,delete this.keys[t.innerId]);void 0!==s&&e.splice(s,1)}sort(t){const{list:e}=this;t?e.sort(((t,e)=>e.__level-t.__level)):e.sort(((t,e)=>t.__level-e.__level))}forEach(t){this.list.forEach(t)}clone(){const t=new Ho;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let s=0,r=t.length;s<r;s++)e[t[s].innerId]=s}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class qo{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(t instanceof Array?this.addList(t):this.add(t))}has(t){return void 0!==this.keys[t.innerId]}without(t){return void 0===this.keys[t.innerId]}sort(t){const{levels:e}=this;t?e.sort(((t,e)=>e-t)):e.sort(((t,e)=>t-e))}addList(t){t.forEach((t=>{this.add(t)}))}add(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach((s=>{e=this.levelMap[s];for(let s=0,r=e.length;s<r;s++)t(e[s])}))}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const Vo="1.0.0-rc.30",Qo={};export{yt as AlignHelper,Un as AnimateEvent,Et as Answer,pt as AroundHelper,dt as AutoBounds,be as BezierHelper,ht as Bounds,it as BoundsHelper,Go as Branch,wn as BranchHelper,po as BranchRender,Lt as CanvasManager,Yn as ChildEvent,e as Creator,It as DataHelper,xt as Debug,ut as Direction4,ct as Direction9,Se as EllipseHelper,Nn as Event,Pt as EventCreator,ni as FileHelper,Dn as ImageEvent,di as ImageManager,s as IncrementId,jn as LayoutEvent,Wo as Leaf,uo as LeafBounds,mn as LeafBoundsHelper,At as LeafData,Qn as LeafDataProxy,En as LeafEventer,dn as LeafHelper,Mn as LeafLayout,qo as LeafLevelList,Ho as LeafList,so as LeafMatrix,co as LeafRender,qt as LeaferCanvasBase,Hn as LeaferEvent,pi as LeaferImage,a as MathHelper,X as Matrix,b as MatrixHelper,$t as NeedConvertToCanvasCommandMap,h as OneRadian,l as PI2,d as PI_2,qr as PathBounds,Ns as PathCommandDataHelper,Jt as PathCommandMap,ps as PathConvert,ei as PathCorner,tr as PathCreator,fr as PathDrawer,Vt as PathHelper,se as PathNumberCommandLengthMap,ee as PathNumberCommandMap,t as Platform,N as Point,I as PointHelper,Xn as PropertyEvent,re as RectHelper,Gn as RenderEvent,zn as ResizeEvent,Bt as Run,mt as StringNumberMap,hi as TaskItem,li as TaskProcessor,z as TwoPointBoundsHelper,Ot as UICreator,kn as WaitHelper,Fn as WatchEvent,Mi as affectRenderBoundsType,Si as affectStrokeBoundsType,mi as attr,vi as autoLayoutType,Ci as boundsType,ii as canvasPatch,Ht as canvasSizeAttrs,zi as cursorType,Fi as dataProcessor,wi as dataType,yi as decorateLeafAttr,Ui as defineDataProcessor,fi as defineKey,xi as defineLeafAttr,Ti as doBoundsType,Li as doStrokeType,Wt as emptyData,Xi as eraserType,c as getBoundsData,gi as getDescriptor,_ as getMatrixData,u as getPointData,Di as hitType,Qo as inviteCode,ji as layoutProcessor,Yi as maskType,Oi as naturalBoundsType,Ei as opacityType,Ri as pathInputType,Pi as pathType,si as pen,bi as positionType,$i as registerUI,Ki as registerUIEvent,Vi as rewrite,Qi as rewriteAble,ki as rotationType,Bi as scaleType,Ni as sortType,Ii as strokeType,Ai as surfaceType,lt as tempBounds,D as tempMatrix,Y as tempPoint,Zi as useModule,Vo as version,Wi as visibleType};
|
package/lib/core.min.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";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:o,PI:n}=Math,a={within:(t,e,s)=>(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=e?o(10,e):1e12;return-0===(t=i(t*s)/s)?0:t}},h=n/180,l=2*n,d=n/2;function u(){return{x:0,y:0}}function c(){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:_,cos:f,acos:g,sqrt:y}=Math,{float:x}=a,m={};function w(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const b={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:w(),tempMatrix:{},set(t,e=1,s=0,r=0,i=1,o=0,n=0){t.a=e,t.b=s,t.c=r,t.d=i,t.e=o,t.f=n},get:p,getWorld:w,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s,r){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s,r&&(t.e-=e,t.f-=s)},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},scaleOfOuter(t,e,s,r){v.toInnerPoint(t,e,m),v.scaleOfInner(t,m,s,r)},scaleOfInner(t,e,s,r=s){v.translateInner(t,e.x,e.y),v.scale(t,s,r),v.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:r,c:i,d:o}=t,n=f(e*=h),a=_(e);t.a=s*n-r*a,t.b=s*a+r*n,t.c=i*n-o*a,t.d=i*a+o*n},rotateOfOuter(t,e,s){v.toInnerPoint(t,e,m),v.rotateOfInner(t,m,s)},rotateOfInner(t,e,s){v.translateInner(t,e.x,e.y),v.rotate(t,s),v.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:r,b:i,c:o,d:n}=t;s&&(s*=h,t.a=r+o*s,t.b=i+n*s),e&&(e*=h,t.c=o+r*e,t.d=n+i*e)},skewOfOuter(t,e,s,r){v.toInnerPoint(t,e,m),v.skewOfInner(t,m,s,r)},skewOfInner(t,e,s,r=0){v.translateInner(t,e.x,e.y),v.skew(t,s,r),v.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:r,c:i,d:o,e:n,f:a}=t;t.a=e.a*s+e.b*i,t.b=e.a*r+e.b*o,t.c=e.c*s+e.d*i,t.d=e.c*r+e.d*o,t.e=e.e*s+e.f*i+n,t.f=e.e*r+e.f*o+a},multiplyParent(t,e,s,r,i,o){let{e:n,f:a}=t;if(o&&(n+=o.scrollX,a+=o.scrollY),s||(s=t),void 0===r&&(r=1!==t.a||t.b||t.c||1!==t.d),r){const{a:r,b:o,c:n,d:a}=t;s.a=r*e.a+o*e.c,s.b=r*e.b+o*e.d,s.c=n*e.a+a*e.c,s.d=n*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=n*e.a+a*e.c+e.e,s.f=n*e.b+a*e.d+e.f},divide(t,e){v.multiply(t,v.tempInvert(e))},divideParent(t,e){v.multiplyParent(t,v.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=v;return v.copy(e,t),v.invert(e),e},invert(t){const{a:e,b:s,c:r,d:i,e:o,f:n}=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=-(o*i-n*r)*a,t.f=-(n*e-o*s)*a}else if(1===e&&1===i)t.e=-o,t.f=-n;else{const s=1/(e*i);t.a=i*s,t.d=e*s,t.e=-o*i*s,t.f=-n*e*s}},toOuterPoint(t,e,s,r){const{x:i,y:o}=e;s||(s=e),s.x=i*t.a+o*t.c,s.y=i*t.b+o*t.d,r||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,r){const{a:i,b:o,c:n,d:a}=t,h=1/(i*a-o*n),{x:l,y:d}=e;if(s||(s=e),s.x=(l*a-d*n)*h,s.y=(d*i-l*o)*h,!r){const{e:e,f:r}=t;s.x-=(e*a-r*n)*h,s.y-=(r*i-e*o)*h}},setLayout(t,e,s,r){const{x:i,y:o,scaleX:n,scaleY:a}=e;if(void 0===r&&(r=e.rotation||e.skewX||e.skewY),r){const{rotation:s,skewX:r,skewY:i}=e,o=s*h,l=f(o),d=_(o);if(r||i){const e=r*h,s=i*h;t.a=(l+s*-d)*n,t.b=(d+s*l)*n,t.c=(e*l-d)*a,t.d=(l+e*d)*a}else t.a=l*n,t.b=d*n,t.c=-d*a,t.d=l*a}else t.a=n,t.b=0,t.c=0,t.d=a;t.e=i,t.f=o,s&&v.translateInner(t,-s.x,-s.y,!0)},getLayout(t,e,s){const{a:r,b:i,c:o,d:n,e:a,f:l}=t;let u,c,p,m,w,b=a,v=l;if(i||o){const t=r*n-i*o;if(o&&!s){u=y(r*r+i*i),c=t/u;const e=r/u;p=i>0?g(e):-g(e)}else{c=y(o*o+n*n),u=t/c;const e=o/c;p=d-(n>0?g(-e):-g(e))}const e=x(f(p)),a=_(p);u=x(u),c=x(c),m=e?x((o/c+a)/e/h,9):0,w=e?x((i/u-a)/e/h,9):0,p=x(p/h)}else u=r,c=n,p=m=w=0;return e&&(b+=e.x*r+e.y*o,v+=e.x*i+e.y*n),{x:b,y:v,scaleX:u,scaleY:c,rotation:p,skewX:m,skewY:w}},withScale(t,e,s=e){const r=t;if(!e||!s){const{a:r,b:i,c:o,d:n}=t;i||o?s=(r*n-i*o)/(e=y(r*r+i*i)):(e=r,s=n)}return r.scaleX=e,r.scaleY=s,r},reset(t){v.set(t)}},v=b,{toInnerPoint:B,toOuterPoint:C}=b,{sin:k,cos:T,abs:O,sqrt:P,atan2:R,min:L,PI:S}=Math,I={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},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=M.defaultPoint);const r=T(e*=h),i=k(e),o=t.x-s.x,n=t.y-s.y;t.x=s.x+o*r-n*i,t.y=s.y+o*i+n*r},tempToInnerOf(t,e){const{tempPoint:s}=M;return E(s,t),B(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=M;return E(s,t),C(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=M;return E(s,t),M.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),B(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){B(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)=>A(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,r){const i=O(s-t),o=O(r-e);return P(i*i+o*o)},getMinDistanceFrom:(t,e,s,r,i,o)=>L(A(t,e,s,r),A(s,r,i,o)),getAngle:(t,e)=>W(t,e)/h,getRotation:(t,e,s,r)=>(r||(r=e),M.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,r.x,r.y)/h),getRadianFrom(t,e,s,r,i,o,n,a){void 0===n&&(n=s,a=r);let h=R(e-r,t-s);const d=R(o-a,i-n)-h;return d<-S?d+l:d},getAtan2:(t,e)=>R(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,r){const i=W(t,e);return(e=r?e:{}).x=t.x+T(i)*s,e.y=t.y+k(i)*s,e},reset(t){M.reset(t)}},M=I,{getDistanceFrom:A,copy:E,getAtan2:W}=M;class D{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?I.copy(this,t):I.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 I.move(this,t,e),this}scale(t,e){return I.scale(this,t,e),this}scaleOf(t,e,s){return I.scaleOf(this,t,e,s),this}rotate(t,e){return I.rotate(this,t,e),this}rotateOf(t,e){return I.rotate(this,e,t),this}getRotation(t,e,s){return I.getRotation(this,t,e,s)}toInnerOf(t,e){return I.toInnerOf(this,t,e),this}toOuterOf(t,e){return I.toOuterOf(this,t,e),this}getCenter(t){return new D(I.getCenter(this,t))}getDistance(t){return I.getDistance(this,t)}getDistancePoint(t,e,s){return new D(I.getDistancePoint(this,t,e,s))}getAngle(t){return I.getAngle(this,t)}getAtan2(t){return I.getAtan2(this,t)}reset(){return I.reset(this),this}}const N=new D;class Y{constructor(t,e,s,r,i,o){this.set(t,e,s,r,i,o)}set(t,e,s,r,i,o){return"object"==typeof t?b.copy(this,t):b.set(this,t,e,s,r,i,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:s,d:r,e:i,f:o}=this;return{a:t,b:e,c:s,d:r,e:i,f:o}}clone(){return new Y(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,s){return b.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return b.scaleOfInner(this,t,e,s),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,s){return b.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return b.skewOfInner(this,t,e,s),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,s){b.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){b.toInnerPoint(this,t,e,s)}setLayout(t,e){return b.setLayout(this,t,e),this}getLayout(t,e){return b.getLayout(this,t,e)}withScale(t,e){return b.withScale(this,t,e)}reset(){b.reset(this)}}const X=new Y,z={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){F(t,e,s),F(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:F}=z,{tempPointBounds:j,setPoint:H,addPoint:U,toBounds:G}=z,{toOuterPoint:q}=b,{float:V,fourNumber:Q}=a,{floor:J,ceil:Z}=Math;let $,K,tt,et;const st={},rt={},it={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){if(s instanceof Array){const i=Q(s);r?ot.set(t,e.x+i[3],e.y+i[0],e.width-i[1]-i[3],e.height-i[2]-i[0]):ot.set(t,e.x-i[3],e.y-i[0],e.width+i[1]+i[3],e.height+i[2]+i[0])}else r&&(s=-s),ot.set(t,e.x-s,e.y-s,e.width+2*s,e.height+2*s)},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),ot.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?at(e,t):e=t,s?(e.offsetX=-(ot.maxX(s)-t.x),e.offsetY=-(ot.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),ot.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e){I.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,r=s){I.scaleOf(t,e,s,r),t.width*=s,t.height*=r},tempToOuterOf:(t,e)=>(ot.copy(ot.tempBounds,t),ot.toOuterOf(ot.tempBounds,e),ot.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),ot.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 st.x=t.x,st.y=t.y,q(e,st,rt),H(j,rt.x,rt.y),st.x=t.x+t.width,q(e,st,rt),U(j,rt.x,rt.y),st.y=t.y+t.height,q(e,st,rt),U(j,rt.x,rt.y),st.x=t.x,q(e,st,rt),U(j,rt.x,rt.y),G(j,s)},toInnerOf(t,e,s){s||(s=t),ot.move(s,-e.e,-e.f),ot.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 Y(r,0,0,r,-e.x*r,-e.y*r)},getSpread(t,e){const s={};return ot.copyAndSpread(s,t,e),s},spread(t,e){ot.copyAndSpread(t,t,e)},shrink(t,e){ot.copyAndSpread(t,t,e,!0)},ceil(t){const{x:e,y:s}=t;t.x=J(t.x),t.y=J(t.y),t.width=e>t.x?Z(t.width+e-t.x):Z(t.width),t.height=s>t.y?Z(t.height+s-t.y):Z(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=V(t.x,e),t.y=V(t.y,e),t.width=V(t.width,e),t.height=V(t.height,e)},add(t,e,s){$=t.x+t.width,K=t.y+t.height,tt=e.x,et=e.y,s||(tt+=e.width,et+=e.height),$=$>tt?$:tt,K=K>et?K:et,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=$-t.x,t.height=K-t.y},addList(t,e){ot.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){ot.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){ot.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,r=!1){let i,o=!0;for(let n=0,a=e.length;n<a;n++)i=s?s(e[n]):e[n],i&&(i.width||i.height)&&(o?(o=!1,r||at(t,i)):nt(t,i));o&&ot.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?H(j,t.x,t.y):U(j,t.x,t.y))),G(j,t)},setPoint(t,e){ot.set(t,e.x,e.y)},addPoint(t,e){nt(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=I.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=I.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=ot.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=ot.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=ot.tempToOuterOf(e,s)),!ot.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:r,y:i,width:o,height:n}=e;return $=r+o,K=i+n,tt=t.x+t.width,et=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,$=$<tt?$:tt,K=K<et?K:et,o=$-r,n=K-i,{x:r,y:i,width:o,height:n}},intersect(t,e,s){ot.copy(t,ot.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){ot.set(t)}},ot=it,{add:nt,copy:at}=ot;class ht{get minX(){return it.minX(this)}get minY(){return it.minY(this)}get maxX(){return it.maxX(this)}get maxY(){return it.maxY(this)}constructor(t,e,s,r){this.set(t,e,s,r)}set(t,e,s,r){return"object"==typeof t?it.copy(this,t):it.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 ht(this)}move(t,e){return it.move(this,t,e),this}scale(t,e){return it.scale(this,t,e),this}scaleOf(t,e,s){return it.scaleOf(this,t,e,s),this}toOuterOf(t,e){return it.toOuterOf(this,t,e),this}toInnerOf(t,e){return it.toInnerOf(this,t,e),this}getFitMatrix(t,e){return it.getFitMatrix(this,t,e)}spread(t){return it.spread(this,t),this}shrink(t){return it.shrink(this,t),this}ceil(){return it.ceil(this),this}unsign(){return it.unsign(this),this}float(t){return it.float(this,t),this}add(t){return it.add(this,t),this}addList(t){return it.setList(this,t,!0),this}setList(t){return it.setList(this,t),this}addListWithFn(t,e){return it.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return it.setListWithFn(this,t,e),this}setPoint(t){return it.setPoint(this,t),this}setPoints(t){return it.setPoints(this,t),this}addPoint(t){return it.addPoint(this,t),this}getPoints(){return it.getPoints(this)}hitPoint(t,e){return it.hitPoint(this,t,e)}hitRadiusPoint(t,e){return it.hitRadiusPoint(this,t,e)}hit(t,e){return it.hit(this,t,e)}includes(t,e){return it.includes(this,t,e)}intersect(t,e){return it.intersect(this,t,e),this}getIntersect(t,e){return new ht(it.getIntersectData(this,t,e))}isSame(t){return it.isSame(this,t)}isEmpty(){return it.isEmpty(this)}reset(){it.reset(this)}}const lt=new ht;var dt,ut;exports.Direction4=void 0,(dt=exports.Direction4||(exports.Direction4={}))[dt.top=0]="top",dt[dt.right=1]="right",dt[dt.bottom=2]="bottom",dt[dt.left=3]="left",exports.Direction9=void 0,(ut=exports.Direction9||(exports.Direction9={}))[ut.topLeft=0]="topLeft",ut[ut.top=1]="top",ut[ut.topRight=2]="topRight",ut[ut.right=3]="right",ut[ut.bottomRight=4]="bottomRight",ut[ut.bottom=5]="bottom",ut[ut.bottomLeft=6]="bottomLeft",ut[ut.left=7]="left",ut[ut.center=8]="center",ut[ut["top-left"]=0]="top-left",ut[ut["top-right"]=2]="top-right",ut[ut["bottom-right"]=4]="bottom-right",ut[ut["bottom-left"]=6]="bottom-left";const ct=[{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}];ct.forEach((t=>t.type="percent"));const pt={directionData:ct,tempPoint:{},get:_t,toPoint(t,e,s,r,i){s||(s={});const o=_t(t);s.x=o.x,s.y=o.y,"percent"===o.type&&(s.x*=e.width,s.y*=e.height,i&&(s.x-=i.x,s.y-=i.y,o.x&&(s.x-=1===o.x?i.width:.5===o.x?o.x*i.width:0),o.y&&(s.y-=1===o.y?i.height:.5===o.y?o.y*i.height:0))),r||(s.x+=e.x,s.y+=e.y)}};function _t(t){return"string"==typeof t?ct[exports.Direction9[t]]:t}const{toPoint:ft}=pt,gt={toPoint(t,e,s,r,i){ft(t,s,r,i,e)}},yt={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};class xt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new xt(t)}static set filter(t){this.filterList=mt(t)}static set exclude(t){this.excludeList=mt(t)}log(...t){if(wt.enable){if(wt.filterList.length&&wt.filterList.every((t=>t!==this.name)))return;if(wt.excludeList.length&&wt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){wt.enable&&this.warn(...t)}warn(...t){wt.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 mt(t){return t?"string"==typeof t&&(t=[t]):t=[],t}xt.filterList=[],xt.excludeList=[],xt.showWarn=!0;const wt=xt,bt=xt.get("RunTime"),vt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const r=s.create(s.RUNTIME);return Bt.currentId=Bt.idMap[r]=e?performance.now():Date.now(),Bt.currentName=Bt.nameMap[r]=t,Bt.nameToIdMap[t]=r,r},end(t,e){const s=Bt.idMap[t],r=Bt.nameMap[t],i=e?(performance.now()-s)/1e3:Date.now()-s;Bt.idMap[t]=Bt.nameMap[t]=Bt.nameToIdMap[r]=void 0,bt.log(r,i,"ms")},endOfName(t,e){const s=Bt.nameToIdMap[t];void 0!==s&&Bt.end(s,e)}},Bt=vt,Ct=xt.get("UICreator"),kt={list:{},register(t){const{__tag:e}=t.prototype;Tt[e]?Ct.repeat(e):Tt[e]=t},get(t,e,s,r,i,o){const n=new Tt[t](e);return void 0!==s&&(n.x=s,r&&(n.y=r),i&&(n.width=i),o&&(n.height=o)),n}},{list:Tt}=kt,Ot=xt.get("EventCreator"),Pt={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(Rt[e]?Ot.repeat(e):Rt[e]=t)}))},changeName(t,e){const s=Rt[t];if(s){const r=Object.keys(s).find((e=>s[e]===t));r&&(s[r]=e,Rt[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Rt[t](...e)},{nameList:Rt}=Pt;const Lt={default:(t,e)=>(St(e,t),St(t,e),t),assign(t,e){let s;Object.keys(e).forEach((r=>{var i;s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(i=t[r])||void 0===i?void 0:i.constructor)===Object?St(t[r],e[r]):t[r]=e[r]}))},copyAttrs:(t,e,s)=>(s.forEach((s=>{void 0!==e[s]&&(t[s]=e[s])})),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let s=0,r=t.length;s<r;s++)e[t[s]]=!0;return e}},{assign:St}=Lt;class It{get __useNaturalRatio(){return!0}get __isLinePath(){return this.path&&6===this.path.length}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:o,f:n}=this.__leaf.__localMatrix;s.matrix={a:t,b:e,c:r,d:i,e:o,f:n}}return s}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&e.isBranch||e.__hasEraser||t.eraser?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 Mt;exports.Answer=void 0,(Mt=exports.Answer||(exports.Answer={}))[Mt.No=0]="No",Mt[Mt.Yes=1]="Yes",Mt[Mt.NoAndSkip=2]="NoAndSkip",Mt[Mt.YesAndSkip=3]="YesAndSkip";function At(t,e,s,r){var i,o=arguments.length,n=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(n=(o<3?i(n):o>3?i(e,s,n):i(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n}function Et(t,e,s,r){return new(s||(s=Promise))((function(i,o){function n(t){try{h(r.next(t))}catch(t){o(t)}}function a(t){try{h(r.throw(t))}catch(t){o(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(n,a)}h((r=r.apply(t,e||[])).next())}))}function Wt(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 Dt=[];function Nt(){return(t,e)=>{Dt.push(e)}}const Yt=[];class Xt{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||Yt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;Dt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,s,r,i,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,r,i,o){"object"==typeof t?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,r,i,o)}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,o,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/r*a;r+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/i*h;i+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,r,i,o,n,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,o){}quadraticCurveTo(t,e,s,r){}closePath(){}arc(t,e,s,r,i,o){}arcTo(t,e,s,r,i){}ellipse(t,e,s,r,i,o,n,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,o){}fillText(t,e,s,r){}measureText(t){}strokeText(t,e,s,r){}destroy(){this.context=null}}At([Wt("imageSmoothingEnabled")],Xt.prototype,"smooth",void 0),At([Wt("imageSmoothingQuality")],Xt.prototype,"smoothLevel",void 0),At([Wt("globalAlpha")],Xt.prototype,"opacity",void 0),At([Wt()],Xt.prototype,"fillStyle",void 0),At([Wt()],Xt.prototype,"strokeStyle",void 0),At([Wt("lineWidth")],Xt.prototype,"strokeWidth",void 0),At([Wt("lineCap")],Xt.prototype,"strokeCap",void 0),At([Wt("lineJoin")],Xt.prototype,"strokeJoin",void 0),At([Wt("lineDashOffset")],Xt.prototype,"dashOffset",void 0),At([Wt()],Xt.prototype,"miterLimit",void 0),At([Wt()],Xt.prototype,"shadowBlur",void 0),At([Wt()],Xt.prototype,"shadowColor",void 0),At([Wt()],Xt.prototype,"shadowOffsetX",void 0),At([Wt()],Xt.prototype,"shadowOffsetY",void 0),At([Wt()],Xt.prototype,"filter",void 0),At([Wt()],Xt.prototype,"font",void 0),At([Wt()],Xt.prototype,"fontKerning",void 0),At([Wt()],Xt.prototype,"fontStretch",void 0),At([Wt()],Xt.prototype,"fontVariantCaps",void 0),At([Wt()],Xt.prototype,"textAlign",void 0),At([Wt()],Xt.prototype,"textBaseline",void 0),At([Wt()],Xt.prototype,"textRendering",void 0),At([Wt()],Xt.prototype,"wordSpacing",void 0),At([Wt()],Xt.prototype,"letterSpacing",void 0),At([Wt()],Xt.prototype,"direction",void 0),At([Nt()],Xt.prototype,"setTransform",null),At([Nt()],Xt.prototype,"resetTransform",null),At([Nt()],Xt.prototype,"getTransform",null),At([Nt()],Xt.prototype,"save",null),At([Nt()],Xt.prototype,"restore",null),At([Nt()],Xt.prototype,"translate",null),At([Nt()],Xt.prototype,"scale",null),At([Nt()],Xt.prototype,"rotate",null),At([Nt()],Xt.prototype,"fill",null),At([Nt()],Xt.prototype,"stroke",null),At([Nt()],Xt.prototype,"clip",null),At([Nt()],Xt.prototype,"fillRect",null),At([Nt()],Xt.prototype,"strokeRect",null),At([Nt()],Xt.prototype,"clearRect",null),At([Nt()],Xt.prototype,"beginPath",null),At([Nt()],Xt.prototype,"moveTo",null),At([Nt()],Xt.prototype,"lineTo",null),At([Nt()],Xt.prototype,"bezierCurveTo",null),At([Nt()],Xt.prototype,"quadraticCurveTo",null),At([Nt()],Xt.prototype,"closePath",null),At([Nt()],Xt.prototype,"arc",null),At([Nt()],Xt.prototype,"arcTo",null),At([Nt()],Xt.prototype,"ellipse",null),At([Nt()],Xt.prototype,"rect",null),At([Nt()],Xt.prototype,"roundRect",null),At([Nt()],Xt.prototype,"createConicGradient",null),At([Nt()],Xt.prototype,"createLinearGradient",null),At([Nt()],Xt.prototype,"createPattern",null),At([Nt()],Xt.prototype,"createRadialGradient",null),At([Nt()],Xt.prototype,"fillText",null),At([Nt()],Xt.prototype,"measureText",null),At([Nt()],Xt.prototype,"strokeText",null);const{copy:zt}=b,Ft={width:1,height:1,pixelRatio:1},jt=["width","height","pixelRatio"];const Ht={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Ut={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Gt=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},Ut),qt={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},Vt={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},Qt=Object.assign(Object.assign({},Vt),Ut),Jt=Gt,Zt={};for(let t in Jt)Zt[Jt[t]]=t;const $t={};for(let t in Jt)$t[Jt[t]]=qt[t];const Kt={drawRoundRect(t,e,s,r,i,o){const n=a.fourNumber(o,Math.min(r/2,i/2)),h=e+r,l=s+i;n[0]?t.moveTo(e+n[0],s):t.moveTo(e,s),n[1]?t.arcTo(h,s,h,l,n[1]):t.lineTo(h,s),n[2]?t.arcTo(h,l,e,l,n[2]):t.lineTo(h,l),n[3]?t.arcTo(e,l,e,s,n[3]):t.lineTo(e,l),n[0]?t.arcTo(e,s,h,s,n[0]):t.lineTo(e,s)}},{sin:te,cos:ee,atan2:se,ceil:re,abs:ie,PI:oe,sqrt:ne,pow:ae}=Math,{setPoint:he,addPoint:le}=z,{set:de}=I,{M:ue,L:ce,C:pe,Q:_e,Z:fe}=Gt,ge={},ye={points(t,e,s,r){if(t.push(ue,e[0],e[1]),s&&e.length>5){let i,o,n,a,h,l,d,u,c,p,_,f,g,y=e.length;const x=!0===s?.5:s;r&&(y=(e=[e[y-2],e[y-1],...e,e[0],e[1],e[2],e[3]]).length);for(let s=2;s<y-2;s+=2)i=e[s-2],o=e[s-1],n=e[s],a=e[s+1],h=e[s+2],l=e[s+3],_=ne(ae(n-i,2)+ae(a-o,2)),f=ne(ae(h-n,2)+ae(l-a,2)),g=_+f,_=x*_/g,f=x*f/g,h-=i,l-=o,d=n-_*h,u=a-_*l,2===s?r||t.push(_e,d,u,n,a):t.push(pe,c,p,d,u,n,a),c=n+f*h,p=a+f*l;r||t.push(_e,c,p,e[y-2],e[y-1])}else for(let s=2,r=e.length;s<r;s+=2)t.push(ce,e[s],e[s+1]);r&&t.push(fe)},rect(t,e,s,r,i){Ht.creator.path=t,Ht.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,o){Ht.creator.path=[],Kt.drawRoundRect(Ht.creator,e,s,r,i,o),t.push(...Ht.convertToCanvasData(Ht.creator.path,!0))},arcTo(t,e,s,r,i,o,n,a,u,c,p){const _=r-e,f=i-s,g=o-r,y=n-i;let x=se(f,_),m=se(y,g),w=m-x;if(w<0&&(w+=l),w===oe||ie(_+f)<1e-12||ie(g+y)<1e-12)return t&&t.push(ce,r,i),u&&(he(u,e,s),le(u,r,i)),p&&de(p,e,s),void(c&&de(c,r,i));const b=_*y-g*f<0,v=b?-1:1,B=a/ee(w/2),C=r+B*ee(x+w/2+d*v),k=i+B*te(x+w/2+d*v);return x-=d*v,m-=d*v,we(t,C,k,a,a,0,x/h,m/h,b,u,c,p)},arc:(t,e,s,r,i,o,n,a,h,l)=>we(t,e,s,r,r,0,i,o,n,a,h,l),ellipse(t,e,s,r,i,o,n,a,u,c,p,_){const f=o*h,g=te(f),y=ee(f);let x=n*h,m=a*h;x>oe&&(x-=l),m<0&&(m+=l);let w=m-x;w<0?w+=l:w>l&&(w-=l),u&&(w-=l);const b=re(ie(w/d)),v=w/b,B=te(v/4),C=8/3*B*B/te(v/2);m=x+v;let k,T,O,P,R,L,S,I,M=ee(x),A=te(x),E=O=y*r*M-g*i*A,W=P=g*r*M+y*i*A,D=e+O,N=s+P;t&&t.push(ce,D,N),c&&he(c,D,N),_&&de(_,D,N);for(let o=0;o<b;o++)k=ee(m),T=te(m),O=y*r*k-g*i*T,P=g*r*k+y*i*T,R=e+E-C*(y*r*A+g*i*M),L=s+W-C*(g*r*A-y*i*M),S=e+O+C*(y*r*T+g*i*k),I=s+P+C*(g*r*T-y*i*k),t&&t.push(pe,R,L,S,I,e+O,s+P),c&&me(e+E,s+W,R,L,S,I,e+O,s+P,c,!0),E=O,W=P,M=k,A=T,x=m,m+=v;p&&de(p,e+O,s+P)},quadraticCurveTo(t,e,s,r,i,o,n){t.push(pe,(e+2*r)/3,(s+2*i)/3,(o+2*r)/3,(n+2*i)/3,o,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,r,i,o,n,a){me(t,e,(t+2*s)/3,(e+2*r)/3,(i+2*s)/3,(o+2*r)/3,i,o,n,a)},toTwoPointBounds(t,e,s,r,i,o,n,a,h,l){const d=[];let u,c,p,_,f,g,y,x,m=t,w=s,b=i,v=n;for(let t=0;t<2;++t)if(1==t&&(m=e,w=r,b=o,v=a),u=-3*m+9*w-9*b+3*v,c=6*m-12*w+6*b,p=3*w-3*m,Math.abs(u)<1e-12){if(Math.abs(c)<1e-12)continue;_=-p/c,0<_&&_<1&&d.push(_)}else y=c*c-4*p*u,x=Math.sqrt(y),y<0||(f=(-c+x)/(2*u),0<f&&f<1&&d.push(f),g=(-c-x)/(2*u),0<g&&g<1&&d.push(g));l?le(h,t,e):he(h,t,e),le(h,n,a);for(let l=0,u=d.length;l<u;l++)xe(d[l],t,e,s,r,i,o,n,a,ge),le(h,ge.x,ge.y)},getPointAndSet(t,e,s,r,i,o,n,a,h,l){const d=1-t,u=d*d*d,c=3*d*d*t,p=3*d*t*t,_=t*t*t;l.x=u*e+c*r+p*o+_*a,l.y=u*s+c*i+p*n+_*h},getPoint(t,e,s,r,i,o,n,a,h){const l={};return xe(t,e,s,r,i,o,n,a,h,l),l}},{getPointAndSet:xe,toTwoPointBounds:me,ellipse:we}=ye,{sin:be,cos:ve,sqrt:Be,atan2:Ce}=Math,{ellipse:ke}=ye,Te={ellipticalArc(e,s,r,i,o,n,a,d,u,c,p){const _=(u-s)/2,f=(c-r)/2,g=n*h,y=be(g),x=ve(g),m=-x*_-y*f,w=-x*f+y*_,b=i*i,v=o*o,B=w*w,C=m*m,k=b*v-b*B-v*C;let T=0;if(k<0){const t=Be(1-k/(b*v));i*=t,o*=t}else T=(a===d?-1:1)*Be(k/(b*B+v*C));const O=T*i*w/o,P=-T*o*m/i,R=Ce((w-P)/o,(m-O)/i),L=Ce((-w-P)/o,(-m-O)/i);let S=L-R;0===d&&S>0?S-=l:1===d&&S<0&&(S+=l);const I=s+_+x*O-y*P,M=r+f+y*O+x*P,A=S<0?1:0;p||t.ellipseToCurve?ke(e,I,M,i,o,n,R/h,L/h,A):i!==o||n?e.push(Gt.G,I,M,i,o,n,R/h,L/h,A):e.push(Gt.O,I,M,i,R/h,L/h,A)}},{M:Oe,m:Pe,L:Re,l:Le,H:Se,h:Ie,V:Me,v:Ae,C:Ee,c:We,S:De,s:Ne,Q:Ye,q:Xe,T:ze,t:Fe,A:je,a:He,Z:Ue,z:Ge,N:qe,D:Ve,X:Qe,G:Je,F:Ze,O:$e,P:Ke,U:ts}=Gt,{rect:es,roundRect:ss,arcTo:rs,arc:is,ellipse:os,quadraticCurveTo:ns}=ye,{ellipticalArc:as}=Te,hs=xt.get("PathConvert"),ls={},ds={current:{dot:0},stringify(t,e){let s,r,i,o=0,n=t.length,h="";for(;o<n;){r=t[o],s=$t[r],h+=r===i?" ":Zt[r];for(let r=1;r<s;r++)h+=a.float(t[o+r],e),r===s-1||(h+=" ");i=r,o+=s}return h},parse(t,e){let s,r,i,o="";const n=[],a=e?Qt:Vt;for(let e=0,h=t.length;e<h;e++)r=t[e],yt[r]?("."===r&&(us.dot&&(cs(n,o),o=""),us.dot++),"0"===o&&"."!==r&&(cs(n,o),o=""),o+=r):Gt[r]?(o&&(cs(n,o),o=""),us.name=Gt[r],us.length=qt[r],us.index=0,cs(n,us.name),!s&&a[r]&&(s=!0)):"-"===r||"+"===r?"e"===i||"E"===i?o+=r:(o&&cs(n,o),o=r):o&&(cs(n,o),o=""),i=r;return o&&cs(n,o),s?ds.toCanvasData(n,e):n},toCanvasData(t,e){let s,r,i,o,n,a=0,h=0,l=0,d=0,u=0,c=t.length;const p=[];for(;u<c;){switch(i=t[u],i){case Pe:t[u+1]+=a,t[u+2]+=h;case Oe:a=t[u+1],h=t[u+2],p.push(Oe,a,h),u+=3;break;case Ie:t[u+1]+=a;case Se:a=t[u+1],p.push(Re,a,h),u+=2;break;case Ae:t[u+1]+=h;case Me:h=t[u+1],p.push(Re,a,h),u+=2;break;case Le:t[u+1]+=a,t[u+2]+=h;case Re:a=t[u+1],h=t[u+2],p.push(Re,a,h),u+=3;break;case Ne:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=De;case De:n=o===Ee||o===De,l=n?2*a-s:t[u+1],d=n?2*h-r:t[u+2],s=t[u+1],r=t[u+2],a=t[u+3],h=t[u+4],p.push(Ee,l,d,s,r,a,h),u+=5;break;case We: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=Ee;case Ee:s=t[u+3],r=t[u+4],a=t[u+5],h=t[u+6],p.push(Ee,t[u+1],t[u+2],s,r,a,h),u+=7;break;case Fe:t[u+1]+=a,t[u+2]+=h,i=ze;case ze:n=o===Ye||o===ze,s=n?2*a-s:t[u+1],r=n?2*h-r:t[u+2],e?ns(p,a,h,s,r,t[u+1],t[u+2]):p.push(Ye,s,r,t[u+1],t[u+2]),a=t[u+1],h=t[u+2],u+=3;break;case Xe:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=Ye;case Ye:s=t[u+1],r=t[u+2],e?ns(p,a,h,s,r,t[u+3],t[u+4]):p.push(Ye,s,r,t[u+3],t[u+4]),a=t[u+3],h=t[u+4],u+=5;break;case He:t[u+6]+=a,t[u+7]+=h;case je:as(p,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 Ge:case Ue:p.push(Ue),u++;break;case qe:a=t[u+1],h=t[u+2],e?es(p,a,h,t[u+3],t[u+4]):ps(p,t,u,5),u+=5;break;case Ve:a=t[u+1],h=t[u+2],e?ss(p,a,h,t[u+3],t[u+4],[t[u+5],t[u+6],t[u+7],t[u+8]]):ps(p,t,u,9),u+=9;break;case Qe:a=t[u+1],h=t[u+2],e?ss(p,a,h,t[u+3],t[u+4],t[u+5]):ps(p,t,u,6),u+=6;break;case Je:os(e?p:ps(p,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,ls),a=ls.x,h=ls.y,u+=9;break;case Ze:e?os(p,t[u+1],t[u+2],t[u+3],t[u+4],0,0,360,!1):ps(p,t,u,5),a=t[u+1]+t[u+3],h=t[u+2],u+=5;break;case $e:is(e?p:ps(p,t,u,7),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],null,ls),a=ls.x,h=ls.y,u+=7;break;case Ke:e?is(p,t[u+1],t[u+2],t[u+3],0,360,!1):ps(p,t,u,4),a=t[u+1]+t[u+3],h=t[u+2],u+=4;break;case ts:rs(e?p:ps(p,t,u,6),a,h,t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],null,ls),a=ls.x,h=ls.y,u+=6;break;default:return hs.error(`command: ${i} [index:${u}]`,t),p}o=i}return p},copyData(t,e,s,r){for(let i=s,o=s+r;i<o;i++)t.push(e[i])},pushData(t,e){us.index===us.length&&(us.index=1,t.push(us.name)),t.push(Number(e)),us.index++,us.dot=0}},{current:us,pushData:cs,copyData:ps}=ds,{M:_s,L:fs,C:gs,Q:ys,Z:xs,N:ms,D:ws,X:bs,G:vs,F:Bs,O:Cs,P:ks,U:Ts}=Gt,{getMinDistanceFrom:Os,getRadianFrom:Ps}=I,{tan:Rs,min:Ls,abs:Ss}=Math,Is={},Ms={beginPath(t){t.length=0},moveTo(t,e,s){t.push(_s,e,s)},lineTo(t,e,s){t.push(fs,e,s)},bezierCurveTo(t,e,s,r,i,o,n){t.push(gs,e,s,r,i,o,n)},quadraticCurveTo(t,e,s,r,i){t.push(ys,e,s,r,i)},closePath(t){t.push(xs)},rect(t,e,s,r,i){t.push(ms,e,s,r,i)},roundRect(t,e,s,r,i,o){if("number"==typeof o)t.push(bs,e,s,r,i,o);else{const n=a.fourNumber(o);n?t.push(ws,e,s,r,i,...n):t.push(ms,e,s,r,i)}},ellipse(t,e,s,r,i,o,n,a,h){void 0===o?t.push(Bs,e,s,r,i):(void 0===n&&(n=0),void 0===a&&(a=360),t.push(vs,e,s,r,i,o,n,a,h?1:0))},arc(t,e,s,r,i,o,n){void 0===i?t.push(ks,e,s,r):(void 0===o&&(o=360),t.push(Cs,e,s,r,i,o,n?1:0))},arcTo(t,e,s,r,i,o,n,a){if(void 0!==n){const h=Rs(Ps(n,a,e,s,r,i)/2)*(Os(n,a,e,s,r,i)/2);t.push(Ts,e,s,r,i,Ls(o,Ss(h)))}else t.push(Ts,e,s,r,i,o)},drawEllipse(t,e,s,r,i,o,n,a,h){ye.ellipse(null,e,s,r,i,void 0===o?0:o,void 0===n?0:n,void 0===a?360:a,h,null,null,Is),t.push(_s,Is.x,Is.y),As(t,e,s,r,i,o,n,a,h)},drawArc(t,e,s,r,i,o,n){ye.arc(null,e,s,r,void 0===i?0:i,void 0===o?360:o,n,null,null,Is),t.push(_s,Is.x,Is.y),Es(t,e,s,r,i,o,n)},drawPoints(t,e,s,r){ye.points(t,e,s,r)}},{ellipse:As,arc:Es}=Ms,{moveTo:Ws,lineTo:Ds,quadraticCurveTo:Ns,bezierCurveTo:Ys,closePath:Xs,beginPath:zs,rect:Fs,roundRect:js,ellipse:Hs,arc:Us,arcTo:Gs,drawEllipse:qs,drawArc:Vs,drawPoints:Qs}=Ms;class Js{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.clearPath=this.beginPath,this.set(t)}set(t){return this.__path=t?"string"==typeof t?Ht.parse(t):t:[],this}beginPath(){return zs(this.__path),this}moveTo(t,e){return Ws(this.__path,t,e),this}lineTo(t,e){return Ds(this.__path,t,e),this}bezierCurveTo(t,e,s,r,i,o){return Ys(this.__path,t,e,s,r,i,o),this}quadraticCurveTo(t,e,s,r){return Ns(this.__path,t,e,s,r),this}closePath(){return Xs(this.__path),this}rect(t,e,s,r){return Fs(this.__path,t,e,s,r),this}roundRect(t,e,s,r,i){return js(this.__path,t,e,s,r,i),this}ellipse(t,e,s,r,i,o,n,a){return Hs(this.__path,t,e,s,r,i,o,n,a),this}arc(t,e,s,r,i,o){return Us(this.__path,t,e,s,r,i,o),this}arcTo(t,e,s,r,i){return Gs(this.__path,t,e,s,r,i),this}drawEllipse(t,e,s,r,i,o,n,a){return qs(this.__path,t,e,s,r,i,o,n,a),this}drawArc(t,e,s,r,i,o){return Vs(this.__path,t,e,s,r,i,o),this}drawPoints(t,e,s){return Qs(this.__path,t,e,s),this}}const{M:Zs,L:$s,C:Ks,Q:tr,Z:er,N:sr,D:rr,X:ir,G:or,F:nr,O:ar,P:hr,U:lr}=Gt,dr=xt.get("PathDrawer"),ur={drawPathByData(t,e){if(!e)return;let s,r=0,i=e.length;for(;r<i;)switch(s=e[r],s){case Zs:t.moveTo(e[r+1],e[r+2]),r+=3;break;case $s:t.lineTo(e[r+1],e[r+2]),r+=3;break;case Ks:t.bezierCurveTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5],e[r+6]),r+=7;break;case tr:t.quadraticCurveTo(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case er:t.closePath(),r+=1;break;case sr:t.rect(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case rr: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 ir:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;case or:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]*h,e[r+6]*h,e[r+7]*h,e[r+8]),r+=9;break;case nr:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,l,!1),r+=5;break;case ar:t.arc(e[r+1],e[r+2],e[r+3],e[r+4]*h,e[r+5]*h,e[r+6]),r+=7;break;case hr:t.arc(e[r+1],e[r+2],e[r+3],0,l,!1),r+=4;break;case lr:t.arcTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;default:return void dr.error(`command: ${s} [index:${r}]`,e)}}},{M:cr,L:pr,C:_r,Q:fr,Z:gr,N:yr,D:xr,X:mr,G:wr,F:br,O:vr,P:Br,U:Cr}=Gt,{toTwoPointBounds:kr,toTwoPointBoundsByQuadraticCurve:Tr,arcTo:Or,arc:Pr,ellipse:Rr}=ye,{addPointBounds:Lr,copy:Sr,addPoint:Ir,setPoint:Mr,addBounds:Ar,toBounds:Er}=z,Wr=xt.get("PathBounds");let Dr,Nr,Yr;const Xr={},zr={},Fr={},jr={toBounds(t,e){jr.toTwoPointBounds(t,zr),Er(zr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Mr(e,0,0);let s,r,i,o,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(s=t[a],0===a&&(s===gr||s===_r||s===fr?Mr(e,h,l):Mr(e,t[a+1],t[a+2])),s){case cr:case pr:h=t[a+1],l=t[a+2],Ir(e,h,l),a+=3;break;case _r:o=t[a+5],n=t[a+6],kr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],o,n,Xr),Lr(e,Xr),h=o,l=n,a+=7;break;case fr:r=t[a+1],i=t[a+2],o=t[a+3],n=t[a+4],Tr(h,l,r,i,o,n,Xr),Lr(e,Xr),h=o,l=n,a+=5;break;case gr:a+=1;break;case yr:h=t[a+1],l=t[a+2],Ar(e,h,l,t[a+3],t[a+4]),a+=5;break;case xr:case mr:h=t[a+1],l=t[a+2],Ar(e,h,l,t[a+3],t[a+4]),a+=s===xr?9:6;break;case wr:Rr(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],Xr,Fr),0===a?Sr(e,Xr):Lr(e,Xr),h=Fr.x,l=Fr.y,a+=9;break;case br:h=t[a+1],l=t[a+2],Nr=t[a+3],Yr=t[a+4],Ar(e,h-Nr,l-Yr,2*Nr,2*Yr),h+=Nr,a+=5;break;case vr:Pr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Xr,Fr),0===a?Sr(e,Xr):Lr(e,Xr),h=Fr.x,l=Fr.y,a+=7;break;case Br:h=t[a+1],l=t[a+2],Dr=t[a+3],Ar(e,h-Dr,l-Dr,2*Dr,2*Dr),h+=Dr,a+=4;break;case Cr:Or(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Xr,Fr),0===a?Sr(e,Xr):Lr(e,Xr),h=Fr.x,l=Fr.y,a+=6;break;default:return void Wr.error(`command: ${s} [index:${a}]`,t)}}},{M:Hr,L:Ur,C:Gr,Z:qr}=Gt,{getCenterX:Vr,getCenterY:Qr}=I,{arcTo:Jr}=Ms,Zr={smooth(t,e,s){let r,i=0,o=0,n=0,a=0,h=0,l=0,d=0,u=0,c=0;const p=t.length,_=[];for(;i<p;)switch(r=t[i],r){case Hr:a=u=t[i+1],h=c=t[i+2],i+=3,t[i]===Ur?(l=t[i+1],d=t[i+2],_.push(Hr,Vr(a,l),Qr(h,d))):_.push(Hr,a,h);break;case Ur:switch(o=t[i+1],n=t[i+2],i+=3,t[i]){case Ur:Jr(_,o,n,t[i+1],t[i+2],e,u,c);break;case qr:Jr(_,o,n,a,h,e,u,c);break;default:_.push(Ur,o,n)}u=o,c=n;break;case Gr:_.push(Gr,t[i+1],t[i+2],t[i+3],t[i+4],t[i+5],t[i+6]),i+=7;break;case qr:Jr(_,a,h,l,d,e,u,c),_.push(qr),i+=1}return r!==qr&&(_[1]=a,_[2]=h),_}};Ht.creator=new Js,Ht.parse=ds.parse,Ht.convertToCanvasData=ds.toCanvasData;const $r=new Js,{drawRoundRect:Kr}=Kt;const ti={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=ei.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{}}}},ei=ti;ei.opacityTypes.forEach((t=>ei.upperCaseTypeMap[t]=t.toUpperCase()));const si=xt.get("TaskProcessor");class ri{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return Et(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){si.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class ii{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&&Lt.assign(this.config,t),this.empty()}add(t,e){let s,r,i,o;const n=new ri(t);return n.parent=this,"number"==typeof e?o=e:e&&(r=e.parallel,s=e.start,i=e.time,o=e.delay),i&&(n.time=i),!1===r&&(n.parallel=!1),void 0===o?this.push(n,s):(this.delayNumber++,setTimeout((()=>{this.delayNumber&&(this.delayNumber--,this.push(n,s))}),o)),this.isComplete=!1,n}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout((()=>this.start())))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach((t=>{t.isComplete||t.cancel()})),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)})):this.nextTask()}runParallelTasks(){this.parallelList.forEach((t=>this.runParallelTask(t)))}runParallelTask(t){t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout((()=>this.run()))}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;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)}destroy(){this.stop()}}const oi={map:{},recycledList:[],tasker:new ii,patternTasker:new ii,get isComplete(){return ni.tasker.isComplete},get(t){let s=ni.map[t.url];return s||(s=e.image(t),ni.map[t.url]=s),s.use++,s},recycle(t){t.use--,setTimeout((()=>{t.use||ni.recycledList.push(t)}))},clearRecycled(){const t=ni.recycledList;t.length>100&&(t.forEach((t=>{!t.use&&t.url&&(delete ni.map[t.url],t.destroy())})),t.length=0)},hasOpacityPixel:t=>ti.opacityTypes.some((e=>ni.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+ti.mineType(t)))return!0}else if(s.includes("."+t)||s.includes("."+ti.upperCaseTypeMap[t]))return!0;return!1},destroy(){ni.map={},ni.recycledList=[]}},ni=oi,{IMAGE:ai,create:hi}=s;function li(t,e,s,r){r||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function di(t,e){return Object.getOwnPropertyDescriptor(t,e)}function ui(t,e){return(s,r)=>pi(s,r,t,e&&e(r))}function ci(t){return t}function pi(t,e,s,r){const i={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};li(t,e,Object.assign(i,r||{})),wi(t,e,s)}function _i(t,e){return ui(t,(t=>({set(s){this.__setAttr(t,s,e)&&fi(this)}})))}function fi(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}const gi=_i;function yi(t){return ui(t,(t=>({set(e){this.__setAttr(t,e)&&xi(this)}})))}function xi(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&fi(t)}const mi=yi;function wi(t,e,s){const r=t.__DataProcessor.prototype,i="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),n={get(){const t=this[i];return void 0===t?s:t},set(t){this[i]=t}};void 0===s?n.get=function(){return this[i]}:"width"===e?n.get=function(){const t=this[i];if(void 0===t){const t=this;return t._height&&t.__naturalWidth&&t.__useNaturalRatio?t._height*t.__naturalWidth/t.__naturalHeight:t.__naturalWidth||s}return t}:"height"===e&&(n.get=function(){const t=this[i];if(void 0===t){const t=this;return t._width&&t.__naturalHeight&&t.__useNaturalRatio?t._width*t.__naturalHeight/t.__naturalWidth:t.__naturalHeight||s}return t});let a,h=r;for(;!a&&h;)a=di(h,e),h=h.__proto__;a&&a.set&&(n.set=a.set),r[o]&&(n.set=r[o],delete r[o]),li(r,e,n)}const bi=new xt("rewrite"),vi=[],Bi=["destroy","constructor"];function Ci(t){vi.length&&(vi.forEach((e=>{t&&bi.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),vi.length=0)}function ki(t,e){return s=>{var r;(t.prototype?(r=t.prototype,Object.getOwnPropertyNames(r)):Object.keys(t)).forEach((r=>{if(!(Bi.includes(r)||e&&e.includes(r)))if(t.prototype){di(t.prototype,r).writable&&(s.prototype[r]=t.prototype[r])}else s.prototype[r]=t[r]}))}}setTimeout((()=>Ci(!0)));const{copy:Ti,toInnerPoint:Oi,scaleOfOuter:Pi,rotateOfOuter:Ri,skewOfOuter:Li,multiplyParent:Si,divideParent:Ii,getLayout:Mi}=b,Ai={},Ei={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),Ni(t,e,s),t.isBranch){const{children:r}=t;for(let t=0,i=r.length;t<i;t++)Di(r[t],e,s)}},updateMatrix(t,e,s){const r=t.__layout;e?s&&(r.waitAutoLayout=!0,t.__hasAutoLayout&&(r.matrixChanged=!1)):r.waitAutoLayout&&(r.waitAutoLayout=!1),r.matrixChanged&&t.__updateLocalMatrix(),r.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Yi(e[t])}},updateAllChange(t){if(Yi(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Xi(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},moveWorld(t,e,s=0){const r="object"==typeof e?Object.assign({},e):{x:e,y:s};t.parent&&Oi(t.parent.worldTransform,r,r,!0),Wi.moveLocal(t,r.x,r.y)},moveLocal(t,e,s=0){"object"==typeof e?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=s)},zoomOfWorld(t,e,s,r,i){Wi.zoomOfLocal(t,Fi(t,e),s,r,i)},zoomOfLocal(t,e,s,r=s,i){Ti(Ai,t.__localMatrix),Pi(Ai,e,s,r),zi(t,Ai),t.scaleResize(s,r,!0!==i)},rotateOfWorld(t,e,s){Wi.rotateOfLocal(t,Fi(t,e),s)},rotateOfLocal(t,e,s){Ti(Ai,t.__localMatrix),Ri(Ai,e,s),zi(t,Ai),t.rotation=a.formatRotation(t.rotation+s)},skewOfWorld(t,e,s,r,i){Wi.skewOfLocal(t,Fi(t,e),s,r,i)},skewOfLocal(t,e,s,r=0,i){Ti(Ai,t.__localMatrix),Li(Ai,e,s,r),Wi.setTransform(t,Ai,i)},transformWorld(t,e,s){Ti(Ai,t.worldTransform),Si(Ai,e),t.parent&&Ii(Ai,t.parent.worldTransform),Wi.setTransform(t,Ai,s)},transform(t,e,s){Ti(Ai,t.localTransform),Si(Ai,e),Wi.setTransform(t,Ai,s)},setTransform(t,e,s){const r=Mi(e);if(s){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;delete r.scaleX,delete r.scaleY,t.set(r),t.scaleResize(e,i,!0!==s)}else t.set(r)},getLocalOrigin:(t,e)=>I.tempToOuterOf(Wi.getInnerOrigin(t,e),t.localTransform),getInnerOrigin:(t,e)=>("string"==typeof e&&pt.toPoint(e,t.boxBounds,e={}),e),getRelativeWorld:(t,e,s)=>(Ti(Ai,t.worldTransform),Ii(Ai,e.worldTransform),s?Ai:Object.assign({},Ai)),drop(t,e,s,r){t.setTransform(Wi.getRelativeWorld(t,e,!0),r),e.add(t,s)},hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}}},Wi=Ei,{updateAllMatrix:Di,updateMatrix:Ni,updateAllWorldOpacity:Yi,updateAllChange:Xi}=Wi;function zi(t,e){const{e:s,f:r}=t.__localMatrix;t.x+=e.e-s,t.y+=e.f-r}function Fi(t,e){return t.__layout.update(),t.parent?I.tempToInnerOf(e,t.parent.__world):e}const ji={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:t=>t.__.mask?t.__localBoxBounds:null,maskLocalStrokeBounds:t=>t.__.mask?t.__layout.localStrokeBounds:null,maskLocalRenderBounds:t=>t.__.mask?t.__layout.localRenderBounds:null,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))},{updateBounds:Hi}=Ei,Ui={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:s}=t;for(let r=0,i=s.length;r<i;r++)(t=s[r]).isBranch&&(t.__tempNumber=1,e.add(t),Gi(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&void 0===s[t.parent.innerId];)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let s=e.length;const{children:r}=t;for(let t=0,s=r.length;t<s;t++)r[t].isBranch&&e.push(r[t]);for(let t=s,r=e.length;t<r;t++)qi(e[t],e)},updateBounds(t,e){const s=[t];qi(t,s),Vi(s,e)},updateBoundsByBranchStack(t,e){let s,r;for(let i=t.length-1;i>-1;i--){s=t[i],r=s.children;for(let t=0,e=r.length;t<e;t++)Hi(r[t]);e&&e===s||Hi(s)}}},{pushAllChildBranch:Gi,pushAllBranchStack:qi,updateBoundsByBranchStack:Vi}=Ui,Qi={run(t){if(t&&t.length){const e=t.length;for(let s=0;s<e;s++)t[s]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:Ji}=Ei,{toOuterOf:Zi,getPoints:$i,copy:Ki}=it,to="_localContentBounds",eo="_worldContentBounds",so="_worldBoxBounds",ro="_worldStrokeBounds";class io{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}get localContentBounds(){return Zi(this.contentBounds,this.leaf.__localMatrix,this[to]||(this[to]={})),this[to]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Zi(this.contentBounds,this.leaf.__world,this[eo]||(this[eo]={})),this[eo]}get worldBoxBounds(){return Zi(this.boxBounds,this.leaf.__world,this[so]||(this[so]={})),this[so]}get worldStrokeBounds(){return Zi(this.strokeBounds,this.leaf.__world,this[ro]||(this[ro]={})),this[ro]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.boxBounds={x:0,y:0,width:0,height:0},this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),this.boxChange(),this.matrixChange()}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leafer:e}=this.leaf;if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=this.leaf;for(;e.parent&&!e.parent.leafer;)e=e.parent;t.layout(e)}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return b.defaultMatrix;case"page":t=e.zoomLayer;default:return Ji(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new ht(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",s){const{leaf:r}=this;let i,o,n=this.getInnerBounds(t);switch(e){case"world":i=r.getWorldPoint(n),o=r.__world;break;case"local":i=r.getLocalPointByInner(n),o=r.__localMatrix;break;case"inner":i=n,o=b.defaultMatrix;break;case"page":e=r.zoomLayer;default:i=r.getWorldPoint(n,e),o=Ji(r,e,!0)}const a=b.getLayout(o);if(Ki(a,n),I.copy(a,i),s){const{scaleX:t,scaleY:e}=a,s=Math.abs(t),r=Math.abs(e);1===s&&1===r||(a.scaleX/=s,a.scaleY/=r,a.width*=s,a.height*=r)}return a}getLayoutPoints(t,e="world"){const{leaf:s}=this,r=$i(this.getInnerBounds(t));let i;switch(e){case"world":i=null;break;case"local":i=s.parent;break;case"inner":break;case"page":e=s.zoomLayer;default:i=e}return void 0!==i&&r.forEach((t=>s.innerToWorld(t,null,!1,i))),r}shrinkContent(){const{x:t,y:e,width:s,height:r}=this.boxBounds;this._contentBounds={x:t,y:e,width:s,height:r}}spreadStroke(){const{x:t,y:e,width:s,height:r}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:s,height:r},this._localStrokeBounds={x:t,y:e,width:s,height:r},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:r}=this.renderBounds;this._renderBounds={x:t,y:e,width:s,height:r},this._localRenderBounds={x:t,y:e,width:s,height:r}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged||this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=!0,this.leaf.forceUpdate("surface"))}destroy(){}}const oo={},no={on(t,e,s){let r,i,o;s&&("boolean"==typeof s?r=s:(r=s.capture,i=s.once));const n=ao(this,r,!0),a="string"==typeof t?t.split(" "):t,h=i?{listener:e,once:i}:{listener:e};a.forEach((t=>{t&&(o=n[t],o?-1===o.findIndex((t=>t.listener===e))&&o.push(h):n[t]=[h])}))},off(t,e,s){if(t){const r="string"==typeof t?t.split(" "):t;if(e){let t,i,o;s&&(t="boolean"==typeof s?s:s.capture);const n=ao(this,t);r.forEach((t=>{t&&(i=n[t],i&&(o=i.findIndex((t=>t.listener===e)),o>-1&&i.splice(o,1),i.length||delete n[t]))}))}else{const{__bubbleMap:t,__captureMap:e}=this;r.forEach((s=>{t&&delete t[s],e&&delete e[s]}))}}else this.__bubbleMap=this.__captureMap=void 0},on_(t,e,s,r){return s&&(e=e.bind(s)),this.on(t,e,r),{type:t,current:this,listener:e,options:r}},off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>t.current.off(t.type,t.listener,t.options))),e.length=0},once(t,e,s){this.on(t,e,{once:!0,capture:s})},emit(t,e,s){!e&&Pt.has(t)&&(e=Pt.get(t,{type:t,target:this,current:this}));const r=ao(this,s)[t];if(r){let i;for(let o=0,n=r.length;o<n&&(i=r[o],i.listener(e),i.once&&(this.off(t,i.listener,s),o--,n--),!e||!e.isStopNow);o++);}this.syncEventer&&this.syncEventer.emitEvent(e,s)},emitEvent(t,e){t.current=this,this.emit(t.type,t,e)},hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:s,__captureMap:r}=this,i=s&&s[t],o=r&&r[t];return!!(void 0===e?i||o:e?o:i)}};function ao(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:oo)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:oo)}}class ho{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&t.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&t.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&t.event.stop(this.origin)}}class lo extends ho{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}lo.ADD="child.add",lo.REMOVE="child.remove",lo.DESTROY="child.destroy";class uo extends ho{constructor(t,e,s,r,i){super(t,e),this.attrName=s,this.oldValue=r,this.newValue=i}}uo.CHANGE="property.change",uo.LEAFER_CHANGE="property.leafer_change";class co extends ho{constructor(t,e){super(t),Object.assign(this,e)}}co.LOAD="image.load",co.LOADED="image.loaded",co.ERROR="image.error";class po extends ho{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){"object"==typeof t?(super(po.RESIZE),Object.assign(this,t)):super(t),this.old=e}}po.RESIZE="resize";class _o extends ho{constructor(t,e){super(t),this.data=e}}_o.REQUEST="watch.request",_o.DATA="watch.data";class fo extends ho{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}fo.CHECK_UPDATE="layout.check_update",fo.REQUEST="layout.request",fo.START="layout.start",fo.BEFORE="layout.before",fo.LAYOUT="layout",fo.AFTER="layout.after",fo.AGAIN="layout.again",fo.END="layout.end";class go extends ho{}go.FRAME="animate.frame";class yo extends ho{constructor(t,e,s,r){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=r)}}yo.REQUEST="render.request",yo.START="render.start",yo.BEFORE="render.before",yo.RENDER="render",yo.AFTER="render.after",yo.AGAIN="render.again",yo.END="render.end",yo.NEXT="render.next";class xo extends ho{}xo.START="leafer.start",xo.BEFORE_READY="leafer.before_ready",xo.READY="leafer.ready",xo.AFTER_READY="leafer.after_ready",xo.VIEW_READY="leafer.view_ready",xo.VIEW_COMPLETED="leafer.view_completed",xo.STOP="leafer.stop",xo.RESTART="leafer.restart",xo.END="leafer.end";const{isFinite:mo}=Number,wo=xt.get("setAttr"),bo={__setAttr(t,e,s){if(this.leafer&&this.leafer.created){const r=this.__.__getInput(t);if(s&&!mo(e)&&void 0!==e&&(wo.warn(this.innerName,t,e),e=void 0),"object"==typeof e||r!==e){this.__[t]=e,this.__proxyData&&this.setProxyAttr(t,e);const{CHANGE:s}=uo,i=new uo(s,this,t,r,e);return this.isLeafer?this.emitEvent(new uo(uo.LEAFER_CHANGE,this,t,r,e)):this.hasEvent(s)&&this.emitEvent(i),this.leafer.emitEvent(i),!0}return!1}return this.__[t]=e,this.__proxyData&&this.setProxyAttr(t,e),!0},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:vo,multiplyParent:Bo,translateInner:Co,defaultWorld:ko}=b,{toPoint:To,tempPoint:Oo}=pt,Po={__updateWorldMatrix(){Bo(this.__local||this.__layout,this.parent?this.parent.__world:ko,this.__world,!!this.__layout.affectScaleOrRotation,this.__,this.parent&&this.parent.__)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged||t.rotationChanged)&&(vo(e,s,null,t.affectRotation),t.scaleChanged=t.rotationChanged=!1),e.e=s.x+s.offsetX,e.f=s.y+s.offsetY,(s.around||s.origin)&&(To(s.around||s.origin,t.boxBounds,Oo),Co(e,-Oo.x,-Oo.y,s.origin))}this.__layout.matrixChanged=!1}},{updateMatrix:Ro,updateAllMatrix:Lo}=Ei,{updateBounds:So}=Ui,{toOuterOf:Io,copyAndSpread:Mo,copy:Ao}=it,{toBounds:Eo}=jr,Wo={__updateWorldBounds(){Io(this.__layout.renderBounds,this.__world,this.__world),this.__layout.resized&&(this.__onUpdateSize(),this.__layout.resized=!1)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized=!0),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=!1,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=!1,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=!1,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized=!0),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=!1,this.parent&&this.parent.__layout.renderChange()),t.boundsChanged=!1},__updateLocalBoxBounds(){this.__hasAutoLayout&&this.__updateAutoLayout(),Io(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Io(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Io(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?Eo(e.__pathForRender,t):(t.x=0,t.y=0,t.width=e.width,t.height=e.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.leafer&&this.leafer.ready&&this.leafer.layouter.addExtra(this),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),Lo(this),So(this,this),this.__.__autoSide&&this.__updateBoxBounds()):(Lo(this),So(this,this))):Ro(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;Mo(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?Mo(t.renderBounds,t.boxBounds,t.renderSpread):Ao(t.renderBounds,t.strokeBounds)}},Do={__render(t,e){if(this.__worldOpacity)if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=this.__.opacity,this.__.__single){if("path"===this.__.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e),this.__worldFlipped?t.copyWorldByReset(s,this.__nowWorld,null,this.__.__blendMode,!0):t.copyWorldToInner(s,this.__nowWorld,this.__layout.renderBounds,this.__.__blendMode),s.recycle(this.__nowWorld)}else this.__draw(t,e)},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),this.__.windingRule?t.clip(this.__.windingRule):t.clip())},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:No}=ji,Yo={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__worldOpacity)if(this.__.__single){if("path"===this.__.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const r=this.__getNowWorld(e);t.opacity=this.__.opacity,t.copyWorldByReset(s,r,r,this.__.__blendMode,!0),s.recycle(r)}else this.__renderBranch(t,e)},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:s}=this;for(let r=0,i=s.length;r<i;r++)No(s[r],e)||s[r].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:s}=this;for(let r=0,i=s.length;r<i;r++)No(s[r],e)||s[r].__clip(t,e)}}},{LEAF:Xo,create:zo}=s,{toInnerPoint:Fo,toOuterPoint:jo,multiplyParent:Ho}=b,{toOuterOf:Uo}=it,{copy:Go}=I,{moveLocal:qo,zoomOfLocal:Vo,rotateOfLocal:Qo,skewOfLocal:Jo,moveWorld:Zo,zoomOfWorld:$o,rotateOfWorld:Ko,skewOfWorld:tn,transform:en,transformWorld:sn,setTransform:rn,getLocalOrigin:on,getRelativeWorld:nn,drop:an}=Ei;exports.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return It}get __LayoutProcessor(){return io}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.__layout.update(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){const{leafer:t}=this;return t&&t.created&&t.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}constructor(t){this.innerId=zo(Xo),this.reset(t)}reset(t){this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0}),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.__leaferWait?this.__leaferWait.push(t):this.__leaferWait=[t]}nextRender(t,e,s){this.leafer?this.leafer.nextRender(t,e,s):this.waitLeafer((()=>this.leafer.nextRender(t,e,s)))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t&&(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.__leaferWait&&Qi.run(this.__leaferWait)),this.isBranch){const{children:e}=this;for(let s=0,r=e.length;s<r;s++)e[s].__bindLeafer(t)}}set(t){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateLayout(){this.__layout.update()}forceUpdate(t){void 0===t?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=void 0===e?null:void 0,this[t]=e}forceRender(t){this.forceUpdate("surface")}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateContentBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some((t=>t.__.eraser))}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:s}=this.__layout;t.clearRect(s.x,s.y,s.width,s.height),t.restore()}__updateMask(t){this.__hasMask=!!t||this.children.some((t=>t.__.mask))}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld;return Ho(this.__world,t.matrix,e,void 0,this.__world),Uo(this.__layout.renderBounds,e,e),e}return this.__world}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,s){return this.__layout.getLayoutBounds(t,e,s)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,s){const r=e?nn(this,e):this.worldTransform,i=s?t:{};return Uo(t,r,i),i}worldToLocal(t,e,s,r){this.parent?this.parent.worldToInner(t,e,s,r):e&&Go(e,t)}localToWorld(t,e,s,r){this.parent?this.parent.innerToWorld(t,e,s,r):e&&Go(e,t)}worldToInner(t,e,s,r){r&&(r.innerToWorld(t,e,s),t=e||t),Fo(this.worldTransform,t,e,s)}innerToWorld(t,e,s,r){jo(this.worldTransform,t,e,s),r&&r.worldToInner(e||t,null,s)}getInnerPoint(t,e,s,r){const i=r?t:{};return this.worldToInner(t,i,s,e),i}getInnerPointByLocal(t,e,s,r){return this.getInnerPoint(t,this.parent,s,r)}getLocalPoint(t,e,s,r){const i=r?t:{};return this.worldToLocal(t,i,s,e),i}getLocalPointByInner(t,e,s,r){return this.getWorldPoint(t,this.parent,s,r)}getWorldPoint(t,e,s,r){const i=r?t:{};return this.innerToWorld(t,i,s,e),i}getWorldPointByLocal(t,e,s,r){const i=r?t:{};return this.localToWorld(t,i,s,e),i}getPagePoint(t,e,s,r){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,s,r)}getWorldPointByPage(t,e,s,r){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,s,r)}setTransform(t,e){rn(this,t,e)}transform(t,e){en(this,t,e)}move(t,e){qo(this,t,e)}scaleOf(t,e,s,r){Vo(this,on(this,t),e,s,r)}rotateOf(t,e){Qo(this,on(this,t),e)}skewOf(t,e,s,r){Jo(this,on(this,t),e,s,r)}transformWorld(t,e){sn(this,t,e)}moveWorld(t,e){Zo(this,t,e)}scaleOfWorld(t,e,s,r){$o(this,t,e,s,r)}rotateOfWorld(t,e){Ko(this,t,e)}skewOfWorld(t,e,s,r){tn(this,t,e,s,r)}scaleResize(t,e=t,s){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e){}__clip(t,e){}__renderShape(t,e,s,r){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,s){an(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,r){}off_(t){}once(t,e,s){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,s){s?this.addAttr(t,e,s):wi(this.prototype,t,e)}static addAttr(t,e,s){s||(s=_i),s(e)(this.prototype,t)}destroy(){if(!this.destroyed){const{parent:t}=this;t&&this.remove(),this.children&&this.removeAll(!0),this.hasEvent(lo.DESTROY)&&this.emitEvent(new lo(lo.DESTROY,this,t)),this.__.destroy(),this.__layout.destroy(),this.__captureMap=this.__bubbleMap=this.__parentWait=this.__leaferWait=null,this.destroyed=!0}}},exports.Leaf=At([ki(bo),ki(Po),ki(Wo),ki(no),ki(Do)],exports.Leaf);const{setListWithFn:hn}=it,{sort:ln}=Ui,{localBoxBounds:dn,localStrokeBounds:un,localRenderBounds:cn,maskLocalBoxBounds:pn,maskLocalStrokeBounds:_n,maskLocalRenderBounds:fn}=ji;exports.Branch=class extends exports.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(){hn(this.__layout.boxBounds,this.children,this.__hasMask?pn:dn)}__updateStrokeBounds(){hn(this.__layout.strokeBounds,this.children,this.__hasMask?_n:un)}__updateRenderBounds(){hn(this.__layout.renderBounds,this.children,this.__hasMask?fn:cn)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,r=e.length;s<r;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(ln),this.__layout.affectChildrenSort=t}}add(t,e){t!==this&&(t.parent&&t.parent.remove(t),t.parent=this,void 0===e?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1),t.__layout.boxChanged||t.__layout.boxChange(),t.__layout.matrixChanged||t.__layout.matrixChange(),t.__parentWait&&Qi.run(t.__parentWait),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(lo.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange())}addMany(...t){t.forEach((t=>this.add(t)))}remove(t,e){if(t){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}else void 0===t&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach((e=>{this.__realRemoveChild(e),t&&e.destroy()})))}clear(){this.removeAll(!0)}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(lo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new lo(t,e,this);e.hasEvent(t)&&e.emitEvent(s),this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}},exports.Branch=At([ki(Yo)],exports.Branch);class gn{get length(){return this.list.length}constructor(t){this.reset(),t&&(t instanceof Array?this.addList(t):this.add(t))}has(t){return t&&void 0!==this.keys[t.innerId]}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return void 0===e?-1:e}add(t){const{list:e,keys:s}=this;void 0===s[t.innerId]&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(void 0===s[t.innerId]){const{list:r}=this;for(let t=e,i=r.length;t<i;t++)s[r[t].innerId]++;0===e?r.unshift(t):(e>r.length&&(e=r.length),r.splice(e,0,t)),s[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let s;for(let r=0,i=e.length;r<i;r++)void 0!==s?this.keys[e[r].innerId]=r-1:e[r].innerId===t.innerId&&(s=r,delete this.keys[t.innerId]);void 0!==s&&e.splice(s,1)}sort(t){const{list:e}=this;t?e.sort(((t,e)=>e.__level-t.__level)):e.sort(((t,e)=>t.__level-e.__level))}forEach(t){this.list.forEach(t)}clone(){const t=new gn;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let s=0,r=t.length;s<r;s++)e[t[s].innerId]=s}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}exports.AlignHelper=gt,exports.AnimateEvent=go,exports.AroundHelper=pt,exports.AutoBounds=class{constructor(t,e,s,r,i,o){"object"==typeof t?this.copy(t):this.set(t,e,s,r,i,o)}set(t=0,e=0,s=0,r=0,i=0,o=0){this.top=t,this.right=e,this.bottom=s,this.left=r,this.width=i,this.height=o}copy(t){const{top:e,right:s,bottom:r,left:i,width:o,height:n}=t;this.set(e,s,r,i,o,n)}getBoundsFrom(t){const{top:e,right:s,bottom:r,left:i,width:o,height:n}=this;return new ht(i,e,o||t.width-i-s,n||t.height-e-r)}},exports.BezierHelper=ye,exports.Bounds=ht,exports.BoundsHelper=it,exports.BranchHelper=Ui,exports.BranchRender=Yo,exports.CanvasManager=class{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()}},exports.ChildEvent=lo,exports.Creator=e,exports.DataHelper=Lt,exports.Debug=xt,exports.EllipseHelper=Te,exports.Event=ho,exports.EventCreator=Pt,exports.FileHelper=ti,exports.ImageEvent=co,exports.ImageManager=oi,exports.IncrementId=s,exports.LayoutEvent=fo,exports.LeafBounds=Wo,exports.LeafBoundsHelper=ji,exports.LeafData=It,exports.LeafDataProxy=bo,exports.LeafEventer=no,exports.LeafHelper=Ei,exports.LeafLayout=io,exports.LeafLevelList=class{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(t instanceof Array?this.addList(t):this.add(t))}has(t){return void 0!==this.keys[t.innerId]}without(t){return void 0===this.keys[t.innerId]}sort(t){const{levels:e}=this;t?e.sort(((t,e)=>e-t)):e.sort(((t,e)=>t-e))}addList(t){t.forEach((t=>{this.add(t)}))}add(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach((s=>{e=this.levelMap[s];for(let s=0,r=e.length;s<r;s++)t(e[s])}))}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}},exports.LeafList=gn,exports.LeafMatrix=Po,exports.LeafRender=Do,exports.LeaferCanvasBase=class extends Xt{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 allowBackgroundColor(){return this.view&&this.parentView}constructor(e,r){super(),this.size={},this.worldTransform={},e||(e=Ft),e.pixelRatio||(e.pixelRatio=t.devicePixelRatio),this.manager=r,this.innerId=s.create(s.CNAVAS);const{width:i,height:o,pixelRatio:n}=e;this.autoLayout=!i||!o,this.size.pixelRatio=n,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){if(this.isSameSize(t))return;let e;this.context&&!this.unreal&&this.width&&(e=this.getSameCanvas(),e.copyWorld(this)),Lt.copyAttrs(this.size,t,jt),this.size.pixelRatio||(this.size.pixelRatio=1),this.bounds=new ht(0,0,this.width,this.height),this.unreal||(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&e&&(this.clearWorld(e.bounds),this.copyWorld(e),e.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}=this,r=this.worldTransform;if(e){const{a:i,b:o,c:n,d:a,e:h,f:l}=e;this.setTransform(r.a=(t.a*i+t.b*n)*s,r.b=(t.a*o+t.b*a)*s,r.c=(t.c*i+t.d*n)*s,r.d=(t.c*o+t.d*a)*s,r.e=(t.e*i+t.f*n+h)*s,r.f=(t.e*o+t.f*a+l)*s)}else this.setTransform(r.a=t.a*s,r.b=t.b*s,r.c=t.c*s,r.d=t.d*s,r.e=t.e*s,r.f=t.f*s)}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,it.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()}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,lt.set(t).scale(this.pixelRatio),this.fillRect(lt.x,lt.y,lt.width,lt.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,lt.set(t).scale(this.pixelRatio),this.strokeRect(lt.x,lt.y,lt.width,lt.height),s&&(this.blendMode="source-over")}clearWorld(t,e){lt.set(t).scale(this.pixelRatio),e&<.ceil(),this.clearRect(lt.x,lt.y,lt.width,lt.height)}clipWorld(t,e){this.beginPath(),lt.set(t).scale(this.pixelRatio),e&<.ceil(),this.rect(lt.x,lt.y,lt.width,lt.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}isSameSize(t){return this.width===t.width&&this.height===t.height&&this.pixelRatio===t.pixelRatio}getSameCanvas(t,s){const r=this.manager?this.manager.get(this.size):e.canvas(Object.assign({},this.size));return r.save(),t&&(zt(r.worldTransform,this.worldTransform),r.useWorldTransform()),s&&(r.smooth=this.smooth),r}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t,!0):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}},exports.LeaferEvent=xo,exports.LeaferImage=class{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){this.use=0,this.waitComplete=[],this.innerId=hi(ai),this.config=t||{url:""},this.isSVG=oi.isFormat("svg",t),this.hasOpacityPixel=oi.hasOpacityPixel(t)}load(e,s){return this.loading||(this.loading=!0,oi.tasker.add((()=>Et(this,void 0,void 0,(function*(){return yield t.origin.loadImage(this.url).then((t=>{this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)})).catch((t=>{this.error=t,this.onComplete(!1)}))}))))),this.waitComplete.push(e,s),this.waitComplete.length-2}unload(t,e){const s=this.waitComplete;if(e){const e=s[t+1];e&&e({type:"stop"})}s[t]=s[t+1]=void 0}onComplete(t){let e;this.waitComplete.forEach(((s,r)=>{e=r%2,s&&(t?e||s(this):e&&s(this.error))})),this.waitComplete.length=0,this.loading=!1}getCanvas(e,s,r,i){if(e||(e=this.width),s||(s=this.height),this.cache){let{params:t,data:e}=this.cache;for(let s in t)if(t[s]!==arguments[s]){e=null;break}if(e)return e}const o=t.origin.createCanvas(e,s),n=o.getContext("2d");return r&&(n.globalAlpha=r),n.drawImage(this.view,0,0,e,s),this.cache=this.use>1?{data:o,params:arguments}:null,o}getPattern(e,s,r,i){const o=t.canvas.createPattern(e,s);try{r&&o.setTransform&&(o.setTransform(r),r=null)}catch(t){}return i&&(i.transform=r),o}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}},exports.MathHelper=a,exports.Matrix=Y,exports.MatrixHelper=b,exports.NeedConvertToCanvasCommandMap=Vt,exports.OneRadian=h,exports.PI2=l,exports.PI_2=d,exports.PathBounds=jr,exports.PathCommandDataHelper=Ms,exports.PathCommandMap=Gt,exports.PathConvert=ds,exports.PathCorner=Zr,exports.PathCreator=Js,exports.PathDrawer=ur,exports.PathHelper=Ht,exports.PathNumberCommandLengthMap=$t,exports.PathNumberCommandMap=Zt,exports.Platform=t,exports.Point=D,exports.PointHelper=I,exports.PropertyEvent=uo,exports.RectHelper=Kt,exports.RenderEvent=yo,exports.ResizeEvent=po,exports.Run=vt,exports.StringNumberMap=yt,exports.TaskItem=ri,exports.TaskProcessor=ii,exports.TwoPointBoundsHelper=z,exports.UICreator=kt,exports.WaitHelper=Qi,exports.WatchEvent=_o,exports.affectRenderBoundsType=function(t){return ui(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))},exports.affectStrokeBoundsType=yi,exports.attr=ci,exports.autoLayoutType=function(t){return ui(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__hasAutoLayout=!!e,this.__local||this.__layout.createLocal())}})))},exports.boundsType=_i,exports.canvasPatch=function(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,r,i){Kr(this,t,e,s,r,i)})}(t)},exports.canvasSizeAttrs=jt,exports.cursorType=function(t){return ui(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}})))},exports.dataProcessor=function(t){return(e,s)=>{li(e,"__DataProcessor",{get:()=>t})}},exports.dataType=function(t){return ui(t)},exports.decorateLeafAttr=ui,exports.defineDataProcessor=wi,exports.defineKey=li,exports.defineLeafAttr=pi,exports.doBoundsType=fi,exports.doStrokeType=xi,exports.emptyData={},exports.eraserType=function(t){return ui(t,(t=>({set(e){this.__setAttr(t,e)&&this.waitParent((()=>{this.parent.__updateEraser(e)}))}})))},exports.getBoundsData=c,exports.getDescriptor=di,exports.getMatrixData=p,exports.getPointData=u,exports.hitType=function(t){return ui(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,xt.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}})))},exports.inviteCode={},exports.layoutProcessor=function(t){return(e,s)=>{li(e,"__LayoutProcessor",{get:()=>t})}},exports.maskType=function(t){return ui(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(e)})))}})))},exports.naturalBoundsType=function(t){return ui(t,(t=>({set(e){this.__setAttr(t,e)&&(fi(this),this.__.__removeNaturalSize())}})))},exports.opacityType=function(t){return ui(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange())}})))},exports.pathInputType=function(t){return ui(t,(t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),fi(this)}})))},exports.pathType=gi,exports.pen=$r,exports.positionType=function(t,e){return ui(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})))},exports.registerUI=function(){return t=>{kt.register(t)}},exports.registerUIEvent=function(){return t=>{Pt.register(t)}},exports.rewrite=function(t){return(e,s)=>{vi.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}},exports.rewriteAble=function(){return t=>{Ci()}},exports.rotationType=function(t,e){return ui(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}})))},exports.scaleType=function(t,e){return ui(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}})))},exports.sortType=function(t){return ui(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()})))}})))},exports.strokeType=mi,exports.surfaceType=function(t){return ui(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})))},exports.tempBounds=lt,exports.tempMatrix=X,exports.tempPoint=N,exports.useModule=ki,exports.version="1.0.0-rc.30",exports.visibleType=function(t){return ui(t,(t=>({set(e){const s=this.visible;this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange(),0!==s&&0!==e||fi(this))}})))};
|
package/package.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/core",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "@leafer/core",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
|
-
"main": "
|
|
8
|
+
"main": "lib/core.esm.js",
|
|
9
9
|
"exports": {
|
|
10
|
-
"import": "./
|
|
11
|
-
"require": "./
|
|
10
|
+
"import": "./lib/core.esm.js",
|
|
11
|
+
"require": "./lib/core.cjs",
|
|
12
12
|
"types": "./types/index.d.ts"
|
|
13
13
|
},
|
|
14
14
|
"types": "types/index.d.ts",
|
|
15
15
|
"files": [
|
|
16
16
|
"src",
|
|
17
17
|
"types",
|
|
18
|
-
"
|
|
18
|
+
"lib"
|
|
19
19
|
],
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|
|
@@ -29,25 +29,22 @@
|
|
|
29
29
|
"leaferjs"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@leafer/
|
|
33
|
-
"@leafer/
|
|
34
|
-
"@leafer/
|
|
35
|
-
"@leafer/
|
|
36
|
-
"@leafer/
|
|
37
|
-
"@leafer/
|
|
38
|
-
"@leafer/display": "1.0.0
|
|
39
|
-
"@leafer/
|
|
40
|
-
"@leafer/
|
|
41
|
-
"@leafer/
|
|
42
|
-
"@leafer/
|
|
43
|
-
"@leafer/
|
|
44
|
-
"@leafer/
|
|
45
|
-
"@leafer/
|
|
46
|
-
"@leafer/
|
|
47
|
-
"@leafer/
|
|
48
|
-
"@leafer/
|
|
49
|
-
"@leafer/plugin": "1.0.0-rc.9",
|
|
50
|
-
"@leafer/task": "1.0.0-rc.9",
|
|
51
|
-
"@leafer/interface": "1.0.0-rc.9"
|
|
32
|
+
"@leafer/canvas": "1.0.0",
|
|
33
|
+
"@leafer/image": "1.0.0",
|
|
34
|
+
"@leafer/data": "1.0.0",
|
|
35
|
+
"@leafer/debug": "1.0.0",
|
|
36
|
+
"@leafer/decorator": "1.0.0",
|
|
37
|
+
"@leafer/display": "1.0.0",
|
|
38
|
+
"@leafer/display-module": "1.0.0",
|
|
39
|
+
"@leafer/event": "1.0.0",
|
|
40
|
+
"@leafer/file": "1.0.0",
|
|
41
|
+
"@leafer/helper": "1.0.0",
|
|
42
|
+
"@leafer/layout": "1.0.0",
|
|
43
|
+
"@leafer/list": "1.0.0",
|
|
44
|
+
"@leafer/math": "1.0.0",
|
|
45
|
+
"@leafer/path": "1.0.0",
|
|
46
|
+
"@leafer/platform": "1.0.0",
|
|
47
|
+
"@leafer/task": "1.0.0",
|
|
48
|
+
"@leafer/interface": "1.0.0"
|
|
52
49
|
}
|
|
53
50
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { IObject } from '@leafer/interface'
|
|
2
|
+
|
|
1
3
|
export * from '@leafer/canvas'
|
|
2
4
|
export * from '@leafer/image'
|
|
3
|
-
export * from '@leafer/interaction'
|
|
4
5
|
|
|
5
6
|
export * from '@leafer/data'
|
|
6
7
|
export * from '@leafer/debug'
|
|
@@ -9,7 +10,6 @@ export * from '@leafer/display'
|
|
|
9
10
|
export * from '@leafer/display-module'
|
|
10
11
|
|
|
11
12
|
export * from '@leafer/event'
|
|
12
|
-
export * from '@leafer/event-ui'
|
|
13
13
|
|
|
14
14
|
export * from '@leafer/file'
|
|
15
15
|
export * from '@leafer/helper'
|
|
@@ -19,6 +19,8 @@ export * from '@leafer/math'
|
|
|
19
19
|
|
|
20
20
|
export * from '@leafer/path'
|
|
21
21
|
export * from '@leafer/platform'
|
|
22
|
-
export * from '@leafer/plugin'
|
|
23
22
|
|
|
24
|
-
export * from '@leafer/task'
|
|
23
|
+
export * from '@leafer/task'
|
|
24
|
+
|
|
25
|
+
export const version = "1.0.0"
|
|
26
|
+
export const inviteCode: IObject = {}
|
package/types/index.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
+
import { IObject } from '@leafer/interface';
|
|
1
2
|
export * from '@leafer/canvas';
|
|
2
3
|
export * from '@leafer/image';
|
|
3
|
-
export * from '@leafer/interaction';
|
|
4
4
|
export * from '@leafer/data';
|
|
5
5
|
export * from '@leafer/debug';
|
|
6
6
|
export * from '@leafer/decorator';
|
|
7
7
|
export * from '@leafer/display';
|
|
8
8
|
export * from '@leafer/display-module';
|
|
9
9
|
export * from '@leafer/event';
|
|
10
|
-
export * from '@leafer/event-ui';
|
|
11
10
|
export * from '@leafer/file';
|
|
12
11
|
export * from '@leafer/helper';
|
|
13
12
|
export * from '@leafer/layout';
|
|
@@ -15,5 +14,9 @@ export * from '@leafer/list';
|
|
|
15
14
|
export * from '@leafer/math';
|
|
16
15
|
export * from '@leafer/path';
|
|
17
16
|
export * from '@leafer/platform';
|
|
18
|
-
export * from '@leafer/plugin';
|
|
19
17
|
export * from '@leafer/task';
|
|
18
|
+
|
|
19
|
+
declare const version = "1.0.0-rc.30";
|
|
20
|
+
declare const inviteCode: IObject;
|
|
21
|
+
|
|
22
|
+
export { inviteCode, version };
|