@leafer-draw/worker 1.12.0 → 1.12.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 +5 -3
- package/dist/worker.esm.js +5 -3
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +94 -34
- 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 +95 -34
- 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.js
CHANGED
|
@@ -425,7 +425,7 @@ var LeaferUI = function(exports) {
|
|
|
425
425
|
};
|
|
426
426
|
}
|
|
427
427
|
const {sin: sin$5, cos: cos$5, acos: acos, sqrt: sqrt$3} = Math;
|
|
428
|
-
const {float: float$
|
|
428
|
+
const {float: float$2} = MathHelper;
|
|
429
429
|
const tempPoint$3 = {};
|
|
430
430
|
function getWorld() {
|
|
431
431
|
return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), {
|
|
@@ -673,12 +673,12 @@ var LeaferUI = function(exports) {
|
|
|
673
673
|
const cosR = c / scaleY;
|
|
674
674
|
rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
|
|
675
675
|
}
|
|
676
|
-
const cosR = float$
|
|
676
|
+
const cosR = float$2(cos$5(rotation));
|
|
677
677
|
const sinR = sin$5(rotation);
|
|
678
|
-
scaleX = float$
|
|
679
|
-
skewX = cosR ? float$
|
|
680
|
-
skewY = cosR ? float$
|
|
681
|
-
rotation = float$
|
|
678
|
+
scaleX = float$2(scaleX), scaleY = float$2(scaleY);
|
|
679
|
+
skewX = cosR ? float$2((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
|
|
680
|
+
skewY = cosR ? float$2((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
|
|
681
|
+
rotation = float$2(rotation / OneRadian);
|
|
682
682
|
} else {
|
|
683
683
|
scaleX = a;
|
|
684
684
|
scaleY = d;
|
|
@@ -720,6 +720,7 @@ var LeaferUI = function(exports) {
|
|
|
720
720
|
}
|
|
721
721
|
};
|
|
722
722
|
const M$6 = MatrixHelper;
|
|
723
|
+
const {float: float$1} = MathHelper;
|
|
723
724
|
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
|
|
724
725
|
const {sin: sin$4, cos: cos$4, abs: abs$4, sqrt: sqrt$2, atan2: atan2$2, min: min$1, round: round$2} = Math;
|
|
725
726
|
const PointHelper = {
|
|
@@ -785,6 +786,11 @@ var LeaferUI = function(exports) {
|
|
|
785
786
|
P$5.toInnerRadiusPointOf(t, matrix, temp);
|
|
786
787
|
return temp;
|
|
787
788
|
},
|
|
789
|
+
copyRadiusPoint(t, point, x, y) {
|
|
790
|
+
copy$9(t, point);
|
|
791
|
+
setRadius(t, x, y);
|
|
792
|
+
return t;
|
|
793
|
+
},
|
|
788
794
|
toInnerRadiusPointOf(t, matrix, to) {
|
|
789
795
|
to || (to = t);
|
|
790
796
|
toInnerPoint$2(matrix, t, to);
|
|
@@ -852,14 +858,14 @@ var LeaferUI = function(exports) {
|
|
|
852
858
|
return points;
|
|
853
859
|
},
|
|
854
860
|
isSame(t, point) {
|
|
855
|
-
return t.x === point.x && t.y === point.y;
|
|
861
|
+
return float$1(t.x) === float$1(point.x) && float$1(t.y) === float$1(point.y);
|
|
856
862
|
},
|
|
857
863
|
reset(t) {
|
|
858
864
|
P$5.reset(t);
|
|
859
865
|
}
|
|
860
866
|
};
|
|
861
867
|
const P$5 = PointHelper;
|
|
862
|
-
const {getDistanceFrom: getDistanceFrom, copy: copy$9, getAtan2: getAtan2} = P$5;
|
|
868
|
+
const {getDistanceFrom: getDistanceFrom, copy: copy$9, setRadius: setRadius, getAtan2: getAtan2} = P$5;
|
|
863
869
|
class Point {
|
|
864
870
|
constructor(x, y) {
|
|
865
871
|
this.set(x, y);
|
|
@@ -2241,7 +2247,7 @@ var LeaferUI = function(exports) {
|
|
|
2241
2247
|
const {pixelRatio: pixelRatio} = this;
|
|
2242
2248
|
this.filter = `blur(${blur * pixelRatio}px)`;
|
|
2243
2249
|
}
|
|
2244
|
-
copyWorld(canvas, from, to, blendMode, ceilPixel
|
|
2250
|
+
copyWorld(canvas, from, to, blendMode, ceilPixel) {
|
|
2245
2251
|
if (blendMode) this.blendMode = blendMode;
|
|
2246
2252
|
if (from) {
|
|
2247
2253
|
this.setTempPixelBounds(from, ceilPixel);
|
|
@@ -2252,7 +2258,7 @@ var LeaferUI = function(exports) {
|
|
|
2252
2258
|
}
|
|
2253
2259
|
if (blendMode) this.blendMode = "source-over";
|
|
2254
2260
|
}
|
|
2255
|
-
copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode, ceilPixel
|
|
2261
|
+
copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode, ceilPixel) {
|
|
2256
2262
|
if (fromWorld.b || fromWorld.c) {
|
|
2257
2263
|
this.save();
|
|
2258
2264
|
this.resetTransform();
|
|
@@ -2265,7 +2271,7 @@ var LeaferUI = function(exports) {
|
|
|
2265
2271
|
if (blendMode) this.blendMode = "source-over";
|
|
2266
2272
|
}
|
|
2267
2273
|
}
|
|
2268
|
-
copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform, ceilPixel
|
|
2274
|
+
copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform, ceilPixel) {
|
|
2269
2275
|
this.resetTransform();
|
|
2270
2276
|
this.copyWorld(canvas, from, to, blendMode, ceilPixel);
|
|
2271
2277
|
if (!onlyResetTransform) this.useWorldTransform();
|
|
@@ -2474,7 +2480,7 @@ var LeaferUI = function(exports) {
|
|
|
2474
2480
|
data.push(M$5, points[0], points[1]);
|
|
2475
2481
|
if (curve && points.length > 5) {
|
|
2476
2482
|
let aX, aY, bX, bY, cX, cY, c1X, c1Y, c2X, c2Y;
|
|
2477
|
-
let ba, cb, d, len = points.length;
|
|
2483
|
+
let baX, baY, ba, cb, d, len = points.length;
|
|
2478
2484
|
const t = curve === true ? .5 : curve;
|
|
2479
2485
|
if (close) {
|
|
2480
2486
|
points = [ points[len - 2], points[len - 1], ...points, points[0], points[1], points[2], points[3] ];
|
|
@@ -2487,7 +2493,9 @@ var LeaferUI = function(exports) {
|
|
|
2487
2493
|
bY = points[i + 1];
|
|
2488
2494
|
cX = points[i + 2];
|
|
2489
2495
|
cY = points[i + 3];
|
|
2490
|
-
|
|
2496
|
+
baX = bX - aX;
|
|
2497
|
+
baY = bY - aY;
|
|
2498
|
+
ba = sqrt$1(pow(baX, 2) + pow(baY, 2));
|
|
2491
2499
|
cb = sqrt$1(pow(cX - bX, 2) + pow(cY - bY, 2));
|
|
2492
2500
|
if (!ba && !cb) continue;
|
|
2493
2501
|
d = ba + cb;
|
|
@@ -2500,7 +2508,7 @@ var LeaferUI = function(exports) {
|
|
|
2500
2508
|
if (i === 2) {
|
|
2501
2509
|
if (!close) data.push(Q$4, c1X, c1Y, bX, bY);
|
|
2502
2510
|
} else {
|
|
2503
|
-
data.push(C$4, c2X, c2Y, c1X, c1Y, bX, bY);
|
|
2511
|
+
if (baX || baY) data.push(C$4, c2X, c2Y, c1X, c1Y, bX, bY);
|
|
2504
2512
|
}
|
|
2505
2513
|
c2X = bX + cb * cX;
|
|
2506
2514
|
c2Y = bY + cb * cY;
|
|
@@ -3068,6 +3076,7 @@ var LeaferUI = function(exports) {
|
|
|
3068
3076
|
}
|
|
3069
3077
|
},
|
|
3070
3078
|
ellipse(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
3079
|
+
if (radiusX === radiusY) return arc$2(data, x, y, radiusX, startAngle, endAngle, anticlockwise);
|
|
3071
3080
|
if (isNull(rotation)) {
|
|
3072
3081
|
data.push(F$3, x, y, radiusX, radiusY);
|
|
3073
3082
|
} else {
|
|
@@ -3080,6 +3089,7 @@ var LeaferUI = function(exports) {
|
|
|
3080
3089
|
if (isNull(startAngle)) {
|
|
3081
3090
|
data.push(P$2, x, y, radius);
|
|
3082
3091
|
} else {
|
|
3092
|
+
if (isNull(startAngle)) startAngle = 0;
|
|
3083
3093
|
if (isNull(endAngle)) endAngle = 360;
|
|
3084
3094
|
data.push(O$2, x, y, radius, startAngle, endAngle, anticlockwise ? 1 : 0);
|
|
3085
3095
|
}
|
|
@@ -3411,6 +3421,7 @@ var LeaferUI = function(exports) {
|
|
|
3411
3421
|
smooth(data, cornerRadius, _cornerSmoothing) {
|
|
3412
3422
|
let command, lastCommand, commandLen;
|
|
3413
3423
|
let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
|
|
3424
|
+
if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
|
|
3414
3425
|
const len = data.length;
|
|
3415
3426
|
const smooth = [];
|
|
3416
3427
|
while (i < len) {
|
|
@@ -3808,7 +3819,9 @@ var LeaferUI = function(exports) {
|
|
|
3808
3819
|
const ImageManager = {
|
|
3809
3820
|
maxRecycled: 10,
|
|
3810
3821
|
recycledList: [],
|
|
3811
|
-
patternTasker: new TaskProcessor
|
|
3822
|
+
patternTasker: new TaskProcessor({
|
|
3823
|
+
parallel: 1
|
|
3824
|
+
}),
|
|
3812
3825
|
get(config) {
|
|
3813
3826
|
let image = Resource.get(config.url);
|
|
3814
3827
|
if (!image) Resource.set(config.url, image = Creator.image(config));
|
|
@@ -4652,9 +4665,52 @@ var LeaferUI = function(exports) {
|
|
|
4652
4665
|
if (exclude && exclude === branch) continue;
|
|
4653
4666
|
updateBounds$3(branch);
|
|
4654
4667
|
}
|
|
4668
|
+
},
|
|
4669
|
+
move(branch, x, y) {
|
|
4670
|
+
let w;
|
|
4671
|
+
const {children: children} = branch;
|
|
4672
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
4673
|
+
branch = children[i];
|
|
4674
|
+
w = branch.__world;
|
|
4675
|
+
w.e += x;
|
|
4676
|
+
w.f += y;
|
|
4677
|
+
w.x += x;
|
|
4678
|
+
w.y += y;
|
|
4679
|
+
if (branch.isBranch) move$3(branch, x, y);
|
|
4680
|
+
}
|
|
4681
|
+
},
|
|
4682
|
+
scale(branch, x, y, scaleX, scaleY, a, b) {
|
|
4683
|
+
let w;
|
|
4684
|
+
const {children: children} = branch;
|
|
4685
|
+
const changeScaleX = scaleX - 1;
|
|
4686
|
+
const changeScaleY = scaleY - 1;
|
|
4687
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
4688
|
+
branch = children[i];
|
|
4689
|
+
w = branch.__world;
|
|
4690
|
+
w.a *= scaleX;
|
|
4691
|
+
w.d *= scaleY;
|
|
4692
|
+
if (w.b || w.c) {
|
|
4693
|
+
w.b *= scaleX;
|
|
4694
|
+
w.c *= scaleY;
|
|
4695
|
+
}
|
|
4696
|
+
if (w.e === w.x && w.f === w.y) {
|
|
4697
|
+
w.x = w.e += (w.e - a) * changeScaleX + x;
|
|
4698
|
+
w.y = w.f += (w.f - b) * changeScaleY + y;
|
|
4699
|
+
} else {
|
|
4700
|
+
w.e += (w.e - a) * changeScaleX + x;
|
|
4701
|
+
w.f += (w.f - b) * changeScaleY + y;
|
|
4702
|
+
w.x += (w.x - a) * changeScaleX + x;
|
|
4703
|
+
w.y += (w.y - b) * changeScaleY + y;
|
|
4704
|
+
}
|
|
4705
|
+
w.width *= scaleX;
|
|
4706
|
+
w.height *= scaleY;
|
|
4707
|
+
w.scaleX *= scaleX;
|
|
4708
|
+
w.scaleY *= scaleY;
|
|
4709
|
+
if (branch.isBranch) scale$1(branch, x, y, scaleX, scaleY, a, b);
|
|
4710
|
+
}
|
|
4655
4711
|
}
|
|
4656
4712
|
};
|
|
4657
|
-
const {pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack: pushAllBranchStack, updateBoundsByBranchStack: updateBoundsByBranchStack} = BranchHelper;
|
|
4713
|
+
const {pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack: pushAllBranchStack, updateBoundsByBranchStack: updateBoundsByBranchStack, move: move$3, scale: scale$1} = BranchHelper;
|
|
4658
4714
|
const WaitHelper = {
|
|
4659
4715
|
run(wait) {
|
|
4660
4716
|
if (wait && wait.length) {
|
|
@@ -6118,10 +6174,10 @@ var LeaferUI = function(exports) {
|
|
|
6118
6174
|
hit(_world, _hitRadius) {
|
|
6119
6175
|
return true;
|
|
6120
6176
|
}
|
|
6121
|
-
__hitWorld(_point) {
|
|
6177
|
+
__hitWorld(_point, _forceHitFill) {
|
|
6122
6178
|
return true;
|
|
6123
6179
|
}
|
|
6124
|
-
__hit(_local) {
|
|
6180
|
+
__hit(_local, _forceHitFill) {
|
|
6125
6181
|
return true;
|
|
6126
6182
|
}
|
|
6127
6183
|
__hitFill(_inner) {
|
|
@@ -6470,7 +6526,7 @@ var LeaferUI = function(exports) {
|
|
|
6470
6526
|
this.levelMap = null;
|
|
6471
6527
|
}
|
|
6472
6528
|
}
|
|
6473
|
-
const version = "1.12.
|
|
6529
|
+
const version = "1.12.2";
|
|
6474
6530
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6475
6531
|
get allowBackgroundColor() {
|
|
6476
6532
|
return true;
|
|
@@ -7561,7 +7617,7 @@ var LeaferUI = function(exports) {
|
|
|
7561
7617
|
if (stroke && !__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
|
|
7562
7618
|
}
|
|
7563
7619
|
} else {
|
|
7564
|
-
if (data.
|
|
7620
|
+
if (data.__pathForRender) drawFast(this, canvas, options); else this.__drawFast(canvas, options);
|
|
7565
7621
|
}
|
|
7566
7622
|
},
|
|
7567
7623
|
__drawShape(canvas, options) {
|
|
@@ -7681,7 +7737,7 @@ var LeaferUI = function(exports) {
|
|
|
7681
7737
|
getPath(curve, pathForRender) {
|
|
7682
7738
|
this.__layout.update();
|
|
7683
7739
|
let path = pathForRender ? this.__.__pathForRender : this.__.path;
|
|
7684
|
-
if (!path) pen.set(path = []), this.__drawPathByBox(pen);
|
|
7740
|
+
if (!path) pen.set(path = []), this.__drawPathByBox(pen, !pathForRender);
|
|
7685
7741
|
return curve ? PathConvert.toCanvasData(path, true) : path;
|
|
7686
7742
|
}
|
|
7687
7743
|
getPathString(curve, pathForRender, floatLength) {
|
|
@@ -7709,17 +7765,18 @@ var LeaferUI = function(exports) {
|
|
|
7709
7765
|
}
|
|
7710
7766
|
__drawPath(canvas) {
|
|
7711
7767
|
canvas.beginPath();
|
|
7712
|
-
this.__drawPathByData(canvas, this.__.path);
|
|
7768
|
+
this.__drawPathByData(canvas, this.__.path, true);
|
|
7713
7769
|
}
|
|
7714
|
-
__drawPathByData(drawer, data) {
|
|
7715
|
-
data ? PathDrawer.drawPathByData(drawer, data) : this.__drawPathByBox(drawer);
|
|
7770
|
+
__drawPathByData(drawer, data, ignoreCornerRadius) {
|
|
7771
|
+
data ? PathDrawer.drawPathByData(drawer, data) : this.__drawPathByBox(drawer, ignoreCornerRadius);
|
|
7716
7772
|
}
|
|
7717
|
-
__drawPathByBox(drawer) {
|
|
7773
|
+
__drawPathByBox(drawer, ignoreCornerRadius) {
|
|
7718
7774
|
const {x: x, y: y, width: width, height: height} = this.__layout.boxBounds;
|
|
7719
|
-
if (this.__.cornerRadius) {
|
|
7775
|
+
if (this.__.cornerRadius && !ignoreCornerRadius) {
|
|
7720
7776
|
const {cornerRadius: cornerRadius} = this.__;
|
|
7721
7777
|
drawer.roundRect(x, y, width, height, isNumber(cornerRadius) ? [ cornerRadius ] : cornerRadius);
|
|
7722
7778
|
} else drawer.rect(x, y, width, height);
|
|
7779
|
+
drawer.closePath();
|
|
7723
7780
|
}
|
|
7724
7781
|
drawImagePlaceholder(_paint, canvas, renderOptions) {
|
|
7725
7782
|
Paint.fill(this.__.placeholderColor, this, canvas, renderOptions);
|
|
@@ -7906,6 +7963,9 @@ var LeaferUI = function(exports) {
|
|
|
7906
7963
|
get layoutLocked() {
|
|
7907
7964
|
return !this.layouter.running;
|
|
7908
7965
|
}
|
|
7966
|
+
get view() {
|
|
7967
|
+
return this.canvas && this.canvas.view;
|
|
7968
|
+
}
|
|
7909
7969
|
get FPS() {
|
|
7910
7970
|
return this.renderer ? this.renderer.FPS : 60;
|
|
7911
7971
|
}
|
|
@@ -7957,7 +8017,6 @@ var LeaferUI = function(exports) {
|
|
|
7957
8017
|
this.__controllers.push(this.renderer = Creator.renderer(this, canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
|
|
7958
8018
|
if (this.isApp) this.__setApp();
|
|
7959
8019
|
this.__checkAutoLayout();
|
|
7960
|
-
this.view = canvas.view;
|
|
7961
8020
|
if (!parentApp) {
|
|
7962
8021
|
this.selector = Creator.selector(this);
|
|
7963
8022
|
this.interaction = Creator.interaction(this, canvas, this.selector, config);
|
|
@@ -8237,7 +8296,7 @@ var LeaferUI = function(exports) {
|
|
|
8237
8296
|
if (this.canvasManager) this.canvasManager.destroy();
|
|
8238
8297
|
}
|
|
8239
8298
|
if (this.canvas) this.canvas.destroy();
|
|
8240
|
-
this.config.view = this.
|
|
8299
|
+
this.config.view = this.parentApp = null;
|
|
8241
8300
|
if (this.userConfig) this.userConfig.view = null;
|
|
8242
8301
|
super.destroy();
|
|
8243
8302
|
setTimeout(() => {
|
|
@@ -8389,7 +8448,6 @@ var LeaferUI = function(exports) {
|
|
|
8389
8448
|
if (startAngle || endAngle) {
|
|
8390
8449
|
if (innerRadius < 1) ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false);
|
|
8391
8450
|
ellipse(path, rx, ry, rx, ry, 0, endAngle, startAngle, true);
|
|
8392
|
-
if (innerRadius < 1) closePath$2(path);
|
|
8393
8451
|
} else {
|
|
8394
8452
|
if (innerRadius < 1) {
|
|
8395
8453
|
ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
|
|
@@ -8397,16 +8455,16 @@ var LeaferUI = function(exports) {
|
|
|
8397
8455
|
}
|
|
8398
8456
|
ellipse(path, rx, ry, rx, ry, 0, 360, 0, true);
|
|
8399
8457
|
}
|
|
8400
|
-
if (Platform.ellipseToCurve) this.__.path = this.getPath(true);
|
|
8401
8458
|
} else {
|
|
8402
8459
|
if (startAngle || endAngle) {
|
|
8403
8460
|
moveTo$3(path, rx, ry);
|
|
8404
8461
|
ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle, false);
|
|
8405
|
-
closePath$2(path);
|
|
8406
8462
|
} else {
|
|
8407
8463
|
ellipse(path, rx, ry, rx, ry);
|
|
8408
8464
|
}
|
|
8409
8465
|
}
|
|
8466
|
+
closePath$2(path);
|
|
8467
|
+
if (Platform.ellipseToCurve) this.__.path = this.getPath(true);
|
|
8410
8468
|
}
|
|
8411
8469
|
};
|
|
8412
8470
|
__decorate([ dataProcessor(EllipseData) ], exports.Ellipse.prototype, "__", void 0);
|
|
@@ -9375,10 +9433,12 @@ var LeaferUI = function(exports) {
|
|
|
9375
9433
|
function createPatternTask(paint, ui, canvas, renderOptions) {
|
|
9376
9434
|
if (!paint.patternTask) {
|
|
9377
9435
|
paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function*() {
|
|
9378
|
-
paint
|
|
9379
|
-
if (canvas.bounds.hit(ui.__nowWorld)) PaintImage.createPattern(paint, ui, canvas, renderOptions);
|
|
9436
|
+
PaintImage.createPattern(paint, ui, canvas, renderOptions);
|
|
9380
9437
|
ui.forceUpdate("surface");
|
|
9381
|
-
}),
|
|
9438
|
+
}), 0, () => {
|
|
9439
|
+
paint.patternTask = null;
|
|
9440
|
+
return canvas.bounds.hit(ui.__nowWorld);
|
|
9441
|
+
});
|
|
9382
9442
|
}
|
|
9383
9443
|
}
|
|
9384
9444
|
function createPattern(paint, ui, canvas, renderOptions) {
|
package/dist/worker.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t,e=require("@leafer/core"),a=require("@leafer-ui/draw");exports.PathNodeHandleType=void 0,(t=exports.PathNodeHandleType||(exports.PathNodeHandleType={}))[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror";class n extends e.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=e.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:a}=this;this.view.width=Math.ceil(t*a),this.view.height=Math.ceil(e*a),this.clientBounds=this.bounds}}e.canvasPatch(OffscreenCanvasRenderingContext2D.prototype),e.canvasPatch(Path2D.prototype);const{mineType:r}=e.FileHelper;function i(t,a){e.Platform.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,a)=>new Promise((n,i)=>{t.convertToBlob({type:r(e),quality:a}).then(t=>{var e=new FileReader;e.onload=t=>n(t.target.result),e.onerror=t=>i(t),e.readAsDataURL(t)}).catch(t=>{i(t)})}),canvasToBolb:(t,e,a)=>t.convertToBlob({type:r(e),quality:a}),canvasSaveAs:(t,e,a)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((a,n)=>{let r=new XMLHttpRequest;r.open("GET",e.Platform.image.getRealURL(t),!0),r.responseType="blob",r.onload=()=>{createImageBitmap(r.response).then(t=>{a(t)}).catch(t=>{n(t)})},r.onerror=t=>n(t),r.send()})},e.Platform.canvas=e.Creator.canvas(),e.Platform.conicGradientSupport=!!e.Platform.canvas.context.createConicGradient}Object.assign(e.Creator,{canvas:(t,e)=>new n(t,e),image:t=>new e.LeaferImage(t)}),e.Platform.name="web",e.Platform.isWorker=!0,e.Platform.backgrounder=!0,e.Platform.requestRender=function(t){requestAnimationFrame(t)},e.defineKey(e.Platform,"devicePixelRatio",{get:()=>1});const{userAgent:s}=navigator;s.indexOf("Firefox")>-1?(e.Platform.conicGradientRotate90=!0,e.Platform.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(e.Platform.fullImageShadow=!0),s.indexOf("Windows")>-1?(e.Platform.os="Windows",e.Platform.intWheelDeltaY=!0):s.indexOf("Mac")>-1?e.Platform.os="Mac":s.indexOf("Linux")>-1&&(e.Platform.os="Linux");class o{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new e.LeafList;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,a){this.totalTimes=0,this.config={},this.__updatedList=new e.LeafList,this.target=t,a&&(this.config=e.DataHelper.default(a,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(e.RenderEvent.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===e.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent))),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,a=e.length;t<a;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new e.WatchEvent(e.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new e.LeafList,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[e.PropertyEvent.CHANGE,this.__onAttrChange,this],[[e.ChildEvent.ADD,e.ChildEvent.REMOVE],this.__onChildEvent,this],[e.WatchEvent.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:l,updateBounds:d,updateChange:c}=e.LeafHelper,{pushAllChildBranch:h,pushAllParent:u}=e.BranchHelper;const{worldBounds:f}=e.LeafBoundsHelper;class p{constructor(t){this.updatedBounds=new e.Bounds,this.beforeBounds=new e.Bounds,this.afterBounds=new e.Bounds,e.isArray(t)&&(t=new e.LeafList(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,f)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,f),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:_}=e.LeafHelper,m=e.Debug.get("Layouter");class y{constructor(t,a){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new e.LeafLevelList,this.target=t,a&&(this.config=e.DataHelper.default(a,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.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(e.LayoutEvent.START),this.layoutOnce(),t.emitEvent(new e.LayoutEvent(e.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){m.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?m.warn("layouting"):this.times>3?m.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(e.WatchEvent.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const a=e.Run.start("PartLayout"),{target:n,__updatedList:r}=this,{BEFORE:i,LAYOUT:s,AFTER:o}=e.LayoutEvent,f=this.getBlocks(r);f.forEach(t=>t.setBefore()),n.emitEvent(new e.LayoutEvent(i,f,this.times)),this.extraBlock=null,r.sort(),function(t,e){let a;t.list.forEach(t=>{a=t.__layout,e.without(t)&&!a.proxyZoom&&(a.matrixChanged?(l(t,!0),e.add(t),t.isBranch&&h(t,e),u(t,e)):a.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),u(t,e)))})}(r,this.__levelList),function(t){let e,a,n;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(a=e[t],a.isBranch&&a.__tempNumber){n=a.children;for(let t=0,e=n.length;t<e;t++)n[t].isBranch||d(n[t])}d(a)}})}(this.__levelList),function(t){t.list.forEach(c)}(r),this.extraBlock&&f.push(this.extraBlock),f.forEach(t=>t.setAfter()),n.emitEvent(new e.LayoutEvent(s,f,this.times)),n.emitEvent(new e.LayoutEvent(o,f,this.times)),this.addBlocks(f),this.__levelList.reset(),this.__updatedList=null,e.Run.end(a)}fullLayout(){const t=e.Run.start("FullLayout"),{target:a}=this,{BEFORE:n,LAYOUT:r,AFTER:i}=e.LayoutEvent,s=this.getBlocks(new e.LeafList(a));a.emitEvent(new e.LayoutEvent(n,s,this.times)),y.fullLayout(a),s.forEach(t=>{t.setAfter()}),a.emitEvent(new e.LayoutEvent(r,s,this.times)),a.emitEvent(new e.LayoutEvent(i,s,this.times)),this.addBlocks(s),e.Run.end(t)}static fullLayout(t){g(t,!0),t.isBranch?e.BranchHelper.updateBounds(t):e.LeafHelper.updateBounds(t),_(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:a}=this.extraBlock||(this.extraBlock=new p([]));e.length?a.add(t.__world):a.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(){this.__eventIds=[this.target.on_([[e.LayoutEvent.REQUEST,this.layout,this],[e.LayoutEvent.AGAIN,this.layoutAgain,this],[e.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=e.Debug.get("Renderer");class v{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,a,n){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=a,n&&(this.config=e.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit(e.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(e.RenderEvent.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(e.RenderEvent.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(e.RenderEvent.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:a}=this;this.times=0,this.totalBounds=new e.Bounds,w.log(a.innerName,"---\x3e");try{this.emitRender(e.RenderEvent.START),this.renderOnce(t),this.emitRender(e.RenderEvent.END,this.totalBounds),e.ImageManager.clearRecycled()}catch(t){this.rendering=!1,w.error(t)}w.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){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 e.Bounds,this.renderOptions={},t)this.emitRender(e.RenderEvent.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(e.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(e.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(e.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(t){const a=e.Run.start("PartRender"),{canvas:n}=this,r=t.getIntersect(n.bounds),i=new e.Bounds(r);n.save(),r.spread(v.clipSpread).ceil(),n.clearWorld(r),n.clipWorld(r),this.__render(r,i),n.restore(),e.Run.end(a)}fullRender(){const t=e.Run.start("FullRender"),{canvas:a}=this;a.save(),a.clear(),this.__render(a.bounds),a.restore(),e.Run.end(t)}__render(t,a){const{canvas:n,target:r}=this,i=t.includes(r.__world),s=i?{includes:i}:{bounds:t,includes:i};this.needFill&&n.fillWorld(t,this.config.fill),e.Debug.showRepaint&&e.Debug.drawRepaint(n,t),this.config.useCellRender&&(s.cellList=this.getCellList()),e.Platform.render(r,n,s),this.renderBounds=a=a||t,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=a:this.totalBounds.add(a),n.updateRender(a)}getCellList(){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const a=new e.Bounds;a.setList(t),t.length=0,t.push(a)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const a=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:n}=this.config;if(n&&t>n)return e.Platform.requestRender(a);const{frames:r}=this;r.length>30&&r.shift(),r.push(t),this.FPS=Math.round(r.reduce((t,e)=>t+e,0)/r.length),this.requestTime=0,this.checkRender()};e.Platform.requestRender(a)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:a,height:n}=t.old;if(!new e.Bounds(0,0,a,n).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new e.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(t,a,n){this.target.emitEvent(new e.RenderEvent(t,this.times,a,n))}__listenEvents(){this.__eventIds=[this.target.on_([[e.RenderEvent.REQUEST,this.update,this],[e.LayoutEvent.END,this.__onLayoutEnd,this],[e.RenderEvent.AGAIN,this.renderAgain,this],[e.ResizeEvent.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}function x(t,e,n){t.__.__font?a.Paint.fillText(t,e,n):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function b(t,n,r,i,s){const o=r.__;e.isObject(t)?a.Paint.drawStrokesStyle(t,n,!1,r,i,s):(i.setStroke(t,o.__strokeWidth*n,o),i.stroke()),o.__useArrow&&a.Paint.strokeArrow(t,r,i,s)}function E(t,n,r,i,s){const o=r.__;e.isObject(t)?a.Paint.drawStrokesStyle(t,n,!0,r,i,s):(i.setStroke(t,o.__strokeWidth*n,o),a.Paint.drawTextStroke(r,i,s))}function P(t,n,r,i,s){const o=i.getSameCanvas(!0,!0);o.font=r.__.__font,E(t,2,r,o,s),o.blendMode="outside"===n?"destination-out":"destination-in",a.Paint.fillText(r,o,s),o.blendMode="normal",e.LeafHelper.copyCanvasByWorld(r,i,o),o.recycle(r.__nowWorld)}v.clipSpread=10,Object.assign(e.Creator,{watcher:(t,e)=>new o(t,e),layouter:(t,e)=>new y(t,e),renderer:(t,e,a)=>new v(t,e,a),selector:(t,e)=>{},interaction:(t,e,a,n)=>{}}),e.Platform.layout=y.fullLayout,e.Platform.render=function(t,a,n){const r=Object.assign(Object.assign({},n),{topRendering:!0});n.topList=new e.LeafList,t.__render(a,n),n.topList.length&&n.topList.forEach(t=>t.__render(a,r))};const{getSpread:S,copyAndSpread:B,toOuterOf:L,getOuterOf:k,getByMove:R,move:C,getIntersectData:A}=e.BoundsHelper,T={};let O;const{stintSet:I}=e.DataHelper,{hasTransparent:M}=a.ColorConvert;function W(t,n,r){if(!e.isObject(n)||!1===n.visible||0===n.opacity)return;let i;const{boxBounds:s}=r.__layout;switch(n.type){case"image":if(!n.url)return;i=a.PaintImage.image(r,t,n,s,!O||!O[n.url]);break;case"linear":i=a.PaintGradient.linearGradient(n,s);break;case"radial":i=a.PaintGradient.radialGradient(n,s);break;case"angular":i=a.PaintGradient.conicGradient(n,s);break;case"solid":const{type:o,color:l,opacity:d}=n;i={type:o,style:a.ColorConvert.string(l,d)};break;default:e.isUndefined(n.r)||(i={type:"solid",style:a.ColorConvert.string(n)})}if(i&&(i.originPaint=n,e.isString(i.style)&&M(i.style)&&(i.isTransparent=!0),n.style)){if(0===n.style.strokeWidth)return;i.strokeStyle=n.style}return i}const D={compute:function(t,n){const r=n.__,i=[];let s,o,l,d=r.__input[t];e.isArray(d)||(d=[d]),O=a.PaintImage.recycleImage(t,r);for(let e,a=0,r=d.length;a<r;a++)(e=W(t,d[a],n))&&(i.push(e),e.strokeStyle&&(l||(l=1),e.strokeStyle.strokeWidth&&(l=Math.max(l,e.strokeStyle.strokeWidth))));r["_"+t]=i.length?i:void 0,i.length?(i.every(t=>t.isTransparent)&&(i.some(t=>t.image)&&(s=!0),o=!0),"fill"===t?(I(r,"__isAlphaPixelFill",s),I(r,"__isTransparentFill",o)):(I(r,"__isAlphaPixelStroke",s),I(r,"__isTransparentStroke",o),I(r,"__hasMultiStrokeStyle",l))):r.__removePaint(t,!1)},fill:function(t,e,a,n){a.fillStyle=t,x(e,a,n)},fills:function(t,e,n,r){let i,s,o;for(let l=0,d=t.length;l<d;l++){if(i=t[l],s=i.originPaint,i.image){if(o?o++:o=1,a.PaintImage.checkImage(i,!e.__.__font,e,n,r))continue;if(!i.style){1===o&&i.image.isPlacehold&&e.drawImagePlaceholder(i,n,r);continue}}if(n.fillStyle=i.style,i.transform||s.scaleFixed){if(n.save(),i.transform&&n.transform(i.transform),s.scaleFixed){const{scaleX:t,scaleY:a}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&a>1)&&n.scale(1/t,1/a)}s.blendMode&&(n.blendMode=s.blendMode),x(e,n,r),n.restore()}else s.blendMode?(n.saveBlendMode(s.blendMode),x(e,n,r),n.restoreBlendMode()):x(e,n,r)}},fillPathOrText:x,fillText:function(t,e,a){const n=t.__,{rows:r,decorationY:i}=n.__textDrawData;let s;n.__isPlacehold&&n.placeholderColor&&(e.fillStyle=n.placeholderColor);for(let t=0,a=r.length;t<a;t++)s=r[t],s.text?e.fillText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.fillText(t.char,t.x,s.y)});if(i){const{decorationColor:t,decorationHeight:a}=n.__textDrawData;t&&(e.fillStyle=t),r.forEach(t=>i.forEach(n=>e.fillRect(t.x,t.y+n,t.width,a)))}},stroke:function(t,n,r,i){const s=n.__;if(s.__strokeWidth)if(s.__font)a.Paint.strokeText(t,n,r,i);else switch(s.strokeAlign){case"center":b(t,1,n,r,i);break;case"inside":!function(t,e,a,n){a.save(),a.clipUI(e),b(t,2,e,a,n),a.restore()}(t,n,r,i);break;case"outside":!function(t,a,n,r){const i=a.__;if(i.__fillAfterStroke)b(t,2,a,n,r);else{const{renderBounds:s}=a.__layout,o=n.getSameCanvas(!0,!0);a.__drawRenderPath(o),b(t,2,a,o,r),o.clipUI(i),o.clearWorld(s),e.LeafHelper.copyCanvasByWorld(a,n,o),o.recycle(a.__nowWorld)}}(t,n,r,i)}},strokes:function(t,e,n,r){a.Paint.stroke(t,e,n,r)},strokeText:function(t,e,a,n){switch(e.__.strokeAlign){case"center":E(t,1,e,a,n);break;case"inside":P(t,"inside",e,a,n);break;case"outside":e.__.__fillAfterStroke?E(t,2,e,a,n):P(t,"outside",e,a,n)}},drawTextStroke:function(t,e,a){let n,r=t.__.__textDrawData;const{rows:i,decorationY:s}=r;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(s){const{decorationHeight:t}=r;i.forEach(a=>s.forEach(n=>e.strokeRect(a.x,a.y+n,a.width,t)))}},drawStrokesStyle:function(t,e,n,r,i,s){let o;const l=r.__,{__hasMultiStrokeStyle:d}=l;d||i.setStroke(void 0,l.__strokeWidth*e,l);for(let c=0,h=t.length;c<h;c++)if(o=t[c],(!o.image||!a.PaintImage.checkImage(o,!1,r,i,s))&&o.style){if(d){const{strokeStyle:t}=o;t?i.setStroke(o.style,l.__getRealStrokeWidth(t)*e,l,t):i.setStroke(o.style,l.__strokeWidth*e,l)}else i.strokeStyle=o.style;o.originPaint.blendMode?(i.saveBlendMode(o.originPaint.blendMode),n?a.Paint.drawTextStroke(r,i,s):i.stroke(),i.restoreBlendMode()):n?a.Paint.drawTextStroke(r,i,s):i.stroke()}},shape:function(t,a,n){const r=a.getSameCanvas(),i=a.bounds,s=t.__nowWorld,o=t.__layout,l=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let d,c,h,u,f,p;L(o.strokeSpread?(B(T,o.boxBounds,o.strokeSpread),T):o.boxBounds,s,l);let{scaleX:g,scaleY:_}=t.getRenderScaleData(!0);if(i.includes(l))p=r,d=f=l,c=s;else{let r;if(e.Platform.fullImageShadow)r=l;else{const t=o.renderShapeSpread?S(i,e.FourNumberHelper.swapAndScale(o.renderShapeSpread,g,_)):i;r=A(t,l)}u=i.getFitMatrix(r);let{a:m,d:y}=u;u.a<1&&(p=a.getSameCanvas(),t.__renderShape(p,n),g*=m,_*=y),f=k(l,u),d=R(f,-u.e,-u.f),c=k(s,u),C(c,-u.e,-u.f);const w=n.matrix;w?(h=new e.Matrix(u),h.multiply(w),m*=w.scaleX,y*=w.scaleY):h=u,h.withScale(m,y),n=Object.assign(Object.assign({},n),{matrix:h})}return t.__renderShape(r,n),{canvas:r,matrix:h,fitMatrix:u,bounds:d,renderBounds:c,worldCanvas:p,shapeBounds:f,scaleX:g,scaleY:_}}};let H,F=new e.Bounds;const{isSame:j}=e.BoundsHelper;function G(t,e,n,r,i,s){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=r.width/e.pixelRatio,e.__naturalHeight=r.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||a.PaintImage.createData(i,r,n,s),!0}function Y(t,a){X(t,e.ImageEvent.LOAD,a)}function U(t,a){X(t,e.ImageEvent.LOADED,a)}function N(t,a,n){a.error=n,t.forceUpdate("surface"),X(t,e.ImageEvent.ERROR,a)}function X(t,a,n){t.hasEvent(a)&&t.emitEvent(new e.ImageEvent(a,n))}function q(t,e){const{leafer:a}=t;a&&a.viewReady&&(a.renderer.ignore=e)}const{get:z,translate:V}=e.MatrixHelper,Q=new e.Bounds,Z={},K={};function $(t,a,n,r){const i=e.isString(t)||r?(r?n-r*a:n%a)/((r||Math.floor(n/a))-1):t;return"auto"===t&&i<0?0:i}let J={},tt=e.getMatrixData();const{get:et,set:at,rotateOfOuter:nt,translate:rt,scaleOfOuter:it,multiplyParent:st,scale:ot,rotate:lt,skew:dt}=e.MatrixHelper;function ct(t,e,a,n,r,i,s,o){s&<(t,s),o&&dt(t,o.x,o.y),r&&ot(t,r,i),rt(t,e.x+a,e.y+n)}function ht(t,e,a,n){return new(a||(a=Promise))(function(r,i){function s(t){try{l(n.next(t))}catch(t){i(t)}}function o(t){try{l(n.throw(t))}catch(t){i(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof a?e:new a(function(t){t(e)})).then(s,o)}l((n=n.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const{get:ut,scale:ft,copy:pt}=e.MatrixHelper,{getFloorScale:gt}=e.MathHelper,{abs:_t}=Math;const mt={image:function(t,a,n,r,i){let s,o;const l=e.ImageManager.get(n);return H&&n===H.paint&&j(r,H.boxBounds)?s=H.leafPaint:(s={type:n.type,image:l},l.hasAlphaPixel&&(s.isTransparent=!0),H=l.use>1?{leafPaint:s,paint:n,boxBounds:F.set(r)}:null),(i||l.loading)&&(o={image:l,attrName:a,attrValue:n}),l.ready?(G(t,a,n,l,s,r),i&&(Y(t,o),U(t,o))):l.error?i&&N(t,o,l.error):(i&&(q(t,!0),Y(t,o)),s.loadId=l.load(()=>{q(t,!1),t.destroyed||(G(t,a,n,l,s,r)&&(l.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),U(t,o)),s.loadId=void 0},e=>{q(t,!1),N(t,o,e),s.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{l.ready||(l.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):l.isPlacehold=!0)),s},checkImage:function(t,n,r,i,s){const{scaleX:o,scaleY:l}=a.PaintImage.getImageRenderScaleData(t,r,i,s),{image:d,data:c,originPaint:h}=t,{exporting:u}=s;return!(!c||t.patternId===o+"-"+l&&!u)&&(n&&(c.repeat?n=!1:h.changeful||"miniapp"===e.Platform.name&&e.ResizeEvent.isResizing(r)||u||(n=e.Platform.image.isLarge(d,o,l)||d.width*o>8096||d.height*l>8096)),n?(r.__.__isFastShadow&&(i.fillStyle=t.style||"#000",i.fill()),a.PaintImage.drawImage(t,o,l,r,i,s),!0):(!t.style||h.sync||u?a.PaintImage.createPattern(t,r,i,s):a.PaintImage.createPatternTask(t,r,i,s),!1))},drawImage:function(t,e,a,n,r,i){const{data:s,image:o}=t,{blendMode:l}=t.originPaint,{opacity:d,transform:c}=s,h=o.getFull(s.filters),u=n.__;let f,{width:p,height:g}=o;(f=c&&!c.onlyScale||u.path||u.cornerRadius)||d||l?(r.save(),f&&r.clipUI(n),l&&(r.blendMode=l),d&&(r.opacity*=d),c&&r.transform(c),r.drawImage(h,0,0,p,g),r.restore()):(s.scaleX&&(p*=s.scaleX,g*=s.scaleY),r.drawImage(h,0,0,p,g))},getImageRenderScaleData:function(t,e,a,n){const r=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:i}=t;if(a){const{pixelRatio:t}=a;r.scaleX*=t,r.scaleY*=t}return i&&i.scaleX&&(r.scaleX*=Math.abs(i.scaleX),r.scaleY*=Math.abs(i.scaleY)),r},recycleImage:function(t,a){const n=a["_"+t];if(e.isArray(n)){let r,i,s,o,l;for(let d=0,c=n.length;d<c;d++)r=n[d],i=r.image,l=i&&i.url,l&&(s||(s={}),s[l]=!0,e.ImageManager.recyclePaint(r),i.loading&&(o||(o=a.__input&&a.__input[t]||[],e.isArray(o)||(o=[o])),i.unload(n[d].loadId,!o.some(t=>t.url===l))));return s}return null},createPatternTask:function(t,n,r,i){t.patternTask||(t.patternTask=e.ImageManager.patternTasker.add(()=>ht(this,void 0,void 0,function*(){t.patternTask=null,r.bounds.hit(n.__nowWorld)&&a.PaintImage.createPattern(t,n,r,i),n.forceUpdate("surface")}),300))},createPattern:function(t,n,r,i){let{scaleX:s,scaleY:o}=a.PaintImage.getImageRenderScaleData(t,n,r,i),l=s+"-"+o;if(t.patternId!==l&&!n.destroyed&&(!e.Platform.image.isLarge(t.image,s,o)||t.data.repeat)){const{image:r,data:i}=t,{transform:d,gap:c}=i,h=a.PaintImage.getPatternFixScale(t,s,o);let u,f,p,{width:g,height:_}=r;h&&(s*=h,o*=h),g*=s,_*=o,c&&(f=c.x*s/_t(i.scaleX||1),p=c.y*o/_t(i.scaleY||1)),(d||1!==s||1!==o)&&(s*=gt(g+(f||0)),o*=gt(_+(p||0)),u=ut(),d&&pt(u,d),ft(u,1/s,1/o));const m=r.getCanvas(g,_,i.opacity,i.filters,f,p,n.leafer&&n.leafer.config.smooth),y=r.getPattern(m,i.repeat||e.Platform.origin.noRepeat||"no-repeat",u,t);t.style=y,t.patternId=l}},getPatternFixScale:function(t,a,n){const{image:r}=t;let i,s=e.Platform.image.maxPatternSize,o=r.width*r.height;return r.isSVG?a>1&&(i=Math.ceil(a)/a):s>o&&(s=o),(o*=a*n)>s&&(i=Math.sqrt(s/o)),i},createData:function(t,e,n,r){t.data=a.PaintImage.getPatternData(n,r,e)},getPatternData:function(t,n,r){t.padding&&(n=Q.set(n).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:i,height:s}=r,{opacity:o,mode:l,align:d,offset:c,scale:h,size:u,rotation:f,skew:p,clipSize:g,repeat:_,gap:m,filters:y}=t,w=n.width===i&&n.height===s,v={mode:l},x="center"!==d&&(f||0)%180==90;let b,E;switch(e.BoundsHelper.set(K,0,0,x?s:i,x?i:s),l&&"cover"!==l&&"fit"!==l?((h||u)&&(e.MathHelper.getScaleData(h,u,r,Z),b=Z.scaleX,E=Z.scaleY),(d||m||_)&&(b&&e.BoundsHelper.scale(K,b,E,!0),d&&e.AlignHelper.toPoint(d,K,n,K,!0,!0))):w&&!f||(b=E=e.BoundsHelper.getFitScale(n,K,"fit"!==l),e.BoundsHelper.put(n,r,d,b,!1,K),e.BoundsHelper.scale(K,b,E,!0)),c&&e.PointHelper.move(K,c),l){case"stretch":w?b&&(b=E=void 0):(b=n.width/i,E=n.height/s,a.PaintImage.stretchMode(v,n,b,E));break;case"normal":case"clip":if(K.x||K.y||b||g||f||p){let t,e;g&&(t=n.width/g.width,e=n.height/g.height),a.PaintImage.clipMode(v,n,K.x,K.y,b,E,f,p,t,e),t&&(b=b?b*t:t,E=E?E*e:e)}break;case"repeat":(!w||b||f||p)&&a.PaintImage.repeatMode(v,n,i,s,K.x,K.y,b,E,f,p,d,t.freeTransform),_||(v.repeat="repeat");const r=e.isObject(_);(m||r)&&(v.gap=function(t,a,n,r,i){let s,o;e.isObject(t)?(s=t.x,o=t.y):s=o=t;return{x:$(s,n,i.width,a&&a.x),y:$(o,r,i.height,a&&a.y)}}(m,r&&_,K.width,K.height,n));break;default:b&&a.PaintImage.fillOrFitMode(v,n,K.x,K.y,b,E,f)}return v.transform||(n.x||n.y)&&V(v.transform=z(),n.x,n.y),b&&(v.scaleX=b,v.scaleY=E),o&&o<1&&(v.opacity=o),y&&(v.filters=y),_&&(v.repeat=e.isString(_)?"x"===_?"repeat-x":"repeat-y":"repeat"),v},stretchMode:function(t,e,a,n){const r=et(),{x:i,y:s}=e;i||s?rt(r,i,s):r.onlyScale=!0,ot(r,a,n),t.transform=r},fillOrFitMode:function(t,e,a,n,r,i,s){const o=et();rt(o,e.x+a,e.y+n),ot(o,r,i),s&&nt(o,{x:e.x+e.width/2,y:e.y+e.height/2},s),t.transform=o},clipMode:function(t,e,a,n,r,i,s,o,l,d){const c=et();ct(c,e,a,n,r,i,s,o),l&&(s||o?(at(tt),it(tt,e,l,d),st(c,tt)):it(c,e,l,d)),t.transform=c},repeatMode:function(t,e,a,n,r,i,s,o,l,d,c,h){const u=et();if(h)ct(u,e,r,i,s,o,l,d);else{if(l)if("center"===c)nt(u,{x:a/2,y:n/2},l);else switch(lt(u,l),l){case 90:rt(u,n,0);break;case 180:rt(u,a,n);break;case 270:rt(u,0,a)}J.x=e.x+r,J.y=e.y+i,rt(u,J.x,J.y),s&&it(u,J,s,o)}t.transform=u}},{toPoint:yt}=e.AroundHelper,{hasTransparent:wt}=a.ColorConvert,vt={},xt={};function bt(t,n,r,i){if(r){let s,o,l,d;for(let t=0,c=r.length;t<c;t++)s=r[t],e.isString(s)?(l=t/(c-1),o=a.ColorConvert.string(s,i)):(l=s.offset,o=a.ColorConvert.string(s.color,i)),n.addColorStop(l,o),!d&&wt(o)&&(d=!0);d&&(t.isTransparent=!0)}}const{getAngle:Et,getDistance:Pt}=e.PointHelper,{get:St,rotateOfOuter:Bt,scaleOfOuter:Lt}=e.MatrixHelper,{toPoint:kt}=e.AroundHelper,Rt={},Ct={};function At(t,e,a,n,r){let i;const{width:s,height:o}=t;if(s!==o||n){const t=Et(e,a);i=St(),r?(Lt(i,e,s/o*(n||1),1),Bt(i,e,t+90)):(Lt(i,e,1,s/o*(n||1)),Bt(i,e,t))}return i}const{getDistance:Tt}=e.PointHelper,{toPoint:Ot}=e.AroundHelper,It={},Mt={};const Wt={linearGradient:function(t,a){let{from:n,to:r,type:i,opacity:s}=t;yt(n||"top",a,vt),yt(r||"bottom",a,xt);const o=e.Platform.canvas.createLinearGradient(vt.x,vt.y,xt.x,xt.y),l={type:i,style:o};return bt(l,o,t.stops,s),l},radialGradient:function(t,a){let{from:n,to:r,type:i,opacity:s,stretch:o}=t;kt(n||"center",a,Rt),kt(r||"bottom",a,Ct);const l=e.Platform.canvas.createRadialGradient(Rt.x,Rt.y,0,Rt.x,Rt.y,Pt(Rt,Ct)),d={type:i,style:l};bt(d,l,t.stops,s);const c=At(a,Rt,Ct,o,!0);return c&&(d.transform=c),d},conicGradient:function(t,a){let{from:n,to:r,type:i,opacity:s,stretch:o}=t;Ot(n||"center",a,It),Ot(r||"bottom",a,Mt);const l=e.Platform.conicGradientSupport?e.Platform.canvas.createConicGradient(0,It.x,It.y):e.Platform.canvas.createRadialGradient(It.x,It.y,0,It.x,It.y,Tt(It,Mt)),d={type:i,style:l};bt(d,l,t.stops,s);const c=At(a,It,Mt,o||1,e.Platform.conicGradientRotate90);return c&&(d.transform=c),d},getTransform:At},{copy:Dt,move:Ht,toOffsetOutBounds:Ft}=e.BoundsHelper,{max:jt,abs:Gt}=Math,Yt={},Ut=new e.Matrix,Nt={};function Xt(t,e){let a,n,r,i,s=0,o=0,l=0,d=0;return e.forEach(t=>{a=t.x||0,n=t.y||0,i=1.5*(t.blur||0),r=Gt(t.spread||0),s=jt(s,r+i-n),o=jt(o,r+i+a),l=jt(l,r+i+n),d=jt(d,r+i-a)}),s===o&&o===l&&l===d?s:[s,o,l,d]}function qt(t,a,n){const{shapeBounds:r}=n;let i,s;e.Platform.fullImageShadow?(Dt(Yt,t.bounds),Ht(Yt,a.x-r.x,a.y-r.y),i=t.bounds,s=Yt):(i=r,s=a),t.copyWorld(n.canvas,i,s)}const{toOffsetOutBounds:zt}=e.BoundsHelper,Vt={};const Qt=Xt;const Zt={shadow:function(t,n,r){let i,s;const{__nowWorld:o}=t,{shadow:l}=t.__,{worldCanvas:d,bounds:c,renderBounds:h,shapeBounds:u,scaleX:f,scaleY:p}=r,g=n.getSameCanvas(),_=l.length-1;Ft(c,Nt,h),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(y=1/t)}g.setWorldShadow(Nt.offsetX+(l.x||0)*f*y,Nt.offsetY+(l.y||0)*p*y,(l.blur||0)*f*y,a.ColorConvert.string(l.color)),s=a.Effect.getShadowTransform(t,g,r,l,Nt,y),s&&g.setTransform(s),qt(g,Nt,r),s&&g.resetTransform(),i=h,l.box&&(g.restore(),g.save(),d&&(g.copyWorld(g,h,o,"copy"),i=o),d?g.copyWorld(d,o,o,"destination-out"):g.copyWorld(r.canvas,u,c,"destination-out")),e.LeafHelper.copyCanvasByWorld(t,n,g,i,l.blendMode),_&&m<_&&g.clearWorld(i)}),g.recycle(i)},innerShadow:function(t,n,r){let i,s;const{__nowWorld:o}=t,{innerShadow:l}=t.__,{worldCanvas:d,bounds:c,renderBounds:h,shapeBounds:u,scaleX:f,scaleY:p}=r,g=n.getSameCanvas(),_=l.length-1;zt(c,Vt,h),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(y=1/t)}g.save(),g.setWorldShadow(Vt.offsetX+(l.x||0)*f*y,Vt.offsetY+(l.y||0)*p*y,(l.blur||0)*f*y),s=a.Effect.getShadowTransform(t,g,r,l,Vt,y,!0),s&&g.setTransform(s),qt(g,Vt,r),g.restore(),d?(g.copyWorld(g,h,o,"copy"),g.copyWorld(d,o,o,"source-out"),i=o):(g.copyWorld(r.canvas,u,c,"source-out"),i=h),g.fillWorld(i,a.ColorConvert.string(l.color),"source-in"),e.LeafHelper.copyCanvasByWorld(t,n,g,i,l.blendMode),_&&m<_&&g.clearWorld(i)}),g.recycle(i)},blur:function(t,e,a){const{blur:n}=t.__;a.setWorldBlur(n*t.__nowWorld.a),a.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),a.filter="none"},backgroundBlur:function(t,e,a){},getShadowRenderSpread:Xt,getShadowTransform:function(t,e,a,n,r,i,s){if(n.spread){const a=2*n.spread*i*(s?-1:1),{width:o,height:l}=t.__layout.strokeBounds;return Ut.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},1+a/o,1+a/l),Ut}},isTransformShadow(t){},getInnerShadowSpread:Qt},{excludeRenderBounds:Kt}=e.LeafBoundsHelper;let $t;function Jt(t,e,a,n,r,i,s,o){switch(e){case"grayscale":$t||($t=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,a,n,r,i){const s=t.__nowWorld;a.resetTransform(),a.opacity=1,a.useMask(n,s),i&&n.recycle(s);ee(t,e,a,1,r,i)}(t,a,n,r,s,o);break;case"opacity-path":ee(t,a,n,i,s,o);break;case"path":o&&a.restore()}}function te(t){return t.getSameCanvas(!1,!0)}function ee(t,e,a,n,r,i){const s=t.__nowWorld;e.resetTransform(),e.opacity=n,e.copyWorld(a,s,void 0,r),i?a.recycle(s):a.clearWorld(s)}a.Group.prototype.__renderMask=function(t,e){let a,n,r,i,s,o;const{children:l}=this;for(let d=0,c=l.length;d<c;d++){if(a=l[d],o=a.__.mask,o){s&&(Jt(this,s,t,r,n,i,void 0,!0),n=r=null),"clipping"!==o&&"clipping-path"!==o||Kt(a,e)||a.__render(t,e),i=a.__.opacity,$t=!1,"path"===o||"clipping-path"===o?(i<1?(s="opacity-path",r||(r=te(t))):(s="path",t.save()),a.__clip(r||t,e)):(s="grayscale"===o?"grayscale":"alpha",n||(n=te(t)),r||(r=te(t)),a.__render(n,e));continue}const c=1===i&&a.__.__blendMode;c&&Jt(this,s,t,r,n,i,void 0,!1),Kt(a,e)||a.__render(r||t,e),c&&Jt(this,s,t,r,n,i,c,!1)}Jt(this,s,t,r,n,i,void 0,!0)};const ae=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ne=ae+"_#~&*+\\=|≮≯≈≠=…",re=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 ie(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const se=ie("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),oe=ie("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),le=ie(ae),de=ie(ne),ce=ie("- —/~|┆·");var he;!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"}(he||(he={}));const{Letter:ue,Single:fe,Before:pe,After:ge,Symbol:_e,Break:me}=he;function ye(t){return se[t]?ue:ce[t]?me:oe[t]?pe:le[t]?ge:de[t]?_e:re.test(t)?fe:ue}const we={trimRight(t){const{words:e}=t;let a,n=0,r=e.length;for(let i=r-1;i>-1&&(a=e[i].data[0]," "===a.char);i--)n++,t.width-=a.width;n&&e.splice(r-n,n)}};function ve(t,e,a){switch(e){case"title":return a?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:xe}=we,{Letter:be,Single:Ee,Before:Pe,After:Se,Symbol:Be,Break:Le}=he;let ke,Re,Ce,Ae,Te,Oe,Ie,Me,We,De,He,Fe,je,Ge,Ye,Ue,Ne,Xe=[];function qe(t,e){We&&!Me&&(Me=We),ke.data.push({char:t,width:e}),Ce+=e}function ze(){Ae+=Ce,ke.width=Ce,Re.words.push(ke),ke={data:[]},Ce=0}function Ve(){Ge&&(Ye.paraNumber++,Re.paraStart=!0,Ge=!1),We&&(Re.startCharSize=Me,Re.endCharSize=We,Me=0),Re.width=Ae,Ue.width?xe(Re):Ne&&Qe(),Xe.push(Re),Re={words:[]},Ae=0}function Qe(){Ae>(Ye.maxWidth||0)&&(Ye.maxWidth=Ae)}const{top:Ze,right:Ke,bottom:$e,left:Je}=e.Direction4;function ta(t,e,a){const{bounds:n,rows:r}=t;n[e]+=a;for(let t=0;t<r.length;t++)r[t][e]+=a}const ea={getDrawData:function(t,n){e.isString(t)||(t=String(t));let r=0,i=0,s=n.__getInput("width")||0,o=n.__getInput("height")||0;const{__padding:l}=n;l&&(s?(r=l[Je],s-=l[Ke]+l[Je],!s&&(s=.01)):n.autoSizeAlign||(r=l[Je]),o?(i=l[Ze],o-=l[Ze]+l[$e],!o&&(o=.01)):n.autoSizeAlign||(i=l[Ze]));const d={bounds:{x:r,y:i,width:s,height:o},rows:[],paraNumber:0,font:e.Platform.canvas.font=n.__font};return function(t,a,n){Ye=t,Xe=t.rows,Ue=t.bounds,Ne=!Ue.width&&!n.autoSizeAlign;const{__letterSpacing:r,paraIndent:i,textCase:s}=n,{canvas:o}=e.Platform,{width:l}=Ue;if(n.__isCharMode){const t="none"!==n.textWrap,e="break"===n.textWrap;Ge=!0,He=null,Me=Ie=We=Ce=Ae=0,ke={data:[]},Re={words:[]},r&&(a=[...a]);for(let n=0,d=a.length;n<d;n++)Oe=a[n],"\n"===Oe?(Ce&&ze(),Re.paraEnd=!0,Ve(),Ge=!0):(De=ye(Oe),De===be&&"none"!==s&&(Oe=ve(Oe,s,!Ce)),Ie=o.measureText(Oe).width,r&&(r<0&&(We=Ie),Ie+=r),Fe=De===Ee&&(He===Ee||He===be)||He===Ee&&De!==Se,je=!(De!==Pe&&De!==Ee||He!==Be&&He!==Se),Te=Ge&&i?l-i:l,t&&l&&Ae+Ce+Ie>Te&&(e?(Ce&&ze(),Ae&&Ve()):(je||(je=De===be&&He==Se),Fe||je||De===Le||De===Pe||De===Ee||Ce+Ie>Te?(Ce&&ze(),Ae&&Ve()):Ae&&Ve()))," "===Oe&&!0!==Ge&&Ae+Ce===0||(De===Le?(" "===Oe&&Ce&&ze(),qe(Oe,Ie),ze()):Fe||je?(Ce&&ze(),qe(Oe,Ie)):qe(Oe,Ie)),He=De);Ce&&ze(),Ae&&Ve(),Xe.length>0&&(Xe[Xe.length-1].paraEnd=!0)}else a.split("\n").forEach(t=>{Ye.paraNumber++,Ae=o.measureText(t).width,Xe.push({x:i||0,text:t,width:Ae,paraStart:!0}),Ne&&Qe()})}(d,t,n),l&&function(t,e,a,n,r){if(!n&&a.autoSizeAlign)switch(a.textAlign){case"left":ta(e,"x",t[Je]);break;case"right":ta(e,"x",-t[Ke])}if(!r&&a.autoSizeAlign)switch(a.verticalAlign){case"top":ta(e,"y",t[Ze]);break;case"bottom":ta(e,"y",-t[$e])}}(l,d,n,s,o),function(t,e){const{rows:a,bounds:n}=t,r=a.length,{__lineHeight:i,__baseLine:s,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:c,paraSpacing:h,autoSizeAlign:u}=e;let{x:f,y:p,width:g,height:_}=n,m=i*r+(h?h*(t.paraNumber-1):0),y=s;if(l&&m>_)m=Math.max(_,i),r>1&&(t.overflow=r);else if(_||u)switch(c){case"middle":p+=(_-m)/2;break;case"bottom":p+=_-m}y+=p;let w,v,x,b=g||u?g:t.maxWidth;for(let s=0,c=r;s<c;s++){if(w=a[s],w.x=f,w.width<g||w.width>g&&!l)switch(d){case"center":w.x+=(b-w.width)/2;break;case"right":w.x+=b-w.width}w.paraStart&&h&&s>0&&(y+=h),w.y=y,y+=i,t.overflow>s&&y>m&&(w.isOverflow=!0,t.overflow=s+1),v=w.x,x=w.width,o<0&&(w.width<0?(x=-w.width+e.fontSize+o,v-=x,x+=e.fontSize):x-=o),v<n.x&&(n.x=v),x>n.width&&(n.width=x),l&&g&&g<x&&(w.isOverflow=!0,t.overflow||(t.overflow=a.length))}n.y=p,n.height=m}(d,n),n.__isCharMode&&function(t,e,a){const{rows:n}=t,{textAlign:r,paraIndent:i,letterSpacing:s}=e,o=a&&r.includes("both"),l=o||a&&r.includes("justify"),d=l&&r.includes("letter");let c,h,u,f,p,g,_,m,y,w;n.forEach(t=>{t.words&&(p=i&&t.paraStart?i:0,m=t.words.length,l&&(w=!t.paraEnd||o,h=a-t.width-p,d?f=h/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=m>1?h/(m-1):0),g=s||t.isOverflow||d?0:u?1:2,t.isOverflow&&!s&&(t.textMode=!0),2===g?(t.x+=p,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=p,c=t.x,t.data=[],t.words.forEach((e,a)=>{1===g?(_={char:"",x:c},c=function(t,e,a){return t.forEach(t=>{a.char+=t.char,e+=t.width}),e}(e.data,c,_),(t.isOverflow||" "!==_.char)&&t.data.push(_)):c=function(t,e,a,n,r){return t.forEach(t=>{(n||" "!==t.char)&&(t.x=e,a.push(t)),e+=t.width,r&&(e+=r)}),e}(e.data,c,t.data,t.isOverflow,w&&f),w&&(y=a===m-1,u?y||(c+=u,t.width+=u):f&&(t.width+=f*(e.data.length-(y?1:0))))})),t.words=null)})}(d,n,s),d.overflow&&function(t,a,n,r){if(!r)return;const{rows:i,overflow:s}=t;let{textOverflow:o}=a;if(i.splice(s),o&&"show"!==o){let t,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?e.Platform.canvas.measureText(o).width:0,c=n+r-d;("none"===a.textWrap?i:[i[s-1]]).forEach(e=>{if(e.isOverflow&&e.data){let a=e.data.length-1;for(let n=a;n>-1&&(t=e.data[n],l=t.x+t.width,!(n===a&&l<c));n--){if(l<c&&" "!==t.char||!n){e.data.splice(n+1),e.width-=t.width;break}e.width-=t.width}e.width+=d,e.data.push({char:o,x:l}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(d,n,r,s),"none"!==n.textDecoration&&function(t,n){let r,i=0;const{fontSize:s,textDecoration:o}=n;switch(t.decorationHeight=s/11,e.isObject(o)?(r=o.type,o.color&&(t.decorationColor=a.ColorConvert.string(o.color)),o.offset&&(i=Math.min(.3*s,Math.max(o.offset,.15*-s)))):r=o,r){case"under":t.decorationY=[.15*s+i];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s+i,.35*-s]}}(d,n),d}};const aa={string:function(t,n){if(!t)return"#000";const r=e.isNumber(n)&&n<1;if(e.isString(t)){if(!r||!a.ColorConvert.object)return t;t=a.ColorConvert.object(t)}let i=e.isUndefined(t.a)?1:t.a;r&&(i*=n);const s=t.r+","+t.g+","+t.b;return 1===i?"rgb("+s+")":"rgba("+s+","+i+")"}};Object.assign(a.TextConvert,ea),Object.assign(a.ColorConvert,aa),Object.assign(a.Paint,D),Object.assign(a.PaintImage,mt),Object.assign(a.PaintGradient,Wt),Object.assign(a.Effect,Zt),i(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return e.LeaferImage}}),exports.Layouter=y,exports.LeaferCanvas=n,exports.Renderer=v,exports.Watcher=o,exports.useCanvas=i,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]}})}),Object.keys(a).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return a[t]}})});
|
|
1
|
+
"use strict";var t,e=require("@leafer/core"),a=require("@leafer-ui/draw");exports.PathNodeHandleType=void 0,(t=exports.PathNodeHandleType||(exports.PathNodeHandleType={}))[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror";class n extends e.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=e.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:a}=this;this.view.width=Math.ceil(t*a),this.view.height=Math.ceil(e*a),this.clientBounds=this.bounds}}e.canvasPatch(OffscreenCanvasRenderingContext2D.prototype),e.canvasPatch(Path2D.prototype);const{mineType:r}=e.FileHelper;function i(t,a){e.Platform.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,a)=>new Promise((n,i)=>{t.convertToBlob({type:r(e),quality:a}).then(t=>{var e=new FileReader;e.onload=t=>n(t.target.result),e.onerror=t=>i(t),e.readAsDataURL(t)}).catch(t=>{i(t)})}),canvasToBolb:(t,e,a)=>t.convertToBlob({type:r(e),quality:a}),canvasSaveAs:(t,e,a)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((a,n)=>{let r=new XMLHttpRequest;r.open("GET",e.Platform.image.getRealURL(t),!0),r.responseType="blob",r.onload=()=>{createImageBitmap(r.response).then(t=>{a(t)}).catch(t=>{n(t)})},r.onerror=t=>n(t),r.send()})},e.Platform.canvas=e.Creator.canvas(),e.Platform.conicGradientSupport=!!e.Platform.canvas.context.createConicGradient}Object.assign(e.Creator,{canvas:(t,e)=>new n(t,e),image:t=>new e.LeaferImage(t)}),e.Platform.name="web",e.Platform.isWorker=!0,e.Platform.backgrounder=!0,e.Platform.requestRender=function(t){requestAnimationFrame(t)},e.defineKey(e.Platform,"devicePixelRatio",{get:()=>1});const{userAgent:s}=navigator;s.indexOf("Firefox")>-1?(e.Platform.conicGradientRotate90=!0,e.Platform.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(e.Platform.fullImageShadow=!0),s.indexOf("Windows")>-1?(e.Platform.os="Windows",e.Platform.intWheelDeltaY=!0):s.indexOf("Mac")>-1?e.Platform.os="Mac":s.indexOf("Linux")>-1&&(e.Platform.os="Linux");class o{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new e.LeafList;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,a){this.totalTimes=0,this.config={},this.__updatedList=new e.LeafList,this.target=t,a&&(this.config=e.DataHelper.default(a,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(e.RenderEvent.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===e.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent))),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,a=e.length;t<a;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new e.WatchEvent(e.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new e.LeafList,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[e.PropertyEvent.CHANGE,this.__onAttrChange,this],[[e.ChildEvent.ADD,e.ChildEvent.REMOVE],this.__onChildEvent,this],[e.WatchEvent.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:l,updateBounds:d,updateChange:c}=e.LeafHelper,{pushAllChildBranch:h,pushAllParent:u}=e.BranchHelper;const{worldBounds:f}=e.LeafBoundsHelper;class p{constructor(t){this.updatedBounds=new e.Bounds,this.beforeBounds=new e.Bounds,this.afterBounds=new e.Bounds,e.isArray(t)&&(t=new e.LeafList(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,f)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,f),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:_}=e.LeafHelper,m=e.Debug.get("Layouter");class y{constructor(t,a){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new e.LeafLevelList,this.target=t,a&&(this.config=e.DataHelper.default(a,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.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(e.LayoutEvent.START),this.layoutOnce(),t.emitEvent(new e.LayoutEvent(e.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){m.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?m.warn("layouting"):this.times>3?m.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(e.WatchEvent.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const a=e.Run.start("PartLayout"),{target:n,__updatedList:r}=this,{BEFORE:i,LAYOUT:s,AFTER:o}=e.LayoutEvent,f=this.getBlocks(r);f.forEach(t=>t.setBefore()),n.emitEvent(new e.LayoutEvent(i,f,this.times)),this.extraBlock=null,r.sort(),function(t,e){let a;t.list.forEach(t=>{a=t.__layout,e.without(t)&&!a.proxyZoom&&(a.matrixChanged?(l(t,!0),e.add(t),t.isBranch&&h(t,e),u(t,e)):a.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),u(t,e)))})}(r,this.__levelList),function(t){let e,a,n;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(a=e[t],a.isBranch&&a.__tempNumber){n=a.children;for(let t=0,e=n.length;t<e;t++)n[t].isBranch||d(n[t])}d(a)}})}(this.__levelList),function(t){t.list.forEach(c)}(r),this.extraBlock&&f.push(this.extraBlock),f.forEach(t=>t.setAfter()),n.emitEvent(new e.LayoutEvent(s,f,this.times)),n.emitEvent(new e.LayoutEvent(o,f,this.times)),this.addBlocks(f),this.__levelList.reset(),this.__updatedList=null,e.Run.end(a)}fullLayout(){const t=e.Run.start("FullLayout"),{target:a}=this,{BEFORE:n,LAYOUT:r,AFTER:i}=e.LayoutEvent,s=this.getBlocks(new e.LeafList(a));a.emitEvent(new e.LayoutEvent(n,s,this.times)),y.fullLayout(a),s.forEach(t=>{t.setAfter()}),a.emitEvent(new e.LayoutEvent(r,s,this.times)),a.emitEvent(new e.LayoutEvent(i,s,this.times)),this.addBlocks(s),e.Run.end(t)}static fullLayout(t){g(t,!0),t.isBranch?e.BranchHelper.updateBounds(t):e.LeafHelper.updateBounds(t),_(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:a}=this.extraBlock||(this.extraBlock=new p([]));e.length?a.add(t.__world):a.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(){this.__eventIds=[this.target.on_([[e.LayoutEvent.REQUEST,this.layout,this],[e.LayoutEvent.AGAIN,this.layoutAgain,this],[e.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=e.Debug.get("Renderer");class v{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,a,n){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=a,n&&(this.config=e.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit(e.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(e.RenderEvent.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(e.RenderEvent.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(e.RenderEvent.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:a}=this;this.times=0,this.totalBounds=new e.Bounds,w.log(a.innerName,"---\x3e");try{this.emitRender(e.RenderEvent.START),this.renderOnce(t),this.emitRender(e.RenderEvent.END,this.totalBounds),e.ImageManager.clearRecycled()}catch(t){this.rendering=!1,w.error(t)}w.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){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 e.Bounds,this.renderOptions={},t)this.emitRender(e.RenderEvent.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(e.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(e.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(e.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(t){const a=e.Run.start("PartRender"),{canvas:n}=this,r=t.getIntersect(n.bounds),i=new e.Bounds(r);n.save(),r.spread(v.clipSpread).ceil(),n.clearWorld(r),n.clipWorld(r),this.__render(r,i),n.restore(),e.Run.end(a)}fullRender(){const t=e.Run.start("FullRender"),{canvas:a}=this;a.save(),a.clear(),this.__render(a.bounds),a.restore(),e.Run.end(t)}__render(t,a){const{canvas:n,target:r}=this,i=t.includes(r.__world),s=i?{includes:i}:{bounds:t,includes:i};this.needFill&&n.fillWorld(t,this.config.fill),e.Debug.showRepaint&&e.Debug.drawRepaint(n,t),this.config.useCellRender&&(s.cellList=this.getCellList()),e.Platform.render(r,n,s),this.renderBounds=a=a||t,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=a:this.totalBounds.add(a),n.updateRender(a)}getCellList(){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const a=new e.Bounds;a.setList(t),t.length=0,t.push(a)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const a=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:n}=this.config;if(n&&t>n)return e.Platform.requestRender(a);const{frames:r}=this;r.length>30&&r.shift(),r.push(t),this.FPS=Math.round(r.reduce((t,e)=>t+e,0)/r.length),this.requestTime=0,this.checkRender()};e.Platform.requestRender(a)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:a,height:n}=t.old;if(!new e.Bounds(0,0,a,n).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new e.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(t,a,n){this.target.emitEvent(new e.RenderEvent(t,this.times,a,n))}__listenEvents(){this.__eventIds=[this.target.on_([[e.RenderEvent.REQUEST,this.update,this],[e.LayoutEvent.END,this.__onLayoutEnd,this],[e.RenderEvent.AGAIN,this.renderAgain,this],[e.ResizeEvent.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}function x(t,e,n){t.__.__font?a.Paint.fillText(t,e,n):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function b(t,n,r,i,s){const o=r.__;e.isObject(t)?a.Paint.drawStrokesStyle(t,n,!1,r,i,s):(i.setStroke(t,o.__strokeWidth*n,o),i.stroke()),o.__useArrow&&a.Paint.strokeArrow(t,r,i,s)}function E(t,n,r,i,s){const o=r.__;e.isObject(t)?a.Paint.drawStrokesStyle(t,n,!0,r,i,s):(i.setStroke(t,o.__strokeWidth*n,o),a.Paint.drawTextStroke(r,i,s))}function P(t,n,r,i,s){const o=i.getSameCanvas(!0,!0);o.font=r.__.__font,E(t,2,r,o,s),o.blendMode="outside"===n?"destination-out":"destination-in",a.Paint.fillText(r,o,s),o.blendMode="normal",e.LeafHelper.copyCanvasByWorld(r,i,o),o.recycle(r.__nowWorld)}v.clipSpread=10,Object.assign(e.Creator,{watcher:(t,e)=>new o(t,e),layouter:(t,e)=>new y(t,e),renderer:(t,e,a)=>new v(t,e,a),selector:(t,e)=>{},interaction:(t,e,a,n)=>{}}),e.Platform.layout=y.fullLayout,e.Platform.render=function(t,a,n){const r=Object.assign(Object.assign({},n),{topRendering:!0});n.topList=new e.LeafList,t.__render(a,n),n.topList.length&&n.topList.forEach(t=>t.__render(a,r))};const{getSpread:S,copyAndSpread:B,toOuterOf:L,getOuterOf:k,getByMove:R,move:C,getIntersectData:A}=e.BoundsHelper,T={};let O;const{stintSet:I}=e.DataHelper,{hasTransparent:M}=a.ColorConvert;function W(t,n,r){if(!e.isObject(n)||!1===n.visible||0===n.opacity)return;let i;const{boxBounds:s}=r.__layout;switch(n.type){case"image":if(!n.url)return;i=a.PaintImage.image(r,t,n,s,!O||!O[n.url]);break;case"linear":i=a.PaintGradient.linearGradient(n,s);break;case"radial":i=a.PaintGradient.radialGradient(n,s);break;case"angular":i=a.PaintGradient.conicGradient(n,s);break;case"solid":const{type:o,color:l,opacity:d}=n;i={type:o,style:a.ColorConvert.string(l,d)};break;default:e.isUndefined(n.r)||(i={type:"solid",style:a.ColorConvert.string(n)})}if(i&&(i.originPaint=n,e.isString(i.style)&&M(i.style)&&(i.isTransparent=!0),n.style)){if(0===n.style.strokeWidth)return;i.strokeStyle=n.style}return i}const D={compute:function(t,n){const r=n.__,i=[];let s,o,l,d=r.__input[t];e.isArray(d)||(d=[d]),O=a.PaintImage.recycleImage(t,r);for(let e,a=0,r=d.length;a<r;a++)(e=W(t,d[a],n))&&(i.push(e),e.strokeStyle&&(l||(l=1),e.strokeStyle.strokeWidth&&(l=Math.max(l,e.strokeStyle.strokeWidth))));r["_"+t]=i.length?i:void 0,i.length?(i.every(t=>t.isTransparent)&&(i.some(t=>t.image)&&(s=!0),o=!0),"fill"===t?(I(r,"__isAlphaPixelFill",s),I(r,"__isTransparentFill",o)):(I(r,"__isAlphaPixelStroke",s),I(r,"__isTransparentStroke",o),I(r,"__hasMultiStrokeStyle",l))):r.__removePaint(t,!1)},fill:function(t,e,a,n){a.fillStyle=t,x(e,a,n)},fills:function(t,e,n,r){let i,s,o;for(let l=0,d=t.length;l<d;l++){if(i=t[l],s=i.originPaint,i.image){if(o?o++:o=1,a.PaintImage.checkImage(i,!e.__.__font,e,n,r))continue;if(!i.style){1===o&&i.image.isPlacehold&&e.drawImagePlaceholder(i,n,r);continue}}if(n.fillStyle=i.style,i.transform||s.scaleFixed){if(n.save(),i.transform&&n.transform(i.transform),s.scaleFixed){const{scaleX:t,scaleY:a}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&a>1)&&n.scale(1/t,1/a)}s.blendMode&&(n.blendMode=s.blendMode),x(e,n,r),n.restore()}else s.blendMode?(n.saveBlendMode(s.blendMode),x(e,n,r),n.restoreBlendMode()):x(e,n,r)}},fillPathOrText:x,fillText:function(t,e,a){const n=t.__,{rows:r,decorationY:i}=n.__textDrawData;let s;n.__isPlacehold&&n.placeholderColor&&(e.fillStyle=n.placeholderColor);for(let t=0,a=r.length;t<a;t++)s=r[t],s.text?e.fillText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.fillText(t.char,t.x,s.y)});if(i){const{decorationColor:t,decorationHeight:a}=n.__textDrawData;t&&(e.fillStyle=t),r.forEach(t=>i.forEach(n=>e.fillRect(t.x,t.y+n,t.width,a)))}},stroke:function(t,n,r,i){const s=n.__;if(s.__strokeWidth)if(s.__font)a.Paint.strokeText(t,n,r,i);else switch(s.strokeAlign){case"center":b(t,1,n,r,i);break;case"inside":!function(t,e,a,n){a.save(),a.clipUI(e),b(t,2,e,a,n),a.restore()}(t,n,r,i);break;case"outside":!function(t,a,n,r){const i=a.__;if(i.__fillAfterStroke)b(t,2,a,n,r);else{const{renderBounds:s}=a.__layout,o=n.getSameCanvas(!0,!0);a.__drawRenderPath(o),b(t,2,a,o,r),o.clipUI(i),o.clearWorld(s),e.LeafHelper.copyCanvasByWorld(a,n,o),o.recycle(a.__nowWorld)}}(t,n,r,i)}},strokes:function(t,e,n,r){a.Paint.stroke(t,e,n,r)},strokeText:function(t,e,a,n){switch(e.__.strokeAlign){case"center":E(t,1,e,a,n);break;case"inside":P(t,"inside",e,a,n);break;case"outside":e.__.__fillAfterStroke?E(t,2,e,a,n):P(t,"outside",e,a,n)}},drawTextStroke:function(t,e,a){let n,r=t.__.__textDrawData;const{rows:i,decorationY:s}=r;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(s){const{decorationHeight:t}=r;i.forEach(a=>s.forEach(n=>e.strokeRect(a.x,a.y+n,a.width,t)))}},drawStrokesStyle:function(t,e,n,r,i,s){let o;const l=r.__,{__hasMultiStrokeStyle:d}=l;d||i.setStroke(void 0,l.__strokeWidth*e,l);for(let c=0,h=t.length;c<h;c++)if(o=t[c],(!o.image||!a.PaintImage.checkImage(o,!1,r,i,s))&&o.style){if(d){const{strokeStyle:t}=o;t?i.setStroke(o.style,l.__getRealStrokeWidth(t)*e,l,t):i.setStroke(o.style,l.__strokeWidth*e,l)}else i.strokeStyle=o.style;o.originPaint.blendMode?(i.saveBlendMode(o.originPaint.blendMode),n?a.Paint.drawTextStroke(r,i,s):i.stroke(),i.restoreBlendMode()):n?a.Paint.drawTextStroke(r,i,s):i.stroke()}},shape:function(t,a,n){const r=a.getSameCanvas(),i=a.bounds,s=t.__nowWorld,o=t.__layout,l=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let d,c,h,u,f,p;L(o.strokeSpread?(B(T,o.boxBounds,o.strokeSpread),T):o.boxBounds,s,l);let{scaleX:g,scaleY:_}=t.getRenderScaleData(!0);if(i.includes(l))p=r,d=f=l,c=s;else{let r;if(e.Platform.fullImageShadow)r=l;else{const t=o.renderShapeSpread?S(i,e.FourNumberHelper.swapAndScale(o.renderShapeSpread,g,_)):i;r=A(t,l)}u=i.getFitMatrix(r);let{a:m,d:y}=u;u.a<1&&(p=a.getSameCanvas(),t.__renderShape(p,n),g*=m,_*=y),f=k(l,u),d=R(f,-u.e,-u.f),c=k(s,u),C(c,-u.e,-u.f);const w=n.matrix;w?(h=new e.Matrix(u),h.multiply(w),m*=w.scaleX,y*=w.scaleY):h=u,h.withScale(m,y),n=Object.assign(Object.assign({},n),{matrix:h})}return t.__renderShape(r,n),{canvas:r,matrix:h,fitMatrix:u,bounds:d,renderBounds:c,worldCanvas:p,shapeBounds:f,scaleX:g,scaleY:_}}};let H,F=new e.Bounds;const{isSame:j}=e.BoundsHelper;function G(t,e,n,r,i,s){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=r.width/e.pixelRatio,e.__naturalHeight=r.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||a.PaintImage.createData(i,r,n,s),!0}function Y(t,a){X(t,e.ImageEvent.LOAD,a)}function U(t,a){X(t,e.ImageEvent.LOADED,a)}function N(t,a,n){a.error=n,t.forceUpdate("surface"),X(t,e.ImageEvent.ERROR,a)}function X(t,a,n){t.hasEvent(a)&&t.emitEvent(new e.ImageEvent(a,n))}function q(t,e){const{leafer:a}=t;a&&a.viewReady&&(a.renderer.ignore=e)}const{get:z,translate:V}=e.MatrixHelper,Q=new e.Bounds,Z={},K={};function $(t,a,n,r){const i=e.isString(t)||r?(r?n-r*a:n%a)/((r||Math.floor(n/a))-1):t;return"auto"===t&&i<0?0:i}let J={},tt=e.getMatrixData();const{get:et,set:at,rotateOfOuter:nt,translate:rt,scaleOfOuter:it,multiplyParent:st,scale:ot,rotate:lt,skew:dt}=e.MatrixHelper;function ct(t,e,a,n,r,i,s,o){s&<(t,s),o&&dt(t,o.x,o.y),r&&ot(t,r,i),rt(t,e.x+a,e.y+n)}function ht(t,e,a,n){return new(a||(a=Promise))(function(r,i){function s(t){try{l(n.next(t))}catch(t){i(t)}}function o(t){try{l(n.throw(t))}catch(t){i(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof a?e:new a(function(t){t(e)})).then(s,o)}l((n=n.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const{get:ut,scale:ft,copy:pt}=e.MatrixHelper,{getFloorScale:gt}=e.MathHelper,{abs:_t}=Math;const mt={image:function(t,a,n,r,i){let s,o;const l=e.ImageManager.get(n);return H&&n===H.paint&&j(r,H.boxBounds)?s=H.leafPaint:(s={type:n.type,image:l},l.hasAlphaPixel&&(s.isTransparent=!0),H=l.use>1?{leafPaint:s,paint:n,boxBounds:F.set(r)}:null),(i||l.loading)&&(o={image:l,attrName:a,attrValue:n}),l.ready?(G(t,a,n,l,s,r),i&&(Y(t,o),U(t,o))):l.error?i&&N(t,o,l.error):(i&&(q(t,!0),Y(t,o)),s.loadId=l.load(()=>{q(t,!1),t.destroyed||(G(t,a,n,l,s,r)&&(l.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),U(t,o)),s.loadId=void 0},e=>{q(t,!1),N(t,o,e),s.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{l.ready||(l.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):l.isPlacehold=!0)),s},checkImage:function(t,n,r,i,s){const{scaleX:o,scaleY:l}=a.PaintImage.getImageRenderScaleData(t,r,i,s),{image:d,data:c,originPaint:h}=t,{exporting:u}=s;return!(!c||t.patternId===o+"-"+l&&!u)&&(n&&(c.repeat?n=!1:h.changeful||"miniapp"===e.Platform.name&&e.ResizeEvent.isResizing(r)||u||(n=e.Platform.image.isLarge(d,o,l)||d.width*o>8096||d.height*l>8096)),n?(r.__.__isFastShadow&&(i.fillStyle=t.style||"#000",i.fill()),a.PaintImage.drawImage(t,o,l,r,i,s),!0):(!t.style||h.sync||u?a.PaintImage.createPattern(t,r,i,s):a.PaintImage.createPatternTask(t,r,i,s),!1))},drawImage:function(t,e,a,n,r,i){const{data:s,image:o}=t,{blendMode:l}=t.originPaint,{opacity:d,transform:c}=s,h=o.getFull(s.filters),u=n.__;let f,{width:p,height:g}=o;(f=c&&!c.onlyScale||u.path||u.cornerRadius)||d||l?(r.save(),f&&r.clipUI(n),l&&(r.blendMode=l),d&&(r.opacity*=d),c&&r.transform(c),r.drawImage(h,0,0,p,g),r.restore()):(s.scaleX&&(p*=s.scaleX,g*=s.scaleY),r.drawImage(h,0,0,p,g))},getImageRenderScaleData:function(t,e,a,n){const r=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:i}=t;if(a){const{pixelRatio:t}=a;r.scaleX*=t,r.scaleY*=t}return i&&i.scaleX&&(r.scaleX*=Math.abs(i.scaleX),r.scaleY*=Math.abs(i.scaleY)),r},recycleImage:function(t,a){const n=a["_"+t];if(e.isArray(n)){let r,i,s,o,l;for(let d=0,c=n.length;d<c;d++)r=n[d],i=r.image,l=i&&i.url,l&&(s||(s={}),s[l]=!0,e.ImageManager.recyclePaint(r),i.loading&&(o||(o=a.__input&&a.__input[t]||[],e.isArray(o)||(o=[o])),i.unload(n[d].loadId,!o.some(t=>t.url===l))));return s}return null},createPatternTask:function(t,n,r,i){t.patternTask||(t.patternTask=e.ImageManager.patternTasker.add(()=>ht(this,void 0,void 0,function*(){a.PaintImage.createPattern(t,n,r,i),n.forceUpdate("surface")}),0,()=>(t.patternTask=null,r.bounds.hit(n.__nowWorld))))},createPattern:function(t,n,r,i){let{scaleX:s,scaleY:o}=a.PaintImage.getImageRenderScaleData(t,n,r,i),l=s+"-"+o;if(t.patternId!==l&&!n.destroyed&&(!e.Platform.image.isLarge(t.image,s,o)||t.data.repeat)){const{image:r,data:i}=t,{transform:d,gap:c}=i,h=a.PaintImage.getPatternFixScale(t,s,o);let u,f,p,{width:g,height:_}=r;h&&(s*=h,o*=h),g*=s,_*=o,c&&(f=c.x*s/_t(i.scaleX||1),p=c.y*o/_t(i.scaleY||1)),(d||1!==s||1!==o)&&(s*=gt(g+(f||0)),o*=gt(_+(p||0)),u=ut(),d&&pt(u,d),ft(u,1/s,1/o));const m=r.getCanvas(g,_,i.opacity,i.filters,f,p,n.leafer&&n.leafer.config.smooth),y=r.getPattern(m,i.repeat||e.Platform.origin.noRepeat||"no-repeat",u,t);t.style=y,t.patternId=l}},getPatternFixScale:function(t,a,n){const{image:r}=t;let i,s=e.Platform.image.maxPatternSize,o=r.width*r.height;return r.isSVG?a>1&&(i=Math.ceil(a)/a):s>o&&(s=o),(o*=a*n)>s&&(i=Math.sqrt(s/o)),i},createData:function(t,e,n,r){t.data=a.PaintImage.getPatternData(n,r,e)},getPatternData:function(t,n,r){t.padding&&(n=Q.set(n).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:i,height:s}=r,{opacity:o,mode:l,align:d,offset:c,scale:h,size:u,rotation:f,skew:p,clipSize:g,repeat:_,gap:m,filters:y}=t,w=n.width===i&&n.height===s,v={mode:l},x="center"!==d&&(f||0)%180==90;let b,E;switch(e.BoundsHelper.set(K,0,0,x?s:i,x?i:s),l&&"cover"!==l&&"fit"!==l?((h||u)&&(e.MathHelper.getScaleData(h,u,r,Z),b=Z.scaleX,E=Z.scaleY),(d||m||_)&&(b&&e.BoundsHelper.scale(K,b,E,!0),d&&e.AlignHelper.toPoint(d,K,n,K,!0,!0))):w&&!f||(b=E=e.BoundsHelper.getFitScale(n,K,"fit"!==l),e.BoundsHelper.put(n,r,d,b,!1,K),e.BoundsHelper.scale(K,b,E,!0)),c&&e.PointHelper.move(K,c),l){case"stretch":w?b&&(b=E=void 0):(b=n.width/i,E=n.height/s,a.PaintImage.stretchMode(v,n,b,E));break;case"normal":case"clip":if(K.x||K.y||b||g||f||p){let t,e;g&&(t=n.width/g.width,e=n.height/g.height),a.PaintImage.clipMode(v,n,K.x,K.y,b,E,f,p,t,e),t&&(b=b?b*t:t,E=E?E*e:e)}break;case"repeat":(!w||b||f||p)&&a.PaintImage.repeatMode(v,n,i,s,K.x,K.y,b,E,f,p,d,t.freeTransform),_||(v.repeat="repeat");const r=e.isObject(_);(m||r)&&(v.gap=function(t,a,n,r,i){let s,o;e.isObject(t)?(s=t.x,o=t.y):s=o=t;return{x:$(s,n,i.width,a&&a.x),y:$(o,r,i.height,a&&a.y)}}(m,r&&_,K.width,K.height,n));break;default:b&&a.PaintImage.fillOrFitMode(v,n,K.x,K.y,b,E,f)}return v.transform||(n.x||n.y)&&V(v.transform=z(),n.x,n.y),b&&(v.scaleX=b,v.scaleY=E),o&&o<1&&(v.opacity=o),y&&(v.filters=y),_&&(v.repeat=e.isString(_)?"x"===_?"repeat-x":"repeat-y":"repeat"),v},stretchMode:function(t,e,a,n){const r=et(),{x:i,y:s}=e;i||s?rt(r,i,s):r.onlyScale=!0,ot(r,a,n),t.transform=r},fillOrFitMode:function(t,e,a,n,r,i,s){const o=et();rt(o,e.x+a,e.y+n),ot(o,r,i),s&&nt(o,{x:e.x+e.width/2,y:e.y+e.height/2},s),t.transform=o},clipMode:function(t,e,a,n,r,i,s,o,l,d){const c=et();ct(c,e,a,n,r,i,s,o),l&&(s||o?(at(tt),it(tt,e,l,d),st(c,tt)):it(c,e,l,d)),t.transform=c},repeatMode:function(t,e,a,n,r,i,s,o,l,d,c,h){const u=et();if(h)ct(u,e,r,i,s,o,l,d);else{if(l)if("center"===c)nt(u,{x:a/2,y:n/2},l);else switch(lt(u,l),l){case 90:rt(u,n,0);break;case 180:rt(u,a,n);break;case 270:rt(u,0,a)}J.x=e.x+r,J.y=e.y+i,rt(u,J.x,J.y),s&&it(u,J,s,o)}t.transform=u}},{toPoint:yt}=e.AroundHelper,{hasTransparent:wt}=a.ColorConvert,vt={},xt={};function bt(t,n,r,i){if(r){let s,o,l,d;for(let t=0,c=r.length;t<c;t++)s=r[t],e.isString(s)?(l=t/(c-1),o=a.ColorConvert.string(s,i)):(l=s.offset,o=a.ColorConvert.string(s.color,i)),n.addColorStop(l,o),!d&&wt(o)&&(d=!0);d&&(t.isTransparent=!0)}}const{getAngle:Et,getDistance:Pt}=e.PointHelper,{get:St,rotateOfOuter:Bt,scaleOfOuter:Lt}=e.MatrixHelper,{toPoint:kt}=e.AroundHelper,Rt={},Ct={};function At(t,e,a,n,r){let i;const{width:s,height:o}=t;if(s!==o||n){const t=Et(e,a);i=St(),r?(Lt(i,e,s/o*(n||1),1),Bt(i,e,t+90)):(Lt(i,e,1,s/o*(n||1)),Bt(i,e,t))}return i}const{getDistance:Tt}=e.PointHelper,{toPoint:Ot}=e.AroundHelper,It={},Mt={};const Wt={linearGradient:function(t,a){let{from:n,to:r,type:i,opacity:s}=t;yt(n||"top",a,vt),yt(r||"bottom",a,xt);const o=e.Platform.canvas.createLinearGradient(vt.x,vt.y,xt.x,xt.y),l={type:i,style:o};return bt(l,o,t.stops,s),l},radialGradient:function(t,a){let{from:n,to:r,type:i,opacity:s,stretch:o}=t;kt(n||"center",a,Rt),kt(r||"bottom",a,Ct);const l=e.Platform.canvas.createRadialGradient(Rt.x,Rt.y,0,Rt.x,Rt.y,Pt(Rt,Ct)),d={type:i,style:l};bt(d,l,t.stops,s);const c=At(a,Rt,Ct,o,!0);return c&&(d.transform=c),d},conicGradient:function(t,a){let{from:n,to:r,type:i,opacity:s,stretch:o}=t;Ot(n||"center",a,It),Ot(r||"bottom",a,Mt);const l=e.Platform.conicGradientSupport?e.Platform.canvas.createConicGradient(0,It.x,It.y):e.Platform.canvas.createRadialGradient(It.x,It.y,0,It.x,It.y,Tt(It,Mt)),d={type:i,style:l};bt(d,l,t.stops,s);const c=At(a,It,Mt,o||1,e.Platform.conicGradientRotate90);return c&&(d.transform=c),d},getTransform:At},{copy:Dt,move:Ht,toOffsetOutBounds:Ft}=e.BoundsHelper,{max:jt,abs:Gt}=Math,Yt={},Ut=new e.Matrix,Nt={};function Xt(t,e){let a,n,r,i,s=0,o=0,l=0,d=0;return e.forEach(t=>{a=t.x||0,n=t.y||0,i=1.5*(t.blur||0),r=Gt(t.spread||0),s=jt(s,r+i-n),o=jt(o,r+i+a),l=jt(l,r+i+n),d=jt(d,r+i-a)}),s===o&&o===l&&l===d?s:[s,o,l,d]}function qt(t,a,n){const{shapeBounds:r}=n;let i,s;e.Platform.fullImageShadow?(Dt(Yt,t.bounds),Ht(Yt,a.x-r.x,a.y-r.y),i=t.bounds,s=Yt):(i=r,s=a),t.copyWorld(n.canvas,i,s)}const{toOffsetOutBounds:zt}=e.BoundsHelper,Vt={};const Qt=Xt;const Zt={shadow:function(t,n,r){let i,s;const{__nowWorld:o}=t,{shadow:l}=t.__,{worldCanvas:d,bounds:c,renderBounds:h,shapeBounds:u,scaleX:f,scaleY:p}=r,g=n.getSameCanvas(),_=l.length-1;Ft(c,Nt,h),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(y=1/t)}g.setWorldShadow(Nt.offsetX+(l.x||0)*f*y,Nt.offsetY+(l.y||0)*p*y,(l.blur||0)*f*y,a.ColorConvert.string(l.color)),s=a.Effect.getShadowTransform(t,g,r,l,Nt,y),s&&g.setTransform(s),qt(g,Nt,r),s&&g.resetTransform(),i=h,l.box&&(g.restore(),g.save(),d&&(g.copyWorld(g,h,o,"copy"),i=o),d?g.copyWorld(d,o,o,"destination-out"):g.copyWorld(r.canvas,u,c,"destination-out")),e.LeafHelper.copyCanvasByWorld(t,n,g,i,l.blendMode),_&&m<_&&g.clearWorld(i)}),g.recycle(i)},innerShadow:function(t,n,r){let i,s;const{__nowWorld:o}=t,{innerShadow:l}=t.__,{worldCanvas:d,bounds:c,renderBounds:h,shapeBounds:u,scaleX:f,scaleY:p}=r,g=n.getSameCanvas(),_=l.length-1;zt(c,Vt,h),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(y=1/t)}g.save(),g.setWorldShadow(Vt.offsetX+(l.x||0)*f*y,Vt.offsetY+(l.y||0)*p*y,(l.blur||0)*f*y),s=a.Effect.getShadowTransform(t,g,r,l,Vt,y,!0),s&&g.setTransform(s),qt(g,Vt,r),g.restore(),d?(g.copyWorld(g,h,o,"copy"),g.copyWorld(d,o,o,"source-out"),i=o):(g.copyWorld(r.canvas,u,c,"source-out"),i=h),g.fillWorld(i,a.ColorConvert.string(l.color),"source-in"),e.LeafHelper.copyCanvasByWorld(t,n,g,i,l.blendMode),_&&m<_&&g.clearWorld(i)}),g.recycle(i)},blur:function(t,e,a){const{blur:n}=t.__;a.setWorldBlur(n*t.__nowWorld.a),a.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),a.filter="none"},backgroundBlur:function(t,e,a){},getShadowRenderSpread:Xt,getShadowTransform:function(t,e,a,n,r,i,s){if(n.spread){const a=2*n.spread*i*(s?-1:1),{width:o,height:l}=t.__layout.strokeBounds;return Ut.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},1+a/o,1+a/l),Ut}},isTransformShadow(t){},getInnerShadowSpread:Qt},{excludeRenderBounds:Kt}=e.LeafBoundsHelper;let $t;function Jt(t,e,a,n,r,i,s,o){switch(e){case"grayscale":$t||($t=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,a,n,r,i){const s=t.__nowWorld;a.resetTransform(),a.opacity=1,a.useMask(n,s),i&&n.recycle(s);ee(t,e,a,1,r,i)}(t,a,n,r,s,o);break;case"opacity-path":ee(t,a,n,i,s,o);break;case"path":o&&a.restore()}}function te(t){return t.getSameCanvas(!1,!0)}function ee(t,e,a,n,r,i){const s=t.__nowWorld;e.resetTransform(),e.opacity=n,e.copyWorld(a,s,void 0,r),i?a.recycle(s):a.clearWorld(s)}a.Group.prototype.__renderMask=function(t,e){let a,n,r,i,s,o;const{children:l}=this;for(let d=0,c=l.length;d<c;d++){if(a=l[d],o=a.__.mask,o){s&&(Jt(this,s,t,r,n,i,void 0,!0),n=r=null),"clipping"!==o&&"clipping-path"!==o||Kt(a,e)||a.__render(t,e),i=a.__.opacity,$t=!1,"path"===o||"clipping-path"===o?(i<1?(s="opacity-path",r||(r=te(t))):(s="path",t.save()),a.__clip(r||t,e)):(s="grayscale"===o?"grayscale":"alpha",n||(n=te(t)),r||(r=te(t)),a.__render(n,e));continue}const c=1===i&&a.__.__blendMode;c&&Jt(this,s,t,r,n,i,void 0,!1),Kt(a,e)||a.__render(r||t,e),c&&Jt(this,s,t,r,n,i,c,!1)}Jt(this,s,t,r,n,i,void 0,!0)};const ae=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ne=ae+"_#~&*+\\=|≮≯≈≠=…",re=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 ie(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const se=ie("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),oe=ie("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),le=ie(ae),de=ie(ne),ce=ie("- —/~|┆·");var he;!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"}(he||(he={}));const{Letter:ue,Single:fe,Before:pe,After:ge,Symbol:_e,Break:me}=he;function ye(t){return se[t]?ue:ce[t]?me:oe[t]?pe:le[t]?ge:de[t]?_e:re.test(t)?fe:ue}const we={trimRight(t){const{words:e}=t;let a,n=0,r=e.length;for(let i=r-1;i>-1&&(a=e[i].data[0]," "===a.char);i--)n++,t.width-=a.width;n&&e.splice(r-n,n)}};function ve(t,e,a){switch(e){case"title":return a?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:xe}=we,{Letter:be,Single:Ee,Before:Pe,After:Se,Symbol:Be,Break:Le}=he;let ke,Re,Ce,Ae,Te,Oe,Ie,Me,We,De,He,Fe,je,Ge,Ye,Ue,Ne,Xe=[];function qe(t,e){We&&!Me&&(Me=We),ke.data.push({char:t,width:e}),Ce+=e}function ze(){Ae+=Ce,ke.width=Ce,Re.words.push(ke),ke={data:[]},Ce=0}function Ve(){Ge&&(Ye.paraNumber++,Re.paraStart=!0,Ge=!1),We&&(Re.startCharSize=Me,Re.endCharSize=We,Me=0),Re.width=Ae,Ue.width?xe(Re):Ne&&Qe(),Xe.push(Re),Re={words:[]},Ae=0}function Qe(){Ae>(Ye.maxWidth||0)&&(Ye.maxWidth=Ae)}const{top:Ze,right:Ke,bottom:$e,left:Je}=e.Direction4;function ta(t,e,a){const{bounds:n,rows:r}=t;n[e]+=a;for(let t=0;t<r.length;t++)r[t][e]+=a}const ea={getDrawData:function(t,n){e.isString(t)||(t=String(t));let r=0,i=0,s=n.__getInput("width")||0,o=n.__getInput("height")||0;const{__padding:l}=n;l&&(s?(r=l[Je],s-=l[Ke]+l[Je],!s&&(s=.01)):n.autoSizeAlign||(r=l[Je]),o?(i=l[Ze],o-=l[Ze]+l[$e],!o&&(o=.01)):n.autoSizeAlign||(i=l[Ze]));const d={bounds:{x:r,y:i,width:s,height:o},rows:[],paraNumber:0,font:e.Platform.canvas.font=n.__font};return function(t,a,n){Ye=t,Xe=t.rows,Ue=t.bounds,Ne=!Ue.width&&!n.autoSizeAlign;const{__letterSpacing:r,paraIndent:i,textCase:s}=n,{canvas:o}=e.Platform,{width:l}=Ue;if(n.__isCharMode){const t="none"!==n.textWrap,e="break"===n.textWrap;Ge=!0,He=null,Me=Ie=We=Ce=Ae=0,ke={data:[]},Re={words:[]},r&&(a=[...a]);for(let n=0,d=a.length;n<d;n++)Oe=a[n],"\n"===Oe?(Ce&&ze(),Re.paraEnd=!0,Ve(),Ge=!0):(De=ye(Oe),De===be&&"none"!==s&&(Oe=ve(Oe,s,!Ce)),Ie=o.measureText(Oe).width,r&&(r<0&&(We=Ie),Ie+=r),Fe=De===Ee&&(He===Ee||He===be)||He===Ee&&De!==Se,je=!(De!==Pe&&De!==Ee||He!==Be&&He!==Se),Te=Ge&&i?l-i:l,t&&l&&Ae+Ce+Ie>Te&&(e?(Ce&&ze(),Ae&&Ve()):(je||(je=De===be&&He==Se),Fe||je||De===Le||De===Pe||De===Ee||Ce+Ie>Te?(Ce&&ze(),Ae&&Ve()):Ae&&Ve()))," "===Oe&&!0!==Ge&&Ae+Ce===0||(De===Le?(" "===Oe&&Ce&&ze(),qe(Oe,Ie),ze()):Fe||je?(Ce&&ze(),qe(Oe,Ie)):qe(Oe,Ie)),He=De);Ce&&ze(),Ae&&Ve(),Xe.length>0&&(Xe[Xe.length-1].paraEnd=!0)}else a.split("\n").forEach(t=>{Ye.paraNumber++,Ae=o.measureText(t).width,Xe.push({x:i||0,text:t,width:Ae,paraStart:!0}),Ne&&Qe()})}(d,t,n),l&&function(t,e,a,n,r){if(!n&&a.autoSizeAlign)switch(a.textAlign){case"left":ta(e,"x",t[Je]);break;case"right":ta(e,"x",-t[Ke])}if(!r&&a.autoSizeAlign)switch(a.verticalAlign){case"top":ta(e,"y",t[Ze]);break;case"bottom":ta(e,"y",-t[$e])}}(l,d,n,s,o),function(t,e){const{rows:a,bounds:n}=t,r=a.length,{__lineHeight:i,__baseLine:s,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:c,paraSpacing:h,autoSizeAlign:u}=e;let{x:f,y:p,width:g,height:_}=n,m=i*r+(h?h*(t.paraNumber-1):0),y=s;if(l&&m>_)m=Math.max(_,i),r>1&&(t.overflow=r);else if(_||u)switch(c){case"middle":p+=(_-m)/2;break;case"bottom":p+=_-m}y+=p;let w,v,x,b=g||u?g:t.maxWidth;for(let s=0,c=r;s<c;s++){if(w=a[s],w.x=f,w.width<g||w.width>g&&!l)switch(d){case"center":w.x+=(b-w.width)/2;break;case"right":w.x+=b-w.width}w.paraStart&&h&&s>0&&(y+=h),w.y=y,y+=i,t.overflow>s&&y>m&&(w.isOverflow=!0,t.overflow=s+1),v=w.x,x=w.width,o<0&&(w.width<0?(x=-w.width+e.fontSize+o,v-=x,x+=e.fontSize):x-=o),v<n.x&&(n.x=v),x>n.width&&(n.width=x),l&&g&&g<x&&(w.isOverflow=!0,t.overflow||(t.overflow=a.length))}n.y=p,n.height=m}(d,n),n.__isCharMode&&function(t,e,a){const{rows:n}=t,{textAlign:r,paraIndent:i,letterSpacing:s}=e,o=a&&r.includes("both"),l=o||a&&r.includes("justify"),d=l&&r.includes("letter");let c,h,u,f,p,g,_,m,y,w;n.forEach(t=>{t.words&&(p=i&&t.paraStart?i:0,m=t.words.length,l&&(w=!t.paraEnd||o,h=a-t.width-p,d?f=h/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=m>1?h/(m-1):0),g=s||t.isOverflow||d?0:u?1:2,t.isOverflow&&!s&&(t.textMode=!0),2===g?(t.x+=p,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=p,c=t.x,t.data=[],t.words.forEach((e,a)=>{1===g?(_={char:"",x:c},c=function(t,e,a){return t.forEach(t=>{a.char+=t.char,e+=t.width}),e}(e.data,c,_),(t.isOverflow||" "!==_.char)&&t.data.push(_)):c=function(t,e,a,n,r){return t.forEach(t=>{(n||" "!==t.char)&&(t.x=e,a.push(t)),e+=t.width,r&&(e+=r)}),e}(e.data,c,t.data,t.isOverflow,w&&f),w&&(y=a===m-1,u?y||(c+=u,t.width+=u):f&&(t.width+=f*(e.data.length-(y?1:0))))})),t.words=null)})}(d,n,s),d.overflow&&function(t,a,n,r){if(!r)return;const{rows:i,overflow:s}=t;let{textOverflow:o}=a;if(i.splice(s),o&&"show"!==o){let t,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?e.Platform.canvas.measureText(o).width:0,c=n+r-d;("none"===a.textWrap?i:[i[s-1]]).forEach(e=>{if(e.isOverflow&&e.data){let a=e.data.length-1;for(let n=a;n>-1&&(t=e.data[n],l=t.x+t.width,!(n===a&&l<c));n--){if(l<c&&" "!==t.char||!n){e.data.splice(n+1),e.width-=t.width;break}e.width-=t.width}e.width+=d,e.data.push({char:o,x:l}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(d,n,r,s),"none"!==n.textDecoration&&function(t,n){let r,i=0;const{fontSize:s,textDecoration:o}=n;switch(t.decorationHeight=s/11,e.isObject(o)?(r=o.type,o.color&&(t.decorationColor=a.ColorConvert.string(o.color)),o.offset&&(i=Math.min(.3*s,Math.max(o.offset,.15*-s)))):r=o,r){case"under":t.decorationY=[.15*s+i];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s+i,.35*-s]}}(d,n),d}};const aa={string:function(t,n){if(!t)return"#000";const r=e.isNumber(n)&&n<1;if(e.isString(t)){if(!r||!a.ColorConvert.object)return t;t=a.ColorConvert.object(t)}let i=e.isUndefined(t.a)?1:t.a;r&&(i*=n);const s=t.r+","+t.g+","+t.b;return 1===i?"rgb("+s+")":"rgba("+s+","+i+")"}};Object.assign(a.TextConvert,ea),Object.assign(a.ColorConvert,aa),Object.assign(a.Paint,D),Object.assign(a.PaintImage,mt),Object.assign(a.PaintGradient,Wt),Object.assign(a.Effect,Zt),i(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return e.LeaferImage}}),exports.Layouter=y,exports.LeaferCanvas=n,exports.Renderer=v,exports.Watcher=o,exports.useCanvas=i,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]}})}),Object.keys(a).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return a[t]}})});
|
|
2
2
|
//# sourceMappingURL=worker.min.cjs.map
|