@fxi/zartigl 0.9.3 → 0.10.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,39 +1,94 @@
1
- const Y = { label: "Thermal", tags: ["sequential", "temperature"], colors: ["#042333", "#2c3395", "#744796", "#b15f82", "#eb7958", "#fbb43d", "#e8fa5b"] }, j = { label: "Haline", tags: ["sequential", "salinity"], colors: ["#2a186c", "#17568b", "#1a7e8f", "#22a785", "#55c666", "#aadc32", "#fde333"] }, z = { label: "Solar", tags: ["sequential", "irradiance"], colors: ["#330f0b", "#6b2313", "#a83c12", "#d6621a", "#f3951e", "#f7c741", "#f9f871"] }, K = { label: "Ice", tags: ["sequential"], colors: ["#040d1a", "#123365", "#1c5f9e", "#2b8ece", "#62bde3", "#aaddf2", "#f2faff"] }, J = { label: "Deep", tags: ["sequential", "depth"], colors: ["#fdfecc", "#c8e59b", "#74c8a3", "#3194b0", "#2a5b8e", "#281a5e", "#0c0820"] }, Q = { label: "RdYlBu", tags: ["diverging"], colors: ["#3288bd", "#66c2a5", "#abdda4", "#e6f598", "#fee08b", "#fdae61", "#f46d43", "#d53e4f"] }, Z = { label: "Dense", tags: ["sequential"], colors: ["#e6f1f1", "#92c4ca", "#44929a", "#20627a", "#1a3c6a", "#211a50", "#0d0621"] }, ee = { label: "Algae", tags: ["sequential", "biology", "log"], colors: ["#d7f9d0", "#a2d595", "#64b463", "#129450", "#126e45", "#1a482f", "#122414"] }, te = { label: "Oxygen", tags: ["sequential", "biology", "hypoxia"], colors: ["#09060f", "#5b1028", "#d43d2f", "#f39b3d", "#f3e7b3", "#79cbd1", "#176b9c"] }, re = { label: "Matter", tags: ["sequential", "biology"], colors: ["#fdfecc", "#f2c98a", "#e07c4e", "#bc3754", "#8d1a6d", "#51156b", "#1c0c3f"] }, ne = { label: "Viridis", tags: ["sequential", "perceptual"], colors: ["#440154", "#443983", "#31688e", "#21918c", "#35b779", "#90d743", "#fde725"] }, ae = { label: "Plasma", tags: ["sequential", "perceptual"], colors: ["#0d0887", "#5e01a6", "#9c179e", "#cc4778", "#ed7953", "#fdb42f", "#f0f921"] }, ie = { label: "Cyclic", tags: ["cyclic", "direction"], colors: ["#2e22ea", "#b541fb", "#fc93c0", "#f1ee35", "#77c80d", "#458776", "#2c24e9"] }, oe = { label: "Tempo", tags: ["sequential"], colors: ["#fff6f4", "#c2d1b9", "#7db390", "#2a937f", "#156d73", "#1c455b", "#151d44"] }, se = { label: "Turbid", tags: ["sequential", "biology", "log"], colors: ["#e9f5a0", "#c8c86e", "#a09845", "#786031", "#533324", "#341423", "#150d17"] }, ce = { label: "Speed", tags: ["sequential", "velocity"], colors: ["#fcfea4", "#d5e429", "#94c63e", "#52a657", "#2d8169", "#1d5b6d", "#0d3361"] }, de = { label: "Amp", tags: ["sequential"], colors: ["#f2f2f2", "#c0b8db", "#9180b6", "#6c4e9e", "#4e2e83", "#32185d", "#110a35"] }, ue = { 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"] }, fe = { label: "Curl", tags: ["diverging"], colors: ["#152237", "#2471b3", "#8dbac4", "#f2f2f2", "#c79f84", "#a63827", "#270b17"] }, he = { label: "Gray", tags: ["sequential"], colors: ["#000000", "#252525", "#4d4d4d", "#7a7a7a", "#a8a8a8", "#d4d4d4", "#ffffff"] }, q = {
1
+ const Y = { label: "Thermal", tags: ["sequential", "temperature"], colors: ["#042333", "#2c3395", "#744796", "#b15f82", "#eb7958", "#fbb43d", "#e8fa5b"] }, z = { label: "Haline", tags: ["sequential", "salinity"], colors: ["#2a186c", "#17568b", "#1a7e8f", "#22a785", "#55c666", "#aadc32", "#fde333"] }, K = { label: "Solar", tags: ["sequential", "irradiance"], colors: ["#330f0b", "#6b2313", "#a83c12", "#d6621a", "#f3951e", "#f7c741", "#f9f871"] }, J = { label: "Ice", tags: ["sequential"], colors: ["#040d1a", "#123365", "#1c5f9e", "#2b8ece", "#62bde3", "#aaddf2", "#f2faff"] }, Q = { label: "Deep", tags: ["sequential", "depth"], colors: ["#fdfecc", "#c8e59b", "#74c8a3", "#3194b0", "#2a5b8e", "#281a5e", "#0c0820"] }, Z = { label: "RdYlBu", tags: ["diverging"], colors: ["#3288bd", "#66c2a5", "#abdda4", "#e6f598", "#fee08b", "#fdae61", "#f46d43", "#d53e4f"] }, ee = { label: "Dense", tags: ["sequential"], colors: ["#e6f1f1", "#92c4ca", "#44929a", "#20627a", "#1a3c6a", "#211a50", "#0d0621"] }, te = { label: "Algae", tags: ["sequential", "biology", "log"], colors: ["#d7f9d0", "#a2d595", "#64b463", "#129450", "#126e45", "#1a482f", "#122414"] }, re = { label: "Oxygen", tags: ["sequential", "biology", "hypoxia"], colors: ["#09060f", "#5b1028", "#d43d2f", "#f39b3d", "#f3e7b3", "#79cbd1", "#176b9c"] }, ne = { label: "Matter", tags: ["sequential", "biology"], colors: ["#fdfecc", "#f2c98a", "#e07c4e", "#bc3754", "#8d1a6d", "#51156b", "#1c0c3f"] }, ae = { label: "Viridis", tags: ["sequential", "perceptual"], colors: ["#440154", "#443983", "#31688e", "#21918c", "#35b779", "#90d743", "#fde725"] }, ie = { label: "Plasma", tags: ["sequential", "perceptual"], colors: ["#0d0887", "#5e01a6", "#9c179e", "#cc4778", "#ed7953", "#fdb42f", "#f0f921"] }, oe = { label: "Cyclic", tags: ["cyclic", "direction"], colors: ["#2e22ea", "#b541fb", "#fc93c0", "#f1ee35", "#77c80d", "#458776", "#2c24e9"] }, se = { label: "Tempo", tags: ["sequential"], colors: ["#fff6f4", "#c2d1b9", "#7db390", "#2a937f", "#156d73", "#1c455b", "#151d44"] }, ce = { 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"] }, ue = { label: "Amp", tags: ["sequential"], colors: ["#f2f2f2", "#c0b8db", "#9180b6", "#6c4e9e", "#4e2e83", "#32185d", "#110a35"] }, le = { label: "Heat", tags: ["sequential"], colors: ["#fde725", "#fde725", "#f8961e", "#e63946", "#9d0208", "#3a0007"] }, fe = { label: "Balance", tags: ["diverging"], colors: ["#181c43", "#3066af", "#9bbcdd", "#f2f2f2", "#e07d53", "#b13626", "#2c0b0e"] }, he = { label: "Delta", tags: ["diverging"], colors: ["#0e3f31", "#20877b", "#99d4c1", "#f2f2f2", "#a1b0d4", "#3c5b9e", "#0d1938"] }, me = { label: "Curl", tags: ["diverging"], colors: ["#152237", "#2471b3", "#8dbac4", "#f2f2f2", "#c79f84", "#a63827", "#270b17"] }, Ee = { label: "Gray", tags: ["sequential"], colors: ["#000000", "#252525", "#4d4d4d", "#7a7a7a", "#a8a8a8", "#d4d4d4", "#ffffff"] }, $ = {
2
2
  thermal: Y,
3
3
  "thermal-alt": { label: "Thermal Alt", tags: ["sequential", "temperature"], colors: ["#176b9c", "#79cbd1", "#f3e7b3", "#f39b3d", "#d43d2f", "#5b1028", "#09060f"] },
4
- haline: j,
5
- solar: z,
6
- ice: K,
7
- deep: J,
8
- rdylbu: Q,
9
- dense: Z,
10
- algae: ee,
11
- oxygen: te,
12
- matter: re,
13
- viridis: ne,
14
- plasma: ae,
15
- cyclic: ie,
16
- tempo: oe,
17
- turbid: se,
18
- speed: ce,
19
- amp: de,
20
- "heat-alert": { label: "Heat Alert", tags: ["sequential", "alpha"], colors: ["#fde72500", "#fde725cc", "#f8961e", "#e63946", "#9d0208", "#3a0007"] },
21
- balance: ue,
22
- delta: le,
23
- curl: fe,
4
+ haline: z,
5
+ solar: K,
6
+ ice: J,
7
+ deep: Q,
8
+ rdylbu: Z,
9
+ dense: ee,
10
+ algae: te,
11
+ oxygen: re,
12
+ matter: ne,
13
+ viridis: ae,
14
+ plasma: ie,
15
+ cyclic: oe,
16
+ tempo: se,
17
+ turbid: ce,
18
+ speed: de,
19
+ amp: ue,
20
+ heat: le,
21
+ "heat-alert": { label: "Heat Alert", tags: ["sequential", "alpha", "deprecated"], colors: ["#fde72500", "#fde725cc", "#f8961e", "#e63946", "#9d0208", "#3a0007"] },
22
+ balance: fe,
23
+ delta: he,
24
+ curl: me,
24
25
  "mono-black": { label: "Black", tags: ["monochrome", "particles"], colors: ["#000000", "#000000"] },
25
26
  "mono-white": { label: "White", tags: ["monochrome", "particles"], colors: ["#ffffff", "#ffffff"] },
26
27
  "mono-pink": { label: "Pink", tags: ["monochrome", "particles"], colors: ["#ff2aa1", "#ff2aa1"] },
27
- gray: he
28
+ gray: Ee
29
+ }, I = 64, pe = {
30
+ linear: (e) => e,
31
+ // Rises fast: values just inside the zone already show.
32
+ log: (e) => Math.log10(1 + 9 * e),
33
+ // Stays faint longer: codec noise at the end of the range stays hidden.
34
+ exp: (e) => (10 ** e - 1) / 9
28
35
  };
29
- function I(e) {
36
+ function Te(e, t) {
37
+ const r = pe[t.curve ?? "linear"], n = t.low ?? 0, a = t.high ?? 0;
38
+ let i = 1;
39
+ return n > 0 && e < n && (i = Math.min(i, r(Math.max(e, 0) / n))), a > 0 && e > 1 - a && (i = Math.min(i, r(Math.max(1 - e, 0) / a))), i;
40
+ }
41
+ function be(e) {
42
+ let t = e.replace("#", "");
43
+ (t.length === 3 || t.length === 4) && (t = [...t].map((n) => n + n).join(""));
44
+ const r = (n) => parseInt(t.slice(n, n + 2), 16);
45
+ return [
46
+ r(0),
47
+ r(2),
48
+ r(4),
49
+ t.length === 8 ? r(6) : 255
50
+ ];
51
+ }
52
+ function we([e, t, r, n]) {
53
+ return `#${[e, t, r, n].map(
54
+ (a) => Math.round(Math.min(255, Math.max(0, a))).toString(16).padStart(2, "0")
55
+ ).join("")}`;
56
+ }
57
+ function Re(e, t) {
58
+ if (t <= e[0][0])
59
+ return e[0][1];
60
+ for (let r = 1; r < e.length; r++) {
61
+ const [n, a] = e[r];
62
+ if (t <= n) {
63
+ const [i, s] = e[r - 1], o = n === i ? 1 : (t - i) / (n - i);
64
+ return s.map((d, c) => d + (a[c] - d) * o);
65
+ }
66
+ }
67
+ return e[e.length - 1][1];
68
+ }
69
+ function _e(e, t) {
70
+ const r = Object.entries(e).map(
71
+ ([a, i]) => [Number(a), be(i)]
72
+ ).sort((a, i) => a[0] - i[0]), n = {};
73
+ for (let a = 0; a <= I; a++) {
74
+ const i = a / I, [s, o, d, c] = Re(r, i);
75
+ n[i] = we([s, o, d, c * Te(i, t)]);
76
+ }
77
+ return n;
78
+ }
79
+ const Ae = (e) => !!e && ((e.low ?? 0) > 0 || (e.high ?? 0) > 0);
80
+ function C(e) {
30
81
  const t = {}, r = e.length - 1;
31
82
  return e.forEach((n, a) => {
32
83
  t[r === 0 ? 0 : a / r] = n;
33
84
  }), t;
34
85
  }
35
- function me(e, t) {
36
- const r = q;
86
+ function Fe(e, t) {
87
+ const r = xe(e, t?.reverse ?? !1);
88
+ return Ae(t?.alphaFade) ? _e(r, t.alphaFade) : r;
89
+ }
90
+ function xe(e, t) {
91
+ const r = $;
37
92
  if (typeof e == "string") {
38
93
  const n = r[e];
39
94
  if (!n)
@@ -42,19 +97,23 @@ function me(e, t) {
42
97
  r
43
98
  ).join(", ")}`
44
99
  );
45
- const a = t?.reverse ? [...n.colors].reverse() : n.colors;
46
- return I(a);
100
+ const a = t ? [...n.colors].reverse() : n.colors;
101
+ return C(a);
47
102
  }
48
103
  if (Array.isArray(e)) {
49
- const n = t?.reverse ? [...e].reverse() : e;
50
- return I(n);
104
+ const n = t ? [...e].reverse() : e;
105
+ return C(n);
51
106
  }
52
- return e;
107
+ return t ? Object.fromEntries(
108
+ Object.entries(e).map(([n, a]) => [1 - Number(n), a])
109
+ ) : e;
53
110
  }
54
- function et() {
55
- return Object.entries(q).map(([t, r]) => ({ id: t, ...r }));
111
+ function ut(e = {}) {
112
+ return Object.entries($).map(([r, n]) => ({ id: r, ...n })).filter(
113
+ (r) => e.includeDeprecated || !r.tags.includes("deprecated")
114
+ );
56
115
  }
57
- function C(e, t, r) {
116
+ function N(e, t, r) {
58
117
  const n = e.createShader(t);
59
118
  if (!n)
60
119
  throw new Error("Failed to create shader");
@@ -64,18 +123,18 @@ function C(e, t, r) {
64
123
  }
65
124
  return n;
66
125
  }
67
- function tt(e, t, r) {
126
+ function lt(e, t, r) {
68
127
  const n = e.createProgram();
69
128
  if (!n)
70
129
  throw new Error("Failed to create program");
71
- const a = C(e, e.VERTEX_SHADER, t), i = C(e, e.FRAGMENT_SHADER, r);
130
+ const a = N(e, e.VERTEX_SHADER, t), i = N(e, e.FRAGMENT_SHADER, r);
72
131
  if (e.attachShader(n, a), e.attachShader(n, i), e.linkProgram(n), !e.getProgramParameter(n, e.LINK_STATUS)) {
73
- const o = e.getProgramInfoLog(n);
74
- throw e.deleteProgram(n), new Error(`Program link error: ${o}`);
132
+ const s = e.getProgramInfoLog(n);
133
+ throw e.deleteProgram(n), new Error(`Program link error: ${s}`);
75
134
  }
76
135
  return e.deleteShader(a), e.deleteShader(i), n;
77
136
  }
78
- function rt(e, t, r, n, a) {
137
+ function ft(e, t, r, n, a) {
79
138
  const i = e.createTexture();
80
139
  if (!i)
81
140
  throw new Error("Failed to create texture");
@@ -91,15 +150,15 @@ function rt(e, t, r, n, a) {
91
150
  r
92
151
  ), e.bindTexture(e.TEXTURE_2D, null), i;
93
152
  }
94
- function Ee(e, t, r) {
153
+ function ye(e, t, r) {
95
154
  const n = e.getParameter(
96
155
  e.TEXTURE_BINDING_2D
97
156
  ), a = e.getParameter(
98
157
  e.FRAMEBUFFER_BINDING
99
- ), i = e.createTexture(), o = e.createFramebuffer();
100
- if (!i || !o)
101
- return i && e.deleteTexture(i), o && e.deleteFramebuffer(o), e.bindTexture(e.TEXTURE_2D, n), e.bindFramebuffer(e.FRAMEBUFFER, a), !1;
102
- let s = !1;
158
+ ), i = e.createTexture(), s = e.createFramebuffer();
159
+ if (!i || !s)
160
+ return i && e.deleteTexture(i), s && e.deleteFramebuffer(s), e.bindTexture(e.TEXTURE_2D, n), e.bindFramebuffer(e.FRAMEBUFFER, a), !1;
161
+ let o = !1;
103
162
  try {
104
163
  e.bindTexture(e.TEXTURE_2D, i), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.NEAREST), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.NEAREST), e.texImage2D(
105
164
  e.TEXTURE_2D,
@@ -111,31 +170,31 @@ function Ee(e, t, r) {
111
170
  e.RGBA,
112
171
  r,
113
172
  null
114
- ), e.bindFramebuffer(e.FRAMEBUFFER, o), e.framebufferTexture2D(
173
+ ), e.bindFramebuffer(e.FRAMEBUFFER, s), e.framebufferTexture2D(
115
174
  e.FRAMEBUFFER,
116
175
  e.COLOR_ATTACHMENT0,
117
176
  e.TEXTURE_2D,
118
177
  i,
119
178
  0
120
- ), s = e.checkFramebufferStatus(e.FRAMEBUFFER) === e.FRAMEBUFFER_COMPLETE;
179
+ ), o = e.checkFramebufferStatus(e.FRAMEBUFFER) === e.FRAMEBUFFER_COMPLETE;
121
180
  } finally {
122
- e.bindFramebuffer(e.FRAMEBUFFER, a), e.bindTexture(e.TEXTURE_2D, n), e.deleteFramebuffer(o), e.deleteTexture(i);
181
+ e.bindFramebuffer(e.FRAMEBUFFER, a), e.bindTexture(e.TEXTURE_2D, n), e.deleteFramebuffer(s), e.deleteTexture(i);
123
182
  }
124
- return s;
183
+ return o;
125
184
  }
126
- function Te(e) {
185
+ function De(e) {
127
186
  return {
128
187
  kind: "rgba8-packed",
129
188
  internalFormat: e.RGBA,
130
189
  type: e.UNSIGNED_BYTE
131
190
  };
132
191
  }
133
- function nt(e) {
192
+ function ht(e) {
134
193
  if (typeof WebGL2RenderingContext > "u" || !(e instanceof WebGL2RenderingContext))
135
194
  throw new Error("zartigl requires WebGL2");
136
195
  return e;
137
196
  }
138
- function at(e) {
197
+ function mt(e) {
139
198
  const t = [];
140
199
  e.getExtension("EXT_color_buffer_float") ? t.push(
141
200
  { kind: "float32", internalFormat: e.RGBA32F, type: e.FLOAT },
@@ -146,19 +205,19 @@ function at(e) {
146
205
  type: e.HALF_FLOAT
147
206
  });
148
207
  for (const r of t)
149
- if (Ee(
208
+ if (ye(
150
209
  e,
151
210
  r.internalFormat,
152
211
  r.type
153
212
  ))
154
213
  return r;
155
- return Te(e);
214
+ return De(e);
156
215
  }
157
- function it(e, t, r, n, a, i, o) {
158
- const s = e.createTexture();
159
- if (!s)
216
+ function Et(e, t, r, n, a, i, s) {
217
+ const o = e.createTexture();
218
+ if (!o)
160
219
  throw new Error("Failed to create texture");
161
- return e.bindTexture(e.TEXTURE_2D, s), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, t), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, t), e.texImage2D(
220
+ return e.bindTexture(e.TEXTURE_2D, o), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, t), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, t), e.texImage2D(
162
221
  e.TEXTURE_2D,
163
222
  0,
164
223
  i,
@@ -166,14 +225,14 @@ function it(e, t, r, n, a, i, o) {
166
225
  a,
167
226
  0,
168
227
  e.RGBA,
169
- o,
228
+ s,
170
229
  r
171
- ), e.bindTexture(e.TEXTURE_2D, null), s;
230
+ ), e.bindTexture(e.TEXTURE_2D, null), o;
172
231
  }
173
- function ot(e, t, r) {
232
+ function pt(e, t, r) {
174
233
  e.activeTexture(e.TEXTURE0 + r), e.bindTexture(e.TEXTURE_2D, t);
175
234
  }
176
- function st(e, t) {
235
+ function Tt(e, t) {
177
236
  const r = e.createFramebuffer();
178
237
  if (!r)
179
238
  throw new Error("Failed to create framebuffer");
@@ -185,7 +244,7 @@ function st(e, t) {
185
244
  0
186
245
  ), e.bindFramebuffer(e.FRAMEBUFFER, null), r;
187
246
  }
188
- function ct(e) {
247
+ function bt(e) {
189
248
  const t = e.createBuffer();
190
249
  if (!t)
191
250
  throw new Error("Failed to create buffer");
@@ -195,7 +254,7 @@ function ct(e) {
195
254
  e.STATIC_DRAW
196
255
  ), t;
197
256
  }
198
- const pe = {
257
+ const Ue = {
199
258
  0: "#3288bd",
200
259
  0.1: "#66c2a5",
201
260
  0.2: "#abdda4",
@@ -205,19 +264,19 @@ const pe = {
205
264
  0.6: "#f46d43",
206
265
  1: "#d53e4f"
207
266
  };
208
- function dt(e, t) {
209
- const r = t != null ? me(t) : pe, n = document.createElement("canvas");
210
- n.width = 256, n.height = 1;
211
- const a = n.getContext("2d"), i = a.createLinearGradient(0, 0, 256, 0);
212
- for (const [s, d] of Object.entries(r))
213
- i.addColorStop(Number(s), d);
214
- a.fillStyle = i, a.fillRect(0, 0, 256, 1);
267
+ function wt(e, t, r) {
268
+ const n = Fe(t ?? Ue, r), a = document.createElement("canvas");
269
+ a.width = 256, a.height = 1;
270
+ const i = a.getContext("2d"), s = i.createLinearGradient(0, 0, 256, 0);
271
+ for (const [d, c] of Object.entries(n))
272
+ s.addColorStop(Number(d), c);
273
+ i.fillStyle = s, i.fillRect(0, 0, 256, 1);
215
274
  const o = e.createTexture();
216
275
  if (!o)
217
276
  throw new Error("Failed to create color ramp texture");
218
- return e.bindTexture(e.TEXTURE_2D, o), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.LINEAR), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, n), e.bindTexture(e.TEXTURE_2D, null), o;
277
+ return e.bindTexture(e.TEXTURE_2D, o), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.LINEAR), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, a), e.bindTexture(e.TEXTURE_2D, null), o;
219
278
  }
220
- function ut(e) {
279
+ function Rt(e) {
221
280
  const t = e.getExtension("WEBGL_debug_renderer_info");
222
281
  return {
223
282
  vendor: String(e.getParameter(e.VENDOR) ?? ""),
@@ -227,7 +286,7 @@ function ut(e) {
227
286
  version: String(e.getParameter(e.VERSION) ?? "")
228
287
  };
229
288
  }
230
- function lt(e) {
289
+ function _t(e) {
231
290
  return {
232
291
  program: e.getParameter(e.CURRENT_PROGRAM),
233
292
  activeTexture: e.getParameter(e.ACTIVE_TEXTURE),
@@ -244,10 +303,10 @@ function lt(e) {
244
303
  ]
245
304
  };
246
305
  }
247
- function ft(e, t) {
306
+ function At(e, t) {
248
307
  e.useProgram(t.program), e.activeTexture(t.activeTexture), e.bindBuffer(e.ARRAY_BUFFER, t.arrayBuffer), e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, t.elementBuffer), e.bindFramebuffer(e.FRAMEBUFFER, t.framebuffer), t.blend ? e.enable(e.BLEND) : e.disable(e.BLEND), t.depthTest ? e.enable(e.DEPTH_TEST) : e.disable(e.DEPTH_TEST), t.stencilTest ? e.enable(e.STENCIL_TEST) : e.disable(e.STENCIL_TEST), e.viewport(t.viewport[0], t.viewport[1], t.viewport[2], t.viewport[3]), e.blendFunc(t.blendFunc[0], t.blendFunc[1]);
249
308
  }
250
- const be = {
309
+ const ve = {
251
310
  degrees_c: "°C",
252
311
  degc: "°C",
253
312
  degrees_celsius: "°C",
@@ -263,7 +322,7 @@ const be = {
263
322
  "0.001": "PSU",
264
323
  psu: "PSU",
265
324
  stress_level: ""
266
- }, we = {
325
+ }, Se = {
267
326
  meter: "m",
268
327
  meters: "m",
269
328
  metre: "m",
@@ -286,36 +345,36 @@ const be = {
286
345
  newton: "N",
287
346
  pascal: "Pa",
288
347
  kelvin: "K"
289
- }, Re = "⁰¹²³⁴⁵⁶⁷⁸⁹";
290
- function N(e) {
291
- return e === 1 ? "" : [...String(e)].map((t) => Re[Number(t)]).join("");
348
+ }, Me = "⁰¹²³⁴⁵⁶⁷⁸⁹";
349
+ function L(e) {
350
+ return e === 1 ? "" : [...String(e)].map((t) => Me[Number(t)]).join("");
292
351
  }
293
- function ht(e) {
294
- const t = e?.trim() ?? "", r = be[t.toLowerCase()];
352
+ function Ft(e) {
353
+ const t = e?.trim() ?? "", r = ve[t.toLowerCase()];
295
354
  if (r != null)
296
355
  return r;
297
356
  if (t.includes("/"))
298
357
  return t;
299
358
  const n = [], a = [];
300
359
  for (const i of t.split(/\s+/)) {
301
- const o = /^([A-Za-z]+)\^?(-?\d+)?$/.exec(i);
302
- if (!o)
360
+ const s = /^([A-Za-z]+)\^?(-?\d+)?$/.exec(i);
361
+ if (!s)
303
362
  return t.replace(/_/g, " ");
304
- const s = we[o[1]] ?? o[1], d = Number(o[2] ?? 1);
305
- d < 0 ? a.push(s + N(-d)) : n.push(s + N(d));
363
+ const o = Se[s[1]] ?? s[1], d = Number(s[2] ?? 1);
364
+ d < 0 ? a.push(o + L(-d)) : n.push(o + L(d));
306
365
  }
307
366
  return [n.join(" ") || "1", ...a].join("/");
308
367
  }
309
- const L = 20, _e = 600;
310
- function Ae(e) {
368
+ const V = 20, ge = 600;
369
+ function ke(e) {
311
370
  const t = Math.max(0, Math.min(1, e));
312
- return L * Math.pow(_e / L, t);
371
+ return V * Math.pow(ge / V, t);
313
372
  }
314
- function mt(e) {
315
- return Math.exp(-1 / Ae(e));
373
+ function xt(e) {
374
+ return Math.exp(-1 / ke(e));
316
375
  }
317
- const Fe = 0.8, xe = 120, ye = 300;
318
- class Et {
376
+ const Pe = 0.8, Ge = 120, Ie = 300;
377
+ class yt {
319
378
  constructor(t) {
320
379
  this.base = t, this.moving = !1, this.start = 0, this.duration = 0, this.from = t, this.to = t;
321
380
  }
@@ -324,7 +383,7 @@ class Et {
324
383
  this.base = t, this.moving || (this.from = t, this.to = t, this.duration = 0);
325
384
  }
326
385
  setMoving(t, r) {
327
- t !== this.moving && (this.from = this.value(r), this.moving = t, this.to = t ? Fe : this.base, this.start = r, this.duration = t ? xe : ye);
386
+ t !== this.moving && (this.from = this.value(r), this.moving = t, this.to = t ? Pe : this.base, this.start = r, this.duration = t ? Ge : Ie);
328
387
  }
329
388
  value(t) {
330
389
  if (this.duration === 0)
@@ -333,7 +392,7 @@ class Et {
333
392
  return r === 1 ? (this.duration = 0, this.from = this.to, this.to) : this.from + (this.to - this.from) * r * r * (3 - 2 * r);
334
393
  }
335
394
  }
336
- function Tt(e) {
395
+ function Dt(e) {
337
396
  if (e == null)
338
397
  return null;
339
398
  if (!Number.isFinite(e[0]) || !Number.isFinite(e[1]) || e[0] >= e[1])
@@ -342,7 +401,7 @@ function Tt(e) {
342
401
  );
343
402
  return [e[0], e[1]];
344
403
  }
345
- function T(e, t) {
404
+ function p(e, t) {
346
405
  if (typeof e != "number" || !Number.isFinite(e))
347
406
  throw new Error(`Invalid GeoVideo manifest ${t}`);
348
407
  return e;
@@ -360,7 +419,7 @@ function S(e) {
360
419
  e
361
420
  );
362
421
  }
363
- function V(e) {
422
+ function B(e) {
364
423
  if (!e || typeof e != "object")
365
424
  throw new Error("Invalid GeoVideo manifest");
366
425
  const t = e;
@@ -373,34 +432,34 @@ function V(e) {
373
432
  if (!Array.isArray(t.bounds) || t.bounds.length !== 4)
374
433
  throw new Error("Invalid GeoVideo manifest bounds");
375
434
  const [r, n, a, i] = t.bounds.map(
376
- (l, m) => T(l, `bounds[${m}]`)
435
+ (l, m) => p(l, `bounds[${m}]`)
377
436
  );
378
437
  if (n < -90 || i > 90 || n >= i || r === a)
379
438
  throw new Error("Invalid GeoVideo geographic bounds");
380
- const o = t.media;
381
- if (!o || typeof o.url != "string" || !o.url)
439
+ const s = t.media;
440
+ if (!s || typeof s.url != "string" || !s.url)
382
441
  throw new Error("Invalid GeoVideo media");
383
442
  for (const l of ["width", "height", "fps", "durationSeconds"])
384
- if (T(o[l], `media.${l}`) <= 0)
443
+ if (p(s[l], `media.${l}`) <= 0)
385
444
  throw new Error(`Invalid GeoVideo media.${l}`);
386
- const s = t.encoding;
387
- if (!s || s.bits !== 8 || s.colorSpace !== "bt709" || s.colorRange !== "limited" && s.colorRange !== "full")
445
+ const o = t.encoding;
446
+ if (!o || o.bits !== 8 || o.colorSpace !== "bt709" || o.colorRange !== "limited" && o.colorRange !== "full")
388
447
  throw new Error("Invalid GeoVideo encoding");
389
- const d = T(s.codeMin, "encoding.codeMin"), c = T(s.codeMax, "encoding.codeMax");
448
+ const d = p(o.codeMin, "encoding.codeMin"), c = p(o.codeMax, "encoding.codeMax");
390
449
  if (d < 0 || c > 255 || d >= c)
391
450
  throw new Error("Invalid GeoVideo code range");
392
- let f = o.height;
393
- if (s.kind === "scalar-luma") {
394
- if (s.transfer !== "linear" || T(s.valueMin, "encoding.valueMin") >= T(s.valueMax, "encoding.valueMax"))
451
+ let f = s.height;
452
+ if (o.kind === "scalar-luma") {
453
+ if (o.transfer !== "linear" && o.transfer !== "log10-1p9" || p(o.valueMin, "encoding.valueMin") >= p(o.valueMax, "encoding.valueMax"))
395
454
  throw new Error("Invalid GeoVideo scalar-luma encoding");
396
- } else if (s.kind === "vector-luma") {
397
- if (s.transfer !== "linear" && s.transfer !== "sqrt" || s.layout !== "stacked-uv" || T(s.valueDomain, "encoding.valueDomain") <= 0 || o.height % 2 !== 0)
455
+ } else if (o.kind === "vector-luma") {
456
+ if (o.transfer !== "linear" && o.transfer !== "sqrt" || o.layout !== "stacked-uv" || p(o.valueDomain, "encoding.valueDomain") <= 0 || s.height % 2 !== 0)
398
457
  throw new Error("Invalid GeoVideo vector-luma encoding");
399
- f = o.height / 2;
458
+ f = s.height / 2;
400
459
  } else
401
460
  throw new Error("Unsupported GeoVideo encoding");
402
461
  const u = t.mask;
403
- if (!u || u.kind !== "static-validity" || typeof u.url != "string" || !u.url || T(u.width, "mask.width") !== o.width || T(u.height, "mask.height") !== f || T(u.threshold, "mask.threshold") < 0 || u.threshold > 1)
462
+ if (!u || u.kind !== "static-validity" || typeof u.url != "string" || !u.url || p(u.width, "mask.width") !== s.width || p(u.height, "mask.height") !== f || p(u.threshold, "mask.threshold") < 0 || u.threshold > 1)
404
463
  throw new Error("Invalid GeoVideo static mask");
405
464
  if (t.timeline?.kind === "range") {
406
465
  const l = x(t.timeline.dateStart, "timeline.dateStart");
@@ -414,9 +473,9 @@ function V(e) {
414
473
  if (!Array.isArray(t.timeline.values) || t.timeline.values.length === 0)
415
474
  throw new Error("GeoVideo sample sequence must contain values");
416
475
  const l = t.timeline.values.map(
417
- (m, p) => x(m, `timeline.values[${p}]`)
476
+ (m, T) => x(m, `timeline.values[${T}]`)
418
477
  );
419
- if (l.some((m, p) => p > 0 && m <= l[p - 1]))
478
+ if (l.some((m, T) => T > 0 && m <= l[T - 1]))
420
479
  throw new Error(
421
480
  "GeoVideo sample sequence values must be strictly increasing"
422
481
  );
@@ -429,15 +488,15 @@ function V(e) {
429
488
  throw new Error("Invalid GeoVideo provenance");
430
489
  return { ...t, bounds: [r, n, a, i] };
431
490
  }
432
- async function ve(e, t) {
491
+ async function Ce(e, t) {
433
492
  if (typeof e != "string")
434
- return V(e);
493
+ return B(e);
435
494
  const r = await fetch(e, { signal: t });
436
495
  if (!r.ok)
437
496
  throw new Error(
438
497
  `GeoVideo manifest request failed (${r.status}): ${e}`
439
498
  );
440
- const n = await r.json(), a = V(n), i = typeof document < "u" ? new URL(e, document.baseURI).href : e;
499
+ const n = await r.json(), a = B(n), i = typeof document < "u" ? new URL(e, document.baseURI).href : e;
441
500
  return {
442
501
  ...a,
443
502
  media: { ...a.media, url: new URL(a.media.url, i).href },
@@ -458,40 +517,40 @@ function A(e) {
458
517
  (a, i) => t + (r - t) * i / (n - 1)
459
518
  );
460
519
  }
461
- function Ue(e) {
520
+ function Ne(e) {
462
521
  return e.timeline.kind === "sample-sequence" ? e.timeline.values.length / e.media.durationSeconds : e.media.fps;
463
522
  }
464
- function pt(e, t) {
465
- return t / Ue(e);
523
+ function Ut(e, t) {
524
+ return t / Ne(e);
466
525
  }
467
- function De(e, t) {
526
+ function Le(e, t) {
468
527
  if (e.timeline.kind === "snapshot-loop")
469
528
  return 0;
470
529
  if (e.timeline.kind === "sample-sequence") {
471
530
  const i = A(e);
472
- let o = 0;
531
+ let s = 0;
473
532
  for (let d = 1; d < i.length; d += 1)
474
- Math.abs(i[d] - t) < Math.abs(i[o] - t) && (o = d);
475
- const s = e.media.durationSeconds / i.length;
476
- return o * s + Math.min(s / 2, 0.5 / e.media.fps);
533
+ Math.abs(i[d] - t) < Math.abs(i[s] - t) && (s = d);
534
+ const o = e.media.durationSeconds / i.length;
535
+ return s * o + Math.min(o / 2, 0.5 / e.media.fps);
477
536
  }
478
537
  const r = new Date(e.timeline.dateStart).getTime(), n = new Date(e.timeline.dateEnd).getTime();
479
- return Math.max(0, Math.min(1, (t - r) / (n - r))) * $(e);
538
+ return Math.max(0, Math.min(1, (t - r) / (n - r))) * W(e);
480
539
  }
481
- function bt(e, t) {
540
+ function vt(e, t) {
482
541
  if (e.timeline.kind === "snapshot-loop")
483
542
  return new Date(e.timeline.date).getTime();
484
543
  if (e.timeline.kind === "sample-sequence") {
485
- const o = A(e), s = e.media.durationSeconds / o.length, d = Math.floor((t + 0.25 / e.media.fps) / s);
486
- return o[Math.max(0, Math.min(o.length - 1, d))];
544
+ const s = A(e), o = e.media.durationSeconds / s.length, d = Math.floor((t + 0.25 / e.media.fps) / o);
545
+ return s[Math.max(0, Math.min(s.length - 1, d))];
487
546
  }
488
- const r = new Date(e.timeline.dateStart).getTime(), n = new Date(e.timeline.dateEnd).getTime(), a = $(e), i = a > 0 ? Math.max(0, Math.min(1, t / a)) : 0;
547
+ const r = new Date(e.timeline.dateStart).getTime(), n = new Date(e.timeline.dateEnd).getTime(), a = W(e), i = a > 0 ? Math.max(0, Math.min(1, t / a)) : 0;
489
548
  return r + (n - r) * i;
490
549
  }
491
- function $(e) {
550
+ function W(e) {
492
551
  return Math.max(0, e.media.durationSeconds - 1 / e.media.fps);
493
552
  }
494
- function Se(e, t) {
553
+ function Ve(e, t) {
495
554
  const r = new Uint8Array(e.length / 4);
496
555
  for (let n = 0; n < r.length; n++) {
497
556
  const a = e[n * 4];
@@ -499,7 +558,7 @@ function Se(e, t) {
499
558
  }
500
559
  return r;
501
560
  }
502
- class Me {
561
+ class Be {
503
562
  constructor() {
504
563
  this.gl = null, this.texture = null, this.framebuffer = null;
505
564
  }
@@ -530,7 +589,7 @@ class Me {
530
589
  return this.gl = n, this.texture = n.createTexture(), this.framebuffer = n.createFramebuffer(), n;
531
590
  }
532
591
  }
533
- function B(e) {
592
+ function X(e) {
534
593
  const t = Math.max(4, Math.floor(e.length / 4 / 997) * 4);
535
594
  for (let r = 3; r < e.length; r += t)
536
595
  if (e[r] !== 0)
@@ -556,18 +615,18 @@ function M(e, t) {
556
615
  (r) => e.addEventListener(t, () => r(), { once: !0 })
557
616
  );
558
617
  }
559
- const ke = 250;
560
- function Pe(e) {
618
+ const Xe = 250;
619
+ function Oe(e) {
561
620
  return "requestVideoFrameCallback" in e ? Promise.race([
562
621
  new Promise(
563
622
  (t) => e.requestVideoFrameCallback(() => t())
564
623
  ),
565
- new Promise((t) => setTimeout(t, ke))
624
+ new Promise((t) => setTimeout(t, Xe))
566
625
  ]) : Promise.resolve();
567
626
  }
568
- class W {
627
+ class H {
569
628
  constructor(t, r, n = {}) {
570
- this.reader = new Me(), 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 = t, this.planes = r, this.cacheSize = Math.max(1, n.cacheSize ?? 3), this.width = t.media.width, this.height = t.media.height / r, this.times = Float64Array.from(A(t));
629
+ this.reader = new Be(), 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 = t, this.planes = r, this.cacheSize = Math.max(1, n.cacheSize ?? 3), this.width = t.media.width, this.height = t.media.height / r, this.times = Float64Array.from(A(t));
571
630
  }
572
631
  /** Static validity, one 8-bit value per grid cell; null before init(). */
573
632
  get mask() {
@@ -576,11 +635,11 @@ class W {
576
635
  /** Luma codes of the presented frame, or null when it is blank. */
577
636
  readCodes(t, r) {
578
637
  const n = this.reader.read(t, this.width, r);
579
- return B(n) ? null : Se(n, this.manifest.encoding.colorRange);
638
+ return X(n) ? null : Ve(n, this.manifest.encoding.colorRange);
580
639
  }
581
640
  /** True when the decoder exposed no pixels; reads back one row only. */
582
641
  isBlank(t) {
583
- return B(this.reader.read(t, this.width, 1));
642
+ return X(this.reader.read(t, this.width, 1));
584
643
  }
585
644
  init() {
586
645
  return this.initPromise ??= this.load().catch((t) => {
@@ -658,10 +717,10 @@ class W {
658
717
  throw new Error(
659
718
  `GeoVideo mask dimensions ${a.naturalWidth}x${a.naturalHeight} do not match manifest ${r}x${n}`
660
719
  );
661
- const i = this.reader.read(a, r, n), o = new Uint8Array(r * n);
662
- for (let s = 0; s < o.length; s++)
663
- o[s] = i[s * 4];
664
- return o;
720
+ const i = this.reader.read(a, r, n), s = new Uint8Array(r * n);
721
+ for (let o = 0; o < s.length; o++)
722
+ s[o] = i[o * 4];
723
+ return s;
665
724
  }
666
725
  async loadVideo() {
667
726
  const t = document.createElement("video");
@@ -683,7 +742,7 @@ class W {
683
742
  async presentFrame(t, r) {
684
743
  if (this.presented && Math.abs(t.currentTime - r) <= 1e-3 && !t.seeking)
685
744
  return;
686
- const n = Pe(t), a = M(t, "seeked");
745
+ const n = Oe(t), a = M(t, "seeked");
687
746
  t.currentTime = r, await a, t.readyState < HTMLMediaElement.HAVE_CURRENT_DATA && await Promise.race([M(t, "loadeddata"), M(t, "canplay")]), await n, this.presented = !0;
688
747
  }
689
748
  /**
@@ -710,28 +769,29 @@ class W {
710
769
  const n = this.video, a = this.maskCodes;
711
770
  if (r.aborted || !n || !a)
712
771
  throw E();
713
- const i = De(this.manifest, this.times[t]);
772
+ const i = Le(this.manifest, this.times[t]);
714
773
  if (await this.presentFrame(n, i), r.aborted || n !== this.video)
715
774
  throw E();
716
- const o = this.height * this.planes;
717
- let s = await this.capture(n, o, a);
718
- if (s === null && !this.primed) {
775
+ const s = this.height * this.planes;
776
+ let o = await this.capture(n, s, a);
777
+ if (o === null && !this.primed) {
719
778
  if (await this.primeDecoder(n), await this.presentFrame(n, i), r.aborted || n !== this.video)
720
779
  throw E();
721
- s = await this.capture(n, o, a);
780
+ o = await this.capture(n, s, a);
722
781
  }
723
- if (s === null)
782
+ if (o === null)
724
783
  throw new Error("GeoVideo frame could not be read back from the decoder");
725
- return s;
784
+ return o;
726
785
  }
727
786
  }
728
- function wt(e) {
787
+ function St(e) {
729
788
  return {
730
789
  codeRange: [e.codeMin / 255, e.codeMax / 255],
731
- valueRange: [e.valueMin, e.valueMax]
790
+ valueRange: [e.valueMin, e.valueMax],
791
+ transfer: e.transfer === "log10-1p9" ? 1 : 0
732
792
  };
733
793
  }
734
- class ge extends W {
794
+ class qe extends H {
735
795
  constructor(t, r = {}) {
736
796
  if (t.encoding.kind !== "scalar-luma")
737
797
  throw new Error("GeoVideoScalarSource requires a scalar-luma manifest");
@@ -744,11 +804,11 @@ class ge extends W {
744
804
  });
745
805
  }
746
806
  }
747
- function Ge(e, t) {
807
+ function $e(e, t) {
748
808
  let r = (e - t.codeMin) / (t.codeMax - t.codeMin) * 2 - 1;
749
809
  return r = Math.max(-1, Math.min(1, r)), t.transfer === "sqrt" && (r = Math.sign(r) * r * r), r * t.valueDomain;
750
810
  }
751
- function Ie(e, t, r, n) {
811
+ function We(e, t, r, n) {
752
812
  const a = t.length;
753
813
  if (e.length !== 2 * a)
754
814
  throw new Error(
@@ -756,30 +816,30 @@ function Ie(e, t, r, n) {
756
816
  );
757
817
  const i = new Float32Array(256);
758
818
  for (let c = 0; c < 256; c++)
759
- i[c] = Ge(c, n);
760
- const o = r * 255, s = new Float32Array(a), d = new Float32Array(a);
819
+ i[c] = $e(c, n);
820
+ const s = r * 255, o = new Float32Array(a), d = new Float32Array(a);
761
821
  for (let c = 0; c < a; c++) {
762
- const f = t[c] >= o;
763
- s[c] = f ? i[e[c]] : NaN, d[c] = f ? i[e[a + c]] : NaN;
822
+ const f = t[c] >= s;
823
+ o[c] = f ? i[e[c]] : NaN, d[c] = f ? i[e[a + c]] : NaN;
764
824
  }
765
- return { u: s, v: d };
825
+ return { u: o, v: d };
766
826
  }
767
- class Ce extends W {
827
+ class He extends H {
768
828
  constructor(t, r = {}) {
769
829
  if (t.encoding.kind !== "vector-luma")
770
830
  throw new Error("GeoVideoVectorSource requires a vector-luma manifest");
771
831
  super(t, 2, r), this.encoding = t.encoding;
772
- const [n, a, i, o] = t.bounds, s = (i - n) / this.width, d = (o - a) / this.height;
832
+ const [n, a, i, s] = t.bounds, o = (i - n) / this.width, d = (s - a) / this.height;
773
833
  this.coords = {
774
834
  time: this.times,
775
835
  vertical: new Float32Array([0]),
776
836
  latitude: Float32Array.from(
777
837
  { length: this.height },
778
- (c, f) => o - (f + 0.5) * d
838
+ (c, f) => s - (f + 0.5) * d
779
839
  ),
780
840
  longitude: Float32Array.from(
781
841
  { length: this.width },
782
- (c, f) => n + (f + 0.5) * s
842
+ (c, f) => n + (f + 0.5) * o
783
843
  )
784
844
  };
785
845
  }
@@ -831,7 +891,7 @@ class Ce extends W {
831
891
  /** u/v codes are written into luma: read back, then decoded on the CPU. */
832
892
  async capture(t, r, n) {
833
893
  const a = this.readCodes(t, r);
834
- return a ? Ie(
894
+ return a ? We(
835
895
  a,
836
896
  n,
837
897
  this.manifest.mask.threshold,
@@ -839,15 +899,15 @@ class Ce extends W {
839
899
  ) : null;
840
900
  }
841
901
  }
842
- function Ne(e, t, r = {}) {
843
- const [n, a] = r.range ?? [-1 / 0, 1 / 0], i = [...e].sort((s, d) => s.start - d.start), o = i.find(
844
- (s) => s.start > t && s.start <= a
902
+ function je(e, t, r = {}) {
903
+ const [n, a] = r.range ?? [-1 / 0, 1 / 0], i = [...e].sort((o, d) => o.start - d.start), s = i.find(
904
+ (o) => o.start > t && o.start <= a
845
905
  ) ?? (r.loop ? i.find(
846
- (s) => s.end >= n && s.start <= a
906
+ (o) => o.end >= n && o.start <= a
847
907
  ) : void 0);
848
- return o ? { chunk: o, time: Math.max(o.start, n) } : null;
908
+ return s ? { chunk: s, time: Math.max(s.start, n) } : null;
849
909
  }
850
- function Le(e, t) {
910
+ function Ye(e, t) {
851
911
  let r = null, n = -1 / 0;
852
912
  for (const a of t) {
853
913
  const i = Math.min(e.end, a.end) - Math.max(e.start, a.start);
@@ -855,7 +915,7 @@ function Le(e, t) {
855
915
  }
856
916
  return r;
857
917
  }
858
- function Ve(e) {
918
+ function ze(e) {
859
919
  return {
860
920
  width: e.mask.width,
861
921
  height: e.mask.height,
@@ -863,11 +923,11 @@ function Ve(e) {
863
923
  rowOrder: "north-to-south"
864
924
  };
865
925
  }
866
- function Be(e, t = {}) {
867
- return e.encoding.kind === "vector-luma" ? new Ce(e, t) : new ge(e, t);
926
+ function Ke(e, t = {}) {
927
+ return e.encoding.kind === "vector-luma" ? new He(e, t) : new qe(e, t);
868
928
  }
869
- const Xe = 3, Oe = 3, qe = 0.6, $e = 1.5;
870
- function We(e, t) {
929
+ const Je = 3, Qe = 3, Ze = 0.6, et = 1.5;
930
+ function tt(e, t) {
871
931
  const r = e.length - 1;
872
932
  if (t <= e[0])
873
933
  return { step: 0, fraction: 0 };
@@ -880,7 +940,7 @@ function We(e, t) {
880
940
  }
881
941
  return { step: n, fraction: (t - e[n]) / (e[a] - e[n]) };
882
942
  }
883
- function He(e) {
943
+ function rt(e) {
884
944
  const t = new AbortController();
885
945
  if (!e)
886
946
  return { controller: t, unlink: () => {
@@ -891,14 +951,14 @@ function He(e) {
891
951
  unlink: () => e.removeEventListener("abort", r)
892
952
  };
893
953
  }
894
- class Rt {
954
+ class Mt {
895
955
  constructor(t) {
896
956
  this.manifests = /* @__PURE__ */ new Map(), this.open = /* @__PURE__ */ new Map(), this.id = t.id, this.chunks = t.chunks.filter(
897
957
  (r) => Number.isFinite(r.start) && Number.isFinite(r.end) && r.end >= r.start
898
- ).sort((r, n) => r.start - n.start), this.maxOpenChunks = Math.max(2, t.maxOpenChunks ?? Xe), this.frameCacheSize = Math.max(
958
+ ).sort((r, n) => r.start - n.start), this.maxOpenChunks = Math.max(2, t.maxOpenChunks ?? Je), this.frameCacheSize = Math.max(
899
959
  1,
900
- t.frameCacheSize ?? Oe
901
- ), this.prefetchAt = t.prefetchAt ?? qe, this.maxGap = t.maxGap, this.loadManifest = t.loadManifest ?? ve, this.createFrameSource = t.createFrameSource ?? ((r, n) => Be(
960
+ t.frameCacheSize ?? Qe
961
+ ), this.prefetchAt = t.prefetchAt ?? Ze, this.maxGap = t.maxGap, this.loadManifest = t.loadManifest ?? Ce, this.createFrameSource = t.createFrameSource ?? ((r, n) => Ke(
902
962
  r,
903
963
  n
904
964
  ));
@@ -934,39 +994,39 @@ class Rt {
934
994
  const i = this.chunkIndexAt(t);
935
995
  if (i < 0)
936
996
  return null;
937
- const o = [], { controller: s, unlink: d } = He(n);
997
+ const s = [], { controller: o, unlink: d } = rt(n);
938
998
  try {
939
- const c = this.acquire(this.chunks[i], o), f = await R(c.ready, s.signal), { times: u } = f;
999
+ const c = this.acquire(this.chunks[i], s), f = await R(c.ready, o.signal), { times: u } = f;
940
1000
  let h;
941
1001
  if (t <= u[u.length - 1]) {
942
- const { step: b, fraction: w } = We(u, t);
1002
+ const { step: b, fraction: w } = tt(u, t);
943
1003
  h = a === "discrete" || w === 0 ? [c, b, c, b, 0] : [c, b, c, b + 1, w];
944
1004
  } else {
945
1005
  const b = this.chunks[i + 1];
946
1006
  if (!b)
947
1007
  return null;
948
- const w = this.acquire(b, o), G = await R(w.ready, s.signal), F = u.length - 1, U = u[F], D = G.times[0];
949
- if (D - U > this.gapLimit(u, G.times))
1008
+ const w = this.acquire(b, s), G = await R(w.ready, o.signal), F = u.length - 1, U = u[F], v = G.times[0];
1009
+ if (v - U > this.gapLimit(u, G.times))
950
1010
  return null;
951
- h = a === "discrete" ? [c, F, c, F, 0] : t >= D ? [w, 0, w, 0, 0] : [c, F, w, 0, (t - U) / (D - U)];
1011
+ h = a === "discrete" ? [c, F, c, F, 0] : t >= v ? [w, 0, w, 0, 0] : [c, F, w, 0, (t - U) / (v - U)];
952
1012
  }
953
- const [l, m, p, y, _] = h, P = l === p && m === y, g = [this.frame(l, m, s.signal)];
954
- P || g.push(this.frame(p, y, s.signal));
955
- let v;
1013
+ const [l, m, T, y, _] = h, k = l === T && m === y, P = [this.frame(l, m, o.signal)];
1014
+ k || P.push(this.frame(T, y, o.signal));
1015
+ let D;
956
1016
  try {
957
- v = await Promise.all(g);
1017
+ D = await Promise.all(P);
958
1018
  } catch (b) {
959
- throw s.abort(), b;
1019
+ throw o.abort(), b;
960
1020
  }
961
1021
  return this.prefetchAfter(i, t), {
962
1022
  time: t,
963
- a: v[0],
964
- b: v[P ? 0 : 1],
1023
+ a: D[0],
1024
+ b: D[k ? 0 : 1],
965
1025
  mix: _
966
1026
  };
967
1027
  } finally {
968
1028
  d();
969
- for (const c of o)
1029
+ for (const c of s)
970
1030
  c.users--;
971
1031
  this.trim();
972
1032
  }
@@ -1001,11 +1061,11 @@ class Rt {
1001
1061
  t.length > 1 ? t[t.length - 1] - t[t.length - 2] : 0,
1002
1062
  r.length > 1 ? r[1] - r[0] : 0
1003
1063
  ], a = Math.max(...n);
1004
- return a > 0 ? a * $e : -1 / 0;
1064
+ return a > 0 ? a * et : -1 / 0;
1005
1065
  }
1006
1066
  prefetchAfter(t, r) {
1007
- const n = this.chunks[t], a = this.chunks[t + 1], i = n.end - n.start, o = i > 0 ? (r - n.start) / i : 1;
1008
- a && o > this.prefetchAt && this.prefetch(a);
1067
+ const n = this.chunks[t], a = this.chunks[t + 1], i = n.end - n.start, s = i > 0 ? (r - n.start) / i : 1;
1068
+ a && s > this.prefetchAt && this.prefetch(a);
1009
1069
  }
1010
1070
  manifest(t) {
1011
1071
  let r = this.manifests.get(t.manifestUrl);
@@ -1038,7 +1098,7 @@ class Rt {
1038
1098
  return n.opened = {
1039
1099
  manifest: a,
1040
1100
  times: Float64Array.from(A(a)),
1041
- grid: Ve(a),
1101
+ grid: ze(a),
1042
1102
  source: this.createFrameSource(a, {
1043
1103
  cacheSize: this.frameCacheSize
1044
1104
  })
@@ -1050,20 +1110,20 @@ class Rt {
1050
1110
  return this.open.set(t.key, r), r;
1051
1111
  }
1052
1112
  async frame(t, r, n) {
1053
- const { manifest: a, times: i, grid: o, source: s } = await R(
1113
+ const { manifest: a, times: i, grid: s, source: o } = await R(
1054
1114
  t.ready,
1055
1115
  n
1056
1116
  );
1057
1117
  if (t.released)
1058
1118
  throw E();
1059
- const d = await s.frame(r, { signal: n });
1119
+ const d = await o.frame(r, { signal: n });
1060
1120
  return {
1061
1121
  key: `${this.id}/${t.chunk.key}/${r}`,
1062
1122
  chunk: t.chunk,
1063
1123
  step: r,
1064
1124
  time: i[r],
1065
1125
  data: d,
1066
- grid: o,
1126
+ grid: s,
1067
1127
  manifest: a
1068
1128
  };
1069
1129
  }
@@ -1080,7 +1140,7 @@ class Rt {
1080
1140
  t.released = !0, t.prefetch?.abort(), t.prefetch = null, t.opened?.source.release(), t.opened = null, this.open.get(t.chunk.key) === t && this.open.delete(t.chunk.key);
1081
1141
  }
1082
1142
  }
1083
- function k(e) {
1143
+ function g(e) {
1084
1144
  const { start: t, end: r } = e.temporal ?? {};
1085
1145
  return {
1086
1146
  source: e,
@@ -1088,54 +1148,54 @@ function k(e) {
1088
1148
  end: Date.parse(r ?? t ?? "")
1089
1149
  };
1090
1150
  }
1091
- function _t(e, t, r = {}) {
1092
- const n = e.filter((i) => i.id === t.id && i.temporal?.start != null).map(k), a = Ne(
1151
+ function gt(e, t, r = {}) {
1152
+ const n = e.filter((i) => i.id === t.id && i.temporal?.start != null).map(g), a = je(
1093
1153
  n,
1094
1154
  Date.parse(t.temporal?.end ?? ""),
1095
1155
  r
1096
1156
  );
1097
1157
  return a ? { source: a.chunk.source, time: a.time } : null;
1098
1158
  }
1099
- function At(e, t) {
1100
- return Le(k(e), t.map(k))?.source ?? null;
1159
+ function kt(e, t) {
1160
+ return Ye(g(e), t.map(g))?.source ?? null;
1101
1161
  }
1102
- const Ye = /^P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/;
1103
- function je(e) {
1162
+ const nt = /^P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/;
1163
+ function at(e) {
1104
1164
  return e instanceof Date ? e.getTime() : typeof e == "number" ? e : new Date(e).getTime();
1105
1165
  }
1106
- function X(e, t) {
1107
- const r = je(e);
1166
+ function O(e, t) {
1167
+ const r = at(e);
1108
1168
  if (!Number.isFinite(r))
1109
1169
  throw new Error(`Invalid ${t}`);
1110
1170
  return r;
1111
1171
  }
1112
- function H(e, t) {
1113
- const r = t.match(Ye);
1172
+ function j(e, t) {
1173
+ const r = t.match(nt);
1114
1174
  if (!r)
1115
1175
  throw new Error(`Invalid trailing time duration: ${t}`);
1116
1176
  const n = r.slice(1).map((_) => Number(_ ?? 0));
1117
1177
  if (!n.some((_) => _ > 0))
1118
1178
  throw new Error("Trailing time duration must be positive");
1119
- const [a, i, o, s, d, c, f] = n, u = new Date(e), h = u.getUTCFullYear() * 12 + u.getUTCMonth() - a * 12 - i, l = Math.floor(h / 12), m = (h % 12 + 12) % 12, p = new Date(Date.UTC(l, m + 1, 0)).getUTCDate();
1179
+ const [a, i, s, o, d, c, f] = n, u = new Date(e), h = u.getUTCFullYear() * 12 + u.getUTCMonth() - a * 12 - i, l = Math.floor(h / 12), m = (h % 12 + 12) % 12, T = new Date(Date.UTC(l, m + 1, 0)).getUTCDate();
1120
1180
  return Date.UTC(
1121
1181
  l,
1122
1182
  m,
1123
- Math.min(u.getUTCDate(), p),
1183
+ Math.min(u.getUTCDate(), T),
1124
1184
  u.getUTCHours(),
1125
1185
  u.getUTCMinutes(),
1126
1186
  u.getUTCSeconds(),
1127
1187
  u.getUTCMilliseconds()
1128
- ) - (((o * 7 + s) * 24 + d) * 60 + c) * 6e4 - f * 1e3;
1188
+ ) - (((s * 7 + o) * 24 + d) * 60 + c) * 6e4 - f * 1e3;
1129
1189
  }
1130
- function Ft(e, [t, r]) {
1190
+ function Pt(e, [t, r]) {
1131
1191
  let n = t, a = r;
1132
- if (typeof e.trailing == "string" ? n = H(r, e.trailing) : (e.start != null && (n = X(e.start, "time range start")), e.end != null && (a = X(e.end, "time range end"))), n > a)
1192
+ if (typeof e.trailing == "string" ? n = j(r, e.trailing) : (e.start != null && (n = O(e.start, "time range start")), e.end != null && (a = O(e.end, "time range end"))), n > a)
1133
1193
  throw new Error("Time range start must not follow its end");
1134
1194
  return [Math.max(t, n), Math.min(r, a)];
1135
1195
  }
1136
- const ze = (e) => typeof e == "object" && e !== null && !Array.isArray(e);
1137
- function xt(e, t) {
1138
- if (!ze(e))
1196
+ const it = (e) => typeof e == "object" && e !== null && !Array.isArray(e);
1197
+ function Gt(e, t) {
1198
+ if (!it(e))
1139
1199
  throw new Error(`${t} must be an object`);
1140
1200
  for (const i of Object.keys(e))
1141
1201
  if (i !== "start" && i !== "end" && i !== "trailing")
@@ -1145,14 +1205,14 @@ function xt(e, t) {
1145
1205
  throw new Error(`${t}.trailing excludes start and end`);
1146
1206
  if (typeof e.trailing != "string")
1147
1207
  throw new Error(`${t}.trailing must be an ISO 8601 duration`);
1148
- return H(0, e.trailing), { trailing: e.trailing };
1208
+ return j(0, e.trailing), { trailing: e.trailing };
1149
1209
  }
1150
1210
  const r = (i) => {
1151
- const o = e[i];
1152
- if (o !== void 0) {
1153
- if (typeof o != "string" || !Number.isFinite(Date.parse(o)))
1211
+ const s = e[i];
1212
+ if (s !== void 0) {
1213
+ if (typeof s != "string" || !Number.isFinite(Date.parse(s)))
1154
1214
  throw new Error(`${t}.${i} is not a date`);
1155
- return o;
1215
+ return s;
1156
1216
  }
1157
1217
  }, n = r("start"), a = r("end");
1158
1218
  if (n !== void 0 && a !== void 0 && Date.parse(n) > Date.parse(a))
@@ -1162,37 +1222,37 @@ function xt(e, t) {
1162
1222
  ...a !== void 0 && { end: a }
1163
1223
  };
1164
1224
  }
1165
- function yt(e) {
1225
+ function It(e) {
1166
1226
  return e.type === "geovideo" && typeof e.indexUrl == "string";
1167
1227
  }
1168
- function vt(e, t) {
1228
+ function Ct(e, t) {
1169
1229
  return e.id === t.id && (e.type !== "geovideo" || t.type !== "geovideo" || e.manifestUrl === t.manifestUrl);
1170
1230
  }
1171
- function O(e) {
1231
+ function q(e) {
1172
1232
  return typeof e == "string" && Number.isFinite(Date.parse(e));
1173
1233
  }
1174
- function Ke(e) {
1234
+ function ot(e) {
1175
1235
  const t = e;
1176
1236
  if (!t || t.schemaVersion !== 1 || t.type !== "geovideo-index" || !Array.isArray(t.chunks))
1177
1237
  throw new Error("Unsupported GeoVideo index");
1178
1238
  for (const r of t.chunks)
1179
- if (!O(r?.start) || !O(r.end) || Date.parse(r.end) < Date.parse(r.start) || typeof r.manifestUrl != "string")
1239
+ if (!q(r?.start) || !q(r.end) || Date.parse(r.end) < Date.parse(r.start) || typeof r.manifestUrl != "string")
1180
1240
  throw new Error("Invalid GeoVideo index chunk");
1181
1241
  return t;
1182
1242
  }
1183
- async function Ut(e, t) {
1243
+ async function Nt(e, t) {
1184
1244
  const r = await fetch(e, { signal: t });
1185
1245
  if (!r.ok)
1186
1246
  throw new Error(
1187
1247
  `GeoVideo index request failed (${r.status}): ${e}`
1188
1248
  );
1189
- return Ke(await r.json());
1249
+ return ot(await r.json());
1190
1250
  }
1191
- function Je(e) {
1251
+ function st(e) {
1192
1252
  return typeof document < "u" ? new URL(e, document.baseURI).href : e;
1193
1253
  }
1194
- function Qe(e, t) {
1195
- const r = Je(t);
1254
+ function ct(e, t) {
1255
+ const r = st(t);
1196
1256
  return e.chunks.map((n) => ({
1197
1257
  key: n.key,
1198
1258
  manifestUrl: new URL(n.manifestUrl, r).href,
@@ -1202,15 +1262,15 @@ function Qe(e, t) {
1202
1262
  ...n.provisional ? { provisional: !0 } : {}
1203
1263
  }));
1204
1264
  }
1205
- function Ze(e, t, r) {
1265
+ function dt(e, t, r) {
1206
1266
  if (t.sourceId !== e.id || t.catalogEntryId !== r.id)
1207
1267
  throw new Error(
1208
1268
  `GeoVideo index identity does not match catalog entry/source: ${e.id}`
1209
1269
  );
1210
1270
  }
1211
- function Dt(e, t, r) {
1212
- Ze(e, t, r);
1213
- const n = Qe(t, e.indexUrl);
1271
+ function Lt(e, t, r) {
1272
+ dt(e, t, r);
1273
+ const n = ct(t, e.indexUrl);
1214
1274
  return t.chunks.map(
1215
1275
  (a, i) => ({
1216
1276
  id: e.id,
@@ -1228,54 +1288,55 @@ function Dt(e, t, r) {
1228
1288
  );
1229
1289
  }
1230
1290
  export {
1231
- et as A,
1232
- yt as B,
1233
- _t as C,
1234
- Ut as D,
1235
- Dt as E,
1236
- Ft as F,
1237
- Ce as G,
1238
- V as H,
1239
- Rt as I,
1240
- W as J,
1241
- ge as K,
1242
- Ze as L,
1243
- Be as M,
1244
- C as N,
1245
- Ae as O,
1246
- Ve as P,
1247
- Qe as Q,
1248
- Ne as R,
1249
- At as S,
1250
- Et as T,
1251
- Le as U,
1252
- xt as V,
1253
- H as W,
1254
- Ke as X,
1255
- ct as a,
1256
- dt as b,
1257
- tt as c,
1258
- at as d,
1259
- it as e,
1260
- st as f,
1261
- ut as g,
1262
- rt as h,
1263
- ot as i,
1264
- nt as j,
1265
- ft as k,
1266
- mt as l,
1267
- ve as m,
1268
- wt as n,
1269
- De as o,
1270
- me as p,
1271
- bt as q,
1272
- Te as r,
1273
- lt as s,
1291
+ ut as A,
1292
+ It as B,
1293
+ gt as C,
1294
+ Nt as D,
1295
+ Lt as E,
1296
+ Pt as F,
1297
+ He as G,
1298
+ B as H,
1299
+ Mt as I,
1300
+ H as J,
1301
+ qe as K,
1302
+ Te as L,
1303
+ dt as M,
1304
+ Ke as N,
1305
+ N as O,
1306
+ ke as P,
1307
+ ze as Q,
1308
+ ct as R,
1309
+ je as S,
1310
+ yt as T,
1311
+ kt as U,
1312
+ Ye as V,
1313
+ Gt as W,
1314
+ j as X,
1315
+ ot as Y,
1316
+ bt as a,
1317
+ wt as b,
1318
+ lt as c,
1319
+ mt as d,
1320
+ Et as e,
1321
+ Tt as f,
1322
+ Rt as g,
1323
+ ft as h,
1324
+ pt as i,
1325
+ ht as j,
1326
+ At as k,
1327
+ xt as l,
1328
+ Ce as m,
1329
+ St as n,
1330
+ Le as o,
1331
+ Fe as p,
1332
+ vt as q,
1333
+ De as r,
1334
+ _t as s,
1274
1335
  A as t,
1275
- X as u,
1276
- Tt as v,
1277
- vt as w,
1278
- pt as x,
1279
- Ue as y,
1280
- ht as z
1336
+ O as u,
1337
+ Dt as v,
1338
+ Ct as w,
1339
+ Ut as x,
1340
+ Ne as y,
1341
+ Ft as z
1281
1342
  };