@idraw/renderer 0.4.0-beta.40 → 0.4.0-beta.41
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/esm/calculator.d.ts +3 -2
- package/dist/esm/calculator.js +14 -2
- package/dist/esm/draw/box.js +2 -2
- package/dist/esm/draw/circle.js +1 -1
- package/dist/esm/draw/global.d.ts +2 -2
- package/dist/esm/draw/group.js +2 -2
- package/dist/esm/draw/image.js +2 -2
- package/dist/esm/draw/layout.js +2 -2
- package/dist/esm/draw/path.js +4 -2
- package/dist/esm/index.js +6 -0
- package/dist/esm/virtual-flat/text.js +2 -2
- package/dist/index.global.js +70 -36
- package/dist/index.global.min.js +1 -1
- package/package.json +3 -3
package/dist/esm/calculator.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Point, Data, Element, ElementType, ViewCalculator, ViewCalculatorOptions, ViewScaleInfo, ViewSizeInfo, ViewRectInfo,
|
|
1
|
+
import type { Point, Data, Element, ElementType, ViewCalculator, ViewCalculatorOptions, ViewScaleInfo, ViewSizeInfo, ViewRectInfo, ModifyInfo, VirtualFlatItem } from '@idraw/types';
|
|
2
2
|
export declare class Calculator implements ViewCalculator {
|
|
3
3
|
#private;
|
|
4
4
|
constructor(opts: ViewCalculatorOptions);
|
|
@@ -34,8 +34,9 @@ export declare class Calculator implements ViewCalculator {
|
|
|
34
34
|
viewScaleInfo: ViewScaleInfo;
|
|
35
35
|
viewSizeInfo: ViewSizeInfo;
|
|
36
36
|
}): ViewRectInfo | null;
|
|
37
|
+
modifyText(element: Element<'text'>): void;
|
|
37
38
|
modifyVirtualFlatItemMap(data: Data, opts: {
|
|
38
|
-
|
|
39
|
+
modifyInfo: ModifyInfo;
|
|
39
40
|
viewScaleInfo: ViewScaleInfo;
|
|
40
41
|
viewSizeInfo: ViewSizeInfo;
|
|
41
42
|
}): void;
|
package/dist/esm/calculator.js
CHANGED
|
@@ -13,6 +13,7 @@ var _Calculator_opts, _Calculator_store;
|
|
|
13
13
|
import { is, getViewPointAtElement, Store, calcViewPointSize, findElementFromListByPosition, getGroupQueueByElementPosition, calcElementOriginRectInfo, originRectInfoToRangeRectInfo } from '@idraw/util';
|
|
14
14
|
import { sortElementsViewVisiableInfoMap, updateVirtualFlatItemMapStatus } from './view-visible';
|
|
15
15
|
import { calcVirtualFlatDetail } from './virtual-flat';
|
|
16
|
+
import { calcVirtualTextDetail } from './virtual-flat/text';
|
|
16
17
|
export class Calculator {
|
|
17
18
|
constructor(opts) {
|
|
18
19
|
_Calculator_opts.set(this, void 0);
|
|
@@ -111,9 +112,20 @@ export class Calculator {
|
|
|
111
112
|
};
|
|
112
113
|
return viewRectInfo;
|
|
113
114
|
}
|
|
115
|
+
modifyText(element) {
|
|
116
|
+
const virtualFlatItemMap = __classPrivateFieldGet(this, _Calculator_store, "f").get('virtualFlatItemMap');
|
|
117
|
+
const flatItem = virtualFlatItemMap[element.uuid];
|
|
118
|
+
if (element && element.type === 'text') {
|
|
119
|
+
const newVirtualFlatItem = Object.assign(Object.assign({}, flatItem), calcVirtualTextDetail(element, {
|
|
120
|
+
tempContext: __classPrivateFieldGet(this, _Calculator_opts, "f").tempContext
|
|
121
|
+
}));
|
|
122
|
+
virtualFlatItemMap[element.uuid] = newVirtualFlatItem;
|
|
123
|
+
__classPrivateFieldGet(this, _Calculator_store, "f").set('virtualFlatItemMap', virtualFlatItemMap);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
114
126
|
modifyVirtualFlatItemMap(data, opts) {
|
|
115
|
-
const {
|
|
116
|
-
const { type, content } =
|
|
127
|
+
const { modifyInfo, viewScaleInfo, viewSizeInfo } = opts;
|
|
128
|
+
const { type, content } = modifyInfo;
|
|
117
129
|
const list = data.elements;
|
|
118
130
|
const virtualFlatItemMap = __classPrivateFieldGet(this, _Calculator_store, "f").get('virtualFlatItemMap');
|
|
119
131
|
if (type === 'deleteElement') {
|
package/dist/esm/draw/box.js
CHANGED
|
@@ -63,7 +63,7 @@ function drawClipPath(ctx, viewElem, opts) {
|
|
|
63
63
|
ctx.scale(totalScale * scaleW, totalScale * scaleH);
|
|
64
64
|
const pathStr = generateSVGPath(clipPath.commands || []);
|
|
65
65
|
const path2d = new Path2D(pathStr);
|
|
66
|
-
ctx.clip(path2d);
|
|
66
|
+
ctx.clip(path2d, 'nonzero');
|
|
67
67
|
ctx.translate(0 - internalX, 0 - internalY);
|
|
68
68
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
69
69
|
rotateElement(ctx, Object.assign({}, viewElem), () => {
|
|
@@ -168,7 +168,7 @@ export function drawBoxBackground(ctx, viewElem, opts) {
|
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
ctx.fill();
|
|
171
|
+
ctx.fill('nonzero');
|
|
172
172
|
if (transform && transform.length > 0) {
|
|
173
173
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
174
174
|
}
|
package/dist/esm/draw/circle.js
CHANGED
|
@@ -50,7 +50,7 @@ export function drawCircle(ctx, elem, opts) {
|
|
|
50
50
|
ctx.fillStyle = fillStyle;
|
|
51
51
|
ctx.circle(centerX, centerY, radiusA, radiusB, 0, 0, 2 * Math.PI);
|
|
52
52
|
ctx.closePath();
|
|
53
|
-
ctx.fill();
|
|
53
|
+
ctx.fill('nonzero');
|
|
54
54
|
ctx.globalAlpha = parentOpacity;
|
|
55
55
|
if (typeof bw === 'number' && bw > 0) {
|
|
56
56
|
const ba = bw / 2 + a;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { RendererDrawElementOptions, ViewContext2D,
|
|
2
|
-
export declare function drawGlobalBackground(ctx: ViewContext2D, global:
|
|
1
|
+
import type { RendererDrawElementOptions, ViewContext2D, ElementGlobal } from '@idraw/types';
|
|
2
|
+
export declare function drawGlobalBackground(ctx: ViewContext2D, global: ElementGlobal | undefined, opts: RendererDrawElementOptions): void;
|
package/dist/esm/draw/group.js
CHANGED
|
@@ -97,8 +97,8 @@ export function drawGroup(ctx, elem, opts) {
|
|
|
97
97
|
ctx.arcTo(x, y + h, x, y, radiusList[3]);
|
|
98
98
|
ctx.arcTo(x, y, x + w, y, radiusList[0]);
|
|
99
99
|
ctx.closePath();
|
|
100
|
-
ctx.fill();
|
|
101
|
-
ctx.clip();
|
|
100
|
+
ctx.fill('nonzero');
|
|
101
|
+
ctx.clip('nonzero');
|
|
102
102
|
}
|
|
103
103
|
if (Array.isArray(elem.detail.children)) {
|
|
104
104
|
const { parentElementSize: parentSize } = opts;
|
package/dist/esm/draw/image.js
CHANGED
|
@@ -39,8 +39,8 @@ export function drawImage(ctx, elem, opts) {
|
|
|
39
39
|
ctx.arcTo(x, y + h, x, y, radiusList[3]);
|
|
40
40
|
ctx.arcTo(x, y, x + w, y, radiusList[0]);
|
|
41
41
|
ctx.closePath();
|
|
42
|
-
ctx.fill();
|
|
43
|
-
ctx.clip();
|
|
42
|
+
ctx.fill('nonzero');
|
|
43
|
+
ctx.clip('nonzero');
|
|
44
44
|
if (scaleMode && originH && originW) {
|
|
45
45
|
let sx = 0;
|
|
46
46
|
let sy = 0;
|
package/dist/esm/draw/layout.js
CHANGED
|
@@ -32,8 +32,8 @@ export function drawLayout(ctx, layout, opts, renderContent) {
|
|
|
32
32
|
ctx.arcTo(x, y + h, x, y, radiusList[3]);
|
|
33
33
|
ctx.arcTo(x, y, x + w, y, radiusList[0]);
|
|
34
34
|
ctx.closePath();
|
|
35
|
-
ctx.fill();
|
|
36
|
-
ctx.clip();
|
|
35
|
+
ctx.fill('nonzero');
|
|
36
|
+
ctx.clip('nonzero');
|
|
37
37
|
}
|
|
38
38
|
renderContent(ctx);
|
|
39
39
|
if (layout.detail.overflow === 'hidden') {
|
package/dist/esm/draw/path.js
CHANGED
|
@@ -30,7 +30,9 @@ export function drawPath(ctx, elem, opts) {
|
|
|
30
30
|
boxViewElem.detail = restDetail;
|
|
31
31
|
let boxOriginElem = Object.assign({}, elem);
|
|
32
32
|
boxOriginElem.detail = restDetail;
|
|
33
|
-
if (detail.fill &&
|
|
33
|
+
if (detail.fill &&
|
|
34
|
+
detail.fill !== 'string' &&
|
|
35
|
+
((_b = (_a = detail.fill) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.includes('gradient'))) {
|
|
34
36
|
boxViewElem = Object.assign(Object.assign({}, viewElem), {
|
|
35
37
|
detail: Object.assign(Object.assign({}, viewElem.detail), {
|
|
36
38
|
background: detail.fill,
|
|
@@ -71,7 +73,7 @@ export function drawPath(ctx, elem, opts) {
|
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
if (detail.fill) {
|
|
74
|
-
ctx.fill(path2d, fillRule);
|
|
76
|
+
ctx.fill(path2d, fillRule || 'nonzero');
|
|
75
77
|
}
|
|
76
78
|
if (detail.stroke && detail.strokeWidth !== 0) {
|
|
77
79
|
ctx.strokeStyle = detail.stroke;
|
package/dist/esm/index.js
CHANGED
|
@@ -54,6 +54,12 @@ export class Renderer extends EventEmitter {
|
|
|
54
54
|
w: opts.viewSizeInfo.width,
|
|
55
55
|
h: opts.viewSizeInfo.height
|
|
56
56
|
};
|
|
57
|
+
if (opts.forceDrawAll === true) {
|
|
58
|
+
__classPrivateFieldGet(this, _Renderer_calculator, "f").resetVirtualFlatItemMap(data, {
|
|
59
|
+
viewScaleInfo: opts.viewScaleInfo,
|
|
60
|
+
viewSizeInfo: opts.viewSizeInfo
|
|
61
|
+
});
|
|
62
|
+
}
|
|
57
63
|
const drawOpts = Object.assign({ loader,
|
|
58
64
|
calculator,
|
|
59
65
|
parentElementSize, elementAssets: data.assets, parentOpacity: 1, overrideElementMap: sharer === null || sharer === void 0 ? void 0 : sharer.getActiveOverrideElemenentMap() }, opts);
|
|
@@ -120,10 +120,10 @@ export function calcVirtualTextDetail(elem, opts) {
|
|
|
120
120
|
eachLineStartY = (fontHeight - fontSize) / 2;
|
|
121
121
|
}
|
|
122
122
|
if (lines.length * fontHeight < h) {
|
|
123
|
-
if (
|
|
123
|
+
if (detail.verticalAlign === 'top') {
|
|
124
124
|
startY = 0;
|
|
125
125
|
}
|
|
126
|
-
else if (
|
|
126
|
+
else if (detail.verticalAlign === 'bottom') {
|
|
127
127
|
startY += h - lines.length * fontHeight;
|
|
128
128
|
}
|
|
129
129
|
else {
|
package/dist/index.global.js
CHANGED
|
@@ -33,36 +33,50 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
33
33
|
}
|
|
34
34
|
return result;
|
|
35
35
|
}
|
|
36
|
+
function generate32Base36Hash(str) {
|
|
37
|
+
const hash256 = generate256BitHash(str);
|
|
38
|
+
return bigIntToBase36(hash256).padStart(32, "0").slice(0, 32);
|
|
39
|
+
}
|
|
40
|
+
function generate256BitHash(str) {
|
|
41
|
+
let h1 = 0xcbf29ce484222325n, h2 = 0x84222325cbf29ce4n;
|
|
42
|
+
let h3 = 0x1b3n * h1, h4 = 0x1000000n * h2;
|
|
43
|
+
const prime = 0x100000001b3n;
|
|
44
|
+
const chunkSize = 4096;
|
|
45
|
+
for (let i = 0; i < str.length; i += chunkSize) {
|
|
46
|
+
const chunk = str.slice(i, i + chunkSize);
|
|
47
|
+
for (let j = 0; j < chunk.length; j++) {
|
|
48
|
+
const code = BigInt(chunk.charCodeAt(j) + i + j);
|
|
49
|
+
h1 = (h1 ^ code) * prime;
|
|
50
|
+
h2 = (h2 ^ h1) * prime ^ h3;
|
|
51
|
+
h3 = (h3 ^ h2) * prime + h4;
|
|
52
|
+
h4 = (h4 ^ h3) * prime | 0x1234567890abcdefn;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return h1 << 192n | h2 << 128n | h3 << 64n | h4;
|
|
56
|
+
}
|
|
57
|
+
function bigIntToBase36(num) {
|
|
58
|
+
const chars = "0123456789abcdefghijklmnopqrstuvwxyz";
|
|
59
|
+
if (num === 0n)
|
|
60
|
+
return "0";
|
|
61
|
+
let result = "";
|
|
62
|
+
while (num > 0n) {
|
|
63
|
+
const rem = num % 36n;
|
|
64
|
+
result = chars[Number(rem)] + result;
|
|
65
|
+
num = num / 36n;
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
36
69
|
function createUUID() {
|
|
37
70
|
function _createStr() {
|
|
38
71
|
return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
|
|
39
72
|
}
|
|
40
73
|
return `${_createStr()}${_createStr()}-${_createStr()}-${_createStr()}-${_createStr()}-${_createStr()}${_createStr()}${_createStr()}`;
|
|
41
74
|
}
|
|
42
|
-
function limitHexStr(str) {
|
|
43
|
-
let count = 0;
|
|
44
|
-
for (let i = 0; i < str.length; i++) {
|
|
45
|
-
count += str.charCodeAt(i) * str.charCodeAt(i) * i * i;
|
|
46
|
-
}
|
|
47
|
-
return count.toString(16).substring(0, 4);
|
|
48
|
-
}
|
|
49
75
|
function createAssetId(assetStr) {
|
|
50
|
-
|
|
51
|
-
const mid = Math.floor(len / 2);
|
|
52
|
-
const start4 = assetStr.substring(0, 4).padEnd(4, "0");
|
|
53
|
-
const end4 = assetStr.substring(0, 4).padEnd(4, "0");
|
|
54
|
-
const str1 = limitHexStr(len.toString(16).padEnd(4, start4));
|
|
55
|
-
const str2 = limitHexStr(assetStr.substring(mid - 4, mid).padEnd(4, start4)).padEnd(4, "f");
|
|
56
|
-
const str3 = limitHexStr(assetStr.substring(mid - 8, mid - 4).padEnd(4, start4)).padEnd(4, "f");
|
|
57
|
-
const str4 = limitHexStr(assetStr.substring(mid - 12, mid - 8).padEnd(4, start4)).padEnd(4, "f");
|
|
58
|
-
const str5 = limitHexStr(assetStr.substring(mid - 16, mid - 12).padEnd(4, end4)).padEnd(4, "f");
|
|
59
|
-
const str6 = limitHexStr(assetStr.substring(mid, mid + 4).padEnd(4, end4)).padEnd(4, "f");
|
|
60
|
-
const str7 = limitHexStr(assetStr.substring(mid + 4, mid + 8).padEnd(4, end4)).padEnd(4, "f");
|
|
61
|
-
const str8 = limitHexStr(end4.padEnd(4, start4).padEnd(4, end4));
|
|
62
|
-
return `@assets/${str1}${str2}-${str3}-${str4}-${str5}-${str6}${str7}${str8}`;
|
|
76
|
+
return `@assets/${generate32Base36Hash(assetStr)}`;
|
|
63
77
|
}
|
|
64
78
|
function isAssetId(id) {
|
|
65
|
-
return /^@assets\/[0-9a-z
|
|
79
|
+
return /^@assets\/[0-9a-z-]{0,}$/.test(`${id}`);
|
|
66
80
|
}
|
|
67
81
|
(function(s, e) {
|
|
68
82
|
var t = {};
|
|
@@ -671,7 +685,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
671
685
|
for (let i = 0; i < position.length; i++) {
|
|
672
686
|
const pos = position[i];
|
|
673
687
|
const item = tempList[pos];
|
|
674
|
-
if (i < position.length - 1 && item.type === "group") {
|
|
688
|
+
if (i < position.length - 1 && (item === null || item === void 0 ? void 0 : item.type) === "group") {
|
|
675
689
|
tempList = item.detail.children;
|
|
676
690
|
} else if (i === position.length - 1) {
|
|
677
691
|
result = item;
|
|
@@ -1119,7 +1133,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1119
1133
|
ctx.scale(totalScale * scaleW, totalScale * scaleH);
|
|
1120
1134
|
const pathStr = generateSVGPath(clipPath.commands || []);
|
|
1121
1135
|
const path2d = new Path2D(pathStr);
|
|
1122
|
-
ctx.clip(path2d);
|
|
1136
|
+
ctx.clip(path2d, "nonzero");
|
|
1123
1137
|
ctx.translate(0 - internalX, 0 - internalY);
|
|
1124
1138
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
1125
1139
|
rotateElement(ctx, { ...viewElem }, () => {
|
|
@@ -1210,7 +1224,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1210
1224
|
}
|
|
1211
1225
|
}
|
|
1212
1226
|
}
|
|
1213
|
-
ctx.fill();
|
|
1227
|
+
ctx.fill("nonzero");
|
|
1214
1228
|
if (transform && transform.length > 0) {
|
|
1215
1229
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
1216
1230
|
}
|
|
@@ -1416,7 +1430,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1416
1430
|
ctx.fillStyle = fillStyle;
|
|
1417
1431
|
ctx.circle(centerX, centerY, radiusA, radiusB, 0, 0, 2 * Math.PI);
|
|
1418
1432
|
ctx.closePath();
|
|
1419
|
-
ctx.fill();
|
|
1433
|
+
ctx.fill("nonzero");
|
|
1420
1434
|
ctx.globalAlpha = parentOpacity;
|
|
1421
1435
|
if (typeof bw === "number" && bw > 0) {
|
|
1422
1436
|
const ba = bw / 2 + a;
|
|
@@ -1496,8 +1510,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1496
1510
|
ctx.arcTo(x22, y22 + h22, x22, y22, radiusList[3]);
|
|
1497
1511
|
ctx.arcTo(x22, y22, x22 + w22, y22, radiusList[0]);
|
|
1498
1512
|
ctx.closePath();
|
|
1499
|
-
ctx.fill();
|
|
1500
|
-
ctx.clip();
|
|
1513
|
+
ctx.fill("nonzero");
|
|
1514
|
+
ctx.clip("nonzero");
|
|
1501
1515
|
if (scaleMode && originH && originW) {
|
|
1502
1516
|
let sx = 0;
|
|
1503
1517
|
let sy = 0;
|
|
@@ -1695,7 +1709,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1695
1709
|
}
|
|
1696
1710
|
}
|
|
1697
1711
|
if (detail.fill) {
|
|
1698
|
-
ctx.fill(path2d, fillRule);
|
|
1712
|
+
ctx.fill(path2d, fillRule || "nonzero");
|
|
1699
1713
|
}
|
|
1700
1714
|
if (detail.stroke && detail.strokeWidth !== 0) {
|
|
1701
1715
|
ctx.strokeStyle = detail.stroke;
|
|
@@ -1804,8 +1818,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1804
1818
|
ctx.arcTo(x22, y22 + h22, x22, y22, radiusList[3]);
|
|
1805
1819
|
ctx.arcTo(x22, y22, x22 + w22, y22, radiusList[0]);
|
|
1806
1820
|
ctx.closePath();
|
|
1807
|
-
ctx.fill();
|
|
1808
|
-
ctx.clip();
|
|
1821
|
+
ctx.fill("nonzero");
|
|
1822
|
+
ctx.clip("nonzero");
|
|
1809
1823
|
}
|
|
1810
1824
|
if (Array.isArray(elem.detail.children)) {
|
|
1811
1825
|
const { parentElementSize: parentSize } = opts;
|
|
@@ -1911,8 +1925,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1911
1925
|
ctx.arcTo(x22, y22 + h22, x22, y22, radiusList[3]);
|
|
1912
1926
|
ctx.arcTo(x22, y22, x22 + w22, y22, radiusList[0]);
|
|
1913
1927
|
ctx.closePath();
|
|
1914
|
-
ctx.fill();
|
|
1915
|
-
ctx.clip();
|
|
1928
|
+
ctx.fill("nonzero");
|
|
1929
|
+
ctx.clip("nonzero");
|
|
1916
1930
|
}
|
|
1917
1931
|
renderContent(ctx);
|
|
1918
1932
|
if (layout.detail.overflow === "hidden") {
|
|
@@ -2240,9 +2254,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2240
2254
|
eachLineStartY = (fontHeight - fontSize2) / 2;
|
|
2241
2255
|
}
|
|
2242
2256
|
if (lines.length * fontHeight < h2) {
|
|
2243
|
-
if (
|
|
2257
|
+
if (detail.verticalAlign === "top") {
|
|
2244
2258
|
startY = 0;
|
|
2245
|
-
} else if (
|
|
2259
|
+
} else if (detail.verticalAlign === "bottom") {
|
|
2246
2260
|
startY += h2 - lines.length * fontHeight;
|
|
2247
2261
|
} else {
|
|
2248
2262
|
startY += (h2 - lines.length * fontHeight) / 2;
|
|
@@ -2475,9 +2489,23 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2475
2489
|
};
|
|
2476
2490
|
return viewRectInfo;
|
|
2477
2491
|
}
|
|
2492
|
+
modifyText(element) {
|
|
2493
|
+
const virtualFlatItemMap = __privateGet(this, _store).get("virtualFlatItemMap");
|
|
2494
|
+
const flatItem = virtualFlatItemMap[element.uuid];
|
|
2495
|
+
if (element && element.type === "text") {
|
|
2496
|
+
const newVirtualFlatItem = {
|
|
2497
|
+
...flatItem,
|
|
2498
|
+
...calcVirtualTextDetail(element, {
|
|
2499
|
+
tempContext: __privateGet(this, _opts).tempContext
|
|
2500
|
+
})
|
|
2501
|
+
};
|
|
2502
|
+
virtualFlatItemMap[element.uuid] = newVirtualFlatItem;
|
|
2503
|
+
__privateGet(this, _store).set("virtualFlatItemMap", virtualFlatItemMap);
|
|
2504
|
+
}
|
|
2505
|
+
}
|
|
2478
2506
|
modifyVirtualFlatItemMap(data, opts) {
|
|
2479
|
-
const {
|
|
2480
|
-
const { type, content } =
|
|
2507
|
+
const { modifyInfo, viewScaleInfo, viewSizeInfo } = opts;
|
|
2508
|
+
const { type, content } = modifyInfo;
|
|
2481
2509
|
const list = data.elements;
|
|
2482
2510
|
const virtualFlatItemMap = __privateGet(this, _store).get("virtualFlatItemMap");
|
|
2483
2511
|
if (type === "deleteElement") {
|
|
@@ -2574,6 +2602,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2574
2602
|
w: opts.viewSizeInfo.width,
|
|
2575
2603
|
h: opts.viewSizeInfo.height
|
|
2576
2604
|
};
|
|
2605
|
+
if (opts.forceDrawAll === true) {
|
|
2606
|
+
__privateGet(this, _calculator).resetVirtualFlatItemMap(data, {
|
|
2607
|
+
viewScaleInfo: opts.viewScaleInfo,
|
|
2608
|
+
viewSizeInfo: opts.viewSizeInfo
|
|
2609
|
+
});
|
|
2610
|
+
}
|
|
2577
2611
|
const drawOpts = {
|
|
2578
2612
|
loader,
|
|
2579
2613
|
calculator,
|
package/dist/index.global.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var iDrawRenderer=function(t){"use strict";var e,n,i,o,a,r,l,s,c,h,f,u,d,g,p,y,w,m,v,x,b=t=>{throw TypeError(t)},S=(t,e,n)=>e.has(t)||b("Cannot "+n),I=(t,e,n)=>(S(t,e,"read from private field"),n?n.call(t):e.get(t)),M=(t,e,n)=>e.has(t)?b("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),P=(t,e,n,i)=>(S(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),C=(t,e,n)=>(S(t,e,"access private method"),n);function R(t){return"string"==typeof t&&(/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)||/^[a-z]{1,}$/i.test(t))}function A(t,e){if(1===e)return t;let n=1;const i=/^#[0-9a-f]{6,6}$/i;let o=t;if(i.test(t)?n=parseInt(t.substring(5,7).replace(/^#/,"0x")):/^#[0-9a-f]{8,8}$/i.test(t)&&(n=parseInt(t.substring(7,9).replace(/^#/,"0x")),o=t.substring(0,7)),n*=e,i.test(o)&&n>0&&n<1){const t=Math.max(0,Math.min(255,Math.ceil(256*n)));o=`${o.toUpperCase()}${t.toString(16).toUpperCase()}`}return o}function T(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return`${t()}${t()}-${t()}-${t()}-${t()}-${t()}${t()}${t()}`}function z(t){let e=0;for(let n=0;n<t.length;n++)e+=t.charCodeAt(n)*t.charCodeAt(n)*n*n;return e.toString(16).substring(0,4)}function k(t){const e=t.length,n=Math.floor(e/2),i=t.substring(0,4).padEnd(4,"0"),o=t.substring(0,4).padEnd(4,"0");return`@assets/${z(e.toString(16).padEnd(4,i))}${z(t.substring(n-4,n).padEnd(4,i)).padEnd(4,"f")}-${z(t.substring(n-8,n-4).padEnd(4,i)).padEnd(4,"f")}-${z(t.substring(n-12,n-8).padEnd(4,i)).padEnd(4,"f")}-${z(t.substring(n-16,n-12).padEnd(4,o)).padEnd(4,"f")}-${z(t.substring(n,n+4).padEnd(4,o)).padEnd(4,"f")}${z(t.substring(n+4,n+8).padEnd(4,o)).padEnd(4,"f")}${z(o.padEnd(4,i).padEnd(4,o))}`}function E(t){return function t(e){const n=function(t){return Object.prototype.toString.call(t).replace(/[\]|\[]{1,1}/gi,"").split(" ")[1]}(e);if(["Null","Number","String","Boolean","Undefined"].indexOf(n)>=0)return e;if("Array"===n){const n=[];return e.forEach((e=>{n.push(t(e))})),n}if("Object"===n){const n={};Object.keys(e).forEach((i=>{n[i]=t(e[i])}));return Object.getOwnPropertySymbols(e).forEach((i=>{n[i]=t(e[i])})),n}}(t)}function L(t){return(Object.prototype.toString.call(t)||"").replace(/(\[object|\])/gi,"").trim()}const O={type(t,e){const n=L(t);return!0===e?n.toLocaleLowerCase():n},array:t=>"Array"===L(t),json:t=>"Object"===L(t),function:t=>"Function"===L(t),asyncFunction:t=>"AsyncFunction"===L(t),boolean:t=>"Boolean"===L(t),string:t=>"String"===L(t),number:t=>"Number"===L(t),undefined:t=>"Undefined"===L(t),null:t=>"Null"===L(t),promise:t=>"Promise"===L(t)};var W=function(t,e,n,i){return new(n||(n=Promise))((function(o,a){function r(t){try{s(i.next(t))}catch(t){a(t)}}function l(t){try{s(i.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,l)}s((i=i.apply(t,e||[])).next())}))};const{Image:$}=window;function F(t){return new Promise(((e,n)=>{const i=new $;i.crossOrigin="anonymous",i.onload=function(){e(i)},i.onabort=n,i.onerror=n,i.src=t}))}function D(t){return W(this,void 0,void 0,(function*(){const e=yield function(t){return new Promise(((e,n)=>{const i=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),o=new FileReader;o.readAsDataURL(i),o.onload=function(t){var n;const i=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(i)},o.onerror=function(t){n(t)}}))}(t);return yield F(e)}))}function B(t,e){return W(this,void 0,void 0,(function*(){t=t.replace(/\&/gi,"&");const n=yield function(t,e){const{width:n,height:i}=e;return new Promise(((e,o)=>{const a=new Blob([`\n <svg \n xmlns="http://www.w3.org/2000/svg" \n width="${n||""}" \n height = "${i||""}">\n <foreignObject width="100%" height="100%">\n <div xmlns = "http://www.w3.org/1999/xhtml">\n ${t}\n </div>\n </foreignObject>\n </svg>\n `],{type:"image/svg+xml;charset=utf-8"}),r=new FileReader;r.readAsDataURL(a),r.onload=function(t){var n;const i=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(i)},r.onerror=function(t){o(t)}}))}(t,e);return yield F(n)}))}function V(t){return"number"==typeof t&&t>=0}function j(t){return"number"==typeof t&&(t>0||t<=0)}function X(t){return"string"==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(`${t}`)}function Y(t){return"string"==typeof t&&/^(data:image\/)/.test(`${t}`)}const H={positiveNum:V,x:function(t){return j(t)},y:function(t){return j(t)},w:function(t){return V(t)},h:function(t){return V(t)},angle:function(t){return"number"==typeof t&&t>=-360&&t<=360},number:j,numberStr:function(t){return/^(-?\d+(?:\.\d+)?)$/.test(`${t}`)},borderWidth:function(t){return V(t)||Array.isArray(t)&&V(t[0])&&V(t[1])&&V(t[2])&&V(t[3])},borderRadius:function(t){return V(t)||Array.isArray(t)&&V(t[0])&&V(t[1])&&V(t[2])&&V(t[3])},color:function(t){return R(t)},imageSrc:function(t){return Y(t)||X(t)},imageURL:X,imageBase64:Y,svg:function(t){return"string"==typeof t&&/^(<svg[\s]{1,}|<svg>)/i.test(`${t}`.trim())&&/<\/[\s]{0,}svg>$/i.test(`${t}`.trim())},html:function(t){let e=!1;if("string"==typeof t){let n=document.createElement("div");n.innerHTML=t,n.children.length>0&&(e=!0),n=null}return e},text:function(t){return"string"==typeof t},fontSize:function(t){return j(t)&&t>0},lineHeight:function(t){return j(t)&&t>0},textAlign:function(t){return["center","left","right"].includes(t)},fontFamily:function(t){return"string"==typeof t&&t.length>0},fontWeight:function(t){return["bold"].includes(t)},strokeWidth:function(t){return j(t)&&t>0}};var U,N=function(t,e,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(t):i?i.value:e.get(t)};class Q{constructor(){U.set(this,void 0),function(t,e,n,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===i?o.call(t,n):o?o.value=n:e.set(t,n)}(this,U,new Map,"f")}on(t,e){if(N(this,U,"f").has(t)){const n=N(this,U,"f").get(t)||[];null==n||n.push(e),N(this,U,"f").set(t,n)}else N(this,U,"f").set(t,[e])}off(t,e){if(N(this,U,"f").has(t)){const n=N(this,U,"f").get(t);if(Array.isArray(n))for(let t=0;t<(null==n?void 0:n.length);t++)if(n[t]===e){n.splice(t,1);break}N(this,U,"f").set(t,n||[])}}trigger(t,e){const n=N(this,U,"f").get(t);return!!Array.isArray(n)&&(n.forEach((t=>{t(e)})),!0)}has(t){if(N(this,U,"f").has(t)){const e=N(this,U,"f").get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1}destroy(){this.clear()}clear(){N(this,U,"f").clear()}}function G(t,e){return{x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}}U=new WeakMap;var q,J,K,Z,_,tt=function(t,e,n,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?o.call(t,n):o?o.value=n:e.set(t,n),n},et=function(t,e,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(t):i?i.value:e.get(t)};class nt{constructor(t){q.add(this),J.set(this,void 0),K.set(this,void 0),Z.set(this,void 0),tt(this,K,E(t.defaultStorage),"f"),tt(this,J,et(this,q,"m",_).call(this),"f"),tt(this,Z,t.defaultStatic||{},"f")}set(t,e){et(this,J,"f")[t]=e}get(t){return et(this,J,"f")[t]}setStatic(t,e){et(this,Z,"f")[t]=e}getStatic(t){return et(this,Z,"f")[t]}getSnapshot(t){return!0===(null==t?void 0:t.deepClone)?E(et(this,J,"f")):Object.assign({},et(this,J,"f"))}clear(){tt(this,J,et(this,q,"m",_).call(this),"f")}destroy(){tt(this,J,null,"f"),tt(this,Z,null,"f")}}function it(t){return t/180*Math.PI}function ot(t,e,n){const i=at(e);!function(t,e,n,i){const o=it(e||0);n&&(o>0||o<0)&&(t.translate(n.x,n.y),t.rotate(o),t.translate(-n.x,-n.y)),i(t),n&&(o>0||o<0)&&(t.translate(n.x,n.y),t.rotate(-o),t.translate(-n.x,-n.y))}(t,e.angle||0,i,(()=>{n(t)}))}function at(t){return{x:t.x+t.w/2,y:t.y+t.h/2}}function rt(t){const e=Math.min(t[0].x,t[1].x,t[2].x,t[3].x),n=Math.min(t[0].y,t[1].y,t[2].y,t[3].y);return at({x:e,y:n,w:Math.max(t[0].x,t[1].x,t[2].x,t[3].x)-e,h:Math.max(t[0].y,t[1].y,t[2].y,t[3].y)-n})}function lt(t,e,n){const i=function(t,e){const n=e.x-t.x,i=e.y-t.y;if(0===n){if(i<0)return 0;if(i>0)return Math.PI}else if(0===i){if(n<0)return 3*Math.PI/2;if(n>0)return Math.PI/2}return n>0&&i<0?Math.atan(Math.abs(n)/Math.abs(i)):n>0&&i>0?Math.PI-Math.atan(Math.abs(n)/Math.abs(i)):n<0&&i>0?Math.PI+Math.atan(Math.abs(n)/Math.abs(i)):n<0&&i<0?2*Math.PI-Math.atan(Math.abs(n)/Math.abs(i)):0}(t,e);let o=i+n;o>2*Math.PI?o-=2*Math.PI:o<0-2*Math.PI&&(o+=2*Math.PI),o<0&&(o+=2*Math.PI);const a=function(t,e){const n=(t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y);return 0===n?n:Math.sqrt(n)}(t,e);let r=0,l=0;return 0===o?(r=0,l=0-a):o>0&&o<Math.PI/2?(r=Math.sin(o)*a,l=0-Math.cos(o)*a):o===Math.PI/2?(r=a,l=0):o>Math.PI/2&&o<Math.PI?(r=Math.sin(Math.PI-o)*a,l=Math.cos(Math.PI-o)*a):o===Math.PI?(r=0,l=a):o>Math.PI&&o<1.5*Math.PI?(r=0-Math.sin(o-Math.PI)*a,l=Math.cos(o-Math.PI)*a):o===1.5*Math.PI?(r=0-a,l=0):o>1.5*Math.PI&&o<2*Math.PI?(r=0-Math.sin(2*Math.PI-o)*a,l=0-Math.cos(2*Math.PI-o)*a):o===2*Math.PI&&(r=0,l=0-a),r+=t.x,l+=t.y,{x:r,y:l}}function st(t,e,n){const{x:i,y:o,w:a,h:r}=t;let l={x:i,y:o},s={x:i+a,y:o},c={x:i+a,y:o+r},h={x:i,y:o+r};if(n&&(n>0||n<0)){const t=it(function(t){if(!(t>0||t<0)||0===t||360===t)return 0;let e=t%360;e<0?e+=360:360===t&&(e=0);return e}(n));l=lt(e,l,t),s=lt(e,s,t),c=lt(e,c,t),h=lt(e,h,t)}return[l,s,c,h]}function ct(t,e,n){return[lt(t,{x:e[0].x,y:e[0].y},n),lt(t,{x:e[1].x,y:e[1].y},n),lt(t,{x:e[2].x,y:e[2].y},n),lt(t,{x:e[3].x,y:e[3].y},n)]}function ht(t,e){var n;const i=[];let o=t;if(e.length>1)for(let t=0;t<e.length-1;t++){const a=o[e[t]];if("group"!==(null==a?void 0:a.type)||!Array.isArray(null===(n=null==a?void 0:a.detail)||void 0===n?void 0:n.children))return null;i.push(a),o=a.detail.children}return i}function ft(t){const{x:e,y:n,h:i,w:o}=t;return[{x:e,y:n},{x:e+o,y:n},{x:e+o,y:n+i},{x:e,y:n+i}]}function ut(t){const{x:e,y:n,w:i,h:o,angle:a=0}=t;return 0===a?ft(t):st(t,at({x:e,y:n,w:i,h:o}),a)}function dt(t,e){const{groupQueue:n}=e;if(!(n.length>0))return[ut(t)];const i=function(t){const e=[];let n=0,i=0;const o=[],a=[...t];for(let t=0;t<a.length;t++){const{x:r,y:l,w:s,h:c,angle:h=0}=a[t];let f;if(n+=r,i+=l,0===t){const t={x:n,y:i,w:s,h:c};f=ut({x:r,y:l,w:s,h:c,angle:h}),o.push({center:at(t),angle:h,radian:it(h)})}else{f=ft({x:n,y:i,w:s,h:c});for(let t=0;t<o.length;t++){const{center:e,radian:n}=o[t];f=ct(e,f,n)}const t=rt(f);(h>0||h<0)&&(f=ct(t,f,it(h))),o.push({center:t,angle:h,radian:it(h)})}e.push(f)}return e}([...n,t]);return i}function gt(t,e){const{viewScaleInfo:n}=e,{x:i,y:o,w:a,h:r,angle:l}=t,{scale:s,offsetTop:c,offsetLeft:h}=n;return{x:i*s+h,y:o*s+c,w:a*s,h:r*s,angle:l}}function pt(t,e){const{viewScaleInfo:n}=e,{x:i,y:o}=t,{scale:a,offsetTop:r,offsetLeft:l}=n;return{x:i*a+l,y:o*a+r}}function yt(t,e){const{context2d:n,element:i,viewScaleInfo:o}=e,{angle:a=0}=i,{x:r,y:l,w:s,h:c}=gt(i,{viewScaleInfo:o}),h=function(t){const{angle:e=0}=t;return st(t,at(t),e)}({x:r,y:l,w:s,h:c,angle:a});if(h.length>=2){n.beginPath(),n.moveTo(h[0].x,h[0].y);for(let t=1;t<h.length;t++)n.lineTo(h[t].x,h[t].y);n.closePath()}return!!n.isPointInPath(t.x,t.y)}function wt(t,e){const{groupQueue:n}=e,i=function(t,e){return dt(t,e).pop()||null}(t,{groupQueue:n}),o=G(i[0],i[1]),a=G(i[1],i[2]),r=G(i[2],i[3]),l=G(i[3],i[0]),s=i[0],c=i[1],h=i[2],f=i[3],u=Math.max(s.x,c.x,h.x,f.x),d=Math.max(s.y,c.y,h.y,f.y);return{center:{x:(u+Math.min(s.x,c.x,h.x,f.x))/2,y:(d+Math.min(s.y,c.y,h.y,f.y))/2},topLeft:s,topRight:c,bottomLeft:f,bottomRight:h,top:o,right:a,left:l,bottom:r}}function mt(t){const e=Math.max(t.topLeft.x,t.topRight.x,t.bottomRight.x,t.bottomLeft.x),n=Math.max(t.topLeft.y,t.topRight.y,t.bottomRight.y,t.bottomLeft.y),i=Math.min(t.topLeft.x,t.topRight.x,t.bottomRight.x,t.bottomLeft.x),o=Math.min(t.topLeft.y,t.topRight.y,t.bottomRight.y,t.bottomLeft.y),a={x:t.center.x,y:t.center.y},r={x:i,y:o},l={x:e,y:o},s={x:e,y:n},c={x:i,y:n},h=G(r,l),f=G(c,s),u=G(r,c);return{center:a,topLeft:r,topRight:l,bottomLeft:c,bottomRight:s,top:h,right:G(l,s),left:u,bottom:f}}function vt(t){let e="";return t.forEach((t=>{e+=t.type+t.params.join(" ")})),e}J=new WeakMap,K=new WeakMap,Z=new WeakMap,q=new WeakSet,_=function(){return E(et(this,K,"f"))};const xt={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function bt(t,e){const{viewScaleInfo:n}=e,{scale:i}=n;let{borderRadius:o}=t.detail;const{borderDash:a}=t.detail,r=Array.isArray(a)&&a.length>0,{boxSizing:l=xt.boxSizing,borderWidth:s}=t.detail;Array.isArray(s)&&(o=0);let{x:c,y:h,w:f,h:u}=t,d=[0,0,0,0];if("number"==typeof o){const t=o*i;d=[t,t,t,t]}else Array.isArray(o)&&4===(null==o?void 0:o.length)&&(d=[o[0]*i,o[1]*i,o[2]*i,o[3]*i]);let g=0;return"number"==typeof s&&(g=(s||0)*i),"border-box"!==l||r?"content-box"===l?(c=t.x-g/2,h=t.y-g/2,f=t.w+g,u=t.h+g):(c=t.x,h=t.y,f=t.w,u=t.h):(c=t.x+g/2,h=t.y+g/2,f=t.w-g,u=t.h-g),f=Math.max(f,1),u=Math.max(u,1),d=d.map((t=>Math.min(t,f/2,u/2))),{x:c,y:h,w:f,h:u,radiusList:d}}const St=["-apple-system",'"system-ui"',' "Segoe UI"'," Roboto",'"Helvetica Neue"',"Arial",'"Noto Sans"'," sans-serif"];function It(t){return[t,...St].join(", ")}function Mt(t,e,n){if("string"==typeof e)return e;const{viewElementSize:i,viewScaleInfo:o,opacity:a=1}=n,{x:r,y:l}=i,{scale:s}=o;if("linear-gradient"===(null==e?void 0:e.type)){const{start:n,end:i,stops:o}=e,c={x:r+n.x*s,y:l+n.y*s},h={x:r+i.x*s,y:l+i.y*s},f=t.createLinearGradient(c.x,c.y,h.x,h.y);return o.forEach((t=>{f.addColorStop(t.offset,A(t.color,a))})),f}if("radial-gradient"===(null==e?void 0:e.type)){const{inner:n,outer:i,stops:o}=e,c={x:r+n.x*s,y:l+n.y*s,radius:n.radius*s},h={x:r+i.x*s,y:l+i.y*s,radius:i.radius*s},f=t.createRadialGradient(c.x,c.y,c.radius,h.x,h.y,h.radius);return o.forEach((t=>{f.addColorStop(t.offset,A(t.color,a))})),f}return"#000000"}const Pt={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function Ct(t){var e,n,i,o;let a=1;return void 0!==(null==(e=null==t?void 0:t.detail)?void 0:e.opacity)&&(null==(n=null==t?void 0:t.detail)?void 0:n.opacity)>=0&&(null==(i=null==t?void 0:t.detail)?void 0:i.opacity)<=1&&(a=null==(o=null==t?void 0:t.detail)?void 0:o.opacity),a}function Rt(t,e,n){const{pattern:i,renderContent:o,originElem:a,calcElemSize:r,viewScaleInfo:l,viewSizeInfo:s}=n||{},{parentOpacity:c}=n,h=Ct(a)*c,{clipPath:f,clipPathStrokeColor:u,clipPathStrokeWidth:d}=a.detail,g=()=>{t.globalAlpha=h,At(t,e,{pattern:i,viewScaleInfo:l,viewSizeInfo:s}),null==o||o(),Tt(t,e,{viewScaleInfo:l}),t.globalAlpha=c};f?(function(t,e,n){const{renderContent:i,originElem:o,calcElemSize:a,viewSizeInfo:r}=n,l=r.devicePixelRatio,{clipPath:s}=(null==o?void 0:o.detail)||{};if(s&&a&&s.commands){const{x:n,y:o,w:r,h:c}=a,{originW:h,originH:f,originX:u,originY:d}=s,g=r/h,p=c/f,y=n-u*g,w=o-d*p;t.save(),t.translate(y,w),t.scale(l*g,l*p);const m=vt(s.commands||[]),v=new Path2D(m);t.clip(v),t.translate(0-y,0-w),t.setTransform(1,0,0,1,0,0),ot(t,{...e},(()=>{null==i||i()})),t.restore()}else null==i||i()}(t,e,{originElem:a,calcElemSize:r,viewSizeInfo:s,renderContent:()=>{g()}}),"number"==typeof d&&d>0&&u&&function(t,e,n){const{renderContent:i,originElem:o,calcElemSize:a,viewSizeInfo:r,parentOpacity:l}=n,s=r.devicePixelRatio,{clipPath:c,clipPathStrokeColor:h,clipPathStrokeWidth:f}=(null==o?void 0:o.detail)||{};if(c&&a&&c.commands&&"number"==typeof f&&f>0&&h){const{x:n,y:o,w:r,h:u}=a,{originW:d,originH:g,originX:p,originY:y}=c,w=r/d,m=u/g,v=n-p*w,x=o-y*m;t.save(),t.globalAlpha=l,t.translate(v,x),t.scale(s*w,s*m);const b=vt(c.commands||[]),S=new Path2D(b);t.strokeStyle=h,t.lineWidth=f,t.stroke(S),t.translate(0-v,0-x),t.setTransform(1,0,0,1,0,0),ot(t,{...e},(()=>{null==i||i()})),t.restore()}else null==i||i()}(t,e,{originElem:a,calcElemSize:r,viewSizeInfo:s,parentOpacity:c})):g()}function At(t,e,n){var i,o;const{pattern:a,viewScaleInfo:r,viewSizeInfo:l}=n,s=[];if(e.detail.background||a){const{x:n,y:l,w:c,h:h,radiusList:f}=bt(e,{viewScaleInfo:r});if(t.beginPath(),t.moveTo(n+f[0],l),t.arcTo(n+c,l,n+c,l+h,f[1]),t.arcTo(n+c,l+h,n,l+h,f[2]),t.arcTo(n,l+h,n,l,f[3]),t.arcTo(n,l,n+c,l,f[0]),t.closePath(),"string"==typeof a)t.fillStyle=a;else if(["CanvasPattern"].includes(O.type(a)))t.fillStyle=a;else if("string"==typeof e.detail.background)t.fillStyle=e.detail.background;else if("linear-gradient"===(null==(i=e.detail.background)?void 0:i.type)){const i=Mt(t,e.detail.background,{viewElementSize:{x:n,y:l,w:c,h:h},viewScaleInfo:r,opacity:t.globalAlpha});t.fillStyle=i}else if("radial-gradient"===(null==(o=e.detail.background)?void 0:o.type)){const i=Mt(t,e.detail.background,{viewElementSize:{x:n,y:l,w:c,h:h},viewScaleInfo:r,opacity:t.globalAlpha});if(t.fillStyle=i,s&&s.length>0)for(let e=0;e<(null==s?void 0:s.length);e++){const i=s[e];"translate"===i.method?t.translate(i.args[0]+n,i.args[1]+l):"rotate"===i.method?t.rotate(...i.args):"scale"===i.method&&t.scale(...i.args)}}t.fill(),s&&s.length>0&&t.setTransform(1,0,0,1,0,0)}}function Tt(t,e,n){if(0===e.detail.borderWidth)return;if(!R(e.detail.borderColor))return;const{viewScaleInfo:i}=n,{scale:o}=i;let a=Pt.borderColor;!0===R(e.detail.borderColor)&&(a=e.detail.borderColor);const{borderDash:r,borderWidth:l,borderRadius:s,boxSizing:c=Pt.boxSizing}=e.detail;let h=[];Array.isArray(r)&&r.length>0&&(h=r.map((t=>Math.ceil(t*o)))),h.length>0?t.lineCap="butt":t.lineCap="square";let f=[0,0,0,0];if("number"==typeof s){const t=s*o;f=[t,t,t,t]}else Array.isArray(s)&&4===(null==s?void 0:s.length)&&(f=[s[0]*o,s[1]*o,s[2]*o,s[3]*o]);let u=0;"number"==typeof l&&(u=l||1),u*=o,t.strokeStyle=a;let d=0,g=0,p=0,y=0;if(Array.isArray(l)&&(d=(l[0]||0)*o,g=(l[1]||0)*o,p=(l[2]||0)*o,y=(l[3]||0)*o),y||g||d||p){t.lineCap="butt";let{x:n,y:i,w:o,h:a}=e;"border-box"===c?(n+=y/2,i+=d/2,o=o-y/2-g/2,a=a-d/2-p/2):"content-box"===c?(n-=y/2,i-=d/2,o=o+y/2+g/2,a=a+d/2+p/2):(n=e.x,i=e.y,o=e.w,a=e.h),d&&(t.beginPath(),t.lineWidth=d,t.moveTo(n-y/2,i),t.lineTo(n+o+g/2,i),t.closePath(),t.stroke()),g&&(t.beginPath(),t.lineWidth=g,t.moveTo(n+o,i-d/2),t.lineTo(n+o,i+a+p/2),t.closePath(),t.stroke()),p&&(t.beginPath(),t.lineWidth=p,t.moveTo(n-y/2,i+a),t.lineTo(n+o+g/2,i+a),t.closePath(),t.stroke()),y&&(t.beginPath(),t.lineWidth=y,t.moveTo(n,i-d/2),t.lineTo(n,i+a+p/2),t.closePath(),t.stroke())}else{let{x:n,y:i,w:o,h:a}=e;"border-box"===c?(n=e.x+u/2,i=e.y+u/2,o=e.w-u,a=e.h-u):"content-box"===c?(n=e.x-u/2,i=e.y-u/2,o=e.w+u,a=e.h+u):(n=e.x,i=e.y,o=e.w,a=e.h),o=Math.max(o,1),a=Math.max(a,1),f=f.map((t=>Math.min(t,o/2,a/2))),t.setLineDash(h),t.lineWidth=u,t.beginPath(),t.moveTo(n+f[0],i),t.arcTo(n+o,i,n+o,i+a,f[1]),t.arcTo(n+o,i+a,n,i+a,f[2]),t.arcTo(n,i+a,n,i,f[3]),t.arcTo(n,i,n+o,i,f[0]),t.closePath(),t.stroke()}t.setLineDash([])}function zt(t,e,n){const{detail:i}=e,{viewScaleInfo:o,renderContent:a}=n,{shadowColor:r,shadowOffsetX:l,shadowOffsetY:s,shadowBlur:c}=i;H.number(c)?(t.save(),t.shadowColor=r||Pt.shadowColor,t.shadowOffsetX=(l||0)*o.scale,t.shadowOffsetY=(s||0)*o.scale,t.shadowBlur=(c||0)*o.scale,a(),t.restore()):(t.save(),t.shadowColor="transparent",t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0,a(),t.restore())}function kt(t,e,n){const{detail:i,angle:o}=e,{viewScaleInfo:a,viewSizeInfo:r,parentOpacity:l}=n,{background:s="#000000",borderColor:c="#000000",boxSizing:h,borderWidth:f=0,borderDash:u}=i;let d=0;"number"==typeof f&&f>0?d=f:Array.isArray(f)&&"number"==typeof f[0]&&f[0]>0&&(d=f[0]),d*=a.scale;const{x:g,y:p,w:y,h:w}=gt({x:e.x,y:e.y,w:e.w,h:e.h},{viewScaleInfo:a})||e,m={...e,x:g,y:p,w:y,h:w,angle:o};ot(t,{x:g,y:p,w:y,h:w,angle:o},(()=>{zt(t,m,{viewScaleInfo:a,renderContent:()=>{let e=y/2,n=w/2;const i=g+e,o=p+n,r=e,f=n;if(d>0&&("content-box"===h||("center-line"===h?(e-=d/2,n-=d/2):(e-=d,n-=d))),e>=0&&n>=0){const h=Ct(m)*l;t.globalAlpha=h,t.beginPath();const v=Mt(t,s,{viewElementSize:{x:g,y:p,w:y,h:w},viewScaleInfo:a,opacity:t.globalAlpha});if(t.fillStyle=v,t.circle(i,o,r,f,0,0,2*Math.PI),t.closePath(),t.fill(),t.globalAlpha=l,"number"==typeof d&&d>0){const r=d/2+e,l=d/2+n;if(t.beginPath(),u){const e=u.map((t=>t*a.scale));t.setLineDash(e)}t.strokeStyle=c,t.lineWidth=d,t.circle(i,o,r,l,0,0,2*Math.PI),t.closePath(),t.stroke(),t.setLineDash([])}}}})}))}function Et(t,e,n){const{viewScaleInfo:i,viewSizeInfo:o,parentOpacity:a}=n,{x:r,y:l,w:s,h:c,angle:h}=gt(e,{viewScaleInfo:i})||e,f={...e,x:r,y:l,w:s,h:c,angle:h};ot(t,{x:r,y:l,w:s,h:c,angle:h},(()=>{zt(t,f,{viewScaleInfo:i,renderContent:()=>{Rt(t,f,{originElem:e,calcElemSize:{x:r,y:l,w:s,h:c,angle:h},viewScaleInfo:i,viewSizeInfo:o,parentOpacity:a,renderContent:()=>{}})}})}))}function Lt(t,e,n){const i=n.loader.getContent(e),{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:r}=n,{x:l,y:s,w:c,h:h,angle:f}=gt(e,{viewScaleInfo:o})||e,u={...e,x:l,y:s,w:c,h:h,angle:f};ot(t,{x:l,y:s,w:c,h:h,angle:f},(()=>{zt(t,u,{viewScaleInfo:o,renderContent:()=>{Rt(t,u,{originElem:e,calcElemSize:{x:l,y:s,w:c,h:h,angle:f},viewScaleInfo:o,viewSizeInfo:a,parentOpacity:r,renderContent:()=>{if(i||n.loader.isDestroyed()||n.loader.load(e,n.elementAssets||{}),"image"===e.type&&i){t.globalAlpha=Ct(e)*r;const{x:n,y:a,w:l,h:s,radiusList:c}=bt(u,{viewScaleInfo:o}),{detail:h}=e,{scaleMode:f,originW:d=0,originH:g=0}=h,p=t.$undoPixelRatio(d),y=t.$undoPixelRatio(g);if(t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(n+c[0],a),t.arcTo(n+l,a,n+l,a+s,c[1]),t.arcTo(n+l,a+s,n,a+s,c[2]),t.arcTo(n,a+s,n,a,c[3]),t.arcTo(n,a,n+l,a,c[0]),t.closePath(),t.fill(),t.clip(),f&&g&&d){let o=0,r=0,c=p,h=y;const u=n,d=a,g=l,w=s;if(p>e.w||y>e.h)if("fill"===f){const t=Math.max(e.w/p,e.h/y),n=y*t;o=(p*t-e.w)/2/t,r=(n-e.h)/2/t,c=e.w/t,h=e.h/t}else if("tile"===f)o=0,r=0,c=e.w,h=e.h;else if("fit"===f){const t=Math.min(e.w/p,e.h/y);o=(p-e.w/t)/2,r=(y-e.h/t)/2,c=e.w/t,h=e.h/t}t.drawImage(i,o,r,c,h,u,d,g,w)}else t.drawImage(i,n,a,l,s);t.globalAlpha=r,t.restore()}}})}})}))}function Ot(t,e,n){const i=n.loader.getContent(e),{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:r}=n,{x:l,y:s,w:c,h:h,angle:f}=gt(e,{viewScaleInfo:o})||e;ot(t,{x:l,y:s,w:c,h:h,angle:f},(()=>{i||n.loader.isDestroyed()||n.loader.load(e,n.elementAssets||{}),"svg"===e.type&&i&&(t.globalAlpha=Ct(e)*r,t.drawImage(i,l,s,c,h),t.globalAlpha=r)}))}function Wt(t,e,n){const i=n.loader.getContent(e),{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:r}=n,{x:l,y:s,w:c,h:h,angle:f}=gt(e,{viewScaleInfo:o})||e;ot(t,{x:l,y:s,w:c,h:h,angle:f},(()=>{i||n.loader.isDestroyed()||n.loader.load(e,n.elementAssets||{}),"html"===e.type&&i&&(t.globalAlpha=Ct(e)*r,t.drawImage(i,l,s,c,h),t.globalAlpha=r)}))}const $t={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function Ft(t,e,n){const{viewScaleInfo:i,viewSizeInfo:o,parentOpacity:a,calculator:r}=n,{x:l,y:s,w:c,h:h,angle:f}=gt(e,{viewScaleInfo:i})||e,u={...e,x:l,y:s,w:c,h:h,angle:f};ot(t,{x:l,y:s,w:c,h:h,angle:f},(()=>{var n,d;zt(t,u,{viewScaleInfo:i,renderContent:()=>{Rt(t,u,{originElem:e,calcElemSize:{x:l,y:s,w:c,h:h,angle:f},viewScaleInfo:i,viewSizeInfo:o,parentOpacity:a})}});{const o={...$t,...e.detail},a=(o.fontSize||$t.fontSize)*i.scale;if(a<2)return;t.fillStyle=e.detail.color||$t.color,t.textBaseline="top",t.$setFont({fontWeight:o.fontWeight,fontSize:a,fontFamily:It(o.fontFamily)});{const a=r.getVirtualFlatItem(e.uuid);Array.isArray(null==a?void 0:a.textLines)&&(null==(n=null==a?void 0:a.textLines)?void 0:n.length)>0&&(void 0!==o.textShadowColor&&R(o.textShadowColor)&&(t.shadowColor=o.textShadowColor),void 0!==o.textShadowOffsetX&&H.number(o.textShadowOffsetX)&&(t.shadowOffsetX=o.textShadowOffsetX),void 0!==o.textShadowOffsetY&&H.number(o.textShadowOffsetY)&&(t.shadowOffsetY=o.textShadowOffsetY),void 0!==o.textShadowBlur&&H.number(o.textShadowBlur)&&(t.shadowBlur=o.textShadowBlur),null==(d=null==a?void 0:a.textLines)||d.forEach((e=>{t.fillText(e.text,l+e.x*i.scale,s+e.y*i.scale)})))}}}))}function Dt(t,e,n){var i,o,a;if(!0===(null==(i=null==e?void 0:e.operations)?void 0:i.invisible))return;const{w:r,h:l}=e,{scale:s}=n.viewScaleInfo;if(s<1&&(r*s<.4||l*s<.4)||0===n.parentOpacity)return;const{overrideElementMap:c}=n;if(!(null==(a=null==(o=null==c?void 0:c[e.uuid])?void 0:o.operations)?void 0:a.invisible))try{switch(e.type){case"rect":Et(t,e,n);break;case"circle":kt(t,e,n);break;case"text":Ft(t,e,n);break;case"image":Lt(t,e,n);break;case"svg":Ot(t,e,n);break;case"html":Wt(t,e,n);break;case"path":!function(t,e,n){var i,o;const{detail:a}=e,{originX:r,originY:l,originW:s,originH:c,fillRule:h}=a,{viewScaleInfo:f,viewSizeInfo:u,parentOpacity:d}=n,{x:g,y:p,w:y,h:w,angle:m}=gt(e,{viewScaleInfo:f})||e,v=y/s,x=w/c,b=g-r*v,S=p-l*x,{clipPath:I,clipPathStrokeColor:M,clipPathStrokeWidth:P,...C}=e.detail,R=f.scale*u.devicePixelRatio,A={...e,x:g,y:p,w:y,h:w,angle:m};let T={...A};T.detail=C;let z={...e};z.detail=C,a.fill&&"string"!==a.fill&&(null==(o=null==(i=a.fill)?void 0:i.type)?void 0:o.includes("gradient"))&&(T={...A,detail:{...A.detail,background:a.fill,clipPath:{commands:a.commands,originX:r,originY:l,originW:s,originH:c}}},z.detail={...T.detail}),ot(t,{x:g,y:p,w:y,h:w,angle:m},(()=>{Rt(t,T,{originElem:z,calcElemSize:{x:g,y:p,w:y,h:w,angle:m},viewScaleInfo:f,viewSizeInfo:u,parentOpacity:d,renderContent:()=>{zt(t,A,{viewScaleInfo:f,renderContent:()=>{t.save(),t.translate(b,S),t.scale(R*v/f.scale,R*x/f.scale);const e=vt(a.commands||[]),n=new Path2D(e);a.fill&&("string"==typeof a.fill?t.fillStyle=a.fill:t.fillStyle="transparent"),a.fill&&t.fill(n,h),a.stroke&&0!==a.strokeWidth&&(t.strokeStyle=a.stroke,t.lineWidth=(a.strokeWidth||1)/u.devicePixelRatio,t.lineCap=a.strokeLineCap||"square",t.stroke(n)),t.translate(-b,-S),t.restore()}})}})}))}(t,e,n);break;case"group":{const i={...n.elementAssets||{},...e.detail.assets||{}};Bt(t,e,{...n,elementAssets:i});break}}}catch(t){console.error(t)}}function Bt(t,e,n){const{viewScaleInfo:i,viewSizeInfo:o,parentOpacity:a}=n,{x:r,y:l,w:s,h:c,angle:h}=gt({x:e.x,y:e.y,w:e.w,h:e.h,angle:e.angle},{viewScaleInfo:i})||e,f={...e,x:r,y:l,w:s,h:c,angle:h};ot(t,{x:r,y:l,w:s,h:c,angle:h},(()=>{t.globalAlpha=Ct(e)*a,zt(t,f,{viewScaleInfo:i,renderContent:()=>{Rt(t,f,{originElem:e,calcElemSize:{x:r,y:l,w:s,h:c,angle:h},viewScaleInfo:i,viewSizeInfo:o,parentOpacity:a,renderContent:()=>{const{x:o,y:r,w:l,h:s,radiusList:c}=bt(f,{viewScaleInfo:i});if("hidden"===e.detail.overflow&&(t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(o+c[0],r),t.arcTo(o+l,r,o+l,r+s,c[1]),t.arcTo(o+l,r+s,o,r+s,c[2]),t.arcTo(o,r+s,o,r,c[3]),t.arcTo(o,r,o+l,r,c[0]),t.closePath(),t.fill(),t.clip()),Array.isArray(e.detail.children)){const{parentElementSize:i}=n,o={x:i.x+e.x,y:i.y+e.y,w:e.w||i.w,h:e.h||i.h,angle:e.angle},{calculator:r}=n;for(let i=0;i<e.detail.children.length;i++){let l=e.detail.children[i];if(l={...l,x:o.x+l.x,y:o.y+l.y},!0===n.forceDrawAll||(null==r?void 0:r.needRender(l)))try{Dt(t,l,{...n,parentOpacity:a*Ct(e)})}catch(t){console.error(t)}}}"hidden"===e.detail.overflow&&t.restore()}})}}),t.globalAlpha=a}))}const Vt={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function jt(t,e,n){var i;const{elements:o=[]}=e,{parentOpacity:a}=n;for(let e=0;e<o.length;e++){const r=o[e],l={...r,detail:{...Vt,...null==r?void 0:r.detail}};if(!0===n.forceDrawAll||(null==(i=n.calculator)?void 0:i.needRender(l)))try{Dt(t,l,{...n,parentOpacity:a})}catch(t){console.error(t)}}}function Xt(t,e,n,i){const{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:r}=n,l={uuid:"layout",type:"group",...e},{x:s,y:c,w:h,h:f}=gt(l,{viewScaleInfo:o})||l,u={...l,x:s,y:c,w:h,h:f,angle:0};if(t.globalAlpha=1,zt(t,u,{viewScaleInfo:o,renderContent:()=>{At(t,u,{viewScaleInfo:o,viewSizeInfo:a})}}),"hidden"===e.detail.overflow){const{viewScaleInfo:i,viewSizeInfo:o}=n,a={uuid:"layout",type:"group",...e},r=gt(a,{viewScaleInfo:i})||a,l={...a,...r},{x:s,y:c,w:h,h:f,radiusList:u}=bt(l,{viewScaleInfo:i});t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(s+u[0],c),t.arcTo(s+h,c,s+h,c+f,u[1]),t.arcTo(s+h,c+f,s,c+f,u[2]),t.arcTo(s,c+f,s,c,u[3]),t.arcTo(s,c,s+h,c,u[0]),t.closePath(),t.fill(),t.clip()}i(t),"hidden"===e.detail.overflow&&t.restore(),Tt(t,u,{viewScaleInfo:o}),t.globalAlpha=r}function Yt(t,e,n){if("string"==typeof(null==e?void 0:e.background)){const{viewSizeInfo:i}=n,{width:o,height:a}=i;t.globalAlpha=1,t.fillStyle=e.background,t.fillRect(0,0,o,a)}}const Ht=["image","svg","html"],Ut=t=>{var e,n,i;let o=null;return"image"===t.type?o=(null==(e=null==t?void 0:t.detail)?void 0:e.src)||null:"svg"===t.type?o=(null==(n=null==t?void 0:t.detail)?void 0:n.svg)||null:"html"===t.type&&(o=(null==(i=null==t?void 0:t.detail)?void 0:i.html)||null),"string"==typeof o&&o?/^@assets\/[0-9a-z]{8,8}\-[0-9a-z]{4,4}\-[0-9a-z]{4,4}\-[0-9a-z]{4,4}\-[0-9a-z]{12,12}$/.test(`${o}`)?o:k(o):k(`${T()}-${t.uuid}-${T()}-${T()}`)};class Nt extends Q{constructor(){super(),M(this,a),M(this,e,{}),M(this,n,{}),M(this,i,{}),M(this,o,!1),C(this,a,r).call(this,"image",(async(t,e)=>{var n;const i=(null==(n=e[t.detail.src])?void 0:n.value)||t.detail.src,o=await F(i);return{uuid:t.uuid,lastModified:Date.now(),content:o}})),C(this,a,r).call(this,"html",(async(t,e)=>{var n;const i=(null==(n=e[t.detail.html])?void 0:n.value)||t.detail.html,o=await B(i,{width:t.detail.originW||t.w,height:t.detail.originH||t.h});return{uuid:t.uuid,lastModified:Date.now(),content:o}})),C(this,a,r).call(this,"svg",(async(t,e)=>{var n;const i=(null==(n=e[t.detail.svg])?void 0:n.value)||t.detail.svg,o=await D(i);return{uuid:t.uuid,lastModified:Date.now(),content:o}}))}isDestroyed(){return I(this,o)}destroy(){P(this,o,!0),this.clear(),P(this,e,null),P(this,n,null),P(this,i,null)}load(t,e){!0!==I(this,o)&&(C(this,a,u).call(this,t)||Ht.includes(t.type)&&C(this,a,f).call(this,t,e))}getContent(t){var e,n;const o=Ut(t);return(null==(n=null==(e=I(this,i))?void 0:e[o])?void 0:n.content)||null}getLoadItemMap(){return I(this,i)}setLoadItemMap(t){P(this,i,t)}}e=new WeakMap,n=new WeakMap,i=new WeakMap,o=new WeakMap,a=new WeakSet,r=function(t,n){I(this,e)[t]=n},l=function(t){var e,n,i;let o=null;return"image"===t.type?o=(null==(e=null==t?void 0:t.detail)?void 0:e.src)||null:"svg"===t.type?o=(null==(n=null==t?void 0:t.detail)?void 0:n.svg)||null:"html"===t.type&&(o=(null==(i=null==t?void 0:t.detail)?void 0:i.html)||null),o},s=function(t){return{element:t,status:"null",content:null,error:null,startTime:-1,endTime:-1,source:C(this,a,l).call(this,t)}},c=function(t){const e=Ut(t.element),n=I(this,i)[e];I(this,o)||(n?n.startTime<t.startTime&&(I(this,i)[e]=t,this.trigger("load",{...t,countTime:t.endTime-t.startTime})):(I(this,i)[e]=t,this.trigger("load",{...t,countTime:t.endTime-t.startTime})))},h=function(t){var e;const n=Ut(t.element),a=null==(e=I(this,i))?void 0:e[n];I(this,o)||(a?a.startTime<t.startTime&&(I(this,i)[n]=t,this.trigger("error",{...t,countTime:t.endTime-t.startTime})):(I(this,i)[n]=t,this.trigger("error",{...t,countTime:t.endTime-t.startTime})))},f=function(t,i){const r=C(this,a,s).call(this,t),l=Ut(t);if(I(this,n)[l])return;I(this,n)[l]=r;const f=I(this,e)[t.type];"function"!=typeof f||I(this,o)||(r.startTime=Date.now(),f(t,i).then((t=>{I(this,o)||(r.content=t.content,r.endTime=Date.now(),r.status="load",C(this,a,c).call(this,r))})).catch((e=>{console.warn(`Load element source "${r.source}" fail`,e,t),r.endTime=Date.now(),r.status="error",r.error=e,C(this,a,h).call(this,r)})))},u=function(t){var e;const i=Ut(t),o=null==(e=I(this,n))?void 0:e[i];return!(!o||"error"!==o.status||!o.source||o.source!==C(this,a,l).call(this,t))};const Qt={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function Gt(t,e){let n={};return"text"===t.type&&(n=function(t,e){const{w:n,h:i}=t,o=e.tempContext,a=[],r={...Qt,...t.detail},l=r.fontSize||Qt.fontSize,s=l;if(s<2)return{};const c=r.lineHeight||l;o.textBaseline="top",o.$setFont({fontWeight:r.fontWeight,fontSize:s,fontFamily:It(r.fontFamily)});let h=r.text.replace(/\r\n/gi,"\n");"lowercase"===r.textTransform?h=h.toLowerCase():"uppercase"===r.textTransform&&(h=h.toUpperCase());const f=c,u=h.split("\n");let d=0;u.forEach(((t,e)=>{if("maxContent"===r.minInlineSize)a.push({x:0,y:0,text:t,width:o.$undoPixelRatio(o.measureText(t).width)});else{let l="",s="",c=t.split(s);if("normal"===r.wordBreak){s=" ";const e=t.split(s);c=[],e.forEach(((t,n)=>{c.push(t),n<e.length-1&&c.push(s)}))}if(1===c.length&&"visible"===r.overflow)a.push({x:0,y:0,text:c[0],width:o.$undoPixelRatio(o.measureText(c[0]).width)});else if(c.length>0){for(let t=0;t<c.length&&(o.$doPixelRatio(n)>=o.measureText(l+c[t]).width?l+=c[t]||"":(a.push({x:0,y:0,text:l,width:o.$undoPixelRatio(o.measureText(l).width)}),l=c[t]||"",d++),!((d+1)*f>i&&"hidden"===r.overflow));t++)if(c.length-1===t&&(d+1)*f<=i){a.push({x:0,y:0,text:l,width:o.$undoPixelRatio(o.measureText(l).width)}),e<u.length-1&&d++;break}}else a.push({x:0,y:0,text:"",width:0})}}));let g=0,p=0;f>s&&(p=(f-s)/2),a.length*f<i&&("top"===t.detail.verticalAlign?g=0:"bottom"===t.detail.verticalAlign?g+=i-a.length*f:g+=(i-a.length*f)/2);{const t=0+g;a.forEach(((e,i)=>{let o=0;"center"===r.textAlign?o=0+(n-e.width)/2:"right"===r.textAlign&&(o=n-e.width+0),a[i].x=o,a[i].y=t+f*i+p}))}return{textLines:a}}(t,e)),n}function qt(t,e){const{viewScaleInfo:n,viewSizeInfo:i,tempContext:o}=e,a=function(t,e){const n={},i=[],o=a=>{const r={type:a.type,isVisibleInView:!0,position:[...i]};let l=null;l=wt(a,{groupQueue:ht(t,i)||[]});const s={...r,originRectInfo:l,rangeRectInfo:H.angle(a.angle)?mt(l):l,...Gt(a,e)};n[a.uuid]=s,"group"===a.type&&a.detail.children.forEach(((t,e)=>{i.push(e),o(t),i.pop()}))};return t.forEach(((t,e)=>{i.push(e),o(t),i.pop()})),n}(t,{tempContext:o});return Jt(a,{viewScaleInfo:n,viewSizeInfo:i})}function Jt(t,e){const n=function(t){const{viewScaleInfo:e,viewSizeInfo:n}=t,{scale:i,offsetTop:o,offsetLeft:a}=e,{width:r,height:l}=n,s=0-a/i,c=0-o/i,h=r/i,f=l/i,u=at({x:s,y:c,w:h,h:f}),d={x:s,y:c},g={x:s+h,y:c},p={x:s,y:c+f},y={x:s+h,y:c+f},w={x:s,y:u.y},m={x:u.x,y:c},v={x:s+h,y:u.y},x={x:u.x,y:c+f};return{center:u,topLeft:d,topRight:g,bottomLeft:p,bottomRight:y,left:w,top:m,right:v,bottom:x}}(e);let i=0,o=0;return Object.keys(t).forEach((e=>{const a=t[e];a.isVisibleInView=function(t,e){const n=Math.min(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),i=Math.max(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),o=Math.min(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y),a=Math.max(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y),r=Math.min(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),l=Math.max(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),s=Math.min(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y),c=Math.max(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y);return n<=l&&i>=r&&o<=c&&a>=s||l<=a&&l>=a&&l<=a&&l>=a}(a.rangeRectInfo,n),a.isVisibleInView?i++:o++})),{virtualFlatItemMap:t,visibleCount:i,invisibleCount:o}}class Kt{constructor(t){M(this,d),M(this,g),P(this,d,t),P(this,g,new nt({defaultStorage:{virtualFlatItemMap:{},visibleCount:0,invisibleCount:0}}))}toGridNum(t,e){return!0===(null==e?void 0:e.ignore)?t:Math.round(t)}destroy(){P(this,d,null)}needRender(t){const e=I(this,g).get("virtualFlatItemMap")[t.uuid];return!e||e.isVisibleInView}getPointElement(t,e){return function(t,e){var n,i,o;const{context2d:a,data:r,viewScaleInfo:l,groupQueue:s}=e,c={index:-1,element:null,groupQueueIndex:-1};if(s&&Array.isArray(s)&&(null==s?void 0:s.length)>0)for(let e=s.length-1;e>=0;e--){let o=0,r=0,h=0;for(let t=0;t<=e;t++)o+=s[t].x,r+=s[t].y,h+=s[t].angle||0;const f=s[e];if(f&&"group"===f.type&&Array.isArray(null===(n=f.detail)||void 0===n?void 0:n.children))for(let n=0;n<f.detail.children.length;n++){const u=f.detail.children[n];if(!0!==(null===(i=null==u?void 0:u.operations)||void 0===i?void 0:i.invisible)){if(!u)break;if(yt(t,{context2d:a,element:{x:o+u.x,y:r+u.y,w:u.w,h:u.h,angle:h+(u.angle||0)},viewScaleInfo:l})){c.element=u,(e<s.length-1||"group"!==u.type)&&(c.groupQueueIndex=e);break}}}if(c.element)break}if(c.element)return c;for(let e=r.elements.length-1;e>=0;e--){const n=r.elements[e];if(!0!==(null===(o=null==n?void 0:n.operations)||void 0===o?void 0:o.invisible)&&yt(t,{context2d:a,element:n,viewScaleInfo:l})){c.index=e,c.element=n;break}}return c}(t,{...e,context2d:I(this,d).tempContext})}resetVirtualFlatItemMap(t,e){if(t){const{virtualFlatItemMap:n,invisibleCount:i,visibleCount:o}=qt(t.elements,{...e,tempContext:I(this,d).tempContext});I(this,g).set("virtualFlatItemMap",n),I(this,g).set("invisibleCount",i),I(this,g).set("visibleCount",o)}}updateVisiableStatus(t){const{virtualFlatItemMap:e,invisibleCount:n,visibleCount:i}=Jt(I(this,g).get("virtualFlatItemMap"),t);I(this,g).set("virtualFlatItemMap",e),I(this,g).set("invisibleCount",n),I(this,g).set("visibleCount",i)}calcViewRectInfoFromOrigin(t,e){const n=I(this,g).get("virtualFlatItemMap")[t];if(!(null==n?void 0:n.originRectInfo))return null;const{checkVisible:i,viewScaleInfo:o,viewSizeInfo:a}=e,{center:r,left:l,right:s,bottom:c,top:h,topLeft:f,topRight:u,bottomLeft:d,bottomRight:p}=n.originRectInfo;if(!0===i&&!1===n.isVisibleInView)return null;const y={viewScaleInfo:o};return{center:pt(r,y),left:pt(l,y),right:pt(s,y),bottom:pt(c,y),top:pt(h,y),topLeft:pt(f,y),topRight:pt(u,y),bottomLeft:pt(d,y),bottomRight:pt(p,y)}}calcViewRectInfoFromRange(t,e){const n=I(this,g).get("virtualFlatItemMap")[t];if(!(null==n?void 0:n.originRectInfo))return null;const{checkVisible:i,viewScaleInfo:o,viewSizeInfo:a}=e,{center:r,left:l,right:s,bottom:c,top:h,topLeft:f,topRight:u,bottomLeft:d,bottomRight:p}=n.rangeRectInfo;if(!0===i&&!1===n.isVisibleInView)return null;const y={viewScaleInfo:o};return{center:pt(r,y),left:pt(l,y),right:pt(s,y),bottom:pt(c,y),top:pt(h,y),topLeft:pt(f,y),topRight:pt(u,y),bottomLeft:pt(d,y),bottomRight:pt(p,y)}}modifyVirtualFlatItemMap(t,e){const{modifyOptions:n,viewScaleInfo:i,viewSizeInfo:o}=e,{type:a,content:r}=n,l=t.elements,s=I(this,g).get("virtualFlatItemMap");if("deleteElement"===a){const{element:t}=r,e=[],n=t=>{e.push(t.uuid),"group"===t.type&&Array.isArray(t.detail.children)&&t.detail.children.forEach((t=>{n(t)}))};n(t),e.forEach((t=>{delete s[t]})),I(this,g).set("virtualFlatItemMap",s)}else if("addElement"===a||"updateElement"===a){const{position:e}=r,n=function(t,e){let n=null,i=e;for(let e=0;e<t.length;e++){const o=i[t[e]];if(e<t.length-1&&"group"===o.type)i=o.detail.children;else{if(e!==t.length-1)break;n=o}}return n}(e,t.elements),c=ht(l,e);if(n)if("updateElement"===a&&"group"===n.type)this.resetVirtualFlatItemMap(t,{viewScaleInfo:i,viewSizeInfo:o});else{const t=wt(n,{groupQueue:c||[]}),r={type:n.type,originRectInfo:t,rangeRectInfo:H.angle(n.angle)?mt(t):t,isVisibleInView:!0,position:[...e],...Gt(n,{tempContext:I(this,d).tempContext})};s[n.uuid]=r,I(this,g).set("virtualFlatItemMap",s),"updateElement"===a&&this.updateVisiableStatus({viewScaleInfo:i,viewSizeInfo:o})}}else"moveElement"===a&&this.resetVirtualFlatItemMap(t,{viewScaleInfo:i,viewSizeInfo:o})}getVirtualFlatItem(t){return I(this,g).get("virtualFlatItemMap")[t]||null}}d=new WeakMap,g=new WeakMap;return p=new WeakMap,y=new WeakMap,w=new WeakMap,m=new WeakMap,v=new WeakSet,x=function(){const t=I(this,y);t.on("load",(t=>{this.trigger("load",t)})),t.on("error",(t=>{console.error(t)}))},t.Calculator=Kt,t.Renderer=class extends Q{constructor(t){super(),M(this,v),M(this,p),M(this,y,new Nt),M(this,w),M(this,m,!1),P(this,p,t),P(this,w,new Kt({tempContext:t.tempContext})),C(this,v,x).call(this)}isDestroyed(){return I(this,m)}destroy(){this.clear(),P(this,p,null),I(this,y).destroy(),P(this,y,null),P(this,m,!0)}updateOptions(t){P(this,p,t)}drawData(t,e){const n=I(this,y),i=I(this,w),{sharer:o}=I(this,p),a=I(this,p).viewContext;a.clearRect(0,0,a.canvas.width,a.canvas.height);const r={loader:n,calculator:i,parentElementSize:{x:0,y:0,w:e.viewSizeInfo.width,h:e.viewSizeInfo.height},elementAssets:t.assets,parentOpacity:1,overrideElementMap:null==o?void 0:o.getActiveOverrideElemenentMap(),...e};Yt(a,t.global,r),t.layout?Xt(a,t.layout,r,(()=>{jt(a,t,r)})):jt(a,t,r)}scale(t){const{sharer:e}=I(this,p);if(!e)return;const{data:n,offsetTop:i,offsetBottom:o,offsetLeft:a,offsetRight:r,width:l,height:s,contextHeight:c,contextWidth:h,devicePixelRatio:f}=e.getActiveStoreSnapshot();n&&this.drawData(n,{viewScaleInfo:{scale:t,offsetTop:i,offsetBottom:o,offsetLeft:a,offsetRight:r},viewSizeInfo:{width:l,height:s,contextHeight:c,contextWidth:h,devicePixelRatio:f}})}setLoadItemMap(t){I(this,y).setLoadItemMap(t)}getLoadItemMap(){return I(this,y).getLoadItemMap()}getLoader(){return I(this,y)}getCalculator(){return I(this,w)}},t.drawCircle=kt,t.drawElement=Dt,t.drawElementList=jt,t.drawGlobalBackground=Yt,t.drawGroup=Bt,t.drawHTML=Wt,t.drawImage=Lt,t.drawLayout=Xt,t.drawRect=Et,t.drawSVG=Ot,t.drawText=Ft,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t}({});
|
|
1
|
+
var iDrawRenderer=function(t){"use strict";var e,n,o,i,a,r,l,s,c,h,f,u,d,g,y,p,w,m,v,x,b=t=>{throw TypeError(t)},S=(t,e,n)=>e.has(t)||b("Cannot "+n),I=(t,e,n)=>(S(t,e,"read from private field"),n?n.call(t):e.get(t)),M=(t,e,n)=>e.has(t)?b("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),P=(t,e,n,o)=>(S(t,e,"write to private field"),o?o.call(t,n):e.set(t,n),n),C=(t,e,n)=>(S(t,e,"access private method"),n);function z(t){return"string"==typeof t&&(/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)||/^[a-z]{1,}$/i.test(t))}function R(t,e){if(1===e)return t;let n=1;const o=/^#[0-9a-f]{6,6}$/i;let i=t;if(o.test(t)?n=parseInt(t.substring(5,7).replace(/^#/,"0x")):/^#[0-9a-f]{8,8}$/i.test(t)&&(n=parseInt(t.substring(7,9).replace(/^#/,"0x")),i=t.substring(0,7)),n*=e,o.test(i)&&n>0&&n<1){const t=Math.max(0,Math.min(255,Math.ceil(256*n)));i=`${i.toUpperCase()}${t.toString(16).toUpperCase()}`}return i}function A(t){const e=function(t){let e=0xcbf29ce484222325n,n=0x84222325cbf29ce4n,o=0x1b3n*e,i=0x1000000n*n;const a=0x100000001b3n,r=4096;for(let l=0;l<t.length;l+=r){const s=t.slice(l,l+r);for(let t=0;t<s.length;t++){e=(e^BigInt(s.charCodeAt(t)+l+t))*a,n=(n^e)*a^o,o=(o^n)*a+i,i=(i^o)*a|0x1234567890abcdefn}}return e<<192n|n<<128n|o<<64n|i}(t);return function(t){const e="0123456789abcdefghijklmnopqrstuvwxyz";if(0n===t)return"0";let n="";for(;t>0n;){n=e[Number(t%36n)]+n,t/=36n}return n}(e).padStart(32,"0").slice(0,32)}function T(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return`${t()}${t()}-${t()}-${t()}-${t()}-${t()}${t()}${t()}`}function k(t){return`@assets/${A(t)}`}function L(t){return function t(e){const n=function(t){return Object.prototype.toString.call(t).replace(/[\]|\[]{1,1}/gi,"").split(" ")[1]}(e);if(["Null","Number","String","Boolean","Undefined"].indexOf(n)>=0)return e;if("Array"===n){const n=[];return e.forEach((e=>{n.push(t(e))})),n}if("Object"===n){const n={};Object.keys(e).forEach((o=>{n[o]=t(e[o])}));return Object.getOwnPropertySymbols(e).forEach((o=>{n[o]=t(e[o])})),n}}(t)}function E(t){return(Object.prototype.toString.call(t)||"").replace(/(\[object|\])/gi,"").trim()}const O={type(t,e){const n=E(t);return!0===e?n.toLocaleLowerCase():n},array:t=>"Array"===E(t),json:t=>"Object"===E(t),function:t=>"Function"===E(t),asyncFunction:t=>"AsyncFunction"===E(t),boolean:t=>"Boolean"===E(t),string:t=>"String"===E(t),number:t=>"Number"===E(t),undefined:t=>"Undefined"===E(t),null:t=>"Null"===E(t),promise:t=>"Promise"===E(t)};var W=function(t,e,n,o){return new(n||(n=Promise))((function(i,a){function r(t){try{s(o.next(t))}catch(t){a(t)}}function l(t){try{s(o.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,l)}s((o=o.apply(t,e||[])).next())}))};const{Image:F}=window;function $(t){return new Promise(((e,n)=>{const o=new F;o.crossOrigin="anonymous",o.onload=function(){e(o)},o.onabort=n,o.onerror=n,o.src=t}))}function D(t){return W(this,void 0,void 0,(function*(){const e=yield function(t){return new Promise(((e,n)=>{const o=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),i=new FileReader;i.readAsDataURL(o),i.onload=function(t){var n;const o=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(o)},i.onerror=function(t){n(t)}}))}(t);return yield $(e)}))}function B(t,e){return W(this,void 0,void 0,(function*(){t=t.replace(/\&/gi,"&");const n=yield function(t,e){const{width:n,height:o}=e;return new Promise(((e,i)=>{const a=new Blob([`\n <svg \n xmlns="http://www.w3.org/2000/svg" \n width="${n||""}" \n height = "${o||""}">\n <foreignObject width="100%" height="100%">\n <div xmlns = "http://www.w3.org/1999/xhtml">\n ${t}\n </div>\n </foreignObject>\n </svg>\n `],{type:"image/svg+xml;charset=utf-8"}),r=new FileReader;r.readAsDataURL(a),r.onload=function(t){var n;const o=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(o)},r.onerror=function(t){i(t)}}))}(t,e);return yield $(n)}))}function V(t){return"number"==typeof t&&t>=0}function j(t){return"number"==typeof t&&(t>0||t<=0)}function X(t){return"string"==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(`${t}`)}function Y(t){return"string"==typeof t&&/^(data:image\/)/.test(`${t}`)}const H={positiveNum:V,x:function(t){return j(t)},y:function(t){return j(t)},w:function(t){return V(t)},h:function(t){return V(t)},angle:function(t){return"number"==typeof t&&t>=-360&&t<=360},number:j,numberStr:function(t){return/^(-?\d+(?:\.\d+)?)$/.test(`${t}`)},borderWidth:function(t){return V(t)||Array.isArray(t)&&V(t[0])&&V(t[1])&&V(t[2])&&V(t[3])},borderRadius:function(t){return V(t)||Array.isArray(t)&&V(t[0])&&V(t[1])&&V(t[2])&&V(t[3])},color:function(t){return z(t)},imageSrc:function(t){return Y(t)||X(t)},imageURL:X,imageBase64:Y,svg:function(t){return"string"==typeof t&&/^(<svg[\s]{1,}|<svg>)/i.test(`${t}`.trim())&&/<\/[\s]{0,}svg>$/i.test(`${t}`.trim())},html:function(t){let e=!1;if("string"==typeof t){let n=document.createElement("div");n.innerHTML=t,n.children.length>0&&(e=!0),n=null}return e},text:function(t){return"string"==typeof t},fontSize:function(t){return j(t)&&t>0},lineHeight:function(t){return j(t)&&t>0},textAlign:function(t){return["center","left","right"].includes(t)},fontFamily:function(t){return"string"==typeof t&&t.length>0},fontWeight:function(t){return["bold"].includes(t)},strokeWidth:function(t){return j(t)&&t>0}};var N,U=function(t,e,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(t):o?o.value:e.get(t)};class Q{constructor(){N.set(this,void 0),function(t,e,n,o,i){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===o?i.call(t,n):i?i.value=n:e.set(t,n)}(this,N,new Map,"f")}on(t,e){if(U(this,N,"f").has(t)){const n=U(this,N,"f").get(t)||[];null==n||n.push(e),U(this,N,"f").set(t,n)}else U(this,N,"f").set(t,[e])}off(t,e){if(U(this,N,"f").has(t)){const n=U(this,N,"f").get(t);if(Array.isArray(n))for(let t=0;t<(null==n?void 0:n.length);t++)if(n[t]===e){n.splice(t,1);break}U(this,N,"f").set(t,n||[])}}trigger(t,e){const n=U(this,N,"f").get(t);return!!Array.isArray(n)&&(n.forEach((t=>{t(e)})),!0)}has(t){if(U(this,N,"f").has(t)){const e=U(this,N,"f").get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1}destroy(){this.clear()}clear(){U(this,N,"f").clear()}}function G(t,e){return{x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}}N=new WeakMap;var q,J,K,Z,_,tt=function(t,e,n,o,i){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?i.call(t,n):i?i.value=n:e.set(t,n),n},et=function(t,e,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(t):o?o.value:e.get(t)};class nt{constructor(t){q.add(this),J.set(this,void 0),K.set(this,void 0),Z.set(this,void 0),tt(this,K,L(t.defaultStorage),"f"),tt(this,J,et(this,q,"m",_).call(this),"f"),tt(this,Z,t.defaultStatic||{},"f")}set(t,e){et(this,J,"f")[t]=e}get(t){return et(this,J,"f")[t]}setStatic(t,e){et(this,Z,"f")[t]=e}getStatic(t){return et(this,Z,"f")[t]}getSnapshot(t){return!0===(null==t?void 0:t.deepClone)?L(et(this,J,"f")):Object.assign({},et(this,J,"f"))}clear(){tt(this,J,et(this,q,"m",_).call(this),"f")}destroy(){tt(this,J,null,"f"),tt(this,Z,null,"f")}}function ot(t){return t/180*Math.PI}function it(t,e,n){const o=at(e);!function(t,e,n,o){const i=ot(e||0);n&&(i>0||i<0)&&(t.translate(n.x,n.y),t.rotate(i),t.translate(-n.x,-n.y)),o(t),n&&(i>0||i<0)&&(t.translate(n.x,n.y),t.rotate(-i),t.translate(-n.x,-n.y))}(t,e.angle||0,o,(()=>{n(t)}))}function at(t){return{x:t.x+t.w/2,y:t.y+t.h/2}}function rt(t){const e=Math.min(t[0].x,t[1].x,t[2].x,t[3].x),n=Math.min(t[0].y,t[1].y,t[2].y,t[3].y);return at({x:e,y:n,w:Math.max(t[0].x,t[1].x,t[2].x,t[3].x)-e,h:Math.max(t[0].y,t[1].y,t[2].y,t[3].y)-n})}function lt(t,e,n){const o=function(t,e){const n=e.x-t.x,o=e.y-t.y;if(0===n){if(o<0)return 0;if(o>0)return Math.PI}else if(0===o){if(n<0)return 3*Math.PI/2;if(n>0)return Math.PI/2}return n>0&&o<0?Math.atan(Math.abs(n)/Math.abs(o)):n>0&&o>0?Math.PI-Math.atan(Math.abs(n)/Math.abs(o)):n<0&&o>0?Math.PI+Math.atan(Math.abs(n)/Math.abs(o)):n<0&&o<0?2*Math.PI-Math.atan(Math.abs(n)/Math.abs(o)):0}(t,e);let i=o+n;i>2*Math.PI?i-=2*Math.PI:i<0-2*Math.PI&&(i+=2*Math.PI),i<0&&(i+=2*Math.PI);const a=function(t,e){const n=(t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y);return 0===n?n:Math.sqrt(n)}(t,e);let r=0,l=0;return 0===i?(r=0,l=0-a):i>0&&i<Math.PI/2?(r=Math.sin(i)*a,l=0-Math.cos(i)*a):i===Math.PI/2?(r=a,l=0):i>Math.PI/2&&i<Math.PI?(r=Math.sin(Math.PI-i)*a,l=Math.cos(Math.PI-i)*a):i===Math.PI?(r=0,l=a):i>Math.PI&&i<1.5*Math.PI?(r=0-Math.sin(i-Math.PI)*a,l=Math.cos(i-Math.PI)*a):i===1.5*Math.PI?(r=0-a,l=0):i>1.5*Math.PI&&i<2*Math.PI?(r=0-Math.sin(2*Math.PI-i)*a,l=0-Math.cos(2*Math.PI-i)*a):i===2*Math.PI&&(r=0,l=0-a),r+=t.x,l+=t.y,{x:r,y:l}}function st(t,e,n){const{x:o,y:i,w:a,h:r}=t;let l={x:o,y:i},s={x:o+a,y:i},c={x:o+a,y:i+r},h={x:o,y:i+r};if(n&&(n>0||n<0)){const t=ot(function(t){if(!(t>0||t<0)||0===t||360===t)return 0;let e=t%360;e<0?e+=360:360===t&&(e=0);return e}(n));l=lt(e,l,t),s=lt(e,s,t),c=lt(e,c,t),h=lt(e,h,t)}return[l,s,c,h]}function ct(t,e,n){return[lt(t,{x:e[0].x,y:e[0].y},n),lt(t,{x:e[1].x,y:e[1].y},n),lt(t,{x:e[2].x,y:e[2].y},n),lt(t,{x:e[3].x,y:e[3].y},n)]}function ht(t,e){var n;const o=[];let i=t;if(e.length>1)for(let t=0;t<e.length-1;t++){const a=i[e[t]];if("group"!==(null==a?void 0:a.type)||!Array.isArray(null===(n=null==a?void 0:a.detail)||void 0===n?void 0:n.children))return null;o.push(a),i=a.detail.children}return o}function ft(t){const{x:e,y:n,h:o,w:i}=t;return[{x:e,y:n},{x:e+i,y:n},{x:e+i,y:n+o},{x:e,y:n+o}]}function ut(t){const{x:e,y:n,w:o,h:i,angle:a=0}=t;return 0===a?ft(t):st(t,at({x:e,y:n,w:o,h:i}),a)}function dt(t,e){const{groupQueue:n}=e;if(!(n.length>0))return[ut(t)];const o=function(t){const e=[];let n=0,o=0;const i=[],a=[...t];for(let t=0;t<a.length;t++){const{x:r,y:l,w:s,h:c,angle:h=0}=a[t];let f;if(n+=r,o+=l,0===t){const t={x:n,y:o,w:s,h:c};f=ut({x:r,y:l,w:s,h:c,angle:h}),i.push({center:at(t),angle:h,radian:ot(h)})}else{f=ft({x:n,y:o,w:s,h:c});for(let t=0;t<i.length;t++){const{center:e,radian:n}=i[t];f=ct(e,f,n)}const t=rt(f);(h>0||h<0)&&(f=ct(t,f,ot(h))),i.push({center:t,angle:h,radian:ot(h)})}e.push(f)}return e}([...n,t]);return o}function gt(t,e){const{viewScaleInfo:n}=e,{x:o,y:i,w:a,h:r,angle:l}=t,{scale:s,offsetTop:c,offsetLeft:h}=n;return{x:o*s+h,y:i*s+c,w:a*s,h:r*s,angle:l}}function yt(t,e){const{viewScaleInfo:n}=e,{x:o,y:i}=t,{scale:a,offsetTop:r,offsetLeft:l}=n;return{x:o*a+l,y:i*a+r}}function pt(t,e){const{context2d:n,element:o,viewScaleInfo:i}=e,{angle:a=0}=o,{x:r,y:l,w:s,h:c}=gt(o,{viewScaleInfo:i}),h=function(t){const{angle:e=0}=t;return st(t,at(t),e)}({x:r,y:l,w:s,h:c,angle:a});if(h.length>=2){n.beginPath(),n.moveTo(h[0].x,h[0].y);for(let t=1;t<h.length;t++)n.lineTo(h[t].x,h[t].y);n.closePath()}return!!n.isPointInPath(t.x,t.y)}function wt(t,e){const{groupQueue:n}=e,o=function(t,e){return dt(t,e).pop()||null}(t,{groupQueue:n}),i=G(o[0],o[1]),a=G(o[1],o[2]),r=G(o[2],o[3]),l=G(o[3],o[0]),s=o[0],c=o[1],h=o[2],f=o[3],u=Math.max(s.x,c.x,h.x,f.x),d=Math.max(s.y,c.y,h.y,f.y);return{center:{x:(u+Math.min(s.x,c.x,h.x,f.x))/2,y:(d+Math.min(s.y,c.y,h.y,f.y))/2},topLeft:s,topRight:c,bottomLeft:f,bottomRight:h,top:i,right:a,left:l,bottom:r}}function mt(t){const e=Math.max(t.topLeft.x,t.topRight.x,t.bottomRight.x,t.bottomLeft.x),n=Math.max(t.topLeft.y,t.topRight.y,t.bottomRight.y,t.bottomLeft.y),o=Math.min(t.topLeft.x,t.topRight.x,t.bottomRight.x,t.bottomLeft.x),i=Math.min(t.topLeft.y,t.topRight.y,t.bottomRight.y,t.bottomLeft.y),a={x:t.center.x,y:t.center.y},r={x:o,y:i},l={x:e,y:i},s={x:e,y:n},c={x:o,y:n},h=G(r,l),f=G(c,s),u=G(r,c);return{center:a,topLeft:r,topRight:l,bottomLeft:c,bottomRight:s,top:h,right:G(l,s),left:u,bottom:f}}function vt(t){let e="";return t.forEach((t=>{e+=t.type+t.params.join(" ")})),e}J=new WeakMap,K=new WeakMap,Z=new WeakMap,q=new WeakSet,_=function(){return L(et(this,K,"f"))};const xt={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function bt(t,e){const{viewScaleInfo:n}=e,{scale:o}=n;let{borderRadius:i}=t.detail;const{borderDash:a}=t.detail,r=Array.isArray(a)&&a.length>0,{boxSizing:l=xt.boxSizing,borderWidth:s}=t.detail;Array.isArray(s)&&(i=0);let{x:c,y:h,w:f,h:u}=t,d=[0,0,0,0];if("number"==typeof i){const t=i*o;d=[t,t,t,t]}else Array.isArray(i)&&4===(null==i?void 0:i.length)&&(d=[i[0]*o,i[1]*o,i[2]*o,i[3]*o]);let g=0;return"number"==typeof s&&(g=(s||0)*o),"border-box"!==l||r?"content-box"===l?(c=t.x-g/2,h=t.y-g/2,f=t.w+g,u=t.h+g):(c=t.x,h=t.y,f=t.w,u=t.h):(c=t.x+g/2,h=t.y+g/2,f=t.w-g,u=t.h-g),f=Math.max(f,1),u=Math.max(u,1),d=d.map((t=>Math.min(t,f/2,u/2))),{x:c,y:h,w:f,h:u,radiusList:d}}const St=["-apple-system",'"system-ui"',' "Segoe UI"'," Roboto",'"Helvetica Neue"',"Arial",'"Noto Sans"'," sans-serif"];function It(t){return[t,...St].join(", ")}function Mt(t,e,n){if("string"==typeof e)return e;const{viewElementSize:o,viewScaleInfo:i,opacity:a=1}=n,{x:r,y:l}=o,{scale:s}=i;if("linear-gradient"===(null==e?void 0:e.type)){const{start:n,end:o,stops:i}=e,c={x:r+n.x*s,y:l+n.y*s},h={x:r+o.x*s,y:l+o.y*s},f=t.createLinearGradient(c.x,c.y,h.x,h.y);return i.forEach((t=>{f.addColorStop(t.offset,R(t.color,a))})),f}if("radial-gradient"===(null==e?void 0:e.type)){const{inner:n,outer:o,stops:i}=e,c={x:r+n.x*s,y:l+n.y*s,radius:n.radius*s},h={x:r+o.x*s,y:l+o.y*s,radius:o.radius*s},f=t.createRadialGradient(c.x,c.y,c.radius,h.x,h.y,h.radius);return i.forEach((t=>{f.addColorStop(t.offset,R(t.color,a))})),f}return"#000000"}const Pt={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function Ct(t){var e,n,o,i;let a=1;return void 0!==(null==(e=null==t?void 0:t.detail)?void 0:e.opacity)&&(null==(n=null==t?void 0:t.detail)?void 0:n.opacity)>=0&&(null==(o=null==t?void 0:t.detail)?void 0:o.opacity)<=1&&(a=null==(i=null==t?void 0:t.detail)?void 0:i.opacity),a}function zt(t,e,n){const{pattern:o,renderContent:i,originElem:a,calcElemSize:r,viewScaleInfo:l,viewSizeInfo:s}=n||{},{parentOpacity:c}=n,h=Ct(a)*c,{clipPath:f,clipPathStrokeColor:u,clipPathStrokeWidth:d}=a.detail,g=()=>{t.globalAlpha=h,Rt(t,e,{pattern:o,viewScaleInfo:l,viewSizeInfo:s}),null==i||i(),At(t,e,{viewScaleInfo:l}),t.globalAlpha=c};f?(function(t,e,n){const{renderContent:o,originElem:i,calcElemSize:a,viewSizeInfo:r}=n,l=r.devicePixelRatio,{clipPath:s}=(null==i?void 0:i.detail)||{};if(s&&a&&s.commands){const{x:n,y:i,w:r,h:c}=a,{originW:h,originH:f,originX:u,originY:d}=s,g=r/h,y=c/f,p=n-u*g,w=i-d*y;t.save(),t.translate(p,w),t.scale(l*g,l*y);const m=vt(s.commands||[]),v=new Path2D(m);t.clip(v,"nonzero"),t.translate(0-p,0-w),t.setTransform(1,0,0,1,0,0),it(t,{...e},(()=>{null==o||o()})),t.restore()}else null==o||o()}(t,e,{originElem:a,calcElemSize:r,viewSizeInfo:s,renderContent:()=>{g()}}),"number"==typeof d&&d>0&&u&&function(t,e,n){const{renderContent:o,originElem:i,calcElemSize:a,viewSizeInfo:r,parentOpacity:l}=n,s=r.devicePixelRatio,{clipPath:c,clipPathStrokeColor:h,clipPathStrokeWidth:f}=(null==i?void 0:i.detail)||{};if(c&&a&&c.commands&&"number"==typeof f&&f>0&&h){const{x:n,y:i,w:r,h:u}=a,{originW:d,originH:g,originX:y,originY:p}=c,w=r/d,m=u/g,v=n-y*w,x=i-p*m;t.save(),t.globalAlpha=l,t.translate(v,x),t.scale(s*w,s*m);const b=vt(c.commands||[]),S=new Path2D(b);t.strokeStyle=h,t.lineWidth=f,t.stroke(S),t.translate(0-v,0-x),t.setTransform(1,0,0,1,0,0),it(t,{...e},(()=>{null==o||o()})),t.restore()}else null==o||o()}(t,e,{originElem:a,calcElemSize:r,viewSizeInfo:s,parentOpacity:c})):g()}function Rt(t,e,n){var o,i;const{pattern:a,viewScaleInfo:r,viewSizeInfo:l}=n,s=[];if(e.detail.background||a){const{x:n,y:l,w:c,h:h,radiusList:f}=bt(e,{viewScaleInfo:r});if(t.beginPath(),t.moveTo(n+f[0],l),t.arcTo(n+c,l,n+c,l+h,f[1]),t.arcTo(n+c,l+h,n,l+h,f[2]),t.arcTo(n,l+h,n,l,f[3]),t.arcTo(n,l,n+c,l,f[0]),t.closePath(),"string"==typeof a)t.fillStyle=a;else if(["CanvasPattern"].includes(O.type(a)))t.fillStyle=a;else if("string"==typeof e.detail.background)t.fillStyle=e.detail.background;else if("linear-gradient"===(null==(o=e.detail.background)?void 0:o.type)){const o=Mt(t,e.detail.background,{viewElementSize:{x:n,y:l,w:c,h:h},viewScaleInfo:r,opacity:t.globalAlpha});t.fillStyle=o}else if("radial-gradient"===(null==(i=e.detail.background)?void 0:i.type)){const o=Mt(t,e.detail.background,{viewElementSize:{x:n,y:l,w:c,h:h},viewScaleInfo:r,opacity:t.globalAlpha});if(t.fillStyle=o,s&&s.length>0)for(let e=0;e<(null==s?void 0:s.length);e++){const o=s[e];"translate"===o.method?t.translate(o.args[0]+n,o.args[1]+l):"rotate"===o.method?t.rotate(...o.args):"scale"===o.method&&t.scale(...o.args)}}t.fill("nonzero"),s&&s.length>0&&t.setTransform(1,0,0,1,0,0)}}function At(t,e,n){if(0===e.detail.borderWidth)return;if(!z(e.detail.borderColor))return;const{viewScaleInfo:o}=n,{scale:i}=o;let a=Pt.borderColor;!0===z(e.detail.borderColor)&&(a=e.detail.borderColor);const{borderDash:r,borderWidth:l,borderRadius:s,boxSizing:c=Pt.boxSizing}=e.detail;let h=[];Array.isArray(r)&&r.length>0&&(h=r.map((t=>Math.ceil(t*i)))),h.length>0?t.lineCap="butt":t.lineCap="square";let f=[0,0,0,0];if("number"==typeof s){const t=s*i;f=[t,t,t,t]}else Array.isArray(s)&&4===(null==s?void 0:s.length)&&(f=[s[0]*i,s[1]*i,s[2]*i,s[3]*i]);let u=0;"number"==typeof l&&(u=l||1),u*=i,t.strokeStyle=a;let d=0,g=0,y=0,p=0;if(Array.isArray(l)&&(d=(l[0]||0)*i,g=(l[1]||0)*i,y=(l[2]||0)*i,p=(l[3]||0)*i),p||g||d||y){t.lineCap="butt";let{x:n,y:o,w:i,h:a}=e;"border-box"===c?(n+=p/2,o+=d/2,i=i-p/2-g/2,a=a-d/2-y/2):"content-box"===c?(n-=p/2,o-=d/2,i=i+p/2+g/2,a=a+d/2+y/2):(n=e.x,o=e.y,i=e.w,a=e.h),d&&(t.beginPath(),t.lineWidth=d,t.moveTo(n-p/2,o),t.lineTo(n+i+g/2,o),t.closePath(),t.stroke()),g&&(t.beginPath(),t.lineWidth=g,t.moveTo(n+i,o-d/2),t.lineTo(n+i,o+a+y/2),t.closePath(),t.stroke()),y&&(t.beginPath(),t.lineWidth=y,t.moveTo(n-p/2,o+a),t.lineTo(n+i+g/2,o+a),t.closePath(),t.stroke()),p&&(t.beginPath(),t.lineWidth=p,t.moveTo(n,o-d/2),t.lineTo(n,o+a+y/2),t.closePath(),t.stroke())}else{let{x:n,y:o,w:i,h:a}=e;"border-box"===c?(n=e.x+u/2,o=e.y+u/2,i=e.w-u,a=e.h-u):"content-box"===c?(n=e.x-u/2,o=e.y-u/2,i=e.w+u,a=e.h+u):(n=e.x,o=e.y,i=e.w,a=e.h),i=Math.max(i,1),a=Math.max(a,1),f=f.map((t=>Math.min(t,i/2,a/2))),t.setLineDash(h),t.lineWidth=u,t.beginPath(),t.moveTo(n+f[0],o),t.arcTo(n+i,o,n+i,o+a,f[1]),t.arcTo(n+i,o+a,n,o+a,f[2]),t.arcTo(n,o+a,n,o,f[3]),t.arcTo(n,o,n+i,o,f[0]),t.closePath(),t.stroke()}t.setLineDash([])}function Tt(t,e,n){const{detail:o}=e,{viewScaleInfo:i,renderContent:a}=n,{shadowColor:r,shadowOffsetX:l,shadowOffsetY:s,shadowBlur:c}=o;H.number(c)?(t.save(),t.shadowColor=r||Pt.shadowColor,t.shadowOffsetX=(l||0)*i.scale,t.shadowOffsetY=(s||0)*i.scale,t.shadowBlur=(c||0)*i.scale,a(),t.restore()):(t.save(),t.shadowColor="transparent",t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0,a(),t.restore())}function kt(t,e,n){const{detail:o,angle:i}=e,{viewScaleInfo:a,viewSizeInfo:r,parentOpacity:l}=n,{background:s="#000000",borderColor:c="#000000",boxSizing:h,borderWidth:f=0,borderDash:u}=o;let d=0;"number"==typeof f&&f>0?d=f:Array.isArray(f)&&"number"==typeof f[0]&&f[0]>0&&(d=f[0]),d*=a.scale;const{x:g,y:y,w:p,h:w}=gt({x:e.x,y:e.y,w:e.w,h:e.h},{viewScaleInfo:a})||e,m={...e,x:g,y:y,w:p,h:w,angle:i};it(t,{x:g,y:y,w:p,h:w,angle:i},(()=>{Tt(t,m,{viewScaleInfo:a,renderContent:()=>{let e=p/2,n=w/2;const o=g+e,i=y+n,r=e,f=n;if(d>0&&("content-box"===h||("center-line"===h?(e-=d/2,n-=d/2):(e-=d,n-=d))),e>=0&&n>=0){const h=Ct(m)*l;t.globalAlpha=h,t.beginPath();const v=Mt(t,s,{viewElementSize:{x:g,y:y,w:p,h:w},viewScaleInfo:a,opacity:t.globalAlpha});if(t.fillStyle=v,t.circle(o,i,r,f,0,0,2*Math.PI),t.closePath(),t.fill("nonzero"),t.globalAlpha=l,"number"==typeof d&&d>0){const r=d/2+e,l=d/2+n;if(t.beginPath(),u){const e=u.map((t=>t*a.scale));t.setLineDash(e)}t.strokeStyle=c,t.lineWidth=d,t.circle(o,i,r,l,0,0,2*Math.PI),t.closePath(),t.stroke(),t.setLineDash([])}}}})}))}function Lt(t,e,n){const{viewScaleInfo:o,viewSizeInfo:i,parentOpacity:a}=n,{x:r,y:l,w:s,h:c,angle:h}=gt(e,{viewScaleInfo:o})||e,f={...e,x:r,y:l,w:s,h:c,angle:h};it(t,{x:r,y:l,w:s,h:c,angle:h},(()=>{Tt(t,f,{viewScaleInfo:o,renderContent:()=>{zt(t,f,{originElem:e,calcElemSize:{x:r,y:l,w:s,h:c,angle:h},viewScaleInfo:o,viewSizeInfo:i,parentOpacity:a,renderContent:()=>{}})}})}))}function Et(t,e,n){const o=n.loader.getContent(e),{viewScaleInfo:i,viewSizeInfo:a,parentOpacity:r}=n,{x:l,y:s,w:c,h:h,angle:f}=gt(e,{viewScaleInfo:i})||e,u={...e,x:l,y:s,w:c,h:h,angle:f};it(t,{x:l,y:s,w:c,h:h,angle:f},(()=>{Tt(t,u,{viewScaleInfo:i,renderContent:()=>{zt(t,u,{originElem:e,calcElemSize:{x:l,y:s,w:c,h:h,angle:f},viewScaleInfo:i,viewSizeInfo:a,parentOpacity:r,renderContent:()=>{if(o||n.loader.isDestroyed()||n.loader.load(e,n.elementAssets||{}),"image"===e.type&&o){t.globalAlpha=Ct(e)*r;const{x:n,y:a,w:l,h:s,radiusList:c}=bt(u,{viewScaleInfo:i}),{detail:h}=e,{scaleMode:f,originW:d=0,originH:g=0}=h,y=t.$undoPixelRatio(d),p=t.$undoPixelRatio(g);if(t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(n+c[0],a),t.arcTo(n+l,a,n+l,a+s,c[1]),t.arcTo(n+l,a+s,n,a+s,c[2]),t.arcTo(n,a+s,n,a,c[3]),t.arcTo(n,a,n+l,a,c[0]),t.closePath(),t.fill("nonzero"),t.clip("nonzero"),f&&g&&d){let i=0,r=0,c=y,h=p;const u=n,d=a,g=l,w=s;if(y>e.w||p>e.h)if("fill"===f){const t=Math.max(e.w/y,e.h/p),n=p*t;i=(y*t-e.w)/2/t,r=(n-e.h)/2/t,c=e.w/t,h=e.h/t}else if("tile"===f)i=0,r=0,c=e.w,h=e.h;else if("fit"===f){const t=Math.min(e.w/y,e.h/p);i=(y-e.w/t)/2,r=(p-e.h/t)/2,c=e.w/t,h=e.h/t}t.drawImage(o,i,r,c,h,u,d,g,w)}else t.drawImage(o,n,a,l,s);t.globalAlpha=r,t.restore()}}})}})}))}function Ot(t,e,n){const o=n.loader.getContent(e),{viewScaleInfo:i,viewSizeInfo:a,parentOpacity:r}=n,{x:l,y:s,w:c,h:h,angle:f}=gt(e,{viewScaleInfo:i})||e;it(t,{x:l,y:s,w:c,h:h,angle:f},(()=>{o||n.loader.isDestroyed()||n.loader.load(e,n.elementAssets||{}),"svg"===e.type&&o&&(t.globalAlpha=Ct(e)*r,t.drawImage(o,l,s,c,h),t.globalAlpha=r)}))}function Wt(t,e,n){const o=n.loader.getContent(e),{viewScaleInfo:i,viewSizeInfo:a,parentOpacity:r}=n,{x:l,y:s,w:c,h:h,angle:f}=gt(e,{viewScaleInfo:i})||e;it(t,{x:l,y:s,w:c,h:h,angle:f},(()=>{o||n.loader.isDestroyed()||n.loader.load(e,n.elementAssets||{}),"html"===e.type&&o&&(t.globalAlpha=Ct(e)*r,t.drawImage(o,l,s,c,h),t.globalAlpha=r)}))}const Ft={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function $t(t,e,n){const{viewScaleInfo:o,viewSizeInfo:i,parentOpacity:a,calculator:r}=n,{x:l,y:s,w:c,h:h,angle:f}=gt(e,{viewScaleInfo:o})||e,u={...e,x:l,y:s,w:c,h:h,angle:f};it(t,{x:l,y:s,w:c,h:h,angle:f},(()=>{var n,d;Tt(t,u,{viewScaleInfo:o,renderContent:()=>{zt(t,u,{originElem:e,calcElemSize:{x:l,y:s,w:c,h:h,angle:f},viewScaleInfo:o,viewSizeInfo:i,parentOpacity:a})}});{const i={...Ft,...e.detail},a=(i.fontSize||Ft.fontSize)*o.scale;if(a<2)return;t.fillStyle=e.detail.color||Ft.color,t.textBaseline="top",t.$setFont({fontWeight:i.fontWeight,fontSize:a,fontFamily:It(i.fontFamily)});{const a=r.getVirtualFlatItem(e.uuid);Array.isArray(null==a?void 0:a.textLines)&&(null==(n=null==a?void 0:a.textLines)?void 0:n.length)>0&&(void 0!==i.textShadowColor&&z(i.textShadowColor)&&(t.shadowColor=i.textShadowColor),void 0!==i.textShadowOffsetX&&H.number(i.textShadowOffsetX)&&(t.shadowOffsetX=i.textShadowOffsetX),void 0!==i.textShadowOffsetY&&H.number(i.textShadowOffsetY)&&(t.shadowOffsetY=i.textShadowOffsetY),void 0!==i.textShadowBlur&&H.number(i.textShadowBlur)&&(t.shadowBlur=i.textShadowBlur),null==(d=null==a?void 0:a.textLines)||d.forEach((e=>{t.fillText(e.text,l+e.x*o.scale,s+e.y*o.scale)})))}}}))}function Dt(t,e,n){var o,i,a;if(!0===(null==(o=null==e?void 0:e.operations)?void 0:o.invisible))return;const{w:r,h:l}=e,{scale:s}=n.viewScaleInfo;if(s<1&&(r*s<.4||l*s<.4)||0===n.parentOpacity)return;const{overrideElementMap:c}=n;if(!(null==(a=null==(i=null==c?void 0:c[e.uuid])?void 0:i.operations)?void 0:a.invisible))try{switch(e.type){case"rect":Lt(t,e,n);break;case"circle":kt(t,e,n);break;case"text":$t(t,e,n);break;case"image":Et(t,e,n);break;case"svg":Ot(t,e,n);break;case"html":Wt(t,e,n);break;case"path":!function(t,e,n){var o,i;const{detail:a}=e,{originX:r,originY:l,originW:s,originH:c,fillRule:h}=a,{viewScaleInfo:f,viewSizeInfo:u,parentOpacity:d}=n,{x:g,y:y,w:p,h:w,angle:m}=gt(e,{viewScaleInfo:f})||e,v=p/s,x=w/c,b=g-r*v,S=y-l*x,{clipPath:I,clipPathStrokeColor:M,clipPathStrokeWidth:P,...C}=e.detail,z=f.scale*u.devicePixelRatio,R={...e,x:g,y:y,w:p,h:w,angle:m};let A={...R};A.detail=C;let T={...e};T.detail=C,a.fill&&"string"!==a.fill&&(null==(i=null==(o=a.fill)?void 0:o.type)?void 0:i.includes("gradient"))&&(A={...R,detail:{...R.detail,background:a.fill,clipPath:{commands:a.commands,originX:r,originY:l,originW:s,originH:c}}},T.detail={...A.detail}),it(t,{x:g,y:y,w:p,h:w,angle:m},(()=>{zt(t,A,{originElem:T,calcElemSize:{x:g,y:y,w:p,h:w,angle:m},viewScaleInfo:f,viewSizeInfo:u,parentOpacity:d,renderContent:()=>{Tt(t,R,{viewScaleInfo:f,renderContent:()=>{t.save(),t.translate(b,S),t.scale(z*v/f.scale,z*x/f.scale);const e=vt(a.commands||[]),n=new Path2D(e);a.fill&&("string"==typeof a.fill?t.fillStyle=a.fill:t.fillStyle="transparent"),a.fill&&t.fill(n,h||"nonzero"),a.stroke&&0!==a.strokeWidth&&(t.strokeStyle=a.stroke,t.lineWidth=(a.strokeWidth||1)/u.devicePixelRatio,t.lineCap=a.strokeLineCap||"square",t.stroke(n)),t.translate(-b,-S),t.restore()}})}})}))}(t,e,n);break;case"group":{const o={...n.elementAssets||{},...e.detail.assets||{}};Bt(t,e,{...n,elementAssets:o});break}}}catch(t){console.error(t)}}function Bt(t,e,n){const{viewScaleInfo:o,viewSizeInfo:i,parentOpacity:a}=n,{x:r,y:l,w:s,h:c,angle:h}=gt({x:e.x,y:e.y,w:e.w,h:e.h,angle:e.angle},{viewScaleInfo:o})||e,f={...e,x:r,y:l,w:s,h:c,angle:h};it(t,{x:r,y:l,w:s,h:c,angle:h},(()=>{t.globalAlpha=Ct(e)*a,Tt(t,f,{viewScaleInfo:o,renderContent:()=>{zt(t,f,{originElem:e,calcElemSize:{x:r,y:l,w:s,h:c,angle:h},viewScaleInfo:o,viewSizeInfo:i,parentOpacity:a,renderContent:()=>{const{x:i,y:r,w:l,h:s,radiusList:c}=bt(f,{viewScaleInfo:o});if("hidden"===e.detail.overflow&&(t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(i+c[0],r),t.arcTo(i+l,r,i+l,r+s,c[1]),t.arcTo(i+l,r+s,i,r+s,c[2]),t.arcTo(i,r+s,i,r,c[3]),t.arcTo(i,r,i+l,r,c[0]),t.closePath(),t.fill("nonzero"),t.clip("nonzero")),Array.isArray(e.detail.children)){const{parentElementSize:o}=n,i={x:o.x+e.x,y:o.y+e.y,w:e.w||o.w,h:e.h||o.h,angle:e.angle},{calculator:r}=n;for(let o=0;o<e.detail.children.length;o++){let l=e.detail.children[o];if(l={...l,x:i.x+l.x,y:i.y+l.y},!0===n.forceDrawAll||(null==r?void 0:r.needRender(l)))try{Dt(t,l,{...n,parentOpacity:a*Ct(e)})}catch(t){console.error(t)}}}"hidden"===e.detail.overflow&&t.restore()}})}}),t.globalAlpha=a}))}const Vt={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function jt(t,e,n){var o;const{elements:i=[]}=e,{parentOpacity:a}=n;for(let e=0;e<i.length;e++){const r=i[e],l={...r,detail:{...Vt,...null==r?void 0:r.detail}};if(!0===n.forceDrawAll||(null==(o=n.calculator)?void 0:o.needRender(l)))try{Dt(t,l,{...n,parentOpacity:a})}catch(t){console.error(t)}}}function Xt(t,e,n,o){const{viewScaleInfo:i,viewSizeInfo:a,parentOpacity:r}=n,l={uuid:"layout",type:"group",...e},{x:s,y:c,w:h,h:f}=gt(l,{viewScaleInfo:i})||l,u={...l,x:s,y:c,w:h,h:f,angle:0};if(t.globalAlpha=1,Tt(t,u,{viewScaleInfo:i,renderContent:()=>{Rt(t,u,{viewScaleInfo:i,viewSizeInfo:a})}}),"hidden"===e.detail.overflow){const{viewScaleInfo:o,viewSizeInfo:i}=n,a={uuid:"layout",type:"group",...e},r=gt(a,{viewScaleInfo:o})||a,l={...a,...r},{x:s,y:c,w:h,h:f,radiusList:u}=bt(l,{viewScaleInfo:o});t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(s+u[0],c),t.arcTo(s+h,c,s+h,c+f,u[1]),t.arcTo(s+h,c+f,s,c+f,u[2]),t.arcTo(s,c+f,s,c,u[3]),t.arcTo(s,c,s+h,c,u[0]),t.closePath(),t.fill("nonzero"),t.clip("nonzero")}o(t),"hidden"===e.detail.overflow&&t.restore(),At(t,u,{viewScaleInfo:i}),t.globalAlpha=r}function Yt(t,e,n){if("string"==typeof(null==e?void 0:e.background)){const{viewSizeInfo:o}=n,{width:i,height:a}=o;t.globalAlpha=1,t.fillStyle=e.background,t.fillRect(0,0,i,a)}}const Ht=["image","svg","html"],Nt=t=>{var e,n,o;let i=null;return"image"===t.type?i=(null==(e=null==t?void 0:t.detail)?void 0:e.src)||null:"svg"===t.type?i=(null==(n=null==t?void 0:t.detail)?void 0:n.svg)||null:"html"===t.type&&(i=(null==(o=null==t?void 0:t.detail)?void 0:o.html)||null),"string"==typeof i&&i?/^@assets\/[0-9a-z-]{0,}$/.test(`${i}`)?i:k(i):k(`${T()}-${t.uuid}-${T()}-${T()}`)};class Ut extends Q{constructor(){super(),M(this,a),M(this,e,{}),M(this,n,{}),M(this,o,{}),M(this,i,!1),C(this,a,r).call(this,"image",(async(t,e)=>{var n;const o=(null==(n=e[t.detail.src])?void 0:n.value)||t.detail.src,i=await $(o);return{uuid:t.uuid,lastModified:Date.now(),content:i}})),C(this,a,r).call(this,"html",(async(t,e)=>{var n;const o=(null==(n=e[t.detail.html])?void 0:n.value)||t.detail.html,i=await B(o,{width:t.detail.originW||t.w,height:t.detail.originH||t.h});return{uuid:t.uuid,lastModified:Date.now(),content:i}})),C(this,a,r).call(this,"svg",(async(t,e)=>{var n;const o=(null==(n=e[t.detail.svg])?void 0:n.value)||t.detail.svg,i=await D(o);return{uuid:t.uuid,lastModified:Date.now(),content:i}}))}isDestroyed(){return I(this,i)}destroy(){P(this,i,!0),this.clear(),P(this,e,null),P(this,n,null),P(this,o,null)}load(t,e){!0!==I(this,i)&&(C(this,a,u).call(this,t)||Ht.includes(t.type)&&C(this,a,f).call(this,t,e))}getContent(t){var e,n;const i=Nt(t);return(null==(n=null==(e=I(this,o))?void 0:e[i])?void 0:n.content)||null}getLoadItemMap(){return I(this,o)}setLoadItemMap(t){P(this,o,t)}}e=new WeakMap,n=new WeakMap,o=new WeakMap,i=new WeakMap,a=new WeakSet,r=function(t,n){I(this,e)[t]=n},l=function(t){var e,n,o;let i=null;return"image"===t.type?i=(null==(e=null==t?void 0:t.detail)?void 0:e.src)||null:"svg"===t.type?i=(null==(n=null==t?void 0:t.detail)?void 0:n.svg)||null:"html"===t.type&&(i=(null==(o=null==t?void 0:t.detail)?void 0:o.html)||null),i},s=function(t){return{element:t,status:"null",content:null,error:null,startTime:-1,endTime:-1,source:C(this,a,l).call(this,t)}},c=function(t){const e=Nt(t.element),n=I(this,o)[e];I(this,i)||(n?n.startTime<t.startTime&&(I(this,o)[e]=t,this.trigger("load",{...t,countTime:t.endTime-t.startTime})):(I(this,o)[e]=t,this.trigger("load",{...t,countTime:t.endTime-t.startTime})))},h=function(t){var e;const n=Nt(t.element),a=null==(e=I(this,o))?void 0:e[n];I(this,i)||(a?a.startTime<t.startTime&&(I(this,o)[n]=t,this.trigger("error",{...t,countTime:t.endTime-t.startTime})):(I(this,o)[n]=t,this.trigger("error",{...t,countTime:t.endTime-t.startTime})))},f=function(t,o){const r=C(this,a,s).call(this,t),l=Nt(t);if(I(this,n)[l])return;I(this,n)[l]=r;const f=I(this,e)[t.type];"function"!=typeof f||I(this,i)||(r.startTime=Date.now(),f(t,o).then((t=>{I(this,i)||(r.content=t.content,r.endTime=Date.now(),r.status="load",C(this,a,c).call(this,r))})).catch((e=>{console.warn(`Load element source "${r.source}" fail`,e,t),r.endTime=Date.now(),r.status="error",r.error=e,C(this,a,h).call(this,r)})))},u=function(t){var e;const o=Nt(t),i=null==(e=I(this,n))?void 0:e[o];return!(!i||"error"!==i.status||!i.source||i.source!==C(this,a,l).call(this,t))};const Qt={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function Gt(t,e){const{w:n,h:o}=t,i=e.tempContext,a=[],r={...Qt,...t.detail},l=r.fontSize||Qt.fontSize,s=l;if(s<2)return{};const c=r.lineHeight||l;i.textBaseline="top",i.$setFont({fontWeight:r.fontWeight,fontSize:s,fontFamily:It(r.fontFamily)});let h=r.text.replace(/\r\n/gi,"\n");"lowercase"===r.textTransform?h=h.toLowerCase():"uppercase"===r.textTransform&&(h=h.toUpperCase());const f=c,u=h.split("\n");let d=0;u.forEach(((t,e)=>{if("maxContent"===r.minInlineSize)a.push({x:0,y:0,text:t,width:i.$undoPixelRatio(i.measureText(t).width)});else{let c="",h="",g=t.split(h);if("normal"===r.wordBreak){h=" ";const e=t.split(h);g=[],e.forEach(((t,n)=>{g.push(t),n<e.length-1&&g.push(h)}))}if(1===g.length&&"visible"===r.overflow)a.push({x:0,y:0,text:g[0],width:i.$undoPixelRatio(i.measureText(g[0]).width)});else if(g.length>0){for(let t=0;t<g.length&&(l=i.$doPixelRatio(n),s=i.measureText(c+g[t]).width,l>=s?c+=g[t]||"":(a.push({x:0,y:0,text:c,width:i.$undoPixelRatio(i.measureText(c).width)}),c=g[t]||"",d++),!((d+1)*f>o&&"hidden"===r.overflow));t++)if(g.length-1===t&&(d+1)*f<=o){a.push({x:0,y:0,text:c,width:i.$undoPixelRatio(i.measureText(c).width)}),e<u.length-1&&d++;break}}else a.push({x:0,y:0,text:"",width:0})}var l,s}));let g=0,y=0;f>s&&(y=(f-s)/2),a.length*f<o&&("top"===r.verticalAlign?g=0:"bottom"===r.verticalAlign?g+=o-a.length*f:g+=(o-a.length*f)/2);{const t=0+g;a.forEach(((e,o)=>{let i=0;"center"===r.textAlign?i=0+(n-e.width)/2:"right"===r.textAlign&&(i=n-e.width+0),a[o].x=i,a[o].y=t+f*o+y}))}return{textLines:a}}function qt(t,e){let n={};return"text"===t.type&&(n=Gt(t,e)),n}function Jt(t,e){const{viewScaleInfo:n,viewSizeInfo:o,tempContext:i}=e,a=function(t,e){const n={},o=[],i=a=>{const r={type:a.type,isVisibleInView:!0,position:[...o]};let l=null;l=wt(a,{groupQueue:ht(t,o)||[]});const s={...r,originRectInfo:l,rangeRectInfo:H.angle(a.angle)?mt(l):l,...qt(a,e)};n[a.uuid]=s,"group"===a.type&&a.detail.children.forEach(((t,e)=>{o.push(e),i(t),o.pop()}))};return t.forEach(((t,e)=>{o.push(e),i(t),o.pop()})),n}(t,{tempContext:i});return Kt(a,{viewScaleInfo:n,viewSizeInfo:o})}function Kt(t,e){const n=function(t){const{viewScaleInfo:e,viewSizeInfo:n}=t,{scale:o,offsetTop:i,offsetLeft:a}=e,{width:r,height:l}=n,s=0-a/o,c=0-i/o,h=r/o,f=l/o,u=at({x:s,y:c,w:h,h:f}),d={x:s,y:c},g={x:s+h,y:c},y={x:s,y:c+f},p={x:s+h,y:c+f},w={x:s,y:u.y},m={x:u.x,y:c},v={x:s+h,y:u.y},x={x:u.x,y:c+f};return{center:u,topLeft:d,topRight:g,bottomLeft:y,bottomRight:p,left:w,top:m,right:v,bottom:x}}(e);let o=0,i=0;return Object.keys(t).forEach((e=>{const a=t[e];a.isVisibleInView=function(t,e){const n=Math.min(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),o=Math.max(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),i=Math.min(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y),a=Math.max(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y),r=Math.min(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),l=Math.max(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),s=Math.min(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y),c=Math.max(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y);return n<=l&&o>=r&&i<=c&&a>=s||l<=a&&l>=a&&l<=a&&l>=a}(a.rangeRectInfo,n),a.isVisibleInView?o++:i++})),{virtualFlatItemMap:t,visibleCount:o,invisibleCount:i}}class Zt{constructor(t){M(this,d),M(this,g),P(this,d,t),P(this,g,new nt({defaultStorage:{virtualFlatItemMap:{},visibleCount:0,invisibleCount:0}}))}toGridNum(t,e){return!0===(null==e?void 0:e.ignore)?t:Math.round(t)}destroy(){P(this,d,null)}needRender(t){const e=I(this,g).get("virtualFlatItemMap")[t.uuid];return!e||e.isVisibleInView}getPointElement(t,e){return function(t,e){var n,o,i;const{context2d:a,data:r,viewScaleInfo:l,groupQueue:s}=e,c={index:-1,element:null,groupQueueIndex:-1};if(s&&Array.isArray(s)&&(null==s?void 0:s.length)>0)for(let e=s.length-1;e>=0;e--){let i=0,r=0,h=0;for(let t=0;t<=e;t++)i+=s[t].x,r+=s[t].y,h+=s[t].angle||0;const f=s[e];if(f&&"group"===f.type&&Array.isArray(null===(n=f.detail)||void 0===n?void 0:n.children))for(let n=0;n<f.detail.children.length;n++){const u=f.detail.children[n];if(!0!==(null===(o=null==u?void 0:u.operations)||void 0===o?void 0:o.invisible)){if(!u)break;if(pt(t,{context2d:a,element:{x:i+u.x,y:r+u.y,w:u.w,h:u.h,angle:h+(u.angle||0)},viewScaleInfo:l})){c.element=u,(e<s.length-1||"group"!==u.type)&&(c.groupQueueIndex=e);break}}}if(c.element)break}if(c.element)return c;for(let e=r.elements.length-1;e>=0;e--){const n=r.elements[e];if(!0!==(null===(i=null==n?void 0:n.operations)||void 0===i?void 0:i.invisible)&&pt(t,{context2d:a,element:n,viewScaleInfo:l})){c.index=e,c.element=n;break}}return c}(t,{...e,context2d:I(this,d).tempContext})}resetVirtualFlatItemMap(t,e){if(t){const{virtualFlatItemMap:n,invisibleCount:o,visibleCount:i}=Jt(t.elements,{...e,tempContext:I(this,d).tempContext});I(this,g).set("virtualFlatItemMap",n),I(this,g).set("invisibleCount",o),I(this,g).set("visibleCount",i)}}updateVisiableStatus(t){const{virtualFlatItemMap:e,invisibleCount:n,visibleCount:o}=Kt(I(this,g).get("virtualFlatItemMap"),t);I(this,g).set("virtualFlatItemMap",e),I(this,g).set("invisibleCount",n),I(this,g).set("visibleCount",o)}calcViewRectInfoFromOrigin(t,e){const n=I(this,g).get("virtualFlatItemMap")[t];if(!(null==n?void 0:n.originRectInfo))return null;const{checkVisible:o,viewScaleInfo:i,viewSizeInfo:a}=e,{center:r,left:l,right:s,bottom:c,top:h,topLeft:f,topRight:u,bottomLeft:d,bottomRight:y}=n.originRectInfo;if(!0===o&&!1===n.isVisibleInView)return null;const p={viewScaleInfo:i};return{center:yt(r,p),left:yt(l,p),right:yt(s,p),bottom:yt(c,p),top:yt(h,p),topLeft:yt(f,p),topRight:yt(u,p),bottomLeft:yt(d,p),bottomRight:yt(y,p)}}calcViewRectInfoFromRange(t,e){const n=I(this,g).get("virtualFlatItemMap")[t];if(!(null==n?void 0:n.originRectInfo))return null;const{checkVisible:o,viewScaleInfo:i,viewSizeInfo:a}=e,{center:r,left:l,right:s,bottom:c,top:h,topLeft:f,topRight:u,bottomLeft:d,bottomRight:y}=n.rangeRectInfo;if(!0===o&&!1===n.isVisibleInView)return null;const p={viewScaleInfo:i};return{center:yt(r,p),left:yt(l,p),right:yt(s,p),bottom:yt(c,p),top:yt(h,p),topLeft:yt(f,p),topRight:yt(u,p),bottomLeft:yt(d,p),bottomRight:yt(y,p)}}modifyText(t){const e=I(this,g).get("virtualFlatItemMap"),n=e[t.uuid];if(t&&"text"===t.type){const o={...n,...Gt(t,{tempContext:I(this,d).tempContext})};e[t.uuid]=o,I(this,g).set("virtualFlatItemMap",e)}}modifyVirtualFlatItemMap(t,e){const{modifyInfo:n,viewScaleInfo:o,viewSizeInfo:i}=e,{type:a,content:r}=n,l=t.elements,s=I(this,g).get("virtualFlatItemMap");if("deleteElement"===a){const{element:t}=r,e=[],n=t=>{e.push(t.uuid),"group"===t.type&&Array.isArray(t.detail.children)&&t.detail.children.forEach((t=>{n(t)}))};n(t),e.forEach((t=>{delete s[t]})),I(this,g).set("virtualFlatItemMap",s)}else if("addElement"===a||"updateElement"===a){const{position:e}=r,n=function(t,e){let n=null,o=e;for(let e=0;e<t.length;e++){const i=o[t[e]];if(e<t.length-1&&"group"===(null==i?void 0:i.type))o=i.detail.children;else{if(e!==t.length-1)break;n=i}}return n}(e,t.elements),c=ht(l,e);if(n)if("updateElement"===a&&"group"===n.type)this.resetVirtualFlatItemMap(t,{viewScaleInfo:o,viewSizeInfo:i});else{const t=wt(n,{groupQueue:c||[]}),r={type:n.type,originRectInfo:t,rangeRectInfo:H.angle(n.angle)?mt(t):t,isVisibleInView:!0,position:[...e],...qt(n,{tempContext:I(this,d).tempContext})};s[n.uuid]=r,I(this,g).set("virtualFlatItemMap",s),"updateElement"===a&&this.updateVisiableStatus({viewScaleInfo:o,viewSizeInfo:i})}}else"moveElement"===a&&this.resetVirtualFlatItemMap(t,{viewScaleInfo:o,viewSizeInfo:i})}getVirtualFlatItem(t){return I(this,g).get("virtualFlatItemMap")[t]||null}}d=new WeakMap,g=new WeakMap;return y=new WeakMap,p=new WeakMap,w=new WeakMap,m=new WeakMap,v=new WeakSet,x=function(){const t=I(this,p);t.on("load",(t=>{this.trigger("load",t)})),t.on("error",(t=>{console.error(t)}))},t.Calculator=Zt,t.Renderer=class extends Q{constructor(t){super(),M(this,v),M(this,y),M(this,p,new Ut),M(this,w),M(this,m,!1),P(this,y,t),P(this,w,new Zt({tempContext:t.tempContext})),C(this,v,x).call(this)}isDestroyed(){return I(this,m)}destroy(){this.clear(),P(this,y,null),I(this,p).destroy(),P(this,p,null),P(this,m,!0)}updateOptions(t){P(this,y,t)}drawData(t,e){const n=I(this,p),o=I(this,w),{sharer:i}=I(this,y),a=I(this,y).viewContext;a.clearRect(0,0,a.canvas.width,a.canvas.height);const r={x:0,y:0,w:e.viewSizeInfo.width,h:e.viewSizeInfo.height};!0===e.forceDrawAll&&I(this,w).resetVirtualFlatItemMap(t,{viewScaleInfo:e.viewScaleInfo,viewSizeInfo:e.viewSizeInfo});const l={loader:n,calculator:o,parentElementSize:r,elementAssets:t.assets,parentOpacity:1,overrideElementMap:null==i?void 0:i.getActiveOverrideElemenentMap(),...e};Yt(a,t.global,l),t.layout?Xt(a,t.layout,l,(()=>{jt(a,t,l)})):jt(a,t,l)}scale(t){const{sharer:e}=I(this,y);if(!e)return;const{data:n,offsetTop:o,offsetBottom:i,offsetLeft:a,offsetRight:r,width:l,height:s,contextHeight:c,contextWidth:h,devicePixelRatio:f}=e.getActiveStoreSnapshot();n&&this.drawData(n,{viewScaleInfo:{scale:t,offsetTop:o,offsetBottom:i,offsetLeft:a,offsetRight:r},viewSizeInfo:{width:l,height:s,contextHeight:c,contextWidth:h,devicePixelRatio:f}})}setLoadItemMap(t){I(this,p).setLoadItemMap(t)}getLoadItemMap(){return I(this,p).getLoadItemMap()}getLoader(){return I(this,p)}getCalculator(){return I(this,w)}},t.drawCircle=kt,t.drawElement=Dt,t.drawElementList=jt,t.drawGlobalBackground=Yt,t.drawGroup=Bt,t.drawHTML=Wt,t.drawImage=Et,t.drawLayout=Xt,t.drawRect=Lt,t.drawSVG=Ot,t.drawText=$t,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idraw/renderer",
|
|
3
|
-
"version": "0.4.0-beta.
|
|
3
|
+
"version": "0.4.0-beta.41",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"author": "idrawjs",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@idraw/types": "^0.4.0-beta.
|
|
24
|
+
"@idraw/types": "^0.4.0-beta.41"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@idraw/util": "^0.4.0-beta.
|
|
28
|
+
"@idraw/util": "^0.4.0-beta.41"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public",
|