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