@genome-spy/app 0.85.0 → 0.87.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 (58) hide show
  1. package/README.md +28 -0
  2. package/dist/{agentApi-Cz0hCnVp.js → agentApi-BZ1JCo1N.js} +7174 -8484
  3. package/dist/agentApi.es.js +3312 -3575
  4. package/dist/agentShared.es.js +14 -13
  5. package/dist/canvas2d-B_PnIof-.js +620 -0
  6. package/dist/canvas2d-Cafq5v-N.js +620 -0
  7. package/dist/{arrayUtils-LJpQOu-U.js → clipOptions-D6eh9T-_.js} +1060 -634
  8. package/dist/{paramUtils-BYI4rwyL.js → clipOptions-H68pJyEZ.js} +940 -514
  9. package/dist/{debug-CgDtmspT.js → debug-BGzgZmyk.js} +8 -8
  10. package/dist/{debug-BvCZWumf.js → debug-UYKZLNh4.js} +8 -8
  11. package/dist/index.es.js +2983 -2916
  12. package/dist/index.js +2006 -1997
  13. package/dist/indexer-Di57GyxX.js +72 -0
  14. package/dist/indexer-o6Hpg4nN.js +72 -0
  15. package/dist/layoutResult-D50MSHXR.js +97 -0
  16. package/dist/nativeText-D9SoxpaD.js +934 -0
  17. package/dist/nativeText-DAjvkrzc.js +934 -0
  18. package/dist/performanceProfiler-CPLEjApa.js +20 -0
  19. package/dist/rasterExport-DzldLv6E.js +44 -0
  20. package/dist/rasterExport-IAbJwi8F.js +44 -0
  21. package/dist/rasterImage-B4rPLaW9.js +18 -0
  22. package/dist/rasterization-CFogVB3B.js +50 -0
  23. package/dist/rectangle-DKnrAmKs.js +142 -0
  24. package/dist/renderCanvas2D-BJ93Ptqj.js +277 -0
  25. package/dist/renderCanvas2D-yJ1IrDcX.js +277 -0
  26. package/dist/schema.json +11685 -4428
  27. package/dist/{svg-yFj875aX.js → svg-BRpl2Xub.js} +412 -449
  28. package/dist/{svg-CCu8kYy2.js → svg-DJuqHIyc.js} +399 -436
  29. package/dist/svgRasterizer-CGZQ5njV.js +40 -0
  30. package/dist/svgRasterizer-PAoqLn1j.js +40 -0
  31. package/dist/vega-scale-BGC53c22.js +2403 -0
  32. package/dist/vega-scale-DdW2NzQ3.js +2403 -0
  33. package/dist/viewError-BiR9VCgL.js +29 -0
  34. package/dist/{viewIdentityRegistry-BUdkK9zT.js → viewIdentityRegistry-D4p067HU.js} +1 -1
  35. package/dist/{viewIdentityRegistry-D3oPbN4O.js → viewIdentityRegistry-Dc2hXYsO.js} +1 -1
  36. package/dist/viewSelectors-DNXnGwEW.js +2015 -0
  37. package/dist/viewSelectors-DYYlOt91.js +2015 -0
  38. package/dist/viewUtils-EdhZTPrJ.js +6448 -0
  39. package/dist/webgl-C53DwzVT.js +4127 -0
  40. package/dist/webgl-CdgNFlJk.js +4127 -0
  41. package/package.json +7 -6
  42. package/dist/bmFontMetrics-CuNB-kNN.js +0 -31
  43. package/dist/canvas2d-DoAXEiF9.js +0 -309
  44. package/dist/canvas2d-f5jl4A5D.js +0 -310
  45. package/dist/clipOptions-gqdb3fvW.js +0 -43
  46. package/dist/color-W5zffv-z.js +0 -335
  47. package/dist/framebufferReadback-CCLOjStu.js +0 -148
  48. package/dist/framebufferReadback-THWwFqs8.js +0 -1994
  49. package/dist/nativeText-DMO8gLt7.js +0 -806
  50. package/dist/nativeText-m5AUINMq.js +0 -806
  51. package/dist/twgl-full.module-DB2UdP1k.js +0 -1849
  52. package/dist/viewRenderingContext-HtpqwS_x.js +0 -120
  53. package/dist/viewSelectors-DGCspRN3.js +0 -4198
  54. package/dist/viewSelectors-U5oLCLHV.js +0 -4195
  55. package/dist/viewUtils-Dg4RA40Q.js +0 -7503
  56. package/dist/warning-DRGdb6BF.js +0 -59
  57. package/dist/webgl-Ci6ZhCCf.js +0 -54
  58. package/dist/webgl-Dpz8a3TI.js +0 -53
