@genome-spy/app 1.1.1 → 1.3.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 (96) hide show
  1. package/dist/{SharedReadCache-Ey5QIiPM.js → SharedReadCache-9sT2aIxW.js} +6 -12
  2. package/dist/__vite-browser-external-Dgu_Ldik.js +7 -0
  3. package/dist/{agentApi-sPuuT0KS.js → agentApi-BclFF9zB.js} +9981 -8914
  4. package/dist/agentApi.es.js +6783 -5135
  5. package/dist/agentShared.es.js +433 -460
  6. package/dist/arrayUtils-Bm7QnzhN.js +1306 -0
  7. package/dist/{blosc-JROzDOnd.js → blosc-C-W97QwH.js} +3 -3
  8. package/dist/{canvas2d-iDK4BC5j.js → canvas2d-8MSf70d4.js} +141 -134
  9. package/dist/{canvas2d-MXaFeZnP.js → canvas2d-BwGNI_Rx.js} +147 -141
  10. package/dist/clipOptions-SrrxeAEU.js +4316 -0
  11. package/dist/clipOptions-clBEbkjv.js +4326 -0
  12. package/dist/{layoutResult-D50MSHXR.js → color-jETn8xK_.js} +29 -10
  13. package/dist/color-uTRRsy8i.js +116 -0
  14. package/dist/{componentStyles-DGtQXvwc.js → componentStyles-C7FbjS-a.js} +1 -1
  15. package/dist/{viewIdentityRegistry-BIYd4TE0.js → containerView-BItRtKqu.js} +28 -31
  16. package/dist/{viewIdentityRegistry-BDKkEjXl.js → containerView-CWa6ZIJW.js} +28 -31
  17. package/dist/{debug-DbigmdrK.js → debug-23s-jja_.js} +10 -9
  18. package/dist/{debug-BlqDxTw3.js → debug-CWRxvAss.js} +9 -10
  19. package/dist/dialog.es.js +1 -1
  20. package/dist/dist-CmY6iewb.js +1501 -0
  21. package/dist/dist-D6xbz5Ks.js +1501 -0
  22. package/dist/{esm-CjkeZi__.js → esm-BFwBAnbO.js} +25 -25
  23. package/dist/esm-BUkWqSr2.js +299 -0
  24. package/dist/{esm-C-6g-SkZ.js → esm-C0xXMLsR.js} +37 -41
  25. package/dist/{esm-CJeszW-t.js → esm-C2xhhXs0.js} +7 -7
  26. package/dist/esm-C6erfjPM.js +252 -0
  27. package/dist/{esm-DFHFX1sH.js → esm-CVjC7qA4.js} +34 -38
  28. package/dist/esm-CqY5ezGz.js +1249 -0
  29. package/dist/esm-DfMIJ_N2.js +1522 -0
  30. package/dist/esm-Dls41IbZ.js +787 -0
  31. package/dist/{esm-Bv7Frz7C.js → esm-DzQDfrsZ.js} +7 -10
  32. package/dist/esm-aGLCvYRP.js +238 -0
  33. package/dist/{esm-VFJeyk9i.js → esm-nzwgJFGz.js} +40 -36
  34. package/dist/figWigMetadataSourceAdapter-8Kf_vZRf.js +36 -0
  35. package/dist/figWigMetadataSourceAdapter-DdDMZpYO.js +36 -0
  36. package/dist/flowNode-BSjy0Wz3.js +1306 -0
  37. package/dist/flowOutput-D5qpxWe0.js +183 -0
  38. package/dist/index.es.js +4766 -5522
  39. package/dist/index.js +1089 -685
  40. package/dist/inflate-BdC5KvHn.js +886 -0
  41. package/dist/{lz4-CUYSbVey.js → lz4-BLPgBOlE.js} +1 -1
  42. package/dist/markUtils-RaatLEa-.js +78 -0
  43. package/dist/{metadataChannels-DV62inJh.js → metadataChannels-DLSmx7kU.js} +6 -3
  44. package/dist/metadataUtils-DxEPe0vj.js +879 -0
  45. package/dist/order-BnKzKjt4.js +1151 -0
  46. package/dist/order-BpJnq_nV.js +1150 -0
  47. package/dist/{parquetRead-0hFIa3Cc.js → parquetRead-D-yY8njE.js} +3 -11
  48. package/dist/{rasterExport-B62RmAK1.js → rasterExport-B-WrX1pa.js} +5 -5
  49. package/dist/{rasterExport-DQH3hVg_.js → rasterExport-C_vx4Jwd.js} +4 -4
  50. package/dist/{rasterization-B05bDo5e.js → rasterization-QktH8Sn2.js} +26 -19
  51. package/dist/rectangle-BAdoDPXu.js +194 -0
  52. package/dist/{rectangle-DE98gIxF.js → rectangle-DZTR6NFQ.js} +10 -1
  53. package/dist/renderCanvas2D-CsRO78Pq.js +291 -0
  54. package/dist/{renderCanvas2D-Bdv-B4wj.js → renderCanvas2D-Y7pkRzbC.js} +98 -92
  55. package/dist/{rolldown-runtime-DF993M8W.js → rolldown-runtime-DeIk2rA4.js} +1 -1
  56. package/dist/{indexer-DbFTKGlm.js → scaleNull-CVzag4z8.js} +2 -12
  57. package/dist/{indexer-En7gpvLN.js → scaleNull-Pbz7QGnl.js} +2 -12
  58. package/dist/{scalePosition-ByvlXaML.js → scalePosition-CRXa0rCC.js} +8 -1
  59. package/dist/schema.json +33403 -16929
  60. package/dist/style.css +1 -1
  61. package/dist/{svg-N3tj05-e.js → svg-BBMtLgtM.js} +445 -362
  62. package/dist/{svg-DHsq1RpV.js → svg-JjWL6U-T.js} +464 -381
  63. package/dist/{svgRasterizer-CYVDlt5z.js → svgRasterizer-6OcftuoI.js} +3 -3
  64. package/dist/{svgRasterizer-CvCBlxLj.js → svgRasterizer-DkNRaCPs.js} +4 -4
  65. package/dist/tableMetadataSourceAdapter-CUNwLsdi.js +291 -0
  66. package/dist/tableMetadataSourceAdapter-DQrEXCo6.js +1283 -0
  67. package/dist/url-DeOdSRrv.js +183 -0
  68. package/dist/viewError-B0TMfOpB.js +33 -0
  69. package/dist/viewError-D9aO90cI.js +33 -0
  70. package/dist/{viewSelectors-DDLW-byr.js → viewSelectors-DkFvo33d.js} +914 -752
  71. package/dist/{viewSelectors-j-F9XwsE.js → viewSelectors-lM93fHAq.js} +942 -780
  72. package/dist/viewUtils-0SJOewM6.js +6195 -0
  73. package/dist/webgl-CXIO3OQz.js +5782 -0
  74. package/dist/webgl-Pdvfhio5.js +5783 -0
  75. package/package.json +7 -5
  76. package/src/agentApi/index.d.ts +3 -2
  77. package/src/agentShared/index.d.ts +2 -0
  78. package/src/appTypes.d.ts +1 -6
  79. package/src/embedTypes.d.ts +36 -1
  80. package/src/index.d.ts +6 -0
  81. package/src/spec/sampleView.d.ts +68 -13
  82. package/src/spec/view.d.ts +44 -5
  83. package/src/state/paramProvenanceTypes.d.ts +25 -2
  84. package/src/state.d.ts +14 -52
  85. package/dist/clipOptions-B5PibDq3.js +0 -2923
  86. package/dist/clipOptions-Cba4I0AO.js +0 -2903
  87. package/dist/esm-Dndm-NaA.js +0 -1193
  88. package/dist/order-B4uR9Q04.js +0 -1062
  89. package/dist/order-BSPy5DI8.js +0 -1062
  90. package/dist/renderCanvas2D-ChdoHGrU.js +0 -285
  91. package/dist/vega-scale-Byaw1K8O.js +0 -2446
  92. package/dist/vega-scale-Ctz_wa3z.js +0 -2443
  93. package/dist/viewError-BiR9VCgL.js +0 -29
  94. package/dist/viewUtils-JX6CMEYH.js +0 -6664
  95. package/dist/webgl-DdmOwEH0.js +0 -5544
  96. package/dist/webgl-Dw8xqZpX.js +0 -5544
