@leafer/core 1.0.3 → 1.0.5
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 +20 -10
- package/lib/core.esm.js +20 -10
- package/lib/core.esm.min.js +1 -1
- package/lib/core.min.cjs +1 -1
- package/package.json +17 -17
- package/src/index.ts +1 -1
- package/types/index.d.ts +1 -1
package/lib/core.cjs
CHANGED
|
@@ -4485,15 +4485,16 @@ class LeafLayout {
|
|
|
4485
4485
|
}
|
|
4486
4486
|
getLayoutBounds(type, relative = 'world', unscale) {
|
|
4487
4487
|
const { leaf } = this;
|
|
4488
|
-
let point, matrix, bounds = this.getInnerBounds(type);
|
|
4488
|
+
let point, matrix, layoutBounds, bounds = this.getInnerBounds(type);
|
|
4489
4489
|
switch (relative) {
|
|
4490
4490
|
case 'world':
|
|
4491
4491
|
point = leaf.getWorldPoint(bounds);
|
|
4492
4492
|
matrix = leaf.__world;
|
|
4493
4493
|
break;
|
|
4494
4494
|
case 'local':
|
|
4495
|
+
const { scaleX, scaleY, rotation, skewX, skewY } = leaf.__;
|
|
4496
|
+
layoutBounds = { scaleX, scaleY, rotation, skewX, skewY };
|
|
4495
4497
|
point = leaf.getLocalPointByInner(bounds);
|
|
4496
|
-
matrix = leaf.__localMatrix;
|
|
4497
4498
|
break;
|
|
4498
4499
|
case 'inner':
|
|
4499
4500
|
point = bounds;
|
|
@@ -4505,7 +4506,8 @@ class LeafLayout {
|
|
|
4505
4506
|
point = leaf.getWorldPoint(bounds, relative);
|
|
4506
4507
|
matrix = getRelativeWorld$1(leaf, relative, true);
|
|
4507
4508
|
}
|
|
4508
|
-
|
|
4509
|
+
if (!layoutBounds)
|
|
4510
|
+
layoutBounds = MatrixHelper.getLayout(matrix);
|
|
4509
4511
|
copy$2(layoutBounds, bounds);
|
|
4510
4512
|
PointHelper.copy(layoutBounds, point);
|
|
4511
4513
|
if (unscale) {
|
|
@@ -4755,6 +4757,7 @@ class RenderEvent extends Event {
|
|
|
4755
4757
|
}
|
|
4756
4758
|
}
|
|
4757
4759
|
RenderEvent.REQUEST = 'render.request';
|
|
4760
|
+
RenderEvent.CHILD_START = 'render.child_start';
|
|
4758
4761
|
RenderEvent.START = 'render.start';
|
|
4759
4762
|
RenderEvent.BEFORE = 'render.before';
|
|
4760
4763
|
RenderEvent.RENDER = 'render';
|
|
@@ -4930,7 +4933,7 @@ const { isFinite } = Number;
|
|
|
4930
4933
|
const debug = Debug.get('setAttr');
|
|
4931
4934
|
const LeafDataProxy = {
|
|
4932
4935
|
__setAttr(name, newValue, checkFiniteNumber) {
|
|
4933
|
-
if (this.
|
|
4936
|
+
if (this.leaferIsCreated) {
|
|
4934
4937
|
const oldValue = this.__.__getInput(name);
|
|
4935
4938
|
if (checkFiniteNumber && !isFinite(newValue) && newValue !== undefined) {
|
|
4936
4939
|
debug.warn(this.innerName, name, newValue);
|
|
@@ -5085,7 +5088,7 @@ const LeafBounds = {
|
|
|
5085
5088
|
const b = this.__layout.boxBounds;
|
|
5086
5089
|
const data = this.__;
|
|
5087
5090
|
if (data.__pathInputed) {
|
|
5088
|
-
toBounds(data.
|
|
5091
|
+
toBounds(data.path, b);
|
|
5089
5092
|
}
|
|
5090
5093
|
else {
|
|
5091
5094
|
b.x = 0;
|
|
@@ -5097,7 +5100,7 @@ const LeafBounds = {
|
|
|
5097
5100
|
__updateAutoLayout() {
|
|
5098
5101
|
this.__layout.matrixChanged = true;
|
|
5099
5102
|
if (this.isBranch) {
|
|
5100
|
-
if (this.
|
|
5103
|
+
if (this.leaferIsReady)
|
|
5101
5104
|
this.leafer.layouter.addExtra(this);
|
|
5102
5105
|
if (this.__.flow) {
|
|
5103
5106
|
if (this.__layout.boxChanged)
|
|
@@ -5232,6 +5235,8 @@ exports.Leaf = class Leaf {
|
|
|
5232
5235
|
get innerName() { return this.__.name || this.tag + this.innerId; }
|
|
5233
5236
|
get __DataProcessor() { return LeafData; }
|
|
5234
5237
|
get __LayoutProcessor() { return LeafLayout; }
|
|
5238
|
+
get leaferIsCreated() { return this.leafer && this.leafer.created; }
|
|
5239
|
+
get leaferIsReady() { return this.leafer && this.leafer.ready; }
|
|
5235
5240
|
get isLeafer() { return false; }
|
|
5236
5241
|
get isBranch() { return false; }
|
|
5237
5242
|
get isBranchLeaf() { return false; }
|
|
@@ -5673,6 +5678,7 @@ exports.Branch = class Branch extends exports.Leaf {
|
|
|
5673
5678
|
add(child, index) {
|
|
5674
5679
|
if (child === this)
|
|
5675
5680
|
return;
|
|
5681
|
+
child.__ || (child = UICreator.get(child.tag, child));
|
|
5676
5682
|
if (child.parent)
|
|
5677
5683
|
child.parent.remove(child);
|
|
5678
5684
|
child.parent = this;
|
|
@@ -5695,10 +5701,14 @@ exports.Branch = class Branch extends exports.Leaf {
|
|
|
5695
5701
|
}
|
|
5696
5702
|
remove(child, destroy) {
|
|
5697
5703
|
if (child) {
|
|
5698
|
-
if (child.
|
|
5699
|
-
|
|
5704
|
+
if (child.__) {
|
|
5705
|
+
if (child.animationOut)
|
|
5706
|
+
child.__runAnimation('out', () => this.__remove(child, destroy));
|
|
5707
|
+
else
|
|
5708
|
+
this.__remove(child, destroy);
|
|
5709
|
+
}
|
|
5700
5710
|
else
|
|
5701
|
-
this.
|
|
5711
|
+
this.find(child).forEach(item => this.remove(item, destroy));
|
|
5702
5712
|
}
|
|
5703
5713
|
else if (child === undefined) {
|
|
5704
5714
|
super.remove(null, destroy);
|
|
@@ -5916,7 +5926,7 @@ class LeafLevelList {
|
|
|
5916
5926
|
}
|
|
5917
5927
|
}
|
|
5918
5928
|
|
|
5919
|
-
const version = "1.0.
|
|
5929
|
+
const version = "1.0.5";
|
|
5920
5930
|
|
|
5921
5931
|
exports.AlignHelper = AlignHelper;
|
|
5922
5932
|
exports.AroundHelper = AroundHelper;
|
package/lib/core.esm.js
CHANGED
|
@@ -4483,15 +4483,16 @@ class LeafLayout {
|
|
|
4483
4483
|
}
|
|
4484
4484
|
getLayoutBounds(type, relative = 'world', unscale) {
|
|
4485
4485
|
const { leaf } = this;
|
|
4486
|
-
let point, matrix, bounds = this.getInnerBounds(type);
|
|
4486
|
+
let point, matrix, layoutBounds, bounds = this.getInnerBounds(type);
|
|
4487
4487
|
switch (relative) {
|
|
4488
4488
|
case 'world':
|
|
4489
4489
|
point = leaf.getWorldPoint(bounds);
|
|
4490
4490
|
matrix = leaf.__world;
|
|
4491
4491
|
break;
|
|
4492
4492
|
case 'local':
|
|
4493
|
+
const { scaleX, scaleY, rotation, skewX, skewY } = leaf.__;
|
|
4494
|
+
layoutBounds = { scaleX, scaleY, rotation, skewX, skewY };
|
|
4493
4495
|
point = leaf.getLocalPointByInner(bounds);
|
|
4494
|
-
matrix = leaf.__localMatrix;
|
|
4495
4496
|
break;
|
|
4496
4497
|
case 'inner':
|
|
4497
4498
|
point = bounds;
|
|
@@ -4503,7 +4504,8 @@ class LeafLayout {
|
|
|
4503
4504
|
point = leaf.getWorldPoint(bounds, relative);
|
|
4504
4505
|
matrix = getRelativeWorld$1(leaf, relative, true);
|
|
4505
4506
|
}
|
|
4506
|
-
|
|
4507
|
+
if (!layoutBounds)
|
|
4508
|
+
layoutBounds = MatrixHelper.getLayout(matrix);
|
|
4507
4509
|
copy$2(layoutBounds, bounds);
|
|
4508
4510
|
PointHelper.copy(layoutBounds, point);
|
|
4509
4511
|
if (unscale) {
|
|
@@ -4753,6 +4755,7 @@ class RenderEvent extends Event {
|
|
|
4753
4755
|
}
|
|
4754
4756
|
}
|
|
4755
4757
|
RenderEvent.REQUEST = 'render.request';
|
|
4758
|
+
RenderEvent.CHILD_START = 'render.child_start';
|
|
4756
4759
|
RenderEvent.START = 'render.start';
|
|
4757
4760
|
RenderEvent.BEFORE = 'render.before';
|
|
4758
4761
|
RenderEvent.RENDER = 'render';
|
|
@@ -4928,7 +4931,7 @@ const { isFinite } = Number;
|
|
|
4928
4931
|
const debug = Debug.get('setAttr');
|
|
4929
4932
|
const LeafDataProxy = {
|
|
4930
4933
|
__setAttr(name, newValue, checkFiniteNumber) {
|
|
4931
|
-
if (this.
|
|
4934
|
+
if (this.leaferIsCreated) {
|
|
4932
4935
|
const oldValue = this.__.__getInput(name);
|
|
4933
4936
|
if (checkFiniteNumber && !isFinite(newValue) && newValue !== undefined) {
|
|
4934
4937
|
debug.warn(this.innerName, name, newValue);
|
|
@@ -5083,7 +5086,7 @@ const LeafBounds = {
|
|
|
5083
5086
|
const b = this.__layout.boxBounds;
|
|
5084
5087
|
const data = this.__;
|
|
5085
5088
|
if (data.__pathInputed) {
|
|
5086
|
-
toBounds(data.
|
|
5089
|
+
toBounds(data.path, b);
|
|
5087
5090
|
}
|
|
5088
5091
|
else {
|
|
5089
5092
|
b.x = 0;
|
|
@@ -5095,7 +5098,7 @@ const LeafBounds = {
|
|
|
5095
5098
|
__updateAutoLayout() {
|
|
5096
5099
|
this.__layout.matrixChanged = true;
|
|
5097
5100
|
if (this.isBranch) {
|
|
5098
|
-
if (this.
|
|
5101
|
+
if (this.leaferIsReady)
|
|
5099
5102
|
this.leafer.layouter.addExtra(this);
|
|
5100
5103
|
if (this.__.flow) {
|
|
5101
5104
|
if (this.__layout.boxChanged)
|
|
@@ -5230,6 +5233,8 @@ let Leaf = class Leaf {
|
|
|
5230
5233
|
get innerName() { return this.__.name || this.tag + this.innerId; }
|
|
5231
5234
|
get __DataProcessor() { return LeafData; }
|
|
5232
5235
|
get __LayoutProcessor() { return LeafLayout; }
|
|
5236
|
+
get leaferIsCreated() { return this.leafer && this.leafer.created; }
|
|
5237
|
+
get leaferIsReady() { return this.leafer && this.leafer.ready; }
|
|
5233
5238
|
get isLeafer() { return false; }
|
|
5234
5239
|
get isBranch() { return false; }
|
|
5235
5240
|
get isBranchLeaf() { return false; }
|
|
@@ -5671,6 +5676,7 @@ let Branch = class Branch extends Leaf {
|
|
|
5671
5676
|
add(child, index) {
|
|
5672
5677
|
if (child === this)
|
|
5673
5678
|
return;
|
|
5679
|
+
child.__ || (child = UICreator.get(child.tag, child));
|
|
5674
5680
|
if (child.parent)
|
|
5675
5681
|
child.parent.remove(child);
|
|
5676
5682
|
child.parent = this;
|
|
@@ -5693,10 +5699,14 @@ let Branch = class Branch extends Leaf {
|
|
|
5693
5699
|
}
|
|
5694
5700
|
remove(child, destroy) {
|
|
5695
5701
|
if (child) {
|
|
5696
|
-
if (child.
|
|
5697
|
-
|
|
5702
|
+
if (child.__) {
|
|
5703
|
+
if (child.animationOut)
|
|
5704
|
+
child.__runAnimation('out', () => this.__remove(child, destroy));
|
|
5705
|
+
else
|
|
5706
|
+
this.__remove(child, destroy);
|
|
5707
|
+
}
|
|
5698
5708
|
else
|
|
5699
|
-
this.
|
|
5709
|
+
this.find(child).forEach(item => this.remove(item, destroy));
|
|
5700
5710
|
}
|
|
5701
5711
|
else if (child === undefined) {
|
|
5702
5712
|
super.remove(null, destroy);
|
|
@@ -5914,6 +5924,6 @@ class LeafLevelList {
|
|
|
5914
5924
|
}
|
|
5915
5925
|
}
|
|
5916
5926
|
|
|
5917
|
-
const version = "1.0.
|
|
5927
|
+
const version = "1.0.5";
|
|
5918
5928
|
|
|
5919
5929
|
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, 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, Point, PointHelper, PropertyEvent, RectHelper, RenderEvent, ResizeEvent, 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, isNull, layoutProcessor, maskType, naturalBoundsType, needPlugin, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds, tempMatrix, tempPoint$2 as tempPoint, useModule, version, visibleType };
|
package/lib/core.esm.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=i;return e[t]?e[t]++:(e[t]=1,0)}},i=s,{round:r,pow:n,PI:o}=Math,a={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)),a.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=e?n(10,e):1e12;return-0===(t=r(t*s)/s)?0:t},getScaleData:(t,e,s,i)=>(i||(i={}),e?(i.scaleX=("number"==typeof e?e:e.width)/s.width,i.scaleY=("number"==typeof e?e:e.height)/s.height):t&&a.assignScale(i,t),i),assignScale(t,e){"number"==typeof e?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)}},h=o/180,l=2*o,d=o/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}=a,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,PI:L}=Math,E={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,s){t.radiusX=e,t.radiusY=void 0===s?e:s},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,s){t.x=e,t.y=s},move(t,e,s){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 A(s,t),B(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=M;return A(s,t),k(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=M;return A(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)=>I(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(I(t,e,s,i),I(s,i,r,n)),getAngle:(t,e)=>W(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<-L?d+l:d},getAtan2:(t,e)=>R(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,i){const r=W(t,e);return(e=i?e:{}).x=t.x+O(r)*s,e.y=t.y+C(r)*s,e},reset(t){M.reset(t)}},M=E,{getDistanceFrom:I,copy:A,getAtan2:W}=M;class N{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?E.copy(this,t):E.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new N(this)}move(t,e){return E.move(this,t,e),this}scale(t,e){return E.scale(this,t,e),this}scaleOf(t,e,s){return E.scaleOf(this,t,e,s),this}rotate(t,e){return E.rotate(this,t,e),this}rotateOf(t,e){return E.rotate(this,e,t),this}getRotation(t,e,s){return E.getRotation(this,t,e,s)}toInnerOf(t,e){return E.toInnerOf(this,t,e),this}toOuterOf(t,e){return E.toOuterOf(this,t,e),this}getCenter(t){return new N(E.getCenter(this,t))}getDistance(t){return E.getDistance(this,t)}getDistancePoint(t,e,s){return new N(E.getDistancePoint(this,t,e,s))}getAngle(t){return E.getAngle(this,t)}getAtan2(t){return E.getAtan2(this,t)}reset(){return E.reset(this),this}}const Y=new N;class D{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 D(this)}translate(t,e){return b.translate(this,t,e),this}translateInner(t,e){return b.translateInner(this,t,e),this}scale(t,e){return b.scale(this,t,e),this}scaleWith(t,e){return b.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,s){return b.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return b.scaleOfInner(this,t,e,s),this}rotate(t){return b.rotate(this,t),this}rotateOfOuter(t,e){return b.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return b.rotateOfInner(this,t,e),this}skew(t,e){return b.skew(this,t,e),this}skewOfOuter(t,e,s){return b.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return b.skewOfInner(this,t,e,s),this}multiply(t){return b.multiply(this,t),this}multiplyParent(t){return b.multiplyParent(this,t),this}divide(t){return b.divide(this,t),this}divideParent(t){return b.divideParent(this,t),this}invert(){return b.invert(this),this}invertWith(){return b.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){b.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){b.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return b.setLayout(this,t,e,s),this}getLayout(t,e,s){return b.getLayout(this,t,e,s)}withScale(t,e){return b.withScale(this,t,e)}reset(){b.reset(this)}}const X=new D,z={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,i,r){F(t,e,s),F(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:F}=z,{tempPointBounds:j,setPoint:U,addPoint:G,toBounds:H}=z,{toOuterPoint:q}=b,{float:V,fourNumber:Q}=a,{floor:J,ceil:Z}=Math;let $,K,tt,et;const st={},it={},rt={tempBounds:{},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=Q(s);i?nt.set(t,n+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):nt.set(t,n-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else i&&(s=-s),nt.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),nt.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?at(e,t):e=t,s?(e.offsetX=-(nt.maxX(s)-t.x),e.offsetY=-(nt.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),nt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e){E.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,i=s){E.scaleOf(t,e,s,i),t.width*=s,t.height*=i},tempToOuterOf:(t,e)=>(nt.copy(nt.tempBounds,t),nt.toOuterOf(nt.tempBounds,e),nt.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),nt.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 st.x=t.x,st.y=t.y,q(e,st,it),U(j,it.x,it.y),st.x=t.x+t.width,q(e,st,it),G(j,it.x,it.y),st.y=t.y+t.height,q(e,st,it),G(j,it.x,it.y),st.x=t.x,q(e,st,it),G(j,it.x,it.y),H(j,s)},toInnerOf(t,e,s){s||(s=t),nt.move(s,-e.e,-e.f),nt.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const i=Math.min(s,Math.min(t.width/e.width,t.height/e.height));return new D(i,0,0,i,-e.x*i,-e.y*i)},getSpread(t,e,s){const i={};return nt.copyAndSpread(i,t,e,!1,s),i},spread(t,e,s){nt.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){nt.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=J(t.x),t.y=J(t.y),t.width=e>t.x?Z(t.width+e-t.x):Z(t.width),t.height=s>t.y?Z(t.height+s-t.y):Z(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=V(t.x,e),t.y=V(t.y,e),t.width=V(t.width,e),t.height=V(t.height,e)},add(t,e,s){$=t.x+t.width,K=t.y+t.height,tt=e.x,et=e.y,s||(tt+=e.width,et+=e.height),$=$>tt?$:tt,K=K>et?K:et,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=$-t.x,t.height=K-t.y},addList(t,e){nt.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){nt.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){nt.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||at(t,r)):ot(t,r));n&&nt.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?U(j,t.x,t.y):G(j,t.x,t.y))),H(j,t)},setPoint(t,e){nt.set(t,e.x,e.y)},addPoint(t,e){ot(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=E.tempToInnerRadiusPointOf(e,s)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,s)=>(s&&(e=E.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=nt.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=nt.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=nt.tempToOuterOf(e,s)),!nt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:i,y:r,width:n,height:o}=e;return $=i+n,K=r+o,tt=t.x+t.width,et=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,$=$<tt?$:tt,K=K<et?K:et,n=$-i,o=K-r,{x:i,y:r,width:n,height:o}},intersect(t,e,s){nt.copy(t,nt.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){nt.set(t)}},nt=rt,{add:ot,copy:at}=nt;class ht{get minX(){return rt.minX(this)}get minY(){return rt.minY(this)}get maxX(){return rt.maxX(this)}get maxY(){return rt.maxY(this)}constructor(t,e,s,i){this.set(t,e,s,i)}set(t,e,s,i){return"object"==typeof t?rt.copy(this,t):rt.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 ht(this)}move(t,e){return rt.move(this,t,e),this}scale(t,e){return rt.scale(this,t,e),this}scaleOf(t,e,s){return rt.scaleOf(this,t,e,s),this}toOuterOf(t,e){return rt.toOuterOf(this,t,e),this}toInnerOf(t,e){return rt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return rt.getFitMatrix(this,t,e)}spread(t,e){return rt.spread(this,t,e),this}shrink(t,e){return rt.shrink(this,t,e),this}ceil(){return rt.ceil(this),this}unsign(){return rt.unsign(this),this}float(t){return rt.float(this,t),this}add(t){return rt.add(this,t),this}addList(t){return rt.setList(this,t,!0),this}setList(t){return rt.setList(this,t),this}addListWithFn(t,e){return rt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return rt.setListWithFn(this,t,e),this}setPoint(t){return rt.setPoint(this,t),this}setPoints(t){return rt.setPoints(this,t),this}addPoint(t){return rt.addPoint(this,t),this}getPoints(){return rt.getPoints(this)}hitPoint(t,e){return rt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return rt.hitRadiusPoint(this,t,e)}hit(t,e){return rt.hit(this,t,e)}includes(t,e){return rt.includes(this,t,e)}intersect(t,e){return rt.intersect(this,t,e),this}getIntersect(t,e){return new ht(rt.getIntersectData(this,t,e))}isSame(t){return rt.isSame(this,t)}isEmpty(){return rt.isEmpty(this)}reset(){rt.reset(this)}}const lt=new ht;class dt{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 ht(r,e,n||t.width-r-s,o||t.height-e-i)}}var ut,ct;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(ut||(ut={})),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"}(ct||(ct={}));const _t=[{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}];_t.forEach((t=>t.type="percent"));const pt={directionData:_t,tempPoint:{},get:ft,toPoint(t,e,s,i,r){const n=ft(t);s.x=n.x,s.y=n.y,"percent"===n.type&&(s.x*=e.width,s.y*=e.height,r&&(s.x-=r.x,s.y-=r.y,n.x&&(s.x-=1===n.x?r.width:.5===n.x?n.x*r.width:0),n.y&&(s.y-=1===n.y?r.height:.5===n.y?n.y*r.height:0))),i||(s.x+=e.x,s.y+=e.y)}};function ft(t){return"string"==typeof t?_t[ct[t]]:t}const{toPoint:gt}=pt,yt={toPoint(t,e,s,i,r){gt(t,s,i,r,e)}},mt={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};class xt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new xt(t)}static set filter(t){this.filterList=wt(t)}static set exclude(t){this.excludeList=wt(t)}log(...t){if(bt.enable){if(bt.filterList.length&&bt.filterList.every((t=>t!==this.name)))return;if(bt.excludeList.length&&bt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){bt.enable&&this.warn(...t)}warn(...t){bt.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 wt(t){return t?"string"==typeof t&&(t=[t]):t=[],t}xt.filterList=[],xt.excludeList=[],xt.showWarn=!0;const bt=xt,vt=xt.get("RunTime"),Bt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=s.create(s.RUNTIME);return kt.currentId=kt.idMap[i]=e?performance.now():Date.now(),kt.currentName=kt.nameMap[i]=t,kt.nameToIdMap[t]=i,i},end(t,e){const s=kt.idMap[t],i=kt.nameMap[t],r=e?(performance.now()-s)/1e3:Date.now()-s;kt.idMap[t]=kt.nameMap[t]=kt.nameToIdMap[i]=void 0,vt.log(i,r,"ms")},endOfName(t,e){const s=kt.nameToIdMap[t];void 0!==s&&kt.end(s,e)}},kt=Bt;function Ct(t){console.error("need plugin: @leafer-in/"+t)}const Ot=xt.get("UICreator"),Tt={list:{},register(t){const{__tag:e}=t.prototype;Pt[e]?Ot.repeat(e):Pt[e]=t},get(t,e,s,i,r,n){const o=new Pt[t](e);return void 0!==s&&(o.x=s,i&&(o.y=i),r&&(o.width=r),n&&(o.height=n)),o}},{list:Pt}=Tt,Rt=xt.get("EventCreator"),St={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(Lt[e]?Rt.repeat(e):Lt[e]=t)}))},changeName(t,e){const s=Lt[t];if(s){const i=Object.keys(s).find((e=>s[e]===t));i&&(s[i]=e,Lt[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Lt[t](...e)},{nameList:Lt}=St;class Et{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let s;const{list:i}=this;for(let e=0,r=i.length;e<r;e++)if(s=i[e],s.recycled&&s.isSameSize(t))return s.recycled=!1,s.manager||(s.manager=this),s;const r=e.canvas(t);return this.add(r),r}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 Mt={default:(t,e)=>(It(e,t),It(t,e),t),assign(t,e){let s;Object.keys(e).forEach((i=>{var r;s=e[i],(null==s?void 0:s.constructor)===Object&&(null===(r=t[i])||void 0===r?void 0:r.constructor)===Object?It(t[i],e[i]):t[i]=e[i]}))},copyAttrs:(t,e,s)=>(s.forEach((s=>{void 0!==e[s]&&(t[s]=e[s])})),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let s=0,i=t.length;s<i;s++)e[t[s]]=!0;return e}},{assign:It}=Mt;class At{get __useNaturalRatio(){return!0}get __isLinePath(){return this.path&&6===this.path.length}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||e.__hasEraser||t.eraser?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 Wt;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(Wt||(Wt={}));const Nt={};function Yt(t){return null==t}function Dt(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 Xt(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 zt(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 Ft=[];function jt(){return(t,e)=>{Ft.push(e)}}const Ut=[];class Gt{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||Ut)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;Ft.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}}Dt([zt("imageSmoothingEnabled")],Gt.prototype,"smooth",void 0),Dt([zt("imageSmoothingQuality")],Gt.prototype,"smoothLevel",void 0),Dt([zt("globalAlpha")],Gt.prototype,"opacity",void 0),Dt([zt()],Gt.prototype,"fillStyle",void 0),Dt([zt()],Gt.prototype,"strokeStyle",void 0),Dt([zt("lineWidth")],Gt.prototype,"strokeWidth",void 0),Dt([zt("lineCap")],Gt.prototype,"strokeCap",void 0),Dt([zt("lineJoin")],Gt.prototype,"strokeJoin",void 0),Dt([zt("lineDashOffset")],Gt.prototype,"dashOffset",void 0),Dt([zt()],Gt.prototype,"miterLimit",void 0),Dt([zt()],Gt.prototype,"shadowBlur",void 0),Dt([zt()],Gt.prototype,"shadowColor",void 0),Dt([zt()],Gt.prototype,"shadowOffsetX",void 0),Dt([zt()],Gt.prototype,"shadowOffsetY",void 0),Dt([zt()],Gt.prototype,"filter",void 0),Dt([zt()],Gt.prototype,"font",void 0),Dt([zt()],Gt.prototype,"fontKerning",void 0),Dt([zt()],Gt.prototype,"fontStretch",void 0),Dt([zt()],Gt.prototype,"fontVariantCaps",void 0),Dt([zt()],Gt.prototype,"textAlign",void 0),Dt([zt()],Gt.prototype,"textBaseline",void 0),Dt([zt()],Gt.prototype,"textRendering",void 0),Dt([zt()],Gt.prototype,"wordSpacing",void 0),Dt([zt()],Gt.prototype,"letterSpacing",void 0),Dt([zt()],Gt.prototype,"direction",void 0),Dt([jt()],Gt.prototype,"setTransform",null),Dt([jt()],Gt.prototype,"resetTransform",null),Dt([jt()],Gt.prototype,"getTransform",null),Dt([jt()],Gt.prototype,"save",null),Dt([jt()],Gt.prototype,"restore",null),Dt([jt()],Gt.prototype,"translate",null),Dt([jt()],Gt.prototype,"scale",null),Dt([jt()],Gt.prototype,"rotate",null),Dt([jt()],Gt.prototype,"fill",null),Dt([jt()],Gt.prototype,"stroke",null),Dt([jt()],Gt.prototype,"clip",null),Dt([jt()],Gt.prototype,"fillRect",null),Dt([jt()],Gt.prototype,"strokeRect",null),Dt([jt()],Gt.prototype,"clearRect",null),Dt([jt()],Gt.prototype,"beginPath",null),Dt([jt()],Gt.prototype,"moveTo",null),Dt([jt()],Gt.prototype,"lineTo",null),Dt([jt()],Gt.prototype,"bezierCurveTo",null),Dt([jt()],Gt.prototype,"quadraticCurveTo",null),Dt([jt()],Gt.prototype,"closePath",null),Dt([jt()],Gt.prototype,"arc",null),Dt([jt()],Gt.prototype,"arcTo",null),Dt([jt()],Gt.prototype,"ellipse",null),Dt([jt()],Gt.prototype,"rect",null),Dt([jt()],Gt.prototype,"roundRect",null),Dt([jt()],Gt.prototype,"createConicGradient",null),Dt([jt()],Gt.prototype,"createLinearGradient",null),Dt([jt()],Gt.prototype,"createPattern",null),Dt([jt()],Gt.prototype,"createRadialGradient",null),Dt([jt()],Gt.prototype,"fillText",null),Dt([jt()],Gt.prototype,"measureText",null),Dt([jt()],Gt.prototype,"strokeText",null);const{copy:Ht}=b,qt={width:1,height:1,pixelRatio:1},Vt=["width","height","pixelRatio"];class Qt extends Gt{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}get allowBackgroundColor(){return this.view&&this.parentView}constructor(e,i){super(),this.size={},this.worldTransform={},e||(e=qt),e.pixelRatio||(e.pixelRatio=t.devicePixelRatio),this.manager=i,this.innerId=s.create(s.CNAVAS);const{width:r,height:n,pixelRatio:o}=e;this.autoLayout=!r||!n,this.size.pixelRatio=o,this.config=e,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){if(this.isSameSize(t))return;let e;this.context&&!this.unreal&&this.width&&(e=this.getSameCanvas(),e.copyWorld(this)),Mt.copyAttrs(this.size,t,Vt),this.size.pixelRatio||(this.size.pixelRatio=1),this.bounds=new ht(0,0,this.width,this.height),this.context&&!this.unreal&&(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&e&&(this.clearWorld(e.bounds),this.copyWorld(e),e.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}=this,i=this.worldTransform;if(e){const{a:r,b:n,c:o,d:a,e:h,f:l}=e;this.setTransform(i.a=(t.a*r+t.b*o)*s,i.b=(t.a*n+t.b*a)*s,i.c=(t.c*r+t.d*o)*s,i.d=(t.c*n+t.d*a)*s,i.e=(t.e*r+t.f*o+h)*s,i.f=(t.e*n+t.f*a+l)*s)}else this.setTransform(i.a=t.a*s,i.b=t.b*s,i.c=t.c*s,i.d=t.d*s,i.e=t.e*s,i.f=t.f*s)}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,rt.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()}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,lt.set(t).scale(this.pixelRatio),this.fillRect(lt.x,lt.y,lt.width,lt.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,lt.set(t).scale(this.pixelRatio),this.strokeRect(lt.x,lt.y,lt.width,lt.height),s&&(this.blendMode="source-over")}clearWorld(t,e){lt.set(t).scale(this.pixelRatio),e&<.ceil(),this.clearRect(lt.x,lt.y,lt.width,lt.height)}clipWorld(t,e){this.beginPath(),lt.set(t).scale(this.pixelRatio),e&<.ceil(),this.rect(lt.x,lt.y,lt.width,lt.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}isSameSize(t){return this.width===t.width&&this.height===t.height&&this.pixelRatio===t.pixelRatio}getSameCanvas(t,s){const i=this.manager?this.manager.get(this.size):e.canvas(Object.assign({},this.size));return i.save(),t&&(Ht(i.worldTransform,this.worldTransform),i.useWorldTransform()),s&&(i.smooth=this.smooth),i}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t,!0):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Jt={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Zt={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},$t=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},Zt),Kt={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},te={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},ee=Object.assign(Object.assign({},te),Zt),se=$t,ie={};for(let t in se)ie[se[t]]=t;const re={};for(let t in se)re[se[t]]=Kt[t];const ne={drawRoundRect(t,e,s,i,r,n){const o=a.fourNumber(n,Math.min(i/2,r/2)),h=e+i,l=s+r;o[0]?t.moveTo(e+o[0],s):t.moveTo(e,s),o[1]?t.arcTo(h,s,h,l,o[1]):t.lineTo(h,s),o[2]?t.arcTo(h,l,e,l,o[2]):t.lineTo(h,l),o[3]?t.arcTo(e,l,e,s,o[3]):t.lineTo(e,l),o[0]?t.arcTo(e,s,h,s,o[0]):t.lineTo(e,s)}},{sin:oe,cos:ae,atan2:he,ceil:le,abs:de,PI:ue,sqrt:ce,pow:_e}=Math,{setPoint:pe,addPoint:fe}=z,{set:ge}=E,{M:ye,L:me,C:xe,Q:we,Z:be}=$t,ve={},Be={points(t,e,s,i){if(t.push(ye,e[0],e[1]),s&&e.length>5){let r,n,o,a,h,l,d,u,c,_,p,f,g,y=e.length;const m=!0===s?.5:s;i&&(y=(e=[e[y-2],e[y-1],...e,e[0],e[1],e[2],e[3]]).length);for(let s=2;s<y-2;s+=2)r=e[s-2],n=e[s-1],o=e[s],a=e[s+1],h=e[s+2],l=e[s+3],p=ce(_e(o-r,2)+_e(a-n,2)),f=ce(_e(h-o,2)+_e(l-a,2)),g=p+f,p=m*p/g,f=m*f/g,h-=r,l-=n,d=o-p*h,u=a-p*l,2===s?i||t.push(we,d,u,o,a):t.push(xe,c,_,d,u,o,a),c=o+f*h,_=a+f*l;i||t.push(we,c,_,e[y-2],e[y-1])}else for(let s=2,i=e.length;s<i;s+=2)t.push(me,e[s],e[s+1]);i&&t.push(be)},rect(t,e,s,i,r){Jt.creator.path=t,Jt.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){Jt.creator.path=[],ne.drawRoundRect(Jt.creator,e,s,i,r,n),t.push(...Jt.convertToCanvasData(Jt.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=he(f,p),x=he(y,g),w=x-m;if(w<0&&(w+=l),w===ue||de(p+f)<1e-12||de(g+y)<1e-12)return t&&t.push(me,i,r),u&&(pe(u,e,s),fe(u,i,r)),_&&ge(_,e,s),void(c&&ge(c,i,r));const b=p*y-g*f<0,v=b?-1:1,B=a/ae(w/2),k=i+B*ae(m+w/2+d*v),C=r+B*oe(m+w/2+d*v);return m-=d*v,x-=d*v,Oe(t,k,C,a,a,0,m/h,x/h,b,u,c,_)},arc:(t,e,s,i,r,n,o,a,h,l)=>Oe(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=oe(f),y=ae(f);let m=o*h,x=a*h;m>ue&&(m-=l),x<0&&(x+=l);let w=x-m;w<0?w+=l:w>l&&(w-=l),u&&(w-=l);const b=le(de(w/d)),v=w/b,B=oe(v/4),k=8/3*B*B/oe(v/2);x=m+v;let C,O,T,P,R,S,L,E,M=ae(m),I=oe(m),A=T=y*i*M-g*r*I,W=P=g*i*M+y*r*I,N=e+T,Y=s+P;t&&t.push(t.length?me:ye,N,Y),c&&pe(c,N,Y),p&&ge(p,N,Y);for(let n=0;n<b;n++)C=ae(x),O=oe(x),T=y*i*C-g*r*O,P=g*i*C+y*r*O,R=e+A-k*(y*i*I+g*r*M),S=s+W-k*(g*i*I-y*r*M),L=e+T+k*(y*i*O+g*r*C),E=s+P+k*(g*i*O-y*r*C),t&&t.push(xe,R,S,L,E,e+T,s+P),c&&Ce(e+A,s+W,R,S,L,E,e+T,s+P,c,!0),A=T,W=P,M=C,I=O,m=x,x+=v;_&&ge(_,e+T,s+P)},quadraticCurveTo(t,e,s,i,r,n,o){t.push(xe,(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){Ce(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?fe(h,t,e):pe(h,t,e),fe(h,o,a);for(let l=0,u=d.length;l<u;l++)ke(d[l],t,e,s,i,r,n,o,a,ve),fe(h,ve.x,ve.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 ke(t,e,s,i,r,n,o,a,h,l),l}},{getPointAndSet:ke,toTwoPointBounds:Ce,ellipse:Oe}=Be,{sin:Te,cos:Pe,sqrt:Re,atan2:Se}=Math,{ellipse:Le}=Be,Ee={ellipticalArc(e,s,i,r,n,o,a,d,u,c,_){const p=(u-s)/2,f=(c-i)/2,g=o*h,y=Te(g),m=Pe(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=Re(1-C/(b*v));r*=t,n*=t}else O=(a===d?-1:1)*Re(C/(b*B+v*k));const T=O*r*w/n,P=-O*n*x/r,R=Se((w-P)/n,(x-T)/r),S=Se((-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,M=i+f+y*T+m*P,I=L<0?1:0;_||t.ellipseToCurve?Le(e,E,M,r,n,o,R/h,S/h,I):r!==n||o?e.push($t.G,E,M,r,n,o,R/h,S/h,I):e.push($t.O,E,M,r,R/h,S/h,I)}},{M:Me,m:Ie,L:Ae,l:We,H:Ne,h:Ye,V:De,v:Xe,C:ze,c:Fe,S:je,s:Ue,Q:Ge,q:He,T:qe,t:Ve,A:Qe,a:Je,Z:Ze,z:$e,N:Ke,D:ts,X:es,G:ss,F:is,O:rs,P:ns,U:os}=$t,{rect:as,roundRect:hs,arcTo:ls,arc:ds,ellipse:us,quadraticCurveTo:cs}=Be,{ellipticalArc:_s}=Ee,ps=xt.get("PathConvert"),fs={},gs={current:{dot:0},stringify(t,e){let s,i,r,n=0,o=t.length,h="";for(;n<o;){i=t[n],s=re[i],h+=i===r?" ":ie[i];for(let i=1;i<s;i++)h+=a.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?ee:te;for(let e=0,h=t.length;e<h;e++)i=t[e],mt[i]?("."===i&&(ys.dot&&(ms(o,n),n=""),ys.dot++),"0"===n&&"."!==i&&(ms(o,n),n=""),n+=i):$t[i]?(n&&(ms(o,n),n=""),ys.name=$t[i],ys.length=Kt[i],ys.index=0,ms(o,ys.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?n+=i:(n&&ms(o,n),n=i):n&&(ms(o,n),n=""),r=i;return n&&ms(o,n),s?gs.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 Ie:t[u+1]+=a,t[u+2]+=h;case Me:a=t[u+1],h=t[u+2],_.push(Me,a,h),u+=3;break;case Ye:t[u+1]+=a;case Ne:a=t[u+1],_.push(Ae,a,h),u+=2;break;case Xe:t[u+1]+=h;case De:h=t[u+1],_.push(Ae,a,h),u+=2;break;case We:t[u+1]+=a,t[u+2]+=h;case Ae:a=t[u+1],h=t[u+2],_.push(Ae,a,h),u+=3;break;case Ue:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,r=je;case je:o=n===ze||n===je,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 Fe: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 Ve:t[u+1]+=a,t[u+2]+=h,r=qe;case qe:o=n===Ge||n===qe,s=o?2*a-s:t[u+1],i=o?2*h-i:t[u+2],e?cs(_,a,h,s,i,t[u+1],t[u+2]):_.push(Ge,s,i,t[u+1],t[u+2]),a=t[u+1],h=t[u+2],u+=3;break;case He:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,r=Ge;case Ge:s=t[u+1],i=t[u+2],e?cs(_,a,h,s,i,t[u+3],t[u+4]):_.push(Ge,s,i,t[u+3],t[u+4]),a=t[u+3],h=t[u+4],u+=5;break;case Je:t[u+6]+=a,t[u+7]+=h;case Qe:_s(_,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 $e:case Ze:_.push(Ze),u++;break;case Ke:a=t[u+1],h=t[u+2],e?as(_,a,h,t[u+3],t[u+4]):xs(_,t,u,5),u+=5;break;case ts:a=t[u+1],h=t[u+2],e?hs(_,a,h,t[u+3],t[u+4],[t[u+5],t[u+6],t[u+7],t[u+8]]):xs(_,t,u,9),u+=9;break;case es:a=t[u+1],h=t[u+2],e?hs(_,a,h,t[u+3],t[u+4],t[u+5]):xs(_,t,u,6),u+=6;break;case ss:us(e?_:xs(_,t,u,9),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],t[u+7],t[u+8],null,fs),a=fs.x,h=fs.y,u+=9;break;case is:e?us(_,t[u+1],t[u+2],t[u+3],t[u+4],0,0,360,!1):xs(_,t,u,5),a=t[u+1]+t[u+3],h=t[u+2],u+=5;break;case rs:ds(e?_:xs(_,t,u,7),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],null,fs),a=fs.x,h=fs.y,u+=7;break;case ns:e?ds(_,t[u+1],t[u+2],t[u+3],0,360,!1):xs(_,t,u,4),a=t[u+1]+t[u+3],h=t[u+2],u+=4;break;case os:ls(e?_:xs(_,t,u,6),a,h,t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],null,fs),a=fs.x,h=fs.y,u+=6;break;default:return ps.error(`command: ${r} [index:${u}]`,t),_}n=r}return _},copyData(t,e,s,i){for(let r=s,n=s+i;r<n;r++)t.push(e[r])},pushData(t,e){ys.index===ys.length&&(ys.index=1,t.push(ys.name)),t.push(Number(e)),ys.index++,ys.dot=0}},{current:ys,pushData:ms,copyData:xs}=gs,{M:ws,L:bs,C:vs,Q:Bs,Z:ks,N:Cs,D:Os,X:Ts,G:Ps,F:Rs,O:Ss,P:Ls,U:Es}=$t,{getMinDistanceFrom:Ms,getRadianFrom:Is}=E,{tan:As,min:Ws,abs:Ns}=Math,Ys={},Ds={beginPath(t){t.length=0},moveTo(t,e,s){t.push(ws,e,s)},lineTo(t,e,s){t.push(bs,e,s)},bezierCurveTo(t,e,s,i,r,n,o){t.push(vs,e,s,i,r,n,o)},quadraticCurveTo(t,e,s,i,r){t.push(Bs,e,s,i,r)},closePath(t){t.push(ks)},rect(t,e,s,i,r){t.push(Cs,e,s,i,r)},roundRect(t,e,s,i,r,n){if("number"==typeof n)t.push(Ts,e,s,i,r,n);else{const o=a.fourNumber(n);o?t.push(Os,e,s,i,r,...o):t.push(Cs,e,s,i,r)}},ellipse(t,e,s,i,r,n,o,a,h){void 0===n?t.push(Rs,e,s,i,r):(void 0===o&&(o=0),void 0===a&&(a=360),t.push(Ps,e,s,i,r,n,o,a,h?1:0))},arc(t,e,s,i,r,n,o){void 0===r?t.push(Ls,e,s,i):(void 0===n&&(n=360),t.push(Ss,e,s,i,r,n,o?1:0))},arcTo(t,e,s,i,r,n,o,a){if(void 0!==o){const h=As(Is(o,a,e,s,i,r)/2)*(Ms(o,a,e,s,i,r)/2);t.push(Es,e,s,i,r,Ws(n,Ns(h)))}else t.push(Es,e,s,i,r,n)},drawEllipse(t,e,s,i,r,n,o,a,h){Be.ellipse(null,e,s,i,r,void 0===n?0:n,void 0===o?0:o,void 0===a?360:a,h,null,null,Ys),t.push(ws,Ys.x,Ys.y),Xs(t,e,s,i,r,n,o,a,h)},drawArc(t,e,s,i,r,n,o){Be.arc(null,e,s,i,void 0===r?0:r,void 0===n?360:n,o,null,null,Ys),t.push(ws,Ys.x,Ys.y),zs(t,e,s,i,r,n,o)},drawPoints(t,e,s,i){Be.points(t,e,s,i)}},{ellipse:Xs,arc:zs}=Ds,{moveTo:Fs,lineTo:js,quadraticCurveTo:Us,bezierCurveTo:Gs,closePath:Hs,beginPath:qs,rect:Vs,roundRect:Qs,ellipse:Js,arc:Zs,arcTo:$s,drawEllipse:Ks,drawArc:ti,drawPoints:ei}=Ds;class si{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.clearPath=this.beginPath,this.set(t)}set(t){return this.__path=t?"string"==typeof t?Jt.parse(t):t:[],this}beginPath(){return qs(this.__path),this.paint(),this}moveTo(t,e){return Fs(this.__path,t,e),this.paint(),this}lineTo(t,e){return js(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,i,r,n){return Gs(this.__path,t,e,s,i,r,n),this.paint(),this}quadraticCurveTo(t,e,s,i){return Us(this.__path,t,e,s,i),this.paint(),this}closePath(){return Hs(this.__path),this.paint(),this}rect(t,e,s,i){return Vs(this.__path,t,e,s,i),this.paint(),this}roundRect(t,e,s,i,r){return Qs(this.__path,t,e,s,i,r),this.paint(),this}ellipse(t,e,s,i,r,n,o,a){return Js(this.__path,t,e,s,i,r,n,o,a),this.paint(),this}arc(t,e,s,i,r,n){return Zs(this.__path,t,e,s,i,r,n),this.paint(),this}arcTo(t,e,s,i,r){return $s(this.__path,t,e,s,i,r),this.paint(),this}drawEllipse(t,e,s,i,r,n,o,a){return Ks(this.__path,t,e,s,i,r,n,o,a),this.paint(),this}drawArc(t,e,s,i,r,n){return ti(this.__path,t,e,s,i,r,n),this.paint(),this}drawPoints(t,e,s){return ei(this.__path,t,e,s),this.paint(),this}paint(){}}const{M:ii,L:ri,C:ni,Q:oi,Z:ai,N:hi,D:li,X:di,G:ui,F:ci,O:_i,P:pi,U:fi}=$t,gi=xt.get("PathDrawer"),yi={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case ii:t.moveTo(e[i+1],e[i+2]),i+=3;break;case ri:t.lineTo(e[i+1],e[i+2]),i+=3;break;case ni:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case oi:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case ai:t.closePath(),i+=1;break;case hi:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case li: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 di:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case ui: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 ci:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,l,!1),i+=5;break;case _i: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 pi:t.arc(e[i+1],e[i+2],e[i+3],0,l,!1),i+=4;break;case fi:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void gi.error(`command: ${s} [index:${i}]`,e)}}},{M:mi,L:xi,C:wi,Q:bi,Z:vi,N:Bi,D:ki,X:Ci,G:Oi,F:Ti,O:Pi,P:Ri,U:Si}=$t,{toTwoPointBounds:Li,toTwoPointBoundsByQuadraticCurve:Ei,arcTo:Mi,arc:Ii,ellipse:Ai}=Be,{addPointBounds:Wi,copy:Ni,addPoint:Yi,setPoint:Di,addBounds:Xi,toBounds:zi}=z,Fi=xt.get("PathBounds");let ji,Ui,Gi;const Hi={},qi={},Vi={},Qi={toBounds(t,e){Qi.toTwoPointBounds(t,qi),zi(qi,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Di(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===vi||o===wi||o===bi?Di(e,h,l):Di(e,t[a+1],t[a+2])),o){case mi:case xi:h=t[a+1],l=t[a+2],Yi(e,h,l),a+=3;break;case wi:r=t[a+5],n=t[a+6],Li(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,n,Hi),Wi(e,Hi),h=r,l=n,a+=7;break;case bi:s=t[a+1],i=t[a+2],r=t[a+3],n=t[a+4],Ei(h,l,s,i,r,n,Hi),Wi(e,Hi),h=r,l=n,a+=5;break;case vi:a+=1;break;case Bi:h=t[a+1],l=t[a+2],Xi(e,h,l,t[a+3],t[a+4]),a+=5;break;case ki:case Ci:h=t[a+1],l=t[a+2],Xi(e,h,l,t[a+3],t[a+4]),a+=o===ki?9:6;break;case Oi:Ai(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],Hi,Vi),0===a?Ni(e,Hi):Wi(e,Hi),h=Vi.x,l=Vi.y,a+=9;break;case Ti:h=t[a+1],l=t[a+2],Ui=t[a+3],Gi=t[a+4],Xi(e,h-Ui,l-Gi,2*Ui,2*Gi),h+=Ui,a+=5;break;case Pi:Ii(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Hi,Vi),0===a?Ni(e,Hi):Wi(e,Hi),h=Vi.x,l=Vi.y,a+=7;break;case Ri:h=t[a+1],l=t[a+2],ji=t[a+3],Xi(e,h-ji,l-ji,2*ji,2*ji),h+=ji,a+=4;break;case Si:Mi(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Hi,Vi),0===a?Ni(e,Hi):Wi(e,Hi),h=Vi.x,l=Vi.y,a+=6;break;default:return void Fi.error(`command: ${o} [index:${a}]`,t)}}},{M:Ji,L:Zi,C:$i,Z:Ki}=$t,{getCenterX:tr,getCenterY:er}=E,{arcTo:sr}=Ds,ir={smooth(t,e,s){let i,r=0,n=0,o=0,a=0,h=0,l=0,d=0,u=0,c=0;const _=t.length,p=[];for(;r<_;)switch(i=t[r],i){case Ji:a=u=t[r+1],h=c=t[r+2],r+=3,t[r]===Zi?(l=t[r+1],d=t[r+2],p.push(Ji,tr(a,l),er(h,d))):p.push(Ji,a,h);break;case Zi:switch(n=t[r+1],o=t[r+2],r+=3,t[r]){case Zi:sr(p,n,o,t[r+1],t[r+2],e,u,c);break;case Ki:sr(p,n,o,a,h,e,u,c);break;default:p.push(Zi,n,o)}u=n,c=o;break;case $i:p.push($i,t[r+1],t[r+2],t[r+3],t[r+4],t[r+5],t[r+6]),r+=7;break;case Ki:sr(p,a,h,l,d,e,u,c),p.push(Ki),r+=1}return i!==Ki&&(p[1]=a,p[2]=h),p}};Jt.creator=new si,Jt.parse=gs.parse,Jt.convertToCanvasData=gs.toCanvasData;const rr=new si,{drawRoundRect:nr}=ne;function or(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,i,r){nr(this,t,e,s,i,r)})}(t)}const ar={opacityTypes:["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=hr.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{}}}},hr=ar;hr.opacityTypes.forEach((t=>hr.upperCaseTypeMap[t]=t.toUpperCase()));const lr=xt.get("TaskProcessor");class dr{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return Xt(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){lr.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class ur{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&&Mt.assign(this.config,t),this.empty()}add(t,e){let s,i,r,n;const o=new dr(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 cr={map:{},recycledList:[],tasker:new ur,patternTasker:new ur,get isComplete(){return _r.tasker.isComplete},get(t){let s=_r.map[t.url];return s||(s=e.image(t),_r.map[t.url]=s),s.use++,s},recycle(t){t.use--,setTimeout((()=>{t.use||_r.recycledList.push(t)}))},clearRecycled(){const t=_r.recycledList;t.length>100&&(t.forEach((t=>{!t.use&&t.url&&(delete _r.map[t.url],t.destroy())})),t.length=0)},hasOpacityPixel:t=>ar.opacityTypes.some((e=>_r.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+ar.mineType(t)))return!0}else if(s.includes("."+t)||s.includes("."+ar.upperCaseTypeMap[t]))return!0;return!1},destroy(){_r.map={},_r.recycledList=[]}},_r=cr,{IMAGE:pr,create:fr}=s;class gr{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){this.use=0,this.waitComplete=[],this.innerId=fr(pr),this.config=t||{url:""},this.isSVG=cr.isFormat("svg",t),this.hasOpacityPixel=cr.hasOpacityPixel(t)}load(e,s){return this.loading||(this.loading=!0,cr.tasker.add((()=>Xt(this,void 0,void 0,(function*(){return yield t.origin.loadImage(this.url).then((t=>{this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)})).catch((t=>{this.error=t,this.onComplete(!1)}))}))))),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}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}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 yr(t,e,s,i){i||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function mr(t,e){return Object.getOwnPropertyDescriptor(t,e)}function xr(t,e){return(s,i)=>br(s,i,t,e&&e(i))}function wr(t){return t}function br(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};yr(t,e,Object.assign(r,i||{})),qr(t,e,s)}function vr(t){return xr(t)}function Br(t,e){return xr(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})))}function kr(t){return xr(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal())}})))}function Cr(t,e){return xr(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}})))}function Or(t,e){return xr(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}})))}function Tr(t,e){return xr(t,(t=>({set(s){this.__setAttr(t,s,e)&&Rr(this)}})))}function Pr(t){return xr(t,(t=>({set(e){this.__setAttr(t,e)&&(Rr(this),this.__.__removeNaturalSize())}})))}function Rr(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Sr(t){return xr(t,(t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),Rr(this)}})))}const Lr=Tr;function Er(t){return xr(t,(t=>({set(e){this.__setAttr(t,e)&&Mr(this)}})))}function Mr(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Rr(t)}const Ir=Er;function Ar(t){return xr(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))}function Wr(t){return xr(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})))}function Nr(t){return xr(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange())}})))}function Yr(t){return xr(t,(t=>({set(e){const s=this.visible;if(!0===s&&0===e){if(this.animationOut)return this.__runAnimation("out",(()=>Dr(this,t,e,s)))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");Dr(this,t,e,s)}})))}function Dr(t,e,s,i){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==i&&0!==s||Rr(t))}function Xr(t){return xr(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()})))}})))}function zr(t){return xr(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(e)})))}})))}function Fr(t){return xr(t,(t=>({set(e){this.__setAttr(t,e)&&this.waitParent((()=>{this.parent.__updateEraser(e)}))}})))}function jr(t){return xr(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,xt.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}})))}function Ur(t){return xr(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}})))}function Gr(t){return(e,s)=>{yr(e,"__DataProcessor",{get:()=>t})}}function Hr(t){return(e,s)=>{yr(e,"__LayoutProcessor",{get:()=>t})}}function qr(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("object"==typeof s){const{clone:t}=Mt;o.get=function(){let e=this[r];return void 0===e&&(this[r]=e=t(s)),e}}"width"===e?o.get=function(){const t=this[r];if(void 0===t){const t=this;return t._height&&t.__naturalWidth&&t.__useNaturalRatio?t._height*t.__naturalWidth/t.__naturalHeight:t.__naturalWidth||s}return t}:"height"===e&&(o.get=function(){const t=this[r];if(void 0===t){const t=this;return t._width&&t.__naturalHeight&&t.__useNaturalRatio?t._width*t.__naturalHeight/t.__naturalWidth:t.__naturalHeight||s}return t});let a,h=i;for(;!a&&h;)a=mr(h,e),h=h.__proto__;a&&a.set&&(o.set=a.set),i[n]&&(o.set=i[n],delete i[n]),yr(i,e,o)}const Vr=new xt("rewrite"),Qr=[],Jr=["destroy","constructor"];function Zr(t){return(e,s)=>{Qr.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function $r(){return t=>{Kr()}}function Kr(t){Qr.length&&(Qr.forEach((e=>{t&&Vr.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Qr.length=0)}function tn(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach((i=>{if(!(Jr.includes(i)||e&&e.includes(i)))if(t.prototype){mr(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]}))}}function en(){return t=>{Tt.register(t)}}function sn(){return t=>{St.register(t)}}setTimeout((()=>Kr(!0)));const{copy:rn,toInnerPoint:nn,toOuterPoint:on,scaleOfOuter:an,rotateOfOuter:hn,skewOfOuter:ln,multiplyParent:dn,divideParent:un,getLayout:cn}=b,_n={},pn={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),yn(t,e,s),t.isBranch){const{children:i}=t;for(let t=0,r=i.length;t<r;t++)gn(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++)mn(e[t])}},updateAllChange(t){if(mn(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)xn(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},moveWorld(t,e,s=0,i){const r="object"==typeof e?Object.assign({},e):{x:e,y:s};i?on(t.localTransform,r,r,!0):t.parent&&nn(t.parent.worldTransform,r,r,!0),fn.moveLocal(t,r.x,r.y)},moveLocal(t,e,s=0){"object"==typeof e?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=s)},zoomOfWorld(t,e,s,i,r){fn.zoomOfLocal(t,bn(t,e),s,i,r)},zoomOfLocal(t,e,s,i=s,r){rn(_n,t.__localMatrix),an(_n,e,s,i),t.origin||t.around?fn.setTransform(t,_n,r):(wn(t,_n),t.scaleResize(s,i,!0!==r))},rotateOfWorld(t,e,s){fn.rotateOfLocal(t,bn(t,e),s)},rotateOfLocal(t,e,s){rn(_n,t.__localMatrix),hn(_n,e,s),t.origin||t.around?fn.setTransform(t,_n):(wn(t,_n),t.rotation=a.formatRotation(t.rotation+s))},skewOfWorld(t,e,s,i,r){fn.skewOfLocal(t,bn(t,e),s,i,r)},skewOfLocal(t,e,s,i=0,r){rn(_n,t.__localMatrix),ln(_n,e,s,i),fn.setTransform(t,_n,r)},transformWorld(t,e,s){rn(_n,t.worldTransform),dn(_n,e),t.parent&&un(_n,t.parent.worldTransform),fn.setTransform(t,_n,s)},transform(t,e,s){rn(_n,t.localTransform),dn(_n,e),fn.setTransform(t,_n,s)},setTransform(t,e,s){const i=cn(e,t.origin&&fn.getInnerOrigin(t,t.origin),t.around&&fn.getInnerOrigin(t,t.around));if(s){const e=i.scaleX/t.scaleX,r=i.scaleY/t.scaleY;delete i.scaleX,delete i.scaleY,t.set(i),t.scaleResize(e,r,!0!==s)}else t.set(i)},getFlipTransform(t,e){const s={a:1,b:0,c:0,d:1,e:0,f:0},i="x"===e?1:-1;return an(s,fn.getLocalOrigin(t,"center"),-1*i,1*i),s},getLocalOrigin:(t,e)=>E.tempToOuterOf(fn.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const s={};return pt.toPoint(e,t.boxBounds,s),s},getRelativeWorld:(t,e,s)=>(rn(_n,t.worldTransform),un(_n,e.worldTransform),s?_n:Object.assign({},_n)),drop(t,e,s,i){t.setTransform(fn.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}}},fn=pn,{updateAllMatrix:gn,updateMatrix:yn,updateAllWorldOpacity:mn,updateAllChange:xn}=fn;function wn(t,e){const{e:s,f:i}=t.__localMatrix;t.x+=e.e-s,t.y+=e.f-i}function bn(t,e){return t.__layout.update(),t.parent?E.tempToInnerOf(e,t.parent.__world):e}const vn={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:Bn}=pn,kn={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),Cn(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++)On(e[t],e)},updateBounds(t,e){const s=[t];On(t,s),Tn(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++)Bn(i[t]);e&&e===s||Bn(s)}}},{pushAllChildBranch:Cn,pushAllBranchStack:On,updateBoundsByBranchStack:Tn}=kn,Pn={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:Rn}=pn,{toOuterOf:Sn,getPoints:Ln,copy:En}=rt,Mn="_localContentBounds",In="_worldContentBounds",An="_worldBoxBounds",Wn="_worldStrokeBounds";class Nn{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}get localContentBounds(){return Sn(this.contentBounds,this.leaf.__localMatrix,this[Mn]||(this[Mn]={})),this[Mn]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Sn(this.contentBounds,this.leaf.__world,this[In]||(this[In]={})),this[In]}get worldBoxBounds(){return Sn(this.boxBounds,this.leaf.__world,this[An]||(this[An]={})),this[An]}get worldStrokeBounds(){return Sn(this.strokeBounds,this.leaf.__world,this[Wn]||(this[Wn]={})),this[Wn]}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.boxBounds={x:0,y:0,width:0,height:0},this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),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{leafer:e}=this.leaf;if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=this.leaf;for(;e.parent&&!e.parent.leafer;)e=e.parent;t.layout(e)}}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 Rn(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 ht(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=this.getInnerBounds(t);switch(e){case"world":r=i.getWorldPoint(o),n=i.__world;break;case"local":r=i.getLocalPointByInner(o),n=i.__localMatrix;break;case"inner":r=o,n=b.defaultMatrix;break;case"page":e=i.zoomLayer;default:r=i.getWorldPoint(o,e),n=Rn(i,e,!0)}const a=b.getLayout(n);if(En(a,o),E.copy(a,r),s){const{scaleX:t,scaleY:e}=a,s=Math.abs(t),i=Math.abs(e);1===s&&1===i||(a.scaleX/=s,a.scaleY/=i,a.width*=s,a.height*=i)}return a}getLayoutPoints(t,e="world"){const{leaf:s}=this,i=Ln(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=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Yn{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 Dn extends Yn{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}Dn.ADD="child.add",Dn.REMOVE="child.remove",Dn.CREATED="created",Dn.MOUNTED="mounted",Dn.UNMOUNTED="unmounted",Dn.DESTROY="destroy";class Xn extends Yn{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}Xn.CHANGE="property.change",Xn.LEAFER_CHANGE="property.leafer_change";class zn extends Yn{constructor(t,e){super(t),Object.assign(this,e)}}zn.LOAD="image.load",zn.LOADED="image.loaded",zn.ERROR="image.error";class Fn extends Yn{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(Fn.RESIZE),Object.assign(this,t)):super(t),this.old=e}}Fn.RESIZE="resize";class jn extends Yn{constructor(t,e){super(t),this.data=e}}jn.REQUEST="watch.request",jn.DATA="watch.data";class Un extends Yn{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}Un.CHECK_UPDATE="layout.check_update",Un.REQUEST="layout.request",Un.START="layout.start",Un.BEFORE="layout.before",Un.LAYOUT="layout",Un.AFTER="layout.after",Un.AGAIN="layout.again",Un.END="layout.end";class Gn extends Yn{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}Gn.REQUEST="render.request",Gn.START="render.start",Gn.BEFORE="render.before",Gn.RENDER="render",Gn.AFTER="render.after",Gn.AGAIN="render.again",Gn.END="render.end",Gn.NEXT="render.next";class Hn extends Yn{}Hn.START="leafer.start",Hn.BEFORE_READY="leafer.before_ready",Hn.READY="leafer.ready",Hn.AFTER_READY="leafer.after_ready",Hn.VIEW_READY="leafer.view_ready",Hn.VIEW_COMPLETED="leafer.view_completed",Hn.STOP="leafer.stop",Hn.RESTART="leafer.restart",Hn.END="leafer.end";const qn={};class Vn{set event(t){this.on(t)}on(t,e,s){if(!e){let e,s=t;for(let t in s)e=s[t],e instanceof Array?this.on(t,e[0],e[1]):this.on(t,e);return}let i,r,n;s&&("once"===s?r=!0:"boolean"==typeof s?i=s:(i=s.capture,r=s.once));const o=Qn(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])}))}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=Qn(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]))}))}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 s&&(e=e.bind(s)),this.on(t,e,i),{type:t,current:this,listener:e,options:i}}off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>t.current.off(t.type,t.listener,t.options))),e.length=0}once(t,e,s){this.on(t,e,{once:!0,capture:s})}emit(t,e,s){!e&&St.has(t)&&(e=St.get(t,{type:t,target:this,current:this}));const i=Qn(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 Qn(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:qn)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:qn)}}const{on:Jn,on_:Zn,off:$n,off_:Kn,once:to,emit:eo,emitEvent:so,hasEvent:io,destroy:ro}=Vn.prototype,no={on:Jn,on_:Zn,off:$n,off_:Kn,once:to,emit:eo,emitEvent:so,hasEvent:io,destroyEventer:ro},{isFinite:oo}=Number,ao=xt.get("setAttr"),ho={__setAttr(t,e,s){if(this.leafer&&this.leafer.created){const i=this.__.__getInput(t);if(s&&!oo(e)&&void 0!==e&&(ao.warn(this.innerName,t,e),e=void 0),"object"==typeof e||i!==e){this.__realSetAttr(t,e);const{CHANGE:s}=Xn,r=new Xn(s,this,t,i,e);return this.isLeafer?this.emitEvent(new Xn(Xn.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:lo,multiplyParent:uo,translateInner:co,defaultWorld:_o}=b,{toPoint:po,tempPoint:fo}=pt,go={__updateWorldMatrix(){uo(this.__local||this.__layout,this.parent?this.parent.__world:_o,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.rotationChanged)&&(lo(e,s,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=!1),e.e=s.x+s.offsetX,e.f=s.y+s.offsetY,(s.around||s.origin)&&(po(s.around||s.origin,t.boxBounds,fo),co(e,-fo.x,-fo.y,!s.around))}this.__layout.matrixChanged=!1}},{updateMatrix:yo,updateAllMatrix:mo}=pn,{updateBounds:xo}=kn,{toOuterOf:wo,copyAndSpread:bo,copy:vo}=rt,{toBounds:Bo}=Qi,ko={__updateWorldBounds(){wo(this.__layout.renderBounds,this.__world,this.__world),this.__layout.resized&&(this.__onUpdateSize(),this.__layout.resized=!1)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized=!0),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=!1,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=!1,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=!1,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized=!0),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=!1,this.parent&&this.parent.__layout.renderChange()),t.boundsChanged=!1},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),wo(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){wo(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){wo(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?Bo(e.__pathForRender,t):(t.x=0,t.y=0,t.width=e.width,t.height=e.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.leafer&&this.leafer.ready&&this.leafer.layouter.addExtra(this),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),mo(this),xo(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(mo(this),xo(this,this))):yo(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;bo(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?bo(t.renderBounds,t.boxBounds,t.renderSpread):vo(t.renderBounds,t.strokeBounds)}},Co={__render(t,e){if(this.__worldOpacity)if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=this.__.opacity,this.__.__single){if("path"===this.__.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e),this.__worldFlipped?t.copyWorldByReset(s,this.__nowWorld,null,this.__.__blendMode,!0):t.copyWorldToInner(s,this.__nowWorld,this.__layout.renderBounds,this.__.__blendMode),s.recycle(this.__nowWorld)}else this.__draw(t,e)},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),this.__.windingRule?t.clip(this.__.windingRule):t.clip())},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Oo}=vn,To={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__worldOpacity)if(this.__.__single){if("path"===this.__.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const i=this.__getNowWorld(e);t.opacity=this.__.opacity,t.copyWorldByReset(s,i,i,this.__.__blendMode,!0),s.recycle(i)}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++)Oo(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++)Oo(s[i],e)||s[i].__clip(t,e)}}},{LEAF:Po,create:Ro}=s,{toInnerPoint:So,toOuterPoint:Lo,multiplyParent:Eo}=b,{toOuterOf:Mo}=rt,{copy:Io,move:Ao}=E,{moveLocal:Wo,zoomOfLocal:No,rotateOfLocal:Yo,skewOfLocal:Do,moveWorld:Xo,zoomOfWorld:zo,rotateOfWorld:Fo,skewOfWorld:jo,transform:Uo,transformWorld:Go,setTransform:Ho,getFlipTransform:qo,getLocalOrigin:Vo,getRelativeWorld:Qo,drop:Jo}=pn;let Zo=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 At}get __LayoutProcessor(){return Nn}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(){const{leafer:t}=this;return t&&t.created&&t.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=Ro(Po),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Dn.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),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(Dn.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Dn.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(Dn.MOUNTED)):this.__emitLifeEvent(Dn.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){this.forceUpdate("surface")}__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=!!t||this.children.some((t=>t.__.mask))}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld;return Eo(this.__world,t.matrix,e,void 0,this.__world),Mo(this.__layout.renderBounds,e,e),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?Qo(this,e):this.worldTransform,r=s?t:{};return Mo(t,i,r),r}worldToLocal(t,e,s,i){this.parent?this.parent.worldToInner(t,e,s,i):e&&Io(e,t)}localToWorld(t,e,s,i){this.parent?this.parent.innerToWorld(t,e,s,i):e&&Io(e,t)}worldToInner(t,e,s,i){i&&(i.innerToWorld(t,e,s),t=e||t),So(this.worldTransform,t,e,s)}innerToWorld(t,e,s,i){Lo(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 Ao(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 Ao(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){Ho(this,t,e)}transform(t,e){Uo(this,t,e)}move(t,e){Wo(this,t,e)}moveInner(t,e){Xo(this,t,e,!0)}scaleOf(t,e,s,i){No(this,Vo(this,t),e,s,i)}rotateOf(t,e){Yo(this,Vo(this,t),e)}skewOf(t,e,s,i){Do(this,Vo(this,t),e,s,i)}transformWorld(t,e){Go(this,t,e)}moveWorld(t,e){Xo(this,t,e)}scaleOfWorld(t,e,s,i){zo(this,t,e,s,i)}rotateOfWorld(t,e){Fo(this,t,e)}skewOfWorld(t,e,s,i){jo(this,t,e,s,i)}flip(t){Uo(this,qo(this,t))}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){}__clip(t,e){}__renderShape(t,e,s,i){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Ct("path")}getMotionPoint(t){return Ct("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){Jo(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,i){}off_(t){}once(t,e,s){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,s){s?this.addAttr(t,e,s):qr(this.prototype,t,e)}static addAttr(t,e,s){s||(s=Tr),s(e)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Dn(t,this,this.parent))}destroy(){if(!this.destroyed){const{parent:t}=this;t&&this.remove(),this.children&&this.removeAll(!0),this.__emitLifeEvent(Dn.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0}}};Zo=Dt([tn(ho),tn(go),tn(ko),tn(no),tn(Co)],Zo);const{setListWithFn:$o}=rt,{sort:Ko}=kn,{localBoxBounds:ta,localStrokeBounds:ea,localRenderBounds:sa,maskLocalBoxBounds:ia,maskLocalStrokeBounds:ra,maskLocalRenderBounds:na}=vn;let oa=class extends Zo{__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(){$o(this.__layout.boxBounds,this.children,this.__hasMask?ia:ta)}__updateStrokeBounds(){$o(this.__layout.strokeBounds,this.children,this.__hasMask?ra:ea)}__updateRenderBounds(){$o(this.__layout.renderBounds,this.children,this.__hasMask?na:sa)}__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(Ko),this.__layout.affectChildrenSort=t}}add(t,e){t!==this&&(t.parent&&t.parent.remove(t),t.parent=this,void 0===e?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1),t.__layout.boxChanged||t.__layout.boxChange(),t.__layout.matrixChanged||t.__layout.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Dn.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Dn.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange())}addMany(...t){t.forEach((t=>this.add(t)))}remove(t,e){t?t.animationOut?t.__runAnimation("out",(()=>this.__remove(t,e))):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(Dn.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Dn.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new Dn(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}};oa=Dt([tn(To)],oa);class aa{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 aa;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let s=0,i=t.length;s<i;s++)e[t[s].innerId]=s}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class ha{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 la="1.0.3";export{yt as AlignHelper,Wt as Answer,pt as AroundHelper,dt as AutoBounds,Be as BezierHelper,ht as Bounds,rt as BoundsHelper,oa as Branch,kn as BranchHelper,To as BranchRender,Et as CanvasManager,Dn as ChildEvent,e as Creator,Mt as DataHelper,xt as Debug,ut as Direction4,ct as Direction9,Ee as EllipseHelper,Yn as Event,St as EventCreator,Vn as Eventer,ar as FileHelper,zn as ImageEvent,cr as ImageManager,s as IncrementId,Un as LayoutEvent,Zo as Leaf,ko as LeafBounds,vn as LeafBoundsHelper,At as LeafData,ho as LeafDataProxy,no as LeafEventer,pn as LeafHelper,Nn as LeafLayout,ha as LeafLevelList,aa as LeafList,go as LeafMatrix,Co as LeafRender,Qt as LeaferCanvasBase,Hn as LeaferEvent,gr as LeaferImage,a as MathHelper,D as Matrix,b as MatrixHelper,te as NeedConvertToCanvasCommandMap,h as OneRadian,l as PI2,d as PI_2,Qi as PathBounds,Ds as PathCommandDataHelper,$t as PathCommandMap,gs as PathConvert,ir as PathCorner,si as PathCreator,yi as PathDrawer,Jt as PathHelper,re as PathNumberCommandLengthMap,ie as PathNumberCommandMap,t as Platform,N as Point,E as PointHelper,Xn as PropertyEvent,ne as RectHelper,Gn as RenderEvent,Fn as ResizeEvent,Bt as Run,mt as StringNumberMap,dr as TaskItem,ur as TaskProcessor,z as TwoPointBoundsHelper,Tt as UICreator,Pn as WaitHelper,jn as WatchEvent,Ar as affectRenderBoundsType,Er as affectStrokeBoundsType,wr as attr,kr as autoLayoutType,Tr as boundsType,or as canvasPatch,Vt as canvasSizeAttrs,Ur as cursorType,Gr as dataProcessor,vr as dataType,xr as decorateLeafAttr,qr as defineDataProcessor,yr as defineKey,br as defineLeafAttr,Rr as doBoundsType,Mr as doStrokeType,Nt as emptyData,Fr as eraserType,c as getBoundsData,mr as getDescriptor,_ as getMatrixData,u as getPointData,jr as hitType,Yt as isNull,Hr as layoutProcessor,zr as maskType,Pr as naturalBoundsType,Ct as needPlugin,Nr as opacityType,Sr as pathInputType,Lr as pathType,rr as pen,Br as positionType,en as registerUI,sn as registerUIEvent,Zr as rewrite,$r as rewriteAble,Or as rotationType,Cr as scaleType,Xr as sortType,Ir as strokeType,Wr as surfaceType,lt as tempBounds,X as tempMatrix,Y as tempPoint,tn as useModule,la as version,Yr as visibleType};
|
|
1
|
+
const t={toURL(t,e){let s=encodeURIComponent(t);return"text"===e?s="data:text/plain;charset=utf-8,"+s:"svg"===e&&(s="data:image/svg+xml,"+s),s},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(e){const{prefix:s,suffix:r}=t.image;return!r||e.startsWith("data:")||e.startsWith("blob:")||(e+=(e.includes("?")?"&":"?")+r),s&&"/"===e[0]&&(e=s+e),e}}},e={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=r;return e[t]?e[t]++:(e[t]=1,0)}},r=s,{round:i,pow:n,PI:o}=Math,a={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)),a.float(t)),getGapRotation(t,e,s=0){let r=t+s;if(e>1){const t=Math.abs(r%e);(t<1||t>e-1)&&(r=Math.round(r/e)*e)}return r-s},float(t,e){const s=e?n(10,e):1e12;return-0===(t=i(t*s)/s)?0:t},getScaleData:(t,e,s,r)=>(r||(r={}),e?(r.scaleX=("number"==typeof e?e:e.width)/s.width,r.scaleY=("number"==typeof e?e:e.height)/s.height):t&&a.assignScale(r,t),r),assignScale(t,e){"number"==typeof e?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)}},h=o/180,l=2*o,d=o/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}=a,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,r=0,i=1,n=0,o=0){t.a=e,t.b=s,t.c=r,t.d=i,t.e=n,t.f=o},get:_,getWorld:w,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s,r){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s,r&&(t.e-=e,t.f-=s)},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},scaleOfOuter(t,e,s,r){v.toInnerPoint(t,e,x),v.scaleOfInner(t,x,s,r)},scaleOfInner(t,e,s,r=s){v.translateInner(t,e.x,e.y),v.scale(t,s,r),v.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:r,c:i,d:n}=t,o=f(e*=h),a=p(e);t.a=s*o-r*a,t.b=s*a+r*o,t.c=i*o-n*a,t.d=i*a+n*o},rotateOfOuter(t,e,s){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:r,b:i,c:n,d:o}=t;s&&(s*=h,t.a=r+n*s,t.b=i+o*s),e&&(e*=h,t.c=n+r*e,t.d=o+i*e)},skewOfOuter(t,e,s,r){v.toInnerPoint(t,e,x),v.skewOfInner(t,x,s,r)},skewOfInner(t,e,s,r=0){v.translateInner(t,e.x,e.y),v.skew(t,s,r),v.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:r,c:i,d:n,e:o,f:a}=t;t.a=e.a*s+e.b*i,t.b=e.a*r+e.b*n,t.c=e.c*s+e.d*i,t.d=e.c*r+e.d*n,t.e=e.e*s+e.f*i+o,t.f=e.e*r+e.f*n+a},multiplyParent(t,e,s,r,i,n){let{e:o,f:a}=t;if(n&&(o+=n.scrollX,a+=n.scrollY),s||(s=t),void 0===r&&(r=1!==t.a||t.b||t.c||1!==t.d),r){const{a:r,b:n,c:o,d:a}=t;s.a=r*e.a+n*e.c,s.b=r*e.b+n*e.d,s.c=o*e.a+a*e.c,s.d=o*e.b+a*e.d,i&&(s.scaleX=e.scaleX*i.scaleX,s.scaleY=e.scaleY*i.scaleY)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,i&&(s.scaleX=e.scaleX,s.scaleY=e.scaleY);s.e=o*e.a+a*e.c+e.e,s.f=o*e.b+a*e.d+e.f},divide(t,e){v.multiply(t,v.tempInvert(e))},divideParent(t,e){v.multiplyParent(t,v.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=v;return v.copy(e,t),v.invert(e),e},invert(t){const{a:e,b:s,c:r,d:i,e:n,f:o}=t;if(s||r){const a=1/(e*i-s*r);t.a=i*a,t.b=-s*a,t.c=-r*a,t.d=e*a,t.e=-(n*i-o*r)*a,t.f=-(o*e-n*s)*a}else if(1===e&&1===i)t.e=-n,t.f=-o;else{const s=1/(e*i);t.a=i*s,t.d=e*s,t.e=-n*i*s,t.f=-o*e*s}},toOuterPoint(t,e,s,r){const{x:i,y:n}=e;s||(s=e),s.x=i*t.a+n*t.c,s.y=i*t.b+n*t.d,r||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,r){const{a:i,b:n,c:o,d:a}=t,h=1/(i*a-n*o),{x:l,y:d}=e;if(s||(s=e),s.x=(l*a-d*o)*h,s.y=(d*i-l*n)*h,!r){const{e:e,f:r}=t;s.x-=(e*a-r*o)*h,s.y-=(r*i-e*n)*h}},setLayout(t,e,s,r,i){const{x:n,y:o,scaleX:a,scaleY:l}=e;if(void 0===i&&(i=e.rotation||e.skewX||e.skewY),i){const{rotation:s,skewX:r,skewY:i}=e,n=s*h,o=f(n),d=p(n);if(r||i){const e=r*h,s=i*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||r)&&v.translateInner(t,-s.x,-s.y,!r)},getLayout(t,e,s,r){const{a:i,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=i*a-n*o;if(o&&!r){c=y(i*i+n*n),_=t/c;const e=i/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=i,_=a,x=w=b=0;return(e=s||e)&&(v+=e.x*i+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 r=t;if(!e||!s){const{a:r,b:i,c:n,d:o}=t;i||n?s=(r*o-i*n)/(e=y(r*r+i*i)):(e=r,s=o)}return r.scaleX=e,r.scaleY=s,r},reset(t){v.set(t)}},v=b,{toInnerPoint:B,toOuterPoint:k}=b,{sin:C,cos:O,abs:T,sqrt:P,atan2:R,min:S,PI:L}=Math,E={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,s){t.radiusX=e,t.radiusY=void 0===s?e:s},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,s){t.x=e,t.y=s},move(t,e,s){t.x+=e,t.y+=s},scale(t,e,s=e){t.x&&(t.x*=e),t.y&&(t.y*=s)},scaleOf(t,e,s,r=s){t.x+=(t.x-e.x)*(s-1),t.y+=(t.y-e.y)*(r-1)},rotate(t,e,s){s||(s=I.defaultPoint);const r=O(e*=h),i=C(e),n=t.x-s.x,o=t.y-s.y;t.x=s.x+n*r-o*i,t.y=s.y+n*i+o*r},tempToInnerOf(t,e){const{tempPoint:s}=I;return A(s,t),B(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=I;return A(s,t),k(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=I;return A(s,t),I.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),B(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){B(e,t,s)},toOuterOf(t,e,s){k(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>M(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,r){const i=T(s-t),n=T(r-e);return P(i*i+n*n)},getMinDistanceFrom:(t,e,s,r,i,n)=>S(M(t,e,s,r),M(s,r,i,n)),getAngle:(t,e)=>W(t,e)/h,getRotation:(t,e,s,r)=>(r||(r=e),I.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,r.x,r.y)/h),getRadianFrom(t,e,s,r,i,n,o,a){void 0===o&&(o=s,a=r);let h=R(e-r,t-s);const d=R(n-a,i-o)-h;return d<-L?d+l:d},getAtan2:(t,e)=>R(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,r){const i=W(t,e);return(e=r?e:{}).x=t.x+O(i)*s,e.y=t.y+C(i)*s,e},reset(t){I.reset(t)}},I=E,{getDistanceFrom:M,copy:A,getAtan2:W}=I;class N{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?E.copy(this,t):E.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new N(this)}move(t,e){return E.move(this,t,e),this}scale(t,e){return E.scale(this,t,e),this}scaleOf(t,e,s){return E.scaleOf(this,t,e,s),this}rotate(t,e){return E.rotate(this,t,e),this}rotateOf(t,e){return E.rotate(this,e,t),this}getRotation(t,e,s){return E.getRotation(this,t,e,s)}toInnerOf(t,e){return E.toInnerOf(this,t,e),this}toOuterOf(t,e){return E.toOuterOf(this,t,e),this}getCenter(t){return new N(E.getCenter(this,t))}getDistance(t){return E.getDistance(this,t)}getDistancePoint(t,e,s){return new N(E.getDistancePoint(this,t,e,s))}getAngle(t){return E.getAngle(this,t)}getAtan2(t){return E.getAtan2(this,t)}reset(){return E.reset(this),this}}const Y=new N;class X{constructor(t,e,s,r,i,n){this.set(t,e,s,r,i,n)}set(t,e,s,r,i,n){return"object"==typeof t?b.copy(this,t):b.set(this,t,e,s,r,i,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:r,e:i,f:n}=this;return{a:t,b:e,c:s,d:r,e:i,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 D=new X,z={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,r,i){F(t,e,s),F(t,e+r,s+i)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:F}=z,{tempPointBounds:j,setPoint:U,addPoint:H,toBounds:G}=z,{toOuterPoint:q}=b,{float:V,fourNumber:Q}=a,{floor:J,ceil:Z}=Math;let $,K,tt,et;const st={},rt={},it={tempBounds:{},set(t,e=0,s=0,r=0,i=0){t.x=e,t.y=s,t.width=r,t.height=i},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s,r,i){const{x:n,y:o,width:a,height:h}=e;if(s instanceof Array){const e=Q(s);r?nt.set(t,n+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):nt.set(t,n-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else r&&(s=-s),nt.set(t,n-s,o-s,a+2*s,h+2*s);i&&("width"===i?(t.y=o,t.height=h):(t.x=n,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,s){t.x+=e,t.y+=s},getByMove:(t,e,s)=>(t=Object.assign({},t),nt.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?at(e,t):e=t,s?(e.offsetX=-(nt.maxX(s)-t.x),e.offsetY=-(nt.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),nt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e){E.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,r=s){E.scaleOf(t,e,s,r),t.width*=s,t.height*=r},tempToOuterOf:(t,e)=>(nt.copy(nt.tempBounds,t),nt.toOuterOf(nt.tempBounds,e),nt.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),nt.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:r,d:i}=e;r>0?(s.width=t.width*r,s.x=e.e+t.x*r):(s.width=t.width*-r,s.x=e.e+t.x*r-s.width),i>0?(s.height=t.height*i,s.y=e.f+t.y*i):(s.height=t.height*-i,s.y=e.f+t.y*i-s.height)}else st.x=t.x,st.y=t.y,q(e,st,rt),U(j,rt.x,rt.y),st.x=t.x+t.width,q(e,st,rt),H(j,rt.x,rt.y),st.y=t.y+t.height,q(e,st,rt),H(j,rt.x,rt.y),st.x=t.x,q(e,st,rt),H(j,rt.x,rt.y),G(j,s)},toInnerOf(t,e,s){s||(s=t),nt.move(s,-e.e,-e.f),nt.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const r=Math.min(s,Math.min(t.width/e.width,t.height/e.height));return new X(r,0,0,r,-e.x*r,-e.y*r)},getSpread(t,e,s){const r={};return nt.copyAndSpread(r,t,e,!1,s),r},spread(t,e,s){nt.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){nt.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=J(t.x),t.y=J(t.y),t.width=e>t.x?Z(t.width+e-t.x):Z(t.width),t.height=s>t.y?Z(t.height+s-t.y):Z(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=V(t.x,e),t.y=V(t.y,e),t.width=V(t.width,e),t.height=V(t.height,e)},add(t,e,s){$=t.x+t.width,K=t.y+t.height,tt=e.x,et=e.y,s||(tt+=e.width,et+=e.height),$=$>tt?$:tt,K=K>et?K:et,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=$-t.x,t.height=K-t.y},addList(t,e){nt.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){nt.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){nt.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,r=!1){let i,n=!0;for(let o=0,a=e.length;o<a;o++)i=s?s(e[o]):e[o],i&&(i.width||i.height)&&(n?(n=!1,r||at(t,i)):ot(t,i));n&&nt.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?U(j,t.x,t.y):H(j,t.x,t.y))),G(j,t)},setPoint(t,e){nt.set(t,e.x,e.y)},addPoint(t,e){ot(t,e,!0)},getPoints(t){const{x:e,y:s,width:r,height:i}=t;return[{x:e,y:s},{x:e+r,y:s},{x:e+r,y:s+i},{x:e,y:s+i}]},hitRadiusPoint:(t,e,s)=>(s&&(e=E.tempToInnerRadiusPointOf(e,s)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,s)=>(s&&(e=E.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=nt.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=nt.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=nt.tempToOuterOf(e,s)),!nt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:r,y:i,width:n,height:o}=e;return $=r+n,K=i+o,tt=t.x+t.width,et=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,$=$<tt?$:tt,K=K<et?K:et,n=$-r,o=K-i,{x:r,y:i,width:n,height:o}},intersect(t,e,s){nt.copy(t,nt.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){nt.set(t)}},nt=it,{add:ot,copy:at}=nt;class ht{get minX(){return it.minX(this)}get minY(){return it.minY(this)}get maxX(){return it.maxX(this)}get maxY(){return it.maxY(this)}constructor(t,e,s,r){this.set(t,e,s,r)}set(t,e,s,r){return"object"==typeof t?it.copy(this,t):it.set(this,t,e,s,r),this}get(){const{x:t,y:e,width:s,height:r}=this;return{x:t,y:e,width:s,height:r}}clone(){return new ht(this)}move(t,e){return it.move(this,t,e),this}scale(t,e){return it.scale(this,t,e),this}scaleOf(t,e,s){return it.scaleOf(this,t,e,s),this}toOuterOf(t,e){return it.toOuterOf(this,t,e),this}toInnerOf(t,e){return it.toInnerOf(this,t,e),this}getFitMatrix(t,e){return it.getFitMatrix(this,t,e)}spread(t,e){return it.spread(this,t,e),this}shrink(t,e){return it.shrink(this,t,e),this}ceil(){return it.ceil(this),this}unsign(){return it.unsign(this),this}float(t){return it.float(this,t),this}add(t){return it.add(this,t),this}addList(t){return it.setList(this,t,!0),this}setList(t){return it.setList(this,t),this}addListWithFn(t,e){return it.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return it.setListWithFn(this,t,e),this}setPoint(t){return it.setPoint(this,t),this}setPoints(t){return it.setPoints(this,t),this}addPoint(t){return it.addPoint(this,t),this}getPoints(){return it.getPoints(this)}hitPoint(t,e){return it.hitPoint(this,t,e)}hitRadiusPoint(t,e){return it.hitRadiusPoint(this,t,e)}hit(t,e){return it.hit(this,t,e)}includes(t,e){return it.includes(this,t,e)}intersect(t,e){return it.intersect(this,t,e),this}getIntersect(t,e){return new ht(it.getIntersectData(this,t,e))}isSame(t){return it.isSame(this,t)}isEmpty(){return it.isEmpty(this)}reset(){it.reset(this)}}const lt=new ht;class dt{constructor(t,e,s,r,i,n){"object"==typeof t?this.copy(t):this.set(t,e,s,r,i,n)}set(t=0,e=0,s=0,r=0,i=0,n=0){this.top=t,this.right=e,this.bottom=s,this.left=r,this.width=i,this.height=n}copy(t){const{top:e,right:s,bottom:r,left:i,width:n,height:o}=t;this.set(e,s,r,i,n,o)}getBoundsFrom(t){const{top:e,right:s,bottom:r,left:i,width:n,height:o}=this;return new ht(i,e,n||t.width-i-s,o||t.height-e-r)}}var ut,ct;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(ut||(ut={})),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"}(ct||(ct={}));const _t=[{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}];_t.forEach((t=>t.type="percent"));const pt={directionData:_t,tempPoint:{},get:ft,toPoint(t,e,s,r,i){const n=ft(t);s.x=n.x,s.y=n.y,"percent"===n.type&&(s.x*=e.width,s.y*=e.height,i&&(s.x-=i.x,s.y-=i.y,n.x&&(s.x-=1===n.x?i.width:.5===n.x?n.x*i.width:0),n.y&&(s.y-=1===n.y?i.height:.5===n.y?n.y*i.height:0))),r||(s.x+=e.x,s.y+=e.y)}};function ft(t){return"string"==typeof t?_t[ct[t]]:t}const{toPoint:gt}=pt,yt={toPoint(t,e,s,r,i){gt(t,s,r,i,e)}},mt={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};class xt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new xt(t)}static set filter(t){this.filterList=wt(t)}static set exclude(t){this.excludeList=wt(t)}log(...t){if(bt.enable){if(bt.filterList.length&&bt.filterList.every((t=>t!==this.name)))return;if(bt.excludeList.length&&bt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){bt.enable&&this.warn(...t)}warn(...t){bt.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 wt(t){return t?"string"==typeof t&&(t=[t]):t=[],t}xt.filterList=[],xt.excludeList=[],xt.showWarn=!0;const bt=xt,vt=xt.get("RunTime"),Bt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const r=s.create(s.RUNTIME);return kt.currentId=kt.idMap[r]=e?performance.now():Date.now(),kt.currentName=kt.nameMap[r]=t,kt.nameToIdMap[t]=r,r},end(t,e){const s=kt.idMap[t],r=kt.nameMap[t],i=e?(performance.now()-s)/1e3:Date.now()-s;kt.idMap[t]=kt.nameMap[t]=kt.nameToIdMap[r]=void 0,vt.log(r,i,"ms")},endOfName(t,e){const s=kt.nameToIdMap[t];void 0!==s&&kt.end(s,e)}},kt=Bt;function Ct(t){console.error("need plugin: @leafer-in/"+t)}const Ot=xt.get("UICreator"),Tt={list:{},register(t){const{__tag:e}=t.prototype;Pt[e]?Ot.repeat(e):Pt[e]=t},get(t,e,s,r,i,n){const o=new Pt[t](e);return void 0!==s&&(o.x=s,r&&(o.y=r),i&&(o.width=i),n&&(o.height=n)),o}},{list:Pt}=Tt,Rt=xt.get("EventCreator"),St={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(Lt[e]?Rt.repeat(e):Lt[e]=t)}))},changeName(t,e){const s=Lt[t];if(s){const r=Object.keys(s).find((e=>s[e]===t));r&&(s[r]=e,Lt[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Lt[t](...e)},{nameList:Lt}=St;class Et{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let s;const{list:r}=this;for(let e=0,i=r.length;e<i;e++)if(s=r[e],s.recycled&&s.isSameSize(t))return s.recycled=!1,s.manager||(s.manager=this),s;const i=e.canvas(t);return this.add(i),i}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let s=0,r=this.list.length;s<r;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach((t=>{t.destroy()})),this.list.length=0}destroy(){this.clear()}}const It={default:(t,e)=>(Mt(e,t),Mt(t,e),t),assign(t,e){let s;Object.keys(e).forEach((r=>{var i;s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(i=t[r])||void 0===i?void 0:i.constructor)===Object?Mt(t[r],e[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,r=t.length;s<r;s++)e[t[s]]=!0;return e}},{assign:Mt}=It;class At{get __useNaturalRatio(){return!0}get __isLinePath(){return this.path&&6===this.path.length}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s;for(let r in this)"_"!==r[0]&&(s=e?e[r]:void 0,t[r]=void 0===s?this[r]:s);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(t,e){const s={};if(t)if(t instanceof Array)for(let e of t)s[e]=this.__getInput(e);else for(let e in t)s[e]=this.__getInput(e);else{let t,e,{__input:r}=this;s.tag=this.__leaf.tag;for(let i in this)if("_"!==i[0]&&(t=this["_"+i],void 0!==t)){if("path"===i&&!this.__pathInputed)continue;e=r?r[i]:void 0,s[i]=void 0===e?t:e}}if(e&&e.matrix){const{a:t,b:e,c:r,d:i,e:n,f:o}=this.__leaf.__localMatrix;s.matrix={a:t,b:e,c:r,d:i,e:n,f:o}}return s}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&e.isBranch||e.__hasEraser||t.eraser?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 Wt;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(Wt||(Wt={}));const Nt={};function Yt(t){return null==t}function Xt(t,e,s,r){var i,n=arguments.length,o=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,s,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(o=(n<3?i(o):n>3?i(e,s,o):i(e,s))||o);return n>3&&o&&Object.defineProperty(e,s,o),o}function Dt(t,e,s,r){return new(s||(s=Promise))((function(i,n){function o(t){try{h(r.next(t))}catch(t){n(t)}}function a(t){try{h(r.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(o,a)}h((r=r.apply(t,e||[])).next())}))}function zt(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 Ft=[];function jt(){return(t,e)=>{Ft.push(e)}}const Ut=[];class Ht{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||Ut)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;Ft.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,s,r,i,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,r,i,n){"object"==typeof t?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,r,i,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,r){}strokeRect(t,e,s,r){}clearRect(t,e,s,r){}drawImage(t,e,s,r,i,n,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/r*a;r+=e,e=0,n+=t,a-=t}if(s<0){const t=-s/i*h;i+=s,s=0,o+=t,h-=t}this.context.drawImage(t,e,s,r,i,n,o,a,h);break;case 5:this.context.drawImage(t,e,s,r,i);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,r,i,n){}quadraticCurveTo(t,e,s,r){}closePath(){}arc(t,e,s,r,i,n){}arcTo(t,e,s,r,i){}ellipse(t,e,s,r,i,n,o,a){}rect(t,e,s,r){}roundRect(t,e,s,r,i){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,r){}createPattern(t,e){}createRadialGradient(t,e,s,r,i,n){}fillText(t,e,s,r){}measureText(t){}strokeText(t,e,s,r){}destroy(){this.context=null}}Xt([zt("imageSmoothingEnabled")],Ht.prototype,"smooth",void 0),Xt([zt("imageSmoothingQuality")],Ht.prototype,"smoothLevel",void 0),Xt([zt("globalAlpha")],Ht.prototype,"opacity",void 0),Xt([zt()],Ht.prototype,"fillStyle",void 0),Xt([zt()],Ht.prototype,"strokeStyle",void 0),Xt([zt("lineWidth")],Ht.prototype,"strokeWidth",void 0),Xt([zt("lineCap")],Ht.prototype,"strokeCap",void 0),Xt([zt("lineJoin")],Ht.prototype,"strokeJoin",void 0),Xt([zt("lineDashOffset")],Ht.prototype,"dashOffset",void 0),Xt([zt()],Ht.prototype,"miterLimit",void 0),Xt([zt()],Ht.prototype,"shadowBlur",void 0),Xt([zt()],Ht.prototype,"shadowColor",void 0),Xt([zt()],Ht.prototype,"shadowOffsetX",void 0),Xt([zt()],Ht.prototype,"shadowOffsetY",void 0),Xt([zt()],Ht.prototype,"filter",void 0),Xt([zt()],Ht.prototype,"font",void 0),Xt([zt()],Ht.prototype,"fontKerning",void 0),Xt([zt()],Ht.prototype,"fontStretch",void 0),Xt([zt()],Ht.prototype,"fontVariantCaps",void 0),Xt([zt()],Ht.prototype,"textAlign",void 0),Xt([zt()],Ht.prototype,"textBaseline",void 0),Xt([zt()],Ht.prototype,"textRendering",void 0),Xt([zt()],Ht.prototype,"wordSpacing",void 0),Xt([zt()],Ht.prototype,"letterSpacing",void 0),Xt([zt()],Ht.prototype,"direction",void 0),Xt([jt()],Ht.prototype,"setTransform",null),Xt([jt()],Ht.prototype,"resetTransform",null),Xt([jt()],Ht.prototype,"getTransform",null),Xt([jt()],Ht.prototype,"save",null),Xt([jt()],Ht.prototype,"restore",null),Xt([jt()],Ht.prototype,"translate",null),Xt([jt()],Ht.prototype,"scale",null),Xt([jt()],Ht.prototype,"rotate",null),Xt([jt()],Ht.prototype,"fill",null),Xt([jt()],Ht.prototype,"stroke",null),Xt([jt()],Ht.prototype,"clip",null),Xt([jt()],Ht.prototype,"fillRect",null),Xt([jt()],Ht.prototype,"strokeRect",null),Xt([jt()],Ht.prototype,"clearRect",null),Xt([jt()],Ht.prototype,"beginPath",null),Xt([jt()],Ht.prototype,"moveTo",null),Xt([jt()],Ht.prototype,"lineTo",null),Xt([jt()],Ht.prototype,"bezierCurveTo",null),Xt([jt()],Ht.prototype,"quadraticCurveTo",null),Xt([jt()],Ht.prototype,"closePath",null),Xt([jt()],Ht.prototype,"arc",null),Xt([jt()],Ht.prototype,"arcTo",null),Xt([jt()],Ht.prototype,"ellipse",null),Xt([jt()],Ht.prototype,"rect",null),Xt([jt()],Ht.prototype,"roundRect",null),Xt([jt()],Ht.prototype,"createConicGradient",null),Xt([jt()],Ht.prototype,"createLinearGradient",null),Xt([jt()],Ht.prototype,"createPattern",null),Xt([jt()],Ht.prototype,"createRadialGradient",null),Xt([jt()],Ht.prototype,"fillText",null),Xt([jt()],Ht.prototype,"measureText",null),Xt([jt()],Ht.prototype,"strokeText",null);const{copy:Gt}=b,qt={width:1,height:1,pixelRatio:1},Vt=["width","height","pixelRatio"];class Qt extends Ht{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 allowBackgroundColor(){return this.view&&this.parentView}constructor(e,r){super(),this.size={},this.worldTransform={},e||(e=qt),e.pixelRatio||(e.pixelRatio=t.devicePixelRatio),this.manager=r,this.innerId=s.create(s.CNAVAS);const{width:i,height:n,pixelRatio:o}=e;this.autoLayout=!i||!n,this.size.pixelRatio=o,this.config=e,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){if(this.isSameSize(t))return;let e;this.context&&!this.unreal&&this.width&&(e=this.getSameCanvas(),e.copyWorld(this)),It.copyAttrs(this.size,t,Vt),this.size.pixelRatio||(this.size.pixelRatio=1),this.bounds=new ht(0,0,this.width,this.height),this.context&&!this.unreal&&(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&e&&(this.clearWorld(e.bounds),this.copyWorld(e),e.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}=this,r=this.worldTransform;if(e){const{a:i,b:n,c:o,d:a,e:h,f:l}=e;this.setTransform(r.a=(t.a*i+t.b*o)*s,r.b=(t.a*n+t.b*a)*s,r.c=(t.c*i+t.d*o)*s,r.d=(t.c*n+t.d*a)*s,r.e=(t.e*i+t.f*o+h)*s,r.f=(t.e*n+t.f*a+l)*s)}else this.setTransform(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)}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,r){const{pixelRatio:i}=this;this.shadowOffsetX=t*i,this.shadowOffsetY=e*i,this.shadowBlur=s*i,this.shadowColor=r||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,r){if(r&&(this.blendMode=r),e){const{pixelRatio:r}=this;s||(s=e),this.drawImage(t.view,e.x*r,e.y*r,e.width*r,e.height*r,s.x*r,s.y*r,s.width*r,s.height*r)}else this.drawImage(t.view,0,0);r&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,r){if(r&&(this.blendMode=r),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,it.tempToOuterOf(s,e)),this.restore();else{const{pixelRatio:r}=this;this.drawImage(t.view,e.x*r,e.y*r,e.width*r,e.height*r,s.x,s.y,s.width,s.height)}r&&(this.blendMode="source-over")}copyWorldByReset(t,e,s,r,i){this.resetTransform(),this.copyWorld(t,e,s,r),i||this.useWorldTransform()}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,lt.set(t).scale(this.pixelRatio),this.fillRect(lt.x,lt.y,lt.width,lt.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,lt.set(t).scale(this.pixelRatio),this.strokeRect(lt.x,lt.y,lt.width,lt.height),s&&(this.blendMode="source-over")}clearWorld(t,e){lt.set(t).scale(this.pixelRatio),e&<.ceil(),this.clearRect(lt.x,lt.y,lt.width,lt.height)}clipWorld(t,e){this.beginPath(),lt.set(t).scale(this.pixelRatio),e&<.ceil(),this.rect(lt.x,lt.y,lt.width,lt.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}isSameSize(t){return this.width===t.width&&this.height===t.height&&this.pixelRatio===t.pixelRatio}getSameCanvas(t,s){const r=this.manager?this.manager.get(this.size):e.canvas(Object.assign({},this.size));return r.save(),t&&(Gt(r.worldTransform,this.worldTransform),r.useWorldTransform()),s&&(r.smooth=this.smooth),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 Jt={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Zt={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},$t=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},Zt),Kt={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},te={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},ee=Object.assign(Object.assign({},te),Zt),se=$t,re={};for(let t in se)re[se[t]]=t;const ie={};for(let t in se)ie[se[t]]=Kt[t];const ne={drawRoundRect(t,e,s,r,i,n){const o=a.fourNumber(n,Math.min(r/2,i/2)),h=e+r,l=s+i;o[0]?t.moveTo(e+o[0],s):t.moveTo(e,s),o[1]?t.arcTo(h,s,h,l,o[1]):t.lineTo(h,s),o[2]?t.arcTo(h,l,e,l,o[2]):t.lineTo(h,l),o[3]?t.arcTo(e,l,e,s,o[3]):t.lineTo(e,l),o[0]?t.arcTo(e,s,h,s,o[0]):t.lineTo(e,s)}},{sin:oe,cos:ae,atan2:he,ceil:le,abs:de,PI:ue,sqrt:ce,pow:_e}=Math,{setPoint:pe,addPoint:fe}=z,{set:ge}=E,{M:ye,L:me,C:xe,Q:we,Z:be}=$t,ve={},Be={points(t,e,s,r){if(t.push(ye,e[0],e[1]),s&&e.length>5){let i,n,o,a,h,l,d,u,c,_,p,f,g,y=e.length;const m=!0===s?.5:s;r&&(y=(e=[e[y-2],e[y-1],...e,e[0],e[1],e[2],e[3]]).length);for(let s=2;s<y-2;s+=2)i=e[s-2],n=e[s-1],o=e[s],a=e[s+1],h=e[s+2],l=e[s+3],p=ce(_e(o-i,2)+_e(a-n,2)),f=ce(_e(h-o,2)+_e(l-a,2)),g=p+f,p=m*p/g,f=m*f/g,h-=i,l-=n,d=o-p*h,u=a-p*l,2===s?r||t.push(we,d,u,o,a):t.push(xe,c,_,d,u,o,a),c=o+f*h,_=a+f*l;r||t.push(we,c,_,e[y-2],e[y-1])}else for(let s=2,r=e.length;s<r;s+=2)t.push(me,e[s],e[s+1]);r&&t.push(be)},rect(t,e,s,r,i){Jt.creator.path=t,Jt.creator.moveTo(e,s).lineTo(e+r,s).lineTo(e+r,s+i).lineTo(e,s+i).lineTo(e,s)},roundRect(t,e,s,r,i,n){Jt.creator.path=[],ne.drawRoundRect(Jt.creator,e,s,r,i,n),t.push(...Jt.convertToCanvasData(Jt.creator.path,!0))},arcTo(t,e,s,r,i,n,o,a,u,c,_){const p=r-e,f=i-s,g=n-r,y=o-i;let m=he(f,p),x=he(y,g),w=x-m;if(w<0&&(w+=l),w===ue||de(p+f)<1e-12||de(g+y)<1e-12)return t&&t.push(me,r,i),u&&(pe(u,e,s),fe(u,r,i)),_&&ge(_,e,s),void(c&&ge(c,r,i));const b=p*y-g*f<0,v=b?-1:1,B=a/ae(w/2),k=r+B*ae(m+w/2+d*v),C=i+B*oe(m+w/2+d*v);return m-=d*v,x-=d*v,Oe(t,k,C,a,a,0,m/h,x/h,b,u,c,_)},arc:(t,e,s,r,i,n,o,a,h,l)=>Oe(t,e,s,r,r,0,i,n,o,a,h,l),ellipse(t,e,s,r,i,n,o,a,u,c,_,p){const f=n*h,g=oe(f),y=ae(f);let m=o*h,x=a*h;m>ue&&(m-=l),x<0&&(x+=l);let w=x-m;w<0?w+=l:w>l&&(w-=l),u&&(w-=l);const b=le(de(w/d)),v=w/b,B=oe(v/4),k=8/3*B*B/oe(v/2);x=m+v;let C,O,T,P,R,S,L,E,I=ae(m),M=oe(m),A=T=y*r*I-g*i*M,W=P=g*r*I+y*i*M,N=e+T,Y=s+P;t&&t.push(t.length?me:ye,N,Y),c&&pe(c,N,Y),p&&ge(p,N,Y);for(let n=0;n<b;n++)C=ae(x),O=oe(x),T=y*r*C-g*i*O,P=g*r*C+y*i*O,R=e+A-k*(y*r*M+g*i*I),S=s+W-k*(g*r*M-y*i*I),L=e+T+k*(y*r*O+g*i*C),E=s+P+k*(g*r*O-y*i*C),t&&t.push(xe,R,S,L,E,e+T,s+P),c&&Ce(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;_&&ge(_,e+T,s+P)},quadraticCurveTo(t,e,s,r,i,n,o){t.push(xe,(e+2*r)/3,(s+2*i)/3,(n+2*r)/3,(o+2*i)/3,n,o)},toTwoPointBoundsByQuadraticCurve(t,e,s,r,i,n,o,a){Ce(t,e,(t+2*s)/3,(e+2*r)/3,(i+2*s)/3,(n+2*r)/3,i,n,o,a)},toTwoPointBounds(t,e,s,r,i,n,o,a,h,l){const d=[];let u,c,_,p,f,g,y,m,x=t,w=s,b=i,v=o;for(let t=0;t<2;++t)if(1==t&&(x=e,w=r,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?fe(h,t,e):pe(h,t,e),fe(h,o,a);for(let l=0,u=d.length;l<u;l++)ke(d[l],t,e,s,r,i,n,o,a,ve),fe(h,ve.x,ve.y)},getPointAndSet(t,e,s,r,i,n,o,a,h,l){const d=1-t,u=d*d*d,c=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=u*e+c*r+_*n+p*a,l.y=u*s+c*i+_*o+p*h},getPoint(t,e,s,r,i,n,o,a,h){const l={};return ke(t,e,s,r,i,n,o,a,h,l),l}},{getPointAndSet:ke,toTwoPointBounds:Ce,ellipse:Oe}=Be,{sin:Te,cos:Pe,sqrt:Re,atan2:Se}=Math,{ellipse:Le}=Be,Ee={ellipticalArc(e,s,r,i,n,o,a,d,u,c,_){const p=(u-s)/2,f=(c-r)/2,g=o*h,y=Te(g),m=Pe(g),x=-m*p-y*f,w=-m*f+y*p,b=i*i,v=n*n,B=w*w,k=x*x,C=b*v-b*B-v*k;let O=0;if(C<0){const t=Re(1-C/(b*v));i*=t,n*=t}else O=(a===d?-1:1)*Re(C/(b*B+v*k));const T=O*i*w/n,P=-O*n*x/i,R=Se((w-P)/n,(x-T)/i),S=Se((-w-P)/n,(-x-T)/i);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=r+f+y*T+m*P,M=L<0?1:0;_||t.ellipseToCurve?Le(e,E,I,i,n,o,R/h,S/h,M):i!==n||o?e.push($t.G,E,I,i,n,o,R/h,S/h,M):e.push($t.O,E,I,i,R/h,S/h,M)}},{M:Ie,m:Me,L:Ae,l:We,H:Ne,h:Ye,V:Xe,v:De,C:ze,c:Fe,S:je,s:Ue,Q:He,q:Ge,T:qe,t:Ve,A:Qe,a:Je,Z:Ze,z:$e,N:Ke,D:ts,X:es,G:ss,F:rs,O:is,P:ns,U:os}=$t,{rect:as,roundRect:hs,arcTo:ls,arc:ds,ellipse:us,quadraticCurveTo:cs}=Be,{ellipticalArc:_s}=Ee,ps=xt.get("PathConvert"),fs={},gs={current:{dot:0},stringify(t,e){let s,r,i,n=0,o=t.length,h="";for(;n<o;){r=t[n],s=ie[r],h+=r===i?" ":re[r];for(let r=1;r<s;r++)h+=a.float(t[n+r],e),r===s-1||(h+=" ");i=r,n+=s}return h},parse(t,e){let s,r,i,n="";const o=[],a=e?ee:te;for(let e=0,h=t.length;e<h;e++)r=t[e],mt[r]?("."===r&&(ys.dot&&(ms(o,n),n=""),ys.dot++),"0"===n&&"."!==r&&(ms(o,n),n=""),n+=r):$t[r]?(n&&(ms(o,n),n=""),ys.name=$t[r],ys.length=Kt[r],ys.index=0,ms(o,ys.name),!s&&a[r]&&(s=!0)):"-"===r||"+"===r?"e"===i||"E"===i?n+=r:(n&&ms(o,n),n=r):n&&(ms(o,n),n=""),i=r;return n&&ms(o,n),s?gs.toCanvasData(o,e):o},toCanvasData(t,e){let s,r,i,n,o,a=0,h=0,l=0,d=0,u=0,c=t.length;const _=[];for(;u<c;){switch(i=t[u],i){case Me:t[u+1]+=a,t[u+2]+=h;case Ie:a=t[u+1],h=t[u+2],_.push(Ie,a,h),u+=3;break;case Ye:t[u+1]+=a;case Ne:a=t[u+1],_.push(Ae,a,h),u+=2;break;case De:t[u+1]+=h;case Xe:h=t[u+1],_.push(Ae,a,h),u+=2;break;case We:t[u+1]+=a,t[u+2]+=h;case Ae:a=t[u+1],h=t[u+2],_.push(Ae,a,h),u+=3;break;case Ue:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=je;case je:o=n===ze||n===je,l=o?2*a-s:t[u+1],d=o?2*h-r:t[u+2],s=t[u+1],r=t[u+2],a=t[u+3],h=t[u+4],_.push(ze,l,d,s,r,a,h),u+=5;break;case Fe:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,t[u+5]+=a,t[u+6]+=h,i=ze;case ze:s=t[u+3],r=t[u+4],a=t[u+5],h=t[u+6],_.push(ze,t[u+1],t[u+2],s,r,a,h),u+=7;break;case Ve:t[u+1]+=a,t[u+2]+=h,i=qe;case qe:o=n===He||n===qe,s=o?2*a-s:t[u+1],r=o?2*h-r:t[u+2],e?cs(_,a,h,s,r,t[u+1],t[u+2]):_.push(He,s,r,t[u+1],t[u+2]),a=t[u+1],h=t[u+2],u+=3;break;case Ge:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=He;case He:s=t[u+1],r=t[u+2],e?cs(_,a,h,s,r,t[u+3],t[u+4]):_.push(He,s,r,t[u+3],t[u+4]),a=t[u+3],h=t[u+4],u+=5;break;case Je:t[u+6]+=a,t[u+7]+=h;case Qe:_s(_,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 $e:case Ze:_.push(Ze),u++;break;case Ke:a=t[u+1],h=t[u+2],e?as(_,a,h,t[u+3],t[u+4]):xs(_,t,u,5),u+=5;break;case ts:a=t[u+1],h=t[u+2],e?hs(_,a,h,t[u+3],t[u+4],[t[u+5],t[u+6],t[u+7],t[u+8]]):xs(_,t,u,9),u+=9;break;case es:a=t[u+1],h=t[u+2],e?hs(_,a,h,t[u+3],t[u+4],t[u+5]):xs(_,t,u,6),u+=6;break;case ss:us(e?_:xs(_,t,u,9),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],t[u+7],t[u+8],null,fs),a=fs.x,h=fs.y,u+=9;break;case rs:e?us(_,t[u+1],t[u+2],t[u+3],t[u+4],0,0,360,!1):xs(_,t,u,5),a=t[u+1]+t[u+3],h=t[u+2],u+=5;break;case is:ds(e?_:xs(_,t,u,7),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],null,fs),a=fs.x,h=fs.y,u+=7;break;case ns:e?ds(_,t[u+1],t[u+2],t[u+3],0,360,!1):xs(_,t,u,4),a=t[u+1]+t[u+3],h=t[u+2],u+=4;break;case os:ls(e?_:xs(_,t,u,6),a,h,t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],null,fs),a=fs.x,h=fs.y,u+=6;break;default:return ps.error(`command: ${i} [index:${u}]`,t),_}n=i}return _},copyData(t,e,s,r){for(let i=s,n=s+r;i<n;i++)t.push(e[i])},pushData(t,e){ys.index===ys.length&&(ys.index=1,t.push(ys.name)),t.push(Number(e)),ys.index++,ys.dot=0}},{current:ys,pushData:ms,copyData:xs}=gs,{M:ws,L:bs,C:vs,Q:Bs,Z:ks,N:Cs,D:Os,X:Ts,G:Ps,F:Rs,O:Ss,P:Ls,U:Es}=$t,{getMinDistanceFrom:Is,getRadianFrom:Ms}=E,{tan:As,min:Ws,abs:Ns}=Math,Ys={},Xs={beginPath(t){t.length=0},moveTo(t,e,s){t.push(ws,e,s)},lineTo(t,e,s){t.push(bs,e,s)},bezierCurveTo(t,e,s,r,i,n,o){t.push(vs,e,s,r,i,n,o)},quadraticCurveTo(t,e,s,r,i){t.push(Bs,e,s,r,i)},closePath(t){t.push(ks)},rect(t,e,s,r,i){t.push(Cs,e,s,r,i)},roundRect(t,e,s,r,i,n){if("number"==typeof n)t.push(Ts,e,s,r,i,n);else{const o=a.fourNumber(n);o?t.push(Os,e,s,r,i,...o):t.push(Cs,e,s,r,i)}},ellipse(t,e,s,r,i,n,o,a,h){void 0===n?t.push(Rs,e,s,r,i):(void 0===o&&(o=0),void 0===a&&(a=360),t.push(Ps,e,s,r,i,n,o,a,h?1:0))},arc(t,e,s,r,i,n,o){void 0===i?t.push(Ls,e,s,r):(void 0===n&&(n=360),t.push(Ss,e,s,r,i,n,o?1:0))},arcTo(t,e,s,r,i,n,o,a){if(void 0!==o){const h=As(Ms(o,a,e,s,r,i)/2)*(Is(o,a,e,s,r,i)/2);t.push(Es,e,s,r,i,Ws(n,Ns(h)))}else t.push(Es,e,s,r,i,n)},drawEllipse(t,e,s,r,i,n,o,a,h){Be.ellipse(null,e,s,r,i,void 0===n?0:n,void 0===o?0:o,void 0===a?360:a,h,null,null,Ys),t.push(ws,Ys.x,Ys.y),Ds(t,e,s,r,i,n,o,a,h)},drawArc(t,e,s,r,i,n,o){Be.arc(null,e,s,r,void 0===i?0:i,void 0===n?360:n,o,null,null,Ys),t.push(ws,Ys.x,Ys.y),zs(t,e,s,r,i,n,o)},drawPoints(t,e,s,r){Be.points(t,e,s,r)}},{ellipse:Ds,arc:zs}=Xs,{moveTo:Fs,lineTo:js,quadraticCurveTo:Us,bezierCurveTo:Hs,closePath:Gs,beginPath:qs,rect:Vs,roundRect:Qs,ellipse:Js,arc:Zs,arcTo:$s,drawEllipse:Ks,drawArc:tr,drawPoints:er}=Xs;class sr{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.clearPath=this.beginPath,this.set(t)}set(t){return this.__path=t?"string"==typeof t?Jt.parse(t):t:[],this}beginPath(){return qs(this.__path),this.paint(),this}moveTo(t,e){return Fs(this.__path,t,e),this.paint(),this}lineTo(t,e){return js(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,r,i,n){return Hs(this.__path,t,e,s,r,i,n),this.paint(),this}quadraticCurveTo(t,e,s,r){return Us(this.__path,t,e,s,r),this.paint(),this}closePath(){return Gs(this.__path),this.paint(),this}rect(t,e,s,r){return Vs(this.__path,t,e,s,r),this.paint(),this}roundRect(t,e,s,r,i){return Qs(this.__path,t,e,s,r,i),this.paint(),this}ellipse(t,e,s,r,i,n,o,a){return Js(this.__path,t,e,s,r,i,n,o,a),this.paint(),this}arc(t,e,s,r,i,n){return Zs(this.__path,t,e,s,r,i,n),this.paint(),this}arcTo(t,e,s,r,i){return $s(this.__path,t,e,s,r,i),this.paint(),this}drawEllipse(t,e,s,r,i,n,o,a){return Ks(this.__path,t,e,s,r,i,n,o,a),this.paint(),this}drawArc(t,e,s,r,i,n){return tr(this.__path,t,e,s,r,i,n),this.paint(),this}drawPoints(t,e,s){return er(this.__path,t,e,s),this.paint(),this}paint(){}}const{M:rr,L:ir,C:nr,Q:or,Z:ar,N:hr,D:lr,X:dr,G:ur,F:cr,O:_r,P:pr,U:fr}=$t,gr=xt.get("PathDrawer"),yr={drawPathByData(t,e){if(!e)return;let s,r=0,i=e.length;for(;r<i;)switch(s=e[r],s){case rr:t.moveTo(e[r+1],e[r+2]),r+=3;break;case ir:t.lineTo(e[r+1],e[r+2]),r+=3;break;case nr:t.bezierCurveTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5],e[r+6]),r+=7;break;case or:t.quadraticCurveTo(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case ar:t.closePath(),r+=1;break;case hr:t.rect(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case lr:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],[e[r+5],e[r+6],e[r+7],e[r+8]]),r+=9;break;case dr:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;case ur:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]*h,e[r+6]*h,e[r+7]*h,e[r+8]),r+=9;break;case cr:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,l,!1),r+=5;break;case _r:t.arc(e[r+1],e[r+2],e[r+3],e[r+4]*h,e[r+5]*h,e[r+6]),r+=7;break;case pr:t.arc(e[r+1],e[r+2],e[r+3],0,l,!1),r+=4;break;case fr:t.arcTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;default:return void gr.error(`command: ${s} [index:${r}]`,e)}}},{M:mr,L:xr,C:wr,Q:br,Z:vr,N:Br,D:kr,X:Cr,G:Or,F:Tr,O:Pr,P:Rr,U:Sr}=$t,{toTwoPointBounds:Lr,toTwoPointBoundsByQuadraticCurve:Er,arcTo:Ir,arc:Mr,ellipse:Ar}=Be,{addPointBounds:Wr,copy:Nr,addPoint:Yr,setPoint:Xr,addBounds:Dr,toBounds:zr}=z,Fr=xt.get("PathBounds");let jr,Ur,Hr;const Gr={},qr={},Vr={},Qr={toBounds(t,e){Qr.toTwoPointBounds(t,qr),zr(qr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Xr(e,0,0);let s,r,i,n,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===vr||o===wr||o===br?Xr(e,h,l):Xr(e,t[a+1],t[a+2])),o){case mr:case xr:h=t[a+1],l=t[a+2],Yr(e,h,l),a+=3;break;case wr:i=t[a+5],n=t[a+6],Lr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,n,Gr),Wr(e,Gr),h=i,l=n,a+=7;break;case br:s=t[a+1],r=t[a+2],i=t[a+3],n=t[a+4],Er(h,l,s,r,i,n,Gr),Wr(e,Gr),h=i,l=n,a+=5;break;case vr:a+=1;break;case Br:h=t[a+1],l=t[a+2],Dr(e,h,l,t[a+3],t[a+4]),a+=5;break;case kr:case Cr:h=t[a+1],l=t[a+2],Dr(e,h,l,t[a+3],t[a+4]),a+=o===kr?9:6;break;case Or:Ar(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],Gr,Vr),0===a?Nr(e,Gr):Wr(e,Gr),h=Vr.x,l=Vr.y,a+=9;break;case Tr:h=t[a+1],l=t[a+2],Ur=t[a+3],Hr=t[a+4],Dr(e,h-Ur,l-Hr,2*Ur,2*Hr),h+=Ur,a+=5;break;case Pr:Mr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Gr,Vr),0===a?Nr(e,Gr):Wr(e,Gr),h=Vr.x,l=Vr.y,a+=7;break;case Rr:h=t[a+1],l=t[a+2],jr=t[a+3],Dr(e,h-jr,l-jr,2*jr,2*jr),h+=jr,a+=4;break;case Sr:Ir(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Gr,Vr),0===a?Nr(e,Gr):Wr(e,Gr),h=Vr.x,l=Vr.y,a+=6;break;default:return void Fr.error(`command: ${o} [index:${a}]`,t)}}},{M:Jr,L:Zr,C:$r,Z:Kr}=$t,{getCenterX:ti,getCenterY:ei}=E,{arcTo:si}=Xs,ri={smooth(t,e,s){let r,i=0,n=0,o=0,a=0,h=0,l=0,d=0,u=0,c=0;const _=t.length,p=[];for(;i<_;)switch(r=t[i],r){case Jr:a=u=t[i+1],h=c=t[i+2],i+=3,t[i]===Zr?(l=t[i+1],d=t[i+2],p.push(Jr,ti(a,l),ei(h,d))):p.push(Jr,a,h);break;case Zr:switch(n=t[i+1],o=t[i+2],i+=3,t[i]){case Zr:si(p,n,o,t[i+1],t[i+2],e,u,c);break;case Kr:si(p,n,o,a,h,e,u,c);break;default:p.push(Zr,n,o)}u=n,c=o;break;case $r:p.push($r,t[i+1],t[i+2],t[i+3],t[i+4],t[i+5],t[i+6]),i+=7;break;case Kr:si(p,a,h,l,d,e,u,c),p.push(Kr),i+=1}return r!==Kr&&(p[1]=a,p[2]=h),p}};Jt.creator=new sr,Jt.parse=gs.parse,Jt.convertToCanvasData=gs.toCanvasData;const ii=new sr,{drawRoundRect:ni}=ne;function oi(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,r,i){ni(this,t,e,s,r,i)})}(t)}const ai={opacityTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=hi.fileType(t);return["jpg","jpeg"].some((t=>t===e))},getExportOptions(t){switch(typeof t){case"object":return t;case"number":return{quality:t};case"boolean":return{blob:t};default:return{}}}},hi=ai;hi.opacityTypes.forEach((t=>hi.upperCaseTypeMap[t]=t.toUpperCase()));const li=xt.get("TaskProcessor");class di{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return Dt(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){li.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class ui{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,s=0;for(let r=0;r<t;r++)r<=this.finishedIndex?(s+=this.list[r].time,r===this.finishedIndex&&(e=s)):e+=this.list[r].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&It.assign(this.config,t),this.empty()}add(t,e){let s,r,i,n;const o=new di(t);return o.parent=this,"number"==typeof e?n=e:e&&(r=e.parallel,s=e.start,i=e.time,n=e.delay),i&&(o.time=i),!1===r&&(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,r=this.finishedIndex+s;if(e.length){if(!this.running)return;r<this.total&&(t=this.list[r],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach((t=>{t.parallel=!1})),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const ci={map:{},recycledList:[],tasker:new ui,patternTasker:new ui,get isComplete(){return _i.tasker.isComplete},get(t){let s=_i.map[t.url];return s||(s=e.image(t),_i.map[t.url]=s),s.use++,s},recycle(t){t.use--,setTimeout((()=>{t.use||_i.recycledList.push(t)}))},clearRecycled(){const t=_i.recycledList;t.length>100&&(t.forEach((t=>{!t.use&&t.url&&(delete _i.map[t.url],t.destroy())})),t.length=0)},hasOpacityPixel:t=>ai.opacityTypes.some((e=>_i.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+ai.mineType(t)))return!0}else if(s.includes("."+t)||s.includes("."+ai.upperCaseTypeMap[t]))return!0;return!1},destroy(){_i.map={},_i.recycledList=[]}},_i=ci,{IMAGE:pi,create:fi}=s;class gi{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){this.use=0,this.waitComplete=[],this.innerId=fi(pi),this.config=t||{url:""},this.isSVG=ci.isFormat("svg",t),this.hasOpacityPixel=ci.hasOpacityPixel(t)}load(e,s){return this.loading||(this.loading=!0,ci.tasker.add((()=>Dt(this,void 0,void 0,(function*(){return yield t.origin.loadImage(this.url).then((t=>{this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)})).catch((t=>{this.error=t,this.onComplete(!1)}))}))))),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}onComplete(t){let e;this.waitComplete.forEach(((s,r)=>{e=r%2,s&&(t?e||s(this):e&&s(this.error))})),this.waitComplete.length=0,this.loading=!1}getCanvas(e,s,r,i){if(e||(e=this.width),s||(s=this.height),this.cache){let{params:t,data:e}=this.cache;for(let s in t)if(t[s]!==arguments[s]){e=null;break}if(e)return e}const n=t.origin.createCanvas(e,s),o=n.getContext("2d");return r&&(o.globalAlpha=r),o.drawImage(this.view,0,0,e,s),this.cache=this.use>1?{data:n,params:arguments}:null,n}getPattern(e,s,r,i){const n=t.canvas.createPattern(e,s);try{r&&n.setTransform&&(n.setTransform(r),r=null)}catch(t){}return i&&(i.transform=r),n}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function yi(t,e,s,r){r||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function mi(t,e){return Object.getOwnPropertyDescriptor(t,e)}function xi(t,e){return(s,r)=>bi(s,r,t,e&&e(r))}function wi(t){return t}function bi(t,e,s,r){const i={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};yi(t,e,Object.assign(i,r||{})),qi(t,e,s)}function vi(t){return xi(t)}function Bi(t,e){return xi(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})))}function ki(t){return xi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal())}})))}function Ci(t,e){return xi(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}})))}function Oi(t,e){return xi(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}})))}function Ti(t,e){return xi(t,(t=>({set(s){this.__setAttr(t,s,e)&&Ri(this)}})))}function Pi(t){return xi(t,(t=>({set(e){this.__setAttr(t,e)&&(Ri(this),this.__.__removeNaturalSize())}})))}function Ri(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Si(t){return xi(t,(t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),Ri(this)}})))}const Li=Ti;function Ei(t){return xi(t,(t=>({set(e){this.__setAttr(t,e)&&Ii(this)}})))}function Ii(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Ri(t)}const Mi=Ei;function Ai(t){return xi(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))}function Wi(t){return xi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})))}function Ni(t){return xi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange())}})))}function Yi(t){return xi(t,(t=>({set(e){const s=this.visible;if(!0===s&&0===e){if(this.animationOut)return this.__runAnimation("out",(()=>Xi(this,t,e,s)))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");Xi(this,t,e,s)}})))}function Xi(t,e,s,r){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==r&&0!==s||Ri(t))}function Di(t){return xi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()})))}})))}function zi(t){return xi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(e)})))}})))}function Fi(t){return xi(t,(t=>({set(e){this.__setAttr(t,e)&&this.waitParent((()=>{this.parent.__updateEraser(e)}))}})))}function ji(t){return xi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,xt.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}})))}function Ui(t){return xi(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}})))}function Hi(t){return(e,s)=>{yi(e,"__DataProcessor",{get:()=>t})}}function Gi(t){return(e,s)=>{yi(e,"__LayoutProcessor",{get:()=>t})}}function qi(t,e,s){const r=t.__DataProcessor.prototype,i="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),o={get(){const t=this[i];return void 0===t?s:t},set(t){this[i]=t}};if(void 0===s)o.get=function(){return this[i]};else if("object"==typeof s){const{clone:t}=It;o.get=function(){let e=this[i];return void 0===e&&(this[i]=e=t(s)),e}}"width"===e?o.get=function(){const t=this[i];if(void 0===t){const t=this;return t._height&&t.__naturalWidth&&t.__useNaturalRatio?t._height*t.__naturalWidth/t.__naturalHeight:t.__naturalWidth||s}return t}:"height"===e&&(o.get=function(){const t=this[i];if(void 0===t){const t=this;return t._width&&t.__naturalHeight&&t.__useNaturalRatio?t._width*t.__naturalHeight/t.__naturalWidth:t.__naturalHeight||s}return t});let a,h=r;for(;!a&&h;)a=mi(h,e),h=h.__proto__;a&&a.set&&(o.set=a.set),r[n]&&(o.set=r[n],delete r[n]),yi(r,e,o)}const Vi=new xt("rewrite"),Qi=[],Ji=["destroy","constructor"];function Zi(t){return(e,s)=>{Qi.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function $i(){return t=>{Ki()}}function Ki(t){Qi.length&&(Qi.forEach((e=>{t&&Vi.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Qi.length=0)}function tn(t,e){return s=>{var r;(t.prototype?(r=t.prototype,Object.getOwnPropertyNames(r)):Object.keys(t)).forEach((r=>{if(!(Ji.includes(r)||e&&e.includes(r)))if(t.prototype){mi(t.prototype,r).writable&&(s.prototype[r]=t.prototype[r])}else s.prototype[r]=t[r]}))}}function en(){return t=>{Tt.register(t)}}function sn(){return t=>{St.register(t)}}setTimeout((()=>Ki(!0)));const{copy:rn,toInnerPoint:nn,toOuterPoint:on,scaleOfOuter:an,rotateOfOuter:hn,skewOfOuter:ln,multiplyParent:dn,divideParent:un,getLayout:cn}=b,_n={},pn={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),yn(t,e,s),t.isBranch){const{children:r}=t;for(let t=0,i=r.length;t<i;t++)gn(r[t],e,s)}},updateMatrix(t,e,s){const r=t.__layout;e?s&&(r.waitAutoLayout=!0,t.__hasAutoLayout&&(r.matrixChanged=!1)):r.waitAutoLayout&&(r.waitAutoLayout=!1),r.matrixChanged&&t.__updateLocalMatrix(),r.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)mn(e[t])}},updateAllChange(t){if(mn(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)xn(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},moveWorld(t,e,s=0,r){const i="object"==typeof e?Object.assign({},e):{x:e,y:s};r?on(t.localTransform,i,i,!0):t.parent&&nn(t.parent.worldTransform,i,i,!0),fn.moveLocal(t,i.x,i.y)},moveLocal(t,e,s=0){"object"==typeof e?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=s)},zoomOfWorld(t,e,s,r,i){fn.zoomOfLocal(t,bn(t,e),s,r,i)},zoomOfLocal(t,e,s,r=s,i){rn(_n,t.__localMatrix),an(_n,e,s,r),t.origin||t.around?fn.setTransform(t,_n,i):(wn(t,_n),t.scaleResize(s,r,!0!==i))},rotateOfWorld(t,e,s){fn.rotateOfLocal(t,bn(t,e),s)},rotateOfLocal(t,e,s){rn(_n,t.__localMatrix),hn(_n,e,s),t.origin||t.around?fn.setTransform(t,_n):(wn(t,_n),t.rotation=a.formatRotation(t.rotation+s))},skewOfWorld(t,e,s,r,i){fn.skewOfLocal(t,bn(t,e),s,r,i)},skewOfLocal(t,e,s,r=0,i){rn(_n,t.__localMatrix),ln(_n,e,s,r),fn.setTransform(t,_n,i)},transformWorld(t,e,s){rn(_n,t.worldTransform),dn(_n,e),t.parent&&un(_n,t.parent.worldTransform),fn.setTransform(t,_n,s)},transform(t,e,s){rn(_n,t.localTransform),dn(_n,e),fn.setTransform(t,_n,s)},setTransform(t,e,s){const r=cn(e,t.origin&&fn.getInnerOrigin(t,t.origin),t.around&&fn.getInnerOrigin(t,t.around));if(s){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;delete r.scaleX,delete r.scaleY,t.set(r),t.scaleResize(e,i,!0!==s)}else t.set(r)},getFlipTransform(t,e){const s={a:1,b:0,c:0,d:1,e:0,f:0},r="x"===e?1:-1;return an(s,fn.getLocalOrigin(t,"center"),-1*r,1*r),s},getLocalOrigin:(t,e)=>E.tempToOuterOf(fn.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const s={};return pt.toPoint(e,t.boxBounds,s),s},getRelativeWorld:(t,e,s)=>(rn(_n,t.worldTransform),un(_n,e.worldTransform),s?_n:Object.assign({},_n)),drop(t,e,s,r){t.setTransform(fn.getRelativeWorld(t,e,!0),r),e.add(t,s)},hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}}},fn=pn,{updateAllMatrix:gn,updateMatrix:yn,updateAllWorldOpacity:mn,updateAllChange:xn}=fn;function wn(t,e){const{e:s,f:r}=t.__localMatrix;t.x+=e.e-s,t.y+=e.f-r}function bn(t,e){return t.__layout.update(),t.parent?E.tempToInnerOf(e,t.parent.__world):e}const vn={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:Bn}=pn,kn={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:s}=t;for(let r=0,i=s.length;r<i;r++)(t=s[r]).isBranch&&(t.__tempNumber=1,e.add(t),Cn(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&void 0===s[t.parent.innerId];)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let s=e.length;const{children:r}=t;for(let t=0,s=r.length;t<s;t++)r[t].isBranch&&e.push(r[t]);for(let t=s,r=e.length;t<r;t++)On(e[t],e)},updateBounds(t,e){const s=[t];On(t,s),Tn(s,e)},updateBoundsByBranchStack(t,e){let s,r;for(let i=t.length-1;i>-1;i--){s=t[i],r=s.children;for(let t=0,e=r.length;t<e;t++)Bn(r[t]);e&&e===s||Bn(s)}}},{pushAllChildBranch:Cn,pushAllBranchStack:On,updateBoundsByBranchStack:Tn}=kn,Pn={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:Rn}=pn,{toOuterOf:Sn,getPoints:Ln,copy:En}=it,In="_localContentBounds",Mn="_worldContentBounds",An="_worldBoxBounds",Wn="_worldStrokeBounds";class Nn{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}get localContentBounds(){return Sn(this.contentBounds,this.leaf.__localMatrix,this[In]||(this[In]={})),this[In]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Sn(this.contentBounds,this.leaf.__world,this[Mn]||(this[Mn]={})),this[Mn]}get worldBoxBounds(){return Sn(this.boxBounds,this.leaf.__world,this[An]||(this[An]={})),this[An]}get worldStrokeBounds(){return Sn(this.strokeBounds,this.leaf.__world,this[Wn]||(this[Wn]={})),this[Wn]}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.boxBounds={x:0,y:0,width:0,height:0},this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),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{leafer:e}=this.leaf;if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=this.leaf;for(;e.parent&&!e.parent.leafer;)e=e.parent;t.layout(e)}}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 Rn(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 ht(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",s){const{leaf:r}=this;let i,n,o,a=this.getInnerBounds(t);switch(e){case"world":i=r.getWorldPoint(a),n=r.__world;break;case"local":const{scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d}=r.__;o={scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d},i=r.getLocalPointByInner(a);break;case"inner":i=a,n=b.defaultMatrix;break;case"page":e=r.zoomLayer;default:i=r.getWorldPoint(a,e),n=Rn(r,e,!0)}if(o||(o=b.getLayout(n)),En(o,a),E.copy(o,i),s){const{scaleX:t,scaleY:e}=o,s=Math.abs(t),r=Math.abs(e);1===s&&1===r||(o.scaleX/=s,o.scaleY/=r,o.width*=s,o.height*=r)}return o}getLayoutPoints(t,e="world"){const{leaf:s}=this,r=Ln(this.getInnerBounds(t));let i;switch(e){case"world":i=null;break;case"local":i=s.parent;break;case"inner":break;case"page":e=s.zoomLayer;default:i=e}return void 0!==i&&r.forEach((t=>s.innerToWorld(t,null,!1,i))),r}shrinkContent(){const{x:t,y:e,width:s,height:r}=this.boxBounds;this._contentBounds={x:t,y:e,width:s,height:r}}spreadStroke(){const{x:t,y:e,width:s,height:r}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:s,height:r},this._localStrokeBounds={x:t,y:e,width:s,height:r},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:r}=this.renderBounds;this._renderBounds={x:t,y:e,width:s,height:r},this._localRenderBounds={x:t,y:e,width:s,height:r}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged||this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Yn{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 Xn extends Yn{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}Xn.ADD="child.add",Xn.REMOVE="child.remove",Xn.CREATED="created",Xn.MOUNTED="mounted",Xn.UNMOUNTED="unmounted",Xn.DESTROY="destroy";class Dn extends Yn{constructor(t,e,s,r,i){super(t,e),this.attrName=s,this.oldValue=r,this.newValue=i}}Dn.CHANGE="property.change",Dn.LEAFER_CHANGE="property.leafer_change";class zn extends Yn{constructor(t,e){super(t),Object.assign(this,e)}}zn.LOAD="image.load",zn.LOADED="image.loaded",zn.ERROR="image.error";class Fn extends Yn{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(Fn.RESIZE),Object.assign(this,t)):super(t),this.old=e}}Fn.RESIZE="resize";class jn extends Yn{constructor(t,e){super(t),this.data=e}}jn.REQUEST="watch.request",jn.DATA="watch.data";class Un extends Yn{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}Un.CHECK_UPDATE="layout.check_update",Un.REQUEST="layout.request",Un.START="layout.start",Un.BEFORE="layout.before",Un.LAYOUT="layout",Un.AFTER="layout.after",Un.AGAIN="layout.again",Un.END="layout.end";class Hn extends Yn{constructor(t,e,s,r){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=r)}}Hn.REQUEST="render.request",Hn.CHILD_START="render.child_start",Hn.START="render.start",Hn.BEFORE="render.before",Hn.RENDER="render",Hn.AFTER="render.after",Hn.AGAIN="render.again",Hn.END="render.end",Hn.NEXT="render.next";class Gn extends Yn{}Gn.START="leafer.start",Gn.BEFORE_READY="leafer.before_ready",Gn.READY="leafer.ready",Gn.AFTER_READY="leafer.after_ready",Gn.VIEW_READY="leafer.view_ready",Gn.VIEW_COMPLETED="leafer.view_completed",Gn.STOP="leafer.stop",Gn.RESTART="leafer.restart",Gn.END="leafer.end";const qn={};class Vn{set event(t){this.on(t)}on(t,e,s){if(!e){let e,s=t;for(let t in s)e=s[t],e instanceof Array?this.on(t,e[0],e[1]):this.on(t,e);return}let r,i,n;s&&("once"===s?i=!0:"boolean"==typeof s?r=s:(r=s.capture,i=s.once));const o=Qn(this,r,!0),a="string"==typeof t?t.split(" "):t,h=i?{listener:e,once:i}:{listener:e};a.forEach((t=>{t&&(n=o[t],n?-1===n.findIndex((t=>t.listener===e))&&n.push(h):o[t]=[h])}))}off(t,e,s){if(t){const r="string"==typeof t?t.split(" "):t;if(e){let t,i,n;s&&(t="boolean"==typeof s?s:"once"!==s&&s.capture);const o=Qn(this,t);r.forEach((t=>{t&&(i=o[t],i&&(n=i.findIndex((t=>t.listener===e)),n>-1&&i.splice(n,1),i.length||delete o[t]))}))}else{const{__bubbleMap:t,__captureMap:e}=this;r.forEach((s=>{t&&delete t[s],e&&delete e[s]}))}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,s,r){return s&&(e=e.bind(s)),this.on(t,e,r),{type:t,current:this,listener:e,options:r}}off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>t.current.off(t.type,t.listener,t.options))),e.length=0}once(t,e,s){this.on(t,e,{once:!0,capture:s})}emit(t,e,s){!e&&St.has(t)&&(e=St.get(t,{type:t,target:this,current:this}));const r=Qn(this,s)[t];if(r){let i;for(let n=0,o=r.length;n<o&&(i=r[n],i.listener(e),i.once&&(this.off(t,i.listener,s),n--,o--),!e||!e.isStopNow);n++);}this.syncEventer&&this.syncEventer.emitEvent(e,s)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:s,__captureMap:r}=this,i=s&&s[t],n=r&&r[t];return!!(void 0===e?i||n:e?n:i)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function Qn(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:qn)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:qn)}}const{on:Jn,on_:Zn,off:$n,off_:Kn,once:to,emit:eo,emitEvent:so,hasEvent:ro,destroy:io}=Vn.prototype,no={on:Jn,on_:Zn,off:$n,off_:Kn,once:to,emit:eo,emitEvent:so,hasEvent:ro,destroyEventer:io},{isFinite:oo}=Number,ao=xt.get("setAttr"),ho={__setAttr(t,e,s){if(this.leaferIsCreated){const r=this.__.__getInput(t);if(s&&!oo(e)&&void 0!==e&&(ao.warn(this.innerName,t,e),e=void 0),"object"==typeof e||r!==e){this.__realSetAttr(t,e);const{CHANGE:s}=Dn,i=new Dn(s,this,t,r,e);return this.isLeafer?this.emitEvent(new Dn(Dn.LEAFER_CHANGE,this,t,r,e)):this.hasEvent(s)&&this.emitEvent(i),this.leafer.emitEvent(i),!0}return!1}return this.__realSetAttr(t,e),!0},__realSetAttr(t,e){const s=this.__;s[t]=e,this.__proxyData&&this.setProxyAttr(t,e),s.normalStyle&&(this.lockNormalStyle||void 0===s.normalStyle[t]||(s.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:lo,multiplyParent:uo,translateInner:co,defaultWorld:_o}=b,{toPoint:po,tempPoint:fo}=pt,go={__updateWorldMatrix(){uo(this.__local||this.__layout,this.parent?this.parent.__world:_o,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.rotationChanged)&&(lo(e,s,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=!1),e.e=s.x+s.offsetX,e.f=s.y+s.offsetY,(s.around||s.origin)&&(po(s.around||s.origin,t.boxBounds,fo),co(e,-fo.x,-fo.y,!s.around))}this.__layout.matrixChanged=!1}},{updateMatrix:yo,updateAllMatrix:mo}=pn,{updateBounds:xo}=kn,{toOuterOf:wo,copyAndSpread:bo,copy:vo}=it,{toBounds:Bo}=Qr,ko={__updateWorldBounds(){wo(this.__layout.renderBounds,this.__world,this.__world),this.__layout.resized&&(this.__onUpdateSize(),this.__layout.resized=!1)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized=!0),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=!1,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=!1,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=!1,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized=!0),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=!1,this.parent&&this.parent.__layout.renderChange()),t.boundsChanged=!1},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),wo(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){wo(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){wo(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?Bo(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.leaferIsReady&&this.leafer.layouter.addExtra(this),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),mo(this),xo(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(mo(this),xo(this,this))):yo(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;bo(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?bo(t.renderBounds,t.boxBounds,t.renderSpread):vo(t.renderBounds,t.strokeBounds)}},Co={__render(t,e){if(this.__worldOpacity)if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=this.__.opacity,this.__.__single){if("path"===this.__.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e),this.__worldFlipped?t.copyWorldByReset(s,this.__nowWorld,null,this.__.__blendMode,!0):t.copyWorldToInner(s,this.__nowWorld,this.__layout.renderBounds,this.__.__blendMode),s.recycle(this.__nowWorld)}else this.__draw(t,e)},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),this.__.windingRule?t.clip(this.__.windingRule):t.clip())},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Oo}=vn,To={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__worldOpacity)if(this.__.__single){if("path"===this.__.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const r=this.__getNowWorld(e);t.opacity=this.__.opacity,t.copyWorldByReset(s,r,r,this.__.__blendMode,!0),s.recycle(r)}else this.__renderBranch(t,e)},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:s}=this;for(let r=0,i=s.length;r<i;r++)Oo(s[r],e)||s[r].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:s}=this;for(let r=0,i=s.length;r<i;r++)Oo(s[r],e)||s[r].__clip(t,e)}}},{LEAF:Po,create:Ro}=s,{toInnerPoint:So,toOuterPoint:Lo,multiplyParent:Eo}=b,{toOuterOf:Io}=it,{copy:Mo,move:Ao}=E,{moveLocal:Wo,zoomOfLocal:No,rotateOfLocal:Yo,skewOfLocal:Xo,moveWorld:Do,zoomOfWorld:zo,rotateOfWorld:Fo,skewOfWorld:jo,transform:Uo,transformWorld:Ho,setTransform:Go,getFlipTransform:qo,getLocalOrigin:Vo,getRelativeWorld:Qo,drop:Jo}=pn;let Zo=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 At}get __LayoutProcessor(){return Nn}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(){const{leafer:t}=this;return t&&t.created&&t.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=Ro(Po),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Xn.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),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(Xn.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Xn.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(Xn.MOUNTED)):this.__emitLifeEvent(Xn.UNMOUNTED),this.isBranch){const{children:e}=this;for(let s=0,r=e.length;s<r;s++)e[s].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){void 0===t?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=void 0===e?null:void 0,this[t]=e}forceRender(t){this.forceUpdate("surface")}__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=!!t||this.children.some((t=>t.__.mask))}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld;return Eo(this.__world,t.matrix,e,void 0,this.__world),Io(this.__layout.renderBounds,e,e),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 r=e?Qo(this,e):this.worldTransform,i=s?t:{};return Io(t,r,i),i}worldToLocal(t,e,s,r){this.parent?this.parent.worldToInner(t,e,s,r):e&&Mo(e,t)}localToWorld(t,e,s,r){this.parent?this.parent.innerToWorld(t,e,s,r):e&&Mo(e,t)}worldToInner(t,e,s,r){r&&(r.innerToWorld(t,e,s),t=e||t),So(this.worldTransform,t,e,s)}innerToWorld(t,e,s,r){Lo(this.worldTransform,t,e,s),r&&r.worldToInner(e||t,null,s)}getBoxPoint(t,e,s,r){return this.getBoxPointByInner(this.getInnerPoint(t,e,s,r),null,null,!0)}getBoxPointByInner(t,e,s,r){const i=r?t:Object.assign({},t),{x:n,y:o}=this.boxBounds;return Ao(i,-n,-o),i}getInnerPoint(t,e,s,r){const i=r?t:{};return this.worldToInner(t,i,s,e),i}getInnerPointByBox(t,e,s,r){const i=r?t:Object.assign({},t),{x:n,y:o}=this.boxBounds;return Ao(i,n,o),i}getInnerPointByLocal(t,e,s,r){return this.getInnerPoint(t,this.parent,s,r)}getLocalPoint(t,e,s,r){const i=r?t:{};return this.worldToLocal(t,i,s,e),i}getLocalPointByInner(t,e,s,r){return this.getWorldPoint(t,this.parent,s,r)}getPagePoint(t,e,s,r){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,s,r)}getWorldPoint(t,e,s,r){const i=r?t:{};return this.innerToWorld(t,i,s,e),i}getWorldPointByBox(t,e,s,r){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,r),e,s,!0)}getWorldPointByLocal(t,e,s,r){const i=r?t:{};return this.localToWorld(t,i,s,e),i}getWorldPointByPage(t,e,s,r){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,s,r)}setTransform(t,e){Go(this,t,e)}transform(t,e){Uo(this,t,e)}move(t,e){Wo(this,t,e)}moveInner(t,e){Do(this,t,e,!0)}scaleOf(t,e,s,r){No(this,Vo(this,t),e,s,r)}rotateOf(t,e){Yo(this,Vo(this,t),e)}skewOf(t,e,s,r){Xo(this,Vo(this,t),e,s,r)}transformWorld(t,e){Ho(this,t,e)}moveWorld(t,e){Do(this,t,e)}scaleOfWorld(t,e,s,r){zo(this,t,e,s,r)}rotateOfWorld(t,e){Fo(this,t,e)}skewOfWorld(t,e,s,r){jo(this,t,e,s,r)}flip(t){Uo(this,qo(this,t))}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){}__clip(t,e){}__renderShape(t,e,s,r){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Ct("path")}getMotionPoint(t){return Ct("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){Jo(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,r){}off_(t){}once(t,e,s){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,s){s?this.addAttr(t,e,s):qi(this.prototype,t,e)}static addAttr(t,e,s){s||(s=Ti),s(e)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Xn(t,this,this.parent))}destroy(){if(!this.destroyed){const{parent:t}=this;t&&this.remove(),this.children&&this.removeAll(!0),this.__emitLifeEvent(Xn.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0}}};Zo=Xt([tn(ho),tn(go),tn(ko),tn(no),tn(Co)],Zo);const{setListWithFn:$o}=it,{sort:Ko}=kn,{localBoxBounds:ta,localStrokeBounds:ea,localRenderBounds:sa,maskLocalBoxBounds:ra,maskLocalStrokeBounds:ia,maskLocalRenderBounds:na}=vn;let oa=class extends Zo{__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(){$o(this.__layout.boxBounds,this.children,this.__hasMask?ra:ta)}__updateStrokeBounds(){$o(this.__layout.strokeBounds,this.children,this.__hasMask?ia:ea)}__updateRenderBounds(){$o(this.__layout.renderBounds,this.children,this.__hasMask?na:sa)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,r=e.length;s<r;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(Ko),this.__layout.affectChildrenSort=t}}add(t,e){t!==this&&(t.__||(t=Tt.get(t.tag,t)),t.parent&&t.parent.remove(t),t.parent=this,void 0===e?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1),t.__layout.boxChanged||t.__layout.boxChange(),t.__layout.matrixChanged||t.__layout.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Xn.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Xn.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange())}addMany(...t){t.forEach((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(Xn.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Xn.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new Xn(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}};oa=Xt([tn(To)],oa);class aa{get length(){return this.list.length}constructor(t){this.reset(),t&&(t instanceof Array?this.addList(t):this.add(t))}has(t){return t&&void 0!==this.keys[t.innerId]}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return void 0===e?-1:e}add(t){const{list:e,keys:s}=this;void 0===s[t.innerId]&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(void 0===s[t.innerId]){const{list:r}=this;for(let t=e,i=r.length;t<i;t++)s[r[t].innerId]++;0===e?r.unshift(t):(e>r.length&&(e=r.length),r.splice(e,0,t)),s[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let s;for(let r=0,i=e.length;r<i;r++)void 0!==s?this.keys[e[r].innerId]=r-1:e[r].innerId===t.innerId&&(s=r,delete this.keys[t.innerId]);void 0!==s&&e.splice(s,1)}sort(t){const{list:e}=this;t?e.sort(((t,e)=>e.__level-t.__level)):e.sort(((t,e)=>t.__level-e.__level))}forEach(t){this.list.forEach(t)}clone(){const t=new aa;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let s=0,r=t.length;s<r;s++)e[t[s].innerId]=s}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class ha{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(t instanceof Array?this.addList(t):this.add(t))}has(t){return void 0!==this.keys[t.innerId]}without(t){return void 0===this.keys[t.innerId]}sort(t){const{levels:e}=this;t?e.sort(((t,e)=>e-t)):e.sort(((t,e)=>t-e))}addList(t){t.forEach((t=>{this.add(t)}))}add(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach((s=>{e=this.levelMap[s];for(let s=0,r=e.length;s<r;s++)t(e[s])}))}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const la="1.0.5";export{yt as AlignHelper,Wt as Answer,pt as AroundHelper,dt as AutoBounds,Be as BezierHelper,ht as Bounds,it as BoundsHelper,oa as Branch,kn as BranchHelper,To as BranchRender,Et as CanvasManager,Xn as ChildEvent,e as Creator,It as DataHelper,xt as Debug,ut as Direction4,ct as Direction9,Ee as EllipseHelper,Yn as Event,St as EventCreator,Vn as Eventer,ai as FileHelper,zn as ImageEvent,ci as ImageManager,s as IncrementId,Un as LayoutEvent,Zo as Leaf,ko as LeafBounds,vn as LeafBoundsHelper,At as LeafData,ho as LeafDataProxy,no as LeafEventer,pn as LeafHelper,Nn as LeafLayout,ha as LeafLevelList,aa as LeafList,go as LeafMatrix,Co as LeafRender,Qt as LeaferCanvasBase,Gn as LeaferEvent,gi as LeaferImage,a as MathHelper,X as Matrix,b as MatrixHelper,te as NeedConvertToCanvasCommandMap,h as OneRadian,l as PI2,d as PI_2,Qr as PathBounds,Xs as PathCommandDataHelper,$t as PathCommandMap,gs as PathConvert,ri as PathCorner,sr as PathCreator,yr as PathDrawer,Jt as PathHelper,ie as PathNumberCommandLengthMap,re as PathNumberCommandMap,t as Platform,N as Point,E as PointHelper,Dn as PropertyEvent,ne as RectHelper,Hn as RenderEvent,Fn as ResizeEvent,Bt as Run,mt as StringNumberMap,di as TaskItem,ui as TaskProcessor,z as TwoPointBoundsHelper,Tt as UICreator,Pn as WaitHelper,jn as WatchEvent,Ai as affectRenderBoundsType,Ei as affectStrokeBoundsType,wi as attr,ki as autoLayoutType,Ti as boundsType,oi as canvasPatch,Vt as canvasSizeAttrs,Ui as cursorType,Hi as dataProcessor,vi as dataType,xi as decorateLeafAttr,qi as defineDataProcessor,yi as defineKey,bi as defineLeafAttr,Ri as doBoundsType,Ii as doStrokeType,Nt as emptyData,Fi as eraserType,c as getBoundsData,mi as getDescriptor,_ as getMatrixData,u as getPointData,ji as hitType,Yt as isNull,Gi as layoutProcessor,zi as maskType,Pi as naturalBoundsType,Ct as needPlugin,Ni as opacityType,Si as pathInputType,Li as pathType,ii as pen,Bi as positionType,en as registerUI,sn as registerUIEvent,Zi as rewrite,$i as rewriteAble,Oi as rotationType,Ci as scaleType,Di as sortType,Mi as strokeType,Wi as surfaceType,lt as tempBounds,D as tempMatrix,Y as tempPoint,tn as useModule,la as version,Yi as visibleType};
|
package/lib/core.min.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t={toURL(t,e){let s=encodeURIComponent(t);return"text"===e?s="data:text/plain;charset=utf-8,"+s:"svg"===e&&(s="data:image/svg+xml,"+s),s},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(e){const{prefix:s,suffix:r}=t.image;return!r||e.startsWith("data:")||e.startsWith("blob:")||(e+=(e.includes("?")?"&":"?")+r),s&&"/"===e[0]&&(e=s+e),e}}},e={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=r;return e[t]?e[t]++:(e[t]=1,0)}},r=s,{round:i,pow:o,PI:n}=Math,a={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)),a.float(t)),getGapRotation(t,e,s=0){let r=t+s;if(e>1){const t=Math.abs(r%e);(t<1||t>e-1)&&(r=Math.round(r/e)*e)}return r-s},float(t,e){const s=e?o(10,e):1e12;return-0===(t=i(t*s)/s)?0:t},getScaleData:(t,e,s,r)=>(r||(r={}),e?(r.scaleX=("number"==typeof e?e:e.width)/s.width,r.scaleY=("number"==typeof e?e:e.height)/s.height):t&&a.assignScale(r,t),r),assignScale(t,e){"number"==typeof e?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)}},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 p(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:_,cos:f,acos:g,sqrt:y}=Math,{float:x}=a,m={};function w(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const b={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:w(),tempMatrix:{},set(t,e=1,s=0,r=0,i=1,o=0,n=0){t.a=e,t.b=s,t.c=r,t.d=i,t.e=o,t.f=n},get:p,getWorld:w,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s,r){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s,r&&(t.e-=e,t.f-=s)},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},scaleOfOuter(t,e,s,r){v.toInnerPoint(t,e,m),v.scaleOfInner(t,m,s,r)},scaleOfInner(t,e,s,r=s){v.translateInner(t,e.x,e.y),v.scale(t,s,r),v.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:r,c:i,d:o}=t,n=f(e*=h),a=_(e);t.a=s*n-r*a,t.b=s*a+r*n,t.c=i*n-o*a,t.d=i*a+o*n},rotateOfOuter(t,e,s){v.toInnerPoint(t,e,m),v.rotateOfInner(t,m,s)},rotateOfInner(t,e,s){v.translateInner(t,e.x,e.y),v.rotate(t,s),v.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:r,b:i,c:o,d:n}=t;s&&(s*=h,t.a=r+o*s,t.b=i+n*s),e&&(e*=h,t.c=o+r*e,t.d=n+i*e)},skewOfOuter(t,e,s,r){v.toInnerPoint(t,e,m),v.skewOfInner(t,m,s,r)},skewOfInner(t,e,s,r=0){v.translateInner(t,e.x,e.y),v.skew(t,s,r),v.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:r,c:i,d:o,e:n,f:a}=t;t.a=e.a*s+e.b*i,t.b=e.a*r+e.b*o,t.c=e.c*s+e.d*i,t.d=e.c*r+e.d*o,t.e=e.e*s+e.f*i+n,t.f=e.e*r+e.f*o+a},multiplyParent(t,e,s,r,i,o){let{e:n,f:a}=t;if(o&&(n+=o.scrollX,a+=o.scrollY),s||(s=t),void 0===r&&(r=1!==t.a||t.b||t.c||1!==t.d),r){const{a:r,b:o,c:n,d:a}=t;s.a=r*e.a+o*e.c,s.b=r*e.b+o*e.d,s.c=n*e.a+a*e.c,s.d=n*e.b+a*e.d,i&&(s.scaleX=e.scaleX*i.scaleX,s.scaleY=e.scaleY*i.scaleY)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,i&&(s.scaleX=e.scaleX,s.scaleY=e.scaleY);s.e=n*e.a+a*e.c+e.e,s.f=n*e.b+a*e.d+e.f},divide(t,e){v.multiply(t,v.tempInvert(e))},divideParent(t,e){v.multiplyParent(t,v.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=v;return v.copy(e,t),v.invert(e),e},invert(t){const{a:e,b:s,c:r,d:i,e:o,f:n}=t;if(s||r){const a=1/(e*i-s*r);t.a=i*a,t.b=-s*a,t.c=-r*a,t.d=e*a,t.e=-(o*i-n*r)*a,t.f=-(n*e-o*s)*a}else if(1===e&&1===i)t.e=-o,t.f=-n;else{const s=1/(e*i);t.a=i*s,t.d=e*s,t.e=-o*i*s,t.f=-n*e*s}},toOuterPoint(t,e,s,r){const{x:i,y:o}=e;s||(s=e),s.x=i*t.a+o*t.c,s.y=i*t.b+o*t.d,r||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,r){const{a:i,b:o,c:n,d:a}=t,h=1/(i*a-o*n),{x:l,y:d}=e;if(s||(s=e),s.x=(l*a-d*n)*h,s.y=(d*i-l*o)*h,!r){const{e:e,f:r}=t;s.x-=(e*a-r*n)*h,s.y-=(r*i-e*o)*h}},setLayout(t,e,s,r,i){const{x:o,y:n,scaleX:a,scaleY:l}=e;if(void 0===i&&(i=e.rotation||e.skewX||e.skewY),i){const{rotation:s,skewX:r,skewY:i}=e,o=s*h,n=f(o),d=_(o);if(r||i){const e=r*h,s=i*h;t.a=(n+s*-d)*a,t.b=(d+s*n)*a,t.c=(e*n-d)*l,t.d=(n+e*d)*l}else t.a=n*a,t.b=d*a,t.c=-d*l,t.d=n*l}else t.a=a,t.b=0,t.c=0,t.d=l;t.e=o,t.f=n,(s=s||r)&&v.translateInner(t,-s.x,-s.y,!r)},getLayout(t,e,s,r){const{a:i,b:o,c:n,d:a,e:l,f:u}=t;let c,p,m,w,b,v=l,B=u;if(o||n){const t=i*a-o*n;if(n&&!r){c=y(i*i+o*o),p=t/c;const e=i/c;m=o>0?g(e):-g(e)}else{p=y(n*n+a*a),c=t/p;const e=n/p;m=d-(a>0?g(-e):-g(e))}const e=x(f(m)),s=_(m);c=x(c),p=x(p),w=e?x((n/p+s)/e/h,9):0,b=e?x((o/c-s)/e/h,9):0,m=x(m/h)}else c=i,p=a,m=w=b=0;return(e=s||e)&&(v+=e.x*i+e.y*n,B+=e.x*o+e.y*a,s||(v-=e.x,B-=e.y)),{x:v,y:B,scaleX:c,scaleY:p,rotation:m,skewX:w,skewY:b}},withScale(t,e,s=e){const r=t;if(!e||!s){const{a:r,b:i,c:o,d:n}=t;i||o?s=(r*n-i*o)/(e=y(r*r+i*i)):(e=r,s=n)}return r.scaleX=e,r.scaleY=s,r},reset(t){v.set(t)}},v=b,{toInnerPoint:B,toOuterPoint:C}=b,{sin:k,cos:T,abs:O,sqrt:P,atan2:L,min:R,PI:S}=Math,E={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,s){t.radiusX=e,t.radiusY=void 0===s?e:s},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,s){t.x=e,t.y=s},move(t,e,s){t.x+=e,t.y+=s},scale(t,e,s=e){t.x&&(t.x*=e),t.y&&(t.y*=s)},scaleOf(t,e,s,r=s){t.x+=(t.x-e.x)*(s-1),t.y+=(t.y-e.y)*(r-1)},rotate(t,e,s){s||(s=M.defaultPoint);const r=T(e*=h),i=k(e),o=t.x-s.x,n=t.y-s.y;t.x=s.x+o*r-n*i,t.y=s.y+o*i+n*r},tempToInnerOf(t,e){const{tempPoint:s}=M;return A(s,t),B(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=M;return A(s,t),C(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=M;return A(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){C(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)=>I(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,r){const i=O(s-t),o=O(r-e);return P(i*i+o*o)},getMinDistanceFrom:(t,e,s,r,i,o)=>R(I(t,e,s,r),I(s,r,i,o)),getAngle:(t,e)=>W(t,e)/h,getRotation:(t,e,s,r)=>(r||(r=e),M.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,r.x,r.y)/h),getRadianFrom(t,e,s,r,i,o,n,a){void 0===n&&(n=s,a=r);let h=L(e-r,t-s);const d=L(o-a,i-n)-h;return d<-S?d+l:d},getAtan2:(t,e)=>L(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,r){const i=W(t,e);return(e=r?e:{}).x=t.x+T(i)*s,e.y=t.y+k(i)*s,e},reset(t){M.reset(t)}},M=E,{getDistanceFrom:I,copy:A,getAtan2:W}=M;class D{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?E.copy(this,t):E.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new D(this)}move(t,e){return E.move(this,t,e),this}scale(t,e){return E.scale(this,t,e),this}scaleOf(t,e,s){return E.scaleOf(this,t,e,s),this}rotate(t,e){return E.rotate(this,t,e),this}rotateOf(t,e){return E.rotate(this,e,t),this}getRotation(t,e,s){return E.getRotation(this,t,e,s)}toInnerOf(t,e){return E.toInnerOf(this,t,e),this}toOuterOf(t,e){return E.toOuterOf(this,t,e),this}getCenter(t){return new D(E.getCenter(this,t))}getDistance(t){return E.getDistance(this,t)}getDistancePoint(t,e,s){return new D(E.getDistancePoint(this,t,e,s))}getAngle(t){return E.getAngle(this,t)}getAtan2(t){return E.getAtan2(this,t)}reset(){return E.reset(this),this}}const N=new D;class Y{constructor(t,e,s,r,i,o){this.set(t,e,s,r,i,o)}set(t,e,s,r,i,o){return"object"==typeof t?b.copy(this,t):b.set(this,t,e,s,r,i,o),this}setWith(t){return b.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:s,d:r,e:i,f:o}=this;return{a:t,b:e,c:s,d:r,e:i,f:o}}clone(){return new Y(this)}translate(t,e){return b.translate(this,t,e),this}translateInner(t,e){return b.translateInner(this,t,e),this}scale(t,e){return b.scale(this,t,e),this}scaleWith(t,e){return b.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,s){return b.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return b.scaleOfInner(this,t,e,s),this}rotate(t){return b.rotate(this,t),this}rotateOfOuter(t,e){return b.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return b.rotateOfInner(this,t,e),this}skew(t,e){return b.skew(this,t,e),this}skewOfOuter(t,e,s){return b.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return b.skewOfInner(this,t,e,s),this}multiply(t){return b.multiply(this,t),this}multiplyParent(t){return b.multiplyParent(this,t),this}divide(t){return b.divide(this,t),this}divideParent(t){return b.divideParent(this,t),this}invert(){return b.invert(this),this}invertWith(){return b.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){b.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){b.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return b.setLayout(this,t,e,s),this}getLayout(t,e,s){return b.getLayout(this,t,e,s)}withScale(t,e){return b.withScale(this,t,e)}reset(){b.reset(this)}}const X=new Y,z={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,r,i){F(t,e,s),F(t,e+r,s+i)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:F}=z,{tempPointBounds:j,setPoint:H,addPoint:U,toBounds:G}=z,{toOuterPoint:q}=b,{float:V,fourNumber:Q}=a,{floor:J,ceil:Z}=Math;let $,K,tt,et;const st={},rt={},it={tempBounds:{},set(t,e=0,s=0,r=0,i=0){t.x=e,t.y=s,t.width=r,t.height=i},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s,r,i){const{x:o,y:n,width:a,height:h}=e;if(s instanceof Array){const e=Q(s);r?ot.set(t,o+e[3],n+e[0],a-e[1]-e[3],h-e[2]-e[0]):ot.set(t,o-e[3],n-e[0],a+e[1]+e[3],h+e[2]+e[0])}else r&&(s=-s),ot.set(t,o-s,n-s,a+2*s,h+2*s);i&&("width"===i?(t.y=n,t.height=h):(t.x=o,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,s){t.x+=e,t.y+=s},getByMove:(t,e,s)=>(t=Object.assign({},t),ot.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?at(e,t):e=t,s?(e.offsetX=-(ot.maxX(s)-t.x),e.offsetY=-(ot.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),ot.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e){E.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,r=s){E.scaleOf(t,e,s,r),t.width*=s,t.height*=r},tempToOuterOf:(t,e)=>(ot.copy(ot.tempBounds,t),ot.toOuterOf(ot.tempBounds,e),ot.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),ot.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:r,d:i}=e;r>0?(s.width=t.width*r,s.x=e.e+t.x*r):(s.width=t.width*-r,s.x=e.e+t.x*r-s.width),i>0?(s.height=t.height*i,s.y=e.f+t.y*i):(s.height=t.height*-i,s.y=e.f+t.y*i-s.height)}else st.x=t.x,st.y=t.y,q(e,st,rt),H(j,rt.x,rt.y),st.x=t.x+t.width,q(e,st,rt),U(j,rt.x,rt.y),st.y=t.y+t.height,q(e,st,rt),U(j,rt.x,rt.y),st.x=t.x,q(e,st,rt),U(j,rt.x,rt.y),G(j,s)},toInnerOf(t,e,s){s||(s=t),ot.move(s,-e.e,-e.f),ot.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const r=Math.min(s,Math.min(t.width/e.width,t.height/e.height));return new Y(r,0,0,r,-e.x*r,-e.y*r)},getSpread(t,e,s){const r={};return ot.copyAndSpread(r,t,e,!1,s),r},spread(t,e,s){ot.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){ot.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=J(t.x),t.y=J(t.y),t.width=e>t.x?Z(t.width+e-t.x):Z(t.width),t.height=s>t.y?Z(t.height+s-t.y):Z(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=V(t.x,e),t.y=V(t.y,e),t.width=V(t.width,e),t.height=V(t.height,e)},add(t,e,s){$=t.x+t.width,K=t.y+t.height,tt=e.x,et=e.y,s||(tt+=e.width,et+=e.height),$=$>tt?$:tt,K=K>et?K:et,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=$-t.x,t.height=K-t.y},addList(t,e){ot.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){ot.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){ot.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,r=!1){let i,o=!0;for(let n=0,a=e.length;n<a;n++)i=s?s(e[n]):e[n],i&&(i.width||i.height)&&(o?(o=!1,r||at(t,i)):nt(t,i));o&&ot.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?H(j,t.x,t.y):U(j,t.x,t.y))),G(j,t)},setPoint(t,e){ot.set(t,e.x,e.y)},addPoint(t,e){nt(t,e,!0)},getPoints(t){const{x:e,y:s,width:r,height:i}=t;return[{x:e,y:s},{x:e+r,y:s},{x:e+r,y:s+i},{x:e,y:s+i}]},hitRadiusPoint:(t,e,s)=>(s&&(e=E.tempToInnerRadiusPointOf(e,s)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,s)=>(s&&(e=E.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=ot.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=ot.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=ot.tempToOuterOf(e,s)),!ot.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:r,y:i,width:o,height:n}=e;return $=r+o,K=i+n,tt=t.x+t.width,et=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,$=$<tt?$:tt,K=K<et?K:et,o=$-r,n=K-i,{x:r,y:i,width:o,height:n}},intersect(t,e,s){ot.copy(t,ot.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){ot.set(t)}},ot=it,{add:nt,copy:at}=ot;class ht{get minX(){return it.minX(this)}get minY(){return it.minY(this)}get maxX(){return it.maxX(this)}get maxY(){return it.maxY(this)}constructor(t,e,s,r){this.set(t,e,s,r)}set(t,e,s,r){return"object"==typeof t?it.copy(this,t):it.set(this,t,e,s,r),this}get(){const{x:t,y:e,width:s,height:r}=this;return{x:t,y:e,width:s,height:r}}clone(){return new ht(this)}move(t,e){return it.move(this,t,e),this}scale(t,e){return it.scale(this,t,e),this}scaleOf(t,e,s){return it.scaleOf(this,t,e,s),this}toOuterOf(t,e){return it.toOuterOf(this,t,e),this}toInnerOf(t,e){return it.toInnerOf(this,t,e),this}getFitMatrix(t,e){return it.getFitMatrix(this,t,e)}spread(t,e){return it.spread(this,t,e),this}shrink(t,e){return it.shrink(this,t,e),this}ceil(){return it.ceil(this),this}unsign(){return it.unsign(this),this}float(t){return it.float(this,t),this}add(t){return it.add(this,t),this}addList(t){return it.setList(this,t,!0),this}setList(t){return it.setList(this,t),this}addListWithFn(t,e){return it.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return it.setListWithFn(this,t,e),this}setPoint(t){return it.setPoint(this,t),this}setPoints(t){return it.setPoints(this,t),this}addPoint(t){return it.addPoint(this,t),this}getPoints(){return it.getPoints(this)}hitPoint(t,e){return it.hitPoint(this,t,e)}hitRadiusPoint(t,e){return it.hitRadiusPoint(this,t,e)}hit(t,e){return it.hit(this,t,e)}includes(t,e){return it.includes(this,t,e)}intersect(t,e){return it.intersect(this,t,e),this}getIntersect(t,e){return new ht(it.getIntersectData(this,t,e))}isSame(t){return it.isSame(this,t)}isEmpty(){return it.isEmpty(this)}reset(){it.reset(this)}}const lt=new ht;var dt,ut;exports.Direction4=void 0,(dt=exports.Direction4||(exports.Direction4={}))[dt.top=0]="top",dt[dt.right=1]="right",dt[dt.bottom=2]="bottom",dt[dt.left=3]="left",exports.Direction9=void 0,(ut=exports.Direction9||(exports.Direction9={}))[ut.topLeft=0]="topLeft",ut[ut.top=1]="top",ut[ut.topRight=2]="topRight",ut[ut.right=3]="right",ut[ut.bottomRight=4]="bottomRight",ut[ut.bottom=5]="bottom",ut[ut.bottomLeft=6]="bottomLeft",ut[ut.left=7]="left",ut[ut.center=8]="center",ut[ut["top-left"]=0]="top-left",ut[ut["top-right"]=2]="top-right",ut[ut["bottom-right"]=4]="bottom-right",ut[ut["bottom-left"]=6]="bottom-left";const ct=[{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}];ct.forEach((t=>t.type="percent"));const pt={directionData:ct,tempPoint:{},get:_t,toPoint(t,e,s,r,i){const o=_t(t);s.x=o.x,s.y=o.y,"percent"===o.type&&(s.x*=e.width,s.y*=e.height,i&&(s.x-=i.x,s.y-=i.y,o.x&&(s.x-=1===o.x?i.width:.5===o.x?o.x*i.width:0),o.y&&(s.y-=1===o.y?i.height:.5===o.y?o.y*i.height:0))),r||(s.x+=e.x,s.y+=e.y)}};function _t(t){return"string"==typeof t?ct[exports.Direction9[t]]:t}const{toPoint:ft}=pt,gt={toPoint(t,e,s,r,i){ft(t,s,r,i,e)}},yt={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};class xt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new xt(t)}static set filter(t){this.filterList=mt(t)}static set exclude(t){this.excludeList=mt(t)}log(...t){if(wt.enable){if(wt.filterList.length&&wt.filterList.every((t=>t!==this.name)))return;if(wt.excludeList.length&&wt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){wt.enable&&this.warn(...t)}warn(...t){wt.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function mt(t){return t?"string"==typeof t&&(t=[t]):t=[],t}xt.filterList=[],xt.excludeList=[],xt.showWarn=!0;const wt=xt,bt=xt.get("RunTime"),vt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const r=s.create(s.RUNTIME);return Bt.currentId=Bt.idMap[r]=e?performance.now():Date.now(),Bt.currentName=Bt.nameMap[r]=t,Bt.nameToIdMap[t]=r,r},end(t,e){const s=Bt.idMap[t],r=Bt.nameMap[t],i=e?(performance.now()-s)/1e3:Date.now()-s;Bt.idMap[t]=Bt.nameMap[t]=Bt.nameToIdMap[r]=void 0,bt.log(r,i,"ms")},endOfName(t,e){const s=Bt.nameToIdMap[t];void 0!==s&&Bt.end(s,e)}},Bt=vt;function Ct(t){console.error("need plugin: @leafer-in/"+t)}const kt=xt.get("UICreator"),Tt={list:{},register(t){const{__tag:e}=t.prototype;Ot[e]?kt.repeat(e):Ot[e]=t},get(t,e,s,r,i,o){const n=new Ot[t](e);return void 0!==s&&(n.x=s,r&&(n.y=r),i&&(n.width=i),o&&(n.height=o)),n}},{list:Ot}=Tt,Pt=xt.get("EventCreator"),Lt={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(Rt[e]?Pt.repeat(e):Rt[e]=t)}))},changeName(t,e){const s=Rt[t];if(s){const r=Object.keys(s).find((e=>s[e]===t));r&&(s[r]=e,Rt[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Rt[t](...e)},{nameList:Rt}=Lt;const St={default:(t,e)=>(Et(e,t),Et(t,e),t),assign(t,e){let s;Object.keys(e).forEach((r=>{var i;s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(i=t[r])||void 0===i?void 0:i.constructor)===Object?Et(t[r],e[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,r=t.length;s<r;s++)e[t[s]]=!0;return e}},{assign:Et}=St;class Mt{get __useNaturalRatio(){return!0}get __isLinePath(){return this.path&&6===this.path.length}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s;for(let r in this)"_"!==r[0]&&(s=e?e[r]:void 0,t[r]=void 0===s?this[r]:s);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(t,e){const s={};if(t)if(t instanceof Array)for(let e of t)s[e]=this.__getInput(e);else for(let e in t)s[e]=this.__getInput(e);else{let t,e,{__input:r}=this;s.tag=this.__leaf.tag;for(let i in this)if("_"!==i[0]&&(t=this["_"+i],void 0!==t)){if("path"===i&&!this.__pathInputed)continue;e=r?r[i]:void 0,s[i]=void 0===e?t:e}}if(e&&e.matrix){const{a:t,b:e,c:r,d:i,e:o,f:n}=this.__leaf.__localMatrix;s.matrix={a:t,b:e,c:r,d:i,e:o,f:n}}return s}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&e.isBranch||e.__hasEraser||t.eraser?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 It;exports.Answer=void 0,(It=exports.Answer||(exports.Answer={}))[It.No=0]="No",It[It.Yes=1]="Yes",It[It.NoAndSkip=2]="NoAndSkip",It[It.YesAndSkip=3]="YesAndSkip";function At(t,e,s,r){var i,o=arguments.length,n=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(n=(o<3?i(n):o>3?i(e,s,n):i(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n}function Wt(t,e,s,r){return new(s||(s=Promise))((function(i,o){function n(t){try{h(r.next(t))}catch(t){o(t)}}function a(t){try{h(r.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(n,a)}h((r=r.apply(t,e||[])).next())}))}function Dt(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 Nt=[];function Yt(){return(t,e)=>{Nt.push(e)}}const Xt=[];class zt{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||Xt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;Nt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,s,r,i,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,r,i,o){"object"==typeof t?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,r,i,o)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,r){}strokeRect(t,e,s,r){}clearRect(t,e,s,r){}drawImage(t,e,s,r,i,o,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/r*a;r+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/i*h;i+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,r,i,o,n,a,h);break;case 5:this.context.drawImage(t,e,s,r,i);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,r,i,o){}quadraticCurveTo(t,e,s,r){}closePath(){}arc(t,e,s,r,i,o){}arcTo(t,e,s,r,i){}ellipse(t,e,s,r,i,o,n,a){}rect(t,e,s,r){}roundRect(t,e,s,r,i){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,r){}createPattern(t,e){}createRadialGradient(t,e,s,r,i,o){}fillText(t,e,s,r){}measureText(t){}strokeText(t,e,s,r){}destroy(){this.context=null}}At([Dt("imageSmoothingEnabled")],zt.prototype,"smooth",void 0),At([Dt("imageSmoothingQuality")],zt.prototype,"smoothLevel",void 0),At([Dt("globalAlpha")],zt.prototype,"opacity",void 0),At([Dt()],zt.prototype,"fillStyle",void 0),At([Dt()],zt.prototype,"strokeStyle",void 0),At([Dt("lineWidth")],zt.prototype,"strokeWidth",void 0),At([Dt("lineCap")],zt.prototype,"strokeCap",void 0),At([Dt("lineJoin")],zt.prototype,"strokeJoin",void 0),At([Dt("lineDashOffset")],zt.prototype,"dashOffset",void 0),At([Dt()],zt.prototype,"miterLimit",void 0),At([Dt()],zt.prototype,"shadowBlur",void 0),At([Dt()],zt.prototype,"shadowColor",void 0),At([Dt()],zt.prototype,"shadowOffsetX",void 0),At([Dt()],zt.prototype,"shadowOffsetY",void 0),At([Dt()],zt.prototype,"filter",void 0),At([Dt()],zt.prototype,"font",void 0),At([Dt()],zt.prototype,"fontKerning",void 0),At([Dt()],zt.prototype,"fontStretch",void 0),At([Dt()],zt.prototype,"fontVariantCaps",void 0),At([Dt()],zt.prototype,"textAlign",void 0),At([Dt()],zt.prototype,"textBaseline",void 0),At([Dt()],zt.prototype,"textRendering",void 0),At([Dt()],zt.prototype,"wordSpacing",void 0),At([Dt()],zt.prototype,"letterSpacing",void 0),At([Dt()],zt.prototype,"direction",void 0),At([Yt()],zt.prototype,"setTransform",null),At([Yt()],zt.prototype,"resetTransform",null),At([Yt()],zt.prototype,"getTransform",null),At([Yt()],zt.prototype,"save",null),At([Yt()],zt.prototype,"restore",null),At([Yt()],zt.prototype,"translate",null),At([Yt()],zt.prototype,"scale",null),At([Yt()],zt.prototype,"rotate",null),At([Yt()],zt.prototype,"fill",null),At([Yt()],zt.prototype,"stroke",null),At([Yt()],zt.prototype,"clip",null),At([Yt()],zt.prototype,"fillRect",null),At([Yt()],zt.prototype,"strokeRect",null),At([Yt()],zt.prototype,"clearRect",null),At([Yt()],zt.prototype,"beginPath",null),At([Yt()],zt.prototype,"moveTo",null),At([Yt()],zt.prototype,"lineTo",null),At([Yt()],zt.prototype,"bezierCurveTo",null),At([Yt()],zt.prototype,"quadraticCurveTo",null),At([Yt()],zt.prototype,"closePath",null),At([Yt()],zt.prototype,"arc",null),At([Yt()],zt.prototype,"arcTo",null),At([Yt()],zt.prototype,"ellipse",null),At([Yt()],zt.prototype,"rect",null),At([Yt()],zt.prototype,"roundRect",null),At([Yt()],zt.prototype,"createConicGradient",null),At([Yt()],zt.prototype,"createLinearGradient",null),At([Yt()],zt.prototype,"createPattern",null),At([Yt()],zt.prototype,"createRadialGradient",null),At([Yt()],zt.prototype,"fillText",null),At([Yt()],zt.prototype,"measureText",null),At([Yt()],zt.prototype,"strokeText",null);const{copy:Ft}=b,jt={width:1,height:1,pixelRatio:1},Ht=["width","height","pixelRatio"];const Ut={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Gt={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},qt=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},Gt),Vt={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},Qt={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},Jt=Object.assign(Object.assign({},Qt),Gt),Zt=qt,$t={};for(let t in Zt)$t[Zt[t]]=t;const Kt={};for(let t in Zt)Kt[Zt[t]]=Vt[t];const te={drawRoundRect(t,e,s,r,i,o){const n=a.fourNumber(o,Math.min(r/2,i/2)),h=e+r,l=s+i;n[0]?t.moveTo(e+n[0],s):t.moveTo(e,s),n[1]?t.arcTo(h,s,h,l,n[1]):t.lineTo(h,s),n[2]?t.arcTo(h,l,e,l,n[2]):t.lineTo(h,l),n[3]?t.arcTo(e,l,e,s,n[3]):t.lineTo(e,l),n[0]?t.arcTo(e,s,h,s,n[0]):t.lineTo(e,s)}},{sin:ee,cos:se,atan2:re,ceil:ie,abs:oe,PI:ne,sqrt:ae,pow:he}=Math,{setPoint:le,addPoint:de}=z,{set:ue}=E,{M:ce,L:pe,C:_e,Q:fe,Z:ge}=qt,ye={},xe={points(t,e,s,r){if(t.push(ce,e[0],e[1]),s&&e.length>5){let i,o,n,a,h,l,d,u,c,p,_,f,g,y=e.length;const x=!0===s?.5:s;r&&(y=(e=[e[y-2],e[y-1],...e,e[0],e[1],e[2],e[3]]).length);for(let s=2;s<y-2;s+=2)i=e[s-2],o=e[s-1],n=e[s],a=e[s+1],h=e[s+2],l=e[s+3],_=ae(he(n-i,2)+he(a-o,2)),f=ae(he(h-n,2)+he(l-a,2)),g=_+f,_=x*_/g,f=x*f/g,h-=i,l-=o,d=n-_*h,u=a-_*l,2===s?r||t.push(fe,d,u,n,a):t.push(_e,c,p,d,u,n,a),c=n+f*h,p=a+f*l;r||t.push(fe,c,p,e[y-2],e[y-1])}else for(let s=2,r=e.length;s<r;s+=2)t.push(pe,e[s],e[s+1]);r&&t.push(ge)},rect(t,e,s,r,i){Ut.creator.path=t,Ut.creator.moveTo(e,s).lineTo(e+r,s).lineTo(e+r,s+i).lineTo(e,s+i).lineTo(e,s)},roundRect(t,e,s,r,i,o){Ut.creator.path=[],te.drawRoundRect(Ut.creator,e,s,r,i,o),t.push(...Ut.convertToCanvasData(Ut.creator.path,!0))},arcTo(t,e,s,r,i,o,n,a,u,c,p){const _=r-e,f=i-s,g=o-r,y=n-i;let x=re(f,_),m=re(y,g),w=m-x;if(w<0&&(w+=l),w===ne||oe(_+f)<1e-12||oe(g+y)<1e-12)return t&&t.push(pe,r,i),u&&(le(u,e,s),de(u,r,i)),p&&ue(p,e,s),void(c&&ue(c,r,i));const b=_*y-g*f<0,v=b?-1:1,B=a/se(w/2),C=r+B*se(x+w/2+d*v),k=i+B*ee(x+w/2+d*v);return x-=d*v,m-=d*v,be(t,C,k,a,a,0,x/h,m/h,b,u,c,p)},arc:(t,e,s,r,i,o,n,a,h,l)=>be(t,e,s,r,r,0,i,o,n,a,h,l),ellipse(t,e,s,r,i,o,n,a,u,c,p,_){const f=o*h,g=ee(f),y=se(f);let x=n*h,m=a*h;x>ne&&(x-=l),m<0&&(m+=l);let w=m-x;w<0?w+=l:w>l&&(w-=l),u&&(w-=l);const b=ie(oe(w/d)),v=w/b,B=ee(v/4),C=8/3*B*B/ee(v/2);m=x+v;let k,T,O,P,L,R,S,E,M=se(x),I=ee(x),A=O=y*r*M-g*i*I,W=P=g*r*M+y*i*I,D=e+O,N=s+P;t&&t.push(t.length?pe:ce,D,N),c&&le(c,D,N),_&&ue(_,D,N);for(let o=0;o<b;o++)k=se(m),T=ee(m),O=y*r*k-g*i*T,P=g*r*k+y*i*T,L=e+A-C*(y*r*I+g*i*M),R=s+W-C*(g*r*I-y*i*M),S=e+O+C*(y*r*T+g*i*k),E=s+P+C*(g*r*T-y*i*k),t&&t.push(_e,L,R,S,E,e+O,s+P),c&&we(e+A,s+W,L,R,S,E,e+O,s+P,c,!0),A=O,W=P,M=k,I=T,x=m,m+=v;p&&ue(p,e+O,s+P)},quadraticCurveTo(t,e,s,r,i,o,n){t.push(_e,(e+2*r)/3,(s+2*i)/3,(o+2*r)/3,(n+2*i)/3,o,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,r,i,o,n,a){we(t,e,(t+2*s)/3,(e+2*r)/3,(i+2*s)/3,(o+2*r)/3,i,o,n,a)},toTwoPointBounds(t,e,s,r,i,o,n,a,h,l){const d=[];let u,c,p,_,f,g,y,x,m=t,w=s,b=i,v=n;for(let t=0;t<2;++t)if(1==t&&(m=e,w=r,b=o,v=a),u=-3*m+9*w-9*b+3*v,c=6*m-12*w+6*b,p=3*w-3*m,Math.abs(u)<1e-12){if(Math.abs(c)<1e-12)continue;_=-p/c,0<_&&_<1&&d.push(_)}else y=c*c-4*p*u,x=Math.sqrt(y),y<0||(f=(-c+x)/(2*u),0<f&&f<1&&d.push(f),g=(-c-x)/(2*u),0<g&&g<1&&d.push(g));l?de(h,t,e):le(h,t,e),de(h,n,a);for(let l=0,u=d.length;l<u;l++)me(d[l],t,e,s,r,i,o,n,a,ye),de(h,ye.x,ye.y)},getPointAndSet(t,e,s,r,i,o,n,a,h,l){const d=1-t,u=d*d*d,c=3*d*d*t,p=3*d*t*t,_=t*t*t;l.x=u*e+c*r+p*o+_*a,l.y=u*s+c*i+p*n+_*h},getPoint(t,e,s,r,i,o,n,a,h){const l={};return me(t,e,s,r,i,o,n,a,h,l),l}},{getPointAndSet:me,toTwoPointBounds:we,ellipse:be}=xe,{sin:ve,cos:Be,sqrt:Ce,atan2:ke}=Math,{ellipse:Te}=xe,Oe={ellipticalArc(e,s,r,i,o,n,a,d,u,c,p){const _=(u-s)/2,f=(c-r)/2,g=n*h,y=ve(g),x=Be(g),m=-x*_-y*f,w=-x*f+y*_,b=i*i,v=o*o,B=w*w,C=m*m,k=b*v-b*B-v*C;let T=0;if(k<0){const t=Ce(1-k/(b*v));i*=t,o*=t}else T=(a===d?-1:1)*Ce(k/(b*B+v*C));const O=T*i*w/o,P=-T*o*m/i,L=ke((w-P)/o,(m-O)/i),R=ke((-w-P)/o,(-m-O)/i);let S=R-L;0===d&&S>0?S-=l:1===d&&S<0&&(S+=l);const E=s+_+x*O-y*P,M=r+f+y*O+x*P,I=S<0?1:0;p||t.ellipseToCurve?Te(e,E,M,i,o,n,L/h,R/h,I):i!==o||n?e.push(qt.G,E,M,i,o,n,L/h,R/h,I):e.push(qt.O,E,M,i,L/h,R/h,I)}},{M:Pe,m:Le,L:Re,l:Se,H:Ee,h:Me,V:Ie,v:Ae,C:We,c:De,S:Ne,s:Ye,Q:Xe,q:ze,T:Fe,t:je,A:He,a:Ue,Z:Ge,z:qe,N:Ve,D:Qe,X:Je,G:Ze,F:$e,O:Ke,P:ts,U:es}=qt,{rect:ss,roundRect:rs,arcTo:is,arc:os,ellipse:ns,quadraticCurveTo:as}=xe,{ellipticalArc:hs}=Oe,ls=xt.get("PathConvert"),ds={},us={current:{dot:0},stringify(t,e){let s,r,i,o=0,n=t.length,h="";for(;o<n;){r=t[o],s=Kt[r],h+=r===i?" ":$t[r];for(let r=1;r<s;r++)h+=a.float(t[o+r],e),r===s-1||(h+=" ");i=r,o+=s}return h},parse(t,e){let s,r,i,o="";const n=[],a=e?Jt:Qt;for(let e=0,h=t.length;e<h;e++)r=t[e],yt[r]?("."===r&&(cs.dot&&(ps(n,o),o=""),cs.dot++),"0"===o&&"."!==r&&(ps(n,o),o=""),o+=r):qt[r]?(o&&(ps(n,o),o=""),cs.name=qt[r],cs.length=Vt[r],cs.index=0,ps(n,cs.name),!s&&a[r]&&(s=!0)):"-"===r||"+"===r?"e"===i||"E"===i?o+=r:(o&&ps(n,o),o=r):o&&(ps(n,o),o=""),i=r;return o&&ps(n,o),s?us.toCanvasData(n,e):n},toCanvasData(t,e){let s,r,i,o,n,a=0,h=0,l=0,d=0,u=0,c=t.length;const p=[];for(;u<c;){switch(i=t[u],i){case Le:t[u+1]+=a,t[u+2]+=h;case Pe:a=t[u+1],h=t[u+2],p.push(Pe,a,h),u+=3;break;case Me:t[u+1]+=a;case Ee:a=t[u+1],p.push(Re,a,h),u+=2;break;case Ae:t[u+1]+=h;case Ie:h=t[u+1],p.push(Re,a,h),u+=2;break;case Se:t[u+1]+=a,t[u+2]+=h;case Re:a=t[u+1],h=t[u+2],p.push(Re,a,h),u+=3;break;case Ye:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=Ne;case Ne:n=o===We||o===Ne,l=n?2*a-s:t[u+1],d=n?2*h-r:t[u+2],s=t[u+1],r=t[u+2],a=t[u+3],h=t[u+4],p.push(We,l,d,s,r,a,h),u+=5;break;case De:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,t[u+5]+=a,t[u+6]+=h,i=We;case We:s=t[u+3],r=t[u+4],a=t[u+5],h=t[u+6],p.push(We,t[u+1],t[u+2],s,r,a,h),u+=7;break;case je:t[u+1]+=a,t[u+2]+=h,i=Fe;case Fe:n=o===Xe||o===Fe,s=n?2*a-s:t[u+1],r=n?2*h-r:t[u+2],e?as(p,a,h,s,r,t[u+1],t[u+2]):p.push(Xe,s,r,t[u+1],t[u+2]),a=t[u+1],h=t[u+2],u+=3;break;case ze:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=Xe;case Xe:s=t[u+1],r=t[u+2],e?as(p,a,h,s,r,t[u+3],t[u+4]):p.push(Xe,s,r,t[u+3],t[u+4]),a=t[u+3],h=t[u+4],u+=5;break;case Ue:t[u+6]+=a,t[u+7]+=h;case He:hs(p,a,h,t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],t[u+7],e),a=t[u+6],h=t[u+7],u+=8;break;case qe:case Ge:p.push(Ge),u++;break;case Ve:a=t[u+1],h=t[u+2],e?ss(p,a,h,t[u+3],t[u+4]):_s(p,t,u,5),u+=5;break;case Qe:a=t[u+1],h=t[u+2],e?rs(p,a,h,t[u+3],t[u+4],[t[u+5],t[u+6],t[u+7],t[u+8]]):_s(p,t,u,9),u+=9;break;case Je:a=t[u+1],h=t[u+2],e?rs(p,a,h,t[u+3],t[u+4],t[u+5]):_s(p,t,u,6),u+=6;break;case Ze:ns(e?p:_s(p,t,u,9),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],t[u+7],t[u+8],null,ds),a=ds.x,h=ds.y,u+=9;break;case $e:e?ns(p,t[u+1],t[u+2],t[u+3],t[u+4],0,0,360,!1):_s(p,t,u,5),a=t[u+1]+t[u+3],h=t[u+2],u+=5;break;case Ke:os(e?p:_s(p,t,u,7),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],null,ds),a=ds.x,h=ds.y,u+=7;break;case ts:e?os(p,t[u+1],t[u+2],t[u+3],0,360,!1):_s(p,t,u,4),a=t[u+1]+t[u+3],h=t[u+2],u+=4;break;case es:is(e?p:_s(p,t,u,6),a,h,t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],null,ds),a=ds.x,h=ds.y,u+=6;break;default:return ls.error(`command: ${i} [index:${u}]`,t),p}o=i}return p},copyData(t,e,s,r){for(let i=s,o=s+r;i<o;i++)t.push(e[i])},pushData(t,e){cs.index===cs.length&&(cs.index=1,t.push(cs.name)),t.push(Number(e)),cs.index++,cs.dot=0}},{current:cs,pushData:ps,copyData:_s}=us,{M:fs,L:gs,C:ys,Q:xs,Z:ms,N:ws,D:bs,X:vs,G:Bs,F:Cs,O:ks,P:Ts,U:Os}=qt,{getMinDistanceFrom:Ps,getRadianFrom:Ls}=E,{tan:Rs,min:Ss,abs:Es}=Math,Ms={},Is={beginPath(t){t.length=0},moveTo(t,e,s){t.push(fs,e,s)},lineTo(t,e,s){t.push(gs,e,s)},bezierCurveTo(t,e,s,r,i,o,n){t.push(ys,e,s,r,i,o,n)},quadraticCurveTo(t,e,s,r,i){t.push(xs,e,s,r,i)},closePath(t){t.push(ms)},rect(t,e,s,r,i){t.push(ws,e,s,r,i)},roundRect(t,e,s,r,i,o){if("number"==typeof o)t.push(vs,e,s,r,i,o);else{const n=a.fourNumber(o);n?t.push(bs,e,s,r,i,...n):t.push(ws,e,s,r,i)}},ellipse(t,e,s,r,i,o,n,a,h){void 0===o?t.push(Cs,e,s,r,i):(void 0===n&&(n=0),void 0===a&&(a=360),t.push(Bs,e,s,r,i,o,n,a,h?1:0))},arc(t,e,s,r,i,o,n){void 0===i?t.push(Ts,e,s,r):(void 0===o&&(o=360),t.push(ks,e,s,r,i,o,n?1:0))},arcTo(t,e,s,r,i,o,n,a){if(void 0!==n){const h=Rs(Ls(n,a,e,s,r,i)/2)*(Ps(n,a,e,s,r,i)/2);t.push(Os,e,s,r,i,Ss(o,Es(h)))}else t.push(Os,e,s,r,i,o)},drawEllipse(t,e,s,r,i,o,n,a,h){xe.ellipse(null,e,s,r,i,void 0===o?0:o,void 0===n?0:n,void 0===a?360:a,h,null,null,Ms),t.push(fs,Ms.x,Ms.y),As(t,e,s,r,i,o,n,a,h)},drawArc(t,e,s,r,i,o,n){xe.arc(null,e,s,r,void 0===i?0:i,void 0===o?360:o,n,null,null,Ms),t.push(fs,Ms.x,Ms.y),Ws(t,e,s,r,i,o,n)},drawPoints(t,e,s,r){xe.points(t,e,s,r)}},{ellipse:As,arc:Ws}=Is,{moveTo:Ds,lineTo:Ns,quadraticCurveTo:Ys,bezierCurveTo:Xs,closePath:zs,beginPath:Fs,rect:js,roundRect:Hs,ellipse:Us,arc:Gs,arcTo:qs,drawEllipse:Vs,drawArc:Qs,drawPoints:Js}=Is;class Zs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.clearPath=this.beginPath,this.set(t)}set(t){return this.__path=t?"string"==typeof t?Ut.parse(t):t:[],this}beginPath(){return Fs(this.__path),this.paint(),this}moveTo(t,e){return Ds(this.__path,t,e),this.paint(),this}lineTo(t,e){return Ns(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,r,i,o){return Xs(this.__path,t,e,s,r,i,o),this.paint(),this}quadraticCurveTo(t,e,s,r){return Ys(this.__path,t,e,s,r),this.paint(),this}closePath(){return zs(this.__path),this.paint(),this}rect(t,e,s,r){return js(this.__path,t,e,s,r),this.paint(),this}roundRect(t,e,s,r,i){return Hs(this.__path,t,e,s,r,i),this.paint(),this}ellipse(t,e,s,r,i,o,n,a){return Us(this.__path,t,e,s,r,i,o,n,a),this.paint(),this}arc(t,e,s,r,i,o){return Gs(this.__path,t,e,s,r,i,o),this.paint(),this}arcTo(t,e,s,r,i){return qs(this.__path,t,e,s,r,i),this.paint(),this}drawEllipse(t,e,s,r,i,o,n,a){return Vs(this.__path,t,e,s,r,i,o,n,a),this.paint(),this}drawArc(t,e,s,r,i,o){return Qs(this.__path,t,e,s,r,i,o),this.paint(),this}drawPoints(t,e,s){return Js(this.__path,t,e,s),this.paint(),this}paint(){}}const{M:$s,L:Ks,C:tr,Q:er,Z:sr,N:rr,D:ir,X:or,G:nr,F:ar,O:hr,P:lr,U:dr}=qt,ur=xt.get("PathDrawer"),cr={drawPathByData(t,e){if(!e)return;let s,r=0,i=e.length;for(;r<i;)switch(s=e[r],s){case $s:t.moveTo(e[r+1],e[r+2]),r+=3;break;case Ks:t.lineTo(e[r+1],e[r+2]),r+=3;break;case tr:t.bezierCurveTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5],e[r+6]),r+=7;break;case er:t.quadraticCurveTo(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case sr:t.closePath(),r+=1;break;case rr:t.rect(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case ir:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],[e[r+5],e[r+6],e[r+7],e[r+8]]),r+=9;break;case or:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;case nr:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]*h,e[r+6]*h,e[r+7]*h,e[r+8]),r+=9;break;case ar:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,l,!1),r+=5;break;case hr:t.arc(e[r+1],e[r+2],e[r+3],e[r+4]*h,e[r+5]*h,e[r+6]),r+=7;break;case lr:t.arc(e[r+1],e[r+2],e[r+3],0,l,!1),r+=4;break;case dr:t.arcTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;default:return void ur.error(`command: ${s} [index:${r}]`,e)}}},{M:pr,L:_r,C:fr,Q:gr,Z:yr,N:xr,D:mr,X:wr,G:br,F:vr,O:Br,P:Cr,U:kr}=qt,{toTwoPointBounds:Tr,toTwoPointBoundsByQuadraticCurve:Or,arcTo:Pr,arc:Lr,ellipse:Rr}=xe,{addPointBounds:Sr,copy:Er,addPoint:Mr,setPoint:Ir,addBounds:Ar,toBounds:Wr}=z,Dr=xt.get("PathBounds");let Nr,Yr,Xr;const zr={},Fr={},jr={},Hr={toBounds(t,e){Hr.toTwoPointBounds(t,Fr),Wr(Fr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Ir(e,0,0);let s,r,i,o,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(n=t[a],0===a&&(n===yr||n===fr||n===gr?Ir(e,h,l):Ir(e,t[a+1],t[a+2])),n){case pr:case _r:h=t[a+1],l=t[a+2],Mr(e,h,l),a+=3;break;case fr:i=t[a+5],o=t[a+6],Tr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,o,zr),Sr(e,zr),h=i,l=o,a+=7;break;case gr:s=t[a+1],r=t[a+2],i=t[a+3],o=t[a+4],Or(h,l,s,r,i,o,zr),Sr(e,zr),h=i,l=o,a+=5;break;case yr:a+=1;break;case xr:h=t[a+1],l=t[a+2],Ar(e,h,l,t[a+3],t[a+4]),a+=5;break;case mr:case wr:h=t[a+1],l=t[a+2],Ar(e,h,l,t[a+3],t[a+4]),a+=n===mr?9:6;break;case br:Rr(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],zr,jr),0===a?Er(e,zr):Sr(e,zr),h=jr.x,l=jr.y,a+=9;break;case vr:h=t[a+1],l=t[a+2],Yr=t[a+3],Xr=t[a+4],Ar(e,h-Yr,l-Xr,2*Yr,2*Xr),h+=Yr,a+=5;break;case Br:Lr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],zr,jr),0===a?Er(e,zr):Sr(e,zr),h=jr.x,l=jr.y,a+=7;break;case Cr:h=t[a+1],l=t[a+2],Nr=t[a+3],Ar(e,h-Nr,l-Nr,2*Nr,2*Nr),h+=Nr,a+=4;break;case kr:Pr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],zr,jr),0===a?Er(e,zr):Sr(e,zr),h=jr.x,l=jr.y,a+=6;break;default:return void Dr.error(`command: ${n} [index:${a}]`,t)}}},{M:Ur,L:Gr,C:qr,Z:Vr}=qt,{getCenterX:Qr,getCenterY:Jr}=E,{arcTo:Zr}=Is,$r={smooth(t,e,s){let r,i=0,o=0,n=0,a=0,h=0,l=0,d=0,u=0,c=0;const p=t.length,_=[];for(;i<p;)switch(r=t[i],r){case Ur:a=u=t[i+1],h=c=t[i+2],i+=3,t[i]===Gr?(l=t[i+1],d=t[i+2],_.push(Ur,Qr(a,l),Jr(h,d))):_.push(Ur,a,h);break;case Gr:switch(o=t[i+1],n=t[i+2],i+=3,t[i]){case Gr:Zr(_,o,n,t[i+1],t[i+2],e,u,c);break;case Vr:Zr(_,o,n,a,h,e,u,c);break;default:_.push(Gr,o,n)}u=o,c=n;break;case qr:_.push(qr,t[i+1],t[i+2],t[i+3],t[i+4],t[i+5],t[i+6]),i+=7;break;case Vr:Zr(_,a,h,l,d,e,u,c),_.push(Vr),i+=1}return r!==Vr&&(_[1]=a,_[2]=h),_}};Ut.creator=new Zs,Ut.parse=us.parse,Ut.convertToCanvasData=us.toCanvasData;const Kr=new Zs,{drawRoundRect:ti}=te;const ei={opacityTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=si.fileType(t);return["jpg","jpeg"].some((t=>t===e))},getExportOptions(t){switch(typeof t){case"object":return t;case"number":return{quality:t};case"boolean":return{blob:t};default:return{}}}},si=ei;si.opacityTypes.forEach((t=>si.upperCaseTypeMap[t]=t.toUpperCase()));const ri=xt.get("TaskProcessor");class ii{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return Wt(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){ri.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class oi{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,s=0;for(let r=0;r<t;r++)r<=this.finishedIndex?(s+=this.list[r].time,r===this.finishedIndex&&(e=s)):e+=this.list[r].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&St.assign(this.config,t),this.empty()}add(t,e){let s,r,i,o;const n=new ii(t);return n.parent=this,"number"==typeof e?o=e:e&&(r=e.parallel,s=e.start,i=e.time,o=e.delay),i&&(n.time=i),!1===r&&(n.parallel=!1),void 0===o?this.push(n,s):(this.delayNumber++,setTimeout((()=>{this.delayNumber&&(this.delayNumber--,this.push(n,s))}),o)),this.isComplete=!1,n}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout((()=>this.start())))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach((t=>{t.isComplete||t.cancel()})),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)})):this.nextTask()}runParallelTasks(){this.parallelList.forEach((t=>this.runParallelTask(t)))}runParallelTask(t){t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout((()=>this.run()))}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let s=this.index;s<e&&(t=this.list[s],t.parallel);s++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const s=e.length,r=this.finishedIndex+s;if(e.length){if(!this.running)return;r<this.total&&(t=this.list[r],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach((t=>{t.parallel=!1})),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const ni={map:{},recycledList:[],tasker:new oi,patternTasker:new oi,get isComplete(){return ai.tasker.isComplete},get(t){let s=ai.map[t.url];return s||(s=e.image(t),ai.map[t.url]=s),s.use++,s},recycle(t){t.use--,setTimeout((()=>{t.use||ai.recycledList.push(t)}))},clearRecycled(){const t=ai.recycledList;t.length>100&&(t.forEach((t=>{!t.use&&t.url&&(delete ai.map[t.url],t.destroy())})),t.length=0)},hasOpacityPixel:t=>ei.opacityTypes.some((e=>ai.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+ei.mineType(t)))return!0}else if(s.includes("."+t)||s.includes("."+ei.upperCaseTypeMap[t]))return!0;return!1},destroy(){ai.map={},ai.recycledList=[]}},ai=ni,{IMAGE:hi,create:li}=s;function di(t,e,s,r){r||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function ui(t,e){return Object.getOwnPropertyDescriptor(t,e)}function ci(t,e){return(s,r)=>_i(s,r,t,e&&e(r))}function pi(t){return t}function _i(t,e,s,r){const i={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};di(t,e,Object.assign(i,r||{})),vi(t,e,s)}function fi(t,e){return ci(t,(t=>({set(s){this.__setAttr(t,s,e)&&gi(this)}})))}function gi(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}const yi=fi;function xi(t){return ci(t,(t=>({set(e){this.__setAttr(t,e)&&mi(this)}})))}function mi(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&gi(t)}const wi=xi;function bi(t,e,s,r){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==r&&0!==s||gi(t))}function vi(t,e,s){const r=t.__DataProcessor.prototype,i="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),n={get(){const t=this[i];return void 0===t?s:t},set(t){this[i]=t}};if(void 0===s)n.get=function(){return this[i]};else if("object"==typeof s){const{clone:t}=St;n.get=function(){let e=this[i];return void 0===e&&(this[i]=e=t(s)),e}}"width"===e?n.get=function(){const t=this[i];if(void 0===t){const t=this;return t._height&&t.__naturalWidth&&t.__useNaturalRatio?t._height*t.__naturalWidth/t.__naturalHeight:t.__naturalWidth||s}return t}:"height"===e&&(n.get=function(){const t=this[i];if(void 0===t){const t=this;return t._width&&t.__naturalHeight&&t.__useNaturalRatio?t._width*t.__naturalHeight/t.__naturalWidth:t.__naturalHeight||s}return t});let a,h=r;for(;!a&&h;)a=ui(h,e),h=h.__proto__;a&&a.set&&(n.set=a.set),r[o]&&(n.set=r[o],delete r[o]),di(r,e,n)}const Bi=new xt("rewrite"),Ci=[],ki=["destroy","constructor"];function Ti(t){Ci.length&&(Ci.forEach((e=>{t&&Bi.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Ci.length=0)}function Oi(t,e){return s=>{var r;(t.prototype?(r=t.prototype,Object.getOwnPropertyNames(r)):Object.keys(t)).forEach((r=>{if(!(ki.includes(r)||e&&e.includes(r)))if(t.prototype){ui(t.prototype,r).writable&&(s.prototype[r]=t.prototype[r])}else s.prototype[r]=t[r]}))}}setTimeout((()=>Ti(!0)));const{copy:Pi,toInnerPoint:Li,toOuterPoint:Ri,scaleOfOuter:Si,rotateOfOuter:Ei,skewOfOuter:Mi,multiplyParent:Ii,divideParent:Ai,getLayout:Wi}=b,Di={},Ni={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),zi(t,e,s),t.isBranch){const{children:r}=t;for(let t=0,i=r.length;t<i;t++)Xi(r[t],e,s)}},updateMatrix(t,e,s){const r=t.__layout;e?s&&(r.waitAutoLayout=!0,t.__hasAutoLayout&&(r.matrixChanged=!1)):r.waitAutoLayout&&(r.waitAutoLayout=!1),r.matrixChanged&&t.__updateLocalMatrix(),r.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Fi(e[t])}},updateAllChange(t){if(Fi(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)ji(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},moveWorld(t,e,s=0,r){const i="object"==typeof e?Object.assign({},e):{x:e,y:s};r?Ri(t.localTransform,i,i,!0):t.parent&&Li(t.parent.worldTransform,i,i,!0),Yi.moveLocal(t,i.x,i.y)},moveLocal(t,e,s=0){"object"==typeof e?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=s)},zoomOfWorld(t,e,s,r,i){Yi.zoomOfLocal(t,Ui(t,e),s,r,i)},zoomOfLocal(t,e,s,r=s,i){Pi(Di,t.__localMatrix),Si(Di,e,s,r),t.origin||t.around?Yi.setTransform(t,Di,i):(Hi(t,Di),t.scaleResize(s,r,!0!==i))},rotateOfWorld(t,e,s){Yi.rotateOfLocal(t,Ui(t,e),s)},rotateOfLocal(t,e,s){Pi(Di,t.__localMatrix),Ei(Di,e,s),t.origin||t.around?Yi.setTransform(t,Di):(Hi(t,Di),t.rotation=a.formatRotation(t.rotation+s))},skewOfWorld(t,e,s,r,i){Yi.skewOfLocal(t,Ui(t,e),s,r,i)},skewOfLocal(t,e,s,r=0,i){Pi(Di,t.__localMatrix),Mi(Di,e,s,r),Yi.setTransform(t,Di,i)},transformWorld(t,e,s){Pi(Di,t.worldTransform),Ii(Di,e),t.parent&&Ai(Di,t.parent.worldTransform),Yi.setTransform(t,Di,s)},transform(t,e,s){Pi(Di,t.localTransform),Ii(Di,e),Yi.setTransform(t,Di,s)},setTransform(t,e,s){const r=Wi(e,t.origin&&Yi.getInnerOrigin(t,t.origin),t.around&&Yi.getInnerOrigin(t,t.around));if(s){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;delete r.scaleX,delete r.scaleY,t.set(r),t.scaleResize(e,i,!0!==s)}else t.set(r)},getFlipTransform(t,e){const s={a:1,b:0,c:0,d:1,e:0,f:0},r="x"===e?1:-1;return Si(s,Yi.getLocalOrigin(t,"center"),-1*r,1*r),s},getLocalOrigin:(t,e)=>E.tempToOuterOf(Yi.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const s={};return pt.toPoint(e,t.boxBounds,s),s},getRelativeWorld:(t,e,s)=>(Pi(Di,t.worldTransform),Ai(Di,e.worldTransform),s?Di:Object.assign({},Di)),drop(t,e,s,r){t.setTransform(Yi.getRelativeWorld(t,e,!0),r),e.add(t,s)},hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}}},Yi=Ni,{updateAllMatrix:Xi,updateMatrix:zi,updateAllWorldOpacity:Fi,updateAllChange:ji}=Yi;function Hi(t,e){const{e:s,f:r}=t.__localMatrix;t.x+=e.e-s,t.y+=e.f-r}function Ui(t,e){return t.__layout.update(),t.parent?E.tempToInnerOf(e,t.parent.__world):e}const Gi={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:qi}=Ni,Vi={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:s}=t;for(let r=0,i=s.length;r<i;r++)(t=s[r]).isBranch&&(t.__tempNumber=1,e.add(t),Qi(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&void 0===s[t.parent.innerId];)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let s=e.length;const{children:r}=t;for(let t=0,s=r.length;t<s;t++)r[t].isBranch&&e.push(r[t]);for(let t=s,r=e.length;t<r;t++)Ji(e[t],e)},updateBounds(t,e){const s=[t];Ji(t,s),Zi(s,e)},updateBoundsByBranchStack(t,e){let s,r;for(let i=t.length-1;i>-1;i--){s=t[i],r=s.children;for(let t=0,e=r.length;t<e;t++)qi(r[t]);e&&e===s||qi(s)}}},{pushAllChildBranch:Qi,pushAllBranchStack:Ji,updateBoundsByBranchStack:Zi}=Vi,$i={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:Ki}=Ni,{toOuterOf:to,getPoints:eo,copy:so}=it,ro="_localContentBounds",io="_worldContentBounds",oo="_worldBoxBounds",no="_worldStrokeBounds";class ao{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}get localContentBounds(){return to(this.contentBounds,this.leaf.__localMatrix,this[ro]||(this[ro]={})),this[ro]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return to(this.contentBounds,this.leaf.__world,this[io]||(this[io]={})),this[io]}get worldBoxBounds(){return to(this.boxBounds,this.leaf.__world,this[oo]||(this[oo]={})),this[oo]}get worldStrokeBounds(){return to(this.strokeBounds,this.leaf.__world,this[no]||(this[no]={})),this[no]}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.boxBounds={x:0,y:0,width:0,height:0},this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),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{leafer:e}=this.leaf;if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=this.leaf;for(;e.parent&&!e.parent.leafer;)e=e.parent;t.layout(e)}}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 Ki(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 ht(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",s){const{leaf:r}=this;let i,o,n=this.getInnerBounds(t);switch(e){case"world":i=r.getWorldPoint(n),o=r.__world;break;case"local":i=r.getLocalPointByInner(n),o=r.__localMatrix;break;case"inner":i=n,o=b.defaultMatrix;break;case"page":e=r.zoomLayer;default:i=r.getWorldPoint(n,e),o=Ki(r,e,!0)}const a=b.getLayout(o);if(so(a,n),E.copy(a,i),s){const{scaleX:t,scaleY:e}=a,s=Math.abs(t),r=Math.abs(e);1===s&&1===r||(a.scaleX/=s,a.scaleY/=r,a.width*=s,a.height*=r)}return a}getLayoutPoints(t,e="world"){const{leaf:s}=this,r=eo(this.getInnerBounds(t));let i;switch(e){case"world":i=null;break;case"local":i=s.parent;break;case"inner":break;case"page":e=s.zoomLayer;default:i=e}return void 0!==i&&r.forEach((t=>s.innerToWorld(t,null,!1,i))),r}shrinkContent(){const{x:t,y:e,width:s,height:r}=this.boxBounds;this._contentBounds={x:t,y:e,width:s,height:r}}spreadStroke(){const{x:t,y:e,width:s,height:r}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:s,height:r},this._localStrokeBounds={x:t,y:e,width:s,height:r},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:r}=this.renderBounds;this._renderBounds={x:t,y:e,width:s,height:r},this._localRenderBounds={x:t,y:e,width:s,height:r}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged||this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class ho{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 lo extends ho{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}lo.ADD="child.add",lo.REMOVE="child.remove",lo.CREATED="created",lo.MOUNTED="mounted",lo.UNMOUNTED="unmounted",lo.DESTROY="destroy";class uo extends ho{constructor(t,e,s,r,i){super(t,e),this.attrName=s,this.oldValue=r,this.newValue=i}}uo.CHANGE="property.change",uo.LEAFER_CHANGE="property.leafer_change";class co extends ho{constructor(t,e){super(t),Object.assign(this,e)}}co.LOAD="image.load",co.LOADED="image.loaded",co.ERROR="image.error";class po extends ho{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(po.RESIZE),Object.assign(this,t)):super(t),this.old=e}}po.RESIZE="resize";class _o extends ho{constructor(t,e){super(t),this.data=e}}_o.REQUEST="watch.request",_o.DATA="watch.data";class fo extends ho{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}fo.CHECK_UPDATE="layout.check_update",fo.REQUEST="layout.request",fo.START="layout.start",fo.BEFORE="layout.before",fo.LAYOUT="layout",fo.AFTER="layout.after",fo.AGAIN="layout.again",fo.END="layout.end";class go extends ho{constructor(t,e,s,r){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=r)}}go.REQUEST="render.request",go.START="render.start",go.BEFORE="render.before",go.RENDER="render",go.AFTER="render.after",go.AGAIN="render.again",go.END="render.end",go.NEXT="render.next";class yo extends ho{}yo.START="leafer.start",yo.BEFORE_READY="leafer.before_ready",yo.READY="leafer.ready",yo.AFTER_READY="leafer.after_ready",yo.VIEW_READY="leafer.view_ready",yo.VIEW_COMPLETED="leafer.view_completed",yo.STOP="leafer.stop",yo.RESTART="leafer.restart",yo.END="leafer.end";const xo={};class mo{set event(t){this.on(t)}on(t,e,s){if(!e){let e,s=t;for(let t in s)e=s[t],e instanceof Array?this.on(t,e[0],e[1]):this.on(t,e);return}let r,i,o;s&&("once"===s?i=!0:"boolean"==typeof s?r=s:(r=s.capture,i=s.once));const n=wo(this,r,!0),a="string"==typeof t?t.split(" "):t,h=i?{listener:e,once:i}:{listener:e};a.forEach((t=>{t&&(o=n[t],o?-1===o.findIndex((t=>t.listener===e))&&o.push(h):n[t]=[h])}))}off(t,e,s){if(t){const r="string"==typeof t?t.split(" "):t;if(e){let t,i,o;s&&(t="boolean"==typeof s?s:"once"!==s&&s.capture);const n=wo(this,t);r.forEach((t=>{t&&(i=n[t],i&&(o=i.findIndex((t=>t.listener===e)),o>-1&&i.splice(o,1),i.length||delete n[t]))}))}else{const{__bubbleMap:t,__captureMap:e}=this;r.forEach((s=>{t&&delete t[s],e&&delete e[s]}))}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,s,r){return s&&(e=e.bind(s)),this.on(t,e,r),{type:t,current:this,listener:e,options:r}}off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>t.current.off(t.type,t.listener,t.options))),e.length=0}once(t,e,s){this.on(t,e,{once:!0,capture:s})}emit(t,e,s){!e&&Lt.has(t)&&(e=Lt.get(t,{type:t,target:this,current:this}));const r=wo(this,s)[t];if(r){let i;for(let o=0,n=r.length;o<n&&(i=r[o],i.listener(e),i.once&&(this.off(t,i.listener,s),o--,n--),!e||!e.isStopNow);o++);}this.syncEventer&&this.syncEventer.emitEvent(e,s)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:s,__captureMap:r}=this,i=s&&s[t],o=r&&r[t];return!!(void 0===e?i||o:e?o:i)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function wo(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:xo)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:xo)}}const{on:bo,on_:vo,off:Bo,off_:Co,once:ko,emit:To,emitEvent:Oo,hasEvent:Po,destroy:Lo}=mo.prototype,Ro={on:bo,on_:vo,off:Bo,off_:Co,once:ko,emit:To,emitEvent:Oo,hasEvent:Po,destroyEventer:Lo},{isFinite:So}=Number,Eo=xt.get("setAttr"),Mo={__setAttr(t,e,s){if(this.leafer&&this.leafer.created){const r=this.__.__getInput(t);if(s&&!So(e)&&void 0!==e&&(Eo.warn(this.innerName,t,e),e=void 0),"object"==typeof e||r!==e){this.__realSetAttr(t,e);const{CHANGE:s}=uo,i=new uo(s,this,t,r,e);return this.isLeafer?this.emitEvent(new uo(uo.LEAFER_CHANGE,this,t,r,e)):this.hasEvent(s)&&this.emitEvent(i),this.leafer.emitEvent(i),!0}return!1}return this.__realSetAttr(t,e),!0},__realSetAttr(t,e){const s=this.__;s[t]=e,this.__proxyData&&this.setProxyAttr(t,e),s.normalStyle&&(this.lockNormalStyle||void 0===s.normalStyle[t]||(s.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Io,multiplyParent:Ao,translateInner:Wo,defaultWorld:Do}=b,{toPoint:No,tempPoint:Yo}=pt,Xo={__updateWorldMatrix(){Ao(this.__local||this.__layout,this.parent?this.parent.__world:Do,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.rotationChanged)&&(Io(e,s,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=!1),e.e=s.x+s.offsetX,e.f=s.y+s.offsetY,(s.around||s.origin)&&(No(s.around||s.origin,t.boxBounds,Yo),Wo(e,-Yo.x,-Yo.y,!s.around))}this.__layout.matrixChanged=!1}},{updateMatrix:zo,updateAllMatrix:Fo}=Ni,{updateBounds:jo}=Vi,{toOuterOf:Ho,copyAndSpread:Uo,copy:Go}=it,{toBounds:qo}=Hr,Vo={__updateWorldBounds(){Ho(this.__layout.renderBounds,this.__world,this.__world),this.__layout.resized&&(this.__onUpdateSize(),this.__layout.resized=!1)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized=!0),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=!1,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=!1,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=!1,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized=!0),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=!1,this.parent&&this.parent.__layout.renderChange()),t.boundsChanged=!1},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),Ho(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Ho(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Ho(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?qo(e.__pathForRender,t):(t.x=0,t.y=0,t.width=e.width,t.height=e.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.leafer&&this.leafer.ready&&this.leafer.layouter.addExtra(this),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),Fo(this),jo(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Fo(this),jo(this,this))):zo(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;Uo(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?Uo(t.renderBounds,t.boxBounds,t.renderSpread):Go(t.renderBounds,t.strokeBounds)}},Qo={__render(t,e){if(this.__worldOpacity)if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=this.__.opacity,this.__.__single){if("path"===this.__.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e),this.__worldFlipped?t.copyWorldByReset(s,this.__nowWorld,null,this.__.__blendMode,!0):t.copyWorldToInner(s,this.__nowWorld,this.__layout.renderBounds,this.__.__blendMode),s.recycle(this.__nowWorld)}else this.__draw(t,e)},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),this.__.windingRule?t.clip(this.__.windingRule):t.clip())},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Jo}=Gi,Zo={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__worldOpacity)if(this.__.__single){if("path"===this.__.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const r=this.__getNowWorld(e);t.opacity=this.__.opacity,t.copyWorldByReset(s,r,r,this.__.__blendMode,!0),s.recycle(r)}else this.__renderBranch(t,e)},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:s}=this;for(let r=0,i=s.length;r<i;r++)Jo(s[r],e)||s[r].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:s}=this;for(let r=0,i=s.length;r<i;r++)Jo(s[r],e)||s[r].__clip(t,e)}}},{LEAF:$o,create:Ko}=s,{toInnerPoint:tn,toOuterPoint:en,multiplyParent:sn}=b,{toOuterOf:rn}=it,{copy:on,move:nn}=E,{moveLocal:an,zoomOfLocal:hn,rotateOfLocal:ln,skewOfLocal:dn,moveWorld:un,zoomOfWorld:cn,rotateOfWorld:pn,skewOfWorld:_n,transform:fn,transformWorld:gn,setTransform:yn,getFlipTransform:xn,getLocalOrigin:mn,getRelativeWorld:wn,drop:bn}=Ni;exports.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return Mt}get __LayoutProcessor(){return ao}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(){const{leafer:t}=this;return t&&t.created&&t.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=Ko($o),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(lo.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),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(lo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(lo.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(lo.MOUNTED)):this.__emitLifeEvent(lo.UNMOUNTED),this.isBranch){const{children:e}=this;for(let s=0,r=e.length;s<r;s++)e[s].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){void 0===t?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=void 0===e?null:void 0,this[t]=e}forceRender(t){this.forceUpdate("surface")}__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=!!t||this.children.some((t=>t.__.mask))}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld;return sn(this.__world,t.matrix,e,void 0,this.__world),rn(this.__layout.renderBounds,e,e),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 r=e?wn(this,e):this.worldTransform,i=s?t:{};return rn(t,r,i),i}worldToLocal(t,e,s,r){this.parent?this.parent.worldToInner(t,e,s,r):e&&on(e,t)}localToWorld(t,e,s,r){this.parent?this.parent.innerToWorld(t,e,s,r):e&&on(e,t)}worldToInner(t,e,s,r){r&&(r.innerToWorld(t,e,s),t=e||t),tn(this.worldTransform,t,e,s)}innerToWorld(t,e,s,r){en(this.worldTransform,t,e,s),r&&r.worldToInner(e||t,null,s)}getBoxPoint(t,e,s,r){return this.getBoxPointByInner(this.getInnerPoint(t,e,s,r),null,null,!0)}getBoxPointByInner(t,e,s,r){const i=r?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return nn(i,-o,-n),i}getInnerPoint(t,e,s,r){const i=r?t:{};return this.worldToInner(t,i,s,e),i}getInnerPointByBox(t,e,s,r){const i=r?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return nn(i,o,n),i}getInnerPointByLocal(t,e,s,r){return this.getInnerPoint(t,this.parent,s,r)}getLocalPoint(t,e,s,r){const i=r?t:{};return this.worldToLocal(t,i,s,e),i}getLocalPointByInner(t,e,s,r){return this.getWorldPoint(t,this.parent,s,r)}getPagePoint(t,e,s,r){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,s,r)}getWorldPoint(t,e,s,r){const i=r?t:{};return this.innerToWorld(t,i,s,e),i}getWorldPointByBox(t,e,s,r){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,r),e,s,!0)}getWorldPointByLocal(t,e,s,r){const i=r?t:{};return this.localToWorld(t,i,s,e),i}getWorldPointByPage(t,e,s,r){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,s,r)}setTransform(t,e){yn(this,t,e)}transform(t,e){fn(this,t,e)}move(t,e){an(this,t,e)}moveInner(t,e){un(this,t,e,!0)}scaleOf(t,e,s,r){hn(this,mn(this,t),e,s,r)}rotateOf(t,e){ln(this,mn(this,t),e)}skewOf(t,e,s,r){dn(this,mn(this,t),e,s,r)}transformWorld(t,e){gn(this,t,e)}moveWorld(t,e){un(this,t,e)}scaleOfWorld(t,e,s,r){cn(this,t,e,s,r)}rotateOfWorld(t,e){pn(this,t,e)}skewOfWorld(t,e,s,r){_n(this,t,e,s,r)}flip(t){fn(this,xn(this,t))}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){}__clip(t,e){}__renderShape(t,e,s,r){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Ct("path")}getMotionPoint(t){return Ct("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){bn(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,r){}off_(t){}once(t,e,s){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,s){s?this.addAttr(t,e,s):vi(this.prototype,t,e)}static addAttr(t,e,s){s||(s=fi),s(e)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new lo(t,this,this.parent))}destroy(){if(!this.destroyed){const{parent:t}=this;t&&this.remove(),this.children&&this.removeAll(!0),this.__emitLifeEvent(lo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0}}},exports.Leaf=At([Oi(Mo),Oi(Xo),Oi(Vo),Oi(Ro),Oi(Qo)],exports.Leaf);const{setListWithFn:vn}=it,{sort:Bn}=Vi,{localBoxBounds:Cn,localStrokeBounds:kn,localRenderBounds:Tn,maskLocalBoxBounds:On,maskLocalStrokeBounds:Pn,maskLocalRenderBounds:Ln}=Gi;exports.Branch=class extends exports.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(){vn(this.__layout.boxBounds,this.children,this.__hasMask?On:Cn)}__updateStrokeBounds(){vn(this.__layout.strokeBounds,this.children,this.__hasMask?Pn:kn)}__updateRenderBounds(){vn(this.__layout.renderBounds,this.children,this.__hasMask?Ln:Tn)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,r=e.length;s<r;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(Bn),this.__layout.affectChildrenSort=t}}add(t,e){t!==this&&(t.parent&&t.parent.remove(t),t.parent=this,void 0===e?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1),t.__layout.boxChanged||t.__layout.boxChange(),t.__layout.matrixChanged||t.__layout.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(lo.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(lo.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange())}addMany(...t){t.forEach((t=>this.add(t)))}remove(t,e){t?t.animationOut?t.__runAnimation("out",(()=>this.__remove(t,e))):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(lo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(lo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new lo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}},exports.Branch=At([Oi(Zo)],exports.Branch);class Rn{get length(){return this.list.length}constructor(t){this.reset(),t&&(t instanceof Array?this.addList(t):this.add(t))}has(t){return t&&void 0!==this.keys[t.innerId]}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return void 0===e?-1:e}add(t){const{list:e,keys:s}=this;void 0===s[t.innerId]&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(void 0===s[t.innerId]){const{list:r}=this;for(let t=e,i=r.length;t<i;t++)s[r[t].innerId]++;0===e?r.unshift(t):(e>r.length&&(e=r.length),r.splice(e,0,t)),s[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let s;for(let r=0,i=e.length;r<i;r++)void 0!==s?this.keys[e[r].innerId]=r-1:e[r].innerId===t.innerId&&(s=r,delete this.keys[t.innerId]);void 0!==s&&e.splice(s,1)}sort(t){const{list:e}=this;t?e.sort(((t,e)=>e.__level-t.__level)):e.sort(((t,e)=>t.__level-e.__level))}forEach(t){this.list.forEach(t)}clone(){const t=new Rn;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let s=0,r=t.length;s<r;s++)e[t[s].innerId]=s}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}exports.AlignHelper=gt,exports.AroundHelper=pt,exports.AutoBounds=class{constructor(t,e,s,r,i,o){"object"==typeof t?this.copy(t):this.set(t,e,s,r,i,o)}set(t=0,e=0,s=0,r=0,i=0,o=0){this.top=t,this.right=e,this.bottom=s,this.left=r,this.width=i,this.height=o}copy(t){const{top:e,right:s,bottom:r,left:i,width:o,height:n}=t;this.set(e,s,r,i,o,n)}getBoundsFrom(t){const{top:e,right:s,bottom:r,left:i,width:o,height:n}=this;return new ht(i,e,o||t.width-i-s,n||t.height-e-r)}},exports.BezierHelper=xe,exports.Bounds=ht,exports.BoundsHelper=it,exports.BranchHelper=Vi,exports.BranchRender=Zo,exports.CanvasManager=class{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let s;const{list:r}=this;for(let e=0,i=r.length;e<i;e++)if(s=r[e],s.recycled&&s.isSameSize(t))return s.recycled=!1,s.manager||(s.manager=this),s;const i=e.canvas(t);return this.add(i),i}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let s=0,r=this.list.length;s<r;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach((t=>{t.destroy()})),this.list.length=0}destroy(){this.clear()}},exports.ChildEvent=lo,exports.Creator=e,exports.DataHelper=St,exports.Debug=xt,exports.EllipseHelper=Oe,exports.Event=ho,exports.EventCreator=Lt,exports.Eventer=mo,exports.FileHelper=ei,exports.ImageEvent=co,exports.ImageManager=ni,exports.IncrementId=s,exports.LayoutEvent=fo,exports.LeafBounds=Vo,exports.LeafBoundsHelper=Gi,exports.LeafData=Mt,exports.LeafDataProxy=Mo,exports.LeafEventer=Ro,exports.LeafHelper=Ni,exports.LeafLayout=ao,exports.LeafLevelList=class{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(t instanceof Array?this.addList(t):this.add(t))}has(t){return void 0!==this.keys[t.innerId]}without(t){return void 0===this.keys[t.innerId]}sort(t){const{levels:e}=this;t?e.sort(((t,e)=>e-t)):e.sort(((t,e)=>t-e))}addList(t){t.forEach((t=>{this.add(t)}))}add(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach((s=>{e=this.levelMap[s];for(let s=0,r=e.length;s<r;s++)t(e[s])}))}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}},exports.LeafList=Rn,exports.LeafMatrix=Xo,exports.LeafRender=Qo,exports.LeaferCanvasBase=class extends zt{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 allowBackgroundColor(){return this.view&&this.parentView}constructor(e,r){super(),this.size={},this.worldTransform={},e||(e=jt),e.pixelRatio||(e.pixelRatio=t.devicePixelRatio),this.manager=r,this.innerId=s.create(s.CNAVAS);const{width:i,height:o,pixelRatio:n}=e;this.autoLayout=!i||!o,this.size.pixelRatio=n,this.config=e,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){if(this.isSameSize(t))return;let e;this.context&&!this.unreal&&this.width&&(e=this.getSameCanvas(),e.copyWorld(this)),St.copyAttrs(this.size,t,Ht),this.size.pixelRatio||(this.size.pixelRatio=1),this.bounds=new ht(0,0,this.width,this.height),this.context&&!this.unreal&&(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&e&&(this.clearWorld(e.bounds),this.copyWorld(e),e.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}=this,r=this.worldTransform;if(e){const{a:i,b:o,c:n,d:a,e:h,f:l}=e;this.setTransform(r.a=(t.a*i+t.b*n)*s,r.b=(t.a*o+t.b*a)*s,r.c=(t.c*i+t.d*n)*s,r.d=(t.c*o+t.d*a)*s,r.e=(t.e*i+t.f*n+h)*s,r.f=(t.e*o+t.f*a+l)*s)}else this.setTransform(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)}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,r){const{pixelRatio:i}=this;this.shadowOffsetX=t*i,this.shadowOffsetY=e*i,this.shadowBlur=s*i,this.shadowColor=r||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,r){if(r&&(this.blendMode=r),e){const{pixelRatio:r}=this;s||(s=e),this.drawImage(t.view,e.x*r,e.y*r,e.width*r,e.height*r,s.x*r,s.y*r,s.width*r,s.height*r)}else this.drawImage(t.view,0,0);r&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,r){if(r&&(this.blendMode=r),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,it.tempToOuterOf(s,e)),this.restore();else{const{pixelRatio:r}=this;this.drawImage(t.view,e.x*r,e.y*r,e.width*r,e.height*r,s.x,s.y,s.width,s.height)}r&&(this.blendMode="source-over")}copyWorldByReset(t,e,s,r,i){this.resetTransform(),this.copyWorld(t,e,s,r),i||this.useWorldTransform()}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,lt.set(t).scale(this.pixelRatio),this.fillRect(lt.x,lt.y,lt.width,lt.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,lt.set(t).scale(this.pixelRatio),this.strokeRect(lt.x,lt.y,lt.width,lt.height),s&&(this.blendMode="source-over")}clearWorld(t,e){lt.set(t).scale(this.pixelRatio),e&<.ceil(),this.clearRect(lt.x,lt.y,lt.width,lt.height)}clipWorld(t,e){this.beginPath(),lt.set(t).scale(this.pixelRatio),e&<.ceil(),this.rect(lt.x,lt.y,lt.width,lt.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}isSameSize(t){return this.width===t.width&&this.height===t.height&&this.pixelRatio===t.pixelRatio}getSameCanvas(t,s){const r=this.manager?this.manager.get(this.size):e.canvas(Object.assign({},this.size));return r.save(),t&&(Ft(r.worldTransform,this.worldTransform),r.useWorldTransform()),s&&(r.smooth=this.smooth),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}},exports.LeaferEvent=yo,exports.LeaferImage=class{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){this.use=0,this.waitComplete=[],this.innerId=li(hi),this.config=t||{url:""},this.isSVG=ni.isFormat("svg",t),this.hasOpacityPixel=ni.hasOpacityPixel(t)}load(e,s){return this.loading||(this.loading=!0,ni.tasker.add((()=>Wt(this,void 0,void 0,(function*(){return yield t.origin.loadImage(this.url).then((t=>{this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)})).catch((t=>{this.error=t,this.onComplete(!1)}))}))))),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}onComplete(t){let e;this.waitComplete.forEach(((s,r)=>{e=r%2,s&&(t?e||s(this):e&&s(this.error))})),this.waitComplete.length=0,this.loading=!1}getCanvas(e,s,r,i){if(e||(e=this.width),s||(s=this.height),this.cache){let{params:t,data:e}=this.cache;for(let s in t)if(t[s]!==arguments[s]){e=null;break}if(e)return e}const o=t.origin.createCanvas(e,s),n=o.getContext("2d");return r&&(n.globalAlpha=r),n.drawImage(this.view,0,0,e,s),this.cache=this.use>1?{data:o,params:arguments}:null,o}getPattern(e,s,r,i){const o=t.canvas.createPattern(e,s);try{r&&o.setTransform&&(o.setTransform(r),r=null)}catch(t){}return i&&(i.transform=r),o}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}},exports.MathHelper=a,exports.Matrix=Y,exports.MatrixHelper=b,exports.NeedConvertToCanvasCommandMap=Qt,exports.OneRadian=h,exports.PI2=l,exports.PI_2=d,exports.PathBounds=Hr,exports.PathCommandDataHelper=Is,exports.PathCommandMap=qt,exports.PathConvert=us,exports.PathCorner=$r,exports.PathCreator=Zs,exports.PathDrawer=cr,exports.PathHelper=Ut,exports.PathNumberCommandLengthMap=Kt,exports.PathNumberCommandMap=$t,exports.Platform=t,exports.Point=D,exports.PointHelper=E,exports.PropertyEvent=uo,exports.RectHelper=te,exports.RenderEvent=go,exports.ResizeEvent=po,exports.Run=vt,exports.StringNumberMap=yt,exports.TaskItem=ii,exports.TaskProcessor=oi,exports.TwoPointBoundsHelper=z,exports.UICreator=Tt,exports.WaitHelper=$i,exports.WatchEvent=_o,exports.affectRenderBoundsType=function(t){return ci(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))},exports.affectStrokeBoundsType=xi,exports.attr=pi,exports.autoLayoutType=function(t){return ci(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal())}})))},exports.boundsType=fi,exports.canvasPatch=function(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,r,i){ti(this,t,e,s,r,i)})}(t)},exports.canvasSizeAttrs=Ht,exports.cursorType=function(t){return ci(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}})))},exports.dataProcessor=function(t){return(e,s)=>{di(e,"__DataProcessor",{get:()=>t})}},exports.dataType=function(t){return ci(t)},exports.decorateLeafAttr=ci,exports.defineDataProcessor=vi,exports.defineKey=di,exports.defineLeafAttr=_i,exports.doBoundsType=gi,exports.doStrokeType=mi,exports.emptyData={},exports.eraserType=function(t){return ci(t,(t=>({set(e){this.__setAttr(t,e)&&this.waitParent((()=>{this.parent.__updateEraser(e)}))}})))},exports.getBoundsData=c,exports.getDescriptor=ui,exports.getMatrixData=p,exports.getPointData=u,exports.hitType=function(t){return ci(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,xt.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}})))},exports.isNull=function(t){return null==t},exports.layoutProcessor=function(t){return(e,s)=>{di(e,"__LayoutProcessor",{get:()=>t})}},exports.maskType=function(t){return ci(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(e)})))}})))},exports.naturalBoundsType=function(t){return ci(t,(t=>({set(e){this.__setAttr(t,e)&&(gi(this),this.__.__removeNaturalSize())}})))},exports.needPlugin=Ct,exports.opacityType=function(t){return ci(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange())}})))},exports.pathInputType=function(t){return ci(t,(t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),gi(this)}})))},exports.pathType=yi,exports.pen=Kr,exports.positionType=function(t,e){return ci(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})))},exports.registerUI=function(){return t=>{Tt.register(t)}},exports.registerUIEvent=function(){return t=>{Lt.register(t)}},exports.rewrite=function(t){return(e,s)=>{Ci.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}},exports.rewriteAble=function(){return t=>{Ti()}},exports.rotationType=function(t,e){return ci(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}})))},exports.scaleType=function(t,e){return ci(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}})))},exports.sortType=function(t){return ci(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()})))}})))},exports.strokeType=wi,exports.surfaceType=function(t){return ci(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})))},exports.tempBounds=lt,exports.tempMatrix=X,exports.tempPoint=N,exports.useModule=Oi,exports.version="1.0.3",exports.visibleType=function(t){return ci(t,(t=>({set(e){const s=this.visible;if(!0===s&&0===e){if(this.animationOut)return this.__runAnimation("out",(()=>bi(this,t,e,s)))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");bi(this,t,e,s)}})))};
|
|
1
|
+
"use strict";const t={toURL(t,e){let s=encodeURIComponent(t);return"text"===e?s="data:text/plain;charset=utf-8,"+s:"svg"===e&&(s="data:image/svg+xml,"+s),s},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(e){const{prefix:s,suffix:r}=t.image;return!r||e.startsWith("data:")||e.startsWith("blob:")||(e+=(e.includes("?")?"&":"?")+r),s&&"/"===e[0]&&(e=s+e),e}}},e={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=r;return e[t]?e[t]++:(e[t]=1,0)}},r=s,{round:i,pow:o,PI:n}=Math,a={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)),a.float(t)),getGapRotation(t,e,s=0){let r=t+s;if(e>1){const t=Math.abs(r%e);(t<1||t>e-1)&&(r=Math.round(r/e)*e)}return r-s},float(t,e){const s=e?o(10,e):1e12;return-0===(t=i(t*s)/s)?0:t},getScaleData:(t,e,s,r)=>(r||(r={}),e?(r.scaleX=("number"==typeof e?e:e.width)/s.width,r.scaleY=("number"==typeof e?e:e.height)/s.height):t&&a.assignScale(r,t),r),assignScale(t,e){"number"==typeof e?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)}},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 p(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:_,cos:f,acos:g,sqrt:y}=Math,{float:x}=a,m={};function w(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const b={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:w(),tempMatrix:{},set(t,e=1,s=0,r=0,i=1,o=0,n=0){t.a=e,t.b=s,t.c=r,t.d=i,t.e=o,t.f=n},get:p,getWorld:w,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s,r){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s,r&&(t.e-=e,t.f-=s)},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},scaleOfOuter(t,e,s,r){v.toInnerPoint(t,e,m),v.scaleOfInner(t,m,s,r)},scaleOfInner(t,e,s,r=s){v.translateInner(t,e.x,e.y),v.scale(t,s,r),v.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:r,c:i,d:o}=t,n=f(e*=h),a=_(e);t.a=s*n-r*a,t.b=s*a+r*n,t.c=i*n-o*a,t.d=i*a+o*n},rotateOfOuter(t,e,s){v.toInnerPoint(t,e,m),v.rotateOfInner(t,m,s)},rotateOfInner(t,e,s){v.translateInner(t,e.x,e.y),v.rotate(t,s),v.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:r,b:i,c:o,d:n}=t;s&&(s*=h,t.a=r+o*s,t.b=i+n*s),e&&(e*=h,t.c=o+r*e,t.d=n+i*e)},skewOfOuter(t,e,s,r){v.toInnerPoint(t,e,m),v.skewOfInner(t,m,s,r)},skewOfInner(t,e,s,r=0){v.translateInner(t,e.x,e.y),v.skew(t,s,r),v.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:r,c:i,d:o,e:n,f:a}=t;t.a=e.a*s+e.b*i,t.b=e.a*r+e.b*o,t.c=e.c*s+e.d*i,t.d=e.c*r+e.d*o,t.e=e.e*s+e.f*i+n,t.f=e.e*r+e.f*o+a},multiplyParent(t,e,s,r,i,o){let{e:n,f:a}=t;if(o&&(n+=o.scrollX,a+=o.scrollY),s||(s=t),void 0===r&&(r=1!==t.a||t.b||t.c||1!==t.d),r){const{a:r,b:o,c:n,d:a}=t;s.a=r*e.a+o*e.c,s.b=r*e.b+o*e.d,s.c=n*e.a+a*e.c,s.d=n*e.b+a*e.d,i&&(s.scaleX=e.scaleX*i.scaleX,s.scaleY=e.scaleY*i.scaleY)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,i&&(s.scaleX=e.scaleX,s.scaleY=e.scaleY);s.e=n*e.a+a*e.c+e.e,s.f=n*e.b+a*e.d+e.f},divide(t,e){v.multiply(t,v.tempInvert(e))},divideParent(t,e){v.multiplyParent(t,v.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=v;return v.copy(e,t),v.invert(e),e},invert(t){const{a:e,b:s,c:r,d:i,e:o,f:n}=t;if(s||r){const a=1/(e*i-s*r);t.a=i*a,t.b=-s*a,t.c=-r*a,t.d=e*a,t.e=-(o*i-n*r)*a,t.f=-(n*e-o*s)*a}else if(1===e&&1===i)t.e=-o,t.f=-n;else{const s=1/(e*i);t.a=i*s,t.d=e*s,t.e=-o*i*s,t.f=-n*e*s}},toOuterPoint(t,e,s,r){const{x:i,y:o}=e;s||(s=e),s.x=i*t.a+o*t.c,s.y=i*t.b+o*t.d,r||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,r){const{a:i,b:o,c:n,d:a}=t,h=1/(i*a-o*n),{x:l,y:d}=e;if(s||(s=e),s.x=(l*a-d*n)*h,s.y=(d*i-l*o)*h,!r){const{e:e,f:r}=t;s.x-=(e*a-r*n)*h,s.y-=(r*i-e*o)*h}},setLayout(t,e,s,r,i){const{x:o,y:n,scaleX:a,scaleY:l}=e;if(void 0===i&&(i=e.rotation||e.skewX||e.skewY),i){const{rotation:s,skewX:r,skewY:i}=e,o=s*h,n=f(o),d=_(o);if(r||i){const e=r*h,s=i*h;t.a=(n+s*-d)*a,t.b=(d+s*n)*a,t.c=(e*n-d)*l,t.d=(n+e*d)*l}else t.a=n*a,t.b=d*a,t.c=-d*l,t.d=n*l}else t.a=a,t.b=0,t.c=0,t.d=l;t.e=o,t.f=n,(s=s||r)&&v.translateInner(t,-s.x,-s.y,!r)},getLayout(t,e,s,r){const{a:i,b:o,c:n,d:a,e:l,f:u}=t;let c,p,m,w,b,v=l,B=u;if(o||n){const t=i*a-o*n;if(n&&!r){c=y(i*i+o*o),p=t/c;const e=i/c;m=o>0?g(e):-g(e)}else{p=y(n*n+a*a),c=t/p;const e=n/p;m=d-(a>0?g(-e):-g(e))}const e=x(f(m)),s=_(m);c=x(c),p=x(p),w=e?x((n/p+s)/e/h,9):0,b=e?x((o/c-s)/e/h,9):0,m=x(m/h)}else c=i,p=a,m=w=b=0;return(e=s||e)&&(v+=e.x*i+e.y*n,B+=e.x*o+e.y*a,s||(v-=e.x,B-=e.y)),{x:v,y:B,scaleX:c,scaleY:p,rotation:m,skewX:w,skewY:b}},withScale(t,e,s=e){const r=t;if(!e||!s){const{a:r,b:i,c:o,d:n}=t;i||o?s=(r*n-i*o)/(e=y(r*r+i*i)):(e=r,s=n)}return r.scaleX=e,r.scaleY=s,r},reset(t){v.set(t)}},v=b,{toInnerPoint:B,toOuterPoint:C}=b,{sin:k,cos:T,abs:O,sqrt:P,atan2:R,min:L,PI:S}=Math,E={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,s){t.radiusX=e,t.radiusY=void 0===s?e:s},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,s){t.x=e,t.y=s},move(t,e,s){t.x+=e,t.y+=s},scale(t,e,s=e){t.x&&(t.x*=e),t.y&&(t.y*=s)},scaleOf(t,e,s,r=s){t.x+=(t.x-e.x)*(s-1),t.y+=(t.y-e.y)*(r-1)},rotate(t,e,s){s||(s=I.defaultPoint);const r=T(e*=h),i=k(e),o=t.x-s.x,n=t.y-s.y;t.x=s.x+o*r-n*i,t.y=s.y+o*i+n*r},tempToInnerOf(t,e){const{tempPoint:s}=I;return A(s,t),B(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=I;return A(s,t),C(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=I;return A(s,t),I.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),B(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){B(e,t,s)},toOuterOf(t,e,s){C(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>M(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,r){const i=O(s-t),o=O(r-e);return P(i*i+o*o)},getMinDistanceFrom:(t,e,s,r,i,o)=>L(M(t,e,s,r),M(s,r,i,o)),getAngle:(t,e)=>W(t,e)/h,getRotation:(t,e,s,r)=>(r||(r=e),I.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,r.x,r.y)/h),getRadianFrom(t,e,s,r,i,o,n,a){void 0===n&&(n=s,a=r);let h=R(e-r,t-s);const d=R(o-a,i-n)-h;return d<-S?d+l:d},getAtan2:(t,e)=>R(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,r){const i=W(t,e);return(e=r?e:{}).x=t.x+T(i)*s,e.y=t.y+k(i)*s,e},reset(t){I.reset(t)}},I=E,{getDistanceFrom:M,copy:A,getAtan2:W}=I;class D{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?E.copy(this,t):E.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new D(this)}move(t,e){return E.move(this,t,e),this}scale(t,e){return E.scale(this,t,e),this}scaleOf(t,e,s){return E.scaleOf(this,t,e,s),this}rotate(t,e){return E.rotate(this,t,e),this}rotateOf(t,e){return E.rotate(this,e,t),this}getRotation(t,e,s){return E.getRotation(this,t,e,s)}toInnerOf(t,e){return E.toInnerOf(this,t,e),this}toOuterOf(t,e){return E.toOuterOf(this,t,e),this}getCenter(t){return new D(E.getCenter(this,t))}getDistance(t){return E.getDistance(this,t)}getDistancePoint(t,e,s){return new D(E.getDistancePoint(this,t,e,s))}getAngle(t){return E.getAngle(this,t)}getAtan2(t){return E.getAtan2(this,t)}reset(){return E.reset(this),this}}const N=new D;class Y{constructor(t,e,s,r,i,o){this.set(t,e,s,r,i,o)}set(t,e,s,r,i,o){return"object"==typeof t?b.copy(this,t):b.set(this,t,e,s,r,i,o),this}setWith(t){return b.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:s,d:r,e:i,f:o}=this;return{a:t,b:e,c:s,d:r,e:i,f:o}}clone(){return new Y(this)}translate(t,e){return b.translate(this,t,e),this}translateInner(t,e){return b.translateInner(this,t,e),this}scale(t,e){return b.scale(this,t,e),this}scaleWith(t,e){return b.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,s){return b.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return b.scaleOfInner(this,t,e,s),this}rotate(t){return b.rotate(this,t),this}rotateOfOuter(t,e){return b.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return b.rotateOfInner(this,t,e),this}skew(t,e){return b.skew(this,t,e),this}skewOfOuter(t,e,s){return b.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return b.skewOfInner(this,t,e,s),this}multiply(t){return b.multiply(this,t),this}multiplyParent(t){return b.multiplyParent(this,t),this}divide(t){return b.divide(this,t),this}divideParent(t){return b.divideParent(this,t),this}invert(){return b.invert(this),this}invertWith(){return b.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){b.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){b.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return b.setLayout(this,t,e,s),this}getLayout(t,e,s){return b.getLayout(this,t,e,s)}withScale(t,e){return b.withScale(this,t,e)}reset(){b.reset(this)}}const X=new Y,z={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,r,i){F(t,e,s),F(t,e+r,s+i)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:F}=z,{tempPointBounds:j,setPoint:H,addPoint:U,toBounds:G}=z,{toOuterPoint:q}=b,{float:V,fourNumber:Q}=a,{floor:J,ceil:Z}=Math;let $,K,tt,et;const st={},rt={},it={tempBounds:{},set(t,e=0,s=0,r=0,i=0){t.x=e,t.y=s,t.width=r,t.height=i},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s,r,i){const{x:o,y:n,width:a,height:h}=e;if(s instanceof Array){const e=Q(s);r?ot.set(t,o+e[3],n+e[0],a-e[1]-e[3],h-e[2]-e[0]):ot.set(t,o-e[3],n-e[0],a+e[1]+e[3],h+e[2]+e[0])}else r&&(s=-s),ot.set(t,o-s,n-s,a+2*s,h+2*s);i&&("width"===i?(t.y=n,t.height=h):(t.x=o,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,s){t.x+=e,t.y+=s},getByMove:(t,e,s)=>(t=Object.assign({},t),ot.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?at(e,t):e=t,s?(e.offsetX=-(ot.maxX(s)-t.x),e.offsetY=-(ot.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),ot.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e){E.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,r=s){E.scaleOf(t,e,s,r),t.width*=s,t.height*=r},tempToOuterOf:(t,e)=>(ot.copy(ot.tempBounds,t),ot.toOuterOf(ot.tempBounds,e),ot.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),ot.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:r,d:i}=e;r>0?(s.width=t.width*r,s.x=e.e+t.x*r):(s.width=t.width*-r,s.x=e.e+t.x*r-s.width),i>0?(s.height=t.height*i,s.y=e.f+t.y*i):(s.height=t.height*-i,s.y=e.f+t.y*i-s.height)}else st.x=t.x,st.y=t.y,q(e,st,rt),H(j,rt.x,rt.y),st.x=t.x+t.width,q(e,st,rt),U(j,rt.x,rt.y),st.y=t.y+t.height,q(e,st,rt),U(j,rt.x,rt.y),st.x=t.x,q(e,st,rt),U(j,rt.x,rt.y),G(j,s)},toInnerOf(t,e,s){s||(s=t),ot.move(s,-e.e,-e.f),ot.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const r=Math.min(s,Math.min(t.width/e.width,t.height/e.height));return new Y(r,0,0,r,-e.x*r,-e.y*r)},getSpread(t,e,s){const r={};return ot.copyAndSpread(r,t,e,!1,s),r},spread(t,e,s){ot.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){ot.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=J(t.x),t.y=J(t.y),t.width=e>t.x?Z(t.width+e-t.x):Z(t.width),t.height=s>t.y?Z(t.height+s-t.y):Z(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=V(t.x,e),t.y=V(t.y,e),t.width=V(t.width,e),t.height=V(t.height,e)},add(t,e,s){$=t.x+t.width,K=t.y+t.height,tt=e.x,et=e.y,s||(tt+=e.width,et+=e.height),$=$>tt?$:tt,K=K>et?K:et,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=$-t.x,t.height=K-t.y},addList(t,e){ot.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){ot.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){ot.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,r=!1){let i,o=!0;for(let n=0,a=e.length;n<a;n++)i=s?s(e[n]):e[n],i&&(i.width||i.height)&&(o?(o=!1,r||at(t,i)):nt(t,i));o&&ot.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?H(j,t.x,t.y):U(j,t.x,t.y))),G(j,t)},setPoint(t,e){ot.set(t,e.x,e.y)},addPoint(t,e){nt(t,e,!0)},getPoints(t){const{x:e,y:s,width:r,height:i}=t;return[{x:e,y:s},{x:e+r,y:s},{x:e+r,y:s+i},{x:e,y:s+i}]},hitRadiusPoint:(t,e,s)=>(s&&(e=E.tempToInnerRadiusPointOf(e,s)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,s)=>(s&&(e=E.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=ot.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=ot.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=ot.tempToOuterOf(e,s)),!ot.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:r,y:i,width:o,height:n}=e;return $=r+o,K=i+n,tt=t.x+t.width,et=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,$=$<tt?$:tt,K=K<et?K:et,o=$-r,n=K-i,{x:r,y:i,width:o,height:n}},intersect(t,e,s){ot.copy(t,ot.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){ot.set(t)}},ot=it,{add:nt,copy:at}=ot;class ht{get minX(){return it.minX(this)}get minY(){return it.minY(this)}get maxX(){return it.maxX(this)}get maxY(){return it.maxY(this)}constructor(t,e,s,r){this.set(t,e,s,r)}set(t,e,s,r){return"object"==typeof t?it.copy(this,t):it.set(this,t,e,s,r),this}get(){const{x:t,y:e,width:s,height:r}=this;return{x:t,y:e,width:s,height:r}}clone(){return new ht(this)}move(t,e){return it.move(this,t,e),this}scale(t,e){return it.scale(this,t,e),this}scaleOf(t,e,s){return it.scaleOf(this,t,e,s),this}toOuterOf(t,e){return it.toOuterOf(this,t,e),this}toInnerOf(t,e){return it.toInnerOf(this,t,e),this}getFitMatrix(t,e){return it.getFitMatrix(this,t,e)}spread(t,e){return it.spread(this,t,e),this}shrink(t,e){return it.shrink(this,t,e),this}ceil(){return it.ceil(this),this}unsign(){return it.unsign(this),this}float(t){return it.float(this,t),this}add(t){return it.add(this,t),this}addList(t){return it.setList(this,t,!0),this}setList(t){return it.setList(this,t),this}addListWithFn(t,e){return it.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return it.setListWithFn(this,t,e),this}setPoint(t){return it.setPoint(this,t),this}setPoints(t){return it.setPoints(this,t),this}addPoint(t){return it.addPoint(this,t),this}getPoints(){return it.getPoints(this)}hitPoint(t,e){return it.hitPoint(this,t,e)}hitRadiusPoint(t,e){return it.hitRadiusPoint(this,t,e)}hit(t,e){return it.hit(this,t,e)}includes(t,e){return it.includes(this,t,e)}intersect(t,e){return it.intersect(this,t,e),this}getIntersect(t,e){return new ht(it.getIntersectData(this,t,e))}isSame(t){return it.isSame(this,t)}isEmpty(){return it.isEmpty(this)}reset(){it.reset(this)}}const lt=new ht;var dt,ut;exports.Direction4=void 0,(dt=exports.Direction4||(exports.Direction4={}))[dt.top=0]="top",dt[dt.right=1]="right",dt[dt.bottom=2]="bottom",dt[dt.left=3]="left",exports.Direction9=void 0,(ut=exports.Direction9||(exports.Direction9={}))[ut.topLeft=0]="topLeft",ut[ut.top=1]="top",ut[ut.topRight=2]="topRight",ut[ut.right=3]="right",ut[ut.bottomRight=4]="bottomRight",ut[ut.bottom=5]="bottom",ut[ut.bottomLeft=6]="bottomLeft",ut[ut.left=7]="left",ut[ut.center=8]="center",ut[ut["top-left"]=0]="top-left",ut[ut["top-right"]=2]="top-right",ut[ut["bottom-right"]=4]="bottom-right",ut[ut["bottom-left"]=6]="bottom-left";const ct=[{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}];ct.forEach((t=>t.type="percent"));const pt={directionData:ct,tempPoint:{},get:_t,toPoint(t,e,s,r,i){const o=_t(t);s.x=o.x,s.y=o.y,"percent"===o.type&&(s.x*=e.width,s.y*=e.height,i&&(s.x-=i.x,s.y-=i.y,o.x&&(s.x-=1===o.x?i.width:.5===o.x?o.x*i.width:0),o.y&&(s.y-=1===o.y?i.height:.5===o.y?o.y*i.height:0))),r||(s.x+=e.x,s.y+=e.y)}};function _t(t){return"string"==typeof t?ct[exports.Direction9[t]]:t}const{toPoint:ft}=pt,gt={toPoint(t,e,s,r,i){ft(t,s,r,i,e)}},yt={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};class xt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new xt(t)}static set filter(t){this.filterList=mt(t)}static set exclude(t){this.excludeList=mt(t)}log(...t){if(wt.enable){if(wt.filterList.length&&wt.filterList.every((t=>t!==this.name)))return;if(wt.excludeList.length&&wt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){wt.enable&&this.warn(...t)}warn(...t){wt.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function mt(t){return t?"string"==typeof t&&(t=[t]):t=[],t}xt.filterList=[],xt.excludeList=[],xt.showWarn=!0;const wt=xt,bt=xt.get("RunTime"),vt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const r=s.create(s.RUNTIME);return Bt.currentId=Bt.idMap[r]=e?performance.now():Date.now(),Bt.currentName=Bt.nameMap[r]=t,Bt.nameToIdMap[t]=r,r},end(t,e){const s=Bt.idMap[t],r=Bt.nameMap[t],i=e?(performance.now()-s)/1e3:Date.now()-s;Bt.idMap[t]=Bt.nameMap[t]=Bt.nameToIdMap[r]=void 0,bt.log(r,i,"ms")},endOfName(t,e){const s=Bt.nameToIdMap[t];void 0!==s&&Bt.end(s,e)}},Bt=vt;function Ct(t){console.error("need plugin: @leafer-in/"+t)}const kt=xt.get("UICreator"),Tt={list:{},register(t){const{__tag:e}=t.prototype;Ot[e]?kt.repeat(e):Ot[e]=t},get(t,e,s,r,i,o){const n=new Ot[t](e);return void 0!==s&&(n.x=s,r&&(n.y=r),i&&(n.width=i),o&&(n.height=o)),n}},{list:Ot}=Tt,Pt=xt.get("EventCreator"),Rt={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(Lt[e]?Pt.repeat(e):Lt[e]=t)}))},changeName(t,e){const s=Lt[t];if(s){const r=Object.keys(s).find((e=>s[e]===t));r&&(s[r]=e,Lt[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Lt[t](...e)},{nameList:Lt}=Rt;const St={default:(t,e)=>(Et(e,t),Et(t,e),t),assign(t,e){let s;Object.keys(e).forEach((r=>{var i;s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(i=t[r])||void 0===i?void 0:i.constructor)===Object?Et(t[r],e[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,r=t.length;s<r;s++)e[t[s]]=!0;return e}},{assign:Et}=St;class It{get __useNaturalRatio(){return!0}get __isLinePath(){return this.path&&6===this.path.length}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s;for(let r in this)"_"!==r[0]&&(s=e?e[r]:void 0,t[r]=void 0===s?this[r]:s);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(t,e){const s={};if(t)if(t instanceof Array)for(let e of t)s[e]=this.__getInput(e);else for(let e in t)s[e]=this.__getInput(e);else{let t,e,{__input:r}=this;s.tag=this.__leaf.tag;for(let i in this)if("_"!==i[0]&&(t=this["_"+i],void 0!==t)){if("path"===i&&!this.__pathInputed)continue;e=r?r[i]:void 0,s[i]=void 0===e?t:e}}if(e&&e.matrix){const{a:t,b:e,c:r,d:i,e:o,f:n}=this.__leaf.__localMatrix;s.matrix={a:t,b:e,c:r,d:i,e:o,f:n}}return s}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&e.isBranch||e.__hasEraser||t.eraser?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 Mt;exports.Answer=void 0,(Mt=exports.Answer||(exports.Answer={}))[Mt.No=0]="No",Mt[Mt.Yes=1]="Yes",Mt[Mt.NoAndSkip=2]="NoAndSkip",Mt[Mt.YesAndSkip=3]="YesAndSkip";function At(t,e,s,r){var i,o=arguments.length,n=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(n=(o<3?i(n):o>3?i(e,s,n):i(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n}function Wt(t,e,s,r){return new(s||(s=Promise))((function(i,o){function n(t){try{h(r.next(t))}catch(t){o(t)}}function a(t){try{h(r.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(n,a)}h((r=r.apply(t,e||[])).next())}))}function Dt(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 Nt=[];function Yt(){return(t,e)=>{Nt.push(e)}}const Xt=[];class zt{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||Xt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;Nt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,s,r,i,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,r,i,o){"object"==typeof t?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,r,i,o)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,r){}strokeRect(t,e,s,r){}clearRect(t,e,s,r){}drawImage(t,e,s,r,i,o,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/r*a;r+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/i*h;i+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,r,i,o,n,a,h);break;case 5:this.context.drawImage(t,e,s,r,i);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,r,i,o){}quadraticCurveTo(t,e,s,r){}closePath(){}arc(t,e,s,r,i,o){}arcTo(t,e,s,r,i){}ellipse(t,e,s,r,i,o,n,a){}rect(t,e,s,r){}roundRect(t,e,s,r,i){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,r){}createPattern(t,e){}createRadialGradient(t,e,s,r,i,o){}fillText(t,e,s,r){}measureText(t){}strokeText(t,e,s,r){}destroy(){this.context=null}}At([Dt("imageSmoothingEnabled")],zt.prototype,"smooth",void 0),At([Dt("imageSmoothingQuality")],zt.prototype,"smoothLevel",void 0),At([Dt("globalAlpha")],zt.prototype,"opacity",void 0),At([Dt()],zt.prototype,"fillStyle",void 0),At([Dt()],zt.prototype,"strokeStyle",void 0),At([Dt("lineWidth")],zt.prototype,"strokeWidth",void 0),At([Dt("lineCap")],zt.prototype,"strokeCap",void 0),At([Dt("lineJoin")],zt.prototype,"strokeJoin",void 0),At([Dt("lineDashOffset")],zt.prototype,"dashOffset",void 0),At([Dt()],zt.prototype,"miterLimit",void 0),At([Dt()],zt.prototype,"shadowBlur",void 0),At([Dt()],zt.prototype,"shadowColor",void 0),At([Dt()],zt.prototype,"shadowOffsetX",void 0),At([Dt()],zt.prototype,"shadowOffsetY",void 0),At([Dt()],zt.prototype,"filter",void 0),At([Dt()],zt.prototype,"font",void 0),At([Dt()],zt.prototype,"fontKerning",void 0),At([Dt()],zt.prototype,"fontStretch",void 0),At([Dt()],zt.prototype,"fontVariantCaps",void 0),At([Dt()],zt.prototype,"textAlign",void 0),At([Dt()],zt.prototype,"textBaseline",void 0),At([Dt()],zt.prototype,"textRendering",void 0),At([Dt()],zt.prototype,"wordSpacing",void 0),At([Dt()],zt.prototype,"letterSpacing",void 0),At([Dt()],zt.prototype,"direction",void 0),At([Yt()],zt.prototype,"setTransform",null),At([Yt()],zt.prototype,"resetTransform",null),At([Yt()],zt.prototype,"getTransform",null),At([Yt()],zt.prototype,"save",null),At([Yt()],zt.prototype,"restore",null),At([Yt()],zt.prototype,"translate",null),At([Yt()],zt.prototype,"scale",null),At([Yt()],zt.prototype,"rotate",null),At([Yt()],zt.prototype,"fill",null),At([Yt()],zt.prototype,"stroke",null),At([Yt()],zt.prototype,"clip",null),At([Yt()],zt.prototype,"fillRect",null),At([Yt()],zt.prototype,"strokeRect",null),At([Yt()],zt.prototype,"clearRect",null),At([Yt()],zt.prototype,"beginPath",null),At([Yt()],zt.prototype,"moveTo",null),At([Yt()],zt.prototype,"lineTo",null),At([Yt()],zt.prototype,"bezierCurveTo",null),At([Yt()],zt.prototype,"quadraticCurveTo",null),At([Yt()],zt.prototype,"closePath",null),At([Yt()],zt.prototype,"arc",null),At([Yt()],zt.prototype,"arcTo",null),At([Yt()],zt.prototype,"ellipse",null),At([Yt()],zt.prototype,"rect",null),At([Yt()],zt.prototype,"roundRect",null),At([Yt()],zt.prototype,"createConicGradient",null),At([Yt()],zt.prototype,"createLinearGradient",null),At([Yt()],zt.prototype,"createPattern",null),At([Yt()],zt.prototype,"createRadialGradient",null),At([Yt()],zt.prototype,"fillText",null),At([Yt()],zt.prototype,"measureText",null),At([Yt()],zt.prototype,"strokeText",null);const{copy:Ft}=b,jt={width:1,height:1,pixelRatio:1},Ht=["width","height","pixelRatio"];const Ut={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Gt={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},qt=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},Gt),Vt={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},Qt={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},Jt=Object.assign(Object.assign({},Qt),Gt),Zt=qt,$t={};for(let t in Zt)$t[Zt[t]]=t;const Kt={};for(let t in Zt)Kt[Zt[t]]=Vt[t];const te={drawRoundRect(t,e,s,r,i,o){const n=a.fourNumber(o,Math.min(r/2,i/2)),h=e+r,l=s+i;n[0]?t.moveTo(e+n[0],s):t.moveTo(e,s),n[1]?t.arcTo(h,s,h,l,n[1]):t.lineTo(h,s),n[2]?t.arcTo(h,l,e,l,n[2]):t.lineTo(h,l),n[3]?t.arcTo(e,l,e,s,n[3]):t.lineTo(e,l),n[0]?t.arcTo(e,s,h,s,n[0]):t.lineTo(e,s)}},{sin:ee,cos:se,atan2:re,ceil:ie,abs:oe,PI:ne,sqrt:ae,pow:he}=Math,{setPoint:le,addPoint:de}=z,{set:ue}=E,{M:ce,L:pe,C:_e,Q:fe,Z:ge}=qt,ye={},xe={points(t,e,s,r){if(t.push(ce,e[0],e[1]),s&&e.length>5){let i,o,n,a,h,l,d,u,c,p,_,f,g,y=e.length;const x=!0===s?.5:s;r&&(y=(e=[e[y-2],e[y-1],...e,e[0],e[1],e[2],e[3]]).length);for(let s=2;s<y-2;s+=2)i=e[s-2],o=e[s-1],n=e[s],a=e[s+1],h=e[s+2],l=e[s+3],_=ae(he(n-i,2)+he(a-o,2)),f=ae(he(h-n,2)+he(l-a,2)),g=_+f,_=x*_/g,f=x*f/g,h-=i,l-=o,d=n-_*h,u=a-_*l,2===s?r||t.push(fe,d,u,n,a):t.push(_e,c,p,d,u,n,a),c=n+f*h,p=a+f*l;r||t.push(fe,c,p,e[y-2],e[y-1])}else for(let s=2,r=e.length;s<r;s+=2)t.push(pe,e[s],e[s+1]);r&&t.push(ge)},rect(t,e,s,r,i){Ut.creator.path=t,Ut.creator.moveTo(e,s).lineTo(e+r,s).lineTo(e+r,s+i).lineTo(e,s+i).lineTo(e,s)},roundRect(t,e,s,r,i,o){Ut.creator.path=[],te.drawRoundRect(Ut.creator,e,s,r,i,o),t.push(...Ut.convertToCanvasData(Ut.creator.path,!0))},arcTo(t,e,s,r,i,o,n,a,u,c,p){const _=r-e,f=i-s,g=o-r,y=n-i;let x=re(f,_),m=re(y,g),w=m-x;if(w<0&&(w+=l),w===ne||oe(_+f)<1e-12||oe(g+y)<1e-12)return t&&t.push(pe,r,i),u&&(le(u,e,s),de(u,r,i)),p&&ue(p,e,s),void(c&&ue(c,r,i));const b=_*y-g*f<0,v=b?-1:1,B=a/se(w/2),C=r+B*se(x+w/2+d*v),k=i+B*ee(x+w/2+d*v);return x-=d*v,m-=d*v,be(t,C,k,a,a,0,x/h,m/h,b,u,c,p)},arc:(t,e,s,r,i,o,n,a,h,l)=>be(t,e,s,r,r,0,i,o,n,a,h,l),ellipse(t,e,s,r,i,o,n,a,u,c,p,_){const f=o*h,g=ee(f),y=se(f);let x=n*h,m=a*h;x>ne&&(x-=l),m<0&&(m+=l);let w=m-x;w<0?w+=l:w>l&&(w-=l),u&&(w-=l);const b=ie(oe(w/d)),v=w/b,B=ee(v/4),C=8/3*B*B/ee(v/2);m=x+v;let k,T,O,P,R,L,S,E,I=se(x),M=ee(x),A=O=y*r*I-g*i*M,W=P=g*r*I+y*i*M,D=e+O,N=s+P;t&&t.push(t.length?pe:ce,D,N),c&&le(c,D,N),_&&ue(_,D,N);for(let o=0;o<b;o++)k=se(m),T=ee(m),O=y*r*k-g*i*T,P=g*r*k+y*i*T,R=e+A-C*(y*r*M+g*i*I),L=s+W-C*(g*r*M-y*i*I),S=e+O+C*(y*r*T+g*i*k),E=s+P+C*(g*r*T-y*i*k),t&&t.push(_e,R,L,S,E,e+O,s+P),c&&we(e+A,s+W,R,L,S,E,e+O,s+P,c,!0),A=O,W=P,I=k,M=T,x=m,m+=v;p&&ue(p,e+O,s+P)},quadraticCurveTo(t,e,s,r,i,o,n){t.push(_e,(e+2*r)/3,(s+2*i)/3,(o+2*r)/3,(n+2*i)/3,o,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,r,i,o,n,a){we(t,e,(t+2*s)/3,(e+2*r)/3,(i+2*s)/3,(o+2*r)/3,i,o,n,a)},toTwoPointBounds(t,e,s,r,i,o,n,a,h,l){const d=[];let u,c,p,_,f,g,y,x,m=t,w=s,b=i,v=n;for(let t=0;t<2;++t)if(1==t&&(m=e,w=r,b=o,v=a),u=-3*m+9*w-9*b+3*v,c=6*m-12*w+6*b,p=3*w-3*m,Math.abs(u)<1e-12){if(Math.abs(c)<1e-12)continue;_=-p/c,0<_&&_<1&&d.push(_)}else y=c*c-4*p*u,x=Math.sqrt(y),y<0||(f=(-c+x)/(2*u),0<f&&f<1&&d.push(f),g=(-c-x)/(2*u),0<g&&g<1&&d.push(g));l?de(h,t,e):le(h,t,e),de(h,n,a);for(let l=0,u=d.length;l<u;l++)me(d[l],t,e,s,r,i,o,n,a,ye),de(h,ye.x,ye.y)},getPointAndSet(t,e,s,r,i,o,n,a,h,l){const d=1-t,u=d*d*d,c=3*d*d*t,p=3*d*t*t,_=t*t*t;l.x=u*e+c*r+p*o+_*a,l.y=u*s+c*i+p*n+_*h},getPoint(t,e,s,r,i,o,n,a,h){const l={};return me(t,e,s,r,i,o,n,a,h,l),l}},{getPointAndSet:me,toTwoPointBounds:we,ellipse:be}=xe,{sin:ve,cos:Be,sqrt:Ce,atan2:ke}=Math,{ellipse:Te}=xe,Oe={ellipticalArc(e,s,r,i,o,n,a,d,u,c,p){const _=(u-s)/2,f=(c-r)/2,g=n*h,y=ve(g),x=Be(g),m=-x*_-y*f,w=-x*f+y*_,b=i*i,v=o*o,B=w*w,C=m*m,k=b*v-b*B-v*C;let T=0;if(k<0){const t=Ce(1-k/(b*v));i*=t,o*=t}else T=(a===d?-1:1)*Ce(k/(b*B+v*C));const O=T*i*w/o,P=-T*o*m/i,R=ke((w-P)/o,(m-O)/i),L=ke((-w-P)/o,(-m-O)/i);let S=L-R;0===d&&S>0?S-=l:1===d&&S<0&&(S+=l);const E=s+_+x*O-y*P,I=r+f+y*O+x*P,M=S<0?1:0;p||t.ellipseToCurve?Te(e,E,I,i,o,n,R/h,L/h,M):i!==o||n?e.push(qt.G,E,I,i,o,n,R/h,L/h,M):e.push(qt.O,E,I,i,R/h,L/h,M)}},{M:Pe,m:Re,L:Le,l:Se,H:Ee,h:Ie,V:Me,v:Ae,C:We,c:De,S:Ne,s:Ye,Q:Xe,q:ze,T:Fe,t:je,A:He,a:Ue,Z:Ge,z:qe,N:Ve,D:Qe,X:Je,G:Ze,F:$e,O:Ke,P:ts,U:es}=qt,{rect:ss,roundRect:rs,arcTo:is,arc:os,ellipse:ns,quadraticCurveTo:as}=xe,{ellipticalArc:hs}=Oe,ls=xt.get("PathConvert"),ds={},us={current:{dot:0},stringify(t,e){let s,r,i,o=0,n=t.length,h="";for(;o<n;){r=t[o],s=Kt[r],h+=r===i?" ":$t[r];for(let r=1;r<s;r++)h+=a.float(t[o+r],e),r===s-1||(h+=" ");i=r,o+=s}return h},parse(t,e){let s,r,i,o="";const n=[],a=e?Jt:Qt;for(let e=0,h=t.length;e<h;e++)r=t[e],yt[r]?("."===r&&(cs.dot&&(ps(n,o),o=""),cs.dot++),"0"===o&&"."!==r&&(ps(n,o),o=""),o+=r):qt[r]?(o&&(ps(n,o),o=""),cs.name=qt[r],cs.length=Vt[r],cs.index=0,ps(n,cs.name),!s&&a[r]&&(s=!0)):"-"===r||"+"===r?"e"===i||"E"===i?o+=r:(o&&ps(n,o),o=r):o&&(ps(n,o),o=""),i=r;return o&&ps(n,o),s?us.toCanvasData(n,e):n},toCanvasData(t,e){let s,r,i,o,n,a=0,h=0,l=0,d=0,u=0,c=t.length;const p=[];for(;u<c;){switch(i=t[u],i){case Re:t[u+1]+=a,t[u+2]+=h;case Pe:a=t[u+1],h=t[u+2],p.push(Pe,a,h),u+=3;break;case Ie:t[u+1]+=a;case Ee:a=t[u+1],p.push(Le,a,h),u+=2;break;case Ae:t[u+1]+=h;case Me:h=t[u+1],p.push(Le,a,h),u+=2;break;case Se:t[u+1]+=a,t[u+2]+=h;case Le:a=t[u+1],h=t[u+2],p.push(Le,a,h),u+=3;break;case Ye:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=Ne;case Ne:n=o===We||o===Ne,l=n?2*a-s:t[u+1],d=n?2*h-r:t[u+2],s=t[u+1],r=t[u+2],a=t[u+3],h=t[u+4],p.push(We,l,d,s,r,a,h),u+=5;break;case De:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,t[u+5]+=a,t[u+6]+=h,i=We;case We:s=t[u+3],r=t[u+4],a=t[u+5],h=t[u+6],p.push(We,t[u+1],t[u+2],s,r,a,h),u+=7;break;case je:t[u+1]+=a,t[u+2]+=h,i=Fe;case Fe:n=o===Xe||o===Fe,s=n?2*a-s:t[u+1],r=n?2*h-r:t[u+2],e?as(p,a,h,s,r,t[u+1],t[u+2]):p.push(Xe,s,r,t[u+1],t[u+2]),a=t[u+1],h=t[u+2],u+=3;break;case ze:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=Xe;case Xe:s=t[u+1],r=t[u+2],e?as(p,a,h,s,r,t[u+3],t[u+4]):p.push(Xe,s,r,t[u+3],t[u+4]),a=t[u+3],h=t[u+4],u+=5;break;case Ue:t[u+6]+=a,t[u+7]+=h;case He:hs(p,a,h,t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],t[u+7],e),a=t[u+6],h=t[u+7],u+=8;break;case qe:case Ge:p.push(Ge),u++;break;case Ve:a=t[u+1],h=t[u+2],e?ss(p,a,h,t[u+3],t[u+4]):_s(p,t,u,5),u+=5;break;case Qe:a=t[u+1],h=t[u+2],e?rs(p,a,h,t[u+3],t[u+4],[t[u+5],t[u+6],t[u+7],t[u+8]]):_s(p,t,u,9),u+=9;break;case Je:a=t[u+1],h=t[u+2],e?rs(p,a,h,t[u+3],t[u+4],t[u+5]):_s(p,t,u,6),u+=6;break;case Ze:ns(e?p:_s(p,t,u,9),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],t[u+7],t[u+8],null,ds),a=ds.x,h=ds.y,u+=9;break;case $e:e?ns(p,t[u+1],t[u+2],t[u+3],t[u+4],0,0,360,!1):_s(p,t,u,5),a=t[u+1]+t[u+3],h=t[u+2],u+=5;break;case Ke:os(e?p:_s(p,t,u,7),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],null,ds),a=ds.x,h=ds.y,u+=7;break;case ts:e?os(p,t[u+1],t[u+2],t[u+3],0,360,!1):_s(p,t,u,4),a=t[u+1]+t[u+3],h=t[u+2],u+=4;break;case es:is(e?p:_s(p,t,u,6),a,h,t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],null,ds),a=ds.x,h=ds.y,u+=6;break;default:return ls.error(`command: ${i} [index:${u}]`,t),p}o=i}return p},copyData(t,e,s,r){for(let i=s,o=s+r;i<o;i++)t.push(e[i])},pushData(t,e){cs.index===cs.length&&(cs.index=1,t.push(cs.name)),t.push(Number(e)),cs.index++,cs.dot=0}},{current:cs,pushData:ps,copyData:_s}=us,{M:fs,L:gs,C:ys,Q:xs,Z:ms,N:ws,D:bs,X:vs,G:Bs,F:Cs,O:ks,P:Ts,U:Os}=qt,{getMinDistanceFrom:Ps,getRadianFrom:Rs}=E,{tan:Ls,min:Ss,abs:Es}=Math,Is={},Ms={beginPath(t){t.length=0},moveTo(t,e,s){t.push(fs,e,s)},lineTo(t,e,s){t.push(gs,e,s)},bezierCurveTo(t,e,s,r,i,o,n){t.push(ys,e,s,r,i,o,n)},quadraticCurveTo(t,e,s,r,i){t.push(xs,e,s,r,i)},closePath(t){t.push(ms)},rect(t,e,s,r,i){t.push(ws,e,s,r,i)},roundRect(t,e,s,r,i,o){if("number"==typeof o)t.push(vs,e,s,r,i,o);else{const n=a.fourNumber(o);n?t.push(bs,e,s,r,i,...n):t.push(ws,e,s,r,i)}},ellipse(t,e,s,r,i,o,n,a,h){void 0===o?t.push(Cs,e,s,r,i):(void 0===n&&(n=0),void 0===a&&(a=360),t.push(Bs,e,s,r,i,o,n,a,h?1:0))},arc(t,e,s,r,i,o,n){void 0===i?t.push(Ts,e,s,r):(void 0===o&&(o=360),t.push(ks,e,s,r,i,o,n?1:0))},arcTo(t,e,s,r,i,o,n,a){if(void 0!==n){const h=Ls(Rs(n,a,e,s,r,i)/2)*(Ps(n,a,e,s,r,i)/2);t.push(Os,e,s,r,i,Ss(o,Es(h)))}else t.push(Os,e,s,r,i,o)},drawEllipse(t,e,s,r,i,o,n,a,h){xe.ellipse(null,e,s,r,i,void 0===o?0:o,void 0===n?0:n,void 0===a?360:a,h,null,null,Is),t.push(fs,Is.x,Is.y),As(t,e,s,r,i,o,n,a,h)},drawArc(t,e,s,r,i,o,n){xe.arc(null,e,s,r,void 0===i?0:i,void 0===o?360:o,n,null,null,Is),t.push(fs,Is.x,Is.y),Ws(t,e,s,r,i,o,n)},drawPoints(t,e,s,r){xe.points(t,e,s,r)}},{ellipse:As,arc:Ws}=Ms,{moveTo:Ds,lineTo:Ns,quadraticCurveTo:Ys,bezierCurveTo:Xs,closePath:zs,beginPath:Fs,rect:js,roundRect:Hs,ellipse:Us,arc:Gs,arcTo:qs,drawEllipse:Vs,drawArc:Qs,drawPoints:Js}=Ms;class Zs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.clearPath=this.beginPath,this.set(t)}set(t){return this.__path=t?"string"==typeof t?Ut.parse(t):t:[],this}beginPath(){return Fs(this.__path),this.paint(),this}moveTo(t,e){return Ds(this.__path,t,e),this.paint(),this}lineTo(t,e){return Ns(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,r,i,o){return Xs(this.__path,t,e,s,r,i,o),this.paint(),this}quadraticCurveTo(t,e,s,r){return Ys(this.__path,t,e,s,r),this.paint(),this}closePath(){return zs(this.__path),this.paint(),this}rect(t,e,s,r){return js(this.__path,t,e,s,r),this.paint(),this}roundRect(t,e,s,r,i){return Hs(this.__path,t,e,s,r,i),this.paint(),this}ellipse(t,e,s,r,i,o,n,a){return Us(this.__path,t,e,s,r,i,o,n,a),this.paint(),this}arc(t,e,s,r,i,o){return Gs(this.__path,t,e,s,r,i,o),this.paint(),this}arcTo(t,e,s,r,i){return qs(this.__path,t,e,s,r,i),this.paint(),this}drawEllipse(t,e,s,r,i,o,n,a){return Vs(this.__path,t,e,s,r,i,o,n,a),this.paint(),this}drawArc(t,e,s,r,i,o){return Qs(this.__path,t,e,s,r,i,o),this.paint(),this}drawPoints(t,e,s){return Js(this.__path,t,e,s),this.paint(),this}paint(){}}const{M:$s,L:Ks,C:tr,Q:er,Z:sr,N:rr,D:ir,X:or,G:nr,F:ar,O:hr,P:lr,U:dr}=qt,ur=xt.get("PathDrawer"),cr={drawPathByData(t,e){if(!e)return;let s,r=0,i=e.length;for(;r<i;)switch(s=e[r],s){case $s:t.moveTo(e[r+1],e[r+2]),r+=3;break;case Ks:t.lineTo(e[r+1],e[r+2]),r+=3;break;case tr:t.bezierCurveTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5],e[r+6]),r+=7;break;case er:t.quadraticCurveTo(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case sr:t.closePath(),r+=1;break;case rr:t.rect(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case ir:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],[e[r+5],e[r+6],e[r+7],e[r+8]]),r+=9;break;case or:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;case nr:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]*h,e[r+6]*h,e[r+7]*h,e[r+8]),r+=9;break;case ar:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,l,!1),r+=5;break;case hr:t.arc(e[r+1],e[r+2],e[r+3],e[r+4]*h,e[r+5]*h,e[r+6]),r+=7;break;case lr:t.arc(e[r+1],e[r+2],e[r+3],0,l,!1),r+=4;break;case dr:t.arcTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;default:return void ur.error(`command: ${s} [index:${r}]`,e)}}},{M:pr,L:_r,C:fr,Q:gr,Z:yr,N:xr,D:mr,X:wr,G:br,F:vr,O:Br,P:Cr,U:kr}=qt,{toTwoPointBounds:Tr,toTwoPointBoundsByQuadraticCurve:Or,arcTo:Pr,arc:Rr,ellipse:Lr}=xe,{addPointBounds:Sr,copy:Er,addPoint:Ir,setPoint:Mr,addBounds:Ar,toBounds:Wr}=z,Dr=xt.get("PathBounds");let Nr,Yr,Xr;const zr={},Fr={},jr={},Hr={toBounds(t,e){Hr.toTwoPointBounds(t,Fr),Wr(Fr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Mr(e,0,0);let s,r,i,o,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(n=t[a],0===a&&(n===yr||n===fr||n===gr?Mr(e,h,l):Mr(e,t[a+1],t[a+2])),n){case pr:case _r:h=t[a+1],l=t[a+2],Ir(e,h,l),a+=3;break;case fr:i=t[a+5],o=t[a+6],Tr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,o,zr),Sr(e,zr),h=i,l=o,a+=7;break;case gr:s=t[a+1],r=t[a+2],i=t[a+3],o=t[a+4],Or(h,l,s,r,i,o,zr),Sr(e,zr),h=i,l=o,a+=5;break;case yr:a+=1;break;case xr:h=t[a+1],l=t[a+2],Ar(e,h,l,t[a+3],t[a+4]),a+=5;break;case mr:case wr:h=t[a+1],l=t[a+2],Ar(e,h,l,t[a+3],t[a+4]),a+=n===mr?9:6;break;case br:Lr(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],zr,jr),0===a?Er(e,zr):Sr(e,zr),h=jr.x,l=jr.y,a+=9;break;case vr:h=t[a+1],l=t[a+2],Yr=t[a+3],Xr=t[a+4],Ar(e,h-Yr,l-Xr,2*Yr,2*Xr),h+=Yr,a+=5;break;case Br:Rr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],zr,jr),0===a?Er(e,zr):Sr(e,zr),h=jr.x,l=jr.y,a+=7;break;case Cr:h=t[a+1],l=t[a+2],Nr=t[a+3],Ar(e,h-Nr,l-Nr,2*Nr,2*Nr),h+=Nr,a+=4;break;case kr:Pr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],zr,jr),0===a?Er(e,zr):Sr(e,zr),h=jr.x,l=jr.y,a+=6;break;default:return void Dr.error(`command: ${n} [index:${a}]`,t)}}},{M:Ur,L:Gr,C:qr,Z:Vr}=qt,{getCenterX:Qr,getCenterY:Jr}=E,{arcTo:Zr}=Ms,$r={smooth(t,e,s){let r,i=0,o=0,n=0,a=0,h=0,l=0,d=0,u=0,c=0;const p=t.length,_=[];for(;i<p;)switch(r=t[i],r){case Ur:a=u=t[i+1],h=c=t[i+2],i+=3,t[i]===Gr?(l=t[i+1],d=t[i+2],_.push(Ur,Qr(a,l),Jr(h,d))):_.push(Ur,a,h);break;case Gr:switch(o=t[i+1],n=t[i+2],i+=3,t[i]){case Gr:Zr(_,o,n,t[i+1],t[i+2],e,u,c);break;case Vr:Zr(_,o,n,a,h,e,u,c);break;default:_.push(Gr,o,n)}u=o,c=n;break;case qr:_.push(qr,t[i+1],t[i+2],t[i+3],t[i+4],t[i+5],t[i+6]),i+=7;break;case Vr:Zr(_,a,h,l,d,e,u,c),_.push(Vr),i+=1}return r!==Vr&&(_[1]=a,_[2]=h),_}};Ut.creator=new Zs,Ut.parse=us.parse,Ut.convertToCanvasData=us.toCanvasData;const Kr=new Zs,{drawRoundRect:ti}=te;const ei={opacityTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=si.fileType(t);return["jpg","jpeg"].some((t=>t===e))},getExportOptions(t){switch(typeof t){case"object":return t;case"number":return{quality:t};case"boolean":return{blob:t};default:return{}}}},si=ei;si.opacityTypes.forEach((t=>si.upperCaseTypeMap[t]=t.toUpperCase()));const ri=xt.get("TaskProcessor");class ii{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return Wt(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){ri.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class oi{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,s=0;for(let r=0;r<t;r++)r<=this.finishedIndex?(s+=this.list[r].time,r===this.finishedIndex&&(e=s)):e+=this.list[r].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&St.assign(this.config,t),this.empty()}add(t,e){let s,r,i,o;const n=new ii(t);return n.parent=this,"number"==typeof e?o=e:e&&(r=e.parallel,s=e.start,i=e.time,o=e.delay),i&&(n.time=i),!1===r&&(n.parallel=!1),void 0===o?this.push(n,s):(this.delayNumber++,setTimeout((()=>{this.delayNumber&&(this.delayNumber--,this.push(n,s))}),o)),this.isComplete=!1,n}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout((()=>this.start())))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach((t=>{t.isComplete||t.cancel()})),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)})):this.nextTask()}runParallelTasks(){this.parallelList.forEach((t=>this.runParallelTask(t)))}runParallelTask(t){t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout((()=>this.run()))}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let s=this.index;s<e&&(t=this.list[s],t.parallel);s++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const s=e.length,r=this.finishedIndex+s;if(e.length){if(!this.running)return;r<this.total&&(t=this.list[r],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach((t=>{t.parallel=!1})),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const ni={map:{},recycledList:[],tasker:new oi,patternTasker:new oi,get isComplete(){return ai.tasker.isComplete},get(t){let s=ai.map[t.url];return s||(s=e.image(t),ai.map[t.url]=s),s.use++,s},recycle(t){t.use--,setTimeout((()=>{t.use||ai.recycledList.push(t)}))},clearRecycled(){const t=ai.recycledList;t.length>100&&(t.forEach((t=>{!t.use&&t.url&&(delete ai.map[t.url],t.destroy())})),t.length=0)},hasOpacityPixel:t=>ei.opacityTypes.some((e=>ai.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+ei.mineType(t)))return!0}else if(s.includes("."+t)||s.includes("."+ei.upperCaseTypeMap[t]))return!0;return!1},destroy(){ai.map={},ai.recycledList=[]}},ai=ni,{IMAGE:hi,create:li}=s;function di(t,e,s,r){r||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function ui(t,e){return Object.getOwnPropertyDescriptor(t,e)}function ci(t,e){return(s,r)=>_i(s,r,t,e&&e(r))}function pi(t){return t}function _i(t,e,s,r){const i={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};di(t,e,Object.assign(i,r||{})),vi(t,e,s)}function fi(t,e){return ci(t,(t=>({set(s){this.__setAttr(t,s,e)&&gi(this)}})))}function gi(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}const yi=fi;function xi(t){return ci(t,(t=>({set(e){this.__setAttr(t,e)&&mi(this)}})))}function mi(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&gi(t)}const wi=xi;function bi(t,e,s,r){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==r&&0!==s||gi(t))}function vi(t,e,s){const r=t.__DataProcessor.prototype,i="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),n={get(){const t=this[i];return void 0===t?s:t},set(t){this[i]=t}};if(void 0===s)n.get=function(){return this[i]};else if("object"==typeof s){const{clone:t}=St;n.get=function(){let e=this[i];return void 0===e&&(this[i]=e=t(s)),e}}"width"===e?n.get=function(){const t=this[i];if(void 0===t){const t=this;return t._height&&t.__naturalWidth&&t.__useNaturalRatio?t._height*t.__naturalWidth/t.__naturalHeight:t.__naturalWidth||s}return t}:"height"===e&&(n.get=function(){const t=this[i];if(void 0===t){const t=this;return t._width&&t.__naturalHeight&&t.__useNaturalRatio?t._width*t.__naturalHeight/t.__naturalWidth:t.__naturalHeight||s}return t});let a,h=r;for(;!a&&h;)a=ui(h,e),h=h.__proto__;a&&a.set&&(n.set=a.set),r[o]&&(n.set=r[o],delete r[o]),di(r,e,n)}const Bi=new xt("rewrite"),Ci=[],ki=["destroy","constructor"];function Ti(t){Ci.length&&(Ci.forEach((e=>{t&&Bi.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Ci.length=0)}function Oi(t,e){return s=>{var r;(t.prototype?(r=t.prototype,Object.getOwnPropertyNames(r)):Object.keys(t)).forEach((r=>{if(!(ki.includes(r)||e&&e.includes(r)))if(t.prototype){ui(t.prototype,r).writable&&(s.prototype[r]=t.prototype[r])}else s.prototype[r]=t[r]}))}}setTimeout((()=>Ti(!0)));const{copy:Pi,toInnerPoint:Ri,toOuterPoint:Li,scaleOfOuter:Si,rotateOfOuter:Ei,skewOfOuter:Ii,multiplyParent:Mi,divideParent:Ai,getLayout:Wi}=b,Di={},Ni={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),zi(t,e,s),t.isBranch){const{children:r}=t;for(let t=0,i=r.length;t<i;t++)Xi(r[t],e,s)}},updateMatrix(t,e,s){const r=t.__layout;e?s&&(r.waitAutoLayout=!0,t.__hasAutoLayout&&(r.matrixChanged=!1)):r.waitAutoLayout&&(r.waitAutoLayout=!1),r.matrixChanged&&t.__updateLocalMatrix(),r.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Fi(e[t])}},updateAllChange(t){if(Fi(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)ji(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},moveWorld(t,e,s=0,r){const i="object"==typeof e?Object.assign({},e):{x:e,y:s};r?Li(t.localTransform,i,i,!0):t.parent&&Ri(t.parent.worldTransform,i,i,!0),Yi.moveLocal(t,i.x,i.y)},moveLocal(t,e,s=0){"object"==typeof e?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=s)},zoomOfWorld(t,e,s,r,i){Yi.zoomOfLocal(t,Ui(t,e),s,r,i)},zoomOfLocal(t,e,s,r=s,i){Pi(Di,t.__localMatrix),Si(Di,e,s,r),t.origin||t.around?Yi.setTransform(t,Di,i):(Hi(t,Di),t.scaleResize(s,r,!0!==i))},rotateOfWorld(t,e,s){Yi.rotateOfLocal(t,Ui(t,e),s)},rotateOfLocal(t,e,s){Pi(Di,t.__localMatrix),Ei(Di,e,s),t.origin||t.around?Yi.setTransform(t,Di):(Hi(t,Di),t.rotation=a.formatRotation(t.rotation+s))},skewOfWorld(t,e,s,r,i){Yi.skewOfLocal(t,Ui(t,e),s,r,i)},skewOfLocal(t,e,s,r=0,i){Pi(Di,t.__localMatrix),Ii(Di,e,s,r),Yi.setTransform(t,Di,i)},transformWorld(t,e,s){Pi(Di,t.worldTransform),Mi(Di,e),t.parent&&Ai(Di,t.parent.worldTransform),Yi.setTransform(t,Di,s)},transform(t,e,s){Pi(Di,t.localTransform),Mi(Di,e),Yi.setTransform(t,Di,s)},setTransform(t,e,s){const r=Wi(e,t.origin&&Yi.getInnerOrigin(t,t.origin),t.around&&Yi.getInnerOrigin(t,t.around));if(s){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;delete r.scaleX,delete r.scaleY,t.set(r),t.scaleResize(e,i,!0!==s)}else t.set(r)},getFlipTransform(t,e){const s={a:1,b:0,c:0,d:1,e:0,f:0},r="x"===e?1:-1;return Si(s,Yi.getLocalOrigin(t,"center"),-1*r,1*r),s},getLocalOrigin:(t,e)=>E.tempToOuterOf(Yi.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const s={};return pt.toPoint(e,t.boxBounds,s),s},getRelativeWorld:(t,e,s)=>(Pi(Di,t.worldTransform),Ai(Di,e.worldTransform),s?Di:Object.assign({},Di)),drop(t,e,s,r){t.setTransform(Yi.getRelativeWorld(t,e,!0),r),e.add(t,s)},hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}}},Yi=Ni,{updateAllMatrix:Xi,updateMatrix:zi,updateAllWorldOpacity:Fi,updateAllChange:ji}=Yi;function Hi(t,e){const{e:s,f:r}=t.__localMatrix;t.x+=e.e-s,t.y+=e.f-r}function Ui(t,e){return t.__layout.update(),t.parent?E.tempToInnerOf(e,t.parent.__world):e}const Gi={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:qi}=Ni,Vi={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:s}=t;for(let r=0,i=s.length;r<i;r++)(t=s[r]).isBranch&&(t.__tempNumber=1,e.add(t),Qi(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&void 0===s[t.parent.innerId];)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let s=e.length;const{children:r}=t;for(let t=0,s=r.length;t<s;t++)r[t].isBranch&&e.push(r[t]);for(let t=s,r=e.length;t<r;t++)Ji(e[t],e)},updateBounds(t,e){const s=[t];Ji(t,s),Zi(s,e)},updateBoundsByBranchStack(t,e){let s,r;for(let i=t.length-1;i>-1;i--){s=t[i],r=s.children;for(let t=0,e=r.length;t<e;t++)qi(r[t]);e&&e===s||qi(s)}}},{pushAllChildBranch:Qi,pushAllBranchStack:Ji,updateBoundsByBranchStack:Zi}=Vi,$i={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:Ki}=Ni,{toOuterOf:to,getPoints:eo,copy:so}=it,ro="_localContentBounds",io="_worldContentBounds",oo="_worldBoxBounds",no="_worldStrokeBounds";class ao{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}get localContentBounds(){return to(this.contentBounds,this.leaf.__localMatrix,this[ro]||(this[ro]={})),this[ro]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return to(this.contentBounds,this.leaf.__world,this[io]||(this[io]={})),this[io]}get worldBoxBounds(){return to(this.boxBounds,this.leaf.__world,this[oo]||(this[oo]={})),this[oo]}get worldStrokeBounds(){return to(this.strokeBounds,this.leaf.__world,this[no]||(this[no]={})),this[no]}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.boxBounds={x:0,y:0,width:0,height:0},this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),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{leafer:e}=this.leaf;if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=this.leaf;for(;e.parent&&!e.parent.leafer;)e=e.parent;t.layout(e)}}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 Ki(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 ht(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",s){const{leaf:r}=this;let i,o,n,a=this.getInnerBounds(t);switch(e){case"world":i=r.getWorldPoint(a),o=r.__world;break;case"local":const{scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d}=r.__;n={scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d},i=r.getLocalPointByInner(a);break;case"inner":i=a,o=b.defaultMatrix;break;case"page":e=r.zoomLayer;default:i=r.getWorldPoint(a,e),o=Ki(r,e,!0)}if(n||(n=b.getLayout(o)),so(n,a),E.copy(n,i),s){const{scaleX:t,scaleY:e}=n,s=Math.abs(t),r=Math.abs(e);1===s&&1===r||(n.scaleX/=s,n.scaleY/=r,n.width*=s,n.height*=r)}return n}getLayoutPoints(t,e="world"){const{leaf:s}=this,r=eo(this.getInnerBounds(t));let i;switch(e){case"world":i=null;break;case"local":i=s.parent;break;case"inner":break;case"page":e=s.zoomLayer;default:i=e}return void 0!==i&&r.forEach((t=>s.innerToWorld(t,null,!1,i))),r}shrinkContent(){const{x:t,y:e,width:s,height:r}=this.boxBounds;this._contentBounds={x:t,y:e,width:s,height:r}}spreadStroke(){const{x:t,y:e,width:s,height:r}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:s,height:r},this._localStrokeBounds={x:t,y:e,width:s,height:r},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:r}=this.renderBounds;this._renderBounds={x:t,y:e,width:s,height:r},this._localRenderBounds={x:t,y:e,width:s,height:r}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged||this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class ho{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 lo extends ho{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}lo.ADD="child.add",lo.REMOVE="child.remove",lo.CREATED="created",lo.MOUNTED="mounted",lo.UNMOUNTED="unmounted",lo.DESTROY="destroy";class uo extends ho{constructor(t,e,s,r,i){super(t,e),this.attrName=s,this.oldValue=r,this.newValue=i}}uo.CHANGE="property.change",uo.LEAFER_CHANGE="property.leafer_change";class co extends ho{constructor(t,e){super(t),Object.assign(this,e)}}co.LOAD="image.load",co.LOADED="image.loaded",co.ERROR="image.error";class po extends ho{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(po.RESIZE),Object.assign(this,t)):super(t),this.old=e}}po.RESIZE="resize";class _o extends ho{constructor(t,e){super(t),this.data=e}}_o.REQUEST="watch.request",_o.DATA="watch.data";class fo extends ho{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}fo.CHECK_UPDATE="layout.check_update",fo.REQUEST="layout.request",fo.START="layout.start",fo.BEFORE="layout.before",fo.LAYOUT="layout",fo.AFTER="layout.after",fo.AGAIN="layout.again",fo.END="layout.end";class go extends ho{constructor(t,e,s,r){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=r)}}go.REQUEST="render.request",go.CHILD_START="render.child_start",go.START="render.start",go.BEFORE="render.before",go.RENDER="render",go.AFTER="render.after",go.AGAIN="render.again",go.END="render.end",go.NEXT="render.next";class yo extends ho{}yo.START="leafer.start",yo.BEFORE_READY="leafer.before_ready",yo.READY="leafer.ready",yo.AFTER_READY="leafer.after_ready",yo.VIEW_READY="leafer.view_ready",yo.VIEW_COMPLETED="leafer.view_completed",yo.STOP="leafer.stop",yo.RESTART="leafer.restart",yo.END="leafer.end";const xo={};class mo{set event(t){this.on(t)}on(t,e,s){if(!e){let e,s=t;for(let t in s)e=s[t],e instanceof Array?this.on(t,e[0],e[1]):this.on(t,e);return}let r,i,o;s&&("once"===s?i=!0:"boolean"==typeof s?r=s:(r=s.capture,i=s.once));const n=wo(this,r,!0),a="string"==typeof t?t.split(" "):t,h=i?{listener:e,once:i}:{listener:e};a.forEach((t=>{t&&(o=n[t],o?-1===o.findIndex((t=>t.listener===e))&&o.push(h):n[t]=[h])}))}off(t,e,s){if(t){const r="string"==typeof t?t.split(" "):t;if(e){let t,i,o;s&&(t="boolean"==typeof s?s:"once"!==s&&s.capture);const n=wo(this,t);r.forEach((t=>{t&&(i=n[t],i&&(o=i.findIndex((t=>t.listener===e)),o>-1&&i.splice(o,1),i.length||delete n[t]))}))}else{const{__bubbleMap:t,__captureMap:e}=this;r.forEach((s=>{t&&delete t[s],e&&delete e[s]}))}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,s,r){return s&&(e=e.bind(s)),this.on(t,e,r),{type:t,current:this,listener:e,options:r}}off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>t.current.off(t.type,t.listener,t.options))),e.length=0}once(t,e,s){this.on(t,e,{once:!0,capture:s})}emit(t,e,s){!e&&Rt.has(t)&&(e=Rt.get(t,{type:t,target:this,current:this}));const r=wo(this,s)[t];if(r){let i;for(let o=0,n=r.length;o<n&&(i=r[o],i.listener(e),i.once&&(this.off(t,i.listener,s),o--,n--),!e||!e.isStopNow);o++);}this.syncEventer&&this.syncEventer.emitEvent(e,s)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:s,__captureMap:r}=this,i=s&&s[t],o=r&&r[t];return!!(void 0===e?i||o:e?o:i)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function wo(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:xo)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:xo)}}const{on:bo,on_:vo,off:Bo,off_:Co,once:ko,emit:To,emitEvent:Oo,hasEvent:Po,destroy:Ro}=mo.prototype,Lo={on:bo,on_:vo,off:Bo,off_:Co,once:ko,emit:To,emitEvent:Oo,hasEvent:Po,destroyEventer:Ro},{isFinite:So}=Number,Eo=xt.get("setAttr"),Io={__setAttr(t,e,s){if(this.leaferIsCreated){const r=this.__.__getInput(t);if(s&&!So(e)&&void 0!==e&&(Eo.warn(this.innerName,t,e),e=void 0),"object"==typeof e||r!==e){this.__realSetAttr(t,e);const{CHANGE:s}=uo,i=new uo(s,this,t,r,e);return this.isLeafer?this.emitEvent(new uo(uo.LEAFER_CHANGE,this,t,r,e)):this.hasEvent(s)&&this.emitEvent(i),this.leafer.emitEvent(i),!0}return!1}return this.__realSetAttr(t,e),!0},__realSetAttr(t,e){const s=this.__;s[t]=e,this.__proxyData&&this.setProxyAttr(t,e),s.normalStyle&&(this.lockNormalStyle||void 0===s.normalStyle[t]||(s.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Mo,multiplyParent:Ao,translateInner:Wo,defaultWorld:Do}=b,{toPoint:No,tempPoint:Yo}=pt,Xo={__updateWorldMatrix(){Ao(this.__local||this.__layout,this.parent?this.parent.__world:Do,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.rotationChanged)&&(Mo(e,s,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=!1),e.e=s.x+s.offsetX,e.f=s.y+s.offsetY,(s.around||s.origin)&&(No(s.around||s.origin,t.boxBounds,Yo),Wo(e,-Yo.x,-Yo.y,!s.around))}this.__layout.matrixChanged=!1}},{updateMatrix:zo,updateAllMatrix:Fo}=Ni,{updateBounds:jo}=Vi,{toOuterOf:Ho,copyAndSpread:Uo,copy:Go}=it,{toBounds:qo}=Hr,Vo={__updateWorldBounds(){Ho(this.__layout.renderBounds,this.__world,this.__world),this.__layout.resized&&(this.__onUpdateSize(),this.__layout.resized=!1)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized=!0),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=!1,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=!1,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=!1,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized=!0),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=!1,this.parent&&this.parent.__layout.renderChange()),t.boundsChanged=!1},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),Ho(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Ho(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Ho(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?qo(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.leaferIsReady&&this.leafer.layouter.addExtra(this),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),Fo(this),jo(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Fo(this),jo(this,this))):zo(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;Uo(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?Uo(t.renderBounds,t.boxBounds,t.renderSpread):Go(t.renderBounds,t.strokeBounds)}},Qo={__render(t,e){if(this.__worldOpacity)if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=this.__.opacity,this.__.__single){if("path"===this.__.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e),this.__worldFlipped?t.copyWorldByReset(s,this.__nowWorld,null,this.__.__blendMode,!0):t.copyWorldToInner(s,this.__nowWorld,this.__layout.renderBounds,this.__.__blendMode),s.recycle(this.__nowWorld)}else this.__draw(t,e)},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),this.__.windingRule?t.clip(this.__.windingRule):t.clip())},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Jo}=Gi,Zo={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__worldOpacity)if(this.__.__single){if("path"===this.__.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const r=this.__getNowWorld(e);t.opacity=this.__.opacity,t.copyWorldByReset(s,r,r,this.__.__blendMode,!0),s.recycle(r)}else this.__renderBranch(t,e)},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:s}=this;for(let r=0,i=s.length;r<i;r++)Jo(s[r],e)||s[r].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:s}=this;for(let r=0,i=s.length;r<i;r++)Jo(s[r],e)||s[r].__clip(t,e)}}},{LEAF:$o,create:Ko}=s,{toInnerPoint:tn,toOuterPoint:en,multiplyParent:sn}=b,{toOuterOf:rn}=it,{copy:on,move:nn}=E,{moveLocal:an,zoomOfLocal:hn,rotateOfLocal:ln,skewOfLocal:dn,moveWorld:un,zoomOfWorld:cn,rotateOfWorld:pn,skewOfWorld:_n,transform:fn,transformWorld:gn,setTransform:yn,getFlipTransform:xn,getLocalOrigin:mn,getRelativeWorld:wn,drop:bn}=Ni;exports.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return It}get __LayoutProcessor(){return ao}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(){const{leafer:t}=this;return t&&t.created&&t.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=Ko($o),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(lo.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),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(lo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(lo.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(lo.MOUNTED)):this.__emitLifeEvent(lo.UNMOUNTED),this.isBranch){const{children:e}=this;for(let s=0,r=e.length;s<r;s++)e[s].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){void 0===t?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=void 0===e?null:void 0,this[t]=e}forceRender(t){this.forceUpdate("surface")}__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=!!t||this.children.some((t=>t.__.mask))}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld;return sn(this.__world,t.matrix,e,void 0,this.__world),rn(this.__layout.renderBounds,e,e),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 r=e?wn(this,e):this.worldTransform,i=s?t:{};return rn(t,r,i),i}worldToLocal(t,e,s,r){this.parent?this.parent.worldToInner(t,e,s,r):e&&on(e,t)}localToWorld(t,e,s,r){this.parent?this.parent.innerToWorld(t,e,s,r):e&&on(e,t)}worldToInner(t,e,s,r){r&&(r.innerToWorld(t,e,s),t=e||t),tn(this.worldTransform,t,e,s)}innerToWorld(t,e,s,r){en(this.worldTransform,t,e,s),r&&r.worldToInner(e||t,null,s)}getBoxPoint(t,e,s,r){return this.getBoxPointByInner(this.getInnerPoint(t,e,s,r),null,null,!0)}getBoxPointByInner(t,e,s,r){const i=r?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return nn(i,-o,-n),i}getInnerPoint(t,e,s,r){const i=r?t:{};return this.worldToInner(t,i,s,e),i}getInnerPointByBox(t,e,s,r){const i=r?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return nn(i,o,n),i}getInnerPointByLocal(t,e,s,r){return this.getInnerPoint(t,this.parent,s,r)}getLocalPoint(t,e,s,r){const i=r?t:{};return this.worldToLocal(t,i,s,e),i}getLocalPointByInner(t,e,s,r){return this.getWorldPoint(t,this.parent,s,r)}getPagePoint(t,e,s,r){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,s,r)}getWorldPoint(t,e,s,r){const i=r?t:{};return this.innerToWorld(t,i,s,e),i}getWorldPointByBox(t,e,s,r){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,r),e,s,!0)}getWorldPointByLocal(t,e,s,r){const i=r?t:{};return this.localToWorld(t,i,s,e),i}getWorldPointByPage(t,e,s,r){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,s,r)}setTransform(t,e){yn(this,t,e)}transform(t,e){fn(this,t,e)}move(t,e){an(this,t,e)}moveInner(t,e){un(this,t,e,!0)}scaleOf(t,e,s,r){hn(this,mn(this,t),e,s,r)}rotateOf(t,e){ln(this,mn(this,t),e)}skewOf(t,e,s,r){dn(this,mn(this,t),e,s,r)}transformWorld(t,e){gn(this,t,e)}moveWorld(t,e){un(this,t,e)}scaleOfWorld(t,e,s,r){cn(this,t,e,s,r)}rotateOfWorld(t,e){pn(this,t,e)}skewOfWorld(t,e,s,r){_n(this,t,e,s,r)}flip(t){fn(this,xn(this,t))}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){}__clip(t,e){}__renderShape(t,e,s,r){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Ct("path")}getMotionPoint(t){return Ct("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){bn(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,r){}off_(t){}once(t,e,s){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,s){s?this.addAttr(t,e,s):vi(this.prototype,t,e)}static addAttr(t,e,s){s||(s=fi),s(e)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new lo(t,this,this.parent))}destroy(){if(!this.destroyed){const{parent:t}=this;t&&this.remove(),this.children&&this.removeAll(!0),this.__emitLifeEvent(lo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0}}},exports.Leaf=At([Oi(Io),Oi(Xo),Oi(Vo),Oi(Lo),Oi(Qo)],exports.Leaf);const{setListWithFn:vn}=it,{sort:Bn}=Vi,{localBoxBounds:Cn,localStrokeBounds:kn,localRenderBounds:Tn,maskLocalBoxBounds:On,maskLocalStrokeBounds:Pn,maskLocalRenderBounds:Rn}=Gi;exports.Branch=class extends exports.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(){vn(this.__layout.boxBounds,this.children,this.__hasMask?On:Cn)}__updateStrokeBounds(){vn(this.__layout.strokeBounds,this.children,this.__hasMask?Pn:kn)}__updateRenderBounds(){vn(this.__layout.renderBounds,this.children,this.__hasMask?Rn:Tn)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,r=e.length;s<r;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(Bn),this.__layout.affectChildrenSort=t}}add(t,e){t!==this&&(t.__||(t=Tt.get(t.tag,t)),t.parent&&t.parent.remove(t),t.parent=this,void 0===e?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1),t.__layout.boxChanged||t.__layout.boxChange(),t.__layout.matrixChanged||t.__layout.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(lo.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(lo.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange())}addMany(...t){t.forEach((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(lo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(lo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new lo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}},exports.Branch=At([Oi(Zo)],exports.Branch);class Ln{get length(){return this.list.length}constructor(t){this.reset(),t&&(t instanceof Array?this.addList(t):this.add(t))}has(t){return t&&void 0!==this.keys[t.innerId]}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return void 0===e?-1:e}add(t){const{list:e,keys:s}=this;void 0===s[t.innerId]&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(void 0===s[t.innerId]){const{list:r}=this;for(let t=e,i=r.length;t<i;t++)s[r[t].innerId]++;0===e?r.unshift(t):(e>r.length&&(e=r.length),r.splice(e,0,t)),s[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let s;for(let r=0,i=e.length;r<i;r++)void 0!==s?this.keys[e[r].innerId]=r-1:e[r].innerId===t.innerId&&(s=r,delete this.keys[t.innerId]);void 0!==s&&e.splice(s,1)}sort(t){const{list:e}=this;t?e.sort(((t,e)=>e.__level-t.__level)):e.sort(((t,e)=>t.__level-e.__level))}forEach(t){this.list.forEach(t)}clone(){const t=new Ln;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let s=0,r=t.length;s<r;s++)e[t[s].innerId]=s}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}exports.AlignHelper=gt,exports.AroundHelper=pt,exports.AutoBounds=class{constructor(t,e,s,r,i,o){"object"==typeof t?this.copy(t):this.set(t,e,s,r,i,o)}set(t=0,e=0,s=0,r=0,i=0,o=0){this.top=t,this.right=e,this.bottom=s,this.left=r,this.width=i,this.height=o}copy(t){const{top:e,right:s,bottom:r,left:i,width:o,height:n}=t;this.set(e,s,r,i,o,n)}getBoundsFrom(t){const{top:e,right:s,bottom:r,left:i,width:o,height:n}=this;return new ht(i,e,o||t.width-i-s,n||t.height-e-r)}},exports.BezierHelper=xe,exports.Bounds=ht,exports.BoundsHelper=it,exports.BranchHelper=Vi,exports.BranchRender=Zo,exports.CanvasManager=class{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let s;const{list:r}=this;for(let e=0,i=r.length;e<i;e++)if(s=r[e],s.recycled&&s.isSameSize(t))return s.recycled=!1,s.manager||(s.manager=this),s;const i=e.canvas(t);return this.add(i),i}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let s=0,r=this.list.length;s<r;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach((t=>{t.destroy()})),this.list.length=0}destroy(){this.clear()}},exports.ChildEvent=lo,exports.Creator=e,exports.DataHelper=St,exports.Debug=xt,exports.EllipseHelper=Oe,exports.Event=ho,exports.EventCreator=Rt,exports.Eventer=mo,exports.FileHelper=ei,exports.ImageEvent=co,exports.ImageManager=ni,exports.IncrementId=s,exports.LayoutEvent=fo,exports.LeafBounds=Vo,exports.LeafBoundsHelper=Gi,exports.LeafData=It,exports.LeafDataProxy=Io,exports.LeafEventer=Lo,exports.LeafHelper=Ni,exports.LeafLayout=ao,exports.LeafLevelList=class{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(t instanceof Array?this.addList(t):this.add(t))}has(t){return void 0!==this.keys[t.innerId]}without(t){return void 0===this.keys[t.innerId]}sort(t){const{levels:e}=this;t?e.sort(((t,e)=>e-t)):e.sort(((t,e)=>t-e))}addList(t){t.forEach((t=>{this.add(t)}))}add(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach((s=>{e=this.levelMap[s];for(let s=0,r=e.length;s<r;s++)t(e[s])}))}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}},exports.LeafList=Ln,exports.LeafMatrix=Xo,exports.LeafRender=Qo,exports.LeaferCanvasBase=class extends zt{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 allowBackgroundColor(){return this.view&&this.parentView}constructor(e,r){super(),this.size={},this.worldTransform={},e||(e=jt),e.pixelRatio||(e.pixelRatio=t.devicePixelRatio),this.manager=r,this.innerId=s.create(s.CNAVAS);const{width:i,height:o,pixelRatio:n}=e;this.autoLayout=!i||!o,this.size.pixelRatio=n,this.config=e,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){if(this.isSameSize(t))return;let e;this.context&&!this.unreal&&this.width&&(e=this.getSameCanvas(),e.copyWorld(this)),St.copyAttrs(this.size,t,Ht),this.size.pixelRatio||(this.size.pixelRatio=1),this.bounds=new ht(0,0,this.width,this.height),this.context&&!this.unreal&&(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&e&&(this.clearWorld(e.bounds),this.copyWorld(e),e.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}=this,r=this.worldTransform;if(e){const{a:i,b:o,c:n,d:a,e:h,f:l}=e;this.setTransform(r.a=(t.a*i+t.b*n)*s,r.b=(t.a*o+t.b*a)*s,r.c=(t.c*i+t.d*n)*s,r.d=(t.c*o+t.d*a)*s,r.e=(t.e*i+t.f*n+h)*s,r.f=(t.e*o+t.f*a+l)*s)}else this.setTransform(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)}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,r){const{pixelRatio:i}=this;this.shadowOffsetX=t*i,this.shadowOffsetY=e*i,this.shadowBlur=s*i,this.shadowColor=r||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,r){if(r&&(this.blendMode=r),e){const{pixelRatio:r}=this;s||(s=e),this.drawImage(t.view,e.x*r,e.y*r,e.width*r,e.height*r,s.x*r,s.y*r,s.width*r,s.height*r)}else this.drawImage(t.view,0,0);r&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,r){if(r&&(this.blendMode=r),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,it.tempToOuterOf(s,e)),this.restore();else{const{pixelRatio:r}=this;this.drawImage(t.view,e.x*r,e.y*r,e.width*r,e.height*r,s.x,s.y,s.width,s.height)}r&&(this.blendMode="source-over")}copyWorldByReset(t,e,s,r,i){this.resetTransform(),this.copyWorld(t,e,s,r),i||this.useWorldTransform()}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,lt.set(t).scale(this.pixelRatio),this.fillRect(lt.x,lt.y,lt.width,lt.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,lt.set(t).scale(this.pixelRatio),this.strokeRect(lt.x,lt.y,lt.width,lt.height),s&&(this.blendMode="source-over")}clearWorld(t,e){lt.set(t).scale(this.pixelRatio),e&<.ceil(),this.clearRect(lt.x,lt.y,lt.width,lt.height)}clipWorld(t,e){this.beginPath(),lt.set(t).scale(this.pixelRatio),e&<.ceil(),this.rect(lt.x,lt.y,lt.width,lt.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}isSameSize(t){return this.width===t.width&&this.height===t.height&&this.pixelRatio===t.pixelRatio}getSameCanvas(t,s){const r=this.manager?this.manager.get(this.size):e.canvas(Object.assign({},this.size));return r.save(),t&&(Ft(r.worldTransform,this.worldTransform),r.useWorldTransform()),s&&(r.smooth=this.smooth),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}},exports.LeaferEvent=yo,exports.LeaferImage=class{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){this.use=0,this.waitComplete=[],this.innerId=li(hi),this.config=t||{url:""},this.isSVG=ni.isFormat("svg",t),this.hasOpacityPixel=ni.hasOpacityPixel(t)}load(e,s){return this.loading||(this.loading=!0,ni.tasker.add((()=>Wt(this,void 0,void 0,(function*(){return yield t.origin.loadImage(this.url).then((t=>{this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)})).catch((t=>{this.error=t,this.onComplete(!1)}))}))))),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}onComplete(t){let e;this.waitComplete.forEach(((s,r)=>{e=r%2,s&&(t?e||s(this):e&&s(this.error))})),this.waitComplete.length=0,this.loading=!1}getCanvas(e,s,r,i){if(e||(e=this.width),s||(s=this.height),this.cache){let{params:t,data:e}=this.cache;for(let s in t)if(t[s]!==arguments[s]){e=null;break}if(e)return e}const o=t.origin.createCanvas(e,s),n=o.getContext("2d");return r&&(n.globalAlpha=r),n.drawImage(this.view,0,0,e,s),this.cache=this.use>1?{data:o,params:arguments}:null,o}getPattern(e,s,r,i){const o=t.canvas.createPattern(e,s);try{r&&o.setTransform&&(o.setTransform(r),r=null)}catch(t){}return i&&(i.transform=r),o}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}},exports.MathHelper=a,exports.Matrix=Y,exports.MatrixHelper=b,exports.NeedConvertToCanvasCommandMap=Qt,exports.OneRadian=h,exports.PI2=l,exports.PI_2=d,exports.PathBounds=Hr,exports.PathCommandDataHelper=Ms,exports.PathCommandMap=qt,exports.PathConvert=us,exports.PathCorner=$r,exports.PathCreator=Zs,exports.PathDrawer=cr,exports.PathHelper=Ut,exports.PathNumberCommandLengthMap=Kt,exports.PathNumberCommandMap=$t,exports.Platform=t,exports.Point=D,exports.PointHelper=E,exports.PropertyEvent=uo,exports.RectHelper=te,exports.RenderEvent=go,exports.ResizeEvent=po,exports.Run=vt,exports.StringNumberMap=yt,exports.TaskItem=ii,exports.TaskProcessor=oi,exports.TwoPointBoundsHelper=z,exports.UICreator=Tt,exports.WaitHelper=$i,exports.WatchEvent=_o,exports.affectRenderBoundsType=function(t){return ci(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))},exports.affectStrokeBoundsType=xi,exports.attr=pi,exports.autoLayoutType=function(t){return ci(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal())}})))},exports.boundsType=fi,exports.canvasPatch=function(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,r,i){ti(this,t,e,s,r,i)})}(t)},exports.canvasSizeAttrs=Ht,exports.cursorType=function(t){return ci(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}})))},exports.dataProcessor=function(t){return(e,s)=>{di(e,"__DataProcessor",{get:()=>t})}},exports.dataType=function(t){return ci(t)},exports.decorateLeafAttr=ci,exports.defineDataProcessor=vi,exports.defineKey=di,exports.defineLeafAttr=_i,exports.doBoundsType=gi,exports.doStrokeType=mi,exports.emptyData={},exports.eraserType=function(t){return ci(t,(t=>({set(e){this.__setAttr(t,e)&&this.waitParent((()=>{this.parent.__updateEraser(e)}))}})))},exports.getBoundsData=c,exports.getDescriptor=ui,exports.getMatrixData=p,exports.getPointData=u,exports.hitType=function(t){return ci(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,xt.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}})))},exports.isNull=function(t){return null==t},exports.layoutProcessor=function(t){return(e,s)=>{di(e,"__LayoutProcessor",{get:()=>t})}},exports.maskType=function(t){return ci(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(e)})))}})))},exports.naturalBoundsType=function(t){return ci(t,(t=>({set(e){this.__setAttr(t,e)&&(gi(this),this.__.__removeNaturalSize())}})))},exports.needPlugin=Ct,exports.opacityType=function(t){return ci(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange())}})))},exports.pathInputType=function(t){return ci(t,(t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),gi(this)}})))},exports.pathType=yi,exports.pen=Kr,exports.positionType=function(t,e){return ci(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})))},exports.registerUI=function(){return t=>{Tt.register(t)}},exports.registerUIEvent=function(){return t=>{Rt.register(t)}},exports.rewrite=function(t){return(e,s)=>{Ci.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}},exports.rewriteAble=function(){return t=>{Ti()}},exports.rotationType=function(t,e){return ci(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}})))},exports.scaleType=function(t,e){return ci(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}})))},exports.sortType=function(t){return ci(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()})))}})))},exports.strokeType=wi,exports.surfaceType=function(t){return ci(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})))},exports.tempBounds=lt,exports.tempMatrix=X,exports.tempPoint=N,exports.useModule=Oi,exports.version="1.0.5",exports.visibleType=function(t){return ci(t,(t=>({set(e){const s=this.visible;if(!0===s&&0===e){if(this.animationOut)return this.__runAnimation("out",(()=>bi(this,t,e,s)))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");bi(this,t,e,s)}})))};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "@leafer/core",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,21 +29,21 @@
|
|
|
29
29
|
"leaferjs"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@leafer/canvas": "1.0.
|
|
33
|
-
"@leafer/image": "1.0.
|
|
34
|
-
"@leafer/data": "1.0.
|
|
35
|
-
"@leafer/debug": "1.0.
|
|
36
|
-
"@leafer/decorator": "1.0.
|
|
37
|
-
"@leafer/display": "1.0.
|
|
38
|
-
"@leafer/display-module": "1.0.
|
|
39
|
-
"@leafer/event": "1.0.
|
|
40
|
-
"@leafer/file": "1.0.
|
|
41
|
-
"@leafer/helper": "1.0.
|
|
42
|
-
"@leafer/layout": "1.0.
|
|
43
|
-
"@leafer/list": "1.0.
|
|
44
|
-
"@leafer/math": "1.0.
|
|
45
|
-
"@leafer/path": "1.0.
|
|
46
|
-
"@leafer/platform": "1.0.
|
|
47
|
-
"@leafer/task": "1.0.
|
|
32
|
+
"@leafer/canvas": "1.0.5",
|
|
33
|
+
"@leafer/image": "1.0.5",
|
|
34
|
+
"@leafer/data": "1.0.5",
|
|
35
|
+
"@leafer/debug": "1.0.5",
|
|
36
|
+
"@leafer/decorator": "1.0.5",
|
|
37
|
+
"@leafer/display": "1.0.5",
|
|
38
|
+
"@leafer/display-module": "1.0.5",
|
|
39
|
+
"@leafer/event": "1.0.5",
|
|
40
|
+
"@leafer/file": "1.0.5",
|
|
41
|
+
"@leafer/helper": "1.0.5",
|
|
42
|
+
"@leafer/layout": "1.0.5",
|
|
43
|
+
"@leafer/list": "1.0.5",
|
|
44
|
+
"@leafer/math": "1.0.5",
|
|
45
|
+
"@leafer/path": "1.0.5",
|
|
46
|
+
"@leafer/platform": "1.0.5",
|
|
47
|
+
"@leafer/task": "1.0.5"
|
|
48
48
|
}
|
|
49
49
|
}
|
package/src/index.ts
CHANGED