@pyreon/charts 0.6.0

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 (56) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +159 -0
  3. package/lib/analysis/index.js.html +5406 -0
  4. package/lib/analysis/manual.js.html +5406 -0
  5. package/lib/charts-Ckh2qxB5.js +17571 -0
  6. package/lib/charts-Ckh2qxB5.js.map +1 -0
  7. package/lib/components-BcPePBeS.js +13688 -0
  8. package/lib/components-BcPePBeS.js.map +1 -0
  9. package/lib/core-9w0g6EOI.js +200 -0
  10. package/lib/core-9w0g6EOI.js.map +1 -0
  11. package/lib/createSeriesData-DOHScdgk.js +412 -0
  12. package/lib/createSeriesData-DOHScdgk.js.map +1 -0
  13. package/lib/customGraphicKeyframeAnimation-CvkEkSt_.js +8524 -0
  14. package/lib/customGraphicKeyframeAnimation-CvkEkSt_.js.map +1 -0
  15. package/lib/graphic-CPJ2K90a.js +10771 -0
  16. package/lib/graphic-CPJ2K90a.js.map +1 -0
  17. package/lib/index.js +309 -0
  18. package/lib/index.js.map +1 -0
  19. package/lib/manual.js +334 -0
  20. package/lib/manual.js.map +1 -0
  21. package/lib/parseGeoJson-BlBe5Vig.js +18498 -0
  22. package/lib/parseGeoJson-BlBe5Vig.js.map +1 -0
  23. package/lib/renderers-Dytryvoy.js +2044 -0
  24. package/lib/renderers-Dytryvoy.js.map +1 -0
  25. package/lib/types/charts.d.ts +7968 -0
  26. package/lib/types/charts.d.ts.map +1 -0
  27. package/lib/types/components.d.ts +4074 -0
  28. package/lib/types/components.d.ts.map +1 -0
  29. package/lib/types/core.d.ts +98 -0
  30. package/lib/types/core.d.ts.map +1 -0
  31. package/lib/types/createSeriesData.d.ts +325 -0
  32. package/lib/types/createSeriesData.d.ts.map +1 -0
  33. package/lib/types/customGraphicKeyframeAnimation.d.ts +3531 -0
  34. package/lib/types/customGraphicKeyframeAnimation.d.ts.map +1 -0
  35. package/lib/types/graphic.d.ts +4043 -0
  36. package/lib/types/graphic.d.ts.map +1 -0
  37. package/lib/types/index.d.ts +255 -0
  38. package/lib/types/index.d.ts.map +1 -0
  39. package/lib/types/index2.d.ts +2221 -0
  40. package/lib/types/index2.d.ts.map +1 -0
  41. package/lib/types/manual.d.ts +279 -0
  42. package/lib/types/manual.d.ts.map +1 -0
  43. package/lib/types/manual2.d.ts +2238 -0
  44. package/lib/types/manual2.d.ts.map +1 -0
  45. package/lib/types/parseGeoJson.d.ts +8695 -0
  46. package/lib/types/parseGeoJson.d.ts.map +1 -0
  47. package/lib/types/renderers.d.ts +995 -0
  48. package/lib/types/renderers.d.ts.map +1 -0
  49. package/package.json +58 -0
  50. package/src/chart-component.tsx +53 -0
  51. package/src/index.ts +64 -0
  52. package/src/loader.ts +222 -0
  53. package/src/manual.ts +36 -0
  54. package/src/tests/charts.test.tsx +363 -0
  55. package/src/types.ts +118 -0
  56. package/src/use-chart.ts +136 -0
