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