@idetik/core 0.7.7 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -347,11 +347,12 @@ vec3 boundingboxMin = vec3(-0.50);
347
347
  vec3 boundingboxMax = vec3(0.50);
348
348
 
349
349
  uniform bool DebugShowDegenerateRays;
350
- uniform float SamplesPerUnit;
351
350
  uniform float MaxIntensity;
352
351
  uniform float OpacityMultiplier;
353
352
  uniform float EarlyTerminationAlpha;
354
353
  uniform vec3 VolumeColor;
354
+ uniform float RelativeStepSize;
355
+ uniform vec3 VoxelScale;
355
356
 
356
357
  vec2 findBoxIntersectionsAlongRay(vec3 rayOrigin, vec3 rayDir, vec3 boxMin, vec3 boxMax) {
357
358
  vec3 reciprocalRayDir = 1.0 / rayDir;
@@ -390,19 +391,35 @@ void main() {
390
391
  exitPoint = clamp(exitPoint + 0.5, 0.0, 1.0);
391
392
 
392
393
 
394
+
395
+
396
+
393
397
  vec3 rayWithinModel = exitPoint - entryPoint;
394
- float rayLength = length(rayWithinModel);
395
- int numSamples = max(int(ceil(rayLength * SamplesPerUnit)), 1);
398
+
399
+
400
+ vec3 textureSize = vec3(textureSize(ImageSampler, 0));
401
+ vec3 rayInVoxels = rayWithinModel * textureSize;
402
+ float rayLengthInVoxels = length(rayInVoxels);
403
+ int numSamples = max(int(ceil(rayLengthInVoxels / RelativeStepSize)), 1);
396
404
  vec3 stepIncrement = rayWithinModel / float(numSamples);
397
405
 
398
406
 
407
+
408
+
409
+
410
+ vec3 stepInWorldSpace = stepIncrement * textureSize * VoxelScale;
411
+ float worldSpaceStepSize = length(stepInWorldSpace);
412
+
413
+
399
414
  vec3 position = entryPoint;
400
415
  vec4 accumulatedColor = vec4(0.0);
401
416
  float sampledData, sampleAlpha, blendedSampleAlpha;
402
417
 
403
418
 
404
419
 
405
- float intensityScale = (1.0 / MaxIntensity) * OpacityMultiplier;
420
+
421
+
422
+ float intensityScale = (OpacityMultiplier / MaxIntensity) * worldSpaceStepSize;
406
423
 
407
424
 
408
425
  for (int i = 0; i < numSamples && accumulatedColor.a < EarlyTerminationAlpha; i++) {
@@ -592,25 +609,25 @@ function sC() {
592
609
  }
593
610
  return "development";
594
611
  }
595
- class c {
612
+ class U {
596
613
  static logLevel_ = sC() === "production" ? "warn" : "debug";
597
614
  static setLogLevel(A) {
598
- c.logLevel_ = A;
615
+ U.logLevel_ = A;
599
616
  }
600
617
  static debug(A, I, ...B) {
601
- c.log("debug", A, I, ...B);
618
+ U.log("debug", A, I, ...B);
602
619
  }
603
620
  static info(A, I, ...B) {
604
- c.log("info", A, I, ...B);
621
+ U.log("info", A, I, ...B);
605
622
  }
606
623
  static warn(A, I, ...B) {
607
- c.log("warn", A, I, ...B);
624
+ U.log("warn", A, I, ...B);
608
625
  }
609
626
  static error(A, I, ...B) {
610
- c.log("error", A, I, ...B);
627
+ U.log("error", A, I, ...B);
611
628
  }
612
629
  static log(A, I, B, ...C) {
613
- if (pg[A] < pg[c.logLevel_]) return;
630
+ if (pg[A] < pg[U.logLevel_]) return;
614
631
  const Q = (/* @__PURE__ */ new Date()).toISOString(), E = DC[A], i = `[${Q}][${A.toUpperCase()}][${I}]`, o = [`${E}${i}`, B, ...C];
615
632
  switch (A) {
616
633
  case "debug":
@@ -712,7 +729,7 @@ class hC {
712
729
  `Unsupported uniform type "${B.type}" (GLenum) found in shader program for uniform "${B.name}"`
713
730
  );
714
731
  const C = this.gl_.getUniformLocation(this.program_, B.name);
715
- C && (this.uniformInfo_.set(B.name, [C, B]), c.debug(
732
+ C && (this.uniformInfo_.set(B.name, [C, B]), U.debug(
716
733
  "WebGLShaderProgram",
717
734
  "Uniform found:",
718
735
  B.name,
@@ -1102,19 +1119,19 @@ function AA() {
1102
1119
  return W != Float32Array && (g[1] = 0, g[2] = 0, g[3] = 0, g[4] = 0, g[6] = 0, g[7] = 0, g[8] = 0, g[9] = 0, g[11] = 0, g[12] = 0, g[13] = 0, g[14] = 0), g[0] = 1, g[5] = 1, g[10] = 1, g[15] = 1, g;
1103
1120
  }
1104
1121
  function qI(g, A) {
1105
- var I = A[0], B = A[1], C = A[2], Q = A[3], E = A[4], i = A[5], o = A[6], a = A[7], D = A[8], h = A[9], t = A[10], y = A[11], w = A[12], F = A[13], S = A[14], G = A[15], U = I * i - B * E, N = I * o - C * E, d = I * a - Q * E, Y = B * o - C * i, J = B * a - Q * i, x = C * a - Q * o, v = D * F - h * w, X = D * S - t * w, O = D * G - y * w, j = h * S - t * F, nA = h * G - y * F, FA = t * G - y * S, m = U * FA - N * nA + d * j + Y * O - J * X + x * v;
1106
- return m ? (m = 1 / m, g[0] = (i * FA - o * nA + a * j) * m, g[1] = (C * nA - B * FA - Q * j) * m, g[2] = (F * x - S * J + G * Y) * m, g[3] = (t * J - h * x - y * Y) * m, g[4] = (o * O - E * FA - a * X) * m, g[5] = (I * FA - C * O + Q * X) * m, g[6] = (S * d - w * x - G * N) * m, g[7] = (D * x - t * d + y * N) * m, g[8] = (E * nA - i * O + a * v) * m, g[9] = (B * O - I * nA - Q * v) * m, g[10] = (w * J - F * d + G * U) * m, g[11] = (h * d - D * J - y * U) * m, g[12] = (i * X - E * j - o * v) * m, g[13] = (I * j - B * X + C * v) * m, g[14] = (F * N - w * Y - S * U) * m, g[15] = (D * Y - h * N + t * U) * m, g) : null;
1122
+ var I = A[0], B = A[1], C = A[2], Q = A[3], E = A[4], i = A[5], o = A[6], a = A[7], D = A[8], h = A[9], t = A[10], y = A[11], w = A[12], n = A[13], S = A[14], G = A[15], c = I * i - B * E, N = I * o - C * E, d = I * a - Q * E, Y = B * o - C * i, J = B * a - Q * i, x = C * a - Q * o, v = D * n - h * w, X = D * S - t * w, O = D * G - y * w, j = h * S - t * n, nA = h * G - y * n, FA = t * G - y * S, m = c * FA - N * nA + d * j + Y * O - J * X + x * v;
1123
+ return m ? (m = 1 / m, g[0] = (i * FA - o * nA + a * j) * m, g[1] = (C * nA - B * FA - Q * j) * m, g[2] = (n * x - S * J + G * Y) * m, g[3] = (t * J - h * x - y * Y) * m, g[4] = (o * O - E * FA - a * X) * m, g[5] = (I * FA - C * O + Q * X) * m, g[6] = (S * d - w * x - G * N) * m, g[7] = (D * x - t * d + y * N) * m, g[8] = (E * nA - i * O + a * v) * m, g[9] = (B * O - I * nA - Q * v) * m, g[10] = (w * J - n * d + G * c) * m, g[11] = (h * d - D * J - y * c) * m, g[12] = (i * X - E * j - o * v) * m, g[13] = (I * j - B * X + C * v) * m, g[14] = (n * N - w * Y - S * c) * m, g[15] = (D * Y - h * N + t * c) * m, g) : null;
1107
1124
  }
1108
1125
  function FI(g, A, I) {
1109
- var B = A[0], C = A[1], Q = A[2], E = A[3], i = A[4], o = A[5], a = A[6], D = A[7], h = A[8], t = A[9], y = A[10], w = A[11], F = A[12], S = A[13], G = A[14], U = A[15], N = I[0], d = I[1], Y = I[2], J = I[3];
1110
- return g[0] = N * B + d * i + Y * h + J * F, g[1] = N * C + d * o + Y * t + J * S, g[2] = N * Q + d * a + Y * y + J * G, g[3] = N * E + d * D + Y * w + J * U, N = I[4], d = I[5], Y = I[6], J = I[7], g[4] = N * B + d * i + Y * h + J * F, g[5] = N * C + d * o + Y * t + J * S, g[6] = N * Q + d * a + Y * y + J * G, g[7] = N * E + d * D + Y * w + J * U, N = I[8], d = I[9], Y = I[10], J = I[11], g[8] = N * B + d * i + Y * h + J * F, g[9] = N * C + d * o + Y * t + J * S, g[10] = N * Q + d * a + Y * y + J * G, g[11] = N * E + d * D + Y * w + J * U, N = I[12], d = I[13], Y = I[14], J = I[15], g[12] = N * B + d * i + Y * h + J * F, g[13] = N * C + d * o + Y * t + J * S, g[14] = N * Q + d * a + Y * y + J * G, g[15] = N * E + d * D + Y * w + J * U, g;
1126
+ var B = A[0], C = A[1], Q = A[2], E = A[3], i = A[4], o = A[5], a = A[6], D = A[7], h = A[8], t = A[9], y = A[10], w = A[11], n = A[12], S = A[13], G = A[14], c = A[15], N = I[0], d = I[1], Y = I[2], J = I[3];
1127
+ return g[0] = N * B + d * i + Y * h + J * n, g[1] = N * C + d * o + Y * t + J * S, g[2] = N * Q + d * a + Y * y + J * G, g[3] = N * E + d * D + Y * w + J * c, N = I[4], d = I[5], Y = I[6], J = I[7], g[4] = N * B + d * i + Y * h + J * n, g[5] = N * C + d * o + Y * t + J * S, g[6] = N * Q + d * a + Y * y + J * G, g[7] = N * E + d * D + Y * w + J * c, N = I[8], d = I[9], Y = I[10], J = I[11], g[8] = N * B + d * i + Y * h + J * n, g[9] = N * C + d * o + Y * t + J * S, g[10] = N * Q + d * a + Y * y + J * G, g[11] = N * E + d * D + Y * w + J * c, N = I[12], d = I[13], Y = I[14], J = I[15], g[12] = N * B + d * i + Y * h + J * n, g[13] = N * C + d * o + Y * t + J * S, g[14] = N * Q + d * a + Y * y + J * G, g[15] = N * E + d * D + Y * w + J * c, g;
1111
1128
  }
1112
1129
  function FC(g, A) {
1113
1130
  return g[0] = A[0], g[1] = 0, g[2] = 0, g[3] = 0, g[4] = 0, g[5] = A[1], g[6] = 0, g[7] = 0, g[8] = 0, g[9] = 0, g[10] = A[2], g[11] = 0, g[12] = 0, g[13] = 0, g[14] = 0, g[15] = 1, g;
1114
1131
  }
1115
1132
  function rC(g, A, I, B) {
1116
- var C = A[0], Q = A[1], E = A[2], i = A[3], o = C + C, a = Q + Q, D = E + E, h = C * o, t = C * a, y = C * D, w = Q * a, F = Q * D, S = E * D, G = i * o, U = i * a, N = i * D, d = B[0], Y = B[1], J = B[2];
1117
- return g[0] = (1 - (w + S)) * d, g[1] = (t + N) * d, g[2] = (y - U) * d, g[3] = 0, g[4] = (t - N) * Y, g[5] = (1 - (h + S)) * Y, g[6] = (F + G) * Y, g[7] = 0, g[8] = (y + U) * J, g[9] = (F - G) * J, g[10] = (1 - (h + w)) * J, g[11] = 0, g[12] = I[0], g[13] = I[1], g[14] = I[2], g[15] = 1, g;
1133
+ var C = A[0], Q = A[1], E = A[2], i = A[3], o = C + C, a = Q + Q, D = E + E, h = C * o, t = C * a, y = C * D, w = Q * a, n = Q * D, S = E * D, G = i * o, c = i * a, N = i * D, d = B[0], Y = B[1], J = B[2];
1134
+ return g[0] = (1 - (w + S)) * d, g[1] = (t + N) * d, g[2] = (y - c) * d, g[3] = 0, g[4] = (t - N) * Y, g[5] = (1 - (h + S)) * Y, g[6] = (n + G) * Y, g[7] = 0, g[8] = (y + c) * J, g[9] = (n - G) * J, g[10] = (1 - (h + w)) * J, g[11] = 0, g[12] = I[0], g[13] = I[1], g[14] = I[2], g[15] = 1, g;
1118
1135
  }
1119
1136
  function SC(g, A, I, B, C) {
1120
1137
  var Q = 1 / Math.tan(A / 2), E;
@@ -1129,8 +1146,8 @@ var cC = NC;
1129
1146
  function UC(g, A, I, B) {
1130
1147
  var C = A[0], Q = A[1], E = A[2], i = B[0], o = B[1], a = B[2], D = C - I[0], h = Q - I[1], t = E - I[2], y = D * D + h * h + t * t;
1131
1148
  y > 0 && (y = 1 / Math.sqrt(y), D *= y, h *= y, t *= y);
1132
- var w = o * t - a * h, F = a * D - i * t, S = i * h - o * D;
1133
- return y = w * w + F * F + S * S, y > 0 && (y = 1 / Math.sqrt(y), w *= y, F *= y, S *= y), g[0] = w, g[1] = F, g[2] = S, g[3] = 0, g[4] = h * S - t * F, g[5] = t * w - D * S, g[6] = D * F - h * w, g[7] = 0, g[8] = D, g[9] = h, g[10] = t, g[11] = 0, g[12] = C, g[13] = Q, g[14] = E, g[15] = 1, g;
1149
+ var w = o * t - a * h, n = a * D - i * t, S = i * h - o * D;
1150
+ return y = w * w + n * n + S * S, y > 0 && (y = 1 / Math.sqrt(y), w *= y, n *= y, S *= y), g[0] = w, g[1] = n, g[2] = S, g[3] = 0, g[4] = h * S - t * n, g[5] = t * w - D * S, g[6] = D * n - h * w, g[7] = 0, g[8] = D, g[9] = h, g[10] = t, g[11] = 0, g[12] = C, g[13] = Q, g[14] = E, g[15] = 1, g;
1134
1151
  }
1135
1152
  function f() {
1136
1153
  var g = new W(3);
@@ -1151,7 +1168,7 @@ function q(g, A, I) {
1151
1168
  function PA(g, A) {
1152
1169
  return g[0] = A[0], g[1] = A[1], g[2] = A[2], g;
1153
1170
  }
1154
- function JA(g, A, I, B) {
1171
+ function SA(g, A, I, B) {
1155
1172
  return g[0] = A, g[1] = I, g[2] = B, g;
1156
1173
  }
1157
1174
  function rI(g, A, I) {
@@ -1259,8 +1276,8 @@ function pC(g, A, I) {
1259
1276
  return g[0] = B * D + E * i + C * a - Q * o, g[1] = C * D + E * o + Q * i - B * a, g[2] = Q * D + E * a + B * o - C * i, g[3] = E * D - B * i - C * o - Q * a, g;
1260
1277
  }
1261
1278
  function OI(g, A, I, B) {
1262
- var C = A[0], Q = A[1], E = A[2], i = A[3], o = I[0], a = I[1], D = I[2], h = I[3], t, y, w, F, S;
1263
- return y = C * o + Q * a + E * D + i * h, y < 0 && (y = -y, o = -o, a = -a, D = -D, h = -h), 1 - y > hA ? (t = Math.acos(y), w = Math.sin(t), F = Math.sin((1 - B) * t) / w, S = Math.sin(B * t) / w) : (F = 1 - B, S = B), g[0] = F * C + S * o, g[1] = F * Q + S * a, g[2] = F * E + S * D, g[3] = F * i + S * h, g;
1279
+ var C = A[0], Q = A[1], E = A[2], i = A[3], o = I[0], a = I[1], D = I[2], h = I[3], t, y, w, n, S;
1280
+ return y = C * o + Q * a + E * D + i * h, y < 0 && (y = -y, o = -o, a = -a, D = -D, h = -h), 1 - y > hA ? (t = Math.acos(y), w = Math.sin(t), n = Math.sin((1 - B) * t) / w, S = Math.sin(B * t) / w) : (n = 1 - B, S = B), g[0] = n * C + S * o, g[1] = n * Q + S * a, g[2] = n * E + S * D, g[3] = n * i + S * h, g;
1264
1281
  }
1265
1282
  function cB(g, A) {
1266
1283
  var I = A[0] + A[4] + A[8], B;
@@ -1334,7 +1351,7 @@ function VI(g, A) {
1334
1351
  return A;
1335
1352
  };
1336
1353
  })();
1337
- class SA {
1354
+ class RA {
1338
1355
  min;
1339
1356
  max;
1340
1357
  /**
@@ -1347,7 +1364,7 @@ class SA {
1347
1364
  this.min = A ? gA(A) : q(1 / 0, 1 / 0, 1 / 0), this.max = I ? gA(I) : q(-1 / 0, -1 / 0, -1 / 0);
1348
1365
  }
1349
1366
  clone() {
1350
- return new SA(this.min, this.max);
1367
+ return new RA(this.min, this.max);
1351
1368
  }
1352
1369
  isEmpty() {
1353
1370
  return this.max[0] <= this.min[0] || this.max[1] <= this.min[1] || this.max[2] <= this.min[2];
@@ -1426,7 +1443,7 @@ class uA extends Dg {
1426
1443
  const A = this.getAttribute("position");
1427
1444
  if (!A || this.vertexCount === 0)
1428
1445
  throw new Error("Failed to generate bounding box");
1429
- const I = (A.offset ?? 0) / Float32Array.BYTES_PER_ELEMENT, B = new SA(), C = f();
1446
+ const I = (A.offset ?? 0) / Float32Array.BYTES_PER_ELEMENT, B = new RA(), C = f();
1430
1447
  for (let Q = 0; Q < this.vertexData_.length; Q += this.stride)
1431
1448
  C[0] = this.vertexData_[Q + I + 0], C[1] = this.vertexData_[Q + I + 1], C[2] = this.vertexData_[Q + I + 2], B.expandWithPoint(C);
1432
1449
  this.boundingBox_ = B;
@@ -1609,7 +1626,7 @@ class PC {
1609
1626
  getFilter(A, I) {
1610
1627
  const { dataFormat: B, dataType: C } = I;
1611
1628
  if (B === "scalar" && C !== "float" && A !== "nearest")
1612
- return c.warn(
1629
+ return U.warn(
1613
1630
  "WebGLTexture",
1614
1631
  "Integer values are not filterable. Using gl.NEAREST instead."
1615
1632
  ), this.gl_.NEAREST;
@@ -1892,7 +1909,7 @@ class vC extends IC {
1892
1909
  });
1893
1910
  if (!I)
1894
1911
  throw new Error("Failed to initialize WebGL2 context");
1895
- this.gl_ = I, c.info(
1912
+ this.gl_ = I, U.info(
1896
1913
  "WebGLRenderer",
1897
1914
  `WebGL version ${I.getParameter(I.VERSION)}`
1898
1915
  ), this.programs_ = new eC(I), this.bindings_ = new ZC(I), this.textures_ = new PC(I), this.state_ = new OC(I), this.initStencil(), this.resize(this.canvas.width, this.canvas.height);
@@ -1907,7 +1924,7 @@ class vC extends IC {
1907
1924
  else if (_.intersects(I, B))
1908
1925
  this.state_.setScissor(I), this.state_.setScissorTest(!0);
1909
1926
  else {
1910
- c.warn(
1927
+ U.warn(
1911
1928
  "WebGLRenderer",
1912
1929
  `Viewport ${A.id} is entirely outside canvas bounds, skipping render`
1913
1930
  );
@@ -1986,10 +2003,10 @@ class vC extends IC {
1986
2003
  C.setUniform(w, B.opacity);
1987
2004
  break;
1988
2005
  case "CameraPositionModel": {
1989
- const F = qI(AA(), E), S = RI(0, 0, 0, 1), G = VA(
2006
+ const n = qI(AA(), E), S = RI(0, 0, 0, 1), G = VA(
1990
2007
  HA(),
1991
2008
  S,
1992
- F
2009
+ n
1993
2010
  );
1994
2011
  C.setUniform(
1995
2012
  w,
@@ -2049,11 +2066,11 @@ class jC {
2049
2066
  cancel(A) {
2050
2067
  const I = this.pending_.findIndex((C) => C.chunk === A);
2051
2068
  if (I >= 0) {
2052
- this.pending_.splice(I, 1), c.debug("ChunkQueue", "Cancelled pending request");
2069
+ this.pending_.splice(I, 1), U.debug("ChunkQueue", "Cancelled pending request");
2053
2070
  return;
2054
2071
  }
2055
2072
  const B = this.running_.get(A);
2056
- B && (B.controller.abort(), c.debug("ChunkQueue", "Cancelled fetch request"));
2073
+ B && (B.controller.abort(), U.debug("ChunkQueue", "Cancelled fetch request"));
2057
2074
  }
2058
2075
  get pendingCount() {
2059
2076
  return this.pending_.length;
@@ -2077,7 +2094,7 @@ class jC {
2077
2094
  I.state === "loading" && (I.state = "loaded");
2078
2095
  },
2079
2096
  (E) => {
2080
- I.state === "loading" && (I.state = "unloaded"), E.name !== "AbortError" && c.error("ChunkQueue", String(E));
2097
+ I.state === "loading" && (I.state = "unloaded"), E.name !== "AbortError" && U.error("ChunkQueue", String(E));
2081
2098
  }
2082
2099
  ).finally(() => {
2083
2100
  this.running_.delete(I), this.pump();
@@ -2098,7 +2115,7 @@ function Pg(g) {
2098
2115
  if (Zg.some((I) => g instanceof I))
2099
2116
  return !0;
2100
2117
  const A = Zg.map((I) => I.name);
2101
- return c.debug(
2118
+ return U.debug(
2102
2119
  "Chunk",
2103
2120
  `Unsupported chunk data type: ${g}. Supported data types: ${A}`
2104
2121
  ), !1;
@@ -2125,7 +2142,7 @@ class _C {
2125
2142
  chunkViewStates_ = /* @__PURE__ */ new Map();
2126
2143
  isDisposed_ = !1;
2127
2144
  constructor(A, I) {
2128
- this.store_ = A, this.policy_ = I, c.info(
2145
+ this.store_ = A, this.policy_ = I, U.info(
2129
2146
  "ChunkStoreView",
2130
2147
  "Using image source policy:",
2131
2148
  this.policy_.profile
@@ -2162,20 +2179,52 @@ class _C {
2162
2179
  );
2163
2180
  return [...C, ...E];
2164
2181
  }
2165
- // TODO: Eventually unify visibility calculations using the camera frustum for both
2166
- // orthographic (2D slices) and perspective (volume rendering) cameras. This would
2167
- // replace both updateChunkStates and updateChunkStatesForVolume with a single method
2168
- // that performs frustum culling based on the camera type.
2169
- updateChunkStatesForVolume(A) {
2182
+ updateChunksForImage(A, I) {
2183
+ const B = I.camera;
2184
+ if (B.type !== "OrthographicCamera")
2185
+ throw new Error(
2186
+ "ChunkStoreView currently supports only orthographic cameras. Update the implementation before using a perspective camera."
2187
+ );
2188
+ const Q = B.getWorldViewRect(), E = Math.abs(Q.max[0] - Q.min[0]), i = I.element, o = I.getBoxRelativeTo(i).toRect().width, a = E / o, D = Math.log2(1 / a);
2189
+ this.setLOD(D);
2190
+ const h = this.getZBounds(A);
2191
+ if (!(this.policyChanged_ || this.viewBounds2DChanged(Q) || this.zBoundsChanged(h) || this.lastTCoord_ !== A.t)) return;
2192
+ const y = this.store_.getTimeIndex(A);
2193
+ if (this.store_.getChunksAtTime(y).length === 0) {
2194
+ U.warn(
2195
+ "ChunkStoreView",
2196
+ "updateChunkViewStates called with no chunks initialized"
2197
+ ), this.chunkViewStates_.clear();
2198
+ return;
2199
+ }
2200
+ const n = UB();
2201
+ xC(n, Q.min, Q.max, 0.5);
2202
+ const [S, G] = this.getZBounds(A), c = new RA(
2203
+ q(Q.min[0], Q.min[1], S),
2204
+ q(Q.max[0], Q.max[1], G)
2205
+ );
2206
+ this.chunkViewStates_.forEach(vI), this.updateChunksAtTimeIndex(
2207
+ y,
2208
+ A,
2209
+ c,
2210
+ n
2211
+ ), A.t !== void 0 && this.markTimeChunksForPrefetch(
2212
+ y,
2213
+ A,
2214
+ c,
2215
+ n
2216
+ ), this.policyChanged_ = !1, this.lastViewBounds2D_ = Q.clone(), this.lastZBounds_ = h, this.lastTCoord_ = A.t;
2217
+ }
2218
+ updateChunksForVolume(A) {
2170
2219
  const I = this.store_.getTimeIndex(A), B = this.store_.getChunksAtTime(I);
2171
2220
  if (B.length === 0) {
2172
- c.warn(
2221
+ U.warn(
2173
2222
  "ChunkStoreView",
2174
- "updateChunkStatesForVolume called with no chunks initialized"
2223
+ "updateChunksForVolume called with no chunks initialized"
2175
2224
  ), this.chunkViewStates_.clear();
2176
2225
  return;
2177
2226
  }
2178
- this.setLOD(0), this.chunkViewStates_.forEach(vI);
2227
+ this.currentLOD_ = this.policy_.lod.min, this.chunkViewStates_.forEach(vI);
2179
2228
  for (const C of B) {
2180
2229
  if (C.lod !== this.currentLOD_ || !(A.c === void 0 || A.c === C.chunkIndex.c)) continue;
2181
2230
  const E = this.policy_.priorityMap.visibleCurrent;
@@ -2189,17 +2238,6 @@ class _C {
2189
2238
  }
2190
2239
  this.lastTCoord_ = A.t;
2191
2240
  }
2192
- updateChunkStates(A, I) {
2193
- const B = I.camera;
2194
- if (B.type !== "OrthographicCamera")
2195
- throw new Error(
2196
- "ChunkStoreView currently supports only orthographic cameras. Update the implementation before using a perspective camera."
2197
- );
2198
- const Q = B.getWorldViewRect(), E = Math.abs(Q.max[0] - Q.min[0]), i = I.element, o = I.getBoxRelativeTo(i).toRect().width, a = E / o, D = Math.log2(1 / a);
2199
- this.setLOD(D);
2200
- const h = this.getZBounds(A);
2201
- (this.policyChanged_ || this.viewBounds2DChanged(Q) || this.zBoundsChanged(h) || this.lastTCoord_ !== A.t) && (this.updateChunkViewStates(A, Q), this.policyChanged_ = !1, this.lastViewBounds2D_ = Q.clone(), this.lastZBounds_ = h, this.lastTCoord_ = A.t);
2202
- }
2203
2241
  allVisibleFallbackLODLoaded(A) {
2204
2242
  const I = this.store_.getTimeIndex(A), B = this.fallbackLOD(), C = this.store_.getChunksAtTime(I).filter((Q) => Q.visible && Q.lod === B);
2205
2243
  return C.length > 0 && C.every((Q) => Q.state === "loaded");
@@ -2217,7 +2255,7 @@ class _C {
2217
2255
  setImageSourcePolicy(A, I) {
2218
2256
  if (I !== hg)
2219
2257
  throw new Error("Unauthorized policy mutation");
2220
- this.policy_ !== A && (this.policy_ = A, this.policyChanged_ = !0, c.info(
2258
+ this.policy_ !== A && (this.policy_ = A, this.policyChanged_ = !0, U.info(
2221
2259
  "ChunkStoreView",
2222
2260
  "Using image source policy:",
2223
2261
  this.policy_.profile
@@ -2233,52 +2271,25 @@ class _C {
2233
2271
  ), D = vA(E, o, a);
2234
2272
  D !== this.currentLOD_ && (this.currentLOD_ = D);
2235
2273
  }
2236
- updateChunkViewStates(A, I) {
2237
- const B = this.store_.getTimeIndex(A);
2238
- if (this.store_.getChunksAtTime(B).length === 0) {
2239
- c.warn(
2240
- "ChunkStoreView",
2241
- "updateChunkViewStates called with no chunks initialized"
2242
- ), this.chunkViewStates_.clear();
2243
- return;
2244
- }
2245
- const Q = UB();
2246
- xC(Q, I.min, I.max, 0.5);
2247
- const [E, i] = this.getZBounds(A), o = new SA(
2248
- q(I.min[0], I.min[1], E),
2249
- q(I.max[0], I.max[1], i)
2250
- );
2251
- this.chunkViewStates_.forEach(vI), this.updateChunksAtTimeIndex(
2252
- B,
2253
- A,
2254
- o,
2255
- Q
2256
- ), A.t !== void 0 && this.markTimeChunksForPrefetch(
2257
- B,
2258
- A,
2259
- o,
2260
- Q
2261
- );
2262
- }
2263
2274
  isChunkChannelInSlice(A, I) {
2264
2275
  return I.c === void 0 || I.c === A.chunkIndex.c;
2265
2276
  }
2266
2277
  updateChunksAtTimeIndex(A, I, B, C) {
2267
2278
  const Q = this.getPaddedBounds(B), E = this.store_.getChunksAtTime(A), i = this.fallbackLOD();
2268
2279
  for (const o of E) {
2269
- const a = this.isChunkWithinBounds(o, B), D = this.isChunkChannelInSlice(o, I), h = o.lod === this.currentLOD_, t = o.lod === i, y = !a && D && h && this.isChunkWithinBounds(o, Q), w = a && D, F = this.computePriority(
2280
+ const a = this.isChunkWithinBounds(o, B), D = this.isChunkChannelInSlice(o, I), h = o.lod === this.currentLOD_, t = o.lod === i, y = !a && D && h && this.isChunkWithinBounds(o, Q), w = a && D, n = this.computePriority(
2270
2281
  t,
2271
2282
  h,
2272
2283
  a,
2273
2284
  y,
2274
2285
  D
2275
2286
  );
2276
- if (F !== null) {
2287
+ if (n !== null) {
2277
2288
  const S = this.squareDistance2D(o, C);
2278
2289
  this.chunkViewStates_.set(o, {
2279
2290
  visible: w,
2280
2291
  prefetch: y,
2281
- priority: F,
2292
+ priority: n,
2282
2293
  orderKey: S
2283
2294
  });
2284
2295
  }
@@ -2311,7 +2322,7 @@ class _C {
2311
2322
  return A && B ? E.fallbackVisible : I && B ? E.visibleCurrent : A ? E.fallbackBackground : I && C ? E.prefetchSpace : null;
2312
2323
  }
2313
2324
  isChunkWithinBounds(A, I) {
2314
- const B = new SA(
2325
+ const B = new RA(
2315
2326
  q(A.offset.x, A.offset.y, A.offset.z),
2316
2327
  q(
2317
2328
  A.offset.x + A.shape.x * A.scale.x,
@@ -2319,7 +2330,7 @@ class _C {
2319
2330
  A.offset.z + A.shape.z * A.scale.z
2320
2331
  )
2321
2332
  );
2322
- return SA.intersects(B, I);
2333
+ return RA.intersects(B, I);
2323
2334
  }
2324
2335
  fallbackLOD() {
2325
2336
  return Math.min(this.policy_.lod.max, this.store_.getLowestResLOD());
@@ -2352,7 +2363,7 @@ class _C {
2352
2363
  getPaddedBounds(A) {
2353
2364
  const I = this.store_.dimensions, B = I.x.lods[this.currentLOD_], C = I.y.lods[this.currentLOD_], Q = I.z?.lods[this.currentLOD_], E = B.chunkSize * B.scale * this.policy_.prefetch.x, i = C.chunkSize * C.scale * this.policy_.prefetch.y;
2354
2365
  let o = 0;
2355
- return Q && (o = Q.chunkSize * Q.scale * this.policy_.prefetch.z), new SA(
2366
+ return Q && (o = Q.chunkSize * Q.scale * this.policy_.prefetch.z), new RA(
2356
2367
  q(
2357
2368
  A.min[0] - E,
2358
2369
  A.min[1] - i,
@@ -2390,13 +2401,13 @@ class $C {
2390
2401
  for (let C = 0; C < I; ++C) {
2391
2402
  const Q = this.chunks_[C];
2392
2403
  for (let E = 0; E < this.dimensions_.numLods; ++E) {
2393
- const i = this.dimensions_.x.lods[E], o = this.dimensions_.y.lods[E], a = this.dimensions_.z?.lods[E], D = i.chunkSize, h = o.chunkSize, t = a?.chunkSize ?? 1, y = Math.ceil(i.size / D), w = Math.ceil(o.size / h), F = Math.ceil((a?.size ?? 1) / t);
2404
+ const i = this.dimensions_.x.lods[E], o = this.dimensions_.y.lods[E], a = this.dimensions_.z?.lods[E], D = i.chunkSize, h = o.chunkSize, t = a?.chunkSize ?? 1, y = Math.ceil(i.size / D), w = Math.ceil(o.size / h), n = Math.ceil((a?.size ?? 1) / t);
2394
2405
  for (let S = 0; S < B; ++S)
2395
2406
  for (let G = 0; G < y; ++G) {
2396
- const U = i.translation + G * i.chunkSize * i.scale;
2407
+ const c = i.translation + G * i.chunkSize * i.scale;
2397
2408
  for (let N = 0; N < w; ++N) {
2398
2409
  const d = o.translation + N * o.chunkSize * o.scale;
2399
- for (let Y = 0; Y < F; ++Y) {
2410
+ for (let Y = 0; Y < n; ++Y) {
2400
2411
  const J = a !== void 0 ? a.translation + Y * t * a.scale : 0;
2401
2412
  Q.push({
2402
2413
  state: "unloaded",
@@ -2419,7 +2430,7 @@ class $C {
2419
2430
  z: a?.scale ?? 1
2420
2431
  },
2421
2432
  offset: {
2422
- x: U,
2433
+ x: c,
2423
2434
  y: d,
2424
2435
  z: J
2425
2436
  }
@@ -2490,7 +2501,7 @@ class $C {
2490
2501
  throw new Error(
2491
2502
  `Chunk state inconsistency detected: priority is null but visible=${A.visible} or prefetch=${A.prefetch} for chunk ${JSON.stringify(A.chunkIndex)} in LOD ${A.lod}`
2492
2503
  );
2493
- A.data = void 0, A.state = "unloaded", A.orderKey = null, c.debug(
2504
+ A.data = void 0, A.state = "unloaded", A.orderKey = null, U.debug(
2494
2505
  "ChunkStore",
2495
2506
  `Disposing chunk ${JSON.stringify(A.chunkIndex)} in LOD ${A.lod}`
2496
2507
  );
@@ -2629,13 +2640,13 @@ var OA = function(g = 1) {
2629
2640
  };
2630
2641
  };
2631
2642
  OA.Panel = function(g, A, I, B) {
2632
- var C = 1 / 0, Q = 0, E = Math.round, i = E(window.devicePixelRatio || 1), o = E(80 * i * B), a = E(48 * i * B), D = E(3 * i * B), h = E(2 * i * B), t = E(3 * i * B), y = E(15 * i * B), w = E(74 * i * B), F = E(30 * i * B), S = document.createElement("canvas");
2643
+ var C = 1 / 0, Q = 0, E = Math.round, i = E(window.devicePixelRatio || 1), o = E(80 * i * B), a = E(48 * i * B), D = E(3 * i * B), h = E(2 * i * B), t = E(3 * i * B), y = E(15 * i * B), w = E(74 * i * B), n = E(30 * i * B), S = document.createElement("canvas");
2633
2644
  S.width = o, S.height = a, S.style.cssText = `width:${E(B * 80)}px;height:${E(B * 48)}px`;
2634
2645
  var G = S.getContext("2d");
2635
- return G.font = "bold " + E(9 * i * B) + "px Helvetica,Arial,sans-serif", G.textBaseline = "top", G.fillStyle = I, G.fillRect(0, 0, o, a), G.fillStyle = A, G.fillText(g, D, h), G.fillRect(t, y, w, F), G.fillStyle = I, G.globalAlpha = 0.9, G.fillRect(t, y, w, F), {
2646
+ return G.font = "bold " + E(9 * i * B) + "px Helvetica,Arial,sans-serif", G.textBaseline = "top", G.fillStyle = I, G.fillRect(0, 0, o, a), G.fillStyle = A, G.fillText(g, D, h), G.fillRect(t, y, w, n), G.fillStyle = I, G.globalAlpha = 0.9, G.fillRect(t, y, w, n), {
2636
2647
  dom: S,
2637
- update: function(U, N) {
2638
- C = Math.min(C, U), Q = Math.max(Q, U), G.fillStyle = I, G.globalAlpha = 1, G.fillRect(0, 0, o, y), G.fillStyle = A, G.fillText(E(U) + " " + g + " (" + E(C) + "-" + E(Q) + ")", D, h), G.drawImage(S, t + i, y, w - i, F, t, y, w - i, F), G.fillRect(t + w - i, y, i, F), G.fillStyle = I, G.globalAlpha = 0.9, G.fillRect(t + w - i, y, i, E((1 - U / N) * F));
2648
+ update: function(c, N) {
2649
+ C = Math.min(C, c), Q = Math.max(Q, c), G.fillStyle = I, G.globalAlpha = 1, G.fillRect(0, 0, o, y), G.fillStyle = A, G.fillText(E(c) + " " + g + " (" + E(C) + "-" + E(Q) + ")", D, h), G.drawImage(S, t + i, y, w - i, n, t, y, w - i, n), G.fillRect(t + w - i, y, i, n), G.fillStyle = I, G.globalAlpha = 0.9, G.fillRect(t + w - i, y, i, E((1 - c / N) * n));
2639
2650
  }
2640
2651
  };
2641
2652
  };
@@ -2734,7 +2745,7 @@ class QQ {
2734
2745
  }
2735
2746
  connect() {
2736
2747
  if (this.isConnected_) {
2737
- c.warn(
2748
+ U.warn(
2738
2749
  "EventDispatcher",
2739
2750
  "Attempted to connect already connected event dispatcher",
2740
2751
  `element id: ${this.element_.id}`
@@ -2749,7 +2760,7 @@ class QQ {
2749
2760
  }
2750
2761
  disconnect() {
2751
2762
  if (!this.isConnected_) {
2752
- c.debug(
2763
+ U.debug(
2753
2764
  "EventDispatcher",
2754
2765
  "Attempted to disconnect already disconnected event dispatcher",
2755
2766
  `element id: ${this.element_.id}`
@@ -2762,7 +2773,7 @@ class QQ {
2762
2773
  }
2763
2774
  handleEvent = (A) => {
2764
2775
  if (!BQ(A.type)) {
2765
- c.error("EventDispatcher", `Unsupported event type ${A.type}`);
2776
+ U.error("EventDispatcher", `Unsupported event type ${A.type}`);
2766
2777
  return;
2767
2778
  }
2768
2779
  const I = new CQ(A.type, A);
@@ -2822,7 +2833,7 @@ class EQ {
2822
2833
  updateAspectRatio() {
2823
2834
  const { width: A, height: I } = this.getBox().toRect();
2824
2835
  if (A <= 0 || I <= 0) {
2825
- c.debug(
2836
+ U.debug(
2826
2837
  "Viewport",
2827
2838
  `Skipping aspect ratio update for viewport ${this.id}: invalid dimensions ${A}x${I}`
2828
2839
  );
@@ -2871,7 +2882,7 @@ class aQ {
2871
2882
  }
2872
2883
  connect() {
2873
2884
  if (this.resizeObserver_) {
2874
- c.warn(
2885
+ U.warn(
2875
2886
  "PixelSizeObserver",
2876
2887
  "Attempted to connect already connected observer"
2877
2888
  );
@@ -2895,7 +2906,7 @@ class aQ {
2895
2906
  }
2896
2907
  disconnect() {
2897
2908
  if (!this.resizeObserver_) {
2898
- c.warn(
2909
+ U.warn(
2899
2910
  "PixelSizeObserver",
2900
2911
  "Attempted to disconnect already disconnected observer"
2901
2912
  );
@@ -3002,14 +3013,14 @@ class to {
3002
3013
  return this.viewports_.find((I) => I.id === A);
3003
3014
  }
3004
3015
  start() {
3005
- if (c.info("Idetik", "Idetik runtime starting"), this.lastAnimationId_ === void 0) {
3016
+ if (U.info("Idetik", "Idetik runtime starting"), this.lastAnimationId_ === void 0) {
3006
3017
  for (const A of this.viewports_)
3007
3018
  A.events.connect();
3008
3019
  this.sizeObserver_.connect(), this.lastAnimationId_ = requestAnimationFrame((A) => {
3009
3020
  this.lastTimestamp_ = A, this.animate(A);
3010
3021
  });
3011
3022
  } else
3012
- c.warn("Idetik", "Idetik runtime already started");
3023
+ U.warn("Idetik", "Idetik runtime already started");
3013
3024
  return this;
3014
3025
  }
3015
3026
  animate(A) {
@@ -3026,8 +3037,8 @@ class to {
3026
3037
  );
3027
3038
  }
3028
3039
  stop() {
3029
- if (c.info("Idetik", "Idetik runtime stopping"), this.lastAnimationId_ === void 0)
3030
- c.warn("Idetik", "Idetik runtime not started");
3040
+ if (U.info("Idetik", "Idetik runtime stopping"), this.lastAnimationId_ === void 0)
3041
+ U.warn("Idetik", "Idetik runtime not started");
3031
3042
  else {
3032
3043
  this.sizeObserver_.disconnect();
3033
3044
  for (const A of this.viewports_)
@@ -3039,11 +3050,11 @@ class to {
3039
3050
  class DQ extends uA {
3040
3051
  constructor(A) {
3041
3052
  if (super(), A.primitive != "triangles") {
3042
- c.warn("WireframeGeometry", "Only indexed geometries are supported");
3053
+ U.warn("WireframeGeometry", "Only indexed geometries are supported");
3043
3054
  return;
3044
3055
  }
3045
3056
  if (A.indexData.length == 0) {
3046
- c.warn(
3057
+ U.warn(
3047
3058
  "WireframeGeometry",
3048
3059
  "Only triangulated geometries are supported"
3049
3060
  );
@@ -3212,22 +3223,22 @@ class tQ {
3212
3223
  setWithViewProjection(A) {
3213
3224
  const I = f();
3214
3225
  this.planes_[0].set(
3215
- JA(I, A[3] + A[0], A[7] + A[4], A[11] + A[8]),
3226
+ SA(I, A[3] + A[0], A[7] + A[4], A[11] + A[8]),
3216
3227
  A[15] + A[12]
3217
3228
  ), this.planes_[1].set(
3218
- JA(I, A[3] - A[0], A[7] - A[4], A[11] - A[8]),
3229
+ SA(I, A[3] - A[0], A[7] - A[4], A[11] - A[8]),
3219
3230
  A[15] - A[12]
3220
3231
  ), this.planes_[2].set(
3221
- JA(I, A[3] - A[1], A[7] - A[5], A[11] - A[9]),
3232
+ SA(I, A[3] - A[1], A[7] - A[5], A[11] - A[9]),
3222
3233
  A[15] - A[13]
3223
3234
  ), this.planes_[3].set(
3224
- JA(I, A[3] + A[1], A[7] + A[5], A[11] + A[9]),
3235
+ SA(I, A[3] + A[1], A[7] + A[5], A[11] + A[9]),
3225
3236
  A[15] + A[13]
3226
3237
  ), this.planes_[4].set(
3227
- JA(I, A[3] + A[2], A[7] + A[6], A[11] + A[10]),
3238
+ SA(I, A[3] + A[2], A[7] + A[6], A[11] + A[10]),
3228
3239
  A[15] + A[14]
3229
3240
  ), this.planes_[5].set(
3230
- JA(I, A[3] - A[2], A[7] - A[6], A[11] - A[10]),
3241
+ SA(I, A[3] - A[2], A[7] - A[6], A[11] - A[10]),
3231
3242
  A[15] - A[14]
3232
3243
  );
3233
3244
  for (const B of this.planes_) B.normalize();
@@ -3451,7 +3462,7 @@ class wA {
3451
3462
  opacity: I = 1,
3452
3463
  blendMode: B = "normal"
3453
3464
  } = {}) {
3454
- (I < 0 || I > 1) && c.warn(
3465
+ (I < 0 || I > 1) && U.warn(
3455
3466
  "Layer",
3456
3467
  `Layer opacity out of bounds: ${I} — clamping to [0.0, 1.0]`
3457
3468
  ), this.transparent = A, this.opacity_ = vA(I, 0, 1), this.blendMode = B;
@@ -3460,7 +3471,7 @@ class wA {
3460
3471
  return this.opacity_;
3461
3472
  }
3462
3473
  set opacity(A) {
3463
- (A < 0 || A > 1) && c.warn(
3474
+ (A < 0 || A > 1) && U.warn(
3464
3475
  "Layer",
3465
3476
  `Opacity out of bounds: ${A} — clamping to [0.0, 1.0]`
3466
3477
  ), this.opacity_ = vA(A, 0, 1);
@@ -3771,15 +3782,15 @@ class JB extends uA {
3771
3782
  const Q = [], E = [], i = B, o = C, a = i + 1, D = o + 1, h = A / i, t = I / o;
3772
3783
  for (let y = 0; y < D; ++y) {
3773
3784
  const w = y * t;
3774
- for (let F = 0; F < a; ++F) {
3775
- const S = F * h, G = F / i, U = y / o, N = [S, w, 0], d = [0, 0, 1], Y = [G, U];
3785
+ for (let n = 0; n < a; ++n) {
3786
+ const S = n * h, G = n / i, c = y / o, N = [S, w, 0], d = [0, 0, 1], Y = [G, c];
3776
3787
  Q.push(...N, ...d, ...Y);
3777
3788
  }
3778
3789
  }
3779
3790
  for (let y = 0; y < o; ++y)
3780
3791
  for (let w = 0; w < i; ++w) {
3781
- const F = w + a * y, S = w + a * (y + 1), G = w + 1 + a * (y + 1), U = w + 1 + a * y;
3782
- E.push(F, S, U), E.push(S, G, U);
3792
+ const n = w + a * y, S = w + a * (y + 1), G = w + 1 + a * (y + 1), c = w + 1 + a * y;
3793
+ E.push(n, S, c), E.push(S, G, c);
3783
3794
  }
3784
3795
  this.vertexData_ = new Float32Array(Q), this.indexData_ = new Uint32Array(E), this.addAttribute({
3785
3796
  type: "position",
@@ -3853,7 +3864,7 @@ class yg extends Dg {
3853
3864
  }
3854
3865
  const jg = 32;
3855
3866
  function Bg(g, { visible: A, color: I, contrastLimits: B }) {
3856
- return A === void 0 && (A = !0), I === void 0 ? I = l.WHITE : I = l.from(I), g !== null ? B = SQ(B, g) : B === void 0 && (c.debug(
3867
+ return A === void 0 && (A = !0), I === void 0 ? I = l.WHITE : I = l.from(I), g !== null ? B = SQ(B, g) : B === void 0 && (U.debug(
3857
3868
  "Channel",
3858
3869
  "No texture provided, defaulting channel contrast limits to [0, 1]."
3859
3870
  ), B = [0, 1]), {
@@ -4044,11 +4055,11 @@ class YB {
4044
4055
  bins_ = /* @__PURE__ */ new Map();
4045
4056
  acquire(A) {
4046
4057
  const B = this.bins_.get(A)?.pop();
4047
- return B && c.debug("RenderablePool", "Renderable object acquired"), B;
4058
+ return B && U.debug("RenderablePool", "Renderable object acquired"), B;
4048
4059
  }
4049
4060
  release(A, I) {
4050
4061
  let B = this.bins_.get(A);
4051
- B || (B = [], this.bins_.set(A, B)), B.push(I), c.debug("RenderablePool", "Renderable object released");
4062
+ B || (B = [], this.bins_.set(A, B)), B.push(I), U.debug("RenderablePool", "Renderable object released");
4052
4063
  }
4053
4064
  clearAll(A) {
4054
4065
  if (A) for (const I of this.bins_.values()) I.forEach(A);
@@ -4103,7 +4114,10 @@ class dB extends wA {
4103
4114
  this.chunkStoreView_ && (this.releaseAndRemoveChunks(this.visibleChunks_.keys()), this.clearObjects(), this.chunkStoreView_.dispose(), this.chunkStoreView_ = void 0);
4104
4115
  }
4105
4116
  update(A) {
4106
- !A || !this.chunkStoreView_ || (this.chunkStoreView_.updateChunkStates(this.sliceCoords_, A.viewport), this.updateChunks(), this.resliceIfZChanged());
4117
+ !A || !this.chunkStoreView_ || (this.chunkStoreView_.updateChunksForImage(
4118
+ this.sliceCoords_,
4119
+ A.viewport
4120
+ ), this.updateChunks(), this.resliceIfZChanged());
4107
4121
  }
4108
4122
  updateChunks() {
4109
4123
  if (!this.chunkStoreView_ || (this.state !== "ready" && this.setState("ready"), this.visibleChunks_.size > 0 && !this.chunkStoreView_.allVisibleFallbackLODLoaded(this.sliceCoords_) && !this.isPresentationStale()))
@@ -4171,7 +4185,7 @@ class dB extends wA {
4171
4185
  slicePlane(A, I) {
4172
4186
  if (!A.data) return;
4173
4187
  const B = (I - A.offset.z) / A.scale.z, C = Math.round(B), Q = vA(C, 0, A.shape.z - 1);
4174
- Ig(B, Q, 1 + 1e-6) || c.error("ImageLayer", "slicePlane zValue outside extent");
4188
+ Ig(B, Q, 1 + 1e-6) || U.error("ImageLayer", "slicePlane zValue outside extent");
4175
4189
  const E = A.shape.x * A.shape.y, i = E * Q;
4176
4190
  return A.data.slice(i, i + E);
4177
4191
  }
@@ -4193,7 +4207,7 @@ class dB extends wA {
4193
4207
  getDataForImage(A) {
4194
4208
  const I = this.sliceCoords_?.z !== void 0 ? this.slicePlane(A, this.sliceCoords_.z) : A.data;
4195
4209
  if (!I) {
4196
- c.warn("ChunkedImageLayer", "No data for image");
4210
+ U.warn("ChunkedImageLayer", "No data for image");
4197
4211
  return;
4198
4212
  }
4199
4213
  return I;
@@ -4291,12 +4305,12 @@ class UQ extends uA {
4291
4305
  });
4292
4306
  }
4293
4307
  buildFace(A, I, B, C, Q, E, i, o, a, D, h, t, y) {
4294
- const w = E / a, F = i / D, S = E / 2, G = i / 2, U = o / 2 * h, N = a + 1, d = D + 1, Y = t.length / 8;
4308
+ const w = E / a, n = i / D, S = E / 2, G = i / 2, c = o / 2 * h, N = a + 1, d = D + 1, Y = t.length / 8;
4295
4309
  for (let J = 0; J < d; J++) {
4296
- const x = -G + J * F;
4310
+ const x = -G + J * n;
4297
4311
  for (let v = 0; v < N; v++) {
4298
4312
  const X = -S + v * w, O = { x: 0, y: 0, z: 0 };
4299
- O[A] = X * C, O[I] = x * Q, O[B] = U;
4313
+ O[A] = X * C, O[I] = x * Q, O[B] = c;
4300
4314
  const j = { x: 0, y: 0, z: 0 };
4301
4315
  j[B] = h;
4302
4316
  const nA = v / a, FA = 1 - J / D;
@@ -4320,12 +4334,18 @@ class UQ extends uA {
4320
4334
  }
4321
4335
  }
4322
4336
  class kQ extends TA {
4337
+ voxelScale = q(1, 1, 1);
4323
4338
  constructor(A) {
4324
4339
  super(), this.geometry = new UQ(1, 1, 1, 1, 1, 1), this.setTexture(0, A), this.programName = LQ(A.dataType), this.cullFaceMode = "front", this.depthTest = !1;
4325
4340
  }
4326
4341
  get type() {
4327
4342
  return "VolumeRenderable";
4328
4343
  }
4344
+ getUniforms() {
4345
+ return {
4346
+ VoxelScale: this.voxelScale
4347
+ };
4348
+ }
4329
4349
  }
4330
4350
  function LQ(g) {
4331
4351
  switch (g) {
@@ -4407,7 +4427,7 @@ class ro extends wA {
4407
4427
  debugShowWireframes_ = !1;
4408
4428
  debugShowDegenerateRays = !1;
4409
4429
  color = q(1, 1, 1);
4410
- samplesPerUnit = 128;
4430
+ relativeStepSize = 1;
4411
4431
  maxIntensity = 255;
4412
4432
  opacityMultiplier = 0.1;
4413
4433
  earlyTerminationAlpha = 0.99;
@@ -4466,20 +4486,21 @@ class ro extends wA {
4466
4486
  this.lastLoadedTime_ = I, this.state !== "ready" && this.setState("ready");
4467
4487
  }
4468
4488
  updateVolumeChunk(A, I) {
4469
- A.transform.setScale([
4470
- I.shape.x * I.scale.x,
4471
- I.shape.y * I.scale.y,
4472
- I.shape.z * I.scale.z
4473
- ]);
4474
4489
  const B = {
4490
+ x: I.shape.x * I.scale.x,
4491
+ y: I.shape.y * I.scale.y,
4492
+ z: I.shape.z * I.scale.z
4493
+ };
4494
+ A.transform.setScale([B.x, B.y, B.z]), SA(A.voxelScale, I.scale.x, I.scale.y, I.scale.z);
4495
+ const C = {
4475
4496
  x: I.shape.x * I.scale.x / 2,
4476
4497
  y: I.shape.y * I.scale.y / 2,
4477
4498
  z: I.shape.z * I.scale.z / 2
4478
4499
  };
4479
4500
  A.transform.setTranslation([
4480
- I.offset.x + B.x,
4481
- I.offset.y + B.y,
4482
- I.offset.z + B.z
4501
+ I.offset.x + C.x,
4502
+ I.offset.y + C.y,
4503
+ I.offset.z + C.z
4483
4504
  ]);
4484
4505
  }
4485
4506
  releaseAndRemoveChunks(A) {
@@ -4494,7 +4515,7 @@ class ro extends wA {
4494
4515
  throw new Error(
4495
4516
  "RenderContext is required for the VolumeLayer update as camera information is used to reorder the chunks."
4496
4517
  );
4497
- this.reorderObjects(A.viewport.camera), this.chunkStoreView_.updateChunkStatesForVolume(this.sliceCoords_), this.updateChunks();
4518
+ this.reorderObjects(A.viewport.camera), this.chunkStoreView_.updateChunksForVolume(this.sliceCoords_), this.updateChunks();
4498
4519
  }
4499
4520
  }
4500
4521
  reorderObjects(A) {
@@ -4508,7 +4529,7 @@ class ro extends wA {
4508
4529
  getUniforms() {
4509
4530
  return {
4510
4531
  DebugShowDegenerateRays: Number(this.debugShowDegenerateRays),
4511
- SamplesPerUnit: this.samplesPerUnit,
4532
+ RelativeStepSize: this.relativeStepSize,
4512
4533
  MaxIntensity: this.maxIntensity,
4513
4534
  OpacityMultiplier: this.opacityMultiplier,
4514
4535
  VolumeColor: this.color,
@@ -4928,11 +4949,11 @@ class lQ {
4928
4949
  const I = this.loadingToken_;
4929
4950
  if (I) {
4930
4951
  if (I.index === A && !I.canceled)
4931
- return c.debug(
4952
+ return U.debug(
4932
4953
  "ImageSeriesLoader",
4933
4954
  "Ignoring duplicate active setIndex request"
4934
4955
  ), { success: !1, reason: "duplicate" };
4935
- c.debug(
4956
+ U.debug(
4936
4957
  "ImageSeriesLoader",
4937
4958
  `Cancelling setIndex request for index ${I.index}, new requested index is ${A}`
4938
4959
  ), I.canceled = !0;
@@ -5000,7 +5021,7 @@ class lQ {
5000
5021
  if (C.status === "rejected") {
5001
5022
  if (C.reason instanceof fI)
5002
5023
  return Promise.reject(C.reason);
5003
- c.error(
5024
+ U.error(
5004
5025
  "ImageSeriesLoader",
5005
5026
  `Error loading slice: ${C.reason}`
5006
5027
  );
@@ -5330,7 +5351,7 @@ function HB(g) {
5330
5351
  }[g];
5331
5352
  return u(I, `Unknown or unsupported data_type: ${g}`), I;
5332
5353
  }
5333
- function NA(g, A) {
5354
+ function cA(g, A) {
5334
5355
  const I = g.length;
5335
5356
  typeof A == "string" && (A = A === "C" ? Array.from({ length: I }, (Q, E) => E) : Array.from({ length: I }, (Q, E) => I - 1 - E)), u(I === A.length, "Order length must match the number of dimensions.");
5336
5357
  let B = 1, C = new Array(I);
@@ -5486,7 +5507,7 @@ class pI {
5486
5507
  #C;
5487
5508
  #B;
5488
5509
  constructor(A, I) {
5489
- this.#B = A?.endian, this.#I = HB(I.data_type), this.#C = I.shape, this.#A = NA(I.shape, "C");
5510
+ this.#B = A?.endian, this.#I = HB(I.data_type), this.#C = I.shape, this.#A = cA(I.shape, "C");
5490
5511
  const B = new this.#I(0);
5491
5512
  this.#g = B.BYTES_PER_ELEMENT;
5492
5513
  }
@@ -5569,8 +5590,8 @@ class Rg {
5569
5590
  let D;
5570
5591
  o.length && (D = (t, y) => {
5571
5592
  let w = y;
5572
- for (let F of o)
5573
- w = F(t, w);
5593
+ for (let n of o)
5594
+ w = n(t, w);
5574
5595
  return w;
5575
5596
  });
5576
5597
  let h = JSON.stringify(a, D, I);
@@ -5584,7 +5605,7 @@ class Rg {
5584
5605
  u(I, "JsonCodec does not yet support non-strict decoding.");
5585
5606
  const B = sI(A), C = B.pop();
5586
5607
  B.pop(), u(C, "0D not implemented for JsonCodec.");
5587
- const Q = NA(C, "C");
5608
+ const Q = cA(C, "C");
5588
5609
  return { data: B, shape: C, stride: Q };
5589
5610
  }
5590
5611
  }
@@ -5607,7 +5628,7 @@ function VQ(g, A) {
5607
5628
  ) : I = new g.constructor(g.data.length), {
5608
5629
  data: I,
5609
5630
  shape: g.shape,
5610
- stride: NA(g.shape, A)
5631
+ stride: cA(g.shape, A)
5611
5632
  };
5612
5633
  }
5613
5634
  function vQ(g, A) {
@@ -5662,7 +5683,7 @@ class Ng {
5662
5683
  return {
5663
5684
  data: A.data,
5664
5685
  shape: A.shape,
5665
- stride: NA(A.shape, this.#A)
5686
+ stride: cA(A.shape, this.#A)
5666
5687
  };
5667
5688
  }
5668
5689
  }
@@ -5671,7 +5692,7 @@ class cg {
5671
5692
  #A;
5672
5693
  #I;
5673
5694
  constructor(A) {
5674
- this.#A = A, this.#I = NA(A, "C");
5695
+ this.#A = A, this.#I = cA(A, "C");
5675
5696
  }
5676
5697
  static fromConfig(A, I) {
5677
5698
  return new cg(I.shape);
@@ -5770,18 +5791,18 @@ function AE(g, A, I, B) {
5770
5791
  codecs: B.index_codecs
5771
5792
  }), i = {};
5772
5793
  return async (o) => {
5773
- let a = o.map((U, N) => Math.floor(U / Q[N])), D = g.resolve(I(a)).path, h;
5794
+ let a = o.map((c, N) => Math.floor(c / Q[N])), D = g.resolve(I(a)).path, h;
5774
5795
  if (D in i)
5775
5796
  h = i[D];
5776
5797
  else {
5777
- let U = 4, N = 16 * Q.reduce((Y, J) => Y * J, 1), d = await C(D, {
5778
- suffixLength: N + U
5798
+ let c = 4, N = 16 * Q.reduce((Y, J) => Y * J, 1), d = await C(D, {
5799
+ suffixLength: N + c
5779
5800
  });
5780
5801
  h = i[D] = d ? await E.decode(d) : null;
5781
5802
  }
5782
5803
  if (h === null)
5783
5804
  return;
5784
- let { data: t, shape: y, stride: w } = h, F = o.map((U, N) => U % y[N]).reduce((U, N, d) => U + N * w[d], 0), S = t[F], G = t[F + 1];
5805
+ let { data: t, shape: y, stride: w } = h, n = o.map((c, N) => c % y[N]).reduce((c, N, d) => c + N * w[d], 0), S = t[n], G = t[n + 1];
5785
5806
  if (!(S === oB && G === oB))
5786
5807
  return C(D, {
5787
5808
  offset: Number(S),
@@ -5835,7 +5856,7 @@ function gE(g, A) {
5835
5856
  codecs: I.codecs
5836
5857
  }),
5837
5858
  get_strides(E) {
5838
- return NA(E, Q);
5859
+ return cA(E, Q);
5839
5860
  },
5840
5861
  get_chunk_bytes: AE(g, A.chunk_grid.configuration.chunk_shape, B.encode_chunk_key, I)
5841
5862
  };
@@ -5851,7 +5872,7 @@ function gE(g, A) {
5851
5872
  codecs: A.codecs
5852
5873
  }),
5853
5874
  get_strides(Q) {
5854
- return NA(Q, C);
5875
+ return cA(Q, C);
5855
5876
  },
5856
5877
  async get_chunk_bytes(Q, E) {
5857
5878
  let i = B.encode_chunk_key(Q), o = g.resolve(i).path;
@@ -6164,16 +6185,16 @@ function GI(g, A, I, B) {
6164
6185
  }, I, Q);
6165
6186
  return;
6166
6187
  }
6167
- const [D, h, t] = C.to, [y, w, F] = C.from, S = pB(D, h, t);
6188
+ const [D, h, t] = C.to, [y, w, n] = C.from, S = pB(D, h, t);
6168
6189
  if (Q.length === 0) {
6169
- if (t === 1 && F === 1 && E === 1 && o === 1) {
6170
- let G = y * I, U = S * I;
6171
- g.data.set(A.data.subarray(G, G + U), D * I);
6190
+ if (t === 1 && n === 1 && E === 1 && o === 1) {
6191
+ let G = y * I, c = S * I;
6192
+ g.data.set(A.data.subarray(G, G + c), D * I);
6172
6193
  return;
6173
6194
  }
6174
6195
  for (let G = 0; G < S; G++) {
6175
- let U = o * (y + F * G) * I;
6176
- g.data.set(A.data.subarray(U, U + I), E * (D + t * G) * I);
6196
+ let c = o * (y + n * G) * I;
6197
+ g.data.set(A.data.subarray(c, c + I), E * (D + t * G) * I);
6177
6198
  }
6178
6199
  return;
6179
6200
  }
@@ -6182,7 +6203,7 @@ function GI(g, A, I, B) {
6182
6203
  data: g.data.subarray(E * (D + G * t) * I),
6183
6204
  stride: i
6184
6205
  }, {
6185
- data: A.data.subarray(o * (y + G * F) * I),
6206
+ data: A.data.subarray(o * (y + G * n) * I),
6186
6207
  stride: a
6187
6208
  }, I, Q);
6188
6209
  }
@@ -6321,14 +6342,14 @@ class Mg extends WA {
6321
6342
  async getRange(A, I, B) {
6322
6343
  if (this.credentials && this.region) {
6323
6344
  const Q = `${this.url.toString().replace(/\/$/, "")}${A}`, E = await this.generateAuthHeaders(Q, "HEAD"), i = await this.generateAuthHeaders(Q, "GET"), o = globalThis.fetch, a = async (h, t) => {
6324
- const w = (t?.method || "GET") === "HEAD" ? E : i, F = {
6345
+ const w = (t?.method || "GET") === "HEAD" ? E : i, n = {
6325
6346
  ...t,
6326
6347
  headers: {
6327
6348
  ...t?.headers,
6328
6349
  ...w
6329
6350
  }
6330
6351
  };
6331
- return o(h, F);
6352
+ return o(h, n);
6332
6353
  }, D = globalThis.fetch;
6333
6354
  globalThis.fetch = a;
6334
6355
  try {
@@ -6350,12 +6371,12 @@ class Mg extends WA {
6350
6371
  x-amz-content-sha256:UNSIGNED-PAYLOAD
6351
6372
  x-amz-date:${o}
6352
6373
  ` + (Q ? `x-amz-security-token:${Q}
6353
- ` : ""), F = Q ? "host;x-amz-content-sha256;x-amz-date;x-amz-security-token" : "host;x-amz-content-sha256;x-amz-date", S = "UNSIGNED-PAYLOAD", G = `${I}
6374
+ ` : ""), n = Q ? "host;x-amz-content-sha256;x-amz-date;x-amz-security-token" : "host;x-amz-content-sha256;x-amz-date", S = "UNSIGNED-PAYLOAD", G = `${I}
6354
6375
  ${t}
6355
6376
  ${y}
6356
6377
  ${w}
6357
- ${F}
6358
- ${S}`, U = "AWS4-HMAC-SHA256", N = `${a}/${E}/${i}/aws4_request`, d = await this.sha256(G), Y = `${U}
6378
+ ${n}
6379
+ ${S}`, c = "AWS4-HMAC-SHA256", N = `${a}/${E}/${i}/aws4_request`, d = await this.sha256(G), Y = `${c}
6359
6380
  ${o}
6360
6381
  ${N}
6361
6382
  ${d}`, J = await this.getSignatureKey(
@@ -6364,7 +6385,7 @@ ${d}`, J = await this.getSignatureKey(
6364
6385
  E,
6365
6386
  i
6366
6387
  ), x = await this.hmacSha256(J, Y), X = {
6367
- Authorization: `${U} Credential=${B}/${N}, SignedHeaders=${F}, Signature=${x}`,
6388
+ Authorization: `${c} Credential=${B}/${N}, SignedHeaders=${n}, Signature=${x}`,
6368
6389
  "X-Amz-Date": o,
6369
6390
  "X-Amz-Content-Sha256": S
6370
6391
  };
@@ -9676,40 +9697,40 @@ function ME(g) {
9676
9697
  }
9677
9698
  const KE = Math.min(navigator.hardwareConcurrency, 8);
9678
9699
  let BA = [], HE = 0, uB = 0;
9679
- const cA = /* @__PURE__ */ new Map(), kI = /* @__PURE__ */ new Set();
9700
+ const UA = /* @__PURE__ */ new Map(), kI = /* @__PURE__ */ new Set();
9680
9701
  function TB(g) {
9681
9702
  const A = BA.find((I) => I.worker === g);
9682
- return A || c.error(
9703
+ return A || U.error(
9683
9704
  "ZarrWorker",
9684
9705
  "Worker not found in pool - this should not happen"
9685
9706
  ), A;
9686
9707
  }
9687
9708
  function qE(g, A) {
9688
- const { id: I, success: B } = g.data, C = cA.get(I);
9709
+ const { id: I, success: B } = g.data, C = UA.get(I);
9689
9710
  if (!C) {
9690
- kI.has(I) ? kI.delete(I) : c.warn(
9711
+ kI.has(I) ? kI.delete(I) : U.warn(
9691
9712
  "ZarrWorker",
9692
9713
  `Received response for unknown message ID ${I}:`,
9693
9714
  g.data
9694
9715
  );
9695
9716
  return;
9696
9717
  }
9697
- cA.delete(I), C.abortListener && C.abortSignal && C.abortSignal.removeEventListener("abort", C.abortListener);
9718
+ UA.delete(I), C.abortListener && C.abortSignal && C.abortSignal.removeEventListener("abort", C.abortListener);
9698
9719
  const Q = TB(A);
9699
- Q && Q.pendingCount > 0 ? Q.pendingCount-- : Q && c.error(
9720
+ Q && Q.pendingCount > 0 ? Q.pendingCount-- : Q && U.error(
9700
9721
  "ZarrWorker",
9701
9722
  "Received message but no pending tasks - this should not happen"
9702
9723
  ), B && g.data.type === "getChunk" ? C.resolve(g.data.chunk) : B || C.reject(new Error(g.data.error || "Unknown worker error"));
9703
9724
  }
9704
9725
  function yB(g, A) {
9705
9726
  if (g instanceof MessageEvent) {
9706
- c.error(
9727
+ U.error(
9707
9728
  "ZarrWorker",
9708
9729
  "Message serialization error occurred - worker remains active"
9709
9730
  );
9710
9731
  return;
9711
9732
  }
9712
- c.error(
9733
+ U.error(
9713
9734
  "ZarrWorker",
9714
9735
  "Worker failed - replacing worker and canceling its in-flight messages",
9715
9736
  g.message
@@ -9721,17 +9742,17 @@ function yB(g, A) {
9721
9742
  }
9722
9743
  const B = I?.workerId;
9723
9744
  if (B !== void 0)
9724
- for (const [C, Q] of cA.entries())
9725
- Q.workerId === B && (Q.reject(new Error(`Worker error: ${g.message}`)), cA.delete(C));
9745
+ for (const [C, Q] of UA.entries())
9746
+ Q.workerId === B && (Q.reject(new Error(`Worker error: ${g.message}`)), UA.delete(C));
9726
9747
  try {
9727
9748
  const C = WB();
9728
9749
  BA.push({
9729
9750
  worker: C,
9730
9751
  pendingCount: 0,
9731
9752
  workerId: uB++
9732
- }), c.debug("ZarrWorker", "Replacement worker created successfully");
9753
+ }), U.debug("ZarrWorker", "Replacement worker created successfully");
9733
9754
  } catch (C) {
9734
- c.error("ZarrWorker", "Failed to create replacement worker", C);
9755
+ U.error("ZarrWorker", "Failed to create replacement worker", C);
9735
9756
  }
9736
9757
  }
9737
9758
  function WB() {
@@ -9753,12 +9774,12 @@ async function fE(g, A, I) {
9753
9774
  reject: C,
9754
9775
  workerId: Q.workerId
9755
9776
  };
9756
- if (cA.set(E, i), I?.signal) {
9777
+ if (UA.set(E, i), I?.signal) {
9757
9778
  const o = () => {
9758
9779
  Q.worker.postMessage({
9759
9780
  id: E,
9760
9781
  type: "cancel"
9761
- }), cA.delete(E), kI.add(E), Q.pendingCount--, C(new DOMException("Operation was aborted", "AbortError"));
9782
+ }), UA.delete(E), kI.add(E), Q.pendingCount--, C(new DOMException("Operation was aborted", "AbortError"));
9762
9783
  };
9763
9784
  if (I.signal.aborted) {
9764
9785
  o(), kI.delete(E);
@@ -9785,12 +9806,12 @@ function pE() {
9785
9806
  workerId: uB++
9786
9807
  });
9787
9808
  }
9788
- c.debug(
9809
+ U.debug(
9789
9810
  "ZarrWorker",
9790
9811
  `Initialized worker pool with ${BA.length} workers`
9791
9812
  );
9792
9813
  } catch {
9793
- c.warn("ZarrWorker", "Failed to create workers - clearing pool"), uE();
9814
+ U.warn("ZarrWorker", "Failed to create workers - clearing pool"), uE();
9794
9815
  return;
9795
9816
  }
9796
9817
  }
@@ -9801,13 +9822,13 @@ async function mE(g, A, I, B) {
9801
9822
  } catch (C) {
9802
9823
  if (C instanceof DOMException && C.name === "AbortError")
9803
9824
  throw C;
9804
- return c.warn("ZarrWorker", "Falling back to main thread", C), await g.getChunk(I, B);
9825
+ return U.warn("ZarrWorker", "Falling back to main thread", C), await g.getChunk(I, B);
9805
9826
  }
9806
9827
  }
9807
9828
  function uE() {
9808
9829
  for (const g of BA)
9809
9830
  g.worker.terminate();
9810
- BA = [], cA.clear();
9831
+ BA = [], UA.clear();
9811
9832
  }
9812
9833
  class TE {
9813
9834
  promises_ = [];
@@ -9903,7 +9924,7 @@ class WE {
9903
9924
  throw new Error(
9904
9925
  "Invalid row alignment value. Possible values are 1, 2, 4, or 8"
9905
9926
  );
9906
- const a = (G, U) => typeof G == "number" ? G * U.scale + U.translation : G.start === null ? U.translation : G.start * U.scale + U.translation, D = this.dimensions_.x.lods[I], h = C[this.dimensions_.x.index], t = a(h, D), y = C[this.dimensions_.y.index], w = this.dimensions_.y.lods[I], F = a(y, w);
9927
+ const a = (G, c) => typeof G == "number" ? G * c.scale + c.translation : G.start === null ? c.translation : G.start * c.scale + c.translation, D = this.dimensions_.x.lods[I], h = C[this.dimensions_.x.index], t = a(h, D), y = C[this.dimensions_.y.index], w = this.dimensions_.y.lods[I], n = a(y, w);
9907
9928
  return {
9908
9929
  state: "loaded",
9909
9930
  lod: I,
@@ -9925,7 +9946,7 @@ class WE {
9925
9946
  y: w.scale,
9926
9947
  z: 1
9927
9948
  },
9928
- offset: { x: t, y: F, z: 0 }
9949
+ offset: { x: t, y: n, z: 0 }
9929
9950
  };
9930
9951
  }
9931
9952
  regionToIndices(A, I) {
@@ -9955,12 +9976,12 @@ function xE(g, A) {
9955
9976
  const I = g.axes.map((h) => h.name), B = g.axes.length, C = eB(I, "x"), Q = eB(I, "y"), E = (h, t) => {
9956
9977
  const y = [];
9957
9978
  for (let w = 0; w < g.datasets.length; w++) {
9958
- const F = g.datasets[w], S = A[w], G = F.coordinateTransformations[0].scale, U = F.coordinateTransformations.length === 2 ? F.coordinateTransformations[1].translation : new Array(B).fill(0);
9979
+ const n = g.datasets[w], S = A[w], G = n.coordinateTransformations[0].scale, c = n.coordinateTransformations.length === 2 ? n.coordinateTransformations[1].translation : new Array(B).fill(0);
9959
9980
  y.push({
9960
9981
  size: S.shape[t],
9961
9982
  chunkSize: S.chunks[t],
9962
9983
  scale: G[t],
9963
- translation: U[t]
9984
+ translation: c[t]
9964
9985
  });
9965
9986
  }
9966
9987
  return {
@@ -10252,7 +10273,7 @@ const JI = (g) => {
10252
10273
  message: i
10253
10274
  };
10254
10275
  }, PE = [];
10255
- function n(g, A) {
10276
+ function F(g, A) {
10256
10277
  const I = LI(), B = JI({
10257
10278
  issueData: A,
10258
10279
  data: g.data,
@@ -10313,7 +10334,7 @@ class Z {
10313
10334
  }
10314
10335
  const L = Object.freeze({
10315
10336
  status: "aborted"
10316
- }), MA = (g) => ({ status: "dirty", value: g }), P = (g) => ({ status: "valid", value: g }), ig = (g) => g.status === "aborted", og = (g) => g.status === "dirty", UA = (g) => g.status === "valid", jA = (g) => typeof Promise < "u" && g instanceof Promise;
10337
+ }), MA = (g) => ({ status: "dirty", value: g }), P = (g) => ({ status: "valid", value: g }), ig = (g) => g.status === "aborted", og = (g) => g.status === "dirty", kA = (g) => g.status === "valid", jA = (g) => typeof Promise < "u" && g instanceof Promise;
10317
10338
  function YI(g, A, I, B) {
10318
10339
  if (typeof A == "function" ? g !== A || !0 : !A.has(g)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10319
10340
  return A.get(g);
@@ -10336,7 +10357,7 @@ class iA {
10336
10357
  }
10337
10358
  }
10338
10359
  const wB = (g, A) => {
10339
- if (UA(A))
10360
+ if (kA(A))
10340
10361
  return { success: !0, data: A.value };
10341
10362
  if (!g.common.issues.length)
10342
10363
  throw new Error("Validation failed but no issues detected.");
@@ -10440,7 +10461,7 @@ class K {
10440
10461
  if (!this["~standard"].async)
10441
10462
  try {
10442
10463
  const Q = this._parseSync({ data: A, path: [], parent: C });
10443
- return UA(Q) ? {
10464
+ return kA(Q) ? {
10444
10465
  value: Q.value
10445
10466
  } : {
10446
10467
  issues: C.common.issues
@@ -10451,7 +10472,7 @@ class K {
10451
10472
  async: !0
10452
10473
  };
10453
10474
  }
10454
- return this._parseAsync({ data: A, path: [], parent: C }).then((Q) => UA(Q) ? {
10475
+ return this._parseAsync({ data: A, path: [], parent: C }).then((Q) => kA(Q) ? {
10455
10476
  value: Q.value
10456
10477
  } : {
10457
10478
  issues: C.common.issues
@@ -10617,7 +10638,7 @@ class IA extends K {
10617
10638
  _parse(A) {
10618
10639
  if (this._def.coerce && (A.data = String(A.data)), this._getType(A) !== r.string) {
10619
10640
  const Q = this._getOrReturnCtx(A);
10620
- return n(Q, {
10641
+ return F(Q, {
10621
10642
  code: e.invalid_type,
10622
10643
  expected: r.string,
10623
10644
  received: Q.parsedType
@@ -10627,7 +10648,7 @@ class IA extends K {
10627
10648
  let C;
10628
10649
  for (const Q of this._def.checks)
10629
10650
  if (Q.kind === "min")
10630
- A.data.length < Q.value && (C = this._getOrReturnCtx(A, C), n(C, {
10651
+ A.data.length < Q.value && (C = this._getOrReturnCtx(A, C), F(C, {
10631
10652
  code: e.too_small,
10632
10653
  minimum: Q.value,
10633
10654
  type: "string",
@@ -10636,7 +10657,7 @@ class IA extends K {
10636
10657
  message: Q.message
10637
10658
  }), B.dirty());
10638
10659
  else if (Q.kind === "max")
10639
- A.data.length > Q.value && (C = this._getOrReturnCtx(A, C), n(C, {
10660
+ A.data.length > Q.value && (C = this._getOrReturnCtx(A, C), F(C, {
10640
10661
  code: e.too_big,
10641
10662
  maximum: Q.value,
10642
10663
  type: "string",
@@ -10646,14 +10667,14 @@ class IA extends K {
10646
10667
  }), B.dirty());
10647
10668
  else if (Q.kind === "length") {
10648
10669
  const E = A.data.length > Q.value, i = A.data.length < Q.value;
10649
- (E || i) && (C = this._getOrReturnCtx(A, C), E ? n(C, {
10670
+ (E || i) && (C = this._getOrReturnCtx(A, C), E ? F(C, {
10650
10671
  code: e.too_big,
10651
10672
  maximum: Q.value,
10652
10673
  type: "string",
10653
10674
  inclusive: !0,
10654
10675
  exact: !0,
10655
10676
  message: Q.message
10656
- }) : i && n(C, {
10677
+ }) : i && F(C, {
10657
10678
  code: e.too_small,
10658
10679
  minimum: Q.value,
10659
10680
  type: "string",
@@ -10662,43 +10683,43 @@ class IA extends K {
10662
10683
  message: Q.message
10663
10684
  }), B.dirty());
10664
10685
  } else if (Q.kind === "email")
10665
- $E.test(A.data) || (C = this._getOrReturnCtx(A, C), n(C, {
10686
+ $E.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10666
10687
  validation: "email",
10667
10688
  code: e.invalid_string,
10668
10689
  message: Q.message
10669
10690
  }), B.dirty());
10670
10691
  else if (Q.kind === "emoji")
10671
- _I || (_I = new RegExp(Ai, "u")), _I.test(A.data) || (C = this._getOrReturnCtx(A, C), n(C, {
10692
+ _I || (_I = new RegExp(Ai, "u")), _I.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10672
10693
  validation: "emoji",
10673
10694
  code: e.invalid_string,
10674
10695
  message: Q.message
10675
10696
  }), B.dirty());
10676
10697
  else if (Q.kind === "uuid")
10677
- XE.test(A.data) || (C = this._getOrReturnCtx(A, C), n(C, {
10698
+ XE.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10678
10699
  validation: "uuid",
10679
10700
  code: e.invalid_string,
10680
10701
  message: Q.message
10681
10702
  }), B.dirty());
10682
10703
  else if (Q.kind === "nanoid")
10683
- jE.test(A.data) || (C = this._getOrReturnCtx(A, C), n(C, {
10704
+ jE.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10684
10705
  validation: "nanoid",
10685
10706
  code: e.invalid_string,
10686
10707
  message: Q.message
10687
10708
  }), B.dirty());
10688
10709
  else if (Q.kind === "cuid")
10689
- OE.test(A.data) || (C = this._getOrReturnCtx(A, C), n(C, {
10710
+ OE.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10690
10711
  validation: "cuid",
10691
10712
  code: e.invalid_string,
10692
10713
  message: Q.message
10693
10714
  }), B.dirty());
10694
10715
  else if (Q.kind === "cuid2")
10695
- VE.test(A.data) || (C = this._getOrReturnCtx(A, C), n(C, {
10716
+ VE.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10696
10717
  validation: "cuid2",
10697
10718
  code: e.invalid_string,
10698
10719
  message: Q.message
10699
10720
  }), B.dirty());
10700
10721
  else if (Q.kind === "ulid")
10701
- vE.test(A.data) || (C = this._getOrReturnCtx(A, C), n(C, {
10722
+ vE.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10702
10723
  validation: "ulid",
10703
10724
  code: e.invalid_string,
10704
10725
  message: Q.message
@@ -10707,61 +10728,61 @@ class IA extends K {
10707
10728
  try {
10708
10729
  new URL(A.data);
10709
10730
  } catch {
10710
- C = this._getOrReturnCtx(A, C), n(C, {
10731
+ C = this._getOrReturnCtx(A, C), F(C, {
10711
10732
  validation: "url",
10712
10733
  code: e.invalid_string,
10713
10734
  message: Q.message
10714
10735
  }), B.dirty();
10715
10736
  }
10716
- else Q.kind === "regex" ? (Q.regex.lastIndex = 0, Q.regex.test(A.data) || (C = this._getOrReturnCtx(A, C), n(C, {
10737
+ else Q.kind === "regex" ? (Q.regex.lastIndex = 0, Q.regex.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10717
10738
  validation: "regex",
10718
10739
  code: e.invalid_string,
10719
10740
  message: Q.message
10720
- }), B.dirty())) : Q.kind === "trim" ? A.data = A.data.trim() : Q.kind === "includes" ? A.data.includes(Q.value, Q.position) || (C = this._getOrReturnCtx(A, C), n(C, {
10741
+ }), B.dirty())) : Q.kind === "trim" ? A.data = A.data.trim() : Q.kind === "includes" ? A.data.includes(Q.value, Q.position) || (C = this._getOrReturnCtx(A, C), F(C, {
10721
10742
  code: e.invalid_string,
10722
10743
  validation: { includes: Q.value, position: Q.position },
10723
10744
  message: Q.message
10724
- }), B.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) || (C = this._getOrReturnCtx(A, C), n(C, {
10745
+ }), B.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) || (C = this._getOrReturnCtx(A, C), F(C, {
10725
10746
  code: e.invalid_string,
10726
10747
  validation: { startsWith: Q.value },
10727
10748
  message: Q.message
10728
- }), B.dirty()) : Q.kind === "endsWith" ? A.data.endsWith(Q.value) || (C = this._getOrReturnCtx(A, C), n(C, {
10749
+ }), B.dirty()) : Q.kind === "endsWith" ? A.data.endsWith(Q.value) || (C = this._getOrReturnCtx(A, C), F(C, {
10729
10750
  code: e.invalid_string,
10730
10751
  validation: { endsWith: Q.value },
10731
10752
  message: Q.message
10732
- }), B.dirty()) : Q.kind === "datetime" ? VB(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), n(C, {
10753
+ }), B.dirty()) : Q.kind === "datetime" ? VB(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10733
10754
  code: e.invalid_string,
10734
10755
  validation: "datetime",
10735
10756
  message: Q.message
10736
- }), B.dirty()) : Q.kind === "date" ? ii.test(A.data) || (C = this._getOrReturnCtx(A, C), n(C, {
10757
+ }), B.dirty()) : Q.kind === "date" ? ii.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10737
10758
  code: e.invalid_string,
10738
10759
  validation: "date",
10739
10760
  message: Q.message
10740
- }), B.dirty()) : Q.kind === "time" ? oi(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), n(C, {
10761
+ }), B.dirty()) : Q.kind === "time" ? oi(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10741
10762
  code: e.invalid_string,
10742
10763
  validation: "time",
10743
10764
  message: Q.message
10744
- }), B.dirty()) : Q.kind === "duration" ? _E.test(A.data) || (C = this._getOrReturnCtx(A, C), n(C, {
10765
+ }), B.dirty()) : Q.kind === "duration" ? _E.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10745
10766
  validation: "duration",
10746
10767
  code: e.invalid_string,
10747
10768
  message: Q.message
10748
- }), B.dirty()) : Q.kind === "ip" ? ai(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), n(C, {
10769
+ }), B.dirty()) : Q.kind === "ip" ? ai(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), F(C, {
10749
10770
  validation: "ip",
10750
10771
  code: e.invalid_string,
10751
10772
  message: Q.message
10752
- }), B.dirty()) : Q.kind === "jwt" ? Di(A.data, Q.alg) || (C = this._getOrReturnCtx(A, C), n(C, {
10773
+ }), B.dirty()) : Q.kind === "jwt" ? Di(A.data, Q.alg) || (C = this._getOrReturnCtx(A, C), F(C, {
10753
10774
  validation: "jwt",
10754
10775
  code: e.invalid_string,
10755
10776
  message: Q.message
10756
- }), B.dirty()) : Q.kind === "cidr" ? si(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), n(C, {
10777
+ }), B.dirty()) : Q.kind === "cidr" ? si(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), F(C, {
10757
10778
  validation: "cidr",
10758
10779
  code: e.invalid_string,
10759
10780
  message: Q.message
10760
- }), B.dirty()) : Q.kind === "base64" ? Qi.test(A.data) || (C = this._getOrReturnCtx(A, C), n(C, {
10781
+ }), B.dirty()) : Q.kind === "base64" ? Qi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10761
10782
  validation: "base64",
10762
10783
  code: e.invalid_string,
10763
10784
  message: Q.message
10764
- }), B.dirty()) : Q.kind === "base64url" ? Ei.test(A.data) || (C = this._getOrReturnCtx(A, C), n(C, {
10785
+ }), B.dirty()) : Q.kind === "base64url" ? Ei.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
10765
10786
  validation: "base64url",
10766
10787
  code: e.invalid_string,
10767
10788
  message: Q.message
@@ -11011,7 +11032,7 @@ class tA extends K {
11011
11032
  _parse(A) {
11012
11033
  if (this._def.coerce && (A.data = Number(A.data)), this._getType(A) !== r.number) {
11013
11034
  const Q = this._getOrReturnCtx(A);
11014
- return n(Q, {
11035
+ return F(Q, {
11015
11036
  code: e.invalid_type,
11016
11037
  expected: r.number,
11017
11038
  received: Q.parsedType
@@ -11020,30 +11041,30 @@ class tA extends K {
11020
11041
  let B;
11021
11042
  const C = new Z();
11022
11043
  for (const Q of this._def.checks)
11023
- Q.kind === "int" ? H.isInteger(A.data) || (B = this._getOrReturnCtx(A, B), n(B, {
11044
+ Q.kind === "int" ? H.isInteger(A.data) || (B = this._getOrReturnCtx(A, B), F(B, {
11024
11045
  code: e.invalid_type,
11025
11046
  expected: "integer",
11026
11047
  received: "float",
11027
11048
  message: Q.message
11028
- }), C.dirty()) : Q.kind === "min" ? (Q.inclusive ? A.data < Q.value : A.data <= Q.value) && (B = this._getOrReturnCtx(A, B), n(B, {
11049
+ }), C.dirty()) : Q.kind === "min" ? (Q.inclusive ? A.data < Q.value : A.data <= Q.value) && (B = this._getOrReturnCtx(A, B), F(B, {
11029
11050
  code: e.too_small,
11030
11051
  minimum: Q.value,
11031
11052
  type: "number",
11032
11053
  inclusive: Q.inclusive,
11033
11054
  exact: !1,
11034
11055
  message: Q.message
11035
- }), C.dirty()) : Q.kind === "max" ? (Q.inclusive ? A.data > Q.value : A.data >= Q.value) && (B = this._getOrReturnCtx(A, B), n(B, {
11056
+ }), C.dirty()) : Q.kind === "max" ? (Q.inclusive ? A.data > Q.value : A.data >= Q.value) && (B = this._getOrReturnCtx(A, B), F(B, {
11036
11057
  code: e.too_big,
11037
11058
  maximum: Q.value,
11038
11059
  type: "number",
11039
11060
  inclusive: Q.inclusive,
11040
11061
  exact: !1,
11041
11062
  message: Q.message
11042
- }), C.dirty()) : Q.kind === "multipleOf" ? hi(A.data, Q.value) !== 0 && (B = this._getOrReturnCtx(A, B), n(B, {
11063
+ }), C.dirty()) : Q.kind === "multipleOf" ? hi(A.data, Q.value) !== 0 && (B = this._getOrReturnCtx(A, B), F(B, {
11043
11064
  code: e.not_multiple_of,
11044
11065
  multipleOf: Q.value,
11045
11066
  message: Q.message
11046
- }), C.dirty()) : Q.kind === "finite" ? Number.isFinite(A.data) || (B = this._getOrReturnCtx(A, B), n(B, {
11067
+ }), C.dirty()) : Q.kind === "finite" ? Number.isFinite(A.data) || (B = this._getOrReturnCtx(A, B), F(B, {
11047
11068
  code: e.not_finite,
11048
11069
  message: Q.message
11049
11070
  }), C.dirty()) : H.assertNever(Q);
@@ -11192,19 +11213,19 @@ class yA extends K {
11192
11213
  let B;
11193
11214
  const C = new Z();
11194
11215
  for (const Q of this._def.checks)
11195
- Q.kind === "min" ? (Q.inclusive ? A.data < Q.value : A.data <= Q.value) && (B = this._getOrReturnCtx(A, B), n(B, {
11216
+ Q.kind === "min" ? (Q.inclusive ? A.data < Q.value : A.data <= Q.value) && (B = this._getOrReturnCtx(A, B), F(B, {
11196
11217
  code: e.too_small,
11197
11218
  type: "bigint",
11198
11219
  minimum: Q.value,
11199
11220
  inclusive: Q.inclusive,
11200
11221
  message: Q.message
11201
- }), C.dirty()) : Q.kind === "max" ? (Q.inclusive ? A.data > Q.value : A.data >= Q.value) && (B = this._getOrReturnCtx(A, B), n(B, {
11222
+ }), C.dirty()) : Q.kind === "max" ? (Q.inclusive ? A.data > Q.value : A.data >= Q.value) && (B = this._getOrReturnCtx(A, B), F(B, {
11202
11223
  code: e.too_big,
11203
11224
  type: "bigint",
11204
11225
  maximum: Q.value,
11205
11226
  inclusive: Q.inclusive,
11206
11227
  message: Q.message
11207
- }), C.dirty()) : Q.kind === "multipleOf" ? A.data % Q.value !== BigInt(0) && (B = this._getOrReturnCtx(A, B), n(B, {
11228
+ }), C.dirty()) : Q.kind === "multipleOf" ? A.data % Q.value !== BigInt(0) && (B = this._getOrReturnCtx(A, B), F(B, {
11208
11229
  code: e.not_multiple_of,
11209
11230
  multipleOf: Q.value,
11210
11231
  message: Q.message
@@ -11213,7 +11234,7 @@ class yA extends K {
11213
11234
  }
11214
11235
  _getInvalidInput(A) {
11215
11236
  const I = this._getOrReturnCtx(A);
11216
- return n(I, {
11237
+ return F(I, {
11217
11238
  code: e.invalid_type,
11218
11239
  expected: r.bigint,
11219
11240
  received: I.parsedType
@@ -11316,7 +11337,7 @@ class zA extends K {
11316
11337
  _parse(A) {
11317
11338
  if (this._def.coerce && (A.data = !!A.data), this._getType(A) !== r.boolean) {
11318
11339
  const B = this._getOrReturnCtx(A);
11319
- return n(B, {
11340
+ return F(B, {
11320
11341
  code: e.invalid_type,
11321
11342
  expected: r.boolean,
11322
11343
  received: B.parsedType
@@ -11330,11 +11351,11 @@ zA.create = (g) => new zA({
11330
11351
  coerce: g?.coerce || !1,
11331
11352
  ...M(g)
11332
11353
  });
11333
- class kA extends K {
11354
+ class LA extends K {
11334
11355
  _parse(A) {
11335
11356
  if (this._def.coerce && (A.data = new Date(A.data)), this._getType(A) !== r.date) {
11336
11357
  const Q = this._getOrReturnCtx(A);
11337
- return n(Q, {
11358
+ return F(Q, {
11338
11359
  code: e.invalid_type,
11339
11360
  expected: r.date,
11340
11361
  received: Q.parsedType
@@ -11342,21 +11363,21 @@ class kA extends K {
11342
11363
  }
11343
11364
  if (isNaN(A.data.getTime())) {
11344
11365
  const Q = this._getOrReturnCtx(A);
11345
- return n(Q, {
11366
+ return F(Q, {
11346
11367
  code: e.invalid_date
11347
11368
  }), L;
11348
11369
  }
11349
11370
  const B = new Z();
11350
11371
  let C;
11351
11372
  for (const Q of this._def.checks)
11352
- Q.kind === "min" ? A.data.getTime() < Q.value && (C = this._getOrReturnCtx(A, C), n(C, {
11373
+ Q.kind === "min" ? A.data.getTime() < Q.value && (C = this._getOrReturnCtx(A, C), F(C, {
11353
11374
  code: e.too_small,
11354
11375
  message: Q.message,
11355
11376
  inclusive: !0,
11356
11377
  exact: !1,
11357
11378
  minimum: Q.value,
11358
11379
  type: "date"
11359
- }), B.dirty()) : Q.kind === "max" ? A.data.getTime() > Q.value && (C = this._getOrReturnCtx(A, C), n(C, {
11380
+ }), B.dirty()) : Q.kind === "max" ? A.data.getTime() > Q.value && (C = this._getOrReturnCtx(A, C), F(C, {
11360
11381
  code: e.too_big,
11361
11382
  message: Q.message,
11362
11383
  inclusive: !0,
@@ -11370,7 +11391,7 @@ class kA extends K {
11370
11391
  };
11371
11392
  }
11372
11393
  _addCheck(A) {
11373
- return new kA({
11394
+ return new LA({
11374
11395
  ...this._def,
11375
11396
  checks: [...this._def.checks, A]
11376
11397
  });
@@ -11402,7 +11423,7 @@ class kA extends K {
11402
11423
  return A != null ? new Date(A) : null;
11403
11424
  }
11404
11425
  }
11405
- kA.create = (g) => new kA({
11426
+ LA.create = (g) => new LA({
11406
11427
  checks: [],
11407
11428
  coerce: g?.coerce || !1,
11408
11429
  typeName: k.ZodDate,
@@ -11412,7 +11433,7 @@ class dI extends K {
11412
11433
  _parse(A) {
11413
11434
  if (this._getType(A) !== r.symbol) {
11414
11435
  const B = this._getOrReturnCtx(A);
11415
- return n(B, {
11436
+ return F(B, {
11416
11437
  code: e.invalid_type,
11417
11438
  expected: r.symbol,
11418
11439
  received: B.parsedType
@@ -11429,7 +11450,7 @@ class _A extends K {
11429
11450
  _parse(A) {
11430
11451
  if (this._getType(A) !== r.undefined) {
11431
11452
  const B = this._getOrReturnCtx(A);
11432
- return n(B, {
11453
+ return F(B, {
11433
11454
  code: e.invalid_type,
11434
11455
  expected: r.undefined,
11435
11456
  received: B.parsedType
@@ -11446,7 +11467,7 @@ class $A extends K {
11446
11467
  _parse(A) {
11447
11468
  if (this._getType(A) !== r.null) {
11448
11469
  const B = this._getOrReturnCtx(A);
11449
- return n(B, {
11470
+ return F(B, {
11450
11471
  code: e.invalid_type,
11451
11472
  expected: r.null,
11452
11473
  received: B.parsedType
@@ -11471,7 +11492,7 @@ fA.create = (g) => new fA({
11471
11492
  typeName: k.ZodAny,
11472
11493
  ...M(g)
11473
11494
  });
11474
- class RA extends K {
11495
+ class NA extends K {
11475
11496
  constructor() {
11476
11497
  super(...arguments), this._unknown = !0;
11477
11498
  }
@@ -11479,14 +11500,14 @@ class RA extends K {
11479
11500
  return P(A.data);
11480
11501
  }
11481
11502
  }
11482
- RA.create = (g) => new RA({
11503
+ NA.create = (g) => new NA({
11483
11504
  typeName: k.ZodUnknown,
11484
11505
  ...M(g)
11485
11506
  });
11486
11507
  class sA extends K {
11487
11508
  _parse(A) {
11488
11509
  const I = this._getOrReturnCtx(A);
11489
- return n(I, {
11510
+ return F(I, {
11490
11511
  code: e.invalid_type,
11491
11512
  expected: r.never,
11492
11513
  received: I.parsedType
@@ -11501,7 +11522,7 @@ class MI extends K {
11501
11522
  _parse(A) {
11502
11523
  if (this._getType(A) !== r.undefined) {
11503
11524
  const B = this._getOrReturnCtx(A);
11504
- return n(B, {
11525
+ return F(B, {
11505
11526
  code: e.invalid_type,
11506
11527
  expected: r.void,
11507
11528
  received: B.parsedType
@@ -11518,14 +11539,14 @@ class CA extends K {
11518
11539
  _parse(A) {
11519
11540
  const { ctx: I, status: B } = this._processInputParams(A), C = this._def;
11520
11541
  if (I.parsedType !== r.array)
11521
- return n(I, {
11542
+ return F(I, {
11522
11543
  code: e.invalid_type,
11523
11544
  expected: r.array,
11524
11545
  received: I.parsedType
11525
11546
  }), L;
11526
11547
  if (C.exactLength !== null) {
11527
11548
  const E = I.data.length > C.exactLength.value, i = I.data.length < C.exactLength.value;
11528
- (E || i) && (n(I, {
11549
+ (E || i) && (F(I, {
11529
11550
  code: E ? e.too_big : e.too_small,
11530
11551
  minimum: i ? C.exactLength.value : void 0,
11531
11552
  maximum: E ? C.exactLength.value : void 0,
@@ -11535,14 +11556,14 @@ class CA extends K {
11535
11556
  message: C.exactLength.message
11536
11557
  }), B.dirty());
11537
11558
  }
11538
- if (C.minLength !== null && I.data.length < C.minLength.value && (n(I, {
11559
+ if (C.minLength !== null && I.data.length < C.minLength.value && (F(I, {
11539
11560
  code: e.too_small,
11540
11561
  minimum: C.minLength.value,
11541
11562
  type: "array",
11542
11563
  inclusive: !0,
11543
11564
  exact: !1,
11544
11565
  message: C.minLength.message
11545
- }), B.dirty()), C.maxLength !== null && I.data.length > C.maxLength.value && (n(I, {
11566
+ }), B.dirty()), C.maxLength !== null && I.data.length > C.maxLength.value && (F(I, {
11546
11567
  code: e.too_big,
11547
11568
  maximum: C.maxLength.value,
11548
11569
  type: "array",
@@ -11616,7 +11637,7 @@ class p extends K {
11616
11637
  _parse(A) {
11617
11638
  if (this._getType(A) !== r.object) {
11618
11639
  const a = this._getOrReturnCtx(A);
11619
- return n(a, {
11640
+ return F(a, {
11620
11641
  code: e.invalid_type,
11621
11642
  expected: r.object,
11622
11643
  received: a.parsedType
@@ -11644,7 +11665,7 @@ class p extends K {
11644
11665
  value: { status: "valid", value: C.data[D] }
11645
11666
  });
11646
11667
  else if (a === "strict")
11647
- i.length > 0 && (n(C, {
11668
+ i.length > 0 && (F(C, {
11648
11669
  code: e.unrecognized_keys,
11649
11670
  keys: i
11650
11671
  }), B.dirty());
@@ -11901,7 +11922,7 @@ class AI extends K {
11901
11922
  if (i.result.status === "dirty")
11902
11923
  return I.common.issues.push(...i.ctx.common.issues), i.result;
11903
11924
  const E = Q.map((i) => new z(i.ctx.common.issues));
11904
- return n(I, {
11925
+ return F(I, {
11905
11926
  code: e.invalid_union,
11906
11927
  unionErrors: E
11907
11928
  }), L;
@@ -11948,7 +11969,7 @@ class AI extends K {
11948
11969
  if (Q)
11949
11970
  return I.common.issues.push(...Q.ctx.common.issues), Q.result;
11950
11971
  const i = E.map((o) => new z(o));
11951
- return n(I, {
11972
+ return F(I, {
11952
11973
  code: e.invalid_union,
11953
11974
  unionErrors: i
11954
11975
  }), L;
@@ -11968,7 +11989,7 @@ class uI extends K {
11968
11989
  _parse(A) {
11969
11990
  const { ctx: I } = this._processInputParams(A);
11970
11991
  if (I.parsedType !== r.object)
11971
- return n(I, {
11992
+ return F(I, {
11972
11993
  code: e.invalid_type,
11973
11994
  expected: r.object,
11974
11995
  received: I.parsedType
@@ -11982,7 +12003,7 @@ class uI extends K {
11982
12003
  data: I.data,
11983
12004
  path: I.path,
11984
12005
  parent: I
11985
- }) : (n(I, {
12006
+ }) : (F(I, {
11986
12007
  code: e.invalid_union_discriminator,
11987
12008
  options: Array.from(this.optionsMap.keys()),
11988
12009
  path: [B]
@@ -12058,7 +12079,7 @@ class II extends K {
12058
12079
  if (ig(Q) || ig(E))
12059
12080
  return L;
12060
12081
  const i = ag(Q.value, E.value);
12061
- return i.valid ? ((og(Q) || og(E)) && I.dirty(), { status: I.value, value: i.data }) : (n(B, {
12082
+ return i.valid ? ((og(Q) || og(E)) && I.dirty(), { status: I.value, value: i.data }) : (F(B, {
12062
12083
  code: e.invalid_intersection_types
12063
12084
  }), L);
12064
12085
  };
@@ -12094,20 +12115,20 @@ class oA extends K {
12094
12115
  _parse(A) {
12095
12116
  const { status: I, ctx: B } = this._processInputParams(A);
12096
12117
  if (B.parsedType !== r.array)
12097
- return n(B, {
12118
+ return F(B, {
12098
12119
  code: e.invalid_type,
12099
12120
  expected: r.array,
12100
12121
  received: B.parsedType
12101
12122
  }), L;
12102
12123
  if (B.data.length < this._def.items.length)
12103
- return n(B, {
12124
+ return F(B, {
12104
12125
  code: e.too_small,
12105
12126
  minimum: this._def.items.length,
12106
12127
  inclusive: !0,
12107
12128
  exact: !1,
12108
12129
  type: "array"
12109
12130
  }), L;
12110
- !this._def.rest && B.data.length > this._def.items.length && (n(B, {
12131
+ !this._def.rest && B.data.length > this._def.items.length && (F(B, {
12111
12132
  code: e.too_big,
12112
12133
  maximum: this._def.items.length,
12113
12134
  inclusive: !0,
@@ -12150,7 +12171,7 @@ class gI extends K {
12150
12171
  _parse(A) {
12151
12172
  const { status: I, ctx: B } = this._processInputParams(A);
12152
12173
  if (B.parsedType !== r.object)
12153
- return n(B, {
12174
+ return F(B, {
12154
12175
  code: e.invalid_type,
12155
12176
  expected: r.object,
12156
12177
  received: B.parsedType
@@ -12191,7 +12212,7 @@ class KI extends K {
12191
12212
  _parse(A) {
12192
12213
  const { status: I, ctx: B } = this._processInputParams(A);
12193
12214
  if (B.parsedType !== r.map)
12194
- return n(B, {
12215
+ return F(B, {
12195
12216
  code: e.invalid_type,
12196
12217
  expected: r.map,
12197
12218
  received: B.parsedType
@@ -12229,24 +12250,24 @@ KI.create = (g, A, I) => new KI({
12229
12250
  typeName: k.ZodMap,
12230
12251
  ...M(I)
12231
12252
  });
12232
- class LA extends K {
12253
+ class JA extends K {
12233
12254
  _parse(A) {
12234
12255
  const { status: I, ctx: B } = this._processInputParams(A);
12235
12256
  if (B.parsedType !== r.set)
12236
- return n(B, {
12257
+ return F(B, {
12237
12258
  code: e.invalid_type,
12238
12259
  expected: r.set,
12239
12260
  received: B.parsedType
12240
12261
  }), L;
12241
12262
  const C = this._def;
12242
- C.minSize !== null && B.data.size < C.minSize.value && (n(B, {
12263
+ C.minSize !== null && B.data.size < C.minSize.value && (F(B, {
12243
12264
  code: e.too_small,
12244
12265
  minimum: C.minSize.value,
12245
12266
  type: "set",
12246
12267
  inclusive: !0,
12247
12268
  exact: !1,
12248
12269
  message: C.minSize.message
12249
- }), I.dirty()), C.maxSize !== null && B.data.size > C.maxSize.value && (n(B, {
12270
+ }), I.dirty()), C.maxSize !== null && B.data.size > C.maxSize.value && (F(B, {
12250
12271
  code: e.too_big,
12251
12272
  maximum: C.maxSize.value,
12252
12273
  type: "set",
@@ -12268,13 +12289,13 @@ class LA extends K {
12268
12289
  return B.common.async ? Promise.all(i).then((o) => E(o)) : E(i);
12269
12290
  }
12270
12291
  min(A, I) {
12271
- return new LA({
12292
+ return new JA({
12272
12293
  ...this._def,
12273
12294
  minSize: { value: A, message: R.toString(I) }
12274
12295
  });
12275
12296
  }
12276
12297
  max(A, I) {
12277
- return new LA({
12298
+ return new JA({
12278
12299
  ...this._def,
12279
12300
  maxSize: { value: A, message: R.toString(I) }
12280
12301
  });
@@ -12286,7 +12307,7 @@ class LA extends K {
12286
12307
  return this.min(1, A);
12287
12308
  }
12288
12309
  }
12289
- LA.create = (g, A) => new LA({
12310
+ JA.create = (g, A) => new JA({
12290
12311
  valueType: g,
12291
12312
  minSize: null,
12292
12313
  maxSize: null,
@@ -12300,7 +12321,7 @@ class KA extends K {
12300
12321
  _parse(A) {
12301
12322
  const { ctx: I } = this._processInputParams(A);
12302
12323
  if (I.parsedType !== r.function)
12303
- return n(I, {
12324
+ return F(I, {
12304
12325
  code: e.invalid_type,
12305
12326
  expected: r.function,
12306
12327
  received: I.parsedType
@@ -12370,7 +12391,7 @@ class KA extends K {
12370
12391
  args(...A) {
12371
12392
  return new KA({
12372
12393
  ...this._def,
12373
- args: oA.create(A).rest(RA.create())
12394
+ args: oA.create(A).rest(NA.create())
12374
12395
  });
12375
12396
  }
12376
12397
  returns(A) {
@@ -12387,8 +12408,8 @@ class KA extends K {
12387
12408
  }
12388
12409
  static create(A, I, B) {
12389
12410
  return new KA({
12390
- args: A || oA.create([]).rest(RA.create()),
12391
- returns: I || RA.create(),
12411
+ args: A || oA.create([]).rest(NA.create()),
12412
+ returns: I || NA.create(),
12392
12413
  typeName: k.ZodFunction,
12393
12414
  ...M(B)
12394
12415
  });
@@ -12412,7 +12433,7 @@ class CI extends K {
12412
12433
  _parse(A) {
12413
12434
  if (A.data !== this._def.value) {
12414
12435
  const I = this._getOrReturnCtx(A);
12415
- return n(I, {
12436
+ return F(I, {
12416
12437
  received: I.data,
12417
12438
  code: e.invalid_literal,
12418
12439
  expected: this._def.value
@@ -12443,7 +12464,7 @@ class eA extends K {
12443
12464
  _parse(A) {
12444
12465
  if (typeof A.data != "string") {
12445
12466
  const I = this._getOrReturnCtx(A), B = this._def.values;
12446
- return n(I, {
12467
+ return F(I, {
12447
12468
  expected: H.joinValues(B),
12448
12469
  received: I.parsedType,
12449
12470
  code: e.invalid_type
@@ -12451,7 +12472,7 @@ class eA extends K {
12451
12472
  }
12452
12473
  if (YI(this, bA) || ZB(this, bA, new Set(this._def.values)), !YI(this, bA).has(A.data)) {
12453
12474
  const I = this._getOrReturnCtx(A), B = this._def.values;
12454
- return n(I, {
12475
+ return F(I, {
12455
12476
  received: I.data,
12456
12477
  code: e.invalid_enum_value,
12457
12478
  options: B
@@ -12503,7 +12524,7 @@ class QI extends K {
12503
12524
  const I = H.getValidEnumValues(this._def.values), B = this._getOrReturnCtx(A);
12504
12525
  if (B.parsedType !== r.string && B.parsedType !== r.number) {
12505
12526
  const C = H.objectValues(I);
12506
- return n(B, {
12527
+ return F(B, {
12507
12528
  expected: H.joinValues(C),
12508
12529
  received: B.parsedType,
12509
12530
  code: e.invalid_type
@@ -12511,7 +12532,7 @@ class QI extends K {
12511
12532
  }
12512
12533
  if (YI(this, ZA) || ZB(this, ZA, new Set(H.getValidEnumValues(this._def.values))), !YI(this, ZA).has(A.data)) {
12513
12534
  const C = H.objectValues(I);
12514
- return n(B, {
12535
+ return F(B, {
12515
12536
  received: B.data,
12516
12537
  code: e.invalid_enum_value,
12517
12538
  options: C
@@ -12536,7 +12557,7 @@ class pA extends K {
12536
12557
  _parse(A) {
12537
12558
  const { ctx: I } = this._processInputParams(A);
12538
12559
  if (I.parsedType !== r.promise && I.common.async === !1)
12539
- return n(I, {
12560
+ return F(I, {
12540
12561
  code: e.invalid_type,
12541
12562
  expected: r.promise,
12542
12563
  received: I.parsedType
@@ -12563,7 +12584,7 @@ class QA extends K {
12563
12584
  _parse(A) {
12564
12585
  const { status: I, ctx: B } = this._processInputParams(A), C = this._def.effect || null, Q = {
12565
12586
  addIssue: (E) => {
12566
- n(B, E), E.fatal ? I.abort() : I.dirty();
12587
+ F(B, E), E.fatal ? I.abort() : I.dirty();
12567
12588
  },
12568
12589
  get path() {
12569
12590
  return B.path;
@@ -12619,14 +12640,14 @@ class QA extends K {
12619
12640
  path: B.path,
12620
12641
  parent: B
12621
12642
  });
12622
- if (!UA(E))
12643
+ if (!kA(E))
12623
12644
  return E;
12624
12645
  const i = C.transform(E.value, Q);
12625
12646
  if (i instanceof Promise)
12626
12647
  throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
12627
12648
  return { status: I.value, value: i };
12628
12649
  } else
12629
- return this._def.schema._parseAsync({ data: B.data, path: B.path, parent: B }).then((E) => UA(E) ? Promise.resolve(C.transform(E.value, Q)).then((i) => ({ status: I.value, value: i })) : E);
12650
+ return this._def.schema._parseAsync({ data: B.data, path: B.path, parent: B }).then((E) => kA(E) ? Promise.resolve(C.transform(E.value, Q)).then((i) => ({ status: I.value, value: i })) : E);
12630
12651
  H.assertNever(C);
12631
12652
  }
12632
12653
  }
@@ -12735,7 +12756,7 @@ class HI extends K {
12735
12756
  _parse(A) {
12736
12757
  if (this._getType(A) !== r.nan) {
12737
12758
  const B = this._getOrReturnCtx(A);
12738
- return n(B, {
12759
+ return F(B, {
12739
12760
  code: e.invalid_type,
12740
12761
  expected: r.nan,
12741
12762
  received: B.parsedType
@@ -12804,7 +12825,7 @@ class yI extends K {
12804
12825
  }
12805
12826
  class oI extends K {
12806
12827
  _parse(A) {
12807
- const I = this._def.innerType._parse(A), B = (C) => (UA(C) && (C.value = Object.freeze(C.value)), C);
12828
+ const I = this._def.innerType._parse(A), B = (C) => (kA(C) && (C.value = Object.freeze(C.value)), C);
12808
12829
  return jA(I) ? I.then((C) => B(C)) : B(I);
12809
12830
  }
12810
12831
  unwrap() {
@@ -12847,7 +12868,7 @@ var k;
12847
12868
  })(k || (k = {}));
12848
12869
  const ei = (g, A = {
12849
12870
  message: `Input not instance of ${g.name}`
12850
- }) => XB((I) => I instanceof g, A), jB = IA.create, zB = tA.create, Gi = HI.create, wi = yA.create, _B = zA.create, ni = kA.create, Fi = dI.create, ri = _A.create, Si = $A.create, Ri = fA.create, Ni = RA.create, ci = sA.create, Ui = MI.create, ki = CA.create, Li = p.create, Ji = p.strictCreate, Yi = AI.create, di = uI.create, Mi = II.create, Ki = oA.create, Hi = gI.create, qi = KI.create, li = LA.create, fi = KA.create, pi = BI.create, mi = CI.create, ui = eA.create, Ti = QI.create, Wi = pA.create, FB = QA.create, xi = EA.create, bi = GA.create, Zi = QA.createWithPreprocess, Pi = yI.create, Oi = () => jB().optional(), Vi = () => zB().optional(), vi = () => _B().optional(), Xi = {
12871
+ }) => XB((I) => I instanceof g, A), jB = IA.create, zB = tA.create, Gi = HI.create, wi = yA.create, _B = zA.create, ni = LA.create, Fi = dI.create, ri = _A.create, Si = $A.create, Ri = fA.create, Ni = NA.create, ci = sA.create, Ui = MI.create, ki = CA.create, Li = p.create, Ji = p.strictCreate, Yi = AI.create, di = uI.create, Mi = II.create, Ki = oA.create, Hi = gI.create, qi = KI.create, li = JA.create, fi = KA.create, pi = BI.create, mi = CI.create, ui = eA.create, Ti = QI.create, Wi = pA.create, FB = QA.create, xi = EA.create, bi = GA.create, Zi = QA.createWithPreprocess, Pi = yI.create, Oi = () => jB().optional(), Vi = () => zB().optional(), vi = () => _B().optional(), Xi = {
12851
12872
  string: (g) => IA.create({ ...g, coerce: !0 }),
12852
12873
  number: (g) => tA.create({ ...g, coerce: !0 }),
12853
12874
  boolean: (g) => zA.create({
@@ -12855,7 +12876,7 @@ const ei = (g, A = {
12855
12876
  coerce: !0
12856
12877
  }),
12857
12878
  bigint: (g) => yA.create({ ...g, coerce: !0 }),
12858
- date: (g) => kA.create({ ...g, coerce: !0 })
12879
+ date: (g) => LA.create({ ...g, coerce: !0 })
12859
12880
  }, ji = L;
12860
12881
  var s = /* @__PURE__ */ Object.freeze({
12861
12882
  __proto__: null,
@@ -12864,14 +12885,14 @@ var s = /* @__PURE__ */ Object.freeze({
12864
12885
  getErrorMap: LI,
12865
12886
  makeIssue: JI,
12866
12887
  EMPTY_PATH: PE,
12867
- addIssueToContext: n,
12888
+ addIssueToContext: F,
12868
12889
  ParseStatus: Z,
12869
12890
  INVALID: L,
12870
12891
  DIRTY: MA,
12871
12892
  OK: P,
12872
12893
  isAborted: ig,
12873
12894
  isDirty: og,
12874
- isValid: UA,
12895
+ isValid: kA,
12875
12896
  isAsync: jA,
12876
12897
  get util() {
12877
12898
  return H;
@@ -12887,12 +12908,12 @@ var s = /* @__PURE__ */ Object.freeze({
12887
12908
  ZodNumber: tA,
12888
12909
  ZodBigInt: yA,
12889
12910
  ZodBoolean: zA,
12890
- ZodDate: kA,
12911
+ ZodDate: LA,
12891
12912
  ZodSymbol: dI,
12892
12913
  ZodUndefined: _A,
12893
12914
  ZodNull: $A,
12894
12915
  ZodAny: fA,
12895
- ZodUnknown: RA,
12916
+ ZodUnknown: NA,
12896
12917
  ZodNever: sA,
12897
12918
  ZodVoid: MI,
12898
12919
  ZodArray: CA,
@@ -12903,7 +12924,7 @@ var s = /* @__PURE__ */ Object.freeze({
12903
12924
  ZodTuple: oA,
12904
12925
  ZodRecord: gI,
12905
12926
  ZodMap: KI,
12906
- ZodSet: LA,
12927
+ ZodSet: JA,
12907
12928
  ZodFunction: KA,
12908
12929
  ZodLazy: BI,
12909
12930
  ZodLiteral: CI,
@@ -13752,7 +13773,7 @@ class qo extends TA {
13752
13773
  export {
13753
13774
  wo as AxesLayer,
13754
13775
  _ as Box2,
13755
- SA as Box3,
13776
+ RA as Box3,
13756
13777
  dB as ChunkedImageLayer,
13757
13778
  l as Color,
13758
13779
  tQ as Frustum,