@@ -1,806 +0,0 @@
1
- import { Et as e, Ut as t, j as n, r } from "./paramUtils-BYI4rwyL.js";
2
- //#region ../core/src/rendering/immediate/markData.js
3
- var i = [];
4
- function a(e, t) {
5
- let n = e.unitView.getCollector();
6
- if (!n) throw Error(`Cannot render an uninitialized mark. View: ${e.unitView.getPathString()}`);
7
- let r = n.facetBatches.get(void 0);
8
- return r?.length ? r : n.facetBatches.get(t.facetId) ?? i;
9
- }
10
- function o(e, t, n, r, i) {
11
- let o = a(e, t);
12
- if (t.sampleFacetRenderingOptions) r(s(n, t.sampleFacetRenderingOptions), o);
13
- else if (e.encoders.facetIndex) for (let [t, a] of l(e.encoders.facetIndex, o)) {
14
- let o = c(e, t);
15
- o ? r(s(n, {
16
- locSize: o,
17
- pixelToUnit: 1
18
- }), a) : i(t);
19
- }
20
- else r(n, o);
21
- }
22
- function s(e, t) {
23
- let n = t.locSize.location * t.pixelToUnit, r = t.locSize.size * t.pixelToUnit;
24
- return e.modify({
25
- y: () => e.y + n * e.height,
26
- height: () => r * e.height
27
- });
28
- }
29
- function c(e, t) {
30
- for (let n of e.unitView.getLayoutAncestors()) {
31
- let e = n.getSampleFacetPosition(t);
32
- if (e) return e;
33
- }
34
- }
35
- function l(e, t) {
36
- let n = /* @__PURE__ */ new Map();
37
- for (let r of t) {
38
- let t = +e(r), i = n.get(t);
39
- i || (i = [], n.set(t, i)), i.push(r);
40
- }
41
- return n;
42
- }
43
- //#endregion
44
- //#region ../core/src/rendering/immediate/bounds.js
45
- function u(e, t, n) {
46
- return {
47
- x1: n?.clipX ? Math.max(0, n.rect.x) : 0,
48
- y1: n?.clipY ? Math.max(0, n.rect.y) : 0,
49
- x2: n?.clipX ? Math.min(e, n.rect.x2) : e,
50
- y2: n?.clipY ? Math.min(t, n.rect.y2) : t
51
- };
52
- }
53
- function d(e, t, n) {
54
- let r = n === !0 || n === "x", i = n === !0 || n === "y";
55
- return {
56
- x1: r ? t?.clipX ? t.rect.x : e.x : -Infinity,
57
- y1: i ? t?.clipY ? t.rect.y : e.y : -Infinity,
58
- x2: r ? t?.clipX ? t.rect.x2 : e.x2 : Infinity,
59
- y2: i ? t?.clipY ? t.rect.y2 : e.y2 : Infinity
60
- };
61
- }
62
- function f(e) {
63
- return e.x1 <= e.x2 && e.y1 <= e.y2;
64
- }
65
- function p(e, t, n) {
66
- return t < e.x1 || t > e.x2 || n < e.y1 || n > e.y2;
67
- }
68
- function m(e, t, n, r, i, a = 0) {
69
- 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);
70
- }
71
- //#endregion
72
- //#region ../core/src/rendering/immediate/geometry/polygonUnion.js
73
- var h = 1e-8;
74
- function g(e) {
75
- let t = e.flatMap((e, t) => e.map((n, r) => ({
76
- a: n,
77
- b: e[(r + 1) % e.length],
78
- polygonIndex: t
79
- }))), n = [];
80
- for (let r of t) {
81
- let i = [0, 1];
82
- for (let e of t) r.polygonIndex != e.polygonIndex && _(r, e, i);
83
- i.sort((e, t) => e - t);
84
- for (let t = 0; t < i.length - 1; t++) {
85
- let a = i[t], o = i[t + 1];
86
- if (o - a <= h) continue;
87
- let s = C(r.a, r.b, a), c = C(r.a, r.b, o), l = C(s, c, .5);
88
- e.some((e, t) => t != r.polygonIndex && x(l, e)) || n.push({
89
- a: s,
90
- b: c,
91
- polygonIndex: r.polygonIndex
92
- });
93
- }
94
- }
95
- return b(y(n));
96
- }
97
- function _(e, t, n) {
98
- let r = T(e.b, e.a), i = T(t.b, t.a), a = T(t.a, e.a), o = D(r, i);
99
- if (Math.abs(o) > h) {
100
- let e = D(a, i) / o, t = D(a, r) / o;
101
- e > h && e < 1 - h && t >= -1e-8 && t <= 1.00000001 && n.push(e);
102
- } else Math.abs(D(a, r)) <= h && (v(e, t.a, n), v(e, t.b, n));
103
- }
104
- function v(e, t, n) {
105
- let r = T(e.b, e.a), i = E(r, r), a = E(T(t, e.a), r) / i;
106
- a > h && a < 1 - h && n.push(a);
107
- }
108
- function y(e) {
109
- let t = /* @__PURE__ */ new Map();
110
- for (let n of e) {
111
- let e = w(n.a) + ":" + w(n.b), r = w(n.b) + ":" + w(n.a);
112
- t.has(r) ? t.delete(r) : t.has(e) || t.set(e, n);
113
- }
114
- return Array.from(t.values());
115
- }
116
- function b(e) {
117
- let t = /* @__PURE__ */ new Map();
118
- for (let n of e) {
119
- let e = w(n.a), r = t.get(e) ?? [];
120
- r.push(n), t.set(e, r);
121
- }
122
- let n = new Set(e), r = [];
123
- for (; n.size;) {
124
- let e = n.values().next().value, i = [e.a], a = e;
125
- for (;;) {
126
- if (n.delete(a), i.push(a.b), w(a.b) == w(i[0])) {
127
- i.pop();
128
- break;
129
- }
130
- let e = (t.get(w(a.b)) ?? []).find((e) => n.has(e));
131
- if (!e) throw Error("Cannot chain SVG polygon union boundary.");
132
- a = e;
133
- }
134
- r.push(i);
135
- }
136
- return r;
137
- }
138
- function x(e, t) {
139
- let n = !1;
140
- for (let r = 0, i = t.length - 1; r < t.length; i = r++) {
141
- let a = t[i], o = t[r];
142
- if (S(e, a, o)) return !1;
143
- 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);
144
- }
145
- return n;
146
- }
147
- function S(e, t, n) {
148
- return Math.abs(D(T(e, t), T(n, t))) <= h && E(T(e, t), T(e, n)) <= h;
149
- }
150
- function C(e, t, n) {
151
- return {
152
- x: e.x + (t.x - e.x) * n,
153
- y: e.y + (t.y - e.y) * n
154
- };
155
- }
156
- function w(e) {
157
- return `${Math.round(e.x / h)},${Math.round(e.y / h)}`;
158
- }
159
- function T(e, t) {
160
- return {
161
- x: e.x - t.x,
162
- y: e.y - t.y
163
- };
164
- }
165
- function E(e, t) {
166
- return e.x * t.x + e.y * t.y;
167
- }
168
- function D(e, t) {
169
- return e.x * t.y - e.y * t.x;
170
- }
171
- //#endregion
172
- //#region ../core/src/rendering/immediate/markEncoding.js
173
- function O(e, t, n) {
174
- return e.x + t * e.width + n;
175
- }
176
- function k(e, t, n) {
177
- return e.y + (1 - t) * e.height + n;
178
- }
179
- function A(e, t, n, r = [0, 0]) {
180
- return N(e, t.x, t.x2, t.xOffset, t.x2Offset, n, O, r);
181
- }
182
- function j(e, t, n, r = [0, 0]) {
183
- return N(e, t.y, t.y2, t.yOffset, t.y2Offset, n, k, r);
184
- }
185
- function M(e, t, n, r) {
186
- 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 = I(i), f = a ? I(a) : 0, p = i.constant ? P(i, r) + d : 0, m = a?.constant ? P(a, r) + f : 0, h = o.constant ? P(o, r) : 0, g = a && s?.constant ? P(s, r) : 0;
187
- return (e, t) => {
188
- let n = o.constant ? h : P(o, e), r = i.constant ? p : P(i, e) + d, c = l + r * u + n, _ = c;
189
- if (a) {
190
- let t = a.constant ? m : P(a, e) + f, r = s ? s.constant ? g : P(s, e) : n;
191
- _ = l + t * u + r;
192
- }
193
- return t[0] = c, t[1] = _, t;
194
- };
195
- }
196
- function N(e, t, n, r, i, a, o, s) {
197
- let c = P(r, a), l = o(e, F(t, a), c), u = n ? o(e, F(n, a), i ? P(i, a) : c) : l;
198
- return s[0] = l, s[1] = u, s;
199
- }
200
- function P(e, t) {
201
- return e(t);
202
- }
203
- function F(e, t) {
204
- return P(e, t) + I(e);
205
- }
206
- function I(e) {
207
- let t = e.scale;
208
- if (!t) return 0;
209
- let n = e.channelDef, r = n && "band" in n ? n.band ?? .5 : .5;
210
- if (t.type == "band" || t.type == "point") return t.bandwidth() * r;
211
- if (t.type == "index" || t.type == "locus") {
212
- let e = t;
213
- return Math.sign(e.step()) * e.bandwidth() * (r - e.align());
214
- } else return 0;
215
- }
216
- function L(e, t) {
217
- return z(e(t));
218
- }
219
- function R(e, t) {
220
- return r(t) ? e.unitView.paramRuntime.evaluateAndGet(t.expr) : t;
221
- }
222
- function z(e) {
223
- return e == null ? "none" : "" + e;
224
- }
225
- //#endregion
226
- //#region ../core/src/rendering/immediate/marks/arrow.js
227
- function B(e) {
228
- let t = e.properties, n = R(e, t.headSpacing);
229
- return {
230
- configuredRHeadSlope: U(R(e, t.headAngle)),
231
- configuredRHeadNotchSlope: U(R(e, t.headNotchAngle)),
232
- headShape: R(e, t.headShape),
233
- headWidth: R(e, t.headWidth),
234
- minSize: R(e, t.minSize),
235
- stem: R(e, t.stem),
236
- startNotch: R(e, t.startNotch),
237
- minStemLength: R(e, t.minStemLength),
238
- headSpacing: n,
239
- repeatHeads: n != null && n >= 0,
240
- headPlacement: R(e, t.headPlacement)
241
- };
242
- }
243
- function V(e, t, n, r) {
244
- let { coords: i, data: a, visibleBounds: o, viewOpacity: s, countOnly: c } = n, l = e.encoders;
245
- if (a.length == 0) return 0;
246
- let u = M(i, l, "x", a[0]), d = M(i, l, "y", a[0]), f = [0, 0], p = [0, 0], h = 0;
247
- for (let e of a) {
248
- u(e, f), d(e, p);
249
- let [n, i] = f, [a, _] = p, v = {
250
- x: n,
251
- y: a
252
- }, y = {
253
- x: i,
254
- y: _
255
- }, b = L(l.direction, e), x = b == "reverse" ? y : v, S = b == "reverse" ? v : y, C = ae(S, x), w = Math.hypot(C.x, C.y);
256
- if (w == 0) continue;
257
- let T = G(C, 1 / w), E = {
258
- x: -T.y,
259
- y: T.x
260
- }, D = Math.max(P(l.size, e), t.minSize), O = D / 2, k = Math.max(t.headWidth * D, 0) / 2, A = re({
261
- segmentLength: w,
262
- headHalfWidth: k,
263
- stemHalfWidth: t.stem ? O : -O,
264
- configuredRHeadSlope: t.configuredRHeadSlope,
265
- configuredRHeadNotchSlope: t.configuredRHeadNotchSlope,
266
- headRepeat: t.repeatHeads,
267
- headPlacement: t.headPlacement,
268
- startNotch: t.startNotch,
269
- minStemLength: t.minStemLength,
270
- headShape: t.headShape
271
- }), j = t.headShape == "open" ? A : Math.min(t.configuredRHeadNotchSlope, A), M = t.headShape == "open" ? D : 0, N = t.headPlacement == "outside" ? ie(k, A, j, M) : 0, F = t.headPlacement == "outside" ? W(S, G(T, N)) : S, I = k * A, R = Math.hypot(k, I), B = t.headShape == "open" && R > 0 ? D * k / R : 0, V = W(F, G(T, -I - B)), H = P(l.strokeWidth, e), U = Math.max(t.stem ? O : 0, k) + H * 2;
272
- if (!m(o, Math.min(x.x, F.x, V.x), Math.min(x.y, F.y, V.y), Math.max(x.x, F.x, V.x), Math.max(x.y, F.y, V.y), U) || (h++, c)) continue;
273
- let K = t.headShape == "triangle" || t.headShape == "open" ? t.headShape : "triangle", q = t.stem ? te(x, F, T, E, O, A, t.startNotch) : null, J = q ? [q] : [], oe = q && K == "triangle" && !t.repeatHeads && k <= O, Y = I + M / Math.hypot(A, 1) + H, X = t.repeatHeads ? Math.max((t.headSpacing ?? 0) * D, Y) : Infinity, Z = Math.hypot(F.x - x.x, F.y - x.y);
274
- for (let e = 0; !oe && !(e > 0 && e + Y - H / 2 > Z); e += X) {
275
- let n = W(F, G(T, -e));
276
- if (J.push(K == "open" ? ne(n, T, E, k, A, j, D) : ee(n, T, E, k, A, j)), !t.repeatHeads || X <= 0) break;
277
- }
278
- let Q = z(l.stroke(e)) != "none" && P(l.strokeOpacity, e) * s > 0 && H > 0;
279
- r({
280
- datum: e,
281
- boundaryLoops: J.length == 1 || !Q ? J : g(J),
282
- strokeWidth: H,
283
- headShapeFallback: K != t.headShape
284
- });
285
- }
286
- return h;
287
- }
288
- function ee(e, t, n, r, i, a) {
289
- let o = r * i, s = o - r * a, c = W(W(e, G(t, -o)), G(n, r)), l = W(W(e, G(t, -o)), G(n, -r));
290
- return [
291
- e,
292
- c,
293
- W(e, G(t, -s)),
294
- l
295
- ];
296
- }
297
- function te(e, t, n, r, i, a, o) {
298
- let s = i * a, c = W(W(t, G(n, -s)), G(r, i)), l = W(W(t, G(n, -s)), G(r, -i)), u = W(e, G(r, i)), d = W(e, G(r, -i));
299
- return [
300
- t,
301
- c,
302
- u,
303
- ...o ? [W(e, G(n, i * a))] : [],
304
- d,
305
- l
306
- ];
307
- }
308
- function ne(e, t, n, r, i, a, o) {
309
- let s = r * i, c = W(W(e, G(t, -s)), G(n, r)), l = W(W(e, G(t, -s)), G(n, -r)), u = Math.hypot(r, s), d = o * r / u, f = o * s / u, p = W(W(c, G(t, -d)), G(n, -f)), m = W(W(l, G(t, -d)), G(n, f));
310
- return [
311
- e,
312
- c,
313
- p,
314
- W(e, G(t, -(s + d - (r - f) * a))),
315
- m,
316
- l
317
- ];
318
- }
319
- function re({ segmentLength: e, headHalfWidth: t, stemHalfWidth: n, configuredRHeadSlope: r, configuredRHeadNotchSlope: i, headRepeat: a, headPlacement: o, startNotch: s, minStemLength: c, headShape: l }) {
320
- if (a || n < 0) return r;
321
- if (o == "outside") return !s || n <= 0 ? r : Math.min(r, Math.max(e - c, 0) / n);
322
- if (l != "triangle") return r;
323
- let u = Math.max(e - c, 0);
324
- return H(n, t, r, i) <= u ? r : u < n * i ? n > 0 ? K(u / n, 0, r) : 0 : K((u + (t - n) * i) / t, 0, r);
325
- }
326
- function H(e, t, n, r) {
327
- return t * n - (t - e) * Math.min(r, n);
328
- }
329
- function ie(e, t, n, r) {
330
- if (e <= 0) return 0;
331
- let i = e * t, a = Math.hypot(e, i);
332
- return i + r * e / a - (e - r * i / a) * n;
333
- }
334
- function U(e) {
335
- let t = K(e, 1, 90) * Math.PI / 180;
336
- return 1 / Math.max(Math.tan(t), 1e-6);
337
- }
338
- function W(e, t) {
339
- return {
340
- x: e.x + t.x,
341
- y: e.y + t.y
342
- };
343
- }
344
- function ae(e, t) {
345
- return {
346
- x: e.x - t.x,
347
- y: e.y - t.y
348
- };
349
- }
350
- function G(e, t) {
351
- return {
352
- x: e.x * t,
353
- y: e.y * t
354
- };
355
- }
356
- function K(e, t, n) {
357
- return Math.min(Math.max(e, t), n);
358
- }
359
- //#endregion
360
- //#region ../core/src/rendering/immediate/geometry/linkGeometry.js
361
- function q(e, t, n, r) {
362
- if (r.shape == "arc") {
363
- let i = [...e], a = [...t], o = Z(a, i), s = se(o);
364
- if (s == 0) return [
365
- i,
366
- i,
367
- a,
368
- a
369
- ];
370
- let c = Q(o, 1 / s), l = [-c[1], c[0]];
371
- s = J(i, a, s, r.maxChordLength, n);
372
- let u = Q(l, Math.max(s / 2 * r.arcHeightFactor, r.minArcHeight) / .75);
373
- return [
374
- i,
375
- X(i, u),
376
- X(a, u),
377
- a
378
- ];
379
- } else if (r.shape == "dome") {
380
- let i, a, o;
381
- 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]);
382
- let s = se(Z(a, i));
383
- J(i, a, s, r.maxChordLength, n), r.clampApex && oe(i, a, r.orient, n);
384
- let c = Q(o, 1 / .75);
385
- return [
386
- i,
387
- X(i, c),
388
- X(a, c),
389
- a
390
- ];
391
- } else if (r.shape == "diagonal") if (r.orient == "vertical") {
392
- let n = (e[1] + t[1]) / 2;
393
- return [
394
- e,
395
- [e[0], n],
396
- [t[0], n],
397
- t
398
- ];
399
- } else {
400
- let n = (e[0] + t[0]) / 2;
401
- return [
402
- e,
403
- [n, e[1]],
404
- [n, t[1]],
405
- t
406
- ];
407
- }
408
- else if (r.shape == "line") {
409
- let n = Q(X(e, t), .5);
410
- return [
411
- e,
412
- n,
413
- n,
414
- t
415
- ];
416
- } else throw Error(`Unsupported link shape: ${r.shape}`);
417
- }
418
- function J(e, t, n, r, i) {
419
- if (n <= r) return n;
420
- let a = Q(Z(t, e), 1 / n);
421
- return Y(e, i, 2) ? (ce(t, X(e, Q(a, r))), r) : Y(t, i, 2) ? (ce(e, Z(t, Q(a, r))), r) : n;
422
- }
423
- function oe(e, t, n, r) {
424
- 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])));
425
- }
426
- function Y(e, t, n) {
427
- return e[0] >= -t.width * n && e[0] <= t.width * (1 + n) && e[1] >= -t.height * n && e[1] <= t.height * (1 + n);
428
- }
429
- function X(e, t) {
430
- return [e[0] + t[0], e[1] + t[1]];
431
- }
432
- function Z(e, t) {
433
- return [e[0] - t[0], e[1] - t[1]];
434
- }
435
- function Q(e, t) {
436
- return [e[0] * t, e[1] * t];
437
- }
438
- function se(e) {
439
- return Math.hypot(e[0], e[1]);
440
- }
441
- function ce(e, t) {
442
- e[0] = t[0], e[1] = t[1];
443
- }
444
- //#endregion
445
- //#region ../core/src/rendering/immediate/marks/link.js
446
- function le(e) {
447
- let t = e.properties;
448
- return {
449
- shape: R(e, t.linkShape),
450
- orient: R(e, t.orient),
451
- arcHeightFactor: R(e, t.arcHeightFactor),
452
- minArcHeight: R(e, t.minArcHeight),
453
- maxChordLength: R(e, t.maxChordLength),
454
- clampApex: R(e, t.clampApex)
455
- };
456
- }
457
- function ue(e, t, n, r) {
458
- let { coords: i, data: a, visibleBounds: o } = n, s = e.encoders;
459
- if (a.length == 0) return 0;
460
- let c = M(i, s, "x", a[0]), l = M(i, s, "y", a[0]), u = [0, 0], d = [0, 0], f = i.x, p = i.y, h = {
461
- width: i.width,
462
- height: i.height
463
- }, g = p + h.height, _ = 0;
464
- for (let e of a) {
465
- c(e, u), l(e, d);
466
- let [n, i] = u, [a, p] = d, v = q([n - f, g - a], [i - f, g - p], h, t);
467
- for (let e of v) e[0] += f, e[1] = g - e[1];
468
- let [y, b, x, S] = v, C = P(s.size, e);
469
- m(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({
470
- datum: e,
471
- points: v,
472
- strokeWidth: C
473
- }));
474
- }
475
- return _;
476
- }
477
- //#endregion
478
- //#region ../core/src/rendering/immediate/marks/point.js
479
- function de(e) {
480
- return { inwardStroke: R(e, e.properties.inwardStroke) };
481
- }
482
- function fe(e, t, n, r) {
483
- let { coords: i, data: a, visibleBounds: o, anchorCullBounds: s } = n, c = e.encoders;
484
- if (a.length == 0) return 0;
485
- let l = M(i, c, "x", a[0]), u = M(i, c, "y", a[0]), d = [0, 0], f = [0, 0], h = e.getSemanticThreshold(), g = {
486
- datum: {},
487
- shape: "circle",
488
- x: 0,
489
- y: 0,
490
- geometryRadius: 0,
491
- angle: 0,
492
- strokeWidth: 0,
493
- lineShape: !1
494
- }, _ = 0;
495
- for (let e of a) {
496
- if (P(c.semanticScore, e) < h) continue;
497
- l(e, d), u(e, f);
498
- let n = d[0] + P(c.dx, e), i = f[0] - P(c.dy, e);
499
- if (p(s, n, i)) continue;
500
- let a = Math.sqrt(P(c.size, e)) / 2;
501
- if (t.inwardStroke && a <= 0) continue;
502
- let v = L(c.shape, e), y = P(c.strokeWidth, e), b = v == "x" || v == "+", x = t.inwardStroke && !b ? Math.min(y, a) : y, S = t.inwardStroke && !b ? a - x / 2 : a, C = t.inwardStroke ? 0 : y / 2, w = a * Math.SQRT2 + C;
503
- m(o, n - w, i - w, n + w, i + w) && (_++, g.datum = e, g.shape = v, g.x = n, g.y = i, g.geometryRadius = S, g.angle = P(c.angle, e), g.strokeWidth = x, g.lineShape = b, r(g));
504
- }
505
- return _;
506
- }
507
- //#endregion
508
- //#region ../core/src/rendering/immediate/geometry/pointPath.js
509
- function pe(e, t, n, r, i) {
510
- let a = r * .4, o = r * .15, s = Math.sqrt(3) * r / 2;
511
- switch (e) {
512
- 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;
513
- 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;
514
- case "triangle-up": return i.moveTo(t, n - s), i.lineTo(t + r, n + s), i.lineTo(t - r, n + s), i.closePath(), !0;
515
- case "triangle-right": return i.moveTo(t + s, n), i.lineTo(t - s, n + r), i.lineTo(t - s, n - r), i.closePath(), !0;
516
- case "triangle-down": return i.moveTo(t, n + s), i.lineTo(t - r, n - s), i.lineTo(t + r, n - s), i.closePath(), !0;
517
- case "triangle-left": return i.moveTo(t - s, n), i.lineTo(t + s, n - r), i.lineTo(t + s, n + r), i.closePath(), !0;
518
- case "tick-up": return $(i, t - o, n - r, t + o, n), !0;
519
- case "tick-right": return $(i, t, n - o, t + r, n + o), !0;
520
- case "tick-down": return $(i, t - o, n, t + o, n + r), !0;
521
- case "tick-left": return $(i, t - r, n - o, t, n + o), !0;
522
- case "+": return i.moveTo(t - r, n), i.lineTo(t + r, n), i.moveTo(t, n - r), i.lineTo(t, n + r), !0;
523
- 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;
524
- default: return !1;
525
- }
526
- }
527
- function $(e, t, n, r, i) {
528
- e.moveTo(t, n), e.lineTo(r, n), e.lineTo(r, i), e.lineTo(t, i), e.closePath();
529
- }
530
- //#endregion
531
- //#region ../core/src/rendering/immediate/marks/rect.js
532
- var me = .1;
533
- function he(e) {
534
- let t = e.properties, n = R(e, t.cornerRadius), r = {
535
- topLeft: R(e, t.cornerRadiusTopLeft ?? n),
536
- topRight: R(e, t.cornerRadiusTopRight ?? n),
537
- bottomRight: R(e, t.cornerRadiusBottomRight ?? n),
538
- bottomLeft: R(e, t.cornerRadiusBottomLeft ?? n)
539
- }, i = {
540
- blur: R(e, t.shadowBlur ?? 0),
541
- color: R(e, t.shadowColor ?? "black"),
542
- offsetX: R(e, t.shadowOffsetX ?? 0),
543
- offsetY: R(e, t.shadowOffsetY ?? 0),
544
- opacity: R(e, t.shadowOpacity ?? 0)
545
- }, a = R(e, t.hatch ?? "none");
546
- return {
547
- cornerRadii: r,
548
- minWidth: R(e, t.minWidth),
549
- minHeight: R(e, t.minHeight),
550
- minOpacity: R(e, t.minOpacity),
551
- shadow: i,
552
- hatch: a,
553
- canPadSeams: a == "none" && i.opacity == 0 && ye(r)
554
- };
555
- }
556
- function ge(e, t, n, r) {
557
- let { coords: i, data: a, visibleBounds: o, viewOpacity: s } = n, c = e.encoders;
558
- if (a.length == 0) return 0;
559
- let l = c.strokeWidth.constant ? P(c.strokeWidth, a[0]) : 0, u = c.fillOpacity.constant ? P(c.fillOpacity, a[0]) : 0, d = M(i, c, "x", a[0]), f = M(i, c, "y", a[0]), p = [0, 0], h = [0, 0], g = {
560
- datum: {},
561
- x: 0,
562
- y: 0,
563
- width: 0,
564
- height: 0,
565
- radii: {
566
- topLeft: 0,
567
- topRight: 0,
568
- bottomRight: 0,
569
- bottomLeft: 0
570
- },
571
- opacityFactor: 1,
572
- strokeWidth: 0,
573
- fill: "none",
574
- fillOpacity: 0
575
- }, _ = 0;
576
- for (let e of a) {
577
- d(e, p), f(e, h);
578
- let n = Math.min(p[0], p[1]), i = Math.min(h[0], h[1]), a = Math.abs(p[1] - p[0]), v = Math.abs(h[1] - h[0]), y = _e(a, t.minWidth), b = _e(v, t.minHeight), x = Math.max(t.minOpacity, y * b);
579
- a < t.minWidth && (n -= (t.minWidth - a) / 2, a = t.minWidth), v < t.minHeight && (i -= (t.minHeight - v) / 2, v = t.minHeight);
580
- let S = c.strokeWidth.constant ? l : P(c.strokeWidth, e), C = z(c.fill(e)), w = (c.fillOpacity.constant ? u : P(c.fillOpacity, e)) * s, T = S == 0 && w == 1 && x == 1 && t.canPadSeams && C != "none" ? me : 0;
581
- T && (n -= T, i -= T, a += T * 2, v += T * 2);
582
- let E = t.shadow.opacity > 0 ? t.shadow.blur + Math.max(Math.abs(t.shadow.offsetX), Math.abs(t.shadow.offsetY)) : 0;
583
- m(o, n, i, n + a, i + v, S / 2 + E) && (_++, g.datum = e, g.x = n, g.y = i, g.width = a, g.height = v, g.opacityFactor = x, g.strokeWidth = S, g.fill = C, g.fillOpacity = w, ve(t.cornerRadii, a, v, g.radii), r(g));
584
- }
585
- return _;
586
- }
587
- function _e(e, t) {
588
- return t > 0 && e < t ? e / t : 1;
589
- }
590
- function ve(e, t, n, r) {
591
- let i = Math.min(t, n) / 2;
592
- 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));
593
- }
594
- function ye(e) {
595
- return e.topLeft == 0 && e.topRight == 0 && e.bottomRight == 0 && e.bottomLeft == 0;
596
- }
597
- //#endregion
598
- //#region ../core/src/rendering/immediate/marks/rule.js
599
- function be(e) {
600
- return { minLength: R(e, e.properties.minLength) };
601
- }
602
- function xe(e, t, n, r) {
603
- let { coords: i, data: a, visibleBounds: o } = n, s = e.encoders;
604
- if (a.length == 0) return 0;
605
- let c = M(i, s, "x", a[0]), l = M(i, s, "y", a[0]), u = [0, 0], d = [0, 0], f = {
606
- datum: {},
607
- x1: 0,
608
- y1: 0,
609
- x2: 0,
610
- y2: 0,
611
- strokeWidth: 0
612
- }, p = 0;
613
- for (let e of a) {
614
- c(e, u), l(e, d);
615
- let [n, i] = u, [a, h] = d, g = i - n, _ = h - a, v = Math.hypot(g, _);
616
- if (v > 0 && v < t.minLength) {
617
- let e = (t.minLength - v) / 2, r = g / v, o = _ / v;
618
- n -= r * e, a -= o * e, i += r * e, h += o * e;
619
- }
620
- let y = P(s.size, e);
621
- m(o, n, a, i, h, y / 2) && (p++, f.datum = e, f.x1 = n, f.y1 = a, f.x2 = i, f.y2 = h, f.strokeWidth = y, r(f));
622
- }
623
- return p;
624
- }
625
- //#endregion
626
- //#region ../core/src/rendering/immediate/marks/text.js
627
- function Se(e) {
628
- let t = e.properties;
629
- return {
630
- align: R(e, t.align),
631
- baseline: R(e, t.baseline),
632
- logoLetters: R(e, t.logoLetters),
633
- paddingX: R(e, t.paddingX),
634
- paddingY: R(e, t.paddingY),
635
- flushX: R(e, t.flushX),
636
- flushY: R(e, t.flushY),
637
- squeeze: R(e, t.squeeze),
638
- dx: R(e, t.dx),
639
- dy: R(e, t.dy)
640
- };
641
- }
642
- function Ce(r, i, a, o) {
643
- let { coords: s, data: c, visibleBounds: l, anchorCullBounds: u } = a, { align: d, baseline: f } = i, m = r.encoders;
644
- if (c.length == 0) return 0;
645
- let h = m.size.constant ? P(m.size, c[0]) : 0, g = m.angle.constant ? P(m.angle, c[0]) : 0, _ = M(s, m, "x", c[0]), v = M(s, m, "y", c[0]), y = r.encoding.text, b = "format" in y ? t(y.format) : (e) => e, x = [0, 0], S = [0, 0], C = {
646
- width: 0,
647
- height: 0
648
- }, w = {
649
- x: 0,
650
- y: 0
651
- }, T = {
652
- position: 0,
653
- scale: 0
654
- }, E = {
655
- width: 0,
656
- heightScale: 0
657
- }, D = {
658
- datum: {},
659
- text: "",
660
- x: 0,
661
- y: 0,
662
- size: 0,
663
- width: 0,
664
- angle: 0,
665
- dx: i.dx,
666
- dy: i.dy,
667
- fadeOpacity: 1,
668
- scale: 1,
669
- logoScale: void 0,
670
- multiCharacterLogo: !1
671
- }, O = !!m.x2, k = !!m.y2, A = 0;
672
- for (let t of c) {
673
- let a = b(m.text(t)), c = e(a) ? a : a === null ? "" : "" + a;
674
- if (!c) continue;
675
- _(t, x), v(t, S);
676
- let [y, j] = x, [M, N] = S, F = m.size.constant ? h : P(m.size, t), I = m.angle.constant ? g : P(m.angle, t);
677
- if (i.logoLetters) {
678
- let e = F, n = F;
679
- if (O && (e = j - y, y = (y + j) / 2), k && (n = M - N, M = (M + N) / 2), !e || !n || p(u, y, M) || !we(l, y, M, Math.abs(e), Math.abs(n), "center", "middle", I, i.dx, i.dy)) continue;
680
- let a = r.font.metrics.getChar(c[0]), s = n * r.font.metrics.common.base * (a.height + 10) / (a.height * a.height);
681
- A++, D.datum = t, D.text = c, D.x = y, D.y = M, D.size = 1, D.width = 1, D.angle = I, D.fadeOpacity = 1, D.scale = 1, E.width = e, E.heightScale = s, D.logoScale = E, D.multiCharacterLogo = c.length > 1, o(D);
682
- continue;
683
- }
684
- let L = r.font.metrics.measureWidth(c, F);
685
- Te(L, F, I, C), O || k ? De(d, f, I, w) : (w.x = Oe[d], w.y = ke[f]);
686
- let R = 1;
687
- if (O && (Ee(Math.min(y, j), Math.max(y, j), C.width, i.paddingX, w.x, i.flushX, s.x, s.x2, T), y = T.position, R *= T.scale), k && (Ee(Math.min(M, N), Math.max(M, N), C.height * R, i.paddingY, w.y, i.flushY, s.y, s.y2, T), M = T.position, R *= T.scale), p(u, y, M)) continue;
688
- let z = 1;
689
- if (R < 1) {
690
- if (!i.squeeze || R < 3 / F) continue;
691
- z = n(3 / F, 6 / F, R);
692
- }
693
- let B = F * R, V = L * R;
694
- we(l, y, M, V, B, d, f, I, i.dx, i.dy) && (A++, D.datum = t, D.text = c, D.x = y, D.y = M, D.size = B, D.width = V, D.angle = I, D.fadeOpacity = z, D.scale = R, D.logoScale = void 0, D.multiCharacterLogo = !1, o(D));
695
- }
696
- return A;
697
- }
698
- function we(e, t, n, r, i, a, o, s, c, l) {
699
- let u = t + c - (Oe[a] + 1) / 2 * r, d = n + l - (ke[o] + 1) / 2 * i, f = u + r, p = d + i;
700
- if (!s) return m(e, u, d, f, p, 1);
701
- let h = s * Math.PI / 180, g = Math.sin(h), _ = Math.cos(h), v = t + (u - t) * _ - (d - n) * g, y = n + (u - t) * g + (d - n) * _, b = t + (f - t) * _ - (d - n) * g, x = n + (f - t) * g + (d - n) * _, S = t + (f - t) * _ - (p - n) * g, C = n + (f - t) * g + (p - n) * _, w = t + (u - t) * _ - (p - n) * g, T = n + (u - t) * g + (p - n) * _;
702
- return m(e, Math.min(v, b, S, w), Math.min(y, x, C, T), Math.max(v, b, S, w), Math.max(y, x, C, T), 1);
703
- }
704
- function Te(e, t, n, r) {
705
- let i = n * Math.PI / 180, a = Math.abs(Math.sin(i)), o = Math.abs(Math.cos(i));
706
- r.width = e * o + t * a, r.height = e * a + t * o;
707
- }
708
- function Ee(e, t, n, r, i, a, o, s, c) {
709
- let l = t - e, u = n + 2 * r;
710
- if (e > s || t < o) {
711
- c.position = 0, c.scale = 0;
712
- return;
713
- }
714
- let d = Math.max(0, l - u), f;
715
- if (i == 0) {
716
- let n = e + t;
717
- if (a) {
718
- let e = Math.max(0, 2 * o + u - n);
719
- n += Math.min(e, d);
720
- let t = Math.max(0, u + n - 2 * s);
721
- n -= Math.min(t, d);
722
- }
723
- f = n / 2;
724
- } else if (i < 0) {
725
- let t = e;
726
- a && (t += Math.min(Math.max(0, o - t), d)), f = t + r;
727
- } else {
728
- let e = t;
729
- a && (e -= Math.min(Math.max(0, e - s), d)), f = e - r;
730
- }
731
- c.position = f, c.scale = Math.max(0, Math.min(1, (l - r) / u));
732
- }
733
- function De(e, t, n, r) {
734
- let i = Oe[e], a = -ke[t], o = ((n + 45) % 360 + 360) % 360, s, c;
735
- 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;
736
- }
737
- var Oe = {
738
- left: -1,
739
- center: 0,
740
- right: 1
741
- }, ke = {
742
- top: -1,
743
- middle: 0,
744
- bottom: 1,
745
- alphabetic: 1,
746
- baseline: 1
747
- }, Ae = {
748
- thin: 100,
749
- light: 300,
750
- regular: 400,
751
- normal: 400,
752
- medium: 500,
753
- bold: 700,
754
- black: 900
755
- };
756
- function je(e) {
757
- return typeof e == "number" ? e : Ae[e];
758
- }
759
- //#endregion
760
- //#region ../core/src/rendering/nativeText.js
761
- var Me = [
762
- "Lato",
763
- "Avenir Next",
764
- "Avenir",
765
- "Segoe UI",
766
- "Ubuntu",
767
- "Noto Sans",
768
- "Helvetica Neue",
769
- "Helvetica",
770
- "Arial",
771
- "sans-serif"
772
- ], Ne = /* @__PURE__ */ new Set([
773
- "serif",
774
- "sans-serif",
775
- "monospace",
776
- "cursive",
777
- "fantasy",
778
- "system-ui",
779
- "ui-serif",
780
- "ui-sans-serif",
781
- "ui-monospace",
782
- "ui-rounded",
783
- "emoji",
784
- "math",
785
- "fangsong"
786
- ]);
787
- function Pe(e) {
788
- let t = e ?? "Lato";
789
- return [t, ...Me.filter((e) => e.toLowerCase() != t.toLowerCase())].map(Ie).join(", ");
790
- }
791
- function Fe(e, t) {
792
- switch (e) {
793
- case "top": return .79 * t;
794
- case "middle": return .35 * t;
795
- case "bottom": return -.21 * t;
796
- case "alphabetic":
797
- case "baseline": return 0;
798
- default: throw Error(`Unknown text baseline: ${e}`);
799
- }
800
- }
801
- function Ie(e) {
802
- let t = e.toLowerCase();
803
- return Ne.has(t) ? t : `'${e.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'`;
804
- }
805
- //#endregion
806
- export { u as C, o as E, d as S, m as T, P as _, Ce as a, R as b, he as c, de as d, fe as f, V as g, B as h, Se as i, ge as l, ue as m, Fe as n, be as o, le as p, je as r, xe as s, Pe as t, pe as u, A as v, f as w, z as x, j as y };