@fxi/zartigl 0.13.1 → 0.14.1
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/dist/catalog.js +1 -1
- package/dist/{engine-Bhb-WayM.js → engine-C8ZNzILO.js} +317 -284
- package/dist/engine.d.ts +6 -1
- package/dist/engine.js +31 -31
- package/dist/{index-DsKvU_FK.js → index-BDIf6Jc0.js} +125 -122
- package/dist/zartigl.d.ts +11 -1
- package/dist/zartigl.js +801 -737
- package/package.json +2 -2
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
import "./backdrop-Dceb4d8E.js";
|
|
2
|
-
const
|
|
3
|
-
thermal:
|
|
2
|
+
const ye = { label: "Thermal", tags: ["sequential", "temperature"], colors: ["#042333", "#2c3395", "#744796", "#b15f82", "#eb7958", "#fbb43d", "#e8fa5b"] }, _e = { label: "Haline", tags: ["sequential", "salinity"], colors: ["#2a186c", "#17568b", "#1a7e8f", "#22a785", "#55c666", "#aadc32", "#fde333"] }, xe = { label: "Solar", tags: ["sequential", "irradiance"], colors: ["#330f0b", "#6b2313", "#a83c12", "#d6621a", "#f3951e", "#f7c741", "#f9f871"] }, Re = { label: "Ice", tags: ["sequential"], colors: ["#040d1a", "#123365", "#1c5f9e", "#2b8ece", "#62bde3", "#aaddf2", "#f2faff"] }, ve = { label: "Deep", tags: ["sequential", "depth"], colors: ["#fdfecc", "#c8e59b", "#74c8a3", "#3194b0", "#2a5b8e", "#281a5e", "#0c0820"] }, ke = { label: "RdYlBu", tags: ["diverging"], colors: ["#3288bd", "#66c2a5", "#abdda4", "#e6f598", "#fee08b", "#fdae61", "#f46d43", "#d53e4f"] }, Ae = { label: "Dense", tags: ["sequential"], colors: ["#e6f1f1", "#92c4ca", "#44929a", "#20627a", "#1a3c6a", "#211a50", "#0d0621"] }, Fe = { label: "Algae", tags: ["sequential", "biology", "log"], colors: ["#d7f9d0", "#a2d595", "#64b463", "#129450", "#126e45", "#1a482f", "#122414"] }, Se = { label: "Oxygen", tags: ["sequential", "biology", "hypoxia"], colors: ["#09060f", "#5b1028", "#d43d2f", "#f39b3d", "#f3e7b3", "#79cbd1", "#176b9c"] }, Ue = { label: "Matter", tags: ["sequential", "biology"], colors: ["#fdfecc", "#f2c98a", "#e07c4e", "#bc3754", "#8d1a6d", "#51156b", "#1c0c3f"] }, Me = { label: "Viridis", tags: ["sequential", "perceptual"], colors: ["#440154", "#443983", "#31688e", "#21918c", "#35b779", "#90d743", "#fde725"] }, De = { label: "Plasma", tags: ["sequential", "perceptual"], colors: ["#0d0887", "#5e01a6", "#9c179e", "#cc4778", "#ed7953", "#fdb42f", "#f0f921"] }, Pe = { label: "Cyclic", tags: ["cyclic", "direction"], colors: ["#2e22ea", "#b541fb", "#fc93c0", "#f1ee35", "#77c80d", "#458776", "#2c24e9"] }, Ge = { label: "Tempo", tags: ["sequential"], colors: ["#fff6f4", "#c2d1b9", "#7db390", "#2a937f", "#156d73", "#1c455b", "#151d44"] }, Ne = { label: "Turbid", tags: ["sequential", "biology", "log"], colors: ["#e9f5a0", "#c8c86e", "#a09845", "#786031", "#533324", "#341423", "#150d17"] }, Ie = { label: "Speed", tags: ["sequential", "velocity"], colors: ["#fcfea4", "#d5e429", "#94c63e", "#52a657", "#2d8169", "#1d5b6d", "#0d3361"] }, Le = { label: "Amp", tags: ["sequential"], colors: ["#f2f2f2", "#c0b8db", "#9180b6", "#6c4e9e", "#4e2e83", "#32185d", "#110a35"] }, Ce = { label: "Heat", tags: ["sequential"], colors: ["#fde725", "#fde725", "#f8961e", "#e63946", "#9d0208", "#3a0007"] }, Ve = { label: "Balance", tags: ["diverging"], colors: ["#181c43", "#3066af", "#9bbcdd", "#f2f2f2", "#e07d53", "#b13626", "#2c0b0e"] }, Oe = { label: "Delta", tags: ["diverging"], colors: ["#0e3f31", "#20877b", "#99d4c1", "#f2f2f2", "#a1b0d4", "#3c5b9e", "#0d1938"] }, Be = { label: "Curl", tags: ["diverging"], colors: ["#152237", "#2471b3", "#8dbac4", "#f2f2f2", "#c79f84", "#a63827", "#270b17"] }, Xe = { label: "Gray", tags: ["sequential"], colors: ["#000000", "#252525", "#4d4d4d", "#7a7a7a", "#a8a8a8", "#d4d4d4", "#ffffff"] }, ue = {
|
|
3
|
+
thermal: ye,
|
|
4
4
|
"thermal-alt": { label: "Thermal Alt", tags: ["sequential", "temperature"], colors: ["#176b9c", "#79cbd1", "#f3e7b3", "#f39b3d", "#d43d2f", "#5b1028", "#09060f"] },
|
|
5
|
-
haline:
|
|
6
|
-
solar:
|
|
7
|
-
ice:
|
|
8
|
-
deep:
|
|
9
|
-
rdylbu:
|
|
5
|
+
haline: _e,
|
|
6
|
+
solar: xe,
|
|
7
|
+
ice: Re,
|
|
8
|
+
deep: ve,
|
|
9
|
+
rdylbu: ke,
|
|
10
10
|
dense: Ae,
|
|
11
|
-
algae:
|
|
12
|
-
oxygen:
|
|
13
|
-
matter:
|
|
14
|
-
viridis:
|
|
15
|
-
plasma:
|
|
16
|
-
cyclic:
|
|
17
|
-
tempo:
|
|
11
|
+
algae: Fe,
|
|
12
|
+
oxygen: Se,
|
|
13
|
+
matter: Ue,
|
|
14
|
+
viridis: Me,
|
|
15
|
+
plasma: De,
|
|
16
|
+
cyclic: Pe,
|
|
17
|
+
tempo: Ge,
|
|
18
18
|
turbid: Ne,
|
|
19
|
-
speed:
|
|
20
|
-
amp:
|
|
21
|
-
heat:
|
|
19
|
+
speed: Ie,
|
|
20
|
+
amp: Le,
|
|
21
|
+
heat: Ce,
|
|
22
22
|
"heat-alert": { label: "Heat Alert", tags: ["sequential", "alpha", "deprecated"], colors: ["#fde72500", "#fde725cc", "#f8961e", "#e63946", "#9d0208", "#3a0007"] },
|
|
23
|
-
balance:
|
|
24
|
-
delta:
|
|
25
|
-
curl:
|
|
23
|
+
balance: Ve,
|
|
24
|
+
delta: Oe,
|
|
25
|
+
curl: Be,
|
|
26
26
|
"mono-black": { label: "Black", tags: ["monochrome", "particles"], colors: ["#000000", "#000000"] },
|
|
27
27
|
"mono-white": { label: "White", tags: ["monochrome", "particles"], colors: ["#ffffff", "#ffffff"] },
|
|
28
28
|
"mono-pink": { label: "Pink", tags: ["monochrome", "particles"], colors: ["#ff2aa1", "#ff2aa1"] },
|
|
29
|
-
gray:
|
|
30
|
-
}, ne = 64,
|
|
29
|
+
gray: Xe
|
|
30
|
+
}, ne = 64, $e = {
|
|
31
31
|
linear: (t) => t,
|
|
32
32
|
// Rises fast: values just inside the zone already show.
|
|
33
33
|
log: (t) => Math.log10(1 + 9 * t),
|
|
34
34
|
// Stays faint longer: codec noise at the end of the range stays hidden.
|
|
35
35
|
exp: (t) => (10 ** t - 1) / 9
|
|
36
36
|
};
|
|
37
|
-
function
|
|
38
|
-
const i =
|
|
37
|
+
function qe(t, e) {
|
|
38
|
+
const i = $e[e.curve ?? "linear"], r = e.low ?? 0, n = e.high ?? 0;
|
|
39
39
|
let s = 1;
|
|
40
40
|
return r > 0 && t < r && (s = Math.min(s, i(Math.max(t, 0) / r))), n > 0 && t > 1 - n && (s = Math.min(s, i(Math.max(1 - t, 0) / n))), s;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function We(t) {
|
|
43
43
|
let e = t.replace("#", "");
|
|
44
44
|
(e.length === 3 || e.length === 4) && (e = [...e].map((r) => r + r).join(""));
|
|
45
45
|
const i = (r) => parseInt(e.slice(r, r + 2), 16);
|
|
@@ -50,12 +50,12 @@ function qe(t) {
|
|
|
50
50
|
e.length === 8 ? i(6) : 255
|
|
51
51
|
];
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function He([t, e, i, r]) {
|
|
54
54
|
return `#${[t, e, i, r].map(
|
|
55
55
|
(n) => Math.round(Math.min(255, Math.max(0, n))).toString(16).padStart(2, "0")
|
|
56
56
|
).join("")}`;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function ze(t, e) {
|
|
59
59
|
if (e <= t[0][0])
|
|
60
60
|
return t[0][1];
|
|
61
61
|
for (let i = 1; i < t.length; i++) {
|
|
@@ -67,28 +67,28 @@ function He(t, e) {
|
|
|
67
67
|
}
|
|
68
68
|
return t[t.length - 1][1];
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function Ye(t, e) {
|
|
71
71
|
const i = Object.entries(t).map(
|
|
72
|
-
([n, s]) => [Number(n),
|
|
72
|
+
([n, s]) => [Number(n), We(s)]
|
|
73
73
|
).sort((n, s) => n[0] - s[0]), r = {};
|
|
74
74
|
for (let n = 0; n <= ne; n++) {
|
|
75
|
-
const s = n / ne, [o, a, c, l] =
|
|
76
|
-
r[s] =
|
|
75
|
+
const s = n / ne, [o, a, c, l] = ze(i, s);
|
|
76
|
+
r[s] = He([o, a, c, l * qe(s, e)]);
|
|
77
77
|
}
|
|
78
78
|
return r;
|
|
79
79
|
}
|
|
80
|
-
const
|
|
80
|
+
const je = (t) => !!t && ((t.low ?? 0) > 0 || (t.high ?? 0) > 0);
|
|
81
81
|
function se(t) {
|
|
82
82
|
const e = {}, i = t.length - 1;
|
|
83
83
|
return t.forEach((r, n) => {
|
|
84
84
|
e[i === 0 ? 0 : n / i] = r;
|
|
85
85
|
}), e;
|
|
86
86
|
}
|
|
87
|
-
function je(t, e) {
|
|
88
|
-
const i = Ke(t, e?.reverse ?? !1);
|
|
89
|
-
return Ye(e?.alphaFade) ? ze(i, e.alphaFade) : i;
|
|
90
|
-
}
|
|
91
87
|
function Ke(t, e) {
|
|
88
|
+
const i = Qe(t, e?.reverse ?? !1);
|
|
89
|
+
return je(e?.alphaFade) ? Ye(i, e.alphaFade) : i;
|
|
90
|
+
}
|
|
91
|
+
function Qe(t, e) {
|
|
92
92
|
const i = ue;
|
|
93
93
|
if (typeof t == "string") {
|
|
94
94
|
const r = i[t];
|
|
@@ -109,7 +109,7 @@ function Ke(t, e) {
|
|
|
109
109
|
Object.entries(t).map(([r, n]) => [1 - Number(r), n])
|
|
110
110
|
) : t;
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function Jt(t = {}) {
|
|
113
113
|
return Object.entries(ue).map(([i, r]) => ({ id: i, ...r })).filter(
|
|
114
114
|
(i) => t.includeDeprecated || !i.tags.includes("deprecated")
|
|
115
115
|
);
|
|
@@ -124,7 +124,7 @@ function ae(t, e, i) {
|
|
|
124
124
|
}
|
|
125
125
|
return r;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function ei(t, e, i) {
|
|
128
128
|
const r = t.createProgram();
|
|
129
129
|
if (!r)
|
|
130
130
|
throw new Error("Failed to create program");
|
|
@@ -135,7 +135,7 @@ function Jt(t, e, i) {
|
|
|
135
135
|
}
|
|
136
136
|
return t.deleteShader(n), t.deleteShader(s), r;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function ti(t, e, i, r, n) {
|
|
139
139
|
const s = t.createTexture();
|
|
140
140
|
if (!s)
|
|
141
141
|
throw new Error("Failed to create texture");
|
|
@@ -151,7 +151,7 @@ function ei(t, e, i, r, n) {
|
|
|
151
151
|
i
|
|
152
152
|
), t.bindTexture(t.TEXTURE_2D, null), s;
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function Ze(t, e, i) {
|
|
155
155
|
const r = t.getParameter(
|
|
156
156
|
t.TEXTURE_BINDING_2D
|
|
157
157
|
), n = t.getParameter(
|
|
@@ -183,19 +183,19 @@ function Qe(t, e, i) {
|
|
|
183
183
|
}
|
|
184
184
|
return a;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function Je(t) {
|
|
187
187
|
return {
|
|
188
188
|
kind: "rgba8-packed",
|
|
189
189
|
internalFormat: t.RGBA,
|
|
190
190
|
type: t.UNSIGNED_BYTE
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function ii(t) {
|
|
194
194
|
if (typeof WebGL2RenderingContext > "u" || !(t instanceof WebGL2RenderingContext))
|
|
195
195
|
throw new Error("zartigl requires WebGL2");
|
|
196
196
|
return t;
|
|
197
197
|
}
|
|
198
|
-
function
|
|
198
|
+
function ri(t) {
|
|
199
199
|
const e = [];
|
|
200
200
|
t.getExtension("EXT_color_buffer_float") ? e.push(
|
|
201
201
|
{ kind: "float32", internalFormat: t.RGBA32F, type: t.FLOAT },
|
|
@@ -206,15 +206,15 @@ function ii(t) {
|
|
|
206
206
|
type: t.HALF_FLOAT
|
|
207
207
|
});
|
|
208
208
|
for (const i of e)
|
|
209
|
-
if (
|
|
209
|
+
if (Ze(
|
|
210
210
|
t,
|
|
211
211
|
i.internalFormat,
|
|
212
212
|
i.type
|
|
213
213
|
))
|
|
214
214
|
return i;
|
|
215
|
-
return
|
|
215
|
+
return Je(t);
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function ni(t, e, i, r, n, s, o) {
|
|
218
218
|
const a = t.createTexture();
|
|
219
219
|
if (!a)
|
|
220
220
|
throw new Error("Failed to create texture");
|
|
@@ -230,10 +230,10 @@ function ri(t, e, i, r, n, s, o) {
|
|
|
230
230
|
i
|
|
231
231
|
), t.bindTexture(t.TEXTURE_2D, null), a;
|
|
232
232
|
}
|
|
233
|
-
function
|
|
233
|
+
function si(t, e, i) {
|
|
234
234
|
t.activeTexture(t.TEXTURE0 + i), t.bindTexture(t.TEXTURE_2D, e);
|
|
235
235
|
}
|
|
236
|
-
function
|
|
236
|
+
function ai(t, e) {
|
|
237
237
|
const i = t.createFramebuffer();
|
|
238
238
|
if (!i)
|
|
239
239
|
throw new Error("Failed to create framebuffer");
|
|
@@ -245,7 +245,7 @@ function si(t, e) {
|
|
|
245
245
|
0
|
|
246
246
|
), t.bindFramebuffer(t.FRAMEBUFFER, null), i;
|
|
247
247
|
}
|
|
248
|
-
function
|
|
248
|
+
function oi(t) {
|
|
249
249
|
const e = t.createBuffer();
|
|
250
250
|
if (!e)
|
|
251
251
|
throw new Error("Failed to create buffer");
|
|
@@ -255,7 +255,7 @@ function ai(t) {
|
|
|
255
255
|
t.STATIC_DRAW
|
|
256
256
|
), e;
|
|
257
257
|
}
|
|
258
|
-
const
|
|
258
|
+
const et = {
|
|
259
259
|
0: "#3288bd",
|
|
260
260
|
0.1: "#66c2a5",
|
|
261
261
|
0.2: "#abdda4",
|
|
@@ -265,8 +265,8 @@ const Je = {
|
|
|
265
265
|
0.6: "#f46d43",
|
|
266
266
|
1: "#d53e4f"
|
|
267
267
|
};
|
|
268
|
-
function
|
|
269
|
-
const r =
|
|
268
|
+
function ci(t, e, i) {
|
|
269
|
+
const r = Ke(e ?? et, i), n = document.createElement("canvas");
|
|
270
270
|
n.width = 256, n.height = 1;
|
|
271
271
|
const s = n.getContext("2d"), o = s.createLinearGradient(0, 0, 256, 0);
|
|
272
272
|
for (const [c, l] of Object.entries(r))
|
|
@@ -277,7 +277,7 @@ function oi(t, e, i) {
|
|
|
277
277
|
throw new Error("Failed to create color ramp texture");
|
|
278
278
|
return t.bindTexture(t.TEXTURE_2D, a), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, t.CLAMP_TO_EDGE), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, t.CLAMP_TO_EDGE), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, t.LINEAR), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, t.LINEAR), t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, t.RGBA, t.UNSIGNED_BYTE, n), t.bindTexture(t.TEXTURE_2D, null), a;
|
|
279
279
|
}
|
|
280
|
-
function
|
|
280
|
+
function li(t) {
|
|
281
281
|
const e = t.getExtension("WEBGL_debug_renderer_info");
|
|
282
282
|
return {
|
|
283
283
|
vendor: String(t.getParameter(t.VENDOR) ?? ""),
|
|
@@ -287,7 +287,7 @@ function ci(t) {
|
|
|
287
287
|
version: String(t.getParameter(t.VERSION) ?? "")
|
|
288
288
|
};
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function di(t) {
|
|
291
291
|
return {
|
|
292
292
|
program: t.getParameter(t.CURRENT_PROGRAM),
|
|
293
293
|
activeTexture: t.getParameter(t.ACTIVE_TEXTURE),
|
|
@@ -304,10 +304,41 @@ function li(t) {
|
|
|
304
304
|
]
|
|
305
305
|
};
|
|
306
306
|
}
|
|
307
|
-
function
|
|
307
|
+
function hi(t, e) {
|
|
308
308
|
t.useProgram(e.program), t.activeTexture(e.activeTexture), t.bindBuffer(t.ARRAY_BUFFER, e.arrayBuffer), t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, e.elementBuffer), t.bindFramebuffer(t.FRAMEBUFFER, e.framebuffer), e.blend ? t.enable(t.BLEND) : t.disable(t.BLEND), e.depthTest ? t.enable(t.DEPTH_TEST) : t.disable(t.DEPTH_TEST), e.stencilTest ? t.enable(t.STENCIL_TEST) : t.disable(t.STENCIL_TEST), t.viewport(e.viewport[0], e.viewport[1], e.viewport[2], e.viewport[3]), t.blendFunc(e.blendFunc[0], e.blendFunc[1]);
|
|
309
309
|
}
|
|
310
|
-
const
|
|
310
|
+
const fe = new Float32Array([
|
|
311
|
+
1,
|
|
312
|
+
0,
|
|
313
|
+
0,
|
|
314
|
+
0,
|
|
315
|
+
0,
|
|
316
|
+
1,
|
|
317
|
+
0,
|
|
318
|
+
0,
|
|
319
|
+
0,
|
|
320
|
+
0,
|
|
321
|
+
1,
|
|
322
|
+
0,
|
|
323
|
+
0,
|
|
324
|
+
0,
|
|
325
|
+
0,
|
|
326
|
+
1
|
|
327
|
+
]), ui = {
|
|
328
|
+
projectionTransition: 1,
|
|
329
|
+
fallbackMatrix: fe
|
|
330
|
+
};
|
|
331
|
+
function fi(t, e, i) {
|
|
332
|
+
t.uniform1f(
|
|
333
|
+
e.u_projection_transition,
|
|
334
|
+
i.projectionTransition ?? 1
|
|
335
|
+
), t.uniformMatrix4fv(
|
|
336
|
+
e.u_fallback_matrix,
|
|
337
|
+
!1,
|
|
338
|
+
i.fallbackMatrix ? i.fallbackMatrix instanceof Float32Array ? i.fallbackMatrix : new Float32Array(Array.from(i.fallbackMatrix)) : fe
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
const tt = {
|
|
311
342
|
degrees_c: "°C",
|
|
312
343
|
degc: "°C",
|
|
313
344
|
degrees_celsius: "°C",
|
|
@@ -323,7 +354,7 @@ const et = {
|
|
|
323
354
|
"0.001": "PSU",
|
|
324
355
|
psu: "PSU",
|
|
325
356
|
stress_level: ""
|
|
326
|
-
},
|
|
357
|
+
}, it = {
|
|
327
358
|
meter: "m",
|
|
328
359
|
meters: "m",
|
|
329
360
|
metre: "m",
|
|
@@ -346,12 +377,12 @@ const et = {
|
|
|
346
377
|
newton: "N",
|
|
347
378
|
pascal: "Pa",
|
|
348
379
|
kelvin: "K"
|
|
349
|
-
},
|
|
380
|
+
}, rt = "⁰¹²³⁴⁵⁶⁷⁸⁹";
|
|
350
381
|
function oe(t) {
|
|
351
|
-
return t === 1 ? "" : [...String(t)].map((e) =>
|
|
382
|
+
return t === 1 ? "" : [...String(t)].map((e) => rt[Number(e)]).join("");
|
|
352
383
|
}
|
|
353
|
-
function
|
|
354
|
-
const e = t?.trim() ?? "", i =
|
|
384
|
+
function mi(t) {
|
|
385
|
+
const e = t?.trim() ?? "", i = tt[e.toLowerCase()];
|
|
355
386
|
if (i != null)
|
|
356
387
|
return i;
|
|
357
388
|
if (e.includes("/"))
|
|
@@ -361,21 +392,21 @@ function hi(t) {
|
|
|
361
392
|
const o = /^([A-Za-z]+)\^?(-?\d+)?$/.exec(s);
|
|
362
393
|
if (!o)
|
|
363
394
|
return e.replace(/_/g, " ");
|
|
364
|
-
const a =
|
|
395
|
+
const a = it[o[1]] ?? o[1], c = Number(o[2] ?? 1);
|
|
365
396
|
c < 0 ? n.push(a + oe(-c)) : r.push(a + oe(c));
|
|
366
397
|
}
|
|
367
398
|
return [r.join(" ") || "1", ...n].join("/");
|
|
368
399
|
}
|
|
369
|
-
const ce = 20,
|
|
370
|
-
function
|
|
400
|
+
const ce = 20, nt = 600;
|
|
401
|
+
function st(t) {
|
|
371
402
|
const e = Math.max(0, Math.min(1, t));
|
|
372
|
-
return ce * Math.pow(
|
|
403
|
+
return ce * Math.pow(nt / ce, e);
|
|
373
404
|
}
|
|
374
|
-
function
|
|
375
|
-
return Math.exp(-1 /
|
|
405
|
+
function pi(t) {
|
|
406
|
+
return Math.exp(-1 / st(t));
|
|
376
407
|
}
|
|
377
|
-
const
|
|
378
|
-
class
|
|
408
|
+
const at = 0.8, ot = 120, ct = 300;
|
|
409
|
+
class Ei {
|
|
379
410
|
constructor(e) {
|
|
380
411
|
this.base = e, this.moving = !1, this.start = 0, this.duration = 0, this.from = e, this.to = e;
|
|
381
412
|
}
|
|
@@ -384,7 +415,7 @@ class fi {
|
|
|
384
415
|
this.base = e, this.moving || (this.from = e, this.to = e, this.duration = 0);
|
|
385
416
|
}
|
|
386
417
|
setMoving(e, i) {
|
|
387
|
-
e !== this.moving && (this.from = this.value(i), this.moving = e, this.to = e ?
|
|
418
|
+
e !== this.moving && (this.from = this.value(i), this.moving = e, this.to = e ? at : this.base, this.start = i, this.duration = e ? ot : ct);
|
|
388
419
|
}
|
|
389
420
|
value(e) {
|
|
390
421
|
if (this.duration === 0)
|
|
@@ -393,7 +424,7 @@ class fi {
|
|
|
393
424
|
return i === 1 ? (this.duration = 0, this.from = this.to, this.to) : this.from + (this.to - this.from) * i * i * (3 - 2 * i);
|
|
394
425
|
}
|
|
395
426
|
}
|
|
396
|
-
var
|
|
427
|
+
var lt = `vec3 velocityValue(vec4 texel, vec2 minimum, vec2 maximum, float physical) {
|
|
397
428
|
if (physical > 0.5) return texel.xyz;
|
|
398
429
|
return vec3(mix(minimum, maximum, texel.rg), texel.a);
|
|
399
430
|
}
|
|
@@ -401,7 +432,7 @@ var ct = `vec3 velocityValue(vec4 texel, vec2 minimum, vec2 maximum, float physi
|
|
|
401
432
|
vec3 blendVelocity(vec3 a, vec3 b, float fraction) {
|
|
402
433
|
if (fraction <= 0.0) return a;
|
|
403
434
|
return mix(a, b, fraction);
|
|
404
|
-
}`,
|
|
435
|
+
}`, dt = `vec3 applyVibrance(vec3 c, float v) {
|
|
405
436
|
float mx = max(c.r, max(c.g, c.b));
|
|
406
437
|
float mn = min(c.r, min(c.g, c.b));
|
|
407
438
|
float boost = v * (1.0 - (mx - mn));
|
|
@@ -422,7 +453,7 @@ vec3 gradeColor(vec3 c, vec4 g) {
|
|
|
422
453
|
|
|
423
454
|
c = mix(c, c * c * (3.0 - 2.0 * c), g.y);
|
|
424
455
|
return clamp(applyVibrance(c, g.z), 0.0, 1.0);
|
|
425
|
-
}`,
|
|
456
|
+
}`, ht = `uniform vec2 u_code_range;
|
|
426
457
|
uniform vec2 u_value_range;
|
|
427
458
|
uniform float u_scalar_transfer;
|
|
428
459
|
|
|
@@ -434,7 +465,7 @@ float geoVideoScalarValue(float r) {
|
|
|
434
465
|
float code = geoVideoScalarCode(r);
|
|
435
466
|
float t = mix(code, (pow(10.0, code) - 1.0) / 9.0, u_scalar_transfer);
|
|
436
467
|
return mix(u_value_range.x, u_value_range.y, t);
|
|
437
|
-
}`,
|
|
468
|
+
}`, ut = `uint pcg(uint v) {
|
|
438
469
|
uint state = v * 747796405u + 2891336453u;
|
|
439
470
|
uint word = ((state >> ((state >> 28u) + 4u)) ^ state) * 277803737u;
|
|
440
471
|
return (word >> 22u) ^ word;
|
|
@@ -442,13 +473,13 @@ float geoVideoScalarValue(float r) {
|
|
|
442
473
|
|
|
443
474
|
float random(uvec3 v) {
|
|
444
475
|
return float(pcg(v.x ^ pcg(v.y ^ pcg(v.z))) >> 8u) * (1.0 / 16777216.0);
|
|
445
|
-
}`,
|
|
476
|
+
}`, ft = `vec3 applyVibrance(vec3 c, float v) {
|
|
446
477
|
float mx = max(c.r, max(c.g, c.b));
|
|
447
478
|
float mn = min(c.r, min(c.g, c.b));
|
|
448
479
|
float boost = v * (1.0 - (mx - mn));
|
|
449
480
|
float luma = dot(c, vec3(0.299, 0.587, 0.114));
|
|
450
481
|
return mix(vec3(luma), c, 1.0 + boost);
|
|
451
|
-
}`,
|
|
482
|
+
}`, mt = `#define GLOW_SCALE 4
|
|
452
483
|
|
|
453
484
|
vec4 glowGather(sampler2D trails, ivec2 texel) {
|
|
454
485
|
ivec2 last = textureSize(trails, 0) - 1;
|
|
@@ -476,8 +507,8 @@ vec4 addGlow(vec4 trail, sampler2D glowTex, vec2 uv, float gain) {
|
|
|
476
507
|
vec3 rgb = (trail.rgb * trail.a + glow.rgb * under) / max(alpha, 1e-4);
|
|
477
508
|
return vec4(rgb, alpha);
|
|
478
509
|
}`;
|
|
479
|
-
const
|
|
480
|
-
function
|
|
510
|
+
const gi = ft, Ti = dt, bi = ut, wi = ht, yi = lt, _i = mt, xi = 4, Ri = 1.2;
|
|
511
|
+
function vi(t) {
|
|
481
512
|
if (t == null)
|
|
482
513
|
return null;
|
|
483
514
|
if (!Number.isFinite(t[0]) || !Number.isFinite(t[1]) || t[0] >= t[1])
|
|
@@ -486,7 +517,7 @@ function Ri(t) {
|
|
|
486
517
|
);
|
|
487
518
|
return [t[0], t[1]];
|
|
488
519
|
}
|
|
489
|
-
function
|
|
520
|
+
function R(t, e) {
|
|
490
521
|
if (typeof t != "number" || !Number.isFinite(t))
|
|
491
522
|
throw new Error(`Invalid GeoVideo manifest ${e}`);
|
|
492
523
|
return t;
|
|
@@ -517,7 +548,7 @@ function le(t) {
|
|
|
517
548
|
if (!Array.isArray(e.bounds) || e.bounds.length !== 4)
|
|
518
549
|
throw new Error("Invalid GeoVideo manifest bounds");
|
|
519
550
|
const [i, r, n, s] = e.bounds.map(
|
|
520
|
-
(m, E) =>
|
|
551
|
+
(m, E) => R(m, `bounds[${E}]`)
|
|
521
552
|
);
|
|
522
553
|
if (r < -90 || s > 90 || r >= s || i === n)
|
|
523
554
|
throw new Error("Invalid GeoVideo geographic bounds");
|
|
@@ -525,26 +556,26 @@ function le(t) {
|
|
|
525
556
|
if (!o || typeof o.url != "string" || !o.url)
|
|
526
557
|
throw new Error("Invalid GeoVideo media");
|
|
527
558
|
for (const m of ["width", "height", "fps", "durationSeconds"])
|
|
528
|
-
if (
|
|
559
|
+
if (R(o[m], `media.${m}`) <= 0)
|
|
529
560
|
throw new Error(`Invalid GeoVideo media.${m}`);
|
|
530
561
|
const a = e.encoding;
|
|
531
562
|
if (!a || a.bits !== 8 || a.colorSpace !== "bt709" || a.colorRange !== "limited" && a.colorRange !== "full")
|
|
532
563
|
throw new Error("Invalid GeoVideo encoding");
|
|
533
|
-
const c =
|
|
564
|
+
const c = R(a.codeMin, "encoding.codeMin"), l = R(a.codeMax, "encoding.codeMax");
|
|
534
565
|
if (c < 0 || l > 255 || c >= l)
|
|
535
566
|
throw new Error("Invalid GeoVideo code range");
|
|
536
567
|
let d = o.height;
|
|
537
568
|
if (a.kind === "scalar-luma") {
|
|
538
|
-
if (a.transfer !== "linear" && a.transfer !== "log10-1p9" ||
|
|
569
|
+
if (a.transfer !== "linear" && a.transfer !== "log10-1p9" || R(a.valueMin, "encoding.valueMin") >= R(a.valueMax, "encoding.valueMax"))
|
|
539
570
|
throw new Error("Invalid GeoVideo scalar-luma encoding");
|
|
540
571
|
} else if (a.kind === "vector-luma") {
|
|
541
|
-
if (a.transfer !== "linear" && a.transfer !== "sqrt" || a.layout !== "stacked-uv" ||
|
|
572
|
+
if (a.transfer !== "linear" && a.transfer !== "sqrt" || a.layout !== "stacked-uv" || R(a.valueDomain, "encoding.valueDomain") <= 0 || o.height % 2 !== 0)
|
|
542
573
|
throw new Error("Invalid GeoVideo vector-luma encoding");
|
|
543
574
|
d = o.height / 2;
|
|
544
575
|
} else
|
|
545
576
|
throw new Error("Unsupported GeoVideo encoding");
|
|
546
577
|
const h = e.mask;
|
|
547
|
-
if (!h || h.kind !== "static-validity" || typeof h.url != "string" || !h.url ||
|
|
578
|
+
if (!h || h.kind !== "static-validity" || typeof h.url != "string" || !h.url || R(h.width, "mask.width") !== o.width || R(h.height, "mask.height") !== d || R(h.threshold, "mask.threshold") < 0 || h.threshold > 1)
|
|
548
579
|
throw new Error("Invalid GeoVideo static mask");
|
|
549
580
|
if (e.timeline?.kind === "range") {
|
|
550
581
|
const m = B(e.timeline.dateStart, "timeline.dateStart");
|
|
@@ -573,7 +604,7 @@ function le(t) {
|
|
|
573
604
|
throw new Error("Invalid GeoVideo provenance");
|
|
574
605
|
return { ...e, bounds: [i, r, n, s] };
|
|
575
606
|
}
|
|
576
|
-
async function
|
|
607
|
+
async function pt(t, e) {
|
|
577
608
|
if (typeof t != "string")
|
|
578
609
|
return le(t);
|
|
579
610
|
const i = await fetch(t, { signal: e });
|
|
@@ -602,13 +633,13 @@ function M(t) {
|
|
|
602
633
|
(n, s) => e + (i - e) * s / (r - 1)
|
|
603
634
|
);
|
|
604
635
|
}
|
|
605
|
-
function
|
|
636
|
+
function me(t) {
|
|
606
637
|
return t.timeline.kind === "sample-sequence" ? t.timeline.values.length / t.media.durationSeconds : t.media.fps;
|
|
607
638
|
}
|
|
608
|
-
function
|
|
609
|
-
return e /
|
|
639
|
+
function ki(t, e) {
|
|
640
|
+
return e / me(t);
|
|
610
641
|
}
|
|
611
|
-
function
|
|
642
|
+
function Et(t, e) {
|
|
612
643
|
if (t.timeline.kind === "snapshot-loop")
|
|
613
644
|
return 0;
|
|
614
645
|
if (t.timeline.kind === "sample-sequence") {
|
|
@@ -620,22 +651,22 @@ function pt(t, e) {
|
|
|
620
651
|
return o * a + Math.min(a / 2, 0.5 / t.media.fps);
|
|
621
652
|
}
|
|
622
653
|
const i = new Date(t.timeline.dateStart).getTime(), r = new Date(t.timeline.dateEnd).getTime();
|
|
623
|
-
return Math.max(0, Math.min(1, (e - i) / (r - i))) *
|
|
654
|
+
return Math.max(0, Math.min(1, (e - i) / (r - i))) * pe(t);
|
|
624
655
|
}
|
|
625
|
-
function
|
|
656
|
+
function Ai(t, e) {
|
|
626
657
|
if (t.timeline.kind === "snapshot-loop")
|
|
627
658
|
return new Date(t.timeline.date).getTime();
|
|
628
659
|
if (t.timeline.kind === "sample-sequence") {
|
|
629
660
|
const o = M(t), a = t.media.durationSeconds / o.length, c = Math.floor((e + 0.25 / t.media.fps) / a);
|
|
630
661
|
return o[Math.max(0, Math.min(o.length - 1, c))];
|
|
631
662
|
}
|
|
632
|
-
const i = new Date(t.timeline.dateStart).getTime(), r = new Date(t.timeline.dateEnd).getTime(), n =
|
|
663
|
+
const i = new Date(t.timeline.dateStart).getTime(), r = new Date(t.timeline.dateEnd).getTime(), n = pe(t), s = n > 0 ? Math.max(0, Math.min(1, e / n)) : 0;
|
|
633
664
|
return i + (r - i) * s;
|
|
634
665
|
}
|
|
635
|
-
function
|
|
666
|
+
function pe(t) {
|
|
636
667
|
return Math.max(0, t.media.durationSeconds - 1 / t.media.fps);
|
|
637
668
|
}
|
|
638
|
-
function
|
|
669
|
+
function gt(t, e) {
|
|
639
670
|
const i = new Uint8Array(t.length / 4);
|
|
640
671
|
for (let r = 0; r < i.length; r++) {
|
|
641
672
|
const n = t[r * 4];
|
|
@@ -643,7 +674,7 @@ function Et(t, e) {
|
|
|
643
674
|
}
|
|
644
675
|
return i;
|
|
645
676
|
}
|
|
646
|
-
class
|
|
677
|
+
class Tt {
|
|
647
678
|
constructor() {
|
|
648
679
|
this.gl = null, this.texture = null, this.framebuffer = null;
|
|
649
680
|
}
|
|
@@ -684,7 +715,7 @@ function de(t) {
|
|
|
684
715
|
function g() {
|
|
685
716
|
return new DOMException("GeoVideo frame request was cancelled", "AbortError");
|
|
686
717
|
}
|
|
687
|
-
function
|
|
718
|
+
function G(t, e, i) {
|
|
688
719
|
return e ? e.aborted ? (t.catch(() => {
|
|
689
720
|
}), i?.(), Promise.reject(g())) : new Promise((r, n) => {
|
|
690
721
|
const s = () => {
|
|
@@ -700,18 +731,18 @@ function Q(t, e) {
|
|
|
700
731
|
(i) => t.addEventListener(e, () => i(), { once: !0 })
|
|
701
732
|
);
|
|
702
733
|
}
|
|
703
|
-
const
|
|
704
|
-
function
|
|
734
|
+
const bt = 250;
|
|
735
|
+
function wt(t) {
|
|
705
736
|
return "requestVideoFrameCallback" in t ? Promise.race([
|
|
706
737
|
new Promise(
|
|
707
738
|
(e) => t.requestVideoFrameCallback(() => e())
|
|
708
739
|
),
|
|
709
|
-
new Promise((e) => setTimeout(e,
|
|
740
|
+
new Promise((e) => setTimeout(e, bt))
|
|
710
741
|
]) : Promise.resolve();
|
|
711
742
|
}
|
|
712
|
-
class
|
|
743
|
+
class Ee {
|
|
713
744
|
constructor(e, i, r = {}) {
|
|
714
|
-
this.reader = new
|
|
745
|
+
this.reader = new Tt(), this.video = null, this.maskCodes = null, this.initPromise = null, this.presented = !1, this.primed = !1, this.queue = Promise.resolve(), this.frames = /* @__PURE__ */ new Map(), this.pending = /* @__PURE__ */ new Set(), this.manifest = e, this.planes = i, this.cacheSize = Math.max(1, r.cacheSize ?? 3), this.width = e.media.width, this.height = e.media.height / i, this.times = Float64Array.from(M(e));
|
|
715
746
|
}
|
|
716
747
|
/** Static validity, one 8-bit value per grid cell; null before init(). */
|
|
717
748
|
get mask() {
|
|
@@ -720,7 +751,7 @@ class pe {
|
|
|
720
751
|
/** Luma codes of the presented frame, or null when it is blank. */
|
|
721
752
|
readCodes(e, i) {
|
|
722
753
|
const r = this.reader.read(e, this.width, i);
|
|
723
|
-
return de(r) ? null :
|
|
754
|
+
return de(r) ? null : gt(r, this.manifest.encoding.colorRange);
|
|
724
755
|
}
|
|
725
756
|
/** True when the decoder exposed no pixels; reads back one row only. */
|
|
726
757
|
isBlank(e) {
|
|
@@ -753,7 +784,7 @@ class pe {
|
|
|
753
784
|
if (n ? (this.frames.delete(e), this.frames.set(e, n)) : n = this.enqueue(e), n.settled)
|
|
754
785
|
return n.promise;
|
|
755
786
|
const s = n;
|
|
756
|
-
return s.waiters++,
|
|
787
|
+
return s.waiters++, G(s.promise, r, () => this.leave(s));
|
|
757
788
|
}
|
|
758
789
|
enqueue(e) {
|
|
759
790
|
const i = new AbortController(), r = this.queue.then(
|
|
@@ -764,7 +795,7 @@ class pe {
|
|
|
764
795
|
const n = {
|
|
765
796
|
index: e,
|
|
766
797
|
controller: i,
|
|
767
|
-
promise:
|
|
798
|
+
promise: G(r, i.signal),
|
|
768
799
|
waiters: 0,
|
|
769
800
|
settled: !1
|
|
770
801
|
};
|
|
@@ -831,7 +862,7 @@ class pe {
|
|
|
831
862
|
async presentFrame(e, i) {
|
|
832
863
|
if (this.presented && Math.abs(e.currentTime - i) <= 1e-3 && !e.seeking)
|
|
833
864
|
return;
|
|
834
|
-
const r =
|
|
865
|
+
const r = wt(e), n = Q(e, "seeked");
|
|
835
866
|
e.currentTime = i, await n, e.readyState < HTMLMediaElement.HAVE_CURRENT_DATA && await Promise.race([Q(e, "loadeddata"), Q(e, "canplay")]), await r, this.presented = !0;
|
|
836
867
|
}
|
|
837
868
|
/**
|
|
@@ -849,7 +880,7 @@ class pe {
|
|
|
849
880
|
}
|
|
850
881
|
/** Media time inside the video frame showing step `index`. */
|
|
851
882
|
stepSeconds(e) {
|
|
852
|
-
return this.manifest.timeline.kind === "snapshot-loop" ? e / this.manifest.media.fps :
|
|
883
|
+
return this.manifest.timeline.kind === "snapshot-loop" ? e / this.manifest.media.fps : Et(this.manifest, this.times[e]);
|
|
853
884
|
}
|
|
854
885
|
/**
|
|
855
886
|
* Seek and capture one step. `signal` aborts it between steps; a seek
|
|
@@ -877,14 +908,14 @@ class pe {
|
|
|
877
908
|
return a;
|
|
878
909
|
}
|
|
879
910
|
}
|
|
880
|
-
function
|
|
911
|
+
function yt(t) {
|
|
881
912
|
return {
|
|
882
913
|
codeRange: [t.codeMin / 255, t.codeMax / 255],
|
|
883
914
|
valueRange: [t.valueMin, t.valueMax],
|
|
884
915
|
transfer: t.transfer === "log10-1p9" ? 1 : 0
|
|
885
916
|
};
|
|
886
917
|
}
|
|
887
|
-
class
|
|
918
|
+
class _t extends Ee {
|
|
888
919
|
constructor(e, i = {}) {
|
|
889
920
|
if (e.encoding.kind !== "scalar-luma")
|
|
890
921
|
throw new Error("GeoVideoScalarSource requires a scalar-luma manifest");
|
|
@@ -914,7 +945,7 @@ function Z(t, e) {
|
|
|
914
945
|
const { index: i, fraction: r } = v(t, e);
|
|
915
946
|
return i + r;
|
|
916
947
|
}
|
|
917
|
-
function
|
|
948
|
+
function xt(t, e) {
|
|
918
949
|
const i = Math.max(0, Math.min(t.length - 1, Math.floor(e))), r = Math.min(i + 1, t.length - 1);
|
|
919
950
|
return t[i] + (t[r] - t[i]) * Math.max(0, e - i);
|
|
920
951
|
}
|
|
@@ -950,7 +981,7 @@ function V(t, e, i) {
|
|
|
950
981
|
function P(t, e) {
|
|
951
982
|
return { at: e.start + 8, count: t.getUint32(e.start + 4) };
|
|
952
983
|
}
|
|
953
|
-
function
|
|
984
|
+
function Rt(t, e, i) {
|
|
954
985
|
const r = V(t, e, "edts"), n = r && V(t, r, "elst");
|
|
955
986
|
if (!n)
|
|
956
987
|
return;
|
|
@@ -958,7 +989,7 @@ function _t(t, e, i) {
|
|
|
958
989
|
if (o !== 1 || a !== i)
|
|
959
990
|
throw new Error("Unsupported MP4 edit list");
|
|
960
991
|
}
|
|
961
|
-
function
|
|
992
|
+
function vt(t) {
|
|
962
993
|
const e = new DataView(t), i = { type: "file", start: 0, end: t.byteLength }, r = b(e, i, "moov"), n = W(e, r.start, r.end).find((f) => {
|
|
963
994
|
if (f.type !== "trak")
|
|
964
995
|
return !1;
|
|
@@ -974,55 +1005,55 @@ function xt(t) {
|
|
|
974
1005
|
), o = b(e, s, "stsd"), [a] = W(e, o.start + 8, o.end);
|
|
975
1006
|
if (!a || a.type !== "avc1" && a.type !== "avc3")
|
|
976
1007
|
throw new Error(`Unsupported MP4 sample entry ${a?.type}`);
|
|
977
|
-
const c = e.getUint16(a.start + 24), l = e.getUint16(a.start + 26), d = b(e, { ...a, start: a.start + 78 }, "avcC"), h = new Uint8Array(t.slice(d.start, d.end)), p = (f) => h[f].toString(16).padStart(2, "0"), m = `avc1.${p(1)}${p(2)}${p(3)}`, E = b(e, s, "stsz"), w = e.getUint32(E.start + 4), y = e.getUint32(E.start + 8),
|
|
1008
|
+
const c = e.getUint16(a.start + 24), l = e.getUint16(a.start + 26), d = b(e, { ...a, start: a.start + 78 }, "avcC"), h = new Uint8Array(t.slice(d.start, d.end)), p = (f) => h[f].toString(16).padStart(2, "0"), m = `avc1.${p(1)}${p(2)}${p(3)}`, E = b(e, s, "stsz"), w = e.getUint32(E.start + 4), y = e.getUint32(E.start + 8), A = Array.from(
|
|
978
1009
|
{ length: y },
|
|
979
1010
|
(f, u) => w || e.getUint32(E.start + 12 + u * 4)
|
|
980
|
-
),
|
|
1011
|
+
), N = V(e, s, "co64"), O = N ?? b(e, s, "stco"), U = P(e, O), T = Array.from(
|
|
981
1012
|
{ length: U.count },
|
|
982
|
-
(f, u) =>
|
|
983
|
-
),
|
|
984
|
-
for (let f = 0; f <
|
|
985
|
-
const u =
|
|
1013
|
+
(f, u) => N ? Number(e.getBigUint64(U.at + u * 8)) : e.getUint32(U.at + u * 4)
|
|
1014
|
+
), _ = P(e, b(e, s, "stsc")), F = [];
|
|
1015
|
+
for (let f = 0; f < _.count; f++) {
|
|
1016
|
+
const u = _.at + f * 12, I = e.getUint32(u) - 1, x = e.getUint32(u + 4), j = f + 1 < _.count ? e.getUint32(u + 12) - 1 : T.length;
|
|
986
1017
|
for (let L = I; L < j; L++) {
|
|
987
1018
|
let C = T[L];
|
|
988
|
-
for (let re = 0; re <
|
|
989
|
-
F.push(C), C +=
|
|
1019
|
+
for (let re = 0; re < x && F.length < y; re++)
|
|
1020
|
+
F.push(C), C += A[F.length - 1];
|
|
990
1021
|
}
|
|
991
1022
|
}
|
|
992
|
-
const S = P(e, b(e, s, "stts")),
|
|
1023
|
+
const S = P(e, b(e, s, "stts")), k = [];
|
|
993
1024
|
let D = 0;
|
|
994
1025
|
for (let f = 0; f < S.count; f++) {
|
|
995
1026
|
const u = e.getUint32(S.at + f * 8), I = e.getUint32(S.at + f * 8 + 4);
|
|
996
|
-
for (let
|
|
997
|
-
|
|
1027
|
+
for (let x = 0; x < u; x++)
|
|
1028
|
+
k.push(D), D += I;
|
|
998
1029
|
}
|
|
999
1030
|
const z = V(e, s, "ctts");
|
|
1000
1031
|
if (z) {
|
|
1001
1032
|
const f = e.getUint8(z.start) === 1, u = P(e, z);
|
|
1002
1033
|
let I = 0;
|
|
1003
|
-
for (let
|
|
1004
|
-
const j = e.getUint32(u.at +
|
|
1034
|
+
for (let x = 0; x < u.count; x++) {
|
|
1035
|
+
const j = e.getUint32(u.at + x * 8), L = f ? e.getInt32(u.at + x * 8 + 4) : e.getUint32(u.at + x * 8 + 4);
|
|
1005
1036
|
for (let C = 0; C < j; C++)
|
|
1006
|
-
|
|
1037
|
+
k[I++] += L;
|
|
1007
1038
|
}
|
|
1008
1039
|
}
|
|
1009
|
-
|
|
1010
|
-
const
|
|
1011
|
-
|
|
1040
|
+
Rt(e, n, Math.min(...k.slice(0, y)));
|
|
1041
|
+
const we = k.slice(0, y).map((f, u) => [f, u]).sort((f, u) => f[0] - u[0]), te = new Array(y);
|
|
1042
|
+
we.forEach(([, f], u) => te[f] = u);
|
|
1012
1043
|
const Y = V(e, s, "stss"), ie = /* @__PURE__ */ new Set();
|
|
1013
1044
|
if (Y) {
|
|
1014
1045
|
const f = P(e, Y);
|
|
1015
1046
|
for (let u = 0; u < f.count; u++)
|
|
1016
1047
|
ie.add(e.getUint32(f.at + u * 4) - 1);
|
|
1017
1048
|
}
|
|
1018
|
-
if (F.length !== y ||
|
|
1049
|
+
if (F.length !== y || k.length < y)
|
|
1019
1050
|
throw new Error("Inconsistent MP4 sample tables");
|
|
1020
1051
|
return {
|
|
1021
1052
|
codec: m,
|
|
1022
1053
|
description: h,
|
|
1023
1054
|
width: c,
|
|
1024
1055
|
height: l,
|
|
1025
|
-
samples:
|
|
1056
|
+
samples: A.map((f, u) => ({
|
|
1026
1057
|
offset: F[u],
|
|
1027
1058
|
size: f,
|
|
1028
1059
|
frame: te[u],
|
|
@@ -1030,8 +1061,8 @@ function xt(t) {
|
|
|
1030
1061
|
}))
|
|
1031
1062
|
};
|
|
1032
1063
|
}
|
|
1033
|
-
const
|
|
1034
|
-
class At extends
|
|
1064
|
+
const kt = 50;
|
|
1065
|
+
class At extends _t {
|
|
1035
1066
|
constructor() {
|
|
1036
1067
|
super(...arguments), this.track = null, this.data = null, this.sampleOfFrame = [], this.decoder = null, this.fed = -1, this.taken = -1, this.outputs = /* @__PURE__ */ new Map(), this.progress = null, this.failure = null, this.loading = null;
|
|
1037
1068
|
}
|
|
@@ -1054,7 +1085,7 @@ class At extends yt {
|
|
|
1054
1085
|
const r = await i.arrayBuffer();
|
|
1055
1086
|
let n;
|
|
1056
1087
|
try {
|
|
1057
|
-
n =
|
|
1088
|
+
n = vt(r);
|
|
1058
1089
|
} catch {
|
|
1059
1090
|
return this.loading === e ? super.loadMedia() : void 0;
|
|
1060
1091
|
}
|
|
@@ -1155,7 +1186,7 @@ class At extends yt {
|
|
|
1155
1186
|
/** Next output, dequeue or error; a timer for decoders without events. */
|
|
1156
1187
|
waitProgress() {
|
|
1157
1188
|
return new Promise((e) => {
|
|
1158
|
-
const i = setTimeout(r,
|
|
1189
|
+
const i = setTimeout(r, kt);
|
|
1159
1190
|
function r() {
|
|
1160
1191
|
clearTimeout(i), e();
|
|
1161
1192
|
}
|
|
@@ -1173,11 +1204,11 @@ class At extends yt {
|
|
|
1173
1204
|
this.outputs.clear();
|
|
1174
1205
|
}
|
|
1175
1206
|
}
|
|
1176
|
-
function
|
|
1207
|
+
function Ft(t, e) {
|
|
1177
1208
|
let i = (t - e.codeMin) / (e.codeMax - e.codeMin) * 2 - 1;
|
|
1178
1209
|
return i = Math.max(-1, Math.min(1, i)), e.transfer === "sqrt" && (i = Math.sign(i) * i * i), i * e.valueDomain;
|
|
1179
1210
|
}
|
|
1180
|
-
function
|
|
1211
|
+
function St(t, e, i, r) {
|
|
1181
1212
|
const n = e.length;
|
|
1182
1213
|
if (t.length !== 2 * n)
|
|
1183
1214
|
throw new Error(
|
|
@@ -1185,7 +1216,7 @@ function Ft(t, e, i, r) {
|
|
|
1185
1216
|
);
|
|
1186
1217
|
const s = new Float32Array(256);
|
|
1187
1218
|
for (let l = 0; l < 256; l++)
|
|
1188
|
-
s[l] =
|
|
1219
|
+
s[l] = Ft(l, r);
|
|
1189
1220
|
const o = i * 255, a = new Float32Array(n), c = new Float32Array(n);
|
|
1190
1221
|
for (let l = 0; l < n; l++) {
|
|
1191
1222
|
const d = e[l] >= o;
|
|
@@ -1193,7 +1224,7 @@ function Ft(t, e, i, r) {
|
|
|
1193
1224
|
}
|
|
1194
1225
|
return { u: a, v: c };
|
|
1195
1226
|
}
|
|
1196
|
-
class
|
|
1227
|
+
class Ut extends Ee {
|
|
1197
1228
|
constructor(e, i = {}) {
|
|
1198
1229
|
if (e.encoding.kind !== "vector-luma")
|
|
1199
1230
|
throw new Error("GeoVideoVectorSource requires a vector-luma manifest");
|
|
@@ -1260,7 +1291,7 @@ class St extends pe {
|
|
|
1260
1291
|
/** u/v codes are written into luma: read back, then decoded on the CPU. */
|
|
1261
1292
|
async capture(e, i, r) {
|
|
1262
1293
|
const n = this.readCodes(e, i);
|
|
1263
|
-
return n ?
|
|
1294
|
+
return n ? St(
|
|
1264
1295
|
n,
|
|
1265
1296
|
r,
|
|
1266
1297
|
this.manifest.mask.threshold,
|
|
@@ -1268,7 +1299,7 @@ class St extends pe {
|
|
|
1268
1299
|
) : null;
|
|
1269
1300
|
}
|
|
1270
1301
|
}
|
|
1271
|
-
function
|
|
1302
|
+
function Mt(t, e, i = {}) {
|
|
1272
1303
|
const [r, n] = i.range ?? [-1 / 0, 1 / 0], s = [...t].sort((a, c) => a.start - c.start), o = s.find(
|
|
1273
1304
|
(a) => a.start > e && a.start <= n
|
|
1274
1305
|
) ?? (i.loop ? s.find(
|
|
@@ -1276,7 +1307,7 @@ function Ut(t, e, i = {}) {
|
|
|
1276
1307
|
) : void 0);
|
|
1277
1308
|
return o ? { chunk: o, time: Math.max(o.start, r) } : null;
|
|
1278
1309
|
}
|
|
1279
|
-
function
|
|
1310
|
+
function Dt(t, e) {
|
|
1280
1311
|
let i = null, r = -1 / 0;
|
|
1281
1312
|
for (const n of e) {
|
|
1282
1313
|
const s = Math.min(t.end, n.end) - Math.max(t.start, n.start);
|
|
@@ -1284,7 +1315,7 @@ function Mt(t, e) {
|
|
|
1284
1315
|
}
|
|
1285
1316
|
return i;
|
|
1286
1317
|
}
|
|
1287
|
-
function
|
|
1318
|
+
function Pt(t) {
|
|
1288
1319
|
return {
|
|
1289
1320
|
width: t.mask.width,
|
|
1290
1321
|
height: t.mask.height,
|
|
@@ -1292,11 +1323,11 @@ function Dt(t) {
|
|
|
1292
1323
|
rowOrder: "north-to-south"
|
|
1293
1324
|
};
|
|
1294
1325
|
}
|
|
1295
|
-
function
|
|
1296
|
-
return t.encoding.kind === "vector-luma" ? new
|
|
1326
|
+
function ge(t, e = {}) {
|
|
1327
|
+
return t.encoding.kind === "vector-luma" ? new Ut(t, e) : new At(t, e);
|
|
1297
1328
|
}
|
|
1298
|
-
const
|
|
1299
|
-
function
|
|
1329
|
+
const Gt = 3, Nt = 3, It = 0.6, Lt = 1.5;
|
|
1330
|
+
function Ct(t) {
|
|
1300
1331
|
const e = new AbortController();
|
|
1301
1332
|
if (!t)
|
|
1302
1333
|
return { controller: e, unlink: () => {
|
|
@@ -1307,14 +1338,14 @@ function Lt(t) {
|
|
|
1307
1338
|
unlink: () => t.removeEventListener("abort", i)
|
|
1308
1339
|
};
|
|
1309
1340
|
}
|
|
1310
|
-
class
|
|
1341
|
+
class Fi {
|
|
1311
1342
|
constructor(e) {
|
|
1312
1343
|
this.manifests = /* @__PURE__ */ new Map(), this.open = /* @__PURE__ */ new Map(), this.id = e.id, this.chunks = e.chunks.filter(
|
|
1313
1344
|
(i) => Number.isFinite(i.start) && Number.isFinite(i.end) && i.end >= i.start
|
|
1314
|
-
).sort((i, r) => i.start - r.start), this.maxOpenChunks = Math.max(2, e.maxOpenChunks ??
|
|
1345
|
+
).sort((i, r) => i.start - r.start), this.maxOpenChunks = Math.max(2, e.maxOpenChunks ?? Gt), this.frameCacheSize = Math.max(
|
|
1315
1346
|
1,
|
|
1316
1347
|
e.frameCacheSize ?? Nt
|
|
1317
|
-
), this.prefetchAt = e.prefetchAt ??
|
|
1348
|
+
), this.prefetchAt = e.prefetchAt ?? It, this.maxGap = e.maxGap, this.loadManifest = e.loadManifest ?? pt, this.createFrameSource = e.createFrameSource ?? ((i, r) => ge(
|
|
1318
1349
|
i,
|
|
1319
1350
|
r
|
|
1320
1351
|
));
|
|
@@ -1333,7 +1364,7 @@ class vi {
|
|
|
1333
1364
|
async steps(e = {}) {
|
|
1334
1365
|
if (e.signal?.aborted)
|
|
1335
1366
|
throw g();
|
|
1336
|
-
const i = await
|
|
1367
|
+
const i = await G(
|
|
1337
1368
|
Promise.all(this.chunks.map((r) => this.manifest(r))),
|
|
1338
1369
|
e.signal
|
|
1339
1370
|
);
|
|
@@ -1350,24 +1381,24 @@ class vi {
|
|
|
1350
1381
|
const s = this.chunkIndexAt(e);
|
|
1351
1382
|
if (s < 0)
|
|
1352
1383
|
return null;
|
|
1353
|
-
const o = [], { controller: a, unlink: c } =
|
|
1384
|
+
const o = [], { controller: a, unlink: c } = Ct(r);
|
|
1354
1385
|
try {
|
|
1355
|
-
const l = this.acquire(this.chunks[s], o), d = await
|
|
1386
|
+
const l = this.acquire(this.chunks[s], o), d = await G(l.ready, a.signal), { times: h } = d;
|
|
1356
1387
|
let p;
|
|
1357
1388
|
if (e <= h[h.length - 1]) {
|
|
1358
|
-
const { index: T, fraction:
|
|
1359
|
-
p = n === "discrete" ||
|
|
1389
|
+
const { index: T, fraction: _ } = v(h, e);
|
|
1390
|
+
p = n === "discrete" || _ === 0 ? [l, T, l, T, 0] : [l, T, l, T + 1, _];
|
|
1360
1391
|
} else {
|
|
1361
1392
|
const T = this.chunks[s + 1];
|
|
1362
1393
|
if (!T)
|
|
1363
1394
|
return null;
|
|
1364
|
-
const
|
|
1365
|
-
if (D -
|
|
1395
|
+
const _ = this.acquire(T, o), F = await G(_.ready, a.signal), S = h.length - 1, k = h[S], D = F.times[0];
|
|
1396
|
+
if (D - k > this.gapLimit(h, F.times))
|
|
1366
1397
|
return null;
|
|
1367
|
-
p = n === "discrete" ? [l, S, l, S, 0] : e >= D ? [
|
|
1398
|
+
p = n === "discrete" ? [l, S, l, S, 0] : e >= D ? [_, 0, _, 0, 0] : [l, S, _, 0, (e - k) / (D - k)];
|
|
1368
1399
|
}
|
|
1369
|
-
const [m, E, w, y,
|
|
1370
|
-
|
|
1400
|
+
const [m, E, w, y, A] = p, N = m === w && E === y, O = [this.frame(m, E, a.signal)];
|
|
1401
|
+
N || O.push(this.frame(w, y, a.signal));
|
|
1371
1402
|
let U;
|
|
1372
1403
|
try {
|
|
1373
1404
|
U = await Promise.all(O);
|
|
@@ -1377,8 +1408,8 @@ class vi {
|
|
|
1377
1408
|
return this.prefetchAfter(s, e), {
|
|
1378
1409
|
time: e,
|
|
1379
1410
|
a: U[0],
|
|
1380
|
-
b: U[
|
|
1381
|
-
mix:
|
|
1411
|
+
b: U[N ? 0 : 1],
|
|
1412
|
+
mix: A
|
|
1382
1413
|
};
|
|
1383
1414
|
} finally {
|
|
1384
1415
|
c();
|
|
@@ -1417,7 +1448,7 @@ class vi {
|
|
|
1417
1448
|
e.length > 1 ? e[e.length - 1] - e[e.length - 2] : 0,
|
|
1418
1449
|
i.length > 1 ? i[1] - i[0] : 0
|
|
1419
1450
|
], n = Math.max(...r);
|
|
1420
|
-
return n > 0 ? n *
|
|
1451
|
+
return n > 0 ? n * Lt : -1 / 0;
|
|
1421
1452
|
}
|
|
1422
1453
|
prefetchAfter(e, i) {
|
|
1423
1454
|
const r = this.chunks[e], n = this.chunks[e + 1], s = r.end - r.start, o = s > 0 ? (i - r.start) / s : 1;
|
|
@@ -1454,7 +1485,7 @@ class vi {
|
|
|
1454
1485
|
return r.opened = {
|
|
1455
1486
|
manifest: n,
|
|
1456
1487
|
times: Float64Array.from(M(n)),
|
|
1457
|
-
grid:
|
|
1488
|
+
grid: Pt(n),
|
|
1458
1489
|
source: this.createFrameSource(n, {
|
|
1459
1490
|
cacheSize: this.frameCacheSize
|
|
1460
1491
|
})
|
|
@@ -1466,7 +1497,7 @@ class vi {
|
|
|
1466
1497
|
return this.open.set(e.key, i), i;
|
|
1467
1498
|
}
|
|
1468
1499
|
async frame(e, i, r) {
|
|
1469
|
-
const { manifest: n, times: s, grid: o, source: a } = await
|
|
1500
|
+
const { manifest: n, times: s, grid: o, source: a } = await G(
|
|
1470
1501
|
e.ready,
|
|
1471
1502
|
r
|
|
1472
1503
|
);
|
|
@@ -1496,18 +1527,18 @@ class vi {
|
|
|
1496
1527
|
e.released = !0, e.prefetch?.abort(), e.prefetch = null, e.opened?.source.release(), e.opened = null, this.open.get(e.chunk.key) === e && this.open.delete(e.chunk.key);
|
|
1497
1528
|
}
|
|
1498
1529
|
}
|
|
1499
|
-
const
|
|
1530
|
+
const Vt = {
|
|
1500
1531
|
a: "u_vel0",
|
|
1501
1532
|
b: "u_vel1",
|
|
1502
1533
|
mix: "u_vel_mix",
|
|
1503
1534
|
bounds: "u_bounds"
|
|
1504
|
-
},
|
|
1535
|
+
}, Ot = {
|
|
1505
1536
|
a: "u_tint0",
|
|
1506
1537
|
b: "u_tint1",
|
|
1507
1538
|
mix: "u_tint_mix",
|
|
1508
1539
|
bounds: "u_tint_bounds"
|
|
1509
1540
|
};
|
|
1510
|
-
function
|
|
1541
|
+
function Bt(t) {
|
|
1511
1542
|
const e = new Float32Array(t.u.length * 4);
|
|
1512
1543
|
for (let i = 0; i < t.u.length; i++) {
|
|
1513
1544
|
const r = t.u[i], n = t.v[i];
|
|
@@ -1515,9 +1546,9 @@ function Ot(t) {
|
|
|
1515
1546
|
}
|
|
1516
1547
|
return e;
|
|
1517
1548
|
}
|
|
1518
|
-
class
|
|
1549
|
+
class Xt {
|
|
1519
1550
|
constructor(e, i, r = {}) {
|
|
1520
|
-
this.gl = e, this.manifest = i, this.options = r, this.textures = /* @__PURE__ */ new Map(), this.pending = /* @__PURE__ */ new Map(), this.mask = null, this.pair = null, this.destroyed = !1, this.linearFilter = !0, this.uploadedFrames = 0, this.lastUploadDurationMs = 0, this.vector = i.encoding.kind === "vector-luma", this.source =
|
|
1551
|
+
this.gl = e, this.manifest = i, this.options = r, this.textures = /* @__PURE__ */ new Map(), this.pending = /* @__PURE__ */ new Map(), this.mask = null, this.pair = null, this.destroyed = !1, this.linearFilter = !0, this.uploadedFrames = 0, this.lastUploadDurationMs = 0, this.vector = i.encoding.kind === "vector-luma", this.source = ge(i, { cacheSize: 2 }), this.uniforms = this.vector ? Vt : Ot;
|
|
1521
1552
|
const n = M(i);
|
|
1522
1553
|
this.times = r.animateSnapshot && i.timeline.kind === "snapshot-loop" ? Array.from(
|
|
1523
1554
|
{
|
|
@@ -1612,7 +1643,7 @@ class Bt {
|
|
|
1612
1643
|
return !1;
|
|
1613
1644
|
const n = this.uniforms;
|
|
1614
1645
|
if (e.texture(n.a, r, this.pair[0]), e.texture(n.b, r + 1, this.pair[1]), e.float(n.mix, this.pair[2]), e.vec4(n.bounds, this.bounds), this.mask && this.manifest.encoding.kind === "scalar-luma") {
|
|
1615
|
-
const { codeRange: s, valueRange: o, transfer: a } =
|
|
1646
|
+
const { codeRange: s, valueRange: o, transfer: a } = yt(
|
|
1616
1647
|
this.manifest.encoding
|
|
1617
1648
|
);
|
|
1618
1649
|
e.texture("u_tint_mask", r + 2, this.mask), e.vec2("u_code_range", ...s), e.vec2("u_value_range", ...o), e.float("u_scalar_transfer", a);
|
|
@@ -1669,7 +1700,7 @@ class Bt {
|
|
|
1669
1700
|
0,
|
|
1670
1701
|
i.RGBA,
|
|
1671
1702
|
i.FLOAT,
|
|
1672
|
-
|
|
1703
|
+
Bt(e)
|
|
1673
1704
|
) : (i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, !1), i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1), i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL, i.NONE), i.texImage2D(
|
|
1674
1705
|
i.TEXTURE_2D,
|
|
1675
1706
|
0,
|
|
@@ -1685,7 +1716,7 @@ class Bt {
|
|
|
1685
1716
|
if (!e)
|
|
1686
1717
|
return null;
|
|
1687
1718
|
const i = this.gl, r = this.gridTexture();
|
|
1688
|
-
return this.options.
|
|
1719
|
+
return this.options.nearestMask && (i.texParameteri(i.TEXTURE_2D, i.TEXTURE_MIN_FILTER, i.NEAREST), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_MAG_FILTER, i.NEAREST)), i.pixelStorei(i.UNPACK_ALIGNMENT, 1), i.texImage2D(
|
|
1689
1720
|
i.TEXTURE_2D,
|
|
1690
1721
|
0,
|
|
1691
1722
|
i.R8,
|
|
@@ -1722,7 +1753,7 @@ class Bt {
|
|
|
1722
1753
|
}
|
|
1723
1754
|
}
|
|
1724
1755
|
}
|
|
1725
|
-
class
|
|
1756
|
+
class $t {
|
|
1726
1757
|
constructor(e, i) {
|
|
1727
1758
|
this.onPlaying = i, this.time = 0, this.endFraction = 0, this.held = !1, this.playingValue = e;
|
|
1728
1759
|
}
|
|
@@ -1757,7 +1788,7 @@ class Xt {
|
|
|
1757
1788
|
const a = Z(i, n[0]), c = Z(i, n[1]), l = c + (o ? 1 : 0);
|
|
1758
1789
|
let d = Math.max(a, Z(i, this.ms) + this.endFraction) + Math.max(0, e) * r;
|
|
1759
1790
|
const h = o ? d >= l : d > l;
|
|
1760
|
-
return h && s && l > a ? d = a + (d - a) % (l - a) : d = Math.min(l, d), this.time =
|
|
1791
|
+
return h && s && l > a ? d = a + (d - a) % (l - a) : d = Math.min(l, d), this.time = xt(i, Math.min(c, d)), this.endFraction = Math.max(0, d - c), h && !s;
|
|
1761
1792
|
}
|
|
1762
1793
|
}
|
|
1763
1794
|
function X(t) {
|
|
@@ -1770,11 +1801,11 @@ function J(t, e) {
|
|
|
1770
1801
|
function $([t, e], i) {
|
|
1771
1802
|
return Math.max(t, Math.min(e, i));
|
|
1772
1803
|
}
|
|
1773
|
-
class
|
|
1804
|
+
class Si {
|
|
1774
1805
|
constructor(e, i, r) {
|
|
1775
1806
|
this.repaint = i, this.emit = r, this.field = null, this.manifest = null, this.gl = null, this.pendingField = null, this.standby = null, this.awaitingNext = !1, this.timeRange = null, this.lastTick = null, this.lastStepTime = null, this.seekId = 0, this.seeking = !1, this.failed = !1, this.exactTime = 0, this.endEmitted = !1, this.destroyed = !1, this.resumePlayback = !1, this.playOnReady = e.autoplay ?? !0, this.loop = e.loop ?? !0, this.playbackRate = e.playbackRate ?? 1, this.stepsPerSecond = e.stepsPerSecond;
|
|
1776
1807
|
const n = typeof e.time == "string" ? Date.parse(e.time) : e.time;
|
|
1777
|
-
this.requestedTime = n != null && Number.isFinite(n) ? n : null, this.requestedTimeRange = e.timeRange, this.clock = new
|
|
1808
|
+
this.requestedTime = n != null && Number.isFinite(n) ? n : null, this.requestedTimeRange = e.timeRange, this.clock = new $t(
|
|
1778
1809
|
!1,
|
|
1779
1810
|
(s) => this.emit("playbackChange", s)
|
|
1780
1811
|
);
|
|
@@ -1840,7 +1871,7 @@ class Ai {
|
|
|
1840
1871
|
const r = this.clock.advance(
|
|
1841
1872
|
i,
|
|
1842
1873
|
this.field.times,
|
|
1843
|
-
this.stepsPerSecond ?? this.playbackRate *
|
|
1874
|
+
this.stepsPerSecond ?? this.playbackRate * me(this.field.manifest),
|
|
1844
1875
|
this.playbackRange(this.field),
|
|
1845
1876
|
this.loop,
|
|
1846
1877
|
!0
|
|
@@ -1983,8 +2014,8 @@ class Ai {
|
|
|
1983
2014
|
];
|
|
1984
2015
|
}
|
|
1985
2016
|
createField(e) {
|
|
1986
|
-
const i = new
|
|
1987
|
-
|
|
2017
|
+
const i = new Xt(this.gl, e, {
|
|
2018
|
+
nearestMask: !0,
|
|
1988
2019
|
animateSnapshot: !0,
|
|
1989
2020
|
onError: (r) => {
|
|
1990
2021
|
this.field === i && !this.seeking && this.reportError(r);
|
|
@@ -2006,18 +2037,18 @@ function H(t) {
|
|
|
2006
2037
|
end: Date.parse(i ?? e ?? "")
|
|
2007
2038
|
};
|
|
2008
2039
|
}
|
|
2009
|
-
function
|
|
2010
|
-
const r = t.filter((s) => s.id === e.id && s.temporal?.start != null).map(H), n =
|
|
2040
|
+
function Ui(t, e, i = {}) {
|
|
2041
|
+
const r = t.filter((s) => s.id === e.id && s.temporal?.start != null).map(H), n = Mt(
|
|
2011
2042
|
r,
|
|
2012
2043
|
Date.parse(e.temporal?.end ?? ""),
|
|
2013
2044
|
i
|
|
2014
2045
|
);
|
|
2015
2046
|
return n ? { source: n.chunk.source, time: n.time } : null;
|
|
2016
2047
|
}
|
|
2017
|
-
function
|
|
2018
|
-
return
|
|
2048
|
+
function Mi(t, e) {
|
|
2049
|
+
return Dt(H(t), e.map(H))?.source ?? null;
|
|
2019
2050
|
}
|
|
2020
|
-
function
|
|
2051
|
+
function Di(t, e = {}) {
|
|
2021
2052
|
const i = e.start ?? -1 / 0, r = e.end ?? 1 / 0, n = t.map(H).filter((a) => a.end >= i && a.start <= r).sort((a, c) => a.start - c.start);
|
|
2022
2053
|
if (n.length === 0)
|
|
2023
2054
|
return;
|
|
@@ -2028,22 +2059,22 @@ function Si(t, e = {}) {
|
|
|
2028
2059
|
(a, c) => o(c) <= o(a) ? c : a
|
|
2029
2060
|
).source;
|
|
2030
2061
|
}
|
|
2031
|
-
const
|
|
2032
|
-
function
|
|
2062
|
+
const qt = /^P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/;
|
|
2063
|
+
function Wt(t) {
|
|
2033
2064
|
return t instanceof Date ? t.getTime() : typeof t == "number" ? t : new Date(t).getTime();
|
|
2034
2065
|
}
|
|
2035
2066
|
function he(t, e) {
|
|
2036
|
-
const i =
|
|
2067
|
+
const i = Wt(t);
|
|
2037
2068
|
if (!Number.isFinite(i))
|
|
2038
2069
|
throw new Error(`Invalid ${e}`);
|
|
2039
2070
|
return i;
|
|
2040
2071
|
}
|
|
2041
|
-
function
|
|
2042
|
-
const i = e.match(
|
|
2072
|
+
function Te(t, e) {
|
|
2073
|
+
const i = e.match(qt);
|
|
2043
2074
|
if (!i)
|
|
2044
2075
|
throw new Error(`Invalid trailing time duration: ${e}`);
|
|
2045
|
-
const r = i.slice(1).map((
|
|
2046
|
-
if (!r.some((
|
|
2076
|
+
const r = i.slice(1).map((A) => Number(A ?? 0));
|
|
2077
|
+
if (!r.some((A) => A > 0))
|
|
2047
2078
|
throw new Error("Trailing time duration must be positive");
|
|
2048
2079
|
const [n, s, o, a, c, l, d] = r, h = new Date(t), p = h.getUTCFullYear() * 12 + h.getUTCMonth() - n * 12 - s, m = Math.floor(p / 12), E = (p % 12 + 12) % 12, w = new Date(Date.UTC(m, E + 1, 0)).getUTCDate();
|
|
2049
2080
|
return Date.UTC(
|
|
@@ -2056,15 +2087,15 @@ function ge(t, e) {
|
|
|
2056
2087
|
h.getUTCMilliseconds()
|
|
2057
2088
|
) - (((o * 7 + a) * 24 + c) * 60 + l) * 6e4 - d * 1e3;
|
|
2058
2089
|
}
|
|
2059
|
-
function
|
|
2090
|
+
function Pi(t, [e, i]) {
|
|
2060
2091
|
let r = e, n = i;
|
|
2061
|
-
if (typeof t.trailing == "string" ? r =
|
|
2092
|
+
if (typeof t.trailing == "string" ? r = Te(i, t.trailing) : (t.start != null && (r = he(t.start, "time range start")), t.end != null && (n = he(t.end, "time range end"))), r > n)
|
|
2062
2093
|
throw new Error("Time range start must not follow its end");
|
|
2063
2094
|
return [Math.max(e, r), Math.min(i, n)];
|
|
2064
2095
|
}
|
|
2065
|
-
const
|
|
2066
|
-
function
|
|
2067
|
-
if (!
|
|
2096
|
+
const Ht = (t) => typeof t == "object" && t !== null && !Array.isArray(t);
|
|
2097
|
+
function Gi(t, e) {
|
|
2098
|
+
if (!Ht(t))
|
|
2068
2099
|
throw new Error(`${e} must be an object`);
|
|
2069
2100
|
for (const s of Object.keys(t))
|
|
2070
2101
|
if (s !== "start" && s !== "end" && s !== "trailing")
|
|
@@ -2074,7 +2105,7 @@ function Mi(t, e) {
|
|
|
2074
2105
|
throw new Error(`${e}.trailing excludes start and end`);
|
|
2075
2106
|
if (typeof t.trailing != "string")
|
|
2076
2107
|
throw new Error(`${e}.trailing must be an ISO 8601 duration`);
|
|
2077
|
-
return
|
|
2108
|
+
return Te(0, t.trailing), { trailing: t.trailing };
|
|
2078
2109
|
}
|
|
2079
2110
|
const i = (s) => {
|
|
2080
2111
|
const o = t[s];
|
|
@@ -2091,14 +2122,14 @@ function Mi(t, e) {
|
|
|
2091
2122
|
...n !== void 0 && { end: n }
|
|
2092
2123
|
};
|
|
2093
2124
|
}
|
|
2094
|
-
function
|
|
2125
|
+
function Ni(t, e) {
|
|
2095
2126
|
return !!t && !!e && t.name === e.name && t.units === e.units && t.positive === e.positive && t.value === e.value;
|
|
2096
2127
|
}
|
|
2097
2128
|
function q(t) {
|
|
2098
2129
|
const e = t;
|
|
2099
2130
|
return !!e && typeof e.name == "string" && typeof e.units == "string" && typeof e.positive == "string" && Number.isFinite(e.value);
|
|
2100
2131
|
}
|
|
2101
|
-
function
|
|
2132
|
+
function zt(t) {
|
|
2102
2133
|
const e = t.depths;
|
|
2103
2134
|
if (e === void 0)
|
|
2104
2135
|
return t.surface === void 0 || q(t.surface);
|
|
@@ -2111,16 +2142,16 @@ function Ht(t) {
|
|
|
2111
2142
|
return r.add(n.value), s;
|
|
2112
2143
|
});
|
|
2113
2144
|
}
|
|
2114
|
-
function
|
|
2145
|
+
function Ii(t) {
|
|
2115
2146
|
return t.type === "geovideo" && typeof t.indexUrl == "string";
|
|
2116
2147
|
}
|
|
2117
|
-
function
|
|
2148
|
+
function Li(t, e) {
|
|
2118
2149
|
return t.id === e.id && (t.type !== "geovideo" || e.type !== "geovideo" || t.manifestUrl === e.manifestUrl);
|
|
2119
2150
|
}
|
|
2120
2151
|
function ee(t) {
|
|
2121
2152
|
return typeof t == "string" && Number.isFinite(Date.parse(t));
|
|
2122
2153
|
}
|
|
2123
|
-
function
|
|
2154
|
+
function Yt(t) {
|
|
2124
2155
|
const e = t.times;
|
|
2125
2156
|
if (!Array.isArray(e) || e.length !== t.samples || e[0] !== t.start || e[e.length - 1] !== t.end)
|
|
2126
2157
|
return !1;
|
|
@@ -2133,30 +2164,30 @@ function zt(t) {
|
|
|
2133
2164
|
}
|
|
2134
2165
|
return !0;
|
|
2135
2166
|
}
|
|
2136
|
-
function
|
|
2167
|
+
function jt(t) {
|
|
2137
2168
|
const e = t;
|
|
2138
2169
|
if (!e || e.schemaVersion !== 1 || e.type !== "geovideo-index" || !Array.isArray(e.chunks))
|
|
2139
2170
|
throw new Error("Unsupported GeoVideo index");
|
|
2140
|
-
if (!
|
|
2171
|
+
if (!zt(e) || e.vertical !== void 0 && !q(e.vertical))
|
|
2141
2172
|
throw new Error("Invalid GeoVideo index levels");
|
|
2142
2173
|
for (const i of e.chunks)
|
|
2143
|
-
if (!ee(i?.start) || !ee(i.end) || Date.parse(i.end) < Date.parse(i.start) || typeof i.manifestUrl != "string" || i.times !== void 0 && !
|
|
2174
|
+
if (!ee(i?.start) || !ee(i.end) || Date.parse(i.end) < Date.parse(i.start) || typeof i.manifestUrl != "string" || i.times !== void 0 && !Yt(i))
|
|
2144
2175
|
throw new Error("Invalid GeoVideo index chunk");
|
|
2145
2176
|
return e;
|
|
2146
2177
|
}
|
|
2147
|
-
async function
|
|
2178
|
+
async function Ci(t, e) {
|
|
2148
2179
|
const i = await fetch(t, { signal: e });
|
|
2149
2180
|
if (!i.ok)
|
|
2150
2181
|
throw new Error(
|
|
2151
2182
|
`GeoVideo index request failed (${i.status}): ${t}`
|
|
2152
2183
|
);
|
|
2153
|
-
return
|
|
2184
|
+
return jt(await i.json());
|
|
2154
2185
|
}
|
|
2155
|
-
function
|
|
2186
|
+
function be(t) {
|
|
2156
2187
|
return typeof document < "u" ? new URL(t, document.baseURI).href : t;
|
|
2157
2188
|
}
|
|
2158
|
-
function
|
|
2159
|
-
const i =
|
|
2189
|
+
function Kt(t, e) {
|
|
2190
|
+
const i = be(e);
|
|
2160
2191
|
return t.chunks.map((r) => ({
|
|
2161
2192
|
key: r.key,
|
|
2162
2193
|
manifestUrl: new URL(r.manifestUrl, i).href,
|
|
@@ -2167,15 +2198,15 @@ function jt(t, e) {
|
|
|
2167
2198
|
...r.provisional ? { provisional: !0 } : {}
|
|
2168
2199
|
}));
|
|
2169
2200
|
}
|
|
2170
|
-
function
|
|
2201
|
+
function Qt(t, e, i) {
|
|
2171
2202
|
if (e.sourceId !== t.id || e.catalogEntryId !== i.id)
|
|
2172
2203
|
throw new Error(
|
|
2173
2204
|
`GeoVideo index identity does not match catalog entry/source: ${t.id}`
|
|
2174
2205
|
);
|
|
2175
2206
|
}
|
|
2176
|
-
function
|
|
2177
|
-
|
|
2178
|
-
const r =
|
|
2207
|
+
function Vi(t, e, i) {
|
|
2208
|
+
Qt(t, e, i);
|
|
2209
|
+
const r = Kt(e, t.indexUrl);
|
|
2179
2210
|
return e.chunks.map(
|
|
2180
2211
|
(n, s) => ({
|
|
2181
2212
|
id: t.id,
|
|
@@ -2192,78 +2223,80 @@ function Ii(t, e, i) {
|
|
|
2192
2223
|
})
|
|
2193
2224
|
);
|
|
2194
2225
|
}
|
|
2195
|
-
function
|
|
2196
|
-
return new URL(t.indexUrl,
|
|
2226
|
+
function Oi(t, e) {
|
|
2227
|
+
return new URL(t.indexUrl, be(e)).href;
|
|
2197
2228
|
}
|
|
2198
2229
|
export {
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2230
|
+
bi as $,
|
|
2231
|
+
Li as A,
|
|
2232
|
+
ki as B,
|
|
2233
|
+
me as C,
|
|
2234
|
+
mi as D,
|
|
2235
|
+
Di as E,
|
|
2236
|
+
ui as F,
|
|
2237
|
+
Ri as G,
|
|
2238
|
+
Ii as H,
|
|
2239
|
+
Ui as I,
|
|
2240
|
+
Pi as J,
|
|
2241
|
+
Oi as K,
|
|
2242
|
+
Ci as L,
|
|
2243
|
+
Vi as M,
|
|
2244
|
+
Kt as N,
|
|
2245
|
+
Ai as O,
|
|
2246
|
+
le as P,
|
|
2247
|
+
Ti as Q,
|
|
2248
|
+
wi as R,
|
|
2249
|
+
_i as S,
|
|
2250
|
+
Ei as T,
|
|
2251
|
+
Fi as U,
|
|
2252
|
+
$t as V,
|
|
2253
|
+
At as W,
|
|
2254
|
+
Xt as X,
|
|
2255
|
+
Ee as Y,
|
|
2256
|
+
_t as Z,
|
|
2257
|
+
Ut as _,
|
|
2258
|
+
oi as a,
|
|
2259
|
+
yi as a0,
|
|
2260
|
+
gi as a1,
|
|
2261
|
+
qe as a2,
|
|
2262
|
+
Qt as a3,
|
|
2263
|
+
ge as a4,
|
|
2264
|
+
ae as a5,
|
|
2265
|
+
st as a6,
|
|
2266
|
+
Pt as a7,
|
|
2236
2267
|
Mt as a8,
|
|
2237
2268
|
Mi as a9,
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2269
|
+
Dt as aa,
|
|
2270
|
+
Gi as ab,
|
|
2271
|
+
xt as ac,
|
|
2272
|
+
Te as ad,
|
|
2273
|
+
v as ae,
|
|
2274
|
+
Z as af,
|
|
2275
|
+
jt as ag,
|
|
2276
|
+
Bt as ah,
|
|
2277
|
+
ci as b,
|
|
2278
|
+
ei as c,
|
|
2279
|
+
ri as d,
|
|
2280
|
+
ni as e,
|
|
2281
|
+
ai as f,
|
|
2282
|
+
li as g,
|
|
2283
|
+
ti as h,
|
|
2284
|
+
si as i,
|
|
2285
|
+
xi as j,
|
|
2286
|
+
ii as k,
|
|
2254
2287
|
di as l,
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2288
|
+
hi as m,
|
|
2289
|
+
Si as n,
|
|
2290
|
+
pi as o,
|
|
2291
|
+
pt as p,
|
|
2292
|
+
yt as q,
|
|
2293
|
+
Je as r,
|
|
2294
|
+
fi as s,
|
|
2295
|
+
Ke as t,
|
|
2296
|
+
Et as u,
|
|
2297
|
+
vi as v,
|
|
2298
|
+
Jt as w,
|
|
2299
|
+
he as x,
|
|
2300
|
+
Ni as y,
|
|
2301
|
+
M as z
|
|
2269
2302
|
};
|