@idraw/util 0.4.0-beta.14 → 0.4.0-beta.16

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.
@@ -14,9 +14,10 @@ export { Store } from './lib/store';
14
14
  export { getViewScaleInfoFromSnapshot, getViewSizeInfoFromSnapshot } from './lib/middleware';
15
15
  export { Context2D } from './lib/context2d';
16
16
  export { rotateElement, parseRadianToAngle, parseAngleToRadian, rotateElementVertexes, getElementRotateVertexes, calcElementCenter, calcElementCenterFromVertexes, rotatePointInGroup, limitAngle, calcRadian } from './lib/rotate';
17
- export { getSelectedElementUUIDs, validateElements, calcElementsContextSize, calcElementsViewInfo, getElemenetsAssetIds, findElementFromList, findElementsFromList, findElementFromListByPosition, findElementQueueFromListByPosition, findElementsFromListByPositions, getGroupQueueFromList, getElementSize, mergeElementAsset, filterElementAsset, isResourceElement, getElementPositionFromList, calcElementListSize } from './lib/element';
17
+ export { getSelectedElementUUIDs, validateElements, calcElementsContextSize, calcElementsViewInfo, getElemenetsAssetIds, findElementFromList, findElementsFromList, findElementFromListByPosition, findElementQueueFromListByPosition, findElementsFromListByPositions, getGroupQueueFromList, getGroupQueueByElementPosition, getElementSize, mergeElementAsset, filterElementAsset, isResourceElement, getElementPositionFromList, calcElementListSize } from './lib/element';
18
18
  export { checkRectIntersect } from './lib/rect';
19
- export { viewScale, viewScroll, calcViewElementSize, calcViewPointSize, calcViewVertexes, isViewPointInElement, getViewPointAtElement, isElementInView, calcViewScaleInfo } from './lib/view-calc';
19
+ export { viewScale, viewScroll, calcViewElementSize, calcViewPointSize, calcViewVertexes, isViewPointInElement, getViewPointAtElement, isElementInView, calcViewScaleInfo, calcElementViewRectInfo, calcElementOriginRectInfo, calcElementViewRectInfoMap } from './lib/view-calc';
20
+ export { sortElementsViewVisiableInfoMap } from './lib/view-visible';
20
21
  export { rotatePoint, rotateVertexes, rotateByCenter } from './lib/rotate';
21
22
  export { getElementVertexes, calcElementVertexesInGroup, calcElementVertexesQueueInGroup, calcElementQueueVertexesQueueInGroup } from './lib/vertex';
22
23
  export { calcElementSizeController } from './lib/controller';
package/dist/esm/index.js CHANGED
@@ -14,9 +14,10 @@ export { Store } from './lib/store';
14
14
  export { getViewScaleInfoFromSnapshot, getViewSizeInfoFromSnapshot } from './lib/middleware';
15
15
  export { Context2D } from './lib/context2d';
16
16
  export { rotateElement, parseRadianToAngle, parseAngleToRadian, rotateElementVertexes, getElementRotateVertexes, calcElementCenter, calcElementCenterFromVertexes, rotatePointInGroup, limitAngle, calcRadian } from './lib/rotate';
17
- export { getSelectedElementUUIDs, validateElements, calcElementsContextSize, calcElementsViewInfo, getElemenetsAssetIds, findElementFromList, findElementsFromList, findElementFromListByPosition, findElementQueueFromListByPosition, findElementsFromListByPositions, getGroupQueueFromList, getElementSize, mergeElementAsset, filterElementAsset, isResourceElement, getElementPositionFromList, calcElementListSize } from './lib/element';
17
+ export { getSelectedElementUUIDs, validateElements, calcElementsContextSize, calcElementsViewInfo, getElemenetsAssetIds, findElementFromList, findElementsFromList, findElementFromListByPosition, findElementQueueFromListByPosition, findElementsFromListByPositions, getGroupQueueFromList, getGroupQueueByElementPosition, getElementSize, mergeElementAsset, filterElementAsset, isResourceElement, getElementPositionFromList, calcElementListSize } from './lib/element';
18
18
  export { checkRectIntersect } from './lib/rect';
19
- export { viewScale, viewScroll, calcViewElementSize, calcViewPointSize, calcViewVertexes, isViewPointInElement, getViewPointAtElement, isElementInView, calcViewScaleInfo } from './lib/view-calc';
19
+ export { viewScale, viewScroll, calcViewElementSize, calcViewPointSize, calcViewVertexes, isViewPointInElement, getViewPointAtElement, isElementInView, calcViewScaleInfo, calcElementViewRectInfo, calcElementOriginRectInfo, calcElementViewRectInfoMap } from './lib/view-calc';
20
+ export { sortElementsViewVisiableInfoMap } from './lib/view-visible';
20
21
  export { rotatePoint, rotateVertexes, rotateByCenter } from './lib/rotate';
21
22
  export { getElementVertexes, calcElementVertexesInGroup, calcElementVertexesQueueInGroup, calcElementQueueVertexesQueueInGroup } from './lib/vertex';
22
23
  export { calcElementSizeController } from './lib/controller';
@@ -11,6 +11,7 @@ export declare class Context2D implements ViewContext2D {
11
11
  fontFamily?: string;
12
12
  fontWeight?: 'bold' | number | string;
13
13
  }): void;
14
+ $resetFont(): void;
14
15
  $getOffscreenCanvas(): OffscreenCanvas | null;
