vitessce 2.0.3 → 3.0.1

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.
@@ -0,0 +1,22 @@
1
+ import { C as s, D as n, F as t, h as p, n as l, P as r, o as T, m as y, V as c, l as d, i as C, f as g, d as f, k as P, j as m, v as V, z as u } from "./index-6ca034d3.js";
2
+ import "react";
3
+ import "react-dom";
4
+ export {
5
+ s as CoordinationType,
6
+ n as DataType,
7
+ t as FileType,
8
+ p as OldCoordinationType,
9
+ l as PluginCoordinationType,
10
+ r as PluginFileType,
11
+ T as PluginJointFileType,
12
+ y as PluginViewType,
13
+ c as ViewType,
14
+ d as Vitessce,
15
+ C as VitessceConfig,
16
+ g as decodeURLParamsToConf,
17
+ f as encodeConfInUrl,
18
+ P as generateConfigs,
19
+ m as hconcat,
20
+ V as vconcat,
21
+ u as z
22
+ };
@@ -1,4 +1,4 @@
1
- import { B as re } from "./index.a9498574.mjs";
1
+ import { B as re } from "./index-6ca034d3.js";
2
2
  import "react";
3
3
  import "react-dom";
4
4
  const O = new Int32Array([
@@ -374,18 +374,19 @@ class le {
374
374
  const h = u() + o - 2;
375
375
  for (; o < h; ) {
376
376
  const F = l[o++], c = new Int32Array(64);
377
- if (F >> 4 === 0)
377
+ if (F >> 4)
378
+ if (F >> 4 === 1)
379
+ for (let r = 0; r < 64; r++) {
380
+ const b = O[r];
381
+ c[b] = u();
382
+ }
383
+ else
384
+ throw new Error("DQT: invalid table spec");
385
+ else
378
386
  for (let r = 0; r < 64; r++) {
379
387
  const b = O[r];
380
388
  c[b] = l[o++];
381
389
  }
382
- else if (F >> 4 === 1)
383
- for (let r = 0; r < 64; r++) {
384
- const b = O[r];
385
- c[b] = u();
386
- }
387
- else
388
- throw new Error("DQT: invalid table spec");
389
390
  this.quantizationTables[F & 15] = c;
390
391
  }
391
392
  break;
@@ -426,10 +427,10 @@ class le {
426
427
  const b = new Uint8Array(r);
427
428
  for (let i = 0; i < r; i++, o++)
428
429
  b[i] = l[o];
429
- h += 17 + r, F >> 4 === 0 ? this.huffmanTablesDC[F & 15] = ne(
430
+ h += 17 + r, F >> 4 ? this.huffmanTablesAC[F & 15] = ne(
430
431
  c,
431
432
  b
432
- ) : this.huffmanTablesAC[F & 15] = ne(
433
+ ) : this.huffmanTablesDC[F & 15] = ne(
433
434
  c,
434
435
  b
435
436
  );
@@ -446,8 +447,7 @@ class le {
446
447
  const m = F.components[l[o++]], x = l[o++];
447
448
  m.huffmanTableDC = this.huffmanTablesDC[x >> 4], m.huffmanTableAC = this.huffmanTablesAC[x & 15], h.push(m);
448
449
  }
449
- const c = l[o++], r = l[o++], b = l[o++];
450
- o += ce(
450
+ const c = l[o++], r = l[o++], b = l[o++], i = ce(
451
451
  l,
452
452
  o,
453
453
  F,
@@ -458,6 +458,7 @@ class le {
458
458
  b >> 4,
459
459
  b & 15
460
460
  );
461
+ o += i;
461
462
  break;
462
463
  }
463
464
  case 65535:
@@ -1,5 +1,5 @@
1
- import { i as te } from "./pako.esm.4b234125.mjs";
2
- import { B as se, L as le, a as re } from "./index.a9498574.mjs";
1
+ import { i as te } from "./pako.esm-a0be47a3.js";
2
+ import { g as se, B as le, L as oe, a as re } from "./index-6ca034d3.js";
3
3
  import "react";
4
4
  import "react-dom";
5
5
  var ie = { exports: {} };
@@ -124,7 +124,7 @@ var ie = { exports: {} };
124
124
  throw "Unexpected end of mask RLE encoding";
125
125
  i.mask.bitset = f, o += i.mask.numBytes;
126
126
  } else
127
- (i.mask.numBytes | i.mask.numBlocksY | i.mask.maxValue) === 0 && (i.mask.bitset = new Uint8Array(Math.ceil(i.width * i.height / 8)));
127
+ i.mask.numBytes | i.mask.numBlocksY | i.mask.maxValue || (i.mask.bitset = new Uint8Array(Math.ceil(i.width * i.height / 8)));
128
128
  n = new DataView(r, o, 16), i.pixels = {}, i.pixels.numBlocksY = n.getUint32(0, !0), i.pixels.numBlocksX = n.getUint32(4, !0), i.pixels.numBytes = n.getUint32(8, !0), i.pixels.maxValue = n.getFloat32(12, !0), o += 16;
129
129
  var l = i.pixels.numBlocksX, s = i.pixels.numBlocksY, w = l + (i.width % l > 0 ? 1 : 0), k = s + (i.height % s > 0 ? 1 : 0);
130
130
  i.pixels.blocks = new Array(w * k);
@@ -192,6 +192,8 @@ var ie = { exports: {} };
192
192
  return F;
193
193
  }(), K = function() {
194
194
  var F = {
195
+ //methods ending with 2 are for the new byte order used by Lerc2.3 and above.
196
+ //originalUnstuff is used to unpack Huffman code table. code is duplicated to unstuffx for performance reasons.
195
197
  unstuff: function(t, e, r, o, a, i, h, n) {
196
198
  var f = (1 << r) - 1, v = 0, u, m = 0, g, l, s, w, k = t.length * 4 - Math.ceil(r * o / 8);
197
199
  if (t[t.length - 1] <<= 8 * k, a)
@@ -241,6 +243,7 @@ var ie = { exports: {} };
241
243
  }
242
244
  }, A = {
243
245
  HUFFMAN_LUT_BITS_MAX: 12,
246
+ //use 2^12 lut, treat it like constant
244
247
  computeChecksumFletcher32: function(t) {
245
248
  for (var e = 65535, r = 65535, o = t.length, a = Math.floor(o / 2), i = 0; a; ) {
246
249
  var h = a >= 359 ? 359 : a;
@@ -389,10 +392,10 @@ var ie = { exports: {} };
389
392
  readHuffman: function(t, e, r, o) {
390
393
  var a = e.headerInfo, i = a.numDims, h = e.headerInfo.height, n = e.headerInfo.width, f = n * h, v = this.readHuffmanTree(t, e), u = v.decodeLut, m = v.tree, g = v.stuffedData, l = v.srcPtr, s = v.bitPos, w = v.numBitsLUTQick, k = v.numBitsLUT, D = e.headerInfo.imageType === 0 ? 128 : 0, d, y, x, L = e.pixels.resultMask, p, c, U, I, M, T, V, S = 0;
391
394
  s > 0 && (l++, s = 0);
392
- var B = g[l], C = e.encodeMode === 1, _ = new r(f * i), O = _, b;
395
+ var B = g[l], C = e.encodeMode === 1, j = new r(f * i), O = j, b;
393
396
  if (i < 2 || C) {
394
397
  for (b = 0; b < i; b++)
395
- if (i > 1 && (O = new r(_.buffer, f * b, f), S = 0), e.headerInfo.numValidPixel === n * h)
398
+ if (i > 1 && (O = new r(j.buffer, f * b, f), S = 0), e.headerInfo.numValidPixel === n * h)
396
399
  for (T = 0, I = 0; I < h; I++)
397
400
  for (M = 0; M < n; M++, T++) {
398
401
  if (y = 0, p = B << s >>> 32 - w, c = p, 32 - s < w && (p |= g[l + 1] >>> 64 - s - w, c = p), u[c])
@@ -434,7 +437,7 @@ var ie = { exports: {} };
434
437
  }
435
438
  s >= 32 && (s -= 32, l++, B = g[l]), x = y - D, O[T] = x;
436
439
  }
437
- e.ptr = e.ptr + (l + 1) * 4 + (s > 0 ? 4 : 0), e.pixels.resultPixels = _, i > 1 && !o && (e.pixels.resultPixels = A.swapDimensionOrder(_, f, i, r));
440
+ e.ptr = e.ptr + (l + 1) * 4 + (s > 0 ? 4 : 0), e.pixels.resultPixels = j, i > 1 && !o && (e.pixels.resultPixels = A.swapDimensionOrder(j, f, i, r));
438
441
  },
439
442
  decodeBits: function(t, e, r, o, a) {
440
443
  {
@@ -461,20 +464,20 @@ var ie = { exports: {} };
461
464
  readTiles: function(t, e, r, o) {
462
465
  var a = e.headerInfo, i = a.width, h = a.height, n = i * h, f = a.microBlockSize, v = a.imageType, u = A.getDataTypeSize(v), m = Math.ceil(i / f), g = Math.ceil(h / f);
463
466
  e.pixels.numBlocksY = g, e.pixels.numBlocksX = m, e.pixels.ptr = 0;
464
- var l = 0, s = 0, w = 0, k = 0, D = 0, d = 0, y = 0, x = 0, L = 0, p = 0, c = 0, U = 0, I = 0, M = 0, T = 0, V = 0, S, B, C, _, O, b, Q = new r(f * f), ne = h % f || f, ae = i % f || f, G, H, q = a.numDims, j, Z = e.pixels.resultMask, z = e.pixels.resultPixels, fe = a.fileVersion, ee = fe >= 5 ? 14 : 15, E, J = a.zMax, N;
467
+ var l = 0, s = 0, w = 0, k = 0, D = 0, d = 0, y = 0, x = 0, L = 0, p = 0, c = 0, U = 0, I = 0, M = 0, T = 0, V = 0, S, B, C, j, O, b, Q = new r(f * f), ne = h % f || f, ae = i % f || f, G, H, q = a.numDims, _, E = e.pixels.resultMask, z = e.pixels.resultPixels, fe = a.fileVersion, ee = fe >= 5 ? 14 : 15, Z, J = a.zMax, N;
465
468
  for (w = 0; w < g; w++)
466
469
  for (D = w !== g - 1 ? f : ne, k = 0; k < m; k++)
467
- for (d = k !== m - 1 ? f : ae, c = w * i * f + k * f, U = i - d, j = 0; j < q; j++) {
468
- if (q > 1 ? (N = z, c = w * i * f + k * f, z = new r(e.pixels.resultPixels.buffer, n * j * u, n), J = a.maxValues[j]) : N = null, y = t.byteLength - e.ptr, S = new DataView(t, e.ptr, Math.min(10, y)), B = {}, V = 0, x = S.getUint8(0), V++, E = a.fileVersion >= 5 ? x & 4 : 0, L = x >> 6 & 255, p = x >> 2 & ee, p !== (k * f >> 3 & ee) || E && j === 0)
470
+ for (d = k !== m - 1 ? f : ae, c = w * i * f + k * f, U = i - d, _ = 0; _ < q; _++) {
471
+ if (q > 1 ? (N = z, c = w * i * f + k * f, z = new r(e.pixels.resultPixels.buffer, n * _ * u, n), J = a.maxValues[_]) : N = null, y = t.byteLength - e.ptr, S = new DataView(t, e.ptr, Math.min(10, y)), B = {}, V = 0, x = S.getUint8(0), V++, Z = a.fileVersion >= 5 ? x & 4 : 0, L = x >> 6 & 255, p = x >> 2 & ee, p !== (k * f >> 3 & ee) || Z && _ === 0)
469
472
  throw "integrity issue";
470
473
  if (b = x & 3, b > 3)
471
474
  throw e.ptr += V, "Invalid block encoding (" + b + ")";
472
475
  if (b === 2) {
473
- if (E)
474
- if (Z)
476
+ if (Z)
477
+ if (E)
475
478
  for (l = 0; l < D; l++)
476
479
  for (s = 0; s < d; s++)
477
- Z[c] && (z[c] = N[c]), c++;
480
+ E[c] && (z[c] = N[c]), c++;
478
481
  else
479
482
  for (l = 0; l < D; l++)
480
483
  for (s = 0; s < d; s++)
@@ -482,12 +485,12 @@ var ie = { exports: {} };
482
485
  e.counter.constant++, e.ptr += V;
483
486
  continue;
484
487
  } else if (b === 0) {
485
- if (E)
488
+ if (Z)
486
489
  throw "integrity issue";
487
- if (e.counter.uncompressed++, e.ptr += V, I = D * d * u, M = t.byteLength - e.ptr, I = I < M ? I : M, C = new ArrayBuffer(I % u === 0 ? I : I + u - I % u), _ = new Uint8Array(C), _.set(new Uint8Array(t, e.ptr, I)), O = new r(C), T = 0, Z)
490
+ if (e.counter.uncompressed++, e.ptr += V, I = D * d * u, M = t.byteLength - e.ptr, I = I < M ? I : M, C = new ArrayBuffer(I % u === 0 ? I : I + u - I % u), j = new Uint8Array(C), j.set(new Uint8Array(t, e.ptr, I)), O = new r(C), T = 0, E)
488
491
  for (l = 0; l < D; l++) {
489
492
  for (s = 0; s < d; s++)
490
- Z[c] && (z[c] = O[T++]), c++;
493
+ E[c] && (z[c] = O[T++]), c++;
491
494
  c += U;
492
495
  }
493
496
  else
@@ -497,24 +500,24 @@ var ie = { exports: {} };
497
500
  c += U;
498
501
  }
499
502
  e.ptr += T * u;
500
- } else if (G = A.getDataTypeUsed(E && v < 6 ? 4 : v, L), H = A.getOnePixel(B, V, G, S), V += A.getDataTypeSize(G), b === 3)
501
- if (e.ptr += V, e.counter.constantoffset++, Z)
503
+ } else if (G = A.getDataTypeUsed(Z && v < 6 ? 4 : v, L), H = A.getOnePixel(B, V, G, S), V += A.getDataTypeSize(G), b === 3)
504
+ if (e.ptr += V, e.counter.constantoffset++, E)
502
505
  for (l = 0; l < D; l++) {
503
506
  for (s = 0; s < d; s++)
504
- Z[c] && (z[c] = E ? Math.min(J, N[c] + H) : H), c++;
507
+ E[c] && (z[c] = Z ? Math.min(J, N[c] + H) : H), c++;
505
508
  c += U;
506
509
  }
507
510
  else
508
511
  for (l = 0; l < D; l++) {
509
512
  for (s = 0; s < d; s++)
510
- z[c] = E ? Math.min(J, N[c] + H) : H, c++;
513
+ z[c] = Z ? Math.min(J, N[c] + H) : H, c++;
511
514
  c += U;
512
515
  }
513
- else if (e.ptr += V, A.decodeBits(t, e, Q, H, j), V = 0, E)
514
- if (Z)
516
+ else if (e.ptr += V, A.decodeBits(t, e, Q, H, _), V = 0, Z)
517
+ if (E)
515
518
  for (l = 0; l < D; l++) {
516
519
  for (s = 0; s < d; s++)
517
- Z[c] && (z[c] = Q[V++] + N[c]), c++;
520
+ E[c] && (z[c] = Q[V++] + N[c]), c++;
518
521
  c += U;
519
522
  }
520
523
  else
@@ -523,10 +526,10 @@ var ie = { exports: {} };
523
526
  z[c] = Q[V++] + N[c], c++;
524
527
  c += U;
525
528
  }
526
- else if (Z)
529
+ else if (E)
527
530
  for (l = 0; l < D; l++) {
528
531
  for (s = 0; s < d; s++)
529
- Z[c] && (z[c] = Q[V++]), c++;
532
+ E[c] && (z[c] = Q[V++]), c++;
530
533
  c += U;
531
534
  }
532
535
  else
@@ -538,6 +541,9 @@ var ie = { exports: {} };
538
541
  }
539
542
  q > 1 && !o && (e.pixels.resultPixels = A.swapDimensionOrder(e.pixels.resultPixels, n, q, r));
540
543
  },
544
+ /*****************
545
+ * private methods (helper methods)
546
+ *****************/
541
547
  formatFileInfo: function(t) {
542
548
  return {
543
549
  fileIdentifierString: t.headerInfo.fileIdentifierString,
@@ -557,6 +563,7 @@ var ie = { exports: {} };
557
563
  pixels: {
558
564
  numBlocksX: t.pixels.numBlocksX,
559
565
  numBlocksY: t.pixels.numBlocksY,
566
+ //"numBytes": data.pixels.numBytes,
560
567
  maxValue: t.headerInfo.zMax,
561
568
  minValue: t.headerInfo.zMin,
562
569
  noDataValue: t.noDataValue
@@ -785,65 +792,100 @@ var ie = { exports: {} };
785
792
  }, X = function(t, e, r) {
786
793
  this.val = t, this.left = e, this.right = r;
787
794
  }, R = {
795
+ /*
796
+ * ********removed options compared to LERC1. We can bring some of them back if needed.
797
+ * removed pixel type. LERC2 is typed and doesn't require user to give pixel type
798
+ * changed encodedMaskData to maskData. LERC2 's js version make it faster to use maskData directly.
799
+ * removed returnMask. mask is used by LERC2 internally and is cost free. In case of user input mask, it's returned as well and has neglible cost.
800
+ * removed nodatavalue. Because LERC2 pixels are typed, nodatavalue will sacrify a useful value for many types (8bit, 16bit) etc,
801
+ * user has to be knowledgable enough about raster and their data to avoid usability issues. so nodata value is simply removed now.
802
+ * We can add it back later if their's a clear requirement.
803
+ * removed encodedMask. This option was not implemented in LercDecode. It can be done after decoding (less efficient)
804
+ * removed computeUsedBitDepths.
805
+ *
806
+ *
807
+ * response changes compared to LERC1
808
+ * 1. encodedMaskData is not available
809
+ * 2. noDataValue is optional (returns only if user's noDataValue is with in the valid data type range)
810
+ * 3. maskData is always available
811
+ */
812
+ /*****************
813
+ * public properties
814
+ ******************/
815
+ //HUFFMAN_LUT_BITS_MAX: 12, //use 2^12 lut, not configurable
816
+ /*****************
817
+ * public methods
818
+ *****************/
819
+ /**
820
+ * Decode a LERC2 byte stream and return an object containing the pixel data and optional metadata.
821
+ *
822
+ * @param {ArrayBuffer} input The LERC input byte stream
823
+ * @param {object} [options] options Decoding options
824
+ * @param {number} [options.inputOffset] The number of bytes to skip in the input byte stream. A valid LERC file is expected at that position
825
+ * @param {boolean} [options.returnFileInfo] If true, the return value will have a fileInfo property that contains metadata obtained from the LERC headers and the decoding process
826
+ * @param {boolean} [options.returnPixelInterleavedDims] If true, returned dimensions are pixel-interleaved, a.k.a [p1_dim0, p1_dim1, p1_dimn, p2_dim0...], default is [p1_dim0, p2_dim0, ..., p1_dim1, p2_dim1...]
827
+ */
788
828
  decode: function(t, e) {
789
829
  e = e || {};
790
830
  var r = e.noDataValue, o = 0, a = {};
791
- a.ptr = e.inputOffset || 0, a.pixels = {}, A.readHeaderInfo(t, a);
792
- var i = a.headerInfo, h = i.fileVersion, n = A.getDataTypeArray(i.imageType);
793
- if (h > 5)
794
- throw "unsupported lerc version 2." + h;
795
- A.readMask(t, a), i.numValidPixel !== i.width * i.height && !a.pixels.resultMask && (a.pixels.resultMask = e.maskData);
796
- var f = i.width * i.height;
797
- a.pixels.resultPixels = new n(f * i.numDims), a.counter = {
798
- onesweep: 0,
799
- uncompressed: 0,
800
- lut: 0,
801
- bitstuffer: 0,
802
- constant: 0,
803
- constantoffset: 0
804
- };
805
- var v = !e.returnPixelInterleavedDims;
806
- if (i.numValidPixel !== 0)
807
- if (i.zMax === i.zMin)
808
- A.constructConstantSurface(a, v);
809
- else if (h >= 4 && A.checkMinMaxRanges(t, a))
810
- A.constructConstantSurface(a, v);
811
- else {
812
- var u = new DataView(t, a.ptr, 2), m = u.getUint8(0);
813
- if (a.ptr++, m)
814
- A.readDataOneSweep(t, a, n, v);
815
- else if (h > 1 && i.imageType <= 1 && Math.abs(i.maxZError - 0.5) < 1e-5) {
816
- var g = u.getUint8(1);
817
- if (a.ptr++, a.encodeMode = g, g > 2 || h < 4 && g > 1)
818
- throw "Invalid Huffman flag " + g;
819
- g ? A.readHuffman(t, a, n, v) : A.readTiles(t, a, n, v);
820
- } else
821
- A.readTiles(t, a, n, v);
831
+ if (a.ptr = e.inputOffset || 0, a.pixels = {}, !!A.readHeaderInfo(t, a)) {
832
+ var i = a.headerInfo, h = i.fileVersion, n = A.getDataTypeArray(i.imageType);
833
+ if (h > 5)
834
+ throw "unsupported lerc version 2." + h;
835
+ A.readMask(t, a), i.numValidPixel !== i.width * i.height && !a.pixels.resultMask && (a.pixels.resultMask = e.maskData);
836
+ var f = i.width * i.height;
837
+ a.pixels.resultPixels = new n(f * i.numDims), a.counter = {
838
+ onesweep: 0,
839
+ uncompressed: 0,
840
+ lut: 0,
841
+ bitstuffer: 0,
842
+ constant: 0,
843
+ constantoffset: 0
844
+ };
845
+ var v = !e.returnPixelInterleavedDims;
846
+ if (i.numValidPixel !== 0)
847
+ if (i.zMax === i.zMin)
848
+ A.constructConstantSurface(a, v);
849
+ else if (h >= 4 && A.checkMinMaxRanges(t, a))
850
+ A.constructConstantSurface(a, v);
851
+ else {
852
+ var u = new DataView(t, a.ptr, 2), m = u.getUint8(0);
853
+ if (a.ptr++, m)
854
+ A.readDataOneSweep(t, a, n, v);
855
+ else if (h > 1 && i.imageType <= 1 && Math.abs(i.maxZError - 0.5) < 1e-5) {
856
+ var g = u.getUint8(1);
857
+ if (a.ptr++, a.encodeMode = g, g > 2 || h < 4 && g > 1)
858
+ throw "Invalid Huffman flag " + g;
859
+ g ? A.readHuffman(t, a, n, v) : A.readTiles(t, a, n, v);
860
+ } else
861
+ A.readTiles(t, a, n, v);
862
+ }
863
+ a.eofOffset = a.ptr;
864
+ var l;
865
+ e.inputOffset ? (l = a.headerInfo.blobSize + e.inputOffset - a.ptr, Math.abs(l) >= 1 && (a.eofOffset = e.inputOffset + a.headerInfo.blobSize)) : (l = a.headerInfo.blobSize - a.ptr, Math.abs(l) >= 1 && (a.eofOffset = a.headerInfo.blobSize));
866
+ var s = {
867
+ width: i.width,
868
+ height: i.height,
869
+ pixelData: a.pixels.resultPixels,
870
+ minValue: i.zMin,
871
+ maxValue: i.zMax,
872
+ validPixelCount: i.numValidPixel,
873
+ dimCount: i.numDims,
874
+ dimStats: {
875
+ minValues: i.minValues,
876
+ maxValues: i.maxValues
877
+ },
878
+ maskData: a.pixels.resultMask
879
+ //noDataValue: noDataValue
880
+ };
881
+ if (a.pixels.resultMask && A.isValidPixelValue(i.imageType, r)) {
882
+ var w = a.pixels.resultMask;
883
+ for (o = 0; o < f; o++)
884
+ w[o] || (s.pixelData[o] = r);
885
+ s.noDataValue = r;
822
886
  }
823
- a.eofOffset = a.ptr;
824
- var l;
825
- e.inputOffset ? (l = a.headerInfo.blobSize + e.inputOffset - a.ptr, Math.abs(l) >= 1 && (a.eofOffset = e.inputOffset + a.headerInfo.blobSize)) : (l = a.headerInfo.blobSize - a.ptr, Math.abs(l) >= 1 && (a.eofOffset = a.headerInfo.blobSize));
826
- var s = {
827
- width: i.width,
828
- height: i.height,
829
- pixelData: a.pixels.resultPixels,
830
- minValue: i.zMin,
831
- maxValue: i.zMax,
832
- validPixelCount: i.numValidPixel,
833
- dimCount: i.numDims,
834
- dimStats: {
835
- minValues: i.minValues,
836
- maxValues: i.maxValues
837
- },
838
- maskData: a.pixels.resultMask
839
- };
840
- if (a.pixels.resultMask && A.isValidPixelValue(i.imageType, r)) {
841
- var w = a.pixels.resultMask;
842
- for (o = 0; o < f; o++)
843
- w[o] || (s.pixelData[o] = r);
844
- s.noDataValue = r;
887
+ return a.noDataValue = r, e.returnFileInfo && (s.fileInfo = A.formatFileInfo(a)), s;
845
888
  }
846
- return a.noDataValue = r, e.returnFileInfo && (s.fileInfo = A.formatFileInfo(a)), s;
847
889
  },
848
890
  getBandCount: function(t) {
849
891
  var e = 0, r = 0, o = {};
@@ -857,6 +899,25 @@ var ie = { exports: {} };
857
899
  var F = new ArrayBuffer(4), A = new Uint8Array(F), X = new Uint32Array(F);
858
900
  return X[0] = 1, A[0] === 1;
859
901
  }(), P = {
902
+ /************wrapper**********************************************/
903
+ /**
904
+ * A wrapper for decoding both LERC1 and LERC2 byte streams capable of handling multiband pixel blocks for various pixel types.
905
+ *
906
+ * @alias module:Lerc
907
+ * @param {ArrayBuffer} input The LERC input byte stream
908
+ * @param {object} [options] The decoding options below are optional.
909
+ * @param {number} [options.inputOffset] The number of bytes to skip in the input byte stream. A valid Lerc file is expected at that position.
910
+ * @param {string} [options.pixelType] (LERC1 only) Default value is F32. Valid pixel types for input are U8/S8/S16/U16/S32/U32/F32.
911
+ * @param {number} [options.noDataValue] (LERC1 only). It is recommended to use the returned mask instead of setting this value.
912
+ * @param {boolean} [options.returnPixelInterleavedDims] (nDim LERC2 only) If true, returned dimensions are pixel-interleaved, a.k.a [p1_dim0, p1_dim1, p1_dimn, p2_dim0...], default is [p1_dim0, p2_dim0, ..., p1_dim1, p2_dim1...]
913
+ * @returns {{width, height, pixels, pixelType, mask, statistics}}
914
+ * @property {number} width Width of decoded image.
915
+ * @property {number} height Height of decoded image.
916
+ * @property {array} pixels [band1, band2, …] Each band is a typed array of width*height.
917
+ * @property {string} pixelType The type of pixels represented in the output.
918
+ * @property {mask} mask Typed array with a size of width*height, or null if all pixels are valid.
919
+ * @property {array} statistics [statistics_band1, statistics_band2, …] Each element is a statistics object representing min and max values
920
+ **/
860
921
  decode: function(F, A) {
861
922
  if (!W)
862
923
  throw "Big endian system is not supported.";
@@ -878,14 +939,23 @@ var ie = { exports: {} };
878
939
  }, u = 0; X < a; ) {
879
940
  var m = e.decode(F, {
880
941
  inputOffset: X,
942
+ //for both lerc1 and lerc2
881
943
  encodedMaskData: i,
944
+ //lerc1 only
882
945
  maskData: f,
946
+ //lerc2 only
883
947
  returnMask: o === 0,
948
+ //lerc1 only
884
949
  returnEncodedMask: o === 0,
950
+ //lerc1 only
885
951
  returnFileInfo: !0,
952
+ //for both lerc1 and lerc2
886
953
  returnPixelInterleavedDims: A.returnPixelInterleavedDims,
954
+ //for ndim lerc2 only
887
955
  pixelType: A.pixelType || null,
956
+ //lerc1 only
888
957
  noDataValue: A.noDataValue || null
958
+ //lerc1 only
889
959
  });
890
960
  X = m.fileInfo.eofOffset, f = m.maskData, o === 0 && (i = m.encodedMaskData, v.width = m.width, v.height = m.height, v.dimCount = m.dimCount || 1, v.pixelType = m.pixelType || m.fileInfo.pixelType, v.mask = f), r > 1 && (f && h.push(f), m.fileInfo.mask && m.fileInfo.mask.numBytes > 0 && u++), o++, v.pixels.push(m.pixelData), v.statistics.push({
891
961
  minValue: m.minValue,
@@ -907,10 +977,11 @@ var ie = { exports: {} };
907
977
  $.exports ? $.exports = P : this.Lerc = P;
908
978
  })();
909
979
  })(ie);
910
- const oe = ie.exports;
911
- class ce extends se {
980
+ var ue = ie.exports;
981
+ const ve = /* @__PURE__ */ se(ue);
982
+ class we extends le {
912
983
  constructor(Y) {
913
- super(), this.planarConfiguration = typeof Y.PlanarConfiguration < "u" ? Y.PlanarConfiguration : 1, this.samplesPerPixel = typeof Y.SamplesPerPixel < "u" ? Y.SamplesPerPixel : 1, this.addCompression = Y.LercParameters[le.AddCompression];
984
+ super(), this.planarConfiguration = typeof Y.PlanarConfiguration != "undefined" ? Y.PlanarConfiguration : 1, this.samplesPerPixel = typeof Y.SamplesPerPixel != "undefined" ? Y.SamplesPerPixel : 1, this.addCompression = Y.LercParameters[oe.AddCompression];
914
985
  }
915
986
  decodeBlock(Y) {
916
987
  switch (this.addCompression) {
@@ -922,9 +993,9 @@ class ce extends se {
922
993
  default:
923
994
  throw new Error(`Unsupported LERC additional compression method identifier: ${this.addCompression}`);
924
995
  }
925
- return oe.decode(Y, { returnPixelInterleavedDims: this.planarConfiguration === 1 }).pixels[0].buffer;
996
+ return ve.decode(Y, { returnPixelInterleavedDims: this.planarConfiguration === 1 }).pixels[0].buffer;
926
997
  }
927
998
  }
928
999
  export {
929
- ce as default
1000
+ we as default
930
1001
  };
@@ -1,8 +1,8 @@
1
- import { B as m } from "./index.a9498574.mjs";
1
+ import { B } from "./index-6ca034d3.js";
2
2
  import "react";
3
3
  import "react-dom";
4
- const k = 9, E = 256, D = 257, B = 12;
5
- function b(c, o, r) {
4
+ const m = 9, E = 256, D = 257, b = 12;
5
+ function k(c, o, r) {
6
6
  const i = o % 8, t = Math.floor(o / 8), h = 8 - i, g = o + r - (t + 1) * 8;
7
7
  let l = 8 * (t + 2) - (o + r);
8
8
  const w = (t + 2) * 8 - o;
@@ -16,8 +16,8 @@ function b(c, o, r) {
16
16
  f <<= Math.max(0, r - w), s += f;
17
17
  }
18
18
  if (g > 8 && t + 2 < c.length) {
19
- const f = (t + 3) * 8 - (o + r);
20
- s += c[t + 2] >>> f;
19
+ const f = (t + 3) * 8 - (o + r), n = c[t + 2] >>> f;
20
+ s += n;
21
21
  }
22
22
  return s;
23
23
  }
@@ -30,12 +30,12 @@ function x(c) {
30
30
  const o = new Uint16Array(4093), r = new Uint8Array(4093);
31
31
  for (let e = 0; e <= 257; e++)
32
32
  o[e] = 4096, r[e] = e;
33
- let i = 258, t = k, h = 0;
33
+ let i = 258, t = m, h = 0;
34
34
  function g() {
35
- i = 258, t = k;
35
+ i = 258, t = m;
36
36
  }
37
37
  function l(e) {
38
- const a = b(e, h, t);
38
+ const a = k(e, h, t);
39
39
  return h += t, a;
40
40
  }
41
41
  function w(e, a) {
@@ -72,11 +72,11 @@ function x(c) {
72
72
  throw new Error(`Bogus entry. Not in dictionary, ${d} / ${i}, position: ${h}`);
73
73
  p(s, e), s.push(e[e.length - 1]), w(d, e[e.length - 1]), d = n;
74
74
  }
75
- i + 1 >= 2 ** t && (t === B ? d = void 0 : t++), n = l(f);
75
+ i + 1 >= 2 ** t && (t === b ? d = void 0 : t++), n = l(f);
76
76
  }
77
77
  return new Uint8Array(s);
78
78
  }
79
- class I extends m {
79
+ class I extends B {
80
80
  decodeBlock(o) {
81
81
  return x(o).buffer;
82
82
  }
@@ -1,4 +1,4 @@
1
- import { B as i } from "./index.a9498574.mjs";
1
+ import { B as i } from "./index-6ca034d3.js";
2
2
  import "react";
3
3
  import "react-dom";
4
4
  class p extends i {