@leafer/core 1.10.1 → 1.11.1

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