@idetik/core 0.13.3 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 oC {
69
+ class sC {
70
70
  canvas_;
71
71
  width_ = 0;
72
72
  height_ = 0;
@@ -100,7 +100,7 @@ class oC {
100
100
  this.backgroundColor_ = l.from(A);
101
101
  }
102
102
  }
103
- var aC = `#version 300 es
103
+ var DC = `#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
- }`, sC = `#version 300 es
169
+ }`, hC = `#version 300 es
170
170
 
171
171
  precision mediump float;
172
172
 
@@ -253,7 +253,7 @@ void main() {
253
253
  rgbColor += value * Color[i];
254
254
  }
255
255
  fragColor = vec4(rgbColor, u_opacity);
256
- }`, DC = `#version 300 es
256
+ }`, tC = `#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
- }`, hC = `#version 300 es
276
+ }`, yC = `#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
- }`, tC = `#version 300 es
296
+ }`, eC = `#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
- }`, yC = `#version 300 es
306
+ }`, GC = `#version 300 es
307
307
 
308
308
  precision mediump float;
309
309
 
@@ -468,7 +468,7 @@ void main() {
468
468
  }
469
469
 
470
470
  fragColor = accumulatedColor;
471
- }`, eC = `#version 300 es
471
+ }`, nC = `#version 300 es
472
472
 
473
473
  precision mediump float;
474
474
  precision highp int;
@@ -558,19 +558,19 @@ void main() {
558
558
 
559
559
  fragColor = vec4(color.rgb, alpha);
560
560
  }`;
561
- const GC = {
561
+ const wC = {
562
562
  projectedLine: {
563
- vertex: aC,
564
- fragment: sC
565
- },
566
- points: {
567
563
  vertex: DC,
568
564
  fragment: hC
569
565
  },
570
- wireframe: {
566
+ points: {
571
567
  vertex: tC,
572
568
  fragment: yC
573
569
  },
570
+ wireframe: {
571
+ vertex: eC,
572
+ fragment: GC
573
+ },
574
574
  floatScalarImage: {
575
575
  vertex: rA,
576
576
  fragment: ZI
@@ -601,7 +601,7 @@ const GC = {
601
601
  },
602
602
  labelImage: {
603
603
  vertex: rA,
604
- fragment: eC
604
+ fragment: nC
605
605
  },
606
606
  floatVolume: {
607
607
  vertex: OI,
@@ -622,7 +622,7 @@ const GC = {
622
622
  info: 20,
623
623
  warn: 30,
624
624
  error: 40
625
- }, nC = {
625
+ }, FC = {
626
626
  debug: "\x1B[90m",
627
627
  // gray
628
628
  info: "\x1B[36m",
@@ -632,7 +632,7 @@ const GC = {
632
632
  error: "\x1B[31m"
633
633
  // red
634
634
  };
635
- function wC() {
635
+ function rC() {
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 wC() {
644
644
  return "development";
645
645
  }
646
646
  class U {
647
- static logLevel_ = wC() === "production" ? "warn" : "debug";
647
+ static logLevel_ = rC() === "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 = nC[A], i = `[${Q}][${A.toUpperCase()}][${I}]`, o = [`${E}${i}`, B, ...C];
665
+ const Q = (/* @__PURE__ */ new Date()).toISOString(), E = FC[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 FC {
682
+ class SC {
683
683
  gl_;
684
684
  program_;
685
685
  uniformInfo_ = /* @__PURE__ */ new Map();
@@ -761,7 +761,7 @@ class FC {
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 (!SC.has(B.type))
764
+ if (!NC.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 FC {
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
- ] : [], SC = new Set(
831
- rC
830
+ ] : [], NC = new Set(
831
+ RC
832
832
  ), vI = "#pragma inject_defines";
833
- class RC {
833
+ class cC {
834
834
  gl_;
835
835
  programs_ = /* @__PURE__ */ new Map();
836
836
  constructor(A) {
@@ -839,14 +839,14 @@ class RC {
839
839
  use(A) {
840
840
  let I = this.programs_.get(A);
841
841
  if (I === void 0) {
842
- const B = GC[A], C = Pg(
842
+ const B = wC[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 FC(
849
+ I = new SC(
850
850
  this.gl_,
851
851
  C,
852
852
  Q
@@ -1129,74 +1129,74 @@ const v = [
1129
1129
  "fe",
1130
1130
  "ff"
1131
1131
  ];
1132
- function LB() {
1132
+ function JB() {
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 = LB();
1137
+ uuid = JB();
1138
1138
  }
1139
- var p = 1e-6, b = typeof Float32Array < "u" ? Float32Array : Array, NC = Math.PI / 180;
1140
- function cC(g) {
1141
- return g * NC;
1139
+ var p = 1e-6, P = typeof Float32Array < "u" ? Float32Array : Array, UC = Math.PI / 180;
1140
+ function kC(g) {
1141
+ return g * UC;
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 JB() {
1149
- var g = new b(9);
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;
1148
+ function YB() {
1149
+ var g = new P(9);
1150
+ return P != Float32Array && (g[1] = 0, g[2] = 0, g[3] = 0, g[5] = 0, g[6] = 0, g[7] = 0), g[0] = 1, g[4] = 1, g[8] = 1, g;
1151
1151
  }
1152
- function UC(g, A) {
1152
+ function LC(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
- var g = new b(16);
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;
1156
+ var g = new P(16);
1157
+ return P != 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
1159
  function mI(g, A) {
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
- 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;
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, R = I * o - C * E, Y = I * a - Q * E, k = B * o - C * i, L = B * a - Q * i, m = C * a - Q * o, x = s * w - h * n, b = s * r - t * n, O = s * G - y * n, V = h * r - t * w, iA = h * G - y * w, oA = t * G - y * r, T = c * oA - R * iA + Y * V + k * O - L * b + m * x;
1161
+ return T ? (T = 1 / T, g[0] = (i * oA - o * iA + a * V) * T, g[1] = (C * iA - B * oA - Q * V) * T, g[2] = (w * m - r * L + G * k) * T, g[3] = (t * L - h * m - y * k) * T, g[4] = (o * O - E * oA - a * b) * T, g[5] = (I * oA - C * O + Q * b) * T, g[6] = (r * Y - n * m - G * R) * T, g[7] = (s * m - t * Y + y * R) * T, g[8] = (E * iA - i * O + a * x) * T, g[9] = (B * O - I * iA - Q * x) * T, g[10] = (n * L - w * Y + G * c) * T, g[11] = (h * Y - s * L - y * c) * T, g[12] = (i * b - E * V - o * x) * T, g[13] = (I * V - B * b + C * x) * T, g[14] = (w * R - n * k - r * c) * T, g[15] = (s * k - h * R + t * c) * T, g) : null;
1162
1162
  }
1163
1163
  function zA(g, A, I) {
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
- 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;
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], R = I[0], Y = I[1], k = I[2], L = I[3];
1165
+ return g[0] = R * B + Y * i + k * h + L * w, g[1] = R * C + Y * o + k * t + L * r, g[2] = R * Q + Y * a + k * y + L * G, g[3] = R * E + Y * s + k * n + L * c, R = I[4], Y = I[5], k = I[6], L = I[7], g[4] = R * B + Y * i + k * h + L * w, g[5] = R * C + Y * o + k * t + L * r, g[6] = R * Q + Y * a + k * y + L * G, g[7] = R * E + Y * s + k * n + L * c, R = I[8], Y = I[9], k = I[10], L = I[11], g[8] = R * B + Y * i + k * h + L * w, g[9] = R * C + Y * o + k * t + L * r, g[10] = R * Q + Y * a + k * y + L * G, g[11] = R * E + Y * s + k * n + L * c, R = I[12], Y = I[13], k = I[14], L = I[15], g[12] = R * B + Y * i + k * h + L * w, g[13] = R * C + Y * o + k * t + L * r, g[14] = R * Q + Y * a + k * y + L * G, g[15] = R * E + Y * s + k * n + L * c, g;
1166
1166
  }
1167
- function kC(g, A) {
1167
+ function JC(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 LC(g, A, I, B) {
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
- 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;
1170
+ function YC(g, A, I, B) {
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, R = i * s, Y = B[0], k = B[1], L = B[2];
1172
+ return g[0] = (1 - (n + r)) * Y, g[1] = (t + R) * Y, g[2] = (y - c) * Y, g[3] = 0, g[4] = (t - R) * k, g[5] = (1 - (h + r)) * k, g[6] = (w + G) * k, g[7] = 0, g[8] = (y + c) * L, g[9] = (w - G) * L, g[10] = (1 - (h + n)) * L, g[11] = 0, g[12] = I[0], g[13] = I[1], g[14] = I[2], g[15] = 1, g;
1173
1173
  }
1174
- function JC(g, A, I, B, C) {
1174
+ function dC(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 YC = JC;
1179
- function dC(g, A, I, B, C, Q, E) {
1178
+ var MC = dC;
1179
+ function KC(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 MC = dC;
1184
- function KC(g, A, I, B) {
1183
+ var HC = KC;
1184
+ function qC(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 HC(g, A) {
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
- 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));
1190
+ function lC(g, A) {
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], R = A[1], Y = A[2], k = A[3], L = A[4], m = A[5], x = A[6], b = A[7], O = A[8], V = A[9], iA = A[10], oA = A[11], T = A[12], xg = A[13], Wg = A[14], bg = A[15];
1192
+ return Math.abs(I - c) <= p * Math.max(1, Math.abs(I), Math.abs(c)) && Math.abs(B - R) <= p * Math.max(1, Math.abs(B), Math.abs(R)) && Math.abs(C - Y) <= p * Math.max(1, Math.abs(C), Math.abs(Y)) && Math.abs(Q - k) <= p * Math.max(1, Math.abs(Q), Math.abs(k)) && Math.abs(E - L) <= p * Math.max(1, Math.abs(E), Math.abs(L)) && Math.abs(i - m) <= p * Math.max(1, Math.abs(i), Math.abs(m)) && Math.abs(o - x) <= p * Math.max(1, Math.abs(o), Math.abs(x)) && Math.abs(a - b) <= p * Math.max(1, Math.abs(a), Math.abs(b)) && Math.abs(s - O) <= p * Math.max(1, Math.abs(s), Math.abs(O)) && Math.abs(h - V) <= p * Math.max(1, Math.abs(h), Math.abs(V)) && Math.abs(t - 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 - T) <= p * Math.max(1, Math.abs(n), Math.abs(T)) && Math.abs(w - xg) <= p * Math.max(1, Math.abs(w), Math.abs(xg)) && Math.abs(r - Wg) <= p * Math.max(1, Math.abs(r), Math.abs(Wg)) && Math.abs(G - bg) <= p * Math.max(1, Math.abs(G), Math.abs(bg));
1193
1193
  }
1194
1194
  function f() {
1195
- var g = new b(3);
1196
- return b != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0), g;
1195
+ var g = new P(3);
1196
+ return P != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0), g;
1197
1197
  }
1198
1198
  function BA(g) {
1199
- var A = new b(3);
1199
+ var A = new P(3);
1200
1200
  return A[0] = g[0], A[1] = g[1], A[2] = g[2], A;
1201
1201
  }
1202
1202
  function eg(g) {
@@ -1204,7 +1204,7 @@ function eg(g) {
1204
1204
  return Math.hypot(A, I, B);
1205
1205
  }
1206
1206
  function q(g, A, I) {
1207
- var B = new b(3);
1207
+ var B = new P(3);
1208
1208
  return B[0] = g, B[1] = A, B[2] = I, B;
1209
1209
  }
1210
1210
  function HA(g, A) {
@@ -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 qC(g, A, I) {
1219
+ function fC(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 lC(g, A, I) {
1222
+ function pC(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,18 +1236,18 @@ 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 fC(g, A) {
1239
+ function mC(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 YB(g, A) {
1243
+ function dB(g, A) {
1244
1244
  return g[0] * A[0] + g[1] * A[1] + g[2] * A[2];
1245
1245
  }
1246
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 pC(g, A, I, B, C, Q) {
1250
+ function uC(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
  }
@@ -1255,14 +1255,14 @@ 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 mC(g) {
1258
+ function TC(g) {
1259
1259
  return g[0] = 0, g[1] = 0, g[2] = 0, g;
1260
1260
  }
1261
- function dB(g, A) {
1261
+ function MB(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 = qC, uC = eg;
1265
+ var UI = fC, xC = eg;
1266
1266
  (function() {
1267
1267
  var g = f();
1268
1268
  return function(A, I, B, C, Q, E) {
@@ -1273,24 +1273,24 @@ var UI = qC, uC = eg;
1273
1273
  };
1274
1274
  })();
1275
1275
  function pA() {
1276
- var g = new b(4);
1277
- return b != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0, g[3] = 0), g;
1276
+ var g = new P(4);
1277
+ return P != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0, g[3] = 0), g;
1278
1278
  }
1279
- function TC(g) {
1280
- var A = new b(4);
1279
+ function WC(g) {
1280
+ var A = new P(4);
1281
1281
  return A[0] = g[0], A[1] = g[1], A[2] = g[2], A[3] = g[3], A;
1282
1282
  }
1283
1283
  function kI(g, A, I, B) {
1284
- var C = new b(4);
1284
+ var C = new P(4);
1285
1285
  return C[0] = g, C[1] = A, C[2] = I, C[3] = B, C;
1286
1286
  }
1287
- function xC(g, A) {
1287
+ function bC(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 WC(g, A, I) {
1290
+ function ZC(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 bC(g, A) {
1293
+ function PC(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
  }
@@ -1308,15 +1308,15 @@ function _A(g, A, I) {
1308
1308
  };
1309
1309
  })();
1310
1310
  function Cg() {
1311
- var g = new b(4);
1312
- return b != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0), g[3] = 1, g;
1311
+ var g = new P(4);
1312
+ return P != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0), g[3] = 1, g;
1313
1313
  }
1314
- function ZC(g, A, I) {
1314
+ function OC(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 PC(g, A, I) {
1319
+ function VC(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
  }
@@ -1324,7 +1324,7 @@ 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 MB(g, A) {
1327
+ function KB(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,12 +1336,12 @@ function MB(g, A) {
1336
1336
  }
1337
1337
  return g;
1338
1338
  }
1339
- var OC = TC, VC = xC, Gg = bC;
1339
+ var vC = WC, XC = bC, Gg = PC;
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 = 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));
1343
+ var E = dB(C, Q);
1344
+ return E < -0.999999 ? (XI(g, A, C), xC(g) < 1e-6 && XI(g, I, C), mC(g, g), OC(B, g, Math.PI), B) : E > 0.999999 ? (B[0] = 0, B[1] = 0, B[2] = 0, B[3] = 1, B) : (XI(g, C, Q), B[0] = g[0], B[1] = g[1], B[2] = g[2], B[3] = 1 + E, Gg(B, B));
1345
1345
  };
1346
1346
  })();
1347
1347
  (function() {
@@ -1351,32 +1351,32 @@ var OC = TC, VC = xC, Gg = bC;
1351
1351
  };
1352
1352
  })();
1353
1353
  (function() {
1354
- var g = JB();
1354
+ var g = YB();
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, MB(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, KB(A, g));
1357
1357
  };
1358
1358
  })();
1359
- function KB() {
1360
- var g = new b(2);
1361
- return b != Float32Array && (g[0] = 0, g[1] = 0), g;
1359
+ function HB() {
1360
+ var g = new P(2);
1361
+ return P != Float32Array && (g[0] = 0, g[1] = 0), g;
1362
1362
  }
1363
1363
  function vg(g) {
1364
- var A = new b(2);
1364
+ var A = new P(2);
1365
1365
  return A[0] = g[0], A[1] = g[1], A;
1366
1366
  }
1367
- function W(g, A) {
1368
- var I = new b(2);
1367
+ function Z(g, A) {
1368
+ var I = new P(2);
1369
1369
  return I[0] = g, I[1] = A, I;
1370
1370
  }
1371
- function vC(g, A) {
1371
+ function jC(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 XC(g) {
1375
+ function zC(g) {
1376
1376
  var A = g[0], I = g[1];
1377
1377
  return A * A + I * I;
1378
1378
  }
1379
- function jC(g, A, I, B) {
1379
+ function _C(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
  }
@@ -1388,7 +1388,7 @@ function zI(g, A) {
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 = KB();
1391
+ var g = HB();
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)
@@ -1438,7 +1438,7 @@ class RA {
1438
1438
  uI(Q, E, A), this.expandWithPoint(Q);
1439
1439
  }
1440
1440
  }
1441
- const zC = {
1441
+ const $C = {
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 _C {
1505
+ class AQ {
1506
1506
  gl_;
1507
1507
  buffers_ = /* @__PURE__ */ new Map();
1508
1508
  currentGeometry_ = null;
@@ -1538,7 +1538,7 @@ class _C {
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 = zC[s.type];
1541
+ const h = $C[s.type];
1542
1542
  this.gl_.vertexAttribPointer(
1543
1543
  h,
1544
1544
  s.itemSize,
@@ -1557,7 +1557,7 @@ class _C {
1557
1557
  this.buffers_.set(A, o), this.gl_.bindVertexArray(null);
1558
1558
  }
1559
1559
  }
1560
- class $C {
1560
+ class IQ {
1561
1561
  gl_;
1562
1562
  textures_ = /* @__PURE__ */ new Map();
1563
1563
  currentTexture_ = null;
@@ -1811,7 +1811,7 @@ class AA {
1811
1811
  * the first element, and avoids biasing toward (0,0).
1812
1812
  */
1813
1813
  constructor(A, I) {
1814
- this.min = A ? vg(A) : W(1 / 0, 1 / 0), this.max = I ? vg(I) : W(-1 / 0, -1 / 0);
1814
+ this.min = A ? vg(A) : Z(1 / 0, 1 / 0), this.max = I ? vg(I) : Z(-1 / 0, -1 / 0);
1815
1815
  }
1816
1816
  clone() {
1817
1817
  return new AA(this.min, this.max);
@@ -1828,8 +1828,8 @@ class AA {
1828
1828
  }
1829
1829
  floor() {
1830
1830
  return new AA(
1831
- W(Math.floor(this.min[0]), Math.floor(this.min[1])),
1832
- W(Math.floor(this.max[0]), Math.floor(this.max[1]))
1831
+ Z(Math.floor(this.min[0]), Math.floor(this.min[1])),
1832
+ Z(Math.floor(this.max[0]), Math.floor(this.max[1]))
1833
1833
  );
1834
1834
  }
1835
1835
  toRect() {
@@ -1837,7 +1837,7 @@ class AA {
1837
1837
  return { x: A, y: I, width: B, height: C };
1838
1838
  }
1839
1839
  }
1840
- class AQ {
1840
+ class gQ {
1841
1841
  gl_;
1842
1842
  enabledCapabilities_ = /* @__PURE__ */ new Map();
1843
1843
  depthMaskEnabled_ = null;
@@ -1937,8 +1937,8 @@ class AQ {
1937
1937
  A ? this.enable(this.gl_.STENCIL_TEST) : this.disable(this.gl_.STENCIL_TEST);
1938
1938
  }
1939
1939
  }
1940
- const IQ = kC(_(), [1, -1, 1]);
1941
- class gQ extends oC {
1940
+ const BQ = JC(_(), [1, -1, 1]);
1941
+ class CQ extends sC {
1942
1942
  gl_;
1943
1943
  programs_;
1944
1944
  bindings_;
@@ -1957,33 +1957,26 @@ class gQ extends oC {
1957
1957
  this.gl_ = I, U.info(
1958
1958
  "WebGLRenderer",
1959
1959
  `WebGL version ${I.getParameter(I.VERSION)}`
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);
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);
1961
1961
  }
1962
1962
  render(A) {
1963
- const I = A.getBoxRelativeTo(this.canvas), B = new AA(
1964
- W(0, 0),
1965
- W(this.width, this.height)
1963
+ let I = getComputedStyle(A.element).visibility !== "hidden";
1964
+ const B = A.getBoxRelativeTo(this.canvas), C = new AA(
1965
+ Z(0, 0),
1966
+ Z(this.width, this.height)
1966
1967
  );
1967
- if (AA.equals(I.floor(), B.floor()))
1968
- this.state_.setScissorTest(!1);
1969
- else if (AA.intersects(I, B))
1970
- this.state_.setScissor(I), this.state_.setScissorTest(!0);
1971
- else {
1972
- U.warn(
1973
- "WebGLRenderer",
1974
- `Viewport ${A.id} is entirely outside canvas bounds, skipping render`
1975
- );
1976
- return;
1977
- }
1978
- this.state_.setViewport(I), this.renderedObjectsPerFrame_ = 0, this.clear();
1979
- const { opaque: C, transparent: Q } = A.layerManager.partitionLayers();
1968
+ AA.equals(B.floor(), C.floor()) ? this.state_.setScissorTest(!1) : AA.intersects(B, C) ? (this.state_.setScissor(B), this.state_.setScissorTest(!0)) : (U.warn(
1969
+ "WebGLRenderer",
1970
+ `Viewport ${A.id} is entirely outside canvas bounds, skipping render`
1971
+ ), I = !1), this.state_.setViewport(B), this.renderedObjectsPerFrame_ = 0, I && this.clear();
1972
+ const { opaque: Q, transparent: E } = A.layerManager.partitionLayers();
1980
1973
  this.state_.setDepthMask(!0);
1981
- const E = A.camera.frustum, i = { viewport: A };
1982
- for (const o of C)
1983
- o.update(i), o.state === "ready" && this.renderLayer(o, A.camera, E);
1974
+ const i = A.camera.frustum, o = { viewport: A };
1975
+ for (const a of Q)
1976
+ a.update(o), a.state === "ready" && I && this.renderLayer(a, A.camera, i);
1984
1977
  this.state_.setDepthMask(!1);
1985
- for (const o of Q)
1986
- o.update(i), o.state === "ready" && this.renderLayer(o, A.camera, E);
1978
+ for (const a of E)
1979
+ a.update(o), a.state === "ready" && I && this.renderLayer(a, A.camera, i);
1987
1980
  this.state_.setDepthMask(!0), this.renderedObjects_ = this.renderedObjectsPerFrame_;
1988
1981
  }
1989
1982
  get textureInfo() {
@@ -2028,7 +2021,7 @@ class gQ extends oC {
2028
2021
  I.transform.matrix
2029
2022
  ), i = zA(
2030
2023
  _(),
2031
- IQ,
2024
+ BQ,
2032
2025
  Q.projectionMatrix
2033
2026
  ), o = [this.canvas.width, this.canvas.height], a = I.getUniforms(), h = {
2034
2027
  ...B.getUniforms(),
@@ -2086,8 +2079,8 @@ class gQ extends oC {
2086
2079
  }
2087
2080
  resize(A, I) {
2088
2081
  const B = new AA(
2089
- W(0, 0),
2090
- W(A, I)
2082
+ Z(0, 0),
2083
+ Z(A, I)
2091
2084
  );
2092
2085
  this.state_.setViewport(B);
2093
2086
  }
@@ -2095,12 +2088,12 @@ class gQ extends oC {
2095
2088
  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);
2096
2089
  }
2097
2090
  }
2098
- const BQ = 8;
2099
- class CQ {
2091
+ const QQ = 8;
2092
+ class EQ {
2100
2093
  maxConcurrent_;
2101
2094
  pending_ = [];
2102
2095
  running_ = /* @__PURE__ */ new Map();
2103
- constructor(A = BQ) {
2096
+ constructor(A = QQ) {
2104
2097
  this.maxConcurrent_ = Math.max(1, A);
2105
2098
  }
2106
2099
  enqueue(A, I) {
@@ -2166,7 +2159,7 @@ function zg(g) {
2166
2159
  `Unsupported chunk data type: ${g}. Supported data types: ${A}`
2167
2160
  ), !1;
2168
2161
  }
2169
- function QQ(g, A) {
2162
+ function iQ(g, A) {
2170
2163
  return Math.round((A - g.translation) / g.scale);
2171
2164
  }
2172
2165
  function Qg(g, A, I = 1e-6) {
@@ -2176,7 +2169,7 @@ function cA(g, A, I) {
2176
2169
  return Math.max(A, Math.min(I, g));
2177
2170
  }
2178
2171
  const ng = Symbol("INTERNAL_POLICY_KEY");
2179
- class EQ {
2172
+ class oQ {
2180
2173
  store_;
2181
2174
  policy_;
2182
2175
  policyChanged_ = !1;
@@ -2195,8 +2188,8 @@ class EQ {
2195
2188
  this.policy_.profile
2196
2189
  );
2197
2190
  const B = this.store_.dimensions, C = B.x.lods[0], Q = B.y.lods[0];
2198
- this.sourceMaxSquareDistance2D_ = XC(
2199
- W(C.size * C.scale, Q.size * Q.scale)
2191
+ this.sourceMaxSquareDistance2D_ = zC(
2192
+ Z(C.size * C.scale, Q.size * Q.scale)
2200
2193
  );
2201
2194
  }
2202
2195
  get chunkViewStates() {
@@ -2244,8 +2237,8 @@ class EQ {
2244
2237
  ), this.chunkViewStates_.clear();
2245
2238
  return;
2246
2239
  }
2247
- const w = KB();
2248
- jC(w, Q.min, Q.max, 0.5);
2240
+ const w = HB();
2241
+ _C(w, Q.min, Q.max, 0.5);
2249
2242
  const [r, G] = this.getZBounds(A), c = new RA(
2250
2243
  q(Q.min[0], Q.min[1], r),
2251
2244
  q(Q.max[0], Q.max[1], G)
@@ -2443,7 +2436,7 @@ class EQ {
2443
2436
  return this.lastViewBounds2D_ === null || !zI(this.lastViewBounds2D_.min, A.min) || !zI(this.lastViewBounds2D_.max, A.max);
2444
2437
  }
2445
2438
  hasViewProjectionChanged(A) {
2446
- return this.lastViewProjection_ === null || !HC(this.lastViewProjection_, A);
2439
+ return this.lastViewProjection_ === null || !lC(this.lastViewProjection_, A);
2447
2440
  }
2448
2441
  zBoundsChanged(A) {
2449
2442
  return !this.lastZBounds_ || !zI(this.lastZBounds_, A);
@@ -2475,7 +2468,7 @@ class EQ {
2475
2468
  function _I(g) {
2476
2469
  g.visible = !1, g.prefetch = !1, g.priority = null, g.orderKey = null;
2477
2470
  }
2478
- class iQ {
2471
+ class aQ {
2479
2472
  chunks_;
2480
2473
  loader_;
2481
2474
  lowestResLOD_;
@@ -2493,10 +2486,10 @@ class iQ {
2493
2486
  for (let r = 0; r < B; ++r)
2494
2487
  for (let G = 0; G < y; ++G) {
2495
2488
  const c = i.translation + G * i.chunkSize * i.scale;
2496
- for (let N = 0; N < n; ++N) {
2497
- const d = o.translation + N * o.chunkSize * o.scale;
2498
- for (let L = 0; L < w; ++L) {
2499
- const k = a !== void 0 ? a.translation + L * t * a.scale : 0;
2489
+ for (let R = 0; R < n; ++R) {
2490
+ const Y = o.translation + R * o.chunkSize * o.scale;
2491
+ for (let k = 0; k < w; ++k) {
2492
+ const L = a !== void 0 ? a.translation + k * t * a.scale : 0;
2500
2493
  Q.push({
2501
2494
  state: "unloaded",
2502
2495
  lod: E,
@@ -2506,12 +2499,12 @@ class iQ {
2506
2499
  orderKey: null,
2507
2500
  shape: {
2508
2501
  x: Math.min(s, i.size - G * s),
2509
- y: Math.min(h, o.size - N * h),
2510
- z: Math.min(t, (a?.size ?? 1) - L * t),
2502
+ y: Math.min(h, o.size - R * h),
2503
+ z: Math.min(t, (a?.size ?? 1) - k * t),
2511
2504
  c: 1
2512
2505
  },
2513
2506
  rowAlignmentBytes: 1,
2514
- chunkIndex: { x: G, y: N, z: L, c: r, t: C },
2507
+ chunkIndex: { x: G, y: R, z: k, c: r, t: C },
2515
2508
  scale: {
2516
2509
  x: i.scale,
2517
2510
  y: o.scale,
@@ -2519,8 +2512,8 @@ class iQ {
2519
2512
  },
2520
2513
  offset: {
2521
2514
  x: c,
2522
- y: d,
2523
- z: k
2515
+ y: Y,
2516
+ z: L
2524
2517
  }
2525
2518
  });
2526
2519
  }
@@ -2533,7 +2526,7 @@ class iQ {
2533
2526
  return this.chunks_[A];
2534
2527
  }
2535
2528
  getTimeIndex(A) {
2536
- return A.t === void 0 || this.dimensions_.t === void 0 ? 0 : QQ(this.dimensions_.t.lods[0], A.t);
2529
+ return A.t === void 0 || this.dimensions_.t === void 0 ? 0 : iQ(this.dimensions_.t.lods[0], A.t);
2537
2530
  }
2538
2531
  get lodCount() {
2539
2532
  return this.lowestResLOD_ + 1;
@@ -2548,7 +2541,7 @@ class iQ {
2548
2541
  return this.loader_.loadChunkData(A, I);
2549
2542
  }
2550
2543
  createView(A) {
2551
- const I = new EQ(this, A);
2544
+ const I = new oQ(this, A);
2552
2545
  return this.views_.push(I), this.hasHadViews_ = !0, I;
2553
2546
  }
2554
2547
  get views() {
@@ -2609,10 +2602,6 @@ class iQ {
2609
2602
  for (let A = 0; A < this.dimensions_.numLods; ++A) {
2610
2603
  const I = this.dimensions_.t?.lods[A];
2611
2604
  if (!I) continue;
2612
- if (I.chunkSize !== 1)
2613
- throw new Error(
2614
- `ChunkStore only supports a chunk size of 1 in t. Found ${I.chunkSize} at LOD ${A}`
2615
- );
2616
2605
  const B = this.dimensions_.t?.lods[A - 1];
2617
2606
  if (B && I.size !== B.size)
2618
2607
  throw new Error(
@@ -2627,10 +2616,6 @@ class iQ {
2627
2616
  for (let A = 0; A < this.dimensions_.numLods; ++A) {
2628
2617
  const I = this.dimensions_.c?.lods[A];
2629
2618
  if (!I) continue;
2630
- if (I.chunkSize !== 1)
2631
- throw new Error(
2632
- `ChunkStore only supports a chunk size of 1 in c. Found ${I.chunkSize} at LOD ${A}`
2633
- );
2634
2619
  if (I.scale !== 1)
2635
2620
  throw new Error(
2636
2621
  `ChunkStore does not support scale in c. Found ${I.scale} at LOD ${A}`
@@ -2650,10 +2635,10 @@ class iQ {
2650
2635
  };
2651
2636
  }
2652
2637
  }
2653
- class oQ {
2638
+ class sQ {
2654
2639
  stores_ = /* @__PURE__ */ new Map();
2655
2640
  pendingStores_ = /* @__PURE__ */ new Map();
2656
- queue_ = new CQ();
2641
+ queue_ = new EQ();
2657
2642
  async addView(A, I) {
2658
2643
  return (await this.getOrCreateStore(A)).createView(I);
2659
2644
  }
@@ -2666,7 +2651,7 @@ class oQ {
2666
2651
  return B;
2667
2652
  const Q = (async () => {
2668
2653
  const i = await A.open();
2669
- return new iQ(i);
2654
+ return new aQ(i);
2670
2655
  })();
2671
2656
  this.pendingStores_.set(A, Q);
2672
2657
  const E = await Q;
@@ -2733,19 +2718,19 @@ XA.Panel = function(g, A, I, B) {
2733
2718
  var G = r.getContext("2d");
2734
2719
  return G.font = "bold " + E(9 * i * B) + "px Helvetica,Arial,sans-serif", G.textBaseline = "top", G.fillStyle = I, G.fillRect(0, 0, o, a), G.fillStyle = A, G.fillText(g, s, h), G.fillRect(t, y, n, w), G.fillStyle = I, G.globalAlpha = 0.9, G.fillRect(t, y, n, w), {
2735
2720
  dom: r,
2736
- update: function(c, N) {
2737
- C = Math.min(C, c), Q = Math.max(Q, c), G.fillStyle = I, G.globalAlpha = 1, G.fillRect(0, 0, o, y), G.fillStyle = A, G.fillText(E(c) + " " + g + " (" + E(C) + "-" + E(Q) + ")", s, h), G.drawImage(r, t + i, y, n - i, w, t, y, n - i, w), G.fillRect(t + n - i, y, i, w), G.fillStyle = I, G.globalAlpha = 0.9, G.fillRect(t + n - i, y, i, E((1 - c / N) * w));
2721
+ update: function(c, R) {
2722
+ C = Math.min(C, c), Q = Math.max(Q, c), G.fillStyle = I, G.globalAlpha = 1, G.fillRect(0, 0, o, y), G.fillStyle = A, G.fillText(E(c) + " " + g + " (" + E(C) + "-" + E(Q) + ")", s, h), G.drawImage(r, t + i, y, n - i, w, t, y, n - i, w), G.fillRect(t + n - i, y, i, w), G.fillStyle = I, G.globalAlpha = 0.9, G.fillRect(t + n - i, y, i, E((1 - c / R) * w));
2738
2723
  }
2739
2724
  };
2740
2725
  };
2741
- function aQ({ scale: g } = { scale: 1.5 }) {
2726
+ function DQ({ scale: g } = { scale: 1.5 }) {
2742
2727
  const A = new XA(g);
2743
2728
  return A.showPanel(
2744
2729
  0
2745
2730
  /* 0 = fps, 1 = ms, 2 = mb */
2746
2731
  ), document.body.appendChild(A.dom), A;
2747
2732
  }
2748
- class sQ {
2733
+ class hQ {
2749
2734
  layers_ = [];
2750
2735
  callbacks_ = [];
2751
2736
  context_;
@@ -2802,10 +2787,10 @@ const Eg = [
2802
2787
  "pointercancel",
2803
2788
  "wheel"
2804
2789
  ];
2805
- function DQ(g) {
2790
+ function tQ(g) {
2806
2791
  return Eg.includes(g);
2807
2792
  }
2808
- class hQ {
2793
+ class yQ {
2809
2794
  propagationStopped_ = !1;
2810
2795
  type;
2811
2796
  event;
@@ -2821,7 +2806,7 @@ class hQ {
2821
2806
  this.propagationStopped_ = !0;
2822
2807
  }
2823
2808
  }
2824
- class tQ {
2809
+ class eQ {
2825
2810
  listeners_ = [];
2826
2811
  element_;
2827
2812
  isConnected_ = !1;
@@ -2860,16 +2845,16 @@ class tQ {
2860
2845
  });
2861
2846
  }
2862
2847
  handleEvent = (A) => {
2863
- if (!DQ(A.type)) {
2848
+ if (!tQ(A.type)) {
2864
2849
  U.error("EventDispatcher", `Unsupported event type ${A.type}`);
2865
2850
  return;
2866
2851
  }
2867
- const I = new hQ(A.type, A);
2852
+ const I = new yQ(A.type, A);
2868
2853
  for (const B of this.listeners_)
2869
2854
  if (B(I), I.propagationStopped) break;
2870
2855
  };
2871
2856
  }
2872
- class yQ {
2857
+ class GQ {
2873
2858
  id;
2874
2859
  element;
2875
2860
  camera;
@@ -2877,9 +2862,9 @@ class yQ {
2877
2862
  events;
2878
2863
  cameraControls;
2879
2864
  constructor(A) {
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) => {
2865
+ 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) => {
2881
2866
  if (I.event instanceof PointerEvent || I.event instanceof WheelEvent) {
2882
- const { clientX: B, clientY: C } = I.event, Q = W(B, C);
2867
+ const { clientX: B, clientY: C } = I.event, Q = Z(B, C);
2883
2868
  I.clipPos = this.clientToClip(Q, 0), I.worldPos = this.camera.clipToWorld(I.clipPos);
2884
2869
  }
2885
2870
  for (const B of this.layerManager.layers)
@@ -2895,8 +2880,8 @@ class yQ {
2895
2880
  getBoxRelativeTo(A) {
2896
2881
  const I = this.getBox().toRect(), B = A.getBoundingClientRect(), C = window.devicePixelRatio || 1, Q = B.left * C, E = B.top * C, i = B.height * C, o = I.x - Q, a = I.y - E, s = Math.floor(o), h = Math.floor(i - a - I.height), t = Math.floor(I.width), y = Math.floor(I.height);
2897
2882
  return new AA(
2898
- W(s, h),
2899
- W(s + t, h + y)
2883
+ Z(s, h),
2884
+ Z(s + t, h + y)
2900
2885
  );
2901
2886
  }
2902
2887
  clientToClip(A, I = 0) {
@@ -2914,8 +2899,8 @@ class yQ {
2914
2899
  getBox() {
2915
2900
  const A = this.element.getBoundingClientRect(), I = window.devicePixelRatio || 1, B = A.left * I, C = A.top * I, Q = A.width * I, E = A.height * I;
2916
2901
  return new AA(
2917
- W(B, C),
2918
- W(B + Q, C + E)
2902
+ Z(B, C),
2903
+ Z(B + Q, C + E)
2919
2904
  );
2920
2905
  }
2921
2906
  updateAspectRatio() {
@@ -2931,42 +2916,44 @@ class yQ {
2931
2916
  this.camera.setAspectRatio(B);
2932
2917
  }
2933
2918
  }
2934
- function eQ(g) {
2935
- const A = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Set();
2936
- for (const B of g) {
2937
- if (I.has(B.id))
2919
+ function qB(g, A) {
2920
+ for (const I of A) {
2921
+ if (I.id === g.id)
2938
2922
  throw new Error(
2939
- `Duplicate viewport ID "${B.id}". Each viewport must have a unique ID.`
2923
+ `Duplicate viewport ID "${g.id}". Each viewport must have a unique ID.`
2940
2924
  );
2941
- if (I.add(B.id), A.has(B.element)) {
2942
- const C = A.get(B.element), Q = B.element.tagName.toLowerCase() + (B.element.id ? `#${B.element.id}` : "[element has no id]");
2925
+ if (I.element === g.element) {
2926
+ const B = g.element.tagName.toLowerCase() + (g.element.id ? `#${g.element.id}` : "[element has no id]");
2943
2927
  throw new Error(
2944
- `Multiple viewports cannot share the same HTML element: viewports "${C}" and "${B.id}" both use ${Q}`
2928
+ `Multiple viewports cannot share the same HTML element: viewports "${I.id}" and "${g.id}" both use ${B}`
2945
2929
  );
2946
2930
  }
