@silurus/ooxml 0.88.0 → 0.89.1

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.
Files changed (127) hide show
  1. package/README.md +118 -23
  2. package/THIRD_PARTY_NOTICES.md +8 -7
  3. package/dist/abort-VrnK7mdP.js +10 -0
  4. package/dist/assets/render-worker-C5G_Nr_A.js +35 -0
  5. package/dist/assets/render-worker-DQfWdNsm.js +16 -0
  6. package/dist/assets/render-worker-Ds7LjwU-.js +15 -0
  7. package/dist/{hyperlink-Cxzhet30.js → bounded-raw-part-cache-CsnNptAy.js} +4937 -7458
  8. package/dist/bundled-asset-url-E2nXURF9.js +15 -0
  9. package/dist/canvas-viewer-mechanics-BZ8QCrRi.js +675 -0
  10. package/dist/cfb-guard-dNeUiANF.js +528 -0
  11. package/dist/chart-ex.mjs +667 -663
  12. package/dist/comment-overlay-controller-CBvQx-En.js +994 -0
  13. package/dist/comment-ui-runtime-B7ZvovcS.js +2 -0
  14. package/dist/{comment-ui-runtime-DcJOYlw-.js → comment-ui-runtime-BKidRH36.js} +5 -5
  15. package/dist/{comment-ui-runtime-CWGqn5Vr.js → comment-ui-runtime-C47QoDUy.js} +5 -5
  16. package/dist/delimited-text-worker-host-CikWU6_m.js +27 -0
  17. package/dist/document-model-source-MzFPrxt0.js +249 -0
  18. package/dist/document-pull-client-BoJeuURD.js +35941 -0
  19. package/dist/document-pull-worker-CaP8XESP.js +104 -0
  20. package/dist/docx-BN70UhvX.js +495 -0
  21. package/dist/docx-BRRtSvk3.js +3563 -0
  22. package/dist/docx-model-source-CTO9iw_W.js +98 -0
  23. package/dist/docx-source-worker.mjs +455 -0
  24. package/dist/docx.mjs +7 -7
  25. package/dist/docx_parser_bg.wasm +0 -0
  26. package/dist/drawingml-shape-CHmq8kpM.js +310 -0
  27. package/dist/duotone-DN8P4aXe.js +126 -0
  28. package/dist/emf-CGFQIz6c.js +1790 -0
  29. package/dist/font-preload-demand-Dmy31xt-.js +2058 -0
  30. package/dist/grid-geometry-C3IG20ut.js +384 -0
  31. package/dist/host-layout-DVMw8hDY.js +56 -0
  32. package/dist/host-layout-measure-DsuQ2UJs.js +7 -0
  33. package/dist/in-process-pull-transport-DuXcPZng.js +29 -0
  34. package/dist/index.mjs +4 -4
  35. package/dist/internal-companion.mjs +12 -0
  36. package/dist/line-distribute-Bu8psjGd.js +2799 -0
  37. package/dist/math.mjs +2 -2
  38. package/dist/mathjax-stix2.js +10 -10
  39. package/dist/model-source-kz_NkZqT.js +179 -0
  40. package/dist/model-source-s5hRpk4w.js +61 -0
  41. package/dist/model-source-session-6fuaqbGs.js +71 -0
  42. package/dist/model-source-session-DqrR4XHR.js +85 -0
  43. package/dist/model-source-session-cPJSF_Ak.js +58 -0
  44. package/dist/node.mjs +7 -1327
  45. package/dist/{pixel-budget-9P63Bsk5.js → pixel-budget-BpTYrepD.js} +13 -10
  46. package/dist/plot-area-frame-Bs_j4uu7.js +41811 -0
  47. package/dist/pptx-CaJ6ILnw.js +183 -0
  48. package/dist/pptx-_BOGcBym.js +2936 -0
  49. package/dist/pptx-model-source-B_9afw9R.js +37 -0
  50. package/dist/pptx-source-worker.mjs +446 -0
  51. package/dist/pptx.mjs +8 -7
  52. package/dist/pptx_parser_bg.wasm +0 -0
  53. package/dist/presentation-model-source-CGHLyX32.js +77 -0
  54. package/dist/raster-target-YQ4G6rxo.js +42 -0
  55. package/dist/region-map.mjs +117 -153
  56. package/dist/{render-D3iqVKCo.js → render-CzbDzRKa.js} +3 -3
  57. package/dist/{render-worker-host-B5wQfB7U.js → render-worker-host-B1u6BOUd.js} +1 -1
  58. package/dist/{render-worker-host-D4123J27.js → render-worker-host-C-EECo68.js} +1 -1
  59. package/dist/{render-worker-host-Di3LxLc0.js → render-worker-host-DDqZTCVf.js} +1 -1
  60. package/dist/renderer-CD2cvVAF.js +5823 -0
  61. package/dist/renderer-DRoeb14O.js +5170 -0
  62. package/dist/resource-measurement-Dhhm7P_l.js +772 -0
  63. package/dist/session-XPmC0CUd.js +656 -0
  64. package/dist/slide-pull-client-tq7U_fYg.js +6485 -0
  65. package/dist/three-d-BKwNPAP4.js +878 -0
  66. package/dist/three-d.mjs +925 -910
  67. package/dist/{raster-target-ojDdQizC.js → tiff-contract-C6M3QcPp.js} +1 -42
  68. package/dist/tiff.mjs +401 -248
  69. package/dist/types/chart-ex.d.ts +149 -2
  70. package/dist/types/docx.d.ts +333 -96
  71. package/dist/types/index.d.ts +566 -301
  72. package/dist/types/internal-companion.d.ts +11 -0
  73. package/dist/types/math.d.ts +1 -1
  74. package/dist/types/node.d.ts +422 -9
  75. package/dist/types/pptx.d.ts +302 -95
  76. package/dist/types/region-map.d.ts +149 -2
  77. package/dist/types/three-d.d.ts +149 -2
  78. package/dist/types/tiff.d.ts +1 -1
  79. package/dist/types/xlsx.d.ts +343 -132
  80. package/dist/wasm-loader-rlgHmcSv.js +35 -0
  81. package/dist/wasm-runtime-generation-D6TKZdNb.js +97 -0
  82. package/dist/workbook-model-source-BIGrfZy6.js +94 -0
  83. package/dist/worker-source-DrwhR9fw.js +22 -0
  84. package/dist/worker-source-SbudzjYL.js +22 -0
  85. package/dist/worker-source-UAi3GNcM.js +22 -0
  86. package/dist/worksheet-pull-client-ClvPO_Jf.js +579 -0
  87. package/dist/xlsx-CsmREBaZ.js +5819 -0
  88. package/dist/xlsx-DmHfeNNp.js +534 -0
  89. package/dist/xlsx-model-source-D1flORqy.js +309 -0
  90. package/dist/xlsx-source-worker.mjs +525 -0
  91. package/dist/xlsx.mjs +8 -7
  92. package/dist/xlsx_parser_bg.wasm +0 -0
  93. package/package.json +42 -16
  94. package/dist/assets/render-worker-1uPAxMZr.js +0 -31
  95. package/dist/assets/render-worker-BlvJybji.js +0 -10
  96. package/dist/assets/render-worker-CzmiJfFL.js +0 -11
  97. package/dist/bounded-raw-part-cache-Cg1BsSZQ.js +0 -119
  98. package/dist/canvas-viewer-mechanics-DbLz0rYW.js +0 -1384
  99. package/dist/cjk-fallback-bLI3z70h.js +0 -46
  100. package/dist/comment-occurrence-C8Y2uoVr.js +0 -6
  101. package/dist/comment-ui-runtime-BsK8pmUT.js +0 -2
  102. package/dist/comments-Diid5ujN.js +0 -246
  103. package/dist/delimited-text-worker-host-BVY-Ecni.js +0 -27
  104. package/dist/document-pull-client-B9PTM-pL.js +0 -27280
  105. package/dist/docx-BF9WXrYH.js +0 -3103
  106. package/dist/dom-interaction-boundary-Cnm8DSBN.js +0 -223
  107. package/dist/highlight-rect-C5hkRqUr.js +0 -13
  108. package/dist/line-distribute-D1WNHKz_.js +0 -1023
  109. package/dist/line-metrics-B60C86uh.js +0 -60
  110. package/dist/plot-area-frame-DLTYKHNP.js +0 -4354
  111. package/dist/pptx-DkyYBYoL.js +0 -3065
  112. package/dist/renderer-B4GZb5We.js +0 -6492
  113. package/dist/resource-measurement-SHQCbkh2.js +0 -150
  114. package/dist/session-BGq81gRQ.js +0 -743
  115. package/dist/slide-pull-client-DiPnm240.js +0 -6253
  116. package/dist/source-key-DIJG8BA0.js +0 -42
  117. package/dist/three-d-DJBl8g8M.js +0 -1162
  118. package/dist/transfer-p6iCC2R7.js +0 -6
  119. package/dist/units-BzZ0gAxs.js +0 -4
  120. package/dist/worksheet-pull-client-BM8ywvbu.js +0 -458
  121. package/dist/xlsx-C9NVjgaV.js +0 -8484
  122. /package/dist/{chunk-DmhlhrBa.js → chunk-Dy4uBu1J.js} +0 -0
  123. /package/dist/{mathjax-DoyWZbSp.js → mathjax-BhwN6ilc.js} +0 -0
  124. /package/dist/{read-only-comment-decoration-Dz7eTQ4d.js → read-only-comment-decoration-PidH0wnP.js} +0 -0
  125. /package/dist/{read-only-comment-margin-DkgzASAl.js → read-only-comment-margin-B52rDVKo.js} +0 -0
  126. /package/dist/{renderer-module-contract-D91rkYHH.js → renderer-module-contract-CWM7jv6d.js} +0 -0
  127. /package/dist/{visible-index-BgiHEc1z.js → visible-index-FeVA0mGE.js} +0 -0