15
16
  $resize(opts: {
16
17
  width: number;
@@ -10,12 +10,16 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
12
  var _Context2D_ctx, _Context2D_opts;
13
+ const defaultFontSize = 12;
14
+ const defaultFontWeight = '400';
15
+ const defaultFontFamily = `-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'`;
13
16
  export class Context2D {
14
17
  constructor(ctx, opts) {
15
18
  _Context2D_ctx.set(this, void 0);
16
19
  _Context2D_opts.set(this, void 0);
17
20
  __classPrivateFieldSet(this, _Context2D_ctx, ctx, "f");
18
21
  __classPrivateFieldSet(this, _Context2D_opts, Object.assign({ devicePixelRatio: 1, offscreenCanvas: null }, opts), "f");
22
+ this.$resetFont();
19
23
  }
20
24
  $undoPixelRatio(num) {
21
25
  return num / __classPrivateFieldGet(this, _Context2D_opts, "f").devicePixelRatio;
@@ -38,6 +42,13 @@ export class Context2D {
38
42
  strList.push(`${opts.fontFamily || 'sans-serif'}`);
39
43
  __classPrivateFieldGet(this, _Context2D_ctx, "f").font = `${strList.join(' ')}`;
40
44
  }
45
+ $resetFont() {
46
+ this.$setFont({
47
+ fontSize: defaultFontSize,
48
+ fontFamily: defaultFontFamily,
49
+ fontWeight: defaultFontWeight
50
+ });
51
+ }
41
52
  $getOffscreenCanvas() {
42
53
  return __classPrivateFieldGet(this, _Context2D_opts, "f").offscreenCanvas;
43
54
  }
@@ -16,6 +16,7 @@ export declare function getElemenetsAssetIds(elements: Elements): string[];
16
16
  export declare function findElementFromList(uuid: string, list: Element<ElementType>[]): Element<ElementType> | null;
17
17
  export declare function findElementsFromList(uuids: string[], list: Element<ElementType>[]): Element<ElementType>[];
18
18
  export declare function getGroupQueueFromList(uuid: string, elements: Element<ElementType>[]): Element<'group'>[];
19
+ export declare function getGroupQueueByElementPosition(elements: Element<ElementType>[], position: ElementPosition): Element<'group'>[] | null;
19
20
  export declare function getElementSize(elem: Element): ElementSize;
20
21
  export declare function mergeElementAsset<T extends Element<LoadElementType>>(element: T, assets: ElementAssets): T;
21
22
  export declare function filterElementAsset<T extends Element<LoadElementType>>(element: T): {
@@ -260,6 +260,24 @@ export function getGroupQueueFromList(uuid, elements) {
260
260
  _scan(uuid, elements);
261
261
  return groupQueue;
262
262
  }
263
+ export function getGroupQueueByElementPosition(elements, position) {
264
+ var _a;
265
+ const groupQueue = [];
266
+ let currentElements = elements;
267
+ if (position.length > 1) {
268
+ for (let i = 0; i < position.length - 1; i++) {
269
+ const group = currentElements[i];
270
+ if ((group === null || group === void 0 ? void 0 : group.type) === 'group' && Array.isArray((_a = group === null || group === void 0 ? void 0 : group.detail) === null || _a === void 0 ? void 0 : _a.children)) {
271
+ groupQueue.push(group);
272
+ currentElements = group.detail.children;
273
+ }
274
+ else {
275
+ return null;
276
+ }
277
+ }
278
+ }
279
+ return groupQueue;
280
+ }
263
281
  export function getElementSize(elem) {
264
282
  const { x, y, w, h, angle } = elem;
265
283
  const size = { x, y, w, h, angle };
@@ -26,7 +26,7 @@ export class Store {
26
26
  return __classPrivateFieldGet(this, _Store_temp, "f")[name];
27
27
  }
28
28
  getSnapshot() {
29
- return deepClone(__classPrivateFieldGet(this, _Store_temp, "f"));
29
+ return __classPrivateFieldGet(this, _Store_temp, "f");
30
30
  }
31
31
  clear() {
32
32
  __classPrivateFieldSet(this, _Store_temp, __classPrivateFieldGet(this, _Store_instances, "m", _Store_createTempStorage).call(this), "f");
@@ -1,4 +1,4 @@
1
- import { Point, PointSize, Data, ViewScaleInfo, ViewSizeInfo, Element, ElementType, ElementSize, ViewContext2D, ViewRectVertexes } from '@idraw/types';
1
+ import { Point, PointSize, Data, ViewScaleInfo, ViewSizeInfo, Element, ElementType, ElementSize, ViewContext2D, ViewRectVertexes, ViewRectInfo, ViewRectInfoMap } from '@idraw/types';
2
2
  export declare function calcViewScaleInfo(info: {
3
3
  scale: number;
4
4
  offsetX: number;
@@ -27,7 +27,6 @@ export declare function calcViewElementSize(size: ElementSize, opts: {
27
27
  }): ElementSize;
28
28
  export declare function calcViewPointSize(size: PointSize, opts: {
29
29
  viewScaleInfo: ViewScaleInfo;
30
- viewSizeInfo: ViewSizeInfo;
31
30
  }): PointSize;
32
31
  export declare function calcViewVertexes(vertexes: ViewRectVertexes, opts: {
33
32
  viewScaleInfo: ViewScaleInfo;
@@ -54,3 +53,15 @@ export declare function isElementInView(elem: ElementSize, opts: {
54
53
  viewScaleInfo: ViewScaleInfo;
55
54
  viewSizeInfo: ViewSizeInfo;
56
55
  }): boolean;
56
+ export declare function calcElementOriginRectInfo(elemSize: ElementSize, opts: {
57
+ groupQueue: Element<'group'>[];
58
+ }): ViewRectInfo;
59
+ export declare function calcElementViewRectInfo(elemSize: ElementSize, opts: {
60
+ groupQueue: Element<'group'>[];
61
+ viewScaleInfo: ViewScaleInfo;
62
+ range?: boolean;
63
+ }): ViewRectInfo;
64
+ export declare function calcElementViewRectInfoMap(elemSize: ElementSize, opts: {
65
+ groupQueue: Element<'group'>[];
66
+ viewScaleInfo: ViewScaleInfo;
67
+ }): ViewRectInfoMap;
@@ -1,5 +1,7 @@
1
1
  import { rotateElementVertexes } from './rotate';
2
2
  import { checkRectIntersect } from './rect';
3
+ import { calcElementVertexesInGroup } from './vertex';
4
+ import { getCenterFromTwoPoints } from './point';
3
5
  export function calcViewScaleInfo(info, opts) {
4
6
  const { scale, offsetX, offsetY } = info;
5
7
  const { viewSizeInfo } = opts;
@@ -184,3 +186,124 @@ export function isElementInView(elem, opts) {
184
186
  const elemSize = { x: elemStartX, y: elemStartY, w: elemEndX - elemStartX, h: elemEndY - elemStartY };
185
187
  return checkRectIntersect(viewSize, elemSize);
186
188
  }
189
+ export function calcElementOriginRectInfo(elemSize, opts) {
190
+ const { groupQueue } = opts;
191
+ const vertexes = calcElementVertexesInGroup(elemSize, { groupQueue });
192
+ const top = getCenterFromTwoPoints(vertexes[0], vertexes[1]);
193
+ const right = getCenterFromTwoPoints(vertexes[1], vertexes[2]);
194
+ const bottom = getCenterFromTwoPoints(vertexes[2], vertexes[3]);
195
+ const left = getCenterFromTwoPoints(vertexes[3], vertexes[0]);
196
+ const topLeft = vertexes[0];
197
+ const topRight = vertexes[1];
198
+ const bottomRight = vertexes[2];
199
+ const bottomLeft = vertexes[3];
200
+ const maxX = Math.max(topLeft.x, topRight.x, bottomRight.x, bottomLeft.x);
201
+ const maxY = Math.max(topLeft.y, topRight.y, bottomRight.y, bottomLeft.y);
202
+ const minX = Math.min(topLeft.x, topRight.x, bottomRight.x, bottomLeft.x);
203
+ const minY = Math.min(topLeft.y, topRight.y, bottomRight.y, bottomLeft.y);
204
+ const center = {
205
+ x: (maxX + minX) / 2,
206
+ y: (maxY + minY) / 2
207
+ };
208
+ const rectInfo = {
209
+ center,
210
+ topLeft,
211
+ topRight,
212
+ bottomLeft,
213
+ bottomRight,
214
+ top,
215
+ right,
216
+ left,
217
+ bottom
218
+ };
219
+ return rectInfo;
220
+ }
221
+ export function calcElementViewRectInfo(elemSize, opts) {
222
+ const { groupQueue, viewScaleInfo, range } = opts;
223
+ const originRectInfo = calcElementOriginRectInfo(elemSize, { groupQueue });
224
+ const { center, top, bottom, left, right, topLeft, topRight, bottomLeft, bottomRight } = originRectInfo;
225
+ const viewRectInfo = {
226
+ center: calcViewPointSize(center, { viewScaleInfo }),
227
+ topLeft: calcViewPointSize(topLeft, { viewScaleInfo }),
228
+ topRight: calcViewPointSize(topRight, { viewScaleInfo }),
229
+ bottomLeft: calcViewPointSize(bottomLeft, { viewScaleInfo }),
230
+ bottomRight: calcViewPointSize(bottomRight, { viewScaleInfo }),
231
+ top: calcViewPointSize(top, { viewScaleInfo }),
232
+ right: calcViewPointSize(right, { viewScaleInfo }),
233
+ left: calcViewPointSize(left, { viewScaleInfo }),
234
+ bottom: calcViewPointSize(bottom, { viewScaleInfo })
235
+ };
236
+ if (range === true) {
237
+ const viewMaxX = Math.max(viewRectInfo.topLeft.x, viewRectInfo.topRight.x, viewRectInfo.bottomRight.x, viewRectInfo.bottomLeft.x);
238
+ const viewMaxY = Math.max(viewRectInfo.topLeft.y, viewRectInfo.topRight.y, viewRectInfo.bottomRight.y, viewRectInfo.bottomLeft.y);
239
+ const viewMinX = Math.min(viewRectInfo.topLeft.x, viewRectInfo.topRight.x, viewRectInfo.bottomRight.x, viewRectInfo.bottomLeft.x);
240
+ const viewMinY = Math.min(viewRectInfo.topLeft.y, viewRectInfo.topRight.y, viewRectInfo.bottomRight.y, viewRectInfo.bottomLeft.y);
241
+ const rangeCenter = { x: viewRectInfo.center.x, y: viewRectInfo.center.y };
242
+ const rangeTopLeft = { x: viewMinX, y: viewMinY };
243
+ const rangeTopRight = { x: viewMaxX, y: viewMinY };
244
+ const rangeBottomRight = { x: viewMaxX, y: viewMaxY };
245
+ const rangeBottomLeft = { x: viewMinX, y: viewMaxY };
246
+ const rangeTop = getCenterFromTwoPoints(rangeTopLeft, rangeTopRight);
247
+ const rangeBottom = getCenterFromTwoPoints(rangeBottomLeft, rangeBottomRight);
248
+ const rangeLeft = getCenterFromTwoPoints(rangeTopLeft, rangeBottomLeft);
249
+ const rangeRight = getCenterFromTwoPoints(rangeTopRight, rangeBottomRight);
250
+ const rangeRectInfo = {
251
+ center: rangeCenter,
252
+ topLeft: rangeTopLeft,
253
+ topRight: rangeTopRight,
254
+ bottomLeft: rangeBottomLeft,
255
+ bottomRight: rangeBottomRight,
256
+ top: rangeTop,
257
+ right: rangeRight,
258
+ left: rangeLeft,
259
+ bottom: rangeBottom
260
+ };
261
+ return rangeRectInfo;
262
+ }
263
+ return viewRectInfo;
264
+ }
265
+ export function calcElementViewRectInfoMap(elemSize, opts) {
266
+ const { groupQueue, viewScaleInfo } = opts;
267
+ const originRectInfo = calcElementOriginRectInfo(elemSize, { groupQueue });
268
+ const { center, top, bottom, left, right, topLeft, topRight, bottomLeft, bottomRight } = originRectInfo;
269
+ const viewRectInfo = {
270
+ center: calcViewPointSize(center, { viewScaleInfo }),
271
+ topLeft: calcViewPointSize(topLeft, { viewScaleInfo }),
272
+ topRight: calcViewPointSize(topRight, { viewScaleInfo }),
273
+ bottomLeft: calcViewPointSize(bottomLeft, { viewScaleInfo }),
274
+ bottomRight: calcViewPointSize(bottomRight, { viewScaleInfo }),
275
+ top: calcViewPointSize(top, { viewScaleInfo }),
276
+ right: calcViewPointSize(right, { viewScaleInfo }),
277
+ left: calcViewPointSize(left, { viewScaleInfo }),
278
+ bottom: calcViewPointSize(bottom, { viewScaleInfo })
279
+ };
280
+ const viewMaxX = Math.max(viewRectInfo.topLeft.x, viewRectInfo.topRight.x, viewRectInfo.bottomRight.x, viewRectInfo.bottomLeft.x);
281
+ const viewMaxY = Math.max(viewRectInfo.topLeft.y, viewRectInfo.topRight.y, viewRectInfo.bottomRight.y, viewRectInfo.bottomLeft.y);
282
+ const viewMinX = Math.min(viewRectInfo.topLeft.x, viewRectInfo.topRight.x, viewRectInfo.bottomRight.x, viewRectInfo.bottomLeft.x);
283
+ const viewMinY = Math.min(viewRectInfo.topLeft.y, viewRectInfo.topRight.y, viewRectInfo.bottomRight.y, viewRectInfo.bottomLeft.y);
284
+ const rangeCenter = { x: viewRectInfo.center.x, y: viewRectInfo.center.y };
285
+ const rangeTopLeft = { x: viewMinX, y: viewMinY };
286
+ const rangeTopRight = { x: viewMaxX, y: viewMinY };
287
+ const rangeBottomRight = { x: viewMaxX, y: viewMaxY };
288
+ const rangeBottomLeft = { x: viewMinX, y: viewMaxY };
289
+ const rangeTop = getCenterFromTwoPoints(rangeTopLeft, rangeTopRight);
290
+ const rangeBottom = getCenterFromTwoPoints(rangeBottomLeft, rangeBottomRight);
291
+ const rangeLeft = getCenterFromTwoPoints(rangeTopLeft, rangeBottomLeft);
292
+ const rangeRight = getCenterFromTwoPoints(rangeTopRight, rangeBottomRight);
293
+ const rangeRectInfo = {
294
+ center: rangeCenter,
295
+ topLeft: rangeTopLeft,
296
+ topRight: rangeTopRight,
297
+ bottomLeft: rangeBottomLeft,
298
+ bottomRight: rangeBottomRight,
299
+ top: rangeTop,
300
+ right: rangeRight,
301
+ left: rangeLeft,
302
+ bottom: rangeBottom
303
+ };
304
+ return {
305
+ originRectInfo,
306
+ viewRectInfo,
307
+ rangeRectInfo
308
+ };
309
+ }
@@ -0,0 +1,2 @@
1
+ import { Elements, ViewVisibleInfoMap } from '@idraw/types';
2
+ export declare function sortElementsViewVisiableInfoMap(elements: Elements): ViewVisibleInfoMap;
@@ -0,0 +1,40 @@
1
+ import { calcElementOriginRectInfo } from './view-calc';
2
+ import { getGroupQueueByElementPosition } from './element';
3
+ export function sortElementsViewVisiableInfoMap(elements) {
4
+ const visibleInfoMap = {};
5
+ const currentPosition = [];
6
+ const _walk = (elem) => {
7
+ const baseInfo = {
8
+ viewRectInfo: null,
9
+ rangeRectInfo: null,
10
+ isVisibleInView: true,
11
+ isGroup: elem.type === 'group',
12
+ position: [...currentPosition]
13
+ };
14
+ let originRectInfo = null;
15
+ const groupQueue = getGroupQueueByElementPosition(elements, currentPosition);
16
+ originRectInfo = calcElementOriginRectInfo(elem, {
17
+ groupQueue: groupQueue || []
18
+ });
19
+ visibleInfoMap[elem.uuid] = Object.assign(Object.assign({}, baseInfo), {
20
+ originRectInfo: originRectInfo
21
+ });
22
+ if (elem.type === 'group') {
23
+ elem.detail.children.forEach((ele, i) => {
24
+ if (ele.type === 'group') {
25
+ currentPosition.push(i);
26
+ }
27
+ _walk(ele);
28
+ if (ele.type === 'group') {
29
+ currentPosition.pop();
30
+ }
31
+ });
32
+ }
33
+ };
34
+ elements.forEach((elem, index) => {
35
+ currentPosition.push(index);
36
+ _walk(elem);
37
+ currentPosition.pop();
38
+ });
39
+ return visibleInfoMap;
40
+ }
@@ -915,6 +915,9 @@ var __privateMethod = (obj, member, method) => {
915
915
  svgDesc,
916
916
  htmlDesc
917
917
  };
918
+ const defaultFontSize = 12;
919
+ const defaultFontWeight = "400";
920
+ const defaultFontFamily = `-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'`;
918
921
  class Context2D {
919
922
  // private _width: number = 0;
920
923
  // private _height: number = 0;
@@ -923,6 +926,7 @@ var __privateMethod = (obj, member, method) => {
923
926
  __privateAdd(this, _opts, void 0);
924
927
  __privateSet(this, _ctx, ctx);
925
928
  __privateSet(this, _opts, { ...{ devicePixelRatio: 1, offscreenCanvas: null }, ...opts });
929
+ this.$resetFont();
926
930
  }
927
931
  $undoPixelRatio(num) {
928
932
  return num / __privateGet(this, _opts).devicePixelRatio;
@@ -945,6 +949,13 @@ var __privateMethod = (obj, member, method) => {
945
949
  strList.push(`${opts.fontFamily || "sans-serif"}`);
946
950
  __privateGet(this, _ctx).font = `${strList.join(" ")}`;
947
951
  }
952
+ $resetFont() {
953
+ this.$setFont({
954
+ fontSize: defaultFontSize,
955
+ fontFamily: defaultFontFamily,
956
+ fontWeight: defaultFontWeight
957
+ });
958
+ }
948
959
  $getOffscreenCanvas() {
949
960
  return __privateGet(this, _opts).offscreenCanvas;
950
961
  }
@@ -1398,7 +1409,7 @@ var __privateMethod = (obj, member, method) => {
1398
1409
  return __privateGet(this, _temp)[name];
1399
1410
  }
1400
1411
  getSnapshot() {
1401
- return deepClone(__privateGet(this, _temp));
1412
+ return __privateGet(this, _temp);
1402
1413
  }
1403
1414
  clear() {
1404
1415
  __privateSet(this, _temp, __privateMethod(this, _createTempStorage, createTempStorage_fn).call(this));
@@ -1875,6 +1886,23 @@ var __privateMethod = (obj, member, method) => {
1875
1886
  _scan(uuid, elements);
1876
1887
  return groupQueue;
1877
1888
  }
1889
+ function getGroupQueueByElementPosition(elements, position) {
1890
+ var _a;
1891
+ const groupQueue = [];
1892
+ let currentElements = elements;
1893
+ if (position.length > 1) {
1894
+ for (let i = 0; i < position.length - 1; i++) {
1895
+ const group = currentElements[i];
1896
+ if ((group == null ? void 0 : group.type) === "group" && Array.isArray((_a = group == null ? void 0 : group.detail) == null ? void 0 : _a.children)) {
1897
+ groupQueue.push(group);
1898
+ currentElements = group.detail.children;
1899
+ } else {
1900
+ return null;
1901
+ }
1902
+ }
1903
+ }
1904
+ return groupQueue;
1905
+ }
1878
1906
  function getElementSize(elem) {
1879
1907
  const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = elem;
1880
1908
  const size = { x: x2, y: y2, w: w2, h: h2, angle: angle2 };
@@ -2021,6 +2049,77 @@ var __privateMethod = (obj, member, method) => {
2021
2049
  const react2MaxY = rect2.y + rect2.h;
2022
2050
  return react1MinX <= react2MaxX && react1MaxX >= react2MinX && react1MinY <= react2MaxY && react1MaxY >= react2MinY;
2023
2051
  }
2052
+ function getElementVertexes(elemSize) {
2053
+ const { x: x2, y: y2, h: h2, w: w2 } = elemSize;
2054
+ return [
2055
+ { x: x2, y: y2 },
2056
+ { x: x2 + w2, y: y2 },
2057
+ { x: x2 + w2, y: y2 + h2 },
2058
+ { x: x2, y: y2 + h2 }
2059
+ ];
2060
+ }
2061
+ function calcElementVertexes(elemSize) {
2062
+ const { x: x2, y: y2, w: w2, h: h2, angle: angle2 = 0 } = elemSize;
2063
+ if (angle2 === 0) {
2064
+ return getElementVertexes(elemSize);
2065
+ }
2066
+ return getElementRotateVertexes(elemSize, calcElementCenter({ x: x2, y: y2, w: w2, h: h2, angle: angle2 }), angle2);
2067
+ }
2068
+ function calcElementQueueVertexesQueueInGroup(groupQueue) {
2069
+ const vesList = [];
2070
+ let totalX = 0;
2071
+ let totalY = 0;
2072
+ const rotateActionList = [];
2073
+ const elemQueue = [...groupQueue];
2074
+ for (let i = 0; i < elemQueue.length; i++) {
2075
+ const { x: x2, y: y2, w: w2, h: h2, angle: angle2 = 0 } = elemQueue[i];
2076
+ totalX += x2;
2077
+ totalY += y2;
2078
+ let ves;
2079
+ if (i === 0) {
2080
+ const elemSize = { x: totalX, y: totalY, w: w2, h: h2, angle: angle2 };
2081
+ ves = calcElementVertexes({ x: x2, y: y2, w: w2, h: h2, angle: angle2 });
2082
+ rotateActionList.push({
2083
+ center: calcElementCenter(elemSize),
2084
+ angle: angle2,
2085
+ radian: parseAngleToRadian(angle2)
2086
+ });
2087
+ } else {
2088
+ const elemSize = { x: totalX, y: totalY, w: w2, h: h2, angle: angle2 };
2089
+ ves = getElementVertexes(elemSize);
2090
+ for (let aIdx = 0; aIdx < rotateActionList.length; aIdx++) {
2091
+ const { center, radian } = rotateActionList[aIdx];
2092
+ ves = rotateVertexes(center, ves, radian);
2093
+ }
2094
+ const vesCenter = calcElementCenterFromVertexes(ves);
2095
+ if (angle2 > 0 || angle2 < 0) {
2096
+ const radian = parseAngleToRadian(angle2);
2097
+ ves = rotateVertexes(vesCenter, ves, radian);
2098
+ }
2099
+ rotateActionList.push({
2100
+ center: vesCenter,
2101
+ angle: angle2,
2102
+ radian: parseAngleToRadian(angle2)
2103
+ });
2104
+ }
2105
+ vesList.push(ves);
2106
+ }
2107
+ return vesList;
2108
+ }
2109
+ function calcElementVertexesQueueInGroup(targetElem, opts) {
2110
+ const { groupQueue } = opts;
2111
+ if (!(groupQueue.length > 0)) {
2112
+ return [calcElementVertexes(targetElem)];
2113
+ }
2114
+ const elemQueue = [...groupQueue, ...[targetElem]];
2115
+ const vesList = calcElementQueueVertexesQueueInGroup(elemQueue);
2116
+ return vesList;
2117
+ }
2118
+ function calcElementVertexesInGroup(targetElem, opts) {
2119
+ const vesList = calcElementVertexesQueueInGroup(targetElem, opts);
2120
+ const ves = vesList.pop();
2121
+ return ves || null;
2122
+ }
2024
2123
  function calcViewScaleInfo(info, opts) {
2025
2124
  const { scale, offsetX, offsetY } = info;
2026
2125
  const { viewSizeInfo } = opts;
@@ -2204,76 +2303,167 @@ var __privateMethod = (obj, member, method) => {
2204
2303
  const elemSize = { x: elemStartX, y: elemStartY, w: elemEndX - elemStartX, h: elemEndY - elemStartY };
2205
2304
  return checkRectIntersect(viewSize, elemSize);
2206
2305
  }
2207
- function getElementVertexes(elemSize) {
2208
- const { x: x2, y: y2, h: h2, w: w2 } = elemSize;
2209
- return [
2210
- { x: x2, y: y2 },
2211
- { x: x2 + w2, y: y2 },
2212
- { x: x2 + w2, y: y2 + h2 },
2213
- { x: x2, y: y2 + h2 }
2214
- ];
2215
- }
2216
- function calcElementVertexes(elemSize) {
2217
- const { x: x2, y: y2, w: w2, h: h2, angle: angle2 = 0 } = elemSize;
2218
- if (angle2 === 0) {
2219
- return getElementVertexes(elemSize);
2220
- }
2221
- return getElementRotateVertexes(elemSize, calcElementCenter({ x: x2, y: y2, w: w2, h: h2, angle: angle2 }), angle2);
2306
+ function calcElementOriginRectInfo(elemSize, opts) {
2307
+ const { groupQueue } = opts;
2308
+ const vertexes = calcElementVertexesInGroup(elemSize, { groupQueue });
2309
+ const top = getCenterFromTwoPoints(vertexes[0], vertexes[1]);
2310
+ const right = getCenterFromTwoPoints(vertexes[1], vertexes[2]);
2311
+ const bottom = getCenterFromTwoPoints(vertexes[2], vertexes[3]);
2312
+ const left = getCenterFromTwoPoints(vertexes[3], vertexes[0]);
2313
+ const topLeft = vertexes[0];
2314
+ const topRight = vertexes[1];
2315
+ const bottomRight = vertexes[2];
2316
+ const bottomLeft = vertexes[3];
2317
+ const maxX = Math.max(topLeft.x, topRight.x, bottomRight.x, bottomLeft.x);
2318
+ const maxY = Math.max(topLeft.y, topRight.y, bottomRight.y, bottomLeft.y);
2319
+ const minX = Math.min(topLeft.x, topRight.x, bottomRight.x, bottomLeft.x);
2320
+ const minY = Math.min(topLeft.y, topRight.y, bottomRight.y, bottomLeft.y);
2321
+ const center = {
2322
+ x: (maxX + minX) / 2,
2323
+ y: (maxY + minY) / 2
2324
+ };
2325
+ const rectInfo = {
2326
+ center,
2327
+ topLeft,
2328
+ topRight,
2329
+ bottomLeft,
2330
+ bottomRight,
2331
+ top,
2332
+ right,
2333
+ left,
2334
+ bottom
2335
+ };
2336
+ return rectInfo;
2337
+ }
2338
+ function calcElementViewRectInfo(elemSize, opts) {
2339
+ const { groupQueue, viewScaleInfo, range } = opts;
2340
+ const originRectInfo = calcElementOriginRectInfo(elemSize, { groupQueue });
2341
+ const { center, top, bottom, left, right, topLeft, topRight, bottomLeft, bottomRight } = originRectInfo;
2342
+ const viewRectInfo = {
2343
+ center: calcViewPointSize(center, { viewScaleInfo }),
2344
+ topLeft: calcViewPointSize(topLeft, { viewScaleInfo }),
2345
+ topRight: calcViewPointSize(topRight, { viewScaleInfo }),
2346
+ bottomLeft: calcViewPointSize(bottomLeft, { viewScaleInfo }),
2347
+ bottomRight: calcViewPointSize(bottomRight, { viewScaleInfo }),
2348
+ top: calcViewPointSize(top, { viewScaleInfo }),
2349
+ right: calcViewPointSize(right, { viewScaleInfo }),
2350
+ left: calcViewPointSize(left, { viewScaleInfo }),
2351
+ bottom: calcViewPointSize(bottom, { viewScaleInfo })
2352
+ };
2353
+ if (range === true) {
2354
+ const viewMaxX = Math.max(viewRectInfo.topLeft.x, viewRectInfo.topRight.x, viewRectInfo.bottomRight.x, viewRectInfo.bottomLeft.x);
2355
+ const viewMaxY = Math.max(viewRectInfo.topLeft.y, viewRectInfo.topRight.y, viewRectInfo.bottomRight.y, viewRectInfo.bottomLeft.y);
2356
+ const viewMinX = Math.min(viewRectInfo.topLeft.x, viewRectInfo.topRight.x, viewRectInfo.bottomRight.x, viewRectInfo.bottomLeft.x);
2357
+ const viewMinY = Math.min(viewRectInfo.topLeft.y, viewRectInfo.topRight.y, viewRectInfo.bottomRight.y, viewRectInfo.bottomLeft.y);
2358
+ const rangeCenter = { x: viewRectInfo.center.x, y: viewRectInfo.center.y };
2359
+ const rangeTopLeft = { x: viewMinX, y: viewMinY };
2360
+ const rangeTopRight = { x: viewMaxX, y: viewMinY };
2361
+ const rangeBottomRight = { x: viewMaxX, y: viewMaxY };
2362
+ const rangeBottomLeft = { x: viewMinX, y: viewMaxY };
2363
+ const rangeTop = getCenterFromTwoPoints(rangeTopLeft, rangeTopRight);
2364
+ const rangeBottom = getCenterFromTwoPoints(rangeBottomLeft, rangeBottomRight);
2365
+ const rangeLeft = getCenterFromTwoPoints(rangeTopLeft, rangeBottomLeft);
2366
+ const rangeRight = getCenterFromTwoPoints(rangeTopRight, rangeBottomRight);
2367
+ const rangeRectInfo = {
2368
+ center: rangeCenter,
2369
+ topLeft: rangeTopLeft,
2370
+ topRight: rangeTopRight,
2371
+ bottomLeft: rangeBottomLeft,
2372
+ bottomRight: rangeBottomRight,
2373
+ top: rangeTop,
2374
+ right: rangeRight,
2375
+ left: rangeLeft,
2376
+ bottom: rangeBottom
2377
+ };
2378
+ return rangeRectInfo;
2379
+ }
2380
+ return viewRectInfo;
2381
+ }
2382
+ function calcElementViewRectInfoMap(elemSize, opts) {
2383
+ const { groupQueue, viewScaleInfo } = opts;
2384
+ const originRectInfo = calcElementOriginRectInfo(elemSize, { groupQueue });
2385
+ const { center, top, bottom, left, right, topLeft, topRight, bottomLeft, bottomRight } = originRectInfo;
2386
+ const viewRectInfo = {
2387
+ center: calcViewPointSize(center, { viewScaleInfo }),
2388
+ topLeft: calcViewPointSize(topLeft, { viewScaleInfo }),
2389
+ topRight: calcViewPointSize(topRight, { viewScaleInfo }),
2390
+ bottomLeft: calcViewPointSize(bottomLeft, { viewScaleInfo }),
2391
+ bottomRight: calcViewPointSize(bottomRight, { viewScaleInfo }),
2392
+ top: calcViewPointSize(top, { viewScaleInfo }),
2393
+ right: calcViewPointSize(right, { viewScaleInfo }),
2394
+ left: calcViewPointSize(left, { viewScaleInfo }),
2395
+ bottom: calcViewPointSize(bottom, { viewScaleInfo })
2396
+ };
2397
+ const viewMaxX = Math.max(viewRectInfo.topLeft.x, viewRectInfo.topRight.x, viewRectInfo.bottomRight.x, viewRectInfo.bottomLeft.x);
2398
+ const viewMaxY = Math.max(viewRectInfo.topLeft.y, viewRectInfo.topRight.y, viewRectInfo.bottomRight.y, viewRectInfo.bottomLeft.y);
2399
+ const viewMinX = Math.min(viewRectInfo.topLeft.x, viewRectInfo.topRight.x, viewRectInfo.bottomRight.x, viewRectInfo.bottomLeft.x);
2400
+ const viewMinY = Math.min(viewRectInfo.topLeft.y, viewRectInfo.topRight.y, viewRectInfo.bottomRight.y, viewRectInfo.bottomLeft.y);
2401
+ const rangeCenter = { x: viewRectInfo.center.x, y: viewRectInfo.center.y };
2402
+ const rangeTopLeft = { x: viewMinX, y: viewMinY };
2403
+ const rangeTopRight = { x: viewMaxX, y: viewMinY };
2404
+ const rangeBottomRight = { x: viewMaxX, y: viewMaxY };
2405
+ const rangeBottomLeft = { x: viewMinX, y: viewMaxY };
2406
+ const rangeTop = getCenterFromTwoPoints(rangeTopLeft, rangeTopRight);
2407
+ const rangeBottom = getCenterFromTwoPoints(rangeBottomLeft, rangeBottomRight);
2408
+ const rangeLeft = getCenterFromTwoPoints(rangeTopLeft, rangeBottomLeft);
2409
+ const rangeRight = getCenterFromTwoPoints(rangeTopRight, rangeBottomRight);
2410
+ const rangeRectInfo = {
2411
+ center: rangeCenter,
2412
+ topLeft: rangeTopLeft,
2413
+ topRight: rangeTopRight,
2414
+ bottomLeft: rangeBottomLeft,
2415
+ bottomRight: rangeBottomRight,
2416
+ top: rangeTop,
2417
+ right: rangeRight,
2418
+ left: rangeLeft,
2419
+ bottom: rangeBottom
2420
+ };
2421
+ return {
2422
+ originRectInfo,
2423
+ viewRectInfo,
2424
+ rangeRectInfo
2425
+ };
2222
2426
  }
2223
- function calcElementQueueVertexesQueueInGroup(groupQueue) {
2224
- const vesList = [];
2225
- let totalX = 0;
2226
- let totalY = 0;
2227
- const rotateActionList = [];
2228
- const elemQueue = [...groupQueue];
2229
- for (let i = 0; i < elemQueue.length; i++) {
2230
- const { x: x2, y: y2, w: w2, h: h2, angle: angle2 = 0 } = elemQueue[i];
2231
- totalX += x2;
2232
- totalY += y2;
2233
- let ves;
2234
- if (i === 0) {
2235
- const elemSize = { x: totalX, y: totalY, w: w2, h: h2, angle: angle2 };
2236
- ves = calcElementVertexes({ x: x2, y: y2, w: w2, h: h2, angle: angle2 });
2237
- rotateActionList.push({
2238
- center: calcElementCenter(elemSize),
2239
- angle: angle2,
2240
- radian: parseAngleToRadian(angle2)
2241
- });
2242
- } else {
2243
- const elemSize = { x: totalX, y: totalY, w: w2, h: h2, angle: angle2 };
2244
- ves = getElementVertexes(elemSize);
2245
- for (let aIdx = 0; aIdx < rotateActionList.length; aIdx++) {
2246
- const { center, radian } = rotateActionList[aIdx];
2247
- ves = rotateVertexes(center, ves, radian);
2248
- }
2249
- const vesCenter = calcElementCenterFromVertexes(ves);
2250
- if (angle2 > 0 || angle2 < 0) {
2251
- const radian = parseAngleToRadian(angle2);
2252
- ves = rotateVertexes(vesCenter, ves, radian);
2427
+ function sortElementsViewVisiableInfoMap(elements) {
2428
+ const visibleInfoMap = {};
2429
+ const currentPosition = [];
2430
+ const _walk = (elem) => {
2431
+ const baseInfo = {
2432
+ viewRectInfo: null,
2433
+ rangeRectInfo: null,
2434
+ isVisibleInView: true,
2435
+ isGroup: elem.type === "group",
2436
+ position: [...currentPosition]
2437
+ };
2438
+ let originRectInfo = null;
2439
+ const groupQueue = getGroupQueueByElementPosition(elements, currentPosition);
2440
+ originRectInfo = calcElementOriginRectInfo(elem, {
2441
+ groupQueue: groupQueue || []
2442
+ });
2443
+ visibleInfoMap[elem.uuid] = {
2444
+ ...baseInfo,
2445
+ ...{
2446
+ originRectInfo
2253
2447
  }
2254
- rotateActionList.push({
2255
- center: vesCenter,
2256
- angle: angle2,
2257
- radian: parseAngleToRadian(angle2)
2448
+ };
2449
+ if (elem.type === "group") {
2450
+ elem.detail.children.forEach((ele, i) => {
2451
+ if (ele.type === "group") {
2452
+ currentPosition.push(i);
2453
+ }
2454
+ _walk(ele);
2455
+ if (ele.type === "group") {
2456
+ currentPosition.pop();
2457
+ }
2258
2458
  });
2259
2459
  }
2260
- vesList.push(ves);
2261
- }
2262
- return vesList;
2263
- }
2264
- function calcElementVertexesQueueInGroup(targetElem, opts) {
2265
- const { groupQueue } = opts;
2266
- if (!(groupQueue.length > 0)) {
2267
- return [calcElementVertexes(targetElem)];
2268
- }
2269
- const elemQueue = [...groupQueue, ...[targetElem]];
2270
- const vesList = calcElementQueueVertexesQueueInGroup(elemQueue);
2271
- return vesList;
2272
- }
2273
- function calcElementVertexesInGroup(targetElem, opts) {
2274
- const vesList = calcElementVertexesQueueInGroup(targetElem, opts);
2275
- const ves = vesList.pop();
2276
- return ves || null;
2460
+ };
2461
+ elements.forEach((elem, index) => {
2462
+ currentPosition.push(index);
2463
+ _walk(elem);
2464
+ currentPosition.pop();
2465
+ });
2466
+ return visibleInfoMap;
2277
2467
  }
2278
2468
  function createControllerElementSizeFromCenter(center, opts) {
2279
2469
  const { x: x2, y: y2 } = center;
@@ -3267,10 +3457,13 @@ var __privateMethod = (obj, member, method) => {
3267
3457
  exports.calcElementCenter = calcElementCenter;
3268
3458
  exports.calcElementCenterFromVertexes = calcElementCenterFromVertexes;
3269
3459
  exports.calcElementListSize = calcElementListSize;
3460
+ exports.calcElementOriginRectInfo = calcElementOriginRectInfo;
3270
3461
  exports.calcElementQueueVertexesQueueInGroup = calcElementQueueVertexesQueueInGroup;
3271
3462
  exports.calcElementSizeController = calcElementSizeController;
3272
3463
  exports.calcElementVertexesInGroup = calcElementVertexesInGroup;
3273
3464
  exports.calcElementVertexesQueueInGroup = calcElementVertexesQueueInGroup;
3465
+ exports.calcElementViewRectInfo = calcElementViewRectInfo;
3466
+ exports.calcElementViewRectInfoMap = calcElementViewRectInfoMap;
3274
3467
  exports.calcElementsContextSize = calcElementsContextSize;
3275
3468
  exports.calcElementsViewInfo = calcElementsViewInfo;
3276
3469
  exports.calcRadian = calcRadian;
@@ -3324,6 +3517,7 @@ var __privateMethod = (obj, member, method) => {
3324
3517
  exports.getElementRotateVertexes = getElementRotateVertexes;
3325
3518
  exports.getElementSize = getElementSize;
3326
3519
  exports.getElementVertexes = getElementVertexes;
3520
+ exports.getGroupQueueByElementPosition = getGroupQueueByElementPosition;
3327
3521
  exports.getGroupQueueFromList = getGroupQueueFromList;
3328
3522
  exports.getModifiedElement = getModifiedElement;
3329
3523
  exports.getSelectedElementUUIDs = getSelectedElementUUIDs;
@@ -3362,6 +3556,7 @@ var __privateMethod = (obj, member, method) => {
3362
3556
  exports.rotatePointInGroup = rotatePointInGroup;
3363
3557
  exports.rotateVertexes = rotateVertexes;
3364
3558
  exports.sortDataAsserts = sortDataAsserts;
3559
+ exports.sortElementsViewVisiableInfoMap = sortElementsViewVisiableInfoMap;
3365
3560
  exports.throttle = throttle;
3366
3561
  exports.toColorHexNum = toColorHexNum;
3367
3562
  exports.toColorHexStr = toColorHexStr;
@@ -1 +1 @@
1
- var iDrawUtil=function(e){"use strict";var t,n,i,o,r,a,l,s=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},c=(e,t,n)=>(s(e,t,"read from private field"),n?n.call(e):t.get(e)),h=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},u=(e,t,n,i)=>(s(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),d=(e,t,n)=>(s(e,t,"access private method"),n);function f(e){return"string"==typeof e&&(/^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e)||/^[a-z]{1,}$/i.test(e))}const g={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function m(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return`${e()}${e()}-${e()}-${e()}-${e()}-${e()}${e()}${e()}`}function x(e){let t=0;for(let n=0;n<e.length;n++)t+=e.charCodeAt(n)*e.charCodeAt(n)*n*n;return t.toString(16).substring(0,4)}function y(e){const t=e.length,n=Math.floor(t/2),i=e.substring(0,4).padEnd(4,"0"),o=e.substring(0,4).padEnd(4,"0");return`@assets/${x(t.toString(16).padEnd(4,i))}${x(e.substring(n-4,n).padEnd(4,i)).padEnd(4,"f")}-${x(e.substring(n-8,n-4).padEnd(4,i)).padEnd(4,"f")}-${x(e.substring(n-12,n-8).padEnd(4,i)).padEnd(4,"f")}-${x(e.substring(n-16,n-12).padEnd(4,o)).padEnd(4,"f")}-${x(e.substring(n,n+4).padEnd(4,o)).padEnd(4,"f")}${x(e.substring(n+4,n+8).padEnd(4,o)).padEnd(4,"f")}${x(o.padEnd(4,i).padEnd(4,o))}`}function p(e){return/^@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(`${e}`)}function w(e){return function e(t){const n=function(e){return Object.prototype.toString.call(e).replace(/[\]|\[]{1,1}/gi,"").split(" ")[1]}(t);if(["Null","Number","String","Boolean","Undefined"].indexOf(n)>=0)return t;if("Array"===n){const n=[];return t.forEach((t=>{n.push(e(t))})),n}if("Object"===n){const n={};Object.keys(t).forEach((i=>{n[i]=e(t[i])}));return Object.getOwnPropertySymbols(t).forEach((i=>{n[i]=e(t[i])})),n}}(e)}function v(e){return(Object.prototype.toString.call(e)||"").replace(/(\[object|\])/gi,"").trim()}const b={type(e,t){const n=v(e);return!0===t?n.toLocaleLowerCase():n},array:e=>"Array"===v(e),json:e=>"Object"===v(e),function:e=>"Function"===v(e),asyncFunction:e=>"AsyncFunction"===v(e),boolean:e=>"Boolean"===v(e),string:e=>"String"===v(e),number:e=>"Number"===v(e),undefined:e=>"Undefined"===v(e),null:e=>"Null"===v(e),promise:e=>"Promise"===v(e)};const{Image:M}=window;function P(e){return new Promise(((t,n)=>{const i=new M;i.crossOrigin="anonymous",i.onload=function(){t(i)},i.onabort=n,i.onerror=n,i.src=e}))}function R(e){return"number"==typeof e&&(e>0||e<=0)}function I(e){return"number"==typeof e&&e>=0}function $(e){return"string"==typeof e&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(`${e}`)}function E(e){return"string"==typeof e&&/^(data:image\/)/.test(`${e}`)}const A={x:function(e){return R(e)},y:function(e){return R(e)},w:I,h:function(e){return"number"==typeof e&&e>=0},angle:function(e){return"number"==typeof e&&e>=-360&&e<=360},number:R,numberStr:function(e){return/^(-?\d+(?:\.\d+)?)$/.test(`${e}`)},borderWidth:function(e){return I(e)},borderRadius:function(e){return R(e)&&e>=0},color:function(e){return f(e)},imageSrc:function(e){return E(e)||$(e)},imageURL:$,imageBase64:E,svg:function(e){return"string"==typeof e&&/^(<svg[\s]{1,}|<svg>)/i.test(`${e}`.trim())&&/<\/[\s]{0,}svg>$/i.test(`${e}`.trim())},html:function(e){let t=!1;if("string"==typeof e){let n=document.createElement("div");n.innerHTML=e,n.children.length>0&&(t=!0),n=null}return t},text:function(e){return"string"==typeof e},fontSize:function(e){return R(e)&&e>0},lineHeight:function(e){return R(e)&&e>0},textAlign:function(e){return["center","left","right"].includes(e)},fontFamily:function(e){return"string"==typeof e&&e.length>0},fontWeight:function(e){return["bold"].includes(e)},strokeWidth:function(e){return R(e)&&e>0}};function S(e={}){const{borderColor:t,borderRadius:n,borderWidth:i}=e;return!(e.hasOwnProperty("borderColor")&&!A.color(t))&&(!(e.hasOwnProperty("borderRadius")&&!A.number(n))&&!(e.hasOwnProperty("borderWidth")&&!A.number(i)))}const C={attrs:function(e){const{x:t,y:n,w:i,h:o,angle:r}=e;return!!(A.x(t)&&A.y(n)&&A.w(i)&&A.h(o)&&A.angle(r))&&(r>=-360&&r<=360)},textDesc:function(e){const{text:t,color:n,fontSize:i,lineHeight:o,fontFamily:r,textAlign:a,fontWeight:l,background:s,strokeWidth:c,strokeColor:h}=e;return!!A.text(t)&&(!!A.color(n)&&(!!A.fontSize(i)&&(!(e.hasOwnProperty("background")&&!A.color(s))&&(!(e.hasOwnProperty("fontWeight")&&!A.fontWeight(l))&&(!(e.hasOwnProperty("lineHeight")&&!A.lineHeight(o))&&(!(e.hasOwnProperty("fontFamily")&&!A.fontFamily(r))&&(!(e.hasOwnProperty("textAlign")&&!A.textAlign(a))&&(!(e.hasOwnProperty("strokeWidth")&&!A.strokeWidth(c))&&(!(e.hasOwnProperty("strokeColor")&&!A.color(h))&&!!S(e))))))))))},rectDesc:function(e){const{background:t}=e;return!(e.hasOwnProperty("background")&&!A.color(t))&&!!S(e)},circleDesc:function(e){const{background:t,borderColor:n,borderWidth:i}=e;return!(e.hasOwnProperty("background")&&!A.color(t))&&(!(e.hasOwnProperty("borderColor")&&!A.color(n))&&!(e.hasOwnProperty("borderWidth")&&!A.number(i)))},imageDesc:function(e){const{src:t}=e;return!!A.imageSrc(t)},svgDesc:function(e){const{svg:t}=e;return!!A.svg(t)},htmlDesc:function(e){const{html:t}=e;return!!A.html(t)}};class k{constructor(e,i){h(this,t,void 0),h(this,n,void 0),u(this,t,e),u(this,n,{devicePixelRatio:1,offscreenCanvas:null,...i})}$undoPixelRatio(e){return e/c(this,n).devicePixelRatio}$doPixelRatio(e){return c(this,n).devicePixelRatio*e}$getContext(){return c(this,t)}$setContext(e){u(this,t,e)}$setFont(e){const n=[];e.fontWeight&&n.push(`${e.fontWeight}`),n.push(`${this.$doPixelRatio(e.fontSize||12)}px`),n.push(`${e.fontFamily||"sans-serif"}`),c(this,t).font=`${n.join(" ")}`}$getOffscreenCanvas(){return c(this,n).offscreenCanvas}$resize(e){const{width:i,height:o,devicePixelRatio:r,resetStyle:a}=e,{canvas:l}=c(this,t);l.width=i*r,l.height=o*r,u(this,n,{...c(this,n),devicePixelRatio:r}),!0===a&&(l.style.width=`${i}px`,l.style.height=`${o}px`)}$getSize(){const{devicePixelRatio:e}=c(this,n),{width:i,height:o}=c(this,t).canvas;return{width:i/e,height:o/e,devicePixelRatio:e}}get canvas(){return c(this,t).canvas}get fillStyle(){return c(this,t).fillStyle}set fillStyle(e){c(this,t).fillStyle=e}get strokeStyle(){return c(this,t).strokeStyle}set strokeStyle(e){c(this,t).strokeStyle=e}get lineWidth(){return this.$undoPixelRatio(c(this,t).lineWidth)}set lineWidth(e){c(this,t).lineWidth=this.$doPixelRatio(e)}get textAlign(){return c(this,t).textAlign}set textAlign(e){c(this,t).textAlign=e}get textBaseline(){return c(this,t).textBaseline}set textBaseline(e){c(this,t).textBaseline=e}get globalAlpha(){return c(this,t).globalAlpha}set globalAlpha(e){c(this,t).globalAlpha=e}get shadowColor(){return c(this,t).shadowColor}set shadowColor(e){c(this,t).shadowColor=e}get shadowOffsetX(){return this.$undoPixelRatio(c(this,t).shadowOffsetX)}set shadowOffsetX(e){c(this,t).shadowOffsetX=this.$doPixelRatio(e)}get shadowOffsetY(){return this.$undoPixelRatio(c(this,t).shadowOffsetY)}set shadowOffsetY(e){c(this,t).shadowOffsetY=this.$doPixelRatio(e)}get shadowBlur(){return this.$undoPixelRatio(c(this,t).shadowBlur)}set shadowBlur(e){c(this,t).shadowBlur=this.$doPixelRatio(e)}get lineCap(){return c(this,t).lineCap}set lineCap(e){c(this,t).lineCap=e}get globalCompositeOperation(){return c(this,t).globalCompositeOperation}set globalCompositeOperation(e){c(this,t).globalCompositeOperation=e}fill(...e){return c(this,t).fill(...e)}arc(e,n,i,o,r,a){return c(this,t).arc(this.$doPixelRatio(e),this.$doPixelRatio(n),this.$doPixelRatio(i),o,r,a)}rect(e,n,i,o){return c(this,t).rect(this.$doPixelRatio(e),this.$doPixelRatio(n),this.$doPixelRatio(i),this.$doPixelRatio(o))}fillRect(e,n,i,o){return c(this,t).fillRect(this.$doPixelRatio(e),this.$doPixelRatio(n),this.$doPixelRatio(i),this.$doPixelRatio(o))}clearRect(e,n,i,o){return c(this,t).clearRect(this.$doPixelRatio(e),this.$doPixelRatio(n),this.$doPixelRatio(i),this.$doPixelRatio(o))}beginPath(){return c(this,t).beginPath()}closePath(){return c(this,t).closePath()}lineTo(e,n){return c(this,t).lineTo(this.$doPixelRatio(e),this.$doPixelRatio(n))}moveTo(e,n){return c(this,t).moveTo(this.$doPixelRatio(e),this.$doPixelRatio(n))}arcTo(e,n,i,o,r){return c(this,t).arcTo(this.$doPixelRatio(e),this.$doPixelRatio(n),this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(r))}getLineDash(){return c(this,t).getLineDash()}setLineDash(e){const n=e.map((e=>this.$doPixelRatio(e)));return c(this,t).setLineDash(n)}stroke(e){return e?c(this,t).stroke(e):c(this,t).stroke()}translate(e,n){return c(this,t).translate(this.$doPixelRatio(e),this.$doPixelRatio(n))}rotate(e){return c(this,t).rotate(e)}drawImage(...e){const n=e[0],i=e[1],o=e[2],r=e[3],a=e[4],l=e[e.length-4],s=e[e.length-3],h=e[e.length-2],u=e[e.length-1];return 9===e.length?c(this,t).drawImage(n,this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(r),this.$doPixelRatio(a),this.$doPixelRatio(l),this.$doPixelRatio(s),this.$doPixelRatio(h),this.$doPixelRatio(u)):c(this,t).drawImage(n,this.$doPixelRatio(l),this.$doPixelRatio(s),this.$doPixelRatio(h),this.$doPixelRatio(u))}createPattern(e,n){return c(this,t).createPattern(e,n)}measureText(e){return c(this,t).measureText(e)}fillText(e,n,i,o){return void 0!==o?c(this,t).fillText(e,this.$doPixelRatio(n),this.$doPixelRatio(i),this.$doPixelRatio(o)):c(this,t).fillText(e,this.$doPixelRatio(n),this.$doPixelRatio(i))}strokeText(e,n,i,o){return void 0!==o?c(this,t).strokeText(e,this.$doPixelRatio(n),this.$doPixelRatio(i),this.$doPixelRatio(o)):c(this,t).strokeText(e,this.$doPixelRatio(n),this.$doPixelRatio(i))}save(){c(this,t).save()}restore(){c(this,t).restore()}scale(e,n){c(this,t).scale(e,n)}circle(e,n,i,o,r,a,l,s){c(this,t).ellipse(this.$doPixelRatio(e),this.$doPixelRatio(n),this.$doPixelRatio(i),this.$doPixelRatio(o),r,a,l,s)}isPointInPath(e,n){return c(this,t).isPointInPath(this.$doPixelRatio(e),this.$doPixelRatio(n))}clip(...e){return c(this,t).clip(...e)}setTransform(e,n,i,o,r,a){return c(this,t).setTransform(e,n,i,o,r,a)}getTransform(){return c(this,t).getTransform()}createLinearGradient(e,n,i,o){return c(this,t).createLinearGradient(this.$doPixelRatio(e),this.$doPixelRatio(n),this.$doPixelRatio(i),this.$doPixelRatio(o))}createRadialGradient(e,n,i,o,r,a){return c(this,t).createRadialGradient(this.$doPixelRatio(e),this.$doPixelRatio(n),this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(r),this.$doPixelRatio(a))}createConicGradient(e,n,i){return c(this,t).createConicGradient(e,this.$doPixelRatio(n),this.$doPixelRatio(i))}}function z(e){const{width:t,height:n,ctx:i,devicePixelRatio:o}=e;let r=i;if(!r){const e=document.createElement("canvas");e.width=t*o,e.height=n*o,r=e.getContext("2d")}return new k(r,e)}function O(e){const{width:t,height:n,devicePixelRatio:i}=e,o=new OffscreenCanvas(t*i,n*i),r=o.getContext("2d").canvas.getContext("2d");return new k(r,{devicePixelRatio:i,offscreenCanvas:o})}t=new WeakMap,n=new WeakMap;function L(e,t){const n=(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y);return 0===n?n:Math.sqrt(n)}function T(e,t){return e.x===t.x&&e.y===t.y&&e.t===t.t}function D(e){return e>=0||e<0}function j(e){return D(e.x)&&D(e.y)&&e.t>0}function W(e,t){return{x:e.x+(t.x-e.x)/2,y:e.y+(t.y-e.y)/2}}i=new WeakMap;function V(e){return e/180*Math.PI}function F(e,t,n,i){const o=V(t||0);n&&(o>0||o<0)&&(e.translate(n.x,n.y),e.rotate(o),e.translate(-n.x,-n.y)),i(e),n&&(o>0||o<0)&&(e.translate(n.x,n.y),e.rotate(-o),e.translate(-n.x,-n.y))}function H(e){return{x:e.x+e.w/2,y:e.y+e.h/2}}function B(e){const t=Math.min(e[0].x,e[1].x,e[2].x,e[3].x),n=Math.min(e[0].y,e[1].y,e[2].y,e[3].y);return H({x:t,y:n,w:Math.max(e[0].x,e[1].x,e[2].x,e[3].x)-t,h:Math.max(e[0].y,e[1].y,e[2].y,e[3].y)-n})}function N(e,t){const n=t.x-e.x,i=t.y-e.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}function G(e,t,n){let i=N(e,t)+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 o=L(e,t);let r=0,a=0;return 0===i?(r=0,a=0-o):i>0&&i<Math.PI/2?(r=Math.sin(i)*o,a=0-Math.cos(i)*o):i===Math.PI/2?(r=o,a=0):i>Math.PI/2&&i<Math.PI?(r=Math.sin(Math.PI-i)*o,a=Math.cos(Math.PI-i)*o):i===Math.PI?(r=0,a=o):i>Math.PI&&i<1.5*Math.PI?(r=0-Math.sin(i-Math.PI)*o,a=Math.cos(i-Math.PI)*o):i===1.5*Math.PI?(r=0-o,a=0):i>1.5*Math.PI&&i<2*Math.PI?(r=0-Math.sin(2*Math.PI-i)*o,a=0-Math.cos(2*Math.PI-i)*o):i===2*Math.PI&&(r=0,a=0-o),r+=e.x,a+=e.y,{x:r,y:a}}function Q(e,t,n){const{x:i,y:o,w:r,h:a}=e;let l={x:i,y:o},s={x:i+r,y:o},c={x:i+r,y:o+a},h={x:i,y:o+a};if(n&&(n>0||n<0)){const e=V(X(n));l=G(t,l,e),s=G(t,s,e),c=G(t,c,e),h=G(t,h,e)}return[l,s,c,h]}function U(e){const{angle:t=0}=e;return Q(e,H(e),t)}function Y(e,t,n){return[G(e,{x:t[0].x,y:t[0].y},n),G(e,{x:t[1].x,y:t[1].y},n),G(e,{x:t[2].x,y:t[2].y},n),G(e,{x:t[3].x,y:t[3].y},n)]}function X(e){if(!(e>0||e<0)||0===e)return 0;let t=e%360;return t<0&&(t+=360),t}function q(e,t){const n={x:0,y:0,w:0,h:0};e.forEach((e=>{const t={x:e.x,y:e.y,w:e.w,h:e.h,angle:e.angle};if(t.angle&&(t.angle>0||t.angle<0)){const e=U(t);if(4===e.length){const n=[e[0].x,e[1].x,e[2].x,e[3].x],i=[e[0].y,e[1].y,e[2].y,e[3].y];t.x=Math.min(...n),t.y=Math.min(...i),t.w=Math.abs(Math.max(...n)-Math.min(...n)),t.h=Math.abs(Math.max(...i)-Math.min(...i))}}const i=Math.min(t.x,n.x),o=Math.min(t.y,n.y),r=Math.max(t.x+t.w,n.x+n.w),a=Math.max(t.y+t.h,n.y+n.h);n.x=i,n.y=o,n.w=Math.abs(r-i),n.h=Math.abs(a-o)})),(null==t?void 0:t.extend)&&(n.x=Math.min(n.x,0),n.y=Math.min(n.y,0));const i={contextWidth:n.w,contextHeight:n.h};return(null==t?void 0:t.viewWidth)&&(null==t?void 0:t.viewHeight)&&(null==t?void 0:t.viewWidth)>0&&(null==t?void 0:t.viewHeight)>0&&(t.viewWidth>n.x+n.w&&(i.contextWidth=t.viewWidth-n.x),t.viewHeight>n.y+n.h&&(i.contextHeight=t.viewHeight-n.y)),i}function Z(e,t){let n=null,i=t;for(let t=0;t<e.length;t++){const o=i[e[t]];if(t<e.length-1&&"group"===o.type)i=o.detail.children;else{if(t!==e.length-1)break;n=o}}return n}function J(e,t){const n=[];let i=!1;const o=t=>{var r;for(let a=0;a<t.length&&!0!==i;a++){n.push(a);const l=t[a];if(l.uuid===e){i=!0;break}if("group"===l.type&&o((null==(r=null==l?void 0:l.detail)?void 0:r.children)||[]),i)break;n.pop()}};return o(t),n}function K(e,t){const n=e.x,i=e.y,o=e.x+e.w,r=e.y+e.h,a=t.x,l=t.y,s=t.x+t.w,c=t.y+t.h;return n<=s&&o>=a&&i<=c&&r>=l}function _(e,t){const{viewScaleInfo:n}=t,{x:i,y:o,w:r,h:a,angle:l}=e,{scale:s,offsetTop:c,offsetLeft:h}=n;return{x:i*s+h,y:o*s+c,w:r*s,h:a*s,angle:l}}function ee(e,t){const{viewScaleInfo:n}=t,{x:i,y:o}=e,{scale:r,offsetTop:a,offsetLeft:l}=n;return{x:i*r+l,y:o*r+a}}function te(e,t){const{context2d:n,element:i,viewScaleInfo:o,viewSizeInfo:r}=t,{angle:a=0}=i,{x:l,y:s,w:c,h:h}=_(i,{viewScaleInfo:o,viewSizeInfo:r}),u=U({x:l,y:s,w:c,h:h,angle:a});if(u.length>=2){n.beginPath(),n.moveTo(u[0].x,u[0].y);for(let e=1;e<u.length;e++)n.lineTo(u[e].x,u[e].y);n.closePath()}return!!n.isPointInPath(e.x,e.y)}function ne(e){const{x:t,y:n,h:i,w:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t+o,y:n+i},{x:t,y:n+i}]}function ie(e){const{x:t,y:n,w:i,h:o,angle:r=0}=e;return 0===r?ne(e):Q(e,H({x:t,y:n,w:i,h:o,angle:r}),r)}function oe(e){const t=[];let n=0,i=0;const o=[],r=[...e];for(let e=0;e<r.length;e++){const{x:a,y:l,w:s,h:c,angle:h=0}=r[e];let u;if(n+=a,i+=l,0===e){const e={x:n,y:i,w:s,h:c,angle:h};u=ie({x:a,y:l,w:s,h:c,angle:h}),o.push({center:H(e),angle:h,radian:V(h)})}else{u=ne({x:n,y:i,w:s,h:c,angle:h});for(let e=0;e<o.length;e++){const{center:t,radian:n}=o[e];u=Y(t,u,n)}const e=B(u);if(h>0||h<0){u=Y(e,u,V(h))}o.push({center:e,angle:h,radian:V(h)})}t.push(u)}return t}function re(e,t){const{groupQueue:n}=t;if(!(n.length>0))return[ie(e)];return oe([...n,e])}function ae(e,t){return re(e,t).pop()||null}function le(e,t){const{x:n,y:i}=e,{size:o,angle:r}=t;return{x:n-o/2,y:i-o/2,w:o,h:o,angle:r}}o=new WeakMap,r=new WeakMap,a=new WeakSet,l=function(){return w(c(this,r))};const se=/([astvzqmhlc])([^astvzqmhlc]*)/gi,ce=/(-?\d+(?:\.\d+)?)/gi;const he=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g,ue=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,de=/^\s*$/,fe={};function ge(e){const t={type:"element",name:"",isVoid:!1,attributes:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(fe[n[1]]||"/"===e.charAt(e.length-2))&&(t.isVoid=!0),t.name.startsWith("!--"))){const t=e.indexOf("--\x3e");return{type:"comment",name:null,attributes:{},children:[],isVoid:!1,comment:-1!==t?e.slice(4,t):""}}const i=new RegExp(he);let o=null;for(;o=i.exec(e),null!==o;)if(o[0].trim())if(o[1]){const e=o[1].trim();let n=[e,""];e.indexOf("=")>-1&&(n=e.split("=")),t.attributes[n[0]]=n[1],i.lastIndex--}else o[2]&&(t.attributes[o[2]]=o[3].trim().substring(1,o[3].length-1));return t}function me(e,t){switch(t.type){case"text":return e+t.textContent;case"element":return e+="<"+t.name+(t.attributes?function(e){const t=[];for(let n in e)t.push(n+'="'+e[n]+'"');return t.length?" "+t.join(" "):""}(t.attributes):"")+(t.isVoid?"/>":">"),t.isVoid?e:e+t.children.reduce(me,"")+"</"+t.name+">";case"comment":return e+="\x3c!--"+t.comment+"--\x3e"}}function xe(e,t){let n=2;return void 0!==(null==t?void 0:t.decimalPlaces)&&(null==t?void 0:t.decimalPlaces)>=0&&(n=t.decimalPlaces),parseFloat(e.toFixed(n))}function ye(e){return e[1]!=-1*e[3]||e[4]!=e[0]||e[0]*e[4]-e[3]*e[1]!=1?null:Math.acos(e[0])}const pe="Text Element";function we(){return{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,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"}}function ve(){return{background:"#D9D9D9"}}const be={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,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};const Me=e=>xe(e,{decimalPlaces:4});function Pe(e,t){const{detail:n}=e,{xRatio:i,yRatio:o,maxRatio:r}=t,a=(i+o)/2,{borderWidth:l,borderRadius:s,borderDash:c,shadowOffsetX:h,shadowOffsetY:u,shadowBlur:d}=n;if("number"==typeof l)n.borderWidth=Me(l*a);else if(Array.isArray(n.borderWidth)){const e=l;n.borderWidth=[Me(e[0]*o),Me(e[1]*i),Me(e[2]*o),Me(e[3]*i)]}if("number"==typeof s)n.borderRadius=Me(s*a);else if(Array.isArray(n.borderRadius)){const e=s;n.borderRadius=[e[0]*i,e[1]*i,e[2]*o,e[3]*o]}Array.isArray(c)&&c.forEach(((e,t)=>{n.borderDash[t]=Me(e*r)})),"number"==typeof h&&(n.shadowOffsetX=Me(h*r)),"number"==typeof u&&(n.shadowOffsetX=Me(u*r)),"number"==typeof d&&(n.shadowOffsetX=Me(d*r))}function Re(e,t){const{type:n}=e;!function(e,t){const{xRatio:n,yRatio:i}=t,{x:o,y:r,w:a,h:l}=e;e.x=Me(o*n),e.y=Me(r*i),e.w=Me(a*n),e.h=Me(l*i),Pe(e,t)}(e,t),"circle"===n||("text"===n?function(e,t){const{minRatio:n,maxRatio:i}=t,{fontSize:o,lineHeight:r}=e.detail,a=(n+i)/2;o&&o>0&&(e.detail.fontSize=Me(o*a)),r&&r>0&&(e.detail.lineHeight=Me(r*a))}(e,t):"image"===n||"svg"===n||"html"===n||"path"===n||"group"===n&&Array.isArray(e.detail.children)&&e.detail.children.forEach((e=>{Re(e,t)})))}function Ie(e,t){const n=t.w&&t.w>0?t.w:e.w,i=t.h&&t.h>0?t.h:e.h,o=n/e.w,r=i/e.h;if(o===r&&1===o)return e;const a=Math.min(o,r),l=Math.max(o,r);e.w=n,e.h=i;const s={xRatio:o,yRatio:r,minRatio:a,maxRatio:l};return"group"===e.type&&Array.isArray(e.detail.children)&&e.detail.children.forEach((e=>{Re(e,s)})),Pe(e,s),e}const $e=200,Ee=200;function Ae(e,t,n){let i=!1;if(1===t.length){const o=t[0];n.splice(o,0,e),i=!0}else if(t.length>1){let o=n;for(let n=0;n<t.length;n++){const r=o[t[n]];if(n===t.length-1){const r=t[n];o.splice(r,0,e),i=!0}else{if(!(n<t.length-1&&"group"===r.type))break;o=r.detail.children}}}return i}function Se(e,t){let n=!1;if(1===e.length){const i=e[0];t.splice(i,1),n=!0}else if(e.length>1){let i=t;for(let t=0;t<e.length;t++){const o=i[e[t]];if(t===e.length-1){const o=e[t];i.splice(o,1),n=!0}else{if(!(t<e.length-1&&"group"===o.type))break;i=o.detail.children}}}return n}function Ce(e,t){const n=[...t.from],i=[...t.to];if(0===n.length||0===i.length)return{elements:e,from:n,to:i};if(n.length<=i.length)for(let t=0;t<n.length;t++)if(i[t]!==n[t]);else if(t===n.length-1)return{elements:e,from:n,to:i};const o=Z(n,e);if(o){if(!Ae(o,i,e))return{elements:e,from:n,to:i};let t=-1;for(let e=0;e<n.length&&i[e]>=0;e++)i[e]!==n[e]&&i[e]<n[e]&&e==i.length-1&&(t=e);t>=0&&(n[t]=n[t]+1),Se(n,e)}return{elements:e,from:n,to:i}}function ke(e,t){var n;const i=Object.keys(t);for(let o=0;o<i.length;o++){const r=i[o];["x","y","w","h","angle","name"].includes(r)?e[r]=t[r]:["detail","operations"].includes(r)&&(b.json(t[r])?((null==e?void 0:e.hasOwnProperty(r))||(e[r]={}),b.json(e[r])&&(e[r]={...e[r],...t[r]})):b.array(t[r])&&((null==e?void 0:e.hasOwnProperty(r))||(e[r]=[]),b.array(e[r])&&(null==(n=null==t?void 0:t[r])||n.forEach(((t,n)=>{e[r][n]=t})),e[r]=[...e[r],...t[r]])))}return e}function ze(e,t,n){var i;const o=Z(e,n);return o&&("group"===o.type&&!0===(null==(i=o.operations)?void 0:i.deepResize)&&(t.w&&t.w>0||t.h&&t.h>0)&&Ie(o,{w:t.w,h:t.h}),ke(o,t)),o}function Oe(e,t,n=void 0){const i=t.split(".").reduce(((e,t)=>Object(e)[t]),e);return void 0===i?n:i}function Le(e,t,n){const i=t.split(".");return"object"!=typeof e||i.reduce(((e,t,i,o)=>i===o.length-1?(e[t]=n,null):(t in e||(e[t]=/^[0-9]{1,}$/.test(o[i+1])?[]:{}),e[t])),e),e}return e.Context2D=k,e.EventEmitter=class{constructor(){h(this,i,void 0),u(this,i,new Map)}on(e,t){if(c(this,i).has(e)){const n=c(this,i).get(e)||[];null==n||n.push(t),c(this,i).set(e,n)}else c(this,i).set(e,[t])}off(e,t){if(c(this,i).has(e)){const n=c(this,i).get(e);if(Array.isArray(n))for(let e=0;e<(null==n?void 0:n.length);e++)if(n[e]===t){n.splice(e,1);break}c(this,i).set(e,n||[])}}trigger(e,t){const n=c(this,i).get(e);return!!Array.isArray(n)&&(n.forEach((e=>{e(t)})),!0)}has(e){if(c(this,i).has(e)){const t=c(this,i).get(e);if(Array.isArray(t)&&t.length>0)return!0}return!1}destroy(){this.clear()}clear(){c(this,i).clear()}},e.Store=class{constructor(e){h(this,a),h(this,o,void 0),h(this,r,void 0),u(this,r,w(e.defaultStorage)),u(this,o,d(this,a,l).call(this))}set(e,t){c(this,o)[e]=t}get(e){return c(this,o)[e]}getSnapshot(){return w(c(this,o))}clear(){u(this,o,d(this,a,l).call(this))}destroy(){u(this,o,null)}},e.calcDistance=L,e.calcElementCenter=H,e.calcElementCenterFromVertexes=B,e.calcElementListSize=function(e){var t;const n={x:0,y:0,w:0,h:0};let i=null;for(let o=0;o<e.length;o++){const r=e[o];if(null==(t=null==r?void 0:r.operations)?void 0:t.invisible)continue;const a={x:r.x,y:r.y,w:r.w,h:r.h,angle:r.angle||0};if(a.angle&&(a.angle>0||a.angle<0)){const e=U(a);if(4===e.length){const t=[e[0].x,e[1].x,e[2].x,e[3].x],n=[e[0].y,e[1].y,e[2].y,e[3].y];a.x=Math.min(...t),a.y=Math.min(...n),a.w=Math.abs(Math.max(...t)-Math.min(...t)),a.h=Math.abs(Math.max(...n)-Math.min(...n))}}if(i){const e=Math.min(a.x,n.x),t=Math.min(a.y,n.y),i=Math.max(a.x+a.w,n.x+n.w),o=Math.max(a.y+a.h,n.y+n.h);n.x=e,n.y=t,n.w=Math.abs(i-e),n.h=Math.abs(o-t)}else n.x=a.x,n.y=a.y,n.w=a.w,n.h=a.h;i=a}return{x:Math.floor(n.x),y:Math.floor(n.y),w:Math.ceil(n.w),h:Math.ceil(n.h)}},e.calcElementQueueVertexesQueueInGroup=oe,e.calcElementSizeController=function(e,t){const{groupQueue:n,controllerSize:i,viewScaleInfo:o}=t,r=(i&&i>0?i:8)/o.scale,{x:a,y:l,w:s,h:c,angle:h=0}=e,u=[{uuid:m(),x:a,y:l,w:s,h:c,angle:h,type:"group",detail:{children:[]}},...n];let d=0;u.forEach((({angle:e=0})=>{d+=e}));const f=ae(e,{groupQueue:n}),g=ae({x:a-2*r,y:l-2*r,h:c+4*r,w:s+4*r,angle:h},{groupQueue:[...n]}),x=W(f[0],f[1]),y=W(f[1],f[2]),p=W(f[2],f[3]),w=W(f[3],f[0]),v=f[0],b=f[1],M=f[2],P=f[3],R=le(x,{size:r,angle:d}),I=le(y,{size:r,angle:d}),$=le(p,{size:r,angle:d}),E=le(w,{size:r,angle:d}),A=le(v,{size:r,angle:d}),S=le(b,{size:r,angle:d}),C=le(P,{size:r,angle:d}),k=le(M,{size:r,angle:d}),z=ie(A),O=ie(S),L=ie(C),T=ie(k),D=[z[1],O[0],O[3],z[2]],j=[O[3],O[2],T[1],T[0]],V=[L[1],T[0],T[3],L[2]],F=[z[3],z[2],L[1],L[0]],H=ie(R),B=ie(I),N=ie($),G=ie(E),Q=W(g[0],g[1]);return{elementWrapper:f,left:{type:"left",vertexes:F,center:w},right:{type:"right",vertexes:j,center:y},top:{type:"top",vertexes:D,center:x},bottom:{type:"bottom",vertexes:V,center:p},topLeft:{type:"top-left",vertexes:z,center:v},topRight:{type:"top-right",vertexes:O,center:b},bottomLeft:{type:"bottom-left",vertexes:L,center:P},bottomRight:{type:"bottom-right",vertexes:T,center:M},leftMiddle:{type:"left-middle",vertexes:G,center:w},rightMiddle:{type:"right-middle",vertexes:B,center:y},topMiddle:{type:"top-middle",vertexes:H,center:x},bottomMiddle:{type:"bottom-middle",vertexes:N,center:p},rotate:{type:"rotate",vertexes:ie(le(Q,{size:r,angle:d})),center:Q}}},e.calcElementVertexesInGroup=ae,e.calcElementVertexesQueueInGroup=re,e.calcElementsContextSize=q,e.calcElementsViewInfo=function(e,t,n){const i=q(e,{viewWidth:t.width,viewHeight:t.height,extend:null==n?void 0:n.extend});return!0===(null==n?void 0:n.extend)&&(i.contextWidth=Math.max(i.contextWidth,t.contextWidth),i.contextHeight=Math.max(i.contextHeight,t.contextHeight)),{contextSize:i}},e.calcRadian=function(e,t,n){const i=N(e,t),o=N(e,n);return null!==o&&null!==i?i>3*Math.PI/2&&o<Math.PI/2?o+(2*Math.PI-i):o>3*Math.PI/2&&i<Math.PI/2?i+(2*Math.PI-o):o-i:0},e.calcSpeed=function(e,t){return L(e,t)/Math.abs(t.t-e.t)},e.calcViewBoxSize=function(e,t){const{viewScaleInfo:n}=t,{scale:i}=n;let{borderRadius:o}=e.detail;const{boxSizing:r=be.boxSizing,borderWidth:a}=e.detail;Array.isArray(a)&&(o=0);let{x:l,y:s,w:c,h:h}=e,u=[0,0,0,0];if("number"==typeof o){const e=o*i;u=[e,e,e,e]}else Array.isArray(o)&&4===(null==o?void 0:o.length)&&(u=[o[0]*i,o[1]*i,o[2]*i,o[3]*i]);let d=0;return"number"==typeof a&&(d=(a||0)*i),"border-box"===r?(l=e.x+d/2,s=e.y+d/2,c=e.w-d,h=e.h-d):"content-box"===r?(l=e.x-d/2,s=e.y-d/2,c=e.w+d,h=e.h+d):(l=e.x,s=e.y,c=e.w,h=e.h),c=Math.max(c,1),h=Math.max(h,1),u=u.map((e=>Math.min(e,c/2,h/2))),{x:l,y:s,w:c,h:h,radiusList:u}},e.calcViewCenter=function(e){let t=0,n=0;if(e){const{viewScaleInfo:i,viewSizeInfo:o}=e,{offsetLeft:r,offsetTop:a,scale:l}=i,{width:s,height:c}=o;t=0-r+s/l/2,n=0-a+c/l/2}return{x:t,y:n}},e.calcViewCenterContent=function(e,t){var n,i,o,r,a,l,s,c;let h=0,u=0,d=1,f=(null==(i=null==(n=null==e?void 0:e.elements)?void 0:n[0])?void 0:i.x)||0,g=(null==(r=null==(o=null==e?void 0:e.elements)?void 0:o[0])?void 0:r.y)||0,m=(null==(l=null==(a=null==e?void 0:e.elements)?void 0:a[0])?void 0:l.w)||0,x=(null==(c=null==(s=null==e?void 0:e.elements)?void 0:s[0])?void 0:c.h)||0;const{width:y,height:p}=t.viewSizeInfo;if(e.elements.forEach((e=>{const t={x:e.x,y:e.y,w:e.w,h:e.h,angle:e.angle};if(t.angle&&(t.angle>0||t.angle<0)){const e=U(t);if(4===e.length){const n=[e[0].x,e[1].x,e[2].x,e[3].x],i=[e[0].y,e[1].y,e[2].y,e[3].y];t.x=Math.min(...n),t.y=Math.min(...i),t.w=Math.abs(Math.max(...n)-Math.min(...n)),t.h=Math.abs(Math.max(...i)-Math.min(...i))}}const n=Math.min(t.x,f),i=Math.min(t.y,g),o=Math.max(t.x+t.w,f+m),r=Math.max(t.y+t.h,g+x);f=n,g=i,m=Math.abs(o-n),x=Math.abs(r-i)})),m>0&&x>0){const e=xe(y/m,{decimalPlaces:4}),t=xe(p/x,{decimalPlaces:4});d=Math.min(e,t,1),h=(m*d-y)/2/d+f,u=(x*d-p)/2/d+g}return{offsetX:xe(h,{decimalPlaces:0}),offsetY:xe(u,{decimalPlaces:0}),scale:d}},e.calcViewElementSize=_,e.calcViewPointSize=ee,e.calcViewScaleInfo=function(e,t){const{scale:n,offsetX:i,offsetY:o}=e,{viewSizeInfo:r}=t,{width:a,height:l,contextWidth:s,contextHeight:c}=r,h=0-i*n,u=0-o*n;return{scale:n,offsetLeft:h,offsetTop:u,offsetRight:a-(s*n+h/n),offsetBottom:l-(c*n+u/n)}},e.calcViewVertexes=function(e,t){return[ee(e[0],t),ee(e[1],t),ee(e[2],t),ee(e[3],t)]},e.check=C,e.checkRectIntersect=K,e.colorNameToHex=function(e){const t=e.toLowerCase(),n=g[t];return"string"==typeof n?n:null},e.colorToCSS=function(e){let t="transparent";if("string"==typeof e)t=e;else if("linear-gradient"===(null==e?void 0:e.type)){const n=[];"number"==typeof e.angle?n.push(`${e.angle}deg`):n.push("180deg"),Array.isArray(e.stops)&&e.stops.forEach((e=>{n.push(`${e.color} ${100*e.offset}%`)})),t=`linear-gradient(${n.join(", ")})`}else if("radial-gradient"===(null==e?void 0:e.type)){const n=[];Array.isArray(e.stops)&&e.stops.forEach((e=>{n.push(`${e.color} ${100*e.offset}%`)})),t=`radial-gradient(circle, ${n.join(", ")})`}return t},e.colorToLinearGradientCSS=function(e){let t="transparent";if("string"==typeof e)t=e;else if("radial-gradient"===(null==e?void 0:e.type)||"linear-gradient"===(null==e?void 0:e.type)){const n=[];Array.isArray(e.stops)&&e.stops.length>0&&(e.stops.forEach(((t,i)=>{n.push(`${t.color} ${100*t.offset}%`),i===e.stops.length-1&&t.offset<1&&n.push(`${t.color} ${100*t.offset}%`)})),t=`linear-gradient(90deg, ${n.join(", ")})`)}return t},e.compose=function(e){return function(t,n){return function i(o){let r=e[o];o===e.length&&n&&(r=n);if(!r)return Promise.resolve();try{return Promise.resolve(r(t,i.bind(null,o+1)))}catch(e){return Promise.reject(e)}}(0)}},e.compressImage=function(e,t){let n=.5;const i=(null==t?void 0:t.type)||"image/png";return(null==t?void 0:t.radio)&&(null==t?void 0:t.radio)>0&&(null==t?void 0:t.radio)<=1&&(n=null==t?void 0:t.radio),new Promise(((t,o)=>{const r=new Image;r.addEventListener("load",(()=>{const{width:e,height:o}=r,a=e*n,l=o*n;let s=document.createElement("canvas");s.width=a,s.height=l;s.getContext("2d").drawImage(r,0,0,a,l);const c=s.toDataURL(i);s=null,t(c)})),r.addEventListener("error",(e=>{o(e)})),r.src=e}))},e.createAssetId=y,e.createBoardContent=function(e,t){const{width:n,height:i,devicePixelRatio:o,offscreen:r,createCustomContext2D:a}=t,l={width:n,height:i,devicePixelRatio:o},s=e.getContext("2d");if(a){const e=a(l),t=a(l),n=a(l),i=z({ctx:s,...l}),o=()=>{const{width:o,height:r}=e.$getSize();i.clearRect(0,0,o,r),i.drawImage(n.canvas,0,0,o,r),i.drawImage(e.canvas,0,0,o,r),i.drawImage(t.canvas,0,0,o,r),n.clearRect(0,0,o,r),e.clearRect(0,0,o,r),t.clearRect(0,0,o,r)};return{underContext:n,viewContext:e,helperContext:t,boardContext:i,drawView:o}}if(!0===r){const e=O(l),t=O(l),n=O(l),i=z({ctx:s,...l}),o=()=>{const{width:o,height:r}=e.$getSize();i.clearRect(0,0,o,r),i.drawImage(n.canvas,0,0,o,r),i.drawImage(e.canvas,0,0,o,r),i.drawImage(t.canvas,0,0,o,r),n.clearRect(0,0,o,r),e.clearRect(0,0,o,r),t.clearRect(0,0,o,r)};return{underContext:n,viewContext:e,helperContext:t,boardContext:i,drawView:o}}{const e=z(l),t=z(l),o=z(l),r=z({ctx:s,...l}),a=()=>{r.clearRect(0,0,n,i),r.drawImage(o.canvas,0,0,n,i),r.drawImage(e.canvas,0,0,n,i),r.drawImage(t.canvas,0,0,n,i),o.clearRect(0,0,n,i),e.clearRect(0,0,n,i),t.clearRect(0,0,n,i)};return{underContext:o,viewContext:e,helperContext:t,boardContext:r,drawView:a}}},e.createContext2D=z,e.createElement=function(e,t,n){const i=function(e,t){let n=0,i=0,o=$e,r=Ee;if(t){const{viewScaleInfo:a,viewSizeInfo:l}=t,{scale:s,offsetLeft:c,offsetTop:h}=a,{width:u,height:d}=l,f=u/4,g=d/4;o=$e>=f?f/s:$e/s,r=Ee>=g?g/s:Ee/s,["circle","svg","image"].includes(e)?o=r=Math.max(o,r):"text"===e&&(r=o/pe.length*2),n=(0-c+u/2-o*s/2)/s,i=(0-h+d/2-r*s/2)/s}return{x:n,y:i,w:o,h:r}}(e,n);let o={};return"rect"===e?o={background:"#D9D9D9"}:"circle"===e?o={background:"#D9D9D9",radius:0}:"text"===e?o=function(e){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,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};return{text:pe,color:t.color,fontFamily:t.fontFamily,fontWeight:t.fontWeight,lineHeight:e.w/pe.length,fontSize:e.w/pe.length,textAlign:"center",verticalAlign:"middle"}}(i):"svg"===e?o={svg:'<svg t="1701004189871" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><path d="M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3-12.3 12.7-12.1 32.9 0.6 45.3l183.7 179.1-43.4 252.9c-1.2 6.9-0.1 14.1 3.2 20.3 8.2 15.6 27.6 21.7 43.2 13.4L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3zM664.8 561.6l36.1 210.3L512 672.7 323.1 772l36.1-210.3-152.8-149L417.6 382 512 190.7 606.4 382l211.2 30.7-152.8 148.9z" fill="#2c2c2c"></path></svg>'}:"image"===e?o={src:"data:image/svg+xml;base64,PHN2ZyAgIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiAgd2lkdGg9IjIwMCIgaGVpZ2h0PSIyMDAiPjxwYXRoIGQ9Ik05MjggMTYwSDk2Yy0xNy43IDAtMzIgMTQuMy0zMiAzMnY2NDBjMCAxNy43IDE0LjMgMzIgMzIgMzJoODMyYzE3LjcgMCAzMi0xNC4zIDMyLTMyVjE5MmMwLTE3LjctMTQuMy0zMi0zMi0zMnogbS00MCA2MzJIMTM2di0zOS45bDEzOC41LTE2NC4zIDE1MC4xIDE3OEw2NTguMSA0ODkgODg4IDc2MS42Vjc5MnogbTAtMTI5LjhMNjY0LjIgMzk2LjhjLTMuMi0zLjgtOS0zLjgtMTIuMiAwTDQyNC42IDY2Ni40bC0xNDQtMTcwLjdjLTMuMi0zLjgtOS0zLjgtMTIuMiAwTDEzNiA2NTIuN1YyMzJoNzUydjQzMC4yeiIgIGZpbGw9IiM1MTUxNTEiPjwvcGF0aD48cGF0aCBkPSJNMzA0IDQ1NmM0OC42IDAgODgtMzkuNCA4OC04OHMtMzkuNC04OC04OC04OC04OCAzOS40LTg4IDg4IDM5LjQgODggODggODh6IG0wLTExNmMxNS41IDAgMjggMTIuNSAyOCAyOHMtMTIuNSAyOC0yOCAyOC0yOC0xMi41LTI4LTI4IDEyLjUtMjggMjgtMjh6IiAgZmlsbD0iIzUxNTE1MSI+PC9wYXRoPjwvc3ZnPg=="}:"group"===e&&(o={children:[],background:"#D9D9D9",overflow:"hidden"}),{...i,...t,uuid:m(),type:e,detail:{...o,...t.detail||{}}}},e.createOffscreenContext2D=O,e.createUUID=m,e.debounce=function(e,t){let n=-1;return function(...i){n>=0&&window.clearTimeout(n),n=setTimeout((()=>{e(...i),n=-1}),t)}},e.deepClone=w,e.deepCloneElement=function(e){const t=w(e),n=e=>{e.uuid=m(),"group"===e.type&&e.detail.children&&e.detail.children.forEach((e=>{n(e)}))};return n(t),t},e.deepResizeGroupElement=Ie,e.delay=function(e){return new Promise((t=>{setTimeout((()=>{t()}),e)}))},e.deleteElementInList=function(e,t){return Se(J(e,t),t)},e.deleteElementInListByPosition=Se,e.downloadFileFromText=function(e,t){const{fileName:n}=t,i=function(e){const t=(new TextEncoder).encode(e),n=new Blob([t],{type:"text/plain;charset=utf-8"});return window.URL.createObjectURL(n)}(e);let o=document.createElement("a");o.href=i,o.download=n,o.click(),o=null},e.downloadImageFromCanvas=function(e,t){const{fileName:n,type:i="image/jpeg"}=t,o=e.toDataURL(i);let r=document.createElement("a");r.href=o,r.download=n,r.click(),r=null},e.equalPoint=T,e.equalTouchPoint=function(e,t){return!0===T(e,t)&&e.f===t.f},e.filterCompactData=function(e,t){const n=e.assets||{},i=w(e),o=(null==t?void 0:t.loadItemMap)||{},r=e=>{e.forEach((e=>{var t,i,a;if("image"===e.type&&e.detail.src){const i=e.detail.src;if(p(i)&&!n[i]&&o[i]&&"string"==typeof(null==(t=o[i])?void 0:t.source))n[i]={type:"image",value:o[i].source};else if(!n[i]){const t=y(i);n[t]||(n[t]={type:"image",value:i}),e.detail.src=t}}else if("svg"===e.type){const t=e.detail.svg;if(p(t)&&!n[t]&&o[t]&&"string"==typeof(null==(i=o[t])?void 0:i.source))n[t]={type:"svg",value:o[t].source};else if(!n[t]){const i=y(t);n[i]||(n[i]={type:"svg",value:t}),e.detail.svg=i}}else if("html"===e.type){const t=e.detail.html;if(p(t)&&!n[t]&&o[t]&&"string"==typeof(null==(a=o[t])?void 0:a.source))n[t]={type:"html",value:o[t].source};else if(!n[t]){const i=y(t);n[i]||(n[i]={type:"html",value:t}),e.detail.html=i}}else if("group"===e.type&&Array.isArray(e.detail.children)){const t=e.detail.assets||{};Object.keys(t).forEach((e=>{n[e]||(n[e]=t[e])})),delete e.detail.assets,r(e.detail.children)}}))};return r(i.elements),i.assets=n,i},e.filterElementAsset=function(e){let t=null,n=null,i=null;return"image"===e.type?i=e.detail.src:"svg"===e.type?i=e.detail.svg:"html"===e.type&&(i=e.detail.html),"string"!=typeof i||p(i)||(t=y(i),n={type:e.type,value:i},"image"===e.type?e.detail.src=t:"svg"===e.type?e.detail.svg=t:"html"===e.type&&(e.detail.html=t)),{element:e,assetId:t,assetItem:n}},e.findElementFromList=function e(t,n){var i;let o=null;for(let r=0;r<n.length;r++){const a=n[r];if(a.uuid===t){o=a;break}if(!o&&"group"===a.type){const n=e(t,(null==(i=null==a?void 0:a.detail)?void 0:i.children)||[]);if((null==n?void 0:n.uuid)===t){o=n;break}}}return o},e.findElementFromListByPosition=Z,e.findElementQueueFromListByPosition=function(e,t){const n=[];let i=t;for(let t=0;t<e.length;t++){const o=i[e[t]];if(!o)break;if(n.push(o),!(t<e.length-1&&"group"===o.type))break;i=o.detail.children}return n},e.findElementsFromList=function(e,t){const n=[];return function t(i){var o;for(let r=0;r<i.length;r++){const a=i[r];e.includes(a.uuid)?n.push(a):"group"===a.type&&t((null==(o=null==a?void 0:a.detail)?void 0:o.children)||[])}}(t),n},e.findElementsFromListByPositions=function(e,t){const n=[];return e.forEach((e=>{const i=Z(e,t);i&&n.push(i)})),n},e.formatNumber=xe,e.generateHTML=function(e){return e.reduce((function(e,t){return e+me("",t)}),"")},e.generateSVGPath=function(e){let t="";return e.forEach((e=>{t+=e.type+e.params.join(" ")})),t},e.getCenterFromTwoPoints=W,e.getDefaultElementDetailConfig=we,e.getDefaultElementRectDetail=ve,e.getElemenetsAssetIds=function(e){const t=[],n=e=>{e.forEach((e=>{"image"===e.type&&p(e.detail.src)?t.push(e.detail.src):"svg"===e.type&&p(e.detail.svg)?t.push(e.detail.svg):"html"===e.type&&e.detail.html?t.push(e.detail.html):"group"===e.type&&Array.isArray(e.detail.children)&&n(e.detail.children)}))};return n(e),t},e.getElementPositionFromList=J,e.getElementRotateVertexes=Q,e.getElementSize=function(e){const{x:t,y:n,w:i,h:o,angle:r}=e;return{x:t,y:n,w:i,h:o,angle:r}},e.getElementVertexes=ne,e.getGroupQueueFromList=function(e,t){const n=[];return function e(t,i){var o;let r=null;for(let a=0;a<i.length;a++){const l=i[a];if(l.uuid===t){r=l;break}if(!r&&"group"===l.type){n.push(l);const i=e(t,(null==(o=null==l?void 0:l.detail)?void 0:o.children)||[]);if((null==i?void 0:i.uuid)===t){r=i;break}n.pop()}}return r}(e,t),n},e.getModifiedElement=function(e,t){const n={},i=[],o=e=>{if(b.json(e)){Object.keys(e).forEach((r=>{if(i.push(r),b.json(e[r])||b.array(e[r]))o(e[r]);else{const e=i.join(".");if("uuid"!==e){const o=Oe(t,e);Le(n,i.join("."),o)}}i.pop()}))}else b.array(e)&&e.forEach((r=>{if(i.push(r),b.json(e[r])||b.array(e[r]))o(e[r]);else{const e=Oe(t,i.join("."));Le(n,i.join("."),e)}i.pop()}))};return o(e),n},e.getSelectedElementUUIDs=function(e,t){var n;let i=[];return Array.isArray(null==e?void 0:e.elements)&&(null==(n=null==e?void 0:e.elements)?void 0:n.length)>0&&Array.isArray(t)&&t.length>0&&t.forEach((t=>{var n;"number"==typeof t?(null==(n=null==e?void 0:e.elements)?void 0:n[t])&&i.push(e.elements[t].uuid):"string"==typeof t&&(i=i.concat(function(e,t){var n;const i=[];if("string"==typeof t&&/^\d+(\.\d+)*$/.test(t)){const o=t.split(".");let r=e;for(;o.length>0;){const e=o.shift();if("string"==typeof e){const t=r[parseInt(e)];t&&0===o.length?i.push(t.uuid):"group"===t.type&&o.length>0&&(r=(null==(n=null==t?void 0:t.detail)?void 0:n.children)||[])}break}}return i}(e.elements,t)))})),i},e.getViewPointAtElement=function(e,t){var n,i,o;const{context2d:r,data:a,viewScaleInfo:l,viewSizeInfo:s,groupQueue:c}=t,h={index:-1,element:null,groupQueueIndex:-1};if(c&&Array.isArray(c)&&(null==c?void 0:c.length)>0)for(let t=c.length-1;t>=0;t--){let o=0,a=0,u=0;for(let e=0;e<=t;e++)o+=c[e].x,a+=c[e].y,u+=c[e].angle||0;const d=c[t];if(d&&"group"===d.type&&Array.isArray(null==(n=d.detail)?void 0:n.children))for(let n=0;n<d.detail.children.length;n++){const f=d.detail.children[n];if(!0!==(null==(i=null==f?void 0:f.operations)?void 0:i.invisible)){if(!f)break;if(te(e,{context2d:r,element:{x:o+f.x,y:a+f.y,w:f.w,h:f.h,angle:u+(f.angle||0)},viewScaleInfo:l,viewSizeInfo:s})){h.element=f,(t<c.length-1||"group"!==f.type)&&(h.groupQueueIndex=t);break}}}if(h.element)break}if(h.element)return h;for(let t=a.elements.length-1;t>=0;t--){const n=a.elements[t];if(!0!==(null==(o=null==n?void 0:n.operations)?void 0:o.invisible)&&te(e,{context2d:r,element:n,viewScaleInfo:l,viewSizeInfo:s})){h.index=t,h.element=n;break}}return h},e.getViewScaleInfoFromSnapshot=function(e){const{activeStore:t}=e;return{scale:null==t?void 0:t.scale,offsetTop:null==t?void 0:t.offsetTop,offsetBottom:null==t?void 0:t.offsetBottom,offsetLeft:null==t?void 0:t.offsetLeft,offsetRight:null==t?void 0:t.offsetRight}},e.getViewSizeInfoFromSnapshot=function(e){const{activeStore:t}=e;return{devicePixelRatio:t.devicePixelRatio,width:null==t?void 0:t.width,height:null==t?void 0:t.height,contextWidth:null==t?void 0:t.contextWidth,contextHeight:null==t?void 0:t.contextHeight}},e.insertElementToListByPosition=Ae,e.is=A,e.isAssetId=p,e.isColorStr=f,e.isElementInView=function(e,t){const{viewSizeInfo:n,viewScaleInfo:i}=t,{width:o,height:r}=n,{angle:a}=e,{x:l,y:s,w:c,h:h}=_(e,{viewScaleInfo:i,viewSizeInfo:n}),u=U({x:l,y:s,w:c,h:h,angle:a}),d={x:0,y:0,w:o,h:r},f=Math.min(u[0].x,u[1].x,u[2].x,u[3].x),g=Math.min(u[0].y,u[1].y,u[2].y,u[3].y);return K(d,{x:f,y:g,w:Math.max(u[0].x,u[1].x,u[2].x,u[3].x)-f,h:Math.max(u[0].y,u[1].y,u[2].y,u[3].y)-g})},e.isResourceElement=function(e){return["image","svg","html"].includes(null==e?void 0:e.type)},e.isViewPointInElement=te,e.istype=b,e.limitAngle=X,e.loadHTML=async function(e,t){e=e.replace(/\&/gi,"&amp;");const n=await function(e,t){const{width:n,height:i}=t;return new Promise(((t,o)=>{const r=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 ${e}\n </div>\n </foreignObject>\n </svg>\n `],{type:"image/svg+xml;charset=utf-8"}),a=new FileReader;a.readAsDataURL(r),a.onload=function(e){var n;const i=null==(n=null==e?void 0:e.target)?void 0:n.result;t(i)},a.onerror=function(e){o(e)}}))}(e,t);return await P(n)},e.loadImage=P,e.loadSVG=async function(e){const t=await function(e){return new Promise(((t,n)=>{const i=new Blob([e],{type:"image/svg+xml;charset=utf-8"}),o=new FileReader;o.readAsDataURL(i),o.onload=function(e){var n;const i=null==(n=null==e?void 0:e.target)?void 0:n.result;t(i)},o.onerror=function(e){n(e)}}))}(e);return await P(t)},e.matrixToAngle=function(e){const t=ye(e);if("number"==typeof t){return 180*t/Math.PI}return t},e.matrixToRadian=ye,e.mergeElementAsset=function(e,t){const n=e;let i=null,o=null;return"image"===n.type?i=n.detail.src:"svg"===n.type?i=n.detail.svg:"html"===n.type&&(i=n.detail.html),i&&(null==i?void 0:i.startsWith("@assets/"))&&(o=t[i]),(null==o?void 0:o.type)===n.type&&"string"==typeof(null==o?void 0:o.value)&&(null==o?void 0:o.value)&&("image"===n.type?n.detail.src=o.value:"svg"===n.type?n.detail.svg=o.value:"html"===n.type&&(n.detail.html=o.value)),n},e.mergeHexColorAlpha=function(e,t){if(1===t)return e;let n=1;const i=/^\#[0-9a-f]{6,6}$/i;let o=e;if(i.test(e)?n=parseInt(e.substring(5,7).replace(/^\#/,"0x")):/^\#[0-9a-f]{8,8}$/i.test(e)&&(n=parseInt(e.substring(7,9).replace(/^\#/,"0x")),o=e.substring(0,7)),n*=t,i.test(o)&&n>0&&n<1){const e=Math.max(0,Math.min(255,Math.ceil(256*n)));o=`${o.toUpperCase()}${e.toString(16).toUpperCase()}`}return o},e.modifyElement=function(e,t){const{type:n}=t,i={...t.content};if("addElement"===n){const n=t,{element:i,position:o}=n.content;(null==o?void 0:o.length)>0?Ae(i,[...o],e.elements):e.elements.push(i)}else if("deleteElement"===n){const n=t,{position:i}=n.content;Se(i,e.elements)}else if("moveElement"===n){const n=t,{from:o,to:r}=n.content,a=Ce(e.elements,{from:o,to:r});i.from=a.from,i.to=a.to,e.elements=a.elements}else if("updateElement"===n){const n=t,{position:i,afterModifiedElement:o}=n.content;ze(i,o,e.elements)}return{data:e,content:i}},e.moveElementPosition=Ce,e.parseAngleToRadian=V,e.parseFileToBase64=function(e){return new Promise((function(t,n){let i=new FileReader;i.addEventListener("load",(function(){t(i.result),i=null})),i.addEventListener("error",(function(e){n(e),i=null})),i.addEventListener("abort",(function(){n(new Error("abort")),i=null})),i.readAsDataURL(e)}))},e.parseFileToText=function(e){return new Promise((function(t,n){let i=new FileReader;i.addEventListener("load",(function(){t(i.result),i=null})),i.addEventListener("error",(function(e){n(e),i=null})),i.addEventListener("abort",(function(){n(new Error("abort")),i=null})),i.readAsText(e)}))},e.parseHTML=function(e){const t=[],n=[];let i,o=-1;return e.replace(ue,((r,a)=>{const l="/"!==r.charAt(1),s=r.startsWith("\x3c!--"),c=a+r.length,h=e.charAt(c);let u;if(s){const e=ge(r);return o<0?(t.push(e),r):(u=n[o],u.children.push(e),r)}if(l){if(o++,i=ge(r),!i.isVoid&&h&&"<"!==h){const t=e.slice(c,e.indexOf("<",c));t.trim()&&i.children.push({type:"text",name:null,attributes:{},children:[],isVoid:!1,textContent:t.trim()})}0===o&&t.push(i),u=n[o-1],u&&u.children.push(i),n[o]=i}if((!l||!Array.isArray(i)&&i.isVoid)&&(o>-1&&!Array.isArray(i)&&(i.isVoid||i.name===r.slice(2,-1))&&(o--,i=-1===o?t:n[o]),"<"!==h&&h)){u=-1===o?t:n[o].children;const i=e.indexOf("<",c);let r=e.slice(c,-1===i?void 0:i);de.test(r)&&(r=" "),(i>-1&&o+u.length>=0||" "!==r)&&r.trim()&&u.push({type:"text",name:null,attributes:{},children:[],isVoid:!1,textContent:r.trim()})}return r})),t},e.parseRadianToAngle=function(e){return e/Math.PI*180},e.parseSVGPath=function(e){const t=[];return e.replace(se,((e,n,i)=>{const o=i.match(ce),r={type:n,params:o?o.map(Number):[]};return t.push(r),e})),t},e.pickFile=function(e){const{accept:t,success:n,error:i}=e;let o=document.createElement("input");o.type="file",t&&(o.accept=t),o.addEventListener("change",(function(){var e;const t=null==(e=o.files)?void 0:e[0];n({file:t}),o=null})),o.addEventListener("error",(function(e){"function"==typeof i&&i(e),o=null})),o.click()},e.rotateByCenter=F,e.rotateElement=function(e,t,n){const i=H(t);F(e,t.angle||0,i,(()=>{n(e)}))},e.rotateElementVertexes=U,e.rotatePoint=G,e.rotatePointInGroup=function(e,t){if((null==t?void 0:t.length)>0){let n=e.x,i=e.y;return t.forEach((e=>{const{x:t,y:o,w:r,h:a,angle:l=0}=e,s=G(H({x:t,y:o,w:r,h:a,angle:l}),{x:n,y:i},V(l));n=s.x,i=s.y})),{x:n,y:i}}return e},e.rotateVertexes=Y,e.sortDataAsserts=function(e,t){const n=e.assets||{};let i=e;!0===(null==t?void 0:t.clone)&&(i=w(e));const o=e=>{e.forEach((e=>{if("image"===e.type&&e.detail.src){const t=e.detail.src,i=y(t);n[i]||(n[i]={type:"image",value:t}),e.detail.src=i}else if("svg"===e.type){const t=e.detail.svg,i=y(t);n[i]||(n[i]={type:"svg",value:t}),e.detail.svg=i}else if("html"===e.type){const t=e.detail.html,i=y(t);n[i]||(n[i]={type:"html",value:t}),e.detail.html=i}else if("group"===e.type&&Array.isArray(e.detail.children)){const t=e.detail.assets||{};Object.keys(t).forEach((e=>{n[e]||(n[e]=t[e])})),delete e.detail.assets,o(e.detail.children)}}))};return o(i.elements),i.assets=n,i},e.throttle=function(e,t){let n=-1;return function(...i){n>=0||(n=setTimeout((()=>{e(...i),n=-1}),t))}},e.toColorHexNum=function(e){return parseInt(e.replace(/^\#/,"0x"))},e.toColorHexStr=function(e){return"#"+e.toString(16)},e.updateElementInList=function e(t,n,i){var o,r;let a=null;for(let l=0;l<i.length;l++){const s=i[l];if(s.uuid===t){"group"===s.type&&!0===(null==(o=s.operations)?void 0:o.deepResize)&&(n.w&&n.w>0||n.h&&n.h>0)&&Ie(s,{w:n.w,h:n.h}),ke(s,n),a=s;break}"group"===s.type&&(a=e(t,n,(null==(r=null==s?void 0:s.detail)?void 0:r.children)||[]))}return a},e.updateElementInListByPosition=ze,e.vaildPoint=j,e.vaildTouchPoint=function(e){return!0===j(e)&&e.f>=0},e.validateElements=function e(t){let n=!0;if(Array.isArray(t)){const i=[];t.forEach((t=>{var o;"string"==typeof t.uuid&&t.uuid?i.includes(t.uuid)?(n=!1,console.warn(`Duplicate uuids: ${t.uuid}`)):i.push(t.uuid):(n=!1,console.warn("Element missing uuid",t)),"group"===t.type&&(n=e(null==(o=null==t?void 0:t.detail)?void 0:o.children))}))}return n},e.viewScale=function(e){const{scale:t,point:n,viewScaleInfo:i}=e,{offsetLeft:o,offsetTop:r}=i,a=t/i.scale,l=n.x,s=n.y;return{moveX:l-l*a+(o*a-o),moveY:s-s*a+(r*a-r)}},e.viewScroll=function(e){const{moveX:t=0,moveY:n=0,viewScaleInfo:i,viewSizeInfo:o}=e,{scale:r}=i,{width:a,height:l,contextWidth:s,contextHeight:c}=o;let h=i.offsetLeft,u=i.offsetRight,d=i.offsetTop,f=i.offsetBottom;return h+=t,d+=n,u=a-(s*r+h),f=l-(c*r+d),{scale:r,offsetTop:d,offsetLeft:h,offsetRight:u,offsetBottom:f}},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
1
+ var iDrawUtil=function(t){"use strict";var e,n,i,o,r,a,l,s=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},c=(t,e,n)=>(s(t,e,"read from private field"),n?n.call(t):e.get(t)),h=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},u=(t,e,n,i)=>(s(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),f=(t,e,n)=>(s(t,e,"access private method"),n);function d(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))}const g={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function m(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return`${t()}${t()}-${t()}-${t()}-${t()}-${t()}${t()}${t()}`}function p(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 y(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/${p(e.toString(16).padEnd(4,i))}${p(t.substring(n-4,n).padEnd(4,i)).padEnd(4,"f")}-${p(t.substring(n-8,n-4).padEnd(4,i)).padEnd(4,"f")}-${p(t.substring(n-12,n-8).padEnd(4,i)).padEnd(4,"f")}-${p(t.substring(n-16,n-12).padEnd(4,o)).padEnd(4,"f")}-${p(t.substring(n,n+4).padEnd(4,o)).padEnd(4,"f")}${p(t.substring(n+4,n+8).padEnd(4,o)).padEnd(4,"f")}${p(o.padEnd(4,i).padEnd(4,o))}`}function x(t){return/^@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(`${t}`)}function w(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 v(t){return(Object.prototype.toString.call(t)||"").replace(/(\[object|\])/gi,"").trim()}const b={type(t,e){const n=v(t);return!0===e?n.toLocaleLowerCase():n},array:t=>"Array"===v(t),json:t=>"Object"===v(t),function:t=>"Function"===v(t),asyncFunction:t=>"AsyncFunction"===v(t),boolean:t=>"Boolean"===v(t),string:t=>"String"===v(t),number:t=>"Number"===v(t),undefined:t=>"Undefined"===v(t),null:t=>"Null"===v(t),promise:t=>"Promise"===v(t)};const{Image:M}=window;function P(t){return new Promise(((e,n)=>{const i=new M;i.crossOrigin="anonymous",i.onload=function(){e(i)},i.onabort=n,i.onerror=n,i.src=t}))}function R(t){return"number"==typeof t&&(t>0||t<=0)}function I(t){return"number"==typeof t&&t>=0}function S(t){return"string"==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(`${t}`)}function $(t){return"string"==typeof t&&/^(data:image\/)/.test(`${t}`)}const E={x:function(t){return R(t)},y:function(t){return R(t)},w:I,h:function(t){return"number"==typeof t&&t>=0},angle:function(t){return"number"==typeof t&&t>=-360&&t<=360},number:R,numberStr:function(t){return/^(-?\d+(?:\.\d+)?)$/.test(`${t}`)},borderWidth:function(t){return I(t)},borderRadius:function(t){return R(t)&&t>=0},color:function(t){return d(t)},imageSrc:function(t){return $(t)||S(t)},imageURL:S,imageBase64:$,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 R(t)&&t>0},lineHeight:function(t){return R(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 R(t)&&t>0}};function A(t={}){const{borderColor:e,borderRadius:n,borderWidth:i}=t;return!(t.hasOwnProperty("borderColor")&&!E.color(e))&&(!(t.hasOwnProperty("borderRadius")&&!E.number(n))&&!(t.hasOwnProperty("borderWidth")&&!E.number(i)))}const C={attrs:function(t){const{x:e,y:n,w:i,h:o,angle:r}=t;return!!(E.x(e)&&E.y(n)&&E.w(i)&&E.h(o)&&E.angle(r))&&(r>=-360&&r<=360)},textDesc:function(t){const{text:e,color:n,fontSize:i,lineHeight:o,fontFamily:r,textAlign:a,fontWeight:l,background:s,strokeWidth:c,strokeColor:h}=t;return!!E.text(e)&&(!!E.color(n)&&(!!E.fontSize(i)&&(!(t.hasOwnProperty("background")&&!E.color(s))&&(!(t.hasOwnProperty("fontWeight")&&!E.fontWeight(l))&&(!(t.hasOwnProperty("lineHeight")&&!E.lineHeight(o))&&(!(t.hasOwnProperty("fontFamily")&&!E.fontFamily(r))&&(!(t.hasOwnProperty("textAlign")&&!E.textAlign(a))&&(!(t.hasOwnProperty("strokeWidth")&&!E.strokeWidth(c))&&(!(t.hasOwnProperty("strokeColor")&&!E.color(h))&&!!A(t))))))))))},rectDesc:function(t){const{background:e}=t;return!(t.hasOwnProperty("background")&&!E.color(e))&&!!A(t)},circleDesc:function(t){const{background:e,borderColor:n,borderWidth:i}=t;return!(t.hasOwnProperty("background")&&!E.color(e))&&(!(t.hasOwnProperty("borderColor")&&!E.color(n))&&!(t.hasOwnProperty("borderWidth")&&!E.number(i)))},imageDesc:function(t){const{src:e}=t;return!!E.imageSrc(e)},svgDesc:function(t){const{svg:e}=t;return!!E.svg(e)},htmlDesc:function(t){const{html:e}=t;return!!E.html(e)}};class L{constructor(t,i){h(this,e,void 0),h(this,n,void 0),u(this,e,t),u(this,n,{devicePixelRatio:1,offscreenCanvas:null,...i}),this.$resetFont()}$undoPixelRatio(t){return t/c(this,n).devicePixelRatio}$doPixelRatio(t){return c(this,n).devicePixelRatio*t}$getContext(){return c(this,e)}$setContext(t){u(this,e,t)}$setFont(t){const n=[];t.fontWeight&&n.push(`${t.fontWeight}`),n.push(`${this.$doPixelRatio(t.fontSize||12)}px`),n.push(`${t.fontFamily||"sans-serif"}`),c(this,e).font=`${n.join(" ")}`}$resetFont(){this.$setFont({fontSize:12,fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'",fontWeight:"400"})}$getOffscreenCanvas(){return c(this,n).offscreenCanvas}$resize(t){const{width:i,height:o,devicePixelRatio:r,resetStyle:a}=t,{canvas:l}=c(this,e);l.width=i*r,l.height=o*r,u(this,n,{...c(this,n),devicePixelRatio:r}),!0===a&&(l.style.width=`${i}px`,l.style.height=`${o}px`)}$getSize(){const{devicePixelRatio:t}=c(this,n),{width:i,height:o}=c(this,e).canvas;return{width:i/t,height:o/t,devicePixelRatio:t}}get canvas(){return c(this,e).canvas}get fillStyle(){return c(this,e).fillStyle}set fillStyle(t){c(this,e).fillStyle=t}get strokeStyle(){return c(this,e).strokeStyle}set strokeStyle(t){c(this,e).strokeStyle=t}get lineWidth(){return this.$undoPixelRatio(c(this,e).lineWidth)}set lineWidth(t){c(this,e).lineWidth=this.$doPixelRatio(t)}get textAlign(){return c(this,e).textAlign}set textAlign(t){c(this,e).textAlign=t}get textBaseline(){return c(this,e).textBaseline}set textBaseline(t){c(this,e).textBaseline=t}get globalAlpha(){return c(this,e).globalAlpha}set globalAlpha(t){c(this,e).globalAlpha=t}get shadowColor(){return c(this,e).shadowColor}set shadowColor(t){c(this,e).shadowColor=t}get shadowOffsetX(){return this.$undoPixelRatio(c(this,e).shadowOffsetX)}set shadowOffsetX(t){c(this,e).shadowOffsetX=this.$doPixelRatio(t)}get shadowOffsetY(){return this.$undoPixelRatio(c(this,e).shadowOffsetY)}set shadowOffsetY(t){c(this,e).shadowOffsetY=this.$doPixelRatio(t)}get shadowBlur(){return this.$undoPixelRatio(c(this,e).shadowBlur)}set shadowBlur(t){c(this,e).shadowBlur=this.$doPixelRatio(t)}get lineCap(){return c(this,e).lineCap}set lineCap(t){c(this,e).lineCap=t}get globalCompositeOperation(){return c(this,e).globalCompositeOperation}set globalCompositeOperation(t){c(this,e).globalCompositeOperation=t}fill(...t){return c(this,e).fill(...t)}arc(t,n,i,o,r,a){return c(this,e).arc(this.$doPixelRatio(t),this.$doPixelRatio(n),this.$doPixelRatio(i),o,r,a)}rect(t,n,i,o){return c(this,e).rect(this.$doPixelRatio(t),this.$doPixelRatio(n),this.$doPixelRatio(i),this.$doPixelRatio(o))}fillRect(t,n,i,o){return c(this,e).fillRect(this.$doPixelRatio(t),this.$doPixelRatio(n),this.$doPixelRatio(i),this.$doPixelRatio(o))}clearRect(t,n,i,o){return c(this,e).clearRect(this.$doPixelRatio(t),this.$doPixelRatio(n),this.$doPixelRatio(i),this.$doPixelRatio(o))}beginPath(){return c(this,e).beginPath()}closePath(){return c(this,e).closePath()}lineTo(t,n){return c(this,e).lineTo(this.$doPixelRatio(t),this.$doPixelRatio(n))}moveTo(t,n){return c(this,e).moveTo(this.$doPixelRatio(t),this.$doPixelRatio(n))}arcTo(t,n,i,o,r){return c(this,e).arcTo(this.$doPixelRatio(t),this.$doPixelRatio(n),this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(r))}getLineDash(){return c(this,e).getLineDash()}setLineDash(t){const n=t.map((t=>this.$doPixelRatio(t)));return c(this,e).setLineDash(n)}stroke(t){return t?c(this,e).stroke(t):c(this,e).stroke()}translate(t,n){return c(this,e).translate(this.$doPixelRatio(t),this.$doPixelRatio(n))}rotate(t){return c(this,e).rotate(t)}drawImage(...t){const n=t[0],i=t[1],o=t[2],r=t[3],a=t[4],l=t[t.length-4],s=t[t.length-3],h=t[t.length-2],u=t[t.length-1];return 9===t.length?c(this,e).drawImage(n,this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(r),this.$doPixelRatio(a),this.$doPixelRatio(l),this.$doPixelRatio(s),this.$doPixelRatio(h),this.$doPixelRatio(u)):c(this,e).drawImage(n,this.$doPixelRatio(l),this.$doPixelRatio(s),this.$doPixelRatio(h),this.$doPixelRatio(u))}createPattern(t,n){return c(this,e).createPattern(t,n)}measureText(t){return c(this,e).measureText(t)}fillText(t,n,i,o){return void 0!==o?c(this,e).fillText(t,this.$doPixelRatio(n),this.$doPixelRatio(i),this.$doPixelRatio(o)):c(this,e).fillText(t,this.$doPixelRatio(n),this.$doPixelRatio(i))}strokeText(t,n,i,o){return void 0!==o?c(this,e).strokeText(t,this.$doPixelRatio(n),this.$doPixelRatio(i),this.$doPixelRatio(o)):c(this,e).strokeText(t,this.$doPixelRatio(n),this.$doPixelRatio(i))}save(){c(this,e).save()}restore(){c(this,e).restore()}scale(t,n){c(this,e).scale(t,n)}circle(t,n,i,o,r,a,l,s){c(this,e).ellipse(this.$doPixelRatio(t),this.$doPixelRatio(n),this.$doPixelRatio(i),this.$doPixelRatio(o),r,a,l,s)}isPointInPath(t,n){return c(this,e).isPointInPath(this.$doPixelRatio(t),this.$doPixelRatio(n))}clip(...t){return c(this,e).clip(...t)}setTransform(t,n,i,o,r,a){return c(this,e).setTransform(t,n,i,o,r,a)}getTransform(){return c(this,e).getTransform()}createLinearGradient(t,n,i,o){return c(this,e).createLinearGradient(this.$doPixelRatio(t),this.$doPixelRatio(n),this.$doPixelRatio(i),this.$doPixelRatio(o))}createRadialGradient(t,n,i,o,r,a){return c(this,e).createRadialGradient(this.$doPixelRatio(t),this.$doPixelRatio(n),this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(r),this.$doPixelRatio(a))}createConicGradient(t,n,i){return c(this,e).createConicGradient(t,this.$doPixelRatio(n),this.$doPixelRatio(i))}}function k(t){const{width:e,height:n,ctx:i,devicePixelRatio:o}=t;let r=i;if(!r){const t=document.createElement("canvas");t.width=e*o,t.height=n*o,r=t.getContext("2d")}return new L(r,t)}function z(t){const{width:e,height:n,devicePixelRatio:i}=t,o=new OffscreenCanvas(e*i,n*i),r=o.getContext("2d").canvas.getContext("2d");return new L(r,{devicePixelRatio:i,offscreenCanvas:o})}e=new WeakMap,n=new WeakMap;function O(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)}function T(t,e){return t.x===e.x&&t.y===e.y&&t.t===e.t}function D(t){return t>=0||t<0}function j(t){return D(t.x)&&D(t.y)&&t.t>0}function W(t,e){return{x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}}i=new WeakMap;function V(t){return t/180*Math.PI}function F(t,e,n,i){const o=V(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))}function H(t){return{x:t.x+t.w/2,y:t.y+t.h/2}}function N(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 H({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 B(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}function Q(t,e,n){let i=B(t,e)+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 o=O(t,e);let r=0,a=0;return 0===i?(r=0,a=0-o):i>0&&i<Math.PI/2?(r=Math.sin(i)*o,a=0-Math.cos(i)*o):i===Math.PI/2?(r=o,a=0):i>Math.PI/2&&i<Math.PI?(r=Math.sin(Math.PI-i)*o,a=Math.cos(Math.PI-i)*o):i===Math.PI?(r=0,a=o):i>Math.PI&&i<1.5*Math.PI?(r=0-Math.sin(i-Math.PI)*o,a=Math.cos(i-Math.PI)*o):i===1.5*Math.PI?(r=0-o,a=0):i>1.5*Math.PI&&i<2*Math.PI?(r=0-Math.sin(2*Math.PI-i)*o,a=0-Math.cos(2*Math.PI-i)*o):i===2*Math.PI&&(r=0,a=0-o),r+=t.x,a+=t.y,{x:r,y:a}}function G(t,e,n){const{x:i,y:o,w:r,h:a}=t;let l={x:i,y:o},s={x:i+r,y:o},c={x:i+r,y:o+a},h={x:i,y:o+a};if(n&&(n>0||n<0)){const t=V(X(n));l=Q(e,l,t),s=Q(e,s,t),c=Q(e,c,t),h=Q(e,h,t)}return[l,s,c,h]}function U(t){const{angle:e=0}=t;return G(t,H(t),e)}function Y(t,e,n){return[Q(t,{x:e[0].x,y:e[0].y},n),Q(t,{x:e[1].x,y:e[1].y},n),Q(t,{x:e[2].x,y:e[2].y},n),Q(t,{x:e[3].x,y:e[3].y},n)]}function X(t){if(!(t>0||t<0)||0===t)return 0;let e=t%360;return e<0&&(e+=360),e}function q(t,e){const n={x:0,y:0,w:0,h:0};t.forEach((t=>{const e={x:t.x,y:t.y,w:t.w,h:t.h,angle:t.angle};if(e.angle&&(e.angle>0||e.angle<0)){const t=U(e);if(4===t.length){const n=[t[0].x,t[1].x,t[2].x,t[3].x],i=[t[0].y,t[1].y,t[2].y,t[3].y];e.x=Math.min(...n),e.y=Math.min(...i),e.w=Math.abs(Math.max(...n)-Math.min(...n)),e.h=Math.abs(Math.max(...i)-Math.min(...i))}}const i=Math.min(e.x,n.x),o=Math.min(e.y,n.y),r=Math.max(e.x+e.w,n.x+n.w),a=Math.max(e.y+e.h,n.y+n.h);n.x=i,n.y=o,n.w=Math.abs(r-i),n.h=Math.abs(a-o)})),(null==e?void 0:e.extend)&&(n.x=Math.min(n.x,0),n.y=Math.min(n.y,0));const i={contextWidth:n.w,contextHeight:n.h};return(null==e?void 0:e.viewWidth)&&(null==e?void 0:e.viewHeight)&&(null==e?void 0:e.viewWidth)>0&&(null==e?void 0:e.viewHeight)>0&&(e.viewWidth>n.x+n.w&&(i.contextWidth=e.viewWidth-n.x),e.viewHeight>n.y+n.h&&(i.contextHeight=e.viewHeight-n.y)),i}function Z(t,e){var n;const i=[];let o=t;if(e.length>1)for(let t=0;t<e.length-1;t++){const e=o[t];if("group"!==(null==e?void 0:e.type)||!Array.isArray(null==(n=null==e?void 0:e.detail)?void 0:n.children))return null;i.push(e),o=e.detail.children}return i}function J(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}function K(t,e){const n=[];let i=!1;const o=e=>{var r;for(let a=0;a<e.length&&!0!==i;a++){n.push(a);const l=e[a];if(l.uuid===t){i=!0;break}if("group"===l.type&&o((null==(r=null==l?void 0:l.detail)?void 0:r.children)||[]),i)break;n.pop()}};return o(e),n}function _(t,e){const n=t.x,i=t.y,o=t.x+t.w,r=t.y+t.h,a=e.x,l=e.y,s=e.x+e.w,c=e.y+e.h;return n<=s&&o>=a&&i<=c&&r>=l}function tt(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 et(t){const{x:e,y:n,w:i,h:o,angle:r=0}=t;return 0===r?tt(t):G(t,H({x:e,y:n,w:i,h:o,angle:r}),r)}function nt(t){const e=[];let n=0,i=0;const o=[],r=[...t];for(let t=0;t<r.length;t++){const{x:a,y:l,w:s,h:c,angle:h=0}=r[t];let u;if(n+=a,i+=l,0===t){const t={x:n,y:i,w:s,h:c,angle:h};u=et({x:a,y:l,w:s,h:c,angle:h}),o.push({center:H(t),angle:h,radian:V(h)})}else{u=tt({x:n,y:i,w:s,h:c,angle:h});for(let t=0;t<o.length;t++){const{center:e,radian:n}=o[t];u=Y(e,u,n)}const t=N(u);if(h>0||h<0){u=Y(t,u,V(h))}o.push({center:t,angle:h,radian:V(h)})}e.push(u)}return e}function it(t,e){const{groupQueue:n}=e;if(!(n.length>0))return[et(t)];return nt([...n,t])}function ot(t,e){return it(t,e).pop()||null}function rt(t,e){const{viewScaleInfo:n}=e,{x:i,y:o,w:r,h:a,angle:l}=t,{scale:s,offsetTop:c,offsetLeft:h}=n;return{x:i*s+h,y:o*s+c,w:r*s,h:a*s,angle:l}}function at(t,e){const{viewScaleInfo:n}=e,{x:i,y:o}=t,{scale:r,offsetTop:a,offsetLeft:l}=n;return{x:i*r+l,y:o*r+a}}function lt(t,e){const{context2d:n,element:i,viewScaleInfo:o,viewSizeInfo:r}=e,{angle:a=0}=i,{x:l,y:s,w:c,h:h}=rt(i,{viewScaleInfo:o,viewSizeInfo:r}),u=U({x:l,y:s,w:c,h:h,angle:a});if(u.length>=2){n.beginPath(),n.moveTo(u[0].x,u[0].y);for(let t=1;t<u.length;t++)n.lineTo(u[t].x,u[t].y);n.closePath()}return!!n.isPointInPath(t.x,t.y)}function st(t,e){const{groupQueue:n}=e,i=ot(t,{groupQueue:n}),o=W(i[0],i[1]),r=W(i[1],i[2]),a=W(i[2],i[3]),l=W(i[3],i[0]),s=i[0],c=i[1],h=i[2],u=i[3],f=Math.max(s.x,c.x,h.x,u.x),d=Math.max(s.y,c.y,h.y,u.y);return{center:{x:(f+Math.min(s.x,c.x,h.x,u.x))/2,y:(d+Math.min(s.y,c.y,h.y,u.y))/2},topLeft:s,topRight:c,bottomLeft:u,bottomRight:h,top:o,right:r,left:l,bottom:a}}function ct(t,e){const{x:n,y:i}=t,{size:o,angle:r}=e;return{x:n-o/2,y:i-o/2,w:o,h:o,angle:r}}o=new WeakMap,r=new WeakMap,a=new WeakSet,l=function(){return w(c(this,r))};const ht=/([astvzqmhlc])([^astvzqmhlc]*)/gi,ut=/(-?\d+(?:\.\d+)?)/gi;const ft=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g,dt=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,gt=/^\s*$/,mt={};function pt(t){const e={type:"element",name:"",isVoid:!1,attributes:{},children:[]},n=t.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(e.name=n[1],(mt[n[1]]||"/"===t.charAt(t.length-2))&&(e.isVoid=!0),e.name.startsWith("!--"))){const e=t.indexOf("--\x3e");return{type:"comment",name:null,attributes:{},children:[],isVoid:!1,comment:-1!==e?t.slice(4,e):""}}const i=new RegExp(ft);let o=null;for(;o=i.exec(t),null!==o;)if(o[0].trim())if(o[1]){const t=o[1].trim();let n=[t,""];t.indexOf("=")>-1&&(n=t.split("=")),e.attributes[n[0]]=n[1],i.lastIndex--}else o[2]&&(e.attributes[o[2]]=o[3].trim().substring(1,o[3].length-1));return e}function yt(t,e){switch(e.type){case"text":return t+e.textContent;case"element":return t+="<"+e.name+(e.attributes?function(t){const e=[];for(let n in t)e.push(n+'="'+t[n]+'"');return e.length?" "+e.join(" "):""}(e.attributes):"")+(e.isVoid?"/>":">"),e.isVoid?t:t+e.children.reduce(yt,"")+"</"+e.name+">";case"comment":return t+="\x3c!--"+e.comment+"--\x3e"}}function xt(t,e){let n=2;return void 0!==(null==e?void 0:e.decimalPlaces)&&(null==e?void 0:e.decimalPlaces)>=0&&(n=e.decimalPlaces),parseFloat(t.toFixed(n))}function wt(t){return t[1]!=-1*t[3]||t[4]!=t[0]||t[0]*t[4]-t[3]*t[1]!=1?null:Math.acos(t[0])}const vt="Text Element";function bt(){return{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,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"}}function Mt(){return{background:"#D9D9D9"}}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,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};const Rt=t=>xt(t,{decimalPlaces:4});function It(t,e){const{detail:n}=t,{xRatio:i,yRatio:o,maxRatio:r}=e,a=(i+o)/2,{borderWidth:l,borderRadius:s,borderDash:c,shadowOffsetX:h,shadowOffsetY:u,shadowBlur:f}=n;if("number"==typeof l)n.borderWidth=Rt(l*a);else if(Array.isArray(n.borderWidth)){const t=l;n.borderWidth=[Rt(t[0]*o),Rt(t[1]*i),Rt(t[2]*o),Rt(t[3]*i)]}if("number"==typeof s)n.borderRadius=Rt(s*a);else if(Array.isArray(n.borderRadius)){const t=s;n.borderRadius=[t[0]*i,t[1]*i,t[2]*o,t[3]*o]}Array.isArray(c)&&c.forEach(((t,e)=>{n.borderDash[e]=Rt(t*r)})),"number"==typeof h&&(n.shadowOffsetX=Rt(h*r)),"number"==typeof u&&(n.shadowOffsetX=Rt(u*r)),"number"==typeof f&&(n.shadowOffsetX=Rt(f*r))}function St(t,e){const{type:n}=t;!function(t,e){const{xRatio:n,yRatio:i}=e,{x:o,y:r,w:a,h:l}=t;t.x=Rt(o*n),t.y=Rt(r*i),t.w=Rt(a*n),t.h=Rt(l*i),It(t,e)}(t,e),"circle"===n||("text"===n?function(t,e){const{minRatio:n,maxRatio:i}=e,{fontSize:o,lineHeight:r}=t.detail,a=(n+i)/2;o&&o>0&&(t.detail.fontSize=Rt(o*a)),r&&r>0&&(t.detail.lineHeight=Rt(r*a))}(t,e):"image"===n||"svg"===n||"html"===n||"path"===n||"group"===n&&Array.isArray(t.detail.children)&&t.detail.children.forEach((t=>{St(t,e)})))}function $t(t,e){const n=e.w&&e.w>0?e.w:t.w,i=e.h&&e.h>0?e.h:t.h,o=n/t.w,r=i/t.h;if(o===r&&1===o)return t;const a=Math.min(o,r),l=Math.max(o,r);t.w=n,t.h=i;const s={xRatio:o,yRatio:r,minRatio:a,maxRatio:l};return"group"===t.type&&Array.isArray(t.detail.children)&&t.detail.children.forEach((t=>{St(t,s)})),It(t,s),t}const Et=200,At=200;function Ct(t,e,n){let i=!1;if(1===e.length){const o=e[0];n.splice(o,0,t),i=!0}else if(e.length>1){let o=n;for(let n=0;n<e.length;n++){const r=o[e[n]];if(n===e.length-1){const r=e[n];o.splice(r,0,t),i=!0}else{if(!(n<e.length-1&&"group"===r.type))break;o=r.detail.children}}}return i}function Lt(t,e){let n=!1;if(1===t.length){const i=t[0];e.splice(i,1),n=!0}else if(t.length>1){let i=e;for(let e=0;e<t.length;e++){const o=i[t[e]];if(e===t.length-1){const o=t[e];i.splice(o,1),n=!0}else{if(!(e<t.length-1&&"group"===o.type))break;i=o.detail.children}}}return n}function kt(t,e){const n=[...e.from],i=[...e.to];if(0===n.length||0===i.length)return{elements:t,from:n,to:i};if(n.length<=i.length)for(let e=0;e<n.length;e++)if(i[e]!==n[e]);else if(e===n.length-1)return{elements:t,from:n,to:i};const o=J(n,t);if(o){if(!Ct(o,i,t))return{elements:t,from:n,to:i};let e=-1;for(let t=0;t<n.length&&i[t]>=0;t++)i[t]!==n[t]&&i[t]<n[t]&&t==i.length-1&&(e=t);e>=0&&(n[e]=n[e]+1),Lt(n,t)}return{elements:t,from:n,to:i}}function zt(t,e){var n;const i=Object.keys(e);for(let o=0;o<i.length;o++){const r=i[o];["x","y","w","h","angle","name"].includes(r)?t[r]=e[r]:["detail","operations"].includes(r)&&(b.json(e[r])?((null==t?void 0:t.hasOwnProperty(r))||(t[r]={}),b.json(t[r])&&(t[r]={...t[r],...e[r]})):b.array(e[r])&&((null==t?void 0:t.hasOwnProperty(r))||(t[r]=[]),b.array(t[r])&&(null==(n=null==e?void 0:e[r])||n.forEach(((e,n)=>{t[r][n]=e})),t[r]=[...t[r],...e[r]])))}return t}function Ot(t,e,n){var i;const o=J(t,n);return o&&("group"===o.type&&!0===(null==(i=o.operations)?void 0:i.deepResize)&&(e.w&&e.w>0||e.h&&e.h>0)&&$t(o,{w:e.w,h:e.h}),zt(o,e)),o}function Tt(t,e,n=void 0){const i=e.split(".").reduce(((t,e)=>Object(t)[e]),t);return void 0===i?n:i}function Dt(t,e,n){const i=e.split(".");return"object"!=typeof t||i.reduce(((t,e,i,o)=>i===o.length-1?(t[e]=n,null):(e in t||(t[e]=/^[0-9]{1,}$/.test(o[i+1])?[]:{}),t[e])),t),t}return t.Context2D=L,t.EventEmitter=class{constructor(){h(this,i,void 0),u(this,i,new Map)}on(t,e){if(c(this,i).has(t)){const n=c(this,i).get(t)||[];null==n||n.push(e),c(this,i).set(t,n)}else c(this,i).set(t,[e])}off(t,e){if(c(this,i).has(t)){const n=c(this,i).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}c(this,i).set(t,n||[])}}trigger(t,e){const n=c(this,i).get(t);return!!Array.isArray(n)&&(n.forEach((t=>{t(e)})),!0)}has(t){if(c(this,i).has(t)){const e=c(this,i).get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1}destroy(){this.clear()}clear(){c(this,i).clear()}},t.Store=class{constructor(t){h(this,a),h(this,o,void 0),h(this,r,void 0),u(this,r,w(t.defaultStorage)),u(this,o,f(this,a,l).call(this))}set(t,e){c(this,o)[t]=e}get(t){return c(this,o)[t]}getSnapshot(){return c(this,o)}clear(){u(this,o,f(this,a,l).call(this))}destroy(){u(this,o,null)}},t.calcDistance=O,t.calcElementCenter=H,t.calcElementCenterFromVertexes=N,t.calcElementListSize=function(t){var e;const n={x:0,y:0,w:0,h:0};let i=null;for(let o=0;o<t.length;o++){const r=t[o];if(null==(e=null==r?void 0:r.operations)?void 0:e.invisible)continue;const a={x:r.x,y:r.y,w:r.w,h:r.h,angle:r.angle||0};if(a.angle&&(a.angle>0||a.angle<0)){const t=U(a);if(4===t.length){const e=[t[0].x,t[1].x,t[2].x,t[3].x],n=[t[0].y,t[1].y,t[2].y,t[3].y];a.x=Math.min(...e),a.y=Math.min(...n),a.w=Math.abs(Math.max(...e)-Math.min(...e)),a.h=Math.abs(Math.max(...n)-Math.min(...n))}}if(i){const t=Math.min(a.x,n.x),e=Math.min(a.y,n.y),i=Math.max(a.x+a.w,n.x+n.w),o=Math.max(a.y+a.h,n.y+n.h);n.x=t,n.y=e,n.w=Math.abs(i-t),n.h=Math.abs(o-e)}else n.x=a.x,n.y=a.y,n.w=a.w,n.h=a.h;i=a}return{x:Math.floor(n.x),y:Math.floor(n.y),w:Math.ceil(n.w),h:Math.ceil(n.h)}},t.calcElementOriginRectInfo=st,t.calcElementQueueVertexesQueueInGroup=nt,t.calcElementSizeController=function(t,e){const{groupQueue:n,controllerSize:i,viewScaleInfo:o}=e,r=(i&&i>0?i:8)/o.scale,{x:a,y:l,w:s,h:c,angle:h=0}=t,u=[{uuid:m(),x:a,y:l,w:s,h:c,angle:h,type:"group",detail:{children:[]}},...n];let f=0;u.forEach((({angle:t=0})=>{f+=t}));const d=ot(t,{groupQueue:n}),g=ot({x:a-2*r,y:l-2*r,h:c+4*r,w:s+4*r,angle:h},{groupQueue:[...n]}),p=W(d[0],d[1]),y=W(d[1],d[2]),x=W(d[2],d[3]),w=W(d[3],d[0]),v=d[0],b=d[1],M=d[2],P=d[3],R=ct(p,{size:r,angle:f}),I=ct(y,{size:r,angle:f}),S=ct(x,{size:r,angle:f}),$=ct(w,{size:r,angle:f}),E=ct(v,{size:r,angle:f}),A=ct(b,{size:r,angle:f}),C=ct(P,{size:r,angle:f}),L=ct(M,{size:r,angle:f}),k=et(E),z=et(A),O=et(C),T=et(L),D=[k[1],z[0],z[3],k[2]],j=[z[3],z[2],T[1],T[0]],V=[O[1],T[0],T[3],O[2]],F=[k[3],k[2],O[1],O[0]],H=et(R),N=et(I),B=et(S),Q=et($),G=W(g[0],g[1]);return{elementWrapper:d,left:{type:"left",vertexes:F,center:w},right:{type:"right",vertexes:j,center:y},top:{type:"top",vertexes:D,center:p},bottom:{type:"bottom",vertexes:V,center:x},topLeft:{type:"top-left",vertexes:k,center:v},topRight:{type:"top-right",vertexes:z,center:b},bottomLeft:{type:"bottom-left",vertexes:O,center:P},bottomRight:{type:"bottom-right",vertexes:T,center:M},leftMiddle:{type:"left-middle",vertexes:Q,center:w},rightMiddle:{type:"right-middle",vertexes:N,center:y},topMiddle:{type:"top-middle",vertexes:H,center:p},bottomMiddle:{type:"bottom-middle",vertexes:B,center:x},rotate:{type:"rotate",vertexes:et(ct(G,{size:r,angle:f})),center:G}}},t.calcElementVertexesInGroup=ot,t.calcElementVertexesQueueInGroup=it,t.calcElementViewRectInfo=function(t,e){const{groupQueue:n,viewScaleInfo:i,range:o}=e,r=st(t,{groupQueue:n}),{center:a,top:l,bottom:s,left:c,right:h,topLeft:u,topRight:f,bottomLeft:d,bottomRight:g}=r,m={center:at(a,{viewScaleInfo:i}),topLeft:at(u,{viewScaleInfo:i}),topRight:at(f,{viewScaleInfo:i}),bottomLeft:at(d,{viewScaleInfo:i}),bottomRight:at(g,{viewScaleInfo:i}),top:at(l,{viewScaleInfo:i}),right:at(h,{viewScaleInfo:i}),left:at(c,{viewScaleInfo:i}),bottom:at(s,{viewScaleInfo:i})};if(!0===o){const t=Math.max(m.topLeft.x,m.topRight.x,m.bottomRight.x,m.bottomLeft.x),e=Math.max(m.topLeft.y,m.topRight.y,m.bottomRight.y,m.bottomLeft.y),n=Math.min(m.topLeft.x,m.topRight.x,m.bottomRight.x,m.bottomLeft.x),i=Math.min(m.topLeft.y,m.topRight.y,m.bottomRight.y,m.bottomLeft.y),o={x:m.center.x,y:m.center.y},r={x:n,y:i},a={x:t,y:i},l={x:t,y:e},s={x:n,y:e},c=W(r,a),h=W(s,l),u=W(r,s);return{center:o,topLeft:r,topRight:a,bottomLeft:s,bottomRight:l,top:c,right:W(a,l),left:u,bottom:h}}return m},t.calcElementViewRectInfoMap=function(t,e){const{groupQueue:n,viewScaleInfo:i}=e,o=st(t,{groupQueue:n}),{center:r,top:a,bottom:l,left:s,right:c,topLeft:h,topRight:u,bottomLeft:f,bottomRight:d}=o,g={center:at(r,{viewScaleInfo:i}),topLeft:at(h,{viewScaleInfo:i}),topRight:at(u,{viewScaleInfo:i}),bottomLeft:at(f,{viewScaleInfo:i}),bottomRight:at(d,{viewScaleInfo:i}),top:at(a,{viewScaleInfo:i}),right:at(c,{viewScaleInfo:i}),left:at(s,{viewScaleInfo:i}),bottom:at(l,{viewScaleInfo:i})},m=Math.max(g.topLeft.x,g.topRight.x,g.bottomRight.x,g.bottomLeft.x),p=Math.max(g.topLeft.y,g.topRight.y,g.bottomRight.y,g.bottomLeft.y),y=Math.min(g.topLeft.x,g.topRight.x,g.bottomRight.x,g.bottomLeft.x),x=Math.min(g.topLeft.y,g.topRight.y,g.bottomRight.y,g.bottomLeft.y),w={x:g.center.x,y:g.center.y},v={x:y,y:x},b={x:m,y:x},M={x:m,y:p},P={x:y,y:p},R=W(v,b),I=W(P,M),S=W(v,P);return{originRectInfo:o,viewRectInfo:g,rangeRectInfo:{center:w,topLeft:v,topRight:b,bottomLeft:P,bottomRight:M,top:R,right:W(b,M),left:S,bottom:I}}},t.calcElementsContextSize=q,t.calcElementsViewInfo=function(t,e,n){const i=q(t,{viewWidth:e.width,viewHeight:e.height,extend:null==n?void 0:n.extend});return!0===(null==n?void 0:n.extend)&&(i.contextWidth=Math.max(i.contextWidth,e.contextWidth),i.contextHeight=Math.max(i.contextHeight,e.contextHeight)),{contextSize:i}},t.calcRadian=function(t,e,n){const i=B(t,e),o=B(t,n);return null!==o&&null!==i?i>3*Math.PI/2&&o<Math.PI/2?o+(2*Math.PI-i):o>3*Math.PI/2&&i<Math.PI/2?i+(2*Math.PI-o):o-i:0},t.calcSpeed=function(t,e){return O(t,e)/Math.abs(e.t-t.t)},t.calcViewBoxSize=function(t,e){const{viewScaleInfo:n}=e,{scale:i}=n;let{borderRadius:o}=t.detail;const{boxSizing:r=Pt.boxSizing,borderWidth:a}=t.detail;Array.isArray(a)&&(o=0);let{x:l,y:s,w:c,h:h}=t,u=[0,0,0,0];if("number"==typeof o){const t=o*i;u=[t,t,t,t]}else Array.isArray(o)&&4===(null==o?void 0:o.length)&&(u=[o[0]*i,o[1]*i,o[2]*i,o[3]*i]);let f=0;return"number"==typeof a&&(f=(a||0)*i),"border-box"===r?(l=t.x+f/2,s=t.y+f/2,c=t.w-f,h=t.h-f):"content-box"===r?(l=t.x-f/2,s=t.y-f/2,c=t.w+f,h=t.h+f):(l=t.x,s=t.y,c=t.w,h=t.h),c=Math.max(c,1),h=Math.max(h,1),u=u.map((t=>Math.min(t,c/2,h/2))),{x:l,y:s,w:c,h:h,radiusList:u}},t.calcViewCenter=function(t){let e=0,n=0;if(t){const{viewScaleInfo:i,viewSizeInfo:o}=t,{offsetLeft:r,offsetTop:a,scale:l}=i,{width:s,height:c}=o;e=0-r+s/l/2,n=0-a+c/l/2}return{x:e,y:n}},t.calcViewCenterContent=function(t,e){var n,i,o,r,a,l,s,c;let h=0,u=0,f=1,d=(null==(i=null==(n=null==t?void 0:t.elements)?void 0:n[0])?void 0:i.x)||0,g=(null==(r=null==(o=null==t?void 0:t.elements)?void 0:o[0])?void 0:r.y)||0,m=(null==(l=null==(a=null==t?void 0:t.elements)?void 0:a[0])?void 0:l.w)||0,p=(null==(c=null==(s=null==t?void 0:t.elements)?void 0:s[0])?void 0:c.h)||0;const{width:y,height:x}=e.viewSizeInfo;if(t.elements.forEach((t=>{const e={x:t.x,y:t.y,w:t.w,h:t.h,angle:t.angle};if(e.angle&&(e.angle>0||e.angle<0)){const t=U(e);if(4===t.length){const n=[t[0].x,t[1].x,t[2].x,t[3].x],i=[t[0].y,t[1].y,t[2].y,t[3].y];e.x=Math.min(...n),e.y=Math.min(...i),e.w=Math.abs(Math.max(...n)-Math.min(...n)),e.h=Math.abs(Math.max(...i)-Math.min(...i))}}const n=Math.min(e.x,d),i=Math.min(e.y,g),o=Math.max(e.x+e.w,d+m),r=Math.max(e.y+e.h,g+p);d=n,g=i,m=Math.abs(o-n),p=Math.abs(r-i)})),m>0&&p>0){const t=xt(y/m,{decimalPlaces:4}),e=xt(x/p,{decimalPlaces:4});f=Math.min(t,e,1),h=(m*f-y)/2/f+d,u=(p*f-x)/2/f+g}return{offsetX:xt(h,{decimalPlaces:0}),offsetY:xt(u,{decimalPlaces:0}),scale:f}},t.calcViewElementSize=rt,t.calcViewPointSize=at,t.calcViewScaleInfo=function(t,e){const{scale:n,offsetX:i,offsetY:o}=t,{viewSizeInfo:r}=e,{width:a,height:l,contextWidth:s,contextHeight:c}=r,h=0-i*n,u=0-o*n;return{scale:n,offsetLeft:h,offsetTop:u,offsetRight:a-(s*n+h/n),offsetBottom:l-(c*n+u/n)}},t.calcViewVertexes=function(t,e){return[at(t[0],e),at(t[1],e),at(t[2],e),at(t[3],e)]},t.check=C,t.checkRectIntersect=_,t.colorNameToHex=function(t){const e=t.toLowerCase(),n=g[e];return"string"==typeof n?n:null},t.colorToCSS=function(t){let e="transparent";if("string"==typeof t)e=t;else if("linear-gradient"===(null==t?void 0:t.type)){const n=[];"number"==typeof t.angle?n.push(`${t.angle}deg`):n.push("180deg"),Array.isArray(t.stops)&&t.stops.forEach((t=>{n.push(`${t.color} ${100*t.offset}%`)})),e=`linear-gradient(${n.join(", ")})`}else if("radial-gradient"===(null==t?void 0:t.type)){const n=[];Array.isArray(t.stops)&&t.stops.forEach((t=>{n.push(`${t.color} ${100*t.offset}%`)})),e=`radial-gradient(circle, ${n.join(", ")})`}return e},t.colorToLinearGradientCSS=function(t){let e="transparent";if("string"==typeof t)e=t;else if("radial-gradient"===(null==t?void 0:t.type)||"linear-gradient"===(null==t?void 0:t.type)){const n=[];Array.isArray(t.stops)&&t.stops.length>0&&(t.stops.forEach(((e,i)=>{n.push(`${e.color} ${100*e.offset}%`),i===t.stops.length-1&&e.offset<1&&n.push(`${e.color} ${100*e.offset}%`)})),e=`linear-gradient(90deg, ${n.join(", ")})`)}return e},t.compose=function(t){return function(e,n){return function i(o){let r=t[o];o===t.length&&n&&(r=n);if(!r)return Promise.resolve();try{return Promise.resolve(r(e,i.bind(null,o+1)))}catch(t){return Promise.reject(t)}}(0)}},t.compressImage=function(t,e){let n=.5;const i=(null==e?void 0:e.type)||"image/png";return(null==e?void 0:e.radio)&&(null==e?void 0:e.radio)>0&&(null==e?void 0:e.radio)<=1&&(n=null==e?void 0:e.radio),new Promise(((e,o)=>{const r=new Image;r.addEventListener("load",(()=>{const{width:t,height:o}=r,a=t*n,l=o*n;let s=document.createElement("canvas");s.width=a,s.height=l;s.getContext("2d").drawImage(r,0,0,a,l);const c=s.toDataURL(i);s=null,e(c)})),r.addEventListener("error",(t=>{o(t)})),r.src=t}))},t.createAssetId=y,t.createBoardContent=function(t,e){const{width:n,height:i,devicePixelRatio:o,offscreen:r,createCustomContext2D:a}=e,l={width:n,height:i,devicePixelRatio:o},s=t.getContext("2d");if(a){const t=a(l),e=a(l),n=a(l),i=k({ctx:s,...l}),o=()=>{const{width:o,height:r}=t.$getSize();i.clearRect(0,0,o,r),i.drawImage(n.canvas,0,0,o,r),i.drawImage(t.canvas,0,0,o,r),i.drawImage(e.canvas,0,0,o,r),n.clearRect(0,0,o,r),t.clearRect(0,0,o,r),e.clearRect(0,0,o,r)};return{underContext:n,viewContext:t,helperContext:e,boardContext:i,drawView:o}}if(!0===r){const t=z(l),e=z(l),n=z(l),i=k({ctx:s,...l}),o=()=>{const{width:o,height:r}=t.$getSize();i.clearRect(0,0,o,r),i.drawImage(n.canvas,0,0,o,r),i.drawImage(t.canvas,0,0,o,r),i.drawImage(e.canvas,0,0,o,r),n.clearRect(0,0,o,r),t.clearRect(0,0,o,r),e.clearRect(0,0,o,r)};return{underContext:n,viewContext:t,helperContext:e,boardContext:i,drawView:o}}{const t=k(l),e=k(l),o=k(l),r=k({ctx:s,...l}),a=()=>{r.clearRect(0,0,n,i),r.drawImage(o.canvas,0,0,n,i),r.drawImage(t.canvas,0,0,n,i),r.drawImage(e.canvas,0,0,n,i),o.clearRect(0,0,n,i),t.clearRect(0,0,n,i),e.clearRect(0,0,n,i)};return{underContext:o,viewContext:t,helperContext:e,boardContext:r,drawView:a}}},t.createContext2D=k,t.createElement=function(t,e,n){const i=function(t,e){let n=0,i=0,o=Et,r=At;if(e){const{viewScaleInfo:a,viewSizeInfo:l}=e,{scale:s,offsetLeft:c,offsetTop:h}=a,{width:u,height:f}=l,d=u/4,g=f/4;o=Et>=d?d/s:Et/s,r=At>=g?g/s:At/s,["circle","svg","image"].includes(t)?o=r=Math.max(o,r):"text"===t&&(r=o/vt.length*2),n=(0-c+u/2-o*s/2)/s,i=(0-h+f/2-r*s/2)/s}return{x:n,y:i,w:o,h:r}}(t,n);let o={};return"rect"===t?o={background:"#D9D9D9"}:"circle"===t?o={background:"#D9D9D9",radius:0}:"text"===t?o=function(t){const e={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,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};return{text:vt,color:e.color,fontFamily:e.fontFamily,fontWeight:e.fontWeight,lineHeight:t.w/vt.length,fontSize:t.w/vt.length,textAlign:"center",verticalAlign:"middle"}}(i):"svg"===t?o={svg:'<svg t="1701004189871" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><path d="M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3-12.3 12.7-12.1 32.9 0.6 45.3l183.7 179.1-43.4 252.9c-1.2 6.9-0.1 14.1 3.2 20.3 8.2 15.6 27.6 21.7 43.2 13.4L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3zM664.8 561.6l36.1 210.3L512 672.7 323.1 772l36.1-210.3-152.8-149L417.6 382 512 190.7 606.4 382l211.2 30.7-152.8 148.9z" fill="#2c2c2c"></path></svg>'}:"image"===t?o={src:"data:image/svg+xml;base64,PHN2ZyAgIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiAgd2lkdGg9IjIwMCIgaGVpZ2h0PSIyMDAiPjxwYXRoIGQ9Ik05MjggMTYwSDk2Yy0xNy43IDAtMzIgMTQuMy0zMiAzMnY2NDBjMCAxNy43IDE0LjMgMzIgMzIgMzJoODMyYzE3LjcgMCAzMi0xNC4zIDMyLTMyVjE5MmMwLTE3LjctMTQuMy0zMi0zMi0zMnogbS00MCA2MzJIMTM2di0zOS45bDEzOC41LTE2NC4zIDE1MC4xIDE3OEw2NTguMSA0ODkgODg4IDc2MS42Vjc5MnogbTAtMTI5LjhMNjY0LjIgMzk2LjhjLTMuMi0zLjgtOS0zLjgtMTIuMiAwTDQyNC42IDY2Ni40bC0xNDQtMTcwLjdjLTMuMi0zLjgtOS0zLjgtMTIuMiAwTDEzNiA2NTIuN1YyMzJoNzUydjQzMC4yeiIgIGZpbGw9IiM1MTUxNTEiPjwvcGF0aD48cGF0aCBkPSJNMzA0IDQ1NmM0OC42IDAgODgtMzkuNCA4OC04OHMtMzkuNC04OC04OC04OC04OCAzOS40LTg4IDg4IDM5LjQgODggODggODh6IG0wLTExNmMxNS41IDAgMjggMTIuNSAyOCAyOHMtMTIuNSAyOC0yOCAyOC0yOC0xMi41LTI4LTI4IDEyLjUtMjggMjgtMjh6IiAgZmlsbD0iIzUxNTE1MSI+PC9wYXRoPjwvc3ZnPg=="}:"group"===t&&(o={children:[],background:"#D9D9D9",overflow:"hidden"}),{...i,...e,uuid:m(),type:t,detail:{...o,...e.detail||{}}}},t.createOffscreenContext2D=z,t.createUUID=m,t.debounce=function(t,e){let n=-1;return function(...i){n>=0&&window.clearTimeout(n),n=setTimeout((()=>{t(...i),n=-1}),e)}},t.deepClone=w,t.deepCloneElement=function(t){const e=w(t),n=t=>{t.uuid=m(),"group"===t.type&&t.detail.children&&t.detail.children.forEach((t=>{n(t)}))};return n(e),e},t.deepResizeGroupElement=$t,t.delay=function(t){return new Promise((e=>{setTimeout((()=>{e()}),t)}))},t.deleteElementInList=function(t,e){return Lt(K(t,e),e)},t.deleteElementInListByPosition=Lt,t.downloadFileFromText=function(t,e){const{fileName:n}=e,i=function(t){const e=(new TextEncoder).encode(t),n=new Blob([e],{type:"text/plain;charset=utf-8"});return window.URL.createObjectURL(n)}(t);let o=document.createElement("a");o.href=i,o.download=n,o.click(),o=null},t.downloadImageFromCanvas=function(t,e){const{fileName:n,type:i="image/jpeg"}=e,o=t.toDataURL(i);let r=document.createElement("a");r.href=o,r.download=n,r.click(),r=null},t.equalPoint=T,t.equalTouchPoint=function(t,e){return!0===T(t,e)&&t.f===e.f},t.filterCompactData=function(t,e){const n=t.assets||{},i=w(t),o=(null==e?void 0:e.loadItemMap)||{},r=t=>{t.forEach((t=>{var e,i,a;if("image"===t.type&&t.detail.src){const i=t.detail.src;if(x(i)&&!n[i]&&o[i]&&"string"==typeof(null==(e=o[i])?void 0:e.source))n[i]={type:"image",value:o[i].source};else if(!n[i]){const e=y(i);n[e]||(n[e]={type:"image",value:i}),t.detail.src=e}}else if("svg"===t.type){const e=t.detail.svg;if(x(e)&&!n[e]&&o[e]&&"string"==typeof(null==(i=o[e])?void 0:i.source))n[e]={type:"svg",value:o[e].source};else if(!n[e]){const i=y(e);n[i]||(n[i]={type:"svg",value:e}),t.detail.svg=i}}else if("html"===t.type){const e=t.detail.html;if(x(e)&&!n[e]&&o[e]&&"string"==typeof(null==(a=o[e])?void 0:a.source))n[e]={type:"html",value:o[e].source};else if(!n[e]){const i=y(e);n[i]||(n[i]={type:"html",value:e}),t.detail.html=i}}else if("group"===t.type&&Array.isArray(t.detail.children)){const e=t.detail.assets||{};Object.keys(e).forEach((t=>{n[t]||(n[t]=e[t])})),delete t.detail.assets,r(t.detail.children)}}))};return r(i.elements),i.assets=n,i},t.filterElementAsset=function(t){let e=null,n=null,i=null;return"image"===t.type?i=t.detail.src:"svg"===t.type?i=t.detail.svg:"html"===t.type&&(i=t.detail.html),"string"!=typeof i||x(i)||(e=y(i),n={type:t.type,value:i},"image"===t.type?t.detail.src=e:"svg"===t.type?t.detail.svg=e:"html"===t.type&&(t.detail.html=e)),{element:t,assetId:e,assetItem:n}},t.findElementFromList=function t(e,n){var i;let o=null;for(let r=0;r<n.length;r++){const a=n[r];if(a.uuid===e){o=a;break}if(!o&&"group"===a.type){const n=t(e,(null==(i=null==a?void 0:a.detail)?void 0:i.children)||[]);if((null==n?void 0:n.uuid)===e){o=n;break}}}return o},t.findElementFromListByPosition=J,t.findElementQueueFromListByPosition=function(t,e){const n=[];let i=e;for(let e=0;e<t.length;e++){const o=i[t[e]];if(!o)break;if(n.push(o),!(e<t.length-1&&"group"===o.type))break;i=o.detail.children}return n},t.findElementsFromList=function(t,e){const n=[];return function e(i){var o;for(let r=0;r<i.length;r++){const a=i[r];t.includes(a.uuid)?n.push(a):"group"===a.type&&e((null==(o=null==a?void 0:a.detail)?void 0:o.children)||[])}}(e),n},t.findElementsFromListByPositions=function(t,e){const n=[];return t.forEach((t=>{const i=J(t,e);i&&n.push(i)})),n},t.formatNumber=xt,t.generateHTML=function(t){return t.reduce((function(t,e){return t+yt("",e)}),"")},t.generateSVGPath=function(t){let e="";return t.forEach((t=>{e+=t.type+t.params.join(" ")})),e},t.getCenterFromTwoPoints=W,t.getDefaultElementDetailConfig=bt,t.getDefaultElementRectDetail=Mt,t.getElemenetsAssetIds=function(t){const e=[],n=t=>{t.forEach((t=>{"image"===t.type&&x(t.detail.src)?e.push(t.detail.src):"svg"===t.type&&x(t.detail.svg)?e.push(t.detail.svg):"html"===t.type&&t.detail.html?e.push(t.detail.html):"group"===t.type&&Array.isArray(t.detail.children)&&n(t.detail.children)}))};return n(t),e},t.getElementPositionFromList=K,t.getElementRotateVertexes=G,t.getElementSize=function(t){const{x:e,y:n,w:i,h:o,angle:r}=t;return{x:e,y:n,w:i,h:o,angle:r}},t.getElementVertexes=tt,t.getGroupQueueByElementPosition=Z,t.getGroupQueueFromList=function(t,e){const n=[];return function t(e,i){var o;let r=null;for(let a=0;a<i.length;a++){const l=i[a];if(l.uuid===e){r=l;break}if(!r&&"group"===l.type){n.push(l);const i=t(e,(null==(o=null==l?void 0:l.detail)?void 0:o.children)||[]);if((null==i?void 0:i.uuid)===e){r=i;break}n.pop()}}return r}(t,e),n},t.getModifiedElement=function(t,e){const n={},i=[],o=t=>{if(b.json(t)){Object.keys(t).forEach((r=>{if(i.push(r),b.json(t[r])||b.array(t[r]))o(t[r]);else{const t=i.join(".");if("uuid"!==t){const o=Tt(e,t);Dt(n,i.join("."),o)}}i.pop()}))}else b.array(t)&&t.forEach((r=>{if(i.push(r),b.json(t[r])||b.array(t[r]))o(t[r]);else{const t=Tt(e,i.join("."));Dt(n,i.join("."),t)}i.pop()}))};return o(t),n},t.getSelectedElementUUIDs=function(t,e){var n;let i=[];return Array.isArray(null==t?void 0:t.elements)&&(null==(n=null==t?void 0:t.elements)?void 0:n.length)>0&&Array.isArray(e)&&e.length>0&&e.forEach((e=>{var n;"number"==typeof e?(null==(n=null==t?void 0:t.elements)?void 0:n[e])&&i.push(t.elements[e].uuid):"string"==typeof e&&(i=i.concat(function(t,e){var n;const i=[];if("string"==typeof e&&/^\d+(\.\d+)*$/.test(e)){const o=e.split(".");let r=t;for(;o.length>0;){const t=o.shift();if("string"==typeof t){const e=r[parseInt(t)];e&&0===o.length?i.push(e.uuid):"group"===e.type&&o.length>0&&(r=(null==(n=null==e?void 0:e.detail)?void 0:n.children)||[])}break}}return i}(t.elements,e)))})),i},t.getViewPointAtElement=function(t,e){var n,i,o;const{context2d:r,data:a,viewScaleInfo:l,viewSizeInfo:s,groupQueue:c}=e,h={index:-1,element:null,groupQueueIndex:-1};if(c&&Array.isArray(c)&&(null==c?void 0:c.length)>0)for(let e=c.length-1;e>=0;e--){let o=0,a=0,u=0;for(let t=0;t<=e;t++)o+=c[t].x,a+=c[t].y,u+=c[t].angle||0;const f=c[e];if(f&&"group"===f.type&&Array.isArray(null==(n=f.detail)?void 0:n.children))for(let n=0;n<f.detail.children.length;n++){const d=f.detail.children[n];if(!0!==(null==(i=null==d?void 0:d.operations)?void 0:i.invisible)){if(!d)break;if(lt(t,{context2d:r,element:{x:o+d.x,y:a+d.y,w:d.w,h:d.h,angle:u+(d.angle||0)},viewScaleInfo:l,viewSizeInfo:s})){h.element=d,(e<c.length-1||"group"!==d.type)&&(h.groupQueueIndex=e);break}}}if(h.element)break}if(h.element)return h;for(let e=a.elements.length-1;e>=0;e--){const n=a.elements[e];if(!0!==(null==(o=null==n?void 0:n.operations)?void 0:o.invisible)&&lt(t,{context2d:r,element:n,viewScaleInfo:l,viewSizeInfo:s})){h.index=e,h.element=n;break}}return h},t.getViewScaleInfoFromSnapshot=function(t){const{activeStore:e}=t;return{scale:null==e?void 0:e.scale,offsetTop:null==e?void 0:e.offsetTop,offsetBottom:null==e?void 0:e.offsetBottom,offsetLeft:null==e?void 0:e.offsetLeft,offsetRight:null==e?void 0:e.offsetRight}},t.getViewSizeInfoFromSnapshot=function(t){const{activeStore:e}=t;return{devicePixelRatio:e.devicePixelRatio,width:null==e?void 0:e.width,height:null==e?void 0:e.height,contextWidth:null==e?void 0:e.contextWidth,contextHeight:null==e?void 0:e.contextHeight}},t.insertElementToListByPosition=Ct,t.is=E,t.isAssetId=x,t.isColorStr=d,t.isElementInView=function(t,e){const{viewSizeInfo:n,viewScaleInfo:i}=e,{width:o,height:r}=n,{angle:a}=t,{x:l,y:s,w:c,h:h}=rt(t,{viewScaleInfo:i,viewSizeInfo:n}),u=U({x:l,y:s,w:c,h:h,angle:a}),f={x:0,y:0,w:o,h:r},d=Math.min(u[0].x,u[1].x,u[2].x,u[3].x),g=Math.min(u[0].y,u[1].y,u[2].y,u[3].y);return _(f,{x:d,y:g,w:Math.max(u[0].x,u[1].x,u[2].x,u[3].x)-d,h:Math.max(u[0].y,u[1].y,u[2].y,u[3].y)-g})},t.isResourceElement=function(t){return["image","svg","html"].includes(null==t?void 0:t.type)},t.isViewPointInElement=lt,t.istype=b,t.limitAngle=X,t.loadHTML=async function(t,e){t=t.replace(/\&/gi,"&amp;");const n=await function(t,e){const{width:n,height:i}=e;return new Promise(((e,o)=>{const r=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"}),a=new FileReader;a.readAsDataURL(r),a.onload=function(t){var n;const i=null==(n=null==t?void 0:t.target)?void 0:n.result;e(i)},a.onerror=function(t){o(t)}}))}(t,e);return await P(n)},t.loadImage=P,t.loadSVG=async function(t){const e=await 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.result;e(i)},o.onerror=function(t){n(t)}}))}(t);return await P(e)},t.matrixToAngle=function(t){const e=wt(t);if("number"==typeof e){return 180*e/Math.PI}return e},t.matrixToRadian=wt,t.mergeElementAsset=function(t,e){const n=t;let i=null,o=null;return"image"===n.type?i=n.detail.src:"svg"===n.type?i=n.detail.svg:"html"===n.type&&(i=n.detail.html),i&&(null==i?void 0:i.startsWith("@assets/"))&&(o=e[i]),(null==o?void 0:o.type)===n.type&&"string"==typeof(null==o?void 0:o.value)&&(null==o?void 0:o.value)&&("image"===n.type?n.detail.src=o.value:"svg"===n.type?n.detail.svg=o.value:"html"===n.type&&(n.detail.html=o.value)),n},t.mergeHexColorAlpha=function(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},t.modifyElement=function(t,e){const{type:n}=e,i={...e.content};if("addElement"===n){const n=e,{element:i,position:o}=n.content;(null==o?void 0:o.length)>0?Ct(i,[...o],t.elements):t.elements.push(i)}else if("deleteElement"===n){const n=e,{position:i}=n.content;Lt(i,t.elements)}else if("moveElement"===n){const n=e,{from:o,to:r}=n.content,a=kt(t.elements,{from:o,to:r});i.from=a.from,i.to=a.to,t.elements=a.elements}else if("updateElement"===n){const n=e,{position:i,afterModifiedElement:o}=n.content;Ot(i,o,t.elements)}return{data:t,content:i}},t.moveElementPosition=kt,t.parseAngleToRadian=V,t.parseFileToBase64=function(t){return new Promise((function(e,n){let i=new FileReader;i.addEventListener("load",(function(){e(i.result),i=null})),i.addEventListener("error",(function(t){n(t),i=null})),i.addEventListener("abort",(function(){n(new Error("abort")),i=null})),i.readAsDataURL(t)}))},t.parseFileToText=function(t){return new Promise((function(e,n){let i=new FileReader;i.addEventListener("load",(function(){e(i.result),i=null})),i.addEventListener("error",(function(t){n(t),i=null})),i.addEventListener("abort",(function(){n(new Error("abort")),i=null})),i.readAsText(t)}))},t.parseHTML=function(t){const e=[],n=[];let i,o=-1;return t.replace(dt,((r,a)=>{const l="/"!==r.charAt(1),s=r.startsWith("\x3c!--"),c=a+r.length,h=t.charAt(c);let u;if(s){const t=pt(r);return o<0?(e.push(t),r):(u=n[o],u.children.push(t),r)}if(l){if(o++,i=pt(r),!i.isVoid&&h&&"<"!==h){const e=t.slice(c,t.indexOf("<",c));e.trim()&&i.children.push({type:"text",name:null,attributes:{},children:[],isVoid:!1,textContent:e.trim()})}0===o&&e.push(i),u=n[o-1],u&&u.children.push(i),n[o]=i}if((!l||!Array.isArray(i)&&i.isVoid)&&(o>-1&&!Array.isArray(i)&&(i.isVoid||i.name===r.slice(2,-1))&&(o--,i=-1===o?e:n[o]),"<"!==h&&h)){u=-1===o?e:n[o].children;const i=t.indexOf("<",c);let r=t.slice(c,-1===i?void 0:i);gt.test(r)&&(r=" "),(i>-1&&o+u.length>=0||" "!==r)&&r.trim()&&u.push({type:"text",name:null,attributes:{},children:[],isVoid:!1,textContent:r.trim()})}return r})),e},t.parseRadianToAngle=function(t){return t/Math.PI*180},t.parseSVGPath=function(t){const e=[];return t.replace(ht,((t,n,i)=>{const o=i.match(ut),r={type:n,params:o?o.map(Number):[]};return e.push(r),t})),e},t.pickFile=function(t){const{accept:e,success:n,error:i}=t;let o=document.createElement("input");o.type="file",e&&(o.accept=e),o.addEventListener("change",(function(){var t;const e=null==(t=o.files)?void 0:t[0];n({file:e}),o=null})),o.addEventListener("error",(function(t){"function"==typeof i&&i(t),o=null})),o.click()},t.rotateByCenter=F,t.rotateElement=function(t,e,n){const i=H(e);F(t,e.angle||0,i,(()=>{n(t)}))},t.rotateElementVertexes=U,t.rotatePoint=Q,t.rotatePointInGroup=function(t,e){if((null==e?void 0:e.length)>0){let n=t.x,i=t.y;return e.forEach((t=>{const{x:e,y:o,w:r,h:a,angle:l=0}=t,s=Q(H({x:e,y:o,w:r,h:a,angle:l}),{x:n,y:i},V(l));n=s.x,i=s.y})),{x:n,y:i}}return t},t.rotateVertexes=Y,t.sortDataAsserts=function(t,e){const n=t.assets||{};let i=t;!0===(null==e?void 0:e.clone)&&(i=w(t));const o=t=>{t.forEach((t=>{if("image"===t.type&&t.detail.src){const e=t.detail.src,i=y(e);n[i]||(n[i]={type:"image",value:e}),t.detail.src=i}else if("svg"===t.type){const e=t.detail.svg,i=y(e);n[i]||(n[i]={type:"svg",value:e}),t.detail.svg=i}else if("html"===t.type){const e=t.detail.html,i=y(e);n[i]||(n[i]={type:"html",value:e}),t.detail.html=i}else if("group"===t.type&&Array.isArray(t.detail.children)){const e=t.detail.assets||{};Object.keys(e).forEach((t=>{n[t]||(n[t]=e[t])})),delete t.detail.assets,o(t.detail.children)}}))};return o(i.elements),i.assets=n,i},t.sortElementsViewVisiableInfoMap=function(t){const e={},n=[],i=o=>{const r={viewRectInfo:null,rangeRectInfo:null,isVisibleInView:!0,isGroup:"group"===o.type,position:[...n]};let a=null;a=st(o,{groupQueue:Z(t,n)||[]}),e[o.uuid]={...r,originRectInfo:a},"group"===o.type&&o.detail.children.forEach(((t,e)=>{"group"===t.type&&n.push(e),i(t),"group"===t.type&&n.pop()}))};return t.forEach(((t,e)=>{n.push(e),i(t),n.pop()})),e},t.throttle=function(t,e){let n=-1;return function(...i){n>=0||(n=setTimeout((()=>{t(...i),n=-1}),e))}},t.toColorHexNum=function(t){return parseInt(t.replace(/^\#/,"0x"))},t.toColorHexStr=function(t){return"#"+t.toString(16)},t.updateElementInList=function t(e,n,i){var o,r;let a=null;for(let l=0;l<i.length;l++){const s=i[l];if(s.uuid===e){"group"===s.type&&!0===(null==(o=s.operations)?void 0:o.deepResize)&&(n.w&&n.w>0||n.h&&n.h>0)&&$t(s,{w:n.w,h:n.h}),zt(s,n),a=s;break}"group"===s.type&&(a=t(e,n,(null==(r=null==s?void 0:s.detail)?void 0:r.children)||[]))}return a},t.updateElementInListByPosition=Ot,t.vaildPoint=j,t.vaildTouchPoint=function(t){return!0===j(t)&&t.f>=0},t.validateElements=function t(e){let n=!0;if(Array.isArray(e)){const i=[];e.forEach((e=>{var o;"string"==typeof e.uuid&&e.uuid?i.includes(e.uuid)?(n=!1,console.warn(`Duplicate uuids: ${e.uuid}`)):i.push(e.uuid):(n=!1,console.warn("Element missing uuid",e)),"group"===e.type&&(n=t(null==(o=null==e?void 0:e.detail)?void 0:o.children))}))}return n},t.viewScale=function(t){const{scale:e,point:n,viewScaleInfo:i}=t,{offsetLeft:o,offsetTop:r}=i,a=e/i.scale,l=n.x,s=n.y;return{moveX:l-l*a+(o*a-o),moveY:s-s*a+(r*a-r)}},t.viewScroll=function(t){const{moveX:e=0,moveY:n=0,viewScaleInfo:i,viewSizeInfo:o}=t,{scale:r}=i,{width:a,height:l,contextWidth:s,contextHeight:c}=o;let h=i.offsetLeft,u=i.offsetRight,f=i.offsetTop,d=i.offsetBottom;return h+=e,f+=n,u=a-(s*r+h),d=l-(c*r+f),{scale:r,offsetTop:f,offsetLeft:h,offsetRight:u,offsetBottom:d}},Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t}({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idraw/util",
3
- "version": "0.4.0-beta.14",
3
+ "version": "0.4.0-beta.16",
4
4
  "description": "",
5
5
  "main": "dist/esm/index.js",
6
6
  "module": "dist/esm/index.js",