2947
- A.set(B.element, B.id);
2948
2931
  }
2949
2932
  }
2950
- function GQ(g, A, I) {
2933
+ function nQ(g) {
2934
+ for (let A = 0; A < g.length; A++)
2935
+ qB(g[A], g.slice(0, A));
2936
+ }
2937
+ function _g(g, A, I) {
2951
2938
  const B = g.map((C) => {
2952
2939
  const Q = C.element ?? A;
2953
2940
  return {
2954
2941
  ...C,
2955
2942
  element: Q,
2956
- id: C.id ?? Q.id ?? LB(),
2957
- layerManager: new sQ(I)
2943
+ id: C.id ?? Q.id ?? JB(),
2944
+ layerManager: new hQ(I)
2958
2945
  };
2959
2946
  });
2960
- return eQ(B), B.map((C) => new yQ(C));
2947
+ return nQ(B), B.map((C) => new GQ(C));
2961
2948
  }
2962
- class nQ {
2949
+ class wQ {
2963
2950
  elements_;
2964
2951
  resizeObserver_;
2965
2952
  mediaQuery_;
2966
2953
  onMediaQueryChange_;
2967
2954
  onChange_;
2968
2955
  constructor(A = [], I) {
2969
- this.elements_ = A, this.onChange_ = I;
2956
+ this.elements_ = [...A], this.onChange_ = I;
2970
2957
  }
2971
2958
  connect() {
2972
2959
  if (this.resizeObserver_) {
@@ -3002,8 +2989,23 @@ class nQ {
3002
2989
  }
3003
2990
  this.resizeObserver_?.disconnect(), this.mediaQuery_ && this.onMediaQueryChange_ && this.mediaQuery_.removeEventListener("change", this.onMediaQueryChange_);
3004
2991
  }
2992
+ observe(A) {
2993
+ if (this.elements_.includes(A)) {
2994
+ U.warn("PixelSizeObserver", "Element already being observed");
2995
+ return;
2996
+ }
2997
+ this.elements_.push(A), this.resizeObserver_ && this.resizeObserver_.observe(A);
2998
+ }
2999
+ unobserve(A) {
3000
+ const I = this.elements_.indexOf(A);
3001
+ if (I === -1) {
3002
+ U.warn("PixelSizeObserver", "Element not being observed");
3003
+ return;
3004
+ }
3005
+ this.elements_.splice(I, 1), this.resizeObserver_ && this.resizeObserver_.unobserve(A);
3006
+ }
3005
3007
  }
3006
- class Ko {
3008
+ class Ho {
3007
3009
  chunkManager_;
3008
3010
  context_;
3009
3011
  renderer_;
@@ -3020,7 +3022,7 @@ class Ko {
3020
3022
  *
3021
3023
  * @param params - Configuration parameters for the Idetik instance
3022
3024
  * @param params.canvas - HTMLCanvasElement to render to
3023
- * @param params.viewports - Array of viewport configurations. (At least one required.)
3025
+ * @param params.viewports - Optional array of viewport configurations.
3024
3026
  * Each viewport renders with its own camera, layers, and controls.
3025
3027
  * The `element` property is optional and defaults to the canvas if not provided.
3026
3028
  * Elements must be unique across viewports.
@@ -3060,23 +3062,20 @@ class Ko {
3060
3062
  * ]
3061
3063
  * });
3062
3064
  *
3063
- * @throws {Error} If viewports array is empty or not provided
3064
3065
  * @throws {Error} If viewports have duplicate IDs or shared elements
3065
3066
  */
3066
3067
  constructor(A) {
3067
- if (this.canvas = A.canvas, A.viewports.length === 0)
3068
- throw new Error("At least one viewport config must be specified.");
3069
- this.renderer_ = new gQ(this.canvas), this.chunkManager_ = new oQ(), this.context_ = {
3068
+ this.canvas = A.canvas, this.renderer_ = new CQ(this.canvas), this.chunkManager_ = new sQ(), this.context_ = {
3070
3069
  chunkManager: this.chunkManager_
3071
- }, this.viewports_ = GQ(
3072
- A.viewports,
3070
+ }, this.viewports_ = _g(
3071
+ A.viewports ?? [],
3073
3072
  this.canvas,
3074
3073
  this.context_
3075
- ), this.overlays = A.overlays ?? [], A.showStats && (this.stats_ = aQ());
3074
+ ), this.overlays = A.overlays ?? [], A.showStats && (this.stats_ = DQ());
3076
3075
  const I = [this.canvas];
3077
3076
  for (const B of this.viewports_)
3078
3077
  B.element !== this.canvas && I.push(B.element);
3079
- this.sizeObserver_ = new nQ(I, () => {
3078
+ this.sizeObserver_ = new wQ(I, () => {
3080
3079
  this.renderer_.updateSize();
3081
3080
  for (const B of this.viewports_)
3082
3081
  B.updateSize(), this.renderer_.render(B);
@@ -3097,18 +3096,37 @@ class Ko {
3097
3096
  get viewports() {
3098
3097
  return this.viewports_;
3099
3098
  }
3099
+ get running() {
3100
+ return this.lastAnimationId_ !== void 0;
3101
+ }
3100
3102
  getViewport(A) {
3101
3103
  return this.viewports_.find((I) => I.id === A);
3102
3104
  }
3105
+ addViewport(A) {
3106
+ const [I] = _g(
3107
+ [A],
3108
+ this.canvas,
3109
+ this.context_
3110
+ );
3111
+ return qB(I, this.viewports_), this.viewports_.push(I), this.running && (I.events.connect(), I.element !== this.canvas && this.sizeObserver_.observe(I.element)), U.info("Idetik", `Added viewport "${I.id}"`), I;
3112
+ }
3113
+ removeViewport(A) {
3114
+ const I = this.viewports_.indexOf(A);
3115
+ return I === -1 ? (U.warn(
3116
+ "Idetik",
3117
+ `Viewport "${A.id}" not found, nothing to remove`
3118
+ ), !1) : (this.running && (A.events.disconnect(), A.element !== this.canvas && this.sizeObserver_.unobserve(A.element)), this.viewports_.splice(I, 1), U.info("Idetik", `Removed viewport "${A.id}"`), !0);
3119
+ }
3103
3120
  start() {
3104
- if (U.info("Idetik", "Idetik runtime starting"), this.lastAnimationId_ === void 0) {
3121
+ if (U.info("Idetik", "Idetik runtime starting"), this.running)
3122
+ U.warn("Idetik", "Idetik runtime already started");
3123
+ else {
3105
3124
  for (const A of this.viewports_)
3106
3125
  A.events.connect();
3107
3126
  this.sizeObserver_.connect(), this.lastAnimationId_ = requestAnimationFrame((A) => {
3108
3127
  this.lastTimestamp_ = A, this.animate(A);
3109
3128
  });
3110
- } else
3111
- U.warn("Idetik", "Idetik runtime already started");
3129
+ }
3112
3130
  return this;
3113
3131
  }
3114
3132
  animate(A) {
@@ -3125,7 +3143,7 @@ class Ko {
3125
3143
  );
3126
3144
  }
3127
3145
  stop() {
3128
- if (U.info("Idetik", "Idetik runtime stopping"), this.lastAnimationId_ === void 0)
3146
+ if (U.info("Idetik", "Idetik runtime stopping"), !this.running)
3129
3147
  U.warn("Idetik", "Idetik runtime not started");
3130
3148
  else {
3131
3149
  this.sizeObserver_.disconnect();
@@ -3135,7 +3153,7 @@ class Ko {
3135
3153
  }
3136
3154
  }
3137
3155
  }
3138
- class wQ extends bA {
3156
+ class FQ extends bA {
3139
3157
  constructor(A) {
3140
3158
  if (super(), A.primitive != "triangles") {
3141
3159
  U.warn("WireframeGeometry", "Only indexed geometries are supported");
@@ -3160,21 +3178,21 @@ class wQ extends bA {
3160
3178
  this.indexData_ = new Uint32Array(B);
3161
3179
  }
3162
3180
  }
3163
- const FQ = q(0, 1, 0);
3164
- class rQ {
3181
+ const rQ = q(0, 1, 0);
3182
+ class SQ {
3165
3183
  dirty_ = !0;
3166
3184
  matrix_ = _();
3167
3185
  rotation_ = Cg();
3168
3186
  translation_ = f();
3169
3187
  scale_ = q(1, 1, 1);
3170
3188
  addRotation(A) {
3171
- PC(this.rotation_, this.rotation_, A), this.dirty_ = !0;
3189
+ VC(this.rotation_, this.rotation_, A), this.dirty_ = !0;
3172
3190
  }
3173
3191
  setRotation(A) {
3174
- VC(this.rotation_, A), this.dirty_ = !0;
3192
+ XC(this.rotation_, A), this.dirty_ = !0;
3175
3193
  }
3176
3194
  get rotation() {
3177
- return OC(this.rotation_);
3195
+ return vC(this.rotation_);
3178
3196
  }
3179
3197
  addTranslation(A) {
3180
3198
  lA(this.translation_, this.translation_, A), this.dirty_ = !0;
@@ -3186,15 +3204,15 @@ class rQ {
3186
3204
  return BA(this.translation_);
3187
3205
  }
3188
3206
  addScale(A) {
3189
- lC(this.scale_, this.scale_, A), this.dirty_ = !0;
3207
+ pC(this.scale_, this.scale_, A), this.dirty_ = !0;
3190
3208
  }
3191
3209
  setScale(A) {
3192
3210
  HA(this.scale_, A), this.dirty_ = !0;
3193
3211
  }
3194
3212
  targetTo(A) {
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;
3213
+ MB(this.translation_, A) && (A = BA(A), A[2] += p);
3214
+ const I = qC(_(), this.translation_, A, rQ), B = LC(YB(), I);
3215
+ KB(this.rotation_, B), Gg(this.rotation_, this.rotation_), this.dirty_ = !0;
3198
3216
  }
3199
3217
  get scale() {
3200
3218
  return BA(this.scale_);
@@ -3206,7 +3224,7 @@ class rQ {
3206
3224
  return mI(_(), this.matrix);
3207
3225
  }
3208
3226
  computeMatrix() {
3209
- LC(
3227
+ YC(
3210
3228
  this.matrix_,
3211
3229
  this.rotation_,
3212
3230
  this.translation_,
@@ -3220,7 +3238,7 @@ class ZA extends yg {
3220
3238
  depthTest = !0;
3221
3239
  textures_ = [];
3222
3240
  staleTextures_ = [];
3223
- transform_ = new rQ();
3241
+ transform_ = new SQ();
3224
3242
  geometry_ = new bA();
3225
3243
  wireframeGeometry_ = null;
3226
3244
  programName_ = null;
@@ -3237,7 +3255,7 @@ class ZA extends yg {
3237
3255
  return this.geometry_;
3238
3256
  }
3239
3257
  get wireframeGeometry() {
3240
- return this.wireframeGeometry_ ??= new wQ(this.geometry), this.wireframeGeometry_;
3258
+ return this.wireframeGeometry_ ??= new FQ(this.geometry), this.wireframeGeometry_;
3241
3259
  }
3242
3260
  get textures() {
3243
3261
  return this.textures_;
@@ -3282,7 +3300,7 @@ class dA {
3282
3300
  this.normal = BA(A), this.signedDistance = I;
3283
3301
  }
3284
3302
  signedDistanceToPoint(A) {
3285
- return YB(this.normal, A) + this.signedDistance;
3303
+ return dB(this.normal, A) + this.signedDistance;
3286
3304
  }
3287
3305
  normalize() {
3288
3306
  const A = eg(this.normal);
@@ -3292,7 +3310,7 @@ class dA {
3292
3310
  }
3293
3311
  }
3294
3312
  }
3295
- class SQ {
3313
+ class RQ {
3296
3314
  planes_;
3297
3315
  constructor(A) {
3298
3316
  this.planes_ = [
@@ -3338,7 +3356,7 @@ class SQ {
3338
3356
  return !0;
3339
3357
  }
3340
3358
  }
3341
- class HB extends ZA {
3359
+ class lB extends ZA {
3342
3360
  projectionMatrix_ = _();
3343
3361
  near_ = 0;
3344
3362
  far_ = 0;
@@ -3360,7 +3378,7 @@ class HB extends ZA {
3360
3378
  return q(A[4], A[5], A[6]);
3361
3379
  }
3362
3380
  get frustum() {
3363
- return new SQ(
3381
+ return new RQ(
3364
3382
  zA(_(), this.projectionMatrix, this.viewMatrix)
3365
3383
  );
3366
3384
  }
@@ -3379,7 +3397,7 @@ class HB extends ZA {
3379
3397
  I,
3380
3398
  B
3381
3399
  );
3382
- WC(C, C, 1 / C[3]);
3400
+ ZC(C, C, 1 / C[3]);
3383
3401
  const Q = _A(
3384
3402
  pA(),
3385
3403
  C,
@@ -3388,13 +3406,13 @@ class HB extends ZA {
3388
3406
  return q(Q[0], Q[1], Q[2]);
3389
3407
  }
3390
3408
  }
3391
- const qB = 1.77, _g = 128, $g = 128 / qB;
3392
- class Ho extends HB {
3409
+ const fB = 1.77, $g = 128, AB = 128 / fB;
3410
+ class qo extends lB {
3393
3411
  // width_ and height_ should always be defined by constructor (see setFrame)
3394
- width_ = _g;
3395
- height_ = $g;
3396
- viewportAspectRatio_ = qB;
3397
- viewportSize_ = [_g, $g];
3412
+ width_ = $g;
3413
+ height_ = AB;
3414
+ viewportAspectRatio_ = fB;
3415
+ viewportSize_ = [$g, AB];
3398
3416
  constructor(A, I, B, C, Q = 0, E = 100) {
3399
3417
  super(), this.near_ = Q, this.far_ = E, this.setFrame(A, I, C, B), this.updateProjectionMatrix();
3400
3418
  }
@@ -3426,14 +3444,14 @@ class Ho extends HB {
3426
3444
  this.viewMatrix
3427
3445
  ), C = mI(_(), B);
3428
3446
  return A = _A(pA(), A, C), I = _A(pA(), I, C), new AA(
3429
- W(A[0], A[1]),
3430
- W(I[0], I[1])
3447
+ Z(A[0], A[1]),
3448
+ Z(I[0], I[1])
3431
3449
  );
3432
3450
  }
3433
3451
  updateProjectionMatrix() {
3434
3452
  const A = this.width_, I = this.height_, B = A / I;
3435
3453
  let C = 0.5 * A, Q = 0.5 * I;
3436
- this.viewportAspectRatio_ > B ? C *= this.viewportAspectRatio_ / B : Q *= B / this.viewportAspectRatio_, this.viewportSize_ = [2 * C, 2 * Q], MC(
3454
+ this.viewportAspectRatio_ > B ? C *= this.viewportAspectRatio_ / B : Q *= B / this.viewportAspectRatio_, this.viewportSize_ = [2 * C, 2 * Q], HC(
3437
3455
  this.projectionMatrix_,
3438
3456
  -C,
3439
3457
  C,
@@ -3444,14 +3462,14 @@ class Ho extends HB {
3444
3462
  );
3445
3463
  }
3446
3464
  }
3447
- const RQ = 60, NQ = 1.77, rI = 0.1, $I = 180 - rI;
3448
- class qo extends HB {
3465
+ const NQ = 60, cQ = 1.77, rI = 0.1, $I = 180 - rI;
3466
+ class lo extends lB {
3449
3467
  fov_;
3450
3468
  aspectRatio_;
3451
3469
  constructor(A = {}) {
3452
3470
  const {
3453
- fov: I = RQ,
3454
- aspectRatio: B = NQ,
3471
+ fov: I = NQ,
3472
+ aspectRatio: B = cQ,
3455
3473
  near: C = 0.1,
3456
3474
  far: Q = 1e4,
3457
3475
  position: E = q(0, 0, 0)
@@ -3477,17 +3495,17 @@ class qo extends HB {
3477
3495
  this.fov_ = Math.max(rI, Math.min($I, this.fov_ / A)), this.updateProjectionMatrix();
3478
3496
  }
3479
3497
  updateProjectionMatrix() {
3480
- YC(
3498
+ MC(
3481
3499
  this.projectionMatrix_,
3482
- cC(this.fov),
3500
+ kC(this.fov),
3483
3501
  this.aspectRatio_,
3484
3502
  this.near_,
3485
3503
  this.far_
3486
3504
  );
3487
3505
  }
3488
3506
  }
3489
- const AB = 0;
3490
- class lo {
3507
+ const IB = 0;
3508
+ class fo {
3491
3509
  camera_;
3492
3510
  dragActive_ = !1;
3493
3511
  dragStart_ = f();
@@ -3527,7 +3545,7 @@ class lo {
3527
3545
  }
3528
3546
  onPointerDown(A) {
3529
3547
  const I = A.event;
3530
- !A.worldPos || I.button !== AB || (this.dragStart_ = BA(A.worldPos), this.dragActive_ = !0, I.target?.setPointerCapture?.(I.pointerId));
3548
+ !A.worldPos || I.button !== IB || (this.dragStart_ = BA(A.worldPos), this.dragActive_ = !0, I.target?.setPointerCapture?.(I.pointerId));
3531
3549
  }
3532
3550
  onPointerMove(A) {
3533
3551
  if (!this.dragActive_ || !A.worldPos) return;
@@ -3536,10 +3554,10 @@ class lo {
3536
3554
  }
3537
3555
  onPointerEnd(A) {
3538
3556
  const I = A.event;
3539
- !this.dragActive_ || I.button !== AB || (this.dragActive_ = !1, I.target?.releasePointerCapture?.(I.pointerId));
3557
+ !this.dragActive_ || I.button !== IB || (this.dragActive_ = !1, I.target?.releasePointerCapture?.(I.pointerId));
3540
3558
  }
3541
3559
  }
3542
- class IB {
3560
+ class gB {
3543
3561
  radius;
3544
3562
  phi;
3545
3563
  theta;
@@ -3555,22 +3573,22 @@ class IB {
3555
3573
  );
3556
3574
  }
3557
3575
  }
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 {
3576
+ const Ag = -1, BB = 0, UQ = 1, CB = 9e-3, kQ = 1e-3, LQ = 9e-4, JQ = 0.5, YQ = 60;
3577
+ class po {
3560
3578
  camera_;
3561
- orbitVelocity_ = new IB(0, 0, 0);
3579
+ orbitVelocity_ = new gB(0, 0, 0);
3562
3580
  panVelocity_ = f();
3563
3581
  currPos_;
3564
3582
  currCenter_ = f();
3565
3583
  dampingFactor_;
3566
3584
  currMouseButton_ = Ag;
3567
3585
  constructor(A, I) {
3568
- this.camera_ = A, this.currPos_ = new IB(
3586
+ this.camera_ = A, this.currPos_ = new gB(
3569
3587
  I?.radius ?? 1,
3570
3588
  I?.yaw ?? 0,
3571
3589
  I?.pitch ?? 0
3572
3590
  ), I?.target && HA(this.currCenter_, I.target), this.dampingFactor_ = cA(
3573
- I?.dampingFactor ?? LQ,
3591
+ I?.dampingFactor ?? JQ,
3574
3592
  0,
3575
3593
  1
3576
3594
  ), this.updateCamera();
@@ -3596,12 +3614,12 @@ class fo {
3596
3614
  }
3597
3615
  }
3598
3616
  onUpdate(A) {
3599
- if (this.orbitVelocity_.phi === 0 && this.orbitVelocity_.theta === 0 && this.orbitVelocity_.radius === 0 && dB(this.panVelocity_, q(0, 0, 0)))
3617
+ if (this.orbitVelocity_.phi === 0 && this.orbitVelocity_.theta === 0 && this.orbitVelocity_.radius === 0 && MB(this.panVelocity_, q(0, 0, 0)))
3600
3618
  return;
3601
3619
  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_);
3602
3620
  const I = Math.PI / 2 - p;
3603
3621
  this.currPos_.theta = cA(this.currPos_.theta, -I, I), this.currPos_.radius = Math.max(0.01, this.currPos_.radius), this.updateCamera();
3604
- const B = Math.pow(1 - this.dampingFactor_, A * JQ);
3622
+ const B = Math.pow(1 - this.dampingFactor_, A * YQ);
3605
3623
  this.orbitVelocity_.phi *= B, this.orbitVelocity_.theta *= B, this.orbitVelocity_.radius *= B, fA(this.panVelocity_, this.panVelocity_, B), this.cutoffLowVelocity();
3606
3624
  }
3607
3625
  onPointerDown(A) {
@@ -3610,7 +3628,7 @@ class fo {
3610
3628
  }
3611
3629
  onPointerMove(A) {
3612
3630
  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;
3631
+ const I = A.event, B = I.movementX ?? 0, C = I.movementY ?? 0, Q = this.currMouseButton_ === BB && !I.shiftKey, E = this.currMouseButton_ === BB && I.shiftKey || this.currMouseButton_ === UQ;
3614
3632
  Q && this.orbit(B, C), E && this.pan(B, C);
3615
3633
  }
3616
3634
  onWheel(A) {
@@ -3625,21 +3643,21 @@ class fo {
3625
3643
  I.target?.releasePointerCapture?.(I.pointerId);
3626
3644
  }
3627
3645
  orbit(A, I) {
3628
- this.orbitVelocity_.phi -= A * BB, this.orbitVelocity_.theta += I * BB;
3646
+ this.orbitVelocity_.phi -= A * CB, this.orbitVelocity_.theta += I * CB;
3629
3647
  }
3630
3648
  pan(A, I) {
3631
- const B = this.currPos_.radius * UQ, C = f();
3649
+ const B = this.currPos_.radius * kQ, C = f();
3632
3650
  cI(C, C, this.camera_.right, A), cI(C, C, this.camera_.up, I), fA(C, C, B), UI(this.panVelocity_, this.panVelocity_, C);
3633
3651
  }
3634
3652
  zoom(A) {
3635
- this.orbitVelocity_.radius += A * kQ;
3653
+ this.orbitVelocity_.radius += A * LQ;
3636
3654
  }
3637
3655
  updateCamera() {
3638
3656
  const A = lA(f(), this.currCenter_, this.currPos_.toVec3());
3639
3657
  this.camera_.transform.setTranslation(A), this.camera_.transform.targetTo(this.currCenter_);
3640
3658
  }
3641
3659
  cutoffLowVelocity() {
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_);
3660
+ 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_);
3643
3661
  }
3644
3662
  }
3645
3663
  class FA {
@@ -3824,7 +3842,7 @@ class wg extends ZA {
3824
3842
  };
3825
3843
  }
3826
3844
  }
3827
- class po extends FA {
3845
+ class mo extends FA {
3828
3846
  type = "AxesLayer";
3829
3847
  constructor(A) {
3830
3848
  super();
@@ -3860,7 +3878,7 @@ function Ig(g) {
3860
3878
  width: I
3861
3879
  });
3862
3880
  }
3863
- class mo extends FA {
3881
+ class uo extends FA {
3864
3882
  type = "ProjectedLineLayer";
3865
3883
  paths_ = [];
3866
3884
  constructor(A = []) {
@@ -3877,10 +3895,10 @@ class mo extends FA {
3877
3895
  // TODO: this is temporary - we may want to generalize this to all layers
3878
3896
  // for now it is used to set the initial camera position to be centered on the tracks
3879
3897
  get extent() {
3880
- return YQ(this.paths_.flat());
3898
+ return dQ(this.paths_.flat());
3881
3899
  }
3882
3900
  }
3883
- function YQ(g) {
3901
+ function dQ(g) {
3884
3902
  function A(o) {
3885
3903
  const a = g.map((s) => s[o]);
3886
3904
  return [Math.min(...a), Math.max(...a)];
@@ -3888,7 +3906,7 @@ function YQ(g) {
3888
3906
  const [I, B] = A(0), [C, Q] = A(1), [E, i] = A(2);
3889
3907
  return { xMin: I, xMax: B, yMin: C, yMax: Q, zMin: E, zMax: i };
3890
3908
  }
3891
- class uo extends FA {
3909
+ class To extends FA {
3892
3910
  type = "TracksLayer";
3893
3911
  tracks_ = [];
3894
3912
  constructor(A = []) {
@@ -3898,7 +3916,7 @@ class uo extends FA {
3898
3916
  this.tracks_.push(A);
3899
3917
  let I;
3900
3918
  if (A.interpolation) {
3901
- const i = MQ({
3919
+ const i = KQ({
3902
3920
  path: A.path,
3903
3921
  pointsPerSegment: A.interpolation.pointsPerSegment,
3904
3922
  tangentFactor: A.interpolation.tangentFactor
@@ -3929,10 +3947,10 @@ class uo extends FA {
3929
3947
  // for now it is used to set the initial camera position to be centered on the tracks
3930
3948
  get extent() {
3931
3949
  const A = this.tracks_.map((I) => I.path);
3932
- return dQ(A.flat());
3950
+ return MQ(A.flat());
3933
3951
  }
3934
3952
  }
3935
- function dQ(g) {
3953
+ function MQ(g) {
3936
3954
  function A(o) {
3937
3955
  const a = g.map((s) => s[o]);
3938
3956
  return [Math.min(...a), Math.max(...a)];
@@ -3940,12 +3958,12 @@ function dQ(g) {
3940
3958
  const [I, B] = A(0), [C, Q] = A(1), [E, i] = A(2);
3941
3959
  return { xMin: I, xMax: B, yMin: C, yMax: Q, zMin: E, zMax: i };
3942
3960
  }
3943
- function MQ({
3961
+ function KQ({
3944
3962
  path: g,
3945
3963
  pointsPerSegment: A,
3946
3964
  tangentFactor: I = 1 / 3
3947
3965
  }) {
3948
- const B = KQ(g), C = Array((g.length - 1) * A);
3966
+ const B = HQ(g), C = Array((g.length - 1) * A);
3949
3967
  for (let Q = 0; Q < g.length - 1; Q++) {
3950
3968
  const E = g[Q], i = g[Q + 1], o = BA(B[Q]);
3951
3969
  cI(o, E, o, I);
@@ -3953,12 +3971,12 @@ function MQ({
3953
3971
  cI(a, i, a, -I);
3954
3972
  for (let s = 0; s < A; s++) {
3955
3973
  const h = s / A, t = C[Q * A + s] = f();
3956
- pC(t, E, o, a, i, h);
3974
+ uC(t, E, o, a, i, h);
3957
3975
  }
3958
3976
  }
3959
3977
  return C;
3960
3978
  }
3961
- function KQ(g) {
3979
+ function HQ(g) {
3962
3980
  if (g.length < 2)
3963
3981
  throw new Error("Path must contain at least 2 points");
3964
3982
  const A = Array(g.length), I = f(), B = f();
@@ -3968,15 +3986,15 @@ function KQ(g) {
3968
3986
  }
3969
3987
  return A;
3970
3988
  }
3971
- class lB extends bA {
3989
+ class pB extends bA {
3972
3990
  constructor(A, I, B, C) {
3973
3991
  super();
3974
3992
  const Q = [], E = [], i = B, o = C, a = i + 1, s = o + 1, h = A / i, t = I / o;
3975
3993
  for (let y = 0; y < s; ++y) {
3976
3994
  const n = y * t;
3977
3995
  for (let w = 0; w < a; ++w) {
3978
- const r = w * h, G = w / i, c = y / o, N = [r, n, 0], d = [0, 0, 1], L = [G, c];
3979
- Q.push(...N, ...d, ...L);
3996
+ const r = w * h, G = w / i, c = y / o, R = [r, n, 0], Y = [0, 0, 1], k = [G, c];
3997
+ Q.push(...R, ...Y, ...k);
3980
3998
  }
3981
3999
  }
3982
4000
  for (let y = 0; y < o; ++y)
@@ -3999,7 +4017,7 @@ class lB extends bA {
3999
4017
  });
4000
4018
  }
4001
4019
  }
4002
- function CB(g) {
4020
+ function QB(g) {
4003
4021
  return g === 1 || g === 2 || g === 4 || g === 8;
4004
4022
  }
4005
4023
  function mA(g) {
@@ -4019,7 +4037,7 @@ function mA(g) {
4019
4037
  return "float";
4020
4038
  throw new Error("Unsupported buffer type.");
4021
4039
  }
4022
- function HQ(g) {
4040
+ function qQ(g) {
4023
4041
  if (g.dataFormat === "rgb" || g.dataFormat === "rgba")
4024
4042
  return [0, 1];
4025
4043
  switch (g.dataType) {
@@ -4054,9 +4072,9 @@ class Fg extends yg {
4054
4072
  return "Texture";
4055
4073
  }
4056
4074
  }
4057
- const QB = 32;
4075
+ const EB = 32;
4058
4076
  function $A(g, { visible: A, color: I, contrastLimits: B }) {
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(
4077
+ return A === void 0 && (A = !0), I === void 0 ? I = l.WHITE : I = l.from(I), g !== null ? B = lQ(B, g) : B === void 0 && (U.debug(
4060
4078
  "Channel",
4061
4079
  "No texture provided, defaulting channel contrast limits to [0, 1]."
4062
4080
  ), B = [0, 1]), {
@@ -4066,8 +4084,8 @@ function $A(g, { visible: A, color: I, contrastLimits: B }) {
4066
4084
  };
4067
4085
  }
4068
4086
  function ig(g, A) {
4069
- if (A.length > QB)
4070
- throw new Error(`Maximum number of channels is ${QB}`);
4087
+ if (A.length > EB)
4088
+ throw new Error(`Maximum number of channels is ${EB}`);
4071
4089
  if (g?.type === "Texture2DArray") {
4072
4090
  const I = g.depth;
4073
4091
  if (A.length !== I)
@@ -4077,9 +4095,9 @@ function ig(g, A) {
4077
4095
  }
4078
4096
  return A.map((I) => $A(g, I));
4079
4097
  }
4080
- function qQ(g, A) {
4098
+ function lQ(g, A) {
4081
4099
  if (g === void 0)
4082
- return HQ(A);
4100
+ return qQ(A);
4083
4101
  if (g[1] <= g[0])
4084
4102
  throw new Error(
4085
4103
  `Contrast limits must be strictly increasing: ${g}.`
@@ -4089,7 +4107,7 @@ function qQ(g, A) {
4089
4107
  class rg extends ZA {
4090
4108
  channels_;
4091
4109
  constructor(A, I, B, C = []) {
4092
- super(), this.geometry = new lB(A, I, 1, 1), this.setTexture(0, B), this.channels_ = ig(B, C), this.programName = lQ(B);
4110
+ super(), this.geometry = new pB(A, I, 1, 1), this.setTexture(0, B), this.channels_ = ig(B, C), this.programName = fQ(B);
4093
4111
  }
4094
4112
  get type() {
4095
4113
  return "ImageRenderable";
@@ -4134,14 +4152,14 @@ class rg extends ZA {
4134
4152
  }
4135
4153
  }
4136
4154
  }
4137
- function lQ(g) {
4155
+ function fQ(g) {
4138
4156
  if (g.type === "Texture2D")
4139
- return fQ(g.dataType);
4140
- if (g.type === "Texture2DArray")
4141
4157
  return pQ(g.dataType);
4158
+ if (g.type === "Texture2DArray")
4159
+ return mQ(g.dataType);
4142
4160
  throw new Error(`Unsupported image texture type: ${g.type}`);
4143
4161
  }
4144
- function fQ(g) {
4162
+ function pQ(g) {
4145
4163
  switch (g) {
4146
4164
  case "byte":
4147
4165
  case "int":
@@ -4155,7 +4173,7 @@ function fQ(g) {
4155
4173
  return "floatScalarImage";
4156
4174
  }
4157
4175
  }
4158
- function pQ(g) {
4176
+ function mQ(g) {
4159
4177
  switch (g) {
4160
4178
  case "byte":
4161
4179
  case "int":
@@ -4221,12 +4239,12 @@ function Sg(g, A, I, B, C = 3) {
4221
4239
  switch (g.type) {
4222
4240
  case "pointerdown": {
4223
4241
  const Q = g.event;
4224
- return W(Q.clientX, Q.clientY);
4242
+ return Z(Q.clientX, Q.clientY);
4225
4243
  }
4226
4244
  case "pointerup": {
4227
4245
  if (!A) return A;
4228
- const Q = g.event, E = W(Q.clientX, Q.clientY);
4229
- if (vC(A, E) < C) {
4246
+ const Q = g.event, E = Z(Q.clientX, Q.clientY);
4247
+ if (jC(A, E) < C) {
4230
4248
  if (!B) return null;
4231
4249
  const o = g.worldPos;
4232
4250
  if (o) {
@@ -4243,7 +4261,7 @@ function Sg(g, A, I, B, C = 3) {
4243
4261
  return A;
4244
4262
  }
4245
4263
  }
4246
- class fB {
4264
+ class mB {
4247
4265
  bins_ = /* @__PURE__ */ new Map();
4248
4266
  acquire(A) {
4249
4267
  const B = this.bins_.get(A)?.pop();
@@ -4258,13 +4276,13 @@ class fB {
4258
4276
  this.bins_.clear();
4259
4277
  }
4260
4278
  }
4261
- class pB extends FA {
4279
+ class uB extends FA {
4262
4280
  type = "ChunkedImageLayer";
4263
4281
  source_;
4264
4282
  sliceCoords_;
4265
4283
  onPickValue_;
4266
4284
  visibleChunks_ = /* @__PURE__ */ new Map();
4267
- pool_ = new fB();
4285
+ pool_ = new mB();
4268
4286
  initialChannelProps_;
4269
4287
  channelChangeCallbacks_ = [];
4270
4288
  policy_;
@@ -4334,7 +4352,7 @@ class pB extends FA {
4334
4352
  return this.lastPresentationTimeCoord_;
4335
4353
  }
4336
4354
  isPresentationStale() {
4337
- return this.lastPresentationTimeStamp_ === void 0 ? !1 : performance.now() - this.lastPresentationTimeStamp_ > pB.STALE_PRESENTATION_MS_;
4355
+ return this.lastPresentationTimeStamp_ === void 0 ? !1 : performance.now() - this.lastPresentationTimeStamp_ > uB.STALE_PRESENTATION_MS_;
4338
4356
  }
4339
4357
  resliceIfZChanged() {
4340
4358
  const A = this.sliceCoords_.z;
@@ -4384,7 +4402,7 @@ class pB extends FA {
4384
4402
  getImageForChunk(A) {
4385
4403
  const I = this.visibleChunks_.get(A);
4386
4404
  if (I) return I;
4387
- const B = this.pool_.acquire(EB(A));
4405
+ const B = this.pool_.acquire(iB(A));
4388
4406
  return B ? (B.textures[0].updateWithChunk(A, this.getDataForImage(A)), this.updateImageChunk(B, A), this.channelProps_ && B.setChannelProps(this.channelProps_), B) : this.createImage(A);
4389
4407
  }
4390
4408
  createImage(A) {
@@ -4467,18 +4485,18 @@ class pB extends FA {
4467
4485
  releaseAndRemoveChunks(A) {
4468
4486
  for (const I of A) {
4469
4487
  const B = this.visibleChunks_.get(I);
4470
- B && (this.pool_.release(EB(I), B), this.visibleChunks_.delete(I));
4488
+ B && (this.pool_.release(iB(I), B), this.visibleChunks_.delete(I));
4471
4489
  }
4472
4490
  }
4473
4491
  }
4474
- function EB(g) {
4492
+ function iB(g) {
4475
4493
  return [
4476
4494
  `lod${g.lod}`,
4477
4495
  `shape${g.shape.x}x${g.shape.y}`,
4478
4496
  `align${g.rowAlignmentBytes}`
4479
4497
  ].join(":");
4480
4498
  }
4481
- class mQ extends bA {
4499
+ class uQ extends bA {
4482
4500
  constructor(A, I, B, C, Q, E) {
4483
4501
  super();
4484
4502
  const i = [], o = [], a = Math.floor(C), s = Math.floor(Q), h = Math.floor(E);
@@ -4497,19 +4515,19 @@ class mQ extends bA {
4497
4515
  });
4498
4516
  }
4499
4517
  buildFace(A, I, B, C, Q, E, i, o, a, s, h, t, y) {
4500
- const n = E / a, w = i / s, r = E / 2, G = i / 2, c = o / 2 * h, N = a + 1, d = s + 1, L = t.length / 8;
4501
- for (let k = 0; k < d; k++) {
4502
- const T = -G + k * w;
4503
- for (let P = 0; P < N; P++) {
4504
- const O = -r + P * n, Z = { x: 0, y: 0, z: 0 };
4505
- Z[A] = O * C, Z[I] = T * Q, Z[B] = c;
4518
+ const n = E / a, w = i / s, r = E / 2, G = i / 2, c = o / 2 * h, R = a + 1, Y = s + 1, k = t.length / 8;
4519
+ for (let L = 0; L < Y; L++) {
4520
+ const m = -G + L * w;
4521
+ for (let x = 0; x < R; x++) {
4522
+ const b = -r + x * n, O = { x: 0, y: 0, z: 0 };
4523
+ O[A] = b * C, O[I] = m * Q, O[B] = c;
4506
4524
  const V = { x: 0, y: 0, z: 0 };
4507
4525
  V[B] = h;
4508
- const iA = P / a, oA = 1 - k / s;
4526
+ const iA = x / a, oA = 1 - L / s;
4509
4527
  t.push(
4510
- Z.x,
4511
- Z.y,
4512
- Z.z,
4528
+ O.x,
4529
+ O.y,
4530
+ O.z,
4513
4531
  V.x,
4514
4532
  V.y,
4515
4533
  V.z,
@@ -4518,10 +4536,10 @@ class mQ extends bA {
4518
4536
  );
4519
4537
  }
4520
4538
  }
4521
- for (let k = 0; k < s; k++)
4522
- for (let T = 0; T < a; T++) {
4523
- const P = L + T + N * k, O = L + T + N * (k + 1), Z = L + (T + 1) + N * (k + 1), V = L + (T + 1) + N * k;
4524
- y.push(P, O, V, O, Z, V);
4539
+ for (let L = 0; L < s; L++)
4540
+ for (let m = 0; m < a; m++) {
4541
+ const x = k + m + R * L, b = k + m + R * (L + 1), O = k + (m + 1) + R * (L + 1), V = k + (m + 1) + R * L;
4542
+ y.push(x, b, V, b, O, V);
4525
4543
  }
4526
4544
  }
4527
4545
  }
@@ -4578,13 +4596,13 @@ class jA extends Fg {
4578
4596
  return B.unpackAlignment = A.rowAlignmentBytes, B;
4579
4597
  }
4580
4598
  }
4581
- class uQ extends ZA {
4599
+ class TQ extends ZA {
4582
4600
  voxelScale = q(1, 1, 1);
4583
4601
  channels_;
4584
4602
  channelToTextureIndex_ = /* @__PURE__ */ new Map();
4585
4603
  loadedChannels_ = /* @__PURE__ */ new Set();
4586
4604
  constructor() {
4587
- super(), this.geometry = new mQ(1, 1, 1, 1, 1, 1), this.cullFaceMode = "front", this.depthTest = !1, this.channels_ = [];
4605
+ super(), this.geometry = new uQ(1, 1, 1, 1, 1, 1), this.cullFaceMode = "front", this.depthTest = !1, this.channels_ = [];
4588
4606
  }
4589
4607
  get type() {
4590
4608
  return "VolumeRenderable";
@@ -4596,7 +4614,7 @@ class uQ extends ZA {
4596
4614
  addChannelTexture(A, I) {
4597
4615
  const B = jA.createWithChunk(I), C = this.textures.length;
4598
4616
  this.setTexture(C, B), this.channelToTextureIndex_.set(A, C);
4599
- const Q = TQ(B.dataType);
4617
+ const Q = xQ(B.dataType);
4600
4618
  if (this.programName && this.programName !== Q)
4601
4619
  throw new Error(
4602
4620
  `Volume renderable does not support multiple channels with different data types. Existing program: ${this.programName}, new channel data type: ${B.dataType} and program: ${Q}`
@@ -4684,7 +4702,7 @@ class uQ extends ZA {
4684
4702
  this.channels_[A] = C;
4685
4703
  }
4686
4704
  }
4687
- function TQ(g) {
4705
+ function xQ(g) {
4688
4706
  switch (g) {
4689
4707
  case "byte":
4690
4708
  case "int":
@@ -4698,7 +4716,7 @@ function TQ(g) {
4698
4716
  return "floatVolume";
4699
4717
  }
4700
4718
  }
4701
- function xQ(g, A) {
4719
+ function WQ(g, A) {
4702
4720
  const I = A.position, B = f(), C = f();
4703
4721
  return g.sort((Q, E) => {
4704
4722
  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);
@@ -4706,14 +4724,14 @@ function xQ(g, A) {
4706
4724
  return i - o;
4707
4725
  }), g;
4708
4726
  }
4709
- const WQ = 2;
4710
- class To extends FA {
4727
+ const bQ = 2;
4728
+ class xo extends FA {
4711
4729
  type = "VolumeLayer";
4712
4730
  source_;
4713
4731
  sliceCoords_;
4714
4732
  currentVolumes_ = /* @__PURE__ */ new Map();
4715
4733
  volumeToPoolKey_ = /* @__PURE__ */ new Map();
4716
- pool_ = new fB();
4734
+ pool_ = new mB();
4717
4735
  initialChannelProps_;
4718
4736
  channelChangeCallbacks_ = [];
4719
4737
  sourcePolicy_;
@@ -4776,7 +4794,7 @@ class To extends FA {
4776
4794
  for (const E of I) B.updateVolumeWithChunk(E);
4777
4795
  return B;
4778
4796
  }
4779
- const C = PQ(I[0]), Q = this.pool_.acquire(C) ?? new uQ();
4797
+ const C = OQ(I[0]), Q = this.pool_.acquire(C) ?? new TQ();
4780
4798
  Q.setChannelProps(this.channelProps_ ?? []), this.volumeToPoolKey_.set(Q, C);
4781
4799
  for (const E of I) Q.updateVolumeWithChunk(E);
4782
4800
  return this.updateVolumeTransform(Q, I[0]), Q;
@@ -4794,7 +4812,7 @@ class To extends FA {
4794
4812
  if (!this.chunkStoreView_) return;
4795
4813
  const A = this.chunkStoreView_.getChunksToRender(
4796
4814
  this.sliceCoords_
4797
- ), I = this.sliceCoords_.t ?? -1, B = ZQ(A), C = this.lastLoadedTime_ !== I || B.size !== this.currentVolumes_.size || this.lastNumRenderedChannelChunks_ !== A.length;
4815
+ ), I = this.sliceCoords_.t ?? -1, B = PQ(A), C = this.lastLoadedTime_ !== I || B.size !== this.currentVolumes_.size || this.lastNumRenderedChannelChunks_ !== A.length;
4798
4816
  if (this.lastNumRenderedChannelChunks_ = A.length, !C) return;
4799
4817
  const Q = Array.from(this.currentVolumes_.entries()).filter(([E]) => !B.has(E)).map(([, E]) => E);
4800
4818
  this.releaseAndRemoveVolumes(Q), this.currentVolumes_.clear(), this.clearObjects();
@@ -4837,7 +4855,7 @@ class To extends FA {
4837
4855
  A.viewport
4838
4856
  );
4839
4857
  const I = A.viewport.cameraControls?.isMoving ?? !1;
4840
- this.interactiveStepSizeScale_ = I ? WQ : 1, this.updateChunks(), xQ(this.objects, A.viewport.camera);
4858
+ this.interactiveStepSizeScale_ = I ? bQ : 1, this.updateChunks(), WQ(this.objects, A.viewport.camera);
4841
4859
  }
4842
4860
  getUniforms() {
4843
4861
  return {
@@ -4848,27 +4866,27 @@ class To extends FA {
4848
4866
  };
4849
4867
  }
4850
4868
  }
4851
- function bQ(g) {
4869
+ function ZQ(g) {
4852
4870
  const { x: A, y: I, z: B, t: C } = g.chunkIndex;
4853
4871
  return `${A}:${I}:${B}:${C}`;
4854
4872
  }
4855
- function ZQ(g) {
4873
+ function PQ(g) {
4856
4874
  const A = /* @__PURE__ */ new Map();
4857
4875
  for (const I of g) {
4858
- const B = bQ(I);
4876
+ const B = ZQ(I);
4859
4877
  let C = A.get(B);
4860
4878
  C || (C = [], A.set(B, C)), C.push(I);
4861
4879
  }
4862
4880
  return A;
4863
4881
  }
4864
- function PQ(g) {
4882
+ function OQ(g) {
4865
4883
  return [
4866
4884
  `lod${g.lod}`,
4867
4885
  `shape${g.shape.x}x${g.shape.y}x${g.shape.z}`,
4868
4886
  `align${g.rowAlignmentBytes}`
4869
4887
  ].join(":");
4870
4888
  }
4871
- class xo extends FA {
4889
+ class Wo extends FA {
4872
4890
  type = "ImageLayer";
4873
4891
  source_;
4874
4892
  region_;
@@ -5015,7 +5033,7 @@ class AI extends Fg {
5015
5033
  return C.unpackAlignment = A.rowAlignmentBytes, C;
5016
5034
  }
5017
5035
  }
5018
- const OQ = [
5036
+ const VQ = [
5019
5037
  [1, 0.5, 0.5],
5020
5038
  [0.5, 1, 0.5],
5021
5039
  [0.5, 0.5, 1],
@@ -5023,7 +5041,7 @@ const OQ = [
5023
5041
  [1, 0.5, 1],
5024
5042
  [1, 1, 0.5]
5025
5043
  ];
5026
- function VQ(g) {
5044
+ function vQ(g) {
5027
5045
  return g = g ?? /* @__PURE__ */ new Map(), new Map(
5028
5046
  Array.from(g.entries()).map(([A, I]) => [
5029
5047
  A,
@@ -5031,37 +5049,37 @@ function VQ(g) {
5031
5049
  ])
5032
5050
  );
5033
5051
  }
5034
- function vQ(g) {
5035
- return g = g ?? OQ, g.map(l.from);
5052
+ function XQ(g) {
5053
+ return g = g ?? VQ, g.map(l.from);
5036
5054
  }
5037
- class iB {
5055
+ class oB {
5038
5056
  lookupTable;
5039
5057
  cycle;
5040
5058
  constructor(A = {}) {
5041
- this.lookupTable = VQ(A.lookupTable), this.cycle = vQ(A.cycle);
5059
+ this.lookupTable = vQ(A.lookupTable), this.cycle = XQ(A.cycle);
5042
5060
  }
5043
5061
  }
5044
- const XQ = /* @__PURE__ */ new Set([
5062
+ const jQ = /* @__PURE__ */ new Set([
5045
5063
  "unsigned_byte",
5046
5064
  "unsigned_short",
5047
5065
  "unsigned_int"
5048
5066
  ]);
5049
- function jQ(g) {
5067
+ function zQ(g) {
5050
5068
  if (g.dataFormat !== "scalar")
5051
5069
  throw new Error(
5052
5070
  `Image data format must be scalar, instead found: ${g.dataFormat}`
5053
5071
  );
5054
- if (!XQ.has(g.dataType))
5072
+ if (!jQ.has(g.dataType))
5055
5073
  throw new Error(
5056
5074
  `Image data type must be unsigned, instead found: ${g.dataType}`
5057
5075
  );
5058
5076
  return g;
5059
5077
  }
5060
- class zQ extends ZA {
5078
+ class _Q extends ZA {
5061
5079
  outlineSelected_;
5062
5080
  selectedValue_;
5063
5081
  constructor(A) {
5064
- super(), this.geometry = new lB(A.width, A.height, 1, 1), this.setTexture(0, jQ(A.imageData));
5082
+ super(), this.geometry = new pB(A.width, A.height, 1, 1), this.setTexture(0, zQ(A.imageData));
5065
5083
  const I = this.makeColorCycleTexture(A.colorMap.cycle);
5066
5084
  this.setTexture(1, I);
5067
5085
  const B = this.makeColorLookupTableTexture(
@@ -5099,7 +5117,7 @@ class zQ extends ZA {
5099
5117
  return Q.set(I, 0), Q.set(B, C), new AI(Q, C, 2);
5100
5118
  }
5101
5119
  }
5102
- class Wo extends FA {
5120
+ class bo extends FA {
5103
5121
  type = "LabelImageLayer";
5104
5122
  source_;
5105
5123
  region_;
@@ -5120,7 +5138,7 @@ class Wo extends FA {
5120
5138
  outlineSelected: E = !1,
5121
5139
  ...i
5122
5140
  }) {
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;
5141
+ super(i), this.setState("initialized"), this.source_ = A, this.region_ = I, this.colorMap_ = new oB(B), this.onPickValue_ = C, this.lod_ = Q, this.outlineSelected_ = E;
5124
5142
  }
5125
5143
  update() {
5126
5144
  switch (this.state) {
@@ -5140,7 +5158,7 @@ class Wo extends FA {
5140
5158
  return this.colorMap_;
5141
5159
  }
5142
5160
  setColorMap(A) {
5143
- this.colorMap_ = new iB(A), this.image_ && this.image_.setColorMap(this.colorMap_);
5161
+ this.colorMap_ = new oB(A), this.image_ && this.image_.setColorMap(this.colorMap_);
5144
5162
  }
5145
5163
  setSelectedValue(A) {
5146
5164
  this.selectedValue_ = A, this.image_ && this.image_.setSelectedValue(this.selectedValue_);
@@ -5164,7 +5182,7 @@ class Wo extends FA {
5164
5182
  }
5165
5183
  createImage(A) {
5166
5184
  this.imageChunk_ = A;
5167
- const I = new zQ({
5185
+ const I = new _Q({
5168
5186
  width: A.shape.x,
5169
5187
  height: A.shape.y,
5170
5188
  imageData: AI.createWithChunk(A),
@@ -5193,7 +5211,7 @@ class TI extends Error {
5193
5211
  super(A), this.name = "AbortError", Object.setPrototypeOf(this, TI.prototype);
5194
5212
  }
5195
5213
  }
5196
- class _Q {
5214
+ class $Q {
5197
5215
  maxConcurrent_;
5198
5216
  pending_ = [];
5199
5217
  abortController_ = new AbortController();
@@ -5237,12 +5255,12 @@ class _Q {
5237
5255
  return this.pending_.length;
5238
5256
  }
5239
5257
  }
5240
- class $Q {
5258
+ class AE {
5241
5259
  source_;
5242
5260
  region_;
5243
5261
  seriesDimensionName_;
5244
5262
  seriesIndex_;
5245
- scheduler_ = new _Q(16);
5263
+ scheduler_ = new $Q(16);
5246
5264
  lod_;
5247
5265
  loader_ = null;
5248
5266
  seriesAttributes_;
@@ -5355,7 +5373,7 @@ class $Q {
5355
5373
  return this.loader_ ??= await this.source_.open(), this.loader_;
5356
5374
  }
5357
5375
  }
5358
- class bo extends FA {
5376
+ class Zo extends FA {
5359
5377
  type = "ImageSeriesLayer";
5360
5378
  seriesLoader_;
5361
5379
  initialChannelProps_;
@@ -5372,7 +5390,7 @@ class bo extends FA {
5372
5390
  lod: Q,
5373
5391
  ...E
5374
5392
  }) {
5375
- super(E), this.setState("initialized"), this.channelProps_ = C, this.initialChannelProps_ = C, this.seriesLoader_ = new $Q({
5393
+ super(E), this.setState("initialized"), this.channelProps_ = C, this.initialChannelProps_ = C, this.seriesLoader_ = new AE({
5376
5394
  source: A,
5377
5395
  region: I,
5378
5396
  seriesDimensionName: B,
@@ -5438,7 +5456,7 @@ class bo extends FA {
5438
5456
  return C.transform.setScale([A.scale.x, A.scale.y, 1]), C.transform.setTranslation([A.offset.x, A.offset.y, 0]), C;
5439
5457
  }
5440
5458
  }
5441
- function mB(g, A, I, B = {}) {
5459
+ function TB(g, A, I, B = {}) {
5442
5460
  return A !== void 0 && I !== void 0 && (B = {
5443
5461
  ...B,
5444
5462
  headers: {
@@ -5447,7 +5465,7 @@ function mB(g, A, I, B = {}) {
5447
5465
  }
5448
5466
  }), fetch(g, B);
5449
5467
  }
5450
- function AE(g, A) {
5468
+ function IE(g, A) {
5451
5469
  return {
5452
5470
  ...g,
5453
5471
  ...A,
@@ -5457,20 +5475,20 @@ function AE(g, A) {
5457
5475
  }
5458
5476
  };
5459
5477
  }
5460
- function oB(g, A) {
5478
+ function aB(g, A) {
5461
5479
  const I = typeof g == "string" ? new URL(g) : g;
5462
5480
  I.pathname.endsWith("/") || (I.pathname += "/");
5463
5481
  const B = new URL(A.slice(1), I);
5464
5482
  return B.search = I.search, B;
5465
5483
  }
5466
- async function aB(g) {
5484
+ async function sB(g) {
5467
5485
  if (g.status !== 404) {
5468
5486
  if (g.status === 200 || g.status === 206)
5469
5487
  return new Uint8Array(await g.arrayBuffer());
5470
5488
  throw new Error(`Unexpected response status ${g.status} ${g.statusText}`);
5471
5489
  }
5472
5490
  }
5473
- async function IE(g, A, I, B) {
5491
+ async function gE(g, A, I, B) {
5474
5492
  if (B)
5475
5493
  return fetch(g, {
5476
5494
  ...I,
@@ -5480,7 +5498,7 @@ async function IE(g, A, I, B) {
5480
5498
  if (!C.ok)
5481
5499
  return C;
5482
5500
  let Q = C.headers.get("Content-Length"), E = Number(Q);
5483
- return mB(g, E - A, E, I);
5501
+ return TB(g, E - A, E, I);
5484
5502
  }
5485
5503
  class PA {
5486
5504
  url;
@@ -5490,18 +5508,18 @@ class PA {
5490
5508
  this.url = A, this.#A = I.overrides ?? {}, this.#I = I.useSuffixRequest ?? !1;
5491
5509
  }
5492
5510
  #g(A) {
5493
- return AE(this.#A, A);
5511
+ return IE(this.#A, A);
5494
5512
  }
5495
5513
  async get(A, I = {}) {
5496
- let B = oB(this.url, A).href, C = await fetch(B, this.#g(I));
5497
- return aB(C);
5514
+ let B = aB(this.url, A).href, C = await fetch(B, this.#g(I));
5515
+ return sB(C);
5498
5516
  }
5499
5517
  async getRange(A, I, B = {}) {
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);
5518
+ let C = aB(this.url, A), Q = this.#g(B), E;
5519
+ return "suffixLength" in I ? E = await gE(C, I.suffixLength, Q, this.#I) : E = await TB(C, I.offset, I.length, Q), sB(E);
5502
5520
  }
5503
5521
  }
5504
- class uB {
5522
+ class xB {
5505
5523
  #A;
5506
5524
  constructor(A, I, B) {
5507
5525
  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));
@@ -5644,14 +5662,14 @@ function GI(g) {
5644
5662
  const A = new TextDecoder().decode(g);
5645
5663
  return JSON.parse(A);
5646
5664
  }
5647
- function sB(g, A) {
5665
+ function DB(g, A) {
5648
5666
  const I = A / 2, B = A - 1;
5649
5667
  let C = 0;
5650
5668
  for (let Q = 0; Q < g.length; Q += A)
5651
5669
  for (let E = 0; E < I; E += 1)
5652
5670
  C = g[Q + E], g[Q + E] = g[Q + B - E], g[Q + B - E] = C;
5653
5671
  }
5654
- function TB(g) {
5672
+ function WB(g) {
5655
5673
  if (g === "v2:object")
5656
5674
  return globalThis.Array;
5657
5675
  let A = g.match(/v2:([US])(\d+)/);
@@ -5671,19 +5689,19 @@ function TB(g) {
5671
5689
  float16: globalThis.Float16Array,
5672
5690
  float32: Float32Array,
5673
5691
  float64: Float64Array,
5674
- bool: uB
5692
+ bool: xB
5675
5693
  }[g];
5676
- return x(I, `Unknown or unsupported data_type: ${g}`), I;
5694
+ return W(I, `Unknown or unsupported data_type: ${g}`), I;
5677
5695
  }
5678
5696
  function UA(g, A) {
5679
5697
  const I = g.length;
5680
- typeof A == "string" && (A = A === "C" ? Array.from({ length: I }, (Q, E) => E) : Array.from({ length: I }, (Q, E) => I - 1 - E)), x(I === A.length, "Order length must match the number of dimensions.");
5698
+ typeof A == "string" && (A = A === "C" ? Array.from({ length: I }, (Q, E) => E) : Array.from({ length: I }, (Q, E) => I - 1 - E)), W(I === A.length, "Order length must match the number of dimensions.");
5681
5699
  let B = 1, C = new Array(I);
5682
5700
  for (let Q = A.length - 1; Q >= 0; Q--)
5683
5701
  C[A[Q]] = B, B *= g[A[Q]];
5684
5702
  return C;
5685
5703
  }
5686
- function gE({ name: g, configuration: A }) {
5704
+ function BE({ name: g, configuration: A }) {
5687
5705
  if (g === "default") {
5688
5706
  const I = A?.separator ?? "/";
5689
5707
  return (B) => ["c", ...B].join(I);
@@ -5694,11 +5712,11 @@ function gE({ name: g, configuration: A }) {
5694
5712
  }
5695
5713
  throw new Error(`Unknown chunk key encoding: ${g}`);
5696
5714
  }
5697
- function BE(g) {
5715
+ function CE(g) {
5698
5716
  if (g === "|O")
5699
5717
  return { data_type: "v2:object" };
5700
5718
  let A = g.match(/^([<|>])(.*)$/);
5701
- x(A, `Invalid dtype: ${g}`);
5719
+ W(A, `Invalid dtype: ${g}`);
5702
5720
  let [, I, B] = A, C = {
5703
5721
  b1: "bool",
5704
5722
  i1: "int8",
@@ -5713,10 +5731,10 @@ function BE(g) {
5713
5731
  f4: "float32",
5714
5732
  f8: "float64"
5715
5733
  }[B] ?? (B.startsWith("S") || B.startsWith("U") ? `v2:${B}` : void 0);
5716
- return x(C, `Unsupported or unknown dtype: ${g}`), I === "|" ? { data_type: C } : { data_type: C, endian: I === "<" ? "little" : "big" };
5734
+ return W(C, `Unsupported or unknown dtype: ${g}`), I === "|" ? { data_type: C } : { data_type: C, endian: I === "<" ? "little" : "big" };
5717
5735
  }
5718
- function CE(g, A = {}) {
5719
- let I = [], B = BE(g.dtype);
5736
+ function QE(g, A = {}) {
5737
+ let I = [], B = CE(g.dtype);
5720
5738
  g.order === "F" && I.push({ name: "transpose", configuration: { order: "F" } }), "endian" in B && B.endian === "big" && I.push({ name: "bytes", configuration: { endian: "big" } });
5721
5739
  for (let { id: C, ...Q } of g.filters ?? [])
5722
5740
  I.push({ name: C, configuration: Q });
@@ -5746,14 +5764,14 @@ function CE(g, A = {}) {
5746
5764
  attributes: A
5747
5765
  };
5748
5766
  }
5749
- function QE(g, A = {}) {
5767
+ function EE(g, A = {}) {
5750
5768
  return {
5751
5769
  zarr_format: 3,
5752
5770
  node_type: "group",
5753
5771
  attributes: A
5754
5772
  };
5755
5773
  }
5756
- function EE(g, A) {
5774
+ function iE(g, A) {
5757
5775
  if (A !== "number" && A !== "bigint" && A !== "boolean" && A !== "object" && A !== "string")
5758
5776
  return g === A;
5759
5777
  let I = g === "bool";
@@ -5768,23 +5786,23 @@ function EE(g, A) {
5768
5786
  let Q = g === "v2:object";
5769
5787
  return A === "object" ? Q : !B && !C && !I && !Q;
5770
5788
  }
5771
- function iE(g) {
5789
+ function oE(g) {
5772
5790
  return g?.name === "sharding_indexed";
5773
5791
  }
5774
- function xB(g) {
5792
+ function bB(g) {
5775
5793
  return (g.data_type === "uint64" || g.data_type === "int64") && g.fill_value != null ? BigInt(g.fill_value) : g.fill_value;
5776
5794
  }
5777
- function WB(g, ...A) {
5795
+ function ZB(g, ...A) {
5778
5796
  if (!A.some((I) => g instanceof I))
5779
5797
  throw g;
5780
5798
  }
5781
- function x(g, A = "") {
5799
+ function W(g, A = "") {
5782
5800
  if (!g)
5783
5801
  throw new Error(A);
5784
5802
  }
5785
- async function bB(g, { format: A, signal: I }) {
5803
+ async function PB(g, { format: A, signal: I }) {
5786
5804
  const B = g instanceof Response ? g : new Response(g);
5787
- x(B.body, "Response does not contain body.");
5805
+ W(B.body, "Response does not contain body.");
5788
5806
  try {
5789
5807
  return await new Response(B.body.pipeThrough(new DecompressionStream(A), { signal: I })).arrayBuffer();
5790
5808
  } catch {
@@ -5794,7 +5812,7 @@ async function bB(g, { format: A, signal: I }) {
5794
5812
  class Ng {
5795
5813
  kind = "array_to_array";
5796
5814
  constructor(A, I) {
5797
- x(A.keepbits >= 0, "keepbits must be zero or positive");
5815
+ W(A.keepbits >= 0, "keepbits must be zero or positive");
5798
5816
  }
5799
5817
  static fromConfig(A, I) {
5800
5818
  return new Ng(A, I);
@@ -5815,12 +5833,12 @@ class Ng {
5815
5833
  return A;
5816
5834
  }
5817
5835
  }
5818
- const DB = oE();
5819
- function oE() {
5836
+ const hB = aE();
5837
+ function aE() {
5820
5838
  const g = new Uint32Array([305419896]);
5821
5839
  return new Uint8Array(g.buffer, g.byteOffset, g.byteLength)[0] !== 18;
5822
5840
  }
5823
- function hB(g) {
5841
+ function tB(g) {
5824
5842
  return "BYTES_PER_ELEMENT" in g ? g.BYTES_PER_ELEMENT : 4;
5825
5843
  }
5826
5844
  class xI {
@@ -5831,7 +5849,7 @@ class xI {
5831
5849
  #C;
5832
5850
  #B;
5833
5851
  constructor(A, I) {
5834
- this.#B = A?.endian, this.#I = TB(I.data_type), this.#C = I.shape, this.#A = UA(I.shape, "C");
5852
+ this.#B = A?.endian, this.#I = WB(I.data_type), this.#C = I.shape, this.#A = UA(I.shape, "C");
5835
5853
  const B = new this.#I(0);
5836
5854
  this.#g = B.BYTES_PER_ELEMENT;
5837
5855
  }
@@ -5840,10 +5858,10 @@ class xI {
5840
5858
  }
5841
5859
  encode(A) {
5842
5860
  let I = new Uint8Array(A.data.buffer);
5843
- return DB && this.#B === "big" && sB(I, hB(this.#I)), I;
5861
+ return hB && this.#B === "big" && DB(I, tB(this.#I)), I;
5844
5862
  }
5845
5863
  decode(A) {
5846
- return DB && this.#B === "big" && sB(A, hB(this.#I)), {
5864
+ return hB && this.#B === "big" && DB(A, tB(this.#I)), {
5847
5865
  data: new this.#I(A.buffer, A.byteOffset, A.byteLength / this.#g),
5848
5866
  shape: this.#C,
5849
5867
  stride: this.#A
@@ -5871,14 +5889,14 @@ class Ug {
5871
5889
  throw new Error("Gzip encoding is not enabled by default. Please register a custom codec with `numcodecs/gzip`.");
5872
5890
  }
5873
5891
  async decode(A) {
5874
- const I = await bB(A, { format: "gzip" });
5892
+ const I = await PB(A, { format: "gzip" });
5875
5893
  return new Uint8Array(I);
5876
5894
  }
5877
5895
  }
5878
- function aE(g, A) {
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;
5880
- }
5881
5896
  function sE(g, A) {
5897
+ return W(!Number.isNaN(A), "JsonCodec allow_nan is false but NaN was encountered during encoding."), W(A !== Number.POSITIVE_INFINITY, "JsonCodec allow_nan is false but Infinity was encountered during encoding."), W(A !== Number.NEGATIVE_INFINITY, "JsonCodec allow_nan is false but -Infinity was encountered during encoding."), A;
5898
+ }
5899
+ function DE(g, A) {
5882
5900
  return A instanceof Object && !Array.isArray(A) ? Object.keys(A).sort().reduce((I, B) => (I[B] = A[B], I), {}) : A;
5883
5901
  }
5884
5902
  class kg {
@@ -5906,9 +5924,9 @@ class kg {
5906
5924
  }
5907
5925
  encode(A) {
5908
5926
  const { indent: I, encoding: B, ensure_ascii: C, check_circular: Q, allow_nan: E, sort_keys: i } = this.#A;
5909
- x(B === "utf-8", "JsonCodec does not yet support non-utf-8 encoding.");
5927
+ W(B === "utf-8", "JsonCodec does not yet support non-utf-8 encoding.");
5910
5928
  const o = [];
5911
- x(Q, "JsonCodec does not yet support skipping the check for circular references during encoding."), E || o.push(aE), i && o.push(sE);
5929
+ W(Q, "JsonCodec does not yet support skipping the check for circular references during encoding."), E || o.push(sE), i && o.push(DE);
5912
5930
  const a = Array.from(A.data);
5913
5931
  a.push("|O"), a.push(A.shape);
5914
5932
  let s;
@@ -5926,15 +5944,15 @@ class kg {
5926
5944
  }
5927
5945
  decode(A) {
5928
5946
  const { strict: I } = this.#I;
5929
- x(I, "JsonCodec does not yet support non-strict decoding.");
5947
+ W(I, "JsonCodec does not yet support non-strict decoding.");
5930
5948
  const B = GI(A), C = B.pop();
5931
- B.pop(), x(C, "0D not implemented for JsonCodec.");
5949
+ B.pop(), W(C, "0D not implemented for JsonCodec.");
5932
5950
  const Q = UA(C, "C");
5933
5951
  return { data: B, shape: C, stride: Q };
5934
5952
  }
5935
5953
  }
5936
- function tB(g) {
5937
- return g instanceof uB || g instanceof Rg || g instanceof eI ? new Proxy(g, {
5954
+ function yB(g) {
5955
+ return g instanceof xB || g instanceof Rg || g instanceof eI ? new Proxy(g, {
5938
5956
  get(I, B) {
5939
5957
  return I.get(Number(B));
5940
5958
  },
@@ -5943,7 +5961,7 @@ function tB(g) {
5943
5961
  }
5944
5962
  }) : g;
5945
5963
  }
5946
- function DE(g, A) {
5964
+ function hE(g, A) {
5947
5965
  let I;
5948
5966
  return g.data instanceof Rg || g.data instanceof eI ? I = new g.constructor(
5949
5967
  // @ts-expect-error
@@ -5955,8 +5973,8 @@ function DE(g, A) {
5955
5973
  stride: UA(g.shape, A)
5956
5974
  };
5957
5975
  }
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);
5976
+ function tE(g, A) {
5977
+ let I = hE(g, A), B = g.shape.length, C = g.data.length, Q = Array(B).fill(0), E = yB(g.data), i = yB(I.data);
5960
5978
  for (let o = 0; o < C; o++) {
5961
5979
  let a = 0;
5962
5980
  for (let s = 0; s < B; s++)
@@ -5971,13 +5989,13 @@ function hE(g, A) {
5971
5989
  }
5972
5990
  return I;
5973
5991
  }
5974
- function tE(g) {
5992
+ function yE(g) {
5975
5993
  let A = g.shape.length;
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);
5994
+ return W(A === g.stride.length, "Shape and stride must have the same length."), g.stride.map((I, B) => ({ stride: I, index: B })).sort((I, B) => B.stride - I.stride).map((I) => I.index);
5977
5995
  }
5978
- function yE(g, A) {
5979
- let I = tE(g);
5980
- return x(I.length === A.length, "Orders must match"), I.every((B, C) => B === A[C]);
5996
+ function eE(g, A) {
5997
+ let I = yE(g);
5998
+ return W(I.length === A.length, "Orders must match"), I.every((B, C) => B === A[C]);
5981
5999
  }
5982
6000
  class Lg {
5983
6001
  kind = "array_to_array";
@@ -5993,7 +6011,7 @@ class Lg {
5993
6011
  Q[i] = C - i - 1, E[i] = C - i - 1;
5994
6012
  else
5995
6013
  Q = B, Q.forEach((i, o) => {
5996
- x(E[i] === void 0, `Invalid permutation: ${JSON.stringify(B)}`), E[i] = o;
6014
+ W(E[i] === void 0, `Invalid permutation: ${JSON.stringify(B)}`), E[i] = o;
5997
6015
  });
5998
6016
  this.#A = Q, this.#I = E;
5999
6017
  }
@@ -6001,7 +6019,7 @@ class Lg {
6001
6019
  return new Lg(A, I);
6002
6020
  }
6003
6021
  encode(A) {
6004
- return yE(A, this.#I) ? A : hE(A, this.#I);
6022
+ return eE(A, this.#I) ? A : tE(A, this.#I);
6005
6023
  }
6006
6024
  decode(A) {
6007
6025
  return {
@@ -6042,19 +6060,19 @@ class Yg {
6042
6060
  throw new Error("Zlib encoding is not enabled by default. Please register a codec with `numcodecs/zlib`.");
6043
6061
  }
6044
6062
  async decode(A) {
6045
- const I = await bB(A, { format: "deflate" });
6063
+ const I = await PB(A, { format: "deflate" });
6046
6064
  return new Uint8Array(I);
6047
6065
  }
6048
6066
  }
6049
- function eE() {
6067
+ function GE() {
6050
6068
  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);
6051
6069
  }
6052
- const GE = eE();
6070
+ const nE = GE();
6053
6071
  function og(g) {
6054
6072
  let A;
6055
6073
  return {
6056
6074
  async encode(I) {
6057
- A || (A = await yB(g));
6075
+ A || (A = await eB(g));
6058
6076
  for (const C of A.array_to_array)
6059
6077
  I = await C.encode(I);
6060
6078
  let B = await A.array_to_bytes.encode(I);
@@ -6063,7 +6081,7 @@ function og(g) {
6063
6081
  return B;
6064
6082
  },
6065
6083
  async decode(I) {
6066
- A || (A = await yB(g));
6084
+ A || (A = await eB(g));
6067
6085
  for (let C = A.bytes_to_bytes.length - 1; C >= 0; C--)
6068
6086
  I = await A.bytes_to_bytes[C].decode(I);
6069
6087
  let B = await A.array_to_bytes.decode(I);
@@ -6073,10 +6091,10 @@ function og(g) {
6073
6091
  }
6074
6092
  };
6075
6093
  }
6076
- async function yB(g) {
6094
+ async function eB(g) {
6077
6095
  let A = g.codecs.map(async (Q) => {
6078
- let E = await GE.get(Q.name)?.();
6079
- return x(E, `Unknown codec: ${Q.name}`), { Codec: E, meta: Q };
6096
+ let E = await nE.get(Q.name)?.();
6097
+ return W(E, `Unknown codec: ${Q.name}`), { Codec: E, meta: Q };
6080
6098
  }), I = [], B, C = [];
6081
6099
  for await (let { Codec: Q, meta: E } of A) {
6082
6100
  let i = Q.fromConfig(E.configuration, g);
@@ -6091,9 +6109,9 @@ async function yB(g) {
6091
6109
  C.push(i);
6092
6110
  }
6093
6111
  }
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 };
6112
+ return B || (W(wE(g), `Cannot encode ${g.data_type} to bytes without a codec`), B = xI.fromConfig({ endian: "little" }, g)), { array_to_array: I, array_to_bytes: B, bytes_to_bytes: C };
6095
6113
  }
6096
- function nE(g) {
6114
+ function wE(g) {
6097
6115
  return g.data_type !== "v2:object";
6098
6116
  }
6099
6117
  class nI extends Error {
@@ -6106,28 +6124,28 @@ class dg extends Error {
6106
6124
  super(`Missing key: ${A}`), this.name = "KeyError";
6107
6125
  }
6108
6126
  }
6109
- const eB = 18446744073709551615n;
6110
- function wE(g, A, I, B) {
6111
- x(g.store.getRange, "Store does not support range requests");
6127
+ const GB = 18446744073709551615n;
6128
+ function FE(g, A, I, B) {
6129
+ W(g.store.getRange, "Store does not support range requests");
6112
6130
  let C = g.store.getRange.bind(g.store), Q = A.map((o, a) => o / B.chunk_shape[a]), E = og({
6113
6131
  data_type: "uint64",
6114
6132
  shape: [...Q, 2],
6115
6133
  codecs: B.index_codecs
6116
6134
  }), i = {};
6117
6135
  return async (o) => {
6118
- let a = o.map((c, N) => Math.floor(c / Q[N])), s = g.resolve(I(a)).path, h;
6136
+ let a = o.map((c, R) => Math.floor(c / Q[R])), s = g.resolve(I(a)).path, h;
6119
6137
  if (s in i)
6120
6138
  h = i[s];
6121
6139
  else {
6122
- let c = 4, N = 16 * Q.reduce((L, k) => L * k, 1), d = await C(s, {
6123
- suffixLength: N + c
6140
+ let c = 4, R = 16 * Q.reduce((k, L) => k * L, 1), Y = await C(s, {
6141
+ suffixLength: R + c
6124
6142
  });
6125
- h = i[s] = d ? await E.decode(d) : null;
6143
+ h = i[s] = Y ? await E.decode(Y) : null;
6126
6144
  }
6127
6145
  if (h === null)
6128
6146
  return;
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];
6130
- if (!(r === eB && G === eB))
6147
+ let { data: t, shape: y, stride: n } = h, w = o.map((c, R) => c % y[R]).reduce((c, R, Y) => c + R * n[Y], 0), r = t[w], G = t[w + 1];
6148
+ if (!(r === GB && G === GB))
6131
6149
  return C(s, {
6132
6150
  offset: Number(r),
6133
6151
  length: Number(G)
@@ -6155,21 +6173,21 @@ class Mg extends z {
6155
6173
  return this.#A.attributes;
6156
6174
  }
6157
6175
  }
6158
- function GB(g) {
6176
+ function nB(g) {
6159
6177
  return g.find((I) => I.name === "transpose")?.configuration?.order ?? "C";
6160
6178
  }
6161
6179
  const OA = Symbol("zarrita.context");
6162
- function FE(g) {
6180
+ function rE(g) {
6163
6181
  return g[OA];
6164
6182
  }
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),
6183
+ function SE(g, A) {
6184
+ let { configuration: I } = A.codecs.find(oE) ?? {}, B = {
6185
+ encode_chunk_key: BE(A.chunk_key_encoding),
6186
+ TypedArray: WB(A.data_type),
6169
6187
  fill_value: A.fill_value
6170
6188
  };
6171
6189
  if (I) {
6172
- let Q = GB(I.codecs);
6190
+ let Q = nB(I.codecs);
6173
6191
  return {
6174
6192
  ...B,
6175
6193
  kind: "sharded",
@@ -6182,10 +6200,10 @@ function rE(g, A) {
6182
6200
  get_strides(E) {
6183
6201
  return UA(E, Q);
6184
6202
  },
6185
- get_chunk_bytes: wE(g, A.chunk_grid.configuration.chunk_shape, B.encode_chunk_key, I)
6203
+ get_chunk_bytes: FE(g, A.chunk_grid.configuration.chunk_shape, B.encode_chunk_key, I)
6186
6204
  };
6187
6205
  }
6188
- let C = GB(A.codecs);
6206
+ let C = nB(A.codecs);
6189
6207
  return {
6190
6208
  ...B,
6191
6209
  kind: "regular",
@@ -6211,8 +6229,8 @@ let JI = class extends z {
6211
6229
  constructor(A, I, B) {
6212
6230
  super(A, I), this.#A = {
6213
6231
  ...B,
6214
- fill_value: xB(B)
6215
- }, this[OA] = rE(this, B);
6232
+ fill_value: bB(B)
6233
+ }, this[OA] = SE(this, B);
6216
6234
  }
6217
6235
  get attrs() {
6218
6236
  return this.#A.attributes;
@@ -6256,15 +6274,15 @@ let JI = class extends z {
6256
6274
  * ```
6257
6275
  */
6258
6276
  is(A) {
6259
- return EE(this.dtype, A);
6277
+ return iE(this.dtype, A);
6260
6278
  }
6261
6279
  };
6262
- function* SE(g, A, I = 1) {
6280
+ function* RE(g, A, I = 1) {
6263
6281
  A === void 0 && (A = g, g = 0);
6264
6282
  for (let B = g; B < A; B += I)
6265
6283
  yield B;
6266
6284
  }
6267
- function* RE(...g) {
6285
+ function* NE(...g) {
6268
6286
  if (g.length === 0)
6269
6287
  return;
6270
6288
  const A = g.map((B) => B[Symbol.iterator]()), I = A.map((B) => B.next());
@@ -6279,7 +6297,7 @@ function* RE(...g) {
6279
6297
  I[B] = A[B].next();
6280
6298
  }
6281
6299
  }
6282
- function NE({ start: g, stop: A, step: I }, B) {
6300
+ function cE({ start: g, stop: A, step: I }, B) {
6283
6301
  if (I === 0)
6284
6302
  throw new Error("slice step cannot be zero");
6285
6303
  I = I ?? 1;
@@ -6293,7 +6311,7 @@ function YI(g, A, I = null) {
6293
6311
  step: I
6294
6312
  };
6295
6313
  }
6296
- function cE() {
6314
+ function UE() {
6297
6315
  const g = [];
6298
6316
  return {
6299
6317
  add: (A) => g.push(A()),
@@ -6305,35 +6323,35 @@ class Kg extends Error {
6305
6323
  super(A), this.name = "IndexError";
6306
6324
  }
6307
6325
  }
6308
- function UE(g, A) {
6326
+ function kE(g, A) {
6309
6327
  throw new Kg(`too many indicies for array; expected ${A.length}, got ${g.length}`);
6310
6328
  }
6311
- function kE(g) {
6329
+ function LE(g) {
6312
6330
  throw new Kg(`index out of bounds for dimension with length ${g}`);
6313
6331
  }
6314
- function LE() {
6332
+ function JE() {
6315
6333
  throw new Kg("only slices with step >= 1 are supported");
6316
6334
  }
6317
- function JE(g, A) {
6318
- g.length > A.length && UE(g, A);
6319
- }
6320
6335
  function YE(g, A) {
6321
- return g = Math.trunc(g), g < 0 && (g = A + g), (g >= A || g < 0) && kE(A), g;
6336
+ g.length > A.length && kE(g, A);
6322
6337
  }
6323
- class dE {
6338
+ function dE(g, A) {
6339
+ return g = Math.trunc(g), g < 0 && (g = A + g), (g >= A || g < 0) && LE(A), g;
6340
+ }
6341
+ class ME {
6324
6342
  dim_sel;
6325
6343
  dim_len;
6326
6344
  dim_chunk_len;
6327
6345
  nitems;
6328
6346
  constructor({ dim_sel: A, dim_len: I, dim_chunk_len: B }) {
6329
- A = YE(A, I), this.dim_sel = A, this.dim_len = I, this.dim_chunk_len = B, this.nitems = 1;
6347
+ A = dE(A, I), this.dim_sel = A, this.dim_len = I, this.dim_chunk_len = B, this.nitems = 1;
6330
6348
  }
6331
6349
  *[Symbol.iterator]() {
6332
6350
  const A = Math.floor(this.dim_sel / this.dim_chunk_len), I = A * this.dim_chunk_len, B = this.dim_sel - I;
6333
6351
  yield { dim_chunk_ix: A, dim_chunk_sel: B };
6334
6352
  }
6335
6353
  }
6336
- class nB {
6354
+ class wB {
6337
6355
  start;
6338
6356
  stop;
6339
6357
  step;
@@ -6342,12 +6360,12 @@ class nB {
6342
6360
  nitems;
6343
6361
  nchunks;
6344
6362
  constructor({ dim_sel: A, dim_len: I, dim_chunk_len: B }) {
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);
6363
+ const [C, Q, E] = cE(A, I);
6364
+ this.start = C, this.stop = Q, this.step = E, this.step < 1 && JE(), this.dim_len = I, this.dim_chunk_len = B, this.nitems = Math.max(0, Math.ceil((this.stop - this.start) / this.step)), this.nchunks = Math.ceil(this.dim_len / this.dim_chunk_len);
6347
6365
  }
6348
6366
  *[Symbol.iterator]() {
6349
6367
  const A = Math.floor(this.start / this.dim_chunk_len), I = Math.ceil(this.stop / this.dim_chunk_len);
6350
- for (const B of SE(A, I)) {
6368
+ for (const B of RE(A, I)) {
6351
6369
  const C = B * this.dim_chunk_len, Q = Math.min(this.dim_len, (B + 1) * this.dim_chunk_len), E = Q - C;
6352
6370
  let i = 0, o = 0;
6353
6371
  if (this.start < C) {
@@ -6368,43 +6386,43 @@ class nB {
6368
6386
  }
6369
6387
  }
6370
6388
  }
6371
- function ME(g, A) {
6389
+ function KE(g, A) {
6372
6390
  let 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;
6391
+ return g === null ? I = A.map((B) => YI(null)) : Array.isArray(g) && (I = g.map((B) => B ?? YI(null))), YE(I, A), I;
6374
6392
  }
6375
- class KE {
6393
+ class HE {
6376
6394
  dim_indexers;
6377
6395
  shape;
6378
6396
  constructor({ selection: A, shape: I, chunk_shape: B }) {
6379
- this.dim_indexers = ME(A, I).map((C, Q) => new (typeof C == "number" ? dE : nB)({
6397
+ this.dim_indexers = KE(A, I).map((C, Q) => new (typeof C == "number" ? ME : wB)({
6380
6398
  // @ts-expect-error ts inference not strong enough to know correct chunk
6381
6399
  dim_sel: C,
6382
6400
  dim_len: I[Q],
6383
6401
  dim_chunk_len: B[Q]
6384
- })), this.shape = this.dim_indexers.filter((C) => C instanceof nB).map((C) => C.nitems);
6402
+ })), this.shape = this.dim_indexers.filter((C) => C instanceof wB).map((C) => C.nitems);
6385
6403
  }
6386
6404
  *[Symbol.iterator]() {
6387
- for (const A of RE(...this.dim_indexers)) {
6405
+ for (const A of NE(...this.dim_indexers)) {
6388
6406
  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 });
6389
6407
  yield { chunk_coords: I, mapping: B };
6390
6408
  }
6391
6409
  }
6392
6410
  }
6393
- function HE(g, A) {
6411
+ function qE(g, A) {
6394
6412
  return "get" in g ? g.get(A) : g[A];
6395
6413
  }
6396
- async function qE(g, A, I, B) {
6397
- let C = FE(g), Q = new KE({
6414
+ async function lE(g, A, I, B) {
6415
+ let C = rE(g), Q = new HE({
6398
6416
  selection: A,
6399
6417
  shape: g.shape,
6400
6418
  chunk_shape: g.chunks
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();
6419
+ }), E = B.prepare(new C.TypedArray(Q.shape.reduce((o, a) => o * a, 1)), Q.shape, C.get_strides(Q.shape)), i = I.create_queue?.() ?? UE();
6402
6420
  for (const { chunk_coords: o, mapping: a } of Q)
6403
6421
  i.add(async () => {
6404
6422
  let { data: s, shape: h, stride: t } = await g.getChunk(o, I.opts), y = B.prepare(s, h, t);
6405
6423
  B.set_from_chunk(E, y, a);
6406
6424
  });
6407
- return await i.onIdle(), Q.shape.length === 0 ? HE(E.data, 0) : E;
6425
+ return await i.onIdle(), Q.shape.length === 0 ? qE(E.data, 0) : E;
6408
6426
  }
6409
6427
  function Hg(g, A = 0, I) {
6410
6428
  let B = I ?? g.length - A;
@@ -6434,32 +6452,32 @@ function gg(g) {
6434
6452
  bytes_per_element: g.data.BYTES_PER_ELEMENT
6435
6453
  };
6436
6454
  }
6437
- function lE(g) {
6455
+ function fE(g) {
6438
6456
  return "chars" in g ? g.constructor.bind(null, g.chars) : g.constructor;
6439
6457
  }
6440
- function fE(g, A) {
6458
+ function pE(g, A) {
6441
6459
  if (globalThis.Array.isArray(g.data))
6442
6460
  return Hg([A]);
6443
- let I = lE(g.data), B = new I([A]);
6461
+ let I = fE(g.data), B = new I([A]);
6444
6462
  return new Uint8Array(B.buffer, B.byteOffset, B.byteLength);
6445
6463
  }
6446
- const pE = {
6464
+ const mE = {
6447
6465
  prepare(g, A, I) {
6448
6466
  return { data: g, shape: A, stride: I };
6449
6467
  },
6450
6468
  set_scalar(g, A, I) {
6451
6469
  let B = gg(g);
6452
- ag(B, A, fE(g, I), B.bytes_per_element);
6470
+ ag(B, A, pE(g, I), B.bytes_per_element);
6453
6471
  },
6454
6472
  set_from_chunk(g, A, I) {
6455
6473
  let B = gg(g);
6456
6474
  SI(B, gg(A), B.bytes_per_element, I);
6457
6475
  }
6458
6476
  };
6459
- async function mE(g, A = null, I = {}) {
6460
- return qE(g, A, I, pE);
6477
+ async function uE(g, A = null, I = {}) {
6478
+ return lE(g, A, I, mE);
6461
6479
  }
6462
- function ZB(g, A, I) {
6480
+ function OB(g, A, I) {
6463
6481
  return I < 0 && A < g ? Math.floor((g - A - 1) / -I) + 1 : g < A ? Math.floor((A - g - 1) / I) + 1 : 0;
6464
6482
  }
6465
6483
  function ag(g, A, I, B) {
@@ -6473,7 +6491,7 @@ function ag(g, A, I, B) {
6473
6491
  ag({ data: t, stride: i }, Q, I, B);
6474
6492
  return;
6475
6493
  }
6476
- const [o, a, s] = C, h = ZB(o, a, s);
6494
+ const [o, a, s] = C, h = OB(o, a, s);
6477
6495
  if (Q.length === 0) {
6478
6496
  for (let t = 0; t < h; t++)
6479
6497
  g.data.set(I, E * (o + s * t) * B);
@@ -6509,7 +6527,7 @@ function SI(g, A, I, B) {
6509
6527
  }, I, Q);
6510
6528
  return;
6511
6529
  }
6512
- const [s, h, t] = C.to, [y, n, w] = C.from, r = ZB(s, h, t);
6530
+ const [s, h, t] = C.to, [y, n, w] = C.from, r = OB(s, h, t);
6513
6531
  if (Q.length === 0) {
6514
6532
  if (t === 1 && w === 1 && E === 1 && o === 1) {
6515
6533
  let G = y * I, c = r * I;
@@ -6531,8 +6549,8 @@ function SI(g, A, I, B) {
6531
6549
  stride: a
6532
6550
  }, I, Q);
6533
6551
  }
6534
- let WI = uE();
6535
- function uE() {
6552
+ let WI = TE();
6553
+ function TE() {
6536
6554
  let g = /* @__PURE__ */ new WeakMap();
6537
6555
  function A(I) {
6538
6556
  let B = g.get(I) ?? { v2: 0, v3: 0 };
@@ -6548,41 +6566,41 @@ function uE() {
6548
6566
  }
6549
6567
  };
6550
6568
  }
6551
- async function TE(g) {
6569
+ async function xE(g) {
6552
6570
  let A = await g.store.get(g.resolve(".zattrs").path);
6553
6571
  return A ? GI(A) : {};
6554
6572
  }
6555
- async function xE(g, A = {}) {
6573
+ async function WE(g, A = {}) {
6556
6574
  let I = "store" in g ? g : new z(g), 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)));
6575
+ return (A.attrs ?? !0) && (B = await xE(I)), A.kind === "array" ? FB(I, B) : A.kind === "group" ? rB(I, B) : FB(I, B).catch((C) => (ZB(C, nI), rB(I, B)));
6558
6576
  }
6559
- async function wB(g, A) {
6577
+ async function FB(g, A) {
6560
6578
  let { path: I } = g.resolve(".zarray"), B = await g.store.get(I);
6561
6579
  if (!B)
6562
6580
  throw new nI("v2 array", {
6563
6581
  cause: new dg(I)
6564
6582
  });
6565
- return WI.increment(g.store, "v2"), new JI(g.store, g.path, CE(GI(B), A));
6583
+ return WI.increment(g.store, "v2"), new JI(g.store, g.path, QE(GI(B), A));
6566
6584
  }
6567
- async function FB(g, A) {
6585
+ async function rB(g, A) {
6568
6586
  let { path: I } = g.resolve(".zgroup"), B = await g.store.get(I);
6569
6587
  if (!B)
6570
6588
  throw new nI("v2 group", {
6571
6589
  cause: new dg(I)
6572
6590
  });
6573
- return WI.increment(g.store, "v2"), new Mg(g.store, g.path, QE(GI(B), A));
6591
+ return WI.increment(g.store, "v2"), new Mg(g.store, g.path, EE(GI(B), A));
6574
6592
  }
6575
- async function WE(g) {
6593
+ async function bE(g) {
6576
6594
  let { store: A, path: I } = g.resolve("zarr.json"), B = await g.store.get(I);
6577
6595
  if (!B)
6578
6596
  throw new nI("v3 array or group", {
6579
6597
  cause: new dg(I)
6580
6598
  });
6581
6599
  let C = GI(B);
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);
6600
+ return C.node_type === "array" && (C.fill_value = bB(C)), C.node_type === "array" ? new JI(A, g.path, C) : new Mg(A, g.path, C);
6583
6601
  }
6584
- async function bE(g, A = {}) {
6585
- let I = "store" in g ? g : new z(g), B = await WE(I);
6602
+ async function ZE(g, A = {}) {
6603
+ let I = "store" in g ? g : new z(g), B = await bE(I);
6586
6604
  if (WI.increment(I.store, "v3"), A.kind === void 0 || A.kind === "array" && B instanceof JI || A.kind === "group" && B instanceof Mg)
6587
6605
  return B;
6588
6606
  let C = B instanceof JI ? "array" : "group";
@@ -6590,11 +6608,11 @@ async function bE(g, A = {}) {
6590
6608
  }
6591
6609
  async function IA(g, A = {}) {
6592
6610
  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)));
6611
+ return C(g, A).catch((E) => (ZB(E, nI), Q(g, A)));
6594
6612
  }
6595
- IA.v2 = xE;
6596
- IA.v3 = bE;
6597
- async function ZE(g, A) {
6613
+ IA.v2 = WE;
6614
+ IA.v3 = ZE;
6615
+ async function PE(g, A) {
6598
6616
  const I = A.split("/"), B = I.pop();
6599
6617
  if (!B)
6600
6618
  throw new Error("Invalid path");
@@ -6611,7 +6629,7 @@ class qg {
6611
6629
  return this.#A;
6612
6630
  }
6613
6631
  async get(A) {
6614
- const I = await ZE(this.#A, A.slice(1)).catch(
6632
+ const I = await PE(this.#A, A.slice(1)).catch(
6615
6633
  () => {
6616
6634
  }
6617
6635
  );
@@ -6621,7 +6639,7 @@ class qg {
6621
6639
  return new Uint8Array(C);
6622
6640
  }
6623
6641
  }
6624
- function PE() {
6642
+ function OE() {
6625
6643
  if (typeof window > "u")
6626
6644
  return;
6627
6645
  const g = window.location.hostname;
@@ -6638,7 +6656,7 @@ class lg extends PA {
6638
6656
  overrides;
6639
6657
  useSuffixRequest;
6640
6658
  constructor(A) {
6641
- PE(), super(A.url, {
6659
+ OE(), super(A.url, {
6642
6660
  overrides: A.overrides,
6643
6661
  useSuffixRequest: A.useSuffixRequest
6644
6662
  }), this.credentials = A.credentials, this.region = A.region, this.overrides = A.overrides, this.useSuffixRequest = A.useSuffixRequest;
@@ -6700,20 +6718,20 @@ ${t}
6700
6718
  ${y}
6701
6719
  ${n}
6702
6720
  ${w}
6703
- ${r}`, c = "AWS4-HMAC-SHA256", N = `${a}/${E}/${i}/aws4_request`, d = await this.sha256(G), L = `${c}
6721
+ ${r}`, c = "AWS4-HMAC-SHA256", R = `${a}/${E}/${i}/aws4_request`, Y = await this.sha256(G), k = `${c}
6704
6722
  ${o}
6705
- ${N}
6706
- ${d}`, k = await this.getSignatureKey(
6723
+ ${R}
6724
+ ${Y}`, L = await this.getSignatureKey(
6707
6725
  C,
6708
6726
  a,
6709
6727
  E,
6710
6728
  i
6711
- ), T = await this.hmacSha256(k, L), O = {
6712
- Authorization: `${c} Credential=${B}/${N}, SignedHeaders=${w}, Signature=${T}`,
6729
+ ), m = await this.hmacSha256(L, k), b = {
6730
+ Authorization: `${c} Credential=${B}/${R}, SignedHeaders=${w}, Signature=${m}`,
6713
6731
  "X-Amz-Date": o,
6714
6732
  "X-Amz-Content-Sha256": r
6715
6733
  };
6716
- return Q && (O["X-Amz-Security-Token"] = Q), O;
6734
+ return Q && (b["X-Amz-Security-Token"] = Q), b;
6717
6735
  }
6718
6736
  getAmzDate() {
6719
6737
  return (/* @__PURE__ */ new Date()).toISOString().replace(/[:-]|\.\d{3}/g, "");
@@ -6776,7 +6794,7 @@ async function wI(g, A) {
6776
6794
  throw new Error(`Failed to open Zarr group at ${g}`);
6777
6795
  }
6778
6796
  }
6779
- async function OE(g, A) {
6797
+ async function VE(g, A) {
6780
6798
  if (A === "v2")
6781
6799
  try {
6782
6800
  return IA.v2(g, { kind: "array", attrs: !1 });
@@ -6795,7 +6813,7 @@ async function OE(g, A) {
6795
6813
  throw new Error(`Failed to open Zarr array at ${g}`);
6796
6814
  }
6797
6815
  }
6798
- async function VE(g) {
6816
+ async function vE(g) {
6799
6817
  let A;
6800
6818
  switch (g.type) {
6801
6819
  case "fetch": {
@@ -6821,9 +6839,9 @@ async function VE(g) {
6821
6839
  }
6822
6840
  }
6823
6841
  const I = g.arrayPath ? A.resolve(g.arrayPath) : A;
6824
- return OE(I, g.zarrVersion);
6842
+ return VE(I, g.zarrVersion);
6825
6843
  }
6826
- function vE(g, A, I) {
6844
+ function XE(g, A, I) {
6827
6845
  if (g.store instanceof lg)
6828
6846
  return {
6829
6847
  type: "s3",
@@ -6854,7 +6872,7 @@ function vE(g, A, I) {
6854
6872
  `Unsupported store type: ${g.store.constructor.name}`
6855
6873
  );
6856
6874
  }
6857
- const PB = `function Bg(i, A, g, E = {}) {
6875
+ const VB = `function Bg(i, A, g, E = {}) {
6858
6876
  return A !== void 0 && g !== void 0 && (E = {
6859
6877
  ...E,
6860
6878
  headers: {
@@ -9997,11 +10015,11 @@ return ret;
9997
10015
  default: FB
9998
10016
  });
9999
10017
  //# sourceMappingURL=worker_kernel-uaRPnPAm.js.map
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) {
10018
+ `, SB = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", VB], { type: "text/javascript;charset=utf-8" });
10019
+ function jE(g) {
10002
10020
  let A;
10003
10021
  try {
10004
- if (A = rB && (self.URL || self.webkitURL).createObjectURL(rB), !A) throw "";
10022
+ if (A = SB && (self.URL || self.webkitURL).createObjectURL(SB), !A) throw "";
10005
10023
  const I = new Worker(A, {
10006
10024
  type: "module",
10007
10025
  name: g?.name
@@ -10011,7 +10029,7 @@ function XE(g) {
10011
10029
  }), I;
10012
10030
  } catch {
10013
10031
  return new Worker(
10014
- "data:text/javascript;charset=utf-8," + encodeURIComponent(PB),
10032
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(VB),
10015
10033
  {
10016
10034
  type: "module",
10017
10035
  name: g?.name
@@ -10019,17 +10037,17 @@ function XE(g) {
10019
10037
  );
10020
10038
  }
10021
10039
  }
10022
- const jE = Math.min(navigator.hardwareConcurrency, 8);
10023
- let CA = [], zE = 0, OB = 0;
10040
+ const zE = Math.min(navigator.hardwareConcurrency, 8);
10041
+ let CA = [], _E = 0, vB = 0;
10024
10042
  const kA = /* @__PURE__ */ new Map(), dI = /* @__PURE__ */ new Set();
10025
- function VB(g) {
10043
+ function XB(g) {
10026
10044
  const A = CA.find((I) => I.worker === g);
10027
10045
  return A || U.error(
10028
10046
  "ZarrWorker",
10029
10047
  "Worker not found in pool - this should not happen"
10030
10048
  ), A;
10031
10049
  }
10032
- function _E(g, A) {
10050
+ function $E(g, A) {
10033
10051
  const { id: I, success: B } = g.data, C = kA.get(I);
10034
10052
  if (!C) {
10035
10053
  dI.has(I) ? dI.delete(I) : U.warn(
@@ -10040,13 +10058,13 @@ function _E(g, A) {
10040
10058
  return;
10041
10059
  }
10042
10060
  kA.delete(I), C.abortListener && C.abortSignal && C.abortSignal.removeEventListener("abort", C.abortListener);
10043
- const Q = VB(A);
10061
+ const Q = XB(A);
10044
10062
  Q && Q.pendingCount > 0 ? Q.pendingCount-- : Q && U.error(
10045
10063
  "ZarrWorker",
10046
10064
  "Received message but no pending tasks - this should not happen"
10047
10065
  ), B && g.data.type === "getChunk" ? C.resolve(g.data.chunk) : B || C.reject(new Error(g.data.error || "Unknown worker error"));
10048
10066
  }
10049
- function SB(g, A) {
10067
+ function RB(g, A) {
10050
10068
  if (g instanceof MessageEvent) {
10051
10069
  U.error(
10052
10070
  "ZarrWorker",
@@ -10059,7 +10077,7 @@ function SB(g, A) {
10059
10077
  "Worker failed - replacing worker and canceling its in-flight messages",
10060
10078
  g.message
10061
10079
  );
10062
- const I = VB(A);
10080
+ const I = XB(A);
10063
10081
  if (I) {
10064
10082
  const C = CA.indexOf(I);
10065
10083
  CA.splice(C, 1);
@@ -10069,31 +10087,31 @@ function SB(g, A) {
10069
10087
  for (const [C, Q] of kA.entries())
10070
10088
  Q.workerId === B && (Q.reject(new Error(`Worker error: ${g.message}`)), kA.delete(C));
10071
10089
  try {
10072
- const C = vB();
10090
+ const C = jB();
10073
10091
  CA.push({
10074
10092
  worker: C,
10075
10093
  pendingCount: 0,
10076
- workerId: OB++
10094
+ workerId: vB++
10077
10095
  }), U.debug("ZarrWorker", "Replacement worker created successfully");
10078
10096
  } catch (C) {
10079
10097
  U.error("ZarrWorker", "Failed to create replacement worker", C);
10080
10098
  }
10081
10099
  }
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(
10100
+ function jB() {
10101
+ const g = new jE();
10102
+ return g.addEventListener("message", (A) => $E(A, g)), g.addEventListener("error", (A) => RB(A, g)), g.addEventListener(
10085
10103
  "messageerror",
10086
- (A) => SB(A, g)
10104
+ (A) => RB(A, g)
10087
10105
  ), g;
10088
10106
  }
10089
- function $E() {
10107
+ function Ai() {
10090
10108
  if (CA.length === 0)
10091
10109
  throw new Error("Worker pool is not initialized");
10092
10110
  return CA.sort((g, A) => g.pendingCount - A.pendingCount)[0];
10093
10111
  }
10094
- async function Ai(g, A, I) {
10112
+ async function Ii(g, A, I) {
10095
10113
  return new Promise((B, C) => {
10096
- const Q = $E(), E = zE++, i = {
10114
+ const Q = Ai(), E = _E++, i = {
10097
10115
  resolve: B,
10098
10116
  reject: C,
10099
10117
  workerId: Q.workerId
@@ -10119,15 +10137,15 @@ async function Ai(g, A, I) {
10119
10137
  });
10120
10138
  });
10121
10139
  }
10122
- function Ii() {
10140
+ function gi() {
10123
10141
  if (!(CA.length > 0))
10124
10142
  try {
10125
- for (let g = 0; g < jE; g++) {
10126
- const A = vB();
10143
+ for (let g = 0; g < zE; g++) {
10144
+ const A = jB();
10127
10145
  CA.push({
10128
10146
  worker: A,
10129
10147
  pendingCount: 0,
10130
- workerId: OB++
10148
+ workerId: vB++
10131
10149
  });
10132
10150
  }
10133
10151
  U.debug(
@@ -10135,26 +10153,26 @@ function Ii() {
10135
10153
  `Initialized worker pool with ${CA.length} workers`
10136
10154
  );
10137
10155
  } catch {
10138
- U.warn("ZarrWorker", "Failed to create workers - clearing pool"), Bi();
10156
+ U.warn("ZarrWorker", "Failed to create workers - clearing pool"), Ci();
10139
10157
  return;
10140
10158
  }
10141
10159
  }
10142
- async function gi(g, A, I, B) {
10143
- Ii();
10160
+ async function Bi(g, A, I, B) {
10161
+ gi();
10144
10162
  try {
10145
- return await Ai(A, I, B);
10163
+ return await Ii(A, I, B);
10146
10164
  } catch (C) {
10147
10165
  if (C instanceof DOMException && C.name === "AbortError")
10148
10166
  throw C;
10149
10167
  return U.warn("ZarrWorker", "Falling back to main thread", C), await g.getChunk(I, B);
10150
10168
  }
10151
10169
  }
10152
- function Bi() {
10170
+ function Ci() {
10153
10171
  for (const g of CA)
10154
10172
  g.worker.terminate();
10155
10173
  CA = [], kA.clear();
10156
10174
  }
10157
- class Ci {
10175
+ class Qi {
10158
10176
  promises_ = [];
10159
10177
  scheduler_;
10160
10178
  constructor(A) {
@@ -10167,61 +10185,76 @@ class Ci {
10167
10185
  return Promise.all(this.promises_.map((A) => this.scheduler_.submit(A)));
10168
10186
  }
10169
10187
  }
10170
- class Qi {
10188
+ class Ei {
10171
10189
  metadata_;
10172
10190
  arrays_;
10173
10191
  arrayParams_;
10174
10192
  dimensions_;
10175
10193
  constructor(A) {
10176
- this.metadata_ = A.metadata, this.arrays_ = A.arrays, this.arrayParams_ = A.arrayParams, this.dimensions_ = Ei(this.metadata_, this.arrays_);
10194
+ this.metadata_ = A.metadata, this.arrays_ = A.arrays, this.arrayParams_ = A.arrayParams, this.dimensions_ = ii(this.metadata_, this.arrays_);
10177
10195
  }
10178
10196
  getSourceDimensionMap() {
10179
10197
  return this.dimensions_;
10180
10198
  }
10181
10199
  async loadChunkData(A, I) {
10182
10200
  const B = [];
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);
10184
- const C = this.arrays_[A.lod], Q = this.arrayParams_[A.lod], E = await gi(C, Q, B, {
10201
+ if (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) {
10202
+ const o = this.dimensions_.c.lods[A.lod];
10203
+ B[this.dimensions_.c.index] = Math.floor(
10204
+ A.chunkIndex.c / o.chunkSize
10205
+ );
10206
+ }
10207
+ if (this.dimensions_.t) {
10208
+ const o = this.dimensions_.t.lods[A.lod];
10209
+ B[this.dimensions_.t.index] = Math.floor(
10210
+ A.chunkIndex.t / o.chunkSize
10211
+ );
10212
+ }
10213
+ const C = this.arrays_[A.lod], Q = this.arrayParams_[A.lod], E = await Bi(C, Q, B, {
10185
10214
  signal: I
10186
10215
  });
10187
- if (!zg(E.data))
10216
+ A.data = this.sliceReceivedChunk(A, E);
10217
+ const i = A.data.BYTES_PER_ELEMENT;
10218
+ if (!QB(i))
10188
10219
  throw new Error(
10189
- `Received chunk has an unsupported data type, data=${E.data.constructor.name}`
10220
+ "Invalid row alignment value. Possible values are 1, 2, 4, or 8"
10190
10221
  );
10191
- NB(E);
10192
- const i = {
10193
- x: E.shape[this.dimensions_.x.index],
10194
- y: E.shape[this.dimensions_.y.index],
10195
- z: this.dimensions_.z ? E.shape[this.dimensions_.z.index] : A.shape.z
10196
- };
10197
- if (i.x < A.shape.x || i.y < A.shape.y || i.z < A.shape.z)
10222
+ A.rowAlignmentBytes = i;
10223
+ }
10224
+ // trim any padding (XYZ padding for edge chunks)
10225
+ // and extract the channel/timepoint
10226
+ sliceReceivedChunk(A, I) {
10227
+ const B = I.data;
10228
+ if (!zg(B))
10198
10229
  throw new Error(
10199
- `Received incompatible shape for chunkIndex ${JSON.stringify(A.chunkIndex)} at LOD ${A.lod}: expected shape: ${JSON.stringify(A.shape)}, received shape: ${JSON.stringify(i)} (too small)`
10230
+ `Received chunk has an unsupported data type, data=${I.data.constructor.name}`
10200
10231
  );
10201
- i.x > A.shape.x || i.y > A.shape.y || i.z > A.shape.z ? A.data = this.trimChunkPadding(
10202
- A,
10203
- E.data,
10204
- E.stride
10205
- ) : A.data = E.data;
10206
- const s = A.data.BYTES_PER_ELEMENT;
10207
- if (!CB(s))
10232
+ cB(I);
10233
+ const C = {
10234
+ x: I.shape[this.dimensions_.x.index],
10235
+ y: I.shape[this.dimensions_.y.index],
10236
+ z: this.dimensions_.z ? I.shape[this.dimensions_.z.index] : A.shape.z
10237
+ };
10238
+ if (C.x < A.shape.x || C.y < A.shape.y || C.z < A.shape.z)
10208
10239
  throw new Error(
10209
- "Invalid row alignment value. Possible values are 1, 2, 4, or 8"
10240
+ `Received incompatible shape for chunkIndex ${JSON.stringify(A.chunkIndex)} at LOD ${A.lod}: expected shape: ${JSON.stringify(A.shape)}, received shape: ${JSON.stringify(C)} (too small)`
10210
10241
  );
10211
- A.rowAlignmentBytes = s;
10212
- }
10213
- trimChunkPadding(A, I, B) {
10214
- const C = A.shape.x * A.shape.y * A.shape.z, Q = new I.constructor(C);
10215
- let E = 0;
10216
- const i = this.dimensions_.z ? B[this.dimensions_.z.index] : 0, o = B[this.dimensions_.y.index];
10217
- for (let a = 0; a < A.shape.z; a++) {
10218
- const s = a * i;
10219
- for (let h = 0; h < A.shape.y; h++) {
10220
- const t = s + h * o, y = t + A.shape.x;
10221
- Q.set(I.subarray(t, y), E), E += A.shape.x;
10242
+ const E = I.stride, i = this.dimensions_.c?.lods[A.lod], o = this.dimensions_.t?.lods[A.lod], a = i ? A.chunkIndex.c % i.chunkSize : 0, s = o ? A.chunkIndex.t % o.chunkSize : 0, h = A.shape.x * A.shape.y * A.shape.z, t = this.dimensions_.c ? E[this.dimensions_.c.index] : 0, y = this.dimensions_.t ? E[this.dimensions_.t.index] : 0, n = s * y + a * t, w = C.x === A.shape.x && C.y === A.shape.y && C.z === A.shape.z;
10243
+ if (n === 0 && B.length === h && w)
10244
+ return B;
10245
+ const G = new B.constructor(h), c = this.dimensions_.z ? E[this.dimensions_.z.index] : 0, R = E[this.dimensions_.y.index];
10246
+ let Y = 0;
10247
+ for (let k = 0; k < A.shape.z; k++) {
10248
+ const L = n + k * c;
10249
+ for (let m = 0; m < A.shape.y; m++) {
10250
+ const x = L + m * R, b = x + A.shape.x;
10251
+ G.set(
10252
+ B.subarray(x, b),
10253
+ Y
10254
+ ), Y += A.shape.x;
10222
10255
  }
10223
10256
  }
10224
- return Q;
10257
+ return G;
10225
10258
  }
10226
10259
  async loadRegion(A, I, B) {
10227
10260
  if (I >= this.arrays_.length)
@@ -10231,20 +10264,20 @@ class Qi {
10231
10264
  const C = this.regionToIndices(A, I), Q = this.arrays_[I];
10232
10265
  let E = {};
10233
10266
  B !== void 0 && (E = {
10234
- create_queue: () => new Ci(B),
10267
+ create_queue: () => new Qi(B),
10235
10268
  opts: { signal: B.abortSignal }
10236
10269
  });
10237
- const i = await mE(Q, C, E);
10270
+ const i = await uE(Q, C, E);
10238
10271
  if (!zg(i.data))
10239
10272
  throw new Error(
10240
10273
  `Subarray has an unsupported data type, data=${i.data.constructor.name}`
10241
10274
  );
10242
- if (NB(i), i.shape.length !== 2 && i.shape.length !== 3)
10275
+ if (cB(i), i.shape.length !== 2 && i.shape.length !== 3)
10243
10276
  throw new Error(
10244
10277
  `Expected to receive a 2D or 3D subarray. Instead chunk has shape ${i.shape}`
10245
10278
  );
10246
10279
  const o = i.data.BYTES_PER_ELEMENT;
10247
- if (!CB(o))
10280
+ if (!QB(o))
10248
10281
  throw new Error(
10249
10282
  "Invalid row alignment value. Possible values are 1, 2, 4, or 8"
10250
10283
  );
@@ -10282,7 +10315,7 @@ class Qi {
10282
10315
  this.dimensions_.t
10283
10316
  ].filter((Q) => Q !== void 0).sort((Q, E) => Q.index - E.index), C = [];
10284
10317
  for (const Q of B) {
10285
- const E = A.find((s) => XB(s.dimension, Q.name));
10318
+ const E = A.find((s) => zB(s.dimension, Q.name));
10286
10319
  if (!E)
10287
10320
  throw new Error(`Region does not contain a slice for ${Q.name}`);
10288
10321
  const i = Q.lods[I];
@@ -10296,8 +10329,8 @@ class Qi {
10296
10329
  return C;
10297
10330
  }
10298
10331
  }
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) => {
10332
+ function ii(g, A) {
10333
+ const I = g.axes.map((h) => h.name), B = g.axes.length, C = NB(I, "x"), Q = NB(I, "y"), E = (h, t) => {
10301
10334
  const y = [];
10302
10335
  for (let n = 0; n < g.datasets.length; n++) {
10303
10336
  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);
@@ -10325,10 +10358,10 @@ function Ei(g, A) {
10325
10358
  const s = RI(I, "t");
10326
10359
  return s !== -1 && (i.t = E(I[s], s)), i;
10327
10360
  }
10328
- function XB(g, A) {
10361
+ function zB(g, A) {
10329
10362
  return g.toLowerCase() === A.toLowerCase();
10330
10363
  }
10331
- function RB(g, A) {
10364
+ function NB(g, A) {
10332
10365
  const I = RI(g, A);
10333
10366
  if (I === -1)
10334
10367
  throw new Error(
@@ -10337,9 +10370,9 @@ function RB(g, A) {
10337
10370
  return I;
10338
10371
  }
10339
10372
  function RI(g, A) {
10340
- return g.findIndex((I) => XB(I, A));
10373
+ return g.findIndex((I) => zB(I, A));
10341
10374
  }
10342
- function NB(g) {
10375
+ function cB(g) {
10343
10376
  let A = 1;
10344
10377
  for (let I = g.shape.length - 1; I >= 0; I--) {
10345
10378
  if (g.stride[I] !== A)
@@ -10452,7 +10485,7 @@ const S = H.arrayToEnum([
10452
10485
  "invalid_intersection_types",
10453
10486
  "not_multiple_of",
10454
10487
  "not_finite"
10455
- ]), ii = (g) => JSON.stringify(g, null, 2).replace(/"([^"]+)":/g, "$1:");
10488
+ ]), oi = (g) => JSON.stringify(g, null, 2).replace(/"([^"]+)":/g, "$1:");
10456
10489
  class $ extends Error {
10457
10490
  get errors() {
10458
10491
  return this.issues;
@@ -10569,12 +10602,12 @@ const uA = (g, A) => {
10569
10602
  }
10570
10603
  return { message: I };
10571
10604
  };
10572
- let jB = uA;
10573
- function oi(g) {
10574
- jB = g;
10605
+ let _B = uA;
10606
+ function ai(g) {
10607
+ _B = g;
10575
10608
  }
10576
10609
  function MI() {
10577
- return jB;
10610
+ return _B;
10578
10611
  }
10579
10612
  const KI = (g) => {
10580
10613
  const { data: A, path: I, errorMaps: B, issueData: C } = g, Q = [...I, ...C.path || []], E = {
@@ -10596,7 +10629,7 @@ const KI = (g) => {
10596
10629
  path: Q,
10597
10630
  message: i
10598
10631
  };
10599
- }, ai = [];
10632
+ }, si = [];
10600
10633
  function F(g, A) {
10601
10634
  const I = MI(), B = KI({
10602
10635
  issueData: A,
@@ -10629,7 +10662,7 @@ class X {
10629
10662
  const B = [];
10630
10663
  for (const C of I) {
10631
10664
  if (C.status === "aborted")
10632
- return Y;
10665
+ return d;
10633
10666
  C.status === "dirty" && A.dirty(), B.push(C.value);
10634
10667
  }
10635
10668
  return { status: A.value, value: B };
@@ -10650,27 +10683,27 @@ class X {
10650
10683
  for (const C of I) {
10651
10684
  const { key: Q, value: E } = C;
10652
10685
  if (Q.status === "aborted" || E.status === "aborted")
10653
- return Y;
10686
+ return d;
10654
10687
  Q.status === "dirty" && A.dirty(), E.status === "dirty" && A.dirty(), Q.value !== "__proto__" && (typeof E.value < "u" || C.alwaysSet) && (B[Q.value] = E.value);
10655
10688
  }
10656
10689
  return { status: A.value, value: B };
10657
10690
  }
10658
10691
  }
10659
- const Y = Object.freeze({
10692
+ const d = Object.freeze({
10660
10693
  status: "aborted"
10661
10694
  }), 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;
10662
10695
  function HI(g, A, I, B) {
10663
10696
  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");
10664
10697
  return A.get(g);
10665
10698
  }
10666
- function zB(g, A, I, B, C) {
10699
+ function $B(g, A, I, B, C) {
10667
10700
  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");
10668
10701
  return A.set(g, I), I;
10669
10702
  }
10670
- var R;
10703
+ var N;
10671
10704
  (function(g) {
10672
10705
  g.errToObj = (A) => typeof A == "string" ? { message: A } : A || {}, g.toString = (A) => typeof A == "string" ? A : A?.message;
10673
- })(R || (R = {}));
10706
+ })(N || (N = {}));
10674
10707
  var VA, vA;
10675
10708
  class sA {
10676
10709
  constructor(A, I, B, C) {
@@ -10680,7 +10713,7 @@ class sA {
10680
10713
  return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
10681
10714
  }
10682
10715
  }
10683
- const cB = (g, A) => {
10716
+ const UB = (g, A) => {
10684
10717
  if (LA(A))
10685
10718
  return { success: !0, data: A.value };
10686
10719
  if (!g.common.issues.length)
@@ -10767,7 +10800,7 @@ class K {
10767
10800
  data: A,
10768
10801
  parsedType: tA(A)
10769
10802
  }, Q = this._parseSync({ data: A, path: C.path, parent: C });
10770
- return cB(C, Q);
10803
+ return UB(C, Q);
10771
10804
  }
10772
10805
  "~validate"(A) {
10773
10806
  var I, B;
@@ -10821,7 +10854,7 @@ class K {
10821
10854
  data: A,
10822
10855
  parsedType: tA(A)
10823
10856
  }, C = this._parse({ data: A, path: B.path, parent: B }), Q = await (II(C) ? C : Promise.resolve(C));
10824
- return cB(B, Q);
10857
+ return UB(B, Q);
10825
10858
  }
10826
10859
  refine(A, I) {
10827
10860
  const B = (C) => typeof I == "string" || typeof I > "u" ? { message: I } : typeof I == "function" ? I(C) : I;
@@ -10927,26 +10960,26 @@ class K {
10927
10960
  return this.safeParse(null).success;
10928
10961
  }
10929
10962
  }
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})+$";
10963
+ const Di = /^c[^\s-]{8,}$/i, hi = /^[0-9a-z]+$/, ti = /^[0-9A-HJKMNP-TV-Z]{26}$/i, yi = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, ei = /^[a-z0-9_-]{21}$/i, Gi = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, ni = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, wi = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Fi = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
10931
10964
  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) {
10965
+ const ri = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Si = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Ri = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Ni = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, ci = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Ui = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, AC = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", ki = new RegExp(`^${AC}$`);
10966
+ function IC(g) {
10934
10967
  let A = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
10935
10968
  return g.precision ? A = `${A}\\.\\d{${g.precision}}` : g.precision == null && (A = `${A}(\\.\\d+)?`), A;
10936
10969
  }
10937
- function ki(g) {
10938
- return new RegExp(`^${$B(g)}$`);
10970
+ function Li(g) {
10971
+ return new RegExp(`^${IC(g)}$`);
10939
10972
  }
10940
- function AC(g) {
10941
- let A = `${_B}T${$B(g)}`;
10973
+ function gC(g) {
10974
+ let A = `${AC}T${IC(g)}`;
10942
10975
  const I = [];
10943
10976
  return I.push(g.local ? "Z?" : "Z"), g.offset && I.push("([+-]\\d{2}:?\\d{2})"), A = `${A}(${I.join("|")})`, new RegExp(`^${A}$`);
10944
10977
  }
10945
- function Li(g, A) {
10946
- return !!((A === "v4" || !A) && Fi.test(g) || (A === "v6" || !A) && Si.test(g));
10947
- }
10948
10978
  function Ji(g, A) {
10949
- if (!ei.test(g))
10979
+ return !!((A === "v4" || !A) && ri.test(g) || (A === "v6" || !A) && Ri.test(g));
10980
+ }
10981
+ function Yi(g, A) {
10982
+ if (!Gi.test(g))
10950
10983
  return !1;
10951
10984
  try {
10952
10985
  const [I] = g.split("."), B = I.replace(/-/g, "+").replace(/_/g, "/").padEnd(I.length + (4 - I.length % 4) % 4, "="), C = JSON.parse(atob(B));
@@ -10955,8 +10988,8 @@ function Ji(g, A) {
10955
10988
  return !1;
10956
10989
  }
10957
10990
  }
10958
- function Yi(g, A) {
10959
- return !!((A === "v4" || !A) && ri.test(g) || (A === "v6" || !A) && Ri.test(g));
10991
+ function di(g, A) {
10992
+ return !!((A === "v4" || !A) && Si.test(g) || (A === "v6" || !A) && Ni.test(g));
10960
10993
  }
10961
10994
  class gA extends K {
10962
10995
  _parse(A) {
@@ -10966,7 +10999,7 @@ class gA extends K {
10966
10999
  code: e.invalid_type,
10967
11000
  expected: S.string,
10968
11001
  received: Q.parsedType
10969
- }), Y;
11002
+ }), d;
10970
11003
  }
10971
11004
  const B = new X();
10972
11005
  let C;
@@ -11007,43 +11040,43 @@ class gA extends K {
11007
11040
  message: Q.message
11008
11041
  }), B.dirty());
11009
11042
  } else if (Q.kind === "email")
11010
- ni.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11043
+ wi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11011
11044
  validation: "email",
11012
11045
  code: e.invalid_string,
11013
11046
  message: Q.message
11014
11047
  }), B.dirty());
11015
11048
  else if (Q.kind === "emoji")
11016
- Bg || (Bg = new RegExp(wi, "u")), Bg.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11049
+ Bg || (Bg = new RegExp(Fi, "u")), Bg.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11017
11050
  validation: "emoji",
11018
11051
  code: e.invalid_string,
11019
11052
  message: Q.message
11020
11053
  }), B.dirty());
11021
11054
  else if (Q.kind === "uuid")
11022
- ti.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11055
+ yi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11023
11056
  validation: "uuid",
11024
11057
  code: e.invalid_string,
11025
11058
  message: Q.message
11026
11059
  }), B.dirty());
11027
11060
  else if (Q.kind === "nanoid")
11028
- yi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11061
+ ei.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11029
11062
  validation: "nanoid",
11030
11063
  code: e.invalid_string,
11031
11064
  message: Q.message
11032
11065
  }), B.dirty());
11033
11066
  else if (Q.kind === "cuid")
11034
- si.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11067
+ Di.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11035
11068
  validation: "cuid",
11036
11069
  code: e.invalid_string,
11037
11070
  message: Q.message
11038
11071
  }), B.dirty());
11039
11072
  else if (Q.kind === "cuid2")
11040
- Di.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11073
+ hi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11041
11074
  validation: "cuid2",
11042
11075
  code: e.invalid_string,
11043
11076
  message: Q.message
11044
11077
  }), B.dirty());
11045
11078
  else if (Q.kind === "ulid")
11046
- hi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11079
+ ti.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11047
11080
  validation: "ulid",
11048
11081
  code: e.invalid_string,
11049
11082
  message: Q.message
@@ -11074,39 +11107,39 @@ class gA extends K {
11074
11107
  code: e.invalid_string,
11075
11108
  validation: { endsWith: Q.value },
11076
11109
  message: Q.message
11077
- }), B.dirty()) : Q.kind === "datetime" ? AC(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11110
+ }), B.dirty()) : Q.kind === "datetime" ? gC(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11078
11111
  code: e.invalid_string,
11079
11112
  validation: "datetime",
11080
11113
  message: Q.message
11081
- }), B.dirty()) : Q.kind === "date" ? Ui.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11114
+ }), B.dirty()) : Q.kind === "date" ? ki.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11082
11115
  code: e.invalid_string,
11083
11116
  validation: "date",
11084
11117
  message: Q.message
11085
- }), B.dirty()) : Q.kind === "time" ? ki(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11118
+ }), B.dirty()) : Q.kind === "time" ? Li(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11086
11119
  code: e.invalid_string,
11087
11120
  validation: "time",
11088
11121
  message: Q.message
11089
- }), B.dirty()) : Q.kind === "duration" ? Gi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11122
+ }), B.dirty()) : Q.kind === "duration" ? ni.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11090
11123
  validation: "duration",
11091
11124
  code: e.invalid_string,
11092
11125
  message: Q.message
11093
- }), B.dirty()) : Q.kind === "ip" ? Li(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), F(C, {
11126
+ }), B.dirty()) : Q.kind === "ip" ? Ji(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), F(C, {
11094
11127
  validation: "ip",
11095
11128
  code: e.invalid_string,
11096
11129
  message: Q.message
11097
- }), B.dirty()) : Q.kind === "jwt" ? Ji(A.data, Q.alg) || (C = this._getOrReturnCtx(A, C), F(C, {
11130
+ }), B.dirty()) : Q.kind === "jwt" ? Yi(A.data, Q.alg) || (C = this._getOrReturnCtx(A, C), F(C, {
11098
11131
  validation: "jwt",
11099
11132
  code: e.invalid_string,
11100
11133
  message: Q.message
11101
- }), B.dirty()) : Q.kind === "cidr" ? Yi(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), F(C, {
11134
+ }), B.dirty()) : Q.kind === "cidr" ? di(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), F(C, {
11102
11135
  validation: "cidr",
11103
11136
  code: e.invalid_string,
11104
11137
  message: Q.message
11105
- }), B.dirty()) : Q.kind === "base64" ? Ni.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11138
+ }), B.dirty()) : Q.kind === "base64" ? ci.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11106
11139
  validation: "base64",
11107
11140
  code: e.invalid_string,
11108
11141
  message: Q.message
11109
- }), B.dirty()) : Q.kind === "base64url" ? ci.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11142
+ }), B.dirty()) : Q.kind === "base64url" ? Ui.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11110
11143
  validation: "base64url",
11111
11144
  code: e.invalid_string,
11112
11145
  message: Q.message
@@ -11117,7 +11150,7 @@ class gA extends K {
11117
11150
  return this.refinement((C) => A.test(C), {
11118
11151
  validation: I,
11119
11152
  code: e.invalid_string,
11120
- ...R.errToObj(B)
11153
+ ...N.errToObj(B)
11121
11154
  });
11122
11155
  }
11123
11156
  _addCheck(A) {
@@ -11127,46 +11160,46 @@ class gA extends K {
11127
11160
  });
11128
11161
  }
11129
11162
  email(A) {
11130
- return this._addCheck({ kind: "email", ...R.errToObj(A) });
11163
+ return this._addCheck({ kind: "email", ...N.errToObj(A) });
11131
11164
  }
11132
11165
  url(A) {
11133
- return this._addCheck({ kind: "url", ...R.errToObj(A) });
11166
+ return this._addCheck({ kind: "url", ...N.errToObj(A) });
11134
11167
  }
11135
11168
  emoji(A) {
11136
- return this._addCheck({ kind: "emoji", ...R.errToObj(A) });
11169
+ return this._addCheck({ kind: "emoji", ...N.errToObj(A) });
11137
11170
  }
11138
11171
  uuid(A) {
11139
- return this._addCheck({ kind: "uuid", ...R.errToObj(A) });
11172
+ return this._addCheck({ kind: "uuid", ...N.errToObj(A) });
11140
11173
  }
11141
11174
  nanoid(A) {
11142
- return this._addCheck({ kind: "nanoid", ...R.errToObj(A) });
11175
+ return this._addCheck({ kind: "nanoid", ...N.errToObj(A) });
11143
11176
  }
11144
11177
  cuid(A) {
11145
- return this._addCheck({ kind: "cuid", ...R.errToObj(A) });
11178
+ return this._addCheck({ kind: "cuid", ...N.errToObj(A) });
11146
11179
  }
11147
11180
  cuid2(A) {
11148
- return this._addCheck({ kind: "cuid2", ...R.errToObj(A) });
11181
+ return this._addCheck({ kind: "cuid2", ...N.errToObj(A) });
11149
11182
  }
11150
11183
  ulid(A) {
11151
- return this._addCheck({ kind: "ulid", ...R.errToObj(A) });
11184
+ return this._addCheck({ kind: "ulid", ...N.errToObj(A) });
11152
11185
  }
11153
11186
  base64(A) {
11154
- return this._addCheck({ kind: "base64", ...R.errToObj(A) });
11187
+ return this._addCheck({ kind: "base64", ...N.errToObj(A) });
11155
11188
  }
11156
11189
  base64url(A) {
11157
11190
  return this._addCheck({
11158
11191
  kind: "base64url",
11159
- ...R.errToObj(A)
11192
+ ...N.errToObj(A)
11160
11193
  });
11161
11194
  }
11162
11195
  jwt(A) {
11163
- return this._addCheck({ kind: "jwt", ...R.errToObj(A) });
11196
+ return this._addCheck({ kind: "jwt", ...N.errToObj(A) });
11164
11197
  }
11165
11198
  ip(A) {
11166
- return this._addCheck({ kind: "ip", ...R.errToObj(A) });
11199
+ return this._addCheck({ kind: "ip", ...N.errToObj(A) });
11167
11200
  }
11168
11201
  cidr(A) {
11169
- return this._addCheck({ kind: "cidr", ...R.errToObj(A) });
11202
+ return this._addCheck({ kind: "cidr", ...N.errToObj(A) });
11170
11203
  }
11171
11204
  datetime(A) {
11172
11205
  var I, B;
@@ -11181,7 +11214,7 @@ class gA extends K {
11181
11214
  precision: typeof A?.precision > "u" ? null : A?.precision,
11182
11215
  offset: (I = A?.offset) !== null && I !== void 0 ? I : !1,
11183
11216
  local: (B = A?.local) !== null && B !== void 0 ? B : !1,
11184
- ...R.errToObj(A?.message)
11217
+ ...N.errToObj(A?.message)
11185
11218
  });
11186
11219
  }
11187
11220
  date(A) {
@@ -11195,17 +11228,17 @@ class gA extends K {
11195
11228
  }) : this._addCheck({
11196
11229
  kind: "time",
11197
11230
  precision: typeof A?.precision > "u" ? null : A?.precision,
11198
- ...R.errToObj(A?.message)
11231
+ ...N.errToObj(A?.message)
11199
11232
  });
11200
11233
  }
11201
11234
  duration(A) {
11202
- return this._addCheck({ kind: "duration", ...R.errToObj(A) });
11235
+ return this._addCheck({ kind: "duration", ...N.errToObj(A) });
11203
11236
  }
11204
11237
  regex(A, I) {
11205
11238
  return this._addCheck({
11206
11239
  kind: "regex",
11207
11240
  regex: A,
11208
- ...R.errToObj(I)
11241
+ ...N.errToObj(I)
11209
11242
  });
11210
11243
  }
11211
11244
  includes(A, I) {
@@ -11213,49 +11246,49 @@ class gA extends K {
11213
11246
  kind: "includes",
11214
11247
  value: A,
11215
11248
  position: I?.position,
11216
- ...R.errToObj(I?.message)
11249
+ ...N.errToObj(I?.message)
11217
11250
  });
11218
11251
  }
11219
11252
  startsWith(A, I) {
11220
11253
  return this._addCheck({
11221
11254
  kind: "startsWith",
11222
11255
  value: A,
11223
- ...R.errToObj(I)
11256
+ ...N.errToObj(I)
11224
11257
  });
11225
11258
  }
11226
11259
  endsWith(A, I) {
11227
11260
  return this._addCheck({
11228
11261
  kind: "endsWith",
11229
11262
  value: A,
11230
- ...R.errToObj(I)
11263
+ ...N.errToObj(I)
11231
11264
  });
11232
11265
  }
11233
11266
  min(A, I) {
11234
11267
  return this._addCheck({
11235
11268
  kind: "min",
11236
11269
  value: A,
11237
- ...R.errToObj(I)
11270
+ ...N.errToObj(I)
11238
11271
  });
11239
11272
  }
11240
11273
  max(A, I) {
11241
11274
  return this._addCheck({
11242
11275
  kind: "max",
11243
11276
  value: A,
11244
- ...R.errToObj(I)
11277
+ ...N.errToObj(I)
11245
11278
  });
11246
11279
  }
11247
11280
  length(A, I) {
11248
11281
  return this._addCheck({
11249
11282
  kind: "length",
11250
11283
  value: A,
11251
- ...R.errToObj(I)
11284
+ ...N.errToObj(I)
11252
11285
  });
11253
11286
  }
11254
11287
  /**
11255
11288
  * Equivalent to `.min(1)`
11256
11289
  */
11257
11290
  nonempty(A) {
11258
- return this.min(1, R.errToObj(A));
11291
+ return this.min(1, N.errToObj(A));
11259
11292
  }
11260
11293
  trim() {
11261
11294
  return new gA({
@@ -11345,7 +11378,7 @@ gA.create = (g) => {
11345
11378
  ...M(g)
11346
11379
  });
11347
11380
  };
11348
- function di(g, A) {
11381
+ function Mi(g, A) {
11349
11382
  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(".", ""));
11350
11383
  return Q % E / Math.pow(10, C);
11351
11384
  }
@@ -11360,7 +11393,7 @@ class eA extends K {
11360
11393
  code: e.invalid_type,
11361
11394
  expected: S.number,
11362
11395
  received: Q.parsedType
11363
- }), Y;
11396
+ }), d;
11364
11397
  }
11365
11398
  let B;
11366
11399
  const C = new X();
@@ -11384,7 +11417,7 @@ class eA extends K {
11384
11417
  inclusive: Q.inclusive,
11385
11418
  exact: !1,
11386
11419
  message: Q.message
11387
- }), C.dirty()) : Q.kind === "multipleOf" ? di(A.data, Q.value) !== 0 && (B = this._getOrReturnCtx(A, B), F(B, {
11420
+ }), C.dirty()) : Q.kind === "multipleOf" ? Mi(A.data, Q.value) !== 0 && (B = this._getOrReturnCtx(A, B), F(B, {
11388
11421
  code: e.not_multiple_of,
11389
11422
  multipleOf: Q.value,
11390
11423
  message: Q.message
@@ -11395,16 +11428,16 @@ class eA extends K {
11395
11428
  return { status: C.value, value: A.data };
11396
11429
  }
11397
11430
  gte(A, I) {
11398
- return this.setLimit("min", A, !0, R.toString(I));
11431
+ return this.setLimit("min", A, !0, N.toString(I));
11399
11432
  }
11400
11433
  gt(A, I) {
11401
- return this.setLimit("min", A, !1, R.toString(I));
11434
+ return this.setLimit("min", A, !1, N.toString(I));
11402
11435
  }
11403
11436
  lte(A, I) {
11404
- return this.setLimit("max", A, !0, R.toString(I));
11437
+ return this.setLimit("max", A, !0, N.toString(I));
11405
11438
  }
11406
11439
  lt(A, I) {
11407
- return this.setLimit("max", A, !1, R.toString(I));
11440
+ return this.setLimit("max", A, !1, N.toString(I));
11408
11441
  }
11409
11442
  setLimit(A, I, B, C) {
11410
11443
  return new eA({
@@ -11415,7 +11448,7 @@ class eA extends K {
11415
11448
  kind: A,
11416
11449
  value: I,
11417
11450
  inclusive: B,
11418
- message: R.toString(C)
11451
+ message: N.toString(C)
11419
11452
  }
11420
11453
  ]
11421
11454
  });
@@ -11429,7 +11462,7 @@ class eA extends K {
11429
11462
  int(A) {
11430
11463
  return this._addCheck({
11431
11464
  kind: "int",
11432
- message: R.toString(A)
11465
+ message: N.toString(A)
11433
11466
  });
11434
11467
  }
11435
11468
  positive(A) {
@@ -11437,7 +11470,7 @@ class eA extends K {
11437
11470
  kind: "min",
11438
11471
  value: 0,
11439
11472
  inclusive: !1,
11440
- message: R.toString(A)
11473
+ message: N.toString(A)
11441
11474
  });
11442
11475
  }
11443
11476
  negative(A) {
@@ -11445,7 +11478,7 @@ class eA extends K {
11445
11478
  kind: "max",
11446
11479
  value: 0,
11447
11480
  inclusive: !1,
11448
- message: R.toString(A)
11481
+ message: N.toString(A)
11449
11482
  });
11450
11483
  }
11451
11484
  nonpositive(A) {
@@ -11453,7 +11486,7 @@ class eA extends K {
11453
11486
  kind: "max",
11454
11487
  value: 0,
11455
11488
  inclusive: !0,
11456
- message: R.toString(A)
11489
+ message: N.toString(A)
11457
11490
  });
11458
11491
  }
11459
11492
  nonnegative(A) {
@@ -11461,20 +11494,20 @@ class eA extends K {
11461
11494
  kind: "min",
11462
11495
  value: 0,
11463
11496
  inclusive: !0,
11464
- message: R.toString(A)
11497
+ message: N.toString(A)
11465
11498
  });
11466
11499
  }
11467
11500
  multipleOf(A, I) {
11468
11501
  return this._addCheck({
11469
11502
  kind: "multipleOf",
11470
11503
  value: A,
11471
- message: R.toString(I)
11504
+ message: N.toString(I)
11472
11505
  });
11473
11506
  }
11474
11507
  finite(A) {
11475
11508
  return this._addCheck({
11476
11509
  kind: "finite",
11477
- message: R.toString(A)
11510
+ message: N.toString(A)
11478
11511
  });
11479
11512
  }
11480
11513
  safe(A) {
@@ -11482,12 +11515,12 @@ class eA extends K {
11482
11515
  kind: "min",
11483
11516
  inclusive: !0,
11484
11517
  value: Number.MIN_SAFE_INTEGER,
11485
- message: R.toString(A)
11518
+ message: N.toString(A)
11486
11519
  })._addCheck({
11487
11520
  kind: "max",
11488
11521
  inclusive: !0,
11489
11522
  value: Number.MAX_SAFE_INTEGER,
11490
- message: R.toString(A)
11523
+ message: N.toString(A)
11491
11524
  });
11492
11525
  }
11493
11526
  get minValue() {
@@ -11562,19 +11595,19 @@ class GA extends K {
11562
11595
  code: e.invalid_type,
11563
11596
  expected: S.bigint,
11564
11597
  received: I.parsedType
11565
- }), Y;
11598
+ }), d;
11566
11599
  }
11567
11600
  gte(A, I) {
11568
- return this.setLimit("min", A, !0, R.toString(I));
11601
+ return this.setLimit("min", A, !0, N.toString(I));
11569
11602
  }
11570
11603
  gt(A, I) {
11571
- return this.setLimit("min", A, !1, R.toString(I));
11604
+ return this.setLimit("min", A, !1, N.toString(I));
11572
11605
  }
11573
11606
  lte(A, I) {
11574
- return this.setLimit("max", A, !0, R.toString(I));
11607
+ return this.setLimit("max", A, !0, N.toString(I));
11575
11608
  }
11576
11609
  lt(A, I) {
11577
- return this.setLimit("max", A, !1, R.toString(I));
11610
+ return this.setLimit("max", A, !1, N.toString(I));
11578
11611
  }
11579
11612
  setLimit(A, I, B, C) {
11580
11613
  return new GA({
@@ -11585,7 +11618,7 @@ class GA extends K {
11585
11618
  kind: A,
11586
11619
  value: I,
11587
11620
  inclusive: B,
11588
- message: R.toString(C)
11621
+ message: N.toString(C)
11589
11622
  }
11590
11623
  ]
11591
11624
  });
@@ -11601,7 +11634,7 @@ class GA extends K {
11601
11634
  kind: "min",
11602
11635
  value: BigInt(0),
11603
11636
  inclusive: !1,
11604
- message: R.toString(A)
11637
+ message: N.toString(A)
11605
11638
  });
11606
11639
  }
11607
11640
  negative(A) {
@@ -11609,7 +11642,7 @@ class GA extends K {
11609
11642
  kind: "max",
11610
11643
  value: BigInt(0),
11611
11644
  inclusive: !1,
11612
- message: R.toString(A)
11645
+ message: N.toString(A)
11613
11646
  });
11614
11647
  }
11615
11648
  nonpositive(A) {
@@ -11617,7 +11650,7 @@ class GA extends K {
11617
11650
  kind: "max",
11618
11651
  value: BigInt(0),
11619
11652
  inclusive: !0,
11620
- message: R.toString(A)
11653
+ message: N.toString(A)
11621
11654
  });
11622
11655
  }
11623
11656
  nonnegative(A) {
@@ -11625,14 +11658,14 @@ class GA extends K {
11625
11658
  kind: "min",
11626
11659
  value: BigInt(0),
11627
11660
  inclusive: !0,
11628
- message: R.toString(A)
11661
+ message: N.toString(A)
11629
11662
  });
11630
11663
  }
11631
11664
  multipleOf(A, I) {
11632
11665
  return this._addCheck({
11633
11666
  kind: "multipleOf",
11634
11667
  value: A,
11635
- message: R.toString(I)
11668
+ message: N.toString(I)
11636
11669
  });
11637
11670
  }
11638
11671
  get minValue() {
@@ -11665,7 +11698,7 @@ class gI extends K {
11665
11698
  code: e.invalid_type,
11666
11699
  expected: S.boolean,
11667
11700
  received: B.parsedType
11668
- }), Y;
11701
+ }), d;
11669
11702
  }
11670
11703
  return j(A.data);
11671
11704
  }
@@ -11683,13 +11716,13 @@ class JA extends K {
11683
11716
  code: e.invalid_type,
11684
11717
  expected: S.date,
11685
11718
  received: Q.parsedType
11686
- }), Y;
11719
+ }), d;
11687
11720
  }
11688
11721
  if (isNaN(A.data.getTime())) {
11689
11722
  const Q = this._getOrReturnCtx(A);
11690
11723
  return F(Q, {
11691
11724
  code: e.invalid_date
11692
- }), Y;
11725
+ }), d;
11693
11726
  }
11694
11727
  const B = new X();
11695
11728
  let C;
@@ -11724,14 +11757,14 @@ class JA extends K {
11724
11757
  return this._addCheck({
11725
11758
  kind: "min",
11726
11759
  value: A.getTime(),
11727
- message: R.toString(I)
11760
+ message: N.toString(I)
11728
11761
  });
11729
11762
  }
11730
11763
  max(A, I) {
11731
11764
  return this._addCheck({
11732
11765
  kind: "max",
11733
11766
  value: A.getTime(),
11734
- message: R.toString(I)
11767
+ message: N.toString(I)
11735
11768
  });
11736
11769
  }
11737
11770
  get minDate() {
@@ -11761,7 +11794,7 @@ class qI extends K {
11761
11794
  code: e.invalid_type,
11762
11795
  expected: S.symbol,
11763
11796
  received: B.parsedType
11764
- }), Y;
11797
+ }), d;
11765
11798
  }
11766
11799
  return j(A.data);
11767
11800
  }
@@ -11778,7 +11811,7 @@ class BI extends K {
11778
11811
  code: e.invalid_type,
11779
11812
  expected: S.undefined,
11780
11813
  received: B.parsedType
11781
- }), Y;
11814
+ }), d;
11782
11815
  }
11783
11816
  return j(A.data);
11784
11817
  }
@@ -11795,7 +11828,7 @@ class CI extends K {
11795
11828
  code: e.invalid_type,
11796
11829
  expected: S.null,
11797
11830
  received: B.parsedType
11798
- }), Y;
11831
+ }), d;
11799
11832
  }
11800
11833
  return j(A.data);
11801
11834
  }
@@ -11835,7 +11868,7 @@ class yA extends K {
11835
11868
  code: e.invalid_type,
11836
11869
  expected: S.never,
11837
11870
  received: I.parsedType
11838
- }), Y;
11871
+ }), d;
11839
11872
  }
11840
11873
  }
11841
11874
  yA.create = (g) => new yA({
@@ -11850,7 +11883,7 @@ class lI extends K {
11850
11883
  code: e.invalid_type,
11851
11884
  expected: S.void,
11852
11885
  received: B.parsedType
11853
- }), Y;
11886
+ }), d;
11854
11887
  }
11855
11888
  return j(A.data);
11856
11889
  }
@@ -11867,7 +11900,7 @@ class QA extends K {
11867
11900
  code: e.invalid_type,
11868
11901
  expected: S.array,
11869
11902
  received: I.parsedType
11870
- }), Y;
11903
+ }), d;
11871
11904
  if (C.exactLength !== null) {
11872
11905
  const E = I.data.length > C.exactLength.value, i = I.data.length < C.exactLength.value;
11873
11906
  (E || i) && (F(I, {
@@ -11905,19 +11938,19 @@ class QA extends K {
11905
11938
  min(A, I) {
11906
11939
  return new QA({
11907
11940
  ...this._def,
11908
- minLength: { value: A, message: R.toString(I) }
11941
+ minLength: { value: A, message: N.toString(I) }
11909
11942
  });
11910
11943
  }
11911
11944
  max(A, I) {
11912
11945
  return new QA({
11913
11946
  ...this._def,
11914
- maxLength: { value: A, message: R.toString(I) }
11947
+ maxLength: { value: A, message: N.toString(I) }
11915
11948
  });
11916
11949
  }
11917
11950
  length(A, I) {
11918
11951
  return new QA({
11919
11952
  ...this._def,
11920
- exactLength: { value: A, message: R.toString(I) }
11953
+ exactLength: { value: A, message: N.toString(I) }
11921
11954
  });
11922
11955
  }
11923
11956
  nonempty(A) {
@@ -11933,13 +11966,13 @@ QA.create = (g, A) => new QA({
11933
11966
  ...M(A)
11934
11967
  });
11935
11968
  function MA(g) {
11936
- if (g instanceof m) {
11969
+ if (g instanceof u) {
11937
11970
  const A = {};
11938
11971
  for (const I in g.shape) {
11939
11972
  const B = g.shape[I];
11940
11973
  A[I] = aA.create(MA(B));
11941
11974
  }
11942
- return new m({
11975
+ return new u({
11943
11976
  ...g._def,
11944
11977
  shape: () => A
11945
11978
  });
@@ -11948,7 +11981,7 @@ function MA(g) {
11948
11981
  type: MA(g.element)
11949
11982
  }) : g instanceof aA ? aA.create(MA(g.unwrap())) : g instanceof wA ? wA.create(MA(g.unwrap())) : g instanceof DA ? DA.create(g.items.map((A) => MA(A))) : g;
11950
11983
  }
11951
- class m extends K {
11984
+ class u extends K {
11952
11985
  constructor() {
11953
11986
  super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
11954
11987
  }
@@ -11965,7 +11998,7 @@ class m extends K {
11965
11998
  code: e.invalid_type,
11966
11999
  expected: S.object,
11967
12000
  received: a.parsedType
11968
- }), Y;
12001
+ }), d;
11969
12002
  }
11970
12003
  const { status: B, ctx: C } = this._processInputParams(A), { shape: Q, keys: E } = this._getCached(), i = [];
11971
12004
  if (!(this._def.catchall instanceof yA && this._def.unknownKeys === "strip"))
@@ -12025,7 +12058,7 @@ class m extends K {
12025
12058
  return this._def.shape();
12026
12059
  }
12027
12060
  strict(A) {
12028
- return R.errToObj, new m({
12061
+ return N.errToObj, new u({
12029
12062
  ...this._def,
12030
12063
  unknownKeys: "strict",
12031
12064
  ...A !== void 0 ? {
@@ -12033,7 +12066,7 @@ class m extends K {
12033
12066
  var C, Q, E, i;
12034
12067
  const o = (E = (Q = (C = this._def).errorMap) === null || Q === void 0 ? void 0 : Q.call(C, I, B).message) !== null && E !== void 0 ? E : B.defaultError;
12035
12068
  return I.code === "unrecognized_keys" ? {
12036
- message: (i = R.errToObj(A).message) !== null && i !== void 0 ? i : o
12069
+ message: (i = N.errToObj(A).message) !== null && i !== void 0 ? i : o
12037
12070
  } : {
12038
12071
  message: o
12039
12072
  };
@@ -12042,13 +12075,13 @@ class m extends K {
12042
12075
  });
12043
12076
  }
12044
12077
  strip() {
12045
- return new m({
12078
+ return new u({
12046
12079
  ...this._def,
12047
12080
  unknownKeys: "strip"
12048
12081
  });
12049
12082
  }
12050
12083
  passthrough() {
12051
- return new m({
12084
+ return new u({
12052
12085
  ...this._def,
12053
12086
  unknownKeys: "passthrough"
12054
12087
  });
@@ -12071,7 +12104,7 @@ class m extends K {
12071
12104
  // }) as any;
12072
12105
  // };
12073
12106
  extend(A) {
12074
- return new m({
12107
+ return new u({
12075
12108
  ...this._def,
12076
12109
  shape: () => ({
12077
12110
  ...this._def.shape(),
@@ -12085,7 +12118,7 @@ class m extends K {
12085
12118
  * upgrade if you are experiencing issues.
12086
12119
  */
12087
12120
  merge(A) {
12088
- return new m({
12121
+ return new u({
12089
12122
  unknownKeys: A._def.unknownKeys,
12090
12123
  catchall: A._def.catchall,
12091
12124
  shape: () => ({
@@ -12155,7 +12188,7 @@ class m extends K {
12155
12188
  // return merged;
12156
12189
  // }
12157
12190
  catchall(A) {
12158
- return new m({
12191
+ return new u({
12159
12192
  ...this._def,
12160
12193
  catchall: A
12161
12194
  });
@@ -12164,7 +12197,7 @@ class m extends K {
12164
12197
  const I = {};
12165
12198
  return H.objectKeys(A).forEach((B) => {
12166
12199
  A[B] && this.shape[B] && (I[B] = this.shape[B]);
12167
- }), new m({
12200
+ }), new u({
12168
12201
  ...this._def,
12169
12202
  shape: () => I
12170
12203
  });
@@ -12173,7 +12206,7 @@ class m extends K {
12173
12206
  const I = {};
12174
12207
  return H.objectKeys(this.shape).forEach((B) => {
12175
12208
  A[B] || (I[B] = this.shape[B]);
12176
- }), new m({
12209
+ }), new u({
12177
12210
  ...this._def,
12178
12211
  shape: () => I
12179
12212
  });
@@ -12189,7 +12222,7 @@ class m extends K {
12189
12222
  return H.objectKeys(this.shape).forEach((B) => {
12190
12223
  const C = this.shape[B];
12191
12224
  A && !A[B] ? I[B] = C : I[B] = C.optional();
12192
- }), new m({
12225
+ }), new u({
12193
12226
  ...this._def,
12194
12227
  shape: () => I
12195
12228
  });
@@ -12205,30 +12238,30 @@ class m extends K {
12205
12238
  Q = Q._def.innerType;
12206
12239
  I[B] = Q;
12207
12240
  }
12208
- }), new m({
12241
+ }), new u({
12209
12242
  ...this._def,
12210
12243
  shape: () => I
12211
12244
  });
12212
12245
  }
12213
12246
  keyof() {
12214
- return IC(H.objectKeys(this.shape));
12247
+ return BC(H.objectKeys(this.shape));
12215
12248
  }
12216
12249
  }
12217
- m.create = (g, A) => new m({
12250
+ u.create = (g, A) => new u({
12218
12251
  shape: () => g,
12219
12252
  unknownKeys: "strip",
12220
12253
  catchall: yA.create(),
12221
12254
  typeName: J.ZodObject,
12222
12255
  ...M(A)
12223
12256
  });
12224
- m.strictCreate = (g, A) => new m({
12257
+ u.strictCreate = (g, A) => new u({
12225
12258
  shape: () => g,
12226
12259
  unknownKeys: "strict",
12227
12260
  catchall: yA.create(),
12228
12261
  typeName: J.ZodObject,
12229
12262
  ...M(A)
12230
12263
  });
12231
- m.lazycreate = (g, A) => new m({
12264
+ u.lazycreate = (g, A) => new u({
12232
12265
  shape: g,
12233
12266
  unknownKeys: "strip",
12234
12267
  catchall: yA.create(),
@@ -12249,7 +12282,7 @@ class QI extends K {
12249
12282
  return F(I, {
12250
12283
  code: e.invalid_union,
12251
12284
  unionErrors: E
12252
- }), Y;
12285
+ }), d;
12253
12286
  }
12254
12287
  if (I.common.async)
12255
12288
  return Promise.all(B.map(async (Q) => {
@@ -12296,7 +12329,7 @@ class QI extends K {
12296
12329
  return F(I, {
12297
12330
  code: e.invalid_union,
12298
12331
  unionErrors: i
12299
- }), Y;
12332
+ }), d;
12300
12333
  }
12301
12334
  }
12302
12335
  get options() {
@@ -12317,7 +12350,7 @@ class bI extends K {
12317
12350
  code: e.invalid_type,
12318
12351
  expected: S.object,
12319
12352
  received: I.parsedType
12320
- }), Y;
12353
+ }), d;
12321
12354
  const B = this.discriminator, C = I.data[B], Q = this.optionsMap.get(C);
12322
12355
  return Q ? I.common.async ? Q._parseAsync({
12323
12356
  data: I.data,
@@ -12331,7 +12364,7 @@ class bI extends K {
12331
12364
  code: e.invalid_union_discriminator,
12332
12365
  options: Array.from(this.optionsMap.keys()),
12333
12366
  path: [B]
12334
- }), Y);
12367
+ }), d);
12335
12368
  }
12336
12369
  get discriminator() {
12337
12370
  return this._def.discriminator;
@@ -12401,11 +12434,11 @@ class EI extends K {
12401
12434
  _parse(A) {
12402
12435
  const { status: I, ctx: B } = this._processInputParams(A), C = (Q, E) => {
12403
12436
  if (Dg(Q) || Dg(E))
12404
- return Y;
12437
+ return d;
12405
12438
  const i = tg(Q.value, E.value);
12406
12439
  return i.valid ? ((hg(Q) || hg(E)) && I.dirty(), { status: I.value, value: i.data }) : (F(B, {
12407
12440
  code: e.invalid_intersection_types
12408
- }), Y);
12441
+ }), d);
12409
12442
  };
12410
12443
  return B.common.async ? Promise.all([
12411
12444
  this._def.left._parseAsync({
@@ -12443,7 +12476,7 @@ class DA extends K {
12443
12476
  code: e.invalid_type,
12444
12477
  expected: S.array,
12445
12478
  received: B.parsedType
12446
- }), Y;
12479
+ }), d;
12447
12480
  if (B.data.length < this._def.items.length)
12448
12481
  return F(B, {
12449
12482
  code: e.too_small,
@@ -12451,7 +12484,7 @@ class DA extends K {
12451
12484
  inclusive: !0,
12452
12485
  exact: !1,
12453
12486
  type: "array"
12454
- }), Y;
12487
+ }), d;
12455
12488
  !this._def.rest && B.data.length > this._def.items.length && (F(B, {
12456
12489
  code: e.too_big,
12457
12490
  maximum: this._def.items.length,
@@ -12499,7 +12532,7 @@ class iI extends K {
12499
12532
  code: e.invalid_type,
12500
12533
  expected: S.object,
12501
12534
  received: B.parsedType
12502
- }), Y;
12535
+ }), d;
12503
12536
  const C = [], Q = this._def.keyType, E = this._def.valueType;
12504
12537
  for (const i in B.data)
12505
12538
  C.push({
@@ -12540,7 +12573,7 @@ class fI extends K {
12540
12573
  code: e.invalid_type,
12541
12574
  expected: S.map,
12542
12575
  received: B.parsedType
12543
- }), Y;
12576
+ }), d;
12544
12577
  const C = this._def.keyType, Q = this._def.valueType, E = [...B.data.entries()].map(([i, o], a) => ({
12545
12578
  key: C._parse(new sA(B, i, B.path, [a, "key"])),
12546
12579
  value: Q._parse(new sA(B, o, B.path, [a, "value"]))
@@ -12551,7 +12584,7 @@ class fI extends K {
12551
12584
  for (const o of E) {
12552
12585
  const a = await o.key, s = await o.value;
12553
12586
  if (a.status === "aborted" || s.status === "aborted")
12554
- return Y;
12587
+ return d;
12555
12588
  (a.status === "dirty" || s.status === "dirty") && I.dirty(), i.set(a.value, s.value);
12556
12589
  }
12557
12590
  return { status: I.value, value: i };
@@ -12561,7 +12594,7 @@ class fI extends K {
12561
12594
  for (const o of E) {
12562
12595
  const a = o.key, s = o.value;
12563
12596
  if (a.status === "aborted" || s.status === "aborted")
12564
- return Y;
12597
+ return d;
12565
12598
  (a.status === "dirty" || s.status === "dirty") && I.dirty(), i.set(a.value, s.value);
12566
12599
  }
12567
12600
  return { status: I.value, value: i };
@@ -12582,7 +12615,7 @@ class YA extends K {
12582
12615
  code: e.invalid_type,
12583
12616
  expected: S.set,
12584
12617
  received: B.parsedType
12585
- }), Y;
12618
+ }), d;
12586
12619
  const C = this._def;
12587
12620
  C.minSize !== null && B.data.size < C.minSize.value && (F(B, {
12588
12621
  code: e.too_small,
@@ -12604,7 +12637,7 @@ class YA extends K {
12604
12637
  const a = /* @__PURE__ */ new Set();
12605
12638
  for (const s of o) {
12606
12639
  if (s.status === "aborted")
12607
- return Y;
12640
+ return d;
12608
12641
  s.status === "dirty" && I.dirty(), a.add(s.value);
12609
12642
  }
12610
12643
  return { status: I.value, value: a };
@@ -12615,13 +12648,13 @@ class YA extends K {
12615
12648
  min(A, I) {
12616
12649
  return new YA({
12617
12650
  ...this._def,
12618
- minSize: { value: A, message: R.toString(I) }
12651
+ minSize: { value: A, message: N.toString(I) }
12619
12652
  });
12620
12653
  }
12621
12654
  max(A, I) {
12622
12655
  return new YA({
12623
12656
  ...this._def,
12624
- maxSize: { value: A, message: R.toString(I) }
12657
+ maxSize: { value: A, message: N.toString(I) }
12625
12658
  });
12626
12659
  }
12627
12660
  size(A, I) {
@@ -12649,7 +12682,7 @@ class qA extends K {
12649
12682
  code: e.invalid_type,
12650
12683
  expected: S.function,
12651
12684
  received: I.parsedType
12652
- }), Y;
12685
+ }), d;
12653
12686
  function B(i, o) {
12654
12687
  return KI({
12655
12688
  data: i,
@@ -12761,7 +12794,7 @@ class aI extends K {
12761
12794
  received: I.data,
12762
12795
  code: e.invalid_literal,
12763
12796
  expected: this._def.value
12764
- }), Y;
12797
+ }), d;
12765
12798
  }
12766
12799
  return { status: "valid", value: A.data };
12767
12800
  }
@@ -12774,7 +12807,7 @@ aI.create = (g, A) => new aI({
12774
12807
  typeName: J.ZodLiteral,
12775
12808
  ...M(A)
12776
12809
  });
12777
- function IC(g, A) {
12810
+ function BC(g, A) {
12778
12811
  return new nA({
12779
12812
  values: g,
12780
12813
  typeName: J.ZodEnum,
@@ -12792,15 +12825,15 @@ class nA extends K {
12792
12825
  expected: H.joinValues(B),
12793
12826
  received: I.parsedType,
12794
12827
  code: e.invalid_type
12795
- }), Y;
12828
+ }), d;
12796
12829
  }
12797
- if (HI(this, VA) || zB(this, VA, new Set(this._def.values)), !HI(this, VA).has(A.data)) {
12830
+ if (HI(this, VA) || $B(this, VA, new Set(this._def.values)), !HI(this, VA).has(A.data)) {
12798
12831
  const I = this._getOrReturnCtx(A), B = this._def.values;
12799
12832
  return F(I, {
12800
12833
  received: I.data,
12801
12834
  code: e.invalid_enum_value,
12802
12835
  options: B
12803
- }), Y;
12836
+ }), d;
12804
12837
  }
12805
12838
  return j(A.data);
12806
12839
  }
@@ -12839,7 +12872,7 @@ class nA extends K {
12839
12872
  }
12840
12873
  }
12841
12874
  VA = /* @__PURE__ */ new WeakMap();
12842
- nA.create = IC;
12875
+ nA.create = BC;
12843
12876
  class sI extends K {
12844
12877
  constructor() {
12845
12878
  super(...arguments), vA.set(this, void 0);
@@ -12852,15 +12885,15 @@ class sI extends K {
12852
12885
  expected: H.joinValues(C),
12853
12886
  received: B.parsedType,
12854
12887
  code: e.invalid_type
12855
- }), Y;
12888
+ }), d;
12856
12889
  }
12857
- if (HI(this, vA) || zB(this, vA, new Set(H.getValidEnumValues(this._def.values))), !HI(this, vA).has(A.data)) {
12890
+ if (HI(this, vA) || $B(this, vA, new Set(H.getValidEnumValues(this._def.values))), !HI(this, vA).has(A.data)) {
12858
12891
  const C = H.objectValues(I);
12859
12892
  return F(B, {
12860
12893
  received: B.data,
12861
12894
  code: e.invalid_enum_value,
12862
12895
  options: C
12863
- }), Y;
12896
+ }), d;
12864
12897
  }
12865
12898
  return j(A.data);
12866
12899
  }
@@ -12885,7 +12918,7 @@ class xA extends K {
12885
12918
  code: e.invalid_type,
12886
12919
  expected: S.promise,
12887
12920
  received: I.parsedType
12888
- }), Y;
12921
+ }), d;
12889
12922
  const B = I.parsedType === S.promise ? I.data : Promise.resolve(I.data);
12890
12923
  return j(B.then((C) => this._def.type.parseAsync(C, {
12891
12924
  path: I.path,
@@ -12919,23 +12952,23 @@ class EA extends K {
12919
12952
  if (B.common.async)
12920
12953
  return Promise.resolve(E).then(async (i) => {
12921
12954
  if (I.value === "aborted")
12922
- return Y;
12955
+ return d;
12923
12956
  const o = await this._def.schema._parseAsync({
12924
12957
  data: i,
12925
12958
  path: B.path,
12926
12959
  parent: B
12927
12960
  });
12928
- return o.status === "aborted" ? Y : o.status === "dirty" || I.value === "dirty" ? KA(o.value) : o;
12961
+ return o.status === "aborted" ? d : o.status === "dirty" || I.value === "dirty" ? KA(o.value) : o;
12929
12962
  });
12930
12963
  {
12931
12964
  if (I.value === "aborted")
12932
- return Y;
12965
+ return d;
12933
12966
  const i = this._def.schema._parseSync({
12934
12967
  data: E,
12935
12968
  path: B.path,
12936
12969
  parent: B
12937
12970
  });
12938
- return i.status === "aborted" ? Y : i.status === "dirty" || I.value === "dirty" ? KA(i.value) : i;
12971
+ return i.status === "aborted" ? d : i.status === "dirty" || I.value === "dirty" ? KA(i.value) : i;
12939
12972
  }
12940
12973
  }
12941
12974
  if (C.type === "refinement") {
@@ -12953,9 +12986,9 @@ class EA extends K {
12953
12986
  path: B.path,
12954
12987
  parent: B
12955
12988
  });
12956
- return i.status === "aborted" ? Y : (i.status === "dirty" && I.dirty(), E(i.value), { status: I.value, value: i.value });
12989
+ return i.status === "aborted" ? d : (i.status === "dirty" && I.dirty(), E(i.value), { status: I.value, value: i.value });
12957
12990
  } else
12958
- return this._def.schema._parseAsync({ data: B.data, path: B.path, parent: B }).then((i) => i.status === "aborted" ? Y : (i.status === "dirty" && I.dirty(), E(i.value).then(() => ({ status: I.value, value: i.value }))));
12991
+ return this._def.schema._parseAsync({ data: B.data, path: B.path, parent: B }).then((i) => i.status === "aborted" ? d : (i.status === "dirty" && I.dirty(), E(i.value).then(() => ({ status: I.value, value: i.value }))));
12959
12992
  }
12960
12993
  if (C.type === "transform")
12961
12994
  if (B.common.async === !1) {
@@ -13084,7 +13117,7 @@ class pI extends K {
13084
13117
  code: e.invalid_type,
13085
13118
  expected: S.nan,
13086
13119
  received: B.parsedType
13087
- }), Y;
13120
+ }), d;
13088
13121
  }
13089
13122
  return { status: "valid", value: A.data };
13090
13123
  }
@@ -13093,7 +13126,7 @@ pI.create = (g) => new pI({
13093
13126
  typeName: J.ZodNaN,
13094
13127
  ...M(g)
13095
13128
  });
13096
- const Mi = Symbol("zod_brand");
13129
+ const Ki = Symbol("zod_brand");
13097
13130
  class fg extends K {
13098
13131
  _parse(A) {
13099
13132
  const { ctx: I } = this._processInputParams(A), B = I.data;
@@ -13117,7 +13150,7 @@ class FI extends K {
13117
13150
  path: B.path,
13118
13151
  parent: B
13119
13152
  });
13120
- return Q.status === "aborted" ? Y : Q.status === "dirty" ? (I.dirty(), KA(Q.value)) : this._def.out._parseAsync({
13153
+ return Q.status === "aborted" ? d : Q.status === "dirty" ? (I.dirty(), KA(Q.value)) : this._def.out._parseAsync({
13121
13154
  data: Q.value,
13122
13155
  path: B.path,
13123
13156
  parent: B
@@ -13129,7 +13162,7 @@ class FI extends K {
13129
13162
  path: B.path,
13130
13163
  parent: B
13131
13164
  });
13132
- return C.status === "aborted" ? Y : C.status === "dirty" ? (I.dirty(), {
13165
+ return C.status === "aborted" ? d : C.status === "dirty" ? (I.dirty(), {
13133
13166
  status: "dirty",
13134
13167
  value: C.value
13135
13168
  }) : this._def.out._parseSync({
@@ -13161,11 +13194,11 @@ tI.create = (g, A) => new tI({
13161
13194
  typeName: J.ZodReadonly,
13162
13195
  ...M(A)
13163
13196
  });
13164
- function UB(g, A) {
13197
+ function kB(g, A) {
13165
13198
  const I = typeof g == "function" ? g(A) : typeof g == "string" ? { message: g } : g;
13166
13199
  return typeof I == "string" ? { message: I } : I;
13167
13200
  }
13168
- function gC(g, A = {}, I) {
13201
+ function CC(g, A = {}, I) {
13169
13202
  return g ? TA.create().superRefine((B, C) => {
13170
13203
  var Q, E;
13171
13204
  const i = g(B);
@@ -13173,26 +13206,26 @@ function gC(g, A = {}, I) {
13173
13206
  return i.then((o) => {
13174
13207
  var a, s;
13175
13208
  if (!o) {
13176
- const h = UB(A, B), t = (s = (a = h.fatal) !== null && a !== void 0 ? a : I) !== null && s !== void 0 ? s : !0;
13209
+ const h = kB(A, B), t = (s = (a = h.fatal) !== null && a !== void 0 ? a : I) !== null && s !== void 0 ? s : !0;
13177
13210
  C.addIssue({ code: "custom", ...h, fatal: t });
13178
13211
  }
13179
13212
  });
13180
13213
  if (!i) {
13181
- const o = UB(A, B), a = (E = (Q = o.fatal) !== null && Q !== void 0 ? Q : I) !== null && E !== void 0 ? E : !0;
13214
+ const o = kB(A, B), a = (E = (Q = o.fatal) !== null && Q !== void 0 ? Q : I) !== null && E !== void 0 ? E : !0;
13182
13215
  C.addIssue({ code: "custom", ...o, fatal: a });
13183
13216
  }
13184
13217
  }) : TA.create();
13185
13218
  }
13186
- const Ki = {
13187
- object: m.lazycreate
13219
+ const Hi = {
13220
+ object: u.lazycreate
13188
13221
  };
13189
13222
  var J;
13190
13223
  (function(g) {
13191
13224
  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";
13192
13225
  })(J || (J = {}));
13193
- const Hi = (g, A = {
13226
+ const qi = (g, A = {
13194
13227
  message: `Input not instance of ${g.name}`
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 = {
13228
+ }) => CC((I) => I instanceof g, A), QC = gA.create, EC = eA.create, li = pI.create, fi = GA.create, iC = gI.create, pi = JA.create, mi = qI.create, ui = BI.create, Ti = CI.create, xi = TA.create, Wi = NA.create, bi = yA.create, Zi = lI.create, Pi = QA.create, Oi = u.create, Vi = u.strictCreate, vi = QI.create, Xi = bI.create, ji = EI.create, zi = DA.create, _i = iI.create, $i = fI.create, Ao = YA.create, Io = qA.create, go = oI.create, Bo = aI.create, Co = nA.create, Qo = sI.create, Eo = xA.create, LB = EA.create, io = aA.create, oo = wA.create, ao = EA.createWithPreprocess, so = FI.create, Do = () => QC().optional(), ho = () => EC().optional(), to = () => iC().optional(), yo = {
13196
13229
  string: (g) => gA.create({ ...g, coerce: !0 }),
13197
13230
  number: (g) => eA.create({ ...g, coerce: !0 }),
13198
13231
  boolean: (g) => gI.create({
@@ -13201,17 +13234,17 @@ const Hi = (g, A = {
13201
13234
  }),
13202
13235
  bigint: (g) => GA.create({ ...g, coerce: !0 }),
13203
13236
  date: (g) => JA.create({ ...g, coerce: !0 })
13204
- }, yo = Y;
13237
+ }, eo = d;
13205
13238
  var D = /* @__PURE__ */ Object.freeze({
13206
13239
  __proto__: null,
13207
13240
  defaultErrorMap: uA,
13208
- setErrorMap: oi,
13241
+ setErrorMap: ai,
13209
13242
  getErrorMap: MI,
13210
13243
  makeIssue: KI,
13211
- EMPTY_PATH: ai,
13244
+ EMPTY_PATH: si,
13212
13245
  addIssueToContext: F,
13213
13246
  ParseStatus: X,
13214
- INVALID: Y,
13247
+ INVALID: d,
13215
13248
  DIRTY: KA,
13216
13249
  OK: j,
13217
13250
  isAborted: Dg,
@@ -13227,7 +13260,7 @@ var D = /* @__PURE__ */ Object.freeze({
13227
13260
  ZodParsedType: S,
13228
13261
  getParsedType: tA,
13229
13262
  ZodType: K,
13230
- datetimeRegex: AC,
13263
+ datetimeRegex: gC,
13231
13264
  ZodString: gA,
13232
13265
  ZodNumber: eA,
13233
13266
  ZodBigInt: GA,
@@ -13241,7 +13274,7 @@ var D = /* @__PURE__ */ Object.freeze({
13241
13274
  ZodNever: yA,
13242
13275
  ZodVoid: lI,
13243
13276
  ZodArray: QA,
13244
- ZodObject: m,
13277
+ ZodObject: u,
13245
13278
  ZodUnion: QI,
13246
13279
  ZodDiscriminatedUnion: bI,
13247
13280
  ZodIntersection: EI,
@@ -13262,63 +13295,63 @@ var D = /* @__PURE__ */ Object.freeze({
13262
13295
  ZodDefault: DI,
13263
13296
  ZodCatch: hI,
13264
13297
  ZodNaN: pI,
13265
- BRAND: Mi,
13298
+ BRAND: Ki,
13266
13299
  ZodBranded: fg,
13267
13300
  ZodPipeline: FI,
13268
13301
  ZodReadonly: tI,
13269
- custom: gC,
13302
+ custom: CC,
13270
13303
  Schema: K,
13271
13304
  ZodSchema: K,
13272
- late: Ki,
13305
+ late: Hi,
13273
13306
  get ZodFirstPartyTypeKind() {
13274
13307
  return J;
13275
13308
  },
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,
13309
+ coerce: yo,
13310
+ any: xi,
13311
+ array: Pi,
13312
+ bigint: fi,
13313
+ boolean: iC,
13314
+ date: pi,
13315
+ discriminatedUnion: Xi,
13316
+ effect: LB,
13317
+ enum: Co,
13318
+ function: Io,
13319
+ instanceof: qi,
13320
+ intersection: ji,
13321
+ lazy: go,
13322
+ literal: Bo,
13323
+ map: $i,
13324
+ nan: li,
13325
+ nativeEnum: Qo,
13326
+ never: bi,
13327
+ null: Ti,
13328
+ nullable: oo,
13329
+ number: EC,
13330
+ object: Oi,
13331
+ oboolean: to,
13332
+ onumber: ho,
13333
+ optional: io,
13334
+ ostring: Do,
13335
+ pipeline: so,
13336
+ preprocess: ao,
13337
+ promise: Eo,
13338
+ record: _i,
13339
+ set: Ao,
13340
+ strictObject: Vi,
13341
+ string: QC,
13342
+ symbol: mi,
13343
+ transformer: LB,
13344
+ tuple: zi,
13345
+ undefined: ui,
13346
+ union: vi,
13347
+ unknown: Wi,
13348
+ void: Zi,
13349
+ NEVER: eo,
13317
13350
  ZodIssueCode: e,
13318
- quotelessJson: ii,
13351
+ quotelessJson: oi,
13319
13352
  ZodError: $
13320
13353
  });
13321
- const eo = D.object({
13354
+ const Go = D.object({
13322
13355
  /**The multiscale datasets for this image*/
13323
13356
  multiscales: D.array(
13324
13357
  D.object({
@@ -13446,7 +13479,7 @@ const eo = D.object({
13446
13479
  projection: D.string().optional()
13447
13480
  }).optional()
13448
13481
  }).optional()
13449
- }).describe("JSON from OME-NGFF .zattrs"), Go = D.object({
13482
+ }).describe("JSON from OME-NGFF .zattrs"), no = D.object({
13450
13483
  plate: D.object({
13451
13484
  /**The acquisitions for this plate*/
13452
13485
  acquisitions: D.array(
@@ -13505,7 +13538,7 @@ const eo = D.object({
13505
13538
  })
13506
13539
  ).min(1).describe("The wells of the plate")
13507
13540
  }).optional()
13508
- }).describe("JSON from OME-NGFF .zattrs"), no = D.object({
13541
+ }).describe("JSON from OME-NGFF .zattrs"), wo = D.object({
13509
13542
  well: D.object({
13510
13543
  /**The fields of view for this well*/
13511
13544
  images: D.array(
@@ -13519,7 +13552,7 @@ const eo = D.object({
13519
13552
  /**The version of the specification*/
13520
13553
  version: D.literal("0.4").describe("The version of the specification").optional()
13521
13554
  }).optional()
13522
- }).describe("JSON from OME-NGFF .zattrs"), wo = D.object({
13555
+ }).describe("JSON from OME-NGFF .zattrs"), Fo = D.object({
13523
13556
  /**The versioned OME-Zarr Metadata namespace*/
13524
13557
  ome: D.object({
13525
13558
  /**The multiscale datasets for this image*/
@@ -13649,7 +13682,7 @@ const eo = D.object({
13649
13682
  /**The version of the OME-Zarr Metadata*/
13650
13683
  version: D.literal("0.5").describe("The version of the OME-Zarr Metadata")
13651
13684
  }).describe("The versioned OME-Zarr Metadata namespace")
13652
- }).describe("The zarr.json attributes key"), Fo = D.object({
13685
+ }).describe("The zarr.json attributes key"), ro = D.object({
13653
13686
  /**The versioned OME-Zarr Metadata namespace*/
13654
13687
  ome: D.object({
13655
13688
  plate: D.object({
@@ -13711,7 +13744,7 @@ const eo = D.object({
13711
13744
  /**The version of the OME-Zarr Metadata*/
13712
13745
  version: D.literal("0.5").describe("The version of the OME-Zarr Metadata")
13713
13746
  }).describe("The versioned OME-Zarr Metadata namespace")
13714
- }).describe("The zarr.json attributes key"), ro = D.object({
13747
+ }).describe("The zarr.json attributes key"), So = D.object({
13715
13748
  /**The versioned OME-Zarr Metadata namespace*/
13716
13749
  ome: D.object({
13717
13750
  well: D.object({
@@ -13730,15 +13763,15 @@ const eo = D.object({
13730
13763
  /**The version of the OME-Zarr Metadata*/
13731
13764
  version: D.literal("0.5").describe("The version of the OME-Zarr Metadata")
13732
13765
  }).describe("The versioned OME-Zarr Metadata namespace")
13733
- }).describe("JSON from OME-Zarr zarr.json"), So = ["0.4", "0.5"], Ro = new Set(So);
13734
- function No(g) {
13766
+ }).describe("JSON from OME-Zarr zarr.json"), Ro = ["0.4", "0.5"], No = new Set(Ro);
13767
+ function co(g) {
13735
13768
  if (!("ome" in g) || !(g.ome instanceof Object)) return;
13736
13769
  const A = g.ome;
13737
- if ("version" in A && typeof A.version == "string" && Ro.has(A.version))
13770
+ if ("version" in A && typeof A.version == "string" && No.has(A.version))
13738
13771
  return A.version;
13739
13772
  }
13740
13773
  function pg(g) {
13741
- const A = No(g);
13774
+ const A = co(g);
13742
13775
  return A === void 0 ? "0.4" : A;
13743
13776
  }
13744
13777
  function WA(g) {
@@ -13750,14 +13783,14 @@ function WA(g) {
13750
13783
  return "v3";
13751
13784
  }
13752
13785
  }
13753
- function EC(g, A) {
13786
+ function oC(g, A) {
13754
13787
  const I = { ...g };
13755
13788
  return delete I[A], I;
13756
13789
  }
13757
- async function Po(g, A) {
13790
+ async function Oo(g, A) {
13758
13791
  const I = new PA(g), B = new z(I), C = WA(A), Q = await wI(B, C);
13759
13792
  try {
13760
- return co(Q.attrs);
13793
+ return Uo(Q.attrs);
13761
13794
  } catch {
13762
13795
  throw Error(
13763
13796
  `Failed to parse OME-Zarr plate:
@@ -13765,58 +13798,58 @@ ${JSON.stringify(Q.attrs)}`
13765
13798
  );
13766
13799
  }
13767
13800
  }
13768
- function co(g) {
13801
+ function Uo(g) {
13769
13802
  switch (pg(g)) {
13770
13803
  case "0.5":
13771
13804
  return {
13772
- ...Fo.parse(g).ome,
13805
+ ...ro.parse(g).ome,
13773
13806
  originalVersion: "0.5"
13774
13807
  };
13775
13808
  case "0.4":
13776
13809
  return {
13777
- ...Uo(Go.parse(g)).ome,
13810
+ ...ko(no.parse(g)).ome,
13778
13811
  originalVersion: "0.4"
13779
13812
  };
13780
13813
  }
13781
13814
  }
13782
- function Uo(g) {
13815
+ function ko(g) {
13783
13816
  if (g.plate === void 0)
13784
13817
  throw new Error("Plate metadata is missing in OME-Zarr v0.4 plate");
13785
13818
  return {
13786
13819
  ome: {
13787
- plate: EC(g.plate, "version"),
13820
+ plate: oC(g.plate, "version"),
13788
13821
  version: "0.5"
13789
13822
  }
13790
13823
  };
13791
13824
  }
13792
- function ko(g) {
13825
+ function Lo(g) {
13793
13826
  if (g.well === void 0)
13794
13827
  throw new Error("Well metadata is missing in OME-Zarr v0.4 well");
13795
13828
  return {
13796
13829
  ome: {
13797
- well: EC(g.well, "version"),
13830
+ well: oC(g.well, "version"),
13798
13831
  version: "0.5"
13799
13832
  }
13800
13833
  };
13801
13834
  }
13802
- function Lo(g) {
13835
+ function Jo(g) {
13803
13836
  switch (pg(g)) {
13804
13837
  case "0.5":
13805
13838
  return {
13806
- ...ro.parse(g).ome,
13839
+ ...So.parse(g).ome,
13807
13840
  originalVersion: "0.5"
13808
13841
  };
13809
13842
  case "0.4":
13810
13843
  return {
13811
- ...ko(no.parse(g)).ome,
13844
+ ...Lo(wo.parse(g)).ome,
13812
13845
  originalVersion: "0.4"
13813
13846
  };
13814
13847
  }
13815
13848
  }
13816
- async function Oo(g, A, I) {
13849
+ async function Vo(g, A, I) {
13817
13850
  const B = g + "/" + A, C = new PA(B), Q = new z(C), E = WA(I), i = await wI(Q, E);
13818
13851
  try {
13819
- return Lo(i.attrs);
13852
+ return Jo(i.attrs);
13820
13853
  } catch {
13821
13854
  throw Error(
13822
13855
  `Failed to parse OME-Zarr well:
@@ -13824,15 +13857,15 @@ ${JSON.stringify(i.attrs)}`
13824
13857
  );
13825
13858
  }
13826
13859
  }
13827
- async function Vo(g) {
13860
+ async function vo(g) {
13828
13861
  const A = WA(g.version), I = await wI(g.location, A);
13829
13862
  return mg(I.attrs).omero?.channels ?? [];
13830
13863
  }
13831
- async function vo(g) {
13864
+ async function Xo(g) {
13832
13865
  const A = WA(g.version), I = await wI(g.location, A);
13833
13866
  return mg(I.attrs).omero?.rdefs;
13834
13867
  }
13835
- function Jo(g) {
13868
+ function Yo(g) {
13836
13869
  return {
13837
13870
  ome: {
13838
13871
  multiscales: g.multiscales,
@@ -13841,23 +13874,23 @@ function Jo(g) {
13841
13874
  }
13842
13875
  };
13843
13876
  }
13844
- function Yo(g) {
13877
+ function Mo(g) {
13845
13878
  switch (pg(g)) {
13846
13879
  case "0.5":
13847
13880
  return {
13848
- ...wo.parse(g).ome,
13881
+ ...Fo.parse(g).ome,
13849
13882
  originalVersion: "0.5"
13850
13883
  };
13851
13884
  case "0.4":
13852
13885
  return {
13853
- ...Jo(eo.parse(g)).ome,
13886
+ ...Yo(Go.parse(g)).ome,
13854
13887
  originalVersion: "0.4"
13855
13888
  };
13856
13889
  }
13857
13890
  }
13858
13891
  function mg(g) {
13859
13892
  try {
13860
- return Yo(g);
13893
+ return Mo(g);
13861
13894
  } catch {
13862
13895
  throw Error(`Failed to parse OME-Zarr image:
13863
13896
  ${JSON.stringify(g)}`);
@@ -13881,15 +13914,15 @@ class NI {
13881
13914
  throw new Error("No datasets found in the multiscale image.");
13882
13915
  A || (A = WA(B.originalVersion));
13883
13916
  const E = Q.datasets.map(
13884
- (s) => vE(this.location, s.path, A)
13917
+ (s) => XE(this.location, s.path, A)
13885
13918
  ), i = await Promise.all(
13886
- E.map((s) => VE(s))
13919
+ E.map((s) => vE(s))
13887
13920
  ), o = i[0].shape, a = Q.axes;
13888
13921
  if (a.length !== o.length)
13889
13922
  throw new Error(
13890
13923
  `Mismatch between number of axes (${a.length}) and array shape (${o.length})`
13891
13924
  );
13892
- return new Qi({
13925
+ return new Ei({
13893
13926
  metadata: Q,
13894
13927
  arrays: i,
13895
13928
  arrayParams: E
@@ -13942,7 +13975,7 @@ class NI {
13942
13975
  });
13943
13976
  }
13944
13977
  }
13945
- const iC = [
13978
+ const aC = [
13946
13979
  "fallbackVisible",
13947
13980
  "prefetchTime",
13948
13981
  "visibleCurrent",
@@ -13950,14 +13983,14 @@ const iC = [
13950
13983
  "prefetchSpace"
13951
13984
  ];
13952
13985
  function ug(g) {
13953
- Mo(g);
13986
+ Ko(g);
13954
13987
  const A = {
13955
13988
  x: g.prefetch.x,
13956
13989
  y: g.prefetch.y,
13957
13990
  z: g.prefetch.z ?? 0,
13958
13991
  t: g.prefetch.t ?? 0
13959
13992
  }, I = Object.freeze(
13960
- iC.reduce(
13993
+ aC.reduce(
13961
13994
  (Q, E) => {
13962
13995
  const i = g.priorityOrder.indexOf(E);
13963
13996
  return Q[E] = i, Q;
@@ -13977,7 +14010,7 @@ function ug(g) {
13977
14010
  };
13978
14011
  return Object.freeze(C);
13979
14012
  }
13980
- function Xo(g = {}) {
14013
+ function jo(g = {}) {
13981
14014
  return ug(Tg({
13982
14015
  profile: "exploration",
13983
14016
  prefetch: { x: 1, y: 1, z: 1, t: 0 },
@@ -13990,7 +14023,7 @@ function Xo(g = {}) {
13990
14023
  ]
13991
14024
  }, g));
13992
14025
  }
13993
- function jo(g = {}) {
14026
+ function zo(g = {}) {
13994
14027
  return ug(Tg({
13995
14028
  profile: "playback",
13996
14029
  prefetch: { x: 0, y: 0, z: 0, t: 20 },
@@ -14003,7 +14036,7 @@ function jo(g = {}) {
14003
14036
  ]
14004
14037
  }, g));
14005
14038
  }
14006
- function zo(g = {}) {
14039
+ function _o(g = {}) {
14007
14040
  return ug(Tg({
14008
14041
  profile: "no-prefetch",
14009
14042
  prefetch: { x: 0, y: 0, z: 0, t: 0 },
@@ -14016,7 +14049,7 @@ function zo(g = {}) {
14016
14049
  ]
14017
14050
  }, g));
14018
14051
  }
14019
- function Mo(g) {
14052
+ function Ko(g) {
14020
14053
  for (const [B, C] of Object.entries(g.prefetch))
14021
14054
  if (C !== void 0 && C < 0)
14022
14055
  throw new Error(`prefetch.${B} must be a non-negative number`);
@@ -14024,7 +14057,7 @@ function Mo(g) {
14024
14057
  if (A?.min !== void 0 && A?.max !== void 0 && A.min > A.max)
14025
14058
  throw new Error("lod.min must be <= lod.max");
14026
14059
  const I = g.priorityOrder;
14027
- if (I.length !== iC.length || new Set(I).size !== I.length)
14060
+ if (I.length !== aC.length || new Set(I).size !== I.length)
14028
14061
  throw new Error("priorityOrder must include all categories exactly once");
14029
14062
  }
14030
14063
  function Tg(g, A = {}) {
@@ -14035,7 +14068,7 @@ function Tg(g, A = {}) {
14035
14068
  priorityOrder: A.priorityOrder ?? g.priorityOrder
14036
14069
  };
14037
14070
  }
14038
- class _o extends ZA {
14071
+ class $o extends ZA {
14039
14072
  atlas_;
14040
14073
  constructor(A, I) {
14041
14074
  super(), this.programName = "points", this.atlas_ = I, A.forEach((Q) => {
@@ -14079,41 +14112,42 @@ class _o extends ZA {
14079
14112
  }
14080
14113
  }
14081
14114
  export {
14082
- po as AxesLayer,
14115
+ mo as AxesLayer,
14083
14116
  AA as Box2,
14084
14117
  RA as Box3,
14085
- pB as ChunkedImageLayer,
14118
+ uB as ChunkedImageLayer,
14086
14119
  l as Color,
14087
- SQ as Frustum,
14088
- Ko as Idetik,
14089
- xo as ImageLayer,
14090
- bo as ImageSeriesLayer,
14091
- Wo as LabelImageLayer,
14120
+ RQ as Frustum,
14121
+ Ho as Idetik,
14122
+ Wo as ImageLayer,
14123
+ Zo as ImageSeriesLayer,
14124
+ bo as LabelImageLayer,
14092
14125
  FA as Layer,
14093
- sQ as LayerManager,
14126
+ hQ as LayerManager,
14094
14127
  NI as OmeZarrImageSource,
14095
- fo as OrbitControls,
14096
- Ho as OrthographicCamera,
14097
- lo as PanZoomControls,
14098
- qo as PerspectiveCamera,
14128
+ po as OrbitControls,
14129
+ qo as OrthographicCamera,
14130
+ fo as PanZoomControls,
14131
+ lo as PerspectiveCamera,
14099
14132
  dA as Plane,
14100
- _o as Points,
14101
- mo as ProjectedLineLayer,
14102
- IB as Spherical,
14133
+ $o as Points,
14134
+ uo as ProjectedLineLayer,
14135
+ gB as Spherical,
14103
14136
  yI as Texture2DArray,
14104
14137
  jA as Texture3D,
14105
- uo as TracksLayer,
14106
- yQ as Viewport,
14107
- To as VolumeLayer,
14108
- gQ as WebGLRenderer,
14109
- Xo as createExplorationPolicy,
14138
+ To as TracksLayer,
14139
+ GQ as Viewport,
14140
+ xo as VolumeLayer,
14141
+ CQ as WebGLRenderer,
14142
+ jo as createExplorationPolicy,
14110
14143
  ug as createImageSourcePolicy,
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
14144
+ _o as createNoPrefetchPolicy,
14145
+ zo as createPlaybackPolicy,
14146
+ Oo as loadOmeZarrPlate,
14147
+ Vo as loadOmeZarrWell,
14148
+ vo as loadOmeroChannels,
14149
+ Xo as loadOmeroDefaults,
14150
+ _g as parseViewportConfigs,
14151
+ qB as validateNewViewport
14118
14152
  };
14119
14153
  //# sourceMappingURL=index.js.map