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