@fxi/zartigl 0.14.1 → 0.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -1
- package/dist/catalog.d.ts +17 -0
- package/dist/catalog.js +20 -19
- package/dist/engine.d.ts +50 -1
- package/dist/{index-BDIf6Jc0.js → index-B1lj-XR_.js} +164 -143
- package/dist/zartigl.d.ts +50 -1
- package/dist/zartigl.js +346 -313
- package/package.json +9 -3
package/dist/zartigl.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { m as ae, p as
|
|
2
|
-
import { T as
|
|
3
|
-
import { O as
|
|
4
|
-
import { B as
|
|
5
|
-
import { f as
|
|
6
|
-
import { inflate as
|
|
7
|
-
import
|
|
8
|
-
const Ie = 85,
|
|
9
|
-
function
|
|
1
|
+
import { m as ae, p as pt, s as gt, a as qe, b as Bt, r as ze, c as $t, d as he, e as qt, f as vt, g as Wt } from "./index-B1lj-XR_.js";
|
|
2
|
+
import { T as Xt, g as Ht, r as Yt, d as Zt, c as W, a as jt, b as ge, e as Qt, f as J, h as Se, i as O, G as Kt, j as We, F as Jt, s as yt, v as Q, k as K, l as Ge, m as Oe, n as _t, o as Xe, p as Ce, q as ei, t as ke, u as ti, w as xt, x as z, y as He, z as we, A as ii, B as ai, C as si, D as Ye, E as ri, H as Fe, I as ni, J as bt, K as oi, L as li, M as ci, N as hi } from "./engine-C8ZNzILO.js";
|
|
3
|
+
import { O as Na, P as za } from "./engine-C8ZNzILO.js";
|
|
4
|
+
import { B as ui, a as di, b as mi, c as fi, d as St, r as wt, e as pi, g as gi } from "./backdrop-Dceb4d8E.js";
|
|
5
|
+
import { f as Oa, i as Ba } from "./backdrop-Dceb4d8E.js";
|
|
6
|
+
import { inflate as vi } from "pako";
|
|
7
|
+
import yi from "numcodecs/blosc";
|
|
8
|
+
const Ie = 85, _i = 89.9;
|
|
9
|
+
function Ue(s) {
|
|
10
10
|
return Math.max(-Ie, Math.min(Ie, s));
|
|
11
11
|
}
|
|
12
12
|
function Ze(s) {
|
|
13
|
-
const e =
|
|
13
|
+
const e = Ue(s), t = Math.sin(e * Math.PI / 180);
|
|
14
14
|
return 0.5 - Math.log((1 + t) / (1 - t)) / (4 * Math.PI);
|
|
15
15
|
}
|
|
16
16
|
function ve(s) {
|
|
17
17
|
return (s + 180) / 360;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function xi(s) {
|
|
20
20
|
return ((s + 180) % 360 + 360) % 360 - 180;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function Tt(s, e, t, i) {
|
|
23
23
|
const a = (o, l, d) => d > l ? Math.abs(o[d] - o[l]) / (d - l) / 2 : o.length > 1 ? Math.abs(o[1] - o[0]) / 2 : 0, r = a(s, t[0], t[1]), n = a(e, i[0], i[1]);
|
|
24
24
|
return {
|
|
25
25
|
west: s[t[0]] - r,
|
|
@@ -34,24 +34,24 @@ function ye(s, e) {
|
|
|
34
34
|
const t = e?.projectionTransition;
|
|
35
35
|
return typeof t == "number" ? t > 0 : !0;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
const t =
|
|
37
|
+
function bi(s, e) {
|
|
38
|
+
const t = xi(s) * Math.PI / 180, i = e * Math.PI / 180, a = Math.cos(i);
|
|
39
39
|
return [
|
|
40
40
|
Math.sin(t) * a,
|
|
41
41
|
Math.sin(i),
|
|
42
42
|
Math.cos(t) * a
|
|
43
43
|
];
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function Si(s) {
|
|
46
46
|
return {
|
|
47
47
|
west: -180,
|
|
48
48
|
east: 180,
|
|
49
|
-
south:
|
|
50
|
-
north:
|
|
49
|
+
south: Ue(s.getSouth()),
|
|
50
|
+
north: Ue(s.getNorth())
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
function
|
|
54
|
-
const i = t ?
|
|
53
|
+
function wi(s, e = 1, t = !1) {
|
|
54
|
+
const i = t ? _i : Ie, a = (d) => Math.max(-i, Math.min(i, d)), r = a(s.getSouth()), n = a(s.getNorth()), l = Math.max(0, n - r) * Math.max(0, e);
|
|
55
55
|
return {
|
|
56
56
|
west: -180,
|
|
57
57
|
east: 180,
|
|
@@ -59,10 +59,10 @@ function Si(s, e = 1, t = !1) {
|
|
|
59
59
|
north: a(n + l)
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function Ti(s, e, t = 1e-6) {
|
|
63
63
|
return s.south <= e.south + t && s.north >= e.north - t;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function Mi(s, e = !1) {
|
|
66
66
|
const t = s.getWest(), i = s.getEast(), a = ve(t), r = ve(i), n = a - Math.floor(a), o = r - a >= 1 ? { minX: 0, maxX: 1 } : { minX: n, maxX: n + r - a };
|
|
67
67
|
return e ? {
|
|
68
68
|
...o,
|
|
@@ -104,7 +104,7 @@ out vec2 v_tex_coord;
|
|
|
104
104
|
void main() {
|
|
105
105
|
v_tex_coord = a_position * 0.5 + 0.5;
|
|
106
106
|
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
107
|
-
}`,
|
|
107
|
+
}`, Ri = `#version 300 es
|
|
108
108
|
precision highp float;
|
|
109
109
|
|
|
110
110
|
uint pcg(uint v) {
|
|
@@ -374,7 +374,7 @@ void main() {
|
|
|
374
374
|
fract(newPos.y * 255.0)
|
|
375
375
|
);
|
|
376
376
|
#endif
|
|
377
|
-
}`,
|
|
377
|
+
}`, Pi = `precision highp float;
|
|
378
378
|
|
|
379
379
|
attribute float a_index;
|
|
380
380
|
attribute float a_is_curr;
|
|
@@ -606,7 +606,7 @@ void main() {
|
|
|
606
606
|
vec2 worldPos = vec2((pos.x + u_world_offset) * u_world_size, pos.y * u_world_size);
|
|
607
607
|
gl_Position = u_matrix * vec4(worldPos, 0.0, 1.0);
|
|
608
608
|
}
|
|
609
|
-
}`,
|
|
609
|
+
}`, Ei = `precision mediump float;
|
|
610
610
|
|
|
611
611
|
uniform sampler2D u_color_ramp;
|
|
612
612
|
uniform float u_particle_contrast;
|
|
@@ -645,7 +645,7 @@ void main() {
|
|
|
645
645
|
}
|
|
646
646
|
|
|
647
647
|
gl_FragColor = vec4(color.rgb, color.a * u_opacity);
|
|
648
|
-
}`,
|
|
648
|
+
}`, Li = `#version 300 es
|
|
649
649
|
precision mediump float;
|
|
650
650
|
|
|
651
651
|
uniform sampler2D u_screen;
|
|
@@ -662,7 +662,7 @@ void main() {
|
|
|
662
662
|
float alpha = floor(color.a * 255.0 * u_opacity) / 255.0;
|
|
663
663
|
|
|
664
664
|
o_color = vec4(color.rgb * step(1.0 / 255.0, alpha), alpha);
|
|
665
|
-
}`,
|
|
665
|
+
}`, Di = `#version 300 es
|
|
666
666
|
precision mediump float;
|
|
667
667
|
|
|
668
668
|
uniform sampler2D u_screen;
|
|
@@ -733,7 +733,7 @@ void main() {
|
|
|
733
733
|
}
|
|
734
734
|
vec3 rgb = u_grade_on > 0.5 ? gradeColor(color.rgb, u_grade) : color.rgb;
|
|
735
735
|
o_color = vec4(rgb, color.a);
|
|
736
|
-
}`,
|
|
736
|
+
}`, Ai = `#version 300 es
|
|
737
737
|
precision mediump float;
|
|
738
738
|
|
|
739
739
|
uniform sampler2D u_screen;
|
|
@@ -770,7 +770,7 @@ vec4 addGlow(vec4 trail, sampler2D glowTex, vec2 uv, float gain) {
|
|
|
770
770
|
|
|
771
771
|
void main() {
|
|
772
772
|
o_color = glowGather(u_screen, ivec2(gl_FragCoord.xy));
|
|
773
|
-
}`,
|
|
773
|
+
}`, Mt = `precision highp float;
|
|
774
774
|
|
|
775
775
|
attribute vec2 a_grid_uv;
|
|
776
776
|
|
|
@@ -804,7 +804,7 @@ void main() {
|
|
|
804
804
|
|
|
805
805
|
v_geo_uv = vec2((lng - u_geo_bounds.x) / width, a_grid_uv.y);
|
|
806
806
|
gl_Position = u_matrix * vec4(worldPos, 0.0, 1.0);
|
|
807
|
-
}`,
|
|
807
|
+
}`, Ci = `precision mediump float;
|
|
808
808
|
|
|
809
809
|
uniform sampler2D u_field;
|
|
810
810
|
uniform sampler2D u_color_ramp;
|
|
@@ -904,7 +904,7 @@ void main() {
|
|
|
904
904
|
vec4 color = texture2D(u_color_ramp, vec2(t, 0.5));
|
|
905
905
|
color.rgb = applyVibrance(color.rgb, u_vibrance);
|
|
906
906
|
gl_FragColor = vec4(color.rgb, color.a * u_opacity);
|
|
907
|
-
}`,
|
|
907
|
+
}`, Rt = `precision highp float;
|
|
908
908
|
|
|
909
909
|
attribute vec2 a_grid_uv;
|
|
910
910
|
|
|
@@ -954,7 +954,7 @@ void main() {
|
|
|
954
954
|
position.xyw = mix(flatPosition.xyw, position.xyw, u_projection_transition);
|
|
955
955
|
}
|
|
956
956
|
gl_Position = position;
|
|
957
|
-
}`,
|
|
957
|
+
}`, ki = `precision mediump float;
|
|
958
958
|
|
|
959
959
|
uniform sampler2D u_field;
|
|
960
960
|
uniform sampler2D u_color_ramp;
|
|
@@ -1044,7 +1044,7 @@ void main() {
|
|
|
1044
1044
|
color.rgb = applyVibrance(color.rgb, u_vibrance);
|
|
1045
1045
|
gl_FragColor = vec4(color.rgb, color.a * u_opacity);
|
|
1046
1046
|
}`;
|
|
1047
|
-
const Me = [0, 0, 0, 0], B = 512, H = B * B, Y = 128, ee = 64,
|
|
1047
|
+
const Me = [0, 0, 0, 0], B = 512, H = B * B, Y = 128, ee = 64, Fi = 1, Ii = 0.92, Ui = 0.1, je = 0.98;
|
|
1048
1048
|
function Vi(s) {
|
|
1049
1049
|
if (Number.isNaN(s))
|
|
1050
1050
|
return 32256;
|
|
@@ -1062,7 +1062,7 @@ function Vi(s) {
|
|
|
1062
1062
|
const i = Math.floor(Math.log2(t)), a = t / 2 ** i - 1;
|
|
1063
1063
|
return e | i + 15 << 10 | Math.round(a * 1024);
|
|
1064
1064
|
}
|
|
1065
|
-
const
|
|
1065
|
+
const Ni = {
|
|
1066
1066
|
particleDensity: 0.05,
|
|
1067
1067
|
speed: 1,
|
|
1068
1068
|
fadeOpacity: 0.996,
|
|
@@ -1071,26 +1071,26 @@ const Ui = {
|
|
|
1071
1071
|
opacity: 1,
|
|
1072
1072
|
logScale: !1,
|
|
1073
1073
|
vibrance: 0,
|
|
1074
|
-
colorGrade:
|
|
1075
|
-
backdrop:
|
|
1074
|
+
colorGrade: di,
|
|
1075
|
+
backdrop: ui,
|
|
1076
1076
|
glow: 0,
|
|
1077
1077
|
scalarMode: !1,
|
|
1078
1078
|
particleState: "auto",
|
|
1079
1079
|
rgba8MaxParticleZoom: 4
|
|
1080
1080
|
};
|
|
1081
|
-
class
|
|
1081
|
+
class Pt {
|
|
1082
1082
|
constructor(e) {
|
|
1083
|
-
this.numParticles = 0, this.prevBounds = null, this.redistributionBoost = 0, this.frame = Math.floor(Math.random() * 2 ** 30), this.webglInfo = null, this.lastRgba8ParticlesSuppressed = !1, this.screenWidth = 0, this.screenHeight = 0, this.glowTexture = null, this.glowFramebuffer = null, this.rasterGridIndexCount = 0, this.renderMode = "raster+particles", this.params = { ...
|
|
1083
|
+
this.numParticles = 0, this.prevBounds = null, this.redistributionBoost = 0, this.frame = Math.floor(Math.random() * 2 ** 30), this.webglInfo = null, this.lastRgba8ParticlesSuppressed = !1, this.screenWidth = 0, this.screenHeight = 0, this.glowTexture = null, this.glowFramebuffer = null, this.rasterGridIndexCount = 0, this.renderMode = "raster+particles", this.params = { ...Ni, ...e }, this.trailFade = new Xt(this.params.fadeOpacity);
|
|
1084
1084
|
}
|
|
1085
1085
|
init(e) {
|
|
1086
|
-
this.gl = e, this.webglInfo =
|
|
1086
|
+
this.gl = e, this.webglInfo = Ht(e), this.stateFormat = this.params.particleState === "rgba8" ? Yt(e) : Zt(e);
|
|
1087
1087
|
const t = this.stateFormat.kind !== "rgba8-packed" ? `#define USE_FLOAT_STATE 1
|
|
1088
1088
|
` : "";
|
|
1089
1089
|
this.updateProgram = W(
|
|
1090
1090
|
e,
|
|
1091
1091
|
de,
|
|
1092
|
-
|
|
1093
|
-
), this.drawProgram = W(e, t +
|
|
1092
|
+
Ri.replace(/^(#version[^\n]*\n)/, `$1${t}`)
|
|
1093
|
+
), this.drawProgram = W(e, t + Pi, Ei), this.fadeProgram = W(e, de, Li), this.compositeProgram = W(e, de, Di), this.glowProgram = W(e, de, Ai), this.gridProgram = W(e, Mt, Ci), this.gridGlobeProgram = W(e, Rt, ki), this.updateLocs = this.getUniforms(this.updateProgram, [
|
|
1094
1094
|
"u_particles",
|
|
1095
1095
|
...ue,
|
|
1096
1096
|
"u_velocity",
|
|
@@ -1174,7 +1174,7 @@ class Rt {
|
|
|
1174
1174
|
"u_vibrance",
|
|
1175
1175
|
"u_scalar_mode",
|
|
1176
1176
|
"u_solid"
|
|
1177
|
-
]), this.quadBuffer =
|
|
1177
|
+
]), this.quadBuffer = jt(e), this.initRasterGrid(), this.colorRampTexture = ge(e, this.params.colorRamp), this.initParticleState();
|
|
1178
1178
|
}
|
|
1179
1179
|
getUniforms(e, t) {
|
|
1180
1180
|
const i = {};
|
|
@@ -1203,7 +1203,7 @@ class Rt {
|
|
|
1203
1203
|
return i;
|
|
1204
1204
|
}
|
|
1205
1205
|
createStateTexture(e) {
|
|
1206
|
-
return
|
|
1206
|
+
return Qt(
|
|
1207
1207
|
this.gl,
|
|
1208
1208
|
this.gl.NEAREST,
|
|
1209
1209
|
e,
|
|
@@ -1277,10 +1277,10 @@ class Rt {
|
|
|
1277
1277
|
h.disable(h.BLEND), h.useProgram(this.updateProgram), h.viewport(0, 0, B, B), O(h, this.particleStateTextures[0], 0), h.uniform1i(this.updateLocs.u_particles, 0), Te(h, this.updateLocs, p), h.uniform1i(this.updateLocs.u_velocity, p.a.unit), h.uniform2f(this.updateLocs.u_velocity_min, ...p.a.min), h.uniform2f(this.updateLocs.u_velocity_max, ...p.a.max), h.uniform1f(this.updateLocs.u_speed, this.params.speed), h.uniform1f(this.updateLocs.u_world_size, n), h.uniform1ui(this.updateLocs.u_frame, this.frame), this.frame = this.frame + 1 >>> 0;
|
|
1278
1278
|
const R = r.maxX - r.minX;
|
|
1279
1279
|
if (this.prevBounds) {
|
|
1280
|
-
const F = this.prevBounds.maxX - this.prevBounds.minX, L = this.prevBounds.maxY - this.prevBounds.minY, D = 1e-6, b = (r.minX + r.maxX) * 0.5, A = (r.minY + r.maxY) * 0.5, N = (this.prevBounds.minX + this.prevBounds.maxX) * 0.5, C = (this.prevBounds.minY + this.prevBounds.maxY) * 0.5, I = Math.abs(R - F) / Math.max(F, D), w = Math.abs(b - N) / Math.max(F, D) + Math.abs(A - C) / Math.max(L, D),
|
|
1280
|
+
const F = this.prevBounds.maxX - this.prevBounds.minX, L = this.prevBounds.maxY - this.prevBounds.minY, D = 1e-6, b = (r.minX + r.maxX) * 0.5, A = (r.minY + r.maxY) * 0.5, N = (this.prevBounds.minX + this.prevBounds.maxX) * 0.5, C = (this.prevBounds.minY + this.prevBounds.maxY) * 0.5, I = Math.abs(R - F) / Math.max(F, D), w = Math.abs(b - N) / Math.max(F, D) + Math.abs(A - C) / Math.max(L, D), U = Math.min(1, I + w);
|
|
1281
1281
|
this.redistributionBoost = Math.max(
|
|
1282
|
-
this.redistributionBoost *
|
|
1283
|
-
|
|
1282
|
+
this.redistributionBoost * Ii,
|
|
1283
|
+
U * Fi
|
|
1284
1284
|
);
|
|
1285
1285
|
}
|
|
1286
1286
|
this.prevBounds = {
|
|
@@ -1291,7 +1291,7 @@ class Rt {
|
|
|
1291
1291
|
};
|
|
1292
1292
|
const k = Math.min(
|
|
1293
1293
|
this.params.dropRate + this.redistributionBoost,
|
|
1294
|
-
|
|
1294
|
+
Ui
|
|
1295
1295
|
);
|
|
1296
1296
|
h.uniform1f(this.updateLocs.u_drop_rate, k), h.uniform1f(
|
|
1297
1297
|
this.updateLocs.u_drop_rate_bump,
|
|
@@ -1381,13 +1381,13 @@ class Rt {
|
|
|
1381
1381
|
h.disableVertexAttribArray(R), h.disableVertexAttribArray(k), h.disable(h.BLEND);
|
|
1382
1382
|
}
|
|
1383
1383
|
h.bindFramebuffer(h.FRAMEBUFFER, g), h.viewport(0, 0, this.screenWidth, this.screenHeight);
|
|
1384
|
-
const _ =
|
|
1384
|
+
const _ = mi(this.params.backdrop);
|
|
1385
1385
|
_[3] > 0 && v(_);
|
|
1386
1386
|
const S = this.params.glow > 0 ? this.renderGlow(g) : null, E = this.params.colorGrade;
|
|
1387
1387
|
h.useProgram(this.compositeProgram), O(h, this.screenTextures[1], 0), h.uniform1i(this.compositeLocs.u_screen, 0), O(h, S ?? this.screenTextures[1], 1), h.uniform1i(this.compositeLocs.u_glow_tex, 1), h.uniform1f(
|
|
1388
1388
|
this.compositeLocs.u_glow,
|
|
1389
|
-
S ?
|
|
1390
|
-
), h.uniform1f(this.compositeLocs.u_grade_on, E.enabled ? 1 : 0), h.uniform4f(this.compositeLocs.u_grade, ...
|
|
1389
|
+
S ? Kt * this.params.glow : 0
|
|
1390
|
+
), h.uniform1f(this.compositeLocs.u_grade_on, E.enabled ? 1 : 0), h.uniform4f(this.compositeLocs.u_grade, ...fi(E)), h.enable(h.BLEND), h.blendFunc(h.SRC_ALPHA, h.ONE_MINUS_SRC_ALPHA), this.drawQuad(), h.disable(h.BLEND), y && (this.particleStateTextures.reverse(), this.particleFramebuffers.reverse()), this.screenTextures.reverse(), this.screenFramebuffers.reverse();
|
|
1391
1391
|
}
|
|
1392
1392
|
/**
|
|
1393
1393
|
* Reduce the latest trails into the glow texture (glow.glsl), then rebind
|
|
@@ -1430,9 +1430,9 @@ class Rt {
|
|
|
1430
1430
|
);
|
|
1431
1431
|
this.unbindRasterGrid(this.gridProgram), u.disable(u.BLEND);
|
|
1432
1432
|
}
|
|
1433
|
-
renderGridGlobe(e, t, i, a, r, n, o = 1, l = Me, d, c =
|
|
1433
|
+
renderGridGlobe(e, t, i, a, r, n, o = 1, l = Me, d, c = Jt) {
|
|
1434
1434
|
const u = this.gl;
|
|
1435
|
-
u.useProgram(this.gridGlobeProgram),
|
|
1435
|
+
u.useProgram(this.gridGlobeProgram), yt(u, this.gridGlobeLocs, c), u.disable(u.DEPTH_TEST), u.disable(u.STENCIL_TEST), u.disable(u.BLEND), this.setGridFieldUniforms(
|
|
1436
1436
|
this.gridGlobeLocs,
|
|
1437
1437
|
e,
|
|
1438
1438
|
t,
|
|
@@ -1535,11 +1535,11 @@ class Rt {
|
|
|
1535
1535
|
}
|
|
1536
1536
|
/** Partial values take the vibrant preset; see resolveColorGrade. */
|
|
1537
1537
|
setColorGrade(e) {
|
|
1538
|
-
this.params.colorGrade =
|
|
1538
|
+
this.params.colorGrade = St(e);
|
|
1539
1539
|
}
|
|
1540
1540
|
/** Missing values take the defaults; see resolveBackdrop. */
|
|
1541
1541
|
setBackdrop(e) {
|
|
1542
|
-
this.params.backdrop =
|
|
1542
|
+
this.params.backdrop = wt(e);
|
|
1543
1543
|
}
|
|
1544
1544
|
/** Halo strength, clamped to [0, 1]; 0 frees the glow texture. */
|
|
1545
1545
|
setGlow(e) {
|
|
@@ -1624,7 +1624,7 @@ class Rt {
|
|
|
1624
1624
|
e.deleteBuffer(this.quadBuffer), e.deleteBuffer(this.particleIndexBuffer), e.deleteBuffer(this.particleIsCurrBuffer), e.deleteTexture(this.colorRampTexture);
|
|
1625
1625
|
}
|
|
1626
1626
|
}
|
|
1627
|
-
class
|
|
1627
|
+
class Et {
|
|
1628
1628
|
constructor() {
|
|
1629
1629
|
this.gl = null, this.texture = null, this.width = 0, this.height = 0, this.uMin = 0, this.uMax = 0, this.vMin = 0, this.vMax = 0, this.geoBounds = { west: -180, south: -90, east: 180, north: 90 }, this.scalarMode = !1, this.linearFilter = !0;
|
|
1630
1630
|
}
|
|
@@ -1702,7 +1702,7 @@ class Pt {
|
|
|
1702
1702
|
this.gl && this.texture && (this.gl.deleteTexture(this.texture), this.texture = null);
|
|
1703
1703
|
}
|
|
1704
1704
|
}
|
|
1705
|
-
function
|
|
1705
|
+
function Lt(s, e, t, i, a, r, n) {
|
|
1706
1706
|
const o = new Float32Array(t * i).fill(NaN), l = new Float32Array(t * i).fill(NaN);
|
|
1707
1707
|
for (const m of s)
|
|
1708
1708
|
for (let p = 0; p < m.latSize; p++)
|
|
@@ -1733,6 +1733,13 @@ function Et(s, e, t, i, a, r, n) {
|
|
|
1733
1733
|
scalarMode: n
|
|
1734
1734
|
};
|
|
1735
1735
|
}
|
|
1736
|
+
function zi(s, e, t, i) {
|
|
1737
|
+
const a = s.indexOf("time");
|
|
1738
|
+
if (a < 0 || !e[a] || !t[a])
|
|
1739
|
+
return "";
|
|
1740
|
+
const r = Math.floor((e[a] - 1) / t[a]);
|
|
1741
|
+
return i[a] === r ? `t=${e[a]}` : "";
|
|
1742
|
+
}
|
|
1736
1743
|
const Re = [
|
|
1737
1744
|
"depth",
|
|
1738
1745
|
"elevation",
|
|
@@ -1746,8 +1753,25 @@ class Qe extends Error {
|
|
|
1746
1753
|
}
|
|
1747
1754
|
}
|
|
1748
1755
|
class _e {
|
|
1749
|
-
|
|
1750
|
-
|
|
1756
|
+
/**
|
|
1757
|
+
* `options.chunkStore` keeps the compressed chunks across sessions (see
|
|
1758
|
+
* chunkStore.ts); without it, chunks are only kept in memory.
|
|
1759
|
+
*/
|
|
1760
|
+
constructor(e, t = 200, i = {}) {
|
|
1761
|
+
this.meta = null, this.coords = null, this.initPromise = null, this.verticalName = "depth", this.timeUnits = "", this.timeCalendar = "standard", this.cache = /* @__PURE__ */ new Map(), this.abortControllers = /* @__PURE__ */ new Map(), this.bloscCodecCache = /* @__PURE__ */ new Map(), this.root = e.replace(/\/$/, ""), this.maxCacheSize = t, this.chunkStore = i.chunkStore;
|
|
1762
|
+
}
|
|
1763
|
+
/** The URL of a chunk, as fetched and as stored. */
|
|
1764
|
+
chunkUrl(e, t) {
|
|
1765
|
+
return `${this.root}/${e}/${t.join(this.getDimensionSeparator(e))}`;
|
|
1766
|
+
}
|
|
1767
|
+
/** The revision a stored chunk must carry to be current (see chunkRevision). */
|
|
1768
|
+
chunkRevision(e, t) {
|
|
1769
|
+
return zi(
|
|
1770
|
+
this.getDimensions(e),
|
|
1771
|
+
this.getShape(e),
|
|
1772
|
+
this.getChunkShape(e),
|
|
1773
|
+
t
|
|
1774
|
+
);
|
|
1751
1775
|
}
|
|
1752
1776
|
async init() {
|
|
1753
1777
|
if (!this.coords) {
|
|
@@ -1797,7 +1821,7 @@ class _e {
|
|
|
1797
1821
|
let a = t ? i[0] : NaN, r = a;
|
|
1798
1822
|
for (let o = 1; o < i.length; o++)
|
|
1799
1823
|
a = Math.min(a, i[o]), r = Math.max(r, i[o]);
|
|
1800
|
-
const n =
|
|
1824
|
+
const n = $i(i);
|
|
1801
1825
|
return {
|
|
1802
1826
|
min: a,
|
|
1803
1827
|
max: r,
|
|
@@ -1869,7 +1893,7 @@ class _e {
|
|
|
1869
1893
|
throw new Error(
|
|
1870
1894
|
`Unsupported Zarr time units: ${this.timeUnits || "<missing>"}`
|
|
1871
1895
|
);
|
|
1872
|
-
const i =
|
|
1896
|
+
const i = Oi(t[2]);
|
|
1873
1897
|
if (!Number.isFinite(i))
|
|
1874
1898
|
throw new Error(`Invalid Zarr time epoch: ${t[2]}`);
|
|
1875
1899
|
const a = t[1].toLowerCase(), r = a.startsWith("ms") || a.startsWith("milli") ? 1 : a.startsWith("s") ? 1e3 : a.startsWith("min") ? 6e4 : a.startsWith("h") ? 36e5 : 864e5;
|
|
@@ -2076,23 +2100,32 @@ class _e {
|
|
|
2076
2100
|
this.abortControllers.get(r)?.abort();
|
|
2077
2101
|
const o = new AbortController();
|
|
2078
2102
|
this.abortControllers.set(r, o);
|
|
2079
|
-
const l = this.getArrayMeta(e);
|
|
2103
|
+
const l = this.getArrayMeta(e), d = this.chunkStore ? this.chunkRevision(e, t) : "";
|
|
2080
2104
|
try {
|
|
2081
|
-
const
|
|
2082
|
-
if (
|
|
2083
|
-
|
|
2105
|
+
const c = await this.chunkStore?.get(n, d);
|
|
2106
|
+
if (c) {
|
|
2107
|
+
const p = Ke(
|
|
2108
|
+
await this.decompress(c, l, e)
|
|
2109
|
+
);
|
|
2110
|
+
return this.cacheChunk(r, p), { data: p, missing: !1, url: n };
|
|
2111
|
+
}
|
|
2112
|
+
const u = await fetch(n, { signal: o.signal });
|
|
2113
|
+
if (!u.ok) {
|
|
2114
|
+
if (u.status === 403 || u.status === 404)
|
|
2084
2115
|
return {
|
|
2085
|
-
data:
|
|
2116
|
+
data: Gi(l),
|
|
2086
2117
|
missing: !0,
|
|
2087
|
-
status:
|
|
2118
|
+
status: u.status,
|
|
2088
2119
|
url: n
|
|
2089
2120
|
};
|
|
2090
|
-
throw new Qe(
|
|
2121
|
+
throw new Qe(u.status, n);
|
|
2091
2122
|
}
|
|
2092
|
-
const
|
|
2093
|
-
|
|
2123
|
+
const f = new Uint8Array(await u.arrayBuffer());
|
|
2124
|
+
this.chunkStore?.put(n, f, d);
|
|
2125
|
+
const m = Ke(
|
|
2126
|
+
await this.decompress(f, l, e)
|
|
2094
2127
|
);
|
|
2095
|
-
return this.cacheChunk(r,
|
|
2128
|
+
return this.cacheChunk(r, m), { data: m, missing: !1, url: n };
|
|
2096
2129
|
} finally {
|
|
2097
2130
|
this.abortControllers.get(r) === o && this.abortControllers.delete(r);
|
|
2098
2131
|
}
|
|
@@ -2112,7 +2145,7 @@ class _e {
|
|
|
2112
2145
|
getBloscCodec(e) {
|
|
2113
2146
|
const t = e.compressor, i = `${t.cname ?? "lz4"}-${t.clevel ?? 5}-${t.shuffle ?? 1}-${t.blocksize ?? 0}`;
|
|
2114
2147
|
let a = this.bloscCodecCache.get(i);
|
|
2115
|
-
return a || (a =
|
|
2148
|
+
return a || (a = yi.fromConfig({
|
|
2116
2149
|
id: "blosc",
|
|
2117
2150
|
cname: t.cname ?? "lz4",
|
|
2118
2151
|
clevel: t.clevel ?? 5,
|
|
@@ -2126,7 +2159,7 @@ class _e {
|
|
|
2126
2159
|
switch (t.compressor.id) {
|
|
2127
2160
|
case "zlib":
|
|
2128
2161
|
case "gzip":
|
|
2129
|
-
a =
|
|
2162
|
+
a = vi(e);
|
|
2130
2163
|
break;
|
|
2131
2164
|
case "blosc": {
|
|
2132
2165
|
a = await this.getBloscCodec(t).decode(e);
|
|
@@ -2236,14 +2269,14 @@ class _e {
|
|
|
2236
2269
|
};
|
|
2237
2270
|
}
|
|
2238
2271
|
}
|
|
2239
|
-
function
|
|
2272
|
+
function Ke(s) {
|
|
2240
2273
|
return s instanceof Float32Array ? s : Float32Array.from(s);
|
|
2241
2274
|
}
|
|
2242
|
-
function
|
|
2275
|
+
function Gi(s) {
|
|
2243
2276
|
const e = s.chunks.reduce((i, a) => i * a, 1), t = new Float32Array(e);
|
|
2244
2277
|
return t.fill(NaN), t;
|
|
2245
2278
|
}
|
|
2246
|
-
function
|
|
2279
|
+
function Oi(s) {
|
|
2247
2280
|
const t = s.trim().replace(/\s+\([^)]*\)\s*$/, "").match(
|
|
2248
2281
|
/^(\d{4})-(\d{2})-(\d{2})(?:(?:T|\s+)(\d{2})(?::(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?)?)?(?:\s*(Z|[+-]\d{2}:?\d{2}))?$/i
|
|
2249
2282
|
);
|
|
@@ -2268,7 +2301,7 @@ function Gi(s) {
|
|
|
2268
2301
|
const g = (p * 60 + h) * 6e4;
|
|
2269
2302
|
return f - (m[1] === "+" ? g : -g);
|
|
2270
2303
|
}
|
|
2271
|
-
function
|
|
2304
|
+
function Bi(s) {
|
|
2272
2305
|
if (typeof s != "number" || !Number.isFinite(s) || s <= 0)
|
|
2273
2306
|
return s;
|
|
2274
2307
|
const e = [
|
|
@@ -2290,7 +2323,7 @@ function Oi(s) {
|
|
|
2290
2323
|
return t;
|
|
2291
2324
|
return Math.round(s);
|
|
2292
2325
|
}
|
|
2293
|
-
function
|
|
2326
|
+
function $i(s) {
|
|
2294
2327
|
if (s.length < 2)
|
|
2295
2328
|
return;
|
|
2296
2329
|
const e = s[1] - s[0];
|
|
@@ -2300,7 +2333,7 @@ function Bi(s) {
|
|
|
2300
2333
|
for (let i = 2; i < s.length; i++)
|
|
2301
2334
|
if (Math.abs(s[i] - s[i - 1] - e) > t)
|
|
2302
2335
|
return;
|
|
2303
|
-
return
|
|
2336
|
+
return Bi(e);
|
|
2304
2337
|
}
|
|
2305
2338
|
class xe extends Error {
|
|
2306
2339
|
constructor(e, t, i) {
|
|
@@ -2309,19 +2342,19 @@ class xe extends Error {
|
|
|
2309
2342
|
), this.name = "ZartiglFrameUnavailableError", this.time = e, this.statuses = [...new Set(t)].sort((a, r) => a - r), this.urls = [...new Set(i)];
|
|
2310
2343
|
}
|
|
2311
2344
|
}
|
|
2312
|
-
function
|
|
2345
|
+
function qi(s) {
|
|
2313
2346
|
for (const e of s)
|
|
2314
2347
|
if (Number.isFinite(e))
|
|
2315
2348
|
return !0;
|
|
2316
2349
|
return !1;
|
|
2317
2350
|
}
|
|
2318
|
-
function
|
|
2351
|
+
function Wi(s, e) {
|
|
2319
2352
|
for (let t = 0; t < Math.min(s.length, e.length); t++)
|
|
2320
2353
|
if (Number.isFinite(s[t]) && Number.isFinite(e[t]))
|
|
2321
2354
|
return !0;
|
|
2322
2355
|
return !1;
|
|
2323
2356
|
}
|
|
2324
|
-
function
|
|
2357
|
+
function Dt(s) {
|
|
2325
2358
|
return {
|
|
2326
2359
|
phase: "blocked",
|
|
2327
2360
|
time: s.time,
|
|
@@ -2331,7 +2364,7 @@ function Lt(s) {
|
|
|
2331
2364
|
}
|
|
2332
2365
|
class me {
|
|
2333
2366
|
constructor(e) {
|
|
2334
|
-
this.type = "custom", this.renderingMode = "3d", this.map = null, this.gl = null, this.activeData = null, this.initialized = !1, this.suspended = !1, this.loading = !1, this.reloadQueued = !1, this.generation = 0, this.requestId = 0, this.pendingReadyTime = null, this.frameCache = /* @__PURE__ */ new Map(), this.inflight = /* @__PURE__ */ new Set(), this.listeners = /* @__PURE__ */ new Map(), this.textureUnit = 1, this.moveEndHandler = null, this.id = e.id, this.variable = e.variable, this.time = e.time ?? 0, this.depth = e.depth ?? 0, this.unit = e.unit ?? "", this.colorDomain = Q(e.colorDomain ?? null), this.zarrSource = e.zarrSource ?? new _e(e.source), this.activeField = new
|
|
2367
|
+
this.type = "custom", this.renderingMode = "3d", this.map = null, this.gl = null, this.activeData = null, this.initialized = !1, this.suspended = !1, this.loading = !1, this.reloadQueued = !1, this.generation = 0, this.requestId = 0, this.pendingReadyTime = null, this.frameCache = /* @__PURE__ */ new Map(), this.inflight = /* @__PURE__ */ new Set(), this.listeners = /* @__PURE__ */ new Map(), this.textureUnit = 1, this.moveEndHandler = null, this.id = e.id, this.variable = e.variable, this.time = e.time ?? 0, this.depth = e.depth ?? 0, this.unit = e.unit ?? "", this.colorDomain = Q(e.colorDomain ?? null), this.zarrSource = e.zarrSource ?? new _e(e.source), this.activeField = new Et(), this.simulation = new Pt({
|
|
2335
2368
|
colorRamp: e.colorRamp,
|
|
2336
2369
|
opacity: e.opacity ?? 1,
|
|
2337
2370
|
logScale: e.logScale ?? !1,
|
|
@@ -2523,7 +2556,7 @@ class me {
|
|
|
2523
2556
|
const n = r instanceof Error ? r : new Error(String(r));
|
|
2524
2557
|
e === this.generation && t === this.requestId && (this.emit(
|
|
2525
2558
|
"status",
|
|
2526
|
-
n instanceof xe ?
|
|
2559
|
+
n instanceof xe ? Dt(n) : { phase: "error", time: a, error: n }
|
|
2527
2560
|
), this.emit("error", n));
|
|
2528
2561
|
}
|
|
2529
2562
|
} finally {
|
|
@@ -2569,12 +2602,12 @@ class me {
|
|
|
2569
2602
|
...b,
|
|
2570
2603
|
latStart: b.latStart - x,
|
|
2571
2604
|
lonStart: b.lonStart - M
|
|
2572
|
-
})), E = this.zarrSource.getCoords(), R = Math.min(T - 1, E.latitude.length - 1), k = Math.min(y - 1, E.longitude.length - 1), F =
|
|
2605
|
+
})), E = this.zarrSource.getCoords(), R = Math.min(T - 1, E.latitude.length - 1), k = Math.min(y - 1, E.longitude.length - 1), F = Tt(
|
|
2573
2606
|
E.longitude,
|
|
2574
2607
|
E.latitude,
|
|
2575
2608
|
[M, k],
|
|
2576
2609
|
[x, R]
|
|
2577
|
-
), L = E.latitude[x] > E.latitude[R], D =
|
|
2610
|
+
), L = E.latitude[x] > E.latitude[R], D = Lt(
|
|
2578
2611
|
S,
|
|
2579
2612
|
[],
|
|
2580
2613
|
v,
|
|
@@ -2583,7 +2616,7 @@ class me {
|
|
|
2583
2616
|
L,
|
|
2584
2617
|
!0
|
|
2585
2618
|
);
|
|
2586
|
-
if (
|
|
2619
|
+
if (!qi(D.u))
|
|
2587
2620
|
throw new xe(
|
|
2588
2621
|
this.timeToMs(e),
|
|
2589
2622
|
p,
|
|
@@ -2652,7 +2685,7 @@ class me {
|
|
|
2652
2685
|
a(...t);
|
|
2653
2686
|
}
|
|
2654
2687
|
}
|
|
2655
|
-
function
|
|
2688
|
+
function Xi(s, e, t) {
|
|
2656
2689
|
if (!Number.isFinite(s) || !Number.isFinite(e))
|
|
2657
2690
|
return { u: NaN, v: NaN };
|
|
2658
2691
|
const i = t.direction_convention !== t.output_direction ? 180 : 0, a = (s + i) * Math.PI / 180;
|
|
@@ -2661,15 +2694,15 @@ function Wi(s, e, t) {
|
|
|
2661
2694
|
v: e * Math.cos(a)
|
|
2662
2695
|
};
|
|
2663
2696
|
}
|
|
2664
|
-
function
|
|
2697
|
+
function Aa(s) {
|
|
2665
2698
|
return [s.direction_variable, s.magnitude_variable];
|
|
2666
2699
|
}
|
|
2667
|
-
const
|
|
2700
|
+
const Hi = 0.7;
|
|
2668
2701
|
class P {
|
|
2669
2702
|
constructor(e) {
|
|
2670
2703
|
if (this.type = "custom", this.renderingMode = "3d", this.map = null, this.gl = null, this.initialized = !1, this.suspended = !1, this.loading = !1, this.reloadQueued = !1, this.reloadQueuedResetParticles = !1, this.globeRendering = null, this.generation = 0, this.requestId = 0, this.pendingReadyTime = null, this.velocityTexUnit = 1, this.moveStartHandler = null, this.moveHandler = null, this.moveEndHandler = null, this.frameCache = /* @__PURE__ */ new Map(), this.inflight = /* @__PURE__ */ new Set(), this.listeners = /* @__PURE__ */ new Map(), this.id = e.id, this.geoVideoManifest = e.geoVideo?.manifest, this.geoVideoManifest && this.geoVideoManifest.encoding.kind !== "vector-luma")
|
|
2671
2704
|
throw new Error("Vector GeoVideo requires a vector-luma manifest");
|
|
2672
|
-
this.playback = e.geoVideo ? new
|
|
2705
|
+
this.playback = e.geoVideo ? new _t(
|
|
2673
2706
|
{ ...e.geoVideo, time: e.time },
|
|
2674
2707
|
() => this.map?.triggerRepaint(),
|
|
2675
2708
|
(t, ...i) => {
|
|
@@ -2687,16 +2720,16 @@ class P {
|
|
|
2687
2720
|
}
|
|
2688
2721
|
t === "timeChange" && (this.time = i[0]), this.emit(t, ...i);
|
|
2689
2722
|
}
|
|
2690
|
-
) : null, this.variableU = e.variableU ?? "uo", this.variableV = e.variableV ?? "vo", this.vectorDerivation = e.vectorDerivation, this.unit = e.unit ?? "m/s", this.time = e.time ?? 0, this.depth = e.depth ?? 0, this.zarrSourceValue = this.playback ? null : e.zarrSource ?? new _e(e.source), this.velocityField = new
|
|
2723
|
+
) : null, this.variableU = e.variableU ?? "uo", this.variableV = e.variableV ?? "vo", this.vectorDerivation = e.vectorDerivation, this.unit = e.unit ?? "m/s", this.time = e.time ?? 0, this.depth = e.depth ?? 0, this.zarrSourceValue = this.playback ? null : e.zarrSource ?? new _e(e.source), this.velocityField = new Et(), this.simulation = new Pt({
|
|
2691
2724
|
particleDensity: e.particleDensity ?? 0.05,
|
|
2692
2725
|
speed: e.speed ?? 1,
|
|
2693
|
-
fadeOpacity: Xe(e.fade ??
|
|
2726
|
+
fadeOpacity: Xe(e.fade ?? Hi),
|
|
2694
2727
|
colorRamp: e.colorRamp,
|
|
2695
2728
|
opacity: e.opacity ?? 1,
|
|
2696
2729
|
logScale: e.logScale ?? !1,
|
|
2697
2730
|
vibrance: e.vibrance ?? 0,
|
|
2698
|
-
colorGrade:
|
|
2699
|
-
backdrop:
|
|
2731
|
+
colorGrade: St(e.colorGrade),
|
|
2732
|
+
backdrop: wt(e.backdrop),
|
|
2700
2733
|
glow: e.glow ?? 0,
|
|
2701
2734
|
particleState: e.particleState ?? "auto",
|
|
2702
2735
|
rgba8MaxParticleZoom: e.rgba8MaxParticleZoom ?? 4
|
|
@@ -2744,9 +2777,9 @@ class P {
|
|
|
2744
2777
|
};
|
|
2745
2778
|
}
|
|
2746
2779
|
isViewportCovered() {
|
|
2747
|
-
return !this.map || !this.velocityField.hasData() ? !1 :
|
|
2780
|
+
return !this.map || !this.velocityField.hasData() ? !1 : Ti(
|
|
2748
2781
|
this.velocityField.geoBounds,
|
|
2749
|
-
|
|
2782
|
+
Si(this.map.getBounds())
|
|
2750
2783
|
);
|
|
2751
2784
|
}
|
|
2752
2785
|
reloadIfViewportUncovered() {
|
|
@@ -2763,7 +2796,7 @@ class P {
|
|
|
2763
2796
|
* The map's current viewport is used to determine the lat bounds of the request.
|
|
2764
2797
|
*/
|
|
2765
2798
|
async fetchVelocityData(e, t) {
|
|
2766
|
-
const i = this.map.getBounds(), a = this.globeRendering ?? ye(this.map), r =
|
|
2799
|
+
const i = this.map.getBounds(), a = this.globeRendering ?? ye(this.map), r = wi(i, 1, a), n = this.zarrSource.findTimeIndex(e), o = this.zarrSource.findDepthIndex(this.depth);
|
|
2767
2800
|
console.log(
|
|
2768
2801
|
`[zartigl] Loading velocity: depth=${this.depth} → depthIdx=${o}, actual depth value=${this.zarrSource.getCoords().vertical[o]}, timeIdx=${n}`
|
|
2769
2802
|
);
|
|
@@ -2776,24 +2809,24 @@ class P {
|
|
|
2776
2809
|
let m = 0;
|
|
2777
2810
|
const p = d.length * 2, h = [], g = [];
|
|
2778
2811
|
t?.(m, p);
|
|
2779
|
-
const x = (w) => d.map(async (
|
|
2812
|
+
const x = (w) => d.map(async (U) => {
|
|
2780
2813
|
const X = await this.zarrSource.fetchSpatialChunkResult(w, {
|
|
2781
|
-
timeIndex:
|
|
2782
|
-
verticalIndex:
|
|
2783
|
-
latitudeChunkIndex:
|
|
2784
|
-
longitudeChunkIndex:
|
|
2814
|
+
timeIndex: U.timeIdx,
|
|
2815
|
+
verticalIndex: U.depthIdx,
|
|
2816
|
+
latitudeChunkIndex: U.latIdx,
|
|
2817
|
+
longitudeChunkIndex: U.lonIdx
|
|
2785
2818
|
});
|
|
2786
2819
|
X.missing && (X.status != null && h.push(X.status), g.push(X.url)), m++, t?.(m, p);
|
|
2787
2820
|
const oe = this.zarrSource.getChunkShape(w), le = oe[f];
|
|
2788
2821
|
return {
|
|
2789
2822
|
data: X.data,
|
|
2790
|
-
latStart:
|
|
2791
|
-
lonStart:
|
|
2792
|
-
latSize:
|
|
2793
|
-
lonSize:
|
|
2823
|
+
latStart: U.latIdx * oe[u],
|
|
2824
|
+
lonStart: U.lonIdx * le,
|
|
2825
|
+
latSize: U.latSize,
|
|
2826
|
+
lonSize: U.lonSize,
|
|
2794
2827
|
lonChunkSize: le
|
|
2795
2828
|
};
|
|
2796
|
-
}), [T, M] = this.vectorDerivation ?
|
|
2829
|
+
}), [T, M] = this.vectorDerivation ? Yi(
|
|
2797
2830
|
await Promise.all(
|
|
2798
2831
|
x(this.vectorDerivation.direction_variable)
|
|
2799
2832
|
),
|
|
@@ -2812,12 +2845,12 @@ class P {
|
|
|
2812
2845
|
...w,
|
|
2813
2846
|
latStart: w.latStart - y,
|
|
2814
2847
|
lonStart: w.lonStart - _
|
|
2815
|
-
})), L = this.zarrSource.getCoords(), D = Math.min(v - 1, L.latitude.length - 1), b = Math.min(S - 1, L.longitude.length - 1), A =
|
|
2848
|
+
})), L = this.zarrSource.getCoords(), D = Math.min(v - 1, L.latitude.length - 1), b = Math.min(S - 1, L.longitude.length - 1), A = Tt(
|
|
2816
2849
|
L.longitude,
|
|
2817
2850
|
L.latitude,
|
|
2818
2851
|
[_, b],
|
|
2819
2852
|
[y, D]
|
|
2820
|
-
), N = L.latitude[y] > L.latitude[D], C =
|
|
2853
|
+
), N = L.latitude[y] > L.latitude[D], C = Lt(
|
|
2821
2854
|
k,
|
|
2822
2855
|
F,
|
|
2823
2856
|
E,
|
|
@@ -2825,7 +2858,7 @@ class P {
|
|
|
2825
2858
|
A,
|
|
2826
2859
|
N
|
|
2827
2860
|
), I = this.zarrSource.getValueDomain?.();
|
|
2828
|
-
if (I != null && I > 0 && (C.uMin = -I, C.uMax = I, C.vMin = -I, C.vMax = I), !
|
|
2861
|
+
if (I != null && I > 0 && (C.uMin = -I, C.uMax = I, C.vMin = -I, C.vMax = I), !Wi(C.u, C.v))
|
|
2829
2862
|
throw new xe(
|
|
2830
2863
|
this.timeToMs(e),
|
|
2831
2864
|
h,
|
|
@@ -2873,7 +2906,7 @@ class P {
|
|
|
2873
2906
|
const o = n instanceof Error ? n : new Error(String(n));
|
|
2874
2907
|
console.error("[zartigl] Failed to load velocity:", o), t === this.generation && i === this.requestId && (this.emit(
|
|
2875
2908
|
"status",
|
|
2876
|
-
o instanceof xe ?
|
|
2909
|
+
o instanceof xe ? Dt(o) : { phase: "error", time: r, error: o }
|
|
2877
2910
|
), this.emit("error", o));
|
|
2878
2911
|
}
|
|
2879
2912
|
} finally {
|
|
@@ -2925,7 +2958,7 @@ class P {
|
|
|
2925
2958
|
this.simulation.resetParticles();
|
|
2926
2959
|
}
|
|
2927
2960
|
this.globeRendering = h;
|
|
2928
|
-
const g = this.map.getBounds(), x =
|
|
2961
|
+
const g = this.map.getBounds(), x = Mi(g, h), T = Be(g, h);
|
|
2929
2962
|
i.disable(i.DEPTH_TEST), i.disable(i.STENCIL_TEST);
|
|
2930
2963
|
const M = 512 * Math.pow(2, this.map.getZoom()), y = this.map.getCenter();
|
|
2931
2964
|
this.simulation.render(
|
|
@@ -2938,7 +2971,7 @@ class P {
|
|
|
2938
2971
|
T,
|
|
2939
2972
|
c,
|
|
2940
2973
|
h,
|
|
2941
|
-
|
|
2974
|
+
bi(y.lng, y.lat),
|
|
2942
2975
|
t.defaultProjectionData.clippingPlane,
|
|
2943
2976
|
...u ? [u] : []
|
|
2944
2977
|
);
|
|
@@ -3126,12 +3159,12 @@ class P {
|
|
|
3126
3159
|
a(...t);
|
|
3127
3160
|
}
|
|
3128
3161
|
}
|
|
3129
|
-
function
|
|
3162
|
+
function Yi(s, e, t) {
|
|
3130
3163
|
const i = [], a = [];
|
|
3131
3164
|
for (let r = 0; r < s.length; r++) {
|
|
3132
3165
|
const n = s[r], o = e[r], l = new Float32Array(n.data.length), d = new Float32Array(n.data.length);
|
|
3133
3166
|
for (let c = 0; c < n.data.length; c++) {
|
|
3134
|
-
const u =
|
|
3167
|
+
const u = Xi(
|
|
3135
3168
|
n.data[c],
|
|
3136
3169
|
o.data[c],
|
|
3137
3170
|
t
|
|
@@ -3142,7 +3175,7 @@ function Hi(s, e, t) {
|
|
|
3142
3175
|
}
|
|
3143
3176
|
return [i, a];
|
|
3144
3177
|
}
|
|
3145
|
-
var
|
|
3178
|
+
var Je = `precision mediump float;
|
|
3146
3179
|
|
|
3147
3180
|
uniform sampler2D u_color;
|
|
3148
3181
|
uniform sampler2D u_color_next;
|
|
@@ -3202,7 +3235,7 @@ void main() {
|
|
|
3202
3235
|
const Z = 128, te = 64;
|
|
3203
3236
|
class G {
|
|
3204
3237
|
constructor(e) {
|
|
3205
|
-
this.type = "custom", this.renderingMode = "3d", this.map = null, this.gl = null, this.manifest = null, this.colorRampTexture = null, this.mercatorProgram = null, this.globeProgram = null, this.vertexBuffer = null, this.indexBuffer = null, this.indexCount = 0, this.abortController = null, this.listeners = /* @__PURE__ */ new Map(), this.id = e.id, this.source = e.manifest, this.opacity = e.opacity ?? 1, this.playback = new
|
|
3238
|
+
this.type = "custom", this.renderingMode = "3d", this.map = null, this.gl = null, this.manifest = null, this.colorRampTexture = null, this.mercatorProgram = null, this.globeProgram = null, this.vertexBuffer = null, this.indexBuffer = null, this.indexCount = 0, this.abortController = null, this.listeners = /* @__PURE__ */ new Map(), this.id = e.id, this.source = e.manifest, this.opacity = e.opacity ?? 1, this.playback = new _t(
|
|
3206
3239
|
e,
|
|
3207
3240
|
() => this.map?.triggerRepaint(),
|
|
3208
3241
|
(t, ...i) => this.emit(t, ...i)
|
|
@@ -3256,7 +3289,7 @@ class G {
|
|
|
3256
3289
|
i.getUniformLocation(c, "u_mask_threshold"),
|
|
3257
3290
|
n.mask.threshold
|
|
3258
3291
|
);
|
|
3259
|
-
const { codeRange: u, valueRange: f, transfer: m } =
|
|
3292
|
+
const { codeRange: u, valueRange: f, transfer: m } = ei(
|
|
3260
3293
|
n.encoding
|
|
3261
3294
|
);
|
|
3262
3295
|
i.uniform1f(
|
|
@@ -3291,7 +3324,7 @@ class G {
|
|
|
3291
3324
|
i.uniform4f(
|
|
3292
3325
|
i.getUniformLocation(c, "u_clipping_plane"),
|
|
3293
3326
|
...y
|
|
3294
|
-
),
|
|
3327
|
+
), yt(
|
|
3295
3328
|
i,
|
|
3296
3329
|
{
|
|
3297
3330
|
u_projection_transition: i.getUniformLocation(
|
|
@@ -3400,7 +3433,7 @@ class G {
|
|
|
3400
3433
|
id: this.id,
|
|
3401
3434
|
initialized: !!e?.currentPair,
|
|
3402
3435
|
playing: this.playback.isPlaying(),
|
|
3403
|
-
currentTime: e ? e.manifest.timeline.kind === "snapshot-loop" ? (this.playback.time - e.times[0]) / 1e3 :
|
|
3436
|
+
currentTime: e ? e.manifest.timeline.kind === "snapshot-loop" ? (this.playback.time - e.times[0]) / 1e3 : ti(e.manifest, this.playback.time) : 0,
|
|
3404
3437
|
manifestId: this.manifest?.id,
|
|
3405
3438
|
mediaUrl: this.manifest?.media.url,
|
|
3406
3439
|
preloadedMediaUrl: this.playback.preloadedMediaUrl,
|
|
@@ -3424,7 +3457,7 @@ class G {
|
|
|
3424
3457
|
return this.listeners.get(e)?.delete(t), this;
|
|
3425
3458
|
}
|
|
3426
3459
|
initGl(e) {
|
|
3427
|
-
this.mercatorProgram = W(e,
|
|
3460
|
+
this.mercatorProgram = W(e, Mt, Je), this.globeProgram = W(e, Rt, Je), this.colorRampTexture = ge(
|
|
3428
3461
|
e,
|
|
3429
3462
|
ke(this.colorRamp)
|
|
3430
3463
|
);
|
|
@@ -3465,22 +3498,22 @@ function $e(s) {
|
|
|
3465
3498
|
function j(s) {
|
|
3466
3499
|
return encodeURIComponent(String(s));
|
|
3467
3500
|
}
|
|
3468
|
-
function
|
|
3501
|
+
function At(s, e) {
|
|
3469
3502
|
return e === "depth" ? -Math.abs(s) : s;
|
|
3470
3503
|
}
|
|
3471
|
-
function
|
|
3504
|
+
function Zi(s) {
|
|
3472
3505
|
let e = s.template.replace(/\{TileMatrix\}/gi, "{z}").replace(/\{TileRow\}/gi, "{y}").replace(/\{TileCol\}/gi, "{x}");
|
|
3473
3506
|
return s.tileMatrixSet != null && (e = e.replace(
|
|
3474
3507
|
/\{TileMatrixSet\}/gi,
|
|
3475
3508
|
j(s.tileMatrixSet)
|
|
3476
3509
|
)), s.style != null && (e = e.replace(/\{Style\}/gi, j(s.style))), s.time != null && (e = e.replace(/\{time\}/gi, j($e(s.time)))), s.depth != null && (e = e.replace(
|
|
3477
3510
|
/\{elevation\}/gi,
|
|
3478
|
-
j(
|
|
3511
|
+
j(At(s.depth, s.verticalLabel))
|
|
3479
3512
|
)), [...e.matchAll(/\{([^{}]+)\}/g)].some(
|
|
3480
3513
|
(t) => !/^(?:z|y|x)$/i.test(t[1])
|
|
3481
3514
|
) ? void 0 : e;
|
|
3482
3515
|
}
|
|
3483
|
-
function
|
|
3516
|
+
function et(s) {
|
|
3484
3517
|
const e = [
|
|
3485
3518
|
["SERVICE", "WMTS"],
|
|
3486
3519
|
["VERSION", "1.0.0"],
|
|
@@ -3494,14 +3527,14 @@ function Je(s) {
|
|
|
3494
3527
|
];
|
|
3495
3528
|
s.style && e.push(["STYLE", s.style]), s.time != null && e.push(["time", $e(s.time)]), s.depth != null && e.push([
|
|
3496
3529
|
"elevation",
|
|
3497
|
-
String(
|
|
3530
|
+
String(At(s.depth, s.verticalLabel))
|
|
3498
3531
|
]);
|
|
3499
3532
|
const t = e.map(
|
|
3500
3533
|
([i, a]) => `${i}=${a.startsWith("{") ? a : j(a)}`
|
|
3501
3534
|
).join("&");
|
|
3502
3535
|
return `${s.baseUrl}?${t}`;
|
|
3503
3536
|
}
|
|
3504
|
-
function
|
|
3537
|
+
function ji(s) {
|
|
3505
3538
|
const e = [
|
|
3506
3539
|
["SERVICE", "WMTS"],
|
|
3507
3540
|
["REQUEST", "GetLegend"],
|
|
@@ -3510,32 +3543,32 @@ function Zi(s) {
|
|
|
3510
3543
|
];
|
|
3511
3544
|
return s.style && e.push(["STYLE", s.style]), `${s.baseUrl}?${e.map(([t, i]) => `${t}=${j(i)}`).join("&")}`;
|
|
3512
3545
|
}
|
|
3513
|
-
function
|
|
3546
|
+
function Qi(s) {
|
|
3514
3547
|
return s.sourceConfig.type === "wmts" ? "scalar-wmts" : s.sourceConfig.type === "geovideo" ? s.entry.kind === "vector" ? "vector-geovideo" : "scalar-geovideo" : s.entry.kind === "vector" ? "vector-zarr" : "scalar-zarr";
|
|
3515
3548
|
}
|
|
3516
|
-
function
|
|
3549
|
+
function Ki(s) {
|
|
3517
3550
|
return s.variables.kind === "scalar" ? s.variables.value : "scalar";
|
|
3518
3551
|
}
|
|
3519
|
-
function
|
|
3552
|
+
function Ji(s) {
|
|
3520
3553
|
return s.variables.kind === "vector" ? s.variables.u ?? "uo" : "uo";
|
|
3521
3554
|
}
|
|
3522
|
-
function
|
|
3555
|
+
function ea(s) {
|
|
3523
3556
|
return s.variables.kind === "vector" ? s.variables.v ?? "vo" : "vo";
|
|
3524
3557
|
}
|
|
3525
|
-
function
|
|
3558
|
+
function ta(s) {
|
|
3526
3559
|
return s.variables.kind === "vector" ? s.variables.derivation : void 0;
|
|
3527
3560
|
}
|
|
3528
|
-
class
|
|
3561
|
+
class ia {
|
|
3529
3562
|
constructor(e) {
|
|
3530
|
-
if (this.type = "custom", this.renderingMode = "3d", this.delegate = null, this.map = null, this.suspended = !1, this.listeners = /* @__PURE__ */ new Map(), this.options = e, this.id = e.id, this.metadata = e.metadata ? { ...e.metadata } : void 0, this.backend =
|
|
3563
|
+
if (this.type = "custom", this.renderingMode = "3d", this.delegate = null, this.map = null, this.suspended = !1, this.listeners = /* @__PURE__ */ new Map(), this.options = e, this.id = e.id, this.metadata = e.metadata ? { ...e.metadata } : void 0, this.backend = Qi(e), this.rasterSourceId = `${e.id}-wmts-source`, this.rasterLayerId = `${e.id}-wmts`, this.time = e.time ?? 0, this.depth = e.depth ?? 0, this.opacity = e.opacity ?? 1, this.backend === "vector-zarr") {
|
|
3531
3564
|
const t = e.sourceConfig;
|
|
3532
3565
|
this.delegate = new P({
|
|
3533
3566
|
...e,
|
|
3534
3567
|
source: t.endpoints.field,
|
|
3535
3568
|
zarrSource: e.zarrSource,
|
|
3536
|
-
variableU:
|
|
3537
|
-
variableV:
|
|
3538
|
-
vectorDerivation:
|
|
3569
|
+
variableU: Ji(t),
|
|
3570
|
+
variableV: ea(t),
|
|
3571
|
+
vectorDerivation: ta(t),
|
|
3539
3572
|
unit: e.unit ?? ""
|
|
3540
3573
|
});
|
|
3541
3574
|
} else if (this.backend === "vector-geovideo") {
|
|
@@ -3562,7 +3595,7 @@ class ta {
|
|
|
3562
3595
|
id: e.id,
|
|
3563
3596
|
source: t.endpoints.field,
|
|
3564
3597
|
zarrSource: e.zarrSource,
|
|
3565
|
-
variable:
|
|
3598
|
+
variable: Ki(t),
|
|
3566
3599
|
time: e.time,
|
|
3567
3600
|
depth: e.depth,
|
|
3568
3601
|
colorRamp: e.colorRamp,
|
|
@@ -3772,14 +3805,14 @@ class ta {
|
|
|
3772
3805
|
return;
|
|
3773
3806
|
this.removeWmts();
|
|
3774
3807
|
const e = this.options.sourceConfig, t = e.tileUrlTemplate ? [
|
|
3775
|
-
|
|
3808
|
+
Zi({
|
|
3776
3809
|
template: e.tileUrlTemplate,
|
|
3777
3810
|
tileMatrixSet: e.tileMatrixSet,
|
|
3778
3811
|
style: e.style,
|
|
3779
3812
|
time: this.time,
|
|
3780
3813
|
depth: this.depth,
|
|
3781
3814
|
verticalLabel: this.options.verticalLabel
|
|
3782
|
-
}) ??
|
|
3815
|
+
}) ?? et({
|
|
3783
3816
|
baseUrl: e.baseUrl ?? new URL(e.capabilitiesUrl).origin,
|
|
3784
3817
|
layer: e.layer,
|
|
3785
3818
|
tileMatrixSet: e.tileMatrixSet ?? "EPSG:3857",
|
|
@@ -3790,7 +3823,7 @@ class ta {
|
|
|
3790
3823
|
verticalLabel: this.options.verticalLabel
|
|
3791
3824
|
})
|
|
3792
3825
|
] : [
|
|
3793
|
-
|
|
3826
|
+
et({
|
|
3794
3827
|
baseUrl: e.baseUrl ?? new URL(e.capabilitiesUrl).origin,
|
|
3795
3828
|
layer: e.layer,
|
|
3796
3829
|
tileMatrixSet: e.tileMatrixSet ?? "EPSG:3857",
|
|
@@ -3846,13 +3879,13 @@ class ta {
|
|
|
3846
3879
|
function Pe(s, e) {
|
|
3847
3880
|
return s.match(new RegExp(`\\b${e}=["']([^"']+)["']`, "i"))?.[1].replace(/&/g, "&").replace(/"/g, '"').replace(/'/g, "'");
|
|
3848
3881
|
}
|
|
3849
|
-
function
|
|
3882
|
+
function aa(s, e, t) {
|
|
3850
3883
|
const i = s.replace(/\{TileMatrix\}/gi, "{z}").replace(/\{TileRow\}/gi, "{y}").replace(/\{TileCol\}/gi, "{x}").replace(/\{TileMatrixSet\}/gi, e), a = t == null ? i : i.replace(/\{Style\}/gi, t);
|
|
3851
3884
|
return [...a.matchAll(/\{([^{}]+)\}/g)].some(
|
|
3852
3885
|
(n) => !/^(?:z|y|x|Time|Elevation)$/i.test(n[1])
|
|
3853
3886
|
) ? void 0 : a;
|
|
3854
3887
|
}
|
|
3855
|
-
function
|
|
3888
|
+
function Ct(s) {
|
|
3856
3889
|
return s.replace(/<[^>]+>/g, "").trim();
|
|
3857
3890
|
}
|
|
3858
3891
|
function be(s, e) {
|
|
@@ -3863,9 +3896,9 @@ function be(s, e) {
|
|
|
3863
3896
|
return [...s.matchAll(t)].map((i) => i[1]);
|
|
3864
3897
|
}
|
|
3865
3898
|
function se(s, e) {
|
|
3866
|
-
return be(s, e).map(
|
|
3899
|
+
return be(s, e).map(Ct).find(Boolean);
|
|
3867
3900
|
}
|
|
3868
|
-
function
|
|
3901
|
+
function tt(s, e) {
|
|
3869
3902
|
const t = e.match(
|
|
3870
3903
|
/^P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/
|
|
3871
3904
|
);
|
|
@@ -3878,15 +3911,15 @@ function et(s, e) {
|
|
|
3878
3911
|
).getUTCDate();
|
|
3879
3912
|
return u.setUTCDate(Math.min(n, f)), u.setUTCDate(u.getUTCDate() + Number(t[3] ?? 0)), u.setUTCHours(u.getUTCHours() + Number(t[4] ?? 0)), u.setUTCMinutes(u.getUTCMinutes() + Number(t[5] ?? 0)), u.setUTCSeconds(u.getUTCSeconds() + Number(t[6] ?? 0)), u.getTime();
|
|
3880
3913
|
}
|
|
3881
|
-
function
|
|
3914
|
+
function sa(s) {
|
|
3882
3915
|
const e = [];
|
|
3883
3916
|
for (const t of s.flatMap((i) => i.split(","))) {
|
|
3884
3917
|
const i = t.trim().split("/");
|
|
3885
3918
|
if (i.length === 3) {
|
|
3886
|
-
const r = Date.parse(i[0]), n = Date.parse(i[1]), o =
|
|
3919
|
+
const r = Date.parse(i[0]), n = Date.parse(i[1]), o = tt(r, i[2]);
|
|
3887
3920
|
if (Number.isFinite(r) && Number.isFinite(n) && o && o > r)
|
|
3888
3921
|
for (let l = r, d = 0; l <= n && d < 1e5; d += 1)
|
|
3889
|
-
e.push(l), l =
|
|
3922
|
+
e.push(l), l = tt(l, i[2]);
|
|
3890
3923
|
continue;
|
|
3891
3924
|
}
|
|
3892
3925
|
const a = Date.parse(t.trim());
|
|
@@ -3894,13 +3927,13 @@ function aa(s) {
|
|
|
3894
3927
|
}
|
|
3895
3928
|
return [...new Set(e)].sort((t, i) => t - i);
|
|
3896
3929
|
}
|
|
3897
|
-
function
|
|
3930
|
+
function it(s, e) {
|
|
3898
3931
|
for (const t of be(s, "Dimension"))
|
|
3899
3932
|
if (se(t, "Identifier")?.toLowerCase() === e.toLowerCase())
|
|
3900
|
-
return be(t, "Value").map(
|
|
3933
|
+
return be(t, "Value").map(Ct);
|
|
3901
3934
|
return [];
|
|
3902
3935
|
}
|
|
3903
|
-
function
|
|
3936
|
+
function ra(s, e) {
|
|
3904
3937
|
const t = be(s, "Layer").find(
|
|
3905
3938
|
(h) => se(h, "Identifier") === e.layer
|
|
3906
3939
|
);
|
|
@@ -3909,7 +3942,7 @@ function sa(s, e) {
|
|
|
3909
3942
|
const i = e.tileMatrixSet ?? se(t, "TileMatrixSet") ?? "";
|
|
3910
3943
|
if (!/3857|GoogleMapsCompatible/i.test(i))
|
|
3911
3944
|
throw new Error(`Unsupported WMTS tile matrix set: ${i || "missing"}`);
|
|
3912
|
-
const a =
|
|
3945
|
+
const a = sa(it(t, "time")), r = a.length ? {
|
|
3913
3946
|
min: a[0],
|
|
3914
3947
|
max: a[a.length - 1],
|
|
3915
3948
|
size: a.length,
|
|
@@ -3918,7 +3951,7 @@ function sa(s, e) {
|
|
|
3918
3951
|
step: a.length > 1 && a.every(
|
|
3919
3952
|
(h, g) => g === 0 || h - a[g - 1] === a[1] - a[0]
|
|
3920
3953
|
) ? a[1] - a[0] : void 0
|
|
3921
|
-
} : { min: 0, max: 0, size: 1, values: [0], units: "static" }, n =
|
|
3954
|
+
} : { min: 0, max: 0, size: 1, values: [0], units: "static" }, n = it(t, "elevation").flatMap((h) => h.split(",")).map(Number).filter(Number.isFinite), o = n.length ? { name: "elevation", label: "elevation", values: n } : null, l = s.match(
|
|
3922
3955
|
/GetTile[\s\S]*?(?:xlink:href|href)=["']([^"']+)/i
|
|
3923
3956
|
)?.[1], c = [
|
|
3924
3957
|
...t.matchAll(/<(?:(?:\w+):)?ResourceURL\b([^>]*)\/?\s*>/gi)
|
|
@@ -3933,7 +3966,7 @@ function sa(s, e) {
|
|
|
3933
3966
|
), p = e.style ?? se(m?.[2] ?? f[0]?.[2] ?? "", "Identifier");
|
|
3934
3967
|
return {
|
|
3935
3968
|
baseUrl: e.baseUrl ?? l ?? new URL(e.capabilitiesUrl).origin,
|
|
3936
|
-
tileUrlTemplate: e.tileUrlTemplate ?? (u ?
|
|
3969
|
+
tileUrlTemplate: e.tileUrlTemplate ?? (u ? aa(u, i, p) : void 0),
|
|
3937
3970
|
tileMatrixSet: i,
|
|
3938
3971
|
format: e.format ?? se(t, "Format") ?? "image/png",
|
|
3939
3972
|
style: p,
|
|
@@ -3941,15 +3974,15 @@ function sa(s, e) {
|
|
|
3941
3974
|
vertical: o
|
|
3942
3975
|
};
|
|
3943
3976
|
}
|
|
3944
|
-
async function
|
|
3977
|
+
async function na(s, e) {
|
|
3945
3978
|
const t = await fetch(s.capabilitiesUrl, { signal: e });
|
|
3946
3979
|
if (!t.ok)
|
|
3947
3980
|
throw new Error(
|
|
3948
3981
|
`WMTS capabilities request failed (${t.status}): ${s.capabilitiesUrl}`
|
|
3949
3982
|
);
|
|
3950
|
-
return
|
|
3983
|
+
return ra(await t.text(), s);
|
|
3951
3984
|
}
|
|
3952
|
-
const
|
|
3985
|
+
const oa = [
|
|
3953
3986
|
0.25,
|
|
3954
3987
|
0.5,
|
|
3955
3988
|
1,
|
|
@@ -3958,8 +3991,8 @@ const na = [
|
|
|
3958
3991
|
8,
|
|
3959
3992
|
16,
|
|
3960
3993
|
32
|
|
3961
|
-
],
|
|
3962
|
-
function
|
|
3994
|
+
], at = [0.25, 0.5, 1, 2];
|
|
3995
|
+
function st(s, e) {
|
|
3963
3996
|
if (s.length === 0)
|
|
3964
3997
|
return e;
|
|
3965
3998
|
let t = s[0], i;
|
|
@@ -3967,7 +4000,7 @@ function at(s, e) {
|
|
|
3967
4000
|
a < t && (t = a), a <= e && (i === void 0 || a > i) && (i = a);
|
|
3968
4001
|
return i ?? t;
|
|
3969
4002
|
}
|
|
3970
|
-
function
|
|
4003
|
+
function la(s) {
|
|
3971
4004
|
const e = s.map((n) => new Date(n)), t = (n) => n.every((o) => e.every((l) => o(l) === o(e[0]))), i = [
|
|
3972
4005
|
(n) => n.getUTCHours(),
|
|
3973
4006
|
(n) => n.getUTCMinutes(),
|
|
@@ -3988,7 +4021,7 @@ function oa(s) {
|
|
|
3988
4021
|
const r = a.getUTCHours() === 0 && a.getUTCMinutes() === 0 && a.getUTCSeconds() === 0 && a.getUTCMilliseconds() === 0;
|
|
3989
4022
|
return r && a.getUTCMonth() === 0 && a.getUTCDate() === 1 ? "year" : r && a.getUTCDate() === 1 ? "month" : r ? "day" : a.getUTCMinutes() === 0 && a.getUTCSeconds() === 0 && a.getUTCMilliseconds() === 0 ? "hour" : a.getUTCSeconds() === 0 && a.getUTCMilliseconds() === 0 ? "minute" : "second";
|
|
3990
4023
|
}
|
|
3991
|
-
function
|
|
4024
|
+
function kt(s) {
|
|
3992
4025
|
if (s.length < 2)
|
|
3993
4026
|
return;
|
|
3994
4027
|
const e = s[1] - s[0];
|
|
@@ -3997,7 +4030,7 @@ function Ct(s) {
|
|
|
3997
4030
|
) ? e : void 0;
|
|
3998
4031
|
}
|
|
3999
4032
|
function re(s, e) {
|
|
4000
|
-
return e ?
|
|
4033
|
+
return e ? bt(e, [
|
|
4001
4034
|
s.values[0],
|
|
4002
4035
|
s.values[s.values.length - 1]
|
|
4003
4036
|
]) : null;
|
|
@@ -4016,11 +4049,11 @@ function ne(s, e) {
|
|
|
4016
4049
|
min: r[0],
|
|
4017
4050
|
max: r[r.length - 1],
|
|
4018
4051
|
size: r.length,
|
|
4019
|
-
step:
|
|
4052
|
+
step: kt(r),
|
|
4020
4053
|
values: r
|
|
4021
4054
|
};
|
|
4022
4055
|
}
|
|
4023
|
-
function
|
|
4056
|
+
function rt(s, e) {
|
|
4024
4057
|
const { start: t, end: i } = s.temporal ?? {};
|
|
4025
4058
|
return t || i ? ne(e, { start: t, end: i }) : e;
|
|
4026
4059
|
}
|
|
@@ -4034,16 +4067,16 @@ function Ee(s, e) {
|
|
|
4034
4067
|
const t = s.sources.filter(Fe);
|
|
4035
4068
|
return t.find((i) => i.id === e) ?? (e === "geovideo" || e === "auto" ? t[0] : void 0);
|
|
4036
4069
|
}
|
|
4037
|
-
function
|
|
4070
|
+
function Ft(s) {
|
|
4038
4071
|
return [...s].sort((e, t) => {
|
|
4039
4072
|
const i = Math.abs(e), a = Math.abs(t);
|
|
4040
4073
|
return i !== a ? i - a : t - e;
|
|
4041
4074
|
});
|
|
4042
4075
|
}
|
|
4043
4076
|
function Le(s, e) {
|
|
4044
|
-
return s?.values.length ? e == null ?
|
|
4077
|
+
return s?.values.length ? e == null ? Ft(s.values)[0] : V(s.values, e) : e ?? 0;
|
|
4045
4078
|
}
|
|
4046
|
-
function
|
|
4079
|
+
function V(s, e) {
|
|
4047
4080
|
if (s.length === 0)
|
|
4048
4081
|
return e;
|
|
4049
4082
|
let t = s[0], i = Math.abs(t - e);
|
|
@@ -4053,7 +4086,7 @@ function U(s, e) {
|
|
|
4053
4086
|
}
|
|
4054
4087
|
return t;
|
|
4055
4088
|
}
|
|
4056
|
-
function
|
|
4089
|
+
function nt(s) {
|
|
4057
4090
|
for (const [e, t] of [
|
|
4058
4091
|
[s?.playbackRate, "Playback rate"],
|
|
4059
4092
|
[s?.stepsPerSecond, "Steps per second"]
|
|
@@ -4061,14 +4094,14 @@ function rt(s) {
|
|
|
4061
4094
|
if (e != null && (!Number.isFinite(e) || e <= 0))
|
|
4062
4095
|
throw new Error(`${t} must be positive`);
|
|
4063
4096
|
}
|
|
4064
|
-
function
|
|
4065
|
-
const t = s.surface?.value ?? 0, i =
|
|
4097
|
+
function ot(s, e) {
|
|
4098
|
+
const t = s.surface?.value ?? 0, i = V(
|
|
4066
4099
|
[t, ...s.depths.map((a) => a.value)],
|
|
4067
4100
|
e
|
|
4068
4101
|
);
|
|
4069
4102
|
return i === t ? null : i;
|
|
4070
4103
|
}
|
|
4071
|
-
function
|
|
4104
|
+
function ca(s) {
|
|
4072
4105
|
const e = s.surface ?? s.depths[0];
|
|
4073
4106
|
return {
|
|
4074
4107
|
name: e.name,
|
|
@@ -4080,24 +4113,24 @@ function la(s) {
|
|
|
4080
4113
|
]
|
|
4081
4114
|
};
|
|
4082
4115
|
}
|
|
4083
|
-
function
|
|
4116
|
+
function lt(s, e) {
|
|
4084
4117
|
return JSON.stringify([
|
|
4085
4118
|
s?.values ?? null,
|
|
4086
4119
|
e ? [e.name, e.units, e.values] : null
|
|
4087
4120
|
]);
|
|
4088
4121
|
}
|
|
4089
|
-
function
|
|
4122
|
+
function ha(s) {
|
|
4090
4123
|
const e = [...new Set(s)].sort((t, i) => t - i);
|
|
4091
4124
|
return {
|
|
4092
4125
|
min: e[0],
|
|
4093
4126
|
max: e[e.length - 1],
|
|
4094
|
-
step:
|
|
4127
|
+
step: kt(e),
|
|
4095
4128
|
size: e.length,
|
|
4096
4129
|
units: "milliseconds since 1970-01-01T00:00:00Z",
|
|
4097
4130
|
values: e
|
|
4098
4131
|
};
|
|
4099
4132
|
}
|
|
4100
|
-
const
|
|
4133
|
+
const ua = 5 * 6e4, da = 6e4, ct = 6;
|
|
4101
4134
|
function pe(s) {
|
|
4102
4135
|
const { particles: e = {}, raster: t = {} } = s, i = {
|
|
4103
4136
|
palette: s.palette,
|
|
@@ -4107,7 +4140,7 @@ function pe(s) {
|
|
|
4107
4140
|
speed: e.speed,
|
|
4108
4141
|
fade: e.fade,
|
|
4109
4142
|
glow: e.glow,
|
|
4110
|
-
colorGrade: e.grade === void 0 ? void 0 :
|
|
4143
|
+
colorGrade: e.grade === void 0 ? void 0 : gi(e.grade),
|
|
4111
4144
|
opacity: t.opacity,
|
|
4112
4145
|
logScale: t.logScale,
|
|
4113
4146
|
vibrance: t.vibrance,
|
|
@@ -4121,29 +4154,29 @@ function pe(s) {
|
|
|
4121
4154
|
Object.entries(i).filter(([, a]) => a !== void 0)
|
|
4122
4155
|
);
|
|
4123
4156
|
}
|
|
4124
|
-
function
|
|
4157
|
+
function Ve(s) {
|
|
4125
4158
|
const e = s.alphaFadeLow ?? 0, t = s.alphaFadeHigh ?? 0;
|
|
4126
4159
|
return e > 0 || t > 0 ? { low: e, high: t, curve: s.alphaFadeCurve ?? "linear" } : void 0;
|
|
4127
4160
|
}
|
|
4128
|
-
const
|
|
4129
|
-
|
|
4130
|
-
),
|
|
4161
|
+
const ht = "rdylbu", ma = new Set(
|
|
4162
|
+
xt({ includeDeprecated: !0 }).map((s) => s.id)
|
|
4163
|
+
), ut = /* @__PURE__ */ new Set();
|
|
4131
4164
|
function Ne(s) {
|
|
4132
|
-
return typeof s != "string" ||
|
|
4133
|
-
`[zartigl] palette "${s}" is not in this version: drawn with "${
|
|
4134
|
-
)),
|
|
4165
|
+
return typeof s != "string" || ma.has(s) ? s : (ut.has(s) || (ut.add(s), console.warn(
|
|
4166
|
+
`[zartigl] palette "${s}" is not in this version: drawn with "${ht}"`
|
|
4167
|
+
)), ht);
|
|
4135
4168
|
}
|
|
4136
4169
|
function De(s) {
|
|
4137
|
-
const { reversePalette: e } = s, t = Ne(s.palette), i =
|
|
4170
|
+
const { reversePalette: e } = s, t = Ne(s.palette), i = Ve(s);
|
|
4138
4171
|
return t != null && (e || i) ? ke(t, { reverse: e, alphaFade: i }) : t;
|
|
4139
4172
|
}
|
|
4140
|
-
const
|
|
4173
|
+
const fa = [
|
|
4141
4174
|
"palette",
|
|
4142
4175
|
"reversePalette",
|
|
4143
4176
|
"alphaFadeLow",
|
|
4144
4177
|
"alphaFadeHigh",
|
|
4145
4178
|
"alphaFadeCurve"
|
|
4146
|
-
],
|
|
4179
|
+
], It = Object.freeze({
|
|
4147
4180
|
palette: "style.palette",
|
|
4148
4181
|
renderMode: "style.renderMode",
|
|
4149
4182
|
particleDensity: "style.particles.density",
|
|
@@ -4171,7 +4204,7 @@ function Ae(s) {
|
|
|
4171
4204
|
backdrop: u,
|
|
4172
4205
|
...f
|
|
4173
4206
|
} = s ?? {}, m = Object.keys(s ?? {}).filter(
|
|
4174
|
-
(h) => h in
|
|
4207
|
+
(h) => h in It && s[h] !== void 0
|
|
4175
4208
|
);
|
|
4176
4209
|
return {
|
|
4177
4210
|
style: ae({
|
|
@@ -4181,7 +4214,7 @@ function Ae(s) {
|
|
|
4181
4214
|
density: i,
|
|
4182
4215
|
speed: a,
|
|
4183
4216
|
fade: r,
|
|
4184
|
-
grade: n &&
|
|
4217
|
+
grade: n && pi(n),
|
|
4185
4218
|
backdrop: u
|
|
4186
4219
|
},
|
|
4187
4220
|
raster: { opacity: o, logScale: l, vibrance: d, colorDomain: c }
|
|
@@ -4190,14 +4223,14 @@ function Ae(s) {
|
|
|
4190
4223
|
legacyKeys: m
|
|
4191
4224
|
};
|
|
4192
4225
|
}
|
|
4193
|
-
const
|
|
4194
|
-
function
|
|
4226
|
+
const dt = /* @__PURE__ */ new Set();
|
|
4227
|
+
function mt(s) {
|
|
4195
4228
|
for (const e of s)
|
|
4196
|
-
|
|
4197
|
-
`[zartigl] settings.${e} is deprecated: use ${
|
|
4229
|
+
dt.has(e) || (dt.add(e), console.warn(
|
|
4230
|
+
`[zartigl] settings.${e} is deprecated: use ${It[e]}`
|
|
4198
4231
|
));
|
|
4199
4232
|
}
|
|
4200
|
-
function
|
|
4233
|
+
function Ut(s, e) {
|
|
4201
4234
|
const t = ze(s, e);
|
|
4202
4235
|
return {
|
|
4203
4236
|
...pe(t),
|
|
@@ -4205,23 +4238,23 @@ function It(s, e) {
|
|
|
4205
4238
|
colorDomain: Q(t.raster.colorDomain)
|
|
4206
4239
|
};
|
|
4207
4240
|
}
|
|
4208
|
-
function
|
|
4241
|
+
function pa(s) {
|
|
4209
4242
|
return {
|
|
4210
|
-
...
|
|
4243
|
+
...Ut(s),
|
|
4211
4244
|
particleState: "auto",
|
|
4212
4245
|
rgba8MaxParticleZoom: 4
|
|
4213
4246
|
};
|
|
4214
4247
|
}
|
|
4215
|
-
function
|
|
4248
|
+
function ga(s) {
|
|
4216
4249
|
const { palette: e, ...t } = s;
|
|
4217
4250
|
return t;
|
|
4218
4251
|
}
|
|
4219
|
-
function
|
|
4220
|
-
s !== void 0 &&
|
|
4252
|
+
function ft(s, e, t) {
|
|
4253
|
+
s !== void 0 && pt(s, "style", {
|
|
4221
4254
|
kind: e.layers.find((i) => i.id === t)?.kind
|
|
4222
4255
|
});
|
|
4223
4256
|
}
|
|
4224
|
-
class
|
|
4257
|
+
class Ca {
|
|
4225
4258
|
constructor(e) {
|
|
4226
4259
|
if (this.fullTimeMeta = null, this.autoplayPending = !0, this.playing = !1, this.catalogLayer = null, this.catalogSource = null, this.layer = null, this.time = 0, this.pendingTime = null, this.requestedTime = null, this.playbackIntent = 0, this.requestSeq = 0, this.playSeq = 0, this.depth = 0, this.depthRequest = null, this.failedGeoVideo = /* @__PURE__ */ new Set(), this.lastMeta = null, this.timeMeta = null, this.resolvedTimeRange = null, this.verticalMeta = null, this.variableUnit = "", this.geoVideoManifest = null, this.wmtsMetadata = null, this.fieldSources = /* @__PURE__ */ new Map(), this.archiveChunks = /* @__PURE__ */ new Map(), this.chunkTimes = /* @__PURE__ */ new Map(), this.archiveRoots = /* @__PURE__ */ new Map(), this.archiveLevel = null, this.depthLocked = !1, this.chunkLevels = /* @__PURE__ */ new Map(), this.nextChunkManifest = null, this.activeFieldSource = null, this.switchGeneration = 0, this.destroyed = !1, this.initialized = !1, this.initStarted = !1, this.updateQueue = Promise.resolve(), this.suspended = !1, this.attachQueued = !1, this.anchor = null, this.querySources = /* @__PURE__ */ new Map(), this.listeners = /* @__PURE__ */ new Map(), this.onMapReady = () => {
|
|
4227
4260
|
this.attachQueued && this.attachWhenReady();
|
|
@@ -4229,9 +4262,9 @@ class Aa {
|
|
|
4229
4262
|
throw new Error("Zartigl requires a layer UUID");
|
|
4230
4263
|
if (e.time != null && z(e.time, "time"), e.depth != null && !Number.isFinite(e.depth))
|
|
4231
4264
|
throw new Error("Depth must be finite");
|
|
4232
|
-
|
|
4265
|
+
nt(e.geoVideo), this.id = e.id ?? "zartigl", this.map = e.map, this.catalog = e.catalog, this.initialLayer = e.layer, this.initialTime = e.time, this.initialDepth = e.depth, this.depthRequest = e.depth ?? null, this.sourcePreference = e.source ?? "auto", this.timeRange = e.timeRange ? { ...e.timeRange } : void 0, this.autoplay = e.geoVideo?.autoplay ?? !0, this.loop = e.geoVideo?.loop ?? !0, this.playbackRate = e.geoVideo?.playbackRate ?? 1, this.stepsPerSecond = e.geoVideo?.stepsPerSecond ?? null, this.metadata = e.metadata ? { ...e.metadata } : void 0, this.before = e.before, this.visible = e.visible ?? !0;
|
|
4233
4266
|
const t = Ae(e.settings);
|
|
4234
|
-
|
|
4267
|
+
mt(t.legacyKeys), this.style = ae(t.style, e.style), ft(this.style, e.catalog, e.layer), this.settings = { ...t.settings, ...pe(this.style) }, this.settings.colorDomain !== void 0 && (this.settings.colorDomain = Q(
|
|
4235
4268
|
this.settings.colorDomain
|
|
4236
4269
|
)), this.colorDomainOverridden = this.settings.colorDomain !== void 0, this.paletteOverridden = this.settings.palette !== void 0, this.map.on("load", this.onMapReady), this.map.on("styledata", this.onMapReady), this.map.on("idle", this.onMapReady);
|
|
4237
4270
|
}
|
|
@@ -4249,15 +4282,15 @@ class Aa {
|
|
|
4249
4282
|
async update(e) {
|
|
4250
4283
|
this.assertAlive();
|
|
4251
4284
|
const t = Ae(e.settings);
|
|
4252
|
-
|
|
4285
|
+
mt(t.legacyKeys);
|
|
4253
4286
|
const i = t.legacyKeys.length ? { ...e, settings: t.settings, stylePatch: t.style } : e;
|
|
4254
4287
|
if (!this.initialized)
|
|
4255
4288
|
throw new Error("Call init() before update()");
|
|
4256
4289
|
if (i.depth != null && !Number.isFinite(i.depth))
|
|
4257
4290
|
throw new Error("Depth must be finite");
|
|
4258
|
-
i.time != null && z(i.time, "time"),
|
|
4291
|
+
i.time != null && z(i.time, "time"), nt(i.geoVideo), i.settings?.colorDomain !== void 0 && Q(i.settings.colorDomain);
|
|
4259
4292
|
for (const a of [i.style, i.stylePatch])
|
|
4260
|
-
a !== void 0 &&
|
|
4293
|
+
a !== void 0 && pt(a, "style");
|
|
4261
4294
|
return i.time != null && this.pause(), this.enqueue(i, ++this.requestSeq);
|
|
4262
4295
|
}
|
|
4263
4296
|
/**
|
|
@@ -4279,9 +4312,9 @@ class Aa {
|
|
|
4279
4312
|
}
|
|
4280
4313
|
async applyUpdate(e, t, i) {
|
|
4281
4314
|
this.assertAlive(), i != null && e.time != null && this.playSeq !== 0 && this.playSeq < i && this.pause();
|
|
4282
|
-
const a = e.layer != null && e.layer !== this.catalogLayer?.id, r = e.source != null && (a || e.source !== this.sourcePreference), n = !a && e.source === "auto" && this.sourcePreference === "auto", o = { time: e.time, depth: e.depth }, l = a ? e.layer : this.catalogLayer?.id, d = e.stylePatch === void 0 ? e.style : e.style === void 0 ? ae(this.style, e.stylePatch) : ae(e.stylePatch, e.style), c = e.settings?.palette, u = d !== void 0 && c !== void 0 && typeof c != "string" && e.style?.palette === void 0 ?
|
|
4283
|
-
|
|
4284
|
-
const f = u ?? (a ?
|
|
4315
|
+
const a = e.layer != null && e.layer !== this.catalogLayer?.id, r = e.source != null && (a || e.source !== this.sourcePreference), n = !a && e.source === "auto" && this.sourcePreference === "auto", o = { time: e.time, depth: e.depth }, l = a ? e.layer : this.catalogLayer?.id, d = e.stylePatch === void 0 ? e.style : e.style === void 0 ? ae(this.style, e.stylePatch) : ae(e.stylePatch, e.style), c = e.settings?.palette, u = d !== void 0 && c !== void 0 && typeof c != "string" && e.style?.palette === void 0 ? ga(d) : d;
|
|
4316
|
+
ft(u, this.catalog, l);
|
|
4317
|
+
const f = u ?? (a ? gt(
|
|
4285
4318
|
this.style,
|
|
4286
4319
|
this.catalog.layers.find((m) => m.id === l)?.kind
|
|
4287
4320
|
) : void 0);
|
|
@@ -4330,10 +4363,10 @@ class Aa {
|
|
|
4330
4363
|
e.geoVideo && (e.geoVideo.autoplay != null && (this.autoplay = e.geoVideo.autoplay, this.catalogSource?.type === "geovideo" && (this.autoplay ? await this.startPlayback(i ?? ++this.requestSeq) : this.pause())), e.geoVideo.loop != null && this.applyLoop(e.geoVideo.loop), e.geoVideo.stepsPerSecond != null ? (this.stepsPerSecond = e.geoVideo.stepsPerSecond, this.applyPlaybackSpeed()) : e.geoVideo.playbackRate != null && this.applyPlaybackRate(e.geoVideo.playbackRate)), e.time != null && e.depth != null ? this.applyTimeAndDepth(e.time, e.depth) : (e.time != null && this.applyTime(e.time), e.depth != null && this.applyDepth(e.depth)), e.time != null && this.requestedTime === z(e.time, "time") && (this.requestedTime = null), e.visible != null && this.applyVisible(e.visible);
|
|
4331
4364
|
}
|
|
4332
4365
|
async loadLayer(e, t = this.sourcePreference, i, a) {
|
|
4333
|
-
const r = this.getSource(), n =
|
|
4366
|
+
const r = this.getSource(), n = lt(this.timeMeta, this.verticalMeta);
|
|
4334
4367
|
await this.loadSource(e, t, i, a);
|
|
4335
4368
|
const o = this.getSource();
|
|
4336
|
-
o && (o.id !== r?.id || o.type !== r?.type) ? this.emit("sourceChange", o) :
|
|
4369
|
+
o && (o.id !== r?.id || o.type !== r?.type) ? this.emit("sourceChange", o) : lt(this.timeMeta, this.verticalMeta) !== n && this.emit("axesChange");
|
|
4337
4370
|
}
|
|
4338
4371
|
async loadSource(e, t, i, a) {
|
|
4339
4372
|
this.assertAlive();
|
|
@@ -4342,7 +4375,7 @@ class Aa {
|
|
|
4342
4375
|
);
|
|
4343
4376
|
if (!r)
|
|
4344
4377
|
throw new Error(`Unknown zartigl catalog entry: ${e}`);
|
|
4345
|
-
const n =
|
|
4378
|
+
const n = pa(r), o = i ? i.timeRange : this.timeRange, l = a ?? ++this.switchGeneration, d = {
|
|
4346
4379
|
...i?.target,
|
|
4347
4380
|
depth: i?.target?.depth ?? this.depthRequest ?? void 0
|
|
4348
4381
|
}, c = await this.selectSource(
|
|
@@ -4372,24 +4405,24 @@ class Aa {
|
|
|
4372
4405
|
throw new Error(
|
|
4373
4406
|
`GeoVideo manifest level does not match its index: ${c.manifestUrl}`
|
|
4374
4407
|
);
|
|
4375
|
-
const k = E?.value ?? null, F = S ? await this.archiveTimes(r, c.id, k) : null, L = S ? await this.archiveLevels(r, S) : null, D = !!L?.depths.length, b = !D && !!L?.surface, A = D || b ?
|
|
4408
|
+
const k = E?.value ?? null, F = S ? await this.archiveTimes(r, c.id, k) : null, L = S ? await this.archiveLevels(r, S) : null, D = !!L?.depths.length, b = !D && !!L?.surface, A = D || b ? ca(L) : null;
|
|
4376
4409
|
if (l !== this.switchGeneration)
|
|
4377
4410
|
throw new DOMException(
|
|
4378
4411
|
"Layer selection was superseded",
|
|
4379
4412
|
"AbortError"
|
|
4380
4413
|
);
|
|
4381
|
-
const N = we(v), C =
|
|
4414
|
+
const N = we(v), C = ha(F ?? N), I = re(
|
|
4382
4415
|
C,
|
|
4383
4416
|
o
|
|
4384
4417
|
), w = ne(
|
|
4385
4418
|
C,
|
|
4386
4419
|
o
|
|
4387
|
-
),
|
|
4420
|
+
), U = N.filter(
|
|
4388
4421
|
(ce) => ce >= w.min && ce <= w.max
|
|
4389
|
-
), X =
|
|
4390
|
-
this.catalogLayer = r, this.catalogSource = c, this.sourcePreference = t, this.timeRange = o, this.activeFieldSource = null, this.geoVideoManifest = v, this.wmtsMetadata = null, this.fullTimeMeta = C, this.resolvedTimeRange = I, this.timeMeta = w, this.verticalMeta = A, this.variableUnit = v.style.unit ?? "", this.variableStandardName = v.provenance.variables[0], this.time = this.pendingTime == null ? X[0] :
|
|
4391
|
-
const
|
|
4392
|
-
if (this.settings = { ...n, ...u }, this.colorDomainOverridden = f, this.paletteOverridden = m, this.settings.colorDomain = f ?
|
|
4422
|
+
), X = U.length ? U : N, oe = this.catalogLayer?.id === r.id && this.catalogSource?.type === "geovideo", le = this.settings.palette;
|
|
4423
|
+
this.catalogLayer = r, this.catalogSource = c, this.sourcePreference = t, this.timeRange = o, this.activeFieldSource = null, this.geoVideoManifest = v, this.wmtsMetadata = null, this.fullTimeMeta = C, this.resolvedTimeRange = I, this.timeMeta = w, this.verticalMeta = A, this.variableUnit = v.style.unit ?? "", this.variableStandardName = v.provenance.variables[0], this.time = this.pendingTime == null ? X[0] : V(X, this.pendingTime), this.pendingTime = null, this.depthLocked = b, this.archiveLevel = k, this.depth = D ? k ?? L.surface?.value ?? 0 : Le(A, d.depth), D && (this.depthRequest = this.depth);
|
|
4424
|
+
const Ot = u.colorDomain;
|
|
4425
|
+
if (this.settings = { ...n, ...u }, this.colorDomainOverridden = f, this.paletteOverridden = m, this.settings.colorDomain = f ? Ot ?? null : v.style.colorDomain, this.settings.palette = m ? this.settings.palette : qe(r.defaults).palette ?? v.style.palette, this.lastMeta = null, oe && this.replaceGeoVideoInPlace(le))
|
|
4393
4426
|
return;
|
|
4394
4427
|
this.detach(), this.attachWhenReady();
|
|
4395
4428
|
return;
|
|
@@ -4403,7 +4436,7 @@ class Aa {
|
|
|
4403
4436
|
if (c.type === "wmts") {
|
|
4404
4437
|
this.emit("status", { phase: "metadata" });
|
|
4405
4438
|
try {
|
|
4406
|
-
const v = await
|
|
4439
|
+
const v = await na(c);
|
|
4407
4440
|
if (l !== this.switchGeneration)
|
|
4408
4441
|
throw new DOMException(
|
|
4409
4442
|
"Layer selection was superseded",
|
|
@@ -4420,7 +4453,7 @@ class Aa {
|
|
|
4420
4453
|
}, this.sourcePreference = t, this.timeRange = o, this.activeFieldSource = null, this.geoVideoManifest = null, this.wmtsMetadata = v, this.fullTimeMeta = _, this.resolvedTimeRange = re(
|
|
4421
4454
|
_,
|
|
4422
4455
|
o
|
|
4423
|
-
), this.timeMeta = S, this.verticalMeta = v.vertical, this.archiveLevel = null, this.depthLocked = !1, this.variableUnit = "", this.variableStandardName = c.layer, this.time = this.pendingTime == null ?
|
|
4456
|
+
), this.timeMeta = S, this.verticalMeta = v.vertical, this.archiveLevel = null, this.depthLocked = !1, this.variableUnit = "", this.variableStandardName = c.layer, this.time = this.pendingTime == null ? st(S.values, Date.now()) : V(S.values, this.pendingTime), this.pendingTime = null, this.depth = Le(v.vertical, d.depth), this.settings = { ...n, ...u }, this.colorDomainOverridden = f, this.paletteOverridden = m, this.lastMeta = null, this.attachWhenReady();
|
|
4424
4457
|
return;
|
|
4425
4458
|
} catch (v) {
|
|
4426
4459
|
const _ = v instanceof Error ? v : new Error(String(v));
|
|
@@ -4438,7 +4471,7 @@ class Aa {
|
|
|
4438
4471
|
throw new Error(
|
|
4439
4472
|
`Configured variable not found in Zarr store: ${_}`
|
|
4440
4473
|
);
|
|
4441
|
-
if (g =
|
|
4474
|
+
if (g = rt(
|
|
4442
4475
|
c,
|
|
4443
4476
|
p.getTimeDimension()
|
|
4444
4477
|
), g.values.length === 0)
|
|
@@ -4452,7 +4485,7 @@ class Aa {
|
|
|
4452
4485
|
}
|
|
4453
4486
|
if (l !== this.switchGeneration)
|
|
4454
4487
|
throw new DOMException("Layer selection was superseded", "AbortError");
|
|
4455
|
-
this.detach(), this.catalogLayer = r, this.catalogSource = c, this.sourcePreference = t, this.timeRange = o, this.activeFieldSource = p, this.geoVideoManifest = null, this.wmtsMetadata = null, this.fullTimeMeta = g, this.resolvedTimeRange = x, this.timeMeta = h, this.verticalMeta = T, this.archiveLevel = null, this.depthLocked = !1, this.variableUnit = typeof M.units == "string" ? M.units : "", this.variableStandardName = typeof M.standard_name == "string" ? M.standard_name : void 0, this.time = this.pendingTime == null ?
|
|
4488
|
+
this.detach(), this.catalogLayer = r, this.catalogSource = c, this.sourcePreference = t, this.timeRange = o, this.activeFieldSource = p, this.geoVideoManifest = null, this.wmtsMetadata = null, this.fullTimeMeta = g, this.resolvedTimeRange = x, this.timeMeta = h, this.verticalMeta = T, this.archiveLevel = null, this.depthLocked = !1, this.variableUnit = typeof M.units == "string" ? M.units : "", this.variableStandardName = typeof M.standard_name == "string" ? M.standard_name : void 0, this.time = this.pendingTime == null ? st(this.timeMeta.values, Date.now()) : V(this.timeMeta.values, this.pendingTime), this.pendingTime = null, this.depth = Le(T, d.depth);
|
|
4456
4489
|
const y = u.colorDomain;
|
|
4457
4490
|
this.settings = { ...n, ...u }, this.colorDomainOverridden = f, this.paletteOverridden = m, this.settings.colorDomain = f ? y ?? null : n.colorDomain ?? null, this.lastMeta = null, this.attachWhenReady();
|
|
4458
4491
|
}
|
|
@@ -4478,8 +4511,8 @@ class Aa {
|
|
|
4478
4511
|
const a = this.catalogLayer, r = this.catalogSource;
|
|
4479
4512
|
if (!a || !r || !this.isArchiveChunk(r))
|
|
4480
4513
|
return !1;
|
|
4481
|
-
const n = Ee(a, this.sourcePreference), o = n ? await this.archiveLevels(a, n) : null, d = !!o?.depths.length && t.depth != null &&
|
|
4482
|
-
if ((t.time == null && !i ||
|
|
4514
|
+
const n = Ee(a, this.sourcePreference), o = n ? await this.archiveLevels(a, n) : null, d = !!o?.depths.length && t.depth != null && ot(o, t.depth) !== this.archiveLevel;
|
|
4515
|
+
if ((t.time == null && !i || Bt(r, this.sourceTimeRequest(e, t.time))) && !d)
|
|
4483
4516
|
return !1;
|
|
4484
4517
|
const u = await this.selectSource(
|
|
4485
4518
|
a,
|
|
@@ -4487,7 +4520,7 @@ class Aa {
|
|
|
4487
4520
|
e,
|
|
4488
4521
|
t
|
|
4489
4522
|
);
|
|
4490
|
-
return !
|
|
4523
|
+
return !ii(u, r);
|
|
4491
4524
|
}
|
|
4492
4525
|
applyVisible(e) {
|
|
4493
4526
|
this.assertAlive(), this.visible !== e && (this.visible = e, e ? this.attachWhenReady() : this.detach());
|
|
@@ -4512,7 +4545,7 @@ class Aa {
|
|
|
4512
4545
|
applyTime(e) {
|
|
4513
4546
|
this.assertAlive();
|
|
4514
4547
|
const t = z(e, "time");
|
|
4515
|
-
this.layer || (this.pendingTime = t), this.time =
|
|
4548
|
+
this.layer || (this.pendingTime = t), this.time = V(this.timeMeta?.values ?? [], t), this.layer?.setTime(this.time);
|
|
4516
4549
|
}
|
|
4517
4550
|
/** Start GeoVideo playback; does nothing where playback is unavailable. */
|
|
4518
4551
|
async play() {
|
|
@@ -4539,7 +4572,7 @@ class Aa {
|
|
|
4539
4572
|
const t = this.timeMeta?.values ?? [];
|
|
4540
4573
|
if (!t.length)
|
|
4541
4574
|
return;
|
|
4542
|
-
const i =
|
|
4575
|
+
const i = V(t, this.requestedTime ?? this.time);
|
|
4543
4576
|
return t[t.indexOf(i) + e];
|
|
4544
4577
|
}
|
|
4545
4578
|
pause() {
|
|
@@ -4560,10 +4593,10 @@ class Aa {
|
|
|
4560
4593
|
}
|
|
4561
4594
|
/** Media rate for the loaded artifact: steps per second when set, else the raw multiplier. */
|
|
4562
4595
|
effectivePlaybackRate() {
|
|
4563
|
-
return this.stepsPerSecond != null && this.geoVideoManifest ?
|
|
4596
|
+
return this.stepsPerSecond != null && this.geoVideoManifest ? ai(this.geoVideoManifest, this.stepsPerSecond) : this.playbackRate;
|
|
4564
4597
|
}
|
|
4565
4598
|
playbackSpeeds() {
|
|
4566
|
-
return this.catalogLayer?.kind === "vector" ?
|
|
4599
|
+
return this.catalogLayer?.kind === "vector" ? at : oa;
|
|
4567
4600
|
}
|
|
4568
4601
|
/**
|
|
4569
4602
|
* Steps per second the active source shows. Vector GeoVideo stays inside
|
|
@@ -4571,29 +4604,29 @@ class Aa {
|
|
|
4571
4604
|
*/
|
|
4572
4605
|
appliedStepsPerSecond() {
|
|
4573
4606
|
if (this.catalogLayer?.kind === "vector") {
|
|
4574
|
-
const e =
|
|
4607
|
+
const e = at;
|
|
4575
4608
|
return Math.min(
|
|
4576
4609
|
e[e.length - 1],
|
|
4577
4610
|
Math.max(e[0], this.stepsPerSecond ?? 1)
|
|
4578
4611
|
);
|
|
4579
4612
|
}
|
|
4580
|
-
return this.stepsPerSecond != null ? this.stepsPerSecond : this.geoVideoManifest ? this.playbackRate *
|
|
4613
|
+
return this.stepsPerSecond != null ? this.stepsPerSecond : this.geoVideoManifest ? this.playbackRate * si(this.geoVideoManifest) : this.playbackRate;
|
|
4581
4614
|
}
|
|
4582
4615
|
/** Apply or clear a time window without rebuilding source metadata or the map layer. */
|
|
4583
4616
|
applyTimeRange(e) {
|
|
4584
4617
|
if (this.assertAlive(), !this.fullTimeMeta)
|
|
4585
4618
|
throw new Error("Set a layer before changing its time range");
|
|
4586
|
-
const t = e == null ? void 0 : { ...e }, i = re(this.fullTimeMeta, t), a = ne(this.fullTimeMeta, t), r =
|
|
4619
|
+
const t = e == null ? void 0 : { ...e }, i = re(this.fullTimeMeta, t), a = ne(this.fullTimeMeta, t), r = V(a.values, this.time);
|
|
4587
4620
|
return this.timeRange = t, this.resolvedTimeRange = i, this.timeMeta = a, this.time = r, this.layer?.setTimeRange([a.min, a.max]), this.layer?.setTime(r), this.getTimeMeta();
|
|
4588
4621
|
}
|
|
4589
4622
|
applyDepth(e) {
|
|
4590
|
-
this.assertAlive(), this.depth =
|
|
4623
|
+
this.assertAlive(), this.depth = V(this.verticalMeta?.values ?? [], e), this.layer?.setDepth(this.depth);
|
|
4591
4624
|
}
|
|
4592
4625
|
applyTimeAndDepth(e, t) {
|
|
4593
|
-
this.assertAlive(), this.time =
|
|
4626
|
+
this.assertAlive(), this.time = V(
|
|
4594
4627
|
this.timeMeta?.values ?? [],
|
|
4595
4628
|
z(e, "time")
|
|
4596
|
-
), this.depth =
|
|
4629
|
+
), this.depth = V(this.verticalMeta?.values ?? [], t), this.layer?.setTimeAndDepth(this.time, this.depth);
|
|
4597
4630
|
}
|
|
4598
4631
|
on(e, t) {
|
|
4599
4632
|
return this.assertAlive(), this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e).add(t), this;
|
|
@@ -4611,7 +4644,7 @@ class Aa {
|
|
|
4611
4644
|
values: t.values,
|
|
4612
4645
|
units: t.units,
|
|
4613
4646
|
current: this.time,
|
|
4614
|
-
granularity:
|
|
4647
|
+
granularity: la(t.values),
|
|
4615
4648
|
timelineKind: this.geoVideoManifest?.timeline.kind
|
|
4616
4649
|
} : {
|
|
4617
4650
|
min: NaN,
|
|
@@ -4627,7 +4660,7 @@ class Aa {
|
|
|
4627
4660
|
return { values: [], label: "depth", current: void 0 };
|
|
4628
4661
|
const e = this.verticalMeta;
|
|
4629
4662
|
return {
|
|
4630
|
-
values:
|
|
4663
|
+
values: Ft(e.values),
|
|
4631
4664
|
name: e.name,
|
|
4632
4665
|
label: e.label,
|
|
4633
4666
|
units: e.units,
|
|
@@ -4648,7 +4681,7 @@ class Aa {
|
|
|
4648
4681
|
const i = this.catalogSource;
|
|
4649
4682
|
return {
|
|
4650
4683
|
type: "image",
|
|
4651
|
-
url:
|
|
4684
|
+
url: ji({
|
|
4652
4685
|
baseUrl: i.baseUrl ?? this.wmtsMetadata?.baseUrl ?? new URL(i.capabilitiesUrl).origin,
|
|
4653
4686
|
layer: i.layer,
|
|
4654
4687
|
style: i.style
|
|
@@ -4662,7 +4695,7 @@ class Aa {
|
|
|
4662
4695
|
type: "gradient",
|
|
4663
4696
|
palette: i,
|
|
4664
4697
|
reverse: this.settings.reversePalette ?? !1,
|
|
4665
|
-
alphaFade:
|
|
4698
|
+
alphaFade: Ve(this.settings),
|
|
4666
4699
|
min: a[0],
|
|
4667
4700
|
max: a[1],
|
|
4668
4701
|
unit: Ye(this.geoVideoManifest.style.unit)
|
|
@@ -4673,14 +4706,14 @@ class Aa {
|
|
|
4673
4706
|
type: "gradient",
|
|
4674
4707
|
palette: e,
|
|
4675
4708
|
reverse: this.settings.reversePalette ?? !1,
|
|
4676
|
-
alphaFade: this.catalogLayer.kind === "scalar" ?
|
|
4709
|
+
alphaFade: this.catalogLayer.kind === "scalar" ? Ve(this.settings) : void 0,
|
|
4677
4710
|
min: t?.[0] ?? this.lastMeta?.min,
|
|
4678
4711
|
max: t?.[1] ?? this.lastMeta?.max,
|
|
4679
4712
|
unit: Ye(this.lastMeta?.unit ?? this.variableUnit)
|
|
4680
4713
|
};
|
|
4681
4714
|
}
|
|
4682
4715
|
getPalettes() {
|
|
4683
|
-
return
|
|
4716
|
+
return xt();
|
|
4684
4717
|
}
|
|
4685
4718
|
getSource() {
|
|
4686
4719
|
return this.catalogSource ? { id: this.catalogSource.id, type: this.catalogSource.type } : void 0;
|
|
@@ -4752,7 +4785,7 @@ class Aa {
|
|
|
4752
4785
|
devicePixelRatio: typeof window < "u" ? window.devicePixelRatio : void 0,
|
|
4753
4786
|
catalogEntry: this.catalogLayer ? {
|
|
4754
4787
|
id: this.catalogLayer.id,
|
|
4755
|
-
title:
|
|
4788
|
+
title: $t(
|
|
4756
4789
|
this.catalogLayer.title,
|
|
4757
4790
|
this.catalog.defaultLocale,
|
|
4758
4791
|
this.catalog.defaultLocale
|
|
@@ -4777,7 +4810,7 @@ class Aa {
|
|
|
4777
4810
|
* color domain of a GeoVideo archive included, as a load sets them.
|
|
4778
4811
|
*/
|
|
4779
4812
|
styledSettings() {
|
|
4780
|
-
const e =
|
|
4813
|
+
const e = Ut(
|
|
4781
4814
|
this.catalogLayer ?? void 0,
|
|
4782
4815
|
this.style
|
|
4783
4816
|
), t = this.catalogSource?.type === "geovideo" ? this.geoVideoManifest : null;
|
|
@@ -4788,7 +4821,7 @@ class Aa {
|
|
|
4788
4821
|
const t = e.colorDomain === void 0 ? e : {
|
|
4789
4822
|
...e,
|
|
4790
4823
|
colorDomain: Q(e.colorDomain)
|
|
4791
|
-
}, i =
|
|
4824
|
+
}, i = fa.some(
|
|
4792
4825
|
(r) => t[r] != null && t[r] !== this.settings[r]
|
|
4793
4826
|
), a = t.particleState != null && t.particleState !== this.settings.particleState;
|
|
4794
4827
|
if (t.colorDomain !== void 0 && (this.colorDomainOverridden = !0), t.palette !== void 0 && (this.paletteOverridden = !0), this.settings = { ...this.settings, ...t }, !!this.layer) {
|
|
@@ -4812,7 +4845,7 @@ class Aa {
|
|
|
4812
4845
|
);
|
|
4813
4846
|
const a = Math.max(1, Math.floor(e.maxPoints ?? 512)), r = this.getQuerySource(i.endpoints.pointSeries);
|
|
4814
4847
|
await r.init();
|
|
4815
|
-
const n = r.getTimeDimension().values, o =
|
|
4848
|
+
const n = r.getTimeDimension().values, o = rt(
|
|
4816
4849
|
i,
|
|
4817
4850
|
r.getTimeDimension()
|
|
4818
4851
|
);
|
|
@@ -4886,7 +4919,7 @@ class Aa {
|
|
|
4886
4919
|
);
|
|
4887
4920
|
return;
|
|
4888
4921
|
}
|
|
4889
|
-
const e = new
|
|
4922
|
+
const e = new ia({
|
|
4890
4923
|
id: this.id,
|
|
4891
4924
|
entry: this.catalogLayer,
|
|
4892
4925
|
sourceConfig: this.catalogSource,
|
|
@@ -4919,7 +4952,7 @@ class Aa {
|
|
|
4919
4952
|
this.pendingTime = null, this.autoplayPending = !1, e.on("loading", () => this.emit("loading")), e.on("loaded", (t) => {
|
|
4920
4953
|
this.lastMeta = t, this.emit("loaded", t);
|
|
4921
4954
|
}), e.on("error", (t) => this.emit("error", t)), e.on("status", (t) => this.emit("status", t)), e.on("frameBuffered", (t) => this.emit("frameBuffered", t)), e.on("cacheInvalidated", () => this.emit("cacheInvalidated")), e.on("timeChange", (t) => {
|
|
4922
|
-
e === this.layer && (this.time =
|
|
4955
|
+
e === this.layer && (this.time = V(this.timeMeta?.values ?? [], t), this.playing && (this.requestedTime = null), this.emit("timeChange", this.time));
|
|
4923
4956
|
}), e.on("playbackChange", (t) => {
|
|
4924
4957
|
e === this.layer && (t && this.preloadNextArchiveChunk(e), t !== this.playing && (this.playing = t, this.emit("playbackChange", t)));
|
|
4925
4958
|
}), e.on("playbackEnd", () => {
|
|
@@ -4990,7 +5023,7 @@ class Aa {
|
|
|
4990
5023
|
async selectSource(e, t, i, a = {}) {
|
|
4991
5024
|
const r = this.sourceTimeRequest(i, a.time), n = Ee(e, t);
|
|
4992
5025
|
if (n) {
|
|
4993
|
-
const o = await this.archiveLevels(e, n), d = o.depths.length > 0 && a.depth != null ?
|
|
5026
|
+
const o = await this.archiveLevels(e, n), d = o.depths.length > 0 && a.depth != null ? ot(o, a.depth) : this.catalogLayer?.id === e.id && this.catalogSource?.id === n.id ? this.archiveLevel : null, c = await this.resolveArchives(e, d), u = c.sources.filter(
|
|
4994
5027
|
(m) => m.id === n.id
|
|
4995
5028
|
);
|
|
4996
5029
|
if (u.length) {
|
|
@@ -5000,7 +5033,7 @@ class Aa {
|
|
|
5000
5033
|
i,
|
|
5001
5034
|
a.time,
|
|
5002
5035
|
d
|
|
5003
|
-
), p =
|
|
5036
|
+
), p = ri(u, { time: m });
|
|
5004
5037
|
if (p && !this.isFailedGeoVideo(p))
|
|
5005
5038
|
return p;
|
|
5006
5039
|
if (t !== "auto" || this.catalogSource?.id === n.id)
|
|
@@ -5053,7 +5086,7 @@ class Aa {
|
|
|
5053
5086
|
if (!e || !t || !this.isArchiveChunk(t))
|
|
5054
5087
|
return null;
|
|
5055
5088
|
const i = this.archiveLevel;
|
|
5056
|
-
return
|
|
5089
|
+
return ni(
|
|
5057
5090
|
(await this.resolveArchives(e, i)).sources,
|
|
5058
5091
|
t,
|
|
5059
5092
|
{
|
|
@@ -5130,8 +5163,8 @@ class Aa {
|
|
|
5130
5163
|
const a = (await this.resolveArchives(e, i)).sources.flatMap(
|
|
5131
5164
|
(n) => n.id === t && n.type === "geovideo" && n.manifestUrl ? [n.manifestUrl] : []
|
|
5132
5165
|
), r = a.filter((n) => !this.chunkTimes.has(n));
|
|
5133
|
-
for (let n = 0; n < r.length; n +=
|
|
5134
|
-
const o = r.slice(n, n +
|
|
5166
|
+
for (let n = 0; n < r.length; n += ct) {
|
|
5167
|
+
const o = r.slice(n, n + ct);
|
|
5135
5168
|
(await Promise.allSettled(
|
|
5136
5169
|
o.map((d) => this.loadChunkManifest(d))
|
|
5137
5170
|
)).forEach((d, c) => {
|
|
@@ -5152,13 +5185,13 @@ class Aa {
|
|
|
5152
5185
|
* and the time shown in agreement.
|
|
5153
5186
|
*/
|
|
5154
5187
|
async archiveSample(e, t, i, a, r = null) {
|
|
5155
|
-
const n = await this.archiveTimes(e, t, r), [o, l] = i && n.length ?
|
|
5188
|
+
const n = await this.archiveTimes(e, t, r), [o, l] = i && n.length ? bt(i, [n[0], n[n.length - 1]]) : [-1 / 0, 1 / 0], d = n.filter((u) => u >= o && u <= l);
|
|
5156
5189
|
if (d.length === 0)
|
|
5157
5190
|
throw new RangeError(
|
|
5158
5191
|
"Time range does not contain any available timestamps"
|
|
5159
5192
|
);
|
|
5160
5193
|
const c = this.sourceTimeRequest(void 0, a).time;
|
|
5161
|
-
return c == null ? d[d.length - 1] :
|
|
5194
|
+
return c == null ? d[d.length - 1] : V(d, c);
|
|
5162
5195
|
}
|
|
5163
5196
|
/**
|
|
5164
5197
|
* Entry whose archive sources are replaced by one fixed-period source per
|
|
@@ -5183,7 +5216,7 @@ class Aa {
|
|
|
5183
5216
|
return n ? this.archiveChunksAt(
|
|
5184
5217
|
e,
|
|
5185
5218
|
a,
|
|
5186
|
-
|
|
5219
|
+
oi(n, a.indexUrl),
|
|
5187
5220
|
n
|
|
5188
5221
|
) : [];
|
|
5189
5222
|
})
|
|
@@ -5204,28 +5237,28 @@ class Aa {
|
|
|
5204
5237
|
if (r && r.expires > Date.now())
|
|
5205
5238
|
return r.chunks;
|
|
5206
5239
|
const n = {
|
|
5207
|
-
expires: Date.now() +
|
|
5208
|
-
chunks:
|
|
5240
|
+
expires: Date.now() + ua,
|
|
5241
|
+
chunks: li(i).then((o) => {
|
|
5209
5242
|
if (a ? !He(o.vertical, a) : o.vertical !== void 0)
|
|
5210
5243
|
throw new Error(`GeoVideo index level does not match: ${i}`);
|
|
5211
5244
|
!a && !this.archiveRoots.has(t.indexUrl) && this.archiveRoots.set(t.indexUrl, {
|
|
5212
5245
|
surface: o.surface,
|
|
5213
5246
|
depths: o.depths ?? []
|
|
5214
5247
|
});
|
|
5215
|
-
const l =
|
|
5248
|
+
const l = ci(
|
|
5216
5249
|
{ ...t, indexUrl: i },
|
|
5217
5250
|
o,
|
|
5218
5251
|
e
|
|
5219
5252
|
);
|
|
5220
|
-
for (const d of
|
|
5253
|
+
for (const d of hi(o, i))
|
|
5221
5254
|
this.chunkLevels.set(d.manifestUrl, a), d.times && this.chunkTimes.set(d.manifestUrl, d.times);
|
|
5222
5255
|
return l;
|
|
5223
|
-
}).catch((o) => (console.warn("[zartigl] GeoVideo archive unavailable:", o), n.expires = Date.now() +
|
|
5256
|
+
}).catch((o) => (console.warn("[zartigl] GeoVideo archive unavailable:", o), n.expires = Date.now() + da, []))
|
|
5224
5257
|
};
|
|
5225
5258
|
return this.archiveChunks.set(i, n), n.chunks;
|
|
5226
5259
|
}
|
|
5227
5260
|
resolveSource(e, t, i) {
|
|
5228
|
-
const a = t === "auto" ?
|
|
5261
|
+
const a = t === "auto" ? qt(e, i) : e.sources.find((r) => r.id === t) ?? he(
|
|
5229
5262
|
e,
|
|
5230
5263
|
[t],
|
|
5231
5264
|
i
|
|
@@ -5286,33 +5319,33 @@ class Aa {
|
|
|
5286
5319
|
a(...t);
|
|
5287
5320
|
}
|
|
5288
5321
|
}
|
|
5289
|
-
function
|
|
5322
|
+
function va(s, e) {
|
|
5290
5323
|
const t = new Date(s).toISOString();
|
|
5291
5324
|
return e === "year" ? t.slice(0, 4) : e === "month" ? t.slice(0, 7) : e === "day" ? t.slice(0, 10) : "";
|
|
5292
5325
|
}
|
|
5293
|
-
function
|
|
5326
|
+
function ya(s, e) {
|
|
5294
5327
|
return e === "year" ? Date.UTC(Number(s), 0, 1) : e === "month" ? (/* @__PURE__ */ new Date(`${s}-01T00:00:00Z`)).getTime() : e === "day" ? (/* @__PURE__ */ new Date(`${s}T00:00:00Z`)).getTime() : (/* @__PURE__ */ new Date(`${s}Z`)).getTime();
|
|
5295
5328
|
}
|
|
5296
|
-
function
|
|
5329
|
+
function ka(s, e, t) {
|
|
5297
5330
|
if (!e || s.length === 0)
|
|
5298
5331
|
return;
|
|
5299
5332
|
if (["year", "month", "day"].includes(t)) {
|
|
5300
5333
|
const a = s.find(
|
|
5301
|
-
(r) =>
|
|
5334
|
+
(r) => va(r, t) === e
|
|
5302
5335
|
);
|
|
5303
5336
|
if (a !== void 0)
|
|
5304
5337
|
return a;
|
|
5305
5338
|
}
|
|
5306
|
-
const i =
|
|
5339
|
+
const i = ya(e, t);
|
|
5307
5340
|
if (Number.isFinite(i))
|
|
5308
5341
|
return s.reduce(
|
|
5309
5342
|
(a, r) => Math.abs(r - i) < Math.abs(a - i) ? r : a
|
|
5310
5343
|
);
|
|
5311
5344
|
}
|
|
5312
|
-
const Vt =
|
|
5345
|
+
const Vt = vt.devDependencies["maplibre-gl"].replace(
|
|
5313
5346
|
/^[^\d]*/,
|
|
5314
5347
|
""
|
|
5315
|
-
),
|
|
5348
|
+
), _a = `https://cdn.jsdelivr.net/npm/maplibre-gl@${Vt}/+esm`, xa = `https://cdn.jsdelivr.net/npm/maplibre-gl@${Vt}/dist/maplibre-gl.css`, ba = `{
|
|
5316
5349
|
version: 8,
|
|
5317
5350
|
sources: {
|
|
5318
5351
|
"eox-cloudless": {
|
|
@@ -5336,10 +5369,10 @@ const Vt = gt.devDependencies["maplibre-gl"].replace(
|
|
|
5336
5369
|
function q(s) {
|
|
5337
5370
|
return JSON.stringify(s);
|
|
5338
5371
|
}
|
|
5339
|
-
function
|
|
5372
|
+
function Sa(s) {
|
|
5340
5373
|
return JSON.stringify(s, null, 2);
|
|
5341
5374
|
}
|
|
5342
|
-
function
|
|
5375
|
+
function Nt(s) {
|
|
5343
5376
|
return s instanceof Date ? `new Date(${q(s.toISOString())})` : typeof s == "string" ? `new Date(${q(s)})` : String(s);
|
|
5344
5377
|
}
|
|
5345
5378
|
function ie(s, e = 6) {
|
|
@@ -5347,25 +5380,25 @@ function ie(s, e = 6) {
|
|
|
5347
5380
|
}
|
|
5348
5381
|
function $(s, e) {
|
|
5349
5382
|
const t = " ".repeat(e);
|
|
5350
|
-
return
|
|
5383
|
+
return Sa(s).split(`
|
|
5351
5384
|
`).map((i) => `${t}${i}`).join(`
|
|
5352
5385
|
`).trimStart();
|
|
5353
5386
|
}
|
|
5354
|
-
function
|
|
5387
|
+
function wa(s, e) {
|
|
5355
5388
|
const t = " ".repeat(e);
|
|
5356
5389
|
return s.split(`
|
|
5357
5390
|
`).map((i) => i.length > 0 ? `${t}${i}` : i).join(`
|
|
5358
5391
|
`);
|
|
5359
5392
|
}
|
|
5360
|
-
const
|
|
5393
|
+
const Ta = (s) => {
|
|
5361
5394
|
const e = s.source ?? "auto";
|
|
5362
5395
|
return s.sourceType ?? (e === "wmts" || e === "geovideo" ? e : "zarr");
|
|
5363
5396
|
};
|
|
5364
|
-
function
|
|
5365
|
-
const { layerKind: e, layerDefaults: t } = s, i =
|
|
5397
|
+
function zt(s) {
|
|
5398
|
+
const { layerKind: e, layerDefaults: t } = s, i = gt(s.style ?? {}, e), a = t === void 0 ? i : Wt(i, ze({ kind: e, defaults: t })), r = a.raster?.opacity, n = Ta(s) !== "wmts" ? a : r === void 0 ? {} : { raster: { opacity: r } };
|
|
5366
5399
|
return Object.keys(n).length ? n : void 0;
|
|
5367
5400
|
}
|
|
5368
|
-
function
|
|
5401
|
+
function Gt(s) {
|
|
5369
5402
|
const { particleState: e, rgba8MaxParticleZoom: t } = s.settings ?? {}, i = Object.fromEntries(
|
|
5370
5403
|
Object.entries({ particleState: e, rgba8MaxParticleZoom: t }).filter(
|
|
5371
5404
|
([, a]) => a !== void 0
|
|
@@ -5373,8 +5406,8 @@ function zt(s) {
|
|
|
5373
5406
|
);
|
|
5374
5407
|
return s.layerKind === "vector" && Object.keys(i).length ? i : void 0;
|
|
5375
5408
|
}
|
|
5376
|
-
function
|
|
5377
|
-
const e = s.source ?? "auto", t =
|
|
5409
|
+
function Fa(s) {
|
|
5410
|
+
const e = s.source ?? "auto", t = zt(s), i = Gt(s), a = [
|
|
5378
5411
|
" idView: widget.opt.view.id,",
|
|
5379
5412
|
" map: widget.opt.map,",
|
|
5380
5413
|
` layer: ${q(s.layerId)},`,
|
|
@@ -5382,7 +5415,7 @@ function ka(s) {
|
|
|
5382
5415
|
];
|
|
5383
5416
|
for (const r of ["title", "subtitle", "description"])
|
|
5384
5417
|
s[r] != null && a.push(` ${r}: ${$(s[r], 10)},`);
|
|
5385
|
-
return s.entry && a.push(` entry: ${$(s.entry, 10)},`), t && a.push(` style: ${$(t, 10)},`), i && a.push(` settings: ${$(i, 10)},`), s.time != null && a.push(` time: ${
|
|
5418
|
+
return s.entry && a.push(` entry: ${$(s.entry, 10)},`), t && a.push(` style: ${$(t, 10)},`), i && a.push(` settings: ${$(i, 10)},`), s.time != null && a.push(` time: ${Nt(s.time)},`), s.timeRange != null && a.push(
|
|
5386
5419
|
` timeRange: ${$(s.timeRange, 10)},`
|
|
5387
5420
|
), s.geoVideo != null && a.push(
|
|
5388
5421
|
` geoVideo: ${$(s.geoVideo, 10)},`
|
|
@@ -5421,14 +5454,14 @@ ${a.join(`
|
|
|
5421
5454
|
};
|
|
5422
5455
|
}`;
|
|
5423
5456
|
}
|
|
5424
|
-
function
|
|
5425
|
-
const e = s.moduleBaseUrl ?? `https://cdn.jsdelivr.net/npm/@fxi/zartigl@${
|
|
5457
|
+
function Ma(s) {
|
|
5458
|
+
const e = s.moduleBaseUrl ?? `https://cdn.jsdelivr.net/npm/@fxi/zartigl@${vt.version}/dist`, t = s.source ?? "auto", i = zt(s), a = Gt(s), r = s.timeRange == null ? "" : ` timeRange: ${$(s.timeRange, 2)},
|
|
5426
5459
|
`, n = s.geoVideo == null ? "" : ` geoVideo: ${$(s.geoVideo, 2)},
|
|
5427
5460
|
`, o = i == null ? "" : ` style: ${$(i, 2)},
|
|
5428
5461
|
`, l = a == null ? "" : ` settings: ${$(a, 2)},
|
|
5429
|
-
`, d = s.time == null ? "" : ` time: ${
|
|
5462
|
+
`, d = s.time == null ? "" : ` time: ${Nt(s.time)},
|
|
5430
5463
|
`, c = s.depth == null ? "" : ` depth: ${s.depth},
|
|
5431
|
-
`, u = s.center ?? [0, 20], f = s.projection ?? "mercator", m = s.mapStyle == null ?
|
|
5464
|
+
`, u = s.center ?? [0, 20], f = s.projection ?? "mercator", m = s.mapStyle == null ? ba : q(s.mapStyle), p = `map.setProjection({ type: ${q(f)} });
|
|
5432
5465
|
map.jumpTo({
|
|
5433
5466
|
center: [${ie(u[0])}, ${ie(u[1])}],
|
|
5434
5467
|
zoom: ${ie(s.zoom ?? 2, 3)},
|
|
@@ -5460,7 +5493,7 @@ const z = new Zartigl({
|
|
|
5460
5493
|
${r}${n}${o}${l}${d}${c}});
|
|
5461
5494
|
|
|
5462
5495
|
await z.init();`;
|
|
5463
|
-
return `import maplibregl from ${q(
|
|
5496
|
+
return `import maplibregl from ${q(_a)};
|
|
5464
5497
|
import { Zartigl } from "${e}/zartigl.js";
|
|
5465
5498
|
import { catalog } from "${e}/catalog.js";
|
|
5466
5499
|
|
|
@@ -5472,18 +5505,18 @@ const map = new maplibregl.Map({
|
|
|
5472
5505
|
});
|
|
5473
5506
|
|
|
5474
5507
|
map.once("style.load", async () => {
|
|
5475
|
-
${
|
|
5508
|
+
${wa(p, 2)}
|
|
5476
5509
|
});`;
|
|
5477
5510
|
}
|
|
5478
|
-
function
|
|
5479
|
-
const e =
|
|
5511
|
+
function Ia(s) {
|
|
5512
|
+
const e = Ma(s);
|
|
5480
5513
|
return `<!doctype html>
|
|
5481
5514
|
<html lang="en">
|
|
5482
5515
|
<head>
|
|
5483
5516
|
<meta charset="UTF-8" />
|
|
5484
5517
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
5485
5518
|
<title>Zartigl demo</title>
|
|
5486
|
-
<link rel="stylesheet" href=${q(
|
|
5519
|
+
<link rel="stylesheet" href=${q(xa)} />
|
|
5487
5520
|
<style>
|
|
5488
5521
|
html, body, #map {
|
|
5489
5522
|
width: 100%;
|
|
@@ -5505,41 +5538,41 @@ ${e}
|
|
|
5505
5538
|
</html>`;
|
|
5506
5539
|
}
|
|
5507
5540
|
export {
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5541
|
+
ui as BACKDROP_OFF,
|
|
5542
|
+
di as COLOR_GRADE_OFF,
|
|
5543
|
+
Oa as COLOR_GRADE_VIBRANT,
|
|
5544
|
+
oa as GEOVIDEO_SPEEDS,
|
|
5512
5545
|
G as GeoVideoLayer,
|
|
5513
|
-
|
|
5514
|
-
|
|
5546
|
+
It as LEGACY_STYLE_SETTINGS,
|
|
5547
|
+
Pt as ParticleSimulation,
|
|
5515
5548
|
me as ScalarLayer,
|
|
5516
|
-
|
|
5549
|
+
at as VECTOR_GEOVIDEO_SPEEDS,
|
|
5517
5550
|
P as VectorLayer,
|
|
5518
|
-
|
|
5551
|
+
Et as VelocityField,
|
|
5519
5552
|
_e as ZarrSource,
|
|
5520
|
-
|
|
5553
|
+
Ca as Zartigl,
|
|
5521
5554
|
xe as ZartiglFrameUnavailableError,
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5555
|
+
Fa as buildMapxWidgetSnippet,
|
|
5556
|
+
Ia as buildStandaloneDemoHtml,
|
|
5557
|
+
Ma as buildStandaloneDemoSnippet,
|
|
5558
|
+
ji as buildWmtsLegendUrl,
|
|
5559
|
+
et as buildWmtsTileUrl,
|
|
5560
|
+
pi as colorGradeToGrade,
|
|
5561
|
+
Xi as deriveDirectionMagnitudeComponents,
|
|
5529
5562
|
Ye as formatUnit,
|
|
5530
|
-
|
|
5531
|
-
|
|
5563
|
+
ti as geoVideoSecondsForTime,
|
|
5564
|
+
Na as geoVideoTimeForSeconds,
|
|
5532
5565
|
we as geoVideoTimelineValues,
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5566
|
+
xt as getPalettes,
|
|
5567
|
+
Aa as getVectorDerivationVariables,
|
|
5568
|
+
gi as gradeToColorGrade,
|
|
5569
|
+
Ba as isHexColor,
|
|
5537
5570
|
Ce as loadGeoVideoManifest,
|
|
5538
|
-
|
|
5539
|
-
|
|
5571
|
+
wt as resolveBackdrop,
|
|
5572
|
+
St as resolveColorGrade,
|
|
5540
5573
|
ke as resolveColorRamp,
|
|
5541
|
-
|
|
5574
|
+
ka as resolveTimeInputSelection,
|
|
5542
5575
|
Ae as splitLegacySettings,
|
|
5543
|
-
|
|
5544
|
-
|
|
5576
|
+
Lt as stitchVelocityChunks,
|
|
5577
|
+
za as validateGeoVideoManifest
|
|
5545
5578
|
};
|