@genome-spy/app 0.88.0 → 0.89.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 (43) hide show
  1. package/dist/{agentApi-BYFBKiRQ.js → agentApi-BUcXm-JC.js} +5544 -6449
  2. package/dist/agentApi.es.js +3328 -4255
  3. package/dist/agentShared.es.js +9 -9
  4. package/dist/{canvas2d-BVQ7-2eJ.js → canvas2d-CGuVGvQk.js} +117 -106
  5. package/dist/{canvas2d-D7SZK3xv.js → canvas2d-DgF0kstG.js} +99 -88
  6. package/dist/{canvasSizeHelper-7h_8rOcx.js → canvasSizeHelper-foL2YvGL.js} +15 -8
  7. package/dist/{clipOptions-DTMcB_9z.js → clipOptions-8BPf0WMZ.js} +1013 -755
  8. package/dist/{clipOptions-BWHr3aTa.js → clipOptions-DBJX_W31.js} +1033 -775
  9. package/dist/{debug-CVpoEOWx.js → debug-BEWbYuZD.js} +2 -2
  10. package/dist/{debug-DYAMZZKl.js → debug-DQj_7mFm.js} +2 -2
  11. package/dist/index.es.js +65 -65
  12. package/dist/index.js +406 -364
  13. package/dist/{indexer-DAH_ruVn.js → indexer-Cdt_U05k.js} +1 -1
  14. package/dist/{indexer-CXjZDo2Q.js → indexer-D8Bgkkb8.js} +1 -1
  15. package/dist/order-BPOzLe80.js +1056 -0
  16. package/dist/order-DIxlclRN.js +1056 -0
  17. package/dist/rasterExport-Bl6w9t3J.js +51 -0
  18. package/dist/rasterExport-DRvNAH-r.js +51 -0
  19. package/dist/rasterization-D0tOoKu_.js +62 -0
  20. package/dist/rectangle-DE98gIxF.js +108 -0
  21. package/dist/{renderCanvas2D-DxturTEW.js → renderCanvas2D-Ct95auF3.js} +60 -59
  22. package/dist/{renderCanvas2D-DtcJjqpB.js → renderCanvas2D-LdEYFnRo.js} +71 -70
  23. package/dist/schema.json +588 -116
  24. package/dist/{svg-CyrLfa9e.js → svg-Ag36-h_I.js} +394 -382
  25. package/dist/{svg-SDJMzL--.js → svg-pkTPD4bv.js} +368 -356
  26. package/dist/{svgRasterizer-f7DJ3UO0.js → svgRasterizer-CksK4QTB.js} +6 -5
  27. package/dist/{svgRasterizer-mWK7HTkx.js → svgRasterizer-DrtJ9nLk.js} +6 -5
  28. package/dist/{vega-scale-CypF85iS.js → vega-scale-BJaDSHBJ.js} +891 -959
  29. package/dist/{vega-scale-DLKCwWRs.js → vega-scale-BWBFykuI.js} +692 -760
  30. package/dist/{viewIdentityRegistry-DIDo44XQ.js → viewIdentityRegistry-B-snqI3y.js} +1 -1
  31. package/dist/{viewIdentityRegistry-Dl-vMN9I.js → viewIdentityRegistry-BvCJajXG.js} +1 -1
  32. package/dist/{viewSelectors-CymbZyE6.js → viewSelectors-BlvzvG-z.js} +445 -380
  33. package/dist/{viewSelectors-DNiDip5e.js → viewSelectors-C5q3qBiR.js} +364 -299
  34. package/dist/{viewUtils-BrJLIj2o.js → viewUtils-C3vBtSvE.js} +1714 -1689
  35. package/dist/{webgl-CqTDifWM.js → webgl-CZX2pe5v.js} +2322 -971
  36. package/dist/{webgl-jaC2m0Zr.js → webgl-CexXSw_I.js} +2374 -1023
  37. package/package.json +5 -5
  38. package/dist/order-C5CzA37O.js +0 -918
  39. package/dist/order-DvY7KNcu.js +0 -918
  40. package/dist/rasterExport-BgZ98e6U.js +0 -44
  41. package/dist/rasterExport-DEr8fOLm.js +0 -44
  42. package/dist/rasterization-CFogVB3B.js +0 -50
  43. package/dist/rectangle-DKnrAmKs.js +0 -142
@@ -1,35 +1,35 @@
1
- import { o as e, s as t, un as n } from "./clipOptions-BWHr3aTa.js";
2
- import { v as r } from "./vega-scale-CypF85iS.js";
3
- import { x as i } from "./viewSelectors-DNiDip5e.js";
4
- import { t as a } from "./rasterization-CFogVB3B.js";
5
- import { t as o } from "./rectangle-DKnrAmKs.js";
1
+ import { hn as e, o as t, s as n } from "./clipOptions-DBJX_W31.js";
2
+ import { v as r } from "./vega-scale-BJaDSHBJ.js";
3
+ import { x as i } from "./viewSelectors-C5q3qBiR.js";
4
+ import { t as a } from "./rasterization-D0tOoKu_.js";
5
+ import { t as o } from "./rectangle-DE98gIxF.js";
6
6
  import { n as s, t as c } from "./layoutResult-D50MSHXR.js";
7
- import { A as l, C as u, D as d, E as f, M as p, N as m, O as h, T as g, _, a as v, c as y, d as b, f as x, g as S, h as C, i as w, j as ee, k as T, l as E, m as D, n as te, o as ne, p as re, r as O, s as ie, t as ae, u as oe, v as se, w as ce, x as le, y as ue } from "./order-C5CzA37O.js";
8
- import { n as k, t as A } from "./svgNumber-DNxESJQB.js";
7
+ import { A as l, D as u, E as d, F as f, I as p, M as m, N as h, O as g, P as _, S as v, _ as y, a as b, b as x, c as S, d as C, f as w, g as T, h as E, i as D, j as O, k, l as A, m as ee, n as te, o as ne, p as re, r as ie, s as ae, t as oe, u as se, v as ce, w as le, x as ue, y as de } from "./order-DIxlclRN.js";
8
+ import { n as j, t as M } from "./svgNumber-DNxESJQB.js";
9
9
  //#region ../core/src/rendering/svg/svgElement.js
