@fxi/zartigl 0.11.2 → 0.12.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.
@@ -1,5 +1,5 @@
1
1
  import "./backdrop-Dceb4d8E.js";
2
- const Te = { label: "Thermal", tags: ["sequential", "temperature"], colors: ["#042333", "#2c3395", "#744796", "#b15f82", "#eb7958", "#fbb43d", "#e8fa5b"] }, be = { label: "Haline", tags: ["sequential", "salinity"], colors: ["#2a186c", "#17568b", "#1a7e8f", "#22a785", "#55c666", "#aadc32", "#fde333"] }, we = { label: "Solar", tags: ["sequential", "irradiance"], colors: ["#330f0b", "#6b2313", "#a83c12", "#d6621a", "#f3951e", "#f7c741", "#f9f871"] }, ye = { label: "Ice", tags: ["sequential"], colors: ["#040d1a", "#123365", "#1c5f9e", "#2b8ece", "#62bde3", "#aaddf2", "#f2faff"] }, _e = { label: "Deep", tags: ["sequential", "depth"], colors: ["#fdfecc", "#c8e59b", "#74c8a3", "#3194b0", "#2a5b8e", "#281a5e", "#0c0820"] }, Re = { label: "RdYlBu", tags: ["diverging"], colors: ["#3288bd", "#66c2a5", "#abdda4", "#e6f598", "#fee08b", "#fdae61", "#f46d43", "#d53e4f"] }, xe = { label: "Dense", tags: ["sequential"], colors: ["#e6f1f1", "#92c4ca", "#44929a", "#20627a", "#1a3c6a", "#211a50", "#0d0621"] }, ve = { label: "Algae", tags: ["sequential", "biology", "log"], colors: ["#d7f9d0", "#a2d595", "#64b463", "#129450", "#126e45", "#1a482f", "#122414"] }, ke = { label: "Oxygen", tags: ["sequential", "biology", "hypoxia"], colors: ["#09060f", "#5b1028", "#d43d2f", "#f39b3d", "#f3e7b3", "#79cbd1", "#176b9c"] }, Ae = { label: "Matter", tags: ["sequential", "biology"], colors: ["#fdfecc", "#f2c98a", "#e07c4e", "#bc3754", "#8d1a6d", "#51156b", "#1c0c3f"] }, Fe = { label: "Viridis", tags: ["sequential", "perceptual"], colors: ["#440154", "#443983", "#31688e", "#21918c", "#35b779", "#90d743", "#fde725"] }, Se = { label: "Plasma", tags: ["sequential", "perceptual"], colors: ["#0d0887", "#5e01a6", "#9c179e", "#cc4778", "#ed7953", "#fdb42f", "#f0f921"] }, Ue = { label: "Cyclic", tags: ["cyclic", "direction"], colors: ["#2e22ea", "#b541fb", "#fc93c0", "#f1ee35", "#77c80d", "#458776", "#2c24e9"] }, Me = { label: "Tempo", tags: ["sequential"], colors: ["#fff6f4", "#c2d1b9", "#7db390", "#2a937f", "#156d73", "#1c455b", "#151d44"] }, Pe = { label: "Turbid", tags: ["sequential", "biology", "log"], colors: ["#e9f5a0", "#c8c86e", "#a09845", "#786031", "#533324", "#341423", "#150d17"] }, De = { label: "Speed", tags: ["sequential", "velocity"], colors: ["#fcfea4", "#d5e429", "#94c63e", "#52a657", "#2d8169", "#1d5b6d", "#0d3361"] }, Ge = { label: "Amp", tags: ["sequential"], colors: ["#f2f2f2", "#c0b8db", "#9180b6", "#6c4e9e", "#4e2e83", "#32185d", "#110a35"] }, Ne = { label: "Heat", tags: ["sequential"], colors: ["#fde725", "#fde725", "#f8961e", "#e63946", "#9d0208", "#3a0007"] }, Ie = { label: "Balance", tags: ["diverging"], colors: ["#181c43", "#3066af", "#9bbcdd", "#f2f2f2", "#e07d53", "#b13626", "#2c0b0e"] }, Le = { label: "Delta", tags: ["diverging"], colors: ["#0e3f31", "#20877b", "#99d4c1", "#f2f2f2", "#a1b0d4", "#3c5b9e", "#0d1938"] }, Ce = { label: "Curl", tags: ["diverging"], colors: ["#152237", "#2471b3", "#8dbac4", "#f2f2f2", "#c79f84", "#a63827", "#270b17"] }, Ve = { label: "Gray", tags: ["sequential"], colors: ["#000000", "#252525", "#4d4d4d", "#7a7a7a", "#a8a8a8", "#d4d4d4", "#ffffff"] }, he = {
2
+ const Te = { label: "Thermal", tags: ["sequential", "temperature"], colors: ["#042333", "#2c3395", "#744796", "#b15f82", "#eb7958", "#fbb43d", "#e8fa5b"] }, be = { label: "Haline", tags: ["sequential", "salinity"], colors: ["#2a186c", "#17568b", "#1a7e8f", "#22a785", "#55c666", "#aadc32", "#fde333"] }, we = { label: "Solar", tags: ["sequential", "irradiance"], colors: ["#330f0b", "#6b2313", "#a83c12", "#d6621a", "#f3951e", "#f7c741", "#f9f871"] }, ye = { label: "Ice", tags: ["sequential"], colors: ["#040d1a", "#123365", "#1c5f9e", "#2b8ece", "#62bde3", "#aaddf2", "#f2faff"] }, _e = { label: "Deep", tags: ["sequential", "depth"], colors: ["#fdfecc", "#c8e59b", "#74c8a3", "#3194b0", "#2a5b8e", "#281a5e", "#0c0820"] }, Re = { label: "RdYlBu", tags: ["diverging"], colors: ["#3288bd", "#66c2a5", "#abdda4", "#e6f598", "#fee08b", "#fdae61", "#f46d43", "#d53e4f"] }, xe = { label: "Dense", tags: ["sequential"], colors: ["#e6f1f1", "#92c4ca", "#44929a", "#20627a", "#1a3c6a", "#211a50", "#0d0621"] }, ve = { label: "Algae", tags: ["sequential", "biology", "log"], colors: ["#d7f9d0", "#a2d595", "#64b463", "#129450", "#126e45", "#1a482f", "#122414"] }, ke = { label: "Oxygen", tags: ["sequential", "biology", "hypoxia"], colors: ["#09060f", "#5b1028", "#d43d2f", "#f39b3d", "#f3e7b3", "#79cbd1", "#176b9c"] }, Ae = { label: "Matter", tags: ["sequential", "biology"], colors: ["#fdfecc", "#f2c98a", "#e07c4e", "#bc3754", "#8d1a6d", "#51156b", "#1c0c3f"] }, Fe = { label: "Viridis", tags: ["sequential", "perceptual"], colors: ["#440154", "#443983", "#31688e", "#21918c", "#35b779", "#90d743", "#fde725"] }, Se = { label: "Plasma", tags: ["sequential", "perceptual"], colors: ["#0d0887", "#5e01a6", "#9c179e", "#cc4778", "#ed7953", "#fdb42f", "#f0f921"] }, Ue = { label: "Cyclic", tags: ["cyclic", "direction"], colors: ["#2e22ea", "#b541fb", "#fc93c0", "#f1ee35", "#77c80d", "#458776", "#2c24e9"] }, Me = { label: "Tempo", tags: ["sequential"], colors: ["#fff6f4", "#c2d1b9", "#7db390", "#2a937f", "#156d73", "#1c455b", "#151d44"] }, De = { label: "Turbid", tags: ["sequential", "biology", "log"], colors: ["#e9f5a0", "#c8c86e", "#a09845", "#786031", "#533324", "#341423", "#150d17"] }, Pe = { label: "Speed", tags: ["sequential", "velocity"], colors: ["#fcfea4", "#d5e429", "#94c63e", "#52a657", "#2d8169", "#1d5b6d", "#0d3361"] }, Ne = { label: "Amp", tags: ["sequential"], colors: ["#f2f2f2", "#c0b8db", "#9180b6", "#6c4e9e", "#4e2e83", "#32185d", "#110a35"] }, Ge = { label: "Heat", tags: ["sequential"], colors: ["#fde725", "#fde725", "#f8961e", "#e63946", "#9d0208", "#3a0007"] }, Ie = { label: "Balance", tags: ["diverging"], colors: ["#181c43", "#3066af", "#9bbcdd", "#f2f2f2", "#e07d53", "#b13626", "#2c0b0e"] }, Le = { label: "Delta", tags: ["diverging"], colors: ["#0e3f31", "#20877b", "#99d4c1", "#f2f2f2", "#a1b0d4", "#3c5b9e", "#0d1938"] }, Ce = { label: "Curl", tags: ["diverging"], colors: ["#152237", "#2471b3", "#8dbac4", "#f2f2f2", "#c79f84", "#a63827", "#270b17"] }, Ve = { label: "Gray", tags: ["sequential"], colors: ["#000000", "#252525", "#4d4d4d", "#7a7a7a", "#a8a8a8", "#d4d4d4", "#ffffff"] }, he = {
3
3
  thermal: Te,
4
4
  "thermal-alt": { label: "Thermal Alt", tags: ["sequential", "temperature"], colors: ["#176b9c", "#79cbd1", "#f3e7b3", "#f39b3d", "#d43d2f", "#5b1028", "#09060f"] },
5
5
  haline: be,
@@ -15,10 +15,10 @@ const Te = { label: "Thermal", tags: ["sequential", "temperature"], colors: ["#0
15
15
  plasma: Se,
16
16
  cyclic: Ue,
17
17
  tempo: Me,
18
- turbid: Pe,
19
- speed: De,
20
- amp: Ge,
21
- heat: Ne,
18
+ turbid: De,
19
+ speed: Pe,
20
+ amp: Ne,
21
+ heat: Ge,
22
22
  "heat-alert": { label: "Heat Alert", tags: ["sequential", "alpha", "deprecated"], colors: ["#fde72500", "#fde725cc", "#f8961e", "#e63946", "#9d0208", "#3a0007"] },
23
23
  balance: Ie,
24
24
  delta: Le,
@@ -27,7 +27,7 @@ const Te = { label: "Thermal", tags: ["sequential", "temperature"], colors: ["#0
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
29
  gray: Ve
30
- }, ie = 64, Oe = {
30
+ }, re = 64, Oe = {
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),
@@ -50,19 +50,19 @@ function Xe(t) {
50
50
  e.length === 8 ? i(6) : 255
51
51
  ];
52
52
  }
53
- function qe([t, e, i, r]) {
53
+ function $e([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 $e(t, e) {
58
+ function qe(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++) {
62
62
  const [r, n] = t[i];
63
63
  if (e <= r) {
64
64
  const [s, o] = t[i - 1], a = r === s ? 1 : (e - s) / (r - s);
65
- return o.map((d, c) => d + (n[c] - d) * a);
65
+ return o.map((c, d) => c + (n[d] - c) * a);
66
66
  }
67
67
  }
68
68
  return t[t.length - 1][1];
@@ -71,14 +71,14 @@ function We(t, e) {
71
71
  const i = Object.entries(t).map(
72
72
  ([n, s]) => [Number(n), Xe(s)]
73
73
  ).sort((n, s) => n[0] - s[0]), r = {};
74
- for (let n = 0; n <= ie; n++) {
75
- const s = n / ie, [o, a, d, c] = $e(i, s);
76
- r[s] = qe([o, a, d, c * Be(s, e)]);
74
+ for (let n = 0; n <= re; n++) {
75
+ const s = n / re, [o, a, c, d] = qe(i, s);
76
+ r[s] = $e([o, a, c, d * Be(s, e)]);
77
77
  }
78
78
  return r;
79
79
  }
80
80
  const He = (t) => !!t && ((t.low ?? 0) > 0 || (t.high ?? 0) > 0);
81
- function re(t) {
81
+ function ne(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;
@@ -99,22 +99,22 @@ function Ye(t, e) {
99
99
  ).join(", ")}`
100
100
  );
101
101
  const n = e ? [...r.colors].reverse() : r.colors;
102
- return re(n);
102
+ return ne(n);
103
103
  }
104
104
  if (Array.isArray(t)) {
105
105
  const r = e ? [...t].reverse() : t;
106
- return re(r);
106
+ return ne(r);
107
107
  }
108
108
  return e ? Object.fromEntries(
109
109
  Object.entries(t).map(([r, n]) => [1 - Number(r), n])
110
110
  ) : t;
111
111
  }
112
- function jt(t = {}) {
112
+ function Kt(t = {}) {
113
113
  return Object.entries(he).map(([i, r]) => ({ id: i, ...r })).filter(
114
114
  (i) => t.includeDeprecated || !i.tags.includes("deprecated")
115
115
  );
116
116
  }
117
- function ne(t, e, i) {
117
+ function se(t, e, i) {
118
118
  const r = t.createShader(e);
119
119
  if (!r)
120
120
  throw new Error("Failed to create shader");
@@ -124,18 +124,18 @@ function ne(t, e, i) {
124
124
  }
125
125
  return r;
126
126
  }
127
- function Kt(t, e, i) {
127
+ function Qt(t, e, i) {
128
128
  const r = t.createProgram();
129
129
  if (!r)
130
130
  throw new Error("Failed to create program");
131
- const n = ne(t, t.VERTEX_SHADER, e), s = ne(t, t.FRAGMENT_SHADER, i);
131
+ const n = se(t, t.VERTEX_SHADER, e), s = se(t, t.FRAGMENT_SHADER, i);
132
132
  if (t.attachShader(r, n), t.attachShader(r, s), t.linkProgram(r), !t.getProgramParameter(r, t.LINK_STATUS)) {
133
133
  const o = t.getProgramInfoLog(r);
134
134
  throw t.deleteProgram(r), new Error(`Program link error: ${o}`);
135
135
  }
136
136
  return t.deleteShader(n), t.deleteShader(s), r;
137
137
  }
138
- function Qt(t, e, i, r, n) {
138
+ function Zt(t, e, i, r, n) {
139
139
  const s = t.createTexture();
140
140
  if (!s)
141
141
  throw new Error("Failed to create texture");
@@ -190,12 +190,12 @@ function Ke(t) {
190
190
  type: t.UNSIGNED_BYTE
191
191
  };
192
192
  }
193
- function Zt(t) {
193
+ function Jt(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 Jt(t) {
198
+ function ei(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 },
@@ -214,7 +214,7 @@ function Jt(t) {
214
214
  return i;
215
215
  return Ke(t);
216
216
  }
217
- function ei(t, e, i, r, n, s, o) {
217
+ function ti(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 ei(t, e, i, r, n, s, o) {
230
230
  i
231
231
  ), t.bindTexture(t.TEXTURE_2D, null), a;
232
232
  }
233
- function ti(t, e, i) {
233
+ function ii(t, e, i) {
234
234
  t.activeTexture(t.TEXTURE0 + i), t.bindTexture(t.TEXTURE_2D, e);
235
235
  }
236
- function ii(t, e) {
236
+ function ri(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 ii(t, e) {
245
245
  0
246
246
  ), t.bindFramebuffer(t.FRAMEBUFFER, null), i;
247
247
  }
248
- function ri(t) {
248
+ function ni(t) {
249
249
  const e = t.createBuffer();
250
250
  if (!e)
251
251
  throw new Error("Failed to create buffer");
@@ -265,19 +265,19 @@ const Qe = {
265
265
  0.6: "#f46d43",
266
266
  1: "#d53e4f"
267
267
  };
268
- function ni(t, e, i) {
268
+ function si(t, e, i) {
269
269
  const r = ze(e ?? Qe, 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
- for (const [d, c] of Object.entries(r))
273
- o.addColorStop(Number(d), c);
272
+ for (const [c, d] of Object.entries(r))
273
+ o.addColorStop(Number(c), d);
274
274
  s.fillStyle = o, s.fillRect(0, 0, 256, 1);
275
275
  const a = t.createTexture();
276
276
  if (!a)
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 si(t) {
280
+ function ai(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 si(t) {
287
287
  version: String(t.getParameter(t.VERSION) ?? "")
288
288
  };
289
289
  }
290
- function ai(t) {
290
+ function oi(t) {
291
291
  return {
292
292
  program: t.getParameter(t.CURRENT_PROGRAM),
293
293
  activeTexture: t.getParameter(t.ACTIVE_TEXTURE),
@@ -304,7 +304,7 @@ function ai(t) {
304
304
  ]
305
305
  };
306
306
  }
307
- function oi(t, e) {
307
+ function ci(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
310
  const Ze = {
@@ -347,10 +347,10 @@ const Ze = {
347
347
  pascal: "Pa",
348
348
  kelvin: "K"
349
349
  }, et = "⁰¹²³⁴⁵⁶⁷⁸⁹";
350
- function se(t) {
350
+ function ae(t) {
351
351
  return t === 1 ? "" : [...String(t)].map((e) => et[Number(e)]).join("");
352
352
  }
353
- function ci(t) {
353
+ function di(t) {
354
354
  const e = t?.trim() ?? "", i = Ze[e.toLowerCase()];
355
355
  if (i != null)
356
356
  return i;
@@ -361,21 +361,21 @@ function ci(t) {
361
361
  const o = /^([A-Za-z]+)\^?(-?\d+)?$/.exec(s);
362
362
  if (!o)
363
363
  return e.replace(/_/g, " ");
364
- const a = Je[o[1]] ?? o[1], d = Number(o[2] ?? 1);
365
- d < 0 ? n.push(a + se(-d)) : r.push(a + se(d));
364
+ const a = Je[o[1]] ?? o[1], c = Number(o[2] ?? 1);
365
+ c < 0 ? n.push(a + ae(-c)) : r.push(a + ae(c));
366
366
  }
367
367
  return [r.join(" ") || "1", ...n].join("/");
368
368
  }
369
- const ae = 20, tt = 600;
369
+ const oe = 20, tt = 600;
370
370
  function it(t) {
371
371
  const e = Math.max(0, Math.min(1, t));
372
- return ae * Math.pow(tt / ae, e);
372
+ return oe * Math.pow(tt / oe, e);
373
373
  }
374
- function di(t) {
374
+ function li(t) {
375
375
  return Math.exp(-1 / it(t));
376
376
  }
377
377
  const rt = 0.8, nt = 120, st = 300;
378
- class li {
378
+ class hi {
379
379
  constructor(e) {
380
380
  this.base = e, this.moving = !1, this.start = 0, this.duration = 0, this.from = e, this.to = e;
381
381
  }
@@ -476,8 +476,8 @@ vec4 addGlow(vec4 trail, sampler2D glowTex, vec2 uv, float gain) {
476
476
  vec3 rgb = (trail.rgb * trail.a + glow.rgb * under) / max(alpha, 1e-4);
477
477
  return vec4(rgb, alpha);
478
478
  }`;
479
- const hi = lt, ui = ot, fi = dt, mi = ct, pi = at, Ei = ht, gi = 4, Ti = 1.2;
480
- function bi(t) {
479
+ const ui = lt, fi = ot, mi = dt, pi = ct, Ei = at, gi = ht, Ti = 4, bi = 1.2;
480
+ function wi(t) {
481
481
  if (t == null)
482
482
  return null;
483
483
  if (!Number.isFinite(t[0]) || !Number.isFinite(t[1]) || t[0] >= t[1])
@@ -499,12 +499,12 @@ function B(t, e) {
499
499
  throw new Error(`Invalid GeoVideo manifest ${e}`);
500
500
  return i;
501
501
  }
502
- function Y(t) {
502
+ function j(t) {
503
503
  return typeof t == "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(
504
504
  t
505
505
  );
506
506
  }
507
- function oe(t) {
507
+ function ce(t) {
508
508
  if (!t || typeof t != "object")
509
509
  throw new Error("Invalid GeoVideo manifest");
510
510
  const e = t;
@@ -530,8 +530,8 @@ function oe(t) {
530
530
  const a = e.encoding;
531
531
  if (!a || a.bits !== 8 || a.colorSpace !== "bt709" || a.colorRange !== "limited" && a.colorRange !== "full")
532
532
  throw new Error("Invalid GeoVideo encoding");
533
- const d = x(a.codeMin, "encoding.codeMin"), c = x(a.codeMax, "encoding.codeMax");
534
- if (d < 0 || c > 255 || d >= c)
533
+ const c = x(a.codeMin, "encoding.codeMin"), d = x(a.codeMax, "encoding.codeMax");
534
+ if (c < 0 || d > 255 || c >= d)
535
535
  throw new Error("Invalid GeoVideo code range");
536
536
  let l = o.height;
537
537
  if (a.kind === "scalar-luma") {
@@ -569,19 +569,19 @@ function oe(t) {
569
569
  const p = e.style?.colorDomain;
570
570
  if (!Array.isArray(p) || p.length !== 2 || !p.every(Number.isFinite) || p[0] >= p[1])
571
571
  throw new Error("Invalid GeoVideo color domain");
572
- if (!Y(e.id) || !e.provenance || !Y(e.provenance.catalogEntryId) || !Y(e.provenance.inputSourceId) || !Array.isArray(e.provenance.variables) || e.provenance.variables.length === 0)
572
+ if (!j(e.id) || !e.provenance || !j(e.provenance.catalogEntryId) || !j(e.provenance.inputSourceId) || !Array.isArray(e.provenance.variables) || e.provenance.variables.length === 0)
573
573
  throw new Error("Invalid GeoVideo provenance");
574
574
  return { ...e, bounds: [i, r, n, s] };
575
575
  }
576
576
  async function ut(t, e) {
577
577
  if (typeof t != "string")
578
- return oe(t);
578
+ return ce(t);
579
579
  const i = await fetch(t, { signal: e });
580
580
  if (!i.ok)
581
581
  throw new Error(
582
582
  `GeoVideo manifest request failed (${i.status}): ${t}`
583
583
  );
584
- const r = await i.json(), n = oe(r), s = typeof document < "u" ? new URL(t, document.baseURI).href : t;
584
+ const r = await i.json(), n = ce(r), s = typeof document < "u" ? new URL(t, document.baseURI).href : t;
585
585
  return {
586
586
  ...n,
587
587
  media: { ...n.media, url: new URL(n.media.url, s).href },
@@ -605,7 +605,7 @@ function M(t) {
605
605
  function ue(t) {
606
606
  return t.timeline.kind === "sample-sequence" ? t.timeline.values.length / t.media.durationSeconds : t.media.fps;
607
607
  }
608
- function wi(t, e) {
608
+ function yi(t, e) {
609
609
  return e / ue(t);
610
610
  }
611
611
  function ft(t, e) {
@@ -614,20 +614,20 @@ function ft(t, e) {
614
614
  if (t.timeline.kind === "sample-sequence") {
615
615
  const s = M(t);
616
616
  let o = 0;
617
- for (let d = 1; d < s.length; d += 1)
618
- Math.abs(s[d] - e) < Math.abs(s[o] - e) && (o = d);
617
+ for (let c = 1; c < s.length; c += 1)
618
+ Math.abs(s[c] - e) < Math.abs(s[o] - e) && (o = c);
619
619
  const a = t.media.durationSeconds / s.length;
620
620
  return o * a + Math.min(a / 2, 0.5 / t.media.fps);
621
621
  }
622
622
  const i = new Date(t.timeline.dateStart).getTime(), r = new Date(t.timeline.dateEnd).getTime();
623
623
  return Math.max(0, Math.min(1, (e - i) / (r - i))) * fe(t);
624
624
  }
625
- function yi(t, e) {
625
+ function _i(t, e) {
626
626
  if (t.timeline.kind === "snapshot-loop")
627
627
  return new Date(t.timeline.date).getTime();
628
628
  if (t.timeline.kind === "sample-sequence") {
629
- const o = M(t), a = t.media.durationSeconds / o.length, d = Math.floor((e + 0.25 / t.media.fps) / a);
630
- return o[Math.max(0, Math.min(o.length - 1, d))];
629
+ const o = M(t), a = t.media.durationSeconds / o.length, c = Math.floor((e + 0.25 / t.media.fps) / a);
630
+ return o[Math.max(0, Math.min(o.length - 1, c))];
631
631
  }
632
632
  const i = new Date(t.timeline.dateStart).getTime(), r = new Date(t.timeline.dateEnd).getTime(), n = fe(t), s = n > 0 ? Math.max(0, Math.min(1, e / n)) : 0;
633
633
  return i + (r - i) * s;
@@ -674,7 +674,7 @@ class pt {
674
674
  return this.gl = r, this.texture = r.createTexture(), this.framebuffer = r.createFramebuffer(), r;
675
675
  }
676
676
  }
677
- function ce(t) {
677
+ function de(t) {
678
678
  const e = Math.max(4, Math.floor(t.length / 4 / 997) * 4);
679
679
  for (let i = 3; i < t.length; i += e)
680
680
  if (t[i] !== 0)
@@ -684,7 +684,7 @@ function ce(t) {
684
684
  function g() {
685
685
  return new DOMException("GeoVideo frame request was cancelled", "AbortError");
686
686
  }
687
- function G(t, e, i) {
687
+ function N(t, e, i) {
688
688
  return e ? e.aborted ? (t.catch(() => {
689
689
  }), i?.(), Promise.reject(g())) : new Promise((r, n) => {
690
690
  const s = () => {
@@ -695,7 +695,7 @@ function G(t, e, i) {
695
695
  });
696
696
  }) : t;
697
697
  }
698
- function j(t, e) {
698
+ function K(t, e) {
699
699
  return new Promise(
700
700
  (i) => t.addEventListener(e, () => i(), { once: !0 })
701
701
  );
@@ -720,11 +720,11 @@ class me {
720
720
  /** Luma codes of the presented frame, or null when it is blank. */
721
721
  readCodes(e, i) {
722
722
  const r = this.reader.read(e, this.width, i);
723
- return ce(r) ? null : mt(r, this.manifest.encoding.colorRange);
723
+ return de(r) ? null : mt(r, this.manifest.encoding.colorRange);
724
724
  }
725
725
  /** True when the decoder exposed no pixels; reads back one row only. */
726
726
  isBlank(e) {
727
- return ce(this.reader.read(e, this.width, 1));
727
+ return de(this.reader.read(e, this.width, 1));
728
728
  }
729
729
  init() {
730
730
  return this.initPromise ??= this.load().catch((e) => {
@@ -753,7 +753,7 @@ class me {
753
753
  if (n ? (this.frames.delete(e), this.frames.set(e, n)) : n = this.enqueue(e), n.settled)
754
754
  return n.promise;
755
755
  const s = n;
756
- return s.waiters++, G(s.promise, r, () => this.leave(s));
756
+ return s.waiters++, N(s.promise, r, () => this.leave(s));
757
757
  }
758
758
  enqueue(e) {
759
759
  const i = new AbortController(), r = this.queue.then(
@@ -764,7 +764,7 @@ class me {
764
764
  const n = {
765
765
  index: e,
766
766
  controller: i,
767
- promise: G(r, i.signal),
767
+ promise: N(r, i.signal),
768
768
  waiters: 0,
769
769
  settled: !1
770
770
  };
@@ -831,8 +831,8 @@ class me {
831
831
  async presentFrame(e, i) {
832
832
  if (this.presented && Math.abs(e.currentTime - i) <= 1e-3 && !e.seeking)
833
833
  return;
834
- const r = gt(e), n = j(e, "seeked");
835
- e.currentTime = i, await n, e.readyState < HTMLMediaElement.HAVE_CURRENT_DATA && await Promise.race([j(e, "loadeddata"), j(e, "canplay")]), await r, this.presented = !0;
834
+ const r = gt(e), n = K(e, "seeked");
835
+ e.currentTime = i, await n, e.readyState < HTMLMediaElement.HAVE_CURRENT_DATA && await Promise.race([K(e, "loadeddata"), K(e, "canplay")]), await r, this.presented = !0;
836
836
  }
837
837
  /**
838
838
  * Some mobile browsers expose no decoded pixels to WebGL until playback
@@ -910,7 +910,7 @@ function v(t, e) {
910
910
  }
911
911
  return { index: r, fraction: (e - t[r]) / (t[n] - t[r]) };
912
912
  }
913
- function K(t, e) {
913
+ function Q(t, e) {
914
914
  const { index: i, fraction: r } = v(t, e);
915
915
  return i + r;
916
916
  }
@@ -918,7 +918,7 @@ function wt(t, e) {
918
918
  const i = Math.max(0, Math.min(t.length - 1, Math.floor(e))), r = Math.min(i + 1, t.length - 1);
919
919
  return t[i] + (t[r] - t[i]) * Math.max(0, e - i);
920
920
  }
921
- function $(t, e, i) {
921
+ function q(t, e, i) {
922
922
  const r = [];
923
923
  let n = e;
924
924
  for (; n + 8 <= i; ) {
@@ -937,7 +937,7 @@ function $(t, e, i) {
937
937
  return r;
938
938
  }
939
939
  function b(t, e, i) {
940
- const r = $(t, e.start, e.end).find(
940
+ const r = q(t, e.start, e.end).find(
941
941
  (n) => n.type === i
942
942
  );
943
943
  if (!r)
@@ -945,21 +945,21 @@ function b(t, e, i) {
945
945
  return r;
946
946
  }
947
947
  function V(t, e, i) {
948
- return $(t, e.start, e.end).find((r) => r.type === i) ?? null;
948
+ return q(t, e.start, e.end).find((r) => r.type === i) ?? null;
949
949
  }
950
- function D(t, e) {
950
+ function P(t, e) {
951
951
  return { at: e.start + 8, count: t.getUint32(e.start + 4) };
952
952
  }
953
953
  function yt(t, e, i) {
954
954
  const r = V(t, e, "edts"), n = r && V(t, r, "elst");
955
955
  if (!n)
956
956
  return;
957
- const { at: s, count: o } = D(t, n), a = t.getUint8(n.start) === 1 ? Number(t.getBigInt64(s + 8)) : t.getInt32(s + 4);
957
+ const { at: s, count: o } = P(t, n), a = t.getUint8(n.start) === 1 ? Number(t.getBigInt64(s + 8)) : t.getInt32(s + 4);
958
958
  if (o !== 1 || a !== i)
959
959
  throw new Error("Unsupported MP4 edit list");
960
960
  }
961
961
  function _t(t) {
962
- const e = new DataView(t), i = { type: "file", start: 0, end: t.byteLength }, r = b(e, i, "moov"), n = $(e, r.start, r.end).find((f) => {
962
+ const e = new DataView(t), i = { type: "file", start: 0, end: t.byteLength }, r = b(e, i, "moov"), n = q(e, r.start, r.end).find((f) => {
963
963
  if (f.type !== "trak")
964
964
  return !1;
965
965
  const u = b(e, b(e, f, "mdia"), "hdlr");
@@ -971,62 +971,62 @@ function _t(t) {
971
971
  e,
972
972
  b(e, b(e, n, "mdia"), "minf"),
973
973
  "stbl"
974
- ), o = b(e, s, "stsd"), [a] = $(e, o.start + 8, o.end);
974
+ ), o = b(e, s, "stsd"), [a] = q(e, o.start + 8, o.end);
975
975
  if (!a || a.type !== "avc1" && a.type !== "avc3")
976
976
  throw new Error(`Unsupported MP4 sample entry ${a?.type}`);
977
- const d = e.getUint16(a.start + 24), c = e.getUint16(a.start + 26), l = b(e, { ...a, start: a.start + 78 }, "avcC"), h = new Uint8Array(t.slice(l.start, l.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(
977
+ const c = e.getUint16(a.start + 24), d = e.getUint16(a.start + 26), l = b(e, { ...a, start: a.start + 78 }, "avcC"), h = new Uint8Array(t.slice(l.start, l.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
978
  { length: y },
979
979
  (f, u) => w || e.getUint32(E.start + 12 + u * 4)
980
- ), N = V(e, s, "co64"), O = N ?? b(e, s, "stco"), U = D(e, O), T = Array.from(
980
+ ), G = V(e, s, "co64"), O = G ?? b(e, s, "stco"), U = P(e, O), T = Array.from(
981
981
  { length: U.count },
982
- (f, u) => N ? Number(e.getBigUint64(U.at + u * 8)) : e.getUint32(U.at + u * 4)
983
- ), _ = D(e, b(e, s, "stsc")), F = [];
982
+ (f, u) => G ? Number(e.getBigUint64(U.at + u * 8)) : e.getUint32(U.at + u * 4)
983
+ ), _ = P(e, b(e, s, "stsc")), F = [];
984
984
  for (let f = 0; f < _.count; f++) {
985
- const u = _.at + f * 12, I = e.getUint32(u) - 1, R = e.getUint32(u + 4), z = f + 1 < _.count ? e.getUint32(u + 12) - 1 : T.length;
986
- for (let L = I; L < z; L++) {
985
+ const u = _.at + f * 12, I = e.getUint32(u) - 1, R = e.getUint32(u + 4), Y = f + 1 < _.count ? e.getUint32(u + 12) - 1 : T.length;
986
+ for (let L = I; L < Y; L++) {
987
987
  let C = T[L];
988
- for (let te = 0; te < R && F.length < y; te++)
988
+ for (let ie = 0; ie < R && F.length < y; ie++)
989
989
  F.push(C), C += A[F.length - 1];
990
990
  }
991
991
  }
992
- const S = D(e, b(e, s, "stts")), k = [];
993
- let P = 0;
992
+ const S = P(e, b(e, s, "stts")), k = [];
993
+ let D = 0;
994
994
  for (let f = 0; f < S.count; f++) {
995
995
  const u = e.getUint32(S.at + f * 8), I = e.getUint32(S.at + f * 8 + 4);
996
996
  for (let R = 0; R < u; R++)
997
- k.push(P), P += I;
997
+ k.push(D), D += I;
998
998
  }
999
- const W = V(e, s, "ctts");
1000
- if (W) {
1001
- const f = e.getUint8(W.start) === 1, u = D(e, W);
999
+ const H = V(e, s, "ctts");
1000
+ if (H) {
1001
+ const f = e.getUint8(H.start) === 1, u = P(e, H);
1002
1002
  let I = 0;
1003
1003
  for (let R = 0; R < u.count; R++) {
1004
- const z = e.getUint32(u.at + R * 8), L = f ? e.getInt32(u.at + R * 8 + 4) : e.getUint32(u.at + R * 8 + 4);
1005
- for (let C = 0; C < z; C++)
1004
+ const Y = e.getUint32(u.at + R * 8), L = f ? e.getInt32(u.at + R * 8 + 4) : e.getUint32(u.at + R * 8 + 4);
1005
+ for (let C = 0; C < Y; C++)
1006
1006
  k[I++] += L;
1007
1007
  }
1008
1008
  }
1009
1009
  yt(e, n, Math.min(...k.slice(0, y)));
1010
- const ge = k.slice(0, y).map((f, u) => [f, u]).sort((f, u) => f[0] - u[0]), J = new Array(y);
1011
- ge.forEach(([, f], u) => J[f] = u);
1012
- const H = V(e, s, "stss"), ee = /* @__PURE__ */ new Set();
1013
- if (H) {
1014
- const f = D(e, H);
1010
+ const ge = k.slice(0, y).map((f, u) => [f, u]).sort((f, u) => f[0] - u[0]), ee = new Array(y);
1011
+ ge.forEach(([, f], u) => ee[f] = u);
1012
+ const z = V(e, s, "stss"), te = /* @__PURE__ */ new Set();
1013
+ if (z) {
1014
+ const f = P(e, z);
1015
1015
  for (let u = 0; u < f.count; u++)
1016
- ee.add(e.getUint32(f.at + u * 4) - 1);
1016
+ te.add(e.getUint32(f.at + u * 4) - 1);
1017
1017
  }
1018
1018
  if (F.length !== y || k.length < y)
1019
1019
  throw new Error("Inconsistent MP4 sample tables");
1020
1020
  return {
1021
1021
  codec: m,
1022
1022
  description: h,
1023
- width: d,
1024
- height: c,
1023
+ width: c,
1024
+ height: d,
1025
1025
  samples: A.map((f, u) => ({
1026
1026
  offset: F[u],
1027
1027
  size: f,
1028
- frame: J[u],
1029
- key: H ? ee.has(u) : !0
1028
+ frame: ee[u],
1029
+ key: z ? te.has(u) : !0
1030
1030
  }))
1031
1031
  };
1032
1032
  }
@@ -1184,31 +1184,31 @@ function kt(t, e, i, r) {
1184
1184
  `GeoVideo vector frame has ${t.length} codes, expected ${2 * n}`
1185
1185
  );
1186
1186
  const s = new Float32Array(256);
1187
- for (let c = 0; c < 256; c++)
1188
- s[c] = vt(c, r);
1189
- const o = i * 255, a = new Float32Array(n), d = new Float32Array(n);
1190
- for (let c = 0; c < n; c++) {
1191
- const l = e[c] >= o;
1192
- a[c] = l ? s[t[c]] : NaN, d[c] = l ? s[t[n + c]] : NaN;
1187
+ for (let d = 0; d < 256; d++)
1188
+ s[d] = vt(d, r);
1189
+ const o = i * 255, a = new Float32Array(n), c = new Float32Array(n);
1190
+ for (let d = 0; d < n; d++) {
1191
+ const l = e[d] >= o;
1192
+ a[d] = l ? s[t[d]] : NaN, c[d] = l ? s[t[n + d]] : NaN;
1193
1193
  }
1194
- return { u: a, v: d };
1194
+ return { u: a, v: c };
1195
1195
  }
1196
1196
  class At extends me {
1197
1197
  constructor(e, i = {}) {
1198
1198
  if (e.encoding.kind !== "vector-luma")
1199
1199
  throw new Error("GeoVideoVectorSource requires a vector-luma manifest");
1200
1200
  super(e, 2, i), this.encoding = e.encoding;
1201
- const [r, n, s, o] = e.bounds, a = (s - r) / this.width, d = (o - n) / this.height;
1201
+ const [r, n, s, o] = e.bounds, a = (s - r) / this.width, c = (o - n) / this.height;
1202
1202
  this.coords = {
1203
1203
  time: this.times,
1204
1204
  vertical: new Float32Array([0]),
1205
1205
  latitude: Float32Array.from(
1206
1206
  { length: this.height },
1207
- (c, l) => o - (l + 0.5) * d
1207
+ (d, l) => o - (l + 0.5) * c
1208
1208
  ),
1209
1209
  longitude: Float32Array.from(
1210
1210
  { length: this.width },
1211
- (c, l) => r + (l + 0.5) * a
1211
+ (d, l) => r + (l + 0.5) * a
1212
1212
  )
1213
1213
  };
1214
1214
  }
@@ -1269,7 +1269,7 @@ class At extends me {
1269
1269
  }
1270
1270
  }
1271
1271
  function Ft(t, e, i = {}) {
1272
- const [r, n] = i.range ?? [-1 / 0, 1 / 0], s = [...t].sort((a, d) => a.start - d.start), o = s.find(
1272
+ const [r, n] = i.range ?? [-1 / 0, 1 / 0], s = [...t].sort((a, c) => a.start - c.start), o = s.find(
1273
1273
  (a) => a.start > e && a.start <= n
1274
1274
  ) ?? (i.loop ? s.find(
1275
1275
  (a) => a.end >= r && a.start <= n
@@ -1295,8 +1295,8 @@ function Ut(t) {
1295
1295
  function pe(t, e = {}) {
1296
1296
  return t.encoding.kind === "vector-luma" ? new At(t, e) : new xt(t, e);
1297
1297
  }
1298
- const Mt = 3, Pt = 3, Dt = 0.6, Gt = 1.5;
1299
- function Nt(t) {
1298
+ const Mt = 3, Dt = 3, Pt = 0.6, Nt = 1.5;
1299
+ function Gt(t) {
1300
1300
  const e = new AbortController();
1301
1301
  if (!t)
1302
1302
  return { controller: e, unlink: () => {
@@ -1307,14 +1307,14 @@ function Nt(t) {
1307
1307
  unlink: () => t.removeEventListener("abort", i)
1308
1308
  };
1309
1309
  }
1310
- class _i {
1310
+ class Ri {
1311
1311
  constructor(e) {
1312
1312
  this.manifests = /* @__PURE__ */ new Map(), this.open = /* @__PURE__ */ new Map(), this.id = e.id, this.chunks = e.chunks.filter(
1313
1313
  (i) => Number.isFinite(i.start) && Number.isFinite(i.end) && i.end >= i.start
1314
1314
  ).sort((i, r) => i.start - r.start), this.maxOpenChunks = Math.max(2, e.maxOpenChunks ?? Mt), this.frameCacheSize = Math.max(
1315
1315
  1,
1316
- e.frameCacheSize ?? Pt
1317
- ), this.prefetchAt = e.prefetchAt ?? Dt, this.maxGap = e.maxGap, this.loadManifest = e.loadManifest ?? ut, this.createFrameSource = e.createFrameSource ?? ((i, r) => pe(
1316
+ e.frameCacheSize ?? Dt
1317
+ ), this.prefetchAt = e.prefetchAt ?? Pt, this.maxGap = e.maxGap, this.loadManifest = e.loadManifest ?? ut, this.createFrameSource = e.createFrameSource ?? ((i, r) => pe(
1318
1318
  i,
1319
1319
  r
1320
1320
  ));
@@ -1333,7 +1333,7 @@ class _i {
1333
1333
  async steps(e = {}) {
1334
1334
  if (e.signal?.aborted)
1335
1335
  throw g();
1336
- const i = await G(
1336
+ const i = await N(
1337
1337
  Promise.all(this.chunks.map((r) => this.manifest(r))),
1338
1338
  e.signal
1339
1339
  );
@@ -1350,24 +1350,24 @@ class _i {
1350
1350
  const s = this.chunkIndexAt(e);
1351
1351
  if (s < 0)
1352
1352
  return null;
1353
- const o = [], { controller: a, unlink: d } = Nt(r);
1353
+ const o = [], { controller: a, unlink: c } = Gt(r);
1354
1354
  try {
1355
- const c = this.acquire(this.chunks[s], o), l = await G(c.ready, a.signal), { times: h } = l;
1355
+ const d = this.acquire(this.chunks[s], o), l = await N(d.ready, a.signal), { times: h } = l;
1356
1356
  let p;
1357
1357
  if (e <= h[h.length - 1]) {
1358
1358
  const { index: T, fraction: _ } = v(h, e);
1359
- p = n === "discrete" || _ === 0 ? [c, T, c, T, 0] : [c, T, c, T + 1, _];
1359
+ p = n === "discrete" || _ === 0 ? [d, T, d, T, 0] : [d, T, d, T + 1, _];
1360
1360
  } else {
1361
1361
  const T = this.chunks[s + 1];
1362
1362
  if (!T)
1363
1363
  return null;
1364
- const _ = this.acquire(T, o), F = await G(_.ready, a.signal), S = h.length - 1, k = h[S], P = F.times[0];
1365
- if (P - k > this.gapLimit(h, F.times))
1364
+ const _ = this.acquire(T, o), F = await N(_.ready, a.signal), S = h.length - 1, k = h[S], D = F.times[0];
1365
+ if (D - k > this.gapLimit(h, F.times))
1366
1366
  return null;
1367
- p = n === "discrete" ? [c, S, c, S, 0] : e >= P ? [_, 0, _, 0, 0] : [c, S, _, 0, (e - k) / (P - k)];
1367
+ p = n === "discrete" ? [d, S, d, S, 0] : e >= D ? [_, 0, _, 0, 0] : [d, S, _, 0, (e - k) / (D - k)];
1368
1368
  }
1369
- const [m, E, w, y, A] = p, N = m === w && E === y, O = [this.frame(m, E, a.signal)];
1370
- N || O.push(this.frame(w, y, a.signal));
1369
+ const [m, E, w, y, A] = p, G = m === w && E === y, O = [this.frame(m, E, a.signal)];
1370
+ G || O.push(this.frame(w, y, a.signal));
1371
1371
  let U;
1372
1372
  try {
1373
1373
  U = await Promise.all(O);
@@ -1377,13 +1377,13 @@ class _i {
1377
1377
  return this.prefetchAfter(s, e), {
1378
1378
  time: e,
1379
1379
  a: U[0],
1380
- b: U[N ? 0 : 1],
1380
+ b: U[G ? 0 : 1],
1381
1381
  mix: A
1382
1382
  };
1383
1383
  } finally {
1384
- d();
1385
- for (const c of o)
1386
- c.users--;
1384
+ c();
1385
+ for (const d of o)
1386
+ d.users--;
1387
1387
  this.trim();
1388
1388
  }
1389
1389
  }
@@ -1417,7 +1417,7 @@ class _i {
1417
1417
  e.length > 1 ? e[e.length - 1] - e[e.length - 2] : 0,
1418
1418
  i.length > 1 ? i[1] - i[0] : 0
1419
1419
  ], n = Math.max(...r);
1420
- return n > 0 ? n * Gt : -1 / 0;
1420
+ return n > 0 ? n * Nt : -1 / 0;
1421
1421
  }
1422
1422
  prefetchAfter(e, i) {
1423
1423
  const r = this.chunks[e], n = this.chunks[e + 1], s = r.end - r.start, o = s > 0 ? (i - r.start) / s : 1;
@@ -1466,19 +1466,19 @@ class _i {
1466
1466
  return this.open.set(e.key, i), i;
1467
1467
  }
1468
1468
  async frame(e, i, r) {
1469
- const { manifest: n, times: s, grid: o, source: a } = await G(
1469
+ const { manifest: n, times: s, grid: o, source: a } = await N(
1470
1470
  e.ready,
1471
1471
  r
1472
1472
  );
1473
1473
  if (e.released)
1474
1474
  throw g();
1475
- const d = await a.frame(i, { signal: r });
1475
+ const c = await a.frame(i, { signal: r });
1476
1476
  return {
1477
1477
  key: `${this.id}/${e.chunk.key}/${i}`,
1478
1478
  chunk: e.chunk,
1479
1479
  step: i,
1480
1480
  time: s[i],
1481
- data: d,
1481
+ data: c,
1482
1482
  grid: o,
1483
1483
  manifest: n
1484
1484
  };
@@ -1574,12 +1574,12 @@ class Vt {
1574
1574
  */
1575
1575
  sample(e, i = !0) {
1576
1576
  const { index: r, fraction: n } = v(this.times, e), s = Math.min(r + 1, this.times.length - 1);
1577
- [...this.pending.keys()].some((c) => c < r || c > s + 1) && (this.source.cancelAll(), this.pending.clear());
1578
- for (const c of [r, s, s + 1])
1579
- c < this.times.length && this.request(c).catch(() => {
1577
+ [...this.pending.keys()].some((d) => d < r || d > s + 1) && (this.source.cancelAll(), this.pending.clear());
1578
+ for (const d of [r, s, s + 1])
1579
+ d < this.times.length && this.request(d).catch(() => {
1580
1580
  });
1581
- const o = this.textures.get(r), a = this.textures.get(s), d = i ? n : 0;
1582
- return o && (d === 0 || a) && (this.pair = [o, d === 0 ? o : a, d]), this.evict(r), this.pair;
1581
+ const o = this.textures.get(r), a = this.textures.get(s), c = i ? n : 0;
1582
+ return o && (c === 0 || a) && (this.pair = [o, c === 0 ? o : a, c]), this.evict(r), this.pair;
1583
1583
  }
1584
1584
  /** Switch spatial filtering without changing the decoded-step cache. */
1585
1585
  setFilter(e) {
@@ -1754,23 +1754,23 @@ class Ot {
1754
1754
  advance(e, i, r, n = [i[0], i[i.length - 1]], s = !1, o = !1) {
1755
1755
  if (!this.advancing || !i.length)
1756
1756
  return !1;
1757
- const a = K(i, n[0]), d = K(i, n[1]), c = d + (o ? 1 : 0);
1758
- let l = Math.max(a, K(i, this.ms) + this.endFraction) + Math.max(0, e) * r;
1759
- const h = o ? l >= c : l > c;
1760
- return h && s && c > a ? l = a + (l - a) % (c - a) : l = Math.min(c, l), this.time = wt(i, Math.min(d, l)), this.endFraction = Math.max(0, l - d), h && !s;
1757
+ const a = Q(i, n[0]), c = Q(i, n[1]), d = c + (o ? 1 : 0);
1758
+ let l = Math.max(a, Q(i, this.ms) + this.endFraction) + Math.max(0, e) * r;
1759
+ const h = o ? l >= d : l > d;
1760
+ return h && s && d > a ? l = a + (l - a) % (d - a) : l = Math.min(d, l), this.time = wt(i, Math.min(c, l)), this.endFraction = Math.max(0, l - c), h && !s;
1761
1761
  }
1762
1762
  }
1763
1763
  function X(t) {
1764
1764
  const e = M(t);
1765
1765
  return [e[0], e[e.length - 1]];
1766
1766
  }
1767
- function Q(t, e) {
1767
+ function Z(t, e) {
1768
1768
  return e ? [Math.max(t[0], e[0]), Math.min(t[1], e[1])] : t;
1769
1769
  }
1770
- function q([t, e], i) {
1770
+ function $([t, e], i) {
1771
1771
  return Math.max(t, Math.min(e, i));
1772
1772
  }
1773
- class Ri {
1773
+ class xi {
1774
1774
  constructor(e, i, r) {
1775
1775
  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
1776
  const n = typeof e.time == "string" ? Date.parse(e.time) : e.time;
@@ -1780,7 +1780,7 @@ class Ri {
1780
1780
  );
1781
1781
  }
1782
1782
  async load(e, i) {
1783
- if (this.gl = e, this.manifest = i, this.timeRange = Q(
1783
+ if (this.gl = e, this.manifest = i, this.timeRange = Z(
1784
1784
  X(i),
1785
1785
  this.requestedTimeRange
1786
1786
  ), this.timeRange[0] > this.timeRange[1])
@@ -1844,7 +1844,7 @@ class Ri {
1844
1844
  this.playbackRange(this.field),
1845
1845
  this.loop,
1846
1846
  !0
1847
- ), { index: n } = v(this.field.times, this.clock.ms), s = this.field.manifest.timeline.kind === "snapshot-loop" ? this.field.times[0] : q(this.timeRange, this.field.times[n]);
1847
+ ), { index: n } = v(this.field.times, this.clock.ms), s = this.field.manifest.timeline.kind === "snapshot-loop" ? this.field.times[0] : $(this.timeRange, this.field.times[n]);
1848
1848
  s !== this.lastStepTime && (this.lastStepTime = s, this.emit("timeChange", s)), r ? this.reachEnd() : this.repaint();
1849
1849
  }
1850
1850
  setTime(e) {
@@ -1858,13 +1858,13 @@ class Ri {
1858
1858
  /** Load the requested step first; stale seeks and swaps cannot replace it. */
1859
1859
  async prepare(e, i) {
1860
1860
  this.failed = !1;
1861
- const r = ++this.seekId, n = this.timeRange ?? X(e.manifest), s = i ?? q(n, this.requestedTime ?? n[0]), o = v(e.times, s), a = Math.min(
1861
+ const r = ++this.seekId, n = this.timeRange ?? X(e.manifest), s = i ?? $(n, this.requestedTime ?? n[0]), o = v(e.times, s), a = Math.min(
1862
1862
  e.times.length - 1,
1863
1863
  o.index + (o.fraction > 0.5 ? 1 : 0)
1864
- ), d = e.times[a];
1865
- this.seeking = !0, this.lastTick = null, e.focus(d);
1864
+ ), c = e.times[a];
1865
+ this.seeking = !0, this.lastTick = null, e.focus(c);
1866
1866
  try {
1867
- await e.prime(d);
1867
+ await e.prime(c);
1868
1868
  } catch (l) {
1869
1869
  if (r !== this.seekId)
1870
1870
  return;
@@ -1872,8 +1872,8 @@ class Ri {
1872
1872
  }
1873
1873
  if (r !== this.seekId || this.destroyed)
1874
1874
  return;
1875
- const c = this.pendingField === e;
1876
- if (c && (this.field?.destroy(), this.field = e, this.pendingField = null, this.lastStepTime = null), this.exactTime = d, this.clock.ms = q(this.playbackRange(e), d), e.sample(d, !1), this.seeking = !1, this.endEmitted = !1, this.repaint(), c) {
1875
+ const d = this.pendingField === e;
1876
+ if (d && (this.field?.destroy(), this.field = e, this.pendingField = null, this.lastStepTime = null), this.exactTime = c, this.clock.ms = $(this.playbackRange(e), c), e.sample(c, !1), this.seeking = !1, this.endEmitted = !1, this.repaint(), d) {
1877
1877
  const l = e.manifest;
1878
1878
  if (this.emit("loaded", {
1879
1879
  min: l.style.colorDomain[0],
@@ -1903,7 +1903,7 @@ class Ri {
1903
1903
  const r = this.replacementTimeRange(e, i);
1904
1904
  if (!r || !this.gl || e.media.url === this.manifest?.media.url)
1905
1905
  return !1;
1906
- const n = q(r, i.time ?? r[0]);
1906
+ const n = $(r, i.time ?? r[0]);
1907
1907
  this.standby?.field.manifest.media.url !== e.media.url && (this.discardStandby(), this.standby = { field: this.createField(e), time: n });
1908
1908
  const s = this.standby;
1909
1909
  return s.time = n, s.field.focus(n), s.field.prime(n).catch(() => {
@@ -1918,7 +1918,7 @@ class Ri {
1918
1918
  const r = this.manifest;
1919
1919
  if (!r || e.encoding.kind !== r.encoding.kind || e.media.width !== r.media.width || e.media.height !== r.media.height || e.mask.width !== r.mask.width || e.mask.height !== r.mask.height)
1920
1920
  return null;
1921
- const n = Q(
1921
+ const n = Z(
1922
1922
  X(e),
1923
1923
  i.timeRange
1924
1924
  );
@@ -1964,7 +1964,7 @@ class Ri {
1964
1964
  setTimeRange(e) {
1965
1965
  if (!Number.isFinite(e[0]) || !Number.isFinite(e[1]) || e[0] > e[1])
1966
1966
  throw new Error("Invalid GeoVideo time range");
1967
- const i = Q(
1967
+ const i = Z(
1968
1968
  this.manifest ? X(this.manifest) : e,
1969
1969
  e
1970
1970
  );
@@ -1998,7 +1998,7 @@ class Ri {
1998
1998
  i.name === "AbortError" || this.destroyed || (this.playOnReady = !1, this.awaitingNext = !1, this.failed = !0, this.seeking = !0, this.clock.setPlaying(!1), this.emit("status", { phase: "error", error: i }), this.emit("error", i));
1999
1999
  }
2000
2000
  }
2001
- function Z(t) {
2001
+ function W(t) {
2002
2002
  const { start: e, end: i } = t.temporal ?? {};
2003
2003
  return {
2004
2004
  source: t,
@@ -2006,22 +2006,33 @@ function Z(t) {
2006
2006
  end: Date.parse(i ?? e ?? "")
2007
2007
  };
2008
2008
  }
2009
- function xi(t, e, i = {}) {
2010
- const r = t.filter((s) => s.id === e.id && s.temporal?.start != null).map(Z), n = Ft(
2009
+ function vi(t, e, i = {}) {
2010
+ const r = t.filter((s) => s.id === e.id && s.temporal?.start != null).map(W), n = Ft(
2011
2011
  r,
2012
2012
  Date.parse(e.temporal?.end ?? ""),
2013
2013
  i
2014
2014
  );
2015
2015
  return n ? { source: n.chunk.source, time: n.time } : null;
2016
2016
  }
2017
- function vi(t, e) {
2018
- return St(Z(t), e.map(Z))?.source ?? null;
2017
+ function ki(t, e) {
2018
+ return St(W(t), e.map(W))?.source ?? null;
2019
+ }
2020
+ function Ai(t, e = {}) {
2021
+ const i = e.start ?? -1 / 0, r = e.end ?? 1 / 0, n = t.map(W).filter((a) => a.end >= i && a.start <= r).sort((a, c) => a.start - c.start);
2022
+ if (n.length === 0)
2023
+ return;
2024
+ if (e.time == null)
2025
+ return n[n.length - 1].source;
2026
+ const s = Math.min(r, Math.max(i, e.time)), o = (a) => s < a.start ? a.start - s : Math.max(0, s - a.end);
2027
+ return n.reduce(
2028
+ (a, c) => o(c) <= o(a) ? c : a
2029
+ ).source;
2019
2030
  }
2020
2031
  const Bt = /^P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/;
2021
2032
  function Xt(t) {
2022
2033
  return t instanceof Date ? t.getTime() : typeof t == "number" ? t : new Date(t).getTime();
2023
2034
  }
2024
- function de(t, e) {
2035
+ function le(t, e) {
2025
2036
  const i = Xt(t);
2026
2037
  if (!Number.isFinite(i))
2027
2038
  throw new Error(`Invalid ${e}`);
@@ -2034,7 +2045,7 @@ function Ee(t, e) {
2034
2045
  const r = i.slice(1).map((A) => Number(A ?? 0));
2035
2046
  if (!r.some((A) => A > 0))
2036
2047
  throw new Error("Trailing time duration must be positive");
2037
- const [n, s, o, a, d, c, l] = 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();
2048
+ const [n, s, o, a, c, d, l] = 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();
2038
2049
  return Date.UTC(
2039
2050
  m,
2040
2051
  E,
@@ -2043,17 +2054,17 @@ function Ee(t, e) {
2043
2054
  h.getUTCMinutes(),
2044
2055
  h.getUTCSeconds(),
2045
2056
  h.getUTCMilliseconds()
2046
- ) - (((o * 7 + a) * 24 + d) * 60 + c) * 6e4 - l * 1e3;
2057
+ ) - (((o * 7 + a) * 24 + c) * 60 + d) * 6e4 - l * 1e3;
2047
2058
  }
2048
- function ki(t, [e, i]) {
2059
+ function Fi(t, [e, i]) {
2049
2060
  let r = e, n = i;
2050
- if (typeof t.trailing == "string" ? r = Ee(i, t.trailing) : (t.start != null && (r = de(t.start, "time range start")), t.end != null && (n = de(t.end, "time range end"))), r > n)
2061
+ if (typeof t.trailing == "string" ? r = Ee(i, t.trailing) : (t.start != null && (r = le(t.start, "time range start")), t.end != null && (n = le(t.end, "time range end"))), r > n)
2051
2062
  throw new Error("Time range start must not follow its end");
2052
2063
  return [Math.max(e, r), Math.min(i, n)];
2053
2064
  }
2054
- const qt = (t) => typeof t == "object" && t !== null && !Array.isArray(t);
2055
- function Ai(t, e) {
2056
- if (!qt(t))
2065
+ const $t = (t) => typeof t == "object" && t !== null && !Array.isArray(t);
2066
+ function Si(t, e) {
2067
+ if (!$t(t))
2057
2068
  throw new Error(`${e} must be an object`);
2058
2069
  for (const s of Object.keys(t))
2059
2070
  if (s !== "start" && s !== "end" && s !== "trailing")
@@ -2080,55 +2091,69 @@ function Ai(t, e) {
2080
2091
  ...n !== void 0 && { end: n }
2081
2092
  };
2082
2093
  }
2083
- function Fi(t) {
2094
+ function Ui(t) {
2084
2095
  return t.type === "geovideo" && typeof t.indexUrl == "string";
2085
2096
  }
2086
- function Si(t, e) {
2097
+ function Mi(t, e) {
2087
2098
  return t.id === e.id && (t.type !== "geovideo" || e.type !== "geovideo" || t.manifestUrl === e.manifestUrl);
2088
2099
  }
2089
- function le(t) {
2100
+ function J(t) {
2090
2101
  return typeof t == "string" && Number.isFinite(Date.parse(t));
2091
2102
  }
2092
- function $t(t) {
2103
+ function qt(t) {
2104
+ const e = t.times;
2105
+ if (!Array.isArray(e) || e.length !== t.samples || e[0] !== t.start || e[e.length - 1] !== t.end)
2106
+ return !1;
2107
+ let i = -1 / 0;
2108
+ for (const r of e) {
2109
+ const n = J(r) ? Date.parse(r) : NaN;
2110
+ if (!(n > i))
2111
+ return !1;
2112
+ i = n;
2113
+ }
2114
+ return !0;
2115
+ }
2116
+ function Wt(t) {
2093
2117
  const e = t;
2094
2118
  if (!e || e.schemaVersion !== 1 || e.type !== "geovideo-index" || !Array.isArray(e.chunks))
2095
2119
  throw new Error("Unsupported GeoVideo index");
2096
2120
  for (const i of e.chunks)
2097
- if (!le(i?.start) || !le(i.end) || Date.parse(i.end) < Date.parse(i.start) || typeof i.manifestUrl != "string")
2121
+ if (!J(i?.start) || !J(i.end) || Date.parse(i.end) < Date.parse(i.start) || typeof i.manifestUrl != "string" || i.times !== void 0 && !qt(i))
2098
2122
  throw new Error("Invalid GeoVideo index chunk");
2099
2123
  return e;
2100
2124
  }
2101
- async function Ui(t, e) {
2125
+ async function Di(t, e) {
2102
2126
  const i = await fetch(t, { signal: e });
2103
2127
  if (!i.ok)
2104
2128
  throw new Error(
2105
2129
  `GeoVideo index request failed (${i.status}): ${t}`
2106
2130
  );
2107
- return $t(await i.json());
2131
+ return Wt(await i.json());
2108
2132
  }
2109
- function Wt(t) {
2133
+ function Ht(t) {
2110
2134
  return typeof document < "u" ? new URL(t, document.baseURI).href : t;
2111
2135
  }
2112
- function Ht(t, e) {
2113
- const i = Wt(e);
2136
+ function zt(t, e) {
2137
+ const i = Ht(e);
2114
2138
  return t.chunks.map((r) => ({
2115
2139
  key: r.key,
2116
2140
  manifestUrl: new URL(r.manifestUrl, i).href,
2117
2141
  start: Date.parse(r.start),
2118
2142
  end: Date.parse(r.end),
2119
2143
  samples: r.samples,
2144
+ ...r.times ? { times: r.times.map(Date.parse) } : {},
2120
2145
  ...r.provisional ? { provisional: !0 } : {}
2121
2146
  }));
2122
2147
  }
2123
- function zt(t, e, i) {
2148
+ function Yt(t, e, i) {
2124
2149
  if (e.sourceId !== t.id || e.catalogEntryId !== i.id)
2125
2150
  throw new Error(
2126
2151
  `GeoVideo index identity does not match catalog entry/source: ${t.id}`
2127
2152
  );
2128
2153
  }
2129
- function Mi(t, e, i) {
2130
- zt(t, e, i);
2131
- const r = Ht(e, t.indexUrl);
2154
+ function Pi(t, e, i) {
2155
+ Yt(t, e, i);
2156
+ const r = zt(e, t.indexUrl);
2132
2157
  return e.chunks.map(
2133
2158
  (n, s) => ({
2134
2159
  id: t.id,
@@ -2146,71 +2171,72 @@ function Mi(t, e, i) {
2146
2171
  );
2147
2172
  }
2148
2173
  export {
2149
- ne as $,
2174
+ Yt as $,
2150
2175
  ue as A,
2151
- ci as B,
2152
- Fi as C,
2153
- xi as D,
2154
- Ui as E,
2155
- Mi as F,
2156
- Ti as G,
2157
- ki as H,
2158
- yi as I,
2159
- oe as J,
2160
- ui as K,
2161
- mi as L,
2162
- Ei as M,
2163
- _i as N,
2164
- Ot as O,
2165
- xt as P,
2166
- Vt as Q,
2167
- me as R,
2168
- bt as S,
2169
- li as T,
2170
- At as U,
2171
- fi as V,
2172
- pi as W,
2173
- hi as X,
2174
- Be as Y,
2175
- zt as Z,
2176
- pe as _,
2177
- ri as a,
2178
- it as a0,
2179
- Ut as a1,
2180
- Ht as a2,
2181
- Ft as a3,
2182
- vi as a4,
2183
- St as a5,
2184
- Ai as a6,
2185
- wt as a7,
2186
- Ee as a8,
2187
- v as a9,
2188
- K as aa,
2189
- $t as ab,
2190
- Ct as ac,
2191
- ni as b,
2192
- Kt as c,
2193
- Jt as d,
2194
- ei as e,
2195
- ii as f,
2196
- si as g,
2197
- Qt as h,
2198
- ti as i,
2199
- gi as j,
2200
- Zt as k,
2201
- oi as l,
2202
- Ri as m,
2203
- di as n,
2176
+ di as B,
2177
+ Ai as C,
2178
+ Ui as D,
2179
+ vi as E,
2180
+ Fi as F,
2181
+ bi as G,
2182
+ Di as H,
2183
+ Pi as I,
2184
+ zt as J,
2185
+ _i as K,
2186
+ ce as L,
2187
+ fi as M,
2188
+ pi as N,
2189
+ gi as O,
2190
+ Ri as P,
2191
+ Ot as Q,
2192
+ xt as R,
2193
+ Vt as S,
2194
+ hi as T,
2195
+ me as U,
2196
+ bt as V,
2197
+ At as W,
2198
+ mi as X,
2199
+ Ei as Y,
2200
+ ui as Z,
2201
+ Be as _,
2202
+ ni as a,
2203
+ pe as a0,
2204
+ se as a1,
2205
+ it as a2,
2206
+ Ut as a3,
2207
+ Ft as a4,
2208
+ ki as a5,
2209
+ St as a6,
2210
+ Si as a7,
2211
+ wt as a8,
2212
+ Ee as a9,
2213
+ v as aa,
2214
+ Q as ab,
2215
+ Wt as ac,
2216
+ Ct as ad,
2217
+ si as b,
2218
+ Qt as c,
2219
+ ei as d,
2220
+ ti as e,
2221
+ ri as f,
2222
+ ai as g,
2223
+ Zt as h,
2224
+ ii as i,
2225
+ Ti as j,
2226
+ Jt as k,
2227
+ ci as l,
2228
+ xi as m,
2229
+ li as n,
2204
2230
  ut as o,
2205
2231
  Tt as p,
2206
2232
  ze as q,
2207
2233
  Ke as r,
2208
- ai as s,
2234
+ oi as s,
2209
2235
  ft as t,
2210
- jt as u,
2211
- bi as v,
2212
- de as w,
2236
+ Kt as u,
2237
+ wi as v,
2238
+ le as w,
2213
2239
  M as x,
2214
- Si as y,
2215
- wi as z
2240
+ Mi as y,
2241
+ yi as z
2216
2242
  };