@idetik/core 0.1.1 → 0.2.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
@@ -527,25 +527,25 @@ function AQ() {
527
527
  }
528
528
  return "development";
529
529
  }
530
- class N {
530
+ class c {
531
531
  static logLevel_ = AQ() === "production" ? "warn" : "debug";
532
532
  static setLogLevel(A) {
533
- N.logLevel_ = A;
533
+ c.logLevel_ = A;
534
534
  }
535
535
  static debug(A, I, ...B) {
536
- N.log("debug", A, I, ...B);
536
+ c.log("debug", A, I, ...B);
537
537
  }
538
538
  static info(A, I, ...B) {
539
- N.log("info", A, I, ...B);
539
+ c.log("info", A, I, ...B);
540
540
  }
541
541
  static warn(A, I, ...B) {
542
- N.log("warn", A, I, ...B);
542
+ c.log("warn", A, I, ...B);
543
543
  }
544
544
  static error(A, I, ...B) {
545
- N.log("error", A, I, ...B);
545
+ c.log("error", A, I, ...B);
546
546
  }
547
547
  static log(A, I, B, ...Q) {
548
- if (Mg[A] < Mg[N.logLevel_]) return;
548
+ if (Mg[A] < Mg[c.logLevel_]) return;
549
549
  const C = (/* @__PURE__ */ new Date()).toISOString(), E = $B[A], i = `[${C}][${A.toUpperCase()}][${I}]`, o = [`${E}${i}`, B, ...Q];
550
550
  switch (A) {
551
551
  case "debug":
@@ -641,7 +641,7 @@ class IQ {
641
641
  `Unsupported uniform type "${B.type}" (GLenum) found in shader program for uniform "${B.name}"`
642
642
  );
643
643
  const Q = this.gl_.getUniformLocation(this.program_, B.name);
644
- Q && (this.uniformInfo_.set(B.name, [Q, B]), N.debug(
644
+ Q && (this.uniformInfo_.set(B.name, [Q, B]), c.debug(
645
645
  "WebGLShaderProgram",
646
646
  "Uniform found:",
647
647
  B.name,
@@ -742,7 +742,7 @@ function Kg(g, A) {
742
742
  ${Q}`;
743
743
  return g.replace(uI, C);
744
744
  }
745
- const Z = [
745
+ const W = [
746
746
  "00",
747
747
  "01",
748
748
  "02",
@@ -1002,12 +1002,12 @@ const Z = [
1002
1002
  ];
1003
1003
  function DB() {
1004
1004
  const g = Math.random() * 4294967295 | 0, A = Math.random() * 4294967295 | 0, I = Math.random() * 4294967295 | 0, B = Math.random() * 4294967295 | 0;
1005
- return (Z[g & 255] + Z[g >> 8 & 255] + Z[g >> 16 & 255] + Z[g >> 24 & 255] + "-" + Z[A & 255] + Z[A >> 8 & 255] + "-" + Z[A >> 16 & 15 | 64] + Z[A >> 24 & 255] + "-" + Z[I & 63 | 128] + Z[I >> 8 & 255] + "-" + Z[I >> 16 & 255] + Z[I >> 24 & 255] + Z[B & 255] + Z[B >> 8 & 255] + Z[B >> 16 & 255] + Z[B >> 24 & 255]).toLowerCase();
1005
+ return (W[g & 255] + W[g >> 8 & 255] + W[g >> 16 & 255] + W[g >> 24 & 255] + "-" + W[A & 255] + W[A >> 8 & 255] + "-" + W[A >> 16 & 15 | 64] + W[A >> 24 & 255] + "-" + W[I & 63 | 128] + W[I >> 8 & 255] + "-" + W[I >> 16 & 255] + W[I >> 24 & 255] + W[B & 255] + W[B >> 8 & 255] + W[B >> 16 & 255] + W[B >> 24 & 255]).toLowerCase();
1006
1006
  }
1007
1007
  class Eg {
1008
1008
  uuid = DB();
1009
1009
  }
1010
- var rA = 1e-6, x = typeof Float32Array < "u" ? Float32Array : Array, CQ = Math.PI / 180;
1010
+ var rA = 1e-6, T = typeof Float32Array < "u" ? Float32Array : Array, CQ = Math.PI / 180;
1011
1011
  function EQ(g) {
1012
1012
  return g * CQ;
1013
1013
  }
@@ -1017,30 +1017,30 @@ Math.hypot || (Math.hypot = function() {
1017
1017
  return Math.sqrt(g);
1018
1018
  });
1019
1019
  function sB() {
1020
- var g = new x(9);
1021
- return x != 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;
1020
+ var g = new T(9);
1021
+ return T != 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;
1022
1022
  }
1023
1023
  function iQ(g, A) {
1024
1024
  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;
1025
1025
  }
1026
1026
  function AA() {
1027
- var g = new x(16);
1028
- return x != 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;
1027
+ var g = new T(16);
1028
+ return T != 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;
1029
1029
  }
1030
1030
  function ig(g, A) {
1031
- var I = A[0], B = A[1], Q = A[2], C = A[3], E = A[4], i = A[5], o = A[6], a = A[7], D = A[8], h = A[9], y = A[10], G = A[11], R = A[12], S = A[13], e = A[14], n = A[15], M = I * i - B * E, k = I * o - Q * E, J = I * a - C * E, K = B * o - Q * i, c = B * a - C * i, b = Q * a - C * o, m = D * S - h * R, v = D * e - y * R, u = D * n - G * R, O = h * e - y * S, wA = h * n - G * S, FA = y * n - G * e, T = M * FA - k * wA + J * O + K * u - c * v + b * m;
1032
- return T ? (T = 1 / T, g[0] = (i * FA - o * wA + a * O) * T, g[1] = (Q * wA - B * FA - C * O) * T, g[2] = (S * b - e * c + n * K) * T, g[3] = (y * c - h * b - G * K) * T, g[4] = (o * u - E * FA - a * v) * T, g[5] = (I * FA - Q * u + C * v) * T, g[6] = (e * J - R * b - n * k) * T, g[7] = (D * b - y * J + G * k) * T, g[8] = (E * wA - i * u + a * m) * T, g[9] = (B * u - I * wA - C * m) * T, g[10] = (R * c - S * J + n * M) * T, g[11] = (h * J - D * c - G * M) * T, g[12] = (i * v - E * O - o * m) * T, g[13] = (I * O - B * v + Q * m) * T, g[14] = (S * k - R * K - e * M) * T, g[15] = (D * K - h * k + y * M) * T, g) : null;
1031
+ var I = A[0], B = A[1], Q = A[2], C = A[3], E = A[4], i = A[5], o = A[6], a = A[7], D = A[8], h = A[9], y = A[10], G = A[11], S = A[12], R = A[13], e = A[14], F = A[15], M = I * i - B * E, N = I * o - Q * E, K = I * a - C * E, J = B * o - Q * i, L = B * a - C * i, O = Q * a - C * o, V = D * R - h * S, X = D * e - y * S, b = D * F - G * S, Z = h * e - y * R, wA = h * F - G * R, FA = y * F - G * e, m = M * FA - N * wA + K * Z + J * b - L * X + O * V;
1032
+ return m ? (m = 1 / m, g[0] = (i * FA - o * wA + a * Z) * m, g[1] = (Q * wA - B * FA - C * Z) * m, g[2] = (R * O - e * L + F * J) * m, g[3] = (y * L - h * O - G * J) * m, g[4] = (o * b - E * FA - a * X) * m, g[5] = (I * FA - Q * b + C * X) * m, g[6] = (e * K - S * O - F * N) * m, g[7] = (D * O - y * K + G * N) * m, g[8] = (E * wA - i * b + a * V) * m, g[9] = (B * b - I * wA - C * V) * m, g[10] = (S * L - R * K + F * M) * m, g[11] = (h * K - D * L - G * M) * m, g[12] = (i * X - E * Z - o * V) * m, g[13] = (I * Z - B * X + Q * V) * m, g[14] = (R * N - S * J - e * M) * m, g[15] = (D * J - h * N + y * M) * m, g) : null;
1033
1033
  }
1034
1034
  function FI(g, A, I) {
1035
- var B = A[0], Q = A[1], C = A[2], E = A[3], i = A[4], o = A[5], a = A[6], D = A[7], h = A[8], y = A[9], G = A[10], R = A[11], S = A[12], e = A[13], n = A[14], M = A[15], k = I[0], J = I[1], K = I[2], c = I[3];
1036
- return g[0] = k * B + J * i + K * h + c * S, g[1] = k * Q + J * o + K * y + c * e, g[2] = k * C + J * a + K * G + c * n, g[3] = k * E + J * D + K * R + c * M, k = I[4], J = I[5], K = I[6], c = I[7], g[4] = k * B + J * i + K * h + c * S, g[5] = k * Q + J * o + K * y + c * e, g[6] = k * C + J * a + K * G + c * n, g[7] = k * E + J * D + K * R + c * M, k = I[8], J = I[9], K = I[10], c = I[11], g[8] = k * B + J * i + K * h + c * S, g[9] = k * Q + J * o + K * y + c * e, g[10] = k * C + J * a + K * G + c * n, g[11] = k * E + J * D + K * R + c * M, k = I[12], J = I[13], K = I[14], c = I[15], g[12] = k * B + J * i + K * h + c * S, g[13] = k * Q + J * o + K * y + c * e, g[14] = k * C + J * a + K * G + c * n, g[15] = k * E + J * D + K * R + c * M, g;
1035
+ var B = A[0], Q = A[1], C = A[2], E = A[3], i = A[4], o = A[5], a = A[6], D = A[7], h = A[8], y = A[9], G = A[10], S = A[11], R = A[12], e = A[13], F = A[14], M = A[15], N = I[0], K = I[1], J = I[2], L = I[3];
1036
+ return g[0] = N * B + K * i + J * h + L * R, g[1] = N * Q + K * o + J * y + L * e, g[2] = N * C + K * a + J * G + L * F, g[3] = N * E + K * D + J * S + L * M, N = I[4], K = I[5], J = I[6], L = I[7], g[4] = N * B + K * i + J * h + L * R, g[5] = N * Q + K * o + J * y + L * e, g[6] = N * C + K * a + J * G + L * F, g[7] = N * E + K * D + J * S + L * M, N = I[8], K = I[9], J = I[10], L = I[11], g[8] = N * B + K * i + J * h + L * R, g[9] = N * Q + K * o + J * y + L * e, g[10] = N * C + K * a + J * G + L * F, g[11] = N * E + K * D + J * S + L * M, N = I[12], K = I[13], J = I[14], L = I[15], g[12] = N * B + K * i + J * h + L * R, g[13] = N * Q + K * o + J * y + L * e, g[14] = N * C + K * a + J * G + L * F, g[15] = N * E + K * D + J * S + L * M, g;
1037
1037
  }
1038
1038
  function oQ(g, A) {
1039
1039
  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;
1040
1040
  }
1041
1041
  function aQ(g, A, I, B) {
1042
- var Q = A[0], C = A[1], E = A[2], i = A[3], o = Q + Q, a = C + C, D = E + E, h = Q * o, y = Q * a, G = Q * D, R = C * a, S = C * D, e = E * D, n = i * o, M = i * a, k = i * D, J = B[0], K = B[1], c = B[2];
1043
- return g[0] = (1 - (R + e)) * J, g[1] = (y + k) * J, g[2] = (G - M) * J, g[3] = 0, g[4] = (y - k) * K, g[5] = (1 - (h + e)) * K, g[6] = (S + n) * K, g[7] = 0, g[8] = (G + M) * c, g[9] = (S - n) * c, g[10] = (1 - (h + R)) * c, g[11] = 0, g[12] = I[0], g[13] = I[1], g[14] = I[2], g[15] = 1, g;
1042
+ var Q = A[0], C = A[1], E = A[2], i = A[3], o = Q + Q, a = C + C, D = E + E, h = Q * o, y = Q * a, G = Q * D, S = C * a, R = C * D, e = E * D, F = i * o, M = i * a, N = i * D, K = B[0], J = B[1], L = B[2];
1043
+ return g[0] = (1 - (S + e)) * K, g[1] = (y + N) * K, g[2] = (G - M) * K, g[3] = 0, g[4] = (y - N) * J, g[5] = (1 - (h + e)) * J, g[6] = (R + F) * J, g[7] = 0, g[8] = (G + M) * L, g[9] = (R - F) * L, g[10] = (1 - (h + S)) * L, g[11] = 0, g[12] = I[0], g[13] = I[1], g[14] = I[2], g[15] = 1, g;
1044
1044
  }
1045
1045
  function DQ(g, A, I, B, Q) {
1046
1046
  var C = 1 / Math.tan(A / 2), E;
@@ -1055,15 +1055,15 @@ var yQ = hQ;
1055
1055
  function tQ(g, A, I, B) {
1056
1056
  var Q = A[0], C = A[1], E = A[2], i = B[0], o = B[1], a = B[2], D = Q - I[0], h = C - I[1], y = E - I[2], G = D * D + h * h + y * y;
1057
1057
  G > 0 && (G = 1 / Math.sqrt(G), D *= G, h *= G, y *= G);
1058
- var R = o * y - a * h, S = a * D - i * y, e = i * h - o * D;
1059
- return G = R * R + S * S + e * e, G > 0 && (G = 1 / Math.sqrt(G), R *= G, S *= G, e *= G), g[0] = R, g[1] = S, g[2] = e, g[3] = 0, g[4] = h * e - y * S, g[5] = y * R - D * e, g[6] = D * S - h * R, g[7] = 0, g[8] = D, g[9] = h, g[10] = y, g[11] = 0, g[12] = Q, g[13] = C, g[14] = E, g[15] = 1, g;
1058
+ var S = o * y - a * h, R = a * D - i * y, e = i * h - o * D;
1059
+ return G = S * S + R * R + e * e, G > 0 && (G = 1 / Math.sqrt(G), S *= G, R *= G, e *= G), g[0] = S, g[1] = R, g[2] = e, g[3] = 0, g[4] = h * e - y * R, g[5] = y * S - D * e, g[6] = D * R - h * S, g[7] = 0, g[8] = D, g[9] = h, g[10] = y, g[11] = 0, g[12] = Q, g[13] = C, g[14] = E, g[15] = 1, g;
1060
1060
  }
1061
1061
  function p() {
1062
- var g = new x(3);
1063
- return x != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0), g;
1062
+ var g = new T(3);
1063
+ return T != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0), g;
1064
1064
  }
1065
1065
  function IA(g) {
1066
- var A = new x(3);
1066
+ var A = new T(3);
1067
1067
  return A[0] = g[0], A[1] = g[1], A[2] = g[2], A;
1068
1068
  }
1069
1069
  function hB(g) {
@@ -1071,7 +1071,7 @@ function hB(g) {
1071
1071
  return Math.hypot(A, I, B);
1072
1072
  }
1073
1073
  function q(g, A, I) {
1074
- var B = new x(3);
1074
+ var B = new T(3);
1075
1075
  return B[0] = g, B[1] = A, B[2] = I, B;
1076
1076
  }
1077
1077
  function bA(g, A) {
@@ -1133,15 +1133,15 @@ var VI = GQ, rQ = hB;
1133
1133
  };
1134
1134
  })();
1135
1135
  function PA() {
1136
- var g = new x(4);
1137
- return x != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0, g[3] = 0), g;
1136
+ var g = new T(4);
1137
+ return T != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0, g[3] = 0), g;
1138
1138
  }
1139
1139
  function SQ(g) {
1140
- var A = new x(4);
1140
+ var A = new T(4);
1141
1141
  return A[0] = g[0], A[1] = g[1], A[2] = g[2], A[3] = g[3], A;
1142
1142
  }
1143
1143
  function vI(g, A, I, B) {
1144
- var Q = new x(4);
1144
+ var Q = new T(4);
1145
1145
  return Q[0] = g, Q[1] = A, Q[2] = I, Q[3] = B, Q;
1146
1146
  }
1147
1147
  function RQ(g, A) {
@@ -1168,8 +1168,8 @@ function nI(g, A, I) {
1168
1168
  };
1169
1169
  })();
1170
1170
  function XI() {
1171
- var g = new x(4);
1172
- return x != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0), g[3] = 1, g;
1171
+ var g = new T(4);
1172
+ return T != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0), g[3] = 1, g;
1173
1173
  }
1174
1174
  function UQ(g, A, I) {
1175
1175
  I = I * 0.5;
@@ -1181,8 +1181,8 @@ function kQ(g, A, I) {
1181
1181
  return g[0] = B * D + E * i + Q * a - C * o, g[1] = Q * D + E * o + C * i - B * a, g[2] = C * D + E * a + B * o - Q * i, g[3] = E * D - B * i - Q * o - C * a, g;
1182
1182
  }
1183
1183
  function WI(g, A, I, B) {
1184
- var Q = A[0], C = A[1], E = A[2], i = A[3], o = I[0], a = I[1], D = I[2], h = I[3], y, G, R, S, e;
1185
- return G = Q * o + C * a + E * D + i * h, G < 0 && (G = -G, o = -o, a = -a, D = -D, h = -h), 1 - G > rA ? (y = Math.acos(G), R = Math.sin(y), S = Math.sin((1 - B) * y) / R, e = Math.sin(B * y) / R) : (S = 1 - B, e = B), g[0] = S * Q + e * o, g[1] = S * C + e * a, g[2] = S * E + e * D, g[3] = S * i + e * h, g;
1184
+ var Q = A[0], C = A[1], E = A[2], i = A[3], o = I[0], a = I[1], D = I[2], h = I[3], y, G, S, R, e;
1185
+ return G = Q * o + C * a + E * D + i * h, G < 0 && (G = -G, o = -o, a = -a, D = -D, h = -h), 1 - G > rA ? (y = Math.acos(G), S = Math.sin(y), R = Math.sin((1 - B) * y) / S, e = Math.sin(B * y) / S) : (R = 1 - B, e = B), g[0] = R * Q + e * o, g[1] = R * C + e * a, g[2] = R * E + e * D, g[3] = R * i + e * h, g;
1186
1186
  }
1187
1187
  function wB(g, A) {
1188
1188
  var I = A[0] + A[4] + A[8], B;
@@ -1217,15 +1217,15 @@ var LQ = SQ, JQ = RQ, og = cQ;
1217
1217
  };
1218
1218
  })();
1219
1219
  function FB() {
1220
- var g = new x(2);
1221
- return x != Float32Array && (g[0] = 0, g[1] = 0), g;
1220
+ var g = new T(2);
1221
+ return T != Float32Array && (g[0] = 0, g[1] = 0), g;
1222
1222
  }
1223
1223
  function qg(g) {
1224
- var A = new x(2);
1224
+ var A = new T(2);
1225
1225
  return A[0] = g[0], A[1] = g[1], A;
1226
1226
  }
1227
- function W(g, A) {
1228
- var I = new x(2);
1227
+ function u(g, A) {
1228
+ var I = new T(2);
1229
1229
  return I[0] = g, I[1] = A, I;
1230
1230
  }
1231
1231
  function YQ(g, A) {
@@ -1531,7 +1531,7 @@ class qQ {
1531
1531
  getFilter(A, I) {
1532
1532
  const { dataFormat: B, dataType: Q } = I;
1533
1533
  if (B === "scalar" && Q !== "float" && A !== "nearest")
1534
- return N.warn(
1534
+ return c.warn(
1535
1535
  "WebGLTexture",
1536
1536
  "Integer values are not filterable. Using gl.NEAREST instead."
1537
1537
  ), this.gl_.NEAREST;
@@ -1671,7 +1671,7 @@ class j {
1671
1671
  * the first element, and avoids biasing toward (0,0).
1672
1672
  */
1673
1673
  constructor(A, I) {
1674
- this.min = A ? qg(A) : W(1 / 0, 1 / 0), this.max = I ? qg(I) : W(-1 / 0, -1 / 0);
1674
+ this.min = A ? qg(A) : u(1 / 0, 1 / 0), this.max = I ? qg(I) : u(-1 / 0, -1 / 0);
1675
1675
  }
1676
1676
  clone() {
1677
1677
  return new j(this.min, this.max);
@@ -1688,8 +1688,8 @@ class j {
1688
1688
  }
1689
1689
  floor() {
1690
1690
  return new j(
1691
- W(Math.floor(this.min[0]), Math.floor(this.min[1])),
1692
- W(Math.floor(this.max[0]), Math.floor(this.max[1]))
1691
+ u(Math.floor(this.min[0]), Math.floor(this.min[1])),
1692
+ u(Math.floor(this.max[0]), Math.floor(this.max[1]))
1693
1693
  );
1694
1694
  }
1695
1695
  toRect() {
@@ -1805,22 +1805,22 @@ class pQ extends ZB {
1805
1805
  antialias: !0
1806
1806
  }), !this.gl_)
1807
1807
  throw new Error("Failed to initialize WebGL2 context");
1808
- N.info(
1808
+ c.info(
1809
1809
  "WebGLRenderer",
1810
1810
  `WebGL version ${this.gl.getParameter(this.gl.VERSION)}`
1811
1811
  ), this.programs_ = new QQ(this.gl), this.bindings_ = new HQ(this.gl), this.textures_ = new qQ(this.gl), this.state_ = new lQ(this.gl), this.resize(this.canvas.width, this.canvas.height);
1812
1812
  }
1813
1813
  render(A) {
1814
1814
  const I = A.getBoxRelativeTo(this.canvas), B = new j(
1815
- W(0, 0),
1816
- W(this.width, this.height)
1815
+ u(0, 0),
1816
+ u(this.width, this.height)
1817
1817
  );
1818
1818
  if (j.equals(I.floor(), B.floor()))
1819
1819
  this.state_.setScissorTest(!1);
1820
1820
  else if (j.intersects(I, B))
1821
1821
  this.state_.setScissor(I), this.state_.setScissorTest(!0);
1822
1822
  else {
1823
- N.warn(
1823
+ c.warn(
1824
1824
  "WebGLRenderer",
1825
1825
  `Viewport ${A.id} is entirely outside canvas bounds, skipping render`
1826
1826
  );
@@ -1829,12 +1829,12 @@ class pQ extends ZB {
1829
1829
  this.state_.setViewport(I), this.renderedObjectsPerFrame_ = 0, this.clear();
1830
1830
  const { opaque: Q, transparent: C } = A.layerManager.partitionLayers();
1831
1831
  this.state_.setDepthMask(!0);
1832
- const E = A.camera.frustum;
1833
- for (const i of Q)
1834
- i.update(), i.state === "ready" && this.renderLayer(i, A.camera, E);
1832
+ const E = A.camera.frustum, i = { viewport: A };
1833
+ for (const o of Q)
1834
+ o.update(i), o.state === "ready" && this.renderLayer(o, A.camera, E);
1835
1835
  this.state_.setDepthMask(!1);
1836
- for (const i of C)
1837
- i.update(), i.state === "ready" && this.renderLayer(i, A.camera, E);
1836
+ for (const o of C)
1837
+ o.update(i), o.state === "ready" && this.renderLayer(o, A.camera, E);
1838
1838
  this.state_.setDepthMask(!0), this.renderedObjects_ = this.renderedObjectsPerFrame_;
1839
1839
  }
1840
1840
  get textureInfo() {
@@ -1911,8 +1911,8 @@ class pQ extends ZB {
1911
1911
  }
1912
1912
  resize(A, I) {
1913
1913
  const B = new j(
1914
- W(0, 0),
1915
- W(A, I)
1914
+ u(0, 0),
1915
+ u(A, I)
1916
1916
  );
1917
1917
  this.state_.setViewport(B);
1918
1918
  }
@@ -1940,11 +1940,11 @@ class uQ {
1940
1940
  cancel(A) {
1941
1941
  const I = this.pending_.findIndex((Q) => Q.chunk === A);
1942
1942
  if (I >= 0) {
1943
- this.pending_.splice(I, 1), N.debug("ChunkQueue", "Cancelled pending request");
1943
+ this.pending_.splice(I, 1), c.debug("ChunkQueue", "Cancelled pending request");
1944
1944
  return;
1945
1945
  }
1946
1946
  const B = this.running_.get(A);
1947
- B && (B.controller.abort(), N.debug("ChunkQueue", "Cancelled fetch request"));
1947
+ B && (B.controller.abort(), c.debug("ChunkQueue", "Cancelled fetch request"));
1948
1948
  }
1949
1949
  get pendingCount() {
1950
1950
  return this.pending_.length;
@@ -1968,7 +1968,7 @@ class uQ {
1968
1968
  I.state === "loading" && (I.state = "loaded");
1969
1969
  },
1970
1970
  (E) => {
1971
- I.state === "loading" && (I.state = "unloaded"), E.name !== "AbortError" && N.error("ChunkQueue", String(E));
1971
+ I.state === "loading" && (I.state = "unloaded"), E.name !== "AbortError" && c.error("ChunkQueue", String(E));
1972
1972
  }
1973
1973
  ).finally(() => {
1974
1974
  this.running_.delete(I), this.pump();
@@ -1989,7 +1989,7 @@ function pg(g) {
1989
1989
  if (fg.some((I) => g instanceof I))
1990
1990
  return !0;
1991
1991
  const A = fg.map((I) => I.name);
1992
- return N.debug(
1992
+ return c.debug(
1993
1993
  "Chunk",
1994
1994
  `Unsupported chunk data type: ${g}. Supported data types: ${A}`
1995
1995
  ), !1;
@@ -2000,98 +2000,63 @@ function TQ(g, A) {
2000
2000
  function jI(g, A, I = 1e-6) {
2001
2001
  return Math.abs(g - A) <= I;
2002
2002
  }
2003
- function OA(g, A, I) {
2004
- return Math.max(A, Math.min(I, g));
2005
- }
2006
- const nB = Symbol("INTERNAL_POLICY_KEY");
2007
2003
  class WQ {
2008
2004
  chunks_;
2009
2005
  loader_;
2010
2006
  lowestResLOD_;
2011
- sliceCoords_;
2012
2007
  dimensions_;
2013
- tIndicesWithQueuedChunks_ = /* @__PURE__ */ new Set();
2014
- sourceMaxSquareDistance2D_;
2015
- policy_;
2016
- policyChanged_ = !1;
2017
- currentLOD_ = 0;
2018
- lastViewBounds2D_ = null;
2019
- lastZBounds_;
2020
- lastTCoord_;
2021
- constructor(A, I, B) {
2022
- this.loader_ = A, this.policy_ = B, this.dimensions_ = this.loader_.getSourceDimensionMap(), this.lowestResLOD_ = this.dimensions_.numLods - 1, this.currentLOD_ = 0, this.sliceCoords_ = I, N.info(
2023
- "ChunkManagerSource",
2024
- "Using image source policy:",
2025
- this.policy_.profile
2026
- ), this.validateXYScaleRatios();
2027
- const { size: Q } = this.getAndValidateTimeDimension(), { size: C } = this.getAndValidateChannelDimension(), E = this.dimensions_.x.lods[0], i = this.dimensions_.y.lods[0];
2028
- this.sourceMaxSquareDistance2D_ = MQ(
2029
- W(E.size * E.scale, i.size * i.scale)
2030
- ), this.chunks_ = Array.from({ length: Q }, () => []);
2031
- for (let o = 0; o < Q; ++o) {
2032
- const a = this.chunks_[o];
2033
- for (let D = 0; D < this.dimensions_.numLods; ++D) {
2034
- const h = this.dimensions_.x.lods[D], y = this.dimensions_.y.lods[D], G = this.dimensions_.z?.lods[D], R = h.chunkSize, S = y.chunkSize, e = G?.chunkSize ?? 1, n = Math.ceil(h.size / R), M = Math.ceil(y.size / S), k = Math.ceil((G?.size ?? 1) / e);
2035
- for (let J = 0; J < n; ++J) {
2036
- const K = h.translation + J * h.chunkSize * h.scale;
2037
- for (let c = 0; c < M; ++c) {
2038
- const b = y.translation + c * y.chunkSize * y.scale;
2039
- for (let m = 0; m < k; ++m) {
2040
- const v = G !== void 0 ? G.translation + m * e * G.scale : 0;
2041
- for (let u = 0; u < C; ++u)
2042
- a.push({
2008
+ constructor(A) {
2009
+ this.loader_ = A, this.dimensions_ = this.loader_.getSourceDimensionMap(), this.lowestResLOD_ = this.dimensions_.numLods - 1, this.validateXYScaleRatios();
2010
+ const { size: I } = this.getAndValidateTimeDimension(), { size: B } = this.getAndValidateChannelDimension();
2011
+ this.chunks_ = Array.from({ length: I }, () => []);
2012
+ for (let Q = 0; Q < I; ++Q) {
2013
+ const C = this.chunks_[Q];
2014
+ for (let E = 0; E < this.dimensions_.numLods; ++E) {
2015
+ const i = this.dimensions_.x.lods[E], o = this.dimensions_.y.lods[E], a = this.dimensions_.z?.lods[E], D = i.chunkSize, h = o.chunkSize, y = a?.chunkSize ?? 1, G = Math.ceil(i.size / D), S = Math.ceil(o.size / h), R = Math.ceil((a?.size ?? 1) / y);
2016
+ for (let e = 0; e < B; ++e)
2017
+ for (let F = 0; F < G; ++F) {
2018
+ const M = i.translation + F * i.chunkSize * i.scale;
2019
+ for (let N = 0; N < S; ++N) {
2020
+ const K = o.translation + N * o.chunkSize * o.scale;
2021
+ for (let J = 0; J < R; ++J) {
2022
+ const L = a !== void 0 ? a.translation + J * y * a.scale : 0;
2023
+ C.push({
2043
2024
  state: "unloaded",
2044
- lod: D,
2025
+ lod: E,
2045
2026
  visible: !1,
2046
2027
  prefetch: !1,
2047
2028
  priority: null,
2048
2029
  orderKey: null,
2049
2030
  shape: {
2050
- x: Math.min(R, h.size - J * R),
2051
- y: Math.min(S, y.size - c * S),
2052
- z: Math.min(e, (G?.size ?? 1) - m * e),
2031
+ x: Math.min(D, i.size - F * D),
2032
+ y: Math.min(h, o.size - N * h),
2033
+ z: Math.min(y, (a?.size ?? 1) - J * y),
2053
2034
  c: 1
2054
2035
  },
2055
2036
  rowAlignmentBytes: 1,
2056
- chunkIndex: { x: J, y: c, z: m, c: u, t: o },
2037
+ chunkIndex: { x: F, y: N, z: J, c: e, t: Q },
2057
2038
  scale: {
2058
- x: h.scale,
2059
- y: y.scale,
2060
- z: G?.scale ?? 1
2039
+ x: i.scale,
2040
+ y: o.scale,
2041
+ z: a?.scale ?? 1
2061
2042
  },
2062
2043
  offset: {
2063
- x: K,
2064
- y: b,
2065
- z: v
2044
+ x: M,
2045
+ y: K,
2046
+ z: L
2066
2047
  }
2067
2048
  });
2049
+ }
2068
2050
  }
2069
2051
  }
2070
- }
2071
2052
  }
2072
2053
  }
2073
2054
  }
2074
- getChunks() {
2075
- const A = this.getChunksAtCurrentTime(), I = A.filter(
2076
- (Q) => Q.lod === this.currentLOD_ && Q.visible && Q.state === "loaded"
2077
- );
2078
- return this.currentLOD_ === this.lowestResLOD_ ? I : [...A.filter(
2079
- (Q) => Q.lod === this.lowestResLOD_ && Q.visible && Q.state === "loaded"
2080
- ), ...I];
2081
- }
2082
- getChunksAtCurrentTime() {
2083
- return this.chunks_[this.getCurrentTimeIndex()];
2084
- }
2085
- getCurrentTimeIndex() {
2086
- return this.sliceCoords_.t === void 0 || this.dimensions_.t === void 0 ? 0 : TQ(this.dimensions_.t.lods[0], this.sliceCoords_.t);
2087
- }
2088
- allVisibleLowestLODLoaded() {
2089
- return this.getChunksAtCurrentTime().filter((A) => A.visible && A.lod === this.lowestResLOD_).every((A) => A.state === "loaded");
2055
+ getChunksAtTime(A) {
2056
+ return this.chunks_[A];
2090
2057
  }
2091
- updateAndCollectChunkChanges(A, I) {
2092
- this.setLOD(A);
2093
- const B = this.getZBounds(), C = this.policyChanged_ || this.viewBounds2DChanged(I) || this.zBoundsChanged(B) || this.lastTCoord_ !== this.sliceCoords_.t ? this.updateAndCollectChunkChangesForCurrentLod(I) : [];
2094
- return this.policyChanged_ = !1, this.lastViewBounds2D_ = I.clone(), this.lastZBounds_ = B, this.lastTCoord_ = this.sliceCoords_.t, C;
2058
+ getTimeIndex(A) {
2059
+ return A.t === void 0 || this.dimensions_.t === void 0 ? 0 : TQ(this.dimensions_.t.lods[0], A.t);
2095
2060
  }
2096
2061
  get lodCount() {
2097
2062
  return this.lowestResLOD_ + 1;
@@ -2099,128 +2064,12 @@ class WQ {
2099
2064
  get dimensions() {
2100
2065
  return this.dimensions_;
2101
2066
  }
2102
- get currentLOD() {
2103
- return this.currentLOD_;
2104
- }
2105
- setImageSourcePolicy(A, I) {
2106
- if (I !== nB)
2107
- throw new Error("Unauthorized policy mutation");
2108
- this.policy_ !== A && (this.policy_ = A, this.policyChanged_ = !0, N.info(
2109
- "ChunkManagerSource",
2110
- "Using image source policy:",
2111
- this.policy_.profile
2112
- ));
2067
+ getLowestResLOD() {
2068
+ return this.lowestResLOD_;
2113
2069
  }
2114
2070
  loadChunkData(A, I) {
2115
2071
  return this.loader_.loadChunkData(A, I);
2116
2072
  }
2117
- setLOD(A) {
2118
- const I = this.dimensions_.x.lods[0].scale, Q = this.policy_.lod.bias - Math.log2(I) - A, C = Math.floor(Q), E = Math.max(
2119
- 0,
2120
- Math.min(this.lowestResLOD_, this.policy_.lod.min)
2121
- ), i = Math.max(
2122
- E,
2123
- Math.min(this.lowestResLOD_, this.policy_.lod.max)
2124
- ), o = OA(C, E, i);
2125
- o !== this.currentLOD_ && (this.currentLOD_ = o);
2126
- }
2127
- updateAndCollectChunkChangesForCurrentLod(A) {
2128
- if (this.chunks_.length === 0)
2129
- return N.warn(
2130
- "ChunkManagerSource",
2131
- "updateChunkVisibility called with no chunks initialized"
2132
- ), [];
2133
- const I = FB();
2134
- KQ(I, A.min, A.max, 0.5);
2135
- const [B, Q] = this.getZBounds(), C = new eA(
2136
- q(A.min[0], A.min[1], B),
2137
- q(A.max[0], A.max[1], Q)
2138
- ), E = [], i = this.getCurrentTimeIndex();
2139
- if (this.sliceCoords_.t !== void 0) {
2140
- const a = this.disposeStaleTimeChunks(i);
2141
- E.push(...a);
2142
- }
2143
- const o = this.updateChunksAtTimeIndex(
2144
- i,
2145
- C,
2146
- I
2147
- );
2148
- if (E.push(...o), this.sliceCoords_.t !== void 0) {
2149
- const a = this.markTimeChunksForPrefetch(
2150
- i,
2151
- C,
2152
- I
2153
- );
2154
- E.push(...a);
2155
- }
2156
- return E;
2157
- }
2158
- disposeStaleTimeChunks(A) {
2159
- const I = [];
2160
- for (const B of this.tIndicesWithQueuedChunks_) {
2161
- const Q = B - A;
2162
- if (Q >= 0 && Q <= this.policy_.prefetch.t) continue;
2163
- const C = this.chunks_[B];
2164
- for (const E of C)
2165
- this.disposeChunk(E), I.push(E);
2166
- this.tIndicesWithQueuedChunks_.delete(B);
2167
- }
2168
- return I;
2169
- }
2170
- updateChunksAtTimeIndex(A, I, B) {
2171
- const Q = this.getPaddedBounds(I), C = this.chunks_[A];
2172
- this.tIndicesWithQueuedChunks_.add(A);
2173
- for (const E of C) {
2174
- const i = this.isChunkWithinBounds(E, I), o = this.isChunkChannelInSlice(E), a = !i && o && this.isChunkWithinBounds(E, Q), D = E.lod === this.currentLOD_, h = E.lod === this.lowestResLOD_, y = E.state === "loaded";
2175
- E.visible = i, E.prefetch = a && D && !y, E.priority = this.computePriority(
2176
- h,
2177
- D,
2178
- i,
2179
- E.prefetch,
2180
- o
2181
- ), E.priority !== null && E.state === "unloaded" ? E.state = "queued" : E.priority === null && E.state === "queued" && (E.state = "unloaded", E.orderKey = null), E.priority !== null && (E.orderKey = this.squareDistance2D(E, B)), this.shouldDispose(
2182
- y,
2183
- h,
2184
- D,
2185
- i,
2186
- a,
2187
- o
2188
- ) && this.disposeChunk(E);
2189
- }
2190
- return C;
2191
- }
2192
- markTimeChunksForPrefetch(A, I, B) {
2193
- const Q = Math.min(
2194
- this.chunks_.length - 1,
2195
- A + this.policy_.prefetch.t
2196
- ), C = [];
2197
- for (let E = A + 1; E <= Q; ++E)
2198
- for (const i of this.chunks_[E]) {
2199
- if (i.state !== "unloaded" || i.lod !== this.lowestResLOD_ || !this.isChunkChannelInSlice(i) || !this.isChunkWithinBounds(i, I)) continue;
2200
- i.prefetch = !0, i.priority = this.policy_.priorityMap.prefetchTime;
2201
- const o = this.squareDistance2D(i, B), a = OA(
2202
- o / this.sourceMaxSquareDistance2D_,
2203
- 0,
2204
- 1 - Number.EPSILON
2205
- );
2206
- i.orderKey = E - A + a, i.state = "queued", this.tIndicesWithQueuedChunks_.add(E), C.push(i);
2207
- }
2208
- return C;
2209
- }
2210
- isChunkChannelInSlice(A) {
2211
- return this.sliceCoords_.c === void 0 || this.sliceCoords_.c === A.chunkIndex.c;
2212
- }
2213
- shouldDispose(A, I, B, Q, C, E) {
2214
- return A ? E ? I ? !1 : B ? !Q && !C : !0 : !0 : !1;
2215
- }
2216
- disposeChunk(A) {
2217
- A.data = void 0, A.state = "unloaded", A.priority = null, A.orderKey = null, A.prefetch = !1;
2218
- }
2219
- computePriority(A, I, B, Q, C) {
2220
- if (!C) return null;
2221
- const E = this.policy_.priorityMap;
2222
- return A && B ? E.fallbackVisible : I && B ? E.visibleCurrent : A ? E.fallbackBackground : I && Q ? E.prefetchSpace : null;
2223
- }
2224
2073
  validateXYScaleRatios() {
2225
2074
  const A = this.dimensions_.x, I = this.dimensions_.y;
2226
2075
  for (let B = 1; B < this.dimensions_.numLods; B++) {
@@ -2237,12 +2086,12 @@ class WQ {
2237
2086
  if (!I) continue;
2238
2087
  if (I.chunkSize !== 1)
2239
2088
  throw new Error(
2240
- `ChunkManager only supports a chunk size of 1 in t. Found ${I.chunkSize} at LOD ${A}`
2089
+ `ChunkStore only supports a chunk size of 1 in t. Found ${I.chunkSize} at LOD ${A}`
2241
2090
  );
2242
2091
  const B = this.dimensions_.t?.lods[A - 1];
2243
2092
  if (B && I.size !== B.size)
2244
2093
  throw new Error(
2245
- `ChunkManager does not support downsampling in t. Found ${B.size} at LOD ${A - 1} → ${I.size} at LOD ${A}`
2094
+ `ChunkStore does not support downsampling in t. Found ${B.size} at LOD ${A - 1} → ${I.size} at LOD ${A}`
2246
2095
  );
2247
2096
  }
2248
2097
  return {
@@ -2255,26 +2104,183 @@ class WQ {
2255
2104
  if (!I) continue;
2256
2105
  if (I.chunkSize !== 1)
2257
2106
  throw new Error(
2258
- `ChunkManager only supports a chunk size of 1 in c. Found ${I.chunkSize} at LOD ${A}`
2107
+ `ChunkStore only supports a chunk size of 1 in c. Found ${I.chunkSize} at LOD ${A}`
2259
2108
  );
2260
2109
  if (I.scale !== 1)
2261
2110
  throw new Error(
2262
- `ChunkManager does not support scale in c. Found ${I.scale} at LOD ${A}`
2111
+ `ChunkStore does not support scale in c. Found ${I.scale} at LOD ${A}`
2263
2112
  );
2264
2113
  if (I.translation !== 0)
2265
2114
  throw new Error(
2266
- `ChunkManager does not support translation in c. Found ${I.translation} at LOD ${A}`
2115
+ `ChunkStore does not support translation in c. Found ${I.translation} at LOD ${A}`
2267
2116
  );
2268
2117
  const B = this.dimensions_.c?.lods[A - 1];
2269
2118
  if (B && I.size !== B.size)
2270
2119
  throw new Error(
2271
- `ChunkManager does not support downsampling in c. Found ${B.size} at LOD ${A - 1} → ${I.size} at LOD ${A}`
2120
+ `ChunkStore does not support downsampling in c. Found ${B.size} at LOD ${A - 1} → ${I.size} at LOD ${A}`
2272
2121
  );
2273
2122
  }
2274
2123
  return {
2275
2124
  size: this.dimensions_.c?.lods[0].size ?? 1
2276
2125
  };
2277
2126
  }
2127
+ }
2128
+ function OA(g, A, I) {
2129
+ return Math.max(A, Math.min(I, g));
2130
+ }
2131
+ const nB = Symbol("INTERNAL_POLICY_KEY");
2132
+ class xQ {
2133
+ store_;
2134
+ policy_;
2135
+ policyChanged_ = !1;
2136
+ currentLOD_ = 0;
2137
+ lastViewBounds2D_ = null;
2138
+ lastZBounds_;
2139
+ lastTCoord_;
2140
+ sourceMaxSquareDistance2D_;
2141
+ chunkViewStates_ = /* @__PURE__ */ new Map();
2142
+ constructor(A, I) {
2143
+ this.store_ = A, this.policy_ = I, c.info(
2144
+ "ChunkStoreView",
2145
+ "Using image source policy:",
2146
+ this.policy_.profile
2147
+ );
2148
+ const B = this.store_.dimensions, Q = B.x.lods[0], C = B.y.lods[0];
2149
+ this.sourceMaxSquareDistance2D_ = MQ(
2150
+ u(Q.size * Q.scale, C.size * C.scale)
2151
+ );
2152
+ }
2153
+ get store() {
2154
+ return this.store_;
2155
+ }
2156
+ get chunkViewStates() {
2157
+ return this.chunkViewStates_;
2158
+ }
2159
+ getChunksToRender(A) {
2160
+ const I = this.store_.getTimeIndex(A), B = this.store_.getChunksAtTime(I), Q = B.filter(
2161
+ (i) => i.lod === this.currentLOD_ && this.chunkViewStates_.get(i)?.visible === !0 && i.state === "loaded"
2162
+ ), C = this.store_.getLowestResLOD();
2163
+ return this.currentLOD_ === C ? Q : [...B.filter(
2164
+ (i) => i.lod === C && this.chunkViewStates_.get(i)?.visible === !0 && i.state === "loaded"
2165
+ ), ...Q];
2166
+ }
2167
+ updateChunkStates(A, I) {
2168
+ const B = I.camera;
2169
+ if (B.type !== "OrthographicCamera")
2170
+ throw new Error(
2171
+ "ChunkStoreView currently supports only orthographic cameras. Update the implementation before using a perspective camera."
2172
+ );
2173
+ const C = B.getWorldViewRect(), E = Math.abs(C.max[0] - C.min[0]), i = I.element, o = I.getBoxRelativeTo(i).toRect().width, a = E / o, D = Math.log2(1 / a);
2174
+ this.setLOD(D);
2175
+ const h = this.getZBounds(A);
2176
+ (this.policyChanged_ || this.viewBounds2DChanged(C) || this.zBoundsChanged(h) || this.lastTCoord_ !== A.t) && (this.updateChunkViewStates(A, C), this.policyChanged_ = !1, this.lastViewBounds2D_ = C.clone(), this.lastZBounds_ = h, this.lastTCoord_ = A.t);
2177
+ }
2178
+ allVisibleLowestLODLoaded(A) {
2179
+ const I = this.store_.getTimeIndex(A), B = this.store_.getChunksAtTime(I).filter((Q) => Q.visible && Q.lod === this.store_.getLowestResLOD());
2180
+ return B.length > 0 && B.every((Q) => Q.state === "loaded");
2181
+ }
2182
+ get currentLOD() {
2183
+ return this.currentLOD_;
2184
+ }
2185
+ maybeForgetChunk(A) {
2186
+ const I = this.chunkViewStates_.get(A);
2187
+ I && (I.visible || I.prefetch || I.priority !== null) || this.chunkViewStates_.delete(A);
2188
+ }
2189
+ setImageSourcePolicy(A, I) {
2190
+ if (I !== nB)
2191
+ throw new Error("Unauthorized policy mutation");
2192
+ this.policy_ !== A && (this.policy_ = A, this.policyChanged_ = !0, c.info(
2193
+ "ChunkStoreView",
2194
+ "Using image source policy:",
2195
+ this.policy_.profile
2196
+ ));
2197
+ }
2198
+ setLOD(A) {
2199
+ const B = this.store_.dimensions.x.lods[0].scale, C = this.policy_.lod.bias - Math.log2(B) - A, E = Math.floor(C), i = this.store_.getLowestResLOD(), o = Math.max(
2200
+ 0,
2201
+ Math.min(i, this.policy_.lod.min)
2202
+ ), a = Math.max(
2203
+ o,
2204
+ Math.min(i, this.policy_.lod.max)
2205
+ ), D = OA(E, o, a);
2206
+ D !== this.currentLOD_ && (this.currentLOD_ = D);
2207
+ }
2208
+ updateChunkViewStates(A, I) {
2209
+ const B = this.store_.getTimeIndex(A);
2210
+ if (this.store_.getChunksAtTime(B).length === 0) {
2211
+ c.warn(
2212
+ "ChunkStoreView",
2213
+ "updateChunkViewStates called with no chunks initialized"
2214
+ ), this.chunkViewStates_.clear();
2215
+ return;
2216
+ }
2217
+ const C = FB();
2218
+ KQ(C, I.min, I.max, 0.5);
2219
+ const [E, i] = this.getZBounds(A), o = new eA(
2220
+ q(I.min[0], I.min[1], E),
2221
+ q(I.max[0], I.max[1], i)
2222
+ );
2223
+ this.chunkViewStates_.forEach(bQ), this.updateChunksAtTimeIndex(
2224
+ B,
2225
+ A,
2226
+ o,
2227
+ C
2228
+ ), A.t !== void 0 && this.markTimeChunksForPrefetch(
2229
+ B,
2230
+ o,
2231
+ C
2232
+ );
2233
+ }
2234
+ isChunkChannelInSlice(A, I) {
2235
+ return I.c === void 0 || I.c === A.chunkIndex.c;
2236
+ }
2237
+ updateChunksAtTimeIndex(A, I, B, Q) {
2238
+ const C = this.getPaddedBounds(B), E = this.store_.getChunksAtTime(A);
2239
+ for (const i of E) {
2240
+ const o = this.isChunkWithinBounds(i, B), a = this.isChunkChannelInSlice(i, I), D = i.lod === this.currentLOD_, h = i.lod === this.store_.getLowestResLOD(), y = !o && a && D && this.isChunkWithinBounds(i, C), G = o && a, S = this.computePriority(
2241
+ h,
2242
+ D,
2243
+ o,
2244
+ y,
2245
+ a
2246
+ );
2247
+ if (S !== null) {
2248
+ const R = this.squareDistance2D(i, Q);
2249
+ this.chunkViewStates_.set(i, {
2250
+ visible: G,
2251
+ prefetch: y,
2252
+ priority: S,
2253
+ orderKey: R
2254
+ });
2255
+ }
2256
+ }
2257
+ }
2258
+ markTimeChunksForPrefetch(A, I, B) {
2259
+ const Q = this.store_.dimensions.t?.lods[0].size ?? 1, C = Math.min(
2260
+ Q - 1,
2261
+ A + this.policy_.prefetch.t
2262
+ );
2263
+ for (let E = A + 1; E <= C; ++E)
2264
+ for (const i of this.store_.getChunksAtTime(E)) {
2265
+ if (i.lod !== this.store_.getLowestResLOD() || !this.isChunkWithinBounds(i, I)) continue;
2266
+ const o = this.policy_.priorityMap.prefetchTime, a = this.squareDistance2D(i, B), D = OA(
2267
+ a / this.sourceMaxSquareDistance2D_,
2268
+ 0,
2269
+ 1 - Number.EPSILON
2270
+ ), h = E - A + D;
2271
+ this.chunkViewStates_.set(i, {
2272
+ visible: !1,
2273
+ prefetch: !0,
2274
+ priority: o,
2275
+ orderKey: h
2276
+ });
2277
+ }
2278
+ }
2279
+ computePriority(A, I, B, Q, C) {
2280
+ if (!C) return null;
2281
+ const E = this.policy_.priorityMap;
2282
+ return A && B ? E.fallbackVisible : I && B ? E.visibleCurrent : A ? E.fallbackBackground : I && Q ? E.prefetchSpace : null;
2283
+ }
2278
2284
  isChunkWithinBounds(A, I) {
2279
2285
  const B = new eA(
2280
2286
  q(A.offset.x, A.offset.y, A.offset.z),
@@ -2286,19 +2292,19 @@ class WQ {
2286
2292
  );
2287
2293
  return eA.intersects(B, I);
2288
2294
  }
2289
- getZBounds() {
2290
- const A = this.dimensions_.z;
2291
- if (A === void 0 || this.sliceCoords_.z === void 0) return [0, 1];
2292
- const I = A.lods[this.currentLOD_], B = I.size, Q = I.scale, C = I.translation, E = Math.floor((this.sliceCoords_.z - C) / Q), i = I.chunkSize, o = Math.max(
2295
+ getZBounds(A) {
2296
+ const I = this.store_.dimensions.z;
2297
+ if (I === void 0 || A.z === void 0) return [0, 1];
2298
+ const B = I.lods[this.currentLOD_], Q = B.size, C = B.scale, E = B.translation, i = Math.floor((A.z - E) / C), o = B.chunkSize, a = Math.max(
2293
2299
  0,
2294
2300
  Math.min(
2295
- Math.floor(E / i),
2296
- Math.ceil(B / i) - 1
2301
+ Math.floor(i / o),
2302
+ Math.ceil(Q / o) - 1
2297
2303
  )
2298
2304
  );
2299
2305
  return [
2300
- C + o * i * Q,
2301
- C + (o + 1) * i * Q
2306
+ E + a * o * C,
2307
+ E + (a + 1) * o * C
2302
2308
  ];
2303
2309
  }
2304
2310
  viewBounds2DChanged(A) {
@@ -2308,18 +2314,18 @@ class WQ {
2308
2314
  return !this.lastZBounds_ || !xI(this.lastZBounds_, A);
2309
2315
  }
2310
2316
  getPaddedBounds(A) {
2311
- const I = this.dimensions_.x.lods[this.currentLOD_], B = this.dimensions_.y.lods[this.currentLOD_], Q = this.dimensions_.z?.lods[this.currentLOD_], C = I.chunkSize * I.scale * this.policy_.prefetch.x, E = B.chunkSize * B.scale * this.policy_.prefetch.y;
2312
- let i = 0;
2313
- return Q && (i = Q.chunkSize * Q.scale * this.policy_.prefetch.z), new eA(
2317
+ const I = this.store_.dimensions, B = I.x.lods[this.currentLOD_], Q = I.y.lods[this.currentLOD_], C = I.z?.lods[this.currentLOD_], E = B.chunkSize * B.scale * this.policy_.prefetch.x, i = Q.chunkSize * Q.scale * this.policy_.prefetch.y;
2318
+ let o = 0;
2319
+ return C && (o = C.chunkSize * C.scale * this.policy_.prefetch.z), new eA(
2314
2320
  q(
2315
- A.min[0] - C,
2316
- A.min[1] - E,
2317
- A.min[2] - i
2321
+ A.min[0] - E,
2322
+ A.min[1] - i,
2323
+ A.min[2] - o
2318
2324
  ),
2319
2325
  q(
2320
- A.max[0] + C,
2321
- A.max[1] + E,
2322
- A.max[2] + i
2326
+ A.max[0] + E,
2327
+ A.max[1] + i,
2328
+ A.max[2] + o
2323
2329
  )
2324
2330
  );
2325
2331
  }
@@ -2331,44 +2337,92 @@ class WQ {
2331
2337
  return Q * Q + C * C;
2332
2338
  }
2333
2339
  }
2334
- class xQ {
2335
- sources_ = /* @__PURE__ */ new Map();
2336
- pendingSources_ = /* @__PURE__ */ new Map();
2340
+ function bQ(g) {
2341
+ g.visible = !1, g.prefetch = !1, g.priority = null, g.orderKey = null;
2342
+ }
2343
+ class ZQ {
2344
+ stores_ = /* @__PURE__ */ new Map();
2345
+ pendingStores_ = /* @__PURE__ */ new Map();
2346
+ views_ = /* @__PURE__ */ new Map();
2337
2347
  queue_ = new uQ();
2338
- async addSource(A, I, B) {
2339
- const Q = this.sources_.get(A) ?? this.pendingSources_.get(A);
2340
- if (Q)
2341
- return Q;
2342
- const E = (async () => {
2343
- const i = await A.open(), o = new WQ(
2344
- i,
2345
- I,
2346
- B
2347
- );
2348
- return this.sources_.set(A, o), this.pendingSources_.delete(A), o;
2349
- })();
2350
- return this.pendingSources_.set(A, E), E;
2348
+ async addView(A, I) {
2349
+ const B = await this.addSource(A), Q = new xQ(B, I);
2350
+ return this.views_.set(B, (this.views_.get(B) ?? []).concat(Q)), Q;
2351
2351
  }
2352
- update(A, I) {
2353
- if (this.sources_.size === 0) return;
2354
- if (A.type !== "OrthographicCamera")
2352
+ removeView(A) {
2353
+ const I = A.store, B = this.getSourceForStore(I), Q = this.views_.get(I);
2354
+ if (!Q)
2355
+ throw new Error("Cannot remove view: store not managed by ChunkManager");
2356
+ const C = Q.indexOf(A);
2357
+ if (C === -1)
2355
2358
  throw new Error(
2356
- "ChunkManager currently supports only orthographic cameras. Update the implementation before using a perspective camera."
2357
- );
2358
- const B = A.getWorldViewRect(), C = Math.abs(B.max[0] - B.min[0]) / I, E = Math.log2(1 / C);
2359
- for (const [i, o] of this.sources_) {
2360
- const a = o.updateAndCollectChunkChanges(
2361
- E,
2362
- B
2359
+ `Cannot remove view: view not found in store's view list (source: ${B})`
2363
2360
  );
2364
- for (const D of a)
2365
- D.priority === null ? this.queue_.cancel(D) : D.state === "queued" && this.queue_.enqueue(
2366
- D,
2367
- (h) => o.loadChunkData(D, h)
2361
+ const E = Array.from(A.chunkViewStates.keys());
2362
+ Q.splice(C, 1);
2363
+ for (const i of E)
2364
+ this.aggregateChunkViewStates(i, I);
2365
+ Q.length === 0 && (this.stores_.delete(B), this.views_.delete(I));
2366
+ }
2367
+ async addSource(A) {
2368
+ const I = this.stores_.get(A) ?? this.pendingStores_.get(A);
2369
+ if (I)
2370
+ return I;
2371
+ const Q = (async () => {
2372
+ const C = await A.open(), E = new WQ(C);
2373
+ return this.stores_.set(A, E), this.pendingStores_.delete(A), E;
2374
+ })();
2375
+ return this.pendingStores_.set(A, Q), Q;
2376
+ }
2377
+ getSourceForStore(A) {
2378
+ for (const [I, B] of this.stores_)
2379
+ if (B === A)
2380
+ return I;
2381
+ throw new Error("Source not found for the given store.");
2382
+ }
2383
+ update() {
2384
+ for (const [A, I] of this.stores_) {
2385
+ const B = this.updateAndCollectChunkChanges(I);
2386
+ for (const Q of B)
2387
+ Q.priority === null ? this.queue_.cancel(Q) : Q.state === "queued" && this.queue_.enqueue(
2388
+ Q,
2389
+ (C) => I.loadChunkData(Q, C)
2368
2390
  );
2369
2391
  }
2370
2392
  this.queue_.flush();
2371
2393
  }
2394
+ updateAndCollectChunkChanges(A) {
2395
+ const I = this.views_.get(A);
2396
+ if (!I) return /* @__PURE__ */ new Set();
2397
+ const B = /* @__PURE__ */ new Set();
2398
+ for (const Q of I)
2399
+ for (const [C, E] of Q.chunkViewStates)
2400
+ B.add(C);
2401
+ for (const Q of B)
2402
+ this.aggregateChunkViewStates(Q, A);
2403
+ return B;
2404
+ }
2405
+ aggregateChunkViewStates(A, I) {
2406
+ const B = this.views_.get(I);
2407
+ if (!B) return;
2408
+ let Q = !1, C = !1, E = null, i = null;
2409
+ for (const h of B) {
2410
+ const y = h.chunkViewStates.get(A);
2411
+ y && (y.visible && (Q = !0), y.prefetch && (C = !0), y.priority !== null && (E === null || y.priority < E) && (E = y.priority, i = y.orderKey), !y.visible && !y.prefetch && y.priority === null && h.maybeForgetChunk(A));
2412
+ }
2413
+ if (A.visible = Q, A.prefetch = C, A.priority = E, A.orderKey = i, A.priority !== null && A.state === "unloaded") {
2414
+ A.state = "queued";
2415
+ return;
2416
+ }
2417
+ if (A.priority === null && A.state === "queued") {
2418
+ A.state = "unloaded";
2419
+ return;
2420
+ }
2421
+ A.state === "loaded" && !A.visible && !A.prefetch && (A.data = void 0, A.state = "unloaded", A.priority = null, A.orderKey = null, A.prefetch = !1, c.debug(
2422
+ "ChunkManager",
2423
+ `Disposing chunk ${JSON.stringify(A.chunkIndex)} in LOD ${A.lod}`
2424
+ ));
2425
+ }
2372
2426
  }
2373
2427
  var ZA = function(g = 1) {
2374
2428
  var A = 0, I = document.createElement("div");
@@ -2412,24 +2466,24 @@ var ZA = function(g = 1) {
2412
2466
  };
2413
2467
  };
2414
2468
  ZA.Panel = function(g, A, I, B) {
2415
- var Q = 1 / 0, C = 0, E = Math.round, i = E(window.devicePixelRatio || 1), o = E(80 * i * B), a = E(48 * i * B), D = E(3 * i * B), h = E(2 * i * B), y = E(3 * i * B), G = E(15 * i * B), R = E(74 * i * B), S = E(30 * i * B), e = document.createElement("canvas");
2469
+ var Q = 1 / 0, C = 0, E = Math.round, i = E(window.devicePixelRatio || 1), o = E(80 * i * B), a = E(48 * i * B), D = E(3 * i * B), h = E(2 * i * B), y = E(3 * i * B), G = E(15 * i * B), S = E(74 * i * B), R = E(30 * i * B), e = document.createElement("canvas");
2416
2470
  e.width = o, e.height = a, e.style.cssText = `width:${E(B * 80)}px;height:${E(B * 48)}px`;
2417
- var n = e.getContext("2d");
2418
- return n.font = "bold " + E(9 * i * B) + "px Helvetica,Arial,sans-serif", n.textBaseline = "top", n.fillStyle = I, n.fillRect(0, 0, o, a), n.fillStyle = A, n.fillText(g, D, h), n.fillRect(y, G, R, S), n.fillStyle = I, n.globalAlpha = 0.9, n.fillRect(y, G, R, S), {
2471
+ var F = e.getContext("2d");
2472
+ return F.font = "bold " + E(9 * i * B) + "px Helvetica,Arial,sans-serif", F.textBaseline = "top", F.fillStyle = I, F.fillRect(0, 0, o, a), F.fillStyle = A, F.fillText(g, D, h), F.fillRect(y, G, S, R), F.fillStyle = I, F.globalAlpha = 0.9, F.fillRect(y, G, S, R), {
2419
2473
  dom: e,
2420
- update: function(M, k) {
2421
- Q = Math.min(Q, M), C = Math.max(C, M), n.fillStyle = I, n.globalAlpha = 1, n.fillRect(0, 0, o, G), n.fillStyle = A, n.fillText(E(M) + " " + g + " (" + E(Q) + "-" + E(C) + ")", D, h), n.drawImage(e, y + i, G, R - i, S, y, G, R - i, S), n.fillRect(y + R - i, G, i, S), n.fillStyle = I, n.globalAlpha = 0.9, n.fillRect(y + R - i, G, i, E((1 - M / k) * S));
2474
+ update: function(M, N) {
2475
+ Q = Math.min(Q, M), C = Math.max(C, M), F.fillStyle = I, F.globalAlpha = 1, F.fillRect(0, 0, o, G), F.fillStyle = A, F.fillText(E(M) + " " + g + " (" + E(Q) + "-" + E(C) + ")", D, h), F.drawImage(e, y + i, G, S - i, R, y, G, S - i, R), F.fillRect(y + S - i, G, i, R), F.fillStyle = I, F.globalAlpha = 0.9, F.fillRect(y + S - i, G, i, E((1 - M / N) * R));
2422
2476
  }
2423
2477
  };
2424
2478
  };
2425
- function bQ({ scale: g } = { scale: 1.5 }) {
2479
+ function PQ({ scale: g } = { scale: 1.5 }) {
2426
2480
  const A = new ZA(g);
2427
2481
  return A.showPanel(
2428
2482
  0
2429
2483
  /* 0 = fps, 1 = ms, 2 = mb */
2430
2484
  ), document.body.appendChild(A.dom), A;
2431
2485
  }
2432
- class ZQ {
2486
+ class OQ {
2433
2487
  layers_ = [];
2434
2488
  callbacks_ = [];
2435
2489
  context_;
@@ -2443,7 +2497,7 @@ class ZQ {
2443
2497
  return { opaque: A, transparent: I };
2444
2498
  }
2445
2499
  add(A) {
2446
- this.layers_ = [...this.layers_, A], this.context_ && A.onAttached(this.context_), this.notifyLayersChanged();
2500
+ this.layers_ = [...this.layers_, A], A.onAttached(this.context_), this.notifyLayersChanged();
2447
2501
  }
2448
2502
  remove(A) {
2449
2503
  const I = this.layers_.indexOf(A);
@@ -2453,11 +2507,11 @@ class ZQ {
2453
2507
  }
2454
2508
  removeByIndex(A) {
2455
2509
  const I = this.layers_[A];
2456
- I && I.onDetached(), this.layers_ = this.layers_.filter((B, Q) => Q !== A), this.notifyLayersChanged();
2510
+ I && I.onDetached(this.context_), this.layers_ = this.layers_.filter((B, Q) => Q !== A), this.notifyLayersChanged();
2457
2511
  }
2458
2512
  removeAll() {
2459
2513
  for (const A of this.layers_)
2460
- A.onDetached();
2514
+ A.onDetached(this.context_);
2461
2515
  this.layers_ = [], this.notifyLayersChanged();
2462
2516
  }
2463
2517
  get layers() {
@@ -2486,10 +2540,10 @@ const zI = [
2486
2540
  "pointercancel",
2487
2541
  "wheel"
2488
2542
  ];
2489
- function PQ(g) {
2543
+ function VQ(g) {
2490
2544
  return zI.includes(g);
2491
2545
  }
2492
- class OQ {
2546
+ class vQ {
2493
2547
  propagationStopped_ = !1;
2494
2548
  type;
2495
2549
  event;
@@ -2505,7 +2559,7 @@ class OQ {
2505
2559
  this.propagationStopped_ = !0;
2506
2560
  }
2507
2561
  }
2508
- class VQ {
2562
+ class XQ {
2509
2563
  listeners_ = [];
2510
2564
  element_;
2511
2565
  isConnected_ = !1;
@@ -2517,7 +2571,7 @@ class VQ {
2517
2571
  }
2518
2572
  connect() {
2519
2573
  if (this.isConnected_) {
2520
- N.warn(
2574
+ c.warn(
2521
2575
  "EventDispatcher",
2522
2576
  "Attempted to connect already connected event dispatcher",
2523
2577
  `element id: ${this.element_.id}`
@@ -2532,7 +2586,7 @@ class VQ {
2532
2586
  }
2533
2587
  disconnect() {
2534
2588
  if (!this.isConnected_) {
2535
- N.debug(
2589
+ c.debug(
2536
2590
  "EventDispatcher",
2537
2591
  "Attempted to disconnect already disconnected event dispatcher",
2538
2592
  `element id: ${this.element_.id}`
@@ -2544,16 +2598,16 @@ class VQ {
2544
2598
  });
2545
2599
  }
2546
2600
  handleEvent = (A) => {
2547
- if (!PQ(A.type)) {
2548
- N.error("EventDispatcher", `Unsupported event type ${A.type}`);
2601
+ if (!VQ(A.type)) {
2602
+ c.error("EventDispatcher", `Unsupported event type ${A.type}`);
2549
2603
  return;
2550
2604
  }
2551
- const I = new OQ(A.type, A);
2605
+ const I = new vQ(A.type, A);
2552
2606
  for (const B of this.listeners_)
2553
2607
  if (B(I), I.propagationStopped) break;
2554
2608
  };
2555
2609
  }
2556
- class vQ {
2610
+ class jQ {
2557
2611
  id;
2558
2612
  element;
2559
2613
  camera;
@@ -2561,9 +2615,9 @@ class vQ {
2561
2615
  events;
2562
2616
  cameraControls;
2563
2617
  constructor(A) {
2564
- 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 VQ(this.element), this.events.addEventListener((I) => {
2618
+ 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 XQ(this.element), this.events.addEventListener((I) => {
2565
2619
  if (I.event instanceof PointerEvent || I.event instanceof WheelEvent) {
2566
- const { clientX: B, clientY: Q } = I.event, C = W(B, Q);
2620
+ const { clientX: B, clientY: Q } = I.event, C = u(B, Q);
2567
2621
  I.clipPos = this.clientToClip(C, 0), I.worldPos = this.camera.clipToWorld(I.clipPos);
2568
2622
  }
2569
2623
  for (const B of this.layerManager.layers)
@@ -2579,8 +2633,8 @@ class vQ {
2579
2633
  getBoxRelativeTo(A) {
2580
2634
  const I = this.getBox().toRect(), B = A.getBoundingClientRect(), Q = window.devicePixelRatio || 1, C = B.left * Q, E = B.top * Q, i = B.height * Q, o = I.x - C, a = I.y - E, D = Math.floor(o), h = Math.floor(i - a - I.height), y = Math.floor(I.width), G = Math.floor(I.height);
2581
2635
  return new j(
2582
- W(D, h),
2583
- W(D + y, h + G)
2636
+ u(D, h),
2637
+ u(D + y, h + G)
2584
2638
  );
2585
2639
  }
2586
2640
  clientToClip(A, I = 0) {
@@ -2598,14 +2652,14 @@ class vQ {
2598
2652
  getBox() {
2599
2653
  const A = this.element.getBoundingClientRect(), I = window.devicePixelRatio || 1, B = A.left * I, Q = A.top * I, C = A.width * I, E = A.height * I;
2600
2654
  return new j(
2601
- W(B, Q),
2602
- W(B + C, Q + E)
2655
+ u(B, Q),
2656
+ u(B + C, Q + E)
2603
2657
  );
2604
2658
  }
2605
2659
  updateAspectRatio() {
2606
2660
  const { width: A, height: I } = this.getBox().toRect();
2607
2661
  if (A <= 0 || I <= 0) {
2608
- N.debug(
2662
+ c.debug(
2609
2663
  "Viewport",
2610
2664
  `Skipping aspect ratio update for viewport ${this.id}: invalid dimensions ${A}x${I}`
2611
2665
  );
@@ -2615,7 +2669,7 @@ class vQ {
2615
2669
  this.camera.setAspectRatio(B);
2616
2670
  }
2617
2671
  }
2618
- function XQ(g) {
2672
+ function zQ(g) {
2619
2673
  const A = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Set();
2620
2674
  for (const B of g) {
2621
2675
  if (I.has(B.id))
@@ -2631,19 +2685,19 @@ function XQ(g) {
2631
2685
  A.set(B.element, B.id);
2632
2686
  }
2633
2687
  }
2634
- function jQ(g, A, I) {
2688
+ function _Q(g, A, I) {
2635
2689
  const B = g.map((Q) => {
2636
2690
  const C = Q.element ?? A;
2637
2691
  return {
2638
2692
  ...Q,
2639
2693
  element: C,
2640
2694
  id: Q.id ?? C.id ?? DB(),
2641
- layerManager: new ZQ(I)
2695
+ layerManager: new OQ(I)
2642
2696
  };
2643
2697
  });
2644
- return XQ(B), B.map((Q) => new vQ(Q));
2698
+ return zQ(B), B.map((Q) => new jQ(Q));
2645
2699
  }
2646
- class zQ {
2700
+ class $Q {
2647
2701
  elements_;
2648
2702
  resizeObserver_;
2649
2703
  mediaQuery_;
@@ -2654,7 +2708,7 @@ class zQ {
2654
2708
  }
2655
2709
  connect() {
2656
2710
  if (this.resizeObserver_) {
2657
- N.warn(
2711
+ c.warn(
2658
2712
  "PixelSizeObserver",
2659
2713
  "Attempted to connect already connected observer"
2660
2714
  );
@@ -2682,7 +2736,7 @@ class zQ {
2682
2736
  }
2683
2737
  disconnect() {
2684
2738
  if (!this.resizeObserver_) {
2685
- N.warn(
2739
+ c.warn(
2686
2740
  "PixelSizeObserver",
2687
2741
  "Attempted to disconnect already disconnected observer"
2688
2742
  );
@@ -2691,7 +2745,7 @@ class zQ {
2691
2745
  this.resizeObserver_?.disconnect(), this.mediaQuery_ && this.onMediaQueryChange_ && this.mediaQuery_.removeEventListener("change", this.onMediaQueryChange_);
2692
2746
  }
2693
2747
  }
2694
- class io {
2748
+ class ao {
2695
2749
  lastAnimationId_;
2696
2750
  chunkManager_;
2697
2751
  context_;
@@ -2752,17 +2806,17 @@ class io {
2752
2806
  constructor(A) {
2753
2807
  if (this.canvas = A.canvas, A.viewports.length === 0)
2754
2808
  throw new Error("At least one viewport config must be specified.");
2755
- this.renderer_ = new pQ(this.canvas), this.chunkManager_ = new xQ(), this.context_ = {
2809
+ this.renderer_ = new pQ(this.canvas), this.chunkManager_ = new ZQ(), this.context_ = {
2756
2810
  chunkManager: this.chunkManager_
2757
- }, this.viewports_ = jQ(
2811
+ }, this.viewports_ = _Q(
2758
2812
  A.viewports,
2759
2813
  this.canvas,
2760
2814
  this.context_
2761
- ), this.overlays = A.overlays ?? [], A.showStats && (this.stats_ = bQ());
2815
+ ), this.overlays = A.overlays ?? [], A.showStats && (this.stats_ = PQ());
2762
2816
  const I = [this.canvas];
2763
2817
  for (const B of this.viewports_)
2764
2818
  B.element !== this.canvas && I.push(B.element);
2765
- this.sizeObserver_ = new zQ(I);
2819
+ this.sizeObserver_ = new $Q(I);
2766
2820
  }
2767
2821
  get renderedObjects() {
2768
2822
  return this.renderer_.renderedObjects;
@@ -2783,21 +2837,19 @@ class io {
2783
2837
  return this.viewports_.find((I) => I.id === A);
2784
2838
  }
2785
2839
  start() {
2786
- if (N.info("Idetik", "Idetik runtime starting"), this.lastAnimationId_ === void 0) {
2840
+ if (c.info("Idetik", "Idetik runtime starting"), this.lastAnimationId_ === void 0) {
2787
2841
  for (const A of this.viewports_)
2788
2842
  A.events.connect();
2789
2843
  this.sizeObserver_.connect(), this.animate();
2790
2844
  } else
2791
- N.warn("Idetik", "Idetik runtime already started");
2845
+ c.warn("Idetik", "Idetik runtime already started");
2792
2846
  return this;
2793
2847
  }
2794
2848
  animate(A) {
2795
2849
  this.stats_ && this.stats_.begin(), this.sizeObserver_.getAndResetChanged() && this.updateSize();
2796
2850
  for (const I of this.viewports_)
2797
- I.camera.type === "OrthographicCamera" && this.chunkManager_.update(
2798
- I.camera,
2799
- I.getBoxRelativeTo(this.canvas).toRect().width
2800
- ), this.renderer_.render(I);
2851
+ this.renderer_.render(I);
2852
+ this.chunkManager_.update();
2801
2853
  for (const I of this.overlays)
2802
2854
  I.update(this, A);
2803
2855
  this.stats_ && this.stats_.end(), this.lastAnimationId_ = requestAnimationFrame(
@@ -2805,8 +2857,8 @@ class io {
2805
2857
  );
2806
2858
  }
2807
2859
  stop() {
2808
- if (N.info("Idetik", "Idetik runtime stopping"), this.lastAnimationId_ === void 0)
2809
- N.warn("Idetik", "Idetik runtime not started");
2860
+ if (c.info("Idetik", "Idetik runtime stopping"), this.lastAnimationId_ === void 0)
2861
+ c.warn("Idetik", "Idetik runtime not started");
2810
2862
  else {
2811
2863
  this.sizeObserver_.disconnect();
2812
2864
  for (const A of this.viewports_)
@@ -2820,14 +2872,14 @@ class io {
2820
2872
  A.updateSize();
2821
2873
  }
2822
2874
  }
2823
- class _Q extends pA {
2875
+ class AC extends pA {
2824
2876
  constructor(A) {
2825
2877
  if (super(), A.primitive != "triangles") {
2826
- N.warn("WireframeGeometry", "Only indexed geometries are supported");
2878
+ c.warn("WireframeGeometry", "Only indexed geometries are supported");
2827
2879
  return;
2828
2880
  }
2829
2881
  if (A.indexData.length == 0) {
2830
- N.warn(
2882
+ c.warn(
2831
2883
  "WireframeGeometry",
2832
2884
  "Only triangulated geometries are supported"
2833
2885
  );
@@ -2845,8 +2897,8 @@ class _Q extends pA {
2845
2897
  this.indexData_ = new Uint32Array(B);
2846
2898
  }
2847
2899
  }
2848
- const $Q = q(0, 1, 0);
2849
- class AC {
2900
+ const IC = q(0, 1, 0);
2901
+ class gC {
2850
2902
  dirty_ = !0;
2851
2903
  matrix_ = AA();
2852
2904
  rotation_ = XI();
@@ -2878,7 +2930,7 @@ class AC {
2878
2930
  }
2879
2931
  targetTo(A) {
2880
2932
  eQ(this.translation_, A) && (A = IA(A), A[2] += rA);
2881
- const I = tQ(AA(), this.translation_, A, $Q), B = iQ(sB(), I);
2933
+ const I = tQ(AA(), this.translation_, A, IC), B = iQ(sB(), I);
2882
2934
  wB(this.rotation_, B), og(this.rotation_, this.rotation_), this.dirty_ = !0;
2883
2935
  }
2884
2936
  get scale() {
@@ -2904,7 +2956,7 @@ class mA extends Eg {
2904
2956
  wireframeColor = l.WHITE;
2905
2957
  textures_ = [];
2906
2958
  staleTextures_ = [];
2907
- transform_ = new AC();
2959
+ transform_ = new gC();
2908
2960
  geometry_ = new pA();
2909
2961
  wireframeGeometry_ = null;
2910
2962
  programName_ = null;
@@ -2921,7 +2973,7 @@ class mA extends Eg {
2921
2973
  return this.geometry_;
2922
2974
  }
2923
2975
  get wireframeGeometry() {
2924
- return this.wireframeGeometry_ ??= new _Q(this.geometry), this.wireframeGeometry_;
2976
+ return this.wireframeGeometry_ ??= new AC(this.geometry), this.wireframeGeometry_;
2925
2977
  }
2926
2978
  get textures() {
2927
2979
  return this.textures_;
@@ -2978,7 +3030,7 @@ class JA {
2978
3030
  }
2979
3031
  }
2980
3032
  }
2981
- class IC {
3033
+ class BC {
2982
3034
  planes_;
2983
3035
  constructor(A) {
2984
3036
  this.planes_ = [
@@ -3046,7 +3098,7 @@ class eB extends mA {
3046
3098
  return q(A[4], A[5], A[6]);
3047
3099
  }
3048
3100
  get frustum() {
3049
- return new IC(
3101
+ return new BC(
3050
3102
  FI(AA(), this.projectionMatrix, this.viewMatrix)
3051
3103
  );
3052
3104
  }
@@ -3075,7 +3127,7 @@ class eB extends mA {
3075
3127
  }
3076
3128
  }
3077
3129
  const rB = 1.77, mg = 128, ug = 128 / rB;
3078
- class oo extends eB {
3130
+ class Do extends eB {
3079
3131
  // width_ and height_ should always be defined by constructor (see setFrame)
3080
3132
  width_ = mg;
3081
3133
  height_ = ug;
@@ -3112,8 +3164,8 @@ class oo extends eB {
3112
3164
  this.viewMatrix
3113
3165
  ), Q = ig(AA(), B);
3114
3166
  return A = nI(PA(), A, Q), I = nI(PA(), I, Q), new j(
3115
- W(A[0], A[1]),
3116
- W(I[0], I[1])
3167
+ u(A[0], A[1]),
3168
+ u(I[0], I[1])
3117
3169
  );
3118
3170
  }
3119
3171
  updateProjectionMatrix() {
@@ -3130,14 +3182,14 @@ class oo extends eB {
3130
3182
  );
3131
3183
  }
3132
3184
  }
3133
- const gC = 60, BC = 1.77, tI = 0.1, bI = 180 - tI;
3134
- class ao extends eB {
3185
+ const QC = 60, CC = 1.77, tI = 0.1, bI = 180 - tI;
3186
+ class so extends eB {
3135
3187
  fov_;
3136
3188
  aspectRatio_;
3137
3189
  constructor(A = {}) {
3138
3190
  const {
3139
- fov: I = gC,
3140
- aspectRatio: B = BC,
3191
+ fov: I = QC,
3192
+ aspectRatio: B = CC,
3141
3193
  near: Q = 0.1,
3142
3194
  far: C = 1e4,
3143
3195
  position: E = q(0, 0, 0)
@@ -3173,7 +3225,7 @@ class ao extends eB {
3173
3225
  }
3174
3226
  }
3175
3227
  const Tg = 0;
3176
- class Do {
3228
+ class ho {
3177
3229
  camera_;
3178
3230
  dragActive_ = !1;
3179
3231
  dragStart_ = p();
@@ -3232,7 +3284,7 @@ class GA {
3232
3284
  opacity: I = 1,
3233
3285
  blendMode: B = "normal"
3234
3286
  } = {}) {
3235
- (I < 0 || I > 1) && N.warn(
3287
+ (I < 0 || I > 1) && c.warn(
3236
3288
  "Layer",
3237
3289
  `Layer opacity out of bounds: ${I} — clamping to [0.0, 1.0]`
3238
3290
  ), this.transparent = A, this.opacity_ = OA(I, 0, 1), this.blendMode = B;
@@ -3241,7 +3293,7 @@ class GA {
3241
3293
  return this.opacity_;
3242
3294
  }
3243
3295
  set opacity(A) {
3244
- (A < 0 || A > 1) && N.warn(
3296
+ (A < 0 || A > 1) && c.warn(
3245
3297
  "Layer",
3246
3298
  `Opacity out of bounds: ${A} — clamping to [0.0, 1.0]`
3247
3299
  ), this.opacity_ = OA(A, 0, 1);
@@ -3254,7 +3306,7 @@ class GA {
3254
3306
  // placeholder implementations.
3255
3307
  async onAttached(A) {
3256
3308
  }
3257
- onDetached() {
3309
+ onDetached(A) {
3258
3310
  }
3259
3311
  get objects() {
3260
3312
  return this.objects_;
@@ -3392,7 +3444,7 @@ class ag extends mA {
3392
3444
  };
3393
3445
  }
3394
3446
  }
3395
- class so extends GA {
3447
+ class yo extends GA {
3396
3448
  type = "AxesLayer";
3397
3449
  constructor(A) {
3398
3450
  super();
@@ -3428,7 +3480,7 @@ function ZI(g) {
3428
3480
  width: I
3429
3481
  });
3430
3482
  }
3431
- class ho extends GA {
3483
+ class to extends GA {
3432
3484
  type = "ProjectedLineLayer";
3433
3485
  paths_ = [];
3434
3486
  constructor(A = []) {
@@ -3445,10 +3497,10 @@ class ho extends GA {
3445
3497
  // TODO: this is temporary - we may want to generalize this to all layers
3446
3498
  // for now it is used to set the initial camera position to be centered on the tracks
3447
3499
  get extent() {
3448
- return QC(this.paths_.flat());
3500
+ return EC(this.paths_.flat());
3449
3501
  }
3450
3502
  }
3451
- function QC(g) {
3503
+ function EC(g) {
3452
3504
  function A(o) {
3453
3505
  const a = g.map((D) => D[o]);
3454
3506
  return [Math.min(...a), Math.max(...a)];
@@ -3456,7 +3508,7 @@ function QC(g) {
3456
3508
  const [I, B] = A(0), [Q, C] = A(1), [E, i] = A(2);
3457
3509
  return { xMin: I, xMax: B, yMin: Q, yMax: C, zMin: E, zMax: i };
3458
3510
  }
3459
- class yo extends GA {
3511
+ class Go extends GA {
3460
3512
  type = "TracksLayer";
3461
3513
  tracks_ = [];
3462
3514
  constructor(A = []) {
@@ -3466,7 +3518,7 @@ class yo extends GA {
3466
3518
  this.tracks_.push(A);
3467
3519
  let I;
3468
3520
  if (A.interpolation) {
3469
- const i = EC({
3521
+ const i = oC({
3470
3522
  path: A.path,
3471
3523
  pointsPerSegment: A.interpolation.pointsPerSegment,
3472
3524
  tangentFactor: A.interpolation.tangentFactor
@@ -3497,10 +3549,10 @@ class yo extends GA {
3497
3549
  // for now it is used to set the initial camera position to be centered on the tracks
3498
3550
  get extent() {
3499
3551
  const A = this.tracks_.map((I) => I.path);
3500
- return CC(A.flat());
3552
+ return iC(A.flat());
3501
3553
  }
3502
3554
  }
3503
- function CC(g) {
3555
+ function iC(g) {
3504
3556
  function A(o) {
3505
3557
  const a = g.map((D) => D[o]);
3506
3558
  return [Math.min(...a), Math.max(...a)];
@@ -3508,12 +3560,12 @@ function CC(g) {
3508
3560
  const [I, B] = A(0), [Q, C] = A(1), [E, i] = A(2);
3509
3561
  return { xMin: I, xMax: B, yMin: Q, yMax: C, zMin: E, zMax: i };
3510
3562
  }
3511
- function EC({
3563
+ function oC({
3512
3564
  path: g,
3513
3565
  pointsPerSegment: A,
3514
3566
  tangentFactor: I = 1 / 3
3515
3567
  }) {
3516
- const B = iC(g), Q = Array((g.length - 1) * A);
3568
+ const B = aC(g), Q = Array((g.length - 1) * A);
3517
3569
  for (let C = 0; C < g.length - 1; C++) {
3518
3570
  const E = g[C], i = g[C + 1], o = IA(B[C]);
3519
3571
  dg(o, E, o, I);
@@ -3526,7 +3578,7 @@ function EC({
3526
3578
  }
3527
3579
  return Q;
3528
3580
  }
3529
- function iC(g) {
3581
+ function aC(g) {
3530
3582
  if (g.length < 2)
3531
3583
  throw new Error("Path must contain at least 2 points");
3532
3584
  const A = Array(g.length), I = p(), B = p();
@@ -3541,16 +3593,16 @@ class SB extends pA {
3541
3593
  super();
3542
3594
  const C = [], E = [], i = B, o = Q, a = i + 1, D = o + 1, h = A / i, y = I / o;
3543
3595
  for (let G = 0; G < D; ++G) {
3544
- const R = G * y;
3545
- for (let S = 0; S < a; ++S) {
3546
- const e = S * h, n = S / i, M = G / o, k = [e, R, 0], J = [0, 0, 1], K = [n, M];
3547
- C.push(...k, ...J, ...K);
3596
+ const S = G * y;
3597
+ for (let R = 0; R < a; ++R) {
3598
+ const e = R * h, F = R / i, M = G / o, N = [e, S, 0], K = [0, 0, 1], J = [F, M];
3599
+ C.push(...N, ...K, ...J);
3548
3600
  }
3549
3601
  }
3550
3602
  for (let G = 0; G < o; ++G)
3551
- for (let R = 0; R < i; ++R) {
3552
- const S = R + a * G, e = R + a * (G + 1), n = R + 1 + a * (G + 1), M = R + 1 + a * G;
3553
- E.push(S, e, M), E.push(e, n, M);
3603
+ for (let S = 0; S < i; ++S) {
3604
+ const R = S + a * G, e = S + a * (G + 1), F = S + 1 + a * (G + 1), M = S + 1 + a * G;
3605
+ E.push(R, e, M), E.push(e, F, M);
3554
3606
  }
3555
3607
  this.vertexData_ = new Float32Array(C), this.indexData_ = new Uint32Array(E), this.addAttribute({
3556
3608
  type: "position",
@@ -3587,7 +3639,7 @@ function dA(g) {
3587
3639
  return "float";
3588
3640
  throw new Error("Unsupported buffer type.");
3589
3641
  }
3590
- function oC(g) {
3642
+ function DC(g) {
3591
3643
  if (g.dataFormat === "rgb" || g.dataFormat === "rgba")
3592
3644
  return [0, 1];
3593
3645
  switch (g.dataType) {
@@ -3624,7 +3676,7 @@ class Dg extends Eg {
3624
3676
  }
3625
3677
  const xg = 32;
3626
3678
  function _I(g, { visible: A, color: I, contrastLimits: B }) {
3627
- return A === void 0 && (A = !0), I === void 0 ? I = l.WHITE : I = l.from(I), g !== null ? B = aC(B, g) : B === void 0 && (N.debug(
3679
+ return A === void 0 && (A = !0), I === void 0 ? I = l.WHITE : I = l.from(I), g !== null ? B = sC(B, g) : B === void 0 && (c.debug(
3628
3680
  "Channel",
3629
3681
  "No texture provided, defaulting channel contrast limits to [0, 1]."
3630
3682
  ), B = [0, 1]), {
@@ -3645,9 +3697,9 @@ function bg(g, A) {
3645
3697
  }
3646
3698
  return A.map((I) => _I(g, I));
3647
3699
  }
3648
- function aC(g, A) {
3700
+ function sC(g, A) {
3649
3701
  if (g === void 0)
3650
- return oC(A);
3702
+ return DC(A);
3651
3703
  if (g[1] <= g[0])
3652
3704
  throw new Error(
3653
3705
  `Contrast limits must be strictly increasing: ${g}.`
@@ -3657,7 +3709,7 @@ function aC(g, A) {
3657
3709
  class sg extends mA {
3658
3710
  channels_;
3659
3711
  constructor(A, I, B, Q = []) {
3660
- super(), this.geometry = new SB(A, I, 1, 1), this.setTexture(0, B), this.channels_ = bg(B, Q), this.programName = DC(B);
3712
+ super(), this.geometry = new SB(A, I, 1, 1), this.setTexture(0, B), this.channels_ = bg(B, Q), this.programName = hC(B);
3661
3713
  }
3662
3714
  get type() {
3663
3715
  return "ImageRenderable";
@@ -3700,14 +3752,14 @@ class sg extends mA {
3700
3752
  }
3701
3753
  }
3702
3754
  }
3703
- function DC(g) {
3755
+ function hC(g) {
3704
3756
  if (g.type === "Texture2D")
3705
- return sC(g.dataType);
3757
+ return yC(g.dataType);
3706
3758
  if (g.type === "Texture2DArray")
3707
- return hC(g.dataType);
3759
+ return tC(g.dataType);
3708
3760
  throw new Error(`Unsupported image texture type: ${g.type}`);
3709
3761
  }
3710
- function sC(g) {
3762
+ function yC(g) {
3711
3763
  switch (g) {
3712
3764
  case "byte":
3713
3765
  case "int":
@@ -3721,7 +3773,7 @@ function sC(g) {
3721
3773
  return "floatScalarImage";
3722
3774
  }
3723
3775
  }
3724
- function hC(g) {
3776
+ function tC(g) {
3725
3777
  switch (g) {
3726
3778
  case "byte":
3727
3779
  case "int":
@@ -3787,11 +3839,11 @@ function hg(g, A, I, B, Q = 3) {
3787
3839
  switch (g.type) {
3788
3840
  case "pointerdown": {
3789
3841
  const C = g.event;
3790
- return W(C.clientX, C.clientY);
3842
+ return u(C.clientX, C.clientY);
3791
3843
  }
3792
3844
  case "pointerup": {
3793
3845
  if (!A) return A;
3794
- const C = g.event, E = W(C.clientX, C.clientY);
3846
+ const C = g.event, E = u(C.clientX, C.clientY);
3795
3847
  if (YQ(A, E) < Q) {
3796
3848
  if (!B) return null;
3797
3849
  const o = g.worldPos;
@@ -3809,15 +3861,15 @@ function hg(g, A, I, B, Q = 3) {
3809
3861
  return A;
3810
3862
  }
3811
3863
  }
3812
- class yC {
3864
+ class GC {
3813
3865
  bins_ = /* @__PURE__ */ new Map();
3814
3866
  acquire(A) {
3815
3867
  const B = this.bins_.get(A)?.pop();
3816
- return B && N.debug("RenderablePool", "Renderable object acquired"), B;
3868
+ return B && c.debug("RenderablePool", "Renderable object acquired"), B;
3817
3869
  }
3818
3870
  release(A, I) {
3819
3871
  let B = this.bins_.get(A);
3820
- B || (B = [], this.bins_.set(A, B)), B.push(I), N.debug("RenderablePool", "Renderable object released");
3872
+ B || (B = [], this.bins_.set(A, B)), B.push(I), c.debug("RenderablePool", "Renderable object released");
3821
3873
  }
3822
3874
  clearAll(A) {
3823
3875
  if (A) for (const I of this.bins_.values()) I.forEach(A);
@@ -3830,12 +3882,12 @@ class RB extends GA {
3830
3882
  sliceCoords_;
3831
3883
  onPickValue_;
3832
3884
  visibleChunks_ = /* @__PURE__ */ new Map();
3833
- pool_ = new yC();
3885
+ pool_ = new GC();
3834
3886
  initialChannelProps_;
3835
3887
  channelChangeCallbacks_ = [];
3836
3888
  policy_;
3837
3889
  channelProps_;
3838
- chunkManagerSource_;
3890
+ chunkStoreView_;
3839
3891
  pointerDownPos_ = null;
3840
3892
  zPrevPointWorld_;
3841
3893
  debugMode_ = !1;
@@ -3859,27 +3911,28 @@ class RB extends GA {
3859
3911
  super(E), this.setState("initialized"), this.source_ = A, this.policy_ = B, this.sliceCoords_ = I, this.channelProps_ = Q, this.initialChannelProps_ = Q, this.onPickValue_ = C;
3860
3912
  }
3861
3913
  async onAttached(A) {
3862
- if (this.chunkManagerSource_)
3914
+ if (this.chunkStoreView_)
3863
3915
  throw new Error(
3864
- "ChunkedImageLayer is already attached. A layer cannot be attached to multiple LayerManagers simultaneously."
3916
+ "ChunkedImageLayer cannot be attached to multiple contexts simultaneously."
3865
3917
  );
3866
- this.chunkManagerSource_ = await A.chunkManager.addSource(
3918
+ this.chunkStoreView_ = await A.chunkManager.addView(
3867
3919
  this.source_,
3868
- this.sliceCoords_,
3869
3920
  this.policy_
3870
3921
  );
3871
3922
  }
3872
- onDetached() {
3873
- this.chunkManagerSource_ = void 0, this.releaseAndRemoveChunks(this.visibleChunks_.keys()), this.clearObjects();
3923
+ onDetached(A) {
3924
+ this.releaseAndRemoveChunks(this.visibleChunks_.keys()), this.clearObjects(), this.chunkStoreView_ && (A.chunkManager.removeView(this.chunkStoreView_), this.chunkStoreView_ = void 0);
3874
3925
  }
3875
- update() {
3876
- this.updateChunks(), this.resliceIfZChanged();
3926
+ update(A) {
3927
+ !A || !this.chunkStoreView_ || (this.chunkStoreView_.updateChunkStates(this.sliceCoords_, A.viewport), this.updateChunks(), this.resliceIfZChanged());
3877
3928
  }
3878
3929
  updateChunks() {
3879
- if (!this.chunkManagerSource_ || (this.state !== "ready" && this.setState("ready"), this.visibleChunks_.size > 0 && !this.chunkManagerSource_.allVisibleLowestLODLoaded() && !this.isPresentationStale()))
3930
+ if (!this.chunkStoreView_ || (this.state !== "ready" && this.setState("ready"), this.visibleChunks_.size > 0 && !this.chunkStoreView_.allVisibleLowestLODLoaded(this.sliceCoords_) && !this.isPresentationStale()))
3880
3931
  return;
3881
3932
  this.lastPresentationTimeStamp_ = performance.now(), this.lastPresentationTimeCoord_ = this.sliceCoords_.t;
3882
- const A = this.chunkManagerSource_.getChunks(), I = new Set(A), B = Array.from(this.visibleChunks_.keys()).filter(
3933
+ const A = this.chunkStoreView_.getChunksToRender(
3934
+ this.sliceCoords_
3935
+ ), I = new Set(A), B = Array.from(this.visibleChunks_.keys()).filter(
3883
3936
  (Q) => !I.has(Q)
3884
3937
  );
3885
3938
  this.releaseAndRemoveChunks(B), this.clearObjects();
@@ -3914,8 +3967,12 @@ class RB extends GA {
3914
3967
  this.onPickValue_
3915
3968
  );
3916
3969
  }
3917
- get chunkManagerSource() {
3918
- return this.chunkManagerSource_;
3970
+ // exposed for use in chunk info overlay
3971
+ get chunkStoreView() {
3972
+ return this.chunkStoreView_;
3973
+ }
3974
+ get sliceCoords() {
3975
+ return this.sliceCoords_;
3919
3976
  }
3920
3977
  get source() {
3921
3978
  return this.source_;
@@ -3924,7 +3981,7 @@ class RB extends GA {
3924
3981
  return this.policy_;
3925
3982
  }
3926
3983
  set imageSourcePolicy(A) {
3927
- this.policy_ !== A && (this.policy_ = A, this.chunkManagerSource_ && this.chunkManagerSource_.setImageSourcePolicy(
3984
+ this.policy_ !== A && (this.policy_ = A, this.chunkStoreView_ && this.chunkStoreView_.setImageSourcePolicy(
3928
3985
  A,
3929
3986
  nB
3930
3987
  ));
@@ -3932,7 +3989,7 @@ class RB extends GA {
3932
3989
  slicePlane(A, I) {
3933
3990
  if (!A.data) return;
3934
3991
  const B = (I - A.offset.z) / A.scale.z, Q = Math.round(B), C = OA(Q, 0, A.shape.z - 1);
3935
- jI(B, C, 1 + 1e-6) || N.error("ImageLayer", "slicePlane zValue outside extent");
3992
+ jI(B, C, 1 + 1e-6) || c.error("ImageLayer", "slicePlane zValue outside extent");
3936
3993
  const E = A.shape.x * A.shape.y, i = E * C;
3937
3994
  return A.data.slice(i, i + E);
3938
3995
  }
@@ -3954,7 +4011,7 @@ class RB extends GA {
3954
4011
  getDataForImage(A) {
3955
4012
  const I = this.sliceCoords_?.z !== void 0 ? this.slicePlane(A, this.sliceCoords_.z) : A.data;
3956
4013
  if (!I) {
3957
- N.warn("ChunkedImageLayer", "No data for image");
4014
+ c.warn("ChunkedImageLayer", "No data for image");
3958
4015
  return;
3959
4016
  }
3960
4017
  return I;
@@ -3963,7 +4020,7 @@ class RB extends GA {
3963
4020
  this.debugMode_ ? (A.wireframeEnabled = !0, A.wireframeColor = this.wireframeColors_[I.lod % this.wireframeColors_.length]) : A.wireframeEnabled = !1, A.transform.setScale([I.scale.x, I.scale.y, 1]), A.transform.setTranslation([I.offset.x, I.offset.y, 0]);
3964
4021
  }
3965
4022
  getValueAtWorld(A) {
3966
- const I = this.chunkManagerSource_?.currentLOD ?? 0;
4023
+ const I = this.chunkStoreView_?.currentLOD ?? 0;
3967
4024
  for (const [B, Q] of this.visibleChunks_) {
3968
4025
  if (B.lod !== I) continue;
3969
4026
  const C = this.getValueFromChunk(B, Q, A);
@@ -4086,7 +4143,7 @@ class yg extends Dg {
4086
4143
  return B.unpackAlignment = A.rowAlignmentBytes, B;
4087
4144
  }
4088
4145
  }
4089
- class tC extends pA {
4146
+ class wC extends pA {
4090
4147
  constructor(A, I, B, Q, C, E) {
4091
4148
  super();
4092
4149
  const i = [], o = [], a = Math.floor(Q), D = Math.floor(C), h = Math.floor(E);
@@ -4105,43 +4162,43 @@ class tC extends pA {
4105
4162
  });
4106
4163
  }
4107
4164
  buildFace(A, I, B, Q, C, E, i, o, a, D, h, y, G) {
4108
- const R = E / a, S = i / D, e = E / 2, n = i / 2, M = o / 2 * h, k = a + 1, J = D + 1, K = y.length / 8;
4109
- for (let c = 0; c < J; c++) {
4110
- const b = -n + c * S;
4111
- for (let m = 0; m < k; m++) {
4112
- const v = -e + m * R, u = { x: 0, y: 0, z: 0 };
4113
- u[A] = v * Q, u[I] = b * C, u[B] = M;
4114
- const O = { x: 0, y: 0, z: 0 };
4115
- O[B] = h;
4116
- const wA = m / a, FA = 1 - c / D;
4165
+ const S = E / a, R = i / D, e = E / 2, F = i / 2, M = o / 2 * h, N = a + 1, K = D + 1, J = y.length / 8;
4166
+ for (let L = 0; L < K; L++) {
4167
+ const O = -F + L * R;
4168
+ for (let V = 0; V < N; V++) {
4169
+ const X = -e + V * S, b = { x: 0, y: 0, z: 0 };
4170
+ b[A] = X * Q, b[I] = O * C, b[B] = M;
4171
+ const Z = { x: 0, y: 0, z: 0 };
4172
+ Z[B] = h;
4173
+ const wA = V / a, FA = 1 - L / D;
4117
4174
  y.push(
4118
- u.x,
4119
- u.y,
4120
- u.z,
4121
- O.x,
4122
- O.y,
4123
- O.z,
4175
+ b.x,
4176
+ b.y,
4177
+ b.z,
4178
+ Z.x,
4179
+ Z.y,
4180
+ Z.z,
4124
4181
  wA,
4125
4182
  FA
4126
4183
  );
4127
4184
  }
4128
4185
  }
4129
- for (let c = 0; c < D; c++)
4130
- for (let b = 0; b < a; b++) {
4131
- const m = K + b + k * c, v = K + b + k * (c + 1), u = K + (b + 1) + k * (c + 1), O = K + (b + 1) + k * c;
4132
- h === 1 ? G.push(m, v, O, v, u, O) : G.push(m, O, v, v, O, u);
4186
+ for (let L = 0; L < D; L++)
4187
+ for (let O = 0; O < a; O++) {
4188
+ const V = J + O + N * L, X = J + O + N * (L + 1), b = J + (O + 1) + N * (L + 1), Z = J + (O + 1) + N * L;
4189
+ h === 1 ? G.push(V, X, Z, X, b, Z) : G.push(V, Z, X, X, Z, b);
4133
4190
  }
4134
4191
  }
4135
4192
  }
4136
- class GC extends mA {
4193
+ class FC extends mA {
4137
4194
  constructor(A, I, B, Q) {
4138
- super(), this.geometry = new tC(A, I, B, 1, 1, 1), this.cullFaceMode = "back", this.setTexture(0, Q), this.programName = wC(Q.dataType);
4195
+ super(), this.geometry = new wC(A, I, B, 1, 1, 1), this.cullFaceMode = "back", this.setTexture(0, Q), this.programName = nC(Q.dataType);
4139
4196
  }
4140
4197
  get type() {
4141
4198
  return "VolumeRenderable";
4142
4199
  }
4143
4200
  }
4144
- function wC(g) {
4201
+ function nC(g) {
4145
4202
  switch (g) {
4146
4203
  case "byte":
4147
4204
  case "int":
@@ -4155,19 +4212,19 @@ function wC(g) {
4155
4212
  return "floatVolume";
4156
4213
  }
4157
4214
  }
4158
- class to extends GA {
4215
+ class wo extends GA {
4159
4216
  type = "VolumeLayer";
4160
4217
  constructor() {
4161
4218
  super();
4162
4219
  const A = new Int8Array([127, 0, 0, 127, 127, 0, 0, 127]), I = new yg(A, 2, 2, 2);
4163
4220
  I.unpackAlignment = 1;
4164
- const B = new GC(1, 1, 1, I);
4221
+ const B = new FC(1, 1, 1, I);
4165
4222
  B.wireframeEnabled = !0, this.addObject(B), this.setState("ready");
4166
4223
  }
4167
4224
  update() {
4168
4225
  }
4169
4226
  }
4170
- class Go extends GA {
4227
+ class Fo extends GA {
4171
4228
  type = "ImageLayer";
4172
4229
  source_;
4173
4230
  region_;
@@ -4314,7 +4371,7 @@ class VA extends Dg {
4314
4371
  return Q.unpackAlignment = A.rowAlignmentBytes, Q;
4315
4372
  }
4316
4373
  }
4317
- const FC = [
4374
+ const eC = [
4318
4375
  [1, 0.5, 0.5],
4319
4376
  [0.5, 1, 0.5],
4320
4377
  [0.5, 0.5, 1],
@@ -4322,7 +4379,7 @@ const FC = [
4322
4379
  [1, 0.5, 1],
4323
4380
  [1, 1, 0.5]
4324
4381
  ];
4325
- function nC(g) {
4382
+ function rC(g) {
4326
4383
  return g = g ?? /* @__PURE__ */ new Map(), new Map(
4327
4384
  Array.from(g.entries()).map(([A, I]) => [
4328
4385
  A,
@@ -4330,37 +4387,37 @@ function nC(g) {
4330
4387
  ])
4331
4388
  );
4332
4389
  }
4333
- function eC(g) {
4334
- return g = g ?? FC, g.map(l.from);
4390
+ function SC(g) {
4391
+ return g = g ?? eC, g.map(l.from);
4335
4392
  }
4336
4393
  class Pg {
4337
4394
  lookupTable;
4338
4395
  cycle;
4339
4396
  constructor(A = {}) {
4340
- this.lookupTable = nC(A.lookupTable), this.cycle = eC(A.cycle);
4397
+ this.lookupTable = rC(A.lookupTable), this.cycle = SC(A.cycle);
4341
4398
  }
4342
4399
  }
4343
- const rC = /* @__PURE__ */ new Set([
4400
+ const RC = /* @__PURE__ */ new Set([
4344
4401
  "unsigned_byte",
4345
4402
  "unsigned_short",
4346
4403
  "unsigned_int"
4347
4404
  ]);
4348
- function SC(g) {
4405
+ function NC(g) {
4349
4406
  if (g.dataFormat !== "scalar")
4350
4407
  throw new Error(
4351
4408
  `Image data format must be scalar, instead found: ${g.dataFormat}`
4352
4409
  );
4353
- if (!rC.has(g.dataType))
4410
+ if (!RC.has(g.dataType))
4354
4411
  throw new Error(
4355
4412
  `Image data type must be unsigned, instead found: ${g.dataType}`
4356
4413
  );
4357
4414
  return g;
4358
4415
  }
4359
- class RC extends mA {
4416
+ class cC extends mA {
4360
4417
  outlineSelected_;
4361
4418
  selectedValue_;
4362
4419
  constructor(A) {
4363
- super(), this.geometry = new SB(A.width, A.height, 1, 1), this.setTexture(0, SC(A.imageData));
4420
+ super(), this.geometry = new SB(A.width, A.height, 1, 1), this.setTexture(0, NC(A.imageData));
4364
4421
  const I = this.makeColorCycleTexture(A.colorMap.cycle);
4365
4422
  this.setTexture(1, I);
4366
4423
  const B = this.makeColorLookupTableTexture(
@@ -4398,7 +4455,7 @@ class RC extends mA {
4398
4455
  return C.set(I, 0), C.set(B, Q), new VA(C, Q, 2);
4399
4456
  }
4400
4457
  }
4401
- class wo extends GA {
4458
+ class no extends GA {
4402
4459
  type = "LabelImageLayer";
4403
4460
  source_;
4404
4461
  region_;
@@ -4463,7 +4520,7 @@ class wo extends GA {
4463
4520
  }
4464
4521
  createImage(A) {
4465
4522
  this.imageChunk_ = A;
4466
- const I = new RC({
4523
+ const I = new cC({
4467
4524
  width: A.shape.x,
4468
4525
  height: A.shape.y,
4469
4526
  imageData: VA.createWithChunk(A),
@@ -4492,7 +4549,7 @@ class KI extends Error {
4492
4549
  super(A), this.name = "AbortError", Object.setPrototypeOf(this, KI.prototype);
4493
4550
  }
4494
4551
  }
4495
- class NC {
4552
+ class UC {
4496
4553
  maxConcurrent_;
4497
4554
  pending_ = [];
4498
4555
  abortController_ = new AbortController();
@@ -4536,12 +4593,12 @@ class NC {
4536
4593
  return this.pending_.length;
4537
4594
  }
4538
4595
  }
4539
- class cC {
4596
+ class kC {
4540
4597
  source_;
4541
4598
  region_;
4542
4599
  seriesDimensionName_;
4543
4600
  seriesIndex_;
4544
- scheduler_ = new NC(16);
4601
+ scheduler_ = new UC(16);
4545
4602
  lod_;
4546
4603
  loader_ = null;
4547
4604
  seriesAttributes_;
@@ -4572,11 +4629,11 @@ class cC {
4572
4629
  const I = this.loadingToken_;
4573
4630
  if (I) {
4574
4631
  if (I.index === A && !I.canceled)
4575
- return N.debug(
4632
+ return c.debug(
4576
4633
  "ImageSeriesLoader",
4577
4634
  "Ignoring duplicate active setIndex request"
4578
4635
  ), { success: !1, reason: "duplicate" };
4579
- N.debug(
4636
+ c.debug(
4580
4637
  "ImageSeriesLoader",
4581
4638
  `Cancelling setIndex request for index ${I.index}, new requested index is ${A}`
4582
4639
  ), I.canceled = !0;
@@ -4636,7 +4693,7 @@ class cC {
4636
4693
  if (Q.status === "rejected") {
4637
4694
  if (Q.reason instanceof KI)
4638
4695
  return Promise.reject(Q.reason);
4639
- N.error(
4696
+ c.error(
4640
4697
  "ImageSeriesLoader",
4641
4698
  `Error loading slice: ${Q.reason}`
4642
4699
  );
@@ -4646,7 +4703,7 @@ class cC {
4646
4703
  return this.loader_ ??= await this.source_.open(), this.loader_;
4647
4704
  }
4648
4705
  }
4649
- class Fo extends GA {
4706
+ class eo extends GA {
4650
4707
  type = "ImageSeriesLayer";
4651
4708
  seriesLoader_;
4652
4709
  initialChannelProps_;
@@ -4663,7 +4720,7 @@ class Fo extends GA {
4663
4720
  lod: C,
4664
4721
  ...E
4665
4722
  }) {
4666
- super(E), this.setState("initialized"), this.channelProps_ = Q, this.initialChannelProps_ = Q, this.seriesLoader_ = new cC({
4723
+ super(E), this.setState("initialized"), this.channelProps_ = Q, this.initialChannelProps_ = Q, this.seriesLoader_ = new kC({
4667
4724
  source: A,
4668
4725
  region: I,
4669
4726
  seriesDimensionName: B,
@@ -4914,7 +4971,7 @@ function Og(g, A) {
4914
4971
  for (let E = 0; E < I; E += 1)
4915
4972
  Q = g[C + E], g[C + E] = g[C + B - E], g[C + B - E] = Q;
4916
4973
  }
4917
- const UC = {
4974
+ const LC = {
4918
4975
  int8: Int8Array,
4919
4976
  int16: Int16Array,
4920
4977
  int32: Int32Array,
@@ -4926,36 +4983,36 @@ const UC = {
4926
4983
  float32: Float32Array,
4927
4984
  float64: Float64Array,
4928
4985
  bool: NB
4929
- }, kC = /v2:([US])(\d+)/;
4986
+ }, JC = /v2:([US])(\d+)/;
4930
4987
  function cB(g) {
4931
4988
  if (g === "v2:object")
4932
4989
  return globalThis.Array;
4933
- let A = g.match(kC);
4990
+ let A = g.match(JC);
4934
4991
  if (A) {
4935
4992
  let [, B, Q] = A;
4936
4993
  return (B === "U" ? aI : wg).bind(null, Number(Q));
4937
4994
  }
4938
- let I = UC[g];
4995
+ let I = LC[g];
4939
4996
  if (!I)
4940
4997
  throw new Error(`Unknown or unsupported data_type: ${g}`);
4941
4998
  return I;
4942
4999
  }
4943
5000
  function RA(g, A) {
4944
- return (A === "C" ? LC : JC)(g);
5001
+ return (A === "C" ? YC : MC)(g);
4945
5002
  }
4946
- function LC(g) {
5003
+ function YC(g) {
4947
5004
  const A = g.length, I = globalThis.Array(A);
4948
5005
  for (let B = A - 1, Q = 1; B >= 0; B--)
4949
5006
  I[B] = Q, Q *= g[B];
4950
5007
  return I;
4951
5008
  }
4952
- function JC(g) {
5009
+ function MC(g) {
4953
5010
  const A = g.length, I = globalThis.Array(A);
4954
5011
  for (let B = 0, Q = 1; B < A; B++)
4955
5012
  I[B] = Q, Q *= g[B];
4956
5013
  return I;
4957
5014
  }
4958
- function YC({ name: g, configuration: A }) {
5015
+ function KC({ name: g, configuration: A }) {
4959
5016
  if (g === "default") {
4960
5017
  const I = A?.separator ?? "/";
4961
5018
  return (B) => ["c", ...B].join(I);
@@ -4969,11 +5026,11 @@ function YC({ name: g, configuration: A }) {
4969
5026
  function $I(g) {
4970
5027
  return g.find((I) => I.name === "transpose")?.configuration?.order === "F" ? "F" : "C";
4971
5028
  }
4972
- const MC = /^([<|>])(.*)$/;
4973
- function KC(g) {
5029
+ const dC = /^([<|>])(.*)$/;
5030
+ function HC(g) {
4974
5031
  if (g === "|O")
4975
5032
  return { data_type: "v2:object" };
4976
- let A = g.match(MC);
5033
+ let A = g.match(dC);
4977
5034
  if (!A)
4978
5035
  throw new Error(`Invalid dtype: ${g}`);
4979
5036
  let [, I, B] = A, Q = {
@@ -4993,8 +5050,8 @@ function KC(g) {
4993
5050
  throw new Error(`Unsupported or unknown dtype: ${g}`);
4994
5051
  return I === "|" ? { data_type: Q } : { data_type: Q, endian: I === "<" ? "little" : "big" };
4995
5052
  }
4996
- function dC(g, A = {}) {
4997
- let I = [], B = KC(g.dtype);
5053
+ function qC(g, A = {}) {
5054
+ let I = [], B = HC(g.dtype);
4998
5055
  g.order === "F" && I.push({ name: "transpose", configuration: { order: "F" } }), "endian" in B && B.endian === "big" && I.push({ name: "bytes", configuration: { endian: "big" } });
4999
5056
  for (let { id: Q, ...C } of g.filters ?? [])
5000
5057
  I.push({ name: Q, configuration: C });
@@ -5024,14 +5081,14 @@ function dC(g, A = {}) {
5024
5081
  attributes: A
5025
5082
  };
5026
5083
  }
5027
- function HC(g, A = {}) {
5084
+ function lC(g, A = {}) {
5028
5085
  return {
5029
5086
  zarr_format: 3,
5030
5087
  node_type: "group",
5031
5088
  attributes: A
5032
5089
  };
5033
5090
  }
5034
- function qC(g, A) {
5091
+ function fC(g, A) {
5035
5092
  if (A !== "number" && A !== "bigint" && A !== "boolean" && A !== "object" && A !== "string")
5036
5093
  return g === A;
5037
5094
  let I = g === "bool";
@@ -5046,14 +5103,14 @@ function qC(g, A) {
5046
5103
  let C = g === "v2:object";
5047
5104
  return A === "object" ? C : !B && !Q && !I && !C;
5048
5105
  }
5049
- function lC(g) {
5106
+ function pC(g) {
5050
5107
  return g?.name === "sharding_indexed";
5051
5108
  }
5052
5109
  function UB(g) {
5053
5110
  return (g.data_type === "uint64" || g.data_type === "int64") && g.fill_value != null ? BigInt(g.fill_value) : g.fill_value;
5054
5111
  }
5055
- const Vg = fC();
5056
- function fC() {
5112
+ const Vg = mC();
5113
+ function mC() {
5057
5114
  const g = new Uint32Array([305419896]);
5058
5115
  return new Uint8Array(g.buffer, g.byteOffset, g.byteLength)[0] !== 18;
5059
5116
  }
@@ -5099,7 +5156,7 @@ class Fg {
5099
5156
  return new Uint8Array(A.buffer, A.byteOffset, A.byteLength - 4);
5100
5157
  }
5101
5158
  }
5102
- function pC(g, A) {
5159
+ function uC(g, A) {
5103
5160
  if (Number.isNaN(A))
5104
5161
  throw new Error("JsonCodec allow_nan is false but NaN was encountered during encoding.");
5105
5162
  if (A === Number.POSITIVE_INFINITY)
@@ -5108,7 +5165,7 @@ function pC(g, A) {
5108
5165
  throw new Error("JsonCodec allow_nan is false but -Infinity was encountered during encoding.");
5109
5166
  return A;
5110
5167
  }
5111
- function mC(g, A) {
5168
+ function TC(g, A) {
5112
5169
  return A instanceof Object && !Array.isArray(A) ? Object.keys(A).sort().reduce((I, B) => (I[B] = A[B], I), {}) : A;
5113
5170
  }
5114
5171
  class ng {
@@ -5141,15 +5198,15 @@ class ng {
5141
5198
  const o = [];
5142
5199
  if (!C)
5143
5200
  throw new Error("JsonCodec does not yet support skipping the check for circular references during encoding.");
5144
- E || o.push(pC), i && o.push(mC);
5201
+ E || o.push(uC), i && o.push(TC);
5145
5202
  const a = Array.from(A.data);
5146
5203
  a.push("|O"), a.push(A.shape);
5147
5204
  let D;
5148
5205
  o.length && (D = (y, G) => {
5149
- let R = G;
5150
- for (let S of o)
5151
- R = S(y, R);
5152
- return R;
5206
+ let S = G;
5207
+ for (let R of o)
5208
+ S = R(y, S);
5209
+ return S;
5153
5210
  });
5154
5211
  let h = JSON.stringify(a, D, I);
5155
5212
  return Q && (h = h.replace(/[\u007F-\uFFFF]/g, (y) => {
@@ -5178,7 +5235,7 @@ function Xg(g) {
5178
5235
  }
5179
5236
  }) : g;
5180
5237
  }
5181
- function uC(g, A) {
5238
+ function WC(g, A) {
5182
5239
  let I;
5183
5240
  return g.data instanceof wg || g.data instanceof aI ? I = new g.constructor(
5184
5241
  // @ts-expect-error
@@ -5190,8 +5247,8 @@ function uC(g, A) {
5190
5247
  stride: RA(g.shape, A)
5191
5248
  };
5192
5249
  }
5193
- function TC(g, A) {
5194
- let I = uC(g, A), B = g.shape.length, Q = g.data.length, C = Array(B).fill(0), E = Xg(g.data), i = Xg(I.data);
5250
+ function xC(g, A) {
5251
+ let I = WC(g, A), B = g.shape.length, Q = g.data.length, C = Array(B).fill(0), E = Xg(g.data), i = Xg(I.data);
5195
5252
  for (let o = 0; o < Q; o++) {
5196
5253
  let a = 0;
5197
5254
  for (let D = 0; D < B; D++)
@@ -5206,7 +5263,7 @@ function TC(g, A) {
5206
5263
  }
5207
5264
  return I;
5208
5265
  }
5209
- function WC(g) {
5266
+ function bC(g) {
5210
5267
  if (!g.stride)
5211
5268
  return "C";
5212
5269
  let A = RA(g.shape, "C");
@@ -5222,7 +5279,7 @@ class eg {
5222
5279
  return new eg(A);
5223
5280
  }
5224
5281
  encode(A) {
5225
- return WC(A) === this.configuration?.order ? A : TC(A, this.configuration?.order ?? "C");
5282
+ return bC(A) === this.configuration?.order ? A : xC(A, this.configuration?.order ?? "C");
5226
5283
  }
5227
5284
  decode(A) {
5228
5285
  return A;
@@ -5250,10 +5307,10 @@ class rg {
5250
5307
  return { data: Q, shape: this.#A, stride: this.#I };
5251
5308
  }
5252
5309
  }
5253
- function xC() {
5310
+ function ZC() {
5254
5311
  return (/* @__PURE__ */ new Map()).set("blosc", () => import("./blosc-BOWv2fO7.js").then((g) => g.default)).set("gzip", () => import("./gzip-DchmmbTG.js").then((g) => g.default)).set("lz4", () => import("./lz4-DUlZKApi.js").then((g) => g.default)).set("zlib", () => import("./zlib-Din1wO0I.js").then((g) => g.default)).set("zstd", () => import("./zstd-DnzmycJs.js").then((g) => g.default)).set("transpose", () => eg).set("bytes", () => dI).set("crc32c", () => Fg).set("vlen-utf8", () => rg).set("json2", () => ng).set("bitround", () => Gg);
5255
5312
  }
5256
- const bC = xC();
5313
+ const PC = ZC();
5257
5314
  function Ag(g) {
5258
5315
  let A;
5259
5316
  return {
@@ -5279,7 +5336,7 @@ function Ag(g) {
5279
5336
  }
5280
5337
  async function jg(g) {
5281
5338
  let A = g.codecs.map(async (C) => {
5282
- let E = await bC.get(C.name)?.();
5339
+ let E = await PC.get(C.name)?.();
5283
5340
  if (!E)
5284
5341
  throw new Error(`Unknown codec: ${C.name}`);
5285
5342
  return { Codec: E, meta: C };
@@ -5298,17 +5355,17 @@ async function jg(g) {
5298
5355
  }
5299
5356
  }
5300
5357
  if (!B) {
5301
- if (!ZC(g))
5358
+ if (!OC(g))
5302
5359
  throw new Error(`Cannot encode ${g.data_type} to bytes without a codec`);
5303
5360
  B = dI.fromConfig({ endian: "little" }, g);
5304
5361
  }
5305
5362
  return { array_to_array: I, array_to_bytes: B, bytes_to_bytes: Q };
5306
5363
  }
5307
- function ZC(g) {
5364
+ function OC(g) {
5308
5365
  return g.data_type !== "v2:object";
5309
5366
  }
5310
5367
  const zg = 18446744073709551615n;
5311
- function PC(g, A, I, B) {
5368
+ function VC(g, A, I, B) {
5312
5369
  if (g.store.getRange === void 0)
5313
5370
  throw new Error("Store does not support range requests");
5314
5371
  let Q = g.store.getRange.bind(g.store), C = A.map((o, a) => o / B.chunk_shape[a]), E = Ag({
@@ -5317,22 +5374,22 @@ function PC(g, A, I, B) {
5317
5374
  codecs: B.index_codecs
5318
5375
  }), i = {};
5319
5376
  return async (o) => {
5320
- let a = o.map((M, k) => Math.floor(M / C[k])), D = g.resolve(I(a)).path, h;
5377
+ let a = o.map((M, N) => Math.floor(M / C[N])), D = g.resolve(I(a)).path, h;
5321
5378
  if (D in i)
5322
5379
  h = i[D];
5323
5380
  else {
5324
- let M = 4, k = 16 * C.reduce((K, c) => K * c, 1), J = await Q(D, {
5325
- suffixLength: k + M
5381
+ let M = 4, N = 16 * C.reduce((J, L) => J * L, 1), K = await Q(D, {
5382
+ suffixLength: N + M
5326
5383
  });
5327
- h = i[D] = J ? await E.decode(J) : null;
5384
+ h = i[D] = K ? await E.decode(K) : null;
5328
5385
  }
5329
5386
  if (h === null)
5330
5387
  return;
5331
- let { data: y, shape: G, stride: R } = h, S = o.map((M, k) => M % G[k]).reduce((M, k, J) => M + k * R[J], 0), e = y[S], n = y[S + 1];
5332
- if (!(e === zg && n === zg))
5388
+ let { data: y, shape: G, stride: S } = h, R = o.map((M, N) => M % G[N]).reduce((M, N, K) => M + N * S[K], 0), e = y[R], F = y[R + 1];
5389
+ if (!(e === zg && F === zg))
5333
5390
  return Q(D, {
5334
5391
  offset: Number(e),
5335
- length: Number(n)
5392
+ length: Number(F)
5336
5393
  });
5337
5394
  };
5338
5395
  }
@@ -5358,12 +5415,12 @@ class Sg extends _ {
5358
5415
  }
5359
5416
  }
5360
5417
  const TA = Symbol("zarrita.context");
5361
- function OC(g) {
5418
+ function vC(g) {
5362
5419
  return g[TA];
5363
5420
  }
5364
- function VC(g, A) {
5365
- let { configuration: I } = A.codecs.find(lC) ?? {}, B = {
5366
- encode_chunk_key: YC(A.chunk_key_encoding),
5421
+ function XC(g, A) {
5422
+ let { configuration: I } = A.codecs.find(pC) ?? {}, B = {
5423
+ encode_chunk_key: KC(A.chunk_key_encoding),
5367
5424
  TypedArray: cB(A.data_type),
5368
5425
  fill_value: A.fill_value
5369
5426
  };
@@ -5381,7 +5438,7 @@ function VC(g, A) {
5381
5438
  get_strides(E, i) {
5382
5439
  return RA(E, i ?? C);
5383
5440
  },
5384
- get_chunk_bytes: PC(g, A.chunk_grid.configuration.chunk_shape, B.encode_chunk_key, I)
5441
+ get_chunk_bytes: VC(g, A.chunk_grid.configuration.chunk_shape, B.encode_chunk_key, I)
5385
5442
  };
5386
5443
  }
5387
5444
  let Q = $I(A.codecs);
@@ -5411,7 +5468,7 @@ let rI = class extends _ {
5411
5468
  super(A, I), this.#A = {
5412
5469
  ...B,
5413
5470
  fill_value: UB(B)
5414
- }, this[TA] = VC(this, B);
5471
+ }, this[TA] = XC(this, B);
5415
5472
  }
5416
5473
  get attrs() {
5417
5474
  return this.#A.attributes;
@@ -5455,10 +5512,10 @@ let rI = class extends _ {
5455
5512
  * ```
5456
5513
  */
5457
5514
  is(A) {
5458
- return qC(this.dtype, A);
5515
+ return fC(this.dtype, A);
5459
5516
  }
5460
- }, HI = vC();
5461
- function vC() {
5517
+ }, HI = jC();
5518
+ function jC() {
5462
5519
  let g = /* @__PURE__ */ new WeakMap();
5463
5520
  function A(I) {
5464
5521
  let B = g.get(I) ?? { v2: 0, v3: 0 };
@@ -5474,13 +5531,13 @@ function vC() {
5474
5531
  }
5475
5532
  };
5476
5533
  }
5477
- async function XC(g) {
5534
+ async function zC(g) {
5478
5535
  let A = await g.store.get(g.resolve(".zattrs").path);
5479
5536
  return A ? DI(A) : {};
5480
5537
  }
5481
- async function jC(g, A = {}) {
5538
+ async function _C(g, A = {}) {
5482
5539
  let I = "store" in g ? g : new _(g), B = {};
5483
- return (A.attrs ?? !0) && (B = await XC(I)), A.kind === "array" ? _g(I, B) : A.kind === "group" ? $g(I, B) : _g(I, B).catch((Q) => {
5540
+ return (A.attrs ?? !0) && (B = await zC(I)), A.kind === "array" ? _g(I, B) : A.kind === "group" ? $g(I, B) : _g(I, B).catch((Q) => {
5484
5541
  if (Q instanceof oI)
5485
5542
  return $g(I, B);
5486
5543
  throw Q;
@@ -5492,7 +5549,7 @@ async function _g(g, A) {
5492
5549
  throw new oI("v2 array", {
5493
5550
  cause: new tg(I)
5494
5551
  });
5495
- return HI.increment(g.store, "v2"), new rI(g.store, g.path, dC(DI(B), A));
5552
+ return HI.increment(g.store, "v2"), new rI(g.store, g.path, qC(DI(B), A));
5496
5553
  }
5497
5554
  async function $g(g, A) {
5498
5555
  let { path: I } = g.resolve(".zgroup"), B = await g.store.get(I);
@@ -5500,9 +5557,9 @@ async function $g(g, A) {
5500
5557
  throw new oI("v2 group", {
5501
5558
  cause: new tg(I)
5502
5559
  });
5503
- return HI.increment(g.store, "v2"), new Sg(g.store, g.path, HC(DI(B), A));
5560
+ return HI.increment(g.store, "v2"), new Sg(g.store, g.path, lC(DI(B), A));
5504
5561
  }
5505
- async function zC(g) {
5562
+ async function $C(g) {
5506
5563
  let { store: A, path: I } = g.resolve("zarr.json"), B = await g.store.get(I);
5507
5564
  if (!B)
5508
5565
  throw new oI("v3 array or group", {
@@ -5511,8 +5568,8 @@ async function zC(g) {
5511
5568
  let Q = DI(B);
5512
5569
  return Q.node_type === "array" && (Q.fill_value = UB(Q)), Q.node_type === "array" ? new rI(A, g.path, Q) : new Sg(A, g.path, Q);
5513
5570
  }
5514
- async function _C(g, A = {}) {
5515
- let I = "store" in g ? g : new _(g), B = await zC(I);
5571
+ async function AE(g, A = {}) {
5572
+ let I = "store" in g ? g : new _(g), B = await $C(I);
5516
5573
  if (HI.increment(I.store, "v3"), A.kind === void 0 || A.kind === "array" && B instanceof rI || A.kind === "group" && B instanceof Sg)
5517
5574
  return B;
5518
5575
  let Q = B instanceof rI ? "array" : "group";
@@ -5526,8 +5583,8 @@ async function z(g, A = {}) {
5526
5583
  throw E;
5527
5584
  });
5528
5585
  }
5529
- z.v2 = jC;
5530
- z.v3 = _C;
5586
+ z.v2 = _C;
5587
+ z.v3 = AE;
5531
5588
  function kB(g, A, I, B = {}) {
5532
5589
  return A !== void 0 && I !== void 0 && (B = {
5533
5590
  ...B,
@@ -5537,7 +5594,7 @@ function kB(g, A, I, B = {}) {
5537
5594
  }
5538
5595
  }), fetch(g, B);
5539
5596
  }
5540
- function $C(g, A) {
5597
+ function IE(g, A) {
5541
5598
  return {
5542
5599
  ...g,
5543
5600
  ...A,
@@ -5560,7 +5617,7 @@ async function IB(g) {
5560
5617
  throw new Error(`Unexpected response status ${g.status} ${g.statusText}`);
5561
5618
  }
5562
5619
  }
5563
- async function AE(g, A, I, B) {
5620
+ async function gE(g, A, I, B) {
5564
5621
  if (B)
5565
5622
  return fetch(g, {
5566
5623
  ...I,
@@ -5580,7 +5637,7 @@ class sI {
5580
5637
  this.url = A, this.#A = I.overrides ?? {}, this.#I = I.useSuffixRequest ?? !1;
5581
5638
  }
5582
5639
  #g(A) {
5583
- return $C(this.#A, A);
5640
+ return IE(this.#A, A);
5584
5641
  }
5585
5642
  async get(A, I = {}) {
5586
5643
  let B = AB(this.url, A).href, Q = await fetch(B, this.#g(I));
@@ -5588,15 +5645,15 @@ class sI {
5588
5645
  }
5589
5646
  async getRange(A, I, B = {}) {
5590
5647
  let Q = AB(this.url, A), C = this.#g(B), E;
5591
- return "suffixLength" in I ? E = await AE(Q, I.suffixLength, C, this.#I) : E = await kB(Q, I.offset, I.length, C), IB(E);
5648
+ return "suffixLength" in I ? E = await gE(Q, I.suffixLength, C, this.#I) : E = await kB(Q, I.offset, I.length, C), IB(E);
5592
5649
  }
5593
5650
  }
5594
- function* IE(g, A, I = 1) {
5651
+ function* BE(g, A, I = 1) {
5595
5652
  A === void 0 && (A = g, g = 0);
5596
5653
  for (let B = g; B < A; B += I)
5597
5654
  yield B;
5598
5655
  }
5599
- function* gE(...g) {
5656
+ function* QE(...g) {
5600
5657
  if (g.length === 0)
5601
5658
  return;
5602
5659
  const A = g.map((B) => B[Symbol.iterator]()), I = A.map((B) => B.next());
@@ -5611,7 +5668,7 @@ function* gE(...g) {
5611
5668
  I[B] = A[B].next();
5612
5669
  }
5613
5670
  }
5614
- function BE({ start: g, stop: A, step: I }, B) {
5671
+ function CE({ start: g, stop: A, step: I }, B) {
5615
5672
  if (I === 0)
5616
5673
  throw new Error("slice step cannot be zero");
5617
5674
  I = I ?? 1;
@@ -5625,7 +5682,7 @@ function SI(g, A, I = null) {
5625
5682
  step: I
5626
5683
  };
5627
5684
  }
5628
- function QE() {
5685
+ function EE() {
5629
5686
  const g = [];
5630
5687
  return {
5631
5688
  add: (A) => g.push(A()),
@@ -5637,28 +5694,28 @@ class Rg extends Error {
5637
5694
  super(A), this.name = "IndexError";
5638
5695
  }
5639
5696
  }
5640
- function CE(g, A) {
5697
+ function iE(g, A) {
5641
5698
  throw new Rg(`too many indicies for array; expected ${A.length}, got ${g.length}`);
5642
5699
  }
5643
- function EE(g) {
5700
+ function oE(g) {
5644
5701
  throw new Rg(`index out of bounds for dimension with length ${g}`);
5645
5702
  }
5646
- function iE() {
5703
+ function aE() {
5647
5704
  throw new Rg("only slices with step >= 1 are supported");
5648
5705
  }
5649
- function oE(g, A) {
5650
- g.length > A.length && CE(g, A);
5706
+ function DE(g, A) {
5707
+ g.length > A.length && iE(g, A);
5651
5708
  }
5652
- function aE(g, A) {
5653
- return g = Math.trunc(g), g < 0 && (g = A + g), (g >= A || g < 0) && EE(A), g;
5709
+ function sE(g, A) {
5710
+ return g = Math.trunc(g), g < 0 && (g = A + g), (g >= A || g < 0) && oE(A), g;
5654
5711
  }
5655
- class DE {
5712
+ class hE {
5656
5713
  dim_sel;
5657
5714
  dim_len;
5658
5715
  dim_chunk_len;
5659
5716
  nitems;
5660
5717
  constructor({ dim_sel: A, dim_len: I, dim_chunk_len: B }) {
5661
- A = aE(A, I), this.dim_sel = A, this.dim_len = I, this.dim_chunk_len = B, this.nitems = 1;
5718
+ A = sE(A, I), this.dim_sel = A, this.dim_len = I, this.dim_chunk_len = B, this.nitems = 1;
5662
5719
  }
5663
5720
  *[Symbol.iterator]() {
5664
5721
  const A = Math.floor(this.dim_sel / this.dim_chunk_len), I = A * this.dim_chunk_len, B = this.dim_sel - I;
@@ -5674,12 +5731,12 @@ class gB {
5674
5731
  nitems;
5675
5732
  nchunks;
5676
5733
  constructor({ dim_sel: A, dim_len: I, dim_chunk_len: B }) {
5677
- const [Q, C, E] = BE(A, I);
5678
- this.start = Q, this.stop = C, this.step = E, this.step < 1 && iE(), 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);
5734
+ const [Q, C, E] = CE(A, I);
5735
+ this.start = Q, this.stop = C, this.step = E, this.step < 1 && aE(), 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);
5679
5736
  }
5680
5737
  *[Symbol.iterator]() {
5681
5738
  const A = Math.floor(this.start / this.dim_chunk_len), I = Math.ceil(this.stop / this.dim_chunk_len);
5682
- for (const B of IE(A, I)) {
5739
+ for (const B of BE(A, I)) {
5683
5740
  const Q = B * this.dim_chunk_len, C = Math.min(this.dim_len, (B + 1) * this.dim_chunk_len), E = C - Q;
5684
5741
  let i = 0, o = 0;
5685
5742
  if (this.start < Q) {
@@ -5700,15 +5757,15 @@ class gB {
5700
5757
  }
5701
5758
  }
5702
5759
  }
5703
- function sE(g, A) {
5760
+ function yE(g, A) {
5704
5761
  let I = [];
5705
- return g === null ? I = A.map((B) => SI(null)) : Array.isArray(g) && (I = g.map((B) => B ?? SI(null))), oE(I, A), I;
5762
+ return g === null ? I = A.map((B) => SI(null)) : Array.isArray(g) && (I = g.map((B) => B ?? SI(null))), DE(I, A), I;
5706
5763
  }
5707
- class hE {
5764
+ class tE {
5708
5765
  dim_indexers;
5709
5766
  shape;
5710
5767
  constructor({ selection: A, shape: I, chunk_shape: B }) {
5711
- this.dim_indexers = sE(A, I).map((Q, C) => new (typeof Q == "number" ? DE : gB)({
5768
+ this.dim_indexers = yE(A, I).map((Q, C) => new (typeof Q == "number" ? hE : gB)({
5712
5769
  // @ts-expect-error ts inference not strong enough to know correct chunk
5713
5770
  dim_sel: Q,
5714
5771
  dim_len: I[C],
@@ -5716,27 +5773,27 @@ class hE {
5716
5773
  })), this.shape = this.dim_indexers.filter((Q) => Q instanceof gB).map((Q) => Q.nitems);
5717
5774
  }
5718
5775
  *[Symbol.iterator]() {
5719
- for (const A of gE(...this.dim_indexers)) {
5776
+ for (const A of QE(...this.dim_indexers)) {
5720
5777
  const I = A.map((Q) => Q.dim_chunk_ix), B = A.map((Q) => "dim_out_sel" in Q ? { from: Q.dim_chunk_sel, to: Q.dim_out_sel } : { from: Q.dim_chunk_sel, to: null });
5721
5778
  yield { chunk_coords: I, mapping: B };
5722
5779
  }
5723
5780
  }
5724
5781
  }
5725
- function yE(g, A) {
5782
+ function GE(g, A) {
5726
5783
  return "get" in g ? g.get(A) : g[A];
5727
5784
  }
5728
- async function tE(g, A, I, B) {
5729
- let Q = OC(g), C = new hE({
5785
+ async function wE(g, A, I, B) {
5786
+ let Q = vC(g), C = new tE({
5730
5787
  selection: A,
5731
5788
  shape: g.shape,
5732
5789
  chunk_shape: g.chunks
5733
- }), E = B.prepare(new Q.TypedArray(C.shape.reduce((o, a) => o * a, 1)), C.shape, Q.get_strides(C.shape, I.order)), i = I.create_queue?.() ?? QE();
5790
+ }), E = B.prepare(new Q.TypedArray(C.shape.reduce((o, a) => o * a, 1)), C.shape, Q.get_strides(C.shape, I.order)), i = I.create_queue?.() ?? EE();
5734
5791
  for (const { chunk_coords: o, mapping: a } of C)
5735
5792
  i.add(async () => {
5736
5793
  let { data: D, shape: h, stride: y } = await g.getChunk(o, I.opts), G = B.prepare(D, h, y);
5737
5794
  B.set_from_chunk(E, G, a);
5738
5795
  });
5739
- return await i.onIdle(), C.shape.length === 0 ? yE(E.data, 0) : E;
5796
+ return await i.onIdle(), C.shape.length === 0 ? GE(E.data, 0) : E;
5740
5797
  }
5741
5798
  function Ng(g, A = 0, I) {
5742
5799
  let B = I ?? g.length - A;
@@ -5766,30 +5823,30 @@ function PI(g) {
5766
5823
  bytes_per_element: g.data.BYTES_PER_ELEMENT
5767
5824
  };
5768
5825
  }
5769
- function GE(g) {
5826
+ function FE(g) {
5770
5827
  return "chars" in g ? g.constructor.bind(null, g.chars) : g.constructor;
5771
5828
  }
5772
- function wE(g, A) {
5829
+ function nE(g, A) {
5773
5830
  if (globalThis.Array.isArray(g.data))
5774
5831
  return Ng([A]);
5775
- let I = GE(g.data), B = new I([A]);
5832
+ let I = FE(g.data), B = new I([A]);
5776
5833
  return new Uint8Array(B.buffer, B.byteOffset, B.byteLength);
5777
5834
  }
5778
- const FE = {
5835
+ const eE = {
5779
5836
  prepare(g, A, I) {
5780
5837
  return { data: g, shape: A, stride: I };
5781
5838
  },
5782
5839
  set_scalar(g, A, I) {
5783
5840
  let B = PI(g);
5784
- Ig(B, A, wE(g, I), B.bytes_per_element);
5841
+ Ig(B, A, nE(g, I), B.bytes_per_element);
5785
5842
  },
5786
5843
  set_from_chunk(g, A, I) {
5787
5844
  let B = PI(g);
5788
5845
  GI(B, PI(A), B.bytes_per_element, I);
5789
5846
  }
5790
5847
  };
5791
- async function nE(g, A = null, I = {}) {
5792
- return tE(g, A, I, FE);
5848
+ async function rE(g, A = null, I = {}) {
5849
+ return wE(g, A, I, eE);
5793
5850
  }
5794
5851
  function LB(g, A, I) {
5795
5852
  return I < 0 && A < g ? Math.floor((g - A - 1) / -I) + 1 : g < A ? Math.floor((A - g - 1) / I) + 1 : 0;
@@ -5831,8 +5888,8 @@ function GI(g, A, I, B) {
5831
5888
  }
5832
5889
  if (Q.to === null) {
5833
5890
  if (C.length === 0) {
5834
- let n = Q.from * I;
5835
- g.data.set(A.data.subarray(n, n + I), 0);
5891
+ let F = Q.from * I;
5892
+ g.data.set(A.data.subarray(F, F + I), 0);
5836
5893
  return;
5837
5894
  }
5838
5895
  GI(g, {
@@ -5841,29 +5898,29 @@ function GI(g, A, I, B) {
5841
5898
  }, I, C);
5842
5899
  return;
5843
5900
  }
5844
- const [D, h, y] = Q.to, [G, R, S] = Q.from, e = LB(D, h, y);
5901
+ const [D, h, y] = Q.to, [G, S, R] = Q.from, e = LB(D, h, y);
5845
5902
  if (C.length === 0) {
5846
- if (y === 1 && S === 1 && E === 1 && o === 1) {
5847
- let n = G * I, M = e * I;
5848
- g.data.set(A.data.subarray(n, n + M), D * I);
5903
+ if (y === 1 && R === 1 && E === 1 && o === 1) {
5904
+ let F = G * I, M = e * I;
5905
+ g.data.set(A.data.subarray(F, F + M), D * I);
5849
5906
  return;
5850
5907
  }
5851
- for (let n = 0; n < e; n++) {
5852
- let M = o * (G + S * n) * I;
5853
- g.data.set(A.data.subarray(M, M + I), E * (D + y * n) * I);
5908
+ for (let F = 0; F < e; F++) {
5909
+ let M = o * (G + R * F) * I;
5910
+ g.data.set(A.data.subarray(M, M + I), E * (D + y * F) * I);
5854
5911
  }
5855
5912
  return;
5856
5913
  }
5857
- for (let n = 0; n < e; n++)
5914
+ for (let F = 0; F < e; F++)
5858
5915
  GI({
5859
- data: g.data.subarray(E * (D + n * y) * I),
5916
+ data: g.data.subarray(E * (D + F * y) * I),
5860
5917
  stride: i
5861
5918
  }, {
5862
- data: A.data.subarray(o * (G + n * S) * I),
5919
+ data: A.data.subarray(o * (G + F * R) * I),
5863
5920
  stride: a
5864
5921
  }, I, C);
5865
5922
  }
5866
- async function eE(g, A) {
5923
+ async function SE(g, A) {
5867
5924
  const I = A.split("/"), B = I.pop();
5868
5925
  if (!B)
5869
5926
  throw new Error("Invalid path");
@@ -5880,7 +5937,7 @@ class cg {
5880
5937
  return this.#A;
5881
5938
  }
5882
5939
  async get(A) {
5883
- const I = await eE(this.#A, A.slice(1)).catch(
5940
+ const I = await SE(this.#A, A.slice(1)).catch(
5884
5941
  () => {
5885
5942
  }
5886
5943
  );
@@ -5909,7 +5966,7 @@ async function hI(g, A) {
5909
5966
  throw new Error(`Failed to open Zarr group at ${g}`);
5910
5967
  }
5911
5968
  }
5912
- async function rE(g, A) {
5969
+ async function RE(g, A) {
5913
5970
  if (A === "v2")
5914
5971
  try {
5915
5972
  return z.v2(g, { kind: "array", attrs: !1 });
@@ -5928,7 +5985,7 @@ async function rE(g, A) {
5928
5985
  throw new Error(`Failed to open Zarr array at ${g}`);
5929
5986
  }
5930
5987
  }
5931
- async function SE(g) {
5988
+ async function NE(g) {
5932
5989
  let A;
5933
5990
  switch (g.type) {
5934
5991
  case "fetch": {
@@ -5950,9 +6007,9 @@ async function SE(g) {
5950
6007
  }
5951
6008
  }
5952
6009
  const I = g.arrayPath ? A.resolve(g.arrayPath) : A;
5953
- return rE(I, g.zarrVersion);
6010
+ return RE(I, g.zarrVersion);
5954
6011
  }
5955
- function RE(g, A, I) {
6012
+ function cE(g, A, I) {
5956
6013
  if (g.store instanceof sI)
5957
6014
  return {
5958
6015
  type: "fetch",
@@ -9517,7 +9574,7 @@ return ret;
9517
9574
  });
9518
9575
  //# sourceMappingURL=worker_kernel-BYKAkuPZ.js.map
9519
9576
  `, BB = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", JB], { type: "text/javascript;charset=utf-8" });
9520
- function NE(g) {
9577
+ function UE(g) {
9521
9578
  let A;
9522
9579
  try {
9523
9580
  if (A = BB && (self.URL || self.webkitURL).createObjectURL(BB), !A) throw "";
@@ -9538,20 +9595,20 @@ function NE(g) {
9538
9595
  );
9539
9596
  }
9540
9597
  }
9541
- const cE = Math.min(navigator.hardwareConcurrency, 8);
9542
- let gA = [], UE = 0, YB = 0;
9598
+ const kE = Math.min(navigator.hardwareConcurrency, 8);
9599
+ let gA = [], LE = 0, YB = 0;
9543
9600
  const NA = /* @__PURE__ */ new Map(), RI = /* @__PURE__ */ new Set();
9544
9601
  function MB(g) {
9545
9602
  const A = gA.find((I) => I.worker === g);
9546
- return A || N.error(
9603
+ return A || c.error(
9547
9604
  "ZarrWorker",
9548
9605
  "Worker not found in pool - this should not happen"
9549
9606
  ), A;
9550
9607
  }
9551
- function kE(g, A) {
9608
+ function JE(g, A) {
9552
9609
  const { id: I, success: B } = g.data, Q = NA.get(I);
9553
9610
  if (!Q) {
9554
- RI.has(I) ? RI.delete(I) : N.warn(
9611
+ RI.has(I) ? RI.delete(I) : c.warn(
9555
9612
  "ZarrWorker",
9556
9613
  `Received response for unknown message ID ${I}:`,
9557
9614
  g.data
@@ -9560,20 +9617,20 @@ function kE(g, A) {
9560
9617
  }
9561
9618
  NA.delete(I), Q.abortListener && Q.abortSignal && Q.abortSignal.removeEventListener("abort", Q.abortListener);
9562
9619
  const C = MB(A);
9563
- C && C.pendingCount > 0 ? C.pendingCount-- : C && N.error(
9620
+ C && C.pendingCount > 0 ? C.pendingCount-- : C && c.error(
9564
9621
  "ZarrWorker",
9565
9622
  "Received message but no pending tasks - this should not happen"
9566
9623
  ), B && g.data.type === "getChunk" ? Q.resolve(g.data.chunk) : B || Q.reject(new Error(g.data.error || "Unknown worker error"));
9567
9624
  }
9568
9625
  function QB(g, A) {
9569
9626
  if (g instanceof MessageEvent) {
9570
- N.error(
9627
+ c.error(
9571
9628
  "ZarrWorker",
9572
9629
  "Message serialization error occurred - worker remains active"
9573
9630
  );
9574
9631
  return;
9575
9632
  }
9576
- N.error(
9633
+ c.error(
9577
9634
  "ZarrWorker",
9578
9635
  "Worker failed - replacing worker and canceling its in-flight messages",
9579
9636
  g.message
@@ -9593,26 +9650,26 @@ function QB(g, A) {
9593
9650
  worker: Q,
9594
9651
  pendingCount: 0,
9595
9652
  workerId: YB++
9596
- }), N.debug("ZarrWorker", "Replacement worker created successfully");
9653
+ }), c.debug("ZarrWorker", "Replacement worker created successfully");
9597
9654
  } catch (Q) {
9598
- N.error("ZarrWorker", "Failed to create replacement worker", Q);
9655
+ c.error("ZarrWorker", "Failed to create replacement worker", Q);
9599
9656
  }
9600
9657
  }
9601
9658
  function KB() {
9602
- const g = new NE();
9603
- return g.addEventListener("message", (A) => kE(A, g)), g.addEventListener("error", (A) => QB(A, g)), g.addEventListener(
9659
+ const g = new UE();
9660
+ return g.addEventListener("message", (A) => JE(A, g)), g.addEventListener("error", (A) => QB(A, g)), g.addEventListener(
9604
9661
  "messageerror",
9605
9662
  (A) => QB(A, g)
9606
9663
  ), g;
9607
9664
  }
9608
- function LE() {
9665
+ function YE() {
9609
9666
  if (gA.length === 0)
9610
9667
  throw new Error("Worker pool is not initialized");
9611
9668
  return gA.sort((g, A) => g.pendingCount - A.pendingCount)[0];
9612
9669
  }
9613
- async function JE(g, A, I) {
9670
+ async function ME(g, A, I) {
9614
9671
  return new Promise((B, Q) => {
9615
- const C = LE(), E = UE++, i = {
9672
+ const C = YE(), E = LE++, i = {
9616
9673
  resolve: B,
9617
9674
  reject: Q,
9618
9675
  workerId: C.workerId
@@ -9638,10 +9695,10 @@ async function JE(g, A, I) {
9638
9695
  });
9639
9696
  });
9640
9697
  }
9641
- function YE() {
9698
+ function KE() {
9642
9699
  if (!(gA.length > 0))
9643
9700
  try {
9644
- for (let g = 0; g < cE; g++) {
9701
+ for (let g = 0; g < kE; g++) {
9645
9702
  const A = KB();
9646
9703
  gA.push({
9647
9704
  worker: A,
@@ -9649,31 +9706,31 @@ function YE() {
9649
9706
  workerId: YB++
9650
9707
  });
9651
9708
  }
9652
- N.debug(
9709
+ c.debug(
9653
9710
  "ZarrWorker",
9654
9711
  `Initialized worker pool with ${gA.length} workers`
9655
9712
  );
9656
9713
  } catch {
9657
- N.warn("ZarrWorker", "Failed to create workers - clearing pool"), KE();
9714
+ c.warn("ZarrWorker", "Failed to create workers - clearing pool"), HE();
9658
9715
  return;
9659
9716
  }
9660
9717
  }
9661
- async function ME(g, A, I, B) {
9662
- YE();
9718
+ async function dE(g, A, I, B) {
9719
+ KE();
9663
9720
  try {
9664
- return await JE(A, I, B);
9721
+ return await ME(A, I, B);
9665
9722
  } catch (Q) {
9666
9723
  if (Q instanceof DOMException && Q.name === "AbortError")
9667
9724
  throw Q;
9668
- return N.warn("ZarrWorker", "Falling back to main thread", Q), await g.getChunk(I, B);
9725
+ return c.warn("ZarrWorker", "Falling back to main thread", Q), await g.getChunk(I, B);
9669
9726
  }
9670
9727
  }
9671
- function KE() {
9728
+ function HE() {
9672
9729
  for (const g of gA)
9673
9730
  g.worker.terminate();
9674
9731
  gA = [], NA.clear();
9675
9732
  }
9676
- class dE {
9733
+ class qE {
9677
9734
  promises_ = [];
9678
9735
  scheduler_;
9679
9736
  constructor(A) {
@@ -9686,14 +9743,14 @@ class dE {
9686
9743
  return Promise.all(this.promises_.map((A) => this.scheduler_.submit(A)));
9687
9744
  }
9688
9745
  }
9689
- class HE {
9746
+ class lE {
9690
9747
  metadata_;
9691
9748
  arrays_;
9692
9749
  arrayParams_;
9693
9750
  loaderAttributes_;
9694
9751
  dimensions_;
9695
9752
  constructor(A) {
9696
- this.metadata_ = A.metadata, this.arrays_ = A.arrays, this.arrayParams_ = A.arrayParams, this.loaderAttributes_ = qE(this.metadata_, this.arrays_), this.dimensions_ = lE(this.loaderAttributes_);
9753
+ this.metadata_ = A.metadata, this.arrays_ = A.arrays, this.arrayParams_ = A.arrayParams, this.loaderAttributes_ = fE(this.metadata_, this.arrays_), this.dimensions_ = pE(this.loaderAttributes_);
9697
9754
  }
9698
9755
  getSourceDimensionMap() {
9699
9756
  return this.dimensions_;
@@ -9701,7 +9758,7 @@ class HE {
9701
9758
  async loadChunkData(A, I) {
9702
9759
  const B = [];
9703
9760
  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);
9704
- const Q = this.arrays_[A.lod], C = this.arrayParams_[A.lod], E = await ME(Q, C, B, {
9761
+ const Q = this.arrays_[A.lod], C = this.arrayParams_[A.lod], E = await dE(Q, C, B, {
9705
9762
  signal: I
9706
9763
  });
9707
9764
  if (!pg(E.data))
@@ -9751,10 +9808,10 @@ class HE {
9751
9808
  const Q = this.loaderAttributes_[I], C = this.regionToIndices(A, Q), { scale: E, translation: i } = Q, o = this.arrays_[I];
9752
9809
  let a = {};
9753
9810
  B !== void 0 && (a = {
9754
- create_queue: () => new dE(B),
9811
+ create_queue: () => new qE(B),
9755
9812
  opts: { signal: B.abortSignal }
9756
9813
  });
9757
- const D = await nE(o, C, a);
9814
+ const D = await rE(o, C, a);
9758
9815
  if (!pg(D.data))
9759
9816
  throw new Error(
9760
9817
  `Subarray has an unsupported data type, data=${D.data.constructor.name}`
@@ -9769,9 +9826,9 @@ class HE {
9769
9826
  "Invalid row alignment value. Possible values are 1, 2, 4, or 8"
9770
9827
  );
9771
9828
  const y = (e) => {
9772
- const n = C[e];
9773
- return typeof n == "number" ? n * E[e] + i[e] : n.start === null ? i[e] : n.start * E[e] + i[e];
9774
- }, G = y(C.length - 1), R = y(C.length - 2);
9829
+ const F = C[e];
9830
+ return typeof F == "number" ? F * E[e] + i[e] : F.start === null ? i[e] : F.start * E[e] + i[e];
9831
+ }, G = y(C.length - 1), S = y(C.length - 2);
9775
9832
  return {
9776
9833
  state: "loaded",
9777
9834
  lod: I,
@@ -9793,7 +9850,7 @@ class HE {
9793
9850
  y: E[C.length - 2],
9794
9851
  z: 1
9795
9852
  },
9796
- offset: { x: G, y: R, z: 0 }
9853
+ offset: { x: G, y: S, z: 0 }
9797
9854
  };
9798
9855
  }
9799
9856
  getAttributes() {
@@ -9815,7 +9872,7 @@ class HE {
9815
9872
  return E;
9816
9873
  }
9817
9874
  }
9818
- function qE(g, A) {
9875
+ function fE(g, A) {
9819
9876
  const I = [], B = g.axes.length;
9820
9877
  for (let Q = 0; Q < g.datasets.length; Q++) {
9821
9878
  const C = g.datasets[Q], E = A[Q], i = C.coordinateTransformations[0].scale, o = C.coordinateTransformations.length === 2 ? C.coordinateTransformations[1].translation : new Array(B).fill(0);
@@ -9830,7 +9887,7 @@ function qE(g, A) {
9830
9887
  }
9831
9888
  return I;
9832
9889
  }
9833
- function lE(g) {
9890
+ function pE(g) {
9834
9891
  const A = g[0].dimensionNames, I = CB(A, "x"), B = CB(A, "y"), Q = {
9835
9892
  x: uA(A[I], I, g),
9836
9893
  y: uA(A[B], B, g),
@@ -9854,7 +9911,7 @@ function uA(g, A, I) {
9854
9911
  }))
9855
9912
  };
9856
9913
  }
9857
- function fE(g, A) {
9914
+ function mE(g, A) {
9858
9915
  return g.toLowerCase() === A.toLowerCase();
9859
9916
  }
9860
9917
  function CB(g, A) {
@@ -9866,7 +9923,7 @@ function CB(g, A) {
9866
9923
  return I;
9867
9924
  }
9868
9925
  function wI(g, A) {
9869
- return g.findIndex((I) => fE(I, A));
9926
+ return g.findIndex((I) => mE(I, A));
9870
9927
  }
9871
9928
  function EB(g) {
9872
9929
  let A = 1;
@@ -9922,7 +9979,7 @@ var gg;
9922
9979
  // second overwrites first
9923
9980
  });
9924
9981
  })(gg || (gg = {}));
9925
- const F = H.arrayToEnum([
9982
+ const n = H.arrayToEnum([
9926
9983
  "string",
9927
9984
  "nan",
9928
9985
  "number",
@@ -9946,23 +10003,23 @@ const F = H.arrayToEnum([
9946
10003
  ]), aA = (g) => {
9947
10004
  switch (typeof g) {
9948
10005
  case "undefined":
9949
- return F.undefined;
10006
+ return n.undefined;
9950
10007
  case "string":
9951
- return F.string;
10008
+ return n.string;
9952
10009
  case "number":
9953
- return isNaN(g) ? F.nan : F.number;
10010
+ return isNaN(g) ? n.nan : n.number;
9954
10011
  case "boolean":
9955
- return F.boolean;
10012
+ return n.boolean;
9956
10013
  case "function":
9957
- return F.function;
10014
+ return n.function;
9958
10015
  case "bigint":
9959
- return F.bigint;
10016
+ return n.bigint;
9960
10017
  case "symbol":
9961
- return F.symbol;
10018
+ return n.symbol;
9962
10019
  case "object":
9963
- return Array.isArray(g) ? F.array : g === null ? F.null : g.then && typeof g.then == "function" && g.catch && typeof g.catch == "function" ? F.promise : typeof Map < "u" && g instanceof Map ? F.map : typeof Set < "u" && g instanceof Set ? F.set : typeof Date < "u" && g instanceof Date ? F.date : F.object;
10020
+ return Array.isArray(g) ? n.array : g === null ? n.null : g.then && typeof g.then == "function" && g.catch && typeof g.catch == "function" ? n.promise : typeof Map < "u" && g instanceof Map ? n.map : typeof Set < "u" && g instanceof Set ? n.set : typeof Date < "u" && g instanceof Date ? n.date : n.object;
9964
10021
  default:
9965
- return F.unknown;
10022
+ return n.unknown;
9966
10023
  }
9967
10024
  }, t = H.arrayToEnum([
9968
10025
  "invalid_type",
@@ -9981,8 +10038,8 @@ const F = H.arrayToEnum([
9981
10038
  "invalid_intersection_types",
9982
10039
  "not_multiple_of",
9983
10040
  "not_finite"
9984
- ]), pE = (g) => JSON.stringify(g, null, 2).replace(/"([^"]+)":/g, "$1:");
9985
- class X extends Error {
10041
+ ]), uE = (g) => JSON.stringify(g, null, 2).replace(/"([^"]+)":/g, "$1:");
10042
+ class v extends Error {
9986
10043
  get errors() {
9987
10044
  return this.issues;
9988
10045
  }
@@ -10019,7 +10076,7 @@ class X extends Error {
10019
10076
  return Q(this), B;
10020
10077
  }
10021
10078
  static assert(A) {
10022
- if (!(A instanceof X))
10079
+ if (!(A instanceof v))
10023
10080
  throw new Error(`Not a ZodError: ${A}`);
10024
10081
  }
10025
10082
  toString() {
@@ -10041,12 +10098,12 @@ class X extends Error {
10041
10098
  return this.flatten();
10042
10099
  }
10043
10100
  }
10044
- X.create = (g) => new X(g);
10101
+ v.create = (g) => new v(g);
10045
10102
  const HA = (g, A) => {
10046
10103
  let I;
10047
10104
  switch (g.code) {
10048
10105
  case t.invalid_type:
10049
- g.received === F.undefined ? I = "Required" : I = `Expected ${g.expected}, received ${g.received}`;
10106
+ g.received === n.undefined ? I = "Required" : I = `Expected ${g.expected}, received ${g.received}`;
10050
10107
  break;
10051
10108
  case t.invalid_literal:
10052
10109
  I = `Invalid literal value, expected ${JSON.stringify(g.expected, H.jsonStringifyReplacer)}`;
@@ -10099,7 +10156,7 @@ const HA = (g, A) => {
10099
10156
  return { message: I };
10100
10157
  };
10101
10158
  let dB = HA;
10102
- function mE(g) {
10159
+ function TE(g) {
10103
10160
  dB = g;
10104
10161
  }
10105
10162
  function NI() {
@@ -10125,7 +10182,7 @@ const cI = (g) => {
10125
10182
  path: C,
10126
10183
  message: i
10127
10184
  };
10128
- }, uE = [];
10185
+ }, WE = [];
10129
10186
  function w(g, A) {
10130
10187
  const I = NI(), B = cI({
10131
10188
  issueData: A,
@@ -10144,7 +10201,7 @@ function w(g, A) {
10144
10201
  });
10145
10202
  g.common.issues.push(B);
10146
10203
  }
10147
- class P {
10204
+ class x {
10148
10205
  constructor() {
10149
10206
  this.value = "valid";
10150
10207
  }
@@ -10158,7 +10215,7 @@ class P {
10158
10215
  const B = [];
10159
10216
  for (const Q of I) {
10160
10217
  if (Q.status === "aborted")
10161
- return L;
10218
+ return k;
10162
10219
  Q.status === "dirty" && A.dirty(), B.push(Q.value);
10163
10220
  }
10164
10221
  return { status: A.value, value: B };
@@ -10172,22 +10229,22 @@ class P {
10172
10229
  value: E
10173
10230
  });
10174
10231
  }
10175
- return P.mergeObjectSync(A, B);
10232
+ return x.mergeObjectSync(A, B);
10176
10233
  }
10177
10234
  static mergeObjectSync(A, I) {
10178
10235
  const B = {};
10179
10236
  for (const Q of I) {
10180
10237
  const { key: C, value: E } = Q;
10181
10238
  if (C.status === "aborted" || E.status === "aborted")
10182
- return L;
10239
+ return k;
10183
10240
  C.status === "dirty" && A.dirty(), E.status === "dirty" && A.dirty(), C.value !== "__proto__" && (typeof E.value < "u" || Q.alwaysSet) && (B[C.value] = E.value);
10184
10241
  }
10185
10242
  return { status: A.value, value: B };
10186
10243
  }
10187
10244
  }
10188
- const L = Object.freeze({
10245
+ const k = Object.freeze({
10189
10246
  status: "aborted"
10190
- }), MA = (g) => ({ status: "dirty", value: g }), V = (g) => ({ status: "valid", value: g }), Bg = (g) => g.status === "aborted", Qg = (g) => g.status === "dirty", cA = (g) => g.status === "valid", vA = (g) => typeof Promise < "u" && g instanceof Promise;
10247
+ }), MA = (g) => ({ status: "dirty", value: g }), P = (g) => ({ status: "valid", value: g }), Bg = (g) => g.status === "aborted", Qg = (g) => g.status === "dirty", cA = (g) => g.status === "valid", vA = (g) => typeof Promise < "u" && g instanceof Promise;
10191
10248
  function UI(g, A, I, B) {
10192
10249
  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");
10193
10250
  return A.get(g);
@@ -10219,7 +10276,7 @@ const iB = (g, A) => {
10219
10276
  get error() {
10220
10277
  if (this._error)
10221
10278
  return this._error;
10222
- const I = new X(g.common.issues);
10279
+ const I = new v(g.common.issues);
10223
10280
  return this._error = I, this._error;
10224
10281
  }
10225
10282
  };
@@ -10255,7 +10312,7 @@ class d {
10255
10312
  }
10256
10313
  _processInputParams(A) {
10257
10314
  return {
10258
- status: new P(),
10315
+ status: new x(),
10259
10316
  ctx: {
10260
10317
  common: A.parent.common,
10261
10318
  data: A.data,
@@ -10456,14 +10513,14 @@ class d {
10456
10513
  return this.safeParse(null).success;
10457
10514
  }
10458
10515
  }
10459
- const TE = /^c[^\s-]{8,}$/i, WE = /^[0-9a-z]+$/, xE = /^[0-9A-HJKMNP-TV-Z]{26}$/i, bE = /^[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, ZE = /^[a-z0-9_-]{21}$/i, PE = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, OE = /^[-+]?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)?)??$/, VE = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, vE = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
10516
+ const xE = /^c[^\s-]{8,}$/i, bE = /^[0-9a-z]+$/, ZE = /^[0-9A-HJKMNP-TV-Z]{26}$/i, PE = /^[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, OE = /^[a-z0-9_-]{21}$/i, VE = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, vE = /^[-+]?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)?)??$/, XE = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, jE = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
10460
10517
  let OI;
10461
- const XE = /^(?:(?: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])$/, jE = /^(?:(?: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])$/, zE = /^(([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]))$/, _E = /^(([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])$/, $E = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Ai = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, qB = "((\\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])))", Ii = new RegExp(`^${qB}$`);
10518
+ const zE = /^(?:(?: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])$/, _E = /^(?:(?: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])$/, $E = /^(([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]))$/, Ai = /^(([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])$/, Ii = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, gi = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, qB = "((\\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])))", Bi = new RegExp(`^${qB}$`);
10462
10519
  function lB(g) {
10463
10520
  let A = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
10464
10521
  return g.precision ? A = `${A}\\.\\d{${g.precision}}` : g.precision == null && (A = `${A}(\\.\\d+)?`), A;
10465
10522
  }
10466
- function gi(g) {
10523
+ function Qi(g) {
10467
10524
  return new RegExp(`^${lB(g)}$`);
10468
10525
  }
10469
10526
  function fB(g) {
@@ -10471,11 +10528,11 @@ function fB(g) {
10471
10528
  const I = [];
10472
10529
  return I.push(g.local ? "Z?" : "Z"), g.offset && I.push("([+-]\\d{2}:?\\d{2})"), A = `${A}(${I.join("|")})`, new RegExp(`^${A}$`);
10473
10530
  }
10474
- function Bi(g, A) {
10475
- return !!((A === "v4" || !A) && XE.test(g) || (A === "v6" || !A) && zE.test(g));
10531
+ function Ci(g, A) {
10532
+ return !!((A === "v4" || !A) && zE.test(g) || (A === "v6" || !A) && $E.test(g));
10476
10533
  }
10477
- function Qi(g, A) {
10478
- if (!PE.test(g))
10534
+ function Ei(g, A) {
10535
+ if (!VE.test(g))
10479
10536
  return !1;
10480
10537
  try {
10481
10538
  const [I] = g.split("."), B = I.replace(/-/g, "+").replace(/_/g, "/").padEnd(I.length + (4 - I.length % 4) % 4, "="), Q = JSON.parse(atob(B));
@@ -10484,20 +10541,20 @@ function Qi(g, A) {
10484
10541
  return !1;
10485
10542
  }
10486
10543
  }
10487
- function Ci(g, A) {
10488
- return !!((A === "v4" || !A) && jE.test(g) || (A === "v6" || !A) && _E.test(g));
10544
+ function ii(g, A) {
10545
+ return !!((A === "v4" || !A) && _E.test(g) || (A === "v6" || !A) && Ai.test(g));
10489
10546
  }
10490
10547
  class $ extends d {
10491
10548
  _parse(A) {
10492
- if (this._def.coerce && (A.data = String(A.data)), this._getType(A) !== F.string) {
10549
+ if (this._def.coerce && (A.data = String(A.data)), this._getType(A) !== n.string) {
10493
10550
  const C = this._getOrReturnCtx(A);
10494
10551
  return w(C, {
10495
10552
  code: t.invalid_type,
10496
- expected: F.string,
10553
+ expected: n.string,
10497
10554
  received: C.parsedType
10498
- }), L;
10555
+ }), k;
10499
10556
  }
10500
- const B = new P();
10557
+ const B = new x();
10501
10558
  let Q;
10502
10559
  for (const C of this._def.checks)
10503
10560
  if (C.kind === "min")
@@ -10536,43 +10593,43 @@ class $ extends d {
10536
10593
  message: C.message
10537
10594
  }), B.dirty());
10538
10595
  } else if (C.kind === "email")
10539
- VE.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10596
+ XE.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10540
10597
  validation: "email",
10541
10598
  code: t.invalid_string,
10542
10599
  message: C.message
10543
10600
  }), B.dirty());
10544
10601
  else if (C.kind === "emoji")
10545
- OI || (OI = new RegExp(vE, "u")), OI.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10602
+ OI || (OI = new RegExp(jE, "u")), OI.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10546
10603
  validation: "emoji",
10547
10604
  code: t.invalid_string,
10548
10605
  message: C.message
10549
10606
  }), B.dirty());
10550
10607
  else if (C.kind === "uuid")
10551
- bE.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10608
+ PE.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10552
10609
  validation: "uuid",
10553
10610
  code: t.invalid_string,
10554
10611
  message: C.message
10555
10612
  }), B.dirty());
10556
10613
  else if (C.kind === "nanoid")
10557
- ZE.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10614
+ OE.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10558
10615
  validation: "nanoid",
10559
10616
  code: t.invalid_string,
10560
10617
  message: C.message
10561
10618
  }), B.dirty());
10562
10619
  else if (C.kind === "cuid")
10563
- TE.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10620
+ xE.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10564
10621
  validation: "cuid",
10565
10622
  code: t.invalid_string,
10566
10623
  message: C.message
10567
10624
  }), B.dirty());
10568
10625
  else if (C.kind === "cuid2")
10569
- WE.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10626
+ bE.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10570
10627
  validation: "cuid2",
10571
10628
  code: t.invalid_string,
10572
10629
  message: C.message
10573
10630
  }), B.dirty());
10574
10631
  else if (C.kind === "ulid")
10575
- xE.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10632
+ ZE.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10576
10633
  validation: "ulid",
10577
10634
  code: t.invalid_string,
10578
10635
  message: C.message
@@ -10607,35 +10664,35 @@ class $ extends d {
10607
10664
  code: t.invalid_string,
10608
10665
  validation: "datetime",
10609
10666
  message: C.message
10610
- }), B.dirty()) : C.kind === "date" ? Ii.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10667
+ }), B.dirty()) : C.kind === "date" ? Bi.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10611
10668
  code: t.invalid_string,
10612
10669
  validation: "date",
10613
10670
  message: C.message
10614
- }), B.dirty()) : C.kind === "time" ? gi(C).test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10671
+ }), B.dirty()) : C.kind === "time" ? Qi(C).test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10615
10672
  code: t.invalid_string,
10616
10673
  validation: "time",
10617
10674
  message: C.message
10618
- }), B.dirty()) : C.kind === "duration" ? OE.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10675
+ }), B.dirty()) : C.kind === "duration" ? vE.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10619
10676
  validation: "duration",
10620
10677
  code: t.invalid_string,
10621
10678
  message: C.message
10622
- }), B.dirty()) : C.kind === "ip" ? Bi(A.data, C.version) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10679
+ }), B.dirty()) : C.kind === "ip" ? Ci(A.data, C.version) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10623
10680
  validation: "ip",
10624
10681
  code: t.invalid_string,
10625
10682
  message: C.message
10626
- }), B.dirty()) : C.kind === "jwt" ? Qi(A.data, C.alg) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10683
+ }), B.dirty()) : C.kind === "jwt" ? Ei(A.data, C.alg) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10627
10684
  validation: "jwt",
10628
10685
  code: t.invalid_string,
10629
10686
  message: C.message
10630
- }), B.dirty()) : C.kind === "cidr" ? Ci(A.data, C.version) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10687
+ }), B.dirty()) : C.kind === "cidr" ? ii(A.data, C.version) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10631
10688
  validation: "cidr",
10632
10689
  code: t.invalid_string,
10633
10690
  message: C.message
10634
- }), B.dirty()) : C.kind === "base64" ? $E.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10691
+ }), B.dirty()) : C.kind === "base64" ? Ii.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10635
10692
  validation: "base64",
10636
10693
  code: t.invalid_string,
10637
10694
  message: C.message
10638
- }), B.dirty()) : C.kind === "base64url" ? Ai.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10695
+ }), B.dirty()) : C.kind === "base64url" ? gi.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
10639
10696
  validation: "base64url",
10640
10697
  code: t.invalid_string,
10641
10698
  message: C.message
@@ -10874,7 +10931,7 @@ $.create = (g) => {
10874
10931
  ...Y(g)
10875
10932
  });
10876
10933
  };
10877
- function Ei(g, A) {
10934
+ function oi(g, A) {
10878
10935
  const I = (g.toString().split(".")[1] || "").length, B = (A.toString().split(".")[1] || "").length, Q = I > B ? I : B, C = parseInt(g.toFixed(Q).replace(".", "")), E = parseInt(A.toFixed(Q).replace(".", ""));
10879
10936
  return C % E / Math.pow(10, Q);
10880
10937
  }
@@ -10883,16 +10940,16 @@ class sA extends d {
10883
10940
  super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
10884
10941
  }
10885
10942
  _parse(A) {
10886
- if (this._def.coerce && (A.data = Number(A.data)), this._getType(A) !== F.number) {
10943
+ if (this._def.coerce && (A.data = Number(A.data)), this._getType(A) !== n.number) {
10887
10944
  const C = this._getOrReturnCtx(A);
10888
10945
  return w(C, {
10889
10946
  code: t.invalid_type,
10890
- expected: F.number,
10947
+ expected: n.number,
10891
10948
  received: C.parsedType
10892
- }), L;
10949
+ }), k;
10893
10950
  }
10894
10951
  let B;
10895
- const Q = new P();
10952
+ const Q = new x();
10896
10953
  for (const C of this._def.checks)
10897
10954
  C.kind === "int" ? H.isInteger(A.data) || (B = this._getOrReturnCtx(A, B), w(B, {
10898
10955
  code: t.invalid_type,
@@ -10913,7 +10970,7 @@ class sA extends d {
10913
10970
  inclusive: C.inclusive,
10914
10971
  exact: !1,
10915
10972
  message: C.message
10916
- }), Q.dirty()) : C.kind === "multipleOf" ? Ei(A.data, C.value) !== 0 && (B = this._getOrReturnCtx(A, B), w(B, {
10973
+ }), Q.dirty()) : C.kind === "multipleOf" ? oi(A.data, C.value) !== 0 && (B = this._getOrReturnCtx(A, B), w(B, {
10917
10974
  code: t.not_multiple_of,
10918
10975
  multipleOf: C.value,
10919
10976
  message: C.message
@@ -11061,10 +11118,10 @@ class hA extends d {
11061
11118
  } catch {
11062
11119
  return this._getInvalidInput(A);
11063
11120
  }
11064
- if (this._getType(A) !== F.bigint)
11121
+ if (this._getType(A) !== n.bigint)
11065
11122
  return this._getInvalidInput(A);
11066
11123
  let B;
11067
- const Q = new P();
11124
+ const Q = new x();
11068
11125
  for (const C of this._def.checks)
11069
11126
  C.kind === "min" ? (C.inclusive ? A.data < C.value : A.data <= C.value) && (B = this._getOrReturnCtx(A, B), w(B, {
11070
11127
  code: t.too_small,
@@ -11089,9 +11146,9 @@ class hA extends d {
11089
11146
  const I = this._getOrReturnCtx(A);
11090
11147
  return w(I, {
11091
11148
  code: t.invalid_type,
11092
- expected: F.bigint,
11149
+ expected: n.bigint,
11093
11150
  received: I.parsedType
11094
- }), L;
11151
+ }), k;
11095
11152
  }
11096
11153
  gte(A, I) {
11097
11154
  return this.setLimit("min", A, !0, r.toString(I));
@@ -11188,15 +11245,15 @@ hA.create = (g) => {
11188
11245
  };
11189
11246
  class XA extends d {
11190
11247
  _parse(A) {
11191
- if (this._def.coerce && (A.data = !!A.data), this._getType(A) !== F.boolean) {
11248
+ if (this._def.coerce && (A.data = !!A.data), this._getType(A) !== n.boolean) {
11192
11249
  const B = this._getOrReturnCtx(A);
11193
11250
  return w(B, {
11194
11251
  code: t.invalid_type,
11195
- expected: F.boolean,
11252
+ expected: n.boolean,
11196
11253
  received: B.parsedType
11197
- }), L;
11254
+ }), k;
11198
11255
  }
11199
- return V(A.data);
11256
+ return P(A.data);
11200
11257
  }
11201
11258
  }
11202
11259
  XA.create = (g) => new XA({
@@ -11206,21 +11263,21 @@ XA.create = (g) => new XA({
11206
11263
  });
11207
11264
  class UA extends d {
11208
11265
  _parse(A) {
11209
- if (this._def.coerce && (A.data = new Date(A.data)), this._getType(A) !== F.date) {
11266
+ if (this._def.coerce && (A.data = new Date(A.data)), this._getType(A) !== n.date) {
11210
11267
  const C = this._getOrReturnCtx(A);
11211
11268
  return w(C, {
11212
11269
  code: t.invalid_type,
11213
- expected: F.date,
11270
+ expected: n.date,
11214
11271
  received: C.parsedType
11215
- }), L;
11272
+ }), k;
11216
11273
  }
11217
11274
  if (isNaN(A.data.getTime())) {
11218
11275
  const C = this._getOrReturnCtx(A);
11219
11276
  return w(C, {
11220
11277
  code: t.invalid_date
11221
- }), L;
11278
+ }), k;
11222
11279
  }
11223
- const B = new P();
11280
+ const B = new x();
11224
11281
  let Q;
11225
11282
  for (const C of this._def.checks)
11226
11283
  C.kind === "min" ? A.data.getTime() < C.value && (Q = this._getOrReturnCtx(A, Q), w(Q, {
@@ -11284,15 +11341,15 @@ UA.create = (g) => new UA({
11284
11341
  });
11285
11342
  class kI extends d {
11286
11343
  _parse(A) {
11287
- if (this._getType(A) !== F.symbol) {
11344
+ if (this._getType(A) !== n.symbol) {
11288
11345
  const B = this._getOrReturnCtx(A);
11289
11346
  return w(B, {
11290
11347
  code: t.invalid_type,
11291
- expected: F.symbol,
11348
+ expected: n.symbol,
11292
11349
  received: B.parsedType
11293
- }), L;
11350
+ }), k;
11294
11351
  }
11295
- return V(A.data);
11352
+ return P(A.data);
11296
11353
  }
11297
11354
  }
11298
11355
  kI.create = (g) => new kI({
@@ -11301,15 +11358,15 @@ kI.create = (g) => new kI({
11301
11358
  });
11302
11359
  class jA extends d {
11303
11360
  _parse(A) {
11304
- if (this._getType(A) !== F.undefined) {
11361
+ if (this._getType(A) !== n.undefined) {
11305
11362
  const B = this._getOrReturnCtx(A);
11306
11363
  return w(B, {
11307
11364
  code: t.invalid_type,
11308
- expected: F.undefined,
11365
+ expected: n.undefined,
11309
11366
  received: B.parsedType
11310
- }), L;
11367
+ }), k;
11311
11368
  }
11312
- return V(A.data);
11369
+ return P(A.data);
11313
11370
  }
11314
11371
  }
11315
11372
  jA.create = (g) => new jA({
@@ -11318,15 +11375,15 @@ jA.create = (g) => new jA({
11318
11375
  });
11319
11376
  class zA extends d {
11320
11377
  _parse(A) {
11321
- if (this._getType(A) !== F.null) {
11378
+ if (this._getType(A) !== n.null) {
11322
11379
  const B = this._getOrReturnCtx(A);
11323
11380
  return w(B, {
11324
11381
  code: t.invalid_type,
11325
- expected: F.null,
11382
+ expected: n.null,
11326
11383
  received: B.parsedType
11327
- }), L;
11384
+ }), k;
11328
11385
  }
11329
- return V(A.data);
11386
+ return P(A.data);
11330
11387
  }
11331
11388
  }
11332
11389
  zA.create = (g) => new zA({
@@ -11338,7 +11395,7 @@ class qA extends d {
11338
11395
  super(...arguments), this._any = !0;
11339
11396
  }
11340
11397
  _parse(A) {
11341
- return V(A.data);
11398
+ return P(A.data);
11342
11399
  }
11343
11400
  }
11344
11401
  qA.create = (g) => new qA({
@@ -11350,7 +11407,7 @@ class SA extends d {
11350
11407
  super(...arguments), this._unknown = !0;
11351
11408
  }
11352
11409
  _parse(A) {
11353
- return V(A.data);
11410
+ return P(A.data);
11354
11411
  }
11355
11412
  }
11356
11413
  SA.create = (g) => new SA({
@@ -11362,9 +11419,9 @@ class DA extends d {
11362
11419
  const I = this._getOrReturnCtx(A);
11363
11420
  return w(I, {
11364
11421
  code: t.invalid_type,
11365
- expected: F.never,
11422
+ expected: n.never,
11366
11423
  received: I.parsedType
11367
- }), L;
11424
+ }), k;
11368
11425
  }
11369
11426
  }
11370
11427
  DA.create = (g) => new DA({
@@ -11373,15 +11430,15 @@ DA.create = (g) => new DA({
11373
11430
  });
11374
11431
  class LI extends d {
11375
11432
  _parse(A) {
11376
- if (this._getType(A) !== F.undefined) {
11433
+ if (this._getType(A) !== n.undefined) {
11377
11434
  const B = this._getOrReturnCtx(A);
11378
11435
  return w(B, {
11379
11436
  code: t.invalid_type,
11380
- expected: F.void,
11437
+ expected: n.void,
11381
11438
  received: B.parsedType
11382
- }), L;
11439
+ }), k;
11383
11440
  }
11384
- return V(A.data);
11441
+ return P(A.data);
11385
11442
  }
11386
11443
  }
11387
11444
  LI.create = (g) => new LI({
@@ -11391,12 +11448,12 @@ LI.create = (g) => new LI({
11391
11448
  class BA extends d {
11392
11449
  _parse(A) {
11393
11450
  const { ctx: I, status: B } = this._processInputParams(A), Q = this._def;
11394
- if (I.parsedType !== F.array)
11451
+ if (I.parsedType !== n.array)
11395
11452
  return w(I, {
11396
11453
  code: t.invalid_type,
11397
- expected: F.array,
11454
+ expected: n.array,
11398
11455
  received: I.parsedType
11399
- }), L;
11456
+ }), k;
11400
11457
  if (Q.exactLength !== null) {
11401
11458
  const E = I.data.length > Q.exactLength.value, i = I.data.length < Q.exactLength.value;
11402
11459
  (E || i) && (w(I, {
@@ -11424,9 +11481,9 @@ class BA extends d {
11424
11481
  exact: !1,
11425
11482
  message: Q.maxLength.message
11426
11483
  }), B.dirty()), I.common.async)
11427
- return Promise.all([...I.data].map((E, i) => Q.type._parseAsync(new EA(I, E, I.path, i)))).then((E) => P.mergeArray(B, E));
11484
+ return Promise.all([...I.data].map((E, i) => Q.type._parseAsync(new EA(I, E, I.path, i)))).then((E) => x.mergeArray(B, E));
11428
11485
  const C = [...I.data].map((E, i) => Q.type._parseSync(new EA(I, E, I.path, i)));
11429
- return P.mergeArray(B, C);
11486
+ return x.mergeArray(B, C);
11430
11487
  }
11431
11488
  get element() {
11432
11489
  return this._def.type;
@@ -11488,13 +11545,13 @@ class f extends d {
11488
11545
  return this._cached = { shape: A, keys: I };
11489
11546
  }
11490
11547
  _parse(A) {
11491
- if (this._getType(A) !== F.object) {
11548
+ if (this._getType(A) !== n.object) {
11492
11549
  const a = this._getOrReturnCtx(A);
11493
11550
  return w(a, {
11494
11551
  code: t.invalid_type,
11495
- expected: F.object,
11552
+ expected: n.object,
11496
11553
  received: a.parsedType
11497
- }), L;
11554
+ }), k;
11498
11555
  }
11499
11556
  const { status: B, ctx: Q } = this._processInputParams(A), { shape: C, keys: E } = this._getCached(), i = [];
11500
11557
  if (!(this._def.catchall instanceof DA && this._def.unknownKeys === "strip"))
@@ -11548,7 +11605,7 @@ class f extends d {
11548
11605
  });
11549
11606
  }
11550
11607
  return a;
11551
- }).then((a) => P.mergeObjectSync(B, a)) : P.mergeObjectSync(B, o);
11608
+ }).then((a) => x.mergeObjectSync(B, a)) : x.mergeObjectSync(B, o);
11552
11609
  }
11553
11610
  get shape() {
11554
11611
  return this._def.shape();
@@ -11774,11 +11831,11 @@ class _A extends d {
11774
11831
  for (const i of C)
11775
11832
  if (i.result.status === "dirty")
11776
11833
  return I.common.issues.push(...i.ctx.common.issues), i.result;
11777
- const E = C.map((i) => new X(i.ctx.common.issues));
11834
+ const E = C.map((i) => new v(i.ctx.common.issues));
11778
11835
  return w(I, {
11779
11836
  code: t.invalid_union,
11780
11837
  unionErrors: E
11781
- }), L;
11838
+ }), k;
11782
11839
  }
11783
11840
  if (I.common.async)
11784
11841
  return Promise.all(B.map(async (C) => {
@@ -11821,11 +11878,11 @@ class _A extends d {
11821
11878
  }
11822
11879
  if (C)
11823
11880
  return I.common.issues.push(...C.ctx.common.issues), C.result;
11824
- const i = E.map((o) => new X(o));
11881
+ const i = E.map((o) => new v(o));
11825
11882
  return w(I, {
11826
11883
  code: t.invalid_union,
11827
11884
  unionErrors: i
11828
- }), L;
11885
+ }), k;
11829
11886
  }
11830
11887
  }
11831
11888
  get options() {
@@ -11841,12 +11898,12 @@ const oA = (g) => g instanceof II ? oA(g.schema) : g instanceof QA ? oA(g.innerT
11841
11898
  class qI extends d {
11842
11899
  _parse(A) {
11843
11900
  const { ctx: I } = this._processInputParams(A);
11844
- if (I.parsedType !== F.object)
11901
+ if (I.parsedType !== n.object)
11845
11902
  return w(I, {
11846
11903
  code: t.invalid_type,
11847
- expected: F.object,
11904
+ expected: n.object,
11848
11905
  received: I.parsedType
11849
- }), L;
11906
+ }), k;
11850
11907
  const B = this.discriminator, Q = I.data[B], C = this.optionsMap.get(Q);
11851
11908
  return C ? I.common.async ? C._parseAsync({
11852
11909
  data: I.data,
@@ -11860,7 +11917,7 @@ class qI extends d {
11860
11917
  code: t.invalid_union_discriminator,
11861
11918
  options: Array.from(this.optionsMap.keys()),
11862
11919
  path: [B]
11863
- }), L);
11920
+ }), k);
11864
11921
  }
11865
11922
  get discriminator() {
11866
11923
  return this._def.discriminator;
@@ -11904,7 +11961,7 @@ function Cg(g, A) {
11904
11961
  const I = aA(g), B = aA(A);
11905
11962
  if (g === A)
11906
11963
  return { valid: !0, data: g };
11907
- if (I === F.object && B === F.object) {
11964
+ if (I === n.object && B === n.object) {
11908
11965
  const Q = H.objectKeys(A), C = H.objectKeys(g).filter((i) => Q.indexOf(i) !== -1), E = { ...g, ...A };
11909
11966
  for (const i of C) {
11910
11967
  const o = Cg(g[i], A[i]);
@@ -11913,7 +11970,7 @@ function Cg(g, A) {
11913
11970
  E[i] = o.data;
11914
11971
  }
11915
11972
  return { valid: !0, data: E };
11916
- } else if (I === F.array && B === F.array) {
11973
+ } else if (I === n.array && B === n.array) {
11917
11974
  if (g.length !== A.length)
11918
11975
  return { valid: !1 };
11919
11976
  const Q = [];
@@ -11924,17 +11981,17 @@ function Cg(g, A) {
11924
11981
  Q.push(o.data);
11925
11982
  }
11926
11983
  return { valid: !0, data: Q };
11927
- } else return I === F.date && B === F.date && +g == +A ? { valid: !0, data: g } : { valid: !1 };
11984
+ } else return I === n.date && B === n.date && +g == +A ? { valid: !0, data: g } : { valid: !1 };
11928
11985
  }
11929
11986
  class $A extends d {
11930
11987
  _parse(A) {
11931
11988
  const { status: I, ctx: B } = this._processInputParams(A), Q = (C, E) => {
11932
11989
  if (Bg(C) || Bg(E))
11933
- return L;
11990
+ return k;
11934
11991
  const i = Cg(C.value, E.value);
11935
11992
  return i.valid ? ((Qg(C) || Qg(E)) && I.dirty(), { status: I.value, value: i.data }) : (w(B, {
11936
11993
  code: t.invalid_intersection_types
11937
- }), L);
11994
+ }), k);
11938
11995
  };
11939
11996
  return B.common.async ? Promise.all([
11940
11997
  this._def.left._parseAsync({
@@ -11967,12 +12024,12 @@ $A.create = (g, A, I) => new $A({
11967
12024
  class iA extends d {
11968
12025
  _parse(A) {
11969
12026
  const { status: I, ctx: B } = this._processInputParams(A);
11970
- if (B.parsedType !== F.array)
12027
+ if (B.parsedType !== n.array)
11971
12028
  return w(B, {
11972
12029
  code: t.invalid_type,
11973
- expected: F.array,
12030
+ expected: n.array,
11974
12031
  received: B.parsedType
11975
- }), L;
12032
+ }), k;
11976
12033
  if (B.data.length < this._def.items.length)
11977
12034
  return w(B, {
11978
12035
  code: t.too_small,
@@ -11980,7 +12037,7 @@ class iA extends d {
11980
12037
  inclusive: !0,
11981
12038
  exact: !1,
11982
12039
  type: "array"
11983
- }), L;
12040
+ }), k;
11984
12041
  !this._def.rest && B.data.length > this._def.items.length && (w(B, {
11985
12042
  code: t.too_big,
11986
12043
  maximum: this._def.items.length,
@@ -11992,7 +12049,7 @@ class iA extends d {
11992
12049
  const o = this._def.items[i] || this._def.rest;
11993
12050
  return o ? o._parse(new EA(B, E, B.path, i)) : null;
11994
12051
  }).filter((E) => !!E);
11995
- return B.common.async ? Promise.all(C).then((E) => P.mergeArray(I, E)) : P.mergeArray(I, C);
12052
+ return B.common.async ? Promise.all(C).then((E) => x.mergeArray(I, E)) : x.mergeArray(I, C);
11996
12053
  }
11997
12054
  get items() {
11998
12055
  return this._def.items;
@@ -12023,12 +12080,12 @@ class AI extends d {
12023
12080
  }
12024
12081
  _parse(A) {
12025
12082
  const { status: I, ctx: B } = this._processInputParams(A);
12026
- if (B.parsedType !== F.object)
12083
+ if (B.parsedType !== n.object)
12027
12084
  return w(B, {
12028
12085
  code: t.invalid_type,
12029
- expected: F.object,
12086
+ expected: n.object,
12030
12087
  received: B.parsedType
12031
- }), L;
12088
+ }), k;
12032
12089
  const Q = [], C = this._def.keyType, E = this._def.valueType;
12033
12090
  for (const i in B.data)
12034
12091
  Q.push({
@@ -12036,7 +12093,7 @@ class AI extends d {
12036
12093
  value: E._parse(new EA(B, B.data[i], B.path, i)),
12037
12094
  alwaysSet: i in B.data
12038
12095
  });
12039
- return B.common.async ? P.mergeObjectAsync(I, Q) : P.mergeObjectSync(I, Q);
12096
+ return B.common.async ? x.mergeObjectAsync(I, Q) : x.mergeObjectSync(I, Q);
12040
12097
  }
12041
12098
  get element() {
12042
12099
  return this._def.valueType;
@@ -12064,12 +12121,12 @@ class JI extends d {
12064
12121
  }
12065
12122
  _parse(A) {
12066
12123
  const { status: I, ctx: B } = this._processInputParams(A);
12067
- if (B.parsedType !== F.map)
12124
+ if (B.parsedType !== n.map)
12068
12125
  return w(B, {
12069
12126
  code: t.invalid_type,
12070
- expected: F.map,
12127
+ expected: n.map,
12071
12128
  received: B.parsedType
12072
- }), L;
12129
+ }), k;
12073
12130
  const Q = this._def.keyType, C = this._def.valueType, E = [...B.data.entries()].map(([i, o], a) => ({
12074
12131
  key: Q._parse(new EA(B, i, B.path, [a, "key"])),
12075
12132
  value: C._parse(new EA(B, o, B.path, [a, "value"]))
@@ -12080,7 +12137,7 @@ class JI extends d {
12080
12137
  for (const o of E) {
12081
12138
  const a = await o.key, D = await o.value;
12082
12139
  if (a.status === "aborted" || D.status === "aborted")
12083
- return L;
12140
+ return k;
12084
12141
  (a.status === "dirty" || D.status === "dirty") && I.dirty(), i.set(a.value, D.value);
12085
12142
  }
12086
12143
  return { status: I.value, value: i };
@@ -12090,7 +12147,7 @@ class JI extends d {
12090
12147
  for (const o of E) {
12091
12148
  const a = o.key, D = o.value;
12092
12149
  if (a.status === "aborted" || D.status === "aborted")
12093
- return L;
12150
+ return k;
12094
12151
  (a.status === "dirty" || D.status === "dirty") && I.dirty(), i.set(a.value, D.value);
12095
12152
  }
12096
12153
  return { status: I.value, value: i };
@@ -12106,12 +12163,12 @@ JI.create = (g, A, I) => new JI({
12106
12163
  class kA extends d {
12107
12164
  _parse(A) {
12108
12165
  const { status: I, ctx: B } = this._processInputParams(A);
12109
- if (B.parsedType !== F.set)
12166
+ if (B.parsedType !== n.set)
12110
12167
  return w(B, {
12111
12168
  code: t.invalid_type,
12112
- expected: F.set,
12169
+ expected: n.set,
12113
12170
  received: B.parsedType
12114
- }), L;
12171
+ }), k;
12115
12172
  const Q = this._def;
12116
12173
  Q.minSize !== null && B.data.size < Q.minSize.value && (w(B, {
12117
12174
  code: t.too_small,
@@ -12133,7 +12190,7 @@ class kA extends d {
12133
12190
  const a = /* @__PURE__ */ new Set();
12134
12191
  for (const D of o) {
12135
12192
  if (D.status === "aborted")
12136
- return L;
12193
+ return k;
12137
12194
  D.status === "dirty" && I.dirty(), a.add(D.value);
12138
12195
  }
12139
12196
  return { status: I.value, value: a };
@@ -12173,12 +12230,12 @@ class KA extends d {
12173
12230
  }
12174
12231
  _parse(A) {
12175
12232
  const { ctx: I } = this._processInputParams(A);
12176
- if (I.parsedType !== F.function)
12233
+ if (I.parsedType !== n.function)
12177
12234
  return w(I, {
12178
12235
  code: t.invalid_type,
12179
- expected: F.function,
12236
+ expected: n.function,
12180
12237
  received: I.parsedType
12181
- }), L;
12238
+ }), k;
12182
12239
  function B(i, o) {
12183
12240
  return cI({
12184
12241
  data: i,
@@ -12214,8 +12271,8 @@ class KA extends d {
12214
12271
  const C = { errorMap: I.common.contextualErrorMap }, E = I.data;
12215
12272
  if (this._def.returns instanceof lA) {
12216
12273
  const i = this;
12217
- return V(async function(...o) {
12218
- const a = new X([]), D = await i._def.args.parseAsync(o, C).catch((G) => {
12274
+ return P(async function(...o) {
12275
+ const a = new v([]), D = await i._def.args.parseAsync(o, C).catch((G) => {
12219
12276
  throw a.addIssue(B(o, G)), a;
12220
12277
  }), h = await Reflect.apply(E, this, D);
12221
12278
  return await i._def.returns._def.type.parseAsync(h, C).catch((G) => {
@@ -12224,13 +12281,13 @@ class KA extends d {
12224
12281
  });
12225
12282
  } else {
12226
12283
  const i = this;
12227
- return V(function(...o) {
12284
+ return P(function(...o) {
12228
12285
  const a = i._def.args.safeParse(o, C);
12229
12286
  if (!a.success)
12230
- throw new X([B(o, a.error)]);
12287
+ throw new v([B(o, a.error)]);
12231
12288
  const D = Reflect.apply(E, this, a.data), h = i._def.returns.safeParse(D, C);
12232
12289
  if (!h.success)
12233
- throw new X([Q(D, h.error)]);
12290
+ throw new v([Q(D, h.error)]);
12234
12291
  return h.data;
12235
12292
  });
12236
12293
  }
@@ -12290,7 +12347,7 @@ class gI extends d {
12290
12347
  received: I.data,
12291
12348
  code: t.invalid_literal,
12292
12349
  expected: this._def.value
12293
- }), L;
12350
+ }), k;
12294
12351
  }
12295
12352
  return { status: "valid", value: A.data };
12296
12353
  }
@@ -12321,7 +12378,7 @@ class yA extends d {
12321
12378
  expected: H.joinValues(B),
12322
12379
  received: I.parsedType,
12323
12380
  code: t.invalid_type
12324
- }), L;
12381
+ }), k;
12325
12382
  }
12326
12383
  if (UI(this, WA) || HB(this, WA, new Set(this._def.values)), !UI(this, WA).has(A.data)) {
12327
12384
  const I = this._getOrReturnCtx(A), B = this._def.values;
@@ -12329,9 +12386,9 @@ class yA extends d {
12329
12386
  received: I.data,
12330
12387
  code: t.invalid_enum_value,
12331
12388
  options: B
12332
- }), L;
12389
+ }), k;
12333
12390
  }
12334
- return V(A.data);
12391
+ return P(A.data);
12335
12392
  }
12336
12393
  get options() {
12337
12394
  return this._def.values;
@@ -12375,13 +12432,13 @@ class BI extends d {
12375
12432
  }
12376
12433
  _parse(A) {
12377
12434
  const I = H.getValidEnumValues(this._def.values), B = this._getOrReturnCtx(A);
12378
- if (B.parsedType !== F.string && B.parsedType !== F.number) {
12435
+ if (B.parsedType !== n.string && B.parsedType !== n.number) {
12379
12436
  const Q = H.objectValues(I);
12380
12437
  return w(B, {
12381
12438
  expected: H.joinValues(Q),
12382
12439
  received: B.parsedType,
12383
12440
  code: t.invalid_type
12384
- }), L;
12441
+ }), k;
12385
12442
  }
12386
12443
  if (UI(this, xA) || HB(this, xA, new Set(H.getValidEnumValues(this._def.values))), !UI(this, xA).has(A.data)) {
12387
12444
  const Q = H.objectValues(I);
@@ -12389,9 +12446,9 @@ class BI extends d {
12389
12446
  received: B.data,
12390
12447
  code: t.invalid_enum_value,
12391
12448
  options: Q
12392
- }), L;
12449
+ }), k;
12393
12450
  }
12394
- return V(A.data);
12451
+ return P(A.data);
12395
12452
  }
12396
12453
  get enum() {
12397
12454
  return this._def.values;
@@ -12409,14 +12466,14 @@ class lA extends d {
12409
12466
  }
12410
12467
  _parse(A) {
12411
12468
  const { ctx: I } = this._processInputParams(A);
12412
- if (I.parsedType !== F.promise && I.common.async === !1)
12469
+ if (I.parsedType !== n.promise && I.common.async === !1)
12413
12470
  return w(I, {
12414
12471
  code: t.invalid_type,
12415
- expected: F.promise,
12472
+ expected: n.promise,
12416
12473
  received: I.parsedType
12417
- }), L;
12418
- const B = I.parsedType === F.promise ? I.data : Promise.resolve(I.data);
12419
- return V(B.then((Q) => this._def.type.parseAsync(Q, {
12474
+ }), k;
12475
+ const B = I.parsedType === n.promise ? I.data : Promise.resolve(I.data);
12476
+ return P(B.then((Q) => this._def.type.parseAsync(Q, {
12420
12477
  path: I.path,
12421
12478
  errorMap: I.common.contextualErrorMap
12422
12479
  })));
@@ -12448,23 +12505,23 @@ class QA extends d {
12448
12505
  if (B.common.async)
12449
12506
  return Promise.resolve(E).then(async (i) => {
12450
12507
  if (I.value === "aborted")
12451
- return L;
12508
+ return k;
12452
12509
  const o = await this._def.schema._parseAsync({
12453
12510
  data: i,
12454
12511
  path: B.path,
12455
12512
  parent: B
12456
12513
  });
12457
- return o.status === "aborted" ? L : o.status === "dirty" || I.value === "dirty" ? MA(o.value) : o;
12514
+ return o.status === "aborted" ? k : o.status === "dirty" || I.value === "dirty" ? MA(o.value) : o;
12458
12515
  });
12459
12516
  {
12460
12517
  if (I.value === "aborted")
12461
- return L;
12518
+ return k;
12462
12519
  const i = this._def.schema._parseSync({
12463
12520
  data: E,
12464
12521
  path: B.path,
12465
12522
  parent: B
12466
12523
  });
12467
- return i.status === "aborted" ? L : i.status === "dirty" || I.value === "dirty" ? MA(i.value) : i;
12524
+ return i.status === "aborted" ? k : i.status === "dirty" || I.value === "dirty" ? MA(i.value) : i;
12468
12525
  }
12469
12526
  }
12470
12527
  if (Q.type === "refinement") {
@@ -12482,9 +12539,9 @@ class QA extends d {
12482
12539
  path: B.path,
12483
12540
  parent: B
12484
12541
  });
12485
- return i.status === "aborted" ? L : (i.status === "dirty" && I.dirty(), E(i.value), { status: I.value, value: i.value });
12542
+ return i.status === "aborted" ? k : (i.status === "dirty" && I.dirty(), E(i.value), { status: I.value, value: i.value });
12486
12543
  } else
12487
- return this._def.schema._parseAsync({ data: B.data, path: B.path, parent: B }).then((i) => i.status === "aborted" ? L : (i.status === "dirty" && I.dirty(), E(i.value).then(() => ({ status: I.value, value: i.value }))));
12544
+ return this._def.schema._parseAsync({ data: B.data, path: B.path, parent: B }).then((i) => i.status === "aborted" ? k : (i.status === "dirty" && I.dirty(), E(i.value).then(() => ({ status: I.value, value: i.value }))));
12488
12545
  }
12489
12546
  if (Q.type === "transform")
12490
12547
  if (B.common.async === !1) {
@@ -12518,7 +12575,7 @@ QA.createWithPreprocess = (g, A, I) => new QA({
12518
12575
  });
12519
12576
  class CA extends d {
12520
12577
  _parse(A) {
12521
- return this._getType(A) === F.undefined ? V(void 0) : this._def.innerType._parse(A);
12578
+ return this._getType(A) === n.undefined ? P(void 0) : this._def.innerType._parse(A);
12522
12579
  }
12523
12580
  unwrap() {
12524
12581
  return this._def.innerType;
@@ -12531,7 +12588,7 @@ CA.create = (g, A) => new CA({
12531
12588
  });
12532
12589
  class tA extends d {
12533
12590
  _parse(A) {
12534
- return this._getType(A) === F.null ? V(null) : this._def.innerType._parse(A);
12591
+ return this._getType(A) === n.null ? P(null) : this._def.innerType._parse(A);
12535
12592
  }
12536
12593
  unwrap() {
12537
12594
  return this._def.innerType;
@@ -12546,7 +12603,7 @@ class QI extends d {
12546
12603
  _parse(A) {
12547
12604
  const { ctx: I } = this._processInputParams(A);
12548
12605
  let B = I.data;
12549
- return I.parsedType === F.undefined && (B = this._def.defaultValue()), this._def.innerType._parse({
12606
+ return I.parsedType === n.undefined && (B = this._def.defaultValue()), this._def.innerType._parse({
12550
12607
  data: B,
12551
12608
  path: I.path,
12552
12609
  parent: I
@@ -12581,7 +12638,7 @@ class CI extends d {
12581
12638
  status: "valid",
12582
12639
  value: C.status === "valid" ? C.value : this._def.catchValue({
12583
12640
  get error() {
12584
- return new X(B.common.issues);
12641
+ return new v(B.common.issues);
12585
12642
  },
12586
12643
  input: B.data
12587
12644
  })
@@ -12589,7 +12646,7 @@ class CI extends d {
12589
12646
  status: "valid",
12590
12647
  value: Q.status === "valid" ? Q.value : this._def.catchValue({
12591
12648
  get error() {
12592
- return new X(B.common.issues);
12649
+ return new v(B.common.issues);
12593
12650
  },
12594
12651
  input: B.data
12595
12652
  })
@@ -12607,13 +12664,13 @@ CI.create = (g, A) => new CI({
12607
12664
  });
12608
12665
  class YI extends d {
12609
12666
  _parse(A) {
12610
- if (this._getType(A) !== F.nan) {
12667
+ if (this._getType(A) !== n.nan) {
12611
12668
  const B = this._getOrReturnCtx(A);
12612
12669
  return w(B, {
12613
12670
  code: t.invalid_type,
12614
- expected: F.nan,
12671
+ expected: n.nan,
12615
12672
  received: B.parsedType
12616
- }), L;
12673
+ }), k;
12617
12674
  }
12618
12675
  return { status: "valid", value: A.data };
12619
12676
  }
@@ -12622,7 +12679,7 @@ YI.create = (g) => new YI({
12622
12679
  typeName: U.ZodNaN,
12623
12680
  ...Y(g)
12624
12681
  });
12625
- const ii = Symbol("zod_brand");
12682
+ const ai = Symbol("zod_brand");
12626
12683
  class Ug extends d {
12627
12684
  _parse(A) {
12628
12685
  const { ctx: I } = this._processInputParams(A), B = I.data;
@@ -12646,7 +12703,7 @@ class yI extends d {
12646
12703
  path: B.path,
12647
12704
  parent: B
12648
12705
  });
12649
- return C.status === "aborted" ? L : C.status === "dirty" ? (I.dirty(), MA(C.value)) : this._def.out._parseAsync({
12706
+ return C.status === "aborted" ? k : C.status === "dirty" ? (I.dirty(), MA(C.value)) : this._def.out._parseAsync({
12650
12707
  data: C.value,
12651
12708
  path: B.path,
12652
12709
  parent: B
@@ -12658,7 +12715,7 @@ class yI extends d {
12658
12715
  path: B.path,
12659
12716
  parent: B
12660
12717
  });
12661
- return Q.status === "aborted" ? L : Q.status === "dirty" ? (I.dirty(), {
12718
+ return Q.status === "aborted" ? k : Q.status === "dirty" ? (I.dirty(), {
12662
12719
  status: "dirty",
12663
12720
  value: Q.value
12664
12721
  }) : this._def.out._parseSync({
@@ -12712,16 +12769,16 @@ function mB(g, A = {}, I) {
12712
12769
  }
12713
12770
  }) : qA.create();
12714
12771
  }
12715
- const oi = {
12772
+ const Di = {
12716
12773
  object: f.lazycreate
12717
12774
  };
12718
12775
  var U;
12719
12776
  (function(g) {
12720
12777
  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";
12721
12778
  })(U || (U = {}));
12722
- const ai = (g, A = {
12779
+ const si = (g, A = {
12723
12780
  message: `Input not instance of ${g.name}`
12724
- }) => mB((I) => I instanceof g, A), uB = $.create, TB = sA.create, Di = YI.create, si = hA.create, WB = XA.create, hi = UA.create, yi = kI.create, ti = jA.create, Gi = zA.create, wi = qA.create, Fi = SA.create, ni = DA.create, ei = LI.create, ri = BA.create, Si = f.create, Ri = f.strictCreate, Ni = _A.create, ci = qI.create, Ui = $A.create, ki = iA.create, Li = AI.create, Ji = JI.create, Yi = kA.create, Mi = KA.create, Ki = II.create, di = gI.create, Hi = yA.create, qi = BI.create, li = lA.create, aB = QA.create, fi = CA.create, pi = tA.create, mi = QA.createWithPreprocess, ui = yI.create, Ti = () => uB().optional(), Wi = () => TB().optional(), xi = () => WB().optional(), bi = {
12781
+ }) => mB((I) => I instanceof g, A), uB = $.create, TB = sA.create, hi = YI.create, yi = hA.create, WB = XA.create, ti = UA.create, Gi = kI.create, wi = jA.create, Fi = zA.create, ni = qA.create, ei = SA.create, ri = DA.create, Si = LI.create, Ri = BA.create, Ni = f.create, ci = f.strictCreate, Ui = _A.create, ki = qI.create, Li = $A.create, Ji = iA.create, Yi = AI.create, Mi = JI.create, Ki = kA.create, di = KA.create, Hi = II.create, qi = gI.create, li = yA.create, fi = BI.create, pi = lA.create, aB = QA.create, mi = CA.create, ui = tA.create, Ti = QA.createWithPreprocess, Wi = yI.create, xi = () => uB().optional(), bi = () => TB().optional(), Zi = () => WB().optional(), Pi = {
12725
12782
  string: (g) => $.create({ ...g, coerce: !0 }),
12726
12783
  number: (g) => sA.create({ ...g, coerce: !0 }),
12727
12784
  boolean: (g) => XA.create({
@@ -12730,19 +12787,19 @@ const ai = (g, A = {
12730
12787
  }),
12731
12788
  bigint: (g) => hA.create({ ...g, coerce: !0 }),
12732
12789
  date: (g) => UA.create({ ...g, coerce: !0 })
12733
- }, Zi = L;
12790
+ }, Oi = k;
12734
12791
  var s = /* @__PURE__ */ Object.freeze({
12735
12792
  __proto__: null,
12736
12793
  defaultErrorMap: HA,
12737
- setErrorMap: mE,
12794
+ setErrorMap: TE,
12738
12795
  getErrorMap: NI,
12739
12796
  makeIssue: cI,
12740
- EMPTY_PATH: uE,
12797
+ EMPTY_PATH: WE,
12741
12798
  addIssueToContext: w,
12742
- ParseStatus: P,
12743
- INVALID: L,
12799
+ ParseStatus: x,
12800
+ INVALID: k,
12744
12801
  DIRTY: MA,
12745
- OK: V,
12802
+ OK: P,
12746
12803
  isAborted: Bg,
12747
12804
  isDirty: Qg,
12748
12805
  isValid: cA,
@@ -12753,7 +12810,7 @@ var s = /* @__PURE__ */ Object.freeze({
12753
12810
  get objectUtil() {
12754
12811
  return gg;
12755
12812
  },
12756
- ZodParsedType: F,
12813
+ ZodParsedType: n,
12757
12814
  getParsedType: aA,
12758
12815
  ZodType: d,
12759
12816
  datetimeRegex: fB,
@@ -12791,63 +12848,63 @@ var s = /* @__PURE__ */ Object.freeze({
12791
12848
  ZodDefault: QI,
12792
12849
  ZodCatch: CI,
12793
12850
  ZodNaN: YI,
12794
- BRAND: ii,
12851
+ BRAND: ai,
12795
12852
  ZodBranded: Ug,
12796
12853
  ZodPipeline: yI,
12797
12854
  ZodReadonly: EI,
12798
12855
  custom: mB,
12799
12856
  Schema: d,
12800
12857
  ZodSchema: d,
12801
- late: oi,
12858
+ late: Di,
12802
12859
  get ZodFirstPartyTypeKind() {
12803
12860
  return U;
12804
12861
  },
12805
- coerce: bi,
12806
- any: wi,
12807
- array: ri,
12808
- bigint: si,
12862
+ coerce: Pi,
12863
+ any: ni,
12864
+ array: Ri,
12865
+ bigint: yi,
12809
12866
  boolean: WB,
12810
- date: hi,
12811
- discriminatedUnion: ci,
12867
+ date: ti,
12868
+ discriminatedUnion: ki,
12812
12869
  effect: aB,
12813
- enum: Hi,
12814
- function: Mi,
12815
- instanceof: ai,
12816
- intersection: Ui,
12817
- lazy: Ki,
12818
- literal: di,
12819
- map: Ji,
12820
- nan: Di,
12821
- nativeEnum: qi,
12822
- never: ni,
12823
- null: Gi,
12824
- nullable: pi,
12870
+ enum: li,
12871
+ function: di,
12872
+ instanceof: si,
12873
+ intersection: Li,
12874
+ lazy: Hi,
12875
+ literal: qi,
12876
+ map: Mi,
12877
+ nan: hi,
12878
+ nativeEnum: fi,
12879
+ never: ri,
12880
+ null: Fi,
12881
+ nullable: ui,
12825
12882
  number: TB,
12826
- object: Si,
12827
- oboolean: xi,
12828
- onumber: Wi,
12829
- optional: fi,
12830
- ostring: Ti,
12831
- pipeline: ui,
12832
- preprocess: mi,
12833
- promise: li,
12834
- record: Li,
12835
- set: Yi,
12836
- strictObject: Ri,
12883
+ object: Ni,
12884
+ oboolean: Zi,
12885
+ onumber: bi,
12886
+ optional: mi,
12887
+ ostring: xi,
12888
+ pipeline: Wi,
12889
+ preprocess: Ti,
12890
+ promise: pi,
12891
+ record: Yi,
12892
+ set: Ki,
12893
+ strictObject: ci,
12837
12894
  string: uB,
12838
- symbol: yi,
12895
+ symbol: Gi,
12839
12896
  transformer: aB,
12840
- tuple: ki,
12841
- undefined: ti,
12842
- union: Ni,
12843
- unknown: Fi,
12844
- void: ei,
12845
- NEVER: Zi,
12897
+ tuple: Ji,
12898
+ undefined: wi,
12899
+ union: Ui,
12900
+ unknown: ei,
12901
+ void: Si,
12902
+ NEVER: Oi,
12846
12903
  ZodIssueCode: t,
12847
- quotelessJson: pE,
12848
- ZodError: X
12904
+ quotelessJson: uE,
12905
+ ZodError: v
12849
12906
  });
12850
- const Pi = s.object({
12907
+ const Vi = s.object({
12851
12908
  /**The multiscale datasets for this image*/
12852
12909
  multiscales: s.array(
12853
12910
  s.object({
@@ -12975,7 +13032,7 @@ const Pi = s.object({
12975
13032
  projection: s.string().optional()
12976
13033
  }).optional()
12977
13034
  }).optional()
12978
- }).describe("JSON from OME-NGFF .zattrs"), Oi = s.object({
13035
+ }).describe("JSON from OME-NGFF .zattrs"), vi = s.object({
12979
13036
  plate: s.object({
12980
13037
  /**The acquisitions for this plate*/
12981
13038
  acquisitions: s.array(
@@ -13034,7 +13091,7 @@ const Pi = s.object({
13034
13091
  })
13035
13092
  ).min(1).describe("The wells of the plate")
13036
13093
  }).optional()
13037
- }).describe("JSON from OME-NGFF .zattrs"), Vi = s.object({
13094
+ }).describe("JSON from OME-NGFF .zattrs"), Xi = s.object({
13038
13095
  well: s.object({
13039
13096
  /**The fields of view for this well*/
13040
13097
  images: s.array(
@@ -13048,7 +13105,7 @@ const Pi = s.object({
13048
13105
  /**The version of the specification*/
13049
13106
  version: s.literal("0.4").describe("The version of the specification").optional()
13050
13107
  }).optional()
13051
- }).describe("JSON from OME-NGFF .zattrs"), vi = s.object({
13108
+ }).describe("JSON from OME-NGFF .zattrs"), ji = s.object({
13052
13109
  /**The versioned OME-Zarr Metadata namespace*/
13053
13110
  ome: s.object({
13054
13111
  /**The multiscale datasets for this image*/
@@ -13178,7 +13235,7 @@ const Pi = s.object({
13178
13235
  /**The version of the OME-Zarr Metadata*/
13179
13236
  version: s.literal("0.5").describe("The version of the OME-Zarr Metadata")
13180
13237
  }).describe("The versioned OME-Zarr Metadata namespace")
13181
- }).describe("The zarr.json attributes key"), Xi = s.object({
13238
+ }).describe("The zarr.json attributes key"), zi = s.object({
13182
13239
  /**The versioned OME-Zarr Metadata namespace*/
13183
13240
  ome: s.object({
13184
13241
  plate: s.object({
@@ -13240,7 +13297,7 @@ const Pi = s.object({
13240
13297
  /**The version of the OME-Zarr Metadata*/
13241
13298
  version: s.literal("0.5").describe("The version of the OME-Zarr Metadata")
13242
13299
  }).describe("The versioned OME-Zarr Metadata namespace")
13243
- }).describe("The zarr.json attributes key"), ji = s.object({
13300
+ }).describe("The zarr.json attributes key"), _i = s.object({
13244
13301
  /**The versioned OME-Zarr Metadata namespace*/
13245
13302
  ome: s.object({
13246
13303
  well: s.object({
@@ -13259,15 +13316,15 @@ const Pi = s.object({
13259
13316
  /**The version of the OME-Zarr Metadata*/
13260
13317
  version: s.literal("0.5").describe("The version of the OME-Zarr Metadata")
13261
13318
  }).describe("The versioned OME-Zarr Metadata namespace")
13262
- }).describe("JSON from OME-Zarr zarr.json"), zi = ["0.4", "0.5"], _i = new Set(zi);
13263
- function $i(g) {
13319
+ }).describe("JSON from OME-Zarr zarr.json"), $i = ["0.4", "0.5"], Ao = new Set($i);
13320
+ function Io(g) {
13264
13321
  if (!("ome" in g) || !(g.ome instanceof Object)) return;
13265
13322
  const A = g.ome;
13266
- if ("version" in A && typeof A.version == "string" && _i.has(A.version))
13323
+ if ("version" in A && typeof A.version == "string" && Ao.has(A.version))
13267
13324
  return A.version;
13268
13325
  }
13269
13326
  function kg(g) {
13270
- const A = $i(g);
13327
+ const A = Io(g);
13271
13328
  return A === void 0 ? "0.4" : A;
13272
13329
  }
13273
13330
  function fA(g) {
@@ -13283,10 +13340,10 @@ function xB(g, A) {
13283
13340
  const I = { ...g };
13284
13341
  return delete I[A], I;
13285
13342
  }
13286
- async function eo(g, A) {
13343
+ async function So(g, A) {
13287
13344
  const I = new _(new sI(g)), B = fA(A), Q = await hI(I, B);
13288
13345
  try {
13289
- return Ao(Q.attrs);
13346
+ return go(Q.attrs);
13290
13347
  } catch {
13291
13348
  throw Error(
13292
13349
  `Failed to parse OME-Zarr plate:
@@ -13294,21 +13351,21 @@ ${JSON.stringify(Q.attrs)}`
13294
13351
  );
13295
13352
  }
13296
13353
  }
13297
- function Ao(g) {
13354
+ function go(g) {
13298
13355
  switch (kg(g)) {
13299
13356
  case "0.5":
13300
13357
  return {
13301
- ...Xi.parse(g).ome,
13358
+ ...zi.parse(g).ome,
13302
13359
  originalVersion: "0.5"
13303
13360
  };
13304
13361
  case "0.4":
13305
13362
  return {
13306
- ...Io(Oi.parse(g)).ome,
13363
+ ...Bo(vi.parse(g)).ome,
13307
13364
  originalVersion: "0.4"
13308
13365
  };
13309
13366
  }
13310
13367
  }
13311
- function Io(g) {
13368
+ function Bo(g) {
13312
13369
  if (g.plate === void 0)
13313
13370
  throw new Error("Plate metadata is missing in OME-Zarr v0.4 plate");
13314
13371
  return {
@@ -13318,7 +13375,7 @@ function Io(g) {
13318
13375
  }
13319
13376
  };
13320
13377
  }
13321
- function go(g) {
13378
+ function Qo(g) {
13322
13379
  if (g.well === void 0)
13323
13380
  throw new Error("Well metadata is missing in OME-Zarr v0.4 well");
13324
13381
  return {
@@ -13328,24 +13385,24 @@ function go(g) {
13328
13385
  }
13329
13386
  };
13330
13387
  }
13331
- function Bo(g) {
13388
+ function Co(g) {
13332
13389
  switch (kg(g)) {
13333
13390
  case "0.5":
13334
13391
  return {
13335
- ...ji.parse(g).ome,
13392
+ ..._i.parse(g).ome,
13336
13393
  originalVersion: "0.5"
13337
13394
  };
13338
13395
  case "0.4":
13339
13396
  return {
13340
- ...go(Vi.parse(g)).ome,
13397
+ ...Qo(Xi.parse(g)).ome,
13341
13398
  originalVersion: "0.4"
13342
13399
  };
13343
13400
  }
13344
13401
  }
13345
- async function ro(g, A, I) {
13402
+ async function Ro(g, A, I) {
13346
13403
  const B = new _(new sI(g + "/" + A)), Q = fA(I), C = await hI(B, Q);
13347
13404
  try {
13348
- return Bo(C.attrs);
13405
+ return Co(C.attrs);
13349
13406
  } catch {
13350
13407
  throw Error(
13351
13408
  `Failed to parse OME-Zarr well:
@@ -13353,15 +13410,15 @@ ${JSON.stringify(C.attrs)}`
13353
13410
  );
13354
13411
  }
13355
13412
  }
13356
- async function So(g) {
13413
+ async function No(g) {
13357
13414
  const A = fA(g.version), I = await hI(g.location, A);
13358
13415
  return Lg(I.attrs).omero?.channels ?? [];
13359
13416
  }
13360
- async function Ro(g) {
13417
+ async function co(g) {
13361
13418
  const A = fA(g.version), I = await hI(g.location, A);
13362
13419
  return Lg(I.attrs).omero?.rdefs;
13363
13420
  }
13364
- function Qo(g) {
13421
+ function Eo(g) {
13365
13422
  return {
13366
13423
  ome: {
13367
13424
  multiscales: g.multiscales,
@@ -13370,29 +13427,29 @@ function Qo(g) {
13370
13427
  }
13371
13428
  };
13372
13429
  }
13373
- function Co(g) {
13430
+ function io(g) {
13374
13431
  switch (kg(g)) {
13375
13432
  case "0.5":
13376
13433
  return {
13377
- ...vi.parse(g).ome,
13434
+ ...ji.parse(g).ome,
13378
13435
  originalVersion: "0.5"
13379
13436
  };
13380
13437
  case "0.4":
13381
13438
  return {
13382
- ...Qo(Pi.parse(g)).ome,
13439
+ ...Eo(Vi.parse(g)).ome,
13383
13440
  originalVersion: "0.4"
13384
13441
  };
13385
13442
  }
13386
13443
  }
13387
13444
  function Lg(g) {
13388
13445
  try {
13389
- return Co(g);
13446
+ return io(g);
13390
13447
  } catch {
13391
13448
  throw Error(`Failed to parse OME-Zarr image:
13392
13449
  ${JSON.stringify(g)}`);
13393
13450
  }
13394
13451
  }
13395
- class No {
13452
+ class Uo {
13396
13453
  location;
13397
13454
  version;
13398
13455
  constructor(A, I, B) {
@@ -13410,15 +13467,15 @@ class No {
13410
13467
  throw new Error("No datasets found in the multiscale image.");
13411
13468
  A || (A = fA(B.originalVersion));
13412
13469
  const E = C.datasets.map(
13413
- (D) => RE(this.location, D.path, A)
13470
+ (D) => cE(this.location, D.path, A)
13414
13471
  ), i = await Promise.all(
13415
- E.map((D) => SE(D))
13472
+ E.map((D) => NE(D))
13416
13473
  ), o = i[0].shape, a = C.axes;
13417
13474
  if (a.length !== o.length)
13418
13475
  throw new Error(
13419
13476
  `Mismatch between number of axes (${a.length}) and array shape (${o.length})`
13420
13477
  );
13421
- return new HE({
13478
+ return new lE({
13422
13479
  metadata: C,
13423
13480
  arrays: i,
13424
13481
  arrayParams: E
@@ -13433,7 +13490,7 @@ const bB = [
13433
13490
  "prefetchSpace"
13434
13491
  ];
13435
13492
  function Jg(g) {
13436
- Eo(g);
13493
+ oo(g);
13437
13494
  const A = {
13438
13495
  x: g.prefetch.x,
13439
13496
  y: g.prefetch.y,
@@ -13460,7 +13517,7 @@ function Jg(g) {
13460
13517
  };
13461
13518
  return Object.freeze(Q);
13462
13519
  }
13463
- function co(g = {}) {
13520
+ function ko(g = {}) {
13464
13521
  return Jg(Yg({
13465
13522
  profile: "exploration",
13466
13523
  prefetch: { x: 1, y: 1, z: 1, t: 0 },
@@ -13473,7 +13530,7 @@ function co(g = {}) {
13473
13530
  ]
13474
13531
  }, g));
13475
13532
  }
13476
- function Uo(g = {}) {
13533
+ function Lo(g = {}) {
13477
13534
  return Jg(Yg({
13478
13535
  profile: "playback",
13479
13536
  prefetch: { x: 0, y: 0, z: 0, t: 20 },
@@ -13486,7 +13543,7 @@ function Uo(g = {}) {
13486
13543
  ]
13487
13544
  }, g));
13488
13545
  }
13489
- function ko(g = {}) {
13546
+ function Jo(g = {}) {
13490
13547
  return Jg(Yg({
13491
13548
  profile: "no-prefetch",
13492
13549
  prefetch: { x: 0, y: 0, z: 0, t: 0 },
@@ -13499,7 +13556,7 @@ function ko(g = {}) {
13499
13556
  ]
13500
13557
  }, g));
13501
13558
  }
13502
- function Eo(g) {
13559
+ function oo(g) {
13503
13560
  for (const [B, Q] of Object.entries(g.prefetch))
13504
13561
  if (Q !== void 0 && Q < 0)
13505
13562
  throw new Error(`prefetch.${B} must be a non-negative number`);
@@ -13518,7 +13575,7 @@ function Yg(g, A = {}) {
13518
13575
  priorityOrder: A.priorityOrder ?? g.priorityOrder
13519
13576
  };
13520
13577
  }
13521
- class Lo {
13578
+ class Yo {
13522
13579
  radius;
13523
13580
  phi;
13524
13581
  theta;
@@ -13534,7 +13591,7 @@ class Lo {
13534
13591
  );
13535
13592
  }
13536
13593
  }
13537
- class Jo extends mA {
13594
+ class Mo extends mA {
13538
13595
  atlas_;
13539
13596
  constructor(A, I) {
13540
13597
  super(), this.programName = "points", this.atlas_ = I, A.forEach((C) => {
@@ -13578,40 +13635,40 @@ class Jo extends mA {
13578
13635
  }
13579
13636
  }
13580
13637
  export {
13581
- so as AxesLayer,
13638
+ yo as AxesLayer,
13582
13639
  j as Box2,
13583
13640
  eA as Box3,
13584
13641
  RB as ChunkedImageLayer,
13585
13642
  l as Color,
13586
- IC as Frustum,
13587
- io as Idetik,
13588
- Go as ImageLayer,
13589
- Fo as ImageSeriesLayer,
13590
- wo as LabelImageLayer,
13643
+ BC as Frustum,
13644
+ ao as Idetik,
13645
+ Fo as ImageLayer,
13646
+ eo as ImageSeriesLayer,
13647
+ no as LabelImageLayer,
13591
13648
  GA as Layer,
13592
- ZQ as LayerManager,
13593
- No as OmeZarrImageSource,
13594
- oo as OrthographicCamera,
13595
- Do as PanZoomControls,
13596
- ao as PerspectiveCamera,
13649
+ OQ as LayerManager,
13650
+ Uo as OmeZarrImageSource,
13651
+ Do as OrthographicCamera,
13652
+ ho as PanZoomControls,
13653
+ so as PerspectiveCamera,
13597
13654
  JA as Plane,
13598
- Jo as Points,
13599
- ho as ProjectedLineLayer,
13600
- Lo as Spherical,
13655
+ Mo as Points,
13656
+ to as ProjectedLineLayer,
13657
+ Yo as Spherical,
13601
13658
  iI as Texture2DArray,
13602
13659
  yg as Texture3D,
13603
- yo as TracksLayer,
13604
- vQ as Viewport,
13605
- to as VolumeLayer,
13660
+ Go as TracksLayer,
13661
+ jQ as Viewport,
13662
+ wo as VolumeLayer,
13606
13663
  pQ as WebGLRenderer,
13607
- co as createExplorationPolicy,
13664
+ ko as createExplorationPolicy,
13608
13665
  Jg as createImageSourcePolicy,
13609
- ko as createNoPrefetchPolicy,
13610
- Uo as createPlaybackPolicy,
13611
- eo as loadOmeZarrPlate,
13612
- ro as loadOmeZarrWell,
13613
- So as loadOmeroChannels,
13614
- Ro as loadOmeroDefaults,
13615
- jQ as parseViewportConfigs
13666
+ Jo as createNoPrefetchPolicy,
13667
+ Lo as createPlaybackPolicy,
13668
+ So as loadOmeZarrPlate,
13669
+ Ro as loadOmeZarrWell,
13670
+ No as loadOmeroChannels,
13671
+ co as loadOmeroDefaults,
13672
+ _Q as parseViewportConfigs
13616
13673
  };
13617
13674
  //# sourceMappingURL=index.js.map