10
- var j = "http://www.w3.org/2000/svg";
11
- function M(e, t) {
12
- let n = document.createElementNS(j, e);
10
+ var N = "http://www.w3.org/2000/svg";
11
+ function P(e, t) {
12
+ let n = document.createElementNS(N, e);
13
13
  if (t) for (let [e, r] of Object.entries(t)) n.setAttribute(e, "" + r);
14
14
  return n;
15
15
  }
16
16
  //#endregion
17
17
  //#region ../core/src/rendering/svg/svgAttributes.js
18
- function N(e, t) {
19
- let n = Object.entries(t).filter(([t, n]) => n.encoder.constant ? (e.setAttribute(t, "" + P(n, {})), !1) : !0);
20
- return (e) => Object.fromEntries(n.map(([t, n]) => [t, P(n, e)]));
18
+ function F(e, t) {
19
+ let n = Object.entries(t).filter(([t, n]) => n.encoder.constant ? (e.setAttribute(t, "" + I(n, {})), !1) : !0);
20
+ return (e) => Object.fromEntries(n.map(([t, n]) => [t, I(n, e)]));
21
21
  }
22
- function P(e, t) {
22
+ function I(e, t) {
23
23
  let n = e.encoder(t);
24
24
  return e.transform ? e.transform(n) : "" + n;
25
25
  }
26
26
  //#endregion
27
27
  //#region ../core/src/rendering/svg/renderers/arrow.js
28
- function de(e, t) {
29
- let n = e, { coords: r, data: i, group: a, viewOpacity: o, visibleBounds: s } = t, c = n.encoders, l = N(a, {
28
+ function fe(e, t) {
29
+ let n = e, { coords: r, data: i, group: a, viewOpacity: o, visibleBounds: s } = t, c = n.encoders, u = F(a, {
30
30
  fill: {
31
31
  encoder: c.fill,
32
- transform: d
32
+ transform: l
33
33
  },
34
34
  "fill-opacity": {
35
35
  encoder: c.fillOpacity,
@@ -37,7 +37,7 @@ function de(e, t) {
37
37
  },
38
38
  stroke: {
39
39
  encoder: c.stroke,
40
- transform: d
40
+ transform: l
41
41
  },
42
42
  "stroke-opacity": {
43
43
  encoder: c.strokeOpacity,
@@ -45,79 +45,79 @@ function de(e, t) {
45
45
  },
46
46
  "stroke-width": {
47
47
  encoder: c.strokeWidth,
48
- transform: (e) => A(+e)
48
+ transform: (e) => M(+e)
49
49
  }
50
50
  });
51
51
  a.setAttribute("stroke-linejoin", "miter");
52
- let u = ue(n);
53
- return le(n, u, {
52
+ let d = v(n);
53
+ return le(n, d, {
54
54
  coords: r,
55
55
  data: i,
56
56
  visibleBounds: s,
57
57
  viewOpacity: o,
58
58
  countOnly: t.countOnly
59
59
  }, (e) => {
60
- t.countOnly || (e.headShapeFallback && t.warn(`SVG export rendered unsupported arrow headShape "${u.headShape}" as a triangle.`), a.appendChild(M("path", {
61
- d: e.boundaryLoops.map(fe).join(" "),
62
- ...l(e.datum)
60
+ t.countOnly || (e.headShapeFallback && t.warn(`SVG export rendered unsupported arrow headShape "${d.headShape}" as a triangle.`), a.appendChild(P("path", {
61
+ d: e.boundaryLoops.map(pe).join(" "),
62
+ ...u(e.datum)
63
63
  })));
64
64
  });
65
65
  }
66
- function fe(e) {
67
- return `M ${e.map(pe).join(" L ")} Z`;
68
- }
69
66
  function pe(e) {
70
- return `${A(e.x)} ${A(e.y)}`;
67
+ return `M ${e.map(me).join(" L ")} Z`;
68
+ }
69
+ function me(e) {
70
+ return `${M(e.x)} ${M(e.y)}`;
71
71
  }
72
72
  //#endregion
73
73
  //#region ../core/src/rendering/svg/renderers/link.js
74
- function me(e, t) {
75
- let n = e, r = D(n), { coords: i, data: a, group: o, viewOpacity: s, visibleBounds: c } = t, l = n.encoders, u = se(n, r.shape, t.secondOrderPass), f = N(o, {
74
+ function he(e, t) {
75
+ let n = e, r = y(n), { coords: i, data: a, group: o, viewOpacity: s, visibleBounds: c } = t, u = n.encoders, d = ue(n, r.shape, t.secondOrderPass), f = F(o, {
76
76
  stroke: {
77
- encoder: l.color,
78
- transform: d
77
+ encoder: u.color,
78
+ transform: l
79
79
  },
80
80
  "stroke-opacity": {
81
- encoder: l.opacity,
81
+ encoder: u.opacity,
82
82
  transform: (e) => +e * s
83
83
  },
84
84
  "stroke-width": {
85
- encoder: l.size,
86
- transform: (e) => A(+e)
85
+ encoder: u.size,
86
+ transform: (e) => M(+e)
87
87
  }
88
88
  });
89
89
  o.setAttribute("fill", "none"), o.setAttribute("stroke-linecap", "butt");
90
90
  let p = o, m;
91
- return C(n, r, {
91
+ return ce(n, r, {
92
92
  coords: i,
93
93
  data: a,
94
94
  visibleBounds: c
95
95
  }, ({ datum: e, points: n }) => {
96
96
  let [r, i, a, s] = n;
97
97
  if (t.countOnly) return;
98
- let c = f(e), l = u ? t.getLinkArcFadeMaskUrl({
98
+ let c = f(e), l = d ? t.getLinkArcFadeMaskUrl({
99
99
  p1: r,
100
100
  p4: s,
101
- distances: u
101
+ distances: d
102
102
  }) : void 0;
103
- l !== m && (m = l, p = l ? M("g", { mask: l }) : o, l && o.appendChild(p)), p.appendChild(M("path", {
104
- d: `M ${F(r)} C ${F(i)} ${F(a)} ${F(s)}`,
103
+ l !== m && (m = l, p = l ? P("g", { mask: l }) : o, l && o.appendChild(p)), p.appendChild(P("path", {
104
+ d: `M ${L(r)} C ${L(i)} ${L(a)} ${L(s)}`,
105
105
  ...c
106
106
  }));
107
107
  });
108
108
  }
109
- function F(e) {
110
- return e.map(A).join(" ");
109
+ function L(e) {
110
+ return e.map(M).join(" ");
111
111
  }
112
112
  //#endregion
113
113
  //#region ../core/src/rendering/svg/renderers/point.js
114
- function I(e, t) {
114
+ function R(e, t) {
115
115
  let n = e;
116
- f(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.");
117
- let r = x(n), { inwardStroke: i } = r, { group: a, viewOpacity: o } = t, s = n.encoders, c = N(a, {
116
+ k(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.");
117
+ let r = E(n), { inwardStroke: i } = r, { group: a, viewOpacity: o } = t, s = n.encoders, c = F(a, {
118
118
  fill: {
119
119
  encoder: s.fill,
120
- transform: d
120
+ transform: l
121
121
  },
122
122
  "fill-opacity": {
123
123
  encoder: s.fillOpacity,
@@ -125,7 +125,7 @@ function I(e, t) {
125
125
  },
126
126
  stroke: {
127
127
  encoder: s.stroke,
128
- transform: d
128
+ transform: l
129
129
  },
130
130
  "stroke-opacity": {
131
131
  encoder: s.strokeOpacity,
@@ -133,47 +133,47 @@ function I(e, t) {
133
133
  },
134
134
  "stroke-width": {
135
135
  encoder: s.strokeWidth,
136
- transform: (e) => A(+e)
136
+ transform: (e) => M(+e)
137
137
  }
138
- }), l = R();
139
- return re(n, r, t, (e) => {
138
+ }), u = _e();
139
+ return T(n, r, t, (e) => {
140
140
  if (t.countOnly) return;
141
- let { datum: n, shape: r, x: u, y: d, geometryRadius: f, angle: p, strokeWidth: m, lineShape: h } = e, g = {
141
+ let { datum: n, shape: r, x: l, y: d, geometryRadius: f, angle: p, strokeWidth: m, lineShape: h } = e, g = {
142
142
  ...c(n),
143
- ...i && !h ? { "stroke-width": A(m) } : {},
144
- ...h ? z(s, n, o) : {}
145
- }, _ = L(r, u, d, f, g, l);
146
- _ ? (p && _.setAttribute("transform", `rotate(${A(p)} ${A(u)} ${A(d)})`), a.appendChild(_)) : (t.warn(`SVG export rendered unsupported point shape "${r}" as a circle.`), a.appendChild(M("circle", {
147
- cx: A(u),
148
- cy: A(d),
149
- r: A(f),
143
+ ...i && !h ? { "stroke-width": M(m) } : {},
144
+ ...h ? ve(s, n, o) : {}
145
+ }, _ = ge(r, l, d, f, g, u);
146
+ _ ? (p && _.setAttribute("transform", `rotate(${M(p)} ${M(l)} ${M(d)})`), a.appendChild(_)) : (t.warn(`SVG export rendered unsupported point shape "${r}" as a circle.`), a.appendChild(P("circle", {
147
+ cx: M(l),
148
+ cy: M(d),
149
+ r: M(f),
150
150
  ...g
151
151
  })));
152
152
  });
153
153
  }
154
- function L(e, t, n, r, i, a) {
155
- let o = A(t), s = A(n), c = A(r);
156
- if (e == "circle") return M("circle", {
154
+ function ge(e, t, n, r, i, a) {
155
+ let o = M(t), s = M(n), c = M(r);
156
+ if (e == "circle") return P("circle", {
157
157
  cx: o,
158
158
  cy: s,
159
159
  r: c,
160
160
  ...i
161
161
  });
162
- if (e == "square") return M("rect", {
163
- x: A(t - r),
164
- y: A(n - r),
165
- width: A(r * 2),
166
- height: A(r * 2),
162
+ if (e == "square") return P("rect", {
163
+ x: M(t - r),
164
+ y: M(n - r),
165
+ width: M(r * 2),
166
+ height: M(r * 2),
167
167
  ...i
168
168
  });
169
169
  let l = a.build(e, t, n, r);
170
- return l ? M("path", {
170
+ return l ? P("path", {
171
171
  d: l,
172
172
  ...i
173
173
  }) : void 0;
174
174
  }
175
- function R() {
176
- let e = "", t = (e, t) => `${A(e)} ${A(t)}`, n = {
175
+ function _e() {
176
+ let e = "", t = (e, t) => `${M(e)} ${M(t)}`, n = {
177
177
  moveTo(n, r) {
178
178
  e += `${e ? " M" : "M"} ${t(n, r)}`;
179
179
  },
@@ -185,26 +185,26 @@ function R() {
185
185
  }
186
186
  };
187
187
  return { build(t, r, i, a) {
188
- return e = "", b(t, r, i, a, n) ? e : void 0;
188
+ return e = "", ee(t, r, i, a, n) ? e : void 0;
189
189
  } };
190
190
  }
191
- function z(e, t, n) {
192
- let r = e.stroke(t), i = u(e.strokeOpacity, t), a = r == null || i <= 0;
191
+ function ve(e, t, n) {
192
+ let r = e.stroke(t), i = d(e.strokeOpacity, t), a = r == null || i <= 0;
193
193
  return {
194
194
  fill: "none",
195
- stroke: d(a ? e.fill(t) : r),
196
- "stroke-opacity": (a ? u(e.fillOpacity, t) : i) * n,
197
- "stroke-width": A(u(e.strokeWidth, t)),
195
+ stroke: l(a ? e.fill(t) : r),
196
+ "stroke-opacity": (a ? d(e.fillOpacity, t) : i) * n,
197
+ "stroke-width": M(d(e.strokeWidth, t)),
198
198
  "stroke-linecap": "butt"
199
199
  };
200
200
  }
201
201
  //#endregion
202
202
  //#region ../core/src/rendering/svg/renderers/rect.js
203
- function he(e, t) {
204
- let n = e, r = E(n), { shadow: i, hatch: a } = r, { group: o, viewOpacity: s } = t, c = n.encoders, l = N(o, {
203
+ function ye(e, t) {
204
+ let n = e, r = w(n), { shadow: i, hatch: a } = r, { group: o, viewOpacity: s } = t, c = n.encoders, u = F(o, {
205
205
  fill: {
206
206
  encoder: c.fill,
207
- transform: d
207
+ transform: l
208
208
  },
209
209
  "fill-opacity": {
210
210
  encoder: c.fillOpacity,
@@ -212,7 +212,7 @@ function he(e, t) {
212
212
  },
213
213
  stroke: {
214
214
  encoder: c.stroke,
215
- transform: d
215
+ transform: l
216
216
  },
217
217
  "stroke-opacity": {
218
218
  encoder: c.strokeOpacity,
@@ -220,248 +220,246 @@ function he(e, t) {
220
220
  },
221
221
  "stroke-width": {
222
222
  encoder: c.strokeWidth,
223
- transform: (e) => A(+e)
223
+ transform: (e) => M(+e)
224
224
  }
225
225
  }), f = i.opacity > 0 ? {
226
226
  fill: i.color,
227
227
  "fill-opacity": 1,
228
228
  stroke: i.color,
229
229
  "stroke-opacity": 1,
230
- opacity: k(i.opacity * s),
230
+ opacity: j(i.opacity * s),
231
231
  filter: t.getShadowFilterUrl(i)
232
232
  } : null;
233
- return oe(n, r, t, (e) => {
233
+ return re(n, r, t, (e) => {
234
234
  if (t.countOnly) return;
235
235
  let { datum: n, x: r, y: i, width: p, height: m, radii: h, opacityFactor: g, strokeWidth: _, fill: v, fillOpacity: y } = e, b = {
236
- ...l(n),
237
- ...g == 1 ? {} : { opacity: k(g) }
236
+ ...u(n),
237
+ ...g == 1 ? {} : { opacity: j(g) }
238
238
  };
239
239
  if (a != "none" && _ > 0 && (b.fill = t.getRectHatchPatternUrl({
240
240
  type: a,
241
- fill: d(c.fill(n)),
242
- fillOpacity: u(c.fillOpacity, n) * s,
243
- stroke: d(c.stroke(n)),
244
- strokeOpacity: u(c.strokeOpacity, n) * s,
241
+ fill: l(c.fill(n)),
242
+ fillOpacity: d(c.fillOpacity, n) * s,
243
+ stroke: l(c.stroke(n)),
244
+ strokeOpacity: d(c.strokeOpacity, n) * s,
245
245
  strokeWidth: _
246
246
  }), b["fill-opacity"] = 1), f) {
247
- let e = B(r, i, p, m, h, {
247
+ let e = z(r, i, p, m, h, {
248
248
  ...f,
249
- "stroke-width": A(_)
249
+ "stroke-width": M(_)
250
250
  });
251
251
  if (a == "none" && v != "none" && y == 1 && g == 1) o.appendChild(e);
252
252
  else {
253
- let n = _ / 2, a = Object.fromEntries(Object.entries(h).map(([e, t]) => [e, t + n])), s = V(r - n, i - n, p + n * 2, m + n * 2, a), c = M("g", { "clip-path": t.getShadowClipPathUrl(s) });
253
+ let n = _ / 2, a = Object.fromEntries(Object.entries(h).map(([e, t]) => [e, t + n])), s = B(r - n, i - n, p + n * 2, m + n * 2, a), c = P("g", { "clip-path": t.getShadowClipPathUrl(s) });
254
254
  c.appendChild(e), o.appendChild(c);
255
255
  }
256
256
  }
257
- o.appendChild(B(r, i, p, m, h, b));
257
+ o.appendChild(z(r, i, p, m, h, b));
258
258
  });
259
259
  }
260
- function B(e, t, n, r, i, a) {
261
- if (ge(i)) {
262
- let o = i.topLeft, s = A(e), c = A(t), l = A(e + n), u = A(t + r);
263
- return M("rect", {
260
+ function z(e, t, n, r, i, a) {
261
+ if (be(i)) {
262
+ let o = i.topLeft, s = M(e), c = M(t), l = M(e + n), u = M(t + r);
263
+ return P("rect", {
264
264
  x: s,
265
265
  y: c,
266
- width: A(l - s),
267
- height: A(u - c),
266
+ width: M(l - s),
267
+ height: M(u - c),
268
268
  ...o ? {
269
- rx: A(o),
270
- ry: A(o)
269
+ rx: M(o),
270
+ ry: M(o)
271
271
  } : {},
272
272
  ...a
273
273
  });
274
- } else return M("path", {
275
- d: V(e, t, n, r, i),
274
+ } else return P("path", {
275
+ d: B(e, t, n, r, i),
276
276
  ...a
277
277
  });
278
278
  }
279
- function ge(e) {
279
+ function be(e) {
280
280
  return Object.values(e).every((t) => t == e.topLeft);
281
281
  }
282
- function V(e, t, n, r, i) {
282
+ function B(e, t, n, r, i) {
283
283
  let a = e + n, o = t + r, { topLeft: s, topRight: c, bottomRight: l, bottomLeft: u } = i;
284
284
  return [
285
- `M ${U(e + s, t)}`,
286
- `H ${A(a - c)}`,
287
- H(c, a, t + c, a, t),
288
- `V ${A(o - l)}`,
289
- H(l, a - l, o, a, o),
290
- `H ${A(e + u)}`,
291
- H(u, e, o - u, e, o),
292
- `V ${A(t + s)}`,
293
- H(s, e + s, t, e, t),
285
+ `M ${H(e + s, t)}`,
286
+ `H ${M(a - c)}`,
287
+ V(c, a, t + c, a, t),
288
+ `V ${M(o - l)}`,
289
+ V(l, a - l, o, a, o),
290
+ `H ${M(e + u)}`,
291
+ V(u, e, o - u, e, o),
292
+ `V ${M(t + s)}`,
293
+ V(s, e + s, t, e, t),
294
294
  "Z"
295
295
  ].join(" ");
296
296
  }
297
- function H(e, t, n, r, i) {
298
- return e ? `A ${A(e)} ${A(e)} 0 0 1 ${U(t, n)}` : `L ${U(r, i)}`;
297
+ function V(e, t, n, r, i) {
298
+ return e ? `A ${M(e)} ${M(e)} 0 0 1 ${H(t, n)}` : `L ${H(r, i)}`;
299
299
  }
300
- function U(e, t) {
301
- return `${A(e)} ${A(t)}`;
300
+ function H(e, t) {
301
+ return `${M(e)} ${M(t)}`;
302
302
  }
303
303
  //#endregion
304
304
  //#region ../core/src/rendering/svg/renderers/rule.js
305
- function W(e, t) {
306
- let n = e, r = ie(n), { coords: i, data: a, group: o, viewOpacity: s, visibleBounds: c } = t, l = n.encoders, u = n.properties.strokeDash, f = N(o, {
305
+ function U(e, t) {
306
+ let n = e, r = se(n), { coords: i, data: a, group: o, viewOpacity: s, visibleBounds: c } = t, u = n.encoders, d = n.properties.strokeDash, f = F(o, {
307
307
  stroke: {
308
- encoder: l.color,
309
- transform: d
308
+ encoder: u.color,
309
+ transform: l
310
310
  },
311
311
  "stroke-opacity": {
312
- encoder: l.opacity,
312
+ encoder: u.opacity,
313
313
  transform: (e) => +e * s
314
314
  },
315
315
  "stroke-width": {
316
- encoder: l.size,
317
- transform: (e) => A(+e)
316
+ encoder: u.size,
317
+ transform: (e) => M(+e)
318
318
  }
319
319
  });
320
- return o.setAttribute("stroke-linecap", "" + n.properties.strokeCap), u && (o.setAttribute("stroke-dasharray", u.map(A).join(" ")), o.setAttribute("stroke-dashoffset", "" + A(n.properties.strokeDashOffset))), y(n, r, {
320
+ return o.setAttribute("stroke-linecap", "" + n.properties.strokeCap), d && (o.setAttribute("stroke-dasharray", d.map(M).join(" ")), o.setAttribute("stroke-dashoffset", "" + M(n.properties.strokeDashOffset))), C(n, r, {
321
321
  coords: i,
322
322
  data: a,
323
323
  visibleBounds: c
324
324
  }, (e) => {
325
- t.countOnly || o.appendChild(M("line", {
326
- x1: A(e.x1),
327
- y1: A(e.y1),
328
- x2: A(e.x2),
329
- y2: A(e.y2),
325
+ t.countOnly || o.appendChild(P("line", {
326
+ x1: M(e.x1),
327
+ y1: M(e.y1),
328
+ x2: M(e.x2),
329
+ y2: M(e.y2),
330
330
  ...f(e.datum)
331
331
  }));
332
332
  });
333
333
  }
334
334
  //#endregion
335
335
  //#region ../core/src/rendering/svg/renderers/text.js
336
- function _e(e, t) {
337
- let n = e, r = n.properties, i = v(n), { coords: a, data: o, group: s, viewOpacity: c, visibleBounds: l, anchorCullBounds: u } = t, p = n.encoders, m = N(s, {
336
+ function xe(e, t) {
337
+ let n = e, r = n.properties, i = t.textMetrics ?? n.unitView.context.textMetrics, a = i.requestFont(r), o = D(i, r), s = S(n), { coords: c, data: u, group: d, viewOpacity: f, visibleBounds: p, anchorCullBounds: m } = t, h = n.encoders, g = F(d, {
338
338
  fill: {
339
- encoder: p.color,
340
- transform: d
339
+ encoder: h.color,
340
+ transform: l
341
341
  },
342
342
  "fill-opacity": {
343
- encoder: p.opacity,
344
- transform: (e) => +e * c
343
+ encoder: h.opacity,
344
+ transform: (e) => +e * f
345
345
  },
346
346
  "font-size": {
347
- encoder: p.size,
348
- transform: (e) => A(+e)
347
+ encoder: h.size,
348
+ transform: (e) => M(+e)
349
349
  }
350
350
  });
351
- s.setAttribute("font-family", te(r.font)), s.setAttribute("font-style", r.fontStyle ?? "normal"), s.setAttribute("font-weight", "" + w(r.fontWeight ?? "normal")), s.setAttribute("text-anchor", ve[i.align]);
352
- let h = {
351
+ d.setAttribute("font-family", b(r.font)), d.setAttribute("font-style", r.fontStyle ?? "normal"), d.setAttribute("font-weight", "" + ae(r.fontWeight ?? "normal")), d.setAttribute("text-anchor", Se[s.align]);
352
+ let _ = {
353
353
  top: {
354
- width: f(n, r.viewportEdgeFadeWidthTop),
355
- distance: f(n, r.viewportEdgeFadeDistanceTop)
354
+ width: k(n, r.viewportEdgeFadeWidthTop),
355
+ distance: k(n, r.viewportEdgeFadeDistanceTop)
356
356
  },
357
357
  right: {
358
- width: f(n, r.viewportEdgeFadeWidthRight),
359
- distance: f(n, r.viewportEdgeFadeDistanceRight)
358
+ width: k(n, r.viewportEdgeFadeWidthRight),
359
+ distance: k(n, r.viewportEdgeFadeDistanceRight)
360
360
  },
361
361
  bottom: {
362
- width: f(n, r.viewportEdgeFadeWidthBottom),
363
- distance: f(n, r.viewportEdgeFadeDistanceBottom)
362
+ width: k(n, r.viewportEdgeFadeWidthBottom),
363
+ distance: k(n, r.viewportEdgeFadeDistanceBottom)
364
364
  },
365
365
  left: {
366
- width: f(n, r.viewportEdgeFadeWidthLeft),
367
- distance: f(n, r.viewportEdgeFadeDistanceLeft)
366
+ width: k(n, r.viewportEdgeFadeWidthLeft),
367
+ distance: k(n, r.viewportEdgeFadeDistanceLeft)
368
368
  }
369
- }, g = ne(n, i, {
370
- coords: a,
371
- data: o,
372
- visibleBounds: l,
373
- anchorCullBounds: u
369
+ }, v = A(n, s, {
370
+ coords: c,
371
+ data: u,
372
+ visibleBounds: p,
373
+ anchorCullBounds: m,
374
+ fontMeasurement: a,
375
+ measureLogoInkBounds: o
374
376
  }, (e) => {
375
377
  if (t.countOnly) return;
376
- if (e.logoScale) {
378
+ if (e.logoTransform) {
377
379
  e.multiCharacterLogo && t.warn("SVG export stretches multi-character logo text as a single glyph cell.");
378
- let n = [`translate(${A(e.x)} ${A(e.y)})`];
379
- e.angle && n.push(`rotate(${A(e.angle)})`), (e.dx || e.dy) && n.push(`translate(${A(e.dx)} ${A(e.dy)})`), n.push(`scale(${A(e.logoScale.width)} ${A(e.logoScale.heightScale)})`);
380
- let r = M("text", {
380
+ let n = [`translate(${M(e.x)} ${M(e.y)})`];
381
+ e.angle && n.push(`rotate(${M(e.angle)})`), (e.dx || e.dy) && n.push(`translate(${M(e.dx)} ${M(e.dy)})`), n.push(`scale(${M(e.logoTransform.scaleX)} ${M(e.logoTransform.scaleY)})`), n.push(`translate(${M(-e.logoTransform.originX)} ${M(-e.logoTransform.originY)})`);
382
+ let r = P("text", {
381
383
  x: 0,
382
384
  y: 0,
383
- dy: O("middle", 1),
384
- "text-anchor": "middle",
385
- lengthAdjust: "spacingAndGlyphs",
386
- textLength: 1,
385
+ "text-anchor": "start",
387
386
  transform: n.join(" "),
388
- ...m(e.datum),
389
- "font-size": 1
387
+ ...g(e.datum),
388
+ "font-size": e.size
390
389
  });
391
- r.textContent = e.text, s.appendChild(r);
390
+ r.textContent = e.text, d.appendChild(r);
392
391
  return;
393
392
  }
394
- let n = A(e.x), r = A(e.y), a = M("text", {
395
- x: n,
396
- y: r,
397
- dx: A(e.dx),
398
- dy: A(e.dy + O(i.baseline, e.size)),
399
- lengthAdjust: "spacingAndGlyphs",
400
- textLength: A(e.width),
401
- ...m(e.datum),
402
- ...e.scale == 1 ? {} : { "font-size": A(e.size) },
403
- ...e.fadeOpacity == 1 ? {} : { opacity: k(e.fadeOpacity) }
393
+ let n = [`translate(${M(e.x)} ${M(e.y)})`];
394
+ e.angle && n.push(`rotate(${M(e.angle)})`), (e.dx || e.dy) && n.push(`translate(${M(e.dx)} ${M(e.dy)})`), e.scale != 1 && n.push(`scale(${M(e.scale)})`);
395
+ let r = P("text", {
396
+ x: 0,
397
+ y: 0,
398
+ dy: M(ne(s.baseline, e.size)),
399
+ ...g(e.datum),
400
+ ...e.fadeOpacity == 1 ? {} : { opacity: j(e.fadeOpacity) },
401
+ transform: n.join(" ")
404
402
  });
405
- a.textContent = e.text, e.angle && a.setAttribute("transform", `rotate(${A(e.angle)} ${n} ${r})`), s.appendChild(a);
403
+ r.textContent = e.text, d.appendChild(r);
406
404
  });
407
- if (!t.countOnly && s.childElementCount > 0) {
408
- let e = t.getViewportEdgeFadeMaskUrl(h);
409
- e && s.setAttribute("mask", e);
405
+ if (!t.countOnly && d.childElementCount > 0) {
406
+ let e = t.getViewportEdgeFadeMaskUrl(_);
407
+ e && d.setAttribute("mask", e);
410
408
  }
411
- return g;
409
+ return v;
412
410
  }
413
- var ve = {
411
+ var Se = {
414
412
  left: "start",
415
413
  center: "middle",
416
414
  right: "end"
417
- }, G = 64;
418
- function ye(e, t) {
419
- let n = xe(e.unitView);
415
+ }, W = 64;
416
+ function Ce(e, t) {
417
+ let n = Te(e.unitView);
420
418
  if (!n) return;
421
419
  let i = e.unitView.getScaleResolution(n.channel)?.getScale();
422
420
  if (!i || !r(i.type)) return;
423
- let { coords: a, data: o, group: s, viewOpacity: c, visibleBounds: l } = t;
421
+ let { coords: a, data: o, group: s, viewOpacity: c, visibleBounds: d } = t;
424
422
  if (!o.length) return 0;
425
- let u = e.encoders, f = n.channel == "stroke" ? u.stroke : u.fill, p = Se(e.unitView.spec.encoding.x), m = Infinity, h = Infinity, _ = -Infinity, v = -Infinity, y = o.map((e) => {
426
- let [t, n] = ce(a, u, e), [r, i] = g(a, u, e);
427
- return m = Math.min(m, t, n), h = Math.min(h, r, i), _ = Math.max(_, t, n), v = Math.max(v, r, i), {
423
+ let f = e.encoders, p = n.channel == "stroke" ? f.stroke : f.fill, m = Ee(e.unitView.spec.encoding.x), h = Infinity, v = Infinity, y = -Infinity, b = -Infinity, x = o.map((e) => {
424
+ let [t, n] = u(a, f, e), [r, i] = g(a, f, e);
425
+ return h = Math.min(h, t, n), v = Math.min(v, r, i), y = Math.max(y, t, n), b = Math.max(b, r, i), {
428
426
  offset: Number(e.position),
429
- color: d(f(e))
427
+ color: l(p(e))
430
428
  };
431
429
  }).sort((e, t) => e.offset - t.offset);
432
- if (!ee(l, m, h, _, v)) return 0;
430
+ if (!_(d, h, v, y, b)) return 0;
433
431
  if (t.countOnly) return o.length;
434
- let b = be(y), x = [
432
+ let S = we(x), C = [
435
433
  {
436
434
  offset: 0,
437
- color: b[0].color
435
+ color: S[0].color
438
436
  },
439
- ...b,
437
+ ...S,
440
438
  {
441
439
  offset: 1,
442
- color: b.at(-1).color
440
+ color: S.at(-1).color
443
441
  }
444
- ], S = t.getLegendGradientUrl({
445
- x1: m,
446
- y1: p ? h : v,
447
- x2: p ? _ : m,
448
- y2: h,
449
- stops: x
450
- }), C = A(m), w = A(h), T = A(_), E = A(v), D = Number(u.fillOpacity(o[0])) * c;
451
- return s.appendChild(M("rect", {
452
- x: C,
453
- y: w,
454
- width: A(T - C),
455
- height: A(E - w),
456
- fill: S,
457
- "fill-opacity": k(D),
442
+ ], w = t.getLegendGradientUrl({
443
+ x1: h,
444
+ y1: m ? v : b,
445
+ x2: m ? y : h,
446
+ y2: v,
447
+ stops: C
448
+ }), T = M(h), E = M(v), D = M(y), O = M(b), k = Number(f.fillOpacity(o[0])) * c;
449
+ return s.appendChild(P("rect", {
450
+ x: T,
451
+ y: E,
452
+ width: M(D - T),
453
+ height: M(O - E),
454
+ fill: w,
455
+ "fill-opacity": j(k),
458
456
  stroke: "none"
459
457
  })), o.length;
460
458
  }
461
- function be(e) {
462
- return e.length <= G ? e : Array.from({ length: G }, (t, n) => e[Math.round(n * (e.length - 1) / (G - 1))]);
459
+ function we(e) {
460
+ return e.length <= W ? e : Array.from({ length: W }, (t, n) => e[Math.round(n * (e.length - 1) / (W - 1))]);
463
461
  }
464
- function xe(e) {
462
+ function Te(e) {
465
463
  let t = e;
466
464
  for (; t;) {
467
465
  let e = t.spec.data;
@@ -469,32 +467,32 @@ function xe(e) {
469
467
  t = t.dataParent;
470
468
  }
471
469
  }
472
- function Se(e) {
470
+ function Ee(e) {
473
471
  return e != null && "field" in e && (e.field == "position0" || e.field == "position1");
474
472
  }
475
473
  //#endregion
476
474
  //#region ../core/src/rendering/svg/renderers/index.js
477
- var Ce = /* @__PURE__ */ new Map([
478
- ["arrow", de],
479
- ["link", me],
480
- ["point", I],
481
- ["rect", he],
482
- ["rule", W],
483
- ["text", _e],
484
- ["tick", W]
475
+ var De = /* @__PURE__ */ new Map([
476
+ ["arrow", fe],
477
+ ["link", he],
478
+ ["point", R],
479
+ ["rect", ye],
480
+ ["rule", U],
481
+ ["text", xe],
482
+ ["tick", U]
485
483
  ]);
486
- function we(e, t) {
484
+ function Oe(e, t) {
487
485
  if (e.getType() == "rect") {
488
- let n = ye(e, t);
486
+ let n = Ce(e, t);
489
487
  if (n !== void 0) return n;
490
488
  }
491
- let n = Ce.get(e.getType());
489
+ let n = De.get(e.getType());
492
490
  if (!n) throw Error(`SVG rendering is not implemented for mark type "${e.getType()}". View: ${e.unitView.getPathString()}`);
493
491
  return n(e, t);
494
492
  }
495
493
  //#endregion
496
494
  //#region ../core/src/rendering/svg/rectHatchPattern.js
497
- function Te(e, t) {
495
+ function ke(e, t) {
498
496
  let n = t.strokeWidth, r = [
499
497
  "dots",
500
498
  "rings",
@@ -507,31 +505,31 @@ function Te(e, t) {
507
505
  "vertical",
508
506
  "horizontal",
509
507
  "grid"
510
- ].includes(t.type), o = r ? n * 7 : n * (i ? 6 : 4), s = a ? n * 2 : n, c = o, l = r ? o * 2 : o, u = M("pattern", {
508
+ ].includes(t.type), o = r ? n * 7 : n * (i ? 6 : 4), s = a ? n * 2 : n, c = o, l = r ? o * 2 : o, u = P("pattern", {
511
509
  id: e,
512
510
  x: 0,
513
511
  y: 0,
514
- width: A(c),
515
- height: A(l),
512
+ width: M(c),
513
+ height: M(l),
516
514
  patternUnits: "userSpaceOnUse"
517
515
  });
518
- u.appendChild(M("rect", {
519
- width: A(c),
520
- height: A(l),
516
+ u.appendChild(P("rect", {
517
+ width: M(c),
518
+ height: M(l),
521
519
  fill: t.fill,
522
- "fill-opacity": k(t.fillOpacity)
520
+ "fill-opacity": j(t.fillOpacity)
523
521
  }));
524
- let d = M("g", {
522
+ let d = P("g", {
525
523
  fill: "none",
526
524
  stroke: t.stroke,
527
- "stroke-opacity": k(t.strokeOpacity),
528
- "stroke-width": A(s),
525
+ "stroke-opacity": j(t.strokeOpacity),
526
+ "stroke-width": M(s),
529
527
  "stroke-linecap": "square"
530
528
  });
531
- return Ee(d, t.type, o, s), u.appendChild(d), u;
529
+ return Ae(d, t.type, o, s), u.appendChild(d), u;
532
530
  }
533
- function Ee(e, t, n, r) {
534
- let i = (t) => e.appendChild(M("path", { d: t })), a = (e) => A(e), o = (e) => {
531
+ function Ae(e, t, n, r) {
532
+ let i = (t) => e.appendChild(P("path", { d: t })), a = (e) => M(e), o = (e) => {
535
533
  for (let t of [
536
534
  -n,
537
535
  0,
@@ -560,10 +558,10 @@ function Ee(e, t, n, r) {
560
558
  case "dots":
561
559
  case "rings":
562
560
  case "ringsLarge": {
563
- let r = n * (t == "dots" ? .07 : t == "rings" ? .2 : .35), i = (t, n) => e.appendChild(M("circle", {
564
- cx: A(t),
565
- cy: A(n),
566
- r: A(r)
561
+ let r = n * (t == "dots" ? .07 : t == "rings" ? .2 : .35), i = (t, n) => e.appendChild(P("circle", {
562
+ cx: M(t),
563
+ cy: M(n),
564
+ r: M(r)
567
565
  }));
568
566
  i(n / 2, 0), i(n / 2, n * 2), i(0, n), i(n, n);
569
567
  break;
@@ -573,47 +571,47 @@ function Ee(e, t, n, r) {
573
571
  }
574
572
  //#endregion
575
573
  //#region ../core/src/rendering/svg/linkArcFadeMask.js
576
- function De(e, t, n, r) {
577
- let { normalX: i, normalY: a, offset: o, start: s, end: c } = r, l = i * o, u = a * o, d = e + "-gradient", f = M("linearGradient", {
574
+ function je(e, t, n, r) {
575
+ let { normalX: i, normalY: a, offset: o, start: s, end: c } = r, l = i * o, u = a * o, d = e + "-gradient", f = P("linearGradient", {
578
576
  id: d,
579
577
  gradientUnits: "userSpaceOnUse",
580
- x1: A(l - i * c),
581
- y1: A(u - a * c),
582
- x2: A(l + i * c),
583
- y2: A(u + a * c),
578
+ x1: M(l - i * c),
579
+ y1: M(u - a * c),
580
+ x2: M(l + i * c),
581
+ y2: M(u + a * c),
584
582
  spreadMethod: "pad"
585
583
  });
586
- for (let { offset: e, opacity: t } of S(s, c)) f.appendChild(M("stop", {
587
- offset: K(e, 3),
584
+ for (let { offset: e, opacity: t } of de(s, c)) f.appendChild(P("stop", {
585
+ offset: G(e, 3),
588
586
  "stop-color": "white",
589
- "stop-opacity": K(t, 3)
587
+ "stop-opacity": G(t, 3)
590
588
  }));
591
- let p = M("mask", {
589
+ let p = P("mask", {
592
590
  id: e,
593
591
  x: 0,
594
592
  y: 0,
595
- width: A(t),
596
- height: A(n),
593
+ width: M(t),
594
+ height: M(n),
597
595
  maskUnits: "userSpaceOnUse",
598
596
  maskContentUnits: "userSpaceOnUse",
599
597
  "mask-type": "luminance"
600
598
  });
601
- return p.appendChild(M("rect", {
602
- width: A(t),
603
- height: A(n),
599
+ return p.appendChild(P("rect", {
600
+ width: M(t),
601
+ height: M(n),
604
602
  fill: `url(#${d})`
605
603
  })), {
606
604
  gradient: f,
607
605
  mask: p
608
606
  };
609
607
  }
610
- function K(e, t) {
608
+ function G(e, t) {
611
609
  let n = 10 ** t;
612
610
  return Math.round(e * n) / n;
613
611
  }
614
612
  //#endregion
615
613
  //#region ../core/src/rendering/svg/svgViewRenderingContext.js
616
- var q = class extends s {
614
+ var K = class extends s {
617
615
  #e;
618
616
  #t;
619
617
  #n = [];
@@ -626,8 +624,8 @@ var q = class extends s {
626
624
  #l = /* @__PURE__ */ new Set();
627
625
  #u = !1;
628
626
  #d = /* @__PURE__ */ new Map();
629
- #f = new p();
630
- #p = M("g");
627
+ #f = new f();
628
+ #p = P("g");
631
629
  #m;
632
630
  #h;
633
631
  #g = [];
@@ -640,14 +638,14 @@ var q = class extends s {
640
638
  #C = 0;
641
639
  #w = 0;
642
640
  constructor(e, t) {
643
- super(e), this.width = t.width, this.height = t.height, this.#h = t.maxVectorInstances;
644
- let n = A(t.width), r = A(t.height);
645
- this.#e = M("svg", {
646
- xmlns: j,
641
+ super(e), this.width = t.width, this.height = t.height, this.textMetrics = t.textMetrics, this.#h = t.maxVectorInstances;
642
+ let n = M(t.width), r = M(t.height);
643
+ this.#e = P("svg", {
644
+ xmlns: N,
647
645
  width: n,
648
646
  height: r,
649
647
  viewBox: `0 0 ${n} ${r}`
650
- }), this.#t = M("defs"), this.#e.appendChild(this.#t), t.background != null && this.#e.appendChild(M("rect", {
648
+ }), this.#t = P("defs"), this.#e.appendChild(this.#t), t.background != null && this.#e.appendChild(P("rect", {
651
649
  width: n,
652
650
  height: r,
653
651
  fill: t.background,
@@ -688,42 +686,42 @@ var q = class extends s {
688
686
  for (let t of e.markGroupElements) t.childElementCount || t.remove();
689
687
  this.#m = void 0;
690
688
  }
691
- pushView(e, t) {
692
- let r = e.getPathString();
693
- if (n(this.#n)?.exportExcluded || i(e) && e.name.startsWith("scrollbar-")) {
689
+ pushView(t, n) {
690
+ let r = t.getPathString();
691
+ if (e(this.#n)?.exportExcluded || i(t) && t.name.startsWith("scrollbar-")) {
694
692
  this.#n.push({
695
- view: e,
693
+ view: t,
696
694
  node: this.currentNode,
697
- coords: t,
695
+ coords: n,
698
696
  exportExcluded: !0
699
697
  });
700
698
  return;
701
699
  }
702
700
  if (this.#u) {
703
701
  this.#n.push({
704
- view: e,
702
+ view: t,
705
703
  node: this.currentNode,
706
- coords: t,
704
+ coords: n,
707
705
  exportExcluded: !1
708
706
  });
709
707
  return;
710
708
  }
711
- let a = this.#m, o = a?.viewGroups.get(e);
709
+ let a = this.#m, o = a?.viewGroups.get(t);
712
710
  if (o) {
713
711
  if (o.parentNode !== this.currentNode) throw Error(`Sample-faceted view was rendered under multiple parents: ${r}`);
714
712
  } else {
715
- o = M("g", {
716
- id: Oe(e.name, this.#v++),
717
- "data-name": e.name,
713
+ o = P("g", {
714
+ id: q(t.name, this.#v++),
715
+ "data-name": t.name,
718
716
  "data-view-path": r
719
717
  });
720
- let t = M("title");
721
- t.textContent = r, o.appendChild(t), this.currentNode.appendChild(o), a?.viewGroups.set(e, o);
718
+ let e = P("title");
719
+ e.textContent = r, o.appendChild(e), this.currentNode.appendChild(o), a?.viewGroups.set(t, o);
722
720
  }
723
721
  this.#n.push({
724
- view: e,
722
+ view: t,
725
723
  node: o,
726
- coords: t,
724
+ coords: n,
727
725
  exportExcluded: !1
728
726
  });
729
727
  }
@@ -731,27 +729,28 @@ var q = class extends s {
731
729
  if (this.#n.pop()?.view !== e) throw Error("Unbalanced SVG view rendering context stack.");
732
730
  }
733
731
  renderMark(r, i) {
734
- if (n(this.#n)?.exportExcluded || r.unitView.getEffectiveOpacity() <= 0) return;
735
- let a = e(i), o = t(a, r.properties.clip, this.currentCoords), s = T(this.width, this.height, o);
736
- if (!l(s)) return;
732
+ if (e(this.#n)?.exportExcluded || r.unitView.getEffectiveOpacity() <= 0) return;
733
+ let a = t(i), o = n(a, r.properties.clip, this.currentCoords), s = m(this.width, this.height, o);
734
+ if (!h(s)) return;
737
735
  let c = this.getVisibleInstanceCount(r);
738
736
  if (!this.#u && this.#h != null && c == 0) return;
739
737
  if (!this.#u && this.#h != null && c > this.#h) {
740
738
  this.#T(r, s);
741
739
  return;
742
740
  }
743
- let u = !this.#u && this.#m != null, d = u ? this.getClipPathUrl(o) : void 0, f = u ? this.#m.markGroups.get(r)?.get(d ?? "") : void 0;
744
- !this.#u && !f && this.#E();
745
- let p = this.#u ? this.#p : this.#O(r, d), g = h(this.currentCoords, a, r.properties.cullByVisibleRange), _ = r.getOrder?.(), v = !this.#u && _ && _.isActive();
746
- if (m(r, i, this.currentCoords, this.#f, (e, t) => {
741
+ let l = !this.#u && this.#m != null, u = l ? this.getClipPathUrl(o) : void 0, d = l ? this.#m.markGroups.get(r)?.get(u ?? "") : void 0;
742
+ !this.#u && !d && this.#E();
743
+ let f = this.#u ? this.#p : this.#O(r, u), g = O(this.currentCoords, a, r.properties.cullByVisibleRange), _ = r.getOrder?.(), v = !this.#u && _ && _.isActive();
744
+ if (p(r, i, this.currentCoords, this.#f, (e, t) => {
747
745
  let n = (t, n = !1) => {
748
- let i = we(r, {
746
+ let i = Oe(r, {
749
747
  coords: e,
750
748
  data: t,
751
- group: p,
749
+ group: f,
752
750
  visibleBounds: s,
753
751
  anchorCullBounds: g,
754
752
  viewOpacity: r.unitView.getEffectiveOpacity(),
753
+ textMetrics: this.textMetrics,
755
754
  secondOrderPass: n,
756
755
  countOnly: this.#u,
757
756
  getViewportEdgeFadeMaskUrl: (e) => this.#u ? void 0 : this.getViewportEdgeFadeMaskUrl(e),
@@ -770,11 +769,11 @@ var q = class extends s {
770
769
  n(t);
771
770
  return;
772
771
  }
773
- let i = ae(t, 0, t.length, _.predicate, _.passes);
772
+ let i = oe(t, 0, t.length, _.predicate, _.passes);
774
773
  for (let [e, t] of i.entries()) t.length !== 0 && n(t, e === 1);
775
- }, (e) => this.#l.add(`SVG export could not resolve sample facet index ${e}. View: ${r.unitView.getPathString()}`)), !this.#u && !u && p.childElementCount > 0) {
774
+ }, (e) => this.#l.add(`SVG export could not resolve sample facet index ${e}. View: ${r.unitView.getPathString()}`)), !this.#u && !l && f.childElementCount > 0) {
776
775
  let e = this.getClipPathUrl(o);
777
- e && p.setAttribute("clip-path", e), this.currentNode.appendChild(p);
776
+ e && f.setAttribute("clip-path", e), this.currentNode.appendChild(f);
778
777
  }
779
778
  }
780
779
  #T(e, t) {
@@ -806,26 +805,26 @@ var q = class extends s {
806
805
  e && (this.#g.push(e), this.#_ = void 0);
807
806
  }
808
807
  #D(e) {
809
- let t = ke(e.viewNodes), n = e.targets.map((e) => e.mark.getType()), r = M("g", {
808
+ let t = Me(e.viewNodes), n = e.targets.map((e) => e.mark.getType()), r = P("g", {
810
809
  id: `rasterized-${n.join("-")}-${this.#w++}`,
811
810
  "data-name": `Rasterized ${n.join(", ")}`,
812
811
  "data-rasterized": ""
813
- }), i = M("image", { preserveAspectRatio: "none" });
812
+ }), i = P("image", { preserveAspectRatio: "none" });
814
813
  r.appendChild(i);
815
814
  let a = e.anchor.parentNode;
816
- t == a ? t.insertBefore(r, e.anchor) : t.insertBefore(r, Ae(a, t)), e.anchor.remove();
817
- for (let n of e.viewNodes) je(n, t);
815
+ t == a ? t.insertBefore(r, e.anchor) : t.insertBefore(r, Ne(a, t)), e.anchor.remove();
816
+ for (let n of e.viewNodes) Pe(n, t);
818
817
  e.image = i;
819
818
  }
820
819
  #O(e, t) {
821
820
  let n = this.#m;
822
- if (!n) return M("g", { "data-mark-type": e.getType() });
821
+ if (!n) return P("g", { "data-mark-type": e.getType() });
823
822
  let r = n.markGroups.get(e);
824
823
  r || (r = /* @__PURE__ */ new Map(), n.markGroups.set(e, r));
825
824
  let i = t ?? "", a = r.get(i);
826
825
  if (a) {
827
826
  if (a.parentNode !== this.currentNode) throw Error(`Sample-faceted mark was rendered under multiple parents: ${e.unitView.getPathString()}`);
828
- } else a = M("g", { "data-mark-type": e.getType() }), t && a.setAttribute("clip-path", t), this.currentNode.appendChild(a), r.set(i, a), n.markGroupElements.add(a);
827
+ } else a = P("g", { "data-mark-type": e.getType() }), t && a.setAttribute("clip-path", t), this.currentNode.appendChild(a), r.set(i, a), n.markGroupElements.add(a);
829
828
  return a;
830
829
  }
831
830
  getClipPathUrl(e) {
@@ -835,14 +834,14 @@ var q = class extends s {
835
834
  e.clipY ? t.y : 0,
836
835
  e.clipX ? t.width : this.width,
837
836
  e.clipY ? t.height : this.height
838
- ].map(A), r = n.join(","), i = this.#r.get(r);
837
+ ].map(M), r = n.join(","), i = this.#r.get(r);
839
838
  if (!i) {
840
839
  i = "clip-" + this.#y++;
841
- let e = M("clipPath", {
840
+ let e = P("clipPath", {
842
841
  id: i,
843
842
  clipPathUnits: "userSpaceOnUse"
844
843
  });
845
- e.appendChild(M("rect", {
844
+ e.appendChild(P("rect", {
846
845
  x: n[0],
847
846
  y: n[1],
848
847
  width: n[2],
@@ -852,28 +851,28 @@ var q = class extends s {
852
851
  return `url(#${i})`;
853
852
  }
854
853
  getShadowFilterUrl(e) {
855
- let t = A(Math.max(e.blur / 2.5, .25)), n = A(e.offsetX), r = A(e.offsetY), i = [
854
+ let t = M(Math.max(e.blur / 2.5, .25)), n = M(e.offsetX), r = M(e.offsetY), i = [
856
855
  t,
857
856
  n,
858
857
  r
859
858
  ].join(","), a = this.#a.get(i);
860
859
  if (!a) {
861
860
  a = "shadow-" + this.#x++;
862
- let e = M("filter", {
861
+ let e = P("filter", {
863
862
  id: a,
864
863
  x: 0,
865
864
  y: 0,
866
- width: A(this.width),
867
- height: A(this.height),
865
+ width: M(this.width),
866
+ height: M(this.height),
868
867
  filterUnits: "userSpaceOnUse",
869
868
  primitiveUnits: "userSpaceOnUse",
870
869
  "color-interpolation-filters": "sRGB"
871
870
  });
872
- e.appendChild(M("feGaussianBlur", {
871
+ e.appendChild(P("feGaussianBlur", {
873
872
  in: "SourceGraphic",
874
873
  stdDeviation: t,
875
874
  result: "blur"
876
- })), e.appendChild(M("feOffset", {
875
+ })), e.appendChild(P("feOffset", {
877
876
  in: "blur",
878
877
  dx: n,
879
878
  dy: r,
@@ -886,12 +885,12 @@ var q = class extends s {
886
885
  let t = this.#o.get(e);
887
886
  if (!t) {
888
887
  t = "shadow-clip-" + this.#y++;
889
- let n = M("clipPath", {
888
+ let n = P("clipPath", {
890
889
  id: t,
891
890
  clipPathUnits: "userSpaceOnUse"
892
891
  });
893
- n.appendChild(M("path", {
894
- d: `M 0 0 V ${A(this.height)} H ${A(this.width)} V 0 Z ${e}`,
892
+ n.appendChild(P("path", {
893
+ d: `M 0 0 V ${M(this.height)} H ${M(this.width)} V 0 Z ${e}`,
895
894
  "clip-rule": "evenodd",
896
895
  "fill-rule": "evenodd"
897
896
  })), this.#t.appendChild(n), this.#o.set(e, t);
@@ -902,68 +901,68 @@ var q = class extends s {
902
901
  let t = JSON.stringify([
903
902
  e.type,
904
903
  e.fill,
905
- k(e.fillOpacity),
904
+ j(e.fillOpacity),
906
905
  e.stroke,
907
- k(e.strokeOpacity),
908
- k(e.strokeWidth)
906
+ j(e.strokeOpacity),
907
+ j(e.strokeWidth)
909
908
  ]), n = this.#s.get(t);
910
- return n || (n = "rect-hatch-" + this.#S++, this.#t.appendChild(Te(n, e)), this.#s.set(t, n)), `url(#${n})`;
909
+ return n || (n = "rect-hatch-" + this.#S++, this.#t.appendChild(ke(n, e)), this.#s.set(t, n)), `url(#${n})`;
911
910
  }
912
911
  getLegendGradientUrl(e) {
913
- let t = "legend-gradient-" + this.#C++, n = M("linearGradient", {
912
+ let t = "legend-gradient-" + this.#C++, n = P("linearGradient", {
914
913
  id: t,
915
914
  gradientUnits: "userSpaceOnUse",
916
- x1: A(e.x1),
917
- y1: A(e.y1),
918
- x2: A(e.x2),
919
- y2: A(e.y2)
915
+ x1: M(e.x1),
916
+ y1: M(e.y1),
917
+ x2: M(e.x2),
918
+ y2: M(e.y2)
920
919
  });
921
- for (let t of e.stops) n.appendChild(M("stop", {
922
- offset: k(t.offset),
920
+ for (let t of e.stops) n.appendChild(P("stop", {
921
+ offset: j(t.offset),
923
922
  "stop-color": t.color
924
923
  }));
925
924
  return this.#t.appendChild(n), `url(#${t})`;
926
925
  }
927
926
  getLinkArcFadeMaskUrl(e) {
928
- let t = _(e.p1, e.p4, e.distances);
927
+ let t = x(e.p1, e.p4, e.distances);
929
928
  if (!t) return;
930
929
  let n = this.#c.get(t.key);
931
930
  if (!n) {
932
931
  n = "link-arc-fade-" + this.#b++;
933
- let { gradient: e, mask: r } = De(n, this.width, this.height, t);
932
+ let { gradient: e, mask: r } = je(n, this.width, this.height, t);
934
933
  this.#t.appendChild(e), this.#t.appendChild(r), this.#c.set(t.key, n);
935
934
  }
936
935
  return `url(#${n})`;
937
936
  }
938
- getViewportEdgeFadeMaskUrl(e) {
939
- let t = Object.entries(e).filter(([, e]) => e.width > 0 && Number.isFinite(e.distance));
940
- if (!t.length) return;
941
- let r = n(this.#n);
937
+ getViewportEdgeFadeMaskUrl(t) {
938
+ let n = Object.entries(t).filter(([, e]) => e.width > 0 && Number.isFinite(e.distance));
939
+ if (!n.length) return;
940
+ let r = e(this.#n);
942
941
  if (!r) throw Error("No current view in SVG rendering context.");
943
942
  let i = this.#i.get(r.view);
944
943
  if (!i) {
945
944
  i = "edge-fade-" + this.#b++;
946
- let e = A(this.width), n = A(this.height), a = M("mask", {
945
+ let e = M(this.width), t = M(this.height), a = P("mask", {
947
946
  id: i,
948
947
  x: 0,
949
948
  y: 0,
950
949
  width: e,
951
- height: n,
950
+ height: t,
952
951
  maskUnits: "userSpaceOnUse",
953
952
  maskContentUnits: "userSpaceOnUse",
954
953
  "mask-type": "luminance"
955
954
  });
956
- a.appendChild(M("rect", {
955
+ a.appendChild(P("rect", {
957
956
  width: e,
958
- height: n,
957
+ height: t,
959
958
  fill: "white"
960
959
  }));
961
- for (let [o, s] of t) {
962
- let t = i + "-" + o, c = Me(t, o, s, r.coords);
963
- this.#t.appendChild(c), a.appendChild(M("rect", {
960
+ for (let [o, s] of n) {
961
+ let n = i + "-" + o, c = Fe(n, o, s, r.coords);
962
+ this.#t.appendChild(c), a.appendChild(P("rect", {
964
963
  width: e,
965
- height: n,
966
- fill: `url(#${t})`
964
+ height: t,
965
+ fill: `url(#${n})`
967
966
  }));
968
967
  }
969
968
  this.#t.appendChild(a), this.#i.set(r.view, i);
@@ -977,52 +976,52 @@ var q = class extends s {
977
976
  return Array.from(this.#l);
978
977
  }
979
978
  get currentNode() {
980
- return n(this.#n)?.node ?? this.#e;
979
+ return e(this.#n)?.node ?? this.#e;
981
980
  }
982
981
  get currentCoords() {
983
- let e = n(this.#n);
984
- if (!e) throw Error("No current view in SVG rendering context.");
985
- return e.coords;
982
+ let t = e(this.#n);
983
+ if (!t) throw Error("No current view in SVG rendering context.");
984
+ return t.coords;
986
985
  }
987
986
  };
988
- function Oe(e, t) {
987
+ function q(e, t) {
989
988
  let n = e.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^A-Za-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
990
989
  return `${/^[A-Za-z_]/.test(n) ? n : n ? "view-" + n : "view"}-${t}`;
991
990
  }
992
991
  function J(e, t) {
993
992
  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);
994
993
  }
995
- function ke(e) {
994
+ function Me(e) {
996
995
  let [t, ...n] = Array.from(e), r = t;
997
996
  for (; n.some((e) => !r.contains(e));) r = r.parentNode;
998
997
  return r;
999
998
  }
1000
- function Ae(e, t) {
999
+ function Ne(e, t) {
1001
1000
  let n = e;
1002
1001
  for (; n.parentNode != t;) n = n.parentNode;
1003
1002
  return n;
1004
1003
  }
1005
- function je(e, t) {
1004
+ function Pe(e, t) {
1006
1005
  let n = e;
1007
1006
  for (; n != t && n.matches("g[data-view-path]") && Array.from(n.children).every((e) => e.tagName == "title");) {
1008
1007
  let e = n.parentNode;
1009
1008
  n.remove(), n = e;
1010
1009
  }
1011
1010
  }
1012
- function Me(e, t, n, r) {
1013
- 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 = M("linearGradient", {
1011
+ function Fe(e, t, n, r) {
1012
+ 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 = P("linearGradient", {
1014
1013
  id: e,
1015
1014
  gradientUnits: "userSpaceOnUse",
1016
- x1: A(a ? i : 0),
1017
- y1: A(a ? 0 : i),
1018
- x2: A(a ? o : 0),
1019
- y2: A(a ? 0 : o)
1015
+ x1: M(a ? i : 0),
1016
+ y1: M(a ? 0 : i),
1017
+ x2: M(a ? o : 0),
1018
+ y2: M(a ? 0 : o)
1020
1019
  });
1021
- return s.appendChild(M("stop", {
1020
+ return s.appendChild(P("stop", {
1022
1021
  offset: 0,
1023
1022
  "stop-color": "black",
1024
1023
  "stop-opacity": 1
1025
- })), s.appendChild(M("stop", {
1024
+ })), s.appendChild(P("stop", {
1026
1025
  offset: 1,
1027
1026
  "stop-color": "black",
1028
1027
  "stop-opacity": 0
@@ -1030,22 +1029,24 @@ function Me(e, t, n, r) {
1030
1029
  }
1031
1030
  //#endregion
1032
1031
  //#region ../core/src/rendering/svg/index.js
1033
- function Y({ viewRoot: e, logicalWidth: t, logicalHeight: n, background: r = "white" }) {
1034
- let i = new q({ picking: !1 }, {
1032
+ function Y({ viewRoot: e, logicalWidth: t, logicalHeight: n, background: r = "white", textMetrics: i = e.context.textMetrics }) {
1033
+ let a = new K({ picking: !1 }, {
1035
1034
  width: t,
1036
1035
  height: n,
1037
- background: r
1036
+ background: r,
1037
+ textMetrics: i
1038
1038
  });
1039
- return c(e, o.create(0, 0, t, n), { renderingOptions: { firstFacet: !0 } }).collectRenderCommands(i), {
1040
- svg: i.getSvg(),
1041
- warnings: i.getWarnings()
1039
+ return c(e, o.create(0, 0, t, n), { renderingOptions: { firstFacet: !0 } }).collectRenderCommands(a), {
1040
+ svg: a.getSvg(),
1041
+ warnings: a.getWarnings()
1042
1042
  };
1043
1043
  }
1044
- function Ne({ viewRoot: e, logicalWidth: t, logicalHeight: n }) {
1045
- let r = new q({ picking: !1 }, {
1044
+ async function Ie({ viewRoot: e, logicalWidth: t, logicalHeight: n }) {
1045
+ let r = new K({ picking: !1 }, {
1046
1046
  width: t,
1047
1047
  height: n,
1048
- background: null
1048
+ background: null,
1049
+ textMetrics: await Z(e)
1049
1050
  });
1050
1051
  return r.beginInstanceCounting(), c(e, o.create(0, 0, t, n), { renderingOptions: { firstFacet: !0 } }).collectRenderCommands(r), r.endInstanceCounting(), { layers: Array.from(r.getVisibleInstanceCounts(), ([e, t]) => ({
1051
1052
  viewName: e.unitView.name,
@@ -1055,36 +1056,41 @@ function Ne({ viewRoot: e, logicalWidth: t, logicalHeight: n }) {
1055
1056
  instanceCount: t
1056
1057
  })).filter((e) => e.instanceCount > 0) };
1057
1058
  }
1058
- async function X(e) {
1059
- let t = e.rasterization;
1060
- return t ? ($(t), e.rasterizeSvgRuns ? Z({
1059
+ async function Le(e) {
1060
+ let t = await Z(e.viewRoot), n = {
1061
1061
  ...e,
1062
+ textMetrics: t
1063
+ }, r = e.rasterization;
1064
+ return r ? ($(r), e.rasterizeSvgRuns ? X({
1065
+ ...n,
1062
1066
  rasterizeSvgRuns: e.rasterizeSvgRuns,
1063
- maxVectorInstances: t.maxVectorInstances,
1064
- pixelRatio: t.pixelRatio
1065
- }) : Q(e)) : {
1066
- ...Y(e),
1067
+ maxVectorInstances: r.maxVectorInstances,
1068
+ pixelRatio: r.pixelRatio
1069
+ }) : Q(n)) : {
1070
+ ...Y(n),
1067
1071
  rasterized: []
1068
1072
  };
1069
1073
  }
1070
- async function Z({ viewRoot: e, rasterizeSvgRuns: t, logicalWidth: n, logicalHeight: r, background: i = "white", maxVectorInstances: s, pixelRatio: l = 2 }) {
1071
- $({
1074
+ async function X({ viewRoot: e, rasterizeSvgRuns: t, logicalWidth: n, logicalHeight: r, background: i = "white", maxVectorInstances: s, pixelRatio: l = 2, textMetrics: u }) {
1075
+ u ??= await Z(e), $({
1072
1076
  maxVectorInstances: s,
1073
1077
  pixelRatio: l
1074
1078
  });
1075
- let u = new q({ picking: !1 }, {
1079
+ let d = new K({ picking: !1 }, {
1076
1080
  width: n,
1077
1081
  height: r,
1078
1082
  background: i,
1079
- maxVectorInstances: s
1080
- }), d = c(e, o.create(0, 0, n, r), { renderingOptions: { firstFacet: !0 } });
1081
- u.beginInstanceCounting(), d.collectRenderCommands(u), u.endInstanceCounting(), d.collectRenderCommands(u);
1082
- let f = u.getRasterRuns();
1083
- if (f.length) try {
1083
+ maxVectorInstances: s,
1084
+ textMetrics: u
1085
+ }), f = c(e, o.create(0, 0, n, r), { renderingOptions: { firstFacet: !0 } });
1086
+ d.beginInstanceCounting(), f.collectRenderCommands(d), d.endInstanceCounting(), f.collectRenderCommands(d);
1087
+ let p = d.getRasterRuns();
1088
+ if (p.length) try {
1084
1089
  await t({
1085
- runs: f,
1090
+ runs: p,
1086
1091
  viewRoot: e,
1087
- layoutResult: d,
1092
+ layoutResult: f,
1093
+ textMetrics: u,
1088
1094
  logicalWidth: n,
1089
1095
  logicalHeight: r,
1090
1096
  pixelRatio: l
@@ -1094,14 +1100,15 @@ async function Z({ viewRoot: e, rasterizeSvgRuns: t, logicalWidth: n, logicalHei
1094
1100
  viewRoot: e,
1095
1101
  logicalWidth: n,
1096
1102
  logicalHeight: r,
1097
- background: i
1103
+ background: i,
1104
+ textMetrics: u
1098
1105
  });
1099
1106
  throw t;
1100
1107
  }
1101
1108
  return {
1102
- svg: u.getSvg(),
1103
- warnings: u.getWarnings(),
1104
- rasterized: f.map((e) => ({
1109
+ svg: d.getSvg(),
1110
+ warnings: d.getWarnings(),
1111
+ rasterized: p.map((e) => ({
1105
1112
  targets: e.targets.map((e) => ({
1106
1113
  markType: e.mark.getType(),
1107
1114
  instanceCount: e.instanceCount
@@ -1112,6 +1119,11 @@ async function Z({ viewRoot: e, rasterizeSvgRuns: t, logicalWidth: n, logicalHei
1112
1119
  }))
1113
1120
  };
1114
1121
  }
1122
+ async function Z(e) {
1123
+ if (!document.fonts) return e.context.textMetrics;
1124
+ let t = te(document);
1125
+ return await ie(t, e), t;
1126
+ }
1115
1127
  function Q(e) {
1116
1128
  let t = Y(e);
1117
1129
  return {
@@ -1125,4 +1137,4 @@ function $(e) {
1125
1137
  if (e.pixelRatio != null && (!Number.isFinite(e.pixelRatio) || e.pixelRatio <= 0)) throw RangeError("SVG raster pixelRatio must be positive.");
1126
1138
  }
1127
1139
  //#endregion
1128
- export { Ne as analyzeSvgExport, Z as createRasterizedSvg, Y as createSvg, X as createSvgExport };
1140
+ export { Ie as analyzeSvgExport, X as createRasterizedSvg, Y as createSvg, Le as createSvgExport };