@@ -0,0 +1,1283 @@
1
+ import { C as e, J as t, Q as n, S as r, X as i, Y as a, Z as o, _ as s, b as c, d as l, f as u, h as d, l as f, m as ee, p as te, q as ne, tt as re, u as ie, v as ae, w as p, x as oe, y as se } from "./flowNode-BSjy0Wz3.js";
2
+ import { l as m, o as h, t as g, u as ce } from "./url-DeOdSRrv.js";
3
+ //#region ../../node_modules/vega-loader/node_modules/vega-util/build/accessor.js
4
+ function _(e, t, n) {
5
+ return Object.assign(e, {
6
+ fields: t || [],
7
+ fname: n
8
+ });
9
+ }
10
+ //#endregion
11
+ //#region ../../node_modules/vega-loader/node_modules/vega-util/build/getter.js
12
+ function le(e) {
13
+ return e.length === 1 ? ue(e[0]) : de(e);
14
+ }
15
+ var ue = (e) => function(t) {
16
+ return t[e];
17
+ }, de = (e) => {
18
+ let t = e.length;
19
+ return function(n) {
20
+ for (let r = 0; r < t; ++r) n = n[e[r]];
21
+ return n;
22
+ };
23
+ };
24
+ //#endregion
25
+ //#region ../../node_modules/vega-loader/node_modules/vega-util/build/error.js
26
+ function v(e) {
27
+ throw Error(e);
28
+ }
29
+ //#endregion
30
+ //#region ../../node_modules/vega-loader/node_modules/vega-util/build/splitAccessPath.js
31
+ function fe(e) {
32
+ let t = [], n = e.length, r = null, i = 0, a = "", o, s, c;
33
+ e += "";
34
+ function l() {
35
+ t.push(a + e.substring(o, s)), a = "", o = s + 1;
36
+ }
37
+ for (o = s = 0; s < n; ++s) if (c = e[s], c === "\\") a += e.substring(o, s++), o = s;
38
+ else if (c === r) l(), r = null, i = -1;
39
+ else if (r) continue;
40
+ else o === i && c === "\"" || o === i && c === "'" ? (o = s + 1, r = c) : c === "." && !i ? s > o ? l() : o = s + 1 : c === "[" ? (s > o && l(), i = o = s + 1) : c === "]" && (i || v("Access path missing open bracket: " + e), i > 0 && l(), i = 0, o = s + 1);
41
+ return i && v("Access path missing closing bracket: " + e), r && v("Access path missing closing quote: " + e), s > o && (s++, l()), t;
42
+ }
43
+ //#endregion
44
+ //#region ../../node_modules/vega-loader/node_modules/vega-util/build/field.js
45
+ function pe(e, t, n) {
46
+ let r = fe(e), i = r.length === 1 ? r[0] : e;
47
+ return _((n && n.get || le)(r), [i], t || i);
48
+ }
49
+ pe("id");
50
+ var me = _((e) => e, [], "identity");
51
+ _(() => 0, [], "zero"), _(() => 1, [], "one"), _(() => !0, [], "true"), _(() => !1, [], "false"), [...Object.getOwnPropertyNames(Object.prototype).filter((e) => typeof Object.prototype[e] == "function")];
52
+ //#endregion
53
+ //#region ../../node_modules/vega-loader/node_modules/vega-util/build/isArray.js
54
+ var he = Array.isArray;
55
+ //#endregion
56
+ //#region ../../node_modules/vega-loader/node_modules/vega-util/build/isObject.js
57
+ function ge(e) {
58
+ return e === Object(e);
59
+ }
60
+ //#endregion
61
+ //#region ../../node_modules/vega-loader/node_modules/vega-util/build/toNumber.js
62
+ function _e(e) {
63
+ return e == null || e === "" ? null : +e;
64
+ }
65
+ //#endregion
66
+ //#region ../../node_modules/vega-loader/node_modules/vega-util/build/isFunction.js
67
+ function y(e) {
68
+ return typeof e == "function";
69
+ }
70
+ //#endregion
71
+ //#region ../../node_modules/vega-loader/node_modules/vega-util/build/extend.js
72
+ function b(e, ...t) {
73
+ for (let n of t) for (let t in n) e[t] = n[t];
74
+ return e;
75
+ }
76
+ //#endregion
77
+ //#region ../../node_modules/vega-loader/node_modules/vega-util/build/hasOwnProperty.js
78
+ function ve(e, t) {
79
+ return Object.hasOwn(e, t);
80
+ }
81
+ //#endregion
82
+ //#region ../../node_modules/vega-loader/node_modules/vega-util/build/isDate.js
83
+ function ye(e) {
84
+ return Object.prototype.toString.call(e) === "[object Date]";
85
+ }
86
+ //#endregion
87
+ //#region ../../node_modules/vega-loader/node_modules/vega-util/build/isIterable.js
88
+ function be(e) {
89
+ return e != null && y(e[Symbol.iterator]);
90
+ }
91
+ //#endregion
92
+ //#region ../../node_modules/vega-loader/node_modules/vega-util/build/isNumber.js
93
+ function xe(e) {
94
+ return typeof e == "number";
95
+ }
96
+ //#endregion
97
+ //#region ../../node_modules/vega-loader/node_modules/vega-util/build/isString.js
98
+ function Se(e) {
99
+ return typeof e == "string";
100
+ }
101
+ //#endregion
102
+ //#region ../../node_modules/vega-loader/node_modules/vega-util/build/stringValue.js
103
+ function x(e) {
104
+ return he(e) ? `[${e.map((e) => e === null ? "null" : x(e))}]` : ge(e) || Se(e) ? JSON.stringify(e).replaceAll("\u2028", "\\u2028").replaceAll("\u2029", "\\u2029") : e;
105
+ }
106
+ //#endregion
107
+ //#region ../../node_modules/vega-loader/node_modules/vega-util/build/toBoolean.js
108
+ function Ce(e) {
109
+ return e == null || e === "" ? null : !e || e === "false" || e === "0" ? !1 : !!e;
110
+ }
111
+ //#endregion
112
+ //#region ../../node_modules/vega-loader/node_modules/vega-util/build/toDate.js
113
+ var we = (e) => xe(e) || ye(e) ? e : Date.parse(e);
114
+ function Te(e, t) {
115
+ return t ||= we, e == null || e === "" ? null : t(e);
116
+ }
117
+ //#endregion
118
+ //#region ../../node_modules/vega-loader/node_modules/vega-util/build/toString.js
119
+ function Ee(e) {
120
+ return e == null || e === "" ? null : e + "";
121
+ }
122
+ //#endregion
123
+ //#region ../../node_modules/d3-dsv/src/dsv.js
124
+ var S = {}, C = {}, w = 34, T = 10, E = 13;
125
+ function D(e) {
126
+ return Function("d", "return {" + e.map(function(e, t) {
127
+ return JSON.stringify(e) + ": d[" + t + "] || \"\"";
128
+ }).join(",") + "}");
129
+ }
130
+ function De(e, t) {
131
+ var n = D(e);
132
+ return function(r, i) {
133
+ return t(n(r), i, e);
134
+ };
135
+ }
136
+ function O(e) {
137
+ var t = Object.create(null), n = [];
138
+ return e.forEach(function(e) {
139
+ for (var r in e) r in t || n.push(t[r] = r);
140
+ }), n;
141
+ }
142
+ function k(e, t) {
143
+ var n = e + "", r = n.length;
144
+ return r < t ? Array(t - r + 1).join(0) + n : n;
145
+ }
146
+ function Oe(e) {
147
+ return e < 0 ? "-" + k(-e, 6) : e > 9999 ? "+" + k(e, 6) : k(e, 4);
148
+ }
149
+ function ke(e) {
150
+ var t = e.getUTCHours(), n = e.getUTCMinutes(), r = e.getUTCSeconds(), i = e.getUTCMilliseconds();
151
+ return isNaN(e) ? "Invalid Date" : Oe(e.getUTCFullYear(), 4) + "-" + k(e.getUTCMonth() + 1, 2) + "-" + k(e.getUTCDate(), 2) + (i ? "T" + k(t, 2) + ":" + k(n, 2) + ":" + k(r, 2) + "." + k(i, 3) + "Z" : r ? "T" + k(t, 2) + ":" + k(n, 2) + ":" + k(r, 2) + "Z" : n || t ? "T" + k(t, 2) + ":" + k(n, 2) + "Z" : "");
152
+ }
153
+ function A(e) {
154
+ var t = RegExp("[\"" + e + "\n\r]"), n = e.charCodeAt(0);
155
+ function r(e, t) {
156
+ var n, r, a = i(e, function(e, i) {
157
+ if (n) return n(e, i - 1);
158
+ r = e, n = t ? De(e, t) : D(e);
159
+ });
160
+ return a.columns = r || [], a;
161
+ }
162
+ function i(e, t) {
163
+ var r = [], i = e.length, a = 0, o = 0, s, c = i <= 0, l = !1;
164
+ e.charCodeAt(i - 1) === T && --i, e.charCodeAt(i - 1) === E && --i;
165
+ function u() {
166
+ if (c) return C;
167
+ if (l) return l = !1, S;
168
+ var t, r = a, o;
169
+ if (e.charCodeAt(r) === w) {
170
+ for (; a++ < i && e.charCodeAt(a) !== w || e.charCodeAt(++a) === w;);
171
+ return (t = a) >= i ? c = !0 : (o = e.charCodeAt(a++)) === T ? l = !0 : o === E && (l = !0, e.charCodeAt(a) === T && ++a), e.slice(r + 1, t - 1).replace(/""/g, "\"");
172
+ }
173
+ for (; a < i;) {
174
+ if ((o = e.charCodeAt(t = a++)) === T) l = !0;
175
+ else if (o === E) l = !0, e.charCodeAt(a) === T && ++a;
176
+ else if (o !== n) continue;
177
+ return e.slice(r, t);
178
+ }
179
+ return c = !0, e.slice(r, i);
180
+ }
181
+ for (; (s = u()) !== C;) {
182
+ for (var d = []; s !== S && s !== C;) d.push(s), s = u();
183
+ t && (d = t(d, o++)) == null || r.push(d);
184
+ }
185
+ return r;
186
+ }
187
+ function a(t, n) {
188
+ return t.map(function(t) {
189
+ return n.map(function(e) {
190
+ return u(t[e]);
191
+ }).join(e);
192
+ });
193
+ }
194
+ function o(t, n) {
195
+ return n ??= O(t), [n.map(u).join(e)].concat(a(t, n)).join("\n");
196
+ }
197
+ function s(e, t) {
198
+ return t ??= O(e), a(e, t).join("\n");
199
+ }
200
+ function c(e) {
201
+ return e.map(l).join("\n");
202
+ }
203
+ function l(t) {
204
+ return t.map(u).join(e);
205
+ }
206
+ function u(e) {
207
+ return e == null ? "" : e instanceof Date ? ke(e) : t.test(e += "") ? "\"" + e.replace(/"/g, "\"\"") + "\"" : e;
208
+ }
209
+ return {
210
+ parse: r,
211
+ parseRows: i,
212
+ format: o,
213
+ formatBody: s,
214
+ formatRows: c,
215
+ formatRow: l,
216
+ formatValue: u
217
+ };
218
+ }
219
+ //#endregion
220
+ //#region ../../node_modules/topojson-client/src/identity.js
221
+ function Ae(e) {
222
+ return e;
223
+ }
224
+ //#endregion
225
+ //#region ../../node_modules/topojson-client/src/transform.js
226
+ function je(e) {
227
+ if (e == null) return Ae;
228
+ var t, n, r = e.scale[0], i = e.scale[1], a = e.translate[0], o = e.translate[1];
229
+ return function(e, s) {
230
+ s || (t = n = 0);
231
+ var c = 2, l = e.length, u = Array(l);
232
+ for (u[0] = (t += e[0]) * r + a, u[1] = (n += e[1]) * i + o; c < l;) u[c] = e[c], ++c;
233
+ return u;
234
+ };
235
+ }
236
+ //#endregion
237
+ //#region ../../node_modules/topojson-client/src/reverse.js
238
+ function Me(e, t) {
239
+ for (var n, r = e.length, i = r - t; i < --r;) n = e[i], e[i++] = e[r], e[r] = n;
240
+ }
241
+ //#endregion
242
+ //#region ../../node_modules/topojson-client/src/feature.js
243
+ function Ne(e, t) {
244
+ return typeof t == "string" && (t = e.objects[t]), t.type === "GeometryCollection" ? {
245
+ type: "FeatureCollection",
246
+ features: t.geometries.map(function(t) {
247
+ return j(e, t);
248
+ })
249
+ } : j(e, t);
250
+ }
251
+ function j(e, t) {
252
+ var n = t.id, r = t.bbox, i = t.properties == null ? {} : t.properties, a = M(e, t);
253
+ return n == null && r == null ? {
254
+ type: "Feature",
255
+ properties: i,
256
+ geometry: a
257
+ } : r == null ? {
258
+ type: "Feature",
259
+ id: n,
260
+ properties: i,
261
+ geometry: a
262
+ } : {
263
+ type: "Feature",
264
+ id: n,
265
+ bbox: r,
266
+ properties: i,
267
+ geometry: a
268
+ };
269
+ }
270
+ function M(e, t) {
271
+ var n = je(e.transform), r = e.arcs;
272
+ function i(e, t) {
273
+ t.length && t.pop();
274
+ for (var i = r[e < 0 ? ~e : e], a = 0, o = i.length; a < o; ++a) t.push(n(i[a], a));
275
+ e < 0 && Me(t, o);
276
+ }
277
+ function a(e) {
278
+ return n(e);
279
+ }
280
+ function o(e) {
281
+ for (var t = [], n = 0, r = e.length; n < r; ++n) i(e[n], t);
282
+ return t.length < 2 && t.push(t[0]), t;
283
+ }
284
+ function s(e) {
285
+ for (var t = o(e); t.length < 4;) t.push(t[0]);
286
+ return t;
287
+ }
288
+ function c(e) {
289
+ return e.map(s);
290
+ }
291
+ function l(e) {
292
+ var t = e.type, n;
293
+ switch (t) {
294
+ case "GeometryCollection": return {
295
+ type: t,
296
+ geometries: e.geometries.map(l)
297
+ };
298
+ case "Point":
299
+ n = a(e.coordinates);
300
+ break;
301
+ case "MultiPoint":
302
+ n = e.coordinates.map(a);
303
+ break;
304
+ case "LineString":
305
+ n = o(e.arcs);
306
+ break;
307
+ case "MultiLineString":
308
+ n = e.arcs.map(o);
309
+ break;
310
+ case "Polygon":
311
+ n = c(e.arcs);
312
+ break;
313
+ case "MultiPolygon":
314
+ n = e.arcs.map(c);
315
+ break;
316
+ default: return null;
317
+ }
318
+ return {
319
+ type: t,
320
+ coordinates: n
321
+ };
322
+ }
323
+ return l(t);
324
+ }
325
+ //#endregion
326
+ //#region ../../node_modules/topojson-client/src/stitch.js
327
+ function Pe(e, t) {
328
+ var n = {}, r = {}, i = {}, a = [], o = -1;
329
+ t.forEach(function(n, r) {
330
+ var i = e.arcs[n < 0 ? ~n : n], a;
331
+ i.length < 3 && !i[1][0] && !i[1][1] && (a = t[++o], t[o] = n, t[r] = a);
332
+ }), t.forEach(function(e) {
333
+ var t = s(e), n = t[0], a = t[1], o, c;
334
+ if (o = i[n]) {
335
+ if (delete i[o.end], o.push(e), o.end = a, c = r[a]) {
336
+ delete r[c.start];
337
+ var l = c === o ? o : o.concat(c);
338
+ r[l.start = o.start] = i[l.end = c.end] = l;
339
+ } else r[o.start] = i[o.end] = o;
340
+ } else if (o = r[a]) {
341
+ if (delete r[o.start], o.unshift(e), o.start = n, c = i[n]) {
342
+ delete i[c.end];
343
+ var u = c === o ? o : c.concat(o);
344
+ r[u.start = c.start] = i[u.end = o.end] = u;
345
+ } else r[o.start] = i[o.end] = o;
346
+ } else o = [e], r[o.start = n] = i[o.end = a] = o;
347
+ });
348
+ function s(t) {
349
+ var n = e.arcs[t < 0 ? ~t : t], r = n[0], i;
350
+ return e.transform ? (i = [0, 0], n.forEach(function(e) {
351
+ i[0] += e[0], i[1] += e[1];
352
+ })) : i = n[n.length - 1], t < 0 ? [i, r] : [r, i];
353
+ }
354
+ function c(e, t) {
355
+ for (var r in e) {
356
+ var i = e[r];
357
+ delete t[i.start], delete i.start, delete i.end, i.forEach(function(e) {
358
+ n[e < 0 ? ~e : e] = 1;
359
+ }), a.push(i);
360
+ }
361
+ }
362
+ return c(i, r), c(r, i), t.forEach(function(e) {
363
+ n[e < 0 ? ~e : e] || a.push([e]);
364
+ }), a;
365
+ }
366
+ //#endregion
367
+ //#region ../../node_modules/topojson-client/src/mesh.js
368
+ function Fe(e) {
369
+ return M(e, Ie.apply(this, arguments));
370
+ }
371
+ function Ie(e, t, n) {
372
+ var r, i, a;
373
+ if (arguments.length > 1) r = Le(e, t, n);
374
+ else for (i = 0, r = Array(a = e.arcs.length); i < a; ++i) r[i] = i;
375
+ return {
376
+ type: "MultiLineString",
377
+ arcs: Pe(e, r)
378
+ };
379
+ }
380
+ function Le(e, t, n) {
381
+ var r = [], i = [], a;
382
+ function o(e) {
383
+ var t = e < 0 ? ~e : e;
384
+ (i[t] || (i[t] = [])).push({
385
+ i: e,
386
+ g: a
387
+ });
388
+ }
389
+ function s(e) {
390
+ e.forEach(o);
391
+ }
392
+ function c(e) {
393
+ e.forEach(s);
394
+ }
395
+ function l(e) {
396
+ e.forEach(c);
397
+ }
398
+ function u(e) {
399
+ switch (a = e, e.type) {
400
+ case "GeometryCollection":
401
+ e.geometries.forEach(u);
402
+ break;
403
+ case "LineString":
404
+ s(e.arcs);
405
+ break;
406
+ case "MultiLineString":
407
+ case "Polygon":
408
+ c(e.arcs);
409
+ break;
410
+ case "MultiPolygon": l(e.arcs);
411
+ }
412
+ }
413
+ return u(t), i.forEach(n == null ? function(e) {
414
+ r.push(e[0].i);
415
+ } : function(e) {
416
+ n(e[0].g, e[e.length - 1].g) && r.push(e[0].i);
417
+ }), r;
418
+ }
419
+ //#endregion
420
+ //#region ../../node_modules/vega-format/node_modules/vega-util/build/accessor.js
421
+ function N(e, t, n) {
422
+ return Object.assign(e, {
423
+ fields: t || [],
424
+ fname: n
425
+ });
426
+ }
427
+ //#endregion
428
+ //#region ../../node_modules/vega-format/node_modules/vega-util/build/getter.js
429
+ function Re(e) {
430
+ return e.length === 1 ? ze(e[0]) : Be(e);
431
+ }
432
+ var ze = (e) => function(t) {
433
+ return t[e];
434
+ }, Be = (e) => {
435
+ let t = e.length;
436
+ return function(n) {
437
+ for (let r = 0; r < t; ++r) n = n[e[r]];
438
+ return n;
439
+ };
440
+ };
441
+ //#endregion
442
+ //#region ../../node_modules/vega-format/node_modules/vega-util/build/error.js
443
+ function P(e) {
444
+ throw Error(e);
445
+ }
446
+ //#endregion
447
+ //#region ../../node_modules/vega-format/node_modules/vega-util/build/splitAccessPath.js
448
+ function Ve(e) {
449
+ let t = [], n = e.length, r = null, i = 0, a = "", o, s, c;
450
+ e += "";
451
+ function l() {
452
+ t.push(a + e.substring(o, s)), a = "", o = s + 1;
453
+ }
454
+ for (o = s = 0; s < n; ++s) if (c = e[s], c === "\\") a += e.substring(o, s++), o = s;
455
+ else if (c === r) l(), r = null, i = -1;
456
+ else if (r) continue;
457
+ else o === i && c === "\"" || o === i && c === "'" ? (o = s + 1, r = c) : c === "." && !i ? s > o ? l() : o = s + 1 : c === "[" ? (s > o && l(), i = o = s + 1) : c === "]" && (i || P("Access path missing open bracket: " + e), i > 0 && l(), i = 0, o = s + 1);
458
+ return i && P("Access path missing closing bracket: " + e), r && P("Access path missing closing quote: " + e), s > o && (s++, l()), t;
459
+ }
460
+ //#endregion
461
+ //#region ../../node_modules/vega-format/node_modules/vega-util/build/field.js
462
+ function He(e, t, n) {
463
+ let r = Ve(e), i = r.length === 1 ? r[0] : e;
464
+ return N((n && n.get || Re)(r), [i], t || i);
465
+ }
466
+ He("id"), N((e) => e, [], "identity"), N(() => 0, [], "zero"), N(() => 1, [], "one"), N(() => !0, [], "true"), N(() => !1, [], "false"), [...Object.getOwnPropertyNames(Object.prototype).filter((e) => typeof Object.prototype[e] == "function")], Array.isArray;
467
+ //#endregion
468
+ //#region ../../node_modules/vega-format/node_modules/vega-util/build/isObject.js
469
+ function Ue(e) {
470
+ return e === Object(e);
471
+ }
472
+ //#endregion
473
+ //#region ../../node_modules/vega-format/node_modules/vega-util/build/isString.js
474
+ function We(e) {
475
+ return typeof e == "string";
476
+ }
477
+ //#endregion
478
+ //#region ../../node_modules/vega-format/build/vega-format.js
479
+ function F(e) {
480
+ let t = {};
481
+ return (n) => t[n] || (t[n] = e(n));
482
+ }
483
+ function Ge(e, t) {
484
+ return (n) => {
485
+ let r = e(n), i = r.indexOf(t);
486
+ if (i < 0) return r;
487
+ let a = Ke(r, i), o = a < r.length ? r.slice(a) : "";
488
+ for (; --a > i;) if (r[a] !== "0") {
489
+ ++a;
490
+ break;
491
+ }
492
+ return r.slice(0, a) + o;
493
+ };
494
+ }
495
+ function Ke(e, t) {
496
+ let n = e.lastIndexOf("e"), r;
497
+ if (n > 0) return n;
498
+ for (n = e.length; --n > t;) if (r = e.charCodeAt(n), r >= 48 && r <= 57) return n + 1;
499
+ }
500
+ function qe(e) {
501
+ let r = F(e.format), i = e.formatPrefix;
502
+ return {
503
+ format: r,
504
+ formatPrefix: i,
505
+ formatFloat(e) {
506
+ let t = n(e || ",");
507
+ if (t.precision == null) {
508
+ switch (t.precision = 12, t.type) {
509
+ case "%":
510
+ t.precision -= 2;
511
+ break;
512
+ case "e": --t.precision;
513
+ }
514
+ return Ge(r(t), r(".1f")(1)[1]);
515
+ }
516
+ return r(t);
517
+ },
518
+ formatSpan(e, o, s, c) {
519
+ c = n(c ?? ",f");
520
+ let l = re(e, o, s), u = Math.max(Math.abs(e), Math.abs(o)), d;
521
+ if (c.precision == null) switch (c.type) {
522
+ case "s": return isNaN(d = t(l, u)) || (c.precision = d), i(c, u);
523
+ case "":
524
+ case "e":
525
+ case "g":
526
+ case "p":
527
+ case "r":
528
+ isNaN(d = ne(l, u)) || (c.precision = d - (c.type === "e"));
529
+ break;
530
+ case "f":
531
+ case "%": isNaN(d = a(l)) || (c.precision = d - (c.type === "%") * 2);
532
+ }
533
+ return r(c);
534
+ }
535
+ };
536
+ }
537
+ Je();
538
+ function Je() {
539
+ return qe({
540
+ format: i,
541
+ formatPrefix: o
542
+ });
543
+ }
544
+ function Ye(e, t, n) {
545
+ n ||= {}, Ue(n) || P(`Invalid time multi-format specifier: ${n}`);
546
+ let i = t(c), a = t(s), o = t(d), l = t(ee), u = t(oe), f = t(ae), te = t(se), ne = t(r), re = e(n.milliseconds || ".%L"), ie = e(n.seconds || ":%S"), p = e(n.minutes || "%I:%M"), m = e(n.hours || "%I %p"), h = e(n.date || n.day || "%a %d"), g = e(n.week || "%b %d"), ce = e(n.month || "%B"), _ = e(n.quarter || "%B"), le = e(n.year || "%Y");
547
+ return (e) => (i(e) < e ? re : a(e) < e ? ie : o(e) < e ? p : l(e) < e ? m : f(e) < e ? u(e) < e ? h : g : ne(e) < e ? te(e) < e ? ce : _ : le)(e);
548
+ }
549
+ function Xe(t) {
550
+ let n = F(t.format), r = F(t.utcFormat);
551
+ return {
552
+ timeFormat: (t) => We(t) ? n(t) : Ye(n, e, t),
553
+ utcFormat: (e) => We(e) ? r(e) : Ye(r, p, e),
554
+ timeParse: F(t.parse),
555
+ utcParse: F(t.utcParse)
556
+ };
557
+ }
558
+ var I;
559
+ Ze();
560
+ function Ze() {
561
+ return I = Xe({
562
+ format: f,
563
+ parse: ie,
564
+ utcFormat: l,
565
+ utcParse: u
566
+ });
567
+ }
568
+ function Qe(e) {
569
+ return Xe(te(e));
570
+ }
571
+ function $e(e) {
572
+ return arguments.length ? I = Qe(e) : I;
573
+ }
574
+ //#endregion
575
+ //#region ../../node_modules/vega-loader/build/vega-loader.browser.js
576
+ var et = /^(data:|([A-Za-z]+:)?\/\/)/, tt = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i, nt = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g, rt = "file://";
577
+ function it(e) {
578
+ return (t) => ({
579
+ options: t || {},
580
+ sanitize: ot,
581
+ load: at,
582
+ fileAccess: !1,
583
+ file: st(e),
584
+ http: lt
585
+ });
586
+ }
587
+ async function at(e, t) {
588
+ let n = await this.sanitize(e, t), r = n.href;
589
+ return n.localFile ? this.file(r) : this.http(r, t?.http);
590
+ }
591
+ async function ot(e, t) {
592
+ t = b({}, this.options, t);
593
+ let n = this.fileAccess, r = { href: null }, i, a, o, s = tt.test(e.replace(nt, ""));
594
+ (e == null || typeof e != "string" || !s) && v("Sanitize failure, invalid URI: " + x(e));
595
+ let c = et.test(e);
596
+ return (o = t.baseURL) && !c && (!e.startsWith("/") && !o.endsWith("/") && (e = "/" + e), e = o + e), a = (i = e.startsWith(rt)) || t.mode === "file" || t.mode !== "http" && !c && n, i ? e = e.slice(7) : e.startsWith("//") && (t.defaultProtocol === "file" ? (e = e.slice(2), a = !0) : e = (t.defaultProtocol || "http") + ":" + e), Object.defineProperty(r, "localFile", { value: !!a }), r.href = e, t.target && (r.target = t.target + ""), t.rel && (r.rel = t.rel + ""), t.context === "image" && t.crossOrigin && (r.crossOrigin = t.crossOrigin + ""), r;
597
+ }
598
+ function st(e) {
599
+ return e ? (t) => new Promise((n, r) => {
600
+ e.readFile(t, (e, t) => {
601
+ e ? r(e) : n(t);
602
+ });
603
+ }) : ct;
604
+ }
605
+ async function ct() {
606
+ v("No file system access.");
607
+ }
608
+ async function lt(e, t) {
609
+ let n = b({}, this.options.http, t), r = t && t.response, i = await fetch(e, n);
610
+ return i.ok ? y(i[r]) ? i[r]() : i.text() : v(i.status + "" + i.statusText);
611
+ }
612
+ var ut = (e) => e != null && e === e, dt = (e) => e === "true" || e === "false" || e === !0 || e === !1, ft = (e) => !Number.isNaN(Date.parse(e)), pt = (e) => !Number.isNaN(+e) && !(e instanceof Date), mt = (e) => pt(e) && Number.isInteger(+e), ht = {
613
+ boolean: Ce,
614
+ integer: _e,
615
+ number: _e,
616
+ date: Te,
617
+ string: Ee,
618
+ unknown: me
619
+ }, L = [
620
+ dt,
621
+ mt,
622
+ pt,
623
+ ft
624
+ ], gt = [
625
+ "boolean",
626
+ "integer",
627
+ "number",
628
+ "date"
629
+ ];
630
+ function _t(e, t) {
631
+ if (!e || !e.length) return "unknown";
632
+ let n = e.length, r = L.length, i = L.map((e, t) => t + 1);
633
+ for (let a = 0, o = 0, s, c; a < n; ++a) for (c = t ? e[a][t] : e[a], s = 0; s < r; ++s) if (i[s] && ut(c) && !L[s](c) && (i[s] = 0, ++o, o === L.length)) return "string";
634
+ return gt[i.reduce((e, t) => e === 0 ? t : e, 0) - 1];
635
+ }
636
+ function vt(e, t) {
637
+ return t.reduce((t, n) => (t[n] = _t(e, n), t), {});
638
+ }
639
+ function yt(e) {
640
+ let t = function(t, n) {
641
+ let r = { delimiter: e };
642
+ return R(t, n ? b(n, r) : r);
643
+ };
644
+ return t.responseType = "text", t;
645
+ }
646
+ function R(e, t) {
647
+ return t.header && (e = t.header.map(x).join(t.delimiter) + "\n" + e), A(t.delimiter).parse(e + "");
648
+ }
649
+ R.responseType = "text";
650
+ function bt(e) {
651
+ return typeof Buffer == "function" && y(Buffer.isBuffer) ? Buffer.isBuffer(e) : !1;
652
+ }
653
+ function z(e, t) {
654
+ let n = t && t.property ? pe(t.property) : me;
655
+ return ge(e) && !bt(e) ? xt(n(e), t) : n(JSON.parse(e));
656
+ }
657
+ z.responseType = "json";
658
+ function xt(e, t) {
659
+ return !he(e) && be(e) && (e = [...e]), t && t.copy ? JSON.parse(JSON.stringify(e)) : e;
660
+ }
661
+ var St = {
662
+ interior: (e, t) => e !== t,
663
+ exterior: (e, t) => e === t
664
+ };
665
+ function Ct(e, t) {
666
+ let n, r, i, a;
667
+ return e = z(e, t), t && t.feature ? (n = Ne, i = t.feature) : t && t.mesh ? (n = Fe, i = t.mesh, a = St[t.filter]) : v("Missing TopoJSON feature or mesh parameter."), r = (r = e.objects[i]) ? n(e, r, a) : v("Invalid TopoJSON object: " + i), r && r.features || [r];
668
+ }
669
+ Ct.responseType = "json";
670
+ var B = {
671
+ dsv: R,
672
+ csv: yt(","),
673
+ tsv: yt(" "),
674
+ json: z,
675
+ topojson: Ct
676
+ };
677
+ function V(e, t) {
678
+ return arguments.length > 1 ? (B[e] = t, this) : ve(B, e) ? B[e] : null;
679
+ }
680
+ function H(e, t, n, r) {
681
+ t ||= {};
682
+ let i = V(t.type || "json");
683
+ return i || v("Unknown data format type: " + t.type), e = i(e, t), t.parse && wt(e, t.parse, n, r), ve(e, "columns") && delete e.columns, e;
684
+ }
685
+ function wt(e, t, n, r) {
686
+ if (!e.length) return;
687
+ let i = $e();
688
+ n ||= i.timeParse, r ||= i.utcParse;
689
+ let a = e.columns || Object.keys(e[0]), o, s, c, l, u, d;
690
+ t === "auto" && (t = vt(e, a)), a = Object.keys(t);
691
+ let f = a.map((e) => {
692
+ let i = t[e], a, o;
693
+ if (i && (i.startsWith("date:") || i.startsWith("utc:"))) return a = i.split(/:(.+)?/, 2), o = a[1], (o[0] === "'" && o[o.length - 1] === "'" || o[0] === "\"" && o[o.length - 1] === "\"") && (o = o.slice(1, -1)), (a[0] === "utc" ? r : n)(o);
694
+ if (!ht[i]) throw Error("Illegal format pattern: " + e + ":" + i);
695
+ return ht[i];
696
+ });
697
+ for (c = 0, u = e.length, d = a.length; c < u; ++c) for (o = e[c], l = 0; l < d; ++l) s = a[l], o[s] = f[l](o[s]);
698
+ }
699
+ var Tt = it(null);
700
+ //#endregion
701
+ //#region ../core/src/data/sources/inlineSource.js
702
+ function Et(e) {
703
+ return "values" in e;
704
+ }
705
+ var Dt = class extends h {
706
+ constructor(e, t) {
707
+ if (super(t), this.params = e, typeof e.values == "string" && !e?.format?.type) throw Error("Data format type (csv, dsv, ...) must be specified if a string is provided!");
708
+ }
709
+ get label() {
710
+ return "inlineSource";
711
+ }
712
+ isTrivial() {
713
+ let e = this.params.values, t = Array.isArray(e) ? e[0] : e;
714
+ return !!(t && Object.keys(t).length == 0 && t.constructor === Object);
715
+ }
716
+ updateDynamicData(e) {
717
+ this.#e(e);
718
+ }
719
+ loadSynchronously() {
720
+ this.#e(this.params.values);
721
+ }
722
+ #e(e) {
723
+ let t = [], n = (e) => e;
724
+ if (Array.isArray(e)) e.length > 0 && (t = e, n = G(e[0]));
725
+ else if (typeof e == "object") t = [e];
726
+ else if (typeof e == "string") t = H(e, W(U(this.params)));
727
+ else throw Error("\"values\" in data configuration is not an array, object, or a string!");
728
+ this.reset(), this.beginBatch({ type: "file" });
729
+ for (let e of t) this._propagate(n(e));
730
+ this.complete();
731
+ }
732
+ async load() {
733
+ this.loadSynchronously();
734
+ }
735
+ }, Ot = /* @__PURE__ */ new Set([
736
+ "csv",
737
+ "tsv",
738
+ "dsv"
739
+ ]), kt = /* @__PURE__ */ new Set([
740
+ "gz",
741
+ "bgz",
742
+ "bgzf"
743
+ ]);
744
+ function U(e, t = []) {
745
+ if (!Et(e) && !Rt(e)) return;
746
+ let n = { ...e.format };
747
+ if (n.type ??= Rt(e) && jt(t), n.parse === void 0 && zt(n.type) && (n.parse = "auto"), !n.type) throw Error("Format for the data source was not defined and it could not be inferred: " + JSON.stringify(e));
748
+ return n;
749
+ }
750
+ function W(e) {
751
+ let t = { ...e };
752
+ return (It(t) || Lt(t)) && t.columns && !("header" in t) && (t.header = t.columns), t;
753
+ }
754
+ function At(e) {
755
+ return V(e)?.responseType ?? "text";
756
+ }
757
+ function jt(e) {
758
+ if (Array.isArray(e) && (e = e[0]), e) {
759
+ let t = Nt(e).split("/").pop()?.toLowerCase();
760
+ if (!t) return;
761
+ let n = t.split(".");
762
+ for (; n.length > 1 && kt.has(n.at(-1));) n.pop();
763
+ let r = n.at(-1);
764
+ if (r && V(r)) return r;
765
+ }
766
+ }
767
+ function Mt(e) {
768
+ let t = Nt(e).split("/").pop()?.toLowerCase();
769
+ if (!t) return !1;
770
+ let n = t.split(".").at(-1);
771
+ return !!n && kt.has(n);
772
+ }
773
+ function Nt(e) {
774
+ return e.replace(/[?#].*$/, "");
775
+ }
776
+ var G = (e) => typeof e == "object" ? Ft : Pt, Pt = (e) => ({ data: e }), Ft = (e) => e;
777
+ function It(e) {
778
+ return e.type == "csv" || e.type == "tsv";
779
+ }
780
+ function Lt(e) {
781
+ return e.type == "dsv";
782
+ }
783
+ function Rt(e) {
784
+ return "url" in e;
785
+ }
786
+ function zt(e) {
787
+ return Ot.has(e);
788
+ }
789
+ //#endregion
790
+ //#region ../core/src/utils/topK.js
791
+ function Bt(e, t, n = (e) => +e, r = 0, i = e.length) {
792
+ let a = i - r;
793
+ if (t <= 0 || a <= 0) return [];
794
+ let o = new ce(), s = 0;
795
+ for (; s < t && s < a; s++) o.push(s, n(e[r + s]));
796
+ for (; s < a; s++) {
797
+ let t = n(e[r + s]);
798
+ t > o.peekValue() && (o.push(s, t), o.pop());
799
+ }
800
+ let c = o.peekValue(), l = [], u = 0, d = 0;
801
+ for (s = 0; s < a; s++) n(e[r + s]) > c && u++;
802
+ let f = t - u;
803
+ for (s = 0; s < a; s++) {
804
+ let t = n(e[r + s]);
805
+ (t > c || t === c && d++ < f) && l.push(s);
806
+ }
807
+ return l.sort((t, i) => {
808
+ let a = n(e[r + t]), o = n(e[r + i]);
809
+ return a > o ? -1 : a < o ? 1 : t - i;
810
+ }), l.map((t) => e[r + t]);
811
+ }
812
+ //#endregion
813
+ //#region src/utils/escapeSeparator.js
814
+ function Vt(e) {
815
+ return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
816
+ }
817
+ function Ht(e, t = "/") {
818
+ let n = Vt(t);
819
+ return e.replace(new RegExp(n, "g"), "\\" + t);
820
+ }
821
+ function K(e, t = "/") {
822
+ return e.map((e) => Ht(e, t)).join(t);
823
+ }
824
+ function q(e, t = "/") {
825
+ if (!t) return [e];
826
+ let n = t, r = [], i = "";
827
+ for (let t = 0; t < e.length; t++) {
828
+ let a = e[t];
829
+ if (a === "\\") {
830
+ if (e.substring(t + 1, t + 1 + n.length) === n) {
831
+ i += n, t += n.length;
832
+ continue;
833
+ }
834
+ i += "\\";
835
+ } else e.substring(t, t + n.length) === n ? (r.push(i), i = "", t += n.length - 1) : i += a;
836
+ }
837
+ return r.push(i), r;
838
+ }
839
+ //#endregion
840
+ //#region src/utils/dataLayout.js
841
+ function Ut(e, t = /* @__PURE__ */ new Set()) {
842
+ if (e.length === 0) return {};
843
+ let n = e[0], r = Object.keys(n).filter((e) => !t.has(e)), i = {};
844
+ for (let t of r) i[t] = e.map((e) => e[t]);
845
+ return i;
846
+ }
847
+ function Wt(e) {
848
+ let t = Object.keys(e);
849
+ if (t.length === 0) return [];
850
+ let n = e[t[0]]?.length ?? 0;
851
+ for (let r of t) {
852
+ if (!Array.isArray(e[r])) throw Error(`Column "${r}" is not an array`);
853
+ if (e[r].length !== n) throw Error(`All columns must have identical lengths; "${r}" has length ${e[r].length}, expected ${n}`);
854
+ }
855
+ let r = [];
856
+ for (let i = 0; i < n; i++) {
857
+ let n = {};
858
+ for (let r of t) n[r] = e[r][i];
859
+ r.push(n);
860
+ }
861
+ return r;
862
+ }
863
+ var Gt = "(Root)";
864
+ function Kt(e) {
865
+ return q(e, "/").at(-1) ?? "";
866
+ }
867
+ function qt(e, t) {
868
+ let n = typeof t == "string" && t.length > 0 ? (e) => q(e, t) : (e) => [e], r = {
869
+ part: Gt,
870
+ attribute: "",
871
+ path: "",
872
+ children: /* @__PURE__ */ new Map(),
873
+ parent: null
874
+ };
875
+ for (let t of e) {
876
+ let e = n(t), i = r;
877
+ for (let n = 0; n < e.length; n++) {
878
+ let r = e[n];
879
+ if (!i.children.has(r)) {
880
+ let a = {
881
+ part: r,
882
+ path: K(e.slice(0, n + 1), "/"),
883
+ attribute: t,
884
+ children: /* @__PURE__ */ new Map(),
885
+ parent: i
886
+ };
887
+ i.children.set(r, a);
888
+ }
889
+ i = i.children.get(r);
890
+ }
891
+ }
892
+ return r;
893
+ }
894
+ function* J(e) {
895
+ if (e) {
896
+ yield e;
897
+ for (let t of e.children.values()) yield* J(t);
898
+ }
899
+ }
900
+ function* Jt(e) {
901
+ for (let t = e.parent; t != null; t = t.parent) yield t;
902
+ }
903
+ function Yt(e) {
904
+ for (let t of [
905
+ ".",
906
+ "_",
907
+ "/"
908
+ ]) {
909
+ let n = [];
910
+ for (let r of e || []) r && r.indexOf(t) >= 0 && n.push(r);
911
+ if (n.length < 2) continue;
912
+ let r = /* @__PURE__ */ new Map();
913
+ for (let e of n) {
914
+ let n = e.split(t);
915
+ if (n.length >= 2) {
916
+ let e = n[0];
917
+ e && r.set(e, (r.get(e) || 0) + 1);
918
+ }
919
+ }
920
+ for (let e of r.values()) if (e >= 2) return t;
921
+ }
922
+ return null;
923
+ }
924
+ function Xt(e) {
925
+ return e.length ? K(e, "/") + "/" : "";
926
+ }
927
+ function Y(e, t = [], n = []) {
928
+ if (!t.length) return e;
929
+ let r = Xt(t), i = {};
930
+ for (let [t, a] of Object.entries(e)) n.includes(t) ? i[t] = a : i[r + t] = a;
931
+ return i;
932
+ }
933
+ function X(e, t, n = "/") {
934
+ return K(q(e, t), n);
935
+ }
936
+ function Z(e, t = {}, n, r, i = /* @__PURE__ */ new Set()) {
937
+ let a = $t(e, i);
938
+ if (n != null && typeof n != "string") throw Error("attributeGroupSeparator must be a string");
939
+ return a = en(a, n), r ? (a = tn(a, r, n), t = nn(t, r, n)) : t[""] && (t = Zt(t, { attributeNames: Object.keys(a).filter((e) => e !== "sample") })), {
940
+ columnarMetadata: a,
941
+ attributeDefs: t
942
+ };
943
+ }
944
+ function Zt(e, t) {
945
+ let n = e[""];
946
+ if (!n) return e;
947
+ let r = {};
948
+ for (let [t, n] of Object.entries(e)) t !== "" && (r[t] = n);
949
+ for (let e of t.attributeNames) {
950
+ if (r[e]) continue;
951
+ let t = q(e, "/"), i = !1;
952
+ for (let e = 1; e < t.length; e++) if (r[K(t.slice(0, e), "/")]) {
953
+ i = !0;
954
+ break;
955
+ }
956
+ i || (r[e] = { ...n });
957
+ }
958
+ return r;
959
+ }
960
+ function Qt(e, t, n) {
961
+ let r = e.filter((e) => t.has(String(e.sample))), i = n.metadataNodeTypes.get("") ?? null, a = n.scales.get("") ?? null, o = (e) => [
962
+ "nominal",
963
+ "ordinal",
964
+ "quantitative"
965
+ ].includes(e), s = o(i), c = Array.from(n.metadataNodeTypes.entries().filter(([e, t]) => e !== "" && o(t)).map(([e]) => e)), l = new Set(n.metadataNodeTypes.entries().filter(([, e]) => e === "unset").map(([e]) => e)), u = Object.fromEntries(c.map((e) => {
966
+ let t = { type: n.metadataNodeTypes.get(e) }, r = n.scales.get(e);
967
+ return r && (t.scale = r), [e, t];
968
+ }));
969
+ if (!n.addUnderGroup && s) {
970
+ let e = { type: i };
971
+ a && (e.scale = a), u = Zt({
972
+ ...u,
973
+ "": e
974
+ }, { attributeNames: Array.from(n.metadataNodeTypes.entries().filter(([, e]) => e === "inherit").map(([e]) => e)) });
975
+ }
976
+ let d = Z(r, u, n.separator, n.addUnderGroup, l);
977
+ if (n.addUnderGroup && s) {
978
+ let e = K(Q(n.addUnderGroup, n.separator ?? void 0), "/");
979
+ if (e && !d.attributeDefs[e]) {
980
+ let t = { type: i };
981
+ a && (t.scale = a), d.attributeDefs[e] = t;
982
+ }
983
+ }
984
+ return d;
985
+ }
986
+ function $t(e, t = /* @__PURE__ */ new Set()) {
987
+ return Ut(e, t);
988
+ }
989
+ function en(e, t) {
990
+ let n = { sample: e.sample };
991
+ for (let [r, i] of Object.entries(e)) {
992
+ if (r === "sample") continue;
993
+ let e = typeof t == "string" && t.length > 0 ? X(r, t, "/") : K([r], "/");
994
+ n[e] = i;
995
+ }
996
+ return n;
997
+ }
998
+ function Q(e, t) {
999
+ return typeof t == "string" && t.length > 0 ? q(e, t) : [e];
1000
+ }
1001
+ function tn(e, t, n) {
1002
+ return rn(e, Q(t, n));
1003
+ }
1004
+ function nn(e, t, n) {
1005
+ let r = Q(t, n), i = K(r, "/"), a = {}, o;
1006
+ for (let [t, n] of Object.entries(e)) t === "" ? o = n : a[t] = n;
1007
+ let s = Y(a, r);
1008
+ return o && !s[i] && (s[i] = o), s;
1009
+ }
1010
+ function rn(e, t = []) {
1011
+ return Y(e, t, ["sample"]);
1012
+ }
1013
+ function an(e) {
1014
+ switch (_t(e)) {
1015
+ case "integer":
1016
+ case "number": return "quantitative";
1017
+ default: return "nominal";
1018
+ }
1019
+ }
1020
+ function on(e, t) {
1021
+ let n = /* @__PURE__ */ new Map();
1022
+ function r(t) {
1023
+ for (let e of Jt(t)) {
1024
+ let t = n.get(e.path);
1025
+ if (t && t !== "unset") return "inherit";
1026
+ }
1027
+ if (t.children.size > 0) {
1028
+ let n = /* @__PURE__ */ new Set();
1029
+ for (let r of J(t)) if (r !== t && r.children.size === 0) {
1030
+ let t = e.get(r.attribute);
1031
+ t && n.add(t);
1032
+ }
1033
+ return n.size === 1 ? n.values().next().value : "unset";
1034
+ }
1035
+ return e.get(t.attribute) ?? "unset";
1036
+ }
1037
+ for (let e of J(t)) n.set(e.path, r(e));
1038
+ return n;
1039
+ }
1040
+ function sn(e, t = {}, n) {
1041
+ let r = structuredClone(t ?? {}), i = qt(e.attributeNames, n), a = /* @__PURE__ */ new Map();
1042
+ function o(e) {
1043
+ e.path && a.set(e.path, e);
1044
+ for (let t of e.children.values()) o(t);
1045
+ }
1046
+ o(i);
1047
+ for (let t of e.attributeNames) {
1048
+ let i = r[t], o = null;
1049
+ if (n != null) {
1050
+ let e = X(t, n, "/"), i = a.get(e)?.parent;
1051
+ for (; i && (o = r[i.path]?.type, o == null);) i = i.parent;
1052
+ }
1053
+ if (!o && (i || (i = {}, r[t] = i), !i.type)) {
1054
+ let n = Object.values(e.entities).map((e) => e[t]);
1055
+ i.type = an(n);
1056
+ }
1057
+ }
1058
+ return r;
1059
+ }
1060
+ function cn(e, t) {
1061
+ let n = new Set(e.attributeNames), r = new Set(t.attributeNames), i = n.intersection(r);
1062
+ if (i.size > 0) throw Error(`Duplicate attribute names: ${Array.from(i).join(", ")}`);
1063
+ let a = [...n, ...r], o = e.attributeDefs ?? {}, s = t.attributeDefs ?? {}, c = { ...o };
1064
+ for (let e of Object.keys(s)) c[e] = e in c ? un(c[e], s[e], e) : s[e];
1065
+ let l = Object.keys(e.entities), u = Object.keys(t.entities), d = /* @__PURE__ */ new Set([...l, ...u]), f = {};
1066
+ for (let r of d) {
1067
+ let i = e.entities[r] ?? {}, o = t.entities[r] ?? {}, s = {};
1068
+ for (let e of a) s[e] = n.has(e) ? i[e] : o[e];
1069
+ f[r] = s;
1070
+ }
1071
+ return {
1072
+ entities: f,
1073
+ attributeNames: a,
1074
+ attributeDefs: c
1075
+ };
1076
+ }
1077
+ function ln(e) {
1078
+ return typeof e == "object" && !!e && !Array.isArray(e);
1079
+ }
1080
+ function un(e, t, n, r = "") {
1081
+ if (m(e, t)) return e;
1082
+ let i = { ...e };
1083
+ for (let [e, a] of Object.entries(t)) {
1084
+ if (!(e in i)) {
1085
+ i[e] = a;
1086
+ continue;
1087
+ }
1088
+ let t = i[e];
1089
+ if (m(t, a)) continue;
1090
+ if (ln(t) && ln(a)) {
1091
+ i[e] = un(t, a, n, r ? r + "." + e : e);
1092
+ continue;
1093
+ }
1094
+ let o = r ? r + "." + e : e, s = dn(t), c = dn(a);
1095
+ throw Error("Conflicting attribute definition for key \"" + n + "\" at \"" + o + "\". Existing value: " + s + "; incoming value: " + c + ". Align the source-level/group defaults (type/scale/visibility) before importing into the same group.");
1096
+ }
1097
+ return i;
1098
+ }
1099
+ function dn(e) {
1100
+ try {
1101
+ return JSON.stringify(e) ?? String(e);
1102
+ } catch {
1103
+ return String(e);
1104
+ }
1105
+ }
1106
+ //#endregion
1107
+ //#region src/sampleView/metadata/metadataValidation.js
1108
+ function fn(e, t) {
1109
+ let n = /* @__PURE__ */ new Map();
1110
+ function r(e, t = 1, r = null) {
1111
+ let i = n.get(e);
1112
+ i || (i = {
1113
+ message: e,
1114
+ count: 0,
1115
+ cases: []
1116
+ }, n.set(e, i)), i.count += t, r && i.cases.push(r);
1117
+ }
1118
+ let i = new Set(e), a = /* @__PURE__ */ new Set();
1119
+ for (let e of t) {
1120
+ if (!("sample" in e)) {
1121
+ r(pn);
1122
+ continue;
1123
+ }
1124
+ if (e.sample == null || e.sample === "") {
1125
+ r(mn);
1126
+ continue;
1127
+ }
1128
+ let t = String(e.sample);
1129
+ a.has(t) && r(hn, 1, t), a.add(t);
1130
+ }
1131
+ return a.size === 0 && r(gn), n.size > 0 ? { error: Array.from(n.values()) } : { statistics: {
1132
+ unknownSamples: a.difference(i),
1133
+ notCoveredSamples: i.difference(a),
1134
+ samplesInBoth: a.intersection(i)
1135
+ } };
1136
+ }
1137
+ var pn = "Missing sample field in metadata record", mn = "Empty sample field in metadata record", hn = "Duplicate sample IDs found in metadata", gn = "No valid samples found in metadata";
1138
+ //#endregion
1139
+ //#region src/sampleView/metadata/metadataSourceAttributes.js
1140
+ function _n(e, t) {
1141
+ return t ? X(e, t, "/") : K([e], "/");
1142
+ }
1143
+ function vn(e, t) {
1144
+ let n = e.attributes;
1145
+ if (!n) return {};
1146
+ let r = e.attributeGroupSeparator, i = /* @__PURE__ */ new Set();
1147
+ for (let e of t) {
1148
+ let t = q(_n(e, r), "/");
1149
+ for (let e = 1; e <= t.length; e++) i.add(K(t.slice(0, e), "/"));
1150
+ }
1151
+ i.add("");
1152
+ let a = {}, o = /* @__PURE__ */ new Map();
1153
+ for (let [e, t] of Object.entries(n)) {
1154
+ let n = _n(e, r);
1155
+ if (!i.has(n)) continue;
1156
+ let s = o.get(n);
1157
+ if (s) throw Error("Metadata source attributes has conflicting keys \"" + s + "\" and \"" + e + "\" that both resolve to \"" + n + "\".");
1158
+ o.set(n, e), a[n] = { ...t };
1159
+ }
1160
+ return a;
1161
+ }
1162
+ //#endregion
1163
+ //#region src/sampleView/metadata/exampleValues.js
1164
+ function $(e, t) {
1165
+ return Bt(e.map((e) => String(e ?? "").trim()).filter(Boolean), t, yn);
1166
+ }
1167
+ function yn(e) {
1168
+ let t = 2166136261;
1169
+ for (let n = 0; n < e.length; n += 1) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
1170
+ return t >>> 0;
1171
+ }
1172
+ //#endregion
1173
+ //#region src/sampleView/metadata/adapters/tableMetadataSourceAdapter.js
1174
+ var bn = class {
1175
+ #e;
1176
+ #t;
1177
+ #n;
1178
+ #r;
1179
+ #i;
1180
+ constructor(e, t = {}) {
1181
+ this.#e = e, this.#t = t.sampleIdField ?? (e.backend.backend === "data" ? e.backend.sampleIdField ?? "sample" : "sample"), this.#n = t.baseUrl, this.#i = /* @__PURE__ */ new Set([
1182
+ this.#t,
1183
+ ...t.excludedColumns ?? [],
1184
+ ...e.excludeColumns ?? []
1185
+ ]);
1186
+ }
1187
+ async listColumns(e) {
1188
+ let t = await this.#a(e), n = this.#t, r = /* @__PURE__ */ new Set();
1189
+ for (let e of t) for (let t of Object.keys(e)) t !== n && (this.#c(t) || r.add(t));
1190
+ return Array.from(r).map((e) => ({ id: e }));
1191
+ }
1192
+ async listSampleIds(e) {
1193
+ return (await this.#a(e)).map((e) => String(e[this.#t] ?? ""));
1194
+ }
1195
+ async listSamples(e = {}, t) {
1196
+ let n = await this.#a(t), r = this.#t;
1197
+ return n.map((t) => {
1198
+ let n = String(t[r] ?? ""), i = e.displayNameField ? t[e.displayNameField] : void 0;
1199
+ return {
1200
+ id: n,
1201
+ displayName: i == null ? n : String(i)
1202
+ };
1203
+ });
1204
+ }
1205
+ async listIdentifierExamples(e, t) {
1206
+ return [{
1207
+ name: "column",
1208
+ primary: !0,
1209
+ examples: $((await this.listColumns(t)).map((e) => e.id), e)
1210
+ }];
1211
+ }
1212
+ async resolveColumns(e, t) {
1213
+ let n = await this.listColumns(t), r = new Set(n.map((e) => e.id)), i = [], a = /* @__PURE__ */ new Set();
1214
+ for (let t of e) r.has(t) ? i.includes(t) || i.push(t) : a.add(t);
1215
+ return {
1216
+ columnIds: i,
1217
+ missing: Array.from(a)
1218
+ };
1219
+ }
1220
+ async fetchColumns(e, t) {
1221
+ let n = await this.#a(t), r = this.#t, i = new Set(e.sampleIds);
1222
+ for (let t of e.columnIds) if (this.#c(t)) throw Error("Column \"" + t + "\" is excluded by metadata source configuration.");
1223
+ let a = [];
1224
+ for (let t of n) {
1225
+ let n = String(t[r] ?? "");
1226
+ if (!i.has(n)) continue;
1227
+ let o = { sample: n };
1228
+ for (let n of e.columnIds) o[n] = t[n];
1229
+ a.push(o);
1230
+ }
1231
+ if (a.length === 0) throw Error("Metadata source rows do not match any sample ids in the current view.");
1232
+ let o = fn(e.sampleIds, a);
1233
+ if ("error" in o) {
1234
+ let e = o.error[0];
1235
+ throw Error("Invalid metadata source payload: " + String(e.message));
1236
+ }
1237
+ if (o.statistics.samplesInBoth.size === 0) throw Error("Metadata source rows do not match any sample ids in the current view.");
1238
+ let s = vn(this.#e, e.columnIds), c = e.groupPath ?? this.#e.groupPath, l = Z(a, s, this.#e.attributeGroupSeparator, c);
1239
+ return e.replace !== void 0 && (l.replace = e.replace), l;
1240
+ }
1241
+ async #a(e) {
1242
+ return this.#r ||= this.loadRows(e).catch((e) => {
1243
+ throw this.#r = void 0, e;
1244
+ }), this.#r;
1245
+ }
1246
+ async loadRows(e) {
1247
+ let t = this.#e.backend;
1248
+ if (t.backend !== "data") throw Error("Table metadata loading requires a data backend.");
1249
+ let n = t.data;
1250
+ if ("url" in n) return this.#o(n, e);
1251
+ if ("values" in n) return this.#s(n);
1252
+ throw Error("Metadata source data backend supports only UrlData and InlineData.");
1253
+ }
1254
+ async #o(e, t) {
1255
+ if (typeof e.url != "string") throw Error("Metadata source UrlData currently supports only string URLs.");
1256
+ let n = g(this.#n, e.url), r = U(e, n), i = At(r.type), a;
1257
+ try {
1258
+ a = await fetch(n, { signal: t });
1259
+ } catch (e) {
1260
+ throw Error("Could not load metadata source: " + e.message, { cause: e });
1261
+ }
1262
+ if (!a.ok) throw Error("Could not load metadata source: " + a.status + " " + a.statusText);
1263
+ let o;
1264
+ return o = typeof a[i] == "function" ? await a[i]() : await a.text(), H(o, W(r));
1265
+ }
1266
+ async #s(e) {
1267
+ let t = e.values, n = [];
1268
+ if (Array.isArray(t)) {
1269
+ if (t.length > 0) {
1270
+ let e = G(t[0]);
1271
+ n = t.map((t) => e(t));
1272
+ }
1273
+ } else if (typeof t == "object") n = [t];
1274
+ else if (typeof t == "string") n = H(t, W(U(e)));
1275
+ else throw Error("Inline metadata source values must be an array, object, or a string.");
1276
+ return n;
1277
+ }
1278
+ #c(e) {
1279
+ return this.#i.has(e);
1280
+ }
1281
+ };
1282
+ //#endregion
1283
+ export { H as A, G as C, Et as D, Dt as E, V as O, Mt as S, W as T, Z as _, nn as a, Bt as b, Qt as c, Kt as d, Yt as f, Jt as g, J as h, fn as i, A as j, Tt as k, cn as l, on as m, $ as n, tn as o, an as p, vn as r, qt as s, bn as t, sn as u, Wt as v, At as w, U as x, q as y };