@genome-spy/app 0.88.1 → 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-BIpg3JKh.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 -362
  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-tZfZ8y3q.js → webgl-CZX2pe5v.js} +2319 -972
  36. package/dist/{webgl-CTJt7jQd.js → webgl-CexXSw_I.js} +2371 -1024
  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
@@ -0,0 +1,1056 @@
1
+ import { Kt as e, Nt as t, mt as n, un as r, xn as i } from "./clipOptions-8BPf0WMZ.js";
2
+ import { i as a } from "./rasterization-D0tOoKu_.js";
3
+ import { t as o } from "./rectangle-DE98gIxF.js";
4
+ //#region ../core/src/rendering/immediate/markData.js
5
+ var s = [], c = class {
6
+ #e = {
7
+ x: 0,
8
+ y: 0,
9
+ width: 0,
10
+ height: 0
11
+ };
12
+ #t = new o(() => this.#e.x, () => this.#e.y, () => this.#e.width, () => this.#e.height);
13
+ #n;
14
+ #r = 0;
15
+ #i = 0;
16
+ #a = NaN;
17
+ #o = NaN;
18
+ #s = NaN;
19
+ resolveFacet(e, t) {
20
+ this.#c(e);
21
+ let n = t.locSize.location, r = t.locSize.size;
22
+ return (this.#a !== n || this.#o !== r || this.#s !== t.pixelToUnit) && (this.#l(n, r, t.pixelToUnit), this.#a = n, this.#o = r, this.#s = t.pixelToUnit), this.#t;
23
+ }
24
+ resolvePlacement(e, t, n) {
25
+ if (!t) return;
26
+ let r = t.getSnapshot().rectangles, i = n * 4;
27
+ if (!(i + 3 >= r.length)) return this.#c(e), this.#l(r[i + 1], r[i + 3], 1), this.#a = NaN, this.#o = NaN, this.#s = NaN, this.#t;
28
+ }
29
+ #c(e) {
30
+ this.#n !== e && (this.#e.x = e.x, this.#r = e.y, this.#e.width = e.width, this.#i = e.height, this.#n = e, this.#a = NaN, this.#o = NaN, this.#s = NaN);
31
+ }
32
+ #l(e, t, n) {
33
+ this.#e.y = this.#r + e * n * this.#i, this.#e.height = t * n * this.#i;
34
+ }
35
+ };
36
+ function l(e, t) {
37
+ let n = e.unitView.getCollector();
38
+ if (!n) throw Error(`Cannot render an uninitialized mark. View: ${e.unitView.getPathString()}`);
39
+ let r = n.facetBatches.get(void 0);
40
+ return r?.length ? r : n.facetBatches.get(t.facetId) ?? s;
41
+ }
42
+ function u(e, t, n, r, i, a) {
43
+ let o = l(e, t);
44
+ if (t.sampleFacetRenderingOptions) i(r.resolveFacet(n, t.sampleFacetRenderingOptions), o);
45
+ else if (e.encoders.facetIndex) for (let [s, c] of d(e.encoders.facetIndex, o)) {
46
+ let e = r.resolvePlacement(n, t.placement?.source, s);
47
+ e ? i(e, c) : a(s);
48
+ }
49
+ else i(n, o);
50
+ }
51
+ function d(e, t) {
52
+ let n = /* @__PURE__ */ new Map();
53
+ for (let r of t) {
54
+ let t = +e(r), i = n.get(t);
55
+ i || (i = [], n.set(t, i)), i.push(r);
56
+ }
57
+ return n;
58
+ }
59
+ //#endregion
60
+ //#region ../core/src/rendering/immediate/bounds.js
61
+ function f(e, t, n) {
62
+ return {
63
+ x1: n?.clipX ? Math.max(0, n.rect.x) : 0,
64
+ y1: n?.clipY ? Math.max(0, n.rect.y) : 0,
65
+ x2: n?.clipX ? Math.min(e, n.rect.x2) : e,
66
+ y2: n?.clipY ? Math.min(t, n.rect.y2) : t
67
+ };
68
+ }
69
+ function p(e, t, n) {
70
+ let r = n === !0 || n === "x", i = n === !0 || n === "y";
71
+ return {
72
+ x1: r ? t?.clipX ? t.rect.x : e.x : -Infinity,
73
+ y1: i ? t?.clipY ? t.rect.y : e.y : -Infinity,
74
+ x2: r ? t?.clipX ? t.rect.x2 : e.x2 : Infinity,
75
+ y2: i ? t?.clipY ? t.rect.y2 : e.y2 : Infinity
76
+ };
77
+ }
78
+ function m(e) {
79
+ return e.x1 <= e.x2 && e.y1 <= e.y2;
80
+ }
81
+ function h(e, t, n) {
82
+ return t < e.x1 || t > e.x2 || n < e.y1 || n > e.y2;
83
+ }
84
+ function g(e, t, n, r, i, a = 0) {
85
+ return !(Math.max(t, r) + a < e.x1 || Math.min(t, r) - a > e.x2 || Math.max(n, i) + a < e.y1 || Math.min(n, i) - a > e.y2);
86
+ }
87
+ //#endregion
88
+ //#region ../core/src/rendering/immediate/geometry/polygonUnion.js
89
+ var _ = 1e-8;
90
+ function v(e) {
91
+ let t = e.flatMap((e, t) => e.map((n, r) => ({
92
+ a: n,
93
+ b: e[(r + 1) % e.length],
94
+ polygonIndex: t
95
+ }))), n = [];
96
+ for (let r of t) {
97
+ let i = [0, 1];
98
+ for (let e of t) r.polygonIndex != e.polygonIndex && y(r, e, i);
99
+ i.sort((e, t) => e - t);
100
+ for (let t = 0; t < i.length - 1; t++) {
101
+ let a = i[t], o = i[t + 1];
102
+ if (o - a <= _) continue;
103
+ let s = T(r.a, r.b, a), c = T(r.a, r.b, o), l = T(s, c, .5);
104
+ e.some((e, t) => t != r.polygonIndex && C(l, e)) || n.push({
105
+ a: s,
106
+ b: c,
107
+ polygonIndex: r.polygonIndex
108
+ });
109
+ }
110
+ }
111
+ return S(x(n));
112
+ }
113
+ function y(e, t, n) {
114
+ let r = D(e.b, e.a), i = D(t.b, t.a), a = D(t.a, e.a), o = k(r, i);
115
+ if (Math.abs(o) > _) {
116
+ let e = k(a, i) / o, t = k(a, r) / o;
117
+ e > _ && e < 1 - _ && t >= -1e-8 && t <= 1.00000001 && n.push(e);
118
+ } else Math.abs(k(a, r)) <= _ && (b(e, t.a, n), b(e, t.b, n));
119
+ }
120
+ function b(e, t, n) {
121
+ let r = D(e.b, e.a), i = O(r, r), a = O(D(t, e.a), r) / i;
122
+ a > _ && a < 1 - _ && n.push(a);
123
+ }
124
+ function x(e) {
125
+ let t = /* @__PURE__ */ new Map();
126
+ for (let n of e) {
127
+ let e = E(n.a) + ":" + E(n.b), r = E(n.b) + ":" + E(n.a);
128
+ t.has(r) ? t.delete(r) : t.has(e) || t.set(e, n);
129
+ }
130
+ return Array.from(t.values());
131
+ }
132
+ function S(e) {
133
+ let t = /* @__PURE__ */ new Map();
134
+ for (let n of e) {
135
+ let e = E(n.a), r = t.get(e) ?? [];
136
+ r.push(n), t.set(e, r);
137
+ }
138
+ let n = new Set(e), r = [];
139
+ for (; n.size;) {
140
+ let e = n.values().next().value, i = [e.a], a = e;
141
+ for (;;) {
142
+ if (n.delete(a), i.push(a.b), E(a.b) == E(i[0])) {
143
+ i.pop();
144
+ break;
145
+ }
146
+ let e = (t.get(E(a.b)) ?? []).find((e) => n.has(e));
147
+ if (!e) throw Error("Cannot chain SVG polygon union boundary.");
148
+ a = e;
149
+ }
150
+ r.push(i);
151
+ }
152
+ return r;
153
+ }
154
+ function C(e, t) {
155
+ let n = !1;
156
+ for (let r = 0, i = t.length - 1; r < t.length; i = r++) {
157
+ let a = t[i], o = t[r];
158
+ if (w(e, a, o)) return !1;
159
+ a.y > e.y != o.y > e.y && e.x < (o.x - a.x) * (e.y - a.y) / (o.y - a.y) + a.x && (n = !n);
160
+ }
161
+ return n;
162
+ }
163
+ function w(e, t, n) {
164
+ return Math.abs(k(D(e, t), D(n, t))) <= _ && O(D(e, t), D(e, n)) <= _;
165
+ }
166
+ function T(e, t, n) {
167
+ return {
168
+ x: e.x + (t.x - e.x) * n,
169
+ y: e.y + (t.y - e.y) * n
170
+ };
171
+ }
172
+ function E(e) {
173
+ return `${Math.round(e.x / _)},${Math.round(e.y / _)}`;
174
+ }
175
+ function D(e, t) {
176
+ return {
177
+ x: e.x - t.x,
178
+ y: e.y - t.y
179
+ };
180
+ }
181
+ function O(e, t) {
182
+ return e.x * t.x + e.y * t.y;
183
+ }
184
+ function k(e, t) {
185
+ return e.x * t.y - e.y * t.x;
186
+ }
187
+ //#endregion
188
+ //#region ../core/src/rendering/immediate/markEncoding.js
189
+ function A(e, t, n) {
190
+ return e.x + t * e.width + n;
191
+ }
192
+ function j(e, t, n) {
193
+ return e.y + (1 - t) * e.height + n;
194
+ }
195
+ function M(e, t, n, r = [0, 0]) {
196
+ return F(e, t.x, t.x2, t.xOffset, t.x2Offset, n, A, r);
197
+ }
198
+ function N(e, t, n, r = [0, 0]) {
199
+ return F(e, t.y, t.y2, t.yOffset, t.y2Offset, n, j, r);
200
+ }
201
+ function P(e, t, n, r) {
202
+ let i = t[n], a = t[n + "2"], o = t[n + "Offset"], s = t[n + "2Offset"], c = n == "x" ? e.width : e.height, l = n == "x" ? e.x : e.y + c, u = n == "x" ? c : -c, d = R(i), f = a ? R(a) : 0, p = i.constant ? I(i, r) + d : 0, m = a?.constant ? I(a, r) + f : 0, h = o.constant ? I(o, r) : 0, g = a && s?.constant ? I(s, r) : 0;
203
+ return (e, t) => {
204
+ let n = o.constant ? h : I(o, e), r = i.constant ? p : I(i, e) + d, c = l + r * u + n, _ = c;
205
+ if (a) {
206
+ let t = a.constant ? m : I(a, e) + f, r = s ? s.constant ? g : I(s, e) : n;
207
+ _ = l + t * u + r;
208
+ }
209
+ return t[0] = c, t[1] = _, t;
210
+ };
211
+ }
212
+ function F(e, t, n, r, i, a, o, s) {
213
+ let c = I(r, a), l = o(e, L(t, a), c), u = n ? o(e, L(n, a), i ? I(i, a) : c) : l;
214
+ return s[0] = l, s[1] = u, s;
215
+ }
216
+ function I(e, t) {
217
+ return e(t);
218
+ }
219
+ function L(e, t) {
220
+ return I(e, t) + R(e);
221
+ }
222
+ function R(e) {
223
+ let t = e.scale;
224
+ if (!t) return 0;
225
+ let n = e.channelDef;
226
+ return a(t, n && "band" in n ? n.band ?? .5 : .5);
227
+ }
228
+ function z(e, t) {
229
+ return V(e(t));
230
+ }
231
+ function B(e, n) {
232
+ return t(n) ? e.unitView.paramRuntime.evaluateAndGet(n.expr) : n;
233
+ }
234
+ function V(e) {
235
+ return e == null ? "none" : "" + e;
236
+ }
237
+ //#endregion
238
+ //#region ../core/src/rendering/immediate/marks/arrow.js
239
+ function H(e) {
240
+ let t = e.properties, n = B(e, t.headSpacing);
241
+ return {
242
+ configuredRHeadSlope: ce(B(e, t.headAngle)),
243
+ configuredRHeadNotchSlope: ce(B(e, t.headNotchAngle)),
244
+ headShape: B(e, t.headShape),
245
+ headWidth: B(e, t.headWidth),
246
+ minSize: B(e, t.minSize),
247
+ stem: B(e, t.stem),
248
+ startNotch: B(e, t.startNotch),
249
+ minStemLength: B(e, t.minStemLength),
250
+ headSpacing: n,
251
+ repeatHeads: n != null && n >= 0,
252
+ headPlacement: B(e, t.headPlacement)
253
+ };
254
+ }
255
+ function ee(e, t, n, r) {
256
+ let { viewOpacity: i } = n, a = e.encoders;
257
+ return U(e, t, n, (e) => {
258
+ let n = t.stem ? re(e.tail, e.tip, e.tangent, e.normal, e.stemHalfWidth, e.rHeadSlope, t.startNotch && !e.bidirectional, e.bidirectional) : null, o = n ? [n] : [];
259
+ W(e, (t, n, r, i) => {
260
+ let a = {
261
+ x: t,
262
+ y: n
263
+ };
264
+ o.push(e.renderedHeadShape == "open" ? ie(a, r, i, e.headHalfWidth, e.rHeadSlope, e.rHeadNotchSlope, e.size) : ne(a, r, i, e.headHalfWidth, e.rHeadSlope, e.rHeadNotchSlope));
265
+ });
266
+ let s = V(a.stroke(e.datum)) != "none" && I(a.strokeOpacity, e.datum) * i > 0 && e.strokeWidth > 0;
267
+ r({
268
+ datum: e.datum,
269
+ boundaryLoops: o.length == 1 || !s ? o : v(o),
270
+ strokeWidth: e.strokeWidth,
271
+ headShapeFallback: e.headShapeFallback
272
+ });
273
+ });
274
+ }
275
+ function U(e, t, n, r) {
276
+ let { coords: i, data: a, visibleBounds: o, countOnly: s } = n, c = e.encoders;
277
+ if (a.length == 0) return 0;
278
+ let l = P(i, c, "x", a[0]), u = P(i, c, "y", a[0]), d = [0, 0], f = [0, 0], p = {
279
+ datum: {},
280
+ tail: {
281
+ x: 0,
282
+ y: 0
283
+ },
284
+ tip: {
285
+ x: 0,
286
+ y: 0
287
+ },
288
+ tangent: {
289
+ x: 0,
290
+ y: 0
291
+ },
292
+ normal: {
293
+ x: 0,
294
+ y: 0
295
+ },
296
+ reverseTangent: {
297
+ x: 0,
298
+ y: 0
299
+ },
300
+ reverseNormal: {
301
+ x: 0,
302
+ y: 0
303
+ },
304
+ size: 0,
305
+ stemHalfWidth: 0,
306
+ headHalfWidth: 0,
307
+ headAxisLength: 0,
308
+ rHeadSlope: 0,
309
+ rHeadNotchSlope: 0,
310
+ strokeWidth: 0,
311
+ repeatSpacing: Infinity,
312
+ headRepeatFootprint: 0,
313
+ geometryLength: 0,
314
+ bidirectional: !1,
315
+ stemContainsHead: !1,
316
+ renderedHeadShape: "triangle",
317
+ headShapeFallback: !1
318
+ }, m = 0;
319
+ for (let e of a) {
320
+ l(e, d), u(e, f);
321
+ let n = te(c.direction, e), i = n == "reverse", a = n == "both", h = i ? d[1] : d[0], _ = i ? f[1] : f[0], v = i ? d[0] : d[1], y = i ? f[0] : f[1], b = v - h, x = y - _, S = Math.hypot(b, x);
322
+ if (S == 0) continue;
323
+ let C = b / S, w = x / S, T = Math.max(I(c.size, e), t.minSize), E = T / 2, D = Math.max(t.headWidth * T, 0) / 2, O = ae({
324
+ segmentLength: S,
325
+ headHalfWidth: D,
326
+ stemHalfWidth: t.stem ? E : -E,
327
+ configuredRHeadSlope: t.configuredRHeadSlope,
328
+ configuredRHeadNotchSlope: t.configuredRHeadNotchSlope,
329
+ headRepeat: t.repeatHeads && !a,
330
+ headPlacement: t.headPlacement,
331
+ startNotch: t.startNotch && !a,
332
+ minStemLength: t.minStemLength,
333
+ headShape: t.headShape,
334
+ bidirectional: a
335
+ }), k = t.headShape == "open" ? O : Math.min(t.configuredRHeadNotchSlope, O), A = t.headShape == "open" ? T : 0, j = t.headPlacement == "outside" ? se(D, O, k, A) : 0, M = v + C * j, N = y + w * j;
336
+ a && (h -= C * j, _ -= w * j);
337
+ let P = D * O, F = Math.hypot(D, P), L = t.headShape == "open" && F > 0 ? T * D / F : 0, R = M - C * (P + L), z = N - w * (P + L), B = a ? h + C * (P + L) : h, V = a ? _ + w * (P + L) : _, H = I(c.strokeWidth, e), ee = Math.max(t.stem ? E : 0, D) + H * 2;
338
+ if (!g(o, Math.min(h, M, R, B), Math.min(_, N, z, V), Math.max(h, M, R, B), Math.max(_, N, z, V), ee) || (m++, s)) continue;
339
+ let U = t.headShape == "triangle" || t.headShape == "open" ? t.headShape : "triangle", W = P + A / Math.hypot(O, 1) + H, ne = !t.repeatHeads || a ? Infinity : Math.max((t.headSpacing ?? 0) * T, W);
340
+ p.datum = e, q(p.tail, h, _), q(p.tip, M, N), q(p.tangent, C, w), q(p.normal, -w, C), q(p.reverseTangent, -C, -w), q(p.reverseNormal, w, -C), p.size = T, p.stemHalfWidth = E, p.headHalfWidth = D, p.headAxisLength = P, p.rHeadSlope = O, p.rHeadNotchSlope = k, p.strokeWidth = H, p.repeatSpacing = ne, p.headRepeatFootprint = W, p.geometryLength = Math.hypot(M - h, N - _), p.bidirectional = a, p.stemContainsHead = t.stem && U == "triangle" && (!t.repeatHeads || a) && D <= E, p.renderedHeadShape = U, p.headShapeFallback = U != t.headShape, r(p);
341
+ }
342
+ return m;
343
+ }
344
+ function te(e, t) {
345
+ let n = z(e, t);
346
+ switch (n) {
347
+ case "forward":
348
+ case "reverse":
349
+ case "both": return n;
350
+ default: throw Error(`Invalid value for "direction" channel: ${n}`);
351
+ }
352
+ }
353
+ function W(e, t) {
354
+ e.bidirectional && !e.stemContainsHead && t(e.tail.x, e.tail.y, e.reverseTangent, e.reverseNormal);
355
+ for (let n = 0; !e.stemContainsHead && !(n > 0 && n + e.headRepeatFootprint - e.strokeWidth / 2 > e.geometryLength || (t(e.tip.x - e.tangent.x * n, e.tip.y - e.tangent.y * n, e.tangent, e.normal), !(e.repeatSpacing > 0) || !Number.isFinite(e.repeatSpacing))); n += e.repeatSpacing);
356
+ }
357
+ function ne(e, t, n, r, i, a) {
358
+ let o = r * i, s = o - r * a, c = G(G(e, K(t, -o)), K(n, r)), l = G(G(e, K(t, -o)), K(n, -r));
359
+ return [
360
+ e,
361
+ c,
362
+ G(e, K(t, -s)),
363
+ l
364
+ ];
365
+ }
366
+ function re(e, t, n, r, i, a, o, s) {
367
+ let c = i * a, l = G(G(t, K(n, -c)), K(r, i)), u = G(G(t, K(n, -c)), K(r, -i)), d = G(e, K(r, i)), f = G(e, K(r, -i));
368
+ return s ? [
369
+ t,
370
+ l,
371
+ G(G(e, K(n, c)), K(r, i)),
372
+ e,
373
+ G(G(e, K(n, c)), K(r, -i)),
374
+ u
375
+ ] : [
376
+ t,
377
+ l,
378
+ d,
379
+ ...o ? [G(e, K(n, i * a))] : [],
380
+ f,
381
+ u
382
+ ];
383
+ }
384
+ function ie(e, t, n, r, i, a, o) {
385
+ let s = r * i, c = G(G(e, K(t, -s)), K(n, r)), l = G(G(e, K(t, -s)), K(n, -r)), u = Math.hypot(r, s), d = u > 0 ? o * r / u : 0, f = u > 0 ? o * s / u : 0, p = G(G(c, K(t, -d)), K(n, -f)), m = G(G(l, K(t, -d)), K(n, f));
386
+ return [
387
+ e,
388
+ c,
389
+ p,
390
+ G(e, K(t, -(s + d - (r - f) * a))),
391
+ m,
392
+ l
393
+ ];
394
+ }
395
+ function ae({ segmentLength: e, headHalfWidth: t, stemHalfWidth: n, configuredRHeadSlope: r, configuredRHeadNotchSlope: i, headRepeat: a, headPlacement: o, startNotch: s, minStemLength: c, headShape: l, bidirectional: u }) {
396
+ if (a || n < 0) return r;
397
+ if (o == "outside") return !s || n <= 0 ? r : Math.min(r, Math.max(e - c, 0) / n);
398
+ if (l != "triangle") return r;
399
+ let d = Math.max(e - c, 0) / (u ? 2 : 1);
400
+ return oe(n, t, r, i) <= d ? r : d < n * i ? n > 0 ? le(d / n, 0, r) : 0 : le((d + (t - n) * i) / t, 0, r);
401
+ }
402
+ function oe(e, t, n, r) {
403
+ return t * n - (t - e) * Math.min(r, n);
404
+ }
405
+ function se(e, t, n, r) {
406
+ if (e <= 0) return 0;
407
+ let i = e * t, a = Math.hypot(e, i);
408
+ return i + r * e / a - (e - r * i / a) * n;
409
+ }
410
+ function ce(e) {
411
+ let t = le(e, 1, 90) * Math.PI / 180;
412
+ return 1 / Math.max(Math.tan(t), 1e-6);
413
+ }
414
+ function G(e, t) {
415
+ return {
416
+ x: e.x + t.x,
417
+ y: e.y + t.y
418
+ };
419
+ }
420
+ function K(e, t) {
421
+ return {
422
+ x: e.x * t,
423
+ y: e.y * t
424
+ };
425
+ }
426
+ function q(e, t, n) {
427
+ e.x = t, e.y = n;
428
+ }
429
+ function le(e, t, n) {
430
+ return Math.min(Math.max(e, t), n);
431
+ }
432
+ //#endregion
433
+ //#region ../core/src/rendering/immediate/linkFading.js
434
+ var ue = 4;
435
+ function de(e, t, n) {
436
+ let r = t[0] - e[0], i = t[1] - e[1], a = Math.hypot(r, i);
437
+ if (a == 0) return;
438
+ let o = -i / a, s = r / a;
439
+ (o < 0 || o == 0 && s < 0) && (o = -o, s = -s);
440
+ let c = o * e[0] + s * e[1], [l, u] = n, d = JSON.stringify([
441
+ J(o, 6),
442
+ J(s, 6),
443
+ J(c, 1),
444
+ J(l, 1),
445
+ J(u, 1)
446
+ ]);
447
+ return {
448
+ normalX: o,
449
+ normalY: s,
450
+ offset: c,
451
+ start: l,
452
+ end: u,
453
+ key: d
454
+ };
455
+ }
456
+ function fe(e, t, n = !1) {
457
+ let r = B(e, e.properties.arcFadingDistance);
458
+ return t != "arc" && t != "dome" || r === !1 || r[0] <= 0 || r[1] <= 0 || n && B(e, e.properties.noFadingOnSecondPass) ? !1 : r;
459
+ }
460
+ function pe(e, t) {
461
+ let n = [], r = (r) => {
462
+ for (let i = 0; i <= ue; i++) {
463
+ let a = i / ue, 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);
464
+ n.push({
465
+ offset: s,
466
+ opacity: 1 - me(c)
467
+ });
468
+ }
469
+ };
470
+ return r(!0), r(!1), n;
471
+ }
472
+ function me(e) {
473
+ let t = Math.max(0, Math.min(1, e));
474
+ return t * t * (3 - 2 * t);
475
+ }
476
+ function J(e, t) {
477
+ let n = 10 ** t;
478
+ return Math.round(e * n) / n;
479
+ }
480
+ //#endregion
481
+ //#region ../core/src/rendering/immediate/geometry/linkGeometry.js
482
+ function he(e, t, n, r) {
483
+ if (r.shape == "arc") {
484
+ let i = [...e], a = [...t], o = X(a, i), s = ye(o);
485
+ if (s == 0) return [
486
+ i,
487
+ i,
488
+ a,
489
+ a
490
+ ];
491
+ let c = Z(o, 1 / s), l = [-c[1], c[0]];
492
+ s = ge(i, a, s, r.maxChordLength, n);
493
+ let u = Z(l, Math.max(s / 2 * r.arcHeightFactor, r.minArcHeight) / .75);
494
+ return [
495
+ i,
496
+ Y(i, u),
497
+ Y(a, u),
498
+ a
499
+ ];
500
+ } else if (r.shape == "dome") {
501
+ let i, a, o;
502
+ r.orient == "vertical" ? (i = [Math.min(e[0], t[0]), t[1]], a = [Math.max(e[0], t[0]), t[1]], o = [0, e[1] - t[1]]) : (i = [t[0], Math.min(e[1], t[1])], a = [t[0], Math.max(e[1], t[1])], o = [e[0] - t[0], 0]);
503
+ let s = ye(X(a, i));
504
+ ge(i, a, s, r.maxChordLength, n), r.clampApex && _e(i, a, r.orient, n);
505
+ let c = Z(o, 1 / .75);
506
+ return [
507
+ i,
508
+ Y(i, c),
509
+ Y(a, c),
510
+ a
511
+ ];
512
+ } else if (r.shape == "diagonal") if (r.orient == "vertical") {
513
+ let n = (e[1] + t[1]) / 2;
514
+ return [
515
+ e,
516
+ [e[0], n],
517
+ [t[0], n],
518
+ t
519
+ ];
520
+ } else {
521
+ let n = (e[0] + t[0]) / 2;
522
+ return [
523
+ e,
524
+ [n, e[1]],
525
+ [n, t[1]],
526
+ t
527
+ ];
528
+ }
529
+ else if (r.shape == "line") {
530
+ let n = Z(Y(e, t), .5);
531
+ return [
532
+ e,
533
+ n,
534
+ n,
535
+ t
536
+ ];
537
+ } else throw Error(`Unsupported link shape: ${r.shape}`);
538
+ }
539
+ function ge(e, t, n, r, i) {
540
+ if (n <= r) return n;
541
+ let a = Z(X(t, e), 1 / n);
542
+ return ve(e, i, 2) ? (be(t, Y(e, Z(a, r))), r) : ve(t, i, 2) ? (be(e, X(t, Z(a, r))), r) : n;
543
+ }
544
+ function _e(e, t, n, r) {
545
+ n == "vertical" ? (t[0] > 0 && (e[0] = Math.max(e[0], -t[0])), e[0] < r.width && (t[0] = Math.min(t[0], 2 * r.width - e[0]))) : (t[1] > 0 && (e[1] = Math.max(e[1], -t[1])), e[1] < r.height && (t[1] = Math.min(t[1], 2 * r.height - e[1])));
546
+ }
547
+ function ve(e, t, n) {
548
+ return e[0] >= -t.width * n && e[0] <= t.width * (1 + n) && e[1] >= -t.height * n && e[1] <= t.height * (1 + n);
549
+ }
550
+ function Y(e, t) {
551
+ return [e[0] + t[0], e[1] + t[1]];
552
+ }
553
+ function X(e, t) {
554
+ return [e[0] - t[0], e[1] - t[1]];
555
+ }
556
+ function Z(e, t) {
557
+ return [e[0] * t, e[1] * t];
558
+ }
559
+ function ye(e) {
560
+ return Math.hypot(e[0], e[1]);
561
+ }
562
+ function be(e, t) {
563
+ e[0] = t[0], e[1] = t[1];
564
+ }
565
+ //#endregion
566
+ //#region ../core/src/rendering/immediate/marks/link.js
567
+ function xe(e) {
568
+ let t = e.properties;
569
+ return {
570
+ shape: B(e, t.linkShape),
571
+ orient: B(e, t.orient),
572
+ arcHeightFactor: B(e, t.arcHeightFactor),
573
+ minArcHeight: B(e, t.minArcHeight),
574
+ maxChordLength: B(e, t.maxChordLength),
575
+ clampApex: B(e, t.clampApex)
576
+ };
577
+ }
578
+ function Se(e, t, n, r) {
579
+ let { coords: i, data: a, visibleBounds: o } = n, s = e.encoders;
580
+ if (a.length == 0) return 0;
581
+ let c = P(i, s, "x", a[0]), l = P(i, s, "y", a[0]), u = [0, 0], d = [0, 0], f = i.x, p = i.y, m = {
582
+ width: i.width,
583
+ height: i.height
584
+ }, h = p + m.height, _ = 0;
585
+ for (let e of a) {
586
+ c(e, u), l(e, d);
587
+ let [n, i] = u, [a, p] = d, v = he([n - f, h - a], [i - f, h - p], m, t);
588
+ for (let e of v) e[0] += f, e[1] = h - e[1];
589
+ let [y, b, x, S] = v, C = I(s.size, e);
590
+ g(o, Math.min(y[0], b[0], x[0], S[0]), Math.min(y[1], b[1], x[1], S[1]), Math.max(y[0], b[0], x[0], S[0]), Math.max(y[1], b[1], x[1], S[1]), C / 2) && (_++, r({
591
+ datum: e,
592
+ points: v,
593
+ strokeWidth: C
594
+ }));
595
+ }
596
+ return _;
597
+ }
598
+ //#endregion
599
+ //#region ../core/src/rendering/immediate/marks/point.js
600
+ function Ce(e) {
601
+ return { inwardStroke: B(e, e.properties.inwardStroke) };
602
+ }
603
+ function we(e, t, n, r) {
604
+ let { coords: i, data: a, visibleBounds: o, anchorCullBounds: s } = n, c = n.start ?? 0, l = n.end ?? a.length, u = e.encoders;
605
+ if (c === l) return 0;
606
+ let d = P(i, u, "x", a[c]), f = P(i, u, "y", a[c]), p = [0, 0], m = [0, 0], _ = e.getSemanticThreshold(), v = {
607
+ datum: {},
608
+ shape: "circle",
609
+ x: 0,
610
+ y: 0,
611
+ geometryRadius: 0,
612
+ boundsRadius: 0,
613
+ angle: 0,
614
+ strokeWidth: 0,
615
+ lineShape: !1
616
+ }, y = 0;
617
+ for (let e = c; e < l; e++) {
618
+ let n = a[e];
619
+ if (I(u.semanticScore, n) < _) continue;
620
+ d(n, p), f(n, m);
621
+ let i = p[0] + I(u.dx, n), c = m[0] - I(u.dy, n);
622
+ if (h(s, i, c)) continue;
623
+ let l = Math.sqrt(I(u.size, n)) / 2;
624
+ if (t.inwardStroke && l <= 0) continue;
625
+ let b = z(u.shape, n), x = I(u.strokeWidth, n), S = b == "x" || b == "+", C = t.inwardStroke && !S ? Math.min(x, l) : x, w = t.inwardStroke && !S ? l - C / 2 : l, T = t.inwardStroke ? 0 : x / 2, E = l * Math.SQRT2 + T;
626
+ g(o, i - E, c - E, i + E, c + E) && (y++, v.datum = n, v.shape = b, v.x = i, v.y = c, v.geometryRadius = w, v.boundsRadius = E, v.angle = I(u.angle, n), v.strokeWidth = C, v.lineShape = S, r(v));
627
+ }
628
+ return y;
629
+ }
630
+ //#endregion
631
+ //#region ../core/src/rendering/immediate/geometry/pointPath.js
632
+ function Te(e, t, n, r, i) {
633
+ let a = r * .4, o = r * .15, s = Math.sqrt(3) * r / 2;
634
+ switch (e) {
635
+ case "diamond": return i.moveTo(t, n - r), i.lineTo(t + r, n), i.lineTo(t, n + r), i.lineTo(t - r, n), i.closePath(), !0;
636
+ case "cross": return i.moveTo(t - a, n - r), i.lineTo(t + a, n - r), i.lineTo(t + a, n - a), i.lineTo(t + r, n - a), i.lineTo(t + r, n + a), i.lineTo(t + a, n + a), i.lineTo(t + a, n + r), i.lineTo(t - a, n + r), i.lineTo(t - a, n + a), i.lineTo(t - r, n + a), i.lineTo(t - r, n - a), i.lineTo(t - a, n - a), i.closePath(), !0;
637
+ case "triangle-up": return i.moveTo(t, n - s), i.lineTo(t + r, n + s), i.lineTo(t - r, n + s), i.closePath(), !0;
638
+ case "triangle-right": return i.moveTo(t + s, n), i.lineTo(t - s, n + r), i.lineTo(t - s, n - r), i.closePath(), !0;
639
+ case "triangle-down": return i.moveTo(t, n + s), i.lineTo(t - r, n - s), i.lineTo(t + r, n - s), i.closePath(), !0;
640
+ case "triangle-left": return i.moveTo(t - s, n), i.lineTo(t + s, n - r), i.lineTo(t + s, n + r), i.closePath(), !0;
641
+ case "tick-up": return Q(i, t - o, n - r, t + o, n), !0;
642
+ case "tick-right": return Q(i, t, n - o, t + r, n + o), !0;
643
+ case "tick-down": return Q(i, t - o, n, t + o, n + r), !0;
644
+ case "tick-left": return Q(i, t - r, n - o, t, n + o), !0;
645
+ case "+": return i.moveTo(t - r, n), i.lineTo(t + r, n), i.moveTo(t, n - r), i.lineTo(t, n + r), !0;
646
+ case "x": return i.moveTo(t - r, n - r), i.lineTo(t + r, n + r), i.moveTo(t + r, n - r), i.lineTo(t - r, n + r), !0;
647
+ default: return !1;
648
+ }
649
+ }
650
+ function Q(e, t, n, r, i) {
651
+ e.moveTo(t, n), e.lineTo(r, n), e.lineTo(r, i), e.lineTo(t, i), e.closePath();
652
+ }
653
+ //#endregion
654
+ //#region ../core/src/rendering/immediate/marks/rect.js
655
+ var Ee = .1;
656
+ function De(e) {
657
+ let t = e.properties, n = B(e, t.cornerRadius), r = {
658
+ topLeft: B(e, t.cornerRadiusTopLeft ?? n),
659
+ topRight: B(e, t.cornerRadiusTopRight ?? n),
660
+ bottomRight: B(e, t.cornerRadiusBottomRight ?? n),
661
+ bottomLeft: B(e, t.cornerRadiusBottomLeft ?? n)
662
+ }, i = {
663
+ blur: B(e, t.shadowBlur ?? 0),
664
+ color: B(e, t.shadowColor ?? "black"),
665
+ offsetX: B(e, t.shadowOffsetX ?? 0),
666
+ offsetY: B(e, t.shadowOffsetY ?? 0),
667
+ opacity: B(e, t.shadowOpacity ?? 0)
668
+ }, a = B(e, t.hatch ?? "none"), o = !je(r);
669
+ return {
670
+ cornerRadii: r,
671
+ minWidth: B(e, t.minWidth),
672
+ minHeight: B(e, t.minHeight),
673
+ minOpacity: B(e, t.minOpacity),
674
+ shadow: i,
675
+ hatch: a,
676
+ hasCornerRadii: o,
677
+ canPadSeams: a == "none" && i.opacity == 0 && !o
678
+ };
679
+ }
680
+ function Oe(e, t, n, r) {
681
+ let { coords: i, data: a, visibleBounds: o, viewOpacity: s } = n, c = n.start ?? 0, l = n.end ?? a.length, u = e.encoders;
682
+ if (c === l) return 0;
683
+ let d = u.strokeWidth.constant, f = u.fillOpacity.constant, p = d ? I(u.strokeWidth, a[c]) : 0, m = f ? I(u.fillOpacity, a[c]) : 0, h = u.fill.constant, _ = h ? V(u.fill(a[c])) : "none", v = t.shadow.opacity > 0 ? t.shadow.blur + Math.max(Math.abs(t.shadow.offsetX), Math.abs(t.shadow.offsetY)) : 0, y = P(i, u, "x", a[c]), b = P(i, u, "y", a[c]), x = [0, 0], S = [0, 0], C = {
684
+ datum: {},
685
+ x: 0,
686
+ y: 0,
687
+ width: 0,
688
+ height: 0,
689
+ radii: {
690
+ topLeft: 0,
691
+ topRight: 0,
692
+ bottomRight: 0,
693
+ bottomLeft: 0
694
+ },
695
+ opacityFactor: 1,
696
+ strokeWidth: 0,
697
+ fill: "none",
698
+ fillOpacity: 0
699
+ }, w = 0;
700
+ for (let e = c; e < l; e++) {
701
+ let n = a[e];
702
+ y(n, x), b(n, S);
703
+ let i = Math.min(x[0], x[1]), c = Math.min(S[0], S[1]), l = Math.abs(x[1] - x[0]), T = Math.abs(S[1] - S[0]), E = ke(l, t.minWidth), D = ke(T, t.minHeight), O = Math.max(t.minOpacity, E * D);
704
+ l < t.minWidth && (i -= (t.minWidth - l) / 2, l = t.minWidth), T < t.minHeight && (c -= (t.minHeight - T) / 2, T = t.minHeight);
705
+ let k = d ? p : I(u.strokeWidth, n), A = h ? _ : V(u.fill(n)), j = (f ? m : I(u.fillOpacity, n)) * s, M = k == 0 && j == 1 && O == 1 && t.canPadSeams && A != "none" ? Ee : 0;
706
+ M && (i -= M, c -= M, l += M * 2, T += M * 2), g(o, i, c, i + l, c + T, k / 2 + v) && (w++, C.datum = n, C.x = i, C.y = c, C.width = l, C.height = T, C.opacityFactor = O, C.strokeWidth = k, C.fill = A, C.fillOpacity = j, t.hasCornerRadii && Ae(t.cornerRadii, l, T, C.radii), r(C));
707
+ }
708
+ return w;
709
+ }
710
+ function ke(e, t) {
711
+ return t > 0 && e < t ? e / t : 1;
712
+ }
713
+ function Ae(e, t, n, r) {
714
+ let i = Math.min(t, n) / 2;
715
+ r.topLeft = Math.max(0, Math.min(e.topLeft, i)), r.topRight = Math.max(0, Math.min(e.topRight, i)), r.bottomRight = Math.max(0, Math.min(e.bottomRight, i)), r.bottomLeft = Math.max(0, Math.min(e.bottomLeft, i));
716
+ }
717
+ function je(e) {
718
+ return e.topLeft == 0 && e.topRight == 0 && e.bottomRight == 0 && e.bottomLeft == 0;
719
+ }
720
+ //#endregion
721
+ //#region ../core/src/rendering/immediate/marks/rule.js
722
+ function Me(e) {
723
+ return { minLength: B(e, e.properties.minLength) };
724
+ }
725
+ function Ne(e, t, n, r) {
726
+ let { coords: i, data: a, visibleBounds: o } = n, s = e.encoders;
727
+ if (a.length == 0) return 0;
728
+ let c = P(i, s, "x", a[0]), l = P(i, s, "y", a[0]), u = [0, 0], d = [0, 0], f = {
729
+ datum: {},
730
+ x1: 0,
731
+ y1: 0,
732
+ x2: 0,
733
+ y2: 0,
734
+ strokeWidth: 0
735
+ }, p = 0;
736
+ for (let e of a) {
737
+ c(e, u), l(e, d);
738
+ let [n, i] = u, [a, m] = d, h = i - n, _ = m - a, v = Math.hypot(h, _);
739
+ if (v > 0 && v < t.minLength) {
740
+ let e = (t.minLength - v) / 2, r = h / v, o = _ / v;
741
+ n -= r * e, a -= o * e, i += r * e, m += o * e;
742
+ }
743
+ let y = I(s.size, e);
744
+ g(o, n, a, i, m, y / 2) && (p++, f.datum = e, f.x1 = n, f.y1 = a, f.x2 = i, f.y2 = m, f.strokeWidth = y, r(f));
745
+ }
746
+ return p;
747
+ }
748
+ //#endregion
749
+ //#region ../core/src/rendering/immediate/marks/text.js
750
+ function Pe(e) {
751
+ let t = e.properties;
752
+ return {
753
+ align: B(e, t.align),
754
+ baseline: B(e, t.baseline),
755
+ logoLetters: B(e, t.logoLetters),
756
+ paddingX: B(e, t.paddingX),
757
+ paddingY: B(e, t.paddingY),
758
+ flushX: B(e, t.flushX),
759
+ flushY: B(e, t.flushY),
760
+ squeeze: B(e, t.squeeze),
761
+ dx: B(e, t.dx),
762
+ dy: B(e, t.dy)
763
+ };
764
+ }
765
+ function Fe(t, r, a, o) {
766
+ let { coords: s, data: c, visibleBounds: l, anchorCullBounds: u } = a, { align: d, baseline: f } = r, p = t.encoders;
767
+ if (c.length == 0) return 0;
768
+ let m = p.size.constant ? I(p.size, c[0]) : 0, g = p.angle.constant ? I(p.angle, c[0]) : 0, _ = P(s, p, "x", c[0]), v = P(s, p, "y", c[0]), y = t.encoding.text, b = "format" in y ? e(y.format) : (e) => e, x = [0, 0], S = [0, 0], C = {
769
+ width: 0,
770
+ height: 0
771
+ }, w = {
772
+ x: 0,
773
+ y: 0
774
+ }, T = {
775
+ position: 0,
776
+ scale: 0
777
+ }, E = {
778
+ scaleX: 0,
779
+ scaleY: 0,
780
+ originX: 0,
781
+ originY: 0
782
+ }, D = Array(8).fill(0), O = {
783
+ datum: {},
784
+ text: "",
785
+ x: 0,
786
+ y: 0,
787
+ size: 0,
788
+ width: 0,
789
+ angle: 0,
790
+ dx: r.dx,
791
+ dy: r.dy,
792
+ fadeOpacity: 1,
793
+ scale: 1,
794
+ logoTransform: void 0,
795
+ multiCharacterLogo: !1,
796
+ boundsQuad: D
797
+ }, k = !!p.x2, A = !!p.y2, j = 0;
798
+ for (let e of c) {
799
+ let t = b(p.text(e)), c = i(t) ? t : t === null ? "" : "" + t;
800
+ if (!c) continue;
801
+ _(e, x), v(e, S);
802
+ let [y, M] = x, [N, P] = S, F = p.size.constant ? m : I(p.size, e), L = p.angle.constant ? g : I(p.angle, e);
803
+ if (r.logoLetters) {
804
+ let t = F, n = F;
805
+ if (k && (t = M - y, y = (y + M) / 2), A && (n = N - P, N = (N + P) / 2), Ie(D, y, N, Math.abs(t), Math.abs(n), "center", "middle", L, r.dx, r.dy), !t || !n || h(u, y, N) || !Le(l, D)) continue;
806
+ let i = a.measureLogoInkBounds(c);
807
+ if (!i) continue;
808
+ j++, O.datum = e, O.text = c, O.x = y, O.y = N, O.size = 100, O.width = i.xMax - i.xMin, O.angle = L, O.fadeOpacity = 1, O.scale = 1, E.scaleX = t / O.width, E.scaleY = n / (i.yMax - i.yMin), E.originX = (i.xMin + i.xMax) / 2, E.originY = (i.yMin + i.yMax) / 2, O.logoTransform = E, O.multiCharacterLogo = c.length > 1, o(O);
809
+ continue;
810
+ }
811
+ let R = a.fontMeasurement.measureWidth(c, F);
812
+ Re(R, F, L, C), k || A ? Be(d, f, L, w) : (w.x = Ve[d], w.y = He[f]);
813
+ let z = 1;
814
+ if (k && (ze(Math.min(y, M), Math.max(y, M), C.width, r.paddingX, w.x, r.flushX, s.x, s.x2, T), y = T.position, z *= T.scale), A && (ze(Math.min(N, P), Math.max(N, P), C.height * z, r.paddingY, w.y, r.flushY, s.y, s.y2, T), N = T.position, z *= T.scale), h(u, y, N)) continue;
815
+ let B = 1;
816
+ if (z < 1) {
817
+ if (!r.squeeze || z < 3 / F) continue;
818
+ B = n(3 / F, 6 / F, z);
819
+ }
820
+ let V = F * z, H = R * z;
821
+ Ie(D, y, N, H, V, d, f, L, r.dx, r.dy), Le(l, D) && (j++, O.datum = e, O.text = c, O.x = y, O.y = N, O.size = F, O.width = H, O.angle = L, O.fadeOpacity = B, O.scale = z, O.logoTransform = void 0, O.multiCharacterLogo = !1, o(O));
822
+ }
823
+ return j;
824
+ }
825
+ function Ie(e, t, n, r, i, a, o, s, c, l) {
826
+ let u = t + c - (Ve[a] + 1) / 2 * r, d = n + l - (He[o] + 1) / 2 * i, f = u + r, p = d + i, m = s * Math.PI / 180, h = Math.sin(m), g = Math.cos(m);
827
+ return $(e, 0, t, n, u, d, h, g), $(e, 2, t, n, f, d, h, g), $(e, 4, t, n, f, p, h, g), $(e, 6, t, n, u, p, h, g), e;
828
+ }
829
+ function Le(e, t) {
830
+ return g(e, Math.min(t[0], t[2], t[4], t[6]), Math.min(t[1], t[3], t[5], t[7]), Math.max(t[0], t[2], t[4], t[6]), Math.max(t[1], t[3], t[5], t[7]), 1);
831
+ }
832
+ function $(e, t, n, r, i, a, o, s) {
833
+ e[t] = n + (i - n) * s - (a - r) * o, e[t + 1] = r + (i - n) * o + (a - r) * s;
834
+ }
835
+ function Re(e, t, n, r) {
836
+ let i = n * Math.PI / 180, a = Math.abs(Math.sin(i)), o = Math.abs(Math.cos(i));
837
+ r.width = e * o + t * a, r.height = e * a + t * o;
838
+ }
839
+ function ze(e, t, n, r, i, a, o, s, c) {
840
+ let l = t - e, u = n + 2 * r;
841
+ if (e > s || t < o) {
842
+ c.position = 0, c.scale = 0;
843
+ return;
844
+ }
845
+ let d = Math.max(0, l - u), f;
846
+ if (i == 0) {
847
+ let n = e + t;
848
+ if (a) {
849
+ let e = Math.max(0, 2 * o + u - n);
850
+ n += Math.min(e, d);
851
+ let t = Math.max(0, u + n - 2 * s);
852
+ n -= Math.min(t, d);
853
+ }
854
+ f = n / 2;
855
+ } else if (i < 0) {
856
+ let t = e;
857
+ a && (t += Math.min(Math.max(0, o - t), d)), f = t + r;
858
+ } else {
859
+ let e = t;
860
+ a && (e -= Math.min(Math.max(0, e - s), d)), f = e - r;
861
+ }
862
+ c.position = f, c.scale = Math.max(0, Math.min(1, (l - r) / u));
863
+ }
864
+ function Be(e, t, n, r) {
865
+ let i = Ve[e], a = -He[t], o = ((n + 45) % 360 + 360) % 360, s, c;
866
+ o < 90 ? (s = i, c = a) : o < 180 ? (s = a, c = -i) : o < 270 ? (s = -i, c = a) : (s = -a, c = i), r.x = s, r.y = -c;
867
+ }
868
+ var Ve = {
869
+ left: -1,
870
+ center: 0,
871
+ right: 1
872
+ }, He = {
873
+ top: -1,
874
+ middle: 0,
875
+ bottom: 1,
876
+ alphabetic: 1,
877
+ baseline: 1
878
+ }, Ue = [
879
+ "Lato",
880
+ "Avenir Next",
881
+ "Avenir",
882
+ "Segoe UI",
883
+ "Ubuntu",
884
+ "Noto Sans",
885
+ "Helvetica Neue",
886
+ "Helvetica",
887
+ "Arial",
888
+ "sans-serif"
889
+ ], We = /* @__PURE__ */ new Set([
890
+ "serif",
891
+ "sans-serif",
892
+ "monospace",
893
+ "cursive",
894
+ "fantasy",
895
+ "system-ui",
896
+ "ui-serif",
897
+ "ui-sans-serif",
898
+ "ui-monospace",
899
+ "ui-rounded",
900
+ "emoji",
901
+ "math",
902
+ "fangsong"
903
+ ]), Ge = {
904
+ thin: 100,
905
+ light: 300,
906
+ regular: 400,
907
+ normal: 400,
908
+ medium: 500,
909
+ bold: 700,
910
+ black: 900
911
+ };
912
+ function Ke(e) {
913
+ let t = e ?? "Lato";
914
+ return [t, ...Ue.filter((e) => e.toLowerCase() != t.toLowerCase())].map(Xe).join(", ");
915
+ }
916
+ function qe(e) {
917
+ if (typeof e == "number") return e;
918
+ let t = Ge[e];
919
+ if (t === void 0) throw Error("Unknown font weight: " + e);
920
+ return t;
921
+ }
922
+ function Je(e) {
923
+ return {
924
+ style: e.fontStyle ?? "normal",
925
+ weight: qe(e.fontWeight ?? "normal"),
926
+ family: Ke(e.font)
927
+ };
928
+ }
929
+ function Ye(e, t) {
930
+ switch (e) {
931
+ case "top": return .79 * t;
932
+ case "middle": return .35 * t;
933
+ case "bottom": return -.21 * t;
934
+ case "alphabetic":
935
+ case "baseline": return 0;
936
+ default: throw Error(`Unknown text baseline: ${e}`);
937
+ }
938
+ }
939
+ function Xe(e) {
940
+ let t = e.toLowerCase();
941
+ return We.has(t) ? t : `'${e.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'`;
942
+ }
943
+ //#endregion
944
+ //#region ../core/src/rendering/nativeTextMetrics.js
945
+ var Ze = "Mg", Qe = 100, $e = class {
946
+ #e;
947
+ #t;
948
+ #n = new r([], JSON.stringify);
949
+ #r = [];
950
+ #i;
951
+ constructor(e, t) {
952
+ this.#e = e, this.#t = t, e.fontKerning = "normal", e.direction = "ltr", e.textAlign = "left", e.textBaseline = "alphabetic";
953
+ }
954
+ requestFont(e) {
955
+ let t = Je(e), n = this.#n.get(t);
956
+ if (!n) {
957
+ n = new et((e, n) => this.#a(t, e, n)), this.#n.set(t, n);
958
+ let e = this.#t?.load(rt(t, 16));
959
+ e && this.#r.push(e.then(() => n.invalidateCache()));
960
+ }
961
+ return n;
962
+ }
963
+ async waitUntilReady() {
964
+ await Promise.all(this.#r);
965
+ }
966
+ #a(e, t, n) {
967
+ let r = rt(e, n);
968
+ return r != this.#i && (this.#e.font = r, this.#i = r), this.#e.measureText(t);
969
+ }
970
+ }, et = class {
971
+ #e;
972
+ #t = NaN;
973
+ #n = /* @__PURE__ */ new Float64Array(128);
974
+ #r = NaN;
975
+ #i = Array(128);
976
+ constructor(e) {
977
+ this.#e = e, this.#n.fill(NaN);
978
+ }
979
+ measureWidth(e, t) {
980
+ this.#a(t);
981
+ let n = e.length == 1 ? e.charCodeAt(0) : 128;
982
+ if (n < 128) {
983
+ let r = this.#n[n];
984
+ if (!Number.isNaN(r)) return r;
985
+ let i = this.#e(e, t).width;
986
+ return this.#n[n] = i, i;
987
+ }
988
+ return this.#e(e, t).width;
989
+ }
990
+ getHeight(e) {
991
+ if (this.#a(e), Number.isNaN(this.#r)) {
992
+ let t = this.#e(Ze, e);
993
+ this.#r = t.actualBoundingBoxAscent + t.actualBoundingBoxDescent;
994
+ }
995
+ return this.#r;
996
+ }
997
+ measureInkBounds(e) {
998
+ let t = e.length == 1 ? e.charCodeAt(0) : 128;
999
+ if (t < 128 && this.#i[t] !== void 0) return this.#i[t];
1000
+ let n = tt(this.#e(e, Qe));
1001
+ return t < 128 && (this.#i[t] = n), n;
1002
+ }
1003
+ invalidateCache() {
1004
+ this.#t = NaN, this.#n.fill(NaN), this.#r = NaN, this.#i.fill(void 0);
1005
+ }
1006
+ #a(e) {
1007
+ e != this.#t && (this.#t = e, this.#n.fill(NaN), this.#r = NaN);
1008
+ }
1009
+ };
1010
+ function tt(e) {
1011
+ let t = {
1012
+ xMin: -e.actualBoundingBoxLeft,
1013
+ xMax: e.actualBoundingBoxRight,
1014
+ yMin: -e.actualBoundingBoxAscent,
1015
+ yMax: e.actualBoundingBoxDescent
1016
+ };
1017
+ return t.xMax > t.xMin && t.yMax > t.yMin ? t : null;
1018
+ }
1019
+ function nt(e, t) {
1020
+ let n = e.requestFont(t);
1021
+ return n instanceof et ? (e) => n.measureInkBounds(e) : (e) => {
1022
+ let t = n.measureWidth(e, Qe), r = n.getHeight(Qe);
1023
+ return t > 0 && r > 0 ? {
1024
+ xMin: 0,
1025
+ xMax: t,
1026
+ yMin: -r,
1027
+ yMax: 0
1028
+ } : null;
1029
+ };
1030
+ }
1031
+ function rt(e, t) {
1032
+ return `${e.style} ${e.weight} ${t}px ${e.family}`;
1033
+ }
1034
+ function it(e) {
1035
+ let t = e.createElement("canvas").getContext("2d");
1036
+ if (!t) throw Error("Canvas2D text measurement is unavailable.");
1037
+ return new $e(t, e.fonts);
1038
+ }
1039
+ async function at(e, t) {
1040
+ t.visit((t) => {
1041
+ let n = t.mark;
1042
+ n?.getType() == "text" && e.requestFont(n.properties);
1043
+ }), await e.waitUntilReady();
1044
+ }
1045
+ //#endregion
1046
+ //#region ../core/src/rendering/immediate/order.js
1047
+ function ot(e, t, n, r, i) {
1048
+ let a = [], o = [];
1049
+ for (let i = t; i < n; i++) {
1050
+ let t = e[i];
1051
+ (r(t) ? a : o).push(t);
1052
+ }
1053
+ return i.map((e) => e === "matching" ? a : o);
1054
+ }
1055
+ //#endregion
1056
+ export { V as A, W as C, M as D, I as E, c as F, u as I, f as M, m as N, N as O, g as P, H as S, U as T, xe as _, Ke as a, de as b, Pe as c, Ne as d, De as f, we as g, Ce as h, nt as i, p as j, B as k, Fe as l, Te as m, it as n, Ye as o, Oe as p, at as r, qe as s, ot as t, Me as u, Se as v, ee as w, fe as x, pe as y };