@idetik/core 0.13.1 → 0.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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 oC {
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 aC = `#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
+ }`, sC = `#version 300 es
170
170
 
171
171
  precision mediump float;
172
172
 
@@ -190,7 +190,7 @@ out vec2 TexCoords;
190
190
  void main() {
191
191
  TexCoords = inUV;
192
192
  gl_Position = Projection * ModelView * vec4(inPosition, 1.0);
193
- }`, PI = `#version 300 es
193
+ }`, ZI = `#version 300 es
194
194
  #pragma inject_defines
195
195
 
196
196
  precision mediump float;
@@ -216,7 +216,7 @@ void main() {
216
216
  float texel = float(texture(ImageSampler, TexCoords).r);
217
217
  float value = (texel + ValueOffset) * ValueScale;
218
218
  fragColor = vec4(value * Color, u_opacity);
219
- }`, OI = `#version 300 es
219
+ }`, PI = `#version 300 es
220
220
  #pragma inject_defines
221
221
 
222
222
  precision mediump float;
@@ -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
+ }`, DC = `#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
+ }`, hC = `#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
+ }`, tC = `#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
+ }`, yC = `#version 300 es
307
307
 
308
308
  precision mediump float;
309
309
 
@@ -314,7 +314,7 @@ uniform vec3 u_color;
314
314
 
315
315
  void main() {
316
316
  fragColor = vec4(u_color, u_opacity);
317
- }`, VI = `#version 300 es
317
+ }`, OI = `#version 300 es
318
318
 
319
319
  precision highp float;
320
320
 
@@ -327,7 +327,7 @@ out highp vec3 PositionModel;
327
327
  void main() {
328
328
  PositionModel = inPosition;
329
329
  gl_Position = Projection * ModelView * vec4(inPosition, 1.0);
330
- }`, vI = `#version 300 es
330
+ }`, VI = `#version 300 es
331
331
  #pragma inject_defines
332
332
  precision highp float;
333
333
 
@@ -468,7 +468,7 @@ void main() {
468
468
  }
469
469
 
470
470
  fragColor = accumulatedColor;
471
- }`, nC = `#version 300 es
471
+ }`, eC = `#version 300 es
472
472
 
473
473
  precision mediump float;
474
474
  precision highp int;
@@ -558,63 +558,63 @@ void main() {
558
558
 
559
559
  fragColor = vec4(color.rgb, alpha);
560
560
  }`;
561
- const wC = {
561
+ const GC = {
562
562
  projectedLine: {
563
+ vertex: aC,
564
+ fragment: sC
565
+ },
566
+ points: {
563
567
  vertex: DC,
564
568
  fragment: hC
565
569
  },
566
- points: {
570
+ wireframe: {
567
571
  vertex: tC,
568
572
  fragment: yC
569
573
  },
570
- wireframe: {
571
- vertex: eC,
572
- fragment: GC
573
- },
574
574
  floatScalarImage: {
575
575
  vertex: rA,
576
- fragment: PI
576
+ fragment: ZI
577
577
  },
578
578
  floatScalarImageArray: {
579
579
  vertex: rA,
580
- fragment: OI
580
+ fragment: PI
581
581
  },
582
582
  intScalarImage: {
583
583
  vertex: rA,
584
- fragment: PI,
584
+ fragment: ZI,
585
585
  fragmentDefines: /* @__PURE__ */ new Map([["TEXTURE_DATA_TYPE_INT", "1"]])
586
586
  },
587
587
  intScalarImageArray: {
588
588
  vertex: rA,
589
- fragment: OI,
589
+ fragment: PI,
590
590
  fragmentDefines: /* @__PURE__ */ new Map([["TEXTURE_DATA_TYPE_INT", "1"]])
591
591
  },
592
592
  uintScalarImage: {
593
593
  vertex: rA,
594
- fragment: PI,
594
+ fragment: ZI,
595
595
  fragmentDefines: /* @__PURE__ */ new Map([["TEXTURE_DATA_TYPE_UINT", "1"]])
596
596
  },
597
597
  uintScalarImageArray: {
598
598
  vertex: rA,
599
- fragment: OI,
599
+ fragment: PI,
600
600
  fragmentDefines: /* @__PURE__ */ new Map([["TEXTURE_DATA_TYPE_UINT", "1"]])
601
601
  },
602
602
  labelImage: {
603
603
  vertex: rA,
604
- fragment: nC
604
+ fragment: eC
605
605
  },
606
606
  floatVolume: {
607
- vertex: VI,
608
- fragment: vI
607
+ vertex: OI,
608
+ fragment: VI
609
609
  },
610
610
  intVolume: {
611
- vertex: VI,
612
- fragment: vI,
611
+ vertex: OI,
612
+ fragment: VI,
613
613
  fragmentDefines: /* @__PURE__ */ new Map([["TEXTURE_DATA_TYPE_INT", "1"]])
614
614
  },
615
615
  uintVolume: {
616
- vertex: VI,
617
- fragment: vI,
616
+ vertex: OI,
617
+ fragment: VI,
618
618
  fragmentDefines: /* @__PURE__ */ new Map([["TEXTURE_DATA_TYPE_UINT", "1"]])
619
619
  }
620
620
  }, Zg = {
@@ -622,7 +622,7 @@ const wC = {
622
622
  info: 20,
623
623
  warn: 30,
624
624
  error: 40
625
- }, FC = {
625
+ }, nC = {
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 wC() {
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_ = wC() === "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 = nC[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 FC {
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 (!SC.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 rC = 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
832
- ), XI = "#pragma inject_defines";
833
- class cC {
830
+ ] : [], SC = new Set(
831
+ rC
832
+ ), vI = "#pragma inject_defines";
833
+ class RC {
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 = GC[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 FC(
850
850
  this.gl_,
851
851
  C,
852
852
  Q
@@ -862,14 +862,14 @@ class cC {
862
862
  }
863
863
  function Pg(g, A) {
864
864
  if (A === void 0 || A.size == 0) return g;
865
- if (!g.includes(XI))
865
+ if (!g.includes(vI))
866
866
  throw new Error(
867
- `Shader source does not contain "${XI}" directive`
867
+ `Shader source does not contain "${vI}" directive`
868
868
  );
869
869
  const I = Array(A.entries()).map(([E, i]) => `#define ${E} ${i}`).join(`
870
870
  `), C = `#line __LINE__ + ${1 - A.size}`, Q = `${I}
871
871
  ${C}`;
872
- return g.replace(XI, Q);
872
+ return g.replace(vI, Q);
873
873
  }
874
874
  const v = [
875
875
  "00",
@@ -1129,34 +1129,34 @@ const v = [
1129
1129
  "fe",
1130
1130
  "ff"
1131
1131
  ];
1132
- function YB() {
1132
+ function LB() {
1133
1133
  const g = Math.random() * 4294967295 | 0, A = Math.random() * 4294967295 | 0, I = Math.random() * 4294967295 | 0, B = Math.random() * 4294967295 | 0;
1134
1134
  return (v[g & 255] + v[g >> 8 & 255] + v[g >> 16 & 255] + v[g >> 24 & 255] + "-" + v[A & 255] + v[A >> 8 & 255] + "-" + v[A >> 16 & 15 | 64] + v[A >> 24 & 255] + "-" + v[I & 63 | 128] + v[I >> 8 & 255] + "-" + v[I >> 16 & 255] + v[I >> 24 & 255] + v[B & 255] + v[B >> 8 & 255] + v[B >> 16 & 255] + v[B >> 24 & 255]).toLowerCase();
1135
1135
  }
1136
1136
  class yg {
1137
- uuid = YB();
1137
+ uuid = LB();
1138
1138
  }
1139
- var p = 1e-6, b = typeof Float32Array < "u" ? Float32Array : Array, UC = Math.PI / 180;
1140
- function kC(g) {
1141
- return g * UC;
1139
+ var p = 1e-6, b = typeof Float32Array < "u" ? Float32Array : Array, NC = Math.PI / 180;
1140
+ function cC(g) {
1141
+ return g * NC;
1142
1142
  }
1143
1143
  Math.hypot || (Math.hypot = function() {
1144
1144
  for (var g = 0, A = arguments.length; A--; )
1145
1145
  g += arguments[A] * arguments[A];
1146
1146
  return Math.sqrt(g);
1147
1147
  });
1148
- function dB() {
1148
+ function JB() {
1149
1149
  var g = new b(9);
1150
1150
  return b != 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;
1151
1151
  }
1152
- function LC(g, A) {
1152
+ function UC(g, A) {
1153
1153
  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;
1154
1154
  }
1155
1155
  function _() {
1156
1156
  var g = new b(16);
1157
1157
  return b != Float32Array && (g[1] = 0, g[2] = 0, g[3] = 0, g[4] = 0, g[6] = 0, g[7] = 0, g[8] = 0, g[9] = 0, g[11] = 0, g[12] = 0, g[13] = 0, g[14] = 0), g[0] = 1, g[5] = 1, g[10] = 1, g[15] = 1, g;
1158
1158
  }
1159
- function uI(g, A) {
1159
+ function mI(g, A) {
1160
1160
  var I = A[0], B = A[1], C = A[2], Q = A[3], E = A[4], i = A[5], o = A[6], a = A[7], s = A[8], h = A[9], t = A[10], y = A[11], n = A[12], w = A[13], r = A[14], G = A[15], c = I * i - B * E, N = I * o - C * E, d = I * a - Q * E, L = B * o - C * i, k = B * a - Q * i, T = C * a - Q * o, P = s * w - h * n, O = s * r - t * n, Z = s * G - y * n, V = h * r - t * w, iA = h * G - y * w, oA = t * G - y * r, u = c * oA - N * iA + d * V + L * Z - k * O + T * P;
1161
1161
  return u ? (u = 1 / u, g[0] = (i * oA - o * iA + a * V) * u, g[1] = (C * iA - B * oA - Q * V) * u, g[2] = (w * T - r * k + G * L) * u, g[3] = (t * k - h * T - y * L) * u, g[4] = (o * Z - E * oA - a * O) * u, g[5] = (I * oA - C * Z + Q * O) * u, g[6] = (r * d - n * T - G * N) * u, g[7] = (s * T - t * d + y * N) * u, g[8] = (E * iA - i * Z + a * P) * u, g[9] = (B * Z - I * iA - Q * P) * u, g[10] = (n * k - w * d + G * c) * u, g[11] = (h * d - s * k - y * c) * u, g[12] = (i * O - E * V - o * P) * u, g[13] = (I * V - B * O + C * P) * u, g[14] = (w * N - n * L - r * c) * u, g[15] = (s * L - h * N + t * c) * u, g) : null;
1162
1162
  }
@@ -1164,30 +1164,30 @@ function zA(g, A, I) {
1164
1164
  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], N = I[0], d = I[1], L = I[2], k = I[3];
1165
1165
  return g[0] = N * B + d * i + L * h + k * w, g[1] = N * C + d * o + L * t + k * r, g[2] = N * Q + d * a + L * y + k * G, g[3] = N * E + d * s + L * n + k * c, N = I[4], d = I[5], L = I[6], k = I[7], g[4] = N * B + d * i + L * h + k * w, g[5] = N * C + d * o + L * t + k * r, g[6] = N * Q + d * a + L * y + k * G, g[7] = N * E + d * s + L * n + k * c, N = I[8], d = I[9], L = I[10], k = I[11], g[8] = N * B + d * i + L * h + k * w, g[9] = N * C + d * o + L * t + k * r, g[10] = N * Q + d * a + L * y + k * G, g[11] = N * E + d * s + L * n + k * c, N = I[12], d = I[13], L = I[14], k = I[15], g[12] = N * B + d * i + L * h + k * w, g[13] = N * C + d * o + L * t + k * r, g[14] = N * Q + d * a + L * y + k * G, g[15] = N * E + d * s + L * n + k * c, g;
1166
1166
  }
1167
- function JC(g, A) {
1167
+ function kC(g, A) {
1168
1168
  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;
1169
1169
  }
1170
- function YC(g, A, I, B) {
1170
+ function LC(g, A, I, B) {
1171
1171
  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, N = i * s, d = B[0], L = B[1], k = B[2];
1172
1172
  return g[0] = (1 - (n + r)) * d, g[1] = (t + N) * d, g[2] = (y - c) * d, g[3] = 0, g[4] = (t - N) * L, g[5] = (1 - (h + r)) * L, g[6] = (w + G) * L, g[7] = 0, g[8] = (y + c) * k, g[9] = (w - G) * k, g[10] = (1 - (h + n)) * k, g[11] = 0, g[12] = I[0], g[13] = I[1], g[14] = I[2], g[15] = 1, g;
1173
1173
  }
1174
- function dC(g, A, I, B, C) {
1174
+ function JC(g, A, I, B, C) {
1175
1175
  var Q = 1 / Math.tan(A / 2), E;
1176
1176
  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;
1177
1177
  }
1178
- var MC = dC;
1179
- function KC(g, A, I, B, C, Q, E) {
1178
+ var YC = JC;
1179
+ function dC(g, A, I, B, C, Q, E) {
1180
1180
  var i = 1 / (A - I), o = 1 / (B - C), a = 1 / (Q - E);
1181
1181
  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;
1182
1182
  }
1183
- var HC = KC;
1184
- function qC(g, A, I, B) {
1183
+ var MC = dC;
1184
+ function KC(g, A, I, B) {
1185
1185
  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;
1186
1186
  y > 0 && (y = 1 / Math.sqrt(y), s *= y, h *= y, t *= y);
1187
1187
  var n = o * t - a * h, w = a * s - i * t, r = i * h - o * s;
1188
1188
  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;
1189
1189
  }
1190
- function lC(g, A) {
1190
+ function HC(g, A) {
1191
1191
  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], N = A[1], d = A[2], L = A[3], k = A[4], T = A[5], P = A[6], O = A[7], Z = A[8], V = A[9], iA = A[10], oA = A[11], u = A[12], xg = A[13], Wg = A[14], bg = A[15];
1192
1192
  return Math.abs(I - c) <= p * Math.max(1, Math.abs(I), Math.abs(c)) && Math.abs(B - N) <= p * Math.max(1, Math.abs(B), Math.abs(N)) && Math.abs(C - d) <= p * Math.max(1, Math.abs(C), Math.abs(d)) && Math.abs(Q - L) <= p * Math.max(1, Math.abs(Q), Math.abs(L)) && Math.abs(E - k) <= p * Math.max(1, Math.abs(E), Math.abs(k)) && Math.abs(i - T) <= p * Math.max(1, Math.abs(i), Math.abs(T)) && Math.abs(o - P) <= p * Math.max(1, Math.abs(o), Math.abs(P)) && Math.abs(a - O) <= p * Math.max(1, Math.abs(a), Math.abs(O)) && Math.abs(s - Z) <= p * Math.max(1, Math.abs(s), Math.abs(Z)) && Math.abs(h - V) <= p * Math.max(1, Math.abs(h), Math.abs(V)) && Math.abs(t - iA) <= p * Math.max(1, Math.abs(t), Math.abs(iA)) && Math.abs(y - oA) <= p * Math.max(1, Math.abs(y), Math.abs(oA)) && Math.abs(n - u) <= p * Math.max(1, Math.abs(n), Math.abs(u)) && 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));
1193
1193
  }
@@ -1216,10 +1216,10 @@ function SA(g, A, I, B) {
1216
1216
  function lA(g, A, I) {
1217
1217
  return g[0] = A[0] + I[0], g[1] = A[1] + I[1], g[2] = A[2] + I[2], g;
1218
1218
  }
1219
- function fC(g, A, I) {
1219
+ function qC(g, A, I) {
1220
1220
  return g[0] = A[0] - I[0], g[1] = A[1] - I[1], g[2] = A[2] - I[2], g;
1221
1221
  }
1222
- function pC(g, A, I) {
1222
+ function lC(g, A, I) {
1223
1223
  return g[0] = A[0] * I[0], g[1] = A[1] * I[1], g[2] = A[2] * I[2], g;
1224
1224
  }
1225
1225
  function fA(g, A, I) {
@@ -1236,33 +1236,33 @@ function Vg(g, A) {
1236
1236
  var I = A[0] - g[0], B = A[1] - g[1], C = A[2] - g[2];
1237
1237
  return I * I + B * B + C * C;
1238
1238
  }
1239
- function mC(g, A) {
1239
+ function fC(g, A) {
1240
1240
  var I = A[0], B = A[1], C = A[2], Q = I * I + B * B + C * C;
1241
1241
  return Q > 0 && (Q = 1 / Math.sqrt(Q)), g[0] = A[0] * Q, g[1] = A[1] * Q, g[2] = A[2] * Q, g;
1242
1242
  }
1243
- function MB(g, A) {
1243
+ function YB(g, A) {
1244
1244
  return g[0] * A[0] + g[1] * A[1] + g[2] * A[2];
1245
1245
  }
1246
- function jI(g, A, I) {
1246
+ function XI(g, A, I) {
1247
1247
  var B = A[0], C = A[1], Q = A[2], E = I[0], i = I[1], o = I[2];
1248
1248
  return g[0] = C * o - Q * i, g[1] = Q * E - B * o, g[2] = B * i - C * E, g;
1249
1249
  }
1250
- function uC(g, A, I, B, C, Q) {
1250
+ function pC(g, A, I, B, C, Q) {
1251
1251
  var E = 1 - Q, i = E * E, o = Q * Q, a = i * E, s = 3 * Q * i, h = 3 * o * E, t = o * Q;
1252
1252
  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;
1253
1253
  }
1254
- function TI(g, A, I) {
1254
+ function uI(g, A, I) {
1255
1255
  var B = A[0], C = A[1], Q = A[2], E = I[3] * B + I[7] * C + I[11] * Q + I[15];
1256
1256
  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;
1257
1257
  }
1258
- function TC(g) {
1258
+ function mC(g) {
1259
1259
  return g[0] = 0, g[1] = 0, g[2] = 0, g;
1260
1260
  }
1261
- function KB(g, A) {
1261
+ function dB(g, A) {
1262
1262
  var I = g[0], B = g[1], C = g[2], Q = A[0], E = A[1], i = A[2];
1263
1263
  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));
1264
1264
  }
1265
- var UI = fC, xC = eg;
1265
+ var UI = qC, uC = eg;
1266
1266
  (function() {
1267
1267
  var g = f();
1268
1268
  return function(A, I, B, C, Q, E) {
@@ -1276,7 +1276,7 @@ function pA() {
1276
1276
  var g = new b(4);
1277
1277
  return b != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0, g[3] = 0), g;
1278
1278
  }
1279
- function WC(g) {
1279
+ function TC(g) {
1280
1280
  var A = new b(4);
1281
1281
  return A[0] = g[0], A[1] = g[1], A[2] = g[2], A[3] = g[3], A;
1282
1282
  }
@@ -1284,13 +1284,13 @@ function kI(g, A, I, B) {
1284
1284
  var C = new b(4);
1285
1285
  return C[0] = g, C[1] = A, C[2] = I, C[3] = B, C;
1286
1286
  }
1287
- function bC(g, A) {
1287
+ function xC(g, A) {
1288
1288
  return g[0] = A[0], g[1] = A[1], g[2] = A[2], g[3] = A[3], g;
1289
1289
  }
1290
- function ZC(g, A, I) {
1290
+ function WC(g, A, I) {
1291
1291
  return g[0] = A[0] * I, g[1] = A[1] * I, g[2] = A[2] * I, g[3] = A[3] * I, g;
1292
1292
  }
1293
- function PC(g, A) {
1293
+ function bC(g, A) {
1294
1294
  var I = A[0], B = A[1], C = A[2], Q = A[3], E = I * I + B * B + C * C + Q * Q;
1295
1295
  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;
1296
1296
  }
@@ -1307,24 +1307,24 @@ function _A(g, A, I) {
1307
1307
  return A;
1308
1308
  };
1309
1309
  })();
1310
- function Qg() {
1310
+ function Cg() {
1311
1311
  var g = new b(4);
1312
1312
  return b != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0), g[3] = 1, g;
1313
1313
  }
1314
- function OC(g, A, I) {
1314
+ function ZC(g, A, I) {
1315
1315
  I = I * 0.5;
1316
1316
  var B = Math.sin(I);
1317
1317
  return g[0] = B * A[0], g[1] = B * A[1], g[2] = B * A[2], g[3] = Math.cos(I), g;
1318
1318
  }
1319
- function VC(g, A, I) {
1319
+ function PC(g, A, I) {
1320
1320
  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];
1321
1321
  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;
1322
1322
  }
1323
- function zI(g, A, I, B) {
1323
+ function jI(g, A, I, B) {
1324
1324
  var C = A[0], Q = A[1], E = A[2], i = A[3], o = I[0], a = I[1], s = I[2], h = I[3], t, y, n, w, r;
1325
1325
  return y = C * o + Q * a + E * s + i * h, y < 0 && (y = -y, o = -o, a = -a, s = -s, h = -h), 1 - y > p ? (t = Math.acos(y), n = Math.sin(t), w = Math.sin((1 - B) * t) / n, r = Math.sin(B * t) / n) : (w = 1 - B, r = B), g[0] = w * C + r * o, g[1] = w * Q + r * a, g[2] = w * E + r * s, g[3] = w * i + r * h, g;
1326
1326
  }
1327
- function HB(g, A) {
1327
+ function MB(g, A) {
1328
1328
  var I = A[0] + A[4] + A[8], B;
1329
1329
  if (I > 0)
1330
1330
  B = Math.sqrt(I + 1), g[3] = 0.5 * B, B = 0.5 / B, g[0] = (A[5] - A[7]) * B, g[1] = (A[6] - A[2]) * B, g[2] = (A[1] - A[3]) * B;
@@ -1336,27 +1336,27 @@ function HB(g, A) {
1336
1336
  }
1337
1337
  return g;
1338
1338
  }
1339
- var vC = WC, XC = bC, Gg = PC;
1339
+ var OC = TC, VC = xC, Gg = bC;
1340
1340
  (function() {
1341
1341
  var g = f(), A = q(1, 0, 0), I = q(0, 1, 0);
1342
1342
  return function(B, C, Q) {
1343
- var E = MB(C, Q);
1344
- return E < -0.999999 ? (jI(g, A, C), xC(g) < 1e-6 && jI(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) : (jI(g, C, Q), B[0] = g[0], B[1] = g[1], B[2] = g[2], B[3] = 1 + E, Gg(B, B));
1343
+ var E = YB(C, Q);
1344
+ return E < -0.999999 ? (XI(g, A, C), uC(g) < 1e-6 && XI(g, I, C), fC(g, g), ZC(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));
1345
1345
  };
1346
1346
  })();
1347
1347
  (function() {
1348
- var g = Qg(), A = Qg();
1348
+ var g = Cg(), A = Cg();
1349
1349
  return function(I, B, C, Q, E, i) {
1350
- return zI(g, B, E, i), zI(A, C, Q, i), zI(I, g, A, 2 * i * (1 - i)), I;
1350
+ return jI(g, B, E, i), jI(A, C, Q, i), jI(I, g, A, 2 * i * (1 - i)), I;
1351
1351
  };
1352
1352
  })();
1353
1353
  (function() {
1354
- var g = dB();
1354
+ var g = JB();
1355
1355
  return function(A, I, B, C) {
1356
- return g[0] = B[0], g[3] = B[1], g[6] = B[2], g[1] = C[0], g[4] = C[1], g[7] = C[2], g[2] = -I[0], g[5] = -I[1], g[8] = -I[2], Gg(A, HB(A, g));
1356
+ return g[0] = B[0], g[3] = B[1], g[6] = B[2], g[1] = C[0], g[4] = C[1], g[7] = C[2], g[2] = -I[0], g[5] = -I[1], g[8] = -I[2], Gg(A, MB(A, g));
1357
1357
  };
1358
1358
  })();
1359
- function qB() {
1359
+ function KB() {
1360
1360
  var g = new b(2);
1361
1361
  return b != Float32Array && (g[0] = 0, g[1] = 0), g;
1362
1362
  }
@@ -1368,27 +1368,27 @@ function W(g, A) {
1368
1368
  var I = new b(2);
1369
1369
  return I[0] = g, I[1] = A, I;
1370
1370
  }
1371
- function jC(g, A) {
1371
+ function vC(g, A) {
1372
1372
  var I = A[0] - g[0], B = A[1] - g[1];
1373
1373
  return Math.hypot(I, B);
1374
1374
  }
1375
- function zC(g) {
1375
+ function XC(g) {
1376
1376
  var A = g[0], I = g[1];
1377
1377
  return A * A + I * I;
1378
1378
  }
1379
- function _C(g, A, I, B) {
1379
+ function jC(g, A, I, B) {
1380
1380
  var C = A[0], Q = A[1];
1381
1381
  return g[0] = C + B * (I[0] - C), g[1] = Q + B * (I[1] - Q), g;
1382
1382
  }
1383
1383
  function Xg(g, A) {
1384
1384
  return g[0] === A[0] && g[1] === A[1];
1385
1385
  }
1386
- function _I(g, A) {
1386
+ function zI(g, A) {
1387
1387
  var I = g[0], B = g[1], C = A[0], Q = A[1];
1388
1388
  return Math.abs(I - C) <= p * Math.max(1, Math.abs(I), Math.abs(C)) && Math.abs(B - Q) <= p * Math.max(1, Math.abs(B), Math.abs(Q));
1389
1389
  }
1390
1390
  (function() {
1391
- var g = qB();
1391
+ var g = KB();
1392
1392
  return function(A, I, B, C, Q, E) {
1393
1393
  var i, o;
1394
1394
  for (I || (I = 2), B || (B = 0), C ? o = Math.min(C * I + B, A.length) : o = A.length, i = B; i < o; i += I)
@@ -1435,10 +1435,10 @@ class RA {
1435
1435
  this.min = q(1 / 0, 1 / 0, 1 / 0), this.max = q(-1 / 0, -1 / 0, -1 / 0);
1436
1436
  const Q = f();
1437
1437
  for (const E of C)
1438
- TI(Q, E, A), this.expandWithPoint(Q);
1438
+ uI(Q, E, A), this.expandWithPoint(Q);
1439
1439
  }
1440
1440
  }
1441
- const $C = {
1441
+ const zC = {
1442
1442
  position: 0,
1443
1443
  normal: 1,
1444
1444
  uv: 2,
@@ -1502,7 +1502,7 @@ class bA extends yg {
1502
1502
  return this.attributes_.find((I) => I.type === A);
1503
1503
  }
1504
1504
  }
1505
- class AQ {
1505
+ class _C {
1506
1506
  gl_;
1507
1507
  buffers_ = /* @__PURE__ */ new Map();
1508
1508
  currentGeometry_ = null;
@@ -1538,7 +1538,7 @@ class AQ {
1538
1538
  this.gl_.bindBuffer(C, Q), this.gl_.bufferData(C, B, this.gl_.STATIC_DRAW);
1539
1539
  const { attributes: E, strideBytes: i } = A;
1540
1540
  E.forEach((s) => {
1541
- const h = $C[s.type];
1541
+ const h = zC[s.type];
1542
1542
  this.gl_.vertexAttribPointer(
1543
1543
  h,
1544
1544
  s.itemSize,
@@ -1557,7 +1557,7 @@ class AQ {
1557
1557
  this.buffers_.set(A, o), this.gl_.bindVertexArray(null);
1558
1558
  }
1559
1559
  }
1560
- class IQ {
1560
+ class $C {
1561
1561
  gl_;
1562
1562
  textures_ = /* @__PURE__ */ new Map();
1563
1563
  currentTexture_ = null;
@@ -1837,7 +1837,7 @@ class AA {
1837
1837
  return { x: A, y: I, width: B, height: C };
1838
1838
  }
1839
1839
  }
1840
- class gQ {
1840
+ class AQ {
1841
1841
  gl_;
1842
1842
  enabledCapabilities_ = /* @__PURE__ */ new Map();
1843
1843
  depthMaskEnabled_ = null;
@@ -1937,8 +1937,8 @@ class gQ {
1937
1937
  A ? this.enable(this.gl_.STENCIL_TEST) : this.disable(this.gl_.STENCIL_TEST);
1938
1938
  }
1939
1939
  }
1940
- const BQ = JC(_(), [1, -1, 1]);
1941
- class CQ extends sC {
1940
+ const IQ = kC(_(), [1, -1, 1]);
1941
+ class gQ extends oC {
1942
1942
  gl_;
1943
1943
  programs_;
1944
1944
  bindings_;
@@ -1957,7 +1957,7 @@ class CQ extends sC {
1957
1957
  this.gl_ = I, U.info(
1958
1958
  "WebGLRenderer",
1959
1959
  `WebGL version ${I.getParameter(I.VERSION)}`
1960
- ), 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);
1960
+ ), this.programs_ = new RC(I), this.bindings_ = new _C(I), this.textures_ = new $C(I), this.state_ = new AQ(I), this.initStencil(), this.resize(this.canvas.width, this.canvas.height);
1961
1961
  }
1962
1962
  render(A) {
1963
1963
  const I = A.getBoxRelativeTo(this.canvas), B = new AA(
@@ -2002,9 +2002,10 @@ class CQ extends sC {
2002
2002
  }
2003
2003
  renderObject(A, I, B) {
2004
2004
  const C = A.objects[I];
2005
- this.state_.setCullFaceMode(C.cullFaceMode), this.state_.setDepthTesting(C.depthTest), this.state_.setDepthMask(C.depthTest), this.bindings_.bindGeometry(C.geometry), C.popStaleTextures().forEach((E) => {
2005
+ if (C.popStaleTextures().forEach((E) => {
2006
2006
  this.textures_.disposeTexture(E);
2007
- }), C.textures.forEach((E, i) => {
2007
+ }), !C.programName) return;
2008
+ this.state_.setCullFaceMode(C.cullFaceMode), this.state_.setDepthTesting(C.depthTest), this.state_.setDepthMask(C.depthTest), this.bindings_.bindGeometry(C.geometry), C.textures.forEach((E, i) => {
2008
2009
  this.textures_.bindTexture(E, i);
2009
2010
  });
2010
2011
  const Q = this.programs_.use(C.programName);
@@ -2027,7 +2028,7 @@ class CQ extends sC {
2027
2028
  I.transform.matrix
2028
2029
  ), i = zA(
2029
2030
  _(),
2030
- BQ,
2031
+ IQ,
2031
2032
  Q.projectionMatrix
2032
2033
  ), o = [this.canvas.width, this.canvas.height], a = I.getUniforms(), h = {
2033
2034
  ...B.getUniforms(),
@@ -2048,7 +2049,7 @@ class CQ extends sC {
2048
2049
  C.setUniform(n, B.opacity);
2049
2050
  break;
2050
2051
  case "CameraPositionModel": {
2051
- const w = uI(_(), E), r = kI(0, 0, 0, 1), G = _A(
2052
+ const w = mI(_(), E), r = kI(0, 0, 0, 1), G = _A(
2052
2053
  pA(),
2053
2054
  r,
2054
2055
  w
@@ -2094,12 +2095,12 @@ class CQ extends sC {
2094
2095
  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);
2095
2096
  }
2096
2097
  }
2097
- const QQ = 8;
2098
- class EQ {
2098
+ const BQ = 8;
2099
+ class CQ {
2099
2100
  maxConcurrent_;
2100
2101
  pending_ = [];
2101
2102
  running_ = /* @__PURE__ */ new Map();
2102
- constructor(A = QQ) {
2103
+ constructor(A = BQ) {
2103
2104
  this.maxConcurrent_ = Math.max(1, A);
2104
2105
  }
2105
2106
  enqueue(A, I) {
@@ -2165,17 +2166,17 @@ function zg(g) {
2165
2166
  `Unsupported chunk data type: ${g}. Supported data types: ${A}`
2166
2167
  ), !1;
2167
2168
  }
2168
- function iQ(g, A) {
2169
+ function QQ(g, A) {
2169
2170
  return Math.round((A - g.translation) / g.scale);
2170
2171
  }
2171
- function Eg(g, A, I = 1e-6) {
2172
+ function Qg(g, A, I = 1e-6) {
2172
2173
  return Math.abs(g - A) <= I;
2173
2174
  }
2174
2175
  function cA(g, A, I) {
2175
2176
  return Math.max(A, Math.min(I, g));
2176
2177
  }
2177
2178
  const ng = Symbol("INTERNAL_POLICY_KEY");
2178
- class oQ {
2179
+ class EQ {
2179
2180
  store_;
2180
2181
  policy_;
2181
2182
  policyChanged_ = !1;
@@ -2194,7 +2195,7 @@ class oQ {
2194
2195
  this.policy_.profile
2195
2196
  );
2196
2197
  const B = this.store_.dimensions, C = B.x.lods[0], Q = B.y.lods[0];
2197
- this.sourceMaxSquareDistance2D_ = zC(
2198
+ this.sourceMaxSquareDistance2D_ = XC(
2198
2199
  W(C.size * C.scale, Q.size * Q.scale)
2199
2200
  );
2200
2201
  }
@@ -2243,13 +2244,13 @@ class oQ {
2243
2244
  ), this.chunkViewStates_.clear();
2244
2245
  return;
2245
2246
  }
2246
- const w = qB();
2247
- _C(w, Q.min, Q.max, 0.5);
2247
+ const w = KB();
2248
+ jC(w, Q.min, Q.max, 0.5);
2248
2249
  const [r, G] = this.getZBounds(A), c = new RA(
2249
2250
  q(Q.min[0], Q.min[1], r),
2250
2251
  q(Q.max[0], Q.max[1], G)
2251
2252
  );
2252
- this.chunkViewStates_.forEach($I), this.updateChunksAtTimeIndex(
2253
+ this.chunkViewStates_.forEach(_I), this.updateChunksAtTimeIndex(
2253
2254
  y,
2254
2255
  A,
2255
2256
  c,
@@ -2276,7 +2277,7 @@ class oQ {
2276
2277
  ), this.chunkViewStates_.clear();
2277
2278
  return;
2278
2279
  }
2279
- this.currentLOD_ = this.policy_.lod.min, this.chunkViewStates_.forEach($I);
2280
+ this.currentLOD_ = this.policy_.lod.min, this.chunkViewStates_.forEach(_I);
2280
2281
  const i = this.fallbackLOD();
2281
2282
  for (const o of E) {
2282
2283
  const a = o.lod === this.currentLOD_, s = o.lod === i;
@@ -2313,7 +2314,7 @@ class oQ {
2313
2314
  I && (I.visible || I.prefetch || I.priority !== null) || this.chunkViewStates_.delete(A);
2314
2315
  }
2315
2316
  dispose() {
2316
- this.isDisposed_ = !0, this.chunkViewStates_.forEach($I);
2317
+ this.isDisposed_ = !0, this.chunkViewStates_.forEach(_I);
2317
2318
  }
2318
2319
  setImageSourcePolicy(A, I) {
2319
2320
  if (I !== ng)
@@ -2439,13 +2440,13 @@ class oQ {
2439
2440
  ];
2440
2441
  }
2441
2442
  viewBounds2DChanged(A) {
2442
- return this.lastViewBounds2D_ === null || !_I(this.lastViewBounds2D_.min, A.min) || !_I(this.lastViewBounds2D_.max, A.max);
2443
+ return this.lastViewBounds2D_ === null || !zI(this.lastViewBounds2D_.min, A.min) || !zI(this.lastViewBounds2D_.max, A.max);
2443
2444
  }
2444
2445
  hasViewProjectionChanged(A) {
2445
- return this.lastViewProjection_ === null || !lC(this.lastViewProjection_, A);
2446
+ return this.lastViewProjection_ === null || !HC(this.lastViewProjection_, A);
2446
2447
  }
2447
2448
  zBoundsChanged(A) {
2448
- return !this.lastZBounds_ || !_I(this.lastZBounds_, A);
2449
+ return !this.lastZBounds_ || !zI(this.lastZBounds_, A);
2449
2450
  }
2450
2451
  getPaddedBounds(A) {
2451
2452
  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;
@@ -2471,10 +2472,10 @@ class oQ {
2471
2472
  return C * C + Q * Q;
2472
2473
  }
2473
2474
  }
2474
- function $I(g) {
2475
+ function _I(g) {
2475
2476
  g.visible = !1, g.prefetch = !1, g.priority = null, g.orderKey = null;
2476
2477
  }
2477
- class aQ {
2478
+ class iQ {
2478
2479
  chunks_;
2479
2480
  loader_;
2480
2481
  lowestResLOD_;
@@ -2532,7 +2533,7 @@ class aQ {
2532
2533
  return this.chunks_[A];
2533
2534
  }
2534
2535
  getTimeIndex(A) {
2535
- return A.t === void 0 || this.dimensions_.t === void 0 ? 0 : iQ(this.dimensions_.t.lods[0], A.t);
2536
+ return A.t === void 0 || this.dimensions_.t === void 0 ? 0 : QQ(this.dimensions_.t.lods[0], A.t);
2536
2537
  }
2537
2538
  get lodCount() {
2538
2539
  return this.lowestResLOD_ + 1;
@@ -2547,7 +2548,7 @@ class aQ {
2547
2548
  return this.loader_.loadChunkData(A, I);
2548
2549
  }
2549
2550
  createView(A) {
2550
- const I = new oQ(this, A);
2551
+ const I = new EQ(this, A);
2551
2552
  return this.views_.push(I), this.hasHadViews_ = !0, I;
2552
2553
  }
2553
2554
  get views() {
@@ -2598,7 +2599,7 @@ class aQ {
2598
2599
  const A = this.dimensions_.x, I = this.dimensions_.y;
2599
2600
  for (let B = 1; B < this.dimensions_.numLods; B++) {
2600
2601
  const C = A.lods[B].scale / A.lods[B - 1].scale, Q = I.lods[B].scale / I.lods[B - 1].scale;
2601
- if (!Eg(C, 2, 0.02) || !Eg(Q, 2, 0.02))
2602
+ if (!Qg(C, 2, 0.02) || !Qg(Q, 2, 0.02))
2602
2603
  throw new Error(
2603
2604
  `Invalid downsampling factor between levels ${B - 1} → ${B}: expected (2× in X and Y), but got (${C.toFixed(2)}×, ${Q.toFixed(2)}×) from scale [${A.lods[B - 1].scale}, ${I.lods[B - 1].scale}] → [${A.lods[B].scale}, ${I.lods[B].scale}]`
2604
2605
  );
@@ -2649,10 +2650,10 @@ class aQ {
2649
2650
  };
2650
2651
  }
2651
2652
  }
2652
- class sQ {
2653
+ class oQ {
2653
2654
  stores_ = /* @__PURE__ */ new Map();
2654
2655
  pendingStores_ = /* @__PURE__ */ new Map();
2655
- queue_ = new EQ();
2656
+ queue_ = new CQ();
2656
2657
  async addView(A, I) {
2657
2658
  return (await this.getOrCreateStore(A)).createView(I);
2658
2659
  }
@@ -2665,7 +2666,7 @@ class sQ {
2665
2666
  return B;
2666
2667
  const Q = (async () => {
2667
2668
  const i = await A.open();
2668
- return new aQ(i);
2669
+ return new iQ(i);
2669
2670
  })();
2670
2671
  this.pendingStores_.set(A, Q);
2671
2672
  const E = await Q;
@@ -2737,14 +2738,14 @@ XA.Panel = function(g, A, I, B) {
2737
2738
  }
2738
2739
  };
2739
2740
  };
2740
- function DQ({ scale: g } = { scale: 1.5 }) {
2741
+ function aQ({ scale: g } = { scale: 1.5 }) {
2741
2742
  const A = new XA(g);
2742
2743
  return A.showPanel(
2743
2744
  0
2744
2745
  /* 0 = fps, 1 = ms, 2 = mb */
2745
2746
  ), document.body.appendChild(A.dom), A;
2746
2747
  }
2747
- class hQ {
2748
+ class sQ {
2748
2749
  layers_ = [];
2749
2750
  callbacks_ = [];
2750
2751
  context_;
@@ -2794,17 +2795,17 @@ class hQ {
2794
2795
  this.callbacks_.splice(I, 1);
2795
2796
  }
2796
2797
  }
2797
- const ig = [
2798
+ const Eg = [
2798
2799
  "pointerdown",
2799
2800
  "pointermove",
2800
2801
  "pointerup",
2801
2802
  "pointercancel",
2802
2803
  "wheel"
2803
2804
  ];
2804
- function tQ(g) {
2805
- return ig.includes(g);
2805
+ function DQ(g) {
2806
+ return Eg.includes(g);
2806
2807
  }
2807
- class yQ {
2808
+ class hQ {
2808
2809
  propagationStopped_ = !1;
2809
2810
  type;
2810
2811
  event;
@@ -2820,7 +2821,7 @@ class yQ {
2820
2821
  this.propagationStopped_ = !0;
2821
2822
  }
2822
2823
  }
2823
- class eQ {
2824
+ class tQ {
2824
2825
  listeners_ = [];
2825
2826
  element_;
2826
2827
  isConnected_ = !1;
@@ -2839,7 +2840,7 @@ class eQ {
2839
2840
  );
2840
2841
  return;
2841
2842
  }
2842
- this.isConnected_ = !0, ig.forEach((A) => {
2843
+ this.isConnected_ = !0, Eg.forEach((A) => {
2843
2844
  this.element_.addEventListener(A, this.handleEvent, {
2844
2845
  passive: !1
2845
2846
  });
@@ -2854,21 +2855,21 @@ class eQ {
2854
2855
  );
2855
2856
  return;
2856
2857
  }
2857
- this.isConnected_ = !1, ig.forEach((A) => {
2858
+ this.isConnected_ = !1, Eg.forEach((A) => {
2858
2859
  this.element_.removeEventListener(A, this.handleEvent);
2859
2860
  });
2860
2861
  }
2861
2862
  handleEvent = (A) => {
2862
- if (!tQ(A.type)) {
2863
+ if (!DQ(A.type)) {
2863
2864
  U.error("EventDispatcher", `Unsupported event type ${A.type}`);
2864
2865
  return;
2865
2866
  }
2866
- const I = new yQ(A.type, A);
2867
+ const I = new hQ(A.type, A);
2867
2868
  for (const B of this.listeners_)
2868
2869
  if (B(I), I.propagationStopped) break;
2869
2870
  };
2870
2871
  }
2871
- class GQ {
2872
+ class yQ {
2872
2873
  id;
2873
2874
  element;
2874
2875
  camera;
@@ -2876,7 +2877,7 @@ class GQ {
2876
2877
  events;
2877
2878
  cameraControls;
2878
2879
  constructor(A) {
2879
- 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) => {
2880
+ 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 tQ(this.element), this.events.addEventListener((I) => {
2880
2881
  if (I.event instanceof PointerEvent || I.event instanceof WheelEvent) {
2881
2882
  const { clientX: B, clientY: C } = I.event, Q = W(B, C);
2882
2883
  I.clipPos = this.clientToClip(Q, 0), I.worldPos = this.camera.clipToWorld(I.clipPos);
@@ -2930,7 +2931,7 @@ class GQ {
2930
2931
  this.camera.setAspectRatio(B);
2931
2932
  }
2932
2933
  }
2933
- function nQ(g) {
2934
+ function eQ(g) {
2934
2935
  const A = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Set();
2935
2936
  for (const B of g) {
2936
2937
  if (I.has(B.id))
@@ -2946,19 +2947,19 @@ function nQ(g) {
2946
2947
  A.set(B.element, B.id);
2947
2948
  }
2948
2949
  }
2949
- function wQ(g, A, I) {
2950
+ function GQ(g, A, I) {
2950
2951
  const B = g.map((C) => {
2951
2952
  const Q = C.element ?? A;
2952
2953
  return {
2953
2954
  ...C,
2954
2955
  element: Q,
2955
- id: C.id ?? Q.id ?? YB(),
2956
- layerManager: new hQ(I)
2956
+ id: C.id ?? Q.id ?? LB(),
2957
+ layerManager: new sQ(I)
2957
2958
  };
2958
2959
  });
2959
- return nQ(B), B.map((C) => new GQ(C));
2960
+ return eQ(B), B.map((C) => new yQ(C));
2960
2961
  }
2961
- class FQ {
2962
+ class nQ {
2962
2963
  elements_;
2963
2964
  resizeObserver_;
2964
2965
  mediaQuery_;
@@ -3002,7 +3003,7 @@ class FQ {
3002
3003
  this.resizeObserver_?.disconnect(), this.mediaQuery_ && this.onMediaQueryChange_ && this.mediaQuery_.removeEventListener("change", this.onMediaQueryChange_);
3003
3004
  }
3004
3005
  }
3005
- class Yo {
3006
+ class Ko {
3006
3007
  chunkManager_;
3007
3008
  context_;
3008
3009
  renderer_;
@@ -3065,17 +3066,17 @@ class Yo {
3065
3066
  constructor(A) {
3066
3067
  if (this.canvas = A.canvas, A.viewports.length === 0)
3067
3068
  throw new Error("At least one viewport config must be specified.");
3068
- this.renderer_ = new CQ(this.canvas), this.chunkManager_ = new sQ(), this.context_ = {
3069
+ this.renderer_ = new gQ(this.canvas), this.chunkManager_ = new oQ(), this.context_ = {
3069
3070
  chunkManager: this.chunkManager_
3070
- }, this.viewports_ = wQ(
3071
+ }, this.viewports_ = GQ(
3071
3072
  A.viewports,
3072
3073
  this.canvas,
3073
3074
  this.context_
3074
- ), this.overlays = A.overlays ?? [], A.showStats && (this.stats_ = DQ());
3075
+ ), this.overlays = A.overlays ?? [], A.showStats && (this.stats_ = aQ());
3075
3076
  const I = [this.canvas];
3076
3077
  for (const B of this.viewports_)
3077
3078
  B.element !== this.canvas && I.push(B.element);
3078
- this.sizeObserver_ = new FQ(I, () => {
3079
+ this.sizeObserver_ = new nQ(I, () => {
3079
3080
  this.renderer_.updateSize();
3080
3081
  for (const B of this.viewports_)
3081
3082
  B.updateSize(), this.renderer_.render(B);
@@ -3134,7 +3135,7 @@ class Yo {
3134
3135
  }
3135
3136
  }
3136
3137
  }
3137
- class rQ extends bA {
3138
+ class wQ extends bA {
3138
3139
  constructor(A) {
3139
3140
  if (super(), A.primitive != "triangles") {
3140
3141
  U.warn("WireframeGeometry", "Only indexed geometries are supported");
@@ -3159,21 +3160,21 @@ class rQ extends bA {
3159
3160
  this.indexData_ = new Uint32Array(B);
3160
3161
  }
3161
3162
  }
3162
- const SQ = q(0, 1, 0);
3163
- class RQ {
3163
+ const FQ = q(0, 1, 0);
3164
+ class rQ {
3164
3165
  dirty_ = !0;
3165
3166
  matrix_ = _();
3166
- rotation_ = Qg();
3167
+ rotation_ = Cg();
3167
3168
  translation_ = f();
3168
3169
  scale_ = q(1, 1, 1);
3169
3170
  addRotation(A) {
3170
- VC(this.rotation_, this.rotation_, A), this.dirty_ = !0;
3171
+ PC(this.rotation_, this.rotation_, A), this.dirty_ = !0;
3171
3172
  }
3172
3173
  setRotation(A) {
3173
- XC(this.rotation_, A), this.dirty_ = !0;
3174
+ VC(this.rotation_, A), this.dirty_ = !0;
3174
3175
  }
3175
3176
  get rotation() {
3176
- return vC(this.rotation_);
3177
+ return OC(this.rotation_);
3177
3178
  }
3178
3179
  addTranslation(A) {
3179
3180
  lA(this.translation_, this.translation_, A), this.dirty_ = !0;
@@ -3185,15 +3186,15 @@ class RQ {
3185
3186
  return BA(this.translation_);
3186
3187
  }
3187
3188
  addScale(A) {
3188
- pC(this.scale_, this.scale_, A), this.dirty_ = !0;
3189
+ lC(this.scale_, this.scale_, A), this.dirty_ = !0;
3189
3190
  }
3190
3191
  setScale(A) {
3191
3192
  HA(this.scale_, A), this.dirty_ = !0;
3192
3193
  }
3193
3194
  targetTo(A) {
3194
- KB(this.translation_, A) && (A = BA(A), A[2] += p);
3195
- const I = qC(_(), this.translation_, A, SQ), B = LC(dB(), I);
3196
- HB(this.rotation_, B), Gg(this.rotation_, this.rotation_), this.dirty_ = !0;
3195
+ dB(this.translation_, A) && (A = BA(A), A[2] += p);
3196
+ const I = KC(_(), this.translation_, A, FQ), B = UC(JB(), I);
3197
+ MB(this.rotation_, B), Gg(this.rotation_, this.rotation_), this.dirty_ = !0;
3197
3198
  }
3198
3199
  get scale() {
3199
3200
  return BA(this.scale_);
@@ -3202,10 +3203,10 @@ class RQ {
3202
3203
  return this.dirty_ && (this.computeMatrix(), this.dirty_ = !1), this.matrix_;
3203
3204
  }
3204
3205
  get inverse() {
3205
- return uI(_(), this.matrix);
3206
+ return mI(_(), this.matrix);
3206
3207
  }
3207
3208
  computeMatrix() {
3208
- YC(
3209
+ LC(
3209
3210
  this.matrix_,
3210
3211
  this.rotation_,
3211
3212
  this.translation_,
@@ -3219,7 +3220,7 @@ class ZA extends yg {
3219
3220
  depthTest = !0;
3220
3221
  textures_ = [];
3221
3222
  staleTextures_ = [];
3222
- transform_ = new RQ();
3223
+ transform_ = new rQ();
3223
3224
  geometry_ = new bA();
3224
3225
  wireframeGeometry_ = null;
3225
3226
  programName_ = null;
@@ -3236,7 +3237,7 @@ class ZA extends yg {
3236
3237
  return this.geometry_;
3237
3238
  }
3238
3239
  get wireframeGeometry() {
3239
- return this.wireframeGeometry_ ??= new rQ(this.geometry), this.wireframeGeometry_;
3240
+ return this.wireframeGeometry_ ??= new wQ(this.geometry), this.wireframeGeometry_;
3240
3241
  }
3241
3242
  get textures() {
3242
3243
  return this.textures_;
@@ -3248,8 +3249,6 @@ class ZA extends yg {
3248
3249
  this.geometry_ = A, this.wireframeGeometry_ = null;
3249
3250
  }
3250
3251
  get programName() {
3251
- if (this.programName_ === null)
3252
- throw new Error("Program name not set");
3253
3252
  return this.programName_;
3254
3253
  }
3255
3254
  get boundingBox() {
@@ -3283,7 +3282,7 @@ class dA {
3283
3282
  this.normal = BA(A), this.signedDistance = I;
3284
3283
  }
3285
3284
  signedDistanceToPoint(A) {
3286
- return MB(this.normal, A) + this.signedDistance;
3285
+ return YB(this.normal, A) + this.signedDistance;
3287
3286
  }
3288
3287
  normalize() {
3289
3288
  const A = eg(this.normal);
@@ -3293,7 +3292,7 @@ class dA {
3293
3292
  }
3294
3293
  }
3295
3294
  }
3296
- class NQ {
3295
+ class SQ {
3297
3296
  planes_;
3298
3297
  constructor(A) {
3299
3298
  this.planes_ = [
@@ -3339,7 +3338,7 @@ class NQ {
3339
3338
  return !0;
3340
3339
  }
3341
3340
  }
3342
- class lB extends ZA {
3341
+ class HB extends ZA {
3343
3342
  projectionMatrix_ = _();
3344
3343
  near_ = 0;
3345
3344
  far_ = 0;
@@ -3361,7 +3360,7 @@ class lB extends ZA {
3361
3360
  return q(A[4], A[5], A[6]);
3362
3361
  }
3363
3362
  get frustum() {
3364
- return new NQ(
3363
+ return new SQ(
3365
3364
  zA(_(), this.projectionMatrix, this.viewMatrix)
3366
3365
  );
3367
3366
  }
@@ -3372,7 +3371,7 @@ class lB extends ZA {
3372
3371
  return this.transform.translation;
3373
3372
  }
3374
3373
  clipToWorld(A) {
3375
- const I = kI(A[0], A[1], A[2], 1), B = uI(
3374
+ const I = kI(A[0], A[1], A[2], 1), B = mI(
3376
3375
  _(),
3377
3376
  this.projectionMatrix_
3378
3377
  ), C = _A(
@@ -3380,7 +3379,7 @@ class lB extends ZA {
3380
3379
  I,
3381
3380
  B
3382
3381
  );
3383
- ZC(C, C, 1 / C[3]);
3382
+ WC(C, C, 1 / C[3]);
3384
3383
  const Q = _A(
3385
3384
  pA(),
3386
3385
  C,
@@ -3389,12 +3388,12 @@ class lB extends ZA {
3389
3388
  return q(Q[0], Q[1], Q[2]);
3390
3389
  }
3391
3390
  }
3392
- const fB = 1.77, _g = 128, $g = 128 / fB;
3393
- class Mo extends lB {
3391
+ const qB = 1.77, _g = 128, $g = 128 / qB;
3392
+ class Ho extends HB {
3394
3393
  // width_ and height_ should always be defined by constructor (see setFrame)
3395
3394
  width_ = _g;
3396
3395
  height_ = $g;
3397
- viewportAspectRatio_ = fB;
3396
+ viewportAspectRatio_ = qB;
3398
3397
  viewportSize_ = [_g, $g];
3399
3398
  constructor(A, I, B, C, Q = 0, E = 100) {
3400
3399
  super(), this.near_ = Q, this.far_ = E, this.setFrame(A, I, C, B), this.updateProjectionMatrix();
@@ -3425,7 +3424,7 @@ class Mo extends lB {
3425
3424
  _(),
3426
3425
  this.projectionMatrix,
3427
3426
  this.viewMatrix
3428
- ), C = uI(_(), B);
3427
+ ), C = mI(_(), B);
3429
3428
  return A = _A(pA(), A, C), I = _A(pA(), I, C), new AA(
3430
3429
  W(A[0], A[1]),
3431
3430
  W(I[0], I[1])
@@ -3434,7 +3433,7 @@ class Mo extends lB {
3434
3433
  updateProjectionMatrix() {
3435
3434
  const A = this.width_, I = this.height_, B = A / I;
3436
3435
  let C = 0.5 * A, Q = 0.5 * I;
3437
- this.viewportAspectRatio_ > B ? C *= this.viewportAspectRatio_ / B : Q *= B / this.viewportAspectRatio_, this.viewportSize_ = [2 * C, 2 * Q], HC(
3436
+ this.viewportAspectRatio_ > B ? C *= this.viewportAspectRatio_ / B : Q *= B / this.viewportAspectRatio_, this.viewportSize_ = [2 * C, 2 * Q], MC(
3438
3437
  this.projectionMatrix_,
3439
3438
  -C,
3440
3439
  C,
@@ -3445,21 +3444,21 @@ class Mo extends lB {
3445
3444
  );
3446
3445
  }
3447
3446
  }
3448
- const cQ = 60, UQ = 1.77, rI = 0.1, Ag = 180 - rI;
3449
- class Ko extends lB {
3447
+ const RQ = 60, NQ = 1.77, rI = 0.1, $I = 180 - rI;
3448
+ class qo extends HB {
3450
3449
  fov_;
3451
3450
  aspectRatio_;
3452
3451
  constructor(A = {}) {
3453
3452
  const {
3454
- fov: I = cQ,
3455
- aspectRatio: B = UQ,
3453
+ fov: I = RQ,
3454
+ aspectRatio: B = NQ,
3456
3455
  near: C = 0.1,
3457
3456
  far: Q = 1e4,
3458
3457
  position: E = q(0, 0, 0)
3459
3458
  } = A;
3460
- if (I < rI || I > Ag)
3459
+ if (I < rI || I > $I)
3461
3460
  throw new Error(
3462
- `Invalid field of view: ${I}, must be in [${rI}, ${Ag}] degrees`
3461
+ `Invalid field of view: ${I}, must be in [${rI}, ${$I}] degrees`
3463
3462
  );
3464
3463
  super(), this.fov_ = I, this.aspectRatio_ = B, this.near_ = C, this.far_ = Q, this.transform.setTranslation(E), this.updateProjectionMatrix();
3465
3464
  }
@@ -3475,12 +3474,12 @@ class Ko extends lB {
3475
3474
  zoom(A) {
3476
3475
  if (A <= 0)
3477
3476
  throw new Error(`Invalid zoom factor: ${A}`);
3478
- this.fov_ = Math.max(rI, Math.min(Ag, this.fov_ / A)), this.updateProjectionMatrix();
3477
+ this.fov_ = Math.max(rI, Math.min($I, this.fov_ / A)), this.updateProjectionMatrix();
3479
3478
  }
3480
3479
  updateProjectionMatrix() {
3481
- MC(
3480
+ YC(
3482
3481
  this.projectionMatrix_,
3483
- kC(this.fov),
3482
+ cC(this.fov),
3484
3483
  this.aspectRatio_,
3485
3484
  this.near_,
3486
3485
  this.far_
@@ -3488,7 +3487,7 @@ class Ko extends lB {
3488
3487
  }
3489
3488
  }
3490
3489
  const AB = 0;
3491
- class Ho {
3490
+ class lo {
3492
3491
  camera_;
3493
3492
  dragActive_ = !1;
3494
3493
  dragStart_ = f();
@@ -3556,22 +3555,22 @@ class IB {
3556
3555
  );
3557
3556
  }
3558
3557
  }
3559
- const Ig = -1, gB = 0, kQ = 1, BB = 9e-3, LQ = 1e-3, JQ = 9e-4, YQ = 0.5, dQ = 60;
3560
- class qo {
3558
+ const Ag = -1, gB = 0, cQ = 1, BB = 9e-3, UQ = 1e-3, kQ = 9e-4, LQ = 0.5, JQ = 60;
3559
+ class fo {
3561
3560
  camera_;
3562
3561
  orbitVelocity_ = new IB(0, 0, 0);
3563
3562
  panVelocity_ = f();
3564
3563
  currPos_;
3565
3564
  currCenter_ = f();
3566
3565
  dampingFactor_;
3567
- currMouseButton_ = Ig;
3566
+ currMouseButton_ = Ag;
3568
3567
  constructor(A, I) {
3569
3568
  this.camera_ = A, this.currPos_ = new IB(
3570
3569
  I?.radius ?? 1,
3571
3570
  I?.yaw ?? 0,
3572
3571
  I?.pitch ?? 0
3573
3572
  ), I?.target && HA(this.currCenter_, I.target), this.dampingFactor_ = cA(
3574
- I?.dampingFactor ?? YQ,
3573
+ I?.dampingFactor ?? LQ,
3575
3574
  0,
3576
3575
  1
3577
3576
  ), this.updateCamera();
@@ -3597,12 +3596,12 @@ class qo {
3597
3596
  }
3598
3597
  }
3599
3598
  onUpdate(A) {
3600
- if (this.orbitVelocity_.phi === 0 && this.orbitVelocity_.theta === 0 && this.orbitVelocity_.radius === 0 && KB(this.panVelocity_, q(0, 0, 0)))
3599
+ if (this.orbitVelocity_.phi === 0 && this.orbitVelocity_.theta === 0 && this.orbitVelocity_.radius === 0 && dB(this.panVelocity_, q(0, 0, 0)))
3601
3600
  return;
3602
3601
  this.currPos_.phi += this.orbitVelocity_.phi, this.currPos_.theta += this.orbitVelocity_.theta, this.currPos_.radius += this.orbitVelocity_.radius * this.currPos_.radius, lA(this.currCenter_, this.currCenter_, this.panVelocity_);
3603
3602
  const I = Math.PI / 2 - p;
3604
3603
  this.currPos_.theta = cA(this.currPos_.theta, -I, I), this.currPos_.radius = Math.max(0.01, this.currPos_.radius), this.updateCamera();
3605
- const B = Math.pow(1 - this.dampingFactor_, A * dQ);
3604
+ const B = Math.pow(1 - this.dampingFactor_, A * JQ);
3606
3605
  this.orbitVelocity_.phi *= B, this.orbitVelocity_.theta *= B, this.orbitVelocity_.radius *= B, fA(this.panVelocity_, this.panVelocity_, B), this.cutoffLowVelocity();
3607
3606
  }
3608
3607
  onPointerDown(A) {
@@ -3610,8 +3609,8 @@ class qo {
3610
3609
  this.currMouseButton_ = I.button, I.target?.setPointerCapture?.(I.pointerId);
3611
3610
  }
3612
3611
  onPointerMove(A) {
3613
- if (this.currMouseButton_ == Ig) return;
3614
- const I = A.event, B = I.movementX ?? 0, C = I.movementY ?? 0, Q = this.currMouseButton_ === gB && !I.shiftKey, E = this.currMouseButton_ === gB && I.shiftKey || this.currMouseButton_ === kQ;
3612
+ if (this.currMouseButton_ == Ag) return;
3613
+ const I = A.event, B = I.movementX ?? 0, C = I.movementY ?? 0, Q = this.currMouseButton_ === gB && !I.shiftKey, E = this.currMouseButton_ === gB && I.shiftKey || this.currMouseButton_ === cQ;
3615
3614
  Q && this.orbit(B, C), E && this.pan(B, C);
3616
3615
  }
3617
3616
  onWheel(A) {
@@ -3621,7 +3620,7 @@ class qo {
3621
3620
  this.zoom(B);
3622
3621
  }
3623
3622
  onPointerEnd(A) {
3624
- this.currMouseButton_ = Ig;
3623
+ this.currMouseButton_ = Ag;
3625
3624
  const I = A.event;
3626
3625
  I.target?.releasePointerCapture?.(I.pointerId);
3627
3626
  }
@@ -3629,18 +3628,18 @@ class qo {
3629
3628
  this.orbitVelocity_.phi -= A * BB, this.orbitVelocity_.theta += I * BB;
3630
3629
  }
3631
3630
  pan(A, I) {
3632
- const B = this.currPos_.radius * LQ, C = f();
3631
+ const B = this.currPos_.radius * UQ, C = f();
3633
3632
  cI(C, C, this.camera_.right, A), cI(C, C, this.camera_.up, I), fA(C, C, B), UI(this.panVelocity_, this.panVelocity_, C);
3634
3633
  }
3635
3634
  zoom(A) {
3636
- this.orbitVelocity_.radius += A * JQ;
3635
+ this.orbitVelocity_.radius += A * kQ;
3637
3636
  }
3638
3637
  updateCamera() {
3639
3638
  const A = lA(f(), this.currCenter_, this.currPos_.toVec3());
3640
3639
  this.camera_.transform.setTranslation(A), this.camera_.transform.targetTo(this.currCenter_);
3641
3640
  }
3642
3641
  cutoffLowVelocity() {
3643
- 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_);
3642
+ 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 && mC(this.panVelocity_);
3644
3643
  }
3645
3644
  }
3646
3645
  class FA {
@@ -3825,25 +3824,25 @@ class wg extends ZA {
3825
3824
  };
3826
3825
  }
3827
3826
  }
3828
- class lo extends FA {
3827
+ class po extends FA {
3829
3828
  type = "AxesLayer";
3830
3829
  constructor(A) {
3831
3830
  super();
3832
3831
  const { length: I, width: B } = A;
3833
3832
  this.addObject(
3834
- gg({
3833
+ Ig({
3835
3834
  end: [I, 0, 0],
3836
3835
  width: B,
3837
3836
  color: [1, 0, 0]
3838
3837
  })
3839
3838
  ), this.addObject(
3840
- gg({
3839
+ Ig({
3841
3840
  end: [0, I, 0],
3842
3841
  width: B,
3843
3842
  color: [0, 1, 0]
3844
3843
  })
3845
3844
  ), this.addObject(
3846
- gg({
3845
+ Ig({
3847
3846
  end: [0, 0, I],
3848
3847
  width: B,
3849
3848
  color: [0, 0, 1]
@@ -3853,7 +3852,7 @@ class lo extends FA {
3853
3852
  update() {
3854
3853
  }
3855
3854
  }
3856
- function gg(g) {
3855
+ function Ig(g) {
3857
3856
  const { end: A, width: I, color: B } = g, C = new LI([[0, 0, 0], A]);
3858
3857
  return new wg({
3859
3858
  geometry: C,
@@ -3861,7 +3860,7 @@ function gg(g) {
3861
3860
  width: I
3862
3861
  });
3863
3862
  }
3864
- class fo extends FA {
3863
+ class mo extends FA {
3865
3864
  type = "ProjectedLineLayer";
3866
3865
  paths_ = [];
3867
3866
  constructor(A = []) {
@@ -3878,10 +3877,10 @@ class fo extends FA {
3878
3877
  // TODO: this is temporary - we may want to generalize this to all layers
3879
3878
  // for now it is used to set the initial camera position to be centered on the tracks
3880
3879
  get extent() {
3881
- return MQ(this.paths_.flat());
3880
+ return YQ(this.paths_.flat());
3882
3881
  }
3883
3882
  }
3884
- function MQ(g) {
3883
+ function YQ(g) {
3885
3884
  function A(o) {
3886
3885
  const a = g.map((s) => s[o]);
3887
3886
  return [Math.min(...a), Math.max(...a)];
@@ -3889,7 +3888,7 @@ function MQ(g) {
3889
3888
  const [I, B] = A(0), [C, Q] = A(1), [E, i] = A(2);
3890
3889
  return { xMin: I, xMax: B, yMin: C, yMax: Q, zMin: E, zMax: i };
3891
3890
  }
3892
- class po extends FA {
3891
+ class uo extends FA {
3893
3892
  type = "TracksLayer";
3894
3893
  tracks_ = [];
3895
3894
  constructor(A = []) {
@@ -3899,7 +3898,7 @@ class po extends FA {
3899
3898
  this.tracks_.push(A);
3900
3899
  let I;
3901
3900
  if (A.interpolation) {
3902
- const i = HQ({
3901
+ const i = MQ({
3903
3902
  path: A.path,
3904
3903
  pointsPerSegment: A.interpolation.pointsPerSegment,
3905
3904
  tangentFactor: A.interpolation.tangentFactor
@@ -3930,10 +3929,10 @@ class po extends FA {
3930
3929
  // for now it is used to set the initial camera position to be centered on the tracks
3931
3930
  get extent() {
3932
3931
  const A = this.tracks_.map((I) => I.path);
3933
- return KQ(A.flat());
3932
+ return dQ(A.flat());
3934
3933
  }
3935
3934
  }
3936
- function KQ(g) {
3935
+ function dQ(g) {
3937
3936
  function A(o) {
3938
3937
  const a = g.map((s) => s[o]);
3939
3938
  return [Math.min(...a), Math.max(...a)];
@@ -3941,12 +3940,12 @@ function KQ(g) {
3941
3940
  const [I, B] = A(0), [C, Q] = A(1), [E, i] = A(2);
3942
3941
  return { xMin: I, xMax: B, yMin: C, yMax: Q, zMin: E, zMax: i };
3943
3942
  }
3944
- function HQ({
3943
+ function MQ({
3945
3944
  path: g,
3946
3945
  pointsPerSegment: A,
3947
3946
  tangentFactor: I = 1 / 3
3948
3947
  }) {
3949
- const B = qQ(g), C = Array((g.length - 1) * A);
3948
+ const B = KQ(g), C = Array((g.length - 1) * A);
3950
3949
  for (let Q = 0; Q < g.length - 1; Q++) {
3951
3950
  const E = g[Q], i = g[Q + 1], o = BA(B[Q]);
3952
3951
  cI(o, E, o, I);
@@ -3954,12 +3953,12 @@ function HQ({
3954
3953
  cI(a, i, a, -I);
3955
3954
  for (let s = 0; s < A; s++) {
3956
3955
  const h = s / A, t = C[Q * A + s] = f();
3957
- uC(t, E, o, a, i, h);
3956
+ pC(t, E, o, a, i, h);
3958
3957
  }
3959
3958
  }
3960
3959
  return C;
3961
3960
  }
3962
- function qQ(g) {
3961
+ function KQ(g) {
3963
3962
  if (g.length < 2)
3964
3963
  throw new Error("Path must contain at least 2 points");
3965
3964
  const A = Array(g.length), I = f(), B = f();
@@ -3969,7 +3968,7 @@ function qQ(g) {
3969
3968
  }
3970
3969
  return A;
3971
3970
  }
3972
- class pB extends bA {
3971
+ class lB extends bA {
3973
3972
  constructor(A, I, B, C) {
3974
3973
  super();
3975
3974
  const Q = [], E = [], i = B, o = C, a = i + 1, s = o + 1, h = A / i, t = I / o;
@@ -4020,7 +4019,7 @@ function mA(g) {
4020
4019
  return "float";
4021
4020
  throw new Error("Unsupported buffer type.");
4022
4021
  }
4023
- function lQ(g) {
4022
+ function HQ(g) {
4024
4023
  if (g.dataFormat === "rgb" || g.dataFormat === "rgba")
4025
4024
  return [0, 1];
4026
4025
  switch (g.dataType) {
@@ -4057,7 +4056,7 @@ class Fg extends yg {
4057
4056
  }
4058
4057
  const QB = 32;
4059
4058
  function $A(g, { visible: A, color: I, contrastLimits: B }) {
4060
- 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(
4059
+ return A === void 0 && (A = !0), I === void 0 ? I = l.WHITE : I = l.from(I), g !== null ? B = qQ(B, g) : B === void 0 && (U.debug(
4061
4060
  "Channel",
4062
4061
  "No texture provided, defaulting channel contrast limits to [0, 1]."
4063
4062
  ), B = [0, 1]), {
@@ -4066,7 +4065,7 @@ function $A(g, { visible: A, color: I, contrastLimits: B }) {
4066
4065
  contrastLimits: B
4067
4066
  };
4068
4067
  }
4069
- function JI(g, A) {
4068
+ function ig(g, A) {
4070
4069
  if (A.length > QB)
4071
4070
  throw new Error(`Maximum number of channels is ${QB}`);
4072
4071
  if (g?.type === "Texture2DArray") {
@@ -4078,9 +4077,9 @@ function JI(g, A) {
4078
4077
  }
4079
4078
  return A.map((I) => $A(g, I));
4080
4079
  }
4081
- function fQ(g, A) {
4080
+ function qQ(g, A) {
4082
4081
  if (g === void 0)
4083
- return lQ(A);
4082
+ return HQ(A);
4084
4083
  if (g[1] <= g[0])
4085
4084
  throw new Error(
4086
4085
  `Contrast limits must be strictly increasing: ${g}.`
@@ -4090,13 +4089,13 @@ function fQ(g, A) {
4090
4089
  class rg extends ZA {
4091
4090
  channels_;
4092
4091
  constructor(A, I, B, C = []) {
4093
- super(), this.geometry = new pB(A, I, 1, 1), this.setTexture(0, B), this.channels_ = JI(B, C), this.programName = pQ(B);
4092
+ super(), this.geometry = new lB(A, I, 1, 1), this.setTexture(0, B), this.channels_ = ig(B, C), this.programName = lQ(B);
4094
4093
  }
4095
4094
  get type() {
4096
4095
  return "ImageRenderable";
4097
4096
  }
4098
4097
  setChannelProps(A) {
4099
- this.channels_ = JI(this.textures[0], A);
4098
+ this.channels_ = ig(this.textures[0], A);
4100
4099
  }
4101
4100
  setChannelProperty(A, I, B) {
4102
4101
  const C = $A(this.textures[0], {
@@ -4135,14 +4134,14 @@ class rg extends ZA {
4135
4134
  }
4136
4135
  }
4137
4136
  }
4138
- function pQ(g) {
4137
+ function lQ(g) {
4139
4138
  if (g.type === "Texture2D")
4140
- return mQ(g.dataType);
4139
+ return fQ(g.dataType);
4141
4140
  if (g.type === "Texture2DArray")
4142
- return uQ(g.dataType);
4141
+ return pQ(g.dataType);
4143
4142
  throw new Error(`Unsupported image texture type: ${g.type}`);
4144
4143
  }
4145
- function mQ(g) {
4144
+ function fQ(g) {
4146
4145
  switch (g) {
4147
4146
  case "byte":
4148
4147
  case "int":
@@ -4156,7 +4155,7 @@ function mQ(g) {
4156
4155
  return "floatScalarImage";
4157
4156
  }
4158
4157
  }
4159
- function uQ(g) {
4158
+ function pQ(g) {
4160
4159
  switch (g) {
4161
4160
  case "byte":
4162
4161
  case "int":
@@ -4227,7 +4226,7 @@ function Sg(g, A, I, B, C = 3) {
4227
4226
  case "pointerup": {
4228
4227
  if (!A) return A;
4229
4228
  const Q = g.event, E = W(Q.clientX, Q.clientY);
4230
- if (jC(A, E) < C) {
4229
+ if (vC(A, E) < C) {
4231
4230
  if (!B) return null;
4232
4231
  const o = g.worldPos;
4233
4232
  if (o) {
@@ -4244,7 +4243,7 @@ function Sg(g, A, I, B, C = 3) {
4244
4243
  return A;
4245
4244
  }
4246
4245
  }
4247
- class mB {
4246
+ class fB {
4248
4247
  bins_ = /* @__PURE__ */ new Map();
4249
4248
  acquire(A) {
4250
4249
  const B = this.bins_.get(A)?.pop();
@@ -4259,13 +4258,13 @@ class mB {
4259
4258
  this.bins_.clear();
4260
4259
  }
4261
4260
  }
4262
- class uB extends FA {
4261
+ class pB extends FA {
4263
4262
  type = "ChunkedImageLayer";
4264
4263
  source_;
4265
4264
  sliceCoords_;
4266
4265
  onPickValue_;
4267
4266
  visibleChunks_ = /* @__PURE__ */ new Map();
4268
- pool_ = new mB();
4267
+ pool_ = new fB();
4269
4268
  initialChannelProps_;
4270
4269
  channelChangeCallbacks_ = [];
4271
4270
  policy_;
@@ -4335,7 +4334,7 @@ class uB extends FA {
4335
4334
  return this.lastPresentationTimeCoord_;
4336
4335
  }
4337
4336
  isPresentationStale() {
4338
- return this.lastPresentationTimeStamp_ === void 0 ? !1 : performance.now() - this.lastPresentationTimeStamp_ > uB.STALE_PRESENTATION_MS_;
4337
+ return this.lastPresentationTimeStamp_ === void 0 ? !1 : performance.now() - this.lastPresentationTimeStamp_ > pB.STALE_PRESENTATION_MS_;
4339
4338
  }
4340
4339
  resliceIfZChanged() {
4341
4340
  const A = this.sliceCoords_.z;
@@ -4378,7 +4377,7 @@ class uB extends FA {
4378
4377
  slicePlane(A, I) {
4379
4378
  if (!A.data) return;
4380
4379
  const B = (I - A.offset.z) / A.scale.z, C = Math.round(B), Q = cA(C, 0, A.shape.z - 1);
4381
- Eg(B, Q, 1 + 1e-6) || U.error("ImageLayer", "slicePlane zValue outside extent");
4380
+ Qg(B, Q, 1 + 1e-6) || U.error("ImageLayer", "slicePlane zValue outside extent");
4382
4381
  const E = A.shape.x * A.shape.y, i = E * Q;
4383
4382
  return A.data.slice(i, i + E);
4384
4383
  }
@@ -4424,7 +4423,7 @@ class uB extends FA {
4424
4423
  }
4425
4424
  getValueFromChunk(A, I, B) {
4426
4425
  if (!A.data) return null;
4427
- const C = TI(
4426
+ const C = uI(
4428
4427
  f(),
4429
4428
  B,
4430
4429
  I.transform.inverse
@@ -4479,7 +4478,7 @@ function EB(g) {
4479
4478
  `align${g.rowAlignmentBytes}`
4480
4479
  ].join(":");
4481
4480
  }
4482
- class TQ extends bA {
4481
+ class mQ extends bA {
4483
4482
  constructor(A, I, B, C, Q, E) {
4484
4483
  super();
4485
4484
  const i = [], o = [], a = Math.floor(C), s = Math.floor(Q), h = Math.floor(E);
@@ -4579,13 +4578,13 @@ class jA extends Fg {
4579
4578
  return B.unpackAlignment = A.rowAlignmentBytes, B;
4580
4579
  }
4581
4580
  }
4582
- class xQ extends ZA {
4581
+ class uQ extends ZA {
4583
4582
  voxelScale = q(1, 1, 1);
4584
4583
  channels_;
4585
4584
  channelToTextureIndex_ = /* @__PURE__ */ new Map();
4586
4585
  loadedChannels_ = /* @__PURE__ */ new Set();
4587
- constructor(A = []) {
4588
- super(), this.geometry = new TQ(1, 1, 1, 1, 1, 1), this.cullFaceMode = "front", this.depthTest = !1, this.channels_ = JI(null, A), this.programName = iB("float");
4586
+ constructor() {
4587
+ super(), this.geometry = new mQ(1, 1, 1, 1, 1, 1), this.cullFaceMode = "front", this.depthTest = !1, this.channels_ = [];
4589
4588
  }
4590
4589
  get type() {
4591
4590
  return "VolumeRenderable";
@@ -4596,7 +4595,13 @@ class xQ extends ZA {
4596
4595
  }
4597
4596
  addChannelTexture(A, I) {
4598
4597
  const B = jA.createWithChunk(I), C = this.textures.length;
4599
- this.setTexture(C, B), this.channelToTextureIndex_.set(A, C), this.programName = iB(B.dataType);
4598
+ this.setTexture(C, B), this.channelToTextureIndex_.set(A, C);
4599
+ const Q = TQ(B.dataType);
4600
+ if (this.programName && this.programName !== Q)
4601
+ throw new Error(
4602
+ `Volume renderable does not support multiple channels with different data types. Existing program: ${this.programName}, new channel data type: ${B.dataType} and program: ${Q}`
4603
+ );
4604
+ this.programName = Q;
4600
4605
  }
4601
4606
  updateChannelTexture(A, I) {
4602
4607
  const B = this.textures[A];
@@ -4663,7 +4668,7 @@ class xQ extends ZA {
4663
4668
  return I !== void 0 ? this.textures[I] : null;
4664
4669
  }
4665
4670
  setChannelProps(A) {
4666
- this.channels_ = JI(
4671
+ this.channels_ = ig(
4667
4672
  this.getAvailableChannelTexture(),
4668
4673
  A
4669
4674
  );
@@ -4679,7 +4684,7 @@ class xQ extends ZA {
4679
4684
  this.channels_[A] = C;
4680
4685
  }
4681
4686
  }
4682
- function iB(g) {
4687
+ function TQ(g) {
4683
4688
  switch (g) {
4684
4689
  case "byte":
4685
4690
  case "int":
@@ -4693,7 +4698,7 @@ function iB(g) {
4693
4698
  return "floatVolume";
4694
4699
  }
4695
4700
  }
4696
- function WQ(g, A) {
4701
+ function xQ(g, A) {
4697
4702
  const I = A.position, B = f(), C = f();
4698
4703
  return g.sort((Q, E) => {
4699
4704
  lA(B, Q.boundingBox.max, Q.boundingBox.min), fA(B, B, 0.5), lA(C, E.boundingBox.max, E.boundingBox.min), fA(C, C, 0.5);
@@ -4701,19 +4706,21 @@ function WQ(g, A) {
4701
4706
  return i - o;
4702
4707
  }), g;
4703
4708
  }
4704
- const bQ = 2;
4705
- class mo extends FA {
4709
+ const WQ = 2;
4710
+ class To extends FA {
4706
4711
  type = "VolumeLayer";
4707
4712
  source_;
4708
4713
  sliceCoords_;
4709
- currentChunks_ = /* @__PURE__ */ new Map();
4710
- pool_ = new mB();
4714
+ currentVolumes_ = /* @__PURE__ */ new Map();
4715
+ volumeToPoolKey_ = /* @__PURE__ */ new Map();
4716
+ pool_ = new fB();
4711
4717
  initialChannelProps_;
4712
4718
  channelChangeCallbacks_ = [];
4713
4719
  sourcePolicy_;
4714
4720
  chunkStoreView_;
4715
4721
  channelProps_;
4716
4722
  lastLoadedTime_ = void 0;
4723
+ lastNumRenderedChannelChunks_ = void 0;
4717
4724
  interactiveStepSizeScale_ = 1;
4718
4725
  // TODO: Make a debug config object to manage debug options
4719
4726
  debugShowWireframes_ = !1;
@@ -4725,9 +4732,11 @@ class mo extends FA {
4725
4732
  return this.debugShowWireframes_;
4726
4733
  }
4727
4734
  set debugShowWireframes(A) {
4728
- this.debugShowWireframes_ !== A && (this.currentVolumes().forEach((I) => {
4729
- I.wireframeEnabled = A;
4730
- }), this.debugShowWireframes_ = A);
4735
+ if (this.debugShowWireframes_ !== A) {
4736
+ for (const I of this.currentVolumes_.values())
4737
+ I.wireframeEnabled = A;
4738
+ this.debugShowWireframes_ = A;
4739
+ }
4731
4740
  }
4732
4741
  set sourcePolicy(A) {
4733
4742
  this.sourcePolicy_ !== A && (this.sourcePolicy_ = A, this.chunkStoreView_ && this.chunkStoreView_.setImageSourcePolicy(
@@ -4736,9 +4745,10 @@ class mo extends FA {
4736
4745
  ));
4737
4746
  }
4738
4747
  setChannelProps(A) {
4739
- this.channelProps_ = A, this.currentVolumes().forEach((I) => {
4748
+ this.channelProps_ = A;
4749
+ for (const I of this.currentVolumes_.values())
4740
4750
  I.setChannelProps(A);
4741
- }), this.channelChangeCallbacks_.forEach((I) => {
4751
+ this.channelChangeCallbacks_.forEach((I) => {
4742
4752
  I();
4743
4753
  });
4744
4754
  }
@@ -4757,20 +4767,19 @@ class mo extends FA {
4757
4767
  throw new Error(`Callback to remove could not be found: ${A}`);
4758
4768
  this.channelChangeCallbacks_.splice(I, 1);
4759
4769
  }
4760
- currentVolumes() {
4761
- return new Set(this.currentChunks_.values());
4762
- }
4763
4770
  constructor({ source: A, sliceCoords: I, policy: B, channelProps: C }) {
4764
4771
  super({ transparent: !0, blendMode: "premultiplied" }), this.source_ = A, this.sliceCoords_ = I, this.sourcePolicy_ = B, this.initialChannelProps_ = C, this.channelProps_ = C, this.setState("initialized");
4765
4772
  }
4766
- getVolumeForChunk(A) {
4767
- const I = this.currentChunks_.get(A);
4768
- if (I) return I;
4769
- for (const [C, Q] of this.currentChunks_)
4770
- if (C.chunkIndex.x === A.chunkIndex.x && C.chunkIndex.y === A.chunkIndex.y && C.chunkIndex.z === A.chunkIndex.z && C.chunkIndex.t === A.chunkIndex.t)
4771
- return Q.updateVolumeWithChunk(A), Q;
4772
- let B = this.pool_.acquire(oB(A));
4773
- return B && this.channelProps_ ? B.setChannelProps(this.channelProps_) : B = new xQ(this.channelProps_), B.updateVolumeWithChunk(A), this.updateVolumeTransform(B, A), B;
4773
+ getOrCreateVolume(A, I) {
4774
+ const B = this.currentVolumes_.get(A);
4775
+ if (B) {
4776
+ for (const E of I) B.updateVolumeWithChunk(E);
4777
+ return B;
4778
+ }
4779
+ const C = PQ(I[0]), Q = this.pool_.acquire(C) ?? new uQ();
4780
+ Q.setChannelProps(this.channelProps_ ?? []), this.volumeToPoolKey_.set(Q, C);
4781
+ for (const E of I) Q.updateVolumeWithChunk(E);
4782
+ return this.updateVolumeTransform(Q, I[0]), Q;
4774
4783
  }
4775
4784
  async onAttached(A) {
4776
4785
  this.chunkStoreView_ = await A.chunkManager.addView(
@@ -4779,25 +4788,21 @@ class mo extends FA {
4779
4788
  );
4780
4789
  }
4781
4790
  onDetached(A) {
4782
- this.chunkStoreView_ && (this.releaseAndRemoveChunks(this.currentChunks_.keys()), this.clearObjects(), this.chunkStoreView_.dispose(), this.chunkStoreView_ = void 0);
4791
+ this.chunkStoreView_ && (this.releaseAndRemoveVolumes(this.currentVolumes_.values()), this.clearObjects(), this.chunkStoreView_.dispose(), this.chunkStoreView_ = void 0);
4783
4792
  }
4784
4793
  updateChunks() {
4785
4794
  if (!this.chunkStoreView_) return;
4786
4795
  const A = this.chunkStoreView_.getChunksToRender(
4787
4796
  this.sliceCoords_
4788
- ), I = this.sliceCoords_.t ?? -1;
4789
- if (!(this.lastLoadedTime_ !== I || A.length !== this.currentChunks_.size)) return;
4790
- const C = new Set(A), Q = Array.from(this.currentChunks_.keys()).filter(
4791
- (E) => !C.has(E)
4792
- );
4793
- this.releaseAndRemoveChunks(Q), this.clearObjects();
4794
- for (const E of A) {
4795
- const i = this.getVolumeForChunk(E);
4796
- i.wireframeEnabled = this.debugShowWireframes, this.currentChunks_.set(E, i);
4797
+ ), I = this.sliceCoords_.t ?? -1, B = ZQ(A), C = this.lastLoadedTime_ !== I || B.size !== this.currentVolumes_.size || this.lastNumRenderedChannelChunks_ !== A.length;
4798
+ if (this.lastNumRenderedChannelChunks_ = A.length, !C) return;
4799
+ const Q = Array.from(this.currentVolumes_.entries()).filter(([E]) => !B.has(E)).map(([, E]) => E);
4800
+ this.releaseAndRemoveVolumes(Q), this.currentVolumes_.clear(), this.clearObjects();
4801
+ for (const [E, i] of B) {
4802
+ const o = this.getOrCreateVolume(E, i);
4803
+ o.wireframeEnabled = this.debugShowWireframes, this.currentVolumes_.set(E, o), this.addObject(o);
4797
4804
  }
4798
- this.currentVolumes().forEach((E) => {
4799
- this.addObject(E);
4800
- }), this.lastLoadedTime_ = I, this.state !== "ready" && this.setState("ready");
4805
+ this.lastLoadedTime_ = I, this.state !== "ready" && this.setState("ready");
4801
4806
  }
4802
4807
  updateVolumeTransform(A, I) {
4803
4808
  const B = {
@@ -4817,12 +4822,9 @@ class mo extends FA {
4817
4822
  I.offset.z + C.z
4818
4823
  ]);
4819
4824
  }
4820
- releaseAndRemoveChunks(A) {
4821
- const I = /* @__PURE__ */ new Set();
4822
- for (const B of A) {
4823
- const C = this.currentChunks_.get(B);
4824
- C && !I.has(C) && (C.clearLoadedChannels(), this.pool_.release(oB(B), C), I.add(C)), this.currentChunks_.delete(B);
4825
- }
4825
+ releaseAndRemoveVolumes(A) {
4826
+ for (const I of A)
4827
+ I.clearLoadedChannels(), this.pool_.release(this.volumeToPoolKey_.get(I), I), this.volumeToPoolKey_.delete(I);
4826
4828
  }
4827
4829
  update(A) {
4828
4830
  if (!this.chunkStoreView_) return;
@@ -4835,7 +4837,7 @@ class mo extends FA {
4835
4837
  A.viewport
4836
4838
  );
4837
4839
  const I = A.viewport.cameraControls?.isMoving ?? !1;
4838
- this.interactiveStepSizeScale_ = I ? bQ : 1, this.updateChunks(), WQ(this.objects, A.viewport.camera);
4840
+ this.interactiveStepSizeScale_ = I ? WQ : 1, this.updateChunks(), xQ(this.objects, A.viewport.camera);
4839
4841
  }
4840
4842
  getUniforms() {
4841
4843
  return {
@@ -4846,14 +4848,27 @@ class mo extends FA {
4846
4848
  };
4847
4849
  }
4848
4850
  }
4849
- function oB(g) {
4851
+ function bQ(g) {
4852
+ const { x: A, y: I, z: B, t: C } = g.chunkIndex;
4853
+ return `${A}:${I}:${B}:${C}`;
4854
+ }
4855
+ function ZQ(g) {
4856
+ const A = /* @__PURE__ */ new Map();
4857
+ for (const I of g) {
4858
+ const B = bQ(I);
4859
+ let C = A.get(B);
4860
+ C || (C = [], A.set(B, C)), C.push(I);
4861
+ }
4862
+ return A;
4863
+ }
4864
+ function PQ(g) {
4850
4865
  return [
4851
4866
  `lod${g.lod}`,
4852
4867
  `shape${g.shape.x}x${g.shape.y}x${g.shape.z}`,
4853
4868
  `align${g.rowAlignmentBytes}`
4854
4869
  ].join(":");
4855
4870
  }
4856
- class uo extends FA {
4871
+ class xo extends FA {
4857
4872
  type = "ImageLayer";
4858
4873
  source_;
4859
4874
  region_;
@@ -4944,7 +4959,7 @@ class uo extends FA {
4944
4959
  }
4945
4960
  getValueAtWorld(A) {
4946
4961
  if (!this.image_ || !this.chunk_?.data) return null;
4947
- const I = TI(
4962
+ const I = uI(
4948
4963
  f(),
4949
4964
  A,
4950
4965
  this.image_.transform.inverse
@@ -5000,7 +5015,7 @@ class AI extends Fg {
5000
5015
  return C.unpackAlignment = A.rowAlignmentBytes, C;
5001
5016
  }
5002
5017
  }
5003
- const ZQ = [
5018
+ const OQ = [
5004
5019
  [1, 0.5, 0.5],
5005
5020
  [0.5, 1, 0.5],
5006
5021
  [0.5, 0.5, 1],
@@ -5008,7 +5023,7 @@ const ZQ = [
5008
5023
  [1, 0.5, 1],
5009
5024
  [1, 1, 0.5]
5010
5025
  ];
5011
- function PQ(g) {
5026
+ function VQ(g) {
5012
5027
  return g = g ?? /* @__PURE__ */ new Map(), new Map(
5013
5028
  Array.from(g.entries()).map(([A, I]) => [
5014
5029
  A,
@@ -5016,37 +5031,37 @@ function PQ(g) {
5016
5031
  ])
5017
5032
  );
5018
5033
  }
5019
- function OQ(g) {
5020
- return g = g ?? ZQ, g.map(l.from);
5034
+ function vQ(g) {
5035
+ return g = g ?? OQ, g.map(l.from);
5021
5036
  }
5022
- class aB {
5037
+ class iB {
5023
5038
  lookupTable;
5024
5039
  cycle;
5025
5040
  constructor(A = {}) {
5026
- this.lookupTable = PQ(A.lookupTable), this.cycle = OQ(A.cycle);
5041
+ this.lookupTable = VQ(A.lookupTable), this.cycle = vQ(A.cycle);
5027
5042
  }
5028
5043
  }
5029
- const VQ = /* @__PURE__ */ new Set([
5044
+ const XQ = /* @__PURE__ */ new Set([
5030
5045
  "unsigned_byte",
5031
5046
  "unsigned_short",
5032
5047
  "unsigned_int"
5033
5048
  ]);
5034
- function vQ(g) {
5049
+ function jQ(g) {
5035
5050
  if (g.dataFormat !== "scalar")
5036
5051
  throw new Error(
5037
5052
  `Image data format must be scalar, instead found: ${g.dataFormat}`
5038
5053
  );
5039
- if (!VQ.has(g.dataType))
5054
+ if (!XQ.has(g.dataType))
5040
5055
  throw new Error(
5041
5056
  `Image data type must be unsigned, instead found: ${g.dataType}`
5042
5057
  );
5043
5058
  return g;
5044
5059
  }
5045
- class XQ extends ZA {
5060
+ class zQ extends ZA {
5046
5061
  outlineSelected_;
5047
5062
  selectedValue_;
5048
5063
  constructor(A) {
5049
- super(), this.geometry = new pB(A.width, A.height, 1, 1), this.setTexture(0, vQ(A.imageData));
5064
+ super(), this.geometry = new lB(A.width, A.height, 1, 1), this.setTexture(0, jQ(A.imageData));
5050
5065
  const I = this.makeColorCycleTexture(A.colorMap.cycle);
5051
5066
  this.setTexture(1, I);
5052
5067
  const B = this.makeColorLookupTableTexture(
@@ -5084,7 +5099,7 @@ class XQ extends ZA {
5084
5099
  return Q.set(I, 0), Q.set(B, C), new AI(Q, C, 2);
5085
5100
  }
5086
5101
  }
5087
- class To extends FA {
5102
+ class Wo extends FA {
5088
5103
  type = "LabelImageLayer";
5089
5104
  source_;
5090
5105
  region_;
@@ -5105,7 +5120,7 @@ class To extends FA {
5105
5120
  outlineSelected: E = !1,
5106
5121
  ...i
5107
5122
  }) {
5108
- super(i), this.setState("initialized"), this.source_ = A, this.region_ = I, this.colorMap_ = new aB(B), this.onPickValue_ = C, this.lod_ = Q, this.outlineSelected_ = E;
5123
+ super(i), this.setState("initialized"), this.source_ = A, this.region_ = I, this.colorMap_ = new iB(B), this.onPickValue_ = C, this.lod_ = Q, this.outlineSelected_ = E;
5109
5124
  }
5110
5125
  update() {
5111
5126
  switch (this.state) {
@@ -5125,7 +5140,7 @@ class To extends FA {
5125
5140
  return this.colorMap_;
5126
5141
  }
5127
5142
  setColorMap(A) {
5128
- this.colorMap_ = new aB(A), this.image_ && this.image_.setColorMap(this.colorMap_);
5143
+ this.colorMap_ = new iB(A), this.image_ && this.image_.setColorMap(this.colorMap_);
5129
5144
  }
5130
5145
  setSelectedValue(A) {
5131
5146
  this.selectedValue_ = A, this.image_ && this.image_.setSelectedValue(this.selectedValue_);
@@ -5149,7 +5164,7 @@ class To extends FA {
5149
5164
  }
5150
5165
  createImage(A) {
5151
5166
  this.imageChunk_ = A;
5152
- const I = new XQ({
5167
+ const I = new zQ({
5153
5168
  width: A.shape.x,
5154
5169
  height: A.shape.y,
5155
5170
  imageData: AI.createWithChunk(A),
@@ -5162,7 +5177,7 @@ class To extends FA {
5162
5177
  getValueAtWorld(A) {
5163
5178
  if (!this.image_ || !this.imageChunk_?.data)
5164
5179
  return null;
5165
- const I = TI(
5180
+ const I = uI(
5166
5181
  f(),
5167
5182
  A,
5168
5183
  this.image_.transform.inverse
@@ -5173,12 +5188,12 @@ class To extends FA {
5173
5188
  return this.imageChunk_.data[Q];
5174
5189
  }
5175
5190
  }
5176
- class xI extends Error {
5191
+ class TI extends Error {
5177
5192
  constructor(A) {
5178
- super(A), this.name = "AbortError", Object.setPrototypeOf(this, xI.prototype);
5193
+ super(A), this.name = "AbortError", Object.setPrototypeOf(this, TI.prototype);
5179
5194
  }
5180
5195
  }
5181
- class jQ {
5196
+ class _Q {
5182
5197
  maxConcurrent_;
5183
5198
  pending_ = [];
5184
5199
  abortController_ = new AbortController();
@@ -5213,7 +5228,7 @@ class jQ {
5213
5228
  return this.abortController_.signal;
5214
5229
  }
5215
5230
  shutdown() {
5216
- this.abortController_.abort(new xI("shutdown"));
5231
+ this.abortController_.abort(new TI("shutdown"));
5217
5232
  }
5218
5233
  get numRunning() {
5219
5234
  return this.numRunning_;
@@ -5222,12 +5237,12 @@ class jQ {
5222
5237
  return this.pending_.length;
5223
5238
  }
5224
5239
  }
5225
- class zQ {
5240
+ class $Q {
5226
5241
  source_;
5227
5242
  region_;
5228
5243
  seriesDimensionName_;
5229
5244
  seriesIndex_;
5230
- scheduler_ = new jQ(16);
5245
+ scheduler_ = new _Q(16);
5231
5246
  lod_;
5232
5247
  loader_ = null;
5233
5248
  seriesAttributes_;
@@ -5328,7 +5343,7 @@ class zQ {
5328
5343
  const B = await Promise.allSettled(I);
5329
5344
  for (const C of B)
5330
5345
  if (C.status === "rejected") {
5331
- if (C.reason instanceof xI)
5346
+ if (C.reason instanceof TI)
5332
5347
  return Promise.reject(C.reason);
5333
5348
  U.error(
5334
5349
  "ImageSeriesLoader",
@@ -5340,7 +5355,7 @@ class zQ {
5340
5355
  return this.loader_ ??= await this.source_.open(), this.loader_;
5341
5356
  }
5342
5357
  }
5343
- class xo extends FA {
5358
+ class bo extends FA {
5344
5359
  type = "ImageSeriesLayer";
5345
5360
  seriesLoader_;
5346
5361
  initialChannelProps_;
@@ -5357,7 +5372,7 @@ class xo extends FA {
5357
5372
  lod: Q,
5358
5373
  ...E
5359
5374
  }) {
5360
- super(E), this.setState("initialized"), this.channelProps_ = C, this.initialChannelProps_ = C, this.seriesLoader_ = new zQ({
5375
+ super(E), this.setState("initialized"), this.channelProps_ = C, this.initialChannelProps_ = C, this.seriesLoader_ = new $Q({
5361
5376
  source: A,
5362
5377
  region: I,
5363
5378
  seriesDimensionName: B,
@@ -5423,7 +5438,7 @@ class xo extends FA {
5423
5438
  return C.transform.setScale([A.scale.x, A.scale.y, 1]), C.transform.setTranslation([A.offset.x, A.offset.y, 0]), C;
5424
5439
  }
5425
5440
  }
5426
- function TB(g, A, I, B = {}) {
5441
+ function mB(g, A, I, B = {}) {
5427
5442
  return A !== void 0 && I !== void 0 && (B = {
5428
5443
  ...B,
5429
5444
  headers: {
@@ -5432,7 +5447,7 @@ function TB(g, A, I, B = {}) {
5432
5447
  }
5433
5448
  }), fetch(g, B);
5434
5449
  }
5435
- function _Q(g, A) {
5450
+ function AE(g, A) {
5436
5451
  return {
5437
5452
  ...g,
5438
5453
  ...A,
@@ -5442,20 +5457,20 @@ function _Q(g, A) {
5442
5457
  }
5443
5458
  };
5444
5459
  }
5445
- function sB(g, A) {
5460
+ function oB(g, A) {
5446
5461
  const I = typeof g == "string" ? new URL(g) : g;
5447
5462
  I.pathname.endsWith("/") || (I.pathname += "/");
5448
5463
  const B = new URL(A.slice(1), I);
5449
5464
  return B.search = I.search, B;
5450
5465
  }
5451
- async function DB(g) {
5466
+ async function aB(g) {
5452
5467
  if (g.status !== 404) {
5453
5468
  if (g.status === 200 || g.status === 206)
5454
5469
  return new Uint8Array(await g.arrayBuffer());
5455
5470
  throw new Error(`Unexpected response status ${g.status} ${g.statusText}`);
5456
5471
  }
5457
5472
  }
5458
- async function $Q(g, A, I, B) {
5473
+ async function IE(g, A, I, B) {
5459
5474
  if (B)
5460
5475
  return fetch(g, {
5461
5476
  ...I,
@@ -5465,7 +5480,7 @@ async function $Q(g, A, I, B) {
5465
5480
  if (!C.ok)
5466
5481
  return C;
5467
5482
  let Q = C.headers.get("Content-Length"), E = Number(Q);
5468
- return TB(g, E - A, E, I);
5483
+ return mB(g, E - A, E, I);
5469
5484
  }
5470
5485
  class PA {
5471
5486
  url;
@@ -5475,18 +5490,18 @@ class PA {
5475
5490
  this.url = A, this.#A = I.overrides ?? {}, this.#I = I.useSuffixRequest ?? !1;
5476
5491
  }
5477
5492
  #g(A) {
5478
- return _Q(this.#A, A);
5493
+ return AE(this.#A, A);
5479
5494
  }
5480
5495
  async get(A, I = {}) {
5481
- let B = sB(this.url, A).href, C = await fetch(B, this.#g(I));
5482
- return DB(C);
5496
+ let B = oB(this.url, A).href, C = await fetch(B, this.#g(I));
5497
+ return aB(C);
5483
5498
  }
5484
5499
  async getRange(A, I, B = {}) {
5485
- let C = sB(this.url, A), Q = this.#g(B), E;
5486
- return "suffixLength" in I ? E = await $Q(C, I.suffixLength, Q, this.#I) : E = await TB(C, I.offset, I.length, Q), DB(E);
5500
+ let C = oB(this.url, A), Q = this.#g(B), E;
5501
+ return "suffixLength" in I ? E = await IE(C, I.suffixLength, Q, this.#I) : E = await mB(C, I.offset, I.length, Q), aB(E);
5487
5502
  }
5488
5503
  }
5489
- class xB {
5504
+ class uB {
5490
5505
  #A;
5491
5506
  constructor(A, I, B) {
5492
5507
  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));
@@ -5629,14 +5644,14 @@ function GI(g) {
5629
5644
  const A = new TextDecoder().decode(g);
5630
5645
  return JSON.parse(A);
5631
5646
  }
5632
- function hB(g, A) {
5647
+ function sB(g, A) {
5633
5648
  const I = A / 2, B = A - 1;
5634
5649
  let C = 0;
5635
5650
  for (let Q = 0; Q < g.length; Q += A)
5636
5651
  for (let E = 0; E < I; E += 1)
5637
5652
  C = g[Q + E], g[Q + E] = g[Q + B - E], g[Q + B - E] = C;
5638
5653
  }
5639
- function WB(g) {
5654
+ function TB(g) {
5640
5655
  if (g === "v2:object")
5641
5656
  return globalThis.Array;
5642
5657
  let A = g.match(/v2:([US])(\d+)/);
@@ -5656,7 +5671,7 @@ function WB(g) {
5656
5671
  float16: globalThis.Float16Array,
5657
5672
  float32: Float32Array,
5658
5673
  float64: Float64Array,
5659
- bool: xB
5674
+ bool: uB
5660
5675
  }[g];
5661
5676
  return x(I, `Unknown or unsupported data_type: ${g}`), I;
5662
5677
  }
@@ -5668,7 +5683,7 @@ function UA(g, A) {
5668
5683
  C[A[Q]] = B, B *= g[A[Q]];
5669
5684
  return C;
5670
5685
  }
5671
- function AE({ name: g, configuration: A }) {
5686
+ function gE({ name: g, configuration: A }) {
5672
5687
  if (g === "default") {
5673
5688
  const I = A?.separator ?? "/";
5674
5689
  return (B) => ["c", ...B].join(I);
@@ -5679,7 +5694,7 @@ function AE({ name: g, configuration: A }) {
5679
5694
  }
5680
5695
  throw new Error(`Unknown chunk key encoding: ${g}`);
5681
5696
  }
5682
- function IE(g) {
5697
+ function BE(g) {
5683
5698
  if (g === "|O")
5684
5699
  return { data_type: "v2:object" };
5685
5700
  let A = g.match(/^([<|>])(.*)$/);
@@ -5700,8 +5715,8 @@ function IE(g) {
5700
5715
  }[B] ?? (B.startsWith("S") || B.startsWith("U") ? `v2:${B}` : void 0);
5701
5716
  return x(C, `Unsupported or unknown dtype: ${g}`), I === "|" ? { data_type: C } : { data_type: C, endian: I === "<" ? "little" : "big" };
5702
5717
  }
5703
- function gE(g, A = {}) {
5704
- let I = [], B = IE(g.dtype);
5718
+ function CE(g, A = {}) {
5719
+ let I = [], B = BE(g.dtype);
5705
5720
  g.order === "F" && I.push({ name: "transpose", configuration: { order: "F" } }), "endian" in B && B.endian === "big" && I.push({ name: "bytes", configuration: { endian: "big" } });
5706
5721
  for (let { id: C, ...Q } of g.filters ?? [])
5707
5722
  I.push({ name: C, configuration: Q });
@@ -5731,14 +5746,14 @@ function gE(g, A = {}) {
5731
5746
  attributes: A
5732
5747
  };
5733
5748
  }
5734
- function BE(g, A = {}) {
5749
+ function QE(g, A = {}) {
5735
5750
  return {
5736
5751
  zarr_format: 3,
5737
5752
  node_type: "group",
5738
5753
  attributes: A
5739
5754
  };
5740
5755
  }
5741
- function CE(g, A) {
5756
+ function EE(g, A) {
5742
5757
  if (A !== "number" && A !== "bigint" && A !== "boolean" && A !== "object" && A !== "string")
5743
5758
  return g === A;
5744
5759
  let I = g === "bool";
@@ -5753,13 +5768,13 @@ function CE(g, A) {
5753
5768
  let Q = g === "v2:object";
5754
5769
  return A === "object" ? Q : !B && !C && !I && !Q;
5755
5770
  }
5756
- function QE(g) {
5771
+ function iE(g) {
5757
5772
  return g?.name === "sharding_indexed";
5758
5773
  }
5759
- function bB(g) {
5774
+ function xB(g) {
5760
5775
  return (g.data_type === "uint64" || g.data_type === "int64") && g.fill_value != null ? BigInt(g.fill_value) : g.fill_value;
5761
5776
  }
5762
- function ZB(g, ...A) {
5777
+ function WB(g, ...A) {
5763
5778
  if (!A.some((I) => g instanceof I))
5764
5779
  throw g;
5765
5780
  }
@@ -5767,7 +5782,7 @@ function x(g, A = "") {
5767
5782
  if (!g)
5768
5783
  throw new Error(A);
5769
5784
  }
5770
- async function PB(g, { format: A, signal: I }) {
5785
+ async function bB(g, { format: A, signal: I }) {
5771
5786
  const B = g instanceof Response ? g : new Response(g);
5772
5787
  x(B.body, "Response does not contain body.");
5773
5788
  try {
@@ -5800,15 +5815,15 @@ class Ng {
5800
5815
  return A;
5801
5816
  }
5802
5817
  }
5803
- const tB = EE();
5804
- function EE() {
5818
+ const DB = oE();
5819
+ function oE() {
5805
5820
  const g = new Uint32Array([305419896]);
5806
5821
  return new Uint8Array(g.buffer, g.byteOffset, g.byteLength)[0] !== 18;
5807
5822
  }
5808
- function yB(g) {
5823
+ function hB(g) {
5809
5824
  return "BYTES_PER_ELEMENT" in g ? g.BYTES_PER_ELEMENT : 4;
5810
5825
  }
5811
- class WI {
5826
+ class xI {
5812
5827
  kind = "array_to_bytes";
5813
5828
  #A;
5814
5829
  #I;
@@ -5816,19 +5831,19 @@ class WI {
5816
5831
  #C;
5817
5832
  #B;
5818
5833
  constructor(A, I) {
5819
- this.#B = A?.endian, this.#I = WB(I.data_type), this.#C = I.shape, this.#A = UA(I.shape, "C");
5834
+ this.#B = A?.endian, this.#I = TB(I.data_type), this.#C = I.shape, this.#A = UA(I.shape, "C");
5820
5835
  const B = new this.#I(0);
5821
5836
  this.#g = B.BYTES_PER_ELEMENT;
5822
5837
  }
5823
5838
  static fromConfig(A, I) {
5824
- return new WI(A, I);
5839
+ return new xI(A, I);
5825
5840
  }
5826
5841
  encode(A) {
5827
5842
  let I = new Uint8Array(A.data.buffer);
5828
- return tB && this.#B === "big" && hB(I, yB(this.#I)), I;
5843
+ return DB && this.#B === "big" && sB(I, hB(this.#I)), I;
5829
5844
  }
5830
5845
  decode(A) {
5831
- return tB && this.#B === "big" && hB(A, yB(this.#I)), {
5846
+ return DB && this.#B === "big" && sB(A, hB(this.#I)), {
5832
5847
  data: new this.#I(A.buffer, A.byteOffset, A.byteLength / this.#g),
5833
5848
  shape: this.#C,
5834
5849
  stride: this.#A
@@ -5856,14 +5871,14 @@ class Ug {
5856
5871
  throw new Error("Gzip encoding is not enabled by default. Please register a custom codec with `numcodecs/gzip`.");
5857
5872
  }
5858
5873
  async decode(A) {
5859
- const I = await PB(A, { format: "gzip" });
5874
+ const I = await bB(A, { format: "gzip" });
5860
5875
  return new Uint8Array(I);
5861
5876
  }
5862
5877
  }
5863
- function iE(g, A) {
5878
+ function aE(g, A) {
5864
5879
  return x(!Number.isNaN(A), "JsonCodec allow_nan is false but NaN was encountered during encoding."), x(A !== Number.POSITIVE_INFINITY, "JsonCodec allow_nan is false but Infinity was encountered during encoding."), x(A !== Number.NEGATIVE_INFINITY, "JsonCodec allow_nan is false but -Infinity was encountered during encoding."), A;
5865
5880
  }
5866
- function oE(g, A) {
5881
+ function sE(g, A) {
5867
5882
  return A instanceof Object && !Array.isArray(A) ? Object.keys(A).sort().reduce((I, B) => (I[B] = A[B], I), {}) : A;
5868
5883
  }
5869
5884
  class kg {
@@ -5893,7 +5908,7 @@ class kg {
5893
5908
  const { indent: I, encoding: B, ensure_ascii: C, check_circular: Q, allow_nan: E, sort_keys: i } = this.#A;
5894
5909
  x(B === "utf-8", "JsonCodec does not yet support non-utf-8 encoding.");
5895
5910
  const o = [];
5896
- x(Q, "JsonCodec does not yet support skipping the check for circular references during encoding."), E || o.push(iE), i && o.push(oE);
5911
+ x(Q, "JsonCodec does not yet support skipping the check for circular references during encoding."), E || o.push(aE), i && o.push(sE);
5897
5912
  const a = Array.from(A.data);
5898
5913
  a.push("|O"), a.push(A.shape);
5899
5914
  let s;
@@ -5918,8 +5933,8 @@ class kg {
5918
5933
  return { data: B, shape: C, stride: Q };
5919
5934
  }
5920
5935
  }
5921
- function eB(g) {
5922
- return g instanceof xB || g instanceof Rg || g instanceof eI ? new Proxy(g, {
5936
+ function tB(g) {
5937
+ return g instanceof uB || g instanceof Rg || g instanceof eI ? new Proxy(g, {
5923
5938
  get(I, B) {
5924
5939
  return I.get(Number(B));
5925
5940
  },
@@ -5928,7 +5943,7 @@ function eB(g) {
5928
5943
  }
5929
5944
  }) : g;
5930
5945
  }
5931
- function aE(g, A) {
5946
+ function DE(g, A) {
5932
5947
  let I;
5933
5948
  return g.data instanceof Rg || g.data instanceof eI ? I = new g.constructor(
5934
5949
  // @ts-expect-error
@@ -5940,8 +5955,8 @@ function aE(g, A) {
5940
5955
  stride: UA(g.shape, A)
5941
5956
  };
5942
5957
  }
5943
- function sE(g, A) {
5944
- let I = aE(g, A), B = g.shape.length, C = g.data.length, Q = Array(B).fill(0), E = eB(g.data), i = eB(I.data);
5958
+ function hE(g, A) {
5959
+ let I = DE(g, A), B = g.shape.length, C = g.data.length, Q = Array(B).fill(0), E = tB(g.data), i = tB(I.data);
5945
5960
  for (let o = 0; o < C; o++) {
5946
5961
  let a = 0;
5947
5962
  for (let s = 0; s < B; s++)
@@ -5956,12 +5971,12 @@ function sE(g, A) {
5956
5971
  }
5957
5972
  return I;
5958
5973
  }
5959
- function DE(g) {
5974
+ function tE(g) {
5960
5975
  let A = g.shape.length;
5961
5976
  return x(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);
5962
5977
  }
5963
- function hE(g, A) {
5964
- let I = DE(g);
5978
+ function yE(g, A) {
5979
+ let I = tE(g);
5965
5980
  return x(I.length === A.length, "Orders must match"), I.every((B, C) => B === A[C]);
5966
5981
  }
5967
5982
  class Lg {
@@ -5986,7 +6001,7 @@ class Lg {
5986
6001
  return new Lg(A, I);
5987
6002
  }
5988
6003
  encode(A) {
5989
- return hE(A, this.#I) ? A : sE(A, this.#I);
6004
+ return yE(A, this.#I) ? A : hE(A, this.#I);
5990
6005
  }
5991
6006
  decode(A) {
5992
6007
  return {
@@ -6027,19 +6042,19 @@ class Yg {
6027
6042
  throw new Error("Zlib encoding is not enabled by default. Please register a codec with `numcodecs/zlib`.");
6028
6043
  }
6029
6044
  async decode(A) {
6030
- const I = await PB(A, { format: "deflate" });
6045
+ const I = await bB(A, { format: "deflate" });
6031
6046
  return new Uint8Array(I);
6032
6047
  }
6033
6048
  }
6034
- function tE() {
6035
- 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", () => WI).set("crc32c", () => cg).set("vlen-utf8", () => Jg).set("json2", () => kg).set("bitround", () => Ng);
6049
+ function eE() {
6050
+ 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);
6036
6051
  }
6037
- const yE = tE();
6052
+ const GE = eE();
6038
6053
  function og(g) {
6039
6054
  let A;
6040
6055
  return {
6041
6056
  async encode(I) {
6042
- A || (A = await GB(g));
6057
+ A || (A = await yB(g));
6043
6058
  for (const C of A.array_to_array)
6044
6059
  I = await C.encode(I);
6045
6060
  let B = await A.array_to_bytes.encode(I);
@@ -6048,7 +6063,7 @@ function og(g) {
6048
6063
  return B;
6049
6064
  },
6050
6065
  async decode(I) {
6051
- A || (A = await GB(g));
6066
+ A || (A = await yB(g));
6052
6067
  for (let C = A.bytes_to_bytes.length - 1; C >= 0; C--)
6053
6068
  I = await A.bytes_to_bytes[C].decode(I);
6054
6069
  let B = await A.array_to_bytes.decode(I);
@@ -6058,9 +6073,9 @@ function og(g) {
6058
6073
  }
6059
6074
  };
6060
6075
  }
6061
- async function GB(g) {
6076
+ async function yB(g) {
6062
6077
  let A = g.codecs.map(async (Q) => {
6063
- let E = await yE.get(Q.name)?.();
6078
+ let E = await GE.get(Q.name)?.();
6064
6079
  return x(E, `Unknown codec: ${Q.name}`), { Codec: E, meta: Q };
6065
6080
  }), I = [], B, C = [];
6066
6081
  for await (let { Codec: Q, meta: E } of A) {
@@ -6076,9 +6091,9 @@ async function GB(g) {
6076
6091
  C.push(i);
6077
6092
  }
6078
6093
  }
6079
- return B || (x(eE(g), `Cannot encode ${g.data_type} to bytes without a codec`), B = WI.fromConfig({ endian: "little" }, g)), { array_to_array: I, array_to_bytes: B, bytes_to_bytes: C };
6094
+ return B || (x(nE(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 };
6080
6095
  }
6081
- function eE(g) {
6096
+ function nE(g) {
6082
6097
  return g.data_type !== "v2:object";
6083
6098
  }
6084
6099
  class nI extends Error {
@@ -6091,8 +6106,8 @@ class dg extends Error {
6091
6106
  super(`Missing key: ${A}`), this.name = "KeyError";
6092
6107
  }
6093
6108
  }
6094
- const nB = 18446744073709551615n;
6095
- function GE(g, A, I, B) {
6109
+ const eB = 18446744073709551615n;
6110
+ function wE(g, A, I, B) {
6096
6111
  x(g.store.getRange, "Store does not support range requests");
6097
6112
  let C = g.store.getRange.bind(g.store), Q = A.map((o, a) => o / B.chunk_shape[a]), E = og({
6098
6113
  data_type: "uint64",
@@ -6112,7 +6127,7 @@ function GE(g, A, I, B) {
6112
6127
  if (h === null)
6113
6128
  return;
6114
6129
  let { data: t, shape: y, stride: n } = h, w = o.map((c, N) => c % y[N]).reduce((c, N, d) => c + N * n[d], 0), r = t[w], G = t[w + 1];
6115
- if (!(r === nB && G === nB))
6130
+ if (!(r === eB && G === eB))
6116
6131
  return C(s, {
6117
6132
  offset: Number(r),
6118
6133
  length: Number(G)
@@ -6140,21 +6155,21 @@ class Mg extends z {
6140
6155
  return this.#A.attributes;
6141
6156
  }
6142
6157
  }
6143
- function wB(g) {
6158
+ function GB(g) {
6144
6159
  return g.find((I) => I.name === "transpose")?.configuration?.order ?? "C";
6145
6160
  }
6146
6161
  const OA = Symbol("zarrita.context");
6147
- function nE(g) {
6162
+ function FE(g) {
6148
6163
  return g[OA];
6149
6164
  }
6150
- function wE(g, A) {
6151
- let { configuration: I } = A.codecs.find(QE) ?? {}, B = {
6152
- encode_chunk_key: AE(A.chunk_key_encoding),
6153
- TypedArray: WB(A.data_type),
6165
+ function rE(g, A) {
6166
+ let { configuration: I } = A.codecs.find(iE) ?? {}, B = {
6167
+ encode_chunk_key: gE(A.chunk_key_encoding),
6168
+ TypedArray: TB(A.data_type),
6154
6169
  fill_value: A.fill_value
6155
6170
  };
6156
6171
  if (I) {
6157
- let Q = wB(I.codecs);
6172
+ let Q = GB(I.codecs);
6158
6173
  return {
6159
6174
  ...B,
6160
6175
  kind: "sharded",
@@ -6167,10 +6182,10 @@ function wE(g, A) {
6167
6182
  get_strides(E) {
6168
6183
  return UA(E, Q);
6169
6184
  },
6170
- get_chunk_bytes: GE(g, A.chunk_grid.configuration.chunk_shape, B.encode_chunk_key, I)
6185
+ get_chunk_bytes: wE(g, A.chunk_grid.configuration.chunk_shape, B.encode_chunk_key, I)
6171
6186
  };
6172
6187
  }
6173
- let C = wB(A.codecs);
6188
+ let C = GB(A.codecs);
6174
6189
  return {
6175
6190
  ...B,
6176
6191
  kind: "regular",
@@ -6189,15 +6204,15 @@ function wE(g, A) {
6189
6204
  }
6190
6205
  };
6191
6206
  }
6192
- let YI = class extends z {
6207
+ let JI = class extends z {
6193
6208
  kind = "array";
6194
6209
  #A;
6195
6210
  [OA];
6196
6211
  constructor(A, I, B) {
6197
6212
  super(A, I), this.#A = {
6198
6213
  ...B,
6199
- fill_value: bB(B)
6200
- }, this[OA] = wE(this, B);
6214
+ fill_value: xB(B)
6215
+ }, this[OA] = rE(this, B);
6201
6216
  }
6202
6217
  get attrs() {
6203
6218
  return this.#A.attributes;
@@ -6241,15 +6256,15 @@ let YI = class extends z {
6241
6256
  * ```
6242
6257
  */
6243
6258
  is(A) {
6244
- return CE(this.dtype, A);
6259
+ return EE(this.dtype, A);
6245
6260
  }
6246
6261
  };
6247
- function* FE(g, A, I = 1) {
6262
+ function* SE(g, A, I = 1) {
6248
6263
  A === void 0 && (A = g, g = 0);
6249
6264
  for (let B = g; B < A; B += I)
6250
6265
  yield B;
6251
6266
  }
6252
- function* rE(...g) {
6267
+ function* RE(...g) {
6253
6268
  if (g.length === 0)
6254
6269
  return;
6255
6270
  const A = g.map((B) => B[Symbol.iterator]()), I = A.map((B) => B.next());
@@ -6264,21 +6279,21 @@ function* rE(...g) {
6264
6279
  I[B] = A[B].next();
6265
6280
  }
6266
6281
  }
6267
- function SE({ start: g, stop: A, step: I }, B) {
6282
+ function NE({ start: g, stop: A, step: I }, B) {
6268
6283
  if (I === 0)
6269
6284
  throw new Error("slice step cannot be zero");
6270
6285
  I = I ?? 1;
6271
6286
  const C = I < 0, [Q, E] = C ? [-1, B - 1] : [0, B];
6272
6287
  return g === null ? g = C ? E : Q : g < 0 ? (g += B, g < Q && (g = Q)) : g > E && (g = E), A === null ? A = C ? Q : E : A < 0 ? (A += B, A < Q && (A = Q)) : A > E && (A = E), [g, A, I];
6273
6288
  }
6274
- function dI(g, A, I = null) {
6289
+ function YI(g, A, I = null) {
6275
6290
  return A === void 0 && (A = g, g = null), {
6276
6291
  start: g,
6277
6292
  stop: A,
6278
6293
  step: I
6279
6294
  };
6280
6295
  }
6281
- function RE() {
6296
+ function cE() {
6282
6297
  const g = [];
6283
6298
  return {
6284
6299
  add: (A) => g.push(A()),
@@ -6290,35 +6305,35 @@ class Kg extends Error {
6290
6305
  super(A), this.name = "IndexError";
6291
6306
  }
6292
6307
  }
6293
- function NE(g, A) {
6308
+ function UE(g, A) {
6294
6309
  throw new Kg(`too many indicies for array; expected ${A.length}, got ${g.length}`);
6295
6310
  }
6296
- function cE(g) {
6311
+ function kE(g) {
6297
6312
  throw new Kg(`index out of bounds for dimension with length ${g}`);
6298
6313
  }
6299
- function UE() {
6314
+ function LE() {
6300
6315
  throw new Kg("only slices with step >= 1 are supported");
6301
6316
  }
6302
- function kE(g, A) {
6303
- g.length > A.length && NE(g, A);
6317
+ function JE(g, A) {
6318
+ g.length > A.length && UE(g, A);
6304
6319
  }
6305
- function LE(g, A) {
6306
- return g = Math.trunc(g), g < 0 && (g = A + g), (g >= A || g < 0) && cE(A), g;
6320
+ function YE(g, A) {
6321
+ return g = Math.trunc(g), g < 0 && (g = A + g), (g >= A || g < 0) && kE(A), g;
6307
6322
  }
6308
- class JE {
6323
+ class dE {
6309
6324
  dim_sel;
6310
6325
  dim_len;
6311
6326
  dim_chunk_len;
6312
6327
  nitems;
6313
6328
  constructor({ dim_sel: A, dim_len: I, dim_chunk_len: B }) {
6314
- A = LE(A, I), this.dim_sel = A, this.dim_len = I, this.dim_chunk_len = B, this.nitems = 1;
6329
+ A = YE(A, I), this.dim_sel = A, this.dim_len = I, this.dim_chunk_len = B, this.nitems = 1;
6315
6330
  }
6316
6331
  *[Symbol.iterator]() {
6317
6332
  const A = Math.floor(this.dim_sel / this.dim_chunk_len), I = A * this.dim_chunk_len, B = this.dim_sel - I;
6318
6333
  yield { dim_chunk_ix: A, dim_chunk_sel: B };
6319
6334
  }
6320
6335
  }
6321
- class FB {
6336
+ class nB {
6322
6337
  start;
6323
6338
  stop;
6324
6339
  step;
@@ -6327,12 +6342,12 @@ class FB {
6327
6342
  nitems;
6328
6343
  nchunks;
6329
6344
  constructor({ dim_sel: A, dim_len: I, dim_chunk_len: B }) {
6330
- const [C, Q, E] = SE(A, I);
6331
- this.start = C, this.stop = Q, this.step = E, this.step < 1 && UE(), 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);
6345
+ const [C, Q, E] = NE(A, I);
6346
+ this.start = C, this.stop = Q, this.step = E, this.step < 1 && LE(), 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);
6332
6347
  }
6333
6348
  *[Symbol.iterator]() {
6334
6349
  const A = Math.floor(this.start / this.dim_chunk_len), I = Math.ceil(this.stop / this.dim_chunk_len);
6335
- for (const B of FE(A, I)) {
6350
+ for (const B of SE(A, I)) {
6336
6351
  const C = B * this.dim_chunk_len, Q = Math.min(this.dim_len, (B + 1) * this.dim_chunk_len), E = Q - C;
6337
6352
  let i = 0, o = 0;
6338
6353
  if (this.start < C) {
@@ -6353,43 +6368,43 @@ class FB {
6353
6368
  }
6354
6369
  }
6355
6370
  }
6356
- function YE(g, A) {
6371
+ function ME(g, A) {
6357
6372
  let I = [];
6358
- return g === null ? I = A.map((B) => dI(null)) : Array.isArray(g) && (I = g.map((B) => B ?? dI(null))), kE(I, A), I;
6373
+ return g === null ? I = A.map((B) => YI(null)) : Array.isArray(g) && (I = g.map((B) => B ?? YI(null))), JE(I, A), I;
6359
6374
  }
6360
- class dE {
6375
+ class KE {
6361
6376
  dim_indexers;
6362
6377
  shape;
6363
6378
  constructor({ selection: A, shape: I, chunk_shape: B }) {
6364
- this.dim_indexers = YE(A, I).map((C, Q) => new (typeof C == "number" ? JE : FB)({
6379
+ this.dim_indexers = ME(A, I).map((C, Q) => new (typeof C == "number" ? dE : nB)({
6365
6380
  // @ts-expect-error ts inference not strong enough to know correct chunk
6366
6381
  dim_sel: C,
6367
6382
  dim_len: I[Q],
6368
6383
  dim_chunk_len: B[Q]
6369
- })), this.shape = this.dim_indexers.filter((C) => C instanceof FB).map((C) => C.nitems);
6384
+ })), this.shape = this.dim_indexers.filter((C) => C instanceof nB).map((C) => C.nitems);
6370
6385
  }
6371
6386
  *[Symbol.iterator]() {
6372
- for (const A of rE(...this.dim_indexers)) {
6387
+ for (const A of RE(...this.dim_indexers)) {
6373
6388
  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 });
6374
6389
  yield { chunk_coords: I, mapping: B };
6375
6390
  }
6376
6391
  }
6377
6392
  }
6378
- function ME(g, A) {
6393
+ function HE(g, A) {
6379
6394
  return "get" in g ? g.get(A) : g[A];
6380
6395
  }
6381
- async function KE(g, A, I, B) {
6382
- let C = nE(g), Q = new dE({
6396
+ async function qE(g, A, I, B) {
6397
+ let C = FE(g), Q = new KE({
6383
6398
  selection: A,
6384
6399
  shape: g.shape,
6385
6400
  chunk_shape: g.chunks
6386
- }), 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?.() ?? RE();
6401
+ }), 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?.() ?? cE();
6387
6402
  for (const { chunk_coords: o, mapping: a } of Q)
6388
6403
  i.add(async () => {
6389
6404
  let { data: s, shape: h, stride: t } = await g.getChunk(o, I.opts), y = B.prepare(s, h, t);
6390
6405
  B.set_from_chunk(E, y, a);
6391
6406
  });
6392
- return await i.onIdle(), Q.shape.length === 0 ? ME(E.data, 0) : E;
6407
+ return await i.onIdle(), Q.shape.length === 0 ? HE(E.data, 0) : E;
6393
6408
  }
6394
6409
  function Hg(g, A = 0, I) {
6395
6410
  let B = I ?? g.length - A;
@@ -6407,7 +6422,7 @@ function Hg(g, A = 0, I) {
6407
6422
  }
6408
6423
  };
6409
6424
  }
6410
- function Bg(g) {
6425
+ function gg(g) {
6411
6426
  return globalThis.Array.isArray(g.data) ? {
6412
6427
  // @ts-expect-error
6413
6428
  data: Hg(g.data),
@@ -6419,32 +6434,32 @@ function Bg(g) {
6419
6434
  bytes_per_element: g.data.BYTES_PER_ELEMENT
6420
6435
  };
6421
6436
  }
6422
- function HE(g) {
6437
+ function lE(g) {
6423
6438
  return "chars" in g ? g.constructor.bind(null, g.chars) : g.constructor;
6424
6439
  }
6425
- function qE(g, A) {
6440
+ function fE(g, A) {
6426
6441
  if (globalThis.Array.isArray(g.data))
6427
6442
  return Hg([A]);
6428
- let I = HE(g.data), B = new I([A]);
6443
+ let I = lE(g.data), B = new I([A]);
6429
6444
  return new Uint8Array(B.buffer, B.byteOffset, B.byteLength);
6430
6445
  }
6431
- const lE = {
6446
+ const pE = {
6432
6447
  prepare(g, A, I) {
6433
6448
  return { data: g, shape: A, stride: I };
6434
6449
  },
6435
6450
  set_scalar(g, A, I) {
6436
- let B = Bg(g);
6437
- ag(B, A, qE(g, I), B.bytes_per_element);
6451
+ let B = gg(g);
6452
+ ag(B, A, fE(g, I), B.bytes_per_element);
6438
6453
  },
6439
6454
  set_from_chunk(g, A, I) {
6440
- let B = Bg(g);
6441
- SI(B, Bg(A), B.bytes_per_element, I);
6455
+ let B = gg(g);
6456
+ SI(B, gg(A), B.bytes_per_element, I);
6442
6457
  }
6443
6458
  };
6444
- async function fE(g, A = null, I = {}) {
6445
- return KE(g, A, I, lE);
6459
+ async function mE(g, A = null, I = {}) {
6460
+ return qE(g, A, I, pE);
6446
6461
  }
6447
- function OB(g, A, I) {
6462
+ function ZB(g, A, I) {
6448
6463
  return I < 0 && A < g ? Math.floor((g - A - 1) / -I) + 1 : g < A ? Math.floor((A - g - 1) / I) + 1 : 0;
6449
6464
  }
6450
6465
  function ag(g, A, I, B) {
@@ -6458,7 +6473,7 @@ function ag(g, A, I, B) {
6458
6473
  ag({ data: t, stride: i }, Q, I, B);
6459
6474
  return;
6460
6475
  }
6461
- const [o, a, s] = C, h = OB(o, a, s);
6476
+ const [o, a, s] = C, h = ZB(o, a, s);
6462
6477
  if (Q.length === 0) {
6463
6478
  for (let t = 0; t < h; t++)
6464
6479
  g.data.set(I, E * (o + s * t) * B);
@@ -6494,7 +6509,7 @@ function SI(g, A, I, B) {
6494
6509
  }, I, Q);
6495
6510
  return;
6496
6511
  }
6497
- const [s, h, t] = C.to, [y, n, w] = C.from, r = OB(s, h, t);
6512
+ const [s, h, t] = C.to, [y, n, w] = C.from, r = ZB(s, h, t);
6498
6513
  if (Q.length === 0) {
6499
6514
  if (t === 1 && w === 1 && E === 1 && o === 1) {
6500
6515
  let G = y * I, c = r * I;
@@ -6516,8 +6531,8 @@ function SI(g, A, I, B) {
6516
6531
  stride: a
6517
6532
  }, I, Q);
6518
6533
  }
6519
- let bI = pE();
6520
- function pE() {
6534
+ let WI = uE();
6535
+ function uE() {
6521
6536
  let g = /* @__PURE__ */ new WeakMap();
6522
6537
  function A(I) {
6523
6538
  let B = g.get(I) ?? { v2: 0, v3: 0 };
@@ -6533,53 +6548,53 @@ function pE() {
6533
6548
  }
6534
6549
  };
6535
6550
  }
6536
- async function mE(g) {
6551
+ async function TE(g) {
6537
6552
  let A = await g.store.get(g.resolve(".zattrs").path);
6538
6553
  return A ? GI(A) : {};
6539
6554
  }
6540
- async function uE(g, A = {}) {
6555
+ async function xE(g, A = {}) {
6541
6556
  let I = "store" in g ? g : new z(g), B = {};
6542
- return (A.attrs ?? !0) && (B = await mE(I)), A.kind === "array" ? rB(I, B) : A.kind === "group" ? SB(I, B) : rB(I, B).catch((C) => (ZB(C, nI), SB(I, B)));
6557
+ return (A.attrs ?? !0) && (B = await TE(I)), A.kind === "array" ? wB(I, B) : A.kind === "group" ? FB(I, B) : wB(I, B).catch((C) => (WB(C, nI), FB(I, B)));
6543
6558
  }
6544
- async function rB(g, A) {
6559
+ async function wB(g, A) {
6545
6560
  let { path: I } = g.resolve(".zarray"), B = await g.store.get(I);
6546
6561
  if (!B)
6547
6562
  throw new nI("v2 array", {
6548
6563
  cause: new dg(I)
6549
6564
  });
6550
- return bI.increment(g.store, "v2"), new YI(g.store, g.path, gE(GI(B), A));
6565
+ return WI.increment(g.store, "v2"), new JI(g.store, g.path, CE(GI(B), A));
6551
6566
  }
6552
- async function SB(g, A) {
6567
+ async function FB(g, A) {
6553
6568
  let { path: I } = g.resolve(".zgroup"), B = await g.store.get(I);
6554
6569
  if (!B)
6555
6570
  throw new nI("v2 group", {
6556
6571
  cause: new dg(I)
6557
6572
  });
6558
- return bI.increment(g.store, "v2"), new Mg(g.store, g.path, BE(GI(B), A));
6573
+ return WI.increment(g.store, "v2"), new Mg(g.store, g.path, QE(GI(B), A));
6559
6574
  }
6560
- async function TE(g) {
6575
+ async function WE(g) {
6561
6576
  let { store: A, path: I } = g.resolve("zarr.json"), B = await g.store.get(I);
6562
6577
  if (!B)
6563
6578
  throw new nI("v3 array or group", {
6564
6579
  cause: new dg(I)
6565
6580
  });
6566
6581
  let C = GI(B);
6567
- return C.node_type === "array" && (C.fill_value = bB(C)), C.node_type === "array" ? new YI(A, g.path, C) : new Mg(A, g.path, C);
6582
+ return C.node_type === "array" && (C.fill_value = xB(C)), C.node_type === "array" ? new JI(A, g.path, C) : new Mg(A, g.path, C);
6568
6583
  }
6569
- async function xE(g, A = {}) {
6570
- let I = "store" in g ? g : new z(g), B = await TE(I);
6571
- if (bI.increment(I.store, "v3"), A.kind === void 0 || A.kind === "array" && B instanceof YI || A.kind === "group" && B instanceof Mg)
6584
+ async function bE(g, A = {}) {
6585
+ let I = "store" in g ? g : new z(g), B = await WE(I);
6586
+ if (WI.increment(I.store, "v3"), A.kind === void 0 || A.kind === "array" && B instanceof JI || A.kind === "group" && B instanceof Mg)
6572
6587
  return B;
6573
- let C = B instanceof YI ? "array" : "group";
6588
+ let C = B instanceof JI ? "array" : "group";
6574
6589
  throw new Error(`Expected node of kind ${A.kind}, found ${C}.`);
6575
6590
  }
6576
6591
  async function IA(g, A = {}) {
6577
- let I = "store" in g ? g.store : g, B = bI.version_max(I), C = B === "v2" ? IA.v2 : IA.v3, Q = B === "v2" ? IA.v3 : IA.v2;
6578
- return C(g, A).catch((E) => (ZB(E, nI), Q(g, A)));
6592
+ let I = "store" in g ? g.store : g, B = WI.version_max(I), C = B === "v2" ? IA.v2 : IA.v3, Q = B === "v2" ? IA.v3 : IA.v2;
6593
+ return C(g, A).catch((E) => (WB(E, nI), Q(g, A)));
6579
6594
  }
6580
- IA.v2 = uE;
6581
- IA.v3 = xE;
6582
- async function WE(g, A) {
6595
+ IA.v2 = xE;
6596
+ IA.v3 = bE;
6597
+ async function ZE(g, A) {
6583
6598
  const I = A.split("/"), B = I.pop();
6584
6599
  if (!B)
6585
6600
  throw new Error("Invalid path");
@@ -6596,7 +6611,7 @@ class qg {
6596
6611
  return this.#A;
6597
6612
  }
6598
6613
  async get(A) {
6599
- const I = await WE(this.#A, A.slice(1)).catch(
6614
+ const I = await ZE(this.#A, A.slice(1)).catch(
6600
6615
  () => {
6601
6616
  }
6602
6617
  );
@@ -6606,7 +6621,7 @@ class qg {
6606
6621
  return new Uint8Array(C);
6607
6622
  }
6608
6623
  }
6609
- function bE() {
6624
+ function PE() {
6610
6625
  if (typeof window > "u")
6611
6626
  return;
6612
6627
  const g = window.location.hostname;
@@ -6623,7 +6638,7 @@ class lg extends PA {
6623
6638
  overrides;
6624
6639
  useSuffixRequest;
6625
6640
  constructor(A) {
6626
- bE(), super(A.url, {
6641
+ PE(), super(A.url, {
6627
6642
  overrides: A.overrides,
6628
6643
  useSuffixRequest: A.useSuffixRequest
6629
6644
  }), this.credentials = A.credentials, this.region = A.region, this.overrides = A.overrides, this.useSuffixRequest = A.useSuffixRequest;
@@ -6761,7 +6776,7 @@ async function wI(g, A) {
6761
6776
  throw new Error(`Failed to open Zarr group at ${g}`);
6762
6777
  }
6763
6778
  }
6764
- async function ZE(g, A) {
6779
+ async function OE(g, A) {
6765
6780
  if (A === "v2")
6766
6781
  try {
6767
6782
  return IA.v2(g, { kind: "array", attrs: !1 });
@@ -6780,7 +6795,7 @@ async function ZE(g, A) {
6780
6795
  throw new Error(`Failed to open Zarr array at ${g}`);
6781
6796
  }
6782
6797
  }
6783
- async function PE(g) {
6798
+ async function VE(g) {
6784
6799
  let A;
6785
6800
  switch (g.type) {
6786
6801
  case "fetch": {
@@ -6806,9 +6821,9 @@ async function PE(g) {
6806
6821
  }
6807
6822
  }
6808
6823
  const I = g.arrayPath ? A.resolve(g.arrayPath) : A;
6809
- return ZE(I, g.zarrVersion);
6824
+ return OE(I, g.zarrVersion);
6810
6825
  }
6811
- function OE(g, A, I) {
6826
+ function vE(g, A, I) {
6812
6827
  if (g.store instanceof lg)
6813
6828
  return {
6814
6829
  type: "s3",
@@ -6839,7 +6854,7 @@ function OE(g, A, I) {
6839
6854
  `Unsupported store type: ${g.store.constructor.name}`
6840
6855
  );
6841
6856
  }
6842
- const VB = `function Bg(i, A, g, E = {}) {
6857
+ const PB = `function Bg(i, A, g, E = {}) {
6843
6858
  return A !== void 0 && g !== void 0 && (E = {
6844
6859
  ...E,
6845
6860
  headers: {
@@ -9982,11 +9997,11 @@ return ret;
9982
9997
  default: FB
9983
9998
  });
9984
9999
  //# sourceMappingURL=worker_kernel-uaRPnPAm.js.map
9985
- `, RB = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", VB], { type: "text/javascript;charset=utf-8" });
9986
- function VE(g) {
10000
+ `, rB = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", PB], { type: "text/javascript;charset=utf-8" });
10001
+ function XE(g) {
9987
10002
  let A;
9988
10003
  try {
9989
- if (A = RB && (self.URL || self.webkitURL).createObjectURL(RB), !A) throw "";
10004
+ if (A = rB && (self.URL || self.webkitURL).createObjectURL(rB), !A) throw "";
9990
10005
  const I = new Worker(A, {
9991
10006
  type: "module",
9992
10007
  name: g?.name
@@ -9996,7 +10011,7 @@ function VE(g) {
9996
10011
  }), I;
9997
10012
  } catch {
9998
10013
  return new Worker(
9999
- "data:text/javascript;charset=utf-8," + encodeURIComponent(VB),
10014
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(PB),
10000
10015
  {
10001
10016
  type: "module",
10002
10017
  name: g?.name
@@ -10004,20 +10019,20 @@ function VE(g) {
10004
10019
  );
10005
10020
  }
10006
10021
  }
10007
- const vE = Math.min(navigator.hardwareConcurrency, 8);
10008
- let CA = [], XE = 0, vB = 0;
10009
- const kA = /* @__PURE__ */ new Map(), MI = /* @__PURE__ */ new Set();
10010
- function XB(g) {
10022
+ const jE = Math.min(navigator.hardwareConcurrency, 8);
10023
+ let CA = [], zE = 0, OB = 0;
10024
+ const kA = /* @__PURE__ */ new Map(), dI = /* @__PURE__ */ new Set();
10025
+ function VB(g) {
10011
10026
  const A = CA.find((I) => I.worker === g);
10012
10027
  return A || U.error(
10013
10028
  "ZarrWorker",
10014
10029
  "Worker not found in pool - this should not happen"
10015
10030
  ), A;
10016
10031
  }
10017
- function jE(g, A) {
10032
+ function _E(g, A) {
10018
10033
  const { id: I, success: B } = g.data, C = kA.get(I);
10019
10034
  if (!C) {
10020
- MI.has(I) ? MI.delete(I) : U.warn(
10035
+ dI.has(I) ? dI.delete(I) : U.warn(
10021
10036
  "ZarrWorker",
10022
10037
  `Received response for unknown message ID ${I}:`,
10023
10038
  g.data
@@ -10025,13 +10040,13 @@ function jE(g, A) {
10025
10040
  return;
10026
10041
  }
10027
10042
  kA.delete(I), C.abortListener && C.abortSignal && C.abortSignal.removeEventListener("abort", C.abortListener);
10028
- const Q = XB(A);
10043
+ const Q = VB(A);
10029
10044
  Q && Q.pendingCount > 0 ? Q.pendingCount-- : Q && U.error(
10030
10045
  "ZarrWorker",
10031
10046
  "Received message but no pending tasks - this should not happen"
10032
10047
  ), B && g.data.type === "getChunk" ? C.resolve(g.data.chunk) : B || C.reject(new Error(g.data.error || "Unknown worker error"));
10033
10048
  }
10034
- function NB(g, A) {
10049
+ function SB(g, A) {
10035
10050
  if (g instanceof MessageEvent) {
10036
10051
  U.error(
10037
10052
  "ZarrWorker",
@@ -10044,7 +10059,7 @@ function NB(g, A) {
10044
10059
  "Worker failed - replacing worker and canceling its in-flight messages",
10045
10060
  g.message
10046
10061
  );
10047
- const I = XB(A);
10062
+ const I = VB(A);
10048
10063
  if (I) {
10049
10064
  const C = CA.indexOf(I);
10050
10065
  CA.splice(C, 1);
@@ -10054,31 +10069,31 @@ function NB(g, A) {
10054
10069
  for (const [C, Q] of kA.entries())
10055
10070
  Q.workerId === B && (Q.reject(new Error(`Worker error: ${g.message}`)), kA.delete(C));
10056
10071
  try {
10057
- const C = jB();
10072
+ const C = vB();
10058
10073
  CA.push({
10059
10074
  worker: C,
10060
10075
  pendingCount: 0,
10061
- workerId: vB++
10076
+ workerId: OB++
10062
10077
  }), U.debug("ZarrWorker", "Replacement worker created successfully");
10063
10078
  } catch (C) {
10064
10079
  U.error("ZarrWorker", "Failed to create replacement worker", C);
10065
10080
  }
10066
10081
  }
10067
- function jB() {
10068
- const g = new VE();
10069
- return g.addEventListener("message", (A) => jE(A, g)), g.addEventListener("error", (A) => NB(A, g)), g.addEventListener(
10082
+ function vB() {
10083
+ const g = new XE();
10084
+ return g.addEventListener("message", (A) => _E(A, g)), g.addEventListener("error", (A) => SB(A, g)), g.addEventListener(
10070
10085
  "messageerror",
10071
- (A) => NB(A, g)
10086
+ (A) => SB(A, g)
10072
10087
  ), g;
10073
10088
  }
10074
- function zE() {
10089
+ function $E() {
10075
10090
  if (CA.length === 0)
10076
10091
  throw new Error("Worker pool is not initialized");
10077
10092
  return CA.sort((g, A) => g.pendingCount - A.pendingCount)[0];
10078
10093
  }
10079
- async function _E(g, A, I) {
10094
+ async function Ai(g, A, I) {
10080
10095
  return new Promise((B, C) => {
10081
- const Q = zE(), E = XE++, i = {
10096
+ const Q = $E(), E = zE++, i = {
10082
10097
  resolve: B,
10083
10098
  reject: C,
10084
10099
  workerId: Q.workerId
@@ -10088,10 +10103,10 @@ async function _E(g, A, I) {
10088
10103
  Q.worker.postMessage({
10089
10104
  id: E,
10090
10105
  type: "cancel"
10091
- }), kA.delete(E), MI.add(E), Q.pendingCount--, C(new DOMException("Operation was aborted", "AbortError"));
10106
+ }), kA.delete(E), dI.add(E), Q.pendingCount--, C(new DOMException("Operation was aborted", "AbortError"));
10092
10107
  };
10093
10108
  if (I.signal.aborted) {
10094
- o(), MI.delete(E);
10109
+ o(), dI.delete(E);
10095
10110
  return;
10096
10111
  }
10097
10112
  I.signal.addEventListener("abort", o, { once: !0 }), i.abortListener = o, i.abortSignal = I.signal;
@@ -10104,15 +10119,15 @@ async function _E(g, A, I) {
10104
10119
  });
10105
10120
  });
10106
10121
  }
10107
- function $E() {
10122
+ function Ii() {
10108
10123
  if (!(CA.length > 0))
10109
10124
  try {
10110
- for (let g = 0; g < vE; g++) {
10111
- const A = jB();
10125
+ for (let g = 0; g < jE; g++) {
10126
+ const A = vB();
10112
10127
  CA.push({
10113
10128
  worker: A,
10114
10129
  pendingCount: 0,
10115
- workerId: vB++
10130
+ workerId: OB++
10116
10131
  });
10117
10132
  }
10118
10133
  U.debug(
@@ -10120,26 +10135,26 @@ function $E() {
10120
10135
  `Initialized worker pool with ${CA.length} workers`
10121
10136
  );
10122
10137
  } catch {
10123
- U.warn("ZarrWorker", "Failed to create workers - clearing pool"), Ii();
10138
+ U.warn("ZarrWorker", "Failed to create workers - clearing pool"), Bi();
10124
10139
  return;
10125
10140
  }
10126
10141
  }
10127
- async function Ai(g, A, I, B) {
10128
- $E();
10142
+ async function gi(g, A, I, B) {
10143
+ Ii();
10129
10144
  try {
10130
- return await _E(A, I, B);
10145
+ return await Ai(A, I, B);
10131
10146
  } catch (C) {
10132
10147
  if (C instanceof DOMException && C.name === "AbortError")
10133
10148
  throw C;
10134
10149
  return U.warn("ZarrWorker", "Falling back to main thread", C), await g.getChunk(I, B);
10135
10150
  }
10136
10151
  }
10137
- function Ii() {
10152
+ function Bi() {
10138
10153
  for (const g of CA)
10139
10154
  g.worker.terminate();
10140
10155
  CA = [], kA.clear();
10141
10156
  }
10142
- class gi {
10157
+ class Ci {
10143
10158
  promises_ = [];
10144
10159
  scheduler_;
10145
10160
  constructor(A) {
@@ -10152,13 +10167,13 @@ class gi {
10152
10167
  return Promise.all(this.promises_.map((A) => this.scheduler_.submit(A)));
10153
10168
  }
10154
10169
  }
10155
- class Bi {
10170
+ class Qi {
10156
10171
  metadata_;
10157
10172
  arrays_;
10158
10173
  arrayParams_;
10159
10174
  dimensions_;
10160
10175
  constructor(A) {
10161
- this.metadata_ = A.metadata, this.arrays_ = A.arrays, this.arrayParams_ = A.arrayParams, this.dimensions_ = Ci(this.metadata_, this.arrays_);
10176
+ this.metadata_ = A.metadata, this.arrays_ = A.arrays, this.arrayParams_ = A.arrayParams, this.dimensions_ = Ei(this.metadata_, this.arrays_);
10162
10177
  }
10163
10178
  getSourceDimensionMap() {
10164
10179
  return this.dimensions_;
@@ -10166,14 +10181,14 @@ class Bi {
10166
10181
  async loadChunkData(A, I) {
10167
10182
  const B = [];
10168
10183
  B[this.dimensions_.x.index] = A.chunkIndex.x, B[this.dimensions_.y.index] = A.chunkIndex.y, this.dimensions_.z && (B[this.dimensions_.z.index] = A.chunkIndex.z), this.dimensions_.c && (B[this.dimensions_.c.index] = A.chunkIndex.c), this.dimensions_.t && (B[this.dimensions_.t.index] = A.chunkIndex.t);
10169
- const C = this.arrays_[A.lod], Q = this.arrayParams_[A.lod], E = await Ai(C, Q, B, {
10184
+ const C = this.arrays_[A.lod], Q = this.arrayParams_[A.lod], E = await gi(C, Q, B, {
10170
10185
  signal: I
10171
10186
  });
10172
10187
  if (!zg(E.data))
10173
10188
  throw new Error(
10174
10189
  `Received chunk has an unsupported data type, data=${E.data.constructor.name}`
10175
10190
  );
10176
- UB(E);
10191
+ NB(E);
10177
10192
  const i = {
10178
10193
  x: E.shape[this.dimensions_.x.index],
10179
10194
  y: E.shape[this.dimensions_.y.index],
@@ -10216,15 +10231,15 @@ class Bi {
10216
10231
  const C = this.regionToIndices(A, I), Q = this.arrays_[I];
10217
10232
  let E = {};
10218
10233
  B !== void 0 && (E = {
10219
- create_queue: () => new gi(B),
10234
+ create_queue: () => new Ci(B),
10220
10235
  opts: { signal: B.abortSignal }
10221
10236
  });
10222
- const i = await fE(Q, C, E);
10237
+ const i = await mE(Q, C, E);
10223
10238
  if (!zg(i.data))
10224
10239
  throw new Error(
10225
10240
  `Subarray has an unsupported data type, data=${i.data.constructor.name}`
10226
10241
  );
10227
- if (UB(i), i.shape.length !== 2 && i.shape.length !== 3)
10242
+ if (NB(i), i.shape.length !== 2 && i.shape.length !== 3)
10228
10243
  throw new Error(
10229
10244
  `Expected to receive a 2D or 3D subarray. Instead chunk has shape ${i.shape}`
10230
10245
  );
@@ -10267,13 +10282,13 @@ class Bi {
10267
10282
  this.dimensions_.t
10268
10283
  ].filter((Q) => Q !== void 0).sort((Q, E) => Q.index - E.index), C = [];
10269
10284
  for (const Q of B) {
10270
- const E = A.find((s) => zB(s.dimension, Q.name));
10285
+ const E = A.find((s) => XB(s.dimension, Q.name));
10271
10286
  if (!E)
10272
10287
  throw new Error(`Region does not contain a slice for ${Q.name}`);
10273
10288
  const i = Q.lods[I];
10274
10289
  let o;
10275
10290
  const a = E.index;
10276
- a.type === "full" ? o = dI(null) : a.type === "point" ? o = Math.round((a.value - i.translation) / i.scale) : o = dI(
10291
+ a.type === "full" ? o = YI(null) : a.type === "point" ? o = Math.round((a.value - i.translation) / i.scale) : o = YI(
10277
10292
  Math.floor((a.start - i.translation) / i.scale),
10278
10293
  Math.ceil((a.stop - i.translation) / i.scale)
10279
10294
  ), C.push(o);
@@ -10281,8 +10296,8 @@ class Bi {
10281
10296
  return C;
10282
10297
  }
10283
10298
  }
10284
- function Ci(g, A) {
10285
- const I = g.axes.map((h) => h.name), B = g.axes.length, C = cB(I, "x"), Q = cB(I, "y"), E = (h, t) => {
10299
+ function Ei(g, A) {
10300
+ const I = g.axes.map((h) => h.name), B = g.axes.length, C = RB(I, "x"), Q = RB(I, "y"), E = (h, t) => {
10286
10301
  const y = [];
10287
10302
  for (let n = 0; n < g.datasets.length; n++) {
10288
10303
  const w = g.datasets[n], r = A[n], G = w.coordinateTransformations[0].scale, c = w.coordinateTransformations.length === 2 ? w.coordinateTransformations[1].translation : new Array(B).fill(0);
@@ -10310,10 +10325,10 @@ function Ci(g, A) {
10310
10325
  const s = RI(I, "t");
10311
10326
  return s !== -1 && (i.t = E(I[s], s)), i;
10312
10327
  }
10313
- function zB(g, A) {
10328
+ function XB(g, A) {
10314
10329
  return g.toLowerCase() === A.toLowerCase();
10315
10330
  }
10316
- function cB(g, A) {
10331
+ function RB(g, A) {
10317
10332
  const I = RI(g, A);
10318
10333
  if (I === -1)
10319
10334
  throw new Error(
@@ -10322,9 +10337,9 @@ function cB(g, A) {
10322
10337
  return I;
10323
10338
  }
10324
10339
  function RI(g, A) {
10325
- return g.findIndex((I) => zB(I, A));
10340
+ return g.findIndex((I) => XB(I, A));
10326
10341
  }
10327
- function UB(g) {
10342
+ function NB(g) {
10328
10343
  let A = 1;
10329
10344
  for (let I = g.shape.length - 1; I >= 0; I--) {
10330
10345
  if (g.stride[I] !== A)
@@ -10437,7 +10452,7 @@ const S = H.arrayToEnum([
10437
10452
  "invalid_intersection_types",
10438
10453
  "not_multiple_of",
10439
10454
  "not_finite"
10440
- ]), Qi = (g) => JSON.stringify(g, null, 2).replace(/"([^"]+)":/g, "$1:");
10455
+ ]), ii = (g) => JSON.stringify(g, null, 2).replace(/"([^"]+)":/g, "$1:");
10441
10456
  class $ extends Error {
10442
10457
  get errors() {
10443
10458
  return this.issues;
@@ -10554,14 +10569,14 @@ const uA = (g, A) => {
10554
10569
  }
10555
10570
  return { message: I };
10556
10571
  };
10557
- let _B = uA;
10558
- function Ei(g) {
10559
- _B = g;
10572
+ let jB = uA;
10573
+ function oi(g) {
10574
+ jB = g;
10560
10575
  }
10561
- function KI() {
10562
- return _B;
10576
+ function MI() {
10577
+ return jB;
10563
10578
  }
10564
- const HI = (g) => {
10579
+ const KI = (g) => {
10565
10580
  const { data: A, path: I, errorMaps: B, issueData: C } = g, Q = [...I, ...C.path || []], E = {
10566
10581
  ...C,
10567
10582
  path: Q
@@ -10581,9 +10596,9 @@ const HI = (g) => {
10581
10596
  path: Q,
10582
10597
  message: i
10583
10598
  };
10584
- }, ii = [];
10599
+ }, ai = [];
10585
10600
  function F(g, A) {
10586
- const I = KI(), B = HI({
10601
+ const I = MI(), B = KI({
10587
10602
  issueData: A,
10588
10603
  data: g.data,
10589
10604
  path: g.path,
@@ -10644,11 +10659,11 @@ class X {
10644
10659
  const Y = Object.freeze({
10645
10660
  status: "aborted"
10646
10661
  }), KA = (g) => ({ status: "dirty", value: g }), j = (g) => ({ status: "valid", value: g }), Dg = (g) => g.status === "aborted", hg = (g) => g.status === "dirty", LA = (g) => g.status === "valid", II = (g) => typeof Promise < "u" && g instanceof Promise;
10647
- function qI(g, A, I, B) {
10662
+ function HI(g, A, I, B) {
10648
10663
  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");
10649
10664
  return A.get(g);
10650
10665
  }
10651
- function $B(g, A, I, B, C) {
10666
+ function zB(g, A, I, B, C) {
10652
10667
  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");
10653
10668
  return A.set(g, I), I;
10654
10669
  }
@@ -10665,7 +10680,7 @@ class sA {
10665
10680
  return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
10666
10681
  }
10667
10682
  }
10668
- const kB = (g, A) => {
10683
+ const cB = (g, A) => {
10669
10684
  if (LA(A))
10670
10685
  return { success: !0, data: A.value };
10671
10686
  if (!g.common.issues.length)
@@ -10752,7 +10767,7 @@ class K {
10752
10767
  data: A,
10753
10768
  parsedType: tA(A)
10754
10769
  }, Q = this._parseSync({ data: A, path: C.path, parent: C });
10755
- return kB(C, Q);
10770
+ return cB(C, Q);
10756
10771
  }
10757
10772
  "~validate"(A) {
10758
10773
  var I, B;
@@ -10806,7 +10821,7 @@ class K {
10806
10821
  data: A,
10807
10822
  parsedType: tA(A)
10808
10823
  }, C = this._parse({ data: A, path: B.path, parent: B }), Q = await (II(C) ? C : Promise.resolve(C));
10809
- return kB(B, Q);
10824
+ return cB(B, Q);
10810
10825
  }
10811
10826
  refine(A, I) {
10812
10827
  const B = (C) => typeof I == "string" || typeof I > "u" ? { message: I } : typeof I == "function" ? I(C) : I;
@@ -10912,26 +10927,26 @@ class K {
10912
10927
  return this.safeParse(null).success;
10913
10928
  }
10914
10929
  }
10915
- const oi = /^c[^\s-]{8,}$/i, ai = /^[0-9a-z]+$/, si = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Di = /^[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, hi = /^[a-z0-9_-]{21}$/i, ti = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, yi = /^[-+]?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)?)??$/, ei = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Gi = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
10916
- let Cg;
10917
- const ni = /^(?:(?: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])$/, wi = /^(?:(?: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])$/, Fi = /^(([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]))$/, 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]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Si = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Ri = /^([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])))", Ni = new RegExp(`^${AC}$`);
10918
- function IC(g) {
10930
+ const si = /^c[^\s-]{8,}$/i, Di = /^[0-9a-z]+$/, hi = /^[0-9A-HJKMNP-TV-Z]{26}$/i, ti = /^[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, yi = /^[a-z0-9_-]{21}$/i, ei = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Gi = /^[-+]?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)?)??$/, ni = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, wi = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
10931
+ let Bg;
10932
+ const Fi = /^(?:(?: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])$/, Si = /^(([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]))$/, 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]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Ni = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, ci = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, _B = "((\\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])))", Ui = new RegExp(`^${_B}$`);
10933
+ function $B(g) {
10919
10934
  let A = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
10920
10935
  return g.precision ? A = `${A}\\.\\d{${g.precision}}` : g.precision == null && (A = `${A}(\\.\\d+)?`), A;
10921
10936
  }
10922
- function ci(g) {
10923
- return new RegExp(`^${IC(g)}$`);
10937
+ function ki(g) {
10938
+ return new RegExp(`^${$B(g)}$`);
10924
10939
  }
10925
- function gC(g) {
10926
- let A = `${AC}T${IC(g)}`;
10940
+ function AC(g) {
10941
+ let A = `${_B}T${$B(g)}`;
10927
10942
  const I = [];
10928
10943
  return I.push(g.local ? "Z?" : "Z"), g.offset && I.push("([+-]\\d{2}:?\\d{2})"), A = `${A}(${I.join("|")})`, new RegExp(`^${A}$`);
10929
10944
  }
10930
- function Ui(g, A) {
10931
- return !!((A === "v4" || !A) && ni.test(g) || (A === "v6" || !A) && Fi.test(g));
10945
+ function Li(g, A) {
10946
+ return !!((A === "v4" || !A) && Fi.test(g) || (A === "v6" || !A) && Si.test(g));
10932
10947
  }
10933
- function ki(g, A) {
10934
- if (!ti.test(g))
10948
+ function Ji(g, A) {
10949
+ if (!ei.test(g))
10935
10950
  return !1;
10936
10951
  try {
10937
10952
  const [I] = g.split("."), B = I.replace(/-/g, "+").replace(/_/g, "/").padEnd(I.length + (4 - I.length % 4) % 4, "="), C = JSON.parse(atob(B));
@@ -10940,8 +10955,8 @@ function ki(g, A) {
10940
10955
  return !1;
10941
10956
  }
10942
10957
  }
10943
- function Li(g, A) {
10944
- return !!((A === "v4" || !A) && wi.test(g) || (A === "v6" || !A) && ri.test(g));
10958
+ function Yi(g, A) {
10959
+ return !!((A === "v4" || !A) && ri.test(g) || (A === "v6" || !A) && Ri.test(g));
10945
10960
  }
10946
10961
  class gA extends K {
10947
10962
  _parse(A) {
@@ -10992,43 +11007,43 @@ class gA extends K {
10992
11007
  message: Q.message
10993
11008
  }), B.dirty());
10994
11009
  } else if (Q.kind === "email")
10995
- ei.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11010
+ ni.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10996
11011
  validation: "email",
10997
11012
  code: e.invalid_string,
10998
11013
  message: Q.message
10999
11014
  }), B.dirty());
11000
11015
  else if (Q.kind === "emoji")
11001
- Cg || (Cg = new RegExp(Gi, "u")), Cg.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11016
+ Bg || (Bg = new RegExp(wi, "u")), Bg.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11002
11017
  validation: "emoji",
11003
11018
  code: e.invalid_string,
11004
11019
  message: Q.message
11005
11020
  }), B.dirty());
11006
11021
  else if (Q.kind === "uuid")
11007
- Di.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11022
+ ti.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11008
11023
  validation: "uuid",
11009
11024
  code: e.invalid_string,
11010
11025
  message: Q.message
11011
11026
  }), B.dirty());
11012
11027
  else if (Q.kind === "nanoid")
11013
- hi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11028
+ yi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11014
11029
  validation: "nanoid",
11015
11030
  code: e.invalid_string,
11016
11031
  message: Q.message
11017
11032
  }), B.dirty());
11018
11033
  else if (Q.kind === "cuid")
11019
- oi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11034
+ si.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11020
11035
  validation: "cuid",
11021
11036
  code: e.invalid_string,
11022
11037
  message: Q.message
11023
11038
  }), B.dirty());
11024
11039
  else if (Q.kind === "cuid2")
11025
- ai.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11040
+ Di.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11026
11041
  validation: "cuid2",
11027
11042
  code: e.invalid_string,
11028
11043
  message: Q.message
11029
11044
  }), B.dirty());
11030
11045
  else if (Q.kind === "ulid")
11031
- si.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11046
+ hi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11032
11047
  validation: "ulid",
11033
11048
  code: e.invalid_string,
11034
11049
  message: Q.message
@@ -11059,39 +11074,39 @@ class gA extends K {
11059
11074
  code: e.invalid_string,
11060
11075
  validation: { endsWith: Q.value },
11061
11076
  message: Q.message
11062
- }), B.dirty()) : Q.kind === "datetime" ? gC(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11077
+ }), B.dirty()) : Q.kind === "datetime" ? AC(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11063
11078
  code: e.invalid_string,
11064
11079
  validation: "datetime",
11065
11080
  message: Q.message
11066
- }), B.dirty()) : Q.kind === "date" ? Ni.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11081
+ }), B.dirty()) : Q.kind === "date" ? Ui.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11067
11082
  code: e.invalid_string,
11068
11083
  validation: "date",
11069
11084
  message: Q.message
11070
- }), B.dirty()) : Q.kind === "time" ? ci(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11085
+ }), B.dirty()) : Q.kind === "time" ? ki(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11071
11086
  code: e.invalid_string,
11072
11087
  validation: "time",
11073
11088
  message: Q.message
11074
- }), B.dirty()) : Q.kind === "duration" ? yi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11089
+ }), B.dirty()) : Q.kind === "duration" ? Gi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11075
11090
  validation: "duration",
11076
11091
  code: e.invalid_string,
11077
11092
  message: Q.message
11078
- }), B.dirty()) : Q.kind === "ip" ? Ui(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), F(C, {
11093
+ }), B.dirty()) : Q.kind === "ip" ? Li(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), F(C, {
11079
11094
  validation: "ip",
11080
11095
  code: e.invalid_string,
11081
11096
  message: Q.message
11082
- }), B.dirty()) : Q.kind === "jwt" ? ki(A.data, Q.alg) || (C = this._getOrReturnCtx(A, C), F(C, {
11097
+ }), B.dirty()) : Q.kind === "jwt" ? Ji(A.data, Q.alg) || (C = this._getOrReturnCtx(A, C), F(C, {
11083
11098
  validation: "jwt",
11084
11099
  code: e.invalid_string,
11085
11100
  message: Q.message
11086
- }), B.dirty()) : Q.kind === "cidr" ? Li(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), F(C, {
11101
+ }), B.dirty()) : Q.kind === "cidr" ? Yi(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), F(C, {
11087
11102
  validation: "cidr",
11088
11103
  code: e.invalid_string,
11089
11104
  message: Q.message
11090
- }), B.dirty()) : Q.kind === "base64" ? Si.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11105
+ }), B.dirty()) : Q.kind === "base64" ? Ni.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11091
11106
  validation: "base64",
11092
11107
  code: e.invalid_string,
11093
11108
  message: Q.message
11094
- }), B.dirty()) : Q.kind === "base64url" ? Ri.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11109
+ }), B.dirty()) : Q.kind === "base64url" ? ci.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11095
11110
  validation: "base64url",
11096
11111
  code: e.invalid_string,
11097
11112
  message: Q.message
@@ -11330,7 +11345,7 @@ gA.create = (g) => {
11330
11345
  ...M(g)
11331
11346
  });
11332
11347
  };
11333
- function Ji(g, A) {
11348
+ function di(g, A) {
11334
11349
  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(".", ""));
11335
11350
  return Q % E / Math.pow(10, C);
11336
11351
  }
@@ -11369,7 +11384,7 @@ class eA extends K {
11369
11384
  inclusive: Q.inclusive,
11370
11385
  exact: !1,
11371
11386
  message: Q.message
11372
- }), C.dirty()) : Q.kind === "multipleOf" ? Ji(A.data, Q.value) !== 0 && (B = this._getOrReturnCtx(A, B), F(B, {
11387
+ }), C.dirty()) : Q.kind === "multipleOf" ? di(A.data, Q.value) !== 0 && (B = this._getOrReturnCtx(A, B), F(B, {
11373
11388
  code: e.not_multiple_of,
11374
11389
  multipleOf: Q.value,
11375
11390
  message: Q.message
@@ -11738,7 +11753,7 @@ JA.create = (g) => new JA({
11738
11753
  typeName: J.ZodDate,
11739
11754
  ...M(g)
11740
11755
  });
11741
- class lI extends K {
11756
+ class qI extends K {
11742
11757
  _parse(A) {
11743
11758
  if (this._getType(A) !== S.symbol) {
11744
11759
  const B = this._getOrReturnCtx(A);
@@ -11751,7 +11766,7 @@ class lI extends K {
11751
11766
  return j(A.data);
11752
11767
  }
11753
11768
  }
11754
- lI.create = (g) => new lI({
11769
+ qI.create = (g) => new qI({
11755
11770
  typeName: J.ZodSymbol,
11756
11771
  ...M(g)
11757
11772
  });
@@ -11827,7 +11842,7 @@ yA.create = (g) => new yA({
11827
11842
  typeName: J.ZodNever,
11828
11843
  ...M(g)
11829
11844
  });
11830
- class fI extends K {
11845
+ class lI extends K {
11831
11846
  _parse(A) {
11832
11847
  if (this._getType(A) !== S.undefined) {
11833
11848
  const B = this._getOrReturnCtx(A);
@@ -11840,7 +11855,7 @@ class fI extends K {
11840
11855
  return j(A.data);
11841
11856
  }
11842
11857
  }
11843
- fI.create = (g) => new fI({
11858
+ lI.create = (g) => new lI({
11844
11859
  typeName: J.ZodVoid,
11845
11860
  ...M(g)
11846
11861
  });
@@ -12196,7 +12211,7 @@ class m extends K {
12196
12211
  });
12197
12212
  }
12198
12213
  keyof() {
12199
- return BC(H.objectKeys(this.shape));
12214
+ return IC(H.objectKeys(this.shape));
12200
12215
  }
12201
12216
  }
12202
12217
  m.create = (g, A) => new m({
@@ -12294,7 +12309,7 @@ QI.create = (g, A) => new QI({
12294
12309
  ...M(A)
12295
12310
  });
12296
12311
  const hA = (g) => g instanceof oI ? hA(g.schema) : g instanceof EA ? hA(g.innerType()) : g instanceof aI ? [g.value] : g instanceof nA ? g.options : g instanceof sI ? H.objectValues(g.enum) : g instanceof DI ? hA(g._def.innerType) : g instanceof BI ? [void 0] : g instanceof CI ? [null] : g instanceof aA ? [void 0, ...hA(g.unwrap())] : g instanceof wA ? [null, ...hA(g.unwrap())] : g instanceof fg || g instanceof tI ? hA(g.unwrap()) : g instanceof hI ? hA(g._def.innerType) : [];
12297
- class ZI extends K {
12312
+ class bI extends K {
12298
12313
  _parse(A) {
12299
12314
  const { ctx: I } = this._processInputParams(A);
12300
12315
  if (I.parsedType !== S.object)
@@ -12347,7 +12362,7 @@ class ZI extends K {
12347
12362
  C.set(i, Q);
12348
12363
  }
12349
12364
  }
12350
- return new ZI({
12365
+ return new bI({
12351
12366
  typeName: J.ZodDiscriminatedUnion,
12352
12367
  discriminator: A,
12353
12368
  options: I,
@@ -12511,7 +12526,7 @@ class iI extends K {
12511
12526
  });
12512
12527
  }
12513
12528
  }
12514
- class pI extends K {
12529
+ class fI extends K {
12515
12530
  get keySchema() {
12516
12531
  return this._def.keyType;
12517
12532
  }
@@ -12553,7 +12568,7 @@ class pI extends K {
12553
12568
  }
12554
12569
  }
12555
12570
  }
12556
- pI.create = (g, A, I) => new pI({
12571
+ fI.create = (g, A, I) => new fI({
12557
12572
  valueType: A,
12558
12573
  keyType: g,
12559
12574
  typeName: J.ZodMap,
@@ -12636,13 +12651,13 @@ class qA extends K {
12636
12651
  received: I.parsedType
12637
12652
  }), Y;
12638
12653
  function B(i, o) {
12639
- return HI({
12654
+ return KI({
12640
12655
  data: i,
12641
12656
  path: I.path,
12642
12657
  errorMaps: [
12643
12658
  I.common.contextualErrorMap,
12644
12659
  I.schemaErrorMap,
12645
- KI(),
12660
+ MI(),
12646
12661
  uA
12647
12662
  ].filter((a) => !!a),
12648
12663
  issueData: {
@@ -12652,13 +12667,13 @@ class qA extends K {
12652
12667
  });
12653
12668
  }
12654
12669
  function C(i, o) {
12655
- return HI({
12670
+ return KI({
12656
12671
  data: i,
12657
12672
  path: I.path,
12658
12673
  errorMaps: [
12659
12674
  I.common.contextualErrorMap,
12660
12675
  I.schemaErrorMap,
12661
- KI(),
12676
+ MI(),
12662
12677
  uA
12663
12678
  ].filter((a) => !!a),
12664
12679
  issueData: {
@@ -12759,7 +12774,7 @@ aI.create = (g, A) => new aI({
12759
12774
  typeName: J.ZodLiteral,
12760
12775
  ...M(A)
12761
12776
  });
12762
- function BC(g, A) {
12777
+ function IC(g, A) {
12763
12778
  return new nA({
12764
12779
  values: g,
12765
12780
  typeName: J.ZodEnum,
@@ -12779,7 +12794,7 @@ class nA extends K {
12779
12794
  code: e.invalid_type
12780
12795
  }), Y;
12781
12796
  }
12782
- if (qI(this, VA) || $B(this, VA, new Set(this._def.values)), !qI(this, VA).has(A.data)) {
12797
+ if (HI(this, VA) || zB(this, VA, new Set(this._def.values)), !HI(this, VA).has(A.data)) {
12783
12798
  const I = this._getOrReturnCtx(A), B = this._def.values;
12784
12799
  return F(I, {
12785
12800
  received: I.data,
@@ -12824,7 +12839,7 @@ class nA extends K {
12824
12839
  }
12825
12840
  }
12826
12841
  VA = /* @__PURE__ */ new WeakMap();
12827
- nA.create = BC;
12842
+ nA.create = IC;
12828
12843
  class sI extends K {
12829
12844
  constructor() {
12830
12845
  super(...arguments), vA.set(this, void 0);
@@ -12839,7 +12854,7 @@ class sI extends K {
12839
12854
  code: e.invalid_type
12840
12855
  }), Y;
12841
12856
  }
12842
- if (qI(this, vA) || $B(this, vA, new Set(H.getValidEnumValues(this._def.values))), !qI(this, vA).has(A.data)) {
12857
+ if (HI(this, vA) || zB(this, vA, new Set(H.getValidEnumValues(this._def.values))), !HI(this, vA).has(A.data)) {
12843
12858
  const C = H.objectValues(I);
12844
12859
  return F(B, {
12845
12860
  received: B.data,
@@ -13061,7 +13076,7 @@ hI.create = (g, A) => new hI({
13061
13076
  catchValue: typeof A.catch == "function" ? A.catch : () => A.catch,
13062
13077
  ...M(A)
13063
13078
  });
13064
- class mI extends K {
13079
+ class pI extends K {
13065
13080
  _parse(A) {
13066
13081
  if (this._getType(A) !== S.nan) {
13067
13082
  const B = this._getOrReturnCtx(A);
@@ -13074,11 +13089,11 @@ class mI extends K {
13074
13089
  return { status: "valid", value: A.data };
13075
13090
  }
13076
13091
  }
13077
- mI.create = (g) => new mI({
13092
+ pI.create = (g) => new pI({
13078
13093
  typeName: J.ZodNaN,
13079
13094
  ...M(g)
13080
13095
  });
13081
- const Yi = Symbol("zod_brand");
13096
+ const Mi = Symbol("zod_brand");
13082
13097
  class fg extends K {
13083
13098
  _parse(A) {
13084
13099
  const { ctx: I } = this._processInputParams(A), B = I.data;
@@ -13146,11 +13161,11 @@ tI.create = (g, A) => new tI({
13146
13161
  typeName: J.ZodReadonly,
13147
13162
  ...M(A)
13148
13163
  });
13149
- function LB(g, A) {
13164
+ function UB(g, A) {
13150
13165
  const I = typeof g == "function" ? g(A) : typeof g == "string" ? { message: g } : g;
13151
13166
  return typeof I == "string" ? { message: I } : I;
13152
13167
  }
13153
- function CC(g, A = {}, I) {
13168
+ function gC(g, A = {}, I) {
13154
13169
  return g ? TA.create().superRefine((B, C) => {
13155
13170
  var Q, E;
13156
13171
  const i = g(B);
@@ -13158,26 +13173,26 @@ function CC(g, A = {}, I) {
13158
13173
  return i.then((o) => {
13159
13174
  var a, s;
13160
13175
  if (!o) {
13161
- const h = LB(A, B), t = (s = (a = h.fatal) !== null && a !== void 0 ? a : I) !== null && s !== void 0 ? s : !0;
13176
+ const h = UB(A, B), t = (s = (a = h.fatal) !== null && a !== void 0 ? a : I) !== null && s !== void 0 ? s : !0;
13162
13177
  C.addIssue({ code: "custom", ...h, fatal: t });
13163
13178
  }
13164
13179
  });
13165
13180
  if (!i) {
13166
- const o = LB(A, B), a = (E = (Q = o.fatal) !== null && Q !== void 0 ? Q : I) !== null && E !== void 0 ? E : !0;
13181
+ const o = UB(A, B), a = (E = (Q = o.fatal) !== null && Q !== void 0 ? Q : I) !== null && E !== void 0 ? E : !0;
13167
13182
  C.addIssue({ code: "custom", ...o, fatal: a });
13168
13183
  }
13169
13184
  }) : TA.create();
13170
13185
  }
13171
- const di = {
13186
+ const Ki = {
13172
13187
  object: m.lazycreate
13173
13188
  };
13174
13189
  var J;
13175
13190
  (function(g) {
13176
13191
  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";
13177
13192
  })(J || (J = {}));
13178
- const Mi = (g, A = {
13193
+ const Hi = (g, A = {
13179
13194
  message: `Input not instance of ${g.name}`
13180
- }) => CC((I) => I instanceof g, A), QC = gA.create, EC = eA.create, Ki = mI.create, Hi = GA.create, iC = gI.create, qi = JA.create, li = lI.create, fi = BI.create, pi = CI.create, mi = TA.create, ui = NA.create, Ti = yA.create, xi = fI.create, Wi = QA.create, bi = m.create, Zi = m.strictCreate, Pi = QI.create, Oi = ZI.create, Vi = EI.create, vi = DA.create, Xi = iI.create, ji = pI.create, zi = YA.create, _i = qA.create, $i = oI.create, Ao = aI.create, Io = nA.create, go = sI.create, Bo = xA.create, JB = EA.create, Co = aA.create, Qo = wA.create, Eo = EA.createWithPreprocess, io = FI.create, oo = () => QC().optional(), ao = () => EC().optional(), so = () => iC().optional(), Do = {
13195
+ }) => gC((I) => I instanceof g, A), BC = gA.create, CC = eA.create, qi = pI.create, li = GA.create, QC = gI.create, fi = JA.create, pi = qI.create, mi = BI.create, ui = CI.create, Ti = TA.create, xi = NA.create, Wi = yA.create, bi = lI.create, Zi = QA.create, Pi = m.create, Oi = m.strictCreate, Vi = QI.create, vi = bI.create, Xi = EI.create, ji = DA.create, zi = iI.create, _i = fI.create, $i = YA.create, Ao = qA.create, Io = oI.create, go = aI.create, Bo = nA.create, Co = sI.create, Qo = xA.create, kB = EA.create, Eo = aA.create, io = wA.create, oo = EA.createWithPreprocess, ao = FI.create, so = () => BC().optional(), Do = () => CC().optional(), ho = () => QC().optional(), to = {
13181
13196
  string: (g) => gA.create({ ...g, coerce: !0 }),
13182
13197
  number: (g) => eA.create({ ...g, coerce: !0 }),
13183
13198
  boolean: (g) => gI.create({
@@ -13186,14 +13201,14 @@ const Mi = (g, A = {
13186
13201
  }),
13187
13202
  bigint: (g) => GA.create({ ...g, coerce: !0 }),
13188
13203
  date: (g) => JA.create({ ...g, coerce: !0 })
13189
- }, ho = Y;
13204
+ }, yo = Y;
13190
13205
  var D = /* @__PURE__ */ Object.freeze({
13191
13206
  __proto__: null,
13192
13207
  defaultErrorMap: uA,
13193
- setErrorMap: Ei,
13194
- getErrorMap: KI,
13195
- makeIssue: HI,
13196
- EMPTY_PATH: ii,
13208
+ setErrorMap: oi,
13209
+ getErrorMap: MI,
13210
+ makeIssue: KI,
13211
+ EMPTY_PATH: ai,
13197
13212
  addIssueToContext: F,
13198
13213
  ParseStatus: X,
13199
13214
  INVALID: Y,
@@ -13212,27 +13227,27 @@ var D = /* @__PURE__ */ Object.freeze({
13212
13227
  ZodParsedType: S,
13213
13228
  getParsedType: tA,
13214
13229
  ZodType: K,
13215
- datetimeRegex: gC,
13230
+ datetimeRegex: AC,
13216
13231
  ZodString: gA,
13217
13232
  ZodNumber: eA,
13218
13233
  ZodBigInt: GA,
13219
13234
  ZodBoolean: gI,
13220
13235
  ZodDate: JA,
13221
- ZodSymbol: lI,
13236
+ ZodSymbol: qI,
13222
13237
  ZodUndefined: BI,
13223
13238
  ZodNull: CI,
13224
13239
  ZodAny: TA,
13225
13240
  ZodUnknown: NA,
13226
13241
  ZodNever: yA,
13227
- ZodVoid: fI,
13242
+ ZodVoid: lI,
13228
13243
  ZodArray: QA,
13229
13244
  ZodObject: m,
13230
13245
  ZodUnion: QI,
13231
- ZodDiscriminatedUnion: ZI,
13246
+ ZodDiscriminatedUnion: bI,
13232
13247
  ZodIntersection: EI,
13233
13248
  ZodTuple: DA,
13234
13249
  ZodRecord: iI,
13235
- ZodMap: pI,
13250
+ ZodMap: fI,
13236
13251
  ZodSet: YA,
13237
13252
  ZodFunction: qA,
13238
13253
  ZodLazy: oI,
@@ -13246,64 +13261,64 @@ var D = /* @__PURE__ */ Object.freeze({
13246
13261
  ZodNullable: wA,
13247
13262
  ZodDefault: DI,
13248
13263
  ZodCatch: hI,
13249
- ZodNaN: mI,
13250
- BRAND: Yi,
13264
+ ZodNaN: pI,
13265
+ BRAND: Mi,
13251
13266
  ZodBranded: fg,
13252
13267
  ZodPipeline: FI,
13253
13268
  ZodReadonly: tI,
13254
- custom: CC,
13269
+ custom: gC,
13255
13270
  Schema: K,
13256
13271
  ZodSchema: K,
13257
- late: di,
13272
+ late: Ki,
13258
13273
  get ZodFirstPartyTypeKind() {
13259
13274
  return J;
13260
13275
  },
13261
- coerce: Do,
13262
- any: mi,
13263
- array: Wi,
13264
- bigint: Hi,
13265
- boolean: iC,
13266
- date: qi,
13267
- discriminatedUnion: Oi,
13268
- effect: JB,
13269
- enum: Io,
13270
- function: _i,
13271
- instanceof: Mi,
13272
- intersection: Vi,
13273
- lazy: $i,
13274
- literal: Ao,
13275
- map: ji,
13276
- nan: Ki,
13277
- nativeEnum: go,
13278
- never: Ti,
13279
- null: pi,
13280
- nullable: Qo,
13281
- number: EC,
13282
- object: bi,
13283
- oboolean: so,
13284
- onumber: ao,
13285
- optional: Co,
13286
- ostring: oo,
13287
- pipeline: io,
13288
- preprocess: Eo,
13289
- promise: Bo,
13290
- record: Xi,
13291
- set: zi,
13292
- strictObject: Zi,
13293
- string: QC,
13294
- symbol: li,
13295
- transformer: JB,
13296
- tuple: vi,
13297
- undefined: fi,
13298
- union: Pi,
13299
- unknown: ui,
13300
- void: xi,
13301
- NEVER: ho,
13276
+ coerce: to,
13277
+ any: Ti,
13278
+ array: Zi,
13279
+ bigint: li,
13280
+ boolean: QC,
13281
+ date: fi,
13282
+ discriminatedUnion: vi,
13283
+ effect: kB,
13284
+ enum: Bo,
13285
+ function: Ao,
13286
+ instanceof: Hi,
13287
+ intersection: Xi,
13288
+ lazy: Io,
13289
+ literal: go,
13290
+ map: _i,
13291
+ nan: qi,
13292
+ nativeEnum: Co,
13293
+ never: Wi,
13294
+ null: ui,
13295
+ nullable: io,
13296
+ number: CC,
13297
+ object: Pi,
13298
+ oboolean: ho,
13299
+ onumber: Do,
13300
+ optional: Eo,
13301
+ ostring: so,
13302
+ pipeline: ao,
13303
+ preprocess: oo,
13304
+ promise: Qo,
13305
+ record: zi,
13306
+ set: $i,
13307
+ strictObject: Oi,
13308
+ string: BC,
13309
+ symbol: pi,
13310
+ transformer: kB,
13311
+ tuple: ji,
13312
+ undefined: mi,
13313
+ union: Vi,
13314
+ unknown: xi,
13315
+ void: bi,
13316
+ NEVER: yo,
13302
13317
  ZodIssueCode: e,
13303
- quotelessJson: Qi,
13318
+ quotelessJson: ii,
13304
13319
  ZodError: $
13305
13320
  });
13306
- const to = D.object({
13321
+ const eo = D.object({
13307
13322
  /**The multiscale datasets for this image*/
13308
13323
  multiscales: D.array(
13309
13324
  D.object({
@@ -13431,7 +13446,7 @@ const to = D.object({
13431
13446
  projection: D.string().optional()
13432
13447
  }).optional()
13433
13448
  }).optional()
13434
- }).describe("JSON from OME-NGFF .zattrs"), yo = D.object({
13449
+ }).describe("JSON from OME-NGFF .zattrs"), Go = D.object({
13435
13450
  plate: D.object({
13436
13451
  /**The acquisitions for this plate*/
13437
13452
  acquisitions: D.array(
@@ -13490,7 +13505,7 @@ const to = D.object({
13490
13505
  })
13491
13506
  ).min(1).describe("The wells of the plate")
13492
13507
  }).optional()
13493
- }).describe("JSON from OME-NGFF .zattrs"), eo = D.object({
13508
+ }).describe("JSON from OME-NGFF .zattrs"), no = D.object({
13494
13509
  well: D.object({
13495
13510
  /**The fields of view for this well*/
13496
13511
  images: D.array(
@@ -13504,7 +13519,7 @@ const to = D.object({
13504
13519
  /**The version of the specification*/
13505
13520
  version: D.literal("0.4").describe("The version of the specification").optional()
13506
13521
  }).optional()
13507
- }).describe("JSON from OME-NGFF .zattrs"), Go = D.object({
13522
+ }).describe("JSON from OME-NGFF .zattrs"), wo = D.object({
13508
13523
  /**The versioned OME-Zarr Metadata namespace*/
13509
13524
  ome: D.object({
13510
13525
  /**The multiscale datasets for this image*/
@@ -13634,7 +13649,7 @@ const to = D.object({
13634
13649
  /**The version of the OME-Zarr Metadata*/
13635
13650
  version: D.literal("0.5").describe("The version of the OME-Zarr Metadata")
13636
13651
  }).describe("The versioned OME-Zarr Metadata namespace")
13637
- }).describe("The zarr.json attributes key"), no = D.object({
13652
+ }).describe("The zarr.json attributes key"), Fo = D.object({
13638
13653
  /**The versioned OME-Zarr Metadata namespace*/
13639
13654
  ome: D.object({
13640
13655
  plate: D.object({
@@ -13696,7 +13711,7 @@ const to = D.object({
13696
13711
  /**The version of the OME-Zarr Metadata*/
13697
13712
  version: D.literal("0.5").describe("The version of the OME-Zarr Metadata")
13698
13713
  }).describe("The versioned OME-Zarr Metadata namespace")
13699
- }).describe("The zarr.json attributes key"), wo = D.object({
13714
+ }).describe("The zarr.json attributes key"), ro = D.object({
13700
13715
  /**The versioned OME-Zarr Metadata namespace*/
13701
13716
  ome: D.object({
13702
13717
  well: D.object({
@@ -13715,15 +13730,15 @@ const to = D.object({
13715
13730
  /**The version of the OME-Zarr Metadata*/
13716
13731
  version: D.literal("0.5").describe("The version of the OME-Zarr Metadata")
13717
13732
  }).describe("The versioned OME-Zarr Metadata namespace")
13718
- }).describe("JSON from OME-Zarr zarr.json"), Fo = ["0.4", "0.5"], ro = new Set(Fo);
13719
- function So(g) {
13733
+ }).describe("JSON from OME-Zarr zarr.json"), So = ["0.4", "0.5"], Ro = new Set(So);
13734
+ function No(g) {
13720
13735
  if (!("ome" in g) || !(g.ome instanceof Object)) return;
13721
13736
  const A = g.ome;
13722
- if ("version" in A && typeof A.version == "string" && ro.has(A.version))
13737
+ if ("version" in A && typeof A.version == "string" && Ro.has(A.version))
13723
13738
  return A.version;
13724
13739
  }
13725
13740
  function pg(g) {
13726
- const A = So(g);
13741
+ const A = No(g);
13727
13742
  return A === void 0 ? "0.4" : A;
13728
13743
  }
13729
13744
  function WA(g) {
@@ -13735,14 +13750,14 @@ function WA(g) {
13735
13750
  return "v3";
13736
13751
  }
13737
13752
  }
13738
- function oC(g, A) {
13753
+ function EC(g, A) {
13739
13754
  const I = { ...g };
13740
13755
  return delete I[A], I;
13741
13756
  }
13742
- async function bo(g, A) {
13757
+ async function Po(g, A) {
13743
13758
  const I = new PA(g), B = new z(I), C = WA(A), Q = await wI(B, C);
13744
13759
  try {
13745
- return Ro(Q.attrs);
13760
+ return co(Q.attrs);
13746
13761
  } catch {
13747
13762
  throw Error(
13748
13763
  `Failed to parse OME-Zarr plate:
@@ -13750,58 +13765,58 @@ ${JSON.stringify(Q.attrs)}`
13750
13765
  );
13751
13766
  }
13752
13767
  }
13753
- function Ro(g) {
13768
+ function co(g) {
13754
13769
  switch (pg(g)) {
13755
13770
  case "0.5":
13756
13771
  return {
13757
- ...no.parse(g).ome,
13772
+ ...Fo.parse(g).ome,
13758
13773
  originalVersion: "0.5"
13759
13774
  };
13760
13775
  case "0.4":
13761
13776
  return {
13762
- ...No(yo.parse(g)).ome,
13777
+ ...Uo(Go.parse(g)).ome,
13763
13778
  originalVersion: "0.4"
13764
13779
  };
13765
13780
  }
13766
13781
  }
13767
- function No(g) {
13782
+ function Uo(g) {
13768
13783
  if (g.plate === void 0)
13769
13784
  throw new Error("Plate metadata is missing in OME-Zarr v0.4 plate");
13770
13785
  return {
13771
13786
  ome: {
13772
- plate: oC(g.plate, "version"),
13787
+ plate: EC(g.plate, "version"),
13773
13788
  version: "0.5"
13774
13789
  }
13775
13790
  };
13776
13791
  }
13777
- function co(g) {
13792
+ function ko(g) {
13778
13793
  if (g.well === void 0)
13779
13794
  throw new Error("Well metadata is missing in OME-Zarr v0.4 well");
13780
13795
  return {
13781
13796
  ome: {
13782
- well: oC(g.well, "version"),
13797
+ well: EC(g.well, "version"),
13783
13798
  version: "0.5"
13784
13799
  }
13785
13800
  };
13786
13801
  }
13787
- function Uo(g) {
13802
+ function Lo(g) {
13788
13803
  switch (pg(g)) {
13789
13804
  case "0.5":
13790
13805
  return {
13791
- ...wo.parse(g).ome,
13806
+ ...ro.parse(g).ome,
13792
13807
  originalVersion: "0.5"
13793
13808
  };
13794
13809
  case "0.4":
13795
13810
  return {
13796
- ...co(eo.parse(g)).ome,
13811
+ ...ko(no.parse(g)).ome,
13797
13812
  originalVersion: "0.4"
13798
13813
  };
13799
13814
  }
13800
13815
  }
13801
- async function Zo(g, A, I) {
13816
+ async function Oo(g, A, I) {
13802
13817
  const B = g + "/" + A, C = new PA(B), Q = new z(C), E = WA(I), i = await wI(Q, E);
13803
13818
  try {
13804
- return Uo(i.attrs);
13819
+ return Lo(i.attrs);
13805
13820
  } catch {
13806
13821
  throw Error(
13807
13822
  `Failed to parse OME-Zarr well:
@@ -13809,15 +13824,15 @@ ${JSON.stringify(i.attrs)}`
13809
13824
  );
13810
13825
  }
13811
13826
  }
13812
- async function Po(g) {
13827
+ async function Vo(g) {
13813
13828
  const A = WA(g.version), I = await wI(g.location, A);
13814
13829
  return mg(I.attrs).omero?.channels ?? [];
13815
13830
  }
13816
- async function Oo(g) {
13831
+ async function vo(g) {
13817
13832
  const A = WA(g.version), I = await wI(g.location, A);
13818
13833
  return mg(I.attrs).omero?.rdefs;
13819
13834
  }
13820
- function ko(g) {
13835
+ function Jo(g) {
13821
13836
  return {
13822
13837
  ome: {
13823
13838
  multiscales: g.multiscales,
@@ -13826,23 +13841,23 @@ function ko(g) {
13826
13841
  }
13827
13842
  };
13828
13843
  }
13829
- function Lo(g) {
13844
+ function Yo(g) {
13830
13845
  switch (pg(g)) {
13831
13846
  case "0.5":
13832
13847
  return {
13833
- ...Go.parse(g).ome,
13848
+ ...wo.parse(g).ome,
13834
13849
  originalVersion: "0.5"
13835
13850
  };
13836
13851
  case "0.4":
13837
13852
  return {
13838
- ...ko(to.parse(g)).ome,
13853
+ ...Jo(eo.parse(g)).ome,
13839
13854
  originalVersion: "0.4"
13840
13855
  };
13841
13856
  }
13842
13857
  }
13843
13858
  function mg(g) {
13844
13859
  try {
13845
- return Lo(g);
13860
+ return Yo(g);
13846
13861
  } catch {
13847
13862
  throw Error(`Failed to parse OME-Zarr image:
13848
13863
  ${JSON.stringify(g)}`);
@@ -13866,15 +13881,15 @@ class NI {
13866
13881
  throw new Error("No datasets found in the multiscale image.");
13867
13882
  A || (A = WA(B.originalVersion));
13868
13883
  const E = Q.datasets.map(
13869
- (s) => OE(this.location, s.path, A)
13884
+ (s) => vE(this.location, s.path, A)
13870
13885
  ), i = await Promise.all(
13871
- E.map((s) => PE(s))
13886
+ E.map((s) => VE(s))
13872
13887
  ), o = i[0].shape, a = Q.axes;
13873
13888
  if (a.length !== o.length)
13874
13889
  throw new Error(
13875
13890
  `Mismatch between number of axes (${a.length}) and array shape (${o.length})`
13876
13891
  );
13877
- return new Bi({
13892
+ return new Qi({
13878
13893
  metadata: Q,
13879
13894
  arrays: i,
13880
13895
  arrayParams: E
@@ -13927,7 +13942,7 @@ class NI {
13927
13942
  });
13928
13943
  }
13929
13944
  }
13930
- const aC = [
13945
+ const iC = [
13931
13946
  "fallbackVisible",
13932
13947
  "prefetchTime",
13933
13948
  "visibleCurrent",
@@ -13935,14 +13950,14 @@ const aC = [
13935
13950
  "prefetchSpace"
13936
13951
  ];
13937
13952
  function ug(g) {
13938
- Jo(g);
13953
+ Mo(g);
13939
13954
  const A = {
13940
13955
  x: g.prefetch.x,
13941
13956
  y: g.prefetch.y,
13942
13957
  z: g.prefetch.z ?? 0,
13943
13958
  t: g.prefetch.t ?? 0
13944
13959
  }, I = Object.freeze(
13945
- aC.reduce(
13960
+ iC.reduce(
13946
13961
  (Q, E) => {
13947
13962
  const i = g.priorityOrder.indexOf(E);
13948
13963
  return Q[E] = i, Q;
@@ -13962,7 +13977,7 @@ function ug(g) {
13962
13977
  };
13963
13978
  return Object.freeze(C);
13964
13979
  }
13965
- function Vo(g = {}) {
13980
+ function Xo(g = {}) {
13966
13981
  return ug(Tg({
13967
13982
  profile: "exploration",
13968
13983
  prefetch: { x: 1, y: 1, z: 1, t: 0 },
@@ -13975,7 +13990,7 @@ function Vo(g = {}) {
13975
13990
  ]
13976
13991
  }, g));
13977
13992
  }
13978
- function vo(g = {}) {
13993
+ function jo(g = {}) {
13979
13994
  return ug(Tg({
13980
13995
  profile: "playback",
13981
13996
  prefetch: { x: 0, y: 0, z: 0, t: 20 },
@@ -13988,7 +14003,7 @@ function vo(g = {}) {
13988
14003
  ]
13989
14004
  }, g));
13990
14005
  }
13991
- function Xo(g = {}) {
14006
+ function zo(g = {}) {
13992
14007
  return ug(Tg({
13993
14008
  profile: "no-prefetch",
13994
14009
  prefetch: { x: 0, y: 0, z: 0, t: 0 },
@@ -14001,7 +14016,7 @@ function Xo(g = {}) {
14001
14016
  ]
14002
14017
  }, g));
14003
14018
  }
14004
- function Jo(g) {
14019
+ function Mo(g) {
14005
14020
  for (const [B, C] of Object.entries(g.prefetch))
14006
14021
  if (C !== void 0 && C < 0)
14007
14022
  throw new Error(`prefetch.${B} must be a non-negative number`);
@@ -14009,7 +14024,7 @@ function Jo(g) {
14009
14024
  if (A?.min !== void 0 && A?.max !== void 0 && A.min > A.max)
14010
14025
  throw new Error("lod.min must be <= lod.max");
14011
14026
  const I = g.priorityOrder;
14012
- if (I.length !== aC.length || new Set(I).size !== I.length)
14027
+ if (I.length !== iC.length || new Set(I).size !== I.length)
14013
14028
  throw new Error("priorityOrder must include all categories exactly once");
14014
14029
  }
14015
14030
  function Tg(g, A = {}) {
@@ -14020,7 +14035,7 @@ function Tg(g, A = {}) {
14020
14035
  priorityOrder: A.priorityOrder ?? g.priorityOrder
14021
14036
  };
14022
14037
  }
14023
- class jo extends ZA {
14038
+ class _o extends ZA {
14024
14039
  atlas_;
14025
14040
  constructor(A, I) {
14026
14041
  super(), this.programName = "points", this.atlas_ = I, A.forEach((Q) => {
@@ -14064,41 +14079,41 @@ class jo extends ZA {
14064
14079
  }
14065
14080
  }
14066
14081
  export {
14067
- lo as AxesLayer,
14082
+ po as AxesLayer,
14068
14083
  AA as Box2,
14069
14084
  RA as Box3,
14070
- uB as ChunkedImageLayer,
14085
+ pB as ChunkedImageLayer,
14071
14086
  l as Color,
14072
- NQ as Frustum,
14073
- Yo as Idetik,
14074
- uo as ImageLayer,
14075
- xo as ImageSeriesLayer,
14076
- To as LabelImageLayer,
14087
+ SQ as Frustum,
14088
+ Ko as Idetik,
14089
+ xo as ImageLayer,
14090
+ bo as ImageSeriesLayer,
14091
+ Wo as LabelImageLayer,
14077
14092
  FA as Layer,
14078
- hQ as LayerManager,
14093
+ sQ as LayerManager,
14079
14094
  NI as OmeZarrImageSource,
14080
- qo as OrbitControls,
14081
- Mo as OrthographicCamera,
14082
- Ho as PanZoomControls,
14083
- Ko as PerspectiveCamera,
14095
+ fo as OrbitControls,
14096
+ Ho as OrthographicCamera,
14097
+ lo as PanZoomControls,
14098
+ qo as PerspectiveCamera,
14084
14099
  dA as Plane,
14085
- jo as Points,
14086
- fo as ProjectedLineLayer,
14100
+ _o as Points,
14101
+ mo as ProjectedLineLayer,
14087
14102
  IB as Spherical,
14088
14103
  yI as Texture2DArray,
14089
14104
  jA as Texture3D,
14090
- po as TracksLayer,
14091
- GQ as Viewport,
14092
- mo as VolumeLayer,
14093
- CQ as WebGLRenderer,
14094
- Vo as createExplorationPolicy,
14105
+ uo as TracksLayer,
14106
+ yQ as Viewport,
14107
+ To as VolumeLayer,
14108
+ gQ as WebGLRenderer,
14109
+ Xo as createExplorationPolicy,
14095
14110
  ug as createImageSourcePolicy,
14096
- Xo as createNoPrefetchPolicy,
14097
- vo as createPlaybackPolicy,
14098
- bo as loadOmeZarrPlate,
14099
- Zo as loadOmeZarrWell,
14100
- Po as loadOmeroChannels,
14101
- Oo as loadOmeroDefaults,
14102
- wQ as parseViewportConfigs
14111
+ zo as createNoPrefetchPolicy,
14112
+ jo as createPlaybackPolicy,
14113
+ Po as loadOmeZarrPlate,
14114
+ Oo as loadOmeZarrWell,
14115
+ Vo as loadOmeroChannels,
14116
+ vo as loadOmeroDefaults,
14117
+ GQ as parseViewportConfigs
14103
14118
  };
14104
14119
  //# sourceMappingURL=index.js.map