@idraw/renderer 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.global.js +151 -126
- package/dist/index.global.min.js +1 -1
- package/package.json +3 -3
package/dist/index.global.js
CHANGED
|
@@ -85,16 +85,16 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
85
85
|
});
|
|
86
86
|
function deepClone(target) {
|
|
87
87
|
function _clone(t) {
|
|
88
|
-
const
|
|
89
|
-
if (["Null", "Number", "String", "Boolean", "Undefined"].indexOf(
|
|
88
|
+
const type2 = is$1(t);
|
|
89
|
+
if (["Null", "Number", "String", "Boolean", "Undefined"].indexOf(type2) >= 0) {
|
|
90
90
|
return t;
|
|
91
|
-
} else if (
|
|
91
|
+
} else if (type2 === "Array") {
|
|
92
92
|
const arr = [];
|
|
93
93
|
t.forEach((item) => {
|
|
94
94
|
arr.push(_clone(item));
|
|
95
95
|
});
|
|
96
96
|
return arr;
|
|
97
|
-
} else if (
|
|
97
|
+
} else if (type2 === "Object") {
|
|
98
98
|
const obj = {};
|
|
99
99
|
const keys = Object.keys(t);
|
|
100
100
|
keys.forEach((key) => {
|
|
@@ -112,45 +112,45 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
112
112
|
function is$1(target) {
|
|
113
113
|
return Object.prototype.toString.call(target).replace(/[\]|\[]{1,1}/gi, "").split(" ")[1];
|
|
114
114
|
}
|
|
115
|
-
function parsePrototype(
|
|
116
|
-
const typeStr = Object.prototype.toString.call(
|
|
115
|
+
function parsePrototype(data2) {
|
|
116
|
+
const typeStr = Object.prototype.toString.call(data2) || "";
|
|
117
117
|
const result = typeStr.replace(/(\[object|\])/gi, "").trim();
|
|
118
118
|
return result;
|
|
119
119
|
}
|
|
120
120
|
const istype = {
|
|
121
|
-
type(
|
|
122
|
-
const result = parsePrototype(
|
|
121
|
+
type(data2, lowerCase) {
|
|
122
|
+
const result = parsePrototype(data2);
|
|
123
123
|
return lowerCase === true ? result.toLocaleLowerCase() : result;
|
|
124
124
|
},
|
|
125
|
-
array(
|
|
126
|
-
return parsePrototype(
|
|
125
|
+
array(data2) {
|
|
126
|
+
return parsePrototype(data2) === "Array";
|
|
127
127
|
},
|
|
128
|
-
json(
|
|
129
|
-
return parsePrototype(
|
|
128
|
+
json(data2) {
|
|
129
|
+
return parsePrototype(data2) === "Object";
|
|
130
130
|
},
|
|
131
|
-
function(
|
|
132
|
-
return parsePrototype(
|
|
131
|
+
function(data2) {
|
|
132
|
+
return parsePrototype(data2) === "Function";
|
|
133
133
|
},
|
|
134
|
-
asyncFunction(
|
|
135
|
-
return parsePrototype(
|
|
134
|
+
asyncFunction(data2) {
|
|
135
|
+
return parsePrototype(data2) === "AsyncFunction";
|
|
136
136
|
},
|
|
137
|
-
boolean(
|
|
138
|
-
return parsePrototype(
|
|
137
|
+
boolean(data2) {
|
|
138
|
+
return parsePrototype(data2) === "Boolean";
|
|
139
139
|
},
|
|
140
|
-
string(
|
|
141
|
-
return parsePrototype(
|
|
140
|
+
string(data2) {
|
|
141
|
+
return parsePrototype(data2) === "String";
|
|
142
142
|
},
|
|
143
|
-
number(
|
|
144
|
-
return parsePrototype(
|
|
143
|
+
number(data2) {
|
|
144
|
+
return parsePrototype(data2) === "Number";
|
|
145
145
|
},
|
|
146
|
-
undefined(
|
|
147
|
-
return parsePrototype(
|
|
146
|
+
undefined(data2) {
|
|
147
|
+
return parsePrototype(data2) === "Undefined";
|
|
148
148
|
},
|
|
149
|
-
null(
|
|
150
|
-
return parsePrototype(
|
|
149
|
+
null(data2) {
|
|
150
|
+
return parsePrototype(data2) === "Null";
|
|
151
151
|
},
|
|
152
|
-
promise(
|
|
153
|
-
return parsePrototype(
|
|
152
|
+
promise(data2) {
|
|
153
|
+
return parsePrototype(data2) === "Promise";
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
156
|
function parseHTMLToDataURL(html2, opts) {
|
|
@@ -333,8 +333,33 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
333
333
|
function numberStr(value) {
|
|
334
334
|
return /^(-?\d+(?:\.\d+)?)$/.test(`${value}`);
|
|
335
335
|
}
|
|
336
|
+
function type(value) {
|
|
337
|
+
return ["rect", "circle", "text", "image", "svg", "html", "group"].includes(value);
|
|
338
|
+
}
|
|
339
|
+
function element(elem) {
|
|
340
|
+
if (!elem) {
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
return type(elem === null || elem === void 0 ? void 0 : elem.type) && x(elem === null || elem === void 0 ? void 0 : elem.x) && y(elem === null || elem === void 0 ? void 0 : elem.y) && w(elem === null || elem === void 0 ? void 0 : elem.w) && h(elem === null || elem === void 0 ? void 0 : elem.h);
|
|
344
|
+
}
|
|
345
|
+
function layout(value) {
|
|
346
|
+
if (!value) {
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
return x(value === null || value === void 0 ? void 0 : value.x) && y(value === null || value === void 0 ? void 0 : value.y) && w(value === null || value === void 0 ? void 0 : value.w) && h(value === null || value === void 0 ? void 0 : value.h);
|
|
350
|
+
}
|
|
351
|
+
function data(d) {
|
|
352
|
+
if (Array(d === null || d === void 0 ? void 0 : d.elements) && (d === null || d === void 0 ? void 0 : d.elements.length) >= 0) {
|
|
353
|
+
return true;
|
|
354
|
+
}
|
|
355
|
+
return false;
|
|
356
|
+
}
|
|
336
357
|
const is = {
|
|
337
358
|
positiveNum,
|
|
359
|
+
data,
|
|
360
|
+
element,
|
|
361
|
+
layout,
|
|
362
|
+
type,
|
|
338
363
|
x,
|
|
339
364
|
y,
|
|
340
365
|
w,
|
|
@@ -803,7 +828,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
803
828
|
}
|
|
804
829
|
function getViewPointAtElement(p, opts) {
|
|
805
830
|
var _a, _b, _c;
|
|
806
|
-
const { context2d: ctx, data, viewScaleInfo, groupQueue } = opts;
|
|
831
|
+
const { context2d: ctx, data: data2, viewScaleInfo, groupQueue } = opts;
|
|
807
832
|
const result = {
|
|
808
833
|
index: -1,
|
|
809
834
|
element: null,
|
|
@@ -854,8 +879,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
854
879
|
if (result.element) {
|
|
855
880
|
return result;
|
|
856
881
|
}
|
|
857
|
-
for (let i =
|
|
858
|
-
const elem =
|
|
882
|
+
for (let i = data2.elements.length - 1; i >= 0; i--) {
|
|
883
|
+
const elem = data2.elements[i];
|
|
859
884
|
if (((_c = elem === null || elem === void 0 ? void 0 : elem.operations) === null || _c === void 0 ? void 0 : _c.invisible) === true) {
|
|
860
885
|
continue;
|
|
861
886
|
}
|
|
@@ -1861,18 +1886,18 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1861
1886
|
});
|
|
1862
1887
|
}
|
|
1863
1888
|
const defaultDetail = getDefaultElementDetailConfig();
|
|
1864
|
-
function drawElementList(ctx,
|
|
1889
|
+
function drawElementList(ctx, data2, opts) {
|
|
1865
1890
|
var _a;
|
|
1866
|
-
const { elements = [] } =
|
|
1891
|
+
const { elements = [] } = data2;
|
|
1867
1892
|
const { parentOpacity } = opts;
|
|
1868
1893
|
for (let i = 0; i < elements.length; i++) {
|
|
1869
|
-
const
|
|
1894
|
+
const element2 = elements[i];
|
|
1870
1895
|
const elem = {
|
|
1871
|
-
...
|
|
1896
|
+
...element2,
|
|
1872
1897
|
...{
|
|
1873
1898
|
detail: {
|
|
1874
1899
|
...defaultDetail,
|
|
1875
|
-
...
|
|
1900
|
+
...element2 == null ? void 0 : element2.detail
|
|
1876
1901
|
}
|
|
1877
1902
|
}
|
|
1878
1903
|
};
|
|
@@ -1893,9 +1918,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1893
1918
|
}
|
|
1894
1919
|
}
|
|
1895
1920
|
}
|
|
1896
|
-
function drawLayout(ctx,
|
|
1921
|
+
function drawLayout(ctx, layout2, opts, renderContent) {
|
|
1897
1922
|
const { viewScaleInfo, viewSizeInfo, parentOpacity } = opts;
|
|
1898
|
-
const elem = { uuid: "layout", type: "group", ...
|
|
1923
|
+
const elem = { uuid: "layout", type: "group", ...layout2 };
|
|
1899
1924
|
const { x: x2, y: y2, w: w2, h: h2 } = calcViewElementSize(elem, { viewScaleInfo }) || elem;
|
|
1900
1925
|
const angle2 = 0;
|
|
1901
1926
|
const viewElem = { ...elem, ...{ x: x2, y: y2, w: w2, h: h2, angle: angle2 } };
|
|
@@ -1906,9 +1931,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1906
1931
|
drawBoxBackground(ctx, viewElem, { viewScaleInfo, viewSizeInfo });
|
|
1907
1932
|
}
|
|
1908
1933
|
});
|
|
1909
|
-
if (
|
|
1934
|
+
if (layout2.detail.overflow === "hidden") {
|
|
1910
1935
|
const { viewScaleInfo: viewScaleInfo2, viewSizeInfo: viewSizeInfo2 } = opts;
|
|
1911
|
-
const elem2 = { uuid: "layout", type: "group", ...
|
|
1936
|
+
const elem2 = { uuid: "layout", type: "group", ...layout2 };
|
|
1912
1937
|
const viewElemSize = calcViewElementSize(elem2, { viewScaleInfo: viewScaleInfo2 }) || elem2;
|
|
1913
1938
|
const viewElem2 = { ...elem2, ...viewElemSize };
|
|
1914
1939
|
const { x: x22, y: y22, w: w22, h: h22, radiusList } = calcViewBoxSize(viewElem2, {
|
|
@@ -1927,7 +1952,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1927
1952
|
ctx.clip("nonzero");
|
|
1928
1953
|
}
|
|
1929
1954
|
renderContent(ctx);
|
|
1930
|
-
if (
|
|
1955
|
+
if (layout2.detail.overflow === "hidden") {
|
|
1931
1956
|
ctx.restore();
|
|
1932
1957
|
}
|
|
1933
1958
|
drawBoxBorder(ctx, viewElem, { viewScaleInfo });
|
|
@@ -1943,23 +1968,23 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1943
1968
|
}
|
|
1944
1969
|
}
|
|
1945
1970
|
const supportElementTypes = ["image", "svg", "html"];
|
|
1946
|
-
const getAssetIdFromElement = (
|
|
1971
|
+
const getAssetIdFromElement = (element2) => {
|
|
1947
1972
|
var _a, _b, _c;
|
|
1948
1973
|
let source = null;
|
|
1949
|
-
if (
|
|
1950
|
-
source = ((_a =
|
|
1951
|
-
} else if (
|
|
1952
|
-
source = ((_b =
|
|
1953
|
-
} else if (
|
|
1954
|
-
source = ((_c =
|
|
1974
|
+
if (element2.type === "image") {
|
|
1975
|
+
source = ((_a = element2 == null ? void 0 : element2.detail) == null ? void 0 : _a.src) || null;
|
|
1976
|
+
} else if (element2.type === "svg") {
|
|
1977
|
+
source = ((_b = element2 == null ? void 0 : element2.detail) == null ? void 0 : _b.svg) || null;
|
|
1978
|
+
} else if (element2.type === "html") {
|
|
1979
|
+
source = ((_c = element2 == null ? void 0 : element2.detail) == null ? void 0 : _c.html) || null;
|
|
1955
1980
|
}
|
|
1956
1981
|
if (typeof source === "string" && source) {
|
|
1957
1982
|
if (isAssetId(source)) {
|
|
1958
1983
|
return source;
|
|
1959
1984
|
}
|
|
1960
|
-
return createAssetId(source,
|
|
1985
|
+
return createAssetId(source, element2.uuid);
|
|
1961
1986
|
}
|
|
1962
|
-
return createAssetId(`${createUUID()}-${
|
|
1987
|
+
return createAssetId(`${createUUID()}-${element2.uuid}-${createUUID()}-${createUUID()}`, element2.uuid);
|
|
1963
1988
|
};
|
|
1964
1989
|
class Loader extends EventEmitter {
|
|
1965
1990
|
constructor() {
|
|
@@ -2013,24 +2038,24 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2013
2038
|
__privateSet(this, _currentLoadItemMap, {});
|
|
2014
2039
|
__privateSet(this, _storageLoadItemMap, {});
|
|
2015
2040
|
}
|
|
2016
|
-
resetElementAsset(
|
|
2041
|
+
resetElementAsset(element2) {
|
|
2017
2042
|
var _a, _b, _c;
|
|
2018
|
-
if (supportElementTypes.includes(
|
|
2043
|
+
if (supportElementTypes.includes(element2.type)) {
|
|
2019
2044
|
let assetId = null;
|
|
2020
2045
|
let resource = null;
|
|
2021
|
-
if (
|
|
2022
|
-
resource =
|
|
2023
|
-
} else if (
|
|
2024
|
-
resource =
|
|
2025
|
-
} else if (
|
|
2026
|
-
resource =
|
|
2046
|
+
if (element2.type === "image" && typeof ((_a = element2 == null ? void 0 : element2.detail) == null ? void 0 : _a.src) === "string") {
|
|
2047
|
+
resource = element2.detail.src;
|
|
2048
|
+
} else if (element2.type === "svg" && typeof ((_b = element2 == null ? void 0 : element2.detail) == null ? void 0 : _b.svg) === "string") {
|
|
2049
|
+
resource = element2.detail.svg;
|
|
2050
|
+
} else if (element2.type === "html" && typeof ((_c = element2 == null ? void 0 : element2.detail) == null ? void 0 : _c.html) === "string") {
|
|
2051
|
+
resource = element2.detail.html;
|
|
2027
2052
|
}
|
|
2028
2053
|
if (typeof resource === "string") {
|
|
2029
|
-
this.load(
|
|
2054
|
+
this.load(element2, {});
|
|
2030
2055
|
if (isAssetId(resource)) {
|
|
2031
2056
|
assetId = resource;
|
|
2032
|
-
} else if (
|
|
2033
|
-
assetId = createAssetId(resource,
|
|
2057
|
+
} else if (element2.uuid) {
|
|
2058
|
+
assetId = createAssetId(resource, element2.uuid);
|
|
2034
2059
|
}
|
|
2035
2060
|
}
|
|
2036
2061
|
if (assetId && isAssetId(assetId)) {
|
|
@@ -2046,20 +2071,20 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2046
2071
|
__privateSet(this, _currentLoadItemMap, null);
|
|
2047
2072
|
__privateSet(this, _storageLoadItemMap, null);
|
|
2048
2073
|
}
|
|
2049
|
-
load(
|
|
2074
|
+
load(element2, assets) {
|
|
2050
2075
|
if (__privateGet(this, _hasDestroyed) === true) {
|
|
2051
2076
|
return;
|
|
2052
2077
|
}
|
|
2053
|
-
if (__privateMethod(this, _Loader_instances, isExistingErrorStorage_fn).call(this,
|
|
2078
|
+
if (__privateMethod(this, _Loader_instances, isExistingErrorStorage_fn).call(this, element2)) {
|
|
2054
2079
|
return;
|
|
2055
2080
|
}
|
|
2056
|
-
if (supportElementTypes.includes(
|
|
2057
|
-
__privateMethod(this, _Loader_instances, loadResource_fn).call(this,
|
|
2081
|
+
if (supportElementTypes.includes(element2.type)) {
|
|
2082
|
+
__privateMethod(this, _Loader_instances, loadResource_fn).call(this, element2, assets);
|
|
2058
2083
|
}
|
|
2059
2084
|
}
|
|
2060
|
-
getContent(
|
|
2085
|
+
getContent(element2) {
|
|
2061
2086
|
var _a, _b;
|
|
2062
|
-
const assetId = getAssetIdFromElement(
|
|
2087
|
+
const assetId = getAssetIdFromElement(element2);
|
|
2063
2088
|
return ((_b = (_a = __privateGet(this, _storageLoadItemMap)) == null ? void 0 : _a[assetId]) == null ? void 0 : _b.content) || null;
|
|
2064
2089
|
}
|
|
2065
2090
|
getLoadItemMap() {
|
|
@@ -2074,30 +2099,30 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2074
2099
|
_storageLoadItemMap = new WeakMap();
|
|
2075
2100
|
_hasDestroyed = new WeakMap();
|
|
2076
2101
|
_Loader_instances = new WeakSet();
|
|
2077
|
-
registerLoadFunc_fn = function(
|
|
2078
|
-
__privateGet(this, _loadFuncMap)[
|
|
2102
|
+
registerLoadFunc_fn = function(type2, func) {
|
|
2103
|
+
__privateGet(this, _loadFuncMap)[type2] = func;
|
|
2079
2104
|
};
|
|
2080
|
-
getLoadElementSource_fn = function(
|
|
2105
|
+
getLoadElementSource_fn = function(element2) {
|
|
2081
2106
|
var _a, _b, _c;
|
|
2082
2107
|
let source = null;
|
|
2083
|
-
if (
|
|
2084
|
-
source = ((_a =
|
|
2085
|
-
} else if (
|
|
2086
|
-
source = ((_b =
|
|
2087
|
-
} else if (
|
|
2088
|
-
source = ((_c =
|
|
2108
|
+
if (element2.type === "image") {
|
|
2109
|
+
source = ((_a = element2 == null ? void 0 : element2.detail) == null ? void 0 : _a.src) || null;
|
|
2110
|
+
} else if (element2.type === "svg") {
|
|
2111
|
+
source = ((_b = element2 == null ? void 0 : element2.detail) == null ? void 0 : _b.svg) || null;
|
|
2112
|
+
} else if (element2.type === "html") {
|
|
2113
|
+
source = ((_c = element2 == null ? void 0 : element2.detail) == null ? void 0 : _c.html) || null;
|
|
2089
2114
|
}
|
|
2090
2115
|
return source;
|
|
2091
2116
|
};
|
|
2092
|
-
createLoadItem_fn = function(
|
|
2117
|
+
createLoadItem_fn = function(element2) {
|
|
2093
2118
|
return {
|
|
2094
|
-
element,
|
|
2119
|
+
element: element2,
|
|
2095
2120
|
status: "null",
|
|
2096
2121
|
content: null,
|
|
2097
2122
|
error: null,
|
|
2098
2123
|
startTime: -1,
|
|
2099
2124
|
endTime: -1,
|
|
2100
|
-
source: __privateMethod(this, _Loader_instances, getLoadElementSource_fn).call(this,
|
|
2125
|
+
source: __privateMethod(this, _Loader_instances, getLoadElementSource_fn).call(this, element2)
|
|
2101
2126
|
};
|
|
2102
2127
|
};
|
|
2103
2128
|
emitLoad_fn = function(item) {
|
|
@@ -2131,17 +2156,17 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2131
2156
|
}
|
|
2132
2157
|
}
|
|
2133
2158
|
};
|
|
2134
|
-
loadResource_fn = function(
|
|
2135
|
-
const item = __privateMethod(this, _Loader_instances, createLoadItem_fn).call(this,
|
|
2136
|
-
const assetId = getAssetIdFromElement(
|
|
2159
|
+
loadResource_fn = function(element2, assets) {
|
|
2160
|
+
const item = __privateMethod(this, _Loader_instances, createLoadItem_fn).call(this, element2);
|
|
2161
|
+
const assetId = getAssetIdFromElement(element2);
|
|
2137
2162
|
if (__privateGet(this, _currentLoadItemMap)[assetId]) {
|
|
2138
2163
|
return;
|
|
2139
2164
|
}
|
|
2140
2165
|
__privateGet(this, _currentLoadItemMap)[assetId] = item;
|
|
2141
|
-
const loadFunc = __privateGet(this, _loadFuncMap)[
|
|
2166
|
+
const loadFunc = __privateGet(this, _loadFuncMap)[element2.type];
|
|
2142
2167
|
if (typeof loadFunc === "function" && !__privateGet(this, _hasDestroyed)) {
|
|
2143
2168
|
item.startTime = Date.now();
|
|
2144
|
-
loadFunc(
|
|
2169
|
+
loadFunc(element2, assets).then((result) => {
|
|
2145
2170
|
if (!__privateGet(this, _hasDestroyed)) {
|
|
2146
2171
|
item.content = result.content;
|
|
2147
2172
|
item.endTime = Date.now();
|
|
@@ -2149,7 +2174,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2149
2174
|
__privateMethod(this, _Loader_instances, emitLoad_fn).call(this, item);
|
|
2150
2175
|
}
|
|
2151
2176
|
}).catch((err) => {
|
|
2152
|
-
console.warn(`Load element source "${item.source}" fail`, err,
|
|
2177
|
+
console.warn(`Load element source "${item.source}" fail`, err, element2);
|
|
2153
2178
|
item.endTime = Date.now();
|
|
2154
2179
|
item.status = "error";
|
|
2155
2180
|
item.error = err;
|
|
@@ -2157,11 +2182,11 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2157
2182
|
});
|
|
2158
2183
|
}
|
|
2159
2184
|
};
|
|
2160
|
-
isExistingErrorStorage_fn = function(
|
|
2185
|
+
isExistingErrorStorage_fn = function(element2) {
|
|
2161
2186
|
var _a;
|
|
2162
|
-
const assetId = getAssetIdFromElement(
|
|
2187
|
+
const assetId = getAssetIdFromElement(element2);
|
|
2163
2188
|
const existItem = (_a = __privateGet(this, _currentLoadItemMap)) == null ? void 0 : _a[assetId];
|
|
2164
|
-
if (existItem && existItem.status === "error" && existItem.source && existItem.source === __privateMethod(this, _Loader_instances, getLoadElementSource_fn).call(this,
|
|
2189
|
+
if (existItem && existItem.status === "error" && existItem.source && existItem.source === __privateMethod(this, _Loader_instances, getLoadElementSource_fn).call(this, element2)) {
|
|
2165
2190
|
return true;
|
|
2166
2191
|
}
|
|
2167
2192
|
return false;
|
|
@@ -2450,9 +2475,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2450
2475
|
const context2d = __privateGet(this, _opts).tempContext;
|
|
2451
2476
|
return getViewPointAtElement(p, { ...opts, ...{ context2d } });
|
|
2452
2477
|
}
|
|
2453
|
-
resetVirtualFlatItemMap(
|
|
2454
|
-
if (
|
|
2455
|
-
const { virtualFlatItemMap, invisibleCount, visibleCount } = sortElementsViewVisiableInfoMap(
|
|
2478
|
+
resetVirtualFlatItemMap(data2, opts) {
|
|
2479
|
+
if (data2) {
|
|
2480
|
+
const { virtualFlatItemMap, invisibleCount, visibleCount } = sortElementsViewVisiableInfoMap(data2.elements, {
|
|
2456
2481
|
...opts,
|
|
2457
2482
|
...{
|
|
2458
2483
|
tempContext: __privateGet(this, _opts).tempContext
|
|
@@ -2520,27 +2545,27 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2520
2545
|
};
|
|
2521
2546
|
return viewRectInfo;
|
|
2522
2547
|
}
|
|
2523
|
-
modifyText(
|
|
2548
|
+
modifyText(element2) {
|
|
2524
2549
|
const virtualFlatItemMap = __privateGet(this, _store).get("virtualFlatItemMap");
|
|
2525
|
-
const flatItem = virtualFlatItemMap[
|
|
2526
|
-
if (
|
|
2550
|
+
const flatItem = virtualFlatItemMap[element2.uuid];
|
|
2551
|
+
if (element2 && element2.type === "text") {
|
|
2527
2552
|
const newVirtualFlatItem = {
|
|
2528
2553
|
...flatItem,
|
|
2529
|
-
...calcVirtualTextDetail(
|
|
2554
|
+
...calcVirtualTextDetail(element2, {
|
|
2530
2555
|
tempContext: __privateGet(this, _opts).tempContext
|
|
2531
2556
|
})
|
|
2532
2557
|
};
|
|
2533
|
-
virtualFlatItemMap[
|
|
2558
|
+
virtualFlatItemMap[element2.uuid] = newVirtualFlatItem;
|
|
2534
2559
|
__privateGet(this, _store).set("virtualFlatItemMap", virtualFlatItemMap);
|
|
2535
2560
|
}
|
|
2536
2561
|
}
|
|
2537
|
-
modifyVirtualFlatItemMap(
|
|
2562
|
+
modifyVirtualFlatItemMap(data2, opts) {
|
|
2538
2563
|
const { modifyInfo, viewScaleInfo, viewSizeInfo } = opts;
|
|
2539
|
-
const { type, content } = modifyInfo;
|
|
2540
|
-
const list =
|
|
2564
|
+
const { type: type2, content } = modifyInfo;
|
|
2565
|
+
const list = data2.elements;
|
|
2541
2566
|
const virtualFlatItemMap = __privateGet(this, _store).get("virtualFlatItemMap");
|
|
2542
|
-
if (
|
|
2543
|
-
const { element } = content;
|
|
2567
|
+
if (type2 === "deleteElement") {
|
|
2568
|
+
const { element: element2 } = content;
|
|
2544
2569
|
const uuids = [];
|
|
2545
2570
|
const _walk = (e) => {
|
|
2546
2571
|
uuids.push(e.uuid);
|
|
@@ -2550,41 +2575,41 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2550
2575
|
});
|
|
2551
2576
|
}
|
|
2552
2577
|
};
|
|
2553
|
-
_walk(
|
|
2578
|
+
_walk(element2);
|
|
2554
2579
|
uuids.forEach((uuid) => {
|
|
2555
2580
|
delete virtualFlatItemMap[uuid];
|
|
2556
2581
|
});
|
|
2557
2582
|
__privateGet(this, _store).set("virtualFlatItemMap", virtualFlatItemMap);
|
|
2558
|
-
} else if (
|
|
2583
|
+
} else if (type2 === "addElement" || type2 === "updateElement") {
|
|
2559
2584
|
const { position } = content;
|
|
2560
|
-
const
|
|
2585
|
+
const element2 = findElementFromListByPosition(position, data2.elements);
|
|
2561
2586
|
const groupQueue = getGroupQueueByElementPosition(list, position);
|
|
2562
|
-
if (
|
|
2563
|
-
if (
|
|
2564
|
-
this.resetVirtualFlatItemMap(
|
|
2587
|
+
if (element2) {
|
|
2588
|
+
if (type2 === "updateElement" && element2.type === "group") {
|
|
2589
|
+
this.resetVirtualFlatItemMap(data2, { viewScaleInfo, viewSizeInfo });
|
|
2565
2590
|
} else {
|
|
2566
|
-
const originRectInfo = calcElementOriginRectInfo(
|
|
2591
|
+
const originRectInfo = calcElementOriginRectInfo(element2, {
|
|
2567
2592
|
groupQueue: groupQueue || []
|
|
2568
2593
|
});
|
|
2569
2594
|
const newVirtualFlatItem = {
|
|
2570
|
-
type:
|
|
2595
|
+
type: element2.type,
|
|
2571
2596
|
originRectInfo,
|
|
2572
|
-
rangeRectInfo: is.angle(
|
|
2597
|
+
rangeRectInfo: is.angle(element2.angle) ? originRectInfoToRangeRectInfo(originRectInfo) : originRectInfo,
|
|
2573
2598
|
isVisibleInView: true,
|
|
2574
2599
|
position: [...position],
|
|
2575
|
-
...calcVirtualFlatDetail(
|
|
2600
|
+
...calcVirtualFlatDetail(element2, {
|
|
2576
2601
|
tempContext: __privateGet(this, _opts).tempContext
|
|
2577
2602
|
})
|
|
2578
2603
|
};
|
|
2579
|
-
virtualFlatItemMap[
|
|
2604
|
+
virtualFlatItemMap[element2.uuid] = newVirtualFlatItem;
|
|
2580
2605
|
__privateGet(this, _store).set("virtualFlatItemMap", virtualFlatItemMap);
|
|
2581
|
-
if (
|
|
2606
|
+
if (type2 === "updateElement") {
|
|
2582
2607
|
this.updateVisiableStatus({ viewScaleInfo, viewSizeInfo });
|
|
2583
2608
|
}
|
|
2584
2609
|
}
|
|
2585
2610
|
}
|
|
2586
|
-
} else if (
|
|
2587
|
-
this.resetVirtualFlatItemMap(
|
|
2611
|
+
} else if (type2 === "moveElement") {
|
|
2612
|
+
this.resetVirtualFlatItemMap(data2, { viewScaleInfo, viewSizeInfo });
|
|
2588
2613
|
}
|
|
2589
2614
|
}
|
|
2590
2615
|
getVirtualFlatItem(uuid) {
|
|
@@ -2621,7 +2646,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2621
2646
|
updateOptions(opts) {
|
|
2622
2647
|
__privateSet(this, _opts2, opts);
|
|
2623
2648
|
}
|
|
2624
|
-
drawData(
|
|
2649
|
+
drawData(data2, opts) {
|
|
2625
2650
|
const loader = __privateGet(this, _loader);
|
|
2626
2651
|
const calculator = __privateGet(this, _calculator);
|
|
2627
2652
|
const { sharer } = __privateGet(this, _opts2);
|
|
@@ -2634,7 +2659,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2634
2659
|
h: opts.viewSizeInfo.height
|
|
2635
2660
|
};
|
|
2636
2661
|
if (opts.forceDrawAll === true) {
|
|
2637
|
-
__privateGet(this, _calculator).resetVirtualFlatItemMap(
|
|
2662
|
+
__privateGet(this, _calculator).resetVirtualFlatItemMap(data2, {
|
|
2638
2663
|
viewScaleInfo: opts.viewScaleInfo,
|
|
2639
2664
|
viewSizeInfo: opts.viewSizeInfo
|
|
2640
2665
|
});
|
|
@@ -2643,18 +2668,18 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2643
2668
|
loader,
|
|
2644
2669
|
calculator,
|
|
2645
2670
|
parentElementSize,
|
|
2646
|
-
elementAssets:
|
|
2671
|
+
elementAssets: data2.assets,
|
|
2647
2672
|
parentOpacity: 1,
|
|
2648
2673
|
overrideElementMap: sharer == null ? void 0 : sharer.getActiveOverrideElemenentMap(),
|
|
2649
2674
|
...opts
|
|
2650
2675
|
};
|
|
2651
|
-
drawGlobalBackground(viewContext,
|
|
2652
|
-
if (
|
|
2653
|
-
drawLayout(viewContext,
|
|
2654
|
-
drawElementList(viewContext,
|
|
2676
|
+
drawGlobalBackground(viewContext, data2.global, drawOpts);
|
|
2677
|
+
if (data2.layout) {
|
|
2678
|
+
drawLayout(viewContext, data2.layout, drawOpts, () => {
|
|
2679
|
+
drawElementList(viewContext, data2, drawOpts);
|
|
2655
2680
|
});
|
|
2656
2681
|
} else {
|
|
2657
|
-
drawElementList(viewContext,
|
|
2682
|
+
drawElementList(viewContext, data2, drawOpts);
|
|
2658
2683
|
}
|
|
2659
2684
|
}
|
|
2660
2685
|
scale(num) {
|
|
@@ -2663,7 +2688,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2663
2688
|
return;
|
|
2664
2689
|
}
|
|
2665
2690
|
const {
|
|
2666
|
-
data,
|
|
2691
|
+
data: data2,
|
|
2667
2692
|
offsetTop,
|
|
2668
2693
|
offsetBottom,
|
|
2669
2694
|
offsetLeft,
|
|
@@ -2674,8 +2699,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2674
2699
|
contextWidth,
|
|
2675
2700
|
devicePixelRatio
|
|
2676
2701
|
} = sharer.getActiveStoreSnapshot();
|
|
2677
|
-
if (
|
|
2678
|
-
this.drawData(
|
|
2702
|
+
if (data2) {
|
|
2703
|
+
this.drawData(data2, {
|
|
2679
2704
|
viewScaleInfo: {
|
|
2680
2705
|
scale: num,
|
|
2681
2706
|
offsetTop,
|
package/dist/index.global.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var iDrawRenderer=function(t){"use strict";var e,n,i,o,a,r,l,s,c,h,f,u,d,g,p,y,w,m,v,x,b=t=>{throw TypeError(t)},S=(t,e,n)=>e.has(t)||b("Cannot "+n),I=(t,e,n)=>(S(t,e,"read from private field"),n?n.call(t):e.get(t)),M=(t,e,n)=>e.has(t)?b("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),P=(t,e,n,i)=>(S(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),C=(t,e,n)=>(S(t,e,"access private method"),n);function z(t){return"string"==typeof t&&(/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)||/^[a-z]{1,}$/i.test(t))}function A(t,e){if(1===e)return t;let n=1;const i=/^#[0-9a-f]{6,6}$/i;let o=t;if(i.test(t)?n=parseInt(t.substring(5,7).replace(/^#/,"0x")):/^#[0-9a-f]{8,8}$/i.test(t)&&(n=parseInt(t.substring(7,9).replace(/^#/,"0x")),o=t.substring(0,7)),n*=e,i.test(o)&&n>0&&n<1){const t=Math.max(0,Math.min(255,Math.ceil(256*n)));o=`${o.toUpperCase()}${t.toString(16).toUpperCase()}`}return o}function R(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return`${t()}${t()}-${t()}-${t()}-${t()}-${t()}${t()}${t()}`}function T(t,e){let n=0;for(let e=0;e<t.length;e++)n+=t.charCodeAt(e);return(n+e).toString(16).substring(0,4)}function k(t,e){const n=t.length,i=function(t){let e=0;for(let n=0;n<t.length;n++)e+=t.charCodeAt(n);return e}(e),o=Math.floor(n/2),a=t.substring(0,4).padStart(4,"0"),r=t.substring(0,4).padStart(4,"0");return`@assets/${T(n.toString(16).padStart(4,a),i).padStart(4,"0")}${T(t.substring(o-4,o).padStart(4,a),i).padStart(4,"0")}-${T(t.substring(o-8,o-4).padStart(4,a),i).padStart(4,"0")}-${T(t.substring(o-12,o-8).padStart(4,a),i).padStart(4,"0")}-${T(t.substring(o-16,o-12).padStart(4,r),i).padStart(4,"0")}-${T(t.substring(o,o+4).padStart(4,r),i).padStart(4,"0")}${T(t.substring(o+4,o+8).padStart(4,r),i).padStart(4,"0")}${T(r.padStart(4,a).padStart(4,r),i)}`}function L(t){return/^@assets\/[0-9a-z-]{0,}$/.test(`${t}`)}function E(t){return function t(e){const n=function(t){return Object.prototype.toString.call(t).replace(/[\]|\[]{1,1}/gi,"").split(" ")[1]}(e);if(["Null","Number","String","Boolean","Undefined"].indexOf(n)>=0)return e;if("Array"===n){const n=[];return e.forEach((e=>{n.push(t(e))})),n}if("Object"===n){const n={};Object.keys(e).forEach((i=>{n[i]=t(e[i])}));return Object.getOwnPropertySymbols(e).forEach((i=>{n[i]=t(e[i])})),n}}(t)}function O(t){return(Object.prototype.toString.call(t)||"").replace(/(\[object|\])/gi,"").trim()}const W={type(t,e){const n=O(t);return!0===e?n.toLocaleLowerCase():n},array:t=>"Array"===O(t),json:t=>"Object"===O(t),function:t=>"Function"===O(t),asyncFunction:t=>"AsyncFunction"===O(t),boolean:t=>"Boolean"===O(t),string:t=>"String"===O(t),number:t=>"Number"===O(t),undefined:t=>"Undefined"===O(t),null:t=>"Null"===O(t),promise:t=>"Promise"===O(t)};var $=function(t,e,n,i){return new(n||(n=Promise))((function(o,a){function r(t){try{s(i.next(t))}catch(t){a(t)}}function l(t){try{s(i.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,l)}s((i=i.apply(t,e||[])).next())}))};const{Image:F}=window;function D(t){return new Promise(((e,n)=>{const i=new F;i.crossOrigin="anonymous",i.onload=function(){e(i)},i.onabort=n,i.onerror=n,i.src=t}))}function B(t){return $(this,void 0,void 0,(function*(){const e=yield function(t){return new Promise(((e,n)=>{const i=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),o=new FileReader;o.readAsDataURL(i),o.onload=function(t){var n;const i=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(i)},o.onerror=function(t){n(t)}}))}(t);return yield D(e)}))}function V(t,e){return $(this,void 0,void 0,(function*(){t=t.replace(/\&/gi,"&");const n=yield function(t,e){const{width:n,height:i}=e;return new Promise(((e,o)=>{const a=new Blob([`\n <svg \n xmlns="http://www.w3.org/2000/svg" \n width="${n||""}" \n height = "${i||""}">\n <foreignObject width="100%" height="100%">\n <div xmlns = "http://www.w3.org/1999/xhtml">\n ${t}\n </div>\n </foreignObject>\n </svg>\n `],{type:"image/svg+xml;charset=utf-8"}),r=new FileReader;r.readAsDataURL(a),r.onload=function(t){var n;const i=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(i)},r.onerror=function(t){o(t)}}))}(t,e);return yield D(n)}))}function j(t){return"number"==typeof t&&t>=0}function X(t){return"number"==typeof t&&(t>0||t<=0)}function Y(t){return"string"==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(`${t}`)}function H(t){return"string"==typeof t&&/^(data:image\/)/.test(`${t}`)}const U={positiveNum:j,x:function(t){return X(t)},y:function(t){return X(t)},w:function(t){return j(t)},h:function(t){return j(t)},angle:function(t){return"number"==typeof t&&t>=-360&&t<=360},number:X,numberStr:function(t){return/^(-?\d+(?:\.\d+)?)$/.test(`${t}`)},borderWidth:function(t){return j(t)||Array.isArray(t)&&j(t[0])&&j(t[1])&&j(t[2])&&j(t[3])},borderRadius:function(t){return j(t)||Array.isArray(t)&&j(t[0])&&j(t[1])&&j(t[2])&&j(t[3])},color:function(t){return z(t)},imageSrc:function(t){return H(t)||Y(t)},imageURL:Y,imageBase64:H,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 X(t)&&t>0},lineHeight:function(t){return X(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 X(t)&&t>0}};var N,Q=function(t,e,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(t):i?i.value:e.get(t)};class G{constructor(){N.set(this,void 0),function(t,e,n,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===i?o.call(t,n):o?o.value=n:e.set(t,n)}(this,N,new Map,"f")}on(t,e){if(Q(this,N,"f").has(t)){const n=Q(this,N,"f").get(t)||[];null==n||n.push(e),Q(this,N,"f").set(t,n)}else Q(this,N,"f").set(t,[e])}off(t,e){if(Q(this,N,"f").has(t)){const n=Q(this,N,"f").get(t);if(Array.isArray(n))for(let t=0;t<(null==n?void 0:n.length);t++)if(n[t]===e){n.splice(t,1);break}Q(this,N,"f").set(t,n||[])}}trigger(t,e){const n=Q(this,N,"f").get(t);return!!Array.isArray(n)&&(n.forEach((t=>{t(e)})),!0)}has(t){if(Q(this,N,"f").has(t)){const e=Q(this,N,"f").get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1}destroy(){this.clear()}clear(){Q(this,N,"f").clear()}}function q(t,e){return{x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}}N=new WeakMap;var J,K,Z,_,tt,et=function(t,e,n,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?o.call(t,n):o?o.value=n:e.set(t,n),n},nt=function(t,e,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(t):i?i.value:e.get(t)};class it{constructor(t){J.add(this),K.set(this,void 0),Z.set(this,void 0),_.set(this,void 0),et(this,Z,E(t.defaultStorage),"f"),et(this,K,nt(this,J,"m",tt).call(this),"f"),et(this,_,t.defaultStatic||{},"f")}set(t,e){nt(this,K,"f")[t]=e}get(t){return nt(this,K,"f")[t]}setStatic(t,e){nt(this,_,"f")[t]=e}getStatic(t){return nt(this,_,"f")[t]}getSnapshot(t){return!0===(null==t?void 0:t.deepClone)?E(nt(this,K,"f")):Object.assign({},nt(this,K,"f"))}clear(){et(this,K,nt(this,J,"m",tt).call(this),"f")}destroy(){et(this,K,null,"f"),et(this,_,null,"f")}}function ot(t){return t/180*Math.PI}function at(t,e,n){const i=rt(e);!function(t,e,n,i){const o=ot(e||0);n&&(o>0||o<0)&&(t.translate(n.x,n.y),t.rotate(o),t.translate(-n.x,-n.y)),i(t),n&&(o>0||o<0)&&(t.translate(n.x,n.y),t.rotate(-o),t.translate(-n.x,-n.y))}(t,e.angle||0,i,(()=>{n(t)}))}function rt(t){return{x:t.x+t.w/2,y:t.y+t.h/2}}function lt(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 rt({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 st(t,e,n){const i=function(t,e){const n=e.x-t.x,i=e.y-t.y;if(0===n){if(i<0)return 0;if(i>0)return Math.PI}else if(0===i){if(n<0)return 3*Math.PI/2;if(n>0)return Math.PI/2}return n>0&&i<0?Math.atan(Math.abs(n)/Math.abs(i)):n>0&&i>0?Math.PI-Math.atan(Math.abs(n)/Math.abs(i)):n<0&&i>0?Math.PI+Math.atan(Math.abs(n)/Math.abs(i)):n<0&&i<0?2*Math.PI-Math.atan(Math.abs(n)/Math.abs(i)):0}(t,e);let o=i+n;o>2*Math.PI?o-=2*Math.PI:o<0-2*Math.PI&&(o+=2*Math.PI),o<0&&(o+=2*Math.PI);const a=function(t,e){const n=(t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y);return 0===n?n:Math.sqrt(n)}(t,e);let r=0,l=0;return 0===o?(r=0,l=0-a):o>0&&o<Math.PI/2?(r=Math.sin(o)*a,l=0-Math.cos(o)*a):o===Math.PI/2?(r=a,l=0):o>Math.PI/2&&o<Math.PI?(r=Math.sin(Math.PI-o)*a,l=Math.cos(Math.PI-o)*a):o===Math.PI?(r=0,l=a):o>Math.PI&&o<1.5*Math.PI?(r=0-Math.sin(o-Math.PI)*a,l=Math.cos(o-Math.PI)*a):o===1.5*Math.PI?(r=0-a,l=0):o>1.5*Math.PI&&o<2*Math.PI?(r=0-Math.sin(2*Math.PI-o)*a,l=0-Math.cos(2*Math.PI-o)*a):o===2*Math.PI&&(r=0,l=0-a),r+=t.x,l+=t.y,{x:r,y:l}}function ct(t,e,n){const{x:i,y:o,w:a,h:r}=t;let l={x:i,y:o},s={x:i+a,y:o},c={x:i+a,y:o+r},h={x:i,y:o+r};if(n&&(n>0||n<0)){const t=ot(function(t){if(!(t>0||t<0)||0===t||360===t)return 0;let e=t%360;e<0?e+=360:360===t&&(e=0);return e}(n));l=st(e,l,t),s=st(e,s,t),c=st(e,c,t),h=st(e,h,t)}return[l,s,c,h]}function ht(t,e,n){return[st(t,{x:e[0].x,y:e[0].y},n),st(t,{x:e[1].x,y:e[1].y},n),st(t,{x:e[2].x,y:e[2].y},n),st(t,{x:e[3].x,y:e[3].y},n)]}function ft(t,e){var n;const i=[];let o=t;if(e.length>1)for(let t=0;t<e.length-1;t++){const a=o[e[t]];if("group"!==(null==a?void 0:a.type)||!Array.isArray(null===(n=null==a?void 0:a.detail)||void 0===n?void 0:n.children))return null;i.push(a),o=a.detail.children}return i}function ut(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 dt(t){const{x:e,y:n,w:i,h:o,angle:a=0}=t;return 0===a?ut(t):ct(t,rt({x:e,y:n,w:i,h:o}),a)}function gt(t,e){const{groupQueue:n}=e;if(!(n.length>0))return[dt(t)];const i=function(t){const e=[];let n=0,i=0;const o=[],a=[...t];for(let t=0;t<a.length;t++){const{x:r,y:l,w:s,h:c,angle:h=0}=a[t];let f;if(n+=r,i+=l,0===t){const t={x:n,y:i,w:s,h:c};f=dt({x:r,y:l,w:s,h:c,angle:h}),o.push({center:rt(t),angle:h,radian:ot(h)})}else{f=ut({x:n,y:i,w:s,h:c});for(let t=0;t<o.length;t++){const{center:e,radian:n}=o[t];f=ht(e,f,n)}const t=lt(f);(h>0||h<0)&&(f=ht(t,f,ot(h))),o.push({center:t,angle:h,radian:ot(h)})}e.push(f)}return e}([...n,t]);return i}function pt(t,e){const{viewScaleInfo:n}=e,{x:i,y:o,w:a,h:r,angle:l}=t,{scale:s,offsetTop:c,offsetLeft:h}=n;return{x:i*s+h,y:o*s+c,w:a*s,h:r*s,angle:l}}function yt(t,e){const{viewScaleInfo:n}=e,{x:i,y:o}=t,{scale:a,offsetTop:r,offsetLeft:l}=n;return{x:i*a+l,y:o*a+r}}function wt(t,e){const{context2d:n,element:i,viewScaleInfo:o}=e,{angle:a=0}=i,{x:r,y:l,w:s,h:c}=pt(i,{viewScaleInfo:o}),h=function(t){const{angle:e=0}=t;return ct(t,rt(t),e)}({x:r,y:l,w:s,h:c,angle:a});if(h.length>=2){n.beginPath(),n.moveTo(h[0].x,h[0].y);for(let t=1;t<h.length;t++)n.lineTo(h[t].x,h[t].y);n.closePath()}return!!n.isPointInPath(t.x,t.y)}function mt(t,e){const{groupQueue:n}=e,i=function(t,e){return gt(t,e).pop()||null}(t,{groupQueue:n}),o=q(i[0],i[1]),a=q(i[1],i[2]),r=q(i[2],i[3]),l=q(i[3],i[0]),s=i[0],c=i[1],h=i[2],f=i[3],u=Math.max(s.x,c.x,h.x,f.x),d=Math.max(s.y,c.y,h.y,f.y);return{center:{x:(u+Math.min(s.x,c.x,h.x,f.x))/2,y:(d+Math.min(s.y,c.y,h.y,f.y))/2},topLeft:s,topRight:c,bottomLeft:f,bottomRight:h,top:o,right:a,left:l,bottom:r}}function vt(t){const e=Math.max(t.topLeft.x,t.topRight.x,t.bottomRight.x,t.bottomLeft.x),n=Math.max(t.topLeft.y,t.topRight.y,t.bottomRight.y,t.bottomLeft.y),i=Math.min(t.topLeft.x,t.topRight.x,t.bottomRight.x,t.bottomLeft.x),o=Math.min(t.topLeft.y,t.topRight.y,t.bottomRight.y,t.bottomLeft.y),a={x:t.center.x,y:t.center.y},r={x:i,y:o},l={x:e,y:o},s={x:e,y:n},c={x:i,y:n},h=q(r,l),f=q(c,s),u=q(r,c);return{center:a,topLeft:r,topRight:l,bottomLeft:c,bottomRight:s,top:h,right:q(l,s),left:u,bottom:f}}function xt(t){let e="";return t.forEach((t=>{e+=t.type+t.params.join(" ")})),e}K=new WeakMap,Z=new WeakMap,_=new WeakMap,J=new WeakSet,tt=function(){return E(nt(this,Z,"f"))};const bt={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function St(t,e){const{viewScaleInfo:n}=e,{scale:i}=n;let{borderRadius:o}=t.detail;const{borderDash:a}=t.detail,r=Array.isArray(a)&&a.length>0,{boxSizing:l=bt.boxSizing,borderWidth:s}=t.detail;Array.isArray(s)&&(o=0);let{x:c,y:h,w:f,h:u}=t,d=[0,0,0,0];if("number"==typeof o){const t=o*i;d=[t,t,t,t]}else Array.isArray(o)&&4===(null==o?void 0:o.length)&&(d=[o[0]*i,o[1]*i,o[2]*i,o[3]*i]);let g=0;return"number"==typeof s&&(g=(s||0)*i),"border-box"!==l||r?"content-box"===l?(c=t.x-g/2,h=t.y-g/2,f=t.w+g,u=t.h+g):(c=t.x,h=t.y,f=t.w,u=t.h):(c=t.x+g/2,h=t.y+g/2,f=t.w-g,u=t.h-g),f=Math.max(f,1),u=Math.max(u,1),d=d.map((t=>Math.min(t,f/2,u/2))),{x:c,y:h,w:f,h:u,radiusList:d}}const It=["-apple-system",'"system-ui"',' "Segoe UI"'," Roboto",'"Helvetica Neue"',"Arial",'"Noto Sans"'," sans-serif"];function Mt(t){return[t,...It].join(", ")}function Pt(t,e,n){if("string"==typeof e)return e;const{viewElementSize:i,viewScaleInfo:o,opacity:a=1}=n,{x:r,y:l}=i,{scale:s}=o;if("linear-gradient"===(null==e?void 0:e.type)){const{start:n,end:i,stops:o}=e,c={x:r+n.x*s,y:l+n.y*s},h={x:r+i.x*s,y:l+i.y*s},f=t.createLinearGradient(c.x,c.y,h.x,h.y);return o.forEach((t=>{f.addColorStop(t.offset,A(t.color,a))})),f}if("radial-gradient"===(null==e?void 0:e.type)){const{inner:n,outer:i,stops:o}=e,c={x:r+n.x*s,y:l+n.y*s,radius:n.radius*s},h={x:r+i.x*s,y:l+i.y*s,radius:i.radius*s},f=t.createRadialGradient(c.x,c.y,c.radius,h.x,h.y,h.radius);return o.forEach((t=>{f.addColorStop(t.offset,A(t.color,a))})),f}return"#000000"}const Ct={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function zt(t){var e,n,i,o;let a=1;return void 0!==(null==(e=null==t?void 0:t.detail)?void 0:e.opacity)&&(null==(n=null==t?void 0:t.detail)?void 0:n.opacity)>=0&&(null==(i=null==t?void 0:t.detail)?void 0:i.opacity)<=1&&(a=null==(o=null==t?void 0:t.detail)?void 0:o.opacity),a}function At(t,e,n){const{pattern:i,renderContent:o,originElem:a,calcElemSize:r,viewScaleInfo:l,viewSizeInfo:s}=n||{},{parentOpacity:c}=n,h=zt(a)*c,{clipPath:f,clipPathStrokeColor:u,clipPathStrokeWidth:d}=a.detail,g=()=>{t.globalAlpha=h,Rt(t,e,{pattern:i,viewScaleInfo:l,viewSizeInfo:s}),null==o||o(),Tt(t,e,{viewScaleInfo:l}),t.globalAlpha=c};f?(function(t,e,n){const{renderContent:i,originElem:o,calcElemSize:a,viewSizeInfo:r}=n,l=r.devicePixelRatio,{clipPath:s}=(null==o?void 0:o.detail)||{};if(s&&a&&s.commands){const{x:n,y:o,w:r,h:c}=a,{originW:h,originH:f,originX:u,originY:d}=s,g=r/h,p=c/f,y=n-u*g,w=o-d*p;t.save(),t.translate(y,w),t.scale(l*g,l*p);const m=xt(s.commands||[]),v=new Path2D(m);t.clip(v,"nonzero"),t.translate(0-y,0-w),t.setTransform(1,0,0,1,0,0),at(t,{...e},(()=>{null==i||i()})),t.restore()}else null==i||i()}(t,e,{originElem:a,calcElemSize:r,viewSizeInfo:s,renderContent:()=>{g()}}),"number"==typeof d&&d>0&&u&&function(t,e,n){const{renderContent:i,originElem:o,calcElemSize:a,viewSizeInfo:r,parentOpacity:l}=n,s=r.devicePixelRatio,{clipPath:c,clipPathStrokeColor:h,clipPathStrokeWidth:f}=(null==o?void 0:o.detail)||{};if(c&&a&&c.commands&&"number"==typeof f&&f>0&&h){const{x:n,y:o,w:r,h:u}=a,{originW:d,originH:g,originX:p,originY:y}=c,w=r/d,m=u/g,v=n-p*w,x=o-y*m;t.save(),t.globalAlpha=l,t.translate(v,x),t.scale(s*w,s*m);const b=xt(c.commands||[]),S=new Path2D(b);t.strokeStyle=h,t.lineWidth=f,t.stroke(S),t.translate(0-v,0-x),t.setTransform(1,0,0,1,0,0),at(t,{...e},(()=>{null==i||i()})),t.restore()}else null==i||i()}(t,e,{originElem:a,calcElemSize:r,viewSizeInfo:s,parentOpacity:c})):g()}function Rt(t,e,n){var i,o;const{pattern:a,viewScaleInfo:r,viewSizeInfo:l}=n,s=[];if(e.detail.background||a){const{x:n,y:l,w:c,h:h,radiusList:f}=St(e,{viewScaleInfo:r});if(t.beginPath(),t.moveTo(n+f[0],l),t.arcTo(n+c,l,n+c,l+h,f[1]),t.arcTo(n+c,l+h,n,l+h,f[2]),t.arcTo(n,l+h,n,l,f[3]),t.arcTo(n,l,n+c,l,f[0]),t.closePath(),"string"==typeof a)t.fillStyle=a;else if(["CanvasPattern"].includes(W.type(a)))t.fillStyle=a;else if("string"==typeof e.detail.background)t.fillStyle=e.detail.background;else if("linear-gradient"===(null==(i=e.detail.background)?void 0:i.type)){const i=Pt(t,e.detail.background,{viewElementSize:{x:n,y:l,w:c,h:h},viewScaleInfo:r,opacity:t.globalAlpha});t.fillStyle=i}else if("radial-gradient"===(null==(o=e.detail.background)?void 0:o.type)){const i=Pt(t,e.detail.background,{viewElementSize:{x:n,y:l,w:c,h:h},viewScaleInfo:r,opacity:t.globalAlpha});if(t.fillStyle=i,s&&s.length>0)for(let e=0;e<(null==s?void 0:s.length);e++){const i=s[e];"translate"===i.method?t.translate(i.args[0]+n,i.args[1]+l):"rotate"===i.method?t.rotate(...i.args):"scale"===i.method&&t.scale(...i.args)}}t.fill("nonzero"),s&&s.length>0&&t.setTransform(1,0,0,1,0,0)}}function Tt(t,e,n){if(0===e.detail.borderWidth)return;if(!z(e.detail.borderColor))return;const{viewScaleInfo:i}=n,{scale:o}=i;let a=Ct.borderColor;!0===z(e.detail.borderColor)&&(a=e.detail.borderColor);const{borderDash:r,borderWidth:l,borderRadius:s,boxSizing:c=Ct.boxSizing}=e.detail;let h=[];Array.isArray(r)&&r.length>0&&(h=r.map((t=>Math.ceil(t*o)))),h.length>0?t.lineCap="butt":t.lineCap="square";let f=[0,0,0,0];if("number"==typeof s){const t=s*o;f=[t,t,t,t]}else Array.isArray(s)&&4===(null==s?void 0:s.length)&&(f=[s[0]*o,s[1]*o,s[2]*o,s[3]*o]);let u=0;"number"==typeof l&&(u=l||1),u*=o,t.strokeStyle=a;let d=0,g=0,p=0,y=0;if(Array.isArray(l)&&(d=(l[0]||0)*o,g=(l[1]||0)*o,p=(l[2]||0)*o,y=(l[3]||0)*o),y||g||d||p){t.lineCap="butt";let{x:n,y:i,w:o,h:a}=e;"border-box"===c?(n+=y/2,i+=d/2,o=o-y/2-g/2,a=a-d/2-p/2):"content-box"===c?(n-=y/2,i-=d/2,o=o+y/2+g/2,a=a+d/2+p/2):(n=e.x,i=e.y,o=e.w,a=e.h),d&&(t.beginPath(),t.lineWidth=d,t.moveTo(n-y/2,i),t.lineTo(n+o+g/2,i),t.closePath(),t.stroke()),g&&(t.beginPath(),t.lineWidth=g,t.moveTo(n+o,i-d/2),t.lineTo(n+o,i+a+p/2),t.closePath(),t.stroke()),p&&(t.beginPath(),t.lineWidth=p,t.moveTo(n-y/2,i+a),t.lineTo(n+o+g/2,i+a),t.closePath(),t.stroke()),y&&(t.beginPath(),t.lineWidth=y,t.moveTo(n,i-d/2),t.lineTo(n,i+a+p/2),t.closePath(),t.stroke())}else{let{x:n,y:i,w:o,h:a}=e;"border-box"===c?(n=e.x+u/2,i=e.y+u/2,o=e.w-u,a=e.h-u):"content-box"===c?(n=e.x-u/2,i=e.y-u/2,o=e.w+u,a=e.h+u):(n=e.x,i=e.y,o=e.w,a=e.h),o=Math.max(o,1),a=Math.max(a,1),f=f.map((t=>Math.min(t,o/2,a/2))),t.setLineDash(h),t.lineWidth=u,t.beginPath(),t.moveTo(n+f[0],i),t.arcTo(n+o,i,n+o,i+a,f[1]),t.arcTo(n+o,i+a,n,i+a,f[2]),t.arcTo(n,i+a,n,i,f[3]),t.arcTo(n,i,n+o,i,f[0]),t.closePath(),t.stroke()}t.setLineDash([])}function kt(t,e,n){const{detail:i}=e,{viewScaleInfo:o,renderContent:a}=n,{shadowColor:r,shadowOffsetX:l,shadowOffsetY:s,shadowBlur:c}=i;U.number(c)?(t.save(),t.shadowColor=r||Ct.shadowColor,t.shadowOffsetX=(l||0)*o.scale,t.shadowOffsetY=(s||0)*o.scale,t.shadowBlur=(c||0)*o.scale,a(),t.restore()):(t.save(),t.shadowColor="transparent",t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0,a(),t.restore())}function Lt(t,e,n){const{detail:i,angle:o}=e,{viewScaleInfo:a,viewSizeInfo:r,parentOpacity:l}=n,{background:s="#000000",borderColor:c="#000000",boxSizing:h,borderWidth:f=0,borderDash:u}=i;let d=0;"number"==typeof f&&f>0?d=f:Array.isArray(f)&&"number"==typeof f[0]&&f[0]>0&&(d=f[0]),d*=a.scale;const{x:g,y:p,w:y,h:w}=pt({x:e.x,y:e.y,w:e.w,h:e.h},{viewScaleInfo:a})||e,m={...e,x:g,y:p,w:y,h:w,angle:o};at(t,{x:g,y:p,w:y,h:w,angle:o},(()=>{kt(t,m,{viewScaleInfo:a,renderContent:()=>{let e=y/2,n=w/2;const i=g+e,o=p+n,r=e,f=n;if(d>0&&("content-box"===h||("center-line"===h?(e-=d/2,n-=d/2):(e-=d,n-=d))),e>=0&&n>=0){const h=zt(m)*l;t.globalAlpha=h,t.beginPath();const v=Pt(t,s,{viewElementSize:{x:g,y:p,w:y,h:w},viewScaleInfo:a,opacity:t.globalAlpha});if(t.fillStyle=v,t.circle(i,o,r,f,0,0,2*Math.PI),t.closePath(),t.fill("nonzero"),t.globalAlpha=l,"number"==typeof d&&d>0){const r=d/2+e,l=d/2+n;if(t.beginPath(),u){const e=u.map((t=>t*a.scale));t.setLineDash(e)}t.strokeStyle=c,t.lineWidth=d,t.circle(i,o,r,l,0,0,2*Math.PI),t.closePath(),t.stroke(),t.setLineDash([])}}}})}))}function Et(t,e,n){const{viewScaleInfo:i,viewSizeInfo:o,parentOpacity:a}=n,{x:r,y:l,w:s,h:c,angle:h}=pt(e,{viewScaleInfo:i})||e,f={...e,x:r,y:l,w:s,h:c,angle:h};at(t,{x:r,y:l,w:s,h:c,angle:h},(()=>{kt(t,f,{viewScaleInfo:i,renderContent:()=>{At(t,f,{originElem:e,calcElemSize:{x:r,y:l,w:s,h:c,angle:h},viewScaleInfo:i,viewSizeInfo:o,parentOpacity:a,renderContent:()=>{}})}})}))}function Ot(t,e,n){const i=n.loader.getContent(e),{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:r}=n,{x:l,y:s,w:c,h:h,angle:f}=pt(e,{viewScaleInfo:o})||e,u={...e,x:l,y:s,w:c,h:h,angle:f};at(t,{x:l,y:s,w:c,h:h,angle:f},(()=>{kt(t,u,{viewScaleInfo:o,renderContent:()=>{At(t,u,{originElem:e,calcElemSize:{x:l,y:s,w:c,h:h,angle:f},viewScaleInfo:o,viewSizeInfo:a,parentOpacity:r,renderContent:()=>{if(i||n.loader.isDestroyed()||n.loader.load(e,n.elementAssets||{}),"image"===e.type&&i){t.globalAlpha=zt(e)*r;const{x:n,y:a,w:l,h:s,radiusList:c}=St(u,{viewScaleInfo:o}),{detail:h}=e,{scaleMode:f,originW:d=0,originH:g=0}=h,p=t.$undoPixelRatio(d),y=t.$undoPixelRatio(g);if(t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(n+c[0],a),t.arcTo(n+l,a,n+l,a+s,c[1]),t.arcTo(n+l,a+s,n,a+s,c[2]),t.arcTo(n,a+s,n,a,c[3]),t.arcTo(n,a,n+l,a,c[0]),t.closePath(),t.fill("nonzero"),t.clip("nonzero"),f&&g&&d){let o=0,r=0,c=p,h=y;const u=n,d=a,g=l,w=s;if(p>e.w||y>e.h)if("fill"===f){const t=Math.max(e.w/p,e.h/y),n=y*t;o=(p*t-e.w)/2/t,r=(n-e.h)/2/t,c=e.w/t,h=e.h/t}else if("tile"===f)o=0,r=0,c=e.w,h=e.h;else if("fit"===f){const t=Math.min(e.w/p,e.h/y);o=(p-e.w/t)/2,r=(y-e.h/t)/2,c=e.w/t,h=e.h/t}t.drawImage(i,o,r,c,h,u,d,g,w)}else t.drawImage(i,n,a,l,s);t.globalAlpha=r,t.restore()}}})}})}))}function Wt(t,e,n){const i=n.loader.getContent(e),{viewScaleInfo:o,parentOpacity:a}=n,{x:r,y:l,w:s,h:c,angle:h}=pt(e,{viewScaleInfo:o})||e;at(t,{x:r,y:l,w:s,h:c,angle:h},(()=>{i||n.loader.isDestroyed()||n.loader.load(e,n.elementAssets||{}),"svg"===e.type&&i&&(t.globalAlpha=zt(e)*a,t.drawImage(i,r,l,s,c),t.globalAlpha=a)}))}function $t(t,e,n){const i=n.loader.getContent(e),{viewScaleInfo:o,parentOpacity:a}=n,{x:r,y:l,w:s,h:c,angle:h}=pt(e,{viewScaleInfo:o})||e;at(t,{x:r,y:l,w:s,h:c,angle:h},(()=>{i||n.loader.isDestroyed()||n.loader.load(e,n.elementAssets||{}),"html"===e.type&&i&&(t.globalAlpha=zt(e)*a,t.drawImage(i,r,l,s,c),t.globalAlpha=a)}))}const Ft={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function Dt(t,e,n){const{viewScaleInfo:i,viewSizeInfo:o,parentOpacity:a,calculator:r}=n,{x:l,y:s,w:c,h:h,angle:f}=pt(e,{viewScaleInfo:i})||e,u={...e,x:l,y:s,w:c,h:h,angle:f};at(t,{x:l,y:s,w:c,h:h,angle:f},(()=>{var d,g;kt(t,u,{viewScaleInfo:i,renderContent:()=>{At(t,u,{originElem:e,calcElemSize:{x:l,y:s,w:c,h:h,angle:f},viewScaleInfo:i,viewSizeInfo:o,parentOpacity:a})}});{const o={...Ft,...e.detail},a=(o.fontSize||Ft.fontSize)*i.scale;if(a<2)return;const{parentOpacity:c}=n,h=zt(e)*c;t.globalAlpha=h,t.fillStyle=e.detail.color||Ft.color,t.textBaseline="top",t.$setFont({fontWeight:o.fontWeight,fontSize:a,fontFamily:Mt(o.fontFamily)});{const n=r.getVirtualFlatItem(e.uuid);Array.isArray(null==n?void 0:n.textLines)&&(null==(d=null==n?void 0:n.textLines)?void 0:d.length)>0&&(void 0!==o.textShadowColor&&z(o.textShadowColor)&&(t.shadowColor=o.textShadowColor),void 0!==o.textShadowOffsetX&&U.number(o.textShadowOffsetX)&&(t.shadowOffsetX=o.textShadowOffsetX),void 0!==o.textShadowOffsetY&&U.number(o.textShadowOffsetY)&&(t.shadowOffsetY=o.textShadowOffsetY),void 0!==o.textShadowBlur&&U.number(o.textShadowBlur)&&(t.shadowBlur=o.textShadowBlur),null==(g=null==n?void 0:n.textLines)||g.forEach((e=>{t.fillText(e.text,l+e.x*i.scale,s+e.y*i.scale)})))}t.globalAlpha=c}}))}function Bt(t,e,n){var i,o,a;if(!0===(null==(i=null==e?void 0:e.operations)?void 0:i.invisible))return;const{w:r,h:l}=e,{scale:s}=n.viewScaleInfo;if(s<1&&(r*s<.4||l*s<.4)||0===n.parentOpacity)return;const{overrideElementMap:c}=n;if(!(null==(a=null==(o=null==c?void 0:c[e.uuid])?void 0:o.operations)?void 0:a.invisible))try{switch(e.type){case"rect":Et(t,e,n);break;case"circle":Lt(t,e,n);break;case"text":Dt(t,e,n);break;case"image":Ot(t,e,n);break;case"svg":Wt(t,e,n);break;case"html":$t(t,e,n);break;case"path":!function(t,e,n){var i,o;const{detail:a}=e,{originX:r,originY:l,originW:s,originH:c,fillRule:h}=a,{viewScaleInfo:f,viewSizeInfo:u,parentOpacity:d}=n,{x:g,y:p,w:y,h:w,angle:m}=pt(e,{viewScaleInfo:f})||e,v=y/s,x=w/c,b=g-r*v,S=p-l*x,{clipPath:I,clipPathStrokeColor:M,clipPathStrokeWidth:P,...C}=e.detail,z=f.scale*u.devicePixelRatio,A={...e,x:g,y:p,w:y,h:w,angle:m};let R={...A};R.detail=C;let T={...e};T.detail=C,a.fill&&"string"!==a.fill&&(null==(o=null==(i=a.fill)?void 0:i.type)?void 0:o.includes("gradient"))&&(R={...A,detail:{...A.detail,background:a.fill,clipPath:{commands:a.commands,originX:r,originY:l,originW:s,originH:c}}},T.detail={...R.detail}),at(t,{x:g,y:p,w:y,h:w,angle:m},(()=>{At(t,R,{originElem:T,calcElemSize:{x:g,y:p,w:y,h:w,angle:m},viewScaleInfo:f,viewSizeInfo:u,parentOpacity:d,renderContent:()=>{kt(t,A,{viewScaleInfo:f,renderContent:()=>{t.save(),t.translate(b,S),t.scale(z*v/f.scale,z*x/f.scale);const e=xt(a.commands||[]),n=new Path2D(e);a.fill&&("string"==typeof a.fill?t.fillStyle=a.fill:t.fillStyle="transparent"),a.fill&&t.fill(n,h||"nonzero"),a.stroke&&0!==a.strokeWidth&&(t.strokeStyle=a.stroke,t.lineWidth=(a.strokeWidth||1)/u.devicePixelRatio,t.lineCap=a.strokeLineCap||"square",t.stroke(n)),t.translate(-b,-S),t.restore()}})}})}))}(t,e,n);break;case"group":{const i={...n.elementAssets||{},...e.detail.assets||{}};Vt(t,e,{...n,elementAssets:i});break}}}catch(t){console.error(t)}}function Vt(t,e,n){const{viewScaleInfo:i,viewSizeInfo:o,parentOpacity:a}=n,{x:r,y:l,w:s,h:c,angle:h}=pt({x:e.x,y:e.y,w:e.w,h:e.h,angle:e.angle},{viewScaleInfo:i})||e,f={...e,x:r,y:l,w:s,h:c,angle:h};at(t,{x:r,y:l,w:s,h:c,angle:h},(()=>{t.globalAlpha=zt(e)*a,kt(t,f,{viewScaleInfo:i,renderContent:()=>{At(t,f,{originElem:e,calcElemSize:{x:r,y:l,w:s,h:c,angle:h},viewScaleInfo:i,viewSizeInfo:o,parentOpacity:a,renderContent:()=>{const{x:o,y:r,w:l,h:s,radiusList:c}=St(f,{viewScaleInfo:i});if("hidden"===e.detail.overflow&&(t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(o+c[0],r),t.arcTo(o+l,r,o+l,r+s,c[1]),t.arcTo(o+l,r+s,o,r+s,c[2]),t.arcTo(o,r+s,o,r,c[3]),t.arcTo(o,r,o+l,r,c[0]),t.closePath(),t.fill("nonzero"),t.clip("nonzero")),Array.isArray(e.detail.children)){const{parentElementSize:i}=n,o={x:i.x+e.x,y:i.y+e.y,w:e.w||i.w,h:e.h||i.h,angle:e.angle},{calculator:r}=n;for(let i=0;i<e.detail.children.length;i++){let l=e.detail.children[i];if(l={...l,x:o.x+l.x,y:o.y+l.y},!0===n.forceDrawAll||(null==r?void 0:r.needRender(l)))try{Bt(t,l,{...n,parentOpacity:a*zt(e)})}catch(t){console.error(t)}}}"hidden"===e.detail.overflow&&t.restore()}})}}),t.globalAlpha=a}))}const jt={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function Xt(t,e,n){var i;const{elements:o=[]}=e,{parentOpacity:a}=n;for(let e=0;e<o.length;e++){const r=o[e],l={...r,detail:{...jt,...null==r?void 0:r.detail}};if(!0===n.forceDrawAll||(null==(i=n.calculator)?void 0:i.needRender(l)))try{Bt(t,l,{...n,parentOpacity:a})}catch(t){console.error(t)}}}function Yt(t,e,n,i){const{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:r}=n,l={uuid:"layout",type:"group",...e},{x:s,y:c,w:h,h:f}=pt(l,{viewScaleInfo:o})||l,u={...l,x:s,y:c,w:h,h:f,angle:0};if(t.globalAlpha=1,kt(t,u,{viewScaleInfo:o,renderContent:()=>{Rt(t,u,{viewScaleInfo:o,viewSizeInfo:a})}}),"hidden"===e.detail.overflow){const{viewScaleInfo:i,viewSizeInfo:o}=n,a={uuid:"layout",type:"group",...e},r=pt(a,{viewScaleInfo:i})||a,l={...a,...r},{x:s,y:c,w:h,h:f,radiusList:u}=St(l,{viewScaleInfo:i});t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(s+u[0],c),t.arcTo(s+h,c,s+h,c+f,u[1]),t.arcTo(s+h,c+f,s,c+f,u[2]),t.arcTo(s,c+f,s,c,u[3]),t.arcTo(s,c,s+h,c,u[0]),t.closePath(),t.fill("nonzero"),t.clip("nonzero")}i(t),"hidden"===e.detail.overflow&&t.restore(),Tt(t,u,{viewScaleInfo:o}),t.globalAlpha=r}function Ht(t,e,n){if("string"==typeof(null==e?void 0:e.background)){const{viewSizeInfo:i}=n,{width:o,height:a}=i;t.globalAlpha=1,t.fillStyle=e.background,t.fillRect(0,0,o,a)}}const Ut=["image","svg","html"],Nt=t=>{var e,n,i;let o=null;return"image"===t.type?o=(null==(e=null==t?void 0:t.detail)?void 0:e.src)||null:"svg"===t.type?o=(null==(n=null==t?void 0:t.detail)?void 0:n.svg)||null:"html"===t.type&&(o=(null==(i=null==t?void 0:t.detail)?void 0:i.html)||null),"string"==typeof o&&o?L(o)?o:k(o,t.uuid):k(`${R()}-${t.uuid}-${R()}-${R()}`,t.uuid)};class Qt extends G{constructor(){super(),M(this,a),M(this,e,{}),M(this,n,{}),M(this,i,{}),M(this,o,!1),C(this,a,r).call(this,"image",(async(t,e)=>{var n;const i=(null==(n=e[t.detail.src])?void 0:n.value)||t.detail.src,o=await D(i);return{uuid:t.uuid,lastModified:Date.now(),content:o}})),C(this,a,r).call(this,"html",(async(t,e)=>{var n;const i=(null==(n=e[t.detail.html])?void 0:n.value)||t.detail.html,o=await V(i,{width:t.detail.originW||t.w,height:t.detail.originH||t.h});return{uuid:t.uuid,lastModified:Date.now(),content:o}})),C(this,a,r).call(this,"svg",(async(t,e)=>{var n;const i=(null==(n=e[t.detail.svg])?void 0:n.value)||t.detail.svg,o=await B(i);return{uuid:t.uuid,lastModified:Date.now(),content:o}}))}isDestroyed(){return I(this,o)}reset(){!0!==I(this,o)&&(P(this,n,{}),P(this,i,{}))}resetElementAsset(t){var e,o,a;if(Ut.includes(t.type)){let r=null,l=null;"image"===t.type&&"string"==typeof(null==(e=null==t?void 0:t.detail)?void 0:e.src)?l=t.detail.src:"svg"===t.type&&"string"==typeof(null==(o=null==t?void 0:t.detail)?void 0:o.svg)?l=t.detail.svg:"html"===t.type&&"string"==typeof(null==(a=null==t?void 0:t.detail)?void 0:a.html)&&(l=t.detail.html),"string"==typeof l&&(this.load(t,{}),L(l)?r=l:t.uuid&&(r=k(l,t.uuid))),r&&L(r)&&(delete I(this,i)[r],delete I(this,n)[r])}}destroy(){P(this,o,!0),this.clear(),P(this,e,null),P(this,n,null),P(this,i,null)}load(t,e){!0!==I(this,o)&&(C(this,a,u).call(this,t)||Ut.includes(t.type)&&C(this,a,f).call(this,t,e))}getContent(t){var e,n;const o=Nt(t);return(null==(n=null==(e=I(this,i))?void 0:e[o])?void 0:n.content)||null}getLoadItemMap(){return I(this,i)}setLoadItemMap(t){P(this,i,t)}}e=new WeakMap,n=new WeakMap,i=new WeakMap,o=new WeakMap,a=new WeakSet,r=function(t,n){I(this,e)[t]=n},l=function(t){var e,n,i;let o=null;return"image"===t.type?o=(null==(e=null==t?void 0:t.detail)?void 0:e.src)||null:"svg"===t.type?o=(null==(n=null==t?void 0:t.detail)?void 0:n.svg)||null:"html"===t.type&&(o=(null==(i=null==t?void 0:t.detail)?void 0:i.html)||null),o},s=function(t){return{element:t,status:"null",content:null,error:null,startTime:-1,endTime:-1,source:C(this,a,l).call(this,t)}},c=function(t){const e=Nt(t.element),n=I(this,i)[e];I(this,o)||(n?n.startTime<t.startTime&&(I(this,i)[e]=t,this.trigger("load",{...t,countTime:t.endTime-t.startTime})):(I(this,i)[e]=t,this.trigger("load",{...t,countTime:t.endTime-t.startTime})))},h=function(t){var e;const n=Nt(t.element),a=null==(e=I(this,i))?void 0:e[n];I(this,o)||(a?a.startTime<t.startTime&&(I(this,i)[n]=t,this.trigger("error",{...t,countTime:t.endTime-t.startTime})):(I(this,i)[n]=t,this.trigger("error",{...t,countTime:t.endTime-t.startTime})))},f=function(t,i){const r=C(this,a,s).call(this,t),l=Nt(t);if(I(this,n)[l])return;I(this,n)[l]=r;const f=I(this,e)[t.type];"function"!=typeof f||I(this,o)||(r.startTime=Date.now(),f(t,i).then((t=>{I(this,o)||(r.content=t.content,r.endTime=Date.now(),r.status="load",C(this,a,c).call(this,r))})).catch((e=>{console.warn(`Load element source "${r.source}" fail`,e,t),r.endTime=Date.now(),r.status="error",r.error=e,C(this,a,h).call(this,r)})))},u=function(t){var e;const i=Nt(t),o=null==(e=I(this,n))?void 0:e[i];return!(!o||"error"!==o.status||!o.source||o.source!==C(this,a,l).call(this,t))};const Gt={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function qt(t,e){const{w:n,h:i}=t,o=e.tempContext,a=[],r={...Gt,...t.detail},l=r.fontSize||Gt.fontSize,s=l;if(s<2)return{};const c=r.lineHeight||l;o.textBaseline="top",o.$setFont({fontWeight:r.fontWeight,fontSize:s,fontFamily:Mt(r.fontFamily)});let h=r.text.replace(/\r\n/gi,"\n");"lowercase"===r.textTransform?h=h.toLowerCase():"uppercase"===r.textTransform&&(h=h.toUpperCase());const f=c,u=h.split("\n");let d=0;u.forEach(((t,e)=>{if("maxContent"===r.minInlineSize)a.push({x:0,y:0,text:t,width:o.$undoPixelRatio(o.measureText(t).width)});else{let c="",h="",g=t.split(h);if("normal"===r.wordBreak){h=" ";const e=t.split(h);g=[],e.forEach(((t,n)=>{g.push(t),n<e.length-1&&g.push(h)}))}if(1===g.length&&"visible"===r.overflow)a.push({x:0,y:0,text:g[0],width:o.$undoPixelRatio(o.measureText(g[0]).width)});else if(g.length>0){for(let t=0;t<g.length&&(l=o.$doPixelRatio(n),s=o.measureText(c+g[t]).width,l>=s?c+=g[t]||"":(a.push({x:0,y:0,text:c,width:o.$undoPixelRatio(o.measureText(c).width)}),c=g[t]||"",d++),!((d+1)*f>i&&"hidden"===r.overflow));t++)if(g.length-1===t&&(d+1)*f<=i){a.push({x:0,y:0,text:c,width:o.$undoPixelRatio(o.measureText(c).width)}),e<u.length-1&&d++;break}}else a.push({x:0,y:0,text:"",width:0})}var l,s}));let g=0,p=0;f>s&&(p=(f-s)/2),a.length*f<i&&("top"===r.verticalAlign?g=0:"bottom"===r.verticalAlign?g+=i-a.length*f:g+=(i-a.length*f)/2);{const t=0+g;a.forEach(((e,i)=>{let o=0;"center"===r.textAlign?o=0+(n-e.width)/2:"right"===r.textAlign&&(o=n-e.width+0),a[i].x=o,a[i].y=t+f*i+p}))}return{textLines:a}}function Jt(t,e){let n={};return"text"===t.type&&(n=qt(t,e)),n}function Kt(t,e){const{viewScaleInfo:n,viewSizeInfo:i,tempContext:o}=e,a=function(t,e){const n={},i=[],o=a=>{const r={type:a.type,isVisibleInView:!0,position:[...i]};let l=null;l=mt(a,{groupQueue:ft(t,i)||[]});const s={...r,originRectInfo:l,rangeRectInfo:U.angle(a.angle)?vt(l):l,...Jt(a,e)};n[a.uuid]=s,"group"===a.type&&a.detail.children.forEach(((t,e)=>{i.push(e),o(t),i.pop()}))};return t.forEach(((t,e)=>{i.push(e),o(t),i.pop()})),n}(t,{tempContext:o});return Zt(a,{viewScaleInfo:n,viewSizeInfo:i})}function Zt(t,e){const n=function(t){const{viewScaleInfo:e,viewSizeInfo:n}=t,{scale:i,offsetTop:o,offsetLeft:a}=e,{width:r,height:l}=n,s=0-a/i,c=0-o/i,h=r/i,f=l/i,u=rt({x:s,y:c,w:h,h:f}),d={x:s,y:c},g={x:s+h,y:c},p={x:s,y:c+f},y={x:s+h,y:c+f},w={x:s,y:u.y},m={x:u.x,y:c},v={x:s+h,y:u.y},x={x:u.x,y:c+f};return{center:u,topLeft:d,topRight:g,bottomLeft:p,bottomRight:y,left:w,top:m,right:v,bottom:x}}(e);let i=0,o=0;return Object.keys(t).forEach((e=>{const a=t[e];a.isVisibleInView=function(t,e){const n=Math.min(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),i=Math.max(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),o=Math.min(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y),a=Math.max(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y),r=Math.min(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),l=Math.max(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),s=Math.min(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y),c=Math.max(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y);return n<=l&&i>=r&&o<=c&&a>=s||l<=a&&l>=a&&l<=a&&l>=a}(a.rangeRectInfo,n),a.isVisibleInView?i++:o++})),{virtualFlatItemMap:t,visibleCount:i,invisibleCount:o}}class _t{constructor(t){M(this,d),M(this,g),P(this,d,t),P(this,g,new it({defaultStorage:{virtualFlatItemMap:{},visibleCount:0,invisibleCount:0}}))}toGridNum(t,e){return!0===(null==e?void 0:e.ignore)?t:Math.round(t)}destroy(){P(this,d,null)}needRender(t){const e=I(this,g).get("virtualFlatItemMap")[t.uuid];return!e||e.isVisibleInView}getPointElement(t,e){return function(t,e){var n,i,o;const{context2d:a,data:r,viewScaleInfo:l,groupQueue:s}=e,c={index:-1,element:null,groupQueueIndex:-1};if(s&&Array.isArray(s)&&(null==s?void 0:s.length)>0)for(let e=s.length-1;e>=0;e--){let o=0,r=0,h=0;for(let t=0;t<=e;t++)o+=s[t].x,r+=s[t].y,h+=s[t].angle||0;const f=s[e];if(f&&"group"===f.type&&Array.isArray(null===(n=f.detail)||void 0===n?void 0:n.children))for(let n=0;n<f.detail.children.length;n++){const u=f.detail.children[n];if(!0!==(null===(i=null==u?void 0:u.operations)||void 0===i?void 0:i.invisible)){if(!u)break;if(wt(t,{context2d:a,element:{x:o+u.x,y:r+u.y,w:u.w,h:u.h,angle:h+(u.angle||0)},viewScaleInfo:l})){c.element=u,(e<s.length-1||"group"!==u.type)&&(c.groupQueueIndex=e);break}}}if(c.element)break}if(c.element)return c;for(let e=r.elements.length-1;e>=0;e--){const n=r.elements[e];if(!0!==(null===(o=null==n?void 0:n.operations)||void 0===o?void 0:o.invisible)&&wt(t,{context2d:a,element:n,viewScaleInfo:l})){c.index=e,c.element=n;break}}return c}(t,{...e,context2d:I(this,d).tempContext})}resetVirtualFlatItemMap(t,e){if(t){const{virtualFlatItemMap:n,invisibleCount:i,visibleCount:o}=Kt(t.elements,{...e,tempContext:I(this,d).tempContext});I(this,g).set("virtualFlatItemMap",n),I(this,g).set("invisibleCount",i),I(this,g).set("visibleCount",o)}}updateVisiableStatus(t){const{virtualFlatItemMap:e,invisibleCount:n,visibleCount:i}=Zt(I(this,g).get("virtualFlatItemMap"),t);I(this,g).set("virtualFlatItemMap",e),I(this,g).set("invisibleCount",n),I(this,g).set("visibleCount",i)}calcViewRectInfoFromOrigin(t,e){const n=I(this,g).get("virtualFlatItemMap")[t];if(!(null==n?void 0:n.originRectInfo))return null;const{checkVisible:i,viewScaleInfo:o,viewSizeInfo:a}=e,{center:r,left:l,right:s,bottom:c,top:h,topLeft:f,topRight:u,bottomLeft:d,bottomRight:p}=n.originRectInfo;if(!0===i&&!1===n.isVisibleInView)return null;const y={viewScaleInfo:o};return{center:yt(r,y),left:yt(l,y),right:yt(s,y),bottom:yt(c,y),top:yt(h,y),topLeft:yt(f,y),topRight:yt(u,y),bottomLeft:yt(d,y),bottomRight:yt(p,y)}}calcViewRectInfoFromRange(t,e){const n=I(this,g).get("virtualFlatItemMap")[t];if(!(null==n?void 0:n.originRectInfo))return null;const{checkVisible:i,viewScaleInfo:o,viewSizeInfo:a}=e,{center:r,left:l,right:s,bottom:c,top:h,topLeft:f,topRight:u,bottomLeft:d,bottomRight:p}=n.rangeRectInfo;if(!0===i&&!1===n.isVisibleInView)return null;const y={viewScaleInfo:o};return{center:yt(r,y),left:yt(l,y),right:yt(s,y),bottom:yt(c,y),top:yt(h,y),topLeft:yt(f,y),topRight:yt(u,y),bottomLeft:yt(d,y),bottomRight:yt(p,y)}}modifyText(t){const e=I(this,g).get("virtualFlatItemMap"),n=e[t.uuid];if(t&&"text"===t.type){const i={...n,...qt(t,{tempContext:I(this,d).tempContext})};e[t.uuid]=i,I(this,g).set("virtualFlatItemMap",e)}}modifyVirtualFlatItemMap(t,e){const{modifyInfo:n,viewScaleInfo:i,viewSizeInfo:o}=e,{type:a,content:r}=n,l=t.elements,s=I(this,g).get("virtualFlatItemMap");if("deleteElement"===a){const{element:t}=r,e=[],n=t=>{e.push(t.uuid),"group"===t.type&&Array.isArray(t.detail.children)&&t.detail.children.forEach((t=>{n(t)}))};n(t),e.forEach((t=>{delete s[t]})),I(this,g).set("virtualFlatItemMap",s)}else if("addElement"===a||"updateElement"===a){const{position:e}=r,n=function(t,e){let n=null,i=e;for(let e=0;e<t.length;e++){const o=i[t[e]];if(e<t.length-1&&"group"===(null==o?void 0:o.type))i=o.detail.children;else{if(e!==t.length-1)break;n=o}}return n}(e,t.elements),c=ft(l,e);if(n)if("updateElement"===a&&"group"===n.type)this.resetVirtualFlatItemMap(t,{viewScaleInfo:i,viewSizeInfo:o});else{const t=mt(n,{groupQueue:c||[]}),r={type:n.type,originRectInfo:t,rangeRectInfo:U.angle(n.angle)?vt(t):t,isVisibleInView:!0,position:[...e],...Jt(n,{tempContext:I(this,d).tempContext})};s[n.uuid]=r,I(this,g).set("virtualFlatItemMap",s),"updateElement"===a&&this.updateVisiableStatus({viewScaleInfo:i,viewSizeInfo:o})}}else"moveElement"===a&&this.resetVirtualFlatItemMap(t,{viewScaleInfo:i,viewSizeInfo:o})}getVirtualFlatItem(t){return I(this,g).get("virtualFlatItemMap")[t]||null}}d=new WeakMap,g=new WeakMap;return p=new WeakMap,y=new WeakMap,w=new WeakMap,m=new WeakMap,v=new WeakSet,x=function(){const t=I(this,y);t.on("load",(t=>{this.trigger("load",t)})),t.on("error",(t=>{console.error(t)}))},t.Calculator=_t,t.Renderer=class extends G{constructor(t){super(),M(this,v),M(this,p),M(this,y,new Qt),M(this,w),M(this,m,!1),P(this,p,t),P(this,w,new _t({tempContext:t.tempContext})),C(this,v,x).call(this)}isDestroyed(){return I(this,m)}destroy(){this.clear(),P(this,p,null),I(this,y).destroy(),P(this,y,null),P(this,m,!0)}updateOptions(t){P(this,p,t)}drawData(t,e){const n=I(this,y),i=I(this,w),{sharer:o}=I(this,p),a=I(this,p).viewContext;a.clearRect(0,0,a.canvas.width,a.canvas.height);const r={x:0,y:0,w:e.viewSizeInfo.width,h:e.viewSizeInfo.height};!0===e.forceDrawAll&&I(this,w).resetVirtualFlatItemMap(t,{viewScaleInfo:e.viewScaleInfo,viewSizeInfo:e.viewSizeInfo});const l={loader:n,calculator:i,parentElementSize:r,elementAssets:t.assets,parentOpacity:1,overrideElementMap:null==o?void 0:o.getActiveOverrideElemenentMap(),...e};Ht(a,t.global,l),t.layout?Yt(a,t.layout,l,(()=>{Xt(a,t,l)})):Xt(a,t,l)}scale(t){const{sharer:e}=I(this,p);if(!e)return;const{data:n,offsetTop:i,offsetBottom:o,offsetLeft:a,offsetRight:r,width:l,height:s,contextHeight:c,contextWidth:h,devicePixelRatio:f}=e.getActiveStoreSnapshot();n&&this.drawData(n,{viewScaleInfo:{scale:t,offsetTop:i,offsetBottom:o,offsetLeft:a,offsetRight:r},viewSizeInfo:{width:l,height:s,contextHeight:c,contextWidth:h,devicePixelRatio:f}})}setLoadItemMap(t){I(this,y).setLoadItemMap(t)}getLoadItemMap(){return I(this,y).getLoadItemMap()}getLoader(){return I(this,y)}getCalculator(){return I(this,w)}},t.drawCircle=Lt,t.drawElement=Bt,t.drawElementList=Xt,t.drawGlobalBackground=Ht,t.drawGroup=Vt,t.drawHTML=$t,t.drawImage=Ot,t.drawLayout=Yt,t.drawRect=Et,t.drawSVG=Wt,t.drawText=Dt,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t}({});
|
|
1
|
+
var iDrawRenderer=function(t){"use strict";var e,n,i,o,a,r,l,s,c,h,u,f,d,g,p,y,w,v,m,x,b=t=>{throw TypeError(t)},S=(t,e,n)=>e.has(t)||b("Cannot "+n),I=(t,e,n)=>(S(t,e,"read from private field"),n?n.call(t):e.get(t)),M=(t,e,n)=>e.has(t)?b("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),P=(t,e,n,i)=>(S(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),C=(t,e,n)=>(S(t,e,"access private method"),n);function A(t){return"string"==typeof t&&(/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)||/^[a-z]{1,}$/i.test(t))}function z(t,e){if(1===e)return t;let n=1;const i=/^#[0-9a-f]{6,6}$/i;let o=t;if(i.test(t)?n=parseInt(t.substring(5,7).replace(/^#/,"0x")):/^#[0-9a-f]{8,8}$/i.test(t)&&(n=parseInt(t.substring(7,9).replace(/^#/,"0x")),o=t.substring(0,7)),n*=e,i.test(o)&&n>0&&n<1){const t=Math.max(0,Math.min(255,Math.ceil(256*n)));o=`${o.toUpperCase()}${t.toString(16).toUpperCase()}`}return o}function R(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return`${t()}${t()}-${t()}-${t()}-${t()}-${t()}${t()}${t()}`}function T(t,e){let n=0;for(let e=0;e<t.length;e++)n+=t.charCodeAt(e);return(n+e).toString(16).substring(0,4)}function k(t,e){const n=t.length,i=function(t){let e=0;for(let n=0;n<t.length;n++)e+=t.charCodeAt(n);return e}(e),o=Math.floor(n/2),a=t.substring(0,4).padStart(4,"0"),r=t.substring(0,4).padStart(4,"0");return`@assets/${T(n.toString(16).padStart(4,a),i).padStart(4,"0")}${T(t.substring(o-4,o).padStart(4,a),i).padStart(4,"0")}-${T(t.substring(o-8,o-4).padStart(4,a),i).padStart(4,"0")}-${T(t.substring(o-12,o-8).padStart(4,a),i).padStart(4,"0")}-${T(t.substring(o-16,o-12).padStart(4,r),i).padStart(4,"0")}-${T(t.substring(o,o+4).padStart(4,r),i).padStart(4,"0")}${T(t.substring(o+4,o+8).padStart(4,r),i).padStart(4,"0")}${T(r.padStart(4,a).padStart(4,r),i)}`}function L(t){return/^@assets\/[0-9a-z-]{0,}$/.test(`${t}`)}function E(t){return function t(e){const n=function(t){return Object.prototype.toString.call(t).replace(/[\]|\[]{1,1}/gi,"").split(" ")[1]}(e);if(["Null","Number","String","Boolean","Undefined"].indexOf(n)>=0)return e;if("Array"===n){const n=[];return e.forEach((e=>{n.push(t(e))})),n}if("Object"===n){const n={};Object.keys(e).forEach((i=>{n[i]=t(e[i])}));return Object.getOwnPropertySymbols(e).forEach((i=>{n[i]=t(e[i])})),n}}(t)}function O(t){return(Object.prototype.toString.call(t)||"").replace(/(\[object|\])/gi,"").trim()}const W={type(t,e){const n=O(t);return!0===e?n.toLocaleLowerCase():n},array:t=>"Array"===O(t),json:t=>"Object"===O(t),function:t=>"Function"===O(t),asyncFunction:t=>"AsyncFunction"===O(t),boolean:t=>"Boolean"===O(t),string:t=>"String"===O(t),number:t=>"Number"===O(t),undefined:t=>"Undefined"===O(t),null:t=>"Null"===O(t),promise:t=>"Promise"===O(t)};var $=function(t,e,n,i){return new(n||(n=Promise))((function(o,a){function r(t){try{s(i.next(t))}catch(t){a(t)}}function l(t){try{s(i.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,l)}s((i=i.apply(t,e||[])).next())}))};const{Image:F}=window;function D(t){return new Promise(((e,n)=>{const i=new F;i.crossOrigin="anonymous",i.onload=function(){e(i)},i.onabort=n,i.onerror=n,i.src=t}))}function B(t){return $(this,void 0,void 0,(function*(){const e=yield function(t){return new Promise(((e,n)=>{const i=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),o=new FileReader;o.readAsDataURL(i),o.onload=function(t){var n;const i=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(i)},o.onerror=function(t){n(t)}}))}(t);return yield D(e)}))}function V(t,e){return $(this,void 0,void 0,(function*(){t=t.replace(/\&/gi,"&");const n=yield function(t,e){const{width:n,height:i}=e;return new Promise(((e,o)=>{const a=new Blob([`\n <svg \n xmlns="http://www.w3.org/2000/svg" \n width="${n||""}" \n height = "${i||""}">\n <foreignObject width="100%" height="100%">\n <div xmlns = "http://www.w3.org/1999/xhtml">\n ${t}\n </div>\n </foreignObject>\n </svg>\n `],{type:"image/svg+xml;charset=utf-8"}),r=new FileReader;r.readAsDataURL(a),r.onload=function(t){var n;const i=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(i)},r.onerror=function(t){o(t)}}))}(t,e);return yield D(n)}))}function j(t){return"number"==typeof t&&t>=0}function X(t){return"number"==typeof t&&(t>0||t<=0)}function Y(t){return X(t)}function H(t){return X(t)}function U(t){return j(t)}function N(t){return j(t)}function Q(t){return"string"==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(`${t}`)}function G(t){return"string"==typeof t&&/^(data:image\/)/.test(`${t}`)}function q(t){return["rect","circle","text","image","svg","html","group"].includes(t)}const J={positiveNum:j,data:function(t){return!!(Array(null==t?void 0:t.elements)&&(null==t?void 0:t.elements.length)>=0)},element:function(t){return!!t&&(q(null==t?void 0:t.type)&&Y(null==t?void 0:t.x)&&H(null==t?void 0:t.y)&&U(null==t?void 0:t.w)&&N(null==t?void 0:t.h))},layout:function(t){return!!t&&(Y(null==t?void 0:t.x)&&H(null==t?void 0:t.y)&&U(null==t?void 0:t.w)&&N(null==t?void 0:t.h))},type:q,x:Y,y:H,w:U,h:N,angle:function(t){return"number"==typeof t&&t>=-360&&t<=360},number:X,numberStr:function(t){return/^(-?\d+(?:\.\d+)?)$/.test(`${t}`)},borderWidth:function(t){return j(t)||Array.isArray(t)&&j(t[0])&&j(t[1])&&j(t[2])&&j(t[3])},borderRadius:function(t){return j(t)||Array.isArray(t)&&j(t[0])&&j(t[1])&&j(t[2])&&j(t[3])},color:function(t){return A(t)},imageSrc:function(t){return G(t)||Q(t)},imageURL:Q,imageBase64:G,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 X(t)&&t>0},lineHeight:function(t){return X(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 X(t)&&t>0}};var K,Z=function(t,e,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(t):i?i.value:e.get(t)};class _{constructor(){K.set(this,void 0),function(t,e,n,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===i?o.call(t,n):o?o.value=n:e.set(t,n)}(this,K,new Map,"f")}on(t,e){if(Z(this,K,"f").has(t)){const n=Z(this,K,"f").get(t)||[];null==n||n.push(e),Z(this,K,"f").set(t,n)}else Z(this,K,"f").set(t,[e])}off(t,e){if(Z(this,K,"f").has(t)){const n=Z(this,K,"f").get(t);if(Array.isArray(n))for(let t=0;t<(null==n?void 0:n.length);t++)if(n[t]===e){n.splice(t,1);break}Z(this,K,"f").set(t,n||[])}}trigger(t,e){const n=Z(this,K,"f").get(t);return!!Array.isArray(n)&&(n.forEach((t=>{t(e)})),!0)}has(t){if(Z(this,K,"f").has(t)){const e=Z(this,K,"f").get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1}destroy(){this.clear()}clear(){Z(this,K,"f").clear()}}function tt(t,e){return{x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}}K=new WeakMap;var et,nt,it,ot,at,rt=function(t,e,n,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?o.call(t,n):o?o.value=n:e.set(t,n),n},lt=function(t,e,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(t):i?i.value:e.get(t)};class st{constructor(t){et.add(this),nt.set(this,void 0),it.set(this,void 0),ot.set(this,void 0),rt(this,it,E(t.defaultStorage),"f"),rt(this,nt,lt(this,et,"m",at).call(this),"f"),rt(this,ot,t.defaultStatic||{},"f")}set(t,e){lt(this,nt,"f")[t]=e}get(t){return lt(this,nt,"f")[t]}setStatic(t,e){lt(this,ot,"f")[t]=e}getStatic(t){return lt(this,ot,"f")[t]}getSnapshot(t){return!0===(null==t?void 0:t.deepClone)?E(lt(this,nt,"f")):Object.assign({},lt(this,nt,"f"))}clear(){rt(this,nt,lt(this,et,"m",at).call(this),"f")}destroy(){rt(this,nt,null,"f"),rt(this,ot,null,"f")}}function ct(t){return t/180*Math.PI}function ht(t,e,n){const i=ut(e);!function(t,e,n,i){const o=ct(e||0);n&&(o>0||o<0)&&(t.translate(n.x,n.y),t.rotate(o),t.translate(-n.x,-n.y)),i(t),n&&(o>0||o<0)&&(t.translate(n.x,n.y),t.rotate(-o),t.translate(-n.x,-n.y))}(t,e.angle||0,i,(()=>{n(t)}))}function ut(t){return{x:t.x+t.w/2,y:t.y+t.h/2}}function ft(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 ut({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 dt(t,e,n){const i=function(t,e){const n=e.x-t.x,i=e.y-t.y;if(0===n){if(i<0)return 0;if(i>0)return Math.PI}else if(0===i){if(n<0)return 3*Math.PI/2;if(n>0)return Math.PI/2}return n>0&&i<0?Math.atan(Math.abs(n)/Math.abs(i)):n>0&&i>0?Math.PI-Math.atan(Math.abs(n)/Math.abs(i)):n<0&&i>0?Math.PI+Math.atan(Math.abs(n)/Math.abs(i)):n<0&&i<0?2*Math.PI-Math.atan(Math.abs(n)/Math.abs(i)):0}(t,e);let o=i+n;o>2*Math.PI?o-=2*Math.PI:o<0-2*Math.PI&&(o+=2*Math.PI),o<0&&(o+=2*Math.PI);const a=function(t,e){const n=(t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y);return 0===n?n:Math.sqrt(n)}(t,e);let r=0,l=0;return 0===o?(r=0,l=0-a):o>0&&o<Math.PI/2?(r=Math.sin(o)*a,l=0-Math.cos(o)*a):o===Math.PI/2?(r=a,l=0):o>Math.PI/2&&o<Math.PI?(r=Math.sin(Math.PI-o)*a,l=Math.cos(Math.PI-o)*a):o===Math.PI?(r=0,l=a):o>Math.PI&&o<1.5*Math.PI?(r=0-Math.sin(o-Math.PI)*a,l=Math.cos(o-Math.PI)*a):o===1.5*Math.PI?(r=0-a,l=0):o>1.5*Math.PI&&o<2*Math.PI?(r=0-Math.sin(2*Math.PI-o)*a,l=0-Math.cos(2*Math.PI-o)*a):o===2*Math.PI&&(r=0,l=0-a),r+=t.x,l+=t.y,{x:r,y:l}}function gt(t,e,n){const{x:i,y:o,w:a,h:r}=t;let l={x:i,y:o},s={x:i+a,y:o},c={x:i+a,y:o+r},h={x:i,y:o+r};if(n&&(n>0||n<0)){const t=ct(function(t){if(!(t>0||t<0)||0===t||360===t)return 0;let e=t%360;e<0?e+=360:360===t&&(e=0);return e}(n));l=dt(e,l,t),s=dt(e,s,t),c=dt(e,c,t),h=dt(e,h,t)}return[l,s,c,h]}function pt(t,e,n){return[dt(t,{x:e[0].x,y:e[0].y},n),dt(t,{x:e[1].x,y:e[1].y},n),dt(t,{x:e[2].x,y:e[2].y},n),dt(t,{x:e[3].x,y:e[3].y},n)]}function yt(t,e){var n;const i=[];let o=t;if(e.length>1)for(let t=0;t<e.length-1;t++){const a=o[e[t]];if("group"!==(null==a?void 0:a.type)||!Array.isArray(null===(n=null==a?void 0:a.detail)||void 0===n?void 0:n.children))return null;i.push(a),o=a.detail.children}return i}function wt(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 vt(t){const{x:e,y:n,w:i,h:o,angle:a=0}=t;return 0===a?wt(t):gt(t,ut({x:e,y:n,w:i,h:o}),a)}function mt(t,e){const{groupQueue:n}=e;if(!(n.length>0))return[vt(t)];const i=function(t){const e=[];let n=0,i=0;const o=[],a=[...t];for(let t=0;t<a.length;t++){const{x:r,y:l,w:s,h:c,angle:h=0}=a[t];let u;if(n+=r,i+=l,0===t){const t={x:n,y:i,w:s,h:c};u=vt({x:r,y:l,w:s,h:c,angle:h}),o.push({center:ut(t),angle:h,radian:ct(h)})}else{u=wt({x:n,y:i,w:s,h:c});for(let t=0;t<o.length;t++){const{center:e,radian:n}=o[t];u=pt(e,u,n)}const t=ft(u);(h>0||h<0)&&(u=pt(t,u,ct(h))),o.push({center:t,angle:h,radian:ct(h)})}e.push(u)}return e}([...n,t]);return i}function xt(t,e){const{viewScaleInfo:n}=e,{x:i,y:o,w:a,h:r,angle:l}=t,{scale:s,offsetTop:c,offsetLeft:h}=n;return{x:i*s+h,y:o*s+c,w:a*s,h:r*s,angle:l}}function bt(t,e){const{viewScaleInfo:n}=e,{x:i,y:o}=t,{scale:a,offsetTop:r,offsetLeft:l}=n;return{x:i*a+l,y:o*a+r}}function St(t,e){const{context2d:n,element:i,viewScaleInfo:o}=e,{angle:a=0}=i,{x:r,y:l,w:s,h:c}=xt(i,{viewScaleInfo:o}),h=function(t){const{angle:e=0}=t;return gt(t,ut(t),e)}({x:r,y:l,w:s,h:c,angle:a});if(h.length>=2){n.beginPath(),n.moveTo(h[0].x,h[0].y);for(let t=1;t<h.length;t++)n.lineTo(h[t].x,h[t].y);n.closePath()}return!!n.isPointInPath(t.x,t.y)}function It(t,e){const{groupQueue:n}=e,i=function(t,e){return mt(t,e).pop()||null}(t,{groupQueue:n}),o=tt(i[0],i[1]),a=tt(i[1],i[2]),r=tt(i[2],i[3]),l=tt(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:a,left:l,bottom:r}}function Mt(t){const e=Math.max(t.topLeft.x,t.topRight.x,t.bottomRight.x,t.bottomLeft.x),n=Math.max(t.topLeft.y,t.topRight.y,t.bottomRight.y,t.bottomLeft.y),i=Math.min(t.topLeft.x,t.topRight.x,t.bottomRight.x,t.bottomLeft.x),o=Math.min(t.topLeft.y,t.topRight.y,t.bottomRight.y,t.bottomLeft.y),a={x:t.center.x,y:t.center.y},r={x:i,y:o},l={x:e,y:o},s={x:e,y:n},c={x:i,y:n},h=tt(r,l),u=tt(c,s),f=tt(r,c);return{center:a,topLeft:r,topRight:l,bottomLeft:c,bottomRight:s,top:h,right:tt(l,s),left:f,bottom:u}}function Pt(t){let e="";return t.forEach((t=>{e+=t.type+t.params.join(" ")})),e}nt=new WeakMap,it=new WeakMap,ot=new WeakMap,et=new WeakSet,at=function(){return E(lt(this,it,"f"))};const Ct={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function At(t,e){const{viewScaleInfo:n}=e,{scale:i}=n;let{borderRadius:o}=t.detail;const{borderDash:a}=t.detail,r=Array.isArray(a)&&a.length>0,{boxSizing:l=Ct.boxSizing,borderWidth:s}=t.detail;Array.isArray(s)&&(o=0);let{x:c,y:h,w:u,h:f}=t,d=[0,0,0,0];if("number"==typeof o){const t=o*i;d=[t,t,t,t]}else Array.isArray(o)&&4===(null==o?void 0:o.length)&&(d=[o[0]*i,o[1]*i,o[2]*i,o[3]*i]);let g=0;return"number"==typeof s&&(g=(s||0)*i),"border-box"!==l||r?"content-box"===l?(c=t.x-g/2,h=t.y-g/2,u=t.w+g,f=t.h+g):(c=t.x,h=t.y,u=t.w,f=t.h):(c=t.x+g/2,h=t.y+g/2,u=t.w-g,f=t.h-g),u=Math.max(u,1),f=Math.max(f,1),d=d.map((t=>Math.min(t,u/2,f/2))),{x:c,y:h,w:u,h:f,radiusList:d}}const zt=["-apple-system",'"system-ui"',' "Segoe UI"'," Roboto",'"Helvetica Neue"',"Arial",'"Noto Sans"'," sans-serif"];function Rt(t){return[t,...zt].join(", ")}function Tt(t,e,n){if("string"==typeof e)return e;const{viewElementSize:i,viewScaleInfo:o,opacity:a=1}=n,{x:r,y:l}=i,{scale:s}=o;if("linear-gradient"===(null==e?void 0:e.type)){const{start:n,end:i,stops:o}=e,c={x:r+n.x*s,y:l+n.y*s},h={x:r+i.x*s,y:l+i.y*s},u=t.createLinearGradient(c.x,c.y,h.x,h.y);return o.forEach((t=>{u.addColorStop(t.offset,z(t.color,a))})),u}if("radial-gradient"===(null==e?void 0:e.type)){const{inner:n,outer:i,stops:o}=e,c={x:r+n.x*s,y:l+n.y*s,radius:n.radius*s},h={x:r+i.x*s,y:l+i.y*s,radius:i.radius*s},u=t.createRadialGradient(c.x,c.y,c.radius,h.x,h.y,h.radius);return o.forEach((t=>{u.addColorStop(t.offset,z(t.color,a))})),u}return"#000000"}const kt={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function Lt(t){var e,n,i,o;let a=1;return void 0!==(null==(e=null==t?void 0:t.detail)?void 0:e.opacity)&&(null==(n=null==t?void 0:t.detail)?void 0:n.opacity)>=0&&(null==(i=null==t?void 0:t.detail)?void 0:i.opacity)<=1&&(a=null==(o=null==t?void 0:t.detail)?void 0:o.opacity),a}function Et(t,e,n){const{pattern:i,renderContent:o,originElem:a,calcElemSize:r,viewScaleInfo:l,viewSizeInfo:s}=n||{},{parentOpacity:c}=n,h=Lt(a)*c,{clipPath:u,clipPathStrokeColor:f,clipPathStrokeWidth:d}=a.detail,g=()=>{t.globalAlpha=h,Ot(t,e,{pattern:i,viewScaleInfo:l,viewSizeInfo:s}),null==o||o(),Wt(t,e,{viewScaleInfo:l}),t.globalAlpha=c};u?(function(t,e,n){const{renderContent:i,originElem:o,calcElemSize:a,viewSizeInfo:r}=n,l=r.devicePixelRatio,{clipPath:s}=(null==o?void 0:o.detail)||{};if(s&&a&&s.commands){const{x:n,y:o,w:r,h:c}=a,{originW:h,originH:u,originX:f,originY:d}=s,g=r/h,p=c/u,y=n-f*g,w=o-d*p;t.save(),t.translate(y,w),t.scale(l*g,l*p);const v=Pt(s.commands||[]),m=new Path2D(v);t.clip(m,"nonzero"),t.translate(0-y,0-w),t.setTransform(1,0,0,1,0,0),ht(t,{...e},(()=>{null==i||i()})),t.restore()}else null==i||i()}(t,e,{originElem:a,calcElemSize:r,viewSizeInfo:s,renderContent:()=>{g()}}),"number"==typeof d&&d>0&&f&&function(t,e,n){const{renderContent:i,originElem:o,calcElemSize:a,viewSizeInfo:r,parentOpacity:l}=n,s=r.devicePixelRatio,{clipPath:c,clipPathStrokeColor:h,clipPathStrokeWidth:u}=(null==o?void 0:o.detail)||{};if(c&&a&&c.commands&&"number"==typeof u&&u>0&&h){const{x:n,y:o,w:r,h:f}=a,{originW:d,originH:g,originX:p,originY:y}=c,w=r/d,v=f/g,m=n-p*w,x=o-y*v;t.save(),t.globalAlpha=l,t.translate(m,x),t.scale(s*w,s*v);const b=Pt(c.commands||[]),S=new Path2D(b);t.strokeStyle=h,t.lineWidth=u,t.stroke(S),t.translate(0-m,0-x),t.setTransform(1,0,0,1,0,0),ht(t,{...e},(()=>{null==i||i()})),t.restore()}else null==i||i()}(t,e,{originElem:a,calcElemSize:r,viewSizeInfo:s,parentOpacity:c})):g()}function Ot(t,e,n){var i,o;const{pattern:a,viewScaleInfo:r,viewSizeInfo:l}=n,s=[];if(e.detail.background||a){const{x:n,y:l,w:c,h:h,radiusList:u}=At(e,{viewScaleInfo:r});if(t.beginPath(),t.moveTo(n+u[0],l),t.arcTo(n+c,l,n+c,l+h,u[1]),t.arcTo(n+c,l+h,n,l+h,u[2]),t.arcTo(n,l+h,n,l,u[3]),t.arcTo(n,l,n+c,l,u[0]),t.closePath(),"string"==typeof a)t.fillStyle=a;else if(["CanvasPattern"].includes(W.type(a)))t.fillStyle=a;else if("string"==typeof e.detail.background)t.fillStyle=e.detail.background;else if("linear-gradient"===(null==(i=e.detail.background)?void 0:i.type)){const i=Tt(t,e.detail.background,{viewElementSize:{x:n,y:l,w:c,h:h},viewScaleInfo:r,opacity:t.globalAlpha});t.fillStyle=i}else if("radial-gradient"===(null==(o=e.detail.background)?void 0:o.type)){const i=Tt(t,e.detail.background,{viewElementSize:{x:n,y:l,w:c,h:h},viewScaleInfo:r,opacity:t.globalAlpha});if(t.fillStyle=i,s&&s.length>0)for(let e=0;e<(null==s?void 0:s.length);e++){const i=s[e];"translate"===i.method?t.translate(i.args[0]+n,i.args[1]+l):"rotate"===i.method?t.rotate(...i.args):"scale"===i.method&&t.scale(...i.args)}}t.fill("nonzero"),s&&s.length>0&&t.setTransform(1,0,0,1,0,0)}}function Wt(t,e,n){if(0===e.detail.borderWidth)return;if(!A(e.detail.borderColor))return;const{viewScaleInfo:i}=n,{scale:o}=i;let a=kt.borderColor;!0===A(e.detail.borderColor)&&(a=e.detail.borderColor);const{borderDash:r,borderWidth:l,borderRadius:s,boxSizing:c=kt.boxSizing}=e.detail;let h=[];Array.isArray(r)&&r.length>0&&(h=r.map((t=>Math.ceil(t*o)))),h.length>0?t.lineCap="butt":t.lineCap="square";let u=[0,0,0,0];if("number"==typeof s){const t=s*o;u=[t,t,t,t]}else Array.isArray(s)&&4===(null==s?void 0:s.length)&&(u=[s[0]*o,s[1]*o,s[2]*o,s[3]*o]);let f=0;"number"==typeof l&&(f=l||1),f*=o,t.strokeStyle=a;let d=0,g=0,p=0,y=0;if(Array.isArray(l)&&(d=(l[0]||0)*o,g=(l[1]||0)*o,p=(l[2]||0)*o,y=(l[3]||0)*o),y||g||d||p){t.lineCap="butt";let{x:n,y:i,w:o,h:a}=e;"border-box"===c?(n+=y/2,i+=d/2,o=o-y/2-g/2,a=a-d/2-p/2):"content-box"===c?(n-=y/2,i-=d/2,o=o+y/2+g/2,a=a+d/2+p/2):(n=e.x,i=e.y,o=e.w,a=e.h),d&&(t.beginPath(),t.lineWidth=d,t.moveTo(n-y/2,i),t.lineTo(n+o+g/2,i),t.closePath(),t.stroke()),g&&(t.beginPath(),t.lineWidth=g,t.moveTo(n+o,i-d/2),t.lineTo(n+o,i+a+p/2),t.closePath(),t.stroke()),p&&(t.beginPath(),t.lineWidth=p,t.moveTo(n-y/2,i+a),t.lineTo(n+o+g/2,i+a),t.closePath(),t.stroke()),y&&(t.beginPath(),t.lineWidth=y,t.moveTo(n,i-d/2),t.lineTo(n,i+a+p/2),t.closePath(),t.stroke())}else{let{x:n,y:i,w:o,h:a}=e;"border-box"===c?(n=e.x+f/2,i=e.y+f/2,o=e.w-f,a=e.h-f):"content-box"===c?(n=e.x-f/2,i=e.y-f/2,o=e.w+f,a=e.h+f):(n=e.x,i=e.y,o=e.w,a=e.h),o=Math.max(o,1),a=Math.max(a,1),u=u.map((t=>Math.min(t,o/2,a/2))),t.setLineDash(h),t.lineWidth=f,t.beginPath(),t.moveTo(n+u[0],i),t.arcTo(n+o,i,n+o,i+a,u[1]),t.arcTo(n+o,i+a,n,i+a,u[2]),t.arcTo(n,i+a,n,i,u[3]),t.arcTo(n,i,n+o,i,u[0]),t.closePath(),t.stroke()}t.setLineDash([])}function $t(t,e,n){const{detail:i}=e,{viewScaleInfo:o,renderContent:a}=n,{shadowColor:r,shadowOffsetX:l,shadowOffsetY:s,shadowBlur:c}=i;J.number(c)?(t.save(),t.shadowColor=r||kt.shadowColor,t.shadowOffsetX=(l||0)*o.scale,t.shadowOffsetY=(s||0)*o.scale,t.shadowBlur=(c||0)*o.scale,a(),t.restore()):(t.save(),t.shadowColor="transparent",t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0,a(),t.restore())}function Ft(t,e,n){const{detail:i,angle:o}=e,{viewScaleInfo:a,viewSizeInfo:r,parentOpacity:l}=n,{background:s="#000000",borderColor:c="#000000",boxSizing:h,borderWidth:u=0,borderDash:f}=i;let d=0;"number"==typeof u&&u>0?d=u:Array.isArray(u)&&"number"==typeof u[0]&&u[0]>0&&(d=u[0]),d*=a.scale;const{x:g,y:p,w:y,h:w}=xt({x:e.x,y:e.y,w:e.w,h:e.h},{viewScaleInfo:a})||e,v={...e,x:g,y:p,w:y,h:w,angle:o};ht(t,{x:g,y:p,w:y,h:w,angle:o},(()=>{$t(t,v,{viewScaleInfo:a,renderContent:()=>{let e=y/2,n=w/2;const i=g+e,o=p+n,r=e,u=n;if(d>0&&("content-box"===h||("center-line"===h?(e-=d/2,n-=d/2):(e-=d,n-=d))),e>=0&&n>=0){const h=Lt(v)*l;t.globalAlpha=h,t.beginPath();const m=Tt(t,s,{viewElementSize:{x:g,y:p,w:y,h:w},viewScaleInfo:a,opacity:t.globalAlpha});if(t.fillStyle=m,t.circle(i,o,r,u,0,0,2*Math.PI),t.closePath(),t.fill("nonzero"),t.globalAlpha=l,"number"==typeof d&&d>0){const r=d/2+e,l=d/2+n;if(t.beginPath(),f){const e=f.map((t=>t*a.scale));t.setLineDash(e)}t.strokeStyle=c,t.lineWidth=d,t.circle(i,o,r,l,0,0,2*Math.PI),t.closePath(),t.stroke(),t.setLineDash([])}}}})}))}function Dt(t,e,n){const{viewScaleInfo:i,viewSizeInfo:o,parentOpacity:a}=n,{x:r,y:l,w:s,h:c,angle:h}=xt(e,{viewScaleInfo:i})||e,u={...e,x:r,y:l,w:s,h:c,angle:h};ht(t,{x:r,y:l,w:s,h:c,angle:h},(()=>{$t(t,u,{viewScaleInfo:i,renderContent:()=>{Et(t,u,{originElem:e,calcElemSize:{x:r,y:l,w:s,h:c,angle:h},viewScaleInfo:i,viewSizeInfo:o,parentOpacity:a,renderContent:()=>{}})}})}))}function Bt(t,e,n){const i=n.loader.getContent(e),{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:r}=n,{x:l,y:s,w:c,h:h,angle:u}=xt(e,{viewScaleInfo:o})||e,f={...e,x:l,y:s,w:c,h:h,angle:u};ht(t,{x:l,y:s,w:c,h:h,angle:u},(()=>{$t(t,f,{viewScaleInfo:o,renderContent:()=>{Et(t,f,{originElem:e,calcElemSize:{x:l,y:s,w:c,h:h,angle:u},viewScaleInfo:o,viewSizeInfo:a,parentOpacity:r,renderContent:()=>{if(i||n.loader.isDestroyed()||n.loader.load(e,n.elementAssets||{}),"image"===e.type&&i){t.globalAlpha=Lt(e)*r;const{x:n,y:a,w:l,h:s,radiusList:c}=At(f,{viewScaleInfo:o}),{detail:h}=e,{scaleMode:u,originW:d=0,originH:g=0}=h,p=t.$undoPixelRatio(d),y=t.$undoPixelRatio(g);if(t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(n+c[0],a),t.arcTo(n+l,a,n+l,a+s,c[1]),t.arcTo(n+l,a+s,n,a+s,c[2]),t.arcTo(n,a+s,n,a,c[3]),t.arcTo(n,a,n+l,a,c[0]),t.closePath(),t.fill("nonzero"),t.clip("nonzero"),u&&g&&d){let o=0,r=0,c=p,h=y;const f=n,d=a,g=l,w=s;if(p>e.w||y>e.h)if("fill"===u){const t=Math.max(e.w/p,e.h/y),n=y*t;o=(p*t-e.w)/2/t,r=(n-e.h)/2/t,c=e.w/t,h=e.h/t}else if("tile"===u)o=0,r=0,c=e.w,h=e.h;else if("fit"===u){const t=Math.min(e.w/p,e.h/y);o=(p-e.w/t)/2,r=(y-e.h/t)/2,c=e.w/t,h=e.h/t}t.drawImage(i,o,r,c,h,f,d,g,w)}else t.drawImage(i,n,a,l,s);t.globalAlpha=r,t.restore()}}})}})}))}function Vt(t,e,n){const i=n.loader.getContent(e),{viewScaleInfo:o,parentOpacity:a}=n,{x:r,y:l,w:s,h:c,angle:h}=xt(e,{viewScaleInfo:o})||e;ht(t,{x:r,y:l,w:s,h:c,angle:h},(()=>{i||n.loader.isDestroyed()||n.loader.load(e,n.elementAssets||{}),"svg"===e.type&&i&&(t.globalAlpha=Lt(e)*a,t.drawImage(i,r,l,s,c),t.globalAlpha=a)}))}function jt(t,e,n){const i=n.loader.getContent(e),{viewScaleInfo:o,parentOpacity:a}=n,{x:r,y:l,w:s,h:c,angle:h}=xt(e,{viewScaleInfo:o})||e;ht(t,{x:r,y:l,w:s,h:c,angle:h},(()=>{i||n.loader.isDestroyed()||n.loader.load(e,n.elementAssets||{}),"html"===e.type&&i&&(t.globalAlpha=Lt(e)*a,t.drawImage(i,r,l,s,c),t.globalAlpha=a)}))}const Xt={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function Yt(t,e,n){const{viewScaleInfo:i,viewSizeInfo:o,parentOpacity:a,calculator:r}=n,{x:l,y:s,w:c,h:h,angle:u}=xt(e,{viewScaleInfo:i})||e,f={...e,x:l,y:s,w:c,h:h,angle:u};ht(t,{x:l,y:s,w:c,h:h,angle:u},(()=>{var d,g;$t(t,f,{viewScaleInfo:i,renderContent:()=>{Et(t,f,{originElem:e,calcElemSize:{x:l,y:s,w:c,h:h,angle:u},viewScaleInfo:i,viewSizeInfo:o,parentOpacity:a})}});{const o={...Xt,...e.detail},a=(o.fontSize||Xt.fontSize)*i.scale;if(a<2)return;const{parentOpacity:c}=n,h=Lt(e)*c;t.globalAlpha=h,t.fillStyle=e.detail.color||Xt.color,t.textBaseline="top",t.$setFont({fontWeight:o.fontWeight,fontSize:a,fontFamily:Rt(o.fontFamily)});{const n=r.getVirtualFlatItem(e.uuid);Array.isArray(null==n?void 0:n.textLines)&&(null==(d=null==n?void 0:n.textLines)?void 0:d.length)>0&&(void 0!==o.textShadowColor&&A(o.textShadowColor)&&(t.shadowColor=o.textShadowColor),void 0!==o.textShadowOffsetX&&J.number(o.textShadowOffsetX)&&(t.shadowOffsetX=o.textShadowOffsetX),void 0!==o.textShadowOffsetY&&J.number(o.textShadowOffsetY)&&(t.shadowOffsetY=o.textShadowOffsetY),void 0!==o.textShadowBlur&&J.number(o.textShadowBlur)&&(t.shadowBlur=o.textShadowBlur),null==(g=null==n?void 0:n.textLines)||g.forEach((e=>{t.fillText(e.text,l+e.x*i.scale,s+e.y*i.scale)})))}t.globalAlpha=c}}))}function Ht(t,e,n){var i,o,a;if(!0===(null==(i=null==e?void 0:e.operations)?void 0:i.invisible))return;const{w:r,h:l}=e,{scale:s}=n.viewScaleInfo;if(s<1&&(r*s<.4||l*s<.4)||0===n.parentOpacity)return;const{overrideElementMap:c}=n;if(!(null==(a=null==(o=null==c?void 0:c[e.uuid])?void 0:o.operations)?void 0:a.invisible))try{switch(e.type){case"rect":Dt(t,e,n);break;case"circle":Ft(t,e,n);break;case"text":Yt(t,e,n);break;case"image":Bt(t,e,n);break;case"svg":Vt(t,e,n);break;case"html":jt(t,e,n);break;case"path":!function(t,e,n){var i,o;const{detail:a}=e,{originX:r,originY:l,originW:s,originH:c,fillRule:h}=a,{viewScaleInfo:u,viewSizeInfo:f,parentOpacity:d}=n,{x:g,y:p,w:y,h:w,angle:v}=xt(e,{viewScaleInfo:u})||e,m=y/s,x=w/c,b=g-r*m,S=p-l*x,{clipPath:I,clipPathStrokeColor:M,clipPathStrokeWidth:P,...C}=e.detail,A=u.scale*f.devicePixelRatio,z={...e,x:g,y:p,w:y,h:w,angle:v};let R={...z};R.detail=C;let T={...e};T.detail=C,a.fill&&"string"!==a.fill&&(null==(o=null==(i=a.fill)?void 0:i.type)?void 0:o.includes("gradient"))&&(R={...z,detail:{...z.detail,background:a.fill,clipPath:{commands:a.commands,originX:r,originY:l,originW:s,originH:c}}},T.detail={...R.detail}),ht(t,{x:g,y:p,w:y,h:w,angle:v},(()=>{Et(t,R,{originElem:T,calcElemSize:{x:g,y:p,w:y,h:w,angle:v},viewScaleInfo:u,viewSizeInfo:f,parentOpacity:d,renderContent:()=>{$t(t,z,{viewScaleInfo:u,renderContent:()=>{t.save(),t.translate(b,S),t.scale(A*m/u.scale,A*x/u.scale);const e=Pt(a.commands||[]),n=new Path2D(e);a.fill&&("string"==typeof a.fill?t.fillStyle=a.fill:t.fillStyle="transparent"),a.fill&&t.fill(n,h||"nonzero"),a.stroke&&0!==a.strokeWidth&&(t.strokeStyle=a.stroke,t.lineWidth=(a.strokeWidth||1)/f.devicePixelRatio,t.lineCap=a.strokeLineCap||"square",t.stroke(n)),t.translate(-b,-S),t.restore()}})}})}))}(t,e,n);break;case"group":{const i={...n.elementAssets||{},...e.detail.assets||{}};Ut(t,e,{...n,elementAssets:i});break}}}catch(t){console.error(t)}}function Ut(t,e,n){const{viewScaleInfo:i,viewSizeInfo:o,parentOpacity:a}=n,{x:r,y:l,w:s,h:c,angle:h}=xt({x:e.x,y:e.y,w:e.w,h:e.h,angle:e.angle},{viewScaleInfo:i})||e,u={...e,x:r,y:l,w:s,h:c,angle:h};ht(t,{x:r,y:l,w:s,h:c,angle:h},(()=>{t.globalAlpha=Lt(e)*a,$t(t,u,{viewScaleInfo:i,renderContent:()=>{Et(t,u,{originElem:e,calcElemSize:{x:r,y:l,w:s,h:c,angle:h},viewScaleInfo:i,viewSizeInfo:o,parentOpacity:a,renderContent:()=>{const{x:o,y:r,w:l,h:s,radiusList:c}=At(u,{viewScaleInfo:i});if("hidden"===e.detail.overflow&&(t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(o+c[0],r),t.arcTo(o+l,r,o+l,r+s,c[1]),t.arcTo(o+l,r+s,o,r+s,c[2]),t.arcTo(o,r+s,o,r,c[3]),t.arcTo(o,r,o+l,r,c[0]),t.closePath(),t.fill("nonzero"),t.clip("nonzero")),Array.isArray(e.detail.children)){const{parentElementSize:i}=n,o={x:i.x+e.x,y:i.y+e.y,w:e.w||i.w,h:e.h||i.h,angle:e.angle},{calculator:r}=n;for(let i=0;i<e.detail.children.length;i++){let l=e.detail.children[i];if(l={...l,x:o.x+l.x,y:o.y+l.y},!0===n.forceDrawAll||(null==r?void 0:r.needRender(l)))try{Ht(t,l,{...n,parentOpacity:a*Lt(e)})}catch(t){console.error(t)}}}"hidden"===e.detail.overflow&&t.restore()}})}}),t.globalAlpha=a}))}const Nt={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function Qt(t,e,n){var i;const{elements:o=[]}=e,{parentOpacity:a}=n;for(let e=0;e<o.length;e++){const r=o[e],l={...r,detail:{...Nt,...null==r?void 0:r.detail}};if(!0===n.forceDrawAll||(null==(i=n.calculator)?void 0:i.needRender(l)))try{Ht(t,l,{...n,parentOpacity:a})}catch(t){console.error(t)}}}function Gt(t,e,n,i){const{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:r}=n,l={uuid:"layout",type:"group",...e},{x:s,y:c,w:h,h:u}=xt(l,{viewScaleInfo:o})||l,f={...l,x:s,y:c,w:h,h:u,angle:0};if(t.globalAlpha=1,$t(t,f,{viewScaleInfo:o,renderContent:()=>{Ot(t,f,{viewScaleInfo:o,viewSizeInfo:a})}}),"hidden"===e.detail.overflow){const{viewScaleInfo:i,viewSizeInfo:o}=n,a={uuid:"layout",type:"group",...e},r=xt(a,{viewScaleInfo:i})||a,l={...a,...r},{x:s,y:c,w:h,h:u,radiusList:f}=At(l,{viewScaleInfo:i});t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(s+f[0],c),t.arcTo(s+h,c,s+h,c+u,f[1]),t.arcTo(s+h,c+u,s,c+u,f[2]),t.arcTo(s,c+u,s,c,f[3]),t.arcTo(s,c,s+h,c,f[0]),t.closePath(),t.fill("nonzero"),t.clip("nonzero")}i(t),"hidden"===e.detail.overflow&&t.restore(),Wt(t,f,{viewScaleInfo:o}),t.globalAlpha=r}function qt(t,e,n){if("string"==typeof(null==e?void 0:e.background)){const{viewSizeInfo:i}=n,{width:o,height:a}=i;t.globalAlpha=1,t.fillStyle=e.background,t.fillRect(0,0,o,a)}}const Jt=["image","svg","html"],Kt=t=>{var e,n,i;let o=null;return"image"===t.type?o=(null==(e=null==t?void 0:t.detail)?void 0:e.src)||null:"svg"===t.type?o=(null==(n=null==t?void 0:t.detail)?void 0:n.svg)||null:"html"===t.type&&(o=(null==(i=null==t?void 0:t.detail)?void 0:i.html)||null),"string"==typeof o&&o?L(o)?o:k(o,t.uuid):k(`${R()}-${t.uuid}-${R()}-${R()}`,t.uuid)};class Zt extends _{constructor(){super(),M(this,a),M(this,e,{}),M(this,n,{}),M(this,i,{}),M(this,o,!1),C(this,a,r).call(this,"image",(async(t,e)=>{var n;const i=(null==(n=e[t.detail.src])?void 0:n.value)||t.detail.src,o=await D(i);return{uuid:t.uuid,lastModified:Date.now(),content:o}})),C(this,a,r).call(this,"html",(async(t,e)=>{var n;const i=(null==(n=e[t.detail.html])?void 0:n.value)||t.detail.html,o=await V(i,{width:t.detail.originW||t.w,height:t.detail.originH||t.h});return{uuid:t.uuid,lastModified:Date.now(),content:o}})),C(this,a,r).call(this,"svg",(async(t,e)=>{var n;const i=(null==(n=e[t.detail.svg])?void 0:n.value)||t.detail.svg,o=await B(i);return{uuid:t.uuid,lastModified:Date.now(),content:o}}))}isDestroyed(){return I(this,o)}reset(){!0!==I(this,o)&&(P(this,n,{}),P(this,i,{}))}resetElementAsset(t){var e,o,a;if(Jt.includes(t.type)){let r=null,l=null;"image"===t.type&&"string"==typeof(null==(e=null==t?void 0:t.detail)?void 0:e.src)?l=t.detail.src:"svg"===t.type&&"string"==typeof(null==(o=null==t?void 0:t.detail)?void 0:o.svg)?l=t.detail.svg:"html"===t.type&&"string"==typeof(null==(a=null==t?void 0:t.detail)?void 0:a.html)&&(l=t.detail.html),"string"==typeof l&&(this.load(t,{}),L(l)?r=l:t.uuid&&(r=k(l,t.uuid))),r&&L(r)&&(delete I(this,i)[r],delete I(this,n)[r])}}destroy(){P(this,o,!0),this.clear(),P(this,e,null),P(this,n,null),P(this,i,null)}load(t,e){!0!==I(this,o)&&(C(this,a,f).call(this,t)||Jt.includes(t.type)&&C(this,a,u).call(this,t,e))}getContent(t){var e,n;const o=Kt(t);return(null==(n=null==(e=I(this,i))?void 0:e[o])?void 0:n.content)||null}getLoadItemMap(){return I(this,i)}setLoadItemMap(t){P(this,i,t)}}e=new WeakMap,n=new WeakMap,i=new WeakMap,o=new WeakMap,a=new WeakSet,r=function(t,n){I(this,e)[t]=n},l=function(t){var e,n,i;let o=null;return"image"===t.type?o=(null==(e=null==t?void 0:t.detail)?void 0:e.src)||null:"svg"===t.type?o=(null==(n=null==t?void 0:t.detail)?void 0:n.svg)||null:"html"===t.type&&(o=(null==(i=null==t?void 0:t.detail)?void 0:i.html)||null),o},s=function(t){return{element:t,status:"null",content:null,error:null,startTime:-1,endTime:-1,source:C(this,a,l).call(this,t)}},c=function(t){const e=Kt(t.element),n=I(this,i)[e];I(this,o)||(n?n.startTime<t.startTime&&(I(this,i)[e]=t,this.trigger("load",{...t,countTime:t.endTime-t.startTime})):(I(this,i)[e]=t,this.trigger("load",{...t,countTime:t.endTime-t.startTime})))},h=function(t){var e;const n=Kt(t.element),a=null==(e=I(this,i))?void 0:e[n];I(this,o)||(a?a.startTime<t.startTime&&(I(this,i)[n]=t,this.trigger("error",{...t,countTime:t.endTime-t.startTime})):(I(this,i)[n]=t,this.trigger("error",{...t,countTime:t.endTime-t.startTime})))},u=function(t,i){const r=C(this,a,s).call(this,t),l=Kt(t);if(I(this,n)[l])return;I(this,n)[l]=r;const u=I(this,e)[t.type];"function"!=typeof u||I(this,o)||(r.startTime=Date.now(),u(t,i).then((t=>{I(this,o)||(r.content=t.content,r.endTime=Date.now(),r.status="load",C(this,a,c).call(this,r))})).catch((e=>{console.warn(`Load element source "${r.source}" fail`,e,t),r.endTime=Date.now(),r.status="error",r.error=e,C(this,a,h).call(this,r)})))},f=function(t){var e;const i=Kt(t),o=null==(e=I(this,n))?void 0:e[i];return!(!o||"error"!==o.status||!o.source||o.source!==C(this,a,l).call(this,t))};const _t={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function te(t,e){const{w:n,h:i}=t,o=e.tempContext,a=[],r={..._t,...t.detail},l=r.fontSize||_t.fontSize,s=l;if(s<2)return{};const c=r.lineHeight||l;o.textBaseline="top",o.$setFont({fontWeight:r.fontWeight,fontSize:s,fontFamily:Rt(r.fontFamily)});let h=r.text.replace(/\r\n/gi,"\n");"lowercase"===r.textTransform?h=h.toLowerCase():"uppercase"===r.textTransform&&(h=h.toUpperCase());const u=c,f=h.split("\n");let d=0;f.forEach(((t,e)=>{if("maxContent"===r.minInlineSize)a.push({x:0,y:0,text:t,width:o.$undoPixelRatio(o.measureText(t).width)});else{let c="",h="",g=t.split(h);if("normal"===r.wordBreak){h=" ";const e=t.split(h);g=[],e.forEach(((t,n)=>{g.push(t),n<e.length-1&&g.push(h)}))}if(1===g.length&&"visible"===r.overflow)a.push({x:0,y:0,text:g[0],width:o.$undoPixelRatio(o.measureText(g[0]).width)});else if(g.length>0){for(let t=0;t<g.length&&(l=o.$doPixelRatio(n),s=o.measureText(c+g[t]).width,l>=s?c+=g[t]||"":(a.push({x:0,y:0,text:c,width:o.$undoPixelRatio(o.measureText(c).width)}),c=g[t]||"",d++),!((d+1)*u>i&&"hidden"===r.overflow));t++)if(g.length-1===t&&(d+1)*u<=i){a.push({x:0,y:0,text:c,width:o.$undoPixelRatio(o.measureText(c).width)}),e<f.length-1&&d++;break}}else a.push({x:0,y:0,text:"",width:0})}var l,s}));let g=0,p=0;u>s&&(p=(u-s)/2),a.length*u<i&&("top"===r.verticalAlign?g=0:"bottom"===r.verticalAlign?g+=i-a.length*u:g+=(i-a.length*u)/2);{const t=0+g;a.forEach(((e,i)=>{let o=0;"center"===r.textAlign?o=0+(n-e.width)/2:"right"===r.textAlign&&(o=n-e.width+0),a[i].x=o,a[i].y=t+u*i+p}))}return{textLines:a}}function ee(t,e){let n={};return"text"===t.type&&(n=te(t,e)),n}function ne(t,e){const{viewScaleInfo:n,viewSizeInfo:i,tempContext:o}=e,a=function(t,e){const n={},i=[],o=a=>{const r={type:a.type,isVisibleInView:!0,position:[...i]};let l=null;l=It(a,{groupQueue:yt(t,i)||[]});const s={...r,originRectInfo:l,rangeRectInfo:J.angle(a.angle)?Mt(l):l,...ee(a,e)};n[a.uuid]=s,"group"===a.type&&a.detail.children.forEach(((t,e)=>{i.push(e),o(t),i.pop()}))};return t.forEach(((t,e)=>{i.push(e),o(t),i.pop()})),n}(t,{tempContext:o});return ie(a,{viewScaleInfo:n,viewSizeInfo:i})}function ie(t,e){const n=function(t){const{viewScaleInfo:e,viewSizeInfo:n}=t,{scale:i,offsetTop:o,offsetLeft:a}=e,{width:r,height:l}=n,s=0-a/i,c=0-o/i,h=r/i,u=l/i,f=ut({x:s,y:c,w:h,h:u}),d={x:s,y:c},g={x:s+h,y:c},p={x:s,y:c+u},y={x:s+h,y:c+u},w={x:s,y:f.y},v={x:f.x,y:c},m={x:s+h,y:f.y},x={x:f.x,y:c+u};return{center:f,topLeft:d,topRight:g,bottomLeft:p,bottomRight:y,left:w,top:v,right:m,bottom:x}}(e);let i=0,o=0;return Object.keys(t).forEach((e=>{const a=t[e];a.isVisibleInView=function(t,e){const n=Math.min(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),i=Math.max(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),o=Math.min(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y),a=Math.max(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y),r=Math.min(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),l=Math.max(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),s=Math.min(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y),c=Math.max(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y);return n<=l&&i>=r&&o<=c&&a>=s||l<=a&&l>=a&&l<=a&&l>=a}(a.rangeRectInfo,n),a.isVisibleInView?i++:o++})),{virtualFlatItemMap:t,visibleCount:i,invisibleCount:o}}class oe{constructor(t){M(this,d),M(this,g),P(this,d,t),P(this,g,new st({defaultStorage:{virtualFlatItemMap:{},visibleCount:0,invisibleCount:0}}))}toGridNum(t,e){return!0===(null==e?void 0:e.ignore)?t:Math.round(t)}destroy(){P(this,d,null)}needRender(t){const e=I(this,g).get("virtualFlatItemMap")[t.uuid];return!e||e.isVisibleInView}getPointElement(t,e){return function(t,e){var n,i,o;const{context2d:a,data:r,viewScaleInfo:l,groupQueue:s}=e,c={index:-1,element:null,groupQueueIndex:-1};if(s&&Array.isArray(s)&&(null==s?void 0:s.length)>0)for(let e=s.length-1;e>=0;e--){let o=0,r=0,h=0;for(let t=0;t<=e;t++)o+=s[t].x,r+=s[t].y,h+=s[t].angle||0;const u=s[e];if(u&&"group"===u.type&&Array.isArray(null===(n=u.detail)||void 0===n?void 0:n.children))for(let n=0;n<u.detail.children.length;n++){const f=u.detail.children[n];if(!0!==(null===(i=null==f?void 0:f.operations)||void 0===i?void 0:i.invisible)){if(!f)break;if(St(t,{context2d:a,element:{x:o+f.x,y:r+f.y,w:f.w,h:f.h,angle:h+(f.angle||0)},viewScaleInfo:l})){c.element=f,(e<s.length-1||"group"!==f.type)&&(c.groupQueueIndex=e);break}}}if(c.element)break}if(c.element)return c;for(let e=r.elements.length-1;e>=0;e--){const n=r.elements[e];if(!0!==(null===(o=null==n?void 0:n.operations)||void 0===o?void 0:o.invisible)&&St(t,{context2d:a,element:n,viewScaleInfo:l})){c.index=e,c.element=n;break}}return c}(t,{...e,context2d:I(this,d).tempContext})}resetVirtualFlatItemMap(t,e){if(t){const{virtualFlatItemMap:n,invisibleCount:i,visibleCount:o}=ne(t.elements,{...e,tempContext:I(this,d).tempContext});I(this,g).set("virtualFlatItemMap",n),I(this,g).set("invisibleCount",i),I(this,g).set("visibleCount",o)}}updateVisiableStatus(t){const{virtualFlatItemMap:e,invisibleCount:n,visibleCount:i}=ie(I(this,g).get("virtualFlatItemMap"),t);I(this,g).set("virtualFlatItemMap",e),I(this,g).set("invisibleCount",n),I(this,g).set("visibleCount",i)}calcViewRectInfoFromOrigin(t,e){const n=I(this,g).get("virtualFlatItemMap")[t];if(!(null==n?void 0:n.originRectInfo))return null;const{checkVisible:i,viewScaleInfo:o,viewSizeInfo:a}=e,{center:r,left:l,right:s,bottom:c,top:h,topLeft:u,topRight:f,bottomLeft:d,bottomRight:p}=n.originRectInfo;if(!0===i&&!1===n.isVisibleInView)return null;const y={viewScaleInfo:o};return{center:bt(r,y),left:bt(l,y),right:bt(s,y),bottom:bt(c,y),top:bt(h,y),topLeft:bt(u,y),topRight:bt(f,y),bottomLeft:bt(d,y),bottomRight:bt(p,y)}}calcViewRectInfoFromRange(t,e){const n=I(this,g).get("virtualFlatItemMap")[t];if(!(null==n?void 0:n.originRectInfo))return null;const{checkVisible:i,viewScaleInfo:o,viewSizeInfo:a}=e,{center:r,left:l,right:s,bottom:c,top:h,topLeft:u,topRight:f,bottomLeft:d,bottomRight:p}=n.rangeRectInfo;if(!0===i&&!1===n.isVisibleInView)return null;const y={viewScaleInfo:o};return{center:bt(r,y),left:bt(l,y),right:bt(s,y),bottom:bt(c,y),top:bt(h,y),topLeft:bt(u,y),topRight:bt(f,y),bottomLeft:bt(d,y),bottomRight:bt(p,y)}}modifyText(t){const e=I(this,g).get("virtualFlatItemMap"),n=e[t.uuid];if(t&&"text"===t.type){const i={...n,...te(t,{tempContext:I(this,d).tempContext})};e[t.uuid]=i,I(this,g).set("virtualFlatItemMap",e)}}modifyVirtualFlatItemMap(t,e){const{modifyInfo:n,viewScaleInfo:i,viewSizeInfo:o}=e,{type:a,content:r}=n,l=t.elements,s=I(this,g).get("virtualFlatItemMap");if("deleteElement"===a){const{element:t}=r,e=[],n=t=>{e.push(t.uuid),"group"===t.type&&Array.isArray(t.detail.children)&&t.detail.children.forEach((t=>{n(t)}))};n(t),e.forEach((t=>{delete s[t]})),I(this,g).set("virtualFlatItemMap",s)}else if("addElement"===a||"updateElement"===a){const{position:e}=r,n=function(t,e){let n=null,i=e;for(let e=0;e<t.length;e++){const o=i[t[e]];if(e<t.length-1&&"group"===(null==o?void 0:o.type))i=o.detail.children;else{if(e!==t.length-1)break;n=o}}return n}(e,t.elements),c=yt(l,e);if(n)if("updateElement"===a&&"group"===n.type)this.resetVirtualFlatItemMap(t,{viewScaleInfo:i,viewSizeInfo:o});else{const t=It(n,{groupQueue:c||[]}),r={type:n.type,originRectInfo:t,rangeRectInfo:J.angle(n.angle)?Mt(t):t,isVisibleInView:!0,position:[...e],...ee(n,{tempContext:I(this,d).tempContext})};s[n.uuid]=r,I(this,g).set("virtualFlatItemMap",s),"updateElement"===a&&this.updateVisiableStatus({viewScaleInfo:i,viewSizeInfo:o})}}else"moveElement"===a&&this.resetVirtualFlatItemMap(t,{viewScaleInfo:i,viewSizeInfo:o})}getVirtualFlatItem(t){return I(this,g).get("virtualFlatItemMap")[t]||null}}d=new WeakMap,g=new WeakMap;return p=new WeakMap,y=new WeakMap,w=new WeakMap,v=new WeakMap,m=new WeakSet,x=function(){const t=I(this,y);t.on("load",(t=>{this.trigger("load",t)})),t.on("error",(t=>{console.error(t)}))},t.Calculator=oe,t.Renderer=class extends _{constructor(t){super(),M(this,m),M(this,p),M(this,y,new Zt),M(this,w),M(this,v,!1),P(this,p,t),P(this,w,new oe({tempContext:t.tempContext})),C(this,m,x).call(this)}isDestroyed(){return I(this,v)}destroy(){this.clear(),P(this,p,null),I(this,y).destroy(),P(this,y,null),P(this,v,!0)}updateOptions(t){P(this,p,t)}drawData(t,e){const n=I(this,y),i=I(this,w),{sharer:o}=I(this,p),a=I(this,p).viewContext;a.clearRect(0,0,a.canvas.width,a.canvas.height);const r={x:0,y:0,w:e.viewSizeInfo.width,h:e.viewSizeInfo.height};!0===e.forceDrawAll&&I(this,w).resetVirtualFlatItemMap(t,{viewScaleInfo:e.viewScaleInfo,viewSizeInfo:e.viewSizeInfo});const l={loader:n,calculator:i,parentElementSize:r,elementAssets:t.assets,parentOpacity:1,overrideElementMap:null==o?void 0:o.getActiveOverrideElemenentMap(),...e};qt(a,t.global,l),t.layout?Gt(a,t.layout,l,(()=>{Qt(a,t,l)})):Qt(a,t,l)}scale(t){const{sharer:e}=I(this,p);if(!e)return;const{data:n,offsetTop:i,offsetBottom:o,offsetLeft:a,offsetRight:r,width:l,height:s,contextHeight:c,contextWidth:h,devicePixelRatio:u}=e.getActiveStoreSnapshot();n&&this.drawData(n,{viewScaleInfo:{scale:t,offsetTop:i,offsetBottom:o,offsetLeft:a,offsetRight:r},viewSizeInfo:{width:l,height:s,contextHeight:c,contextWidth:h,devicePixelRatio:u}})}setLoadItemMap(t){I(this,y).setLoadItemMap(t)}getLoadItemMap(){return I(this,y).getLoadItemMap()}getLoader(){return I(this,y)}getCalculator(){return I(this,w)}},t.drawCircle=Ft,t.drawElement=Ht,t.drawElementList=Qt,t.drawGlobalBackground=qt,t.drawGroup=Ut,t.drawHTML=jt,t.drawImage=Bt,t.drawLayout=Gt,t.drawRect=Dt,t.drawSVG=Vt,t.drawText=Yt,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idraw/renderer",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"author": "idrawjs",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@idraw/types": "^0.4.
|
|
24
|
+
"@idraw/types": "^0.4.2"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@idraw/util": "^0.4.
|
|
28
|
+
"@idraw/util": "^0.4.2"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public",
|