@leafer/core 1.6.5 → 1.6.6

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