@leafer/core 1.0.0-rc.1 → 1.0.0-rc.10

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.
@@ -0,0 +1 @@
1
+ const t={image:{maxCacheSize:4096e3,maxPatternSize:8847360,suffix:"leaf",crossOrigin:"anonymous"}},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)=>(t<e&&(t=e),t>s&&(t=s),t),fourNumber(t,e){let s;if(t instanceof Array)switch(t.length){case 4:s=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 _(){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,o=0,n=0){t.a=e,t.b=s,t.c=r,t.d=i,t.e=o,t.f=n},get:_,getWorld:w,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},scaleOfOuter(t,e,s,r){B.toInnerPoint(t,e,x),B.scaleOfInner(t,x,s,r)},scaleOfInner(t,e,s,r=s){B.translateInner(t,e.x,e.y),B.scale(t,s,r),B.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:r,c:i,d:o}=t,n=f(e*=h),a=p(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){B.toInnerPoint(t,e,x),B.rotateOfInner(t,x,s)},rotateOfInner(t,e,s){B.translateInner(t,e.x,e.y),B.rotate(t,s),B.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a: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){B.toInnerPoint(t,e,x),B.skewOfInner(t,x,s,r)},skewOfInner(t,e,s,r=0){B.translateInner(t,e.x,e.y),B.skew(t,s,r),B.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:r,c:i,d: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){const{e:o,f:n}=t;if(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=o*e.a+n*e.c+e.e,s.f=o*e.b+n*e.d+e.f},divide(t,e){B.multiply(t,B.tempInvert(e))},divideParent(t,e){B.multiplyParent(t,B.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=B;return B.copy(e,t),B.invert(e),e},invert(t){const{a:e,b:s,c:r,d:i,e: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=p(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&&B.translateInner(t,-s.x,-s.y)},getLayout(t,e,s){const{a:r,b:i,c:o,d:n,e:a,f:l}=t;let u,c,_,x,w,b=a,B=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;_=i>0?g(e):-g(e)}else{c=y(o*o+n*n),u=t/c;const e=o/c;_=d-(n>0?g(-e):-g(e))}const e=m(f(_)),a=p(_);u=m(u),c=m(c),x=e?m((o/c+a)/e/h,9):0,w=e?m((i/u-a)/e/h,9):0,_=m(_/h)}else u=r,c=n,_=x=w=0;return e&&(b+=e.x*r+e.y*o,B+=e.x*i+e.y*n),{x:b,y:B,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: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){B.set(t)}},B=b,{toInnerPoint:v,toOuterPoint:k}=b,{sin:C,cos:O,abs:T,sqrt:P,atan2:R,min:S,PI:L}=Math,A={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},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=I.defaultPoint);const r=O(e*=h),i=C(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}=I;return I.copy(s,t),v(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=I;return I.copy(s,t),k(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=I;return I.copy(s,t),I.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),v(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){v(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)=>I.getDistanceFrom(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,r){const i=T(s-t),o=T(r-e);return P(i*i+o*o)},getMinDistanceFrom:(t,e,s,r,i,o)=>S(I.getDistanceFrom(t,e,s,r),I.getDistanceFrom(s,r,i,o)),getAngle:(t,e)=>I.getAtan2(t,e)/h,getRotation:(t,e,s,r)=>(r||(r=e),I.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<-L?d+l:d},getAtan2:(t,e)=>R(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s){const r=I.getAtan2(t,e);return{x:t.x+O(r)*s,y:t.y+C(r)*s}},reset(t){I.reset(t)}},I=A;class M{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?A.copy(this,t):A.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new M(this)}move(t,e){return A.move(this,t,e),this}scale(t,e){return A.scale(this,t,e),this}scaleOf(t,e,s){return A.scaleOf(this,t,e,s),this}rotate(t,e){return A.rotate(this,t,e),this}rotateOf(t,e){return A.rotate(this,e,t),this}getRotation(t,e,s){return A.getRotation(this,t,e,s)}toInnerOf(t,e){return A.toInnerOf(this,t,e),this}toOuterOf(t,e){return A.toOuterOf(this,t,e),this}getCenter(t){return new M(A.getCenter(this,t))}getDistance(t){return A.getDistance(this,t)}getDistancePoint(t,e){return new M(A.getDistancePoint(this,t,e))}getAngle(t){return A.getAngle(this,t)}getAtan2(t){return A.getAtan2(this,t)}reset(){return A.reset(this),this}}class E{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}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 E(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}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}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 W={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){D(t,e,s),D(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:D}=W,{tempPointBounds:N,setPoint:Y,addPoint:X,toBounds:z}=W,{toOuterPoint:F}=b,{float:j}=a,{floor:U,ceil:q}=Math;let G,H,V,Q;const Z={},J={},$={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){r||(r=s),K.set(t,e.x-s,e.y-r,e.width+2*s,e.height+2*r)},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),K.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?et(e,t):e=t,s?(e.offsetX=-(K.maxX(s)-t.x),e.offsetY=-(K.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),K.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e){A.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,r=s){A.scaleOf(t,e,s,r),t.width*=s,t.height*=r},tempToOuterOf:(t,e)=>(K.copy(K.tempBounds,t),K.toOuterOf(K.tempBounds,e),K.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),K.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 Z.x=t.x,Z.y=t.y,F(e,Z,J),Y(N,J.x,J.y),Z.x=t.x+t.width,F(e,Z,J),X(N,J.x,J.y),Z.y=t.y+t.height,F(e,Z,J),X(N,J.x,J.y),Z.x=t.x,F(e,Z,J),X(N,J.x,J.y),z(N,s)},toInnerOf(t,e,s){s||(s=t),K.move(s,-e.e,-e.f),K.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e){const s=Math.min(1,Math.min(t.width/e.width,t.height/e.height));return new E(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e,s){const r={};return K.copyAndSpread(r,t,e,s),r},spread(t,e,s=e){K.copyAndSpread(t,t,e,s)},ceil(t){const{x:e,y:s}=t;t.x=U(t.x),t.y=U(t.y),t.width=e>t.x?q(t.width+e-t.x):q(t.width),t.height=s>t.y?q(t.height+s-t.y):q(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=j(t.x,e),t.y=j(t.y,e),t.width=j(t.width,e),t.height=j(t.height,e)},add(t,e){G=t.x+t.width,H=t.y+t.height,V=e.x+e.width,Q=e.y+e.height,G=G>V?G:V,H=H>Q?H:Q,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=G-t.x,t.height=H-t.y},addList(t,e){K.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){K.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){K.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||et(t,i)):tt(t,i));o&&K.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?Y(N,t.x,t.y):X(N,t.x,t.y))),z(N,t)},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=A.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=A.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=K.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=K.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=K.tempToOuterOf(e,s)),!K.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:r,y:i,width:o,height:n}=e;return G=r+o,H=i+n,V=t.x+t.width,Q=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,G=G<V?G:V,H=H<Q?H:Q,o=G-r,n=H-i,{x:r,y:i,width:o,height:n}},intersect(t,e,s){K.copy(t,K.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){K.set(t)}},K=$,{add:tt,copy:et}=K;class st{get minX(){return $.minX(this)}get minY(){return $.minY(this)}get maxX(){return $.maxX(this)}get maxY(){return $.maxY(this)}constructor(t,e,s,r){this.set(t,e,s,r)}set(t,e,s,r){return"object"==typeof t?$.copy(this,t):$.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 st(this)}move(t,e){return $.move(this,t,e),this}scale(t,e){return $.scale(this,t,e),this}scaleOf(t,e,s){return $.scaleOf(this,t,e,s),this}toOuterOf(t,e){return $.toOuterOf(this,t,e),this}toInnerOf(t,e){return $.toInnerOf(this,t,e),this}getFitMatrix(t){return $.getFitMatrix(this,t)}spread(t,e){return $.spread(this,t,e),this}ceil(){return $.ceil(this),this}unsign(){return $.unsign(this),this}float(t){return $.float(this,t),this}add(t){return $.add(this,t),this}addList(t){return $.setList(this,t,!0),this}setList(t){return $.setList(this,t),this}addListWithFn(t,e){return $.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return $.setListWithFn(this,t,e),this}setPoints(t){return $.setPoints(this,t),this}getPoints(){return $.getPoints(this)}hitPoint(t,e){return $.hitPoint(this,t,e)}hitRadiusPoint(t,e){return $.hitRadiusPoint(this,t,e)}hit(t,e){return $.hit(this,t,e)}includes(t,e){return $.includes(this,t,e)}intersect(t,e){return $.intersect(this,t,e),this}getIntersect(t,e){return new st($.getIntersectData(this,t,e))}isSame(t){return $.isSame(this,t)}isEmpty(){return $.isEmpty(this)}reset(){$.reset(this)}}class rt{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 st(i,e,o||t.width-i-s,n||t.height-e-r)}}var it,ot;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(it||(it={})),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"}(ot||(ot={}));const nt=[{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}],at={directionData:nt,tempPoint:{},get:ht,toPoint(t,e,s,r){s||(s={});const i=ht(t);s.x=i.x*e.width,s.y=i.y*e.height,r||(s.x+=e.x,s.y+=e.y)}};function ht(t){return"string"==typeof t?nt[ot[t]]:t}const lt={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 dt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new dt(t)}static set filter(t){this.filterList=ut(t)}static set exclude(t){this.excludeList=ut(t)}log(...t){if(ct.enable){if(ct.filterList.length&&ct.filterList.every((t=>t!==this.name)))return;if(ct.excludeList.length&&ct.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){ct.enable&&this.warn(...t)}warn(...t){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 ut(t){return t?"string"==typeof t&&(t=[t]):t=[],t}dt.filterList=[],dt.excludeList=[];const ct=dt,_t=dt.get("RunTime"),pt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const r=s.create(s.RUNTIME);return ft.currentId=ft.idMap[r]=e?performance.now():Date.now(),ft.currentName=ft.nameMap[r]=t,ft.nameToIdMap[t]=r,r},end(t,e){const s=ft.idMap[t],r=ft.nameMap[t],i=e?(performance.now()-s)/1e3:Date.now()-s;ft.idMap[t]=ft.nameMap[t]=ft.nameToIdMap[r]=void 0,_t.log(r,i,"ms")},endOfName(t,e){const s=ft.nameToIdMap[t];void 0!==s&&ft.end(s,e)}},ft=pt,gt=dt.get("UICreator"),yt={list:{},register(t){const{__tag:e}=t.prototype;mt[e]?gt.repeat(e):mt[e]=t},get(t,e,s,r,i,o){const n=new mt[t](e);return void 0!==s&&(n.x=s,r&&(n.y=r),i&&(n.width=i),o&&(n.height=o)),n}},{list:mt}=yt,xt=dt.get("EventCreator"),wt={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(bt[e]?xt.repeat(e):bt[e]=t)}))},changeName(t,e){const s=bt[t];if(s){const r=Object.keys(s).find((e=>s[e]===t));r&&(s[r]=e,bt[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new bt[t](...e)},{nameList:bt}=wt;class Bt{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 vt={default:(t,e)=>(kt(e,t),kt(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?kt(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))},{assign:kt}=vt;class Ct{get __blendMode(){if(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}return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s,r;for(let i in this)"_"!==i[0]&&(s=this["_"+i],void 0!==s&&(r=e?e[i]:void 0,t[i]=void 0===r?s:r));return t}__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}destroy(){this.__input=this.__middle=null}}var Ot;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(Ot||(Ot={}));const Tt={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=Pt.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{}}}},Pt=Tt;function Rt(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 St(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 Lt(t){return(e,s)=>{t||(t=s),Object.defineProperty(e,s,{get(){return this.context[t]},set(e){this.context[t]=e}})}}Pt.opacityTypes.forEach((t=>Pt.upperCaseTypeMap[t]=t.toUpperCase())),"function"==typeof SuppressedError&&SuppressedError;const At=[];function It(){return(t,e)=>{At.push(e)}}const Mt=[];class Et{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||Mt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;At.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}}Rt([Lt("imageSmoothingEnabled")],Et.prototype,"smooth",void 0),Rt([Lt("imageSmoothingQuality")],Et.prototype,"smoothLevel",void 0),Rt([Lt("globalAlpha")],Et.prototype,"opacity",void 0),Rt([Lt()],Et.prototype,"fillStyle",void 0),Rt([Lt()],Et.prototype,"strokeStyle",void 0),Rt([Lt("lineWidth")],Et.prototype,"strokeWidth",void 0),Rt([Lt("lineCap")],Et.prototype,"strokeCap",void 0),Rt([Lt("lineJoin")],Et.prototype,"strokeJoin",void 0),Rt([Lt("lineDashOffset")],Et.prototype,"dashOffset",void 0),Rt([Lt()],Et.prototype,"miterLimit",void 0),Rt([Lt()],Et.prototype,"shadowBlur",void 0),Rt([Lt()],Et.prototype,"shadowColor",void 0),Rt([Lt()],Et.prototype,"shadowOffsetX",void 0),Rt([Lt()],Et.prototype,"shadowOffsetY",void 0),Rt([Lt()],Et.prototype,"filter",void 0),Rt([Lt()],Et.prototype,"font",void 0),Rt([Lt()],Et.prototype,"fontKerning",void 0),Rt([Lt()],Et.prototype,"fontStretch",void 0),Rt([Lt()],Et.prototype,"fontVariantCaps",void 0),Rt([Lt()],Et.prototype,"textAlign",void 0),Rt([Lt()],Et.prototype,"textBaseline",void 0),Rt([Lt()],Et.prototype,"textRendering",void 0),Rt([Lt()],Et.prototype,"wordSpacing",void 0),Rt([Lt()],Et.prototype,"letterSpacing",void 0),Rt([Lt()],Et.prototype,"direction",void 0),Rt([It()],Et.prototype,"setTransform",null),Rt([It()],Et.prototype,"resetTransform",null),Rt([It()],Et.prototype,"getTransform",null),Rt([It()],Et.prototype,"save",null),Rt([It()],Et.prototype,"restore",null),Rt([It()],Et.prototype,"translate",null),Rt([It()],Et.prototype,"scale",null),Rt([It()],Et.prototype,"rotate",null),Rt([It()],Et.prototype,"fill",null),Rt([It()],Et.prototype,"stroke",null),Rt([It()],Et.prototype,"clip",null),Rt([It()],Et.prototype,"fillRect",null),Rt([It()],Et.prototype,"strokeRect",null),Rt([It()],Et.prototype,"clearRect",null),Rt([It()],Et.prototype,"beginPath",null),Rt([It()],Et.prototype,"moveTo",null),Rt([It()],Et.prototype,"lineTo",null),Rt([It()],Et.prototype,"bezierCurveTo",null),Rt([It()],Et.prototype,"quadraticCurveTo",null),Rt([It()],Et.prototype,"closePath",null),Rt([It()],Et.prototype,"arc",null),Rt([It()],Et.prototype,"arcTo",null),Rt([It()],Et.prototype,"ellipse",null),Rt([It()],Et.prototype,"rect",null),Rt([It()],Et.prototype,"roundRect",null),Rt([It()],Et.prototype,"createConicGradient",null),Rt([It()],Et.prototype,"createLinearGradient",null),Rt([It()],Et.prototype,"createPattern",null),Rt([It()],Et.prototype,"createRadialGradient",null),Rt([It()],Et.prototype,"fillText",null),Rt([It()],Et.prototype,"measureText",null),Rt([It()],Et.prototype,"strokeText",null);const{copy:Wt}=b,Dt=new st,Nt={width:1,height:1,pixelRatio:1},Yt=dt.get("LeaferCanvasBase"),Xt=["width","height","pixelRatio"];class zt extends Et{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=Nt),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(){this.context=this.view.getContext("2d"),this.__bindContext()}export(t,e){const{quality:s,blob:r}=Tt.getExportOptions(e);return t.includes(".")?this.saveAs(t,s):r?this.toBlob(t,s):this.toDataURL(t,s)}toBlob(e,s){return new Promise((r=>{t.origin.canvasToBolb(this.view,e,s).then((t=>{r(t)})).catch((t=>{Yt.error(t),r(null)}))}))}toDataURL(e,s){return t.origin.canvasToDataURL(this.view,e,s)}saveAs(e,s){return new Promise((r=>{t.origin.canvasSaveAs(this.view,e,s).then((()=>{r(!0)})).catch((t=>{Yt.error(t),r(!1)}))}))}resize(t){if(this.isSameSize(t))return;let e;this.context&&!this.unreal&&this.width&&(e=this.getSameCanvas(),e.copyWorld(this)),vt.copyAttrs(this.size,t,Xt),this.size.pixelRatio||(this.size.pixelRatio=1),this.bounds=new st(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(){}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=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 e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)}hitStroke(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)}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,$.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,Dt.set(t).scale(this.pixelRatio),this.fillRect(Dt.x,Dt.y,Dt.width,Dt.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,Dt.set(t).scale(this.pixelRatio),this.strokeRect(Dt.x,Dt.y,Dt.width,Dt.height),s&&(this.blendMode="source-over")}clearWorld(t,e){Dt.set(t).scale(this.pixelRatio),e&&Dt.ceil(),this.clearRect(Dt.x,Dt.y,Dt.width,Dt.height)}clipWorld(t,e){this.beginPath(),Dt.set(t).scale(this.pixelRatio),e&&Dt.ceil(),this.rect(Dt.x,Dt.y,Dt.width,Dt.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t,this.height*t)}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&&(Wt(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 Ft={creator:{},parse(t,e){},convertToCanvasData(t,e){}},jt={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Ut=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},jt),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},Gt={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},Ht=Object.assign(Object.assign({},Gt),jt),Vt=Ut,Qt={};for(let t in Vt)Qt[Vt[t]]=t;const Zt={};for(let t in Vt)Zt[Vt[t]]=qt[t];const Jt={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:$t,cos:Kt,atan2:te,ceil:ee,abs:se,PI:re,sqrt:ie,pow:oe}=Math,{setPoint:ne,addPoint:ae}=W,{set:he}=A,{M:le,L:de,C:ue,Q:ce,Z:_e}=Ut,pe={},fe={points(t,e,s,r){if(t.push(le,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 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],o=e[s-1],n=e[s],a=e[s+1],h=e[s+2],l=e[s+3],p=ie(oe(n-i,2)+oe(a-o,2)),f=ie(oe(h-n,2)+oe(l-a,2)),g=p+f,p=m*p/g,f=m*f/g,h-=i,l-=o,d=n-p*h,u=a-p*l,2===s?r||t.push(ce,d,u,n,a):t.push(ue,c,_,d,u,n,a),c=n+f*h,_=a+f*l;r||t.push(ce,c,_,e[y-2],e[y-1])}else for(let s=2,r=e.length;s<r;s+=2)t.push(de,e[s],e[s+1]);r&&t.push(_e)},rect(t,e,s,r,i){Ft.creator.path=t,Ft.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){Ft.creator.path=[],Jt.drawRoundRect(Ft.creator,e,s,r,i,o),t.push(...Ft.convertToCanvasData(Ft.creator.path,!0))},arcTo(t,e,s,r,i,o,n,a,u,c,_){const p=r-e,f=i-s,g=o-r,y=n-i;let m=te(f,p),x=te(y,g),w=x-m;if(w<0&&(w+=l),w===re||se(p+f)<1e-12||se(g+y)<1e-12)return t&&t.push(de,r,i),u&&(ne(u,e,s),ae(u,r,i)),_&&he(_,e,s),void(c&&he(c,r,i));const b=p*y-g*f<0,B=b?-1:1,v=a/Kt(w/2),k=r+v*Kt(m+w/2+d*B),C=i+v*$t(m+w/2+d*B);return m-=d*B,x-=d*B,me(t,k,C,a,a,0,m/h,x/h,b,u,c,_)},arc:(t,e,s,r,i,o,n,a,h,l)=>me(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=$t(f),y=Kt(f);let m=n*h,x=a*h;m>re&&(m-=l),x<0&&(x+=l);let w=x-m;w<0?w+=l:w>l&&(w-=l),u&&(w-=l);const b=ee(se(w/d)),B=w/b,v=$t(B/4),k=8/3*v*v/$t(B/2);x=m+B;let C,O,T,P,R,S,L,A,I=Kt(m),M=$t(m),E=T=y*r*I-g*i*M,W=P=g*r*I+y*i*M,D=e+T,N=s+P;t&&t.push(de,D,N),c&&ne(c,D,N),p&&he(p,D,N);for(let o=0;o<b;o++)C=Kt(x),O=$t(x),T=y*r*C-g*i*O,P=g*r*C+y*i*O,R=e+E-k*(y*r*M+g*i*I),S=s+W-k*(g*r*M-y*i*I),L=e+T+k*(y*r*O+g*i*C),A=s+P+k*(g*r*O-y*i*C),t&&t.push(ue,R,S,L,A,e+T,s+P),c&&ye(e+E,s+W,R,S,L,A,e+T,s+P,c,!0),E=T,W=P,I=C,M=O,m=x,x+=B;_&&he(_,e+T,s+P)},quadraticCurveTo(t,e,s,r,i,o,n){t.push(ue,(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){ye(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,m,x=t,w=s,b=i,B=n;for(let t=0;t<2;++t)if(1==t&&(x=e,w=r,b=o,B=a),u=-3*x+9*w-9*b+3*B,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?ae(h,t,e):ne(h,t,e),ae(h,n,a);for(let l=0,u=d.length;l<u;l++)ge(d[l],t,e,s,r,i,o,n,a,pe),ae(h,pe.x,pe.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,_=3*d*t*t,p=t*t*t;l.x=u*e+c*r+_*o+p*a,l.y=u*s+c*i+_*n+p*h},getPoint(t,e,s,r,i,o,n,a,h){const l={};return ge(t,e,s,r,i,o,n,a,h,l),l}},{getPointAndSet:ge,toTwoPointBounds:ye,ellipse:me}=fe,{sin:xe,cos:we,sqrt:be,atan2:Be}=Math,{ellipse:ve}=fe,ke={ellipticalArc(e,s,r,i,o,n,a,d,u,c,_){const p=(u-s)/2,f=(c-r)/2,g=n*h,y=xe(g),m=we(g),x=-m*p-y*f,w=-m*f+y*p,b=i*i,B=o*o,v=w*w,k=x*x,C=b*B-b*v-B*k;let O=0;if(C<0){const t=be(1-C/(b*B));i*=t,o*=t}else O=(a===d?-1:1)*be(C/(b*v+B*k));const T=O*i*w/o,P=-O*o*x/i,R=Be((w-P)/o,(x-T)/i),S=Be((-w-P)/o,(-x-T)/i);let L=S-R;0===d&&L>0?L-=l:1===d&&L<0&&(L+=l);const A=s+p+m*T-y*P,I=r+f+y*T+m*P,M=L<0?1:0;_||t.ellipseToCurve?ve(e,A,I,i,o,n,R/h,S/h,M):i!==o||n?e.push(Ut.G,A,I,i,o,n,R/h,S/h,M):e.push(Ut.O,A,I,i,R/h,S/h,M)}},{M:Ce,m:Oe,L:Te,l:Pe,H:Re,h:Se,V:Le,v:Ae,C:Ie,c:Me,S:Ee,s:We,Q:De,q:Ne,T:Ye,t:Xe,A:ze,a:Fe,Z:je,z:Ue,N:qe,D:Ge,X:He,G:Ve,F:Qe,O:Ze,P:Je,U:$e}=Ut,{rect:Ke,roundRect:ts,arcTo:es,arc:ss,ellipse:rs,quadraticCurveTo:is}=fe,{ellipticalArc:os}=ke,ns=dt.get("PathConvert"),as={},hs={current:{dot:0},stringify(t,e){let s,r,i,o=0,n=t.length,h="";for(;o<n;){r=t[o],s=Zt[r],h+=r===i?" ":Qt[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?Ht:Gt;for(let e=0,h=t.length;e<h;e++)r=t[e],lt[r]?("."===r&&(ls.dot++,ls.dot>1&&(ds(n,o),o="")),o+=r):Ut[r]?(o&&(ds(n,o),o=""),ls.name=Ut[r],ls.length=qt[r],ls.index=0,ds(n,ls.name),!s&&a[r]&&(s=!0)):"-"===r||"+"===r?"e"===i||"E"===i?o+=r:(o&&ds(n,o),o=r):o&&(ds(n,o),o=""),i=r;return o&&ds(n,o),s?hs.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 _=[];for(;u<c;){switch(i=t[u],i){case Oe:t[u+1]+=a,t[u+2]+=h;case Ce:a=t[u+1],h=t[u+2],_.push(Ce,a,h),u+=3;break;case Se:t[u+1]+=a;case Re:a=t[u+1],_.push(Te,a,h),u+=2;break;case Ae:t[u+1]+=h;case Le:h=t[u+1],_.push(Te,a,h),u+=2;break;case Pe:t[u+1]+=a,t[u+2]+=h;case Te:a=t[u+1],h=t[u+2],_.push(Te,a,h),u+=3;break;case We:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=Ee;case Ee:n=o===Ie||o===Ee,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],_.push(Ie,l,d,s,r,a,h),u+=5;break;case Me: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=Ie;case Ie:s=t[u+3],r=t[u+4],a=t[u+5],h=t[u+6],_.push(Ie,t[u+1],t[u+2],s,r,a,h),u+=7;break;case Xe:t[u+1]+=a,t[u+2]+=h,i=Ye;case Ye:n=o===De||o===Ye,s=n?2*a-s:t[u+1],r=n?2*h-r:t[u+2],e?is(_,a,h,s,r,t[u+1],t[u+2]):_.push(De,s,r,t[u+1],t[u+2]),a=t[u+1],h=t[u+2],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:s=t[u+1],r=t[u+2],e?is(_,a,h,s,r,t[u+3],t[u+4]):_.push(De,s,r,t[u+3],t[u+4]),a=t[u+3],h=t[u+4],u+=5;break;case Fe:t[u+6]+=a,t[u+7]+=h;case ze:os(_,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 Ue:case je:_.push(je),u++;break;case qe:a=t[u+1],h=t[u+2],e?Ke(_,a,h,t[u+3],t[u+4]):us(_,t,u,5),u+=5;break;case Ge:a=t[u+1],h=t[u+2],e?ts(_,a,h,t[u+3],t[u+4],[t[u+5],t[u+6],t[u+7],t[u+8]]):us(_,t,u,9),u+=9;break;case He:a=t[u+1],h=t[u+2],e?ts(_,a,h,t[u+3],t[u+4],t[u+5]):us(_,t,u,6),u+=6;break;case Ve:rs(e?_:us(_,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,as),a=as.x,h=as.y,u+=9;break;case Qe:e?rs(_,t[u+1],t[u+2],t[u+3],t[u+4],0,0,360,!1):us(_,t,u,5),a=t[u+1]+t[u+3],h=t[u+2],u+=5;break;case Ze:ss(e?_:us(_,t,u,7),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],null,as),a=as.x,h=as.y,u+=7;break;case Je:e?ss(_,t[u+1],t[u+2],t[u+3],0,360,!1):us(_,t,u,4),a=t[u+1]+t[u+3],h=t[u+2],u+=4;break;case $e:es(e?_:us(_,t,u,6),a,h,t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],null,as),a=as.x,h=as.y,u+=6;break;default:return ns.error(`command: ${i} [index:${u}]`,t),_}o=i}return _},copyData(t,e,s,r){for(let i=s,o=s+r;i<o;i++)t.push(e[i])},pushData(t,e){ls.index===ls.length&&(ls.index=1,t.push(ls.name)),t.push(Number(e)),ls.index++,ls.dot=0}},{current:ls,pushData:ds,copyData:us}=hs,{M:cs,L:_s,C:ps,Q:fs,Z:gs,N:ys,D:ms,X:xs,G:ws,F:bs,O:Bs,P:vs,U:ks}=Ut,{getMinDistanceFrom:Cs,getRadianFrom:Os}=A,{tan:Ts,min:Ps,abs:Rs}=Math,Ss={},Ls={beginPath(t){t.length=0},moveTo(t,e,s){t.push(cs,e,s)},lineTo(t,e,s){t.push(_s,e,s)},bezierCurveTo(t,e,s,r,i,o,n){t.push(ps,e,s,r,i,o,n)},quadraticCurveTo(t,e,s,r,i){t.push(fs,e,s,r,i)},closePath(t){t.push(gs)},rect(t,e,s,r,i){t.push(ys,e,s,r,i)},roundRect(t,e,s,r,i,o){if("number"==typeof o)t.push(xs,e,s,r,i,o);else{const n=a.fourNumber(o);n?t.push(ms,e,s,r,i,...n):t.push(ys,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(ws,e,s,r,i,o,n,a,h?1:0))},arc(t,e,s,r,i,o,n){void 0===i?t.push(vs,e,s,r):(void 0===o&&(o=360),t.push(Bs,e,s,r,i,o,n?1:0))},arcTo(t,e,s,r,i,o,n,a){if(void 0!==n){const h=Ts(Os(n,a,e,s,r,i)/2)*(Cs(n,a,e,s,r,i)/2);t.push(ks,e,s,r,i,Ps(o,Rs(h)))}else t.push(ks,e,s,r,i,o)},drawEllipse(t,e,s,r,i,o,n,a,h){void 0===o&&(o=0),void 0===n&&(n=0),void 0===a&&(a=360),fe.ellipse(null,e,s,r,i,o,n,a,h,null,null,Ss),t.push(cs,Ss.x,Ss.y),As(t,e,s,r,i,o,n,a,h)},drawArc(t,e,s,r,i,o,n){void 0===i&&(i=0),void 0===o&&(o=360),fe.arc(null,e,s,r,i,o,n,null,null,Ss),t.push(cs,Ss.x,Ss.y),Is(t,e,s,r,i,o,n)},drawPoints(t,e,s,r){fe.points(t,e,s,r)}},{ellipse:As,arc:Is}=Ls,{moveTo:Ms,lineTo:Es,quadraticCurveTo:Ws,bezierCurveTo:Ds,closePath:Ns,beginPath:Ys,rect:Xs,roundRect:zs,ellipse:Fs,arc:js,arcTo:Us,drawEllipse:qs,drawArc:Gs,drawPoints:Hs}=Ls;class Vs{constructor(t){this.path=t?"string"==typeof t?Ft.parse(t):t:[]}beginPath(){return Ys(this.path),this}moveTo(t,e){return Ms(this.path,t,e),this}lineTo(t,e){return Es(this.path,t,e),this}bezierCurveTo(t,e,s,r,i,o){return Ds(this.path,t,e,s,r,i,o),this}quadraticCurveTo(t,e,s,r){return Ws(this.path,t,e,s,r),this}closePath(){return Ns(this.path),this}rect(t,e,s,r){return Xs(this.path,t,e,s,r),this}roundRect(t,e,s,r,i){return zs(this.path,t,e,s,r,i),this}ellipse(t,e,s,r,i,o,n,a){return Fs(this.path,t,e,s,r,i,o,n,a),this}arc(t,e,s,r,i,o){return js(this.path,t,e,s,r,i,o),this}arcTo(t,e,s,r,i){return Us(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 Gs(this.path,t,e,s,r,i,o),this}drawPoints(t,e,s){return Hs(this.path,t,e,s),this}}const{M:Qs,L:Zs,C:Js,Q:$s,Z:Ks,N:tr,D:er,X:sr,G:rr,F:ir,O:or,P:nr,U:ar}=Ut,hr=dt.get("PathDrawer"),lr={drawPathByData(t,e){if(!e)return;let s,r=0,i=e.length;for(;r<i;)switch(s=e[r],s){case Qs:t.moveTo(e[r+1],e[r+2]),r+=3;break;case Zs:t.lineTo(e[r+1],e[r+2]),r+=3;break;case Js:t.bezierCurveTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5],e[r+6]),r+=7;break;case $s:t.quadraticCurveTo(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case Ks:t.closePath(),r+=1;break;case tr:t.rect(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case er: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 sr:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;case rr: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 ir:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,l,!1),r+=5;break;case or: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 nr:t.arc(e[r+1],e[r+2],e[r+3],0,l,!1),r+=4;break;case ar:t.arcTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;default:return void hr.error(`command: ${s} [index:${r}]`,e)}}},{M:dr,L:ur,C:cr,Q:_r,Z:pr,N:fr,D:gr,X:yr,G:mr,F:xr,O:wr,P:br,U:Br}=Ut,{toTwoPointBounds:vr,toTwoPointBoundsByQuadraticCurve:kr,arcTo:Cr,arc:Or,ellipse:Tr}=fe,{addPointBounds:Pr,copy:Rr,addPoint:Sr,setPoint:Lr,addBounds:Ar,toBounds:Ir}=W,Mr=dt.get("PathBounds");let Er,Wr,Dr;const Nr={},Yr={},Xr={},zr={toBounds(t,e){zr.toTwoPointBounds(t,Yr),Ir(Yr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Lr(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===pr||s===cr||s===_r?Lr(e,h,l):Lr(e,t[a+1],t[a+2])),s){case dr:case ur:h=t[a+1],l=t[a+2],Sr(e,h,l),a+=3;break;case cr:o=t[a+5],n=t[a+6],vr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],o,n,Nr),Pr(e,Nr),h=o,l=n,a+=7;break;case _r:r=t[a+1],i=t[a+2],o=t[a+3],n=t[a+4],kr(h,l,r,i,o,n,Nr),Pr(e,Nr),h=o,l=n,a+=5;break;case pr:a+=1;break;case fr:h=t[a+1],l=t[a+2],Ar(e,h,l,t[a+3],t[a+4]),a+=5;break;case gr:case yr:h=t[a+1],l=t[a+2],Ar(e,h,l,t[a+3],t[a+4]),a+=s===gr?9:6;break;case mr:Tr(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],Nr,Xr),0===a?Rr(e,Nr):Pr(e,Nr),h=Xr.x,l=Xr.y,a+=9;break;case xr:h=t[a+1],l=t[a+2],Wr=t[a+3],Dr=t[a+4],Ar(e,h-Wr,l-Dr,2*Wr,2*Dr),h+=Wr,a+=5;break;case wr:Or(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Nr,Xr),0===a?Rr(e,Nr):Pr(e,Nr),h=Xr.x,l=Xr.y,a+=7;break;case br:h=t[a+1],l=t[a+2],Er=t[a+3],Ar(e,h-Er,l-Er,2*Er,2*Er),h+=Er,a+=4;break;case Br:Cr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Nr,Xr),0===a?Rr(e,Nr):Pr(e,Nr),h=Xr.x,l=Xr.y,a+=6;break;default:return void Mr.error(`command: ${s} [index:${a}]`,t)}}},{M:Fr,L:jr,C:Ur,Z:qr}=Ut,{getCenterX:Gr,getCenterY:Hr}=A,{arcTo:Vr}=Ls,Qr={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 _=t.length,p=[];for(;i<_;)switch(r=t[i],r){case Fr:a=u=t[i+1],h=c=t[i+2],i+=3,t[i]===jr?(l=t[i+1],d=t[i+2],p.push(Fr,Gr(a,l),Hr(h,d))):p.push(Fr,a,h);break;case jr:switch(o=t[i+1],n=t[i+2],i+=3,t[i]){case jr:Vr(p,o,n,t[i+1],t[i+2],e,u,c);break;case qr:Vr(p,o,n,a,h,e,u,c);break;default:p.push(jr,o,n)}u=o,c=n;break;case Ur:p.push(Ur,t[i+1],t[i+2],t[i+3],t[i+4],t[i+5],t[i+6]),i+=7;break;case qr:Vr(p,a,h,l,d,e,u,c),p.push(qr),i+=1}return r!==qr&&(p[1]=a,p[2]=h),p}};Ft.creator=new Vs,Ft.parse=hs.parse,Ft.convertToCanvasData=hs.toCanvasData;const{drawRoundRect:Zr}=Jt;function Jr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,r,i){Zr(this,t,e,s,r,i)})}(t)}const $r=dt.get("TaskProcessor");class Kr{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return St(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){$r.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class ti{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&&vt.assign(this.config,t),this.empty()}add(t,e){let s,r,i,o;const n=new Kr(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 ei={map:{},recycledList:[],tasker:new ti,patternTasker:new ti,get isComplete(){return si.tasker.isComplete},get(t){let s=si.map[t.url];return s||(s=e.image(t),si.map[t.url]=s),s.use++,s},recycle(t){t.use--,setTimeout((()=>{t.use||si.recycledList.push(t)}))},clearRecycled(){const t=si.recycledList;t.length&&(t.forEach((t=>{!t.use&&t.url&&(delete si.map[t.url],t.destroy())})),t.length=0)},hasOpacityPixel:t=>Tt.opacityTypes.some((e=>si.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+Tt.mineType(t)))return!0}else if(s.includes("."+t)||s.includes("."+Tt.upperCaseTypeMap[t]))return!0;return!1},destroy(){si.map={}}},si=ei,{IMAGE:ri,create:ii}=s;class oi{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){this.use=0,this.waitComplete=[],this.innerId=ii(ri),this.config=t||{url:""},this.isSVG=ei.isFormat("svg",t),this.hasOpacityPixel=ei.hasOpacityPixel(t)}load(e,s){return this.loading||(this.loading=!0,ei.tasker.add((()=>St(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}}function ni(t,e,s){Object.defineProperty(t,e,s)}function ai(t,e){return Object.getOwnPropertyDescriptor(t,e)}function hi(t,e,s,r){const i={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)},configurable:!0,enumerable:!0};ni(t,e,Object.assign(i,r||{})),Pi(t,e,s)}function li(t){return(e,s)=>{hi(e,s,t)}}function di(t){return(e,s)=>{hi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.matrixChanged||this.__layout.matrixChange()}})}}function ui(t){return(e,s)=>{hi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.matrixChanged||this.__layout.matrixChange(),this.__hasAutoLayout=!!t,this.__local||this.__layout.createLocal()}})}}function ci(t){return(e,s)=>{hi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}})}}function _i(t){return(e,s)=>{hi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}})}}function pi(t){return(e,s)=>{hi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__hasAutoLayout&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})}}const fi=pi;function gi(t){return(e,s)=>{hi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.strokeChanged||this.__layout.strokeChange()}})}}const yi=gi;function mi(t){return(e,s)=>{hi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.renderChanged||this.__layout.renderChange()}})}}function xi(t){return(e,s)=>{hi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}})}}function wi(t){return(e,s)=>{hi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.opacityChanged||this.__layout.opacityChange()}})}}function bi(t){return(e,s)=>{hi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()}))}})}}function Bi(t){return(e,s)=>{hi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(t)}))}})}}function vi(t){return(e,s)=>{hi(e,s,t,{set(t){this.__setAttr(s,t),this.waitParent((()=>{this.parent.__updateEraser(t)}))}})}}function ki(t){return(e,s)=>{hi(e,s,t,{set(t){this.__setAttr(s,t),dt.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor()}})}}function Ci(t){return(e,s)=>{hi(e,s,t,{set(t){this.__setAttr(s,t),this.leafer&&this.leafer.updateCursor()}})}}function Oi(t){return(e,s)=>{ni(e,"__DataProcessor",{get:()=>t})}}function Ti(t){return(e,s)=>{ni(e,"__LayoutProcessor",{get:()=>t})}}function Pi(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},configurable:!0,enumerable:!0};void 0===s?n.get=function(){return this[i]}:"width"===e?n.get=function(){const t=this[i];return void 0===t?this.__naturalWidth||s:t}:"height"===e&&(n.get=function(){const t=this[i];return void 0===t?this.__naturalHeight||s:t});let a,h=r;for(;!a&&h;)a=ai(h,e),h=h.__proto__;a&&a.set&&(n.set=a.set),r[o]&&(n.set=r[o],delete r[o]),Object.defineProperty(r,e,n)}const Ri=new dt("rewrite"),Si=[],Li=["destroy","constructor"];function Ai(t){return(e,s)=>{Si.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function Ii(){return t=>{Mi()}}function Mi(t){Si.length&&(Si.forEach((e=>{t&&Ri.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Si.length=0)}function Ei(t,e){return s=>{var r;(t.prototype?(r=t.prototype,Object.getOwnPropertyNames(r)):Object.keys(t)).forEach((r=>{if(!(Li.includes(r)||e&&e.includes(r)))if(t.prototype){ai(t.prototype,r).writable&&(s.prototype[r]=t.prototype[r])}else s.prototype[r]=t[r]}))}}function Wi(){return t=>{yt.register(t)}}function Di(){return t=>{wt.register(t)}}setTimeout((()=>Mi(!0)));const Ni=new E,{toOuterOf:Yi,getPoints:Xi,copy:zi}=$;class Fi{get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}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"){switch(this.update(),t){case"world":return this.leaf.__world;case"local":return this.leaf.__localMatrix;case"inner":return b.defaultMatrix;default:return new E(this.leaf.__world).divideParent(t.__world)}}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);default:return new st(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"margin":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"margin":case"content":case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"content":if(this.contentBounds)return this.getWorldContentBounds();case"margin":case"box":return this.getWorldBoxBounds();case"margin":case"stroke":return this.getWorldStrokeBounds()}}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;default:i=r.getWorldPoint(n,e),o=Ni.set(r.__world).divideParent(e.__world)}const a=b.getLayout(o);if(zi(a,n),A.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=Xi(this.getInnerBounds(t));let i;switch(e){case"world":i=null;break;case"local":i=s.parent;break;case"inner":break;default:i=e}return void 0!==i&&r.forEach((t=>s.innerToWorld(t,null,!1,i))),r}getWorldContentBounds(){return this._worldContentBounds||(this._worldContentBounds={}),Yi(this.contentBounds,this.leaf.__world,this._worldContentBounds),this._worldContentBounds}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),Yi(this.boxBounds,this.leaf.__world,this._worldBoxBounds),this._worldBoxBounds}getWorldStrokeBounds(){return this._worldStrokeBounds||(this._worldStrokeBounds={}),Yi(this.strokeBounds,this.leaf.__world,this._worldStrokeBounds),this._worldStrokeBounds}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}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}}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 ji={},Ui={on(t,e,s){let r,i,o;s&&("boolean"==typeof s?r=s:(r=s.capture,i=s.once));const n=qi(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){let r,i,o;s&&(r="boolean"==typeof s?s:s.capture);const n=qi(this,r);("string"==typeof t?t.split(" "):t).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]))}))},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&&wt.has(t)&&(e=wt.get(t,{type:t,target:this,current:this}));const r=qi(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++);}},emitEvent(t,e){t.current=this,this.emit(t.type,t,e)},hasEvent(t,e){const{__bubbleMap:s,__captureMap:r}=this,i=s&&s[t],o=r&&r[t];return!!(void 0===e?i||o:e?o:i)}};function qi(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:ji)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:ji)}}class Gi{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 Hi extends Gi{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}Hi.ADD="child.add",Hi.REMOVE="child.remove";class Vi extends Gi{constructor(t,e,s,r,i){super(t,e),this.attrName=s,this.oldValue=r,this.newValue=i}}Vi.CHANGE="property.change",Vi.LEAFER_CHANGE="property.leafer_change";class Qi extends Gi{constructor(t,e){super(t),Object.assign(this,e)}}Qi.LOAD="image.load",Qi.LOADED="image.loaded",Qi.ERROR="image.error";class Zi extends Gi{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(Zi.RESIZE),Object.assign(this,t)):super(t),this.old=e}}Zi.RESIZE="resize";class Ji extends Gi{constructor(t,e){super(t),this.data=e}}Ji.REQUEST="watch.request",Ji.DATA="watch.data";class $i extends Gi{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}$i.CHECK_UPDATE="layout.check_update",$i.REQUEST="layout.request",$i.START="layout.start",$i.BEFORE="layout.before",$i.LAYOUT="layout",$i.AFTER="layout.after",$i.AGAIN="layout.again",$i.END="layout.end";class Ki extends Gi{}Ki.FRAME="animate.frame";class to extends Gi{constructor(t,e,s,r){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=r)}}to.REQUEST="render.request",to.START="render.start",to.BEFORE="render.before",to.RENDER="render",to.AFTER="render.after",to.AGAIN="render.again",to.END="render.end",to.NEXT="render.next";class eo extends Gi{}eo.START="leafer.start",eo.BEFORE_READY="leafer.before_ready",eo.READY="leafer.ready",eo.AFTER_READY="leafer.after_ready",eo.VIEW_READY="leafer.view_ready",eo.VIEW_COMPLETED="leafer.view_completed",eo.STOP="leafer.stop",eo.RESTART="leafer.restart",eo.END="leafer.end";const so={__setAttr(t,e){if(this.leafer&&this.leafer.created){const s=this.__.__getInput(t);if("object"==typeof e||s!==e){this.__[t]=e,this.__proxyData&&this.setProxyAttr(t,e);const{CHANGE:r}=Vi,i=new Vi(r,this,t,s,e);this.isLeafer?this.emitEvent(new Vi(Vi.LEAFER_CHANGE,this,t,s,e)):this.hasEvent(r)&&this.emitEvent(i),this.leafer.emitEvent(i)}}else this.__[t]=e,this.__proxyData&&this.setProxyAttr(t,e)},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:ro,multiplyParent:io,translateInner:oo,defaultWorld:no}=b,{toPoint:ao,tempPoint:ho}=at,lo={__updateWorldMatrix(){io(this.__local||this.__layout,this.parent?this.parent.__world:no,this.__world,!!this.__layout.affectScaleOrRotation,this.__)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged||t.rotationChanged)&&(ro(e,s,null,t.affectRotation),t.scaleChanged=t.rotationChanged=!1),e.e=s.x,e.f=s.y,s.around&&(ao(s.around,t.boxBounds,ho),oo(e,-ho.x,-ho.y))}this.__layout.matrixChanged=!1}},{copy:uo,toInnerPoint:co,scaleOfOuter:_o,rotateOfOuter:po,skewOfOuter:fo,multiplyParent:go,divideParent:yo,getLayout:mo}=b,xo={},wo={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),vo(t,e,s),t.isBranch){const{children:r}=t;for(let t=0,i=r.length;t<i;t++)Bo(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++)ko(e[t])}},updateAllChange(t){if(ko(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Co(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},moveWorld(t,e,s){const r={x:e,y:s};t.parent&&co(t.parent.worldTransform,r,r,!0),bo.moveLocal(t,r.x,r.y)},moveLocal(t,e,s=0){t.x+=e,t.y+=s},zoomOfWorld(t,e,s,r,i){bo.zoomOfLocal(t,To(t,e),s,r,i)},zoomOfLocal(t,e,s,r=s,i){uo(xo,t.__localMatrix),_o(xo,e,s,r),Oo(t,xo),t.scaleResize(s,r,!0!==i)},rotateOfWorld(t,e,s){bo.rotateOfLocal(t,To(t,e),s)},rotateOfLocal(t,e,s){uo(xo,t.__localMatrix),po(xo,e,s),Oo(t,xo),t.rotation=a.formatRotation(t.rotation+s)},skewOfWorld(t,e,s,r,i){bo.skewOfLocal(t,To(t,e),s,r,i)},skewOfLocal(t,e,s,r=0,i){uo(xo,t.__localMatrix),fo(xo,e,s,r),bo.setTransform(t,xo,i)},transformWorld(t,e,s){uo(xo,t.worldTransform),go(xo,e),t.parent&&yo(xo,t.parent.worldTransform),bo.setTransform(t,xo,s)},transform(t,e,s){uo(xo,t.localTransform),go(xo,e),bo.setTransform(t,xo,s)},setTransform(t,e,s){const r=mo(e);s&&(t.scaleResize(r.scaleX/t.scaleX,r.scaleY/t.scaleY,!0!==s),delete r.scaleX,delete r.scaleY),t.set(r)},drop(t,e,s,r){uo(xo,t.worldTransform),yo(xo,e.worldTransform),t.setTransform(xo,r),e.add(t,s)},hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},hasParentAutoLayout(t){for(;t.parent;)if((t=t.parent).__hasAutoLayout)return!0}},bo=wo,{updateAllMatrix:Bo,updateMatrix:vo,updateAllWorldOpacity:ko,updateAllChange:Co}=bo;function Oo(t,e){const{e:s,f:r}=t.__localMatrix;t.x+=e.e-s,t.y+=e.f-r}function To(t,e){return t.__layout.update(),t.parent?A.tempToInnerOf(e,t.parent.__world):e}const Po={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser?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:Ro}=wo,So={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),Lo(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++)Ao(e[t],e)},updateBounds(t,e){const s=[t];Ao(t,s),Io(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++)Ro(r[t]);e&&e===s||Ro(s)}}},{pushAllChildBranch:Lo,pushAllBranchStack:Ao,updateBoundsByBranchStack:Io}=So,Mo={run(t){if(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)}}},{updateMatrix:Eo,updateAllMatrix:Wo,hasParentAutoLayout:Do}=wo,{updateBounds:No}=So,{toOuterOf:Yo,copyAndSpread:Xo}=$,zo={__updateWorldBounds(){Yo(this.__layout.renderBounds,this.__world,this.__world),this.__layout.resized&&(this.__onUpdateSize(),this.__layout.resized=!1)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.boxChanged=!1,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.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.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(),Yo(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Yo(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Yo(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,{width:e,height:s}=this.__;t.x=0,t.y=0,t.width=e,t.height=s},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.leafer&&this.leafer.layouter.addExtra(this),Do(this)?Eo(this):(Wo(this),No(this,this))):Eo(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){Xo(this.__layout.strokeBounds,this.__layout.boxBounds,this.__layout.strokeSpread)},__updateRenderBounds(){Xo(this.__layout.renderBounds,this.__layout.strokeBounds,this.__layout.renderSpread)}},Fo={__render(t,e){if(this.__worldOpacity)if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=this.__.opacity,this.__.__single){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:jo}=Po,Uo={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__worldOpacity)if(this.__.__single){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++)jo(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++)jo(s[r],e)||s[r].__clip(t,e)}}},{LEAF:qo,create:Go}=s,{toInnerPoint:Ho,toOuterPoint:Vo,multiplyParent:Qo}=b,{toOuterOf:Zo}=$,{tempToOuterOf:Jo,copy:$o}=A,{moveLocal:Ko,zoomOfLocal:tn,rotateOfLocal:en,skewOfLocal:sn,transform:rn,setTransform:on,drop:nn}=wo;let an=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 Ct}get __LayoutProcessor(){return Fi}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}constructor(t){this.innerId=Go(qo),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.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t){this.parent?t():this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}waitLeafer(t){this.leafer?t():this.__leaferWait?this.__leaferWait.push(t):this.__leaferWait=[t]}nextRender(t,e){this.leafer?this.leafer.nextRender(t,e):this.waitLeafer((()=>this.leafer.nextRender(t,e)))}__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&&Mo.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(){}toJSON(){return this.__.__getInputData()}toString(){return JSON.stringify(this.toJSON())}__setAttr(t,e){}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findOne(t,e){}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}updateLayout(){this.__layout.update()}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateAutoLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some((t=>t.__.eraser))}__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 Qo(this.__world,t.matrix,e,void 0,this.__world),Zo(this.__layout.renderBounds,e,e),e}return this.__world}getWorld(t){return this.__layout.update(),"x"===t?this.__world.e:"y"===t?this.__world.f:this.getLayoutBounds()[t]}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)}worldToLocal(t,e,s,r){this.parent?this.parent.worldToInner(t,e,s,r):e&&$o(e,t)}localToWorld(t,e,s,r){this.parent?this.parent.innerToWorld(t,e,s,r):e&&$o(e,t)}worldToInner(t,e,s,r){r&&(r.innerToWorld(t,e,s),t=e||t),Ho(this.worldTransform,t,e,s)}innerToWorld(t,e,s,r){Vo(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){on(this,t,e)}transform(t,e){rn(this,t,e)}move(t,e){Ko(this,t,e)}scaleOf(t,e,s,r){tn(this,Jo(t,this.localTransform),e,s,r)}rotateOf(t,e){en(this,Jo(t,this.localTransform),e)}skewOf(t,e,s,r){sn(this,Jo(t,this.localTransform),e,s,r)}scaleResize(t,e=t,s){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t,e){var s;return null===(s=this.__hitCanvas)||void 0===s?void 0:s.hitFill(t,e)}__hitStroke(t,e){var s;return null===(s=this.__hitCanvas)||void 0===s?void 0:s.hitStroke(t,e)}__drawHitPath(t){t&&this.__drawRenderPath(t)}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e){}__clip(t,e){}__renderShape(t,e){}__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){nn(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){Pi(this.prototype,t,e)}static addAttr(t,e,s){s||(s=pi),s(e)(this.prototype,t)}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.removeAll(!0),this.__.destroy(),this.__layout.destroy(),this.__captureMap=this.__bubbleMap=this.__parentWait=this.__leaferWait=null,this.destroyed=!0)}};an=Rt([Ei(so),Ei(lo),Ei(zo),Ei(Ui),Ei(Fo)],an);const{setListWithFn:hn}=$,{sort:ln}=So,{localBoxBounds:dn,localStrokeBounds:un,localRenderBounds:cn,maskLocalBoxBounds:_n,maskLocalStrokeBounds:pn,maskLocalRenderBounds:fn}=Po;let gn=class extends an{constructor(){super(),this.isBranch=!0,this.children=[]}__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?_n:dn)}__updateStrokeBounds(){hn(this.__layout.strokeBounds,this.children,this.__hasMask?pn: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.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.boundsChanged||t.__layout.matrixChange(),t.__parentWait&&Mo.run(t.__parentWait),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Hi.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(Hi.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new Hi(t,e,this);e.hasEvent(t)&&e.emitEvent(s),this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}};gn=Rt([Ei(Uo)],gn);class yn{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 yn;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 mn{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}}export{Ki as AnimateEvent,Ot as Answer,at as AroundHelper,rt as AutoBounds,fe as BezierHelper,st as Bounds,$ as BoundsHelper,gn as Branch,So as BranchHelper,Uo as BranchRender,Bt as CanvasManager,Hi as ChildEvent,e as Creator,vt as DataHelper,dt as Debug,it as Direction4,ot as Direction9,ke as EllipseHelper,Gi as Event,wt as EventCreator,Tt as FileHelper,Qi as ImageEvent,ei as ImageManager,s as IncrementId,$i as LayoutEvent,an as Leaf,zo as LeafBounds,Po as LeafBoundsHelper,Ct as LeafData,so as LeafDataProxy,Ui as LeafEventer,wo as LeafHelper,Fi as LeafLayout,mn as LeafLevelList,yn as LeafList,lo as LeafMatrix,Fo as LeafRender,zt as LeaferCanvasBase,eo as LeaferEvent,oi as LeaferImage,a as MathHelper,E as Matrix,b as MatrixHelper,Gt as NeedConvertToCanvasCommandMap,h as OneRadian,l as PI2,d as PI_2,zr as PathBounds,Ls as PathCommandDataHelper,Ut as PathCommandMap,hs as PathConvert,Qr as PathCorner,Vs as PathCreator,lr as PathDrawer,Ft as PathHelper,Zt as PathNumberCommandLengthMap,Qt as PathNumberCommandMap,t as Platform,M as Point,A as PointHelper,Vi as PropertyEvent,Jt as RectHelper,to as RenderEvent,Zi as ResizeEvent,pt as Run,lt as StringNumberMap,Kr as TaskItem,ti as TaskProcessor,W as TwoPointBoundsHelper,yt as UICreator,Mo as WaitHelper,Ji as WatchEvent,mi as affectRenderBoundsType,gi as affectStrokeBoundsType,ui as autoLayoutType,pi as boundsType,Jr as canvasPatch,Xt as canvasSizeAttrs,Ci as cursorType,Oi as dataProcessor,li as dataType,Pi as defineDataProcessor,ni as defineKey,hi as defineLeafAttr,vi as eraserType,c as getBoundsData,ai as getDescriptor,_ as getMatrixData,u as getPointData,ki as hitType,Ti as layoutProcessor,Bi as maskType,wi as opacityType,fi as pathType,di as positionType,Wi as registerUI,Di as registerUIEvent,Ai as rewrite,Ii as rewriteAble,_i as rotationType,ci as scaleType,bi as sortType,yi as strokeType,xi as surfaceType,Ei as useModule};
@@ -0,0 +1 @@
1
+ "use strict";const t={image:{maxCacheSize:4096e3,maxPatternSize:8847360,suffix:"leaf",crossOrigin:"anonymous"}},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)=>(t<e&&(t=e),t>s&&(t=s),t),fourNumber(t,e){let s;if(t instanceof Array)switch(t.length){case 4:s=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){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*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){const{e:o,f:n}=t;if(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=o*e.a+n*e.c+e.e,s.f=o*e.b+n*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)},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:k}=b,{sin:C,cos:T,abs:P,sqrt:O,atan2:L,min:R,PI:S}=Math,M={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},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=I.defaultPoint);const r=T(e*=h),i=C(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}=I;return I.copy(s,t),B(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=I;return I.copy(s,t),k(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=I;return I.copy(s,t),I.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)=>I.getDistanceFrom(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,r){const i=P(s-t),o=P(r-e);return O(i*i+o*o)},getMinDistanceFrom:(t,e,s,r,i,o)=>R(I.getDistanceFrom(t,e,s,r),I.getDistanceFrom(s,r,i,o)),getAngle:(t,e)=>I.getAtan2(t,e)/h,getRotation:(t,e,s,r)=>(r||(r=e),I.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=L(e-r,t-s);const d=L(o-a,i-n)-h;return d<-S?d+l:d},getAtan2:(t,e)=>L(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s){const r=I.getAtan2(t,e);return{x:t.x+T(r)*s,y:t.y+C(r)*s}},reset(t){I.reset(t)}},I=M;class A{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?M.copy(this,t):M.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new A(this)}move(t,e){return M.move(this,t,e),this}scale(t,e){return M.scale(this,t,e),this}scaleOf(t,e,s){return M.scaleOf(this,t,e,s),this}rotate(t,e){return M.rotate(this,t,e),this}rotateOf(t,e){return M.rotate(this,e,t),this}getRotation(t,e,s){return M.getRotation(this,t,e,s)}toInnerOf(t,e){return M.toInnerOf(this,t,e),this}toOuterOf(t,e){return M.toOuterOf(this,t,e),this}getCenter(t){return new A(M.getCenter(this,t))}getDistance(t){return M.getDistance(this,t)}getDistancePoint(t,e){return new A(M.getDistancePoint(this,t,e))}getAngle(t){return M.getAngle(this,t)}getAtan2(t){return M.getAtan2(this,t)}reset(){return M.reset(this),this}}class E{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}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 E(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}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}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 W={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){D(t,e,s),D(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:D}=W,{tempPointBounds:N,setPoint:Y,addPoint:X,toBounds:z}=W,{toOuterPoint:F}=b,{float:j}=a,{floor:H,ceil:U}=Math;let q,G,V,Q;const Z={},J={},$={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){r||(r=s),K.set(t,e.x-s,e.y-r,e.width+2*s,e.height+2*r)},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),K.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?et(e,t):e=t,s?(e.offsetX=-(K.maxX(s)-t.x),e.offsetY=-(K.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),K.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e){M.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,r=s){M.scaleOf(t,e,s,r),t.width*=s,t.height*=r},tempToOuterOf:(t,e)=>(K.copy(K.tempBounds,t),K.toOuterOf(K.tempBounds,e),K.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),K.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 Z.x=t.x,Z.y=t.y,F(e,Z,J),Y(N,J.x,J.y),Z.x=t.x+t.width,F(e,Z,J),X(N,J.x,J.y),Z.y=t.y+t.height,F(e,Z,J),X(N,J.x,J.y),Z.x=t.x,F(e,Z,J),X(N,J.x,J.y),z(N,s)},toInnerOf(t,e,s){s||(s=t),K.move(s,-e.e,-e.f),K.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e){const s=Math.min(1,Math.min(t.width/e.width,t.height/e.height));return new E(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e,s){const r={};return K.copyAndSpread(r,t,e,s),r},spread(t,e,s=e){K.copyAndSpread(t,t,e,s)},ceil(t){const{x:e,y:s}=t;t.x=H(t.x),t.y=H(t.y),t.width=e>t.x?U(t.width+e-t.x):U(t.width),t.height=s>t.y?U(t.height+s-t.y):U(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=j(t.x,e),t.y=j(t.y,e),t.width=j(t.width,e),t.height=j(t.height,e)},add(t,e){q=t.x+t.width,G=t.y+t.height,V=e.x+e.width,Q=e.y+e.height,q=q>V?q:V,G=G>Q?G:Q,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=q-t.x,t.height=G-t.y},addList(t,e){K.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){K.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){K.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||et(t,i)):tt(t,i));o&&K.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?Y(N,t.x,t.y):X(N,t.x,t.y))),z(N,t)},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=M.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=M.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=K.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=K.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=K.tempToOuterOf(e,s)),!K.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:r,y:i,width:o,height:n}=e;return q=r+o,G=i+n,V=t.x+t.width,Q=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,q=q<V?q:V,G=G<Q?G:Q,o=q-r,n=G-i,{x:r,y:i,width:o,height:n}},intersect(t,e,s){K.copy(t,K.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){K.set(t)}},K=$,{add:tt,copy:et}=K;class st{get minX(){return $.minX(this)}get minY(){return $.minY(this)}get maxX(){return $.maxX(this)}get maxY(){return $.maxY(this)}constructor(t,e,s,r){this.set(t,e,s,r)}set(t,e,s,r){return"object"==typeof t?$.copy(this,t):$.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 st(this)}move(t,e){return $.move(this,t,e),this}scale(t,e){return $.scale(this,t,e),this}scaleOf(t,e,s){return $.scaleOf(this,t,e,s),this}toOuterOf(t,e){return $.toOuterOf(this,t,e),this}toInnerOf(t,e){return $.toInnerOf(this,t,e),this}getFitMatrix(t){return $.getFitMatrix(this,t)}spread(t,e){return $.spread(this,t,e),this}ceil(){return $.ceil(this),this}unsign(){return $.unsign(this),this}float(t){return $.float(this,t),this}add(t){return $.add(this,t),this}addList(t){return $.setList(this,t,!0),this}setList(t){return $.setList(this,t),this}addListWithFn(t,e){return $.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return $.setListWithFn(this,t,e),this}setPoints(t){return $.setPoints(this,t),this}getPoints(){return $.getPoints(this)}hitPoint(t,e){return $.hitPoint(this,t,e)}hitRadiusPoint(t,e){return $.hitRadiusPoint(this,t,e)}hit(t,e){return $.hit(this,t,e)}includes(t,e){return $.includes(this,t,e)}intersect(t,e){return $.intersect(this,t,e),this}getIntersect(t,e){return new st($.getIntersectData(this,t,e))}isSame(t){return $.isSame(this,t)}isEmpty(){return $.isEmpty(this)}reset(){$.reset(this)}}var rt,it;exports.Direction4=void 0,(rt=exports.Direction4||(exports.Direction4={}))[rt.top=0]="top",rt[rt.right=1]="right",rt[rt.bottom=2]="bottom",rt[rt.left=3]="left",exports.Direction9=void 0,(it=exports.Direction9||(exports.Direction9={}))[it.topLeft=0]="topLeft",it[it.top=1]="top",it[it.topRight=2]="topRight",it[it.right=3]="right",it[it.bottomRight=4]="bottomRight",it[it.bottom=5]="bottom",it[it.bottomLeft=6]="bottomLeft",it[it.left=7]="left",it[it.center=8]="center";const ot=[{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}],nt={directionData:ot,tempPoint:{},get:at,toPoint(t,e,s,r){s||(s={});const i=at(t);s.x=i.x*e.width,s.y=i.y*e.height,r||(s.x+=e.x,s.y+=e.y)}};function at(t){return"string"==typeof t?ot[exports.Direction9[t]]:t}const ht={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 lt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new lt(t)}static set filter(t){this.filterList=dt(t)}static set exclude(t){this.excludeList=dt(t)}log(...t){if(ut.enable){if(ut.filterList.length&&ut.filterList.every((t=>t!==this.name)))return;if(ut.excludeList.length&&ut.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){ut.enable&&this.warn(...t)}warn(...t){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 dt(t){return t?"string"==typeof t&&(t=[t]):t=[],t}lt.filterList=[],lt.excludeList=[];const ut=lt,ct=lt.get("RunTime"),pt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const r=s.create(s.RUNTIME);return _t.currentId=_t.idMap[r]=e?performance.now():Date.now(),_t.currentName=_t.nameMap[r]=t,_t.nameToIdMap[t]=r,r},end(t,e){const s=_t.idMap[t],r=_t.nameMap[t],i=e?(performance.now()-s)/1e3:Date.now()-s;_t.idMap[t]=_t.nameMap[t]=_t.nameToIdMap[r]=void 0,ct.log(r,i,"ms")},endOfName(t,e){const s=_t.nameToIdMap[t];void 0!==s&&_t.end(s,e)}},_t=pt,ft=lt.get("UICreator"),gt={list:{},register(t){const{__tag:e}=t.prototype;yt[e]?ft.repeat(e):yt[e]=t},get(t,e,s,r,i,o){const n=new yt[t](e);return void 0!==s&&(n.x=s,r&&(n.y=r),i&&(n.width=i),o&&(n.height=o)),n}},{list:yt}=gt,xt=lt.get("EventCreator"),mt={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(wt[e]?xt.repeat(e):wt[e]=t)}))},changeName(t,e){const s=wt[t];if(s){const r=Object.keys(s).find((e=>s[e]===t));r&&(s[r]=e,wt[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new wt[t](...e)},{nameList:wt}=mt;const bt={default:(t,e)=>(vt(e,t),vt(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?vt(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))},{assign:vt}=bt;class Bt{get __blendMode(){if(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}return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s,r;for(let i in this)"_"!==i[0]&&(s=this["_"+i],void 0!==s&&(r=e?e[i]:void 0,t[i]=void 0===r?s:r));return t}__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}destroy(){this.__input=this.__middle=null}}var kt;exports.Answer=void 0,(kt=exports.Answer||(exports.Answer={}))[kt.No=0]="No",kt[kt.Yes=1]="Yes",kt[kt.NoAndSkip=2]="NoAndSkip",kt[kt.YesAndSkip=3]="YesAndSkip";const Ct={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=Tt.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{}}}},Tt=Ct;function Pt(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 Ot(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 Lt(t){return(e,s)=>{t||(t=s),Object.defineProperty(e,s,{get(){return this.context[t]},set(e){this.context[t]=e}})}}Tt.opacityTypes.forEach((t=>Tt.upperCaseTypeMap[t]=t.toUpperCase())),"function"==typeof SuppressedError&&SuppressedError;const Rt=[];function St(){return(t,e)=>{Rt.push(e)}}const Mt=[];class It{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||Mt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;Rt.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}}Pt([Lt("imageSmoothingEnabled")],It.prototype,"smooth",void 0),Pt([Lt("imageSmoothingQuality")],It.prototype,"smoothLevel",void 0),Pt([Lt("globalAlpha")],It.prototype,"opacity",void 0),Pt([Lt()],It.prototype,"fillStyle",void 0),Pt([Lt()],It.prototype,"strokeStyle",void 0),Pt([Lt("lineWidth")],It.prototype,"strokeWidth",void 0),Pt([Lt("lineCap")],It.prototype,"strokeCap",void 0),Pt([Lt("lineJoin")],It.prototype,"strokeJoin",void 0),Pt([Lt("lineDashOffset")],It.prototype,"dashOffset",void 0),Pt([Lt()],It.prototype,"miterLimit",void 0),Pt([Lt()],It.prototype,"shadowBlur",void 0),Pt([Lt()],It.prototype,"shadowColor",void 0),Pt([Lt()],It.prototype,"shadowOffsetX",void 0),Pt([Lt()],It.prototype,"shadowOffsetY",void 0),Pt([Lt()],It.prototype,"filter",void 0),Pt([Lt()],It.prototype,"font",void 0),Pt([Lt()],It.prototype,"fontKerning",void 0),Pt([Lt()],It.prototype,"fontStretch",void 0),Pt([Lt()],It.prototype,"fontVariantCaps",void 0),Pt([Lt()],It.prototype,"textAlign",void 0),Pt([Lt()],It.prototype,"textBaseline",void 0),Pt([Lt()],It.prototype,"textRendering",void 0),Pt([Lt()],It.prototype,"wordSpacing",void 0),Pt([Lt()],It.prototype,"letterSpacing",void 0),Pt([Lt()],It.prototype,"direction",void 0),Pt([St()],It.prototype,"setTransform",null),Pt([St()],It.prototype,"resetTransform",null),Pt([St()],It.prototype,"getTransform",null),Pt([St()],It.prototype,"save",null),Pt([St()],It.prototype,"restore",null),Pt([St()],It.prototype,"translate",null),Pt([St()],It.prototype,"scale",null),Pt([St()],It.prototype,"rotate",null),Pt([St()],It.prototype,"fill",null),Pt([St()],It.prototype,"stroke",null),Pt([St()],It.prototype,"clip",null),Pt([St()],It.prototype,"fillRect",null),Pt([St()],It.prototype,"strokeRect",null),Pt([St()],It.prototype,"clearRect",null),Pt([St()],It.prototype,"beginPath",null),Pt([St()],It.prototype,"moveTo",null),Pt([St()],It.prototype,"lineTo",null),Pt([St()],It.prototype,"bezierCurveTo",null),Pt([St()],It.prototype,"quadraticCurveTo",null),Pt([St()],It.prototype,"closePath",null),Pt([St()],It.prototype,"arc",null),Pt([St()],It.prototype,"arcTo",null),Pt([St()],It.prototype,"ellipse",null),Pt([St()],It.prototype,"rect",null),Pt([St()],It.prototype,"roundRect",null),Pt([St()],It.prototype,"createConicGradient",null),Pt([St()],It.prototype,"createLinearGradient",null),Pt([St()],It.prototype,"createPattern",null),Pt([St()],It.prototype,"createRadialGradient",null),Pt([St()],It.prototype,"fillText",null),Pt([St()],It.prototype,"measureText",null),Pt([St()],It.prototype,"strokeText",null);const{copy:At}=b,Et=new st,Wt={width:1,height:1,pixelRatio:1},Dt=lt.get("LeaferCanvasBase"),Nt=["width","height","pixelRatio"];const Yt={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Xt={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},zt=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},Xt),Ft={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},jt={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},Ht=Object.assign(Object.assign({},jt),Xt),Ut=zt,qt={};for(let t in Ut)qt[Ut[t]]=t;const Gt={};for(let t in Ut)Gt[Ut[t]]=Ft[t];const Vt={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:Qt,cos:Zt,atan2:Jt,ceil:$t,abs:Kt,PI:te,sqrt:ee,pow:se}=Math,{setPoint:re,addPoint:ie}=W,{set:oe}=M,{M:ne,L:ae,C:he,Q:le,Z:de}=zt,ue={},ce={points(t,e,s,r){if(t.push(ne,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],_=ee(se(n-i,2)+se(a-o,2)),f=ee(se(h-n,2)+se(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(le,d,u,n,a):t.push(he,c,p,d,u,n,a),c=n+f*h,p=a+f*l;r||t.push(le,c,p,e[y-2],e[y-1])}else for(let s=2,r=e.length;s<r;s+=2)t.push(ae,e[s],e[s+1]);r&&t.push(de)},rect(t,e,s,r,i){Yt.creator.path=t,Yt.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){Yt.creator.path=[],Vt.drawRoundRect(Yt.creator,e,s,r,i,o),t.push(...Yt.convertToCanvasData(Yt.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=Jt(f,_),m=Jt(y,g),w=m-x;if(w<0&&(w+=l),w===te||Kt(_+f)<1e-12||Kt(g+y)<1e-12)return t&&t.push(ae,r,i),u&&(re(u,e,s),ie(u,r,i)),p&&oe(p,e,s),void(c&&oe(c,r,i));const b=_*y-g*f<0,v=b?-1:1,B=a/Zt(w/2),k=r+B*Zt(x+w/2+d*v),C=i+B*Qt(x+w/2+d*v);return x-=d*v,m-=d*v,fe(t,k,C,a,a,0,x/h,m/h,b,u,c,p)},arc:(t,e,s,r,i,o,n,a,h,l)=>fe(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=Qt(f),y=Zt(f);let x=n*h,m=a*h;x>te&&(x-=l),m<0&&(m+=l);let w=m-x;w<0?w+=l:w>l&&(w-=l),u&&(w-=l);const b=$t(Kt(w/d)),v=w/b,B=Qt(v/4),k=8/3*B*B/Qt(v/2);m=x+v;let C,T,P,O,L,R,S,M,I=Zt(x),A=Qt(x),E=P=y*r*I-g*i*A,W=O=g*r*I+y*i*A,D=e+P,N=s+O;t&&t.push(ae,D,N),c&&re(c,D,N),_&&oe(_,D,N);for(let o=0;o<b;o++)C=Zt(m),T=Qt(m),P=y*r*C-g*i*T,O=g*r*C+y*i*T,L=e+E-k*(y*r*A+g*i*I),R=s+W-k*(g*r*A-y*i*I),S=e+P+k*(y*r*T+g*i*C),M=s+O+k*(g*r*T-y*i*C),t&&t.push(he,L,R,S,M,e+P,s+O),c&&_e(e+E,s+W,L,R,S,M,e+P,s+O,c,!0),E=P,W=O,I=C,A=T,x=m,m+=v;p&&oe(p,e+P,s+O)},quadraticCurveTo(t,e,s,r,i,o,n){t.push(he,(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){_e(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?ie(h,t,e):re(h,t,e),ie(h,n,a);for(let l=0,u=d.length;l<u;l++)pe(d[l],t,e,s,r,i,o,n,a,ue),ie(h,ue.x,ue.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 pe(t,e,s,r,i,o,n,a,h,l),l}},{getPointAndSet:pe,toTwoPointBounds:_e,ellipse:fe}=ce,{sin:ge,cos:ye,sqrt:xe,atan2:me}=Math,{ellipse:we}=ce,be={ellipticalArc(e,s,r,i,o,n,a,d,u,c,p){const _=(u-s)/2,f=(c-r)/2,g=n*h,y=ge(g),x=ye(g),m=-x*_-y*f,w=-x*f+y*_,b=i*i,v=o*o,B=w*w,k=m*m,C=b*v-b*B-v*k;let T=0;if(C<0){const t=xe(1-C/(b*v));i*=t,o*=t}else T=(a===d?-1:1)*xe(C/(b*B+v*k));const P=T*i*w/o,O=-T*o*m/i,L=me((w-O)/o,(m-P)/i),R=me((-w-O)/o,(-m-P)/i);let S=R-L;0===d&&S>0?S-=l:1===d&&S<0&&(S+=l);const M=s+_+x*P-y*O,I=r+f+y*P+x*O,A=S<0?1:0;p||t.ellipseToCurve?we(e,M,I,i,o,n,L/h,R/h,A):i!==o||n?e.push(zt.G,M,I,i,o,n,L/h,R/h,A):e.push(zt.O,M,I,i,L/h,R/h,A)}},{M:ve,m:Be,L:ke,l:Ce,H:Te,h:Pe,V:Oe,v:Le,C:Re,c:Se,S:Me,s:Ie,Q:Ae,q:Ee,T:We,t:De,A:Ne,a:Ye,Z:Xe,z:ze,N:Fe,D:je,X:He,G:Ue,F:qe,O:Ge,P:Ve,U:Qe}=zt,{rect:Ze,roundRect:Je,arcTo:$e,arc:Ke,ellipse:ts,quadraticCurveTo:es}=ce,{ellipticalArc:ss}=be,rs=lt.get("PathConvert"),is={},os={current:{dot:0},stringify(t,e){let s,r,i,o=0,n=t.length,h="";for(;o<n;){r=t[o],s=Gt[r],h+=r===i?" ":qt[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?Ht:jt;for(let e=0,h=t.length;e<h;e++)r=t[e],ht[r]?("."===r&&(ns.dot++,ns.dot>1&&(as(n,o),o="")),o+=r):zt[r]?(o&&(as(n,o),o=""),ns.name=zt[r],ns.length=Ft[r],ns.index=0,as(n,ns.name),!s&&a[r]&&(s=!0)):"-"===r||"+"===r?"e"===i||"E"===i?o+=r:(o&&as(n,o),o=r):o&&(as(n,o),o=""),i=r;return o&&as(n,o),s?os.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 Be:t[u+1]+=a,t[u+2]+=h;case ve:a=t[u+1],h=t[u+2],p.push(ve,a,h),u+=3;break;case Pe:t[u+1]+=a;case Te:a=t[u+1],p.push(ke,a,h),u+=2;break;case Le:t[u+1]+=h;case Oe:h=t[u+1],p.push(ke,a,h),u+=2;break;case Ce:t[u+1]+=a,t[u+2]+=h;case ke:a=t[u+1],h=t[u+2],p.push(ke,a,h),u+=3;break;case Ie:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=Me;case Me:n=o===Re||o===Me,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(Re,l,d,s,r,a,h),u+=5;break;case Se: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=Re;case Re:s=t[u+3],r=t[u+4],a=t[u+5],h=t[u+6],p.push(Re,t[u+1],t[u+2],s,r,a,h),u+=7;break;case De:t[u+1]+=a,t[u+2]+=h,i=We;case We:n=o===Ae||o===We,s=n?2*a-s:t[u+1],r=n?2*h-r:t[u+2],e?es(p,a,h,s,r,t[u+1],t[u+2]):p.push(Ae,s,r,t[u+1],t[u+2]),a=t[u+1],h=t[u+2],u+=3;break;case Ee:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=Ae;case Ae:s=t[u+1],r=t[u+2],e?es(p,a,h,s,r,t[u+3],t[u+4]):p.push(Ae,s,r,t[u+3],t[u+4]),a=t[u+3],h=t[u+4],u+=5;break;case Ye:t[u+6]+=a,t[u+7]+=h;case Ne:ss(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 ze:case Xe:p.push(Xe),u++;break;case Fe:a=t[u+1],h=t[u+2],e?Ze(p,a,h,t[u+3],t[u+4]):hs(p,t,u,5),u+=5;break;case je:a=t[u+1],h=t[u+2],e?Je(p,a,h,t[u+3],t[u+4],[t[u+5],t[u+6],t[u+7],t[u+8]]):hs(p,t,u,9),u+=9;break;case He:a=t[u+1],h=t[u+2],e?Je(p,a,h,t[u+3],t[u+4],t[u+5]):hs(p,t,u,6),u+=6;break;case Ue:ts(e?p:hs(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,is),a=is.x,h=is.y,u+=9;break;case qe:e?ts(p,t[u+1],t[u+2],t[u+3],t[u+4],0,0,360,!1):hs(p,t,u,5),a=t[u+1]+t[u+3],h=t[u+2],u+=5;break;case Ge:Ke(e?p:hs(p,t,u,7),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],null,is),a=is.x,h=is.y,u+=7;break;case Ve:e?Ke(p,t[u+1],t[u+2],t[u+3],0,360,!1):hs(p,t,u,4),a=t[u+1]+t[u+3],h=t[u+2],u+=4;break;case Qe:$e(e?p:hs(p,t,u,6),a,h,t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],null,is),a=is.x,h=is.y,u+=6;break;default:return rs.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){ns.index===ns.length&&(ns.index=1,t.push(ns.name)),t.push(Number(e)),ns.index++,ns.dot=0}},{current:ns,pushData:as,copyData:hs}=os,{M:ls,L:ds,C:us,Q:cs,Z:ps,N:_s,D:fs,X:gs,G:ys,F:xs,O:ms,P:ws,U:bs}=zt,{getMinDistanceFrom:vs,getRadianFrom:Bs}=M,{tan:ks,min:Cs,abs:Ts}=Math,Ps={},Os={beginPath(t){t.length=0},moveTo(t,e,s){t.push(ls,e,s)},lineTo(t,e,s){t.push(ds,e,s)},bezierCurveTo(t,e,s,r,i,o,n){t.push(us,e,s,r,i,o,n)},quadraticCurveTo(t,e,s,r,i){t.push(cs,e,s,r,i)},closePath(t){t.push(ps)},rect(t,e,s,r,i){t.push(_s,e,s,r,i)},roundRect(t,e,s,r,i,o){if("number"==typeof o)t.push(gs,e,s,r,i,o);else{const n=a.fourNumber(o);n?t.push(fs,e,s,r,i,...n):t.push(_s,e,s,r,i)}},ellipse(t,e,s,r,i,o,n,a,h){void 0===o?t.push(xs,e,s,r,i):(void 0===n&&(n=0),void 0===a&&(a=360),t.push(ys,e,s,r,i,o,n,a,h?1:0))},arc(t,e,s,r,i,o,n){void 0===i?t.push(ws,e,s,r):(void 0===o&&(o=360),t.push(ms,e,s,r,i,o,n?1:0))},arcTo(t,e,s,r,i,o,n,a){if(void 0!==n){const h=ks(Bs(n,a,e,s,r,i)/2)*(vs(n,a,e,s,r,i)/2);t.push(bs,e,s,r,i,Cs(o,Ts(h)))}else t.push(bs,e,s,r,i,o)},drawEllipse(t,e,s,r,i,o,n,a,h){void 0===o&&(o=0),void 0===n&&(n=0),void 0===a&&(a=360),ce.ellipse(null,e,s,r,i,o,n,a,h,null,null,Ps),t.push(ls,Ps.x,Ps.y),Ls(t,e,s,r,i,o,n,a,h)},drawArc(t,e,s,r,i,o,n){void 0===i&&(i=0),void 0===o&&(o=360),ce.arc(null,e,s,r,i,o,n,null,null,Ps),t.push(ls,Ps.x,Ps.y),Rs(t,e,s,r,i,o,n)},drawPoints(t,e,s,r){ce.points(t,e,s,r)}},{ellipse:Ls,arc:Rs}=Os,{moveTo:Ss,lineTo:Ms,quadraticCurveTo:Is,bezierCurveTo:As,closePath:Es,beginPath:Ws,rect:Ds,roundRect:Ns,ellipse:Ys,arc:Xs,arcTo:zs,drawEllipse:Fs,drawArc:js,drawPoints:Hs}=Os;class Us{constructor(t){this.path=t?"string"==typeof t?Yt.parse(t):t:[]}beginPath(){return Ws(this.path),this}moveTo(t,e){return Ss(this.path,t,e),this}lineTo(t,e){return Ms(this.path,t,e),this}bezierCurveTo(t,e,s,r,i,o){return As(this.path,t,e,s,r,i,o),this}quadraticCurveTo(t,e,s,r){return Is(this.path,t,e,s,r),this}closePath(){return Es(this.path),this}rect(t,e,s,r){return Ds(this.path,t,e,s,r),this}roundRect(t,e,s,r,i){return Ns(this.path,t,e,s,r,i),this}ellipse(t,e,s,r,i,o,n,a){return Ys(this.path,t,e,s,r,i,o,n,a),this}arc(t,e,s,r,i,o){return Xs(this.path,t,e,s,r,i,o),this}arcTo(t,e,s,r,i){return zs(this.path,t,e,s,r,i),this}drawEllipse(t,e,s,r,i,o,n,a){return Fs(this.path,t,e,s,r,i,o,n,a),this}drawArc(t,e,s,r,i,o){return js(this.path,t,e,s,r,i,o),this}drawPoints(t,e,s){return Hs(this.path,t,e,s),this}}const{M:qs,L:Gs,C:Vs,Q:Qs,Z:Zs,N:Js,D:$s,X:Ks,G:tr,F:er,O:sr,P:rr,U:ir}=zt,or=lt.get("PathDrawer"),nr={drawPathByData(t,e){if(!e)return;let s,r=0,i=e.length;for(;r<i;)switch(s=e[r],s){case qs:t.moveTo(e[r+1],e[r+2]),r+=3;break;case Gs:t.lineTo(e[r+1],e[r+2]),r+=3;break;case Vs:t.bezierCurveTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5],e[r+6]),r+=7;break;case Qs:t.quadraticCurveTo(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case Zs:t.closePath(),r+=1;break;case Js:t.rect(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case $s: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 Ks:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;case tr: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 er:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,l,!1),r+=5;break;case sr: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 rr:t.arc(e[r+1],e[r+2],e[r+3],0,l,!1),r+=4;break;case ir:t.arcTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;default:return void or.error(`command: ${s} [index:${r}]`,e)}}},{M:ar,L:hr,C:lr,Q:dr,Z:ur,N:cr,D:pr,X:_r,G:fr,F:gr,O:yr,P:xr,U:mr}=zt,{toTwoPointBounds:wr,toTwoPointBoundsByQuadraticCurve:br,arcTo:vr,arc:Br,ellipse:kr}=ce,{addPointBounds:Cr,copy:Tr,addPoint:Pr,setPoint:Or,addBounds:Lr,toBounds:Rr}=W,Sr=lt.get("PathBounds");let Mr,Ir,Ar;const Er={},Wr={},Dr={},Nr={toBounds(t,e){Nr.toTwoPointBounds(t,Wr),Rr(Wr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Or(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===ur||s===lr||s===dr?Or(e,h,l):Or(e,t[a+1],t[a+2])),s){case ar:case hr:h=t[a+1],l=t[a+2],Pr(e,h,l),a+=3;break;case lr:o=t[a+5],n=t[a+6],wr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],o,n,Er),Cr(e,Er),h=o,l=n,a+=7;break;case dr:r=t[a+1],i=t[a+2],o=t[a+3],n=t[a+4],br(h,l,r,i,o,n,Er),Cr(e,Er),h=o,l=n,a+=5;break;case ur:a+=1;break;case cr:h=t[a+1],l=t[a+2],Lr(e,h,l,t[a+3],t[a+4]),a+=5;break;case pr:case _r:h=t[a+1],l=t[a+2],Lr(e,h,l,t[a+3],t[a+4]),a+=s===pr?9:6;break;case fr:kr(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],Er,Dr),0===a?Tr(e,Er):Cr(e,Er),h=Dr.x,l=Dr.y,a+=9;break;case gr:h=t[a+1],l=t[a+2],Ir=t[a+3],Ar=t[a+4],Lr(e,h-Ir,l-Ar,2*Ir,2*Ar),h+=Ir,a+=5;break;case yr:Br(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Er,Dr),0===a?Tr(e,Er):Cr(e,Er),h=Dr.x,l=Dr.y,a+=7;break;case xr:h=t[a+1],l=t[a+2],Mr=t[a+3],Lr(e,h-Mr,l-Mr,2*Mr,2*Mr),h+=Mr,a+=4;break;case mr:vr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Er,Dr),0===a?Tr(e,Er):Cr(e,Er),h=Dr.x,l=Dr.y,a+=6;break;default:return void Sr.error(`command: ${s} [index:${a}]`,t)}}},{M:Yr,L:Xr,C:zr,Z:Fr}=zt,{getCenterX:jr,getCenterY:Hr}=M,{arcTo:Ur}=Os,qr={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 Yr:a=u=t[i+1],h=c=t[i+2],i+=3,t[i]===Xr?(l=t[i+1],d=t[i+2],_.push(Yr,jr(a,l),Hr(h,d))):_.push(Yr,a,h);break;case Xr:switch(o=t[i+1],n=t[i+2],i+=3,t[i]){case Xr:Ur(_,o,n,t[i+1],t[i+2],e,u,c);break;case Fr:Ur(_,o,n,a,h,e,u,c);break;default:_.push(Xr,o,n)}u=o,c=n;break;case zr:_.push(zr,t[i+1],t[i+2],t[i+3],t[i+4],t[i+5],t[i+6]),i+=7;break;case Fr:Ur(_,a,h,l,d,e,u,c),_.push(Fr),i+=1}return r!==Fr&&(_[1]=a,_[2]=h),_}};Yt.creator=new Us,Yt.parse=os.parse,Yt.convertToCanvasData=os.toCanvasData;const{drawRoundRect:Gr}=Vt;const Vr=lt.get("TaskProcessor");class Qr{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return Ot(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){Vr.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class Zr{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&&bt.assign(this.config,t),this.empty()}add(t,e){let s,r,i,o;const n=new Qr(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 Jr={map:{},recycledList:[],tasker:new Zr,patternTasker:new Zr,get isComplete(){return $r.tasker.isComplete},get(t){let s=$r.map[t.url];return s||(s=e.image(t),$r.map[t.url]=s),s.use++,s},recycle(t){t.use--,setTimeout((()=>{t.use||$r.recycledList.push(t)}))},clearRecycled(){const t=$r.recycledList;t.length&&(t.forEach((t=>{!t.use&&t.url&&(delete $r.map[t.url],t.destroy())})),t.length=0)},hasOpacityPixel:t=>Ct.opacityTypes.some((e=>$r.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+Ct.mineType(t)))return!0}else if(s.includes("."+t)||s.includes("."+Ct.upperCaseTypeMap[t]))return!0;return!1},destroy(){$r.map={}}},$r=Jr,{IMAGE:Kr,create:ti}=s;function ei(t,e,s){Object.defineProperty(t,e,s)}function si(t,e){return Object.getOwnPropertyDescriptor(t,e)}function ri(t,e,s,r){const i={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)},configurable:!0,enumerable:!0};ei(t,e,Object.assign(i,r||{})),hi(t,e,s)}function ii(t){return(e,s)=>{ri(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__hasAutoLayout&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})}}const oi=ii;function ni(t){return(e,s)=>{ri(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.strokeChanged||this.__layout.strokeChange()}})}}const ai=ni;function hi(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},configurable:!0,enumerable:!0};void 0===s?n.get=function(){return this[i]}:"width"===e?n.get=function(){const t=this[i];return void 0===t?this.__naturalWidth||s:t}:"height"===e&&(n.get=function(){const t=this[i];return void 0===t?this.__naturalHeight||s:t});let a,h=r;for(;!a&&h;)a=si(h,e),h=h.__proto__;a&&a.set&&(n.set=a.set),r[o]&&(n.set=r[o],delete r[o]),Object.defineProperty(r,e,n)}const li=new lt("rewrite"),di=[],ui=["destroy","constructor"];function ci(t){di.length&&(di.forEach((e=>{t&&li.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),di.length=0)}function pi(t,e){return s=>{var r;(t.prototype?(r=t.prototype,Object.getOwnPropertyNames(r)):Object.keys(t)).forEach((r=>{if(!(ui.includes(r)||e&&e.includes(r)))if(t.prototype){si(t.prototype,r).writable&&(s.prototype[r]=t.prototype[r])}else s.prototype[r]=t[r]}))}}setTimeout((()=>ci(!0)));const _i=new E,{toOuterOf:fi,getPoints:gi,copy:yi}=$;class xi{get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}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"){switch(this.update(),t){case"world":return this.leaf.__world;case"local":return this.leaf.__localMatrix;case"inner":return b.defaultMatrix;default:return new E(this.leaf.__world).divideParent(t.__world)}}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);default:return new st(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"margin":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"margin":case"content":case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"content":if(this.contentBounds)return this.getWorldContentBounds();case"margin":case"box":return this.getWorldBoxBounds();case"margin":case"stroke":return this.getWorldStrokeBounds()}}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;default:i=r.getWorldPoint(n,e),o=_i.set(r.__world).divideParent(e.__world)}const a=b.getLayout(o);if(yi(a,n),M.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=gi(this.getInnerBounds(t));let i;switch(e){case"world":i=null;break;case"local":i=s.parent;break;case"inner":break;default:i=e}return void 0!==i&&r.forEach((t=>s.innerToWorld(t,null,!1,i))),r}getWorldContentBounds(){return this._worldContentBounds||(this._worldContentBounds={}),fi(this.contentBounds,this.leaf.__world,this._worldContentBounds),this._worldContentBounds}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),fi(this.boxBounds,this.leaf.__world,this._worldBoxBounds),this._worldBoxBounds}getWorldStrokeBounds(){return this._worldStrokeBounds||(this._worldStrokeBounds={}),fi(this.strokeBounds,this.leaf.__world,this._worldStrokeBounds),this._worldStrokeBounds}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}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}}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 mi={},wi={on(t,e,s){let r,i,o;s&&("boolean"==typeof s?r=s:(r=s.capture,i=s.once));const n=bi(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){let r,i,o;s&&(r="boolean"==typeof s?s:s.capture);const n=bi(this,r);("string"==typeof t?t.split(" "):t).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]))}))},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&&mt.has(t)&&(e=mt.get(t,{type:t,target:this,current:this}));const r=bi(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++);}},emitEvent(t,e){t.current=this,this.emit(t.type,t,e)},hasEvent(t,e){const{__bubbleMap:s,__captureMap:r}=this,i=s&&s[t],o=r&&r[t];return!!(void 0===e?i||o:e?o:i)}};function bi(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:mi)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:mi)}}class vi{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 Bi extends vi{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}Bi.ADD="child.add",Bi.REMOVE="child.remove";class ki extends vi{constructor(t,e,s,r,i){super(t,e),this.attrName=s,this.oldValue=r,this.newValue=i}}ki.CHANGE="property.change",ki.LEAFER_CHANGE="property.leafer_change";class Ci extends vi{constructor(t,e){super(t),Object.assign(this,e)}}Ci.LOAD="image.load",Ci.LOADED="image.loaded",Ci.ERROR="image.error";class Ti extends vi{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(Ti.RESIZE),Object.assign(this,t)):super(t),this.old=e}}Ti.RESIZE="resize";class Pi extends vi{constructor(t,e){super(t),this.data=e}}Pi.REQUEST="watch.request",Pi.DATA="watch.data";class Oi extends vi{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}Oi.CHECK_UPDATE="layout.check_update",Oi.REQUEST="layout.request",Oi.START="layout.start",Oi.BEFORE="layout.before",Oi.LAYOUT="layout",Oi.AFTER="layout.after",Oi.AGAIN="layout.again",Oi.END="layout.end";class Li extends vi{}Li.FRAME="animate.frame";class Ri extends vi{constructor(t,e,s,r){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=r)}}Ri.REQUEST="render.request",Ri.START="render.start",Ri.BEFORE="render.before",Ri.RENDER="render",Ri.AFTER="render.after",Ri.AGAIN="render.again",Ri.END="render.end",Ri.NEXT="render.next";class Si extends vi{}Si.START="leafer.start",Si.BEFORE_READY="leafer.before_ready",Si.READY="leafer.ready",Si.AFTER_READY="leafer.after_ready",Si.VIEW_READY="leafer.view_ready",Si.VIEW_COMPLETED="leafer.view_completed",Si.STOP="leafer.stop",Si.RESTART="leafer.restart",Si.END="leafer.end";const Mi={__setAttr(t,e){if(this.leafer&&this.leafer.created){const s=this.__.__getInput(t);if("object"==typeof e||s!==e){this.__[t]=e,this.__proxyData&&this.setProxyAttr(t,e);const{CHANGE:r}=ki,i=new ki(r,this,t,s,e);this.isLeafer?this.emitEvent(new ki(ki.LEAFER_CHANGE,this,t,s,e)):this.hasEvent(r)&&this.emitEvent(i),this.leafer.emitEvent(i)}}else this.__[t]=e,this.__proxyData&&this.setProxyAttr(t,e)},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Ii,multiplyParent:Ai,translateInner:Ei,defaultWorld:Wi}=b,{toPoint:Di,tempPoint:Ni}=nt,Yi={__updateWorldMatrix(){Ai(this.__local||this.__layout,this.parent?this.parent.__world:Wi,this.__world,!!this.__layout.affectScaleOrRotation,this.__)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged||t.rotationChanged)&&(Ii(e,s,null,t.affectRotation),t.scaleChanged=t.rotationChanged=!1),e.e=s.x,e.f=s.y,s.around&&(Di(s.around,t.boxBounds,Ni),Ei(e,-Ni.x,-Ni.y))}this.__layout.matrixChanged=!1}},{copy:Xi,toInnerPoint:zi,scaleOfOuter:Fi,rotateOfOuter:ji,skewOfOuter:Hi,multiplyParent:Ui,divideParent:qi,getLayout:Gi}=b,Vi={},Qi={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),$i(t,e,s),t.isBranch){const{children:r}=t;for(let t=0,i=r.length;t<i;t++)Ji(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++)Ki(e[t])}},updateAllChange(t){if(Ki(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)to(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},moveWorld(t,e,s){const r={x:e,y:s};t.parent&&zi(t.parent.worldTransform,r,r,!0),Zi.moveLocal(t,r.x,r.y)},moveLocal(t,e,s=0){t.x+=e,t.y+=s},zoomOfWorld(t,e,s,r,i){Zi.zoomOfLocal(t,so(t,e),s,r,i)},zoomOfLocal(t,e,s,r=s,i){Xi(Vi,t.__localMatrix),Fi(Vi,e,s,r),eo(t,Vi),t.scaleResize(s,r,!0!==i)},rotateOfWorld(t,e,s){Zi.rotateOfLocal(t,so(t,e),s)},rotateOfLocal(t,e,s){Xi(Vi,t.__localMatrix),ji(Vi,e,s),eo(t,Vi),t.rotation=a.formatRotation(t.rotation+s)},skewOfWorld(t,e,s,r,i){Zi.skewOfLocal(t,so(t,e),s,r,i)},skewOfLocal(t,e,s,r=0,i){Xi(Vi,t.__localMatrix),Hi(Vi,e,s,r),Zi.setTransform(t,Vi,i)},transformWorld(t,e,s){Xi(Vi,t.worldTransform),Ui(Vi,e),t.parent&&qi(Vi,t.parent.worldTransform),Zi.setTransform(t,Vi,s)},transform(t,e,s){Xi(Vi,t.localTransform),Ui(Vi,e),Zi.setTransform(t,Vi,s)},setTransform(t,e,s){const r=Gi(e);s&&(t.scaleResize(r.scaleX/t.scaleX,r.scaleY/t.scaleY,!0!==s),delete r.scaleX,delete r.scaleY),t.set(r)},drop(t,e,s,r){Xi(Vi,t.worldTransform),qi(Vi,e.worldTransform),t.setTransform(Vi,r),e.add(t,s)},hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},hasParentAutoLayout(t){for(;t.parent;)if((t=t.parent).__hasAutoLayout)return!0}},Zi=Qi,{updateAllMatrix:Ji,updateMatrix:$i,updateAllWorldOpacity:Ki,updateAllChange:to}=Zi;function eo(t,e){const{e:s,f:r}=t.__localMatrix;t.x+=e.e-s,t.y+=e.f-r}function so(t,e){return t.__layout.update(),t.parent?M.tempToInnerOf(e,t.parent.__world):e}const ro={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser?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:io}=Qi,oo={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),no(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++)ao(e[t],e)},updateBounds(t,e){const s=[t];ao(t,s),ho(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++)io(r[t]);e&&e===s||io(s)}}},{pushAllChildBranch:no,pushAllBranchStack:ao,updateBoundsByBranchStack:ho}=oo,lo={run(t){if(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)}}},{updateMatrix:uo,updateAllMatrix:co,hasParentAutoLayout:po}=Qi,{updateBounds:_o}=oo,{toOuterOf:fo,copyAndSpread:go}=$,yo={__updateWorldBounds(){fo(this.__layout.renderBounds,this.__world,this.__world),this.__layout.resized&&(this.__onUpdateSize(),this.__layout.resized=!1)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.boxChanged=!1,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.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.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(),fo(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){fo(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){fo(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,{width:e,height:s}=this.__;t.x=0,t.y=0,t.width=e,t.height=s},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.leafer&&this.leafer.layouter.addExtra(this),po(this)?uo(this):(co(this),_o(this,this))):uo(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){go(this.__layout.strokeBounds,this.__layout.boxBounds,this.__layout.strokeSpread)},__updateRenderBounds(){go(this.__layout.renderBounds,this.__layout.strokeBounds,this.__layout.renderSpread)}},xo={__render(t,e){if(this.__worldOpacity)if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=this.__.opacity,this.__.__single){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:mo}=ro,wo={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__worldOpacity)if(this.__.__single){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++)mo(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++)mo(s[r],e)||s[r].__clip(t,e)}}},{LEAF:bo,create:vo}=s,{toInnerPoint:Bo,toOuterPoint:ko,multiplyParent:Co}=b,{toOuterOf:To}=$,{tempToOuterOf:Po,copy:Oo}=M,{moveLocal:Lo,zoomOfLocal:Ro,rotateOfLocal:So,skewOfLocal:Mo,transform:Io,setTransform:Ao,drop:Eo}=Qi;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 Bt}get __LayoutProcessor(){return xi}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}constructor(t){this.innerId=vo(bo),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.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t){this.parent?t():this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}waitLeafer(t){this.leafer?t():this.__leaferWait?this.__leaferWait.push(t):this.__leaferWait=[t]}nextRender(t,e){this.leafer?this.leafer.nextRender(t,e):this.waitLeafer((()=>this.leafer.nextRender(t,e)))}__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&&lo.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(){}toJSON(){return this.__.__getInputData()}toString(){return JSON.stringify(this.toJSON())}__setAttr(t,e){}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findOne(t,e){}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}updateLayout(){this.__layout.update()}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateAutoLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some((t=>t.__.eraser))}__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 Co(this.__world,t.matrix,e,void 0,this.__world),To(this.__layout.renderBounds,e,e),e}return this.__world}getWorld(t){return this.__layout.update(),"x"===t?this.__world.e:"y"===t?this.__world.f:this.getLayoutBounds()[t]}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)}worldToLocal(t,e,s,r){this.parent?this.parent.worldToInner(t,e,s,r):e&&Oo(e,t)}localToWorld(t,e,s,r){this.parent?this.parent.innerToWorld(t,e,s,r):e&&Oo(e,t)}worldToInner(t,e,s,r){r&&(r.innerToWorld(t,e,s),t=e||t),Bo(this.worldTransform,t,e,s)}innerToWorld(t,e,s,r){ko(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){Ao(this,t,e)}transform(t,e){Io(this,t,e)}move(t,e){Lo(this,t,e)}scaleOf(t,e,s,r){Ro(this,Po(t,this.localTransform),e,s,r)}rotateOf(t,e){So(this,Po(t,this.localTransform),e)}skewOf(t,e,s,r){Mo(this,Po(t,this.localTransform),e,s,r)}scaleResize(t,e=t,s){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t,e){var s;return null===(s=this.__hitCanvas)||void 0===s?void 0:s.hitFill(t,e)}__hitStroke(t,e){var s;return null===(s=this.__hitCanvas)||void 0===s?void 0:s.hitStroke(t,e)}__drawHitPath(t){t&&this.__drawRenderPath(t)}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e){}__clip(t,e){}__renderShape(t,e){}__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){hi(this.prototype,t,e)}static addAttr(t,e,s){s||(s=ii),s(e)(this.prototype,t)}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.removeAll(!0),this.__.destroy(),this.__layout.destroy(),this.__captureMap=this.__bubbleMap=this.__parentWait=this.__leaferWait=null,this.destroyed=!0)}},exports.Leaf=Pt([pi(Mi),pi(Yi),pi(yo),pi(wi),pi(xo)],exports.Leaf);const{setListWithFn:Wo}=$,{sort:Do}=oo,{localBoxBounds:No,localStrokeBounds:Yo,localRenderBounds:Xo,maskLocalBoxBounds:zo,maskLocalStrokeBounds:Fo,maskLocalRenderBounds:jo}=ro;exports.Branch=class extends exports.Leaf{constructor(){super(),this.isBranch=!0,this.children=[]}__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(){Wo(this.__layout.boxBounds,this.children,this.__hasMask?zo:No)}__updateStrokeBounds(){Wo(this.__layout.strokeBounds,this.children,this.__hasMask?Fo:Yo)}__updateRenderBounds(){Wo(this.__layout.renderBounds,this.children,this.__hasMask?jo:Xo)}__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(Do),this.__layout.affectChildrenSort=t}}add(t,e){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.boundsChanged||t.__layout.matrixChange(),t.__parentWait&&lo.run(t.__parentWait),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Bi.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(Bi.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new Bi(t,e,this);e.hasEvent(t)&&e.emitEvent(s),this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}},exports.Branch=Pt([pi(wo)],exports.Branch);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()}}exports.AnimateEvent=Li,exports.AroundHelper=nt,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 st(i,e,o||t.width-i-s,n||t.height-e-r)}},exports.BezierHelper=ce,exports.Bounds=st,exports.BoundsHelper=$,exports.BranchHelper=oo,exports.BranchRender=wo,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=Bi,exports.Creator=e,exports.DataHelper=bt,exports.Debug=lt,exports.EllipseHelper=be,exports.Event=vi,exports.EventCreator=mt,exports.FileHelper=Ct,exports.ImageEvent=Ci,exports.ImageManager=Jr,exports.IncrementId=s,exports.LayoutEvent=Oi,exports.LeafBounds=yo,exports.LeafBoundsHelper=ro,exports.LeafData=Bt,exports.LeafDataProxy=Mi,exports.LeafEventer=wi,exports.LeafHelper=Qi,exports.LeafLayout=xi,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=Ho,exports.LeafMatrix=Yi,exports.LeafRender=xo,exports.LeaferCanvasBase=class extends It{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=Wt),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(){this.context=this.view.getContext("2d"),this.__bindContext()}export(t,e){const{quality:s,blob:r}=Ct.getExportOptions(e);return t.includes(".")?this.saveAs(t,s):r?this.toBlob(t,s):this.toDataURL(t,s)}toBlob(e,s){return new Promise((r=>{t.origin.canvasToBolb(this.view,e,s).then((t=>{r(t)})).catch((t=>{Dt.error(t),r(null)}))}))}toDataURL(e,s){return t.origin.canvasToDataURL(this.view,e,s)}saveAs(e,s){return new Promise((r=>{t.origin.canvasSaveAs(this.view,e,s).then((()=>{r(!0)})).catch((t=>{Dt.error(t),r(!1)}))}))}resize(t){if(this.isSameSize(t))return;let e;this.context&&!this.unreal&&this.width&&(e=this.getSameCanvas(),e.copyWorld(this)),bt.copyAttrs(this.size,t,Nt),this.size.pixelRatio||(this.size.pixelRatio=1),this.bounds=new st(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(){}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=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 e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)}hitStroke(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)}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,$.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,Et.set(t).scale(this.pixelRatio),this.fillRect(Et.x,Et.y,Et.width,Et.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,Et.set(t).scale(this.pixelRatio),this.strokeRect(Et.x,Et.y,Et.width,Et.height),s&&(this.blendMode="source-over")}clearWorld(t,e){Et.set(t).scale(this.pixelRatio),e&&Et.ceil(),this.clearRect(Et.x,Et.y,Et.width,Et.height)}clipWorld(t,e){this.beginPath(),Et.set(t).scale(this.pixelRatio),e&&Et.ceil(),this.rect(Et.x,Et.y,Et.width,Et.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t,this.height*t)}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&&(At(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=Si,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=ti(Kr),this.config=t||{url:""},this.isSVG=Jr.isFormat("svg",t),this.hasOpacityPixel=Jr.hasOpacityPixel(t)}load(e,s){return this.loading||(this.loading=!0,Jr.tasker.add((()=>Ot(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=E,exports.MatrixHelper=b,exports.NeedConvertToCanvasCommandMap=jt,exports.OneRadian=h,exports.PI2=l,exports.PI_2=d,exports.PathBounds=Nr,exports.PathCommandDataHelper=Os,exports.PathCommandMap=zt,exports.PathConvert=os,exports.PathCorner=qr,exports.PathCreator=Us,exports.PathDrawer=nr,exports.PathHelper=Yt,exports.PathNumberCommandLengthMap=Gt,exports.PathNumberCommandMap=qt,exports.Platform=t,exports.Point=A,exports.PointHelper=M,exports.PropertyEvent=ki,exports.RectHelper=Vt,exports.RenderEvent=Ri,exports.ResizeEvent=Ti,exports.Run=pt,exports.StringNumberMap=ht,exports.TaskItem=Qr,exports.TaskProcessor=Zr,exports.TwoPointBoundsHelper=W,exports.UICreator=gt,exports.WaitHelper=lo,exports.WatchEvent=Pi,exports.affectRenderBoundsType=function(t){return(e,s)=>{ri(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.renderChanged||this.__layout.renderChange()}})}},exports.affectStrokeBoundsType=ni,exports.autoLayoutType=function(t){return(e,s)=>{ri(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.matrixChanged||this.__layout.matrixChange(),this.__hasAutoLayout=!!t,this.__local||this.__layout.createLocal()}})}},exports.boundsType=ii,exports.canvasPatch=function(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,r,i){Gr(this,t,e,s,r,i)})}(t)},exports.canvasSizeAttrs=Nt,exports.cursorType=function(t){return(e,s)=>{ri(e,s,t,{set(t){this.__setAttr(s,t),this.leafer&&this.leafer.updateCursor()}})}},exports.dataProcessor=function(t){return(e,s)=>{ei(e,"__DataProcessor",{get:()=>t})}},exports.dataType=function(t){return(e,s)=>{ri(e,s,t)}},exports.defineDataProcessor=hi,exports.defineKey=ei,exports.defineLeafAttr=ri,exports.eraserType=function(t){return(e,s)=>{ri(e,s,t,{set(t){this.__setAttr(s,t),this.waitParent((()=>{this.parent.__updateEraser(t)}))}})}},exports.getBoundsData=c,exports.getDescriptor=si,exports.getMatrixData=p,exports.getPointData=u,exports.hitType=function(t){return(e,s)=>{ri(e,s,t,{set(t){this.__setAttr(s,t),lt.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor()}})}},exports.layoutProcessor=function(t){return(e,s)=>{ei(e,"__LayoutProcessor",{get:()=>t})}},exports.maskType=function(t){return(e,s)=>{ri(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(t)}))}})}},exports.opacityType=function(t){return(e,s)=>{ri(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.opacityChanged||this.__layout.opacityChange()}})}},exports.pathType=oi,exports.positionType=function(t){return(e,s)=>{ri(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.matrixChanged||this.__layout.matrixChange()}})}},exports.registerUI=function(){return t=>{gt.register(t)}},exports.registerUIEvent=function(){return t=>{mt.register(t)}},exports.rewrite=function(t){return(e,s)=>{di.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}},exports.rewriteAble=function(){return t=>{ci()}},exports.rotationType=function(t){return(e,s)=>{ri(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}})}},exports.scaleType=function(t){return(e,s)=>{ri(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}})}},exports.sortType=function(t){return(e,s)=>{ri(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()}))}})}},exports.strokeType=ai,exports.surfaceType=function(t){return(e,s)=>{ri(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}})}},exports.useModule=pi;
package/package.json CHANGED
@@ -1,20 +1,21 @@
1
1
  {
2
2
  "name": "@leafer/core",
3
- "version": "1.0.0-rc.1",
3
+ "version": "1.0.0-rc.10",
4
4
  "description": "@leafer/core",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
- "main": "dist/core.esm.js",
8
+ "main": "lib/core.esm.js",
9
9
  "exports": {
10
- "import": "./dist/core.esm.js",
11
- "require": "./dist/core.cjs"
10
+ "import": "./lib/core.esm.js",
11
+ "require": "./lib/core.cjs",
12
+ "types": "./types/index.d.ts"
12
13
  },
13
14
  "types": "types/index.d.ts",
14
15
  "files": [
15
16
  "src",
16
17
  "types",
17
- "dist"
18
+ "lib"
18
19
  ],
19
20
  "repository": {
20
21
  "type": "git",
@@ -28,25 +29,22 @@
28
29
  "leaferjs"
29
30
  ],
30
31
  "dependencies": {
31
- "@leafer/interaction": "1.0.0-rc.1",
32
- "@leafer/canvas": "1.0.0-rc.1",
33
- "@leafer/image": "1.0.0-rc.1",
34
- "@leafer/data": "1.0.0-rc.1",
35
- "@leafer/debug": "1.0.0-rc.1",
36
- "@leafer/decorator": "1.0.0-rc.1",
37
- "@leafer/display": "1.0.0-rc.1",
38
- "@leafer/display-module": "1.0.0-rc.1",
39
- "@leafer/event": "1.0.0-rc.1",
40
- "@leafer/event-ui": "1.0.0-rc.1",
41
- "@leafer/file": "1.0.0-rc.1",
42
- "@leafer/helper": "1.0.0-rc.1",
43
- "@leafer/layout": "1.0.0-rc.1",
44
- "@leafer/list": "1.0.0-rc.1",
45
- "@leafer/math": "1.0.0-rc.1",
46
- "@leafer/path": "1.0.0-rc.1",
47
- "@leafer/platform": "1.0.0-rc.1",
48
- "@leafer/plugin": "1.0.0-rc.1",
49
- "@leafer/task": "1.0.0-rc.1",
50
- "@leafer/interface": "1.0.0-rc.1"
32
+ "@leafer/canvas": "1.0.0-rc.10",
33
+ "@leafer/image": "1.0.0-rc.10",
34
+ "@leafer/data": "1.0.0-rc.10",
35
+ "@leafer/debug": "1.0.0-rc.10",
36
+ "@leafer/decorator": "1.0.0-rc.10",
37
+ "@leafer/display": "1.0.0-rc.10",
38
+ "@leafer/display-module": "1.0.0-rc.10",
39
+ "@leafer/event": "1.0.0-rc.10",
40
+ "@leafer/file": "1.0.0-rc.10",
41
+ "@leafer/helper": "1.0.0-rc.10",
42
+ "@leafer/layout": "1.0.0-rc.10",
43
+ "@leafer/list": "1.0.0-rc.10",
44
+ "@leafer/math": "1.0.0-rc.10",
45
+ "@leafer/path": "1.0.0-rc.10",
46
+ "@leafer/platform": "1.0.0-rc.10",
47
+ "@leafer/task": "1.0.0-rc.10",
48
+ "@leafer/interface": "1.0.0-rc.10"
51
49
  }
52
50
  }
package/src/index.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export * from '@leafer/canvas'
2
2
  export * from '@leafer/image'
3
- export * from '@leafer/interaction'
4
3
 
5
4
  export * from '@leafer/data'
6
5
  export * from '@leafer/debug'
@@ -9,7 +8,6 @@ export * from '@leafer/display'
9
8
  export * from '@leafer/display-module'
10
9
 
11
10
  export * from '@leafer/event'
12
- export * from '@leafer/event-ui'
13
11
 
14
12
  export * from '@leafer/file'
15
13
  export * from '@leafer/helper'
@@ -19,6 +17,5 @@ export * from '@leafer/math'
19
17
 
20
18
  export * from '@leafer/path'
21
19
  export * from '@leafer/platform'
22
- export * from '@leafer/plugin'
23
20
 
24
21
  export * from '@leafer/task'
package/types/index.d.ts CHANGED
@@ -1,13 +1,11 @@
1
1
  export * from '@leafer/canvas';
2
2
  export * from '@leafer/image';
3
- export * from '@leafer/interaction';
4
3
  export * from '@leafer/data';
5
4
  export * from '@leafer/debug';
6
5
  export * from '@leafer/decorator';
7
6
  export * from '@leafer/display';
8
7
  export * from '@leafer/display-module';
9
8
  export * from '@leafer/event';
10
- export * from '@leafer/event-ui';
11
9
  export * from '@leafer/file';
12
10
  export * from '@leafer/helper';
13
11
  export * from '@leafer/layout';
@@ -15,5 +13,4 @@ export * from '@leafer/list';
15
13
  export * from '@leafer/math';
16
14
  export * from '@leafer/path';
17
15
  export * from '@leafer/platform';
18
- export * from '@leafer/plugin';
19
16
  export * from '@leafer/task';