@genome-spy/app 0.84.0 → 0.86.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.
- package/README.md +28 -0
- package/dist/{agentApi-DHXYZVvQ.js → agentApi-DgopQbMV.js} +5804 -7009
- package/dist/agentApi.es.js +2823 -2594
- package/dist/agentShared.es.js +15 -14
- package/dist/canvas2d-8uxuN_vx.js +619 -0
- package/dist/canvas2d-BtQC7Xr8.js +619 -0
- package/dist/canvasSizeHelper-7h_8rOcx.js +56 -0
- package/dist/clipOptions-BQfNhxgP.js +2239 -0
- package/dist/clipOptions-taFzEljc.js +2259 -0
- package/dist/{debug-aHQsa6hU.js → debug-Bzc3SoRg.js} +8 -8
- package/dist/{debug-D6FqxKEj.js → debug-D_VtWQ6l.js} +8 -8
- package/dist/{esm-CGLz7idZ.js → esm-BA6yMcc-.js} +438 -434
- package/dist/{esm-D8vvQAP3.js → esm-CcDLRSvC.js} +33 -33
- package/dist/{esm-BeV56E_5.js → esm-CfYZhLHN.js} +33 -33
- package/dist/{esm-DQ3lJSQN.js → esm-JAiZmFIS.js} +1 -1
- package/dist/index.es.js +3067 -2987
- package/dist/index.js +2030 -2022
- package/dist/indexer-qiFctgR3.js +72 -0
- package/dist/indexer-qy_dq5l5.js +72 -0
- package/dist/layoutResult-D50MSHXR.js +97 -0
- package/dist/nativeText-DFV5XIx8.js +860 -0
- package/dist/nativeText-vT3AWE14.js +860 -0
- package/dist/performanceProfiler-CPLEjApa.js +20 -0
- package/dist/rasterExport-B8pVoOsj.js +44 -0
- package/dist/rasterExport-C4r4xjQT.js +44 -0
- package/dist/rasterImage-B4rPLaW9.js +18 -0
- package/dist/rasterization-CFogVB3B.js +50 -0
- package/dist/rectangle-DKnrAmKs.js +142 -0
- package/dist/renderCanvas2D-BQrRWp2Z.js +271 -0
- package/dist/renderCanvas2D-CHVNfIUz.js +271 -0
- package/dist/schema.json +1559 -219
- package/dist/style.css +1 -1
- package/dist/svg-C-Sw6E6G.js +1167 -0
- package/dist/svg-CKHwwKRt.js +1167 -0
- package/dist/{svgNumber-C6aRPc8Z.js → svgNumber-DNxESJQB.js} +1 -1
- package/dist/svgRasterizer-BgD72AmG.js +40 -0
- package/dist/svgRasterizer-BgSNqI3L.js +40 -0
- package/dist/vega-scale-CK0_al6O.js +2700 -0
- package/dist/vega-scale-D46-iCaL.js +2700 -0
- package/dist/viewError-BiR9VCgL.js +29 -0
- package/dist/{viewIdentityRegistry-Dl7rR4Ay.js → viewIdentityRegistry-B-VGlez1.js} +1 -1
- package/dist/{viewIdentityRegistry-AEQpJTDm.js → viewIdentityRegistry-CDtVktJD.js} +1 -1
- package/dist/viewSelectors-CKfxF_LM.js +1817 -0
- package/dist/viewSelectors-D_imtq5Z.js +1817 -0
- package/dist/viewUtils-nCJ7AoaI.js +5782 -0
- package/dist/warning-CpIIpk8e.js +7 -0
- package/dist/webgl-BaA3jSa2.js +4128 -0
- package/dist/webgl-FP-4EsBL.js +4128 -0
- package/package.json +7 -6
- package/dist/bmFontMetrics-CuNB-kNN.js +0 -31
- package/dist/clipOptions-Dqco1p8b.js +0 -377
- package/dist/framebufferReadback-Bje9lHb7.js +0 -1993
- package/dist/framebufferReadback-CC0D6Haw.js +0 -147
- package/dist/raster-9uKYMjHZ.js +0 -53
- package/dist/raster-BofBWXbe.js +0 -54
- package/dist/svg-CvsT1Y2V.js +0 -1793
- package/dist/svg-DRgWfcsL.js +0 -1793
- package/dist/twgl-full.module-BNEMlXRV.js +0 -1849
- package/dist/viewRenderingContext-HtpqwS_x.js +0 -120
- package/dist/viewSelectors-BhW4mTR1.js +0 -6386
- package/dist/viewSelectors-Bwzj10Qz.js +0 -6363
- package/dist/viewUtils-DMNiWslc.js +0 -7228
|
@@ -0,0 +1,1817 @@
|
|
|
1
|
+
import { Ct as e, Et as t, Gt as n, Jt as r, O as i, Ot as a, St as o, Tt as s, Xt as c, Yt as l, nn as u, nt as d, o as f, rt as p, t as m, u as ee, y as h } from "./clipOptions-BQfNhxgP.js";
|
|
2
|
+
import { a as g, n as te, r as ne, t as _ } from "./viewError-BiR9VCgL.js";
|
|
3
|
+
import { U as re, it as ie, m as ae, y as v } from "./vega-scale-CK0_al6O.js";
|
|
4
|
+
//#region ../core/src/view/layout/flexLayout.js
|
|
5
|
+
function oe(e, t, { spacing: n, devicePixelRatio: r, offset: i, reverse: a } = {}) {
|
|
6
|
+
n ||= 0, i ||= 0;
|
|
7
|
+
let o = he(e, t, n), s = 0, c = 0;
|
|
8
|
+
for (let t = 0; t < e.length; t++) s += o[t], x(e[t]) || c++;
|
|
9
|
+
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) => {
|
|
10
|
+
let t = d;
|
|
11
|
+
if (!t) return;
|
|
12
|
+
let r = (e ? n : 0) * (a ? -1 : 1);
|
|
13
|
+
m -= r;
|
|
14
|
+
for (let e = 0; e < t; e++) f.push({
|
|
15
|
+
location: m + (e + 1) / (t + 1) * r,
|
|
16
|
+
size: 0
|
|
17
|
+
});
|
|
18
|
+
m += r, d = 0;
|
|
19
|
+
}, m = a ? Math.max(t, l) : 0 + i;
|
|
20
|
+
if (e.length == 1 && x(e[0])) return [{
|
|
21
|
+
location: m,
|
|
22
|
+
size: 0
|
|
23
|
+
}];
|
|
24
|
+
for (let t = 0; t < e.length; t++) {
|
|
25
|
+
let r = e[t];
|
|
26
|
+
if (x(r)) d++;
|
|
27
|
+
else {
|
|
28
|
+
p(f.length > 0);
|
|
29
|
+
let e = o[t];
|
|
30
|
+
a && (m -= e), f.push({
|
|
31
|
+
location: u(m),
|
|
32
|
+
size: u(e)
|
|
33
|
+
}), a ? m -= n : m += e + n;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return m += a ? n : -n, p(!1), f;
|
|
37
|
+
}
|
|
38
|
+
function se(e, { spacing: t } = { spacing: 0 }) {
|
|
39
|
+
let n = 0;
|
|
40
|
+
for (let r of e) n += w(r) + (x(r) ? 0 : t);
|
|
41
|
+
return Math.max(0, n - t);
|
|
42
|
+
}
|
|
43
|
+
function ce(e, t, { spacing: n = 0 } = {}) {
|
|
44
|
+
let r = [], i = [], a = 0, o = 0;
|
|
45
|
+
for (let [s, c] of e.entries()) {
|
|
46
|
+
let e = w(c), l = !x(c), u = o && l ? n : 0;
|
|
47
|
+
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;
|
|
48
|
+
}
|
|
49
|
+
return i.length && r.push(i), r;
|
|
50
|
+
}
|
|
51
|
+
function le(e) {
|
|
52
|
+
let t = 0, n = 0, r = 0, i, a = !0;
|
|
53
|
+
for (let o of e) {
|
|
54
|
+
t = Math.max(t, o.px ?? 0), n = Math.max(n, o.grow ?? 0), r = Math.max(r, w(o));
|
|
55
|
+
let e = T(o);
|
|
56
|
+
e === void 0 ? a = !1 : i = i === void 0 ? e : Math.max(i, e);
|
|
57
|
+
}
|
|
58
|
+
return D({
|
|
59
|
+
px: t,
|
|
60
|
+
grow: n,
|
|
61
|
+
minPx: r,
|
|
62
|
+
maxPx: a ? i : void 0
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function ue(e) {
|
|
66
|
+
let t = {
|
|
67
|
+
px: 0,
|
|
68
|
+
grow: 0,
|
|
69
|
+
minPx: 0,
|
|
70
|
+
maxPx: 0
|
|
71
|
+
}, n = !0;
|
|
72
|
+
for (let r of e) {
|
|
73
|
+
t.px += S(r.px), t.grow += S(r.grow), t.minPx += w(r);
|
|
74
|
+
let e = T(r);
|
|
75
|
+
e === void 0 ? n = !1 : t.maxPx += e;
|
|
76
|
+
}
|
|
77
|
+
return n || delete t.maxPx, D(t);
|
|
78
|
+
}
|
|
79
|
+
var y = class e {
|
|
80
|
+
constructor(e, t) {
|
|
81
|
+
this.width = e, this.height = t;
|
|
82
|
+
}
|
|
83
|
+
addPadding(e) {
|
|
84
|
+
return this.#e(e.width, e.height);
|
|
85
|
+
}
|
|
86
|
+
subtractPadding(e) {
|
|
87
|
+
return this.#e(-e.width, -e.height);
|
|
88
|
+
}
|
|
89
|
+
#e(t, n) {
|
|
90
|
+
return new e(ve(this.width, t), ve(this.height, n));
|
|
91
|
+
}
|
|
92
|
+
isGrowing() {
|
|
93
|
+
return !!(this.width.grow || this.height.grow);
|
|
94
|
+
}
|
|
95
|
+
}, b = Object.freeze({
|
|
96
|
+
px: 0,
|
|
97
|
+
grow: 0
|
|
98
|
+
}), de = new y(b, b);
|
|
99
|
+
function x(e) {
|
|
100
|
+
return !e.px && !e.grow && !e.minPx;
|
|
101
|
+
}
|
|
102
|
+
function fe(e, t) {
|
|
103
|
+
return !e || !t ? !1 : e.px === t.px && e.grow === t.grow && e.minPx === t.minPx && e.maxPx === t.maxPx;
|
|
104
|
+
}
|
|
105
|
+
function S(e) {
|
|
106
|
+
return e || 0;
|
|
107
|
+
}
|
|
108
|
+
function pe(e) {
|
|
109
|
+
return e && (r(e.px) || r(e.grow) || r(e.minPx) || r(e.maxPx));
|
|
110
|
+
}
|
|
111
|
+
function me(e) {
|
|
112
|
+
if (q(e)) throw Error("parseSizeDef does not accept step-based sizes.");
|
|
113
|
+
if (pe(e)) return _e(e), D(e);
|
|
114
|
+
if (r(e)) return {
|
|
115
|
+
px: e,
|
|
116
|
+
grow: 0
|
|
117
|
+
};
|
|
118
|
+
if (e === "container" || !e) return {
|
|
119
|
+
px: 0,
|
|
120
|
+
grow: 1
|
|
121
|
+
};
|
|
122
|
+
throw Error(`Invalid sizeDef: ${e}`);
|
|
123
|
+
}
|
|
124
|
+
function he(e, t, n) {
|
|
125
|
+
let r = !1;
|
|
126
|
+
for (let t of e) _e(t), r ||= E(t);
|
|
127
|
+
if (!r) return ge(e, t, n);
|
|
128
|
+
let i = Array(e.length).fill(0), a = [];
|
|
129
|
+
for (let t = 0; t < e.length; t++) x(e[t]) || a.push(t);
|
|
130
|
+
let o = Math.max(0, a.length - 1) * n, s = Math.max(0, t - o), c = /* @__PURE__ */ new Set();
|
|
131
|
+
for (let t of a) {
|
|
132
|
+
let n = e[t];
|
|
133
|
+
S(n.grow) || (i[t] = C(S(n.px), n), c.add(t));
|
|
134
|
+
}
|
|
135
|
+
for (;;) {
|
|
136
|
+
let t = 0, n = 0, r = 0;
|
|
137
|
+
for (let o of a) c.has(o) ? r += i[o] : (t += S(e[o].px), n += S(e[o].grow));
|
|
138
|
+
if (!n) {
|
|
139
|
+
for (let t of a) c.has(t) || (i[t] = C(S(e[t].px), e[t]), c.add(t));
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
let o = Math.max(0, s - r - t), l = 0, u = [], d = [];
|
|
143
|
+
for (let t of a) {
|
|
144
|
+
if (c.has(t)) continue;
|
|
145
|
+
let r = e[t], a = S(r.px) + S(r.grow) / n * o, s = C(a, r);
|
|
146
|
+
i[t] = s;
|
|
147
|
+
let f = s - a;
|
|
148
|
+
l += f, f > 0 ? u.push(t) : f < 0 && d.push(t);
|
|
149
|
+
}
|
|
150
|
+
if (!u.length && !d.length) break;
|
|
151
|
+
if (l > 0) for (let e of u) c.add(e);
|
|
152
|
+
else if (l < 0) for (let e of d) c.add(e);
|
|
153
|
+
else for (let e of a) c.add(e);
|
|
154
|
+
}
|
|
155
|
+
return i;
|
|
156
|
+
}
|
|
157
|
+
function ge(e, t, n) {
|
|
158
|
+
let r = 0, i = 0;
|
|
159
|
+
for (let t of e) r += S(t.px) + (x(t) ? 0 : n), i += S(t.grow);
|
|
160
|
+
r -= n;
|
|
161
|
+
let a = Math.max(0, t - r), o = Array(e.length);
|
|
162
|
+
for (let t = 0; t < e.length; t++) {
|
|
163
|
+
let n = e[t];
|
|
164
|
+
o[t] = x(n) ? 0 : S(n.px) + (i ? S(n.grow) / i * a : 0);
|
|
165
|
+
}
|
|
166
|
+
return o;
|
|
167
|
+
}
|
|
168
|
+
function _e(e) {
|
|
169
|
+
if (e.minPx !== void 0 && e.maxPx !== void 0 && e.minPx > e.maxPx) throw Error("SizeDef minPx cannot be greater than maxPx.");
|
|
170
|
+
}
|
|
171
|
+
function C(e, t) {
|
|
172
|
+
return Math.min(Math.max(e, t.minPx ?? 0), t.maxPx ?? Infinity);
|
|
173
|
+
}
|
|
174
|
+
function w(e) {
|
|
175
|
+
return C(S(e.px), e);
|
|
176
|
+
}
|
|
177
|
+
function T(e) {
|
|
178
|
+
return e.maxPx ?? (S(e.grow) ? void 0 : w(e));
|
|
179
|
+
}
|
|
180
|
+
function E(e) {
|
|
181
|
+
return e.minPx !== void 0 || e.maxPx !== void 0;
|
|
182
|
+
}
|
|
183
|
+
function ve(e, t) {
|
|
184
|
+
return D({
|
|
185
|
+
px: (e.px ?? 0) + t,
|
|
186
|
+
grow: e.grow,
|
|
187
|
+
minPx: e.minPx === void 0 ? void 0 : Math.max(0, e.minPx + t),
|
|
188
|
+
maxPx: e.maxPx === void 0 ? void 0 : Math.max(0, e.maxPx + t)
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
function D(e) {
|
|
192
|
+
let t = {}, n = e.px !== void 0, r = e.grow !== void 0, i = E(e);
|
|
193
|
+
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 > S(e.px) && (t.minPx = e.minPx), e.maxPx !== void 0 && (S(t.grow) || e.maxPx < S(e.px)) && (t.maxPx = e.maxPx), t;
|
|
194
|
+
}
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region ../core/src/view/layout/padding.js
|
|
197
|
+
var O = class e {
|
|
198
|
+
constructor(e, t, n, r) {
|
|
199
|
+
this.top = e || 0, this.right = t || 0, this.bottom = n || 0, this.left = r || 0;
|
|
200
|
+
}
|
|
201
|
+
get width() {
|
|
202
|
+
return this.left + this.right;
|
|
203
|
+
}
|
|
204
|
+
get height() {
|
|
205
|
+
return this.top + this.bottom;
|
|
206
|
+
}
|
|
207
|
+
expand(t) {
|
|
208
|
+
return t <= 0 ? this : new e(this.top + t, this.right + t, this.bottom + t, this.left + t);
|
|
209
|
+
}
|
|
210
|
+
add(t) {
|
|
211
|
+
return new e(this.top + t.top, this.right + t.right, this.bottom + t.bottom, this.left + t.left);
|
|
212
|
+
}
|
|
213
|
+
subtract(t) {
|
|
214
|
+
return new e(this.top - t.top, this.right - t.right, this.bottom - t.bottom, this.left - t.left);
|
|
215
|
+
}
|
|
216
|
+
union(t) {
|
|
217
|
+
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));
|
|
218
|
+
}
|
|
219
|
+
getHorizontal() {
|
|
220
|
+
return new e(0, this.right, 0, this.left);
|
|
221
|
+
}
|
|
222
|
+
getVertical() {
|
|
223
|
+
return new e(this.top, 0, this.bottom, 0);
|
|
224
|
+
}
|
|
225
|
+
get horizontalTotal() {
|
|
226
|
+
return this.left + this.right;
|
|
227
|
+
}
|
|
228
|
+
get verticalTotal() {
|
|
229
|
+
return this.top + this.bottom;
|
|
230
|
+
}
|
|
231
|
+
static createFromConfig(e) {
|
|
232
|
+
return typeof e == "number" ? this.createUniformPadding(e) : e ? this.createFromRecord(e) : k;
|
|
233
|
+
}
|
|
234
|
+
static createFromRecord(t) {
|
|
235
|
+
return new e(t.top, t.right, t.bottom, t.left);
|
|
236
|
+
}
|
|
237
|
+
static zero() {
|
|
238
|
+
return k;
|
|
239
|
+
}
|
|
240
|
+
static createUniformPadding(t) {
|
|
241
|
+
return new e(t, t, t, t);
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
function ye(e, t) {
|
|
245
|
+
return t ? new O(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;
|
|
246
|
+
}
|
|
247
|
+
var k = O.createUniformPadding(0);
|
|
248
|
+
Object.freeze(k);
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region ../core/src/utils/url.js
|
|
251
|
+
var be = /^([A-Za-z]+:)?\/\//;
|
|
252
|
+
function A(e, t) {
|
|
253
|
+
if (t && be.test(t)) return t;
|
|
254
|
+
let n = typeof e == "function" ? e() : e;
|
|
255
|
+
if (!n) return t;
|
|
256
|
+
if (!t) return n;
|
|
257
|
+
if (/[#?]/.test(n)) throw Error(`Cannot append to a url with query or hash. Append: ${t}, base: ${n}`);
|
|
258
|
+
return Se(n) + t;
|
|
259
|
+
}
|
|
260
|
+
function xe(e, t, n = Ce()) {
|
|
261
|
+
let r = typeof e == "function" ? e() : e;
|
|
262
|
+
if (!t) return r;
|
|
263
|
+
try {
|
|
264
|
+
if (r) {
|
|
265
|
+
let e = n ? new URL(r, n).href : new URL(r).href;
|
|
266
|
+
return new URL(t, e).href;
|
|
267
|
+
} else if (n) return new URL(t, n).href;
|
|
268
|
+
} catch {}
|
|
269
|
+
return A(r, t);
|
|
270
|
+
}
|
|
271
|
+
function Se(e) {
|
|
272
|
+
let t = e.replace(/[^/]*$/, "");
|
|
273
|
+
return t === "" ? void 0 : t.endsWith("://") ? e + "/" : t;
|
|
274
|
+
}
|
|
275
|
+
function Ce() {
|
|
276
|
+
if (typeof document < "u" && document.baseURI) return document.baseURI;
|
|
277
|
+
if (typeof window < "u" && window.location?.href) return window.location.href;
|
|
278
|
+
}
|
|
279
|
+
//#endregion
|
|
280
|
+
//#region ../../node_modules/flatqueue/index.js
|
|
281
|
+
var j = class {
|
|
282
|
+
constructor(e = Infinity, t = Float64Array, n = Uint32Array) {
|
|
283
|
+
let r = e !== Infinity;
|
|
284
|
+
this.ids = r ? new n(e) : [], this.values = r ? new t(e) : [], this.capacity = e, this.length = 0;
|
|
285
|
+
}
|
|
286
|
+
clear() {
|
|
287
|
+
this.length = 0;
|
|
288
|
+
}
|
|
289
|
+
push(e, t) {
|
|
290
|
+
if (this.length === this.capacity) throw RangeError("Queue is at capacity.");
|
|
291
|
+
let n = this.length++;
|
|
292
|
+
for (; n > 0;) {
|
|
293
|
+
let e = n - 1 >> 1, r = this.values[e];
|
|
294
|
+
if (t >= r) break;
|
|
295
|
+
this.ids[n] = this.ids[e], this.values[n] = r, n = e;
|
|
296
|
+
}
|
|
297
|
+
this.ids[n] = e, this.values[n] = t;
|
|
298
|
+
}
|
|
299
|
+
pop() {
|
|
300
|
+
if (this.length === 0) return;
|
|
301
|
+
let e = this.ids, t = this.values, n = e[0], r = --this.length;
|
|
302
|
+
if (r > 0) {
|
|
303
|
+
let n = e[r], i = t[r], a = 0, o = r >> 1;
|
|
304
|
+
for (; a < o;) {
|
|
305
|
+
let n = (a << 1) + 1, o = n + 1, s = n + (o < r & +(t[o] < t[n]));
|
|
306
|
+
if (t[s] >= i) break;
|
|
307
|
+
e[a] = e[s], t[a] = t[s], a = s;
|
|
308
|
+
}
|
|
309
|
+
e[a] = n, t[a] = i;
|
|
310
|
+
}
|
|
311
|
+
return n;
|
|
312
|
+
}
|
|
313
|
+
peek() {
|
|
314
|
+
return this.length > 0 ? this.ids[0] : void 0;
|
|
315
|
+
}
|
|
316
|
+
peekValue() {
|
|
317
|
+
return this.length > 0 ? this.values[0] : void 0;
|
|
318
|
+
}
|
|
319
|
+
shrink() {
|
|
320
|
+
Array.isArray(this.ids) && (this.ids.length = this.length), Array.isArray(this.values) && (this.values.length = this.length);
|
|
321
|
+
}
|
|
322
|
+
}, M = Symbol("runtimeNode"), N = 1e6;
|
|
323
|
+
function we(e) {
|
|
324
|
+
return e ? (t, n) => {
|
|
325
|
+
e.addDisposer(t, n);
|
|
326
|
+
} : () => void 0;
|
|
327
|
+
}
|
|
328
|
+
function Te(e, t) {
|
|
329
|
+
let n = {
|
|
330
|
+
id: e.id,
|
|
331
|
+
name: e.name,
|
|
332
|
+
kind: e.kind,
|
|
333
|
+
get() {
|
|
334
|
+
return e.value;
|
|
335
|
+
},
|
|
336
|
+
subscribe(t) {
|
|
337
|
+
return e.listeners.add(t), () => {
|
|
338
|
+
e.listeners.delete(t);
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
return Object.defineProperty(n, M, {
|
|
343
|
+
enumerable: !1,
|
|
344
|
+
configurable: !1,
|
|
345
|
+
writable: !1,
|
|
346
|
+
value: e
|
|
347
|
+
}), t ? Object.assign(n, { set(e) {
|
|
348
|
+
t(e);
|
|
349
|
+
} }) : n;
|
|
350
|
+
}
|
|
351
|
+
function Ee(e) {
|
|
352
|
+
let t = e[M];
|
|
353
|
+
if (!t) throw Error("ParamRef is not bound to this graph runtime. Expected runtime-created ref.");
|
|
354
|
+
return t;
|
|
355
|
+
}
|
|
356
|
+
function De(e) {
|
|
357
|
+
return typeof e.rank == "number" ? e.rank : Ee(e).rank;
|
|
358
|
+
}
|
|
359
|
+
function Oe(e) {
|
|
360
|
+
for (let t of e) t();
|
|
361
|
+
}
|
|
362
|
+
var ke = class {
|
|
363
|
+
#e = 1;
|
|
364
|
+
#t = 1;
|
|
365
|
+
#n = 0;
|
|
366
|
+
#r = !1;
|
|
367
|
+
#i = !1;
|
|
368
|
+
#a = /* @__PURE__ */ new Set();
|
|
369
|
+
#o = /* @__PURE__ */ new Set();
|
|
370
|
+
#s = new j();
|
|
371
|
+
#c = new j();
|
|
372
|
+
#l = /* @__PURE__ */ new Set();
|
|
373
|
+
#u;
|
|
374
|
+
constructor(e = {}) {
|
|
375
|
+
this.#u = we(e.lifecycleRegistry);
|
|
376
|
+
}
|
|
377
|
+
createWritable(e, t, n, r, i = {}) {
|
|
378
|
+
let a = "n" + this.#e++, o = i.notify ?? !0, s = {
|
|
379
|
+
id: a,
|
|
380
|
+
name: t,
|
|
381
|
+
kind: n,
|
|
382
|
+
value: r,
|
|
383
|
+
rank: 0,
|
|
384
|
+
disposed: !1,
|
|
385
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
386
|
+
subscribe(e) {
|
|
387
|
+
return s.listeners.add(e), () => {
|
|
388
|
+
s.listeners.delete(e);
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
return this.#u(e, () => {
|
|
393
|
+
s.disposed = !0, s.listeners.clear();
|
|
394
|
+
}), Te(s, (e) => {
|
|
395
|
+
if (s.disposed) throw Error("Cannot set disposed parameter \"" + t + "\" (" + a + ").");
|
|
396
|
+
e !== s.value && (s.value = e, o && Oe(s.listeners));
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
computed(e, t, n, r) {
|
|
400
|
+
let i = n.reduce((e, t) => Math.max(e, De(t)), 0), a = {
|
|
401
|
+
id: "n" + this.#e++,
|
|
402
|
+
name: t,
|
|
403
|
+
kind: "derived",
|
|
404
|
+
rank: i + 1,
|
|
405
|
+
value: r(),
|
|
406
|
+
disposed: !1,
|
|
407
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
408
|
+
fn: r,
|
|
409
|
+
subscribe(e) {
|
|
410
|
+
return a.listeners.add(e), () => {
|
|
411
|
+
a.listeners.delete(e);
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
}, o = n.map((e) => e.subscribe(() => {
|
|
415
|
+
a.disposed || (this.#d(a), e.propagation === "sync" && this.flushNow());
|
|
416
|
+
}));
|
|
417
|
+
return this.#u(e, () => {
|
|
418
|
+
a.disposed || (a.disposed = !0, o.forEach((e) => e()), a.listeners.clear(), this.#a.delete(a));
|
|
419
|
+
}), Te(a);
|
|
420
|
+
}
|
|
421
|
+
effect(e, t, n) {
|
|
422
|
+
let r = t.reduce((e, t) => Math.max(e, De(t)), 0), i = {
|
|
423
|
+
id: "n" + this.#e++,
|
|
424
|
+
rank: r + 1,
|
|
425
|
+
disposed: !1,
|
|
426
|
+
fn: n
|
|
427
|
+
}, a = () => {
|
|
428
|
+
i.disposed || this.#f(i);
|
|
429
|
+
}, o = t.map((e) => e.subscribe(a)), s = () => {
|
|
430
|
+
i.disposed || (i.disposed = !0, o.forEach((e) => e()), this.#o.delete(i));
|
|
431
|
+
};
|
|
432
|
+
return this.#u(e, s), s;
|
|
433
|
+
}
|
|
434
|
+
runInTransaction(e) {
|
|
435
|
+
this.#n += 1;
|
|
436
|
+
try {
|
|
437
|
+
return e();
|
|
438
|
+
} finally {
|
|
439
|
+
--this.#n, this.#n === 0 && this.#m();
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
flushNow() {
|
|
443
|
+
if (!(this.#n > 0 || this.#i)) {
|
|
444
|
+
this.#r = !1, this.#i = !0;
|
|
445
|
+
try {
|
|
446
|
+
let e = !0;
|
|
447
|
+
for (; e;) {
|
|
448
|
+
for (e = !1; this.#s.length > 0;) {
|
|
449
|
+
e = !0;
|
|
450
|
+
let t = this.#s.pop();
|
|
451
|
+
if (this.#a.delete(t), t.disposed) continue;
|
|
452
|
+
let n = t.value, r = t.fn();
|
|
453
|
+
r !== n && (t.value = r, Oe(t.listeners));
|
|
454
|
+
}
|
|
455
|
+
for (; this.#c.length > 0;) {
|
|
456
|
+
e = !0;
|
|
457
|
+
let t = this.#c.pop();
|
|
458
|
+
this.#o.delete(t), !t.disposed && t.fn();
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
} finally {
|
|
462
|
+
this.#i = !1, this.#g();
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
whenPropagated(e = {}) {
|
|
467
|
+
if (this.#h()) return Promise.resolve();
|
|
468
|
+
let { signal: t, timeoutMs: n } = e;
|
|
469
|
+
return t?.aborted ? Promise.reject(/* @__PURE__ */ Error("whenPropagated aborted")) : new Promise((e, r) => {
|
|
470
|
+
let i = {
|
|
471
|
+
resolve: e,
|
|
472
|
+
reject: r
|
|
473
|
+
};
|
|
474
|
+
t && (i.abortHandler = () => {
|
|
475
|
+
this.#l.delete(i), r(/* @__PURE__ */ Error("whenPropagated aborted"));
|
|
476
|
+
}, t.addEventListener("abort", i.abortHandler, { once: !0 })), n != null && (i.timeoutId = setTimeout(() => {
|
|
477
|
+
this.#l.delete(i), i.abortHandler && t?.removeEventListener("abort", i.abortHandler), r(/* @__PURE__ */ Error("whenPropagated timeout after " + n + " ms"));
|
|
478
|
+
}, n)), this.#l.add(i);
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
#d(e) {
|
|
482
|
+
this.#a.has(e) || (this.#a.add(e), this.#s.push(e, this.#p(e.rank)), this.#m());
|
|
483
|
+
}
|
|
484
|
+
#f(e) {
|
|
485
|
+
this.#o.has(e) || (this.#o.add(e), this.#c.push(e, this.#p(e.rank)), this.#m());
|
|
486
|
+
}
|
|
487
|
+
#p(e) {
|
|
488
|
+
let t = this.#t % N;
|
|
489
|
+
return this.#t += 1, e * N + t;
|
|
490
|
+
}
|
|
491
|
+
#m() {
|
|
492
|
+
this.#n > 0 || this.#r || this.#i || (this.#r = !0, queueMicrotask(() => {
|
|
493
|
+
this.flushNow();
|
|
494
|
+
}));
|
|
495
|
+
}
|
|
496
|
+
#h() {
|
|
497
|
+
return this.#n === 0 && !this.#r && !this.#i && this.#s.length === 0 && this.#c.length === 0 && this.#a.size === 0 && this.#o.size === 0;
|
|
498
|
+
}
|
|
499
|
+
#g() {
|
|
500
|
+
if (this.#h()) {
|
|
501
|
+
for (let e of this.#l) e.timeoutId && clearTimeout(e.timeoutId), e.resolve();
|
|
502
|
+
this.#l.clear();
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}, Ae = class {
|
|
506
|
+
#e = 1;
|
|
507
|
+
#t = /* @__PURE__ */ new Map();
|
|
508
|
+
createOwner(e, t) {
|
|
509
|
+
let n = e + ":" + t + ":" + this.#e++;
|
|
510
|
+
return this.#t.set(n, /* @__PURE__ */ new Set()), n;
|
|
511
|
+
}
|
|
512
|
+
addDisposer(e, t) {
|
|
513
|
+
let n = this.#t.get(e);
|
|
514
|
+
if (!n) throw Error("Unknown owner: " + e);
|
|
515
|
+
n.add(t);
|
|
516
|
+
}
|
|
517
|
+
disposeOwner(e) {
|
|
518
|
+
let t = this.#t.get(e);
|
|
519
|
+
if (t) {
|
|
520
|
+
for (let e of t) e();
|
|
521
|
+
t.clear(), this.#t.delete(e);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}, je = class {
|
|
525
|
+
#e = 1;
|
|
526
|
+
#t = /* @__PURE__ */ new Map();
|
|
527
|
+
createRootScope(e) {
|
|
528
|
+
let t = "scope:" + this.#e++;
|
|
529
|
+
return this.#t.set(t, {
|
|
530
|
+
params: /* @__PURE__ */ new Map(),
|
|
531
|
+
ownerId: e
|
|
532
|
+
}), t;
|
|
533
|
+
}
|
|
534
|
+
createChildScope(e, t) {
|
|
535
|
+
if (!this.#t.has(t)) throw Error("Unknown parent scope: " + t);
|
|
536
|
+
let n = "scope:" + this.#e++;
|
|
537
|
+
return this.#t.set(n, {
|
|
538
|
+
parentScope: t,
|
|
539
|
+
params: /* @__PURE__ */ new Map(),
|
|
540
|
+
ownerId: e
|
|
541
|
+
}), n;
|
|
542
|
+
}
|
|
543
|
+
getOwnerId(e) {
|
|
544
|
+
let t = this.#t.get(e);
|
|
545
|
+
if (!t) throw Error("Unknown scope: " + e);
|
|
546
|
+
return t.ownerId;
|
|
547
|
+
}
|
|
548
|
+
clearScope(e) {
|
|
549
|
+
let t = this.#t.get(e);
|
|
550
|
+
if (!t) throw Error("Unknown scope: " + e);
|
|
551
|
+
t.params.clear();
|
|
552
|
+
}
|
|
553
|
+
register(e, t, n) {
|
|
554
|
+
a(t);
|
|
555
|
+
let r = this.#t.get(e);
|
|
556
|
+
if (!r) throw Error("Unknown scope: " + e);
|
|
557
|
+
if (r.params.has(t)) throw Error("Parameter \"" + t + "\" already exists in scope " + e);
|
|
558
|
+
return r.params.set(t, n), n;
|
|
559
|
+
}
|
|
560
|
+
resolve(e, t) {
|
|
561
|
+
a(t);
|
|
562
|
+
let n = e;
|
|
563
|
+
for (; n;) {
|
|
564
|
+
let e = this.#t.get(n);
|
|
565
|
+
if (!e) throw Error("Unknown scope: " + n);
|
|
566
|
+
let r = e.params.get(t);
|
|
567
|
+
if (r) return r;
|
|
568
|
+
n = e.parentScope;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
//#endregion
|
|
573
|
+
//#region ../core/src/paramRuntime/expressionCompiler.js
|
|
574
|
+
function Me(e, t = {}, n = {}) {
|
|
575
|
+
return p(e, t, n);
|
|
576
|
+
}
|
|
577
|
+
//#endregion
|
|
578
|
+
//#region ../core/src/paramRuntime/expressionRef.js
|
|
579
|
+
function Ne(e, t, n = {}) {
|
|
580
|
+
let r = {}, i = Me(e, r, n), a = /* @__PURE__ */ new Map();
|
|
581
|
+
for (let n of i.globals) {
|
|
582
|
+
if (a.has(n)) continue;
|
|
583
|
+
let i = t(n);
|
|
584
|
+
if (!i) throw Error("Unknown variable \"" + n + "\" in expression: " + e);
|
|
585
|
+
a.set(n, i), Object.defineProperty(r, n, {
|
|
586
|
+
enumerable: !0,
|
|
587
|
+
get() {
|
|
588
|
+
return i.get();
|
|
589
|
+
}
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
let o = /* @__PURE__ */ new Set();
|
|
593
|
+
return i.subscribe = (e) => {
|
|
594
|
+
let t = [];
|
|
595
|
+
for (let n of a.values()) t.push(n.subscribe(e));
|
|
596
|
+
for (let n of i.scaleDependencies ?? []) t.push(n.subscribe(e));
|
|
597
|
+
let n = !0, r = () => {
|
|
598
|
+
n && (n = !1, o.delete(r), t.forEach((e) => e()));
|
|
599
|
+
};
|
|
600
|
+
return o.add(r), r;
|
|
601
|
+
}, i.invalidate = () => {
|
|
602
|
+
for (let e of o) e();
|
|
603
|
+
o.clear();
|
|
604
|
+
}, i.identifier = () => i.code + "|" + Array.from(a.values()).map((e) => e.id).concat((i.scaleDependencies ?? []).map((e) => e.id)).join(","), {
|
|
605
|
+
expression: i,
|
|
606
|
+
dependencies: Array.from(a.values()).concat(i.scaleDependencies ?? [])
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
//#endregion
|
|
610
|
+
//#region ../core/src/paramRuntime/paramRuntime.js
|
|
611
|
+
var Pe = class {
|
|
612
|
+
#e = new Ae();
|
|
613
|
+
#t = new ke({ lifecycleRegistry: this.#e });
|
|
614
|
+
#n = new je();
|
|
615
|
+
createScope(e) {
|
|
616
|
+
let t = this.#e.createOwner("scope", e ?? "root");
|
|
617
|
+
return e ? this.#n.createChildScope(t, e) : this.#n.createRootScope(t);
|
|
618
|
+
}
|
|
619
|
+
disposeScope(e) {
|
|
620
|
+
let t = this.#n.getOwnerId(e);
|
|
621
|
+
this.#e.disposeOwner(t), this.#n.clearScope(e);
|
|
622
|
+
}
|
|
623
|
+
addScopeDisposer(e, t) {
|
|
624
|
+
let n = this.#n.getOwnerId(e);
|
|
625
|
+
this.#e.addDisposer(n, t);
|
|
626
|
+
}
|
|
627
|
+
registerBase(e, t, n, r) {
|
|
628
|
+
let i = this.#n.getOwnerId(e), a = this.#t.createWritable(i, t, "base", n, r);
|
|
629
|
+
return this.#n.register(e, t, a);
|
|
630
|
+
}
|
|
631
|
+
registerSelection(e, t, n, r) {
|
|
632
|
+
let i = this.#n.getOwnerId(e), a = this.#t.createWritable(i, t, "selection", n, r);
|
|
633
|
+
return this.#n.register(e, t, a);
|
|
634
|
+
}
|
|
635
|
+
registerDerived(e, t, n, r) {
|
|
636
|
+
let { expression: i, dependencies: a } = Ne(n, (t) => this.resolve(e, t), r), o = this.#n.getOwnerId(e), s = this.#t.computed(o, t, a, () => i(null));
|
|
637
|
+
return this.#n.register(e, t, s);
|
|
638
|
+
}
|
|
639
|
+
createExpression(e, t, n) {
|
|
640
|
+
let { expression: r } = Ne(t, (t) => this.resolve(e, t), n);
|
|
641
|
+
return r;
|
|
642
|
+
}
|
|
643
|
+
resolve(e, t) {
|
|
644
|
+
return this.#n.resolve(e, t);
|
|
645
|
+
}
|
|
646
|
+
runInTransaction(e) {
|
|
647
|
+
return this.#t.runInTransaction(e);
|
|
648
|
+
}
|
|
649
|
+
flushNow() {
|
|
650
|
+
this.#t.flushNow();
|
|
651
|
+
}
|
|
652
|
+
whenPropagated(e) {
|
|
653
|
+
return this.#t.whenPropagated(e);
|
|
654
|
+
}
|
|
655
|
+
}, Fe = (e) => new Promise((t) => setTimeout(t, e));
|
|
656
|
+
function Ie() {
|
|
657
|
+
return { canceled: !1 };
|
|
658
|
+
}
|
|
659
|
+
function Le(e) {
|
|
660
|
+
let t = e.requestAnimationFrame || window.requestAnimationFrame, n = e.signal, r = e.cancelToken, i = () => new Promise((i, a) => {
|
|
661
|
+
if (r?.canceled) return i();
|
|
662
|
+
if (n?.aborted) return a("aborted");
|
|
663
|
+
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) => {
|
|
664
|
+
if (r?.canceled) {
|
|
665
|
+
i();
|
|
666
|
+
return;
|
|
667
|
+
}
|
|
668
|
+
n?.aborted ? a("aborted") : (e.onUpdate(f(u(p(d(o))))), o < s ? t(m) : (e.onUpdate(f(u(1))), i()));
|
|
669
|
+
};
|
|
670
|
+
t(m);
|
|
671
|
+
});
|
|
672
|
+
return e.delay ? r?.canceled ? Promise.resolve() : n?.aborted ? Promise.reject("aborted") : Fe(e.delay).then(i) : i();
|
|
673
|
+
}
|
|
674
|
+
//#endregion
|
|
675
|
+
//#region ../core/src/utils/animator.js
|
|
676
|
+
var Re = class {
|
|
677
|
+
constructor(e) {
|
|
678
|
+
this._renderCallback = e, this._renderRequested = !1, this._finalized = !1, this._warn = !1, this._animationFrameRequest = void 0, this.transitions = [], this.transitionsEnabled = !0;
|
|
679
|
+
}
|
|
680
|
+
requestTransition(e) {
|
|
681
|
+
this._finalized || (this.cancelTransition(e), this.transitions.push(e), this.requestRender());
|
|
682
|
+
}
|
|
683
|
+
cancelTransition(e) {
|
|
684
|
+
let t = this.transitions.indexOf(e);
|
|
685
|
+
t >= 0 && this.transitions.splice(t, 1);
|
|
686
|
+
}
|
|
687
|
+
requestRender() {
|
|
688
|
+
this._finalized || (this._renderRequested ? this._warn && console.warn("Render already requested!") : (this._renderRequested = !0, this._animationFrameRequest = window.requestAnimationFrame((e) => {
|
|
689
|
+
if (this._animationFrameRequest = void 0, this._finalized) return;
|
|
690
|
+
this._renderRequested = !1;
|
|
691
|
+
let t = this.transitions;
|
|
692
|
+
this.transitions = [];
|
|
693
|
+
let n;
|
|
694
|
+
for (; n = t.shift();) n(e);
|
|
695
|
+
this._finalized || this._renderCallback(e);
|
|
696
|
+
})));
|
|
697
|
+
}
|
|
698
|
+
finalize() {
|
|
699
|
+
this._finalized = !0, this._renderRequested = !1, this.transitions = [], this._animationFrameRequest !== void 0 && (window.cancelAnimationFrame(this._animationFrameRequest), this._animationFrameRequest = void 0);
|
|
700
|
+
}
|
|
701
|
+
transition(e) {
|
|
702
|
+
return Le({
|
|
703
|
+
requestAnimationFrame: (e) => this.requestTransition(e),
|
|
704
|
+
...e
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
};
|
|
708
|
+
function ze(e, t, n, r, i) {
|
|
709
|
+
let a = 0, o = !0, s = !1, c = structuredClone(i), l = c;
|
|
710
|
+
function u(e, t, n, r) {
|
|
711
|
+
return t + (e - t) * 2 ** (-n / r);
|
|
712
|
+
}
|
|
713
|
+
function d(i) {
|
|
714
|
+
if (s = !1, o) return;
|
|
715
|
+
let d = i - a;
|
|
716
|
+
a = i;
|
|
717
|
+
for (let e of Object.keys(l)) c[e] = u(c[e], l[e], d, n);
|
|
718
|
+
t(c);
|
|
719
|
+
let p = -Infinity;
|
|
720
|
+
for (let e of Object.keys(l)) p = Math.max(p, Math.abs(l[e] - c[e]));
|
|
721
|
+
p < r ? (c = l, t(c), o = !0, p != 0 && e.requestRender()) : f();
|
|
722
|
+
}
|
|
723
|
+
function f() {
|
|
724
|
+
s || (s = !0, e.requestTransition(d));
|
|
725
|
+
}
|
|
726
|
+
function p(n) {
|
|
727
|
+
l = n, e.transitionsEnabled === !1 ? (c = l, o = !0, s = !1, e.cancelTransition(d), t(c)) : o && (o = !1, a = Be(), d(a));
|
|
728
|
+
}
|
|
729
|
+
return p.stop = () => {
|
|
730
|
+
o = !0, s = !1, e.cancelTransition(d);
|
|
731
|
+
}, p.snap = (e) => {
|
|
732
|
+
l = e, c = e, p.stop(), t(c);
|
|
733
|
+
}, p;
|
|
734
|
+
}
|
|
735
|
+
function Be() {
|
|
736
|
+
let e = globalThis.document?.timeline?.currentTime;
|
|
737
|
+
return typeof e == "number" ? e : performance.now();
|
|
738
|
+
}
|
|
739
|
+
//#endregion
|
|
740
|
+
//#region ../core/src/paramRuntime/viewParamRuntime.js
|
|
741
|
+
var P = class {
|
|
742
|
+
#e;
|
|
743
|
+
#t;
|
|
744
|
+
#n = /* @__PURE__ */ new Map();
|
|
745
|
+
#r = /* @__PURE__ */ new Map();
|
|
746
|
+
#i = /* @__PURE__ */ new Map();
|
|
747
|
+
#a = /* @__PURE__ */ new Map();
|
|
748
|
+
#o;
|
|
749
|
+
#s;
|
|
750
|
+
#c;
|
|
751
|
+
#l;
|
|
752
|
+
#u = !1;
|
|
753
|
+
constructor(e, t, n, r = {}) {
|
|
754
|
+
this.#o = e ?? (() => void 0), this.#s = t ?? (() => void 0), this.#c = n, this.#l = r.snapTransitionedUpdates ?? !1;
|
|
755
|
+
let i = this.#o();
|
|
756
|
+
i ? (this.#e = i.#e, this.#t = this.#e.createScope(i.#t)) : (this.#e = new Pe(), this.#t = this.#e.createScope());
|
|
757
|
+
}
|
|
758
|
+
registerParam(e) {
|
|
759
|
+
let t = e.name;
|
|
760
|
+
if (a(t), this.#i.has(t)) throw Error("Parameter \"" + t + "\" already registered in this scope.");
|
|
761
|
+
He(e);
|
|
762
|
+
let n, r;
|
|
763
|
+
if (e.push == "outer") {
|
|
764
|
+
let i = this.findRuntimeForParam(t);
|
|
765
|
+
if (!i) throw Error(`Parameter "${t}" not found in outer scope!`);
|
|
766
|
+
let a = i.paramConfigs.get(t);
|
|
767
|
+
if (!a) throw Error(`Outer parameter "${t}" exists as a value but has no registered config.`);
|
|
768
|
+
if ("expr" in a || "select" in a || "ruler" in a) throw Error(`The outer parameter "${t}" must not have expr, select, or ruler properties!`);
|
|
769
|
+
n = (e) => {
|
|
770
|
+
i.setValue(t, e);
|
|
771
|
+
}, this.#n.set(t, n), "ruler" in e && (r = o(e, this), n(r));
|
|
772
|
+
} else if ("value" in e) r = o(e, this), n = "transition" in e ? this.#f(t, r, e.transition) : this.#d(t, r);
|
|
773
|
+
else if ("expr" in e) {
|
|
774
|
+
if ("transition" in e) this.#p(t, e.expr, e.transition);
|
|
775
|
+
else {
|
|
776
|
+
let n = this.#e.registerDerived(this.#t, t, e.expr, { resolveScaleResolution: this.#s });
|
|
777
|
+
this.#r.set(t, n);
|
|
778
|
+
}
|
|
779
|
+
n = () => {
|
|
780
|
+
throw Error("Cannot set derived parameter \"" + t + "\".");
|
|
781
|
+
};
|
|
782
|
+
} else r = o(e, this), n = this.#d(t, r);
|
|
783
|
+
if ("select" in e) {
|
|
784
|
+
if (r ??= o(e, this), !this.#n.has(t)) {
|
|
785
|
+
let e = this.#e.registerSelection(this.#t, t, r);
|
|
786
|
+
this.#r.set(t, e), this.#n.set(t, (t) => {
|
|
787
|
+
e.set(t), this.#e.flushNow();
|
|
788
|
+
}), n = this.#n.get(t);
|
|
789
|
+
}
|
|
790
|
+
n(r);
|
|
791
|
+
}
|
|
792
|
+
return this.#i.set(t, e), n;
|
|
793
|
+
}
|
|
794
|
+
allocateSetter(e, t, n = !1) {
|
|
795
|
+
if (a(e), this.#n.has(e)) throw Error("Setter already allocated for parameter: " + e);
|
|
796
|
+
let r = this.#e.registerBase(this.#t, e, t, { notify: !n });
|
|
797
|
+
this.#r.set(e, r);
|
|
798
|
+
let i = (e) => {
|
|
799
|
+
r.set(e), this.#e.flushNow();
|
|
800
|
+
};
|
|
801
|
+
return this.#n.set(e, i), i;
|
|
802
|
+
}
|
|
803
|
+
setValue(e, t, n) {
|
|
804
|
+
a(e);
|
|
805
|
+
let r = this.#n.get(e);
|
|
806
|
+
if (!r) throw Error("Writable parameter not found in this scope: " + e);
|
|
807
|
+
r(t, n);
|
|
808
|
+
}
|
|
809
|
+
getValue(e) {
|
|
810
|
+
return this.#r.get(e)?.get();
|
|
811
|
+
}
|
|
812
|
+
getTargetValue(e) {
|
|
813
|
+
return a(e), this.#a.get(e)?.target ?? this.getValue(e);
|
|
814
|
+
}
|
|
815
|
+
subscribe(e, t) {
|
|
816
|
+
a(e);
|
|
817
|
+
let n = this.findRuntimeForParam(e);
|
|
818
|
+
if (!n) throw Error("Parameter not found: " + e);
|
|
819
|
+
let r = n.#r.get(e);
|
|
820
|
+
if (!r) throw Error("Parameter found without local reference: " + e);
|
|
821
|
+
return r.subscribe(t);
|
|
822
|
+
}
|
|
823
|
+
findValue(e) {
|
|
824
|
+
return this.findRuntimeForParam(e)?.getValue(e);
|
|
825
|
+
}
|
|
826
|
+
findTargetValue(e) {
|
|
827
|
+
return this.findRuntimeForParam(e)?.getTargetValue(e);
|
|
828
|
+
}
|
|
829
|
+
get paramConfigs() {
|
|
830
|
+
return this.#i;
|
|
831
|
+
}
|
|
832
|
+
hasLocalParam(e) {
|
|
833
|
+
return a(e), this.#r.has(e);
|
|
834
|
+
}
|
|
835
|
+
hasConfiguredParamInScopeChain(e) {
|
|
836
|
+
return a(e), this.#i.has(e) ? !0 : this.#o()?.hasConfiguredParamInScopeChain(e) ?? !1;
|
|
837
|
+
}
|
|
838
|
+
findRuntimeForParam(e) {
|
|
839
|
+
return this.#r.has(e) ? this : this.#o()?.findRuntimeForParam(e);
|
|
840
|
+
}
|
|
841
|
+
getDebugState() {
|
|
842
|
+
let e = [];
|
|
843
|
+
for (let [t, n] of this.#r) {
|
|
844
|
+
let r = this.#i.get(t);
|
|
845
|
+
e.push({
|
|
846
|
+
name: t,
|
|
847
|
+
kind: Ve(r),
|
|
848
|
+
value: n.get(),
|
|
849
|
+
writable: this.#n.has(t),
|
|
850
|
+
configured: !!r,
|
|
851
|
+
config: r ? structuredClone(r) : void 0,
|
|
852
|
+
target: this.#a.get(t)?.target
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
return {
|
|
856
|
+
scopeId: this.#t,
|
|
857
|
+
disposed: this.#u,
|
|
858
|
+
params: e
|
|
859
|
+
};
|
|
860
|
+
}
|
|
861
|
+
createExpression(e) {
|
|
862
|
+
return this.#e.createExpression(this.#t, e, { resolveScaleResolution: this.#s });
|
|
863
|
+
}
|
|
864
|
+
watchExpression(e, t, n = {}) {
|
|
865
|
+
let r = this.createExpression(e), i = r.subscribe(t);
|
|
866
|
+
return (n.scopeOwned ?? !0) && this.#e.addScopeDisposer(this.#t, i), n.registerDisposer?.(i), r;
|
|
867
|
+
}
|
|
868
|
+
#d(e, t) {
|
|
869
|
+
let n = this.#e.registerBase(this.#t, e, t);
|
|
870
|
+
this.#r.set(e, n);
|
|
871
|
+
let r = (e) => {
|
|
872
|
+
n.set(e), this.#e.flushNow();
|
|
873
|
+
};
|
|
874
|
+
return this.#n.set(e, r), r;
|
|
875
|
+
}
|
|
876
|
+
#f(e, t, n) {
|
|
877
|
+
let r = this.#m(e, t, n), i = (t, n) => {
|
|
878
|
+
this.#h(e, r, t, n);
|
|
879
|
+
};
|
|
880
|
+
return this.#n.set(e, i), i;
|
|
881
|
+
}
|
|
882
|
+
#p(e, t, n) {
|
|
883
|
+
let r = this.createExpression(t), i = this.#m(e, r(null), n), a = r.subscribe(() => {
|
|
884
|
+
this.#h(e, i, r(null), { animate: !this.#l });
|
|
885
|
+
});
|
|
886
|
+
this.#e.addScopeDisposer(this.#t, a);
|
|
887
|
+
}
|
|
888
|
+
#m(e, t, n) {
|
|
889
|
+
let r = F(e, t), i = this.#e.registerBase(this.#t, e, r);
|
|
890
|
+
this.#r.set(e, i);
|
|
891
|
+
let a = this.#c;
|
|
892
|
+
if (!a) throw Error(`The parameter "${e}" uses transition but no animator is available.`);
|
|
893
|
+
let o = ze(a, ({ value: e }) => {
|
|
894
|
+
i.set(e), this.#e.flushNow();
|
|
895
|
+
}, n.halfLife ?? 80, n.epsilon ?? .01, { value: i.get() }), s = {
|
|
896
|
+
target: i.get(),
|
|
897
|
+
smoother: o,
|
|
898
|
+
dispose: () => {
|
|
899
|
+
o.stop(), this.#a.delete(e);
|
|
900
|
+
}
|
|
901
|
+
};
|
|
902
|
+
return this.#a.set(e, s), this.#e.addScopeDisposer(this.#t, s.dispose), s;
|
|
903
|
+
}
|
|
904
|
+
#h(e, t, n, r = {}) {
|
|
905
|
+
let i = F(e, n);
|
|
906
|
+
t.target = i, r.animate === !1 ? t.smoother.snap({ value: i }) : t.smoother({ value: i });
|
|
907
|
+
}
|
|
908
|
+
evaluateAndGet(e) {
|
|
909
|
+
return this.createExpression(e)();
|
|
910
|
+
}
|
|
911
|
+
runInTransaction(e) {
|
|
912
|
+
return this.#e.runInTransaction(e);
|
|
913
|
+
}
|
|
914
|
+
flushNow() {
|
|
915
|
+
this.#e.flushNow();
|
|
916
|
+
}
|
|
917
|
+
whenPropagated(e) {
|
|
918
|
+
return this.#e.whenPropagated(e);
|
|
919
|
+
}
|
|
920
|
+
finalizeInitialization() {
|
|
921
|
+
this.#l = !1;
|
|
922
|
+
}
|
|
923
|
+
dispose() {
|
|
924
|
+
this.#u || (this.#u = !0, this.#e.disposeScope(this.#t), this.#n.clear(), this.#r.clear(), this.#i.clear(), this.#a.clear());
|
|
925
|
+
}
|
|
926
|
+
hasPointSelections() {
|
|
927
|
+
for (let e of this.#i.values()) if (s(e)) {
|
|
928
|
+
let t = e.select;
|
|
929
|
+
if (c(t)) {
|
|
930
|
+
if (t == "point") return !0;
|
|
931
|
+
} else if (t.type == "point") return !0;
|
|
932
|
+
}
|
|
933
|
+
return !1;
|
|
934
|
+
}
|
|
935
|
+
};
|
|
936
|
+
function Ve(e) {
|
|
937
|
+
return e ? e.push === "outer" ? "push" : "select" in e ? "selection" : "ruler" in e ? "ruler" : "expr" in e ? "derived" : "base" : "auto";
|
|
938
|
+
}
|
|
939
|
+
function He(e) {
|
|
940
|
+
let t = e.name;
|
|
941
|
+
if ("value" in e && "expr" in e) throw Error(`The parameter "${t}" must not have both value and expr properties!`);
|
|
942
|
+
if ("expr" in e && "bind" in e) throw Error(`The parameter "${t}" must not have both expr and bind properties!`);
|
|
943
|
+
if (!("transition" in e)) return;
|
|
944
|
+
if ("select" in e || "ruler" in e || e.push === "outer") throw Error(`The parameter "${t}" must not use transition with select, ruler, or push.`);
|
|
945
|
+
if (!("value" in e || "expr" in e)) throw Error(`The transitioned parameter "${t}" must have a value or expr property.`);
|
|
946
|
+
let n = e.transition;
|
|
947
|
+
if (!n) throw Error(`The parameter "${t}" must have a transition configuration.`);
|
|
948
|
+
if (n.type !== "lerp") throw Error(`Unsupported transition type for parameter "${t}": ${n.type}`);
|
|
949
|
+
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.`);
|
|
950
|
+
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.`);
|
|
951
|
+
}
|
|
952
|
+
function F(e, t) {
|
|
953
|
+
if (typeof t != "number" || !Number.isFinite(t)) throw Error(`Transitioned parameter "${e}" must have a finite numeric value.`);
|
|
954
|
+
return t;
|
|
955
|
+
}
|
|
956
|
+
//#endregion
|
|
957
|
+
//#region ../core/src/utils/addBaseUrl.js
|
|
958
|
+
function Ue(e, t) {
|
|
959
|
+
return !t || /^(data:|([A-Za-z]+:)?\/\/)/.test(e) || e.startsWith("/") ? e : (t.endsWith("/") || (t += "/"), t + e);
|
|
960
|
+
}
|
|
961
|
+
function We(e) {
|
|
962
|
+
if (!e) return e;
|
|
963
|
+
if (/[?#]/.test(e)) throw Error(`Invalid base URL: ${e} - cannot contain query or hash.`);
|
|
964
|
+
return e.endsWith("/") ? e : e + "/";
|
|
965
|
+
}
|
|
966
|
+
//#endregion
|
|
967
|
+
//#region ../core/src/config/mergeConfig.js
|
|
968
|
+
function I(e) {
|
|
969
|
+
return l(e) && !Array.isArray(e);
|
|
970
|
+
}
|
|
971
|
+
function Ge(e) {
|
|
972
|
+
let t = {};
|
|
973
|
+
for (let [n, r] of Object.entries(e)) t[n] = L(r);
|
|
974
|
+
return t;
|
|
975
|
+
}
|
|
976
|
+
function L(e) {
|
|
977
|
+
return Array.isArray(e) ? e.map(L) : I(e) ? Ge(e) : e;
|
|
978
|
+
}
|
|
979
|
+
function R(e, t) {
|
|
980
|
+
for (let [n, r] of Object.entries(t)) {
|
|
981
|
+
if (r === void 0) continue;
|
|
982
|
+
let t = e[n];
|
|
983
|
+
I(r) && I(t) ? R(t, r) : e[n] = L(r);
|
|
984
|
+
}
|
|
985
|
+
return e;
|
|
986
|
+
}
|
|
987
|
+
function z(e) {
|
|
988
|
+
let t = {};
|
|
989
|
+
for (let n of e) n && R(t, n);
|
|
990
|
+
return t;
|
|
991
|
+
}
|
|
992
|
+
//#endregion
|
|
993
|
+
//#region ../core/src/view/viewChrome.js
|
|
994
|
+
var B = /* @__PURE__ */ new WeakMap();
|
|
995
|
+
function Ke(e, t) {
|
|
996
|
+
B.set(e, t);
|
|
997
|
+
}
|
|
998
|
+
function qe(e) {
|
|
999
|
+
return B.get(e);
|
|
1000
|
+
}
|
|
1001
|
+
function V(e) {
|
|
1002
|
+
return B.has(e);
|
|
1003
|
+
}
|
|
1004
|
+
function H(e) {
|
|
1005
|
+
let t = e;
|
|
1006
|
+
for (; t;) {
|
|
1007
|
+
let n = B.get(t);
|
|
1008
|
+
if (n === "excludeSubtree" || t === e && n === "exclude") return !0;
|
|
1009
|
+
t = t.layoutParent;
|
|
1010
|
+
}
|
|
1011
|
+
return !1;
|
|
1012
|
+
}
|
|
1013
|
+
//#endregion
|
|
1014
|
+
//#region ../core/src/view/postScaleParams.js
|
|
1015
|
+
var U = /* @__PURE__ */ new WeakMap();
|
|
1016
|
+
function Je(e, t) {
|
|
1017
|
+
U.set(e, t);
|
|
1018
|
+
}
|
|
1019
|
+
function Ye(e) {
|
|
1020
|
+
return U.get(e);
|
|
1021
|
+
}
|
|
1022
|
+
//#endregion
|
|
1023
|
+
//#region ../core/src/data/namedDataScope.js
|
|
1024
|
+
var Xe = class {
|
|
1025
|
+
name;
|
|
1026
|
+
owner;
|
|
1027
|
+
getDefaultData;
|
|
1028
|
+
#e;
|
|
1029
|
+
#t = !1;
|
|
1030
|
+
#n = 0;
|
|
1031
|
+
#r = !1;
|
|
1032
|
+
constructor(e, t, n) {
|
|
1033
|
+
this.name = e, this.owner = t, this.getDefaultData = n;
|
|
1034
|
+
}
|
|
1035
|
+
get disposed() {
|
|
1036
|
+
return this.#r;
|
|
1037
|
+
}
|
|
1038
|
+
beginUpdate() {
|
|
1039
|
+
if (this.#r) throw Error(`Named dataset "${this.name}" has been disposed.`);
|
|
1040
|
+
return ++this.#n;
|
|
1041
|
+
}
|
|
1042
|
+
isCurrentUpdate(e) {
|
|
1043
|
+
return !this.#r && e === this.#n;
|
|
1044
|
+
}
|
|
1045
|
+
getData() {
|
|
1046
|
+
if (this.#r) throw Error(`Named dataset "${this.name}" has been disposed.`);
|
|
1047
|
+
let e = this.#t ? this.#e : this.getDefaultData();
|
|
1048
|
+
if (e === void 0) return [];
|
|
1049
|
+
if (!Array.isArray(e)) throw Error(`Named data "${this.name}" is not an array!`);
|
|
1050
|
+
return e;
|
|
1051
|
+
}
|
|
1052
|
+
setData(e) {
|
|
1053
|
+
if (!Array.isArray(e)) throw Error(`Named data "${this.name}" is not an array!`);
|
|
1054
|
+
this.#e = e, this.#t = !0;
|
|
1055
|
+
}
|
|
1056
|
+
resetData() {
|
|
1057
|
+
this.#e = void 0, this.#t = !1;
|
|
1058
|
+
}
|
|
1059
|
+
dispose() {
|
|
1060
|
+
this.#e = void 0, this.#t = !1, this.#n++, this.#r = !0;
|
|
1061
|
+
}
|
|
1062
|
+
}, Ze = class {
|
|
1063
|
+
view;
|
|
1064
|
+
#e = /* @__PURE__ */ new Map();
|
|
1065
|
+
#t = /* @__PURE__ */ new Map();
|
|
1066
|
+
constructor(e) {
|
|
1067
|
+
this.view = e;
|
|
1068
|
+
for (let [t, n] of Object.entries(e.spec.datasets ?? {})) this.#e.set(t, new Xe(t, e, () => n));
|
|
1069
|
+
}
|
|
1070
|
+
getLocalBinding(e) {
|
|
1071
|
+
return this.#e.get(e);
|
|
1072
|
+
}
|
|
1073
|
+
findDeclaredBinding(e) {
|
|
1074
|
+
return this.#e.get(e) || this.view.dataParent?.namedDataScope.findDeclaredBinding(e);
|
|
1075
|
+
}
|
|
1076
|
+
resolve(e) {
|
|
1077
|
+
let t = this.#e.get(e);
|
|
1078
|
+
if (t) return t;
|
|
1079
|
+
let n = this.view.dataParent?.namedDataScope;
|
|
1080
|
+
if (n) return n.resolve(e);
|
|
1081
|
+
let r = this.#t.get(e);
|
|
1082
|
+
return r || (r = new Xe(e, void 0, () => this.view.context.getNamedDataFromProvider(e)), this.#t.set(e, r)), r;
|
|
1083
|
+
}
|
|
1084
|
+
dispose() {
|
|
1085
|
+
for (let e of this.#e.values()) e.dispose();
|
|
1086
|
+
this.#e.clear();
|
|
1087
|
+
for (let e of this.#t.values()) e.dispose();
|
|
1088
|
+
this.#t.clear();
|
|
1089
|
+
}
|
|
1090
|
+
}, W = "VISIT_SKIP", G = "VISIT_STOP", K = (e) => e, Qe = class {
|
|
1091
|
+
spec;
|
|
1092
|
+
namedDataScope;
|
|
1093
|
+
#e;
|
|
1094
|
+
#t;
|
|
1095
|
+
#n = {};
|
|
1096
|
+
#r = {};
|
|
1097
|
+
#i = {};
|
|
1098
|
+
#a;
|
|
1099
|
+
#o;
|
|
1100
|
+
#s = !1;
|
|
1101
|
+
#c = !1;
|
|
1102
|
+
#l = void 0;
|
|
1103
|
+
#u = !1;
|
|
1104
|
+
#d = [];
|
|
1105
|
+
opacityFunction = K;
|
|
1106
|
+
#f = [];
|
|
1107
|
+
#p = "none";
|
|
1108
|
+
#m = /* @__PURE__ */ new Map();
|
|
1109
|
+
facetCoords = new ie([], JSON.stringify);
|
|
1110
|
+
constructor(e, t, n, r, i, a = {}) {
|
|
1111
|
+
if (!e) throw Error("View spec must be defined!");
|
|
1112
|
+
if (this.context = t, this.layoutParent = n, this.dataParent = r, this.#t = i, this.spec = e, this.namedDataScope = new Ze(this), r && e.theme !== void 0) throw Error("\"theme\" is only supported at the root specification. Use \"config\" and \"style\" for subtree customization.");
|
|
1113
|
+
let o = r ? r.getConfigScopes() : [t.getBaseConfig()], s = e.config;
|
|
1114
|
+
if (this.#e = [...o, s].filter((e) => !!e), this.resolutions = {
|
|
1115
|
+
scale: {},
|
|
1116
|
+
axis: {},
|
|
1117
|
+
legend: {}
|
|
1118
|
+
}, ne(this), this.options = {
|
|
1119
|
+
inheritEncoding: !1,
|
|
1120
|
+
layoutSizeParams: "own",
|
|
1121
|
+
...a
|
|
1122
|
+
}, this.flowHandle = void 0, this.needsAxes = {
|
|
1123
|
+
x: !1,
|
|
1124
|
+
y: !1
|
|
1125
|
+
}, this.paramRuntime = new P(() => this.dataParent?.paramRuntime, (e) => this.getScaleResolution(e), t.animator, { snapTransitionedUpdates: !0 }), e.params) {
|
|
1126
|
+
let t = /* @__PURE__ */ new Set();
|
|
1127
|
+
for (let n of e.params) {
|
|
1128
|
+
if ("expr" in n) {
|
|
1129
|
+
let { usesScaleHelper: e, globals: r } = d(n.expr), i = r.some((e) => t.has(e));
|
|
1130
|
+
if (e || i) {
|
|
1131
|
+
t.add(n.name), this.#d.push(n);
|
|
1132
|
+
continue;
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
this.paramRuntime.registerParam(n);
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
this.options.layoutSizeParams !== "inherit" && (this.#a = this.#h("width"), this.#o = this.#h("height"));
|
|
1139
|
+
}
|
|
1140
|
+
#h(e) {
|
|
1141
|
+
if (!(this.paramRuntime.hasLocalParam(e) || this.options.layoutSizeParams != "force" && this.paramRuntime.hasConfiguredParamInScopeChain(e))) return this.paramRuntime.allocateSetter(e, 0);
|
|
1142
|
+
}
|
|
1143
|
+
get name() {
|
|
1144
|
+
return this.spec.name ?? this.#t;
|
|
1145
|
+
}
|
|
1146
|
+
get explicitName() {
|
|
1147
|
+
return this.spec.name;
|
|
1148
|
+
}
|
|
1149
|
+
getZindex() {
|
|
1150
|
+
return this.spec.zindex ?? 0;
|
|
1151
|
+
}
|
|
1152
|
+
get defaultName() {
|
|
1153
|
+
return this.#t;
|
|
1154
|
+
}
|
|
1155
|
+
getConfig() {
|
|
1156
|
+
return z(this.#e);
|
|
1157
|
+
}
|
|
1158
|
+
getCursorSpec() {
|
|
1159
|
+
return this.spec.cursor;
|
|
1160
|
+
}
|
|
1161
|
+
getCursor() {
|
|
1162
|
+
let t = this.getCursorSpec();
|
|
1163
|
+
return e(t) ? this.paramRuntime.evaluateAndGet(t.expr) : t;
|
|
1164
|
+
}
|
|
1165
|
+
watchCursor(t, n) {
|
|
1166
|
+
let r = this.getCursorSpec();
|
|
1167
|
+
e(r) && this.paramRuntime.watchExpression(r.expr, t, {
|
|
1168
|
+
scopeOwned: !1,
|
|
1169
|
+
registerDisposer: n
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1172
|
+
getConfigScopes() {
|
|
1173
|
+
return this.#e.slice();
|
|
1174
|
+
}
|
|
1175
|
+
get coords() {
|
|
1176
|
+
return this.facetCoords.values().next().value;
|
|
1177
|
+
}
|
|
1178
|
+
getPadding() {
|
|
1179
|
+
return this._cache("size/padding", () => O.createFromConfig(this.spec.padding));
|
|
1180
|
+
}
|
|
1181
|
+
getOverhang() {
|
|
1182
|
+
return O.zero();
|
|
1183
|
+
}
|
|
1184
|
+
isScrollable() {
|
|
1185
|
+
return this.spec.viewportWidth != null || this.spec.viewportHeight != null;
|
|
1186
|
+
}
|
|
1187
|
+
getSize() {
|
|
1188
|
+
return this._cache("size/size", () => this.isConfiguredVisible() ? new y(this.#g("width"), this.#g("height")) : de);
|
|
1189
|
+
}
|
|
1190
|
+
getViewportSize() {
|
|
1191
|
+
if (!this.isScrollable()) return this.getSize();
|
|
1192
|
+
if (!this.isConfiguredVisible()) return de;
|
|
1193
|
+
let e = this.getSize();
|
|
1194
|
+
return new y(this.#g("viewportWidth") ?? e.width, this.#g("viewportHeight") ?? e.height);
|
|
1195
|
+
}
|
|
1196
|
+
#g(e) {
|
|
1197
|
+
let { value: t, implicit: n } = this.#_(e), r = this.resolveSizeValue(e, t), i = q(r), a = e == "viewportWidth" || e == "viewportHeight";
|
|
1198
|
+
if (i) {
|
|
1199
|
+
if (a) throw new _(`Cannot use step-based size with "${e}"!`, this);
|
|
1200
|
+
let t = this.#x(e, r), i = this.getScaleResolution(e == "width" ? "x" : "y")?.getScale();
|
|
1201
|
+
if (i) {
|
|
1202
|
+
let n;
|
|
1203
|
+
if (v(i.type)) n = i.domain().length;
|
|
1204
|
+
else if (["locus", "index"].includes(i.type)) {
|
|
1205
|
+
let e = i.domain();
|
|
1206
|
+
n = ee(e) - e[0];
|
|
1207
|
+
} else throw new _(`Cannot use step-based size with "${i.type}" scale!`, this);
|
|
1208
|
+
let a = i;
|
|
1209
|
+
n = ae(n, a.paddingInner(), a.paddingOuter());
|
|
1210
|
+
let o = e == "width" ? "xOffset" : "yOffset", s = this.getScaleResolution(o)?.getScale(), c = r.for ?? (s && v(s.type) ? "offset" : "position"), l = t;
|
|
1211
|
+
if (c == "offset") {
|
|
1212
|
+
if (!s || !v(s.type)) throw new _(`Cannot use ${e}.step.for = "offset" without a discrete ${o} scale!`, this);
|
|
1213
|
+
let t = s, n = ae(s.domain().length, t.paddingInner(), t.paddingOuter());
|
|
1214
|
+
l *= n / (1 - a.paddingInner());
|
|
1215
|
+
}
|
|
1216
|
+
return {
|
|
1217
|
+
px: n * l,
|
|
1218
|
+
grow: 0
|
|
1219
|
+
};
|
|
1220
|
+
} else if (n) return {
|
|
1221
|
+
px: t,
|
|
1222
|
+
grow: 0
|
|
1223
|
+
};
|
|
1224
|
+
else throw new _(`Cannot use step-based size with "${e}"!`, this);
|
|
1225
|
+
} else return (r && me(r)) ?? (a ? void 0 : {
|
|
1226
|
+
px: 0,
|
|
1227
|
+
grow: 1
|
|
1228
|
+
});
|
|
1229
|
+
}
|
|
1230
|
+
#_(e) {
|
|
1231
|
+
let t = this.spec[e];
|
|
1232
|
+
return t != null || e == "viewportWidth" || e == "viewportHeight" ? {
|
|
1233
|
+
value: t,
|
|
1234
|
+
implicit: !1
|
|
1235
|
+
} : {
|
|
1236
|
+
value: this.#v(e),
|
|
1237
|
+
implicit: !0
|
|
1238
|
+
};
|
|
1239
|
+
}
|
|
1240
|
+
#v(e) {
|
|
1241
|
+
if (H(this)) return;
|
|
1242
|
+
let t = this.getConfig().view;
|
|
1243
|
+
if (!t) return;
|
|
1244
|
+
let n = e == "width" ? "x" : "y", r = this.getScaleResolution(n)?.getResolvedScaleType();
|
|
1245
|
+
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 });
|
|
1246
|
+
}
|
|
1247
|
+
resolveSizeValue(t, n) {
|
|
1248
|
+
if (!e(n)) return n;
|
|
1249
|
+
let r = this.#C(t)();
|
|
1250
|
+
if (rt(r) || r === "container") return r;
|
|
1251
|
+
throw new _(`"${t}" ExprRef must resolve to a finite number or "container"!`, this);
|
|
1252
|
+
}
|
|
1253
|
+
registerSizeInvalidation() {
|
|
1254
|
+
this.#y("width", "x"), this.#y("height", "y"), this.#b("width"), this.#b("height"), this.#b("viewportWidth"), this.#b("viewportHeight");
|
|
1255
|
+
}
|
|
1256
|
+
#y(e, t) {
|
|
1257
|
+
let { value: n, implicit: r } = this.#_(e);
|
|
1258
|
+
if (!q(n)) return;
|
|
1259
|
+
let i = this.getScaleResolution(t);
|
|
1260
|
+
if (!i) {
|
|
1261
|
+
if (r) return;
|
|
1262
|
+
throw new _("Cannot use 'step' size without a scale!", this);
|
|
1263
|
+
}
|
|
1264
|
+
let a = () => {
|
|
1265
|
+
let t = this.getSize()[e];
|
|
1266
|
+
this.invalidateSizeCache();
|
|
1267
|
+
let n = this.getSize()[e];
|
|
1268
|
+
fe(t, n) || this.context.requestLayoutReflow();
|
|
1269
|
+
};
|
|
1270
|
+
if (i.addEventListener("domain", a), this.registerDisposer(() => i.removeEventListener("domain", a)), n.for != "position") {
|
|
1271
|
+
let t = e == "width" ? "xOffset" : "yOffset", n = this.getScaleResolution(t);
|
|
1272
|
+
n && v(n.getResolvedScaleType()) && (n.addEventListener("domain", a), this.registerDisposer(() => n.removeEventListener("domain", a)));
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
#b(t) {
|
|
1276
|
+
let { value: n } = this.#_(t);
|
|
1277
|
+
e(n) ? this.#S(t, n.expr) : q(n) && e(n.step) && this.#S(t + ".step", n.step.expr);
|
|
1278
|
+
}
|
|
1279
|
+
#x(t, n) {
|
|
1280
|
+
let r = e(n.step) ? this.#C(t + ".step")() : n.step;
|
|
1281
|
+
if (rt(r)) return r;
|
|
1282
|
+
throw new _(`"${t}.step" ExprRef must resolve to a finite number!`, this);
|
|
1283
|
+
}
|
|
1284
|
+
#S(e, t) {
|
|
1285
|
+
if (!this.#m.has(e)) {
|
|
1286
|
+
let n = this.paramRuntime.watchExpression(t, () => {
|
|
1287
|
+
this.invalidateSizeCache(), this.context.requestLayoutReflow();
|
|
1288
|
+
});
|
|
1289
|
+
this.#m.set(e, n);
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
#C(e) {
|
|
1293
|
+
let t = this.#m.get(e);
|
|
1294
|
+
if (!t) throw new _(`"${e}" ExprRef was not registered before layout!`, this);
|
|
1295
|
+
return t;
|
|
1296
|
+
}
|
|
1297
|
+
isConfiguredVisible() {
|
|
1298
|
+
return this.context.isViewConfiguredVisible(this);
|
|
1299
|
+
}
|
|
1300
|
+
isVisibleInSpec() {
|
|
1301
|
+
return this.spec.visible ?? !0;
|
|
1302
|
+
}
|
|
1303
|
+
isVisible() {
|
|
1304
|
+
return this.getLayoutAncestors().every((e) => e.isConfiguredVisible());
|
|
1305
|
+
}
|
|
1306
|
+
isDomainInert() {
|
|
1307
|
+
if (this.spec.domainInert) return !0;
|
|
1308
|
+
let e = this.dataParent;
|
|
1309
|
+
return e ? e.isDomainInert() : !1;
|
|
1310
|
+
}
|
|
1311
|
+
getDataInitializationState() {
|
|
1312
|
+
return this.#p;
|
|
1313
|
+
}
|
|
1314
|
+
_setDataInitializationState(e) {
|
|
1315
|
+
this.#p = e;
|
|
1316
|
+
}
|
|
1317
|
+
isDataInitialized() {
|
|
1318
|
+
return this.#p === "ready";
|
|
1319
|
+
}
|
|
1320
|
+
getEffectiveOpacity() {
|
|
1321
|
+
return this.opacityFunction(this.layoutParent?.getEffectiveOpacity() ?? 1);
|
|
1322
|
+
}
|
|
1323
|
+
getOpacity() {
|
|
1324
|
+
return this.opacityFunction(1);
|
|
1325
|
+
}
|
|
1326
|
+
hasLocalOpacity() {
|
|
1327
|
+
return this.opacityFunction !== K;
|
|
1328
|
+
}
|
|
1329
|
+
getPathString() {
|
|
1330
|
+
return this.getLayoutAncestors().map((e) => e.name).reverse().join("/");
|
|
1331
|
+
}
|
|
1332
|
+
#w(e) {
|
|
1333
|
+
let t = [], n = this;
|
|
1334
|
+
do
|
|
1335
|
+
t.push(n), n = n[e];
|
|
1336
|
+
while (n);
|
|
1337
|
+
return t;
|
|
1338
|
+
}
|
|
1339
|
+
getLayoutAncestors() {
|
|
1340
|
+
return this.#w("layoutParent");
|
|
1341
|
+
}
|
|
1342
|
+
getDataAncestors() {
|
|
1343
|
+
return this.#w("dataParent");
|
|
1344
|
+
}
|
|
1345
|
+
handleBroadcast(e) {
|
|
1346
|
+
for (let t of this.#n[e.type] || []) t(e);
|
|
1347
|
+
}
|
|
1348
|
+
_addBroadcastHandler(e, t) {
|
|
1349
|
+
let n = this.#n[e];
|
|
1350
|
+
return n || (n = [], this.#n[e] = n), n.push(t), () => {
|
|
1351
|
+
let n = this.#n[e];
|
|
1352
|
+
if (!n) return;
|
|
1353
|
+
let r = n.indexOf(t);
|
|
1354
|
+
r >= 0 && n.splice(r, 1);
|
|
1355
|
+
};
|
|
1356
|
+
}
|
|
1357
|
+
handleInteraction(e, t) {
|
|
1358
|
+
t && e.type === "mousemove" && e.pointedViews.add(this);
|
|
1359
|
+
let n = t ? this.#r : this.#i;
|
|
1360
|
+
for (let t of n[e.type] || []) t(e);
|
|
1361
|
+
}
|
|
1362
|
+
addInteractionListener(e, t, n) {
|
|
1363
|
+
let r = n ? this.#r : this.#i, i = r[e];
|
|
1364
|
+
i || (i = [], r[e] = i), i.push(t);
|
|
1365
|
+
}
|
|
1366
|
+
removeInteractionListener(e, t, n) {
|
|
1367
|
+
let r = (n ? this.#r : this.#i)?.[e];
|
|
1368
|
+
if (r) {
|
|
1369
|
+
let e = r.indexOf(t);
|
|
1370
|
+
e >= 0 && r.splice(e, 1);
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
visit(e) {
|
|
1374
|
+
try {
|
|
1375
|
+
let t = e(this);
|
|
1376
|
+
if (e.postOrder && e.postOrder(this), t !== "VISIT_STOP") return t;
|
|
1377
|
+
} catch (e) {
|
|
1378
|
+
throw e.view = this, e;
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
getDescendants() {
|
|
1382
|
+
let e = [];
|
|
1383
|
+
return this.visit((t) => {
|
|
1384
|
+
e.push(t);
|
|
1385
|
+
}), e;
|
|
1386
|
+
}
|
|
1387
|
+
dispose() {
|
|
1388
|
+
for (let e of this.#f) e();
|
|
1389
|
+
this.#f.length = 0;
|
|
1390
|
+
let e = this.flowHandle;
|
|
1391
|
+
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;
|
|
1392
|
+
}
|
|
1393
|
+
registerDisposer(e) {
|
|
1394
|
+
this.#f.push(e);
|
|
1395
|
+
}
|
|
1396
|
+
disposeSubtree() {
|
|
1397
|
+
let e = () => void 0;
|
|
1398
|
+
e.postOrder = (e) => {
|
|
1399
|
+
e.dispose();
|
|
1400
|
+
}, this.visit(e);
|
|
1401
|
+
}
|
|
1402
|
+
configurePostScaleParams() {
|
|
1403
|
+
let e = [...this.#d, ...Ye(this.spec) ?? []];
|
|
1404
|
+
if (e.length && !this.#u) {
|
|
1405
|
+
this.#u = !0, this.#l = !1;
|
|
1406
|
+
for (let t of e) this.paramRuntime.registerParam(t);
|
|
1407
|
+
this.registerDisposer(this._addBroadcastHandler("subtreeDataReady", () => {
|
|
1408
|
+
this.#l = !0, this.#T();
|
|
1409
|
+
}));
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
configureViewOpacity() {
|
|
1413
|
+
(!this.opacityFunction || this.opacityFunction === K) && (this.opacityFunction = et(this));
|
|
1414
|
+
}
|
|
1415
|
+
finalizeParamRuntimeInitialization() {
|
|
1416
|
+
this.#l === void 0 ? this.paramRuntime.finalizeInitialization() : this.#T();
|
|
1417
|
+
}
|
|
1418
|
+
onBeforeRender() {
|
|
1419
|
+
this.#s ||= !0;
|
|
1420
|
+
}
|
|
1421
|
+
hasRendered() {
|
|
1422
|
+
return this.#s;
|
|
1423
|
+
}
|
|
1424
|
+
arrange(e, t, n = {}) {
|
|
1425
|
+
if (n.firstFacet && this.facetCoords.clear(), this.facetCoords.set(n.facetId, m(t, f(n))), this.#a || this.#o) {
|
|
1426
|
+
let e = this.getOverhang(), n = this.layoutParent ? O.zero() : this.getPadding();
|
|
1427
|
+
this.#a?.(t.width - e.width - n.width), this.#o?.(t.height - e.height - n.height);
|
|
1428
|
+
}
|
|
1429
|
+
this.#c = !0, this.#T();
|
|
1430
|
+
}
|
|
1431
|
+
#T() {
|
|
1432
|
+
this.#l && this.#c && (this.#l = void 0, this.paramRuntime.finalizeInitialization());
|
|
1433
|
+
}
|
|
1434
|
+
getEncoding() {
|
|
1435
|
+
let e = this.dataParent && this.options.inheritEncoding ? this.dataParent.getEncoding() : {}, t = this.spec.encoding || {}, n = {
|
|
1436
|
+
...e,
|
|
1437
|
+
...t
|
|
1438
|
+
};
|
|
1439
|
+
for (let [e, t] of Object.entries(n)) t === null && delete n[e];
|
|
1440
|
+
return n;
|
|
1441
|
+
}
|
|
1442
|
+
getFacetAccessor(e) {
|
|
1443
|
+
if (this.layoutParent) return this.layoutParent.getFacetAccessor(this);
|
|
1444
|
+
}
|
|
1445
|
+
getFacetFields(e) {
|
|
1446
|
+
let t = this.getEncoding().sample;
|
|
1447
|
+
return i(t) ? [t.field] : this.options.inheritEncoding ? this.layoutParent?.getFacetFields(this) : [];
|
|
1448
|
+
}
|
|
1449
|
+
usesSampleFacetRendering() {
|
|
1450
|
+
return this.layoutParent?.usesSampleFacetRendering() ?? !1;
|
|
1451
|
+
}
|
|
1452
|
+
getParentGridChromePolicy() {
|
|
1453
|
+
return {
|
|
1454
|
+
axes: !0,
|
|
1455
|
+
background: !0
|
|
1456
|
+
};
|
|
1457
|
+
}
|
|
1458
|
+
getScaleResolution(e) {
|
|
1459
|
+
let t = h(e);
|
|
1460
|
+
return this.getDataAncestors().map((e) => e.resolutions.scale[t]).find((e) => e);
|
|
1461
|
+
}
|
|
1462
|
+
getAxisResolution(e) {
|
|
1463
|
+
let t = h(e);
|
|
1464
|
+
return this.getDataAncestors().map((e) => e.resolutions.axis[t]).find((e) => e);
|
|
1465
|
+
}
|
|
1466
|
+
getLegendResolution(e) {
|
|
1467
|
+
let t = h(e);
|
|
1468
|
+
return this.getDataAncestors().map((e) => e.resolutions.legend[t]).find((e) => e);
|
|
1469
|
+
}
|
|
1470
|
+
getConfiguredResolution(e, t) {
|
|
1471
|
+
return this.spec.resolve?.[t]?.[e];
|
|
1472
|
+
}
|
|
1473
|
+
getConfiguredOrDefaultResolution(e, t) {
|
|
1474
|
+
return (this.getConfiguredResolution(e, t) ?? this.getConfiguredResolution("default", t)) || (t == "legend" ? this.getConfiguredOrDefaultResolution(e, "scale") : this.getDefaultResolution(e, t));
|
|
1475
|
+
}
|
|
1476
|
+
getDefaultResolution(e, t) {
|
|
1477
|
+
return "independent";
|
|
1478
|
+
}
|
|
1479
|
+
getBaseUrl() {
|
|
1480
|
+
return A(() => this.dataParent?.getBaseUrl(), We(this.spec.baseUrl));
|
|
1481
|
+
}
|
|
1482
|
+
isPickingSupported() {
|
|
1483
|
+
return !0;
|
|
1484
|
+
}
|
|
1485
|
+
getTitleText() {
|
|
1486
|
+
let t = this.spec.title;
|
|
1487
|
+
if (t) return c(t) ? t : e(t.text) ? this.paramRuntime.evaluateAndGet(t.text.expr) : t.text;
|
|
1488
|
+
}
|
|
1489
|
+
_cache(e, t) {
|
|
1490
|
+
return te(this, e, t);
|
|
1491
|
+
}
|
|
1492
|
+
_invalidateCacheByPrefix(e, t = "self") {
|
|
1493
|
+
switch (t) {
|
|
1494
|
+
case "self":
|
|
1495
|
+
g(this, e);
|
|
1496
|
+
break;
|
|
1497
|
+
case "ancestors":
|
|
1498
|
+
for (let t of this.getLayoutAncestors()) g(t, e);
|
|
1499
|
+
break;
|
|
1500
|
+
case "progeny":
|
|
1501
|
+
this.visit((t) => g(t, e));
|
|
1502
|
+
break;
|
|
1503
|
+
default:
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
invalidateSizeCache() {
|
|
1507
|
+
g(this, "size"), this._invalidateCacheByPrefix("size", "ancestors");
|
|
1508
|
+
}
|
|
1509
|
+
propagateInteraction(e) {}
|
|
1510
|
+
};
|
|
1511
|
+
function $e(e) {
|
|
1512
|
+
return "unitsPerPixel" in e;
|
|
1513
|
+
}
|
|
1514
|
+
function et(t) {
|
|
1515
|
+
let i = "opacity" in t.spec ? t.spec.opacity : void 0;
|
|
1516
|
+
if (i !== void 0) {
|
|
1517
|
+
if (r(i)) return (e) => e * i;
|
|
1518
|
+
if ($e(i)) {
|
|
1519
|
+
let r = (e) => {
|
|
1520
|
+
let n = t.getScaleResolution(e), r = n?.getScale();
|
|
1521
|
+
if ([
|
|
1522
|
+
"linear",
|
|
1523
|
+
"index",
|
|
1524
|
+
"locus"
|
|
1525
|
+
].includes(r?.type)) return {
|
|
1526
|
+
scale: r,
|
|
1527
|
+
scaleResolution: n
|
|
1528
|
+
};
|
|
1529
|
+
}, a = nt(i.values, "opacity.values", t);
|
|
1530
|
+
if (!n(i.unitsPerPixel)) throw new _("\"opacity.unitsPerPixel\" must be an array.", t);
|
|
1531
|
+
let o = () => 1, s = [], c = () => {
|
|
1532
|
+
let e = tt(nt(s.map((e) => e()), "opacity.unitsPerPixel", t), a, t), n = re().domain(e.unitsPerPixel).range(e.values).clamp(!0);
|
|
1533
|
+
o = (e) => n(e);
|
|
1534
|
+
};
|
|
1535
|
+
s = i.unitsPerPixel.map((n) => {
|
|
1536
|
+
if (e(n)) {
|
|
1537
|
+
let e = t.paramRuntime.watchExpression(n.expr, () => {
|
|
1538
|
+
c(), t.context.animator.requestRender();
|
|
1539
|
+
});
|
|
1540
|
+
return () => e(null);
|
|
1541
|
+
} else return () => n;
|
|
1542
|
+
}), c();
|
|
1543
|
+
let l = (e) => {
|
|
1544
|
+
let t = e.scaleResolution.getAxisLength() || 1e3;
|
|
1545
|
+
return u(e.scale.domain()) / t;
|
|
1546
|
+
}, d;
|
|
1547
|
+
if (i.channel === "auto") {
|
|
1548
|
+
let e = r("x"), n = r("y");
|
|
1549
|
+
if (e && n) d = () => (l(e) + l(n)) / 2;
|
|
1550
|
+
else if (e) d = () => l(e);
|
|
1551
|
+
else if (n) d = () => l(n);
|
|
1552
|
+
else throw new _("Cannot find a resolved quantitative x or y scale for dynamic opacity!", t);
|
|
1553
|
+
} else {
|
|
1554
|
+
let e = i.channel ? r(i.channel) : r("x") ?? r("y");
|
|
1555
|
+
if (!e) throw new _("Cannot find a resolved quantitative scale for dynamic opacity!", t);
|
|
1556
|
+
d = () => l(e);
|
|
1557
|
+
}
|
|
1558
|
+
return (e) => o(d()) * e;
|
|
1559
|
+
} else if (e(i)) {
|
|
1560
|
+
let e = t.paramRuntime.watchExpression(i.expr, () => t.context.animator.requestRender());
|
|
1561
|
+
return (t) => e(null) * t;
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
return K;
|
|
1565
|
+
}
|
|
1566
|
+
function tt(e, t, n) {
|
|
1567
|
+
if (!e.length) throw new _("\"opacity.unitsPerPixel\" must contain at least one stop.", n);
|
|
1568
|
+
if (e.length !== t.length) throw new _("\"opacity.unitsPerPixel\" and \"opacity.values\" must have the same length.", n);
|
|
1569
|
+
e.forEach((e, t) => {
|
|
1570
|
+
if (e <= 0) throw new _("Invalid opacity.unitsPerPixel value at index " + t + ". Stop values must be positive.", n);
|
|
1571
|
+
});
|
|
1572
|
+
let r = e.map((e, n) => ({
|
|
1573
|
+
stop: e,
|
|
1574
|
+
value: t[n]
|
|
1575
|
+
}));
|
|
1576
|
+
r.sort((e, t) => t.stop - e.stop);
|
|
1577
|
+
let i = r.map((e) => e.stop), a = r.map((e) => e.value);
|
|
1578
|
+
for (let t = 1; t < e.length; t++) if (i[t - 1] <= i[t]) throw new _("\"opacity.unitsPerPixel\" must be strictly decreasing.", n);
|
|
1579
|
+
return {
|
|
1580
|
+
unitsPerPixel: i,
|
|
1581
|
+
values: a
|
|
1582
|
+
};
|
|
1583
|
+
}
|
|
1584
|
+
function nt(e, t, i) {
|
|
1585
|
+
if (!n(e)) throw new _("\"" + t + "\" must evaluate to an array.", i);
|
|
1586
|
+
return e.map((e, n) => {
|
|
1587
|
+
if (!r(e) || !Number.isFinite(e)) throw new _("Invalid " + t + " value at index " + n + ". Expected a finite number.", i);
|
|
1588
|
+
return e;
|
|
1589
|
+
});
|
|
1590
|
+
}
|
|
1591
|
+
var q = (e) => !!e && typeof e == "object" && "step" in e;
|
|
1592
|
+
function rt(e) {
|
|
1593
|
+
return typeof e == "number" && Number.isFinite(e);
|
|
1594
|
+
}
|
|
1595
|
+
var J = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakMap();
|
|
1596
|
+
function it(e, t) {
|
|
1597
|
+
X(e, t, "Import");
|
|
1598
|
+
}
|
|
1599
|
+
function at(e, t) {
|
|
1600
|
+
X(e, t, "View");
|
|
1601
|
+
}
|
|
1602
|
+
function X(e, t, n) {
|
|
1603
|
+
if (t !== null && typeof t != "string") throw Error(n + " scope name must be a string or null.");
|
|
1604
|
+
J.set(e, { name: t });
|
|
1605
|
+
}
|
|
1606
|
+
function ot(e) {
|
|
1607
|
+
return J.get(e);
|
|
1608
|
+
}
|
|
1609
|
+
function st(e, t = {}) {
|
|
1610
|
+
let n = t.skipSubtree ?? !1 ? "excludeSubtree" : "exclude";
|
|
1611
|
+
Y.set(e, n);
|
|
1612
|
+
}
|
|
1613
|
+
function ct(e, t = {}) {
|
|
1614
|
+
Ke(e, t.skipSubtree ?? !1 ? "excludeSubtree" : "exclude");
|
|
1615
|
+
}
|
|
1616
|
+
function lt(e) {
|
|
1617
|
+
return e.getLayoutAncestors().some(V);
|
|
1618
|
+
}
|
|
1619
|
+
function Z(e) {
|
|
1620
|
+
let t = e.getDataAncestors(), n = [];
|
|
1621
|
+
for (let e = t.length - 1; e >= 0; --e) {
|
|
1622
|
+
let r = J.get(t[e]);
|
|
1623
|
+
r && typeof r.name == "string" && n.push(r.name);
|
|
1624
|
+
}
|
|
1625
|
+
return n;
|
|
1626
|
+
}
|
|
1627
|
+
function ut(e) {
|
|
1628
|
+
let t = e.explicitName;
|
|
1629
|
+
if (!t) throw Error("Cannot build a selector for a view without a name.");
|
|
1630
|
+
return {
|
|
1631
|
+
scope: Z(e),
|
|
1632
|
+
view: t
|
|
1633
|
+
};
|
|
1634
|
+
}
|
|
1635
|
+
function dt(e, t) {
|
|
1636
|
+
if (!t) throw Error("Cannot build a selector for a parameter without a name.");
|
|
1637
|
+
return {
|
|
1638
|
+
scope: Z(e),
|
|
1639
|
+
param: t
|
|
1640
|
+
};
|
|
1641
|
+
}
|
|
1642
|
+
function ft(e) {
|
|
1643
|
+
return bt(e), "p:" + JSON.stringify({
|
|
1644
|
+
scope: e.scope,
|
|
1645
|
+
param: e.param
|
|
1646
|
+
});
|
|
1647
|
+
}
|
|
1648
|
+
function pt(e, t) {
|
|
1649
|
+
e.visit((e) => {
|
|
1650
|
+
let n = qe(e);
|
|
1651
|
+
if (n === "excludeSubtree") return W;
|
|
1652
|
+
if (n !== "exclude") return t(e);
|
|
1653
|
+
});
|
|
1654
|
+
}
|
|
1655
|
+
function mt(e, t) {
|
|
1656
|
+
e.visit((e) => {
|
|
1657
|
+
let n = Y.get(e);
|
|
1658
|
+
if (n === "excludeSubtree") return W;
|
|
1659
|
+
if (n !== "exclude") return t(e);
|
|
1660
|
+
});
|
|
1661
|
+
}
|
|
1662
|
+
function ht(e, t) {
|
|
1663
|
+
if (xt(t), !kt(e, t.scope)) return;
|
|
1664
|
+
let n = [];
|
|
1665
|
+
if ($(e, t.scope, (e) => {
|
|
1666
|
+
e.explicitName === t.view && n.push(e);
|
|
1667
|
+
}, { includeNamedImportRoots: !0 }), n.length === 1) return n[0];
|
|
1668
|
+
if (n.length !== 0) throw Error("View selector is ambiguous for view \"" + t.view + "\" in scope " + JSON.stringify(t.scope));
|
|
1669
|
+
}
|
|
1670
|
+
function gt(e, t) {
|
|
1671
|
+
if (bt(t), !kt(e, t.scope)) return;
|
|
1672
|
+
let n = [];
|
|
1673
|
+
if ($(e, t.scope, (e) => {
|
|
1674
|
+
for (let [r, i] of e.paramRuntime.paramConfigs) r === t.param && Q(i) && n.push({
|
|
1675
|
+
view: e,
|
|
1676
|
+
param: i
|
|
1677
|
+
});
|
|
1678
|
+
}), n.length === 1) return n[0];
|
|
1679
|
+
if (n.length !== 0) throw Error("Param selector is ambiguous for param \"" + t.param + "\" in scope " + JSON.stringify(t.scope));
|
|
1680
|
+
}
|
|
1681
|
+
function _t(e, t) {
|
|
1682
|
+
e.visit((e) => {
|
|
1683
|
+
let n = Y.get(e);
|
|
1684
|
+
if (n === "excludeSubtree") return W;
|
|
1685
|
+
if (n !== "exclude") for (let [n, r] of e.paramRuntime.paramConfigs) Q(r) && t({
|
|
1686
|
+
view: e,
|
|
1687
|
+
param: r,
|
|
1688
|
+
selector: dt(e, n)
|
|
1689
|
+
});
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
function vt(e) {
|
|
1693
|
+
let t = [];
|
|
1694
|
+
return _t(e, (e) => t.push(e)), t;
|
|
1695
|
+
}
|
|
1696
|
+
function yt(e) {
|
|
1697
|
+
let t = [];
|
|
1698
|
+
for (let n of St(e)) {
|
|
1699
|
+
let r = Ct(n);
|
|
1700
|
+
Tt(e, r, t), Et(e, r, t);
|
|
1701
|
+
}
|
|
1702
|
+
return t;
|
|
1703
|
+
}
|
|
1704
|
+
function bt(e) {
|
|
1705
|
+
if (!e || !Array.isArray(e.scope)) throw Error("Param selector scope must be an array.");
|
|
1706
|
+
if (typeof e.param != "string" || !e.param.length) throw Error("Param selector param must be a non-empty string.");
|
|
1707
|
+
}
|
|
1708
|
+
function xt(e) {
|
|
1709
|
+
if (!e || !Array.isArray(e.scope)) throw Error("View selector scope must be an array.");
|
|
1710
|
+
if (typeof e.view != "string" || !e.view.length) throw Error("View selector view must be a non-empty string.");
|
|
1711
|
+
}
|
|
1712
|
+
function Q(e) {
|
|
1713
|
+
return e.persist === !1 ? !1 : s(e) ? !0 : t(e) ? !!e.bind : !1;
|
|
1714
|
+
}
|
|
1715
|
+
function St(e) {
|
|
1716
|
+
let t = /* @__PURE__ */ new Set([e]);
|
|
1717
|
+
return e.visit((e) => {
|
|
1718
|
+
let n = J.get(e);
|
|
1719
|
+
n && typeof n.name == "string" && t.add(e);
|
|
1720
|
+
}), Array.from(t);
|
|
1721
|
+
}
|
|
1722
|
+
function Ct(e) {
|
|
1723
|
+
return Z(e);
|
|
1724
|
+
}
|
|
1725
|
+
function wt(e) {
|
|
1726
|
+
return e.length ? "import scope [" + e.join(" / ") + "]" : "import scope (root)";
|
|
1727
|
+
}
|
|
1728
|
+
function Tt(e, t, n) {
|
|
1729
|
+
let r = /* @__PURE__ */ new Map();
|
|
1730
|
+
$(e, t, (e) => {
|
|
1731
|
+
for (let [t, n] of e.paramRuntime.paramConfigs) {
|
|
1732
|
+
if (!Q(n)) continue;
|
|
1733
|
+
let i = r.get(t);
|
|
1734
|
+
i ? i.push(e) : r.set(t, [e]);
|
|
1735
|
+
}
|
|
1736
|
+
});
|
|
1737
|
+
for (let [e, i] of r) {
|
|
1738
|
+
if (i.length <= 1) continue;
|
|
1739
|
+
let r = i.map((e) => e.getPathString()).join(", ");
|
|
1740
|
+
n.push({
|
|
1741
|
+
message: "Bookmarkable parameter \"" + e + "\" is not unique within " + wt(t) + ". Found in: " + r + ".",
|
|
1742
|
+
scope: t
|
|
1743
|
+
});
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
function Et(e, t, n) {
|
|
1747
|
+
let r = Dt(e, t);
|
|
1748
|
+
if (!r.length) return;
|
|
1749
|
+
let i = r.filter((e) => Ot(e));
|
|
1750
|
+
if (i.length <= 1) return;
|
|
1751
|
+
let a = /* @__PURE__ */ new Map();
|
|
1752
|
+
for (let e of i) {
|
|
1753
|
+
let t = J.get(e), n = t ? t.name : void 0;
|
|
1754
|
+
typeof n != "string" || !n.length || a.set(n, (a.get(n) ?? 0) + 1);
|
|
1755
|
+
}
|
|
1756
|
+
for (let [e, r] of a) r > 1 && n.push({
|
|
1757
|
+
message: "Import instance name \"" + e + "\" is used multiple times for addressable instances in " + wt(t) + ".",
|
|
1758
|
+
scope: t
|
|
1759
|
+
});
|
|
1760
|
+
}
|
|
1761
|
+
function Dt(e, t) {
|
|
1762
|
+
let n = [];
|
|
1763
|
+
return $(e, t, (e) => {
|
|
1764
|
+
if (Z(e).length !== t.length + 1) return;
|
|
1765
|
+
let r = J.get(e);
|
|
1766
|
+
!r || typeof r.name != "string" || n.push(e);
|
|
1767
|
+
}, { includeNamedImportRoots: !0 }), n;
|
|
1768
|
+
}
|
|
1769
|
+
function Ot(e) {
|
|
1770
|
+
let t = !1;
|
|
1771
|
+
return e.visit((e) => {
|
|
1772
|
+
let n = Y.get(e);
|
|
1773
|
+
if (n === "excludeSubtree") return W;
|
|
1774
|
+
if (n !== "exclude") {
|
|
1775
|
+
for (let n of e.paramRuntime.paramConfigs.values()) if (Q(n)) return t = !0, G;
|
|
1776
|
+
}
|
|
1777
|
+
}), t;
|
|
1778
|
+
}
|
|
1779
|
+
function kt(e, t) {
|
|
1780
|
+
let n = e, r = [];
|
|
1781
|
+
for (let i of t) {
|
|
1782
|
+
if (typeof i != "string" || !i.length) throw Error("Scope names must be non-empty strings.");
|
|
1783
|
+
let t, a = !1;
|
|
1784
|
+
if ($(e, r, (e) => {
|
|
1785
|
+
let n = J.get(e);
|
|
1786
|
+
if (!(!n || n.name !== i) && Z(e).length === r.length + 1) {
|
|
1787
|
+
if (t) return a = !0, G;
|
|
1788
|
+
t = e;
|
|
1789
|
+
}
|
|
1790
|
+
}, { includeNamedImportRoots: !0 }), a) throw Error("Multiple import instances named \"" + i + "\" in scope.");
|
|
1791
|
+
if (t) n = t, r.push(i);
|
|
1792
|
+
else return;
|
|
1793
|
+
}
|
|
1794
|
+
return n;
|
|
1795
|
+
}
|
|
1796
|
+
function $(e, t, n, r = {}) {
|
|
1797
|
+
let i = r.includeNamedImportRoots ?? !1;
|
|
1798
|
+
e.visit((e) => {
|
|
1799
|
+
let r = J.get(e), a = Y.get(e);
|
|
1800
|
+
if (a === "excludeSubtree") return W;
|
|
1801
|
+
if (a !== "exclude" && At(e, t, r, i)) return n(e);
|
|
1802
|
+
});
|
|
1803
|
+
}
|
|
1804
|
+
function At(e, t, n, r) {
|
|
1805
|
+
let i = Z(e);
|
|
1806
|
+
return jt(i, t) ? !0 : !r || !n || typeof n.name != "string" || i.length !== t.length + 1 ? !1 : Mt(t, i);
|
|
1807
|
+
}
|
|
1808
|
+
function jt(e, t) {
|
|
1809
|
+
return e.length === t.length && Mt(e, t);
|
|
1810
|
+
}
|
|
1811
|
+
function Mt(e, t) {
|
|
1812
|
+
if (e.length > t.length) return !1;
|
|
1813
|
+
for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
|
|
1814
|
+
return !0;
|
|
1815
|
+
}
|
|
1816
|
+
//#endregion
|
|
1817
|
+
export { Se as A, oe as B, Ue as C, Ie as D, ze as E, b as F, ue as H, le as I, se as L, O as M, ye as N, j as O, y as P, T as R, z as S, Re as T, ce as U, me as V, G as _, lt as a, V as b, st as c, gt as d, ht as f, W as g, pt as h, ut as i, xe as j, A as k, it as l, mt as m, ot as n, ft as o, yt as p, Z as r, ct as s, vt as t, at as u, Qe as v, P as w, H as x, Je as y, w as z };
|