@genome-spy/app 0.84.0 → 0.86.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 (62) hide show
  1. package/README.md +28 -0
  2. package/dist/{agentApi-DHXYZVvQ.js → agentApi-DgopQbMV.js} +5804 -7009
  3. package/dist/agentApi.es.js +2823 -2594
  4. package/dist/agentShared.es.js +15 -14
  5. package/dist/canvas2d-8uxuN_vx.js +619 -0
  6. package/dist/canvas2d-BtQC7Xr8.js +619 -0
  7. package/dist/canvasSizeHelper-7h_8rOcx.js +56 -0
  8. package/dist/clipOptions-BQfNhxgP.js +2239 -0
  9. package/dist/clipOptions-taFzEljc.js +2259 -0
  10. package/dist/{debug-aHQsa6hU.js → debug-Bzc3SoRg.js} +8 -8
  11. package/dist/{debug-D6FqxKEj.js → debug-D_VtWQ6l.js} +8 -8
  12. package/dist/{esm-CGLz7idZ.js → esm-BA6yMcc-.js} +438 -434
  13. package/dist/{esm-D8vvQAP3.js → esm-CcDLRSvC.js} +33 -33
  14. package/dist/{esm-BeV56E_5.js → esm-CfYZhLHN.js} +33 -33
  15. package/dist/{esm-DQ3lJSQN.js → esm-JAiZmFIS.js} +1 -1
  16. package/dist/index.es.js +3067 -2987
  17. package/dist/index.js +2030 -2022
  18. package/dist/indexer-qiFctgR3.js +72 -0
  19. package/dist/indexer-qy_dq5l5.js +72 -0
  20. package/dist/layoutResult-D50MSHXR.js +97 -0
  21. package/dist/nativeText-DFV5XIx8.js +860 -0
  22. package/dist/nativeText-vT3AWE14.js +860 -0
  23. package/dist/performanceProfiler-CPLEjApa.js +20 -0
  24. package/dist/rasterExport-B8pVoOsj.js +44 -0
  25. package/dist/rasterExport-C4r4xjQT.js +44 -0
  26. package/dist/rasterImage-B4rPLaW9.js +18 -0
  27. package/dist/rasterization-CFogVB3B.js +50 -0
  28. package/dist/rectangle-DKnrAmKs.js +142 -0
  29. package/dist/renderCanvas2D-BQrRWp2Z.js +271 -0
  30. package/dist/renderCanvas2D-CHVNfIUz.js +271 -0
  31. package/dist/schema.json +1559 -219
  32. package/dist/style.css +1 -1
  33. package/dist/svg-C-Sw6E6G.js +1167 -0
  34. package/dist/svg-CKHwwKRt.js +1167 -0
  35. package/dist/{svgNumber-C6aRPc8Z.js → svgNumber-DNxESJQB.js} +1 -1
  36. package/dist/svgRasterizer-BgD72AmG.js +40 -0
  37. package/dist/svgRasterizer-BgSNqI3L.js +40 -0
  38. package/dist/vega-scale-CK0_al6O.js +2700 -0
  39. package/dist/vega-scale-D46-iCaL.js +2700 -0
  40. package/dist/viewError-BiR9VCgL.js +29 -0
  41. package/dist/{viewIdentityRegistry-Dl7rR4Ay.js → viewIdentityRegistry-B-VGlez1.js} +1 -1
  42. package/dist/{viewIdentityRegistry-AEQpJTDm.js → viewIdentityRegistry-CDtVktJD.js} +1 -1
  43. package/dist/viewSelectors-CKfxF_LM.js +1817 -0
  44. package/dist/viewSelectors-D_imtq5Z.js +1817 -0
  45. package/dist/viewUtils-nCJ7AoaI.js +5782 -0
  46. package/dist/warning-CpIIpk8e.js +7 -0
  47. package/dist/webgl-BaA3jSa2.js +4128 -0
  48. package/dist/webgl-FP-4EsBL.js +4128 -0
  49. package/package.json +7 -6
  50. package/dist/bmFontMetrics-CuNB-kNN.js +0 -31
  51. package/dist/clipOptions-Dqco1p8b.js +0 -377
  52. package/dist/framebufferReadback-Bje9lHb7.js +0 -1993
  53. package/dist/framebufferReadback-CC0D6Haw.js +0 -147
  54. package/dist/raster-9uKYMjHZ.js +0 -53
  55. package/dist/raster-BofBWXbe.js +0 -54
  56. package/dist/svg-CvsT1Y2V.js +0 -1793
  57. package/dist/svg-DRgWfcsL.js +0 -1793
  58. package/dist/twgl-full.module-BNEMlXRV.js +0 -1849
  59. package/dist/viewRenderingContext-HtpqwS_x.js +0 -120
  60. package/dist/viewSelectors-BhW4mTR1.js +0 -6386
  61. package/dist/viewSelectors-Bwzj10Qz.js +0 -6363
  62. package/dist/viewUtils-DMNiWslc.js +0 -7228
