@idetik/core 0.27.0 → 0.27.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/assets/worker_kernel-CBlE4MBI.js.map +1 -1
  2. package/dist/index.d.ts +142 -135
  3. package/dist/index.js +705 -693
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.umd.cjs +39 -39
  6. package/dist/index.umd.cjs.map +1 -1
  7. package/dist/types/src/core/layer.d.ts +1 -4
  8. package/dist/types/src/core/layer.d.ts.map +1 -1
  9. package/dist/types/src/core/renderer.d.ts +3 -0
  10. package/dist/types/src/core/renderer.d.ts.map +1 -1
  11. package/dist/types/src/core/viewport.d.ts +6 -0
  12. package/dist/types/src/core/viewport.d.ts.map +1 -1
  13. package/dist/types/src/data/chunk.d.ts +1 -1
  14. package/dist/types/src/data/chunk.d.ts.map +1 -1
  15. package/dist/types/src/data/chunk_manager.d.ts.map +1 -1
  16. package/dist/types/src/data/chunk_store.d.ts +2 -4
  17. package/dist/types/src/data/chunk_store.d.ts.map +1 -1
  18. package/dist/types/src/data/chunk_store_view.d.ts +7 -3
  19. package/dist/types/src/data/chunk_store_view.d.ts.map +1 -1
  20. package/dist/types/src/data/ome_zarr/image_source.d.ts +1 -1
  21. package/dist/types/src/data/ome_zarr/image_source.d.ts.map +1 -1
  22. package/dist/types/src/layers/image_layer.d.ts +3 -2
  23. package/dist/types/src/layers/image_layer.d.ts.map +1 -1
  24. package/dist/types/src/layers/label_layer.d.ts +3 -2
  25. package/dist/types/src/layers/label_layer.d.ts.map +1 -1
  26. package/dist/types/src/layers/volume_layer.d.ts +3 -2
  27. package/dist/types/src/layers/volume_layer.d.ts.map +1 -1
  28. package/dist/types/src/objects/cameras/camera.d.ts +1 -0
  29. package/dist/types/src/objects/cameras/camera.d.ts.map +1 -1
  30. package/dist/types/src/objects/cameras/orthographic_camera.d.ts.map +1 -1
  31. package/dist/types/src/renderers/webgl_renderer.d.ts +3 -0
  32. package/dist/types/src/renderers/webgl_renderer.d.ts.map +1 -1
  33. package/dist/types/src/renderers/webgl_textures.d.ts +2 -1
  34. package/dist/types/src/renderers/webgl_textures.d.ts.map +1 -1
  35. package/dist/types/src/renderers/webgpu/webgpu_renderer.d.ts +3 -0
  36. package/dist/types/src/renderers/webgpu/webgpu_renderer.d.ts.map +1 -1
  37. package/dist/types/src/renderers/webgpu/webgpu_texture_pool.d.ts.map +1 -1
  38. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -839,7 +839,7 @@ function GQ() {
839
839
  function qE(C, A) {
840
840
  return C[0] = A[0], C[1] = A[1], C[2] = A[2], C[3] = A[4], C[4] = A[5], C[5] = A[6], C[6] = A[8], C[7] = A[9], C[8] = A[10], C;
841
841
  }
842
- function FA() {
842
+ function SA() {
843
843
  var C = new DA(16);
844
844
  return DA != Float32Array && (C[1] = 0, C[2] = 0, C[3] = 0, C[4] = 0, C[6] = 0, C[7] = 0, C[8] = 0, C[9] = 0, C[11] = 0, C[12] = 0, C[13] = 0, C[14] = 0), C[0] = 1, C[5] = 1, C[10] = 1, C[15] = 1, C;
845
845
  }
@@ -848,19 +848,19 @@ function pE(C, A, I, g, B, Q, E, i, o, s, t, a, n, D, F, U) {
848
848
  return S[0] = C, S[1] = A, S[2] = I, S[3] = g, S[4] = B, S[5] = Q, S[6] = E, S[7] = i, S[8] = o, S[9] = s, S[10] = t, S[11] = a, S[12] = n, S[13] = D, S[14] = F, S[15] = U, S;
849
849
  }
850
850
  function kg(C, A) {
851
- var I = A[0], g = A[1], B = A[2], Q = A[3], E = A[4], i = A[5], o = A[6], s = A[7], t = A[8], a = A[9], n = A[10], D = A[11], F = A[12], U = A[13], S = A[14], d = A[15], K = I * i - g * E, k = I * o - B * E, R = I * s - Q * E, L = g * o - B * i, M = g * s - Q * i, W = B * s - Q * o, IA = t * U - a * F, CA = t * S - n * F, $ = t * d - D * F, gA = a * S - n * U, SA = a * d - D * U, NA = n * d - D * S, oA = K * NA - k * SA + R * gA + L * $ - M * CA + W * IA;
852
- return oA ? (oA = 1 / oA, C[0] = (i * NA - o * SA + s * gA) * oA, C[1] = (B * SA - g * NA - Q * gA) * oA, C[2] = (U * W - S * M + d * L) * oA, C[3] = (n * M - a * W - D * L) * oA, C[4] = (o * $ - E * NA - s * CA) * oA, C[5] = (I * NA - B * $ + Q * CA) * oA, C[6] = (S * R - F * W - d * k) * oA, C[7] = (t * W - n * R + D * k) * oA, C[8] = (E * SA - i * $ + s * IA) * oA, C[9] = (g * $ - I * SA - Q * IA) * oA, C[10] = (F * M - U * R + d * K) * oA, C[11] = (a * R - t * M - D * K) * oA, C[12] = (i * CA - E * gA - o * IA) * oA, C[13] = (I * gA - g * CA + B * IA) * oA, C[14] = (U * k - F * L - S * K) * oA, C[15] = (t * L - a * k + n * K) * oA, C) : null;
851
+ var I = A[0], g = A[1], B = A[2], Q = A[3], E = A[4], i = A[5], o = A[6], s = A[7], t = A[8], a = A[9], n = A[10], D = A[11], F = A[12], U = A[13], S = A[14], l = A[15], u = I * i - g * E, k = I * o - B * E, R = I * s - Q * E, L = g * o - B * i, M = g * s - Q * i, W = B * s - Q * o, $ = t * U - a * F, BA = t * S - n * F, IA = t * l - D * F, iA = a * S - n * U, fA = a * l - D * U, uA = n * l - D * S, oA = u * uA - k * fA + R * iA + L * IA - M * BA + W * $;
852
+ return oA ? (oA = 1 / oA, C[0] = (i * uA - o * fA + s * iA) * oA, C[1] = (B * fA - g * uA - Q * iA) * oA, C[2] = (U * W - S * M + l * L) * oA, C[3] = (n * M - a * W - D * L) * oA, C[4] = (o * IA - E * uA - s * BA) * oA, C[5] = (I * uA - B * IA + Q * BA) * oA, C[6] = (S * R - F * W - l * k) * oA, C[7] = (t * W - n * R + D * k) * oA, C[8] = (E * fA - i * IA + s * $) * oA, C[9] = (g * IA - I * fA - Q * $) * oA, C[10] = (F * M - U * R + l * u) * oA, C[11] = (a * R - t * M - D * u) * oA, C[12] = (i * BA - E * iA - o * $) * oA, C[13] = (I * iA - g * BA + B * $) * oA, C[14] = (U * k - F * L - S * u) * oA, C[15] = (t * L - a * k + n * u) * oA, C) : null;
853
853
  }
854
- function _A(C, A, I) {
855
- var g = A[0], B = A[1], Q = A[2], E = A[3], i = A[4], o = A[5], s = A[6], t = A[7], a = A[8], n = A[9], D = A[10], F = A[11], U = A[12], S = A[13], d = A[14], K = A[15], k = I[0], R = I[1], L = I[2], M = I[3];
856
- return C[0] = k * g + R * i + L * a + M * U, C[1] = k * B + R * o + L * n + M * S, C[2] = k * Q + R * s + L * D + M * d, C[3] = k * E + R * t + L * F + M * K, k = I[4], R = I[5], L = I[6], M = I[7], C[4] = k * g + R * i + L * a + M * U, C[5] = k * B + R * o + L * n + M * S, C[6] = k * Q + R * s + L * D + M * d, C[7] = k * E + R * t + L * F + M * K, k = I[8], R = I[9], L = I[10], M = I[11], C[8] = k * g + R * i + L * a + M * U, C[9] = k * B + R * o + L * n + M * S, C[10] = k * Q + R * s + L * D + M * d, C[11] = k * E + R * t + L * F + M * K, k = I[12], R = I[13], L = I[14], M = I[15], C[12] = k * g + R * i + L * a + M * U, C[13] = k * B + R * o + L * n + M * S, C[14] = k * Q + R * s + L * D + M * d, C[15] = k * E + R * t + L * F + M * K, C;
854
+ function eI(C, A, I) {
855
+ var g = A[0], B = A[1], Q = A[2], E = A[3], i = A[4], o = A[5], s = A[6], t = A[7], a = A[8], n = A[9], D = A[10], F = A[11], U = A[12], S = A[13], l = A[14], u = A[15], k = I[0], R = I[1], L = I[2], M = I[3];
856
+ return C[0] = k * g + R * i + L * a + M * U, C[1] = k * B + R * o + L * n + M * S, C[2] = k * Q + R * s + L * D + M * l, C[3] = k * E + R * t + L * F + M * u, k = I[4], R = I[5], L = I[6], M = I[7], C[4] = k * g + R * i + L * a + M * U, C[5] = k * B + R * o + L * n + M * S, C[6] = k * Q + R * s + L * D + M * l, C[7] = k * E + R * t + L * F + M * u, k = I[8], R = I[9], L = I[10], M = I[11], C[8] = k * g + R * i + L * a + M * U, C[9] = k * B + R * o + L * n + M * S, C[10] = k * Q + R * s + L * D + M * l, C[11] = k * E + R * t + L * F + M * u, k = I[12], R = I[13], L = I[14], M = I[15], C[12] = k * g + R * i + L * a + M * U, C[13] = k * B + R * o + L * n + M * S, C[14] = k * Q + R * s + L * D + M * l, C[15] = k * E + R * t + L * F + M * u, C;
857
857
  }
858
858
  function mE(C, A) {
859
859
  return C[0] = A[0], C[1] = 0, C[2] = 0, C[3] = 0, C[4] = 0, C[5] = A[1], C[6] = 0, C[7] = 0, C[8] = 0, C[9] = 0, C[10] = A[2], C[11] = 0, C[12] = 0, C[13] = 0, C[14] = 0, C[15] = 1, C;
860
860
  }
861
861
  function xE(C, A, I, g) {
862
- var B = A[0], Q = A[1], E = A[2], i = A[3], o = B + B, s = Q + Q, t = E + E, a = B * o, n = B * s, D = B * t, F = Q * s, U = Q * t, S = E * t, d = i * o, K = i * s, k = i * t, R = g[0], L = g[1], M = g[2];
863
- return C[0] = (1 - (F + S)) * R, C[1] = (n + k) * R, C[2] = (D - K) * R, C[3] = 0, C[4] = (n - k) * L, C[5] = (1 - (a + S)) * L, C[6] = (U + d) * L, C[7] = 0, C[8] = (D + K) * M, C[9] = (U - d) * M, C[10] = (1 - (a + F)) * M, C[11] = 0, C[12] = I[0], C[13] = I[1], C[14] = I[2], C[15] = 1, C;
862
+ var B = A[0], Q = A[1], E = A[2], i = A[3], o = B + B, s = Q + Q, t = E + E, a = B * o, n = B * s, D = B * t, F = Q * s, U = Q * t, S = E * t, l = i * o, u = i * s, k = i * t, R = g[0], L = g[1], M = g[2];
863
+ return C[0] = (1 - (F + S)) * R, C[1] = (n + k) * R, C[2] = (D - u) * R, C[3] = 0, C[4] = (n - k) * L, C[5] = (1 - (a + S)) * L, C[6] = (U + l) * L, C[7] = 0, C[8] = (D + u) * M, C[9] = (U - l) * M, C[10] = (1 - (a + F)) * M, C[11] = 0, C[12] = I[0], C[13] = I[1], C[14] = I[2], C[15] = 1, C;
864
864
  }
865
865
  function bE(C, A, I, g, B) {
866
866
  var Q = 1 / Math.tan(A / 2);
@@ -884,10 +884,10 @@ function ZE(C, A, I, g) {
884
884
  return D = F * F + U * U + S * S, D > 0 && (D = 1 / Math.sqrt(D), F *= D, U *= D, S *= D), C[0] = F, C[1] = U, C[2] = S, C[3] = 0, C[4] = a * S - n * U, C[5] = n * F - t * S, C[6] = t * U - a * F, C[7] = 0, C[8] = t, C[9] = a, C[10] = n, C[11] = 0, C[12] = B, C[13] = Q, C[14] = E, C[15] = 1, C;
885
885
  }
886
886
  function PE(C, A) {
887
- var I = C[0], g = C[1], B = C[2], Q = C[3], E = C[4], i = C[5], o = C[6], s = C[7], t = C[8], a = C[9], n = C[10], D = C[11], F = C[12], U = C[13], S = C[14], d = C[15], K = A[0], k = A[1], R = A[2], L = A[3], M = A[4], W = A[5], IA = A[6], CA = A[7], $ = A[8], gA = A[9], SA = A[10], NA = A[11], oA = A[12], BC = A[13], CC = A[14], QC = A[15];
888
- return Math.abs(I - K) <= AA * Math.max(1, Math.abs(I), Math.abs(K)) && Math.abs(g - k) <= AA * Math.max(1, Math.abs(g), Math.abs(k)) && Math.abs(B - R) <= AA * Math.max(1, Math.abs(B), Math.abs(R)) && Math.abs(Q - L) <= AA * Math.max(1, Math.abs(Q), Math.abs(L)) && Math.abs(E - M) <= AA * Math.max(1, Math.abs(E), Math.abs(M)) && Math.abs(i - W) <= AA * Math.max(1, Math.abs(i), Math.abs(W)) && Math.abs(o - IA) <= AA * Math.max(1, Math.abs(o), Math.abs(IA)) && Math.abs(s - CA) <= AA * Math.max(1, Math.abs(s), Math.abs(CA)) && Math.abs(t - $) <= AA * Math.max(1, Math.abs(t), Math.abs($)) && Math.abs(a - gA) <= AA * Math.max(1, Math.abs(a), Math.abs(gA)) && Math.abs(n - SA) <= AA * Math.max(1, Math.abs(n), Math.abs(SA)) && Math.abs(D - NA) <= AA * Math.max(1, Math.abs(D), Math.abs(NA)) && Math.abs(F - oA) <= AA * Math.max(1, Math.abs(F), Math.abs(oA)) && Math.abs(U - BC) <= AA * Math.max(1, Math.abs(U), Math.abs(BC)) && Math.abs(S - CC) <= AA * Math.max(1, Math.abs(S), Math.abs(CC)) && Math.abs(d - QC) <= AA * Math.max(1, Math.abs(d), Math.abs(QC));
887
+ var I = C[0], g = C[1], B = C[2], Q = C[3], E = C[4], i = C[5], o = C[6], s = C[7], t = C[8], a = C[9], n = C[10], D = C[11], F = C[12], U = C[13], S = C[14], l = C[15], u = A[0], k = A[1], R = A[2], L = A[3], M = A[4], W = A[5], $ = A[6], BA = A[7], IA = A[8], iA = A[9], fA = A[10], uA = A[11], oA = A[12], BC = A[13], CC = A[14], QC = A[15];
888
+ return Math.abs(I - u) <= AA * Math.max(1, Math.abs(I), Math.abs(u)) && Math.abs(g - k) <= AA * Math.max(1, Math.abs(g), Math.abs(k)) && Math.abs(B - R) <= AA * Math.max(1, Math.abs(B), Math.abs(R)) && Math.abs(Q - L) <= AA * Math.max(1, Math.abs(Q), Math.abs(L)) && Math.abs(E - M) <= AA * Math.max(1, Math.abs(E), Math.abs(M)) && Math.abs(i - W) <= AA * Math.max(1, Math.abs(i), Math.abs(W)) && Math.abs(o - $) <= AA * Math.max(1, Math.abs(o), Math.abs($)) && Math.abs(s - BA) <= AA * Math.max(1, Math.abs(s), Math.abs(BA)) && Math.abs(t - IA) <= AA * Math.max(1, Math.abs(t), Math.abs(IA)) && Math.abs(a - iA) <= AA * Math.max(1, Math.abs(a), Math.abs(iA)) && Math.abs(n - fA) <= AA * Math.max(1, Math.abs(n), Math.abs(fA)) && Math.abs(D - uA) <= AA * Math.max(1, Math.abs(D), Math.abs(uA)) && Math.abs(F - oA) <= AA * Math.max(1, Math.abs(F), Math.abs(oA)) && Math.abs(U - BC) <= AA * Math.max(1, Math.abs(U), Math.abs(BC)) && Math.abs(S - CC) <= AA * Math.max(1, Math.abs(S), Math.abs(CC)) && Math.abs(l - QC) <= AA * Math.max(1, Math.abs(l), Math.abs(QC));
889
889
  }
890
- function EA() {
890
+ function QA() {
891
891
  var C = new DA(3);
892
892
  return DA != Float32Array && (C[0] = 0, C[1] = 0, C[2] = 0), C;
893
893
  }
@@ -906,7 +906,7 @@ function P(C, A, I) {
906
906
  function $g(C, A) {
907
907
  return C[0] = A[0], C[1] = A[1], C[2] = A[2], C;
908
908
  }
909
- function II(C, A, I, g) {
909
+ function AI(C, A, I, g) {
910
910
  return C[0] = A, C[1] = I, C[2] = g, C;
911
911
  }
912
912
  function HI(C, A, I) {
@@ -952,7 +952,7 @@ function NB(C, A) {
952
952
  }
953
953
  var AB = VE, jE = FB;
954
954
  (function() {
955
- var C = EA();
955
+ var C = QA();
956
956
  return function(A, I, g, B, Q, E) {
957
957
  var i, o;
958
958
  for (I || (I = 3), g || (g = 0), B ? o = Math.min(B * I + g, A.length) : o = A.length, i = g; i < o; i += I)
@@ -1026,7 +1026,7 @@ function SQ(C, A) {
1026
1026
  }
1027
1027
  var Ci = zE, Qi = $E, RB = Ii;
1028
1028
  (function() {
1029
- var C = EA(), A = P(1, 0, 0), I = P(0, 1, 0);
1029
+ var C = QA(), A = P(1, 0, 0), I = P(0, 1, 0);
1030
1030
  return function(g, B, Q) {
1031
1031
  var E = FQ(B, Q);
1032
1032
  return E < -0.999999 ? (Kg(C, A, B), jE(C) < 1e-6 && Kg(C, I, B), _E(C, C), gi(g, C, Math.PI), g) : E > 0.999999 ? (g[0] = 0, g[1] = 0, g[2] = 0, g[3] = 1, g) : (Kg(C, B, Q), g[0] = C[0], g[1] = C[1], g[2] = C[2], g[3] = 1 + E, RB(g, g));
@@ -1084,7 +1084,7 @@ function qg(C, A) {
1084
1084
  return A;
1085
1085
  };
1086
1086
  })();
1087
- class gI {
1087
+ class II {
1088
1088
  min;
1089
1089
  max;
1090
1090
  /**
@@ -1097,7 +1097,7 @@ class gI {
1097
1097
  this.min = A ? bA(A) : P(1 / 0, 1 / 0, 1 / 0), this.max = I ? bA(I) : P(-1 / 0, -1 / 0, -1 / 0);
1098
1098
  }
1099
1099
  clone() {
1100
- return new gI(this.min, this.max);
1100
+ return new II(this.min, this.max);
1101
1101
  }
1102
1102
  isEmpty() {
1103
1103
  return this.max[0] <= this.min[0] || this.max[1] <= this.min[1] || this.max[2] <= this.min[2];
@@ -1121,7 +1121,7 @@ class gI {
1121
1121
  P(g[0], g[1], g[2])
1122
1122
  ];
1123
1123
  this.min = P(1 / 0, 1 / 0, 1 / 0), this.max = P(-1 / 0, -1 / 0, -1 / 0);
1124
- const Q = EA();
1124
+ const Q = QA();
1125
1125
  for (const E of B)
1126
1126
  SB(Q, E, A), this.expandWithPoint(Q);
1127
1127
  }
@@ -1175,7 +1175,7 @@ class NI extends GB {
1175
1175
  const A = this.getAttribute("position");
1176
1176
  if (!A || this.vertexCount === 0)
1177
1177
  throw new Error("Failed to generate bounding box");
1178
- const I = (A.offset ?? 0) / Float32Array.BYTES_PER_ELEMENT, g = new gI(), B = EA();
1178
+ const I = (A.offset ?? 0) / Float32Array.BYTES_PER_ELEMENT, g = new II(), B = QA();
1179
1179
  for (let Q = 0; Q < this.vertexData_.length; Q += this.stride)
1180
1180
  B[0] = this.vertexData_[Q + I + 0], B[1] = this.vertexData_[Q + I + 1], B[2] = this.vertexData_[Q + I + 2], g.expandWithPoint(B);
1181
1181
  this.boundingBox_ = g;
@@ -1267,13 +1267,8 @@ class ti {
1267
1267
  throw new Error(
1268
1268
  `Texture index ${I} must be in [0, ${this.maxTextureUnits_ - 1}]`
1269
1269
  );
1270
- this.gl_.activeTexture(this.gl_.TEXTURE0 + I);
1271
- const g = this.getTextureType(A), B = this.getDataFormatInfo(A.dataFormat, A.dataType);
1272
- this.textures_.has(A) || this.generateTexture(A, B, g);
1273
- const Q = this.textures_.get(A);
1274
- if (!Q)
1275
- throw new Error("Failed to retrieve texture ID");
1276
- this.gl_.bindTexture(g, Q), A.needsUpdate && A.data !== null && (this.configureTextureParameters(A, g), this.uploadTextureData(A, B, g), A.needsUpdate = !1), this.currentTexture_ = A;
1270
+ const g = this.textures_.get(A);
1271
+ g && !A.needsUpdate ? (this.gl_.activeTexture(this.gl_.TEXTURE0 + I), this.gl_.bindTexture(this.getTextureType(A), g)) : this.uploadTexture(A, I), this.currentTexture_ = A;
1277
1272
  }
1278
1273
  readTexel(A, I, g, B) {
1279
1274
  const Q = this.gl_, E = this.textures_.get(A);
@@ -1312,7 +1307,18 @@ class ti {
1312
1307
  return { format: I.RGBA, type: I.FLOAT, out: new Float32Array(4) };
1313
1308
  }
1314
1309
  }
1315
- disposeTexture(A) {
1310
+ uploadTexture(A, I = 0) {
1311
+ if (this.textures_.has(A) && !A.needsUpdate) return;
1312
+ if (A.data === null)
1313
+ throw new Error("Cannot upload a texture that has no CPU data");
1314
+ const g = this.getTextureType(A), B = this.getDataFormatInfo(A.dataFormat, A.dataType);
1315
+ this.gl_.activeTexture(this.gl_.TEXTURE0 + I), this.textures_.has(A) || this.generateTexture(A, B, g);
1316
+ const Q = this.textures_.get(A);
1317
+ if (!Q)
1318
+ throw new Error("Failed to retrieve texture ID");
1319
+ this.gl_.bindTexture(g, Q), this.configureTextureParameters(A, g), this.uploadTextureData(A, B, g), A.needsUpdate = !1;
1320
+ }
1321
+ dispose(A) {
1316
1322
  const I = this.textures_.get(A);
1317
1323
  if (I) {
1318
1324
  this.gl_.deleteTexture(I), this.textures_.delete(A), A.readTexel = void 0, this.currentTexture_ === A && (this.currentTexture_ = null);
@@ -1322,7 +1328,7 @@ class ti {
1322
1328
  }
1323
1329
  disposeAll() {
1324
1330
  for (const A of Array.from(this.textures_.keys()))
1325
- this.disposeTexture(A);
1331
+ this.dispose(A);
1326
1332
  this.gpuTextureBytes_ = 0, this.textureCount_ = 0;
1327
1333
  }
1328
1334
  alreadyActive(A) {
@@ -1662,7 +1668,7 @@ class ai {
1662
1668
  A ? this.enable(this.gl_.STENCIL_TEST) : this.disable(this.gl_.STENCIL_TEST);
1663
1669
  }
1664
1670
  }
1665
- const ei = mE(FA(), [1, -1, 1]);
1671
+ const ei = mE(SA(), [1, -1, 1]);
1666
1672
  class eC extends cQ {
1667
1673
  gl_;
1668
1674
  programs_;
@@ -1697,7 +1703,7 @@ class eC extends cQ {
1697
1703
  for (const t of A.layers)
1698
1704
  (t.blendMode === "none" ? I : g).push(t);
1699
1705
  for (const t of [...I, ...g])
1700
- t.update({ viewport: A });
1706
+ t.update(A);
1701
1707
  if (getComputedStyle(A.element).visibility === "hidden") return;
1702
1708
  const B = A.getBoxRelativeTo(this.canvas), Q = new GA(
1703
1709
  eA(0, 0),
@@ -1740,7 +1746,7 @@ class eC extends cQ {
1740
1746
  renderObject(A, I, g) {
1741
1747
  const B = A.objects[I];
1742
1748
  if (B.popStaleTextures().forEach((E) => {
1743
- this.textures_.disposeTexture(E);
1749
+ this.textures_.dispose(E);
1744
1750
  }), !B.programName) return;
1745
1751
  this.state_.setCullFaceMode(B.cullFaceMode), this.state_.setDepthTesting(B.depthTest), this.state_.setDepthMask(B.depthTest), this.bindings_.bindGeometry(B.geometry), B.textures.forEach((E, i) => {
1746
1752
  this.textures_.bindTexture(E, i);
@@ -1759,12 +1765,12 @@ class eC extends cQ {
1759
1765
  }
1760
1766
  }
1761
1767
  drawGeometry(A, I, g, B, Q) {
1762
- const E = _A(
1763
- FA(),
1768
+ const E = eI(
1769
+ SA(),
1764
1770
  Q.viewMatrix,
1765
1771
  I.transform.matrix
1766
- ), i = _A(
1767
- FA(),
1772
+ ), i = eI(
1773
+ SA(),
1768
1774
  ei,
1769
1775
  Q.projectionMatrix
1770
1776
  ), o = this.currentViewportSize_, s = I.getUniforms(), a = {
@@ -1789,7 +1795,7 @@ class eC extends cQ {
1789
1795
  );
1790
1796
  break;
1791
1797
  case "CameraPositionModel": {
1792
- const U = kg(FA(), E), S = Bg(0, 0, 0, 1), d = pI(
1798
+ const U = kg(SA(), E), S = Bg(0, 0, 0, 1), l = pI(
1793
1799
  rI(),
1794
1800
  S,
1795
1801
  U
@@ -1797,9 +1803,9 @@ class eC extends cQ {
1797
1803
  B.setUniform(
1798
1804
  F,
1799
1805
  P(
1800
- d[0],
1801
- d[1],
1802
- d[2]
1806
+ l[0],
1807
+ l[1],
1808
+ l[2]
1803
1809
  )
1804
1810
  );
1805
1811
  break;
@@ -1810,6 +1816,12 @@ class eC extends cQ {
1810
1816
  const n = this.glGetPrimitive(A.primitive), D = A.indexData;
1811
1817
  D.length ? this.gl_.drawElements(n, D.length, this.gl_.UNSIGNED_INT, 0) : this.gl_.drawArrays(n, 0, A.vertexCount);
1812
1818
  }
1819
+ uploadTexture(A) {
1820
+ this.textures_.uploadTexture(A);
1821
+ }
1822
+ disposeTexture(A) {
1823
+ this.textures_.dispose(A);
1824
+ }
1813
1825
  glGetPrimitive(A) {
1814
1826
  switch (A) {
1815
1827
  case "points":
@@ -2160,16 +2172,20 @@ class ki {
2160
2172
  this.device_ = A, this.textures_ = [];
2161
2173
  }
2162
2174
  get(A) {
2163
- const I = this.textures_.find((B) => B.entry === A);
2164
- if (I)
2165
- return A.needsUpdate && this.upload(A, I.texture), I.texture;
2166
- const g = this.device_.createTexture({
2167
- size: nC(A),
2168
- dimension: A instanceof TA ? "3d" : "2d",
2169
- format: di(A),
2170
- usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.COPY_SRC
2171
- });
2172
- return this.upload(A, g), this.textures_.push({ entry: A, texture: g }), A.readTexel = (B, Q, E) => this.readTexel(g, A.dataType, B, Q, E), g;
2175
+ let I = this.textures_.find((g) => g.entry === A);
2176
+ if (I && !A.needsUpdate) return I.texture;
2177
+ if (A.data === null)
2178
+ throw new Error("Cannot upload a texture that has no CPU data");
2179
+ if (!I) {
2180
+ const g = this.device_.createTexture({
2181
+ size: nC(A),
2182
+ dimension: A instanceof TA ? "3d" : "2d",
2183
+ format: di(A),
2184
+ usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.COPY_SRC
2185
+ });
2186
+ this.textures_.push({ entry: A, texture: g }), I = this.textures_[this.textures_.length - 1];
2187
+ }
2188
+ return this.upload(A, I.texture), A.readTexel = (g, B, Q) => this.readTexel(I.texture, A.dataType, g, B, Q), I.texture;
2173
2189
  }
2174
2190
  async readTexel(A, I, g, B, Q) {
2175
2191
  const E = this.device_.createBuffer({
@@ -2479,7 +2495,7 @@ function UQ(C) {
2479
2495
  align: 1
2480
2496
  };
2481
2497
  }
2482
- class dA {
2498
+ class kA {
2483
2499
  constructor(A, I) {
2484
2500
  this.name = A, this.attributes = I, this.size = 0;
2485
2501
  }
@@ -2528,7 +2544,7 @@ class hC {
2528
2544
  return this.type.isArray ? this.type.stride : this.size;
2529
2545
  }
2530
2546
  }
2531
- class PA extends dA {
2547
+ class PA extends kA {
2532
2548
  constructor(A, I) {
2533
2549
  super(A, I), this.members = [], this.align = 0, this.startLine = -1, this.endLine = -1, this.inUse = !1;
2534
2550
  }
@@ -2536,7 +2552,7 @@ class PA extends dA {
2536
2552
  return !0;
2537
2553
  }
2538
2554
  }
2539
- class XA extends dA {
2555
+ class _A extends kA {
2540
2556
  constructor(A, I) {
2541
2557
  super(A, I), this.count = 0, this.stride = 0;
2542
2558
  }
@@ -2547,7 +2563,7 @@ class XA extends dA {
2547
2563
  return `array<${this.format.getTypeName()}, ${this.count}>`;
2548
2564
  }
2549
2565
  }
2550
- class CB extends dA {
2566
+ class CB extends kA {
2551
2567
  constructor(A, I, g) {
2552
2568
  super(A, g), this.format = I;
2553
2569
  }
@@ -2558,7 +2574,7 @@ class CB extends dA {
2558
2574
  return `&${this.format.getTypeName()}`;
2559
2575
  }
2560
2576
  }
2561
- class BI extends dA {
2577
+ class gI extends kA {
2562
2578
  constructor(A, I, g, B) {
2563
2579
  super(A, g), this.format = I, this.access = B;
2564
2580
  }
@@ -2869,9 +2885,9 @@ function _(C, A, I, g, B) {
2869
2885
  return B;
2870
2886
  }
2871
2887
  const pg = { r8unorm: { bytesPerBlock: 1, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 1 }, r8snorm: { bytesPerBlock: 1, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 1 }, r8uint: { bytesPerBlock: 1, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 1 }, r8sint: { bytesPerBlock: 1, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 1 }, rg8unorm: { bytesPerBlock: 2, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 2 }, rg8snorm: { bytesPerBlock: 2, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 2 }, rg8uint: { bytesPerBlock: 2, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 2 }, rg8sint: { bytesPerBlock: 2, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 2 }, rgba8unorm: { bytesPerBlock: 4, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 4 }, "rgba8unorm-srgb": { bytesPerBlock: 4, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 4 }, rgba8snorm: { bytesPerBlock: 4, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 4 }, rgba8uint: { bytesPerBlock: 4, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 4 }, rgba8sint: { bytesPerBlock: 4, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 4 }, bgra8unorm: { bytesPerBlock: 4, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 4 }, "bgra8unorm-srgb": { bytesPerBlock: 4, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 4 }, r16uint: { bytesPerBlock: 2, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 1 }, r16sint: { bytesPerBlock: 2, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 1 }, r16float: { bytesPerBlock: 2, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 1 }, rg16uint: { bytesPerBlock: 4, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 2 }, rg16sint: { bytesPerBlock: 4, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 2 }, rg16float: { bytesPerBlock: 4, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 2 }, rgba16uint: { bytesPerBlock: 8, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 4 }, rgba16sint: { bytesPerBlock: 8, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 4 }, rgba16float: { bytesPerBlock: 8, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 4 }, r32uint: { bytesPerBlock: 4, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 1 }, r32sint: { bytesPerBlock: 4, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 1 }, r32float: { bytesPerBlock: 4, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 1 }, rg32uint: { bytesPerBlock: 8, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 2 }, rg32sint: { bytesPerBlock: 8, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 2 }, rg32float: { bytesPerBlock: 8, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 2 }, rgba32uint: { bytesPerBlock: 16, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 4 }, rgba32sint: { bytesPerBlock: 16, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 4 }, rgba32float: { bytesPerBlock: 16, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 4 }, rgb10a2uint: { bytesPerBlock: 4, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 4 }, rgb10a2unorm: { bytesPerBlock: 4, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 4 }, rg11b10ufloat: { bytesPerBlock: 4, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 4 }, stencil8: { bytesPerBlock: 1, blockWidth: 1, blockHeight: 1, isCompressed: !1, isDepthStencil: !0, hasDepth: !1, hasStencil: !0, channels: 1 }, depth16unorm: { bytesPerBlock: 2, blockWidth: 1, blockHeight: 1, isCompressed: !1, isDepthStencil: !0, hasDepth: !0, hasStencil: !1, channels: 1 }, depth24plus: { bytesPerBlock: 4, blockWidth: 1, blockHeight: 1, isCompressed: !1, isDepthStencil: !0, hasDepth: !0, hasStencil: !1, depthOnlyFormat: "depth32float", channels: 1 }, "depth24plus-stencil8": { bytesPerBlock: 8, blockWidth: 1, blockHeight: 1, isCompressed: !1, isDepthStencil: !0, hasDepth: !0, hasStencil: !0, depthOnlyFormat: "depth32float", channels: 1 }, depth32float: { bytesPerBlock: 4, blockWidth: 1, blockHeight: 1, isCompressed: !1, isDepthStencil: !0, hasDepth: !0, hasStencil: !1, channels: 1 }, "depth32float-stencil8": { bytesPerBlock: 8, blockWidth: 1, blockHeight: 1, isCompressed: !1, isDepthStencil: !0, hasDepth: !0, hasStencil: !0, stencilOnlyFormat: "depth32float", channels: 1 }, rgb9e5ufloat: { bytesPerBlock: 4, blockWidth: 1, blockHeight: 1, isCompressed: !1, channels: 4 }, "bc1-rgba-unorm": { bytesPerBlock: 8, blockWidth: 4, blockHeight: 4, isCompressed: !0, channels: 4 }, "bc1-rgba-unorm-srgb": { bytesPerBlock: 8, blockWidth: 4, blockHeight: 4, isCompressed: !0, channels: 4 }, "bc2-rgba-unorm": { bytesPerBlock: 16, blockWidth: 4, blockHeight: 4, isCompressed: !0, channels: 4 }, "bc2-rgba-unorm-srgb": { bytesPerBlock: 16, blockWidth: 4, blockHeight: 4, isCompressed: !0, channels: 4 }, "bc3-rgba-unorm": { bytesPerBlock: 16, blockWidth: 4, blockHeight: 4, isCompressed: !0, channels: 4 }, "bc3-rgba-unorm-srgb": { bytesPerBlock: 16, blockWidth: 4, blockHeight: 4, isCompressed: !0, channels: 4 }, "bc4-r-unorm": { bytesPerBlock: 8, blockWidth: 4, blockHeight: 4, isCompressed: !0, channels: 1 }, "bc4-r-snorm": { bytesPerBlock: 8, blockWidth: 4, blockHeight: 4, isCompressed: !0, channels: 1 }, "bc5-rg-unorm": { bytesPerBlock: 16, blockWidth: 4, blockHeight: 4, isCompressed: !0, channels: 2 }, "bc5-rg-snorm": { bytesPerBlock: 16, blockWidth: 4, blockHeight: 4, isCompressed: !0, channels: 2 }, "bc6h-rgb-ufloat": { bytesPerBlock: 16, blockWidth: 4, blockHeight: 4, isCompressed: !0, channels: 4 }, "bc6h-rgb-float": { bytesPerBlock: 16, blockWidth: 4, blockHeight: 4, isCompressed: !0, channels: 4 }, "bc7-rgba-unorm": { bytesPerBlock: 16, blockWidth: 4, blockHeight: 4, isCompressed: !0, channels: 4 }, "bc7-rgba-unorm-srgb": { bytesPerBlock: 16, blockWidth: 4, blockHeight: 4, isCompressed: !0, channels: 4 }, "etc2-rgb8unorm": { bytesPerBlock: 8, blockWidth: 4, blockHeight: 4, isCompressed: !0, channels: 4 }, "etc2-rgb8unorm-srgb": { bytesPerBlock: 8, blockWidth: 4, blockHeight: 4, isCompressed: !0, channels: 4 }, "etc2-rgb8a1unorm": { bytesPerBlock: 8, blockWidth: 4, blockHeight: 4, isCompressed: !0, channels: 4 }, "etc2-rgb8a1unorm-srgb": { bytesPerBlock: 8, blockWidth: 4, blockHeight: 4, isCompressed: !0, channels: 4 }, "etc2-rgba8unorm": { bytesPerBlock: 16, blockWidth: 4, blockHeight: 4, isCompressed: !0, channels: 4 }, "etc2-rgba8unorm-srgb": { bytesPerBlock: 16, blockWidth: 4, blockHeight: 4, isCompressed: !0, channels: 4 }, "eac-r11unorm": { bytesPerBlock: 8, blockWidth: 1, blockHeight: 1, isCompressed: !0, channels: 1 }, "eac-r11snorm": { bytesPerBlock: 8, blockWidth: 1, blockHeight: 1, isCompressed: !0, channels: 1 }, "eac-rg11unorm": { bytesPerBlock: 16, blockWidth: 1, blockHeight: 1, isCompressed: !0, channels: 2 }, "eac-rg11snorm": { bytesPerBlock: 16, blockWidth: 1, blockHeight: 1, isCompressed: !0, channels: 2 }, "astc-4x4-unorm": { bytesPerBlock: 16, blockWidth: 4, blockHeight: 4, isCompressed: !0, channels: 4 }, "astc-4x4-unorm-srgb": { bytesPerBlock: 16, blockWidth: 4, blockHeight: 4, isCompressed: !0, channels: 4 }, "astc-5x4-unorm": { bytesPerBlock: 16, blockWidth: 5, blockHeight: 4, isCompressed: !0, channels: 4 }, "astc-5x4-unorm-srgb": { bytesPerBlock: 16, blockWidth: 5, blockHeight: 4, isCompressed: !0, channels: 4 }, "astc-5x5-unorm": { bytesPerBlock: 16, blockWidth: 5, blockHeight: 5, isCompressed: !0, channels: 4 }, "astc-5x5-unorm-srgb": { bytesPerBlock: 16, blockWidth: 5, blockHeight: 5, isCompressed: !0, channels: 4 }, "astc-6x5-unorm": { bytesPerBlock: 16, blockWidth: 6, blockHeight: 5, isCompressed: !0, channels: 4 }, "astc-6x5-unorm-srgb": { bytesPerBlock: 16, blockWidth: 6, blockHeight: 5, isCompressed: !0, channels: 4 }, "astc-6x6-unorm": { bytesPerBlock: 16, blockWidth: 6, blockHeight: 6, isCompressed: !0, channels: 4 }, "astc-6x6-unorm-srgb": { bytesPerBlock: 16, blockWidth: 6, blockHeight: 6, isCompressed: !0, channels: 4 }, "astc-8x5-unorm": { bytesPerBlock: 16, blockWidth: 8, blockHeight: 5, isCompressed: !0, channels: 4 }, "astc-8x5-unorm-srgb": { bytesPerBlock: 16, blockWidth: 8, blockHeight: 5, isCompressed: !0, channels: 4 }, "astc-8x6-unorm": { bytesPerBlock: 16, blockWidth: 8, blockHeight: 6, isCompressed: !0, channels: 4 }, "astc-8x6-unorm-srgb": { bytesPerBlock: 16, blockWidth: 8, blockHeight: 6, isCompressed: !0, channels: 4 }, "astc-8x8-unorm": { bytesPerBlock: 16, blockWidth: 8, blockHeight: 8, isCompressed: !0, channels: 4 }, "astc-8x8-unorm-srgb": { bytesPerBlock: 16, blockWidth: 8, blockHeight: 8, isCompressed: !0, channels: 4 }, "astc-10x5-unorm": { bytesPerBlock: 16, blockWidth: 10, blockHeight: 5, isCompressed: !0, channels: 4 }, "astc-10x5-unorm-srgb": { bytesPerBlock: 16, blockWidth: 10, blockHeight: 5, isCompressed: !0, channels: 4 }, "astc-10x6-unorm": { bytesPerBlock: 16, blockWidth: 10, blockHeight: 6, isCompressed: !0, channels: 4 }, "astc-10x6-unorm-srgb": { bytesPerBlock: 16, blockWidth: 10, blockHeight: 6, isCompressed: !0, channels: 4 }, "astc-10x8-unorm": { bytesPerBlock: 16, blockWidth: 10, blockHeight: 8, isCompressed: !0, channels: 4 }, "astc-10x8-unorm-srgb": { bytesPerBlock: 16, blockWidth: 10, blockHeight: 8, isCompressed: !0, channels: 4 }, "astc-10x10-unorm": { bytesPerBlock: 16, blockWidth: 10, blockHeight: 10, isCompressed: !0, channels: 4 }, "astc-10x10-unorm-srgb": { bytesPerBlock: 16, blockWidth: 10, blockHeight: 10, isCompressed: !0, channels: 4 }, "astc-12x10-unorm": { bytesPerBlock: 16, blockWidth: 12, blockHeight: 10, isCompressed: !0, channels: 4 }, "astc-12x10-unorm-srgb": { bytesPerBlock: 16, blockWidth: 12, blockHeight: 10, isCompressed: !0, channels: 4 }, "astc-12x12-unorm": { bytesPerBlock: 16, blockWidth: 12, blockHeight: 12, isCompressed: !0, channels: 4 }, "astc-12x12-unorm-srgb": { bytesPerBlock: 16, blockWidth: 12, blockHeight: 12, isCompressed: !0, channels: 4 } };
2872
- class LA {
2888
+ class dA {
2873
2889
  constructor() {
2874
- this.id = LA._id++, this.line = 0;
2890
+ this.id = dA._id++, this.line = 0;
2875
2891
  }
2876
2892
  get isAstNode() {
2877
2893
  return !0;
@@ -2897,17 +2913,17 @@ class LA {
2897
2913
  return (g = (I = this.constEvaluate(A)) === null || I === void 0 ? void 0 : I.toString()) !== null && g !== void 0 ? g : "";
2898
2914
  }
2899
2915
  }
2900
- LA._id = 0;
2901
- class Cg extends LA {
2916
+ dA._id = 0;
2917
+ class Cg extends dA {
2902
2918
  }
2903
2919
  Cg.instance = new Cg();
2904
- class Qg extends LA {
2920
+ class Qg extends dA {
2905
2921
  }
2906
2922
  Qg.instance = new Qg();
2907
2923
  const LQ = /* @__PURE__ */ new Set(["all", "any", "select", "arrayLength", "abs", "acos", "acosh", "asin", "asinh", "atan", "atanh", "atan2", "ceil", "clamp", "cos", "cosh", "countLeadingZeros", "countOneBits", "countTrailingZeros", "cross", "degrees", "determinant", "distance", "dot", "dot4U8Packed", "dot4I8Packed", "exp", "exp2", "extractBits", "faceForward", "firstLeadingBit", "firstTrailingBit", "floor", "fma", "fract", "frexp", "insertBits", "inverseSqrt", "ldexp", "length", "log", "log2", "max", "min", "mix", "modf", "normalize", "pow", "quantizeToF16", "radians", "reflect", "refract", "reverseBits", "round", "saturate", "sign", "sin", "sinh", "smoothstep", "sqrt", "step", "tan", "tanh", "transpose", "trunc", "dpdx", "dpdxCoarse", "dpdxFine", "dpdy", "dpdyCoarse", "dpdyFine", "fwidth", "fwidthCoarse", "fwidthFine", "textureDimensions", "textureGather", "textureGatherCompare", "textureLoad", "textureNumLayers", "textureNumLevels", "textureNumSamples", "textureSample", "textureSampleBias", "textureSampleCompare", "textureSampleCompareLevel", "textureSampleGrad", "textureSampleLevel", "textureSampleBaseClampToEdge", "textureStore", "atomicLoad", "atomicStore", "atomicAdd", "atomicSub", "atomicMax", "atomicMin", "atomicAnd", "atomicOr", "atomicXor", "atomicExchange", "atomicCompareExchangeWeak", "pack4x8snorm", "pack4x8unorm", "pack4xI8", "pack4xU8", "pack4x8Clamp", "pack4xU8Clamp", "pack2x16snorm", "pack2x16unorm", "pack2x16float", "unpack4x8snorm", "unpack4x8unorm", "unpack4xI8", "unpack4xU8", "unpack2x16snorm", "unpack2x16unorm", "unpack2x16float", "storageBarrier", "textureBarrier", "workgroupBarrier", "workgroupUniformLoad", "subgroupAdd", "subgroupExclusiveAdd", "subgroupInclusiveAdd", "subgroupAll", "subgroupAnd", "subgroupAny", "subgroupBallot", "subgroupBroadcast", "subgroupBroadcastFirst", "subgroupElect", "subgroupMax", "subgroupMin", "subgroupMul", "subgroupExclusiveMul", "subgroupInclusiveMul", "subgroupOr", "subgroupShuffle", "subgroupShuffleDown", "subgroupShuffleUp", "subgroupShuffleXor", "subgroupXor", "quadBroadcast", "quadSwapDiagonal", "quadSwapX", "quadSwapY"]);
2908
- class iA extends LA {
2924
+ class EA extends dA {
2909
2925
  }
2910
- class mI extends iA {
2926
+ class mI extends EA {
2911
2927
  constructor(A, I, g, B, Q, E) {
2912
2928
  super(), this.calls = /* @__PURE__ */ new Set(), this.name = A, this.args = I, this.returnType = g, this.body = B, this.startLine = Q, this.endLine = E;
2913
2929
  }
@@ -2921,7 +2937,7 @@ class mI extends iA {
2921
2937
  this.searchBlock(this.body, A);
2922
2938
  }
2923
2939
  }
2924
- class wC extends iA {
2940
+ class wC extends EA {
2925
2941
  constructor(A) {
2926
2942
  super(), this.expression = A;
2927
2943
  }
@@ -2932,7 +2948,7 @@ class wC extends iA {
2932
2948
  this.expression.search(A);
2933
2949
  }
2934
2950
  }
2935
- class JQ extends iA {
2951
+ class JQ extends EA {
2936
2952
  constructor(A, I) {
2937
2953
  super(), this.condition = A, this.body = I;
2938
2954
  }
@@ -2943,7 +2959,7 @@ class JQ extends iA {
2943
2959
  this.condition.search(A), this.searchBlock(this.body, A);
2944
2960
  }
2945
2961
  }
2946
- class QB extends iA {
2962
+ class QB extends EA {
2947
2963
  constructor(A, I) {
2948
2964
  super(), this.body = A, this.loopId = I;
2949
2965
  }
@@ -2954,7 +2970,7 @@ class QB extends iA {
2954
2970
  this.searchBlock(this.body, A);
2955
2971
  }
2956
2972
  }
2957
- class YQ extends iA {
2973
+ class YQ extends EA {
2958
2974
  constructor(A, I, g, B) {
2959
2975
  super(), this.init = A, this.condition = I, this.increment = g, this.body = B;
2960
2976
  }
@@ -2966,7 +2982,7 @@ class YQ extends iA {
2966
2982
  (I = this.init) === null || I === void 0 || I.search(A), (g = this.condition) === null || g === void 0 || g.search(A), (B = this.increment) === null || B === void 0 || B.search(A), this.searchBlock(this.body, A);
2967
2983
  }
2968
2984
  }
2969
- class HA extends iA {
2985
+ class HA extends EA {
2970
2986
  constructor(A, I, g, B, Q) {
2971
2987
  super(), this.attributes = null, this.name = A, this.type = I, this.storage = g, this.access = B, this.value = Q;
2972
2988
  }
@@ -2978,7 +2994,7 @@ class HA extends iA {
2978
2994
  A(this), (I = this.value) === null || I === void 0 || I.search(A);
2979
2995
  }
2980
2996
  }
2981
- class lB extends iA {
2997
+ class lB extends EA {
2982
2998
  constructor(A, I, g) {
2983
2999
  super(), this.attributes = null, this.name = A, this.type = I, this.value = g;
2984
3000
  }
@@ -2990,7 +3006,7 @@ class lB extends iA {
2990
3006
  (I = this.value) === null || I === void 0 || I.search(A);
2991
3007
  }
2992
3008
  }
2993
- class fI extends iA {
3009
+ class fI extends EA {
2994
3010
  constructor(A, I, g, B, Q) {
2995
3011
  super(), this.attributes = null, this.name = A, this.type = I, this.storage = g, this.access = B, this.value = Q;
2996
3012
  }
@@ -3002,7 +3018,7 @@ class fI extends iA {
3002
3018
  A(this), (I = this.value) === null || I === void 0 || I.search(A);
3003
3019
  }
3004
3020
  }
3005
- class zI extends iA {
3021
+ class zI extends EA {
3006
3022
  constructor(A, I, g, B, Q) {
3007
3023
  super(), this.attributes = null, this.name = A, this.type = I, this.storage = g, this.access = B, this.value = Q;
3008
3024
  }
@@ -3017,17 +3033,17 @@ class zI extends iA {
3017
3033
  A(this), (I = this.value) === null || I === void 0 || I.search(A);
3018
3034
  }
3019
3035
  }
3020
- var eI, LI, G, h;
3036
+ var aI, LI, G, h;
3021
3037
  ((C) => {
3022
3038
  C.increment = "++", C.decrement = "--";
3023
- })(eI || (eI = {})), ((C) => {
3039
+ })(aI || (aI = {})), ((C) => {
3024
3040
  C.parse = function(A) {
3025
3041
  const I = A;
3026
3042
  if (I === "parse") throw new Error("Invalid value for IncrementOperator");
3027
3043
  return C[I];
3028
3044
  };
3029
- })(eI || (eI = {}));
3030
- class MQ extends iA {
3045
+ })(aI || (aI = {}));
3046
+ class MQ extends EA {
3031
3047
  constructor(A, I) {
3032
3048
  super(), this.operator = A, this.variable = I;
3033
3049
  }
@@ -3047,7 +3063,7 @@ class MQ extends iA {
3047
3063
  return I;
3048
3064
  };
3049
3065
  })(LI || (LI = {}));
3050
- class fQ extends iA {
3066
+ class fQ extends EA {
3051
3067
  constructor(A, I, g) {
3052
3068
  super(), this.operator = A, this.variable = I, this.value = g;
3053
3069
  }
@@ -3058,7 +3074,7 @@ class fQ extends iA {
3058
3074
  this.variable.search(A), this.value.search(A);
3059
3075
  }
3060
3076
  }
3061
- class LB extends iA {
3077
+ class LB extends EA {
3062
3078
  constructor(A, I) {
3063
3079
  super(), this.name = A, this.args = I;
3064
3080
  }
@@ -3073,7 +3089,7 @@ class LB extends iA {
3073
3089
  A(this);
3074
3090
  }
3075
3091
  }
3076
- class uQ extends iA {
3092
+ class uQ extends EA {
3077
3093
  constructor(A, I) {
3078
3094
  super(), this.body = A, this.continuing = I;
3079
3095
  }
@@ -3085,7 +3101,7 @@ class uQ extends iA {
3085
3101
  this.searchBlock(this.body, A), (I = this.continuing) === null || I === void 0 || I.search(A);
3086
3102
  }
3087
3103
  }
3088
- class KQ extends iA {
3104
+ class KQ extends EA {
3089
3105
  constructor(A, I) {
3090
3106
  super(), this.condition = A, this.cases = I;
3091
3107
  }
@@ -3097,7 +3113,7 @@ class KQ extends iA {
3097
3113
  for (const I of this.cases) I.search(A);
3098
3114
  }
3099
3115
  }
3100
- class HQ extends iA {
3116
+ class HQ extends EA {
3101
3117
  constructor(A, I, g, B) {
3102
3118
  super(), this.condition = A, this.body = I, this.elseif = g, this.else = B;
3103
3119
  }
@@ -3108,7 +3124,7 @@ class HQ extends iA {
3108
3124
  this.condition.search(A), this.searchBlock(this.body, A), this.searchBlock(this.elseif, A), this.searchBlock(this.else, A);
3109
3125
  }
3110
3126
  }
3111
- class qQ extends iA {
3127
+ class qQ extends EA {
3112
3128
  constructor(A) {
3113
3129
  super(), this.value = A;
3114
3130
  }
@@ -3120,7 +3136,7 @@ class qQ extends iA {
3120
3136
  (I = this.value) === null || I === void 0 || I.search(A);
3121
3137
  }
3122
3138
  }
3123
- class Pi extends iA {
3139
+ class Pi extends EA {
3124
3140
  constructor(A) {
3125
3141
  super(), this.name = A;
3126
3142
  }
@@ -3128,7 +3144,7 @@ class Pi extends iA {
3128
3144
  return "enable";
3129
3145
  }
3130
3146
  }
3131
- class Vi extends iA {
3147
+ class Vi extends EA {
3132
3148
  constructor(A) {
3133
3149
  super(), this.extensions = A;
3134
3150
  }
@@ -3136,7 +3152,7 @@ class Vi extends iA {
3136
3152
  return "requires";
3137
3153
  }
3138
3154
  }
3139
- class pQ extends iA {
3155
+ class pQ extends EA {
3140
3156
  constructor(A, I) {
3141
3157
  super(), this.severity = A, this.rule = I;
3142
3158
  }
@@ -3144,7 +3160,7 @@ class pQ extends iA {
3144
3160
  return "diagnostic";
3145
3161
  }
3146
3162
  }
3147
- class JB extends iA {
3163
+ class JB extends EA {
3148
3164
  constructor(A, I) {
3149
3165
  super(), this.name = A, this.type = I;
3150
3166
  }
@@ -3152,12 +3168,12 @@ class JB extends iA {
3152
3168
  return "alias";
3153
3169
  }
3154
3170
  }
3155
- class Oi extends iA {
3171
+ class Oi extends EA {
3156
3172
  get astNodeType() {
3157
3173
  return "discard";
3158
3174
  }
3159
3175
  }
3160
- class mQ extends iA {
3176
+ class mQ extends EA {
3161
3177
  constructor() {
3162
3178
  super(...arguments), this.condition = null, this.loopId = -1;
3163
3179
  }
@@ -3165,7 +3181,7 @@ class mQ extends iA {
3165
3181
  return "break";
3166
3182
  }
3167
3183
  }
3168
- class xQ extends iA {
3184
+ class xQ extends EA {
3169
3185
  constructor() {
3170
3186
  super(...arguments), this.loopId = -1;
3171
3187
  }
@@ -3173,7 +3189,7 @@ class xQ extends iA {
3173
3189
  return "continue";
3174
3190
  }
3175
3191
  }
3176
- class N extends iA {
3192
+ class N extends EA {
3177
3193
  constructor(A) {
3178
3194
  super(), this.attributes = null, this.name = A;
3179
3195
  }
@@ -3273,12 +3289,12 @@ class JI extends N {
3273
3289
  return "sampler";
3274
3290
  }
3275
3291
  }
3276
- class fA extends LA {
3292
+ class YA extends dA {
3277
3293
  constructor() {
3278
3294
  super(), this.postfix = null, this.hasParen = !1;
3279
3295
  }
3280
3296
  }
3281
- class CI extends fA {
3297
+ class BI extends YA {
3282
3298
  constructor(A) {
3283
3299
  super(), this.value = A;
3284
3300
  }
@@ -3292,7 +3308,7 @@ class CI extends fA {
3292
3308
  return this.value;
3293
3309
  }
3294
3310
  }
3295
- class KA extends fA {
3311
+ class KA extends YA {
3296
3312
  constructor(A, I) {
3297
3313
  super(), this.type = A, this.args = I;
3298
3314
  }
@@ -3306,7 +3322,7 @@ class KA extends fA {
3306
3322
  return I && (I[0] = this.type), A.evalExpression(this, A.context);
3307
3323
  }
3308
3324
  }
3309
- class YB extends fA {
3325
+ class YB extends YA {
3310
3326
  constructor(A, I) {
3311
3327
  super(), this.cachedReturnValue = null, this.name = A, this.args = I;
3312
3328
  }
@@ -3327,7 +3343,7 @@ class YB extends fA {
3327
3343
  A(this);
3328
3344
  }
3329
3345
  }
3330
- class wA extends fA {
3346
+ class wA extends YA {
3331
3347
  constructor(A) {
3332
3348
  super(), this.name = A;
3333
3349
  }
@@ -3341,7 +3357,7 @@ class wA extends fA {
3341
3357
  return A.evalExpression(this, A.context);
3342
3358
  }
3343
3359
  }
3344
- class bQ extends fA {
3360
+ class bQ extends YA {
3345
3361
  constructor(A, I) {
3346
3362
  super(), this.name = A, this.initializer = I;
3347
3363
  }
@@ -3356,7 +3372,7 @@ class bQ extends fA {
3356
3372
  this.initializer.search(A);
3357
3373
  }
3358
3374
  }
3359
- class rA extends fA {
3375
+ class rA extends YA {
3360
3376
  constructor(A, I) {
3361
3377
  super(), this.value = A, this.type = I;
3362
3378
  }
@@ -3379,7 +3395,7 @@ class rA extends fA {
3379
3395
  return this.value instanceof r || this.value instanceof p ? this.value.data : (console.error("Value is not a vector or matrix."), new Float32Array(0));
3380
3396
  }
3381
3397
  }
3382
- class TQ extends fA {
3398
+ class TQ extends YA {
3383
3399
  constructor(A, I) {
3384
3400
  super(), this.type = A, this.value = I;
3385
3401
  }
@@ -3390,7 +3406,7 @@ class TQ extends fA {
3390
3406
  this.value.search(A);
3391
3407
  }
3392
3408
  }
3393
- class hI extends fA {
3409
+ class hI extends YA {
3394
3410
  constructor(A) {
3395
3411
  super(), this.index = A;
3396
3412
  }
@@ -3398,7 +3414,7 @@ class hI extends fA {
3398
3414
  this.index.search(A);
3399
3415
  }
3400
3416
  }
3401
- class WQ extends fA {
3417
+ class WQ extends YA {
3402
3418
  constructor() {
3403
3419
  super();
3404
3420
  }
@@ -3417,7 +3433,7 @@ class tA extends WQ {
3417
3433
  this.right.search(A);
3418
3434
  }
3419
3435
  }
3420
- class YA extends WQ {
3436
+ class LA extends WQ {
3421
3437
  constructor(A, I, g) {
3422
3438
  super(), this.operator = A, this.left = I, this.right = g;
3423
3439
  }
@@ -3434,7 +3450,7 @@ class YA extends WQ {
3434
3450
  this.left.search(A), this.right.search(A);
3435
3451
  }
3436
3452
  }
3437
- class vQ extends LA {
3453
+ class vQ extends dA {
3438
3454
  constructor(A) {
3439
3455
  super(), this.body = A;
3440
3456
  }
@@ -3442,7 +3458,7 @@ class vQ extends LA {
3442
3458
  A(this), this.searchBlock(this.body, A);
3443
3459
  }
3444
3460
  }
3445
- class Ag extends fA {
3461
+ class Ag extends YA {
3446
3462
  get astNodeType() {
3447
3463
  return "default";
3448
3464
  }
@@ -3469,7 +3485,7 @@ class PQ extends vQ {
3469
3485
  this.searchBlock(this.body, A);
3470
3486
  }
3471
3487
  }
3472
- class FC extends LA {
3488
+ class FC extends dA {
3473
3489
  constructor(A, I, g) {
3474
3490
  super(), this.name = A, this.type = I, this.attributes = g;
3475
3491
  }
@@ -3477,7 +3493,7 @@ class FC extends LA {
3477
3493
  return "argument";
3478
3494
  }
3479
3495
  }
3480
- class _i extends LA {
3496
+ class _i extends dA {
3481
3497
  constructor(A, I) {
3482
3498
  super(), this.condition = A, this.body = I;
3483
3499
  }
@@ -3488,7 +3504,7 @@ class _i extends LA {
3488
3504
  this.condition.search(A), this.searchBlock(this.body, A);
3489
3505
  }
3490
3506
  }
3491
- class SC extends LA {
3507
+ class SC extends dA {
3492
3508
  constructor(A, I, g) {
3493
3509
  super(), this.name = A, this.type = I, this.attributes = g;
3494
3510
  }
@@ -3496,7 +3512,7 @@ class SC extends LA {
3496
3512
  return "member";
3497
3513
  }
3498
3514
  }
3499
- class VQ extends LA {
3515
+ class VQ extends dA {
3500
3516
  constructor(A, I) {
3501
3517
  super(), this.name = A, this.value = I;
3502
3518
  }
@@ -3504,9 +3520,9 @@ class VQ extends LA {
3504
3520
  return "attribute";
3505
3521
  }
3506
3522
  }
3507
- class uA {
3523
+ class MA {
3508
3524
  constructor(A, I) {
3509
- this.parent = null, this.typeInfo = A, this.parent = I, this.id = uA._id++;
3525
+ this.parent = null, this.typeInfo = A, this.parent = I, this.id = MA._id++;
3510
3526
  }
3511
3527
  setDataValue(A, I, g, B) {
3512
3528
  console.error(`SetDataValue: Not implemented for ${this.constructor.name}`);
@@ -3518,8 +3534,8 @@ class uA {
3518
3534
  return `<${this.typeInfo.getTypeName()}>`;
3519
3535
  }
3520
3536
  }
3521
- uA._id = 0;
3522
- class NC extends uA {
3537
+ MA._id = 0;
3538
+ class NC extends MA {
3523
3539
  constructor(A, I) {
3524
3540
  super(A, I);
3525
3541
  }
@@ -3530,9 +3546,9 @@ class NC extends uA {
3530
3546
  return this.typeInfo.name;
3531
3547
  }
3532
3548
  }
3533
- class EB extends uA {
3549
+ class EB extends MA {
3534
3550
  constructor() {
3535
- super(new dA("void", null), null);
3551
+ super(new kA("void", null), null);
3536
3552
  }
3537
3553
  clone() {
3538
3554
  return this;
@@ -3542,7 +3558,7 @@ class EB extends uA {
3542
3558
  }
3543
3559
  }
3544
3560
  EB.void = new EB();
3545
- class sI extends uA {
3561
+ class oI extends MA {
3546
3562
  constructor(A) {
3547
3563
  super(new CB("pointer", A.typeInfo, null), null), this.reference = A;
3548
3564
  }
@@ -3559,7 +3575,7 @@ class sI extends uA {
3559
3575
  return `&${this.reference.toString()}`;
3560
3576
  }
3561
3577
  }
3562
- class c extends uA {
3578
+ class c extends MA {
3563
3579
  constructor(A, I, g = null) {
3564
3580
  super(I, g), A instanceof Int32Array || A instanceof Uint32Array || A instanceof Float32Array ? this.data = A : this.typeInfo.name === "x32" ? A - Math.floor(A) !== 0 ? this.data = new Float32Array([A]) : this.data = A >= 0 ? new Uint32Array([A]) : new Int32Array([A]) : this.typeInfo.name === "i32" || this.typeInfo.name === "bool" ? this.data = new Int32Array([A]) : this.typeInfo.name === "u32" ? this.data = new Uint32Array([A]) : this.typeInfo.name === "f32" || this.typeInfo.name === "f16" ? this.data = new Float32Array([A]) : console.error("ScalarData2: Invalid type", I);
3565
3581
  }
@@ -3592,7 +3608,7 @@ function Xi(C, A, I) {
3592
3608
  const g = A.length;
3593
3609
  return g === 2 ? I === "f32" ? new r(new Float32Array(A), C.getTypeInfo("vec2f")) : I === "i32" || I === "bool" ? new r(new Int32Array(A), C.getTypeInfo("vec2i")) : I === "u32" ? new r(new Uint32Array(A), C.getTypeInfo("vec2u")) : I === "f16" ? new r(new Float32Array(A), C.getTypeInfo("vec2h")) : (console.error(`getSubData: Unknown format ${I}`), null) : g === 3 ? I === "f32" ? new r(new Float32Array(A), C.getTypeInfo("vec3f")) : I === "i32" || I === "bool" ? new r(new Int32Array(A), C.getTypeInfo("vec3i")) : I === "u32" ? new r(new Uint32Array(A), C.getTypeInfo("vec3u")) : I === "f16" ? new r(new Float32Array(A), C.getTypeInfo("vec3h")) : (console.error(`getSubData: Unknown format ${I}`), null) : g === 4 ? I === "f32" ? new r(new Float32Array(A), C.getTypeInfo("vec4f")) : I === "i32" || I === "bool" ? new r(new Int32Array(A), C.getTypeInfo("vec4i")) : I === "u32" ? new r(new Uint32Array(A), C.getTypeInfo("vec4u")) : I === "f16" ? new r(new Float32Array(A), C.getTypeInfo("vec4h")) : (console.error(`getSubData: Unknown format ${I}`), null) : (console.error(`getSubData: Invalid vector size ${A.length}`), null);
3594
3610
  }
3595
- class r extends uA {
3611
+ class r extends MA {
3596
3612
  constructor(A, I, g = null) {
3597
3613
  if (super(I, g), A instanceof Float32Array || A instanceof Uint32Array || A instanceof Int32Array) this.data = A;
3598
3614
  else {
@@ -3607,12 +3623,12 @@ class r extends uA {
3607
3623
  throw new Error("VectorData: Invalid data type");
3608
3624
  }
3609
3625
  setDataValue(A, I, g, B) {
3610
- g instanceof CI ? console.error("TODO: Set vector postfix") : I instanceof r ? this.data = I.data : console.error("SetDataValue: Invalid value", I);
3626
+ g instanceof BI ? console.error("TODO: Set vector postfix") : I instanceof r ? this.data = I.data : console.error("SetDataValue: Invalid value", I);
3611
3627
  }
3612
3628
  getSubData(A, I, g) {
3613
3629
  if (I === null) return this;
3614
3630
  let B = A.getTypeInfo("f32");
3615
- if (this.typeInfo instanceof BI) B = this.typeInfo.format || B;
3631
+ if (this.typeInfo instanceof gI) B = this.typeInfo.format || B;
3616
3632
  else {
3617
3633
  const E = this.typeInfo.name;
3618
3634
  E === "vec2f" || E === "vec3f" || E === "vec4f" ? B = A.getTypeInfo("f32") : E === "vec2i" || E === "vec3i" || E === "vec4i" ? B = A.getTypeInfo("i32") : E === "vec2b" || E === "vec3b" || E === "vec4b" ? B = A.getTypeInfo("bool") : E === "vec2u" || E === "vec3u" || E === "vec4u" ? B = A.getTypeInfo("u32") : E === "vec2h" || E === "vec3h" || E === "vec4h" ? B = A.getTypeInfo("f16") : console.error(`GetSubData: Unknown type ${E}`);
@@ -3645,7 +3661,7 @@ class r extends uA {
3645
3661
  }
3646
3662
  throw new Error("GetSubData: Invalid data type");
3647
3663
  }
3648
- if (!(I instanceof CI)) return console.error("GetSubData: Unknown postfix", I), null;
3664
+ if (!(I instanceof BI)) return console.error("GetSubData: Unknown postfix", I), null;
3649
3665
  {
3650
3666
  const E = I.value.toLowerCase();
3651
3667
  if (E.length === 1) {
@@ -3684,7 +3700,7 @@ class r extends uA {
3684
3700
  return A;
3685
3701
  }
3686
3702
  }
3687
- class p extends uA {
3703
+ class p extends MA {
3688
3704
  constructor(A, I, g = null) {
3689
3705
  super(I, g), A instanceof Float32Array ? this.data = A : this.data = new Float32Array(A);
3690
3706
  }
@@ -3692,12 +3708,12 @@ class p extends uA {
3692
3708
  return new p(new Float32Array(this.data), this.typeInfo, null);
3693
3709
  }
3694
3710
  setDataValue(A, I, g, B) {
3695
- g instanceof CI ? console.error("TODO: Set matrix postfix") : I instanceof p ? this.data = I.data : console.error("SetDataValue: Invalid value", I);
3711
+ g instanceof BI ? console.error("TODO: Set matrix postfix") : I instanceof p ? this.data = I.data : console.error("SetDataValue: Invalid value", I);
3696
3712
  }
3697
3713
  getSubData(A, I, g) {
3698
3714
  if (I === null) return this;
3699
3715
  const B = this.typeInfo.name;
3700
- if (A.getTypeInfo("f32"), this.typeInfo instanceof BI) this.typeInfo.format;
3716
+ if (A.getTypeInfo("f32"), this.typeInfo instanceof gI) this.typeInfo.format;
3701
3717
  else if (B.endsWith("f")) A.getTypeInfo("f32");
3702
3718
  else if (B.endsWith("i")) A.getTypeInfo("i32");
3703
3719
  else if (B.endsWith("u")) A.getTypeInfo("u32");
@@ -3735,19 +3751,19 @@ class p extends uA {
3735
3751
  return A;
3736
3752
  }
3737
3753
  }
3738
- class QA extends uA {
3754
+ class CA extends MA {
3739
3755
  constructor(A, I, g = 0, B = null) {
3740
3756
  super(I, B), this.buffer = A instanceof ArrayBuffer ? A : A.buffer, this.offset = g;
3741
3757
  }
3742
3758
  clone() {
3743
3759
  const A = new Uint8Array(new Uint8Array(this.buffer, this.offset, this.typeInfo.size));
3744
- return new QA(A.buffer, this.typeInfo, 0, null);
3760
+ return new CA(A.buffer, this.typeInfo, 0, null);
3745
3761
  }
3746
3762
  setDataValue(A, I, g, B) {
3747
3763
  if (I === null) return void console.log("setDataValue: NULL data.");
3748
3764
  let Q = this.offset, E = this.typeInfo;
3749
3765
  for (; g; ) {
3750
- if (g instanceof hI) if (E instanceof XA) {
3766
+ if (g instanceof hI) if (E instanceof _A) {
3751
3767
  const i = g.index;
3752
3768
  if (i instanceof rA) {
3753
3769
  if (!(i.value instanceof c)) return void console.error(`SetDataValue: Invalid index type ${i.value}`);
@@ -3760,7 +3776,7 @@ class QA extends uA {
3760
3776
  E = E.format;
3761
3777
  } else console.error(`SetDataValue: Type ${E.getTypeName()} is not an array`);
3762
3778
  else {
3763
- if (!(g instanceof CI)) return void console.error("SetDataValue: Unknown postfix type", g);
3779
+ if (!(g instanceof BI)) return void console.error("SetDataValue: Unknown postfix type", g);
3764
3780
  {
3765
3781
  const i = g.value;
3766
3782
  if (E instanceof PA) {
@@ -3770,7 +3786,7 @@ class QA extends uA {
3770
3786
  break;
3771
3787
  }
3772
3788
  if (!o) return void console.error(`SetDataValue: Member ${i} not found`);
3773
- } else if (E instanceof dA) {
3789
+ } else if (E instanceof kA) {
3774
3790
  const o = E.getTypeName();
3775
3791
  let s = 0;
3776
3792
  if (i === "x" || i === "r") s = 0;
@@ -3877,7 +3893,7 @@ class QA extends uA {
3877
3893
  const i = new Float32Array(this.buffer, B, 16);
3878
3894
  return void (I instanceof p ? (i[0] = I.data[0], i[1] = I.data[1], i[2] = I.data[2], i[3] = I.data[3], i[4] = I.data[4], i[5] = I.data[5], i[6] = I.data[6], i[7] = I.data[7], i[8] = I.data[8], i[9] = I.data[9], i[10] = I.data[10], i[11] = I.data[11], i[12] = I.data[12], i[13] = I.data[13], i[14] = I.data[14], i[15] = I.data[15]) : (i[0] = I[0], i[1] = I[1], i[2] = I[2], i[3] = I[3], i[4] = I[4], i[5] = I[5], i[6] = I[6], i[7] = I[7], i[8] = I[8], i[9] = I[9], i[10] = I[10], i[11] = I[11], i[12] = I[12], i[13] = I[13], i[14] = I[14], i[15] = I[15]));
3879
3895
  }
3880
- if (I instanceof QA) {
3896
+ if (I instanceof CA) {
3881
3897
  if (g === I.typeInfo)
3882
3898
  return void new Uint8Array(this.buffer, B, I.buffer.byteLength).set(new Uint8Array(I.buffer));
3883
3899
  console.error("SetDataValue: Type mismatch", E, I.typeInfo.getTypeName());
@@ -3893,15 +3909,15 @@ class QA extends uA {
3893
3909
  let i = this.offset, o = this.typeInfo;
3894
3910
  for (; I; ) {
3895
3911
  if (I instanceof hI) {
3896
- const t = I.index, a = t instanceof fA ? A.evalExpression(t, g) : t;
3912
+ const t = I.index, a = t instanceof YA ? A.evalExpression(t, g) : t;
3897
3913
  let n = 0;
3898
- if (a instanceof c ? n = a.value : typeof a == "number" ? n = a : console.error("GetDataValue: Invalid index type", t), o instanceof XA) i += n * o.stride, o = o.format;
3914
+ if (a instanceof c ? n = a.value : typeof a == "number" ? n = a : console.error("GetDataValue: Invalid index type", t), o instanceof _A) i += n * o.stride, o = o.format;
3899
3915
  else {
3900
3916
  const D = o.getTypeName();
3901
3917
  D === "mat4x4" || D === "mat4x4f" || D === "mat4x4h" ? (i += 16 * n, o = A.getTypeInfo("vec4f")) : D === "mat4x3" || D === "mat4x3f" || D === "mat4x3h" ? (i += 12 * n, o = A.getTypeInfo("vec3f")) : D === "mat4x2" || D === "mat4x2f" || D === "mat4x2h" ? (i += 8 * n, o = A.getTypeInfo("vec2f")) : D === "mat3x4" || D === "mat3x4f" || D === "mat3x4h" ? (i += 12 * n, o = A.getTypeInfo("vec4f")) : D === "mat3x3" || D === "mat3x3f" || D === "mat3x3h" ? (i += 9 * n, o = A.getTypeInfo("vec3f")) : D === "mat3x2" || D === "mat3x2f" || D === "mat3x2h" ? (i += 6 * n, o = A.getTypeInfo("vec2f")) : D === "mat2x4" || D === "mat2x4f" || D === "mat2x4h" ? (i += 8 * n, o = A.getTypeInfo("vec4f")) : D === "mat2x3" || D === "mat2x3f" || D === "mat2x3h" ? (i += 6 * n, o = A.getTypeInfo("vec3f")) : D === "mat2x2" || D === "mat2x2f" || D === "mat2x2h" ? (i += 4 * n, o = A.getTypeInfo("vec2f")) : D === "vec2f" || D === "vec3f" || D === "vec4f" ? (i += 4 * n, o = A.getTypeInfo("f32")) : D === "vec2h" || D === "vec3h" || D === "vec4h" ? (i += 2 * n, o = A.getTypeInfo("f16")) : D === "vec2b" || D === "vec3b" || D === "vec4b" ? (i += 1 * n, o = A.getTypeInfo("bool")) : D === "vec2i" || D === "vec3i" || D === "vec4i" ? (i += 4 * n, o = A.getTypeInfo("i32")) : D === "vec2u" || D === "vec3u" || D === "vec4u" ? (i += 4 * n, o = A.getTypeInfo("u32")) : console.error(`getDataValue: Type ${o.getTypeName()} is not an array`);
3902
3918
  }
3903
3919
  } else {
3904
- if (!(I instanceof CI)) return console.error("GetDataValue: Unknown postfix type", I), null;
3920
+ if (!(I instanceof BI)) return console.error("GetDataValue: Unknown postfix type", I), null;
3905
3921
  {
3906
3922
  const t = I.value;
3907
3923
  if (o instanceof PA) {
@@ -3911,7 +3927,7 @@ class QA extends uA {
3911
3927
  break;
3912
3928
  }
3913
3929
  if (!a) return console.error(`GetDataValue: Member ${t} not found`), null;
3914
- } else if (o instanceof dA) {
3930
+ } else if (o instanceof kA) {
3915
3931
  const a = o.getTypeName();
3916
3932
  if (a === "vec2f" || a === "vec3f" || a === "vec4f" || a === "vec2i" || a === "vec3i" || a === "vec4i" || a === "vec2u" || a === "vec3u" || a === "vec4u" || a === "vec2b" || a === "vec3b" || a === "vec4b" || a === "vec2h" || a === "vec3h" || a === "vec4h" || a === "vec2" || a === "vec3" || a === "vec4") {
3917
3933
  if (t.length > 0 && t.length < 5) {
@@ -3937,16 +3953,16 @@ class QA extends uA {
3937
3953
  if (a === "vec2f") D.push(new Float32Array(this.buffer, i, 2)[S]);
3938
3954
  else if (a === "vec3f") {
3939
3955
  if (i + 12 >= this.buffer.byteLength) return console.log("Insufficient buffer data"), null;
3940
- const d = new Float32Array(this.buffer, i, 3);
3941
- D.push(d[S]);
3956
+ const l = new Float32Array(this.buffer, i, 3);
3957
+ D.push(l[S]);
3942
3958
  } else if (a === "vec4f") D.push(new Float32Array(this.buffer, i, 4)[S]);
3943
3959
  else if (a === "vec2i") n = "i", D.push(new Int32Array(this.buffer, i, 2)[S]);
3944
3960
  else if (a === "vec3i") n = "i", D.push(new Int32Array(this.buffer, i, 3)[S]);
3945
3961
  else if (a === "vec4i") n = "i", D.push(new Int32Array(this.buffer, i, 4)[S]);
3946
3962
  else if (a === "vec2u") {
3947
3963
  n = "u";
3948
- const d = new Uint32Array(this.buffer, i, 2);
3949
- D.push(d[S]);
3964
+ const l = new Uint32Array(this.buffer, i, 2);
3965
+ D.push(l[S]);
3950
3966
  } else a === "vec3u" ? (n = "u", D.push(new Uint32Array(this.buffer, i, 3)[S])) : a === "vec4u" && (n = "u", D.push(new Uint32Array(this.buffer, i, 4)[S]));
3951
3967
  }
3952
3968
  return D.length === 2 ? o = A.getTypeInfo(`vec2${n}`) : D.length === 3 ? o = A.getTypeInfo(`vec3${n}`) : D.length === 4 ? o = A.getTypeInfo(`vec4${n}`) : console.error(`GetDataValue: Invalid vector length ${D.length}`), new r(D, o, null);
@@ -3960,7 +3976,7 @@ class QA extends uA {
3960
3976
  I = I.postfix;
3961
3977
  }
3962
3978
  const s = o.getTypeName();
3963
- return s === "f32" ? new c(new Float32Array(this.buffer, i, 1), o, this) : s === "i32" ? new c(new Int32Array(this.buffer, i, 1), o, this) : s === "u32" ? new c(new Uint32Array(this.buffer, i, 1), o, this) : s === "vec2f" ? new r(new Float32Array(this.buffer, i, 2), o, this) : s === "vec3f" ? new r(new Float32Array(this.buffer, i, 3), o, this) : s === "vec4f" ? new r(new Float32Array(this.buffer, i, 4), o, this) : s === "vec2i" ? new r(new Int32Array(this.buffer, i, 2), o, this) : s === "vec3i" ? new r(new Int32Array(this.buffer, i, 3), o, this) : s === "vec4i" ? new r(new Int32Array(this.buffer, i, 4), o, this) : s === "vec2u" ? new r(new Uint32Array(this.buffer, i, 2), o, this) : s === "vec3u" ? new r(new Uint32Array(this.buffer, i, 3), o, this) : s === "vec4u" ? new r(new Uint32Array(this.buffer, i, 4), o, this) : o instanceof BI && o.name === "atomic" ? ((B = o.format) === null || B === void 0 ? void 0 : B.name) === "u32" ? new c(new Uint32Array(this.buffer, i, 1)[0], o.format, this) : ((Q = o.format) === null || Q === void 0 ? void 0 : Q.name) === "i32" ? new c(new Int32Array(this.buffer, i, 1)[0], o.format, this) : (console.error(`GetDataValue: Invalid atomic format ${(E = o.format) === null || E === void 0 ? void 0 : E.name}`), null) : new QA(this.buffer, o, i, this);
3979
+ return s === "f32" ? new c(new Float32Array(this.buffer, i, 1), o, this) : s === "i32" ? new c(new Int32Array(this.buffer, i, 1), o, this) : s === "u32" ? new c(new Uint32Array(this.buffer, i, 1), o, this) : s === "vec2f" ? new r(new Float32Array(this.buffer, i, 2), o, this) : s === "vec3f" ? new r(new Float32Array(this.buffer, i, 3), o, this) : s === "vec4f" ? new r(new Float32Array(this.buffer, i, 4), o, this) : s === "vec2i" ? new r(new Int32Array(this.buffer, i, 2), o, this) : s === "vec3i" ? new r(new Int32Array(this.buffer, i, 3), o, this) : s === "vec4i" ? new r(new Int32Array(this.buffer, i, 4), o, this) : s === "vec2u" ? new r(new Uint32Array(this.buffer, i, 2), o, this) : s === "vec3u" ? new r(new Uint32Array(this.buffer, i, 3), o, this) : s === "vec4u" ? new r(new Uint32Array(this.buffer, i, 4), o, this) : o instanceof gI && o.name === "atomic" ? ((B = o.format) === null || B === void 0 ? void 0 : B.name) === "u32" ? new c(new Uint32Array(this.buffer, i, 1)[0], o.format, this) : ((Q = o.format) === null || Q === void 0 ? void 0 : Q.name) === "i32" ? new c(new Int32Array(this.buffer, i, 1)[0], o.format, this) : (console.error(`GetDataValue: Invalid atomic format ${(E = o.format) === null || E === void 0 ? void 0 : E.name}`), null) : new CA(this.buffer, o, i, this);
3964
3980
  }
3965
3981
  toArray() {
3966
3982
  const A = this.typeInfo.getTypeName();
@@ -3968,7 +3984,7 @@ class QA extends uA {
3968
3984
  }
3969
3985
  toString() {
3970
3986
  let A = "";
3971
- if (this.typeInfo instanceof XA) if (this.typeInfo.format.name === "f32") {
3987
+ if (this.typeInfo instanceof _A) if (this.typeInfo.format.name === "f32") {
3972
3988
  const I = new Float32Array(this.buffer, this.offset);
3973
3989
  A = `[${I[0]}`;
3974
3990
  for (let g = 1; g < I.length; ++g) A += `, ${I[g]}`;
@@ -3997,7 +4013,7 @@ class QA extends uA {
3997
4013
  return A;
3998
4014
  }
3999
4015
  }
4000
- class xA extends uA {
4016
+ class xA extends MA {
4001
4017
  constructor(A, I, g, B) {
4002
4018
  super(I, null), this.data = A, this.descriptor = g, this.view = B;
4003
4019
  }
@@ -4064,9 +4080,9 @@ class xA extends uA {
4064
4080
  }
4065
4081
  setPixel(A, I, g, B, Q) {
4066
4082
  const E = this.texelByteSize, i = this.bytesPerRow, o = this.height, s = this.data[B];
4067
- (function(t, a, n, D, F, U, S, d, K, k) {
4068
- const R = D * (S >>= F) * (U >>= F) + n * S + a * d;
4069
- switch (K) {
4083
+ (function(t, a, n, D, F, U, S, l, u, k) {
4084
+ const R = D * (S >>= F) * (U >>= F) + n * S + a * l;
4085
+ switch (u) {
4070
4086
  case "r8unorm":
4071
4087
  return void _(t, R, "8unorm", 1, k);
4072
4088
  case "r8snorm":
@@ -4576,7 +4592,7 @@ class qA {
4576
4592
  return this._types.set(A, Q), this._updateTypeInfo(Q), Q;
4577
4593
  }
4578
4594
  if (A instanceof uI) {
4579
- const B = A, Q = B.format ? this.getTypeInfo(B.format, B.attributes) : null, E = new XA(B.name, I);
4595
+ const B = A, Q = B.format ? this.getTypeInfo(B.format, B.attributes) : null, E = new _A(B.name, I);
4580
4596
  return E.format = Q, E.count = B.count, this._types.set(A, E), this._updateTypeInfo(E), E;
4581
4597
  }
4582
4598
  if (A instanceof mA) {
@@ -4589,20 +4605,20 @@ class qA {
4589
4605
  return this._types.set(A, Q), this._updateTypeInfo(Q), Q;
4590
4606
  }
4591
4607
  if (A instanceof JI) {
4592
- const B = A, Q = B.format instanceof N, E = B.format ? Q ? this.getTypeInfo(B.format, null) : new dA(B.format, null) : null, i = new BI(B.name, E, I, B.access);
4608
+ const B = A, Q = B.format instanceof N, E = B.format ? Q ? this.getTypeInfo(B.format, null) : new kA(B.format, null) : null, i = new gI(B.name, E, I, B.access);
4593
4609
  return this._types.set(A, i), this._updateTypeInfo(i), i;
4594
4610
  }
4595
4611
  if (A instanceof w) {
4596
- const B = A, Q = B.format ? this.getTypeInfo(B.format, null) : null, E = new BI(B.name, Q, I, B.access);
4612
+ const B = A, Q = B.format ? this.getTypeInfo(B.format, null) : null, E = new gI(B.name, Q, I, B.access);
4597
4613
  return this._types.set(A, E), this._updateTypeInfo(E), E;
4598
4614
  }
4599
- const g = new dA(A.name, I);
4615
+ const g = new kA(A.name, I);
4600
4616
  return this._types.set(A, g), this._updateTypeInfo(g), g;
4601
4617
  }
4602
4618
  _updateTypeInfo(A) {
4603
4619
  var I, g, B;
4604
4620
  const Q = this._getTypeSize(A);
4605
- if (A.size = (I = Q?.size) !== null && I !== void 0 ? I : 0, A instanceof XA && A.format) {
4621
+ if (A.size = (I = Q?.size) !== null && I !== void 0 ? I : 0, A instanceof _A && A.format) {
4606
4622
  const E = this._getTypeSize(A.format);
4607
4623
  A.stride = Math.max((g = E?.size) !== null && g !== void 0 ? g : 0, (B = E?.align) !== null && B !== void 0 ? B : 0), this._updateTypeInfo(A.format);
4608
4624
  }
@@ -4624,7 +4640,7 @@ class qA {
4624
4640
  var I, g;
4625
4641
  if (A == null) return null;
4626
4642
  const B = this._getAttributeNum(A.attributes, "size", 0), Q = this._getAttributeNum(A.attributes, "align", 0);
4627
- if (A instanceof hC && (A = A.type), A instanceof dA) {
4643
+ if (A instanceof hC && (A = A.type), A instanceof kA) {
4628
4644
  const E = this._getAlias(A.name);
4629
4645
  E !== null && (A = E);
4630
4646
  }
@@ -4642,7 +4658,7 @@ class qA {
4642
4658
  return new XI(Math.max(Q, E.align / i), Math.max(B, E.size / i));
4643
4659
  }
4644
4660
  }
4645
- if (A instanceof XA) {
4661
+ if (A instanceof _A) {
4646
4662
  let E = A, i = 8, o = 8;
4647
4663
  const s = this._getTypeSize(E.format);
4648
4664
  return s !== null && (o = s.size, i = s.align), o = E.count * this._getAttributeNum((g = A?.attributes) !== null && g !== void 0 ? g : null, "stride", this._roundUp(i, o)), B && (o = B), new XI(Math.max(Q, i), Math.max(B, o));
@@ -4780,7 +4796,7 @@ class Qo {
4780
4796
  let g = A.args[0];
4781
4797
  g instanceof tA && (g = g.right);
4782
4798
  const B = this.exec.evalExpression(g, I);
4783
- if (B instanceof QA && B.typeInfo.size === 0) {
4799
+ if (B instanceof CA && B.typeInfo.size === 0) {
4784
4800
  const Q = B.typeInfo, E = B.buffer.byteLength / Q.stride;
4785
4801
  return new c(E, this.getTypeInfo("u32"));
4786
4802
  }
@@ -5372,7 +5388,7 @@ class Qo {
5372
5388
  const B = this.exec.getVariableName(g, I), Q = I.getVariable(B);
5373
5389
  let E = A.args[1];
5374
5390
  const i = this.exec.evalExpression(E, I), o = Q.value.getSubData(this.exec, g.postfix, I);
5375
- return o instanceof c && i instanceof c && (o.value = i.value), Q.value instanceof QA && Q.value.setDataValue(this.exec, o, g.postfix, I), null;
5391
+ return o instanceof c && i instanceof c && (o.value = i.value), Q.value instanceof CA && Q.value.setDataValue(this.exec, o, g.postfix, I), null;
5376
5392
  }
5377
5393
  AtomicAdd(A, I) {
5378
5394
  let g = A.args[0];
@@ -5380,7 +5396,7 @@ class Qo {
5380
5396
  const B = this.exec.getVariableName(g, I), Q = I.getVariable(B);
5381
5397
  let E = A.args[1];
5382
5398
  const i = this.exec.evalExpression(E, I), o = Q.value.getSubData(this.exec, g.postfix, I), s = new c(o.value, o.typeInfo);
5383
- return o instanceof c && i instanceof c && (o.value += i.value), Q.value instanceof QA && Q.value.setDataValue(this.exec, o, g.postfix, I), s;
5399
+ return o instanceof c && i instanceof c && (o.value += i.value), Q.value instanceof CA && Q.value.setDataValue(this.exec, o, g.postfix, I), s;
5384
5400
  }
5385
5401
  AtomicSub(A, I) {
5386
5402
  let g = A.args[0];
@@ -5388,7 +5404,7 @@ class Qo {
5388
5404
  const B = this.exec.getVariableName(g, I), Q = I.getVariable(B);
5389
5405
  let E = A.args[1];
5390
5406
  const i = this.exec.evalExpression(E, I), o = Q.value.getSubData(this.exec, g.postfix, I), s = new c(o.value, o.typeInfo);
5391
- return o instanceof c && i instanceof c && (o.value -= i.value), Q.value instanceof QA && Q.value.setDataValue(this.exec, o, g.postfix, I), s;
5407
+ return o instanceof c && i instanceof c && (o.value -= i.value), Q.value instanceof CA && Q.value.setDataValue(this.exec, o, g.postfix, I), s;
5392
5408
  }
5393
5409
  AtomicMax(A, I) {
5394
5410
  let g = A.args[0];
@@ -5396,7 +5412,7 @@ class Qo {
5396
5412
  const B = this.exec.getVariableName(g, I), Q = I.getVariable(B);
5397
5413
  let E = A.args[1];
5398
5414
  const i = this.exec.evalExpression(E, I), o = Q.value.getSubData(this.exec, g.postfix, I), s = new c(o.value, o.typeInfo);
5399
- return o instanceof c && i instanceof c && (o.value = Math.max(o.value, i.value)), Q.value instanceof QA && Q.value.setDataValue(this.exec, o, g.postfix, I), s;
5415
+ return o instanceof c && i instanceof c && (o.value = Math.max(o.value, i.value)), Q.value instanceof CA && Q.value.setDataValue(this.exec, o, g.postfix, I), s;
5400
5416
  }
5401
5417
  AtomicMin(A, I) {
5402
5418
  let g = A.args[0];
@@ -5404,7 +5420,7 @@ class Qo {
5404
5420
  const B = this.exec.getVariableName(g, I), Q = I.getVariable(B);
5405
5421
  let E = A.args[1];
5406
5422
  const i = this.exec.evalExpression(E, I), o = Q.value.getSubData(this.exec, g.postfix, I), s = new c(o.value, o.typeInfo);
5407
- return o instanceof c && i instanceof c && (o.value = Math.min(o.value, i.value)), Q.value instanceof QA && Q.value.setDataValue(this.exec, o, g.postfix, I), s;
5423
+ return o instanceof c && i instanceof c && (o.value = Math.min(o.value, i.value)), Q.value instanceof CA && Q.value.setDataValue(this.exec, o, g.postfix, I), s;
5408
5424
  }
5409
5425
  AtomicAnd(A, I) {
5410
5426
  let g = A.args[0];
@@ -5412,7 +5428,7 @@ class Qo {
5412
5428
  const B = this.exec.getVariableName(g, I), Q = I.getVariable(B);
5413
5429
  let E = A.args[1];
5414
5430
  const i = this.exec.evalExpression(E, I), o = Q.value.getSubData(this.exec, g.postfix, I), s = new c(o.value, o.typeInfo);
5415
- return o instanceof c && i instanceof c && (o.value = o.value & i.value), Q.value instanceof QA && Q.value.setDataValue(this.exec, o, g.postfix, I), s;
5431
+ return o instanceof c && i instanceof c && (o.value = o.value & i.value), Q.value instanceof CA && Q.value.setDataValue(this.exec, o, g.postfix, I), s;
5416
5432
  }
5417
5433
  AtomicOr(A, I) {
5418
5434
  let g = A.args[0];
@@ -5420,7 +5436,7 @@ class Qo {
5420
5436
  const B = this.exec.getVariableName(g, I), Q = I.getVariable(B);
5421
5437
  let E = A.args[1];
5422
5438
  const i = this.exec.evalExpression(E, I), o = Q.value.getSubData(this.exec, g.postfix, I), s = new c(o.value, o.typeInfo);
5423
- return o instanceof c && i instanceof c && (o.value = o.value | i.value), Q.value instanceof QA && Q.value.setDataValue(this.exec, o, g.postfix, I), s;
5439
+ return o instanceof c && i instanceof c && (o.value = o.value | i.value), Q.value instanceof CA && Q.value.setDataValue(this.exec, o, g.postfix, I), s;
5424
5440
  }
5425
5441
  AtomicXor(A, I) {
5426
5442
  let g = A.args[0];
@@ -5428,7 +5444,7 @@ class Qo {
5428
5444
  const B = this.exec.getVariableName(g, I), Q = I.getVariable(B);
5429
5445
  let E = A.args[1];
5430
5446
  const i = this.exec.evalExpression(E, I), o = Q.value.getSubData(this.exec, g.postfix, I), s = new c(o.value, o.typeInfo);
5431
- return o instanceof c && i instanceof c && (o.value = o.value ^ i.value), Q.value instanceof QA && Q.value.setDataValue(this.exec, o, g.postfix, I), s;
5447
+ return o instanceof c && i instanceof c && (o.value = o.value ^ i.value), Q.value instanceof CA && Q.value.setDataValue(this.exec, o, g.postfix, I), s;
5432
5448
  }
5433
5449
  AtomicExchange(A, I) {
5434
5450
  let g = A.args[0];
@@ -5436,7 +5452,7 @@ class Qo {
5436
5452
  const B = this.exec.getVariableName(g, I), Q = I.getVariable(B);
5437
5453
  let E = A.args[1];
5438
5454
  const i = this.exec.evalExpression(E, I), o = Q.value.getSubData(this.exec, g.postfix, I), s = new c(o.value, o.typeInfo);
5439
- return o instanceof c && i instanceof c && (o.value = i.value), Q.value instanceof QA && Q.value.setDataValue(this.exec, o, g.postfix, I), s;
5455
+ return o instanceof c && i instanceof c && (o.value = i.value), Q.value instanceof CA && Q.value.setDataValue(this.exec, o, g.postfix, I), s;
5440
5456
  }
5441
5457
  AtomicCompareExchangeWeak(A, I) {
5442
5458
  return console.error("TODO: atomicCompareExchangeWeak"), null;
@@ -5578,7 +5594,7 @@ class Qo {
5578
5594
  }
5579
5595
  }
5580
5596
  const mg = { vec2: 2, vec2f: 2, vec2i: 2, vec2u: 2, vec2b: 2, vec2h: 2, vec3: 3, vec3f: 3, vec3i: 3, vec3u: 3, vec3b: 3, vec3h: 3, vec4: 4, vec4f: 4, vec4i: 4, vec4u: 4, vec4b: 4, vec4h: 4 }, cA = { mat2x2: [2, 2, 4], mat2x2f: [2, 2, 4], mat2x2h: [2, 2, 4], mat2x3: [2, 3, 6], mat2x3f: [2, 3, 6], mat2x3h: [2, 3, 6], mat2x4: [2, 4, 8], mat2x4f: [2, 4, 8], mat2x4h: [2, 4, 8], mat3x2: [3, 2, 6], mat3x2f: [3, 2, 6], mat3x2h: [3, 2, 6], mat3x3: [3, 3, 9], mat3x3f: [3, 3, 9], mat3x3h: [3, 3, 9], mat3x4: [3, 4, 12], mat3x4f: [3, 4, 12], mat3x4h: [3, 4, 12], mat4x2: [4, 2, 8], mat4x2f: [4, 2, 8], mat4x2h: [4, 2, 8], mat4x3: [4, 3, 12], mat4x3f: [4, 3, 12], mat4x3h: [4, 3, 12], mat4x4: [4, 4, 16], mat4x4f: [4, 4, 16], mat4x4h: [4, 4, 16] };
5581
- class BA extends Co {
5597
+ class gA extends Co {
5582
5598
  constructor(A, I) {
5583
5599
  var g;
5584
5600
  super(), this.ast = A ?? [], this.reflection = new qA(), this.reflection.updateAST(this.ast), this.context = (g = I?.clone()) !== null && g !== void 0 ? g : new KB(), this.builtins = new Qo(this), this.typeInfo = { bool: this.getTypeInfo(N.bool), i32: this.getTypeInfo(N.i32), u32: this.getTypeInfo(N.u32), f32: this.getTypeInfo(N.f32), f16: this.getTypeInfo(N.f16), vec2f: this.getTypeInfo(w.vec2f), vec2u: this.getTypeInfo(w.vec2u), vec2i: this.getTypeInfo(w.vec2i), vec2h: this.getTypeInfo(w.vec2h), vec3f: this.getTypeInfo(w.vec3f), vec3u: this.getTypeInfo(w.vec3u), vec3i: this.getTypeInfo(w.vec3i), vec3h: this.getTypeInfo(w.vec3h), vec4f: this.getTypeInfo(w.vec4f), vec4u: this.getTypeInfo(w.vec4u), vec4i: this.getTypeInfo(w.vec4i), vec4h: this.getTypeInfo(w.vec4h), mat2x2f: this.getTypeInfo(w.mat2x2f), mat2x3f: this.getTypeInfo(w.mat2x3f), mat2x4f: this.getTypeInfo(w.mat2x4f), mat3x2f: this.getTypeInfo(w.mat3x2f), mat3x3f: this.getTypeInfo(w.mat3x3f), mat3x4f: this.getTypeInfo(w.mat3x4f), mat4x2f: this.getTypeInfo(w.mat4x2f), mat4x3f: this.getTypeInfo(w.mat4x3f), mat4x4f: this.getTypeInfo(w.mat4x4f) };
@@ -5589,7 +5605,7 @@ class BA extends Co {
5589
5605
  if (B === null) return null;
5590
5606
  if (B instanceof c) return B.value;
5591
5607
  if (B instanceof r || B instanceof p) return Array.from(B.data);
5592
- if (B instanceof QA && B.typeInfo instanceof XA) {
5608
+ if (B instanceof CA && B.typeInfo instanceof _A) {
5593
5609
  if (B.typeInfo.format.name === "u32") return Array.from(new Uint32Array(B.buffer, B.offset, B.typeInfo.count));
5594
5610
  if (B.typeInfo.format.name === "i32") return Array.from(new Int32Array(B.buffer, B.offset, B.typeInfo.count));
5595
5611
  if (B.typeInfo.format.name === "f32") return Array.from(new Float32Array(B.buffer, B.offset, B.typeInfo.count));
@@ -5617,20 +5633,20 @@ class BA extends Co {
5617
5633
  const F = g[n][D];
5618
5634
  Q.variables.forEach((U) => {
5619
5635
  var S;
5620
- const d = U.node;
5621
- if (d?.attributes) {
5622
- let K = null, k = null;
5623
- for (const R of d.attributes) R.name === "binding" ? K = R.value : R.name === "group" && (k = R.value);
5624
- if (D === K && n === k) {
5636
+ const l = U.node;
5637
+ if (l?.attributes) {
5638
+ let u = null, k = null;
5639
+ for (const R of l.attributes) R.name === "binding" ? u = R.value : R.name === "group" && (k = R.value);
5640
+ if (D === u && n === k) {
5625
5641
  let R = !1;
5626
5642
  for (const L of a.resources) if (L.name === U.name && L.group === parseInt(n) && L.binding === parseInt(D)) {
5627
5643
  R = !0;
5628
5644
  break;
5629
5645
  }
5630
5646
  if (R) if (F.texture !== void 0 && F.descriptor !== void 0) {
5631
- const L = new xA(F.texture, this.getTypeInfo(d.type), F.descriptor, (S = F.texture.view) !== null && S !== void 0 ? S : null);
5647
+ const L = new xA(F.texture, this.getTypeInfo(l.type), F.descriptor, (S = F.texture.view) !== null && S !== void 0 ? S : null);
5632
5648
  U.value = L;
5633
- } else F.uniform !== void 0 ? U.value = new QA(F.uniform, this.getTypeInfo(d.type)) : U.value = new QA(F, this.getTypeInfo(d.type));
5649
+ } else F.uniform !== void 0 ? U.value = new CA(F.uniform, this.getTypeInfo(l.type)) : U.value = new CA(F, this.getTypeInfo(l.type));
5634
5650
  }
5635
5651
  }
5636
5652
  });
@@ -5645,9 +5661,9 @@ class BA extends Co {
5645
5661
  if (!(g instanceof c)) throw new Error("Invalid break-if condition");
5646
5662
  if (!g.value) return null;
5647
5663
  }
5648
- return BA._breakObj;
5664
+ return gA._breakObj;
5649
5665
  }
5650
- if (A instanceof xQ) return BA._continueObj;
5666
+ if (A instanceof xQ) return gA._continueObj;
5651
5667
  if (A instanceof fI) this._let(A, I);
5652
5668
  else if (A instanceof HA) this._var(A, I);
5653
5669
  else if (A instanceof zI) this._const(A, I);
@@ -5677,7 +5693,7 @@ class BA extends Co {
5677
5693
  return null;
5678
5694
  }
5679
5695
  evalExpression(A, I) {
5680
- return A instanceof YA ? this._evalBinaryOp(A, I) : A instanceof rA ? this._evalLiteral(A, I) : A instanceof wA ? this._evalVariable(A, I) : A instanceof YB ? this._evalCall(A, I) : A instanceof KA ? this._evalCreate(A, I) : A instanceof bQ ? this._evalConst(A, I) : A instanceof TQ ? this._evalBitcast(A, I) : A instanceof tA ? this._evalUnaryOp(A, I) : (console.error("Invalid expression type", A, `Line ${A.line}`), null);
5696
+ return A instanceof LA ? this._evalBinaryOp(A, I) : A instanceof rA ? this._evalLiteral(A, I) : A instanceof wA ? this._evalVariable(A, I) : A instanceof YB ? this._evalCall(A, I) : A instanceof KA ? this._evalCreate(A, I) : A instanceof bQ ? this._evalConst(A, I) : A instanceof TQ ? this._evalBitcast(A, I) : A instanceof tA ? this._evalUnaryOp(A, I) : (console.error("Invalid expression type", A, `Line ${A.line}`), null);
5681
5697
  }
5682
5698
  getTypeInfo(A) {
5683
5699
  var I;
@@ -5691,7 +5707,7 @@ class BA extends Co {
5691
5707
  _setOverrides(A, I) {
5692
5708
  for (const g in A) {
5693
5709
  const B = A[g], Q = this.reflection.getOverrideInfo(g);
5694
- Q !== null ? (Q.type === null && (Q.type = this.getTypeInfo("u32")), BA._numericScalarTypes.has(Q.type.name) ? I.setVariable(g, new c(B, Q.type)) : BA._vectorTypes.has(Q.type.name) ? I.setVariable(g, new r(B, Q.type)) : console.error(`Invalid constant type for ${g}`)) : console.error(`Override ${g} does not exist in the shader.`);
5710
+ Q !== null ? (Q.type === null && (Q.type = this.getTypeInfo("u32")), gA._numericScalarTypes.has(Q.type.name) ? I.setVariable(g, new c(B, Q.type)) : gA._vectorTypes.has(Q.type.name) ? I.setVariable(g, new r(B, Q.type)) : console.error(`Invalid constant type for ${g}`)) : console.error(`Override ${g} does not exist in the shader.`);
5695
5711
  }
5696
5712
  }
5697
5713
  _dispatchWorkgroup(A, I, g) {
@@ -5765,11 +5781,11 @@ class BA extends Co {
5765
5781
  if (A instanceof tA) {
5766
5782
  if (A.operator === "*") {
5767
5783
  const g = this._getVariableData(A.right, I);
5768
- return g instanceof sI ? g.reference.getSubData(this, A.postfix, I) : (console.error(`Variable ${A.right} is not a pointer. Line ${A.line}`), null);
5784
+ return g instanceof oI ? g.reference.getSubData(this, A.postfix, I) : (console.error(`Variable ${A.right} is not a pointer. Line ${A.line}`), null);
5769
5785
  }
5770
5786
  if (A.operator === "&") {
5771
5787
  const g = this._getVariableData(A.right, I);
5772
- return new sI(g);
5788
+ return new oI(g);
5773
5789
  }
5774
5790
  }
5775
5791
  return null;
@@ -5782,7 +5798,7 @@ class BA extends Co {
5782
5798
  if (o instanceof c || o instanceof r || o instanceof p) {
5783
5799
  if (s instanceof c || s instanceof r || s instanceof p && o.data.length === s.data.length) return void o.data.set(s.data);
5784
5800
  console.error(`Invalid assignment. Line ${A.line}`);
5785
- } else if (o instanceof QA && s instanceof QA && o.buffer.byteLength - o.offset >= s.buffer.byteLength - s.offset) return void (o.buffer.byteLength % 4 == 0 ? new Uint32Array(o.buffer, o.offset, o.typeInfo.size / 4).set(new Uint32Array(s.buffer, s.offset, s.typeInfo.size / 4)) : new Uint8Array(o.buffer, o.offset, o.typeInfo.size).set(new Uint8Array(s.buffer, s.offset, s.typeInfo.size)));
5801
+ } else if (o instanceof CA && s instanceof CA && o.buffer.byteLength - o.offset >= s.buffer.byteLength - s.offset) return void (o.buffer.byteLength % 4 == 0 ? new Uint32Array(o.buffer, o.offset, o.typeInfo.size / 4).set(new Uint32Array(s.buffer, s.offset, s.typeInfo.size / 4)) : new Uint8Array(o.buffer, o.offset, o.typeInfo.size).set(new Uint8Array(s.buffer, s.offset, s.typeInfo.size)));
5786
5802
  return console.error(`Invalid assignment. Line ${A.line}`), null;
5787
5803
  }
5788
5804
  if (t === "+=") return o instanceof c || o instanceof r || o instanceof p ? s instanceof c || s instanceof r || s instanceof p ? void o.data.set(s.data.map((a, n) => o.data[n] + a)) : void console.error(`Invalid assignment . Line ${A.line}`) : void console.error(`Invalid assignment. Line ${A.line}`);
@@ -5792,7 +5808,7 @@ class BA extends Co {
5792
5808
  if (A.variable.operator === "*") {
5793
5809
  B = this.getVariableName(A.variable.right, I);
5794
5810
  const o = I.getVariable(B);
5795
- if (!(o && o.value instanceof sI)) return void console.error(`Variable ${B} is not a pointer. Line ${A.line}`);
5811
+ if (!(o && o.value instanceof oI)) return void console.error(`Variable ${B} is not a pointer. Line ${A.line}`);
5796
5812
  g = o.value.reference;
5797
5813
  let s = A.variable.postfix;
5798
5814
  if (!s) {
@@ -5813,7 +5829,7 @@ class BA extends Co {
5813
5829
  if (o === null) return void console.error(`Variable ${B} not found. Line ${A.line}`);
5814
5830
  g = o.value;
5815
5831
  }
5816
- if (g instanceof sI && (g = g.reference), g === null) return void console.error(`Variable ${B} not found. Line ${A.line}`);
5832
+ if (g instanceof oI && (g = g.reference), g === null) return void console.error(`Variable ${B} not found. Line ${A.line}`);
5817
5833
  const E = this.evalExpression(A.value, I), i = A.operator;
5818
5834
  if (i !== "=") {
5819
5835
  const o = g.getSubData(this, Q, I);
@@ -5848,9 +5864,9 @@ class BA extends Co {
5848
5864
  if (!(o instanceof c && E instanceof c)) return void console.error(`Invalid type for ${A.operator} operator. Line ${A.line}`);
5849
5865
  i === "+=" ? o.value += E.value : i === "-=" ? o.value -= E.value : i === "*=" ? o.value *= E.value : i === "/=" ? o.value /= E.value : i === "%=" ? o.value %= E.value : i === "&=" ? o.value &= E.value : i === "|=" ? o.value |= E.value : i === "^=" ? o.value ^= E.value : i === "<<=" ? o.value <<= E.value : i === ">>=" ? o.value >>= E.value : console.error(`Invalid operator ${i}. Line ${A.line}`);
5850
5866
  }
5851
- return void (g instanceof QA && g.setDataValue(this, o, Q, I));
5867
+ return void (g instanceof CA && g.setDataValue(this, o, Q, I));
5852
5868
  }
5853
- if (g instanceof QA) g.setDataValue(this, E, Q, I);
5869
+ if (g instanceof CA) g.setDataValue(this, E, Q, I);
5854
5870
  else if (Q) {
5855
5871
  if (!(g instanceof r || g instanceof p)) return void console.error(`Variable ${B} is not a vector or matrix. Line ${A.line}`);
5856
5872
  if (Q instanceof hI) {
@@ -5898,7 +5914,7 @@ class BA extends Co {
5898
5914
  }
5899
5915
  }
5900
5916
  }
5901
- } else if (Q instanceof CI) {
5917
+ } else if (Q instanceof BI) {
5902
5918
  const o = Q.value;
5903
5919
  if (!(g instanceof r)) return void console.error(`Invalid assignment to ${o}. Variable ${B} is not a vector. Line ${A.line}`);
5904
5920
  if (E instanceof c) {
@@ -5958,7 +5974,7 @@ class BA extends Co {
5958
5974
  A.value instanceof tA || (g = g.clone());
5959
5975
  } else {
5960
5976
  const B = A.type.name;
5961
- if (BA._defaultableTypes.has(B)) {
5977
+ if (gA._defaultableTypes.has(B)) {
5962
5978
  const Q = new KA(A.type, []);
5963
5979
  g = this._evalCreate(Q, I);
5964
5980
  }
@@ -5973,7 +5989,7 @@ class BA extends Co {
5973
5989
  } else {
5974
5990
  if (A.type === null) return void console.error(`Variable ${A.name} has no type. Line ${A.line}`);
5975
5991
  const B = A.type.name;
5976
- if (BA._defaultableTypes.has(B) || A.type instanceof uI || A.type instanceof mA || A.type instanceof w) {
5992
+ if (gA._defaultableTypes.has(B) || A.type instanceof uI || A.type instanceof mA || A.type instanceof w) {
5977
5993
  const Q = new KA(A.type, []);
5978
5994
  g = this._evalCreate(Q, I);
5979
5995
  }
@@ -6015,8 +6031,8 @@ class BA extends Co {
6015
6031
  _for(A, I) {
6016
6032
  for (I = I.clone(), this.execStatement(A.init, I); this._getScalarValue(this.evalExpression(A.condition, I)); ) {
6017
6033
  const g = this._execStatements(A.body, I);
6018
- if (g === BA._breakObj) break;
6019
- if (g !== null && g !== BA._continueObj) return g;
6034
+ if (g === gA._breakObj) break;
6035
+ if (g !== null && g !== gA._continueObj) return g;
6020
6036
  this.execStatement(A.increment, I);
6021
6037
  }
6022
6038
  return null;
@@ -6024,9 +6040,9 @@ class BA extends Co {
6024
6040
  _loop(A, I) {
6025
6041
  for (I = I.clone(); ; ) {
6026
6042
  const g = this._execStatements(A.body, I);
6027
- if (g === BA._breakObj) break;
6028
- if (g === BA._continueObj) {
6029
- if (A.continuing && this._execStatements(A.continuing.body, I) === BA._breakObj)
6043
+ if (g === gA._breakObj) break;
6044
+ if (g === gA._continueObj) {
6045
+ if (A.continuing && this._execStatements(A.continuing.body, I) === gA._breakObj)
6030
6046
  break;
6031
6047
  } else if (g !== null) return g;
6032
6048
  }
@@ -6035,8 +6051,8 @@ class BA extends Co {
6035
6051
  _while(A, I) {
6036
6052
  for (I = I.clone(); this._getScalarValue(this.evalExpression(A.condition, I)); ) {
6037
6053
  const g = this._execStatements(A.body, I);
6038
- if (g === BA._breakObj) break;
6039
- if (g !== BA._continueObj && g !== null) return g;
6054
+ if (g === gA._breakObj) break;
6055
+ if (g !== gA._continueObj && g !== null) return g;
6040
6056
  }
6041
6057
  return null;
6042
6058
  }
@@ -6143,13 +6159,13 @@ class BA extends Co {
6143
6159
  const B = A instanceof KA ? A.type.name : A.name, Q = A instanceof KA ? this.getTypeInfo(A.type) : this.getTypeInfo(A.name);
6144
6160
  if (Q === null) return console.error(`Unknown type ${B}. Line ${A.line}`), null;
6145
6161
  if (Q.size === 0) return null;
6146
- const E = new QA(new ArrayBuffer(Q.size), Q, 0);
6162
+ const E = new CA(new ArrayBuffer(Q.size), Q, 0);
6147
6163
  if (Q instanceof PA) {
6148
6164
  if (A.args) for (let i = 0; i < A.args.length; ++i) {
6149
6165
  const o = Q.members[i], s = A.args[i], t = this.evalExpression(s, I);
6150
6166
  E.setData(this, t, o.type, o.offset, I);
6151
6167
  }
6152
- } else if (Q instanceof XA) {
6168
+ } else if (Q instanceof _A) {
6153
6169
  let i = 0;
6154
6170
  if (A.args) for (let o = 0; o < A.args.length; ++o) {
6155
6171
  const s = A.args[o], t = this.evalExpression(s, I);
@@ -6170,15 +6186,15 @@ class BA extends Co {
6170
6186
  let I = A[0];
6171
6187
  if (I.name === "f32") return I;
6172
6188
  for (let g = 1; g < A.length; ++g) {
6173
- const B = BA._priority.get(I.name);
6174
- BA._priority.get(A[g].name) < B && (I = A[g]);
6189
+ const B = gA._priority.get(I.name);
6190
+ gA._priority.get(A[g].name) < B && (I = A[g]);
6175
6191
  }
6176
6192
  return I.name === "x32" ? this.getTypeInfo("i32") : I;
6177
6193
  }
6178
6194
  _evalUnaryOp(A, I) {
6179
6195
  const g = this.evalExpression(A.right, I);
6180
- if (A.operator === "&") return new sI(g);
6181
- if (A.operator === "*") return g instanceof sI ? g.reference.getSubData(this, A.postfix, I) : (console.error(`Invalid dereference. Line ${A.line}`), null);
6196
+ if (A.operator === "&") return new oI(g);
6197
+ if (A.operator === "*") return g instanceof oI ? g.reference.getSubData(this, A.postfix, I) : (console.error(`Invalid dereference. Line ${A.line}`), null);
6182
6198
  const B = g instanceof c ? g.value : g instanceof r ? Array.from(g.data) : null;
6183
6199
  switch (A.operator) {
6184
6200
  case "+": {
@@ -6223,7 +6239,7 @@ class BA extends Co {
6223
6239
  return A.typeInfo.getTypeName().startsWith("vec");
6224
6240
  }
6225
6241
  _evalBinaryOp(A, I) {
6226
- const g = this.evalExpression(A.left, I), B = this.evalExpression(A.right, I), Q = g instanceof c ? g.value : g instanceof r || g instanceof p ? Array.from(g.data) : g instanceof QA ? g.toArray() : null, E = B instanceof c ? B.value : B instanceof r || B instanceof p ? Array.from(B.data) : B instanceof QA ? B.toArray() : null;
6242
+ const g = this.evalExpression(A.left, I), B = this.evalExpression(A.right, I), Q = g instanceof c ? g.value : g instanceof r || g instanceof p ? Array.from(g.data) : g instanceof CA ? g.toArray() : null, E = B instanceof c ? B.value : B instanceof r || B instanceof p ? Array.from(B.data) : B instanceof CA ? B.toArray() : null;
6227
6243
  switch (A.operator) {
6228
6244
  case "+": {
6229
6245
  if (J(Q) && J(E)) {
@@ -6265,15 +6281,15 @@ class BA extends Co {
6265
6281
  if (J(Q) && J(E)) {
6266
6282
  const t = Q, a = E;
6267
6283
  if (this._isMatrixType(g) && this._isMatrixType(B)) {
6268
- const n = (function(S, d, K, k) {
6269
- if (cA[d.name] === void 0 || cA[k.name] === void 0) return null;
6270
- const R = cA[d.name][0], L = cA[d.name][1], M = cA[k.name][0];
6284
+ const n = (function(S, l, u, k) {
6285
+ if (cA[l.name] === void 0 || cA[k.name] === void 0) return null;
6286
+ const R = cA[l.name][0], L = cA[l.name][1], M = cA[k.name][0];
6271
6287
  if (R !== cA[k.name][1]) return null;
6272
6288
  const W = new Array(M * L);
6273
- for (let IA = 0; IA < L; IA++) for (let CA = 0; CA < M; CA++) {
6274
- let $ = 0;
6275
- for (let gA = 0; gA < R; gA++) $ += S[gA * L + IA] * K[CA * R + gA];
6276
- W[IA * M + CA] = $;
6289
+ for (let $ = 0; $ < L; $++) for (let BA = 0; BA < M; BA++) {
6290
+ let IA = 0;
6291
+ for (let iA = 0; iA < R; iA++) IA += S[iA * L + $] * u[BA * R + iA];
6292
+ W[$ * M + BA] = IA;
6277
6293
  }
6278
6294
  return W;
6279
6295
  })(t, g.typeInfo, a, B.typeInfo);
@@ -6284,12 +6300,12 @@ class BA extends Co {
6284
6300
  if (this._isMatrixType(g) && this._isVectorType(B)) {
6285
6301
  const n = (function(D, F, U, S) {
6286
6302
  if (cA[F.name] === void 0 || mg[S.name] === void 0) return null;
6287
- const d = cA[F.name][0], K = cA[F.name][1];
6288
- if (d !== U.length) return null;
6289
- const k = new Array(K);
6290
- for (let R = 0; R < K; R++) {
6303
+ const l = cA[F.name][0], u = cA[F.name][1];
6304
+ if (l !== U.length) return null;
6305
+ const k = new Array(u);
6306
+ for (let R = 0; R < u; R++) {
6291
6307
  let L = 0;
6292
- for (let M = 0; M < d; M++) L += D[M * K + R] * U[M];
6308
+ for (let M = 0; M < l; M++) L += D[M * u + R] * U[M];
6293
6309
  k[R] = L;
6294
6310
  }
6295
6311
  return k;
@@ -6299,12 +6315,12 @@ class BA extends Co {
6299
6315
  if (this._isVectorType(g) && this._isMatrixType(B)) {
6300
6316
  const n = (function(D, F, U, S) {
6301
6317
  if (mg[F.name] === void 0 || cA[S.name] === void 0) return null;
6302
- const d = cA[S.name][0], K = cA[S.name][1];
6303
- if (K !== D.length) return null;
6318
+ const l = cA[S.name][0], u = cA[S.name][1];
6319
+ if (u !== D.length) return null;
6304
6320
  const k = [];
6305
- for (let R = 0; R < d; R++) {
6321
+ for (let R = 0; R < l; R++) {
6306
6322
  let L = 0;
6307
- for (let M = 0; M < K; M++) L += D[M] * U[M * d + R];
6323
+ for (let M = 0; M < u; M++) L += D[M] * U[M * l + R];
6308
6324
  k[R] = L;
6309
6325
  }
6310
6326
  return k;
@@ -6947,14 +6963,14 @@ class BA extends Co {
6947
6963
  const o = this.evalExpression(i, I);
6948
6964
  o instanceof r ? E.push(...o.data) : o instanceof c ? E.push(o.value) : o instanceof p && E.push(...o.data);
6949
6965
  }
6950
- if (g instanceof BI && g.format === null && (g.format = this.getTypeInfo("f32")), E.length === 0) {
6966
+ if (g instanceof gI && g.format === null && (g.format = this.getTypeInfo("f32")), E.length === 0) {
6951
6967
  const i = new Array(Q[2]).fill(0);
6952
6968
  return new p(i, g).getSubData(this, A.postfix, I);
6953
6969
  }
6954
6970
  return E.length !== Q[2] ? (console.error(`Invalid matrix constructor. Line ${A.line}`), null) : new p(E, g).getSubData(this, A.postfix, I);
6955
6971
  }
6956
6972
  }
6957
- BA._numericScalarTypes = /* @__PURE__ */ new Set(["f32", "i32", "u32", "bool", "f16"]), BA._vectorTypes = /* @__PURE__ */ new Set(["vec2", "vec3", "vec4", "vec2f", "vec3f", "vec4f", "vec2i", "vec3i", "vec4i", "vec2u", "vec3u", "vec4u", "vec2h", "vec3h", "vec4h", "vec2b", "vec3b", "vec4b"]), BA._matrixTypes = /* @__PURE__ */ new Set(["mat2x2", "mat2x3", "mat2x4", "mat3x2", "mat3x3", "mat3x4", "mat4x2", "mat4x3", "mat4x4", "mat2x2f", "mat2x3f", "mat2x4f", "mat3x2f", "mat3x3f", "mat3x4f", "mat4x2f", "mat4x3f", "mat4x4f", "mat2x2h", "mat2x3h", "mat2x4h", "mat3x2h", "mat3x3h", "mat3x4h", "mat4x2h", "mat4x3h", "mat4x4h"]), BA._defaultableTypes = /* @__PURE__ */ new Set([...BA._numericScalarTypes, ...BA._vectorTypes, ...BA._matrixTypes, "array"]), BA._breakObj = new NC(new dA("BREAK", null), null), BA._continueObj = new NC(new dA("CONTINUE", null), null), BA._priority = /* @__PURE__ */ new Map([["f32", 0], ["f16", 1], ["u32", 2], ["i32", 3], ["x32", 3]]);
6973
+ gA._numericScalarTypes = /* @__PURE__ */ new Set(["f32", "i32", "u32", "bool", "f16"]), gA._vectorTypes = /* @__PURE__ */ new Set(["vec2", "vec3", "vec4", "vec2f", "vec3f", "vec4f", "vec2i", "vec3i", "vec4i", "vec2u", "vec3u", "vec4u", "vec2h", "vec3h", "vec4h", "vec2b", "vec3b", "vec4b"]), gA._matrixTypes = /* @__PURE__ */ new Set(["mat2x2", "mat2x3", "mat2x4", "mat3x2", "mat3x3", "mat3x4", "mat4x2", "mat4x3", "mat4x4", "mat2x2f", "mat2x3f", "mat2x4f", "mat3x2f", "mat3x3f", "mat3x4f", "mat4x2f", "mat4x3f", "mat4x4f", "mat2x2h", "mat2x3h", "mat2x4h", "mat3x2h", "mat3x3h", "mat3x4h", "mat4x2h", "mat4x3h", "mat4x4h"]), gA._defaultableTypes = /* @__PURE__ */ new Set([...gA._numericScalarTypes, ...gA._vectorTypes, ...gA._matrixTypes, "array"]), gA._breakObj = new NC(new kA("BREAK", null), null), gA._continueObj = new NC(new kA("CONTINUE", null), null), gA._priority = /* @__PURE__ */ new Map([["f32", 0], ["f16", 1], ["u32", 2], ["i32", 3], ["x32", 3]]);
6958
6974
  class Eo {
6959
6975
  constructor() {
6960
6976
  this.constants = /* @__PURE__ */ new Map(), this.aliases = /* @__PURE__ */ new Map(), this.structs = /* @__PURE__ */ new Map();
@@ -6962,7 +6978,7 @@ class Eo {
6962
6978
  }
6963
6979
  class io {
6964
6980
  constructor() {
6965
- this._tokens = [], this._current = 0, this._currentLine = 1, this._deferArrayCountEval = [], this._currentLoop = [], this._context = new Eo(), this._exec = new BA(), this._forwardTypeCount = 0;
6981
+ this._tokens = [], this._current = 0, this._currentLine = 1, this._deferArrayCountEval = [], this._currentLoop = [], this._context = new Eo(), this._exec = new gA(), this._forwardTypeCount = 0;
6966
6982
  }
6967
6983
  parse(A) {
6968
6984
  this._initialize(A), this._deferArrayCountEval.length = 0;
@@ -7238,7 +7254,7 @@ class io {
7238
7254
  if (I === null) return null;
7239
7255
  if (!this._check(e.increment_operators)) return this._current = A, null;
7240
7256
  const g = this._consume(e.increment_operators, "Expected increment operator");
7241
- return this._updateNode(new MQ(g.type === e.tokens.plus_plus ? eI.increment : eI.decrement, I));
7257
+ return this._updateNode(new MQ(g.type === e.tokens.plus_plus ? aI.increment : aI.decrement, I));
7242
7258
  }
7243
7259
  _assignment_statement() {
7244
7260
  let A = null;
@@ -7338,51 +7354,51 @@ class io {
7338
7354
  }
7339
7355
  _short_circuit_or_expression() {
7340
7356
  let A = this._short_circuit_and_expr();
7341
- for (; this._match(e.tokens.or_or); ) A = this._updateNode(new YA(this._previous().toString(), A, this._short_circuit_and_expr()));
7357
+ for (; this._match(e.tokens.or_or); ) A = this._updateNode(new LA(this._previous().toString(), A, this._short_circuit_and_expr()));
7342
7358
  return A;
7343
7359
  }
7344
7360
  _short_circuit_and_expr() {
7345
7361
  let A = this._inclusive_or_expression();
7346
- for (; this._match(e.tokens.and_and); ) A = this._updateNode(new YA(this._previous().toString(), A, this._inclusive_or_expression()));
7362
+ for (; this._match(e.tokens.and_and); ) A = this._updateNode(new LA(this._previous().toString(), A, this._inclusive_or_expression()));
7347
7363
  return A;
7348
7364
  }
7349
7365
  _inclusive_or_expression() {
7350
7366
  let A = this._exclusive_or_expression();
7351
- for (; this._match(e.tokens.or); ) A = this._updateNode(new YA(this._previous().toString(), A, this._exclusive_or_expression()));
7367
+ for (; this._match(e.tokens.or); ) A = this._updateNode(new LA(this._previous().toString(), A, this._exclusive_or_expression()));
7352
7368
  return A;
7353
7369
  }
7354
7370
  _exclusive_or_expression() {
7355
7371
  let A = this._and_expression();
7356
- for (; this._match(e.tokens.xor); ) A = this._updateNode(new YA(this._previous().toString(), A, this._and_expression()));
7372
+ for (; this._match(e.tokens.xor); ) A = this._updateNode(new LA(this._previous().toString(), A, this._and_expression()));
7357
7373
  return A;
7358
7374
  }
7359
7375
  _and_expression() {
7360
7376
  let A = this._equality_expression();
7361
- for (; this._match(e.tokens.and); ) A = this._updateNode(new YA(this._previous().toString(), A, this._equality_expression()));
7377
+ for (; this._match(e.tokens.and); ) A = this._updateNode(new LA(this._previous().toString(), A, this._equality_expression()));
7362
7378
  return A;
7363
7379
  }
7364
7380
  _equality_expression() {
7365
7381
  const A = this._relational_expression();
7366
- return this._match([e.tokens.equal_equal, e.tokens.not_equal]) ? this._updateNode(new YA(this._previous().toString(), A, this._relational_expression())) : A;
7382
+ return this._match([e.tokens.equal_equal, e.tokens.not_equal]) ? this._updateNode(new LA(this._previous().toString(), A, this._relational_expression())) : A;
7367
7383
  }
7368
7384
  _relational_expression() {
7369
7385
  let A = this._shift_expression();
7370
- for (; this._match([e.tokens.less_than, e.tokens.greater_than, e.tokens.less_than_equal, e.tokens.greater_than_equal]); ) A = this._updateNode(new YA(this._previous().toString(), A, this._shift_expression()));
7386
+ for (; this._match([e.tokens.less_than, e.tokens.greater_than, e.tokens.less_than_equal, e.tokens.greater_than_equal]); ) A = this._updateNode(new LA(this._previous().toString(), A, this._shift_expression()));
7371
7387
  return A;
7372
7388
  }
7373
7389
  _shift_expression() {
7374
7390
  let A = this._additive_expression();
7375
- for (; this._match([e.tokens.shift_left, e.tokens.shift_right]); ) A = this._updateNode(new YA(this._previous().toString(), A, this._additive_expression()));
7391
+ for (; this._match([e.tokens.shift_left, e.tokens.shift_right]); ) A = this._updateNode(new LA(this._previous().toString(), A, this._additive_expression()));
7376
7392
  return A;
7377
7393
  }
7378
7394
  _additive_expression() {
7379
7395
  let A = this._multiplicative_expression();
7380
- for (; this._match([e.tokens.plus, e.tokens.minus]); ) A = this._updateNode(new YA(this._previous().toString(), A, this._multiplicative_expression()));
7396
+ for (; this._match([e.tokens.plus, e.tokens.minus]); ) A = this._updateNode(new LA(this._previous().toString(), A, this._multiplicative_expression()));
7381
7397
  return A;
7382
7398
  }
7383
7399
  _multiplicative_expression() {
7384
7400
  let A = this._unary_expression();
7385
- for (; this._match([e.tokens.star, e.tokens.forward_slash, e.tokens.modulo]); ) A = this._updateNode(new YA(this._previous().toString(), A, this._unary_expression()));
7401
+ for (; this._match([e.tokens.star, e.tokens.forward_slash, e.tokens.modulo]); ) A = this._updateNode(new LA(this._previous().toString(), A, this._unary_expression()));
7386
7402
  return A;
7387
7403
  }
7388
7404
  _unary_expression() {
@@ -7400,7 +7416,7 @@ class io {
7400
7416
  return g && (I.postfix = g), I;
7401
7417
  }
7402
7418
  if (this._match(e.tokens.period)) {
7403
- const A = this._consume(e.tokens.name, "Expected member name."), I = this._postfix_expression(), g = this._updateNode(new CI(A.lexeme));
7419
+ const A = this._consume(e.tokens.name, "Expected member name."), I = this._postfix_expression(), g = this._updateNode(new BI(A.lexeme));
7404
7420
  return I && (g.postfix = I), g;
7405
7421
  }
7406
7422
  return null;
@@ -7650,7 +7666,7 @@ class io {
7650
7666
  const E = this._short_circuit_or_expression();
7651
7667
  try {
7652
7668
  let o = [N.f32], s = E.constEvaluate(this._exec, o);
7653
- s instanceof c && this._validateTypeRange(s.value, o[0]), o[0] instanceof w && o[0].format === null && s.typeInfo instanceof BI && s.typeInfo.format !== null && (s.typeInfo.format.name === "f16" ? o[0].format = N.f16 : s.typeInfo.format.name === "f32" ? o[0].format = N.f32 : s.typeInfo.format.name === "i32" ? o[0].format = N.i32 : s.typeInfo.format.name === "u32" ? o[0].format = N.u32 : s.typeInfo.format.name === "bool" ? o[0].format = N.bool : console.error(`TODO: implement template format type ${s.typeInfo.format.name}`)), Q = this._updateNode(new rA(s, o[0])), this._exec.context.setVariable(I.toString(), s);
7669
+ s instanceof c && this._validateTypeRange(s.value, o[0]), o[0] instanceof w && o[0].format === null && s.typeInfo instanceof gI && s.typeInfo.format !== null && (s.typeInfo.format.name === "f16" ? o[0].format = N.f16 : s.typeInfo.format.name === "f32" ? o[0].format = N.f32 : s.typeInfo.format.name === "i32" ? o[0].format = N.i32 : s.typeInfo.format.name === "u32" ? o[0].format = N.u32 : s.typeInfo.format.name === "bool" ? o[0].format = N.bool : console.error(`TODO: implement template format type ${s.typeInfo.format.name}`)), Q = this._updateNode(new rA(s, o[0])), this._exec.context.setVariable(I.toString(), s);
7654
7670
  } catch {
7655
7671
  Q = E;
7656
7672
  }
@@ -7859,7 +7875,7 @@ function ao(C, A) {
7859
7875
  }
7860
7876
  return g.map((Q) => ({ entries: [...Q.values()].sort(to) }));
7861
7877
  }
7862
- function AI(C, A) {
7878
+ function $A(C, A) {
7863
7879
  return Object.fromEntries(A.map((I) => {
7864
7880
  const g = yo(C, I, 0);
7865
7881
  return [
@@ -7995,7 +8011,7 @@ function bg(C, A) {
7995
8011
  return I;
7996
8012
  }
7997
8013
  function ho(C) {
7998
- const A = new oo(C), I = Object.fromEntries(A.structs.map((a) => [a.name, OQ(A, a, 0)])), g = AI(A, A.uniforms), B = AI(A, A.immediates), Q = AI(A, A.storage.filter((a) => a.resourceType === sA.Storage)), E = AI(A, A.storage.filter((a) => a.resourceType === sA.StorageTexture)), i = AI(A, A.textures.filter((a) => a.type.name !== "texture_external")), o = AI(A, A.textures.filter((a) => a.type.name === "texture_external")), s = AI(A, A.samplers), t = {
8014
+ const A = new oo(C), I = Object.fromEntries(A.structs.map((a) => [a.name, OQ(A, a, 0)])), g = $A(A, A.uniforms), B = $A(A, A.immediates), Q = $A(A, A.storage.filter((a) => a.resourceType === sA.Storage)), E = $A(A, A.storage.filter((a) => a.resourceType === sA.StorageTexture)), i = $A(A, A.textures.filter((a) => a.type.name !== "texture_external")), o = $A(A, A.textures.filter((a) => a.type.name === "texture_external")), s = $A(A, A.samplers), t = {
7999
8015
  ...bg(A.entry.vertex, GPUShaderStage.VERTEX),
8000
8016
  ...bg(A.entry.fragment, GPUShaderStage.FRAGMENT),
8001
8017
  ...bg(A.entry.compute, GPUShaderStage.COMPUTE)
@@ -8397,8 +8413,8 @@ class Mo extends cQ {
8397
8413
  context_;
8398
8414
  depthFormat_;
8399
8415
  device_;
8400
- currentProjection_ = FA();
8401
- currentModelView_ = FA();
8416
+ currentProjection_ = SA();
8417
+ currentModelView_ = SA();
8402
8418
  colorMSAATexture_ = null;
8403
8419
  depthStencilTexture_ = null;
8404
8420
  passEncoder_ = null;
@@ -8441,7 +8457,7 @@ class Mo extends cQ {
8441
8457
  for (const o of A.layers)
8442
8458
  (o.blendMode === "none" ? I : g).push(o);
8443
8459
  for (const o of [...I, ...g])
8444
- o.update({ viewport: A });
8460
+ o.update(A);
8445
8461
  if (getComputedStyle(A.element).visibility === "hidden") return;
8446
8462
  const B = A.getBoxRelativeTo(this.canvas), Q = new GA(
8447
8463
  eA(0, 0),
@@ -8528,7 +8544,7 @@ class Mo extends cQ {
8528
8544
  },
8529
8545
  Q
8530
8546
  );
8531
- B.setPipeline(E.pipeline), _A(
8547
+ B.setPipeline(E.pipeline), eI(
8532
8548
  this.currentModelView_,
8533
8549
  I.viewMatrix,
8534
8550
  A.transform.matrix
@@ -8582,8 +8598,14 @@ class Mo extends cQ {
8582
8598
  }
8583
8599
  clear() {
8584
8600
  }
8601
+ uploadTexture(A) {
8602
+ this.texturePool_.get(A);
8603
+ }
8604
+ disposeTexture(A) {
8605
+ this.texturePool_.dispose(A);
8606
+ }
8585
8607
  setUniformsForObject(A, I, g) {
8586
- _A(
8608
+ eI(
8587
8609
  this.currentModelView_,
8588
8610
  g.viewMatrix,
8589
8611
  A.transform.matrix
@@ -8611,7 +8633,7 @@ class Mo extends cQ {
8611
8633
  );
8612
8634
  }
8613
8635
  updateProjection(A) {
8614
- _A(
8636
+ eI(
8615
8637
  this.currentProjection_,
8616
8638
  Jo,
8617
8639
  A
@@ -8773,71 +8795,61 @@ class bo {
8773
8795
  return [...g, ...B];
8774
8796
  }
8775
8797
  updateChunksForImage(A, I) {
8776
- const g = I.camera;
8777
- if (g.type !== "OrthographicCamera")
8778
- throw new Error(
8779
- "ChunkStoreView currently supports only orthographic cameras. Update the implementation before using a perspective camera."
8780
- );
8781
- const Q = g.getWorldViewRect(), E = Math.abs(Q.max[0] - Q.min[0]), i = I.element, o = I.getBoxRelativeTo(i).toRect().width, s = E / o, t = Math.log2(1 / s);
8782
- this.setLOD(t);
8783
- const a = this.getZBounds(A);
8784
- if (!(this.policyChanged_ || this.viewBounds2DChanged(Q) || this.zBoundsChanged(a) || this.lastTCoord_ !== A.t || this.cCoordsChanged(A.c))) return;
8785
- const D = this.timeIndex(A);
8786
- if (!this.store_.hasChunksAtTime(D)) {
8798
+ const g = I.worldViewRect, Q = Math.abs(g.max[0] - g.min[0]) / I.bufferWidthPx, E = Math.log2(1 / Q);
8799
+ this.setLOD(E);
8800
+ const i = this.getZBounds(A);
8801
+ if (!(this.policyChanged_ || this.viewBounds2DChanged(g) || this.zBoundsChanged(i) || this.lastTCoord_ !== A.t || this.cCoordsChanged(A.c))) return;
8802
+ const s = this.timeIndex(A);
8803
+ if (!this.store_.hasChunksAtTime(s)) {
8787
8804
  H.warn(
8788
8805
  "ChunkStoreView",
8789
8806
  "updateChunkViewStates called with no chunks initialized"
8790
8807
  ), this.chunkViewStates_.clear();
8791
8808
  return;
8792
8809
  }
8793
- const F = NQ();
8794
- oi(F, Q.min, Q.max, 0.5);
8795
- const [U, S] = this.getZBounds(A), d = new gI(
8796
- P(Q.min[0], Q.min[1], U),
8797
- P(Q.max[0], Q.max[1], S)
8810
+ const t = NQ();
8811
+ oi(t, g.min, g.max, 0.5);
8812
+ const [a, n] = this.getZBounds(A), D = new II(
8813
+ P(g.min[0], g.min[1], a),
8814
+ P(g.max[0], g.max[1], n)
8798
8815
  );
8799
8816
  this.chunkViewStates_.forEach(Wg);
8800
- const K = this.channelsOfInterest(A), k = this.fallbackLOD(), R = this.getPaddedBounds(d), L = this.currentLOD_ === k ? [this.currentLOD_] : [this.currentLOD_, k];
8801
- for (const M of L) {
8802
- const W = M === this.currentLOD_, IA = M === k;
8817
+ const F = this.channelsOfInterest(A), U = this.fallbackLOD(), S = this.getPaddedBounds(D), l = this.currentLOD_ === U ? [this.currentLOD_] : [this.currentLOD_, U];
8818
+ for (const u of l) {
8819
+ const k = u === this.currentLOD_, R = u === U;
8803
8820
  this.iterateChunksInBox(
8804
- D,
8805
- M,
8806
- K,
8807
- R,
8808
- (CA, $) => {
8809
- const gA = gI.intersects($, d), SA = W && !gA, NA = this.computePriority(
8810
- IA,
8821
+ s,
8822
+ u,
8823
+ F,
8824
+ S,
8825
+ (L, M) => {
8826
+ const W = II.intersects(M, D), $ = k && !W, BA = this.computePriority(
8827
+ R,
8828
+ k,
8811
8829
  W,
8812
- gA,
8813
- SA,
8830
+ $,
8814
8831
  !0
8815
8832
  );
8816
- NA !== null && this.chunkViewStates_.set(CA, {
8817
- visible: gA,
8818
- prefetch: SA,
8819
- priority: NA,
8820
- orderKey: this.squareDistance2D(CA, F)
8833
+ BA !== null && this.chunkViewStates_.set(L, {
8834
+ visible: W,
8835
+ prefetch: $,
8836
+ priority: BA,
8837
+ orderKey: this.squareDistance2D(L, t)
8821
8838
  });
8822
8839
  }
8823
8840
  );
8824
8841
  }
8825
8842
  this.markTimeChunksForPrefetchImage(
8826
- D,
8843
+ s,
8827
8844
  A,
8828
- d,
8829
- F
8830
- ), this.policyChanged_ = !1, this.lastViewBounds2D_ = Q.clone(), this.lastZBounds_ = a, this.lastTCoord_ = A.t, this.lastCCoords_ = A.c ? [...A.c] : void 0;
8845
+ D,
8846
+ t
8847
+ ), this.policyChanged_ = !1, this.lastViewBounds2D_ = g.clone(), this.lastZBounds_ = i, this.lastTCoord_ = A.t, this.lastCCoords_ = A.c ? [...A.c] : void 0;
8831
8848
  }
8832
8849
  updateChunksForVolume(A, I) {
8833
- const g = _A(
8834
- FA(),
8835
- I.camera.projectionMatrix,
8836
- I.camera.viewMatrix
8837
- );
8838
- if (!(this.policyChanged_ || this.hasViewProjectionChanged(g) || this.lastTCoord_ !== A.t || this.cCoordsChanged(A.c))) return;
8839
- const Q = this.timeIndex(A);
8840
- if (!this.store_.hasChunksAtTime(Q)) {
8850
+ if (!(this.policyChanged_ || this.hasViewProjectionChanged(I) || this.lastTCoord_ !== A.t || this.cCoordsChanged(A.c))) return;
8851
+ const B = this.timeIndex(A);
8852
+ if (!this.store_.hasChunksAtTime(B)) {
8841
8853
  H.warn(
8842
8854
  "ChunkStoreView",
8843
8855
  "updateChunksForVolume called with no chunks initialized"
@@ -8845,32 +8857,32 @@ class bo {
8845
8857
  return;
8846
8858
  }
8847
8859
  this.currentLOD_ = this.policy_.lod.min, this.chunkViewStates_.forEach(Wg);
8848
- const E = this.channelsOfInterest(A), i = this.fallbackLOD(), o = (s) => {
8849
- const t = s.lod === i, a = s.lod === this.currentLOD_, n = this.computePriority(
8860
+ const Q = this.channelsOfInterest(A), E = this.fallbackLOD(), i = (o) => {
8861
+ const s = o.lod === E, t = o.lod === this.currentLOD_, a = this.computePriority(
8862
+ s,
8850
8863
  t,
8851
- a,
8852
8864
  !0,
8853
8865
  !1,
8854
8866
  !0
8855
8867
  );
8856
- n !== null && this.chunkViewStates_.set(s, {
8868
+ a !== null && this.chunkViewStates_.set(o, {
8857
8869
  visible: !0,
8858
8870
  prefetch: !1,
8859
- priority: n,
8871
+ priority: a,
8860
8872
  orderKey: 0
8861
8873
  });
8862
8874
  };
8863
8875
  this.iterateAllChunksAtLod(
8864
- Q,
8876
+ B,
8865
8877
  this.currentLOD_,
8866
- E,
8867
- o
8868
- ), this.currentLOD_ !== i && this.iterateAllChunksAtLod(
8869
8878
  Q,
8870
- i,
8879
+ i
8880
+ ), this.currentLOD_ !== E && this.iterateAllChunksAtLod(
8881
+ B,
8871
8882
  E,
8872
- o
8873
- ), this.markTimeChunksForPrefetchVolume(Q, A), this.policyChanged_ = !1, this.lastTCoord_ = A.t, this.lastCCoords_ = A.c ? [...A.c] : void 0, this.lastViewProjection_ = g;
8883
+ Q,
8884
+ i
8885
+ ), this.markTimeChunksForPrefetchVolume(B, A), this.policyChanged_ = !1, this.lastTCoord_ = A.t, this.lastCCoords_ = A.c ? [...A.c] : void 0, this.lastViewProjection_ = I;
8874
8886
  }
8875
8887
  allVisibleFallbackLODLoaded() {
8876
8888
  const A = this.fallbackLOD();
@@ -8965,8 +8977,8 @@ class bo {
8965
8977
  // Half-open chunk-index range [min, max) at a given LOD that covers `bounds`.
8966
8978
  // Returns null if the bounds don't overlap the data grid.
8967
8979
  chunkIndexRange(A, I) {
8968
- const g = this.store_.dimensions, B = g.x.lods[I], Q = g.y.lods[I], E = g.z?.lods[I], i = Math.ceil(B.size / B.chunkSize), o = Math.ceil(Q.size / Q.chunkSize), s = E ? Math.ceil(E.size / E.chunkSize) : 1, t = B.chunkSize * B.scale, a = Q.chunkSize * Q.scale, n = E ? E.chunkSize * E.scale : 1, D = B.translation, F = Q.translation, U = E?.translation ?? 0, S = Math.max(0, Math.floor((A.min[0] - D) / t)), d = Math.min(i, Math.ceil((A.max[0] - D) / t)), K = Math.max(0, Math.floor((A.min[1] - F) / a)), k = Math.min(o, Math.ceil((A.max[1] - F) / a)), R = E ? Math.max(0, Math.floor((A.min[2] - U) / n)) : 0, L = E ? Math.min(s, Math.ceil((A.max[2] - U) / n)) : 1;
8969
- return S >= d || K >= k || R >= L ? null : { xMin: S, xMax: d, yMin: K, yMax: k, zMin: R, zMax: L };
8980
+ const g = this.store_.dimensions, B = g.x.lods[I], Q = g.y.lods[I], E = g.z?.lods[I], i = Math.ceil(B.size / B.chunkSize), o = Math.ceil(Q.size / Q.chunkSize), s = E ? Math.ceil(E.size / E.chunkSize) : 1, t = B.chunkSize * B.scale, a = Q.chunkSize * Q.scale, n = E ? E.chunkSize * E.scale : 1, D = B.translation, F = Q.translation, U = E?.translation ?? 0, S = Math.max(0, Math.floor((A.min[0] - D) / t)), l = Math.min(i, Math.ceil((A.max[0] - D) / t)), u = Math.max(0, Math.floor((A.min[1] - F) / a)), k = Math.min(o, Math.ceil((A.max[1] - F) / a)), R = E ? Math.max(0, Math.floor((A.min[2] - U) / n)) : 0, L = E ? Math.min(s, Math.ceil((A.max[2] - U) / n)) : 1;
8981
+ return S >= l || u >= k || R >= L ? null : { xMin: S, xMax: l, yMin: u, yMax: k, zMin: R, zMax: L };
8970
8982
  }
8971
8983
  iterateChunksInBox(A, I, g, B, Q) {
8972
8984
  const E = this.chunkIndexRange(B, I);
@@ -8997,7 +9009,7 @@ class bo {
8997
9009
  }
8998
9010
  }
8999
9011
  getChunkAabb(A) {
9000
- return new gI(
9012
+ return new II(
9001
9013
  P(A.offset.x, A.offset.y, A.offset.z),
9002
9014
  P(
9003
9015
  A.offset.x + A.shape.x * A.scale.x,
@@ -9047,7 +9059,7 @@ class bo {
9047
9059
  getPaddedBounds(A) {
9048
9060
  const I = this.store_.dimensions, g = I.x.lods[this.currentLOD_], B = I.y.lods[this.currentLOD_], Q = I.z?.lods[this.currentLOD_], E = g.chunkSize * g.scale * this.policy_.prefetch.x, i = B.chunkSize * B.scale * this.policy_.prefetch.y;
9049
9061
  let o = 0;
9050
- return Q && (o = Q.chunkSize * Q.scale * this.policy_.prefetch.z), new gI(
9062
+ return Q && (o = Q.chunkSize * Q.scale * this.policy_.prefetch.z), new II(
9051
9063
  P(
9052
9064
  A.min[0] - E,
9053
9065
  A.min[1] - i,
@@ -9074,33 +9086,32 @@ function Wg(C) {
9074
9086
  class To {
9075
9087
  // Chunks indexed as chunks_[lod][t][c][z][y][x].
9076
9088
  chunks_;
9077
- loader_;
9078
9089
  lowestResLOD_;
9079
9090
  dimensions_;
9080
9091
  views_ = [];
9081
9092
  hasHadViews_ = !1;
9082
9093
  constructor(A) {
9083
- this.loader_ = A, this.dimensions_ = this.loader_.getSourceDimensionMap(), this.lowestResLOD_ = this.dimensions_.numLods - 1, this.validateXYScaleRatios();
9094
+ this.dimensions_ = A, this.lowestResLOD_ = this.dimensions_.numLods - 1, this.validateXYScaleRatios();
9084
9095
  const { size: I } = this.getAndValidateTimeDimension(), { size: g } = this.getAndValidateChannelDimension(), B = this.dimensions_.numLods;
9085
9096
  this.chunks_ = new Array(B);
9086
9097
  for (let Q = 0; Q < B; ++Q) {
9087
9098
  const E = this.dimensions_.x.lods[Q], i = this.dimensions_.y.lods[Q], o = this.dimensions_.z?.lods[Q], s = E.chunkSize, t = i.chunkSize, a = o?.chunkSize ?? 1, n = Math.ceil(E.size / s), D = Math.ceil(i.size / t), F = o ? Math.ceil(o.size / a) : 1, U = new Array(I);
9088
9099
  this.chunks_[Q] = U;
9089
9100
  for (let S = 0; S < I; ++S) {
9090
- const d = new Array(g);
9091
- U[S] = d;
9092
- for (let K = 0; K < g; ++K) {
9101
+ const l = new Array(g);
9102
+ U[S] = l;
9103
+ for (let u = 0; u < g; ++u) {
9093
9104
  const k = new Array(F);
9094
- d[K] = k;
9105
+ l[u] = k;
9095
9106
  for (let R = 0; R < F; ++R) {
9096
9107
  const L = o !== void 0 ? o.translation + R * a * o.scale : 0, M = new Array(D);
9097
9108
  k[R] = M;
9098
9109
  for (let W = 0; W < D; ++W) {
9099
- const IA = i.translation + W * t * i.scale, CA = new Array(n);
9100
- M[W] = CA;
9101
- for (let $ = 0; $ < n; ++$) {
9102
- const gA = E.translation + $ * s * E.scale;
9103
- CA[$] = {
9110
+ const $ = i.translation + W * t * i.scale, BA = new Array(n);
9111
+ M[W] = BA;
9112
+ for (let IA = 0; IA < n; ++IA) {
9113
+ const iA = E.translation + IA * s * E.scale;
9114
+ BA[IA] = {
9104
9115
  state: "unloaded",
9105
9116
  lod: Q,
9106
9117
  visible: !1,
@@ -9108,21 +9119,21 @@ class To {
9108
9119
  priority: null,
9109
9120
  orderKey: null,
9110
9121
  shape: {
9111
- x: Math.min(s, E.size - $ * s),
9122
+ x: Math.min(s, E.size - IA * s),
9112
9123
  y: Math.min(t, i.size - W * t),
9113
9124
  z: Math.min(a, (o?.size ?? 1) - R * a),
9114
9125
  c: 1
9115
9126
  },
9116
9127
  rowAlignmentBytes: 1,
9117
- chunkIndex: { x: $, y: W, z: R, c: K, t: S },
9128
+ chunkIndex: { x: IA, y: W, z: R, c: u, t: S },
9118
9129
  scale: {
9119
9130
  x: E.scale,
9120
9131
  y: i.scale,
9121
9132
  z: o?.scale ?? 1
9122
9133
  },
9123
9134
  offset: {
9124
- x: gA,
9125
- y: IA,
9135
+ x: iA,
9136
+ y: $,
9126
9137
  z: L
9127
9138
  }
9128
9139
  };
@@ -9151,9 +9162,6 @@ class To {
9151
9162
  getLowestResLOD() {
9152
9163
  return this.lowestResLOD_;
9153
9164
  }
9154
- loadChunkData(A, I) {
9155
- return this.loader_.loadChunkData(A, I);
9156
- }
9157
9165
  addView(A) {
9158
9166
  const I = new bo(this, A);
9159
9167
  return this.views_.push(I), this.hasHadViews_ = !0, I;
@@ -9249,7 +9257,7 @@ class To {
9249
9257
  }
9250
9258
  }
9251
9259
  class Wo {
9252
- stores_ = /* @__PURE__ */ new Map();
9260
+ stores_ = [];
9253
9261
  queue_ = new Ko();
9254
9262
  get queueStats() {
9255
9263
  return {
@@ -9261,21 +9269,21 @@ class Wo {
9261
9269
  return po();
9262
9270
  }
9263
9271
  addView(A, I) {
9264
- let g = this.stores_.get(A);
9265
- return g || (g = new To(A.getLoader()), this.stores_.set(A, g)), g.addView(I);
9272
+ let g = this.stores_.find((B) => B.source === A)?.store;
9273
+ return g || (g = new To(A.loader.getSourceDimensionMap()), this.stores_.push({ source: A, store: g })), g.addView(I);
9266
9274
  }
9267
9275
  update() {
9268
- for (const [A, I] of this.stores_) {
9276
+ for (const { source: A, store: I } of this.stores_) {
9269
9277
  const g = I.updateAndCollectChunkChanges();
9270
9278
  for (const B of g)
9271
9279
  B.priority === null ? this.queue_.cancel(B) : B.state === "queued" && this.queue_.enqueue(
9272
9280
  B,
9273
- (Q) => I.loadChunkData(B, Q)
9281
+ (Q) => A.loader.loadChunkData(B, Q)
9274
9282
  );
9275
9283
  }
9276
9284
  this.queue_.flush();
9277
- for (const [A, I] of this.stores_)
9278
- I.canDispose() && this.stores_.delete(A);
9285
+ for (let A = this.stores_.length - 1; A >= 0; A--)
9286
+ this.stores_[A].store.canDispose() && this.stores_.splice(A, 1);
9279
9287
  }
9280
9288
  }
9281
9289
  var KI = function(C = 1) {
@@ -9322,11 +9330,11 @@ var KI = function(C = 1) {
9322
9330
  KI.Panel = function(C, A, I, g) {
9323
9331
  var B = 1 / 0, Q = 0, E = Math.round, i = E(window.devicePixelRatio || 1), o = E(80 * i * g), s = E(48 * i * g), t = E(3 * i * g), a = E(2 * i * g), n = E(3 * i * g), D = E(15 * i * g), F = E(74 * i * g), U = E(30 * i * g), S = document.createElement("canvas");
9324
9332
  S.width = o, S.height = s, S.style.cssText = `width:${E(g * 80)}px;height:${E(g * 48)}px`;
9325
- var d = S.getContext("2d");
9326
- return d.font = "bold " + E(9 * i * g) + "px Helvetica,Arial,sans-serif", d.textBaseline = "top", d.fillStyle = I, d.fillRect(0, 0, o, s), d.fillStyle = A, d.fillText(C, t, a), d.fillRect(n, D, F, U), d.fillStyle = I, d.globalAlpha = 0.9, d.fillRect(n, D, F, U), {
9333
+ var l = S.getContext("2d");
9334
+ return l.font = "bold " + E(9 * i * g) + "px Helvetica,Arial,sans-serif", l.textBaseline = "top", l.fillStyle = I, l.fillRect(0, 0, o, s), l.fillStyle = A, l.fillText(C, t, a), l.fillRect(n, D, F, U), l.fillStyle = I, l.globalAlpha = 0.9, l.fillRect(n, D, F, U), {
9327
9335
  dom: S,
9328
- update: function(K, k) {
9329
- B = Math.min(B, K), Q = Math.max(Q, K), d.fillStyle = I, d.globalAlpha = 1, d.fillRect(0, 0, o, D), d.fillStyle = A, d.fillText(E(K) + " " + C + " (" + E(B) + "-" + E(Q) + ")", t, a), d.drawImage(S, n + i, D, F - i, U, n, D, F - i, U), d.fillRect(n + F - i, D, i, U), d.fillStyle = I, d.globalAlpha = 0.9, d.fillRect(n + F - i, D, i, E((1 - K / k) * U));
9336
+ update: function(u, k) {
9337
+ B = Math.min(B, u), Q = Math.max(Q, u), l.fillStyle = I, l.globalAlpha = 1, l.fillRect(0, 0, o, D), l.fillStyle = A, l.fillText(E(u) + " " + C + " (" + E(B) + "-" + E(Q) + ")", t, a), l.drawImage(S, n + i, D, F - i, U, n, D, F - i, U), l.fillRect(n + F - i, D, i, U), l.fillStyle = I, l.globalAlpha = 0.9, l.fillRect(n + F - i, D, i, E((1 - u / k) * U));
9330
9338
  }
9331
9339
  };
9332
9340
  };
@@ -9462,6 +9470,9 @@ class Oo {
9462
9470
  eA(t + n, a + D)
9463
9471
  );
9464
9472
  }
9473
+ getBufferRect() {
9474
+ return this.getBoxRelativeTo(this.element).toRect();
9475
+ }
9465
9476
  clientToClip(A, I = 0) {
9466
9477
  const [g, B] = A, Q = this.element.getBoundingClientRect();
9467
9478
  return P(
@@ -9873,7 +9884,7 @@ class qB extends vI {
9873
9884
  super(`Unsupported: ${A}`), this.feature = A;
9874
9885
  }
9875
9886
  }
9876
- function oI(C) {
9887
+ function iI(C) {
9877
9888
  return () => {
9878
9889
  throw new qB(`${C} encode`);
9879
9890
  };
@@ -9887,7 +9898,7 @@ class ag {
9887
9898
  static fromConfig(A, I) {
9888
9899
  return new ag(A, I);
9889
9900
  }
9890
- encode = oI("bitround");
9901
+ encode = iI("bitround");
9891
9902
  /**
9892
9903
  * Decode a chunk of data (no-op).
9893
9904
  * @param arr - The chunk to decode
@@ -10089,9 +10100,9 @@ function UI(C) {
10089
10100
  throw new nA(`Unknown or unsupported dataType: ${C}`);
10090
10101
  return I;
10091
10102
  }
10092
- function QI(C, A) {
10103
+ function CI(C, A) {
10093
10104
  const I = C.length;
10094
- typeof A == "string" && (A = A === "C" ? Array.from({ length: I }, (Q, E) => E) : Array.from({ length: I }, (Q, E) => I - 1 - E)), RA(I === A.length, "Order length must match the number of dimensions.");
10105
+ typeof A == "string" && (A = A === "C" ? Array.from({ length: I }, (Q, E) => E) : Array.from({ length: I }, (Q, E) => I - 1 - E)), FA(I === A.length, "Order length must match the number of dimensions.");
10095
10106
  let g = 1, B = new Array(I);
10096
10107
  for (let Q = A.length - 1; Q >= 0; Q--)
10097
10108
  B[A[Q]] = g, g *= C[A[Q]];
@@ -10242,7 +10253,7 @@ function $Q(C, ...A) {
10242
10253
  if (!A.some((I) => C instanceof I))
10243
10254
  throw C;
10244
10255
  }
10245
- function RA(C, A = "") {
10256
+ function FA(C, A = "") {
10246
10257
  if (!C)
10247
10258
  throw new Error(A);
10248
10259
  }
@@ -10254,7 +10265,7 @@ async function AE(C, { format: A, signal: I }) {
10254
10265
  let B = new Uint8Array(C.buffer, C.byteOffset, C.byteLength);
10255
10266
  g = new Response(B.slice().buffer);
10256
10267
  }
10257
- RA(g.body, "Response does not contain body.");
10268
+ FA(g.body, "Response does not contain body.");
10258
10269
  try {
10259
10270
  return await new Response(g.body.pipeThrough(new DecompressionStream(A), { signal: I })).arrayBuffer();
10260
10271
  } catch {
@@ -10277,7 +10288,7 @@ class lg {
10277
10288
  #B;
10278
10289
  #C;
10279
10290
  constructor(A, I) {
10280
- this.#C = A?.endian, this.#I = UI(I.dataType), this.#B = I.shape, this.#A = QI(I.shape, "C");
10291
+ this.#C = A?.endian, this.#I = UI(I.dataType), this.#B = I.shape, this.#A = CI(I.shape, "C");
10281
10292
  const g = new this.#I(0);
10282
10293
  this.#g = g.BYTES_PER_ELEMENT;
10283
10294
  }
@@ -10454,7 +10465,7 @@ class xB {
10454
10465
  const Q = A.rounding ?? "nearest-even", E = A.scalar_map?.decode ? pC(A.scalar_map.decode, B, g) : [], i = A.scalar_map?.encode ? pC(A.scalar_map.encode, g, B) : [];
10455
10466
  return new xB(g, B, Q, A.out_of_range, E, i);
10456
10467
  }
10457
- encode = oI("cast_value");
10468
+ encode = iI("cast_value");
10458
10469
  decode(A) {
10459
10470
  const I = A.data, g = new this.#I(I.length);
10460
10471
  for (let B = 0; B < I.length; B++)
@@ -10509,7 +10520,7 @@ class bB {
10509
10520
  static fromConfig() {
10510
10521
  return new bB();
10511
10522
  }
10512
- encode = oI("crc32c");
10523
+ encode = iI("crc32c");
10513
10524
  decode(A) {
10514
10525
  return new Uint8Array(A.buffer, A.byteOffset, A.byteLength - 4);
10515
10526
  }
@@ -10576,14 +10587,14 @@ class WB {
10576
10587
  static fromConfig(A) {
10577
10588
  return new WB();
10578
10589
  }
10579
- encode = oI("gzip");
10590
+ encode = iI("gzip");
10580
10591
  async decode(A) {
10581
10592
  const I = await AE(A, { format: "gzip" });
10582
10593
  return new Uint8Array(I);
10583
10594
  }
10584
10595
  }
10585
10596
  function ns(C, A) {
10586
- return RA(!Number.isNaN(A), "JsonCodec allow_nan is false but NaN was encountered during encoding."), RA(A !== Number.POSITIVE_INFINITY, "JsonCodec allow_nan is false but Infinity was encountered during encoding."), RA(A !== Number.NEGATIVE_INFINITY, "JsonCodec allow_nan is false but -Infinity was encountered during encoding."), A;
10597
+ return FA(!Number.isNaN(A), "JsonCodec allow_nan is false but NaN was encountered during encoding."), FA(A !== Number.POSITIVE_INFINITY, "JsonCodec allow_nan is false but Infinity was encountered during encoding."), FA(A !== Number.NEGATIVE_INFINITY, "JsonCodec allow_nan is false but -Infinity was encountered during encoding."), A;
10587
10598
  }
10588
10599
  function rs(C, A) {
10589
10600
  return A instanceof Object && !Array.isArray(A) ? Object.keys(A).sort().reduce((I, g) => (I[g] = A[g], I), {}) : A;
@@ -10613,9 +10624,9 @@ class rg {
10613
10624
  }
10614
10625
  encode(A) {
10615
10626
  const { indent: I, encoding: g, ensure_ascii: B, check_circular: Q, allow_nan: E, sort_keys: i } = this.#A;
10616
- RA(g === "utf-8", "JsonCodec does not yet support non-utf-8 encoding.");
10627
+ FA(g === "utf-8", "JsonCodec does not yet support non-utf-8 encoding.");
10617
10628
  const o = [];
10618
- RA(Q, "JsonCodec does not yet support skipping the check for circular references during encoding."), E || o.push(ns), i && o.push(rs);
10629
+ FA(Q, "JsonCodec does not yet support skipping the check for circular references during encoding."), E || o.push(ns), i && o.push(rs);
10619
10630
  const s = Array.from(A.data);
10620
10631
  s.push("|O"), s.push(A.shape);
10621
10632
  let t;
@@ -10633,10 +10644,10 @@ class rg {
10633
10644
  }
10634
10645
  decode(A) {
10635
10646
  const { strict: I } = this.#I;
10636
- RA(I, "JsonCodec does not yet support non-strict decoding.");
10647
+ FA(I, "JsonCodec does not yet support non-strict decoding.");
10637
10648
  const g = PI(A), B = g.pop();
10638
- g.pop(), RA(B, "0D not implemented for JsonCodec.");
10639
- const Q = QI(B, "C");
10649
+ g.pop(), FA(B, "0D not implemented for JsonCodec.");
10650
+ const Q = CI(B, "C");
10640
10651
  return { data: g, shape: B, stride: Q };
10641
10652
  }
10642
10653
  }
@@ -10666,7 +10677,7 @@ class vB {
10666
10677
  throw new nA(`scale_offset codec does not support data type: ${I.dataType}`);
10667
10678
  return new vB(ng(I.dataType, A.scale ?? 1), ng(I.dataType, A.offset ?? 0), UI(I.dataType));
10668
10679
  }
10669
- encode = oI("scale_offset");
10680
+ encode = iI("scale_offset");
10670
10681
  decode(A) {
10671
10682
  const I = A.data, g = new this.#A(I.length);
10672
10683
  for (let B = 0; B < I.length; B++)
@@ -10680,7 +10691,7 @@ class ZB {
10680
10691
  constructor(A, I) {
10681
10692
  if (I) {
10682
10693
  let g = new (UI(I.dataType))(0);
10683
- RA("BYTES_PER_ELEMENT" in g, `Shuffle codec requires a fixed-size dtype, got "${I.dataType}"`), this.#A = g.BYTES_PER_ELEMENT;
10694
+ FA("BYTES_PER_ELEMENT" in g, `Shuffle codec requires a fixed-size dtype, got "${I.dataType}"`), this.#A = g.BYTES_PER_ELEMENT;
10684
10695
  } else
10685
10696
  this.#A = A.elementsize ?? 4;
10686
10697
  }
@@ -10727,7 +10738,7 @@ function cs(C, A) {
10727
10738
  ) : I = new C.constructor(C.data.length), {
10728
10739
  data: I,
10729
10740
  shape: C.shape,
10730
- stride: QI(C.shape, A)
10741
+ stride: CI(C.shape, A)
10731
10742
  };
10732
10743
  }
10733
10744
  function ws(C, A) {
@@ -10748,11 +10759,11 @@ function ws(C, A) {
10748
10759
  }
10749
10760
  function Gs(C) {
10750
10761
  let A = C.shape.length;
10751
- return RA(A === C.stride.length, "Shape and stride must have the same length."), C.stride.map((I, g) => ({ stride: I, index: g })).sort((I, g) => g.stride - I.stride).map((I) => I.index);
10762
+ return FA(A === C.stride.length, "Shape and stride must have the same length."), C.stride.map((I, g) => ({ stride: I, index: g })).sort((I, g) => g.stride - I.stride).map((I) => I.index);
10752
10763
  }
10753
10764
  function Fs(C, A) {
10754
10765
  let I = Gs(C);
10755
- return RA(I.length === A.length, "Orders must match"), I.every((g, B) => g === A[B]);
10766
+ return FA(I.length === A.length, "Orders must match"), I.every((g, B) => g === A[B]);
10756
10767
  }
10757
10768
  class PB {
10758
10769
  kind = "array_to_array";
@@ -10768,7 +10779,7 @@ class PB {
10768
10779
  Q[i] = B - i - 1, E[i] = B - i - 1;
10769
10780
  else
10770
10781
  Q = g, Q.forEach((i, o) => {
10771
- RA(E[i] === void 0, `Invalid permutation: ${JSON.stringify(g)}`), E[i] = o;
10782
+ FA(E[i] === void 0, `Invalid permutation: ${JSON.stringify(g)}`), E[i] = o;
10772
10783
  });
10773
10784
  this.#A = Q, this.#I = E;
10774
10785
  }
@@ -10782,7 +10793,7 @@ class PB {
10782
10793
  return {
10783
10794
  data: A.data,
10784
10795
  shape: A.shape,
10785
- stride: QI(A.shape, this.#A)
10796
+ stride: CI(A.shape, this.#A)
10786
10797
  };
10787
10798
  }
10788
10799
  }
@@ -10791,12 +10802,12 @@ class Dg {
10791
10802
  #A;
10792
10803
  #I;
10793
10804
  constructor(A) {
10794
- this.#A = A, this.#I = QI(A, "C");
10805
+ this.#A = A, this.#I = CI(A, "C");
10795
10806
  }
10796
10807
  static fromConfig(A, I) {
10797
10808
  return new Dg(I.shape);
10798
10809
  }
10799
- encode = oI("vlen-utf8");
10810
+ encode = iI("vlen-utf8");
10800
10811
  decode(A) {
10801
10812
  let I = new TextDecoder(), g = new DataView(A.buffer), B = Array(g.getUint32(0, !0)), Q = 4;
10802
10813
  for (let E = 0; E < B.length; E++) {
@@ -10811,7 +10822,7 @@ class VB {
10811
10822
  static fromConfig(A) {
10812
10823
  return new VB();
10813
10824
  }
10814
- encode = oI("zlib");
10825
+ encode = iI("zlib");
10815
10826
  async decode(A) {
10816
10827
  const I = await AE(A, { format: "deflate" });
10817
10828
  return new Uint8Array(I);
@@ -10937,15 +10948,15 @@ function Us(C, A, I, g) {
10937
10948
  let D = await o[n];
10938
10949
  if (D === null)
10939
10950
  return;
10940
- let { data: F, shape: U, stride: S } = D, d = s.map((R, L) => R % U[L]).reduce((R, L, M) => R + L * S[M], 0), K = F[d], k = F[d + 1];
10941
- if (!(K === vC && k === vC))
10951
+ let { data: F, shape: U, stride: S } = D, l = s.map((R, L) => R % U[L]).reduce((R, L, M) => R + L * S[M], 0), u = F[l], k = F[l + 1];
10952
+ if (!(u === vC && k === vC))
10942
10953
  return B(n, {
10943
- offset: Number(K),
10954
+ offset: Number(u),
10944
10955
  length: Number(k)
10945
10956
  }, t);
10946
10957
  };
10947
10958
  }
10948
- class lA {
10959
+ class UA {
10949
10960
  store;
10950
10961
  path;
10951
10962
  constructor(A, I = "/") {
@@ -10953,10 +10964,10 @@ class lA {
10953
10964
  }
10954
10965
  resolve(A) {
10955
10966
  let I = new URL(`file://${this.path.endsWith("/") ? this.path : `${this.path}/`}`);
10956
- return new lA(this.store, decodeURIComponent(new URL(A, I).pathname));
10967
+ return new UA(this.store, decodeURIComponent(new URL(A, I).pathname));
10957
10968
  }
10958
10969
  }
10959
- class OB extends lA {
10970
+ class OB extends UA {
10960
10971
  kind = "group";
10961
10972
  #A;
10962
10973
  constructor(A, I, g) {
@@ -10989,7 +11000,7 @@ function ds(C, A) {
10989
11000
  fillValue: A.fill_value
10990
11001
  }),
10991
11002
  getStrides(E) {
10992
- return QI(E, Q);
11003
+ return CI(E, Q);
10993
11004
  },
10994
11005
  getChunkBytes: Us(C, A.chunk_grid.configuration.chunk_shape, g.encodeChunkKey, I)
10995
11006
  };
@@ -11006,7 +11017,7 @@ function ds(C, A) {
11006
11017
  fillValue: A.fill_value
11007
11018
  }),
11008
11019
  getStrides(Q) {
11009
- return QI(Q, B);
11020
+ return CI(Q, B);
11010
11021
  },
11011
11022
  async getChunkBytes(Q, E) {
11012
11023
  let i = g.encodeChunkKey(Q), o = C.resolve(i).path;
@@ -11014,7 +11025,7 @@ function ds(C, A) {
11014
11025
  }
11015
11026
  };
11016
11027
  }
11017
- let hg = class extends lA {
11028
+ let hg = class extends UA {
11018
11029
  kind = "array";
11019
11030
  #A;
11020
11031
  [jI];
@@ -11123,7 +11134,7 @@ async function Ys(C, A) {
11123
11134
  return I ? PI(I) : {};
11124
11135
  }
11125
11136
  async function Ms(C, A = {}) {
11126
- let I = "store" in C ? C : new lA(C), { signal: g } = A, B = {};
11137
+ let I = "store" in C ? C : new UA(C), { signal: g } = A, B = {};
11127
11138
  return (A.attrs ?? !0) && (B = await Ys(I, g)), g?.throwIfAborted(), A.kind === "array" ? PC(I, B, g) : A.kind === "group" ? VC(I, B, g) : PC(I, B, g).catch((Q) => ($Q(Q, kI, nA), VC(I, B, g)));
11128
11139
  }
11129
11140
  async function PC(C, A, I) {
@@ -11146,7 +11157,7 @@ async function fs(C, A) {
11146
11157
  return Q.node_type === "array" && (Q.fill_value = zQ(Q)), Q.node_type === "array" ? gE(new hg(I, C.path, Q)) : new OB(I, C.path, Q);
11147
11158
  }
11148
11159
  async function us(C, A = {}) {
11149
- let I = "store" in C ? C : new lA(C), g = await fs(I, A.signal);
11160
+ let I = "store" in C ? C : new UA(C), g = await fs(I, A.signal);
11150
11161
  if (Lg.increment(I.store, "v3"), A.kind === void 0 || A.kind === "array" && g instanceof hg || A.kind === "group" && g instanceof OB)
11151
11162
  return g;
11152
11163
  let B = g instanceof hg ? "array" : "group";
@@ -11155,12 +11166,12 @@ async function us(C, A = {}) {
11155
11166
  found: B
11156
11167
  });
11157
11168
  }
11158
- async function UA(C, A = {}) {
11159
- let I = "store" in C ? C.store : C, g = Lg.versionMax(I), B = g === "v2" ? UA.v2 : UA.v3, Q = g === "v2" ? UA.v3 : UA.v2;
11169
+ async function RA(C, A = {}) {
11170
+ let I = "store" in C ? C.store : C, g = Lg.versionMax(I), B = g === "v2" ? RA.v2 : RA.v3, Q = g === "v2" ? RA.v3 : RA.v2;
11160
11171
  return B(C, A).catch((E) => ($Q(E, kI, nA), Q(C, A)));
11161
11172
  }
11162
- UA.v2 = Ms;
11163
- UA.v3 = us;
11173
+ RA.v2 = Ms;
11174
+ RA.v3 = us;
11164
11175
  async function Ks(C, A) {
11165
11176
  const I = A.split("/"), g = I.pop();
11166
11177
  if (!g)
@@ -11191,18 +11202,18 @@ class _B {
11191
11202
  async function VI(C, A) {
11192
11203
  if (A === "v2")
11193
11204
  try {
11194
- return UA.v2(C, { kind: "group", attrs: !0 });
11205
+ return RA.v2(C, { kind: "group", attrs: !0 });
11195
11206
  } catch {
11196
11207
  throw new Error(`Failed to open Zarr v2 group at ${C}`);
11197
11208
  }
11198
11209
  if (A === "v3")
11199
11210
  try {
11200
- return UA.v3(C, { kind: "group" });
11211
+ return RA.v3(C, { kind: "group" });
11201
11212
  } catch {
11202
11213
  throw new Error(`Failed to open Zarr v3 group at ${C}`);
11203
11214
  }
11204
11215
  try {
11205
- return UA(C, { kind: "group" });
11216
+ return RA(C, { kind: "group" });
11206
11217
  } catch {
11207
11218
  throw new Error(`Failed to open Zarr group at ${C}`);
11208
11219
  }
@@ -11210,18 +11221,18 @@ async function VI(C, A) {
11210
11221
  async function Hs(C, A) {
11211
11222
  if (A === "v2")
11212
11223
  try {
11213
- return UA.v2(C, { kind: "array", attrs: !1 });
11224
+ return RA.v2(C, { kind: "array", attrs: !1 });
11214
11225
  } catch {
11215
11226
  throw new Error(`Failed to open Zarr v2 array at ${C}`);
11216
11227
  }
11217
11228
  if (A === "v3")
11218
11229
  try {
11219
- return UA.v3(C, { kind: "array" });
11230
+ return RA.v3(C, { kind: "array" });
11220
11231
  } catch {
11221
11232
  throw new Error(`Failed to open Zarr v3 array at ${C}`);
11222
11233
  }
11223
11234
  try {
11224
- return UA(C, { kind: "array" });
11235
+ return RA(C, { kind: "array" });
11225
11236
  } catch {
11226
11237
  throw new Error(`Failed to open Zarr array at ${C}`);
11227
11238
  }
@@ -11231,11 +11242,11 @@ async function qs(C) {
11231
11242
  switch (C.type) {
11232
11243
  case "fetch": {
11233
11244
  const g = new WI(C.url);
11234
- A = new lA(g);
11245
+ A = new UA(g);
11235
11246
  break;
11236
11247
  }
11237
11248
  case "filesystem": {
11238
- A = new lA(
11249
+ A = new UA(
11239
11250
  new _B(C.directoryHandle),
11240
11251
  C.path
11241
11252
  );
@@ -11294,18 +11305,18 @@ function xs(C, A, I, g) {
11294
11305
  const s = g.cChunkSize ? Q.c % g.cChunkSize : 0, t = g.tChunkSize ? Q.t % g.tChunkSize : 0, a = B.x * B.y * B.z, n = E.c !== void 0 ? I[E.c] : 0, D = E.t !== void 0 ? I[E.t] : 0, F = t * D + s * n, U = o.x === B.x && o.y === B.y && o.z === B.z;
11295
11306
  if (F === 0 && C.length === a && U)
11296
11307
  return C;
11297
- const d = new C.constructor(
11308
+ const l = new C.constructor(
11298
11309
  a
11299
- ), K = E.z !== void 0 ? I[E.z] : 0, k = I[E.y];
11310
+ ), u = E.z !== void 0 ? I[E.z] : 0, k = I[E.y];
11300
11311
  let R = 0;
11301
11312
  for (let L = 0; L < B.z; L++) {
11302
- const M = F + L * K;
11313
+ const M = F + L * u;
11303
11314
  for (let W = 0; W < B.y; W++) {
11304
- const IA = M + W * k, CA = IA + B.x;
11305
- d.set(C.subarray(IA, CA), R), R += B.x;
11315
+ const $ = M + W * k, BA = $ + B.x;
11316
+ l.set(C.subarray($, BA), R), R += B.x;
11306
11317
  }
11307
11318
  }
11308
- return d;
11319
+ return l;
11309
11320
  }
11310
11321
  const BE = `function xg(B, A) {
11311
11322
  return {
@@ -14984,17 +14995,17 @@ function bs(C) {
14984
14995
  }
14985
14996
  }
14986
14997
  const Ts = Math.max(1, navigator.hardwareConcurrency - 2);
14987
- let MA = [], Ws = 0, CE = 0;
14988
- const EI = /* @__PURE__ */ new Map(), yg = /* @__PURE__ */ new Set();
14998
+ let JA = [], Ws = 0, CE = 0;
14999
+ const QI = /* @__PURE__ */ new Map(), yg = /* @__PURE__ */ new Set();
14989
15000
  function QE(C) {
14990
- const A = MA.find((I) => I.worker === C);
15001
+ const A = JA.find((I) => I.worker === C);
14991
15002
  return A || H.error(
14992
15003
  "ZarrWorker",
14993
15004
  "Worker not found in pool - this should not happen"
14994
15005
  ), A;
14995
15006
  }
14996
15007
  function vs(C, A) {
14997
- const { id: I, success: g } = C.data, B = EI.get(I);
15008
+ const { id: I, success: g } = C.data, B = QI.get(I);
14998
15009
  if (!B) {
14999
15010
  yg.has(I) ? yg.delete(I) : H.warn(
15000
15011
  "ZarrWorker",
@@ -15003,7 +15014,7 @@ function vs(C, A) {
15003
15014
  );
15004
15015
  return;
15005
15016
  }
15006
- EI.delete(I), B.abortListener && B.abortSignal && B.abortSignal.removeEventListener("abort", B.abortListener);
15017
+ QI.delete(I), B.abortListener && B.abortSignal && B.abortSignal.removeEventListener("abort", B.abortListener);
15007
15018
  const Q = QE(A);
15008
15019
  Q && Q.pendingCount > 0 ? Q.pendingCount-- : Q && H.error(
15009
15020
  "ZarrWorker",
@@ -15025,16 +15036,16 @@ function _C(C, A) {
15025
15036
  );
15026
15037
  const I = QE(A);
15027
15038
  if (I) {
15028
- const B = MA.indexOf(I);
15029
- MA.splice(B, 1);
15039
+ const B = JA.indexOf(I);
15040
+ JA.splice(B, 1);
15030
15041
  }
15031
15042
  const g = I?.workerId;
15032
15043
  if (g !== void 0)
15033
- for (const [B, Q] of EI.entries())
15034
- Q.workerId === g && (Q.reject(new Error(`Worker error: ${C.message}`)), EI.delete(B));
15044
+ for (const [B, Q] of QI.entries())
15045
+ Q.workerId === g && (Q.reject(new Error(`Worker error: ${C.message}`)), QI.delete(B));
15035
15046
  try {
15036
15047
  const B = EE();
15037
- MA.push({
15048
+ JA.push({
15038
15049
  worker: B,
15039
15050
  pendingCount: 0,
15040
15051
  workerId: CE++
@@ -15051,9 +15062,9 @@ function EE() {
15051
15062
  ), C;
15052
15063
  }
15053
15064
  function Zs() {
15054
- if (MA.length === 0)
15065
+ if (JA.length === 0)
15055
15066
  throw new Error("Worker pool is not initialized");
15056
- return MA.sort((C, A) => C.pendingCount - A.pendingCount)[0];
15067
+ return JA.sort((C, A) => C.pendingCount - A.pendingCount)[0];
15057
15068
  }
15058
15069
  async function Ps(C, A, I, g) {
15059
15070
  return new Promise((B, Q) => {
@@ -15062,12 +15073,12 @@ async function Ps(C, A, I, g) {
15062
15073
  reject: Q,
15063
15074
  workerId: E.workerId
15064
15075
  };
15065
- if (EI.set(i, o), g?.signal) {
15076
+ if (QI.set(i, o), g?.signal) {
15066
15077
  const s = () => {
15067
15078
  E.worker.postMessage({
15068
15079
  id: i,
15069
15080
  type: "cancel"
15070
- }), EI.delete(i), yg.add(i), E.pendingCount--, Q(new DOMException("Operation was aborted", "AbortError"));
15081
+ }), QI.delete(i), yg.add(i), E.pendingCount--, Q(new DOMException("Operation was aborted", "AbortError"));
15071
15082
  };
15072
15083
  if (g.signal.aborted) {
15073
15084
  s(), yg.delete(i);
@@ -15085,11 +15096,11 @@ async function Ps(C, A, I, g) {
15085
15096
  });
15086
15097
  }
15087
15098
  function Vs() {
15088
- if (!(MA.length > 0))
15099
+ if (!(JA.length > 0))
15089
15100
  try {
15090
15101
  for (let C = 0; C < Ts; C++) {
15091
15102
  const A = EE();
15092
- MA.push({
15103
+ JA.push({
15093
15104
  worker: A,
15094
15105
  pendingCount: 0,
15095
15106
  workerId: CE++
@@ -15097,7 +15108,7 @@ function Vs() {
15097
15108
  }
15098
15109
  H.debug(
15099
15110
  "ZarrWorker",
15100
- `Initialized worker pool with ${MA.length} workers`
15111
+ `Initialized worker pool with ${JA.length} workers`
15101
15112
  );
15102
15113
  } catch {
15103
15114
  H.warn("ZarrWorker", "Failed to create workers - clearing pool"), _s();
@@ -15131,9 +15142,9 @@ async function Os(C, A, I, g, B) {
15131
15142
  }
15132
15143
  }
15133
15144
  function _s() {
15134
- for (const C of MA)
15145
+ for (const C of JA)
15135
15146
  C.worker.terminate();
15136
- MA = [], EI.clear();
15147
+ JA = [], QI.clear();
15137
15148
  }
15138
15149
  class Xs {
15139
15150
  metadata_;
@@ -15190,12 +15201,12 @@ function js(C, A) {
15190
15201
  const I = C.axes.map((a) => a.name), g = C.axes.length, B = XC(I, "x"), Q = XC(I, "y"), E = (a, n) => {
15191
15202
  const D = [];
15192
15203
  for (let F = 0; F < C.datasets.length; F++) {
15193
- const U = C.datasets[F], S = A[F], d = U.coordinateTransformations[0].scale, K = U.coordinateTransformations.length === 2 ? U.coordinateTransformations[1].translation : new Array(g).fill(0);
15204
+ const U = C.datasets[F], S = A[F], l = U.coordinateTransformations[0].scale, u = U.coordinateTransformations.length === 2 ? U.coordinateTransformations[1].translation : new Array(g).fill(0);
15194
15205
  D.push({
15195
15206
  size: S.shape[n],
15196
15207
  chunkSize: S.chunks[n],
15197
- scale: d[n],
15198
- translation: K[n]
15208
+ scale: l[n],
15209
+ translation: u[n]
15199
15210
  });
15200
15211
  }
15201
15212
  if (C.axes[n].type === "space" && $s(D))
@@ -15326,7 +15337,7 @@ const f = V.arrayToEnum([
15326
15337
  default:
15327
15338
  return f.unknown;
15328
15339
  }
15329
- }, l = V.arrayToEnum([
15340
+ }, d = V.arrayToEnum([
15330
15341
  "invalid_type",
15331
15342
  "invalid_literal",
15332
15343
  "custom",
@@ -15411,52 +15422,52 @@ vA.create = (C) => new vA(C);
15411
15422
  const aB = (C, A) => {
15412
15423
  let I;
15413
15424
  switch (C.code) {
15414
- case l.invalid_type:
15425
+ case d.invalid_type:
15415
15426
  C.received === f.undefined ? I = "Required" : I = `Expected ${C.expected}, received ${C.received}`;
15416
15427
  break;
15417
- case l.invalid_literal:
15428
+ case d.invalid_literal:
15418
15429
  I = `Invalid literal value, expected ${JSON.stringify(C.expected, V.jsonStringifyReplacer)}`;
15419
15430
  break;
15420
- case l.unrecognized_keys:
15431
+ case d.unrecognized_keys:
15421
15432
  I = `Unrecognized key(s) in object: ${V.joinValues(C.keys, ", ")}`;
15422
15433
  break;
15423
- case l.invalid_union:
15434
+ case d.invalid_union:
15424
15435
  I = "Invalid input";
15425
15436
  break;
15426
- case l.invalid_union_discriminator:
15437
+ case d.invalid_union_discriminator:
15427
15438
  I = `Invalid discriminator value. Expected ${V.joinValues(C.options)}`;
15428
15439
  break;
15429
- case l.invalid_enum_value:
15440
+ case d.invalid_enum_value:
15430
15441
  I = `Invalid enum value. Expected ${V.joinValues(C.options)}, received '${C.received}'`;
15431
15442
  break;
15432
- case l.invalid_arguments:
15443
+ case d.invalid_arguments:
15433
15444
  I = "Invalid function arguments";
15434
15445
  break;
15435
- case l.invalid_return_type:
15446
+ case d.invalid_return_type:
15436
15447
  I = "Invalid function return type";
15437
15448
  break;
15438
- case l.invalid_date:
15449
+ case d.invalid_date:
15439
15450
  I = "Invalid date";
15440
15451
  break;
15441
- case l.invalid_string:
15452
+ case d.invalid_string:
15442
15453
  typeof C.validation == "object" ? "includes" in C.validation ? (I = `Invalid input: must include "${C.validation.includes}"`, typeof C.validation.position == "number" && (I = `${I} at one or more positions greater than or equal to ${C.validation.position}`)) : "startsWith" in C.validation ? I = `Invalid input: must start with "${C.validation.startsWith}"` : "endsWith" in C.validation ? I = `Invalid input: must end with "${C.validation.endsWith}"` : V.assertNever(C.validation) : C.validation !== "regex" ? I = `Invalid ${C.validation}` : I = "Invalid";
15443
15454
  break;
15444
- case l.too_small:
15455
+ case d.too_small:
15445
15456
  C.type === "array" ? I = `Array must contain ${C.exact ? "exactly" : C.inclusive ? "at least" : "more than"} ${C.minimum} element(s)` : C.type === "string" ? I = `String must contain ${C.exact ? "exactly" : C.inclusive ? "at least" : "over"} ${C.minimum} character(s)` : C.type === "number" ? I = `Number must be ${C.exact ? "exactly equal to " : C.inclusive ? "greater than or equal to " : "greater than "}${C.minimum}` : C.type === "bigint" ? I = `Number must be ${C.exact ? "exactly equal to " : C.inclusive ? "greater than or equal to " : "greater than "}${C.minimum}` : C.type === "date" ? I = `Date must be ${C.exact ? "exactly equal to " : C.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(C.minimum))}` : I = "Invalid input";
15446
15457
  break;
15447
- case l.too_big:
15458
+ case d.too_big:
15448
15459
  C.type === "array" ? I = `Array must contain ${C.exact ? "exactly" : C.inclusive ? "at most" : "less than"} ${C.maximum} element(s)` : C.type === "string" ? I = `String must contain ${C.exact ? "exactly" : C.inclusive ? "at most" : "under"} ${C.maximum} character(s)` : C.type === "number" ? I = `Number must be ${C.exact ? "exactly" : C.inclusive ? "less than or equal to" : "less than"} ${C.maximum}` : C.type === "bigint" ? I = `BigInt must be ${C.exact ? "exactly" : C.inclusive ? "less than or equal to" : "less than"} ${C.maximum}` : C.type === "date" ? I = `Date must be ${C.exact ? "exactly" : C.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(C.maximum))}` : I = "Invalid input";
15449
15460
  break;
15450
- case l.custom:
15461
+ case d.custom:
15451
15462
  I = "Invalid input";
15452
15463
  break;
15453
- case l.invalid_intersection_types:
15464
+ case d.invalid_intersection_types:
15454
15465
  I = "Intersection results could not be merged";
15455
15466
  break;
15456
- case l.not_multiple_of:
15467
+ case d.not_multiple_of:
15457
15468
  I = `Number must be a multiple of ${C.multipleOf}`;
15458
15469
  break;
15459
- case l.not_finite:
15470
+ case d.not_finite:
15460
15471
  I = "Number must be finite";
15461
15472
  break;
15462
15473
  default:
@@ -15507,7 +15518,7 @@ function Y(C, A) {
15507
15518
  });
15508
15519
  C.common.issues.push(g);
15509
15520
  }
15510
- class kA {
15521
+ class NA {
15511
15522
  constructor() {
15512
15523
  this.value = "valid";
15513
15524
  }
@@ -15535,7 +15546,7 @@ class kA {
15535
15546
  value: E
15536
15547
  });
15537
15548
  }
15538
- return kA.mergeObjectSync(A, g);
15549
+ return NA.mergeObjectSync(A, g);
15539
15550
  }
15540
15551
  static mergeObjectSync(A, I) {
15541
15552
  const g = {};
@@ -15550,12 +15561,12 @@ class kA {
15550
15561
  }
15551
15562
  const m = Object.freeze({
15552
15563
  status: "aborted"
15553
- }), YI = (C) => ({ status: "dirty", value: C }), JA = (C) => ({ status: "valid", value: C }), zC = (C) => C.status === "aborted", $C = (C) => C.status === "dirty", yI = (C) => C.status === "valid", cg = (C) => typeof Promise < "u" && C instanceof Promise;
15554
- var u;
15564
+ }), YI = (C) => ({ status: "dirty", value: C }), lA = (C) => ({ status: "valid", value: C }), zC = (C) => C.status === "aborted", $C = (C) => C.status === "dirty", yI = (C) => C.status === "valid", cg = (C) => typeof Promise < "u" && C instanceof Promise;
15565
+ var K;
15555
15566
  (function(C) {
15556
15567
  C.errToObj = (A) => typeof A == "string" ? { message: A } : A || {}, C.toString = (A) => typeof A == "string" ? A : A?.message;
15557
- })(u || (u = {}));
15558
- class zA {
15568
+ })(K || (K = {}));
15569
+ class jA {
15559
15570
  constructor(A, I, g, B) {
15560
15571
  this._cachedPath = [], this.parent = A, this.data = I, this._path = g, this._key = B;
15561
15572
  }
@@ -15608,7 +15619,7 @@ class Z {
15608
15619
  }
15609
15620
  _processInputParams(A) {
15610
15621
  return {
15611
- status: new kA(),
15622
+ status: new NA(),
15612
15623
  ctx: {
15613
15624
  common: A.parent.common,
15614
15625
  data: A.data,
@@ -15707,7 +15718,7 @@ class Z {
15707
15718
  const g = (B) => typeof I == "string" || typeof I > "u" ? { message: I } : typeof I == "function" ? I(B) : I;
15708
15719
  return this._refinement((B, Q) => {
15709
15720
  const E = A(B), i = () => Q.addIssue({
15710
- code: l.custom,
15721
+ code: d.custom,
15711
15722
  ...g(B)
15712
15723
  });
15713
15724
  return typeof Promise < "u" && E instanceof Promise ? E.then((o) => o ? !0 : (i(), !1)) : E ? !0 : (i(), !1);
@@ -15734,7 +15745,7 @@ class Z {
15734
15745
  };
15735
15746
  }
15736
15747
  optional() {
15737
- return jA.create(this, this._def);
15748
+ return XA.create(this, this._def);
15738
15749
  }
15739
15750
  nullable() {
15740
15751
  return FI.create(this, this._def);
@@ -15848,17 +15859,17 @@ class VA extends Z {
15848
15859
  if (this._def.coerce && (A.data = String(A.data)), this._getType(A) !== f.string) {
15849
15860
  const Q = this._getOrReturnCtx(A);
15850
15861
  return Y(Q, {
15851
- code: l.invalid_type,
15862
+ code: d.invalid_type,
15852
15863
  expected: f.string,
15853
15864
  received: Q.parsedType
15854
15865
  }), m;
15855
15866
  }
15856
- const g = new kA();
15867
+ const g = new NA();
15857
15868
  let B;
15858
15869
  for (const Q of this._def.checks)
15859
15870
  if (Q.kind === "min")
15860
15871
  A.data.length < Q.value && (B = this._getOrReturnCtx(A, B), Y(B, {
15861
- code: l.too_small,
15872
+ code: d.too_small,
15862
15873
  minimum: Q.value,
15863
15874
  type: "string",
15864
15875
  inclusive: !0,
@@ -15867,7 +15878,7 @@ class VA extends Z {
15867
15878
  }), g.dirty());
15868
15879
  else if (Q.kind === "max")
15869
15880
  A.data.length > Q.value && (B = this._getOrReturnCtx(A, B), Y(B, {
15870
- code: l.too_big,
15881
+ code: d.too_big,
15871
15882
  maximum: Q.value,
15872
15883
  type: "string",
15873
15884
  inclusive: !0,
@@ -15877,14 +15888,14 @@ class VA extends Z {
15877
15888
  else if (Q.kind === "length") {
15878
15889
  const E = A.data.length > Q.value, i = A.data.length < Q.value;
15879
15890
  (E || i) && (B = this._getOrReturnCtx(A, B), E ? Y(B, {
15880
- code: l.too_big,
15891
+ code: d.too_big,
15881
15892
  maximum: Q.value,
15882
15893
  type: "string",
15883
15894
  inclusive: !0,
15884
15895
  exact: !0,
15885
15896
  message: Q.message
15886
15897
  }) : i && Y(B, {
15887
- code: l.too_small,
15898
+ code: d.too_small,
15888
15899
  minimum: Q.value,
15889
15900
  type: "string",
15890
15901
  inclusive: !0,
@@ -15894,43 +15905,43 @@ class VA extends Z {
15894
15905
  } else if (Q.kind === "email")
15895
15906
  tt.test(A.data) || (B = this._getOrReturnCtx(A, B), Y(B, {
15896
15907
  validation: "email",
15897
- code: l.invalid_string,
15908
+ code: d.invalid_string,
15898
15909
  message: Q.message
15899
15910
  }), g.dirty());
15900
15911
  else if (Q.kind === "emoji")
15901
15912
  Og || (Og = new RegExp(at, "u")), Og.test(A.data) || (B = this._getOrReturnCtx(A, B), Y(B, {
15902
15913
  validation: "emoji",
15903
- code: l.invalid_string,
15914
+ code: d.invalid_string,
15904
15915
  message: Q.message
15905
15916
  }), g.dirty());
15906
15917
  else if (Q.kind === "uuid")
15907
15918
  Et.test(A.data) || (B = this._getOrReturnCtx(A, B), Y(B, {
15908
15919
  validation: "uuid",
15909
- code: l.invalid_string,
15920
+ code: d.invalid_string,
15910
15921
  message: Q.message
15911
15922
  }), g.dirty());
15912
15923
  else if (Q.kind === "nanoid")
15913
15924
  it.test(A.data) || (B = this._getOrReturnCtx(A, B), Y(B, {
15914
15925
  validation: "nanoid",
15915
- code: l.invalid_string,
15926
+ code: d.invalid_string,
15916
15927
  message: Q.message
15917
15928
  }), g.dirty());
15918
15929
  else if (Q.kind === "cuid")
15919
15930
  Bt.test(A.data) || (B = this._getOrReturnCtx(A, B), Y(B, {
15920
15931
  validation: "cuid",
15921
- code: l.invalid_string,
15932
+ code: d.invalid_string,
15922
15933
  message: Q.message
15923
15934
  }), g.dirty());
15924
15935
  else if (Q.kind === "cuid2")
15925
15936
  Ct.test(A.data) || (B = this._getOrReturnCtx(A, B), Y(B, {
15926
15937
  validation: "cuid2",
15927
- code: l.invalid_string,
15938
+ code: d.invalid_string,
15928
15939
  message: Q.message
15929
15940
  }), g.dirty());
15930
15941
  else if (Q.kind === "ulid")
15931
15942
  Qt.test(A.data) || (B = this._getOrReturnCtx(A, B), Y(B, {
15932
15943
  validation: "ulid",
15933
- code: l.invalid_string,
15944
+ code: d.invalid_string,
15934
15945
  message: Q.message
15935
15946
  }), g.dirty());
15936
15947
  else if (Q.kind === "url")
@@ -15939,61 +15950,61 @@ class VA extends Z {
15939
15950
  } catch {
15940
15951
  B = this._getOrReturnCtx(A, B), Y(B, {
15941
15952
  validation: "url",
15942
- code: l.invalid_string,
15953
+ code: d.invalid_string,
15943
15954
  message: Q.message
15944
15955
  }), g.dirty();
15945
15956
  }
15946
15957
  else Q.kind === "regex" ? (Q.regex.lastIndex = 0, Q.regex.test(A.data) || (B = this._getOrReturnCtx(A, B), Y(B, {
15947
15958
  validation: "regex",
15948
- code: l.invalid_string,
15959
+ code: d.invalid_string,
15949
15960
  message: Q.message
15950
15961
  }), g.dirty())) : Q.kind === "trim" ? A.data = A.data.trim() : Q.kind === "includes" ? A.data.includes(Q.value, Q.position) || (B = this._getOrReturnCtx(A, B), Y(B, {
15951
- code: l.invalid_string,
15962
+ code: d.invalid_string,
15952
15963
  validation: { includes: Q.value, position: Q.position },
15953
15964
  message: Q.message
15954
15965
  }), g.dirty()) : Q.kind === "toLowerCase" ? A.data = A.data.toLowerCase() : Q.kind === "toUpperCase" ? A.data = A.data.toUpperCase() : Q.kind === "startsWith" ? A.data.startsWith(Q.value) || (B = this._getOrReturnCtx(A, B), Y(B, {
15955
- code: l.invalid_string,
15966
+ code: d.invalid_string,
15956
15967
  validation: { startsWith: Q.value },
15957
15968
  message: Q.message
15958
15969
  }), g.dirty()) : Q.kind === "endsWith" ? A.data.endsWith(Q.value) || (B = this._getOrReturnCtx(A, B), Y(B, {
15959
- code: l.invalid_string,
15970
+ code: d.invalid_string,
15960
15971
  validation: { endsWith: Q.value },
15961
15972
  message: Q.message
15962
15973
  }), g.dirty()) : Q.kind === "datetime" ? Gt(Q).test(A.data) || (B = this._getOrReturnCtx(A, B), Y(B, {
15963
- code: l.invalid_string,
15974
+ code: d.invalid_string,
15964
15975
  validation: "datetime",
15965
15976
  message: Q.message
15966
15977
  }), g.dirty()) : Q.kind === "date" ? ct.test(A.data) || (B = this._getOrReturnCtx(A, B), Y(B, {
15967
- code: l.invalid_string,
15978
+ code: d.invalid_string,
15968
15979
  validation: "date",
15969
15980
  message: Q.message
15970
15981
  }), g.dirty()) : Q.kind === "time" ? wt(Q).test(A.data) || (B = this._getOrReturnCtx(A, B), Y(B, {
15971
- code: l.invalid_string,
15982
+ code: d.invalid_string,
15972
15983
  validation: "time",
15973
15984
  message: Q.message
15974
15985
  }), g.dirty()) : Q.kind === "duration" ? st.test(A.data) || (B = this._getOrReturnCtx(A, B), Y(B, {
15975
15986
  validation: "duration",
15976
- code: l.invalid_string,
15987
+ code: d.invalid_string,
15977
15988
  message: Q.message
15978
15989
  }), g.dirty()) : Q.kind === "ip" ? Ft(A.data, Q.version) || (B = this._getOrReturnCtx(A, B), Y(B, {
15979
15990
  validation: "ip",
15980
- code: l.invalid_string,
15991
+ code: d.invalid_string,
15981
15992
  message: Q.message
15982
15993
  }), g.dirty()) : Q.kind === "jwt" ? St(A.data, Q.alg) || (B = this._getOrReturnCtx(A, B), Y(B, {
15983
15994
  validation: "jwt",
15984
- code: l.invalid_string,
15995
+ code: d.invalid_string,
15985
15996
  message: Q.message
15986
15997
  }), g.dirty()) : Q.kind === "cidr" ? Nt(A.data, Q.version) || (B = this._getOrReturnCtx(A, B), Y(B, {
15987
15998
  validation: "cidr",
15988
- code: l.invalid_string,
15999
+ code: d.invalid_string,
15989
16000
  message: Q.message
15990
16001
  }), g.dirty()) : Q.kind === "base64" ? ht.test(A.data) || (B = this._getOrReturnCtx(A, B), Y(B, {
15991
16002
  validation: "base64",
15992
- code: l.invalid_string,
16003
+ code: d.invalid_string,
15993
16004
  message: Q.message
15994
16005
  }), g.dirty()) : Q.kind === "base64url" ? yt.test(A.data) || (B = this._getOrReturnCtx(A, B), Y(B, {
15995
16006
  validation: "base64url",
15996
- code: l.invalid_string,
16007
+ code: d.invalid_string,
15997
16008
  message: Q.message
15998
16009
  }), g.dirty()) : V.assertNever(Q);
15999
16010
  return { status: g.value, value: A.data };
@@ -16001,8 +16012,8 @@ class VA extends Z {
16001
16012
  _regex(A, I, g) {
16002
16013
  return this.refinement((B) => A.test(B), {
16003
16014
  validation: I,
16004
- code: l.invalid_string,
16005
- ...u.errToObj(g)
16015
+ code: d.invalid_string,
16016
+ ...K.errToObj(g)
16006
16017
  });
16007
16018
  }
16008
16019
  _addCheck(A) {
@@ -16012,46 +16023,46 @@ class VA extends Z {
16012
16023
  });
16013
16024
  }
16014
16025
  email(A) {
16015
- return this._addCheck({ kind: "email", ...u.errToObj(A) });
16026
+ return this._addCheck({ kind: "email", ...K.errToObj(A) });
16016
16027
  }
16017
16028
  url(A) {
16018
- return this._addCheck({ kind: "url", ...u.errToObj(A) });
16029
+ return this._addCheck({ kind: "url", ...K.errToObj(A) });
16019
16030
  }
16020
16031
  emoji(A) {
16021
- return this._addCheck({ kind: "emoji", ...u.errToObj(A) });
16032
+ return this._addCheck({ kind: "emoji", ...K.errToObj(A) });
16022
16033
  }
16023
16034
  uuid(A) {
16024
- return this._addCheck({ kind: "uuid", ...u.errToObj(A) });
16035
+ return this._addCheck({ kind: "uuid", ...K.errToObj(A) });
16025
16036
  }
16026
16037
  nanoid(A) {
16027
- return this._addCheck({ kind: "nanoid", ...u.errToObj(A) });
16038
+ return this._addCheck({ kind: "nanoid", ...K.errToObj(A) });
16028
16039
  }
16029
16040
  cuid(A) {
16030
- return this._addCheck({ kind: "cuid", ...u.errToObj(A) });
16041
+ return this._addCheck({ kind: "cuid", ...K.errToObj(A) });
16031
16042
  }
16032
16043
  cuid2(A) {
16033
- return this._addCheck({ kind: "cuid2", ...u.errToObj(A) });
16044
+ return this._addCheck({ kind: "cuid2", ...K.errToObj(A) });
16034
16045
  }
16035
16046
  ulid(A) {
16036
- return this._addCheck({ kind: "ulid", ...u.errToObj(A) });
16047
+ return this._addCheck({ kind: "ulid", ...K.errToObj(A) });
16037
16048
  }
16038
16049
  base64(A) {
16039
- return this._addCheck({ kind: "base64", ...u.errToObj(A) });
16050
+ return this._addCheck({ kind: "base64", ...K.errToObj(A) });
16040
16051
  }
16041
16052
  base64url(A) {
16042
16053
  return this._addCheck({
16043
16054
  kind: "base64url",
16044
- ...u.errToObj(A)
16055
+ ...K.errToObj(A)
16045
16056
  });
16046
16057
  }
16047
16058
  jwt(A) {
16048
- return this._addCheck({ kind: "jwt", ...u.errToObj(A) });
16059
+ return this._addCheck({ kind: "jwt", ...K.errToObj(A) });
16049
16060
  }
16050
16061
  ip(A) {
16051
- return this._addCheck({ kind: "ip", ...u.errToObj(A) });
16062
+ return this._addCheck({ kind: "ip", ...K.errToObj(A) });
16052
16063
  }
16053
16064
  cidr(A) {
16054
- return this._addCheck({ kind: "cidr", ...u.errToObj(A) });
16065
+ return this._addCheck({ kind: "cidr", ...K.errToObj(A) });
16055
16066
  }
16056
16067
  datetime(A) {
16057
16068
  return typeof A == "string" ? this._addCheck({
@@ -16065,7 +16076,7 @@ class VA extends Z {
16065
16076
  precision: typeof A?.precision > "u" ? null : A?.precision,
16066
16077
  offset: A?.offset ?? !1,
16067
16078
  local: A?.local ?? !1,
16068
- ...u.errToObj(A?.message)
16079
+ ...K.errToObj(A?.message)
16069
16080
  });
16070
16081
  }
16071
16082
  date(A) {
@@ -16079,17 +16090,17 @@ class VA extends Z {
16079
16090
  }) : this._addCheck({
16080
16091
  kind: "time",
16081
16092
  precision: typeof A?.precision > "u" ? null : A?.precision,
16082
- ...u.errToObj(A?.message)
16093
+ ...K.errToObj(A?.message)
16083
16094
  });
16084
16095
  }
16085
16096
  duration(A) {
16086
- return this._addCheck({ kind: "duration", ...u.errToObj(A) });
16097
+ return this._addCheck({ kind: "duration", ...K.errToObj(A) });
16087
16098
  }
16088
16099
  regex(A, I) {
16089
16100
  return this._addCheck({
16090
16101
  kind: "regex",
16091
16102
  regex: A,
16092
- ...u.errToObj(I)
16103
+ ...K.errToObj(I)
16093
16104
  });
16094
16105
  }
16095
16106
  includes(A, I) {
@@ -16097,49 +16108,49 @@ class VA extends Z {
16097
16108
  kind: "includes",
16098
16109
  value: A,
16099
16110
  position: I?.position,
16100
- ...u.errToObj(I?.message)
16111
+ ...K.errToObj(I?.message)
16101
16112
  });
16102
16113
  }
16103
16114
  startsWith(A, I) {
16104
16115
  return this._addCheck({
16105
16116
  kind: "startsWith",
16106
16117
  value: A,
16107
- ...u.errToObj(I)
16118
+ ...K.errToObj(I)
16108
16119
  });
16109
16120
  }
16110
16121
  endsWith(A, I) {
16111
16122
  return this._addCheck({
16112
16123
  kind: "endsWith",
16113
16124
  value: A,
16114
- ...u.errToObj(I)
16125
+ ...K.errToObj(I)
16115
16126
  });
16116
16127
  }
16117
16128
  min(A, I) {
16118
16129
  return this._addCheck({
16119
16130
  kind: "min",
16120
16131
  value: A,
16121
- ...u.errToObj(I)
16132
+ ...K.errToObj(I)
16122
16133
  });
16123
16134
  }
16124
16135
  max(A, I) {
16125
16136
  return this._addCheck({
16126
16137
  kind: "max",
16127
16138
  value: A,
16128
- ...u.errToObj(I)
16139
+ ...K.errToObj(I)
16129
16140
  });
16130
16141
  }
16131
16142
  length(A, I) {
16132
16143
  return this._addCheck({
16133
16144
  kind: "length",
16134
16145
  value: A,
16135
- ...u.errToObj(I)
16146
+ ...K.errToObj(I)
16136
16147
  });
16137
16148
  }
16138
16149
  /**
16139
16150
  * Equivalent to `.min(1)`
16140
16151
  */
16141
16152
  nonempty(A) {
16142
- return this.min(1, u.errToObj(A));
16153
+ return this.min(1, K.errToObj(A));
16143
16154
  }
16144
16155
  trim() {
16145
16156
  return new VA({
@@ -16238,54 +16249,54 @@ class cI extends Z {
16238
16249
  if (this._def.coerce && (A.data = Number(A.data)), this._getType(A) !== f.number) {
16239
16250
  const Q = this._getOrReturnCtx(A);
16240
16251
  return Y(Q, {
16241
- code: l.invalid_type,
16252
+ code: d.invalid_type,
16242
16253
  expected: f.number,
16243
16254
  received: Q.parsedType
16244
16255
  }), m;
16245
16256
  }
16246
16257
  let g;
16247
- const B = new kA();
16258
+ const B = new NA();
16248
16259
  for (const Q of this._def.checks)
16249
16260
  Q.kind === "int" ? V.isInteger(A.data) || (g = this._getOrReturnCtx(A, g), Y(g, {
16250
- code: l.invalid_type,
16261
+ code: d.invalid_type,
16251
16262
  expected: "integer",
16252
16263
  received: "float",
16253
16264
  message: Q.message
16254
16265
  }), B.dirty()) : Q.kind === "min" ? (Q.inclusive ? A.data < Q.value : A.data <= Q.value) && (g = this._getOrReturnCtx(A, g), Y(g, {
16255
- code: l.too_small,
16266
+ code: d.too_small,
16256
16267
  minimum: Q.value,
16257
16268
  type: "number",
16258
16269
  inclusive: Q.inclusive,
16259
16270
  exact: !1,
16260
16271
  message: Q.message
16261
16272
  }), B.dirty()) : Q.kind === "max" ? (Q.inclusive ? A.data > Q.value : A.data >= Q.value) && (g = this._getOrReturnCtx(A, g), Y(g, {
16262
- code: l.too_big,
16273
+ code: d.too_big,
16263
16274
  maximum: Q.value,
16264
16275
  type: "number",
16265
16276
  inclusive: Q.inclusive,
16266
16277
  exact: !1,
16267
16278
  message: Q.message
16268
16279
  }), B.dirty()) : Q.kind === "multipleOf" ? Rt(A.data, Q.value) !== 0 && (g = this._getOrReturnCtx(A, g), Y(g, {
16269
- code: l.not_multiple_of,
16280
+ code: d.not_multiple_of,
16270
16281
  multipleOf: Q.value,
16271
16282
  message: Q.message
16272
16283
  }), B.dirty()) : Q.kind === "finite" ? Number.isFinite(A.data) || (g = this._getOrReturnCtx(A, g), Y(g, {
16273
- code: l.not_finite,
16284
+ code: d.not_finite,
16274
16285
  message: Q.message
16275
16286
  }), B.dirty()) : V.assertNever(Q);
16276
16287
  return { status: B.value, value: A.data };
16277
16288
  }
16278
16289
  gte(A, I) {
16279
- return this.setLimit("min", A, !0, u.toString(I));
16290
+ return this.setLimit("min", A, !0, K.toString(I));
16280
16291
  }
16281
16292
  gt(A, I) {
16282
- return this.setLimit("min", A, !1, u.toString(I));
16293
+ return this.setLimit("min", A, !1, K.toString(I));
16283
16294
  }
16284
16295
  lte(A, I) {
16285
- return this.setLimit("max", A, !0, u.toString(I));
16296
+ return this.setLimit("max", A, !0, K.toString(I));
16286
16297
  }
16287
16298
  lt(A, I) {
16288
- return this.setLimit("max", A, !1, u.toString(I));
16299
+ return this.setLimit("max", A, !1, K.toString(I));
16289
16300
  }
16290
16301
  setLimit(A, I, g, B) {
16291
16302
  return new cI({
@@ -16296,7 +16307,7 @@ class cI extends Z {
16296
16307
  kind: A,
16297
16308
  value: I,
16298
16309
  inclusive: g,
16299
- message: u.toString(B)
16310
+ message: K.toString(B)
16300
16311
  }
16301
16312
  ]
16302
16313
  });
@@ -16310,7 +16321,7 @@ class cI extends Z {
16310
16321
  int(A) {
16311
16322
  return this._addCheck({
16312
16323
  kind: "int",
16313
- message: u.toString(A)
16324
+ message: K.toString(A)
16314
16325
  });
16315
16326
  }
16316
16327
  positive(A) {
@@ -16318,7 +16329,7 @@ class cI extends Z {
16318
16329
  kind: "min",
16319
16330
  value: 0,
16320
16331
  inclusive: !1,
16321
- message: u.toString(A)
16332
+ message: K.toString(A)
16322
16333
  });
16323
16334
  }
16324
16335
  negative(A) {
@@ -16326,7 +16337,7 @@ class cI extends Z {
16326
16337
  kind: "max",
16327
16338
  value: 0,
16328
16339
  inclusive: !1,
16329
- message: u.toString(A)
16340
+ message: K.toString(A)
16330
16341
  });
16331
16342
  }
16332
16343
  nonpositive(A) {
@@ -16334,7 +16345,7 @@ class cI extends Z {
16334
16345
  kind: "max",
16335
16346
  value: 0,
16336
16347
  inclusive: !0,
16337
- message: u.toString(A)
16348
+ message: K.toString(A)
16338
16349
  });
16339
16350
  }
16340
16351
  nonnegative(A) {
@@ -16342,20 +16353,20 @@ class cI extends Z {
16342
16353
  kind: "min",
16343
16354
  value: 0,
16344
16355
  inclusive: !0,
16345
- message: u.toString(A)
16356
+ message: K.toString(A)
16346
16357
  });
16347
16358
  }
16348
16359
  multipleOf(A, I) {
16349
16360
  return this._addCheck({
16350
16361
  kind: "multipleOf",
16351
16362
  value: A,
16352
- message: u.toString(I)
16363
+ message: K.toString(I)
16353
16364
  });
16354
16365
  }
16355
16366
  finite(A) {
16356
16367
  return this._addCheck({
16357
16368
  kind: "finite",
16358
- message: u.toString(A)
16369
+ message: K.toString(A)
16359
16370
  });
16360
16371
  }
16361
16372
  safe(A) {
@@ -16363,12 +16374,12 @@ class cI extends Z {
16363
16374
  kind: "min",
16364
16375
  inclusive: !0,
16365
16376
  value: Number.MIN_SAFE_INTEGER,
16366
- message: u.toString(A)
16377
+ message: K.toString(A)
16367
16378
  })._addCheck({
16368
16379
  kind: "max",
16369
16380
  inclusive: !0,
16370
16381
  value: Number.MAX_SAFE_INTEGER,
16371
- message: u.toString(A)
16382
+ message: K.toString(A)
16372
16383
  });
16373
16384
  }
16374
16385
  get minValue() {
@@ -16416,22 +16427,22 @@ class xI extends Z {
16416
16427
  if (this._getType(A) !== f.bigint)
16417
16428
  return this._getInvalidInput(A);
16418
16429
  let g;
16419
- const B = new kA();
16430
+ const B = new NA();
16420
16431
  for (const Q of this._def.checks)
16421
16432
  Q.kind === "min" ? (Q.inclusive ? A.data < Q.value : A.data <= Q.value) && (g = this._getOrReturnCtx(A, g), Y(g, {
16422
- code: l.too_small,
16433
+ code: d.too_small,
16423
16434
  type: "bigint",
16424
16435
  minimum: Q.value,
16425
16436
  inclusive: Q.inclusive,
16426
16437
  message: Q.message
16427
16438
  }), B.dirty()) : Q.kind === "max" ? (Q.inclusive ? A.data > Q.value : A.data >= Q.value) && (g = this._getOrReturnCtx(A, g), Y(g, {
16428
- code: l.too_big,
16439
+ code: d.too_big,
16429
16440
  type: "bigint",
16430
16441
  maximum: Q.value,
16431
16442
  inclusive: Q.inclusive,
16432
16443
  message: Q.message
16433
16444
  }), B.dirty()) : Q.kind === "multipleOf" ? A.data % Q.value !== BigInt(0) && (g = this._getOrReturnCtx(A, g), Y(g, {
16434
- code: l.not_multiple_of,
16445
+ code: d.not_multiple_of,
16435
16446
  multipleOf: Q.value,
16436
16447
  message: Q.message
16437
16448
  }), B.dirty()) : V.assertNever(Q);
@@ -16440,22 +16451,22 @@ class xI extends Z {
16440
16451
  _getInvalidInput(A) {
16441
16452
  const I = this._getOrReturnCtx(A);
16442
16453
  return Y(I, {
16443
- code: l.invalid_type,
16454
+ code: d.invalid_type,
16444
16455
  expected: f.bigint,
16445
16456
  received: I.parsedType
16446
16457
  }), m;
16447
16458
  }
16448
16459
  gte(A, I) {
16449
- return this.setLimit("min", A, !0, u.toString(I));
16460
+ return this.setLimit("min", A, !0, K.toString(I));
16450
16461
  }
16451
16462
  gt(A, I) {
16452
- return this.setLimit("min", A, !1, u.toString(I));
16463
+ return this.setLimit("min", A, !1, K.toString(I));
16453
16464
  }
16454
16465
  lte(A, I) {
16455
- return this.setLimit("max", A, !0, u.toString(I));
16466
+ return this.setLimit("max", A, !0, K.toString(I));
16456
16467
  }
16457
16468
  lt(A, I) {
16458
- return this.setLimit("max", A, !1, u.toString(I));
16469
+ return this.setLimit("max", A, !1, K.toString(I));
16459
16470
  }
16460
16471
  setLimit(A, I, g, B) {
16461
16472
  return new xI({
@@ -16466,7 +16477,7 @@ class xI extends Z {
16466
16477
  kind: A,
16467
16478
  value: I,
16468
16479
  inclusive: g,
16469
- message: u.toString(B)
16480
+ message: K.toString(B)
16470
16481
  }
16471
16482
  ]
16472
16483
  });
@@ -16482,7 +16493,7 @@ class xI extends Z {
16482
16493
  kind: "min",
16483
16494
  value: BigInt(0),
16484
16495
  inclusive: !1,
16485
- message: u.toString(A)
16496
+ message: K.toString(A)
16486
16497
  });
16487
16498
  }
16488
16499
  negative(A) {
@@ -16490,7 +16501,7 @@ class xI extends Z {
16490
16501
  kind: "max",
16491
16502
  value: BigInt(0),
16492
16503
  inclusive: !1,
16493
- message: u.toString(A)
16504
+ message: K.toString(A)
16494
16505
  });
16495
16506
  }
16496
16507
  nonpositive(A) {
@@ -16498,7 +16509,7 @@ class xI extends Z {
16498
16509
  kind: "max",
16499
16510
  value: BigInt(0),
16500
16511
  inclusive: !0,
16501
- message: u.toString(A)
16512
+ message: K.toString(A)
16502
16513
  });
16503
16514
  }
16504
16515
  nonnegative(A) {
@@ -16506,14 +16517,14 @@ class xI extends Z {
16506
16517
  kind: "min",
16507
16518
  value: BigInt(0),
16508
16519
  inclusive: !0,
16509
- message: u.toString(A)
16520
+ message: K.toString(A)
16510
16521
  });
16511
16522
  }
16512
16523
  multipleOf(A, I) {
16513
16524
  return this._addCheck({
16514
16525
  kind: "multipleOf",
16515
16526
  value: A,
16516
- message: u.toString(I)
16527
+ message: K.toString(I)
16517
16528
  });
16518
16529
  }
16519
16530
  get minValue() {
@@ -16540,12 +16551,12 @@ class eB extends Z {
16540
16551
  if (this._def.coerce && (A.data = !!A.data), this._getType(A) !== f.boolean) {
16541
16552
  const g = this._getOrReturnCtx(A);
16542
16553
  return Y(g, {
16543
- code: l.invalid_type,
16554
+ code: d.invalid_type,
16544
16555
  expected: f.boolean,
16545
16556
  received: g.parsedType
16546
16557
  }), m;
16547
16558
  }
16548
- return JA(A.data);
16559
+ return lA(A.data);
16549
16560
  }
16550
16561
  }
16551
16562
  eB.create = (C) => new eB({
@@ -16558,7 +16569,7 @@ class wg extends Z {
16558
16569
  if (this._def.coerce && (A.data = new Date(A.data)), this._getType(A) !== f.date) {
16559
16570
  const Q = this._getOrReturnCtx(A);
16560
16571
  return Y(Q, {
16561
- code: l.invalid_type,
16572
+ code: d.invalid_type,
16562
16573
  expected: f.date,
16563
16574
  received: Q.parsedType
16564
16575
  }), m;
@@ -16566,21 +16577,21 @@ class wg extends Z {
16566
16577
  if (Number.isNaN(A.data.getTime())) {
16567
16578
  const Q = this._getOrReturnCtx(A);
16568
16579
  return Y(Q, {
16569
- code: l.invalid_date
16580
+ code: d.invalid_date
16570
16581
  }), m;
16571
16582
  }
16572
- const g = new kA();
16583
+ const g = new NA();
16573
16584
  let B;
16574
16585
  for (const Q of this._def.checks)
16575
16586
  Q.kind === "min" ? A.data.getTime() < Q.value && (B = this._getOrReturnCtx(A, B), Y(B, {
16576
- code: l.too_small,
16587
+ code: d.too_small,
16577
16588
  message: Q.message,
16578
16589
  inclusive: !0,
16579
16590
  exact: !1,
16580
16591
  minimum: Q.value,
16581
16592
  type: "date"
16582
16593
  }), g.dirty()) : Q.kind === "max" ? A.data.getTime() > Q.value && (B = this._getOrReturnCtx(A, B), Y(B, {
16583
- code: l.too_big,
16594
+ code: d.too_big,
16584
16595
  message: Q.message,
16585
16596
  inclusive: !0,
16586
16597
  exact: !1,
@@ -16602,14 +16613,14 @@ class wg extends Z {
16602
16613
  return this._addCheck({
16603
16614
  kind: "min",
16604
16615
  value: A.getTime(),
16605
- message: u.toString(I)
16616
+ message: K.toString(I)
16606
16617
  });
16607
16618
  }
16608
16619
  max(A, I) {
16609
16620
  return this._addCheck({
16610
16621
  kind: "max",
16611
16622
  value: A.getTime(),
16612
- message: u.toString(I)
16623
+ message: K.toString(I)
16613
16624
  });
16614
16625
  }
16615
16626
  get minDate() {
@@ -16636,12 +16647,12 @@ class IQ extends Z {
16636
16647
  if (this._getType(A) !== f.symbol) {
16637
16648
  const g = this._getOrReturnCtx(A);
16638
16649
  return Y(g, {
16639
- code: l.invalid_type,
16650
+ code: d.invalid_type,
16640
16651
  expected: f.symbol,
16641
16652
  received: g.parsedType
16642
16653
  }), m;
16643
16654
  }
16644
- return JA(A.data);
16655
+ return lA(A.data);
16645
16656
  }
16646
16657
  }
16647
16658
  IQ.create = (C) => new IQ({
@@ -16653,12 +16664,12 @@ class gQ extends Z {
16653
16664
  if (this._getType(A) !== f.undefined) {
16654
16665
  const g = this._getOrReturnCtx(A);
16655
16666
  return Y(g, {
16656
- code: l.invalid_type,
16667
+ code: d.invalid_type,
16657
16668
  expected: f.undefined,
16658
16669
  received: g.parsedType
16659
16670
  }), m;
16660
16671
  }
16661
- return JA(A.data);
16672
+ return lA(A.data);
16662
16673
  }
16663
16674
  }
16664
16675
  gQ.create = (C) => new gQ({
@@ -16670,12 +16681,12 @@ class BQ extends Z {
16670
16681
  if (this._getType(A) !== f.null) {
16671
16682
  const g = this._getOrReturnCtx(A);
16672
16683
  return Y(g, {
16673
- code: l.invalid_type,
16684
+ code: d.invalid_type,
16674
16685
  expected: f.null,
16675
16686
  received: g.parsedType
16676
16687
  }), m;
16677
16688
  }
16678
- return JA(A.data);
16689
+ return lA(A.data);
16679
16690
  }
16680
16691
  }
16681
16692
  BQ.create = (C) => new BQ({
@@ -16687,7 +16698,7 @@ class nB extends Z {
16687
16698
  super(...arguments), this._any = !0;
16688
16699
  }
16689
16700
  _parse(A) {
16690
- return JA(A.data);
16701
+ return lA(A.data);
16691
16702
  }
16692
16703
  }
16693
16704
  nB.create = (C) => new nB({
@@ -16699,24 +16710,24 @@ class CQ extends Z {
16699
16710
  super(...arguments), this._unknown = !0;
16700
16711
  }
16701
16712
  _parse(A) {
16702
- return JA(A.data);
16713
+ return lA(A.data);
16703
16714
  }
16704
16715
  }
16705
16716
  CQ.create = (C) => new CQ({
16706
16717
  typeName: x.ZodUnknown,
16707
16718
  ...b(C)
16708
16719
  });
16709
- class $A extends Z {
16720
+ class zA extends Z {
16710
16721
  _parse(A) {
16711
16722
  const I = this._getOrReturnCtx(A);
16712
16723
  return Y(I, {
16713
- code: l.invalid_type,
16724
+ code: d.invalid_type,
16714
16725
  expected: f.never,
16715
16726
  received: I.parsedType
16716
16727
  }), m;
16717
16728
  }
16718
16729
  }
16719
- $A.create = (C) => new $A({
16730
+ zA.create = (C) => new zA({
16720
16731
  typeName: x.ZodNever,
16721
16732
  ...b(C)
16722
16733
  });
@@ -16725,12 +16736,12 @@ class QQ extends Z {
16725
16736
  if (this._getType(A) !== f.undefined) {
16726
16737
  const g = this._getOrReturnCtx(A);
16727
16738
  return Y(g, {
16728
- code: l.invalid_type,
16739
+ code: d.invalid_type,
16729
16740
  expected: f.void,
16730
16741
  received: g.parsedType
16731
16742
  }), m;
16732
16743
  }
16733
- return JA(A.data);
16744
+ return lA(A.data);
16734
16745
  }
16735
16746
  }
16736
16747
  QQ.create = (C) => new QQ({
@@ -16742,14 +16753,14 @@ class pA extends Z {
16742
16753
  const { ctx: I, status: g } = this._processInputParams(A), B = this._def;
16743
16754
  if (I.parsedType !== f.array)
16744
16755
  return Y(I, {
16745
- code: l.invalid_type,
16756
+ code: d.invalid_type,
16746
16757
  expected: f.array,
16747
16758
  received: I.parsedType
16748
16759
  }), m;
16749
16760
  if (B.exactLength !== null) {
16750
16761
  const E = I.data.length > B.exactLength.value, i = I.data.length < B.exactLength.value;
16751
16762
  (E || i) && (Y(I, {
16752
- code: E ? l.too_big : l.too_small,
16763
+ code: E ? d.too_big : d.too_small,
16753
16764
  minimum: i ? B.exactLength.value : void 0,
16754
16765
  maximum: E ? B.exactLength.value : void 0,
16755
16766
  type: "array",
@@ -16759,23 +16770,23 @@ class pA extends Z {
16759
16770
  }), g.dirty());
16760
16771
  }
16761
16772
  if (B.minLength !== null && I.data.length < B.minLength.value && (Y(I, {
16762
- code: l.too_small,
16773
+ code: d.too_small,
16763
16774
  minimum: B.minLength.value,
16764
16775
  type: "array",
16765
16776
  inclusive: !0,
16766
16777
  exact: !1,
16767
16778
  message: B.minLength.message
16768
16779
  }), g.dirty()), B.maxLength !== null && I.data.length > B.maxLength.value && (Y(I, {
16769
- code: l.too_big,
16780
+ code: d.too_big,
16770
16781
  maximum: B.maxLength.value,
16771
16782
  type: "array",
16772
16783
  inclusive: !0,
16773
16784
  exact: !1,
16774
16785
  message: B.maxLength.message
16775
16786
  }), g.dirty()), I.common.async)
16776
- return Promise.all([...I.data].map((E, i) => B.type._parseAsync(new zA(I, E, I.path, i)))).then((E) => kA.mergeArray(g, E));
16777
- const Q = [...I.data].map((E, i) => B.type._parseSync(new zA(I, E, I.path, i)));
16778
- return kA.mergeArray(g, Q);
16787
+ return Promise.all([...I.data].map((E, i) => B.type._parseAsync(new jA(I, E, I.path, i)))).then((E) => NA.mergeArray(g, E));
16788
+ const Q = [...I.data].map((E, i) => B.type._parseSync(new jA(I, E, I.path, i)));
16789
+ return NA.mergeArray(g, Q);
16779
16790
  }
16780
16791
  get element() {
16781
16792
  return this._def.type;
@@ -16783,19 +16794,19 @@ class pA extends Z {
16783
16794
  min(A, I) {
16784
16795
  return new pA({
16785
16796
  ...this._def,
16786
- minLength: { value: A, message: u.toString(I) }
16797
+ minLength: { value: A, message: K.toString(I) }
16787
16798
  });
16788
16799
  }
16789
16800
  max(A, I) {
16790
16801
  return new pA({
16791
16802
  ...this._def,
16792
- maxLength: { value: A, message: u.toString(I) }
16803
+ maxLength: { value: A, message: K.toString(I) }
16793
16804
  });
16794
16805
  }
16795
16806
  length(A, I) {
16796
16807
  return new pA({
16797
16808
  ...this._def,
16798
- exactLength: { value: A, message: u.toString(I) }
16809
+ exactLength: { value: A, message: K.toString(I) }
16799
16810
  });
16800
16811
  }
16801
16812
  nonempty(A) {
@@ -16810,12 +16821,12 @@ pA.create = (C, A) => new pA({
16810
16821
  typeName: x.ZodArray,
16811
16822
  ...b(A)
16812
16823
  });
16813
- function aI(C) {
16824
+ function tI(C) {
16814
16825
  if (C instanceof aA) {
16815
16826
  const A = {};
16816
16827
  for (const I in C.shape) {
16817
16828
  const g = C.shape[I];
16818
- A[I] = jA.create(aI(g));
16829
+ A[I] = XA.create(tI(g));
16819
16830
  }
16820
16831
  return new aA({
16821
16832
  ...C._def,
@@ -16823,8 +16834,8 @@ function aI(C) {
16823
16834
  });
16824
16835
  } else return C instanceof pA ? new pA({
16825
16836
  ...C._def,
16826
- type: aI(C.element)
16827
- }) : C instanceof jA ? jA.create(aI(C.unwrap())) : C instanceof FI ? FI.create(aI(C.unwrap())) : C instanceof iI ? iI.create(C.items.map((A) => aI(A))) : C;
16837
+ type: tI(C.element)
16838
+ }) : C instanceof XA ? XA.create(tI(C.unwrap())) : C instanceof FI ? FI.create(tI(C.unwrap())) : C instanceof EI ? EI.create(C.items.map((A) => tI(A))) : C;
16828
16839
  }
16829
16840
  class aA extends Z {
16830
16841
  constructor() {
@@ -16840,13 +16851,13 @@ class aA extends Z {
16840
16851
  if (this._getType(A) !== f.object) {
16841
16852
  const s = this._getOrReturnCtx(A);
16842
16853
  return Y(s, {
16843
- code: l.invalid_type,
16854
+ code: d.invalid_type,
16844
16855
  expected: f.object,
16845
16856
  received: s.parsedType
16846
16857
  }), m;
16847
16858
  }
16848
16859
  const { status: g, ctx: B } = this._processInputParams(A), { shape: Q, keys: E } = this._getCached(), i = [];
16849
- if (!(this._def.catchall instanceof $A && this._def.unknownKeys === "strip"))
16860
+ if (!(this._def.catchall instanceof zA && this._def.unknownKeys === "strip"))
16850
16861
  for (const s in B.data)
16851
16862
  E.includes(s) || i.push(s);
16852
16863
  const o = [];
@@ -16854,11 +16865,11 @@ class aA extends Z {
16854
16865
  const t = Q[s], a = B.data[s];
16855
16866
  o.push({
16856
16867
  key: { status: "valid", value: s },
16857
- value: t._parse(new zA(B, a, B.path, s)),
16868
+ value: t._parse(new jA(B, a, B.path, s)),
16858
16869
  alwaysSet: s in B.data
16859
16870
  });
16860
16871
  }
16861
- if (this._def.catchall instanceof $A) {
16872
+ if (this._def.catchall instanceof zA) {
16862
16873
  const s = this._def.unknownKeys;
16863
16874
  if (s === "passthrough")
16864
16875
  for (const t of i)
@@ -16868,7 +16879,7 @@ class aA extends Z {
16868
16879
  });
16869
16880
  else if (s === "strict")
16870
16881
  i.length > 0 && (Y(B, {
16871
- code: l.unrecognized_keys,
16882
+ code: d.unrecognized_keys,
16872
16883
  keys: i
16873
16884
  }), g.dirty());
16874
16885
  else if (s !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
@@ -16879,7 +16890,7 @@ class aA extends Z {
16879
16890
  o.push({
16880
16891
  key: { status: "valid", value: t },
16881
16892
  value: s._parse(
16882
- new zA(B, a, B.path, t)
16893
+ new jA(B, a, B.path, t)
16883
16894
  //, ctx.child(key), value, getParsedType(value)
16884
16895
  ),
16885
16896
  alwaysSet: t in B.data
@@ -16897,20 +16908,20 @@ class aA extends Z {
16897
16908
  });
16898
16909
  }
16899
16910
  return s;
16900
- }).then((s) => kA.mergeObjectSync(g, s)) : kA.mergeObjectSync(g, o);
16911
+ }).then((s) => NA.mergeObjectSync(g, s)) : NA.mergeObjectSync(g, o);
16901
16912
  }
16902
16913
  get shape() {
16903
16914
  return this._def.shape();
16904
16915
  }
16905
16916
  strict(A) {
16906
- return u.errToObj, new aA({
16917
+ return K.errToObj, new aA({
16907
16918
  ...this._def,
16908
16919
  unknownKeys: "strict",
16909
16920
  ...A !== void 0 ? {
16910
16921
  errorMap: (I, g) => {
16911
16922
  const B = this._def.errorMap?.(I, g).message ?? g.defaultError;
16912
16923
  return I.code === "unrecognized_keys" ? {
16913
- message: u.errToObj(A).message ?? B
16924
+ message: K.errToObj(A).message ?? B
16914
16925
  } : {
16915
16926
  message: B
16916
16927
  };
@@ -17059,7 +17070,7 @@ class aA extends Z {
17059
17070
  * @deprecated
17060
17071
  */
17061
17072
  deepPartial() {
17062
- return aI(this);
17073
+ return tI(this);
17063
17074
  }
17064
17075
  partial(A) {
17065
17076
  const I = {};
@@ -17079,7 +17090,7 @@ class aA extends Z {
17079
17090
  I[g] = this.shape[g];
17080
17091
  else {
17081
17092
  let Q = this.shape[g];
17082
- for (; Q instanceof jA; )
17093
+ for (; Q instanceof XA; )
17083
17094
  Q = Q._def.innerType;
17084
17095
  I[g] = Q;
17085
17096
  }
@@ -17095,21 +17106,21 @@ class aA extends Z {
17095
17106
  aA.create = (C, A) => new aA({
17096
17107
  shape: () => C,
17097
17108
  unknownKeys: "strip",
17098
- catchall: $A.create(),
17109
+ catchall: zA.create(),
17099
17110
  typeName: x.ZodObject,
17100
17111
  ...b(A)
17101
17112
  });
17102
17113
  aA.strictCreate = (C, A) => new aA({
17103
17114
  shape: () => C,
17104
17115
  unknownKeys: "strict",
17105
- catchall: $A.create(),
17116
+ catchall: zA.create(),
17106
17117
  typeName: x.ZodObject,
17107
17118
  ...b(A)
17108
17119
  });
17109
17120
  aA.lazycreate = (C, A) => new aA({
17110
17121
  shape: C,
17111
17122
  unknownKeys: "strip",
17112
- catchall: $A.create(),
17123
+ catchall: zA.create(),
17113
17124
  typeName: x.ZodObject,
17114
17125
  ...b(A)
17115
17126
  });
@@ -17125,7 +17136,7 @@ class Gg extends Z {
17125
17136
  return I.common.issues.push(...i.ctx.common.issues), i.result;
17126
17137
  const E = Q.map((i) => new vA(i.ctx.common.issues));
17127
17138
  return Y(I, {
17128
- code: l.invalid_union,
17139
+ code: d.invalid_union,
17129
17140
  unionErrors: E
17130
17141
  }), m;
17131
17142
  }
@@ -17172,7 +17183,7 @@ class Gg extends Z {
17172
17183
  return I.common.issues.push(...Q.ctx.common.issues), Q.result;
17173
17184
  const i = E.map((o) => new vA(o));
17174
17185
  return Y(I, {
17175
- code: l.invalid_union,
17186
+ code: d.invalid_union,
17176
17187
  unionErrors: i
17177
17188
  }), m;
17178
17189
  }
@@ -17219,7 +17230,7 @@ class Fg extends Z {
17219
17230
  return m;
17220
17231
  const i = rB(Q.value, E.value);
17221
17232
  return i.valid ? (($C(Q) || $C(E)) && I.dirty(), { status: I.value, value: i.data }) : (Y(g, {
17222
- code: l.invalid_intersection_types
17233
+ code: d.invalid_intersection_types
17223
17234
  }), m);
17224
17235
  };
17225
17236
  return g.common.async ? Promise.all([
@@ -17250,25 +17261,25 @@ Fg.create = (C, A, I) => new Fg({
17250
17261
  typeName: x.ZodIntersection,
17251
17262
  ...b(I)
17252
17263
  });
17253
- class iI extends Z {
17264
+ class EI extends Z {
17254
17265
  _parse(A) {
17255
17266
  const { status: I, ctx: g } = this._processInputParams(A);
17256
17267
  if (g.parsedType !== f.array)
17257
17268
  return Y(g, {
17258
- code: l.invalid_type,
17269
+ code: d.invalid_type,
17259
17270
  expected: f.array,
17260
17271
  received: g.parsedType
17261
17272
  }), m;
17262
17273
  if (g.data.length < this._def.items.length)
17263
17274
  return Y(g, {
17264
- code: l.too_small,
17275
+ code: d.too_small,
17265
17276
  minimum: this._def.items.length,
17266
17277
  inclusive: !0,
17267
17278
  exact: !1,
17268
17279
  type: "array"
17269
17280
  }), m;
17270
17281
  !this._def.rest && g.data.length > this._def.items.length && (Y(g, {
17271
- code: l.too_big,
17282
+ code: d.too_big,
17272
17283
  maximum: this._def.items.length,
17273
17284
  inclusive: !0,
17274
17285
  exact: !1,
@@ -17276,24 +17287,24 @@ class iI extends Z {
17276
17287
  }), I.dirty());
17277
17288
  const Q = [...g.data].map((E, i) => {
17278
17289
  const o = this._def.items[i] || this._def.rest;
17279
- return o ? o._parse(new zA(g, E, g.path, i)) : null;
17290
+ return o ? o._parse(new jA(g, E, g.path, i)) : null;
17280
17291
  }).filter((E) => !!E);
17281
- return g.common.async ? Promise.all(Q).then((E) => kA.mergeArray(I, E)) : kA.mergeArray(I, Q);
17292
+ return g.common.async ? Promise.all(Q).then((E) => NA.mergeArray(I, E)) : NA.mergeArray(I, Q);
17282
17293
  }
17283
17294
  get items() {
17284
17295
  return this._def.items;
17285
17296
  }
17286
17297
  rest(A) {
17287
- return new iI({
17298
+ return new EI({
17288
17299
  ...this._def,
17289
17300
  rest: A
17290
17301
  });
17291
17302
  }
17292
17303
  }
17293
- iI.create = (C, A) => {
17304
+ EI.create = (C, A) => {
17294
17305
  if (!Array.isArray(C))
17295
17306
  throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
17296
- return new iI({
17307
+ return new EI({
17297
17308
  items: C,
17298
17309
  typeName: x.ZodTuple,
17299
17310
  rest: null,
@@ -17311,13 +17322,13 @@ class EQ extends Z {
17311
17322
  const { status: I, ctx: g } = this._processInputParams(A);
17312
17323
  if (g.parsedType !== f.map)
17313
17324
  return Y(g, {
17314
- code: l.invalid_type,
17325
+ code: d.invalid_type,
17315
17326
  expected: f.map,
17316
17327
  received: g.parsedType
17317
17328
  }), m;
17318
17329
  const B = this._def.keyType, Q = this._def.valueType, E = [...g.data.entries()].map(([i, o], s) => ({
17319
- key: B._parse(new zA(g, i, g.path, [s, "key"])),
17320
- value: Q._parse(new zA(g, o, g.path, [s, "value"]))
17330
+ key: B._parse(new jA(g, i, g.path, [s, "key"])),
17331
+ value: Q._parse(new jA(g, o, g.path, [s, "value"]))
17321
17332
  }));
17322
17333
  if (g.common.async) {
17323
17334
  const i = /* @__PURE__ */ new Map();
@@ -17353,20 +17364,20 @@ class bI extends Z {
17353
17364
  const { status: I, ctx: g } = this._processInputParams(A);
17354
17365
  if (g.parsedType !== f.set)
17355
17366
  return Y(g, {
17356
- code: l.invalid_type,
17367
+ code: d.invalid_type,
17357
17368
  expected: f.set,
17358
17369
  received: g.parsedType
17359
17370
  }), m;
17360
17371
  const B = this._def;
17361
17372
  B.minSize !== null && g.data.size < B.minSize.value && (Y(g, {
17362
- code: l.too_small,
17373
+ code: d.too_small,
17363
17374
  minimum: B.minSize.value,
17364
17375
  type: "set",
17365
17376
  inclusive: !0,
17366
17377
  exact: !1,
17367
17378
  message: B.minSize.message
17368
17379
  }), I.dirty()), B.maxSize !== null && g.data.size > B.maxSize.value && (Y(g, {
17369
- code: l.too_big,
17380
+ code: d.too_big,
17370
17381
  maximum: B.maxSize.value,
17371
17382
  type: "set",
17372
17383
  inclusive: !0,
@@ -17383,19 +17394,19 @@ class bI extends Z {
17383
17394
  }
17384
17395
  return { status: I.value, value: s };
17385
17396
  }
17386
- const i = [...g.data.values()].map((o, s) => Q._parse(new zA(g, o, g.path, s)));
17397
+ const i = [...g.data.values()].map((o, s) => Q._parse(new jA(g, o, g.path, s)));
17387
17398
  return g.common.async ? Promise.all(i).then((o) => E(o)) : E(i);
17388
17399
  }
17389
17400
  min(A, I) {
17390
17401
  return new bI({
17391
17402
  ...this._def,
17392
- minSize: { value: A, message: u.toString(I) }
17403
+ minSize: { value: A, message: K.toString(I) }
17393
17404
  });
17394
17405
  }
17395
17406
  max(A, I) {
17396
17407
  return new bI({
17397
17408
  ...this._def,
17398
- maxSize: { value: A, message: u.toString(I) }
17409
+ maxSize: { value: A, message: K.toString(I) }
17399
17410
  });
17400
17411
  }
17401
17412
  size(A, I) {
@@ -17432,7 +17443,7 @@ class DB extends Z {
17432
17443
  const I = this._getOrReturnCtx(A);
17433
17444
  return Y(I, {
17434
17445
  received: I.data,
17435
- code: l.invalid_literal,
17446
+ code: d.invalid_literal,
17436
17447
  expected: this._def.value
17437
17448
  }), m;
17438
17449
  }
@@ -17461,18 +17472,18 @@ class wI extends Z {
17461
17472
  return Y(I, {
17462
17473
  expected: V.joinValues(g),
17463
17474
  received: I.parsedType,
17464
- code: l.invalid_type
17475
+ code: d.invalid_type
17465
17476
  }), m;
17466
17477
  }
17467
17478
  if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(A.data)) {
17468
17479
  const I = this._getOrReturnCtx(A), g = this._def.values;
17469
17480
  return Y(I, {
17470
17481
  received: I.data,
17471
- code: l.invalid_enum_value,
17482
+ code: d.invalid_enum_value,
17472
17483
  options: g
17473
17484
  }), m;
17474
17485
  }
17475
- return JA(A.data);
17486
+ return lA(A.data);
17476
17487
  }
17477
17488
  get options() {
17478
17489
  return this._def.values;
@@ -17517,18 +17528,18 @@ class oQ extends Z {
17517
17528
  return Y(g, {
17518
17529
  expected: V.joinValues(B),
17519
17530
  received: g.parsedType,
17520
- code: l.invalid_type
17531
+ code: d.invalid_type
17521
17532
  }), m;
17522
17533
  }
17523
17534
  if (this._cache || (this._cache = new Set(V.getValidEnumValues(this._def.values))), !this._cache.has(A.data)) {
17524
17535
  const B = V.objectValues(I);
17525
17536
  return Y(g, {
17526
17537
  received: g.data,
17527
- code: l.invalid_enum_value,
17538
+ code: d.invalid_enum_value,
17528
17539
  options: B
17529
17540
  }), m;
17530
17541
  }
17531
- return JA(A.data);
17542
+ return lA(A.data);
17532
17543
  }
17533
17544
  get enum() {
17534
17545
  return this._def.values;
@@ -17547,12 +17558,12 @@ class Sg extends Z {
17547
17558
  const { ctx: I } = this._processInputParams(A);
17548
17559
  if (I.parsedType !== f.promise && I.common.async === !1)
17549
17560
  return Y(I, {
17550
- code: l.invalid_type,
17561
+ code: d.invalid_type,
17551
17562
  expected: f.promise,
17552
17563
  received: I.parsedType
17553
17564
  }), m;
17554
17565
  const g = I.parsedType === f.promise ? I.data : Promise.resolve(I.data);
17555
- return JA(g.then((B) => this._def.type.parseAsync(B, {
17566
+ return lA(g.then((B) => this._def.type.parseAsync(B, {
17556
17567
  path: I.path,
17557
17568
  errorMap: I.common.contextualErrorMap
17558
17569
  })));
@@ -17655,22 +17666,22 @@ GI.createWithPreprocess = (C, A, I) => new GI({
17655
17666
  typeName: x.ZodEffects,
17656
17667
  ...b(I)
17657
17668
  });
17658
- class jA extends Z {
17669
+ class XA extends Z {
17659
17670
  _parse(A) {
17660
- return this._getType(A) === f.undefined ? JA(void 0) : this._def.innerType._parse(A);
17671
+ return this._getType(A) === f.undefined ? lA(void 0) : this._def.innerType._parse(A);
17661
17672
  }
17662
17673
  unwrap() {
17663
17674
  return this._def.innerType;
17664
17675
  }
17665
17676
  }
17666
- jA.create = (C, A) => new jA({
17677
+ XA.create = (C, A) => new XA({
17667
17678
  innerType: C,
17668
17679
  typeName: x.ZodOptional,
17669
17680
  ...b(A)
17670
17681
  });
17671
17682
  class FI extends Z {
17672
17683
  _parse(A) {
17673
- return this._getType(A) === f.null ? JA(null) : this._def.innerType._parse(A);
17684
+ return this._getType(A) === f.null ? lA(null) : this._def.innerType._parse(A);
17674
17685
  }
17675
17686
  unwrap() {
17676
17687
  return this._def.innerType;
@@ -17749,7 +17760,7 @@ class sQ extends Z {
17749
17760
  if (this._getType(A) !== f.nan) {
17750
17761
  const g = this._getOrReturnCtx(A);
17751
17762
  return Y(g, {
17752
- code: l.invalid_type,
17763
+ code: d.invalid_type,
17753
17764
  expected: f.nan,
17754
17765
  received: g.parsedType
17755
17766
  }), m;
@@ -17833,14 +17844,14 @@ var x;
17833
17844
  C.ZodString = "ZodString", C.ZodNumber = "ZodNumber", C.ZodNaN = "ZodNaN", C.ZodBigInt = "ZodBigInt", C.ZodBoolean = "ZodBoolean", C.ZodDate = "ZodDate", C.ZodSymbol = "ZodSymbol", C.ZodUndefined = "ZodUndefined", C.ZodNull = "ZodNull", C.ZodAny = "ZodAny", C.ZodUnknown = "ZodUnknown", C.ZodNever = "ZodNever", C.ZodVoid = "ZodVoid", C.ZodArray = "ZodArray", C.ZodObject = "ZodObject", C.ZodUnion = "ZodUnion", C.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", C.ZodIntersection = "ZodIntersection", C.ZodTuple = "ZodTuple", C.ZodRecord = "ZodRecord", C.ZodMap = "ZodMap", C.ZodSet = "ZodSet", C.ZodFunction = "ZodFunction", C.ZodLazy = "ZodLazy", C.ZodLiteral = "ZodLiteral", C.ZodEnum = "ZodEnum", C.ZodEffects = "ZodEffects", C.ZodNativeEnum = "ZodNativeEnum", C.ZodOptional = "ZodOptional", C.ZodNullable = "ZodNullable", C.ZodDefault = "ZodDefault", C.ZodCatch = "ZodCatch", C.ZodPromise = "ZodPromise", C.ZodBranded = "ZodBranded", C.ZodPipeline = "ZodPipeline", C.ZodReadonly = "ZodReadonly";
17834
17845
  })(x || (x = {}));
17835
17846
  const z = VA.create, T = cI.create, tE = eB.create, OA = nB.create;
17836
- $A.create;
17847
+ zA.create;
17837
17848
  const j = pA.create, q = aA.create;
17838
17849
  Gg.create;
17839
17850
  Fg.create;
17840
- iI.create;
17851
+ EI.create;
17841
17852
  const yA = DB.create, nI = wI.create;
17842
17853
  Sg.create;
17843
- jA.create;
17854
+ XA.create;
17844
17855
  FI.create;
17845
17856
  const Ut = q({
17846
17857
  /**The multiscale datasets for this image*/
@@ -18279,7 +18290,7 @@ function aE(C, A) {
18279
18290
  return delete I[A], I;
18280
18291
  }
18281
18292
  async function Fa(C, A) {
18282
- const I = new WI(C), g = new lA(I), B = SI(A), Q = await VI(g, B);
18293
+ const I = new WI(C), g = new UA(I), B = SI(A), Q = await VI(g, B);
18283
18294
  try {
18284
18295
  return Kt(Q.attrs);
18285
18296
  } catch {
@@ -18338,7 +18349,7 @@ function pt(C) {
18338
18349
  }
18339
18350
  }
18340
18351
  async function Sa(C, A, I) {
18341
- const g = C + "/" + A, B = new WI(g), Q = new lA(B), E = SI(I), i = await VI(Q, E);
18352
+ const g = C + "/" + A, B = new WI(g), Q = new UA(B), E = SI(I), i = await VI(Q, E);
18342
18353
  try {
18343
18354
  return pt(i.attrs);
18344
18355
  } catch {
@@ -18422,7 +18433,7 @@ class MI {
18422
18433
  getChannelCount() {
18423
18434
  return this.getDimensions().c?.lods[0].size ?? 1;
18424
18435
  }
18425
- getLoader() {
18436
+ get loader() {
18426
18437
  return this.loader_;
18427
18438
  }
18428
18439
  /**
@@ -18432,7 +18443,7 @@ class MI {
18432
18443
  * @param props.version OME-Zarr version
18433
18444
  */
18434
18445
  static async fromHttp(A) {
18435
- const I = new lA(new WI(A.url)), g = await MI.openLoader(I, A.version);
18446
+ const I = new UA(new WI(A.url)), g = await MI.openLoader(I, A.version);
18436
18447
  return new MI({ location: I, version: A.version, loader: g });
18437
18448
  }
18438
18449
  /**
@@ -18445,7 +18456,7 @@ class MI {
18445
18456
  * ask the user once for permission to the root directory
18446
18457
  */
18447
18458
  static async fromFileSystem(A) {
18448
- const I = new lA(
18459
+ const I = new UA(
18449
18460
  new _B(A.directory),
18450
18461
  A.path
18451
18462
  ), g = await MI.openLoader(I, A.version);
@@ -18604,9 +18615,9 @@ class Tt extends NI {
18604
18615
  const Wt = P(0, 1, 0);
18605
18616
  class vt {
18606
18617
  dirty_ = !0;
18607
- matrix_ = FA();
18618
+ matrix_ = SA();
18608
18619
  rotation_ = IB();
18609
- translation_ = EA();
18620
+ translation_ = QA();
18610
18621
  scale_ = P(1, 1, 1);
18611
18622
  addRotation(A) {
18612
18623
  Bi(this.rotation_, this.rotation_, A), this.dirty_ = !0;
@@ -18634,7 +18645,7 @@ class vt {
18634
18645
  }
18635
18646
  targetTo(A) {
18636
18647
  NB(this.translation_, A) && (A = bA(A), A[2] += AA);
18637
- const I = ZE(FA(), this.translation_, A, Wt), g = qE(GQ(), I);
18648
+ const I = ZE(SA(), this.translation_, A, Wt), g = qE(GQ(), I);
18638
18649
  SQ(this.rotation_, g), RB(this.rotation_, this.rotation_), this.dirty_ = !0;
18639
18650
  }
18640
18651
  get scale() {
@@ -18644,7 +18655,7 @@ class vt {
18644
18655
  return this.dirty_ && (this.computeMatrix(), this.dirty_ = !1), this.matrix_;
18645
18656
  }
18646
18657
  get inverse() {
18647
- return kg(FA(), this.matrix);
18658
+ return kg(SA(), this.matrix);
18648
18659
  }
18649
18660
  computeMatrix() {
18650
18661
  xE(
@@ -18816,14 +18827,14 @@ class nE extends NI {
18816
18827
  for (let D = 0; D < t; ++D) {
18817
18828
  const F = D * n;
18818
18829
  for (let U = 0; U < s; ++U) {
18819
- const S = U * a, d = U / i, K = D / o, k = [S, F, 0], R = [0, 0, 1], L = [d, K];
18830
+ const S = U * a, l = U / i, u = D / o, k = [S, F, 0], R = [0, 0, 1], L = [l, u];
18820
18831
  Q.push(...k, ...R, ...L);
18821
18832
  }
18822
18833
  }
18823
18834
  for (let D = 0; D < o; ++D)
18824
18835
  for (let F = 0; F < i; ++F) {
18825
- const U = F + s * D, S = F + s * (D + 1), d = F + 1 + s * (D + 1), K = F + 1 + s * D;
18826
- E.push(U, S, K), E.push(S, d, K);
18836
+ const U = F + s * D, S = F + s * (D + 1), l = F + 1 + s * (D + 1), u = F + 1 + s * D;
18837
+ E.push(U, S, u), E.push(S, l, u);
18827
18838
  }
18828
18839
  this.vertexData_ = new Float32Array(Q), this.indexData_ = new Uint32Array(E), this.addAttribute({
18829
18840
  type: "position",
@@ -18979,14 +18990,18 @@ class DE extends Jg {
18979
18990
  this.releaseAndRemoveChunks(this.visibleChunks_.keys()), this.clearObjects(), this.chunkStoreView_?.dispose(), this.chunkStoreView_ = void 0;
18980
18991
  }
18981
18992
  update(A) {
18982
- if (!(!A || !this.chunkStoreView_)) {
18983
- this.chunkStoreView_.updateChunksForImage(
18984
- this.sliceCoords_,
18985
- A.viewport
18986
- ), this.updateChunks();
18987
- for (const [I, g] of this.visibleChunks_)
18988
- g.zTexCoord = this.zTexCoordForChunk(I);
18989
- }
18993
+ if (!A || !this.chunkStoreView_) return;
18994
+ const I = A.camera;
18995
+ if (I.type !== "OrthographicCamera")
18996
+ throw new Error(
18997
+ "Image rendering currently supports only orthographic cameras. Update the implementation before using a perspective camera."
18998
+ );
18999
+ this.chunkStoreView_.updateChunksForImage(this.sliceCoords_, {
19000
+ worldViewRect: I.getWorldViewRect(),
19001
+ bufferWidthPx: A.getBufferRect().width
19002
+ }), this.updateChunks();
19003
+ for (const [g, B] of this.visibleChunks_)
19004
+ B.zTexCoord = this.zTexCoordForChunk(g);
18990
19005
  }
18991
19006
  updateChunks() {
18992
19007
  if (!this.chunkStoreView_ || (this.state !== "ready" && this.setState("ready"), this.visibleChunks_.size > 0 && !this.chunkStoreView_.allVisibleFallbackLODLoaded() && !this.isPresentationStale()))
@@ -19080,7 +19095,7 @@ class DE extends Jg {
19080
19095
  }
19081
19096
  async readValueFromChunk(A, I, g) {
19082
19097
  const B = SB(
19083
- EA(),
19098
+ QA(),
19084
19099
  g,
19085
19100
  I.transform.inverse
19086
19101
  ), Q = Math.floor(B[0]), E = Math.floor(B[1]);
@@ -19152,31 +19167,31 @@ class _t extends NI {
19152
19167
  });
19153
19168
  }
19154
19169
  buildFace(A, I, g, B, Q, E, i, o, s, t, a, n, D) {
19155
- const F = E / s, U = i / t, S = E / 2, d = i / 2, K = o / 2 * a, k = s + 1, R = t + 1, L = n.length / 8;
19170
+ const F = E / s, U = i / t, S = E / 2, l = i / 2, u = o / 2 * a, k = s + 1, R = t + 1, L = n.length / 8;
19156
19171
  for (let M = 0; M < R; M++) {
19157
- const W = -d + M * U;
19158
- for (let IA = 0; IA < k; IA++) {
19159
- const CA = -S + IA * F, $ = { x: 0, y: 0, z: 0 };
19160
- $[A] = CA * B, $[I] = W * Q, $[g] = K;
19161
- const gA = { x: 0, y: 0, z: 0 };
19162
- gA[g] = a;
19163
- const SA = IA / s, NA = 1 - M / t;
19172
+ const W = -l + M * U;
19173
+ for (let $ = 0; $ < k; $++) {
19174
+ const BA = -S + $ * F, IA = { x: 0, y: 0, z: 0 };
19175
+ IA[A] = BA * B, IA[I] = W * Q, IA[g] = u;
19176
+ const iA = { x: 0, y: 0, z: 0 };
19177
+ iA[g] = a;
19178
+ const fA = $ / s, uA = 1 - M / t;
19164
19179
  n.push(
19165
- $.x,
19166
- $.y,
19167
- $.z,
19168
- gA.x,
19169
- gA.y,
19170
- gA.z,
19171
- SA,
19172
- NA
19180
+ IA.x,
19181
+ IA.y,
19182
+ IA.z,
19183
+ iA.x,
19184
+ iA.y,
19185
+ iA.z,
19186
+ fA,
19187
+ uA
19173
19188
  );
19174
19189
  }
19175
19190
  }
19176
19191
  for (let M = 0; M < t; M++)
19177
19192
  for (let W = 0; W < s; W++) {
19178
- const IA = L + W + k * M, CA = L + W + k * (M + 1), $ = L + (W + 1) + k * (M + 1), gA = L + (W + 1) + k * M;
19179
- D.push(IA, CA, gA, CA, $, gA);
19193
+ const $ = L + W + k * M, BA = L + W + k * (M + 1), IA = L + (W + 1) + k * (M + 1), iA = L + (W + 1) + k * M;
19194
+ D.push($, BA, iA, BA, IA, iA);
19180
19195
  }
19181
19196
  }
19182
19197
  }
@@ -19302,7 +19317,7 @@ function jt(C) {
19302
19317
  }
19303
19318
  }
19304
19319
  function zt(C, A) {
19305
- const I = A.position, g = EA(), B = EA();
19320
+ const I = A.position, g = QA(), B = QA();
19306
19321
  return C.sort((Q, E) => {
19307
19322
  HI(g, Q.boundingBox.max, Q.boundingBox.min), qI(g, g, 0.5), HI(B, E.boundingBox.max, E.boundingBox.min), qI(B, B, 0.5);
19308
19323
  const i = sC(I, g), o = sC(I, B);
@@ -19418,7 +19433,7 @@ class Ua extends Jg {
19418
19433
  y: I.shape.y * I.scale.y,
19419
19434
  z: I.shape.z * I.scale.z
19420
19435
  };
19421
- A.transform.setScale([g.x, g.y, g.z]), II(A.voxelScale, I.scale.x, I.scale.y, I.scale.z);
19436
+ A.transform.setScale([g.x, g.y, g.z]), AI(A.voxelScale, I.scale.x, I.scale.y, I.scale.z);
19422
19437
  const B = {
19423
19438
  x: I.shape.x * I.scale.x / 2,
19424
19439
  y: I.shape.y * I.scale.y / 2,
@@ -19434,17 +19449,13 @@ class Ua extends Jg {
19434
19449
  A.clearLoadedChannels(), this.pool_.release(this.volumeToPoolKey_.get(A), A), this.volumeToPoolKey_.delete(A);
19435
19450
  }
19436
19451
  update(A) {
19437
- if (!this.chunkStoreView_) return;
19438
- if (A === void 0)
19439
- throw new Error(
19440
- "RenderContext is required for the VolumeLayer update as camera information is used to reorder the chunks."
19441
- );
19452
+ if (!A || !this.chunkStoreView_) return;
19442
19453
  this.chunkStoreView_.updateChunksForVolume(
19443
19454
  this.sliceCoords_,
19444
- A.viewport
19455
+ A.camera.getViewProjection()
19445
19456
  );
19446
- const I = A.viewport.cameraControls?.isMoving ?? !1;
19447
- this.interactiveStepSizeScale_ = I ? $t : 1, this.updateChunks(), zt(this.objects, A.viewport.camera);
19457
+ const I = A.cameraControls?.isMoving ?? !1;
19458
+ this.interactiveStepSizeScale_ = I ? $t : 1, this.updateChunks(), zt(this.objects, A.camera);
19448
19459
  }
19449
19460
  getUniforms() {
19450
19461
  return {
@@ -19647,14 +19658,18 @@ class hE extends Jg {
19647
19658
  this.releaseAndRemoveChunks(this.visibleChunks_.keys()), this.clearObjects(), this.chunkStoreView_?.dispose(), this.chunkStoreView_ = void 0;
19648
19659
  }
19649
19660
  update(A) {
19650
- if (!(!A || !this.chunkStoreView_)) {
19651
- this.chunkStoreView_.updateChunksForImage(
19652
- this.sliceCoords_,
19653
- A.viewport
19654
- ), this.updateChunks();
19655
- for (const [I, g] of this.visibleChunks_)
19656
- g.zTexCoord = this.zTexCoordForChunk(I);
19657
- }
19661
+ if (!A || !this.chunkStoreView_) return;
19662
+ const I = A.camera;
19663
+ if (I.type !== "OrthographicCamera")
19664
+ throw new Error(
19665
+ "Label rendering currently supports only orthographic cameras. Update the implementation before using a perspective camera."
19666
+ );
19667
+ this.chunkStoreView_.updateChunksForImage(this.sliceCoords_, {
19668
+ worldViewRect: I.getWorldViewRect(),
19669
+ bufferWidthPx: A.getBufferRect().width
19670
+ }), this.updateChunks();
19671
+ for (const [g, B] of this.visibleChunks_)
19672
+ B.zTexCoord = this.zTexCoordForChunk(g);
19658
19673
  }
19659
19674
  updateChunks() {
19660
19675
  if (!this.chunkStoreView_ || (this.state !== "ready" && this.setState("ready"), this.visibleChunks_.size > 0 && !this.chunkStoreView_.allVisibleFallbackLODLoaded() && !this.isPresentationStale()))
@@ -19730,7 +19745,7 @@ class hE extends Jg {
19730
19745
  }
19731
19746
  async readValueFromChunk(A, I, g) {
19732
19747
  const B = SB(
19733
- EA(),
19748
+ QA(),
19734
19749
  g,
19735
19750
  I.transform.inverse
19736
19751
  ), Q = Math.floor(B[0]), E = Math.floor(B[1]);
@@ -19917,9 +19932,9 @@ const jg = -1, nQ = 0, aa = 1, rQ = 9e-3, ea = 1e-3, na = 9e-4, ra = 0.5, Da = 6
19917
19932
  class la {
19918
19933
  camera_;
19919
19934
  orbitVelocity_ = new eQ(0, 0, 0);
19920
- panVelocity_ = EA();
19935
+ panVelocity_ = QA();
19921
19936
  currPos_;
19922
- currCenter_ = EA();
19937
+ currCenter_ = QA();
19923
19938
  dampingFactor_;
19924
19939
  currMouseButton_ = jg;
19925
19940
  constructor(A, I) {
@@ -19986,21 +20001,21 @@ class la {
19986
20001
  this.orbitVelocity_.phi -= A * rQ, this.orbitVelocity_.theta += I * rQ;
19987
20002
  }
19988
20003
  pan(A, I) {
19989
- const g = this.currPos_.radius * ea, B = EA();
20004
+ const g = this.currPos_.radius * ea, B = QA();
19990
20005
  oC(B, B, this.camera_.right, A), oC(B, B, this.camera_.up, I), qI(B, B, g), AB(this.panVelocity_, this.panVelocity_, B);
19991
20006
  }
19992
20007
  zoom(A) {
19993
20008
  this.orbitVelocity_.radius += A * na;
19994
20009
  }
19995
20010
  updateCamera() {
19996
- const A = HI(EA(), this.currCenter_, this.currPos_.toVec3());
20011
+ const A = HI(QA(), this.currCenter_, this.currPos_.toVec3());
19997
20012
  this.camera_.transform.setTranslation(A), this.camera_.transform.targetTo(this.currCenter_);
19998
20013
  }
19999
20014
  cutoffLowVelocity() {
20000
20015
  Math.abs(this.orbitVelocity_.phi) < AA && (this.orbitVelocity_.phi = 0), Math.abs(this.orbitVelocity_.theta) < AA && (this.orbitVelocity_.theta = 0), Math.abs(this.orbitVelocity_.radius) < AA && (this.orbitVelocity_.radius = 0), FB(this.panVelocity_) < AA && XE(this.panVelocity_);
20001
20016
  }
20002
20017
  }
20003
- class tI {
20018
+ class sI {
20004
20019
  normal;
20005
20020
  signedDistance;
20006
20021
  constructor(A = P(0, 1, 0), I = 0) {
@@ -20024,41 +20039,41 @@ class ha {
20024
20039
  planes_;
20025
20040
  constructor(A) {
20026
20041
  this.planes_ = [
20027
- new tI(EA(), 0),
20028
- new tI(EA(), 0),
20029
- new tI(EA(), 0),
20030
- new tI(EA(), 0),
20031
- new tI(EA(), 0),
20032
- new tI(EA(), 0)
20042
+ new sI(QA(), 0),
20043
+ new sI(QA(), 0),
20044
+ new sI(QA(), 0),
20045
+ new sI(QA(), 0),
20046
+ new sI(QA(), 0),
20047
+ new sI(QA(), 0)
20033
20048
  ], this.setWithViewProjection(A);
20034
20049
  }
20035
20050
  // Uses the fast plane-extraction algorithm described in
20036
20051
  // Gribb & Hartmann (1997): https://tinyurl.com/5x5htcwm
20037
20052
  setWithViewProjection(A) {
20038
- const I = EA();
20053
+ const I = QA();
20039
20054
  this.planes_[0].set(
20040
- II(I, A[3] + A[0], A[7] + A[4], A[11] + A[8]),
20055
+ AI(I, A[3] + A[0], A[7] + A[4], A[11] + A[8]),
20041
20056
  A[15] + A[12]
20042
20057
  ), this.planes_[1].set(
20043
- II(I, A[3] - A[0], A[7] - A[4], A[11] - A[8]),
20058
+ AI(I, A[3] - A[0], A[7] - A[4], A[11] - A[8]),
20044
20059
  A[15] - A[12]
20045
20060
  ), this.planes_[2].set(
20046
- II(I, A[3] - A[1], A[7] - A[5], A[11] - A[9]),
20061
+ AI(I, A[3] - A[1], A[7] - A[5], A[11] - A[9]),
20047
20062
  A[15] - A[13]
20048
20063
  ), this.planes_[3].set(
20049
- II(I, A[3] + A[1], A[7] + A[5], A[11] + A[9]),
20064
+ AI(I, A[3] + A[1], A[7] + A[5], A[11] + A[9]),
20050
20065
  A[15] + A[13]
20051
20066
  ), this.planes_[4].set(
20052
- II(I, A[3] + A[2], A[7] + A[6], A[11] + A[10]),
20067
+ AI(I, A[3] + A[2], A[7] + A[6], A[11] + A[10]),
20053
20068
  A[15] + A[14]
20054
20069
  ), this.planes_[5].set(
20055
- II(I, A[3] - A[2], A[7] - A[6], A[11] - A[10]),
20070
+ AI(I, A[3] - A[2], A[7] - A[6], A[11] - A[10]),
20056
20071
  A[15] - A[14]
20057
20072
  );
20058
20073
  for (const g of this.planes_) g.normalize();
20059
20074
  }
20060
20075
  intersectsWithBox3(A) {
20061
- const I = EA();
20076
+ const I = QA();
20062
20077
  for (const g of this.planes_) {
20063
20078
  const B = g.normal;
20064
20079
  if (I[0] = B[0] > 0 ? A.max[0] : A.min[0], I[1] = B[1] > 0 ? A.max[1] : A.min[1], I[2] = B[2] > 0 ? A.max[2] : A.min[2], g.signedDistanceToPoint(I) < 0) return !1;
@@ -20067,7 +20082,7 @@ class ha {
20067
20082
  }
20068
20083
  }
20069
20084
  class cE extends dI {
20070
- projectionMatrix_ = FA();
20085
+ projectionMatrix_ = SA();
20071
20086
  near_ = 0;
20072
20087
  far_ = 0;
20073
20088
  update() {
@@ -20087,10 +20102,11 @@ class cE extends dI {
20087
20102
  const A = this.transform.matrix;
20088
20103
  return P(A[4], A[5], A[6]);
20089
20104
  }
20105
+ getViewProjection() {
20106
+ return eI(SA(), this.projectionMatrix, this.viewMatrix);
20107
+ }
20090
20108
  get frustum() {
20091
- return new ha(
20092
- _A(FA(), this.projectionMatrix, this.viewMatrix)
20093
- );
20109
+ return new ha(this.getViewProjection());
20094
20110
  }
20095
20111
  pan(A) {
20096
20112
  this.transform.addTranslation(A);
@@ -20100,7 +20116,7 @@ class cE extends dI {
20100
20116
  }
20101
20117
  clipToWorld(A) {
20102
20118
  const I = Bg(A[0], A[1], A[2], 1), g = kg(
20103
- FA(),
20119
+ SA(),
20104
20120
  this.projectionMatrix_
20105
20121
  ), B = pI(
20106
20122
  rI(),
@@ -20148,12 +20164,8 @@ class La extends cE {
20148
20164
  }
20149
20165
  getWorldViewRect() {
20150
20166
  let A = Bg(-1, -1, 0, 1), I = Bg(1, 1, 0, 1);
20151
- const g = _A(
20152
- FA(),
20153
- this.projectionMatrix,
20154
- this.viewMatrix
20155
- ), B = kg(FA(), g);
20156
- return A = pI(rI(), A, B), I = pI(rI(), I, B), new GA(
20167
+ const g = kg(SA(), this.getViewProjection());
20168
+ return A = pI(rI(), A, g), I = pI(rI(), I, g), new GA(
20157
20169
  eA(A[0], A[1]),
20158
20170
  eA(I[0], I[1])
20159
20171
  );
@@ -20176,7 +20188,7 @@ const yQ = 0;
20176
20188
  class Ja {
20177
20189
  camera_;
20178
20190
  dragActive_ = !1;
20179
- dragStart_ = EA();
20191
+ dragStart_ = QA();
20180
20192
  constructor(A) {
20181
20193
  this.camera_ = A;
20182
20194
  }
@@ -20208,7 +20220,7 @@ class Ja {
20208
20220
  I.preventDefault();
20209
20221
  const g = bA(A.worldPos), B = I.deltaY < 0 ? 1.05 : 0.95;
20210
20222
  this.camera_.zoom(B);
20211
- const Q = this.camera_.clipToWorld(A.clipPos), E = AB(EA(), g, Q);
20223
+ const Q = this.camera_.clipToWorld(A.clipPos), E = AB(QA(), g, Q);
20212
20224
  this.camera_.pan(E);
20213
20225
  }
20214
20226
  onPointerDown(A) {
@@ -20217,7 +20229,7 @@ class Ja {
20217
20229
  }
20218
20230
  onPointerMove(A) {
20219
20231
  if (!this.dragActive_ || !A.worldPos) return;
20220
- const I = AB(EA(), this.dragStart_, A.worldPos);
20232
+ const I = AB(QA(), this.dragStart_, A.worldPos);
20221
20233
  this.camera_.pan(I);
20222
20234
  }
20223
20235
  onPointerEnd(A) {