@idetik/core 0.16.2 → 0.17.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -66,7 +66,7 @@ class l {
66
66
  return I.length === 1 ? "0" + I : I;
67
67
  }
68
68
  }
69
- class sC {
69
+ class DC {
70
70
  canvas_;
71
71
  width_ = 0;
72
72
  height_ = 0;
@@ -100,7 +100,7 @@ class sC {
100
100
  this.backgroundColor_ = l.from(A);
101
101
  }
102
102
  }
103
- var DC = `#version 300 es
103
+ var hC = `#version 300 es
104
104
 
105
105
  const float PI = 3.14159265;
106
106
 
@@ -166,7 +166,7 @@ void main() {
166
166
 
167
167
 
168
168
  gl_PointSize = 5.0;
169
- }`, hC = `#version 300 es
169
+ }`, tC = `#version 300 es
170
170
 
171
171
  precision mediump float;
172
172
 
@@ -253,7 +253,7 @@ void main() {
253
253
  rgbColor += value * Color[i];
254
254
  }
255
255
  fragColor = vec4(rgbColor, u_opacity);
256
- }`, tC = `#version 300 es
256
+ }`, yC = `#version 300 es
257
257
 
258
258
  precision mediump float;
259
259
 
@@ -273,7 +273,7 @@ void main() {
273
273
  gl_PointSize = inSize;
274
274
  color = inColor;
275
275
  marker = uint(inMarker);
276
- }`, yC = `#version 300 es
276
+ }`, eC = `#version 300 es
277
277
 
278
278
  precision mediump float;
279
279
 
@@ -293,7 +293,7 @@ void main() {
293
293
  discard;
294
294
  }
295
295
  fragColor = vec4(color.rgb, u_opacity * alpha * color.a);
296
- }`, eC = `#version 300 es
296
+ }`, GC = `#version 300 es
297
297
 
298
298
  layout (location = 0) in vec3 inPosition;
299
299
  layout (location = 1) in vec3 inNormal;
@@ -303,7 +303,7 @@ uniform mat4 ModelView;
303
303
 
304
304
  void main() {
305
305
  gl_Position = Projection * ModelView * vec4(inPosition, 1.0);
306
- }`, GC = `#version 300 es
306
+ }`, nC = `#version 300 es
307
307
 
308
308
  precision mediump float;
309
309
 
@@ -468,7 +468,7 @@ void main() {
468
468
  }
469
469
 
470
470
  fragColor = accumulatedColor;
471
- }`, nC = `#version 300 es
471
+ }`, wC = `#version 300 es
472
472
 
473
473
  precision mediump float;
474
474
  precision highp int;
