@leafer-draw/worker 1.6.0 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.cjs +59 -51
- package/dist/worker.esm.js +59 -51
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +106 -69
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +102 -69
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +9 -9
- package/dist/worker.cjs.map +0 -1
- package/dist/worker.esm.js.map +0 -1
- package/dist/worker.js.map +0 -1
- package/dist/worker.module.js.map +0 -1
package/dist/worker.js
CHANGED
|
@@ -2592,7 +2592,11 @@ var LeaferUI = (function (exports) {
|
|
|
2592
2592
|
const point = {};
|
|
2593
2593
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, point);
|
|
2594
2594
|
return point;
|
|
2595
|
-
}
|
|
2595
|
+
},
|
|
2596
|
+
getDerivative(t, fromV, v1, v2, toV) {
|
|
2597
|
+
const o = 1 - t;
|
|
2598
|
+
return 3 * o * o * (v1 - fromV) + 6 * o * t * (v2 - v1) + 3 * t * t * (toV - v2);
|
|
2599
|
+
},
|
|
2596
2600
|
};
|
|
2597
2601
|
const { getPointAndSet, toTwoPointBounds: toTwoPointBounds$1, ellipse: ellipse$6 } = BezierHelper;
|
|
2598
2602
|
|
|
@@ -3773,8 +3777,11 @@ var LeaferUI = (function (exports) {
|
|
|
3773
3777
|
load(onSuccess, onError) {
|
|
3774
3778
|
if (!this.loading) {
|
|
3775
3779
|
this.loading = true;
|
|
3780
|
+
let { loadImage, loadImageWithProgress } = Platform.origin, onProgress = this.config.showProgress && loadImageWithProgress && this.onProgress.bind(this);
|
|
3781
|
+
if (onProgress)
|
|
3782
|
+
loadImage = loadImageWithProgress;
|
|
3776
3783
|
Resource.tasker.add(() => __awaiter(this, void 0, void 0, function* () {
|
|
3777
|
-
return yield
|
|
3784
|
+
return yield loadImage(this.url, onProgress).then(img => this.setView(img)).catch((e) => {
|
|
3778
3785
|
this.error = e;
|
|
3779
3786
|
this.onComplete(false);
|
|
3780
3787
|
});
|
|
@@ -3799,6 +3806,9 @@ var LeaferUI = (function (exports) {
|
|
|
3799
3806
|
this.view = img;
|
|
3800
3807
|
this.onComplete(true);
|
|
3801
3808
|
}
|
|
3809
|
+
onProgress(progress) {
|
|
3810
|
+
this.progress = progress;
|
|
3811
|
+
}
|
|
3802
3812
|
onComplete(isSuccess) {
|
|
3803
3813
|
let odd;
|
|
3804
3814
|
this.waitComplete.forEach((item, index) => {
|
|
@@ -4264,13 +4274,20 @@ var LeaferUI = (function (exports) {
|
|
|
4264
4274
|
if (leaf.isBranch) {
|
|
4265
4275
|
const { children } = leaf;
|
|
4266
4276
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
4267
|
-
updateAllWorldOpacity
|
|
4277
|
+
updateAllWorldOpacity(children[i]);
|
|
4268
4278
|
}
|
|
4269
4279
|
}
|
|
4270
4280
|
},
|
|
4271
|
-
|
|
4272
|
-
|
|
4281
|
+
updateChange(leaf) {
|
|
4282
|
+
const layout = leaf.__layout;
|
|
4283
|
+
if (layout.stateStyleChanged)
|
|
4284
|
+
leaf.updateState();
|
|
4285
|
+
if (layout.opacityChanged)
|
|
4286
|
+
updateAllWorldOpacity(leaf);
|
|
4273
4287
|
leaf.__updateChange();
|
|
4288
|
+
},
|
|
4289
|
+
updateAllChange(leaf) {
|
|
4290
|
+
updateChange$1(leaf);
|
|
4274
4291
|
if (leaf.isBranch) {
|
|
4275
4292
|
const { children } = leaf;
|
|
4276
4293
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
@@ -4406,7 +4423,7 @@ var LeaferUI = (function (exports) {
|
|
|
4406
4423
|
}
|
|
4407
4424
|
};
|
|
4408
4425
|
const L = LeafHelper;
|
|
4409
|
-
const { updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity:
|
|
4426
|
+
const { updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1 } = L;
|
|
4410
4427
|
function getTempLocal(t, world) {
|
|
4411
4428
|
t.__layout.update();
|
|
4412
4429
|
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
|
|
@@ -6128,7 +6145,7 @@ var LeaferUI = (function (exports) {
|
|
|
6128
6145
|
}
|
|
6129
6146
|
}
|
|
6130
6147
|
|
|
6131
|
-
const version = "1.6.
|
|
6148
|
+
const version = "1.6.2";
|
|
6132
6149
|
|
|
6133
6150
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6134
6151
|
get allowBackgroundColor() { return true; }
|
|
@@ -6313,7 +6330,7 @@ var LeaferUI = (function (exports) {
|
|
|
6313
6330
|
}
|
|
6314
6331
|
}
|
|
6315
6332
|
|
|
6316
|
-
const { updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds,
|
|
6333
|
+
const { updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds, updateChange: updateOneChange } = LeafHelper;
|
|
6317
6334
|
const { pushAllChildBranch, pushAllParent } = BranchHelper;
|
|
6318
6335
|
function updateMatrix(updateList, levelList) {
|
|
6319
6336
|
let layout;
|
|
@@ -6356,15 +6373,7 @@ var LeaferUI = (function (exports) {
|
|
|
6356
6373
|
});
|
|
6357
6374
|
}
|
|
6358
6375
|
function updateChange(updateList) {
|
|
6359
|
-
|
|
6360
|
-
updateList.list.forEach(leaf => {
|
|
6361
|
-
layout = leaf.__layout;
|
|
6362
|
-
if (layout.opacityChanged)
|
|
6363
|
-
updateAllWorldOpacity(leaf);
|
|
6364
|
-
if (layout.stateStyleChanged)
|
|
6365
|
-
setTimeout(() => layout.stateStyleChanged && leaf.updateState());
|
|
6366
|
-
leaf.__updateChange();
|
|
6367
|
-
});
|
|
6376
|
+
updateList.list.forEach(updateOneChange);
|
|
6368
6377
|
}
|
|
6369
6378
|
|
|
6370
6379
|
const { worldBounds } = LeafBoundsHelper;
|
|
@@ -6585,6 +6594,15 @@ var LeaferUI = (function (exports) {
|
|
|
6585
6594
|
}
|
|
6586
6595
|
checkRender() {
|
|
6587
6596
|
if (this.running) {
|
|
6597
|
+
const { target } = this;
|
|
6598
|
+
if (target.isApp) {
|
|
6599
|
+
target.emit(RenderEvent.CHILD_START, target);
|
|
6600
|
+
target.children.forEach(leafer => {
|
|
6601
|
+
leafer.renderer.FPS = this.FPS;
|
|
6602
|
+
leafer.renderer.checkRender();
|
|
6603
|
+
});
|
|
6604
|
+
target.emit(RenderEvent.CHILD_END, target);
|
|
6605
|
+
}
|
|
6588
6606
|
if (this.changed && this.canvas.view)
|
|
6589
6607
|
this.render();
|
|
6590
6608
|
this.target.emit(RenderEvent.NEXT);
|
|
@@ -6670,7 +6688,7 @@ var LeaferUI = (function (exports) {
|
|
|
6670
6688
|
bounds.spread(Renderer.clipSpread).ceil();
|
|
6671
6689
|
canvas.clearWorld(bounds, true);
|
|
6672
6690
|
canvas.clipWorld(bounds, true);
|
|
6673
|
-
this.__render(bounds,
|
|
6691
|
+
this.__render(bounds, realBounds);
|
|
6674
6692
|
canvas.restore();
|
|
6675
6693
|
Run.end(t);
|
|
6676
6694
|
}
|
|
@@ -6679,12 +6697,12 @@ var LeaferUI = (function (exports) {
|
|
|
6679
6697
|
const { canvas } = this;
|
|
6680
6698
|
canvas.save();
|
|
6681
6699
|
canvas.clear();
|
|
6682
|
-
this.__render(canvas.bounds
|
|
6700
|
+
this.__render(canvas.bounds);
|
|
6683
6701
|
canvas.restore();
|
|
6684
6702
|
Run.end(t);
|
|
6685
6703
|
}
|
|
6686
|
-
__render(bounds,
|
|
6687
|
-
const { canvas } = this, options = includes ? { includes } : { bounds, includes };
|
|
6704
|
+
__render(bounds, realBounds) {
|
|
6705
|
+
const { canvas } = this, includes = bounds.includes(this.target.__world), options = includes ? { includes } : { bounds, includes };
|
|
6688
6706
|
if (this.needFill)
|
|
6689
6707
|
canvas.fillWorld(bounds, this.config.fill);
|
|
6690
6708
|
if (Debug.showRepaint)
|
|
@@ -6711,22 +6729,14 @@ var LeaferUI = (function (exports) {
|
|
|
6711
6729
|
}
|
|
6712
6730
|
__requestRender() {
|
|
6713
6731
|
const target = this.target;
|
|
6714
|
-
if (target
|
|
6715
|
-
return target.parentApp.renderer.update(false);
|
|
6716
|
-
if (this.requestTime)
|
|
6732
|
+
if (this.requestTime || !target)
|
|
6717
6733
|
return;
|
|
6734
|
+
if (target.parentApp)
|
|
6735
|
+
return target.parentApp.requestRender(false);
|
|
6718
6736
|
const requestTime = this.requestTime = Date.now();
|
|
6719
6737
|
Platform.requestRender(() => {
|
|
6720
6738
|
this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - requestTime)));
|
|
6721
6739
|
this.requestTime = 0;
|
|
6722
|
-
if (target.isApp) {
|
|
6723
|
-
target.emit(RenderEvent.CHILD_START, target);
|
|
6724
|
-
target.children.forEach(leafer => {
|
|
6725
|
-
leafer.renderer.FPS = this.FPS;
|
|
6726
|
-
leafer.renderer.checkRender();
|
|
6727
|
-
});
|
|
6728
|
-
target.emit(RenderEvent.CHILD_END, target);
|
|
6729
|
-
}
|
|
6730
6740
|
this.checkRender();
|
|
6731
6741
|
});
|
|
6732
6742
|
}
|
|
@@ -7051,13 +7061,11 @@ var LeaferUI = (function (exports) {
|
|
|
7051
7061
|
setFontWeight(value) {
|
|
7052
7062
|
if (typeof value === 'string') {
|
|
7053
7063
|
this.__setInput('fontWeight', value);
|
|
7054
|
-
|
|
7055
|
-
}
|
|
7056
|
-
else {
|
|
7057
|
-
if (this.__input)
|
|
7058
|
-
this.__removeInput('fontWeight');
|
|
7059
|
-
this._fontWeight = value;
|
|
7064
|
+
value = fontWeightMap[value] || 400;
|
|
7060
7065
|
}
|
|
7066
|
+
else if (this.__input)
|
|
7067
|
+
this.__removeInput('fontWeight');
|
|
7068
|
+
this._fontWeight = value;
|
|
7061
7069
|
}
|
|
7062
7070
|
setBoxStyle(value) {
|
|
7063
7071
|
let t = this.__leaf, box = t.__box;
|
|
@@ -7384,6 +7392,9 @@ var LeaferUI = (function (exports) {
|
|
|
7384
7392
|
else
|
|
7385
7393
|
drawer.rect(x, y, width, height);
|
|
7386
7394
|
}
|
|
7395
|
+
drawImagePlaceholder(canvas, _image) {
|
|
7396
|
+
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
7397
|
+
}
|
|
7387
7398
|
animate(_keyframe, _options, _type, _isTemp) {
|
|
7388
7399
|
return Plugin.need('animate');
|
|
7389
7400
|
}
|
|
@@ -7620,6 +7631,9 @@ var LeaferUI = (function (exports) {
|
|
|
7620
7631
|
__decorate([
|
|
7621
7632
|
effectType()
|
|
7622
7633
|
], exports.UI.prototype, "filter", void 0);
|
|
7634
|
+
__decorate([
|
|
7635
|
+
surfaceType()
|
|
7636
|
+
], exports.UI.prototype, "placeholderColor", void 0);
|
|
7623
7637
|
__decorate([
|
|
7624
7638
|
dataType({})
|
|
7625
7639
|
], exports.UI.prototype, "data", void 0);
|
|
@@ -8450,10 +8464,11 @@ var LeaferUI = (function (exports) {
|
|
|
8450
8464
|
get ready() { return this.image ? this.image.ready : false; }
|
|
8451
8465
|
constructor(data) {
|
|
8452
8466
|
super(data);
|
|
8453
|
-
this.
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8467
|
+
this.on_(ImageEvent.LOADED, this.__onLoaded, this);
|
|
8468
|
+
}
|
|
8469
|
+
__onLoaded(e) {
|
|
8470
|
+
if (e.attrName === 'fill' && e.attrValue.url === this.url)
|
|
8471
|
+
this.image = e.image;
|
|
8457
8472
|
}
|
|
8458
8473
|
destroy() {
|
|
8459
8474
|
this.image = null;
|
|
@@ -8567,7 +8582,7 @@ var LeaferUI = (function (exports) {
|
|
|
8567
8582
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
8568
8583
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
8569
8584
|
data.__clipText = textOverflow !== 'show' && !data.__autoSize;
|
|
8570
|
-
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8585
|
+
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === '') ? data.placeholder : data.text, this.__);
|
|
8571
8586
|
}
|
|
8572
8587
|
__updateBoxBounds() {
|
|
8573
8588
|
const data = this.__;
|
|
@@ -8665,6 +8680,9 @@ var LeaferUI = (function (exports) {
|
|
|
8665
8680
|
__decorate([
|
|
8666
8681
|
boundsType('')
|
|
8667
8682
|
], exports.Text.prototype, "text", void 0);
|
|
8683
|
+
__decorate([
|
|
8684
|
+
boundsType('')
|
|
8685
|
+
], exports.Text.prototype, "placeholder", void 0);
|
|
8668
8686
|
__decorate([
|
|
8669
8687
|
boundsType('caption')
|
|
8670
8688
|
], exports.Text.prototype, "fontFamily", void 0);
|
|
@@ -8784,8 +8802,10 @@ var LeaferUI = (function (exports) {
|
|
|
8784
8802
|
}
|
|
8785
8803
|
|
|
8786
8804
|
function fillText(ui, canvas) {
|
|
8787
|
-
|
|
8788
|
-
|
|
8805
|
+
const data = ui.__, { rows, decorationY } = data.__textDrawData;
|
|
8806
|
+
if (data.__isPlacehold && data.placeholderColor)
|
|
8807
|
+
canvas.fillStyle = data.placeholderColor;
|
|
8808
|
+
let row;
|
|
8789
8809
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
8790
8810
|
row = rows[i];
|
|
8791
8811
|
if (row.text)
|
|
@@ -8794,7 +8814,7 @@ var LeaferUI = (function (exports) {
|
|
|
8794
8814
|
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
8795
8815
|
}
|
|
8796
8816
|
if (decorationY) {
|
|
8797
|
-
const { decorationColor, decorationHeight } = data;
|
|
8817
|
+
const { decorationColor, decorationHeight } = data.__textDrawData;
|
|
8798
8818
|
if (decorationColor)
|
|
8799
8819
|
canvas.fillStyle = decorationColor;
|
|
8800
8820
|
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
@@ -8803,38 +8823,44 @@ var LeaferUI = (function (exports) {
|
|
|
8803
8823
|
|
|
8804
8824
|
function fill(fill, ui, canvas) {
|
|
8805
8825
|
canvas.fillStyle = fill;
|
|
8806
|
-
|
|
8826
|
+
fillPathOrText(ui, canvas);
|
|
8807
8827
|
}
|
|
8808
8828
|
function fills(fills, ui, canvas) {
|
|
8809
8829
|
let item;
|
|
8810
|
-
const { windingRule, __font } = ui.__;
|
|
8811
8830
|
for (let i = 0, len = fills.length; i < len; i++) {
|
|
8812
8831
|
item = fills[i];
|
|
8813
|
-
if (item.image
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
|
|
8819
|
-
|
|
8820
|
-
if (item.blendMode)
|
|
8821
|
-
canvas.blendMode = item.blendMode;
|
|
8822
|
-
__font ? fillText(ui, canvas) : (windingRule ? canvas.fill(windingRule) : canvas.fill());
|
|
8823
|
-
canvas.restore();
|
|
8832
|
+
if (item.image) {
|
|
8833
|
+
if (PaintImage.checkImage(ui, canvas, item, !ui.__.__font))
|
|
8834
|
+
continue;
|
|
8835
|
+
if (!item.style) {
|
|
8836
|
+
if (!i && item.image.isPlacehold)
|
|
8837
|
+
ui.drawImagePlaceholder(canvas, item.image);
|
|
8838
|
+
continue;
|
|
8824
8839
|
}
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
|
|
8840
|
+
}
|
|
8841
|
+
canvas.fillStyle = item.style;
|
|
8842
|
+
if (item.transform) {
|
|
8843
|
+
canvas.save();
|
|
8844
|
+
canvas.transform(item.transform);
|
|
8845
|
+
if (item.blendMode)
|
|
8846
|
+
canvas.blendMode = item.blendMode;
|
|
8847
|
+
fillPathOrText(ui, canvas);
|
|
8848
|
+
canvas.restore();
|
|
8849
|
+
}
|
|
8850
|
+
else {
|
|
8851
|
+
if (item.blendMode) {
|
|
8852
|
+
canvas.saveBlendMode(item.blendMode);
|
|
8853
|
+
fillPathOrText(ui, canvas);
|
|
8854
|
+
canvas.restoreBlendMode();
|
|
8834
8855
|
}
|
|
8856
|
+
else
|
|
8857
|
+
fillPathOrText(ui, canvas);
|
|
8835
8858
|
}
|
|
8836
8859
|
}
|
|
8837
8860
|
}
|
|
8861
|
+
function fillPathOrText(ui, canvas) {
|
|
8862
|
+
ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
|
|
8863
|
+
}
|
|
8838
8864
|
|
|
8839
8865
|
function strokeText(stroke, ui, canvas) {
|
|
8840
8866
|
const { strokeAlign } = ui.__;
|
|
@@ -9074,6 +9100,7 @@ var LeaferUI = (function (exports) {
|
|
|
9074
9100
|
compute,
|
|
9075
9101
|
fill,
|
|
9076
9102
|
fills,
|
|
9103
|
+
fillPathOrText,
|
|
9077
9104
|
fillText,
|
|
9078
9105
|
stroke,
|
|
9079
9106
|
strokes,
|
|
@@ -9266,6 +9293,13 @@ var LeaferUI = (function (exports) {
|
|
|
9266
9293
|
onLoadError(ui, event, error);
|
|
9267
9294
|
leafPaint.loadId = null;
|
|
9268
9295
|
});
|
|
9296
|
+
if (ui.placeholderColor)
|
|
9297
|
+
setTimeout(() => {
|
|
9298
|
+
if (!(image.ready || image.isPlacehold)) {
|
|
9299
|
+
image.isPlacehold = true;
|
|
9300
|
+
ui.forceUpdate('surface');
|
|
9301
|
+
}
|
|
9302
|
+
}, 100);
|
|
9269
9303
|
}
|
|
9270
9304
|
return leafPaint;
|
|
9271
9305
|
}
|
|
@@ -10459,4 +10493,7 @@ var LeaferUI = (function (exports) {
|
|
|
10459
10493
|
return exports;
|
|
10460
10494
|
|
|
10461
10495
|
})({});
|
|
10462
|
-
|
|
10496
|
+
|
|
10497
|
+
function Leafer(opt) { return new LeaferUI.Leafer(opt); }
|
|
10498
|
+
Object.setPrototypeOf(Leafer, LeaferUI);
|
|
10499
|
+
Leafer.prototype = LeaferUI.Leafer.prototype;
|
package/dist/worker.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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:a}=t.FileHelper;function i(e,n){t.Platform.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,n)=>new Promise(((i,r)=>{t.convertToBlob({type:a(e),quality:n}).then((t=>{var e=new FileReader;e.onload=t=>i(t.target.result),e.onerror=t=>r(t),e.readAsDataURL(t)})).catch((t=>{r(t)}))})),canvasToBolb:(t,e,n)=>t.convertToBlob({type:a(e),quality:n}),canvasSaveAs:(t,e,n)=>new Promise((t=>t())),download(t,e){},loadImage:e=>new Promise(((n,a)=>{let i=new XMLHttpRequest;i.open("GET",t.Platform.image.getRealURL(e),!0),i.responseType="blob",i.onload=()=>{createImageBitmap(i.response).then((t=>{n(t)})).catch((t=>{a(t)}))},i.onerror=t=>a(t),i.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.backgrounder=!0,t.Platform.requestRender=function(t){requestAnimationFrame(t)},t.defineKey(t.Platform,"devicePixelRatio",{get:()=>1});const{userAgent:r}=navigator;r.indexOf("Firefox")>-1?(t.Platform.conicGradientRotate90=!0,t.Platform.intWheelDeltaY=!0):r.indexOf("Safari")>-1&&-1===r.indexOf("Chrome")&&(t.Platform.fullImageShadow=!0),r.indexOf("Windows")>-1?(t.Platform.os="Windows",t.Platform.intWheelDeltaY=!0):r.indexOf("Mac")>-1?t.Platform.os="Mac":r.indexOf("Linux")>-1&&(t.Platform.os="Linux");class o{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:s,updateBounds:d,updateAllWorldOpacity:l}=t.LeafHelper,{pushAllChildBranch:c,pushAllParent:h}=t.BranchHelper;const{worldBounds:u}=t.LeafBoundsHelper;class f{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(){this.afterBounds.setListWithFn(this.updatedList.list,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:p,updateAllChange:g}=t.LeafHelper,_=t.Debug.get("Layouter");class y{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){_.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?_.warn("layouting"):this.times>3?_.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:a,__updatedList:i}=this,{BEFORE:r,LAYOUT:o,AFTER:u}=t.LayoutEvent,f=this.getBlocks(i);f.forEach((t=>t.setBefore())),a.emitEvent(new t.LayoutEvent(r,f,this.times)),this.extraBlock=null,i.sort(),function(t,e){let n;t.list.forEach((t=>{n=t.__layout,e.without(t)&&!n.proxyZoom&&(n.matrixChanged?(s(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)))}))}(i,this.__levelList),function(t){let e,n,a;t.sort(!0),t.levels.forEach((i=>{e=t.levelMap[i];for(let t=0,i=e.length;t<i;t++){if(n=e[t],n.isBranch&&n.__tempNumber){a=n.children;for(let t=0,e=a.length;t<e;t++)a[t].isBranch||d(a[t])}d(n)}}))}(this.__levelList),function(t){let e;t.list.forEach((t=>{e=t.__layout,e.opacityChanged&&l(t),e.stateStyleChanged&&setTimeout((()=>e.stateStyleChanged&&t.updateState())),t.__updateChange()}))}(i),this.extraBlock&&f.push(this.extraBlock),f.forEach((t=>t.setAfter())),a.emitEvent(new t.LayoutEvent(o,f,this.times)),a.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:a,LAYOUT:i,AFTER:r}=t.LayoutEvent,o=this.getBlocks(new t.LeafList(n));n.emitEvent(new t.LayoutEvent(a,o,this.times)),y.fullLayout(n),o.forEach((t=>{t.setAfter()})),n.emitEvent(new t.LayoutEvent(i,o,this.times)),n.emitEvent(new t.LayoutEvent(r,o,this.times)),this.addBlocks(o),t.Run.end(e)}static fullLayout(e){p(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),g(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:n}=this.extraBlock||(this.extraBlock=new f([]));e.length?n.add(t.__world):n.set(t.__world),e.add(t)}}createBlock(t){return new f(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 w=t.Debug.get("Renderer");class m{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,n,a){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=e,this.canvas=n,a&&(this.config=t.DataHelper.default(a,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}checkRender(){this.running&&(this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT))}render(e){if(!this.running||!this.canvas.view)return this.update();const{target:n}=this;this.times=0,this.totalBounds=new t.Bounds,w.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,w.error(t)}w.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){if(this.rendering)return w.warn("rendering");if(this.times>3)return w.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;e&&(this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)})))}clipRender(e){const n=t.Run.start("PartRender"),{canvas:a}=this,i=e.getIntersect(a.bounds),r=new t.Bounds(i);a.save(),i.spread(m.clipSpread).ceil(),a.clearWorld(i,!0),a.clipWorld(i,!0),this.__render(i,e.includes(this.target.__world),r),a.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,a){const{canvas:i}=this,r=n?{includes:n}:{bounds:e,includes:n};this.needFill&&i.fillWorld(e,this.config.fill),t.Debug.showRepaint&&t.Debug.drawRepaint(i,e),this.target.__render(i,r),this.renderBounds=a=a||e,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=a:this.totalBounds.add(a),i.updateRender(a)}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=this.target;if(e.parentApp)return e.parentApp.renderer.update(!1);if(this.requestTime)return;const n=this.requestTime=Date.now();t.Platform.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-n))),this.requestTime=0,e.isApp&&(e.emit(t.RenderEvent.CHILD_START,e),e.children.forEach((t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()})),e.emit(t.RenderEvent.CHILD_END,e)),this.checkRender()}))}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:n,height:a}=e.old;if(!new t.Bounds(0,0,n,a).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.update()}}__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||w.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(e,n,a){this.target.emitEvent(new t.RenderEvent(e,this.times,n,a))}__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 v(t,e){let n,a=t.__.__textDrawData;const{rows:i,decorationY:r}=a;for(let t=0,a=i.length;t<a;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)}));if(r){const{decorationColor:t,decorationHeight:n}=a;t&&(e.fillStyle=t),i.forEach((t=>r.forEach((a=>e.fillRect(t.x,t.y+a,t.width,n)))))}}function x(t,e,n){const{strokeAlign:a}=e.__,i="string"!=typeof t;switch(a){case"center":n.setStroke(i?void 0:t,e.__.strokeWidth,e.__),i?B(t,!0,e,n):E(e,n);break;case"inside":b("inside",t,i,e,n);break;case"outside":b("outside",t,i,e,n)}}function b(t,e,n,a,i){const{__strokeWidth:r,__font:o}=a.__,s=i.getSameCanvas(!0,!0);s.setStroke(n?void 0:e,2*r,a.__),s.font=o,n?B(e,!0,a,s):E(a,s),s.blendMode="outside"===t?"destination-out":"destination-in",v(a,s),s.blendMode="normal",a.__worldFlipped?i.copyWorldByReset(s,a.__nowWorld):i.copyWorldToInner(s,a.__nowWorld,a.__layout.renderBounds),s.recycle(a.__nowWorld)}function E(t,e){let n,a=t.__.__textDrawData;const{rows:i,decorationY:r}=a;for(let t=0,a=i.length;t<a;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)}));if(r){const{decorationHeight:t}=a;i.forEach((n=>r.forEach((a=>e.strokeRect(n.x,n.y+a,n.width,t)))))}}function B(t,n,a,i){let r;for(let o=0,s=t.length;o<s;o++)r=t[o],r.image&&e.PaintImage.checkImage(a,i,r,!1)||r.style&&(i.strokeStyle=r.style,r.blendMode?(i.saveBlendMode(r.blendMode),n?E(a,i):i.stroke(),i.restoreBlendMode()):n?E(a,i):i.stroke())}function R(t,e){t.__.dashPattern&&(e.beginPath(),t.__drawPathByData(e,t.__.__pathForArrow),e.dashPattern=null,e.stroke())}m.clipSpread=10,Object.assign(t.Creator,{watcher:(t,e)=>new o(t,e),layouter:(t,e)=>new y(t,e),renderer:(t,e,n)=>new m(t,e,n),selector:(t,e)=>{},interaction:(t,e,n,a)=>{}}),t.Platform.layout=y.fullLayout;const{getSpread:L,getOuterOf:k,getByMove:S,getIntersectData:P}=t.BoundsHelper;let C;function A(t,n,a){if("object"!=typeof n||!1===n.visible||0===n.opacity)return;const{boxBounds:i}=a.__layout;switch(n.type){case"solid":let{type:r,blendMode:o,color:s,opacity:d}=n;return{type:r,blendMode:o,style:e.ColorConvert.string(s,d)};case"image":return e.PaintImage.image(a,t,n,i,!C||!C[n.url]);case"linear":return e.PaintGradient.linearGradient(n,i);case"radial":return e.PaintGradient.radialGradient(n,i);case"angular":return e.PaintGradient.conicGradient(n,i);default:return void 0!==n.r?{type:"solid",style:e.ColorConvert.string(n)}:void 0}}const W={compute:function(t,n){const a=n.__,i=[];let r,o=a.__input[t];o instanceof Array||(o=[o]),C=e.PaintImage.recycleImage(t,a);for(let e,a=0,r=o.length;a<r;a++)e=A(t,o[a],n),e&&i.push(e);a["_"+t]=i.length?i:void 0,i.length&&i[0].image&&(r=i[0].image.hasOpacityPixel),"fill"===t?a.__pixelFill=r:a.__pixelStroke=r},fill:function(t,e,n){n.fillStyle=t,e.__.__font?v(e,n):e.__.windingRule?n.fill(e.__.windingRule):n.fill()},fills:function(t,n,a){let i;const{windingRule:r,__font:o}=n.__;for(let s=0,d=t.length;s<d;s++)i=t[s],i.image&&e.PaintImage.checkImage(n,a,i,!o)||i.style&&(a.fillStyle=i.style,i.transform?(a.save(),a.transform(i.transform),i.blendMode&&(a.blendMode=i.blendMode),o?v(n,a):r?a.fill(r):a.fill(),a.restore()):i.blendMode?(a.saveBlendMode(i.blendMode),o?v(n,a):r?a.fill(r):a.fill(),a.restoreBlendMode()):o?v(n,a):r?a.fill(r):a.fill())},fillText:v,stroke:function(t,e,n){const a=e.__,{__strokeWidth:i,strokeAlign:r,__font:o}=a;if(i)if(o)x(t,e,n);else switch(r){case"center":n.setStroke(t,i,a),n.stroke(),a.__useArrow&&R(e,n);break;case"inside":n.save(),n.setStroke(t,2*i,a),a.windingRule?n.clip(a.windingRule):n.clip(),n.stroke(),n.restore();break;case"outside":const r=n.getSameCanvas(!0,!0);r.setStroke(t,2*i,a),e.__drawRenderPath(r),r.stroke(),a.windingRule?r.clip(a.windingRule):r.clip(),r.clearWorld(e.__layout.renderBounds),e.__worldFlipped?n.copyWorldByReset(r,e.__nowWorld):n.copyWorldToInner(r,e.__nowWorld,e.__layout.renderBounds),r.recycle(e.__nowWorld)}},strokes:function(t,e,n){const a=e.__,{__strokeWidth:i,strokeAlign:r,__font:o}=a;if(i)if(o)x(t,e,n);else switch(r){case"center":n.setStroke(void 0,i,a),B(t,!1,e,n),a.__useArrow&&R(e,n);break;case"inside":n.save(),n.setStroke(void 0,2*i,a),a.windingRule?n.clip(a.windingRule):n.clip(),B(t,!1,e,n),n.restore();break;case"outside":const{renderBounds:r}=e.__layout,o=n.getSameCanvas(!0,!0);e.__drawRenderPath(o),o.setStroke(void 0,2*i,a),B(t,!1,e,o),a.windingRule?o.clip(a.windingRule):o.clip(),o.clearWorld(r),e.__worldFlipped?n.copyWorldByReset(o,e.__nowWorld):n.copyWorldToInner(o,e.__nowWorld,r),o.recycle(e.__nowWorld)}},strokeText:x,drawTextStroke:E,shape:function(t,e,n){const a=e.getSameCanvas(),i=t.__nowWorld;let r,o,s,d,{scaleX:l,scaleY:c}=i;if(l<0&&(l=-l),c<0&&(c=-c),e.bounds.includes(i))d=a,r=s=i;else{const{renderShapeSpread:a}=t.__layout,h=P(a?L(e.bounds,l===c?a*l:[a*c,a*l]):e.bounds,i);o=e.bounds.getFitMatrix(h);let{a:u,d:f}=o;if(o.a<1&&(d=e.getSameCanvas(),t.__renderShape(d,n),l*=u,c*=f),s=k(i,o),r=S(s,-o.e,-o.f),n.matrix){const{matrix:t}=n;o.multiply(t),u*=t.scaleX,f*=t.scaleY}n=Object.assign(Object.assign({},n),{matrix:o.withScale(u,f)})}return t.__renderShape(a,n),{canvas:a,matrix:o,bounds:r,worldCanvas:d,shapeBounds:s,scaleX:l,scaleY:c}}};let O={};const{get:M,rotateOfOuter:T,translate:I,scaleOfOuter:D,scale:H,rotate:F}=t.MatrixHelper;function G(t,e,n,a,i,r,o){const s=M();I(s,e.x+n,e.y+a),H(s,i,r),o&&T(s,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=s}function j(t,e,n,a,i,r,o){const s=M();I(s,e.x+n,e.y+a),i&&H(s,i,r),o&&F(s,o),t.transform=s}function z(t,e,n,a,i,r,o,s,d,l){const c=M();if(d)if("center"===l)T(c,{x:n/2,y:a/2},d);else switch(F(c,d),d){case 90:I(c,a,0);break;case 180:I(c,n,a);break;case 270:I(c,0,n)}O.x=e.x+i,O.y=e.y+r,I(c,O.x,O.y),o&&D(c,O,o,s),t.transform=c}const{get:Y,translate:q}=t.MatrixHelper,N=new t.Bounds,U={},X={};function V(t,e,n,a){const{blendMode:i,changeful:r,sync:o}=n;i&&(t.blendMode=i),r&&(t.changeful=r),o&&(t.sync=o),t.data=Q(n,a,e)}function Q(e,n,a){let{width:i,height:r}=a;e.padding&&(n=N.set(n).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");const{opacity:o,mode:s,align:d,offset:l,scale:c,size:h,rotation:u,repeat:f,filters:p}=e,g=n.width===i&&n.height===r,_={mode:s},y="center"!==d&&(u||0)%180==90,w=y?r:i,m=y?i:r;let v,x,b=0,E=0;if(s&&"cover"!==s&&"fit"!==s)(c||h)&&(t.MathHelper.getScaleData(c,h,a,X),v=X.scaleX,x=X.scaleY);else if(!g||u){const t=n.width/w,e=n.height/m;v=x="fit"===s?Math.min(t,e):Math.max(t,e),b+=(n.width-i*v)/2,E+=(n.height-r*x)/2}if(d){const e={x:b,y:E,width:w,height:m};v&&(e.width*=v,e.height*=x),t.AlignHelper.toPoint(d,e,n,U,!0),b+=U.x,E+=U.y}switch(l&&(b+=l.x,E+=l.y),s){case"stretch":g||(i=n.width,r=n.height);break;case"normal":case"clip":(b||E||v||u)&&j(_,n,b,E,v,x,u);break;case"repeat":(!g||v||u)&&z(_,n,i,r,b,E,v,x,u,d),f||(_.repeat="repeat");break;default:v&&G(_,n,b,E,v,x,u)}return _.transform||(n.x||n.y)&&(_.transform=Y(),q(_.transform,n.x,n.y)),v&&"stretch"!==s&&(_.scaleX=v,_.scaleY=x),_.width=i,_.height=r,o&&(_.opacity=o),p&&(_.filters=p),f&&(_.repeat="string"==typeof f?"x"===f?"repeat-x":"repeat-y":"repeat"),_}let Z,K=new t.Bounds;const{isSame:$}=t.BoundsHelper;function J(t,e,n,a,i,r){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=a.width/e.pixelRatio,e.__naturalHeight=a.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return i.data||V(i,a,n,r),!0}function tt(e,n){at(e,t.ImageEvent.LOAD,n)}function et(e,n){at(e,t.ImageEvent.LOADED,n)}function nt(e,n,a){n.error=a,e.forceUpdate("surface"),at(e,t.ImageEvent.ERROR,n)}function at(e,n,a){e.hasEvent(n)&&e.emitEvent(new t.ImageEvent(n,a))}function it(t,e){const{leafer:n}=t;n&&n.viewReady&&(n.renderer.ignore=e)}const{get:rt,scale:ot,copy:st}=t.MatrixHelper,{ceil:dt,abs:lt}=Math;function ct(e,n,a){let{scaleX:i,scaleY:r}=t.ImageManager.patternLocked?e.__world:e.__nowWorld;const o=i+"-"+r+"-"+a;if(n.patternId===o||e.destroyed)return!1;{i=lt(i),r=lt(r);const{image:e,data:s}=n;let d,l,{width:c,height:h,scaleX:u,scaleY:f,transform:p,repeat:g}=s;u&&(l=rt(),st(l,p),ot(l,1/u,1/f),i*=u,r*=f),i*=a,r*=a,c*=i,h*=r;const _=c*h;if(!g&&_>t.Platform.image.maxCacheSize)return!1;let y=t.Platform.image.maxPatternSize;if(!e.isSVG){const t=e.width*e.height;y>t&&(y=t)}_>y&&(d=Math.sqrt(_/y)),d&&(i/=d,r/=d,c/=d,h/=d),u&&(i/=u,r/=f),(p||1!==i||1!==r)&&(l||(l=rt(),p&&st(l,p)),ot(l,1/i,1/r));const w=e.getCanvas(dt(c)||1,dt(h)||1,s.opacity,s.filters),m=e.getPattern(w,g||t.Platform.origin.noRepeat||"no-repeat",l,n);return n.style=m,n.patternId=o,!0}}function ht(t,e,n,a){return new(n||(n=Promise))((function(i,r){function o(t){try{d(a.next(t))}catch(t){r(t)}}function s(t){try{d(a.throw(t))}catch(t){r(t)}}function d(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}d((a=a.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const{abs:ut}=Math;const ft={image:function(e,n,a,i,r){let o,s;const d=t.ImageManager.get(a);return Z&&a===Z.paint&&$(i,Z.boxBounds)?o=Z.leafPaint:(o={type:a.type,image:d},Z=d.use>1?{leafPaint:o,paint:a,boxBounds:K.set(i)}:null),(r||d.loading)&&(s={image:d,attrName:n,attrValue:a}),d.ready?(J(e,n,a,d,o,i),r&&(tt(e,s),et(e,s))):d.error?r&&nt(e,s,d.error):(r&&(it(e,!0),tt(e,s)),o.loadId=d.load((()=>{it(e,!1),e.destroyed||(J(e,n,a,d,o,i)&&(d.hasOpacityPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),et(e,s)),o.loadId=null}),(t=>{it(e,!1),nt(e,s,t),o.loadId=null}))),o},checkImage:function(n,a,i,r){const{scaleX:o,scaleY:s}=t.ImageManager.patternLocked?n.__world:n.__nowWorld,{pixelRatio:d}=a,{data:l}=i;if(!l||i.patternId===o+"-"+s+"-"+d&&!e.Export.running)return!1;if(r)if(l.repeat)r=!1;else if(!(i.changeful||t.ResizeEvent.isResizing(n)||e.Export.running)){let{width:e,height:n}=l;e*=ut(o)*d,n*=ut(s)*d,l.scaleX&&(e*=l.scaleX,n*=l.scaleY),r=e*n>t.Platform.image.maxCacheSize}return r?(function(t,e,n,a){e.save(),t.windingRule?e.clip(t.windingRule):e.clip(),n.blendMode&&(e.blendMode=n.blendMode);a.opacity&&(e.opacity*=a.opacity);a.transform&&e.transform(a.transform);e.drawImage(n.image.getFull(a.filters),0,0,a.width,a.height),e.restore()}(n,a,i,l),!0):(!i.style||i.sync||e.Export.running?ct(n,i,d):i.patternTask||(i.patternTask=t.ImageManager.patternTasker.add((()=>ht(this,void 0,void 0,(function*(){i.patternTask=null,a.bounds.hit(n.__nowWorld)&&ct(n,i,d),n.forceUpdate("surface")}))),300)),!1)},createPattern:ct,recycleImage:function(e,n){const a=n["_"+e];if(a instanceof Array){let i,r,o,s,d;for(let l=0,c=a.length;l<c;l++)i=a[l],r=i.image,d=r&&r.url,d&&(o||(o={}),o[d]=!0,t.ImageManager.recycle(r),r.loading&&(s||(s=n.__input&&n.__input[e]||[],s instanceof Array||(s=[s])),r.unload(a[l].loadId,!s.some((t=>t.url===d)))));return o}return null},createData:V,getPatternData:Q,fillOrFitMode:G,clipMode:j,repeatMode:z},{toPoint:pt}=t.AroundHelper,gt={},_t={};function yt(t,n,a){if(n){let i;for(let r=0,o=n.length;r<o;r++)i=n[r],"string"==typeof i?t.addColorStop(r/(o-1),e.ColorConvert.string(i,a)):t.addColorStop(i.offset,e.ColorConvert.string(i.color,a))}}const{getAngle:wt,getDistance:mt}=t.PointHelper,{get:vt,rotateOfOuter:xt,scaleOfOuter:bt}=t.MatrixHelper,{toPoint:Et}=t.AroundHelper,Bt={},Rt={};function Lt(t,e,n,a,i){let r;const{width:o,height:s}=t;if(o!==s||a){const t=wt(e,n);r=vt(),i?(bt(r,e,o/s*(a||1),1),xt(r,e,t+90)):(bt(r,e,1,o/s*(a||1)),xt(r,e,t))}return r}const{getDistance:kt}=t.PointHelper,{toPoint:St}=t.AroundHelper,Pt={},Ct={};const At={linearGradient:function(e,n){let{from:a,to:i,type:r,blendMode:o,opacity:s}=e;pt(a||"top",n,gt),pt(i||"bottom",n,_t);const d=t.Platform.canvas.createLinearGradient(gt.x,gt.y,_t.x,_t.y);yt(d,e.stops,s);const l={type:r,style:d};return o&&(l.blendMode=o),l},radialGradient:function(e,n){let{from:a,to:i,type:r,opacity:o,blendMode:s,stretch:d}=e;Et(a||"center",n,Bt),Et(i||"bottom",n,Rt);const l=t.Platform.canvas.createRadialGradient(Bt.x,Bt.y,0,Bt.x,Bt.y,mt(Bt,Rt));yt(l,e.stops,o);const c={type:r,style:l},h=Lt(n,Bt,Rt,d,!0);return h&&(c.transform=h),s&&(c.blendMode=s),c},conicGradient:function(e,n){let{from:a,to:i,type:r,opacity:o,blendMode:s,stretch:d}=e;St(a||"center",n,Pt),St(i||"bottom",n,Ct);const l=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));yt(l,e.stops,o);const c={type:r,style:l},h=Lt(n,Pt,Ct,d||1,t.Platform.conicGradientRotate90);return h&&(c.transform=h),s&&(c.blendMode=s),c},getTransform:Lt},{copy:Wt,toOffsetOutBounds:Ot}=t.BoundsHelper,Mt={},Tt={};function It(e,n,a,i){const{bounds:r,shapeBounds:o}=i;if(t.Platform.fullImageShadow){if(Wt(Mt,e.bounds),Mt.x+=n.x-o.x,Mt.y+=n.y-o.y,a){const{matrix:t}=i;Mt.x-=(r.x+(t?t.e:0)+r.width/2)*(a-1),Mt.y-=(r.y+(t?t.f:0)+r.height/2)*(a-1),Mt.width*=a,Mt.height*=a}e.copyWorld(i.canvas,e.bounds,Mt)}else a&&(Wt(Mt,n),Mt.x-=n.width/2*(a-1),Mt.y-=n.height/2*(a-1),Mt.width*=a,Mt.height*=a),e.copyWorld(i.canvas,o,a?Mt:n)}const{toOffsetOutBounds:Dt}=t.BoundsHelper,Ht={};const Ft={shadow:function(t,n,a){let i,r;const{__nowWorld:o,__layout:s}=t,{shadow:d}=t.__,{worldCanvas:l,bounds:c,shapeBounds:h,scaleX:u,scaleY:f}=a,p=n.getSameCanvas(),g=d.length-1;Ot(c,Tt),d.forEach(((d,_)=>{p.setWorldShadow(Tt.offsetX+d.x*u,Tt.offsetY+d.y*f,d.blur*u,e.ColorConvert.string(d.color)),r=d.spread?1+2*d.spread/(s.boxBounds.width+2*(s.strokeBoxSpread||0)):0,It(p,Tt,r,a),i=c,d.box&&(p.restore(),p.save(),l&&(p.copyWorld(p,c,o,"copy"),i=o),l?p.copyWorld(l,o,o,"destination-out"):p.copyWorld(a.canvas,h,c,"destination-out")),t.__worldFlipped?n.copyWorldByReset(p,i,o,d.blendMode):n.copyWorldToInner(p,i,s.renderBounds,d.blendMode),g&&_<g&&p.clearWorld(i,!0)})),p.recycle(i)},innerShadow:function(t,n,a){let i,r;const{__nowWorld:o,__layout:s}=t,{innerShadow:d}=t.__,{worldCanvas:l,bounds:c,shapeBounds:h,scaleX:u,scaleY:f}=a,p=n.getSameCanvas(),g=d.length-1;Dt(c,Ht),d.forEach(((d,_)=>{p.save(),p.setWorldShadow(Ht.offsetX+d.x*u,Ht.offsetY+d.y*f,d.blur*u),r=d.spread?1-2*d.spread/(s.boxBounds.width+2*(s.strokeBoxSpread||0)):0,It(p,Ht,r,a),p.restore(),l?(p.copyWorld(p,c,o,"copy"),p.copyWorld(l,o,o,"source-out"),i=o):(p.copyWorld(a.canvas,h,c,"source-out"),i=c),p.fillWorld(i,e.ColorConvert.string(d.color),"source-in"),t.__worldFlipped?n.copyWorldByReset(p,i,o,d.blendMode):n.copyWorldToInner(p,i,s.renderBounds,d.blendMode),g&&_<g&&p.clearWorld(i,!0)})),p.recycle(i)},blur:function(t,e,n){const{blur:a}=t.__;n.setWorldBlur(a*t.__nowWorld.a),n.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),n.filter="none"},backgroundBlur:function(t,e,n){}},{excludeRenderBounds:Gt}=t.LeafBoundsHelper;function jt(t,e,n,a,i,r){switch(e){case"grayscale":i.useGrayscaleAlpha(t.__nowWorld);case"alpha":!function(t,e,n,a){const i=t.__nowWorld;n.resetTransform(),n.opacity=1,n.useMask(a,i),a.recycle(i),Yt(t,e,n,1)}(t,n,a,i);break;case"opacity-path":Yt(t,n,a,r);break;case"path":n.restore()}}function zt(t){return t.getSameCanvas(!1,!0)}function Yt(t,e,n,a){const i=t.__nowWorld;e.resetTransform(),e.opacity=a,e.copyWorld(n,i),n.recycle(i)}e.Group.prototype.__renderMask=function(t,e){let n,a,i,r,o,s;const{children:d}=this;for(let l=0,c=d.length;l<c;l++)n=d[l],s=n.__.mask,s&&(o&&(jt(this,o,t,i,a,r),a=i=null),"path"===s||"clipping-path"===s?(n.opacity<1?(o="opacity-path",r=n.opacity,i||(i=zt(t))):(o="path",t.save()),n.__clip(i||t,e)):(o="grayscale"===s?"grayscale":"alpha",a||(a=zt(t)),i||(i=zt(t)),n.__render(a,e)),"clipping"!==s&&"clipping-path"!==s)||Gt(n,e)||n.__render(i||t,e);jt(this,o,t,i,a,r)};const qt=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Nt=qt+"_#~&*+\\=|≮≯≈≠=…",Ut=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 Xt(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Vt=Xt("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Qt=Xt("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Zt=Xt(qt),Kt=Xt(Nt),$t=Xt("- —/~|┆·");var Jt;!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"}(Jt||(Jt={}));const{Letter:te,Single:ee,Before:ne,After:ae,Symbol:ie,Break:re}=Jt;function oe(t){return Vt[t]?te:$t[t]?re:Qt[t]?ne:Zt[t]?ae:Kt[t]?ie:Ut.test(t)?ee:te}const se={trimRight(t){const{words:e}=t;let n,a=0,i=e.length;for(let r=i-1;r>-1&&(n=e[r].data[0]," "===n.char);r--)a++,t.width-=n.width;a&&e.splice(i-a,a)}};function de(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:le}=se,{Letter:ce,Single:he,Before:ue,After:fe,Symbol:pe,Break:ge}=Jt;let _e,ye,we,me,ve,xe,be,Ee,Be,Re,Le,ke,Se,Pe,Ce,Ae,We,Oe=[];function Me(t,e){Be&&!Ee&&(Ee=Be),_e.data.push({char:t,width:e}),we+=e}function Te(){me+=we,_e.width=we,ye.words.push(_e),_e={data:[]},we=0}function Ie(){Pe&&(Ce.paraNumber++,ye.paraStart=!0,Pe=!1),Be&&(ye.startCharSize=Ee,ye.endCharSize=Be,Ee=0),ye.width=me,Ae.width?le(ye):We&&De(),Oe.push(ye),ye={words:[]},me=0}function De(){me>(Ce.maxWidth||0)&&(Ce.maxWidth=me)}const{top:He,right:Fe,bottom:Ge,left:je}=t.Direction4;function ze(t,e,n){const{bounds:a,rows:i}=t;a[e]+=n;for(let t=0;t<i.length;t++)i[t][e]+=n}const Ye={getDrawData:function(n,a){"string"!=typeof n&&(n=String(n));let i=0,r=0,o=a.__getInput("width")||0,s=a.__getInput("height")||0;const{textDecoration:d,__font:l,__padding:c}=a;c&&(o?(i=c[je],o-=c[Fe]+c[je]):a.autoSizeAlign||(i=c[je]),s?(r=c[He],s-=c[He]+c[Ge]):a.autoSizeAlign||(r=c[He]));const h={bounds:{x:i,y:r,width:o,height:s},rows:[],paraNumber:0,font:t.Platform.canvas.font=l};return function(e,n,a){Ce=e,Oe=e.rows,Ae=e.bounds,We=!Ae.width&&!a.autoSizeAlign;const{__letterSpacing:i,paraIndent:r,textCase:o}=a,{canvas:s}=t.Platform,{width:d,height:l}=Ae;if(d||l||i||"none"!==o){const t="none"!==a.textWrap,e="break"===a.textWrap;Pe=!0,Le=null,Ee=be=Be=we=me=0,_e={data:[]},ye={words:[]};for(let a=0,l=n.length;a<l;a++)xe=n[a],"\n"===xe?(we&&Te(),ye.paraEnd=!0,Ie(),Pe=!0):(Re=oe(xe),Re===ce&&"none"!==o&&(xe=de(xe,o,!we)),be=s.measureText(xe).width,i&&(i<0&&(Be=be),be+=i),ke=Re===he&&(Le===he||Le===ce)||Le===he&&Re!==fe,Se=!(Re!==ue&&Re!==he||Le!==pe&&Le!==fe),ve=Pe&&r?d-r:d,t&&d&&me+we+be>ve&&(e?(we&&Te(),me&&Ie()):(Se||(Se=Re===ce&&Le==fe),ke||Se||Re===ge||Re===ue||Re===he||we+be>ve?(we&&Te(),me&&Ie()):me&&Ie()))," "===xe&&!0!==Pe&&me+we===0||(Re===ge?(" "===xe&&we&&Te(),Me(xe,be),Te()):ke||Se?(we&&Te(),Me(xe,be)):Me(xe,be)),Le=Re);we&&Te(),me&&Ie(),Oe.length>0&&(Oe[Oe.length-1].paraEnd=!0)}else n.split("\n").forEach((t=>{Ce.paraNumber++,me=s.measureText(t).width,Oe.push({x:r||0,text:t,width:me,paraStart:!0}),We&&De()}))}(h,n,a),c&&function(t,e,n,a,i){if(!a&&n.autoSizeAlign)switch(n.textAlign){case"left":ze(e,"x",t[je]);break;case"right":ze(e,"x",-t[Fe])}if(!i&&n.autoSizeAlign)switch(n.verticalAlign){case"top":ze(e,"y",t[He]);break;case"bottom":ze(e,"y",-t[Ge])}}(c,h,a,o,s),function(t,e){const{rows:n,bounds:a}=t,i=n.length,{__lineHeight:r,__baseLine:o,__letterSpacing:s,__clipText:d,textAlign:l,verticalAlign:c,paraSpacing:h,autoSizeAlign:u}=e;let{x:f,y:p,width:g,height:_}=a,y=r*i+(h?h*(t.paraNumber-1):0),w=o;if(d&&y>_)y=Math.max(_,r),i>1&&(t.overflow=i);else if(_||u)switch(c){case"middle":p+=(_-y)/2;break;case"bottom":p+=_-y}w+=p;let m,v,x,b=g||u?g:t.maxWidth;for(let o=0,c=i;o<c;o++){if(m=n[o],m.x=f,m.width<g||m.width>g&&!d)switch(l){case"center":m.x+=(b-m.width)/2;break;case"right":m.x+=b-m.width}m.paraStart&&h&&o>0&&(w+=h),m.y=w,w+=r,t.overflow>o&&w>y&&(m.isOverflow=!0,t.overflow=o+1),v=m.x,x=m.width,s<0&&(m.width<0?(x=-m.width+e.fontSize+s,v-=x,x+=e.fontSize):x-=s),v<a.x&&(a.x=v),x>a.width&&(a.width=x),d&&g&&g<x&&(m.isOverflow=!0,t.overflow||(t.overflow=n.length))}a.y=p,a.height=y}(h,a),function(t,e,n){const{rows:a}=t,{textAlign:i,paraIndent:r,letterSpacing:o}=e;let s,d,l,c,h,u;a.forEach((t=>{t.words&&(l=r&&t.paraStart?r:0,u=t.words.length,d=n&&("justify"===i||"both"===i)&&u>1?(n-t.width-l)/(u-1):0,c=o||t.isOverflow?0:d>.01?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===c?(t.x+=l,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=l,s=t.x,t.data=[],t.words.forEach(((e,n)=>{1===c?(h={char:"",x:s},s=function(t,e,n){return t.forEach((t=>{n.char+=t.char,e+=t.width})),e}(e.data,s,h),(t.isOverflow||" "!==h.char)&&t.data.push(h)):s=function(t,e,n,a){return t.forEach((t=>{(a||" "!==t.char)&&(t.x=e,n.push(t)),e+=t.width})),e}(e.data,s,t.data,t.isOverflow),!d||t.paraEnd&&"both"!==i||n===u-1||(s+=d,t.width+=d)}))),t.words=null)}))}(h,a,o),h.overflow&&function(e,n,a,i){if(!i)return;const{rows:r,overflow:o}=e;let{textOverflow:s}=n;if(r.splice(o),s&&"show"!==s){let e,d;"hide"===s?s="":"ellipsis"===s&&(s="...");const l=s?t.Platform.canvas.measureText(s).width:0,c=a+i-l;("none"===n.textWrap?r:[r[o-1]]).forEach((t=>{if(t.isOverflow&&t.data){let n=t.data.length-1;for(let a=n;a>-1&&(e=t.data[a],d=e.x+e.width,!(a===n&&d<c));a--){if(d<c&&" "!==e.char||!a){t.data.splice(a+1),t.width-=e.width;break}t.width-=e.width}t.width+=l,t.data.push({char:s,x:d}),t.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(t)}}))}}(h,a,i,o),"none"!==d&&function(t,n){let a;const{fontSize:i,textDecoration:r}=n;switch(t.decorationHeight=i/11,"object"==typeof r?(a=r.type,r.color&&(t.decorationColor=e.ColorConvert.string(r.color))):a=r,a){case"under":t.decorationY=[.15*i];break;case"delete":t.decorationY=[.35*-i];break;case"under-delete":t.decorationY=[.15*i,.35*-i]}}(h,a),h}};const qe={string:function(t,n){const a="number"==typeof n&&1!==n;if("string"==typeof t){if(!a||!e.ColorConvert.object)return t;t=e.ColorConvert.object(t)}let i=void 0===t.a?1:t.a;a&&(i*=n);const r=t.r+","+t.g+","+t.b;return 1===i?"rgb("+r+")":"rgba("+r+","+i+")"}};Object.assign(e.TextConvert,Ye),Object.assign(e.ColorConvert,qe),Object.assign(e.Paint,W),Object.assign(e.PaintImage,ft),Object.assign(e.PaintGradient,At),Object.assign(e.Effect,Ft),i(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Layouter=y,exports.LeaferCanvas=n,exports.Renderer=m,exports.Watcher=o,exports.useCanvas=i,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:a}=t.FileHelper;function i(e,n){t.Platform.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,n)=>new Promise(((i,o)=>{t.convertToBlob({type:a(e),quality:n}).then((t=>{var e=new FileReader;e.onload=t=>i(t.target.result),e.onerror=t=>o(t),e.readAsDataURL(t)})).catch((t=>{o(t)}))})),canvasToBolb:(t,e,n)=>t.convertToBlob({type:a(e),quality:n}),canvasSaveAs:(t,e,n)=>new Promise((t=>t())),download(t,e){},loadImage:e=>new Promise(((n,a)=>{let i=new XMLHttpRequest;i.open("GET",t.Platform.image.getRealURL(e),!0),i.responseType="blob",i.onload=()=>{createImageBitmap(i.response).then((t=>{n(t)})).catch((t=>{a(t)}))},i.onerror=t=>a(t),i.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.backgrounder=!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 r{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:s,updateBounds:d,updateChange:l}=t.LeafHelper,{pushAllChildBranch:c,pushAllParent:h}=t.BranchHelper;const{worldBounds:u}=t.LeafBoundsHelper;class f{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(){this.afterBounds.setListWithFn(this.updatedList.list,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:p,updateAllChange:g}=t.LeafHelper,_=t.Debug.get("Layouter");class w{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){_.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?_.warn("layouting"):this.times>3?_.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:a,__updatedList:i}=this,{BEFORE:o,LAYOUT:r,AFTER:u}=t.LayoutEvent,f=this.getBlocks(i);f.forEach((t=>t.setBefore())),a.emitEvent(new t.LayoutEvent(o,f,this.times)),this.extraBlock=null,i.sort(),function(t,e){let n;t.list.forEach((t=>{n=t.__layout,e.without(t)&&!n.proxyZoom&&(n.matrixChanged?(s(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)))}))}(i,this.__levelList),function(t){let e,n,a;t.sort(!0),t.levels.forEach((i=>{e=t.levelMap[i];for(let t=0,i=e.length;t<i;t++){if(n=e[t],n.isBranch&&n.__tempNumber){a=n.children;for(let t=0,e=a.length;t<e;t++)a[t].isBranch||d(a[t])}d(n)}}))}(this.__levelList),function(t){t.list.forEach(l)}(i),this.extraBlock&&f.push(this.extraBlock),f.forEach((t=>t.setAfter())),a.emitEvent(new t.LayoutEvent(r,f,this.times)),a.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:a,LAYOUT:i,AFTER:o}=t.LayoutEvent,r=this.getBlocks(new t.LeafList(n));n.emitEvent(new t.LayoutEvent(a,r,this.times)),w.fullLayout(n),r.forEach((t=>{t.setAfter()})),n.emitEvent(new t.LayoutEvent(i,r,this.times)),n.emitEvent(new t.LayoutEvent(o,r,this.times)),this.addBlocks(r),t.Run.end(e)}static fullLayout(e){p(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),g(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:n}=this.extraBlock||(this.extraBlock=new f([]));e.length?n.add(t.__world):n.set(t.__world),e.add(t)}}createBlock(t){return new f(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 m{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,n,a){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=e,this.canvas=n,a&&(this.config=t.DataHelper.default(a,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:e}=this;e.isApp&&(e.emit(t.RenderEvent.CHILD_START,e),e.children.forEach((t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()})),e.emit(t.RenderEvent.CHILD_END,e)),this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)}}render(e){if(!this.running||!this.canvas.view)return this.update();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;e&&(this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)})))}clipRender(e){const n=t.Run.start("PartRender"),{canvas:a}=this,i=e.getIntersect(a.bounds),o=new t.Bounds(i);a.save(),i.spread(m.clipSpread).ceil(),a.clearWorld(i,!0),a.clipWorld(i,!0),this.__render(i,o),a.restore(),t.Run.end(n)}fullRender(){const e=t.Run.start("FullRender"),{canvas:n}=this;n.save(),n.clear(),this.__render(n.bounds),n.restore(),t.Run.end(e)}__render(e,n){const{canvas:a}=this,i=e.includes(this.target.__world),o=i?{includes:i}:{bounds:e,includes:i};this.needFill&&a.fillWorld(e,this.config.fill),t.Debug.showRepaint&&t.Debug.drawRepaint(a,e),this.target.__render(a,o),this.renderBounds=n=n||e,this.renderOptions=o,this.totalBounds.isEmpty()?this.totalBounds=n:this.totalBounds.add(n),a.updateRender(n)}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=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);const n=this.requestTime=Date.now();t.Platform.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-n))),this.requestTime=0,this.checkRender()}))}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:n,height:a}=e.old;if(!new t.Bounds(0,0,n,a).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.update()}}__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,a){this.target.emitEvent(new t.RenderEvent(e,this.times,n,a))}__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 v(t,e){const n=t.__,{rows:a,decorationY:i}=n.__textDrawData;let o;n.__isPlacehold&&n.placeholderColor&&(e.fillStyle=n.placeholderColor);for(let t=0,n=a.length;t<n;t++)o=a[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach((t=>{e.fillText(t.char,t.x,o.y)}));if(i){const{decorationColor:t,decorationHeight:o}=n.__textDrawData;t&&(e.fillStyle=t),a.forEach((t=>i.forEach((n=>e.fillRect(t.x,t.y+n,t.width,o)))))}}function x(t,e){t.__.__font?v(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function b(t,e,n){const{strokeAlign:a}=e.__,i="string"!=typeof t;switch(a){case"center":n.setStroke(i?void 0:t,e.__.strokeWidth,e.__),i?R(t,!0,e,n):B(e,n);break;case"inside":E("inside",t,i,e,n);break;case"outside":E("outside",t,i,e,n)}}function E(t,e,n,a,i){const{__strokeWidth:o,__font:r}=a.__,s=i.getSameCanvas(!0,!0);s.setStroke(n?void 0:e,2*o,a.__),s.font=r,n?R(e,!0,a,s):B(a,s),s.blendMode="outside"===t?"destination-out":"destination-in",v(a,s),s.blendMode="normal",a.__worldFlipped?i.copyWorldByReset(s,a.__nowWorld):i.copyWorldToInner(s,a.__nowWorld,a.__layout.renderBounds),s.recycle(a.__nowWorld)}function B(t,e){let n,a=t.__.__textDrawData;const{rows:i,decorationY:o}=a;for(let t=0,a=i.length;t<a;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)}));if(o){const{decorationHeight:t}=a;i.forEach((n=>o.forEach((a=>e.strokeRect(n.x,n.y+a,n.width,t)))))}}function R(t,n,a,i){let o;for(let r=0,s=t.length;r<s;r++)o=t[r],o.image&&e.PaintImage.checkImage(a,i,o,!1)||o.style&&(i.strokeStyle=o.style,o.blendMode?(i.saveBlendMode(o.blendMode),n?B(a,i):i.stroke(),i.restoreBlendMode()):n?B(a,i):i.stroke())}function L(t,e){t.__.dashPattern&&(e.beginPath(),t.__drawPathByData(e,t.__.__pathForArrow),e.dashPattern=null,e.stroke())}m.clipSpread=10,Object.assign(t.Creator,{watcher:(t,e)=>new r(t,e),layouter:(t,e)=>new w(t,e),renderer:(t,e,n)=>new m(t,e,n),selector:(t,e)=>{},interaction:(t,e,n,a)=>{}}),t.Platform.layout=w.fullLayout;const{getSpread:k,getOuterOf:S,getByMove:P,getIntersectData:C}=t.BoundsHelper;let A;function W(t,n,a){if("object"!=typeof n||!1===n.visible||0===n.opacity)return;const{boxBounds:i}=a.__layout;switch(n.type){case"solid":let{type:o,blendMode:r,color:s,opacity:d}=n;return{type:o,blendMode:r,style:e.ColorConvert.string(s,d)};case"image":return e.PaintImage.image(a,t,n,i,!A||!A[n.url]);case"linear":return e.PaintGradient.linearGradient(n,i);case"radial":return e.PaintGradient.radialGradient(n,i);case"angular":return e.PaintGradient.conicGradient(n,i);default:return void 0!==n.r?{type:"solid",style:e.ColorConvert.string(n)}:void 0}}const O={compute:function(t,n){const a=n.__,i=[];let o,r=a.__input[t];r instanceof Array||(r=[r]),A=e.PaintImage.recycleImage(t,a);for(let e,a=0,o=r.length;a<o;a++)e=W(t,r[a],n),e&&i.push(e);a["_"+t]=i.length?i:void 0,i.length&&i[0].image&&(o=i[0].image.hasOpacityPixel),"fill"===t?a.__pixelFill=o:a.__pixelStroke=o},fill:function(t,e,n){n.fillStyle=t,x(e,n)},fills:function(t,n,a){let i;for(let o=0,r=t.length;o<r;o++){if(i=t[o],i.image){if(e.PaintImage.checkImage(n,a,i,!n.__.__font))continue;if(!i.style){!o&&i.image.isPlacehold&&n.drawImagePlaceholder(a,i.image);continue}}a.fillStyle=i.style,i.transform?(a.save(),a.transform(i.transform),i.blendMode&&(a.blendMode=i.blendMode),x(n,a),a.restore()):i.blendMode?(a.saveBlendMode(i.blendMode),x(n,a),a.restoreBlendMode()):x(n,a)}},fillPathOrText:x,fillText:v,stroke:function(t,e,n){const a=e.__,{__strokeWidth:i,strokeAlign:o,__font:r}=a;if(i)if(r)b(t,e,n);else switch(o){case"center":n.setStroke(t,i,a),n.stroke(),a.__useArrow&&L(e,n);break;case"inside":n.save(),n.setStroke(t,2*i,a),a.windingRule?n.clip(a.windingRule):n.clip(),n.stroke(),n.restore();break;case"outside":const o=n.getSameCanvas(!0,!0);o.setStroke(t,2*i,a),e.__drawRenderPath(o),o.stroke(),a.windingRule?o.clip(a.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 a=e.__,{__strokeWidth:i,strokeAlign:o,__font:r}=a;if(i)if(r)b(t,e,n);else switch(o){case"center":n.setStroke(void 0,i,a),R(t,!1,e,n),a.__useArrow&&L(e,n);break;case"inside":n.save(),n.setStroke(void 0,2*i,a),a.windingRule?n.clip(a.windingRule):n.clip(),R(t,!1,e,n),n.restore();break;case"outside":const{renderBounds:o}=e.__layout,r=n.getSameCanvas(!0,!0);e.__drawRenderPath(r),r.setStroke(void 0,2*i,a),R(t,!1,e,r),a.windingRule?r.clip(a.windingRule):r.clip(),r.clearWorld(o),e.__worldFlipped?n.copyWorldByReset(r,e.__nowWorld):n.copyWorldToInner(r,e.__nowWorld,o),r.recycle(e.__nowWorld)}},strokeText:b,drawTextStroke:B,shape:function(t,e,n){const a=e.getSameCanvas(),i=t.__nowWorld;let o,r,s,d,{scaleX:l,scaleY:c}=i;if(l<0&&(l=-l),c<0&&(c=-c),e.bounds.includes(i))d=a,o=s=i;else{const{renderShapeSpread:a}=t.__layout,h=C(a?k(e.bounds,l===c?a*l:[a*c,a*l]):e.bounds,i);r=e.bounds.getFitMatrix(h);let{a:u,d:f}=r;if(r.a<1&&(d=e.getSameCanvas(),t.__renderShape(d,n),l*=u,c*=f),s=S(i,r),o=P(s,-r.e,-r.f),n.matrix){const{matrix:t}=n;r.multiply(t),u*=t.scaleX,f*=t.scaleY}n=Object.assign(Object.assign({},n),{matrix:r.withScale(u,f)})}return t.__renderShape(a,n),{canvas:a,matrix:r,bounds:o,worldCanvas:d,shapeBounds:s,scaleX:l,scaleY:c}}};let M={};const{get:T,rotateOfOuter:I,translate:D,scaleOfOuter:H,scale:F,rotate:G}=t.MatrixHelper;function j(t,e,n,a,i,o,r){const s=T();D(s,e.x+n,e.y+a),F(s,i,o),r&&I(s,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=s}function z(t,e,n,a,i,o,r){const s=T();D(s,e.x+n,e.y+a),i&&F(s,i,o),r&&G(s,r),t.transform=s}function Y(t,e,n,a,i,o,r,s,d,l){const c=T();if(d)if("center"===l)I(c,{x:n/2,y:a/2},d);else switch(G(c,d),d){case 90:D(c,a,0);break;case 180:D(c,n,a);break;case 270:D(c,0,n)}M.x=e.x+i,M.y=e.y+o,D(c,M.x,M.y),r&&H(c,M,r,s),t.transform=c}const{get:q,translate:U}=t.MatrixHelper,N=new t.Bounds,X={},V={};function Q(t,e,n,a){const{blendMode:i,changeful:o,sync:r}=n;i&&(t.blendMode=i),o&&(t.changeful=o),r&&(t.sync=r),t.data=Z(n,a,e)}function Z(e,n,a){let{width:i,height:o}=a;e.padding&&(n=N.set(n).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");const{opacity:r,mode:s,align:d,offset:l,scale:c,size:h,rotation:u,repeat:f,filters:p}=e,g=n.width===i&&n.height===o,_={mode:s},w="center"!==d&&(u||0)%180==90,y=w?o:i,m=w?i:o;let v,x,b=0,E=0;if(s&&"cover"!==s&&"fit"!==s)(c||h)&&(t.MathHelper.getScaleData(c,h,a,V),v=V.scaleX,x=V.scaleY);else if(!g||u){const t=n.width/y,e=n.height/m;v=x="fit"===s?Math.min(t,e):Math.max(t,e),b+=(n.width-i*v)/2,E+=(n.height-o*x)/2}if(d){const e={x:b,y:E,width:y,height:m};v&&(e.width*=v,e.height*=x),t.AlignHelper.toPoint(d,e,n,X,!0),b+=X.x,E+=X.y}switch(l&&(b+=l.x,E+=l.y),s){case"stretch":g||(i=n.width,o=n.height);break;case"normal":case"clip":(b||E||v||u)&&z(_,n,b,E,v,x,u);break;case"repeat":(!g||v||u)&&Y(_,n,i,o,b,E,v,x,u,d),f||(_.repeat="repeat");break;default:v&&j(_,n,b,E,v,x,u)}return _.transform||(n.x||n.y)&&(_.transform=q(),U(_.transform,n.x,n.y)),v&&"stretch"!==s&&(_.scaleX=v,_.scaleY=x),_.width=i,_.height=o,r&&(_.opacity=r),p&&(_.filters=p),f&&(_.repeat="string"==typeof f?"x"===f?"repeat-x":"repeat-y":"repeat"),_}let K,$=new t.Bounds;const{isSame:J}=t.BoundsHelper;function tt(t,e,n,a,i,o){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=a.width/e.pixelRatio,e.__naturalHeight=a.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return i.data||Q(i,a,n,o),!0}function et(e,n){it(e,t.ImageEvent.LOAD,n)}function nt(e,n){it(e,t.ImageEvent.LOADED,n)}function at(e,n,a){n.error=a,e.forceUpdate("surface"),it(e,t.ImageEvent.ERROR,n)}function it(e,n,a){e.hasEvent(n)&&e.emitEvent(new t.ImageEvent(n,a))}function ot(t,e){const{leafer:n}=t;n&&n.viewReady&&(n.renderer.ignore=e)}const{get:rt,scale:st,copy:dt}=t.MatrixHelper,{ceil:lt,abs:ct}=Math;function ht(e,n,a){let{scaleX:i,scaleY:o}=t.ImageManager.patternLocked?e.__world:e.__nowWorld;const r=i+"-"+o+"-"+a;if(n.patternId===r||e.destroyed)return!1;{i=ct(i),o=ct(o);const{image:e,data:s}=n;let d,l,{width:c,height:h,scaleX:u,scaleY:f,transform:p,repeat:g}=s;u&&(l=rt(),dt(l,p),st(l,1/u,1/f),i*=u,o*=f),i*=a,o*=a,c*=i,h*=o;const _=c*h;if(!g&&_>t.Platform.image.maxCacheSize)return!1;let w=t.Platform.image.maxPatternSize;if(!e.isSVG){const t=e.width*e.height;w>t&&(w=t)}_>w&&(d=Math.sqrt(_/w)),d&&(i/=d,o/=d,c/=d,h/=d),u&&(i/=u,o/=f),(p||1!==i||1!==o)&&(l||(l=rt(),p&&dt(l,p)),st(l,1/i,1/o));const y=e.getCanvas(lt(c)||1,lt(h)||1,s.opacity,s.filters),m=e.getPattern(y,g||t.Platform.origin.noRepeat||"no-repeat",l,n);return n.style=m,n.patternId=r,!0}}function ut(t,e,n,a){return new(n||(n=Promise))((function(i,o){function r(t){try{d(a.next(t))}catch(t){o(t)}}function s(t){try{d(a.throw(t))}catch(t){o(t)}}function d(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,s)}d((a=a.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const{abs:ft}=Math;const pt={image:function(e,n,a,i,o){let r,s;const d=t.ImageManager.get(a);return K&&a===K.paint&&J(i,K.boxBounds)?r=K.leafPaint:(r={type:a.type,image:d},K=d.use>1?{leafPaint:r,paint:a,boxBounds:$.set(i)}:null),(o||d.loading)&&(s={image:d,attrName:n,attrValue:a}),d.ready?(tt(e,n,a,d,r,i),o&&(et(e,s),nt(e,s))):d.error?o&&at(e,s,d.error):(o&&(ot(e,!0),et(e,s)),r.loadId=d.load((()=>{ot(e,!1),e.destroyed||(tt(e,n,a,d,r,i)&&(d.hasOpacityPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),nt(e,s)),r.loadId=null}),(t=>{ot(e,!1),at(e,s,t),r.loadId=null})),e.placeholderColor&&setTimeout((()=>{d.ready||d.isPlacehold||(d.isPlacehold=!0,e.forceUpdate("surface"))}),100)),r},checkImage:function(n,a,i,o){const{scaleX:r,scaleY:s}=t.ImageManager.patternLocked?n.__world:n.__nowWorld,{pixelRatio:d}=a,{data:l}=i;if(!l||i.patternId===r+"-"+s+"-"+d&&!e.Export.running)return!1;if(o)if(l.repeat)o=!1;else if(!(i.changeful||t.ResizeEvent.isResizing(n)||e.Export.running)){let{width:e,height:n}=l;e*=ft(r)*d,n*=ft(s)*d,l.scaleX&&(e*=l.scaleX,n*=l.scaleY),o=e*n>t.Platform.image.maxCacheSize}return o?(function(t,e,n,a){e.save(),t.windingRule?e.clip(t.windingRule):e.clip(),n.blendMode&&(e.blendMode=n.blendMode);a.opacity&&(e.opacity*=a.opacity);a.transform&&e.transform(a.transform);e.drawImage(n.image.getFull(a.filters),0,0,a.width,a.height),e.restore()}(n,a,i,l),!0):(!i.style||i.sync||e.Export.running?ht(n,i,d):i.patternTask||(i.patternTask=t.ImageManager.patternTasker.add((()=>ut(this,void 0,void 0,(function*(){i.patternTask=null,a.bounds.hit(n.__nowWorld)&&ht(n,i,d),n.forceUpdate("surface")}))),300)),!1)},createPattern:ht,recycleImage:function(e,n){const a=n["_"+e];if(a instanceof Array){let i,o,r,s,d;for(let l=0,c=a.length;l<c;l++)i=a[l],o=i.image,d=o&&o.url,d&&(r||(r={}),r[d]=!0,t.ImageManager.recycle(o),o.loading&&(s||(s=n.__input&&n.__input[e]||[],s instanceof Array||(s=[s])),o.unload(a[l].loadId,!s.some((t=>t.url===d)))));return r}return null},createData:Q,getPatternData:Z,fillOrFitMode:j,clipMode:z,repeatMode:Y},{toPoint:gt}=t.AroundHelper,_t={},wt={};function yt(t,n,a){if(n){let i;for(let o=0,r=n.length;o<r;o++)i=n[o],"string"==typeof i?t.addColorStop(o/(r-1),e.ColorConvert.string(i,a)):t.addColorStop(i.offset,e.ColorConvert.string(i.color,a))}}const{getAngle:mt,getDistance:vt}=t.PointHelper,{get:xt,rotateOfOuter:bt,scaleOfOuter:Et}=t.MatrixHelper,{toPoint:Bt}=t.AroundHelper,Rt={},Lt={};function kt(t,e,n,a,i){let o;const{width:r,height:s}=t;if(r!==s||a){const t=mt(e,n);o=xt(),i?(Et(o,e,r/s*(a||1),1),bt(o,e,t+90)):(Et(o,e,1,r/s*(a||1)),bt(o,e,t))}return o}const{getDistance:St}=t.PointHelper,{toPoint:Pt}=t.AroundHelper,Ct={},At={};const Wt={linearGradient:function(e,n){let{from:a,to:i,type:o,blendMode:r,opacity:s}=e;gt(a||"top",n,_t),gt(i||"bottom",n,wt);const d=t.Platform.canvas.createLinearGradient(_t.x,_t.y,wt.x,wt.y);yt(d,e.stops,s);const l={type:o,style:d};return r&&(l.blendMode=r),l},radialGradient:function(e,n){let{from:a,to:i,type:o,opacity:r,blendMode:s,stretch:d}=e;Bt(a||"center",n,Rt),Bt(i||"bottom",n,Lt);const l=t.Platform.canvas.createRadialGradient(Rt.x,Rt.y,0,Rt.x,Rt.y,vt(Rt,Lt));yt(l,e.stops,r);const c={type:o,style:l},h=kt(n,Rt,Lt,d,!0);return h&&(c.transform=h),s&&(c.blendMode=s),c},conicGradient:function(e,n){let{from:a,to:i,type:o,opacity:r,blendMode:s,stretch:d}=e;Pt(a||"center",n,Ct),Pt(i||"bottom",n,At);const l=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,Ct.x,Ct.y):t.Platform.canvas.createRadialGradient(Ct.x,Ct.y,0,Ct.x,Ct.y,St(Ct,At));yt(l,e.stops,r);const c={type:o,style:l},h=kt(n,Ct,At,d||1,t.Platform.conicGradientRotate90);return h&&(c.transform=h),s&&(c.blendMode=s),c},getTransform:kt},{copy:Ot,toOffsetOutBounds:Mt}=t.BoundsHelper,Tt={},It={};function Dt(e,n,a,i){const{bounds:o,shapeBounds:r}=i;if(t.Platform.fullImageShadow){if(Ot(Tt,e.bounds),Tt.x+=n.x-r.x,Tt.y+=n.y-r.y,a){const{matrix:t}=i;Tt.x-=(o.x+(t?t.e:0)+o.width/2)*(a-1),Tt.y-=(o.y+(t?t.f:0)+o.height/2)*(a-1),Tt.width*=a,Tt.height*=a}e.copyWorld(i.canvas,e.bounds,Tt)}else a&&(Ot(Tt,n),Tt.x-=n.width/2*(a-1),Tt.y-=n.height/2*(a-1),Tt.width*=a,Tt.height*=a),e.copyWorld(i.canvas,r,a?Tt:n)}const{toOffsetOutBounds:Ht}=t.BoundsHelper,Ft={};const Gt={shadow:function(t,n,a){let i,o;const{__nowWorld:r,__layout:s}=t,{shadow:d}=t.__,{worldCanvas:l,bounds:c,shapeBounds:h,scaleX:u,scaleY:f}=a,p=n.getSameCanvas(),g=d.length-1;Mt(c,It),d.forEach(((d,_)=>{p.setWorldShadow(It.offsetX+d.x*u,It.offsetY+d.y*f,d.blur*u,e.ColorConvert.string(d.color)),o=d.spread?1+2*d.spread/(s.boxBounds.width+2*(s.strokeBoxSpread||0)):0,Dt(p,It,o,a),i=c,d.box&&(p.restore(),p.save(),l&&(p.copyWorld(p,c,r,"copy"),i=r),l?p.copyWorld(l,r,r,"destination-out"):p.copyWorld(a.canvas,h,c,"destination-out")),t.__worldFlipped?n.copyWorldByReset(p,i,r,d.blendMode):n.copyWorldToInner(p,i,s.renderBounds,d.blendMode),g&&_<g&&p.clearWorld(i,!0)})),p.recycle(i)},innerShadow:function(t,n,a){let i,o;const{__nowWorld:r,__layout:s}=t,{innerShadow:d}=t.__,{worldCanvas:l,bounds:c,shapeBounds:h,scaleX:u,scaleY:f}=a,p=n.getSameCanvas(),g=d.length-1;Ht(c,Ft),d.forEach(((d,_)=>{p.save(),p.setWorldShadow(Ft.offsetX+d.x*u,Ft.offsetY+d.y*f,d.blur*u),o=d.spread?1-2*d.spread/(s.boxBounds.width+2*(s.strokeBoxSpread||0)):0,Dt(p,Ft,o,a),p.restore(),l?(p.copyWorld(p,c,r,"copy"),p.copyWorld(l,r,r,"source-out"),i=r):(p.copyWorld(a.canvas,h,c,"source-out"),i=c),p.fillWorld(i,e.ColorConvert.string(d.color),"source-in"),t.__worldFlipped?n.copyWorldByReset(p,i,r,d.blendMode):n.copyWorldToInner(p,i,s.renderBounds,d.blendMode),g&&_<g&&p.clearWorld(i,!0)})),p.recycle(i)},blur:function(t,e,n){const{blur:a}=t.__;n.setWorldBlur(a*t.__nowWorld.a),n.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),n.filter="none"},backgroundBlur:function(t,e,n){}},{excludeRenderBounds:jt}=t.LeafBoundsHelper;function zt(t,e,n,a,i,o){switch(e){case"grayscale":i.useGrayscaleAlpha(t.__nowWorld);case"alpha":!function(t,e,n,a){const i=t.__nowWorld;n.resetTransform(),n.opacity=1,n.useMask(a,i),a.recycle(i),qt(t,e,n,1)}(t,n,a,i);break;case"opacity-path":qt(t,n,a,o);break;case"path":n.restore()}}function Yt(t){return t.getSameCanvas(!1,!0)}function qt(t,e,n,a){const i=t.__nowWorld;e.resetTransform(),e.opacity=a,e.copyWorld(n,i),n.recycle(i)}e.Group.prototype.__renderMask=function(t,e){let n,a,i,o,r,s;const{children:d}=this;for(let l=0,c=d.length;l<c;l++)n=d[l],s=n.__.mask,s&&(r&&(zt(this,r,t,i,a,o),a=i=null),"path"===s||"clipping-path"===s?(n.opacity<1?(r="opacity-path",o=n.opacity,i||(i=Yt(t))):(r="path",t.save()),n.__clip(i||t,e)):(r="grayscale"===s?"grayscale":"alpha",a||(a=Yt(t)),i||(i=Yt(t)),n.__render(a,e)),"clipping"!==s&&"clipping-path"!==s)||jt(n,e)||n.__render(i||t,e);zt(this,r,t,i,a,o)};const Ut=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Nt=Ut+"_#~&*+\\=|≮≯≈≠=…",Xt=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 Qt=Vt("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Zt=Vt("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Kt=Vt(Ut),$t=Vt(Nt),Jt=Vt("- —/~|┆·");var te;!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"}(te||(te={}));const{Letter:ee,Single:ne,Before:ae,After:ie,Symbol:oe,Break:re}=te;function se(t){return Qt[t]?ee:Jt[t]?re:Zt[t]?ae:Kt[t]?ie:$t[t]?oe:Xt.test(t)?ne:ee}const de={trimRight(t){const{words:e}=t;let n,a=0,i=e.length;for(let o=i-1;o>-1&&(n=e[o].data[0]," "===n.char);o--)a++,t.width-=n.width;a&&e.splice(i-a,a)}};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:ce}=de,{Letter:he,Single:ue,Before:fe,After:pe,Symbol:ge,Break:_e}=te;let we,ye,me,ve,xe,be,Ee,Be,Re,Le,ke,Se,Pe,Ce,Ae,We,Oe,Me=[];function Te(t,e){Re&&!Be&&(Be=Re),we.data.push({char:t,width:e}),me+=e}function Ie(){ve+=me,we.width=me,ye.words.push(we),we={data:[]},me=0}function De(){Ce&&(Ae.paraNumber++,ye.paraStart=!0,Ce=!1),Re&&(ye.startCharSize=Be,ye.endCharSize=Re,Be=0),ye.width=ve,We.width?ce(ye):Oe&&He(),Me.push(ye),ye={words:[]},ve=0}function He(){ve>(Ae.maxWidth||0)&&(Ae.maxWidth=ve)}const{top:Fe,right:Ge,bottom:je,left:ze}=t.Direction4;function Ye(t,e,n){const{bounds:a,rows:i}=t;a[e]+=n;for(let t=0;t<i.length;t++)i[t][e]+=n}const qe={getDrawData:function(n,a){"string"!=typeof n&&(n=String(n));let i=0,o=0,r=a.__getInput("width")||0,s=a.__getInput("height")||0;const{textDecoration:d,__font:l,__padding:c}=a;c&&(r?(i=c[ze],r-=c[Ge]+c[ze]):a.autoSizeAlign||(i=c[ze]),s?(o=c[Fe],s-=c[Fe]+c[je]):a.autoSizeAlign||(o=c[Fe]));const h={bounds:{x:i,y:o,width:r,height:s},rows:[],paraNumber:0,font:t.Platform.canvas.font=l};return function(e,n,a){Ae=e,Me=e.rows,We=e.bounds,Oe=!We.width&&!a.autoSizeAlign;const{__letterSpacing:i,paraIndent:o,textCase:r}=a,{canvas:s}=t.Platform,{width:d,height:l}=We;if(d||l||i||"none"!==r){const t="none"!==a.textWrap,e="break"===a.textWrap;Ce=!0,ke=null,Be=Ee=Re=me=ve=0,we={data:[]},ye={words:[]};for(let a=0,l=n.length;a<l;a++)be=n[a],"\n"===be?(me&&Ie(),ye.paraEnd=!0,De(),Ce=!0):(Le=se(be),Le===he&&"none"!==r&&(be=le(be,r,!me)),Ee=s.measureText(be).width,i&&(i<0&&(Re=Ee),Ee+=i),Se=Le===ue&&(ke===ue||ke===he)||ke===ue&&Le!==pe,Pe=!(Le!==fe&&Le!==ue||ke!==ge&&ke!==pe),xe=Ce&&o?d-o:d,t&&d&&ve+me+Ee>xe&&(e?(me&&Ie(),ve&&De()):(Pe||(Pe=Le===he&&ke==pe),Se||Pe||Le===_e||Le===fe||Le===ue||me+Ee>xe?(me&&Ie(),ve&&De()):ve&&De()))," "===be&&!0!==Ce&&ve+me===0||(Le===_e?(" "===be&&me&&Ie(),Te(be,Ee),Ie()):Se||Pe?(me&&Ie(),Te(be,Ee)):Te(be,Ee)),ke=Le);me&&Ie(),ve&&De(),Me.length>0&&(Me[Me.length-1].paraEnd=!0)}else n.split("\n").forEach((t=>{Ae.paraNumber++,ve=s.measureText(t).width,Me.push({x:o||0,text:t,width:ve,paraStart:!0}),Oe&&He()}))}(h,n,a),c&&function(t,e,n,a,i){if(!a&&n.autoSizeAlign)switch(n.textAlign){case"left":Ye(e,"x",t[ze]);break;case"right":Ye(e,"x",-t[Ge])}if(!i&&n.autoSizeAlign)switch(n.verticalAlign){case"top":Ye(e,"y",t[Fe]);break;case"bottom":Ye(e,"y",-t[je])}}(c,h,a,r,s),function(t,e){const{rows:n,bounds:a}=t,i=n.length,{__lineHeight:o,__baseLine:r,__letterSpacing:s,__clipText:d,textAlign:l,verticalAlign:c,paraSpacing:h,autoSizeAlign:u}=e;let{x:f,y:p,width:g,height:_}=a,w=o*i+(h?h*(t.paraNumber-1):0),y=r;if(d&&w>_)w=Math.max(_,o),i>1&&(t.overflow=i);else if(_||u)switch(c){case"middle":p+=(_-w)/2;break;case"bottom":p+=_-w}y+=p;let m,v,x,b=g||u?g:t.maxWidth;for(let r=0,c=i;r<c;r++){if(m=n[r],m.x=f,m.width<g||m.width>g&&!d)switch(l){case"center":m.x+=(b-m.width)/2;break;case"right":m.x+=b-m.width}m.paraStart&&h&&r>0&&(y+=h),m.y=y,y+=o,t.overflow>r&&y>w&&(m.isOverflow=!0,t.overflow=r+1),v=m.x,x=m.width,s<0&&(m.width<0?(x=-m.width+e.fontSize+s,v-=x,x+=e.fontSize):x-=s),v<a.x&&(a.x=v),x>a.width&&(a.width=x),d&&g&&g<x&&(m.isOverflow=!0,t.overflow||(t.overflow=n.length))}a.y=p,a.height=w}(h,a),function(t,e,n){const{rows:a}=t,{textAlign:i,paraIndent:o,letterSpacing:r}=e;let s,d,l,c,h,u;a.forEach((t=>{t.words&&(l=o&&t.paraStart?o:0,u=t.words.length,d=n&&("justify"===i||"both"===i)&&u>1?(n-t.width-l)/(u-1):0,c=r||t.isOverflow?0:d>.01?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===c?(t.x+=l,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=l,s=t.x,t.data=[],t.words.forEach(((e,n)=>{1===c?(h={char:"",x:s},s=function(t,e,n){return t.forEach((t=>{n.char+=t.char,e+=t.width})),e}(e.data,s,h),(t.isOverflow||" "!==h.char)&&t.data.push(h)):s=function(t,e,n,a){return t.forEach((t=>{(a||" "!==t.char)&&(t.x=e,n.push(t)),e+=t.width})),e}(e.data,s,t.data,t.isOverflow),!d||t.paraEnd&&"both"!==i||n===u-1||(s+=d,t.width+=d)}))),t.words=null)}))}(h,a,r),h.overflow&&function(e,n,a,i){if(!i)return;const{rows:o,overflow:r}=e;let{textOverflow:s}=n;if(o.splice(r),s&&"show"!==s){let e,d;"hide"===s?s="":"ellipsis"===s&&(s="...");const l=s?t.Platform.canvas.measureText(s).width:0,c=a+i-l;("none"===n.textWrap?o:[o[r-1]]).forEach((t=>{if(t.isOverflow&&t.data){let n=t.data.length-1;for(let a=n;a>-1&&(e=t.data[a],d=e.x+e.width,!(a===n&&d<c));a--){if(d<c&&" "!==e.char||!a){t.data.splice(a+1),t.width-=e.width;break}t.width-=e.width}t.width+=l,t.data.push({char:s,x:d}),t.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(t)}}))}}(h,a,i,r),"none"!==d&&function(t,n){let a;const{fontSize:i,textDecoration:o}=n;switch(t.decorationHeight=i/11,"object"==typeof o?(a=o.type,o.color&&(t.decorationColor=e.ColorConvert.string(o.color))):a=o,a){case"under":t.decorationY=[.15*i];break;case"delete":t.decorationY=[.35*-i];break;case"under-delete":t.decorationY=[.15*i,.35*-i]}}(h,a),h}};const Ue={string:function(t,n){const a="number"==typeof n&&1!==n;if("string"==typeof t){if(!a||!e.ColorConvert.object)return t;t=e.ColorConvert.object(t)}let i=void 0===t.a?1:t.a;a&&(i*=n);const o=t.r+","+t.g+","+t.b;return 1===i?"rgb("+o+")":"rgba("+o+","+i+")"}};Object.assign(e.TextConvert,qe),Object.assign(e.ColorConvert,Ue),Object.assign(e.Paint,O),Object.assign(e.PaintImage,pt),Object.assign(e.PaintGradient,Wt),Object.assign(e.Effect,Gt),i(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Layouter=w,exports.LeaferCanvas=n,exports.Renderer=m,exports.Watcher=r,exports.useCanvas=i,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]}})}));
|
|
2
2
|
//# sourceMappingURL=worker.min.cjs.map
|