@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
@@ -1,331 +1,13 @@
1
- import { $t as e, Ot as t, St as n, Tt as r, V as i, an as a, b as o, cn as s, ft as c, gn as l, k as u, ln as d, o as f, pt as p, t as m, u as ee, un as te, wt as ne, xt as h } from "./clipOptions-Cba4I0AO.js";
2
- import { a as g, n as re, r as ie, t as _ } from "./viewError-BiR9VCgL.js";
3
- import { H as ae, m as oe, y as v } from "./vega-scale-Byaw1K8O.js";
4
- import { t as se } from "./warning-CpIIpk8e.js";
5
- //#region ../core/src/view/layout/flexLayout.js
6
- function ce(e, t, { spacing: n, devicePixelRatio: r, offset: i, reverse: a } = {}) {
7
- n ||= 0, i ||= 0;
8
- let o = ge(e, t, n), s = 0, c = 0;
9
- for (let t = 0; t < e.length; t++) s += o[t], S(e[t]) || c++;
10
- let l = s + Math.max(0, c - 1) * n, u = r === void 0 ? (e) => e : (e) => Math.round(e * r) / r, d = 0, f = [], p = (e) => {
11
- let t = d;
12
- if (!t) return;
13
- let r = (e ? n : 0) * (a ? -1 : 1);
14
- m -= r;
15
- for (let e = 0; e < t; e++) f.push({
16
- location: m + (e + 1) / (t + 1) * r,
17
- size: 0
18
- });
19
- m += r, d = 0;
20
- }, m = a ? Math.max(t, l) : 0 + i;
21
- if (e.length == 1 && S(e[0])) return [{
22
- location: m,
23
- size: 0
24
- }];
25
- for (let t = 0; t < e.length; t++) {
26
- let r = e[t];
27
- if (S(r)) d++;
28
- else {
29
- p(f.length > 0);
30
- let e = o[t];
31
- a && (m -= e), f.push({
32
- location: u(m),
33
- size: u(e)
34
- }), a ? m -= n : m += e + n;
35
- }
36
- }
37
- return m += a ? n : -n, p(!1), f;
38
- }
39
- function le(e, { spacing: t } = { spacing: 0 }) {
40
- let n = 0;
41
- for (let r of e) n += E(r) + (S(r) ? 0 : t);
42
- return Math.max(0, n - t);
43
- }
44
- function ue(e, t, { spacing: n = 0 } = {}) {
45
- let r = [], i = [], a = 0, o = 0;
46
- for (let [s, c] of e.entries()) {
47
- let e = E(c), l = !S(c), u = o && l ? n : 0;
48
- i.length && a + u + e > t && (r.push(i), i = [], a = 0, o = 0), i.push(s), a += (o && l ? n : 0) + e, o += +!!l;
49
- }
50
- return i.length && r.push(i), r;
51
- }
52
- function de(e) {
53
- let t = 0, n = 0, r = 0, i, a = !0;
54
- for (let o of e) {
55
- t = Math.max(t, o.px ?? 0), n = Math.max(n, o.grow ?? 0), r = Math.max(r, E(o));
56
- let e = D(o);
57
- e === void 0 ? a = !1 : i = i === void 0 ? e : Math.max(i, e);
58
- }
59
- return O({
60
- px: t,
61
- grow: n,
62
- minPx: r,
63
- maxPx: a ? i : void 0
64
- });
65
- }
66
- function fe(e) {
67
- let t = {
68
- px: 0,
69
- grow: 0,
70
- minPx: 0,
71
- maxPx: 0
72
- }, n = !0;
73
- for (let r of e) {
74
- t.px += C(r.px), t.grow += C(r.grow), t.minPx += E(r);
75
- let e = D(r);
76
- e === void 0 ? n = !1 : t.maxPx += e;
77
- }
78
- return n || delete t.maxPx, O(t);
79
- }
80
- var y = class e {
81
- constructor(e, t) {
82
- this.width = e, this.height = t;
83
- }
84
- addPadding(e) {
85
- return this.#e(e.width, e.height);
86
- }
87
- subtractPadding(e) {
88
- return this.#e(-e.width, -e.height);
89
- }
90
- #e(t, n) {
91
- return new e(ye(this.width, t), ye(this.height, n));
92
- }
93
- isGrowing() {
94
- return !!(this.width.grow || this.height.grow);
95
- }
96
- }, b = Object.freeze({
97
- px: 0,
98
- grow: 0
99
- }), x = new y(b, b);
100
- function S(e) {
101
- return !e.px && !e.grow && !e.minPx;
102
- }
103
- function pe(e, t) {
104
- return !e || !t ? !1 : e.px === t.px && e.grow === t.grow && e.minPx === t.minPx && e.maxPx === t.maxPx;
105
- }
106
- function C(e) {
107
- return e || 0;
108
- }
109
- function me(e) {
110
- return e && (s(e.px) || s(e.grow) || s(e.minPx) || s(e.maxPx));
111
- }
1
+ import { C as e, E as t, Fn as n, Jn as r, K as i, M as a, On as o, P as s, Q as c, Tt as l, Wn as u, Yn as d, Z as f, _ as p, _n as m, an as ee, b as h, f as g, g as _, gt as v, l as te, m as y, o as ne, p as re, qn as b, t as ie, tr as ae, un as x } from "./clipOptions-clBEbkjv.js";
2
+ import { i as oe, l as se, t as ce, u as le } from "./url-DeOdSRrv.js";
3
+ import { a as S, n as ue, r as de, t as C } from "./viewError-D9aO90cI.js";
4
+ import { t as fe } from "./warning-CpIIpk8e.js";
5
+ //#region ../core/src/paramRuntime/graphRuntime.js
6
+ var pe = Symbol("runtimeNode"), me = 1e6;
112
7
  function he(e) {
113
- if (J(e)) throw Error("parseSizeDef does not accept step-based sizes.");
114
- if (me(e)) return w(e), O(e);
115
- if (s(e)) return {
116
- px: e,
117
- grow: 0
118
- };
119
- if (e === "container" || !e) return {
120
- px: 0,
121
- grow: 1
122
- };
123
- throw Error(`Invalid sizeDef: ${e}`);
124
- }
125
- function ge(e, t, n) {
126
- let r = !1;
127
- for (let t of e) w(t), r ||= ve(t);
128
- if (!r) return _e(e, t, n);
129
- let i = Array(e.length).fill(0), a = [];
130
- for (let t = 0; t < e.length; t++) S(e[t]) || a.push(t);
131
- let o = Math.max(0, a.length - 1) * n, s = Math.max(0, t - o), c = /* @__PURE__ */ new Set();
132
- for (let t of a) {
133
- let n = e[t];
134
- C(n.grow) || (i[t] = T(C(n.px), n), c.add(t));
135
- }
136
- for (;;) {
137
- let t = 0, n = 0, r = 0;
138
- for (let o of a) c.has(o) ? r += i[o] : (t += C(e[o].px), n += C(e[o].grow));
139
- if (!n) {
140
- for (let t of a) c.has(t) || (i[t] = T(C(e[t].px), e[t]), c.add(t));
141
- break;
142
- }
143
- let o = Math.max(0, s - r - t), l = 0, u = [], d = [];
144
- for (let t of a) {
145
- if (c.has(t)) continue;
146
- let r = e[t], a = C(r.px) + C(r.grow) / n * o, s = T(a, r);
147
- i[t] = s;
148
- let f = s - a;
149
- l += f, f > 0 ? u.push(t) : f < 0 && d.push(t);
150
- }
151
- if (!u.length && !d.length) break;
152
- if (l > 0) for (let e of u) c.add(e);
153
- else if (l < 0) for (let e of d) c.add(e);
154
- else for (let e of a) c.add(e);
155
- }
156
- return i;
157
- }
158
- function _e(e, t, n) {
159
- let r = 0, i = 0;
160
- for (let t of e) r += C(t.px) + (S(t) ? 0 : n), i += C(t.grow);
161
- r -= n;
162
- let a = Math.max(0, t - r), o = Array(e.length);
163
- for (let t = 0; t < e.length; t++) {
164
- let n = e[t];
165
- o[t] = S(n) ? 0 : C(n.px) + (i ? C(n.grow) / i * a : 0);
166
- }
167
- return o;
168
- }
169
- function w(e) {
170
- if (e.minPx !== void 0 && e.maxPx !== void 0 && e.minPx > e.maxPx) throw Error("SizeDef minPx cannot be greater than maxPx.");
171
- }
172
- function T(e, t) {
173
- return Math.min(Math.max(e, t.minPx ?? 0), t.maxPx ?? Infinity);
174
- }
175
- function E(e) {
176
- return T(C(e.px), e);
177
- }
178
- function D(e) {
179
- return e.maxPx ?? (C(e.grow) ? void 0 : E(e));
180
- }
181
- function ve(e) {
182
- return e.minPx !== void 0 || e.maxPx !== void 0;
183
- }
184
- function ye(e, t) {
185
- return O({
186
- px: (e.px ?? 0) + t,
187
- grow: e.grow,
188
- minPx: e.minPx === void 0 ? void 0 : Math.max(0, e.minPx + t),
189
- maxPx: e.maxPx === void 0 ? void 0 : Math.max(0, e.maxPx + t)
190
- });
191
- }
192
- function O(e) {
193
- let t = {}, n = e.px !== void 0, r = e.grow !== void 0, i = ve(e);
194
- return e.px ? t.px = e.px : e.px === 0 && (t.px = 0), e.grow ? t.grow = e.grow : e.grow === 0 ? t.grow = 0 : !n && !r && i && (t.grow = 1), e.minPx && e.minPx > C(e.px) && (t.minPx = e.minPx), e.maxPx !== void 0 && (C(t.grow) || e.maxPx < C(e.px)) && (t.maxPx = e.maxPx), t;
195
- }
196
- //#endregion
197
- //#region ../core/src/view/layout/padding.js
198
- var k = class e {
199
- constructor(e, t, n, r) {
200
- this.top = e || 0, this.right = t || 0, this.bottom = n || 0, this.left = r || 0;
201
- }
202
- get width() {
203
- return this.left + this.right;
204
- }
205
- get height() {
206
- return this.top + this.bottom;
207
- }
208
- expand(t) {
209
- return t <= 0 ? this : new e(this.top + t, this.right + t, this.bottom + t, this.left + t);
210
- }
211
- add(t) {
212
- return new e(this.top + t.top, this.right + t.right, this.bottom + t.bottom, this.left + t.left);
213
- }
214
- subtract(t) {
215
- return new e(this.top - t.top, this.right - t.right, this.bottom - t.bottom, this.left - t.left);
216
- }
217
- union(t) {
218
- return new e(Math.max(this.top, t.top), Math.max(this.right, t.right), Math.max(this.bottom, t.bottom), Math.max(this.left, t.left));
219
- }
220
- getHorizontal() {
221
- return new e(0, this.right, 0, this.left);
222
- }
223
- getVertical() {
224
- return new e(this.top, 0, this.bottom, 0);
225
- }
226
- get horizontalTotal() {
227
- return this.left + this.right;
228
- }
229
- get verticalTotal() {
230
- return this.top + this.bottom;
231
- }
232
- static createFromConfig(e) {
233
- return typeof e == "number" ? this.createUniformPadding(e) : e ? this.createFromRecord(e) : A;
234
- }
235
- static createFromRecord(t) {
236
- return new e(t.top, t.right, t.bottom, t.left);
237
- }
238
- static zero() {
239
- return A;
240
- }
241
- static createUniformPadding(t) {
242
- return new e(t, t, t, t);
243
- }
244
- };
245
- function be(e, t) {
246
- return t ? new k(t.top === !1 ? 0 : e.top, t.right === !1 ? 0 : e.right, t.bottom === !1 ? 0 : e.bottom, t.left === !1 ? 0 : e.left) : e;
247
- }
248
- var A = k.createUniformPadding(0);
249
- Object.freeze(A);
250
- //#endregion
251
- //#region ../core/src/utils/url.js
252
- var xe = /^([A-Za-z]+:)?\/\//;
253
- function j(e, t) {
254
- if (t && xe.test(t)) return t;
255
- let n = typeof e == "function" ? e() : e;
256
- if (!n) return t;
257
- if (!t) return n;
258
- if (/[#?]/.test(n)) throw Error(`Cannot append to a url with query or hash. Append: ${t}, base: ${n}`);
259
- return M(n) + t;
260
- }
261
- function Se(e, t, n = Ce()) {
262
- let r = typeof e == "function" ? e() : e;
263
- if (!t) return r;
264
- try {
265
- if (r) {
266
- let e = n ? new URL(r, n).href : new URL(r).href;
267
- return new URL(t, e).href;
268
- }
269
- if (n) return new URL(t, n).href;
270
- } catch {}
271
- return j(r, t);
272
- }
273
- function M(e) {
274
- let t = e.replace(/[^/]*$/, "");
275
- return t === "" ? void 0 : t.endsWith("://") ? e + "/" : t;
276
- }
277
- function Ce() {
278
- if (typeof document < "u" && document.baseURI) return document.baseURI;
279
- if (typeof window < "u" && window.location?.href) return window.location.href;
280
- }
281
- //#endregion
282
- //#region ../../node_modules/flatqueue/index.js
283
- var N = class {
284
- constructor(e = Infinity, t = Float64Array, n = Uint32Array) {
285
- let r = e !== Infinity;
286
- this.ids = r ? new n(e) : [], this.values = r ? new t(e) : [], this.capacity = e, this.length = 0;
287
- }
288
- clear() {
289
- this.length = 0;
290
- }
291
- push(e, t) {
292
- if (this.length === this.capacity) throw RangeError("Queue is at capacity.");
293
- let n = this.length++;
294
- for (; n > 0;) {
295
- let e = n - 1 >> 1, r = this.values[e];
296
- if (t >= r) break;
297
- this.ids[n] = this.ids[e], this.values[n] = r, n = e;
298
- }
299
- this.ids[n] = e, this.values[n] = t;
300
- }
301
- pop() {
302
- if (this.length === 0) return;
303
- let e = this.ids, t = this.values, n = e[0], r = --this.length;
304
- if (r > 0) {
305
- let n = e[r], i = t[r], a = 0, o = r >> 1;
306
- for (; a < o;) {
307
- let n = (a << 1) + 1, o = n + 1, s = n + (+(o < r) & t[o] < t[n]);
308
- if (t[s] >= i) break;
309
- e[a] = e[s], t[a] = t[s], a = s;
310
- }
311
- e[a] = n, t[a] = i;
312
- }
313
- return n;
314
- }
315
- peek() {
316
- return this.length > 0 ? this.ids[0] : void 0;
317
- }
318
- peekValue() {
319
- return this.length > 0 ? this.values[0] : void 0;
320
- }
321
- shrink() {
322
- Array.isArray(this.ids) && (this.ids.length = this.length), Array.isArray(this.values) && (this.values.length = this.length);
323
- }
324
- }, P = Symbol("runtimeNode"), F = 1e6;
325
- function we(e) {
326
8
  return e ? (t, n) => e.addDisposer(t, n) : () => () => void 0;
327
9
  }
328
- function I(e, t, n = !0) {
10
+ function w(e, t, n = !0) {
329
11
  let r = {
330
12
  id: e.id,
331
13
  name: e.name,
@@ -340,7 +22,7 @@ function I(e, t, n = !0) {
340
22
  };
341
23
  }
342
24
  };
343
- return Object.defineProperty(r, P, {
25
+ return Object.defineProperty(r, pe, {
344
26
  enumerable: !1,
345
27
  configurable: !1,
346
28
  writable: !1,
@@ -349,18 +31,25 @@ function I(e, t, n = !0) {
349
31
  t(e);
350
32
  } }) : r;
351
33
  }
352
- function Te(e) {
353
- let t = e[P];
34
+ function T(e) {
35
+ let t = e[pe];
354
36
  if (!t) throw Error("ParamRef is not bound to this graph runtime. Expected runtime-created ref.");
355
37
  return t;
356
38
  }
357
- function Ee(e) {
358
- return typeof e.rank == "number" ? e.rank : Te(e).rank;
39
+ function ge(e, t) {
40
+ let n = T(t), r = /* @__PURE__ */ new Set(), i = (e) => {
41
+ let t = T(e);
42
+ return t === n || !r.has(t) && (r.add(t), (t.dependencies ?? []).some(i));
43
+ };
44
+ return i(e);
359
45
  }
360
- function De(e) {
46
+ function _e(e) {
47
+ return typeof e.rank == "number" ? e.rank : T(e).rank;
48
+ }
49
+ function ve(e) {
361
50
  for (let t of e) t();
362
51
  }
363
- var Oe = class {
52
+ var ye = class {
364
53
  #e = 1;
365
54
  #t = 1;
366
55
  #n = 0;
@@ -374,13 +63,13 @@ var Oe = class {
374
63
  #u = /* @__PURE__ */ new Map();
375
64
  #d = /* @__PURE__ */ new Set();
376
65
  #f = /* @__PURE__ */ new Set();
377
- #p = new N();
378
- #m = new N();
66
+ #p = new le();
67
+ #m = new le();
379
68
  #h = /* @__PURE__ */ new Set();
380
69
  #g;
381
70
  #_;
382
71
  constructor(e = {}) {
383
- this.#g = we(e.lifecycleRegistry), this.#_ = e.onError;
72
+ this.#g = he(e.lifecycleRegistry), this.#_ = e.onError;
384
73
  }
385
74
  createWritable(e, t, n, r, i = {}) {
386
75
  let a = "n" + this.#e++, o = i.notify ?? !0, s = {
@@ -402,7 +91,7 @@ var Oe = class {
402
91
  }, l = () => {
403
92
  s.disposed = !0, s.listeners.clear(), u();
404
93
  }, u = this.#g(e, l);
405
- return Object.assign(I(s, c, o), { dispose: l });
94
+ return Object.assign(w(s, c, o), { dispose: l });
406
95
  }
407
96
  computed(e, t, n, r, i = {}) {
408
97
  return this.#v(e, t, n, r, i);
@@ -437,19 +126,13 @@ var Oe = class {
437
126
  })), l = c(), u = () => {
438
127
  s.disposed || (s.disposed = !0, d(), l.forEach((e) => e()), s.listeners.clear(), this.#d.delete(s));
439
128
  }, d = this.#g(e, u);
440
- return Object.assign(I(s), {
129
+ return Object.assign(w(s), {
441
130
  dispose: u,
442
131
  rebind: (e, n) => {
443
132
  if (s.disposed) throw Error("Cannot rebind disposed operation: " + t);
444
- let r = /* @__PURE__ */ new Set(), i = (e) => {
445
- let n = e[P];
446
- if (n === s) throw Error("Reactive dependency cycle: " + t);
447
- if (!r.has(n)) {
448
- r.add(n);
449
- for (let e of n?.dependencies ?? []) i(e);
450
- }
451
- };
452
- e.forEach(i), l.forEach((e) => e()), s.dependencies = e, s.fn = n, this.#n++, l = c(), this.#C(s), this.#p.clear();
133
+ let r = w(s);
134
+ if (e.some((e) => ge(e, r))) throw Error("Reactive dependency cycle: " + t);
135
+ l.forEach((e) => e()), s.dependencies = e, s.fn = n, this.#n++, l = c(), this.#C(s), this.#p.clear();
453
136
  for (let e of this.#d) this.#p.push(e, this.#T(e.rank));
454
137
  this.#m.clear();
455
138
  for (let e of this.#f) this.#m.push(e, this.#T(e.rank));
@@ -543,7 +226,7 @@ var Oe = class {
543
226
  #y(e) {
544
227
  this.#s++;
545
228
  try {
546
- De(e);
229
+ ve(e);
547
230
  } catch (e) {
548
231
  throw this.#c = !1, !this.#o && this.#s === 1 && this.#b(e), e;
549
232
  } finally {
@@ -587,25 +270,17 @@ var Oe = class {
587
270
  }
588
271
  #S(e) {
589
272
  let t = -1, n = 0;
590
- return () => (t !== this.#n && (n = 1 + e().reduce((e, t) => Math.max(e, Ee(t)), 0), t = this.#n), n);
273
+ return () => (t !== this.#n && (n = 1 + e().reduce((e, t) => Math.max(e, _e(t)), 0), t = this.#n), n);
591
274
  }
592
275
  #C(e) {
593
- if (this.#d.has(e)) {
594
- this.#E();
595
- return;
596
- }
597
- this.#d.add(e), this.#p.push(e, this.#T(e.rank)), this.#E();
276
+ this.#d.has(e) || (this.#d.add(e), this.#p.push(e, this.#T(e.rank))), this.#E();
598
277
  }
599
278
  #w(e) {
600
- if (this.#f.has(e)) {
601
- this.#E();
602
- return;
603
- }
604
- this.#f.add(e), this.#m.push(e, this.#T(e.rank)), this.#E();
279
+ this.#f.has(e) || (this.#f.add(e), this.#m.push(e, this.#T(e.rank))), this.#E();
605
280
  }
606
281
  #T(e) {
607
- let t = this.#t % F;
608
- return this.#t += 1, e * F + t;
282
+ let t = this.#t % me;
283
+ return this.#t += 1, e * me + t;
609
284
  }
610
285
  #E() {
611
286
  this.#r > 0 || this.#a || this.#o || (this.#a = !0, queueMicrotask(() => {
@@ -621,7 +296,7 @@ var Oe = class {
621
296
  this.#h.clear();
622
297
  }
623
298
  }
624
- }, ke = class {
299
+ }, be = class {
625
300
  #e = 1;
626
301
  #t = /* @__PURE__ */ new Map();
627
302
  createOwner(e, t) {
@@ -642,7 +317,7 @@ var Oe = class {
642
317
  t.clear(), this.#t.delete(e);
643
318
  }
644
319
  }
645
- }, Ae = class {
320
+ }, xe = class {
646
321
  #e = 1;
647
322
  #t = /* @__PURE__ */ new Map();
648
323
  createRootScope(e) {
@@ -673,78 +348,82 @@ var Oe = class {
673
348
  if (!t) throw Error("Unknown scope: " + e);
674
349
  t.params.clear(), t.initializers.clear();
675
350
  }
676
- registerInitializer(e, n, r) {
677
- t(n);
678
- let i = this.#t.get(e);
679
- if (!i) throw Error("Unknown scope: " + e);
680
- if (i.params.has(n) || i.initializers.has(n)) throw Error(`Parameter "${n}" already exists in scope ${e}`);
681
- i.initializers.set(n, {
682
- initialize: r,
351
+ registerInitializer(e, t, n) {
352
+ h(t);
353
+ let r = this.#t.get(e);
354
+ if (!r) throw Error("Unknown scope: " + e);
355
+ if (r.params.has(t) || r.initializers.has(t)) throw Error(`Parameter "${t}" already exists in scope ${e}`);
356
+ r.initializers.set(t, {
357
+ initialize: n,
683
358
  initializing: !1
684
359
  });
685
360
  }
686
- register(e, n, r) {
687
- t(n);
688
- let i = this.#t.get(e);
689
- if (!i) throw Error("Unknown scope: " + e);
690
- if (i.params.has(n) || i.initializers.get(n)?.initializing === !1) throw Error("Parameter \"" + n + "\" already exists in scope " + e);
691
- return i.params.set(n, r), r;
692
- }
693
- resolve(e, n) {
694
- t(n);
695
- let r = e;
696
- for (; r;) {
697
- let e = this.#t.get(r);
698
- if (!e) throw Error("Unknown scope: " + r);
699
- let t = e.initializers.get(n);
700
- if (t) {
701
- if (t.initializing) throw Error(`Parameter dependency cycle while initializing "${n}" in ${r}.`);
702
- t.initializing = !0;
361
+ register(e, t, n) {
362
+ h(t);
363
+ let r = this.#t.get(e);
364
+ if (!r) throw Error("Unknown scope: " + e);
365
+ if (r.params.has(t) || r.initializers.get(t)?.initializing === !1) throw Error("Parameter \"" + t + "\" already exists in scope " + e);
366
+ return r.params.set(t, n), n;
367
+ }
368
+ resolve(e, t) {
369
+ h(t);
370
+ let n = e;
371
+ for (; n;) {
372
+ let e = this.#t.get(n);
373
+ if (!e) throw Error("Unknown scope: " + n);
374
+ let r = e.initializers.get(t);
375
+ if (r) {
376
+ if (r.initializing) throw Error(`Parameter dependency cycle while initializing "${t}" in ${n}.`);
377
+ r.initializing = !0;
703
378
  try {
704
- if (t.initialize(), !e.params.has(n)) throw Error(`Initializer did not register parameter "${n}".`);
705
- e.initializers.delete(n);
379
+ if (r.initialize(), !e.params.has(t)) throw Error(`Initializer did not register parameter "${t}".`);
380
+ e.initializers.delete(t);
706
381
  } finally {
707
- t.initializing = !1;
382
+ r.initializing = !1;
708
383
  }
709
384
  }
710
- let i = e.params.get(n);
385
+ let i = e.params.get(t);
711
386
  if (i) return i;
712
- r = e.parentScope;
387
+ n = e.parentScope;
713
388
  }
714
389
  }
715
390
  };
716
391
  //#endregion
717
392
  //#region ../core/src/paramRuntime/expressionCompiler.js
718
- function je(e, t = {}, n = {}) {
719
- return p(e, t, n);
393
+ function Se(e, t = {}, n = {}) {
394
+ return c(e, t, n);
720
395
  }
721
396
  //#endregion
722
397
  //#region ../core/src/paramRuntime/expressionRef.js
723
- function Me(e, t, n = {}) {
724
- let r = {}, i = je(e, r, n), a = /* @__PURE__ */ new Map();
725
- for (let n of i.globals) {
726
- if (a.has(n)) continue;
727
- let i = t(n);
728
- if (!i) throw Error("Unknown variable \"" + n + "\" in expression: " + e);
729
- a.set(n, i), Object.defineProperty(r, n, {
730
- enumerable: !0,
731
- get() {
732
- return i.get();
733
- }
734
- });
398
+ function E(e, t, n = {}) {
399
+ let r = {}, i = Se(e, r, n), a = /* @__PURE__ */ new Map();
400
+ try {
401
+ for (let n of i.globals) {
402
+ if (a.has(n)) continue;
403
+ let i = t(n);
404
+ if (!i) throw Error("Unknown variable \"" + n + "\" in expression: " + e);
405
+ a.set(n, i), Object.defineProperty(r, n, {
406
+ enumerable: !0,
407
+ get() {
408
+ return i.get();
409
+ }
410
+ });
411
+ }
412
+ } catch (e) {
413
+ throw o(e, n.specLocation);
735
414
  }
736
- let o = /* @__PURE__ */ new Set();
415
+ let s = /* @__PURE__ */ new Set();
737
416
  return i.subscribe = (e) => {
738
417
  let t = [];
739
418
  for (let n of a.values()) t.push(n.subscribe(e));
740
419
  for (let n of i.scaleDependencies ?? []) t.push(n.subscribe(e));
741
420
  let n = !0, r = () => {
742
- n && (n = !1, o.delete(r), t.forEach((e) => e()));
421
+ n && (n = !1, s.delete(r), t.forEach((e) => e()));
743
422
  };
744
- return o.add(r), r;
423
+ return s.add(r), r;
745
424
  }, i.invalidate = () => {
746
- for (let e of o) e();
747
- o.clear();
425
+ for (let e of s) e();
426
+ s.clear();
748
427
  }, i.createSnapshotEvaluator = () => {
749
428
  let e = {};
750
429
  for (let t of Object.keys(r)) a.has(t) || (e[t] = r[t]);
@@ -763,12 +442,12 @@ function Me(e, t, n = {}) {
763
442
  }
764
443
  //#endregion
765
444
  //#region ../core/src/paramRuntime/paramRuntime.js
766
- var Ne = class {
767
- #e = new ke();
445
+ var Ce = class {
446
+ #e = new be();
768
447
  #t;
769
- #n = new Ae();
448
+ #n = new xe();
770
449
  constructor(e = {}) {
771
- this.#t = new Oe({
450
+ this.#t = new ye({
772
451
  lifecycleRegistry: this.#e,
773
452
  onError: e.onError
774
453
  });
@@ -797,11 +476,14 @@ var Ne = class {
797
476
  return this.#n.register(e, t, a);
798
477
  }
799
478
  registerDerived(e, t, n, r) {
800
- let { expression: i, dependencies: a } = Me(n, (t) => this.resolve(r?.expressionScope ?? e, t), r), o = this.#n.getOwnerId(e), s = this.#t.computed(o, t, a, () => i(null));
479
+ let { expression: i, dependencies: a } = E(n, (t) => this.resolve(r?.expressionScope ?? e, t), r), o = this.#n.getOwnerId(e), s = this.#t.computed(o, t, a, () => i(null));
801
480
  return this.#n.register(e, t, s);
802
481
  }
482
+ registerComputed(e, t, n, r) {
483
+ return this.#n.register(e, t, this.#t.computed(this.#n.getOwnerId(e), t, n, r));
484
+ }
803
485
  createExpression(e, t, n) {
804
- let { expression: r } = Me(t, (t) => this.resolve(e, t), n);
486
+ let { expression: r } = E(t, (t) => this.resolve(e, t), n);
805
487
  return r;
806
488
  }
807
489
  resolve(e, t) {
@@ -834,28 +516,82 @@ var Ne = class {
834
516
  whenPropagated(e) {
835
517
  return this.#t.whenPropagated(e);
836
518
  }
837
- }, Pe = (e) => new Promise((t) => setTimeout(t, e));
838
- function Fe() {
519
+ }, we = class {
520
+ #e;
521
+ #t;
522
+ #n;
523
+ #r;
524
+ #i = /* @__PURE__ */ new Set();
525
+ #a = !1;
526
+ #o;
527
+ #s;
528
+ constructor(e, t, n) {
529
+ this.#e = e, this.#t = t, this.#n = n, this.#o = e.signal("intervalCompletion", 0), this.#s = e.effect([e.getParamRef(t), this.#o], () => {
530
+ if (this.#a) {
531
+ this.#a = !1;
532
+ for (let n of Array.from(this.#i)) try {
533
+ n(e.getValue(t));
534
+ } catch (e) {
535
+ console.error(e);
536
+ }
537
+ }
538
+ });
539
+ }
540
+ beforeWrite(e, t) {
541
+ let n = this.#n;
542
+ if (n) {
543
+ if (e?.type !== "interval") throw Error(`Parameter "${this.#t}" requires an interval selection.`);
544
+ i(e.intervals, n);
545
+ }
546
+ this.#r && t !== this.#r.host && this.cancel(), this.#a = !this.#r && !se(e, this.#e.getValue(this.#t));
547
+ }
548
+ begin(e, t) {
549
+ this.cancel(), this.#r = {
550
+ host: e,
551
+ cancel: t,
552
+ initial: structuredClone(this.#e.getValue(this.#t))
553
+ };
554
+ }
555
+ finish(e, t) {
556
+ if (this.#r?.host !== e) return;
557
+ let n = this.#r.initial;
558
+ this.#r = void 0, t && !se(n, this.#e.getValue(this.#t)) && (this.#a = !0, this.#o.set(this.#o.get() + 1), this.#e.flushNow());
559
+ }
560
+ cancel() {
561
+ let e = this.#r;
562
+ this.#r = void 0, e?.cancel();
563
+ }
564
+ clear() {
565
+ this.cancel();
566
+ let e = this.#e.getValue(this.#t);
567
+ a(e) && this.#e.setValue(this.#t, t(Object.keys(e.intervals)));
568
+ }
569
+ subscribeCommit(e) {
570
+ return this.#i.add(e), () => {
571
+ this.#i.delete(e);
572
+ };
573
+ }
574
+ dispose() {
575
+ this.cancel(), this.#s(), this.#i.clear();
576
+ }
577
+ }, Te = (e) => new Promise((t) => setTimeout(t, e));
578
+ function Ee() {
839
579
  return { canceled: !1 };
840
580
  }
841
- function Ie(e) {
581
+ function De(e) {
842
582
  let t = e.requestAnimationFrame || window.requestAnimationFrame, n = e.signal, r = e.cancelToken, i = () => new Promise((i, a) => {
843
583
  if (r?.canceled) return i();
844
584
  if (n?.aborted) return a("aborted");
845
585
  let o = performance.now(), s = o + (e.duration || 1e3), c = typeof e.from == "number" ? e.from : 0, l = typeof e.to == "number" ? e.to : 1, u = e.easingFunction || ((e) => e), d = (e) => (e - o) / (s - o), f = (e) => e * (l - c) + c, p = (e) => Math.max(0, Math.min(1, e)), m = (o) => {
846
- if (r?.canceled) {
847
- i();
848
- return;
849
- }
850
- n?.aborted ? a("aborted") : (e.onUpdate(f(u(p(d(o))))), o < s ? t(m) : (e.onUpdate(f(u(1))), i()));
586
+ r?.canceled ? i() : n?.aborted ? a("aborted") : (e.onUpdate(f(u(p(d(o))))), o < s ? t(m) : (e.onUpdate(f(u(1))), i()));
851
587
  };
852
588
  t(m);
853
589
  });
854
- return e.delay ? r?.canceled ? Promise.resolve() : n?.aborted ? Promise.reject("aborted") : Pe(e.delay).then(i) : i();
590
+ return e.delay ? r?.canceled ? Promise.resolve() : n?.aborted ? Promise.reject("aborted") : Te(e.delay).then(i) : i();
855
591
  }
856
592
  //#endregion
857
593
  //#region ../core/src/utils/animator.js
858
- var Le = class {
594
+ var Oe = class {
859
595
  constructor(e, t) {
860
596
  this._renderCallback = e, this._onError = t, this._renderRequested = !1, this._finalized = !1, this._warn = !1, this._animationFrameRequest = void 0, this.transitions = [], this.transitionsEnabled = !0;
861
597
  }
@@ -886,13 +622,13 @@ var Le = class {
886
622
  this._finalized = !0, this._renderRequested = !1, this.transitions = [], this._animationFrameRequest !== void 0 && (window.cancelAnimationFrame(this._animationFrameRequest), this._animationFrameRequest = void 0);
887
623
  }
888
624
  transition(e) {
889
- return Ie({
625
+ return De({
890
626
  requestAnimationFrame: (e) => this.requestTransition(e),
891
627
  ...e
892
628
  });
893
629
  }
894
630
  };
895
- function Re(e, t, n, r, i) {
631
+ function ke(e, t, n, r, i) {
896
632
  let a = 0, o = !0, s = !1, c = structuredClone(i), l = c;
897
633
  function u(e, t, n, r) {
898
634
  return t + (e - t) * 2 ** (-n / r);
@@ -911,7 +647,7 @@ function Re(e, t, n, r, i) {
911
647
  s || (s = !0, e.requestTransition(d));
912
648
  }
913
649
  function p(n) {
914
- l = n, e.transitionsEnabled === !1 ? (c = l, o = !0, s = !1, e.cancelTransition(d), t(c)) : o && (o = !1, a = ze(), d(a));
650
+ l = n, e.transitionsEnabled === !1 ? (c = l, o = !0, s = !1, e.cancelTransition(d), t(c)) : o && (o = !1, a = Ae(), d(a));
915
651
  }
916
652
  return p.stop = () => {
917
653
  o = !0, s = !1, e.cancelTransition(d);
@@ -919,159 +655,228 @@ function Re(e, t, n, r, i) {
919
655
  l = e, c = e, p.stop(), t(c);
920
656
  }, p;
921
657
  }
922
- function ze() {
658
+ function Ae() {
923
659
  let e = globalThis.document?.timeline?.currentTime;
924
660
  return typeof e == "number" ? e : performance.now();
925
661
  }
926
662
  //#endregion
927
663
  //#region ../core/src/paramRuntime/viewParamRuntime.js
928
- var Be = class {
664
+ var je = class {
929
665
  #e;
930
666
  #t;
931
667
  #n = /* @__PURE__ */ new Map();
932
668
  #r = /* @__PURE__ */ new Map();
933
- #i = /* @__PURE__ */ new Map();
934
- #a = /* @__PURE__ */ new Set();
669
+ #i = !0;
670
+ #a = /* @__PURE__ */ new Map();
935
671
  #o = /* @__PURE__ */ new Map();
936
- #s;
937
- #c = /* @__PURE__ */ new Map();
672
+ #s = /* @__PURE__ */ new Map();
673
+ #c = /* @__PURE__ */ new Set();
938
674
  #l = /* @__PURE__ */ new Map();
939
675
  #u = /* @__PURE__ */ new Map();
940
676
  #d;
941
- #f;
942
- #p;
943
- #m;
944
- #h = !1;
677
+ #f = /* @__PURE__ */ new Map();
678
+ #p = /* @__PURE__ */ new Map();
679
+ #m = /* @__PURE__ */ new Map();
680
+ #h;
681
+ #g;
682
+ #_;
683
+ #v;
684
+ #y;
685
+ #b = !1;
945
686
  constructor(e, t, n, r = {}) {
946
- this.#d = e ?? (() => void 0), this.#f = t ?? (() => void 0), this.#p = n, this.#m = r.settleTemporalUpdatesImmediately ?? !1;
947
- let i = this.#d();
948
- i ? (this.#e = i.#e, this.#t = this.#e.createScope(i.#t)) : (this.#e = new Ne({ onError: r.onError }), this.#t = this.#e.createScope());
687
+ this.#h = e ?? (() => void 0), this.#g = t ?? (() => void 0), this.#_ = n, this.#y = r.getSpecOrigin, this.#v = r.settleTemporalUpdatesImmediately ?? !1;
688
+ let i = this.#h();
689
+ i ? (this.#e = i.#e, this.#t = this.#e.createScope(i.#t)) : (this.#e = new Ce({ onError: r.onError }), this.#t = this.#e.createScope());
949
690
  }
950
691
  setSelectionSource(e) {
951
- this.#s = e;
692
+ this.#d = e;
952
693
  }
953
694
  findSelectionCapability(e) {
954
- let t = this.findRuntimeForParam(e), n = t && t.#c.get(e);
695
+ let t = this.findRuntimeForParam(e), n = t && t.#f.get(e);
955
696
  if (!n?.size) return;
956
697
  let r = Array.from(n, (t) => ({
957
698
  type: t.kind,
958
699
  components: t.components.map((e) => ({
959
700
  component: e,
960
- type: t.source?.getScaleResolution(e)?.type
701
+ type: t.kind === "interval" ? t.source?.getScaleResolution(e)?.type : void 0
961
702
  })),
962
703
  location: t.source?.name ?? e
963
704
  })), i = r[0], a = JSON.stringify(i.components), o = r.find(({ components: e }) => JSON.stringify(e) !== a);
964
705
  if (o) throw Error(`Conflicting selection declarations for "${e}" in "${i.location}" and "${o.location}".`);
965
706
  return i;
966
707
  }
967
- #g(e) {
968
- if (!("select" in e)) return;
969
- let t = i(e.select), n = t.type === "interval" ? "interval" : t.toggle ? "multi" : "single", r = t.type === "interval" ? Array.from(new Set(t.encodings)).sort() : [], a = e.push === "outer" ? this.findRuntimeForParam(e.name) : this, o = {
970
- kind: n,
971
- components: r,
972
- source: this.#s
973
- }, s = a.#c.get(e.name) ?? /* @__PURE__ */ new Set(), c = s.values().next().value;
974
- if (c && (c.kind !== n || JSON.stringify(c.components) !== JSON.stringify(r))) throw Error(`Conflicting selection declarations for "${e.name}" in "${c.source?.name ?? e.name}" and "${this.#s?.name ?? e.name}".`);
975
- s.add(o), a.#c.set(e.name, s), this.#e.addScopeDisposer(this.#t, () => {
708
+ #x(t) {
709
+ if (!("select" in t)) return;
710
+ let n = e(t.select), r = n.type === "interval" ? "interval" : n.encodings ? "categories" : n.toggle ? "multi" : "single", i = n.encodings ? Array.from(new Set(n.encodings)).sort() : [], a = t.push === "outer" ? this.findRuntimeForParam(t.name) : this, o = {
711
+ kind: r,
712
+ toggle: n.type === "point" ? !!n.toggle : void 0,
713
+ components: i,
714
+ source: this.#d
715
+ }, s = a.#f.get(t.name) ?? /* @__PURE__ */ new Set(), c = s.values().next().value;
716
+ if (c && (c.kind !== r || c.toggle !== o.toggle || JSON.stringify(c.components) !== JSON.stringify(i))) throw Error(`Conflicting selection declarations for "${t.name}" in "${c.source?.name ?? t.name}" and "${this.#d?.name ?? t.name}".`);
717
+ s.add(o), a.#f.set(t.name, s), this.#e.addScopeDisposer(this.#t, () => {
976
718
  s.delete(o);
977
719
  });
978
720
  }
979
- get #_() {
980
- return { resolveScaleResolution: this.#f };
721
+ #S(e) {
722
+ return {
723
+ resolveScaleResolution: this.#g,
724
+ specLocation: this.getSpecLocation(e, ["expr"])
725
+ };
726
+ }
727
+ registerOutput(e) {
728
+ return this.registerParam({ name: e }), this.#C(e);
729
+ }
730
+ #C(e) {
731
+ let t = this.#r.get(e);
732
+ if (t) return t;
733
+ if (!this.#i) throw Error("Cannot add a transform output to configured ancestor parameter \"" + e + "\". Create its owner and producer together.");
734
+ let n = this.#s.get(e);
735
+ if (!n || Object.keys(n).some((e) => e !== "name" && e !== "description") || this.#a.get(e)?.size) throw Error("Transform output target \"" + e + "\" must be a bare parameter with no other writers.");
736
+ let r = this.#o.get(e), i = new oe(r);
737
+ return i.owner = this.#d, this.#n.delete(e), this.#r.set(e, i), this.#s.set(e, {
738
+ ...n,
739
+ persist: !1
740
+ }), r.set(Object.freeze([])), this.#e.flushNow(), i;
741
+ }
742
+ finalizeOutputDeclarations() {
743
+ this.#i = !1;
744
+ }
745
+ getOutput(e) {
746
+ let t = this.#r.get(e);
747
+ if (!t) throw Error("Output parameter \"" + e + "\" is not declared.");
748
+ return t;
749
+ }
750
+ resolveOutput(e) {
751
+ if (typeof e == "string") return this.getOutput(e);
752
+ if (e.push !== "outer") throw Error("Transform output pushing requires push: \"outer\".");
753
+ let t = this.#h()?.findRuntimeForParam(e.name);
754
+ if (!t) throw Error("Output parameter \"" + e.name + "\" not found in outer scope.");
755
+ return t.#C(e.name);
756
+ }
757
+ get outputs() {
758
+ return this.#r.values();
759
+ }
760
+ isWritable(e) {
761
+ return this.#n.has(e);
981
762
  }
982
- registerParam(e, n = {}) {
983
- let r = e.name;
984
- if (t(r), this.#i.has(r) || this.#a.has(r)) throw Error("Parameter \"" + r + "\" already registered in this scope.");
985
- if (He(e), n.defer) {
763
+ registerParam(e, t = {}) {
764
+ let n = e.name;
765
+ try {
766
+ h(n);
767
+ } catch (t) {
768
+ throw o(t, this.getSpecLocation(e, ["name"]));
769
+ }
770
+ if (this.#s.has(n) || this.#c.has(n)) throw o(/* @__PURE__ */ Error("Parameter \"" + n + "\" already registered in this scope."), this.getSpecLocation(e, ["name"]));
771
+ if (Ne(e), t.defer) {
986
772
  if (!("expr" in e)) throw Error("Only expression parameters can be deferred.");
987
- return this.#e.registerInitializer(this.#t, r, () => {
988
- this.#v(e);
989
- }), this.#i.set(r, e), () => {
990
- throw Error("Cannot set derived parameter \"" + r + "\".");
773
+ return this.#e.registerInitializer(this.#t, n, () => {
774
+ this.#w(e);
775
+ }), this.#s.set(n, e), () => {
776
+ throw Error("Cannot set derived parameter \"" + n + "\".");
991
777
  };
992
778
  }
993
- return this.#v(e);
779
+ return this.#w(e);
994
780
  }
995
781
  registerLazyExpression(e, t, n) {
996
782
  this.#e.registerInitializer(this.#t, e, () => {
997
783
  n?.();
998
- let r = this.#e.registerDerived(this.#t, e, t, this.#_);
999
- this.#r.set(e, r);
1000
- }), this.#a.add(e);
784
+ let r = this.#e.registerDerived(this.#t, e, t, this.#S());
785
+ this.#o.set(e, r);
786
+ }), this.#c.add(e);
787
+ }
788
+ registerComputed(e, t, n) {
789
+ this.#e.registerInitializer(this.#t, e, () => {
790
+ this.#o.set(e, this.#e.registerComputed(this.#t, e, t(), n));
791
+ }), this.#c.add(e);
1001
792
  }
1002
793
  registerScopedExpression(e, t, n) {
1003
794
  if (this.#e !== n.#e) throw Error("Scoped expressions must share a parameter runtime.");
1004
- if (this.#i.has(e)) throw Error("Parameter \"" + e + "\" already registered in this scope.");
795
+ if (this.#s.has(e)) throw Error("Parameter \"" + e + "\" already registered in this scope.");
1005
796
  this.#e.registerInitializer(this.#t, e, () => {
1006
797
  let r = this.#e.registerDerived(this.#t, e, t, {
1007
798
  expressionScope: n.#t,
1008
- ...n.#_
799
+ ...n.#S()
1009
800
  });
1010
- this.#r.set(e, r);
1011
- }), this.#i.set(e, {
801
+ this.#o.set(e, r);
802
+ }), this.#s.set(e, {
1012
803
  name: e,
1013
804
  expr: t
1014
805
  });
1015
806
  }
1016
- #v(e) {
1017
- let t = e.name, n, r;
1018
- if (e.push == "outer") {
1019
- let i = this.findRuntimeForParam(t);
1020
- if (!i) throw Error(`Parameter "${t}" not found in outer scope!`);
1021
- let a = i.paramConfigs.get(t);
1022
- if (!a) throw Error(`Outer parameter "${t}" exists as a value but has no registered config.`);
1023
- if ("expr" in a || "select" in a || "ruler" in a) throw Error(`The outer parameter "${t}" must not have expr, select, or ruler properties!`);
1024
- n = (e) => {
1025
- i.setValue(t, e);
1026
- }, this.#n.set(t, n), "ruler" in e && (r = h(e, this), n(r));
1027
- } else if ("value" in e) r = h(e, this), n = "transition" in e ? this.#b(t, r, e.transition) : this.#y(t, r);
1028
- else if ("expr" in e) {
1029
- if ("transition" in e) this.#x(t, e.expr, e.transition);
1030
- else if ("debounce" in e) this.#S(t, e.expr, e.debounce);
807
+ #w(t) {
808
+ let n = t.name, r, i;
809
+ if (t.push == "outer") {
810
+ let e = this.findRuntimeForParam(n);
811
+ if (!e) throw o(/* @__PURE__ */ Error(`Parameter "${n}" not found in outer scope!`), this.getSpecLocation(t, ["name"]));
812
+ let a = e.paramConfigs.get(n);
813
+ if (!a) throw Error(`Outer parameter "${n}" exists as a value but has no registered config.`);
814
+ if ("expr" in a || "select" in a && !("select" in t) || "ruler" in a || !e.isWritable(n)) throw Error(`The outer parameter "${n}" must not have expr, select, or ruler properties!`);
815
+ r = (t, r = {}) => {
816
+ e.setValue(n, t, r);
817
+ }, this.#n.set(n, r);
818
+ let s = e.#a.get(n) ?? /* @__PURE__ */ new Set();
819
+ s.add(this), e.#a.set(n, s), this.#e.addScopeDisposer(this.#t, () => {
820
+ s.delete(this);
821
+ }), "ruler" in t && (i = g(t, this), r(i));
822
+ } else if ("value" in t) i = g(t, this), r = "transition" in t ? this.#T(n, i, t.transition) : this.allocateSetter(n, i);
823
+ else if (y(t)) {
824
+ if ("transition" in t) this.#E(n, t, t.transition);
825
+ else if ("debounce" in t) this.#D(n, t, t.debounce);
1031
826
  else {
1032
- let n = this.#e.registerDerived(this.#t, t, e.expr, this.#_);
1033
- this.#r.set(t, n);
827
+ let e = this.#e.registerDerived(this.#t, n, t.expr, this.#S(t));
828
+ this.#o.set(n, e);
1034
829
  }
1035
- n = () => {
1036
- throw Error("Cannot set derived parameter \"" + t + "\".");
830
+ r = () => {
831
+ throw Error("Cannot set derived parameter \"" + n + "\".");
1037
832
  };
1038
- } else r = h(e, this), n = this.#y(t, r);
1039
- if ("select" in e) {
1040
- if (r ??= h(e, this), !this.#n.has(t)) {
1041
- let e = this.#e.registerSelection(this.#t, t, r);
1042
- this.#r.set(t, e), this.#n.set(t, (t) => {
1043
- e.set(t), this.#e.flushNow();
1044
- }), n = this.#n.get(t);
833
+ } else i = g(t, this), r = this.allocateSetter(n, i);
834
+ if ("select" in t) {
835
+ if (t.push === "outer") {
836
+ let e = this.findValue(n);
837
+ e && [
838
+ "single",
839
+ "multi",
840
+ "categories",
841
+ "interval"
842
+ ].includes(e.type) && (i = e);
843
+ }
844
+ if (i ??= g(t, this), !this.#n.has(n)) {
845
+ let e = this.#e.registerSelection(this.#t, n, i);
846
+ this.#o.set(n, e), this.#n.set(n, (t, r) => {
847
+ this.#u.get(n)?.beforeWrite(t, r?.intervalGesture), e.set(t), this.#e.flushNow();
848
+ }), r = this.#n.get(n);
1045
849
  }
1046
- n(r);
850
+ r(i);
1047
851
  }
1048
- return this.#i.set(t, e), this.#g(e), n;
1049
- }
1050
- allocateSetter(e, n, r = !1) {
1051
- if (t(e), this.#n.has(e)) throw Error("Setter already allocated for parameter: " + e);
1052
- let i = this.#e.registerBase(this.#t, e, n, { notify: !r });
1053
- this.#r.set(e, i);
1054
- let a = (e) => {
1055
- i.set(e), this.#e.flushNow();
852
+ return this.#s.set(n, t), this.#x(t), "select" in t && e(t.select).type === "interval" && this.getIntervalSelectionState(n).beforeWrite(this.findValue(n)), r;
853
+ }
854
+ allocateSetter(e, t, n = !1) {
855
+ if (h(e), this.#n.has(e)) throw Error("Setter already allocated for parameter: " + e);
856
+ let r = this.#e.registerBase(this.#t, e, t, { notify: !n });
857
+ this.#o.set(e, r);
858
+ let i = (t, n = {}) => {
859
+ if (this.#r.has(e)) throw Error("Cannot set output parameter \"" + e + "\".");
860
+ this.#u.get(e)?.beforeWrite(t, n?.intervalGesture), r.set(t), this.#e.flushNow();
1056
861
  };
1057
- return this.#n.set(e, a), a;
862
+ return this.#n.set(e, i), i;
1058
863
  }
1059
- setValue(e, n, r) {
1060
- t(e);
1061
- let i = this.#n.get(e);
1062
- if (!i) throw Error("Writable parameter not found in this scope: " + e);
1063
- i(n, r);
864
+ setValue(e, t, n) {
865
+ h(e);
866
+ let r = this.#n.get(e);
867
+ if (!r) throw Error("Writable parameter not found in this scope: " + e);
868
+ r(t, n);
1064
869
  }
1065
870
  getValue(e) {
1066
- return !this.#r.has(e) && this.hasLocalParam(e) && this.#e.resolve(this.#t, e), this.#r.get(e)?.get();
871
+ return !this.#o.has(e) && this.hasLocalParam(e) && this.#e.resolve(this.#t, e), this.#o.get(e)?.get();
1067
872
  }
1068
873
  getParamRef(e) {
1069
- t(e);
1070
- let n = this.findRuntimeForParam(e);
1071
- if (n) return n.#r.has(e) || n.#e.resolve(n.#t, e), n.#r.get(e);
874
+ h(e);
875
+ let t = this.findRuntimeForParam(e);
876
+ if (t) return t.#o.has(e) || t.#e.resolve(t.#t, e), t.#o.get(e);
1072
877
  }
1073
878
  getTargetValue(e) {
1074
- return t(e), this.#l.get(e)?.target ?? this.#u.get(e)?.target ?? this.getValue(e);
879
+ return h(e), this.#p.get(e)?.target ?? this.#m.get(e)?.target ?? this.getValue(e);
1075
880
  }
1076
881
  subscribe(e, t) {
1077
882
  let n = this.getParamRef(e);
@@ -1085,38 +890,53 @@ var Be = class {
1085
890
  return this.findRuntimeForParam(e)?.getTargetValue(e);
1086
891
  }
1087
892
  get paramConfigs() {
1088
- return this.#i;
893
+ return this.#s;
1089
894
  }
1090
895
  hasLocalParam(e) {
1091
- t(e);
1092
- let n = this.#i.get(e);
1093
- return this.#r.has(e) || this.#a.has(e) || n !== void 0 && "expr" in n;
896
+ h(e);
897
+ let t = this.#s.get(e);
898
+ return this.#o.has(e) || this.#c.has(e) || t !== void 0 && "expr" in t;
1094
899
  }
1095
900
  isPendingParam(e) {
1096
901
  let t = this.findRuntimeForParam(e);
1097
- return t !== void 0 && !t.#r.has(e);
902
+ return t !== void 0 && !t.#o.has(e);
1098
903
  }
1099
904
  hasConfiguredParamInScopeChain(e) {
1100
- return t(e), this.#i.has(e) ? !0 : this.#d()?.hasConfiguredParamInScopeChain(e) ?? !1;
905
+ return h(e), this.#s.has(e) ? !0 : this.#h()?.hasConfiguredParamInScopeChain(e) ?? !1;
1101
906
  }
1102
907
  findRuntimeForParam(e) {
1103
- return this.hasLocalParam(e) ? this : this.#d()?.findRuntimeForParam(e);
908
+ return this.hasLocalParam(e) ? this : this.#h()?.findRuntimeForParam(e);
1104
909
  }
1105
910
  findConfiguredParam(e) {
1106
- let t = this.#i.get(e);
911
+ let t = this.#s.get(e);
1107
912
  return t ? {
1108
913
  runtime: this,
1109
914
  config: t
1110
- } : this.#d()?.findConfiguredParam(e);
915
+ } : this.#h()?.findConfiguredParam(e);
916
+ }
917
+ getIntervalSelectionState(e) {
918
+ let t = this.findRuntimeForParam(e), n = t.#u.get(e);
919
+ if (!n) {
920
+ let r = t.#f.get(e)?.values().next().value;
921
+ n = new we(t, e, r?.components.find(s)), t.#u.set(e, n);
922
+ }
923
+ return n;
924
+ }
925
+ getComplexIntervals(e, t) {
926
+ let n = this.findRuntimeForParam(e).#f.get(e)?.values().next().value?.source;
927
+ return Object.fromEntries(Object.entries(t).map(([e, t]) => {
928
+ let r = n?.getScaleResolution(e);
929
+ return [e, t ? t.map((e) => r ? r.toComplex(e) : e) : null];
930
+ }));
1111
931
  }
1112
932
  registerSelectionController(e, t) {
1113
- let n = this.#o.get(e);
1114
- return n || (n = /* @__PURE__ */ new Set(), this.#o.set(e, n)), n.add(t), () => {
1115
- n.delete(t), n.size === 0 && this.#o.delete(e);
933
+ let n = this.#l.get(e);
934
+ return n || (n = /* @__PURE__ */ new Set(), this.#l.set(e, n)), n.add(t), () => {
935
+ n.delete(t), n.size === 0 && this.#l.delete(e);
1116
936
  };
1117
937
  }
1118
938
  getSelectionController(e) {
1119
- let t = this.#o.get(e);
939
+ let t = this.#l.get(e);
1120
940
  if (t) {
1121
941
  if (t.size > 1) throw Error(`Selection "${e}" has ambiguous interaction ownership.`);
1122
942
  return t.values().next().value;
@@ -1124,26 +944,29 @@ var Be = class {
1124
944
  }
1125
945
  getDebugState() {
1126
946
  let e = [];
1127
- for (let [t, n] of this.#r) {
1128
- let r = this.#i.get(t);
947
+ for (let [t, n] of this.#o) {
948
+ let r = this.#s.get(t);
1129
949
  e.push({
1130
950
  name: t,
1131
- kind: Ve(r),
951
+ kind: Me(r),
1132
952
  value: n.get(),
1133
953
  writable: this.#n.has(t),
1134
954
  configured: !!r,
1135
955
  config: r ? structuredClone(r) : void 0,
1136
- target: this.#l.get(t)?.target ?? this.#u.get(t)?.target
956
+ target: this.#p.get(t)?.target ?? this.#m.get(t)?.target
1137
957
  });
1138
958
  }
1139
959
  return {
1140
960
  scopeId: this.#t,
1141
- disposed: this.#h,
961
+ disposed: this.#b,
1142
962
  params: e
1143
963
  };
1144
964
  }
965
+ getSpecLocation(e, t) {
966
+ return te(e, this.#y, t);
967
+ }
1145
968
  createExpression(e) {
1146
- return this.#e.createExpression(this.#t, e, this.#_);
969
+ return this.#e.createExpression(this.#t, typeof e == "string" ? e : e.expr, this.#S(typeof e == "string" ? void 0 : e));
1147
970
  }
1148
971
  watchExpression(e, t, n = {}) {
1149
972
  let r = this.createExpression(e), i = r.subscribe(t);
@@ -1170,59 +993,51 @@ var Be = class {
1170
993
  cancelUpdate(e) {
1171
994
  this.#e.cancelUpdate(e);
1172
995
  }
1173
- #y(e, t) {
1174
- let n = this.#e.registerBase(this.#t, e, t);
1175
- this.#r.set(e, n);
1176
- let r = (e) => {
1177
- n.set(e), this.#e.flushNow();
1178
- };
1179
- return this.#n.set(e, r), r;
1180
- }
1181
- #b(e, t, n) {
1182
- let r = this.#C(e, t, n), i = (t, n) => {
1183
- this.#w(e, r, t, n);
996
+ #T(e, t, n) {
997
+ let r = this.#O(e, t, n), i = (t, n) => {
998
+ this.#k(e, r, t, n);
1184
999
  };
1185
1000
  return this.#n.set(e, i), i;
1186
1001
  }
1187
- #x(e, t, n) {
1188
- let r = this.createExpression(t), i = this.#C(e, r(null), n), a = r.subscribe(() => {
1189
- this.#w(e, i, r(null), { animate: !this.#m });
1002
+ #E(e, t, n) {
1003
+ let r = this.createExpression(t), i = this.#O(e, r(null), n), a = r.subscribe(() => {
1004
+ this.#k(e, i, r(null), { animate: !this.#v });
1190
1005
  });
1191
1006
  this.#e.addScopeDisposer(this.#t, a);
1192
1007
  }
1193
- #S(e, t, n) {
1008
+ #D(e, t, n) {
1194
1009
  let r = this.createExpression(t), i = r(null), a = this.#e.registerBase(this.#t, e, i);
1195
- this.#r.set(e, a);
1010
+ this.#o.set(e, a);
1196
1011
  let o = {
1197
1012
  target: i,
1198
1013
  timeout: void 0
1199
1014
  }, s = () => {
1200
1015
  o.timeout = void 0, a.set(o.target), this.#e.flushNow();
1201
1016
  }, c = r.subscribe(() => {
1202
- o.target = r(null), clearTimeout(o.timeout), o.timeout = void 0, o.target !== a.get() && (this.#m ? s() : o.timeout = setTimeout(s, n));
1017
+ o.target = r(null), clearTimeout(o.timeout), o.timeout = void 0, o.target !== a.get() && (this.#v ? s() : o.timeout = setTimeout(s, n));
1203
1018
  });
1204
- this.#u.set(e, o), this.#e.addScopeDisposer(this.#t, () => {
1205
- clearTimeout(o.timeout), c(), this.#u.delete(e);
1019
+ this.#m.set(e, o), this.#e.addScopeDisposer(this.#t, () => {
1020
+ clearTimeout(o.timeout), c(), this.#m.delete(e);
1206
1021
  });
1207
1022
  }
1208
- #C(e, t, n) {
1209
- let r = Ue(e, t), i = this.#e.registerBase(this.#t, e, r);
1210
- this.#r.set(e, i);
1211
- let a = this.#p;
1023
+ #O(e, t, n) {
1024
+ let r = Pe(e, t), i = this.#e.registerBase(this.#t, e, r);
1025
+ this.#o.set(e, i);
1026
+ let a = this.#_;
1212
1027
  if (!a) throw Error(`The parameter "${e}" uses transition but no animator is available.`);
1213
- let o = Re(a, ({ value: e }) => {
1028
+ let o = ke(a, ({ value: e }) => {
1214
1029
  i.set(e), this.#e.flushNow();
1215
1030
  }, n.halfLife ?? 80, n.epsilon ?? .01, { value: i.get() }), s = {
1216
1031
  target: i.get(),
1217
1032
  smoother: o,
1218
1033
  dispose: () => {
1219
- o.stop(), this.#l.delete(e);
1034
+ o.stop(), this.#p.delete(e);
1220
1035
  }
1221
1036
  };
1222
- return this.#l.set(e, s), this.#e.addScopeDisposer(this.#t, s.dispose), s;
1037
+ return this.#p.set(e, s), this.#e.addScopeDisposer(this.#t, s.dispose), s;
1223
1038
  }
1224
- #w(e, t, n, r = {}) {
1225
- let i = Ue(e, n);
1039
+ #k(e, t, n, r = {}) {
1040
+ let i = Pe(e, n);
1226
1041
  t.target = i, r.animate === !1 ? t.smoother.snap({ value: i }) : t.smoother({ value: i });
1227
1042
  }
1228
1043
  evaluateAndGet(e) {
@@ -1238,25 +1053,24 @@ var Be = class {
1238
1053
  return this.#e.whenPropagated(e);
1239
1054
  }
1240
1055
  finalizeInitialization() {
1241
- this.#m = !1;
1056
+ this.#v = !1;
1242
1057
  }
1243
1058
  dispose() {
1244
- this.#h || (this.#h = !0, this.#e.disposeScope(this.#t), this.#n.clear(), this.#r.clear(), this.#i.clear(), this.#a.clear(), this.#o.clear(), this.#l.clear(), this.#u.clear());
1245
- }
1246
- hasPointSelections() {
1247
- for (let e of this.#i.values()) if (ne(e)) {
1248
- let t = e.select;
1249
- if (te(t)) {
1250
- if (t == "point") return !0;
1251
- } else if (t.type == "point") return !0;
1059
+ if (!this.#b) {
1060
+ this.#b = !0;
1061
+ for (let e of this.#u.values()) e.dispose();
1062
+ this.#u.clear(), this.#e.disposeScope(this.#t), this.#n.clear(), this.#o.clear(), this.#r.clear(), this.#a.clear(), this.#s.clear(), this.#c.clear(), this.#l.clear(), this.#p.clear(), this.#m.clear();
1252
1063
  }
1064
+ }
1065
+ hasPointSelections({ inherited: e = !1, recordsOnly: t = !1, inputOnly: n = !1 } = {}) {
1066
+ for (let r = this; r; r = e ? r.#h() : void 0) for (let i of r.#s.values()) if (_(i) && (!n || re(i)) && (i.select === "point" || typeof i.select == "object" && i.select.type === "point") && (!t || typeof i.select == "string" || !("encodings" in i.select && i.select.encodings)) && (!e || this.findConfiguredParam(i.name).config === i)) return !0;
1253
1067
  return !1;
1254
1068
  }
1255
1069
  };
1256
- function Ve(e) {
1070
+ function Me(e) {
1257
1071
  return e ? e.push === "outer" ? "push" : "select" in e ? "selection" : "ruler" in e ? "ruler" : "expr" in e ? "derived" : "base" : "auto";
1258
1072
  }
1259
- function He(e) {
1073
+ function Ne(e) {
1260
1074
  let t = e.name;
1261
1075
  if ("value" in e && "expr" in e) throw Error(`The parameter "${t}" must not have both value and expr properties!`);
1262
1076
  if ("expr" in e && "bind" in e) throw Error(`The parameter "${t}" must not have both expr and bind properties!`);
@@ -1274,62 +1088,321 @@ function He(e) {
1274
1088
  if (n.halfLife != null && (!Number.isFinite(n.halfLife) || n.halfLife <= 0)) throw Error(`The transition halfLife for parameter "${t}" must be a positive finite number.`);
1275
1089
  if (n.epsilon != null && (!Number.isFinite(n.epsilon) || n.epsilon < 0)) throw Error(`The transition epsilon for parameter "${t}" must be a non-negative finite number.`);
1276
1090
  }
1277
- function Ue(e, t) {
1091
+ function Pe(e, t) {
1278
1092
  if (typeof t != "number" || !Number.isFinite(t)) throw Error(`Transitioned parameter "${e}" must have a finite numeric value.`);
1279
1093
  return t;
1280
1094
  }
1281
1095
  //#endregion
1096
+ //#region ../core/src/view/layout/flexLayout.js
1097
+ function Fe(e, t, n = {}) {
1098
+ let { sizes: r } = N(e, t, n.spacing || 0);
1099
+ return Ie(e, r, t, n);
1100
+ }
1101
+ function Ie(e, t, n, { spacing: r, devicePixelRatio: i, offset: a, reverse: o } = {}) {
1102
+ r ||= 0, a ||= 0;
1103
+ let s = 0, c = 0;
1104
+ for (let n = 0; n < e.length; n++) s += t[n], k(e[n]) || c++;
1105
+ let l = s + Math.max(0, c - 1) * r, u = i === void 0 ? (e) => e : (e) => Math.round(e * i) / i, d = 0, f = [], p = (e) => {
1106
+ let t = d;
1107
+ if (!t) return;
1108
+ let n = (e ? r : 0) * (o ? -1 : 1);
1109
+ m -= n;
1110
+ for (let e = 0; e < t; e++) f.push({
1111
+ location: m + (e + 1) / (t + 1) * n,
1112
+ size: 0
1113
+ });
1114
+ m += n, d = 0;
1115
+ }, m = o ? Math.max(n, l) : 0 + a;
1116
+ if (e.length == 1 && k(e[0])) return [{
1117
+ location: m,
1118
+ size: 0
1119
+ }];
1120
+ for (let n = 0; n < e.length; n++) {
1121
+ let i = e[n];
1122
+ if (k(i)) d++;
1123
+ else {
1124
+ p(f.length > 0);
1125
+ let e = t[n];
1126
+ o && (m -= e), f.push({
1127
+ location: u(m),
1128
+ size: u(e)
1129
+ }), o ? m -= r : m += e + r;
1130
+ }
1131
+ }
1132
+ return m += o ? r : -r, p(!1), f;
1133
+ }
1134
+ function Le(e, { spacing: t } = { spacing: 0 }) {
1135
+ let n = 0;
1136
+ for (let r of e) n += F(r) + (k(r) ? 0 : t);
1137
+ return Math.max(0, n - t);
1138
+ }
1139
+ function Re(e, t, { spacing: n = 0 } = {}) {
1140
+ let r = [], i = [], a = 0, o = 0;
1141
+ for (let [s, c] of e.entries()) {
1142
+ let e = F(c), l = !k(c), u = o && l ? n : 0;
1143
+ i.length && a + u + e > t && (r.push(i), i = [], a = 0, o = 0), i.push(s), a += (o && l ? n : 0) + e, o += +!!l;
1144
+ }
1145
+ return i.length && r.push(i), r;
1146
+ }
1147
+ function ze(e) {
1148
+ let t = 0, n = 0, r = 0, i, a = !0;
1149
+ for (let o of e) {
1150
+ t = Math.max(t, o.px ?? 0), n = Math.max(n, o.grow ?? 0), r = Math.max(r, F(o));
1151
+ let e = I(o);
1152
+ e === void 0 ? a = !1 : i = i === void 0 ? e : Math.max(i, e);
1153
+ }
1154
+ return R({
1155
+ px: t,
1156
+ grow: n,
1157
+ minPx: r,
1158
+ maxPx: a ? i : void 0
1159
+ });
1160
+ }
1161
+ function Be(e, t = 0, n = 0) {
1162
+ let r = Math.max(0, e.length - 1) * t, i = {
1163
+ px: r,
1164
+ grow: e.length ? 0 : n,
1165
+ minPx: r,
1166
+ maxPx: r
1167
+ }, a = e.length > 0;
1168
+ for (let t of e) {
1169
+ i.px += A(t.px), i.grow += A(t.grow), i.minPx += F(t);
1170
+ let e = I(t);
1171
+ e === void 0 ? a = !1 : i.maxPx += e;
1172
+ }
1173
+ return a || delete i.maxPx, R(i);
1174
+ }
1175
+ var D = class e {
1176
+ constructor(e, t) {
1177
+ this.width = e, this.height = t;
1178
+ }
1179
+ addPadding(e) {
1180
+ return this.#e(e.width, e.height);
1181
+ }
1182
+ subtractPadding(e) {
1183
+ return this.#e(-e.width, -e.height);
1184
+ }
1185
+ #e(t, n) {
1186
+ return new e(L(this.width, t), L(this.height, n));
1187
+ }
1188
+ isGrowing() {
1189
+ return !!(this.width.grow || this.height.grow);
1190
+ }
1191
+ }, Ve = Object.freeze({
1192
+ px: 0,
1193
+ grow: 0
1194
+ }), O = new D(Ve, Ve);
1195
+ function k(e) {
1196
+ return !e.px && !e.grow && !e.minPx;
1197
+ }
1198
+ function He(e, t) {
1199
+ return !e || !t ? !1 : e.px === t.px && e.grow === t.grow && e.minPx === t.minPx && e.maxPx === t.maxPx;
1200
+ }
1201
+ function A(e) {
1202
+ return e || 0;
1203
+ }
1204
+ function j(e) {
1205
+ return e && (b(e.px) || b(e.grow) || b(e.minPx) || b(e.maxPx));
1206
+ }
1207
+ function M(e) {
1208
+ if (J(e)) throw Error("parseSizeDef does not accept step-based sizes.");
1209
+ if (j(e)) return We(e), R(e);
1210
+ if (b(e)) return {
1211
+ px: e,
1212
+ grow: 0
1213
+ };
1214
+ if (e === "container" || !e) return {
1215
+ px: 0,
1216
+ grow: 1
1217
+ };
1218
+ throw Error(`Invalid sizeDef: ${e}`);
1219
+ }
1220
+ function N(e, t, n = 0) {
1221
+ let r = !1;
1222
+ for (let t of e) We(t), r ||= Ge(t);
1223
+ if (!r) return Ue(e, t, n);
1224
+ let i = Array(e.length).fill(0), a = [];
1225
+ for (let t = 0; t < e.length; t++) k(e[t]) || a.push(t);
1226
+ let o = Math.max(0, a.length - 1) * n, s = Math.max(0, t - o), c = /* @__PURE__ */ new Set();
1227
+ for (let t of a) {
1228
+ let n = e[t];
1229
+ A(n.grow) || (i[t] = P(A(n.px), n), c.add(t));
1230
+ }
1231
+ let l = 0;
1232
+ for (;;) {
1233
+ let t = 0, n = 0, r = 0;
1234
+ for (let o of a) c.has(o) ? r += i[o] : (t += A(e[o].px), n += A(e[o].grow));
1235
+ if (!n) {
1236
+ for (let t of a) c.has(t) || (i[t] = P(A(e[t].px), e[t]), c.add(t));
1237
+ break;
1238
+ }
1239
+ let o = Math.max(0, s - r - t);
1240
+ l = o / n;
1241
+ let u = 0, d = [], f = [];
1242
+ for (let t of a) {
1243
+ if (c.has(t)) continue;
1244
+ let r = e[t], a = A(r.px) + A(r.grow) / n * o, s = P(a, r);
1245
+ i[t] = s;
1246
+ let l = s - a;
1247
+ u += l, l > 0 ? d.push(t) : l < 0 && f.push(t);
1248
+ }
1249
+ if (!d.length && !f.length) break;
1250
+ if (u > 0) for (let e of d) c.add(e);
1251
+ else if (u < 0) for (let e of f) c.add(e);
1252
+ else for (let e of a) c.add(e);
1253
+ }
1254
+ return {
1255
+ sizes: i,
1256
+ growth: l
1257
+ };
1258
+ }
1259
+ function Ue(e, t, n) {
1260
+ let r = 0, i = 0;
1261
+ for (let t of e) r += A(t.px) + (k(t) ? 0 : n), i += A(t.grow);
1262
+ r -= n;
1263
+ let a = Math.max(0, t - r), o = Array(e.length);
1264
+ for (let t = 0; t < e.length; t++) {
1265
+ let n = e[t];
1266
+ o[t] = k(n) ? 0 : A(n.px) + (i ? A(n.grow) / i * a : 0);
1267
+ }
1268
+ return {
1269
+ sizes: o,
1270
+ growth: i ? a / i : 0
1271
+ };
1272
+ }
1273
+ function We(e) {
1274
+ if (e.minPx !== void 0 && e.maxPx !== void 0 && e.minPx > e.maxPx) throw Error("SizeDef minPx cannot be greater than maxPx.");
1275
+ }
1276
+ function P(e, t) {
1277
+ return Math.min(Math.max(e, t.minPx ?? 0), t.maxPx ?? Infinity);
1278
+ }
1279
+ function F(e) {
1280
+ return P(A(e.px), e);
1281
+ }
1282
+ function I(e) {
1283
+ return e.maxPx ?? (A(e.grow) ? void 0 : F(e));
1284
+ }
1285
+ function Ge(e) {
1286
+ return e.minPx !== void 0 || e.maxPx !== void 0;
1287
+ }
1288
+ function L(e, t) {
1289
+ return R({
1290
+ px: (e.px ?? 0) + t,
1291
+ grow: e.grow,
1292
+ minPx: e.minPx === void 0 ? void 0 : Math.max(0, e.minPx + t),
1293
+ maxPx: e.maxPx === void 0 ? void 0 : Math.max(0, e.maxPx + t)
1294
+ });
1295
+ }
1296
+ function R(e) {
1297
+ let t = {}, n = e.px !== void 0, r = e.grow !== void 0, i = Ge(e);
1298
+ return e.px ? t.px = e.px : e.px === 0 && (t.px = 0), e.grow ? t.grow = e.grow : e.grow === 0 ? t.grow = 0 : !n && !r && i && (t.grow = 1), e.minPx && e.minPx > A(e.px) && (t.minPx = e.minPx), e.maxPx !== void 0 && (A(t.grow) || e.maxPx < A(e.px)) && (t.maxPx = e.maxPx), t;
1299
+ }
1300
+ //#endregion
1301
+ //#region ../core/src/view/layout/padding.js
1302
+ var z = class e {
1303
+ constructor(e, t, n, r) {
1304
+ this.top = e || 0, this.right = t || 0, this.bottom = n || 0, this.left = r || 0;
1305
+ }
1306
+ get width() {
1307
+ return this.left + this.right;
1308
+ }
1309
+ get height() {
1310
+ return this.top + this.bottom;
1311
+ }
1312
+ expand(t) {
1313
+ return t <= 0 ? this : new e(this.top + t, this.right + t, this.bottom + t, this.left + t);
1314
+ }
1315
+ add(t) {
1316
+ return new e(this.top + t.top, this.right + t.right, this.bottom + t.bottom, this.left + t.left);
1317
+ }
1318
+ subtract(t) {
1319
+ return new e(this.top - t.top, this.right - t.right, this.bottom - t.bottom, this.left - t.left);
1320
+ }
1321
+ union(t) {
1322
+ return new e(Math.max(this.top, t.top), Math.max(this.right, t.right), Math.max(this.bottom, t.bottom), Math.max(this.left, t.left));
1323
+ }
1324
+ getHorizontal() {
1325
+ return new e(0, this.right, 0, this.left);
1326
+ }
1327
+ getVertical() {
1328
+ return new e(this.top, 0, this.bottom, 0);
1329
+ }
1330
+ get horizontalTotal() {
1331
+ return this.left + this.right;
1332
+ }
1333
+ get verticalTotal() {
1334
+ return this.top + this.bottom;
1335
+ }
1336
+ static createFromConfig(e) {
1337
+ return typeof e == "number" ? this.createUniformPadding(e) : e ? this.createFromRecord(e) : B;
1338
+ }
1339
+ static createFromRecord(t) {
1340
+ return new e(t.top, t.right, t.bottom, t.left);
1341
+ }
1342
+ static zero() {
1343
+ return B;
1344
+ }
1345
+ static createUniformPadding(t) {
1346
+ return new e(t, t, t, t);
1347
+ }
1348
+ };
1349
+ function Ke(e, t, n = z.zero()) {
1350
+ return t ? new z(t.top === !1 ? n.top : e.top, t.right === !1 ? n.right : e.right, t.bottom === !1 ? n.bottom : e.bottom, t.left === !1 ? n.left : e.left) : e;
1351
+ }
1352
+ var B = z.createUniformPadding(0);
1353
+ Object.freeze(B);
1354
+ //#endregion
1282
1355
  //#region ../core/src/utils/addBaseUrl.js
1283
- function We(e, t) {
1356
+ function qe(e, t) {
1284
1357
  return !t || /^(data:|([A-Za-z]+:)?\/\/)/.test(e) || e.startsWith("/") ? e : (t.endsWith("/") || (t += "/"), t + e);
1285
1358
  }
1286
- function Ge(e) {
1359
+ function Je(e) {
1287
1360
  if (!e) return e;
1288
1361
  if (/[?#]/.test(e)) throw Error(`Invalid base URL: ${e} - cannot contain query or hash.`);
1289
1362
  return e.endsWith("/") ? e : e + "/";
1290
1363
  }
1291
1364
  //#endregion
1292
1365
  //#region ../core/src/config/mergeConfig.js
1293
- function L(e) {
1294
- return d(e) && !Array.isArray(e);
1366
+ function V(e) {
1367
+ return r(e) && !Array.isArray(e) && !("expr" in e && typeof e.expr == "string");
1295
1368
  }
1296
- function Ke(e) {
1369
+ function Ye(e) {
1297
1370
  let t = {};
1298
- for (let [n, r] of Object.entries(e)) t[n] = R(r);
1371
+ for (let [n, r] of Object.entries(e)) t[n] = H(r);
1299
1372
  return t;
1300
1373
  }
1301
- function R(e) {
1302
- return Array.isArray(e) ? e.map(R) : L(e) ? Ke(e) : e;
1374
+ function H(e) {
1375
+ return Array.isArray(e) ? e.map(H) : V(e) ? Ye(e) : e;
1303
1376
  }
1304
- function z(e, t) {
1377
+ function Xe(e, t) {
1305
1378
  for (let [n, r] of Object.entries(t)) {
1306
1379
  if (r === void 0) continue;
1307
1380
  let t = e[n];
1308
- L(r) && L(t) ? z(t, r) : e[n] = R(r);
1381
+ V(r) && V(t) ? Xe(t, r) : e[n] = H(r);
1309
1382
  }
1310
1383
  return e;
1311
1384
  }
1312
- function B(e) {
1385
+ function Ze(e) {
1313
1386
  let t = {};
1314
- for (let n of e) n && z(t, n);
1387
+ for (let n of e) n && Xe(t, n);
1315
1388
  return t;
1316
1389
  }
1317
1390
  //#endregion
1318
1391
  //#region ../core/src/view/viewChrome.js
1319
- var V = /* @__PURE__ */ new WeakMap();
1320
- function qe(e, t) {
1321
- V.set(e, t);
1392
+ var U = /* @__PURE__ */ new WeakMap();
1393
+ function Qe(e, t) {
1394
+ U.set(e, t);
1322
1395
  }
1323
- function Je(e) {
1324
- return V.get(e);
1396
+ function $e(e) {
1397
+ return U.get(e);
1325
1398
  }
1326
- function H(e) {
1327
- return V.has(e);
1399
+ function W(e) {
1400
+ return U.has(e);
1328
1401
  }
1329
- function U(e) {
1402
+ function et(e) {
1330
1403
  let t = e;
1331
1404
  for (; t;) {
1332
- let n = V.get(t);
1405
+ let n = U.get(t);
1333
1406
  if (n === "excludeSubtree" || t === e && n === "exclude") return !0;
1334
1407
  t = t.layoutParent;
1335
1408
  }
@@ -1337,16 +1410,34 @@ function U(e) {
1337
1410
  }
1338
1411
  //#endregion
1339
1412
  //#region ../core/src/view/postScaleParams.js
1340
- var W = /* @__PURE__ */ new WeakMap();
1341
- function Ye(e, t) {
1342
- W.set(e, t);
1413
+ var tt = /* @__PURE__ */ new WeakMap();
1414
+ function nt(e, t) {
1415
+ tt.set(e, t);
1343
1416
  }
1344
- function Xe(e) {
1345
- return W.get(e);
1417
+ function rt(e) {
1418
+ return tt.get(e);
1419
+ }
1420
+ //#endregion
1421
+ //#region ../core/src/view/transformOutputDeclarations.js
1422
+ function* it(e) {
1423
+ for (let t of e) t.type === "values" ? yield {
1424
+ transform: t,
1425
+ property: "param",
1426
+ param: t.param
1427
+ } : t.type === "dendrogram" && t.domainParam !== void 0 ? yield {
1428
+ transform: t,
1429
+ property: "domainParam",
1430
+ param: t.domainParam
1431
+ } : t.type === "branch" && (yield* it(t.transform));
1432
+ }
1433
+ function at(e) {
1434
+ e.visit((e) => {
1435
+ e.paramRuntime.finalizeOutputDeclarations();
1436
+ });
1346
1437
  }
1347
1438
  //#endregion
1348
1439
  //#region ../core/src/data/namedDataScope.js
1349
- var Ze = class {
1440
+ var ot = class {
1350
1441
  name;
1351
1442
  owner;
1352
1443
  getDefaultData;
@@ -1384,13 +1475,13 @@ var Ze = class {
1384
1475
  dispose() {
1385
1476
  this.#e = void 0, this.#t = !1, this.#n++, this.#r = !0;
1386
1477
  }
1387
- }, Qe = class {
1478
+ }, st = class {
1388
1479
  view;
1389
1480
  #e = /* @__PURE__ */ new Map();
1390
1481
  #t = /* @__PURE__ */ new Map();
1391
1482
  constructor(e) {
1392
1483
  this.view = e;
1393
- for (let [t, n] of Object.entries(e.spec.datasets ?? {})) this.#e.set(t, new Ze(t, e, () => n));
1484
+ for (let [t, n] of Object.entries(e.spec.datasets ?? {})) this.#e.set(t, new ot(t, e, () => n));
1394
1485
  }
1395
1486
  getLocalBinding(e) {
1396
1487
  return this.#e.get(e);
@@ -1404,7 +1495,7 @@ var Ze = class {
1404
1495
  let n = this.view.dataParent?.namedDataScope;
1405
1496
  if (n) return n.resolve(e);
1406
1497
  let r = this.#t.get(e);
1407
- return r || (r = new Ze(e, void 0, () => this.view.context.getNamedDataFromProvider(e)), this.#t.set(e, r)), r;
1498
+ return r || (r = new ot(e, void 0, () => this.view.context.getNamedDataFromProvider(e)), this.#t.set(e, r)), r;
1408
1499
  }
1409
1500
  dispose() {
1410
1501
  for (let e of this.#e.values()) e.dispose();
@@ -1412,9 +1503,10 @@ var Ze = class {
1412
1503
  for (let e of this.#t.values()) e.dispose();
1413
1504
  this.#t.clear();
1414
1505
  }
1415
- }, G = "VISIT_SKIP", K = "VISIT_STOP", q = (e) => e, $e = class {
1506
+ }, G = "VISIT_SKIP", K = "VISIT_STOP", q = (e) => e, ct = class {
1416
1507
  spec;
1417
1508
  namedDataScope;
1509
+ flowOutputs = /* @__PURE__ */ new Set();
1418
1510
  #e;
1419
1511
  #t;
1420
1512
  #n = {};
@@ -1431,30 +1523,41 @@ var Ze = class {
1431
1523
  #f = [];
1432
1524
  #p = "none";
1433
1525
  #m = /* @__PURE__ */ new Map();
1434
- facetCoords = new e([], JSON.stringify);
1526
+ facetCoords = new n([], JSON.stringify);
1527
+ layoutCoords;
1435
1528
  constructor(e, t, n, r, i, a = {}) {
1436
1529
  if (!e) throw Error("View spec must be defined!");
1437
- if (this.context = t, this.layoutParent = n, this.dataParent = r, this.#t = i, this.spec = e, this.namedDataScope = new Qe(this), r && e.theme !== void 0) throw Error("\"theme\" is only supported at the root specification. Use \"config\" and \"style\" for subtree customization.");
1438
- let o = r ? r.getConfigScopes() : [t.getBaseConfig()], s = e.config;
1439
- this.#e = [...o, s].filter((e) => !!e), this.resolutions = {
1530
+ if (this.context = t, this.layoutParent = n, this.dataParent = r, a.chrome && Qe(this, "excludeSubtree"), this.#t = i, this.spec = e, this.namedDataScope = new st(this), r && e.theme !== void 0) throw Error("\"theme\" is only supported at the root specification. Use \"config\" and \"style\" for subtree customization.");
1531
+ let s = r ? r.getConfigScopes() : [t.getBaseConfig()], c = e.config;
1532
+ this.#e = [...s, c].filter((e) => !!e), this.resolutions = {
1440
1533
  scale: {},
1441
1534
  axis: {},
1442
1535
  legend: {}
1443
- }, ie(this), this.options = {
1536
+ }, de(this), this.options = {
1444
1537
  inheritEncoding: !1,
1445
1538
  layoutSizeParams: "own",
1446
1539
  ...a
1447
1540
  }, this.flowHandle = void 0, this.needsAxes = {
1448
1541
  x: !1,
1449
1542
  y: !1
1450
- }, this.paramRuntime = new Be(() => this.dataParent?.paramRuntime, (e) => this.getScaleResolution(e), t.animator, {
1543
+ }, this.paramRuntime = new je(() => this.dataParent?.paramRuntime, (e) => this.getScaleResolution(e), t.animator, {
1451
1544
  settleTemporalUpdatesImmediately: !0,
1452
- onError: t.reportError
1453
- }), this.paramRuntime.setSelectionSource(this), "mark" in e && this.paramRuntime.registerLazyExpression("zoomLevel", "zoomLevel()", () => se("The automatic zoomLevel parameter is deprecated. Use zoomLevel() or an explicit channel such as zoomLevel(\"x\") instead."));
1454
- let l = [...e.params ?? [], ...Xe(e) ?? []];
1545
+ onError: t.reportError,
1546
+ getSpecOrigin: t.getSpecOrigin
1547
+ }), this.paramRuntime.setSelectionSource(this), "mark" in e && this.paramRuntime.registerLazyExpression("zoomLevel", "zoomLevel()", () => fe("The automatic zoomLevel parameter is deprecated. Use zoomLevel() or an explicit channel such as zoomLevel(\"x\") instead."));
1548
+ for (let { transform: t, property: n, param: r } of it(e.transform ?? [])) try {
1549
+ typeof r == "string" && this.paramRuntime.registerOutput(r);
1550
+ let e = this.paramRuntime.resolveOutput(r);
1551
+ if (e.producerView) throw Error("Duplicate transform output producer.");
1552
+ e.producerView = this, this.flowOutputs.add(e);
1553
+ } catch (e) {
1554
+ throw o(e, this.paramRuntime.getSpecLocation(t, [n]));
1555
+ }
1556
+ let l = [...e.params ?? [], ...rt(e) ?? []];
1557
+ this.options.layoutSizeParams !== "inherit" && (l.some((e) => e.name === "width") || (this.#a = this.#h("width")), l.some((e) => e.name === "height") || (this.#o = this.#h("height")));
1455
1558
  for (let e of l) {
1456
1559
  if ("expr" in e) {
1457
- let { usesScaleHelper: t, globals: n } = c(e.expr), r = n.some((e) => this.paramRuntime.isPendingParam(e));
1560
+ let { usesScaleHelper: t, globals: n } = f(e.expr, this.paramRuntime.getSpecLocation(e, ["expr"])), r = n.some((e) => this.paramRuntime.isPendingParam(e));
1458
1561
  if (t || r) {
1459
1562
  this.paramRuntime.registerParam(e, { defer: !0 }), this.#d.push(e.name);
1460
1563
  continue;
@@ -1462,7 +1565,6 @@ var Ze = class {
1462
1565
  }
1463
1566
  this.paramRuntime.registerParam(e);
1464
1567
  }
1465
- this.options.layoutSizeParams !== "inherit" && (this.#a = this.#h("width"), this.#o = this.#h("height"));
1466
1568
  }
1467
1569
  #h(e) {
1468
1570
  if (!(this.paramRuntime.hasLocalParam(e) || this.options.layoutSizeParams != "force" && this.paramRuntime.hasConfiguredParamInScopeChain(e))) return this.paramRuntime.allocateSetter(e, 0);
@@ -1480,18 +1582,18 @@ var Ze = class {
1480
1582
  return this.#t;
1481
1583
  }
1482
1584
  getConfig() {
1483
- return B(this.#e);
1585
+ return Ze(this.#e);
1484
1586
  }
1485
1587
  getCursorSpec() {
1486
1588
  return this.spec.cursor;
1487
1589
  }
1488
1590
  getCursor() {
1489
1591
  let e = this.getCursorSpec();
1490
- return n(e) ? this.paramRuntime.evaluateAndGet(e.expr) : e;
1592
+ return y(e) ? this.paramRuntime.evaluateAndGet(e) : e;
1491
1593
  }
1492
1594
  watchCursor(e, t) {
1493
- let r = this.getCursorSpec();
1494
- n(r) && this.paramRuntime.watchExpression(r.expr, e, {
1595
+ let n = this.getCursorSpec();
1596
+ y(n) && this.paramRuntime.watchExpression(n, e, {
1495
1597
  scopeOwned: !1,
1496
1598
  registerDisposer: t
1497
1599
  });
@@ -1503,45 +1605,77 @@ var Ze = class {
1503
1605
  return this.facetCoords.values().next().value;
1504
1606
  }
1505
1607
  getPadding() {
1506
- return this._cache("size/padding", () => k.createFromConfig(this.spec.padding));
1608
+ return this._cache("size/padding", () => z.createFromConfig(this.spec.padding));
1507
1609
  }
1508
1610
  getOverhang() {
1509
- return k.zero();
1611
+ return z.zero();
1612
+ }
1613
+ getStructuralOverhang() {
1614
+ return z.zero();
1615
+ }
1616
+ getStructuralSizeDefs(e) {
1617
+ let t = this.getStructuralOverhang();
1618
+ return {
1619
+ before: { px: t[e === "x" ? "left" : "top"] },
1620
+ after: { px: t[e === "x" ? "right" : "bottom"] }
1621
+ };
1622
+ }
1623
+ getAlignment(e) {
1624
+ let t = e === "x" ? "width" : "height";
1625
+ return {
1626
+ size: this.getViewportSize().subtractPadding(this.getOverhang())[t],
1627
+ before: 0,
1628
+ after: 0
1629
+ };
1630
+ }
1631
+ getAlignmentCoords(e) {
1632
+ return this.coords.shrink(this.getOverhang());
1633
+ }
1634
+ getLayoutFootprints() {
1635
+ return [{
1636
+ view: this,
1637
+ coords: this.coords.shrink(this.getOverhang()),
1638
+ chrome: !1
1639
+ }];
1510
1640
  }
1511
1641
  isScrollable() {
1512
1642
  return this.spec.viewportWidth != null || this.spec.viewportHeight != null;
1513
1643
  }
1514
1644
  getSize() {
1515
- return this._cache("size/size", () => this.isConfiguredVisible() ? new y(this.#g("width"), this.#g("height")) : x);
1645
+ return this._cache("size/size", () => this.isConfiguredVisible() ? new D(this.#g("width"), this.#g("height")) : O);
1516
1646
  }
1517
1647
  getViewportSize() {
1518
1648
  if (!this.isScrollable()) return this.getSize();
1519
- if (!this.isConfiguredVisible()) return x;
1649
+ if (!this.isConfiguredVisible()) return O;
1520
1650
  let e = this.getSize();
1521
- return new y(this.#g("viewportWidth") ?? e.width, this.#g("viewportHeight") ?? e.height);
1651
+ return new D(this.#g("viewportWidth") ?? e.width, this.#g("viewportHeight") ?? e.height);
1652
+ }
1653
+ getViewportAnchor(e) {
1654
+ let t = this.spec[e];
1655
+ if (!t || typeof t != "object" || !("anchor" in t)) return "start";
1656
+ if (e !== "viewportWidth" && e !== "viewportHeight") throw new C("Anchors are supported only on viewport sizes.", this);
1657
+ if (!j(t) && !y(t)) throw new C("An anchored viewport must define a size.", this);
1658
+ let n = t.anchor === void 0 ? "start" : t.anchor;
1659
+ if (n !== "start" && n !== "end") throw new C("Viewport anchor must be \"start\" or \"end\".", this);
1660
+ return n;
1522
1661
  }
1523
1662
  #g(e) {
1524
1663
  let { value: t, implicit: n } = this.#_(e), r = this.resolveSizeValue(e, t), i = J(r), a = e == "viewportWidth" || e == "viewportHeight";
1525
1664
  if (i) {
1526
- if (a) throw new _(`Cannot use step-based size with "${e}"!`, this);
1665
+ if (a) throw new C(`Cannot use step-based size with "${e}"!`, this);
1527
1666
  let t = this.#x(e, r), i = this.getScaleResolution(e == "width" ? "x" : "y")?.getScale();
1528
1667
  if (i) {
1529
- let n;
1530
- if (v(i.type)) n = i.domain().length;
1531
- else if (["locus", "index"].includes(i.type)) {
1532
- let e = i.domain();
1533
- n = ee(e) - e[0];
1534
- } else throw new _(`Cannot use step-based size with "${i.type}" scale!`, this);
1535
- let a = i;
1536
- n = oe(n, a.paddingInner(), a.paddingOuter());
1537
- let o = e == "width" ? "xOffset" : "yOffset", s = this.getScaleResolution(o)?.getScale(), c = r.for ?? (s && v(s.type) ? "offset" : "position"), l = t;
1538
- if (c == "offset") {
1539
- if (!s || !v(s.type)) throw new _(`Cannot use ${e}.step.for = "offset" without a discrete ${o} scale!`, this);
1540
- let t = s, n = oe(s.domain().length, t.paddingInner(), t.paddingOuter());
1541
- l *= n / (1 - a.paddingInner());
1668
+ if (!("sizeForStep" in i)) throw new C(`Cannot use step-based size with "${i.type}" scale!`, this);
1669
+ let n = e == "width" ? "xOffset" : "yOffset", a = this.getScaleResolution(n)?.getScale(), o = r.for ?? (a && x(a.type) ? "offset" : "position"), s = t;
1670
+ if (o == "offset") {
1671
+ let t = i.paddingInner?.() ?? 1;
1672
+ if (t === 1) throw new C("Offset-step sizing requires a primary scale with nonzero bandwidth.", this);
1673
+ if (!a || !x(a.type)) throw new C(`Cannot use ${e}.step.for = "offset" without a discrete ${n} scale!`, this);
1674
+ let r = a, o = ee(a.domain().length, a.type === "point" ? 1 : r.paddingInner(), r.paddingOuter());
1675
+ s *= o / (1 - t);
1542
1676
  }
1543
1677
  return {
1544
- px: n * l,
1678
+ px: i.sizeForStep(s),
1545
1679
  grow: 0
1546
1680
  };
1547
1681
  }
@@ -1549,9 +1683,9 @@ var Ze = class {
1549
1683
  px: t,
1550
1684
  grow: 0
1551
1685
  };
1552
- throw new _(`Cannot use step-based size with "${e}"!`, this);
1686
+ throw new C(`Cannot use step-based size with "${e}"!`, this);
1553
1687
  }
1554
- return (r && he(r)) ?? (a ? void 0 : {
1688
+ return (r && M(r)) ?? (a ? void 0 : {
1555
1689
  px: 0,
1556
1690
  grow: 1
1557
1691
  });
@@ -1567,20 +1701,23 @@ var Ze = class {
1567
1701
  };
1568
1702
  }
1569
1703
  #v(e) {
1570
- if (U(this)) return;
1704
+ if (et(this)) return;
1571
1705
  let t = this.getConfig().view;
1572
1706
  if (!t) return;
1573
1707
  let n = e == "width" ? "x" : "y", r = this.getScaleResolution(n)?.getResolvedScaleType();
1574
- return r && !v(r) ? e == "width" ? t.continuousWidth : t.continuousHeight : (e == "width" ? t.discreteWidth : t.discreteHeight) ?? (t.step === void 0 ? void 0 : { step: t.step });
1708
+ return r && !x(r) ? e == "width" ? t.continuousWidth : t.continuousHeight : (e == "width" ? t.discreteWidth : t.discreteHeight) ?? (t.step === void 0 ? void 0 : { step: t.step });
1575
1709
  }
1576
1710
  resolveSizeValue(e, t) {
1577
- if (!n(t)) return t;
1578
- let r = this.#C(e)();
1579
- if (it(r) || r === "container") return r;
1580
- throw new _(`"${e}" ExprRef must resolve to a finite number or "container"!`, this);
1711
+ if (this.getViewportAnchor(e), !y(t)) return t;
1712
+ let n = this.#C(e)();
1713
+ if (pt(n) || n === "container") return n;
1714
+ throw new C(`"${e}" ExprRef must resolve to a finite number or "container"!`, this);
1581
1715
  }
1582
1716
  registerSizeInvalidation() {
1583
- this.#y("width", "x"), this.#y("height", "y"), this.#b("width"), this.#b("height"), this.#b("viewportWidth"), this.#b("viewportHeight");
1717
+ this.#b("width"), this.#b("height"), this.#b("viewportWidth"), this.#b("viewportHeight");
1718
+ }
1719
+ isStepSized(e) {
1720
+ return J(this.#_(e).value);
1584
1721
  }
1585
1722
  #y(e, t) {
1586
1723
  let { value: n, implicit: r } = this.#_(e);
@@ -1588,27 +1725,27 @@ var Ze = class {
1588
1725
  let i = this.getScaleResolution(t);
1589
1726
  if (!i) {
1590
1727
  if (r) return;
1591
- throw new _("Cannot use 'step' size without a scale!", this);
1728
+ throw new C("Cannot use 'step' size without a scale!", this);
1592
1729
  }
1593
1730
  let a = () => {
1594
1731
  let t = this.getSize()[e];
1595
1732
  this.invalidateSizeCache();
1596
1733
  let n = this.getSize()[e];
1597
- pe(t, n) || this.context.requestLayoutReflow();
1734
+ He(t, n) || this.context.requestLayoutReflow();
1598
1735
  };
1599
- if (i.addEventListener("domain", a), this.registerDisposer(() => i.removeEventListener("domain", a)), n.for != "position") {
1736
+ if (this.registerDisposer(i.observeMapping(a)), n.for != "position") {
1600
1737
  let t = e == "width" ? "xOffset" : "yOffset", n = this.getScaleResolution(t);
1601
- n && v(n.getResolvedScaleType()) && (n.addEventListener("domain", a), this.registerDisposer(() => n.removeEventListener("domain", a)));
1738
+ n && x(n.getResolvedScaleType()) && this.registerDisposer(n.observeMapping(a));
1602
1739
  }
1603
1740
  }
1604
1741
  #b(e) {
1605
1742
  let { value: t } = this.#_(e);
1606
- n(t) ? this.#S(e, t.expr) : J(t) && n(t.step) && this.#S(e + ".step", t.step.expr);
1743
+ y(t) ? this.#S(e, t) : J(t) && y(t.step) && this.#S(e + ".step", t.step);
1607
1744
  }
1608
1745
  #x(e, t) {
1609
- let r = n(t.step) ? this.#C(e + ".step")() : t.step;
1610
- if (it(r)) return r;
1611
- throw new _(`"${e}.step" ExprRef must resolve to a finite number!`, this);
1746
+ let n = y(t.step) ? this.#C(e + ".step")() : t.step;
1747
+ if (pt(n)) return n;
1748
+ throw new C(`"${e}.step" ExprRef must resolve to a finite number!`, this);
1612
1749
  }
1613
1750
  #S(e, t) {
1614
1751
  if (!this.#m.has(e)) {
@@ -1620,7 +1757,7 @@ var Ze = class {
1620
1757
  }
1621
1758
  #C(e) {
1622
1759
  let t = this.#m.get(e);
1623
- if (!t) throw new _(`"${e}" ExprRef was not registered before layout!`, this);
1760
+ if (!t) throw new C(`"${e}" ExprRef was not registered before layout!`, this);
1624
1761
  return t;
1625
1762
  }
1626
1763
  isConfiguredVisible() {
@@ -1684,7 +1821,7 @@ var Ze = class {
1684
1821
  };
1685
1822
  }
1686
1823
  handleInteraction(e, t) {
1687
- t && e.type === "mousemove" && e.pointedViews.add(this);
1824
+ t && e.type === "mousemove" && e.pointedViews.set(this, e.facetId);
1688
1825
  let n = t ? this.#r : this.#i;
1689
1826
  for (let t of n[e.type] || []) t(e);
1690
1827
  }
@@ -1717,23 +1854,33 @@ var Ze = class {
1717
1854
  for (let e of this.#f) e();
1718
1855
  this.#f.length = 0;
1719
1856
  let e = this.flowHandle;
1720
- e?.collector && (this.context.dataFlow.pruneCollectorBranch(e.collector), this.context.dataFlow.removeCollector(e.collector)), e?.dataSource && e.dataSource.view === this && !e.dataSource.shareKey && this.context.dataFlow.removeDataSource(e.dataSource), this.paramRuntime.dispose(), this.namedDataScope.dispose(), this.context.dataFlow.loadingStatusRegistry.delete(this), this.flowHandle = void 0;
1857
+ for (let t of e?.terminals ?? []) t.children.length === 0 && this.context.dataFlow.pruneBranch(t);
1858
+ e?.collector && (this.context.dataFlow.pruneBranch(e.collector), this.context.dataFlow.removeCollector(e.collector)), e?.dataSource && e.dataSource.view === this && !e.dataSource.shareKey && this.context.dataFlow.removeDataSource(e.dataSource), this.paramRuntime.dispose(), this.namedDataScope.dispose();
1859
+ for (let e of this.flowOutputs) e.producerView = void 0;
1860
+ this.flowOutputs.clear(), this.flowHandle = void 0, this.context.dataFlow.loadingStatusRegistry.delete(this);
1721
1861
  }
1722
1862
  registerDisposer(e) {
1723
1863
  this.#f.push(e);
1724
1864
  }
1725
- disposeSubtree() {
1726
- let e = (e) => {
1865
+ assertCanDisposeSubtree() {
1866
+ let e = new Set(this.getDescendants());
1867
+ for (let t of e) for (let n of t.flowOutputs) if (n.owner && !e.has(n.owner)) throw Error("Cannot remove a shared output producer while its owner survives.");
1868
+ }
1869
+ disposeSubtree({ checkDependencies: e = !0 } = {}) {
1870
+ e && this.assertCanDisposeSubtree();
1871
+ let t = (e) => {
1727
1872
  for (let t of Object.values(e.resolutions.scale)) t.dispose();
1728
1873
  };
1729
- e.postOrder = (e) => {
1874
+ t.postOrder = (e) => {
1730
1875
  e.dispose();
1731
- }, this.visit(e);
1876
+ }, this.visit(t);
1732
1877
  }
1733
1878
  configurePostScaleParams() {
1879
+ if (this.#u) return;
1880
+ this.#u = !0, this.#y("width", "x"), this.#y("height", "y");
1734
1881
  let e = this.#d;
1735
- if (e.length && !this.#u) {
1736
- this.#u = !0, this.#l = !1;
1882
+ if (e.length) {
1883
+ this.#l = !1;
1737
1884
  for (let t of e) this.paramRuntime.getValue(t);
1738
1885
  this.registerDisposer(this._addBroadcastHandler("subtreeDataReady", () => {
1739
1886
  this.#l = !0, this.#T();
@@ -1741,7 +1888,7 @@ var Ze = class {
1741
1888
  }
1742
1889
  }
1743
1890
  configureViewOpacity() {
1744
- (!this.opacityFunction || this.opacityFunction === q) && (this.opacityFunction = tt(this));
1891
+ (!this.opacityFunction || this.opacityFunction === q) && (this.opacityFunction = ut(this));
1745
1892
  }
1746
1893
  finalizeParamRuntimeInitialization() {
1747
1894
  this.#l === void 0 ? this.paramRuntime.finalizeInitialization() : this.#T();
@@ -1753,8 +1900,10 @@ var Ze = class {
1753
1900
  return this.#s;
1754
1901
  }
1755
1902
  arrange(e, t, n = {}) {
1756
- if (n.firstFacet && this.facetCoords.clear(), this.facetCoords.set(n.facetId, m(t, f(n))), this.#a || this.#o) {
1757
- let e = this.getOverhang(), n = this.layoutParent ? k.zero() : this.getPadding();
1903
+ if (this.layoutParent || this.visit((e) => {
1904
+ e.layoutCoords = void 0;
1905
+ }), this.layoutCoords = t, n.firstFacet && this.facetCoords.clear(), this.facetCoords.set(n.facetId, ie(t, ne(n))), this.#a || this.#o) {
1906
+ let e = this.getOverhang(), n = this.layoutParent ? z.zero() : this.getPadding();
1758
1907
  this.#a?.(t.width - e.width - n.width), this.#o?.(t.height - e.height - n.height);
1759
1908
  }
1760
1909
  this.#c = !0, this.#T();
@@ -1775,7 +1924,7 @@ var Ze = class {
1775
1924
  }
1776
1925
  getFacetFields(e) {
1777
1926
  let t = this.getEncoding().sample;
1778
- return u(t) ? [t.field] : this.options.inheritEncoding ? this.layoutParent?.getFacetFields(this) : [];
1927
+ return l(t) ? [t.field] : this.options.inheritEncoding ? this.layoutParent?.getFacetFields(this) : [];
1779
1928
  }
1780
1929
  usesSampleFacetRendering() {
1781
1930
  return this.layoutParent?.usesSampleFacetRendering() ?? !1;
@@ -1787,15 +1936,23 @@ var Ze = class {
1787
1936
  };
1788
1937
  }
1789
1938
  getScaleResolution(e) {
1790
- let t = o(e);
1791
- return this.getDataAncestors().map((e) => e.resolutions.scale[t]).find((e) => e);
1939
+ return this.#E(e, "scale");
1792
1940
  }
1793
1941
  getAxisResolution(e) {
1794
- let t = o(e);
1795
- return this.getDataAncestors().map((e) => e.resolutions.axis[t]).find((e) => e);
1942
+ return this.#E(e, "axis");
1943
+ }
1944
+ #E(e, t) {
1945
+ let n = v(e);
1946
+ for (let e of this.getDataAncestors()) {
1947
+ let r = e.resolutions[t][n];
1948
+ if (r || e.isResolutionBoundary(n)) return r;
1949
+ }
1950
+ }
1951
+ isResolutionBoundary(e) {
1952
+ return this.options.resolutionBoundaryChannels?.some((t) => t === v(e)) ?? !1;
1796
1953
  }
1797
1954
  getLegendResolution(e) {
1798
- let t = o(e);
1955
+ let t = v(e);
1799
1956
  return this.getDataAncestors().map((e) => e.resolutions.legend[t]).find((e) => e);
1800
1957
  }
1801
1958
  getConfiguredResolution(e, t) {
@@ -1808,43 +1965,43 @@ var Ze = class {
1808
1965
  return "independent";
1809
1966
  }
1810
1967
  getBaseUrl() {
1811
- return j(() => this.dataParent?.getBaseUrl(), Ge(this.spec.baseUrl));
1968
+ return ce(() => this.dataParent?.getBaseUrl(), Je(this.spec.baseUrl));
1812
1969
  }
1813
1970
  isPickingSupported() {
1814
1971
  return !0;
1815
1972
  }
1816
1973
  getTitleText() {
1817
1974
  let e = this.spec.title;
1818
- if (e) return te(e) ? e : n(e.text) ? this.paramRuntime.evaluateAndGet(e.text.expr) : e.text;
1975
+ if (e) return d(e) ? e : y(e.text) ? this.paramRuntime.evaluateAndGet(e.text) : e.text;
1819
1976
  }
1820
1977
  _cache(e, t) {
1821
- return re(this, e, t);
1978
+ return ue(this, e, t);
1822
1979
  }
1823
1980
  _invalidateCacheByPrefix(e, t = "self") {
1824
1981
  switch (t) {
1825
1982
  case "self":
1826
- g(this, e);
1983
+ S(this, e);
1827
1984
  break;
1828
1985
  case "ancestors":
1829
- for (let t of this.getLayoutAncestors()) g(t, e);
1986
+ for (let t of this.getLayoutAncestors()) S(t, e);
1830
1987
  break;
1831
- case "progeny": this.visit((t) => g(t, e));
1988
+ case "progeny": this.visit((t) => S(t, e));
1832
1989
  }
1833
1990
  }
1834
1991
  invalidateSizeCache() {
1835
- g(this, "size"), this._invalidateCacheByPrefix("size", "ancestors");
1992
+ S(this, "size"), this._invalidateCacheByPrefix("size", "ancestors");
1836
1993
  }
1837
1994
  propagateInteraction(e) {}
1838
1995
  };
1839
- function et(e) {
1996
+ function lt(e) {
1840
1997
  return "unitsPerPixel" in e;
1841
1998
  }
1842
- function tt(e) {
1999
+ function ut(e) {
1843
2000
  let t = "opacity" in e.spec ? e.spec.opacity : void 0;
1844
2001
  if (t !== void 0) {
1845
- if (s(t)) return (e) => e * t;
1846
- if (et(t)) {
1847
- let r = (t) => {
2002
+ if (b(t)) return (e) => e * t;
2003
+ if (lt(t)) {
2004
+ let n = (t) => {
1848
2005
  let n = e.getScaleResolution(t), r = n?.getScale();
1849
2006
  if ([
1850
2007
  "linear",
@@ -1854,50 +2011,50 @@ function tt(e) {
1854
2011
  scale: r,
1855
2012
  scaleResolution: n
1856
2013
  };
1857
- }, i = rt(t.values, "opacity.values", e);
1858
- if (!a(t.unitsPerPixel)) throw new _("\"opacity.unitsPerPixel\" must be an array.", e);
1859
- let o = () => 1, s = [], c = () => {
1860
- let t = nt(rt(s.map((e) => e()), "opacity.unitsPerPixel", e), i, e), n = ae().domain(t.unitsPerPixel).range(t.values).clamp(!0);
1861
- o = (e) => n(e);
2014
+ }, r = ft(t.values, "opacity.values", e);
2015
+ if (!u(t.unitsPerPixel)) throw new C("\"opacity.unitsPerPixel\" must be an array.", e);
2016
+ let i = () => 1, a = [], o = () => {
2017
+ let t = dt(ft(a.map((e) => e()), "opacity.unitsPerPixel", e), r, e), n = m().domain(t.unitsPerPixel).range(t.values).clamp(!0);
2018
+ i = (e) => n(e);
1862
2019
  };
1863
- s = t.unitsPerPixel.map((t) => {
1864
- if (n(t)) {
1865
- let n = e.paramRuntime.watchExpression(t.expr, () => {
1866
- c(), e.context.animator.requestRender();
2020
+ a = t.unitsPerPixel.map((t) => {
2021
+ if (y(t)) {
2022
+ let n = e.paramRuntime.watchExpression(t, () => {
2023
+ o(), e.context.animator.requestRender();
1867
2024
  });
1868
2025
  return () => n(null);
1869
2026
  }
1870
2027
  return () => t;
1871
- }), c();
1872
- let u = (e) => {
2028
+ }), o();
2029
+ let s = (e) => {
1873
2030
  let t = e.scaleResolution.getAxisLength() || 1e3;
1874
- return l(e.scale.domain()) / t;
1875
- }, d;
2031
+ return ae(e.scale.domain()) / t;
2032
+ }, c;
1876
2033
  if (t.channel === "auto") {
1877
- let t = r("x"), n = r("y");
1878
- if (t && n) d = () => (u(t) + u(n)) / 2;
1879
- else if (t) d = () => u(t);
1880
- else if (n) d = () => u(n);
1881
- else throw new _("Cannot find a resolved quantitative x or y scale for dynamic opacity!", e);
2034
+ let t = n("x"), r = n("y");
2035
+ if (t && r) c = () => (s(t) + s(r)) / 2;
2036
+ else if (t) c = () => s(t);
2037
+ else if (r) c = () => s(r);
2038
+ else throw new C("Cannot find a resolved quantitative x or y scale for dynamic opacity!", e);
1882
2039
  } else {
1883
- let n = t.channel ? r(t.channel) : r("x") ?? r("y");
1884
- if (!n) throw new _("Cannot find a resolved quantitative scale for dynamic opacity!", e);
1885
- d = () => u(n);
2040
+ let r = t.channel ? n(t.channel) : n("x") ?? n("y");
2041
+ if (!r) throw new C("Cannot find a resolved quantitative scale for dynamic opacity!", e);
2042
+ c = () => s(r);
1886
2043
  }
1887
- return (e) => o(d()) * e;
2044
+ return (e) => i(c()) * e;
1888
2045
  }
1889
- if (n(t)) {
1890
- let n = e.paramRuntime.watchExpression(t.expr, () => e.context.animator.requestRender());
2046
+ if (y(t)) {
2047
+ let n = e.paramRuntime.watchExpression(t, () => e.context.animator.requestRender());
1891
2048
  return (e) => n(null) * e;
1892
2049
  }
1893
2050
  }
1894
2051
  return q;
1895
2052
  }
1896
- function nt(e, t, n) {
1897
- if (!e.length) throw new _("\"opacity.unitsPerPixel\" must contain at least one stop.", n);
1898
- if (e.length !== t.length) throw new _("\"opacity.unitsPerPixel\" and \"opacity.values\" must have the same length.", n);
2053
+ function dt(e, t, n) {
2054
+ if (!e.length) throw new C("\"opacity.unitsPerPixel\" must contain at least one stop.", n);
2055
+ if (e.length !== t.length) throw new C("\"opacity.unitsPerPixel\" and \"opacity.values\" must have the same length.", n);
1899
2056
  e.forEach((e, t) => {
1900
- if (e <= 0) throw new _("Invalid opacity.unitsPerPixel value at index " + t + ". Stop values must be positive.", n);
2057
+ if (e <= 0) throw new C("Invalid opacity.unitsPerPixel value at index " + t + ". Stop values must be positive.", n);
1901
2058
  });
1902
2059
  let r = e.map((e, n) => ({
1903
2060
  stop: e,
@@ -1905,46 +2062,46 @@ function nt(e, t, n) {
1905
2062
  }));
1906
2063
  r.sort((e, t) => t.stop - e.stop);
1907
2064
  let i = r.map((e) => e.stop), a = r.map((e) => e.value);
1908
- for (let t = 1; t < e.length; t++) if (i[t - 1] <= i[t]) throw new _("\"opacity.unitsPerPixel\" must be strictly decreasing.", n);
2065
+ for (let t = 1; t < e.length; t++) if (i[t - 1] <= i[t]) throw new C("\"opacity.unitsPerPixel\" must be strictly decreasing.", n);
1909
2066
  return {
1910
2067
  unitsPerPixel: i,
1911
2068
  values: a
1912
2069
  };
1913
2070
  }
1914
- function rt(e, t, n) {
1915
- if (!a(e)) throw new _("\"" + t + "\" must evaluate to an array.", n);
2071
+ function ft(e, t, n) {
2072
+ if (!u(e)) throw new C("\"" + t + "\" must evaluate to an array.", n);
1916
2073
  return e.map((e, r) => {
1917
- if (!s(e) || !Number.isFinite(e)) throw new _("Invalid " + t + " value at index " + r + ". Expected a finite number.", n);
2074
+ if (!b(e) || !Number.isFinite(e)) throw new C("Invalid " + t + " value at index " + r + ". Expected a finite number.", n);
1918
2075
  return e;
1919
2076
  });
1920
2077
  }
1921
2078
  var J = (e) => !!e && typeof e == "object" && "step" in e;
1922
- function it(e) {
2079
+ function pt(e) {
1923
2080
  return typeof e == "number" && Number.isFinite(e);
1924
2081
  }
1925
2082
  var Y = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap();
1926
- function at(e, t) {
1927
- st(e, t, "Import");
2083
+ function mt(e, t) {
2084
+ gt(e, t, "Import");
1928
2085
  }
1929
- function ot(e, t) {
1930
- st(e, t, "View");
2086
+ function ht(e, t) {
2087
+ gt(e, t, "View");
1931
2088
  }
1932
- function st(e, t, n) {
2089
+ function gt(e, t, n) {
1933
2090
  if (t !== null && typeof t != "string") throw Error(n + " scope name must be a string or null.");
1934
2091
  Y.set(e, { name: t });
1935
2092
  }
1936
- function ct(e) {
2093
+ function _t(e) {
1937
2094
  return Y.get(e);
1938
2095
  }
1939
- function lt(e, t = {}) {
2096
+ function vt(e, t = {}) {
1940
2097
  let n = t.skipSubtree ?? !1 ? "excludeSubtree" : "exclude";
1941
2098
  X.set(e, n);
1942
2099
  }
1943
- function ut(e, t = {}) {
1944
- qe(e, t.skipSubtree ?? !1 ? "excludeSubtree" : "exclude");
2100
+ function yt(e, t = {}) {
2101
+ Qe(e, t.skipSubtree ?? !1 ? "excludeSubtree" : "exclude");
1945
2102
  }
1946
- function dt(e) {
1947
- return e.getLayoutAncestors().some(H);
2103
+ function bt(e) {
2104
+ return e.getLayoutAncestors().some(W);
1948
2105
  }
1949
2106
  function Z(e) {
1950
2107
  let t = e.getDataAncestors(), n = [];
@@ -1954,7 +2111,7 @@ function Z(e) {
1954
2111
  }
1955
2112
  return n;
1956
2113
  }
1957
- function ft(e) {
2114
+ function xt(e) {
1958
2115
  let t = e.explicitName;
1959
2116
  if (!t) throw Error("Cannot build a selector for a view without a name.");
1960
2117
  return {
@@ -1962,104 +2119,109 @@ function ft(e) {
1962
2119
  view: t
1963
2120
  };
1964
2121
  }
1965
- function pt(e, t) {
2122
+ function St(e, t) {
1966
2123
  if (!t) throw Error("Cannot build a selector for a parameter without a name.");
1967
2124
  return {
1968
2125
  scope: Z(e),
1969
2126
  param: t
1970
2127
  };
1971
2128
  }
1972
- function mt(e) {
1973
- return St(e), "p:" + JSON.stringify({
2129
+ function Ct(e) {
2130
+ return jt(e), "p:" + JSON.stringify({
1974
2131
  scope: e.scope,
1975
2132
  param: e.param
1976
2133
  });
1977
2134
  }
1978
- function ht(e, t) {
2135
+ function wt(e, t) {
1979
2136
  e.visit((e) => {
1980
- let n = Je(e);
2137
+ let n = $e(e);
1981
2138
  if (n === "excludeSubtree") return G;
1982
2139
  if (n !== "exclude") return t(e);
1983
2140
  });
1984
2141
  }
1985
- function gt(e, t) {
2142
+ function Tt(e, t) {
1986
2143
  e.visit((e) => {
1987
2144
  let n = X.get(e);
1988
2145
  if (n === "excludeSubtree") return G;
1989
2146
  if (n !== "exclude") return t(e);
1990
2147
  });
1991
2148
  }
1992
- function _t(e, t) {
1993
- if (Ct(t), !jt(e, t.scope)) return;
2149
+ function Et(e, t) {
2150
+ if (Mt(t), !Bt(e, t.scope)) return;
1994
2151
  let n = [];
1995
2152
  if ($(e, t.scope, (e) => {
1996
2153
  e.explicitName === t.view && n.push(e);
1997
2154
  }, { includeNamedImportRoots: !0 }), n.length === 1) return n[0];
1998
2155
  if (n.length !== 0) throw Error("View selector is ambiguous for view \"" + t.view + "\" in scope " + JSON.stringify(t.scope));
1999
2156
  }
2000
- function vt(e, t) {
2001
- if (St(t), !jt(e, t.scope)) return;
2157
+ function Dt(e, t) {
2158
+ if (jt(t), !Bt(e, t.scope)) return;
2002
2159
  let n = [];
2003
2160
  if ($(e, t.scope, (e) => {
2004
- for (let [r, i] of e.paramRuntime.paramConfigs) r === t.param && Q(i) && n.push({
2161
+ for (let [r, i] of e.paramRuntime.paramConfigs) r === t.param && Q(i, e) && n.push({
2005
2162
  view: e,
2006
2163
  param: i
2007
2164
  });
2008
2165
  }), n.length === 1) return n[0];
2009
2166
  if (n.length !== 0) throw Error("Param selector is ambiguous for param \"" + t.param + "\" in scope " + JSON.stringify(t.scope));
2010
2167
  }
2011
- function yt(e, t) {
2168
+ function Ot(e, t) {
2012
2169
  e.visit((e) => {
2013
2170
  let n = X.get(e);
2014
2171
  if (n === "excludeSubtree") return G;
2015
- if (n !== "exclude") for (let [n, r] of e.paramRuntime.paramConfigs) Q(r) && t({
2172
+ if (n !== "exclude") for (let [n, r] of e.paramRuntime.paramConfigs) Q(r, e) && t({
2016
2173
  view: e,
2017
2174
  param: r,
2018
- selector: pt(e, n)
2175
+ selector: St(e, n)
2019
2176
  });
2020
2177
  });
2021
2178
  }
2022
- function bt(e) {
2179
+ function kt(e) {
2023
2180
  let t = [];
2024
- return yt(e, (e) => t.push(e)), t;
2181
+ return Ot(e, (e) => t.push(e)), t;
2025
2182
  }
2026
- function xt(e) {
2183
+ function At(e) {
2027
2184
  let t = [];
2028
- for (let n of wt(e)) {
2029
- let r = Tt(n);
2030
- Dt(e, r, t), Ot(e, r, t);
2185
+ for (let n of Nt(e)) {
2186
+ let r = Pt(n);
2187
+ It(e, r, t), Lt(e, r, t);
2031
2188
  }
2032
2189
  return t;
2033
2190
  }
2034
- function St(e) {
2191
+ function jt(e) {
2035
2192
  if (!e || !Array.isArray(e.scope)) throw Error("Param selector scope must be an array.");
2036
2193
  if (typeof e.param != "string" || !e.param.length) throw Error("Param selector param must be a non-empty string.");
2037
2194
  }
2038
- function Ct(e) {
2195
+ function Mt(e) {
2039
2196
  if (!e || !Array.isArray(e.scope)) throw Error("View selector scope must be an array.");
2040
2197
  if (typeof e.view != "string" || !e.view.length) throw Error("View selector view must be a non-empty string.");
2041
2198
  }
2042
- function Q(e) {
2043
- return e.persist === !1 ? !1 : ne(e) ? !0 : r(e) ? !!e.bind : !1;
2199
+ function Q(e, t) {
2200
+ if (e.persist === !1) return !1;
2201
+ if (e.push === "outer") {
2202
+ let n = t.paramRuntime.findRuntimeForParam(e.name);
2203
+ if (_(n.paramConfigs.get(e.name))) return !1;
2204
+ }
2205
+ return _(e) ? !0 : p(e) ? !!e.bind : !1;
2044
2206
  }
2045
- function wt(e) {
2207
+ function Nt(e) {
2046
2208
  let t = /* @__PURE__ */ new Set([e]);
2047
2209
  return e.visit((e) => {
2048
2210
  let n = Y.get(e);
2049
2211
  n && typeof n.name == "string" && t.add(e);
2050
2212
  }), Array.from(t);
2051
2213
  }
2052
- function Tt(e) {
2214
+ function Pt(e) {
2053
2215
  return Z(e);
2054
2216
  }
2055
- function Et(e) {
2217
+ function Ft(e) {
2056
2218
  return e.length ? "import scope [" + e.join(" / ") + "]" : "import scope (root)";
2057
2219
  }
2058
- function Dt(e, t, n) {
2220
+ function It(e, t, n) {
2059
2221
  let r = /* @__PURE__ */ new Map();
2060
2222
  $(e, t, (e) => {
2061
2223
  for (let [t, n] of e.paramRuntime.paramConfigs) {
2062
- if (!Q(n)) continue;
2224
+ if (!Q(n, e)) continue;
2063
2225
  let i = r.get(t);
2064
2226
  i ? i.push(e) : r.set(t, [e]);
2065
2227
  }
@@ -2068,15 +2230,15 @@ function Dt(e, t, n) {
2068
2230
  if (i.length <= 1) continue;
2069
2231
  let r = i.map((e) => e.getPathString()).join(", ");
2070
2232
  n.push({
2071
- message: "Bookmarkable parameter \"" + e + "\" is not unique within " + Et(t) + ". Found in: " + r + ".",
2233
+ message: "Bookmarkable parameter \"" + e + "\" is not unique within " + Ft(t) + ". Found in: " + r + ".",
2072
2234
  scope: t
2073
2235
  });
2074
2236
  }
2075
2237
  }
2076
- function Ot(e, t, n) {
2077
- let r = kt(e, t);
2238
+ function Lt(e, t, n) {
2239
+ let r = Rt(e, t);
2078
2240
  if (!r.length) return;
2079
- let i = r.filter((e) => At(e));
2241
+ let i = r.filter((e) => zt(e));
2080
2242
  if (i.length <= 1) return;
2081
2243
  let a = /* @__PURE__ */ new Map();
2082
2244
  for (let e of i) {
@@ -2084,11 +2246,11 @@ function Ot(e, t, n) {
2084
2246
  typeof n == "string" && n.length && a.set(n, (a.get(n) ?? 0) + 1);
2085
2247
  }
2086
2248
  for (let [e, r] of a) r > 1 && n.push({
2087
- message: "Import instance name \"" + e + "\" is used multiple times for addressable instances in " + Et(t) + ".",
2249
+ message: "Import instance name \"" + e + "\" is used multiple times for addressable instances in " + Ft(t) + ".",
2088
2250
  scope: t
2089
2251
  });
2090
2252
  }
2091
- function kt(e, t) {
2253
+ function Rt(e, t) {
2092
2254
  let n = [];
2093
2255
  return $(e, t, (e) => {
2094
2256
  if (Z(e).length !== t.length + 1) return;
@@ -2096,17 +2258,17 @@ function kt(e, t) {
2096
2258
  r && typeof r.name == "string" && n.push(e);
2097
2259
  }, { includeNamedImportRoots: !0 }), n;
2098
2260
  }
2099
- function At(e) {
2261
+ function zt(e) {
2100
2262
  let t = !1;
2101
2263
  return e.visit((e) => {
2102
2264
  let n = X.get(e);
2103
2265
  if (n === "excludeSubtree") return G;
2104
2266
  if (n !== "exclude") {
2105
- for (let n of e.paramRuntime.paramConfigs.values()) if (Q(n)) return t = !0, K;
2267
+ for (let n of e.paramRuntime.paramConfigs.values()) if (Q(n, e)) return t = !0, K;
2106
2268
  }
2107
2269
  }), t;
2108
2270
  }
2109
- function jt(e, t) {
2271
+ function Bt(e, t) {
2110
2272
  let n = e, r = [];
2111
2273
  for (let i of t) {
2112
2274
  if (typeof i != "string" || !i.length) throw Error("Scope names must be non-empty strings.");
@@ -2128,20 +2290,20 @@ function $(e, t, n, r = {}) {
2128
2290
  e.visit((e) => {
2129
2291
  let r = Y.get(e), a = X.get(e);
2130
2292
  if (a === "excludeSubtree") return G;
2131
- if (a !== "exclude" && Mt(e, t, r, i)) return n(e);
2293
+ if (a !== "exclude" && Vt(e, t, r, i)) return n(e);
2132
2294
  });
2133
2295
  }
2134
- function Mt(e, t, n, r) {
2296
+ function Vt(e, t, n, r) {
2135
2297
  let i = Z(e);
2136
- return Nt(i, t) ? !0 : !r || !n || typeof n.name != "string" || i.length !== t.length + 1 ? !1 : Pt(t, i);
2298
+ return Ht(i, t) ? !0 : !r || !n || typeof n.name != "string" || i.length !== t.length + 1 ? !1 : Ut(t, i);
2137
2299
  }
2138
- function Nt(e, t) {
2139
- return e.length === t.length && Pt(e, t);
2300
+ function Ht(e, t) {
2301
+ return e.length === t.length && Ut(e, t);
2140
2302
  }
2141
- function Pt(e, t) {
2303
+ function Ut(e, t) {
2142
2304
  if (e.length > t.length) return !1;
2143
2305
  for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
2144
2306
  return !0;
2145
2307
  }
2146
2308
  //#endregion
2147
- export { M as A, ce as B, We as C, Fe as D, Re as E, b as F, fe as H, de as I, le as L, k as M, be as N, N as O, y as P, D as R, B as S, Le as T, ue as U, he as V, K as _, dt as a, H as b, lt as c, vt as d, _t as f, G as g, ht as h, ft as i, Se as j, j as k, at as l, gt as m, ct as n, mt as o, xt as p, Z as r, ut as s, bt as t, ot as u, $e as v, Be as w, U as x, Ye as y, E as z };
2309
+ export { L as A, Be as B, et as C, Ke as D, z as E, F, Ee as G, je as H, Fe as I, De as K, M as L, ze as M, Le as N, D as O, I as P, Ie as R, W as S, qe as T, Oe as U, Re as V, ke as W, G as _, xt as a, at as b, yt as c, ht as d, Dt as f, wt as g, Tt as h, Z as i, P as j, O as k, vt as l, At as m, _t as n, bt as o, Et as p, ge as q, St as r, Ct as s, kt as t, mt as u, K as v, Ze as w, nt as x, ct as y, N as z };