@@ -558,18 +558,18 @@ void main() {
558
558
 
559
559
  fragColor = vec4(color.rgb, alpha);
560
560
  }`;
561
- const wC = {
561
+ const FC = {
562
562
  projectedLine: {
563
- vertex: DC,
564
- fragment: hC
563
+ vertex: hC,
564
+ fragment: tC
565
565
  },
566
566
  points: {
567
- vertex: tC,
568
- fragment: yC
567
+ vertex: yC,
568
+ fragment: eC
569
569
  },
570
570
  wireframe: {
571
- vertex: eC,
572
- fragment: GC
571
+ vertex: GC,
572
+ fragment: nC
573
573
  },
574
574
  floatScalarImage: {
575
575
  vertex: FA,
@@ -601,7 +601,7 @@ const wC = {
601
601
  },
602
602
  labelImage: {
603
603
  vertex: FA,
604
- fragment: nC
604
+ fragment: wC
605
605
  },
606
606
  floatVolume: {
607
607
  vertex: OI,
@@ -622,7 +622,7 @@ const wC = {
622
622
  info: 20,
623
623
  warn: 30,
624
624
  error: 40
625
- }, FC = {
625
+ }, rC = {
626
626
  debug: "\x1B[90m",
627
627
  // gray
628
628
  info: "\x1B[36m",
@@ -632,7 +632,7 @@ const wC = {
632
632
  error: "\x1B[31m"
633
633
  // red
634
634
  };
635
- function rC() {
635
+ function SC() {
636
636
  const g = typeof process < "u" && typeof process.env?.NODE_ENV == "string" ? process.env.NODE_ENV : void 0;
637
637
  if (g === "production" || g === "development" || g === "test")
638
638
  return g;
@@ -644,7 +644,7 @@ function rC() {
644
644
  return "development";
645
645
  }
646
646
  class U {
647
- static logLevel_ = rC() === "production" ? "warn" : "debug";
647
+ static logLevel_ = SC() === "production" ? "warn" : "debug";
648
648
  static setLogLevel(A) {
649
649
  U.logLevel_ = A;
650
650
  }
@@ -662,7 +662,7 @@ class U {
662
662
  }
663
663
  static log(A, I, B, ...C) {
664
664
  if (Zg[A] < Zg[U.logLevel_]) return;
665
- const Q = (/* @__PURE__ */ new Date()).toISOString(), E = FC[A], i = `[${Q}][${A.toUpperCase()}][${I}]`, o = [`${E}${i}`, B, ...C];
665
+ const Q = (/* @__PURE__ */ new Date()).toISOString(), E = rC[A], i = `[${Q}][${A.toUpperCase()}][${I}]`, o = [`${E}${i}`, B, ...C];
666
666
  switch (A) {
667
667
  case "debug":
668
668
  console.debug(...o);
@@ -679,7 +679,7 @@ class U {
679
679
  }
680
680
  }
681
681
  }
682
- class SC {
682
+ class RC {
683
683
  gl_;
684
684
  program_;
685
685
  uniformInfo_ = /* @__PURE__ */ new Map();
@@ -761,7 +761,7 @@ class SC {
761
761
  for (let I = 0; I < A; I++) {
762
762
  const B = this.gl_.getActiveUniform(this.program_, I);
763
763
  if (B) {
764
- if (!NC.has(B.type))
764
+ if (!cC.has(B.type))
765
765
  throw new Error(
766
766
  `Unsupported uniform type "${B.type}" (GLenum) found in shader program for uniform "${B.name}"`
767
767
  );
@@ -802,7 +802,7 @@ class SC {
802
802
  return Array.from(this.uniformInfo_.keys());
803
803
  }
804
804
  }
805
- const RC = typeof window < "u" ? [
805
+ const NC = typeof window < "u" ? [
806
806
  WebGL2RenderingContext.BOOL,
807
807
  WebGL2RenderingContext.FLOAT,
808
808
  WebGL2RenderingContext.INT,
@@ -827,10 +827,10 @@ const RC = typeof window < "u" ? [
827
827
  WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_3D,
828
828
  WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_CUBE,
829
829
  WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_2D_ARRAY
830
- ] : [], NC = new Set(
831
- RC
830
+ ] : [], cC = new Set(
831
+ NC
832
832
  ), vI = "#pragma inject_defines";
833
- class cC {
833
+ class UC {
834
834
  gl_;
835
835
  programs_ = /* @__PURE__ */ new Map();
836
836
  constructor(A) {
@@ -839,14 +839,14 @@ class cC {
839
839
  use(A) {
840
840
  let I = this.programs_.get(A);
841
841
  if (I === void 0) {
842
- const B = wC[A], C = Pg(
842
+ const B = FC[A], C = Pg(
843
843
  B.vertex,
844
844
  B.vertexDefines
845
845
  ), Q = Pg(
846
846
  B.fragment,
847
847
  B.fragmentDefines
848
848
  );
849
- I = new SC(
849
+ I = new RC(
850
850
  this.gl_,
851
851
  C,
852
852
  Q
@@ -879,9 +879,9 @@ function JB(g) {
879
879
  class yg {
880
880
  id = JB();
881
881
  }
882
- var p = 1e-6, P = typeof Float32Array < "u" ? Float32Array : Array, UC = Math.PI / 180;
883
- function kC(g) {
884
- return g * UC;
882
+ var p = 1e-6, P = typeof Float32Array < "u" ? Float32Array : Array, kC = Math.PI / 180;
883
+ function LC(g) {
884
+ return g * kC;
885
885
  }
886
886
  Math.hypot || (Math.hypot = function() {
887
887
  for (var g = 0, A = arguments.length; A--; )
@@ -892,7 +892,7 @@ function YB() {
892
892
  var g = new P(9);
893
893
  return P != Float32Array && (g[1] = 0, g[2] = 0, g[3] = 0, g[5] = 0, g[6] = 0, g[7] = 0), g[0] = 1, g[4] = 1, g[8] = 1, g;
894
894
  }
895
- function LC(g, A) {
895
+ function JC(g, A) {
896
896
  return g[0] = A[0], g[1] = A[1], g[2] = A[2], g[3] = A[4], g[4] = A[5], g[5] = A[6], g[6] = A[8], g[7] = A[9], g[8] = A[10], g;
897
897
  }
898
898
  function z() {
@@ -907,30 +907,30 @@ function jA(g, A, I) {
907
907
  var B = A[0], C = A[1], Q = A[2], E = A[3], i = A[4], o = A[5], a = A[6], s = A[7], h = A[8], t = A[9], y = A[10], n = A[11], w = A[12], r = A[13], G = A[14], c = A[15], R = I[0], Y = I[1], k = I[2], L = I[3];
908
908
  return g[0] = R * B + Y * i + k * h + L * w, g[1] = R * C + Y * o + k * t + L * r, g[2] = R * Q + Y * a + k * y + L * G, g[3] = R * E + Y * s + k * n + L * c, R = I[4], Y = I[5], k = I[6], L = I[7], g[4] = R * B + Y * i + k * h + L * w, g[5] = R * C + Y * o + k * t + L * r, g[6] = R * Q + Y * a + k * y + L * G, g[7] = R * E + Y * s + k * n + L * c, R = I[8], Y = I[9], k = I[10], L = I[11], g[8] = R * B + Y * i + k * h + L * w, g[9] = R * C + Y * o + k * t + L * r, g[10] = R * Q + Y * a + k * y + L * G, g[11] = R * E + Y * s + k * n + L * c, R = I[12], Y = I[13], k = I[14], L = I[15], g[12] = R * B + Y * i + k * h + L * w, g[13] = R * C + Y * o + k * t + L * r, g[14] = R * Q + Y * a + k * y + L * G, g[15] = R * E + Y * s + k * n + L * c, g;
909
909
  }
910
- function JC(g, A) {
910
+ function YC(g, A) {
911
911
  return g[0] = A[0], g[1] = 0, g[2] = 0, g[3] = 0, g[4] = 0, g[5] = A[1], g[6] = 0, g[7] = 0, g[8] = 0, g[9] = 0, g[10] = A[2], g[11] = 0, g[12] = 0, g[13] = 0, g[14] = 0, g[15] = 1, g;
912
912
  }
913
- function YC(g, A, I, B) {
913
+ function dC(g, A, I, B) {
914
914
  var C = A[0], Q = A[1], E = A[2], i = A[3], o = C + C, a = Q + Q, s = E + E, h = C * o, t = C * a, y = C * s, n = Q * a, w = Q * s, r = E * s, G = i * o, c = i * a, R = i * s, Y = B[0], k = B[1], L = B[2];
915
915
  return g[0] = (1 - (n + r)) * Y, g[1] = (t + R) * Y, g[2] = (y - c) * Y, g[3] = 0, g[4] = (t - R) * k, g[5] = (1 - (h + r)) * k, g[6] = (w + G) * k, g[7] = 0, g[8] = (y + c) * L, g[9] = (w - G) * L, g[10] = (1 - (h + n)) * L, g[11] = 0, g[12] = I[0], g[13] = I[1], g[14] = I[2], g[15] = 1, g;
916
916
  }
917
- function dC(g, A, I, B, C) {
917
+ function MC(g, A, I, B, C) {
918
918
  var Q = 1 / Math.tan(A / 2), E;
919
919
  return g[0] = Q / I, g[1] = 0, g[2] = 0, g[3] = 0, g[4] = 0, g[5] = Q, g[6] = 0, g[7] = 0, g[8] = 0, g[9] = 0, g[11] = -1, g[12] = 0, g[13] = 0, g[15] = 0, C != null && C !== 1 / 0 ? (E = 1 / (B - C), g[10] = (C + B) * E, g[14] = 2 * C * B * E) : (g[10] = -1, g[14] = -2 * B), g;
920
920
  }
921
- var MC = dC;
922
- function KC(g, A, I, B, C, Q, E) {
921
+ var KC = MC;
922
+ function HC(g, A, I, B, C, Q, E) {
923
923
  var i = 1 / (A - I), o = 1 / (B - C), a = 1 / (Q - E);
924
924
  return g[0] = -2 * i, g[1] = 0, g[2] = 0, g[3] = 0, g[4] = 0, g[5] = -2 * o, g[6] = 0, g[7] = 0, g[8] = 0, g[9] = 0, g[10] = 2 * a, g[11] = 0, g[12] = (A + I) * i, g[13] = (C + B) * o, g[14] = (E + Q) * a, g[15] = 1, g;
925
925
  }
926
- var HC = KC;
927
- function qC(g, A, I, B) {
926
+ var qC = HC;
927
+ function lC(g, A, I, B) {
928
928
  var C = A[0], Q = A[1], E = A[2], i = B[0], o = B[1], a = B[2], s = C - I[0], h = Q - I[1], t = E - I[2], y = s * s + h * h + t * t;
929
929
  y > 0 && (y = 1 / Math.sqrt(y), s *= y, h *= y, t *= y);
930
930
  var n = o * t - a * h, w = a * s - i * t, r = i * h - o * s;
931
931
  return y = n * n + w * w + r * r, y > 0 && (y = 1 / Math.sqrt(y), n *= y, w *= y, r *= y), g[0] = n, g[1] = w, g[2] = r, g[3] = 0, g[4] = h * r - t * w, g[5] = t * n - s * r, g[6] = s * w - h * n, g[7] = 0, g[8] = s, g[9] = h, g[10] = t, g[11] = 0, g[12] = C, g[13] = Q, g[14] = E, g[15] = 1, g;
932
932
  }
933
- function lC(g, A) {
933
+ function fC(g, A) {
934
934
  var I = g[0], B = g[1], C = g[2], Q = g[3], E = g[4], i = g[5], o = g[6], a = g[7], s = g[8], h = g[9], t = g[10], y = g[11], n = g[12], w = g[13], r = g[14], G = g[15], c = A[0], R = A[1], Y = A[2], k = A[3], L = A[4], m = A[5], x = A[6], b = A[7], O = A[8], V = A[9], EA = A[10], iA = A[11], T = A[12], xg = A[13], Wg = A[14], bg = A[15];
935
935
  return Math.abs(I - c) <= p * Math.max(1, Math.abs(I), Math.abs(c)) && Math.abs(B - R) <= p * Math.max(1, Math.abs(B), Math.abs(R)) && Math.abs(C - Y) <= p * Math.max(1, Math.abs(C), Math.abs(Y)) && Math.abs(Q - k) <= p * Math.max(1, Math.abs(Q), Math.abs(k)) && Math.abs(E - L) <= p * Math.max(1, Math.abs(E), Math.abs(L)) && Math.abs(i - m) <= p * Math.max(1, Math.abs(i), Math.abs(m)) && Math.abs(o - x) <= p * Math.max(1, Math.abs(o), Math.abs(x)) && Math.abs(a - b) <= p * Math.max(1, Math.abs(a), Math.abs(b)) && Math.abs(s - O) <= p * Math.max(1, Math.abs(s), Math.abs(O)) && Math.abs(h - V) <= p * Math.max(1, Math.abs(h), Math.abs(V)) && Math.abs(t - EA) <= p * Math.max(1, Math.abs(t), Math.abs(EA)) && Math.abs(y - iA) <= p * Math.max(1, Math.abs(y), Math.abs(iA)) && Math.abs(n - T) <= p * Math.max(1, Math.abs(n), Math.abs(T)) && Math.abs(w - xg) <= p * Math.max(1, Math.abs(w), Math.abs(xg)) && Math.abs(r - Wg) <= p * Math.max(1, Math.abs(r), Math.abs(Wg)) && Math.abs(G - bg) <= p * Math.max(1, Math.abs(G), Math.abs(bg));
936
936
  }
@@ -959,10 +959,10 @@ function rA(g, A, I, B) {
959
959
  function qA(g, A, I) {
960
960
  return g[0] = A[0] + I[0], g[1] = A[1] + I[1], g[2] = A[2] + I[2], g;
961
961
  }
962
- function fC(g, A, I) {
962
+ function pC(g, A, I) {
963
963
  return g[0] = A[0] - I[0], g[1] = A[1] - I[1], g[2] = A[2] - I[2], g;
964
964
  }
965
- function pC(g, A, I) {
965
+ function mC(g, A, I) {
966
966
  return g[0] = A[0] * I[0], g[1] = A[1] * I[1], g[2] = A[2] * I[2], g;
967
967
  }
968
968
  function lA(g, A, I) {
@@ -979,7 +979,7 @@ function Vg(g, A) {
979
979
  var I = A[0] - g[0], B = A[1] - g[1], C = A[2] - g[2];
980
980
  return I * I + B * B + C * C;
981
981
  }
982
- function mC(g, A) {
982
+ function uC(g, A) {
983
983
  var I = A[0], B = A[1], C = A[2], Q = I * I + B * B + C * C;
984
984
  return Q > 0 && (Q = 1 / Math.sqrt(Q)), g[0] = A[0] * Q, g[1] = A[1] * Q, g[2] = A[2] * Q, g;
985
985
  }
@@ -990,7 +990,7 @@ function XI(g, A, I) {
990
990
  var B = A[0], C = A[1], Q = A[2], E = I[0], i = I[1], o = I[2];
991
991
  return g[0] = C * o - Q * i, g[1] = Q * E - B * o, g[2] = B * i - C * E, g;
992
992
  }
993
- function uC(g, A, I, B, C, Q) {
993
+ function TC(g, A, I, B, C, Q) {
994
994
  var E = 1 - Q, i = E * E, o = Q * Q, a = i * E, s = 3 * Q * i, h = 3 * o * E, t = o * Q;
995
995
  return g[0] = A[0] * a + I[0] * s + B[0] * h + C[0] * t, g[1] = A[1] * a + I[1] * s + B[1] * h + C[1] * t, g[2] = A[2] * a + I[2] * s + B[2] * h + C[2] * t, g;
996
996
  }
@@ -998,14 +998,14 @@ function uI(g, A, I) {
998
998
  var B = A[0], C = A[1], Q = A[2], E = I[3] * B + I[7] * C + I[11] * Q + I[15];
999
999
  return E = E || 1, g[0] = (I[0] * B + I[4] * C + I[8] * Q + I[12]) / E, g[1] = (I[1] * B + I[5] * C + I[9] * Q + I[13]) / E, g[2] = (I[2] * B + I[6] * C + I[10] * Q + I[14]) / E, g;
1000
1000
  }
1001
- function TC(g) {
1001
+ function xC(g) {
1002
1002
  return g[0] = 0, g[1] = 0, g[2] = 0, g;
1003
1003
  }
1004
1004
  function MB(g, A) {
1005
1005
  var I = g[0], B = g[1], C = g[2], Q = A[0], E = A[1], i = A[2];
1006
1006
  return Math.abs(I - Q) <= p * Math.max(1, Math.abs(I), Math.abs(Q)) && Math.abs(B - E) <= p * Math.max(1, Math.abs(B), Math.abs(E)) && Math.abs(C - i) <= p * Math.max(1, Math.abs(C), Math.abs(i));
1007
1007
  }
1008
- var UI = fC, xC = eg;
1008
+ var UI = pC, WC = eg;
1009
1009
  (function() {
1010
1010
  var g = f();
1011
1011
  return function(A, I, B, C, Q, E) {
@@ -1019,7 +1019,7 @@ function fA() {
1019
1019
  var g = new P(4);
1020
1020
  return P != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0, g[3] = 0), g;
1021
1021
  }
1022
- function WC(g) {
1022
+ function bC(g) {
1023
1023
  var A = new P(4);
1024
1024
  return A[0] = g[0], A[1] = g[1], A[2] = g[2], A[3] = g[3], A;
1025
1025
  }
@@ -1027,13 +1027,13 @@ function kI(g, A, I, B) {
1027
1027
  var C = new P(4);
1028
1028
  return C[0] = g, C[1] = A, C[2] = I, C[3] = B, C;
1029
1029
  }
1030
- function bC(g, A) {
1030
+ function ZC(g, A) {
1031
1031
  return g[0] = A[0], g[1] = A[1], g[2] = A[2], g[3] = A[3], g;
1032
1032
  }
1033
- function ZC(g, A, I) {
1033
+ function PC(g, A, I) {
1034
1034
  return g[0] = A[0] * I, g[1] = A[1] * I, g[2] = A[2] * I, g[3] = A[3] * I, g;
1035
1035
  }
1036
- function PC(g, A) {
1036
+ function OC(g, A) {
1037
1037
  var I = A[0], B = A[1], C = A[2], Q = A[3], E = I * I + B * B + C * C + Q * Q;
1038
1038
  return E > 0 && (E = 1 / Math.sqrt(E)), g[0] = I * E, g[1] = B * E, g[2] = C * E, g[3] = Q * E, g;
1039
1039
  }
@@ -1054,12 +1054,12 @@ function Cg() {
1054
1054
  var g = new P(4);
1055
1055
  return P != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0), g[3] = 1, g;
1056
1056
  }
1057
- function OC(g, A, I) {
1057
+ function VC(g, A, I) {
1058
1058
  I = I * 0.5;
1059
1059
  var B = Math.sin(I);
1060
1060
  return g[0] = B * A[0], g[1] = B * A[1], g[2] = B * A[2], g[3] = Math.cos(I), g;
1061
1061
  }
1062
- function VC(g, A, I) {
1062
+ function vC(g, A, I) {
1063
1063
  var B = A[0], C = A[1], Q = A[2], E = A[3], i = I[0], o = I[1], a = I[2], s = I[3];
1064
1064
  return g[0] = B * s + E * i + C * a - Q * o, g[1] = C * s + E * o + Q * i - B * a, g[2] = Q * s + E * a + B * o - C * i, g[3] = E * s - B * i - C * o - Q * a, g;
1065
1065
  }
@@ -1079,12 +1079,12 @@ function KB(g, A) {
1079
1079
  }
1080
1080
  return g;
1081
1081
  }
1082
- var vC = WC, XC = bC, Gg = PC;
1082
+ var XC = bC, jC = ZC, Gg = OC;
1083
1083
  (function() {
1084
1084
  var g = f(), A = q(1, 0, 0), I = q(0, 1, 0);
1085
1085
  return function(B, C, Q) {
1086
1086
  var E = dB(C, Q);
1087
- return E < -0.999999 ? (XI(g, A, C), xC(g) < 1e-6 && XI(g, I, C), mC(g, g), OC(B, g, Math.PI), B) : E > 0.999999 ? (B[0] = 0, B[1] = 0, B[2] = 0, B[3] = 1, B) : (XI(g, C, Q), B[0] = g[0], B[1] = g[1], B[2] = g[2], B[3] = 1 + E, Gg(B, B));
1087
+ return E < -0.999999 ? (XI(g, A, C), WC(g) < 1e-6 && XI(g, I, C), uC(g, g), VC(B, g, Math.PI), B) : E > 0.999999 ? (B[0] = 0, B[1] = 0, B[2] = 0, B[3] = 1, B) : (XI(g, C, Q), B[0] = g[0], B[1] = g[1], B[2] = g[2], B[3] = 1 + E, Gg(B, B));
1088
1088
  };
1089
1089
  })();
1090
1090
  (function() {
@@ -1111,15 +1111,15 @@ function Z(g, A) {
1111
1111
  var I = new P(2);
1112
1112
  return I[0] = g, I[1] = A, I;
1113
1113
  }
1114
- function jC(g, A) {
1114
+ function zC(g, A) {
1115
1115
  var I = A[0] - g[0], B = A[1] - g[1];
1116
1116
  return Math.hypot(I, B);
1117
1117
  }
1118
- function zC(g) {
1118
+ function _C(g) {
1119
1119
  var A = g[0], I = g[1];
1120
1120
  return A * A + I * I;
1121
1121
  }
1122
- function _C(g, A, I, B) {
1122
+ function $C(g, A, I, B) {
1123
1123
  var C = A[0], Q = A[1];
1124
1124
  return g[0] = C + B * (I[0] - C), g[1] = Q + B * (I[1] - Q), g;
1125
1125
  }
@@ -1181,7 +1181,7 @@ class SA {
1181
1181
  uI(Q, E, A), this.expandWithPoint(Q);
1182
1182
  }
1183
1183
  }
1184
- const $C = {
1184
+ const AQ = {
1185
1185
  position: 0,
1186
1186
  normal: 1,
1187
1187
  uv: 2,
@@ -1245,7 +1245,7 @@ class WA extends yg {
1245
1245
  return this.attributes_.find((I) => I.type === A);
1246
1246
  }
1247
1247
  }
1248
- class AQ {
1248
+ class IQ {
1249
1249
  gl_;
1250
1250
  buffers_ = /* @__PURE__ */ new Map();
1251
1251
  currentGeometry_ = null;
@@ -1281,7 +1281,7 @@ class AQ {
1281
1281
  this.gl_.bindBuffer(C, Q), this.gl_.bufferData(C, B, this.gl_.STATIC_DRAW);
1282
1282
  const { attributes: E, strideBytes: i } = A;
1283
1283
  E.forEach((s) => {
1284
- const h = $C[s.type];
1284
+ const h = AQ[s.type];
1285
1285
  this.gl_.vertexAttribPointer(
1286
1286
  h,
1287
1287
  s.itemSize,
@@ -1300,7 +1300,7 @@ class AQ {
1300
1300
  this.buffers_.set(A, o), this.gl_.bindVertexArray(null);
1301
1301
  }
1302
1302
  }
1303
- class IQ {
1303
+ class gQ {
1304
1304
  gl_;
1305
1305
  textures_ = /* @__PURE__ */ new Map();
1306
1306
  currentTexture_ = null;
@@ -1580,7 +1580,7 @@ class $ {
1580
1580
  return { x: A, y: I, width: B, height: C };
1581
1581
  }
1582
1582
  }
1583
- class gQ {
1583
+ class BQ {
1584
1584
  gl_;
1585
1585
  enabledCapabilities_ = /* @__PURE__ */ new Map();
1586
1586
  depthMaskEnabled_ = null;
@@ -1680,8 +1680,8 @@ class gQ {
1680
1680
  A ? this.enable(this.gl_.STENCIL_TEST) : this.disable(this.gl_.STENCIL_TEST);
1681
1681
  }
1682
1682
  }
1683
- const BQ = JC(z(), [1, -1, 1]);
1684
- class CQ extends sC {
1683
+ const CQ = YC(z(), [1, -1, 1]);
1684
+ class QQ extends DC {
1685
1685
  gl_;
1686
1686
  programs_;
1687
1687
  bindings_;
@@ -1700,7 +1700,7 @@ class CQ extends sC {
1700
1700
  this.gl_ = I, U.info(
1701
1701
  "WebGLRenderer",
1702
1702
  `WebGL version ${I.getParameter(I.VERSION)}`
1703
- ), this.programs_ = new cC(I), this.bindings_ = new AQ(I), this.textures_ = new IQ(I), this.state_ = new gQ(I), this.initStencil(), this.resize(this.canvas.width, this.canvas.height);
1703
+ ), this.programs_ = new UC(I), this.bindings_ = new IQ(I), this.textures_ = new gQ(I), this.state_ = new BQ(I), this.initStencil(), this.resize(this.canvas.width, this.canvas.height);
1704
1704
  }
1705
1705
  render(A) {
1706
1706
  let I = getComputedStyle(A.element).visibility !== "hidden";
@@ -1764,7 +1764,7 @@ class CQ extends sC {
1764
1764
  I.transform.matrix
1765
1765
  ), i = jA(
1766
1766
  z(),
1767
- BQ,
1767
+ CQ,
1768
1768
  Q.projectionMatrix
1769
1769
  ), o = [this.canvas.width, this.canvas.height], a = I.getUniforms(), h = {
1770
1770
  ...B.getUniforms(),
@@ -1831,12 +1831,12 @@ class CQ extends sC {
1831
1831
  this.gl_.clearColor(...this.backgroundColor.rgba), this.gl_.clear(this.gl_.COLOR_BUFFER_BIT | this.gl_.DEPTH_BUFFER_BIT), this.state_.setDepthTesting(!0), this.gl_.depthFunc(this.gl_.LEQUAL);
1832
1832
  }
1833
1833
  }
1834
- const QQ = 8;
1835
- class EQ {
1834
+ const EQ = 8;
1835
+ class iQ {
1836
1836
  maxConcurrent_;
1837
1837
  pending_ = [];
1838
1838
  running_ = /* @__PURE__ */ new Map();
1839
- constructor(A = QQ) {
1839
+ constructor(A = EQ) {
1840
1840
  this.maxConcurrent_ = Math.max(1, A);
1841
1841
  }
1842
1842
  enqueue(A, I) {
@@ -1902,7 +1902,7 @@ function zg(g) {
1902
1902
  `Unsupported chunk data type: ${g}. Supported data types: ${A}`
1903
1903
  ), !1;
1904
1904
  }
1905
- function iQ(g, A) {
1905
+ function oQ(g, A) {
1906
1906
  return Math.round((A - g.translation) / g.scale);
1907
1907
  }
1908
1908
  function Qg(g, A, I = 1e-6) {
@@ -1912,7 +1912,7 @@ function NA(g, A, I) {
1912
1912
  return Math.max(A, Math.min(I, g));
1913
1913
  }
1914
1914
  const ng = Symbol("INTERNAL_POLICY_KEY");
1915
- class oQ {
1915
+ class aQ {
1916
1916
  store_;
1917
1917
  policy_;
1918
1918
  policyChanged_ = !1;
@@ -1921,6 +1921,7 @@ class oQ {
1921
1921
  lastViewProjection_ = null;
1922
1922
  lastZBounds_;
1923
1923
  lastTCoord_;
1924
+ lastCCoords_;
1924
1925
  sourceMaxSquareDistance2D_;
1925
1926
  chunkViewStates_ = /* @__PURE__ */ new Map();
1926
1927
  isDisposed_ = !1;
@@ -1931,7 +1932,7 @@ class oQ {
1931
1932
  this.policy_.profile
1932
1933
  );
1933
1934
  const B = this.store_.dimensions, C = B.x.lods[0], Q = B.y.lods[0];
1934
- this.sourceMaxSquareDistance2D_ = zC(
1935
+ this.sourceMaxSquareDistance2D_ = _C(
1935
1936
  Z(C.size * C.scale, Q.size * Q.scale)
1936
1937
  );
1937
1938
  }
@@ -1951,6 +1952,9 @@ class oQ {
1951
1952
  get lodCount() {
1952
1953
  return this.store_.lodCount;
1953
1954
  }
1955
+ get channelCount() {
1956
+ return this.store_.channelCount;
1957
+ }
1954
1958
  getChunksToRender(A) {
1955
1959
  const I = this.store_.getTimeIndex(A), B = this.store_.getChunksAtTime(I), C = B.filter(
1956
1960
  (i) => i.lod === this.currentLOD_ && this.chunkViewStates_.get(i)?.visible === !0 && i.state === "loaded"
@@ -1971,7 +1975,7 @@ class oQ {
1971
1975
  const Q = B.getWorldViewRect(), E = Math.abs(Q.max[0] - Q.min[0]), i = I.element, o = I.getBoxRelativeTo(i).toRect().width, a = E / o, s = Math.log2(1 / a);
1972
1976
  this.setLOD(s);
1973
1977
  const h = this.getZBounds(A);
1974
- if (!(this.policyChanged_ || this.viewBounds2DChanged(Q) || this.zBoundsChanged(h) || this.lastTCoord_ !== A.t)) return;
1978
+ if (!(this.policyChanged_ || this.viewBounds2DChanged(Q) || this.zBoundsChanged(h) || this.lastTCoord_ !== A.t || this.cCoordsChanged(A.c))) return;
1975
1979
  const y = this.store_.getTimeIndex(A);
1976
1980
  if (this.store_.getChunksAtTime(y).length === 0) {
1977
1981
  U.warn(
@@ -1981,7 +1985,7 @@ class oQ {
1981
1985
  return;
1982
1986
  }
1983
1987
  const w = HB();
1984
- _C(w, Q.min, Q.max, 0.5);
1988
+ $C(w, Q.min, Q.max, 0.5);
1985
1989
  const [r, G] = this.getZBounds(A), c = new SA(
1986
1990
  q(Q.min[0], Q.min[1], r),
1987
1991
  q(Q.max[0], Q.max[1], G)
@@ -1996,7 +2000,7 @@ class oQ {
1996
2000
  A,
1997
2001
  c,
1998
2002
  w
1999
- ), this.policyChanged_ = !1, this.lastViewBounds2D_ = Q.clone(), this.lastZBounds_ = h, this.lastTCoord_ = A.t;
2003
+ ), this.policyChanged_ = !1, this.lastViewBounds2D_ = Q.clone(), this.lastZBounds_ = h, this.lastTCoord_ = A.t, this.lastCCoords_ = A.c ? [...A.c] : void 0;
2000
2004
  }
2001
2005
  updateChunksForVolume(A, I) {
2002
2006
  const B = jA(
@@ -2004,7 +2008,7 @@ class oQ {
2004
2008
  I.camera.projectionMatrix,
2005
2009
  I.camera.viewMatrix
2006
2010
  );
2007
- if (!(this.policyChanged_ || this.hasViewProjectionChanged(B) || this.lastTCoord_ !== A.t)) return;
2011
+ if (!(this.policyChanged_ || this.hasViewProjectionChanged(B) || this.lastTCoord_ !== A.t || this.cCoordsChanged(A.c))) return;
2008
2012
  const Q = this.store_.getTimeIndex(A), E = this.store_.getChunksAtTime(Q);
2009
2013
  if (E.length === 0) {
2010
2014
  U.warn(
@@ -2036,7 +2040,7 @@ class oQ {
2036
2040
  // All chunks have the same ordering for volume rendering
2037
2041
  });
2038
2042
  }
2039
- A.t !== void 0 && this.markTimeChunksForPrefetchVolume(Q, A), this.policyChanged_ = !1, this.lastTCoord_ = A.t, this.lastViewProjection_ = B;
2043
+ A.t !== void 0 && this.markTimeChunksForPrefetchVolume(Q, A), this.policyChanged_ = !1, this.lastTCoord_ = A.t, this.lastCCoords_ = A.c ? [...A.c] : void 0, this.lastViewProjection_ = B;
2040
2044
  }
2041
2045
  allVisibleFallbackLODLoaded(A) {
2042
2046
  const I = this.store_.getTimeIndex(A), B = this.fallbackLOD(), C = this.store_.getChunksAtTime(I).filter((Q) => Q.visible && Q.lod === B);
@@ -2072,7 +2076,7 @@ class oQ {
2072
2076
  s !== this.currentLOD_ && (this.currentLOD_ = s);
2073
2077
  }
2074
2078
  isChunkChannelInSlice(A, I) {
2075
- return I.c === void 0 || I.c === A.chunkIndex.c;
2079
+ return I.c === void 0 ? !0 : I.c.length === 0 ? !1 : I.c.includes(A.chunkIndex.c);
2076
2080
  }
2077
2081
  updateChunksAtTimeIndex(A, I, B, C) {
2078
2082
  const Q = this.getPaddedBounds(B), E = this.store_.getChunksAtTime(A), i = this.fallbackLOD();
@@ -2179,11 +2183,14 @@ class oQ {
2179
2183
  return this.lastViewBounds2D_ === null || !zI(this.lastViewBounds2D_.min, A.min) || !zI(this.lastViewBounds2D_.max, A.max);
2180
2184
  }
2181
2185
  hasViewProjectionChanged(A) {
2182
- return this.lastViewProjection_ === null || !lC(this.lastViewProjection_, A);
2186
+ return this.lastViewProjection_ === null || !fC(this.lastViewProjection_, A);
2183
2187
  }
2184
2188
  zBoundsChanged(A) {
2185
2189
  return !this.lastZBounds_ || !zI(this.lastZBounds_, A);
2186
2190
  }
2191
+ cCoordsChanged(A) {
2192
+ return !this.lastCCoords_ && !A ? !1 : !this.lastCCoords_ || !A || this.lastCCoords_.length !== A.length ? !0 : !this.lastCCoords_.every((I, B) => I === A[B]);
2193
+ }
2187
2194
  getPaddedBounds(A) {
2188
2195
  const I = this.store_.dimensions, B = I.x.lods[this.currentLOD_], C = I.y.lods[this.currentLOD_], Q = I.z?.lods[this.currentLOD_], E = B.chunkSize * B.scale * this.policy_.prefetch.x, i = C.chunkSize * C.scale * this.policy_.prefetch.y;
2189
2196
  let o = 0;
@@ -2211,7 +2218,7 @@ class oQ {
2211
2218
  function _I(g) {
2212
2219
  g.visible = !1, g.prefetch = !1, g.priority = null, g.orderKey = null;
2213
2220
  }
2214
- class aQ {
2221
+ class sQ {
2215
2222
  chunks_;
2216
2223
  loader_;
2217
2224
  lowestResLOD_;
@@ -2269,11 +2276,14 @@ class aQ {
2269
2276
  return this.chunks_[A];
2270
2277
  }
2271
2278
  getTimeIndex(A) {
2272
- return A.t === void 0 || this.dimensions_.t === void 0 ? 0 : iQ(this.dimensions_.t.lods[0], A.t);
2279
+ return A.t === void 0 || this.dimensions_.t === void 0 ? 0 : oQ(this.dimensions_.t.lods[0], A.t);
2273
2280
  }
2274
2281
  get lodCount() {
2275
2282
  return this.lowestResLOD_ + 1;
2276
2283
  }
2284
+ get channelCount() {
2285
+ return this.dimensions_.c?.lods[0].size ?? 1;
2286
+ }
2277
2287
  get dimensions() {
2278
2288
  return this.dimensions_;
2279
2289
  }
@@ -2284,7 +2294,7 @@ class aQ {
2284
2294
  return this.loader_.loadChunkData(A, I);
2285
2295
  }
2286
2296
  createView(A) {
2287
- const I = new oQ(this, A);
2297
+ const I = new aQ(this, A);
2288
2298
  return this.views_.push(I), this.hasHadViews_ = !0, I;
2289
2299
  }
2290
2300
  get views() {
@@ -2377,10 +2387,10 @@ class aQ {
2377
2387
  };
2378
2388
  }
2379
2389
  }
2380
- class sQ {
2390
+ class DQ {
2381
2391
  stores_ = /* @__PURE__ */ new Map();
2382
2392
  pendingStores_ = /* @__PURE__ */ new Map();
2383
- queue_ = new EQ();
2393
+ queue_ = new iQ();
2384
2394
  get queueStats() {
2385
2395
  return {
2386
2396
  pending: this.queue_.pendingCount,
@@ -2399,7 +2409,7 @@ class sQ {
2399
2409
  return B;
2400
2410
  const Q = (async () => {
2401
2411
  const i = await A.open();
2402
- return new aQ(i);
2412
+ return new sQ(i);
2403
2413
  })();
2404
2414
  this.pendingStores_.set(A, Q);
2405
2415
  const E = await Q;
@@ -2471,14 +2481,14 @@ vA.Panel = function(g, A, I, B) {
2471
2481
  }
2472
2482
  };
2473
2483
  };
2474
- function DQ({ scale: g } = { scale: 1.5 }) {
2484
+ function hQ({ scale: g } = { scale: 1.5 }) {
2475
2485
  const A = new vA(g);
2476
2486
  return A.showPanel(
2477
2487
  0
2478
2488
  /* 0 = fps, 1 = ms, 2 = mb */
2479
2489
  ), document.body.appendChild(A.dom), A;
2480
2490
  }
2481
- class hQ {
2491
+ class tQ {
2482
2492
  layers_ = [];
2483
2493
  callbacks_ = [];
2484
2494
  context_;
@@ -2535,10 +2545,10 @@ const Eg = [
2535
2545
  "pointercancel",
2536
2546
  "wheel"
2537
2547
  ];
2538
- function tQ(g) {
2548
+ function yQ(g) {
2539
2549
  return Eg.includes(g);
2540
2550
  }
2541
- class yQ {
2551
+ class eQ {
2542
2552
  propagationStopped_ = !1;
2543
2553
  type;
2544
2554
  event;
@@ -2554,7 +2564,7 @@ class yQ {
2554
2564
  this.propagationStopped_ = !0;
2555
2565
  }
2556
2566
  }
2557
- class eQ {
2567
+ class GQ {
2558
2568
  listeners_ = [];
2559
2569
  element_;
2560
2570
  isConnected_ = !1;
@@ -2593,16 +2603,16 @@ class eQ {
2593
2603
  });
2594
2604
  }
2595
2605
  handleEvent = (A) => {
2596
- if (!tQ(A.type)) {
2606
+ if (!yQ(A.type)) {
2597
2607
  U.error("EventDispatcher", `Unsupported event type ${A.type}`);
2598
2608
  return;
2599
2609
  }
2600
- const I = new yQ(A.type, A);
2610
+ const I = new eQ(A.type, A);
2601
2611
  for (const B of this.listeners_)
2602
2612
  if (B(I), I.propagationStopped) break;
2603
2613
  };
2604
2614
  }
2605
- class GQ {
2615
+ class nQ {
2606
2616
  id;
2607
2617
  element;
2608
2618
  camera;
@@ -2610,7 +2620,7 @@ class GQ {
2610
2620
  events;
2611
2621
  cameraControls;
2612
2622
  constructor(A) {
2613
- this.id = A.id, this.element = A.element, this.camera = A.camera, this.layerManager = A.layerManager, this.cameraControls = A.cameraControls, this.updateAspectRatio(), this.events = new eQ(this.element), this.events.addEventListener((I) => {
2623
+ this.id = A.id, this.element = A.element, this.camera = A.camera, this.layerManager = A.layerManager, this.cameraControls = A.cameraControls, this.updateAspectRatio(), this.events = new GQ(this.element), this.events.addEventListener((I) => {
2614
2624
  if (I.event instanceof PointerEvent || I.event instanceof WheelEvent) {
2615
2625
  const { clientX: B, clientY: C } = I.event, Q = Z(B, C);
2616
2626
  I.clipPos = this.clientToClip(Q, 0), I.worldPos = this.camera.clipToWorld(I.clipPos);
@@ -2678,7 +2688,7 @@ function qB(g, A) {
2678
2688
  }
2679
2689
  }
2680
2690
  }
2681
- function nQ(g) {
2691
+ function wQ(g) {
2682
2692
  for (let A = 0; A < g.length; A++)
2683
2693
  qB(g[A], g.slice(0, A));
2684
2694
  }
@@ -2689,12 +2699,12 @@ function _g(g, A, I) {
2689
2699
  ...C,
2690
2700
  element: Q,
2691
2701
  id: C.id ?? Q.id ?? JB("viewport"),
2692
- layerManager: new hQ(I)
2702
+ layerManager: new tQ(I)
2693
2703
  };
2694
2704
  });
2695
- return nQ(B), B.map((C) => new GQ(C));
2705
+ return wQ(B), B.map((C) => new nQ(C));
2696
2706
  }
2697
- class wQ {
2707
+ class FQ {
2698
2708
  elements_;
2699
2709
  resizeObserver_;
2700
2710
  mediaQuery_;
@@ -2753,7 +2763,7 @@ class wQ {
2753
2763
  this.elements_.splice(I, 1), this.resizeObserver_ && this.resizeObserver_.unobserve(A);
2754
2764
  }
2755
2765
  }
2756
- class Ho {
2766
+ class qo {
2757
2767
  chunkManager_;
2758
2768
  context_;
2759
2769
  renderer_;
@@ -2813,17 +2823,17 @@ class Ho {
2813
2823
  * @throws {Error} If viewports have duplicate IDs or shared elements
2814
2824
  */
2815
2825
  constructor(A) {
2816
- this.canvas = A.canvas, this.renderer_ = new CQ(this.canvas), this.chunkManager_ = new sQ(), this.context_ = {
2826
+ this.canvas = A.canvas, this.renderer_ = new QQ(this.canvas), this.chunkManager_ = new DQ(), this.context_ = {
2817
2827
  chunkManager: this.chunkManager_
2818
2828
  }, this.viewports_ = _g(
2819
2829
  A.viewports ?? [],
2820
2830
  this.canvas,
2821
2831
  this.context_
2822
- ), this.overlays = A.overlays ?? [], A.showStats && (this.stats_ = DQ());
2832
+ ), this.overlays = A.overlays ?? [], A.showStats && (this.stats_ = hQ());
2823
2833
  const I = [this.canvas];
2824
2834
  for (const B of this.viewports_)
2825
2835
  B.element !== this.canvas && I.push(B.element);
2826
- this.sizeObserver_ = new wQ(I, () => {
2836
+ this.sizeObserver_ = new FQ(I, () => {
2827
2837
  this.renderer_.updateSize();
2828
2838
  for (const B of this.viewports_)
2829
2839
  B.updateSize(), this.renderer_.render(B);
@@ -2904,7 +2914,7 @@ class Ho {
2904
2914
  }
2905
2915
  }
2906
2916
  }
2907
- class FQ extends WA {
2917
+ class rQ extends WA {
2908
2918
  constructor(A) {
2909
2919
  if (super(), A.primitive != "triangles") {
2910
2920
  U.warn("WireframeGeometry", "Only indexed geometries are supported");
@@ -2929,21 +2939,21 @@ class FQ extends WA {
2929
2939
  this.indexData_ = new Uint32Array(B);
2930
2940
  }
2931
2941
  }
2932
- const rQ = q(0, 1, 0);
2933
- class SQ {
2942
+ const SQ = q(0, 1, 0);
2943
+ class RQ {
2934
2944
  dirty_ = !0;
2935
2945
  matrix_ = z();
2936
2946
  rotation_ = Cg();
2937
2947
  translation_ = f();
2938
2948
  scale_ = q(1, 1, 1);
2939
2949
  addRotation(A) {
2940
- VC(this.rotation_, this.rotation_, A), this.dirty_ = !0;
2950
+ vC(this.rotation_, this.rotation_, A), this.dirty_ = !0;
2941
2951
  }
2942
2952
  setRotation(A) {
2943
- XC(this.rotation_, A), this.dirty_ = !0;
2953
+ jC(this.rotation_, A), this.dirty_ = !0;
2944
2954
  }
2945
2955
  get rotation() {
2946
- return vC(this.rotation_);
2956
+ return XC(this.rotation_);
2947
2957
  }
2948
2958
  addTranslation(A) {
2949
2959
  qA(this.translation_, this.translation_, A), this.dirty_ = !0;
@@ -2955,14 +2965,14 @@ class SQ {
2955
2965
  return gA(this.translation_);
2956
2966
  }
2957
2967
  addScale(A) {
2958
- pC(this.scale_, this.scale_, A), this.dirty_ = !0;
2968
+ mC(this.scale_, this.scale_, A), this.dirty_ = !0;
2959
2969
  }
2960
2970
  setScale(A) {
2961
2971
  KA(this.scale_, A), this.dirty_ = !0;
2962
2972
  }
2963
2973
  targetTo(A) {
2964
2974
  MB(this.translation_, A) && (A = gA(A), A[2] += p);
2965
- const I = qC(z(), this.translation_, A, rQ), B = LC(YB(), I);
2975
+ const I = lC(z(), this.translation_, A, SQ), B = JC(YB(), I);
2966
2976
  KB(this.rotation_, B), Gg(this.rotation_, this.rotation_), this.dirty_ = !0;
2967
2977
  }
2968
2978
  get scale() {
@@ -2975,7 +2985,7 @@ class SQ {
2975
2985
  return mI(z(), this.matrix);
2976
2986
  }
2977
2987
  computeMatrix() {
2978
- YC(
2988
+ dC(
2979
2989
  this.matrix_,
2980
2990
  this.rotation_,
2981
2991
  this.translation_,
@@ -2989,7 +2999,7 @@ class bA extends yg {
2989
2999
  depthTest = !0;
2990
3000
  textures_ = [];
2991
3001
  staleTextures_ = [];
2992
- transform_ = new SQ();
3002
+ transform_ = new RQ();
2993
3003
  geometry_ = new WA();
2994
3004
  wireframeGeometry_ = null;
2995
3005
  programName_ = null;
@@ -3006,7 +3016,7 @@ class bA extends yg {
3006
3016
  return this.geometry_;
3007
3017
  }
3008
3018
  get wireframeGeometry() {
3009
- return this.wireframeGeometry_ ??= new FQ(this.geometry), this.wireframeGeometry_;
3019
+ return this.wireframeGeometry_ ??= new rQ(this.geometry), this.wireframeGeometry_;
3010
3020
  }
3011
3021
  get textures() {
3012
3022
  return this.textures_;
@@ -3061,7 +3071,7 @@ class YA {
3061
3071
  }
3062
3072
  }
3063
3073
  }
3064
- class RQ {
3074
+ class NQ {
3065
3075
  planes_;
3066
3076
  constructor(A) {
3067
3077
  this.planes_ = [
@@ -3129,7 +3139,7 @@ class lB extends bA {
3129
3139
  return q(A[4], A[5], A[6]);
3130
3140
  }
3131
3141
  get frustum() {
3132
- return new RQ(
3142
+ return new NQ(
3133
3143
  jA(z(), this.projectionMatrix, this.viewMatrix)
3134
3144
  );
3135
3145
  }
@@ -3148,7 +3158,7 @@ class lB extends bA {
3148
3158
  I,
3149
3159
  B
3150
3160
  );
3151
- ZC(C, C, 1 / C[3]);
3161
+ PC(C, C, 1 / C[3]);
3152
3162
  const Q = zA(
3153
3163
  fA(),
3154
3164
  C,
@@ -3158,7 +3168,7 @@ class lB extends bA {
3158
3168
  }
3159
3169
  }
3160
3170
  const fB = 1.77, $g = 128, AB = 128 / fB;
3161
- class qo extends lB {
3171
+ class lo extends lB {
3162
3172
  // width_ and height_ should always be defined by constructor (see setFrame)
3163
3173
  width_ = $g;
3164
3174
  height_ = AB;
@@ -3202,7 +3212,7 @@ class qo extends lB {
3202
3212
  updateProjectionMatrix() {
3203
3213
  const A = this.width_, I = this.height_, B = A / I;
3204
3214
  let C = 0.5 * A, Q = 0.5 * I;
3205
- this.viewportAspectRatio_ > B ? C *= this.viewportAspectRatio_ / B : Q *= B / this.viewportAspectRatio_, this.viewportSize_ = [2 * C, 2 * Q], HC(
3215
+ this.viewportAspectRatio_ > B ? C *= this.viewportAspectRatio_ / B : Q *= B / this.viewportAspectRatio_, this.viewportSize_ = [2 * C, 2 * Q], qC(
3206
3216
  this.projectionMatrix_,
3207
3217
  -C,
3208
3218
  C,
@@ -3213,14 +3223,14 @@ class qo extends lB {
3213
3223
  );
3214
3224
  }
3215
3225
  }
3216
- const NQ = 60, cQ = 1.77, rI = 0.1, $I = 180 - rI;
3217
- class lo extends lB {
3226
+ const cQ = 60, UQ = 1.77, rI = 0.1, $I = 180 - rI;
3227
+ class fo extends lB {
3218
3228
  fov_;
3219
3229
  aspectRatio_;
3220
3230
  constructor(A = {}) {
3221
3231
  const {
3222
- fov: I = NQ,
3223
- aspectRatio: B = cQ,
3232
+ fov: I = cQ,
3233
+ aspectRatio: B = UQ,
3224
3234
  near: C = 0.1,
3225
3235
  far: Q = 1e4,
3226
3236
  position: E = q(0, 0, 0)
@@ -3246,9 +3256,9 @@ class lo extends lB {
3246
3256
  this.fov_ = Math.max(rI, Math.min($I, this.fov_ / A)), this.updateProjectionMatrix();
3247
3257
  }
3248
3258
  updateProjectionMatrix() {
3249
- MC(
3259
+ KC(
3250
3260
  this.projectionMatrix_,
3251
- kC(this.fov),
3261
+ LC(this.fov),
3252
3262
  this.aspectRatio_,
3253
3263
  this.near_,
3254
3264
  this.far_
@@ -3256,7 +3266,7 @@ class lo extends lB {
3256
3266
  }
3257
3267
  }
3258
3268
  const IB = 0;
3259
- class fo {
3269
+ class po {
3260
3270
  camera_;
3261
3271
  dragActive_ = !1;
3262
3272
  dragStart_ = f();
@@ -3324,8 +3334,8 @@ class gB {
3324
3334
  );
3325
3335
  }
3326
3336
  }
3327
- const Ag = -1, BB = 0, UQ = 1, CB = 9e-3, kQ = 1e-3, LQ = 9e-4, JQ = 0.5, YQ = 60;
3328
- class po {
3337
+ const Ag = -1, BB = 0, kQ = 1, CB = 9e-3, LQ = 1e-3, JQ = 9e-4, YQ = 0.5, dQ = 60;
3338
+ class mo {
3329
3339
  camera_;
3330
3340
  orbitVelocity_ = new gB(0, 0, 0);
3331
3341
  panVelocity_ = f();
@@ -3339,7 +3349,7 @@ class po {
3339
3349
  I?.yaw ?? 0,
3340
3350
  I?.pitch ?? 0
3341
3351
  ), I?.target && KA(this.currCenter_, I.target), this.dampingFactor_ = NA(
3342
- I?.dampingFactor ?? JQ,
3352
+ I?.dampingFactor ?? YQ,
3343
3353
  0,
3344
3354
  1
3345
3355
  ), this.updateCamera();
@@ -3370,7 +3380,7 @@ class po {
3370
3380
  this.currPos_.phi += this.orbitVelocity_.phi, this.currPos_.theta += this.orbitVelocity_.theta, this.currPos_.radius += this.orbitVelocity_.radius * this.currPos_.radius, qA(this.currCenter_, this.currCenter_, this.panVelocity_);
3371
3381
  const I = Math.PI / 2 - p;
3372
3382
  this.currPos_.theta = NA(this.currPos_.theta, -I, I), this.currPos_.radius = Math.max(0.01, this.currPos_.radius), this.updateCamera();
3373
- const B = Math.pow(1 - this.dampingFactor_, A * YQ);
3383
+ const B = Math.pow(1 - this.dampingFactor_, A * dQ);
3374
3384
  this.orbitVelocity_.phi *= B, this.orbitVelocity_.theta *= B, this.orbitVelocity_.radius *= B, lA(this.panVelocity_, this.panVelocity_, B), this.cutoffLowVelocity();
3375
3385
  }
3376
3386
  onPointerDown(A) {
@@ -3379,7 +3389,7 @@ class po {
3379
3389
  }
3380
3390
  onPointerMove(A) {
3381
3391
  if (this.currMouseButton_ == Ag) return;
3382
- const I = A.event, B = I.movementX ?? 0, C = I.movementY ?? 0, Q = this.currMouseButton_ === BB && !I.shiftKey, E = this.currMouseButton_ === BB && I.shiftKey || this.currMouseButton_ === UQ;
3392
+ const I = A.event, B = I.movementX ?? 0, C = I.movementY ?? 0, Q = this.currMouseButton_ === BB && !I.shiftKey, E = this.currMouseButton_ === BB && I.shiftKey || this.currMouseButton_ === kQ;
3383
3393
  Q && this.orbit(B, C), E && this.pan(B, C);
3384
3394
  }
3385
3395
  onWheel(A) {
@@ -3397,18 +3407,18 @@ class po {
3397
3407
  this.orbitVelocity_.phi -= A * CB, this.orbitVelocity_.theta += I * CB;
3398
3408
  }
3399
3409
  pan(A, I) {
3400
- const B = this.currPos_.radius * kQ, C = f();
3410
+ const B = this.currPos_.radius * LQ, C = f();
3401
3411
  cI(C, C, this.camera_.right, A), cI(C, C, this.camera_.up, I), lA(C, C, B), UI(this.panVelocity_, this.panVelocity_, C);
3402
3412
  }
3403
3413
  zoom(A) {
3404
- this.orbitVelocity_.radius += A * LQ;
3414
+ this.orbitVelocity_.radius += A * JQ;
3405
3415
  }
3406
3416
  updateCamera() {
3407
3417
  const A = qA(f(), this.currCenter_, this.currPos_.toVec3());
3408
3418
  this.camera_.transform.setTranslation(A), this.camera_.transform.targetTo(this.currCenter_);
3409
3419
  }
3410
3420
  cutoffLowVelocity() {
3411
- Math.abs(this.orbitVelocity_.phi) < p && (this.orbitVelocity_.phi = 0), Math.abs(this.orbitVelocity_.theta) < p && (this.orbitVelocity_.theta = 0), Math.abs(this.orbitVelocity_.radius) < p && (this.orbitVelocity_.radius = 0), eg(this.panVelocity_) < p && TC(this.panVelocity_);
3421
+ Math.abs(this.orbitVelocity_.phi) < p && (this.orbitVelocity_.phi = 0), Math.abs(this.orbitVelocity_.theta) < p && (this.orbitVelocity_.theta = 0), Math.abs(this.orbitVelocity_.radius) < p && (this.orbitVelocity_.radius = 0), eg(this.panVelocity_) < p && xC(this.panVelocity_);
3412
3422
  }
3413
3423
  }
3414
3424
  class wA {
@@ -3593,7 +3603,7 @@ class wg extends bA {
3593
3603
  };
3594
3604
  }
3595
3605
  }
3596
- class mo extends wA {
3606
+ class uo extends wA {
3597
3607
  type = "AxesLayer";
3598
3608
  constructor(A) {
3599
3609
  super();
@@ -3629,7 +3639,7 @@ function Ig(g) {
3629
3639
  width: I
3630
3640
  });
3631
3641
  }
3632
- class uo extends wA {
3642
+ class To extends wA {
3633
3643
  type = "ProjectedLineLayer";
3634
3644
  paths_ = [];
3635
3645
  constructor(A = []) {
@@ -3646,10 +3656,10 @@ class uo extends wA {
3646
3656
  // TODO: this is temporary - we may want to generalize this to all layers
3647
3657
  // for now it is used to set the initial camera position to be centered on the tracks
3648
3658
  get extent() {
3649
- return dQ(this.paths_.flat());
3659
+ return MQ(this.paths_.flat());
3650
3660
  }
3651
3661
  }
3652
- function dQ(g) {
3662
+ function MQ(g) {
3653
3663
  function A(o) {
3654
3664
  const a = g.map((s) => s[o]);
3655
3665
  return [Math.min(...a), Math.max(...a)];
@@ -3657,7 +3667,7 @@ function dQ(g) {
3657
3667
  const [I, B] = A(0), [C, Q] = A(1), [E, i] = A(2);
3658
3668
  return { xMin: I, xMax: B, yMin: C, yMax: Q, zMin: E, zMax: i };
3659
3669
  }
3660
- class To extends wA {
3670
+ class xo extends wA {
3661
3671
  type = "TracksLayer";
3662
3672
  tracks_ = [];
3663
3673
  constructor(A = []) {
@@ -3667,7 +3677,7 @@ class To extends wA {
3667
3677
  this.tracks_.push(A);
3668
3678
  let I;
3669
3679
  if (A.interpolation) {
3670
- const i = KQ({
3680
+ const i = HQ({
3671
3681
  path: A.path,
3672
3682
  pointsPerSegment: A.interpolation.pointsPerSegment,
3673
3683
  tangentFactor: A.interpolation.tangentFactor
@@ -3698,10 +3708,10 @@ class To extends wA {
3698
3708
  // for now it is used to set the initial camera position to be centered on the tracks
3699
3709
  get extent() {
3700
3710
  const A = this.tracks_.map((I) => I.path);
3701
- return MQ(A.flat());
3711
+ return KQ(A.flat());
3702
3712
  }
3703
3713
  }
3704
- function MQ(g) {
3714
+ function KQ(g) {
3705
3715
  function A(o) {
3706
3716
  const a = g.map((s) => s[o]);
3707
3717
  return [Math.min(...a), Math.max(...a)];
@@ -3709,12 +3719,12 @@ function MQ(g) {
3709
3719
  const [I, B] = A(0), [C, Q] = A(1), [E, i] = A(2);
3710
3720
  return { xMin: I, xMax: B, yMin: C, yMax: Q, zMin: E, zMax: i };
3711
3721
  }
3712
- function KQ({
3722
+ function HQ({
3713
3723
  path: g,
3714
3724
  pointsPerSegment: A,
3715
3725
  tangentFactor: I = 1 / 3
3716
3726
  }) {
3717
- const B = HQ(g), C = Array((g.length - 1) * A);
3727
+ const B = qQ(g), C = Array((g.length - 1) * A);
3718
3728
  for (let Q = 0; Q < g.length - 1; Q++) {
3719
3729
  const E = g[Q], i = g[Q + 1], o = gA(B[Q]);
3720
3730
  cI(o, E, o, I);
@@ -3722,12 +3732,12 @@ function KQ({
3722
3732
  cI(a, i, a, -I);
3723
3733
  for (let s = 0; s < A; s++) {
3724
3734
  const h = s / A, t = C[Q * A + s] = f();
3725
- uC(t, E, o, a, i, h);
3735
+ TC(t, E, o, a, i, h);
3726
3736
  }
3727
3737
  }
3728
3738
  return C;
3729
3739
  }
3730
- function HQ(g) {
3740
+ function qQ(g) {
3731
3741
  if (g.length < 2)
3732
3742
  throw new Error("Path must contain at least 2 points");
3733
3743
  const A = Array(g.length), I = f(), B = f();
@@ -3737,37 +3747,6 @@ function HQ(g) {
3737
3747
  }
3738
3748
  return A;
3739
3749
  }
3740
- class pB extends WA {
3741
- constructor(A, I, B, C) {
3742
- super();
3743
- const Q = [], E = [], i = B, o = C, a = i + 1, s = o + 1, h = A / i, t = I / o;
3744
- for (let y = 0; y < s; ++y) {
3745
- const n = y * t;
3746
- for (let w = 0; w < a; ++w) {
3747
- const r = w * h, G = w / i, c = y / o, R = [r, n, 0], Y = [0, 0, 1], k = [G, c];
3748
- Q.push(...R, ...Y, ...k);
3749
- }
3750
- }
3751
- for (let y = 0; y < o; ++y)
3752
- for (let n = 0; n < i; ++n) {
3753
- const w = n + a * y, r = n + a * (y + 1), G = n + 1 + a * (y + 1), c = n + 1 + a * y;
3754
- E.push(w, r, c), E.push(r, G, c);
3755
- }
3756
- this.vertexData_ = new Float32Array(Q), this.indexData_ = new Uint32Array(E), this.addAttribute({
3757
- type: "position",
3758
- itemSize: 3,
3759
- offset: 0
3760
- }), this.addAttribute({
3761
- type: "normal",
3762
- itemSize: 3,
3763
- offset: 3 * Float32Array.BYTES_PER_ELEMENT
3764
- }), this.addAttribute({
3765
- type: "uv",
3766
- itemSize: 2,
3767
- offset: 6 * Float32Array.BYTES_PER_ELEMENT
3768
- });
3769
- }
3770
- }
3771
3750
  function QB(g) {
3772
3751
  return g === 1 || g === 2 || g === 4 || g === 8;
3773
3752
  }
@@ -3788,7 +3767,7 @@ function pA(g) {
3788
3767
  return "float";
3789
3768
  throw new Error("Unsupported buffer type.");
3790
3769
  }
3791
- function qQ(g) {
3770
+ function lQ(g) {
3792
3771
  if (g.dataFormat === "rgb" || g.dataFormat === "rgba")
3793
3772
  return [0, 1];
3794
3773
  switch (g.dataType) {
@@ -3825,7 +3804,7 @@ class Fg extends yg {
3825
3804
  }
3826
3805
  const EB = 32;
3827
3806
  function _A(g, { visible: A, color: I, contrastLimits: B }) {
3828
- return A === void 0 && (A = !0), I === void 0 ? I = l.WHITE : I = l.from(I), g !== null ? B = lQ(B, g) : B === void 0 && (U.debug(
3807
+ return A === void 0 && (A = !0), I === void 0 ? I = l.WHITE : I = l.from(I), g !== null ? B = fQ(B, g) : B === void 0 && (U.debug(
3829
3808
  "Channel",
3830
3809
  "No texture provided, defaulting channel contrast limits to [0, 1]."
3831
3810
  ), B = [0, 1]), {
@@ -3846,19 +3825,56 @@ function ig(g, A) {
3846
3825
  }
3847
3826
  return A.map((I) => _A(g, I));
3848
3827
  }
3849
- function lQ(g, A) {
3828
+ function pB(g, A) {
3829
+ if (g && g.length !== A)
3830
+ throw new Error(
3831
+ `channelProps length (${g.length}) must match source channel count (${A}).`
3832
+ );
3833
+ }
3834
+ function fQ(g, A) {
3850
3835
  if (g === void 0)
3851
- return qQ(A);
3836
+ return lQ(A);
3852
3837
  if (g[1] <= g[0])
3853
3838
  throw new Error(
3854
3839
  `Contrast limits must be strictly increasing: ${g}.`
3855
3840
  );
3856
3841
  return g;
3857
3842
  }
3843
+ class mB extends WA {
3844
+ constructor(A, I, B, C) {
3845
+ super();
3846
+ const Q = [], E = [], i = B, o = C, a = i + 1, s = o + 1, h = A / i, t = I / o;
3847
+ for (let y = 0; y < s; ++y) {
3848
+ const n = y * t;
3849
+ for (let w = 0; w < a; ++w) {
3850
+ const r = w * h, G = w / i, c = y / o, R = [r, n, 0], Y = [0, 0, 1], k = [G, c];
3851
+ Q.push(...R, ...Y, ...k);
3852
+ }
3853
+ }
3854
+ for (let y = 0; y < o; ++y)
3855
+ for (let n = 0; n < i; ++n) {
3856
+ const w = n + a * y, r = n + a * (y + 1), G = n + 1 + a * (y + 1), c = n + 1 + a * y;
3857
+ E.push(w, r, c), E.push(r, G, c);
3858
+ }
3859
+ this.vertexData_ = new Float32Array(Q), this.indexData_ = new Uint32Array(E), this.addAttribute({
3860
+ type: "position",
3861
+ itemSize: 3,
3862
+ offset: 0
3863
+ }), this.addAttribute({
3864
+ type: "normal",
3865
+ itemSize: 3,
3866
+ offset: 3 * Float32Array.BYTES_PER_ELEMENT
3867
+ }), this.addAttribute({
3868
+ type: "uv",
3869
+ itemSize: 2,
3870
+ offset: 6 * Float32Array.BYTES_PER_ELEMENT
3871
+ });
3872
+ }
3873
+ }
3858
3874
  class rg extends bA {
3859
3875
  channels_;
3860
3876
  constructor(A, I, B, C = []) {
3861
- super(), this.geometry = new pB(A, I, 1, 1), this.setTexture(0, B), this.channels_ = ig(B, C), this.programName = fQ(B);
3877
+ super(), this.geometry = new mB(A, I, 1, 1), this.setTexture(0, B), this.channels_ = ig(B, C), this.programName = pQ(B);
3862
3878
  }
3863
3879
  get type() {
3864
3880
  return "ImageRenderable";
@@ -3903,14 +3919,14 @@ class rg extends bA {
3903
3919
  }
3904
3920
  }
3905
3921
  }
3906
- function fQ(g) {
3922
+ function pQ(g) {
3907
3923
  if (g.type === "Texture2D")
3908
- return pQ(g.dataType);
3909
- if (g.type === "Texture2DArray")
3910
3924
  return mQ(g.dataType);
3925
+ if (g.type === "Texture2DArray")
3926
+ return uQ(g.dataType);
3911
3927
  throw new Error(`Unsupported image texture type: ${g.type}`);
3912
3928
  }
3913
- function pQ(g) {
3929
+ function mQ(g) {
3914
3930
  switch (g) {
3915
3931
  case "byte":
3916
3932
  case "int":
@@ -3924,7 +3940,7 @@ function pQ(g) {
3924
3940
  return "floatScalarImage";
3925
3941
  }
3926
3942
  }
3927
- function mQ(g) {
3943
+ function uQ(g) {
3928
3944
  switch (g) {
3929
3945
  case "byte":
3930
3946
  case "int":
@@ -3995,7 +4011,7 @@ function Sg(g, A, I, B, C = 3) {
3995
4011
  case "pointerup": {
3996
4012
  if (!A) return A;
3997
4013
  const Q = g.event, E = Z(Q.clientX, Q.clientY);
3998
- if (jC(A, E) < C) {
4014
+ if (zC(A, E) < C) {
3999
4015
  if (!B) return null;
4000
4016
  const o = g.worldPos;
4001
4017
  if (o) {
@@ -4012,7 +4028,7 @@ function Sg(g, A, I, B, C = 3) {
4012
4028
  return A;
4013
4029
  }
4014
4030
  }
4015
- class mB {
4031
+ class uB {
4016
4032
  bins_ = /* @__PURE__ */ new Map();
4017
4033
  acquire(A) {
4018
4034
  const B = this.bins_.get(A)?.pop();
@@ -4027,13 +4043,13 @@ class mB {
4027
4043
  this.bins_.clear();
4028
4044
  }
4029
4045
  }
4030
- class uB extends wA {
4046
+ class TB extends wA {
4031
4047
  type = "ChunkedImageLayer";
4032
4048
  source_;
4033
4049
  sliceCoords_;
4034
4050
  onPickValue_;
4035
4051
  visibleChunks_ = /* @__PURE__ */ new Map();
4036
- pool_ = new mB();
4052
+ pool_ = new uB();
4037
4053
  initialChannelProps_;
4038
4054
  channelChangeCallbacks_ = [];
4039
4055
  policy_;
@@ -4070,6 +4086,11 @@ class uB extends wA {
4070
4086
  this.source_,
4071
4087
  this.policy_
4072
4088
  );
4089
+ const I = this.chunkStoreView_.channelCount;
4090
+ if (pB(this.channelProps_, I), I > 1 && this.sliceCoords_.c !== void 0 && this.sliceCoords_.c.length > 1)
4091
+ throw new Error(
4092
+ `ChunkedImageLayer requires exactly one channel in sliceCoords.c for multi-channel sources (found ${I} channels). Use one layer per channel.`
4093
+ );
4073
4094
  }
4074
4095
  onDetached(A) {
4075
4096
  this.chunkStoreView_ && (this.releaseAndRemoveChunks(this.visibleChunks_.keys()), this.clearObjects(), this.chunkStoreView_.dispose(), this.chunkStoreView_ = void 0);
@@ -4103,7 +4124,7 @@ class uB extends wA {
4103
4124
  return this.lastPresentationTimeCoord_;
4104
4125
  }
4105
4126
  isPresentationStale() {
4106
- return this.lastPresentationTimeStamp_ === void 0 ? !1 : performance.now() - this.lastPresentationTimeStamp_ > uB.STALE_PRESENTATION_MS_;
4127
+ return this.lastPresentationTimeStamp_ === void 0 ? !1 : performance.now() - this.lastPresentationTimeStamp_ > TB.STALE_PRESENTATION_MS_;
4107
4128
  }
4108
4129
  resliceIfZChanged() {
4109
4130
  const A = this.sliceCoords_.z;
@@ -4154,14 +4175,17 @@ class uB extends wA {
4154
4175
  const I = this.visibleChunks_.get(A);
4155
4176
  if (I) return I;
4156
4177
  const B = this.pool_.acquire(iB(A));
4157
- return B ? (B.textures[0].updateWithChunk(A, this.getDataForImage(A)), this.updateImageChunk(B, A), this.channelProps_ && B.setChannelProps(this.channelProps_), B) : this.createImage(A);
4178
+ return B ? (B.textures[0].updateWithChunk(A, this.getDataForImage(A)), this.updateImageChunk(B, A), B.setChannelProps(this.getChannelPropsForChunk(A)), B) : this.createImage(A);
4179
+ }
4180
+ getChannelPropsForChunk(A) {
4181
+ return this.channelProps_ ? [this.channelProps_[A.chunkIndex.c] ?? {}] : [{}];
4158
4182
  }
4159
4183
  createImage(A) {
4160
4184
  const I = new rg(
4161
4185
  A.shape.x,
4162
4186
  A.shape.y,
4163
4187
  tI.createWithChunk(A, this.getDataForImage(A)),
4164
- this.channelProps_ ?? [{}]
4188
+ this.getChannelPropsForChunk(A)
4165
4189
  );
4166
4190
  return this.updateImageChunk(I, A), I;
4167
4191
  }
@@ -4215,8 +4239,8 @@ class uB extends wA {
4215
4239
  return this.channelProps_;
4216
4240
  }
4217
4241
  setChannelProps(A) {
4218
- this.channelProps_ = A, this.visibleChunks_.forEach((I) => {
4219
- I.setChannelProps(A);
4242
+ this.channelProps_ = A, this.visibleChunks_.forEach((I, B) => {
4243
+ I.setChannelProps(this.getChannelPropsForChunk(B));
4220
4244
  }), this.channelChangeCallbacks_.forEach((I) => {
4221
4245
  I();
4222
4246
  });
@@ -4247,7 +4271,7 @@ function iB(g) {
4247
4271
  `align${g.rowAlignmentBytes}`
4248
4272
  ].join(":");
4249
4273
  }
4250
- class uQ extends WA {
4274
+ class TQ extends WA {
4251
4275
  constructor(A, I, B, C, Q, E) {
4252
4276
  super();
4253
4277
  const i = [], o = [], a = Math.floor(C), s = Math.floor(Q), h = Math.floor(E);
@@ -4347,13 +4371,13 @@ class XA extends Fg {
4347
4371
  return B.unpackAlignment = A.rowAlignmentBytes, B;
4348
4372
  }
4349
4373
  }
4350
- class TQ extends bA {
4374
+ class xQ extends bA {
4351
4375
  voxelScale = q(1, 1, 1);
4352
4376
  channels_;
4353
4377
  channelToTextureIndex_ = /* @__PURE__ */ new Map();
4354
4378
  loadedChannels_ = /* @__PURE__ */ new Set();
4355
4379
  constructor() {
4356
- super(), this.geometry = new uQ(1, 1, 1, 1, 1, 1), this.cullFaceMode = "front", this.depthTest = !1, this.channels_ = [];
4380
+ super(), this.geometry = new TQ(1, 1, 1, 1, 1, 1), this.cullFaceMode = "front", this.depthTest = !1, this.channels_ = [];
4357
4381
  }
4358
4382
  get type() {
4359
4383
  return "VolumeRenderable";
@@ -4365,7 +4389,7 @@ class TQ extends bA {
4365
4389
  addChannelTexture(A, I) {
4366
4390
  const B = XA.createWithChunk(I), C = this.textures.length;
4367
4391
  this.setTexture(C, B), this.channelToTextureIndex_.set(A, C);
4368
- const Q = xQ(B.dataType);
4392
+ const Q = WQ(B.dataType);
4369
4393
  if (this.programName && this.programName !== Q)
4370
4394
  throw new Error(
4371
4395
  `Volume renderable does not support multiple channels with different data types. Existing program: ${this.programName}, new channel data type: ${B.dataType} and program: ${Q}`
@@ -4453,7 +4477,7 @@ class TQ extends bA {
4453
4477
  this.channels_[A] = C;
4454
4478
  }
4455
4479
  }
4456
- function xQ(g) {
4480
+ function WQ(g) {
4457
4481
  switch (g) {
4458
4482
  case "byte":
4459
4483
  case "int":
@@ -4467,7 +4491,7 @@ function xQ(g) {
4467
4491
  return "floatVolume";
4468
4492
  }
4469
4493
  }
4470
- function WQ(g, A) {
4494
+ function bQ(g, A) {
4471
4495
  const I = A.position, B = f(), C = f();
4472
4496
  return g.sort((Q, E) => {
4473
4497
  qA(B, Q.boundingBox.max, Q.boundingBox.min), lA(B, B, 0.5), qA(C, E.boundingBox.max, E.boundingBox.min), lA(C, C, 0.5);
@@ -4475,14 +4499,14 @@ function WQ(g, A) {
4475
4499
  return i - o;
4476
4500
  }), g;
4477
4501
  }
4478
- const bQ = 2;
4479
- class xo extends wA {
4502
+ const ZQ = 2;
4503
+ class Wo extends wA {
4480
4504
  type = "VolumeLayer";
4481
4505
  source_;
4482
4506
  sliceCoords_;
4483
4507
  currentVolumes_ = /* @__PURE__ */ new Map();
4484
4508
  volumeToPoolKey_ = /* @__PURE__ */ new Map();
4485
- pool_ = new mB();
4509
+ pool_ = new uB();
4486
4510
  initialChannelProps_;
4487
4511
  channelChangeCallbacks_ = [];
4488
4512
  sourcePolicy_;
@@ -4545,7 +4569,7 @@ class xo extends wA {
4545
4569
  for (const E of I) B.updateVolumeWithChunk(E);
4546
4570
  return B;
4547
4571
  }
4548
- const C = OQ(I[0]), Q = this.pool_.acquire(C) ?? new TQ();
4572
+ const C = VQ(I[0]), Q = this.pool_.acquire(C) ?? new xQ();
4549
4573
  Q.setChannelProps(this.channelProps_ ?? []), this.volumeToPoolKey_.set(Q, C);
4550
4574
  for (const E of I) Q.updateVolumeWithChunk(E);
4551
4575
  return this.updateVolumeTransform(Q, I[0]), Q;
@@ -4554,24 +4578,33 @@ class xo extends wA {
4554
4578
  this.chunkStoreView_ = await A.chunkManager.addView(
4555
4579
  this.source_,
4556
4580
  this.sourcePolicy_
4581
+ ), pB(
4582
+ this.channelProps_,
4583
+ this.chunkStoreView_.channelCount
4557
4584
  );
4558
4585
  }
4559
4586
  onDetached(A) {
4560
- this.chunkStoreView_ && (this.releaseAndRemoveVolumes(this.currentVolumes_.values()), this.clearObjects(), this.chunkStoreView_.dispose(), this.chunkStoreView_ = void 0);
4587
+ if (this.chunkStoreView_) {
4588
+ for (const I of this.currentVolumes_.values())
4589
+ this.releaseAndRemoveVolume(I);
4590
+ this.clearObjects(), this.chunkStoreView_.dispose(), this.chunkStoreView_ = void 0;
4591
+ }
4561
4592
  }
4562
4593
  updateChunks() {
4563
4594
  if (!this.chunkStoreView_) return;
4564
4595
  const A = this.chunkStoreView_.getChunksToRender(
4565
4596
  this.sliceCoords_
4566
- ), I = this.sliceCoords_.t ?? -1, B = PQ(A), C = this.lastLoadedTime_ !== I || B.size !== this.currentVolumes_.size || this.lastNumRenderedChannelChunks_ !== A.length;
4567
- if (this.lastNumRenderedChannelChunks_ = A.length, !C) return;
4568
- const Q = Array.from(this.currentVolumes_.entries()).filter(([E]) => !B.has(E)).map(([, E]) => E);
4569
- this.releaseAndRemoveVolumes(Q), this.currentVolumes_.clear(), this.clearObjects();
4570
- for (const [E, i] of B) {
4571
- const o = this.getOrCreateVolume(E, i);
4572
- o.wireframeEnabled = this.debugShowWireframes, this.currentVolumes_.set(E, o), this.addObject(o);
4597
+ ), I = this.sliceCoords_.t ?? -1, B = OQ(A);
4598
+ if (this.lastLoadedTime_ !== I || B.size !== this.currentVolumes_.size || this.lastNumRenderedChannelChunks_ !== A.length) {
4599
+ for (const [Q, E] of this.currentVolumes_)
4600
+ B.has(Q) || (this.releaseAndRemoveVolume(E), this.currentVolumes_.delete(Q));
4601
+ this.clearObjects();
4602
+ for (const [Q, E] of B) {
4603
+ const i = this.getOrCreateVolume(Q, E);
4604
+ i.wireframeEnabled = this.debugShowWireframes, this.currentVolumes_.set(Q, i), this.addObject(i);
4605
+ }
4606
+ this.lastLoadedTime_ = I, this.lastNumRenderedChannelChunks_ = A.length, this.state !== "ready" && this.setState("ready");
4573
4607
  }
4574
- this.lastLoadedTime_ = I, this.state !== "ready" && this.setState("ready");
4575
4608
  }
4576
4609
  updateVolumeTransform(A, I) {
4577
4610
  const B = {
@@ -4591,9 +4624,8 @@ class xo extends wA {
4591
4624
  I.offset.z + C.z
4592
4625
  ]);
4593
4626
  }
4594
- releaseAndRemoveVolumes(A) {
4595
- for (const I of A)
4596
- I.clearLoadedChannels(), this.pool_.release(this.volumeToPoolKey_.get(I), I), this.volumeToPoolKey_.delete(I);
4627
+ releaseAndRemoveVolume(A) {
4628
+ A.clearLoadedChannels(), this.pool_.release(this.volumeToPoolKey_.get(A), A), this.volumeToPoolKey_.delete(A);
4597
4629
  }
4598
4630
  update(A) {
4599
4631
  if (!this.chunkStoreView_) return;
@@ -4606,7 +4638,7 @@ class xo extends wA {
4606
4638
  A.viewport
4607
4639
  );
4608
4640
  const I = A.viewport.cameraControls?.isMoving ?? !1;
4609
- this.interactiveStepSizeScale_ = I ? bQ : 1, this.updateChunks(), WQ(this.objects, A.viewport.camera);
4641
+ this.interactiveStepSizeScale_ = I ? ZQ : 1, this.updateChunks(), bQ(this.objects, A.viewport.camera);
4610
4642
  }
4611
4643
  getUniforms() {
4612
4644
  return {
@@ -4617,27 +4649,27 @@ class xo extends wA {
4617
4649
  };
4618
4650
  }
4619
4651
  }
4620
- function ZQ(g) {
4652
+ function PQ(g) {
4621
4653
  const { x: A, y: I, z: B, t: C } = g.chunkIndex;
4622
4654
  return `${A}:${I}:${B}:${C}`;
4623
4655
  }
4624
- function PQ(g) {
4656
+ function OQ(g) {
4625
4657
  const A = /* @__PURE__ */ new Map();
4626
4658
  for (const I of g) {
4627
- const B = ZQ(I);
4659
+ const B = PQ(I);
4628
4660
  let C = A.get(B);
4629
4661
  C || (C = [], A.set(B, C)), C.push(I);
4630
4662
  }
4631
4663
  return A;
4632
4664
  }
4633
- function OQ(g) {
4665
+ function VQ(g) {
4634
4666
  return [
4635
4667
  `lod${g.lod}`,
4636
4668
  `shape${g.shape.x}x${g.shape.y}x${g.shape.z}`,
4637
4669
  `align${g.rowAlignmentBytes}`
4638
4670
  ].join(":");
4639
4671
  }
4640
- class Wo extends wA {
4672
+ class bo extends wA {
4641
4673
  type = "ImageLayer";
4642
4674
  source_;
4643
4675
  region_;
@@ -4784,7 +4816,7 @@ class $A extends Fg {
4784
4816
  return C.unpackAlignment = A.rowAlignmentBytes, C;
4785
4817
  }
4786
4818
  }
4787
- const VQ = [
4819
+ const vQ = [
4788
4820
  [1, 0.5, 0.5],
4789
4821
  [0.5, 1, 0.5],
4790
4822
  [0.5, 0.5, 1],
@@ -4792,7 +4824,7 @@ const VQ = [
4792
4824
  [1, 0.5, 1],
4793
4825
  [1, 1, 0.5]
4794
4826
  ];
4795
- function vQ(g) {
4827
+ function XQ(g) {
4796
4828
  return g = g ?? /* @__PURE__ */ new Map(), new Map(
4797
4829
  Array.from(g.entries()).map(([A, I]) => [
4798
4830
  A,
@@ -4800,37 +4832,37 @@ function vQ(g) {
4800
4832
  ])
4801
4833
  );
4802
4834
  }
4803
- function XQ(g) {
4804
- return g = g ?? VQ, g.map(l.from);
4835
+ function jQ(g) {
4836
+ return g = g ?? vQ, g.map(l.from);
4805
4837
  }
4806
4838
  class oB {
4807
4839
  lookupTable;
4808
4840
  cycle;
4809
4841
  constructor(A = {}) {
4810
- this.lookupTable = vQ(A.lookupTable), this.cycle = XQ(A.cycle);
4842
+ this.lookupTable = XQ(A.lookupTable), this.cycle = jQ(A.cycle);
4811
4843
  }
4812
4844
  }
4813
- const jQ = /* @__PURE__ */ new Set([
4845
+ const zQ = /* @__PURE__ */ new Set([
4814
4846
  "unsigned_byte",
4815
4847
  "unsigned_short",
4816
4848
  "unsigned_int"
4817
4849
  ]);
4818
- function zQ(g) {
4850
+ function _Q(g) {
4819
4851
  if (g.dataFormat !== "scalar")
4820
4852
  throw new Error(
4821
4853
  `Image data format must be scalar, instead found: ${g.dataFormat}`
4822
4854
  );
4823
- if (!jQ.has(g.dataType))
4855
+ if (!zQ.has(g.dataType))
4824
4856
  throw new Error(
4825
4857
  `Image data type must be unsigned, instead found: ${g.dataType}`
4826
4858
  );
4827
4859
  return g;
4828
4860
  }
4829
- class _Q extends bA {
4861
+ class $Q extends bA {
4830
4862
  outlineSelected_;
4831
4863
  selectedValue_;
4832
4864
  constructor(A) {
4833
- super(), this.geometry = new pB(A.width, A.height, 1, 1), this.setTexture(0, zQ(A.imageData));
4865
+ super(), this.geometry = new mB(A.width, A.height, 1, 1), this.setTexture(0, _Q(A.imageData));
4834
4866
  const I = this.makeColorCycleTexture(A.colorMap.cycle);
4835
4867
  this.setTexture(1, I);
4836
4868
  const B = this.makeColorLookupTableTexture(
@@ -4868,7 +4900,7 @@ class _Q extends bA {
4868
4900
  return Q.set(I, 0), Q.set(B, C), new $A(Q, C, 2);
4869
4901
  }
4870
4902
  }
4871
- class bo extends wA {
4903
+ class Zo extends wA {
4872
4904
  type = "LabelImageLayer";
4873
4905
  source_;
4874
4906
  region_;
@@ -4933,7 +4965,7 @@ class bo extends wA {
4933
4965
  }
4934
4966
  createImage(A) {
4935
4967
  this.imageChunk_ = A;
4936
- const I = new _Q({
4968
+ const I = new $Q({
4937
4969
  width: A.shape.x,
4938
4970
  height: A.shape.y,
4939
4971
  imageData: $A.createWithChunk(A),
@@ -4962,7 +4994,7 @@ class TI extends Error {
4962
4994
  super(A), this.name = "AbortError", Object.setPrototypeOf(this, TI.prototype);
4963
4995
  }
4964
4996
  }
4965
- class $Q {
4997
+ class AE {
4966
4998
  maxConcurrent_;
4967
4999
  pending_ = [];
4968
5000
  abortController_ = new AbortController();
@@ -5006,12 +5038,12 @@ class $Q {
5006
5038
  return this.pending_.length;
5007
5039
  }
5008
5040
  }
5009
- class AE {
5041
+ class IE {
5010
5042
  source_;
5011
5043
  region_;
5012
5044
  seriesDimensionName_;
5013
5045
  seriesIndex_;
5014
- scheduler_ = new $Q(16);
5046
+ scheduler_ = new AE(16);
5015
5047
  lod_;
5016
5048
  loader_ = null;
5017
5049
  seriesAttributes_;
@@ -5124,7 +5156,7 @@ class AE {
5124
5156
  return this.loader_ ??= await this.source_.open(), this.loader_;
5125
5157
  }
5126
5158
  }
5127
- class Zo extends wA {
5159
+ class Po extends wA {
5128
5160
  type = "ImageSeriesLayer";
5129
5161
  seriesLoader_;
5130
5162
  initialChannelProps_;
@@ -5141,7 +5173,7 @@ class Zo extends wA {
5141
5173
  lod: Q,
5142
5174
  ...E
5143
5175
  }) {
5144
- super(E), this.setState("initialized"), this.channelProps_ = C, this.initialChannelProps_ = C, this.seriesLoader_ = new AE({
5176
+ super(E), this.setState("initialized"), this.channelProps_ = C, this.initialChannelProps_ = C, this.seriesLoader_ = new IE({
5145
5177
  source: A,
5146
5178
  region: I,
5147
5179
  seriesDimensionName: B,
@@ -5207,7 +5239,7 @@ class Zo extends wA {
5207
5239
  return C.transform.setScale([A.scale.x, A.scale.y, 1]), C.transform.setTranslation([A.offset.x, A.offset.y, 0]), C;
5208
5240
  }
5209
5241
  }
5210
- function TB(g, A, I, B = {}) {
5242
+ function xB(g, A, I, B = {}) {
5211
5243
  return A !== void 0 && I !== void 0 && (B = {
5212
5244
  ...B,
5213
5245
  headers: {
@@ -5216,7 +5248,7 @@ function TB(g, A, I, B = {}) {
5216
5248
  }
5217
5249
  }), fetch(g, B);
5218
5250
  }
5219
- function IE(g, A) {
5251
+ function gE(g, A) {
5220
5252
  return {
5221
5253
  ...g,
5222
5254
  ...A,
@@ -5239,7 +5271,7 @@ async function sB(g) {
5239
5271
  throw new Error(`Unexpected response status ${g.status} ${g.statusText}`);
5240
5272
  }
5241
5273
  }
5242
- async function gE(g, A, I, B) {
5274
+ async function BE(g, A, I, B) {
5243
5275
  if (B)
5244
5276
  return fetch(g, {
5245
5277
  ...I,
@@ -5249,7 +5281,7 @@ async function gE(g, A, I, B) {
5249
5281
  if (!C.ok)
5250
5282
  return C;
5251
5283
  let Q = C.headers.get("Content-Length"), E = Number(Q);
5252
- return TB(g, E - A, E, I);
5284
+ return xB(g, E - A, E, I);
5253
5285
  }
5254
5286
  class ZA {
5255
5287
  url;
@@ -5259,7 +5291,7 @@ class ZA {
5259
5291
  this.url = A, this.#A = I.overrides ?? {}, this.#I = I.useSuffixRequest ?? !1;
5260
5292
  }
5261
5293
  #g(A) {
5262
- return IE(this.#A, A);
5294
+ return gE(this.#A, A);
5263
5295
  }
5264
5296
  async get(A, I = {}) {
5265
5297
  let B = aB(this.url, A).href, C = await fetch(B, this.#g(I));
@@ -5267,10 +5299,10 @@ class ZA {
5267
5299
  }
5268
5300
  async getRange(A, I, B = {}) {
5269
5301
  let C = aB(this.url, A), Q = this.#g(B), E;
5270
- return "suffixLength" in I ? E = await gE(C, I.suffixLength, Q, this.#I) : E = await TB(C, I.offset, I.length, Q), sB(E);
5302
+ return "suffixLength" in I ? E = await BE(C, I.suffixLength, Q, this.#I) : E = await xB(C, I.offset, I.length, Q), sB(E);
5271
5303
  }
5272
5304
  }
5273
- class xB {
5305
+ class WB {
5274
5306
  #A;
5275
5307
  constructor(A, I, B) {
5276
5308
  typeof A == "number" ? this.#A = new Uint8Array(A) : A instanceof ArrayBuffer ? this.#A = new Uint8Array(A, I, B) : this.#A = new Uint8Array(Array.from(A, (C) => C ? 1 : 0));
@@ -5420,7 +5452,7 @@ function DB(g, A) {
5420
5452
  for (let E = 0; E < I; E += 1)
5421
5453
  C = g[Q + E], g[Q + E] = g[Q + B - E], g[Q + B - E] = C;
5422
5454
  }
5423
- function WB(g) {
5455
+ function bB(g) {
5424
5456
  if (g === "v2:object")
5425
5457
  return globalThis.Array;
5426
5458
  let A = g.match(/v2:([US])(\d+)/);
@@ -5440,7 +5472,7 @@ function WB(g) {
5440
5472
  float16: globalThis.Float16Array,
5441
5473
  float32: Float32Array,
5442
5474
  float64: Float64Array,
5443
- bool: xB
5475
+ bool: WB
5444
5476
  }[g];
5445
5477
  return W(I, `Unknown or unsupported data_type: ${g}`), I;
5446
5478
  }
@@ -5452,7 +5484,7 @@ function cA(g, A) {
5452
5484
  C[A[Q]] = B, B *= g[A[Q]];
5453
5485
  return C;
5454
5486
  }
5455
- function BE({ name: g, configuration: A }) {
5487
+ function CE({ name: g, configuration: A }) {
5456
5488
  if (g === "default") {
5457
5489
  const I = A?.separator ?? "/";
5458
5490
  return (B) => ["c", ...B].join(I);
@@ -5463,7 +5495,7 @@ function BE({ name: g, configuration: A }) {
5463
5495
  }
5464
5496
  throw new Error(`Unknown chunk key encoding: ${g}`);
5465
5497
  }
5466
- function CE(g) {
5498
+ function QE(g) {
5467
5499
  if (g === "|O")
5468
5500
  return { data_type: "v2:object" };
5469
5501
  let A = g.match(/^([<|>])(.*)$/);
@@ -5484,8 +5516,8 @@ function CE(g) {
5484
5516
  }[B] ?? (B.startsWith("S") || B.startsWith("U") ? `v2:${B}` : void 0);
5485
5517
  return W(C, `Unsupported or unknown dtype: ${g}`), I === "|" ? { data_type: C } : { data_type: C, endian: I === "<" ? "little" : "big" };
5486
5518
  }
5487
- function QE(g, A = {}) {
5488
- let I = [], B = CE(g.dtype);
5519
+ function EE(g, A = {}) {
5520
+ let I = [], B = QE(g.dtype);
5489
5521
  g.order === "F" && I.push({ name: "transpose", configuration: { order: "F" } }), "endian" in B && B.endian === "big" && I.push({ name: "bytes", configuration: { endian: "big" } });
5490
5522
  for (let { id: C, ...Q } of g.filters ?? [])
5491
5523
  I.push({ name: C, configuration: Q });
@@ -5515,14 +5547,14 @@ function QE(g, A = {}) {
5515
5547
  attributes: A
5516
5548
  };
5517
5549
  }
5518
- function EE(g, A = {}) {
5550
+ function iE(g, A = {}) {
5519
5551
  return {
5520
5552
  zarr_format: 3,
5521
5553
  node_type: "group",
5522
5554
  attributes: A
5523
5555
  };
5524
5556
  }
5525
- function iE(g, A) {
5557
+ function oE(g, A) {
5526
5558
  if (A !== "number" && A !== "bigint" && A !== "boolean" && A !== "object" && A !== "string")
5527
5559
  return g === A;
5528
5560
  let I = g === "bool";
@@ -5537,13 +5569,13 @@ function iE(g, A) {
5537
5569
  let Q = g === "v2:object";
5538
5570
  return A === "object" ? Q : !B && !C && !I && !Q;
5539
5571
  }
5540
- function oE(g) {
5572
+ function aE(g) {
5541
5573
  return g?.name === "sharding_indexed";
5542
5574
  }
5543
- function bB(g) {
5575
+ function ZB(g) {
5544
5576
  return (g.data_type === "uint64" || g.data_type === "int64") && g.fill_value != null ? BigInt(g.fill_value) : g.fill_value;
5545
5577
  }
5546
- function ZB(g, ...A) {
5578
+ function PB(g, ...A) {
5547
5579
  if (!A.some((I) => g instanceof I))
5548
5580
  throw g;
5549
5581
  }
@@ -5551,7 +5583,7 @@ function W(g, A = "") {
5551
5583
  if (!g)
5552
5584
  throw new Error(A);
5553
5585
  }
5554
- async function PB(g, { format: A, signal: I }) {
5586
+ async function OB(g, { format: A, signal: I }) {
5555
5587
  const B = g instanceof Response ? g : new Response(g);
5556
5588
  W(B.body, "Response does not contain body.");
5557
5589
  try {
@@ -5584,8 +5616,8 @@ class Ng {
5584
5616
  return A;
5585
5617
  }
5586
5618
  }
5587
- const hB = aE();
5588
- function aE() {
5619
+ const hB = sE();
5620
+ function sE() {
5589
5621
  const g = new Uint32Array([305419896]);
5590
5622
  return new Uint8Array(g.buffer, g.byteOffset, g.byteLength)[0] !== 18;
5591
5623
  }
@@ -5600,7 +5632,7 @@ class xI {
5600
5632
  #C;
5601
5633
  #B;
5602
5634
  constructor(A, I) {
5603
- this.#B = A?.endian, this.#I = WB(I.data_type), this.#C = I.shape, this.#A = cA(I.shape, "C");
5635
+ this.#B = A?.endian, this.#I = bB(I.data_type), this.#C = I.shape, this.#A = cA(I.shape, "C");
5604
5636
  const B = new this.#I(0);
5605
5637
  this.#g = B.BYTES_PER_ELEMENT;
5606
5638
  }
@@ -5640,14 +5672,14 @@ class Ug {
5640
5672
  throw new Error("Gzip encoding is not enabled by default. Please register a custom codec with `numcodecs/gzip`.");
5641
5673
  }
5642
5674
  async decode(A) {
5643
- const I = await PB(A, { format: "gzip" });
5675
+ const I = await OB(A, { format: "gzip" });
5644
5676
  return new Uint8Array(I);
5645
5677
  }
5646
5678
  }
5647
- function sE(g, A) {
5679
+ function DE(g, A) {
5648
5680
  return W(!Number.isNaN(A), "JsonCodec allow_nan is false but NaN was encountered during encoding."), W(A !== Number.POSITIVE_INFINITY, "JsonCodec allow_nan is false but Infinity was encountered during encoding."), W(A !== Number.NEGATIVE_INFINITY, "JsonCodec allow_nan is false but -Infinity was encountered during encoding."), A;
5649
5681
  }
5650
- function DE(g, A) {
5682
+ function hE(g, A) {
5651
5683
  return A instanceof Object && !Array.isArray(A) ? Object.keys(A).sort().reduce((I, B) => (I[B] = A[B], I), {}) : A;
5652
5684
  }
5653
5685
  class kg {
@@ -5677,7 +5709,7 @@ class kg {
5677
5709
  const { indent: I, encoding: B, ensure_ascii: C, check_circular: Q, allow_nan: E, sort_keys: i } = this.#A;
5678
5710
  W(B === "utf-8", "JsonCodec does not yet support non-utf-8 encoding.");
5679
5711
  const o = [];
5680
- W(Q, "JsonCodec does not yet support skipping the check for circular references during encoding."), E || o.push(sE), i && o.push(DE);
5712
+ W(Q, "JsonCodec does not yet support skipping the check for circular references during encoding."), E || o.push(DE), i && o.push(hE);
5681
5713
  const a = Array.from(A.data);
5682
5714
  a.push("|O"), a.push(A.shape);
5683
5715
  let s;
@@ -5703,7 +5735,7 @@ class kg {
5703
5735
  }
5704
5736
  }
5705
5737
  function yB(g) {
5706
- return g instanceof xB || g instanceof Rg || g instanceof yI ? new Proxy(g, {
5738
+ return g instanceof WB || g instanceof Rg || g instanceof yI ? new Proxy(g, {
5707
5739
  get(I, B) {
5708
5740
  return I.get(Number(B));
5709
5741
  },
@@ -5712,7 +5744,7 @@ function yB(g) {
5712
5744
  }
5713
5745
  }) : g;
5714
5746
  }
5715
- function hE(g, A) {
5747
+ function tE(g, A) {
5716
5748
  let I;
5717
5749
  return g.data instanceof Rg || g.data instanceof yI ? I = new g.constructor(
5718
5750
  // @ts-expect-error
@@ -5724,8 +5756,8 @@ function hE(g, A) {
5724
5756
  stride: cA(g.shape, A)
5725
5757
  };
5726
5758
  }
5727
- function tE(g, A) {
5728
- let I = hE(g, A), B = g.shape.length, C = g.data.length, Q = Array(B).fill(0), E = yB(g.data), i = yB(I.data);
5759
+ function yE(g, A) {
5760
+ let I = tE(g, A), B = g.shape.length, C = g.data.length, Q = Array(B).fill(0), E = yB(g.data), i = yB(I.data);
5729
5761
  for (let o = 0; o < C; o++) {
5730
5762
  let a = 0;
5731
5763
  for (let s = 0; s < B; s++)
@@ -5740,12 +5772,12 @@ function tE(g, A) {
5740
5772
  }
5741
5773
  return I;
5742
5774
  }
5743
- function yE(g) {
5775
+ function eE(g) {
5744
5776
  let A = g.shape.length;
5745
5777
  return W(A === g.stride.length, "Shape and stride must have the same length."), g.stride.map((I, B) => ({ stride: I, index: B })).sort((I, B) => B.stride - I.stride).map((I) => I.index);
5746
5778
  }
5747
- function eE(g, A) {
5748
- let I = yE(g);
5779
+ function GE(g, A) {
5780
+ let I = eE(g);
5749
5781
  return W(I.length === A.length, "Orders must match"), I.every((B, C) => B === A[C]);
5750
5782
  }
5751
5783
  class Lg {
@@ -5770,7 +5802,7 @@ class Lg {
5770
5802
  return new Lg(A, I);
5771
5803
  }
5772
5804
  encode(A) {
5773
- return eE(A, this.#I) ? A : tE(A, this.#I);
5805
+ return GE(A, this.#I) ? A : yE(A, this.#I);
5774
5806
  }
5775
5807
  decode(A) {
5776
5808
  return {
@@ -5811,14 +5843,14 @@ class Yg {
5811
5843
  throw new Error("Zlib encoding is not enabled by default. Please register a codec with `numcodecs/zlib`.");
5812
5844
  }
5813
5845
  async decode(A) {
5814
- const I = await PB(A, { format: "deflate" });
5846
+ const I = await OB(A, { format: "deflate" });
5815
5847
  return new Uint8Array(I);
5816
5848
  }
5817
5849
  }
5818
- function GE() {
5850
+ function nE() {
5819
5851
  return (/* @__PURE__ */ new Map()).set("blosc", () => import("./blosc-BOWv2fO7.js").then((g) => g.default)).set("lz4", () => import("./lz4-DUlZKApi.js").then((g) => g.default)).set("zstd", () => import("./zstd-DnzmycJs.js").then((g) => g.default)).set("gzip", () => Ug).set("zlib", () => Yg).set("transpose", () => Lg).set("bytes", () => xI).set("crc32c", () => cg).set("vlen-utf8", () => Jg).set("json2", () => kg).set("bitround", () => Ng);
5820
5852
  }
5821
- const nE = GE();
5853
+ const wE = nE();
5822
5854
  function og(g) {
5823
5855
  let A;
5824
5856
  return {
@@ -5844,7 +5876,7 @@ function og(g) {
5844
5876
  }
5845
5877
  async function eB(g) {
5846
5878
  let A = g.codecs.map(async (Q) => {
5847
- let E = await nE.get(Q.name)?.();
5879
+ let E = await wE.get(Q.name)?.();
5848
5880
  return W(E, `Unknown codec: ${Q.name}`), { Codec: E, meta: Q };
5849
5881
  }), I = [], B, C = [];
5850
5882
  for await (let { Codec: Q, meta: E } of A) {
@@ -5860,9 +5892,9 @@ async function eB(g) {
5860
5892
  C.push(i);
5861
5893
  }
5862
5894
  }
5863
- return B || (W(wE(g), `Cannot encode ${g.data_type} to bytes without a codec`), B = xI.fromConfig({ endian: "little" }, g)), { array_to_array: I, array_to_bytes: B, bytes_to_bytes: C };
5895
+ return B || (W(FE(g), `Cannot encode ${g.data_type} to bytes without a codec`), B = xI.fromConfig({ endian: "little" }, g)), { array_to_array: I, array_to_bytes: B, bytes_to_bytes: C };
5864
5896
  }
5865
- function wE(g) {
5897
+ function FE(g) {
5866
5898
  return g.data_type !== "v2:object";
5867
5899
  }
5868
5900
  class GI extends Error {
@@ -5876,7 +5908,7 @@ class dg extends Error {
5876
5908
  }
5877
5909
  }
5878
5910
  const GB = 18446744073709551615n;
5879
- function FE(g, A, I, B) {
5911
+ function rE(g, A, I, B) {
5880
5912
  W(g.store.getRange, "Store does not support range requests");
5881
5913
  let C = g.store.getRange.bind(g.store), Q = A.map((o, a) => o / B.chunk_shape[a]), E = og({
5882
5914
  data_type: "uint64",
@@ -5928,13 +5960,13 @@ function nB(g) {
5928
5960
  return g.find((I) => I.name === "transpose")?.configuration?.order ?? "C";
5929
5961
  }
5930
5962
  const PA = Symbol("zarrita.context");
5931
- function rE(g) {
5963
+ function SE(g) {
5932
5964
  return g[PA];
5933
5965
  }
5934
- function SE(g, A) {
5935
- let { configuration: I } = A.codecs.find(oE) ?? {}, B = {
5936
- encode_chunk_key: BE(A.chunk_key_encoding),
5937
- TypedArray: WB(A.data_type),
5966
+ function RE(g, A) {
5967
+ let { configuration: I } = A.codecs.find(aE) ?? {}, B = {
5968
+ encode_chunk_key: CE(A.chunk_key_encoding),
5969
+ TypedArray: bB(A.data_type),
5938
5970
  fill_value: A.fill_value
5939
5971
  };
5940
5972
  if (I) {
@@ -5951,7 +5983,7 @@ function SE(g, A) {
5951
5983
  get_strides(E) {
5952
5984
  return cA(E, Q);
5953
5985
  },
5954
- get_chunk_bytes: FE(g, A.chunk_grid.configuration.chunk_shape, B.encode_chunk_key, I)
5986
+ get_chunk_bytes: rE(g, A.chunk_grid.configuration.chunk_shape, B.encode_chunk_key, I)
5955
5987
  };
5956
5988
  }
5957
5989
  let C = nB(A.codecs);
@@ -5980,8 +6012,8 @@ let JI = class extends j {
5980
6012
  constructor(A, I, B) {
5981
6013
  super(A, I), this.#A = {
5982
6014
  ...B,
5983
- fill_value: bB(B)
5984
- }, this[PA] = SE(this, B);
6015
+ fill_value: ZB(B)
6016
+ }, this[PA] = RE(this, B);
5985
6017
  }
5986
6018
  get attrs() {
5987
6019
  return this.#A.attributes;
@@ -6025,15 +6057,15 @@ let JI = class extends j {
6025
6057
  * ```
