@idetik/core 0.23.6 → 0.24.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
@@ -590,25 +590,25 @@ function lE() {
590
590
  }
591
591
  return "development";
592
592
  }
593
- class H {
593
+ class K {
594
594
  static logLevel_ = lE() === "production" ? "warn" : "debug";
595
595
  static setLogLevel(A) {
596
- H.logLevel_ = A;
596
+ K.logLevel_ = A;
597
597
  }
598
598
  static debug(A, I, ...g) {
599
- H.log("debug", A, I, ...g);
599
+ K.log("debug", A, I, ...g);
600
600
  }
601
601
  static info(A, I, ...g) {
602
- H.log("info", A, I, ...g);
602
+ K.log("info", A, I, ...g);
603
603
  }
604
604
  static warn(A, I, ...g) {
605
- H.log("warn", A, I, ...g);
605
+ K.log("warn", A, I, ...g);
606
606
  }
607
607
  static error(A, I, ...g) {
608
- H.log("error", A, I, ...g);
608
+ K.log("error", A, I, ...g);
609
609
  }
610
610
  static log(A, I, g, ...B) {
611
- if (iC[A] < iC[H.logLevel_]) return;
611
+ if (iC[A] < iC[K.logLevel_]) return;
612
612
  const Q = (/* @__PURE__ */ new Date()).toISOString(), E = dE[A], i = `[${Q}][${A.toUpperCase()}][${I}]`, o = [`${E}${i}`, g, ...B];
613
613
  switch (A) {
614
614
  case "debug":
@@ -713,7 +713,7 @@ class LE {
713
713
  `Unsupported uniform type "${g.type}" (GLenum) found in shader program for uniform "${g.name}"`
714
714
  );
715
715
  const B = this.gl_.getUniformLocation(this.program_, g.name);
716
- B && (this.uniformInfo_.set(g.name, [B, g]), H.debug(
716
+ B && (this.uniformInfo_.set(g.name, [B, g]), K.debug(
717
717
  "WebGLShaderProgram",
718
718
  "Uniform found:",
719
719
  g.name,
@@ -846,19 +846,19 @@ function HE(C, A, I, g, B, Q, E, i, o, s, t, a, n, D, F, U) {
846
846
  return S[0] = C, S[1] = A, S[2] = I, S[3] = g, S[4] = B, S[5] = Q, S[6] = E, S[7] = i, S[8] = o, S[9] = s, S[10] = t, S[11] = a, S[12] = n, S[13] = D, S[14] = F, S[15] = U, S;
847
847
  }
848
848
  function Ng(C, A) {
849
- var I = A[0], g = A[1], B = A[2], Q = A[3], E = A[4], i = A[5], o = A[6], s = A[7], t = A[8], a = A[9], n = A[10], D = A[11], F = A[12], U = A[13], S = A[14], d = A[15], K = I * i - g * E, k = I * o - B * E, R = I * s - Q * E, L = g * o - B * i, Y = g * s - Q * i, T = B * s - Q * o, IA = t * U - a * F, CA = t * S - n * F, $ = t * d - D * F, gA = a * S - n * U, SA = a * d - D * U, NA = n * d - D * S, oA = K * NA - k * SA + R * gA + L * $ - Y * CA + T * IA;
850
- return oA ? (oA = 1 / oA, C[0] = (i * NA - o * SA + s * gA) * oA, C[1] = (B * SA - g * NA - Q * gA) * oA, C[2] = (U * T - S * Y + d * L) * oA, C[3] = (n * Y - a * T - D * L) * oA, C[4] = (o * $ - E * NA - s * CA) * oA, C[5] = (I * NA - B * $ + Q * CA) * oA, C[6] = (S * R - F * T - d * k) * oA, C[7] = (t * T - n * R + D * k) * oA, C[8] = (E * SA - i * $ + s * IA) * oA, C[9] = (g * $ - I * SA - Q * IA) * oA, C[10] = (F * Y - U * R + d * K) * oA, C[11] = (a * R - t * Y - D * K) * oA, C[12] = (i * CA - E * gA - o * IA) * oA, C[13] = (I * gA - g * CA + B * IA) * oA, C[14] = (U * k - F * L - S * K) * oA, C[15] = (t * L - a * k + n * K) * oA, C) : null;
849
+ var I = A[0], g = A[1], B = A[2], Q = A[3], E = A[4], i = A[5], o = A[6], s = A[7], t = A[8], a = A[9], n = A[10], D = A[11], F = A[12], U = A[13], S = A[14], d = A[15], H = I * i - g * E, k = I * o - B * E, R = I * s - Q * E, L = g * o - B * i, Y = g * s - Q * i, T = B * s - Q * o, IA = t * U - a * F, CA = t * S - n * F, $ = t * d - D * F, gA = a * S - n * U, SA = a * d - D * U, NA = n * d - D * S, oA = H * NA - k * SA + R * gA + L * $ - Y * CA + T * IA;
850
+ return oA ? (oA = 1 / oA, C[0] = (i * NA - o * SA + s * gA) * oA, C[1] = (B * SA - g * NA - Q * gA) * oA, C[2] = (U * T - S * Y + d * L) * oA, C[3] = (n * Y - a * T - D * L) * oA, C[4] = (o * $ - E * NA - s * CA) * oA, C[5] = (I * NA - B * $ + Q * CA) * oA, C[6] = (S * R - F * T - d * k) * oA, C[7] = (t * T - n * R + D * k) * oA, C[8] = (E * SA - i * $ + s * IA) * oA, C[9] = (g * $ - I * SA - Q * IA) * oA, C[10] = (F * Y - U * R + d * H) * oA, C[11] = (a * R - t * Y - D * H) * oA, C[12] = (i * CA - E * gA - o * IA) * oA, C[13] = (I * gA - g * CA + B * IA) * oA, C[14] = (U * k - F * L - S * H) * oA, C[15] = (t * L - a * k + n * H) * oA, C) : null;
851
851
  }
852
852
  function OA(C, A, I) {
853
- var g = A[0], B = A[1], Q = A[2], E = A[3], i = A[4], o = A[5], s = A[6], t = A[7], a = A[8], n = A[9], D = A[10], F = A[11], U = A[12], S = A[13], d = A[14], K = A[15], k = I[0], R = I[1], L = I[2], Y = I[3];
854
- return C[0] = k * g + R * i + L * a + Y * U, C[1] = k * B + R * o + L * n + Y * S, C[2] = k * Q + R * s + L * D + Y * d, C[3] = k * E + R * t + L * F + Y * K, k = I[4], R = I[5], L = I[6], Y = I[7], C[4] = k * g + R * i + L * a + Y * U, C[5] = k * B + R * o + L * n + Y * S, C[6] = k * Q + R * s + L * D + Y * d, C[7] = k * E + R * t + L * F + Y * K, k = I[8], R = I[9], L = I[10], Y = I[11], C[8] = k * g + R * i + L * a + Y * U, C[9] = k * B + R * o + L * n + Y * S, C[10] = k * Q + R * s + L * D + Y * d, C[11] = k * E + R * t + L * F + Y * K, k = I[12], R = I[13], L = I[14], Y = I[15], C[12] = k * g + R * i + L * a + Y * U, C[13] = k * B + R * o + L * n + Y * S, C[14] = k * Q + R * s + L * D + Y * d, C[15] = k * E + R * t + L * F + Y * K, C;
853
+ var g = A[0], B = A[1], Q = A[2], E = A[3], i = A[4], o = A[5], s = A[6], t = A[7], a = A[8], n = A[9], D = A[10], F = A[11], U = A[12], S = A[13], d = A[14], H = A[15], k = I[0], R = I[1], L = I[2], Y = I[3];
854
+ return C[0] = k * g + R * i + L * a + Y * U, C[1] = k * B + R * o + L * n + Y * S, C[2] = k * Q + R * s + L * D + Y * d, C[3] = k * E + R * t + L * F + Y * H, k = I[4], R = I[5], L = I[6], Y = I[7], C[4] = k * g + R * i + L * a + Y * U, C[5] = k * B + R * o + L * n + Y * S, C[6] = k * Q + R * s + L * D + Y * d, C[7] = k * E + R * t + L * F + Y * H, k = I[8], R = I[9], L = I[10], Y = I[11], C[8] = k * g + R * i + L * a + Y * U, C[9] = k * B + R * o + L * n + Y * S, C[10] = k * Q + R * s + L * D + Y * d, C[11] = k * E + R * t + L * F + Y * H, k = I[12], R = I[13], L = I[14], Y = I[15], C[12] = k * g + R * i + L * a + Y * U, C[13] = k * B + R * o + L * n + Y * S, C[14] = k * Q + R * s + L * D + Y * d, C[15] = k * E + R * t + L * F + Y * H, C;
855
855
  }
856
856
  function qE(C, A) {
857
857
  return C[0] = A[0], C[1] = 0, C[2] = 0, C[3] = 0, C[4] = 0, C[5] = A[1], C[6] = 0, C[7] = 0, C[8] = 0, C[9] = 0, C[10] = A[2], C[11] = 0, C[12] = 0, C[13] = 0, C[14] = 0, C[15] = 1, C;
858
858
  }
859
859
  function pE(C, A, I, g) {
860
- var B = A[0], Q = A[1], E = A[2], i = A[3], o = B + B, s = Q + Q, t = E + E, a = B * o, n = B * s, D = B * t, F = Q * s, U = Q * t, S = E * t, d = i * o, K = i * s, k = i * t, R = g[0], L = g[1], Y = g[2];
861
- return C[0] = (1 - (F + S)) * R, C[1] = (n + k) * R, C[2] = (D - K) * R, C[3] = 0, C[4] = (n - k) * L, C[5] = (1 - (a + S)) * L, C[6] = (U + d) * L, C[7] = 0, C[8] = (D + K) * Y, C[9] = (U - d) * Y, C[10] = (1 - (a + F)) * Y, C[11] = 0, C[12] = I[0], C[13] = I[1], C[14] = I[2], C[15] = 1, C;
860
+ var B = A[0], Q = A[1], E = A[2], i = A[3], o = B + B, s = Q + Q, t = E + E, a = B * o, n = B * s, D = B * t, F = Q * s, U = Q * t, S = E * t, d = i * o, H = i * s, k = i * t, R = g[0], L = g[1], Y = g[2];
861
+ return C[0] = (1 - (F + S)) * R, C[1] = (n + k) * R, C[2] = (D - H) * R, C[3] = 0, C[4] = (n - k) * L, C[5] = (1 - (a + S)) * L, C[6] = (U + d) * L, C[7] = 0, C[8] = (D + H) * Y, C[9] = (U - d) * Y, C[10] = (1 - (a + F)) * Y, C[11] = 0, C[12] = I[0], C[13] = I[1], C[14] = I[2], C[15] = 1, C;
862
862
  }
863
863
  function mE(C, A, I, g, B) {
864
864
  var Q = 1 / Math.tan(A / 2);
@@ -882,8 +882,8 @@ function WE(C, A, I, g) {
882
882
  return D = F * F + U * U + S * S, D > 0 && (D = 1 / Math.sqrt(D), F *= D, U *= D, S *= D), C[0] = F, C[1] = U, C[2] = S, C[3] = 0, C[4] = a * S - n * U, C[5] = n * F - t * S, C[6] = t * U - a * F, C[7] = 0, C[8] = t, C[9] = a, C[10] = n, C[11] = 0, C[12] = B, C[13] = Q, C[14] = E, C[15] = 1, C;
883
883
  }
884
884
  function vE(C, A) {
885
- var I = C[0], g = C[1], B = C[2], Q = C[3], E = C[4], i = C[5], o = C[6], s = C[7], t = C[8], a = C[9], n = C[10], D = C[11], F = C[12], U = C[13], S = C[14], d = C[15], K = A[0], k = A[1], R = A[2], L = A[3], Y = A[4], T = A[5], IA = A[6], CA = A[7], $ = A[8], gA = A[9], SA = A[10], NA = A[11], oA = A[12], CC = A[13], QC = A[14], EC = A[15];
886
- return Math.abs(I - K) <= AA * Math.max(1, Math.abs(I), Math.abs(K)) && Math.abs(g - k) <= AA * Math.max(1, Math.abs(g), Math.abs(k)) && Math.abs(B - R) <= AA * Math.max(1, Math.abs(B), Math.abs(R)) && Math.abs(Q - L) <= AA * Math.max(1, Math.abs(Q), Math.abs(L)) && Math.abs(E - Y) <= AA * Math.max(1, Math.abs(E), Math.abs(Y)) && Math.abs(i - T) <= AA * Math.max(1, Math.abs(i), Math.abs(T)) && Math.abs(o - IA) <= AA * Math.max(1, Math.abs(o), Math.abs(IA)) && Math.abs(s - CA) <= AA * Math.max(1, Math.abs(s), Math.abs(CA)) && Math.abs(t - $) <= AA * Math.max(1, Math.abs(t), Math.abs($)) && Math.abs(a - gA) <= AA * Math.max(1, Math.abs(a), Math.abs(gA)) && Math.abs(n - SA) <= AA * Math.max(1, Math.abs(n), Math.abs(SA)) && Math.abs(D - NA) <= AA * Math.max(1, Math.abs(D), Math.abs(NA)) && Math.abs(F - oA) <= AA * Math.max(1, Math.abs(F), Math.abs(oA)) && Math.abs(U - CC) <= AA * Math.max(1, Math.abs(U), Math.abs(CC)) && Math.abs(S - QC) <= AA * Math.max(1, Math.abs(S), Math.abs(QC)) && Math.abs(d - EC) <= AA * Math.max(1, Math.abs(d), Math.abs(EC));
885
+ var I = C[0], g = C[1], B = C[2], Q = C[3], E = C[4], i = C[5], o = C[6], s = C[7], t = C[8], a = C[9], n = C[10], D = C[11], F = C[12], U = C[13], S = C[14], d = C[15], H = A[0], k = A[1], R = A[2], L = A[3], Y = A[4], T = A[5], IA = A[6], CA = A[7], $ = A[8], gA = A[9], SA = A[10], NA = A[11], oA = A[12], CC = A[13], QC = A[14], EC = A[15];
886
+ return Math.abs(I - H) <= AA * Math.max(1, Math.abs(I), Math.abs(H)) && Math.abs(g - k) <= AA * Math.max(1, Math.abs(g), Math.abs(k)) && Math.abs(B - R) <= AA * Math.max(1, Math.abs(B), Math.abs(R)) && Math.abs(Q - L) <= AA * Math.max(1, Math.abs(Q), Math.abs(L)) && Math.abs(E - Y) <= AA * Math.max(1, Math.abs(E), Math.abs(Y)) && Math.abs(i - T) <= AA * Math.max(1, Math.abs(i), Math.abs(T)) && Math.abs(o - IA) <= AA * Math.max(1, Math.abs(o), Math.abs(IA)) && Math.abs(s - CA) <= AA * Math.max(1, Math.abs(s), Math.abs(CA)) && Math.abs(t - $) <= AA * Math.max(1, Math.abs(t), Math.abs($)) && Math.abs(a - gA) <= AA * Math.max(1, Math.abs(a), Math.abs(gA)) && Math.abs(n - SA) <= AA * Math.max(1, Math.abs(n), Math.abs(SA)) && Math.abs(D - NA) <= AA * Math.max(1, Math.abs(D), Math.abs(NA)) && Math.abs(F - oA) <= AA * Math.max(1, Math.abs(F), Math.abs(oA)) && Math.abs(U - CC) <= AA * Math.max(1, Math.abs(U), Math.abs(CC)) && Math.abs(S - QC) <= AA * Math.max(1, Math.abs(S), Math.abs(QC)) && Math.abs(d - EC) <= AA * Math.max(1, Math.abs(d), Math.abs(EC));
887
887
  }
888
888
  function EA() {
889
889
  var C = new DA(3);
@@ -1356,7 +1356,7 @@ class oi {
1356
1356
  getFilter(A, I) {
1357
1357
  const { dataFormat: g, dataType: B } = I;
1358
1358
  if (g === "scalar" && B !== "float" && A !== "nearest")
1359
- return H.warn(
1359
+ return K.warn(
1360
1360
  "WebGLTexture",
1361
1361
  "Integer values are not filterable. Using gl.NEAREST instead."
1362
1362
  ), this.gl_.NEAREST;
@@ -1640,7 +1640,7 @@ class nC extends hQ {
1640
1640
  });
1641
1641
  if (!I)
1642
1642
  throw new Error("Failed to initialize WebGL2 context");
1643
- this.gl_ = I, H.info(
1643
+ this.gl_ = I, K.info(
1644
1644
  "WebGLRenderer",
1645
1645
  `WebGL version ${I.getParameter(I.VERSION)}`
1646
1646
  ), this.programs_ = new ME(I), this.bindings_ = new ii(I), this.textures_ = new oi(I), this.state_ = new si(I), this.initStencil(), this.resize(this.canvas.width, this.canvas.height);
@@ -1668,7 +1668,7 @@ class nC extends hQ {
1668
1668
  else if (i)
1669
1669
  this.state_.setScissorTest(!0), this.state_.setScissor(B);
1670
1670
  else {
1671
- H.warn(
1671
+ K.warn(
1672
1672
  "WebGLRenderer",
1673
1673
  `Viewport ${A.id} is entirely outside canvas bounds, skipping render`
1674
1674
  );
@@ -3925,9 +3925,9 @@ class xA extends uA {
3925
3925
  }
3926
3926
  setPixel(A, I, g, B, Q) {
3927
3927
  const E = this.texelByteSize, i = this.bytesPerRow, o = this.height, s = this.data[B];
3928
- (function(t, a, n, D, F, U, S, d, K, k) {
3928
+ (function(t, a, n, D, F, U, S, d, H, k) {
3929
3929
  const R = D * (S >>= F) * (U >>= F) + n * S + a * d;
3930
- switch (K) {
3930
+ switch (H) {
3931
3931
  case "r8unorm":
3932
3932
  return void _(t, R, "8unorm", 1, k);
3933
3933
  case "r8snorm":
@@ -5480,9 +5480,9 @@ class BA extends Io {
5480
5480
  var S;
5481
5481
  const d = U.node;
5482
5482
  if (d?.attributes) {
5483
- let K = null, k = null;
5484
- for (const R of d.attributes) R.name === "binding" ? K = R.value : R.name === "group" && (k = R.value);
5485
- if (D === K && n === k) {
5483
+ let H = null, k = null;
5484
+ for (const R of d.attributes) R.name === "binding" ? H = R.value : R.name === "group" && (k = R.value);
5485
+ if (D === H && n === k) {
5486
5486
  let R = !1;
5487
5487
  for (const L of a.resources) if (L.name === U.name && L.group === parseInt(n) && L.binding === parseInt(D)) {
5488
5488
  R = !0;
@@ -6126,14 +6126,14 @@ class BA extends Io {
6126
6126
  if (J(Q) && J(E)) {
6127
6127
  const t = Q, a = E;
6128
6128
  if (this._isMatrixType(g) && this._isMatrixType(B)) {
6129
- const n = (function(S, d, K, k) {
6129
+ const n = (function(S, d, H, k) {
6130
6130
  if (cA[d.name] === void 0 || cA[k.name] === void 0) return null;
6131
6131
  const R = cA[d.name][0], L = cA[d.name][1], Y = cA[k.name][0];
6132
6132
  if (R !== cA[k.name][1]) return null;
6133
6133
  const T = new Array(Y * L);
6134
6134
  for (let IA = 0; IA < L; IA++) for (let CA = 0; CA < Y; CA++) {
6135
6135
  let $ = 0;
6136
- for (let gA = 0; gA < R; gA++) $ += S[gA * L + IA] * K[CA * R + gA];
6136
+ for (let gA = 0; gA < R; gA++) $ += S[gA * L + IA] * H[CA * R + gA];
6137
6137
  T[IA * Y + CA] = $;
6138
6138
  }
6139
6139
  return T;
@@ -6145,12 +6145,12 @@ class BA extends Io {
6145
6145
  if (this._isMatrixType(g) && this._isVectorType(B)) {
6146
6146
  const n = (function(D, F, U, S) {
6147
6147
  if (cA[F.name] === void 0 || qg[S.name] === void 0) return null;
6148
- const d = cA[F.name][0], K = cA[F.name][1];
6148
+ const d = cA[F.name][0], H = cA[F.name][1];
6149
6149
  if (d !== U.length) return null;
6150
- const k = new Array(K);
6151
- for (let R = 0; R < K; R++) {
6150
+ const k = new Array(H);
6151
+ for (let R = 0; R < H; R++) {
6152
6152
  let L = 0;
6153
- for (let Y = 0; Y < d; Y++) L += D[Y * K + R] * U[Y];
6153
+ for (let Y = 0; Y < d; Y++) L += D[Y * H + R] * U[Y];
6154
6154
  k[R] = L;
6155
6155
  }
6156
6156
  return k;
@@ -6160,12 +6160,12 @@ class BA extends Io {
6160
6160
  if (this._isVectorType(g) && this._isMatrixType(B)) {
6161
6161
  const n = (function(D, F, U, S) {
6162
6162
  if (qg[F.name] === void 0 || cA[S.name] === void 0) return null;
6163
- const d = cA[S.name][0], K = cA[S.name][1];
6164
- if (K !== D.length) return null;
6163
+ const d = cA[S.name][0], H = cA[S.name][1];
6164
+ if (H !== D.length) return null;
6165
6165
  const k = [];
6166
6166
  for (let R = 0; R < d; R++) {
6167
6167
  let L = 0;
6168
- for (let Y = 0; Y < K; Y++) L += D[Y] * U[Y * d + R];
6168
+ for (let Y = 0; Y < H; Y++) L += D[Y] * U[Y * d + R];
6169
6169
  k[R] = L;
6170
6170
  }
6171
6171
  return k;
@@ -8154,7 +8154,7 @@ async function Fo(C, A) {
8154
8154
  const I = await A.getCompilationInfo();
8155
8155
  if (I.messages.some((g) => g.type === "error")) {
8156
8156
  for (const g of I.messages)
8157
- H.error("WebGPUPipelines", `${g.type}: ${g.message}`);
8157
+ K.error("WebGPUPipelines", `${g.type}: ${g.message}`);
8158
8158
  throw new Error(`Failed to compile WGSL shader ${C}.wgsl`);
8159
8159
  }
8160
8160
  }
@@ -8275,7 +8275,7 @@ class Lo extends hQ {
8275
8275
  I,
8276
8276
  this.colorFormat_,
8277
8277
  this.depthFormat_
8278
- ), H.info("WebGPURenderer", "WebGPU Initialized"), this.resize(this.width, this.height);
8278
+ ), K.info("WebGPURenderer", "WebGPU Initialized"), this.resize(this.width, this.height);
8279
8279
  }
8280
8280
  async compileShaders() {
8281
8281
  await Promise.all([
@@ -8300,7 +8300,7 @@ class Lo extends hQ {
8300
8300
  eA(this.width, this.height)
8301
8301
  );
8302
8302
  if (!GA.intersects(B, Q)) {
8303
- H.warn(
8303
+ K.warn(
8304
8304
  "WebGPURenderer",
8305
8305
  `Viewport ${A.id} is entirely outside canvas bounds`
8306
8306
  );
@@ -8507,11 +8507,11 @@ class Mo {
8507
8507
  cancel(A) {
8508
8508
  const I = this.pending_.findIndex((B) => B.chunk === A);
8509
8509
  if (I >= 0) {
8510
- this.pending_.splice(I, 1), H.debug("ChunkQueue", "Cancelled pending request");
8510
+ this.pending_.splice(I, 1), K.debug("ChunkQueue", "Cancelled pending request");
8511
8511
  return;
8512
8512
  }
8513
8513
  const g = this.running_.get(A);
8514
- g && (g.controller.abort(), H.debug("ChunkQueue", "Cancelled fetch request"));
8514
+ g && (g.controller.abort(), K.debug("ChunkQueue", "Cancelled fetch request"));
8515
8515
  }
8516
8516
  get pendingCount() {
8517
8517
  return this.pending_.length;
@@ -8535,7 +8535,7 @@ class Mo {
8535
8535
  I.state === "loading" && (I.state = "loaded");
8536
8536
  },
8537
8537
  (E) => {
8538
- I.state === "loading" && (I.state = "unloaded"), E.name !== "AbortError" && H.error("ChunkQueue", String(E));
8538
+ I.state === "loading" && (I.state = "unloaded"), E.name !== "AbortError" && K.error("ChunkQueue", String(E));
8539
8539
  }
8540
8540
  ).finally(() => {
8541
8541
  this.running_.delete(I), this.pump();
@@ -8569,7 +8569,7 @@ function Ho(C) {
8569
8569
  if (dC.some((I) => C instanceof I))
8570
8570
  return !0;
8571
8571
  const A = dC.map((I) => I.name);
8572
- return H.debug(
8572
+ return K.debug(
8573
8573
  "Chunk",
8574
8574
  `Unsupported chunk data type: ${C}. Supported data types: ${A}`
8575
8575
  ), !1;
@@ -8595,7 +8595,7 @@ class po {
8595
8595
  chunkViewStates_ = /* @__PURE__ */ new Map();
8596
8596
  isDisposed_ = !1;
8597
8597
  constructor(A, I) {
8598
- this.store_ = A, this.policy_ = I, H.info(
8598
+ this.store_ = A, this.policy_ = I, K.info(
8599
8599
  "ChunkStoreView",
8600
8600
  "Using image source policy:",
8601
8601
  this.policy_.profile
@@ -8635,7 +8635,7 @@ class po {
8635
8635
  if (!(this.policyChanged_ || this.viewBounds2DChanged(Q) || this.zBoundsChanged(a) || this.lastTCoord_ !== A.t || this.cCoordsChanged(A.c))) return;
8636
8636
  const D = this.timeIndex(A);
8637
8637
  if (!this.store_.hasChunksAtTime(D)) {
8638
- H.warn(
8638
+ K.warn(
8639
8639
  "ChunkStoreView",
8640
8640
  "updateChunkViewStates called with no chunks initialized"
8641
8641
  ), this.chunkViewStates_.clear();
@@ -8648,13 +8648,13 @@ class po {
8648
8648
  P(Q.max[0], Q.max[1], S)
8649
8649
  );
8650
8650
  this.chunkViewStates_.forEach(bg);
8651
- const K = this.channelsOfInterest(A), k = this.fallbackLOD(), R = this.getPaddedBounds(d), L = this.currentLOD_ === k ? [this.currentLOD_] : [this.currentLOD_, k];
8651
+ const H = this.channelsOfInterest(A), k = this.fallbackLOD(), R = this.getPaddedBounds(d), L = this.currentLOD_ === k ? [this.currentLOD_] : [this.currentLOD_, k];
8652
8652
  for (const Y of L) {
8653
8653
  const T = Y === this.currentLOD_, IA = Y === k;
8654
8654
  this.iterateChunksInBox(
8655
8655
  D,
8656
8656
  Y,
8657
- K,
8657
+ H,
8658
8658
  R,
8659
8659
  (CA, $) => {
8660
8660
  const gA = II.intersects($, d), SA = T && !gA, NA = this.computePriority(
@@ -8689,7 +8689,7 @@ class po {
8689
8689
  if (!(this.policyChanged_ || this.hasViewProjectionChanged(g) || this.lastTCoord_ !== A.t || this.cCoordsChanged(A.c))) return;
8690
8690
  const Q = this.timeIndex(A);
8691
8691
  if (!this.store_.hasChunksAtTime(Q)) {
8692
- H.warn(
8692
+ K.warn(
8693
8693
  "ChunkStoreView",
8694
8694
  "updateChunksForVolume called with no chunks initialized"
8695
8695
  ), this.chunkViewStates_.clear();
@@ -8744,7 +8744,7 @@ class po {
8744
8744
  setImageSourcePolicy(A, I) {
8745
8745
  if (I !== kg)
8746
8746
  throw new Error("Unauthorized policy mutation");
8747
- this.policy_ !== A && (this.policy_ = A, this.policyChanged_ = !0, H.info(
8747
+ this.policy_ !== A && (this.policy_ = A, this.policyChanged_ = !0, K.info(
8748
8748
  "ChunkStoreView",
8749
8749
  "Using image source policy:",
8750
8750
  this.policy_.profile
@@ -8816,8 +8816,8 @@ class po {
8816
8816
  // Half-open chunk-index range [min, max) at a given LOD that covers `bounds`.
8817
8817
  // Returns null if the bounds don't overlap the data grid.
8818
8818
  chunkIndexRange(A, I) {
8819
- const g = this.store_.dimensions, B = g.x.lods[I], Q = g.y.lods[I], E = g.z?.lods[I], i = Math.ceil(B.size / B.chunkSize), o = Math.ceil(Q.size / Q.chunkSize), s = E ? Math.ceil(E.size / E.chunkSize) : 1, t = B.chunkSize * B.scale, a = Q.chunkSize * Q.scale, n = E ? E.chunkSize * E.scale : 1, D = B.translation, F = Q.translation, U = E?.translation ?? 0, S = Math.max(0, Math.floor((A.min[0] - D) / t)), d = Math.min(i, Math.ceil((A.max[0] - D) / t)), K = Math.max(0, Math.floor((A.min[1] - F) / a)), k = Math.min(o, Math.ceil((A.max[1] - F) / a)), R = E ? Math.max(0, Math.floor((A.min[2] - U) / n)) : 0, L = E ? Math.min(s, Math.ceil((A.max[2] - U) / n)) : 1;
8820
- return S >= d || K >= k || R >= L ? null : { xMin: S, xMax: d, yMin: K, yMax: k, zMin: R, zMax: L };
8819
+ const g = this.store_.dimensions, B = g.x.lods[I], Q = g.y.lods[I], E = g.z?.lods[I], i = Math.ceil(B.size / B.chunkSize), o = Math.ceil(Q.size / Q.chunkSize), s = E ? Math.ceil(E.size / E.chunkSize) : 1, t = B.chunkSize * B.scale, a = Q.chunkSize * Q.scale, n = E ? E.chunkSize * E.scale : 1, D = B.translation, F = Q.translation, U = E?.translation ?? 0, S = Math.max(0, Math.floor((A.min[0] - D) / t)), d = Math.min(i, Math.ceil((A.max[0] - D) / t)), H = Math.max(0, Math.floor((A.min[1] - F) / a)), k = Math.min(o, Math.ceil((A.max[1] - F) / a)), R = E ? Math.max(0, Math.floor((A.min[2] - U) / n)) : 0, L = E ? Math.min(s, Math.ceil((A.max[2] - U) / n)) : 1;
8820
+ return S >= d || H >= k || R >= L ? null : { xMin: S, xMax: d, yMin: H, yMax: k, zMin: R, zMax: L };
8821
8821
  }
8822
8822
  iterateChunksInBox(A, I, g, B, Q) {
8823
8823
  const E = this.chunkIndexRange(B, I);
@@ -8940,9 +8940,9 @@ class mo {
8940
8940
  for (let S = 0; S < I; ++S) {
8941
8941
  const d = new Array(g);
8942
8942
  U[S] = d;
8943
- for (let K = 0; K < g; ++K) {
8943
+ for (let H = 0; H < g; ++H) {
8944
8944
  const k = new Array(F);
8945
- d[K] = k;
8945
+ d[H] = k;
8946
8946
  for (let R = 0; R < F; ++R) {
8947
8947
  const L = o !== void 0 ? o.translation + R * a * o.scale : 0, Y = new Array(D);
8948
8948
  k[R] = Y;
@@ -8965,7 +8965,7 @@ class mo {
8965
8965
  c: 1
8966
8966
  },
8967
8967
  rowAlignmentBytes: 1,
8968
- chunkIndex: { x: $, y: T, z: R, c: K, t: S },
8968
+ chunkIndex: { x: $, y: T, z: R, c: H, t: S },
8969
8969
  scale: {
8970
8970
  x: E.scale,
8971
8971
  y: i.scale,
@@ -9047,7 +9047,7 @@ class mo {
9047
9047
  throw new Error(
9048
9048
  `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}`
9049
9049
  );
9050
- uo(A), A.state = "unloaded", A.orderKey = null, H.debug(
9050
+ uo(A), A.state = "unloaded", A.orderKey = null, K.debug(
9051
9051
  "ChunkStore",
9052
9052
  `Disposing chunk ${JSON.stringify(A.chunkIndex)} in LOD ${A.lod}`
9053
9053
  );
@@ -9081,7 +9081,7 @@ class mo {
9081
9081
  for (let A = 0; A < this.dimensions_.numLods; ++A) {
9082
9082
  const I = this.dimensions_.c?.lods[A];
9083
9083
  if (!I) continue;
9084
- if (I.scale !== 1 && H.warn(
9084
+ if (I.scale !== 1 && K.warn(
9085
9085
  "ChunkStore",
9086
9086
  `Idetik does not make use of non-unity scale in c. Found ${I.scale} at LOD ${A}`
9087
9087
  ), I.translation !== 0)
@@ -9123,12 +9123,21 @@ class xo {
9123
9123
  if (g)
9124
9124
  return g;
9125
9125
  const Q = (async () => {
9126
- const i = await A.open();
9127
- return new mo(i);
9126
+ const E = await A.open();
9127
+ return new mo(E);
9128
9128
  })();
9129
9129
  this.pendingStores_.set(A, Q);
9130
- const E = await Q;
9131
- return this.stores_.set(A, E), this.pendingStores_.delete(A), E;
9130
+ try {
9131
+ const E = await Q;
9132
+ return this.stores_.set(A, E), E;
9133
+ } catch (E) {
9134
+ throw K.error(
9135
+ "ChunkManager",
9136
+ `Failed to open chunk source: ${String(E)}`
9137
+ ), E;
9138
+ } finally {
9139
+ this.pendingStores_.delete(A);
9140
+ }
9132
9141
  }
9133
9142
  update() {
9134
9143
  for (const [A, I] of this.stores_) {
@@ -9191,8 +9200,8 @@ uI.Panel = function(C, A, I, g) {
9191
9200
  var d = S.getContext("2d");
9192
9201
  return d.font = "bold " + E(9 * i * g) + "px Helvetica,Arial,sans-serif", d.textBaseline = "top", d.fillStyle = I, d.fillRect(0, 0, o, s), d.fillStyle = A, d.fillText(C, t, a), d.fillRect(n, D, F, U), d.fillStyle = I, d.globalAlpha = 0.9, d.fillRect(n, D, F, U), {
9193
9202
  dom: S,
9194
- update: function(K, k) {
9195
- B = Math.min(B, K), Q = Math.max(Q, K), d.fillStyle = I, d.globalAlpha = 1, d.fillRect(0, 0, o, D), d.fillStyle = A, d.fillText(E(K) + " " + C + " (" + E(B) + "-" + E(Q) + ")", t, a), d.drawImage(S, n + i, D, F - i, U, n, D, F - i, U), d.fillRect(n + F - i, D, i, U), d.fillStyle = I, d.globalAlpha = 0.9, d.fillRect(n + F - i, D, i, E((1 - K / k) * U));
9203
+ update: function(H, k) {
9204
+ B = Math.min(B, H), Q = Math.max(Q, H), d.fillStyle = I, d.globalAlpha = 1, d.fillRect(0, 0, o, D), d.fillStyle = A, d.fillText(E(H) + " " + C + " (" + E(B) + "-" + E(Q) + ")", t, a), d.drawImage(S, n + i, D, F - i, U, n, D, F - i, U), d.fillRect(n + F - i, D, i, U), d.fillStyle = I, d.globalAlpha = 0.9, d.fillRect(n + F - i, D, i, E((1 - H / k) * U));
9196
9205
  }
9197
9206
  };
9198
9207
  };
@@ -9241,7 +9250,7 @@ class vo {
9241
9250
  }
9242
9251
  connect() {
9243
9252
  if (this.isConnected_) {
9244
- H.warn(
9253
+ K.warn(
9245
9254
  "EventDispatcher",
9246
9255
  "Attempted to connect already connected event dispatcher",
9247
9256
  `element id: ${this.element_.id}`
@@ -9256,7 +9265,7 @@ class vo {
9256
9265
  }
9257
9266
  disconnect() {
9258
9267
  if (!this.isConnected_) {
9259
- H.debug(
9268
+ K.debug(
9260
9269
  "EventDispatcher",
9261
9270
  "Attempted to disconnect already disconnected event dispatcher",
9262
9271
  `element id: ${this.element_.id}`
@@ -9269,7 +9278,7 @@ class vo {
9269
9278
  }
9270
9279
  handleEvent = (A) => {
9271
9280
  if (!To(A.type)) {
9272
- H.error("EventDispatcher", `Unsupported event type ${A.type}`);
9281
+ K.error("EventDispatcher", `Unsupported event type ${A.type}`);
9273
9282
  return;
9274
9283
  }
9275
9284
  const I = new Wo(A.type, A);
@@ -9350,7 +9359,7 @@ class Zo {
9350
9359
  updateAspectRatio() {
9351
9360
  const { width: A, height: I } = this.getBox().toRect();
9352
9361
  if (A <= 0 || I <= 0) {
9353
- H.debug(
9362
+ K.debug(
9354
9363
  "Viewport",
9355
9364
  `Skipping aspect ratio update for viewport ${this.id}: invalid dimensions ${A}x${I}`
9356
9365
  );
@@ -9401,7 +9410,7 @@ class Vo {
9401
9410
  }
9402
9411
  connect() {
9403
9412
  if (this.resizeObserver_) {
9404
- H.warn(
9413
+ K.warn(
9405
9414
  "PixelSizeObserver",
9406
9415
  "Attempted to connect already connected observer"
9407
9416
  );
@@ -9425,7 +9434,7 @@ class Vo {
9425
9434
  }
9426
9435
  disconnect() {
9427
9436
  if (!this.resizeObserver_) {
9428
- H.warn(
9437
+ K.warn(
9429
9438
  "PixelSizeObserver",
9430
9439
  "Attempted to disconnect already disconnected observer"
9431
9440
  );
@@ -9435,7 +9444,7 @@ class Vo {
9435
9444
  }
9436
9445
  observe(A) {
9437
9446
  if (this.elements_.includes(A)) {
9438
- H.warn("PixelSizeObserver", "Element already being observed");
9447
+ K.warn("PixelSizeObserver", "Element already being observed");
9439
9448
  return;
9440
9449
  }
9441
9450
  this.elements_.push(A), this.resizeObserver_ && this.resizeObserver_.observe(A);
@@ -9443,7 +9452,7 @@ class Vo {
9443
9452
  unobserve(A) {
9444
9453
  const I = this.elements_.indexOf(A);
9445
9454
  if (I === -1) {
9446
- H.warn("PixelSizeObserver", "Element not being observed");
9455
+ K.warn("PixelSizeObserver", "Element not being observed");
9447
9456
  return;
9448
9457
  }
9449
9458
  this.elements_.splice(I, 1), this.resizeObserver_ && this.resizeObserver_.unobserve(A);
@@ -9566,18 +9575,18 @@ class OQ {
9566
9575
  this.canvas,
9567
9576
  this.context_
9568
9577
  );
9569
- return VQ(I, this.viewports_), this.viewports_.push(I), this.running && (I.events.connect(), I.element !== this.canvas && this.sizeObserver_.observe(I.element)), H.info("Idetik", `Added viewport "${I.id}"`), I;
9578
+ return VQ(I, this.viewports_), this.viewports_.push(I), this.running && (I.events.connect(), I.element !== this.canvas && this.sizeObserver_.observe(I.element)), K.info("Idetik", `Added viewport "${I.id}"`), I;
9570
9579
  }
9571
9580
  removeViewport(A) {
9572
9581
  const I = this.viewports_.indexOf(A);
9573
- return I === -1 ? (H.warn(
9582
+ return I === -1 ? (K.warn(
9574
9583
  "Idetik",
9575
9584
  `Viewport "${A.id}" not found, nothing to remove`
9576
- ), !1) : (this.running && (A.events.disconnect(), A.element !== this.canvas && this.sizeObserver_.unobserve(A.element)), this.viewports_.splice(I, 1), H.info("Idetik", `Removed viewport "${A.id}"`), !0);
9585
+ ), !1) : (this.running && (A.events.disconnect(), A.element !== this.canvas && this.sizeObserver_.unobserve(A.element)), this.viewports_.splice(I, 1), K.info("Idetik", `Removed viewport "${A.id}"`), !0);
9577
9586
  }
9578
9587
  start() {
9579
- if (H.info("Idetik", "Idetik runtime starting"), this.running)
9580
- H.warn("Idetik", "Idetik runtime already started");
9588
+ if (K.info("Idetik", "Idetik runtime starting"), this.running)
9589
+ K.warn("Idetik", "Idetik runtime already started");
9581
9590
  else {
9582
9591
  for (const A of this.viewports_)
9583
9592
  A.events.connect();
@@ -9601,8 +9610,8 @@ class OQ {
9601
9610
  );
9602
9611
  }
9603
9612
  stop() {
9604
- if (H.info("Idetik", "Idetik runtime stopping"), !this.running)
9605
- H.warn("Idetik", "Idetik runtime not started");
9613
+ if (K.info("Idetik", "Idetik runtime stopping"), !this.running)
9614
+ K.warn("Idetik", "Idetik runtime not started");
9606
9615
  else {
9607
9616
  this.sizeObserver_.disconnect();
9608
9617
  for (const A of this.viewports_)
@@ -10788,7 +10797,7 @@ function Ns(C, A, I, g) {
10788
10797
  let F = await s[D];
10789
10798
  if (F === null)
10790
10799
  return;
10791
- let { data: U, shape: S, stride: d } = F, K = t.map((L, Y) => L % S[Y]).reduce((L, Y, T) => L + Y * d[T], 0), k = U[K], R = U[K + 1];
10800
+ let { data: U, shape: S, stride: d } = F, H = t.map((L, Y) => L % S[Y]).reduce((L, Y, T) => L + Y * d[T], 0), k = U[H], R = U[H + 1];
10792
10801
  if (!(k === TC && R === TC))
10793
10802
  return B(D, {
10794
10803
  offset: Number(k),
@@ -11147,10 +11156,10 @@ function qs(C, A, I, g) {
11147
11156
  return C;
11148
11157
  const d = new C.constructor(
11149
11158
  a
11150
- ), K = E.z !== void 0 ? I[E.z] : 0, k = I[E.y];
11159
+ ), H = E.z !== void 0 ? I[E.z] : 0, k = I[E.y];
11151
11160
  let R = 0;
11152
11161
  for (let L = 0; L < B.z; L++) {
11153
- const Y = F + L * K;
11162
+ const Y = F + L * H;
11154
11163
  for (let T = 0; T < B.y; T++) {
11155
11164
  const IA = Y + T * k, CA = IA + B.x;
11156
11165
  d.set(C.subarray(IA, CA), R), R += B.x;
@@ -14824,7 +14833,7 @@ let MA = [], xs = 0, gE = 0;
14824
14833
  const QI = /* @__PURE__ */ new Map(), hg = /* @__PURE__ */ new Set();
14825
14834
  function BE(C) {
14826
14835
  const A = MA.find((I) => I.worker === C);
14827
- return A || H.error(
14836
+ return A || K.error(
14828
14837
  "ZarrWorker",
14829
14838
  "Worker not found in pool - this should not happen"
14830
14839
  ), A;
@@ -14832,7 +14841,7 @@ function BE(C) {
14832
14841
  function bs(C, A) {
14833
14842
  const { id: I, success: g } = C.data, B = QI.get(I);
14834
14843
  if (!B) {
14835
- hg.has(I) ? hg.delete(I) : H.warn(
14844
+ hg.has(I) ? hg.delete(I) : K.warn(
14836
14845
  "ZarrWorker",
14837
14846
  `Received response for unknown message ID ${I}:`,
14838
14847
  C.data
@@ -14841,20 +14850,20 @@ function bs(C, A) {
14841
14850
  }
14842
14851
  QI.delete(I), B.abortListener && B.abortSignal && B.abortSignal.removeEventListener("abort", B.abortListener);
14843
14852
  const Q = BE(A);
14844
- Q && Q.pendingCount > 0 ? Q.pendingCount-- : Q && H.error(
14853
+ Q && Q.pendingCount > 0 ? Q.pendingCount-- : Q && K.error(
14845
14854
  "ZarrWorker",
14846
14855
  "Received message but no pending tasks - this should not happen"
14847
14856
  ), g && C.data.type === "getChunk" ? B.resolve(C.data.data) : g || B.reject(new Error(C.data.error || "Unknown worker error"));
14848
14857
  }
14849
14858
  function VC(C, A) {
14850
14859
  if (C instanceof MessageEvent) {
14851
- H.error(
14860
+ K.error(
14852
14861
  "ZarrWorker",
14853
14862
  "Message serialization error occurred - worker remains active"
14854
14863
  );
14855
14864
  return;
14856
14865
  }
14857
- H.error(
14866
+ K.error(
14858
14867
  "ZarrWorker",
14859
14868
  "Worker failed - replacing worker and canceling its in-flight messages",
14860
14869
  C.message
@@ -14874,9 +14883,9 @@ function VC(C, A) {
14874
14883
  worker: B,
14875
14884
  pendingCount: 0,
14876
14885
  workerId: gE++
14877
- }), H.debug("ZarrWorker", "Replacement worker created successfully");
14886
+ }), K.debug("ZarrWorker", "Replacement worker created successfully");
14878
14887
  } catch (B) {
14879
- H.error("ZarrWorker", "Failed to create replacement worker", B);
14888
+ K.error("ZarrWorker", "Failed to create replacement worker", B);
14880
14889
  }
14881
14890
  }
14882
14891
  function CE() {
@@ -14931,12 +14940,12 @@ function vs() {
14931
14940
  workerId: gE++
14932
14941
  });
14933
14942
  }
14934
- H.debug(
14943
+ K.debug(
14935
14944
  "ZarrWorker",
14936
14945
  `Initialized worker pool with ${MA.length} workers`
14937
14946
  );
14938
14947
  } catch {
14939
- H.warn("ZarrWorker", "Failed to create workers - clearing pool"), Ps();
14948
+ K.warn("ZarrWorker", "Failed to create workers - clearing pool"), Ps();
14940
14949
  return;
14941
14950
  }
14942
14951
  }
@@ -14952,7 +14961,7 @@ async function Zs(C, A, I, g, B) {
14952
14961
  } catch (Q) {
14953
14962
  if (Q instanceof DOMException && Q.name === "AbortError")
14954
14963
  throw Q;
14955
- H.warn("ZarrWorker", "Falling back to main thread", Q);
14964
+ K.warn("ZarrWorker", "Falling back to main thread", Q);
14956
14965
  const E = await C.getChunk(I, B);
14957
14966
  if (!Ho(E.data))
14958
14967
  throw new Error(
@@ -15026,12 +15035,12 @@ function Os(C, A) {
15026
15035
  const I = C.axes.map((a) => a.name), g = C.axes.length, B = OC(I, "x"), Q = OC(I, "y"), E = (a, n) => {
15027
15036
  const D = [];
15028
15037
  for (let F = 0; F < C.datasets.length; F++) {
15029
- const U = C.datasets[F], S = A[F], d = U.coordinateTransformations[0].scale, K = U.coordinateTransformations.length === 2 ? U.coordinateTransformations[1].translation : new Array(g).fill(0);
15038
+ const U = C.datasets[F], S = A[F], d = U.coordinateTransformations[0].scale, H = U.coordinateTransformations.length === 2 ? U.coordinateTransformations[1].translation : new Array(g).fill(0);
15030
15039
  D.push({
15031
15040
  size: S.shape[n],
15032
15041
  chunkSize: S.chunks[n],
15033
15042
  scale: d[n],
15034
- translation: K[n]
15043
+ translation: H[n]
15035
15044
  });
15036
15045
  }
15037
15046
  if (C.axes[n].type === "space" && Xs(D))
@@ -18226,10 +18235,12 @@ ${JSON.stringify(C)}`);
18226
18235
  class yB {
18227
18236
  location;
18228
18237
  version;
18238
+ loader_;
18229
18239
  constructor(A) {
18230
18240
  this.location = A.location, this.version = A.version;
18231
18241
  }
18232
18242
  async open() {
18243
+ if (this.loader_) return this.loader_;
18233
18244
  let A = FI(this.version);
18234
18245
  const I = await VI(this.location, A), g = $B(I.attrs), B = g.multiscales;
18235
18246
  if (B.length !== 1)
@@ -18249,27 +18260,33 @@ class yB {
18249
18260
  throw new Error(
18250
18261
  `Mismatch between number of axes (${s.length}) and array shape (${o.length})`
18251
18262
  );
18252
- return new Vs({
18253
- metadata: Q,
18254
- arrays: i,
18255
- arrayParams: E
18256
- });
18263
+ return this.loader_ = new Vs({ metadata: Q, arrays: i, arrayParams: E }), this.loader_;
18264
+ }
18265
+ getDimensions() {
18266
+ if (!this.loader_)
18267
+ throw new Error(
18268
+ "OmeZarrImageSource.getDimensions() requires the source to be opened first; use `await OmeZarrImageSource.fromHttp({ url })` or `await source.open()`."
18269
+ );
18270
+ return this.loader_.getSourceDimensionMap();
18271
+ }
18272
+ getChannelCount() {
18273
+ return this.getDimensions().c?.lods[0].size ?? 1;
18257
18274
  }
18258
18275
  /**
18259
- * Creates an OmeZarrImageSource from an HTTP(S) URL.
18276
+ * Creates and opens an OmeZarrImageSource from an HTTP(S) URL.
18260
18277
  *
18261
- * @param url URL of Zarr root
18262
- * @param version OME-Zarr version
18278
+ * @param props.url URL of the Zarr root
18279
+ * @param props.version OME-Zarr version
18263
18280
  */
18264
- static fromHttp(A) {
18265
- const I = new WI(A.url);
18266
- return new yB({
18281
+ static async fromHttp(A) {
18282
+ const I = new WI(A.url), g = new yB({
18267
18283
  location: new lA(I),
18268
18284
  version: A.version
18269
18285
  });
18286
+ return await g.open(), g;
18270
18287
  }
18271
18288
  /**
18272
- * Creates an OmeZarrImageSource from a local filesystem directory.
18289
+ * Creates and opens an OmeZarrImageSource from a local filesystem directory.
18273
18290
  *
18274
18291
  * @param directory return value of `window.showDirectoryPicker()` which gives the browser
18275
18292
  * permission to access a directory (only works in Chrome/Edge)
@@ -18277,12 +18294,12 @@ class yB {
18277
18294
  * @param path path to image, beginning with "/". This argument allows the application to only
18278
18295
  * ask the user once for permission to the root directory
18279
18296
  */
18280
- static fromFileSystem(A) {
18281
- const I = new XB(A.directory);
18282
- return new yB({
18297
+ static async fromFileSystem(A) {
18298
+ const I = new XB(A.directory), g = new yB({
18283
18299
  location: new lA(I, A.path),
18284
18300
  version: A.version
18285
18301
  });
18302
+ return await g.open(), g;
18286
18303
  }
18287
18304
  }
18288
18305
  class lg {
@@ -18298,7 +18315,7 @@ class lg {
18298
18315
  return this.opacity_;
18299
18316
  }
18300
18317
  set opacity(A) {
18301
- (A < 0 || A > 1) && H.warn(
18318
+ (A < 0 || A > 1) && K.warn(
18302
18319
  "Layer",
18303
18320
  `Opacity out of bounds: ${A} — clamping to [0.0, 1.0]`
18304
18321
  ), this.opacity_ = TA(A, 0, 1);
@@ -18405,11 +18422,11 @@ class pt extends NI {
18405
18422
  class mt extends NI {
18406
18423
  constructor(A) {
18407
18424
  if (super(), A.primitive != "triangles") {
18408
- H.warn("WireframeGeometry", "Only indexed geometries are supported");
18425
+ K.warn("WireframeGeometry", "Only indexed geometries are supported");
18409
18426
  return;
18410
18427
  }
18411
18428
  if (A.indexData.length == 0) {
18412
- H.warn(
18429
+ K.warn(
18413
18430
  "WireframeGeometry",
18414
18431
  "Only triangulated geometries are supported"
18415
18432
  );
@@ -18605,7 +18622,7 @@ function Vg(C) {
18605
18622
  }
18606
18623
  const oQ = 32;
18607
18624
  function TI(C, { visible: A, color: I, contrastLimits: g, opacity: B }) {
18608
- return A ??= !0, I = I === void 0 ? X.WHITE : X.from(I), B = B === void 0 ? 1 : TA(B, 0, 1), C !== null ? g = Wt(g, C) : g === void 0 && (H.debug(
18625
+ return A ??= !0, I = I === void 0 ? X.WHITE : X.from(I), B = B === void 0 ? 1 : TA(B, 0, 1), C !== null ? g = Wt(g, C) : g === void 0 && (K.debug(
18609
18626
  "Channel",
18610
18627
  "No texture provided, defaulting channel contrast limits to [0, 1]."
18611
18628
  ), g = [0, 1]), {
@@ -18642,14 +18659,14 @@ class aE extends NI {
18642
18659
  for (let D = 0; D < t; ++D) {
18643
18660
  const F = D * n;
18644
18661
  for (let U = 0; U < s; ++U) {
18645
- const S = U * a, d = U / i, K = D / o, k = [S, F, 0], R = [0, 0, 1], L = [d, K];
18662
+ const S = U * a, d = U / i, H = D / o, k = [S, F, 0], R = [0, 0, 1], L = [d, H];
18646
18663
  Q.push(...k, ...R, ...L);
18647
18664
  }
18648
18665
  }
18649
18666
  for (let D = 0; D < o; ++D)
18650
18667
  for (let F = 0; F < i; ++F) {
18651
- const U = F + s * D, S = F + s * (D + 1), d = F + 1 + s * (D + 1), K = F + 1 + s * D;
18652
- E.push(U, S, K), E.push(S, d, K);
18668
+ const U = F + s * D, S = F + s * (D + 1), d = F + 1 + s * (D + 1), H = F + 1 + s * D;
18669
+ E.push(U, S, H), E.push(S, d, H);
18653
18670
  }
18654
18671
  this.vertexData_ = new Float32Array(Q), this.indexData_ = new Uint32Array(E), this.addAttribute({
18655
18672
  type: "position",
@@ -18786,11 +18803,11 @@ class AC {
18786
18803
  bins_ = /* @__PURE__ */ new Map();
18787
18804
  acquire(A) {
18788
18805
  const g = this.bins_.get(A)?.pop();
18789
- return g && H.debug("RenderablePool", "Renderable object acquired"), g;
18806
+ return g && K.debug("RenderablePool", "Renderable object acquired"), g;
18790
18807
  }
18791
18808
  release(A, I) {
18792
18809
  let g = this.bins_.get(A);
18793
- g || (g = [], this.bins_.set(A, g)), g.push(I), H.debug("RenderablePool", "Renderable object released");
18810
+ g || (g = [], this.bins_.set(A, g)), g.push(I), K.debug("RenderablePool", "Renderable object released");
18794
18811
  }
18795
18812
  clearAll(A) {
18796
18813
  if (A) for (const I of this.bins_.values()) I.forEach(A);
@@ -18919,7 +18936,7 @@ class nE extends lg {
18919
18936
  slicePlane(A, I) {
18920
18937
  if (!A.data) return;
18921
18938
  const g = (I - A.offset.z) / A.scale.z, B = Math.round(g), Q = TA(B, 0, A.shape.z - 1);
18922
- ag(g, Q, 1 + 1e-6) || H.error("ImageLayer", "slicePlane zValue outside extent");
18939
+ ag(g, Q, 1 + 1e-6) || K.error("ImageLayer", "slicePlane zValue outside extent");
18923
18940
  const E = A.shape.x * A.shape.y, i = E * Q;
18924
18941
  return A.data.slice(i, i + E);
18925
18942
  }
@@ -18944,7 +18961,7 @@ class nE extends lg {
18944
18961
  getDataForImage(A) {
18945
18962
  const I = this.sliceCoords_?.z !== void 0 ? this.slicePlane(A, this.sliceCoords_.z) : A.data;
18946
18963
  if (!I) {
18947
- H.warn("ImageLayer", "No data for image");
18964
+ K.warn("ImageLayer", "No data for image");
18948
18965
  return;
18949
18966
  }
18950
18967
  return I;
@@ -19042,12 +19059,12 @@ class Pt extends NI {
19042
19059
  });
19043
19060
  }
19044
19061
  buildFace(A, I, g, B, Q, E, i, o, s, t, a, n, D) {
19045
- const F = E / s, U = i / t, S = E / 2, d = i / 2, K = o / 2 * a, k = s + 1, R = t + 1, L = n.length / 8;
19062
+ const F = E / s, U = i / t, S = E / 2, d = i / 2, H = o / 2 * a, k = s + 1, R = t + 1, L = n.length / 8;
19046
19063
  for (let Y = 0; Y < R; Y++) {
19047
19064
  const T = -d + Y * U;
19048
19065
  for (let IA = 0; IA < k; IA++) {
19049
19066
  const CA = -S + IA * F, $ = { x: 0, y: 0, z: 0 };
19050
- $[A] = CA * B, $[I] = T * Q, $[g] = K;
19067
+ $[A] = CA * B, $[I] = T * Q, $[g] = H;
19051
19068
  const gA = { x: 0, y: 0, z: 0 };
19052
19069
  gA[g] = a;
19053
19070
  const SA = IA / s, NA = 1 - Y / t;
@@ -19657,7 +19674,7 @@ class rE extends lg {
19657
19674
  slicePlane(A, I) {
19658
19675
  if (!A.data) return;
19659
19676
  const g = (I - A.offset.z) / A.scale.z, B = Math.round(g), Q = TA(B, 0, A.shape.z - 1);
19660
- ag(g, Q, 1 + 1e-6) || H.error("LabelLayer", "slicePlane zValue outside extent");
19677
+ ag(g, Q, 1 + 1e-6) || K.error("LabelLayer", "slicePlane zValue outside extent");
19661
19678
  const E = A.shape.x * A.shape.y, i = E * Q;
19662
19679
  return A.data.slice(i, i + E);
19663
19680
  }
@@ -19681,7 +19698,7 @@ class rE extends lg {
19681
19698
  getDataForLabel(A) {
19682
19699
  const I = this.sliceCoords_?.z !== void 0 ? this.slicePlane(A, this.sliceCoords_.z) : A.data;
19683
19700
  if (!I) {
19684
- H.warn("LabelLayer", "No data for label");
19701
+ K.warn("LabelLayer", "No data for label");
19685
19702
  return;
19686
19703
  }
19687
19704
  return I;