@@ -0,0 +1,2044 @@
1
+ import { $ as hasShadow, A as ZRImage, An as isArray, Fn as isImagePatternObject, G as TEXT_ALIGN_TO_ANCHOR, Gn as merge, H as devicePixelRatio, Hn as keys, In as isNumber, J as getIdURL, Jn as noop, K as adjustTextY, Ln as isObject, M as DEFAULT_PATH_STYLE, N as Path, Nn as isFunction, On as indexOf, Ot as copyTransform, Pn as isGradientObject, Q as getShadowKey, Qn as retrieve2, Qt as BoundingRect, R as PathProxy, Sn as each, T as parseFontSize, Tn as filter, U as Eventful, Un as logError, Wn as map, X as getPathPrecision, Xt as getLineHeight, Y as getMatrixStr, Z as getSRTTransformString, a as getCanvasGradient, ar as DEFAULT_FONT_FAMILY, at as isRadialGradient, cr as __extends, dn as createOrUpdateImage, et as isAroundZero, f as requestAnimationFrame, ft as liftColor, gn as clone, i as getLineDash, ir as DEFAULT_FONT, it as isPattern, j as TSpan, mn as assert, n as brushSingle, nt as isImagePattern, o as getSize, or as platformApi, ot as normalizeColor, pn as env, q as encodeBase64, r as createCanvasPattern, rt as isLinearGradient, s as getElementSSRData, st as round4, t as brush$1, tt as isGradient, v as encodeHTML, vt as createCubicEasingFunc, w as hasSeparateFont, wn as extend, x as CompoundPath, xn as disableUserSelect, zn as isString } from "./graphic-CPJ2K90a.js";
2
+
3
+ //#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/svg/SVGPathRebuilder.js
4
+ var mathSin = Math.sin;
5
+ var mathCos = Math.cos;
6
+ var PI = Math.PI;
7
+ var PI2 = Math.PI * 2;
8
+ var degree = 180 / PI;
9
+ var SVGPathRebuilder = function() {
10
+ function SVGPathRebuilder() {}
11
+ SVGPathRebuilder.prototype.reset = function(precision) {
12
+ this._start = true;
13
+ this._d = [];
14
+ this._str = "";
15
+ this._p = Math.pow(10, precision || 4);
16
+ };
17
+ SVGPathRebuilder.prototype.moveTo = function(x, y) {
18
+ this._add("M", x, y);
19
+ };
20
+ SVGPathRebuilder.prototype.lineTo = function(x, y) {
21
+ this._add("L", x, y);
22
+ };
23
+ SVGPathRebuilder.prototype.bezierCurveTo = function(x, y, x2, y2, x3, y3) {
24
+ this._add("C", x, y, x2, y2, x3, y3);
25
+ };
26
+ SVGPathRebuilder.prototype.quadraticCurveTo = function(x, y, x2, y2) {
27
+ this._add("Q", x, y, x2, y2);
28
+ };
29
+ SVGPathRebuilder.prototype.arc = function(cx, cy, r, startAngle, endAngle, anticlockwise) {
30
+ this.ellipse(cx, cy, r, r, 0, startAngle, endAngle, anticlockwise);
31
+ };
32
+ SVGPathRebuilder.prototype.ellipse = function(cx, cy, rx, ry, psi, startAngle, endAngle, anticlockwise) {
33
+ var dTheta = endAngle - startAngle;
34
+ var clockwise = !anticlockwise;
35
+ var dThetaPositive = Math.abs(dTheta);
36
+ var isCircle = isAroundZero(dThetaPositive - PI2) || (clockwise ? dTheta >= PI2 : -dTheta >= PI2);
37
+ var unifiedTheta = dTheta > 0 ? dTheta % PI2 : dTheta % PI2 + PI2;
38
+ var large = false;
39
+ if (isCircle) large = true;
40
+ else if (isAroundZero(dThetaPositive)) large = false;
41
+ else large = unifiedTheta >= PI === !!clockwise;
42
+ var x0 = cx + rx * mathCos(startAngle);
43
+ var y0 = cy + ry * mathSin(startAngle);
44
+ if (this._start) this._add("M", x0, y0);
45
+ var xRot = Math.round(psi * degree);
46
+ if (isCircle) {
47
+ var p = 1 / this._p;
48
+ var dTheta_1 = (clockwise ? 1 : -1) * (PI2 - p);
49
+ this._add("A", rx, ry, xRot, 1, +clockwise, cx + rx * mathCos(startAngle + dTheta_1), cy + ry * mathSin(startAngle + dTheta_1));
50
+ if (p > .01) this._add("A", rx, ry, xRot, 0, +clockwise, x0, y0);
51
+ } else {
52
+ var x = cx + rx * mathCos(endAngle);
53
+ var y = cy + ry * mathSin(endAngle);
54
+ this._add("A", rx, ry, xRot, +large, +clockwise, x, y);
55
+ }
56
+ };
57
+ SVGPathRebuilder.prototype.rect = function(x, y, w, h) {
58
+ this._add("M", x, y);
59
+ this._add("l", w, 0);
60
+ this._add("l", 0, h);
61
+ this._add("l", -w, 0);
62
+ this._add("Z");
63
+ };
64
+ SVGPathRebuilder.prototype.closePath = function() {
65
+ if (this._d.length > 0) this._add("Z");
66
+ };
67
+ SVGPathRebuilder.prototype._add = function(cmd, a, b, c, d, e, f, g, h) {
68
+ var vals = [];
69
+ var p = this._p;
70
+ for (var i = 1; i < arguments.length; i++) {
71
+ var val = arguments[i];
72
+ if (isNaN(val)) {
73
+ this._invalid = true;
74
+ return;
75
+ }
76
+ vals.push(Math.round(val * p) / p);
77
+ }
78
+ this._d.push(cmd + vals.join(" "));
79
+ this._start = cmd === "Z";
80
+ };
81
+ SVGPathRebuilder.prototype.generateStr = function() {
82
+ this._str = this._invalid ? "" : this._d.join("");
83
+ this._d = [];
84
+ };
85
+ SVGPathRebuilder.prototype.getStr = function() {
86
+ return this._str;
87
+ };
88
+ return SVGPathRebuilder;
89
+ }();
90
+
91
+ //#endregion
92
+ //#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/svg/mapStyleToAttrs.js
93
+ var NONE = "none";
94
+ var mathRound = Math.round;
95
+ function pathHasFill(style) {
96
+ var fill = style.fill;
97
+ return fill != null && fill !== NONE;
98
+ }
99
+ function pathHasStroke(style) {
100
+ var stroke = style.stroke;
101
+ return stroke != null && stroke !== NONE;
102
+ }
103
+ var strokeProps = [
104
+ "lineCap",
105
+ "miterLimit",
106
+ "lineJoin"
107
+ ];
108
+ var svgStrokeProps = map(strokeProps, function(prop) {
109
+ return "stroke-" + prop.toLowerCase();
110
+ });
111
+ function mapStyleToAttrs(updateAttr, style, el, forceUpdate) {
112
+ var opacity = style.opacity == null ? 1 : style.opacity;
113
+ if (el instanceof ZRImage) {
114
+ updateAttr("opacity", opacity);
115
+ return;
116
+ }
117
+ if (pathHasFill(style)) {
118
+ var fill = normalizeColor(style.fill);
119
+ updateAttr("fill", fill.color);
120
+ var fillOpacity = style.fillOpacity != null ? style.fillOpacity * fill.opacity * opacity : fill.opacity * opacity;
121
+ if (forceUpdate || fillOpacity < 1) updateAttr("fill-opacity", fillOpacity);
122
+ } else updateAttr("fill", NONE);
123
+ if (pathHasStroke(style)) {
124
+ var stroke = normalizeColor(style.stroke);
125
+ updateAttr("stroke", stroke.color);
126
+ var strokeScale = style.strokeNoScale ? el.getLineScale() : 1;
127
+ var strokeWidth = strokeScale ? (style.lineWidth || 0) / strokeScale : 0;
128
+ var strokeOpacity = style.strokeOpacity != null ? style.strokeOpacity * stroke.opacity * opacity : stroke.opacity * opacity;
129
+ var strokeFirst = style.strokeFirst;
130
+ if (forceUpdate || strokeWidth !== 1) updateAttr("stroke-width", strokeWidth);
131
+ if (forceUpdate || strokeFirst) updateAttr("paint-order", strokeFirst ? "stroke" : "fill");
132
+ if (forceUpdate || strokeOpacity < 1) updateAttr("stroke-opacity", strokeOpacity);
133
+ if (style.lineDash) {
134
+ var _a = getLineDash(el), lineDash = _a[0], lineDashOffset = _a[1];
135
+ if (lineDash) {
136
+ lineDashOffset = mathRound(lineDashOffset || 0);
137
+ updateAttr("stroke-dasharray", lineDash.join(","));
138
+ if (lineDashOffset || forceUpdate) updateAttr("stroke-dashoffset", lineDashOffset);
139
+ }
140
+ } else if (forceUpdate) updateAttr("stroke-dasharray", NONE);
141
+ for (var i = 0; i < strokeProps.length; i++) {
142
+ var propName = strokeProps[i];
143
+ if (forceUpdate || style[propName] !== DEFAULT_PATH_STYLE[propName]) {
144
+ var val = style[propName] || DEFAULT_PATH_STYLE[propName];
145
+ val && updateAttr(svgStrokeProps[i], val);
146
+ }
147
+ }
148
+ } else if (forceUpdate) updateAttr("stroke", NONE);
149
+ }
150
+
151
+ //#endregion
152
+ //#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/svg/core.js
153
+ var SVGNS = "http://www.w3.org/2000/svg";
154
+ var XLINKNS = "http://www.w3.org/1999/xlink";
155
+ var XMLNS = "http://www.w3.org/2000/xmlns/";
156
+ var XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace";
157
+ var META_DATA_PREFIX = "ecmeta_";
158
+ function createElement(name) {
159
+ return document.createElementNS(SVGNS, name);
160
+ }
161
+ function createVNode(tag, key, attrs, children, text) {
162
+ return {
163
+ tag,
164
+ attrs: attrs || {},
165
+ children,
166
+ text,
167
+ key
168
+ };
169
+ }
170
+ function createElementOpen(name, attrs) {
171
+ var attrsStr = [];
172
+ if (attrs) for (var key in attrs) {
173
+ var val = attrs[key];
174
+ var part = key;
175
+ if (val === false) continue;
176
+ else if (val !== true && val != null) part += "=\"" + val + "\"";
177
+ attrsStr.push(part);
178
+ }
179
+ return "<" + name + " " + attrsStr.join(" ") + ">";
180
+ }
181
+ function createElementClose(name) {
182
+ return "</" + name + ">";
183
+ }
184
+ function vNodeToString(el, opts) {
185
+ opts = opts || {};
186
+ var S = opts.newline ? "\n" : "";
187
+ function convertElToString(el) {
188
+ var children = el.children, tag = el.tag, attrs = el.attrs, text = el.text;
189
+ return createElementOpen(tag, attrs) + (tag !== "style" ? encodeHTML(text) : text || "") + (children ? "" + S + map(children, function(child) {
190
+ return convertElToString(child);
191
+ }).join(S) + S : "") + createElementClose(tag);
192
+ }
193
+ return convertElToString(el);
194
+ }
195
+ function getCssString(selectorNodes, animationNodes, opts) {
196
+ opts = opts || {};
197
+ var S = opts.newline ? "\n" : "";
198
+ var bracketBegin = " {" + S;
199
+ var bracketEnd = S + "}";
200
+ var selectors = map(keys(selectorNodes), function(className) {
201
+ return className + bracketBegin + map(keys(selectorNodes[className]), function(attrName) {
202
+ return attrName + ":" + selectorNodes[className][attrName] + ";";
203
+ }).join(S) + bracketEnd;
204
+ }).join(S);
205
+ var animations = map(keys(animationNodes), function(animationName) {
206
+ return "@keyframes " + animationName + bracketBegin + map(keys(animationNodes[animationName]), function(percent) {
207
+ return percent + bracketBegin + map(keys(animationNodes[animationName][percent]), function(attrName) {
208
+ var val = animationNodes[animationName][percent][attrName];
209
+ if (attrName === "d") val = "path(\"" + val + "\")";
210
+ return attrName + ":" + val + ";";
211
+ }).join(S) + bracketEnd;
212
+ }).join(S) + bracketEnd;
213
+ }).join(S);
214
+ if (!selectors && !animations) return "";
215
+ return [
216
+ "<![CDATA[",
217
+ selectors,
218
+ animations,
219
+ "]]>"
220
+ ].join(S);
221
+ }
222
+ function createBrushScope(zrId) {
223
+ return {
224
+ zrId,
225
+ shadowCache: {},
226
+ patternCache: {},
227
+ gradientCache: {},
228
+ clipPathCache: {},
229
+ defs: {},
230
+ cssNodes: {},
231
+ cssAnims: {},
232
+ cssStyleCache: {},
233
+ cssAnimIdx: 0,
234
+ shadowIdx: 0,
235
+ gradientIdx: 0,
236
+ patternIdx: 0,
237
+ clipPathIdx: 0
238
+ };
239
+ }
240
+ function createSVGVNode(width, height, children, useViewBox) {
241
+ return createVNode("svg", "root", {
242
+ "width": width,
243
+ "height": height,
244
+ "xmlns": SVGNS,
245
+ "xmlns:xlink": XLINKNS,
246
+ "version": "1.1",
247
+ "baseProfile": "full",
248
+ "viewBox": useViewBox ? "0 0 " + width + " " + height : false
249
+ }, children);
250
+ }
251
+
252
+ //#endregion
253
+ //#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/svg/cssClassId.js
254
+ var cssClassIdx = 0;
255
+ function getClassId() {
256
+ return cssClassIdx++;
257
+ }
258
+
259
+ //#endregion
260
+ //#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/svg/cssAnimation.js
261
+ var EASING_MAP = {
262
+ cubicIn: "0.32,0,0.67,0",
263
+ cubicOut: "0.33,1,0.68,1",
264
+ cubicInOut: "0.65,0,0.35,1",
265
+ quadraticIn: "0.11,0,0.5,0",
266
+ quadraticOut: "0.5,1,0.89,1",
267
+ quadraticInOut: "0.45,0,0.55,1",
268
+ quarticIn: "0.5,0,0.75,0",
269
+ quarticOut: "0.25,1,0.5,1",
270
+ quarticInOut: "0.76,0,0.24,1",
271
+ quinticIn: "0.64,0,0.78,0",
272
+ quinticOut: "0.22,1,0.36,1",
273
+ quinticInOut: "0.83,0,0.17,1",
274
+ sinusoidalIn: "0.12,0,0.39,0",
275
+ sinusoidalOut: "0.61,1,0.88,1",
276
+ sinusoidalInOut: "0.37,0,0.63,1",
277
+ exponentialIn: "0.7,0,0.84,0",
278
+ exponentialOut: "0.16,1,0.3,1",
279
+ exponentialInOut: "0.87,0,0.13,1",
280
+ circularIn: "0.55,0,1,0.45",
281
+ circularOut: "0,0.55,0.45,1",
282
+ circularInOut: "0.85,0,0.15,1"
283
+ };
284
+ var transformOriginKey = "transform-origin";
285
+ function buildPathString(el, kfShape, path) {
286
+ var shape = extend({}, el.shape);
287
+ extend(shape, kfShape);
288
+ el.buildPath(path, shape);
289
+ var svgPathBuilder = new SVGPathRebuilder();
290
+ svgPathBuilder.reset(getPathPrecision(el));
291
+ path.rebuildPath(svgPathBuilder, 1);
292
+ svgPathBuilder.generateStr();
293
+ return svgPathBuilder.getStr();
294
+ }
295
+ function setTransformOrigin(target, transform) {
296
+ var originX = transform.originX, originY = transform.originY;
297
+ if (originX || originY) target[transformOriginKey] = originX + "px " + originY + "px";
298
+ }
299
+ var ANIMATE_STYLE_MAP = {
300
+ fill: "fill",
301
+ opacity: "opacity",
302
+ lineWidth: "stroke-width",
303
+ lineDashOffset: "stroke-dashoffset"
304
+ };
305
+ function addAnimation(cssAnim, scope) {
306
+ var animationName = scope.zrId + "-ani-" + scope.cssAnimIdx++;
307
+ scope.cssAnims[animationName] = cssAnim;
308
+ return animationName;
309
+ }
310
+ function createCompoundPathCSSAnimation(el, attrs, scope) {
311
+ var paths = el.shape.paths;
312
+ var composedAnim = {};
313
+ var cssAnimationCfg;
314
+ var cssAnimationName;
315
+ each(paths, function(path) {
316
+ var subScope = createBrushScope(scope.zrId);
317
+ subScope.animation = true;
318
+ createCSSAnimation(path, {}, subScope, true);
319
+ var cssAnims = subScope.cssAnims;
320
+ var cssNodes = subScope.cssNodes;
321
+ var animNames = keys(cssAnims);
322
+ var len = animNames.length;
323
+ if (!len) return;
324
+ cssAnimationName = animNames[len - 1];
325
+ var lastAnim = cssAnims[cssAnimationName];
326
+ for (var percent in lastAnim) {
327
+ var kf = lastAnim[percent];
328
+ composedAnim[percent] = composedAnim[percent] || { d: "" };
329
+ composedAnim[percent].d += kf.d || "";
330
+ }
331
+ for (var className in cssNodes) {
332
+ var val = cssNodes[className].animation;
333
+ if (val.indexOf(cssAnimationName) >= 0) cssAnimationCfg = val;
334
+ }
335
+ });
336
+ if (!cssAnimationCfg) return;
337
+ attrs.d = false;
338
+ var animationName = addAnimation(composedAnim, scope);
339
+ return cssAnimationCfg.replace(cssAnimationName, animationName);
340
+ }
341
+ function getEasingFunc(easing) {
342
+ return isString(easing) ? EASING_MAP[easing] ? "cubic-bezier(" + EASING_MAP[easing] + ")" : createCubicEasingFunc(easing) ? easing : "" : "";
343
+ }
344
+ function createCSSAnimation(el, attrs, scope, onlyShape) {
345
+ var animators = el.animators;
346
+ var len = animators.length;
347
+ var cssAnimations = [];
348
+ if (el instanceof CompoundPath) {
349
+ var animationCfg = createCompoundPathCSSAnimation(el, attrs, scope);
350
+ if (animationCfg) cssAnimations.push(animationCfg);
351
+ else if (!len) return;
352
+ } else if (!len) return;
353
+ var groupAnimators = {};
354
+ for (var i = 0; i < len; i++) {
355
+ var animator = animators[i];
356
+ var cfgArr = [animator.getMaxTime() / 1e3 + "s"];
357
+ var easing = getEasingFunc(animator.getClip().easing);
358
+ var delay = animator.getDelay();
359
+ if (easing) cfgArr.push(easing);
360
+ else cfgArr.push("linear");
361
+ if (delay) cfgArr.push(delay / 1e3 + "s");
362
+ if (animator.getLoop()) cfgArr.push("infinite");
363
+ var cfg = cfgArr.join(" ");
364
+ groupAnimators[cfg] = groupAnimators[cfg] || [cfg, []];
365
+ groupAnimators[cfg][1].push(animator);
366
+ }
367
+ function createSingleCSSAnimation(groupAnimator) {
368
+ var animators = groupAnimator[1];
369
+ var len = animators.length;
370
+ var transformKfs = {};
371
+ var shapeKfs = {};
372
+ var finalKfs = {};
373
+ var animationTimingFunctionAttrName = "animation-timing-function";
374
+ function saveAnimatorTrackToCssKfs(animator, cssKfs, toCssAttrName) {
375
+ var tracks = animator.getTracks();
376
+ var maxTime = animator.getMaxTime();
377
+ for (var k = 0; k < tracks.length; k++) {
378
+ var track = tracks[k];
379
+ if (track.needsAnimate()) {
380
+ var kfs = track.keyframes;
381
+ var attrName = track.propName;
382
+ toCssAttrName && (attrName = toCssAttrName(attrName));
383
+ if (attrName) for (var i = 0; i < kfs.length; i++) {
384
+ var kf = kfs[i];
385
+ var percent = Math.round(kf.time / maxTime * 100) + "%";
386
+ var kfEasing = getEasingFunc(kf.easing);
387
+ var rawValue = kf.rawValue;
388
+ if (isString(rawValue) || isNumber(rawValue)) {
389
+ cssKfs[percent] = cssKfs[percent] || {};
390
+ cssKfs[percent][attrName] = kf.rawValue;
391
+ if (kfEasing) cssKfs[percent][animationTimingFunctionAttrName] = kfEasing;
392
+ }
393
+ }
394
+ }
395
+ }
396
+ }
397
+ for (var i = 0; i < len; i++) {
398
+ var animator = animators[i];
399
+ var targetProp = animator.targetName;
400
+ if (!targetProp) !onlyShape && saveAnimatorTrackToCssKfs(animator, transformKfs);
401
+ else if (targetProp === "shape") saveAnimatorTrackToCssKfs(animator, shapeKfs);
402
+ }
403
+ for (var percent in transformKfs) {
404
+ var transform = {};
405
+ copyTransform(transform, el);
406
+ extend(transform, transformKfs[percent]);
407
+ var str = getSRTTransformString(transform);
408
+ var timingFunction = transformKfs[percent][animationTimingFunctionAttrName];
409
+ finalKfs[percent] = str ? { transform: str } : {};
410
+ setTransformOrigin(finalKfs[percent], transform);
411
+ if (timingFunction) finalKfs[percent][animationTimingFunctionAttrName] = timingFunction;
412
+ }
413
+ var path;
414
+ var canAnimateShape = true;
415
+ for (var percent in shapeKfs) {
416
+ finalKfs[percent] = finalKfs[percent] || {};
417
+ var isFirst = !path;
418
+ var timingFunction = shapeKfs[percent][animationTimingFunctionAttrName];
419
+ if (isFirst) path = new PathProxy();
420
+ var len_1 = path.len();
421
+ path.reset();
422
+ finalKfs[percent].d = buildPathString(el, shapeKfs[percent], path);
423
+ var newLen = path.len();
424
+ if (!isFirst && len_1 !== newLen) {
425
+ canAnimateShape = false;
426
+ break;
427
+ }
428
+ if (timingFunction) finalKfs[percent][animationTimingFunctionAttrName] = timingFunction;
429
+ }
430
+ if (!canAnimateShape) for (var percent in finalKfs) delete finalKfs[percent].d;
431
+ if (!onlyShape) for (var i = 0; i < len; i++) {
432
+ var animator = animators[i];
433
+ var targetProp = animator.targetName;
434
+ if (targetProp === "style") saveAnimatorTrackToCssKfs(animator, finalKfs, function(propName) {
435
+ return ANIMATE_STYLE_MAP[propName];
436
+ });
437
+ }
438
+ var percents = keys(finalKfs);
439
+ var allTransformOriginSame = true;
440
+ var transformOrigin;
441
+ for (var i = 1; i < percents.length; i++) {
442
+ var p0 = percents[i - 1];
443
+ var p1 = percents[i];
444
+ if (finalKfs[p0][transformOriginKey] !== finalKfs[p1][transformOriginKey]) {
445
+ allTransformOriginSame = false;
446
+ break;
447
+ }
448
+ transformOrigin = finalKfs[p0][transformOriginKey];
449
+ }
450
+ if (allTransformOriginSame && transformOrigin) {
451
+ for (var percent in finalKfs) if (finalKfs[percent][transformOriginKey]) delete finalKfs[percent][transformOriginKey];
452
+ attrs[transformOriginKey] = transformOrigin;
453
+ }
454
+ if (filter(percents, function(percent) {
455
+ return keys(finalKfs[percent]).length > 0;
456
+ }).length) return addAnimation(finalKfs, scope) + " " + groupAnimator[0] + " both";
457
+ }
458
+ for (var key in groupAnimators) {
459
+ var animationCfg = createSingleCSSAnimation(groupAnimators[key]);
460
+ if (animationCfg) cssAnimations.push(animationCfg);
461
+ }
462
+ if (cssAnimations.length) {
463
+ var className = scope.zrId + "-cls-" + getClassId();
464
+ scope.cssNodes["." + className] = { animation: cssAnimations.join(",") };
465
+ attrs["class"] = className;
466
+ }
467
+ }
468
+
469
+ //#endregion
470
+ //#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/svg/cssEmphasis.js
471
+ function createCSSEmphasis(el, attrs, scope) {
472
+ if (!el.ignore) if (el.isSilent()) {
473
+ var style = { "pointer-events": "none" };
474
+ setClassAttribute(style, attrs, scope, true);
475
+ } else {
476
+ var emphasisStyle = el.states.emphasis && el.states.emphasis.style ? el.states.emphasis.style : {};
477
+ var fill = emphasisStyle.fill;
478
+ if (!fill) {
479
+ var normalFill = el.style && el.style.fill;
480
+ var selectFill = el.states.select && el.states.select.style && el.states.select.style.fill;
481
+ var fromFill = el.currentStates.indexOf("select") >= 0 ? selectFill || normalFill : normalFill;
482
+ if (fromFill) fill = liftColor(fromFill);
483
+ }
484
+ var lineWidth = emphasisStyle.lineWidth;
485
+ if (lineWidth) {
486
+ var scaleX = !emphasisStyle.strokeNoScale && el.transform ? el.transform[0] : 1;
487
+ lineWidth = lineWidth / scaleX;
488
+ }
489
+ var style = { cursor: "pointer" };
490
+ if (fill) style.fill = fill;
491
+ if (emphasisStyle.stroke) style.stroke = emphasisStyle.stroke;
492
+ if (lineWidth) style["stroke-width"] = lineWidth;
493
+ setClassAttribute(style, attrs, scope, true);
494
+ }
495
+ }
496
+ function setClassAttribute(style, attrs, scope, withHover) {
497
+ var styleKey = JSON.stringify(style);
498
+ var className = scope.cssStyleCache[styleKey];
499
+ if (!className) {
500
+ className = scope.zrId + "-cls-" + getClassId();
501
+ scope.cssStyleCache[styleKey] = className;
502
+ scope.cssNodes["." + className + (withHover ? ":hover" : "")] = style;
503
+ }
504
+ attrs["class"] = attrs["class"] ? attrs["class"] + " " + className : className;
505
+ }
506
+
507
+ //#endregion
508
+ //#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/svg/graphic.js
509
+ var round = Math.round;
510
+ function isImageLike(val) {
511
+ return val && isString(val.src);
512
+ }
513
+ function isCanvasLike(val) {
514
+ return val && isFunction(val.toDataURL);
515
+ }
516
+ function setStyleAttrs(attrs, style, el, scope) {
517
+ mapStyleToAttrs(function(key, val) {
518
+ var isFillStroke = key === "fill" || key === "stroke";
519
+ if (isFillStroke && isGradient(val)) setGradient(style, attrs, key, scope);
520
+ else if (isFillStroke && isPattern(val)) setPattern(el, attrs, key, scope);
521
+ else attrs[key] = val;
522
+ if (isFillStroke && scope.ssr && val === "none") attrs["pointer-events"] = "visible";
523
+ }, style, el, false);
524
+ setShadow(el, attrs, scope);
525
+ }
526
+ function setMetaData(attrs, el) {
527
+ var metaData = getElementSSRData(el);
528
+ if (metaData) {
529
+ metaData.each(function(val, key) {
530
+ val != null && (attrs[("ecmeta_" + key).toLowerCase()] = val + "");
531
+ });
532
+ if (el.isSilent()) attrs[META_DATA_PREFIX + "silent"] = "true";
533
+ }
534
+ }
535
+ function noRotateScale(m) {
536
+ return isAroundZero(m[0] - 1) && isAroundZero(m[1]) && isAroundZero(m[2]) && isAroundZero(m[3] - 1);
537
+ }
538
+ function noTranslate(m) {
539
+ return isAroundZero(m[4]) && isAroundZero(m[5]);
540
+ }
541
+ function setTransform(attrs, m, compress) {
542
+ if (m && !(noTranslate(m) && noRotateScale(m))) {
543
+ var mul = compress ? 10 : 1e4;
544
+ attrs.transform = noRotateScale(m) ? "translate(" + round(m[4] * mul) / mul + " " + round(m[5] * mul) / mul + ")" : getMatrixStr(m);
545
+ }
546
+ }
547
+ function convertPolyShape(shape, attrs, mul) {
548
+ var points = shape.points;
549
+ var strArr = [];
550
+ for (var i = 0; i < points.length; i++) {
551
+ strArr.push(round(points[i][0] * mul) / mul);
552
+ strArr.push(round(points[i][1] * mul) / mul);
553
+ }
554
+ attrs.points = strArr.join(" ");
555
+ }
556
+ function validatePolyShape(shape) {
557
+ return !shape.smooth;
558
+ }
559
+ function createAttrsConvert(desc) {
560
+ var normalizedDesc = map(desc, function(item) {
561
+ return typeof item === "string" ? [item, item] : item;
562
+ });
563
+ return function(shape, attrs, mul) {
564
+ for (var i = 0; i < normalizedDesc.length; i++) {
565
+ var item = normalizedDesc[i];
566
+ var val = shape[item[0]];
567
+ if (val != null) attrs[item[1]] = round(val * mul) / mul;
568
+ }
569
+ };
570
+ }
571
+ var builtinShapesDef = {
572
+ circle: [createAttrsConvert([
573
+ "cx",
574
+ "cy",
575
+ "r"
576
+ ])],
577
+ polyline: [convertPolyShape, validatePolyShape],
578
+ polygon: [convertPolyShape, validatePolyShape]
579
+ };
580
+ function hasShapeAnimation(el) {
581
+ var animators = el.animators;
582
+ for (var i = 0; i < animators.length; i++) if (animators[i].targetName === "shape") return true;
583
+ return false;
584
+ }
585
+ function brushSVGPath(el, scope) {
586
+ var style = el.style;
587
+ var shape = el.shape;
588
+ var builtinShpDef = builtinShapesDef[el.type];
589
+ var attrs = {};
590
+ var needsAnimate = scope.animation;
591
+ var svgElType = "path";
592
+ var strokePercent = el.style.strokePercent;
593
+ var precision = scope.compress && getPathPrecision(el) || 4;
594
+ if (builtinShpDef && !scope.willUpdate && !(builtinShpDef[1] && !builtinShpDef[1](shape)) && !(needsAnimate && hasShapeAnimation(el)) && !(strokePercent < 1)) {
595
+ svgElType = el.type;
596
+ var mul = Math.pow(10, precision);
597
+ builtinShpDef[0](shape, attrs, mul);
598
+ } else {
599
+ var needBuildPath = !el.path || el.shapeChanged();
600
+ if (!el.path) el.createPathProxy();
601
+ var path = el.path;
602
+ if (needBuildPath) {
603
+ path.beginPath();
604
+ el.buildPath(path, el.shape);
605
+ el.pathUpdated();
606
+ }
607
+ var pathVersion = path.getVersion();
608
+ var elExt = el;
609
+ var svgPathBuilder = elExt.__svgPathBuilder;
610
+ if (elExt.__svgPathVersion !== pathVersion || !svgPathBuilder || strokePercent !== elExt.__svgPathStrokePercent) {
611
+ if (!svgPathBuilder) svgPathBuilder = elExt.__svgPathBuilder = new SVGPathRebuilder();
612
+ svgPathBuilder.reset(precision);
613
+ path.rebuildPath(svgPathBuilder, strokePercent);
614
+ svgPathBuilder.generateStr();
615
+ elExt.__svgPathVersion = pathVersion;
616
+ elExt.__svgPathStrokePercent = strokePercent;
617
+ }
618
+ attrs.d = svgPathBuilder.getStr();
619
+ }
620
+ setTransform(attrs, el.transform);
621
+ setStyleAttrs(attrs, style, el, scope);
622
+ setMetaData(attrs, el);
623
+ scope.animation && createCSSAnimation(el, attrs, scope);
624
+ scope.emphasis && createCSSEmphasis(el, attrs, scope);
625
+ return createVNode(svgElType, el.id + "", attrs);
626
+ }
627
+ function brushSVGImage(el, scope) {
628
+ var style = el.style;
629
+ var image = style.image;
630
+ if (image && !isString(image)) {
631
+ if (isImageLike(image)) image = image.src;
632
+ else if (isCanvasLike(image)) image = image.toDataURL();
633
+ }
634
+ if (!image) return;
635
+ var x = style.x || 0;
636
+ var y = style.y || 0;
637
+ var dw = style.width;
638
+ var dh = style.height;
639
+ var attrs = {
640
+ href: image,
641
+ width: dw,
642
+ height: dh
643
+ };
644
+ if (x) attrs.x = x;
645
+ if (y) attrs.y = y;
646
+ setTransform(attrs, el.transform);
647
+ setStyleAttrs(attrs, style, el, scope);
648
+ setMetaData(attrs, el);
649
+ scope.animation && createCSSAnimation(el, attrs, scope);
650
+ return createVNode("image", el.id + "", attrs);
651
+ }
652
+ function brushSVGTSpan(el, scope) {
653
+ var style = el.style;
654
+ var text = style.text;
655
+ text != null && (text += "");
656
+ if (!text || isNaN(style.x) || isNaN(style.y)) return;
657
+ var font = style.font || "12px sans-serif";
658
+ var x = style.x || 0;
659
+ var y = adjustTextY(style.y || 0, getLineHeight(font), style.textBaseline);
660
+ var textAlign = TEXT_ALIGN_TO_ANCHOR[style.textAlign] || style.textAlign;
661
+ var attrs = {
662
+ "dominant-baseline": "central",
663
+ "text-anchor": textAlign
664
+ };
665
+ if (hasSeparateFont(style)) {
666
+ var separatedFontStr = "";
667
+ var fontStyle = style.fontStyle;
668
+ var fontSize = parseFontSize(style.fontSize);
669
+ if (!parseFloat(fontSize)) return;
670
+ var fontFamily = style.fontFamily || "sans-serif";
671
+ var fontWeight = style.fontWeight;
672
+ separatedFontStr += "font-size:" + fontSize + ";font-family:" + fontFamily + ";";
673
+ if (fontStyle && fontStyle !== "normal") separatedFontStr += "font-style:" + fontStyle + ";";
674
+ if (fontWeight && fontWeight !== "normal") separatedFontStr += "font-weight:" + fontWeight + ";";
675
+ attrs.style = separatedFontStr;
676
+ } else attrs.style = "font: " + font;
677
+ if (text.match(/\s/)) attrs["xml:space"] = "preserve";
678
+ if (x) attrs.x = x;
679
+ if (y) attrs.y = y;
680
+ setTransform(attrs, el.transform);
681
+ setStyleAttrs(attrs, style, el, scope);
682
+ setMetaData(attrs, el);
683
+ scope.animation && createCSSAnimation(el, attrs, scope);
684
+ return createVNode("text", el.id + "", attrs, void 0, text);
685
+ }
686
+ function brush(el, scope) {
687
+ if (el instanceof Path) return brushSVGPath(el, scope);
688
+ else if (el instanceof ZRImage) return brushSVGImage(el, scope);
689
+ else if (el instanceof TSpan) return brushSVGTSpan(el, scope);
690
+ }
691
+ function setShadow(el, attrs, scope) {
692
+ var style = el.style;
693
+ if (hasShadow(style)) {
694
+ var shadowKey = getShadowKey(el);
695
+ var shadowCache = scope.shadowCache;
696
+ var shadowId = shadowCache[shadowKey];
697
+ if (!shadowId) {
698
+ var globalScale = el.getGlobalScale();
699
+ var scaleX = globalScale[0];
700
+ var scaleY = globalScale[1];
701
+ if (!scaleX || !scaleY) return;
702
+ var offsetX = style.shadowOffsetX || 0;
703
+ var offsetY = style.shadowOffsetY || 0;
704
+ var blur_1 = style.shadowBlur;
705
+ var _a = normalizeColor(style.shadowColor), opacity = _a.opacity, color = _a.color;
706
+ var stdDx = blur_1 / 2 / scaleX;
707
+ var stdDy = blur_1 / 2 / scaleY;
708
+ var stdDeviation = stdDx + " " + stdDy;
709
+ shadowId = scope.zrId + "-s" + scope.shadowIdx++;
710
+ scope.defs[shadowId] = createVNode("filter", shadowId, {
711
+ "id": shadowId,
712
+ "x": "-100%",
713
+ "y": "-100%",
714
+ "width": "300%",
715
+ "height": "300%"
716
+ }, [createVNode("feDropShadow", "", {
717
+ "dx": offsetX / scaleX,
718
+ "dy": offsetY / scaleY,
719
+ "stdDeviation": stdDeviation,
720
+ "flood-color": color,
721
+ "flood-opacity": opacity
722
+ })]);
723
+ shadowCache[shadowKey] = shadowId;
724
+ }
725
+ attrs.filter = getIdURL(shadowId);
726
+ }
727
+ }
728
+ function setGradient(style, attrs, target, scope) {
729
+ var val = style[target];
730
+ var gradientTag;
731
+ var gradientAttrs = { "gradientUnits": val.global ? "userSpaceOnUse" : "objectBoundingBox" };
732
+ if (isLinearGradient(val)) {
733
+ gradientTag = "linearGradient";
734
+ gradientAttrs.x1 = val.x;
735
+ gradientAttrs.y1 = val.y;
736
+ gradientAttrs.x2 = val.x2;
737
+ gradientAttrs.y2 = val.y2;
738
+ } else if (isRadialGradient(val)) {
739
+ gradientTag = "radialGradient";
740
+ gradientAttrs.cx = retrieve2(val.x, .5);
741
+ gradientAttrs.cy = retrieve2(val.y, .5);
742
+ gradientAttrs.r = retrieve2(val.r, .5);
743
+ } else {
744
+ if (process.env.NODE_ENV !== "production") logError("Illegal gradient type.");
745
+ return;
746
+ }
747
+ var colors = val.colorStops;
748
+ var colorStops = [];
749
+ for (var i = 0, len = colors.length; i < len; ++i) {
750
+ var offset = round4(colors[i].offset) * 100 + "%";
751
+ var stopColor = colors[i].color;
752
+ var _a = normalizeColor(stopColor), color = _a.color, opacity = _a.opacity;
753
+ var stopsAttrs = { "offset": offset };
754
+ stopsAttrs["stop-color"] = color;
755
+ if (opacity < 1) stopsAttrs["stop-opacity"] = opacity;
756
+ colorStops.push(createVNode("stop", i + "", stopsAttrs));
757
+ }
758
+ var gradientKey = vNodeToString(createVNode(gradientTag, "", gradientAttrs, colorStops));
759
+ var gradientCache = scope.gradientCache;
760
+ var gradientId = gradientCache[gradientKey];
761
+ if (!gradientId) {
762
+ gradientId = scope.zrId + "-g" + scope.gradientIdx++;
763
+ gradientCache[gradientKey] = gradientId;
764
+ gradientAttrs.id = gradientId;
765
+ scope.defs[gradientId] = createVNode(gradientTag, gradientId, gradientAttrs, colorStops);
766
+ }
767
+ attrs[target] = getIdURL(gradientId);
768
+ }
769
+ function setPattern(el, attrs, target, scope) {
770
+ var val = el.style[target];
771
+ var boundingRect = el.getBoundingRect();
772
+ var patternAttrs = {};
773
+ var repeat = val.repeat;
774
+ var noRepeat = repeat === "no-repeat";
775
+ var repeatX = repeat === "repeat-x";
776
+ var repeatY = repeat === "repeat-y";
777
+ var child;
778
+ if (isImagePattern(val)) {
779
+ var imageWidth_1 = val.imageWidth;
780
+ var imageHeight_1 = val.imageHeight;
781
+ var imageSrc = void 0;
782
+ var patternImage = val.image;
783
+ if (isString(patternImage)) imageSrc = patternImage;
784
+ else if (isImageLike(patternImage)) imageSrc = patternImage.src;
785
+ else if (isCanvasLike(patternImage)) imageSrc = patternImage.toDataURL();
786
+ if (typeof Image === "undefined") {
787
+ var errMsg = "Image width/height must been given explictly in svg-ssr renderer.";
788
+ assert(imageWidth_1, errMsg);
789
+ assert(imageHeight_1, errMsg);
790
+ } else if (imageWidth_1 == null || imageHeight_1 == null) {
791
+ var setSizeToVNode_1 = function(vNode, img) {
792
+ if (vNode) {
793
+ var svgEl = vNode.elm;
794
+ var width = imageWidth_1 || img.width;
795
+ var height = imageHeight_1 || img.height;
796
+ if (vNode.tag === "pattern") {
797
+ if (repeatX) {
798
+ height = 1;
799
+ width /= boundingRect.width;
800
+ } else if (repeatY) {
801
+ width = 1;
802
+ height /= boundingRect.height;
803
+ }
804
+ }
805
+ vNode.attrs.width = width;
806
+ vNode.attrs.height = height;
807
+ if (svgEl) {
808
+ svgEl.setAttribute("width", width);
809
+ svgEl.setAttribute("height", height);
810
+ }
811
+ }
812
+ };
813
+ var createdImage = createOrUpdateImage(imageSrc, null, el, function(img) {
814
+ noRepeat || setSizeToVNode_1(patternVNode, img);
815
+ setSizeToVNode_1(child, img);
816
+ });
817
+ if (createdImage && createdImage.width && createdImage.height) {
818
+ imageWidth_1 = imageWidth_1 || createdImage.width;
819
+ imageHeight_1 = imageHeight_1 || createdImage.height;
820
+ }
821
+ }
822
+ child = createVNode("image", "img", {
823
+ href: imageSrc,
824
+ width: imageWidth_1,
825
+ height: imageHeight_1
826
+ });
827
+ patternAttrs.width = imageWidth_1;
828
+ patternAttrs.height = imageHeight_1;
829
+ } else if (val.svgElement) {
830
+ child = clone(val.svgElement);
831
+ patternAttrs.width = val.svgWidth;
832
+ patternAttrs.height = val.svgHeight;
833
+ }
834
+ if (!child) return;
835
+ var patternWidth;
836
+ var patternHeight;
837
+ if (noRepeat) patternWidth = patternHeight = 1;
838
+ else if (repeatX) {
839
+ patternHeight = 1;
840
+ patternWidth = patternAttrs.width / boundingRect.width;
841
+ } else if (repeatY) {
842
+ patternWidth = 1;
843
+ patternHeight = patternAttrs.height / boundingRect.height;
844
+ } else patternAttrs.patternUnits = "userSpaceOnUse";
845
+ if (patternWidth != null && !isNaN(patternWidth)) patternAttrs.width = patternWidth;
846
+ if (patternHeight != null && !isNaN(patternHeight)) patternAttrs.height = patternHeight;
847
+ var patternTransform = getSRTTransformString(val);
848
+ patternTransform && (patternAttrs.patternTransform = patternTransform);
849
+ var patternVNode = createVNode("pattern", "", patternAttrs, [child]);
850
+ var patternKey = vNodeToString(patternVNode);
851
+ var patternCache = scope.patternCache;
852
+ var patternId = patternCache[patternKey];
853
+ if (!patternId) {
854
+ patternId = scope.zrId + "-p" + scope.patternIdx++;
855
+ patternCache[patternKey] = patternId;
856
+ patternAttrs.id = patternId;
857
+ patternVNode = scope.defs[patternId] = createVNode("pattern", patternId, patternAttrs, [child]);
858
+ }
859
+ attrs[target] = getIdURL(patternId);
860
+ }
861
+ function setClipPath(clipPath, attrs, scope) {
862
+ var clipPathCache = scope.clipPathCache, defs = scope.defs;
863
+ var clipPathId = clipPathCache[clipPath.id];
864
+ if (!clipPathId) {
865
+ clipPathId = scope.zrId + "-c" + scope.clipPathIdx++;
866
+ var clipPathAttrs = { id: clipPathId };
867
+ clipPathCache[clipPath.id] = clipPathId;
868
+ defs[clipPathId] = createVNode("clipPath", clipPathId, clipPathAttrs, [brushSVGPath(clipPath, scope)]);
869
+ }
870
+ attrs["clip-path"] = getIdURL(clipPathId);
871
+ }
872
+
873
+ //#endregion
874
+ //#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/svg/domapi.js
875
+ function createTextNode(text) {
876
+ return document.createTextNode(text);
877
+ }
878
+ function insertBefore(parentNode, newNode, referenceNode) {
879
+ parentNode.insertBefore(newNode, referenceNode);
880
+ }
881
+ function removeChild(node, child) {
882
+ node.removeChild(child);
883
+ }
884
+ function appendChild(node, child) {
885
+ node.appendChild(child);
886
+ }
887
+ function parentNode(node) {
888
+ return node.parentNode;
889
+ }
890
+ function nextSibling(node) {
891
+ return node.nextSibling;
892
+ }
893
+ function setTextContent(node, text) {
894
+ node.textContent = text;
895
+ }
896
+
897
+ //#endregion
898
+ //#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/svg/patch.js
899
+ var colonChar = 58;
900
+ var xChar = 120;
901
+ var emptyNode = createVNode("", "");
902
+ function isUndef(s) {
903
+ return s === void 0;
904
+ }
905
+ function isDef(s) {
906
+ return s !== void 0;
907
+ }
908
+ function createKeyToOldIdx(children, beginIdx, endIdx) {
909
+ var map = {};
910
+ for (var i = beginIdx; i <= endIdx; ++i) {
911
+ var key = children[i].key;
912
+ if (key !== void 0) {
913
+ if (process.env.NODE_ENV !== "production") {
914
+ if (map[key] != null) console.error("Duplicate key " + key);
915
+ }
916
+ map[key] = i;
917
+ }
918
+ }
919
+ return map;
920
+ }
921
+ function sameVnode(vnode1, vnode2) {
922
+ var isSameKey = vnode1.key === vnode2.key;
923
+ return vnode1.tag === vnode2.tag && isSameKey;
924
+ }
925
+ function createElm(vnode) {
926
+ var i;
927
+ var children = vnode.children;
928
+ var tag = vnode.tag;
929
+ if (isDef(tag)) {
930
+ var elm = vnode.elm = createElement(tag);
931
+ updateAttrs(emptyNode, vnode);
932
+ if (isArray(children)) for (i = 0; i < children.length; ++i) {
933
+ var ch = children[i];
934
+ if (ch != null) appendChild(elm, createElm(ch));
935
+ }
936
+ else if (isDef(vnode.text) && !isObject(vnode.text)) appendChild(elm, createTextNode(vnode.text));
937
+ } else vnode.elm = createTextNode(vnode.text);
938
+ return vnode.elm;
939
+ }
940
+ function addVnodes(parentElm, before, vnodes, startIdx, endIdx) {
941
+ for (; startIdx <= endIdx; ++startIdx) {
942
+ var ch = vnodes[startIdx];
943
+ if (ch != null) insertBefore(parentElm, createElm(ch), before);
944
+ }
945
+ }
946
+ function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
947
+ for (; startIdx <= endIdx; ++startIdx) {
948
+ var ch = vnodes[startIdx];
949
+ if (ch != null) if (isDef(ch.tag)) {
950
+ var parent_1 = parentNode(ch.elm);
951
+ removeChild(parent_1, ch.elm);
952
+ } else removeChild(parentElm, ch.elm);
953
+ }
954
+ }
955
+ function updateAttrs(oldVnode, vnode) {
956
+ var key;
957
+ var elm = vnode.elm;
958
+ var oldAttrs = oldVnode && oldVnode.attrs || {};
959
+ var attrs = vnode.attrs || {};
960
+ if (oldAttrs === attrs) return;
961
+ for (key in attrs) {
962
+ var cur = attrs[key];
963
+ if (oldAttrs[key] !== cur) if (cur === true) elm.setAttribute(key, "");
964
+ else if (cur === false) elm.removeAttribute(key);
965
+ else if (key === "style") elm.style.cssText = cur;
966
+ else if (key.charCodeAt(0) !== xChar) elm.setAttribute(key, cur);
967
+ else if (key === "xmlns:xlink" || key === "xmlns") elm.setAttributeNS(XMLNS, key, cur);
968
+ else if (key.charCodeAt(3) === colonChar) elm.setAttributeNS(XML_NAMESPACE, key, cur);
969
+ else if (key.charCodeAt(5) === colonChar) elm.setAttributeNS(XLINKNS, key, cur);
970
+ else elm.setAttribute(key, cur);
971
+ }
972
+ for (key in oldAttrs) if (!(key in attrs)) elm.removeAttribute(key);
973
+ }
974
+ function updateChildren(parentElm, oldCh, newCh) {
975
+ var oldStartIdx = 0;
976
+ var newStartIdx = 0;
977
+ var oldEndIdx = oldCh.length - 1;
978
+ var oldStartVnode = oldCh[0];
979
+ var oldEndVnode = oldCh[oldEndIdx];
980
+ var newEndIdx = newCh.length - 1;
981
+ var newStartVnode = newCh[0];
982
+ var newEndVnode = newCh[newEndIdx];
983
+ var oldKeyToIdx;
984
+ var idxInOld;
985
+ var elmToMove;
986
+ var before;
987
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) if (oldStartVnode == null) oldStartVnode = oldCh[++oldStartIdx];
988
+ else if (oldEndVnode == null) oldEndVnode = oldCh[--oldEndIdx];
989
+ else if (newStartVnode == null) newStartVnode = newCh[++newStartIdx];
990
+ else if (newEndVnode == null) newEndVnode = newCh[--newEndIdx];
991
+ else if (sameVnode(oldStartVnode, newStartVnode)) {
992
+ patchVnode(oldStartVnode, newStartVnode);
993
+ oldStartVnode = oldCh[++oldStartIdx];
994
+ newStartVnode = newCh[++newStartIdx];
995
+ } else if (sameVnode(oldEndVnode, newEndVnode)) {
996
+ patchVnode(oldEndVnode, newEndVnode);
997
+ oldEndVnode = oldCh[--oldEndIdx];
998
+ newEndVnode = newCh[--newEndIdx];
999
+ } else if (sameVnode(oldStartVnode, newEndVnode)) {
1000
+ patchVnode(oldStartVnode, newEndVnode);
1001
+ insertBefore(parentElm, oldStartVnode.elm, nextSibling(oldEndVnode.elm));
1002
+ oldStartVnode = oldCh[++oldStartIdx];
1003
+ newEndVnode = newCh[--newEndIdx];
1004
+ } else if (sameVnode(oldEndVnode, newStartVnode)) {
1005
+ patchVnode(oldEndVnode, newStartVnode);
1006
+ insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
1007
+ oldEndVnode = oldCh[--oldEndIdx];
1008
+ newStartVnode = newCh[++newStartIdx];
1009
+ } else {
1010
+ if (isUndef(oldKeyToIdx)) oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
1011
+ idxInOld = oldKeyToIdx[newStartVnode.key];
1012
+ if (isUndef(idxInOld)) insertBefore(parentElm, createElm(newStartVnode), oldStartVnode.elm);
1013
+ else {
1014
+ elmToMove = oldCh[idxInOld];
1015
+ if (elmToMove.tag !== newStartVnode.tag) insertBefore(parentElm, createElm(newStartVnode), oldStartVnode.elm);
1016
+ else {
1017
+ patchVnode(elmToMove, newStartVnode);
1018
+ oldCh[idxInOld] = void 0;
1019
+ insertBefore(parentElm, elmToMove.elm, oldStartVnode.elm);
1020
+ }
1021
+ }
1022
+ newStartVnode = newCh[++newStartIdx];
1023
+ }
1024
+ if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) if (oldStartIdx > oldEndIdx) {
1025
+ before = newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].elm;
1026
+ addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx);
1027
+ } else removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
1028
+ }
1029
+ function patchVnode(oldVnode, vnode) {
1030
+ var elm = vnode.elm = oldVnode.elm;
1031
+ var oldCh = oldVnode.children;
1032
+ var ch = vnode.children;
1033
+ if (oldVnode === vnode) return;
1034
+ updateAttrs(oldVnode, vnode);
1035
+ if (isUndef(vnode.text)) {
1036
+ if (isDef(oldCh) && isDef(ch)) {
1037
+ if (oldCh !== ch) updateChildren(elm, oldCh, ch);
1038
+ } else if (isDef(ch)) {
1039
+ if (isDef(oldVnode.text)) setTextContent(elm, "");
1040
+ addVnodes(elm, null, ch, 0, ch.length - 1);
1041
+ } else if (isDef(oldCh)) removeVnodes(elm, oldCh, 0, oldCh.length - 1);
1042
+ else if (isDef(oldVnode.text)) setTextContent(elm, "");
1043
+ } else if (oldVnode.text !== vnode.text) {
1044
+ if (isDef(oldCh)) removeVnodes(elm, oldCh, 0, oldCh.length - 1);
1045
+ setTextContent(elm, vnode.text);
1046
+ }
1047
+ }
1048
+ function patch(oldVnode, vnode) {
1049
+ if (sameVnode(oldVnode, vnode)) patchVnode(oldVnode, vnode);
1050
+ else {
1051
+ var elm = oldVnode.elm;
1052
+ var parent_2 = parentNode(elm);
1053
+ createElm(vnode);
1054
+ if (parent_2 !== null) {
1055
+ insertBefore(parent_2, vnode.elm, nextSibling(elm));
1056
+ removeVnodes(parent_2, [oldVnode], 0, 0);
1057
+ }
1058
+ }
1059
+ return vnode;
1060
+ }
1061
+
1062
+ //#endregion
1063
+ //#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/svg/Painter.js
1064
+ var svgId = 0;
1065
+ var SVGPainter = function() {
1066
+ function SVGPainter(root, storage, opts) {
1067
+ this.type = "svg";
1068
+ this.refreshHover = createMethodNotSupport("refreshHover");
1069
+ this.configLayer = createMethodNotSupport("configLayer");
1070
+ this.storage = storage;
1071
+ this._opts = opts = extend({}, opts);
1072
+ this.root = root;
1073
+ this._id = "zr" + svgId++;
1074
+ this._oldVNode = createSVGVNode(opts.width, opts.height);
1075
+ if (root && !opts.ssr) {
1076
+ var viewport = this._viewport = document.createElement("div");
1077
+ viewport.style.cssText = "position:relative;overflow:hidden";
1078
+ var svgDom = this._svgDom = this._oldVNode.elm = createElement("svg");
1079
+ updateAttrs(null, this._oldVNode);
1080
+ viewport.appendChild(svgDom);
1081
+ root.appendChild(viewport);
1082
+ }
1083
+ this.resize(opts.width, opts.height);
1084
+ }
1085
+ SVGPainter.prototype.getType = function() {
1086
+ return this.type;
1087
+ };
1088
+ SVGPainter.prototype.getViewportRoot = function() {
1089
+ return this._viewport;
1090
+ };
1091
+ SVGPainter.prototype.getViewportRootOffset = function() {
1092
+ var viewportRoot = this.getViewportRoot();
1093
+ if (viewportRoot) return {
1094
+ offsetLeft: viewportRoot.offsetLeft || 0,
1095
+ offsetTop: viewportRoot.offsetTop || 0
1096
+ };
1097
+ };
1098
+ SVGPainter.prototype.getSvgDom = function() {
1099
+ return this._svgDom;
1100
+ };
1101
+ SVGPainter.prototype.refresh = function() {
1102
+ if (this.root) {
1103
+ var vnode = this.renderToVNode({ willUpdate: true });
1104
+ vnode.attrs.style = "position:absolute;left:0;top:0;user-select:none";
1105
+ patch(this._oldVNode, vnode);
1106
+ this._oldVNode = vnode;
1107
+ }
1108
+ };
1109
+ SVGPainter.prototype.renderOneToVNode = function(el) {
1110
+ return brush(el, createBrushScope(this._id));
1111
+ };
1112
+ SVGPainter.prototype.renderToVNode = function(opts) {
1113
+ opts = opts || {};
1114
+ var list = this.storage.getDisplayList(true);
1115
+ var width = this._width;
1116
+ var height = this._height;
1117
+ var scope = createBrushScope(this._id);
1118
+ scope.animation = opts.animation;
1119
+ scope.willUpdate = opts.willUpdate;
1120
+ scope.compress = opts.compress;
1121
+ scope.emphasis = opts.emphasis;
1122
+ scope.ssr = this._opts.ssr;
1123
+ var children = [];
1124
+ var bgVNode = this._bgVNode = createBackgroundVNode(width, height, this._backgroundColor, scope);
1125
+ bgVNode && children.push(bgVNode);
1126
+ var mainVNode = !opts.compress ? this._mainVNode = createVNode("g", "main", {}, []) : null;
1127
+ this._paintList(list, scope, mainVNode ? mainVNode.children : children);
1128
+ mainVNode && children.push(mainVNode);
1129
+ var defs = map(keys(scope.defs), function(id) {
1130
+ return scope.defs[id];
1131
+ });
1132
+ if (defs.length) children.push(createVNode("defs", "defs", {}, defs));
1133
+ if (opts.animation) {
1134
+ var animationCssStr = getCssString(scope.cssNodes, scope.cssAnims, { newline: true });
1135
+ if (animationCssStr) {
1136
+ var styleNode = createVNode("style", "stl", {}, [], animationCssStr);
1137
+ children.push(styleNode);
1138
+ }
1139
+ }
1140
+ return createSVGVNode(width, height, children, opts.useViewBox);
1141
+ };
1142
+ SVGPainter.prototype.renderToString = function(opts) {
1143
+ opts = opts || {};
1144
+ return vNodeToString(this.renderToVNode({
1145
+ animation: retrieve2(opts.cssAnimation, true),
1146
+ emphasis: retrieve2(opts.cssEmphasis, true),
1147
+ willUpdate: false,
1148
+ compress: true,
1149
+ useViewBox: retrieve2(opts.useViewBox, true)
1150
+ }), { newline: true });
1151
+ };
1152
+ SVGPainter.prototype.setBackgroundColor = function(backgroundColor) {
1153
+ this._backgroundColor = backgroundColor;
1154
+ };
1155
+ SVGPainter.prototype.getSvgRoot = function() {
1156
+ return this._mainVNode && this._mainVNode.elm;
1157
+ };
1158
+ SVGPainter.prototype._paintList = function(list, scope, out) {
1159
+ var listLen = list.length;
1160
+ var clipPathsGroupsStack = [];
1161
+ var clipPathsGroupsStackDepth = 0;
1162
+ var currentClipPathGroup;
1163
+ var prevClipPaths;
1164
+ var clipGroupNodeIdx = 0;
1165
+ for (var i = 0; i < listLen; i++) {
1166
+ var displayable = list[i];
1167
+ if (!displayable.invisible) {
1168
+ var clipPaths = displayable.__clipPaths;
1169
+ var len = clipPaths && clipPaths.length || 0;
1170
+ var prevLen = prevClipPaths && prevClipPaths.length || 0;
1171
+ var lca = void 0;
1172
+ for (lca = Math.max(len - 1, prevLen - 1); lca >= 0; lca--) if (clipPaths && prevClipPaths && clipPaths[lca] === prevClipPaths[lca]) break;
1173
+ for (var i_1 = prevLen - 1; i_1 > lca; i_1--) {
1174
+ clipPathsGroupsStackDepth--;
1175
+ currentClipPathGroup = clipPathsGroupsStack[clipPathsGroupsStackDepth - 1];
1176
+ }
1177
+ for (var i_2 = lca + 1; i_2 < len; i_2++) {
1178
+ var groupAttrs = {};
1179
+ setClipPath(clipPaths[i_2], groupAttrs, scope);
1180
+ var g = createVNode("g", "clip-g-" + clipGroupNodeIdx++, groupAttrs, []);
1181
+ (currentClipPathGroup ? currentClipPathGroup.children : out).push(g);
1182
+ clipPathsGroupsStack[clipPathsGroupsStackDepth++] = g;
1183
+ currentClipPathGroup = g;
1184
+ }
1185
+ prevClipPaths = clipPaths;
1186
+ var ret = brush(displayable, scope);
1187
+ if (ret) (currentClipPathGroup ? currentClipPathGroup.children : out).push(ret);
1188
+ }
1189
+ }
1190
+ };
1191
+ SVGPainter.prototype.resize = function(width, height) {
1192
+ var opts = this._opts;
1193
+ var root = this.root;
1194
+ var viewport = this._viewport;
1195
+ width != null && (opts.width = width);
1196
+ height != null && (opts.height = height);
1197
+ if (root && viewport) {
1198
+ viewport.style.display = "none";
1199
+ width = getSize(root, 0, opts);
1200
+ height = getSize(root, 1, opts);
1201
+ viewport.style.display = "";
1202
+ }
1203
+ if (this._width !== width || this._height !== height) {
1204
+ this._width = width;
1205
+ this._height = height;
1206
+ if (viewport) {
1207
+ var viewportStyle = viewport.style;
1208
+ viewportStyle.width = width + "px";
1209
+ viewportStyle.height = height + "px";
1210
+ }
1211
+ if (!isPattern(this._backgroundColor)) {
1212
+ var svgDom = this._svgDom;
1213
+ if (svgDom) {
1214
+ svgDom.setAttribute("width", width);
1215
+ svgDom.setAttribute("height", height);
1216
+ }
1217
+ var bgEl = this._bgVNode && this._bgVNode.elm;
1218
+ if (bgEl) {
1219
+ bgEl.setAttribute("width", width);
1220
+ bgEl.setAttribute("height", height);
1221
+ }
1222
+ } else this.refresh();
1223
+ }
1224
+ };
1225
+ SVGPainter.prototype.getWidth = function() {
1226
+ return this._width;
1227
+ };
1228
+ SVGPainter.prototype.getHeight = function() {
1229
+ return this._height;
1230
+ };
1231
+ SVGPainter.prototype.dispose = function() {
1232
+ if (this.root) this.root.innerHTML = "";
1233
+ this._svgDom = this._viewport = this.storage = this._oldVNode = this._bgVNode = this._mainVNode = null;
1234
+ };
1235
+ SVGPainter.prototype.clear = function() {
1236
+ if (this._svgDom) this._svgDom.innerHTML = null;
1237
+ this._oldVNode = null;
1238
+ };
1239
+ SVGPainter.prototype.toDataURL = function(base64) {
1240
+ var str = this.renderToString();
1241
+ var prefix = "data:image/svg+xml;";
1242
+ if (base64) {
1243
+ str = encodeBase64(str);
1244
+ return str && prefix + "base64," + str;
1245
+ }
1246
+ return prefix + "charset=UTF-8," + encodeURIComponent(str);
1247
+ };
1248
+ return SVGPainter;
1249
+ }();
1250
+ function createMethodNotSupport(method) {
1251
+ return function() {
1252
+ if (process.env.NODE_ENV !== "production") logError("In SVG mode painter not support method \"" + method + "\"");
1253
+ };
1254
+ }
1255
+ function createBackgroundVNode(width, height, backgroundColor, scope) {
1256
+ var bgVNode;
1257
+ if (backgroundColor && backgroundColor !== "none") {
1258
+ bgVNode = createVNode("rect", "bg", {
1259
+ width,
1260
+ height,
1261
+ x: "0",
1262
+ y: "0"
1263
+ });
1264
+ if (isGradient(backgroundColor)) setGradient({ fill: backgroundColor }, bgVNode.attrs, "fill", scope);
1265
+ else if (isPattern(backgroundColor)) setPattern({
1266
+ style: { fill: backgroundColor },
1267
+ dirty: noop,
1268
+ getBoundingRect: function() {
1269
+ return {
1270
+ width,
1271
+ height
1272
+ };
1273
+ }
1274
+ }, bgVNode.attrs, "fill", scope);
1275
+ else {
1276
+ var _a = normalizeColor(backgroundColor), color = _a.color, opacity = _a.opacity;
1277
+ bgVNode.attrs.fill = color;
1278
+ opacity < 1 && (bgVNode.attrs["fill-opacity"] = opacity);
1279
+ }
1280
+ }
1281
+ return bgVNode;
1282
+ }
1283
+
1284
+ //#endregion
1285
+ //#region ../../node_modules/.bun/echarts@6.0.0/node_modules/echarts/lib/renderer/installSVGRenderer.js
1286
+ /**
1287
+ * AUTO-GENERATED FILE. DO NOT MODIFY.
1288
+ */
1289
+ function install$1(registers) {
1290
+ registers.registerPainter("svg", SVGPainter);
1291
+ }
1292
+
1293
+ //#endregion
1294
+ //#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/canvas/Layer.js
1295
+ function createDom(id, painter, dpr) {
1296
+ var newDom = platformApi.createCanvas();
1297
+ var width = painter.getWidth();
1298
+ var height = painter.getHeight();
1299
+ var newDomStyle = newDom.style;
1300
+ if (newDomStyle) {
1301
+ newDomStyle.position = "absolute";
1302
+ newDomStyle.left = "0";
1303
+ newDomStyle.top = "0";
1304
+ newDomStyle.width = width + "px";
1305
+ newDomStyle.height = height + "px";
1306
+ newDom.setAttribute("data-zr-dom-id", id);
1307
+ }
1308
+ newDom.width = width * dpr;
1309
+ newDom.height = height * dpr;
1310
+ return newDom;
1311
+ }
1312
+ var Layer = function(_super) {
1313
+ __extends(Layer, _super);
1314
+ function Layer(id, painter, dpr) {
1315
+ var _this = _super.call(this) || this;
1316
+ _this.motionBlur = false;
1317
+ _this.lastFrameAlpha = .7;
1318
+ _this.dpr = 1;
1319
+ _this.virtual = false;
1320
+ _this.config = {};
1321
+ _this.incremental = false;
1322
+ _this.zlevel = 0;
1323
+ _this.maxRepaintRectCount = 5;
1324
+ _this.__dirty = true;
1325
+ _this.__firstTimePaint = true;
1326
+ _this.__used = false;
1327
+ _this.__drawIndex = 0;
1328
+ _this.__startIndex = 0;
1329
+ _this.__endIndex = 0;
1330
+ _this.__prevStartIndex = null;
1331
+ _this.__prevEndIndex = null;
1332
+ var dom;
1333
+ dpr = dpr || devicePixelRatio;
1334
+ if (typeof id === "string") dom = createDom(id, painter, dpr);
1335
+ else if (isObject(id)) {
1336
+ dom = id;
1337
+ id = dom.id;
1338
+ }
1339
+ _this.id = id;
1340
+ _this.dom = dom;
1341
+ var domStyle = dom.style;
1342
+ if (domStyle) {
1343
+ disableUserSelect(dom);
1344
+ dom.onselectstart = function() {
1345
+ return false;
1346
+ };
1347
+ domStyle.padding = "0";
1348
+ domStyle.margin = "0";
1349
+ domStyle.borderWidth = "0";
1350
+ }
1351
+ _this.painter = painter;
1352
+ _this.dpr = dpr;
1353
+ return _this;
1354
+ }
1355
+ Layer.prototype.getElementCount = function() {
1356
+ return this.__endIndex - this.__startIndex;
1357
+ };
1358
+ Layer.prototype.afterBrush = function() {
1359
+ this.__prevStartIndex = this.__startIndex;
1360
+ this.__prevEndIndex = this.__endIndex;
1361
+ };
1362
+ Layer.prototype.initContext = function() {
1363
+ this.ctx = this.dom.getContext("2d");
1364
+ this.ctx.dpr = this.dpr;
1365
+ };
1366
+ Layer.prototype.setUnpainted = function() {
1367
+ this.__firstTimePaint = true;
1368
+ };
1369
+ Layer.prototype.createBackBuffer = function() {
1370
+ var dpr = this.dpr;
1371
+ this.domBack = createDom("back-" + this.id, this.painter, dpr);
1372
+ this.ctxBack = this.domBack.getContext("2d");
1373
+ if (dpr !== 1) this.ctxBack.scale(dpr, dpr);
1374
+ };
1375
+ Layer.prototype.createRepaintRects = function(displayList, prevList, viewWidth, viewHeight) {
1376
+ if (this.__firstTimePaint) {
1377
+ this.__firstTimePaint = false;
1378
+ return null;
1379
+ }
1380
+ var mergedRepaintRects = [];
1381
+ var maxRepaintRectCount = this.maxRepaintRectCount;
1382
+ var full = false;
1383
+ var pendingRect = new BoundingRect(0, 0, 0, 0);
1384
+ function addRectToMergePool(rect) {
1385
+ if (!rect.isFinite() || rect.isZero()) return;
1386
+ if (mergedRepaintRects.length === 0) {
1387
+ var boundingRect = new BoundingRect(0, 0, 0, 0);
1388
+ boundingRect.copy(rect);
1389
+ mergedRepaintRects.push(boundingRect);
1390
+ } else {
1391
+ var isMerged = false;
1392
+ var minDeltaArea = Infinity;
1393
+ var bestRectToMergeIdx = 0;
1394
+ for (var i = 0; i < mergedRepaintRects.length; ++i) {
1395
+ var mergedRect = mergedRepaintRects[i];
1396
+ if (mergedRect.intersect(rect)) {
1397
+ var pendingRect_1 = new BoundingRect(0, 0, 0, 0);
1398
+ pendingRect_1.copy(mergedRect);
1399
+ pendingRect_1.union(rect);
1400
+ mergedRepaintRects[i] = pendingRect_1;
1401
+ isMerged = true;
1402
+ break;
1403
+ } else if (full) {
1404
+ pendingRect.copy(rect);
1405
+ pendingRect.union(mergedRect);
1406
+ var aArea = rect.width * rect.height;
1407
+ var bArea = mergedRect.width * mergedRect.height;
1408
+ var deltaArea = pendingRect.width * pendingRect.height - aArea - bArea;
1409
+ if (deltaArea < minDeltaArea) {
1410
+ minDeltaArea = deltaArea;
1411
+ bestRectToMergeIdx = i;
1412
+ }
1413
+ }
1414
+ }
1415
+ if (full) {
1416
+ mergedRepaintRects[bestRectToMergeIdx].union(rect);
1417
+ isMerged = true;
1418
+ }
1419
+ if (!isMerged) {
1420
+ var boundingRect = new BoundingRect(0, 0, 0, 0);
1421
+ boundingRect.copy(rect);
1422
+ mergedRepaintRects.push(boundingRect);
1423
+ }
1424
+ if (!full) full = mergedRepaintRects.length >= maxRepaintRectCount;
1425
+ }
1426
+ }
1427
+ for (var i = this.__startIndex; i < this.__endIndex; ++i) {
1428
+ var el = displayList[i];
1429
+ if (el) {
1430
+ var shouldPaint = el.shouldBePainted(viewWidth, viewHeight, true, true);
1431
+ var prevRect = el.__isRendered && (el.__dirty & 1 || !shouldPaint) ? el.getPrevPaintRect() : null;
1432
+ if (prevRect) addRectToMergePool(prevRect);
1433
+ var curRect = shouldPaint && (el.__dirty & 1 || !el.__isRendered) ? el.getPaintRect() : null;
1434
+ if (curRect) addRectToMergePool(curRect);
1435
+ }
1436
+ }
1437
+ for (var i = this.__prevStartIndex; i < this.__prevEndIndex; ++i) {
1438
+ var el = prevList[i];
1439
+ var shouldPaint = el && el.shouldBePainted(viewWidth, viewHeight, true, true);
1440
+ if (el && (!shouldPaint || !el.__zr) && el.__isRendered) {
1441
+ var prevRect = el.getPrevPaintRect();
1442
+ if (prevRect) addRectToMergePool(prevRect);
1443
+ }
1444
+ }
1445
+ var hasIntersections;
1446
+ do {
1447
+ hasIntersections = false;
1448
+ for (var i = 0; i < mergedRepaintRects.length;) {
1449
+ if (mergedRepaintRects[i].isZero()) {
1450
+ mergedRepaintRects.splice(i, 1);
1451
+ continue;
1452
+ }
1453
+ for (var j = i + 1; j < mergedRepaintRects.length;) if (mergedRepaintRects[i].intersect(mergedRepaintRects[j])) {
1454
+ hasIntersections = true;
1455
+ mergedRepaintRects[i].union(mergedRepaintRects[j]);
1456
+ mergedRepaintRects.splice(j, 1);
1457
+ } else j++;
1458
+ i++;
1459
+ }
1460
+ } while (hasIntersections);
1461
+ this._paintRects = mergedRepaintRects;
1462
+ return mergedRepaintRects;
1463
+ };
1464
+ Layer.prototype.debugGetPaintRects = function() {
1465
+ return (this._paintRects || []).slice();
1466
+ };
1467
+ Layer.prototype.resize = function(width, height) {
1468
+ var dpr = this.dpr;
1469
+ var dom = this.dom;
1470
+ var domStyle = dom.style;
1471
+ var domBack = this.domBack;
1472
+ if (domStyle) {
1473
+ domStyle.width = width + "px";
1474
+ domStyle.height = height + "px";
1475
+ }
1476
+ dom.width = width * dpr;
1477
+ dom.height = height * dpr;
1478
+ if (domBack) {
1479
+ domBack.width = width * dpr;
1480
+ domBack.height = height * dpr;
1481
+ if (dpr !== 1) this.ctxBack.scale(dpr, dpr);
1482
+ }
1483
+ };
1484
+ Layer.prototype.clear = function(clearAll, clearColor, repaintRects) {
1485
+ var dom = this.dom;
1486
+ var ctx = this.ctx;
1487
+ var width = dom.width;
1488
+ var height = dom.height;
1489
+ clearColor = clearColor || this.clearColor;
1490
+ var haveMotionBLur = this.motionBlur && !clearAll;
1491
+ var lastFrameAlpha = this.lastFrameAlpha;
1492
+ var dpr = this.dpr;
1493
+ var self = this;
1494
+ if (haveMotionBLur) {
1495
+ if (!this.domBack) this.createBackBuffer();
1496
+ this.ctxBack.globalCompositeOperation = "copy";
1497
+ this.ctxBack.drawImage(dom, 0, 0, width / dpr, height / dpr);
1498
+ }
1499
+ var domBack = this.domBack;
1500
+ function doClear(x, y, width, height) {
1501
+ ctx.clearRect(x, y, width, height);
1502
+ if (clearColor && clearColor !== "transparent") {
1503
+ var clearColorGradientOrPattern = void 0;
1504
+ if (isGradientObject(clearColor)) {
1505
+ clearColorGradientOrPattern = (clearColor.global || clearColor.__width === width && clearColor.__height === height) && clearColor.__canvasGradient || getCanvasGradient(ctx, clearColor, {
1506
+ x: 0,
1507
+ y: 0,
1508
+ width,
1509
+ height
1510
+ });
1511
+ clearColor.__canvasGradient = clearColorGradientOrPattern;
1512
+ clearColor.__width = width;
1513
+ clearColor.__height = height;
1514
+ } else if (isImagePatternObject(clearColor)) {
1515
+ clearColor.scaleX = clearColor.scaleX || dpr;
1516
+ clearColor.scaleY = clearColor.scaleY || dpr;
1517
+ clearColorGradientOrPattern = createCanvasPattern(ctx, clearColor, { dirty: function() {
1518
+ self.setUnpainted();
1519
+ self.painter.refresh();
1520
+ } });
1521
+ }
1522
+ ctx.save();
1523
+ ctx.fillStyle = clearColorGradientOrPattern || clearColor;
1524
+ ctx.fillRect(x, y, width, height);
1525
+ ctx.restore();
1526
+ }
1527
+ if (haveMotionBLur) {
1528
+ ctx.save();
1529
+ ctx.globalAlpha = lastFrameAlpha;
1530
+ ctx.drawImage(domBack, x, y, width, height);
1531
+ ctx.restore();
1532
+ }
1533
+ }
1534
+ if (!repaintRects || haveMotionBLur) doClear(0, 0, width, height);
1535
+ else if (repaintRects.length) each(repaintRects, function(rect) {
1536
+ doClear(rect.x * dpr, rect.y * dpr, rect.width * dpr, rect.height * dpr);
1537
+ });
1538
+ };
1539
+ return Layer;
1540
+ }(Eventful);
1541
+
1542
+ //#endregion
1543
+ //#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/canvas/Painter.js
1544
+ var HOVER_LAYER_ZLEVEL = 1e5;
1545
+ var CANVAS_ZLEVEL = 314159;
1546
+ var EL_AFTER_INCREMENTAL_INC = .01;
1547
+ var INCREMENTAL_INC = .001;
1548
+ function isLayerValid(layer) {
1549
+ if (!layer) return false;
1550
+ if (layer.__builtin__) return true;
1551
+ if (typeof layer.resize !== "function" || typeof layer.refresh !== "function") return false;
1552
+ return true;
1553
+ }
1554
+ function createRoot(width, height) {
1555
+ var domRoot = document.createElement("div");
1556
+ domRoot.style.cssText = [
1557
+ "position:relative",
1558
+ "width:" + width + "px",
1559
+ "height:" + height + "px",
1560
+ "padding:0",
1561
+ "margin:0",
1562
+ "border-width:0"
1563
+ ].join(";") + ";";
1564
+ return domRoot;
1565
+ }
1566
+ var CanvasPainter = function() {
1567
+ function CanvasPainter(root, storage, opts, id) {
1568
+ this.type = "canvas";
1569
+ this._zlevelList = [];
1570
+ this._prevDisplayList = [];
1571
+ this._layers = {};
1572
+ this._layerConfig = {};
1573
+ this._needsManuallyCompositing = false;
1574
+ this.type = "canvas";
1575
+ var singleCanvas = !root.nodeName || root.nodeName.toUpperCase() === "CANVAS";
1576
+ this._opts = opts = extend({}, opts || {});
1577
+ this.dpr = opts.devicePixelRatio || devicePixelRatio;
1578
+ this._singleCanvas = singleCanvas;
1579
+ this.root = root;
1580
+ if (root.style) {
1581
+ disableUserSelect(root);
1582
+ root.innerHTML = "";
1583
+ }
1584
+ this.storage = storage;
1585
+ var zlevelList = this._zlevelList;
1586
+ this._prevDisplayList = [];
1587
+ var layers = this._layers;
1588
+ if (!singleCanvas) {
1589
+ this._width = getSize(root, 0, opts);
1590
+ this._height = getSize(root, 1, opts);
1591
+ var domRoot = this._domRoot = createRoot(this._width, this._height);
1592
+ root.appendChild(domRoot);
1593
+ } else {
1594
+ var rootCanvas = root;
1595
+ var width = rootCanvas.width;
1596
+ var height = rootCanvas.height;
1597
+ if (opts.width != null) width = opts.width;
1598
+ if (opts.height != null) height = opts.height;
1599
+ this.dpr = opts.devicePixelRatio || 1;
1600
+ rootCanvas.width = width * this.dpr;
1601
+ rootCanvas.height = height * this.dpr;
1602
+ this._width = width;
1603
+ this._height = height;
1604
+ var mainLayer = new Layer(rootCanvas, this, this.dpr);
1605
+ mainLayer.__builtin__ = true;
1606
+ mainLayer.initContext();
1607
+ layers[CANVAS_ZLEVEL] = mainLayer;
1608
+ mainLayer.zlevel = CANVAS_ZLEVEL;
1609
+ zlevelList.push(CANVAS_ZLEVEL);
1610
+ this._domRoot = root;
1611
+ }
1612
+ }
1613
+ CanvasPainter.prototype.getType = function() {
1614
+ return "canvas";
1615
+ };
1616
+ CanvasPainter.prototype.isSingleCanvas = function() {
1617
+ return this._singleCanvas;
1618
+ };
1619
+ CanvasPainter.prototype.getViewportRoot = function() {
1620
+ return this._domRoot;
1621
+ };
1622
+ CanvasPainter.prototype.getViewportRootOffset = function() {
1623
+ var viewportRoot = this.getViewportRoot();
1624
+ if (viewportRoot) return {
1625
+ offsetLeft: viewportRoot.offsetLeft || 0,
1626
+ offsetTop: viewportRoot.offsetTop || 0
1627
+ };
1628
+ };
1629
+ CanvasPainter.prototype.refresh = function(paintAll) {
1630
+ var list = this.storage.getDisplayList(true);
1631
+ var prevList = this._prevDisplayList;
1632
+ var zlevelList = this._zlevelList;
1633
+ this._redrawId = Math.random();
1634
+ this._paintList(list, prevList, paintAll, this._redrawId);
1635
+ for (var i = 0; i < zlevelList.length; i++) {
1636
+ var z = zlevelList[i];
1637
+ var layer = this._layers[z];
1638
+ if (!layer.__builtin__ && layer.refresh) {
1639
+ var clearColor = i === 0 ? this._backgroundColor : null;
1640
+ layer.refresh(clearColor);
1641
+ }
1642
+ }
1643
+ if (this._opts.useDirtyRect) this._prevDisplayList = list.slice();
1644
+ return this;
1645
+ };
1646
+ CanvasPainter.prototype.refreshHover = function() {
1647
+ this._paintHoverList(this.storage.getDisplayList(false));
1648
+ };
1649
+ CanvasPainter.prototype._paintHoverList = function(list) {
1650
+ var len = list.length;
1651
+ var hoverLayer = this._hoverlayer;
1652
+ hoverLayer && hoverLayer.clear();
1653
+ if (!len) return;
1654
+ var scope = {
1655
+ inHover: true,
1656
+ viewWidth: this._width,
1657
+ viewHeight: this._height
1658
+ };
1659
+ var ctx;
1660
+ for (var i = 0; i < len; i++) {
1661
+ var el = list[i];
1662
+ if (el.__inHover) {
1663
+ if (!hoverLayer) hoverLayer = this._hoverlayer = this.getLayer(HOVER_LAYER_ZLEVEL);
1664
+ if (!ctx) {
1665
+ ctx = hoverLayer.ctx;
1666
+ ctx.save();
1667
+ }
1668
+ brush$1(ctx, el, scope, i === len - 1);
1669
+ }
1670
+ }
1671
+ if (ctx) ctx.restore();
1672
+ };
1673
+ CanvasPainter.prototype.getHoverLayer = function() {
1674
+ return this.getLayer(HOVER_LAYER_ZLEVEL);
1675
+ };
1676
+ CanvasPainter.prototype.paintOne = function(ctx, el) {
1677
+ brushSingle(ctx, el);
1678
+ };
1679
+ CanvasPainter.prototype._paintList = function(list, prevList, paintAll, redrawId) {
1680
+ if (this._redrawId !== redrawId) return;
1681
+ paintAll = paintAll || false;
1682
+ this._updateLayerStatus(list);
1683
+ var _a = this._doPaintList(list, prevList, paintAll), finished = _a.finished, needsRefreshHover = _a.needsRefreshHover;
1684
+ if (this._needsManuallyCompositing) this._compositeManually();
1685
+ if (needsRefreshHover) this._paintHoverList(list);
1686
+ if (!finished) {
1687
+ var self_1 = this;
1688
+ requestAnimationFrame(function() {
1689
+ self_1._paintList(list, prevList, paintAll, redrawId);
1690
+ });
1691
+ } else this.eachLayer(function(layer) {
1692
+ layer.afterBrush && layer.afterBrush();
1693
+ });
1694
+ };
1695
+ CanvasPainter.prototype._compositeManually = function() {
1696
+ var ctx = this.getLayer(CANVAS_ZLEVEL).ctx;
1697
+ var width = this._domRoot.width;
1698
+ var height = this._domRoot.height;
1699
+ ctx.clearRect(0, 0, width, height);
1700
+ this.eachBuiltinLayer(function(layer) {
1701
+ if (layer.virtual) ctx.drawImage(layer.dom, 0, 0, width, height);
1702
+ });
1703
+ };
1704
+ CanvasPainter.prototype._doPaintList = function(list, prevList, paintAll) {
1705
+ var _this = this;
1706
+ var layerList = [];
1707
+ var useDirtyRect = this._opts.useDirtyRect;
1708
+ for (var zi = 0; zi < this._zlevelList.length; zi++) {
1709
+ var zlevel = this._zlevelList[zi];
1710
+ var layer = this._layers[zlevel];
1711
+ if (layer.__builtin__ && layer !== this._hoverlayer && (layer.__dirty || paintAll)) layerList.push(layer);
1712
+ }
1713
+ var finished = true;
1714
+ var needsRefreshHover = false;
1715
+ var _loop_1 = function(k) {
1716
+ var layer = layerList[k];
1717
+ var ctx = layer.ctx;
1718
+ var repaintRects = useDirtyRect && layer.createRepaintRects(list, prevList, this_1._width, this_1._height);
1719
+ var start = paintAll ? layer.__startIndex : layer.__drawIndex;
1720
+ var useTimer = !paintAll && layer.incremental && Date.now;
1721
+ var startTime = useTimer && Date.now();
1722
+ var clearColor = layer.zlevel === this_1._zlevelList[0] ? this_1._backgroundColor : null;
1723
+ if (layer.__startIndex === layer.__endIndex) layer.clear(false, clearColor, repaintRects);
1724
+ else if (start === layer.__startIndex) {
1725
+ var firstEl = list[start];
1726
+ if (!firstEl.incremental || !firstEl.notClear || paintAll) layer.clear(false, clearColor, repaintRects);
1727
+ }
1728
+ if (start === -1) {
1729
+ console.error("For some unknown reason. drawIndex is -1");
1730
+ start = layer.__startIndex;
1731
+ }
1732
+ var i;
1733
+ var repaint = function(repaintRect) {
1734
+ var scope = {
1735
+ inHover: false,
1736
+ allClipped: false,
1737
+ prevEl: null,
1738
+ viewWidth: _this._width,
1739
+ viewHeight: _this._height
1740
+ };
1741
+ for (i = start; i < layer.__endIndex; i++) {
1742
+ var el = list[i];
1743
+ if (el.__inHover) needsRefreshHover = true;
1744
+ _this._doPaintEl(el, layer, useDirtyRect, repaintRect, scope, i === layer.__endIndex - 1);
1745
+ if (useTimer) {
1746
+ if (Date.now() - startTime > 15) break;
1747
+ }
1748
+ }
1749
+ if (scope.prevElClipPaths) ctx.restore();
1750
+ };
1751
+ if (repaintRects) if (repaintRects.length === 0) i = layer.__endIndex;
1752
+ else {
1753
+ var dpr = this_1.dpr;
1754
+ for (var r = 0; r < repaintRects.length; ++r) {
1755
+ var rect = repaintRects[r];
1756
+ ctx.save();
1757
+ ctx.beginPath();
1758
+ ctx.rect(rect.x * dpr, rect.y * dpr, rect.width * dpr, rect.height * dpr);
1759
+ ctx.clip();
1760
+ repaint(rect);
1761
+ ctx.restore();
1762
+ }
1763
+ }
1764
+ else {
1765
+ ctx.save();
1766
+ repaint();
1767
+ ctx.restore();
1768
+ }
1769
+ layer.__drawIndex = i;
1770
+ if (layer.__drawIndex < layer.__endIndex) finished = false;
1771
+ };
1772
+ var this_1 = this;
1773
+ for (var k = 0; k < layerList.length; k++) _loop_1(k);
1774
+ if (env.wxa) each(this._layers, function(layer) {
1775
+ if (layer && layer.ctx && layer.ctx.draw) layer.ctx.draw();
1776
+ });
1777
+ return {
1778
+ finished,
1779
+ needsRefreshHover
1780
+ };
1781
+ };
1782
+ CanvasPainter.prototype._doPaintEl = function(el, currentLayer, useDirtyRect, repaintRect, scope, isLast) {
1783
+ var ctx = currentLayer.ctx;
1784
+ if (useDirtyRect) {
1785
+ var paintRect = el.getPaintRect();
1786
+ if (!repaintRect || paintRect && paintRect.intersect(repaintRect)) {
1787
+ brush$1(ctx, el, scope, isLast);
1788
+ el.setPrevPaintRect(paintRect);
1789
+ }
1790
+ } else brush$1(ctx, el, scope, isLast);
1791
+ };
1792
+ CanvasPainter.prototype.getLayer = function(zlevel, virtual) {
1793
+ if (this._singleCanvas && !this._needsManuallyCompositing) zlevel = CANVAS_ZLEVEL;
1794
+ var layer = this._layers[zlevel];
1795
+ if (!layer) {
1796
+ layer = new Layer("zr_" + zlevel, this, this.dpr);
1797
+ layer.zlevel = zlevel;
1798
+ layer.__builtin__ = true;
1799
+ if (this._layerConfig[zlevel]) merge(layer, this._layerConfig[zlevel], true);
1800
+ else if (this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC]) merge(layer, this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC], true);
1801
+ if (virtual) layer.virtual = virtual;
1802
+ this.insertLayer(zlevel, layer);
1803
+ layer.initContext();
1804
+ }
1805
+ return layer;
1806
+ };
1807
+ CanvasPainter.prototype.insertLayer = function(zlevel, layer) {
1808
+ var layersMap = this._layers;
1809
+ var zlevelList = this._zlevelList;
1810
+ var len = zlevelList.length;
1811
+ var domRoot = this._domRoot;
1812
+ var prevLayer = null;
1813
+ var i = -1;
1814
+ if (layersMap[zlevel]) {
1815
+ if (process.env.NODE_ENV !== "production") logError("ZLevel " + zlevel + " has been used already");
1816
+ return;
1817
+ }
1818
+ if (!isLayerValid(layer)) {
1819
+ if (process.env.NODE_ENV !== "production") logError("Layer of zlevel " + zlevel + " is not valid");
1820
+ return;
1821
+ }
1822
+ if (len > 0 && zlevel > zlevelList[0]) {
1823
+ for (i = 0; i < len - 1; i++) if (zlevelList[i] < zlevel && zlevelList[i + 1] > zlevel) break;
1824
+ prevLayer = layersMap[zlevelList[i]];
1825
+ }
1826
+ zlevelList.splice(i + 1, 0, zlevel);
1827
+ layersMap[zlevel] = layer;
1828
+ if (!layer.virtual) if (prevLayer) {
1829
+ var prevDom = prevLayer.dom;
1830
+ if (prevDom.nextSibling) domRoot.insertBefore(layer.dom, prevDom.nextSibling);
1831
+ else domRoot.appendChild(layer.dom);
1832
+ } else if (domRoot.firstChild) domRoot.insertBefore(layer.dom, domRoot.firstChild);
1833
+ else domRoot.appendChild(layer.dom);
1834
+ layer.painter || (layer.painter = this);
1835
+ };
1836
+ CanvasPainter.prototype.eachLayer = function(cb, context) {
1837
+ var zlevelList = this._zlevelList;
1838
+ for (var i = 0; i < zlevelList.length; i++) {
1839
+ var z = zlevelList[i];
1840
+ cb.call(context, this._layers[z], z);
1841
+ }
1842
+ };
1843
+ CanvasPainter.prototype.eachBuiltinLayer = function(cb, context) {
1844
+ var zlevelList = this._zlevelList;
1845
+ for (var i = 0; i < zlevelList.length; i++) {
1846
+ var z = zlevelList[i];
1847
+ var layer = this._layers[z];
1848
+ if (layer.__builtin__) cb.call(context, layer, z);
1849
+ }
1850
+ };
1851
+ CanvasPainter.prototype.eachOtherLayer = function(cb, context) {
1852
+ var zlevelList = this._zlevelList;
1853
+ for (var i = 0; i < zlevelList.length; i++) {
1854
+ var z = zlevelList[i];
1855
+ var layer = this._layers[z];
1856
+ if (!layer.__builtin__) cb.call(context, layer, z);
1857
+ }
1858
+ };
1859
+ CanvasPainter.prototype.getLayers = function() {
1860
+ return this._layers;
1861
+ };
1862
+ CanvasPainter.prototype._updateLayerStatus = function(list) {
1863
+ this.eachBuiltinLayer(function(layer, z) {
1864
+ layer.__dirty = layer.__used = false;
1865
+ });
1866
+ function updatePrevLayer(idx) {
1867
+ if (prevLayer) {
1868
+ if (prevLayer.__endIndex !== idx) prevLayer.__dirty = true;
1869
+ prevLayer.__endIndex = idx;
1870
+ }
1871
+ }
1872
+ if (this._singleCanvas) for (var i_1 = 1; i_1 < list.length; i_1++) {
1873
+ var el = list[i_1];
1874
+ if (el.zlevel !== list[i_1 - 1].zlevel || el.incremental) {
1875
+ this._needsManuallyCompositing = true;
1876
+ break;
1877
+ }
1878
+ }
1879
+ var prevLayer = null;
1880
+ var incrementalLayerCount = 0;
1881
+ var prevZlevel;
1882
+ var i;
1883
+ for (i = 0; i < list.length; i++) {
1884
+ var el = list[i];
1885
+ var zlevel = el.zlevel;
1886
+ var layer = void 0;
1887
+ if (prevZlevel !== zlevel) {
1888
+ prevZlevel = zlevel;
1889
+ incrementalLayerCount = 0;
1890
+ }
1891
+ if (el.incremental) {
1892
+ layer = this.getLayer(zlevel + INCREMENTAL_INC, this._needsManuallyCompositing);
1893
+ layer.incremental = true;
1894
+ incrementalLayerCount = 1;
1895
+ } else layer = this.getLayer(zlevel + (incrementalLayerCount > 0 ? EL_AFTER_INCREMENTAL_INC : 0), this._needsManuallyCompositing);
1896
+ if (!layer.__builtin__) logError("ZLevel " + zlevel + " has been used by unkown layer " + layer.id);
1897
+ if (layer !== prevLayer) {
1898
+ layer.__used = true;
1899
+ if (layer.__startIndex !== i) layer.__dirty = true;
1900
+ layer.__startIndex = i;
1901
+ if (!layer.incremental) layer.__drawIndex = i;
1902
+ else layer.__drawIndex = -1;
1903
+ updatePrevLayer(i);
1904
+ prevLayer = layer;
1905
+ }
1906
+ if (el.__dirty & 1 && !el.__inHover) {
1907
+ layer.__dirty = true;
1908
+ if (layer.incremental && layer.__drawIndex < 0) layer.__drawIndex = i;
1909
+ }
1910
+ }
1911
+ updatePrevLayer(i);
1912
+ this.eachBuiltinLayer(function(layer, z) {
1913
+ if (!layer.__used && layer.getElementCount() > 0) {
1914
+ layer.__dirty = true;
1915
+ layer.__startIndex = layer.__endIndex = layer.__drawIndex = 0;
1916
+ }
1917
+ if (layer.__dirty && layer.__drawIndex < 0) layer.__drawIndex = layer.__startIndex;
1918
+ });
1919
+ };
1920
+ CanvasPainter.prototype.clear = function() {
1921
+ this.eachBuiltinLayer(this._clearLayer);
1922
+ return this;
1923
+ };
1924
+ CanvasPainter.prototype._clearLayer = function(layer) {
1925
+ layer.clear();
1926
+ };
1927
+ CanvasPainter.prototype.setBackgroundColor = function(backgroundColor) {
1928
+ this._backgroundColor = backgroundColor;
1929
+ each(this._layers, function(layer) {
1930
+ layer.setUnpainted();
1931
+ });
1932
+ };
1933
+ CanvasPainter.prototype.configLayer = function(zlevel, config) {
1934
+ if (config) {
1935
+ var layerConfig = this._layerConfig;
1936
+ if (!layerConfig[zlevel]) layerConfig[zlevel] = config;
1937
+ else merge(layerConfig[zlevel], config, true);
1938
+ for (var i = 0; i < this._zlevelList.length; i++) {
1939
+ var _zlevel = this._zlevelList[i];
1940
+ if (_zlevel === zlevel || _zlevel === zlevel + EL_AFTER_INCREMENTAL_INC) {
1941
+ var layer = this._layers[_zlevel];
1942
+ merge(layer, layerConfig[zlevel], true);
1943
+ }
1944
+ }
1945
+ }
1946
+ };
1947
+ CanvasPainter.prototype.delLayer = function(zlevel) {
1948
+ var layers = this._layers;
1949
+ var zlevelList = this._zlevelList;
1950
+ var layer = layers[zlevel];
1951
+ if (!layer) return;
1952
+ layer.dom.parentNode.removeChild(layer.dom);
1953
+ delete layers[zlevel];
1954
+ zlevelList.splice(indexOf(zlevelList, zlevel), 1);
1955
+ };
1956
+ CanvasPainter.prototype.resize = function(width, height) {
1957
+ if (!this._domRoot.style) {
1958
+ if (width == null || height == null) return;
1959
+ this._width = width;
1960
+ this._height = height;
1961
+ this.getLayer(CANVAS_ZLEVEL).resize(width, height);
1962
+ } else {
1963
+ var domRoot = this._domRoot;
1964
+ domRoot.style.display = "none";
1965
+ var opts = this._opts;
1966
+ var root = this.root;
1967
+ width != null && (opts.width = width);
1968
+ height != null && (opts.height = height);
1969
+ width = getSize(root, 0, opts);
1970
+ height = getSize(root, 1, opts);
1971
+ domRoot.style.display = "";
1972
+ if (this._width !== width || height !== this._height) {
1973
+ domRoot.style.width = width + "px";
1974
+ domRoot.style.height = height + "px";
1975
+ for (var id in this._layers) if (this._layers.hasOwnProperty(id)) this._layers[id].resize(width, height);
1976
+ this.refresh(true);
1977
+ }
1978
+ this._width = width;
1979
+ this._height = height;
1980
+ }
1981
+ return this;
1982
+ };
1983
+ CanvasPainter.prototype.clearLayer = function(zlevel) {
1984
+ var layer = this._layers[zlevel];
1985
+ if (layer) layer.clear();
1986
+ };
1987
+ CanvasPainter.prototype.dispose = function() {
1988
+ this.root.innerHTML = "";
1989
+ this.root = this.storage = this._domRoot = this._layers = null;
1990
+ };
1991
+ CanvasPainter.prototype.getRenderedCanvas = function(opts) {
1992
+ opts = opts || {};
1993
+ if (this._singleCanvas && !this._compositeManually) return this._layers[CANVAS_ZLEVEL].dom;
1994
+ var imageLayer = new Layer("image", this, opts.pixelRatio || this.dpr);
1995
+ imageLayer.initContext();
1996
+ imageLayer.clear(false, opts.backgroundColor || this._backgroundColor);
1997
+ var ctx = imageLayer.ctx;
1998
+ if (opts.pixelRatio <= this.dpr) {
1999
+ this.refresh();
2000
+ var width_1 = imageLayer.dom.width;
2001
+ var height_1 = imageLayer.dom.height;
2002
+ this.eachLayer(function(layer) {
2003
+ if (layer.__builtin__) ctx.drawImage(layer.dom, 0, 0, width_1, height_1);
2004
+ else if (layer.renderToCanvas) {
2005
+ ctx.save();
2006
+ layer.renderToCanvas(ctx);
2007
+ ctx.restore();
2008
+ }
2009
+ });
2010
+ } else {
2011
+ var scope = {
2012
+ inHover: false,
2013
+ viewWidth: this._width,
2014
+ viewHeight: this._height
2015
+ };
2016
+ var displayList = this.storage.getDisplayList(true);
2017
+ for (var i = 0, len = displayList.length; i < len; i++) {
2018
+ var el = displayList[i];
2019
+ brush$1(ctx, el, scope, i === len - 1);
2020
+ }
2021
+ }
2022
+ return imageLayer.dom;
2023
+ };
2024
+ CanvasPainter.prototype.getWidth = function() {
2025
+ return this._width;
2026
+ };
2027
+ CanvasPainter.prototype.getHeight = function() {
2028
+ return this._height;
2029
+ };
2030
+ return CanvasPainter;
2031
+ }();
2032
+
2033
+ //#endregion
2034
+ //#region ../../node_modules/.bun/echarts@6.0.0/node_modules/echarts/lib/renderer/installCanvasRenderer.js
2035
+ /**
2036
+ * AUTO-GENERATED FILE. DO NOT MODIFY.
2037
+ */
2038
+ function install(registers) {
2039
+ registers.registerPainter("canvas", CanvasPainter);
2040
+ }
2041
+
2042
+ //#endregion
2043
+ export { install as CanvasRenderer, install$1 as SVGRenderer };
2044
+ //# sourceMappingURL=renderers-Dytryvoy.js.map