@leafer-draw/worker 1.0.4 → 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/dist/worker.cjs +32 -24
- package/dist/worker.esm.js +32 -24
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.js +69 -56
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.module.js +69 -56
- package/dist/worker.module.min.js +1 -1
- package/package.json +9 -9
package/dist/worker.js
CHANGED
|
@@ -4758,6 +4758,7 @@ var LeaferUI = (function (exports) {
|
|
|
4758
4758
|
}
|
|
4759
4759
|
}
|
|
4760
4760
|
RenderEvent.REQUEST = 'render.request';
|
|
4761
|
+
RenderEvent.CHILD_START = 'render.child_start';
|
|
4761
4762
|
RenderEvent.START = 'render.start';
|
|
4762
4763
|
RenderEvent.BEFORE = 'render.before';
|
|
4763
4764
|
RenderEvent.RENDER = 'render';
|
|
@@ -4933,7 +4934,7 @@ var LeaferUI = (function (exports) {
|
|
|
4933
4934
|
const debug$5 = Debug.get('setAttr');
|
|
4934
4935
|
const LeafDataProxy = {
|
|
4935
4936
|
__setAttr(name, newValue, checkFiniteNumber) {
|
|
4936
|
-
if (this.
|
|
4937
|
+
if (this.leaferIsCreated) {
|
|
4937
4938
|
const oldValue = this.__.__getInput(name);
|
|
4938
4939
|
if (checkFiniteNumber && !isFinite(newValue) && newValue !== undefined) {
|
|
4939
4940
|
debug$5.warn(this.innerName, name, newValue);
|
|
@@ -5005,7 +5006,7 @@ var LeaferUI = (function (exports) {
|
|
|
5005
5006
|
|
|
5006
5007
|
const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2 } = LeafHelper;
|
|
5007
5008
|
const { updateBounds: updateBounds$1 } = BranchHelper;
|
|
5008
|
-
const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$
|
|
5009
|
+
const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$4 } = BoundsHelper;
|
|
5009
5010
|
const { toBounds: toBounds$2 } = PathBounds;
|
|
5010
5011
|
const LeafBounds = {
|
|
5011
5012
|
__updateWorldBounds() {
|
|
@@ -5088,7 +5089,7 @@ var LeaferUI = (function (exports) {
|
|
|
5088
5089
|
const b = this.__layout.boxBounds;
|
|
5089
5090
|
const data = this.__;
|
|
5090
5091
|
if (data.__pathInputed) {
|
|
5091
|
-
toBounds$2(data.
|
|
5092
|
+
toBounds$2(data.path, b);
|
|
5092
5093
|
}
|
|
5093
5094
|
else {
|
|
5094
5095
|
b.x = 0;
|
|
@@ -5100,7 +5101,7 @@ var LeaferUI = (function (exports) {
|
|
|
5100
5101
|
__updateAutoLayout() {
|
|
5101
5102
|
this.__layout.matrixChanged = true;
|
|
5102
5103
|
if (this.isBranch) {
|
|
5103
|
-
if (this.
|
|
5104
|
+
if (this.leaferIsReady)
|
|
5104
5105
|
this.leafer.layouter.addExtra(this);
|
|
5105
5106
|
if (this.__.flow) {
|
|
5106
5107
|
if (this.__layout.boxChanged)
|
|
@@ -5126,11 +5127,11 @@ var LeaferUI = (function (exports) {
|
|
|
5126
5127
|
},
|
|
5127
5128
|
__updateStrokeBounds() {
|
|
5128
5129
|
const layout = this.__layout;
|
|
5129
|
-
copyAndSpread$
|
|
5130
|
+
copyAndSpread$1(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
|
|
5130
5131
|
},
|
|
5131
5132
|
__updateRenderBounds() {
|
|
5132
5133
|
const layout = this.__layout;
|
|
5133
|
-
layout.renderSpread > 0 ? copyAndSpread$
|
|
5134
|
+
layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$4(layout.renderBounds, layout.strokeBounds);
|
|
5134
5135
|
}
|
|
5135
5136
|
};
|
|
5136
5137
|
|
|
@@ -5235,6 +5236,8 @@ var LeaferUI = (function (exports) {
|
|
|
5235
5236
|
get innerName() { return this.__.name || this.tag + this.innerId; }
|
|
5236
5237
|
get __DataProcessor() { return LeafData; }
|
|
5237
5238
|
get __LayoutProcessor() { return LeafLayout; }
|
|
5239
|
+
get leaferIsCreated() { return this.leafer && this.leafer.created; }
|
|
5240
|
+
get leaferIsReady() { return this.leafer && this.leafer.ready; }
|
|
5238
5241
|
get isLeafer() { return false; }
|
|
5239
5242
|
get isBranch() { return false; }
|
|
5240
5243
|
get isBranchLeaf() { return false; }
|
|
@@ -5676,6 +5679,7 @@ var LeaferUI = (function (exports) {
|
|
|
5676
5679
|
add(child, index) {
|
|
5677
5680
|
if (child === this)
|
|
5678
5681
|
return;
|
|
5682
|
+
child.__ || (child = UICreator.get(child.tag, child));
|
|
5679
5683
|
if (child.parent)
|
|
5680
5684
|
child.parent.remove(child);
|
|
5681
5685
|
child.parent = this;
|
|
@@ -5698,10 +5702,14 @@ var LeaferUI = (function (exports) {
|
|
|
5698
5702
|
}
|
|
5699
5703
|
remove(child, destroy) {
|
|
5700
5704
|
if (child) {
|
|
5701
|
-
if (child.
|
|
5702
|
-
|
|
5705
|
+
if (child.__) {
|
|
5706
|
+
if (child.animationOut)
|
|
5707
|
+
child.__runAnimation('out', () => this.__remove(child, destroy));
|
|
5708
|
+
else
|
|
5709
|
+
this.__remove(child, destroy);
|
|
5710
|
+
}
|
|
5703
5711
|
else
|
|
5704
|
-
this.
|
|
5712
|
+
this.find(child).forEach(item => this.remove(item, destroy));
|
|
5705
5713
|
}
|
|
5706
5714
|
else if (child === undefined) {
|
|
5707
5715
|
super.remove(null, destroy);
|
|
@@ -5919,7 +5927,7 @@ var LeaferUI = (function (exports) {
|
|
|
5919
5927
|
}
|
|
5920
5928
|
}
|
|
5921
5929
|
|
|
5922
|
-
const version = "1.0.
|
|
5930
|
+
const version = "1.0.5";
|
|
5923
5931
|
|
|
5924
5932
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
5925
5933
|
get allowBackgroundColor() { return true; }
|
|
@@ -6388,6 +6396,7 @@ var LeaferUI = (function (exports) {
|
|
|
6388
6396
|
this.totalBounds = new Bounds();
|
|
6389
6397
|
debug$3.log(target.innerName, '--->');
|
|
6390
6398
|
try {
|
|
6399
|
+
target.app.emit(RenderEvent.CHILD_START, target);
|
|
6391
6400
|
this.emitRender(RenderEvent.START);
|
|
6392
6401
|
this.renderOnce(callback);
|
|
6393
6402
|
this.emitRender(RenderEvent.END, this.totalBounds);
|
|
@@ -7124,12 +7133,7 @@ var LeaferUI = (function (exports) {
|
|
|
7124
7133
|
this.__drawPathByData(canvas, this.__.path);
|
|
7125
7134
|
}
|
|
7126
7135
|
__drawPathByData(drawer, data) {
|
|
7127
|
-
|
|
7128
|
-
PathDrawer.drawPathByData(drawer, data);
|
|
7129
|
-
}
|
|
7130
|
-
else {
|
|
7131
|
-
this.__drawPathByBox(drawer);
|
|
7132
|
-
}
|
|
7136
|
+
data ? PathDrawer.drawPathByData(drawer, data) : this.__drawPathByBox(drawer);
|
|
7133
7137
|
}
|
|
7134
7138
|
__drawPathByBox(drawer) {
|
|
7135
7139
|
const { x, y, width, height } = this.__layout.boxBounds;
|
|
@@ -7137,9 +7141,8 @@ var LeaferUI = (function (exports) {
|
|
|
7137
7141
|
const { cornerRadius } = this.__;
|
|
7138
7142
|
drawer.roundRect(x, y, width, height, typeof cornerRadius === 'number' ? [cornerRadius] : cornerRadius);
|
|
7139
7143
|
}
|
|
7140
|
-
else
|
|
7144
|
+
else
|
|
7141
7145
|
drawer.rect(x, y, width, height);
|
|
7142
|
-
}
|
|
7143
7146
|
}
|
|
7144
7147
|
animate(_keyframe, _options, _type, _isTemp) {
|
|
7145
7148
|
return needPlugin('animate');
|
|
@@ -7822,10 +7825,9 @@ var LeaferUI = (function (exports) {
|
|
|
7822
7825
|
registerUI()
|
|
7823
7826
|
], exports.Rect);
|
|
7824
7827
|
|
|
7825
|
-
const
|
|
7826
|
-
const group = exports.Group.prototype;
|
|
7828
|
+
const { copy: copy$2, add, includes: includes$1 } = BoundsHelper;
|
|
7829
|
+
const rect = exports.Rect.prototype, group = exports.Group.prototype;
|
|
7827
7830
|
const childrenRenderBounds = {};
|
|
7828
|
-
const { copy: copy$2, add, includes: includes$1, copyAndSpread: copyAndSpread$1 } = BoundsHelper;
|
|
7829
7831
|
exports.Box = class Box extends exports.Group {
|
|
7830
7832
|
get __tag() { return 'Box'; }
|
|
7831
7833
|
get isBranchLeaf() { return true; }
|
|
@@ -7839,29 +7841,27 @@ var LeaferUI = (function (exports) {
|
|
|
7839
7841
|
return this.__updateRectRenderSpread() || -1;
|
|
7840
7842
|
}
|
|
7841
7843
|
__updateRectBoxBounds() { }
|
|
7842
|
-
__updateBoxBounds(
|
|
7844
|
+
__updateBoxBounds(_secondLayout) {
|
|
7843
7845
|
const data = this.__;
|
|
7844
7846
|
if (this.children.length) {
|
|
7845
7847
|
if (data.__autoSide) {
|
|
7846
|
-
if (this.leafer && this.leafer.ready)
|
|
7847
|
-
this.leafer.layouter.addExtra(this);
|
|
7848
7848
|
super.__updateBoxBounds();
|
|
7849
7849
|
const { boxBounds } = this.__layout;
|
|
7850
7850
|
if (!data.__autoSize) {
|
|
7851
|
-
if (data.__autoWidth)
|
|
7852
|
-
boxBounds.width += boxBounds.x, boxBounds.
|
|
7853
|
-
|
|
7854
|
-
|
|
7851
|
+
if (data.__autoWidth) {
|
|
7852
|
+
boxBounds.width += boxBounds.x, boxBounds.x = 0;
|
|
7853
|
+
boxBounds.height = data.height, boxBounds.y = 0;
|
|
7854
|
+
}
|
|
7855
|
+
else {
|
|
7856
|
+
boxBounds.height += boxBounds.y, boxBounds.y = 0;
|
|
7857
|
+
boxBounds.width = data.width, boxBounds.x = 0;
|
|
7858
|
+
}
|
|
7855
7859
|
}
|
|
7856
|
-
if (secondLayout && data.flow && data.padding)
|
|
7857
|
-
copyAndSpread$1(boxBounds, boxBounds, data.padding, false, data.__autoSize ? null : (data.__autoWidth ? 'width' : 'height'));
|
|
7858
7860
|
this.__updateNaturalSize();
|
|
7859
7861
|
}
|
|
7860
7862
|
else {
|
|
7861
7863
|
this.__updateRectBoxBounds();
|
|
7862
7864
|
}
|
|
7863
|
-
if (data.flow)
|
|
7864
|
-
this.__updateContentBounds();
|
|
7865
7865
|
}
|
|
7866
7866
|
else {
|
|
7867
7867
|
this.__updateRectBoxBounds();
|
|
@@ -7927,6 +7927,9 @@ var LeaferUI = (function (exports) {
|
|
|
7927
7927
|
__decorate([
|
|
7928
7928
|
dataType(false)
|
|
7929
7929
|
], exports.Box.prototype, "resizeChildren", void 0);
|
|
7930
|
+
__decorate([
|
|
7931
|
+
dataType(false)
|
|
7932
|
+
], exports.Box.prototype, "textBox", void 0);
|
|
7930
7933
|
__decorate([
|
|
7931
7934
|
affectRenderBoundsType('show')
|
|
7932
7935
|
], exports.Box.prototype, "overflow", void 0);
|
|
@@ -8456,6 +8459,9 @@ var LeaferUI = (function (exports) {
|
|
|
8456
8459
|
__decorate([
|
|
8457
8460
|
boundsType('top')
|
|
8458
8461
|
], exports.Text.prototype, "verticalAlign", void 0);
|
|
8462
|
+
__decorate([
|
|
8463
|
+
boundsType(true)
|
|
8464
|
+
], exports.Text.prototype, "autoSizeAlign", void 0);
|
|
8459
8465
|
__decorate([
|
|
8460
8466
|
boundsType('normal')
|
|
8461
8467
|
], exports.Text.prototype, "textWrap", void 0);
|
|
@@ -8997,9 +9003,10 @@ var LeaferUI = (function (exports) {
|
|
|
8997
9003
|
onLoadError(ui, event, image.error);
|
|
8998
9004
|
}
|
|
8999
9005
|
else {
|
|
9000
|
-
|
|
9001
|
-
|
|
9006
|
+
if (firstUse) {
|
|
9007
|
+
ignoreRender(ui, true);
|
|
9002
9008
|
onLoad(ui, event);
|
|
9009
|
+
}
|
|
9003
9010
|
leafPaint.loadId = image.load(() => {
|
|
9004
9011
|
ignoreRender(ui, false);
|
|
9005
9012
|
if (!ui.destroyed) {
|
|
@@ -9611,11 +9618,12 @@ var LeaferUI = (function (exports) {
|
|
|
9611
9618
|
const { Letter, Single, Before, After, Symbol, Break } = CharType;
|
|
9612
9619
|
let word, row, wordWidth, rowWidth, realWidth;
|
|
9613
9620
|
let char, charWidth, startCharSize, charSize, charType, lastCharType, langBreak, afterBreak, paraStart;
|
|
9614
|
-
let textDrawData, rows = [], bounds;
|
|
9621
|
+
let textDrawData, rows = [], bounds, findMaxWidth;
|
|
9615
9622
|
function createRows(drawData, content, style) {
|
|
9616
9623
|
textDrawData = drawData;
|
|
9617
9624
|
rows = drawData.rows;
|
|
9618
9625
|
bounds = drawData.bounds;
|
|
9626
|
+
findMaxWidth = !bounds.width && !style.autoSizeAlign;
|
|
9619
9627
|
const { __letterSpacing, paraIndent, textCase } = style;
|
|
9620
9628
|
const { canvas } = Platform;
|
|
9621
9629
|
const { width, height } = bounds;
|
|
@@ -9700,7 +9708,10 @@ var LeaferUI = (function (exports) {
|
|
|
9700
9708
|
else {
|
|
9701
9709
|
content.split('\n').forEach(content => {
|
|
9702
9710
|
textDrawData.paraNumber++;
|
|
9703
|
-
|
|
9711
|
+
rowWidth = canvas.measureText(content).width;
|
|
9712
|
+
rows.push({ x: paraIndent || 0, text: content, width: rowWidth, paraStart: true });
|
|
9713
|
+
if (findMaxWidth)
|
|
9714
|
+
setMaxWidth();
|
|
9704
9715
|
});
|
|
9705
9716
|
}
|
|
9706
9717
|
}
|
|
@@ -9731,10 +9742,16 @@ var LeaferUI = (function (exports) {
|
|
|
9731
9742
|
row.width = rowWidth;
|
|
9732
9743
|
if (bounds.width)
|
|
9733
9744
|
trimRight(row);
|
|
9745
|
+
else if (findMaxWidth)
|
|
9746
|
+
setMaxWidth();
|
|
9734
9747
|
rows.push(row);
|
|
9735
9748
|
row = { words: [] };
|
|
9736
9749
|
rowWidth = 0;
|
|
9737
9750
|
}
|
|
9751
|
+
function setMaxWidth() {
|
|
9752
|
+
if (rowWidth > (textDrawData.maxWidth || 0))
|
|
9753
|
+
textDrawData.maxWidth = rowWidth;
|
|
9754
|
+
}
|
|
9738
9755
|
|
|
9739
9756
|
const CharMode = 0;
|
|
9740
9757
|
const WordMode = 1;
|
|
@@ -9806,34 +9823,32 @@ var LeaferUI = (function (exports) {
|
|
|
9806
9823
|
|
|
9807
9824
|
function layoutText(drawData, style) {
|
|
9808
9825
|
const { rows, bounds } = drawData;
|
|
9809
|
-
const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing } = style;
|
|
9826
|
+
const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing, autoSizeAlign } = style;
|
|
9810
9827
|
let { x, y, width, height } = bounds, realHeight = __lineHeight * rows.length + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
|
|
9811
9828
|
let starY = __baseLine;
|
|
9812
9829
|
if (__clipText && realHeight > height) {
|
|
9813
9830
|
realHeight = Math.max(height, __lineHeight);
|
|
9814
9831
|
drawData.overflow = rows.length;
|
|
9815
9832
|
}
|
|
9816
|
-
else {
|
|
9833
|
+
else if (height || autoSizeAlign) {
|
|
9817
9834
|
switch (verticalAlign) {
|
|
9818
9835
|
case 'middle':
|
|
9819
9836
|
y += (height - realHeight) / 2;
|
|
9820
9837
|
break;
|
|
9821
|
-
case 'bottom':
|
|
9822
|
-
y += (height - realHeight);
|
|
9838
|
+
case 'bottom': y += (height - realHeight);
|
|
9823
9839
|
}
|
|
9824
9840
|
}
|
|
9825
9841
|
starY += y;
|
|
9826
|
-
let row, rowX, rowWidth;
|
|
9842
|
+
let row, rowX, rowWidth, layoutWidth = (width || autoSizeAlign) ? width : drawData.maxWidth;
|
|
9827
9843
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
9828
9844
|
row = rows[i];
|
|
9829
9845
|
row.x = x;
|
|
9830
9846
|
if (row.width < width || (row.width > width && !__clipText)) {
|
|
9831
9847
|
switch (textAlign) {
|
|
9832
9848
|
case 'center':
|
|
9833
|
-
row.x += (
|
|
9849
|
+
row.x += (layoutWidth - row.width) / 2;
|
|
9834
9850
|
break;
|
|
9835
|
-
case 'right':
|
|
9836
|
-
row.x += width - row.width;
|
|
9851
|
+
case 'right': row.x += layoutWidth - row.width;
|
|
9837
9852
|
}
|
|
9838
9853
|
}
|
|
9839
9854
|
if (row.paraStart && paraSpacing && i > 0)
|
|
@@ -9938,14 +9953,14 @@ var LeaferUI = (function (exports) {
|
|
|
9938
9953
|
let height = style.__getInput('height') || 0;
|
|
9939
9954
|
const { textDecoration, __font, __padding: padding } = style;
|
|
9940
9955
|
if (padding) {
|
|
9941
|
-
if (width)
|
|
9956
|
+
if (width)
|
|
9957
|
+
x = padding[left], width -= (padding[right] + padding[left]);
|
|
9958
|
+
else if (!style.autoSizeAlign)
|
|
9942
9959
|
x = padding[left];
|
|
9943
|
-
|
|
9944
|
-
|
|
9945
|
-
if (
|
|
9960
|
+
if (height)
|
|
9961
|
+
y = padding[top], height -= (padding[top] + padding[bottom]);
|
|
9962
|
+
else if (!style.autoSizeAlign)
|
|
9946
9963
|
y = padding[top];
|
|
9947
|
-
height -= (padding[top] + padding[bottom]);
|
|
9948
|
-
}
|
|
9949
9964
|
}
|
|
9950
9965
|
const drawData = {
|
|
9951
9966
|
bounds: { x, y, width, height },
|
|
@@ -9965,22 +9980,20 @@ var LeaferUI = (function (exports) {
|
|
|
9965
9980
|
return drawData;
|
|
9966
9981
|
}
|
|
9967
9982
|
function padAutoText(padding, drawData, style, width, height) {
|
|
9968
|
-
if (!width) {
|
|
9983
|
+
if (!width && style.autoSizeAlign) {
|
|
9969
9984
|
switch (style.textAlign) {
|
|
9970
9985
|
case 'left':
|
|
9971
9986
|
offsetText(drawData, 'x', padding[left]);
|
|
9972
9987
|
break;
|
|
9973
|
-
case 'right':
|
|
9974
|
-
offsetText(drawData, 'x', -padding[right]);
|
|
9988
|
+
case 'right': offsetText(drawData, 'x', -padding[right]);
|
|
9975
9989
|
}
|
|
9976
9990
|
}
|
|
9977
|
-
if (!height) {
|
|
9991
|
+
if (!height && style.autoSizeAlign) {
|
|
9978
9992
|
switch (style.verticalAlign) {
|
|
9979
9993
|
case 'top':
|
|
9980
9994
|
offsetText(drawData, 'y', padding[top]);
|
|
9981
9995
|
break;
|
|
9982
|
-
case 'bottom':
|
|
9983
|
-
offsetText(drawData, 'y', -padding[bottom]);
|
|
9996
|
+
case 'bottom': offsetText(drawData, 'y', -padding[bottom]);
|
|
9984
9997
|
}
|
|
9985
9998
|
}
|
|
9986
9999
|
}
|
package/dist/worker.min.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=require("@leafer/core"),e=require("@leafer-ui/draw");class n extends t.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=t.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:n}=this;this.view.width=Math.ceil(t*n),this.view.height=Math.ceil(e*n),this.clientBounds=this.bounds}}t.canvasPatch(OffscreenCanvasRenderingContext2D.prototype),t.canvasPatch(Path2D.prototype);const{mineType:i}=t.FileHelper;function a(e,n){t.Platform.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,n)=>new Promise(((a,o)=>{t.convertToBlob({type:i(e),quality:n}).then((t=>{var e=new FileReader;e.onload=t=>a(t.target.result),e.onerror=t=>o(t),e.readAsDataURL(t)})).catch((t=>{o(t)}))})),canvasToBolb:(t,e,n)=>t.convertToBlob({type:i(e),quality:n}),canvasSaveAs:(t,e,n)=>new Promise((t=>t())),download(t,e){},loadImage:e=>new Promise(((n,i)=>{let a=new XMLHttpRequest;a.open("GET",t.Platform.image.getRealURL(e),!0),a.responseType="blob",a.onload=()=>{createImageBitmap(a.response).then((t=>{n(t)})).catch((t=>{i(t)}))},a.onerror=t=>i(t),a.send()}))},t.Platform.canvas=t.Creator.canvas(),t.Platform.conicGradientSupport=!!t.Platform.canvas.context.createConicGradient}Object.assign(t.Creator,{canvas:(t,e)=>new n(t,e),image:e=>new t.LeaferImage(e)}),t.Platform.name="web",t.Platform.isWorker=!0,t.Platform.requestRender=function(t){requestAnimationFrame(t)},t.defineKey(t.Platform,"devicePixelRatio",{get:()=>1});const{userAgent:o}=navigator;o.indexOf("Firefox")>-1?(t.Platform.conicGradientRotate90=!0,t.Platform.intWheelDeltaY=!0):o.indexOf("Safari")>-1&&-1===o.indexOf("Chrome")&&(t.Platform.fullImageShadow=!0),o.indexOf("Windows")>-1?(t.Platform.os="Windows",t.Platform.intWheelDeltaY=!0):o.indexOf("Mac")>-1?t.Platform.os="Mac":o.indexOf("Linux")>-1&&(t.Platform.os="Linux");class s{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t.LeafList;return this.__updatedList.list.forEach((t=>{t.leafer&&e.add(t)})),e}return this.__updatedList}constructor(e,n){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(t.RenderEvent.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(e){e.type===t.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(e.child)):(this.hasRemove=!0,this.__updatedList.add(e.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,n=e.length;t<n;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new t.WatchEvent(t.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new t.LeafList,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.PropertyEvent.CHANGE,this.__onAttrChange,this),e.on_([t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this),e.on_(t.WatchEvent.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllMatrix:r,updateBounds:l,updateAllWorldOpacity:d}=t.LeafHelper,{pushAllChildBranch:c,pushAllParent:h}=t.BranchHelper;const{worldBounds:u}=t.LeafBoundsHelper,f={x:0,y:0,width:1e5,height:1e5};class p{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,e instanceof Array&&(e=new t.LeafList(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,u)}setAfter(){const{list:t}=this.updatedList;t.some((t=>t.noBounds))?this.afterBounds.set(f):this.afterBounds.setListWithFn(t,u),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:g,updateAllChange:_}=t.LeafHelper,w=t.Debug.get("Layouter");class m{constructor(e,n){this.totalTimes=0,this.config={},this.__levelList=new t.LeafLevelList,this.target=e,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:e}=this;this.times=0;try{e.emit(t.LayoutEvent.START),this.layoutOnce(),e.emitEvent(new t.LayoutEvent(t.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){w.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?w.warn("layouting"):this.times>3?w.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(t.WatchEvent.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var e;if(!(null===(e=this.__updatedList)||void 0===e?void 0:e.length))return;const n=t.Run.start("PartLayout"),{target:i,__updatedList:a}=this,{BEFORE:o,LAYOUT:s,AFTER:u}=t.LayoutEvent,f=this.getBlocks(a);f.forEach((t=>t.setBefore())),i.emitEvent(new t.LayoutEvent(o,f,this.times)),this.extraBlock=null,a.sort(),function(t,e){let n;t.list.forEach((t=>{n=t.__layout,e.without(t)&&!n.proxyZoom&&(n.matrixChanged?(r(t,!0),e.add(t),t.isBranch&&c(t,e),h(t,e)):n.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),h(t,e)))}))}(a,this.__levelList),function(t){let e,n,i;t.sort(!0),t.levels.forEach((a=>{e=t.levelMap[a];for(let t=0,a=e.length;t<a;t++){if(n=e[t],n.isBranch&&n.__tempNumber){i=n.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||l(i[t])}l(n)}}))}(this.__levelList),function(t){let e;t.list.forEach((t=>{e=t.__layout,e.opacityChanged&&d(t),e.stateStyleChanged&&setTimeout((()=>e.stateStyleChanged&&t.updateState())),t.__updateChange()}))}(a),this.extraBlock&&f.push(this.extraBlock),f.forEach((t=>t.setAfter())),i.emitEvent(new t.LayoutEvent(s,f,this.times)),i.emitEvent(new t.LayoutEvent(u,f,this.times)),this.addBlocks(f),this.__levelList.reset(),this.__updatedList=null,t.Run.end(n)}fullLayout(){const e=t.Run.start("FullLayout"),{target:n}=this,{BEFORE:i,LAYOUT:a,AFTER:o}=t.LayoutEvent,s=this.getBlocks(new t.LeafList(n));n.emitEvent(new t.LayoutEvent(i,s,this.times)),m.fullLayout(n),s.forEach((t=>{t.setAfter()})),n.emitEvent(new t.LayoutEvent(a,s,this.times)),n.emitEvent(new t.LayoutEvent(o,s,this.times)),this.addBlocks(s),t.Run.end(e)}static fullLayout(e){g(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),_(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:n}=this.extraBlock||(this.extraBlock=new p([]));e.length?n.add(t.__world):n.set(t.__world),e.add(t)}}createBlock(t){return new p(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.LayoutEvent.REQUEST,this.layout,this),e.on_(t.LayoutEvent.AGAIN,this.layoutAgain,this),e.on_(t.WatchEvent.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const y=t.Debug.get("Renderer");class v{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,n,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=e,this.canvas=n,i&&(this.config=t.DataHelper.default(i,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}render(e){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:n}=this;this.times=0,this.totalBounds=new t.Bounds,y.log(n.innerName,"---\x3e");try{this.emitRender(t.RenderEvent.START),this.renderOnce(e),this.emitRender(t.RenderEvent.END,this.totalBounds),t.ImageManager.clearRecycled()}catch(t){this.rendering=!1,y.error(t)}y.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){if(this.rendering)return y.warn("rendering");if(this.times>3)return y.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new t.Bounds,this.renderOptions={},e)this.emitRender(t.RenderEvent.BEFORE),e();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(t.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(t.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(t.RenderEvent.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return y.warn("PartRender: need update attr");this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(e){const n=t.Run.start("PartRender"),{canvas:i}=this,a=e.getIntersect(i.bounds),o=e.includes(this.target.__world),s=new t.Bounds(a);i.save(),o&&!t.Debug.showRepaint?i.clear():(a.spread(10+1/this.canvas.pixelRatio).ceil(),i.clearWorld(a,!0),i.clipWorld(a,!0)),this.__render(a,o,s),i.restore(),t.Run.end(n)}fullRender(){const e=t.Run.start("FullRender"),{canvas:n}=this;n.save(),n.clear(),this.__render(n.bounds,!0),n.restore(),t.Run.end(e)}__render(e,n,i){const a=e.includes(this.target.__world)?{includes:n}:{bounds:e,includes:n};this.needFill&&this.canvas.fillWorld(e,this.config.fill),t.Debug.showRepaint&&this.canvas.strokeWorld(e,"red"),this.target.__render(this.canvas,a),this.renderBounds=i=i||e,this.renderOptions=a,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),t.Debug.showHitView&&this.renderHitView(a),t.Debug.showBoundsView&&this.renderBoundsView(a),this.canvas.updateRender(i)}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const n=new t.Bounds;n.setList(e),e.length=0,e.push(n)}}__requestRender(){const e=Date.now();t.Platform.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-e))),this.running&&(this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)),this.target&&this.__requestRender()}))}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:n,height:i}=e.old;if(!new t.Bounds(0,0,n,i).includes(this.target.__world)||this.needFill||!e.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new t.Bounds(0,0,1,1)),this.changed=!0}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||y.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(e,n,i){this.target.emitEvent(new t.RenderEvent(e,this.times,n,i))}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.RenderEvent.REQUEST,this.update,this),e.on_(t.LayoutEvent.END,this.__onLayoutEnd,this),e.on_(t.RenderEvent.AGAIN,this.renderAgain,this),e.on_(t.ResizeEvent.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}function x(t,e){let n;const{rows:i,decorationY:a,decorationHeight:o}=t.__.__textDrawData;for(let t=0,s=i.length;t<s;t++)n=i[t],n.text?e.fillText(n.text,n.x,n.y):n.data&&n.data.forEach((t=>{e.fillText(t.char,t.x,n.y)})),a&&e.fillRect(n.x,n.y+a,n.width,o)}function b(t,e,n){const{strokeAlign:i}=e.__,a="string"!=typeof t;switch(i){case"center":n.setStroke(a?void 0:t,e.__.strokeWidth,e.__),a?R(t,!0,e,n):E(e,n);break;case"inside":B("inside",t,a,e,n);break;case"outside":B("outside",t,a,e,n)}}function B(t,e,n,i,a){const{__strokeWidth:o,__font:s}=i.__,r=a.getSameCanvas(!0,!0);r.setStroke(n?void 0:e,2*o,i.__),r.font=s,n?R(e,!0,i,r):E(i,r),r.blendMode="outside"===t?"destination-out":"destination-in",x(i,r),r.blendMode="normal",i.__worldFlipped?a.copyWorldByReset(r,i.__nowWorld):a.copyWorldToInner(r,i.__nowWorld,i.__layout.renderBounds),r.recycle(i.__nowWorld)}function E(t,e){let n;const{rows:i,decorationY:a,decorationHeight:o}=t.__.__textDrawData;for(let t=0,s=i.length;t<s;t++)n=i[t],n.text?e.strokeText(n.text,n.x,n.y):n.data&&n.data.forEach((t=>{e.strokeText(t.char,t.x,n.y)})),a&&e.strokeRect(n.x,n.y+a,n.width,o)}function R(t,n,i,a){let o;for(let s=0,r=t.length;s<r;s++)o=t[s],o.image&&e.PaintImage.checkImage(i,a,o,!1)||o.style&&(a.strokeStyle=o.style,o.blendMode?(a.saveBlendMode(o.blendMode),n?E(i,a):a.stroke(),a.restoreBlendMode()):n?E(i,a):a.stroke())}Object.assign(t.Creator,{watcher:(t,e)=>new s(t,e),layouter:(t,e)=>new m(t,e),renderer:(t,e,n)=>new v(t,e,n),selector:(t,e)=>{},interaction:(t,e,n,i)=>{}}),t.Platform.layout=m.fullLayout;const{getSpread:L,getOuterOf:k,getByMove:P,getIntersectData:S}=t.BoundsHelper;let C;function O(t,n,i){if("object"!=typeof n||!1===n.visible||0===n.opacity)return;const{boxBounds:a}=i.__layout;switch(n.type){case"solid":let{type:o,blendMode:s,color:r,opacity:l}=n;return{type:o,blendMode:s,style:e.ColorConvert.string(r,l)};case"image":return e.PaintImage.image(i,t,n,a,!C||!C[n.url]);case"linear":return e.PaintGradient.linearGradient(n,a);case"radial":return e.PaintGradient.radialGradient(n,a);case"angular":return e.PaintGradient.conicGradient(n,a);default:return void 0!==n.r?{type:"solid",style:e.ColorConvert.string(n)}:void 0}}const W={compute:function(t,n){const i=n.__,a=[];let o,s=i.__input[t];s instanceof Array||(s=[s]),C=e.PaintImage.recycleImage(t,i);for(let e,i=0,o=s.length;i<o;i++)e=O(t,s[i],n),e&&a.push(e);i["_"+t]=a.length?a:void 0,a.length&&a[0].image&&(o=a[0].image.hasOpacityPixel),"fill"===t?i.__pixelFill=o:i.__pixelStroke=o},fill:function(t,e,n){n.fillStyle=t,e.__.__font?x(e,n):e.__.windingRule?n.fill(e.__.windingRule):n.fill()},fills:function(t,n,i){let a;const{windingRule:o,__font:s}=n.__;for(let r=0,l=t.length;r<l;r++)a=t[r],a.image&&e.PaintImage.checkImage(n,i,a,!s)||a.style&&(i.fillStyle=a.style,a.transform?(i.save(),i.transform(a.transform),a.blendMode&&(i.blendMode=a.blendMode),s?x(n,i):o?i.fill(o):i.fill(),i.restore()):a.blendMode?(i.saveBlendMode(a.blendMode),s?x(n,i):o?i.fill(o):i.fill(),i.restoreBlendMode()):s?x(n,i):o?i.fill(o):i.fill())},fillText:x,stroke:function(t,e,n){const i=e.__,{__strokeWidth:a,strokeAlign:o,__font:s}=i;if(a)if(s)b(t,e,n);else switch(o){case"center":n.setStroke(t,a,i),n.stroke();break;case"inside":n.save(),n.setStroke(t,2*a,i),i.windingRule?n.clip(i.windingRule):n.clip(),n.stroke(),n.restore();break;case"outside":const o=n.getSameCanvas(!0,!0);o.setStroke(t,2*a,i),e.__drawRenderPath(o),o.stroke(),i.windingRule?o.clip(i.windingRule):o.clip(),o.clearWorld(e.__layout.renderBounds),e.__worldFlipped?n.copyWorldByReset(o,e.__nowWorld):n.copyWorldToInner(o,e.__nowWorld,e.__layout.renderBounds),o.recycle(e.__nowWorld)}},strokes:function(t,e,n){const i=e.__,{__strokeWidth:a,strokeAlign:o,__font:s}=i;if(a)if(s)b(t,e,n);else switch(o){case"center":n.setStroke(void 0,a,i),R(t,!1,e,n);break;case"inside":n.save(),n.setStroke(void 0,2*a,i),i.windingRule?n.clip(i.windingRule):n.clip(),R(t,!1,e,n),n.restore();break;case"outside":const{renderBounds:o}=e.__layout,s=n.getSameCanvas(!0,!0);e.__drawRenderPath(s),s.setStroke(void 0,2*a,i),R(t,!1,e,s),i.windingRule?s.clip(i.windingRule):s.clip(),s.clearWorld(o),e.__worldFlipped?n.copyWorldByReset(s,e.__nowWorld):n.copyWorldToInner(s,e.__nowWorld,o),s.recycle(e.__nowWorld)}},strokeText:b,drawTextStroke:E,shape:function(t,e,n){const i=e.getSameCanvas(),a=t.__nowWorld;let o,s,r,l,{scaleX:d,scaleY:c}=a;if(d<0&&(d=-d),c<0&&(c=-c),e.bounds.includes(a))l=i,o=r=a;else{const{renderShapeSpread:i}=t.__layout,h=S(i?L(e.bounds,d===c?i*d:[i*c,i*d]):e.bounds,a);s=e.bounds.getFitMatrix(h);let{a:u,d:f}=s;if(s.a<1&&(l=e.getSameCanvas(),t.__renderShape(l,n),d*=u,c*=f),r=k(a,s),o=P(r,-s.e,-s.f),n.matrix){const{matrix:t}=n;s.multiply(t),u*=t.scaleX,f*=t.scaleY}n=Object.assign(Object.assign({},n),{matrix:s.withScale(u,f)})}return t.__renderShape(i,n),{canvas:i,matrix:s,bounds:o,worldCanvas:l,shapeBounds:r,scaleX:d,scaleY:c}}};let A={};const{get:M,rotateOfOuter:T,translate:I,scaleOfOuter:D,scale:H,rotate:F}=t.MatrixHelper;function Y(t,e,n,i,a,o,s){const r=M();I(r,e.x+n,e.y+i),H(r,a,o),s&&T(r,{x:e.x+e.width/2,y:e.y+e.height/2},s),t.transform=r}function G(t,e,n,i,a,o,s){const r=M();I(r,e.x+n,e.y+i),a&&H(r,a,o),s&&F(r,s),t.transform=r}function j(t,e,n,i,a,o,s,r,l,d){const c=M();if(l)if("center"===d)T(c,{x:n/2,y:i/2},l);else switch(F(c,l),l){case 90:I(c,i,0);break;case 180:I(c,n,i);break;case 270:I(c,0,n)}A.x=e.x+a,A.y=e.y+o,I(c,A.x,A.y),s&&D(c,A,s,r),t.transform=c}const{get:X,translate:U}=t.MatrixHelper,N=new t.Bounds,q={},V={};function z(t,e,n,i){const{blendMode:a,sync:o}=n;a&&(t.blendMode=a),o&&(t.sync=o),t.data=Q(n,i,e)}function Q(e,n,i){let{width:a,height:o}=i;e.padding&&(n=N.set(n).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");const{opacity:s,mode:r,align:l,offset:d,scale:c,size:h,rotation:u,repeat:f}=e,p=n.width===a&&n.height===o,g={mode:r},_="center"!==l&&(u||0)%180==90,w=_?o:a,m=_?a:o;let y,v,x=0,b=0;if(r&&"cover"!==r&&"fit"!==r)(c||h)&&(t.MathHelper.getScaleData(c,h,i,V),y=V.scaleX,v=V.scaleY);else if(!p||u){const t=n.width/w,e=n.height/m;y=v="fit"===r?Math.min(t,e):Math.max(t,e),x+=(n.width-a*y)/2,b+=(n.height-o*v)/2}if(l){const e={x:x,y:b,width:w,height:m};y&&(e.width*=y,e.height*=v),t.AlignHelper.toPoint(l,e,n,q,!0),x+=q.x,b+=q.y}switch(d&&(x+=d.x,b+=d.y),r){case"stretch":p||(a=n.width,o=n.height);break;case"normal":case"clip":(x||b||y||u)&&G(g,n,x,b,y,v,u);break;case"repeat":(!p||y||u)&&j(g,n,a,o,x,b,y,v,u,l),f||(g.repeat="repeat");break;default:y&&Y(g,n,x,b,y,v,u)}return g.transform||(n.x||n.y)&&(g.transform=X(),U(g.transform,n.x,n.y)),y&&"stretch"!==r&&(g.scaleX=y,g.scaleY=v),g.width=a,g.height=o,s&&(g.opacity=s),f&&(g.repeat="string"==typeof f?"x"===f?"repeat-x":"repeat-y":"repeat"),g}let J,Z=new t.Bounds;const{isSame:K}=t.BoundsHelper;function $(t,e,n,i,a,o){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return a.data||z(a,i,n,o),!0}function tt(e,n){it(e,t.ImageEvent.LOAD,n)}function et(e,n){it(e,t.ImageEvent.LOADED,n)}function nt(e,n,i){n.error=i,e.forceUpdate("surface"),it(e,t.ImageEvent.ERROR,n)}function it(e,n,i){e.hasEvent(n)&&e.emitEvent(new t.ImageEvent(n,i))}function at(t,e){const{leafer:n}=t;n&&n.viewReady&&(n.renderer.ignore=e)}const{get:ot,scale:st,copy:rt}=t.MatrixHelper,{ceil:lt,abs:dt}=Math;function ct(e,n,i){let{scaleX:a,scaleY:o}=t.ImageManager.patternLocked?e.__world:e.__nowWorld;const s=a+"-"+o+"-"+i;if(n.patternId===s||e.destroyed)return!1;{a=dt(a),o=dt(o);const{image:e,data:r}=n;let l,d,{width:c,height:h,scaleX:u,scaleY:f,opacity:p,transform:g,repeat:_}=r;u&&(d=ot(),rt(d,g),st(d,1/u,1/f),a*=u,o*=f),a*=i,o*=i,c*=a,h*=o;const w=c*h;if(!_&&w>t.Platform.image.maxCacheSize)return!1;let m=t.Platform.image.maxPatternSize;if(!e.isSVG){const t=e.width*e.height;m>t&&(m=t)}w>m&&(l=Math.sqrt(w/m)),l&&(a/=l,o/=l,c/=l,h/=l),u&&(a/=u,o/=f),(g||1!==a||1!==o)&&(d||(d=ot(),g&&rt(d,g)),st(d,1/a,1/o));const y=e.getCanvas(lt(c)||1,lt(h)||1,p),v=e.getPattern(y,_||t.Platform.origin.noRepeat||"no-repeat",d,n);return n.style=v,n.patternId=s,!0}}function ht(t,e,n,i){return new(n||(n=Promise))((function(a,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function r(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?a(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,r)}l((i=i.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const{abs:ut}=Math;const ft={image:function(e,n,i,a,o){let s,r;const l=t.ImageManager.get(i);return J&&i===J.paint&&K(a,J.boxBounds)?s=J.leafPaint:(s={type:i.type,image:l},J=l.use>1?{leafPaint:s,paint:i,boxBounds:Z.set(a)}:null),(o||l.loading)&&(r={image:l,attrName:n,attrValue:i}),l.ready?($(e,n,i,l,s,a),o&&(tt(e,r),et(e,r))):l.error?o&&nt(e,r,l.error):(at(e,!0),o&&tt(e,r),s.loadId=l.load((()=>{at(e,!1),e.destroyed||($(e,n,i,l,s,a)&&(l.hasOpacityPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),et(e,r)),s.loadId=null}),(t=>{at(e,!1),nt(e,r,t),s.loadId=null}))),s},checkImage:function(n,i,a,o){const{scaleX:s,scaleY:r}=t.ImageManager.patternLocked?n.__world:n.__nowWorld,{pixelRatio:l}=i;if(!a.data||a.patternId===s+"-"+r+"-"+l&&!e.Export.running)return!1;{const{data:d}=a;if(o)if(d.repeat)o=!1;else{let{width:n,height:i}=d;n*=ut(s)*l,i*=ut(r)*l,d.scaleX&&(n*=d.scaleX,i*=d.scaleY),o=n*i>t.Platform.image.maxCacheSize||e.Export.running}return o?(i.save(),i.clip(),a.blendMode&&(i.blendMode=a.blendMode),d.opacity&&(i.opacity*=d.opacity),d.transform&&i.transform(d.transform),i.drawImage(a.image.view,0,0,d.width,d.height),i.restore(),!0):(!a.style||a.sync||e.Export.running?ct(n,a,l):a.patternTask||(a.patternTask=t.ImageManager.patternTasker.add((()=>ht(this,void 0,void 0,(function*(){a.patternTask=null,i.bounds.hit(n.__nowWorld)&&ct(n,a,l),n.forceUpdate("surface")}))),300)),!1)}},createPattern:ct,recycleImage:function(e,n){const i=n["_"+e];if(i instanceof Array){let a,o,s,r;for(let l=0,d=i.length;l<d;l++)a=i[l].image,r=a&&a.url,r&&(o||(o={}),o[r]=!0,t.ImageManager.recycle(a),a.loading&&(s||(s=n.__input&&n.__input[e]||[],s instanceof Array||(s=[s])),a.unload(i[l].loadId,!s.some((t=>t.url===r)))));return o}return null},createData:z,getPatternData:Q,fillOrFitMode:Y,clipMode:G,repeatMode:j},{toPoint:pt}=t.AroundHelper,gt={},_t={};function wt(t,n,i){if(n){let a;for(let o=0,s=n.length;o<s;o++)a=n[o],"string"==typeof a?t.addColorStop(o/(s-1),e.ColorConvert.string(a,i)):t.addColorStop(a.offset,e.ColorConvert.string(a.color,i))}}const{getAngle:mt,getDistance:yt}=t.PointHelper,{get:vt,rotateOfOuter:xt,scaleOfOuter:bt}=t.MatrixHelper,{toPoint:Bt}=t.AroundHelper,Et={},Rt={};function Lt(t,e,n,i,a){let o;const{width:s,height:r}=t;if(s!==r||i){const t=mt(e,n);o=vt(),a?(bt(o,e,s/r*(i||1),1),xt(o,e,t+90)):(bt(o,e,1,s/r*(i||1)),xt(o,e,t))}return o}const{getDistance:kt}=t.PointHelper,{toPoint:Pt}=t.AroundHelper,St={},Ct={};const Ot={linearGradient:function(e,n){let{from:i,to:a,type:o,blendMode:s,opacity:r}=e;pt(i||"top",n,gt),pt(a||"bottom",n,_t);const l=t.Platform.canvas.createLinearGradient(gt.x,gt.y,_t.x,_t.y);wt(l,e.stops,r);const d={type:o,style:l};return s&&(d.blendMode=s),d},radialGradient:function(e,n){let{from:i,to:a,type:o,opacity:s,blendMode:r,stretch:l}=e;Bt(i||"center",n,Et),Bt(a||"bottom",n,Rt);const d=t.Platform.canvas.createRadialGradient(Et.x,Et.y,0,Et.x,Et.y,yt(Et,Rt));wt(d,e.stops,s);const c={type:o,style:d},h=Lt(n,Et,Rt,l,!0);return h&&(c.transform=h),r&&(c.blendMode=r),c},conicGradient:function(e,n){let{from:i,to:a,type:o,opacity:s,blendMode:r,stretch:l}=e;Pt(i||"center",n,St),Pt(a||"bottom",n,Ct);const d=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,St.x,St.y):t.Platform.canvas.createRadialGradient(St.x,St.y,0,St.x,St.y,kt(St,Ct));wt(d,e.stops,s);const c={type:o,style:d},h=Lt(n,St,Ct,l||1,t.Platform.conicGradientRotate90);return h&&(c.transform=h),r&&(c.blendMode=r),c},getTransform:Lt},{copy:Wt,toOffsetOutBounds:At}=t.BoundsHelper,Mt={},Tt={};function It(e,n,i,a){const{bounds:o,shapeBounds:s}=a;if(t.Platform.fullImageShadow){if(Wt(Mt,e.bounds),Mt.x+=n.x-s.x,Mt.y+=n.y-s.y,i){const{matrix:t}=a;Mt.x-=(o.x+(t?t.e:0)+o.width/2)*(i-1),Mt.y-=(o.y+(t?t.f:0)+o.height/2)*(i-1),Mt.width*=i,Mt.height*=i}e.copyWorld(a.canvas,e.bounds,Mt)}else i&&(Wt(Mt,n),Mt.x-=n.width/2*(i-1),Mt.y-=n.height/2*(i-1),Mt.width*=i,Mt.height*=i),e.copyWorld(a.canvas,s,i?Mt:n)}const{toOffsetOutBounds:Dt}=t.BoundsHelper,Ht={};const Ft={shadow:function(t,e,n){let i,a;const{__nowWorld:o,__layout:s}=t,{shadow:r}=t.__,{worldCanvas:l,bounds:d,shapeBounds:c,scaleX:h,scaleY:u}=n,f=e.getSameCanvas(),p=r.length-1;At(d,Tt),r.forEach(((r,g)=>{f.setWorldShadow(Tt.offsetX+r.x*h,Tt.offsetY+r.y*u,r.blur*h,r.color),a=r.spread?1+2*r.spread/(s.boxBounds.width+2*(s.strokeBoxSpread||0)):0,It(f,Tt,a,n),i=d,r.box&&(f.restore(),f.save(),l&&(f.copyWorld(f,d,o,"copy"),i=o),l?f.copyWorld(l,o,o,"destination-out"):f.copyWorld(n.canvas,c,d,"destination-out")),t.__worldFlipped?e.copyWorldByReset(f,i,o,r.blendMode):e.copyWorldToInner(f,i,s.renderBounds,r.blendMode),p&&g<p&&f.clearWorld(i,!0)})),f.recycle(i)},innerShadow:function(t,e,n){let i,a;const{__nowWorld:o,__layout:s}=t,{innerShadow:r}=t.__,{worldCanvas:l,bounds:d,shapeBounds:c,scaleX:h,scaleY:u}=n,f=e.getSameCanvas(),p=r.length-1;Dt(d,Ht),r.forEach(((r,g)=>{f.save(),f.setWorldShadow(Ht.offsetX+r.x*h,Ht.offsetY+r.y*u,r.blur*h),a=r.spread?1-2*r.spread/(s.boxBounds.width+2*(s.strokeBoxSpread||0)):0,It(f,Ht,a,n),f.restore(),l?(f.copyWorld(f,d,o,"copy"),f.copyWorld(l,o,o,"source-out"),i=o):(f.copyWorld(n.canvas,c,d,"source-out"),i=d),f.fillWorld(i,r.color,"source-in"),t.__worldFlipped?e.copyWorldByReset(f,i,o,r.blendMode):e.copyWorldToInner(f,i,s.renderBounds,r.blendMode),p&&g<p&&f.clearWorld(i,!0)})),f.recycle(i)},blur:function(t,e,n){const{blur:i}=t.__;n.setWorldBlur(i*t.__nowWorld.a),n.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),n.filter="none"},backgroundBlur:function(t,e,n){}},{excludeRenderBounds:Yt}=t.LeafBoundsHelper;function Gt(t,e,n,i,a,o){switch(e){case"alpha":!function(t,e,n,i){const a=t.__nowWorld;n.resetTransform(),n.opacity=1,n.useMask(i,a),i.recycle(a),Xt(t,e,n,1)}(t,n,i,a);break;case"opacity-path":Xt(t,n,i,o);break;case"path":n.restore()}}function jt(t){return t.getSameCanvas(!1,!0)}function Xt(t,e,n,i){const a=t.__nowWorld;e.resetTransform(),e.opacity=i,e.copyWorld(n,a),n.recycle(a)}e.Group.prototype.__renderMask=function(t,e){let n,i,a,o,s;const{children:r}=this;for(let l=0,d=r.length;l<d;l++)n=r[l],n.__.mask&&(s&&(Gt(this,s,t,a,i,o),i=a=null),"path"===n.__.mask?(n.opacity<1?(s="opacity-path",o=n.opacity,a||(a=jt(t))):(s="path",t.save()),n.__clip(a||t,e)):(s="alpha",i||(i=jt(t)),a||(a=jt(t)),n.__render(i,e)),"clipping"!==n.__.mask)||Yt(n,e)||n.__render(a||t,e);Gt(this,s,t,a,i,o)};const Ut=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Nt=Ut+"_#~&*+\\=|≮≯≈≠=…",qt=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map((([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`)).join("|"));function Vt(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const zt=Vt("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Qt=Vt("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Jt=Vt(Ut),Zt=Vt(Nt),Kt=Vt("- —/~|┆·");var $t;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}($t||($t={}));const{Letter:te,Single:ee,Before:ne,After:ie,Symbol:ae,Break:oe}=$t;function se(t){return zt[t]?te:Kt[t]?oe:Qt[t]?ne:Jt[t]?ie:Zt[t]?ae:qt.test(t)?ee:te}const re={trimRight(t){const{words:e}=t;let n,i=0,a=e.length;for(let o=a-1;o>-1&&(n=e[o].data[0]," "===n.char);o--)i++,t.width-=n.width;i&&e.splice(a-i,i)}};function le(t,e,n){switch(e){case"title":return n?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:de}=re,{Letter:ce,Single:he,Before:ue,After:fe,Symbol:pe,Break:ge}=$t;let _e,we,me,ye,ve,xe,be,Be,Ee,Re,Le,ke,Pe,Se,Ce,Oe,We=[];function Ae(t,e){Ee&&!Be&&(Be=Ee),_e.data.push({char:t,width:e}),me+=e}function Me(){ye+=me,_e.width=me,we.words.push(_e),_e={data:[]},me=0}function Te(){Se&&(Ce.paraNumber++,we.paraStart=!0,Se=!1),Ee&&(we.startCharSize=Be,we.endCharSize=Ee,Be=0),we.width=ye,Oe.width&&de(we),We.push(we),we={words:[]},ye=0}const Ie=0,De=1,He=2;const{top:Fe,right:Ye,bottom:Ge,left:je}=t.Direction4;function Xe(t,e,n){const{bounds:i,rows:a}=t;i[e]+=n;for(let t=0;t<a.length;t++)a[t][e]+=n}const Ue={getDrawData:function(e,n){"string"!=typeof e&&(e=String(e));let i=0,a=0,o=n.__getInput("width")||0,s=n.__getInput("height")||0;const{textDecoration:r,__font:l,__padding:d}=n;d&&(o&&(i=d[je],o-=d[Ye]+d[je]),s&&(a=d[Fe],s-=d[Fe]+d[Ge]));const c={bounds:{x:i,y:a,width:o,height:s},rows:[],paraNumber:0,font:t.Platform.canvas.font=l};return function(e,n,i){Ce=e,We=e.rows,Oe=e.bounds;const{__letterSpacing:a,paraIndent:o,textCase:s}=i,{canvas:r}=t.Platform,{width:l,height:d}=Oe;if(l||d||a||"none"!==s){const t="none"!==i.textWrap,e="break"===i.textWrap;Se=!0,Le=null,Be=be=Ee=me=ye=0,_e={data:[]},we={words:[]};for(let i=0,d=n.length;i<d;i++)xe=n[i],"\n"===xe?(me&&Me(),we.paraEnd=!0,Te(),Se=!0):(Re=se(xe),Re===ce&&"none"!==s&&(xe=le(xe,s,!me)),be=r.measureText(xe).width,a&&(a<0&&(Ee=be),be+=a),ke=Re===he&&(Le===he||Le===ce)||Le===he&&Re!==fe,Pe=!(Re!==ue&&Re!==he||Le!==pe&&Le!==fe),ve=Se&&o?l-o:l,t&&l&&ye+me+be>ve&&(e?(me&&Me(),ye&&Te()):(Pe||(Pe=Re===ce&&Le==fe),ke||Pe||Re===ge||Re===ue||Re===he||me+be>ve?(me&&Me(),ye&&Te()):ye&&Te()))," "===xe&&!0!==Se&&ye+me===0||(Re===ge?(" "===xe&&me&&Me(),Ae(xe,be),Me()):ke||Pe?(me&&Me(),Ae(xe,be)):Ae(xe,be)),Le=Re);me&&Me(),ye&&Te(),We.length>0&&(We[We.length-1].paraEnd=!0)}else n.split("\n").forEach((t=>{Ce.paraNumber++,We.push({x:o||0,text:t,width:r.measureText(t).width,paraStart:!0})}))}(c,e,n),d&&function(t,e,n,i,a){if(!i)switch(n.textAlign){case"left":Xe(e,"x",t[je]);break;case"right":Xe(e,"x",-t[Ye])}if(!a)switch(n.verticalAlign){case"top":Xe(e,"y",t[Fe]);break;case"bottom":Xe(e,"y",-t[Ge])}}(d,c,n,o,s),function(t,e){const{rows:n,bounds:i}=t,{__lineHeight:a,__baseLine:o,__letterSpacing:s,__clipText:r,textAlign:l,verticalAlign:d,paraSpacing:c}=e;let h,u,f,{x:p,y:g,width:_,height:w}=i,m=a*n.length+(c?c*(t.paraNumber-1):0),y=o;if(r&&m>w)m=Math.max(w,a),t.overflow=n.length;else switch(d){case"middle":g+=(w-m)/2;break;case"bottom":g+=w-m}y+=g;for(let o=0,d=n.length;o<d;o++){if(h=n[o],h.x=p,h.width<_||h.width>_&&!r)switch(l){case"center":h.x+=(_-h.width)/2;break;case"right":h.x+=_-h.width}h.paraStart&&c&&o>0&&(y+=c),h.y=y,y+=a,t.overflow>o&&y>m&&(h.isOverflow=!0,t.overflow=o+1),u=h.x,f=h.width,s<0&&(h.width<0?(f=-h.width+e.fontSize+s,u-=f,f+=e.fontSize):f-=s),u<i.x&&(i.x=u),f>i.width&&(i.width=f),r&&_&&_<f&&(h.isOverflow=!0,t.overflow||(t.overflow=n.length))}i.y=g,i.height=m}(c,n),function(t,e,n,i){const{rows:a}=t,{textAlign:o,paraIndent:s,letterSpacing:r}=e;let l,d,c,h,u;a.forEach((t=>{t.words&&(c=s&&t.paraStart?s:0,d=n&&"justify"===o&&t.words.length>1?(n-t.width-c)/(t.words.length-1):0,h=r||t.isOverflow?Ie:d>.01?De:He,t.isOverflow&&!r&&(t.textMode=!0),h===He?(t.x+=c,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=c,l=t.x,t.data=[],t.words.forEach((e=>{h===De?(u={char:"",x:l},l=function(t,e,n){return t.forEach((t=>{n.char+=t.char,e+=t.width})),e}(e.data,l,u),(t.isOverflow||" "!==u.char)&&t.data.push(u)):l=function(t,e,n,i){return t.forEach((t=>{(i||" "!==t.char)&&(t.x=e,n.push(t)),e+=t.width})),e}(e.data,l,t.data,t.isOverflow),!t.paraEnd&&d&&(l+=d,t.width+=d)}))),t.words=null)}))}(c,n,o),c.overflow&&function(e,n,i,a){if(!a)return;const{rows:o,overflow:s}=e;let{textOverflow:r}=n;if(o.splice(s),r&&"show"!==r){let e,l;"hide"===r?r="":"ellipsis"===r&&(r="...");const d=r?t.Platform.canvas.measureText(r).width:0,c=i+a-d;("none"===n.textWrap?o:[o[s-1]]).forEach((t=>{if(t.isOverflow&&t.data){let n=t.data.length-1;for(let i=n;i>-1&&(e=t.data[i],l=e.x+e.width,!(i===n&&l<c));i--){if(l<c&&" "!==e.char){t.data.splice(i+1),t.width-=e.width;break}t.width-=e.width}t.width+=d,t.data.push({char:r,x:l}),t.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(t)}}))}}(c,n,i,o),"none"!==r&&function(t,e){const{fontSize:n}=e;switch(t.decorationHeight=n/11,e.textDecoration){case"under":t.decorationY=.15*n;break;case"delete":t.decorationY=.35*-n}}(c,n),c}};const Ne={string:function(t,n){const i="number"==typeof n&&1!==n;if("string"==typeof t){if(!i||!e.ColorConvert.object)return t;t=e.ColorConvert.object(t)}let a=void 0===t.a?1:t.a;i&&(a*=n);const o=t.r+","+t.g+","+t.b;return 1===a?"rgb("+o+")":"rgba("+o+","+a+")"}},{setPoint:qe,addPoint:Ve,toBounds:ze}=t.TwoPointBoundsHelper;const Qe={export(e,n,i){this.running=!0;const a=t.FileHelper.fileType(n),o=n.includes(".");return i=t.FileHelper.getExportOptions(i),function(e){Je||(Je=new t.TaskProcessor);return new Promise((t=>{Je.add((()=>ht(this,void 0,void 0,(function*(){return yield e(t)}))),{parallel:!1})}))}((s=>new Promise((r=>{const l=t=>{s(t),r(),this.running=!1},{toURL:d}=t.Platform,{download:c}=t.Platform.origin;if("json"===a)return o&&c(d(JSON.stringify(e.toJSON(i.json)),"text"),n),l({data:!!o||e.toJSON(i.json)});if("svg"===a)return o&&c(d(e.toSVG(),"svg"),n),l({data:!!o||e.toSVG()});const{leafer:h}=e;h?(Ze(e),h.waitViewCompleted((()=>ht(this,void 0,void 0,(function*(){let a,o,s=1,r=1;const{worldTransform:d,isLeafer:c,isFrame:u}=e,{slice:f,trim:p,onCanvas:g}=i,_=void 0===i.smooth?h.config.smooth:i.smooth,w=i.contextSettings||h.config.contextSettings,m=i.screenshot||e.isApp,y=c&&m&&void 0===i.fill?e.fill:i.fill,v=t.FileHelper.isOpaqueImage(n)||y,x=new t.Matrix;if(m)a=!0===m?c?h.canvas.bounds:e.worldRenderBounds:m;else{let t=i.relative||(c?"inner":"local");switch(s=d.scaleX,r=d.scaleY,t){case"inner":x.set(d);break;case"local":x.set(d).divide(e.localTransform),s/=e.scaleX,r/=e.scaleY;break;case"world":s=1,r=1;break;case"page":t=e.leafer;default:x.set(d).divide(e.getTransform(t));const n=t.worldTransform;s/=s/n.scaleX,r/=r/n.scaleY}a=e.getBounds("render",t)}const b={scaleX:1,scaleY:1};t.MathHelper.getScaleData(i.scale,i.size,a,b);let B=i.pixelRatio||1;e.isApp&&(b.scaleX*=B,b.scaleY*=B,B=e.app.pixelRatio);const{x:E,y:R,width:L,height:k}=new t.Bounds(a).scale(b.scaleX,b.scaleY),P={matrix:x.scale(1/b.scaleX,1/b.scaleY).invert().translate(-E,-R).withScale(1/s*b.scaleX,1/r*b.scaleY)};let S,C=t.Creator.canvas({width:Math.round(L),height:Math.round(k),pixelRatio:B,smooth:_,contextSettings:w});if(f&&(S=e,S.__worldOpacity=0,e=h,P.bounds=C.bounds),C.save(),u&&void 0!==y){const t=e.get("fill");e.fill="",e.__render(C,P),e.fill=t}else e.__render(C,P);if(C.restore(),S&&S.__updateWorldOpacity(),p){o=function(e){const{width:n,height:i}=e.view,{data:a}=e.context.getImageData(0,0,n,i);let o,s,r,l=0;for(let t=0;t<a.length;t+=4)0!==a[t+3]&&(o=l%n,s=(l-o)/n,r?Ve(r,o,s):qe(r={},o,s)),l++;const d=new t.Bounds;return ze(r,d),d.scale(1/e.pixelRatio).ceil()}(C);const e=C,{width:n,height:i}=o,a={x:0,y:0,width:n,height:i,pixelRatio:B};C=t.Creator.canvas(a),C.copyWorld(e,o,a)}v&&C.fillWorld(C.bounds,y||"#FFFFFF","destination-over"),g&&g(C);const O="canvas"===n?C:yield C.export(n,i);l({data:O,width:C.pixelWidth,height:C.pixelHeight,renderBounds:a,trimBounds:o})}))))):l({data:!1})}))))}};let Je;function Ze(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach((t=>Ze(t)))}const Ke=t.LeaferCanvasBase.prototype,$e=t.Debug.get("@leafer-ui/export");Ke.export=function(e,n){const{quality:i,blob:a}=t.FileHelper.getExportOptions(n);return e.includes(".")?this.saveAs(e,i):a?this.toBlob(e,i):this.toDataURL(e,i)},Ke.toBlob=function(e,n){return new Promise((i=>{t.Platform.origin.canvasToBolb(this.view,e,n).then((t=>{i(t)})).catch((t=>{$e.error(t),i(null)}))}))},Ke.toDataURL=function(e,n){return t.Platform.origin.canvasToDataURL(this.view,e,n)},Ke.saveAs=function(e,n){return new Promise((i=>{t.Platform.origin.canvasSaveAs(this.view,e,n).then((()=>{i(!0)})).catch((t=>{$e.error(t),i(!1)}))}))},Object.assign(e.TextConvert,Ue),Object.assign(e.ColorConvert,Ne),Object.assign(e.Paint,W),Object.assign(e.PaintImage,ft),Object.assign(e.PaintGradient,Ot),Object.assign(e.Effect,Ft),Object.assign(e.Export,Qe),a(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Layouter=m,exports.LeaferCanvas=n,exports.Renderer=v,exports.Watcher=s,exports.useCanvas=a,Object.keys(t).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})})),Object.keys(e).forEach((function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})}));
|
|
1
|
+
"use strict";var t=require("@leafer/core"),e=require("@leafer-ui/draw");class n extends t.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=t.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:n}=this;this.view.width=Math.ceil(t*n),this.view.height=Math.ceil(e*n),this.clientBounds=this.bounds}}t.canvasPatch(OffscreenCanvasRenderingContext2D.prototype),t.canvasPatch(Path2D.prototype);const{mineType:i}=t.FileHelper;function a(e,n){t.Platform.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,n)=>new Promise(((a,o)=>{t.convertToBlob({type:i(e),quality:n}).then((t=>{var e=new FileReader;e.onload=t=>a(t.target.result),e.onerror=t=>o(t),e.readAsDataURL(t)})).catch((t=>{o(t)}))})),canvasToBolb:(t,e,n)=>t.convertToBlob({type:i(e),quality:n}),canvasSaveAs:(t,e,n)=>new Promise((t=>t())),download(t,e){},loadImage:e=>new Promise(((n,i)=>{let a=new XMLHttpRequest;a.open("GET",t.Platform.image.getRealURL(e),!0),a.responseType="blob",a.onload=()=>{createImageBitmap(a.response).then((t=>{n(t)})).catch((t=>{i(t)}))},a.onerror=t=>i(t),a.send()}))},t.Platform.canvas=t.Creator.canvas(),t.Platform.conicGradientSupport=!!t.Platform.canvas.context.createConicGradient}Object.assign(t.Creator,{canvas:(t,e)=>new n(t,e),image:e=>new t.LeaferImage(e)}),t.Platform.name="web",t.Platform.isWorker=!0,t.Platform.requestRender=function(t){requestAnimationFrame(t)},t.defineKey(t.Platform,"devicePixelRatio",{get:()=>1});const{userAgent:o}=navigator;o.indexOf("Firefox")>-1?(t.Platform.conicGradientRotate90=!0,t.Platform.intWheelDeltaY=!0):o.indexOf("Safari")>-1&&-1===o.indexOf("Chrome")&&(t.Platform.fullImageShadow=!0),o.indexOf("Windows")>-1?(t.Platform.os="Windows",t.Platform.intWheelDeltaY=!0):o.indexOf("Mac")>-1?t.Platform.os="Mac":o.indexOf("Linux")>-1&&(t.Platform.os="Linux");class s{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t.LeafList;return this.__updatedList.list.forEach((t=>{t.leafer&&e.add(t)})),e}return this.__updatedList}constructor(e,n){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(t.RenderEvent.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(e){e.type===t.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(e.child)):(this.hasRemove=!0,this.__updatedList.add(e.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,n=e.length;t<n;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new t.WatchEvent(t.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new t.LeafList,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.PropertyEvent.CHANGE,this.__onAttrChange,this),e.on_([t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this),e.on_(t.WatchEvent.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllMatrix:r,updateBounds:l,updateAllWorldOpacity:d}=t.LeafHelper,{pushAllChildBranch:c,pushAllParent:h}=t.BranchHelper;const{worldBounds:u}=t.LeafBoundsHelper,f={x:0,y:0,width:1e5,height:1e5};class p{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,e instanceof Array&&(e=new t.LeafList(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,u)}setAfter(){const{list:t}=this.updatedList;t.some((t=>t.noBounds))?this.afterBounds.set(f):this.afterBounds.setListWithFn(t,u),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:g,updateAllChange:_}=t.LeafHelper,w=t.Debug.get("Layouter");class m{constructor(e,n){this.totalTimes=0,this.config={},this.__levelList=new t.LeafLevelList,this.target=e,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:e}=this;this.times=0;try{e.emit(t.LayoutEvent.START),this.layoutOnce(),e.emitEvent(new t.LayoutEvent(t.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){w.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?w.warn("layouting"):this.times>3?w.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(t.WatchEvent.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var e;if(!(null===(e=this.__updatedList)||void 0===e?void 0:e.length))return;const n=t.Run.start("PartLayout"),{target:i,__updatedList:a}=this,{BEFORE:o,LAYOUT:s,AFTER:u}=t.LayoutEvent,f=this.getBlocks(a);f.forEach((t=>t.setBefore())),i.emitEvent(new t.LayoutEvent(o,f,this.times)),this.extraBlock=null,a.sort(),function(t,e){let n;t.list.forEach((t=>{n=t.__layout,e.without(t)&&!n.proxyZoom&&(n.matrixChanged?(r(t,!0),e.add(t),t.isBranch&&c(t,e),h(t,e)):n.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),h(t,e)))}))}(a,this.__levelList),function(t){let e,n,i;t.sort(!0),t.levels.forEach((a=>{e=t.levelMap[a];for(let t=0,a=e.length;t<a;t++){if(n=e[t],n.isBranch&&n.__tempNumber){i=n.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||l(i[t])}l(n)}}))}(this.__levelList),function(t){let e;t.list.forEach((t=>{e=t.__layout,e.opacityChanged&&d(t),e.stateStyleChanged&&setTimeout((()=>e.stateStyleChanged&&t.updateState())),t.__updateChange()}))}(a),this.extraBlock&&f.push(this.extraBlock),f.forEach((t=>t.setAfter())),i.emitEvent(new t.LayoutEvent(s,f,this.times)),i.emitEvent(new t.LayoutEvent(u,f,this.times)),this.addBlocks(f),this.__levelList.reset(),this.__updatedList=null,t.Run.end(n)}fullLayout(){const e=t.Run.start("FullLayout"),{target:n}=this,{BEFORE:i,LAYOUT:a,AFTER:o}=t.LayoutEvent,s=this.getBlocks(new t.LeafList(n));n.emitEvent(new t.LayoutEvent(i,s,this.times)),m.fullLayout(n),s.forEach((t=>{t.setAfter()})),n.emitEvent(new t.LayoutEvent(a,s,this.times)),n.emitEvent(new t.LayoutEvent(o,s,this.times)),this.addBlocks(s),t.Run.end(e)}static fullLayout(e){g(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),_(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:n}=this.extraBlock||(this.extraBlock=new p([]));e.length?n.add(t.__world):n.set(t.__world),e.add(t)}}createBlock(t){return new p(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.LayoutEvent.REQUEST,this.layout,this),e.on_(t.LayoutEvent.AGAIN,this.layoutAgain,this),e.on_(t.WatchEvent.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const y=t.Debug.get("Renderer");class v{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,n,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=e,this.canvas=n,i&&(this.config=t.DataHelper.default(i,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}render(e){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:n}=this;this.times=0,this.totalBounds=new t.Bounds,y.log(n.innerName,"---\x3e");try{n.app.emit(t.RenderEvent.CHILD_START,n),this.emitRender(t.RenderEvent.START),this.renderOnce(e),this.emitRender(t.RenderEvent.END,this.totalBounds),t.ImageManager.clearRecycled()}catch(t){this.rendering=!1,y.error(t)}y.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){if(this.rendering)return y.warn("rendering");if(this.times>3)return y.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new t.Bounds,this.renderOptions={},e)this.emitRender(t.RenderEvent.BEFORE),e();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(t.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(t.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(t.RenderEvent.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return y.warn("PartRender: need update attr");this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(e){const n=t.Run.start("PartRender"),{canvas:i}=this,a=e.getIntersect(i.bounds),o=e.includes(this.target.__world),s=new t.Bounds(a);i.save(),o&&!t.Debug.showRepaint?i.clear():(a.spread(10+1/this.canvas.pixelRatio).ceil(),i.clearWorld(a,!0),i.clipWorld(a,!0)),this.__render(a,o,s),i.restore(),t.Run.end(n)}fullRender(){const e=t.Run.start("FullRender"),{canvas:n}=this;n.save(),n.clear(),this.__render(n.bounds,!0),n.restore(),t.Run.end(e)}__render(e,n,i){const a=e.includes(this.target.__world)?{includes:n}:{bounds:e,includes:n};this.needFill&&this.canvas.fillWorld(e,this.config.fill),t.Debug.showRepaint&&this.canvas.strokeWorld(e,"red"),this.target.__render(this.canvas,a),this.renderBounds=i=i||e,this.renderOptions=a,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),t.Debug.showHitView&&this.renderHitView(a),t.Debug.showBoundsView&&this.renderBoundsView(a),this.canvas.updateRender(i)}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const n=new t.Bounds;n.setList(e),e.length=0,e.push(n)}}__requestRender(){const e=Date.now();t.Platform.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-e))),this.running&&(this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)),this.target&&this.__requestRender()}))}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:n,height:i}=e.old;if(!new t.Bounds(0,0,n,i).includes(this.target.__world)||this.needFill||!e.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new t.Bounds(0,0,1,1)),this.changed=!0}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||y.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(e,n,i){this.target.emitEvent(new t.RenderEvent(e,this.times,n,i))}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.RenderEvent.REQUEST,this.update,this),e.on_(t.LayoutEvent.END,this.__onLayoutEnd,this),e.on_(t.RenderEvent.AGAIN,this.renderAgain,this),e.on_(t.ResizeEvent.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}function x(t,e){let n;const{rows:i,decorationY:a,decorationHeight:o}=t.__.__textDrawData;for(let t=0,s=i.length;t<s;t++)n=i[t],n.text?e.fillText(n.text,n.x,n.y):n.data&&n.data.forEach((t=>{e.fillText(t.char,t.x,n.y)})),a&&e.fillRect(n.x,n.y+a,n.width,o)}function b(t,e,n){const{strokeAlign:i}=e.__,a="string"!=typeof t;switch(i){case"center":n.setStroke(a?void 0:t,e.__.strokeWidth,e.__),a?R(t,!0,e,n):E(e,n);break;case"inside":B("inside",t,a,e,n);break;case"outside":B("outside",t,a,e,n)}}function B(t,e,n,i,a){const{__strokeWidth:o,__font:s}=i.__,r=a.getSameCanvas(!0,!0);r.setStroke(n?void 0:e,2*o,i.__),r.font=s,n?R(e,!0,i,r):E(i,r),r.blendMode="outside"===t?"destination-out":"destination-in",x(i,r),r.blendMode="normal",i.__worldFlipped?a.copyWorldByReset(r,i.__nowWorld):a.copyWorldToInner(r,i.__nowWorld,i.__layout.renderBounds),r.recycle(i.__nowWorld)}function E(t,e){let n;const{rows:i,decorationY:a,decorationHeight:o}=t.__.__textDrawData;for(let t=0,s=i.length;t<s;t++)n=i[t],n.text?e.strokeText(n.text,n.x,n.y):n.data&&n.data.forEach((t=>{e.strokeText(t.char,t.x,n.y)})),a&&e.strokeRect(n.x,n.y+a,n.width,o)}function R(t,n,i,a){let o;for(let s=0,r=t.length;s<r;s++)o=t[s],o.image&&e.PaintImage.checkImage(i,a,o,!1)||o.style&&(a.strokeStyle=o.style,o.blendMode?(a.saveBlendMode(o.blendMode),n?E(i,a):a.stroke(),a.restoreBlendMode()):n?E(i,a):a.stroke())}Object.assign(t.Creator,{watcher:(t,e)=>new s(t,e),layouter:(t,e)=>new m(t,e),renderer:(t,e,n)=>new v(t,e,n),selector:(t,e)=>{},interaction:(t,e,n,i)=>{}}),t.Platform.layout=m.fullLayout;const{getSpread:L,getOuterOf:k,getByMove:S,getIntersectData:P}=t.BoundsHelper;let C;function O(t,n,i){if("object"!=typeof n||!1===n.visible||0===n.opacity)return;const{boxBounds:a}=i.__layout;switch(n.type){case"solid":let{type:o,blendMode:s,color:r,opacity:l}=n;return{type:o,blendMode:s,style:e.ColorConvert.string(r,l)};case"image":return e.PaintImage.image(i,t,n,a,!C||!C[n.url]);case"linear":return e.PaintGradient.linearGradient(n,a);case"radial":return e.PaintGradient.radialGradient(n,a);case"angular":return e.PaintGradient.conicGradient(n,a);default:return void 0!==n.r?{type:"solid",style:e.ColorConvert.string(n)}:void 0}}const A={compute:function(t,n){const i=n.__,a=[];let o,s=i.__input[t];s instanceof Array||(s=[s]),C=e.PaintImage.recycleImage(t,i);for(let e,i=0,o=s.length;i<o;i++)e=O(t,s[i],n),e&&a.push(e);i["_"+t]=a.length?a:void 0,a.length&&a[0].image&&(o=a[0].image.hasOpacityPixel),"fill"===t?i.__pixelFill=o:i.__pixelStroke=o},fill:function(t,e,n){n.fillStyle=t,e.__.__font?x(e,n):e.__.windingRule?n.fill(e.__.windingRule):n.fill()},fills:function(t,n,i){let a;const{windingRule:o,__font:s}=n.__;for(let r=0,l=t.length;r<l;r++)a=t[r],a.image&&e.PaintImage.checkImage(n,i,a,!s)||a.style&&(i.fillStyle=a.style,a.transform?(i.save(),i.transform(a.transform),a.blendMode&&(i.blendMode=a.blendMode),s?x(n,i):o?i.fill(o):i.fill(),i.restore()):a.blendMode?(i.saveBlendMode(a.blendMode),s?x(n,i):o?i.fill(o):i.fill(),i.restoreBlendMode()):s?x(n,i):o?i.fill(o):i.fill())},fillText:x,stroke:function(t,e,n){const i=e.__,{__strokeWidth:a,strokeAlign:o,__font:s}=i;if(a)if(s)b(t,e,n);else switch(o){case"center":n.setStroke(t,a,i),n.stroke();break;case"inside":n.save(),n.setStroke(t,2*a,i),i.windingRule?n.clip(i.windingRule):n.clip(),n.stroke(),n.restore();break;case"outside":const o=n.getSameCanvas(!0,!0);o.setStroke(t,2*a,i),e.__drawRenderPath(o),o.stroke(),i.windingRule?o.clip(i.windingRule):o.clip(),o.clearWorld(e.__layout.renderBounds),e.__worldFlipped?n.copyWorldByReset(o,e.__nowWorld):n.copyWorldToInner(o,e.__nowWorld,e.__layout.renderBounds),o.recycle(e.__nowWorld)}},strokes:function(t,e,n){const i=e.__,{__strokeWidth:a,strokeAlign:o,__font:s}=i;if(a)if(s)b(t,e,n);else switch(o){case"center":n.setStroke(void 0,a,i),R(t,!1,e,n);break;case"inside":n.save(),n.setStroke(void 0,2*a,i),i.windingRule?n.clip(i.windingRule):n.clip(),R(t,!1,e,n),n.restore();break;case"outside":const{renderBounds:o}=e.__layout,s=n.getSameCanvas(!0,!0);e.__drawRenderPath(s),s.setStroke(void 0,2*a,i),R(t,!1,e,s),i.windingRule?s.clip(i.windingRule):s.clip(),s.clearWorld(o),e.__worldFlipped?n.copyWorldByReset(s,e.__nowWorld):n.copyWorldToInner(s,e.__nowWorld,o),s.recycle(e.__nowWorld)}},strokeText:b,drawTextStroke:E,shape:function(t,e,n){const i=e.getSameCanvas(),a=t.__nowWorld;let o,s,r,l,{scaleX:d,scaleY:c}=a;if(d<0&&(d=-d),c<0&&(c=-c),e.bounds.includes(a))l=i,o=r=a;else{const{renderShapeSpread:i}=t.__layout,h=P(i?L(e.bounds,d===c?i*d:[i*c,i*d]):e.bounds,a);s=e.bounds.getFitMatrix(h);let{a:u,d:f}=s;if(s.a<1&&(l=e.getSameCanvas(),t.__renderShape(l,n),d*=u,c*=f),r=k(a,s),o=S(r,-s.e,-s.f),n.matrix){const{matrix:t}=n;s.multiply(t),u*=t.scaleX,f*=t.scaleY}n=Object.assign(Object.assign({},n),{matrix:s.withScale(u,f)})}return t.__renderShape(i,n),{canvas:i,matrix:s,bounds:o,worldCanvas:l,shapeBounds:r,scaleX:d,scaleY:c}}};let W={};const{get:M,rotateOfOuter:T,translate:I,scaleOfOuter:D,scale:H,rotate:F}=t.MatrixHelper;function Y(t,e,n,i,a,o,s){const r=M();I(r,e.x+n,e.y+i),H(r,a,o),s&&T(r,{x:e.x+e.width/2,y:e.y+e.height/2},s),t.transform=r}function G(t,e,n,i,a,o,s){const r=M();I(r,e.x+n,e.y+i),a&&H(r,a,o),s&&F(r,s),t.transform=r}function j(t,e,n,i,a,o,s,r,l,d){const c=M();if(l)if("center"===d)T(c,{x:n/2,y:i/2},l);else switch(F(c,l),l){case 90:I(c,i,0);break;case 180:I(c,n,i);break;case 270:I(c,0,n)}W.x=e.x+a,W.y=e.y+o,I(c,W.x,W.y),s&&D(c,W,s,r),t.transform=c}const{get:X,translate:U}=t.MatrixHelper,z=new t.Bounds,N={},q={};function V(t,e,n,i){const{blendMode:a,sync:o}=n;a&&(t.blendMode=a),o&&(t.sync=o),t.data=Q(n,i,e)}function Q(e,n,i){let{width:a,height:o}=i;e.padding&&(n=z.set(n).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");const{opacity:s,mode:r,align:l,offset:d,scale:c,size:h,rotation:u,repeat:f}=e,p=n.width===a&&n.height===o,g={mode:r},_="center"!==l&&(u||0)%180==90,w=_?o:a,m=_?a:o;let y,v,x=0,b=0;if(r&&"cover"!==r&&"fit"!==r)(c||h)&&(t.MathHelper.getScaleData(c,h,i,q),y=q.scaleX,v=q.scaleY);else if(!p||u){const t=n.width/w,e=n.height/m;y=v="fit"===r?Math.min(t,e):Math.max(t,e),x+=(n.width-a*y)/2,b+=(n.height-o*v)/2}if(l){const e={x:x,y:b,width:w,height:m};y&&(e.width*=y,e.height*=v),t.AlignHelper.toPoint(l,e,n,N,!0),x+=N.x,b+=N.y}switch(d&&(x+=d.x,b+=d.y),r){case"stretch":p||(a=n.width,o=n.height);break;case"normal":case"clip":(x||b||y||u)&&G(g,n,x,b,y,v,u);break;case"repeat":(!p||y||u)&&j(g,n,a,o,x,b,y,v,u,l),f||(g.repeat="repeat");break;default:y&&Y(g,n,x,b,y,v,u)}return g.transform||(n.x||n.y)&&(g.transform=X(),U(g.transform,n.x,n.y)),y&&"stretch"!==r&&(g.scaleX=y,g.scaleY=v),g.width=a,g.height=o,s&&(g.opacity=s),f&&(g.repeat="string"==typeof f?"x"===f?"repeat-x":"repeat-y":"repeat"),g}let J,Z=new t.Bounds;const{isSame:K}=t.BoundsHelper;function $(t,e,n,i,a,o){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return a.data||V(a,i,n,o),!0}function tt(e,n){it(e,t.ImageEvent.LOAD,n)}function et(e,n){it(e,t.ImageEvent.LOADED,n)}function nt(e,n,i){n.error=i,e.forceUpdate("surface"),it(e,t.ImageEvent.ERROR,n)}function it(e,n,i){e.hasEvent(n)&&e.emitEvent(new t.ImageEvent(n,i))}function at(t,e){const{leafer:n}=t;n&&n.viewReady&&(n.renderer.ignore=e)}const{get:ot,scale:st,copy:rt}=t.MatrixHelper,{ceil:lt,abs:dt}=Math;function ct(e,n,i){let{scaleX:a,scaleY:o}=t.ImageManager.patternLocked?e.__world:e.__nowWorld;const s=a+"-"+o+"-"+i;if(n.patternId===s||e.destroyed)return!1;{a=dt(a),o=dt(o);const{image:e,data:r}=n;let l,d,{width:c,height:h,scaleX:u,scaleY:f,opacity:p,transform:g,repeat:_}=r;u&&(d=ot(),rt(d,g),st(d,1/u,1/f),a*=u,o*=f),a*=i,o*=i,c*=a,h*=o;const w=c*h;if(!_&&w>t.Platform.image.maxCacheSize)return!1;let m=t.Platform.image.maxPatternSize;if(!e.isSVG){const t=e.width*e.height;m>t&&(m=t)}w>m&&(l=Math.sqrt(w/m)),l&&(a/=l,o/=l,c/=l,h/=l),u&&(a/=u,o/=f),(g||1!==a||1!==o)&&(d||(d=ot(),g&&rt(d,g)),st(d,1/a,1/o));const y=e.getCanvas(lt(c)||1,lt(h)||1,p),v=e.getPattern(y,_||t.Platform.origin.noRepeat||"no-repeat",d,n);return n.style=v,n.patternId=s,!0}}function ht(t,e,n,i){return new(n||(n=Promise))((function(a,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function r(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?a(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,r)}l((i=i.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const{abs:ut}=Math;const ft={image:function(e,n,i,a,o){let s,r;const l=t.ImageManager.get(i);return J&&i===J.paint&&K(a,J.boxBounds)?s=J.leafPaint:(s={type:i.type,image:l},J=l.use>1?{leafPaint:s,paint:i,boxBounds:Z.set(a)}:null),(o||l.loading)&&(r={image:l,attrName:n,attrValue:i}),l.ready?($(e,n,i,l,s,a),o&&(tt(e,r),et(e,r))):l.error?o&&nt(e,r,l.error):(o&&(at(e,!0),tt(e,r)),s.loadId=l.load((()=>{at(e,!1),e.destroyed||($(e,n,i,l,s,a)&&(l.hasOpacityPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),et(e,r)),s.loadId=null}),(t=>{at(e,!1),nt(e,r,t),s.loadId=null}))),s},checkImage:function(n,i,a,o){const{scaleX:s,scaleY:r}=t.ImageManager.patternLocked?n.__world:n.__nowWorld,{pixelRatio:l}=i;if(!a.data||a.patternId===s+"-"+r+"-"+l&&!e.Export.running)return!1;{const{data:d}=a;if(o)if(d.repeat)o=!1;else{let{width:n,height:i}=d;n*=ut(s)*l,i*=ut(r)*l,d.scaleX&&(n*=d.scaleX,i*=d.scaleY),o=n*i>t.Platform.image.maxCacheSize||e.Export.running}return o?(i.save(),i.clip(),a.blendMode&&(i.blendMode=a.blendMode),d.opacity&&(i.opacity*=d.opacity),d.transform&&i.transform(d.transform),i.drawImage(a.image.view,0,0,d.width,d.height),i.restore(),!0):(!a.style||a.sync||e.Export.running?ct(n,a,l):a.patternTask||(a.patternTask=t.ImageManager.patternTasker.add((()=>ht(this,void 0,void 0,(function*(){a.patternTask=null,i.bounds.hit(n.__nowWorld)&&ct(n,a,l),n.forceUpdate("surface")}))),300)),!1)}},createPattern:ct,recycleImage:function(e,n){const i=n["_"+e];if(i instanceof Array){let a,o,s,r;for(let l=0,d=i.length;l<d;l++)a=i[l].image,r=a&&a.url,r&&(o||(o={}),o[r]=!0,t.ImageManager.recycle(a),a.loading&&(s||(s=n.__input&&n.__input[e]||[],s instanceof Array||(s=[s])),a.unload(i[l].loadId,!s.some((t=>t.url===r)))));return o}return null},createData:V,getPatternData:Q,fillOrFitMode:Y,clipMode:G,repeatMode:j},{toPoint:pt}=t.AroundHelper,gt={},_t={};function wt(t,n,i){if(n){let a;for(let o=0,s=n.length;o<s;o++)a=n[o],"string"==typeof a?t.addColorStop(o/(s-1),e.ColorConvert.string(a,i)):t.addColorStop(a.offset,e.ColorConvert.string(a.color,i))}}const{getAngle:mt,getDistance:yt}=t.PointHelper,{get:vt,rotateOfOuter:xt,scaleOfOuter:bt}=t.MatrixHelper,{toPoint:Bt}=t.AroundHelper,Et={},Rt={};function Lt(t,e,n,i,a){let o;const{width:s,height:r}=t;if(s!==r||i){const t=mt(e,n);o=vt(),a?(bt(o,e,s/r*(i||1),1),xt(o,e,t+90)):(bt(o,e,1,s/r*(i||1)),xt(o,e,t))}return o}const{getDistance:kt}=t.PointHelper,{toPoint:St}=t.AroundHelper,Pt={},Ct={};const Ot={linearGradient:function(e,n){let{from:i,to:a,type:o,blendMode:s,opacity:r}=e;pt(i||"top",n,gt),pt(a||"bottom",n,_t);const l=t.Platform.canvas.createLinearGradient(gt.x,gt.y,_t.x,_t.y);wt(l,e.stops,r);const d={type:o,style:l};return s&&(d.blendMode=s),d},radialGradient:function(e,n){let{from:i,to:a,type:o,opacity:s,blendMode:r,stretch:l}=e;Bt(i||"center",n,Et),Bt(a||"bottom",n,Rt);const d=t.Platform.canvas.createRadialGradient(Et.x,Et.y,0,Et.x,Et.y,yt(Et,Rt));wt(d,e.stops,s);const c={type:o,style:d},h=Lt(n,Et,Rt,l,!0);return h&&(c.transform=h),r&&(c.blendMode=r),c},conicGradient:function(e,n){let{from:i,to:a,type:o,opacity:s,blendMode:r,stretch:l}=e;St(i||"center",n,Pt),St(a||"bottom",n,Ct);const d=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,Pt.x,Pt.y):t.Platform.canvas.createRadialGradient(Pt.x,Pt.y,0,Pt.x,Pt.y,kt(Pt,Ct));wt(d,e.stops,s);const c={type:o,style:d},h=Lt(n,Pt,Ct,l||1,t.Platform.conicGradientRotate90);return h&&(c.transform=h),r&&(c.blendMode=r),c},getTransform:Lt},{copy:At,toOffsetOutBounds:Wt}=t.BoundsHelper,Mt={},Tt={};function It(e,n,i,a){const{bounds:o,shapeBounds:s}=a;if(t.Platform.fullImageShadow){if(At(Mt,e.bounds),Mt.x+=n.x-s.x,Mt.y+=n.y-s.y,i){const{matrix:t}=a;Mt.x-=(o.x+(t?t.e:0)+o.width/2)*(i-1),Mt.y-=(o.y+(t?t.f:0)+o.height/2)*(i-1),Mt.width*=i,Mt.height*=i}e.copyWorld(a.canvas,e.bounds,Mt)}else i&&(At(Mt,n),Mt.x-=n.width/2*(i-1),Mt.y-=n.height/2*(i-1),Mt.width*=i,Mt.height*=i),e.copyWorld(a.canvas,s,i?Mt:n)}const{toOffsetOutBounds:Dt}=t.BoundsHelper,Ht={};const Ft={shadow:function(t,e,n){let i,a;const{__nowWorld:o,__layout:s}=t,{shadow:r}=t.__,{worldCanvas:l,bounds:d,shapeBounds:c,scaleX:h,scaleY:u}=n,f=e.getSameCanvas(),p=r.length-1;Wt(d,Tt),r.forEach(((r,g)=>{f.setWorldShadow(Tt.offsetX+r.x*h,Tt.offsetY+r.y*u,r.blur*h,r.color),a=r.spread?1+2*r.spread/(s.boxBounds.width+2*(s.strokeBoxSpread||0)):0,It(f,Tt,a,n),i=d,r.box&&(f.restore(),f.save(),l&&(f.copyWorld(f,d,o,"copy"),i=o),l?f.copyWorld(l,o,o,"destination-out"):f.copyWorld(n.canvas,c,d,"destination-out")),t.__worldFlipped?e.copyWorldByReset(f,i,o,r.blendMode):e.copyWorldToInner(f,i,s.renderBounds,r.blendMode),p&&g<p&&f.clearWorld(i,!0)})),f.recycle(i)},innerShadow:function(t,e,n){let i,a;const{__nowWorld:o,__layout:s}=t,{innerShadow:r}=t.__,{worldCanvas:l,bounds:d,shapeBounds:c,scaleX:h,scaleY:u}=n,f=e.getSameCanvas(),p=r.length-1;Dt(d,Ht),r.forEach(((r,g)=>{f.save(),f.setWorldShadow(Ht.offsetX+r.x*h,Ht.offsetY+r.y*u,r.blur*h),a=r.spread?1-2*r.spread/(s.boxBounds.width+2*(s.strokeBoxSpread||0)):0,It(f,Ht,a,n),f.restore(),l?(f.copyWorld(f,d,o,"copy"),f.copyWorld(l,o,o,"source-out"),i=o):(f.copyWorld(n.canvas,c,d,"source-out"),i=d),f.fillWorld(i,r.color,"source-in"),t.__worldFlipped?e.copyWorldByReset(f,i,o,r.blendMode):e.copyWorldToInner(f,i,s.renderBounds,r.blendMode),p&&g<p&&f.clearWorld(i,!0)})),f.recycle(i)},blur:function(t,e,n){const{blur:i}=t.__;n.setWorldBlur(i*t.__nowWorld.a),n.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),n.filter="none"},backgroundBlur:function(t,e,n){}},{excludeRenderBounds:Yt}=t.LeafBoundsHelper;function Gt(t,e,n,i,a,o){switch(e){case"alpha":!function(t,e,n,i){const a=t.__nowWorld;n.resetTransform(),n.opacity=1,n.useMask(i,a),i.recycle(a),Xt(t,e,n,1)}(t,n,i,a);break;case"opacity-path":Xt(t,n,i,o);break;case"path":n.restore()}}function jt(t){return t.getSameCanvas(!1,!0)}function Xt(t,e,n,i){const a=t.__nowWorld;e.resetTransform(),e.opacity=i,e.copyWorld(n,a),n.recycle(a)}e.Group.prototype.__renderMask=function(t,e){let n,i,a,o,s;const{children:r}=this;for(let l=0,d=r.length;l<d;l++)n=r[l],n.__.mask&&(s&&(Gt(this,s,t,a,i,o),i=a=null),"path"===n.__.mask?(n.opacity<1?(s="opacity-path",o=n.opacity,a||(a=jt(t))):(s="path",t.save()),n.__clip(a||t,e)):(s="alpha",i||(i=jt(t)),a||(a=jt(t)),n.__render(i,e)),"clipping"!==n.__.mask)||Yt(n,e)||n.__render(a||t,e);Gt(this,s,t,a,i,o)};const Ut=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",zt=Ut+"_#~&*+\\=|≮≯≈≠=…",Nt=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map((([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`)).join("|"));function qt(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Vt=qt("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Qt=qt("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Jt=qt(Ut),Zt=qt(zt),Kt=qt("- —/~|┆·");var $t;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}($t||($t={}));const{Letter:te,Single:ee,Before:ne,After:ie,Symbol:ae,Break:oe}=$t;function se(t){return Vt[t]?te:Kt[t]?oe:Qt[t]?ne:Jt[t]?ie:Zt[t]?ae:Nt.test(t)?ee:te}const re={trimRight(t){const{words:e}=t;let n,i=0,a=e.length;for(let o=a-1;o>-1&&(n=e[o].data[0]," "===n.char);o--)i++,t.width-=n.width;i&&e.splice(a-i,i)}};function le(t,e,n){switch(e){case"title":return n?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:de}=re,{Letter:ce,Single:he,Before:ue,After:fe,Symbol:pe,Break:ge}=$t;let _e,we,me,ye,ve,xe,be,Be,Ee,Re,Le,ke,Se,Pe,Ce,Oe,Ae,We=[];function Me(t,e){Ee&&!Be&&(Be=Ee),_e.data.push({char:t,width:e}),me+=e}function Te(){ye+=me,_e.width=me,we.words.push(_e),_e={data:[]},me=0}function Ie(){Pe&&(Ce.paraNumber++,we.paraStart=!0,Pe=!1),Ee&&(we.startCharSize=Be,we.endCharSize=Ee,Be=0),we.width=ye,Oe.width?de(we):Ae&&De(),We.push(we),we={words:[]},ye=0}function De(){ye>(Ce.maxWidth||0)&&(Ce.maxWidth=ye)}const He=0,Fe=1,Ye=2;const{top:Ge,right:je,bottom:Xe,left:Ue}=t.Direction4;function ze(t,e,n){const{bounds:i,rows:a}=t;i[e]+=n;for(let t=0;t<a.length;t++)a[t][e]+=n}const Ne={getDrawData:function(e,n){"string"!=typeof e&&(e=String(e));let i=0,a=0,o=n.__getInput("width")||0,s=n.__getInput("height")||0;const{textDecoration:r,__font:l,__padding:d}=n;d&&(o?(i=d[Ue],o-=d[je]+d[Ue]):n.autoSizeAlign||(i=d[Ue]),s?(a=d[Ge],s-=d[Ge]+d[Xe]):n.autoSizeAlign||(a=d[Ge]));const c={bounds:{x:i,y:a,width:o,height:s},rows:[],paraNumber:0,font:t.Platform.canvas.font=l};return function(e,n,i){Ce=e,We=e.rows,Oe=e.bounds,Ae=!Oe.width&&!i.autoSizeAlign;const{__letterSpacing:a,paraIndent:o,textCase:s}=i,{canvas:r}=t.Platform,{width:l,height:d}=Oe;if(l||d||a||"none"!==s){const t="none"!==i.textWrap,e="break"===i.textWrap;Pe=!0,Le=null,Be=be=Ee=me=ye=0,_e={data:[]},we={words:[]};for(let i=0,d=n.length;i<d;i++)xe=n[i],"\n"===xe?(me&&Te(),we.paraEnd=!0,Ie(),Pe=!0):(Re=se(xe),Re===ce&&"none"!==s&&(xe=le(xe,s,!me)),be=r.measureText(xe).width,a&&(a<0&&(Ee=be),be+=a),ke=Re===he&&(Le===he||Le===ce)||Le===he&&Re!==fe,Se=!(Re!==ue&&Re!==he||Le!==pe&&Le!==fe),ve=Pe&&o?l-o:l,t&&l&&ye+me+be>ve&&(e?(me&&Te(),ye&&Ie()):(Se||(Se=Re===ce&&Le==fe),ke||Se||Re===ge||Re===ue||Re===he||me+be>ve?(me&&Te(),ye&&Ie()):ye&&Ie()))," "===xe&&!0!==Pe&&ye+me===0||(Re===ge?(" "===xe&&me&&Te(),Me(xe,be),Te()):ke||Se?(me&&Te(),Me(xe,be)):Me(xe,be)),Le=Re);me&&Te(),ye&&Ie(),We.length>0&&(We[We.length-1].paraEnd=!0)}else n.split("\n").forEach((t=>{Ce.paraNumber++,ye=r.measureText(t).width,We.push({x:o||0,text:t,width:ye,paraStart:!0}),Ae&&De()}))}(c,e,n),d&&function(t,e,n,i,a){if(!i&&n.autoSizeAlign)switch(n.textAlign){case"left":ze(e,"x",t[Ue]);break;case"right":ze(e,"x",-t[je])}if(!a&&n.autoSizeAlign)switch(n.verticalAlign){case"top":ze(e,"y",t[Ge]);break;case"bottom":ze(e,"y",-t[Xe])}}(d,c,n,o,s),function(t,e){const{rows:n,bounds:i}=t,{__lineHeight:a,__baseLine:o,__letterSpacing:s,__clipText:r,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:h}=e;let{x:u,y:f,width:p,height:g}=i,_=a*n.length+(c?c*(t.paraNumber-1):0),w=o;if(r&&_>g)_=Math.max(g,a),t.overflow=n.length;else if(g||h)switch(d){case"middle":f+=(g-_)/2;break;case"bottom":f+=g-_}w+=f;let m,y,v,x=p||h?p:t.maxWidth;for(let o=0,d=n.length;o<d;o++){if(m=n[o],m.x=u,m.width<p||m.width>p&&!r)switch(l){case"center":m.x+=(x-m.width)/2;break;case"right":m.x+=x-m.width}m.paraStart&&c&&o>0&&(w+=c),m.y=w,w+=a,t.overflow>o&&w>_&&(m.isOverflow=!0,t.overflow=o+1),y=m.x,v=m.width,s<0&&(m.width<0?(v=-m.width+e.fontSize+s,y-=v,v+=e.fontSize):v-=s),y<i.x&&(i.x=y),v>i.width&&(i.width=v),r&&p&&p<v&&(m.isOverflow=!0,t.overflow||(t.overflow=n.length))}i.y=f,i.height=_}(c,n),function(t,e,n,i){const{rows:a}=t,{textAlign:o,paraIndent:s,letterSpacing:r}=e;let l,d,c,h,u;a.forEach((t=>{t.words&&(c=s&&t.paraStart?s:0,d=n&&"justify"===o&&t.words.length>1?(n-t.width-c)/(t.words.length-1):0,h=r||t.isOverflow?He:d>.01?Fe:Ye,t.isOverflow&&!r&&(t.textMode=!0),h===Ye?(t.x+=c,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=c,l=t.x,t.data=[],t.words.forEach((e=>{h===Fe?(u={char:"",x:l},l=function(t,e,n){return t.forEach((t=>{n.char+=t.char,e+=t.width})),e}(e.data,l,u),(t.isOverflow||" "!==u.char)&&t.data.push(u)):l=function(t,e,n,i){return t.forEach((t=>{(i||" "!==t.char)&&(t.x=e,n.push(t)),e+=t.width})),e}(e.data,l,t.data,t.isOverflow),!t.paraEnd&&d&&(l+=d,t.width+=d)}))),t.words=null)}))}(c,n,o),c.overflow&&function(e,n,i,a){if(!a)return;const{rows:o,overflow:s}=e;let{textOverflow:r}=n;if(o.splice(s),r&&"show"!==r){let e,l;"hide"===r?r="":"ellipsis"===r&&(r="...");const d=r?t.Platform.canvas.measureText(r).width:0,c=i+a-d;("none"===n.textWrap?o:[o[s-1]]).forEach((t=>{if(t.isOverflow&&t.data){let n=t.data.length-1;for(let i=n;i>-1&&(e=t.data[i],l=e.x+e.width,!(i===n&&l<c));i--){if(l<c&&" "!==e.char){t.data.splice(i+1),t.width-=e.width;break}t.width-=e.width}t.width+=d,t.data.push({char:r,x:l}),t.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(t)}}))}}(c,n,i,o),"none"!==r&&function(t,e){const{fontSize:n}=e;switch(t.decorationHeight=n/11,e.textDecoration){case"under":t.decorationY=.15*n;break;case"delete":t.decorationY=.35*-n}}(c,n),c}};const qe={string:function(t,n){const i="number"==typeof n&&1!==n;if("string"==typeof t){if(!i||!e.ColorConvert.object)return t;t=e.ColorConvert.object(t)}let a=void 0===t.a?1:t.a;i&&(a*=n);const o=t.r+","+t.g+","+t.b;return 1===a?"rgb("+o+")":"rgba("+o+","+a+")"}},{setPoint:Ve,addPoint:Qe,toBounds:Je}=t.TwoPointBoundsHelper;const Ze={export(e,n,i){this.running=!0;const a=t.FileHelper.fileType(n),o=n.includes(".");return i=t.FileHelper.getExportOptions(i),function(e){Ke||(Ke=new t.TaskProcessor);return new Promise((t=>{Ke.add((()=>ht(this,void 0,void 0,(function*(){return yield e(t)}))),{parallel:!1})}))}((s=>new Promise((r=>{const l=t=>{s(t),r(),this.running=!1},{toURL:d}=t.Platform,{download:c}=t.Platform.origin;if("json"===a)return o&&c(d(JSON.stringify(e.toJSON(i.json)),"text"),n),l({data:!!o||e.toJSON(i.json)});if("svg"===a)return o&&c(d(e.toSVG(),"svg"),n),l({data:!!o||e.toSVG()});const{leafer:h}=e;h?($e(e),h.waitViewCompleted((()=>ht(this,void 0,void 0,(function*(){let a,o,s=1,r=1;const{worldTransform:d,isLeafer:c,isFrame:u}=e,{slice:f,trim:p,onCanvas:g}=i,_=void 0===i.smooth?h.config.smooth:i.smooth,w=i.contextSettings||h.config.contextSettings,m=i.screenshot||e.isApp,y=c&&m&&void 0===i.fill?e.fill:i.fill,v=t.FileHelper.isOpaqueImage(n)||y,x=new t.Matrix;if(m)a=!0===m?c?h.canvas.bounds:e.worldRenderBounds:m;else{let t=i.relative||(c?"inner":"local");switch(s=d.scaleX,r=d.scaleY,t){case"inner":x.set(d);break;case"local":x.set(d).divide(e.localTransform),s/=e.scaleX,r/=e.scaleY;break;case"world":s=1,r=1;break;case"page":t=e.leafer;default:x.set(d).divide(e.getTransform(t));const n=t.worldTransform;s/=s/n.scaleX,r/=r/n.scaleY}a=e.getBounds("render",t)}const b={scaleX:1,scaleY:1};t.MathHelper.getScaleData(i.scale,i.size,a,b);let B=i.pixelRatio||1;e.isApp&&(b.scaleX*=B,b.scaleY*=B,B=e.app.pixelRatio);const{x:E,y:R,width:L,height:k}=new t.Bounds(a).scale(b.scaleX,b.scaleY),S={matrix:x.scale(1/b.scaleX,1/b.scaleY).invert().translate(-E,-R).withScale(1/s*b.scaleX,1/r*b.scaleY)};let P,C=t.Creator.canvas({width:Math.round(L),height:Math.round(k),pixelRatio:B,smooth:_,contextSettings:w});if(f&&(P=e,P.__worldOpacity=0,e=h,S.bounds=C.bounds),C.save(),u&&void 0!==y){const t=e.get("fill");e.fill="",e.__render(C,S),e.fill=t}else e.__render(C,S);if(C.restore(),P&&P.__updateWorldOpacity(),p){o=function(e){const{width:n,height:i}=e.view,{data:a}=e.context.getImageData(0,0,n,i);let o,s,r,l=0;for(let t=0;t<a.length;t+=4)0!==a[t+3]&&(o=l%n,s=(l-o)/n,r?Qe(r,o,s):Ve(r={},o,s)),l++;const d=new t.Bounds;return Je(r,d),d.scale(1/e.pixelRatio).ceil()}(C);const e=C,{width:n,height:i}=o,a={x:0,y:0,width:n,height:i,pixelRatio:B};C=t.Creator.canvas(a),C.copyWorld(e,o,a)}v&&C.fillWorld(C.bounds,y||"#FFFFFF","destination-over"),g&&g(C);const O="canvas"===n?C:yield C.export(n,i);l({data:O,width:C.pixelWidth,height:C.pixelHeight,renderBounds:a,trimBounds:o})}))))):l({data:!1})}))))}};let Ke;function $e(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach((t=>$e(t)))}const tn=t.LeaferCanvasBase.prototype,en=t.Debug.get("@leafer-ui/export");tn.export=function(e,n){const{quality:i,blob:a}=t.FileHelper.getExportOptions(n);return e.includes(".")?this.saveAs(e,i):a?this.toBlob(e,i):this.toDataURL(e,i)},tn.toBlob=function(e,n){return new Promise((i=>{t.Platform.origin.canvasToBolb(this.view,e,n).then((t=>{i(t)})).catch((t=>{en.error(t),i(null)}))}))},tn.toDataURL=function(e,n){return t.Platform.origin.canvasToDataURL(this.view,e,n)},tn.saveAs=function(e,n){return new Promise((i=>{t.Platform.origin.canvasSaveAs(this.view,e,n).then((()=>{i(!0)})).catch((t=>{en.error(t),i(!1)}))}))},Object.assign(e.TextConvert,Ne),Object.assign(e.ColorConvert,qe),Object.assign(e.Paint,A),Object.assign(e.PaintImage,ft),Object.assign(e.PaintGradient,Ot),Object.assign(e.Effect,Ft),Object.assign(e.Export,Ze),a(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Layouter=m,exports.LeaferCanvas=n,exports.Renderer=v,exports.Watcher=s,exports.useCanvas=a,Object.keys(t).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})})),Object.keys(e).forEach((function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})}));
|