@@ -1,4354 +0,0 @@
1
- import { a as e, n as t, r as n, t as r } from "./units-BzZ0gAxs.js";
2
- import { i, r as a } from "./pixel-budget-9P63Bsk5.js";
3
- //#region packages/core/src/chart/effective-style.ts
4
- var o = [
5
- "fontSizeHpt",
6
- "fontBold",
7
- "fontItalic",
8
- "fontFace",
9
- "fontLanguage",
10
- "fontBaseline",
11
- "textRotation",
12
- "textWrap",
13
- "textVerticalAnchor",
14
- "textVerticalMode",
15
- "textLInsEmu",
16
- "textTInsEmu",
17
- "textRInsEmu",
18
- "textBInsEmu",
19
- "textBodyAuthored"
20
- ], s = [
21
- "fontColor",
22
- "fontColors",
23
- "fontColorIndex",
24
- "fontFormattingIndices",
25
- "fontPaintAuthored",
26
- "fontHidden"
27
- ], c = [
28
- "fillPaints",
29
- "fillColors",
30
- "fillHidden",
31
- "fillPaintAuthored",
32
- "fillNoStyle",
33
- "fillColorIndex",
34
- "fillFormattingIndices",
35
- "fillSemanticFallbackIndices"
36
- ], l = [
37
- "lineColors",
38
- "linePaints",
39
- "linePaintAuthored",
40
- "lineHidden",
41
- "lineNoStyle",
42
- "lineColorIndex",
43
- "lineFormattingIndices",
44
- "lineSemanticFallbackIndices"
45
- ], u = [
46
- "shapePropertiesPresent",
47
- "allowNoFillOverride",
48
- "allowNoLineOverride"
49
- ], d = [
50
- "lineWidthEmu",
51
- "lineCap",
52
- "lineJoin",
53
- "lineCompound"
54
- ], f = [
55
- "lineDash",
56
- "lineDashAuthored",
57
- "lineCustomDash"
58
- ], p;
59
- function m(e) {
60
- if (p) return e();
61
- p = /* @__PURE__ */ new WeakMap();
62
- try {
63
- return e();
64
- } finally {
65
- p = void 0;
66
- }
67
- }
68
- function h(e) {
69
- let t = p?.get(e);
70
- if (t) return t;
71
- let n = /* @__PURE__ */ new WeakMap();
72
- for (let t = 0; t < e.series.length; t++) n.set(e.series[t], t);
73
- let r = new Int32Array(e.series.length);
74
- r.fill(-1);
75
- for (let t = 0; t < (e.plotGroups?.length ?? 0); t++) {
76
- let n = e.plotGroups[t], i = Math.min(e.series.length, n.seriesStart + n.seriesCount);
77
- for (let e = Math.max(0, n.seriesStart); e < i; e++) r[e] = t;
78
- }
79
- let i = {
80
- series: n,
81
- groupBySeries: r
82
- };
83
- return p?.set(e, i), i;
84
- }
85
- function g(e, t, n = -1) {
86
- return h(e).series.get(t) ?? n;
87
- }
88
- function _(e, t) {
89
- return t >= 0 && t < e.series.length ? h(e).groupBySeries[t] ?? -1 : -1;
90
- }
91
- function v(e, t) {
92
- let n = _(e, t);
93
- return n >= 0 ? e.plotGroups?.[n] : void 0;
94
- }
95
- function y(...e) {
96
- for (let t of e) if (t != null && (t.lineDashAuthored === !0 || t.lineDash != null || t.lineCustomDash != null)) return t;
97
- }
98
- var b = [
99
- "shadows",
100
- "innerShadows",
101
- "glows",
102
- "softEdges",
103
- "reflections",
104
- "effectAuthored",
105
- "effectNoStyle",
106
- "effectUnsupported",
107
- "effectFormattingIndices",
108
- "effectColorIndex"
109
- ];
110
- function x(e, t, n) {
111
- if (!t) return;
112
- let r = e, i = t;
113
- for (let e of n) {
114
- let t = i[e];
115
- t != null && (r[e] = t);
116
- }
117
- }
118
- function S(e, t) {
119
- let n = e;
120
- return t.some((e) => n[e] !== void 0 && n[e] !== null);
121
- }
122
- function C(e, t) {
123
- if (!e) return t ?? void 0;
124
- if (!t) return e;
125
- let n = {};
126
- if (x(n, e, o), x(n, t, o), x(n, e, s), S(t, s)) {
127
- for (let e of s) delete n[e];
128
- x(n, t, s);
129
- }
130
- if (x(n, e, c), t.fillNoStyle !== !0 && S(t, c)) {
131
- for (let e of c) delete n[e];
132
- x(n, t, c);
133
- }
134
- if (x(n, e, l), x(n, e, d), x(n, e, f), t.lineNoStyle !== !0 && S(t, l)) {
135
- for (let e of l) delete n[e];
136
- x(n, t, l);
137
- }
138
- if (x(n, t, d), S(t, f)) {
139
- for (let e of f) delete n[e];
140
- x(n, t, f);
141
- }
142
- if (x(n, e, b), t.effectNoStyle !== !0 && S(t, b)) {
143
- for (let e of b) delete n[e];
144
- x(n, t, b);
145
- }
146
- return x(n, t, u), n;
147
- }
148
- function w(e) {
149
- let t = e.classicChartStyleRoles, n = e.linkedChartStyleRoles ?? e.chartStyleRoles;
150
- if (!t) return e;
151
- let r = new Set([...Object.keys(t), ...Object.keys(n ?? {})]), i = {};
152
- for (let e of r) {
153
- let r = C(t[e], n?.[e]);
154
- r && (i[e] = r);
155
- }
156
- let a = {};
157
- for (let r of [
158
- "dataPoint",
159
- "dataPoint3D",
160
- "dataPointLine",
161
- "dataPointMarker"
162
- ]) {
163
- let i = C(e.classicVaryingPointChartStyleRoles?.[r] ?? t[r], n?.[r]);
164
- i && (a[r] = i);
165
- }
166
- let o = e.classicVaryingPointChartStyleRolesByGroup?.map((e) => {
167
- if (!e) return null;
168
- let t = {};
169
- for (let r of [
170
- "dataPoint",
171
- "dataPoint3D",
172
- "dataPointLine",
173
- "dataPointMarker"
174
- ]) {
175
- let i = C(e[r], n?.[r]);
176
- i && (t[r] = i);
177
- }
178
- return t;
179
- });
180
- return {
181
- ...e,
182
- linkedChartStyleRoles: n,
183
- chartStyleRoles: i,
184
- varyingPointChartStyleRoles: Object.keys(a).length > 0 ? a : void 0,
185
- varyingPointChartStyleRolesByGroup: o,
186
- chartexDataPointStyle: i.dataPoint,
187
- chartexDataPointLineStyle: i.dataPointLine,
188
- chartexSeriesLineStyle: i.seriesLine,
189
- chartexDataPointMarkerStyle: i.dataPointMarker
190
- };
191
- }
192
- function T(e, t) {
193
- return e.linkedChartStyleRoles?.[t] ?? (e.classicChartStyleRoles == null ? e.chartStyleRoles?.[t] : void 0);
194
- }
195
- function E(e, t) {
196
- let n = v(e, t);
197
- return n ? n.kind === "pie" || n.kind === "pie3D" || n.kind === "doughnut" || n.kind === "ofPie" ? n.varyColors !== !1 : n.kind === "bubble" ? n.seriesCount === 1 && n.varyColors !== !1 : n.kind === "line" || n.kind === "scatter" ? n.seriesCount === 1 && n.varyColors === !0 : n.kind === "radar" ? n.radarStyle !== "filled" && n.seriesCount === 1 && n.varyColors === !0 : (n.kind === "bar" || n.kind === "bar3D") && n.seriesCount === 1 && n.varyColors === !0 : e.chartType === "pie" || e.chartType === "pie3D" || e.chartType === "doughnut" || e.chartType === "ofPie" ? e.varyColors !== !1 : e.chartType === "bubble" ? e.series.length === 1 && e.varyColors !== !1 : e.varyColors === !0 && e.series.length === 1 && (e.chartType.includes("Bar") || e.chartType === "line" || e.chartType === "stackedLine" || e.chartType === "stackedLinePct" || e.chartType === "scatter" || e.chartType === "radar" && e.radarStyle !== "filled");
198
- }
199
- function D(e, t, n) {
200
- if (!E(e, n)) return e.chartStyleRoles?.[t];
201
- let r = _(e, n), i = r >= 0 ? e.varyingPointChartStyleRolesByGroup?.[r] : void 0;
202
- return i == null ? e.varyingPointChartStyleRoles?.[t] ?? e.chartStyleRoles?.[t] : i[t];
203
- }
204
- //#endregion
205
- //#region packages/core/src/chart/sparse-style-index.ts
206
- var O;
207
- function k(e) {
208
- if (O) return e();
209
- O = {
210
- compact: /* @__PURE__ */ new WeakMap(),
211
- membership: /* @__PURE__ */ new WeakMap()
212
- };
213
- try {
214
- return e();
215
- } finally {
216
- O = void 0;
217
- }
218
- }
219
- function A(e, t) {
220
- if (!O) return e.indexOf(t);
221
- let n = O.compact.get(e);
222
- if (!n) {
223
- let t = /* @__PURE__ */ new Map();
224
- for (let n = 0; n < e.length; n++) {
225
- let r = e[n];
226
- t.has(r) || t.set(r, n);
227
- }
228
- n = t, O.compact.set(e, n);
229
- }
230
- return n.get(t) ?? -1;
231
- }
232
- function ee(e, t) {
233
- if (!e) return !1;
234
- if (!O) return e.includes(t);
235
- let n = O.membership.get(e);
236
- return n || (n = new Set(e), O.membership.set(e, n)), n.has(t);
237
- }
238
- //#endregion
239
- //#region packages/core/src/chart/style-paint.ts
240
- function te(e, t, n) {
241
- let r = t === "font" ? e.fontFormattingIndices : t === "fill" ? e.fillFormattingIndices : t === "line" ? e.lineFormattingIndices : e.effectFormattingIndices, i = r ? A(r, n) : -1;
242
- return i >= 0 ? i : n;
243
- }
244
- function ne(e, t) {
245
- if (!e) return null;
246
- if (!e.fontColors?.length) return e.fontColor ?? null;
247
- let n = e.fontColorIndex ?? te(e, "font", t);
248
- return e.fontColors[n % e.fontColors.length] ?? null;
249
- }
250
- function j(e, t, n) {
251
- if (!e) return null;
252
- let r = t === "fill" ? e.fillColors : e.lineColors;
253
- return r?.length ? r[((t === "fill" ? e?.fillColorIndex : e?.lineColorIndex) ?? te(e, t, n)) % r.length] ?? null : null;
254
- }
255
- function re(e, t) {
256
- if (!e) return null;
257
- let n = e.fillPaints;
258
- return n?.length ? n[(e.fillColorIndex ?? te(e, "fill", t)) % n.length] ?? null : null;
259
- }
260
- function ie(e, t) {
261
- if (!e) return null;
262
- let n = e.linePaints;
263
- return n?.length ? n[(e.lineColorIndex ?? te(e, "line", t)) % n.length] ?? null : null;
264
- }
265
- function M(e, t) {
266
- if (!e) return;
267
- if (e.fillHidden) return e.fillNoStyle ? void 0 : null;
268
- if (ee(e.fillSemanticFallbackIndices, t)) return;
269
- let n = re(e, t);
270
- if (n) return n;
271
- let r = j(e, "fill", t);
272
- return r ? {
273
- fillType: "solid",
274
- color: r
275
- } : e.fillPaintAuthored === !0 ? null : void 0;
276
- }
277
- function ae(e, t) {
278
- if (!e) return;
279
- if (e.lineHidden) return e.lineNoStyle ? void 0 : null;
280
- if (ee(e.lineSemanticFallbackIndices, t)) return;
281
- let n = ie(e, t);
282
- if (n) return n;
283
- let r = j(e, "line", t);
284
- return r ? {
285
- fillType: "solid",
286
- color: r
287
- } : e.linePaintAuthored === !0 ? null : void 0;
288
- }
289
- function oe(e, t) {
290
- return e == null ? !0 : t === "fill" ? e.fillNoStyle === !0 || e.allowNoFillOverride === !0 : e.lineNoStyle === !0 || e.allowNoLineOverride === !0;
291
- }
292
- function N(e, t, n) {
293
- let r = M(e, n);
294
- return r === null && e?.fillHidden === !0 && !oe(t, "fill") ? void 0 : r;
295
- }
296
- function se(e, t, n) {
297
- let r = ae(e, n);
298
- return r === null && e?.lineHidden === !0 && !oe(t, "line") ? void 0 : r;
299
- }
300
- function P(e) {
301
- return oe(e, "fill") ? null : void 0;
302
- }
303
- function ce(e) {
304
- return oe(e, "line") ? null : void 0;
305
- }
306
- function F(e, t, n, ...r) {
307
- for (let e of r) {
308
- let r = N(e, t, n);
309
- if (r !== void 0) return r;
310
- }
311
- return M(e, n);
312
- }
313
- function le(e, t, n, ...r) {
314
- for (let e of r) {
315
- let r = se(e, t, n);
316
- if (r !== void 0) return r;
317
- }
318
- return ae(e, n);
319
- }
320
- function ue(e, t, n) {
321
- let r = T(e, n);
322
- if (t.fillHidden === !0) {
323
- let e = P(r);
324
- if (e !== void 0) return e;
325
- }
326
- if (t.fill != null) return t.fill;
327
- if (t.fillColor != null) return {
328
- fillType: "solid",
329
- color: t.fillColor
330
- };
331
- let i = N(t.style, r, 0);
332
- return i === void 0 ? t.fillPaintAuthored === !0 && t.fillHidden !== !0 ? null : F(e.chartStyleRoles?.[n], r, 0, t.style) : i;
333
- }
334
- function de(e, t, n) {
335
- let r = t?.style, i = e.chartStyleRoles?.[n], a = T(e, n), o;
336
- t?.fillHidden === !0 ? (o = P(a), o === void 0 && (o = M(i, 0))) : o = t?.fillColor ? {
337
- fillType: "solid",
338
- color: t.fillColor
339
- } : F(i, a, 0, r);
340
- let s;
341
- t?.lineHidden === !0 ? (s = ce(a), s === void 0 && (s = ae(i, 0))) : s = t?.lineColor ? {
342
- fillType: "solid",
343
- color: t.lineColor
344
- } : le(i, a, 0, r);
345
- let c = i, l = y(t?.lineDash == null ? void 0 : {
346
- lineDash: t.lineDash,
347
- lineDashAuthored: !0
348
- }, r, c);
349
- return {
350
- fill: o,
351
- line: s,
352
- lineWidthEmu: t?.lineWidthEmu ?? r?.lineWidthEmu ?? c?.lineWidthEmu,
353
- lineDash: l?.lineDash,
354
- lineCustomDash: l?.lineCustomDash,
355
- lineCap: r?.lineCap ?? c?.lineCap,
356
- lineJoin: r?.lineJoin ?? c?.lineJoin
357
- };
358
- }
359
- //#endregion
360
- //#region packages/core/src/chart/classic-data-point-style.ts
361
- function fe(e, t, n, r, i) {
362
- let a = r?.chartexStyle, o = n.chartexStyle, s = g(e, n), c = D(e, t, s >= 0 ? s : i) ?? (t === "dataPoint" ? e.chartexDataPointStyle : e.chartexDataPointLineStyle), l = T(e, t), u = r?.lineHidden === !0 ? null : se(a, l, r?.idx ?? i);
363
- u === void 0 && r?.lineColor && (u = {
364
- fillType: "solid",
365
- color: r.lineColor
366
- }), u === void 0 && (u = n.lineHidden === !0 ? null : se(o, l, i)), u === void 0 && n.lineColor && (u = {
367
- fillType: "solid",
368
- color: n.lineColor
369
- }), u === void 0 && (u = ae(c, i));
370
- let d = y(r?.lineDash == null ? void 0 : {
371
- lineDash: r.lineDash,
372
- lineDashAuthored: !0
373
- }, a, o, c);
374
- return {
375
- paint: u,
376
- widthEmu: r?.lineWidthEmu ?? a?.lineWidthEmu ?? n.lineWidthEmu ?? o?.lineWidthEmu ?? c?.lineWidthEmu,
377
- dash: d?.lineDash,
378
- customDash: d?.lineCustomDash,
379
- cap: a?.lineCap ?? o?.lineCap ?? c?.lineCap,
380
- join: a?.lineJoin ?? o?.lineJoin ?? c?.lineJoin
381
- };
382
- }
383
- function pe(e, t, n, r, i) {
384
- let a = g(e, t), o = D(e, "dataPoint", a >= 0 ? a : r) ?? e.chartexDataPointStyle, s = T(e, "dataPoint"), c = N(n?.chartexStyle, s, n?.idx ?? r);
385
- if (c !== void 0) return c;
386
- if (n?.fillHidden === !0) {
387
- let e = P(s);
388
- if (e !== void 0) return e;
389
- }
390
- if (n?.color === "00000000") return null;
391
- if (n?.color) return {
392
- fillType: "solid",
393
- color: n.color
394
- };
395
- let l = i == null ? null : t.dataPointColors?.[i];
396
- if (l === "00000000") return null;
397
- if (l) return {
398
- fillType: "solid",
399
- color: l
400
- };
401
- let u = N(t.chartexStyle, s, r);
402
- return u === void 0 ? t.color === "00000000" ? null : t.fillPattern ? t.fillPattern : M(o, r) : u;
403
- }
404
- //#endregion
405
- //#region packages/core/src/chart/category-spacing.ts
406
- function me(e, t) {
407
- return t == null || !Number.isFinite(t) ? e : e * Math.max(0, Math.min(1e3, t)) / 100;
408
- }
409
- function he(e, t, n, r = !1) {
410
- let i = Math.max(0, t - 1), a = Number.isFinite(e) ? Math.max(0, Math.min(i, e)) : 0, o = n ? (a + .5) / Math.max(1, t) : t === 1 ? .5 : a / i;
411
- return r ? 1 - o : o;
412
- }
413
- function ge(e, t) {
414
- if (e <= 0) return [];
415
- let n = [], r = t ? e : e - 1;
416
- for (let i = 0; i <= r; i++) n.push(t ? i / e : e === 1 ? .5 : i / (e - 1));
417
- return n;
418
- }
419
- function _e(e, t) {
420
- return e <= 0 ? [] : t ? Array.from({ length: e }, (t, n) => (n + .5) / e) : e <= 1 ? [] : Array.from({ length: e - 1 }, (t, n) => (n + .5) / (e - 1));
421
- }
422
- function ve(e, t, n, r, i) {
423
- if (i == null) return {
424
- fraction: he(e, t, n, r),
425
- textAlign: "center"
426
- };
427
- let a = Math.max(0, t - 1), o = Number.isFinite(e) ? Math.max(0, Math.min(a, e)) : 0, s, c;
428
- if (t <= 1 ? (s = 0, c = 1) : n ? (s = o / t, c = (o + 1) / t) : (s = o === 0 ? 0 : (o - .5) / a, c = o === a ? 1 : (o + .5) / a), r) {
429
- let e = 1 - c;
430
- c = 1 - s, s = e;
431
- }
432
- return i === "l" ? {
433
- fraction: s,
434
- textAlign: "left"
435
- } : i === "r" ? {
436
- fraction: c,
437
- textAlign: "right"
438
- } : {
439
- fraction: (s + c) / 2,
440
- textAlign: "center"
441
- };
442
- }
443
- function ye(e, t) {
444
- return e != null && Number.isFinite(e) ? Math.max(0, Math.min(500, e)) : t === "legacy" ? 150 : 33;
445
- }
446
- //#endregion
447
- //#region packages/core/src/chart/layout.ts
448
- function be(e, t, n) {
449
- let r = Math.max(1, t), i = [], a = [], o = 0;
450
- for (let t = 0; t < e.length; t++) {
451
- let s = Math.min(r, Math.max(0, e[t])), c = a.length === 0 ? s : o + n + s;
452
- a.length > 0 && c > r ? (i.push(a), a = [t], o = s) : (a.push(t), o = c);
453
- }
454
- return a.length > 0 && i.push(a), i;
455
- }
456
- var xe = 14;
457
- function Se(e, t) {
458
- return typeof e == "number" && Number.isFinite(e) && e >= 100 && e <= 4e5 ? e / 100 * t : null;
459
- }
460
- function Ce(e, t, n) {
461
- return Se(e.titleFontSizeHpt, n) ?? xe * n;
462
- }
463
- var we = .62;
464
- function Te(e, t, n, r, i) {
465
- if (!e.title && !e.titlePresent) return {
466
- fontPx: 0,
467
- topPad: 0,
468
- bottomPad: 0,
469
- bandH: 0
470
- };
471
- let a = Ce(e, t, n), o = a + t * r + t * i, s = Math.min(Math.max(0, o - a), a * we);
472
- return {
473
- fontPx: a,
474
- topPad: s,
475
- bottomPad: o - a - s,
476
- bandH: o
477
- };
478
- }
479
- function Ee(e, t, n, r, i) {
480
- if (!e.showLegend) return null;
481
- let a = e.legendPos ?? "r", o = a === "l" ? "l" : a === "t" ? "t" : a === "b" ? "b" : "r";
482
- if (o === "r" || o === "l") {
483
- if (i) {
484
- let e = Math.min(80, t * .3), n = t * .3, r = Math.max(0, ...i.itemWidths) + i.horizontalPadding;
485
- return {
486
- side: o,
487
- reserveW: Math.min(n, Math.max(e, r)),
488
- reserveH: 0
489
- };
490
- }
491
- return {
492
- side: o,
493
- reserveW: Math.max(80, t * r),
494
- reserveH: 0
495
- };
496
- }
497
- if (i) {
498
- let e = Math.max(1, t - i.horizontalPadding), r = be(i.itemWidths, e, i.itemGap).length * i.rowHeight + i.verticalPadding;
499
- return {
500
- side: o,
501
- reserveW: 0,
502
- reserveH: Math.min(n * .3, r)
503
- };
504
- }
505
- return {
506
- side: o,
507
- reserveW: 0,
508
- reserveH: Math.max(18, n * .08)
509
- };
510
- }
511
- function De(e, t = !1) {
512
- return t ? {
513
- legRightW: 0,
514
- legLeftW: 0,
515
- legTopH: 0,
516
- legBottomH: 0
517
- } : {
518
- legRightW: e?.side === "r" ? e.reserveW : 0,
519
- legLeftW: e?.side === "l" ? e.reserveW : 0,
520
- legTopH: e?.side === "t" ? e.reserveH : 0,
521
- legBottomH: e?.side === "b" ? e.reserveH : 0
522
- };
523
- }
524
- function Oe(e, t) {
525
- return Se(e, t) ?? 10 * t;
526
- }
527
- function ke(e, t) {
528
- return Math.max(0, e != null && Number.isFinite(e) ? e : 0) / n * t;
529
- }
530
- function Ae(e, t, n) {
531
- let r = 0, i = !1;
532
- if (n != null) switch (i = !0, n) {
533
- case "horz": break;
534
- case "vert270":
535
- r -= 90;
536
- break;
537
- case "vert":
538
- case "wordArtVert":
539
- case "eaVert":
540
- case "mongolianVert":
541
- case "wordArtVertRtl":
542
- r += 90;
543
- break;
544
- }
545
- return t != null && Number.isFinite(t) && (r += t / 6e4, i = !0), i ? r * Math.PI / 180 : e === "left" || e === "right" ? -Math.PI / 2 : 0;
546
- }
547
- function je(e) {
548
- return Math.max(8, e * .02);
549
- }
550
- function Me(e, t, n, r) {
551
- let i = Oe(e.catAxisTitleFontSizeHpt, r), a = Oe(e.valAxisTitleFontSizeHpt, r), o = ke(e.catAxisTitleTextVerticalInsetEmu, r), s = ke(e.valAxisTitleTextVerticalInsetEmu, r);
552
- return {
553
- catFontPx: i,
554
- valFontPx: a,
555
- catBandH: e.catAxisTitle ? i + o + je(n) + 4 : 0,
556
- valBandW: e.valAxisTitle ? a + s + je(t) + 4 : 0
557
- };
558
- }
559
- var Ne = 2.25, Pe = 2.75, Fe = 2.15, Ie = 3.05;
560
- function Le(e, t, n) {
561
- if (!e.title && !e.titlePresent) return {
562
- fontPx: 0,
563
- topPad: 0,
564
- bottomPad: 0,
565
- bandH: 0
566
- };
567
- let r = Ce(e, t, n), i = r * (e.cartesianAutoLayoutProfile === "wordClassicColumn" ? Fe : Ne), a = Math.min(Math.max(0, i - r), r * we);
568
- return {
569
- fontPx: r,
570
- topPad: a,
571
- bottomPad: i - r - a,
572
- bandH: i
573
- };
574
- }
575
- function Re(e, t, n) {
576
- let r = ze(e), i = me(r, t);
577
- return e * (n === "wordClassicColumn" ? Ie : Pe) + i - r;
578
- }
579
- function ze(e) {
580
- return 5 / 6 * e;
581
- }
582
- function Be(e) {
583
- return e;
584
- }
585
- var Ve = 1.5;
586
- function He(e) {
587
- let t = e.outerTextMarginPx ?? 0;
588
- return {
589
- t: e.valAxisHidden ? 0 : e.valLabelFontPx / 2 + t,
590
- r: (e.secondaryBandW ?? 0) > 0 ? (e.secondaryBandW ?? 0) + t : 0,
591
- b: e.catAxisHidden ? 0 : e.catLabelFontPx + (e.catLabelGapPx ?? ze(e.catLabelFontPx)) + e.catTitleBandH + t,
592
- l: e.valAxisHidden ? 0 : e.valLabelWidth + (e.valLabelGapPx ?? Be(e.valLabelFontPx)) + e.valTitleBandW + t
593
- };
594
- }
595
- function Ue(e, t, n) {
596
- let r = e.xMode || "factor", i = e.yMode || "factor", a = e.wMode || "factor", o = e.hMode || "factor", s = r === "edge" ? t.x + e.x * t.w : n.x + e.x * t.w, c = i === "edge" ? t.y + e.y * t.h : n.y + e.y * t.h, l = e.w == null ? n.w : a === "edge" ? t.x + e.w * t.w - s : e.w * t.w, u = e.h == null ? n.h : o === "edge" ? t.y + e.h * t.h - c : e.h * t.h;
597
- return ![
598
- s,
599
- c,
600
- l,
601
- u
602
- ].every(Number.isFinite) || l <= 0 || u <= 0 ? null : {
603
- x: s,
604
- y: c,
605
- w: l,
606
- h: u
607
- };
608
- }
609
- function We(e, t, n, r, i, a, o) {
610
- let s = o.titleBand ?? Te(e, i, a, o.titleTopPadFrac ?? 0, o.titleBottomPadFrac ?? 0), c = o.legendReserve === void 0 ? Ee(e, r, i, o.legendSideReserveFrac) : o.legendReserve, l = De(c, e.legendOverlay === !0), u = Me(e, r, i, a), d, f, p, m;
611
- if (o.radialGapFrac != null) {
612
- let e = i * o.radialGapFrac;
613
- p = r - l.legRightW - l.legLeftW, m = i - s.bandH - l.legTopH - l.legBottomH - e, d = t + l.legLeftW, f = n + s.bandH + l.legTopH + e;
614
- } else {
615
- let e = o.pad;
616
- if (!e) throw Error("computeChartFrame: cartesian frame requires params.pad");
617
- d = t + e.l, f = n + e.t, p = r - e.l - e.r, m = i - e.t - e.b;
618
- }
619
- let h = !1, g = o.honorPlotAreaManualLayout ? e.plotAreaManualLayout : null;
620
- if (g) {
621
- let e = g.layoutTarget === "inner" ? {
622
- t: 0,
623
- r: 0,
624
- b: 0,
625
- l: 0
626
- } : o.manualOuterInsets ?? {
627
- t: 0,
628
- r: 0,
629
- b: 0,
630
- l: 0
631
- }, a = g.layoutTarget === "inner" ? {
632
- x: d,
633
- y: f,
634
- w: p,
635
- h: m
636
- } : {
637
- x: d - e.l,
638
- y: f - e.t,
639
- w: p + e.l + e.r,
640
- h: m + e.t + e.b
641
- }, s = Ue(g, {
642
- x: t,
643
- y: n,
644
- w: r,
645
- h: i
646
- }, a);
647
- s && s.w > e.l + e.r && s.h > e.t + e.b && (d = s.x + e.l, f = s.y + e.t, p = s.w - e.l - e.r, m = s.h - e.t - e.b, h = !0);
648
- }
649
- return {
650
- title: s,
651
- legend: c,
652
- legendBands: l,
653
- axisTitles: u,
654
- plotRect: {
655
- px0: d,
656
- py0: f,
657
- pw: p,
658
- ph: m
659
- },
660
- plotAreaManualLayoutApplied: h,
661
- center: {
662
- cx: d + p / 2,
663
- cy: f + m / 2
664
- }
665
- };
666
- }
667
- //#endregion
668
- //#region packages/core/src/chart/data-label-layout.ts
669
- var Ge = (e) => [
670
- e.x,
671
- e.y,
672
- e.w,
673
- e.h
674
- ].every(Number.isFinite) && e.w > 0 && e.h > 0;
675
- function Ke(e, t) {
676
- let n = Math.max(e.x, t.x), r = Math.max(e.y, t.y), i = Math.min(e.x + e.w, t.x + t.w), a = Math.min(e.y + e.h, t.y + t.h);
677
- return i > n && a > r ? {
678
- x: n,
679
- y: r,
680
- w: i - n,
681
- h: a - r
682
- } : null;
683
- }
684
- function qe(e, t, n) {
685
- return Math.min(Math.max(e, t), n);
686
- }
687
- function Je(e, t, n, r, i, a = t) {
688
- if (!Ge(t) || !Ge(a) || !Number.isFinite(r) || r <= 0 || ![n.w, n.h].every(Number.isFinite) || n.w < 0 || n.h <= 0) return null;
689
- let o = r * .5, s = t, c, l, u = !1, d = "center", f = "middle";
690
- if (e.kind === "point") {
691
- if (![
692
- e.x,
693
- e.y,
694
- e.markerGap ?? 0
695
- ].every(Number.isFinite)) return null;
696
- let t = o + Math.max(0, e.markerGap ?? 0);
697
- switch (c = e.x, l = e.y, e.position ?? "r") {
698
- case "l":
699
- c -= t + n.w / 2, d = "right";
700
- break;
701
- case "t":
702
- l -= t + n.h / 2, f = "bottom";
703
- break;
704
- case "b":
705
- l += t + n.h / 2, f = "top";
706
- break;
707
- case "ctr":
708
- case "inEnd":
709
- case "bestFit": break;
710
- default:
711
- c += t + n.w / 2, d = "left";
712
- break;
713
- }
714
- } else if (e.kind === "box") {
715
- if (![
716
- e.rect.x,
717
- e.rect.y,
718
- e.rect.w,
719
- e.rect.h
720
- ].every(Number.isFinite) || e.rect.w <= 0 || e.rect.h <= 0) return null;
721
- let r = Ke(e.rect, t);
722
- if (!r) return null;
723
- let i = e.position ?? "ctr";
724
- c = r.x + r.w / 2, l = r.y + r.h / 2, i === "inBase" ? (s = {
725
- x: r.x + o,
726
- y: r.y + o,
727
- w: r.w - o,
728
- h: r.h - o
729
- }, c = s.x + n.w / 2, l = s.y + n.h / 2, d = "left", f = "top") : i === "inEnd" ? (s = {
730
- x: r.x + o,
731
- y: r.y,
732
- w: r.w - o,
733
- h: r.h - o
734
- }, c = s.x + n.w / 2, l = s.y + s.h - n.h / 2, d = "left", f = "bottom") : i === "l" ? (s = {
735
- x: r.x + o,
736
- y: r.y + o,
737
- w: r.w - o,
738
- h: r.h - o * 2
739
- }, c = s.x + n.w / 2, d = "left") : i === "r" || i === "outEnd" ? (s = {
740
- x: r.x,
741
- y: r.y + o,
742
- w: r.w - o,
743
- h: r.h - o * 2
744
- }, c = s.x + s.w - n.w / 2, d = "right") : i === "t" ? (s = {
745
- x: r.x + o,
746
- y: r.y + o,
747
- w: r.w - o * 2,
748
- h: r.h - o
749
- }, l = s.y + n.h / 2, f = "top") : i === "b" ? (s = {
750
- x: r.x + o,
751
- y: r.y,
752
- w: r.w - o * 2,
753
- h: r.h - o
754
- }, l = s.y + s.h - n.h / 2, f = "bottom") : s = {
755
- x: r.x + o,
756
- y: r.y + o,
757
- w: r.w - o * 2,
758
- h: r.h - o * 2
759
- };
760
- } else {
761
- if (![
762
- e.rect.x,
763
- e.rect.y,
764
- e.rect.w,
765
- e.rect.h
766
- ].every(Number.isFinite) || e.rect.w < 0 || e.rect.h < 0) return null;
767
- let r = e.position ?? "outEnd", i = r === "inBase" || r === "inEnd" || r === "ctr";
768
- if (u = !i, i) {
769
- let n = Ke(e.rect, t);
770
- if (!n) return null;
771
- s = n;
772
- } else if (e.orientation === "vertical" && e.rect.w <= 0 || e.orientation === "horizontal" && e.rect.h <= 0) return null;
773
- let a = e.rect.x + e.rect.w / 2, p = e.rect.y + e.rect.h / 2;
774
- if (c = a, l = p, e.orientation === "vertical") {
775
- let t = e.negative ? e.rect.y + e.rect.h : e.rect.y, i = e.negative ? e.rect.y : e.rect.y + e.rect.h;
776
- r === "inBase" ? (l = i + (e.negative ? 1 : -1) * (o + n.h / 2), f = e.negative ? "top" : "bottom") : r === "inEnd" ? (l = t + (e.negative ? -1 : 1) * (o + n.h / 2), f = e.negative ? "bottom" : "top") : r !== "ctr" && (l = t + (e.negative ? 1 : -1) * (o + n.h / 2), f = e.negative ? "top" : "bottom");
777
- } else {
778
- let t = e.negative ? e.rect.x : e.rect.x + e.rect.w, i = e.negative ? e.rect.x + e.rect.w : e.rect.x;
779
- r === "inBase" ? (c = i + (e.negative ? -1 : 1) * (o + n.w / 2), d = e.negative ? "right" : "left") : r === "inEnd" ? (c = t + (e.negative ? 1 : -1) * (o + n.w / 2), d = e.negative ? "left" : "right") : r !== "ctr" && (c = t + (e.negative ? -1 : 1) * (o + n.w / 2), d = e.negative ? "right" : "left");
780
- }
781
- }
782
- let p = Math.max(2, r * .5), m = Math.max(2, r * .9);
783
- if (s.w < p || s.h < m) return null;
784
- let h = {
785
- x: c - Math.min(n.w, s.w) / 2,
786
- y: l - Math.min(n.h, s.h) / 2,
787
- w: Math.min(n.w, s.w),
788
- h: Math.min(n.h, s.h)
789
- };
790
- if (i) {
791
- let e = Ue(i, a, h);
792
- if (!e) return null;
793
- h = e, d = "center", f = "middle";
794
- let n = Ke(e, t);
795
- if (!n || (s = n, s.w < p || s.h < m)) return null;
796
- }
797
- let g = Math.min(Math.max(p, h.w), s.w), _ = Math.min(Math.max(m, h.h), s.h), v = g / 2, y = _ / 2, b = u || i ? h.x + h.w / 2 : qe(h.x + h.w / 2, s.x + v, s.x + s.w - v), x = u || i ? h.y + h.h / 2 : qe(h.y + h.h / 2, s.y + y, s.y + s.h - y);
798
- return [b, x].every(Number.isFinite) ? {
799
- x: d === "left" ? b - v : d === "right" ? b + v : b,
800
- y: f === "top" ? x - y : f === "bottom" ? x + y : x,
801
- textAlign: d,
802
- textBaseline: f,
803
- maxWidth: s.w,
804
- maxHeight: s.h,
805
- clip: s,
806
- rect: h
807
- } : null;
808
- }
809
- var Ye = 4096, Xe = 4;
810
- function Ze(e, t, n) {
811
- if (n(e) <= t) return e;
812
- if (n("…") > t) return "";
813
- let r = 0, i = Array.from(e), a = i.length;
814
- for (; r < a;) {
815
- let e = Math.ceil((r + a) / 2);
816
- n(`${i.slice(0, e).join("")}…`) <= t ? r = e : a = e - 1;
817
- }
818
- return `${i.slice(0, r).join("")}…`;
819
- }
820
- function Qe(e) {
821
- let t = "", n = 0;
822
- for (let r of e) {
823
- if (n >= Ye) return {
824
- value: t,
825
- truncated: !0
826
- };
827
- t += r, n++;
828
- }
829
- return {
830
- value: t,
831
- truncated: !1
832
- };
833
- }
834
- function $e(e, t, n, r, i) {
835
- if (![
836
- t,
837
- n,
838
- r
839
- ].every(Number.isFinite) || t <= 0 || n < r || r <= 0) return [];
840
- let a = Math.max(1, Math.min(Xe, Math.floor(n / r))), o = Qe(e), s = o.value.split(/\r?\n/), c = [], l = o.truncated, u = (e) => {
841
- let n = [], r = "";
842
- for (let a of Array.from(e)) {
843
- let e = `${r}${a}`;
844
- r && i(e) > t ? (n.push(r), r = a) : r = e;
845
- }
846
- return r && n.push(r), n.filter((e) => i(e) <= t);
847
- };
848
- for (let e of s) {
849
- if (i(e) <= t) {
850
- c.push(e);
851
- continue;
852
- }
853
- let n = e.match(/\S+\s*|\s+/g) ?? [];
854
- if (n.length <= 1) c.push(...u(e));
855
- else {
856
- let e = "";
857
- for (let r of n) {
858
- let n = `${e}${r}`;
859
- if (i(n) <= t) e = n;
860
- else {
861
- e && c.push(e);
862
- let t = u(r);
863
- e = t.pop() ?? "", c.push(...t);
864
- }
865
- }
866
- e && c.push(e);
867
- }
868
- }
869
- l ||= c.length > a;
870
- let d = c.slice(0, a);
871
- return l && d.length > 0 && !d[d.length - 1].endsWith("…") && (d[d.length - 1] = Ze(`${d[d.length - 1]}…`, t, i)), d;
872
- }
873
- //#endregion
874
- //#region packages/core/src/chart/data-label-style.ts
875
- function I(e, t) {
876
- return (t?.deleted ?? e?.deleted) === !0;
877
- }
878
- function et(e, t) {
879
- let n = e?.fontPaintAuthored === !0 || e?.fontColor != null || e?.fontHidden === !0, r = t?.fontPaintAuthored === !0 || t?.fontColor != null || t?.fontHidden === !0;
880
- return {
881
- fontColor: n ? e.fontColor : e?.fontColor ?? t?.fontColor,
882
- fontItalic: e?.fontItalic ?? t?.fontItalic,
883
- fontLanguage: e?.fontLanguage ?? t?.fontLanguage,
884
- fontBaseline: e?.fontBaseline ?? t?.fontBaseline,
885
- fontPaintAuthored: n ? !0 : r || void 0,
886
- fontHidden: n ? e.fontHidden : t?.fontHidden,
887
- textRotation: e?.textRotation ?? t?.textRotation,
888
- textWrap: e?.textWrap ?? t?.textWrap,
889
- textVerticalAnchor: e?.textVerticalAnchor ?? t?.textVerticalAnchor,
890
- textVerticalMode: e?.textVerticalMode ?? t?.textVerticalMode,
891
- textLInsEmu: e?.textLInsEmu ?? t?.textLInsEmu,
892
- textTInsEmu: e?.textTInsEmu ?? t?.textTInsEmu,
893
- textRInsEmu: e?.textRInsEmu ?? t?.textRInsEmu,
894
- textBInsEmu: e?.textBInsEmu ?? t?.textBInsEmu,
895
- textBodyAuthored: e?.textBodyAuthored === !0 || t?.textBodyAuthored === !0 || void 0,
896
- textAlign: e?.textAlign ?? t?.textAlign
897
- };
898
- }
899
- function tt(e, t) {
900
- return e?.textAlign === "l" ? "left" : e?.textAlign === "r" ? "right" : e?.textAlign === "ctr" ? "center" : t;
901
- }
902
- function nt(e, i) {
903
- let a = i / n, o = e?.textBodyAuthored === !0 ? r : 0, s = e?.textBodyAuthored === !0 ? t : 0;
904
- return {
905
- left: (e?.textLInsEmu ?? o) * a,
906
- top: (e?.textTInsEmu ?? s) * a,
907
- right: (e?.textRInsEmu ?? o) * a,
908
- bottom: (e?.textBInsEmu ?? s) * a
909
- };
910
- }
911
- function rt(e, t) {
912
- let n = Number.isFinite(e) ? e / 6e4 * Math.PI / 180 : 0;
913
- return t === "vert" ? n + Math.PI / 2 : t === "vert270" ? n + Math.PI * 3 / 2 : n;
914
- }
915
- function it(e, t, n, r) {
916
- let i = rt(n, r);
917
- if (i === 0) return {
918
- w: e,
919
- h: t,
920
- radians: i
921
- };
922
- let a = Math.abs(Math.cos(i)), o = Math.abs(Math.sin(i));
923
- return {
924
- w: e * a + t * o,
925
- h: e * o + t * a,
926
- radians: i
927
- };
928
- }
929
- function at(e, t, n, r, i, a, o) {
930
- return r !== 0 && (e.translate(t, n), e.rotate(r), e.translate(-t, -n)), {
931
- x: t + (i === "left" ? o.left : i === "right" ? -o.right : (o.left - o.right) / 2),
932
- y: n + (a === "top" ? o.top : a === "bottom" ? -o.bottom : (o.top - o.bottom) / 2)
933
- };
934
- }
935
- function ot(e, t, n, r, i, a) {
936
- return a?.textWrap === "none" ? ![
937
- t,
938
- n,
939
- r
940
- ].every(Number.isFinite) || t <= 0 || n <= 0 || r <= 0 ? [] : Qe(e).value.split(/\r?\n/) : $e(e, t, n, r, i);
941
- }
942
- function st(e, t, n, r, i, a, o = "center", s = "center", c = n.w, l = 0) {
943
- if (!a) {
944
- let n = Math.max(0, c) / 2, r = (e) => e === "left" ? -n : e === "right" ? n : 0, i = r(o) - r(s);
945
- return {
946
- x: e + Math.cos(l) * i,
947
- y: t + Math.sin(l) * i
948
- };
949
- }
950
- let u = o === "left" ? n.x : o === "right" ? n.x + n.w : n.x + n.w / 2, d = i?.textVerticalAnchor ?? (i?.textBodyAuthored === !0 ? "t" : "ctr");
951
- return d === "t" ? {
952
- x: u,
953
- y: n.y + Math.min(r, n.h) / 2
954
- } : d === "b" ? {
955
- x: u,
956
- y: n.y + n.h - Math.min(r, n.h) / 2
957
- } : {
958
- x: u,
959
- y: n.y + n.h / 2
960
- };
961
- }
962
- //#endregion
963
- //#region packages/core/src/chart/legend-entry-plan.ts
964
- function ct(e, t = 1, n = !0) {
965
- return e === "pie" || e === "ofPie" ? !0 : e === "doughnut" && (t <= 1 || n);
966
- }
967
- function lt(e) {
968
- return e.chartType === "bubble" && e.series.length === 1 && e.series[0]?.bubbleXSourceIsString === !0 ? !0 : !!e.varyColors && e.series.length === 1 && typeof e.chartType == "string" && (/Bar/.test(e.chartType) || e.chartType === "line" || e.chartType === "stackedLine" || e.chartType === "stackedLinePct" || e.chartType === "scatter" || e.chartType === "radar" && e.radarStyle !== "filled");
969
- }
970
- function ut(e, t) {
971
- let n = 0;
972
- for (let r of e.series[t]?.trendLines ?? []) r.lineHidden === !0 || r.linePaintAuthored === !0 && r.lineColor == null || n++;
973
- return n;
974
- }
975
- function dt(e, t = !1) {
976
- let n = e.series.map(() => ({
977
- firstIndex: -1,
978
- count: 0,
979
- pointDriven: !1
980
- }));
981
- if (e.series.length === 0) return n;
982
- let r = ct(e.chartType, e.series.length, e.varyColors !== !1), i = lt(e);
983
- if (r || i) return n[0] = {
984
- firstIndex: 0,
985
- count: e.series[0]?.values.length ?? 0,
986
- pointDriven: !0
987
- }, n;
988
- let a = 0;
989
- for (let r = 0; r < e.series.length; r++) {
990
- let i = v(e, r), o = i?.kind !== "pie" && i?.kind !== "pie3D" && i?.kind !== "doughnut" && i?.kind !== "ofPie" && E(e, r), s = o ? e.series[r].values.length : 1;
991
- n[r] = {
992
- firstIndex: a,
993
- count: s,
994
- pointDriven: o
995
- }, a += s + (t ? ut(e, r) : 0);
996
- }
997
- return n;
998
- }
999
- function ft(e, t, n = 0) {
1000
- let r = e[t];
1001
- if (!r || r.firstIndex < 0 || r.count === 0) return null;
1002
- let i = r.pointDriven ? n : 0;
1003
- return i >= 0 && i < r.count ? r.firstIndex + i : null;
1004
- }
1005
- function pt(e) {
1006
- let t = /* @__PURE__ */ new Set();
1007
- for (let n of e.legendEntries ?? []) n.deleted === !0 && t.add(n.idx);
1008
- return t;
1009
- }
1010
- function mt(e, t, n, r = 0) {
1011
- let i = ft(e, n, r);
1012
- return i != null && !t.has(i);
1013
- }
1014
- function ht(e, t, n) {
1015
- let r = e[n];
1016
- if (!r || r.firstIndex < 0) return !1;
1017
- for (let e = 0; e < r.count; e++) if (!t.has(r.firstIndex + e)) return !0;
1018
- return !1;
1019
- }
1020
- //#endregion
1021
- //#region packages/core/src/chart/marker-style.ts
1022
- function gt(e) {
1023
- return e.markerSymbol != null || e.markerSize != null || e.markerFill != null || e.markerFillPaint !== void 0 || e.markerFillPaintAuthored === !0 || e.markerStyle != null || e.markerLine != null || e.markerLinePaintAuthored === !0 || e.markerLineWidthEmu != null;
1024
- }
1025
- function _t(e) {
1026
- return e != null && (e.markerSymbol != null || e.markerSize != null || e.markerFill != null || e.color != null || e.markerFillPaint !== void 0 || e.markerFillPaintAuthored === !0 || e.chartexStyle != null || e.markerStyle != null || e.markerLine != null || e.markerLinePaintAuthored === !0 || e.markerLineWidthEmu != null);
1027
- }
1028
- function vt(e, t) {
1029
- return t == null || !Number.isFinite(t) || t === 0 || t < 0 && e.showNegativeBubbles !== !0 ? null : Math.abs(t);
1030
- }
1031
- function yt(e, t) {
1032
- return e.bubble3D ?? e.bubble3DGroupDefault ?? !1;
1033
- }
1034
- function bt(e) {
1035
- return e !== "none" && e !== "x" && e !== "plus";
1036
- }
1037
- function xt(e, t, n, r, i, a) {
1038
- if (t.sourceHidden?.[r] === !0) return !1;
1039
- let o = a?.chartType ?? e.chartType, s = t.values[r] != null;
1040
- if (!s && (n === "line" || n === "stackedLine" || n === "stackedLinePct") && (s = (o === "line" || o === "stackedLine" || o === "stackedLinePct") && (o !== "line" || e.dispBlanksAs === "zero")), !s) return !1;
1041
- if (n === "scatter" && i) {
1042
- let n = (t.categories ?? e.categories)[r];
1043
- if (n == null || !Number.isFinite(Number.parseFloat(n))) return !1;
1044
- }
1045
- if (n === "scatter" && o === "bubble") {
1046
- let n = t.bubbleSizes?.[r];
1047
- if (n == null || !Number.isFinite(n) || n === 0) return !1;
1048
- let i = a?.showNegativeBubbles ?? e.showNegativeBubbles;
1049
- return n < 0 && i !== !0 ? !1 : (a?.bubbleScale ?? e.bubbleScale ?? 100) > 0;
1050
- }
1051
- return !0;
1052
- }
1053
- function L(e, t, n, r, i, a = 0) {
1054
- if (t.sourceHidden?.[r] === !0 || n === "surface" || n === "ofPie" || n === "doughnut" && a > 0) return !1;
1055
- if (n === "area" || n === "stackedArea" || n === "stackedAreaPct") return r < Math.max(e.categories.length, t.categories?.length ?? 0, t.values.length);
1056
- let o = t.values[r];
1057
- if ((n === "line" || n === "stackedLine" || n === "stackedLinePct") && o == null) return (e.chartType === "line" || e.chartType === "stackedLine" || e.chartType === "stackedLinePct") && (e.chartType !== "line" || e.dispBlanksAs === "zero");
1058
- if (o == null || !Number.isFinite(o)) return !1;
1059
- if (n === "pie" || n === "doughnut" || n === "ofPie") return t.values.some((e) => e != null && Number.isFinite(e) && Math.abs(e) > 0);
1060
- if (n === "scatter") {
1061
- if (!i) return !0;
1062
- let n = (t.categories ?? e.categories)[r];
1063
- return n != null && Number.isFinite(Number.parseFloat(n));
1064
- }
1065
- return !0;
1066
- }
1067
- function St(e, t, n, r, i, a, o = 0) {
1068
- if (n === "radar" || !t.seriesDataLabels && !t.dataLabelOverrides?.length) return 0;
1069
- let s = new Map((t.dataLabelOverrides ?? []).map((e) => [e.idx, e])), c = 0;
1070
- for (let a = 0; a < r; a++) {
1071
- let r = s.get(a);
1072
- I(t.seriesDataLabels, r) || (r?.showLegendKey ?? t.seriesDataLabels?.showLegendKey ?? !1) === !0 && L(e, t, n, a, i, o) && c++;
1073
- }
1074
- return c;
1075
- }
1076
- function R(e) {
1077
- return e === "line" || e === "stackedLine" || e === "stackedLinePct" || e === "area" || e === "stackedArea" || e === "stackedAreaPct" || e === "stock" || e === "clusteredBar" || e === "clusteredBarH" || e === "stackedBar" || e === "stackedBarH" || e === "stackedBarPct" || e === "stackedBarHPct";
1078
- }
1079
- function Ct(e) {
1080
- return e.dataPointOverrides?.some((e) => e.markerSymbol != null && e.markerSymbol !== "none") === !0;
1081
- }
1082
- function wt(e, t, n, r) {
1083
- return e === "radar" ? r === "filled" : e === "scatter" && t !== "bubble" && (n === "lineNoMarker" || n === "smoothNoMarker");
1084
- }
1085
- function Tt(e, t, n, r) {
1086
- let i = n.seriesType ?? e;
1087
- return !(i === "line" || i === "stackedLine" || i === "stackedLinePct" || i === "stock" || i === "radar") && i !== "scatter" && i !== "bubble" || i === "radar" && r === "filled" || i === "scatter" && (t === "lineNoMarker" || t === "smoothNoMarker") ? !1 : (n.markerSymbol ?? (i === "stock" ? "none" : "circle")) !== "none" && n.showMarker !== !1;
1088
- }
1089
- function Et(e, t, n, r) {
1090
- return t?.markerSymbol == null ? !r || e.markerSymbol === "none" ? "none" : e.markerSymbol ?? n : t.markerSymbol;
1091
- }
1092
- function Dt(e, t, n) {
1093
- if (t?.markerFillPaint !== void 0) return t.markerFillPaint;
1094
- if (!(t?.markerFill != null || t?.color != null || t?.markerFillPaintAuthored === !0) && e.dataPointColors?.[n] == null && e.markerFillPaint !== void 0) return e.markerFillPaint;
1095
- }
1096
- function Ot(e, t, n, r) {
1097
- return t?.markerFill == null ? t?.color == null ? e.dataPointColors?.[n] ?? (t?.markerFillPaintAuthored === !0 ? "00000000" : e.markerFill == null ? e.markerFillPaintAuthored === !0 ? "00000000" : r : e.markerFill) : t.color : t.markerFill;
1098
- }
1099
- function kt(e) {
1100
- return e.markerFillPaint;
1101
- }
1102
- function At(e, t) {
1103
- return e.markerFill == null ? e.markerFillPaintAuthored === !0 ? "00000000" : t : e.markerFill;
1104
- }
1105
- function jt(e) {
1106
- return e?.fillType === "gradient" ? e.stops.length : e == null ? 0 : 1;
1107
- }
1108
- //#endregion
1109
- //#region packages/core/src/chart/plot-groups.ts
1110
- var Mt = new Set([
1111
- "area3D",
1112
- "line3D",
1113
- "pie3D",
1114
- "bar3D",
1115
- "surface3D"
1116
- ]);
1117
- function Nt(e, t) {
1118
- return t === "bar" || t === "bar3D" ? e.includes("Bar") : t === "line" || t === "line3D" ? e.includes("Line") : t === "area" || t === "area3D" ? e.includes("Area") : t === "pie" || t === "pie3D" ? e === "pie" : t === "surface" || t === "surface3D" ? e === "surface" || e === "surface3D" : e === t;
1119
- }
1120
- function Pt(e) {
1121
- if (e.plotGroups == null) return !0;
1122
- let t = 0;
1123
- for (let n of e.plotGroups) {
1124
- if (!Number.isSafeInteger(n.seriesStart) || n.seriesStart !== t || !Number.isSafeInteger(n.seriesCount) || n.seriesCount < 0 || n.seriesCount > e.series.length - t) return !1;
1125
- t += n.seriesCount;
1126
- }
1127
- return t === e.series.length;
1128
- }
1129
- function Ft(e) {
1130
- let t = Array(e.series.length);
1131
- for (let n of e.plotGroups ?? []) {
1132
- let r = Math.min(e.series.length, n.seriesStart + n.seriesCount);
1133
- for (let e = n.seriesStart; e < r; e++) t[e] = n;
1134
- }
1135
- return t;
1136
- }
1137
- function It(e, t) {
1138
- return t ? t.kind === "bubble" ? "bubble" : t.kind === "line" ? t.grouping === "percentStacked" ? "stackedLinePct" : t.grouping === "stacked" ? "stackedLine" : "line" : t.kind === "area" ? t.grouping === "percentStacked" ? "stackedAreaPct" : t.grouping === "stacked" ? "stackedArea" : "area" : t.kind : e;
1139
- }
1140
- function Lt(e) {
1141
- if (e.plotGroups == null || e.plotGroups.length <= 1) return "legacy";
1142
- if (!Pt(e)) return "unsupported";
1143
- let t = e.plotGroups.filter((e) => e.seriesCount > 0);
1144
- if (t.length === 0) return "legacy";
1145
- if (t.length === 1) return Nt(e.chartType, t[0].kind) ? "legacy" : "unsupported";
1146
- if (t.some((e) => e.categoryAxis === "none" || e.valueAxis === "none") || t.some((t) => t.categoryAxis === "secondary" && e.secondaryCatAxis == null || t.valueAxis === "secondary" && e.secondaryValAxis == null)) return "unsupported";
1147
- let n = new Set(t.map((e) => e.kind));
1148
- if (t.some((e) => Mt.has(e.kind))) return "unsupported";
1149
- if (t.length === 2 && t[0].kind === "bar" && t[1].kind === "scatter") {
1150
- let [n, r] = t, i = e.series.slice(n.seriesStart, n.seriesStart + n.seriesCount), a = e.series.slice(r.seriesStart, r.seriesStart + r.seriesCount);
1151
- return n.categoryAxis === "primary" && (n.valueAxis === "primary" || n.valueAxis === "unresolved") && (r.categoryAxis === "secondary" || r.categoryAxis === "unresolved") && r.valueAxis === "secondary" && e.secondaryCatAxis != null && e.secondaryValAxis != null && i.every((e) => e.useSecondaryAxis !== !0) && a.every((e) => e.useSecondaryAxis === !0) ? "bar-combo" : "unsupported";
1152
- }
1153
- if (t.some((e) => e.categoryAxis === "unresolved" || e.valueAxis === "unresolved" || e.seriesAxis === "unresolved")) return "unsupported";
1154
- if (n.size === 1) {
1155
- let n = t[0].kind;
1156
- if (n === "line" || n === "area") return t.some((e) => e.categoryAxis !== "primary") ? "unsupported" : n === "line" ? "line-groups" : "area-groups";
1157
- if (n === "scatter" || n === "bubble") return "scatter-bubble";
1158
- if (n === "bar") {
1159
- let n = e.chartType.endsWith("H") ? "bar" : "col";
1160
- return new Set(t.map((e) => e.barDirection ?? n)).size > 1 && (t.length !== 2 || t.some((e) => e.categoryAxis !== "primary" || e.valueAxis !== "primary")) ? "unsupported" : "bar-combo";
1161
- }
1162
- return "unsupported";
1163
- }
1164
- if (t.length === 2 && n.has("bar") && n.has("area")) return t.find((e) => e.kind === "line" || e.kind === "area")?.categoryAxis === "primary" ? "bar-combo" : "unsupported";
1165
- if (t.length === 2 && t[0].kind === "area" && t[1].kind === "line" && t.every((e) => e.categoryAxis === "primary" && e.valueAxis === "primary")) return "area-groups";
1166
- if (n.size === 2 && n.has("bar") && n.has("line")) {
1167
- let n = t.filter((e) => e.kind === "bar"), r = t.filter((e) => e.kind === "line"), i = e.chartType.endsWith("H") ? "bar" : "col", a = new Set(n.map((e) => e.barDirection ?? i));
1168
- return n.length <= 2 && r.length === 1 && t.length <= 3 && a.size === 1 && t.every((e) => e.categoryAxis === "primary") ? "bar-combo" : "unsupported";
1169
- }
1170
- return [...n].every((e) => e === "scatter" || e === "bubble") ? t.length > 2 ? "unsupported" : "scatter-bubble" : t.length === 2 && t[0].kind === "stock" && t[1].kind === "line" && (t[0].seriesCount === 3 || t[0].seriesCount === 4) && (t[1].grouping == null || t[1].grouping === "standard") && t.every((e) => e.categoryAxis === "primary" && e.valueAxis === "primary") ? "stock-line" : "unsupported";
1171
- }
1172
- //#endregion
1173
- //#region packages/core/src/chart/of-pie.ts
1174
- function Rt(e, t) {
1175
- let n = e?.splitType ?? "auto", r = e?.splitPos, i = /* @__PURE__ */ new Set();
1176
- if ((e?.splitPosAuthored === !0 || r != null) && (![
1177
- "percent",
1178
- "pos",
1179
- "val"
1180
- ].includes(n) || r == null || !Number.isFinite(r))) return null;
1181
- if (n === "auto") {
1182
- if (e?.splitTypeAuthored === !0) return null;
1183
- let n = Math.ceil(t.length / 3);
1184
- for (let e = Math.max(0, t.length - n); e < t.length; e++) i.add(e);
1185
- return i;
1186
- }
1187
- if (n === "cust") {
1188
- if (e?.customSplitIndices == null) return null;
1189
- for (let n of e.customSplitIndices) Number.isSafeInteger(n) && n >= 0 && n < t.length && i.add(n);
1190
- return i;
1191
- }
1192
- if (r == null || !Number.isFinite(r)) return null;
1193
- if (n === "pos") {
1194
- if (!Number.isInteger(r) || r < 0 || r > 32e3) return null;
1195
- let e = Math.min(t.length, r);
1196
- for (let n = t.length - e; n < t.length; n++) i.add(n);
1197
- return i;
1198
- }
1199
- if (n === "val") {
1200
- for (let e = 0; e < t.length; e++) {
1201
- let n = t[e];
1202
- n != null && Number.isFinite(n) && n < r && i.add(e);
1203
- }
1204
- return i;
1205
- }
1206
- if (r < 0 || r > 100) return null;
1207
- let a = 0;
1208
- for (let e of t) e != null && Number.isFinite(e) && (a += Math.abs(e));
1209
- if (!(a > 0)) return i;
1210
- for (let e = 0; e < t.length; e++) {
1211
- let n = t[e];
1212
- n != null && Number.isFinite(n) && Math.abs(n) / a * 100 < r && i.add(e);
1213
- }
1214
- return i;
1215
- }
1216
- //#endregion
1217
- //#region packages/core/src/canvas/aux-canvas.ts
1218
- function zt(e, t) {
1219
- return [Math.max(1, Math.ceil(e)), Math.max(1, Math.ceil(t))];
1220
- }
1221
- function z(e, t) {
1222
- let [n, r] = zt(e, t);
1223
- if (typeof OffscreenCanvas < "u") return new OffscreenCanvas(n, r);
1224
- if (typeof document < "u") {
1225
- let e = document.createElement("canvas");
1226
- return e.width = n, e.height = r, e;
1227
- }
1228
- return null;
1229
- }
1230
- function Bt(e, t, n) {
1231
- let [r, i] = zt(t, n);
1232
- if (typeof OffscreenCanvas < "u") try {
1233
- return new OffscreenCanvas(r, i);
1234
- } catch {}
1235
- if (typeof document < "u") try {
1236
- let e = document.createElement("canvas");
1237
- return e.width = r, e.height = i, e;
1238
- } catch {}
1239
- try {
1240
- let t = e.canvas?.constructor;
1241
- return typeof t == "function" ? new t(r, i) : null;
1242
- } catch {
1243
- return null;
1244
- }
1245
- }
1246
- //#endregion
1247
- //#region packages/core/src/image/dib.ts
1248
- var Vt = a, Ht = i;
1249
- function Ut(e, t, n, r, i) {
1250
- if (n < 40 || t + 40 > e.byteLength) return null;
1251
- let a = e.getUint32(t, !0);
1252
- if (a < 40) return null;
1253
- let o = e.getInt32(t + 4, !0), s = e.getInt32(t + 8, !0), c = e.getUint16(t + 14, !0);
1254
- if (e.getUint32(t + 16, !0) !== 0) return null;
1255
- let l = s < 0, u = Math.abs(o), d = Math.abs(s);
1256
- if (u <= 0 || d <= 0 || u > Vt || d > Vt || u * d > Ht) return null;
1257
- let f = new Uint8ClampedArray(u * d * 4), p = u * c + 31 >> 5 << 2 >>> 0;
1258
- if (r + p * d > r + i + p && r + p * d > e.byteLength) return null;
1259
- let m = null;
1260
- if (c <= 8) {
1261
- let n = e.getUint32(t + 32, !0);
1262
- n === 0 && (n = 1 << c);
1263
- let r = t + a;
1264
- m = [];
1265
- for (let t = 0; t < n; t++) {
1266
- let n = r + t * 4;
1267
- if (n + 4 > e.byteLength) break;
1268
- let i = e.getUint8(n), a = e.getUint8(n + 1), o = e.getUint8(n + 2);
1269
- m.push(o << 16 | a << 8 | i);
1270
- }
1271
- }
1272
- let h = (e, t, n, r, i, a) => {
1273
- let o = (e * u + t) * 4;
1274
- f[o] = n, f[o + 1] = r, f[o + 2] = i, f[o + 3] = a;
1275
- }, g = !1;
1276
- for (let t = 0; t < d; t++) {
1277
- let n = l ? t : d - 1 - t, i = t, a = r + n * p;
1278
- if (a + p > e.byteLength) break;
1279
- if (c === 32) for (let t = 0; t < u; t++) {
1280
- let n = a + t * 4, r = e.getUint8(n), o = e.getUint8(n + 1), s = e.getUint8(n + 2), c = e.getUint8(n + 3);
1281
- c !== 0 && (g = !0), h(i, t, s, o, r, c);
1282
- }
1283
- else if (c === 24) {
1284
- for (let t = 0; t < u; t++) {
1285
- let n = a + t * 3;
1286
- h(i, t, e.getUint8(n + 2), e.getUint8(n + 1), e.getUint8(n), 255);
1287
- }
1288
- g = !0;
1289
- } else if (c === 8 && m) {
1290
- for (let t = 0; t < u; t++) {
1291
- let n = e.getUint8(a + t), r = m[n] ?? 0;
1292
- h(i, t, r >> 16 & 255, r >> 8 & 255, r & 255, 255);
1293
- }
1294
- g = !0;
1295
- } else if (c === 4 && m) {
1296
- for (let t = 0; t < u; t++) {
1297
- let n = e.getUint8(a + (t >> 1)), r = t & 1 ? n & 15 : n >> 4 & 15, o = m[r] ?? 0;
1298
- h(i, t, o >> 16 & 255, o >> 8 & 255, o & 255, 255);
1299
- }
1300
- g = !0;
1301
- } else if (c === 1 && m) {
1302
- for (let t = 0; t < u; t++) {
1303
- let n = e.getUint8(a + (t >> 3)) >> 7 - (t & 7) & 1, r = m[n] ?? 0;
1304
- h(i, t, r >> 16 & 255, r >> 8 & 255, r & 255, 255);
1305
- }
1306
- g = !0;
1307
- } else return null;
1308
- }
1309
- if (c === 32 && !g) for (let e = 3; e < f.length; e += 4) f[e] = 255;
1310
- return {
1311
- width: u,
1312
- height: d,
1313
- data: f
1314
- };
1315
- }
1316
- function Wt(e, t, n) {
1317
- if (n < 40 || t + 40 > e.byteLength) return null;
1318
- let r = e.getUint32(t, !0);
1319
- if (r < 40) return null;
1320
- let i = e.getUint16(t + 14, !0), a = 0;
1321
- if (i <= 8) {
1322
- let n = e.getUint32(t + 32, !0);
1323
- n === 0 && (n = 1 << i), a = n;
1324
- } else a = e.getUint32(t + 32, !0);
1325
- let o = r + a * 4, s = t + o, c = n - o;
1326
- return c <= 0 ? null : Ut(e, t, o, s, c);
1327
- }
1328
- function Gt(e, t, n, r, i, a) {
1329
- try {
1330
- let o = z(t.width, t.height);
1331
- if (!o) return !1;
1332
- let s = o.getContext("2d");
1333
- if (!s) return !1;
1334
- let c = s.createImageData(t.width, t.height);
1335
- c.data.set(t.data), s.putImageData(c, 0, 0);
1336
- let l = Math.min(n, i), u = Math.min(r, a), d = Math.abs(i - n), f = Math.abs(a - r);
1337
- return e.drawImage(o, l, u, d, f), !0;
1338
- } catch {
1339
- return !1;
1340
- }
1341
- }
1342
- //#endregion
1343
- //#region packages/core/src/image/wmf.ts
1344
- var B = {
1345
- EOF: 0,
1346
- SETBKMODE: 258,
1347
- SETTEXTALIGN: 302,
1348
- SETTEXTCOLOR: 521,
1349
- SETPOLYFILLMODE: 262,
1350
- SETWINDOWORG: 523,
1351
- SETWINDOWEXT: 524,
1352
- SELECTOBJECT: 301,
1353
- DELETEOBJECT: 496,
1354
- TEXTOUT: 1313,
1355
- POLYGON: 804,
1356
- POLYLINE: 805,
1357
- POLYPOLYGON: 1336,
1358
- RECTANGLE: 1051,
1359
- CREATEPENINDIRECT: 762,
1360
- CREATEFONTINDIRECT: 763,
1361
- CREATEBRUSHINDIRECT: 764,
1362
- DIBBITBLT: 2368,
1363
- DIBSTRETCHBLT: 2881,
1364
- STRETCHDIBITS: 3907
1365
- }, Kt = 2596720087, qt = 22, Jt = 18, Yt = 1179469088;
1366
- function Xt(e, t) {
1367
- if (e.length < t + Jt) return !1;
1368
- let n = e[t] | e[t + 1] << 8, r = e[t + 2] | e[t + 3] << 8;
1369
- return (n === 1 || n === 2) && r === 9;
1370
- }
1371
- function Zt(e) {
1372
- return e.length < 4 ? !1 : (e[0] | e[1] << 8 | e[2] << 16 | e[3] << 24) >>> 0 === Kt ? !0 : Xt(e, 0);
1373
- }
1374
- function Qt(e) {
1375
- if (e.length < 44) return !1;
1376
- let t = new DataView(e.buffer, e.byteOffset, e.byteLength);
1377
- return t.getUint32(0, !0) === 1 && t.getUint32(40, !0) === Yt;
1378
- }
1379
- function $t(e) {
1380
- return e === "image/wmf" || e === "image/emf";
1381
- }
1382
- function en(e) {
1383
- let t = e & 255, n = e >>> 8 & 255, r = e >>> 16 & 255, i = (e) => e.toString(16).padStart(2, "0");
1384
- return `#${i(t)}${i(n)}${i(r)}`;
1385
- }
1386
- function tn(e, t) {
1387
- for (let n = 0; n < e.length; n++) if (e[n] == null) {
1388
- e[n] = t;
1389
- return;
1390
- }
1391
- e.push(t);
1392
- }
1393
- var nn = class {
1394
- p = 0;
1395
- constructor(e, t, n) {
1396
- this.b = e, this.end = n, this.p = t;
1397
- }
1398
- get remaining() {
1399
- return this.end - this.p;
1400
- }
1401
- i16() {
1402
- let e = this.u16();
1403
- return e >= 32768 ? e - 65536 : e;
1404
- }
1405
- u16() {
1406
- let e = this.b[this.p] | this.b[this.p + 1] << 8;
1407
- return this.p += 2, e;
1408
- }
1409
- u8() {
1410
- return this.b[this.p++];
1411
- }
1412
- u32() {
1413
- let e = (this.b[this.p] | this.b[this.p + 1] << 8 | this.b[this.p + 2] << 16 | this.b[this.p + 3] << 24) >>> 0;
1414
- return this.p += 4, e;
1415
- }
1416
- bytes(e) {
1417
- let t = Math.min(this.p + Math.max(0, e), this.end), n = this.b.subarray(this.p, t);
1418
- return this.p = t, n;
1419
- }
1420
- skip(e) {
1421
- this.p = Math.min(this.p + Math.max(0, e), this.end);
1422
- }
1423
- };
1424
- function V(e, t) {
1425
- return (t - e.orgX) * (e.W / e.extX);
1426
- }
1427
- function H(e, t) {
1428
- return (t - e.orgY) * (e.H / e.extY);
1429
- }
1430
- function rn(e, t) {
1431
- let n = t * Math.abs(e.W / e.extX);
1432
- return n >= 1 ? n : 1;
1433
- }
1434
- var an = .001;
1435
- function on(e, t, n) {
1436
- return Math.abs(e - t) <= an || Math.abs(e - n) <= an;
1437
- }
1438
- function sn(e, t, n) {
1439
- let r = [], i = n ? t.length : t.length - 1;
1440
- for (let n = 0; n < i; n++) {
1441
- let i = t[n], a = t[(n + 1) % t.length], o = Math.abs(i[0] - a[0]) <= an && on(i[0], 0, e.W) && on(a[0], 0, e.W), s = Math.abs(i[1] - a[1]) <= an && on(i[1], 0, e.H) && on(a[1], 0, e.H);
1442
- o || s || r.push([i, a]);
1443
- }
1444
- return r;
1445
- }
1446
- function cn(e, t, n) {
1447
- if (!e.curPen || e.curPen.stroke == null || t.length < 2) return;
1448
- let { ctx: r } = e;
1449
- if (r.strokeStyle = e.curPen.stroke, r.lineWidth = rn(e, e.curPen.width), !e.suppressBoundaryFrame) {
1450
- r.beginPath(), r.moveTo(t[0][0], t[0][1]);
1451
- for (let e = 1; e < t.length; e++) r.lineTo(t[e][0], t[e][1]);
1452
- n && r.closePath(), r.stroke(), e.drew = !0;
1453
- return;
1454
- }
1455
- let i = sn(e, t, n);
1456
- if (i.length === 0) return;
1457
- r.beginPath();
1458
- let a = null;
1459
- for (let [e, t] of i) (!a || a[0] !== e[0] || a[1] !== e[1]) && r.moveTo(e[0], e[1]), r.lineTo(t[0], t[1]), a = t;
1460
- r.stroke(), e.drew = !0;
1461
- }
1462
- function ln(e, t, n) {
1463
- let r = [];
1464
- for (let i = 0; i < n && !(t.remaining < 4); i++) {
1465
- let n = t.i16(), i = t.i16();
1466
- r.push([V(e, n), H(e, i)]);
1467
- }
1468
- return r;
1469
- }
1470
- function un(e, t) {
1471
- t.length < 2 || !e.curPen || e.curPen.stroke == null || cn(e, t, !1);
1472
- }
1473
- function dn(e, t) {
1474
- if (t.length < 2) return;
1475
- let { ctx: n } = e;
1476
- if (e.curBrush && e.curBrush.fill != null) {
1477
- n.beginPath(), n.moveTo(t[0][0], t[0][1]);
1478
- for (let e = 1; e < t.length; e++) n.lineTo(t[e][0], t[e][1]);
1479
- n.closePath(), n.fillStyle = e.curBrush.fill, n.fill(e.fillRule), e.drew = !0;
1480
- }
1481
- cn(e, t, !0);
1482
- }
1483
- function fn(e, t) {
1484
- let n = t.u16();
1485
- if (n <= 0 || n > 65536) return;
1486
- let r = [];
1487
- for (let e = 0; e < n; e++) {
1488
- if (t.remaining < 2) return;
1489
- r.push(t.u16());
1490
- }
1491
- let { ctx: i } = e;
1492
- i.beginPath();
1493
- let a = !1;
1494
- for (let n of r) {
1495
- if (n < 2) {
1496
- for (let e = 0; e < n && t.remaining >= 4; e++) t.i16(), t.i16();
1497
- continue;
1498
- }
1499
- let r = ln(e, t, n);
1500
- if (!(r.length < 2)) {
1501
- i.moveTo(r[0][0], r[0][1]);
1502
- for (let e = 1; e < r.length; e++) i.lineTo(r[e][0], r[e][1]);
1503
- i.closePath(), a = !0;
1504
- }
1505
- }
1506
- a && (e.curBrush && e.curBrush.fill != null && (i.fillStyle = e.curBrush.fill, i.fill(e.fillRule), e.drew = !0), e.curPen && e.curPen.stroke != null && (i.strokeStyle = e.curPen.stroke, i.lineWidth = rn(e, e.curPen.width), i.stroke(), e.drew = !0));
1507
- }
1508
- function pn(e) {
1509
- let t = e.u16(), n = e.i16();
1510
- e.i16();
1511
- let r = e.u32();
1512
- return {
1513
- kind: "pen",
1514
- stroke: (t & 255) == 5 ? null : en(r),
1515
- width: Math.abs(n)
1516
- };
1517
- }
1518
- function mn(e) {
1519
- let t = e.u16(), n = e.u32();
1520
- return e.u16(), {
1521
- kind: "brush",
1522
- fill: t === 1 ? null : en(n)
1523
- };
1524
- }
1525
- function hn(e) {
1526
- let t = e.indexOf(0), n = t >= 0 ? e.subarray(0, t) : e;
1527
- if (n.length === 0) return "";
1528
- try {
1529
- return new TextDecoder("shift_jis").decode(n);
1530
- } catch {
1531
- return String.fromCharCode(...n);
1532
- }
1533
- }
1534
- function gn(e) {
1535
- let t = Math.abs(e.i16());
1536
- e.i16(), e.i16(), e.i16();
1537
- let n = e.i16(), r = e.u8() !== 0;
1538
- return e.u8(), e.u8(), e.u8(), e.u8(), e.u8(), e.u8(), e.u8(), {
1539
- kind: "font",
1540
- height: t,
1541
- weight: n,
1542
- italic: r,
1543
- face: hn(e.bytes(Math.min(32, e.remaining)))
1544
- };
1545
- }
1546
- function _n(e, t, n, r) {
1547
- if (t.length === 0) return;
1548
- let i = e.curFont, a = i?.height || 12, o = Math.abs(H(e, e.orgY + a) - H(e, e.orgY));
1549
- if (!Number.isFinite(o) || o < 1) return;
1550
- let { ctx: s } = e;
1551
- try {
1552
- s.fillStyle = e.textColor;
1553
- let a = i && i.weight >= 700 ? "bold " : "";
1554
- s.font = `${i?.italic ? "italic " : ""}${a}${o}px ${i?.face || "sans-serif"}`;
1555
- let c = e.textAlign & 6;
1556
- s.textAlign = c === 2 ? "right" : c === 6 ? "center" : "left", s.textBaseline = (e.textAlign & 24) == 24 ? "alphabetic" : "top", s.fillText(t, V(e, n), H(e, r)), e.drew = !0;
1557
- } catch {}
1558
- }
1559
- function vn(e, t, n, r, i = !1) {
1560
- if (!Zt(e)) return !1;
1561
- let a = 0;
1562
- (e.length >= 4 ? (e[0] | e[1] << 8 | e[2] << 16 | e[3] << 24) >>> 0 : 0) === Kt && (a = qt);
1563
- let o = a + Jt;
1564
- if (o > e.length) return !1;
1565
- let s = {
1566
- ctx: t,
1567
- W: n,
1568
- H: r,
1569
- orgX: 0,
1570
- orgY: 0,
1571
- extX: n || 1,
1572
- extY: r || 1,
1573
- haveExt: !1,
1574
- objects: [],
1575
- curPen: null,
1576
- curBrush: null,
1577
- curFont: null,
1578
- textColor: "#000000",
1579
- textAlign: 0,
1580
- fillRule: "nonzero",
1581
- drew: !1,
1582
- suppressBoundaryFrame: i
1583
- }, c = new DataView(e.buffer, e.byteOffset, e.byteLength);
1584
- for (; o + 6 <= e.length;) {
1585
- let t = c.getUint32(o, !0), n = c.getUint16(o + 4, !0);
1586
- if (t < 3) break;
1587
- let r = t * 2, i = o + r;
1588
- if (i > e.length || n === B.EOF) break;
1589
- let a = o + 6, l = new nn(e, a, i);
1590
- switch (n) {
1591
- case B.SETWINDOWORG:
1592
- s.orgY = l.i16(), s.orgX = l.i16();
1593
- break;
1594
- case B.SETWINDOWEXT: {
1595
- let e = l.i16(), t = l.i16();
1596
- s.extY = e || 1, s.extX = t || 1, s.haveExt = !0;
1597
- break;
1598
- }
1599
- case B.SETPOLYFILLMODE:
1600
- s.fillRule = l.u16() === 1 ? "evenodd" : "nonzero";
1601
- break;
1602
- case B.SETTEXTCOLOR:
1603
- s.textColor = en(l.u32());
1604
- break;
1605
- case B.SETTEXTALIGN:
1606
- s.textAlign = l.u16();
1607
- break;
1608
- case B.CREATEPENINDIRECT:
1609
- tn(s.objects, pn(l));
1610
- break;
1611
- case B.CREATEBRUSHINDIRECT:
1612
- tn(s.objects, mn(l));
1613
- break;
1614
- case B.CREATEFONTINDIRECT:
1615
- tn(s.objects, gn(l));
1616
- break;
1617
- case B.SELECTOBJECT: {
1618
- let e = l.u16(), t = s.objects[e];
1619
- t?.kind === "pen" ? s.curPen = t : t?.kind === "brush" ? s.curBrush = t : t?.kind === "font" && (s.curFont = t);
1620
- break;
1621
- }
1622
- case B.DELETEOBJECT: {
1623
- let e = l.u16(), t = s.objects[e];
1624
- t && (t === s.curPen && (s.curPen = null), t === s.curBrush && (s.curBrush = null), t === s.curFont && (s.curFont = null), s.objects[e] = null);
1625
- break;
1626
- }
1627
- case B.POLYLINE:
1628
- un(s, ln(s, l, l.i16()));
1629
- break;
1630
- case B.POLYGON:
1631
- dn(s, ln(s, l, l.i16()));
1632
- break;
1633
- case B.POLYPOLYGON:
1634
- fn(s, l);
1635
- break;
1636
- case B.RECTANGLE: {
1637
- let e = l.i16(), t = l.i16(), n = l.i16(), r = l.i16();
1638
- dn(s, [
1639
- [V(s, r), H(s, n)],
1640
- [V(s, t), H(s, n)],
1641
- [V(s, t), H(s, e)],
1642
- [V(s, r), H(s, e)]
1643
- ]);
1644
- break;
1645
- }
1646
- case B.TEXTOUT: {
1647
- let e = l.u16(), t = hn(l.bytes(e));
1648
- e % 2 != 0 && l.skip(1);
1649
- let n = l.i16();
1650
- _n(s, t, l.i16(), n);
1651
- break;
1652
- }
1653
- case B.STRETCHDIBITS: {
1654
- l.u32(), l.i16(), l.i16(), l.i16(), l.i16(), l.u16();
1655
- let e = l.i16(), t = l.i16(), n = l.i16(), r = l.i16(), o = a + 22, u = Wt(c, o, i - o);
1656
- if (u) {
1657
- let i = V(s, r), a = H(s, n), o = V(s, r + t), c = H(s, n + e);
1658
- Gt(s.ctx, u, i, a, o, c) && (s.drew = !0);
1659
- }
1660
- break;
1661
- }
1662
- case B.DIBSTRETCHBLT:
1663
- case B.DIBBITBLT:
1664
- case B.SETBKMODE: break;
1665
- default: break;
1666
- }
1667
- o = i;
1668
- }
1669
- return s.drew;
1670
- }
1671
- var yn = 2e3, bn = 2;
1672
- function xn(e, t) {
1673
- let n = e > 0 ? e : 300, r = t > 0 ? t : 300, i = (e) => Math.max(1, Math.min(yn, Math.round(e)));
1674
- return {
1675
- w: i(n * bn),
1676
- h: i(r * bn)
1677
- };
1678
- }
1679
- async function Sn(e, t, n, r = !1) {
1680
- if (!Zt(e) || t <= 0 || n <= 0) return null;
1681
- let i = z(t, n);
1682
- if (!i) return null;
1683
- let a = i.getContext("2d");
1684
- return !a || (a.lineJoin = "round", a.lineCap = "round", !vn(e, a, t, n, r)) ? null : createImageBitmap(i);
1685
- }
1686
- //#endregion
1687
- //#region packages/core/src/image/crop.ts
1688
- function Cn(e) {
1689
- if (!e) return !0;
1690
- if (![
1691
- e.l,
1692
- e.t,
1693
- e.r,
1694
- e.b
1695
- ].every(Number.isFinite)) return !1;
1696
- let t = e.l, n = e.t, r = 1 - e.r, i = 1 - e.b;
1697
- return r > t && i > n && Math.min(1, r) > Math.max(0, t) && Math.min(1, i) > Math.max(0, n);
1698
- }
1699
- function wn(e) {
1700
- let t = e;
1701
- return {
1702
- w: t.naturalWidth || (typeof t.width == "number" ? t.width : 0) || 0,
1703
- h: t.naturalHeight || (typeof t.height == "number" ? t.height : 0) || 0
1704
- };
1705
- }
1706
- function Tn(e, t) {
1707
- if (!t || !(t.l || t.t || t.r || t.b) || ![
1708
- t.l,
1709
- t.t,
1710
- t.r,
1711
- t.b
1712
- ].every(Number.isFinite)) return null;
1713
- let { w: n, h: r } = wn(e);
1714
- if (n <= 0 || r <= 0) return null;
1715
- let i = t.l, a = t.t, o = 1 - t.r, s = 1 - t.b, c = o - i, l = s - a;
1716
- if (!(c > 0) || !(l > 0)) return {
1717
- sx: 0,
1718
- sy: 0,
1719
- sw: 0,
1720
- sh: 0,
1721
- dxFraction: 0,
1722
- dyFraction: 0,
1723
- dwFraction: 0,
1724
- dhFraction: 0
1725
- };
1726
- let u = Math.max(0, i), d = Math.max(0, a), f = Math.min(1, o), p = Math.min(1, s), m = Math.max(0, f - u), h = Math.max(0, p - d);
1727
- return {
1728
- sx: u * n,
1729
- sy: d * r,
1730
- sw: m * n,
1731
- sh: h * r,
1732
- dxFraction: (u - i) / c,
1733
- dyFraction: (d - a) / l,
1734
- dwFraction: m / c,
1735
- dhFraction: h / l
1736
- };
1737
- }
1738
- function En(e, t, n, r, i, a, o) {
1739
- let s = Tn(t, n);
1740
- s ? s.sw > 0 && s.sh > 0 && s.dwFraction > 0 && s.dhFraction > 0 && e.drawImage(t, s.sx, s.sy, s.sw, s.sh, r + s.dxFraction * a, i + s.dyFraction * o, s.dwFraction * a, s.dhFraction * o) : e.drawImage(t, r, i, a, o);
1741
- }
1742
- function Dn(e, t, n) {
1743
- if (!Number.isFinite(e) || !Number.isFinite(t) || !(e > 0) || !(t > 0)) return null;
1744
- let r = n ? 1 - n.l - n.r : 1, i = n ? 1 - n.t - n.b : 1;
1745
- if (!Number.isFinite(r) || !Number.isFinite(i) || !(r > 0) || !(i > 0) || !Cn(n)) return null;
1746
- let a = Math.ceil(e / r), o = Math.ceil(t / i);
1747
- return Number.isFinite(a) && Number.isFinite(o) ? {
1748
- width: a,
1749
- height: o
1750
- } : null;
1751
- }
1752
- function On(e, t, n, r) {
1753
- if (!t || !$t(e)) return {
1754
- widthPt: n,
1755
- heightPt: r
1756
- };
1757
- if (!Cn(t)) return null;
1758
- let i = 1 - t.l - t.r, a = 1 - t.t - t.b;
1759
- return {
1760
- widthPt: n / i,
1761
- heightPt: r / a
1762
- };
1763
- }
1764
- //#endregion
1765
- //#region packages/core/src/shape/pattern-bitmaps.ts
1766
- var kn = {
1767
- pct5: [
1768
- 0,
1769
- 16,
1770
- 0,
1771
- 0,
1772
- 0,
1773
- 1,
1774
- 0,
1775
- 0
1776
- ],
1777
- pct10: [
1778
- 136,
1779
- 0,
1780
- 34,
1781
- 0,
1782
- 136,
1783
- 0,
1784
- 34,
1785
- 0
1786
- ],
1787
- pct20: [
1788
- 136,
1789
- 34,
1790
- 136,
1791
- 34,
1792
- 136,
1793
- 34,
1794
- 136,
1795
- 34
1796
- ],
1797
- pct25: [
1798
- 136,
1799
- 85,
1800
- 34,
1801
- 85,
1802
- 136,
1803
- 85,
1804
- 34,
1805
- 85
1806
- ],
1807
- pct30: [
1808
- 170,
1809
- 85,
1810
- 170,
1811
- 85,
1812
- 170,
1813
- 85,
1814
- 170,
1815
- 85
1816
- ],
1817
- pct40: [
1818
- 170,
1819
- 119,
1820
- 170,
1821
- 221,
1822
- 170,
1823
- 119,
1824
- 170,
1825
- 221
1826
- ],
1827
- pct50: [
1828
- 170,
1829
- 85,
1830
- 170,
1831
- 85,
1832
- 170,
1833
- 85,
1834
- 170,
1835
- 85
1836
- ],
1837
- pct60: [
1838
- 221,
1839
- 85,
1840
- 119,
1841
- 85,
1842
- 221,
1843
- 85,
1844
- 119,
1845
- 85
1846
- ],
1847
- pct70: [
1848
- 238,
1849
- 85,
1850
- 187,
1851
- 85,
1852
- 238,
1853
- 85,
1854
- 187,
1855
- 85
1856
- ],
1857
- pct75: [
1858
- 238,
1859
- 170,
1860
- 187,
1861
- 170,
1862
- 238,
1863
- 170,
1864
- 187,
1865
- 170
1866
- ],
1867
- pct80: [
1868
- 254,
1869
- 239,
1870
- 251,
1871
- 191,
1872
- 254,
1873
- 239,
1874
- 251,
1875
- 191
1876
- ],
1877
- pct90: [
1878
- 255,
1879
- 239,
1880
- 255,
1881
- 251,
1882
- 255,
1883
- 239,
1884
- 255,
1885
- 251
1886
- ],
1887
- horz: [
1888
- 255,
1889
- 0,
1890
- 0,
1891
- 0,
1892
- 255,
1893
- 0,
1894
- 0,
1895
- 0
1896
- ],
1897
- vert: [
1898
- 136,
1899
- 136,
1900
- 136,
1901
- 136,
1902
- 136,
1903
- 136,
1904
- 136,
1905
- 136
1906
- ],
1907
- ltHorz: [
1908
- 0,
1909
- 255,
1910
- 0,
1911
- 0,
1912
- 0,
1913
- 0,
1914
- 0,
1915
- 0
1916
- ],
1917
- ltVert: [
1918
- 32,
1919
- 32,
1920
- 32,
1921
- 32,
1922
- 32,
1923
- 32,
1924
- 32,
1925
- 32
1926
- ],
1927
- dkHorz: [
1928
- 255,
1929
- 255,
1930
- 0,
1931
- 0,
1932
- 255,
1933
- 255,
1934
- 0,
1935
- 0
1936
- ],
1937
- dkVert: [
1938
- 204,
1939
- 204,
1940
- 204,
1941
- 204,
1942
- 204,
1943
- 204,
1944
- 204,
1945
- 204
1946
- ],
1947
- narHorz: [
1948
- 255,
1949
- 0,
1950
- 255,
1951
- 0,
1952
- 255,
1953
- 0,
1954
- 255,
1955
- 0
1956
- ],
1957
- narVert: [
1958
- 170,
1959
- 170,
1960
- 170,
1961
- 170,
1962
- 170,
1963
- 170,
1964
- 170,
1965
- 170
1966
- ],
1967
- cross: [
1968
- 255,
1969
- 136,
1970
- 136,
1971
- 136,
1972
- 255,
1973
- 136,
1974
- 136,
1975
- 136
1976
- ],
1977
- lgGrid: [
1978
- 255,
1979
- 128,
1980
- 128,
1981
- 128,
1982
- 128,
1983
- 128,
1984
- 128,
1985
- 128
1986
- ],
1987
- smGrid: [
1988
- 255,
1989
- 136,
1990
- 136,
1991
- 136,
1992
- 255,
1993
- 136,
1994
- 136,
1995
- 136
1996
- ],
1997
- dotGrid: [
1998
- 136,
1999
- 0,
2000
- 0,
2001
- 0,
2002
- 136,
2003
- 0,
2004
- 0,
2005
- 0
2006
- ],
2007
- dnDiag: [
2008
- 128,
2009
- 64,
2010
- 32,
2011
- 16,
2012
- 8,
2013
- 4,
2014
- 2,
2015
- 1
2016
- ],
2017
- upDiag: [
2018
- 1,
2019
- 2,
2020
- 4,
2021
- 8,
2022
- 16,
2023
- 32,
2024
- 64,
2025
- 128
2026
- ],
2027
- ltDnDiag: [
2028
- 136,
2029
- 68,
2030
- 34,
2031
- 17,
2032
- 136,
2033
- 68,
2034
- 34,
2035
- 17
2036
- ],
2037
- ltUpDiag: [
2038
- 17,
2039
- 34,
2040
- 68,
2041
- 136,
2042
- 17,
2043
- 34,
2044
- 68,
2045
- 136
2046
- ],
2047
- dkDnDiag: [
2048
- 195,
2049
- 129,
2050
- 0,
2051
- 129,
2052
- 195,
2053
- 129,
2054
- 0,
2055
- 129
2056
- ],
2057
- dkUpDiag: [
2058
- 195,
2059
- 129,
2060
- 0,
2061
- 129,
2062
- 195,
2063
- 129,
2064
- 0,
2065
- 129
2066
- ],
2067
- wdDnDiag: [
2068
- 128,
2069
- 64,
2070
- 32,
2071
- 16,
2072
- 8,
2073
- 4,
2074
- 2,
2075
- 129
2076
- ],
2077
- wdUpDiag: [
2078
- 1,
2079
- 2,
2080
- 4,
2081
- 8,
2082
- 16,
2083
- 32,
2084
- 64,
2085
- 129
2086
- ],
2087
- diagCross: [
2088
- 129,
2089
- 66,
2090
- 36,
2091
- 24,
2092
- 24,
2093
- 36,
2094
- 66,
2095
- 129
2096
- ],
2097
- horzBrick: [
2098
- 255,
2099
- 16,
2100
- 16,
2101
- 16,
2102
- 255,
2103
- 1,
2104
- 1,
2105
- 1
2106
- ],
2107
- diagBrick: [
2108
- 129,
2109
- 66,
2110
- 36,
2111
- 24,
2112
- 36,
2113
- 66,
2114
- 129,
2115
- 0
2116
- ],
2117
- lgCheck: [
2118
- 240,
2119
- 240,
2120
- 240,
2121
- 240,
2122
- 15,
2123
- 15,
2124
- 15,
2125
- 15
2126
- ],
2127
- smCheck: [
2128
- 204,
2129
- 204,
2130
- 51,
2131
- 51,
2132
- 204,
2133
- 204,
2134
- 51,
2135
- 51
2136
- ],
2137
- trellis: [
2138
- 165,
2139
- 90,
2140
- 165,
2141
- 90,
2142
- 165,
2143
- 90,
2144
- 165,
2145
- 90
2146
- ]
2147
- };
2148
- function An(e, t, n) {
2149
- let r = kn[e];
2150
- if (!r) return null;
2151
- let i = z(8, 8);
2152
- if (!i) return null;
2153
- let a = i.getContext("2d");
2154
- if (!a) return null;
2155
- a.fillStyle = jn(n), a.fillRect(0, 0, 8, 8), a.fillStyle = jn(t);
2156
- for (let e = 0; e < 8; e++) {
2157
- let t = r[e];
2158
- for (let n = 0; n < 8; n++) t & 1 << 7 - n && a.fillRect(n, e, 1, 1);
2159
- }
2160
- return i;
2161
- }
2162
- function jn(e) {
2163
- return `rgba(${parseInt(e.slice(0, 2), 16)},${parseInt(e.slice(2, 4), 16)},${parseInt(e.slice(4, 6), 16)},${e.length >= 8 ? parseInt(e.slice(6, 8), 16) / 255 : 1})`;
2164
- }
2165
- //#endregion
2166
- //#region packages/core/src/draw/dash.ts
2167
- function Mn(e, t) {
2168
- return e.map((e) => e * t);
2169
- }
2170
- var Nn = {
2171
- dotted: [1, 2],
2172
- dashed: [3, 2],
2173
- dashSmallGap: [3, 1],
2174
- dotDash: [
2175
- 1,
2176
- 2,
2177
- 3,
2178
- 2
2179
- ],
2180
- dotDotDash: [
2181
- 1,
2182
- 2,
2183
- 1,
2184
- 2,
2185
- 3,
2186
- 2
2187
- ],
2188
- dashDotStroked: [
2189
- 1,
2190
- 2,
2191
- 3,
2192
- 2
2193
- ]
2194
- };
2195
- function Pn(e, t) {
2196
- let n = Nn[e];
2197
- return n ? Mn(n, t) : [];
2198
- }
2199
- var Fn = {
2200
- hair: [1, 1],
2201
- dashed: [4, 3],
2202
- mediumDashed: [4, 3],
2203
- dotted: [2, 2],
2204
- dashDot: [
2205
- 4,
2206
- 2,
2207
- 1,
2208
- 2
2209
- ],
2210
- mediumDashDot: [
2211
- 4,
2212
- 2,
2213
- 1,
2214
- 2
2215
- ],
2216
- dashDotDot: [
2217
- 4,
2218
- 2,
2219
- 1,
2220
- 2,
2221
- 1,
2222
- 2
2223
- ],
2224
- mediumDashDotDot: [
2225
- 4,
2226
- 2,
2227
- 1,
2228
- 2,
2229
- 1,
2230
- 2
2231
- ],
2232
- slantDashDot: [
2233
- 5,
2234
- 3,
2235
- 1,
2236
- 3
2237
- ]
2238
- };
2239
- function In(e) {
2240
- let t = Fn[e];
2241
- return t ? Mn(t, 1) : [];
2242
- }
2243
- var Ln = {
2244
- dash: [6, 3],
2245
- dot: [1.5, 3],
2246
- dashDot: [
2247
- 6,
2248
- 3,
2249
- 1.5,
2250
- 3
2251
- ],
2252
- lgDash: [10, 4],
2253
- lgDashDot: [
2254
- 10,
2255
- 4,
2256
- 1.5,
2257
- 4
2258
- ],
2259
- lgDashDotDot: [
2260
- 10,
2261
- 4,
2262
- 1.5,
2263
- 4,
2264
- 1.5,
2265
- 4
2266
- ],
2267
- sysDash: [4, 2],
2268
- sysDot: [1, 2],
2269
- sysDashDot: [
2270
- 4,
2271
- 2,
2272
- 1,
2273
- 2
2274
- ],
2275
- sysDashDotDot: [
2276
- 4,
2277
- 2,
2278
- 1,
2279
- 2,
2280
- 1,
2281
- 2
2282
- ]
2283
- };
2284
- function Rn(e, t) {
2285
- let n = Ln[e];
2286
- return n ? Mn(n, t) : [];
2287
- }
2288
- var zn = 512;
2289
- function Bn(e, t, n) {
2290
- if (e != null) {
2291
- let t = [];
2292
- for (let r = 0; r < Math.min(e.length, zn); r += 1) {
2293
- let i = e[r];
2294
- !Number.isFinite(i.dash) || !Number.isFinite(i.space) || i.dash < 0 || i.space < 0 || i.dash === 0 && i.space === 0 || t.push(i.dash * n, i.space * n);
2295
- }
2296
- return t;
2297
- }
2298
- return Rn(t ?? "solid", n);
2299
- }
2300
- function Vn(e, t) {
2301
- let n = Rn(e, t);
2302
- if (n.length > 0) return n;
2303
- let r = e.trim().split(/[\s,]+/).map(Number);
2304
- return r.length >= 2 && r.every((e) => Number.isFinite(e) && e >= 0) && r.some((e) => e > 0) ? (r.length % 2 != 0 && r.pop(), Mn(r, t)) : [];
2305
- }
2306
- var Hn = {
2307
- dotted: [1.5, 3],
2308
- dottedHeavy: [1.5, 3],
2309
- dash: [6, 3],
2310
- dashHeavy: [6, 3],
2311
- dashLong: [10, 4],
2312
- dashLongHeavy: [10, 4],
2313
- dotDash: [
2314
- 6,
2315
- 3,
2316
- 1.5,
2317
- 3
2318
- ],
2319
- dotDashHeavy: [
2320
- 6,
2321
- 3,
2322
- 1.5,
2323
- 3
2324
- ],
2325
- dotDotDash: [
2326
- 6,
2327
- 3,
2328
- 1.5,
2329
- 3,
2330
- 1.5,
2331
- 3
2332
- ],
2333
- dotDotDashHeavy: [
2334
- 6,
2335
- 3,
2336
- 1.5,
2337
- 3,
2338
- 1.5,
2339
- 3
2340
- ]
2341
- };
2342
- function Un(e, t) {
2343
- let n = Hn[e];
2344
- return n ? Mn(n, t) : [];
2345
- }
2346
- //#endregion
2347
- //#region packages/core/src/shape/paint.ts
2348
- var Wn = 512;
2349
- function Gn(e, t, n, r, i, a, o) {
2350
- let s = e.tileRect;
2351
- if (!s || (s.l ?? 0) === 0 && (s.t ?? 0) === 0 && (s.r ?? 0) === 0 && (s.b ?? 0) === 0) return null;
2352
- let c = n + i * (s.l ?? 0), l = r + a * (s.t ?? 0), u = i * (1 - (s.l ?? 0) - (s.r ?? 0)), d = a * (1 - (s.t ?? 0) - (s.b ?? 0));
2353
- if (!Number.isFinite(u) || !Number.isFinite(d) || Math.abs(u) < 1e-9 || Math.abs(d) < 1e-9) return null;
2354
- let f = Math.min(1, Wn / Math.abs(u), Wn / Math.abs(d)), p = Math.max(1, Math.ceil(Math.abs(u) * f)), m = Math.max(1, Math.ceil(Math.abs(d) * f)), h = Bt(t, p, m), g = h?.getContext("2d");
2355
- if (!h || !g) return null;
2356
- let _ = G({
2357
- ...e,
2358
- tileRect: void 0,
2359
- flip: void 0
2360
- }, g, 0, 0, p, m, o);
2361
- if (!_) return null;
2362
- g.fillStyle = _, g.fillRect(0, 0, p, m);
2363
- let v = e.flip === "x" || e.flip === "xy", y = e.flip === "y" || e.flip === "xy", b = h;
2364
- if (v || y) {
2365
- let e = Bt(t, p * (v ? 2 : 1), m * (y ? 2 : 1)), n = e?.getContext("2d");
2366
- if (!e || !n) return null;
2367
- for (let e = 0; e < (y ? 2 : 1); e += 1) for (let t = 0; t < (v ? 2 : 1); t += 1) n.save(), n.translate(t * p, e * m), n.scale(t === 1 ? -1 : 1, e === 1 ? -1 : 1), n.drawImage(h, t === 1 ? -p : 0, e === 1 ? -m : 0), n.restore();
2368
- b = e;
2369
- }
2370
- let x = t.createPattern(b, "repeat");
2371
- return !x || typeof x.setTransform != "function" ? null : (x.setTransform({
2372
- a: u / p,
2373
- b: 0,
2374
- c: 0,
2375
- d: d / m,
2376
- e: c,
2377
- f: l
2378
- }), x);
2379
- }
2380
- function U(e, t = 1) {
2381
- let n = e.charCodeAt(0) === 35 ? e.slice(1) : e;
2382
- return `rgba(${parseInt(n.slice(0, 2), 16)},${parseInt(n.slice(2, 4), 16)},${parseInt(n.slice(4, 6), 16)},${n.length >= 8 ? parseInt(n.slice(6, 8), 16) / 255 : t})`;
2383
- }
2384
- function Kn(e) {
2385
- let t = e.startsWith("#") ? e.slice(1) : e;
2386
- if (t.length < 8) return !0;
2387
- let n = Number.parseInt(t.slice(6, 8), 16);
2388
- return !Number.isFinite(n) || n !== 0;
2389
- }
2390
- function W(e) {
2391
- return !e || e.fillType === "none" ? !1 : e.fillType === "solid" ? Kn(e.color) : e.fillType === "gradient" ? e.stops.some((e) => Kn(e.color)) : e.fillType === "pattern" ? Kn(e.fg) || Kn(e.bg) : e.alpha == null || !Number.isFinite(e.alpha) || e.alpha > 0;
2392
- }
2393
- function qn(e) {
2394
- let t = e.charCodeAt(0) === 35 ? e.slice(1) : e, n = parseInt(t.slice(0, 2), 16), r = parseInt(t.slice(2, 4), 16), i = parseInt(t.slice(4, 6), 16);
2395
- return .299 * n + .587 * r + .114 * i;
2396
- }
2397
- function Jn(e) {
2398
- return e && qn(e) < 128 ? "#FFFFFF" : "#000000";
2399
- }
2400
- function G(e, t, n, r, i, a, o = 0) {
2401
- if (!e || e.fillType === "none") return null;
2402
- if (e.fillType === "solid") return U(e.color);
2403
- if (e.fillType === "pattern") return Xn(e, t);
2404
- if (e.fillType === "gradient") {
2405
- let s = e.stops;
2406
- if (s.length === 0) return null;
2407
- if (s.length === 1) return U(s[0].color);
2408
- let c = Gn(e, t, n, r, i, a, o);
2409
- if (c) return c;
2410
- let l, u = e.tileRect, d = n + i * (u?.l ?? 0), f = r + a * (u?.t ?? 0), p = i * (1 - (u?.l ?? 0) - (u?.r ?? 0)), m = a * (1 - (u?.t ?? 0) - (u?.b ?? 0));
2411
- if (e.gradType === "radial") {
2412
- let n = e.fillToRect, r = d + p * (n?.l ?? 0), i = f + m * (n?.t ?? 0), a = p * (1 - (n?.l ?? 0) - (n?.r ?? 0)), o = m * (1 - (n?.t ?? 0) - (n?.b ?? 0)), s = r + a / 2, c = i + o / 2, u = Math.max(Math.abs(s - d), Math.abs(d + p - s)), h = Math.max(Math.abs(c - f), Math.abs(f + m - c)), g = e.path === "rect" ? Math.max(u, h) : Math.sqrt(u * u + h * h);
2413
- l = t.createRadialGradient(s, c, 0, s, c, Math.max(g, 1e-9));
2414
- } else {
2415
- let n = (e.rotWithShape === !1 ? e.angle - o : e.angle) * Math.PI / 180, r = Math.cos(n), i = Math.sin(n);
2416
- if (e.scaled === !0) {
2417
- r *= p, i *= m;
2418
- let e = Math.hypot(r, i);
2419
- e > 0 && (r /= e, i /= e);
2420
- }
2421
- let a = d + p / 2, s = f + m / 2, c = (Math.abs(r) * p + Math.abs(i) * m) / 2;
2422
- l = t.createLinearGradient(a - r * c, s - i * c, a + r * c, s + i * c);
2423
- }
2424
- for (let e of s) l.addColorStop(Math.min(1, Math.max(0, e.position)), U(e.color));
2425
- return l;
2426
- }
2427
- return null;
2428
- }
2429
- var Yn = /* @__PURE__ */ new WeakMap();
2430
- function Xn(e, t) {
2431
- let n = `${e.preset}|${e.fg}|${e.bg}`, r = Yn.get(t);
2432
- r || (r = /* @__PURE__ */ new Map(), Yn.set(t, r));
2433
- let i = r.get(n);
2434
- if (i) return i;
2435
- let a = An(e.preset, e.fg, e.bg);
2436
- if (!a) return U(e.fg);
2437
- let o = t.createPattern(a, "repeat");
2438
- return o ? (r.set(n, o), o) : U(e.fg);
2439
- }
2440
- function Zn(e, t, n) {
2441
- if (!t) {
2442
- e.strokeStyle = "transparent", e.lineWidth = 0, e.setLineDash([]), e.lineCap = "butt", e.lineJoin = "miter", e.miterLimit = 10;
2443
- return;
2444
- }
2445
- e.strokeStyle = U(t.color);
2446
- let r = Math.max(.5, t.width * n);
2447
- e.lineWidth = r;
2448
- let i = t.customDash == null ? t.dashStyle ? Vn(t.dashStyle, r) : [] : Bn(t.customDash, null, r), a = t.lineCap ?? "butt", o = i.some((e, t) => t % 2 == 0 && e === 0);
2449
- e.lineCap = a === "butt" && o ? "square" : a, e.lineJoin = t.lineJoin ?? "miter", e.miterLimit = t.miterLimit ?? 10, e.setLineDash(i);
2450
- }
2451
- //#endregion
2452
- //#region packages/core/src/chart/box-whisker.ts
2453
- var Qn = .06;
2454
- function $n(e) {
2455
- let t = Math.floor(e.length / 2);
2456
- return e.length % 2 == 1 ? e[t] : e[t - 1] / 2 + e[t] / 2;
2457
- }
2458
- function er(e) {
2459
- let t = 0;
2460
- for (let n of e) t = Math.max(t, Math.abs(n));
2461
- if (t === 0) return 0;
2462
- let n = 0;
2463
- for (let r of e) n += r / t;
2464
- return n / e.length * t;
2465
- }
2466
- function tr(e, t, n) {
2467
- if (!Number.isFinite(t)) return n < 0 ? -Number.MAX_VALUE : Number.MAX_VALUE;
2468
- let r = e + n * t;
2469
- return Number.isFinite(r) ? r : n < 0 ? -Number.MAX_VALUE : Number.MAX_VALUE;
2470
- }
2471
- function nr(e, t) {
2472
- let n = e.filter((e) => typeof e == "number" && Number.isFinite(e)).sort((e, t) => e - t);
2473
- if (n.length === 0) return null;
2474
- let r = Math.floor(n.length / 2), i = $n(n), a = t === "inclusive" && n.length % 2 == 1, o = n.slice(0, r + +!!a), s = n.slice(r + +(n.length % 2 == 1 && !a)), c = $n(o.length > 0 ? o : n), l = $n(s.length > 0 ? s : n), u = (l - c) * 1.5, d = tr(c, u, -1), f = tr(l, u, 1), p = [], m = [];
2475
- for (let e of n) e < d || e > f ? m.push(e) : p.push(e);
2476
- return {
2477
- q1: c,
2478
- median: i,
2479
- q3: l,
2480
- lowerFence: d,
2481
- upperFence: f,
2482
- whiskerLo: p[0] ?? n[0],
2483
- whiskerHi: p[p.length - 1] ?? n[n.length - 1],
2484
- mean: er(n),
2485
- outliers: m,
2486
- inner: p
2487
- };
2488
- }
2489
- function rr(e, t) {
2490
- let n = 0;
2491
- for (let r of e) for (let e of r) if (n += e.length, !Number.isSafeInteger(n) || n > t) return t + 1;
2492
- return n;
2493
- }
2494
- function ir(e, t, n, r, i, a, o) {
2495
- if (!Number.isFinite(e) || !Number.isFinite(t) || t <= 0 || !Number.isInteger(n) || n <= 0 || !Number.isInteger(r) || r <= 0 || !Number.isInteger(i) || i < 0 || i >= n || !Number.isInteger(a) || a < 0 || a >= r || !Number.isFinite(o) || o < 0) return null;
2496
- let s = t / n, c = s / (r + o / 100), l = c * r, u = c * Qn, d = c - u, f = e + s * (i + .5) - l / 2 + a * c + u / 2;
2497
- return {
2498
- boxX: f,
2499
- boxWidth: d,
2500
- centerX: f + d / 2
2501
- };
2502
- }
2503
- //#endregion
2504
- //#region packages/core/src/canvas/clamp.ts
2505
- var ar = 32767, or = 1 << 24;
2506
- function sr(e, t) {
2507
- let n = Number.isFinite(e) && e > 0 ? Math.max(1, Math.round(e)) : 1, r = Number.isFinite(t) && t > 0 ? Math.max(1, Math.round(t)) : 1, i = Math.min(1, ar / n, ar / r), a = n * r, o = a > 16777216 ? Math.sqrt(or / a) : 1, s = Math.min(i, o);
2508
- return s >= 1 ? {
2509
- width: n,
2510
- height: r,
2511
- scale: 1,
2512
- clamped: !1
2513
- } : {
2514
- width: Math.max(1, Math.floor(n * s)),
2515
- height: Math.max(1, Math.floor(r * s)),
2516
- scale: s,
2517
- clamped: !0
2518
- };
2519
- }
2520
- //#endregion
2521
- //#region packages/core/src/shape/effects.ts
2522
- function cr(e, t) {
2523
- return [t === "tl" || t === "l" || t === "bl" ? e.x : t === "tr" || t === "r" || t === "br" ? e.x + e.w : e.x + e.w / 2, t === "tl" || t === "t" || t === "tr" ? e.y : t === "l" || t === "ctr" || t === "r" ? e.y + e.h / 2 : e.y + e.h];
2524
- }
2525
- function K(e, t) {
2526
- return e * t;
2527
- }
2528
- function q(e) {
2529
- return e.getContext("2d") ?? null;
2530
- }
2531
- function lr(e, t, n, r) {
2532
- let i = Math.max(0, Math.floor(e.x - t)), a = Math.max(0, Math.floor(e.y - t)), o = Math.min(n, Math.ceil(e.x + e.w + t)), s = Math.min(r, Math.ceil(e.y + e.h + t));
2533
- return {
2534
- x: i,
2535
- y: a,
2536
- w: Math.max(1, o - i),
2537
- h: Math.max(1, s - a)
2538
- };
2539
- }
2540
- function ur(e, t) {
2541
- if (t.x === 0 && t.y === 0) return e;
2542
- let n = t.x, r = t.y;
2543
- return new Proxy(e, {
2544
- get(e, t) {
2545
- if (t === "setTransform") return (t) => {
2546
- e.setTransform(t.a, t.b, t.c, t.d, t.e - n, t.f - r);
2547
- };
2548
- let i = Reflect.get(e, t);
2549
- return typeof i == "function" ? i.bind(e) : i;
2550
- },
2551
- set(e, t, n) {
2552
- return e[t] = n, !0;
2553
- }
2554
- });
2555
- }
2556
- function dr(e, t, n, r, i, a, o, s = 0, c) {
2557
- let l = Math.max(0, K(r.blur, i)), u = K(r.dist, i), d = r.rotWithShape === !1 ? 0 : s, f = (r.dir + d) * Math.PI / 180, p = Math.cos(f) * u, m = Math.sin(f) * u, h = lr(n, Math.ceil(l * 3 + Math.max(Math.abs(p), Math.abs(m))) + 2, a, o), g = z(h.w, h.h);
2558
- if (!g) return !1;
2559
- let _ = q(g);
2560
- if (!_) return !1;
2561
- t(ur(_, h)), _.save(), _.setTransform(1, 0, 0, 1, 0, 0), _.globalCompositeOperation = "source-in", _.fillStyle = U(r.color, r.alpha), _.fillRect(0, 0, h.w, h.h), _.restore(), e.save(), l > 0 && (e.filter = `blur(${l}px)`);
2562
- let [v, y] = c ?? cr(n, r.algn ?? "b"), b = r.sx ?? 1, x = r.sy ?? 1, S = Math.tan((r.kx ?? 0) * Math.PI / 180), C = Math.tan((r.ky ?? 0) * Math.PI / 180);
2563
- return e.translate(p, m), e.translate(v, y), d !== 0 && e.rotate(d * Math.PI / 180), e.transform(b, C, S, x, 0, 0), d !== 0 && e.rotate(-d * Math.PI / 180), e.translate(-v, -y), e.drawImage(g, h.x, h.y), e.restore(), !0;
2564
- }
2565
- function fr(e, t, n, r, i, a, o) {
2566
- let s = K(r.blur, i), c = K(r.dist, i), l = r.dir * Math.PI / 180, u = Math.cos(l) * c, d = Math.sin(l) * c, f = lr(n, Math.ceil(3 * s + Math.abs(c)) + 2, a, o), p = z(f.w, f.h);
2567
- if (!p) return;
2568
- let m = q(p);
2569
- if (!m) return;
2570
- let h = ur(m, f);
2571
- h.save(), h.fillStyle = U(r.color, r.alpha), t(h), h.restore(), h.save(), h.globalCompositeOperation = "destination-out", h.filter = s > 0 ? `blur(${s}px)` : "none", h.translate(u, d), h.fillStyle = "#000", t(h), h.restore(), h.save(), h.globalCompositeOperation = "destination-in", h.filter = "none", h.fillStyle = "#000", t(h), h.restore(), e.save(), e.drawImage(p, f.x, f.y), e.restore();
2572
- }
2573
- function pr(e, t, n, r, i, a, o, s) {
2574
- let c = K(r.radius, i);
2575
- if (c <= 0) {
2576
- t(e);
2577
- return;
2578
- }
2579
- let l = lr(n, Math.ceil(c) + 2, a, o), u = n.x - l.x, d = n.y - l.y, f = z(l.w, l.h);
2580
- if (!f) {
2581
- t(e);
2582
- return;
2583
- }
2584
- let p = q(f);
2585
- if (!p) {
2586
- t(e);
2587
- return;
2588
- }
2589
- let m = ur(p, l), h = s ?? t;
2590
- t(m);
2591
- let g = z(l.w, l.h), _ = z(l.w, l.h), v = g ? q(g) : null, y = _ ? q(_) : null;
2592
- if (g && v && _ && y) {
2593
- let t = ur(v, l);
2594
- t.fillStyle = "#000", h(t), y.drawImage(f, u, d, n.w, n.h, u - c, d - c, n.w + c * 2, n.h + c * 2), y.drawImage(f, 0, 0), y.globalCompositeOperation = "destination-in", y.filter = `blur(${c / 3}px)`, y.drawImage(g, 0, 0), y.filter = "none", y.globalCompositeOperation = "source-over", e.save(), e.drawImage(_, l.x, l.y), e.restore();
2595
- return;
2596
- }
2597
- e.save(), e.drawImage(f, 0, 0), e.restore();
2598
- }
2599
- function mr(e, t, n, r, i, a, o) {
2600
- let s = z(a, o);
2601
- if (!s) return;
2602
- let c = q(s);
2603
- if (!c) return;
2604
- let l = K(r.blur, i);
2605
- c.save(), l > 0 && (c.filter = `blur(${l}px)`), t(c), c.restore(), c.save(), c.globalCompositeOperation = "destination-in";
2606
- let u = n.y, d = n.y + n.h, f = c.createLinearGradient(0, d, 0, u), p = hr(r.stPos), m = hr(r.endPos);
2607
- f.addColorStop(0, `rgba(0,0,0,${r.stA})`), p > 0 && f.addColorStop(p, `rgba(0,0,0,${r.stA})`), m < 1 && m > p && f.addColorStop(m, `rgba(0,0,0,${r.endA})`), f.addColorStop(1, `rgba(0,0,0,${r.endA})`), c.fillStyle = f, c.fillRect(0, 0, a, o), c.restore();
2608
- let h = K(r.dist, i), g = r.dir * Math.PI / 180, _ = Math.cos(g) * h, v = Math.sin(g) * h;
2609
- e.save(), e.translate(n.x + _, d + v), e.scale(r.sx, r.sy), e.translate(-n.x, -d), e.drawImage(s, 0, 0), e.restore();
2610
- }
2611
- function hr(e) {
2612
- return e < 0 ? 0 : e > 1 ? 1 : e;
2613
- }
2614
- //#endregion
2615
- //#region packages/core/src/chart/style-effects.ts
2616
- var gr = 12700, _r = or, vr = /* @__PURE__ */ new WeakMap();
2617
- function yr(e, t, n = _r, r = 1) {
2618
- let i = vr.get(e), a = Number.isSafeInteger(r) && r > 0 ? r : 1;
2619
- vr.set(e, { perConsumerMaximum: Math.floor(Math.max(0, n) / a) });
2620
- try {
2621
- return t();
2622
- } finally {
2623
- i ? vr.set(e, i) : vr.delete(e);
2624
- }
2625
- }
2626
- function br(e) {
2627
- return e?.effectAuthored === !0 || e?.effectUnsupported === !0 || e?.effectNoStyle === !0 || e?.shadows != null || e?.innerShadows != null || e?.glows != null || e?.softEdges != null || e?.reflections != null;
2628
- }
2629
- function J(...e) {
2630
- return e.find(br) ?? void 0;
2631
- }
2632
- function xr(e, t) {
2633
- if (e?.length) return e[t % e.length] ?? void 0;
2634
- }
2635
- function Sr(e, t, n, r = n) {
2636
- let i = br(e), a = i ? e : t;
2637
- if (!a || a.effectNoStyle === !0 || a.effectUnsupported === !0) return;
2638
- let o = i ? n : r, s = a.effectFormattingIndices ? A(a.effectFormattingIndices, o) : -1, c = a.effectColorIndex ?? (s >= 0 ? s : o), l = {
2639
- shadow: xr(a.shadows, c),
2640
- innerShadow: xr(a.innerShadows, c),
2641
- glow: xr(a.glows, c),
2642
- softEdge: xr(a.softEdges, c),
2643
- reflection: xr(a.reflections, c)
2644
- };
2645
- return Object.values(l).some(Boolean) ? l : void 0;
2646
- }
2647
- function Cr(e) {
2648
- if (typeof e.getTransform == "function") {
2649
- let t = e.getTransform();
2650
- if ([
2651
- t.a,
2652
- t.b,
2653
- t.c,
2654
- t.d,
2655
- t.e,
2656
- t.f
2657
- ].every(Number.isFinite)) return t;
2658
- }
2659
- return {
2660
- a: 1,
2661
- b: 0,
2662
- c: 0,
2663
- d: 1,
2664
- e: 0,
2665
- f: 0
2666
- };
2667
- }
2668
- function wr(e, t, n) {
2669
- return [e.a * t + e.c * n + e.e, e.b * t + e.d * n + e.f];
2670
- }
2671
- function Tr(e, t) {
2672
- let n = [
2673
- wr(e, t.x, t.y),
2674
- wr(e, t.x + t.w, t.y),
2675
- wr(e, t.x, t.y + t.h),
2676
- wr(e, t.x + t.w, t.y + t.h)
2677
- ], r = n.map((e) => e[0]), i = n.map((e) => e[1]), a = Math.min(...r), o = Math.max(...r), s = Math.min(...i), c = Math.max(...i);
2678
- return {
2679
- x: a,
2680
- y: s,
2681
- w: o - a,
2682
- h: c - s
2683
- };
2684
- }
2685
- function Er(e, t, n) {
2686
- let r = Math.max(1, Math.ceil(e.w + t * 2)) * Math.max(1, Math.ceil(e.h + t * 2)) * n;
2687
- return Number.isSafeInteger(r) ? r : Infinity;
2688
- }
2689
- function Dr(e, t, n, r, i) {
2690
- let a = e.softEdge ? Math.ceil(e.softEdge.radius * 3 * n) + 2 : 0, o = e.innerShadow ? Math.ceil((e.innerShadow.blur * 3 + Math.abs(e.innerShadow.dist)) * n) + 2 : 0, s = e.shadow ? Math.ceil((e.shadow.blur * 3 + Math.abs(e.shadow.dist)) * n) + 2 : 0;
2691
- return (e.reflection ? r * i : 0) + (e.shadow ? Er(t, s, 1) : 0) + (e.softEdge ? Er(t, a, 2) : 0) + (e.innerShadow ? Er(t, o, 2) : 0);
2692
- }
2693
- function Or(e, t, n) {
2694
- let r = t.dir * Math.PI / 180, i = t.dist / gr * n;
2695
- e.shadowColor = U(t.color, t.alpha), e.shadowBlur = Math.max(0, t.blur / gr * n), e.shadowOffsetX = Math.cos(r) * i, e.shadowOffsetY = Math.sin(r) * i;
2696
- }
2697
- function kr(e, t, n) {
2698
- e.shadowColor = U(t.color, t.alpha), e.shadowBlur = Math.max(0, t.radius / gr * n), e.shadowOffsetX = 0, e.shadowOffsetY = 0;
2699
- }
2700
- function Ar(e, t, n, r, i, a, o = r) {
2701
- let s = Sr(t, n, r, o), c = s?.shadow ?? s?.glow;
2702
- c && (e.save(), e.globalCompositeOperation = "destination-over", "radius" in c ? kr(e, c, i) : Or(e, c, i), a(e), e.restore());
2703
- }
2704
- function jr(e) {
2705
- let t = e.canvas;
2706
- return [t?.width ?? 0, t?.height ?? 0];
2707
- }
2708
- function Mr(e, t, n, r, i, a, o, s = r) {
2709
- let c = Sr(t, n, r, s);
2710
- if (!c) {
2711
- o(e);
2712
- return;
2713
- }
2714
- let l = Cr(e), u = Tr(l, i), d = Math.max(Math.hypot(l.a, l.b), Math.hypot(l.c, l.d)), f = Math.max(0, a * d / gr), [p, m] = jr(e), h = p > 0 && m > 0, g = (e) => {
2715
- e.setTransform(l), o(e);
2716
- }, _ = () => e.setTransform(1, 0, 0, 1, 0, 0), v = Dr(c, u, f, p, m), y = vr.get(e), b = h && Number.isSafeInteger(v) && v <= (y?.perConsumerMaximum ?? 0), x = !1;
2717
- b && c.shadow && (e.save(), _(), x = dr(e, g, u, c.shadow, f, p, m, Math.atan2(l.b, l.a) * 180 / Math.PI), e.restore());
2718
- let S = x ? c.glow : c.shadow ?? c.glow;
2719
- b && c.reflection && (e.save(), _(), mr(e, g, u, c.reflection, f, p, m), e.restore());
2720
- let C = !1;
2721
- !S && b && c.softEdge && (e.save(), _(), pr(e, g, u, c.softEdge, f, p, m), e.restore(), C = !0), C || (e.save(), S && ("radius" in S ? kr(e, S, a) : Or(e, S, a)), o(e), e.restore()), b && c.innerShadow && (e.save(), _(), fr(e, g, u, c.innerShadow, f, p, m), e.restore());
2722
- }
2723
- function Nr(e) {
2724
- if (e.length > 1e4) return !0;
2725
- let t = 0;
2726
- for (let n of e) {
2727
- if (n.path.length > 512 || t > 1e4 - n.path.length) return !0;
2728
- t += n.path.length;
2729
- }
2730
- return !1;
2731
- }
2732
- function Pr(e, t = !1) {
2733
- let n = {
2734
- label: "",
2735
- layoutWeight: 0,
2736
- value: 0,
2737
- depth: -1,
2738
- children: [],
2739
- branchIndex: -1,
2740
- labelIndex: -1,
2741
- a0: 0,
2742
- a1: 0
2743
- }, r = e.reduce((e, t) => Number.isFinite(t.size) && t.size > e ? t.size : e, 0), i = (e, t) => e > Number.MAX_VALUE - t ? Number.MAX_VALUE : e + t, a = /* @__PURE__ */ new WeakMap();
2744
- for (let o of e) {
2745
- let e = Number.isFinite(o.size) && o.size > 0 ? o.size : 0, s = r > 0 ? e / r : 0, c = n;
2746
- for (let n = 0; n < o.path.length; n++) {
2747
- let r = o.path[n], l = a.get(c);
2748
- l || (l = /* @__PURE__ */ new Map(), a.set(c, l));
2749
- let u = t && n === o.path.length - 1, d = u ? void 0 : l.get(r);
2750
- d || (d = {
2751
- label: r,
2752
- layoutWeight: 0,
2753
- value: 0,
2754
- depth: n,
2755
- children: [],
2756
- branchIndex: n === 0 ? c.children.length : c.branchIndex,
2757
- labelIndex: -1,
2758
- a0: 0,
2759
- a1: 0
2760
- }, c.children.push(d), u || l.set(r, d)), d.layoutWeight += s, d.value = i(d.value, e), c = d;
2761
- }
2762
- }
2763
- n.layoutWeight = n.children.reduce((e, t) => e + t.layoutWeight, 0), n.value = n.children.reduce((e, t) => i(e, t.value), 0);
2764
- let o = 0, s = [...n.children].reverse();
2765
- for (; s.length > 0;) {
2766
- let e = s.pop();
2767
- e.labelIndex = o++;
2768
- for (let t = e.children.length - 1; t >= 0; t--) s.push(e.children[t]);
2769
- }
2770
- return n;
2771
- }
2772
- function Fr(e) {
2773
- let t = [e];
2774
- for (; t.length > 0;) {
2775
- let e = t.pop(), n = 0;
2776
- for (let t of e.children) n += t.layoutWeight;
2777
- if (n <= 0) continue;
2778
- let r = e.a0;
2779
- for (let i of e.children) {
2780
- let a = (e.a1 - e.a0) * i.layoutWeight / n;
2781
- i.a0 = r, i.a1 = r + a, r = i.a1, t.push(i);
2782
- }
2783
- }
2784
- }
2785
- function Ir(e) {
2786
- let t = e.depth, n = [e];
2787
- for (; n.length > 0;) {
2788
- let e = n.pop();
2789
- t = Math.max(t, e.depth);
2790
- for (let t = e.children.length - 1; t >= 0; t--) n.push(e.children[t]);
2791
- }
2792
- return t;
2793
- }
2794
- //#endregion
2795
- //#region packages/core/src/excel-date.ts
2796
- var Lr = 864e5, Rr = Date.UTC(1899, 11, 30), zr = Date.UTC(1904, 0, 1);
2797
- function Br(e, t = !1) {
2798
- if (t) return new Date(zr + e * Lr);
2799
- let n = e < 60 ? e + 1 : e;
2800
- return new Date(Rr + n * Lr);
2801
- }
2802
- function Vr(e, t = !1) {
2803
- if (t) return (e.getTime() - zr) / Lr;
2804
- let n = (e.getTime() - Rr) / Lr;
2805
- return n <= 60 ? n - 1 : n;
2806
- }
2807
- //#endregion
2808
- //#region packages/core/src/text/round-decimal.ts
2809
- function Hr(e, t) {
2810
- if (!Number.isFinite(e)) return String(e);
2811
- let n = Math.max(0, Math.trunc(t)), r = e < 0, [i, a = ""] = Ur(Math.abs(e).toString()).split("."), o = a.padEnd(n + 1, "0"), s = o.slice(0, n), c = o.charCodeAt(n) - 48, l = (i + s).split("").map((e) => e.charCodeAt(0) - 48);
2812
- if (c >= 5) {
2813
- let e = l.length - 1;
2814
- for (; e >= 0; e--) if (l[e] === 9) l[e] = 0;
2815
- else {
2816
- l[e] += 1;
2817
- break;
2818
- }
2819
- e < 0 && l.unshift(1);
2820
- }
2821
- let u = l.map((e) => String(e)).join(""), d = n, f = (d > 0 ? u.slice(0, u.length - d) : u) || "0", p = d > 0 ? u.slice(u.length - d) : "", m = f.replace(/^0+(?=\d)/, ""), h = p.length > 0 ? `${m}.${p}` : m, g = /^[0.]*$/.test(h) && !/[1-9]/.test(h);
2822
- return r && !g ? `-${h}` : h;
2823
- }
2824
- function Ur(e) {
2825
- let t = /^(\d+)(?:\.(\d+))?[eE]([+-]?\d+)$/.exec(e);
2826
- if (!t) return e;
2827
- let [, n, r = "", i] = t, a = parseInt(i, 10), o = n + r, s = n.length + a;
2828
- return s <= 0 ? "0." + "0".repeat(-s) + o : s >= o.length ? o + "0".repeat(s - o.length) : o.slice(0, s) + "." + o.slice(s);
2829
- }
2830
- //#endregion
2831
- //#region packages/core/src/chart/chart-number-format.ts
2832
- var Wr = /* @__PURE__ */ new Map();
2833
- function Gr(e, t = !1, n = typeof navigator > "u" ? void 0 : navigator.language) {
2834
- let r = n ?? "", i = Wr.get(r);
2835
- return i || (i = new Intl.DateTimeFormat(n, {
2836
- year: "numeric",
2837
- month: "numeric",
2838
- day: "numeric",
2839
- timeZone: "UTC"
2840
- }), Wr.set(r, i)), i.format(Br(e, t));
2841
- }
2842
- function Kr(e) {
2843
- return Number.isInteger(e) ? String(e) : Hr(e, 6).replace(/\.?0+$/, "");
2844
- }
2845
- function qr(e, t, n = !1) {
2846
- if (!t || t.trim().toLowerCase() === "general") return Kr(e);
2847
- if (Yr(t)) return Xr(e, t, n);
2848
- let r = Zr(t), i;
2849
- return i = e > 0 ? r[0] ?? t : e < 0 ? r[1] ?? r[0] ?? t : r[2] ?? r[0] ?? t, i === "" ? "" : (e < 0 && r.length < 2 ? "-" : "") + Qr(Math.abs(e), i);
2850
- }
2851
- function Jr(e, t, n = !1) {
2852
- if (!t || e.trim() === "") return e;
2853
- let r = Number(e);
2854
- return Number.isFinite(r) ? qr(r, t, n) : e;
2855
- }
2856
- function Yr(e) {
2857
- let t = !1;
2858
- for (let n = 0; n < e.length; n++) {
2859
- let r = e[n];
2860
- if (r === "\"") {
2861
- t = !t;
2862
- continue;
2863
- }
2864
- if (!t) {
2865
- if (r === "\\") {
2866
- n++;
2867
- continue;
2868
- }
2869
- if (r === "[") {
2870
- for (; n < e.length && e[n] !== "]";) n++;
2871
- continue;
2872
- }
2873
- if (r === "y" || r === "Y" || r === "d" || r === "D" || r === "m" || r === "M" || r === "h" || r === "H" || r === "s" || r === "S") return !0;
2874
- }
2875
- }
2876
- return !1;
2877
- }
2878
- function Xr(e, t, n = !1) {
2879
- let r = Br(Math.floor(e), n), i = r.getUTCFullYear(), a = r.getUTCMonth() + 1, o = r.getUTCDate(), s = (e - Math.floor(e)) * 86400, c = Math.floor(s / 3600), l = Math.floor(s % 3600 / 60), u = Math.floor(s % 60), d = "", f = !1, p = 0;
2880
- for (; p < t.length;) {
2881
- let e = t[p];
2882
- if (e === "\"") {
2883
- f = !f, p++;
2884
- continue;
2885
- }
2886
- if (f) {
2887
- d += e, p++;
2888
- continue;
2889
- }
2890
- if (e === "\\" && p + 1 < t.length) {
2891
- d += t[p + 1], p += 2;
2892
- continue;
2893
- }
2894
- if (e === "[") {
2895
- for (; p < t.length && t[p] !== "]";) p++;
2896
- p < t.length && p++;
2897
- continue;
2898
- }
2899
- if (e === "y" || e === "Y") {
2900
- let e = 0;
2901
- for (; p < t.length && (t[p] === "y" || t[p] === "Y");) e++, p++;
2902
- d += e >= 3 ? String(i) : String(i % 100).padStart(2, "0");
2903
- continue;
2904
- }
2905
- if (e === "m" || e === "M") {
2906
- let e = 0;
2907
- for (; p < t.length && (t[p] === "m" || t[p] === "M");) e++, p++;
2908
- if (d.match(/[Hh]+\W*$/)) d += e >= 2 ? String(l).padStart(2, "0") : String(l);
2909
- else {
2910
- let t = [
2911
- "Jan",
2912
- "Feb",
2913
- "Mar",
2914
- "Apr",
2915
- "May",
2916
- "Jun",
2917
- "Jul",
2918
- "Aug",
2919
- "Sep",
2920
- "Oct",
2921
- "Nov",
2922
- "Dec"
2923
- ], n = [
2924
- "January",
2925
- "February",
2926
- "March",
2927
- "April",
2928
- "May",
2929
- "June",
2930
- "July",
2931
- "August",
2932
- "September",
2933
- "October",
2934
- "November",
2935
- "December"
2936
- ];
2937
- d += e >= 5 ? n[a - 1][0] : e === 4 ? n[a - 1] : e === 3 ? t[a - 1] : e === 2 ? String(a).padStart(2, "0") : String(a);
2938
- }
2939
- continue;
2940
- }
2941
- if (e === "d" || e === "D") {
2942
- let e = 0;
2943
- for (; p < t.length && (t[p] === "d" || t[p] === "D");) e++, p++;
2944
- d += e >= 2 ? String(o).padStart(2, "0") : String(o);
2945
- continue;
2946
- }
2947
- if (e === "h" || e === "H") {
2948
- let e = 0;
2949
- for (; p < t.length && (t[p] === "h" || t[p] === "H");) e++, p++;
2950
- d += e >= 2 ? String(c).padStart(2, "0") : String(c);
2951
- continue;
2952
- }
2953
- if (e === "s" || e === "S") {
2954
- let e = 0;
2955
- for (; p < t.length && (t[p] === "s" || t[p] === "S");) e++, p++;
2956
- d += e >= 2 ? String(u).padStart(2, "0") : String(u);
2957
- continue;
2958
- }
2959
- d += e, p++;
2960
- }
2961
- return d;
2962
- }
2963
- function Zr(e) {
2964
- let t = [], n = "";
2965
- for (let r = 0; r < e.length; r++) {
2966
- let i = e[r];
2967
- if (i === "\\" && r + 1 < e.length) {
2968
- n += i + e[r + 1], r++;
2969
- continue;
2970
- }
2971
- if (i === "\"") {
2972
- for (n += i, r++; r < e.length && e[r] !== "\"";) n += e[r], r++;
2973
- r < e.length && (n += e[r]);
2974
- continue;
2975
- }
2976
- if (i === "[") {
2977
- for (n += i, r++; r < e.length && e[r] !== "]";) n += e[r], r++;
2978
- r < e.length && (n += e[r]);
2979
- continue;
2980
- }
2981
- if (i === ";") {
2982
- t.push(n), n = "";
2983
- continue;
2984
- }
2985
- n += i;
2986
- }
2987
- return t.push(n), t;
2988
- }
2989
- function Qr(e, t) {
2990
- let n = [], r = 0, i = !1, a = !1;
2991
- for (; r < t.length;) {
2992
- let e = t[r];
2993
- if (e === "\"") {
2994
- r++;
2995
- let e = "";
2996
- for (; r < t.length && t[r] !== "\"";) e += t[r], r++;
2997
- r < t.length && r++, n.push({
2998
- kind: "lit",
2999
- text: e
3000
- });
3001
- continue;
3002
- }
3003
- if (e === "\\" && r + 1 < t.length) {
3004
- n.push({
3005
- kind: "lit",
3006
- text: t[r + 1]
3007
- }), r += 2;
3008
- continue;
3009
- }
3010
- if (e === "_" && r + 1 < t.length) {
3011
- n.push({
3012
- kind: "lit",
3013
- text: " "
3014
- }), r += 2;
3015
- continue;
3016
- }
3017
- if (e === "*" && r + 1 < t.length) {
3018
- r += 2;
3019
- continue;
3020
- }
3021
- if (e === "[") {
3022
- for (r++; r < t.length && t[r] !== "]";) r++;
3023
- r < t.length && r++;
3024
- continue;
3025
- }
3026
- if (e === "%") {
3027
- a = !0, n.push({
3028
- kind: "lit",
3029
- text: "%"
3030
- }), r++;
3031
- continue;
3032
- }
3033
- if (e === "#" || e === "0" || e === "." || e === "," || e === "?") {
3034
- let e = "";
3035
- for (; r < t.length && (t[r] === "#" || t[r] === "0" || t[r] === "." || t[r] === "," || t[r] === "?");) e += t[r], r++;
3036
- n.push({
3037
- kind: "num",
3038
- text: e
3039
- }), i = !0;
3040
- continue;
3041
- }
3042
- n.push({
3043
- kind: "lit",
3044
- text: e
3045
- }), r++;
3046
- }
3047
- if (!i) return n.map((e) => e.text).join("");
3048
- let o = a ? e * 100 : e, s = "";
3049
- for (let e of n) e.kind === "num" && (s += e.text);
3050
- let c = $r(o, s), l = !1;
3051
- return n.map((e) => e.kind === "lit" ? e.text : l ? "" : (l = !0, c)).join("");
3052
- }
3053
- function $r(e, t) {
3054
- let n = t.indexOf("."), r = n >= 0 ? t.slice(0, n) : t, i = n >= 0 ? t.slice(n + 1) : "", a = /,/.test(r), o = (i.match(/[#0?]/g) ?? []).length, s = (r.replace(/,/g, "").match(/0/g) ?? []).length, [c, l = ""] = Hr(e, o).split("."), u = c.padStart(s, "0"), d = a ? u.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : u;
3055
- return o === 0 ? d : `${d}.${l.padEnd(o, "0")}`;
3056
- }
3057
- //#endregion
3058
- //#region packages/core/src/chart/data-label-content.ts
3059
- function ei(e) {
3060
- if (e.customText) return e.customText;
3061
- let t = [];
3062
- if (e.showCategory && e.category && t.push(e.category), e.showSeries && e.seriesName && t.push(e.seriesName), e.showValue && e.sourceValue != null) {
3063
- let n = e.valueDivisor != null && Number.isFinite(e.valueDivisor) && e.valueDivisor > 0 ? e.valueDivisor : 1;
3064
- t.push(qr(e.sourceValue / n, e.formatCode ?? null, e.date1904));
3065
- }
3066
- return e.showPercent && e.percentRatio != null && t.push(qr(e.percentRatio, e.percentFormatCode ?? e.formatCode ?? "0%", e.date1904)), e.showBubbleSize && e.bubbleSize != null && t.push(qr(e.bubbleSize, e.formatCode ?? null, e.date1904)), t.filter((e) => e !== "").join(e.separator ?? e.defaultSeparator ?? " ");
3067
- }
3068
- //#endregion
3069
- //#region packages/core/src/chart/image-fill-context.ts
3070
- var ti;
3071
- function ni(e, t) {
3072
- let n = ti;
3073
- ti = e;
3074
- try {
3075
- return t();
3076
- } finally {
3077
- ti = n;
3078
- }
3079
- }
3080
- function ri(e, t, n, r, i, a, o, s = 0) {
3081
- return ti?.(e, t, n, r, i, a, o, s) ?? !1;
3082
- }
3083
- //#endregion
3084
- //#region packages/core/src/chart/label-box.ts
3085
- function ii(e, t, n, r, i = 0, a = i) {
3086
- if (!t || !e && !r) return e ?? void 0;
3087
- let o = e ?? {}, s = t.fillNoStyle !== !0 && (t.fillPaintAuthored === !0 || t.fillHidden === !0 || t.fillPaints != null || t.fillColors != null), c = o.fillHidden === !0 ? P(n) : void 0, l = N(o.style, n, i), u = o.fillPaint != null || o.fill != null || l !== void 0 || o.fillHidden === !0 && c !== void 0 || o.fillPaintAuthored === !0 && o.fillHidden !== !0, d = c === void 0 ? o.fillPaint ?? (o.fill ? {
3088
- fillType: "solid",
3089
- color: o.fill
3090
- } : l === void 0 ? o.fillPaintAuthored === !0 && o.fillHidden !== !0 ? null : M(t, a) : l) : c;
3091
- return {
3092
- fill: d?.fillType === "solid" ? d.color : void 0,
3093
- fillPaint: d != null && d.fillType !== "solid" ? d : void 0,
3094
- fillHidden: d === null ? !0 : void 0,
3095
- fillPaintAuthored: u || s ? !0 : o.fillPaintAuthored
3096
- };
3097
- }
3098
- function Y(e) {
3099
- if (!e) return !1;
3100
- let t = e.fillHidden !== !0 && (e.fillPaint == null ? e.fill != null && W({
3101
- fillType: "solid",
3102
- color: e.fill
3103
- }) : W(e.fillPaint)), n = e.borderHidden !== !0 && (e.borderFill == null ? e.borderColor != null && W({
3104
- fillType: "solid",
3105
- color: e.borderColor
3106
- }) : W(e.borderFill));
3107
- return t || n;
3108
- }
3109
- function ai(e, t) {
3110
- if (!e) return t ?? void 0;
3111
- if (!t) return e;
3112
- let n = e.fillPaintAuthored === !0 || e.fill != null || e.fillPaint != null || e.fillHidden === !0, r = e.borderPaintAuthored === !0 || e.borderColor != null || e.borderFill != null || e.borderHidden === !0, i = e.borderDashAuthored === !0 || e.borderDash != null || e.borderCustomDash != null;
3113
- return {
3114
- ...t,
3115
- ...e,
3116
- fill: n ? e.fill : t.fill,
3117
- fillPaint: n ? e.fillPaint : t.fillPaint,
3118
- fillHidden: n ? e.fillHidden : t.fillHidden,
3119
- fillPaintAuthored: n ? e.fillPaintAuthored : t.fillPaintAuthored,
3120
- borderColor: r ? e.borderColor : t.borderColor,
3121
- borderFill: r ? e.borderFill : t.borderFill,
3122
- borderHidden: r ? e.borderHidden : t.borderHidden,
3123
- borderPaintAuthored: r ? e.borderPaintAuthored : t.borderPaintAuthored,
3124
- borderWidthEmu: e.borderWidthEmu ?? t.borderWidthEmu,
3125
- borderDash: i ? e.borderDash : t.borderDash,
3126
- borderCustomDash: i ? e.borderCustomDash : t.borderCustomDash,
3127
- borderDashAuthored: i ? e.borderDashAuthored : t.borderDashAuthored,
3128
- borderCap: e.borderCap ?? t.borderCap,
3129
- borderJoin: e.borderJoin ?? t.borderJoin,
3130
- borderCompound: e.borderCompound ?? t.borderCompound,
3131
- style: J(e.style, t.style),
3132
- effectFallbackStyle: e.effectFallbackStyle ?? t.effectFallbackStyle,
3133
- effectStyleIndex: e.effectStyleIndex ?? t.effectStyleIndex,
3134
- effectFallbackIndex: e.effectFallbackIndex ?? t.effectFallbackIndex
3135
- };
3136
- }
3137
- function oi(e, t, r, i, a = 0) {
3138
- t && Mr(e, t.style, t.effectFallbackStyle, t.effectStyleIndex ?? 0, r, i, (e) => {
3139
- if (t.fillHidden !== !0) {
3140
- let n = t.fillPaint?.fillType === "image" && ri(e, t.fillPaint, r.x, r.y, r.w, r.h, i, a) ? null : t.fillPaint ? G(t.fillPaint, e, r.x, r.y, r.w, r.h, a) : t.fill ? `#${t.fill}` : null;
3141
- n && (e.fillStyle = n, e.fillRect(r.x, r.y, r.w, r.h));
3142
- }
3143
- if (t.borderHidden === !0) return;
3144
- let o = t.borderFill ? G(t.borderFill, e, r.x, r.y, r.w, r.h, a) : t.borderColor ? `#${t.borderColor}` : null;
3145
- o && (e.save(), e.strokeStyle = o, e.lineWidth = t.borderWidthEmu == null ? Math.max(.25, .75 * i) : Math.max(.25, t.borderWidthEmu / n * i), e.setLineDash(Bn(t.borderCustomDash, t.borderDash, e.lineWidth)), t.borderCap === "rnd" ? e.lineCap = "round" : t.borderCap === "sq" ? e.lineCap = "square" : t.borderCap === "flat" && (e.lineCap = "butt"), t.borderJoin === "round" ? e.lineJoin = "round" : t.borderJoin === "bevel" ? e.lineJoin = "bevel" : t.borderJoin === "miter" && (e.lineJoin = "miter"), e.strokeRect(r.x, r.y, r.w, r.h), e.restore());
3146
- }, t.effectFallbackIndex ?? t.effectStyleIndex ?? 0);
3147
- }
3148
- //#endregion
3149
- //#region packages/core/src/chart/chart-ex-label.ts
3150
- function si(e) {
3151
- let t = e?.divisor;
3152
- return t != null && Number.isFinite(t) && t > 0 ? t : 1;
3153
- }
3154
- function ci(e, t, n, r, i, a, o, s, c) {
3155
- if (!t) return null;
3156
- let l = t.seriesDataLabels, u = o.get(n);
3157
- if (I(l, u) || !l && !u && !a.visible) return null;
3158
- let d = typeof s == "boolean" ? s : !1, f = typeof s == "number" ? s : void 0, p = !d && (u?.showVal ?? l?.showVal ?? a.showVal), m = u?.showCatName ?? l?.showCatName ?? a.showCatName, h = u?.showSerName ?? l?.showSerName ?? a.showSerName ?? !1, g = u?.showPercent ?? l?.showPercent ?? a.showPercent ?? !1, _ = u?.showLegendKey ?? l?.showLegendKey ?? !1, v = u?.formatCode ?? l?.formatCode ?? e.dataLabelFormatCode ?? null, y = ei({
3159
- customText: u?.text,
3160
- showCategory: m,
3161
- showSeries: h,
3162
- showValue: p,
3163
- showPercent: g,
3164
- category: r,
3165
- seriesName: t.name,
3166
- sourceValue: i,
3167
- valueDivisor: si(c),
3168
- percentRatio: f,
3169
- formatCode: v ?? t.valFormatCode ?? null,
3170
- percentFormatCode: v ?? "0%",
3171
- date1904: e.date1904,
3172
- separator: u?.separator ?? l?.separator
3173
- });
3174
- return !y && !_ ? null : {
3175
- text: y,
3176
- showLegendKey: _,
3177
- position: u?.position ?? l?.position,
3178
- fontColor: u?.fontColor ?? l?.fontColor,
3179
- fontSizeHpt: u?.fontSizeHpt ?? l?.fontSizeHpt,
3180
- fontBold: u?.fontBold ?? l?.fontBold,
3181
- fontFace: u?.fontFace ?? l?.fontFace,
3182
- manualLayout: u?.manualLayout,
3183
- labelBox: ai(u?.labelBox, l?.labelBox),
3184
- richRuns: u?.text ? u.richRuns : void 0,
3185
- textStyle: et(u, l)
3186
- };
3187
- }
3188
- //#endregion
3189
- //#region packages/core/src/chart/chart-ex-hierarchy-labels.ts
3190
- function li(e, t) {
3191
- let n = e.chartexSunburst ? {
3192
- rows: e.chartexSunburst.rows,
3193
- kind: "sunburst"
3194
- } : e.chartexTreemap ? {
3195
- rows: e.chartexTreemap.rows,
3196
- kind: "treemap"
3197
- } : void 0;
3198
- if (!n) return "not-hierarchy";
3199
- if (n.rows.length === 0) return "ok";
3200
- if (Nr(n.rows)) return "too-large";
3201
- let r = Pr(n.rows, n.kind === "treemap");
3202
- if (r.layoutWeight <= 0 || r.children.length === 0) return "ok";
3203
- n.kind === "sunburst" && (r.a0 = -Math.PI / 2, r.a1 = r.a0 + Math.PI * 2, Fr(r));
3204
- let i = e.chartexTreemap?.parentLabelLayout ?? "overlapping", a = e.series[0], o = new Map((a?.dataLabelOverrides ?? []).map((e) => [e.idx, e])), s = [...r.children];
3205
- for (; s.length > 0;) {
3206
- let r = s.pop();
3207
- for (let e of r.children) s.push(e);
3208
- if (r.layoutWeight <= 0 || n.kind === "sunburst" && r.a1 - r.a0 <= 1e-4) continue;
3209
- let c = n.kind === "treemap" && r.children.length > 0 && i === "banner" ? ci(e, a, r.labelIndex, r.label, r.value, {
3210
- visible: !0,
3211
- showVal: !1,
3212
- showCatName: !0
3213
- }, o, !0) : null;
3214
- t({
3215
- node: r,
3216
- kind: n.kind,
3217
- paintsBody: n.kind === "sunburst" || r.children.length === 0 || c != null
3218
- });
3219
- }
3220
- return "ok";
3221
- }
3222
- function ui(e, t) {
3223
- let n = e.chartexSunburst ? {
3224
- rows: e.chartexSunburst.rows,
3225
- kind: "sunburst"
3226
- } : e.chartexTreemap ? {
3227
- rows: e.chartexTreemap.rows,
3228
- kind: "treemap"
3229
- } : void 0;
3230
- if (!n) return "not-hierarchy";
3231
- if (n.rows.length === 0) return "ok";
3232
- if (Nr(n.rows)) return "too-large";
3233
- let r = Pr(n.rows, n.kind === "treemap");
3234
- if (r.layoutWeight <= 0 || r.children.length === 0) return "ok";
3235
- n.kind === "sunburst" && (r.a0 = -Math.PI / 2, r.a1 = r.a0 + Math.PI * 2, Fr(r));
3236
- let i = e.series[0], a = new Map((i?.dataLabelOverrides ?? []).map((e) => [e.idx, e])), o = e.chartexTreemap?.parentLabelLayout ?? "overlapping", s = [...r.children];
3237
- for (; s.length > 0;) {
3238
- let r = s.pop();
3239
- for (let e of r.children) s.push(e);
3240
- if (r.layoutWeight <= 0 || n.kind === "sunburst" && r.a1 - r.a0 <= 1e-4) continue;
3241
- let c;
3242
- n.kind === "sunburst" ? c = ci(e, i, r.labelIndex, r.label, r.value, {
3243
- visible: !1,
3244
- showVal: !1,
3245
- showCatName: !1
3246
- }, a) : r.children.length > 0 ? (c = ci(e, i, r.labelIndex, r.label, r.value, {
3247
- visible: o !== "none",
3248
- showVal: !1,
3249
- showCatName: !0
3250
- }, a), o === "overlapping" && r.depth !== 0 && (c = null)) : c = ci(e, i, r.labelIndex, r.label, r.value, {
3251
- visible: !1,
3252
- showVal: !1,
3253
- showCatName: !1
3254
- }, a), c && t({
3255
- label: c,
3256
- styleIndex: r.labelIndex,
3257
- linkedStyleIndex: a.has(r.labelIndex) ? r.labelIndex : i?.chartexFormatIdx ?? 0
3258
- });
3259
- }
3260
- return "ok";
3261
- }
3262
- //#endregion
3263
- //#region packages/core/src/chart/waterfall-plan.ts
3264
- function di(e, t, n) {
3265
- let r = Math.max(e.length, t), i = new Set(n), a = !1, o = (e, t) => {
3266
- let n = e + t;
3267
- return Number.isFinite(n) ? n : (a = !0, n < 0 ? -Number.MAX_VALUE : Number.MAX_VALUE);
3268
- }, s = 0, c = -Infinity, l = 0, u = [];
3269
- for (let t = 0; t < r; t++) {
3270
- let n = e[t], r = n != null && Number.isFinite(n), a = n == null || r, d = r ? n : 0;
3271
- if (i.has(t)) {
3272
- let e = {
3273
- start: 0,
3274
- end: d,
3275
- isSub: !0,
3276
- isPos: !0,
3277
- hasValue: r,
3278
- paintSlot: a,
3279
- semanticIndex: 2
3280
- };
3281
- u.push(e), a && (c = Math.max(c, e.start, e.end), l = Math.min(l, e.start, e.end)), r && (s = d);
3282
- } else {
3283
- let e = o(s, d), t = d >= 0 ? s : e, n = d >= 0 ? e : s, i = {
3284
- start: t,
3285
- end: n,
3286
- isSub: !1,
3287
- isPos: d >= 0,
3288
- hasValue: r,
3289
- paintSlot: a,
3290
- semanticIndex: d >= 0 ? 0 : 1
3291
- };
3292
- u.push(i), a && (c = Math.max(c, t, n), l = Math.min(l, t, n)), r && (s = e);
3293
- }
3294
- }
3295
- return {
3296
- bars: u,
3297
- rawMin: l,
3298
- rawMax: c,
3299
- cumulativeOverflow: a
3300
- };
3301
- }
3302
- //#endregion
3303
- //#region packages/core/src/chart/resource-limits.ts
3304
- var X = 1e4, fi = 4096, pi = 1048576, mi = 4096;
3305
- function hi(e, t, n, r = n) {
3306
- return Sr(e, t, n, r) != null;
3307
- }
3308
- function gi(e, t, n, r) {
3309
- let i = r[n];
3310
- return i?.kind === "bubble" || i?.kind === "scatter" ? "scatter" : i?.kind === "line" ? e.chartType === "stackedLinePct" ? "stackedLinePct" : e.chartType === "stackedLine" ? "stackedLine" : "line" : i?.kind === "area" ? e.chartType === "stackedAreaPct" ? "stackedAreaPct" : e.chartType === "stackedArea" ? "stackedArea" : "area" : i?.kind ?? t.seriesType ?? (e.chartType === "bubble" ? "scatter" : e.chartType);
3311
- }
3312
- function _i(e, t) {
3313
- let n = e.series.filter((e) => e.lineGroupIndex === t);
3314
- return n.length > 0 || t !== 0 || ![
3315
- "line",
3316
- "stackedLine",
3317
- "stackedLinePct"
3318
- ].includes(e.chartType) ? n : e.series.filter((e) => e.seriesType == null || e.seriesType === "line");
3319
- }
3320
- function vi(e, t, n) {
3321
- return !!(n?.text || (n?.showVal ?? t.seriesDataLabels?.showVal ?? e.showDataLabels) || (n?.showCatName ?? t.seriesDataLabels?.showCatName) || (n?.showSerName ?? t.seriesDataLabels?.showSerName) || (n?.showPercent ?? t.seriesDataLabels?.showPercent) || (n?.showBubbleSize ?? t.seriesDataLabels?.showBubbleSize) || (n?.showLegendKey ?? t.seriesDataLabels?.showLegendKey));
3322
- }
3323
- function yi(e, t, n, r) {
3324
- return e.threeD || r[t]?.kind.endsWith("3D") === !0 || E(e, t) ? null : n === "line" || n === "stackedLine" || n === "stackedLinePct" ? "dataPointLine" : n === "area" || n === "stackedArea" || n === "stackedAreaPct" ? "dataPoint" : n === "radar" ? (r[t]?.radarStyle ?? e.radarStyle) === "filled" ? "dataPoint" : "dataPointLine" : null;
3325
- }
3326
- function bi(e) {
3327
- let t = Si(e.chartType), n = Ft(e), r = e.series.map((t, r) => gi(e, t, r, n)), i = e.series.some((t, n) => r[n] === "scatter" && (t.categories ?? e.categories).some((e) => Number.isFinite(Number.parseFloat(e)))), a = 0, o = (e, t, n = 0, r = n) => {
3328
- hi(e, t, n, r) && a++;
3329
- };
3330
- o(e.chartAreaStyle, e.chartStyleRoles?.chartArea), o(e.plotAreaStyle, e.chartStyleRoles?.[e.threeD ? "plotArea3D" : "plotArea"]), e.showLegend && o(e.legendStyle, e.chartStyleRoles?.legend), (e.titlePresent === !0 || e.title != null || (e.titleRichRuns?.length ?? 0) > 0) && o(e.titleStyle, e.chartStyleRoles?.title), e.catAxisTitle != null && o(e.catAxisTitleStyle, e.chartStyleRoles?.axisTitle), e.valAxisTitle != null && o(e.valAxisTitleStyle, e.chartStyleRoles?.axisTitle);
3331
- for (let t of [e.secondaryValAxis, e.secondaryCatAxis]) t?.title != null && o(t.titleStyle, e.chartStyleRoles?.axisTitle), t?.displayUnits?.label != null && o(t.displayUnits.label.boxStyle?.style, e.chartStyleRoles?.axisTitle);
3332
- if (e.threeD?.seriesAxis?.title != null && o(e.threeD.seriesAxis.titleStyle, e.chartStyleRoles?.axisTitle), e.valAxisDisplayUnits?.label != null && o(e.valAxisDisplayUnits.label.boxStyle?.style, e.chartStyleRoles?.axisTitle), e.catAxisDisplayUnits?.label != null && o(e.catAxisDisplayUnits.label.boxStyle?.style, e.chartStyleRoles?.axisTitle), ui(e, ({ label: t, linkedStyleIndex: n }) => {
3333
- let r = t.labelBox, i = Y(r) ? e.chartStyleRoles?.dataLabelCallout ?? e.chartStyleRoles?.dataLabel : e.chartStyleRoles?.dataLabel;
3334
- o(r?.style, i, 0, n);
3335
- }), e.chartType === "waterfall") {
3336
- let t = e.series[0], n = new Map((t?.dataPointOverrides ?? []).map((e) => [e.idx, e])), r = di(t?.values ?? [], e.categories.length, e.subtotalIndices);
3337
- if (!r.cumulativeOverflow && r.rawMax > r.rawMin) for (let i = 0; i < r.bars.length; i++) {
3338
- let a = r.bars[i];
3339
- a.paintSlot && o(J(n.get(i)?.chartexStyle, t?.chartexStyle), e.chartexDataPointStyle, a.semanticIndex, a.semanticIndex);
3340
- }
3341
- } else if (e.chartType === "funnel") {
3342
- let t = e.series[0], n = t?.values ?? [];
3343
- if (n.some((e) => e != null && e > 0)) {
3344
- let r = Math.max(n.length, e.categories.length);
3345
- for (let i = 0; i < r; i++) (n[i] ?? 0) > 0 && o(t?.chartexStyle, e.chartexDataPointStyle, 0, 0);
3346
- }
3347
- }
3348
- for (let t = 0; t < (e.chartexBox?.series.length ?? 0); t++) {
3349
- let n = e.chartexBox.series[t], r = n.chartexFormatIdx ?? t;
3350
- for (let t of n.valuesByCategory) nr(t, n.quartileMethod) && o(n.chartexStyle, e.chartexDataPointStyle, r, r);
3351
- }
3352
- let s = e.series[0];
3353
- li(e, ({ node: t, paintsBody: n }) => {
3354
- n && o(s?.chartexStyle, e.chartexDataPointStyle, s?.chartexFormatIdx ?? 0, t.branchIndex);
3355
- });
3356
- let c = dt(e), l = pt(e);
3357
- for (let a = 0; a < e.series.length; a++) {
3358
- let s = e.series[a], u = r[a], d = n[a], f = It(e.chartType, d), p = s.chartexFormatIdx ?? a, m = new Map((s.dataPointOverrides ?? []).map((e) => [e.idx, e])), h = yi(e, a, u, n), g = E(e, a), _ = e.threeD != null || d?.kind.endsWith("3D") === !0, v = d?.kind === "bubble" || d == null && e.chartType === "bubble", y = u === "radar" && (d?.radarStyle ?? e.radarStyle) === "filled", b = u === "scatter" && !v, x = g && (u === "line" || u === "stackedLine" || u === "stackedLinePct" || u === "radar" && !y || b), S = /* @__PURE__ */ new Set();
3359
- if (x) if (u === "scatter") {
3360
- let t = [];
3361
- for (let n = 0; n < s.values.length; n++) xt(e, s, u, n, i, { chartType: f }) && t.push(n);
3362
- for (let e = 1; e < t.length; e++) S.add(t[e]);
3363
- } else {
3364
- let t = u === "stackedLine" || u === "stackedLinePct" || d?.kind === "line" && (d.grouping === "stacked" || d.grouping === "percentStacked") || u === "line" && e.dispBlanksAs === "zero", n = u !== "radar" && !t && e.dispBlanksAs === "span", r = [], i = () => {
3365
- for (let e = 1; e < r.length; e++) S.add(r[e]);
3366
- u === "radar" && r.length === s.values.length && r.length > 1 && S.add(r[0]), r = [];
3367
- };
3368
- for (let e = 0; e < s.values.length; e++) {
3369
- if (s.sourceHidden?.[e] === !0) {
3370
- i();
3371
- continue;
3372
- }
3373
- let a = s.values[e];
3374
- a != null && Number.isFinite(a) || t ? r.push(e) : n || i();
3375
- }
3376
- i();
3377
- }
3378
- if (t && h && (!g || h === "dataPoint" && (u === "area" || u === "stackedArea" || u === "stackedAreaPct")) && o(J(s.chartexStyle), D(e, h, a), p), t && g && y && s.values.length >= 3 && s.values.every((e, t) => e != null && Number.isFinite(e) && s.sourceHidden?.[t] !== !0) && o(J(m.get(0)?.chartexStyle, s.chartexStyle), D(e, "dataPoint", a), 0, 0), t && u === "scatter" && !g && b) {
3379
- let t = 0;
3380
- for (let n = 0; n < s.values.length; n++) xt(e, s, u, n, i, { chartType: f }) && t++;
3381
- t >= 2 && o(J(s.chartexStyle), D(e, "dataPointLine", a), p);
3382
- }
3383
- let C = Math.max(s.values.length, s.categories?.length ?? 0, s.bubbleSizes?.length ?? 0, e.categories.length);
3384
- if (t && !e.threeD && d?.kind.endsWith("3D") !== !0) for (let t = 0; t < C; t++) {
3385
- let n = m.get(t), r = xt(e, s, u, t, i, {
3386
- chartType: f,
3387
- bubbleScale: d?.bubbleScale ?? e.bubbleScale,
3388
- showNegativeBubbles: d?.showNegativeBubbles ?? e.showNegativeBubbles
3389
- }), c = v ? "bubble" : u, l = c === "area" || c === "stackedArea" || c === "stackedAreaPct", _ = c === "line" || c === "stackedLine" || c === "stackedLinePct" || l || c === "scatter" || c === "bubble" || c === "radar" || c === "stock", y = wt(c, f, d?.scatterStyle ?? e.scatterStyle, d?.radarStyle ?? e.radarStyle), b = l ? (s.showMarker === !0 || gt(s)) && s.markerSymbol !== "none" : c === "stock" ? s.markerSymbol != null && s.markerSymbol !== "none" : s.showMarker !== !1 && s.markerSymbol !== "none", C = r && _ && !y && Et(s, n, "circle", b) !== "none", w = s.values[t], T = r && (!(u === "pie" || u === "doughnut" || u === "ofPie") || w != null && Number.isFinite(w) && Math.abs(w) > 0), E = d?.kind === "stock" ? d.seriesStart : 0, O = d?.kind === "stock" ? d.seriesCount : e.series.length, k = u === "stock" && (a === E + O - 1 || O >= 4 && a === E);
3390
- if ((x ? S.has(t) : h == null && (v || u !== "scatter" && u !== "radar")) && T && (u !== "stock" || k && !C)) {
3391
- let r = v ? yt(s, n) ? "dataPoint3D" : "dataPoint" : u === "line" || u === "stackedLine" || u === "stackedLinePct" || u === "stock" || u === "scatter" || u === "radar" ? "dataPointLine" : "dataPoint";
3392
- o(J(n?.chartexStyle, s.chartexStyle), D(e, r, a), u === "stock" ? p : n?.chartexStyle ? t : p, u === "stock" ? p : g ? t : p);
3393
- }
3394
- C && !v && o(J(n?.markerStyle, n?.chartexStyle, s.markerStyle), D(e, "dataPointMarker", a), n?.markerStyle || n?.chartexStyle ? t : p, g ? t : p);
3395
- }
3396
- if (t && u === "ofPie") {
3397
- let t = Rt(e.ofPie, s.values), n = t == null ? void 0 : [...t].find((e) => {
3398
- let t = s.values[e];
3399
- return t != null && Number.isFinite(t) && Math.abs(t) > 0;
3400
- });
3401
- n != null && o(J(m.get(n)?.chartexStyle, s.chartexStyle), D(e, "dataPoint", a), g ? n : p);
3402
- }
3403
- if (t && _ && (d?.kind === "line3D" || d?.kind === "area3D" || u === "line" || u === "stackedLine" || u === "stackedLinePct" || u === "area" || u === "stackedArea" || u === "stackedAreaPct")) {
3404
- let t = (d?.kind === "area3D" || u === "area" || u === "stackedArea" || u === "stackedAreaPct" ? s.showMarker === !0 || gt(s) : s.showMarker === !0) && s.markerSymbol !== "none";
3405
- for (let n = 0; n < C; n++) {
3406
- let r = m.get(n), i = t || r?.markerSymbol != null && r.markerSymbol !== "none", c = s.values[n];
3407
- !i || s.sourceHidden?.[n] === !0 || c == null || !Number.isFinite(c) || o(J(r?.markerStyle, r?.chartexStyle, s.markerStyle), D(e, "dataPointMarker", a), r?.markerStyle || r?.chartexStyle ? n : p, p);
3408
- }
3409
- }
3410
- let w = u === "scatter" && !v && s.lineHidden !== !0, T = d?.kind === "line3D" || u === "line" || u === "stackedLine" || u === "stackedLinePct" || u === "stock" || w || u === "radar" && !y, O = v || u === "scatter" && !w, k = _ ? "dataPoint3D" : T ? "dataPointLine" : "dataPoint", A = (t, n) => {
3411
- let r = n ? m.get(t) : void 0, i = n ? t : a;
3412
- if (!O) {
3413
- let c = J(r?.chartexStyle, s.chartexStyle);
3414
- o(c, D(e, k, a), _ ? c === r?.chartexStyle ? t : p : r?.chartexStyle ? t : p, _ ? g ? i : p : n ? t : p);
3415
- }
3416
- if (!((_ ? T && s.showMarker === !0 && s.markerSymbol !== "none" : Tt(f, d?.scatterStyle ?? e.scatterStyle, s, d?.radarStyle ?? e.radarStyle)) || r?.markerSymbol != null && r.markerSymbol !== "none")) return;
3417
- let c = v && yt(s, r) ? "dataPoint3D" : v ? "dataPoint" : "dataPointMarker";
3418
- o(J(r?.markerStyle, r?.chartexStyle, v ? s.chartexStyle : s.markerStyle), D(e, c, a), r?.markerStyle || r?.chartexStyle ? t : p, _ ? p : n ? t : p);
3419
- };
3420
- if (e.showLegend) {
3421
- let e = c[a];
3422
- if (e) for (let t = 0; t < e.count; t++) l.has(e.firstIndex + t) || A(e.pointDriven ? t : 0, e.pointDriven);
3423
- }
3424
- if (e.dataTable?.showKeys === !0 && R(e.chartType) && A(0, c[a]?.pointDriven === !0), St(e, s, u, C, i, {
3425
- chartType: f,
3426
- bubbleScale: d?.bubbleScale ?? e.bubbleScale,
3427
- showNegativeBubbles: d?.showNegativeBubbles ?? e.showNegativeBubbles
3428
- }, a) > 0) {
3429
- let t = new Map((s.dataLabelOverrides ?? []).map((e) => [e.idx, e]));
3430
- for (let n = 0; n < C; n++) {
3431
- let r = t.get(n);
3432
- I(s.seriesDataLabels, r) || (r?.showLegendKey ?? s.seriesDataLabels?.showLegendKey) !== !0 || !L(e, s, u, n, i, a) || A(n, c[a]?.pointDriven === !0);
3433
- }
3434
- }
3435
- for (let t of s.dataLabelOverrides ?? []) {
3436
- if (s.sourceHidden?.[t.idx] === !0 || I(s.seriesDataLabels, t) || !vi(e, s, t) || !L(e, s, u, t.idx, i, a)) continue;
3437
- let n = ai(t.labelBox, s.seriesDataLabels?.labelBox);
3438
- o(J(t.labelBox?.style, s.seriesDataLabels?.labelBox?.style), Y(n) ? e.chartStyleRoles?.dataLabelCallout ?? e.chartStyleRoles?.dataLabel : e.chartStyleRoles?.dataLabel, 0, t.idx);
3439
- }
3440
- let ee = new Set((s.dataLabelOverrides ?? []).map((e) => e.idx));
3441
- if (s.seriesDataLabels?.labelBox != null || e.chartStyleRoles?.dataLabel != null) {
3442
- let t = Math.max(s.values.length, s.categories?.length ?? 0, e.categories.length);
3443
- for (let n = 0; n < t; n++) ee.has(n) || L(e, s, u, n, i, a) && vi(e, s, void 0) && o(s.seriesDataLabels?.labelBox?.style, Y(s.seriesDataLabels?.labelBox) ? e.chartStyleRoles?.dataLabelCallout ?? e.chartStyleRoles?.dataLabel : e.chartStyleRoles?.dataLabel, 0, s.chartexFormatIdx ?? a);
3444
- }
3445
- for (let n of t ? s.trendLines ?? [] : []) (n.dispEq === !0 || n.dispRSqr === !0 || n.labelText || n.labelRichRuns?.some((e) => e.text.length > 0) === !0) && o(n.labelBox?.style, e.chartStyleRoles?.trendlineLabel, 0, s.chartexFormatIdx ?? a);
3446
- }
3447
- for (let t = 0; t < (e.chartexBox?.series.length ?? 0); t++) {
3448
- let n = e.chartexBox.series[t];
3449
- if ((e.chartStyleMarkerSymbol ?? e.chartexMarkerSymbol ?? "circle") === "none" || !n.showNonoutliers && !n.showOutliers) continue;
3450
- let r = n.chartexFormatIdx ?? t;
3451
- for (let t of n.valuesByCategory) {
3452
- let i = nr(t, n.quartileMethod);
3453
- if (!i) continue;
3454
- let a = (n.showNonoutliers ? i.inner.length : 0) + (n.showOutliers ? i.outliers.length : 0);
3455
- for (let t = 0; t < a; t++) o(J(n.chartexStyle), e.chartStyleRoles?.dataPointMarker, r);
3456
- }
3457
- }
3458
- let u = (t, n) => {
3459
- let r = t[0], i = t.at(-1);
3460
- if (!r || !i) return;
3461
- let a = Math.max(r.values.length, i.values.length);
3462
- for (let t = 0; t < a; t++) {
3463
- let a = r.values[t], s = i.values[t];
3464
- if (a == null || s == null || !Number.isFinite(a) || !Number.isFinite(s) || a === s) continue;
3465
- let c = s > a ? "upBar" : "downBar";
3466
- o((c === "upBar" ? n.up : n.down).style, e.chartStyleRoles?.[c], t);
3467
- }
3468
- };
3469
- if (e.stockUpDownBars) {
3470
- let t = e.plotGroups?.find((e) => e.kind === "stock");
3471
- u(t ? e.series.slice(t.seriesStart, t.seriesStart + t.seriesCount) : e.series, e.stockUpDownBarStyle ?? {
3472
- gapWidthPercent: 150,
3473
- up: {},
3474
- down: {}
3475
- });
3476
- }
3477
- for (let t of e.lineGroupDecorations ?? []) t.upDownBars && u(_i(e, t.groupIndex), t.upDownBars);
3478
- return Math.max(1, a);
3479
- }
3480
- var xi = new Set([
3481
- "clusteredBar",
3482
- "clusteredBarH",
3483
- "stackedBar",
3484
- "stackedBarH",
3485
- "stackedBarPct",
3486
- "stackedBarHPct",
3487
- "clusteredColumn",
3488
- "line",
3489
- "stackedLine",
3490
- "stackedLinePct",
3491
- "area",
3492
- "stackedArea",
3493
- "stackedAreaPct",
3494
- "pie",
3495
- "doughnut",
3496
- "ofPie",
3497
- "radar",
3498
- "scatter",
3499
- "bubble",
3500
- "stock",
3501
- "surface",
3502
- "surface3D"
3503
- ]);
3504
- function Si(e) {
3505
- return xi.has(e);
3506
- }
3507
- function Ci(e) {
3508
- let t = 0, n = (e) => !Number.isSafeInteger(e) || e < 0 || e > 1e4 - t ? !1 : (t += e, !0), r = (e, n) => !Number.isSafeInteger(e) || e < 0 || !Number.isSafeInteger(n) || n < 0 || e !== 0 && n > Math.floor((1e4 - t) / e) ? !1 : (t += e * n, !0);
3509
- if (!n(e.legendEntries?.length ?? 0) || !n(e.plotGroups?.length ?? 0)) return X + 1;
3510
- if (e.plotGroups != null) {
3511
- let t = 0;
3512
- for (let n of e.plotGroups) {
3513
- if (!Number.isSafeInteger(n.seriesStart) || n.seriesStart < 0 || !Number.isSafeInteger(n.seriesCount) || n.seriesCount < 0 || n.seriesStart !== t || n.seriesCount > e.series.length - t) return X + 1;
3514
- t += n.seriesCount;
3515
- }
3516
- if (t !== e.series.length) return X + 1;
3517
- }
3518
- for (let t of e.series) {
3519
- let i = Math.max(1, e.categories.length, t.values.length, t.categories?.length ?? 0, t.bubbleSizes?.length ?? 0, t.dataPointOverrides?.length ?? 0, t.dataLabelOverrides?.length ?? 0);
3520
- if (!n(i) || !r(t.trendLines?.length ?? 0, Math.max(1, t.values.length)) || !n(t.errBars?.length ?? 0)) return X + 1;
3521
- for (let e of t.errBars ?? []) if (!n(Math.max(i, e.plus.length, e.minus.length))) return X + 1;
3522
- }
3523
- if (!n(e.chartexSunburst?.rows.length ?? 0) || !n(e.chartexTreemap?.rows.length ?? 0) || !n(e.chartexRegionMap?.rows.length ?? 0) || !n(e.chartexBox?.categories.length ?? 0) || !n(e.chartexBox?.series.length ?? 0)) return X + 1;
3524
- for (let t of e.chartexBox?.series ?? []) for (let e of t.valuesByCategory) if (!n(e.length)) return X + 1;
3525
- return n(e.ofPie?.customSplitIndices?.length ?? 0) ? t : X + 1;
3526
- }
3527
- function wi(e) {
3528
- if (!Si(e.chartType)) return null;
3529
- let t = 0;
3530
- for (let n of e.series) {
3531
- let r = 0;
3532
- for (let e of n.errBars ?? []) r = Math.max(r, e.plus.length, e.minus.length);
3533
- let i = Math.max(1, e.categories.length, n.categories?.length ?? 0, n.values.length, n.bubbleSizes?.length ?? 0, n.dataPointOverrides?.length ?? 0, n.dataLabelOverrides?.length ?? 0, n.trendLines?.length ?? 0, r);
3534
- if (!Number.isSafeInteger(i) || i > 1e4 - t) return X + 1;
3535
- t += i;
3536
- }
3537
- return t;
3538
- }
3539
- //#endregion
3540
- //#region packages/core/src/chart/three-d-surface-picture-plan.ts
3541
- function Ti(e, t) {
3542
- return !Number.isSafeInteger(t) || t < 0 ? !1 : e.slabFaces ? t === 0 ? e.slabFaces.front : t === 1 || t >= 6 ? !1 : t % 2 == 0 ? e.slabFaces.end : e.slabFaces.sides : t === 0;
3543
- }
3544
- function Ei(e, t) {
3545
- return e.mode !== "stack" && e.mode !== "stackScale" || !Ti(e, t) ? !1 : !e.slabFaces || t === 0 || t % 2 == 1;
3546
- }
3547
- function Di(e, t) {
3548
- return Ti(e, t) ? Oi(e, t) ? e.repetitions : 1 : 0;
3549
- }
3550
- function Oi(e, t) {
3551
- return e.mode === "stackScale" && Ei(e, t);
3552
- }
3553
- function ki(e) {
3554
- let t = 0;
3555
- for (let n = 0; n < 6; n++) if (t += Di(e, n), t > 4096) return null;
3556
- return e;
3557
- }
3558
- function Ai(e) {
3559
- return e == null || [
3560
- e.l,
3561
- e.t,
3562
- e.r,
3563
- e.b
3564
- ].every((e) => (e ?? 0) === 0);
3565
- }
3566
- function ji(e) {
3567
- if (!e) return !0;
3568
- let t = e.l ?? 0, n = e.t ?? 0, r = e.r ?? 0, i = e.b ?? 0, a = [
3569
- t,
3570
- n,
3571
- r,
3572
- i
3573
- ], o = 1 - r, s = 1 - i;
3574
- return a.every(Number.isFinite) && o > t && s > n && Math.min(1, o) > Math.max(0, t) && Math.min(1, s) > Math.max(0, n);
3575
- }
3576
- function Mi(e, t, n, r) {
3577
- if (e.tile != null == (e.stretch === !0) || !ji(e.srcRect) || !ji(e.fillRect) || e.rotWithShape === !1 || e.alpha != null && (!Number.isFinite(e.alpha) || e.alpha < 0 || e.alpha > 1)) return null;
3578
- let i = t?.pictureOptions;
3579
- if (i?.pictureFormatAuthored === !0 && i.pictureFormat == null || i?.pictureStackUnitAuthored === !0 && i.pictureStackUnit == null) return null;
3580
- let a = i?.pictureFormat ?? "stretch";
3581
- if ((!Ai(e.srcRect) || !Ai(e.fillRect)) && a !== "stretch") return null;
3582
- let o = t?.thicknessPercent ?? 0;
3583
- if (!Number.isFinite(o) || o < 0) return null;
3584
- let s = o === 0 ? void 0 : {
3585
- front: i?.applyToFront !== !1,
3586
- sides: i?.applyToSides !== !1,
3587
- end: i?.applyToEnd !== !1
3588
- };
3589
- if (s && !Object.values(s).some(Boolean) || !s && (n === "backWall" && i?.applyToFront === !1 || (n === "floor" || n === "sideWall") && i?.applyToSides === !1) || (i?.pictureStackUnitAuthored === !0 || i?.pictureStackUnit != null) && a !== "stackScale") return null;
3590
- if (e.tile) return a !== "stretch" || !Ai(e.fillRect) ? null : ki({
3591
- mode: "tile",
3592
- repetitions: 1,
3593
- slabFaces: s
3594
- });
3595
- if (a === "stretch") return ki({
3596
- mode: "stretch",
3597
- repetitions: 1,
3598
- slabFaces: s
3599
- });
3600
- if (a === "stack") return ki({
3601
- mode: "stack",
3602
- repetitions: 1,
3603
- slabFaces: s
3604
- });
3605
- if (a !== "stackScale") return null;
3606
- let c = i?.pictureStackUnit;
3607
- if (!(c != null && Number.isFinite(c) && c > 0)) return null;
3608
- if (n === "floor") return ki({
3609
- mode: "stretch",
3610
- repetitions: 1,
3611
- slabFaces: s
3612
- });
3613
- if (r == null) return ki({
3614
- mode: "stackScale",
3615
- repetitions: 1,
3616
- stackUnit: c,
3617
- slabFaces: s
3618
- });
3619
- if (!(Number.isFinite(r) && r > 0)) return null;
3620
- let l = Math.ceil(r / c);
3621
- return !Number.isSafeInteger(l) || l < 1 || l > 4096 ? null : ki({
3622
- mode: "stackScale",
3623
- repetitions: l,
3624
- stackUnit: c,
3625
- slabFaces: s
3626
- });
3627
- }
3628
- //#endregion
3629
- //#region packages/core/src/chart/axis-style.ts
3630
- function Ni(e, t) {
3631
- return e ? Math.max(.5, e / n) * t : 1;
3632
- }
3633
- function Pi(e, t, n) {
3634
- return {
3635
- color: e ? `#${e}` : "#aaa",
3636
- width: Ni(t, n)
3637
- };
3638
- }
3639
- function Fi(e, t, n) {
3640
- return {
3641
- color: e ? `#${e}` : "#e0e0e0",
3642
- width: t ? Ni(t, n) : .5
3643
- };
3644
- }
3645
- function Ii(e) {
3646
- return e.catAxisCrossBetween !== "midCat";
3647
- }
3648
- //#endregion
3649
- //#region packages/core/src/chart/compound-frame.ts
3650
- function Li(e, t) {
3651
- if (!Number.isFinite(e) || e <= 0) return [];
3652
- let n = t === "dbl" ? [
3653
- 1,
3654
- 1,
3655
- 1
3656
- ] : t === "thinThick" ? [
3657
- 1,
3658
- 1,
3659
- 3
3660
- ] : t === "thickThin" ? [
3661
- 3,
3662
- 1,
3663
- 1
3664
- ] : t === "tri" ? [
3665
- 1,
3666
- 1,
3667
- 2,
3668
- 1,
3669
- 1
3670
- ] : [1], r = e / n.reduce((e, t) => e + t, 0), i = [], a = 0;
3671
- for (let e = 0; e < n.length; e += 2) {
3672
- let t = n[e] * r;
3673
- i.push({
3674
- center: a + t / 2,
3675
- width: t
3676
- }), a += t + (n[e + 1] ?? 0) * r;
3677
- }
3678
- return i;
3679
- }
3680
- function Ri(e, t, n, r, i, a) {
3681
- let o = Math.max(0, Math.min(a, r / 2, i / 2));
3682
- e.beginPath(), e.moveTo(t + o, n), e.lineTo(t + r - o, n), e.quadraticCurveTo(t + r, n, t + r, n + o), e.lineTo(t + r, n + i - o), e.quadraticCurveTo(t + r, n + i, t + r - o, n + i), e.lineTo(t + o, n + i), e.quadraticCurveTo(t, n + i, t, n + i - o), e.lineTo(t, n + o), e.quadraticCurveTo(t, n, t + o, n), e.closePath();
3683
- }
3684
- function zi(e, t, n, r, i, a, o, s = 0) {
3685
- if (r > 0 && i > 0) for (let c of Li(a, o)) {
3686
- let a = Math.max(0, r - c.center * 2), o = Math.max(0, i - c.center * 2);
3687
- a > 0 && o > 0 && (e.lineWidth = c.width, s > 0 ? (Ri(e, t + c.center, n + c.center, a, o, Math.max(0, s - c.center)), e.stroke()) : e.strokeRect(t + c.center, n + c.center, a, o));
3688
- }
3689
- }
3690
- //#endregion
3691
- //#region packages/core/src/chart/legend-frame.ts
3692
- function Bi(e) {
3693
- let t = T(e, "legend"), n = e.legendFillHidden === !0 && P(t) === void 0;
3694
- if (!(e.legendFillHidden === !0 && !n)) {
3695
- if (e.legendFill != null) return e.legendFill;
3696
- if (!(e.legendFillColor != null || e.legendFillPaintAuthored === !0 && !n)) return F(e.chartStyleRoles?.legend, t, 0, e.legendStyle) ?? void 0;
3697
- }
3698
- }
3699
- function Vi(e, t, n, r, i = 0) {
3700
- (!t.legendFill && !t.legendFillColor || t.legendFillHidden === !0) && (!t.legendLineFill && !t.legendLineColor || t.legendLineHidden === !0) || Mr(e, t.legendStyle, t.chartStyleRoles?.legend, 0, n, r, (e) => {
3701
- if (e.save(), t.legendFillHidden !== !0 && (t.legendFill || t.legendFillColor)) {
3702
- let a = t.legendFill?.fillType === "image" && ri(e, t.legendFill, n.x, n.y, n.w, n.h, r, i) ? null : t.legendFill ? G(t.legendFill, e, n.x, n.y, n.w, n.h, i) : t.legendFillColor ? `#${t.legendFillColor}` : null;
3703
- a && (e.fillStyle = a), a && e.fillRect(n.x, n.y, n.w, n.h);
3704
- }
3705
- if (t.legendLineHidden !== !0 && (t.legendLineFill || t.legendLineColor) && n.w > 0 && n.h > 0) {
3706
- let a = Ni(t.legendLineWidthEmu, r), o = t.legendLineFill ? G(t.legendLineFill, e, n.x, n.y, n.w, n.h, i) : t.legendLineColor ? `#${t.legendLineColor}` : null;
3707
- o && (e.strokeStyle = o, e.lineCap = t.legendLineCap === "rnd" ? "round" : t.legendLineCap === "sq" ? "square" : "butt", e.lineJoin = t.legendLineJoin === "round" || t.legendLineJoin === "bevel" ? t.legendLineJoin : "miter", e.setLineDash(Bn(t.legendLineCustomDash, t.legendLineDash, a)), zi(e, n.x, n.y, n.w, n.h, a, t.legendLineCompound));
3708
- }
3709
- e.restore();
3710
- });
3711
- }
3712
- //#endregion
3713
- //#region packages/core/src/chart/source-visibility.ts
3714
- function Hi(e, t) {
3715
- if (!e.some(Boolean)) return null;
3716
- let n = Math.max(t, e.length), r = [], i = new Int32Array(n);
3717
- i.fill(-1);
3718
- for (let t = 0; t < n; t++) e[t] !== !0 && (i[t] = r.length, r.push(t));
3719
- return {
3720
- keep: r,
3721
- remap: i
3722
- };
3723
- }
3724
- function Z(e, t) {
3725
- if (e == null) return e;
3726
- let n = [];
3727
- for (let r of t.keep) r < e.length && n.push(e[r]);
3728
- return n;
3729
- }
3730
- function Ui(e, t) {
3731
- if (e == null) return e;
3732
- let n = [];
3733
- for (let r of e) {
3734
- if (r.idx >= t.remap.length) continue;
3735
- let e = t.remap[r.idx];
3736
- e >= 0 && n.push({
3737
- ...r,
3738
- idx: e
3739
- });
3740
- }
3741
- return n;
3742
- }
3743
- function Wi(e) {
3744
- return Math.max(e.values.length, e.categories?.length ?? 0, e.sourceHidden?.length ?? 0, e.dataPointColors?.length ?? 0, e.dataLabelColors?.length ?? 0, e.catFormatCodes?.length ?? 0, e.bubbleSizes?.length ?? 0, ...(e.errBars ?? []).flatMap((e) => [e.plus.length, e.minus.length]));
3745
- }
3746
- function Gi(e, t) {
3747
- return {
3748
- ...e,
3749
- values: Z(e.values, t) ?? [],
3750
- categories: Z(e.categories, t),
3751
- sourceHidden: Z(e.sourceHidden, t),
3752
- dataPointColors: Z(e.dataPointColors, t),
3753
- dataLabelColors: Z(e.dataLabelColors, t),
3754
- catFormatCodes: Z(e.catFormatCodes, t),
3755
- bubbleSizes: Z(e.bubbleSizes, t),
3756
- dataPointOverrides: Ui(e.dataPointOverrides, t),
3757
- dataLabelOverrides: Ui(e.dataLabelOverrides, t),
3758
- errBars: e.errBars?.map((e) => ({
3759
- ...e,
3760
- plus: Z(e.plus, t) ?? [],
3761
- minus: Z(e.minus, t) ?? []
3762
- }))
3763
- };
3764
- }
3765
- function Ki(e) {
3766
- let t = e.sourceHidden;
3767
- if (!t?.some(Boolean)) return e;
3768
- let n = (e, n) => e == null ? e : e.map((e, r) => t[r] === !0 ? n : e);
3769
- return {
3770
- ...e,
3771
- values: n(e.values, null) ?? [],
3772
- bubbleSizes: n(e.bubbleSizes, null),
3773
- errBars: e.errBars?.map((e) => ({
3774
- ...e,
3775
- plus: n(e.plus, null) ?? [],
3776
- minus: n(e.minus, null) ?? []
3777
- }))
3778
- };
3779
- }
3780
- function qi(e) {
3781
- return e.chartType === "scatter" || e.chartType === "bubble";
3782
- }
3783
- function Ji(e) {
3784
- let t = e.sourceHidden;
3785
- return t != null && t.length > 0 && t.every(Boolean);
3786
- }
3787
- function Yi(e, t) {
3788
- if (e.plotGroups == null) return e.plotGroups;
3789
- let n = new Set(t), r = 0;
3790
- return e.plotGroups.map((e) => {
3791
- let t = 0, i = e.seriesStart + e.seriesCount;
3792
- for (let r = e.seriesStart; r < i; r++) n.has(r) && t++;
3793
- let a = {
3794
- ...e,
3795
- seriesStart: r,
3796
- seriesCount: t
3797
- };
3798
- return r += t, a;
3799
- });
3800
- }
3801
- var Xi = [
3802
- "diamond",
3803
- "square",
3804
- "triangle",
3805
- "x",
3806
- "star",
3807
- "circle"
3808
- ], Zi = /* @__PURE__ */ new WeakSet();
3809
- function Qi(e) {
3810
- return Zi.has(e);
3811
- }
3812
- function $i(e, t) {
3813
- let n = e.themeAccentColors, r = t.dataPointColors?.some((e) => e != null) === !0 || (t.dataPointOverrides?.length ?? 0) > 0, i = t.markerSymbol != null || t.markerFill != null || t.markerFillPaintAuthored === !0 || t.markerLine != null || t.markerLinePaintAuthored === !0;
3814
- if (e.scatterStyle !== "marker" || !n?.length || r || i || t.lineHidden === !0) return t;
3815
- let a = {
3816
- ...t,
3817
- dataPointColors: t.values.map((e, t) => n[t % n.length]),
3818
- dataPointOverrides: t.values.map((e, t) => ({
3819
- idx: t,
3820
- markerSymbol: Xi[t % Xi.length]
3821
- }))
3822
- };
3823
- return Zi.add(a), a;
3824
- }
3825
- function ea(e) {
3826
- if (e.plotVisibleOnly !== !0) return e;
3827
- if (qi(e)) {
3828
- let t = [];
3829
- return {
3830
- ...e,
3831
- series: e.series.flatMap((n, r) => {
3832
- let i = n.categories == null ? {
3833
- ...n,
3834
- categories: e.categories
3835
- } : n, a = i.sourceHidden, o = a && Hi(a, Wi(i));
3836
- if (!o) return t.push(r), [i];
3837
- if (o.keep.length === 0) return [];
3838
- t.push(r);
3839
- let s = Gi(i, o);
3840
- return e.chartType === "scatter" ? [$i(e, s)] : [s];
3841
- }),
3842
- plotGroups: Yi(e, t)
3843
- };
3844
- }
3845
- let t = Math.max(e.categories.length, ...e.categoryLevels?.map((e) => e.length) ?? [], ...e.series.map(Wi)), n = e.categorySourceHidden ? Hi(e.categorySourceHidden, t) : null, r = [], i = e.series.flatMap((e, t) => {
3846
- let i = n ? Gi(e, n) : e;
3847
- return n?.keep.length === 0 || Ji(i) ? [] : (r.push(t), [Ki(i)]);
3848
- }), a = Yi(e, r);
3849
- if (!n) return {
3850
- ...e,
3851
- series: i,
3852
- plotGroups: a
3853
- };
3854
- let o = e.subtotalIndices.flatMap((e) => {
3855
- if (e >= n.remap.length) return [];
3856
- let t = n.remap[e];
3857
- return t >= 0 ? [t] : [];
3858
- });
3859
- return {
3860
- ...e,
3861
- categories: Z(e.categories, n) ?? [],
3862
- categoryLevels: e.categoryLevels?.map((e) => Z(e, n) ?? []),
3863
- categorySourceHidden: Z(e.categorySourceHidden, n),
3864
- subtotalIndices: o,
3865
- series: i,
3866
- plotGroups: a
3867
- };
3868
- }
3869
- //#endregion
3870
- //#region packages/core/src/chart/image-fill.ts
3871
- var ta = new Set([
3872
- "line",
3873
- "stackedLine",
3874
- "stackedLinePct",
3875
- "area",
3876
- "stackedArea",
3877
- "stackedAreaPct",
3878
- "clusteredBar",
3879
- "clusteredBarH",
3880
- "stackedBar",
3881
- "stackedBarH",
3882
- "stackedBarPct",
3883
- "stackedBarHPct",
3884
- "surface",
3885
- "surface3D"
3886
- ]);
3887
- function na(e) {
3888
- return JSON.stringify([
3889
- e.imagePath,
3890
- e.svgImagePath ?? null,
3891
- e.duotone?.clr1 ?? null,
3892
- e.duotone?.clr2 ?? null
3893
- ]);
3894
- }
3895
- var Q;
3896
- function ra(e, t) {
3897
- let n = Q;
3898
- Q = e;
3899
- try {
3900
- return ni(ba, t);
3901
- } finally {
3902
- Q = n;
3903
- }
3904
- }
3905
- function ia(e, t, n, r, i) {
3906
- let a = e;
3907
- return {
3908
- x: a.endsWith("r") || a === "r" ? t - r : a === "t" || a === "ctr" || a === "b" ? (t - r) / 2 : 0,
3909
- y: a.startsWith("b") || a === "b" ? n - i : a === "l" || a === "ctr" || a === "r" ? (n - i) / 2 : 0
3910
- };
3911
- }
3912
- var aa = new Set([
3913
- "tl",
3914
- "t",
3915
- "tr",
3916
- "l",
3917
- "ctr",
3918
- "r",
3919
- "bl",
3920
- "b",
3921
- "br"
3922
- ]), oa = new Set([
3923
- "none",
3924
- "x",
3925
- "y",
3926
- "xy"
3927
- ]);
3928
- function sa(e) {
3929
- return e.tile != null != (e.stretch === !0) && Cn(e.srcRect);
3930
- }
3931
- function ca(e) {
3932
- let t = e.tile;
3933
- if (!t) return null;
3934
- let { algn: n, tx: r, ty: i, sx: a, sy: o } = t, s = t.flip ?? "none", c = e.dpi;
3935
- return !n || !aa.has(n) || !oa.has(s) || !Number.isFinite(r) || !Number.isFinite(i) || !(c != null && Number.isFinite(c) && c > 0) || !(Number.isFinite(a) && a > 0) || !(Number.isFinite(o) && o > 0) ? null : {
3936
- alignment: n,
3937
- tx: r,
3938
- ty: i,
3939
- sx: a,
3940
- sy: o,
3941
- dpi: c,
3942
- flipX: s === "x" || s === "xy",
3943
- flipY: s === "y" || s === "xy"
3944
- };
3945
- }
3946
- function la(e) {
3947
- return !W(e) || !sa(e) ? null : Q?.(e) ?? null;
3948
- }
3949
- function ua(t, r, i = e) {
3950
- let a = ca(t);
3951
- if (!a) return null;
3952
- let o = wn(r);
3953
- if (!(Number.isFinite(o.w) && o.w > 0) || !(Number.isFinite(o.h) && o.h > 0)) return null;
3954
- let s = 96 / a.dpi * (i / e), c = o.w * a.sx * s, l = o.h * a.sy * s;
3955
- return !(c > 0) || !(l > 0) ? null : {
3956
- alignment: a.alignment,
3957
- tileW: c,
3958
- tileH: l,
3959
- offsetX: a.tx / n * i,
3960
- offsetY: a.ty / n * i,
3961
- flipX: a.flipX,
3962
- flipY: a.flipY
3963
- };
3964
- }
3965
- function da(e, t, n) {
3966
- let r = ia(e.alignment, t, n, e.tileW, e.tileH);
3967
- return {
3968
- x: r.x + e.offsetX,
3969
- y: r.y + e.offsetY
3970
- };
3971
- }
3972
- function fa(e, t, n, r, i) {
3973
- let a = ua(e, t, i);
3974
- if (!a) return null;
3975
- let { tileW: o, tileH: s } = a, c = Math.ceil(n / o) + 2, l = Math.ceil(r / s) + 2, u = c * l;
3976
- return Number.isSafeInteger(u) ? {
3977
- ...a,
3978
- columns: c,
3979
- rows: l,
3980
- repetitions: u
3981
- } : null;
3982
- }
3983
- function pa(t, n, r, i, a = e) {
3984
- if (!(r > 0) || !(i > 0) || !W(t) || !sa(t)) return 0;
3985
- let o = (n ?? Q)?.(t);
3986
- if (!o) return 0;
3987
- if (!t.tile) return 1;
3988
- let s = fa(t, o, r, i, a);
3989
- return s ? Math.min(s.repetitions, mi) : 0;
3990
- }
3991
- function $(e) {
3992
- return Number.isFinite(e) && e > 0;
3993
- }
3994
- function ma(e, t) {
3995
- if (!$(t.widthPt) || !$(t.heightPt) || !$(e.metafileWidthFactor) || !$(e.metafileHeightFactor) || !Number.isFinite(e.targetWidthFactor) || e.targetWidthFactor < 0 || !Number.isFinite(e.targetHeightFactor) || e.targetHeightFactor < 0) return null;
3996
- let n = t.widthPt * e.metafileWidthFactor, r = t.heightPt * e.metafileHeightFactor;
3997
- if (!$(n) || !$(r)) return null;
3998
- let i = t.targetWidthPx, a = t.targetHeightPx;
3999
- if (i != null != (a != null)) return null;
4000
- if (i == null || a == null) return {
4001
- widthPt: n,
4002
- heightPt: r
4003
- };
4004
- if (!$(i) || !$(a)) return null;
4005
- let o = i * e.targetWidthFactor, s = a * e.targetHeightFactor;
4006
- if (!Number.isFinite(o) || o < 0 || e.targetWidthFactor > 0 && o === 0 || !Number.isFinite(s) || s < 0 || e.targetHeightFactor > 0 && s === 0) return null;
4007
- let c = Math.ceil(o), l = Math.ceil(s);
4008
- return !Number.isFinite(c) || !Number.isFinite(l) ? null : {
4009
- widthPt: n,
4010
- heightPt: r,
4011
- targetWidthPx: c,
4012
- targetHeightPx: l
4013
- };
4014
- }
4015
- function ha(e) {
4016
- if (!W(e) || !sa(e)) return null;
4017
- let t = e.srcRect ? 1 - e.srcRect.l - e.srcRect.r : 1, n = e.srcRect ? 1 - e.srcRect.t - e.srcRect.b : 1;
4018
- if (!(Number.isFinite(t) && t > 0) || !(Number.isFinite(n) && n > 0)) return null;
4019
- let r = e.srcRect != null;
4020
- if (e.tile) {
4021
- if (!ca(e)) return null;
4022
- let i = 1 / t, a = 1 / n;
4023
- return !$(i) || !$(a) ? null : {
4024
- preserveNaturalSize: !0,
4025
- hasSourceCrop: r,
4026
- targetWidthFactor: 0,
4027
- targetHeightFactor: 0,
4028
- metafileWidthFactor: i,
4029
- metafileHeightFactor: a
4030
- };
4031
- }
4032
- let i = e.fillRect, a = i?.l ?? 0, o = i?.t ?? 0, s = i?.r ?? 0, c = i?.b ?? 0;
4033
- if (![
4034
- a,
4035
- o,
4036
- s,
4037
- c
4038
- ].every(Number.isFinite)) return null;
4039
- let l = 1 - a - s, u = 1 - o - c;
4040
- if (!$(l) || !$(u)) return null;
4041
- let d = l / t, f = u / n;
4042
- return !$(d) || !$(f) ? null : {
4043
- preserveNaturalSize: !1,
4044
- hasSourceCrop: r,
4045
- targetWidthFactor: d,
4046
- targetHeightFactor: f,
4047
- metafileWidthFactor: d,
4048
- metafileHeightFactor: f
4049
- };
4050
- }
4051
- function ga(e, t) {
4052
- return {
4053
- fill: e.fill,
4054
- preserveNaturalSize: e.preserveNaturalSize || t.preserveNaturalSize,
4055
- hasSourceCrop: e.hasSourceCrop || t.hasSourceCrop,
4056
- targetWidthFactor: Math.max(e.targetWidthFactor, t.targetWidthFactor),
4057
- targetHeightFactor: Math.max(e.targetHeightFactor, t.targetHeightFactor),
4058
- metafileWidthFactor: Math.max(e.metafileWidthFactor, t.metafileWidthFactor),
4059
- metafileHeightFactor: Math.max(e.metafileHeightFactor, t.metafileHeightFactor)
4060
- };
4061
- }
4062
- function _a(e, t) {
4063
- if (Ci(e) > 1e4) return {
4064
- usages: [],
4065
- sourceLimitExceeded: !1,
4066
- usageRejected: !1
4067
- };
4068
- e = ea(e), e = w(e);
4069
- let n = /* @__PURE__ */ new Map(), r = !1, i = !1, a = (e) => {
4070
- if (i || !e || typeof e != "object" || e.fillType !== "image") return;
4071
- let a = e, o = ha(a);
4072
- if (!o) return;
4073
- let s = na(a), c = {
4074
- fill: a,
4075
- ...o
4076
- };
4077
- if (t && !t(c)) {
4078
- i = !0;
4079
- return;
4080
- }
4081
- let l = n.get(s);
4082
- if (l) {
4083
- n.set(s, ga(l, c));
4084
- return;
4085
- }
4086
- if (n.size >= 256) {
4087
- r = !0;
4088
- return;
4089
- }
4090
- n.set(s, c);
4091
- }, o = (e, t) => {
4092
- let n = M(e, t);
4093
- return n?.fillType === "image" || n == null ? n : null;
4094
- }, s = (e, t, n) => {
4095
- let r = N(e, t, n);
4096
- return r?.fillType === "image" || r == null ? r : null;
4097
- }, c = (e, t, n, r, i) => {
4098
- let a = e?.fillHidden ? P(r) : N(e, r, i);
4099
- if (a !== void 0) return a?.fillType === "image" ? a : null;
4100
- if (t) return null;
4101
- let o = M(n, i);
4102
- return o?.fillType === "image" || o == null ? o : null;
4103
- }, l = (t, n, r) => t?.fillHidden === !0 || t?.color != null || t?.chartexStyle?.fillPaintAuthored === !0 || t?.chartexStyle?.fillHidden != null || t?.chartexStyle?.fillColors?.some((e) => e != null) === !0 || t?.chartexStyle?.fillPaints?.some((e) => e != null) === !0 ? c(t?.fillHidden === !0 ? {
4104
- ...t.chartexStyle,
4105
- fillHidden: !0,
4106
- fillPaintAuthored: !0
4107
- } : t?.chartexStyle, t?.color, e.chartexDataPointStyle, T(e, "dataPoint") ?? (e.classicChartStyleRoles == null ? e.chartexDataPointStyle : void 0), r) : n?.chartexStyle?.fillPaintAuthored === !0 ? c(n.chartexStyle, n.color, e.chartexDataPointStyle, T(e, "dataPoint") ?? (e.classicChartStyleRoles == null ? e.chartexDataPointStyle : void 0), r) : c(n?.chartexStyle, n?.color, e.chartexDataPointStyle, T(e, "dataPoint"), r), u = (e, t, n, r, i, a, o) => {
4108
- if (n === !0) {
4109
- let e = P(a);
4110
- if (e !== void 0) return e;
4111
- }
4112
- if (e?.fillType === "image") return e;
4113
- if (e != null || t != null || r === !0 && n !== !0) return null;
4114
- if (i?.fillNoStyle === !0) return;
4115
- let s = F(i, a, 0, o);
4116
- return s?.fillType === "image" || s == null ? s : null;
4117
- }, d = u(e.chartFill, void 0, e.chartFillHidden, e.chartFillPaintAuthored, e.chartStyleRoles?.chartArea, T(e, "chartArea"), e.chartAreaStyle);
4118
- d && a(d);
4119
- let f = u(e.plotAreaFill, e.plotAreaBg, e.plotAreaFillHidden, e.plotAreaFillPaintAuthored, e.threeD ? e.chartStyleRoles?.plotArea3D : e.chartStyleRoles?.plotArea, T(e, e.threeD ? "plotArea3D" : "plotArea"), e.plotAreaStyle);
4120
- f && a(f), e.showLegend && a(Bi(e));
4121
- let p = (e, t, n, r = 0) => {
4122
- a(ii(e, t, n, !0, 0, r)?.fillPaint);
4123
- };
4124
- e.title && p(e.titleStyle ? { style: e.titleStyle } : void 0, e.chartStyleRoles?.title, T(e, "title")), e.catAxisTitle && p(e.catAxisTitleStyle ? { style: e.catAxisTitleStyle } : void 0, e.chartStyleRoles?.axisTitle, T(e, "axisTitle")), e.valAxisTitle && p(e.valAxisTitleStyle ? { style: e.valAxisTitleStyle } : void 0, e.chartStyleRoles?.axisTitle, T(e, "axisTitle"));
4125
- for (let t of [e.secondaryValAxis, e.secondaryCatAxis]) t?.title && p(t.titleStyle ? { style: t.titleStyle } : void 0, e.chartStyleRoles?.axisTitle, T(e, "axisTitle")), t?.displayUnits?.label && p(t.displayUnits.label.boxStyle, e.chartStyleRoles?.axisTitle, T(e, "axisTitle"));
4126
- e.threeD?.seriesAxis?.title && p(e.threeD.seriesAxis.titleStyle ? { style: e.threeD.seriesAxis.titleStyle } : void 0, e.chartStyleRoles?.axisTitle, T(e, "axisTitle"));
4127
- for (let t of [e.valAxisDisplayUnits, e.catAxisDisplayUnits]) t?.label && p(t.label.boxStyle, e.chartStyleRoles?.axisTitle, T(e, "axisTitle"));
4128
- let m = e.series.some((e) => e.values.some((e) => e != null && Number.isFinite(e))), h = Math.max(e.categories.length, ...e.series.map((e) => e.categories?.length ?? e.values.length)), g = e.chartType === "surface" || e.chartType === "surface3D" ? e.series.length >= 2 && h >= 2 && m : m;
4129
- if (e.threeD && ta.has(e.chartType) && g) {
4130
- let t = e.valMin != null && Number.isFinite(e.valMin) && e.valMax != null && Number.isFinite(e.valMax) ? e.valMax - e.valMin : void 0;
4131
- for (let [n, r] of [
4132
- ["floor", "floor"],
4133
- ["sideWall", "wall"],
4134
- ["backWall", "wall"]
4135
- ]) {
4136
- let i = e.threeD[n], o = de(e, i, r).fill;
4137
- o?.fillType === "image" && Mi(o, i, n, t) && a(o);
4138
- }
4139
- }
4140
- let _ = Ft(e), v = (t, n) => {
4141
- let r = ue(e, t, n);
4142
- return r?.fillType === "image" || r == null ? r : null;
4143
- }, y = (e, t, n) => {
4144
- if (!e || !t) return;
4145
- let r = !1, i = !1, o = Math.max(e.values.length, t.values.length);
4146
- for (let n = 0; n < o && !(r && i); n++) {
4147
- let a = e.values[n], o = t.values[n];
4148
- a == null || o == null || !Number.isFinite(a) || !Number.isFinite(o) || a === o || (o > a ? r = !0 : i = !0);
4149
- }
4150
- r && a(v(n.up, "upBar")), i && a(v(n.down, "downBar"));
4151
- };
4152
- for (let t of e.lineGroupDecorations ?? []) {
4153
- if (!t.upDownBars) continue;
4154
- let n = e.series.filter((e) => e.lineGroupIndex === t.groupIndex);
4155
- n.length === 0 && t.groupIndex === 0 && [
4156
- "line",
4157
- "stackedLine",
4158
- "stackedLinePct"
4159
- ].includes(e.chartType) && (n = e.series.filter((e) => e.seriesType == null || e.seriesType === "line")), y(n[0], n.at(-1), t.upDownBars);
4160
- }
4161
- if (e.stockUpDownBars) {
4162
- let t = e.plotGroups?.find((e) => e.kind === "stock"), n = t ? e.series.slice(t.seriesStart, t.seriesStart + t.seriesCount) : e.series;
4163
- y(n[0], n.at(-1), e.stockUpDownBarStyle ?? {
4164
- gapWidthPercent: 150,
4165
- up: {},
4166
- down: {}
4167
- });
4168
- }
4169
- let b = e.series.some((t, n) => {
4170
- let r = _[n];
4171
- return (r?.kind === "bubble" || r?.kind === "scatter" ? "scatter" : t.seriesType ?? (e.chartType === "bubble" ? "scatter" : e.chartType)) === "scatter" && (t.categories ?? e.categories).some((e) => Number.isFinite(Number.parseFloat(e)));
4172
- }), x = pt(e), S = dt(e, !0), C = e.categories.length > 0 || (e.series[0]?.categories?.length ?? 0) > 0 || e.series.some((e) => e.values.length > 0);
4173
- for (let t = 0; t < e.series.length; t++) {
4174
- let n = e.series[t], r = n.chartexFormatIdx ?? t, i = E(e, t), c = D(e, "dataPointMarker", t), l = _[t], u = l?.kind === "bubble" || l == null && e.chartType === "bubble", d = l?.kind === "bubble" || l?.kind === "scatter" ? "scatter" : n.seriesType ?? (e.chartType === "bubble" ? "scatter" : e.chartType), f = It(e.chartType, l), m = l?.scatterStyle ?? e.scatterStyle, h = l?.radarStyle ?? e.radarStyle, g = {
4175
- chartType: f,
4176
- bubbleScale: l?.bubbleScale ?? e.bubbleScale,
4177
- showNegativeBubbles: l?.showNegativeBubbles ?? e.showNegativeBubbles
4178
- }, v = d === "line" || d === "stackedLine" || d === "stackedLinePct" || d === "area" || d === "stackedArea" || d === "stackedAreaPct" || d === "scatter" || d === "radar" || d === "stock", y = d === "area" || d === "stackedArea" || d === "stackedAreaPct", w = y ? (n.showMarker === !0 || gt(n)) && n.markerSymbol !== "none" : d === "stock" ? n.markerSymbol != null && n.markerSymbol !== "none" : n.showMarker !== !1 && n.markerSymbol !== "none", O = ht(S, x, t), k = Math.max(n.values.length, n.categories?.length ?? 0, e.categories.length), A = new Map((n.dataLabelOverrides ?? []).map((e) => [e.idx, e]));
4179
- for (let i = 0; i < k; i++) {
4180
- let a = A.get(i);
4181
- if (I(n.seriesDataLabels, a) || !(a?.text || (a?.showVal ?? n.seriesDataLabels?.showVal ?? e.showDataLabels) || (a?.showCatName ?? n.seriesDataLabels?.showCatName) || (a?.showSerName ?? n.seriesDataLabels?.showSerName) || (a?.showPercent ?? n.seriesDataLabels?.showPercent) || (a?.showBubbleSize ?? n.seriesDataLabels?.showBubbleSize) || (a?.showLegendKey ?? n.seriesDataLabels?.showLegendKey)) || !L(e, n, d, i, b, t)) continue;
4182
- let o = ai(a?.labelBox, n.seriesDataLabels?.labelBox), s = Y(o);
4183
- p(o, s ? e.chartStyleRoles?.dataLabelCallout ?? e.chartStyleRoles?.dataLabel : e.chartStyleRoles?.dataLabel, s ? T(e, "dataLabelCallout") ?? T(e, "dataLabel") : T(e, "dataLabel"), a ? i : r);
4184
- }
4185
- for (let t of n.trendLines ?? []) (t.dispEq === !0 || t.dispRSqr === !0 || t.labelText || t.labelRichRuns?.some((e) => e.text.length > 0) === !0) && p(t.labelBox, e.chartStyleRoles?.trendlineLabel, T(e, "trendlineLabel"), r);
4186
- let ee = St(e, n, d, k, b, g, t) > 0, te = new Map((n.dataLabelOverrides ?? []).map((e) => [e.idx, e])), ne = (r) => {
4187
- let i = te.get(r);
4188
- return !I(n.seriesDataLabels, i) && (i?.showLegendKey ?? n.seriesDataLabels?.showLegendKey ?? !1) === !0 && L(e, n, d, r, b, t);
4189
- }, j = S[t]?.pointDriven === !0, re = !j && Tt(f, m, n, h) && (e.showLegend && O || e.dataTable?.showKeys === !0 && R(e.chartType) && C || ee), ie = n.markerSymbol ?? (d === "stock" ? "none" : "circle");
4190
- if (!(l?.kind === "bar3D" || l?.kind === "pie3D" || l?.kind === "area3D" || l?.kind === "line3D" || l?.kind === "surface3D") && (l?.kind === "bar" || d === "bar" || d === "clusteredBar" || d === "clusteredBarH" || d === "stackedBar" || d === "stackedBarH" || d === "stackedBarPct" || d === "stackedBarHPct" || d === "pie" || d === "doughnut" || d === "ofPie" || y || d === "radar" && h === "filled")) {
4191
- let o = new Map((n.dataPointOverrides ?? []).map((e) => [e.idx, e])), s = y ? n.values.length > 0 : d === "radar" ? k > 2 && Array.from({ length: k }, (e, t) => n.values[t] != null && Number.isFinite(n.values[t])).every(Boolean) : n.values.some((e) => e != null && Number.isFinite(e) && e !== 0), c = e.showLegend && O || e.dataTable?.showKeys === !0 && R(e.chartType) && C || ee, l = i || d === "pie" || d === "doughnut" || d === "ofPie";
4192
- if (s || c) if (y || d === "radar" && !i) {
4193
- let t = pe(e, n, void 0, r);
4194
- t?.fillType === "image" && a(t);
4195
- } else if (d === "radar") {
4196
- let t = o.get(0), r = pe(e, n, t, 0, 0);
4197
- r?.fillType === "image" && a(r);
4198
- } else {
4199
- if (c && !l) {
4200
- let t = pe(e, n, void 0, r);
4201
- t?.fillType === "image" && a(t);
4202
- }
4203
- for (let s = 0; s < k; s++) {
4204
- let c = n.values[s], u = c != null && Number.isFinite(c) && c !== 0, d = l && (e.showLegend && mt(S, x, t, s) || e.dataTable?.showKeys === !0 && R(e.chartType) && C && s === 0 || ne(s));
4205
- if (!u && !d) continue;
4206
- let f = o.get(s), p = pe(e, n, f, i ? s : r, s);
4207
- p?.fillType === "image" && a(p);
4208
- }
4209
- }
4210
- }
4211
- if (!v || wt(d, f, m, h)) continue;
4212
- if (re && bt(ie)) {
4213
- if (u) {
4214
- let i = T(e, "dataPoint"), c = s(n.chartexStyle, i, r);
4215
- if (c && a(c), c === void 0 && n.color == null) {
4216
- let n = o(D(e, "dataPoint", t), r);
4217
- n && a(n);
4218
- }
4219
- } else a(n.markerFillPaint);
4220
- if (!u && n.markerFillPaint === void 0 && n.markerFill == null && !(n.markerFillPaintAuthored === !0 && n.markerStyle?.fillHidden !== !0) && !i) {
4221
- let t = F(c, T(e, "dataPointMarker"), r, n.markerStyle);
4222
- t?.fillType === "image" && a(t);
4223
- }
4224
- }
4225
- if (!w && !Ct(n)) continue;
4226
- let M = new Map((n.dataPointOverrides ?? []).map((e) => [e.idx, e]));
4227
- for (let f = 0; f < k; f++) {
4228
- let p = xt(e, n, d, f, b, g) && (!u || (l?.bubbleScale ?? e.bubbleScale ?? 100) > 0 && vt({ showNegativeBubbles: l?.showNegativeBubbles ?? e.showNegativeBubbles }, n.bubbleSizes?.[f]) != null), m = j && e.showLegend && mt(S, x, t, f), h = j && e.dataTable?.showKeys === !0 && R(e.chartType) && C && f === 0, _ = j && ne(f);
4229
- if (!p && !m && !h && !_) continue;
4230
- let v = M.get(f);
4231
- if (!bt(Et(n, v, "circle", w))) continue;
4232
- if (u) {
4233
- if ((n.bubbleSizes?.[f] ?? 0) < 0) continue;
4234
- let i = D(e, "dataPoint", t), c = E(e, t) ? f : r, l = T(e, "dataPoint"), u = N(v?.chartexStyle, l, f), d = u?.fillType === "image" || u == null ? u : null;
4235
- d && a(d);
4236
- let p = v?.fillHidden === !0 ? P(l) : void 0;
4237
- if (d !== void 0 || p !== void 0 || v?.color != null || n.dataPointColors?.[f] != null) continue;
4238
- let m = s(n.chartexStyle, l, r);
4239
- if (m && a(m), m !== void 0 || n.color != null) continue;
4240
- let h = o(i, c);
4241
- h && a(h);
4242
- continue;
4243
- }
4244
- let y = Dt(n, v, f);
4245
- if (a(y), y === void 0 && v?.markerFill == null && v?.color == null && n.dataPointColors?.[f] == null && n.markerFill == null && !(v?.markerFillPaintAuthored === !0 && v.markerStyle?.fillHidden !== !0) && !(n.markerFillPaintAuthored === !0 && n.markerStyle?.fillHidden !== !0)) {
4246
- let t = v?.markerStyle?.shapePropertiesPresent === !0 ? v.markerStyle : n.markerStyle, o = F(c, T(e, "dataPointMarker"), i ? f : r, t);
4247
- o?.fillType === "image" && a(o);
4248
- }
4249
- }
4250
- }
4251
- for (let t = 0; t < (e.chartexBox?.series.length ?? 0); t++) {
4252
- let n = e.chartexBox.series[t];
4253
- if (!bt(e.chartStyleMarkerSymbol ?? e.chartexMarkerSymbol ?? "circle") || !(n.showNonoutliers || n.showOutliers)) continue;
4254
- let r = 0;
4255
- for (let e of n.valuesByCategory) {
4256
- let t = nr(e, n.quartileMethod);
4257
- t && (n.showNonoutliers && (r += t.inner.length), n.showOutliers && (r += t.outliers.length));
4258
- }
4259
- if (r === 0) continue;
4260
- let i = n.chartexFormatIdx ?? t, c = n.chartexStyle, l = e.chartexDataPointMarkerStyle ?? e.chartexDataPointStyle ?? void 0, u = s(c, e.chartexDataPointMarkerStyle == null ? T(e, "dataPoint") ?? (e.classicChartStyleRoles == null ? l : void 0) : T(e, "dataPointMarker") ?? (e.classicChartStyleRoles == null ? l : void 0), i);
4261
- if (u && a(u), u !== void 0 || n.color != null) continue;
4262
- let d = o(l, i);
4263
- d && a(d);
4264
- }
4265
- if (e.chartType === "waterfall") {
4266
- let t = e.series[0], n = new Map((t?.dataPointOverrides ?? []).map((e) => [e.idx, e])), r = di(t?.values ?? [], e.categories.length, e.subtotalIndices);
4267
- if (!r.cumulativeOverflow && r.rawMax > r.rawMin) for (let e = 0; e < r.bars.length; e++) {
4268
- let i = r.bars[e];
4269
- i.paintSlot && a(l(n.get(e), t, i.semanticIndex));
4270
- }
4271
- } else if (e.chartType === "funnel") {
4272
- let t = e.series[0];
4273
- (t?.values ?? []).some((e) => e != null && e > 0) && a(c(t?.chartexStyle, t?.color, e.chartexDataPointStyle, T(e, "dataPoint"), 0));
4274
- }
4275
- for (let t = 0; t < (e.chartexBox?.series.length ?? 0); t++) {
4276
- let n = e.chartexBox.series[t];
4277
- n.valuesByCategory.some((e) => nr(e, n.quartileMethod) != null) && a(c(n.chartexStyle, n.color, e.chartexDataPointStyle, T(e, "dataPoint"), n.chartexFormatIdx ?? t));
4278
- }
4279
- let O = e.series[0];
4280
- return li(e, ({ node: t, paintsBody: n }) => {
4281
- n && a(c(O?.chartexStyle, O?.color, e.chartexDataPointStyle, T(e, "dataPoint"), t.branchIndex));
4282
- }), ui(e, ({ label: t, linkedStyleIndex: n }) => {
4283
- let r = t.labelBox, i = Y(r), o = i ? e.chartStyleRoles?.dataLabelCallout ?? e.chartStyleRoles?.dataLabel : e.chartStyleRoles?.dataLabel, s = ii(r, o, i ? T(e, "dataLabelCallout") ?? T(e, "dataLabel") : T(e, "dataLabel"), o != null, 0, n);
4284
- s?.fillPaint?.fillType === "image" && a(s.fillPaint);
4285
- }), {
4286
- usages: r || i ? [] : [...n.values()],
4287
- sourceLimitExceeded: r,
4288
- usageRejected: i
4289
- };
4290
- }
4291
- function va(e) {
4292
- return m(() => k(() => _a(e).usages));
4293
- }
4294
- function ya(e, t) {
4295
- return m(() => k(() => {
4296
- let n = /* @__PURE__ */ new Map();
4297
- for (let r = 0; r < e.length; r++) {
4298
- let i = e[r], a = _a(i, t ? (e) => t(e, r) : void 0);
4299
- if (!a.usageRejected) {
4300
- if (a.sourceLimitExceeded) return [];
4301
- for (let e of a.usages) {
4302
- let t = na(e.fill), r = n.get(t);
4303
- if (r) {
4304
- n.set(t, ga(r, e));
4305
- continue;
4306
- }
4307
- if (n.size >= 256) return [];
4308
- n.set(t, e);
4309
- }
4310
- }
4311
- }
4312
- return [...n.values()];
4313
- }));
4314
- }
4315
- function ba(t, n, r, i, a, o, s = e, c = 0) {
4316
- if (!W(n) || !(a > 0) || !(o > 0) || !sa(n)) return !1;
4317
- let l = Q?.(n);
4318
- if (!l || c !== 0 && n.rotWithShape == null) return !1;
4319
- if (t.save(), t.beginPath(), t.rect(r, i, a, o), t.clip(), n.rotWithShape === !1 && c !== 0 && (t.translate(r + a / 2, i + o / 2), t.rotate(-c * Math.PI / 180), t.translate(-(r + a / 2), -(i + o / 2))), n.alpha != null && (t.globalAlpha *= Math.max(0, Math.min(1, n.alpha))), !n.tile) {
4320
- let e = n.fillRect, s = r + (e?.l ?? 0) * a, c = i + (e?.t ?? 0) * o, u = (1 - (e?.l ?? 0) - (e?.r ?? 0)) * a, d = (1 - (e?.t ?? 0) - (e?.b ?? 0)) * o;
4321
- return u > 0 && d > 0 && En(t, l, n.srcRect, s, c, u, d), t.restore(), u > 0 && d > 0;
4322
- }
4323
- let u = fa(n, l, a, o, s);
4324
- if (!u || u.repetitions > 4096) return t.restore(), !1;
4325
- let { tileW: d, tileH: f, flipX: p, flipY: m, columns: h, rows: g } = u, _ = da(u, a, o), v = r + _.x, y = i + _.y, b = Math.floor((r - v) / d) - 1, x = Math.floor((i - y) / f) - 1;
4326
- for (let e = x; e < x + g; e++) for (let r = b; r < b + h; r++) {
4327
- let i = v + r * d, a = y + e * f, o = p && Math.abs(r) % 2 == 1, s = m && Math.abs(e) % 2 == 1;
4328
- t.save(), t.translate(i + (o ? d : 0), a + (s ? f : 0)), t.scale(o ? -1 : 1, s ? -1 : 1), En(t, l, n.srcRect, 0, 0, d, f), t.restore();
4329
- }
4330
- return t.restore(), !0;
4331
- }
4332
- //#endregion
4333
- //#region packages/core/src/chart/plot-area-frame.ts
4334
- function xa(e, t, r, i, a, o, s, c = 0) {
4335
- Mr(e, t.plotAreaStyle, t.threeD ? t.chartStyleRoles?.plotArea3D : t.chartStyleRoles?.plotArea, 0, {
4336
- x: r,
4337
- y: i,
4338
- w: a,
4339
- h: o
4340
- }, s, (e) => {
4341
- if (t.plotAreaFillHidden !== !0) if (t.plotAreaFill?.fillType === "image") ba(e, t.plotAreaFill, r, i, a, o, s, c);
4342
- else {
4343
- let n = t.plotAreaFill ? G(t.plotAreaFill, e, r, i, a, o, c) : t.plotAreaBg ? `#${t.plotAreaBg}` : null;
4344
- n && (e.fillStyle = n, e.fillRect(r, i, a, o));
4345
- }
4346
- if (t.plotAreaLineHidden === !0 || !t.plotAreaLineFill && !t.plotAreaLineColor) return;
4347
- let l = t.plotAreaLineWidthEmu ? Math.max(.5, t.plotAreaLineWidthEmu / n) * s : 1;
4348
- e.save();
4349
- let u = t.plotAreaLineFill ? G(t.plotAreaLineFill, e, r, i, a, o, c) : t.plotAreaLineColor ? `#${t.plotAreaLineColor}` : null;
4350
- u && (e.strokeStyle = u, e.setLineDash(Bn(t.plotAreaLineCustomDash, t.plotAreaLineDash, l)), e.lineCap = t.plotAreaLineCap === "rnd" ? "round" : t.plotAreaLineCap === "sq" ? "square" : "butt", e.lineJoin = t.plotAreaLineJoin === "round" || t.plotAreaLineJoin === "bevel" ? t.plotAreaLineJoin : "miter", zi(e, r, i, a, o, l, t.plotAreaLineCompound)), e.restore();
4351
- });
4352
- }
4353
- //#endregion
4354
- export { J as $, ce as $n, gt as $t, wi as A, Me as An, Sn as At, oi as B, ge as Bn, yt as Bt, Ei as C, Oe as Cn, En as Ct, pi as D, Le as Dn, en as Dt, mi as E, ke as En, Dn as Et, ui as F, Te as Fn, Bt as Ft, Gr as G, ye as Gn, Et as Gt, Jr as H, me as Hn, L as Ht, ci as I, We as In, Rt as It, Vr as J, ue as Jn, Dt as Jt, Hr as K, pe as Kn, Ct as Kt, Y as L, be as Ln, Lt, Ci as M, Ee as Mn, Gt as Mt, di as N, He as Nn, Ut as Nt, fi as O, Re as On, Qt as Ot, li as P, Se as Pn, z as Pt, Ir as Q, P as Qn, _t as Qt, ii as R, Ue as Rn, Ft as Rt, Di as S, Ve as Sn, Tn as St, X as T, Ae as Tn, On as Tt, Kr as U, _e as Un, xt as Ut, ei as V, ve as Vn, R as Vt, qr as W, he as Wn, St as Wt, Nr as X, N as Xn, bt as Xt, Pr as Y, j as Yn, jt as Yt, Fr as Z, se as Zn, wt as Zt, Ii as _, it as _n, Pn as _t, ma as a, pt as an, de as ar, mr as at, Mi as b, $e as bn, Un as bt, va as c, dt as cn, v as cr, ar as ct, ra as d, st as dn, y as dr, rr as dt, Tt as en, F as er, Mr as et, ea as f, tt as fn, C as fr, nr as ft, Ni as g, ot as gn, G as gt, zi as h, et as hn, w as hr, U as ht, la as i, lt as in, ae as ir, dr as it, Si as j, De as jn, xn as jt, bi as k, ze as kn, Zt as kt, ya as l, ct as ln, g as lr, sr as lt, Vi as m, I as mn, m as mr, Jn as mt, na as n, kt as nn, ne as nr, yr as nt, ua as o, ft as on, k as or, pr as ot, Qi as p, nt as pn, T as pr, Zn as pt, Br as q, fe as qn, Ot as qt, pa as r, vt as rn, le as rr, fr as rt, da as s, mt as sn, D as sr, or as st, xa as t, At as tn, M as tr, Ar as tt, ba as u, ht as un, E as ur, ir as ut, Pi as v, at as vn, Bn as vt, Oi as w, je as wn, wn as wt, Ti as x, Je as xn, In as xt, Fi as y, Qe as yn, Rn as yt, ai as z, Be as zn, It as zt };