@@ -0,0 +1,1167 @@
1
+ import { E as e, Jt as t, O as n, _t as r, o as i, s as a } from "./clipOptions-taFzEljc.js";
2
+ import { v as o } from "./vega-scale-D46-iCaL.js";
3
+ import { x as s } from "./viewSelectors-D_imtq5Z.js";
4
+ import { t as c } from "./rasterization-CFogVB3B.js";
5
+ import { t as l } from "./rectangle-DKnrAmKs.js";
6
+ import { n as u, t as d } from "./layoutResult-D50MSHXR.js";
7
+ import { C as f, D as p, E as m, O as h, S as g, T as _, _ as v, a as y, b as ee, c as b, d as x, f as S, h as C, i as w, k as T, l as E, m as D, n as O, o as te, p as ne, r as re, s as ie, t as ae, u as oe, w as se, x as ce, y as k } from "./nativeText-vT3AWE14.js";
8
+ import { n as A, t as j } from "./svgNumber-DNxESJQB.js";
9
+ //#region ../core/src/rendering/svg/svgElement.js
10
+ var M = "http://www.w3.org/2000/svg";
11
+ function N(e, t) {
12
+ let n = document.createElementNS(M, e);
13
+ if (t) for (let [e, r] of Object.entries(t)) n.setAttribute(e, "" + r);
14
+ return n;
15
+ }
16
+ //#endregion
17
+ //#region ../core/src/rendering/svg/svgAttributes.js
18
+ function P(e, t) {
19
+ let n = Object.entries(t).filter(([t, n]) => n.encoder.constant ? (e.setAttribute(t, "" + F(n, {})), !1) : !0);
20
+ return (e) => Object.fromEntries(n.map(([t, n]) => [t, F(n, e)]));
21
+ }
22
+ function F(e, t) {
23
+ let n = e.encoder(t);
24
+ return e.transform ? e.transform(n) : "" + n;
25
+ }
26
+ //#endregion
27
+ //#region ../core/src/rendering/svg/renderers/arrow.js
28
+ function le(e, t) {
29
+ let n = e, { coords: r, data: i, group: a, viewOpacity: o, visibleBounds: s } = t, c = n.encoders, l = P(a, {
30
+ fill: {
31
+ encoder: c.fill,
32
+ transform: f
33
+ },
34
+ "fill-opacity": {
35
+ encoder: c.fillOpacity,
36
+ transform: (e) => +e * o
37
+ },
38
+ stroke: {
39
+ encoder: c.stroke,
40
+ transform: f
41
+ },
42
+ "stroke-opacity": {
43
+ encoder: c.strokeOpacity,
44
+ transform: (e) => +e * o
45
+ },
46
+ "stroke-width": {
47
+ encoder: c.strokeWidth,
48
+ transform: (e) => j(+e)
49
+ }
50
+ });
51
+ a.setAttribute("stroke-linejoin", "miter");
52
+ let u = C(n);
53
+ return v(n, u, {
54
+ coords: r,
55
+ data: i,
56
+ visibleBounds: s,
57
+ viewOpacity: o,
58
+ countOnly: t.countOnly
59
+ }, (e) => {
60
+ t.countOnly || (e.headShapeFallback && t.warn(`SVG export rendered unsupported arrow headShape "${u.headShape}" as a triangle.`), a.appendChild(N("path", {
61
+ d: e.boundaryLoops.map(ue).join(" "),
62
+ ...l(e.datum)
63
+ })));
64
+ });
65
+ }
66
+ function ue(e) {
67
+ return `M ${e.map(de).join(" L ")} Z`;
68
+ }
69
+ function de(e) {
70
+ return `${j(e.x)} ${j(e.y)}`;
71
+ }
72
+ //#endregion
73
+ //#region ../core/src/rendering/svg/renderers/link.js
74
+ function fe(e, t) {
75
+ let n = e, r = n.properties, i = g(n, r.arcFadingDistance), a = ne(n), { coords: o, data: s, group: c, viewOpacity: l, visibleBounds: u } = t, d = n.encoders, p = g(n, r.noFadingOnPointSelection) ? pe(n, d) : [], m = P(c, {
76
+ stroke: {
77
+ encoder: d.color,
78
+ transform: f
79
+ },
80
+ "stroke-opacity": {
81
+ encoder: d.opacity,
82
+ transform: (e) => +e * l
83
+ },
84
+ "stroke-width": {
85
+ encoder: d.size,
86
+ transform: (e) => j(+e)
87
+ }
88
+ });
89
+ return c.setAttribute("fill", "none"), c.setAttribute("stroke-linecap", "butt"), D(n, a, {
90
+ coords: o,
91
+ data: s,
92
+ visibleBounds: u
93
+ }, ({ datum: e, points: n }) => {
94
+ let [r, o, s, l] = n;
95
+ if (t.countOnly) return;
96
+ let u = m(e);
97
+ if (a.shape == "arc" && i !== !1 && i[0] > 0 && i[1] > 0 && !me(e, p)) {
98
+ let e = t.getLinkArcFadeMaskUrl({
99
+ p1: r,
100
+ p4: l,
101
+ distances: i
102
+ });
103
+ e && (u.mask = e);
104
+ }
105
+ c.appendChild(N("path", {
106
+ d: `M ${I(r)} C ${I(o)} ${I(s)} ${I(l)}`,
107
+ ...u
108
+ }));
109
+ });
110
+ }
111
+ function pe(t, r) {
112
+ let i = new Set(Object.values(r).flatMap((e) => e.branches).map((e) => e.predicate?.param).filter((e) => e));
113
+ return Array.from(i).map((e) => t.unitView.paramRuntime.findValue(e)).filter((t) => t && (n(t) || e(t)));
114
+ }
115
+ function me(e, t) {
116
+ let i = e[r];
117
+ return t.some((e) => n(e) ? e.uniqueId != null && e.uniqueId == i : e.data.has(i));
118
+ }
119
+ function I(e) {
120
+ return e.map(j).join(" ");
121
+ }
122
+ //#endregion
123
+ //#region ../core/src/rendering/svg/renderers/point.js
124
+ function he(e, t) {
125
+ let n = e;
126
+ g(n, n.properties.fillGradientStrength) && t.warn("SVG export ignored unsupported point property fillGradientStrength."), n.properties.geometricZoomBound && t.warn("SVG export ignored unsupported point property geometricZoomBound.");
127
+ let r = x(n), { inwardStroke: i } = r, { group: a, viewOpacity: o } = t, s = n.encoders, c = P(a, {
128
+ fill: {
129
+ encoder: s.fill,
130
+ transform: f
131
+ },
132
+ "fill-opacity": {
133
+ encoder: s.fillOpacity,
134
+ transform: (e) => +e * o
135
+ },
136
+ stroke: {
137
+ encoder: s.stroke,
138
+ transform: f
139
+ },
140
+ "stroke-opacity": {
141
+ encoder: s.strokeOpacity,
142
+ transform: (e) => +e * o
143
+ },
144
+ "stroke-width": {
145
+ encoder: s.strokeWidth,
146
+ transform: (e) => j(+e)
147
+ }
148
+ }), l = R();
149
+ return S(n, r, t, (e) => {
150
+ if (t.countOnly) return;
151
+ let { datum: n, shape: r, x: u, y: d, geometryRadius: f, angle: p, strokeWidth: m, lineShape: h } = e, g = {
152
+ ...c(n),
153
+ ...i && !h ? { "stroke-width": j(m) } : {},
154
+ ...h ? ge(s, n, o) : {}
155
+ }, _ = L(r, u, d, f, g, l);
156
+ _ ? (p && _.setAttribute("transform", `rotate(${j(p)} ${j(u)} ${j(d)})`), a.appendChild(_)) : (t.warn(`SVG export rendered unsupported point shape "${r}" as a circle.`), a.appendChild(N("circle", {
157
+ cx: j(u),
158
+ cy: j(d),
159
+ r: j(f),
160
+ ...g
161
+ })));
162
+ });
163
+ }
164
+ function L(e, t, n, r, i, a) {
165
+ let o = j(t), s = j(n), c = j(r);
166
+ if (e == "circle") return N("circle", {
167
+ cx: o,
168
+ cy: s,
169
+ r: c,
170
+ ...i
171
+ });
172
+ if (e == "square") return N("rect", {
173
+ x: j(t - r),
174
+ y: j(n - r),
175
+ width: j(r * 2),
176
+ height: j(r * 2),
177
+ ...i
178
+ });
179
+ let l = a.build(e, t, n, r);
180
+ return l ? N("path", {
181
+ d: l,
182
+ ...i
183
+ }) : void 0;
184
+ }
185
+ function R() {
186
+ let e = "", t = (e, t) => `${j(e)} ${j(t)}`, n = {
187
+ moveTo(n, r) {
188
+ e += `${e ? " M" : "M"} ${t(n, r)}`;
189
+ },
190
+ lineTo(n, r) {
191
+ e += ` L ${t(n, r)}`;
192
+ },
193
+ closePath() {
194
+ e += " Z";
195
+ }
196
+ };
197
+ return { build(t, r, i, a) {
198
+ return e = "", oe(t, r, i, a, n) ? e : void 0;
199
+ } };
200
+ }
201
+ function ge(e, t, n) {
202
+ let r = e.stroke(t), i = k(e.strokeOpacity, t), a = r == null || i <= 0;
203
+ return {
204
+ fill: "none",
205
+ stroke: f(a ? e.fill(t) : r),
206
+ "stroke-opacity": (a ? k(e.fillOpacity, t) : i) * n,
207
+ "stroke-width": j(k(e.strokeWidth, t)),
208
+ "stroke-linecap": "butt"
209
+ };
210
+ }
211
+ //#endregion
212
+ //#region ../core/src/rendering/svg/renderers/rect.js
213
+ function _e(e, t) {
214
+ let n = e, r = b(n), { shadow: i, hatch: a } = r, { group: o, viewOpacity: s } = t, c = n.encoders, l = P(o, {
215
+ fill: {
216
+ encoder: c.fill,
217
+ transform: f
218
+ },
219
+ "fill-opacity": {
220
+ encoder: c.fillOpacity,
221
+ transform: (e) => +e * s
222
+ },
223
+ stroke: {
224
+ encoder: c.stroke,
225
+ transform: f
226
+ },
227
+ "stroke-opacity": {
228
+ encoder: c.strokeOpacity,
229
+ transform: (e) => +e * s
230
+ },
231
+ "stroke-width": {
232
+ encoder: c.strokeWidth,
233
+ transform: (e) => j(+e)
234
+ }
235
+ }), u = i.opacity > 0 ? {
236
+ fill: i.color,
237
+ "fill-opacity": 1,
238
+ stroke: i.color,
239
+ "stroke-opacity": 1,
240
+ opacity: A(i.opacity * s),
241
+ filter: t.getShadowFilterUrl(i)
242
+ } : null;
243
+ return E(n, r, t, (e) => {
244
+ if (t.countOnly) return;
245
+ let { datum: n, x: r, y: i, width: d, height: p, radii: m, opacityFactor: h, strokeWidth: g, fill: _, fillOpacity: v } = e, y = {
246
+ ...l(n),
247
+ ...h == 1 ? {} : { opacity: A(h) }
248
+ };
249
+ if (a != "none" && g > 0 && (y.fill = t.getRectHatchPatternUrl({
250
+ type: a,
251
+ fill: f(c.fill(n)),
252
+ fillOpacity: k(c.fillOpacity, n) * s,
253
+ stroke: f(c.stroke(n)),
254
+ strokeOpacity: k(c.strokeOpacity, n) * s,
255
+ strokeWidth: g
256
+ }), y["fill-opacity"] = 1), u) {
257
+ let e = z(r, i, d, p, m, {
258
+ ...u,
259
+ "stroke-width": j(g)
260
+ });
261
+ if (a == "none" && _ != "none" && v == 1 && h == 1) o.appendChild(e);
262
+ else {
263
+ let n = g / 2, a = Object.fromEntries(Object.entries(m).map(([e, t]) => [e, t + n])), s = B(r - n, i - n, d + n * 2, p + n * 2, a), c = N("g", { "clip-path": t.getShadowClipPathUrl(s) });
264
+ c.appendChild(e), o.appendChild(c);
265
+ }
266
+ }
267
+ o.appendChild(z(r, i, d, p, m, y));
268
+ });
269
+ }
270
+ function z(e, t, n, r, i, a) {
271
+ if (ve(i)) {
272
+ let o = i.topLeft, s = j(e), c = j(t), l = j(e + n), u = j(t + r);
273
+ return N("rect", {
274
+ x: s,
275
+ y: c,
276
+ width: j(l - s),
277
+ height: j(u - c),
278
+ ...o ? {
279
+ rx: j(o),
280
+ ry: j(o)
281
+ } : {},
282
+ ...a
283
+ });
284
+ } else return N("path", {
285
+ d: B(e, t, n, r, i),
286
+ ...a
287
+ });
288
+ }
289
+ function ve(e) {
290
+ return Object.values(e).every((t) => t == e.topLeft);
291
+ }
292
+ function B(e, t, n, r, i) {
293
+ let a = e + n, o = t + r, { topLeft: s, topRight: c, bottomRight: l, bottomLeft: u } = i;
294
+ return [
295
+ `M ${H(e + s, t)}`,
296
+ `H ${j(a - c)}`,
297
+ V(c, a, t + c, a, t),
298
+ `V ${j(o - l)}`,
299
+ V(l, a - l, o, a, o),
300
+ `H ${j(e + u)}`,
301
+ V(u, e, o - u, e, o),
302
+ `V ${j(t + s)}`,
303
+ V(s, e + s, t, e, t),
304
+ "Z"
305
+ ].join(" ");
306
+ }
307
+ function V(e, t, n, r, i) {
308
+ return e ? `A ${j(e)} ${j(e)} 0 0 1 ${H(t, n)}` : `L ${H(r, i)}`;
309
+ }
310
+ function H(e, t) {
311
+ return `${j(e)} ${j(t)}`;
312
+ }
313
+ //#endregion
314
+ //#region ../core/src/rendering/svg/renderers/rule.js
315
+ function U(e, t) {
316
+ let n = e, r = te(n), { coords: i, data: a, group: o, viewOpacity: s, visibleBounds: c } = t, l = n.encoders, u = n.properties.strokeDash, d = P(o, {
317
+ stroke: {
318
+ encoder: l.color,
319
+ transform: f
320
+ },
321
+ "stroke-opacity": {
322
+ encoder: l.opacity,
323
+ transform: (e) => +e * s
324
+ },
325
+ "stroke-width": {
326
+ encoder: l.size,
327
+ transform: (e) => j(+e)
328
+ }
329
+ });
330
+ return o.setAttribute("stroke-linecap", "" + n.properties.strokeCap), u && (o.setAttribute("stroke-dasharray", u.map(j).join(" ")), o.setAttribute("stroke-dashoffset", "" + j(n.properties.strokeDashOffset))), ie(n, r, {
331
+ coords: i,
332
+ data: a,
333
+ visibleBounds: c
334
+ }, (e) => {
335
+ t.countOnly || o.appendChild(N("line", {
336
+ x1: j(e.x1),
337
+ y1: j(e.y1),
338
+ x2: j(e.x2),
339
+ y2: j(e.y2),
340
+ ...d(e.datum)
341
+ }));
342
+ });
343
+ }
344
+ //#endregion
345
+ //#region ../core/src/rendering/svg/renderers/text.js
346
+ function ye(e, t) {
347
+ let n = e, r = n.properties, i = w(n), { coords: a, data: o, group: s, viewOpacity: c, visibleBounds: l, anchorCullBounds: u } = t, d = n.encoders, p = P(s, {
348
+ fill: {
349
+ encoder: d.color,
350
+ transform: f
351
+ },
352
+ "fill-opacity": {
353
+ encoder: d.opacity,
354
+ transform: (e) => +e * c
355
+ },
356
+ "font-size": {
357
+ encoder: d.size,
358
+ transform: (e) => j(+e)
359
+ }
360
+ });
361
+ s.setAttribute("font-family", ae(r.font)), s.setAttribute("font-style", r.fontStyle ?? "normal"), s.setAttribute("font-weight", "" + re(r.fontWeight ?? "normal")), s.setAttribute("text-anchor", W[i.align]);
362
+ let m = {
363
+ top: {
364
+ width: g(n, r.viewportEdgeFadeWidthTop),
365
+ distance: g(n, r.viewportEdgeFadeDistanceTop)
366
+ },
367
+ right: {
368
+ width: g(n, r.viewportEdgeFadeWidthRight),
369
+ distance: g(n, r.viewportEdgeFadeDistanceRight)
370
+ },
371
+ bottom: {
372
+ width: g(n, r.viewportEdgeFadeWidthBottom),
373
+ distance: g(n, r.viewportEdgeFadeDistanceBottom)
374
+ },
375
+ left: {
376
+ width: g(n, r.viewportEdgeFadeWidthLeft),
377
+ distance: g(n, r.viewportEdgeFadeDistanceLeft)
378
+ }
379
+ }, h = y(n, i, {
380
+ coords: a,
381
+ data: o,
382
+ visibleBounds: l,
383
+ anchorCullBounds: u
384
+ }, (e) => {
385
+ if (t.countOnly) return;
386
+ if (e.logoScale) {
387
+ e.multiCharacterLogo && t.warn("SVG export stretches multi-character logo text as a single glyph cell.");
388
+ let n = [`translate(${j(e.x)} ${j(e.y)})`];
389
+ e.angle && n.push(`rotate(${j(e.angle)})`), (e.dx || e.dy) && n.push(`translate(${j(e.dx)} ${j(e.dy)})`), n.push(`scale(${j(e.logoScale.width)} ${j(e.logoScale.heightScale)})`);
390
+ let r = N("text", {
391
+ x: 0,
392
+ y: 0,
393
+ dy: O("middle", 1),
394
+ "text-anchor": "middle",
395
+ lengthAdjust: "spacingAndGlyphs",
396
+ textLength: 1,
397
+ transform: n.join(" "),
398
+ ...p(e.datum),
399
+ "font-size": 1
400
+ });
401
+ r.textContent = e.text, s.appendChild(r);
402
+ return;
403
+ }
404
+ let n = j(e.x), r = j(e.y), a = N("text", {
405
+ x: n,
406
+ y: r,
407
+ dx: j(e.dx),
408
+ dy: j(e.dy + O(i.baseline, e.size)),
409
+ lengthAdjust: "spacingAndGlyphs",
410
+ textLength: j(e.width),
411
+ ...p(e.datum),
412
+ ...e.scale == 1 ? {} : { "font-size": j(e.size) },
413
+ ...e.fadeOpacity == 1 ? {} : { opacity: A(e.fadeOpacity) }
414
+ });
415
+ a.textContent = e.text, e.angle && a.setAttribute("transform", `rotate(${j(e.angle)} ${n} ${r})`), s.appendChild(a);
416
+ });
417
+ if (!t.countOnly && s.childElementCount > 0) {
418
+ let e = t.getViewportEdgeFadeMaskUrl(m);
419
+ e && s.setAttribute("mask", e);
420
+ }
421
+ return h;
422
+ }
423
+ var W = {
424
+ left: "start",
425
+ center: "middle",
426
+ right: "end"
427
+ }, G = 64;
428
+ function be(e, t) {
429
+ let n = Se(e.unitView);
430
+ if (!n) return;
431
+ let r = e.unitView.getScaleResolution(n.channel)?.getScale();
432
+ if (!r || !o(r.type)) return;
433
+ let { coords: i, data: a, group: s, viewOpacity: c, visibleBounds: l } = t;
434
+ if (!a.length) return 0;
435
+ let u = e.encoders, d = n.channel == "stroke" ? u.stroke : u.fill, m = Ce(e.unitView.spec.encoding.x), h = Infinity, g = Infinity, _ = -Infinity, v = -Infinity, y = a.map((e) => {
436
+ let [t, n] = ee(i, u, e), [r, a] = ce(i, u, e);
437
+ return h = Math.min(h, t, n), g = Math.min(g, r, a), _ = Math.max(_, t, n), v = Math.max(v, r, a), {
438
+ offset: Number(e.position),
439
+ color: f(d(e))
440
+ };
441
+ }).sort((e, t) => e.offset - t.offset);
442
+ if (!p(l, h, g, _, v)) return 0;
443
+ if (t.countOnly) return a.length;
444
+ let b = xe(y), x = [
445
+ {
446
+ offset: 0,
447
+ color: b[0].color
448
+ },
449
+ ...b,
450
+ {
451
+ offset: 1,
452
+ color: b.at(-1).color
453
+ }
454
+ ], S = t.getLegendGradientUrl({
455
+ x1: h,
456
+ y1: m ? g : v,
457
+ x2: m ? _ : h,
458
+ y2: g,
459
+ stops: x
460
+ }), C = j(h), w = j(g), T = j(_), E = j(v), D = Number(u.fillOpacity(a[0])) * c;
461
+ return s.appendChild(N("rect", {
462
+ x: C,
463
+ y: w,
464
+ width: j(T - C),
465
+ height: j(E - w),
466
+ fill: S,
467
+ "fill-opacity": A(D),
468
+ stroke: "none"
469
+ })), a.length;
470
+ }
471
+ function xe(e) {
472
+ return e.length <= G ? e : Array.from({ length: G }, (t, n) => e[Math.round(n * (e.length - 1) / (G - 1))]);
473
+ }
474
+ function Se(e) {
475
+ let t = e;
476
+ for (; t;) {
477
+ let e = t.spec.data;
478
+ if (e) return "lazy" in e && e.lazy.type == "legendGradient" ? e.lazy : void 0;
479
+ t = t.dataParent;
480
+ }
481
+ }
482
+ function Ce(e) {
483
+ return e != null && "field" in e && (e.field == "position0" || e.field == "position1");
484
+ }
485
+ //#endregion
486
+ //#region ../core/src/rendering/svg/renderers/index.js
487
+ var we = /* @__PURE__ */ new Map([
488
+ ["arrow", le],
489
+ ["link", fe],
490
+ ["point", he],
491
+ ["rect", _e],
492
+ ["rule", U],
493
+ ["text", ye],
494
+ ["tick", U]
495
+ ]);
496
+ function Te(e, t) {
497
+ if (e.getType() == "rect") {
498
+ let n = be(e, t);
499
+ if (n !== void 0) return n;
500
+ }
501
+ let n = we.get(e.getType());
502
+ if (!n) throw Error(`SVG rendering is not implemented for mark type "${e.getType()}". View: ${e.unitView.getPathString()}`);
503
+ return n(e, t);
504
+ }
505
+ //#endregion
506
+ //#region ../core/src/rendering/svg/rectHatchPattern.js
507
+ function Ee(e, t) {
508
+ let n = t.strokeWidth, r = [
509
+ "dots",
510
+ "rings",
511
+ "ringsLarge"
512
+ ].includes(t.type), i = [
513
+ "diagonal",
514
+ "antiDiagonal",
515
+ "cross"
516
+ ].includes(t.type), a = [
517
+ "vertical",
518
+ "horizontal",
519
+ "grid"
520
+ ].includes(t.type), o = r ? n * 7 : n * (i ? 6 : 4), s = a ? n * 2 : n, c = o, l = r ? o * 2 : o, u = N("pattern", {
521
+ id: e,
522
+ x: 0,
523
+ y: 0,
524
+ width: j(c),
525
+ height: j(l),
526
+ patternUnits: "userSpaceOnUse"
527
+ });
528
+ u.appendChild(N("rect", {
529
+ width: j(c),
530
+ height: j(l),
531
+ fill: t.fill,
532
+ "fill-opacity": A(t.fillOpacity)
533
+ }));
534
+ let d = N("g", {
535
+ fill: "none",
536
+ stroke: t.stroke,
537
+ "stroke-opacity": A(t.strokeOpacity),
538
+ "stroke-width": j(s),
539
+ "stroke-linecap": "square"
540
+ });
541
+ return De(d, t.type, o, s), u.appendChild(d), u;
542
+ }
543
+ function De(e, t, n, r) {
544
+ let i = (t) => e.appendChild(N("path", { d: t })), a = (e) => j(e), o = (e) => {
545
+ for (let t of [
546
+ -n,
547
+ 0,
548
+ n
549
+ ]) i(`M ${a(t - r)} ${a(e ? -r : n + r)} L ${a(t + n + r)} ${a(e ? n + r : -r)}`);
550
+ };
551
+ switch (t) {
552
+ case "diagonal":
553
+ o(!0);
554
+ break;
555
+ case "antiDiagonal":
556
+ o(!1);
557
+ break;
558
+ case "cross":
559
+ o(!0), o(!1);
560
+ break;
561
+ case "vertical":
562
+ i(`M 0 ${a(-r)} V ${a(n + r)}`);
563
+ break;
564
+ case "horizontal":
565
+ i(`M ${a(-r)} 0 H ${a(n + r)}`);
566
+ break;
567
+ case "grid":
568
+ i(`M 0 ${a(-r)} V ${a(n + r)} M ${a(-r)} 0 H ${a(n + r)}`);
569
+ break;
570
+ case "dots":
571
+ case "rings":
572
+ case "ringsLarge": {
573
+ let r = n * (t == "dots" ? .07 : t == "rings" ? .2 : .35), i = (t, n) => e.appendChild(N("circle", {
574
+ cx: j(t),
575
+ cy: j(n),
576
+ r: j(r)
577
+ }));
578
+ i(n / 2, 0), i(n / 2, n * 2), i(0, n), i(n, n);
579
+ break;
580
+ }
581
+ default: throw Error(`Unknown rectangle hatch pattern: ${t}`);
582
+ }
583
+ }
584
+ //#endregion
585
+ //#region ../core/src/rendering/svg/linkArcFadeMask.js
586
+ var K = 4;
587
+ function Oe(e, t, n) {
588
+ let r = t[0] - e[0], i = t[1] - e[1], a = Math.hypot(r, i);
589
+ if (a == 0) return;
590
+ let o = -i / a, s = r / a;
591
+ (o < 0 || o == 0 && s < 0) && (o = -o, s = -s);
592
+ let c = o * e[0] + s * e[1], [l, u] = n, d = JSON.stringify([
593
+ q(o, 6),
594
+ q(s, 6),
595
+ q(c, 1),
596
+ q(l, 1),
597
+ q(u, 1)
598
+ ]);
599
+ return {
600
+ normalX: o,
601
+ normalY: s,
602
+ offset: c,
603
+ start: l,
604
+ end: u,
605
+ key: d
606
+ };
607
+ }
608
+ function ke(e, t, n, r) {
609
+ let { normalX: i, normalY: a, offset: o, start: s, end: c } = r, l = i * o, u = a * o, d = e + "-gradient", f = N("linearGradient", {
610
+ id: d,
611
+ gradientUnits: "userSpaceOnUse",
612
+ x1: j(l - i * c),
613
+ y1: j(u - a * c),
614
+ x2: j(l + i * c),
615
+ y2: j(u + a * c),
616
+ spreadMethod: "pad"
617
+ });
618
+ for (let { offset: e, opacity: t } of Ae(s, c)) f.appendChild(N("stop", {
619
+ offset: q(e, 3),
620
+ "stop-color": "white",
621
+ "stop-opacity": q(t, 3)
622
+ }));
623
+ let p = N("mask", {
624
+ id: e,
625
+ x: 0,
626
+ y: 0,
627
+ width: j(t),
628
+ height: j(n),
629
+ maskUnits: "userSpaceOnUse",
630
+ maskContentUnits: "userSpaceOnUse",
631
+ "mask-type": "luminance"
632
+ });
633
+ return p.appendChild(N("rect", {
634
+ width: j(t),
635
+ height: j(n),
636
+ fill: `url(#${d})`
637
+ })), {
638
+ gradient: f,
639
+ mask: p
640
+ };
641
+ }
642
+ function Ae(e, t) {
643
+ let n = [], r = (r) => {
644
+ for (let i = 0; i <= K; i++) {
645
+ let a = i / K, o = r ? t + (e - t) * a : e + (t - e) * a, s = r ? (t - o) / (2 * t) : (t + o) / (2 * t), c = (o - e) / (t - e);
646
+ n.push({
647
+ offset: s,
648
+ opacity: 1 - je(c)
649
+ });
650
+ }
651
+ };
652
+ return r(!0), r(!1), n;
653
+ }
654
+ function je(e) {
655
+ let t = Math.max(0, Math.min(1, e));
656
+ return t * t * (3 - 2 * t);
657
+ }
658
+ function q(e, t) {
659
+ let n = 10 ** t;
660
+ return Math.round(e * n) / n;
661
+ }
662
+ //#endregion
663
+ //#region ../core/src/rendering/svg/svgViewRenderingContext.js
664
+ var J = class extends u {
665
+ #e;
666
+ #t;
667
+ #n = [];
668
+ #r = /* @__PURE__ */ new Map();
669
+ #i = /* @__PURE__ */ new WeakMap();
670
+ #a = /* @__PURE__ */ new Map();
671
+ #o = /* @__PURE__ */ new Map();
672
+ #s = /* @__PURE__ */ new Map();
673
+ #c = /* @__PURE__ */ new Map();
674
+ #l = /* @__PURE__ */ new Set();
675
+ #u = !1;
676
+ #d = /* @__PURE__ */ new Map();
677
+ #f = new h();
678
+ #p = N("g");
679
+ #m;
680
+ #h;
681
+ #g = [];
682
+ #_;
683
+ #v = 0;
684
+ #y = 0;
685
+ #b = 0;
686
+ #x = 0;
687
+ #S = 0;
688
+ #C = 0;
689
+ #w = 0;
690
+ constructor(e, t) {
691
+ super(e), this.width = t.width, this.height = t.height, this.#h = t.maxVectorInstances;
692
+ let n = j(t.width), r = j(t.height);
693
+ this.#e = N("svg", {
694
+ xmlns: M,
695
+ width: n,
696
+ height: r,
697
+ viewBox: `0 0 ${n} ${r}`
698
+ }), this.#t = N("defs"), this.#e.appendChild(this.#t), t.background != null && this.#e.appendChild(N("rect", {
699
+ width: n,
700
+ height: r,
701
+ fill: t.background,
702
+ "data-export-background": ""
703
+ }));
704
+ }
705
+ beginInstanceCounting() {
706
+ if (this.#n.length || this.#u) throw Error("Cannot start SVG instance counting during traversal.");
707
+ this.#d = /* @__PURE__ */ new Map(), this.#u = !0;
708
+ }
709
+ endInstanceCounting() {
710
+ if (this.#n.length || !this.#u) throw Error("SVG instance counting is not active or traversal is incomplete.");
711
+ this.#u = !1;
712
+ }
713
+ getVisibleInstanceCount(e) {
714
+ return this.#d.get(e) ?? 0;
715
+ }
716
+ getVisibleInstanceCounts() {
717
+ return new Map(this.#d);
718
+ }
719
+ getRasterRuns() {
720
+ this.#E();
721
+ for (let e of this.#g) e.image || this.#D(e);
722
+ return this.#g;
723
+ }
724
+ beginSampleFacetBatch() {
725
+ if (this.#m) throw Error("Nested sample facet batches are not supported.");
726
+ this.#m = {
727
+ viewGroups: /* @__PURE__ */ new WeakMap(),
728
+ markGroups: /* @__PURE__ */ new WeakMap(),
729
+ markGroupElements: /* @__PURE__ */ new Set(),
730
+ rasterRuns: /* @__PURE__ */ new WeakMap()
731
+ };
732
+ }
733
+ endSampleFacetBatch() {
734
+ let e = this.#m;
735
+ if (!e) throw Error("No sample facet batch is active.");
736
+ for (let t of e.markGroupElements) t.childElementCount || t.remove();
737
+ this.#m = void 0;
738
+ }
739
+ pushView(e, n) {
740
+ let r = e.getPathString();
741
+ if (t(this.#n)?.exportExcluded || s(e) && e.name.startsWith("scrollbar-")) {
742
+ this.#n.push({
743
+ view: e,
744
+ node: this.currentNode,
745
+ coords: n,
746
+ exportExcluded: !0
747
+ });
748
+ return;
749
+ }
750
+ if (this.#u) {
751
+ this.#n.push({
752
+ view: e,
753
+ node: this.currentNode,
754
+ coords: n,
755
+ exportExcluded: !1
756
+ });
757
+ return;
758
+ }
759
+ let i = this.#m, a = i?.viewGroups.get(e);
760
+ if (a) {
761
+ if (a.parentNode !== this.currentNode) throw Error(`Sample-faceted view was rendered under multiple parents: ${r}`);
762
+ } else {
763
+ a = N("g", {
764
+ id: Me(e.name, this.#v++),
765
+ "data-name": e.name,
766
+ "data-view-path": r
767
+ });
768
+ let t = N("title");
769
+ t.textContent = r, a.appendChild(t), this.currentNode.appendChild(a), i?.viewGroups.set(e, a);
770
+ }
771
+ this.#n.push({
772
+ view: e,
773
+ node: a,
774
+ coords: n,
775
+ exportExcluded: !1
776
+ });
777
+ }
778
+ popView(e) {
779
+ if (this.#n.pop()?.view !== e) throw Error("Unbalanced SVG view rendering context stack.");
780
+ }
781
+ renderMark(e, n) {
782
+ if (t(this.#n)?.exportExcluded || e.unitView.getEffectiveOpacity() <= 0) return;
783
+ let r = i(n), o = a(r, e.properties.clip, this.currentCoords), s = _(this.width, this.height, o);
784
+ if (!m(s)) return;
785
+ let c = this.getVisibleInstanceCount(e);
786
+ if (!this.#u && this.#h != null && c == 0) return;
787
+ if (!this.#u && this.#h != null && c > this.#h) {
788
+ this.#T(e, s);
789
+ return;
790
+ }
791
+ let l = !this.#u && this.#m != null, u = l ? this.getClipPathUrl(o) : void 0, d = l ? this.#m.markGroups.get(e)?.get(u ?? "") : void 0;
792
+ !this.#u && !d && this.#E();
793
+ let f = this.#u ? this.#p : this.#O(e, u), p = se(this.currentCoords, r, e.properties.cullByVisibleRange);
794
+ if (T(e, n, this.currentCoords, this.#f, (t, n) => {
795
+ let r = Te(e, {
796
+ coords: t,
797
+ data: n,
798
+ group: f,
799
+ visibleBounds: s,
800
+ anchorCullBounds: p,
801
+ viewOpacity: e.unitView.getEffectiveOpacity(),
802
+ countOnly: this.#u,
803
+ getViewportEdgeFadeMaskUrl: (e) => this.#u ? void 0 : this.getViewportEdgeFadeMaskUrl(e),
804
+ getShadowFilterUrl: (e) => this.#u ? "" : this.getShadowFilterUrl(e),
805
+ getShadowClipPathUrl: (e) => this.#u ? "" : this.getShadowClipPathUrl(e),
806
+ getRectHatchPatternUrl: (e) => this.#u ? "" : this.getRectHatchPatternUrl(e),
807
+ getLinkArcFadeMaskUrl: (e) => this.#u ? void 0 : this.getLinkArcFadeMaskUrl(e),
808
+ getLegendGradientUrl: (e) => this.#u ? "" : this.getLegendGradientUrl(e),
809
+ warn: (t) => {
810
+ this.#u || this.#l.add(`${t} View: ${e.unitView.getPathString()}`);
811
+ }
812
+ });
813
+ this.#u && this.#d.set(e, this.getVisibleInstanceCount(e) + r);
814
+ }, (t) => this.#l.add(`SVG export could not resolve sample facet index ${t}. View: ${e.unitView.getPathString()}`)), !this.#u && !l && f.childElementCount > 0) {
815
+ let e = this.getClipPathUrl(o);
816
+ e && f.setAttribute("clip-path", e), this.currentNode.appendChild(f);
817
+ }
818
+ }
819
+ #T(e, t) {
820
+ let n = this.#m?.rasterRuns.get(e);
821
+ if (n) {
822
+ Y(n.bounds, t), n.viewNodes.add(this.currentNode);
823
+ return;
824
+ }
825
+ let r = this.#_;
826
+ if (r) Y(r.bounds, t);
827
+ else {
828
+ let e = document.createComment("raster-run");
829
+ this.currentNode.appendChild(e), r = {
830
+ marks: /* @__PURE__ */ new Set(),
831
+ targets: [],
832
+ viewNodes: /* @__PURE__ */ new Set(),
833
+ anchor: e,
834
+ bounds: { ...t },
835
+ image: void 0
836
+ }, this.#_ = r;
837
+ }
838
+ r.marks.add(e), r.targets.push({
839
+ mark: e,
840
+ instanceCount: this.getVisibleInstanceCount(e)
841
+ }), r.viewNodes.add(this.currentNode), this.#m?.rasterRuns.set(e, r);
842
+ }
843
+ #E() {
844
+ let e = this.#_;
845
+ e && (this.#g.push(e), this.#_ = void 0);
846
+ }
847
+ #D(e) {
848
+ let t = Ne(e.viewNodes), n = e.targets.map((e) => e.mark.getType()), r = N("g", {
849
+ id: `rasterized-${n.join("-")}-${this.#w++}`,
850
+ "data-name": `Rasterized ${n.join(", ")}`,
851
+ "data-rasterized": ""
852
+ }), i = N("image", { preserveAspectRatio: "none" });
853
+ r.appendChild(i);
854
+ let a = e.anchor.parentNode;
855
+ t == a ? t.insertBefore(r, e.anchor) : t.insertBefore(r, Pe(a, t)), e.anchor.remove();
856
+ for (let n of e.viewNodes) Fe(n, t);
857
+ e.image = i;
858
+ }
859
+ #O(e, t) {
860
+ let n = this.#m;
861
+ if (!n) return N("g", { "data-mark-type": e.getType() });
862
+ let r = n.markGroups.get(e);
863
+ r || (r = /* @__PURE__ */ new Map(), n.markGroups.set(e, r));
864
+ let i = t ?? "", a = r.get(i);
865
+ if (a) {
866
+ if (a.parentNode !== this.currentNode) throw Error(`Sample-faceted mark was rendered under multiple parents: ${e.unitView.getPathString()}`);
867
+ } else a = N("g", { "data-mark-type": e.getType() }), t && a.setAttribute("clip-path", t), this.currentNode.appendChild(a), r.set(i, a), n.markGroupElements.add(a);
868
+ return a;
869
+ }
870
+ getClipPathUrl(e) {
871
+ if (!e) return;
872
+ let t = e.rect.flatten(), n = [
873
+ e.clipX ? t.x : 0,
874
+ e.clipY ? t.y : 0,
875
+ e.clipX ? t.width : this.width,
876
+ e.clipY ? t.height : this.height
877
+ ].map(j), r = n.join(","), i = this.#r.get(r);
878
+ if (!i) {
879
+ i = "clip-" + this.#y++;
880
+ let e = N("clipPath", {
881
+ id: i,
882
+ clipPathUnits: "userSpaceOnUse"
883
+ });
884
+ e.appendChild(N("rect", {
885
+ x: n[0],
886
+ y: n[1],
887
+ width: n[2],
888
+ height: n[3]
889
+ })), this.#t.appendChild(e), this.#r.set(r, i);
890
+ }
891
+ return `url(#${i})`;
892
+ }
893
+ getShadowFilterUrl(e) {
894
+ let t = j(Math.max(e.blur / 2.5, .25)), n = j(e.offsetX), r = j(e.offsetY), i = [
895
+ t,
896
+ n,
897
+ r
898
+ ].join(","), a = this.#a.get(i);
899
+ if (!a) {
900
+ a = "shadow-" + this.#x++;
901
+ let e = N("filter", {
902
+ id: a,
903
+ x: 0,
904
+ y: 0,
905
+ width: j(this.width),
906
+ height: j(this.height),
907
+ filterUnits: "userSpaceOnUse",
908
+ primitiveUnits: "userSpaceOnUse",
909
+ "color-interpolation-filters": "sRGB"
910
+ });
911
+ e.appendChild(N("feGaussianBlur", {
912
+ in: "SourceGraphic",
913
+ stdDeviation: t,
914
+ result: "blur"
915
+ })), e.appendChild(N("feOffset", {
916
+ in: "blur",
917
+ dx: n,
918
+ dy: r,
919
+ result: "offsetBlur"
920
+ })), this.#t.appendChild(e), this.#a.set(i, a);
921
+ }
922
+ return `url(#${a})`;
923
+ }
924
+ getShadowClipPathUrl(e) {
925
+ let t = this.#o.get(e);
926
+ if (!t) {
927
+ t = "shadow-clip-" + this.#y++;
928
+ let n = N("clipPath", {
929
+ id: t,
930
+ clipPathUnits: "userSpaceOnUse"
931
+ });
932
+ n.appendChild(N("path", {
933
+ d: `M 0 0 V ${j(this.height)} H ${j(this.width)} V 0 Z ${e}`,
934
+ "clip-rule": "evenodd",
935
+ "fill-rule": "evenodd"
936
+ })), this.#t.appendChild(n), this.#o.set(e, t);
937
+ }
938
+ return `url(#${t})`;
939
+ }
940
+ getRectHatchPatternUrl(e) {
941
+ let t = JSON.stringify([
942
+ e.type,
943
+ e.fill,
944
+ A(e.fillOpacity),
945
+ e.stroke,
946
+ A(e.strokeOpacity),
947
+ A(e.strokeWidth)
948
+ ]), n = this.#s.get(t);
949
+ return n || (n = "rect-hatch-" + this.#S++, this.#t.appendChild(Ee(n, e)), this.#s.set(t, n)), `url(#${n})`;
950
+ }
951
+ getLegendGradientUrl(e) {
952
+ let t = "legend-gradient-" + this.#C++, n = N("linearGradient", {
953
+ id: t,
954
+ gradientUnits: "userSpaceOnUse",
955
+ x1: j(e.x1),
956
+ y1: j(e.y1),
957
+ x2: j(e.x2),
958
+ y2: j(e.y2)
959
+ });
960
+ for (let t of e.stops) n.appendChild(N("stop", {
961
+ offset: A(t.offset),
962
+ "stop-color": t.color
963
+ }));
964
+ return this.#t.appendChild(n), `url(#${t})`;
965
+ }
966
+ getLinkArcFadeMaskUrl(e) {
967
+ let t = Oe(e.p1, e.p4, e.distances);
968
+ if (!t) return;
969
+ let n = this.#c.get(t.key);
970
+ if (!n) {
971
+ n = "link-arc-fade-" + this.#b++;
972
+ let { gradient: e, mask: r } = ke(n, this.width, this.height, t);
973
+ this.#t.appendChild(e), this.#t.appendChild(r), this.#c.set(t.key, n);
974
+ }
975
+ return `url(#${n})`;
976
+ }
977
+ getViewportEdgeFadeMaskUrl(e) {
978
+ let n = Object.entries(e).filter(([, e]) => e.width > 0 && Number.isFinite(e.distance));
979
+ if (!n.length) return;
980
+ let r = t(this.#n);
981
+ if (!r) throw Error("No current view in SVG rendering context.");
982
+ let i = this.#i.get(r.view);
983
+ if (!i) {
984
+ i = "edge-fade-" + this.#b++;
985
+ let e = j(this.width), t = j(this.height), a = N("mask", {
986
+ id: i,
987
+ x: 0,
988
+ y: 0,
989
+ width: e,
990
+ height: t,
991
+ maskUnits: "userSpaceOnUse",
992
+ maskContentUnits: "userSpaceOnUse",
993
+ "mask-type": "luminance"
994
+ });
995
+ a.appendChild(N("rect", {
996
+ width: e,
997
+ height: t,
998
+ fill: "white"
999
+ }));
1000
+ for (let [o, s] of n) {
1001
+ let n = i + "-" + o, c = Ie(n, o, s, r.coords);
1002
+ this.#t.appendChild(c), a.appendChild(N("rect", {
1003
+ width: e,
1004
+ height: t,
1005
+ fill: `url(#${n})`
1006
+ }));
1007
+ }
1008
+ this.#t.appendChild(a), this.#i.set(r.view, i);
1009
+ }
1010
+ return `url(#${i})`;
1011
+ }
1012
+ getSvg() {
1013
+ return this.#e;
1014
+ }
1015
+ getWarnings() {
1016
+ return Array.from(this.#l);
1017
+ }
1018
+ get currentNode() {
1019
+ return t(this.#n)?.node ?? this.#e;
1020
+ }
1021
+ get currentCoords() {
1022
+ let e = t(this.#n);
1023
+ if (!e) throw Error("No current view in SVG rendering context.");
1024
+ return e.coords;
1025
+ }
1026
+ };
1027
+ function Me(e, t) {
1028
+ let n = e.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^A-Za-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
1029
+ return `${/^[A-Za-z_]/.test(n) ? n : n ? "view-" + n : "view"}-${t}`;
1030
+ }
1031
+ function Y(e, t) {
1032
+ e.x1 = Math.min(e.x1, t.x1), e.y1 = Math.min(e.y1, t.y1), e.x2 = Math.max(e.x2, t.x2), e.y2 = Math.max(e.y2, t.y2);
1033
+ }
1034
+ function Ne(e) {
1035
+ let [t, ...n] = Array.from(e), r = t;
1036
+ for (; n.some((e) => !r.contains(e));) r = r.parentNode;
1037
+ return r;
1038
+ }
1039
+ function Pe(e, t) {
1040
+ let n = e;
1041
+ for (; n.parentNode != t;) n = n.parentNode;
1042
+ return n;
1043
+ }
1044
+ function Fe(e, t) {
1045
+ let n = e;
1046
+ for (; n != t && n.matches("g[data-view-path]") && Array.from(n.children).every((e) => e.tagName == "title");) {
1047
+ let e = n.parentNode;
1048
+ n.remove(), n = e;
1049
+ }
1050
+ }
1051
+ function Ie(e, t, n, r) {
1052
+ let i = t == "top" ? r.y + n.distance : t == "right" ? r.x2 - n.distance : t == "bottom" ? r.y2 - n.distance : r.x + n.distance, a = t == "left" || t == "right", o = i + (t == "top" || t == "left" ? 1 : -1) * n.width, s = N("linearGradient", {
1053
+ id: e,
1054
+ gradientUnits: "userSpaceOnUse",
1055
+ x1: j(a ? i : 0),
1056
+ y1: j(a ? 0 : i),
1057
+ x2: j(a ? o : 0),
1058
+ y2: j(a ? 0 : o)
1059
+ });
1060
+ return s.appendChild(N("stop", {
1061
+ offset: 0,
1062
+ "stop-color": "black",
1063
+ "stop-opacity": 1
1064
+ })), s.appendChild(N("stop", {
1065
+ offset: 1,
1066
+ "stop-color": "black",
1067
+ "stop-opacity": 0
1068
+ })), s;
1069
+ }
1070
+ //#endregion
1071
+ //#region ../core/src/rendering/svg/index.js
1072
+ function X({ viewRoot: e, logicalWidth: t, logicalHeight: n, background: r = "white" }) {
1073
+ let i = new J({ picking: !1 }, {
1074
+ width: t,
1075
+ height: n,
1076
+ background: r
1077
+ });
1078
+ return d(e, l.create(0, 0, t, n), { renderingOptions: { firstFacet: !0 } }).collectRenderCommands(i), {
1079
+ svg: i.getSvg(),
1080
+ warnings: i.getWarnings()
1081
+ };
1082
+ }
1083
+ function Le({ viewRoot: e, logicalWidth: t, logicalHeight: n }) {
1084
+ let r = new J({ picking: !1 }, {
1085
+ width: t,
1086
+ height: n,
1087
+ background: null
1088
+ });
1089
+ return r.beginInstanceCounting(), d(e, l.create(0, 0, t, n), { renderingOptions: { firstFacet: !0 } }).collectRenderCommands(r), r.endInstanceCounting(), { layers: Array.from(r.getVisibleInstanceCounts(), ([e, t]) => ({
1090
+ viewName: e.unitView.name,
1091
+ viewTitle: e.unitView.getTitleText(),
1092
+ viewPath: e.unitView.getPathString(),
1093
+ markType: e.getType(),
1094
+ instanceCount: t
1095
+ })).filter((e) => e.instanceCount > 0) };
1096
+ }
1097
+ async function Re(e) {
1098
+ let t = e.rasterization;
1099
+ return t ? ($(t), e.rasterizeSvgRuns ? Z({
1100
+ ...e,
1101
+ rasterizeSvgRuns: e.rasterizeSvgRuns,
1102
+ maxVectorInstances: t.maxVectorInstances,
1103
+ pixelRatio: t.pixelRatio
1104
+ }) : Q(e)) : {
1105
+ ...X(e),
1106
+ rasterized: []
1107
+ };
1108
+ }
1109
+ async function Z({ viewRoot: e, rasterizeSvgRuns: t, logicalWidth: n, logicalHeight: r, background: i = "white", maxVectorInstances: a, pixelRatio: o = 2 }) {
1110
+ $({
1111
+ maxVectorInstances: a,
1112
+ pixelRatio: o
1113
+ });
1114
+ let s = new J({ picking: !1 }, {
1115
+ width: n,
1116
+ height: r,
1117
+ background: i,
1118
+ maxVectorInstances: a
1119
+ }), u = d(e, l.create(0, 0, n, r), { renderingOptions: { firstFacet: !0 } });
1120
+ s.beginInstanceCounting(), u.collectRenderCommands(s), s.endInstanceCounting(), u.collectRenderCommands(s);
1121
+ let f = s.getRasterRuns();
1122
+ if (f.length) try {
1123
+ await t({
1124
+ runs: f,
1125
+ viewRoot: e,
1126
+ layoutResult: u,
1127
+ logicalWidth: n,
1128
+ logicalHeight: r,
1129
+ pixelRatio: o
1130
+ });
1131
+ } catch (t) {
1132
+ if (t instanceof c) return Q({
1133
+ viewRoot: e,
1134
+ logicalWidth: n,
1135
+ logicalHeight: r,
1136
+ background: i
1137
+ });
1138
+ throw t;
1139
+ }
1140
+ return {
1141
+ svg: s.getSvg(),
1142
+ warnings: s.getWarnings(),
1143
+ rasterized: f.map((e) => ({
1144
+ targets: e.targets.map((e) => ({
1145
+ markType: e.mark.getType(),
1146
+ instanceCount: e.instanceCount
1147
+ })),
1148
+ reason: "instance-threshold",
1149
+ maxVectorInstances: a,
1150
+ pixelRatio: o
1151
+ }))
1152
+ };
1153
+ }
1154
+ function Q(e) {
1155
+ let t = X(e);
1156
+ return {
1157
+ ...t,
1158
+ warnings: [...t.warnings, "SVG rasterization was requested but no raster rendering backend is available; exported all marks as vectors."],
1159
+ rasterized: []
1160
+ };
1161
+ }
1162
+ function $(e) {
1163
+ if (!Number.isInteger(e.maxVectorInstances) || e.maxVectorInstances < 0) throw RangeError("maxVectorInstances must be a non-negative integer.");
1164
+ if (e.pixelRatio != null && (!Number.isFinite(e.pixelRatio) || e.pixelRatio <= 0)) throw RangeError("SVG raster pixelRatio must be positive.");
1165
+ }
1166
+ //#endregion
1167
+ export { Le as analyzeSvgExport, Z as createRasterizedSvg, X as createSvg, Re as createSvgExport };