@leafer-ui/node 1.9.8 → 1.9.10
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/node.cjs +49 -25
- package/dist/node.esm.js +50 -26
- package/dist/node.esm.min.js +1 -1
- package/dist/node.esm.min.js.map +1 -1
- package/dist/node.min.cjs +1 -1
- package/dist/node.min.cjs.map +1 -1
- package/package.json +12 -12
package/dist/node.cjs
CHANGED
|
@@ -695,7 +695,7 @@ class Picker {
|
|
|
695
695
|
children: [ target ]
|
|
696
696
|
} : target);
|
|
697
697
|
const {list: list} = this.findList;
|
|
698
|
-
const leaf = this.getBestMatchLeaf(list, options.bottomList, ignoreHittable);
|
|
698
|
+
const leaf = this.getBestMatchLeaf(list, options.bottomList, ignoreHittable, !!options.findList);
|
|
699
699
|
const path = ignoreHittable ? this.getPath(leaf) : this.getHitablePath(leaf);
|
|
700
700
|
this.clear();
|
|
701
701
|
return through ? {
|
|
@@ -710,7 +710,7 @@ class Picker {
|
|
|
710
710
|
hitPoint(hitPoint, hitRadius, options) {
|
|
711
711
|
return !!this.getByPoint(hitPoint, hitRadius, options).target;
|
|
712
712
|
}
|
|
713
|
-
getBestMatchLeaf(list, bottomList, ignoreHittable) {
|
|
713
|
+
getBestMatchLeaf(list, bottomList, ignoreHittable, allowNull) {
|
|
714
714
|
const findList = this.findList = new core.LeafList;
|
|
715
715
|
if (list.length) {
|
|
716
716
|
let find;
|
|
@@ -741,15 +741,27 @@ class Picker {
|
|
|
741
741
|
if (findList.length) return findList.list[0];
|
|
742
742
|
}
|
|
743
743
|
}
|
|
744
|
+
if (allowNull) return null;
|
|
744
745
|
return ignoreHittable ? list[0] : list.find(item => core.LeafHelper.worldHittable(item));
|
|
745
746
|
}
|
|
746
747
|
getPath(leaf) {
|
|
747
|
-
const path = new core.LeafList;
|
|
748
|
+
const path = new core.LeafList, syncList = [], {target: target} = this;
|
|
748
749
|
while (leaf) {
|
|
750
|
+
if (leaf.syncEventer) syncList.push(leaf.syncEventer);
|
|
749
751
|
path.add(leaf);
|
|
750
752
|
leaf = leaf.parent;
|
|
753
|
+
if (leaf === target) break;
|
|
754
|
+
}
|
|
755
|
+
if (syncList.length) {
|
|
756
|
+
syncList.forEach(item => {
|
|
757
|
+
while (item) {
|
|
758
|
+
if (item.__.hittable) path.add(item);
|
|
759
|
+
item = item.parent;
|
|
760
|
+
if (item === target) break;
|
|
761
|
+
}
|
|
762
|
+
});
|
|
751
763
|
}
|
|
752
|
-
if (
|
|
764
|
+
if (target) path.add(target);
|
|
753
765
|
return path;
|
|
754
766
|
}
|
|
755
767
|
getHitablePath(leaf) {
|
|
@@ -1225,7 +1237,14 @@ const PaintModule = {
|
|
|
1225
1237
|
|
|
1226
1238
|
let origin = {}, tempMatrix$1 = core.getMatrixData();
|
|
1227
1239
|
|
|
1228
|
-
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = core.MatrixHelper;
|
|
1240
|
+
const {get: get$3, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = core.MatrixHelper;
|
|
1241
|
+
|
|
1242
|
+
function stretchMode(data, box, scaleX, scaleY) {
|
|
1243
|
+
const transform = get$3();
|
|
1244
|
+
translate$1(transform, box.x, box.y);
|
|
1245
|
+
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
1246
|
+
data.transform = transform;
|
|
1247
|
+
}
|
|
1229
1248
|
|
|
1230
1249
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
1231
1250
|
const transform = get$3();
|
|
@@ -1242,8 +1261,11 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, c
|
|
|
1242
1261
|
const transform = get$3();
|
|
1243
1262
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
1244
1263
|
if (clipScaleX) {
|
|
1245
|
-
|
|
1246
|
-
|
|
1264
|
+
if (rotation || skew) {
|
|
1265
|
+
set(tempMatrix$1);
|
|
1266
|
+
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
1267
|
+
multiplyParent(transform, tempMatrix$1);
|
|
1268
|
+
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
1247
1269
|
}
|
|
1248
1270
|
data.transform = transform;
|
|
1249
1271
|
}
|
|
@@ -1339,7 +1361,10 @@ function getPatternData(paint, box, image) {
|
|
|
1339
1361
|
if (offset) core.PointHelper.move(tempImage, offset);
|
|
1340
1362
|
switch (mode) {
|
|
1341
1363
|
case "stretch":
|
|
1342
|
-
if (!sameBox)
|
|
1364
|
+
if (!sameBox) {
|
|
1365
|
+
scaleX = box.width / width, scaleY = box.height / height;
|
|
1366
|
+
stretchMode(data, box, scaleX, scaleY);
|
|
1367
|
+
}
|
|
1343
1368
|
break;
|
|
1344
1369
|
|
|
1345
1370
|
case "normal":
|
|
@@ -1348,7 +1373,7 @@ function getPatternData(paint, box, image) {
|
|
|
1348
1373
|
let clipScaleX, clipScaleY;
|
|
1349
1374
|
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
1350
1375
|
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
1351
|
-
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX :
|
|
1376
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : clipScaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
1352
1377
|
}
|
|
1353
1378
|
break;
|
|
1354
1379
|
|
|
@@ -1365,17 +1390,14 @@ function getPatternData(paint, box, image) {
|
|
|
1365
1390
|
if (scaleX) fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
1366
1391
|
}
|
|
1367
1392
|
if (!data.transform) {
|
|
1368
|
-
if (box.x || box.y)
|
|
1369
|
-
data.transform = get$2();
|
|
1370
|
-
translate(data.transform, box.x, box.y);
|
|
1371
|
-
}
|
|
1393
|
+
if (box.x || box.y) translate(data.transform = get$2(), box.x, box.y);
|
|
1372
1394
|
}
|
|
1373
|
-
|
|
1395
|
+
data.width = width;
|
|
1396
|
+
data.height = height;
|
|
1397
|
+
if (scaleX) {
|
|
1374
1398
|
data.scaleX = scaleX;
|
|
1375
1399
|
data.scaleY = scaleY;
|
|
1376
1400
|
}
|
|
1377
|
-
data.width = width;
|
|
1378
|
-
data.height = height;
|
|
1379
1401
|
if (opacity) data.opacity = opacity;
|
|
1380
1402
|
if (filters) data.filters = filters;
|
|
1381
1403
|
if (repeat) data.repeat = core.isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
@@ -1507,7 +1529,7 @@ function ignoreRender(ui, value) {
|
|
|
1507
1529
|
|
|
1508
1530
|
const {get: get$1, scale: scale, copy: copy$1} = core.MatrixHelper;
|
|
1509
1531
|
|
|
1510
|
-
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
1532
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs$1} = Math;
|
|
1511
1533
|
|
|
1512
1534
|
function createPattern(ui, paint, pixelRatio) {
|
|
1513
1535
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -1518,8 +1540,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
1518
1540
|
scaleX *= pixelRatio;
|
|
1519
1541
|
scaleY *= pixelRatio;
|
|
1520
1542
|
if (sx) {
|
|
1521
|
-
sx = abs(sx);
|
|
1522
|
-
sy = abs(sy);
|
|
1543
|
+
sx = abs$1(sx);
|
|
1544
|
+
sy = abs$1(sy);
|
|
1523
1545
|
imageMatrix = get$1();
|
|
1524
1546
|
copy$1(imageMatrix, transform);
|
|
1525
1547
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -1661,6 +1683,7 @@ const PaintImageModule = {
|
|
|
1661
1683
|
recycleImage: recycleImage,
|
|
1662
1684
|
createData: createData,
|
|
1663
1685
|
getPatternData: getPatternData,
|
|
1686
|
+
stretchMode: stretchMode,
|
|
1664
1687
|
fillOrFitMode: fillOrFitMode,
|
|
1665
1688
|
clipMode: clipMode,
|
|
1666
1689
|
repeatMode: repeatMode
|
|
@@ -1771,7 +1794,7 @@ const PaintGradientModule = {
|
|
|
1771
1794
|
getTransform: getTransform
|
|
1772
1795
|
};
|
|
1773
1796
|
|
|
1774
|
-
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = core.BoundsHelper, {max: max} = Math;
|
|
1797
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = core.BoundsHelper, {max: max, abs: abs} = Math;
|
|
1775
1798
|
|
|
1776
1799
|
const tempBounds = {}, tempMatrix = new core.Matrix;
|
|
1777
1800
|
|
|
@@ -1791,8 +1814,8 @@ function shadow(ui, current, shape) {
|
|
|
1791
1814
|
const sx = Math.abs(nowWorld.scaleX);
|
|
1792
1815
|
if (sx > 1) otherScale = 1 / sx;
|
|
1793
1816
|
}
|
|
1794
|
-
other.setWorldShadow(offsetOutBounds$1.offsetX + item.x * scaleX * otherScale, offsetOutBounds$1.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale, draw.ColorConvert.string(item.color));
|
|
1795
|
-
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
1817
|
+
other.setWorldShadow(offsetOutBounds$1.offsetX + (item.x || 0) * scaleX * otherScale, offsetOutBounds$1.offsetY + (item.y || 0) * scaleY * otherScale, (item.blur || 0) * scaleX * otherScale, draw.ColorConvert.string(item.color));
|
|
1818
|
+
transform = draw.Effect.getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
1796
1819
|
if (transform) other.setTransform(transform);
|
|
1797
1820
|
drawWorldShadow(other, offsetOutBounds$1, shape);
|
|
1798
1821
|
if (transform) other.resetTransform();
|
|
@@ -1815,7 +1838,7 @@ function shadow(ui, current, shape) {
|
|
|
1815
1838
|
function getShadowRenderSpread(_ui, shadow) {
|
|
1816
1839
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
1817
1840
|
shadow.forEach(item => {
|
|
1818
|
-
x = item.x || 0, y = item.y || 0,
|
|
1841
|
+
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs(item.spread || 0);
|
|
1819
1842
|
top = max(top, spread + blur - y);
|
|
1820
1843
|
right = max(right, spread + blur + x);
|
|
1821
1844
|
bottom = max(bottom, spread + blur + y);
|
|
@@ -1868,8 +1891,8 @@ function innerShadow(ui, current, shape) {
|
|
|
1868
1891
|
if (sx > 1) otherScale = 1 / sx;
|
|
1869
1892
|
}
|
|
1870
1893
|
other.save();
|
|
1871
|
-
other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
|
|
1872
|
-
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
1894
|
+
other.setWorldShadow(offsetOutBounds.offsetX + (item.x || 0) * scaleX * otherScale, offsetOutBounds.offsetY + (item.y || 0) * scaleY * otherScale, (item.blur || 0) * scaleX * otherScale);
|
|
1895
|
+
transform = draw.Effect.getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
1873
1896
|
if (transform) other.setTransform(transform);
|
|
1874
1897
|
drawWorldShadow(other, offsetOutBounds, shape);
|
|
1875
1898
|
other.restore();
|
|
@@ -2505,6 +2528,7 @@ const TextConvertModule = {
|
|
|
2505
2528
|
};
|
|
2506
2529
|
|
|
2507
2530
|
function string(color, opacity) {
|
|
2531
|
+
if (!color) return "#000";
|
|
2508
2532
|
const doOpacity = core.isNumber(opacity) && opacity < 1;
|
|
2509
2533
|
if (core.isString(color)) {
|
|
2510
2534
|
if (doOpacity && draw.ColorConvert.object) color = draw.ColorConvert.object(color); else return color;
|
package/dist/node.esm.js
CHANGED
|
@@ -10,7 +10,7 @@ import { HitCanvasManager, InteractionBase } from "@leafer-ui/core";
|
|
|
10
10
|
|
|
11
11
|
export * from "@leafer-ui/core";
|
|
12
12
|
|
|
13
|
-
import { PaintImage, Paint, ColorConvert, PaintGradient, Export, Group, TextConvert,
|
|
13
|
+
import { PaintImage, Paint, ColorConvert, PaintGradient, Export, Effect, Group, TextConvert, TwoPointBoundsHelper, Bounds as Bounds$1, FileHelper as FileHelper$1, Platform as Platform$1, isUndefined as isUndefined$1, Matrix as Matrix$1, MathHelper as MathHelper$1, Creator as Creator$1, TaskProcessor, Resource, LeaferCanvasBase as LeaferCanvasBase$1, Debug as Debug$1, Plugin as Plugin$1, UI } from "@leafer-ui/draw";
|
|
14
14
|
|
|
15
15
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
16
16
|
function adopt(value) {
|
|
@@ -699,7 +699,7 @@ class Picker {
|
|
|
699
699
|
children: [ target ]
|
|
700
700
|
} : target);
|
|
701
701
|
const {list: list} = this.findList;
|
|
702
|
-
const leaf = this.getBestMatchLeaf(list, options.bottomList, ignoreHittable);
|
|
702
|
+
const leaf = this.getBestMatchLeaf(list, options.bottomList, ignoreHittable, !!options.findList);
|
|
703
703
|
const path = ignoreHittable ? this.getPath(leaf) : this.getHitablePath(leaf);
|
|
704
704
|
this.clear();
|
|
705
705
|
return through ? {
|
|
@@ -714,7 +714,7 @@ class Picker {
|
|
|
714
714
|
hitPoint(hitPoint, hitRadius, options) {
|
|
715
715
|
return !!this.getByPoint(hitPoint, hitRadius, options).target;
|
|
716
716
|
}
|
|
717
|
-
getBestMatchLeaf(list, bottomList, ignoreHittable) {
|
|
717
|
+
getBestMatchLeaf(list, bottomList, ignoreHittable, allowNull) {
|
|
718
718
|
const findList = this.findList = new LeafList;
|
|
719
719
|
if (list.length) {
|
|
720
720
|
let find;
|
|
@@ -745,15 +745,27 @@ class Picker {
|
|
|
745
745
|
if (findList.length) return findList.list[0];
|
|
746
746
|
}
|
|
747
747
|
}
|
|
748
|
+
if (allowNull) return null;
|
|
748
749
|
return ignoreHittable ? list[0] : list.find(item => LeafHelper.worldHittable(item));
|
|
749
750
|
}
|
|
750
751
|
getPath(leaf) {
|
|
751
|
-
const path = new LeafList;
|
|
752
|
+
const path = new LeafList, syncList = [], {target: target} = this;
|
|
752
753
|
while (leaf) {
|
|
754
|
+
if (leaf.syncEventer) syncList.push(leaf.syncEventer);
|
|
753
755
|
path.add(leaf);
|
|
754
756
|
leaf = leaf.parent;
|
|
757
|
+
if (leaf === target) break;
|
|
758
|
+
}
|
|
759
|
+
if (syncList.length) {
|
|
760
|
+
syncList.forEach(item => {
|
|
761
|
+
while (item) {
|
|
762
|
+
if (item.__.hittable) path.add(item);
|
|
763
|
+
item = item.parent;
|
|
764
|
+
if (item === target) break;
|
|
765
|
+
}
|
|
766
|
+
});
|
|
755
767
|
}
|
|
756
|
-
if (
|
|
768
|
+
if (target) path.add(target);
|
|
757
769
|
return path;
|
|
758
770
|
}
|
|
759
771
|
getHitablePath(leaf) {
|
|
@@ -1229,7 +1241,14 @@ const PaintModule = {
|
|
|
1229
1241
|
|
|
1230
1242
|
let origin = {}, tempMatrix$1 = getMatrixData();
|
|
1231
1243
|
|
|
1232
|
-
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
1244
|
+
const {get: get$3, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
1245
|
+
|
|
1246
|
+
function stretchMode(data, box, scaleX, scaleY) {
|
|
1247
|
+
const transform = get$3();
|
|
1248
|
+
translate$1(transform, box.x, box.y);
|
|
1249
|
+
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
1250
|
+
data.transform = transform;
|
|
1251
|
+
}
|
|
1233
1252
|
|
|
1234
1253
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
1235
1254
|
const transform = get$3();
|
|
@@ -1246,8 +1265,11 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, c
|
|
|
1246
1265
|
const transform = get$3();
|
|
1247
1266
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
1248
1267
|
if (clipScaleX) {
|
|
1249
|
-
|
|
1250
|
-
|
|
1268
|
+
if (rotation || skew) {
|
|
1269
|
+
set(tempMatrix$1);
|
|
1270
|
+
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
1271
|
+
multiplyParent(transform, tempMatrix$1);
|
|
1272
|
+
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
1251
1273
|
}
|
|
1252
1274
|
data.transform = transform;
|
|
1253
1275
|
}
|
|
@@ -1343,7 +1365,10 @@ function getPatternData(paint, box, image) {
|
|
|
1343
1365
|
if (offset) PointHelper.move(tempImage, offset);
|
|
1344
1366
|
switch (mode) {
|
|
1345
1367
|
case "stretch":
|
|
1346
|
-
if (!sameBox)
|
|
1368
|
+
if (!sameBox) {
|
|
1369
|
+
scaleX = box.width / width, scaleY = box.height / height;
|
|
1370
|
+
stretchMode(data, box, scaleX, scaleY);
|
|
1371
|
+
}
|
|
1347
1372
|
break;
|
|
1348
1373
|
|
|
1349
1374
|
case "normal":
|
|
@@ -1352,7 +1377,7 @@ function getPatternData(paint, box, image) {
|
|
|
1352
1377
|
let clipScaleX, clipScaleY;
|
|
1353
1378
|
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
1354
1379
|
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
1355
|
-
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX :
|
|
1380
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : clipScaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
1356
1381
|
}
|
|
1357
1382
|
break;
|
|
1358
1383
|
|
|
@@ -1369,17 +1394,14 @@ function getPatternData(paint, box, image) {
|
|
|
1369
1394
|
if (scaleX) fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
1370
1395
|
}
|
|
1371
1396
|
if (!data.transform) {
|
|
1372
|
-
if (box.x || box.y)
|
|
1373
|
-
data.transform = get$2();
|
|
1374
|
-
translate(data.transform, box.x, box.y);
|
|
1375
|
-
}
|
|
1397
|
+
if (box.x || box.y) translate(data.transform = get$2(), box.x, box.y);
|
|
1376
1398
|
}
|
|
1377
|
-
|
|
1399
|
+
data.width = width;
|
|
1400
|
+
data.height = height;
|
|
1401
|
+
if (scaleX) {
|
|
1378
1402
|
data.scaleX = scaleX;
|
|
1379
1403
|
data.scaleY = scaleY;
|
|
1380
1404
|
}
|
|
1381
|
-
data.width = width;
|
|
1382
|
-
data.height = height;
|
|
1383
1405
|
if (opacity) data.opacity = opacity;
|
|
1384
1406
|
if (filters) data.filters = filters;
|
|
1385
1407
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
@@ -1511,7 +1533,7 @@ function ignoreRender(ui, value) {
|
|
|
1511
1533
|
|
|
1512
1534
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
1513
1535
|
|
|
1514
|
-
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
1536
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs$1} = Math;
|
|
1515
1537
|
|
|
1516
1538
|
function createPattern(ui, paint, pixelRatio) {
|
|
1517
1539
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -1522,8 +1544,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
1522
1544
|
scaleX *= pixelRatio;
|
|
1523
1545
|
scaleY *= pixelRatio;
|
|
1524
1546
|
if (sx) {
|
|
1525
|
-
sx = abs(sx);
|
|
1526
|
-
sy = abs(sy);
|
|
1547
|
+
sx = abs$1(sx);
|
|
1548
|
+
sy = abs$1(sy);
|
|
1527
1549
|
imageMatrix = get$1();
|
|
1528
1550
|
copy$1(imageMatrix, transform);
|
|
1529
1551
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -1665,6 +1687,7 @@ const PaintImageModule = {
|
|
|
1665
1687
|
recycleImage: recycleImage,
|
|
1666
1688
|
createData: createData,
|
|
1667
1689
|
getPatternData: getPatternData,
|
|
1690
|
+
stretchMode: stretchMode,
|
|
1668
1691
|
fillOrFitMode: fillOrFitMode,
|
|
1669
1692
|
clipMode: clipMode,
|
|
1670
1693
|
repeatMode: repeatMode
|
|
@@ -1775,7 +1798,7 @@ const PaintGradientModule = {
|
|
|
1775
1798
|
getTransform: getTransform
|
|
1776
1799
|
};
|
|
1777
1800
|
|
|
1778
|
-
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max} = Math;
|
|
1801
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max, abs: abs} = Math;
|
|
1779
1802
|
|
|
1780
1803
|
const tempBounds = {}, tempMatrix = new Matrix;
|
|
1781
1804
|
|
|
@@ -1795,8 +1818,8 @@ function shadow(ui, current, shape) {
|
|
|
1795
1818
|
const sx = Math.abs(nowWorld.scaleX);
|
|
1796
1819
|
if (sx > 1) otherScale = 1 / sx;
|
|
1797
1820
|
}
|
|
1798
|
-
other.setWorldShadow(offsetOutBounds$1.offsetX + item.x * scaleX * otherScale, offsetOutBounds$1.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale, ColorConvert.string(item.color));
|
|
1799
|
-
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
1821
|
+
other.setWorldShadow(offsetOutBounds$1.offsetX + (item.x || 0) * scaleX * otherScale, offsetOutBounds$1.offsetY + (item.y || 0) * scaleY * otherScale, (item.blur || 0) * scaleX * otherScale, ColorConvert.string(item.color));
|
|
1822
|
+
transform = Effect.getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
1800
1823
|
if (transform) other.setTransform(transform);
|
|
1801
1824
|
drawWorldShadow(other, offsetOutBounds$1, shape);
|
|
1802
1825
|
if (transform) other.resetTransform();
|
|
@@ -1819,7 +1842,7 @@ function shadow(ui, current, shape) {
|
|
|
1819
1842
|
function getShadowRenderSpread(_ui, shadow) {
|
|
1820
1843
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
1821
1844
|
shadow.forEach(item => {
|
|
1822
|
-
x = item.x || 0, y = item.y || 0,
|
|
1845
|
+
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs(item.spread || 0);
|
|
1823
1846
|
top = max(top, spread + blur - y);
|
|
1824
1847
|
right = max(right, spread + blur + x);
|
|
1825
1848
|
bottom = max(bottom, spread + blur + y);
|
|
@@ -1872,8 +1895,8 @@ function innerShadow(ui, current, shape) {
|
|
|
1872
1895
|
if (sx > 1) otherScale = 1 / sx;
|
|
1873
1896
|
}
|
|
1874
1897
|
other.save();
|
|
1875
|
-
other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
|
|
1876
|
-
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
1898
|
+
other.setWorldShadow(offsetOutBounds.offsetX + (item.x || 0) * scaleX * otherScale, offsetOutBounds.offsetY + (item.y || 0) * scaleY * otherScale, (item.blur || 0) * scaleX * otherScale);
|
|
1899
|
+
transform = Effect.getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
1877
1900
|
if (transform) other.setTransform(transform);
|
|
1878
1901
|
drawWorldShadow(other, offsetOutBounds, shape);
|
|
1879
1902
|
other.restore();
|
|
@@ -2509,6 +2532,7 @@ const TextConvertModule = {
|
|
|
2509
2532
|
};
|
|
2510
2533
|
|
|
2511
2534
|
function string(color, opacity) {
|
|
2535
|
+
if (!color) return "#000";
|
|
2512
2536
|
const doOpacity = isNumber(opacity) && opacity < 1;
|
|
2513
2537
|
if (isString(color)) {
|
|
2514
2538
|
if (doOpacity && ColorConvert.object) color = ColorConvert.object(color); else return color;
|
package/dist/node.esm.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{LeaferCanvasBase as t,Platform as e,canvasPatch as i,FileHelper as s,Creator as n,LeaferImage as a,defineKey as r,LeafList as o,DataHelper as l,RenderEvent as d,ChildEvent as h,WatchEvent as c,PropertyEvent as u,LeafHelper as f,BranchHelper as g,LeafBoundsHelper as p,Bounds as _,isArray as w,Debug as y,LeafLevelList as m,LayoutEvent as v,Run as x,ImageManager as b,ResizeEvent as B,BoundsHelper as S,Plugin as k,isObject as R,FourNumberHelper as E,Matrix as L,isUndefined as T,isString as A,getMatrixData as C,MatrixHelper as O,MathHelper as P,AlignHelper as W,PointHelper as M,ImageEvent as D,AroundHelper as F,Direction4 as I,isNumber as U}from"@leafer/core";export*from"@leafer/core";export{LeaferImage}from"@leafer/core";import{writeFileSync as Y}from"fs";import{HitCanvasManager as X,InteractionBase as z}from"@leafer-ui/core";export*from"@leafer-ui/core";import{PaintImage as N,Paint as j,ColorConvert as q,PaintGradient as G,Export as H,Group as V,TextConvert as Q,Effect as J,TwoPointBoundsHelper as Z,Bounds as $,FileHelper as K,Platform as tt,isUndefined as et,Matrix as it,MathHelper as st,Creator as nt,TaskProcessor as at,Resource as rt,LeaferCanvasBase as ot,Debug as lt,Plugin as dt,UI as ht}from"@leafer-ui/draw";function ct(t,e,i,s){return new(i||(i=Promise))(function(n,a){function r(t){try{l(s.next(t))}catch(t){a(t)}}function o(t){try{l(s.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(r,o)}l((s=s.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;class ut extends t{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config),e.roundRectPatch&&(this.context.__proto__.roundRect=null,i(this.context.__proto__))}__createView(){this.view=e.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}const{mineType:ft,fileType:gt}=s;function pt(t,i){if(e.canvasType=t,!e.origin){if("skia"===t){const{Canvas:t,loadImage:s}=i;e.origin={createCanvas:(e,i,s)=>new t(e,i,s),canvasToDataURL:(t,e,i)=>t.toDataURLSync(e,{quality:i}),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(t,e,i)=>t.saveAs(e,{quality:i}),download(t,e){},loadImage:t=>s(e.image.getRealURL(t))},e.roundRectPatch=!0}else if("napi"===t){const{Canvas:t,loadImage:s}=i;e.origin={createCanvas:(e,i,s)=>new t(e,i,s),canvasToDataURL:(t,e,i)=>t.toDataURL(ft(e),i),canvasToBolb:(t,e,i)=>ct(this,void 0,void 0,function*(){return t.toBuffer(ft(e),i)}),canvasSaveAs:(t,e,i)=>ct(this,void 0,void 0,function*(){return Y(e,t.toBuffer(ft(gt(e)),i))}),download(t,e){},loadImage:t=>s(e.image.getRealURL(t))}}e.ellipseToCurve=!0,e.event={stopDefault(t){},stopNow(t){},stop(t){}},e.canvas=n.canvas()}}Object.assign(n,{canvas:(t,e)=>new ut(t,e),image:t=>new a(t)}),e.name="node",e.backgrounder=!0,e.requestRender=function(t){setTimeout(t,16)},r(e,"devicePixelRatio",{get:()=>1}),e.conicGradientSupport=!0;class _t{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new o;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new o,this.target=t,e&&(this.config=l.default(e,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(d.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===h.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,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new c(c.DATA,{updatedList:this.updatedList})),this.__updatedList=new o,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[u.CHANGE,this.__onAttrChange,this],[[h.ADD,h.REMOVE],this.__onChildEvent,this],[c.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:wt,updateBounds:yt,updateChange:mt}=f,{pushAllChildBranch:vt,pushAllParent:xt}=g;const{worldBounds:bt}=p;class Bt{constructor(t){this.updatedBounds=new _,this.beforeBounds=new _,this.afterBounds=new _,w(t)&&(t=new o(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,bt)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,bt),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:St,updateAllChange:kt}=f,Rt=y.get("Layouter");class Et{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new m,this.target=t,e&&(this.config=l.default(e,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(v.START),this.layoutOnce(),t.emitEvent(new v(v.END,this.layoutedBlocks,this.times))}catch(t){Rt.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Rt.warn("layouting"):this.times>3?Rt.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(c.REQUEST),this.totalTimes>1?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 e=x.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:a,AFTER:r}=v,o=this.getBlocks(s);o.forEach(t=>t.setBefore()),i.emitEvent(new v(n,o,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(wt(t,!0),e.add(t),t.isBranch&&vt(t,e),xt(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),xt(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||yt(s[t])}yt(i)}})}(this.__levelList),function(t){t.list.forEach(mt)}(s),this.extraBlock&&o.push(this.extraBlock),o.forEach(t=>t.setAfter()),i.emitEvent(new v(a,o,this.times)),i.emitEvent(new v(r,o,this.times)),this.addBlocks(o),this.__levelList.reset(),this.__updatedList=null,x.end(e)}fullLayout(){const t=x.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=v,a=this.getBlocks(new o(e));e.emitEvent(new v(i,a,this.times)),Et.fullLayout(e),a.forEach(t=>{t.setAfter()}),e.emitEvent(new v(s,a,this.times)),e.emitEvent(new v(n,a,this.times)),this.addBlocks(a),x.end(t)}static fullLayout(t){St(t,!0),t.isBranch?g.updateBounds(t):f.updateBounds(t),kt(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Bt([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Bt(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_([[v.REQUEST,this.layout,this],[v.AGAIN,this.layoutAgain,this],[c.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Lt=y.get("Renderer");class Tt{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=l.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(v.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(d.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(d.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(d.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new _,Lt.log(e.innerName,"---\x3e");try{this.emitRender(d.START),this.renderOnce(t),this.emitRender(d.END,this.totalBounds),b.clearRecycled()}catch(t){this.rendering=!1,Lt.error(t)}Lt.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Lt.warn("rendering");if(this.times>3)return Lt.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new _,this.renderOptions={},t)this.emitRender(d.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(d.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(d.RENDER,this.renderBounds,this.renderOptions),this.emitRender(d.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 e=x.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new _(s);i.save(),s.spread(Tt.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),x.end(e)}fullRender(){const t=x.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),x.end(t)}__render(t,i){const{canvas:s}=this,n=t.includes(this.target.__world),a=n?{includes:n}:{bounds:t,includes:n};this.needFill&&s.fillWorld(t,this.config.fill),y.showRepaint&&y.drawRepaint(s,t),e.render(this.target,s,a),this.renderBounds=i=i||t,this.renderOptions=a,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),s.updateRender(i)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new _;e.setList(t),t.length=0,t.push(e)}}__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 i=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:s}=this.config;if(s&&t>s)return e.requestRender(i);const{frames:n}=this;n.length>30&&n.shift(),n.push(t),this.FPS=Math.round(n.reduce((t,e)=>t+e,0)/n.length),this.requestTime=0,this.checkRender()};e.requestRender(i)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new _(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new _(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||Lt.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new d(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[d.REQUEST,this.update,this],[v.END,this.__onLayoutEnd,this],[d.AGAIN,this.renderAgain,this],[B.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Tt.clipSpread=10;const{hitRadiusPoint:At}=S;class Ct{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,a=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new o(i.findList),i.findList||this.hitBranch(a.isBranchLeaf?{children:[a]}:a);const{list:r}=this.findList,l=this.getBestMatchLeaf(r,i.bottomList,n),d=n?this.getPath(l):this.getHitablePath(l);return this.clear(),s?{path:d,target:l,throughPath:r.length?this.getThroughPath(r):d}:{path:d,target:l}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i){const s=this.findList=new o;if(t.length){let e;const{x:n,y:a}=this.point,r={x:n,y:a,radiusX:0,radiusY:0};for(let n=0,a=t.length;n<a;n++)if(e=t[n],(i||f.worldHittable(e))&&(this.hitChild(e,r),s.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&f.hasParent(t,e))){s.reset();break}return s.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),s.length)return s.list[0];return i?t[0]:t.find(t=>f.worldHittable(t))}getPath(t){const e=new o;for(;t;)e.add(t),t=t.parent;return this.target&&e.add(this.target),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new o;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new o,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,a;for(let t=0,r=i.length;t<r;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(a=s.list[t],!n||!n.has(a));t++)e.add(a)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:n}=this;for(let a=t.length-1;a>-1;a--)i=t[a],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||At(i.__world,n),i.isBranch?(s||i.__ignoreHitWorld)&&(i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)):s&&this.hitChild(i,n))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:a}=s;for(let s=0,r=a.length;s<r;s++)if(i=a[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Ot{constructor(t,e){this.config={},e&&(this.config=l.default(e,this.config)),this.picker=new Ct(this.target=t,this),this.finder=n.finder&&n.finder()}getByPoint(t,i,s){const{target:n,picker:a}=this;return e.backgrounder&&n&&n.updateLayout(),a.getByPoint(t,i,s)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):k.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Pt(t,e){const i=t.__,{rows:s,decorationY:n}=i.__textDrawData;let a;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)a=s[t],a.text?e.fillText(a.text,a.x,a.y):a.data&&a.data.forEach(t=>{e.fillText(t.char,t.x,a.y)});if(n){const{decorationColor:t,decorationHeight:a}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach(t=>n.forEach(i=>e.fillRect(t.x,t.y+i,t.width,a)))}}function Wt(t,e){t.__.__font?Pt(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Mt(t,e,i){switch(e.__.strokeAlign){case"center":Dt(t,1,e,i);break;case"inside":Ft(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?Dt(t,2,e,i):Ft(t,"outside",e,i)}}function Dt(t,e,i,s){const n=i.__;R(t)?Ut(t,e,!0,i,s):(s.setStroke(t,n.__strokeWidth*e,n),It(i,s))}function Ft(t,e,i,s){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,Dt(t,2,i,n),n.blendMode="outside"===e?"destination-out":"destination-in",Pt(i,n),n.blendMode="normal",f.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}function It(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:a}=s;for(let t=0,s=n.length;t<s;t++)i=n[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach(t=>{e.strokeText(t.char,t.x,i.y)});if(a){const{decorationHeight:t}=s;n.forEach(i=>a.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}}function Ut(t,e,i,s,n){let a;const r=s.__,{__hasMultiStrokeStyle:o}=r;o||n.setStroke(void 0,r.__strokeWidth*e,r);for(let l=0,d=t.length;l<d;l++)if(a=t[l],(!a.image||!N.checkImage(s,n,a,!1))&&a.style){if(o){const{strokeStyle:t}=a;t?n.setStroke(a.style,r.__getRealStrokeWidth(t)*e,r,t):n.setStroke(a.style,r.__strokeWidth*e,r)}else n.strokeStyle=a.style;a.blendMode?(n.saveBlendMode(a.blendMode),i?It(s,n):n.stroke(),n.restoreBlendMode()):i?It(s,n):n.stroke()}}function Yt(t,e,i){const s=e.__;if(s.__strokeWidth)if(s.__font)Mt(t,e,i);else switch(s.strokeAlign){case"center":Xt(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),Xt(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const s=e.__;if(s.__fillAfterStroke)Xt(t,2,e,i);else{const{renderBounds:n}=e.__layout,a=i.getSameCanvas(!0,!0);e.__drawRenderPath(a),Xt(t,2,e,a),a.clipUI(s),a.clearWorld(n),f.copyCanvasByWorld(e,i,a),a.recycle(e.__nowWorld)}}(t,e,i)}}function Xt(t,e,i,s){const n=i.__;R(t)?Ut(t,e,!1,i,s):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&j.strokeArrow(t,i,s)}Object.assign(n,{watcher:(t,e)=>new _t(t,e),layouter:(t,e)=>new Et(t,e),renderer:(t,e,i)=>new Tt(t,e,i),selector:(t,e)=>new Ot(t,e)}),e.layout=Et.fullLayout,e.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new o,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const{getSpread:zt,copyAndSpread:Nt,toOuterOf:jt,getOuterOf:qt,getByMove:Gt,move:Ht,getIntersectData:Vt}=S,Qt={};let Jt;const{stintSet:Zt}=l,{hasTransparent:$t}=q;function Kt(t,e,i){if(!R(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout;switch(e.type){case"image":s=N.image(i,t,e,n,!Jt||!Jt[e.url]);break;case"linear":s=G.linearGradient(e,n);break;case"radial":s=G.radialGradient(e,n);break;case"angular":s=G.conicGradient(e,n);break;case"solid":const{type:a,color:r,opacity:o}=e;s={type:a,style:q.string(r,o)};break;default:T(e.r)||(s={type:"solid",style:q.string(e)})}if(s){if(A(s.style)&&$t(s.style)&&(s.isTransparent=!0),e.style){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}e.editing&&(s.editing=e.editing),e.blendMode&&(s.blendMode=e.blendMode)}return s}const te={compute:function(t,e){const i=e.__,s=[];let n,a,r,o=i.__input[t];w(o)||(o=[o]),Jt=N.recycleImage(t,i);for(let i,n=0,a=o.length;n<a;n++)(i=Kt(t,o[n],e))&&(s.push(i),i.strokeStyle&&(r||(r=1),i.strokeStyle.strokeWidth&&(r=Math.max(r,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length&&s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),a=!0),"fill"===t?(Zt(i,"__isAlphaPixelFill",n),Zt(i,"__isTransparentFill",a)):(Zt(i,"__isAlphaPixelStroke",n),Zt(i,"__isTransparentStroke",a),Zt(i,"__hasMultiStrokeStyle",r))},fill:function(t,e,i){i.fillStyle=t,Wt(e,i)},fills:function(t,e,i){let s;for(let n=0,a=t.length;n<a;n++){if(s=t[n],s.image){if(N.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!n&&s.image.isPlacehold&&e.drawImagePlaceholder(i,s.image);continue}}if(i.fillStyle=s.style,s.transform||s.scaleFixed){if(i.save(),s.transform&&i.transform(s.transform),s.scaleFixed){const{scaleX:t,scaleY:n}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&n>1)&&i.scale(1/t,1/n)}s.blendMode&&(i.blendMode=s.blendMode),Wt(e,i),i.restore()}else s.blendMode?(i.saveBlendMode(s.blendMode),Wt(e,i),i.restoreBlendMode()):Wt(e,i)}},fillPathOrText:Wt,fillText:Pt,stroke:Yt,strokes:function(t,e,i){Yt(t,e,i)},strokeText:Mt,drawTextStroke:It,shape:function(t,i,s){const n=i.getSameCanvas(),a=i.bounds,r=t.__nowWorld,o=t.__layout,l=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let d,h,c,u,f,g;jt(o.strokeSpread?(Nt(Qt,o.boxBounds,o.strokeSpread),Qt):o.boxBounds,r,l);let{scaleX:p,scaleY:_}=t.getRenderScaleData(!0);if(a.includes(l))g=n,d=f=l,h=r;else{let n;if(e.fullImageShadow)n=l;else{const t=o.renderShapeSpread?zt(a,E.swapAndScale(o.renderShapeSpread,p,_)):a;n=Vt(t,l)}u=a.getFitMatrix(n);let{a:w,d:y}=u;u.a<1&&(g=i.getSameCanvas(),t.__renderShape(g,s),p*=w,_*=y),f=qt(l,u),d=Gt(f,-u.e,-u.f),h=qt(r,u),Ht(h,-u.e,-u.f);const m=s.matrix;m?(c=new L(u),c.multiply(m),w*=m.scaleX,y*=m.scaleY):c=u,c.withScale(w,y),s=Object.assign(Object.assign({},s),{matrix:c})}return t.__renderShape(n,s),{canvas:n,matrix:c,fitMatrix:u,bounds:d,renderBounds:h,worldCanvas:g,shapeBounds:f,scaleX:p,scaleY:_}}};let ee={},ie=C();const{get:se,rotateOfOuter:ne,translate:ae,scaleOfOuter:re,multiplyParent:oe,scale:le,rotate:de,skew:he}=O;function ce(t,e,i,s,n,a,r){const o=se();ae(o,e.x+i,e.y+s),le(o,n,a),r&&ne(o,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=o}function ue(t,e,i,s,n,a,r,o,l,d){const h=se();ge(h,e,i,s,n,a,r,o),l&&(ie.a=l,ie.d=d,oe(h,ie)),t.transform=h}function fe(t,e,i,s,n,a,r,o,l,d,h,c){const u=se();if(c)ge(u,e,n,a,r,o,l,d);else{if(l)if("center"===h)ne(u,{x:i/2,y:s/2},l);else switch(de(u,l),l){case 90:ae(u,s,0);break;case 180:ae(u,i,s);break;case 270:ae(u,0,i)}ee.x=e.x+n,ee.y=e.y+a,ae(u,ee.x,ee.y),r&&re(u,ee,r,o)}t.transform=u}function ge(t,e,i,s,n,a,r,o){r&&de(t,r),o&&he(t,o.x,o.y),n&&le(t,n,a),ae(t,e.x+i,e.y+s)}const{get:pe,translate:_e}=O,we=new _,ye={},me={};function ve(t,e,i,s){const{changeful:n,sync:a,scaleFixed:r}=i;n&&(t.changeful=n),a&&(t.sync=a),r&&(t.scaleFixed=r),t.data=xe(i,s,e)}function xe(t,e,i){t.padding&&(e=we.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:s,height:n}=i;const{opacity:a,mode:r,align:o,offset:l,scale:d,size:h,rotation:c,skew:u,clipSize:f,repeat:g,gap:p,filters:_}=t,w=e.width===s&&e.height===n,y={mode:r},m="center"!==o&&(c||0)%180==90;let v,x;switch(S.set(me,0,0,m?n:s,m?s:n),r&&"cover"!==r&&"fit"!==r?((d||h)&&(P.getScaleData(d,h,i,ye),v=ye.scaleX,x=ye.scaleY),(o||p||g)&&(v&&S.scale(me,v,x,!0),o&&W.toPoint(o,me,e,me,!0,!0))):w&&!c||(v=x=S.getFitScale(e,me,"fit"!==r),S.put(e,i,o,v,!1,me),S.scale(me,v,x,!0)),l&&M.move(me,l),r){case"stretch":w||(s=e.width,n=e.height);break;case"normal":case"clip":if(me.x||me.y||v||f||c||u){let t,i;f&&(t=e.width/f.width,i=e.height/f.height),ue(y,e,me.x,me.y,v,x,c,u,t,i),t&&(v=v?v*t:v,x=x?x*i:i)}break;case"repeat":(!w||v||c||u)&&fe(y,e,s,n,me.x,me.y,v,x,c,u,o,t.freeTransform),g||(y.repeat="repeat");const i=R(g);(p||i)&&(y.gap=function(t,e,i,s,n){let a,r;R(t)?(a=t.x,r=t.y):a=r=t;return{x:be(a,i,n.width,e&&e.x),y:be(r,s,n.height,e&&e.y)}}(p,i&&g,me.width,me.height,e));break;default:v&&ce(y,e,me.x,me.y,v,x,c)}return y.transform||(e.x||e.y)&&(y.transform=pe(),_e(y.transform,e.x,e.y)),v&&"stretch"!==r&&(y.scaleX=v,y.scaleY=x),y.width=s,y.height=n,a&&(y.opacity=a),_&&(y.filters=_),g&&(y.repeat=A(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),y}function be(t,e,i,s){const n=A(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let Be,Se=new _;const{isSame:ke}=S;function Re(t,e,i,s,n,a){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return n.data||ve(n,s,i,a),!0}function Ee(t,e){Ae(t,D.LOAD,e)}function Le(t,e){Ae(t,D.LOADED,e)}function Te(t,e,i){e.error=i,t.forceUpdate("surface"),Ae(t,D.ERROR,e)}function Ae(t,e,i){t.hasEvent(e)&&t.emitEvent(new D(e,i))}function Ce(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Oe,scale:Pe,copy:We}=O,{floor:Me,ceil:De,max:Fe,abs:Ie}=Math;function Ue(t,i,s){let{scaleX:n,scaleY:a}=t.getRenderScaleData(!0,i.scaleFixed);const r=n+"-"+a+"-"+s;if(i.patternId===r||t.destroyed)return!1;{const{image:o,data:l}=i;let d,h,{width:c,height:u,scaleX:f,scaleY:g,transform:p,repeat:_,gap:w}=l;n*=s,a*=s,f&&(f=Ie(f),g=Ie(g),h=Oe(),We(h,p),Pe(h,1/f,1/g),n*=f,a*=g),c*=n,u*=a;const y=c*u;if(!_&&y>e.image.maxCacheSize)return!1;let m=e.image.maxPatternSize;if(o.isSVG){const t=c/o.width;t>1&&(d=t/De(t))}else{const t=o.width*o.height;m>t&&(m=t)}y>m&&(d=Math.sqrt(y/m)),d&&(n/=d,a/=d,c/=d,u/=d),f&&(n/=f,a/=g);const v=w&&w.x*n,x=w&&w.y*a;if(p||1!==n||1!==a){const t=c+(v||0),e=u+(x||0);n/=t/Fe(Me(t),1),a/=e/Fe(Me(e),1),h||(h=Oe(),p&&We(h,p)),Pe(h,1/n,1/a)}const b=o.getCanvas(c,u,l.opacity,l.filters,v,x,t.leafer&&t.leafer.config.smooth),B=o.getPattern(b,_||e.origin.noRepeat||"no-repeat",h,i);return i.style=B,i.patternId=r,!0}}const Ye={image:function(t,e,i,s,n){let a,r;const o=b.get(i);return Be&&i===Be.paint&&ke(s,Be.boxBounds)?a=Be.leafPaint:(a={type:i.type,image:o},o.hasAlphaPixel&&(a.isTransparent=!0),Be=o.use>1?{leafPaint:a,paint:i,boxBounds:Se.set(s)}:null),(n||o.loading)&&(r={image:o,attrName:e,attrValue:i}),o.ready?(Re(t,e,i,o,a,s),n&&(Ee(t,r),Le(t,r))):o.error?n&&Te(t,r,o.error):(n&&(Ce(t,!0),Ee(t,r)),a.loadId=o.load(()=>{Ce(t,!1),t.destroyed||(Re(t,e,i,o,a,s)&&(o.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Le(t,r)),a.loadId=void 0},e=>{Ce(t,!1),Te(t,r,e),a.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{o.ready||(o.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):o.isPlacehold=!0)),a},checkImage:function(t,i,s,n){const{scaleX:a,scaleY:r}=t.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:o}=i,{data:l}=s;if(!l||s.patternId===a+"-"+r+"-"+o&&!H.running)return!1;if(n)if(l.repeat)n=!1;else if(!(s.changeful||"miniapp"===e.name&&B.isResizing(t)||H.running)){let{width:t,height:i}=l;t*=a*o,i*=r*o,l.scaleX&&(t*=l.scaleX,i*=l.scaleY),n=t*i>e.image.maxCacheSize}return n?(t.__.__isFastShadow&&(i.fillStyle=s.style||"#000",i.fill()),function(t,e,i,s){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);s.opacity&&(e.opacity*=s.opacity);s.transform&&e.transform(s.transform);e.drawImage(i.image.getFull(s.filters),0,0,s.width,s.height),e.restore()}(t,i,s,l),!0):(!s.style||s.sync||H.running?Ue(t,s,o):s.patternTask||(s.patternTask=b.patternTasker.add(()=>ct(this,void 0,void 0,function*(){s.patternTask=null,i.bounds.hit(t.__nowWorld)&&Ue(t,s,o),t.forceUpdate("surface")}),300)),!1)},createPattern:Ue,recycleImage:function(t,e){const i=e["_"+t];if(w(i)){let s,n,a,r,o;for(let l=0,d=i.length;l<d;l++)s=i[l],n=s.image,o=n&&n.url,o&&(a||(a={}),a[o]=!0,b.recycle(n),n.loading&&(r||(r=e.__input&&e.__input[t]||[],w(r)||(r=[r])),n.unload(i[l].loadId,!r.some(t=>t.url===o))));return a}return null},createData:ve,getPatternData:xe,fillOrFitMode:ce,clipMode:ue,repeatMode:fe},{toPoint:Xe}=F,{hasTransparent:ze}=q,Ne={},je={};function qe(t,e,i,s){if(i){let n,a,r,o;for(let t=0,l=i.length;t<l;t++)n=i[t],A(n)?(r=t/(l-1),a=q.string(n,s)):(r=n.offset,a=q.string(n.color,s)),e.addColorStop(r,a),!o&&ze(a)&&(o=!0);o&&(t.isTransparent=!0)}}const{getAngle:Ge,getDistance:He}=M,{get:Ve,rotateOfOuter:Qe,scaleOfOuter:Je}=O,{toPoint:Ze}=F,$e={},Ke={};function ti(t,e,i,s,n){let a;const{width:r,height:o}=t;if(r!==o||s){const t=Ge(e,i);a=Ve(),n?(Je(a,e,r/o*(s||1),1),Qe(a,e,t+90)):(Je(a,e,1,r/o*(s||1)),Qe(a,e,t))}return a}const{getDistance:ei}=M,{toPoint:ii}=F,si={},ni={};const ai={linearGradient:function(t,i){let{from:s,to:n,type:a,opacity:r}=t;Xe(s||"top",i,Ne),Xe(n||"bottom",i,je);const o=e.canvas.createLinearGradient(Ne.x,Ne.y,je.x,je.y),l={type:a,style:o};return qe(l,o,t.stops,r),l},radialGradient:function(t,i){let{from:s,to:n,type:a,opacity:r,stretch:o}=t;Ze(s||"center",i,$e),Ze(n||"bottom",i,Ke);const l=e.canvas.createRadialGradient($e.x,$e.y,0,$e.x,$e.y,He($e,Ke)),d={type:a,style:l};qe(d,l,t.stops,r);const h=ti(i,$e,Ke,o,!0);return h&&(d.transform=h),d},conicGradient:function(t,i){let{from:s,to:n,type:a,opacity:r,stretch:o}=t;ii(s||"center",i,si),ii(n||"bottom",i,ni);const l=e.conicGradientSupport?e.canvas.createConicGradient(0,si.x,si.y):e.canvas.createRadialGradient(si.x,si.y,0,si.x,si.y,ei(si,ni)),d={type:a,style:l};qe(d,l,t.stops,r);const h=ti(i,si,ni,o||1,e.conicGradientRotate90);return h&&(d.transform=h),d},getTransform:ti},{copy:ri,move:oi,toOffsetOutBounds:li}=S,{max:di}=Math,hi={},ci=new L,ui={};function fi(t,e){let i,s,n,a,r=0,o=0,l=0,d=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,n=t.spread||0,a=1.5*(t.blur||0),r=di(r,n+a-s),o=di(o,n+a+i),l=di(l,n+a+s),d=di(d,n+a-i)}),r===o&&o===l&&l===d?r:[r,o,l,d]}function gi(t,e,i,s,n,a,r){if(s.spread){const i=1+2*s.spread/t.__layout.strokeBounds.width*a*(r?-1:1);return ci.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},i),ci}}function pi(t,i,s){const{shapeBounds:n}=s;let a,r;e.fullImageShadow?(ri(hi,t.bounds),oi(hi,i.x-n.x,i.y-n.y),a=t.bounds,r=hi):(a=n,r=i),t.copyWorld(s.canvas,a,r)}const{toOffsetOutBounds:_i}=S,wi={};const yi=fi;const mi={shadow:function(t,e,i){let s,n;const{__nowWorld:a}=t,{shadow:r}=t.__,{worldCanvas:o,bounds:l,renderBounds:d,shapeBounds:h,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),p=r.length-1;li(l,ui,d),r.forEach((r,_)=>{let w=1;if(r.scaleFixed){const t=Math.abs(a.scaleX);t>1&&(w=1/t)}g.setWorldShadow(ui.offsetX+r.x*c*w,ui.offsetY+r.y*u*w,r.blur*c*w,q.string(r.color)),n=gi(t,g,i,r,ui,w),n&&g.setTransform(n),pi(g,ui,i),n&&g.resetTransform(),s=d,r.box&&(g.restore(),g.save(),o&&(g.copyWorld(g,d,a,"copy"),s=a),o?g.copyWorld(o,a,a,"destination-out"):g.copyWorld(i.canvas,h,l,"destination-out")),f.copyCanvasByWorld(t,e,g,s,r.blendMode),p&&_<p&&g.clearWorld(s)}),g.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:a}=t,{innerShadow:r}=t.__,{worldCanvas:o,bounds:l,renderBounds:d,shapeBounds:h,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),p=r.length-1;_i(l,wi,d),r.forEach((r,_)=>{let w=1;if(r.scaleFixed){const t=Math.abs(a.scaleX);t>1&&(w=1/t)}g.save(),g.setWorldShadow(wi.offsetX+r.x*c*w,wi.offsetY+r.y*u*w,r.blur*c*w),n=gi(t,g,0,r,wi,w,!0),n&&g.setTransform(n),pi(g,wi,i),g.restore(),o?(g.copyWorld(g,d,a,"copy"),g.copyWorld(o,a,a,"source-out"),s=a):(g.copyWorld(i.canvas,h,l,"source-out"),s=d),g.fillWorld(s,q.string(r.color),"source-in"),f.copyCanvasByWorld(t,e,g,s,r.blendMode),p&&_<p&&g.clearWorld(s)}),g.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:fi,getShadowTransform:gi,isTransformShadow(t){},getInnerShadowSpread:yi},{excludeRenderBounds:vi}=p;let xi;function bi(t,e,i,s,n,a,r,o){switch(e){case"grayscale":xi||(xi=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,a){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),a&&s.recycle(r);Si(t,e,i,1,n,a)}(t,i,s,n,r,o);break;case"opacity-path":Si(t,i,s,a,r,o);break;case"path":o&&i.restore()}}function Bi(t){return t.getSameCanvas(!1,!0)}function Si(t,e,i,s,n,a){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,n),a?i.recycle(r):i.clearWorld(r)}V.prototype.__renderMask=function(t,e){let i,s,n,a,r,o;const{children:l}=this;for(let d=0,h=l.length;d<h;d++){if(i=l[d],o=i.__.mask,o){r&&(bi(this,r,t,n,s,a,void 0,!0),s=n=null),"clipping"!==o&&"clipping-path"!==o||vi(i,e)||i.__render(t,e),a=i.__.opacity,xi=!1,"path"===o||"clipping-path"===o?(a<1?(r="opacity-path",n||(n=Bi(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===o?"grayscale":"alpha",s||(s=Bi(t)),n||(n=Bi(t)),i.__render(s,e));continue}const h=1===a&&i.__.__blendMode;h&&bi(this,r,t,n,s,a,void 0,!1),vi(i,e)||i.__render(n||t,e),h&&bi(this,r,t,n,s,a,h,!1)}bi(this,r,t,n,s,a,void 0,!0)};const ki=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Ri=ki+"_#~&*+\\=|≮≯≈≠=…",Ei=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 Li(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Ti=Li("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Ai=Li("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Ci=Li(ki),Oi=Li(Ri),Pi=Li("- —/~|┆·");var Wi;!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"}(Wi||(Wi={}));const{Letter:Mi,Single:Di,Before:Fi,After:Ii,Symbol:Ui,Break:Yi}=Wi;function Xi(t){return Ti[t]?Mi:Pi[t]?Yi:Ai[t]?Fi:Ci[t]?Ii:Oi[t]?Ui:Ei.test(t)?Di:Mi}const zi={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let a=n-1;a>-1&&(i=e[a].data[0]," "===i.char);a--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function Ni(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:ji}=zi,{Letter:qi,Single:Gi,Before:Hi,After:Vi,Symbol:Qi,Break:Ji}=Wi;let Zi,$i,Ki,ts,es,is,ss,ns,as,rs,os,ls,ds,hs,cs,us,fs,gs=[];function ps(t,e){as&&!ns&&(ns=as),Zi.data.push({char:t,width:e}),Ki+=e}function _s(){ts+=Ki,Zi.width=Ki,$i.words.push(Zi),Zi={data:[]},Ki=0}function ws(){hs&&(cs.paraNumber++,$i.paraStart=!0,hs=!1),as&&($i.startCharSize=ns,$i.endCharSize=as,ns=0),$i.width=ts,us.width?ji($i):fs&&ys(),gs.push($i),$i={words:[]},ts=0}function ys(){ts>(cs.maxWidth||0)&&(cs.maxWidth=ts)}const{top:ms,right:vs,bottom:xs,left:bs}=I;function Bs(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const Ss={getDrawData:function(t,i){A(t)||(t=String(t));let s=0,n=0,a=i.__getInput("width")||0,r=i.__getInput("height")||0;const{textDecoration:o,__font:l,__padding:d}=i;d&&(a?(s=d[bs],a-=d[vs]+d[bs]):i.autoSizeAlign||(s=d[bs]),r?(n=d[ms],r-=d[ms]+d[xs]):i.autoSizeAlign||(n=d[ms]));const h={bounds:{x:s,y:n,width:a,height:r},rows:[],paraNumber:0,font:e.canvas.font=l};return function(t,i,s){cs=t,gs=t.rows,us=t.bounds,fs=!us.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:a,textCase:r}=s,{canvas:o}=e,{width:l,height:d}=us;if(l||d||n||"none"!==r){const t="none"!==s.textWrap,e="break"===s.textWrap;hs=!0,os=null,ns=ss=as=Ki=ts=0,Zi={data:[]},$i={words:[]},n&&(i=[...i]);for(let s=0,d=i.length;s<d;s++)is=i[s],"\n"===is?(Ki&&_s(),$i.paraEnd=!0,ws(),hs=!0):(rs=Xi(is),rs===qi&&"none"!==r&&(is=Ni(is,r,!Ki)),ss=o.measureText(is).width,n&&(n<0&&(as=ss),ss+=n),ls=rs===Gi&&(os===Gi||os===qi)||os===Gi&&rs!==Vi,ds=!(rs!==Hi&&rs!==Gi||os!==Qi&&os!==Vi),es=hs&&a?l-a:l,t&&l&&ts+Ki+ss>es&&(e?(Ki&&_s(),ts&&ws()):(ds||(ds=rs===qi&&os==Vi),ls||ds||rs===Ji||rs===Hi||rs===Gi||Ki+ss>es?(Ki&&_s(),ts&&ws()):ts&&ws()))," "===is&&!0!==hs&&ts+Ki===0||(rs===Ji?(" "===is&&Ki&&_s(),ps(is,ss),_s()):ls||ds?(Ki&&_s(),ps(is,ss)):ps(is,ss)),os=rs);Ki&&_s(),ts&&ws(),gs.length>0&&(gs[gs.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{cs.paraNumber++,ts=o.measureText(t).width,gs.push({x:a||0,text:t,width:ts,paraStart:!0}),fs&&ys()})}(h,t,i),d&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Bs(e,"x",t[bs]);break;case"right":Bs(e,"x",-t[vs])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Bs(e,"y",t[ms]);break;case"bottom":Bs(e,"y",-t[xs])}}(d,h,i,a,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:a,__baseLine:r,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:h,paraSpacing:c,autoSizeAlign:u}=e;let{x:f,y:g,width:p,height:_}=s,w=a*n+(c?c*(t.paraNumber-1):0),y=r;if(l&&w>_)w=Math.max(_,a),n>1&&(t.overflow=n);else if(_||u)switch(h){case"middle":g+=(_-w)/2;break;case"bottom":g+=_-w}y+=g;let m,v,x,b=p||u?p:t.maxWidth;for(let r=0,h=n;r<h;r++){if(m=i[r],m.x=f,m.width<p||m.width>p&&!l)switch(d){case"center":m.x+=(b-m.width)/2;break;case"right":m.x+=b-m.width}m.paraStart&&c&&r>0&&(y+=c),m.y=y,y+=a,t.overflow>r&&y>w&&(m.isOverflow=!0,t.overflow=r+1),v=m.x,x=m.width,o<0&&(m.width<0?(x=-m.width+e.fontSize+o,v-=x,x+=e.fontSize):x-=o),v<s.x&&(s.x=v),x>s.width&&(s.width=x),l&&p&&p<x&&(m.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=g,s.height=w}(h,i),function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:a,letterSpacing:r}=e;let o,l,d,h,c,u;s.forEach(t=>{t.words&&(d=a&&t.paraStart?a:0,u=t.words.length,l=i&&("justify"===n||"both"===n)&&u>1?(i-t.width-d)/(u-1):0,h=r||t.isOverflow?0:l>.01?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===h?(t.x+=d,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=d,o=t.x,t.data=[],t.words.forEach((e,i)=>{1===h?(c={char:"",x:o},o=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,o,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):o=function(t,e,i,s){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width}),e}(e.data,o,t.data,t.isOverflow),!l||t.paraEnd&&"both"!==n||i===u-1||(o+=l,t.width+=l)})),t.words=null)})}(h,i,a),h.overflow&&function(t,i,s,n){if(!n)return;const{rows:a,overflow:r}=t;let{textOverflow:o}=i;if(a.splice(r),o&&"show"!==o){let t,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?e.canvas.measureText(o).width:0,h=s+n-d;("none"===i.textWrap?a:[a[r-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],l=t.x+t.width,!(s===i&&l<h));s--){if(l<h&&" "!==t.char||!s){e.data.splice(s+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)}})}}(h,i,s,a),"none"!==o&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:a}=e;switch(t.decorationHeight=n/11,R(a)?(i=a.type,a.color&&(t.decorationColor=q.string(a.color)),a.offset&&(s=Math.min(.3*n,Math.max(a.offset,.15*-n)))):i=a,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(h,i),h}};const ks={string:function(t,e){const i=U(e)&&e<1;if(A(t)){if(!i||!q.object)return t;t=q.object(t)}let s=T(t.a)?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};Object.assign(Q,Ss),Object.assign(q,ks),Object.assign(j,te),Object.assign(N,Ye),Object.assign(G,ai),Object.assign(J,mi);const{setPoint:Rs,addPoint:Es,toBounds:Ls}=Z;const Ts={syncExport(t,e,i){let s;H.running=!0;try{const n=K.fileType(e),a=e.includes(".");i=K.getExportOptions(i);const{toURL:r}=tt,{download:o}=tt.origin;if("json"===n)a&&o(r(JSON.stringify(t.toJSON(i.json)),"text"),e),s={data:!!a||t.toJSON(i.json)};else if("svg"===n)a&&o(r(t.toSVG(),"svg"),e),s={data:!!a||t.toSVG()};else{let n,a,r=1,o=1;const{worldTransform:l,isLeafer:d,leafer:h,isFrame:c}=t,{slice:u,clip:f,trim:g,screenshot:p,padding:_,onCanvas:w}=i,y=et(i.smooth)?!h||h.config.smooth:i.smooth,m=i.contextSettings||(h?h.config.contextSettings:void 0),v=d&&p&&et(i.fill)?t.fill:i.fill,x=K.isOpaqueImage(e)||v,b=new it;if(p)n=!0===p?d?h.canvas.bounds:t.worldRenderBounds:p;else{let e=i.relative||(d?"inner":"local");switch(r=l.scaleX,o=l.scaleY,e){case"inner":b.set(l);break;case"local":b.set(l).divide(t.localTransform),r/=t.scaleX,o/=t.scaleY;break;case"world":r=1,o=1;break;case"page":e=h||t;default:b.set(l).divide(t.getTransform(e));const i=e.worldTransform;r/=r/i.scaleX,o/=o/i.scaleY}n=t.getBounds("render",e)}const B={scaleX:1,scaleY:1};st.getScaleData(i.scale,i.size,n,B);let S=i.pixelRatio||1,{x:k,y:R,width:E,height:L}=new $(n).scale(B.scaleX,B.scaleY);f&&(k+=f.x,R+=f.y,E=f.width,L=f.height);const T={exporting:!0,matrix:b.scale(1/B.scaleX,1/B.scaleY).invert().translate(-k,-R).withScale(1/r*B.scaleX,1/o*B.scaleY)};let A,C=nt.canvas({width:Math.floor(E),height:Math.floor(L),pixelRatio:S,smooth:y,contextSettings:m});u&&(A=t,A.__worldOpacity=0,t=h||t,T.bounds=C.bounds),C.save();const O=c&&!et(v),P=t.get("fill");if(O&&(t.fill=""),tt.render(t,C,T),O&&(t.fill=P),C.restore(),A&&A.__updateWorldOpacity(),g){a=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let n,a,r,o=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(n=o%e,a=(o-n)/e,r?Es(r,n,a):Rs(r={},n,a)),o++;const l=new $;return r&&(Ls(r,l),l.scale(1/t.pixelRatio).ceil()),l}(C);const t=C,{width:e,height:i}=a,s={x:0,y:0,width:e,height:i,pixelRatio:S};C=nt.canvas(s),C.copyWorld(t,a,s),t.destroy()}if(_){const[t,e,i,s]=st.fourNumber(_),n=C,{width:a,height:r}=n;C=nt.canvas({width:a+s+e,height:r+t+i,pixelRatio:S}),C.copyWorld(n,n.bounds,{x:s,y:t,width:a,height:r}),n.destroy()}x&&C.fillWorld(C.bounds,v||"#FFFFFF","destination-over"),w&&w(C);s={data:"canvas"===e?C:C.export(e,i),width:C.pixelWidth,height:C.pixelHeight,renderBounds:n,trimBounds:a};const W=h&&h.app;W&&W.canvasManager&&W.canvasManager.clearRecycled()}}catch(t){s={data:"",error:t}}return H.running=!1,s},export(t,e,i){return H.running=!0,function(t){As||(As=new at);return new Promise(e=>{As.add(()=>ct(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(s=>new Promise(n=>{const a=()=>ct(this,void 0,void 0,function*(){if(!rt.isComplete)return tt.requestRender(a);const r=H.syncExport(t,e,i);r.data instanceof Promise&&(r.data=yield r.data),s(r),n()});t.updateLayout(),Cs(t);const{leafer:r}=t;r?r.waitViewCompleted(a):a()}))}};let As;function Cs(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>Cs(t))}const Os=ot.prototype,Ps=lt.get("@leafer-in/export");Os.export=function(t,e){const{quality:i,blob:s}=K.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},Os.toBlob=function(t,e){return new Promise(i=>{tt.origin.canvasToBolb(this.view,t,e).then(t=>{i(t)}).catch(t=>{Ps.error(t),i(null)})})},Os.toDataURL=function(t,e){return tt.origin.canvasToDataURL(this.view,t,e)},Os.saveAs=function(t,e){return new Promise(i=>{tt.origin.canvasSaveAs(this.view,t,e).then(()=>{i(!0)}).catch(t=>{Ps.error(t),i(!1)})})},dt.add("export"),Object.assign(H,Ts),ht.prototype.export=function(t,e){return H.export(this,t,e)},ht.prototype.syncExport=function(t,e){return H.syncExport(this,t,e)},Object.assign(n,{interaction:(t,e,i,s)=>new z(t,e,i,s),hitCanvas:(t,e)=>new ut(t,e),hitCanvasManager:()=>new X});export{Et as Layouter,ut as LeaferCanvas,Ct as Picker,Tt as Renderer,Ot as Selector,_t as Watcher,pt as useCanvas};
|
|
1
|
+
import{LeaferCanvasBase as t,Platform as e,canvasPatch as i,FileHelper as s,Creator as n,LeaferImage as a,defineKey as r,LeafList as o,DataHelper as l,RenderEvent as d,ChildEvent as h,WatchEvent as c,PropertyEvent as u,LeafHelper as f,BranchHelper as g,LeafBoundsHelper as p,Bounds as _,isArray as w,Debug as y,LeafLevelList as m,LayoutEvent as v,Run as x,ImageManager as b,ResizeEvent as B,BoundsHelper as S,Plugin as k,isObject as R,FourNumberHelper as E,Matrix as L,isUndefined as T,isString as A,getMatrixData as C,MatrixHelper as O,MathHelper as P,AlignHelper as W,PointHelper as M,ImageEvent as D,AroundHelper as F,Direction4 as I,isNumber as U}from"@leafer/core";export*from"@leafer/core";export{LeaferImage}from"@leafer/core";import{writeFileSync as Y}from"fs";import{HitCanvasManager as X,InteractionBase as z}from"@leafer-ui/core";export*from"@leafer-ui/core";import{PaintImage as N,Paint as j,ColorConvert as q,PaintGradient as G,Export as H,Effect as V,Group as Q,TextConvert as J,TwoPointBoundsHelper as Z,Bounds as $,FileHelper as K,Platform as tt,isUndefined as et,Matrix as it,MathHelper as st,Creator as nt,TaskProcessor as at,Resource as rt,LeaferCanvasBase as ot,Debug as lt,Plugin as dt,UI as ht}from"@leafer-ui/draw";function ct(t,e,i,s){return new(i||(i=Promise))(function(n,a){function r(t){try{l(s.next(t))}catch(t){a(t)}}function o(t){try{l(s.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(r,o)}l((s=s.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;class ut extends t{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config),e.roundRectPatch&&(this.context.__proto__.roundRect=null,i(this.context.__proto__))}__createView(){this.view=e.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}const{mineType:ft,fileType:gt}=s;function pt(t,i){if(e.canvasType=t,!e.origin){if("skia"===t){const{Canvas:t,loadImage:s}=i;e.origin={createCanvas:(e,i,s)=>new t(e,i,s),canvasToDataURL:(t,e,i)=>t.toDataURLSync(e,{quality:i}),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(t,e,i)=>t.saveAs(e,{quality:i}),download(t,e){},loadImage:t=>s(e.image.getRealURL(t))},e.roundRectPatch=!0}else if("napi"===t){const{Canvas:t,loadImage:s}=i;e.origin={createCanvas:(e,i,s)=>new t(e,i,s),canvasToDataURL:(t,e,i)=>t.toDataURL(ft(e),i),canvasToBolb:(t,e,i)=>ct(this,void 0,void 0,function*(){return t.toBuffer(ft(e),i)}),canvasSaveAs:(t,e,i)=>ct(this,void 0,void 0,function*(){return Y(e,t.toBuffer(ft(gt(e)),i))}),download(t,e){},loadImage:t=>s(e.image.getRealURL(t))}}e.ellipseToCurve=!0,e.event={stopDefault(t){},stopNow(t){},stop(t){}},e.canvas=n.canvas()}}Object.assign(n,{canvas:(t,e)=>new ut(t,e),image:t=>new a(t)}),e.name="node",e.backgrounder=!0,e.requestRender=function(t){setTimeout(t,16)},r(e,"devicePixelRatio",{get:()=>1}),e.conicGradientSupport=!0;class _t{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new o;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new o,this.target=t,e&&(this.config=l.default(e,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(d.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===h.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,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new c(c.DATA,{updatedList:this.updatedList})),this.__updatedList=new o,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[u.CHANGE,this.__onAttrChange,this],[[h.ADD,h.REMOVE],this.__onChildEvent,this],[c.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:wt,updateBounds:yt,updateChange:mt}=f,{pushAllChildBranch:vt,pushAllParent:xt}=g;const{worldBounds:bt}=p;class Bt{constructor(t){this.updatedBounds=new _,this.beforeBounds=new _,this.afterBounds=new _,w(t)&&(t=new o(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,bt)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,bt),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:St,updateAllChange:kt}=f,Rt=y.get("Layouter");class Et{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new m,this.target=t,e&&(this.config=l.default(e,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(v.START),this.layoutOnce(),t.emitEvent(new v(v.END,this.layoutedBlocks,this.times))}catch(t){Rt.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Rt.warn("layouting"):this.times>3?Rt.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(c.REQUEST),this.totalTimes>1?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 e=x.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:a,AFTER:r}=v,o=this.getBlocks(s);o.forEach(t=>t.setBefore()),i.emitEvent(new v(n,o,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(wt(t,!0),e.add(t),t.isBranch&&vt(t,e),xt(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),xt(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||yt(s[t])}yt(i)}})}(this.__levelList),function(t){t.list.forEach(mt)}(s),this.extraBlock&&o.push(this.extraBlock),o.forEach(t=>t.setAfter()),i.emitEvent(new v(a,o,this.times)),i.emitEvent(new v(r,o,this.times)),this.addBlocks(o),this.__levelList.reset(),this.__updatedList=null,x.end(e)}fullLayout(){const t=x.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=v,a=this.getBlocks(new o(e));e.emitEvent(new v(i,a,this.times)),Et.fullLayout(e),a.forEach(t=>{t.setAfter()}),e.emitEvent(new v(s,a,this.times)),e.emitEvent(new v(n,a,this.times)),this.addBlocks(a),x.end(t)}static fullLayout(t){St(t,!0),t.isBranch?g.updateBounds(t):f.updateBounds(t),kt(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Bt([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Bt(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_([[v.REQUEST,this.layout,this],[v.AGAIN,this.layoutAgain,this],[c.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Lt=y.get("Renderer");class Tt{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=l.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(v.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(d.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(d.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(d.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new _,Lt.log(e.innerName,"---\x3e");try{this.emitRender(d.START),this.renderOnce(t),this.emitRender(d.END,this.totalBounds),b.clearRecycled()}catch(t){this.rendering=!1,Lt.error(t)}Lt.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Lt.warn("rendering");if(this.times>3)return Lt.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new _,this.renderOptions={},t)this.emitRender(d.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(d.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(d.RENDER,this.renderBounds,this.renderOptions),this.emitRender(d.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 e=x.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new _(s);i.save(),s.spread(Tt.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),x.end(e)}fullRender(){const t=x.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),x.end(t)}__render(t,i){const{canvas:s}=this,n=t.includes(this.target.__world),a=n?{includes:n}:{bounds:t,includes:n};this.needFill&&s.fillWorld(t,this.config.fill),y.showRepaint&&y.drawRepaint(s,t),e.render(this.target,s,a),this.renderBounds=i=i||t,this.renderOptions=a,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),s.updateRender(i)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new _;e.setList(t),t.length=0,t.push(e)}}__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 i=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:s}=this.config;if(s&&t>s)return e.requestRender(i);const{frames:n}=this;n.length>30&&n.shift(),n.push(t),this.FPS=Math.round(n.reduce((t,e)=>t+e,0)/n.length),this.requestTime=0,this.checkRender()};e.requestRender(i)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new _(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new _(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||Lt.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new d(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[d.REQUEST,this.update,this],[v.END,this.__onLayoutEnd,this],[d.AGAIN,this.renderAgain,this],[B.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Tt.clipSpread=10;const{hitRadiusPoint:At}=S;class Ct{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,a=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new o(i.findList),i.findList||this.hitBranch(a.isBranchLeaf?{children:[a]}:a);const{list:r}=this.findList,l=this.getBestMatchLeaf(r,i.bottomList,n,!!i.findList),d=n?this.getPath(l):this.getHitablePath(l);return this.clear(),s?{path:d,target:l,throughPath:r.length?this.getThroughPath(r):d}:{path:d,target:l}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const n=this.findList=new o;if(t.length){let e;const{x:s,y:a}=this.point,r={x:s,y:a,radiusX:0,radiusY:0};for(let s=0,a=t.length;s<a;s++)if(e=t[s],(i||f.worldHittable(e))&&(this.hitChild(e,r),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&f.hasParent(t,e))){n.reset();break}return n.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),n.length)return n.list[0];return s?null:i?t[0]:t.find(t=>f.worldHittable(t))}getPath(t){const e=new o,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new o;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new o,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,a;for(let t=0,r=i.length;t<r;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(a=s.list[t],!n||!n.has(a));t++)e.add(a)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:n}=this;for(let a=t.length-1;a>-1;a--)i=t[a],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||At(i.__world,n),i.isBranch?(s||i.__ignoreHitWorld)&&(i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)):s&&this.hitChild(i,n))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:a}=s;for(let s=0,r=a.length;s<r;s++)if(i=a[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Ot{constructor(t,e){this.config={},e&&(this.config=l.default(e,this.config)),this.picker=new Ct(this.target=t,this),this.finder=n.finder&&n.finder()}getByPoint(t,i,s){const{target:n,picker:a}=this;return e.backgrounder&&n&&n.updateLayout(),a.getByPoint(t,i,s)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):k.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Pt(t,e){const i=t.__,{rows:s,decorationY:n}=i.__textDrawData;let a;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)a=s[t],a.text?e.fillText(a.text,a.x,a.y):a.data&&a.data.forEach(t=>{e.fillText(t.char,t.x,a.y)});if(n){const{decorationColor:t,decorationHeight:a}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach(t=>n.forEach(i=>e.fillRect(t.x,t.y+i,t.width,a)))}}function Wt(t,e){t.__.__font?Pt(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Mt(t,e,i){switch(e.__.strokeAlign){case"center":Dt(t,1,e,i);break;case"inside":Ft(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?Dt(t,2,e,i):Ft(t,"outside",e,i)}}function Dt(t,e,i,s){const n=i.__;R(t)?Ut(t,e,!0,i,s):(s.setStroke(t,n.__strokeWidth*e,n),It(i,s))}function Ft(t,e,i,s){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,Dt(t,2,i,n),n.blendMode="outside"===e?"destination-out":"destination-in",Pt(i,n),n.blendMode="normal",f.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}function It(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:a}=s;for(let t=0,s=n.length;t<s;t++)i=n[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach(t=>{e.strokeText(t.char,t.x,i.y)});if(a){const{decorationHeight:t}=s;n.forEach(i=>a.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}}function Ut(t,e,i,s,n){let a;const r=s.__,{__hasMultiStrokeStyle:o}=r;o||n.setStroke(void 0,r.__strokeWidth*e,r);for(let l=0,d=t.length;l<d;l++)if(a=t[l],(!a.image||!N.checkImage(s,n,a,!1))&&a.style){if(o){const{strokeStyle:t}=a;t?n.setStroke(a.style,r.__getRealStrokeWidth(t)*e,r,t):n.setStroke(a.style,r.__strokeWidth*e,r)}else n.strokeStyle=a.style;a.blendMode?(n.saveBlendMode(a.blendMode),i?It(s,n):n.stroke(),n.restoreBlendMode()):i?It(s,n):n.stroke()}}function Yt(t,e,i){const s=e.__;if(s.__strokeWidth)if(s.__font)Mt(t,e,i);else switch(s.strokeAlign){case"center":Xt(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),Xt(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const s=e.__;if(s.__fillAfterStroke)Xt(t,2,e,i);else{const{renderBounds:n}=e.__layout,a=i.getSameCanvas(!0,!0);e.__drawRenderPath(a),Xt(t,2,e,a),a.clipUI(s),a.clearWorld(n),f.copyCanvasByWorld(e,i,a),a.recycle(e.__nowWorld)}}(t,e,i)}}function Xt(t,e,i,s){const n=i.__;R(t)?Ut(t,e,!1,i,s):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&j.strokeArrow(t,i,s)}Object.assign(n,{watcher:(t,e)=>new _t(t,e),layouter:(t,e)=>new Et(t,e),renderer:(t,e,i)=>new Tt(t,e,i),selector:(t,e)=>new Ot(t,e)}),e.layout=Et.fullLayout,e.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new o,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const{getSpread:zt,copyAndSpread:Nt,toOuterOf:jt,getOuterOf:qt,getByMove:Gt,move:Ht,getIntersectData:Vt}=S,Qt={};let Jt;const{stintSet:Zt}=l,{hasTransparent:$t}=q;function Kt(t,e,i){if(!R(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout;switch(e.type){case"image":s=N.image(i,t,e,n,!Jt||!Jt[e.url]);break;case"linear":s=G.linearGradient(e,n);break;case"radial":s=G.radialGradient(e,n);break;case"angular":s=G.conicGradient(e,n);break;case"solid":const{type:a,color:r,opacity:o}=e;s={type:a,style:q.string(r,o)};break;default:T(e.r)||(s={type:"solid",style:q.string(e)})}if(s){if(A(s.style)&&$t(s.style)&&(s.isTransparent=!0),e.style){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}e.editing&&(s.editing=e.editing),e.blendMode&&(s.blendMode=e.blendMode)}return s}const te={compute:function(t,e){const i=e.__,s=[];let n,a,r,o=i.__input[t];w(o)||(o=[o]),Jt=N.recycleImage(t,i);for(let i,n=0,a=o.length;n<a;n++)(i=Kt(t,o[n],e))&&(s.push(i),i.strokeStyle&&(r||(r=1),i.strokeStyle.strokeWidth&&(r=Math.max(r,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length&&s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),a=!0),"fill"===t?(Zt(i,"__isAlphaPixelFill",n),Zt(i,"__isTransparentFill",a)):(Zt(i,"__isAlphaPixelStroke",n),Zt(i,"__isTransparentStroke",a),Zt(i,"__hasMultiStrokeStyle",r))},fill:function(t,e,i){i.fillStyle=t,Wt(e,i)},fills:function(t,e,i){let s;for(let n=0,a=t.length;n<a;n++){if(s=t[n],s.image){if(N.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!n&&s.image.isPlacehold&&e.drawImagePlaceholder(i,s.image);continue}}if(i.fillStyle=s.style,s.transform||s.scaleFixed){if(i.save(),s.transform&&i.transform(s.transform),s.scaleFixed){const{scaleX:t,scaleY:n}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&n>1)&&i.scale(1/t,1/n)}s.blendMode&&(i.blendMode=s.blendMode),Wt(e,i),i.restore()}else s.blendMode?(i.saveBlendMode(s.blendMode),Wt(e,i),i.restoreBlendMode()):Wt(e,i)}},fillPathOrText:Wt,fillText:Pt,stroke:Yt,strokes:function(t,e,i){Yt(t,e,i)},strokeText:Mt,drawTextStroke:It,shape:function(t,i,s){const n=i.getSameCanvas(),a=i.bounds,r=t.__nowWorld,o=t.__layout,l=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let d,h,c,u,f,g;jt(o.strokeSpread?(Nt(Qt,o.boxBounds,o.strokeSpread),Qt):o.boxBounds,r,l);let{scaleX:p,scaleY:_}=t.getRenderScaleData(!0);if(a.includes(l))g=n,d=f=l,h=r;else{let n;if(e.fullImageShadow)n=l;else{const t=o.renderShapeSpread?zt(a,E.swapAndScale(o.renderShapeSpread,p,_)):a;n=Vt(t,l)}u=a.getFitMatrix(n);let{a:w,d:y}=u;u.a<1&&(g=i.getSameCanvas(),t.__renderShape(g,s),p*=w,_*=y),f=qt(l,u),d=Gt(f,-u.e,-u.f),h=qt(r,u),Ht(h,-u.e,-u.f);const m=s.matrix;m?(c=new L(u),c.multiply(m),w*=m.scaleX,y*=m.scaleY):c=u,c.withScale(w,y),s=Object.assign(Object.assign({},s),{matrix:c})}return t.__renderShape(n,s),{canvas:n,matrix:c,fitMatrix:u,bounds:d,renderBounds:h,worldCanvas:g,shapeBounds:f,scaleX:p,scaleY:_}}};let ee={},ie=C();const{get:se,set:ne,rotateOfOuter:ae,translate:re,scaleOfOuter:oe,multiplyParent:le,scale:de,rotate:he,skew:ce}=O;function ue(t,e,i,s){const n=se();re(n,e.x,e.y),i&&de(n,i,s),t.transform=n}function fe(t,e,i,s,n,a,r){const o=se();re(o,e.x+i,e.y+s),de(o,n,a),r&&ae(o,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=o}function ge(t,e,i,s,n,a,r,o,l,d){const h=se();_e(h,e,i,s,n,a,r,o),l&&(r||o?(ne(ie),oe(ie,e,l,d),le(h,ie)):oe(h,e,l,d)),t.transform=h}function pe(t,e,i,s,n,a,r,o,l,d,h,c){const u=se();if(c)_e(u,e,n,a,r,o,l,d);else{if(l)if("center"===h)ae(u,{x:i/2,y:s/2},l);else switch(he(u,l),l){case 90:re(u,s,0);break;case 180:re(u,i,s);break;case 270:re(u,0,i)}ee.x=e.x+n,ee.y=e.y+a,re(u,ee.x,ee.y),r&&oe(u,ee,r,o)}t.transform=u}function _e(t,e,i,s,n,a,r,o){r&&he(t,r),o&&ce(t,o.x,o.y),n&&de(t,n,a),re(t,e.x+i,e.y+s)}const{get:we,translate:ye}=O,me=new _,ve={},xe={};function be(t,e,i,s){const{changeful:n,sync:a,scaleFixed:r}=i;n&&(t.changeful=n),a&&(t.sync=a),r&&(t.scaleFixed=r),t.data=Be(i,s,e)}function Be(t,e,i){t.padding&&(e=me.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:s,height:n}=i;const{opacity:a,mode:r,align:o,offset:l,scale:d,size:h,rotation:c,skew:u,clipSize:f,repeat:g,gap:p,filters:_}=t,w=e.width===s&&e.height===n,y={mode:r},m="center"!==o&&(c||0)%180==90;let v,x;switch(S.set(xe,0,0,m?n:s,m?s:n),r&&"cover"!==r&&"fit"!==r?((d||h)&&(P.getScaleData(d,h,i,ve),v=ve.scaleX,x=ve.scaleY),(o||p||g)&&(v&&S.scale(xe,v,x,!0),o&&W.toPoint(o,xe,e,xe,!0,!0))):w&&!c||(v=x=S.getFitScale(e,xe,"fit"!==r),S.put(e,i,o,v,!1,xe),S.scale(xe,v,x,!0)),l&&M.move(xe,l),r){case"stretch":w||(v=e.width/s,x=e.height/n,ue(y,e,v,x));break;case"normal":case"clip":if(xe.x||xe.y||v||f||c||u){let t,i;f&&(t=e.width/f.width,i=e.height/f.height),ge(y,e,xe.x,xe.y,v,x,c,u,t,i),t&&(v=v?v*t:t,x=x?x*i:i)}break;case"repeat":(!w||v||c||u)&&pe(y,e,s,n,xe.x,xe.y,v,x,c,u,o,t.freeTransform),g||(y.repeat="repeat");const i=R(g);(p||i)&&(y.gap=function(t,e,i,s,n){let a,r;R(t)?(a=t.x,r=t.y):a=r=t;return{x:Se(a,i,n.width,e&&e.x),y:Se(r,s,n.height,e&&e.y)}}(p,i&&g,xe.width,xe.height,e));break;default:v&&fe(y,e,xe.x,xe.y,v,x,c)}return y.transform||(e.x||e.y)&&ye(y.transform=we(),e.x,e.y),y.width=s,y.height=n,v&&(y.scaleX=v,y.scaleY=x),a&&(y.opacity=a),_&&(y.filters=_),g&&(y.repeat=A(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),y}function Se(t,e,i,s){const n=A(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let ke,Re=new _;const{isSame:Ee}=S;function Le(t,e,i,s,n,a){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return n.data||be(n,s,i,a),!0}function Te(t,e){Oe(t,D.LOAD,e)}function Ae(t,e){Oe(t,D.LOADED,e)}function Ce(t,e,i){e.error=i,t.forceUpdate("surface"),Oe(t,D.ERROR,e)}function Oe(t,e,i){t.hasEvent(e)&&t.emitEvent(new D(e,i))}function Pe(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:We,scale:Me,copy:De}=O,{floor:Fe,ceil:Ie,max:Ue,abs:Ye}=Math;function Xe(t,i,s){let{scaleX:n,scaleY:a}=t.getRenderScaleData(!0,i.scaleFixed);const r=n+"-"+a+"-"+s;if(i.patternId===r||t.destroyed)return!1;{const{image:o,data:l}=i;let d,h,{width:c,height:u,scaleX:f,scaleY:g,transform:p,repeat:_,gap:w}=l;n*=s,a*=s,f&&(f=Ye(f),g=Ye(g),h=We(),De(h,p),Me(h,1/f,1/g),n*=f,a*=g),c*=n,u*=a;const y=c*u;if(!_&&y>e.image.maxCacheSize)return!1;let m=e.image.maxPatternSize;if(o.isSVG){const t=c/o.width;t>1&&(d=t/Ie(t))}else{const t=o.width*o.height;m>t&&(m=t)}y>m&&(d=Math.sqrt(y/m)),d&&(n/=d,a/=d,c/=d,u/=d),f&&(n/=f,a/=g);const v=w&&w.x*n,x=w&&w.y*a;if(p||1!==n||1!==a){const t=c+(v||0),e=u+(x||0);n/=t/Ue(Fe(t),1),a/=e/Ue(Fe(e),1),h||(h=We(),p&&De(h,p)),Me(h,1/n,1/a)}const b=o.getCanvas(c,u,l.opacity,l.filters,v,x,t.leafer&&t.leafer.config.smooth),B=o.getPattern(b,_||e.origin.noRepeat||"no-repeat",h,i);return i.style=B,i.patternId=r,!0}}const ze={image:function(t,e,i,s,n){let a,r;const o=b.get(i);return ke&&i===ke.paint&&Ee(s,ke.boxBounds)?a=ke.leafPaint:(a={type:i.type,image:o},o.hasAlphaPixel&&(a.isTransparent=!0),ke=o.use>1?{leafPaint:a,paint:i,boxBounds:Re.set(s)}:null),(n||o.loading)&&(r={image:o,attrName:e,attrValue:i}),o.ready?(Le(t,e,i,o,a,s),n&&(Te(t,r),Ae(t,r))):o.error?n&&Ce(t,r,o.error):(n&&(Pe(t,!0),Te(t,r)),a.loadId=o.load(()=>{Pe(t,!1),t.destroyed||(Le(t,e,i,o,a,s)&&(o.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Ae(t,r)),a.loadId=void 0},e=>{Pe(t,!1),Ce(t,r,e),a.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{o.ready||(o.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):o.isPlacehold=!0)),a},checkImage:function(t,i,s,n){const{scaleX:a,scaleY:r}=t.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:o}=i,{data:l}=s;if(!l||s.patternId===a+"-"+r+"-"+o&&!H.running)return!1;if(n)if(l.repeat)n=!1;else if(!(s.changeful||"miniapp"===e.name&&B.isResizing(t)||H.running)){let{width:t,height:i}=l;t*=a*o,i*=r*o,l.scaleX&&(t*=l.scaleX,i*=l.scaleY),n=t*i>e.image.maxCacheSize}return n?(t.__.__isFastShadow&&(i.fillStyle=s.style||"#000",i.fill()),function(t,e,i,s){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);s.opacity&&(e.opacity*=s.opacity);s.transform&&e.transform(s.transform);e.drawImage(i.image.getFull(s.filters),0,0,s.width,s.height),e.restore()}(t,i,s,l),!0):(!s.style||s.sync||H.running?Xe(t,s,o):s.patternTask||(s.patternTask=b.patternTasker.add(()=>ct(this,void 0,void 0,function*(){s.patternTask=null,i.bounds.hit(t.__nowWorld)&&Xe(t,s,o),t.forceUpdate("surface")}),300)),!1)},createPattern:Xe,recycleImage:function(t,e){const i=e["_"+t];if(w(i)){let s,n,a,r,o;for(let l=0,d=i.length;l<d;l++)s=i[l],n=s.image,o=n&&n.url,o&&(a||(a={}),a[o]=!0,b.recycle(n),n.loading&&(r||(r=e.__input&&e.__input[t]||[],w(r)||(r=[r])),n.unload(i[l].loadId,!r.some(t=>t.url===o))));return a}return null},createData:be,getPatternData:Be,stretchMode:ue,fillOrFitMode:fe,clipMode:ge,repeatMode:pe},{toPoint:Ne}=F,{hasTransparent:je}=q,qe={},Ge={};function He(t,e,i,s){if(i){let n,a,r,o;for(let t=0,l=i.length;t<l;t++)n=i[t],A(n)?(r=t/(l-1),a=q.string(n,s)):(r=n.offset,a=q.string(n.color,s)),e.addColorStop(r,a),!o&&je(a)&&(o=!0);o&&(t.isTransparent=!0)}}const{getAngle:Ve,getDistance:Qe}=M,{get:Je,rotateOfOuter:Ze,scaleOfOuter:$e}=O,{toPoint:Ke}=F,ti={},ei={};function ii(t,e,i,s,n){let a;const{width:r,height:o}=t;if(r!==o||s){const t=Ve(e,i);a=Je(),n?($e(a,e,r/o*(s||1),1),Ze(a,e,t+90)):($e(a,e,1,r/o*(s||1)),Ze(a,e,t))}return a}const{getDistance:si}=M,{toPoint:ni}=F,ai={},ri={};const oi={linearGradient:function(t,i){let{from:s,to:n,type:a,opacity:r}=t;Ne(s||"top",i,qe),Ne(n||"bottom",i,Ge);const o=e.canvas.createLinearGradient(qe.x,qe.y,Ge.x,Ge.y),l={type:a,style:o};return He(l,o,t.stops,r),l},radialGradient:function(t,i){let{from:s,to:n,type:a,opacity:r,stretch:o}=t;Ke(s||"center",i,ti),Ke(n||"bottom",i,ei);const l=e.canvas.createRadialGradient(ti.x,ti.y,0,ti.x,ti.y,Qe(ti,ei)),d={type:a,style:l};He(d,l,t.stops,r);const h=ii(i,ti,ei,o,!0);return h&&(d.transform=h),d},conicGradient:function(t,i){let{from:s,to:n,type:a,opacity:r,stretch:o}=t;ni(s||"center",i,ai),ni(n||"bottom",i,ri);const l=e.conicGradientSupport?e.canvas.createConicGradient(0,ai.x,ai.y):e.canvas.createRadialGradient(ai.x,ai.y,0,ai.x,ai.y,si(ai,ri)),d={type:a,style:l};He(d,l,t.stops,r);const h=ii(i,ai,ri,o||1,e.conicGradientRotate90);return h&&(d.transform=h),d},getTransform:ii},{copy:li,move:di,toOffsetOutBounds:hi}=S,{max:ci,abs:ui}=Math,fi={},gi=new L,pi={};function _i(t,e){let i,s,n,a,r=0,o=0,l=0,d=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,a=1.5*(t.blur||0),n=ui(t.spread||0),r=ci(r,n+a-s),o=ci(o,n+a+i),l=ci(l,n+a+s),d=ci(d,n+a-i)}),r===o&&o===l&&l===d?r:[r,o,l,d]}function wi(t,i,s){const{shapeBounds:n}=s;let a,r;e.fullImageShadow?(li(fi,t.bounds),di(fi,i.x-n.x,i.y-n.y),a=t.bounds,r=fi):(a=n,r=i),t.copyWorld(s.canvas,a,r)}const{toOffsetOutBounds:yi}=S,mi={};const vi=_i;const xi={shadow:function(t,e,i){let s,n;const{__nowWorld:a}=t,{shadow:r}=t.__,{worldCanvas:o,bounds:l,renderBounds:d,shapeBounds:h,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),p=r.length-1;hi(l,pi,d),r.forEach((r,_)=>{let w=1;if(r.scaleFixed){const t=Math.abs(a.scaleX);t>1&&(w=1/t)}g.setWorldShadow(pi.offsetX+(r.x||0)*c*w,pi.offsetY+(r.y||0)*u*w,(r.blur||0)*c*w,q.string(r.color)),n=V.getShadowTransform(t,g,i,r,pi,w),n&&g.setTransform(n),wi(g,pi,i),n&&g.resetTransform(),s=d,r.box&&(g.restore(),g.save(),o&&(g.copyWorld(g,d,a,"copy"),s=a),o?g.copyWorld(o,a,a,"destination-out"):g.copyWorld(i.canvas,h,l,"destination-out")),f.copyCanvasByWorld(t,e,g,s,r.blendMode),p&&_<p&&g.clearWorld(s)}),g.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:a}=t,{innerShadow:r}=t.__,{worldCanvas:o,bounds:l,renderBounds:d,shapeBounds:h,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),p=r.length-1;yi(l,mi,d),r.forEach((r,_)=>{let w=1;if(r.scaleFixed){const t=Math.abs(a.scaleX);t>1&&(w=1/t)}g.save(),g.setWorldShadow(mi.offsetX+(r.x||0)*c*w,mi.offsetY+(r.y||0)*u*w,(r.blur||0)*c*w),n=V.getShadowTransform(t,g,i,r,mi,w,!0),n&&g.setTransform(n),wi(g,mi,i),g.restore(),o?(g.copyWorld(g,d,a,"copy"),g.copyWorld(o,a,a,"source-out"),s=a):(g.copyWorld(i.canvas,h,l,"source-out"),s=d),g.fillWorld(s,q.string(r.color),"source-in"),f.copyCanvasByWorld(t,e,g,s,r.blendMode),p&&_<p&&g.clearWorld(s)}),g.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:_i,getShadowTransform:function(t,e,i,s,n,a,r){if(s.spread){const i=1+2*s.spread/t.__layout.strokeBounds.width*a*(r?-1:1);return gi.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},i),gi}},isTransformShadow(t){},getInnerShadowSpread:vi},{excludeRenderBounds:bi}=p;let Bi;function Si(t,e,i,s,n,a,r,o){switch(e){case"grayscale":Bi||(Bi=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,a){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),a&&s.recycle(r);Ri(t,e,i,1,n,a)}(t,i,s,n,r,o);break;case"opacity-path":Ri(t,i,s,a,r,o);break;case"path":o&&i.restore()}}function ki(t){return t.getSameCanvas(!1,!0)}function Ri(t,e,i,s,n,a){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,n),a?i.recycle(r):i.clearWorld(r)}Q.prototype.__renderMask=function(t,e){let i,s,n,a,r,o;const{children:l}=this;for(let d=0,h=l.length;d<h;d++){if(i=l[d],o=i.__.mask,o){r&&(Si(this,r,t,n,s,a,void 0,!0),s=n=null),"clipping"!==o&&"clipping-path"!==o||bi(i,e)||i.__render(t,e),a=i.__.opacity,Bi=!1,"path"===o||"clipping-path"===o?(a<1?(r="opacity-path",n||(n=ki(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===o?"grayscale":"alpha",s||(s=ki(t)),n||(n=ki(t)),i.__render(s,e));continue}const h=1===a&&i.__.__blendMode;h&&Si(this,r,t,n,s,a,void 0,!1),bi(i,e)||i.__render(n||t,e),h&&Si(this,r,t,n,s,a,h,!1)}Si(this,r,t,n,s,a,void 0,!0)};const Ei=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Li=Ei+"_#~&*+\\=|≮≯≈≠=…",Ti=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 Ai(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Ci=Ai("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Oi=Ai("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Pi=Ai(Ei),Wi=Ai(Li),Mi=Ai("- —/~|┆·");var Di;!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"}(Di||(Di={}));const{Letter:Fi,Single:Ii,Before:Ui,After:Yi,Symbol:Xi,Break:zi}=Di;function Ni(t){return Ci[t]?Fi:Mi[t]?zi:Oi[t]?Ui:Pi[t]?Yi:Wi[t]?Xi:Ti.test(t)?Ii:Fi}const ji={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let a=n-1;a>-1&&(i=e[a].data[0]," "===i.char);a--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function qi(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Gi}=ji,{Letter:Hi,Single:Vi,Before:Qi,After:Ji,Symbol:Zi,Break:$i}=Di;let Ki,ts,es,is,ss,ns,as,rs,os,ls,ds,hs,cs,us,fs,gs,ps,_s=[];function ws(t,e){os&&!rs&&(rs=os),Ki.data.push({char:t,width:e}),es+=e}function ys(){is+=es,Ki.width=es,ts.words.push(Ki),Ki={data:[]},es=0}function ms(){us&&(fs.paraNumber++,ts.paraStart=!0,us=!1),os&&(ts.startCharSize=rs,ts.endCharSize=os,rs=0),ts.width=is,gs.width?Gi(ts):ps&&vs(),_s.push(ts),ts={words:[]},is=0}function vs(){is>(fs.maxWidth||0)&&(fs.maxWidth=is)}const{top:xs,right:bs,bottom:Bs,left:Ss}=I;function ks(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const Rs={getDrawData:function(t,i){A(t)||(t=String(t));let s=0,n=0,a=i.__getInput("width")||0,r=i.__getInput("height")||0;const{textDecoration:o,__font:l,__padding:d}=i;d&&(a?(s=d[Ss],a-=d[bs]+d[Ss]):i.autoSizeAlign||(s=d[Ss]),r?(n=d[xs],r-=d[xs]+d[Bs]):i.autoSizeAlign||(n=d[xs]));const h={bounds:{x:s,y:n,width:a,height:r},rows:[],paraNumber:0,font:e.canvas.font=l};return function(t,i,s){fs=t,_s=t.rows,gs=t.bounds,ps=!gs.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:a,textCase:r}=s,{canvas:o}=e,{width:l,height:d}=gs;if(l||d||n||"none"!==r){const t="none"!==s.textWrap,e="break"===s.textWrap;us=!0,ds=null,rs=as=os=es=is=0,Ki={data:[]},ts={words:[]},n&&(i=[...i]);for(let s=0,d=i.length;s<d;s++)ns=i[s],"\n"===ns?(es&&ys(),ts.paraEnd=!0,ms(),us=!0):(ls=Ni(ns),ls===Hi&&"none"!==r&&(ns=qi(ns,r,!es)),as=o.measureText(ns).width,n&&(n<0&&(os=as),as+=n),hs=ls===Vi&&(ds===Vi||ds===Hi)||ds===Vi&&ls!==Ji,cs=!(ls!==Qi&&ls!==Vi||ds!==Zi&&ds!==Ji),ss=us&&a?l-a:l,t&&l&&is+es+as>ss&&(e?(es&&ys(),is&&ms()):(cs||(cs=ls===Hi&&ds==Ji),hs||cs||ls===$i||ls===Qi||ls===Vi||es+as>ss?(es&&ys(),is&&ms()):is&&ms()))," "===ns&&!0!==us&&is+es===0||(ls===$i?(" "===ns&&es&&ys(),ws(ns,as),ys()):hs||cs?(es&&ys(),ws(ns,as)):ws(ns,as)),ds=ls);es&&ys(),is&&ms(),_s.length>0&&(_s[_s.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{fs.paraNumber++,is=o.measureText(t).width,_s.push({x:a||0,text:t,width:is,paraStart:!0}),ps&&vs()})}(h,t,i),d&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":ks(e,"x",t[Ss]);break;case"right":ks(e,"x",-t[bs])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":ks(e,"y",t[xs]);break;case"bottom":ks(e,"y",-t[Bs])}}(d,h,i,a,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:a,__baseLine:r,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:h,paraSpacing:c,autoSizeAlign:u}=e;let{x:f,y:g,width:p,height:_}=s,w=a*n+(c?c*(t.paraNumber-1):0),y=r;if(l&&w>_)w=Math.max(_,a),n>1&&(t.overflow=n);else if(_||u)switch(h){case"middle":g+=(_-w)/2;break;case"bottom":g+=_-w}y+=g;let m,v,x,b=p||u?p:t.maxWidth;for(let r=0,h=n;r<h;r++){if(m=i[r],m.x=f,m.width<p||m.width>p&&!l)switch(d){case"center":m.x+=(b-m.width)/2;break;case"right":m.x+=b-m.width}m.paraStart&&c&&r>0&&(y+=c),m.y=y,y+=a,t.overflow>r&&y>w&&(m.isOverflow=!0,t.overflow=r+1),v=m.x,x=m.width,o<0&&(m.width<0?(x=-m.width+e.fontSize+o,v-=x,x+=e.fontSize):x-=o),v<s.x&&(s.x=v),x>s.width&&(s.width=x),l&&p&&p<x&&(m.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=g,s.height=w}(h,i),function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:a,letterSpacing:r}=e;let o,l,d,h,c,u;s.forEach(t=>{t.words&&(d=a&&t.paraStart?a:0,u=t.words.length,l=i&&("justify"===n||"both"===n)&&u>1?(i-t.width-d)/(u-1):0,h=r||t.isOverflow?0:l>.01?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===h?(t.x+=d,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=d,o=t.x,t.data=[],t.words.forEach((e,i)=>{1===h?(c={char:"",x:o},o=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,o,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):o=function(t,e,i,s){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width}),e}(e.data,o,t.data,t.isOverflow),!l||t.paraEnd&&"both"!==n||i===u-1||(o+=l,t.width+=l)})),t.words=null)})}(h,i,a),h.overflow&&function(t,i,s,n){if(!n)return;const{rows:a,overflow:r}=t;let{textOverflow:o}=i;if(a.splice(r),o&&"show"!==o){let t,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?e.canvas.measureText(o).width:0,h=s+n-d;("none"===i.textWrap?a:[a[r-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],l=t.x+t.width,!(s===i&&l<h));s--){if(l<h&&" "!==t.char||!s){e.data.splice(s+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)}})}}(h,i,s,a),"none"!==o&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:a}=e;switch(t.decorationHeight=n/11,R(a)?(i=a.type,a.color&&(t.decorationColor=q.string(a.color)),a.offset&&(s=Math.min(.3*n,Math.max(a.offset,.15*-n)))):i=a,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(h,i),h}};const Es={string:function(t,e){if(!t)return"#000";const i=U(e)&&e<1;if(A(t)){if(!i||!q.object)return t;t=q.object(t)}let s=T(t.a)?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};Object.assign(J,Rs),Object.assign(q,Es),Object.assign(j,te),Object.assign(N,ze),Object.assign(G,oi),Object.assign(V,xi);const{setPoint:Ls,addPoint:Ts,toBounds:As}=Z;const Cs={syncExport(t,e,i){let s;H.running=!0;try{const n=K.fileType(e),a=e.includes(".");i=K.getExportOptions(i);const{toURL:r}=tt,{download:o}=tt.origin;if("json"===n)a&&o(r(JSON.stringify(t.toJSON(i.json)),"text"),e),s={data:!!a||t.toJSON(i.json)};else if("svg"===n)a&&o(r(t.toSVG(),"svg"),e),s={data:!!a||t.toSVG()};else{let n,a,r=1,o=1;const{worldTransform:l,isLeafer:d,leafer:h,isFrame:c}=t,{slice:u,clip:f,trim:g,screenshot:p,padding:_,onCanvas:w}=i,y=et(i.smooth)?!h||h.config.smooth:i.smooth,m=i.contextSettings||(h?h.config.contextSettings:void 0),v=d&&p&&et(i.fill)?t.fill:i.fill,x=K.isOpaqueImage(e)||v,b=new it;if(p)n=!0===p?d?h.canvas.bounds:t.worldRenderBounds:p;else{let e=i.relative||(d?"inner":"local");switch(r=l.scaleX,o=l.scaleY,e){case"inner":b.set(l);break;case"local":b.set(l).divide(t.localTransform),r/=t.scaleX,o/=t.scaleY;break;case"world":r=1,o=1;break;case"page":e=h||t;default:b.set(l).divide(t.getTransform(e));const i=e.worldTransform;r/=r/i.scaleX,o/=o/i.scaleY}n=t.getBounds("render",e)}const B={scaleX:1,scaleY:1};st.getScaleData(i.scale,i.size,n,B);let S=i.pixelRatio||1,{x:k,y:R,width:E,height:L}=new $(n).scale(B.scaleX,B.scaleY);f&&(k+=f.x,R+=f.y,E=f.width,L=f.height);const T={exporting:!0,matrix:b.scale(1/B.scaleX,1/B.scaleY).invert().translate(-k,-R).withScale(1/r*B.scaleX,1/o*B.scaleY)};let A,C=nt.canvas({width:Math.floor(E),height:Math.floor(L),pixelRatio:S,smooth:y,contextSettings:m});u&&(A=t,A.__worldOpacity=0,t=h||t,T.bounds=C.bounds),C.save();const O=c&&!et(v),P=t.get("fill");if(O&&(t.fill=""),tt.render(t,C,T),O&&(t.fill=P),C.restore(),A&&A.__updateWorldOpacity(),g){a=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let n,a,r,o=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(n=o%e,a=(o-n)/e,r?Ts(r,n,a):Ls(r={},n,a)),o++;const l=new $;return r&&(As(r,l),l.scale(1/t.pixelRatio).ceil()),l}(C);const t=C,{width:e,height:i}=a,s={x:0,y:0,width:e,height:i,pixelRatio:S};C=nt.canvas(s),C.copyWorld(t,a,s),t.destroy()}if(_){const[t,e,i,s]=st.fourNumber(_),n=C,{width:a,height:r}=n;C=nt.canvas({width:a+s+e,height:r+t+i,pixelRatio:S}),C.copyWorld(n,n.bounds,{x:s,y:t,width:a,height:r}),n.destroy()}x&&C.fillWorld(C.bounds,v||"#FFFFFF","destination-over"),w&&w(C);s={data:"canvas"===e?C:C.export(e,i),width:C.pixelWidth,height:C.pixelHeight,renderBounds:n,trimBounds:a};const W=h&&h.app;W&&W.canvasManager&&W.canvasManager.clearRecycled()}}catch(t){s={data:"",error:t}}return H.running=!1,s},export(t,e,i){return H.running=!0,function(t){Os||(Os=new at);return new Promise(e=>{Os.add(()=>ct(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(s=>new Promise(n=>{const a=()=>ct(this,void 0,void 0,function*(){if(!rt.isComplete)return tt.requestRender(a);const r=H.syncExport(t,e,i);r.data instanceof Promise&&(r.data=yield r.data),s(r),n()});t.updateLayout(),Ps(t);const{leafer:r}=t;r?r.waitViewCompleted(a):a()}))}};let Os;function Ps(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>Ps(t))}const Ws=ot.prototype,Ms=lt.get("@leafer-in/export");Ws.export=function(t,e){const{quality:i,blob:s}=K.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},Ws.toBlob=function(t,e){return new Promise(i=>{tt.origin.canvasToBolb(this.view,t,e).then(t=>{i(t)}).catch(t=>{Ms.error(t),i(null)})})},Ws.toDataURL=function(t,e){return tt.origin.canvasToDataURL(this.view,t,e)},Ws.saveAs=function(t,e){return new Promise(i=>{tt.origin.canvasSaveAs(this.view,t,e).then(()=>{i(!0)}).catch(t=>{Ms.error(t),i(!1)})})},dt.add("export"),Object.assign(H,Cs),ht.prototype.export=function(t,e){return H.export(this,t,e)},ht.prototype.syncExport=function(t,e){return H.syncExport(this,t,e)},Object.assign(n,{interaction:(t,e,i,s)=>new z(t,e,i,s),hitCanvas:(t,e)=>new ut(t,e),hitCanvasManager:()=>new X});export{Et as Layouter,ut as LeaferCanvas,Ct as Picker,Tt as Renderer,Ot as Selector,_t as Watcher,pt as useCanvas};
|
|
2
2
|
//# sourceMappingURL=node.esm.min.js.map
|