6026
6058
  */
6027
6059
  is(A) {
6028
- return iE(this.dtype, A);
6060
+ return oE(this.dtype, A);
6029
6061
  }
6030
6062
  };
6031
- function* RE(g, A, I = 1) {
6063
+ function* NE(g, A, I = 1) {
6032
6064
  A === void 0 && (A = g, g = 0);
6033
6065
  for (let B = g; B < A; B += I)
6034
6066
  yield B;
6035
6067
  }
6036
- function* NE(...g) {
6068
+ function* cE(...g) {
6037
6069
  if (g.length === 0)
6038
6070
  return;
6039
6071
  const A = g.map((B) => B[Symbol.iterator]()), I = A.map((B) => B.next());
@@ -6048,7 +6080,7 @@ function* NE(...g) {
6048
6080
  I[B] = A[B].next();
6049
6081
  }
6050
6082
  }
6051
- function cE({ start: g, stop: A, step: I }, B) {
6083
+ function UE({ start: g, stop: A, step: I }, B) {
6052
6084
  if (I === 0)
6053
6085
  throw new Error("slice step cannot be zero");
6054
6086
  I = I ?? 1;
@@ -6062,7 +6094,7 @@ function YI(g, A, I = null) {
6062
6094
  step: I
6063
6095
  };
6064
6096
  }
6065
- function UE() {
6097
+ function kE() {
6066
6098
  const g = [];
6067
6099
  return {
6068
6100
  add: (A) => g.push(A()),
@@ -6074,28 +6106,28 @@ class Kg extends Error {
6074
6106
  super(A), this.name = "IndexError";
6075
6107
  }
6076
6108
  }
6077
- function kE(g, A) {
6109
+ function LE(g, A) {
6078
6110
  throw new Kg(`too many indicies for array; expected ${A.length}, got ${g.length}`);
6079
6111
  }
6080
- function LE(g) {
6112
+ function JE(g) {
6081
6113
  throw new Kg(`index out of bounds for dimension with length ${g}`);
6082
6114
  }
6083
- function JE() {
6115
+ function YE() {
6084
6116
  throw new Kg("only slices with step >= 1 are supported");
6085
6117
  }
6086
- function YE(g, A) {
6087
- g.length > A.length && kE(g, A);
6088
- }
6089
6118
  function dE(g, A) {
6090
- return g = Math.trunc(g), g < 0 && (g = A + g), (g >= A || g < 0) && LE(A), g;
6119
+ g.length > A.length && LE(g, A);
6120
+ }
6121
+ function ME(g, A) {
6122
+ return g = Math.trunc(g), g < 0 && (g = A + g), (g >= A || g < 0) && JE(A), g;
6091
6123
  }
6092
- class ME {
6124
+ class KE {
6093
6125
  dim_sel;
6094
6126
  dim_len;
6095
6127
  dim_chunk_len;
6096
6128
  nitems;
6097
6129
  constructor({ dim_sel: A, dim_len: I, dim_chunk_len: B }) {
6098
- A = dE(A, I), this.dim_sel = A, this.dim_len = I, this.dim_chunk_len = B, this.nitems = 1;
6130
+ A = ME(A, I), this.dim_sel = A, this.dim_len = I, this.dim_chunk_len = B, this.nitems = 1;
6099
6131
  }
6100
6132
  *[Symbol.iterator]() {
6101
6133
  const A = Math.floor(this.dim_sel / this.dim_chunk_len), I = A * this.dim_chunk_len, B = this.dim_sel - I;
@@ -6111,12 +6143,12 @@ class wB {
6111
6143
  nitems;
6112
6144
  nchunks;
6113
6145
  constructor({ dim_sel: A, dim_len: I, dim_chunk_len: B }) {
6114
- const [C, Q, E] = cE(A, I);
6115
- this.start = C, this.stop = Q, this.step = E, this.step < 1 && JE(), this.dim_len = I, this.dim_chunk_len = B, this.nitems = Math.max(0, Math.ceil((this.stop - this.start) / this.step)), this.nchunks = Math.ceil(this.dim_len / this.dim_chunk_len);
6146
+ const [C, Q, E] = UE(A, I);
6147
+ this.start = C, this.stop = Q, this.step = E, this.step < 1 && YE(), this.dim_len = I, this.dim_chunk_len = B, this.nitems = Math.max(0, Math.ceil((this.stop - this.start) / this.step)), this.nchunks = Math.ceil(this.dim_len / this.dim_chunk_len);
6116
6148
  }
6117
6149
  *[Symbol.iterator]() {
6118
6150
  const A = Math.floor(this.start / this.dim_chunk_len), I = Math.ceil(this.stop / this.dim_chunk_len);
6119
- for (const B of RE(A, I)) {
6151
+ for (const B of NE(A, I)) {
6120
6152
  const C = B * this.dim_chunk_len, Q = Math.min(this.dim_len, (B + 1) * this.dim_chunk_len), E = Q - C;
6121
6153
  let i = 0, o = 0;
6122
6154
  if (this.start < C) {
@@ -6137,15 +6169,15 @@ class wB {
6137
6169
  }
6138
6170
  }
6139
6171
  }
6140
- function KE(g, A) {
6172
+ function HE(g, A) {
6141
6173
  let I = [];
6142
- return g === null ? I = A.map((B) => YI(null)) : Array.isArray(g) && (I = g.map((B) => B ?? YI(null))), YE(I, A), I;
6174
+ return g === null ? I = A.map((B) => YI(null)) : Array.isArray(g) && (I = g.map((B) => B ?? YI(null))), dE(I, A), I;
6143
6175
  }
6144
- class HE {
6176
+ class qE {
6145
6177
  dim_indexers;
6146
6178
  shape;
6147
6179
  constructor({ selection: A, shape: I, chunk_shape: B }) {
6148
- this.dim_indexers = KE(A, I).map((C, Q) => new (typeof C == "number" ? ME : wB)({
6180
+ this.dim_indexers = HE(A, I).map((C, Q) => new (typeof C == "number" ? KE : wB)({
6149
6181
  // @ts-expect-error ts inference not strong enough to know correct chunk
6150
6182
  dim_sel: C,
6151
6183
  dim_len: I[Q],
@@ -6153,27 +6185,27 @@ class HE {
6153
6185
  })), this.shape = this.dim_indexers.filter((C) => C instanceof wB).map((C) => C.nitems);
6154
6186
  }
6155
6187
  *[Symbol.iterator]() {
6156
- for (const A of NE(...this.dim_indexers)) {
6188
+ for (const A of cE(...this.dim_indexers)) {
6157
6189
  const I = A.map((C) => C.dim_chunk_ix), B = A.map((C) => "dim_out_sel" in C ? { from: C.dim_chunk_sel, to: C.dim_out_sel } : { from: C.dim_chunk_sel, to: null });
6158
6190
  yield { chunk_coords: I, mapping: B };
6159
6191
  }
6160
6192
  }
6161
6193
  }
6162
- function qE(g, A) {
6194
+ function lE(g, A) {
6163
6195
  return "get" in g ? g.get(A) : g[A];
6164
6196
  }
6165
- async function lE(g, A, I, B) {
6166
- let C = rE(g), Q = new HE({
6197
+ async function fE(g, A, I, B) {
6198
+ let C = SE(g), Q = new qE({
6167
6199
  selection: A,
6168
6200
  shape: g.shape,
6169
6201
  chunk_shape: g.chunks
6170
- }), E = B.prepare(new C.TypedArray(Q.shape.reduce((o, a) => o * a, 1)), Q.shape, C.get_strides(Q.shape)), i = I.create_queue?.() ?? UE();
6202
+ }), E = B.prepare(new C.TypedArray(Q.shape.reduce((o, a) => o * a, 1)), Q.shape, C.get_strides(Q.shape)), i = I.create_queue?.() ?? kE();
6171
6203
  for (const { chunk_coords: o, mapping: a } of Q)
6172
6204
  i.add(async () => {
6173
6205
  let { data: s, shape: h, stride: t } = await g.getChunk(o, I.opts), y = B.prepare(s, h, t);
6174
6206
  B.set_from_chunk(E, y, a);
6175
6207
  });
6176
- return await i.onIdle(), Q.shape.length === 0 ? qE(E.data, 0) : E;
6208
+ return await i.onIdle(), Q.shape.length === 0 ? lE(E.data, 0) : E;
6177
6209
  }
6178
6210
  function Hg(g, A = 0, I) {
6179
6211
  let B = I ?? g.length - A;
@@ -6203,32 +6235,32 @@ function gg(g) {
6203
6235
  bytes_per_element: g.data.BYTES_PER_ELEMENT
6204
6236
  };
6205
6237
  }
6206
- function fE(g) {
6238
+ function pE(g) {
6207
6239
  return "chars" in g ? g.constructor.bind(null, g.chars) : g.constructor;
6208
6240
  }
6209
- function pE(g, A) {
6241
+ function mE(g, A) {
6210
6242
  if (globalThis.Array.isArray(g.data))
6211
6243
  return Hg([A]);
6212
- let I = fE(g.data), B = new I([A]);
6244
+ let I = pE(g.data), B = new I([A]);
6213
6245
  return new Uint8Array(B.buffer, B.byteOffset, B.byteLength);
6214
6246
  }
6215
- const mE = {
6247
+ const uE = {
6216
6248
  prepare(g, A, I) {
6217
6249
  return { data: g, shape: A, stride: I };
6218
6250
  },
6219
6251
  set_scalar(g, A, I) {
6220
6252
  let B = gg(g);
6221
- ag(B, A, pE(g, I), B.bytes_per_element);
6253
+ ag(B, A, mE(g, I), B.bytes_per_element);
6222
6254
  },
6223
6255
  set_from_chunk(g, A, I) {
6224
6256
  let B = gg(g);
6225
6257
  SI(B, gg(A), B.bytes_per_element, I);
6226
6258
  }
6227
6259
  };
6228
- async function uE(g, A = null, I = {}) {
6229
- return lE(g, A, I, mE);
6260
+ async function TE(g, A = null, I = {}) {
6261
+ return fE(g, A, I, uE);
6230
6262
  }
6231
- function OB(g, A, I) {
6263
+ function VB(g, A, I) {
6232
6264
  return I < 0 && A < g ? Math.floor((g - A - 1) / -I) + 1 : g < A ? Math.floor((A - g - 1) / I) + 1 : 0;
6233
6265
  }
6234
6266
  function ag(g, A, I, B) {
@@ -6242,7 +6274,7 @@ function ag(g, A, I, B) {
6242
6274
  ag({ data: t, stride: i }, Q, I, B);
6243
6275
  return;
6244
6276
  }
6245
- const [o, a, s] = C, h = OB(o, a, s);
6277
+ const [o, a, s] = C, h = VB(o, a, s);
6246
6278
  if (Q.length === 0) {
6247
6279
  for (let t = 0; t < h; t++)
6248
6280
  g.data.set(I, E * (o + s * t) * B);
@@ -6278,7 +6310,7 @@ function SI(g, A, I, B) {
6278
6310
  }, I, Q);
6279
6311
  return;
6280
6312
  }
6281
- const [s, h, t] = C.to, [y, n, w] = C.from, r = OB(s, h, t);
6313
+ const [s, h, t] = C.to, [y, n, w] = C.from, r = VB(s, h, t);
6282
6314
  if (Q.length === 0) {
6283
6315
  if (t === 1 && w === 1 && E === 1 && o === 1) {
6284
6316
  let G = y * I, c = r * I;
@@ -6300,8 +6332,8 @@ function SI(g, A, I, B) {
6300
6332
  stride: a
6301
6333
  }, I, Q);
6302
6334
  }
6303
- let WI = TE();
6304
- function TE() {
6335
+ let WI = xE();
6336
+ function xE() {
6305
6337
  let g = /* @__PURE__ */ new WeakMap();
6306
6338
  function A(I) {
6307
6339
  let B = g.get(I) ?? { v2: 0, v3: 0 };
@@ -6317,13 +6349,13 @@ function TE() {
6317
6349
  }
6318
6350
  };
6319
6351
  }
6320
- async function xE(g) {
6352
+ async function WE(g) {
6321
6353
  let A = await g.store.get(g.resolve(".zattrs").path);
6322
6354
  return A ? eI(A) : {};
6323
6355
  }
6324
- async function WE(g, A = {}) {
6356
+ async function bE(g, A = {}) {
6325
6357
  let I = "store" in g ? g : new j(g), B = {};
6326
- return (A.attrs ?? !0) && (B = await xE(I)), A.kind === "array" ? FB(I, B) : A.kind === "group" ? rB(I, B) : FB(I, B).catch((C) => (ZB(C, GI), rB(I, B)));
6358
+ return (A.attrs ?? !0) && (B = await WE(I)), A.kind === "array" ? FB(I, B) : A.kind === "group" ? rB(I, B) : FB(I, B).catch((C) => (PB(C, GI), rB(I, B)));
6327
6359
  }
6328
6360
  async function FB(g, A) {
6329
6361
  let { path: I } = g.resolve(".zarray"), B = await g.store.get(I);
@@ -6331,7 +6363,7 @@ async function FB(g, A) {
6331
6363
  throw new GI("v2 array", {
6332
6364
  cause: new dg(I)
6333
6365
  });
6334
- return WI.increment(g.store, "v2"), new JI(g.store, g.path, QE(eI(B), A));
6366
+ return WI.increment(g.store, "v2"), new JI(g.store, g.path, EE(eI(B), A));
6335
6367
  }
6336
6368
  async function rB(g, A) {
6337
6369
  let { path: I } = g.resolve(".zgroup"), B = await g.store.get(I);
@@ -6339,19 +6371,19 @@ async function rB(g, A) {
6339
6371
  throw new GI("v2 group", {
6340
6372
  cause: new dg(I)
6341
6373
  });
6342
- return WI.increment(g.store, "v2"), new Mg(g.store, g.path, EE(eI(B), A));
6374
+ return WI.increment(g.store, "v2"), new Mg(g.store, g.path, iE(eI(B), A));
6343
6375
  }
6344
- async function bE(g) {
6376
+ async function ZE(g) {
6345
6377
  let { store: A, path: I } = g.resolve("zarr.json"), B = await g.store.get(I);
6346
6378
  if (!B)
6347
6379
  throw new GI("v3 array or group", {
6348
6380
  cause: new dg(I)
6349
6381
  });
6350
6382
  let C = eI(B);
6351
- return C.node_type === "array" && (C.fill_value = bB(C)), C.node_type === "array" ? new JI(A, g.path, C) : new Mg(A, g.path, C);
6383
+ return C.node_type === "array" && (C.fill_value = ZB(C)), C.node_type === "array" ? new JI(A, g.path, C) : new Mg(A, g.path, C);
6352
6384
  }
6353
- async function ZE(g, A = {}) {
6354
- let I = "store" in g ? g : new j(g), B = await bE(I);
6385
+ async function PE(g, A = {}) {
6386
+ let I = "store" in g ? g : new j(g), B = await ZE(I);
6355
6387
  if (WI.increment(I.store, "v3"), A.kind === void 0 || A.kind === "array" && B instanceof JI || A.kind === "group" && B instanceof Mg)
6356
6388
  return B;
6357
6389
  let C = B instanceof JI ? "array" : "group";
@@ -6359,11 +6391,11 @@ async function ZE(g, A = {}) {
6359
6391
  }
6360
6392
  async function AA(g, A = {}) {
6361
6393
  let I = "store" in g ? g.store : g, B = WI.version_max(I), C = B === "v2" ? AA.v2 : AA.v3, Q = B === "v2" ? AA.v3 : AA.v2;
6362
- return C(g, A).catch((E) => (ZB(E, GI), Q(g, A)));
6394
+ return C(g, A).catch((E) => (PB(E, GI), Q(g, A)));
6363
6395
  }
6364
- AA.v2 = WE;
6365
- AA.v3 = ZE;
6366
- async function PE(g, A) {
6396
+ AA.v2 = bE;
6397
+ AA.v3 = PE;
6398
+ async function OE(g, A) {
6367
6399
  const I = A.split("/"), B = I.pop();
6368
6400
  if (!B)
6369
6401
  throw new Error("Invalid path");
@@ -6380,7 +6412,7 @@ class qg {
6380
6412
  return this.#A;
6381
6413
  }
6382
6414
  async get(A) {
6383
- const I = await PE(this.#A, A.slice(1)).catch(
6415
+ const I = await OE(this.#A, A.slice(1)).catch(
6384
6416
  () => {
6385
6417
  }
6386
6418
  );
@@ -6390,7 +6422,7 @@ class qg {
6390
6422
  return new Uint8Array(C);
6391
6423
  }
6392
6424
  }
6393
- function OE() {
6425
+ function VE() {
6394
6426
  if (typeof window > "u")
6395
6427
  return;
6396
6428
  const g = window.location.hostname;
@@ -6407,7 +6439,7 @@ class lg extends ZA {
6407
6439
  overrides;
6408
6440
  useSuffixRequest;
6409
6441
  constructor(A) {
6410
- OE(), super(A.url, {
6442
+ VE(), super(A.url, {
6411
6443
  overrides: A.overrides,
6412
6444
  useSuffixRequest: A.useSuffixRequest
6413
6445
  }), this.credentials = A.credentials, this.region = A.region, this.overrides = A.overrides, this.useSuffixRequest = A.useSuffixRequest;
@@ -6545,7 +6577,7 @@ async function nI(g, A) {
6545
6577
  throw new Error(`Failed to open Zarr group at ${g}`);
6546
6578
  }
6547
6579
  }
6548
- async function VE(g, A) {
6580
+ async function vE(g, A) {
6549
6581
  if (A === "v2")
6550
6582
  try {
6551
6583
  return AA.v2(g, { kind: "array", attrs: !1 });
@@ -6564,7 +6596,7 @@ async function VE(g, A) {
6564
6596
  throw new Error(`Failed to open Zarr array at ${g}`);
6565
6597
  }
6566
6598
  }
6567
- async function vE(g) {
6599
+ async function XE(g) {
6568
6600
  let A;
6569
6601
  switch (g.type) {
6570
6602
  case "fetch": {
@@ -6590,9 +6622,9 @@ async function vE(g) {
6590
6622
  }
6591
6623
  }
6592
6624
  const I = g.arrayPath ? A.resolve(g.arrayPath) : A;
6593
- return VE(I, g.zarrVersion);
6625
+ return vE(I, g.zarrVersion);
6594
6626
  }
6595
- function XE(g, A, I) {
6627
+ function jE(g, A, I) {
6596
6628
  if (g.store instanceof lg)
6597
6629
  return {
6598
6630
  type: "s3",
@@ -6623,7 +6655,7 @@ function XE(g, A, I) {
6623
6655
  `Unsupported store type: ${g.store.constructor.name}`
6624
6656
  );
6625
6657
  }
6626
- const VB = `function Bg(i, A, g, E = {}) {
6658
+ const vB = `function Bg(i, A, g, E = {}) {
6627
6659
  return A !== void 0 && g !== void 0 && (E = {
6628
6660
  ...E,
6629
6661
  headers: {
@@ -9766,8 +9798,8 @@ return ret;
9766
9798
  default: FB
9767
9799
  });
9768
9800
  //# sourceMappingURL=worker_kernel-uaRPnPAm.js.map
9769
- `, SB = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", VB], { type: "text/javascript;charset=utf-8" });
9770
- function jE(g) {
9801
+ `, SB = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", vB], { type: "text/javascript;charset=utf-8" });
9802
+ function zE(g) {
9771
9803
  let A;
9772
9804
  try {
9773
9805
  if (A = SB && (self.URL || self.webkitURL).createObjectURL(SB), !A) throw "";
@@ -9780,7 +9812,7 @@ function jE(g) {
9780
9812
  }), I;
9781
9813
  } catch {
9782
9814
  return new Worker(
9783
- "data:text/javascript;charset=utf-8," + encodeURIComponent(VB),
9815
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(vB),
9784
9816
  {
9785
9817
  type: "module",
9786
9818
  name: g?.name
@@ -9788,17 +9820,17 @@ function jE(g) {
9788
9820
  );
9789
9821
  }
9790
9822
  }
9791
- const zE = Math.min(navigator.hardwareConcurrency, 8);
9792
- let BA = [], _E = 0, vB = 0;
9823
+ const _E = Math.min(navigator.hardwareConcurrency, 8);
9824
+ let BA = [], $E = 0, XB = 0;
9793
9825
  const UA = /* @__PURE__ */ new Map(), dI = /* @__PURE__ */ new Set();
9794
- function XB(g) {
9826
+ function jB(g) {
9795
9827
  const A = BA.find((I) => I.worker === g);
9796
9828
  return A || U.error(
9797
9829
  "ZarrWorker",
9798
9830
  "Worker not found in pool - this should not happen"
9799
9831
  ), A;
9800
9832
  }
9801
- function $E(g, A) {
9833
+ function Ai(g, A) {
9802
9834
  const { id: I, success: B } = g.data, C = UA.get(I);
9803
9835
  if (!C) {
9804
9836
  dI.has(I) ? dI.delete(I) : U.warn(
@@ -9809,7 +9841,7 @@ function $E(g, A) {
9809
9841
  return;
9810
9842
  }
9811
9843
  UA.delete(I), C.abortListener && C.abortSignal && C.abortSignal.removeEventListener("abort", C.abortListener);
9812
- const Q = XB(A);
9844
+ const Q = jB(A);
9813
9845
  Q && Q.pendingCount > 0 ? Q.pendingCount-- : Q && U.error(
9814
9846
  "ZarrWorker",
9815
9847
  "Received message but no pending tasks - this should not happen"
@@ -9828,7 +9860,7 @@ function RB(g, A) {
9828
9860
  "Worker failed - replacing worker and canceling its in-flight messages",
9829
9861
  g.message
9830
9862
  );
9831
- const I = XB(A);
9863
+ const I = jB(A);
9832
9864
  if (I) {
9833
9865
  const C = BA.indexOf(I);
9834
9866
  BA.splice(C, 1);
@@ -9838,31 +9870,31 @@ function RB(g, A) {
9838
9870
  for (const [C, Q] of UA.entries())
9839
9871
  Q.workerId === B && (Q.reject(new Error(`Worker error: ${g.message}`)), UA.delete(C));
9840
9872
  try {
9841
- const C = jB();
9873
+ const C = zB();
9842
9874
  BA.push({
9843
9875
  worker: C,
9844
9876
  pendingCount: 0,
9845
- workerId: vB++
9877
+ workerId: XB++
9846
9878
  }), U.debug("ZarrWorker", "Replacement worker created successfully");
9847
9879
  } catch (C) {
9848
9880
  U.error("ZarrWorker", "Failed to create replacement worker", C);
9849
9881
  }
9850
9882
  }
9851
- function jB() {
9852
- const g = new jE();
9853
- return g.addEventListener("message", (A) => $E(A, g)), g.addEventListener("error", (A) => RB(A, g)), g.addEventListener(
9883
+ function zB() {
9884
+ const g = new zE();
9885
+ return g.addEventListener("message", (A) => Ai(A, g)), g.addEventListener("error", (A) => RB(A, g)), g.addEventListener(
9854
9886
  "messageerror",
9855
9887
  (A) => RB(A, g)
9856
9888
  ), g;
9857
9889
  }
9858
- function Ai() {
9890
+ function Ii() {
9859
9891
  if (BA.length === 0)
9860
9892
  throw new Error("Worker pool is not initialized");
9861
9893
  return BA.sort((g, A) => g.pendingCount - A.pendingCount)[0];
9862
9894
  }
9863
- async function Ii(g, A, I) {
9895
+ async function gi(g, A, I) {
9864
9896
  return new Promise((B, C) => {
9865
- const Q = Ai(), E = _E++, i = {
9897
+ const Q = Ii(), E = $E++, i = {
9866
9898
  resolve: B,
9867
9899
  reject: C,
9868
9900
  workerId: Q.workerId
@@ -9888,15 +9920,15 @@ async function Ii(g, A, I) {
9888
9920
  });
9889
9921
  });
9890
9922
  }
9891
- function gi() {
9923
+ function Bi() {
9892
9924
  if (!(BA.length > 0))
9893
9925
  try {
9894
- for (let g = 0; g < zE; g++) {
9895
- const A = jB();
9926
+ for (let g = 0; g < _E; g++) {
9927
+ const A = zB();
9896
9928
  BA.push({
9897
9929
  worker: A,
9898
9930
  pendingCount: 0,
9899
- workerId: vB++
9931
+ workerId: XB++
9900
9932
  });
9901
9933
  }
9902
9934
  U.debug(
@@ -9904,26 +9936,26 @@ function gi() {
9904
9936
  `Initialized worker pool with ${BA.length} workers`
9905
9937
  );
9906
9938
  } catch {
9907
- U.warn("ZarrWorker", "Failed to create workers - clearing pool"), Ci();
9939
+ U.warn("ZarrWorker", "Failed to create workers - clearing pool"), Qi();
9908
9940
  return;
9909
9941
  }
9910
9942
  }
9911
- async function Bi(g, A, I, B) {
9912
- gi();
9943
+ async function Ci(g, A, I, B) {
9944
+ Bi();
9913
9945
  try {
9914
- return await Ii(A, I, B);
9946
+ return await gi(A, I, B);
9915
9947
  } catch (C) {
9916
9948
  if (C instanceof DOMException && C.name === "AbortError")
9917
9949
  throw C;
9918
9950
  return U.warn("ZarrWorker", "Falling back to main thread", C), await g.getChunk(I, B);
9919
9951
  }
9920
9952
  }
9921
- function Ci() {
9953
+ function Qi() {
9922
9954
  for (const g of BA)
9923
9955
  g.worker.terminate();
9924
9956
  BA = [], UA.clear();
9925
9957
  }
9926
- class Qi {
9958
+ class Ei {
9927
9959
  promises_ = [];
9928
9960
  scheduler_;
9929
9961
  constructor(A) {
@@ -9936,13 +9968,13 @@ class Qi {
9936
9968
  return Promise.all(this.promises_.map((A) => this.scheduler_.submit(A)));
9937
9969
  }
9938
9970
  }
9939
- class Ei {
9971
+ class ii {
9940
9972
  metadata_;
9941
9973
  arrays_;
9942
9974
  arrayParams_;
9943
9975
  dimensions_;
9944
9976
  constructor(A) {
9945
- this.metadata_ = A.metadata, this.arrays_ = A.arrays, this.arrayParams_ = A.arrayParams, this.dimensions_ = ii(this.metadata_, this.arrays_);
9977
+ this.metadata_ = A.metadata, this.arrays_ = A.arrays, this.arrayParams_ = A.arrayParams, this.dimensions_ = oi(this.metadata_, this.arrays_);
9946
9978
  }
9947
9979
  getSourceDimensionMap() {
9948
9980
  return this.dimensions_;
@@ -9961,7 +9993,7 @@ class Ei {
9961
9993
  A.chunkIndex.t / o.chunkSize
9962
9994
  );
9963
9995
  }
9964
- const C = this.arrays_[A.lod], Q = this.arrayParams_[A.lod], E = await Bi(C, Q, B, {
9996
+ const C = this.arrays_[A.lod], Q = this.arrayParams_[A.lod], E = await Ci(C, Q, B, {
9965
9997
  signal: I
9966
9998
  });
9967
9999
  A.data = this.sliceReceivedChunk(A, E);
@@ -10015,10 +10047,10 @@ class Ei {
10015
10047
  const C = this.regionToIndices(A, I), Q = this.arrays_[I];
10016
10048
  let E = {};
10017
10049
  B !== void 0 && (E = {
10018
- create_queue: () => new Qi(B),
10050
+ create_queue: () => new Ei(B),
10019
10051
  opts: { signal: B.abortSignal }
10020
10052
  });
10021
- const i = await uE(Q, C, E);
10053
+ const i = await TE(Q, C, E);
10022
10054
  if (!zg(i.data))
10023
10055
  throw new Error(
10024
10056
  `Subarray has an unsupported data type, data=${i.data.constructor.name}`
@@ -10066,7 +10098,7 @@ class Ei {
10066
10098
  this.dimensions_.t
10067
10099
  ].filter((Q) => Q !== void 0).sort((Q, E) => Q.index - E.index), C = [];
10068
10100
  for (const Q of B) {
10069
- const E = A.find((s) => zB(s.dimension, Q.name));
10101
+ const E = A.find((s) => _B(s.dimension, Q.name));
10070
10102
  if (!E)
10071
10103
  throw new Error(`Region does not contain a slice for ${Q.name}`);
10072
10104
  const i = Q.lods[I];
@@ -10080,7 +10112,7 @@ class Ei {
10080
10112
  return C;
10081
10113
  }
10082
10114
  }
10083
- function ii(g, A) {
10115
+ function oi(g, A) {
10084
10116
  const I = g.axes.map((h) => h.name), B = g.axes.length, C = NB(I, "x"), Q = NB(I, "y"), E = (h, t) => {
10085
10117
  const y = [];
10086
10118
  for (let n = 0; n < g.datasets.length; n++) {
@@ -10109,7 +10141,7 @@ function ii(g, A) {
10109
10141
  const s = RI(I, "t");
10110
10142
  return s !== -1 && (i.t = E(I[s], s)), i;
10111
10143
  }
10112
- function zB(g, A) {
10144
+ function _B(g, A) {
10113
10145
  return g.toLowerCase() === A.toLowerCase();
10114
10146
  }
10115
10147
  function NB(g, A) {
@@ -10121,7 +10153,7 @@ function NB(g, A) {
10121
10153
  return I;
10122
10154
  }
10123
10155
  function RI(g, A) {
10124
- return g.findIndex((I) => zB(I, A));
10156
+ return g.findIndex((I) => _B(I, A));
10125
10157
  }
10126
10158
  function cB(g) {
10127
10159
  let A = 1;
@@ -10236,7 +10268,7 @@ const S = H.arrayToEnum([
10236
10268
  "invalid_intersection_types",
10237
10269
  "not_multiple_of",
10238
10270
  "not_finite"
10239
- ]), oi = (g) => JSON.stringify(g, null, 2).replace(/"([^"]+)":/g, "$1:");
10271
+ ]), ai = (g) => JSON.stringify(g, null, 2).replace(/"([^"]+)":/g, "$1:");
10240
10272
  class _ extends Error {
10241
10273
  get errors() {
10242
10274
  return this.issues;
@@ -10353,12 +10385,12 @@ const mA = (g, A) => {
10353
10385
  }
10354
10386
  return { message: I };
10355
10387
  };
10356
- let _B = mA;
10357
- function ai(g) {
10358
- _B = g;
10388
+ let $B = mA;
10389
+ function si(g) {
10390
+ $B = g;
10359
10391
  }
10360
10392
  function MI() {
10361
- return _B;
10393
+ return $B;
10362
10394
  }
10363
10395
  const KI = (g) => {
10364
10396
  const { data: A, path: I, errorMaps: B, issueData: C } = g, Q = [...I, ...C.path || []], E = {
@@ -10380,7 +10412,7 @@ const KI = (g) => {
10380
10412
  path: Q,
10381
10413
  message: i
10382
10414
  };
10383
- }, si = [];
10415
+ }, Di = [];
10384
10416
  function F(g, A) {
10385
10417
  const I = MI(), B = KI({
10386
10418
  issueData: A,
@@ -10447,7 +10479,7 @@ function HI(g, A, I, B) {
10447
10479
  if (typeof A == "function" ? g !== A || !0 : !A.has(g)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10448
10480
  return A.get(g);
10449
10481
  }
10450
- function $B(g, A, I, B, C) {
10482
+ function AC(g, A, I, B, C) {
10451
10483
  if (typeof A == "function" ? g !== A || !0 : !A.has(g)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10452
10484
  return A.set(g, I), I;
10453
10485
  }
@@ -10711,26 +10743,26 @@ class K {
10711
10743
  return this.safeParse(null).success;
10712
10744
  }
10713
10745
  }
10714
- const Di = /^c[^\s-]{8,}$/i, hi = /^[0-9a-z]+$/, ti = /^[0-9A-HJKMNP-TV-Z]{26}$/i, yi = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, ei = /^[a-z0-9_-]{21}$/i, Gi = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, ni = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, wi = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Fi = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
10746
+ const hi = /^c[^\s-]{8,}$/i, ti = /^[0-9a-z]+$/, yi = /^[0-9A-HJKMNP-TV-Z]{26}$/i, ei = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Gi = /^[a-z0-9_-]{21}$/i, ni = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, wi = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Fi = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, ri = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
10715
10747
  let Bg;
10716
- const ri = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Si = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Ri = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Ni = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, ci = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Ui = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, AC = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", ki = new RegExp(`^${AC}$`);
10717
- function IC(g) {
10748
+ const Si = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Ri = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Ni = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, ci = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Ui = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, ki = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, IC = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", Li = new RegExp(`^${IC}$`);
10749
+ function gC(g) {
10718
10750
  let A = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
10719
10751
  return g.precision ? A = `${A}\\.\\d{${g.precision}}` : g.precision == null && (A = `${A}(\\.\\d+)?`), A;
10720
10752
  }
10721
- function Li(g) {
10722
- return new RegExp(`^${IC(g)}$`);
10753
+ function Ji(g) {
10754
+ return new RegExp(`^${gC(g)}$`);
10723
10755
  }
10724
- function gC(g) {
10725
- let A = `${AC}T${IC(g)}`;
10756
+ function BC(g) {
10757
+ let A = `${IC}T${gC(g)}`;
10726
10758
  const I = [];
10727
10759
  return I.push(g.local ? "Z?" : "Z"), g.offset && I.push("([+-]\\d{2}:?\\d{2})"), A = `${A}(${I.join("|")})`, new RegExp(`^${A}$`);
10728
10760
  }
10729
- function Ji(g, A) {
10730
- return !!((A === "v4" || !A) && ri.test(g) || (A === "v6" || !A) && Ri.test(g));
10731
- }
10732
10761
  function Yi(g, A) {
10733
- if (!Gi.test(g))
10762
+ return !!((A === "v4" || !A) && Si.test(g) || (A === "v6" || !A) && Ni.test(g));
10763
+ }
10764
+ function di(g, A) {
10765
+ if (!ni.test(g))
10734
10766
  return !1;
10735
10767
  try {
10736
10768
  const [I] = g.split("."), B = I.replace(/-/g, "+").replace(/_/g, "/").padEnd(I.length + (4 - I.length % 4) % 4, "="), C = JSON.parse(atob(B));
@@ -10739,8 +10771,8 @@ function Yi(g, A) {
10739
10771
  return !1;
10740
10772
  }
10741
10773
  }
10742
- function di(g, A) {
10743
- return !!((A === "v4" || !A) && Si.test(g) || (A === "v6" || !A) && Ni.test(g));
10774
+ function Mi(g, A) {
10775
+ return !!((A === "v4" || !A) && Ri.test(g) || (A === "v6" || !A) && ci.test(g));
10744
10776
  }
10745
10777
  class IA extends K {
10746
10778
  _parse(A) {
@@ -10791,43 +10823,43 @@ class IA extends K {
10791
10823
  message: Q.message
10792
10824
  }), B.dirty());
10793
10825
  } else if (Q.kind === "email")
10794
- wi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10826
+ Fi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10795
10827
  validation: "email",
10796
10828
  code: e.invalid_string,
10797
10829
  message: Q.message
10798
10830
  }), B.dirty());
10799
10831
  else if (Q.kind === "emoji")
10800
- Bg || (Bg = new RegExp(Fi, "u")), Bg.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10832
+ Bg || (Bg = new RegExp(ri, "u")), Bg.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10801
10833
  validation: "emoji",
10802
10834
  code: e.invalid_string,
10803
10835
  message: Q.message
10804
10836
  }), B.dirty());
10805
10837
  else if (Q.kind === "uuid")
10806
- yi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10838
+ ei.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10807
10839
  validation: "uuid",
10808
10840
  code: e.invalid_string,
10809
10841
  message: Q.message
10810
10842
  }), B.dirty());
10811
10843
  else if (Q.kind === "nanoid")
10812
- ei.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10844
+ Gi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10813
10845
  validation: "nanoid",
10814
10846
  code: e.invalid_string,
10815
10847
  message: Q.message
10816
10848
  }), B.dirty());
10817
10849
  else if (Q.kind === "cuid")
10818
- Di.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10850
+ hi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10819
10851
  validation: "cuid",
10820
10852
  code: e.invalid_string,
10821
10853
  message: Q.message
10822
10854
  }), B.dirty());
10823
10855
  else if (Q.kind === "cuid2")
10824
- hi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10856
+ ti.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10825
10857
  validation: "cuid2",
10826
10858
  code: e.invalid_string,
10827
10859
  message: Q.message
10828
10860
  }), B.dirty());
10829
10861
  else if (Q.kind === "ulid")
10830
- ti.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10862
+ yi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10831
10863
  validation: "ulid",
10832
10864
  code: e.invalid_string,
10833
10865
  message: Q.message
@@ -10858,39 +10890,39 @@ class IA extends K {
10858
10890
  code: e.invalid_string,
10859
10891
  validation: { endsWith: Q.value },
10860
10892
  message: Q.message
10861
- }), B.dirty()) : Q.kind === "datetime" ? gC(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10893
+ }), B.dirty()) : Q.kind === "datetime" ? BC(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10862
10894
  code: e.invalid_string,
10863
10895
  validation: "datetime",
10864
10896
  message: Q.message
10865
- }), B.dirty()) : Q.kind === "date" ? ki.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10897
+ }), B.dirty()) : Q.kind === "date" ? Li.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10866
10898
  code: e.invalid_string,
10867
10899
  validation: "date",
10868
10900
  message: Q.message
10869
- }), B.dirty()) : Q.kind === "time" ? Li(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10901
+ }), B.dirty()) : Q.kind === "time" ? Ji(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10870
10902
  code: e.invalid_string,
10871
10903
  validation: "time",
10872
10904
  message: Q.message
10873
- }), B.dirty()) : Q.kind === "duration" ? ni.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10905
+ }), B.dirty()) : Q.kind === "duration" ? wi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10874
10906
  validation: "duration",
10875
10907
  code: e.invalid_string,
10876
10908
  message: Q.message
10877
- }), B.dirty()) : Q.kind === "ip" ? Ji(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), F(C, {
10909
+ }), B.dirty()) : Q.kind === "ip" ? Yi(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), F(C, {
10878
10910
  validation: "ip",
10879
10911
  code: e.invalid_string,
10880
10912
  message: Q.message
10881
- }), B.dirty()) : Q.kind === "jwt" ? Yi(A.data, Q.alg) || (C = this._getOrReturnCtx(A, C), F(C, {
10913
+ }), B.dirty()) : Q.kind === "jwt" ? di(A.data, Q.alg) || (C = this._getOrReturnCtx(A, C), F(C, {
10882
10914
  validation: "jwt",
10883
10915
  code: e.invalid_string,
10884
10916
  message: Q.message
10885
- }), B.dirty()) : Q.kind === "cidr" ? di(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), F(C, {
10917
+ }), B.dirty()) : Q.kind === "cidr" ? Mi(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), F(C, {
10886
10918
  validation: "cidr",
10887
10919
  code: e.invalid_string,
10888
10920
  message: Q.message
10889
- }), B.dirty()) : Q.kind === "base64" ? ci.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10921
+ }), B.dirty()) : Q.kind === "base64" ? Ui.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10890
10922
  validation: "base64",
10891
10923
  code: e.invalid_string,
10892
10924
  message: Q.message
10893
- }), B.dirty()) : Q.kind === "base64url" ? Ui.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10925
+ }), B.dirty()) : Q.kind === "base64url" ? ki.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10894
10926
  validation: "base64url",
10895
10927
  code: e.invalid_string,
10896
10928
  message: Q.message
@@ -11129,7 +11161,7 @@ IA.create = (g) => {
11129
11161
  ...M(g)
11130
11162
  });
11131
11163
  };
11132
- function Mi(g, A) {
11164
+ function Ki(g, A) {
11133
11165
  const I = (g.toString().split(".")[1] || "").length, B = (A.toString().split(".")[1] || "").length, C = I > B ? I : B, Q = parseInt(g.toFixed(C).replace(".", "")), E = parseInt(A.toFixed(C).replace(".", ""));
11134
11166
  return Q % E / Math.pow(10, C);
11135
11167
  }
@@ -11168,7 +11200,7 @@ class yA extends K {
11168
11200
  inclusive: Q.inclusive,
11169
11201
  exact: !1,
11170
11202
  message: Q.message
11171
- }), C.dirty()) : Q.kind === "multipleOf" ? Mi(A.data, Q.value) !== 0 && (B = this._getOrReturnCtx(A, B), F(B, {
11203
+ }), C.dirty()) : Q.kind === "multipleOf" ? Ki(A.data, Q.value) !== 0 && (B = this._getOrReturnCtx(A, B), F(B, {
11172
11204
  code: e.not_multiple_of,
11173
11205
  multipleOf: Q.value,
11174
11206
  message: Q.message
@@ -11995,7 +12027,7 @@ class u extends K {
11995
12027
  });
11996
12028
  }
11997
12029
  keyof() {
11998
- return BC(H.objectKeys(this.shape));
12030
+ return CC(H.objectKeys(this.shape));
11999
12031
  }
12000
12032
  }
12001
12033
  u.create = (g, A) => new u({
@@ -12558,7 +12590,7 @@ oI.create = (g, A) => new oI({
12558
12590
  typeName: J.ZodLiteral,
12559
12591
  ...M(A)
12560
12592
  });
12561
- function BC(g, A) {
12593
+ function CC(g, A) {
12562
12594
  return new GA({
12563
12595
  values: g,
12564
12596
  typeName: J.ZodEnum,
@@ -12578,7 +12610,7 @@ class GA extends K {
12578
12610
  code: e.invalid_type
12579
12611
  }), d;
12580
12612
  }
12581
- if (HI(this, OA) || $B(this, OA, new Set(this._def.values)), !HI(this, OA).has(A.data)) {
12613
+ if (HI(this, OA) || AC(this, OA, new Set(this._def.values)), !HI(this, OA).has(A.data)) {
12582
12614
  const I = this._getOrReturnCtx(A), B = this._def.values;
12583
12615
  return F(I, {
12584
12616
  received: I.data,
@@ -12623,7 +12655,7 @@ class GA extends K {
12623
12655
  }
12624
12656
  }
12625
12657
  OA = /* @__PURE__ */ new WeakMap();
12626
- GA.create = BC;
12658
+ GA.create = CC;
12627
12659
  class aI extends K {
12628
12660
  constructor() {
12629
12661
  super(...arguments), VA.set(this, void 0);
@@ -12638,7 +12670,7 @@ class aI extends K {
12638
12670
  code: e.invalid_type
12639
12671
  }), d;
12640
12672
  }
12641
- if (HI(this, VA) || $B(this, VA, new Set(H.getValidEnumValues(this._def.values))), !HI(this, VA).has(A.data)) {
12673
+ if (HI(this, VA) || AC(this, VA, new Set(H.getValidEnumValues(this._def.values))), !HI(this, VA).has(A.data)) {
12642
12674
  const C = H.objectValues(I);
12643
12675
  return F(B, {
12644
12676
  received: B.data,
@@ -12877,7 +12909,7 @@ pI.create = (g) => new pI({
12877
12909
  typeName: J.ZodNaN,
12878
12910
  ...M(g)
12879
12911
  });
12880
- const Ki = Symbol("zod_brand");
12912
+ const Hi = Symbol("zod_brand");
12881
12913
  class fg extends K {
12882
12914
  _parse(A) {
12883
12915
  const { ctx: I } = this._processInputParams(A), B = I.data;
@@ -12949,7 +12981,7 @@ function kB(g, A) {
12949
12981
  const I = typeof g == "function" ? g(A) : typeof g == "string" ? { message: g } : g;
12950
12982
  return typeof I == "string" ? { message: I } : I;
12951
12983
  }
12952
- function CC(g, A = {}, I) {
12984
+ function QC(g, A = {}, I) {
12953
12985
  return g ? uA.create().superRefine((B, C) => {
12954
12986
  var Q, E;
12955
12987
  const i = g(B);
@@ -12967,16 +12999,16 @@ function CC(g, A = {}, I) {
12967
12999
  }
12968
13000
  }) : uA.create();
12969
13001
  }
12970
- const Hi = {
13002
+ const qi = {
12971
13003
  object: u.lazycreate
12972
13004
  };
12973
13005
  var J;
12974
13006
  (function(g) {
12975
13007
  g.ZodString = "ZodString", g.ZodNumber = "ZodNumber", g.ZodNaN = "ZodNaN", g.ZodBigInt = "ZodBigInt", g.ZodBoolean = "ZodBoolean", g.ZodDate = "ZodDate", g.ZodSymbol = "ZodSymbol", g.ZodUndefined = "ZodUndefined", g.ZodNull = "ZodNull", g.ZodAny = "ZodAny", g.ZodUnknown = "ZodUnknown", g.ZodNever = "ZodNever", g.ZodVoid = "ZodVoid", g.ZodArray = "ZodArray", g.ZodObject = "ZodObject", g.ZodUnion = "ZodUnion", g.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", g.ZodIntersection = "ZodIntersection", g.ZodTuple = "ZodTuple", g.ZodRecord = "ZodRecord", g.ZodMap = "ZodMap", g.ZodSet = "ZodSet", g.ZodFunction = "ZodFunction", g.ZodLazy = "ZodLazy", g.ZodLiteral = "ZodLiteral", g.ZodEnum = "ZodEnum", g.ZodEffects = "ZodEffects", g.ZodNativeEnum = "ZodNativeEnum", g.ZodOptional = "ZodOptional", g.ZodNullable = "ZodNullable", g.ZodDefault = "ZodDefault", g.ZodCatch = "ZodCatch", g.ZodPromise = "ZodPromise", g.ZodBranded = "ZodBranded", g.ZodPipeline = "ZodPipeline", g.ZodReadonly = "ZodReadonly";
12976
13008
  })(J || (J = {}));
12977
- const qi = (g, A = {
13009
+ const li = (g, A = {
12978
13010
  message: `Input not instance of ${g.name}`
12979
- }) => CC((I) => I instanceof g, A), QC = IA.create, EC = yA.create, li = pI.create, fi = eA.create, iC = II.create, pi = LA.create, mi = qI.create, ui = gI.create, Ti = BI.create, xi = uA.create, Wi = RA.create, bi = tA.create, Zi = lI.create, Pi = CA.create, Oi = u.create, Vi = u.strictCreate, vi = CI.create, Xi = bI.create, ji = QI.create, zi = sA.create, _i = EI.create, $i = fI.create, Ao = JA.create, Io = HA.create, go = iI.create, Bo = oI.create, Co = GA.create, Qo = aI.create, Eo = TA.create, LB = QA.create, io = oA.create, oo = nA.create, ao = QA.createWithPreprocess, so = wI.create, Do = () => QC().optional(), ho = () => EC().optional(), to = () => iC().optional(), yo = {
13011
+ }) => QC((I) => I instanceof g, A), EC = IA.create, iC = yA.create, fi = pI.create, pi = eA.create, oC = II.create, mi = LA.create, ui = qI.create, Ti = gI.create, xi = BI.create, Wi = uA.create, bi = RA.create, Zi = tA.create, Pi = lI.create, Oi = CA.create, Vi = u.create, vi = u.strictCreate, Xi = CI.create, ji = bI.create, zi = QI.create, _i = sA.create, $i = EI.create, Ao = fI.create, Io = JA.create, go = HA.create, Bo = iI.create, Co = oI.create, Qo = GA.create, Eo = aI.create, io = TA.create, LB = QA.create, oo = oA.create, ao = nA.create, so = QA.createWithPreprocess, Do = wI.create, ho = () => EC().optional(), to = () => iC().optional(), yo = () => oC().optional(), eo = {
12980
13012
  string: (g) => IA.create({ ...g, coerce: !0 }),
12981
13013
  number: (g) => yA.create({ ...g, coerce: !0 }),
12982
13014
  boolean: (g) => II.create({
@@ -12985,14 +13017,14 @@ const qi = (g, A = {
12985
13017
  }),
12986
13018
  bigint: (g) => eA.create({ ...g, coerce: !0 }),
12987
13019
  date: (g) => LA.create({ ...g, coerce: !0 })
12988
- }, eo = d;
13020
+ }, Go = d;
12989
13021
  var D = /* @__PURE__ */ Object.freeze({
12990
13022
  __proto__: null,
12991
13023
  defaultErrorMap: mA,
12992
- setErrorMap: ai,
13024
+ setErrorMap: si,
12993
13025
  getErrorMap: MI,
12994
13026
  makeIssue: KI,
12995
- EMPTY_PATH: si,
13027
+ EMPTY_PATH: Di,
12996
13028
  addIssueToContext: F,
12997
13029
  ParseStatus: v,
12998
13030
  INVALID: d,
@@ -13011,7 +13043,7 @@ var D = /* @__PURE__ */ Object.freeze({
13011
13043
  ZodParsedType: S,
13012
13044
  getParsedType: hA,
13013
13045
  ZodType: K,
13014
- datetimeRegex: gC,
13046
+ datetimeRegex: BC,
13015
13047
  ZodString: IA,
13016
13048
  ZodNumber: yA,
13017
13049
  ZodBigInt: eA,
@@ -13046,63 +13078,63 @@ var D = /* @__PURE__ */ Object.freeze({
13046
13078
  ZodDefault: sI,
13047
13079
  ZodCatch: DI,
13048
13080
  ZodNaN: pI,
13049
- BRAND: Ki,
13081
+ BRAND: Hi,
13050
13082
  ZodBranded: fg,
13051
13083
  ZodPipeline: wI,
13052
13084
  ZodReadonly: hI,
13053
- custom: CC,
13085
+ custom: QC,
13054
13086
  Schema: K,
13055
13087
  ZodSchema: K,
13056
- late: Hi,
13088
+ late: qi,
13057
13089
  get ZodFirstPartyTypeKind() {
13058
13090
  return J;
13059
13091
  },
13060
- coerce: yo,
13061
- any: xi,
13062
- array: Pi,
13063
- bigint: fi,
13064
- boolean: iC,
13065
- date: pi,
13066
- discriminatedUnion: Xi,
13092
+ coerce: eo,
13093
+ any: Wi,
13094
+ array: Oi,
13095
+ bigint: pi,
13096
+ boolean: oC,
13097
+ date: mi,
13098
+ discriminatedUnion: ji,
13067
13099
  effect: LB,
13068
- enum: Co,
13069
- function: Io,
13070
- instanceof: qi,
13071
- intersection: ji,
13072
- lazy: go,
13073
- literal: Bo,
13074
- map: $i,
13075
- nan: li,
13076
- nativeEnum: Qo,
13077
- never: bi,
13078
- null: Ti,
13079
- nullable: oo,
13080
- number: EC,
13081
- object: Oi,
13082
- oboolean: to,
13083
- onumber: ho,
13084
- optional: io,
13085
- ostring: Do,
13086
- pipeline: so,
13087
- preprocess: ao,
13088
- promise: Eo,
13089
- record: _i,
13090
- set: Ao,
13091
- strictObject: Vi,
13092
- string: QC,
13093
- symbol: mi,
13100
+ enum: Qo,
13101
+ function: go,
13102
+ instanceof: li,
13103
+ intersection: zi,
13104
+ lazy: Bo,
13105
+ literal: Co,
13106
+ map: Ao,
13107
+ nan: fi,
13108
+ nativeEnum: Eo,
13109
+ never: Zi,
13110
+ null: xi,
13111
+ nullable: ao,
13112
+ number: iC,
13113
+ object: Vi,
13114
+ oboolean: yo,
13115
+ onumber: to,
13116
+ optional: oo,
13117
+ ostring: ho,
13118
+ pipeline: Do,
13119
+ preprocess: so,
13120
+ promise: io,
13121
+ record: $i,
13122
+ set: Io,
13123
+ strictObject: vi,
13124
+ string: EC,
13125
+ symbol: ui,
13094
13126
  transformer: LB,
13095
- tuple: zi,
13096
- undefined: ui,
13097
- union: vi,
13098
- unknown: Wi,
13099
- void: Zi,
13100
- NEVER: eo,
13127
+ tuple: _i,
13128
+ undefined: Ti,
13129
+ union: Xi,
13130
+ unknown: bi,
13131
+ void: Pi,
13132
+ NEVER: Go,
13101
13133
  ZodIssueCode: e,
13102
- quotelessJson: oi,
13134
+ quotelessJson: ai,
13103
13135
  ZodError: _
13104
13136
  });
13105
- const Go = D.object({
13137
+ const no = D.object({
13106
13138
  /**The multiscale datasets for this image*/
13107
13139
  multiscales: D.array(
13108
13140
  D.object({
@@ -13230,7 +13262,7 @@ const Go = D.object({
13230
13262
  projection: D.string().optional()
13231
13263
  }).optional()
13232
13264
  }).optional()
13233
- }).describe("JSON from OME-NGFF .zattrs"), no = D.object({
13265
+ }).describe("JSON from OME-NGFF .zattrs"), wo = D.object({
13234
13266
  plate: D.object({
13235
13267
  /**The acquisitions for this plate*/
13236
13268
  acquisitions: D.array(
@@ -13289,7 +13321,7 @@ const Go = D.object({
13289
13321
  })
13290
13322
  ).min(1).describe("The wells of the plate")
13291
13323
  }).optional()
13292
- }).describe("JSON from OME-NGFF .zattrs"), wo = D.object({
13324
+ }).describe("JSON from OME-NGFF .zattrs"), Fo = D.object({
13293
13325
  well: D.object({
13294
13326
  /**The fields of view for this well*/
13295
13327
  images: D.array(
@@ -13303,7 +13335,7 @@ const Go = D.object({
13303
13335
  /**The version of the specification*/
13304
13336
  version: D.literal("0.4").describe("The version of the specification").optional()
13305
13337
  }).optional()
13306
- }).describe("JSON from OME-NGFF .zattrs"), Fo = D.object({
13338
+ }).describe("JSON from OME-NGFF .zattrs"), ro = D.object({
13307
13339
  /**The versioned OME-Zarr Metadata namespace*/
13308
13340
  ome: D.object({
13309
13341
  /**The multiscale datasets for this image*/
@@ -13433,7 +13465,7 @@ const Go = D.object({
13433
13465
  /**The version of the OME-Zarr Metadata*/
13434
13466
  version: D.literal("0.5").describe("The version of the OME-Zarr Metadata")
13435
13467
  }).describe("The versioned OME-Zarr Metadata namespace")
13436
- }).describe("The zarr.json attributes key"), ro = D.object({
13468
+ }).describe("The zarr.json attributes key"), So = D.object({
13437
13469
  /**The versioned OME-Zarr Metadata namespace*/
13438
13470
  ome: D.object({
13439
13471
  plate: D.object({
@@ -13495,7 +13527,7 @@ const Go = D.object({
13495
13527
  /**The version of the OME-Zarr Metadata*/
13496
13528
  version: D.literal("0.5").describe("The version of the OME-Zarr Metadata")
13497
13529
  }).describe("The versioned OME-Zarr Metadata namespace")
13498
- }).describe("The zarr.json attributes key"), So = D.object({
13530
+ }).describe("The zarr.json attributes key"), Ro = D.object({
13499
13531
  /**The versioned OME-Zarr Metadata namespace*/
13500
13532
  ome: D.object({
13501
13533
  well: D.object({
@@ -13514,15 +13546,15 @@ const Go = D.object({
13514
13546
  /**The version of the OME-Zarr Metadata*/
13515
13547
  version: D.literal("0.5").describe("The version of the OME-Zarr Metadata")
13516
13548
  }).describe("The versioned OME-Zarr Metadata namespace")
13517
- }).describe("JSON from OME-Zarr zarr.json"), Ro = ["0.4", "0.5"], No = new Set(Ro);
13518
- function co(g) {
13549
+ }).describe("JSON from OME-Zarr zarr.json"), No = ["0.4", "0.5"], co = new Set(No);
13550
+ function Uo(g) {
13519
13551
  if (!("ome" in g) || !(g.ome instanceof Object)) return;
13520
13552
  const A = g.ome;
13521
- if ("version" in A && typeof A.version == "string" && No.has(A.version))
13553
+ if ("version" in A && typeof A.version == "string" && co.has(A.version))
13522
13554
  return A.version;
13523
13555
  }
13524
13556
  function pg(g) {
13525
- const A = co(g);
13557
+ const A = Uo(g);
13526
13558
  return A === void 0 ? "0.4" : A;
13527
13559
  }
13528
13560
  function xA(g) {
@@ -13534,14 +13566,14 @@ function xA(g) {
13534
13566
  return "v3";
13535
13567
  }
13536
13568
  }
13537
- function oC(g, A) {
13569
+ function aC(g, A) {
13538
13570
  const I = { ...g };
13539
13571
  return delete I[A], I;
13540
13572
  }
13541
- async function Oo(g, A) {
13573
+ async function Vo(g, A) {
13542
13574
  const I = new ZA(g), B = new j(I), C = xA(A), Q = await nI(B, C);
13543
13575
  try {
13544
- return Uo(Q.attrs);
13576
+ return ko(Q.attrs);
13545
13577
  } catch {
13546
13578
  throw Error(
13547
13579
  `Failed to parse OME-Zarr plate:
@@ -13549,58 +13581,58 @@ ${JSON.stringify(Q.attrs)}`
13549
13581
  );
13550
13582
  }
13551
13583
  }
13552
- function Uo(g) {
13584
+ function ko(g) {
13553
13585
  switch (pg(g)) {
13554
13586
  case "0.5":
13555
13587
  return {
13556
- ...ro.parse(g).ome,
13588
+ ...So.parse(g).ome,
13557
13589
  originalVersion: "0.5"
13558
13590
  };
13559
13591
  case "0.4":
13560
13592
  return {
13561
- ...ko(no.parse(g)).ome,
13593
+ ...Lo(wo.parse(g)).ome,
13562
13594
  originalVersion: "0.4"
13563
13595
  };
13564
13596
  }
13565
13597
  }
13566
- function ko(g) {
13598
+ function Lo(g) {
13567
13599
  if (g.plate === void 0)
13568
13600
  throw new Error("Plate metadata is missing in OME-Zarr v0.4 plate");
13569
13601
  return {
13570
13602
  ome: {
13571
- plate: oC(g.plate, "version"),
13603
+ plate: aC(g.plate, "version"),
13572
13604
  version: "0.5"
13573
13605
  }
13574
13606
  };
13575
13607
  }
13576
- function Lo(g) {
13608
+ function Jo(g) {
13577
13609
  if (g.well === void 0)
13578
13610
  throw new Error("Well metadata is missing in OME-Zarr v0.4 well");
13579
13611
  return {
13580
13612
  ome: {
13581
- well: oC(g.well, "version"),
13613
+ well: aC(g.well, "version"),
13582
13614
  version: "0.5"
13583
13615
  }
13584
13616
  };
13585
13617
  }
13586
- function Jo(g) {
13618
+ function Yo(g) {
13587
13619
  switch (pg(g)) {
13588
13620
  case "0.5":
13589
13621
  return {
13590
- ...So.parse(g).ome,
13622
+ ...Ro.parse(g).ome,
13591
13623
  originalVersion: "0.5"
13592
13624
  };
13593
13625
  case "0.4":
13594
13626
  return {
13595
- ...Lo(wo.parse(g)).ome,
13627
+ ...Jo(Fo.parse(g)).ome,
13596
13628
  originalVersion: "0.4"
13597
13629
  };
13598
13630
  }
13599
13631
  }
13600
- async function Vo(g, A, I) {
13632
+ async function vo(g, A, I) {
13601
13633
  const B = g + "/" + A, C = new ZA(B), Q = new j(C), E = xA(I), i = await nI(Q, E);
13602
13634
  try {
13603
- return Jo(i.attrs);
13635
+ return Yo(i.attrs);
13604
13636
  } catch {
13605
13637
  throw Error(
13606
13638
  `Failed to parse OME-Zarr well:
@@ -13608,15 +13640,15 @@ ${JSON.stringify(i.attrs)}`
13608
13640
  );
13609
13641
  }
13610
13642
  }
13611
- async function vo(g) {
13643
+ async function Xo(g) {
13612
13644
  const A = xA(g.version), I = await nI(g.location, A);
13613
13645
  return mg(I.attrs).omero?.channels ?? [];
13614
13646
  }
13615
- async function Xo(g) {
13647
+ async function jo(g) {
13616
13648
  const A = xA(g.version), I = await nI(g.location, A);
13617
13649
  return mg(I.attrs).omero?.rdefs;
13618
13650
  }
13619
- function Yo(g) {
13651
+ function Mo(g) {
13620
13652
  return {
13621
13653
  ome: {
13622
13654
  multiscales: g.multiscales,
@@ -13625,23 +13657,23 @@ function Yo(g) {
13625
13657
  }
13626
13658
  };
13627
13659
  }
13628
- function Mo(g) {
13660
+ function Ko(g) {
13629
13661
  switch (pg(g)) {
13630
13662
  case "0.5":
13631
13663
  return {
13632
- ...Fo.parse(g).ome,
13664
+ ...ro.parse(g).ome,
13633
13665
  originalVersion: "0.5"
13634
13666
  };
13635
13667
  case "0.4":
13636
13668
  return {
13637
- ...Yo(Go.parse(g)).ome,
13669
+ ...Mo(no.parse(g)).ome,
13638
13670
  originalVersion: "0.4"
13639
13671
  };
13640
13672
  }
13641
13673
  }
13642
13674
  function mg(g) {
13643
13675
  try {
13644
- return Mo(g);
13676
+ return Ko(g);
13645
13677
  } catch {
13646
13678
  throw Error(`Failed to parse OME-Zarr image:
13647
13679
  ${JSON.stringify(g)}`);
@@ -13665,15 +13697,15 @@ class NI {
13665
13697
  throw new Error("No datasets found in the multiscale image.");
13666
13698
  A || (A = xA(B.originalVersion));
13667
13699
  const E = Q.datasets.map(
13668
- (s) => XE(this.location, s.path, A)
13700
+ (s) => jE(this.location, s.path, A)
13669
13701
  ), i = await Promise.all(
13670
- E.map((s) => vE(s))
13702
+ E.map((s) => XE(s))
13671
13703
  ), o = i[0].shape, a = Q.axes;
13672
13704
  if (a.length !== o.length)
13673
13705
  throw new Error(
13674
13706
  `Mismatch between number of axes (${a.length}) and array shape (${o.length})`
13675
13707
  );
13676
- return new Ei({
13708
+ return new ii({
13677
13709
  metadata: Q,
13678
13710
  arrays: i,
13679
13711
  arrayParams: E
@@ -13726,7 +13758,7 @@ class NI {
13726
13758
  });
13727
13759
  }
13728
13760
  }
13729
- const aC = [
13761
+ const sC = [
13730
13762
  "fallbackVisible",
13731
13763
  "prefetchTime",
13732
13764
  "visibleCurrent",
@@ -13734,14 +13766,14 @@ const aC = [
13734
13766
  "prefetchSpace"
13735
13767
  ];
13736
13768
  function ug(g) {
13737
- Ko(g);
13769
+ Ho(g);
13738
13770
  const A = {
13739
13771
  x: g.prefetch.x,
13740
13772
  y: g.prefetch.y,
13741
13773
  z: g.prefetch.z ?? 0,
13742
13774
  t: g.prefetch.t ?? 0
13743
13775
  }, I = Object.freeze(
13744
- aC.reduce(
13776
+ sC.reduce(
13745
13777
  (Q, E) => {
13746
13778
  const i = g.priorityOrder.indexOf(E);
13747
13779
  return Q[E] = i, Q;
@@ -13761,7 +13793,7 @@ function ug(g) {
13761
13793
  };
13762
13794
  return Object.freeze(C);
13763
13795
  }
13764
- function jo(g = {}) {
13796
+ function zo(g = {}) {
13765
13797
  return ug(Tg({
13766
13798
  profile: "exploration",
13767
13799
  prefetch: { x: 1, y: 1, z: 1, t: 0 },
@@ -13774,7 +13806,7 @@ function jo(g = {}) {
13774
13806
  ]
13775
13807
  }, g));
13776
13808
  }
13777
- function zo(g = {}) {
13809
+ function _o(g = {}) {
13778
13810
  return ug(Tg({
13779
13811
  profile: "playback",
13780
13812
  prefetch: { x: 0, y: 0, z: 0, t: 20 },
@@ -13787,7 +13819,7 @@ function zo(g = {}) {
13787
13819
  ]
13788
13820
  }, g));
13789
13821
  }
13790
- function _o(g = {}) {
13822
+ function $o(g = {}) {
13791
13823
  return ug(Tg({
13792
13824
  profile: "no-prefetch",
13793
13825
  prefetch: { x: 0, y: 0, z: 0, t: 0 },
@@ -13800,7 +13832,7 @@ function _o(g = {}) {
13800
13832
  ]
13801
13833
  }, g));
13802
13834
  }
13803
- function Ko(g) {
13835
+ function Ho(g) {
13804
13836
  for (const [B, C] of Object.entries(g.prefetch))
13805
13837
  if (C !== void 0 && C < 0)
13806
13838
  throw new Error(`prefetch.${B} must be a non-negative number`);
@@ -13808,7 +13840,7 @@ function Ko(g) {
13808
13840
  if (A?.min !== void 0 && A?.max !== void 0 && A.min > A.max)
13809
13841
  throw new Error("lod.min must be <= lod.max");
13810
13842
  const I = g.priorityOrder;
13811
- if (I.length !== aC.length || new Set(I).size !== I.length)
13843
+ if (I.length !== sC.length || new Set(I).size !== I.length)
13812
13844
  throw new Error("priorityOrder must include all categories exactly once");
13813
13845
  }
13814
13846
  function Tg(g, A = {}) {
@@ -13819,7 +13851,7 @@ function Tg(g, A = {}) {
13819
13851
  priorityOrder: A.priorityOrder ?? g.priorityOrder
13820
13852
  };
13821
13853
  }
13822
- class $o extends bA {
13854
+ class Aa extends bA {
13823
13855
  atlas_;
13824
13856
  constructor(A, I) {
13825
13857
  super(), this.programName = "points", this.atlas_ = I, A.forEach((Q) => {
@@ -13863,41 +13895,41 @@ class $o extends bA {
13863
13895
  }
13864
13896
  }
13865
13897
  export {
13866
- mo as AxesLayer,
13898
+ uo as AxesLayer,
13867
13899
  $ as Box2,
13868
13900
  SA as Box3,
13869
- uB as ChunkedImageLayer,
13901
+ TB as ChunkedImageLayer,
13870
13902
  l as Color,
13871
- RQ as Frustum,
13872
- Ho as Idetik,
13873
- Wo as ImageLayer,
13874
- Zo as ImageSeriesLayer,
13875
- bo as LabelImageLayer,
13903
+ NQ as Frustum,
13904
+ qo as Idetik,
13905
+ bo as ImageLayer,
13906
+ Po as ImageSeriesLayer,
13907
+ Zo as LabelImageLayer,
13876
13908
  wA as Layer,
13877
- hQ as LayerManager,
13909
+ tQ as LayerManager,
13878
13910
  NI as OmeZarrImageSource,
13879
- po as OrbitControls,
13880
- qo as OrthographicCamera,
13881
- fo as PanZoomControls,
13882
- lo as PerspectiveCamera,
13911
+ mo as OrbitControls,
13912
+ lo as OrthographicCamera,
13913
+ po as PanZoomControls,
13914
+ fo as PerspectiveCamera,
13883
13915
  YA as Plane,
13884
- $o as Points,
13885
- uo as ProjectedLineLayer,
13916
+ Aa as Points,
13917
+ To as ProjectedLineLayer,
13886
13918
  gB as Spherical,
13887
13919
  tI as Texture2DArray,
13888
13920
  XA as Texture3D,
13889
- To as TracksLayer,
13890
- GQ as Viewport,
13891
- xo as VolumeLayer,
13892
- CQ as WebGLRenderer,
13893
- jo as createExplorationPolicy,
13921
+ xo as TracksLayer,
13922
+ nQ as Viewport,
13923
+ Wo as VolumeLayer,
13924
+ QQ as WebGLRenderer,
13925
+ zo as createExplorationPolicy,
13894
13926
  ug as createImageSourcePolicy,
13895
- _o as createNoPrefetchPolicy,
13896
- zo as createPlaybackPolicy,
13897
- Oo as loadOmeZarrPlate,
13898
- Vo as loadOmeZarrWell,
13899
- vo as loadOmeroChannels,
13900
- Xo as loadOmeroDefaults,
13927
+ $o as createNoPrefetchPolicy,
13928
+ _o as createPlaybackPolicy,
13929
+ Vo as loadOmeZarrPlate,
13930
+ vo as loadOmeZarrWell,
13931
+ Xo as loadOmeroChannels,
13932
+ jo as loadOmeroDefaults,
13901
13933
  _g as parseViewportConfigs,
13902
13934
  qB as validateNewViewport
13903
13935
  };