omezarr-tilesource 0.3.0 → 0.4.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.
@@ -1,105 +1,16 @@
1
- import { r as e } from "./chunk-BXES_1_E.js";
2
- import { n as t, t as n } from "./dist-DIvEDGnZ.js";
3
- import r from "openseadragon";
4
- //#region node_modules/.pnpm/@zarrita+storage@0.2.0/node_modules/@zarrita/storage/dist/src/util.js
5
- function i(e) {
6
- return e.slice(1);
7
- }
8
- function a(e, t, n, r = {}) {
9
- return t !== void 0 && n !== void 0 && (r = {
10
- ...r,
11
- headers: {
12
- ...r.headers,
13
- Range: `bytes=${t}-${t + n - 1}`
14
- }
15
- }), fetch(e, r);
16
- }
17
- function o(e, t) {
18
- return {
19
- ...e,
20
- ...t,
21
- headers: {
22
- ...e.headers,
23
- ...t.headers
24
- }
25
- };
26
- }
27
- function s(e, t = "") {
28
- if (!e) throw Error(t);
29
- }
30
- //#endregion
31
- //#region node_modules/.pnpm/@zarrita+storage@0.2.0/node_modules/@zarrita/storage/dist/src/fetch.js
32
- function c(e, t) {
33
- let n = typeof e == "string" ? new URL(e) : e;
34
- n.pathname.endsWith("/") || (n.pathname += "/");
35
- let r = new URL(t.slice(1), n);
36
- return r.search = n.search, r;
37
- }
38
- async function l(e) {
39
- if (e.status !== 404) {
40
- if (e.status === 200 || e.status === 206) return new Uint8Array(await e.arrayBuffer());
41
- throw Error(`Unexpected response status ${e.status} ${e.statusText}`);
42
- }
43
- }
44
- var u = class {
45
- url;
46
- #e;
47
- #t;
48
- #n;
49
- constructor(e, t = {}) {
50
- this.url = e, this.#e = t.fetch ?? ((e) => fetch(e)), this.#t = t.overrides ?? {}, this.#n = t.useSuffixRequest ?? !1;
51
- }
52
- #r(e, t) {
53
- return new Request(e, o(this.#t, t));
54
- }
55
- async get(e, t = {}) {
56
- let n = c(this.url, e).href, r = this.#r(n, t);
57
- return l(await this.#e(r));
58
- }
59
- async getRange(e, t, n = {}) {
60
- let r = c(this.url, e), i;
61
- if ("suffixLength" in t) i = await this.#i(r, t.suffixLength, n);
62
- else {
63
- let e = {
64
- ...n,
65
- headers: {
66
- ...n.headers,
67
- Range: `bytes=${t.offset}-${t.offset + t.length - 1}`
68
- }
69
- }, a = this.#r(r, e);
70
- i = await this.#e(a);
71
- }
72
- return l(i);
73
- }
74
- async #i(e, t, n) {
75
- if (this.#n) {
76
- let r = {
77
- ...n,
78
- headers: {
79
- ...n.headers,
80
- Range: `bytes=-${t}`
81
- }
82
- };
83
- return this.#e(this.#r(e, r));
84
- }
85
- let r = this.#r(e, {
86
- ...n,
87
- method: "HEAD"
88
- }), i = await this.#e(r);
89
- if (!i.ok) return i;
90
- let a = i.headers.get("Content-Length"), o = Number(a), s = o - t, c = {
91
- ...n,
92
- headers: {
93
- ...n.headers,
94
- Range: `bytes=${s}-${o - 1}`
95
- }
96
- };
97
- return this.#e(this.#r(e, c));
98
- }
99
- };
100
- //#endregion
101
- //#region node_modules/.pnpm/unzipit@2.0.0/node_modules/unzipit/dist/unzipit.module.js
102
- n();
1
+ import { t as e } from "./dist-DXBnbeGc.js";
2
+ import t from "openseadragon";
3
+ //#region \0rolldown/runtime.js
4
+ var n = Object.create, r = Object.defineProperty, i = Object.getOwnPropertyDescriptor, a = Object.getOwnPropertyNames, o = Object.getPrototypeOf, s = Object.prototype.hasOwnProperty, c = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), l = (e, t, n, o) => {
5
+ if (t && typeof t == "object" || typeof t == "function") for (var c = a(t), l = 0, u = c.length, d; l < u; l++) d = c[l], !s.call(e, d) && d !== n && r(e, d, {
6
+ get: ((e) => t[e]).bind(null, d),
7
+ enumerable: !(o = i(t, d)) || o.enumerable
8
+ });
9
+ return e;
10
+ }, u = (e, t, i) => (i = e == null ? {} : n(o(e)), l(t || !e || !e.__esModule ? r(i, "default", {
11
+ value: e,
12
+ enumerable: !0
13
+ }) : i, e));
103
14
  function d(e) {
104
15
  return e.arrayBuffer ? e.arrayBuffer() : new Promise((t, n) => {
105
16
  let r = new FileReader();
@@ -118,7 +29,7 @@ function p(e) {
118
29
  function m(e) {
119
30
  return typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer;
120
31
  }
121
- var h = t !== void 0 && !!t?.versions && t?.versions?.node !== void 0 && t?.versions?.electron === void 0;
32
+ var h = e !== void 0 && !!e?.versions && e?.versions?.node !== void 0 && e?.versions?.electron === void 0;
122
33
  function g(e) {
123
34
  return e.byteOffset === 0 && e.byteLength === e.buffer.byteLength;
124
35
  }
@@ -150,11 +61,11 @@ var _ = class {
150
61
  numWorkers: 1,
151
62
  workerURL: "",
152
63
  useWorkers: !1
153
- }, te = 0, ne = 0, re = !0, ie = [], y = [], b = [], x = /* @__PURE__ */ new Map();
64
+ }, te = 0, ne = 0, y = !0, re = [], b = [], x = [], ie = /* @__PURE__ */ new Map();
154
65
  function ae(e) {
155
66
  ce(e.target);
156
- let { id: t, error: n, data: r } = e.data, i = x.get(t);
157
- x.delete(t), n ? i.reject(n) : i.resolve(r);
67
+ let { id: t, error: n, data: r } = e.data, i = ie.get(t);
68
+ ie.delete(t), n ? i.reject(n) : i.resolve(r);
158
69
  }
159
70
  function oe(e) {
160
71
  return new Promise((t, n) => {
@@ -166,9 +77,9 @@ function oe(e) {
166
77
  }
167
78
  var se = function() {
168
79
  return h ? {
169
- async createWorker(t) {
170
- let { Worker: n } = await import("./__vite-browser-external-BIIyDRRX.js").then((t) => /* @__PURE__ */ e(t.default, 1));
171
- return new n(t);
80
+ async createWorker(e) {
81
+ let { Worker: t } = await import("./__vite-browser-external-B2tgTj77.js").then((e) => /* @__PURE__ */ u(e.default, 1));
82
+ return new t(e);
172
83
  },
173
84
  addEventListener(e, t) {
174
85
  e.on("message", (n) => {
@@ -216,19 +127,19 @@ var se = function() {
216
127
  };
217
128
  }();
218
129
  function ce(e) {
219
- y.push(e), fe();
130
+ b.push(e), fe();
220
131
  }
221
132
  async function le() {
222
- if (y.length === 0 && ne < v.numWorkers) {
133
+ if (b.length === 0 && ne < v.numWorkers) {
223
134
  ++ne;
224
135
  try {
225
136
  let e = await se.createWorker(v.workerURL);
226
- ie.push(e), y.push(e), se.addEventListener(e, ae);
137
+ re.push(e), b.push(e), se.addEventListener(e, ae);
227
138
  } catch {
228
- re = !1;
139
+ y = !1;
229
140
  }
230
141
  }
231
- return y.pop();
142
+ return b.pop();
232
143
  }
233
144
  async function ue(e) {
234
145
  let t = new DecompressionStream("deflate-raw"), n = t.writable.getWriter();
@@ -252,17 +163,17 @@ async function de(e, t, n, r) {
252
163
  }
253
164
  }
254
165
  async function fe() {
255
- if (b.length !== 0) {
256
- if (v.useWorkers && re) {
166
+ if (x.length !== 0) {
167
+ if (v.useWorkers && y) {
257
168
  let e = await le();
258
- if (re) {
169
+ if (y) {
259
170
  if (e) {
260
- if (b.length === 0) {
171
+ if (x.length === 0) {
261
172
  ce(e);
262
173
  return;
263
174
  }
264
- let { id: t, src: n, uncompressedSize: r, type: i, resolve: a, reject: o } = b.shift();
265
- x.set(t, {
175
+ let { id: t, src: n, uncompressedSize: r, type: i, resolve: a, reject: o } = x.shift();
176
+ ie.set(t, {
266
177
  id: t,
267
178
  src: n,
268
179
  uncompressedSize: r,
@@ -282,15 +193,15 @@ async function fe() {
282
193
  return;
283
194
  }
284
195
  }
285
- for (; b.length;) {
286
- let { src: e, type: t, resolve: n, reject: r } = b.shift();
196
+ for (; x.length;) {
197
+ let { src: e, type: t, resolve: n, reject: r } = x.shift();
287
198
  de(p(e) ? await f(e) : e, t, n, r);
288
199
  }
289
200
  }
290
201
  }
291
202
  function pe(e, t, n) {
292
203
  return new Promise((r, i) => {
293
- b.push({
204
+ x.push({
294
205
  src: e,
295
206
  uncompressedSize: t,
296
207
  type: n,
@@ -309,14 +220,14 @@ var he = class {
309
220
  this._reader = e, this._rawEntry = t, this.name = t.name, this.nameBytes = t.nameBytes, this.size = t.uncompressedSize, this.compressedSize = t.compressedSize, this.comment = t.comment, this.commentBytes = t.commentBytes, this.compressionMethod = t.compressionMethod, this.lastModDate = me(t.lastModFileDate, t.lastModFileTime), this.isDirectory = t.uncompressedSize === 0 && t.name.endsWith("/"), this.encrypted = !!(t.generalPurposeBitFlag & 1), this.externalFileAttributes = t.externalFileAttributes, this.versionMadeBy = t.versionMadeBy;
310
221
  }
311
222
  async blob(e = "application/octet-stream") {
312
- return await ke(this._reader, this._rawEntry, e);
223
+ return await Oe(this._reader, this._rawEntry, e);
313
224
  }
314
225
  async arrayBuffer() {
315
- return await Oe(this._reader, this._rawEntry);
226
+ return await De(this._reader, this._rawEntry);
316
227
  }
317
228
  async text() {
318
229
  let e = await this.arrayBuffer();
319
- return E(new Uint8Array(e));
230
+ return D(new Uint8Array(e));
320
231
  }
321
232
  async json() {
322
233
  let e = await this.text();
@@ -326,104 +237,104 @@ var he = class {
326
237
  async function S(e, t, n) {
327
238
  return await e.read(t, n);
328
239
  }
329
- async function ye(e, t, n, r) {
240
+ async function C(e, t, n, r) {
330
241
  return e.sliceAsBlob ? await e.sliceAsBlob(t, n, r) : await e.read(t, n);
331
242
  }
332
- var be = { unsigned() {
243
+ var ye = { unsigned() {
333
244
  return 0;
334
245
  } };
335
- function C(e, t) {
336
- return e[t] + e[t + 1] * 256;
337
- }
338
246
  function w(e, t) {
339
- return e[t] + e[t + 1] * 256 + e[t + 2] * 65536 + e[t + 3] * 16777216;
247
+ return e[t] + e[t + 1] * 256;
340
248
  }
341
249
  function T(e, t) {
342
- return w(e, t) + w(e, t + 4) * 4294967296;
250
+ return e[t] + e[t + 1] * 256 + e[t + 2] * 65536 + e[t + 3] * 16777216;
343
251
  }
344
- var xe = new TextDecoder();
345
252
  function E(e, t) {
346
- return m(e.buffer) && (e = new Uint8Array(e)), xe.decode(e);
253
+ return T(e, t) + T(e, t + 4) * 4294967296;
347
254
  }
348
- async function Se(e, t) {
255
+ var be = new TextDecoder();
256
+ function D(e, t) {
257
+ return m(e.buffer) && (e = new Uint8Array(e)), be.decode(e);
258
+ }
259
+ async function xe(e, t) {
349
260
  let n = Math.min(65557, t), r = t - n, i = await S(e, r, n);
350
261
  for (let t = n - ge; t >= 0; --t) {
351
- if (w(i, t) !== _e) continue;
352
- let n = new Uint8Array(i.buffer, i.byteOffset + t, i.byteLength - t), a = C(n, 4);
262
+ if (T(i, t) !== _e) continue;
263
+ let n = new Uint8Array(i.buffer, i.byteOffset + t, i.byteLength - t), a = w(n, 4);
353
264
  if (a !== 0) throw Error(`multi-volume zip files are not supported. This is volume: ${a}`);
354
- let o = C(n, 10), s = w(n, 12), c = w(n, 16), l = C(n, 20), u = n.length - ge;
265
+ let o = w(n, 10), s = T(n, 12), c = T(n, 16), l = w(n, 20), u = n.length - ge;
355
266
  if (l !== u) throw Error(`invalid comment length. expected: ${u}, actual: ${l}`);
356
- let d = new Uint8Array(n.buffer, n.byteOffset + 22, l), f = E(d);
357
- return o === 65535 || c === 4294967295 ? await we(e, r + t, f, d) : await Ee(e, c, s, o, f, d);
267
+ let d = new Uint8Array(n.buffer, n.byteOffset + 22, l), f = D(d);
268
+ return o === 65535 || c === 4294967295 ? await Ce(e, r + t, f, d) : await Te(e, c, s, o, f, d);
358
269
  }
359
270
  throw Error("could not find end of central directory. maybe not zip file");
360
271
  }
361
- var Ce = 117853008;
362
- async function we(e, t, n, r) {
272
+ var Se = 117853008;
273
+ async function Ce(e, t, n, r) {
363
274
  let i = await S(e, t - 20, 20);
364
- if (w(i, 0) !== Ce) throw Error("invalid zip64 end of central directory locator signature");
365
- let a = await S(e, T(i, 8), 56);
366
- if (w(a, 0) !== ve) throw Error("invalid zip64 end of central directory record signature");
367
- let o = T(a, 32), s = T(a, 40);
368
- return Ee(e, T(a, 48), s, o, n, r);
369
- }
370
- var Te = 33639248;
371
- async function Ee(e, t, n, r, i, a) {
275
+ if (T(i, 0) !== Se) throw Error("invalid zip64 end of central directory locator signature");
276
+ let a = await S(e, E(i, 8), 56);
277
+ if (T(a, 0) !== ve) throw Error("invalid zip64 end of central directory record signature");
278
+ let o = E(a, 32), s = E(a, 40);
279
+ return Te(e, E(a, 48), s, o, n, r);
280
+ }
281
+ var we = 33639248;
282
+ async function Te(e, t, n, r, i, a) {
372
283
  let o = 0, s = await S(e, t, n), c = [];
373
284
  for (let e = 0; e < r; ++e) {
374
- let e = s.subarray(o, o + 46), t = w(e, 0);
375
- if (t !== Te) throw Error(`invalid central directory file header signature: 0x${t.toString(16)}`);
285
+ let e = s.subarray(o, o + 46), t = T(e, 0);
286
+ if (t !== we) throw Error(`invalid central directory file header signature: 0x${t.toString(16)}`);
376
287
  let n = {
377
- versionMadeBy: C(e, 4),
378
- versionNeededToExtract: C(e, 6),
379
- generalPurposeBitFlag: C(e, 8),
380
- compressionMethod: C(e, 10),
381
- lastModFileTime: C(e, 12),
382
- lastModFileDate: C(e, 14),
383
- crc32: w(e, 16),
384
- compressedSize: w(e, 20),
385
- uncompressedSize: w(e, 24),
386
- fileNameLength: C(e, 28),
387
- extraFieldLength: C(e, 30),
388
- fileCommentLength: C(e, 32),
389
- internalFileAttributes: C(e, 36),
390
- externalFileAttributes: w(e, 38),
391
- relativeOffsetOfLocalHeader: w(e, 42)
288
+ versionMadeBy: w(e, 4),
289
+ versionNeededToExtract: w(e, 6),
290
+ generalPurposeBitFlag: w(e, 8),
291
+ compressionMethod: w(e, 10),
292
+ lastModFileTime: w(e, 12),
293
+ lastModFileDate: w(e, 14),
294
+ crc32: T(e, 16),
295
+ compressedSize: T(e, 20),
296
+ uncompressedSize: T(e, 24),
297
+ fileNameLength: w(e, 28),
298
+ extraFieldLength: w(e, 30),
299
+ fileCommentLength: w(e, 32),
300
+ internalFileAttributes: w(e, 36),
301
+ externalFileAttributes: T(e, 38),
302
+ relativeOffsetOfLocalHeader: T(e, 42)
392
303
  };
393
304
  if (n.generalPurposeBitFlag & 64) throw Error("strong encryption is not supported");
394
305
  o += 46;
395
306
  let r = s.subarray(o, o + n.fileNameLength + n.extraFieldLength + n.fileCommentLength);
396
- n.generalPurposeBitFlag & 2048, n.nameBytes = r.slice(0, n.fileNameLength), n.name = E(n.nameBytes);
307
+ n.generalPurposeBitFlag & 2048, n.nameBytes = r.slice(0, n.fileNameLength), n.name = D(n.nameBytes);
397
308
  let i = n.fileNameLength + n.extraFieldLength, a = r.slice(n.fileNameLength, i);
398
309
  n.extraFields = [];
399
310
  let l = 0;
400
311
  for (; l < a.length - 3;) {
401
- let e = C(a, l + 0), t = C(a, l + 2), r = l + 4, i = r + t;
312
+ let e = w(a, l + 0), t = w(a, l + 2), r = l + 4, i = r + t;
402
313
  if (i > a.length) throw Error("extra field length exceeds extra field buffer size");
403
314
  n.extraFields.push({
404
315
  id: e,
405
316
  data: a.slice(r, i)
406
317
  }), l = i;
407
318
  }
408
- if (n.commentBytes = r.slice(i, i + n.fileCommentLength), n.comment = E(n.commentBytes), o += r.length, n.uncompressedSize === 4294967295 || n.compressedSize === 4294967295 || n.relativeOffsetOfLocalHeader === 4294967295) {
319
+ if (n.commentBytes = r.slice(i, i + n.fileCommentLength), n.comment = D(n.commentBytes), o += r.length, n.uncompressedSize === 4294967295 || n.compressedSize === 4294967295 || n.relativeOffsetOfLocalHeader === 4294967295) {
409
320
  let e = n.extraFields.find((e) => e.id === 1);
410
321
  if (!e) throw Error("expected zip64 extended information extra field");
411
322
  let t = e.data, r = 0;
412
323
  if (n.uncompressedSize === 4294967295) {
413
324
  if (r + 8 > t.length) throw Error("zip64 extended information extra field does not include uncompressed size");
414
- n.uncompressedSize = T(t, r), r += 8;
325
+ n.uncompressedSize = E(t, r), r += 8;
415
326
  }
416
327
  if (n.compressedSize === 4294967295) {
417
328
  if (r + 8 > t.length) throw Error("zip64 extended information extra field does not include compressed size");
418
- n.compressedSize = T(t, r), r += 8;
329
+ n.compressedSize = E(t, r), r += 8;
419
330
  }
420
331
  if (n.relativeOffsetOfLocalHeader === 4294967295) {
421
332
  if (r + 8 > t.length) throw Error("zip64 extended information extra field does not include relative header offset");
422
- n.relativeOffsetOfLocalHeader = T(t, r), r += 8;
333
+ n.relativeOffsetOfLocalHeader = E(t, r), r += 8;
423
334
  }
424
335
  }
425
- let u = n.extraFields.find((e) => e.id === 28789 && e.data.length >= 6 && e.data[0] === 1 && w(e.data, 1), be.unsigned());
426
- if (u && (n.fileName = E(u.data.slice(5))), n.compressionMethod === 0) {
336
+ let u = n.extraFields.find((e) => e.id === 28789 && e.data.length >= 6 && e.data[0] === 1 && T(e.data, 1), ye.unsigned());
337
+ if (u && (n.fileName = D(u.data.slice(5))), n.compressionMethod === 0) {
427
338
  let e = n.uncompressedSize;
428
339
  if (n.generalPurposeBitFlag & 1 && (e += 12), n.compressedSize !== e) throw Error(`compressed size mismatch for stored file: ${n.compressedSize} != ${e}`);
429
340
  }
@@ -437,11 +348,11 @@ async function Ee(e, t, n, r, i, a) {
437
348
  entries: c.map((t) => new he(e, t))
438
349
  };
439
350
  }
440
- async function De(e, t) {
351
+ async function Ee(e, t) {
441
352
  if (t.generalPurposeBitFlag & 1) throw Error("encrypted entries not supported");
442
- let n = await S(e, t.relativeOffsetOfLocalHeader, 30), r = await e.getLength(), i = w(n, 0);
353
+ let n = await S(e, t.relativeOffsetOfLocalHeader, 30), r = await e.getLength(), i = T(n, 0);
443
354
  if (i !== 67324752) throw Error(`invalid local file header signature: 0x${i.toString(16)}`);
444
- let a = C(n, 26), o = C(n, 28), s = t.relativeOffsetOfLocalHeader + n.length + a + o, c;
355
+ let a = w(n, 26), o = w(n, 28), s = t.relativeOffsetOfLocalHeader + n.length + a + o, c;
445
356
  if (t.compressionMethod === 0) c = !1;
446
357
  else if (t.compressionMethod === 8) c = !0;
447
358
  else throw Error(`unsupported compression method: ${t.compressionMethod}`);
@@ -452,25 +363,25 @@ async function De(e, t) {
452
363
  fileDataStart: l
453
364
  };
454
365
  }
455
- async function Oe(e, t) {
456
- let { decompress: n, fileDataStart: r } = await De(e, t);
366
+ async function De(e, t) {
367
+ let { decompress: n, fileDataStart: r } = await Ee(e, t);
457
368
  if (!n) {
458
369
  let n = await S(e, r, t.compressedSize);
459
370
  return g(n) ? n.buffer : n.slice().buffer;
460
371
  }
461
- let i = await ye(e, r, t.compressedSize);
372
+ let i = await C(e, r, t.compressedSize);
462
373
  return await pe((i instanceof Uint8Array, i), t.uncompressedSize);
463
374
  }
464
- async function ke(e, t, n) {
465
- let { decompress: r, fileDataStart: i } = await De(e, t);
375
+ async function Oe(e, t, n) {
376
+ let { decompress: r, fileDataStart: i } = await Ee(e, t);
466
377
  if (!r) {
467
- let r = await ye(e, i, t.compressedSize, n);
378
+ let r = await C(e, i, t.compressedSize, n);
468
379
  return p(r) ? r : new Blob([r], { type: n });
469
380
  }
470
- let a = await ye(e, i, t.compressedSize);
381
+ let a = await C(e, i, t.compressedSize);
471
382
  return await pe((a instanceof Uint8Array, a), t.uncompressedSize, n);
472
383
  }
473
- async function Ae(e) {
384
+ async function ke(e) {
474
385
  let t;
475
386
  if (typeof Blob < "u" && e instanceof Blob) t = new ee(e);
476
387
  else if (e instanceof ArrayBuffer || e && e.buffer && e.buffer instanceof ArrayBuffer) t = new _(e);
@@ -483,23 +394,50 @@ async function Ae(e) {
483
394
  else throw Error("unsupported source type");
484
395
  let n = await t.getLength();
485
396
  if (n > 2 ** 53 - 1) throw Error(`file too large. size: ${n}. Only file sizes up 4503599627370496 bytes are supported`);
486
- return await Se(t, n);
397
+ return await xe(t, n);
487
398
  }
488
- async function je(e) {
489
- let { zip: t, entries: n } = await Ae(e);
399
+ async function Ae(e) {
400
+ let { zip: t, entries: n } = await ke(e);
490
401
  return {
491
402
  zip: t,
492
403
  entries: Object.fromEntries(n.map((e) => [e.name, e]))
493
404
  };
494
405
  }
495
406
  //#endregion
407
+ //#region node_modules/.pnpm/@zarrita+storage@0.2.0/node_modules/@zarrita/storage/dist/src/util.js
408
+ function je(e) {
409
+ return e.slice(1);
410
+ }
411
+ function Me(e, t, n, r = {}) {
412
+ return t !== void 0 && n !== void 0 && (r = {
413
+ ...r,
414
+ headers: {
415
+ ...r.headers,
416
+ Range: `bytes=${t}-${t + n - 1}`
417
+ }
418
+ }), fetch(e, r);
419
+ }
420
+ function Ne(e, t) {
421
+ return {
422
+ ...e,
423
+ ...t,
424
+ headers: {
425
+ ...e.headers,
426
+ ...t.headers
427
+ }
428
+ };
429
+ }
430
+ function Pe(e, t = "") {
431
+ if (!e) throw Error(t);
432
+ }
433
+ //#endregion
496
434
  //#region node_modules/.pnpm/@zarrita+storage@0.2.0/node_modules/@zarrita/storage/dist/src/zip.js
497
- function Me(e) {
435
+ function Fe(e) {
498
436
  if (!("_rawEntry" in e)) return;
499
437
  let t = e._rawEntry;
500
438
  if (typeof t == "object" && t && "relativeOffsetOfLocalHeader" in t && typeof t.relativeOffsetOfLocalHeader == "number") return { relativeOffsetOfLocalHeader: t.relativeOffsetOfLocalHeader };
501
439
  }
502
- var Ne = class {
440
+ var Ie = class {
503
441
  blob;
504
442
  constructor(e) {
505
443
  this.blob = e;
@@ -511,7 +449,7 @@ var Ne = class {
511
449
  let n = this.blob.slice(e, e + t);
512
450
  return new Uint8Array(await n.arrayBuffer());
513
451
  }
514
- }, Pe = class {
452
+ }, Le = class {
515
453
  url;
516
454
  length;
517
455
  #e;
@@ -524,55 +462,125 @@ var Ne = class {
524
462
  ...this.#e,
525
463
  method: "HEAD"
526
464
  });
527
- if (s(e.ok, `failed http request ${this.url}, status: ${e.status}: ${e.statusText}`), this.length = Number(e.headers.get("content-length")), Number.isNaN(this.length)) throw Error("could not get length");
465
+ if (Pe(e.ok, `failed http request ${this.url}, status: ${e.status}: ${e.statusText}`), this.length = Number(e.headers.get("content-length")), Number.isNaN(this.length)) throw Error("could not get length");
528
466
  }
529
467
  return this.length;
530
468
  }
531
469
  async read(e, t) {
532
470
  if (t === 0) return new Uint8Array();
533
- let n = await a(this.url, e, t, this.#e);
534
- return s(n.ok, `failed http request ${this.url}, status: ${n.status} offset: ${e} size: ${t}: ${n.statusText}`), new Uint8Array(await n.arrayBuffer());
471
+ let n = await Me(this.url, e, t, this.#e);
472
+ return Pe(n.ok, `failed http request ${this.url}, status: ${n.status} offset: ${e} size: ${t}: ${n.statusText}`), new Uint8Array(await n.arrayBuffer());
535
473
  }
536
- }, Fe = class e {
474
+ }, Re = class e {
537
475
  info;
538
476
  reader;
539
477
  constructor(e, t = {}) {
540
- this.reader = e, this.info = je(e).then((e) => (t.transformEntries && (e.entries = t.transformEntries(e.entries)), e));
478
+ this.reader = e, this.info = Ae(e).then((e) => (t.transformEntries && (e.entries = t.transformEntries(e.entries)), e));
541
479
  }
542
480
  async getEntryDataOffset(e) {
543
481
  let t = e.relativeOffsetOfLocalHeader, n = await this.reader.read(t, 30), r = n[26] + n[27] * 256, i = n[28] + n[29] * 256;
544
482
  return t + 30 + r + i;
545
483
  }
546
484
  async get(e) {
547
- let t = (await this.info).entries[i(e)];
485
+ let t = (await this.info).entries[je(e)];
548
486
  if (t) return new Uint8Array(await t.arrayBuffer());
549
487
  }
550
488
  async getRange(e, t) {
551
- let n = (await this.info).entries[i(e)];
489
+ let n = (await this.info).entries[je(e)];
552
490
  if (!n) return;
553
- let r = Me(n);
491
+ let r = Fe(n);
554
492
  if (!r) throw Error("ZipFileStore.getRange requires internal unzipit properties that are not available. This may indicate an incompatible version of unzipit.");
555
493
  if (n.compressionMethod !== 0) {
556
494
  let n = await this.get(e);
557
495
  return n ? "suffixLength" in t ? n.slice(-t.suffixLength) : n.slice(t.offset, t.offset + t.length) : void 0;
558
496
  }
559
- let a = await this.getEntryDataOffset(r);
497
+ let i = await this.getEntryDataOffset(r);
560
498
  if ("suffixLength" in t) {
561
- let e = a + n.size - t.suffixLength;
499
+ let e = i + n.size - t.suffixLength;
562
500
  return this.reader.read(e, t.suffixLength);
563
501
  }
564
- return this.reader.read(a + t.offset, t.length);
502
+ return this.reader.read(i + t.offset, t.length);
565
503
  }
566
504
  async has(e) {
567
- return i(e) in (await this.info).entries;
505
+ return je(e) in (await this.info).entries;
568
506
  }
569
507
  static fromUrl(t, n = {}) {
570
- return new e(new Pe(t, n), n);
508
+ return new e(new Le(t, n), n);
571
509
  }
572
510
  static fromBlob(t, n = {}) {
573
- return new e(new Ne(t), n);
511
+ return new e(new Ie(t), n);
512
+ }
513
+ };
514
+ //#endregion
515
+ //#region node_modules/.pnpm/@zarrita+storage@0.2.0/node_modules/@zarrita/storage/dist/src/fetch.js
516
+ function ze(e, t) {
517
+ let n = typeof e == "string" ? new URL(e) : e;
518
+ n.pathname.endsWith("/") || (n.pathname += "/");
519
+ let r = new URL(t.slice(1), n);
520
+ return r.search = n.search, r;
521
+ }
522
+ async function Be(e) {
523
+ if (e.status !== 404) {
524
+ if (e.status === 200 || e.status === 206) return new Uint8Array(await e.arrayBuffer());
525
+ throw Error(`Unexpected response status ${e.status} ${e.statusText}`);
526
+ }
527
+ }
528
+ var Ve = class {
529
+ url;
530
+ #e;
531
+ #t;
532
+ #n;
533
+ constructor(e, t = {}) {
534
+ this.url = e, this.#e = t.fetch ?? ((e) => fetch(e)), this.#t = t.overrides ?? {}, this.#n = t.useSuffixRequest ?? !1;
535
+ }
536
+ #r(e, t) {
537
+ return new Request(e, Ne(this.#t, t));
538
+ }
539
+ async get(e, t = {}) {
540
+ let n = ze(this.url, e).href, r = this.#r(n, t);
541
+ return Be(await this.#e(r));
542
+ }
543
+ async getRange(e, t, n = {}) {
544
+ let r = ze(this.url, e), i;
545
+ if ("suffixLength" in t) i = await this.#i(r, t.suffixLength, n);
546
+ else {
547
+ let e = {
548
+ ...n,
549
+ headers: {
550
+ ...n.headers,
551
+ Range: `bytes=${t.offset}-${t.offset + t.length - 1}`
552
+ }
553
+ }, a = this.#r(r, e);
554
+ i = await this.#e(a);
555
+ }
556
+ return Be(i);
557
+ }
558
+ async #i(e, t, n) {
559
+ if (this.#n) {
560
+ let r = {
561
+ ...n,
562
+ headers: {
563
+ ...n.headers,
564
+ Range: `bytes=-${t}`
565
+ }
566
+ };
567
+ return this.#e(this.#r(e, r));
568
+ }
569
+ let r = this.#r(e, {
570
+ ...n,
571
+ method: "HEAD"
572
+ }), i = await this.#e(r);
573
+ if (!i.ok) return i;
574
+ let a = i.headers.get("Content-Length"), o = Number(a), s = o - t, c = {
575
+ ...n,
576
+ headers: {
577
+ ...n.headers,
578
+ Range: `bytes=${s}-${o - 1}`
579
+ }
580
+ };
581
+ return this.#e(this.#r(e, c));
574
582
  }
575
- }, D = class extends Error {}, O = class extends D {
583
+ }, O = class extends Error {}, k = class extends O {
576
584
  _tag = "NotFoundError";
577
585
  name = "NotFoundError";
578
586
  path;
@@ -580,21 +588,21 @@ var Ne = class {
580
588
  constructor(e, t = {}) {
581
589
  super(`Not found: ${e}`, { cause: t.cause }), this.path = t.path, this.found = t.found;
582
590
  }
583
- }, k = class extends D {
591
+ }, A = class extends O {
584
592
  _tag = "InvalidMetadataError";
585
593
  name = "InvalidMetadataError";
586
594
  path;
587
595
  constructor(e, t = {}) {
588
596
  super(e, { cause: t.cause }), this.path = t.path;
589
597
  }
590
- }, Ie = class extends D {
598
+ }, He = class extends O {
591
599
  _tag = "UnknownCodecError";
592
600
  name = "UnknownCodecError";
593
601
  codec;
594
602
  constructor(e) {
595
603
  super(`Unknown codec: ${e}`), this.codec = e;
596
604
  }
597
- }, Le = class extends D {
605
+ }, Ue = class extends O {
598
606
  _tag = "CodecPipelineError";
599
607
  name = "CodecPipelineError";
600
608
  direction;
@@ -608,10 +616,10 @@ var Ne = class {
608
616
  ].filter(Boolean);
609
617
  super(t.join(" "), { cause: e.cause }), this.direction = e.direction, this.codec = e.codec, this.chunkPath = e.chunkPath;
610
618
  }
611
- }, A = class extends D {
619
+ }, j = class extends O {
612
620
  _tag = "InvalidSelectionError";
613
621
  name = "InvalidSelectionError";
614
- }, Re = class extends D {
622
+ }, We = class extends O {
615
623
  _tag = "UnsupportedError";
616
624
  name = "UnsupportedError";
617
625
  feature;
@@ -621,35 +629,35 @@ var Ne = class {
621
629
  };
622
630
  //#endregion
623
631
  //#region node_modules/.pnpm/zarrita@0.7.5/node_modules/zarrita/dist/src/codecs/_shared.js
624
- function j(e) {
632
+ function M(e) {
625
633
  return () => {
626
- throw new Re(`${e} encode`);
634
+ throw new We(`${e} encode`);
627
635
  };
628
636
  }
629
637
  //#endregion
630
638
  //#region node_modules/.pnpm/zarrita@0.7.5/node_modules/zarrita/dist/src/codecs/bitround.js
631
- var ze = class e {
639
+ var Ge = class e {
632
640
  kind = "array_to_array";
633
641
  constructor(e, t) {
634
- if (e.keepbits < 0) throw new k("keepbits must be zero or positive");
642
+ if (e.keepbits < 0) throw new A("keepbits must be zero or positive");
635
643
  }
636
644
  static fromConfig(t, n) {
637
645
  return new e(t, n);
638
646
  }
639
- encode = j("bitround");
647
+ encode = M("bitround");
640
648
  decode(e) {
641
649
  return e;
642
650
  }
643
651
  };
644
652
  //#endregion
645
653
  //#region node_modules/.pnpm/zarrita@0.7.5/node_modules/zarrita/dist/src/typedarray.js
646
- function M(e) {
654
+ function N(e) {
647
655
  return e instanceof ArrayBuffer || e instanceof SharedArrayBuffer;
648
656
  }
649
- var Be = class {
657
+ var Ke = class {
650
658
  #e;
651
659
  constructor(e, t, n) {
652
- typeof e == "number" ? this.#e = new Uint8Array(e) : M(e) ? this.#e = new Uint8Array(e, t, n) : this.#e = new Uint8Array(Array.from(e, (e) => +!!e));
660
+ typeof e == "number" ? this.#e = new Uint8Array(e) : N(e) ? this.#e = new Uint8Array(e, t, n) : this.#e = new Uint8Array(Array.from(e, (e) => +!!e));
653
661
  }
654
662
  get BYTES_PER_ELEMENT() {
655
663
  return 1;
@@ -679,13 +687,13 @@ var Be = class {
679
687
  *[Symbol.iterator]() {
680
688
  for (let e = 0; e < this.length; e++) yield this.get(e);
681
689
  }
682
- }, N = class {
690
+ }, P = class {
683
691
  _data;
684
692
  chars;
685
693
  #e;
686
694
  constructor(e, t, n, r) {
687
695
  if (this.chars = e, this.#e = new TextEncoder(), typeof t == "number") this._data = new Uint8Array(t * e);
688
- else if (M(t)) r && (r *= e), this._data = new Uint8Array(t, n, r);
696
+ else if (N(t)) r && (r *= e), this._data = new Uint8Array(t, n, r);
689
697
  else {
690
698
  let n = Array.from(t);
691
699
  this._data = new Uint8Array(n.length * e);
@@ -722,12 +730,12 @@ var Be = class {
722
730
  *[Symbol.iterator]() {
723
731
  for (let e = 0; e < this.length; e++) yield this.get(e);
724
732
  }
725
- }, Ve = class e {
733
+ }, F = class e {
726
734
  #e;
727
735
  chars;
728
736
  constructor(t, n, r, i) {
729
737
  if (this.chars = t, typeof n == "number") this.#e = new Int32Array(n * t);
730
- else if (M(n)) i && (i *= t), this.#e = new Int32Array(n, r, i);
738
+ else if (N(n)) i && (i *= t), this.#e = new Int32Array(n, r, i);
731
739
  else {
732
740
  let r = n, i = new e(t, 1);
733
741
  this.#e = new Int32Array((function* () {
@@ -771,30 +779,30 @@ var Be = class {
771
779
  };
772
780
  //#endregion
773
781
  //#region node_modules/.pnpm/zarrita@0.7.5/node_modules/zarrita/dist/src/util.js
774
- function He() {
782
+ function qe() {
775
783
  if (typeof SharedArrayBuffer > "u") throw Error("SharedArrayBuffer is not available. In browsers, this requires Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy headers to be set.");
776
784
  }
777
- function Ue(e, t) {
785
+ function Je(e, t) {
778
786
  return t ? new SharedArrayBuffer(e) : new ArrayBuffer(e);
779
787
  }
780
- function P(e) {
788
+ function I(e) {
781
789
  let t = new TextDecoder().decode(e);
782
790
  try {
783
791
  return JSON.parse(t);
784
792
  } catch (e) {
785
- throw new k("Failed to decode JSON", { cause: e });
793
+ throw new A("Failed to decode JSON", { cause: e });
786
794
  }
787
795
  }
788
- function We(e, t) {
796
+ function Ye(e, t) {
789
797
  let n = t / 2, r = t - 1, i = 0;
790
798
  for (let a = 0; a < e.length; a += t) for (let t = 0; t < n; t += 1) i = e[a + t], e[a + t] = e[a + r - t], e[a + r - t] = i;
791
799
  }
792
- function F(e) {
800
+ function L(e) {
793
801
  if (e === "v2:object") return globalThis.Array;
794
802
  let t = e.match(/v2:([US])(\d+)/);
795
803
  if (t) {
796
804
  let [, e, n] = t;
797
- return (e === "U" ? Ve : N).bind(null, Number(n));
805
+ return (e === "U" ? F : P).bind(null, Number(n));
798
806
  }
799
807
  if (e === "string") return globalThis.Array;
800
808
  let n = {
@@ -809,19 +817,19 @@ function F(e) {
809
817
  float16: globalThis.Float16Array,
810
818
  float32: Float32Array,
811
819
  float64: Float64Array,
812
- bool: Be
820
+ bool: Ke
813
821
  }[e];
814
- if (!n) throw new k(`Unknown or unsupported dataType: ${e}`);
822
+ if (!n) throw new A(`Unknown or unsupported dataType: ${e}`);
815
823
  return n;
816
824
  }
817
- function I(e, t) {
825
+ function R(e, t) {
818
826
  let n = e.length;
819
- typeof t == "string" && (t = t === "C" ? Array.from({ length: n }, (e, t) => t) : Array.from({ length: n }, (e, t) => n - 1 - t)), L(n === t.length, "Order length must match the number of dimensions.");
827
+ typeof t == "string" && (t = t === "C" ? Array.from({ length: n }, (e, t) => t) : Array.from({ length: n }, (e, t) => n - 1 - t)), z(n === t.length, "Order length must match the number of dimensions.");
820
828
  let r = 1, i = Array(n);
821
829
  for (let n = t.length - 1; n >= 0; n--) i[t[n]] = r, r *= e[t[n]];
822
830
  return i;
823
831
  }
824
- function Ge({ name: e, configuration: t }) {
832
+ function Xe({ name: e, configuration: t }) {
825
833
  if (e === "default") {
826
834
  let e = t?.separator ?? "/";
827
835
  return (t) => ["c", ...t].join(e);
@@ -830,12 +838,12 @@ function Ge({ name: e, configuration: t }) {
830
838
  let e = t?.separator ?? ".";
831
839
  return (t) => t.join(e) || "0";
832
840
  }
833
- throw new k(`Unknown chunk key encoding: ${e}`);
841
+ throw new A(`Unknown chunk key encoding: ${e}`);
834
842
  }
835
- function Ke(e) {
843
+ function Ze(e) {
836
844
  if (e === "|O") return { dataType: "v2:object" };
837
845
  let t = e.match(/^([<|>])(.*)$/);
838
- if (!t) throw new k(`Invalid dtype: ${e}`);
846
+ if (!t) throw new A(`Invalid dtype: ${e}`);
839
847
  let [, n, r] = t, i = {
840
848
  b1: "bool",
841
849
  i1: "int8",
@@ -850,24 +858,24 @@ function Ke(e) {
850
858
  f4: "float32",
851
859
  f8: "float64"
852
860
  }[r] ?? (r.startsWith("S") || r.startsWith("U") ? `v2:${r}` : void 0);
853
- if (!i) throw new k(`Unsupported or unknown dtype: ${e}`);
861
+ if (!i) throw new A(`Unsupported or unknown dtype: ${e}`);
854
862
  return n === "|" ? { dataType: i } : {
855
863
  dataType: i,
856
864
  endian: n === "<" ? "little" : "big"
857
865
  };
858
866
  }
859
- function qe(e) {
867
+ function Qe(e) {
860
868
  return (e.id === "fixedscaleoffset" || e.id === "numcodecs.fixedscaleoffset") && typeof e.scale == "number" && typeof e.offset == "number" && (e.astype === void 0 || typeof e.astype == "string") && (e.dtype === void 0 || typeof e.dtype == "string");
861
869
  }
862
- function Je(e, t = {}) {
863
- let n = [], r = Ke(e.dtype);
870
+ function $e(e, t = {}) {
871
+ let n = [], r = Ze(e.dtype);
864
872
  e.order === "F" && n.push({
865
873
  name: "transpose",
866
874
  configuration: { order: "F" }
867
875
  });
868
876
  for (let t of e.filters ?? []) {
869
877
  if (t.id === "fixedscaleoffset" || t.id === "numcodecs.fixedscaleoffset") {
870
- if (!qe(t)) throw new k(`Invalid fixedscaleoffset filter: ${JSON.stringify(t)}`);
878
+ if (!Qe(t)) throw new A(`Invalid fixedscaleoffset filter: ${JSON.stringify(t)}`);
871
879
  n.push({
872
880
  name: "scale_offset",
873
881
  configuration: {
@@ -877,8 +885,8 @@ function Je(e, t = {}) {
877
885
  });
878
886
  let r = t.astype ?? t.dtype;
879
887
  if (r !== void 0 && r !== e.dtype) {
880
- let e = Ke(r).dataType;
881
- if (!Xe(e, "number") && !Xe(e, "bigint")) throw new k(`fixedscaleoffset astype must be a numeric data type, got ${r}`);
888
+ let e = Ze(r).dataType;
889
+ if (!tt(e, "number") && !tt(e, "bigint")) throw new A(`fixedscaleoffset astype must be a numeric data type, got ${r}`);
882
890
  n.push({
883
891
  name: "cast_value",
884
892
  configuration: {
@@ -926,14 +934,14 @@ function Je(e, t = {}) {
926
934
  attributes: t
927
935
  };
928
936
  }
929
- function Ye(e, t = {}) {
937
+ function et(e, t = {}) {
930
938
  return {
931
939
  zarr_format: 3,
932
940
  node_type: "group",
933
941
  attributes: t
934
942
  };
935
943
  }
936
- function Xe(e, t) {
944
+ function tt(e, t) {
937
945
  if (t !== "number" && t !== "bigint" && t !== "boolean" && t !== "object" && t !== "string") return e === t;
938
946
  let n = e === "bool";
939
947
  if (t === "boolean") return n;
@@ -944,10 +952,10 @@ function Xe(e, t) {
944
952
  let a = e === "v2:object";
945
953
  return t === "object" ? a : !r && !i && !n && !a;
946
954
  }
947
- function Ze(e) {
955
+ function nt(e) {
948
956
  return e?.name === "sharding_indexed";
949
957
  }
950
- function Qe(e) {
958
+ function rt(e) {
951
959
  if ((e.data_type === "uint64" || e.data_type === "int64") && e.fill_value != null) return BigInt(e.fill_value);
952
960
  let t = e.data_type === "float16" || e.data_type === "float32" || e.data_type === "float64";
953
961
  if (typeof e.fill_value == "string" && t) {
@@ -960,24 +968,24 @@ function Qe(e) {
960
968
  }
961
969
  return e.fill_value;
962
970
  }
963
- function $e(e) {
971
+ function it(e) {
964
972
  let t = e.signal, n = e.opts?.signal;
965
973
  return t && n ? AbortSignal.any([t, n]) : t ?? n;
966
974
  }
967
- function et(e, ...t) {
975
+ function at(e, ...t) {
968
976
  if (!t.some((t) => e instanceof t)) throw e;
969
977
  }
970
- function L(e, t = "") {
978
+ function z(e, t = "") {
971
979
  if (!e) throw Error(t);
972
980
  }
973
- async function tt(e, { format: t, signal: n }) {
981
+ async function ot(e, { format: t, signal: n }) {
974
982
  let r;
975
983
  if (e instanceof ArrayBuffer) r = new Response(e);
976
984
  else {
977
985
  let t = new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
978
986
  r = new Response(t.slice().buffer);
979
987
  }
980
- L(r.body, "Response does not contain body.");
988
+ z(r.body, "Response does not contain body.");
981
989
  try {
982
990
  return await new Response(r.body.pipeThrough(new DecompressionStream(t), { signal: n })).arrayBuffer();
983
991
  } catch {
@@ -986,15 +994,15 @@ async function tt(e, { format: t, signal: n }) {
986
994
  }
987
995
  //#endregion
988
996
  //#region node_modules/.pnpm/zarrita@0.7.5/node_modules/zarrita/dist/src/codecs/bytes.js
989
- var nt = rt();
990
- function rt() {
997
+ var st = ct();
998
+ function ct() {
991
999
  let e = new Uint32Array([305419896]);
992
1000
  return new Uint8Array(e.buffer, e.byteOffset, e.byteLength)[0] !== 18;
993
1001
  }
994
- function it(e) {
1002
+ function lt(e) {
995
1003
  return "BYTES_PER_ELEMENT" in e ? e.BYTES_PER_ELEMENT : 4;
996
1004
  }
997
- var at = class e {
1005
+ var ut = class e {
998
1006
  kind = "array_to_bytes";
999
1007
  #e;
1000
1008
  #t;
@@ -1002,7 +1010,7 @@ var at = class e {
1002
1010
  #r;
1003
1011
  #i;
1004
1012
  constructor(e, t) {
1005
- this.#i = e?.endian, this.#t = F(t.dataType), this.#r = t.shape, this.#e = I(t.shape, "C");
1013
+ this.#i = e?.endian, this.#t = L(t.dataType), this.#r = t.shape, this.#e = R(t.shape, "C");
1006
1014
  let n = new this.#t(0);
1007
1015
  this.#n = n.BYTES_PER_ELEMENT;
1008
1016
  }
@@ -1011,56 +1019,56 @@ var at = class e {
1011
1019
  }
1012
1020
  encode(e) {
1013
1021
  let t = new Uint8Array(e.data.buffer);
1014
- return nt && this.#i === "big" && (t = t.slice(), We(t, it(this.#t))), t;
1022
+ return st && this.#i === "big" && (t = t.slice(), Ye(t, lt(this.#t))), t;
1015
1023
  }
1016
1024
  computeEncodedSize(e) {
1017
1025
  return e;
1018
1026
  }
1019
1027
  decode(e) {
1020
- return nt && this.#i === "big" && (e = e.slice(), We(e, it(this.#t))), e.byteOffset % this.#n !== 0 && (e = e.slice()), {
1028
+ return st && this.#i === "big" && (e = e.slice(), Ye(e, lt(this.#t))), e.byteOffset % this.#n !== 0 && (e = e.slice()), {
1021
1029
  data: new this.#t(e.buffer, e.byteOffset, e.byteLength / this.#n),
1022
1030
  shape: this.#r,
1023
1031
  stride: this.#e
1024
1032
  };
1025
1033
  }
1026
- }, ot = {
1034
+ }, dt = {
1027
1035
  NaN: NaN,
1028
1036
  Infinity: Infinity,
1029
1037
  "-Infinity": -Infinity
1030
- }, st = {
1038
+ }, ft = {
1031
1039
  float16: 2,
1032
1040
  float32: 4,
1033
1041
  float64: 8
1034
1042
  };
1035
- function R(e) {
1036
- return e in st;
1043
+ function B(e) {
1044
+ return e in ft;
1037
1045
  }
1038
- function ct(e) {
1046
+ function pt(e) {
1039
1047
  return e === "int64" || e === "uint64";
1040
1048
  }
1041
- function lt(e, t) {
1049
+ function mt(e, t) {
1042
1050
  let n = BigInt(e), r = new ArrayBuffer(t), i = new DataView(r);
1043
1051
  if (t === 2) {
1044
- if (typeof i.getFloat16 != "function") throw new Re("float16 hex-encoded scalar decoding (requires DataView.prototype.getFloat16)");
1052
+ if (typeof i.getFloat16 != "function") throw new We("float16 hex-encoded scalar decoding (requires DataView.prototype.getFloat16)");
1045
1053
  return i.setUint16(0, Number(n)), i.getFloat16(0);
1046
1054
  }
1047
1055
  return t === 4 ? (i.setUint32(0, Number(n)), i.getFloat32(0)) : (i.setBigUint64(0, n), i.getFloat64(0));
1048
1056
  }
1049
- function z(e, t) {
1050
- if (ct(e)) {
1051
- if (typeof t != "number" || !Number.isInteger(t)) throw new k(`Expected an integer value for data type "${e}", got ${JSON.stringify(t)}`);
1057
+ function V(e, t) {
1058
+ if (pt(e)) {
1059
+ if (typeof t != "number" || !Number.isInteger(t)) throw new A(`Expected an integer value for data type "${e}", got ${JSON.stringify(t)}`);
1052
1060
  return BigInt(t);
1053
1061
  }
1054
1062
  if (typeof t == "number") {
1055
- if (!R(e) && !Number.isInteger(t)) throw new k(`Expected an integer value for data type "${e}", got ${t}`);
1063
+ if (!B(e) && !Number.isInteger(t)) throw new A(`Expected an integer value for data type "${e}", got ${t}`);
1056
1064
  return t;
1057
1065
  }
1058
- if (!R(e)) throw new k(`String-encoded scalar "${t}" is not valid for non-float data type "${e}"`);
1059
- return t in ot ? ot[t] : lt(t, st[e]);
1066
+ if (!B(e)) throw new A(`String-encoded scalar "${t}" is not valid for non-float data type "${e}"`);
1067
+ return t in dt ? dt[t] : mt(t, ft[e]);
1060
1068
  }
1061
1069
  //#endregion
1062
1070
  //#region node_modules/.pnpm/zarrita@0.7.5/node_modules/zarrita/dist/src/codecs/cast_value.js
1063
- var ut = new Set([
1071
+ var ht = new Set([
1064
1072
  "int8",
1065
1073
  "uint8",
1066
1074
  "int16",
@@ -1072,29 +1080,29 @@ var ut = new Set([
1072
1080
  "float16",
1073
1081
  "float32",
1074
1082
  "float64"
1075
- ]), dt = {
1083
+ ]), gt = {
1076
1084
  int8: [-128, 2 ** 7 - 1],
1077
1085
  uint8: [0, 2 ** 8 - 1],
1078
1086
  int16: [-(2 ** 15), 2 ** 15 - 1],
1079
1087
  uint16: [0, 2 ** 16 - 1],
1080
1088
  int32: [-(2 ** 31), 2 ** 31 - 1],
1081
1089
  uint32: [0, 2 ** 32 - 1]
1082
- }, ft = {
1090
+ }, _t = {
1083
1091
  int64: [-(2n ** 63n), 2n ** 63n - 1n],
1084
1092
  uint64: [0n, 2n ** 64n - 1n]
1085
1093
  };
1086
- function pt(e, t, n) {
1094
+ function vt(e, t, n) {
1087
1095
  return e.map(([e, r]) => ({
1088
- src: z(t, e),
1089
- tgt: z(n, r)
1096
+ src: V(t, e),
1097
+ tgt: V(n, r)
1090
1098
  }));
1091
1099
  }
1092
- function mt(e, t) {
1100
+ function yt(e, t) {
1093
1101
  for (let n of t) if (typeof n.src == "number" && Number.isNaN(n.src)) {
1094
1102
  if (typeof e == "number" && Number.isNaN(e)) return n.tgt;
1095
1103
  } else if (e === n.src) return n.tgt;
1096
1104
  }
1097
- function ht(e) {
1105
+ function bt(e) {
1098
1106
  if (!Number.isFinite(e)) return e;
1099
1107
  if (Math.abs(e - Math.trunc(e)) === .5) {
1100
1108
  let t = Math.floor(e), n = Math.ceil(e);
@@ -1102,19 +1110,19 @@ function ht(e) {
1102
1110
  }
1103
1111
  return Math.round(e);
1104
1112
  }
1105
- function gt(e) {
1113
+ function xt(e) {
1106
1114
  return Math.sign(e) * Math.floor(Math.abs(e) + .5);
1107
1115
  }
1108
- function _t(e) {
1116
+ function St(e) {
1109
1117
  switch (e) {
1110
- case "nearest-even": return ht;
1118
+ case "nearest-even": return bt;
1111
1119
  case "towards-zero": return Math.trunc;
1112
1120
  case "towards-positive": return Math.ceil;
1113
1121
  case "towards-negative": return Math.floor;
1114
- case "nearest-away": return gt;
1122
+ case "nearest-away": return xt;
1115
1123
  }
1116
1124
  }
1117
- function vt(e, t, n) {
1125
+ function Ct(e, t, n) {
1118
1126
  let r = t - e + 1;
1119
1127
  switch (n) {
1120
1128
  case "clamp": return (n) => n < e ? e : n > t ? t : n;
@@ -1125,7 +1133,7 @@ function vt(e, t, n) {
1125
1133
  };
1126
1134
  }
1127
1135
  }
1128
- function B(e, t, n) {
1136
+ function wt(e, t, n) {
1129
1137
  let r = t - e + 1n;
1130
1138
  switch (n) {
1131
1139
  case "clamp": return (n) => n < e ? e : n > t ? t : n;
@@ -1136,14 +1144,14 @@ function B(e, t, n) {
1136
1144
  };
1137
1145
  }
1138
1146
  }
1139
- var yt = class e {
1147
+ var Tt = class e {
1140
1148
  kind = "array_to_array";
1141
1149
  #e;
1142
1150
  #t;
1143
1151
  #n;
1144
1152
  #r;
1145
1153
  constructor(e, t, n, r, i, a) {
1146
- this.#e = t, this.#t = F(e), this.#n = bt(t, e, n, r, i), this.#r = bt(e, t, n, r, a);
1154
+ this.#e = t, this.#t = L(e), this.#n = Et(t, e, n, r, i), this.#r = Et(e, t, n, r, a);
1147
1155
  }
1148
1156
  getEncodedMeta(e) {
1149
1157
  let t = e.fillValue;
@@ -1155,12 +1163,12 @@ var yt = class e {
1155
1163
  }
1156
1164
  static fromConfig(t, n) {
1157
1165
  let r = n.dataType, i = t.data_type;
1158
- if (!ut.has(r)) throw new k(`cast_value codec does not support array data type: ${r}`);
1159
- if (!ut.has(i)) throw new k(`cast_value codec does not support encoded data type: ${i}`);
1160
- let a = t.rounding ?? "nearest-even", o = t.scalar_map?.decode ? pt(t.scalar_map.decode, i, r) : [], s = t.scalar_map?.encode ? pt(t.scalar_map.encode, r, i) : [];
1166
+ if (!ht.has(r)) throw new A(`cast_value codec does not support array data type: ${r}`);
1167
+ if (!ht.has(i)) throw new A(`cast_value codec does not support encoded data type: ${i}`);
1168
+ let a = t.rounding ?? "nearest-even", o = t.scalar_map?.decode ? vt(t.scalar_map.decode, i, r) : [], s = t.scalar_map?.encode ? vt(t.scalar_map.encode, r, i) : [];
1161
1169
  return new e(r, i, a, t.out_of_range, o, s);
1162
1170
  }
1163
- encode = j("cast_value");
1171
+ encode = M("cast_value");
1164
1172
  decode(e) {
1165
1173
  let t = e.data, n = new this.#t(t.length);
1166
1174
  for (let e = 0; e < t.length; e++) n[e] = this.#n(t[e]);
@@ -1171,54 +1179,54 @@ var yt = class e {
1171
1179
  };
1172
1180
  }
1173
1181
  };
1174
- function bt(e, t, n, r, i) {
1175
- let a = R(e), o = ct(e), s = R(t), c = ct(t), l;
1182
+ function Et(e, t, n, r, i) {
1183
+ let a = B(e), o = pt(e), s = B(t), c = pt(t), l;
1176
1184
  if (a && s) {
1177
- if (n !== "nearest-even") throw new k(`cast_value float -> float only supports "nearest-even" rounding, got "${n}"`);
1185
+ if (n !== "nearest-even") throw new A(`cast_value float -> float only supports "nearest-even" rounding, got "${n}"`);
1178
1186
  l = (e) => e;
1179
1187
  } else if (a && !s && !c) {
1180
- let e = _t(n), i = vt(...dt[t], r);
1188
+ let e = St(n), i = Ct(...gt[t], r);
1181
1189
  l = (t) => {
1182
1190
  if (!Number.isFinite(t)) throw Error(`Cannot cast ${t} to integer type without scalar_map`);
1183
1191
  return i(e(t));
1184
1192
  };
1185
1193
  } else if (a && c) {
1186
- let e = _t(n), i = B(...ft[t], r);
1194
+ let e = St(n), i = wt(..._t[t], r);
1187
1195
  l = (t) => {
1188
1196
  if (!Number.isFinite(t)) throw Error(`Cannot cast ${t} to integer type without scalar_map`);
1189
1197
  return i(BigInt(e(t)));
1190
1198
  };
1191
1199
  } else if (!a && !o && s) l = (e) => e;
1192
1200
  else if (o && s) l = (e) => Number(e);
1193
- else if (!a && !o && !s && !c) l = vt(...dt[t], r);
1201
+ else if (!a && !o && !s && !c) l = Ct(...gt[t], r);
1194
1202
  else if (!a && !o && c) {
1195
- let e = B(...ft[t], r);
1203
+ let e = wt(..._t[t], r);
1196
1204
  l = (t) => e(BigInt(t));
1197
1205
  } else if (o && !s && !c) {
1198
- let e = vt(...dt[t], r);
1206
+ let e = Ct(...gt[t], r);
1199
1207
  l = (t) => e(Number(t));
1200
- } else if (o && c) l = B(...ft[t], r);
1208
+ } else if (o && c) l = wt(..._t[t], r);
1201
1209
  else throw Error(`Unhandled type combination: ${e} -> ${t}`);
1202
1210
  return i.length === 0 ? l : (e) => {
1203
- let t = mt(e, i);
1211
+ let t = yt(e, i);
1204
1212
  return t === void 0 ? l(e) : t;
1205
1213
  };
1206
1214
  }
1207
1215
  //#endregion
1208
1216
  //#region node_modules/.pnpm/zarrita@0.7.5/node_modules/zarrita/dist/src/codecs/crc32c.js
1209
- var xt = class e {
1217
+ var Dt = class e {
1210
1218
  kind = "bytes_to_bytes";
1211
1219
  static fromConfig() {
1212
1220
  return new e();
1213
1221
  }
1214
- encode = j("crc32c");
1222
+ encode = M("crc32c");
1215
1223
  decode(e) {
1216
1224
  return new Uint8Array(e.buffer, e.byteOffset, e.byteLength - 4);
1217
1225
  }
1218
1226
  computeEncodedSize(e) {
1219
1227
  return e + 4;
1220
1228
  }
1221
- }, St = new Set([
1229
+ }, Ot = new Set([
1222
1230
  "int8",
1223
1231
  "uint8",
1224
1232
  "int16",
@@ -1231,7 +1239,7 @@ var xt = class e {
1231
1239
  "float32",
1232
1240
  "float64"
1233
1241
  ]);
1234
- function Ct(e, t) {
1242
+ function kt(e, t) {
1235
1243
  let n = e.length, r = n === 0 || t[n - 1] === 1;
1236
1244
  for (let i = n - 2; i >= 0 && r; i--) r = t[i] === t[i + 1] * e[i + 1];
1237
1245
  if (r) return;
@@ -1239,18 +1247,18 @@ function Ct(e, t) {
1239
1247
  for (let r = 1; r < n && i; r++) i = t[r] === t[r - 1] * e[r - 1];
1240
1248
  if (!i) throw Error(`DeltaCodec requires C- or Fortran-contiguous strides, got shape=${JSON.stringify(e)} stride=${JSON.stringify(t)}`);
1241
1249
  }
1242
- var wt = class e {
1250
+ var At = class e {
1243
1251
  kind = "array_to_array";
1244
1252
  #e;
1245
1253
  constructor(e) {
1246
1254
  this.#e = e;
1247
1255
  }
1248
1256
  static fromConfig(t, n) {
1249
- if (!St.has(n.dataType)) throw new k(`Delta codec does not support data type: ${n.dataType}`);
1250
- return new e(F(n.dataType));
1257
+ if (!Ot.has(n.dataType)) throw new A(`Delta codec does not support data type: ${n.dataType}`);
1258
+ return new e(L(n.dataType));
1251
1259
  }
1252
1260
  encode(e) {
1253
- Ct(e.shape, e.stride);
1261
+ kt(e.shape, e.stride);
1254
1262
  let t = e.data, n = new this.#e(t.length);
1255
1263
  n[0] = t[0];
1256
1264
  for (let e = 1; e < t.length; e++) n[e] = t[e] - t[e - 1];
@@ -1261,7 +1269,7 @@ var wt = class e {
1261
1269
  };
1262
1270
  }
1263
1271
  decode(e) {
1264
- Ct(e.shape, e.stride);
1272
+ kt(e.shape, e.stride);
1265
1273
  let t = e.data, n = new this.#e(t.length);
1266
1274
  n[0] = t[0];
1267
1275
  for (let e = 1; e < t.length; e++) n[e] = n[e - 1] + t[e];
@@ -1271,26 +1279,26 @@ var wt = class e {
1271
1279
  stride: e.stride
1272
1280
  };
1273
1281
  }
1274
- }, Tt = class e {
1282
+ }, jt = class e {
1275
1283
  kind = "bytes_to_bytes";
1276
1284
  static fromConfig(t) {
1277
1285
  return new e();
1278
1286
  }
1279
- encode = j("gzip");
1287
+ encode = M("gzip");
1280
1288
  async decode(e) {
1281
- let t = await tt(e, { format: "gzip" });
1289
+ let t = await ot(e, { format: "gzip" });
1282
1290
  return new Uint8Array(t);
1283
1291
  }
1284
1292
  };
1285
1293
  //#endregion
1286
1294
  //#region node_modules/.pnpm/zarrita@0.7.5/node_modules/zarrita/dist/src/codecs/json2.js
1287
- function Et(e, t) {
1288
- return L(!Number.isNaN(t), "JsonCodec allow_nan is false but NaN was encountered during encoding."), L(t !== Infinity, "JsonCodec allow_nan is false but Infinity was encountered during encoding."), L(t !== -Infinity, "JsonCodec allow_nan is false but -Infinity was encountered during encoding."), t;
1295
+ function Mt(e, t) {
1296
+ return z(!Number.isNaN(t), "JsonCodec allow_nan is false but NaN was encountered during encoding."), z(t !== Infinity, "JsonCodec allow_nan is false but Infinity was encountered during encoding."), z(t !== -Infinity, "JsonCodec allow_nan is false but -Infinity was encountered during encoding."), t;
1289
1297
  }
1290
- function Dt(e, t) {
1298
+ function Nt(e, t) {
1291
1299
  return t instanceof Object && !Array.isArray(t) ? Object.keys(t).sort().reduce((e, n) => (e[n] = t[n], e), {}) : t;
1292
1300
  }
1293
- var Ot = class e {
1301
+ var Pt = class e {
1294
1302
  configuration;
1295
1303
  kind = "array_to_bytes";
1296
1304
  #e;
@@ -1314,9 +1322,9 @@ var Ot = class e {
1314
1322
  }
1315
1323
  encode(e) {
1316
1324
  let { indent: t, encoding: n, ensure_ascii: r, check_circular: i, allow_nan: a, sort_keys: o } = this.#e;
1317
- L(n === "utf-8", "JsonCodec does not yet support non-utf-8 encoding.");
1325
+ z(n === "utf-8", "JsonCodec does not yet support non-utf-8 encoding.");
1318
1326
  let s = [];
1319
- L(i, "JsonCodec does not yet support skipping the check for circular references during encoding."), a || s.push(Et), o && s.push(Dt);
1327
+ z(i, "JsonCodec does not yet support skipping the check for circular references during encoding."), a || s.push(Mt), o && s.push(Nt);
1320
1328
  let c = Array.from(e.data);
1321
1329
  c.push("|O"), c.push(e.shape);
1322
1330
  let l;
@@ -1333,15 +1341,15 @@ var Ot = class e {
1333
1341
  }
1334
1342
  decode(e) {
1335
1343
  let { strict: t } = this.#t;
1336
- L(t, "JsonCodec does not yet support non-strict decoding.");
1337
- let n = P(e), r = n.pop();
1338
- return n.pop(), L(r, "0D not implemented for JsonCodec."), {
1344
+ z(t, "JsonCodec does not yet support non-strict decoding.");
1345
+ let n = I(e), r = n.pop();
1346
+ return n.pop(), z(r, "0D not implemented for JsonCodec."), {
1339
1347
  data: n,
1340
1348
  shape: r,
1341
- stride: I(r, "C")
1349
+ stride: R(r, "C")
1342
1350
  };
1343
1351
  }
1344
- }, kt = new Set([
1352
+ }, Ft = new Set([
1345
1353
  "int8",
1346
1354
  "uint8",
1347
1355
  "int16",
@@ -1353,7 +1361,7 @@ var Ot = class e {
1353
1361
  "float16",
1354
1362
  "float32",
1355
1363
  "float64"
1356
- ]), At = class e {
1364
+ ]), It = class e {
1357
1365
  kind = "array_to_array";
1358
1366
  #e;
1359
1367
  #t;
@@ -1362,10 +1370,10 @@ var Ot = class e {
1362
1370
  this.#t = e, this.#n = t, this.#e = n;
1363
1371
  }
1364
1372
  static fromConfig(t, n) {
1365
- if (!kt.has(n.dataType)) throw new k(`scale_offset codec does not support data type: ${n.dataType}`);
1366
- return new e(z(n.dataType, t.scale ?? 1), z(n.dataType, t.offset ?? 0), F(n.dataType));
1373
+ if (!Ft.has(n.dataType)) throw new A(`scale_offset codec does not support data type: ${n.dataType}`);
1374
+ return new e(V(n.dataType, t.scale ?? 1), V(n.dataType, t.offset ?? 0), L(n.dataType));
1367
1375
  }
1368
- encode = j("scale_offset");
1376
+ encode = M("scale_offset");
1369
1377
  decode(e) {
1370
1378
  let t = e.data, n = new this.#e(t.length);
1371
1379
  for (let e = 0; e < t.length; e++) n[e] = t[e] / this.#t + this.#n;
@@ -1375,39 +1383,39 @@ var Ot = class e {
1375
1383
  stride: e.stride
1376
1384
  };
1377
1385
  }
1378
- }, jt = class e {
1386
+ }, Lt = class e {
1379
1387
  kind = "bytes_to_bytes";
1380
1388
  #e;
1381
1389
  constructor(e, t) {
1382
1390
  if (t) {
1383
- let e = new (F(t.dataType))(0);
1384
- L("BYTES_PER_ELEMENT" in e, `Shuffle codec requires a fixed-size dtype, got "${t.dataType}"`), this.#e = e.BYTES_PER_ELEMENT;
1391
+ let e = new (L(t.dataType))(0);
1392
+ z("BYTES_PER_ELEMENT" in e, `Shuffle codec requires a fixed-size dtype, got "${t.dataType}"`), this.#e = e.BYTES_PER_ELEMENT;
1385
1393
  } else this.#e = e.elementsize ?? 4;
1386
1394
  }
1387
1395
  static fromConfig(t, n) {
1388
1396
  return new e(t, n);
1389
1397
  }
1390
1398
  encode(e) {
1391
- return Mt(e, this.#e);
1399
+ return Rt(e, this.#e);
1392
1400
  }
1393
1401
  decode(e) {
1394
- return Nt(e, this.#e);
1402
+ return zt(e, this.#e);
1395
1403
  }
1396
1404
  };
1397
- function Mt(e, t) {
1405
+ function Rt(e, t) {
1398
1406
  let n = e.length, r = Math.floor(n / t), i = new Uint8Array(n);
1399
1407
  for (let n = 0; n < t; n++) for (let a = 0; a < r; a++) i[n * r + a] = e[a * t + n];
1400
1408
  return i;
1401
1409
  }
1402
- function Nt(e, t) {
1410
+ function zt(e, t) {
1403
1411
  let n = e.length, r = Math.floor(n / t), i = new Uint8Array(n);
1404
1412
  for (let n = 0; n < t; n++) for (let a = 0; a < r; a++) i[a * t + n] = e[n * r + a];
1405
1413
  return i;
1406
1414
  }
1407
1415
  //#endregion
1408
1416
  //#region node_modules/.pnpm/zarrita@0.7.5/node_modules/zarrita/dist/src/codecs/transpose.js
1409
- function Pt(e) {
1410
- return e instanceof Be || e instanceof N || e instanceof Ve ? new Proxy(e, {
1417
+ function Bt(e) {
1418
+ return e instanceof Ke || e instanceof P || e instanceof F ? new Proxy(e, {
1411
1419
  get(e, t) {
1412
1420
  return e.get(Number(t));
1413
1421
  },
@@ -1416,16 +1424,16 @@ function Pt(e) {
1416
1424
  }
1417
1425
  }) : e;
1418
1426
  }
1419
- function Ft(e, t) {
1427
+ function Vt(e, t) {
1420
1428
  let n;
1421
- return n = e.data instanceof N || e.data instanceof Ve ? new e.data.constructor(e.data.chars, e.data.length) : new e.data.constructor(e.data.length), {
1429
+ return n = e.data instanceof P || e.data instanceof F ? new e.data.constructor(e.data.chars, e.data.length) : new e.data.constructor(e.data.length), {
1422
1430
  data: n,
1423
1431
  shape: e.shape,
1424
- stride: I(e.shape, t)
1432
+ stride: R(e.shape, t)
1425
1433
  };
1426
1434
  }
1427
- function It(e, t) {
1428
- let n = Ft(e, t), r = e.shape.length, i = e.shape.reduce((e, t) => e * t, 1), a = Array(r).fill(0), o = Pt(e.data), s = Pt(n.data);
1435
+ function Ht(e, t) {
1436
+ let n = Vt(e, t), r = e.shape.length, i = e.shape.reduce((e, t) => e * t, 1), a = Array(r).fill(0), o = Bt(e.data), s = Bt(n.data);
1429
1437
  for (let t = 0; t < i; t++) {
1430
1438
  let t = 0, i = 0;
1431
1439
  for (let o = 0; o < r; o++) t += a[o] * e.stride[o], i += a[o] * n.stride[o];
@@ -1437,18 +1445,18 @@ function It(e, t) {
1437
1445
  }
1438
1446
  return n;
1439
1447
  }
1440
- function Lt(e) {
1448
+ function Ut(e) {
1441
1449
  let t = e.shape.length;
1442
- return L(t === e.stride.length, "Shape and stride must have the same length."), e.stride.map((e, t) => ({
1450
+ return z(t === e.stride.length, "Shape and stride must have the same length."), e.stride.map((e, t) => ({
1443
1451
  stride: e,
1444
1452
  index: t
1445
1453
  })).sort((e, t) => t.stride - e.stride).map((e) => e.index);
1446
1454
  }
1447
- function Rt(e, t) {
1448
- let n = Lt(e);
1449
- return L(n.length === t.length, "Orders must match"), n.every((e, n) => e === t[n]);
1455
+ function Wt(e, t) {
1456
+ let n = Ut(e);
1457
+ return z(n.length === t.length, "Orders must match"), n.every((e, n) => e === t[n]);
1450
1458
  }
1451
- var zt = class e {
1459
+ var Gt = class e {
1452
1460
  kind = "array_to_array";
1453
1461
  #e;
1454
1462
  constructor(e, t) {
@@ -1459,7 +1467,7 @@ var zt = class e {
1459
1467
  i = n;
1460
1468
  let e = Array(r);
1461
1469
  i.forEach((t) => {
1462
- L(!e[t], `Invalid permutation: ${JSON.stringify(n)}`), e[t] = !0;
1470
+ z(!e[t], `Invalid permutation: ${JSON.stringify(n)}`), e[t] = !0;
1463
1471
  });
1464
1472
  }
1465
1473
  this.#e = i;
@@ -1468,26 +1476,26 @@ var zt = class e {
1468
1476
  return new e(t, n);
1469
1477
  }
1470
1478
  encode(e) {
1471
- return Rt(e, this.#e) ? e : It(e, this.#e);
1479
+ return Wt(e, this.#e) ? e : Ht(e, this.#e);
1472
1480
  }
1473
1481
  decode(e) {
1474
1482
  return {
1475
1483
  data: e.data,
1476
1484
  shape: e.shape,
1477
- stride: I(e.shape, this.#e)
1485
+ stride: R(e.shape, this.#e)
1478
1486
  };
1479
1487
  }
1480
- }, Bt = class e {
1488
+ }, Kt = class e {
1481
1489
  kind = "array_to_bytes";
1482
1490
  #e;
1483
1491
  #t;
1484
1492
  constructor(e) {
1485
- this.#e = e, this.#t = I(e, "C");
1493
+ this.#e = e, this.#t = R(e, "C");
1486
1494
  }
1487
1495
  static fromConfig(t, n) {
1488
1496
  return new e(n.shape);
1489
1497
  }
1490
- encode = j("vlen-utf8");
1498
+ encode = M("vlen-utf8");
1491
1499
  decode(e) {
1492
1500
  let t = new TextDecoder(), n = new DataView(e.buffer), r = Array(n.getUint32(0, !0)), i = 4;
1493
1501
  for (let a = 0; a < r.length; a++) {
@@ -1500,34 +1508,34 @@ var zt = class e {
1500
1508
  stride: this.#t
1501
1509
  };
1502
1510
  }
1503
- }, Vt = class e {
1511
+ }, qt = class e {
1504
1512
  kind = "bytes_to_bytes";
1505
1513
  static fromConfig(t) {
1506
1514
  return new e();
1507
1515
  }
1508
- encode = j("zlib");
1516
+ encode = M("zlib");
1509
1517
  async decode(e) {
1510
- let t = await tt(e, { format: "deflate" });
1518
+ let t = await ot(e, { format: "deflate" });
1511
1519
  return new Uint8Array(t);
1512
1520
  }
1513
1521
  };
1514
1522
  //#endregion
1515
1523
  //#region node_modules/.pnpm/zarrita@0.7.5/node_modules/zarrita/dist/src/codecs.js
1516
- function Ht() {
1517
- let e = () => import("./blosc-D7C3XedS.js").then((e) => e.default), t = () => import("./lz4-O6H78S8a.js").then((e) => e.default), n = () => import("./zstd-GeB6dyr_.js").then((e) => e.default), r = () => Tt, i = () => Vt;
1518
- return (/* @__PURE__ */ new Map()).set("blosc", e).set("lz4", t).set("zstd", n).set("gzip", r).set("zlib", i).set("transpose", () => zt).set("bytes", () => at).set("crc32c", () => xt).set("vlen-utf8", () => Bt).set("json2", () => Ot).set("bitround", () => ze).set("cast_value", () => yt).set("scale_offset", () => At).set("numcodecs.blosc", e).set("numcodecs.lz4", t).set("numcodecs.zstd", n).set("numcodecs.gzip", r).set("numcodecs.zlib", i).set("numcodecs.vlen-utf8", () => Bt).set("numcodecs.shuffle", () => jt).set("numcodecs.delta", () => wt).set("numcodecs.bitround", () => ze).set("numcodecs.json2", () => Ot);
1524
+ function Jt() {
1525
+ let e = () => import("./blosc-D7C3XedS.js").then((e) => e.default), t = () => import("./lz4-O6H78S8a.js").then((e) => e.default), n = () => import("./zstd-GeB6dyr_.js").then((e) => e.default), r = () => jt, i = () => qt;
1526
+ return (/* @__PURE__ */ new Map()).set("blosc", e).set("lz4", t).set("zstd", n).set("gzip", r).set("zlib", i).set("transpose", () => Gt).set("bytes", () => ut).set("crc32c", () => Dt).set("vlen-utf8", () => Kt).set("json2", () => Pt).set("bitround", () => Ge).set("cast_value", () => Tt).set("scale_offset", () => It).set("numcodecs.blosc", e).set("numcodecs.lz4", t).set("numcodecs.zstd", n).set("numcodecs.gzip", r).set("numcodecs.zlib", i).set("numcodecs.vlen-utf8", () => Kt).set("numcodecs.shuffle", () => Lt).set("numcodecs.delta", () => At).set("numcodecs.bitround", () => Ge).set("numcodecs.json2", () => Pt);
1519
1527
  }
1520
- var Ut = Ht();
1521
- function V(e) {
1528
+ var Yt = Jt();
1529
+ function Xt(e) {
1522
1530
  let t;
1523
1531
  function n() {
1524
- return t ||= Gt(e), t;
1532
+ return t ||= Qt(e), t;
1525
1533
  }
1526
1534
  async function r(e, t, n) {
1527
1535
  try {
1528
1536
  return await n();
1529
1537
  } catch (n) {
1530
- throw new Le({
1538
+ throw new Ue({
1531
1539
  direction: e,
1532
1540
  codec: t,
1533
1541
  cause: n
@@ -1556,20 +1564,20 @@ function V(e) {
1556
1564
  return i;
1557
1565
  },
1558
1566
  async computeEncodedSize(e) {
1559
- let t = await n(), r = Wt(t.arrayToBytes.name, t.arrayToBytes.codec, e);
1560
- for (let { name: e, codec: n } of t.bytesToBytes) r = Wt(e, n, r);
1567
+ let t = await n(), r = Zt(t.arrayToBytes.name, t.arrayToBytes.codec, e);
1568
+ for (let { name: e, codec: n } of t.bytesToBytes) r = Zt(e, n, r);
1561
1569
  return r;
1562
1570
  }
1563
1571
  };
1564
1572
  }
1565
- function Wt(e, t, n) {
1566
- if (!t.computeEncodedSize) throw new k(`Codec "${e}" cannot compute its encoded size; it is not a fixed-size codec and cannot be used in a sharding index pipeline`);
1573
+ function Zt(e, t, n) {
1574
+ if (!t.computeEncodedSize) throw new A(`Codec "${e}" cannot compute its encoded size; it is not a fixed-size codec and cannot be used in a sharding index pipeline`);
1567
1575
  return t.computeEncodedSize(n);
1568
1576
  }
1569
- async function Gt(e) {
1577
+ async function Qt(e) {
1570
1578
  let t = e.codecs.map(async (e) => {
1571
- let t = await Ut.get(e.name)?.();
1572
- if (!t) throw new Ie(e.name);
1579
+ let t = await Yt.get(e.name)?.();
1580
+ if (!t) throw new He(e.name);
1573
1581
  return {
1574
1582
  Codec: t,
1575
1583
  meta: e
@@ -1597,10 +1605,10 @@ async function Gt(e) {
1597
1605
  }
1598
1606
  }
1599
1607
  if (!r) {
1600
- if (!Kt(a)) throw new k(`Cannot encode ${a.dataType} to bytes without a codec`);
1608
+ if (!$t(a)) throw new A(`Cannot encode ${a.dataType} to bytes without a codec`);
1601
1609
  r = {
1602
1610
  name: "bytes",
1603
- codec: at.fromConfig({ endian: "little" }, a)
1611
+ codec: ut.fromConfig({ endian: "little" }, a)
1604
1612
  };
1605
1613
  }
1606
1614
  return {
@@ -1609,15 +1617,15 @@ async function Gt(e) {
1609
1617
  bytesToBytes: i
1610
1618
  };
1611
1619
  }
1612
- function Kt(e) {
1620
+ function $t(e) {
1613
1621
  return e.dataType !== "v2:object" && e.dataType !== "string";
1614
1622
  }
1615
1623
  //#endregion
1616
1624
  //#region node_modules/.pnpm/zarrita@0.7.5/node_modules/zarrita/dist/src/codecs/sharding.js
1617
- var qt = 18446744073709551615n;
1618
- function Jt(e, t, n, r) {
1619
- if (!e.store.getRange) throw new Re("sharding requires a store with getRange");
1620
- let i = e.store.getRange.bind(e.store), a = t.map((e, t) => e / r.chunk_shape[t]), o = V({
1625
+ var en = 18446744073709551615n;
1626
+ function tn(e, t, n, r) {
1627
+ if (!e.store.getRange) throw new We("sharding requires a store with getRange");
1628
+ let i = e.store.getRange.bind(e.store), a = t.map((e, t) => e / r.chunk_shape[t]), o = Xt({
1621
1629
  dataType: "uint64",
1622
1630
  shape: [...a, 2],
1623
1631
  codecs: r.index_codecs,
@@ -1634,7 +1642,7 @@ function Jt(e, t, n, r) {
1634
1642
  let d = await c[u];
1635
1643
  if (d === null) return;
1636
1644
  let { data: f, shape: p, stride: m } = d, h = t.map((e, t) => e % p[t]).reduce((e, t, n) => e + t * m[n], 0), g = f[h], _ = f[h + 1];
1637
- if (!(g === qt && _ === qt)) return i(u, {
1645
+ if (!(g === en && _ === en)) return i(u, {
1638
1646
  offset: Number(g),
1639
1647
  length: Number(_)
1640
1648
  }, r);
@@ -1653,7 +1661,7 @@ var H = class e {
1653
1661
  return new e(this.store, decodeURIComponent(new URL(t, n).pathname));
1654
1662
  }
1655
1663
  };
1656
- function Yt(e) {
1664
+ function nn(e) {
1657
1665
  return new H(e ?? /* @__PURE__ */ new Map());
1658
1666
  }
1659
1667
  var U = class extends H {
@@ -1666,54 +1674,54 @@ var U = class extends H {
1666
1674
  return this.#e.attributes;
1667
1675
  }
1668
1676
  };
1669
- function Xt(e) {
1677
+ function rn(e) {
1670
1678
  return e.find((e) => e.name === "transpose")?.configuration?.order ?? "C";
1671
1679
  }
1672
- function Zt(e, t) {
1680
+ function an(e, t) {
1673
1681
  let n = new Map(t.map((e, t) => [e, t]));
1674
1682
  return e.filter((e) => n.has(e)).map((e) => n.get(e));
1675
1683
  }
1676
- function Qt(e) {
1677
- return (t, n) => I(t, globalThis.Array.isArray(e) && n ? Zt(e, n) : e);
1684
+ function on(e) {
1685
+ return (t, n) => R(t, globalThis.Array.isArray(e) && n ? an(e, n) : e);
1678
1686
  }
1679
1687
  var W = Symbol("zarrita.context");
1680
- function $t(e) {
1688
+ function sn(e) {
1681
1689
  return e[W];
1682
1690
  }
1683
- function en(e, t) {
1684
- let { configuration: n } = t.codecs.find(Ze) ?? {}, r = {
1685
- encodeChunkKey: Ge(t.chunk_key_encoding),
1686
- TypedArray: F(t.data_type),
1691
+ function cn(e, t) {
1692
+ let { configuration: n } = t.codecs.find(nt) ?? {}, r = {
1693
+ encodeChunkKey: Xe(t.chunk_key_encoding),
1694
+ TypedArray: L(t.data_type),
1687
1695
  fillValue: t.fill_value
1688
1696
  };
1689
1697
  if (n) {
1690
- let i = Xt(n.codecs);
1698
+ let i = rn(n.codecs);
1691
1699
  return {
1692
1700
  ...r,
1693
1701
  kind: "sharded",
1694
1702
  chunkShape: n.chunk_shape,
1695
- codec: V({
1703
+ codec: Xt({
1696
1704
  dataType: t.data_type,
1697
1705
  shape: n.chunk_shape,
1698
1706
  codecs: n.codecs,
1699
1707
  fillValue: t.fill_value
1700
1708
  }),
1701
- getStrides: Qt(i),
1702
- getChunkBytes: Jt(e, t.chunk_grid.configuration.chunk_shape, r.encodeChunkKey, n)
1709
+ getStrides: on(i),
1710
+ getChunkBytes: tn(e, t.chunk_grid.configuration.chunk_shape, r.encodeChunkKey, n)
1703
1711
  };
1704
1712
  }
1705
- let i = Xt(t.codecs);
1713
+ let i = rn(t.codecs);
1706
1714
  return {
1707
1715
  ...r,
1708
1716
  kind: "regular",
1709
1717
  chunkShape: t.chunk_grid.configuration.chunk_shape,
1710
- codec: V({
1718
+ codec: Xt({
1711
1719
  dataType: t.data_type,
1712
1720
  shape: t.chunk_grid.configuration.chunk_shape,
1713
1721
  codecs: t.codecs,
1714
1722
  fillValue: t.fill_value
1715
1723
  }),
1716
- getStrides: Qt(i),
1724
+ getStrides: on(i),
1717
1725
  async getChunkBytes(t, n) {
1718
1726
  let i = r.encodeChunkKey(t), a = e.resolve(i).path;
1719
1727
  return e.store.get(a, n);
@@ -1727,8 +1735,8 @@ var G = class extends H {
1727
1735
  constructor(e, t, n) {
1728
1736
  super(e, t), this.#e = {
1729
1737
  ...n,
1730
- fill_value: Qe(n)
1731
- }, this[W] = en(this, this.#e);
1738
+ fill_value: rt(n)
1739
+ }, this[W] = cn(this, this.#e);
1732
1740
  }
1733
1741
  get attrs() {
1734
1742
  return this.#e.attributes;
@@ -1749,7 +1757,7 @@ var G = class extends H {
1749
1757
  return this.#e.data_type;
1750
1758
  }
1751
1759
  async getChunk(e, t, n) {
1752
- n?.useSharedArrayBuffer && He();
1760
+ n?.useSharedArrayBuffer && qe();
1753
1761
  let r = this[W], i = await r.getChunkBytes(e, t);
1754
1762
  if (!i) {
1755
1763
  let e = r.chunkShape.reduce((e, t) => e * t, 1), t;
@@ -1757,7 +1765,7 @@ var G = class extends H {
1757
1765
  let n = new r.TypedArray(0);
1758
1766
  if (!("BYTES_PER_ELEMENT" in n)) console.warn("zarrita: useSharedArrayBuffer is not supported for non-buffer-backed data types."), t = new r.TypedArray(e);
1759
1767
  else {
1760
- let i = Ue(e * n.BYTES_PER_ELEMENT, !0);
1768
+ let i = Je(e * n.BYTES_PER_ELEMENT, !0);
1761
1769
  t = new r.TypedArray(i, 0, e);
1762
1770
  }
1763
1771
  } else t = new r.TypedArray(e);
@@ -1770,29 +1778,29 @@ var G = class extends H {
1770
1778
  return r.codec.decode(i);
1771
1779
  }
1772
1780
  is(e) {
1773
- return Xe(this.dtype, e);
1781
+ return tt(this.dtype, e);
1774
1782
  }
1775
1783
  };
1776
1784
  //#endregion
1777
1785
  //#region node_modules/.pnpm/zarrita@0.7.5/node_modules/zarrita/dist/src/extension/extend.js
1778
- function tn(e, t) {
1786
+ function ln(e, t) {
1779
1787
  let n = e;
1780
1788
  for (let e of t) n = n instanceof Promise ? n.then((t) => e(t)) : e(n);
1781
1789
  return n;
1782
1790
  }
1783
1791
  //#endregion
1784
1792
  //#region node_modules/.pnpm/zarrita@0.7.5/node_modules/zarrita/dist/src/extension/extend-array.js
1785
- function nn(e, ...t) {
1786
- return tn(e, t);
1793
+ function un(e, ...t) {
1794
+ return ln(e, t);
1787
1795
  }
1788
1796
  //#endregion
1789
1797
  //#region node_modules/.pnpm/zarrita@0.7.5/node_modules/zarrita/dist/src/open.js
1790
- async function rn(e) {
1798
+ async function dn(e) {
1791
1799
  let t = e.store.arrayExtensions;
1792
- return t?.length ? await nn(e, ...t) : e;
1800
+ return t?.length ? await un(e, ...t) : e;
1793
1801
  }
1794
- var K = an();
1795
- function an() {
1802
+ var K = fn();
1803
+ function fn() {
1796
1804
  let e = /* @__PURE__ */ new WeakMap();
1797
1805
  function t(t) {
1798
1806
  let n = e.get(t) ?? {
@@ -1811,51 +1819,51 @@ function an() {
1811
1819
  }
1812
1820
  };
1813
1821
  }
1814
- async function on(e, t) {
1822
+ async function pn(e, t) {
1815
1823
  let n = await e.store.get(e.resolve(".zattrs").path, { signal: t });
1816
- return n ? P(n) : {};
1824
+ return n ? I(n) : {};
1817
1825
  }
1818
- async function sn(e, t = {}) {
1826
+ async function mn(e, t = {}) {
1819
1827
  let n = "store" in e ? e : new H(e), { signal: r } = t, i = {};
1820
- return (t.attrs ?? !0) && (i = await on(n, r)), r?.throwIfAborted(), t.kind === "array" ? cn(n, i, r) : t.kind === "group" ? ln(n, i, r) : cn(n, i, r).catch((e) => (et(e, O, k), ln(n, i, r)));
1828
+ return (t.attrs ?? !0) && (i = await pn(n, r)), r?.throwIfAborted(), t.kind === "array" ? hn(n, i, r) : t.kind === "group" ? gn(n, i, r) : hn(n, i, r).catch((e) => (at(e, k, A), gn(n, i, r)));
1821
1829
  }
1822
- async function cn(e, t, n) {
1830
+ async function hn(e, t, n) {
1823
1831
  let { path: r } = e.resolve(".zarray"), i = await e.store.get(r, { signal: n });
1824
- if (!i) throw new O("v2 array", { path: r });
1825
- return K.increment(e.store, "v2"), rn(new G(e.store, e.path, Je(P(i), t)));
1832
+ if (!i) throw new k("v2 array", { path: r });
1833
+ return K.increment(e.store, "v2"), dn(new G(e.store, e.path, $e(I(i), t)));
1826
1834
  }
1827
- async function ln(e, t, n) {
1835
+ async function gn(e, t, n) {
1828
1836
  let { path: r } = e.resolve(".zgroup"), i = await e.store.get(r, { signal: n });
1829
- if (!i) throw new O("v2 group", { path: r });
1830
- return K.increment(e.store, "v2"), new U(e.store, e.path, Ye(P(i), t));
1837
+ if (!i) throw new k("v2 group", { path: r });
1838
+ return K.increment(e.store, "v2"), new U(e.store, e.path, et(I(i), t));
1831
1839
  }
1832
- async function un(e, t) {
1840
+ async function _n(e, t) {
1833
1841
  let { store: n, path: r } = e.resolve("zarr.json"), i = await e.store.get(r, { signal: t });
1834
- if (!i) throw new O("v3 array or group", { path: r });
1835
- let a = P(i);
1836
- return a.node_type === "array" && (a.fill_value = Qe(a)), a.node_type === "array" ? rn(new G(n, e.path, a)) : new U(n, e.path, a);
1842
+ if (!i) throw new k("v3 array or group", { path: r });
1843
+ let a = I(i);
1844
+ return a.node_type === "array" && (a.fill_value = rt(a)), a.node_type === "array" ? dn(new G(n, e.path, a)) : new U(n, e.path, a);
1837
1845
  }
1838
- async function dn(e, t = {}) {
1839
- let n = "store" in e ? e : new H(e), r = await un(n, t.signal);
1846
+ async function vn(e, t = {}) {
1847
+ let n = "store" in e ? e : new H(e), r = await _n(n, t.signal);
1840
1848
  if (K.increment(n.store, "v3"), t.kind === void 0 || t.kind === "array" && r instanceof G || t.kind === "group" && r instanceof U) return r;
1841
1849
  let i = r instanceof G ? "array" : "group";
1842
- throw new O(`${t.kind} at ${n.path}`, {
1850
+ throw new k(`${t.kind} at ${n.path}`, {
1843
1851
  path: n.path,
1844
1852
  found: i
1845
1853
  });
1846
1854
  }
1847
1855
  async function q(e, t = {}) {
1848
1856
  let n = "store" in e ? e.store : e, r = K.versionMax(n), i = r === "v2" ? q.v2 : q.v3, a = r === "v2" ? q.v3 : q.v2;
1849
- return i(e, t).catch((n) => (et(n, O, k), a(e, t)));
1857
+ return i(e, t).catch((n) => (at(n, k, A), a(e, t)));
1850
1858
  }
1851
- q.v2 = sn, q.v3 = dn;
1859
+ q.v2 = mn, q.v3 = vn;
1852
1860
  //#endregion
1853
1861
  //#region node_modules/.pnpm/zarrita@0.7.5/node_modules/zarrita/dist/src/indexing/util.js
1854
- function* fn(e, t, n = 1) {
1862
+ function* yn(e, t, n = 1) {
1855
1863
  t === void 0 && (t = e, e = 0);
1856
1864
  for (let r = e; r < t; r += n) yield r;
1857
1865
  }
1858
- function* pn(...e) {
1866
+ function* bn(...e) {
1859
1867
  if (e.length === 0) return;
1860
1868
  let t = e.map((e) => e[Symbol.iterator]()), n = t.map((e) => e.next());
1861
1869
  if (n.some((e) => e.done)) throw Error("Input contains an empty iterator.");
@@ -1866,8 +1874,8 @@ function* pn(...e) {
1866
1874
  n[r] = t[r].next();
1867
1875
  }
1868
1876
  }
1869
- function mn({ start: e, stop: t, step: n }, r) {
1870
- if (n === 0) throw new A("slice step cannot be zero");
1877
+ function xn({ start: e, stop: t, step: n }, r) {
1878
+ if (n === 0) throw new j("slice step cannot be zero");
1871
1879
  n ??= 1;
1872
1880
  let i = n < 0, [a, o] = i ? [-1, r - 1] : [0, r];
1873
1881
  return e === null ? e = i ? o : a : e < 0 ? (e += r, e < a && (e = a)) : e > o && (e = o), t === null ? t = i ? a : o : t < 0 ? (t += r, t < a && (t = a)) : t > o && (t = o), [
@@ -1876,22 +1884,22 @@ function mn({ start: e, stop: t, step: n }, r) {
1876
1884
  n
1877
1885
  ];
1878
1886
  }
1879
- function hn(e) {
1887
+ function Sn(e) {
1880
1888
  if (e == null) return null;
1881
1889
  if (typeof e == "bigint") {
1882
- if (e > 2 ** 53 - 1 || e < -(2 ** 53 - 1)) throw new A(`Cannot safely convert ${e} to a number. Value exceeds Number.MAX_SAFE_INTEGER.`);
1890
+ if (e > 2 ** 53 - 1 || e < -(2 ** 53 - 1)) throw new j(`Cannot safely convert ${e} to a number. Value exceeds Number.MAX_SAFE_INTEGER.`);
1883
1891
  return Number(e);
1884
1892
  }
1885
1893
  return e;
1886
1894
  }
1887
1895
  function J(e, t, n = null) {
1888
1896
  return t === void 0 && (t = e, e = null), {
1889
- start: hn(e),
1890
- stop: hn(t),
1891
- step: hn(n)
1897
+ start: Sn(e),
1898
+ stop: Sn(t),
1899
+ step: Sn(n)
1892
1900
  };
1893
1901
  }
1894
- function gn() {
1902
+ function Cn() {
1895
1903
  let e = [];
1896
1904
  return {
1897
1905
  add: (t) => e.push(t()),
@@ -1900,28 +1908,28 @@ function gn() {
1900
1908
  }
1901
1909
  //#endregion
1902
1910
  //#region node_modules/.pnpm/zarrita@0.7.5/node_modules/zarrita/dist/src/indexing/indexer.js
1903
- function _n(e, t) {
1904
- throw new A(`too many indicies for array; expected ${t.length}, got ${e.length}`);
1911
+ function wn(e, t) {
1912
+ throw new j(`too many indicies for array; expected ${t.length}, got ${e.length}`);
1905
1913
  }
1906
- function vn(e) {
1907
- throw new A(`index out of bounds for dimension with length ${e}`);
1914
+ function Tn(e) {
1915
+ throw new j(`index out of bounds for dimension with length ${e}`);
1908
1916
  }
1909
- function yn() {
1910
- throw new A("only slices with step >= 1 are supported");
1917
+ function En() {
1918
+ throw new j("only slices with step >= 1 are supported");
1911
1919
  }
1912
- function bn(e, t) {
1913
- e.length > t.length && _n(e, t);
1920
+ function Dn(e, t) {
1921
+ e.length > t.length && wn(e, t);
1914
1922
  }
1915
- function xn(e, t) {
1916
- return e = Math.trunc(e), e < 0 && (e = t + e), (e >= t || e < 0) && vn(t), e;
1923
+ function On(e, t) {
1924
+ return e = Math.trunc(e), e < 0 && (e = t + e), (e >= t || e < 0) && Tn(t), e;
1917
1925
  }
1918
- var Sn = class {
1926
+ var kn = class {
1919
1927
  dimSel;
1920
1928
  dimLen;
1921
1929
  dimChunkLen;
1922
1930
  nitems;
1923
1931
  constructor({ dimSel: e, dimLen: t, dimChunkLen: n }) {
1924
- e = xn(e, t), this.dimSel = e, this.dimLen = t, this.dimChunkLen = n, this.nitems = 1;
1932
+ e = On(e, t), this.dimSel = e, this.dimLen = t, this.dimChunkLen = n, this.nitems = 1;
1925
1933
  }
1926
1934
  *[Symbol.iterator]() {
1927
1935
  let e = Math.floor(this.dimSel / this.dimChunkLen), t = e * this.dimChunkLen;
@@ -1930,7 +1938,7 @@ var Sn = class {
1930
1938
  dimChunkSel: this.dimSel - t
1931
1939
  };
1932
1940
  }
1933
- }, Cn = class {
1941
+ }, An = class {
1934
1942
  start;
1935
1943
  stop;
1936
1944
  step;
@@ -1939,12 +1947,12 @@ var Sn = class {
1939
1947
  nitems;
1940
1948
  nchunks;
1941
1949
  constructor({ dimSel: e, dimLen: t, dimChunkLen: n }) {
1942
- let [r, i, a] = mn(e, t);
1943
- this.start = r, this.stop = i, this.step = a, this.step < 1 && yn(), this.dimLen = t, this.dimChunkLen = n, this.nitems = Math.max(0, Math.ceil((this.stop - this.start) / this.step)), this.nchunks = Math.ceil(this.dimLen / this.dimChunkLen);
1950
+ let [r, i, a] = xn(e, t);
1951
+ this.start = r, this.stop = i, this.step = a, this.step < 1 && En(), this.dimLen = t, this.dimChunkLen = n, this.nitems = Math.max(0, Math.ceil((this.stop - this.start) / this.step)), this.nchunks = Math.ceil(this.dimLen / this.dimChunkLen);
1944
1952
  }
1945
1953
  *[Symbol.iterator]() {
1946
1954
  let e = Math.floor(this.start / this.dimChunkLen), t = Math.ceil(this.stop / this.dimChunkLen);
1947
- for (let n of fn(e, t)) {
1955
+ for (let n of yn(e, t)) {
1948
1956
  let e = n * this.dimChunkLen, t = Math.min(this.dimLen, (n + 1) * this.dimChunkLen), r = t - e, i = 0, a = 0;
1949
1957
  if (this.start < e) {
1950
1958
  let t = (e - this.start) % this.step;
@@ -1967,26 +1975,26 @@ var Sn = class {
1967
1975
  }
1968
1976
  }
1969
1977
  };
1970
- function wn(e, t) {
1978
+ function jn(e, t) {
1971
1979
  let n = [];
1972
- return e === null ? n = t.map((e) => J(null)) : Array.isArray(e) && (n = e.map((e) => e ?? J(null))), bn(n, t), n;
1980
+ return e === null ? n = t.map((e) => J(null)) : Array.isArray(e) && (n = e.map((e) => e ?? J(null))), Dn(n, t), n;
1973
1981
  }
1974
- var Tn = class {
1982
+ var Mn = class {
1975
1983
  dimIndexers;
1976
1984
  shape;
1977
1985
  outputAxes;
1978
1986
  constructor({ selection: e, shape: t, chunkShape: n }) {
1979
- this.dimIndexers = wn(e, t).map((e, r) => new (typeof e == "number" ? Sn : Cn)({
1987
+ this.dimIndexers = jn(e, t).map((e, r) => new (typeof e == "number" ? kn : An)({
1980
1988
  dimSel: e,
1981
1989
  dimLen: t[r],
1982
1990
  dimChunkLen: n[r]
1983
- })), this.shape = this.dimIndexers.filter((e) => e instanceof Cn).map((e) => e.nitems), this.outputAxes = this.dimIndexers.map((e, t) => ({
1991
+ })), this.shape = this.dimIndexers.filter((e) => e instanceof An).map((e) => e.nitems), this.outputAxes = this.dimIndexers.map((e, t) => ({
1984
1992
  ixr: e,
1985
1993
  axis: t
1986
- })).filter(({ ixr: e }) => e instanceof Cn).map(({ axis: e }) => e);
1994
+ })).filter(({ ixr: e }) => e instanceof An).map(({ axis: e }) => e);
1987
1995
  }
1988
1996
  *[Symbol.iterator]() {
1989
- for (let e of pn(...this.dimIndexers)) yield {
1997
+ for (let e of bn(...this.dimIndexers)) yield {
1990
1998
  chunkCoords: e.map((e) => e.dimChunkIx),
1991
1999
  mapping: e.map((e) => "dimOutSel" in e ? {
1992
2000
  from: e.dimChunkSel,
@@ -2000,45 +2008,45 @@ var Tn = class {
2000
2008
  };
2001
2009
  //#endregion
2002
2010
  //#region node_modules/.pnpm/zarrita@0.7.5/node_modules/zarrita/dist/src/indexing/get.js
2003
- function En(e, t) {
2011
+ function Nn(e, t) {
2004
2012
  return "get" in e ? e.get(t) : e[t];
2005
2013
  }
2006
- async function Dn(e, t, n, r) {
2007
- n.useSharedArrayBuffer && He();
2008
- let i = $e(n), a = $t(e), o = new Tn({
2014
+ async function Pn(e, t, n, r) {
2015
+ n.useSharedArrayBuffer && qe();
2016
+ let i = it(n), a = sn(e), o = new Mn({
2009
2017
  selection: t,
2010
2018
  shape: e.shape,
2011
2019
  chunkShape: e.chunks
2012
2020
  });
2013
2021
  if (e.shape.length === 0) {
2014
2022
  let { data: t } = await e.getChunk([], { signal: i }, { useSharedArrayBuffer: n.useSharedArrayBuffer });
2015
- return En(t, 0);
2023
+ return Nn(t, 0);
2016
2024
  }
2017
2025
  let s = o.shape.reduce((e, t) => e * t, 1), c;
2018
2026
  if (n.useSharedArrayBuffer) {
2019
2027
  let e = new a.TypedArray(0);
2020
2028
  if (!("BYTES_PER_ELEMENT" in e)) console.warn("zarrita: useSharedArrayBuffer is not supported for non-buffer-backed data types."), c = new a.TypedArray(s);
2021
2029
  else {
2022
- let t = Ue(s * e.BYTES_PER_ELEMENT, !0);
2030
+ let t = Je(s * e.BYTES_PER_ELEMENT, !0);
2023
2031
  c = new a.TypedArray(t, 0, s);
2024
2032
  }
2025
2033
  } else c = new a.TypedArray(s);
2026
- let l = r.prepare(c, o.shape, a.getStrides(o.shape, o.outputAxes)), u = n.createQueue?.() ?? gn();
2034
+ let l = r.prepare(c, o.shape, a.getStrides(o.shape, o.outputAxes)), u = n.createQueue?.() ?? Cn();
2027
2035
  for (let { chunkCoords: t, mapping: a } of o) u.add(async () => {
2028
2036
  i?.throwIfAborted();
2029
2037
  let { data: o, shape: s, stride: c } = await e.getChunk(t, { signal: i }, { useSharedArrayBuffer: n.useSharedArrayBuffer }), u = r.prepare(o, s, c);
2030
2038
  r.setFromChunk(l, u, a);
2031
2039
  });
2032
- return await u.onIdle(), o.shape.length === 0 ? En(l.data, 0) : l;
2040
+ return await u.onIdle(), o.shape.length === 0 ? Nn(l.data, 0) : l;
2033
2041
  }
2034
2042
  //#endregion
2035
2043
  //#region node_modules/.pnpm/zarrita@0.7.5/node_modules/zarrita/dist/src/indexing/ops.js
2036
- function On(e, t = 0, n) {
2044
+ function Fn(e, t = 0, n) {
2037
2045
  let r = n ?? e.length - t;
2038
2046
  return {
2039
2047
  length: r,
2040
2048
  subarray(n, i = r) {
2041
- return On(e, t + n, i - n);
2049
+ return Fn(e, t + n, i - n);
2042
2050
  },
2043
2051
  set(n, r = 0) {
2044
2052
  for (let i = 0; i < n.length; i++) e[t + r + i] = n.get(i);
@@ -2048,9 +2056,9 @@ function On(e, t = 0, n) {
2048
2056
  }
2049
2057
  };
2050
2058
  }
2051
- function kn(e) {
2059
+ function Y(e) {
2052
2060
  return globalThis.Array.isArray(e.data) ? {
2053
- data: On(e.data),
2061
+ data: Fn(e.data),
2054
2062
  stride: e.stride,
2055
2063
  bytesPerElement: 1
2056
2064
  } : {
@@ -2059,15 +2067,15 @@ function kn(e) {
2059
2067
  bytesPerElement: e.data.BYTES_PER_ELEMENT
2060
2068
  };
2061
2069
  }
2062
- function An(e) {
2070
+ function In(e) {
2063
2071
  return "chars" in e ? e.constructor.bind(null, e.chars) : e.constructor;
2064
2072
  }
2065
- function jn(e, t) {
2066
- if (globalThis.Array.isArray(e.data)) return On([t]);
2067
- let n = new (An(e.data))([t]);
2073
+ function Ln(e, t) {
2074
+ if (globalThis.Array.isArray(e.data)) return Fn([t]);
2075
+ let n = new (In(e.data))([t]);
2068
2076
  return new Uint8Array(n.buffer, n.byteOffset, n.byteLength);
2069
2077
  }
2070
- var Mn = {
2078
+ var Rn = {
2071
2079
  prepare(e, t, n) {
2072
2080
  return {
2073
2081
  data: e,
@@ -2076,44 +2084,44 @@ var Mn = {
2076
2084
  };
2077
2085
  },
2078
2086
  setScalar(e, t, n) {
2079
- let r = kn(e);
2080
- Pn(r, t, jn(e, n), r.bytesPerElement);
2087
+ let r = Y(e);
2088
+ Vn(r, t, Ln(e, n), r.bytesPerElement);
2081
2089
  },
2082
2090
  setFromChunk(e, t, n) {
2083
- let r = kn(e);
2084
- X(r, kn(t), r.bytesPerElement, n);
2091
+ let r = Y(e);
2092
+ X(r, Y(t), r.bytesPerElement, n);
2085
2093
  }
2086
2094
  };
2087
- async function Nn(e, t = null, n = {}) {
2088
- return Dn(e, t, n, Mn);
2095
+ async function zn(e, t = null, n = {}) {
2096
+ return Pn(e, t, n, Rn);
2089
2097
  }
2090
- function Y(e, t, n) {
2098
+ function Bn(e, t, n) {
2091
2099
  return n < 0 && t < e ? Math.floor((e - t - 1) / -n) + 1 : e < t ? Math.floor((t - e - 1) / n) + 1 : 0;
2092
2100
  }
2093
- function Pn(e, t, n, r) {
2101
+ function Vn(e, t, n, r) {
2094
2102
  if (t.length === 0) {
2095
2103
  e.data.set(n, 0);
2096
2104
  return;
2097
2105
  }
2098
2106
  let [i, ...a] = t, [o, ...s] = e.stride;
2099
2107
  if (typeof i == "number") {
2100
- Pn({
2108
+ Vn({
2101
2109
  data: e.data.subarray(o * i * r),
2102
2110
  stride: s
2103
2111
  }, a, n, r);
2104
2112
  return;
2105
2113
  }
2106
- let [c, l, u] = i, d = Y(c, l, u);
2114
+ let [c, l, u] = i, d = Bn(c, l, u);
2107
2115
  if (a.length === 0) {
2108
2116
  for (let t = 0; t < d; t++) e.data.set(n, o * (c + u * t) * r);
2109
2117
  return;
2110
2118
  }
2111
- for (let t = 0; t < d; t++) Pn({
2119
+ for (let t = 0; t < d; t++) Vn({
2112
2120
  data: e.data.subarray(o * (c + u * t) * r),
2113
2121
  stride: s
2114
2122
  }, a, n, r);
2115
2123
  }
2116
- function Fn(e, t, n) {
2124
+ function Hn(e, t, n) {
2117
2125
  if (e.length !== t.length || e.length !== n.length) return null;
2118
2126
  let r = 1, i = 0, a = 0;
2119
2127
  for (let o = e.length - 1; o >= 0; o--) {
@@ -2121,7 +2129,7 @@ function Fn(e, t, n) {
2121
2129
  if (s.from === null || s.to === null || t[o] !== r || n[o] !== r) return null;
2122
2130
  let [c, l, u] = s.to, [d, , f] = s.from;
2123
2131
  if (u !== 1 || f !== 1) return null;
2124
- i += r * c, a += r * d, r *= Y(c, l, u);
2132
+ i += r * c, a += r * d, r *= Bn(c, l, u);
2125
2133
  }
2126
2134
  return {
2127
2135
  size: r,
@@ -2130,7 +2138,7 @@ function Fn(e, t, n) {
2130
2138
  };
2131
2139
  }
2132
2140
  function X(e, t, n, r) {
2133
- let i = Fn(r, e.stride, t.stride);
2141
+ let i = Hn(r, e.stride, t.stride);
2134
2142
  if (i !== null) {
2135
2143
  let r = i.srcOffset * n;
2136
2144
  e.data.set(t.data.subarray(r, r + i.size * n), i.destOffset * n);
@@ -2160,7 +2168,7 @@ function X(e, t, n, r) {
2160
2168
  }, n, o);
2161
2169
  return;
2162
2170
  }
2163
- let [d, f, p] = a.to, [m, h, g] = a.from, _ = Y(d, f, p);
2171
+ let [d, f, p] = a.to, [m, h, g] = a.from, _ = Bn(d, f, p);
2164
2172
  if (o.length === 0) {
2165
2173
  for (let r = 0; r < _; r++) {
2166
2174
  let i = l * (m + g * r) * n;
@@ -2178,13 +2186,13 @@ function X(e, t, n, r) {
2178
2186
  }
2179
2187
  //#endregion
2180
2188
  //#region node_modules/.pnpm/ome-zarr.js@0.0.20/node_modules/ome-zarr.js/dist/ome-zarr.js
2181
- var In = Object.defineProperty, Ln = (e, t, n) => t in e ? In(e, t, {
2189
+ var Un = Object.defineProperty, Wn = (e, t, n) => t in e ? Un(e, t, {
2182
2190
  enumerable: !0,
2183
2191
  configurable: !0,
2184
2192
  writable: !0,
2185
2193
  value: n
2186
- }) : e[t] = n, Z = (e, t, n) => Ln(e, typeof t == "symbol" ? t : t + "", n);
2187
- function Rn(e, t, n) {
2194
+ }) : e[t] = n, Z = (e, t, n) => Wn(e, typeof t == "symbol" ? t : t + "", n);
2195
+ function Gn(e, t, n) {
2188
2196
  let { dst: r, blending: i = "additive" } = n ?? {}, [a, o] = e.shape, s = r ?? new Uint8ClampedArray(4 * a * o).fill(0), c = a * o * 4, l = 0;
2189
2197
  for (let n = 0; n < c; n += 4) {
2190
2198
  let r = Number(e.data[l]);
@@ -2196,7 +2204,7 @@ function Rn(e, t, n) {
2196
2204
  }
2197
2205
  return s;
2198
2206
  }
2199
- function zn(e, t, n) {
2207
+ function Kn(e, t, n) {
2200
2208
  let r = t.length, { dst: i, blending: a = "additive" } = n ?? {}, o;
2201
2209
  if (n != null && n.range) {
2202
2210
  let e = n.range;
@@ -2207,12 +2215,12 @@ function zn(e, t, n) {
2207
2215
  } else o = function(e) {
2208
2216
  return e <= 0 ? t[0] : t[(e - 1) % (r - 1) + 1];
2209
2217
  };
2210
- return Rn(e, o, {
2218
+ return Gn(e, o, {
2211
2219
  dst: i,
2212
2220
  blending: a
2213
2221
  });
2214
2222
  }
2215
- function Bn(e, t, n) {
2223
+ function qn(e, t, n) {
2216
2224
  let { dst: r, blending: i = "additive", fillValue: a = [
2217
2225
  0,
2218
2226
  0,
@@ -2222,12 +2230,12 @@ function Bn(e, t, n) {
2222
2230
  function o(e) {
2223
2231
  return t.get(e) ?? a;
2224
2232
  }
2225
- return Rn(e, o, {
2233
+ return Gn(e, o, {
2226
2234
  dst: r,
2227
2235
  blending: i
2228
2236
  });
2229
2237
  }
2230
- async function Vn(e, t, n, r, i, a) {
2238
+ async function Jn(e, t, n, r, i, a) {
2231
2239
  let { signal: o, calcMinMaxForRange: s } = a ?? {};
2232
2240
  o?.throwIfAborted();
2233
2241
  let c = e.shape, l = t?.map((e) => e.name || e.toString()) || [
@@ -2239,21 +2247,21 @@ async function Vn(e, t, n, r, i, a) {
2239
2247
  ], u = c[l.indexOf("c")] || 1, d, f, p = [], m;
2240
2248
  if (n) {
2241
2249
  let e = 0;
2242
- d = n.map((t) => (t.active ??= !0, e += +!!t.active, t.active && e <= Q)), f = n.map((e) => Zn(e.color)), p = n.map((e) => "lut" in e && e.lut ? e.lut : "colorMap" in e ? e.colorMap : void 0);
2243
- } else d = Qn(u), f = tr(u, d);
2250
+ d = n.map((t) => (t.active ??= !0, e += +!!t.active, t.active && e <= Q)), f = n.map((e) => ir(e.color)), p = n.map((e) => "lut" in e && e.lut ? e.lut : "colorMap" in e ? e.colorMap : void 0);
2251
+ } else d = ar(u), f = cr(u, d);
2244
2252
  let h = d.reduce((e, t, n) => (t && e.push(n), e), []);
2245
2253
  f = h.map((e) => f[e]), m = h.map((e) => {
2246
2254
  var t;
2247
2255
  return !!((t = n?.[e]) != null && t.inverted);
2248
2256
  }), p !== void 0 && (p = p.filter((e, t) => h.includes(t)));
2249
- let g = lr(h, c, l, r).map((t) => Nn(e, t, { opts: { signal: o } })), _ = await Promise.all(g);
2257
+ let g = gr(h, c, l, r).map((t) => zn(e, t, { opts: { signal: o } })), _ = await Promise.all(g);
2250
2258
  o?.throwIfAborted();
2251
- let ee = Hn(_, h.map((e, t) => {
2259
+ let ee = Yn(_, h.map((e, t) => {
2252
2260
  if (n && n[e]) {
2253
2261
  let t = n[e];
2254
2262
  if (t?.window?.start !== void 0 && t?.window?.end !== void 0) return [t.window.start, t.window.end];
2255
2263
  }
2256
- if (s) return nr(_[t]);
2264
+ if (s) return lr(_[t]);
2257
2265
  }), f, p, m, i), v = _[0].shape[0];
2258
2266
  return {
2259
2267
  data: ee,
@@ -2261,7 +2269,7 @@ async function Vn(e, t, n, r, i, a) {
2261
2269
  height: v
2262
2270
  };
2263
2271
  }
2264
- function Hn(e, t, n, r, i, a = !1) {
2272
+ function Yn(e, t, n, r, i, a = !1) {
2265
2273
  let o = n.map((e, t) => {
2266
2274
  let n = r != null && r.length ? r[t] : void 0;
2267
2275
  return n ||= Array.from({ length: 256 }, (t, n) => [
@@ -2272,30 +2280,30 @@ function Hn(e, t, n, r, i, a = !1) {
2272
2280
  ]), i && i[t] && Array.isArray(n) && (n = n.reverse()), n;
2273
2281
  }), s = performance.now(), c;
2274
2282
  if (o[0] instanceof Map) {
2275
- let t = o[0], n = t.get(Xn);
2276
- c = Bn(e[0], t, { fillValue: n });
2277
- } else c = zn(e[0], o[0], { range: t[0] });
2283
+ let t = o[0], n = t.get(rr);
2284
+ c = qn(e[0], t, { fillValue: n });
2285
+ } else c = Kn(e[0], o[0], { range: t[0] });
2278
2286
  for (let n = 1; n < e.length; n++) if (o[n] instanceof Map) {
2279
2287
  let t = o[n], r = t.get(Infinity);
2280
- c = Bn(e[n], t, {
2288
+ c = qn(e[n], t, {
2281
2289
  blending: "additive",
2282
2290
  dst: c,
2283
2291
  fillValue: r
2284
2292
  });
2285
- } else c = zn(e[n], o[n], {
2293
+ } else c = Kn(e[n], o[n], {
2286
2294
  blending: "additive",
2287
2295
  dst: c,
2288
2296
  range: t[n]
2289
2297
  });
2290
- return performance.now() - s < 100 && a && ar(c, 5)[4] < 1 && (c = ir(c, 2)), c;
2298
+ return performance.now() - s < 100 && a && fr(c, 5)[4] < 1 && (c = dr(c, 2)), c;
2291
2299
  }
2292
- function Un(e, t) {
2300
+ function Xn(e, t) {
2293
2301
  return e + (e.endsWith("/") ? "" : "/") + "|zarr" + t + ":";
2294
2302
  }
2295
- function Wn(e) {
2303
+ function Zn(e) {
2296
2304
  return e.split("/").filter(Boolean).pop() || "Default";
2297
2305
  }
2298
- function Gn(e, t, n, r, i) {
2306
+ function Qn(e, t, n, r, i) {
2299
2307
  let a = {};
2300
2308
  r.forEach((e, t) => {
2301
2309
  a[e.name] = {
@@ -2307,15 +2315,15 @@ function Gn(e, t, n, r, i) {
2307
2315
  "z" in a ? i[a.z.index] === 1 && (o = "xy") : o = "xy";
2308
2316
  let s = n === "segmentation" && (!a.c || i[a.c?.index] === 1) ? "segmentation" : "auto", c = {
2309
2317
  layers: [{
2310
- name: Wn(e),
2311
- source: Un(e, t),
2318
+ name: Zn(e),
2319
+ source: Xn(e, t),
2312
2320
  type: s
2313
2321
  }],
2314
2322
  layout: o
2315
2323
  }, l = JSON.stringify(c);
2316
2324
  return encodeURIComponent(l);
2317
2325
  }
2318
- var Kn = class {
2326
+ var $n = class {
2319
2327
  constructor(e, t) {
2320
2328
  Z(this, "attrs"), Z(this, "imgAttrs"), Z(this, "store"), Z(this, "multiscales"), Z(this, "paths"), Z(this, "scales"), Z(this, "shapes"), Z(this, "arrays", {}), Z(this, "omero"), Z(this, "axes"), Z(this, "zarr_version"), Z(this, "omezarr_version");
2321
2329
  var n;
@@ -2329,12 +2337,12 @@ var Kn = class {
2329
2337
  }
2330
2338
  static async load(e, t = {}) {
2331
2339
  let { signal: n } = t ?? {};
2332
- n?.throwIfAborted(), typeof e == "string" && (e = new u(e));
2340
+ n?.throwIfAborted(), typeof e == "string" && (e = new Ve(e));
2333
2341
  let r;
2334
2342
  if (t.attrs) r = t.attrs;
2335
2343
  else {
2336
2344
  let t;
2337
- e instanceof U ? t = e : (t = await cr(e, void 0, void 0, { signal: n }), n?.throwIfAborted()), r = t.attrs;
2345
+ e instanceof U ? t = e : (t = await hr(e, void 0, void 0, { signal: n }), n?.throwIfAborted()), r = t.attrs;
2338
2346
  }
2339
2347
  let i = new this(r, e), a = t.datasetIndex ?? 0;
2340
2348
  return await i.openArray(a), i;
@@ -2396,7 +2404,7 @@ var Kn = class {
2396
2404
  var e;
2397
2405
  let t = [];
2398
2406
  try {
2399
- let n = await cr(this.store, "labels", this.zarr_version);
2407
+ let n = await hr(this.store, "labels", this.zarr_version);
2400
2408
  n && (e = n.attrs) != null && e.labels && (t = n.attrs.labels);
2401
2409
  } catch (e) {
2402
2410
  console.info("Failed to load labels group:", e);
@@ -2407,15 +2415,15 @@ var Kn = class {
2407
2415
  let e = this.store.url || "";
2408
2416
  if (!e) throw Error("Cannot generate Neuroglancer URL: store does not have a URL");
2409
2417
  let t = this.getZarrVersion(), n = this.imgAttrs["image-label"] ? "segmentation" : "auto", r = await this.getShape();
2410
- return "https://neuroglancer-demo.appspot.com/#!" + Gn(e.toString(), t, n, this.axes, r);
2418
+ return "https://neuroglancer-demo.appspot.com/#!" + Qn(e.toString(), t, n, this.axes, r);
2411
2419
  }
2412
2420
  async openArray(e, t) {
2413
2421
  let n;
2414
2422
  if (typeof e == "number" ? (e < 0 && (e = this.paths.length + e), n = this.paths[e]) : n = e, this.arrays[n]) return this.arrays[n];
2415
- let r = await sr(this.store, n, this.zarr_version, t);
2423
+ let r = await mr(this.store, n, this.zarr_version, t);
2416
2424
  if (this.arrays[n] = r, !this.omero) {
2417
2425
  let e = (await this.calcShapes())?.[0] || r.shape, t = this.axes.map((e) => e.name || e.toString()), n = e[t.findIndex((e) => e === "c")] || 1, i = e[t.findIndex((e) => e === "z")] || 1, a = e[t.findIndex((e) => e === "t")] || 1;
2418
- if (this.omero = $n({
2426
+ if (this.omero = or({
2419
2427
  sizeC: n,
2420
2428
  sizeZ: i,
2421
2429
  sizeT: a
@@ -2486,7 +2494,7 @@ var Kn = class {
2486
2494
  }
2487
2495
  async renderArray(e = {}) {
2488
2496
  let t;
2489
- if (e.arr) t = typeof e.arr == "string" ? await q(new u(e.arr), { kind: "array" }) : e.arr;
2497
+ if (e.arr) t = typeof e.arr == "string" ? await q(new Ve(e.arr), { kind: "array" }) : e.arr;
2490
2498
  else {
2491
2499
  let n;
2492
2500
  if (e.arrayPathOrIndex !== void 0) n = e.arrayPathOrIndex;
@@ -2504,21 +2512,21 @@ var Kn = class {
2504
2512
  e && e[c] != r[c] && (s.z = Math.floor(s.z * r[c] / e[c]));
2505
2513
  }
2506
2514
  s.t ??= this.omero?.rdefs?.defaultT;
2507
- let l = e.channels || this.omero?.channels, d = this.calcMinMaxForRange ?? !0;
2508
- e?.calcMinMaxForRange != null && (d = e.calcMinMaxForRange);
2509
- let { data: f, width: p, height: m } = await Vn(t, this.axes, l, s, !!e.autoBoost, {
2515
+ let l = e.channels || this.omero?.channels, u = this.calcMinMaxForRange ?? !0;
2516
+ e?.calcMinMaxForRange != null && (u = e.calcMinMaxForRange);
2517
+ let { data: d, width: f, height: p } = await Jn(t, this.axes, l, s, !!e.autoBoost, {
2510
2518
  signal: e.signal,
2511
- calcMinMaxForRange: !!d
2519
+ calcMinMaxForRange: !!u
2512
2520
  });
2513
2521
  return {
2514
- data: f,
2515
- width: p,
2516
- height: m
2522
+ data: d,
2523
+ width: f,
2524
+ height: p
2517
2525
  };
2518
2526
  }
2519
2527
  async render(e = {}) {
2520
2528
  let { data: t, width: n } = await this.renderArray(e);
2521
- return ur(t, n);
2529
+ return _r(t, n);
2522
2530
  }
2523
2531
  }, Q = 3, $ = {
2524
2532
  cyan: "#00FFFF",
@@ -2528,24 +2536,24 @@ var Kn = class {
2528
2536
  green: "#00FF00",
2529
2537
  blue: "#0000FF",
2530
2538
  white: "#FFFFFF"
2531
- }, qn = [$.magenta, $.green], Jn = [
2539
+ }, er = [$.magenta, $.green], tr = [
2532
2540
  $.red,
2533
2541
  $.green,
2534
2542
  $.blue
2535
- ], Yn = Object.values($), Xn = Infinity;
2536
- function Zn(e) {
2543
+ ], nr = Object.values($), rr = Infinity;
2544
+ function ir(e) {
2537
2545
  return e.startsWith("#") && (e = e.slice(1)), [
2538
2546
  parseInt(e.slice(0, 2), 16),
2539
2547
  parseInt(e.slice(2, 4), 16),
2540
2548
  parseInt(e.slice(4, 6), 16)
2541
2549
  ];
2542
2550
  }
2543
- function Qn(e) {
2551
+ function ar(e) {
2544
2552
  let t;
2545
2553
  return t = e <= Q ? Array(e).fill(!0) : [...Array(Q).fill(!0), ...Array(e - Q).fill(!1)], t;
2546
2554
  }
2547
- function $n({ sizeC: e, sizeZ: t, sizeT: n }, r) {
2548
- let i = Qn(e), a = er(e, i), o = rr(r);
2555
+ function or({ sizeC: e, sizeZ: t, sizeT: n }, r) {
2556
+ let i = ar(e), a = sr(e, i), o = ur(r);
2549
2557
  return {
2550
2558
  channels: i.map((e, t) => ({
2551
2559
  active: e,
@@ -2562,23 +2570,23 @@ function $n({ sizeC: e, sizeZ: t, sizeT: n }, r) {
2562
2570
  }
2563
2571
  };
2564
2572
  }
2565
- function er(e, t) {
2573
+ function sr(e, t) {
2566
2574
  let n = [];
2567
2575
  if (e == 1) n = [$.white];
2568
- else if (e == 2) n = qn;
2569
- else if (e === 3) n = Jn;
2570
- else if (e <= Q) n = Yn.slice(0, e);
2576
+ else if (e == 2) n = er;
2577
+ else if (e === 3) n = tr;
2578
+ else if (e <= Q) n = nr.slice(0, e);
2571
2579
  else {
2572
2580
  n = Array(e).fill($.white);
2573
2581
  let r = t.flatMap((e, t) => e ? t : []);
2574
- for (let [e, t] of r.entries()) n[t] = Yn[e];
2582
+ for (let [e, t] of r.entries()) n[t] = nr[e];
2575
2583
  }
2576
2584
  return n = n.map((e) => (e.startsWith("#") && (e = e.slice(1)), e)), n;
2577
2585
  }
2578
- function tr(e, t) {
2579
- return er(e, t).map(Zn);
2586
+ function cr(e, t) {
2587
+ return sr(e, t).map(ir);
2580
2588
  }
2581
- function nr(e) {
2589
+ function lr(e) {
2582
2590
  let t = e.data, n = 0, r = Infinity, i = e.data.length;
2583
2591
  for (let e = 0; e < i; e++) {
2584
2592
  let i = Number(t[e]);
@@ -2586,7 +2594,7 @@ function nr(e) {
2586
2594
  }
2587
2595
  return [r, n];
2588
2596
  }
2589
- function rr(e) {
2597
+ function ur(e) {
2590
2598
  let t = 0, n = 65535;
2591
2599
  if (e) if (e.includes("int") || e.includes("uint")) {
2592
2600
  let r = e.match(/\d+/);
@@ -2606,14 +2614,14 @@ function rr(e) {
2606
2614
  max: n
2607
2615
  };
2608
2616
  }
2609
- function ir(e, t) {
2617
+ function dr(e, t) {
2610
2618
  for (let n = 0; n < e.length / 4; n++) for (let r = 0; r < 3; r++) {
2611
2619
  let i = e[n * 4 + r];
2612
2620
  i = Math.min(255, i * t), e[n * 4 + r] = i;
2613
2621
  }
2614
2622
  return e;
2615
2623
  }
2616
- function ar(e, t = 5) {
2624
+ function fr(e, t = 5) {
2617
2625
  let n = Array(t).fill(0), r = 256 / t, i = e.length / 4;
2618
2626
  for (let t = 0; t < i; t++) {
2619
2627
  let i = e[t * 4];
@@ -2623,23 +2631,23 @@ function ar(e, t = 5) {
2623
2631
  }
2624
2632
  return n = n.map((e) => 100 * e / i), n;
2625
2633
  }
2626
- async function or(e, t, n, r, i) {
2634
+ async function pr(e, t, n, r, i) {
2627
2635
  let { signal: a } = i ?? {};
2628
2636
  a?.throwIfAborted();
2629
2637
  let o = r === 3 ? q.v3 : r === 2 ? q.v2 : q, s;
2630
- s = e instanceof U ? e : Yt(typeof e == "string" ? new u(e) : e), n && (s = s.resolve(n));
2638
+ s = e instanceof U ? e : nn(typeof e == "string" ? new Ve(e) : e), n && (s = s.resolve(n));
2631
2639
  let c = await o(s, { kind: t });
2632
2640
  return a?.throwIfAborted(), c;
2633
2641
  }
2634
- async function sr(e, t, n, r) {
2642
+ async function mr(e, t, n, r) {
2635
2643
  let { signal: i } = r ?? {};
2636
- return i?.throwIfAborted(), or(e, "array", t, n, { signal: i });
2644
+ return i?.throwIfAborted(), pr(e, "array", t, n, { signal: i });
2637
2645
  }
2638
- async function cr(e, t, n, r) {
2646
+ async function hr(e, t, n, r) {
2639
2647
  let { signal: i } = r ?? {};
2640
- return i?.throwIfAborted(), or(e, "group", t, n, { signal: i });
2648
+ return i?.throwIfAborted(), pr(e, "group", t, n, { signal: i });
2641
2649
  }
2642
- function lr(e, t, n, r) {
2650
+ function gr(e, t, n, r) {
2643
2651
  return e.map((e) => t.map((t, i) => {
2644
2652
  let a = n[i];
2645
2653
  if (a == "c") return e;
@@ -2651,7 +2659,7 @@ function lr(e, t, n, r) {
2651
2659
  return a == "x" || a == "y" ? J(0, t) : a == "z" || a == "t" ? parseInt(t / 2 + "") : 0;
2652
2660
  }));
2653
2661
  }
2654
- async function ur(e, t) {
2662
+ async function _r(e, t) {
2655
2663
  let n = e.length / (t * 4);
2656
2664
  if (typeof document < "u") {
2657
2665
  let r = document.createElement("canvas");
@@ -2659,7 +2667,7 @@ async function ur(e, t) {
2659
2667
  let i = r.getContext("2d");
2660
2668
  return i ? (i.putImageData(new ImageData(e, t, n), 0, 0), r.toDataURL("image/png")) : "";
2661
2669
  } else {
2662
- let { PNG: r } = await import("./png-K1gqQ34g-BW3a7qE6.js").then((e) => e.p), { Buffer: i } = await import("./__vite-browser-external-YbutIfMq-DmIpWUUk.js").then((e) => e._), a = new r({
2670
+ let { PNG: r } = await import("./png-K1gqQ34g-aB7GLn6k.js").then((e) => e.p), { Buffer: i } = await import("./__vite-browser-external-YbutIfMq-DmIpWUUk.js").then((e) => e._), a = new r({
2663
2671
  width: t,
2664
2672
  height: n
2665
2673
  });
@@ -2674,7 +2682,7 @@ async function ur(e, t) {
2674
2682
  }
2675
2683
  //#endregion
2676
2684
  //#region src/OMEZarrTileSource.ts
2677
- var dr = class e extends r.TileSource {
2685
+ var vr = class e extends t.TileSource {
2678
2686
  zip;
2679
2687
  c;
2680
2688
  z;
@@ -2685,11 +2693,28 @@ var dr = class e extends r.TileSource {
2685
2693
  height = 10;
2686
2694
  _image;
2687
2695
  _arrays;
2696
+ _readyPromise = new Promise((e, t) => {
2697
+ this.addOnceHandler("ready", () => e(this)), this.addOnceHandler("open-failed", (e) => t(Error(e.message)));
2698
+ });
2688
2699
  static {
2689
- e._learnConverters(r);
2700
+ e._learnConverters(t);
2690
2701
  }
2691
- constructor(e) {
2692
- typeof e == "string" ? (super(e), this.url = e, this.dataType = "context2d") : (super(e.url), this.url = e.url, this.zip = e.zip, this.c = e.c, this.z = e.z, this.t = e.t, this.dataType = e.dataType ?? "context2d", this.autoBoost = e.autoBoost);
2702
+ static open(t, n) {
2703
+ return new e(t, n).whenReady();
2704
+ }
2705
+ constructor(e, t) {
2706
+ typeof e == "string" ? (super(e), this.url = e, this.dataType = "context2d") : (super(e.url), this.url = e.url, this.zip = e.zip, this.c = e.c, this.z = e.z, this.t = e.t, this.dataType = e.dataType ?? "context2d", this.autoBoost = e.autoBoost), this._image = t, this._readyPromise.catch(() => {});
2707
+ }
2708
+ get image() {
2709
+ if (this._image === void 0) throw Error("tile source not ready");
2710
+ return this._image;
2711
+ }
2712
+ get arrays() {
2713
+ if (this._arrays === void 0) throw Error("tile source not ready");
2714
+ return this._arrays;
2715
+ }
2716
+ whenReady() {
2717
+ return this._readyPromise;
2693
2718
  }
2694
2719
  supports(e) {
2695
2720
  return Array.isArray(e) || e instanceof Document ? !1 : typeof e == "string" ? e.endsWith(".ozx") : "type" in e && e.type === "ome-zarr";
@@ -2710,7 +2735,7 @@ var dr = class e extends r.TileSource {
2710
2735
  return t instanceof e && this.url === t.url && this.zip === t.zip && this.c === t.c && this.z === t.z && this.t === t.t && this.dataType === t.dataType && this.autoBoost === t.autoBoost;
2711
2736
  }
2712
2737
  getImageInfo(e) {
2713
- Kn.load(this.zip || this.zip === void 0 && e.endsWith(".ozx") ? Fe.fromUrl(e) : e).then(async (e) => {
2738
+ Promise.resolve(this._image ?? $n.load(this.zip || this.zip === void 0 && e.endsWith(".ozx") ? Re.fromUrl(e) : e)).then(async (e) => {
2714
2739
  let t = e.getAxesNames();
2715
2740
  for (let e of t) if (![
2716
2741
  "t",
@@ -2721,11 +2746,16 @@ var dr = class e extends r.TileSource {
2721
2746
  ].includes(e)) throw Error(`unsupported axis: ${e}`);
2722
2747
  if (!t.includes("x") || !t.includes("y")) throw Error("missing X or Y axis");
2723
2748
  if (t.indexOf("y") > t.indexOf("x")) throw Error("X axis must come after Y axis");
2724
- let n = await Promise.all(e.paths.map((t) => e.openArray(t))), r = t.indexOf("c"), i = r >= 0 ? n[0].shape[r] : 1;
2725
- if (this.z !== void 0 && e.setZIndex(this.z), this.t !== void 0 && e.setTIndex(this.t), this.dataType !== "context2d" && this.c === void 0 && i > 1) throw Error(`Multi-channel image with ${i} channels; specify c or render as "context2d"`);
2726
- let a = e.checkChannelIndex(this.c ?? 0);
2727
- if (a.channels.length !== i) throw Error(`OME-Zarr metadata lists ${a.channels.length} channels, but the image has ${i}`);
2728
- if (this._getActiveChannelIndices(a).length === 0) throw Error("No active channels; specify c or activate channels in the OME-Zarr metadata");
2749
+ let n = await Promise.all(e.paths.map((t) => e.openArray(t))), r = t.indexOf("t"), i = r >= 0 ? n[0].shape[r] : 1;
2750
+ if (this.t !== void 0 && (this.t < 0 || this.t >= i)) throw Error(`Invalid t index ${this.t} for image with ${i} timepoints`);
2751
+ let a = t.indexOf("z"), o = a >= 0 ? n[0].shape[a] : 1;
2752
+ if (this.z !== void 0 && (this.z < 0 || this.z >= o)) throw Error(`Invalid z index ${this.z} for image with ${o} z-slices`);
2753
+ let s = t.indexOf("c"), c = s >= 0 ? n[0].shape[s] : 1;
2754
+ if (this.c !== void 0 && (this.c < 0 || this.c >= c)) throw Error(`Invalid c index ${this.c} for image with ${c} channels`);
2755
+ if (this.dataType !== "context2d" && this.c === void 0 && c > 1) throw Error(`Multi-channel image with ${c} channels; specify c or render as "context2d"`);
2756
+ let l = e.checkChannelIndex(this.c ?? 0);
2757
+ if (l.channels.length !== c) throw Error(`OME-Zarr metadata lists ${l.channels.length} channels, but the image has ${c}`);
2758
+ if (this._getActiveChannelIndices(l).length === 0) throw Error("No active channels; specify c or activate channels in the OME-Zarr metadata");
2729
2759
  this._image = e, this._arrays = n, this.width = n[0].shape[t.indexOf("x")], this.height = n[0].shape[t.indexOf("y")], this.maxLevel = n.length - 1, this.raiseEvent("ready", { tileSource: this });
2730
2760
  }).catch((t) => {
2731
2761
  this._image = void 0, this._arrays = void 0, this.width = 10, this.height = 10, this.maxLevel = 0, this.raiseEvent("open-failed", {
@@ -2763,13 +2793,13 @@ var dr = class e extends r.TileSource {
2763
2793
  let i = new URLSearchParams(t.src), a = +i.get("level"), o = +i.get("x"), s = +i.get("y");
2764
2794
  try {
2765
2795
  if (this._image === void 0 || this._arrays === void 0) throw Error("tile source not ready");
2766
- let n = this._arrays[this.maxLevel - a], i = this._image.checkChannelIndex(this.c ?? 0), c = this._getActiveChannelIndices(i), l = c.map((e) => i.channels[e]), u = this.getTileWidth(a), d = this.getTileHeight(a), f = lr(c, n.shape, this._image.getAxesNames(), {
2796
+ let n = this._arrays[this.maxLevel - a], i = this._image.checkChannelIndex(this.c ?? 0), c = this._getActiveChannelIndices(i), l = c.map((e) => i.channels[e]), u = this.getTileWidth(a), d = this.getTileHeight(a), f = gr(c, n.shape, this._image.getAxesNames(), {
2767
2797
  x: [o * u, (o + 1) * u],
2768
2798
  y: [s * d, (s + 1) * d],
2769
- z: i.rdefs.defaultZ,
2770
- t: i.rdefs.defaultT
2799
+ z: this.z ?? i.rdefs?.defaultZ,
2800
+ t: this.t ?? i.rdefs?.defaultT
2771
2801
  });
2772
- Promise.all(f.map((e) => Nn(n, e, { signal: r.signal }))).then((n) => {
2802
+ Promise.all(f.map((e) => zn(n, e, { signal: r.signal }))).then((n) => {
2773
2803
  if (this.dataType === "context2d") {
2774
2804
  let r = e._render(n, l, this.autoBoost);
2775
2805
  t.finish(r, null, "context2d");
@@ -2781,9 +2811,9 @@ var dr = class e extends r.TileSource {
2781
2811
  };
2782
2812
  t.finish(e, null, "ome-zarr");
2783
2813
  }
2784
- }, (e) => {
2814
+ }).catch((e) => {
2785
2815
  let n = r.signal.aborted;
2786
- r.abort(), n || t.fail(`failed to render tile for level=${a}, x=${o}, y=${s}: ${e}`, null);
2816
+ r.abort(), n || t.fail(`failed to render tile for level=${a}, x=${o}, y=${s}: ${String(e)}`, null);
2787
2817
  });
2788
2818
  } catch (e) {
2789
2819
  t.fail(`failed to download tile for level=${a}, x=${o}, y=${s}: ${String(e)}`, null);
@@ -2793,8 +2823,8 @@ var dr = class e extends r.TileSource {
2793
2823
  let t = e.userData;
2794
2824
  t.abortController !== void 0 && (t.abortController.abort(), t.abortController = void 0);
2795
2825
  }
2796
- static enable(t = r) {
2797
- Object.assign(t, { OMEZarrTileSource: e }), e._learnConverters(t);
2826
+ static enable(n = t) {
2827
+ Object.assign(n, { OMEZarrTileSource: e }), e._learnConverters(n);
2798
2828
  }
2799
2829
  static _learnConverters(t) {
2800
2830
  t.converter.existsType("ome-zarr") || (t.converter.learn("ome-zarr", "context2d", (t, { chunk: n, channel: r, autoBoost: i }) => e._render([n], [r], i), 1, 1), t.converter.learn("ome-zarr", "ome-zarr", (e, t) => ({
@@ -2808,27 +2838,31 @@ var dr = class e extends r.TileSource {
2808
2838
  _getActiveChannelIndices(e) {
2809
2839
  return this.c !== void 0 || this.dataType !== "context2d" ? [this.c ?? 0] : e.channels.flatMap((e, t) => e.active === !1 ? [] : [t]);
2810
2840
  }
2811
- static _render(e, t, n) {
2812
- let r = t.map((e) => {
2841
+ static _render(t, n, r) {
2842
+ let i = n.map((e) => {
2813
2843
  let t = e.color.replace(/^#/, "");
2814
2844
  return [
2815
2845
  parseInt(t.slice(0, 2), 16),
2816
2846
  parseInt(t.slice(2, 4), 16),
2817
2847
  parseInt(t.slice(4, 6), 16)
2818
2848
  ];
2819
- }), i = Hn(e, t.map((t, n) => {
2820
- let [r, i] = t.window.start !== void 0 && t.window.end !== void 0 ? [t.window.start, t.window.end] : nr(e[n]);
2821
- return r < i ? [r, i] : [r, r + 1];
2822
- }), r, t.map((e) => e.lut ?? e.colorMap), t.map((e) => e.inverted === !0), n), a = e[0].shape[1], o = e[0].shape[0], s = document.createElement("canvas");
2823
- s.width = a, s.height = o;
2824
- let c = s.getContext("2d");
2825
- if (c === null) throw Error("failed to get 2D canvas context");
2826
- let l = new ImageData(i, a, o);
2827
- return c.putImageData(l, 0, 0), c;
2849
+ }), a = Yn(t, n.map((n, r) => {
2850
+ let [i, a] = n.window.start !== void 0 && n.window.end !== void 0 ? [n.window.start, n.window.end] : e._getDataTypeRange(t[r]);
2851
+ return i < a ? [i, a] : [i, i + 1];
2852
+ }), i, n.map((e) => e.lut ?? e.colorMap), n.map((e) => e.inverted === !0), r), o = t[0].shape[1], s = t[0].shape[0], c = document.createElement("canvas");
2853
+ c.width = o, c.height = s;
2854
+ let l = c.getContext("2d");
2855
+ if (l === null) throw Error("failed to get 2D canvas context");
2856
+ let u = new ImageData(a, o, s);
2857
+ return l.putImageData(u, 0, 0), l;
2858
+ }
2859
+ static _getDataTypeRange(e) {
2860
+ let { data: t } = e;
2861
+ return t instanceof Int8Array ? [-128, 127] : t instanceof Uint8Array ? [0, 255] : t instanceof Int16Array ? [-32768, 32767] : t instanceof Uint16Array ? [0, 65535] : t instanceof Int32Array ? [-2147483648, 2147483647] : t instanceof Uint32Array ? [0, 4294967295] : t instanceof BigInt64Array ? [-(2 ** 63), 2 ** 63 - 1] : t instanceof BigUint64Array ? [0, 2 ** 64 - 1] : [0, 1];
2828
2862
  }
2829
2863
  };
2830
2864
  //#endregion
2831
2865
  //#region src/main.ts
2832
- globalThis.OpenSeadragon && dr.enable(globalThis.OpenSeadragon);
2866
+ globalThis.OpenSeadragon && vr.enable(globalThis.OpenSeadragon);
2833
2867
  //#endregion
2834
- export { dr as OMEZarrTileSource };
2868
+ export { vr as OMEZarrTileSource, c as t };