@vitessce/gl 3.2.2 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{deflate-2292d6bb.js → deflate-27838921.js} +1 -1
- package/dist/{index-7bac69ff.js → index-9f310473.js} +356 -2707
- package/dist/index.js +2 -2
- package/dist/{jpeg-d84c376b.js → jpeg-29bf61b4.js} +1 -1
- package/dist/{lerc-abfff89b.js → lerc-64265216.js} +1 -1
- package/dist/{lzw-e748554e.js → lzw-984a6040.js} +1 -1
- package/dist/{packbits-17d3eaf3.js → packbits-d5887f3d.js} +1 -1
- package/dist/{raw-7701dc0d.js → raw-df5c07c8.js} +1 -1
- package/dist/{webimage-6b6fefe4.js → webimage-a12c8ff6.js} +1 -1
- package/dist-tsc/viv.d.ts +1 -1
- package/dist-tsc/viv.js +1 -1
- package/package.json +2 -2
- package/src/viv.js +0 -1
|
@@ -731,9 +731,9 @@ function concatenateTypedArrays(...typedArrays) {
|
|
|
731
731
|
const sumLength = arrays.reduce((acc, value) => acc + value.length, 0);
|
|
732
732
|
const result = new TypedArrayConstructor(sumLength);
|
|
733
733
|
let offset = 0;
|
|
734
|
-
for (const
|
|
735
|
-
result.set(
|
|
736
|
-
offset +=
|
|
734
|
+
for (const array of arrays) {
|
|
735
|
+
result.set(array, offset);
|
|
736
|
+
offset += array.length;
|
|
737
737
|
}
|
|
738
738
|
return result;
|
|
739
739
|
}
|
|
@@ -2475,7 +2475,7 @@ async function parseWithLoader(loader, data, options, context) {
|
|
|
2475
2475
|
assert$b(!loader.parseSync);
|
|
2476
2476
|
throw new Error("".concat(loader.id, " loader - no parser found and worker is disabled"));
|
|
2477
2477
|
}
|
|
2478
|
-
async function load
|
|
2478
|
+
async function load(url, loaders, options, context) {
|
|
2479
2479
|
if (!Array.isArray(loaders) && !isLoaderObject(loaders)) {
|
|
2480
2480
|
options = loaders;
|
|
2481
2481
|
loaders = void 0;
|
|
@@ -3664,8 +3664,8 @@ const drawFramebuffer = (gl, value) => {
|
|
|
3664
3664
|
const readFramebuffer = (gl, value) => {
|
|
3665
3665
|
return gl.bindFramebuffer(36008, value);
|
|
3666
3666
|
};
|
|
3667
|
-
function isArray$4(
|
|
3668
|
-
return Array.isArray(
|
|
3667
|
+
function isArray$4(array) {
|
|
3668
|
+
return Array.isArray(array) || ArrayBuffer.isView(array);
|
|
3669
3669
|
}
|
|
3670
3670
|
const GL_PARAMETER_SETTERS = {
|
|
3671
3671
|
[3042]: enable,
|
|
@@ -8663,16 +8663,16 @@ class VertexArrayObject extends Resource$1 {
|
|
|
8663
8663
|
VertexArrayObject.MAX_ATTRIBUTES = VertexArrayObject.MAX_ATTRIBUTES || gl.getParameter(34921);
|
|
8664
8664
|
return VertexArrayObject.MAX_ATTRIBUTES;
|
|
8665
8665
|
}
|
|
8666
|
-
static setConstant(gl, location,
|
|
8667
|
-
switch (
|
|
8666
|
+
static setConstant(gl, location, array) {
|
|
8667
|
+
switch (array.constructor) {
|
|
8668
8668
|
case Float32Array:
|
|
8669
|
-
VertexArrayObject._setConstantFloatArray(gl, location,
|
|
8669
|
+
VertexArrayObject._setConstantFloatArray(gl, location, array);
|
|
8670
8670
|
break;
|
|
8671
8671
|
case Int32Array:
|
|
8672
|
-
VertexArrayObject._setConstantIntArray(gl, location,
|
|
8672
|
+
VertexArrayObject._setConstantIntArray(gl, location, array);
|
|
8673
8673
|
break;
|
|
8674
8674
|
case Uint32Array:
|
|
8675
|
-
VertexArrayObject._setConstantUintArray(gl, location,
|
|
8675
|
+
VertexArrayObject._setConstantUintArray(gl, location, array);
|
|
8676
8676
|
break;
|
|
8677
8677
|
default:
|
|
8678
8678
|
assert$8(false);
|
|
@@ -8796,57 +8796,57 @@ class VertexArrayObject extends Resource$1 {
|
|
|
8796
8796
|
}
|
|
8797
8797
|
return true;
|
|
8798
8798
|
}
|
|
8799
|
-
static _setConstantFloatArray(gl, location,
|
|
8800
|
-
switch (
|
|
8799
|
+
static _setConstantFloatArray(gl, location, array) {
|
|
8800
|
+
switch (array.length) {
|
|
8801
8801
|
case 1:
|
|
8802
|
-
gl.vertexAttrib1fv(location,
|
|
8802
|
+
gl.vertexAttrib1fv(location, array);
|
|
8803
8803
|
break;
|
|
8804
8804
|
case 2:
|
|
8805
|
-
gl.vertexAttrib2fv(location,
|
|
8805
|
+
gl.vertexAttrib2fv(location, array);
|
|
8806
8806
|
break;
|
|
8807
8807
|
case 3:
|
|
8808
|
-
gl.vertexAttrib3fv(location,
|
|
8808
|
+
gl.vertexAttrib3fv(location, array);
|
|
8809
8809
|
break;
|
|
8810
8810
|
case 4:
|
|
8811
|
-
gl.vertexAttrib4fv(location,
|
|
8811
|
+
gl.vertexAttrib4fv(location, array);
|
|
8812
8812
|
break;
|
|
8813
8813
|
default:
|
|
8814
8814
|
assert$8(false);
|
|
8815
8815
|
}
|
|
8816
8816
|
}
|
|
8817
|
-
static _setConstantIntArray(gl, location,
|
|
8817
|
+
static _setConstantIntArray(gl, location, array) {
|
|
8818
8818
|
assert$8(isWebGL2$1(gl));
|
|
8819
|
-
switch (
|
|
8819
|
+
switch (array.length) {
|
|
8820
8820
|
case 1:
|
|
8821
|
-
gl.vertexAttribI1iv(location,
|
|
8821
|
+
gl.vertexAttribI1iv(location, array);
|
|
8822
8822
|
break;
|
|
8823
8823
|
case 2:
|
|
8824
|
-
gl.vertexAttribI2iv(location,
|
|
8824
|
+
gl.vertexAttribI2iv(location, array);
|
|
8825
8825
|
break;
|
|
8826
8826
|
case 3:
|
|
8827
|
-
gl.vertexAttribI3iv(location,
|
|
8827
|
+
gl.vertexAttribI3iv(location, array);
|
|
8828
8828
|
break;
|
|
8829
8829
|
case 4:
|
|
8830
|
-
gl.vertexAttribI4iv(location,
|
|
8830
|
+
gl.vertexAttribI4iv(location, array);
|
|
8831
8831
|
break;
|
|
8832
8832
|
default:
|
|
8833
8833
|
assert$8(false);
|
|
8834
8834
|
}
|
|
8835
8835
|
}
|
|
8836
|
-
static _setConstantUintArray(gl, location,
|
|
8836
|
+
static _setConstantUintArray(gl, location, array) {
|
|
8837
8837
|
assert$8(isWebGL2$1(gl));
|
|
8838
|
-
switch (
|
|
8838
|
+
switch (array.length) {
|
|
8839
8839
|
case 1:
|
|
8840
|
-
gl.vertexAttribI1uiv(location,
|
|
8840
|
+
gl.vertexAttribI1uiv(location, array);
|
|
8841
8841
|
break;
|
|
8842
8842
|
case 2:
|
|
8843
|
-
gl.vertexAttribI2uiv(location,
|
|
8843
|
+
gl.vertexAttribI2uiv(location, array);
|
|
8844
8844
|
break;
|
|
8845
8845
|
case 3:
|
|
8846
|
-
gl.vertexAttribI3uiv(location,
|
|
8846
|
+
gl.vertexAttribI3uiv(location, array);
|
|
8847
8847
|
break;
|
|
8848
8848
|
case 4:
|
|
8849
|
-
gl.vertexAttribI4uiv(location,
|
|
8849
|
+
gl.vertexAttribI4uiv(location, array);
|
|
8850
8850
|
break;
|
|
8851
8851
|
default:
|
|
8852
8852
|
assert$8(false);
|
|
@@ -9219,7 +9219,7 @@ function formatValue$1(v) {
|
|
|
9219
9219
|
let opts2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
9220
9220
|
const EPSILON2 = 1e-16;
|
|
9221
9221
|
const {
|
|
9222
|
-
isInteger
|
|
9222
|
+
isInteger = false
|
|
9223
9223
|
} = opts2;
|
|
9224
9224
|
if (Array.isArray(v) || ArrayBuffer.isView(v)) {
|
|
9225
9225
|
return formatArrayValue(v, opts2);
|
|
@@ -9228,9 +9228,9 @@ function formatValue$1(v) {
|
|
|
9228
9228
|
return String(v);
|
|
9229
9229
|
}
|
|
9230
9230
|
if (Math.abs(v) < EPSILON2) {
|
|
9231
|
-
return
|
|
9231
|
+
return isInteger ? "0" : "0.";
|
|
9232
9232
|
}
|
|
9233
|
-
if (
|
|
9233
|
+
if (isInteger) {
|
|
9234
9234
|
return v.toFixed(0);
|
|
9235
9235
|
}
|
|
9236
9236
|
if (Math.abs(v) > 100 && Math.abs(v) < 1e4) {
|
|
@@ -9376,14 +9376,14 @@ function getDebugTableRow(vertexArray, attribute, accessor, header) {
|
|
|
9376
9376
|
let size = 1;
|
|
9377
9377
|
let verts = 0;
|
|
9378
9378
|
let bytes = 0;
|
|
9379
|
-
let
|
|
9379
|
+
let isInteger;
|
|
9380
9380
|
let marker2;
|
|
9381
9381
|
let value;
|
|
9382
9382
|
if (accessor) {
|
|
9383
9383
|
type = accessor.type;
|
|
9384
9384
|
size = accessor.size;
|
|
9385
9385
|
type = String(type).replace("Array", "");
|
|
9386
|
-
|
|
9386
|
+
isInteger = type.indexOf("nt") !== -1;
|
|
9387
9387
|
}
|
|
9388
9388
|
if (attribute instanceof Buffer$3) {
|
|
9389
9389
|
const buffer2 = attribute;
|
|
@@ -9400,13 +9400,13 @@ function getDebugTableRow(vertexArray, attribute, accessor, header) {
|
|
|
9400
9400
|
const instanced = accessor.divisor > 0;
|
|
9401
9401
|
format = "".concat(instanced ? "I " : "P ", " ").concat(verts, " (x").concat(size, "=").concat(bytes, " bytes ").concat(getKey(gl, type), ")");
|
|
9402
9402
|
} else {
|
|
9403
|
-
|
|
9403
|
+
isInteger = true;
|
|
9404
9404
|
format = "".concat(bytes, " bytes");
|
|
9405
9405
|
}
|
|
9406
9406
|
return {
|
|
9407
9407
|
[header]: "".concat(marker2).concat(formatValue$1(value, {
|
|
9408
9408
|
size,
|
|
9409
|
-
isInteger
|
|
9409
|
+
isInteger
|
|
9410
9410
|
})),
|
|
9411
9411
|
"Format ": format
|
|
9412
9412
|
};
|
|
@@ -9414,11 +9414,11 @@ function getDebugTableRow(vertexArray, attribute, accessor, header) {
|
|
|
9414
9414
|
value = attribute;
|
|
9415
9415
|
size = attribute.length;
|
|
9416
9416
|
type = String(attribute.constructor.name).replace("Array", "");
|
|
9417
|
-
|
|
9417
|
+
isInteger = type.indexOf("nt") !== -1;
|
|
9418
9418
|
return {
|
|
9419
9419
|
[header]: "".concat(formatValue$1(value, {
|
|
9420
9420
|
size,
|
|
9421
|
-
isInteger
|
|
9421
|
+
isInteger
|
|
9422
9422
|
}), " (constant)"),
|
|
9423
9423
|
"Format ": "".concat(size, "x").concat(type, " (constant)")
|
|
9424
9424
|
};
|
|
@@ -10737,8 +10737,8 @@ function formatValue(value, {
|
|
|
10737
10737
|
function isArray$3(value) {
|
|
10738
10738
|
return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
10739
10739
|
}
|
|
10740
|
-
function clone$6(
|
|
10741
|
-
return "clone" in
|
|
10740
|
+
function clone$6(array) {
|
|
10741
|
+
return "clone" in array ? array.clone() : array.slice();
|
|
10742
10742
|
}
|
|
10743
10743
|
function toRadians(degrees2) {
|
|
10744
10744
|
return radians$1(degrees2);
|
|
@@ -10852,14 +10852,14 @@ function withEpsilon(epsilon3, func) {
|
|
|
10852
10852
|
function round$1(value) {
|
|
10853
10853
|
return Math.round(value / config.EPSILON) * config.EPSILON;
|
|
10854
10854
|
}
|
|
10855
|
-
function duplicateArray(
|
|
10856
|
-
return
|
|
10855
|
+
function duplicateArray(array) {
|
|
10856
|
+
return array.clone ? array.clone() : new Array(array.length);
|
|
10857
10857
|
}
|
|
10858
10858
|
function map(value, func, result) {
|
|
10859
10859
|
if (isArray$3(value)) {
|
|
10860
|
-
const
|
|
10861
|
-
result = result || duplicateArray(
|
|
10862
|
-
for (let i2 = 0; i2 < result.length && i2 <
|
|
10860
|
+
const array = value;
|
|
10861
|
+
result = result || duplicateArray(array);
|
|
10862
|
+
for (let i2 = 0; i2 < result.length && i2 < array.length; ++i2) {
|
|
10863
10863
|
result[i2] = func(value[i2], i2, result);
|
|
10864
10864
|
}
|
|
10865
10865
|
return result;
|
|
@@ -10891,9 +10891,9 @@ class MathArray extends _extendableBuiltin(Array) {
|
|
|
10891
10891
|
clone() {
|
|
10892
10892
|
return new this.constructor().copy(this);
|
|
10893
10893
|
}
|
|
10894
|
-
fromArray(
|
|
10894
|
+
fromArray(array, offset = 0) {
|
|
10895
10895
|
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
10896
|
-
this[i2] =
|
|
10896
|
+
this[i2] = array[i2 + offset];
|
|
10897
10897
|
}
|
|
10898
10898
|
return this.check();
|
|
10899
10899
|
}
|
|
@@ -10928,23 +10928,23 @@ class MathArray extends _extendableBuiltin(Array) {
|
|
|
10928
10928
|
}
|
|
10929
10929
|
return "".concat(opts2.printTypes ? this.constructor.name : "", "[").concat(string, "]");
|
|
10930
10930
|
}
|
|
10931
|
-
equals(
|
|
10932
|
-
if (!
|
|
10931
|
+
equals(array) {
|
|
10932
|
+
if (!array || this.length !== array.length) {
|
|
10933
10933
|
return false;
|
|
10934
10934
|
}
|
|
10935
10935
|
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
10936
|
-
if (!equals$3(this[i2],
|
|
10936
|
+
if (!equals$3(this[i2], array[i2])) {
|
|
10937
10937
|
return false;
|
|
10938
10938
|
}
|
|
10939
10939
|
}
|
|
10940
10940
|
return true;
|
|
10941
10941
|
}
|
|
10942
|
-
exactEquals(
|
|
10943
|
-
if (!
|
|
10942
|
+
exactEquals(array) {
|
|
10943
|
+
if (!array || this.length !== array.length) {
|
|
10944
10944
|
return false;
|
|
10945
10945
|
}
|
|
10946
10946
|
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
10947
|
-
if (this[i2] !==
|
|
10947
|
+
if (this[i2] !== array[i2]) {
|
|
10948
10948
|
return false;
|
|
10949
10949
|
}
|
|
10950
10950
|
}
|
|
@@ -11132,11 +11132,11 @@ class Vector extends MathArray {
|
|
|
11132
11132
|
return checkNumber(length2);
|
|
11133
11133
|
}
|
|
11134
11134
|
dot(mathArray) {
|
|
11135
|
-
let
|
|
11135
|
+
let product = 0;
|
|
11136
11136
|
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
11137
|
-
|
|
11137
|
+
product += this[i2] * mathArray[i2];
|
|
11138
11138
|
}
|
|
11139
|
-
return checkNumber(
|
|
11139
|
+
return checkNumber(product);
|
|
11140
11140
|
}
|
|
11141
11141
|
normalize() {
|
|
11142
11142
|
const length2 = this.magnitude();
|
|
@@ -11204,7 +11204,7 @@ if (!Math.hypot)
|
|
|
11204
11204
|
}
|
|
11205
11205
|
return Math.sqrt(y2);
|
|
11206
11206
|
};
|
|
11207
|
-
function create$
|
|
11207
|
+
function create$4() {
|
|
11208
11208
|
var out = new ARRAY_TYPE(2);
|
|
11209
11209
|
if (ARRAY_TYPE != Float32Array) {
|
|
11210
11210
|
out[0] = 0;
|
|
@@ -11269,7 +11269,7 @@ function transformMat4$2(out, a2, m) {
|
|
|
11269
11269
|
}
|
|
11270
11270
|
var sub$1 = subtract$1;
|
|
11271
11271
|
(function() {
|
|
11272
|
-
var vec = create$
|
|
11272
|
+
var vec = create$4();
|
|
11273
11273
|
return function(a2, stride, offset, count2, fn, arg) {
|
|
11274
11274
|
var i2, l2;
|
|
11275
11275
|
if (!stride) {
|
|
@@ -11357,9 +11357,9 @@ class Vector2 extends Vector {
|
|
|
11357
11357
|
this[1] = y2;
|
|
11358
11358
|
return this.check();
|
|
11359
11359
|
}
|
|
11360
|
-
copy(
|
|
11361
|
-
this[0] =
|
|
11362
|
-
this[1] =
|
|
11360
|
+
copy(array) {
|
|
11361
|
+
this[0] = array[0];
|
|
11362
|
+
this[1] = array[1];
|
|
11363
11363
|
return this.check();
|
|
11364
11364
|
}
|
|
11365
11365
|
fromObject(object2) {
|
|
@@ -11409,7 +11409,7 @@ class Vector2 extends Vector {
|
|
|
11409
11409
|
return this.check();
|
|
11410
11410
|
}
|
|
11411
11411
|
}
|
|
11412
|
-
function create$
|
|
11412
|
+
function create$3() {
|
|
11413
11413
|
var out = new ARRAY_TYPE(3);
|
|
11414
11414
|
if (ARRAY_TYPE != Float32Array) {
|
|
11415
11415
|
out[0] = 0;
|
|
@@ -11575,7 +11575,7 @@ var mul = multiply$3;
|
|
|
11575
11575
|
var len = length$4;
|
|
11576
11576
|
var sqrLen = squaredLength$2;
|
|
11577
11577
|
(function() {
|
|
11578
|
-
var vec = create$
|
|
11578
|
+
var vec = create$3();
|
|
11579
11579
|
return function(a2, stride, offset, count2, fn, arg) {
|
|
11580
11580
|
var i2, l2;
|
|
11581
11581
|
if (!stride) {
|
|
@@ -11632,10 +11632,10 @@ class Vector3 extends Vector {
|
|
|
11632
11632
|
this[2] = z2;
|
|
11633
11633
|
return this.check();
|
|
11634
11634
|
}
|
|
11635
|
-
copy(
|
|
11636
|
-
this[0] =
|
|
11637
|
-
this[1] =
|
|
11638
|
-
this[2] =
|
|
11635
|
+
copy(array) {
|
|
11636
|
+
this[0] = array[0];
|
|
11637
|
+
this[1] = array[1];
|
|
11638
|
+
this[2] = array[2];
|
|
11639
11639
|
return this.check();
|
|
11640
11640
|
}
|
|
11641
11641
|
fromObject(object2) {
|
|
@@ -11749,11 +11749,11 @@ class Vector4 extends Vector {
|
|
|
11749
11749
|
this[3] = w2;
|
|
11750
11750
|
return this.check();
|
|
11751
11751
|
}
|
|
11752
|
-
copy(
|
|
11753
|
-
this[0] =
|
|
11754
|
-
this[1] =
|
|
11755
|
-
this[2] =
|
|
11756
|
-
this[3] =
|
|
11752
|
+
copy(array) {
|
|
11753
|
+
this[0] = array[0];
|
|
11754
|
+
this[1] = array[1];
|
|
11755
|
+
this[2] = array[2];
|
|
11756
|
+
this[3] = array[3];
|
|
11757
11757
|
return this.check();
|
|
11758
11758
|
}
|
|
11759
11759
|
fromObject(object2) {
|
|
@@ -11856,7 +11856,7 @@ class Matrix extends MathArray {
|
|
|
11856
11856
|
return this;
|
|
11857
11857
|
}
|
|
11858
11858
|
}
|
|
11859
|
-
function create$
|
|
11859
|
+
function create$2() {
|
|
11860
11860
|
var out = new ARRAY_TYPE(9);
|
|
11861
11861
|
if (ARRAY_TYPE != Float32Array) {
|
|
11862
11862
|
out[1] = 0;
|
|
@@ -12033,26 +12033,26 @@ class Matrix3 extends Matrix {
|
|
|
12033
12033
|
get INDICES() {
|
|
12034
12034
|
return INDICES$1;
|
|
12035
12035
|
}
|
|
12036
|
-
constructor(
|
|
12036
|
+
constructor(array, ...args) {
|
|
12037
12037
|
super(-0, -0, -0, -0, -0, -0, -0, -0, -0);
|
|
12038
|
-
if (arguments.length === 1 && Array.isArray(
|
|
12039
|
-
this.copy(
|
|
12038
|
+
if (arguments.length === 1 && Array.isArray(array)) {
|
|
12039
|
+
this.copy(array);
|
|
12040
12040
|
} else if (args.length > 0) {
|
|
12041
|
-
this.copy([
|
|
12041
|
+
this.copy([array, ...args]);
|
|
12042
12042
|
} else {
|
|
12043
12043
|
this.identity();
|
|
12044
12044
|
}
|
|
12045
12045
|
}
|
|
12046
|
-
copy(
|
|
12047
|
-
this[0] =
|
|
12048
|
-
this[1] =
|
|
12049
|
-
this[2] =
|
|
12050
|
-
this[3] =
|
|
12051
|
-
this[4] =
|
|
12052
|
-
this[5] =
|
|
12053
|
-
this[6] =
|
|
12054
|
-
this[7] =
|
|
12055
|
-
this[8] =
|
|
12046
|
+
copy(array) {
|
|
12047
|
+
this[0] = array[0];
|
|
12048
|
+
this[1] = array[1];
|
|
12049
|
+
this[2] = array[2];
|
|
12050
|
+
this[3] = array[3];
|
|
12051
|
+
this[4] = array[4];
|
|
12052
|
+
this[5] = array[5];
|
|
12053
|
+
this[6] = array[6];
|
|
12054
|
+
this[7] = array[7];
|
|
12055
|
+
this[8] = array[8];
|
|
12056
12056
|
return this.check();
|
|
12057
12057
|
}
|
|
12058
12058
|
identity() {
|
|
@@ -12732,7 +12732,7 @@ function equals$2(a2, b) {
|
|
|
12732
12732
|
var b12 = b[12], b13 = b[13], b14 = b[14], b15 = b[15];
|
|
12733
12733
|
return Math.abs(a0 - b0) <= EPSILON$3 * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON$3 * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a22 - b2) <= EPSILON$3 * Math.max(1, Math.abs(a22), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON$3 * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= EPSILON$3 * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= EPSILON$3 * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= EPSILON$3 * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= EPSILON$3 * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= EPSILON$3 * Math.max(1, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= EPSILON$3 * Math.max(1, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= EPSILON$3 * Math.max(1, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= EPSILON$3 * Math.max(1, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= EPSILON$3 * Math.max(1, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= EPSILON$3 * Math.max(1, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= EPSILON$3 * Math.max(1, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= EPSILON$3 * Math.max(1, Math.abs(a15), Math.abs(b15));
|
|
12734
12734
|
}
|
|
12735
|
-
function create$
|
|
12735
|
+
function create$1() {
|
|
12736
12736
|
var out = new ARRAY_TYPE(4);
|
|
12737
12737
|
if (ARRAY_TYPE != Float32Array) {
|
|
12738
12738
|
out[0] = 0;
|
|
@@ -12821,7 +12821,7 @@ function transformQuat(out, a2, q) {
|
|
|
12821
12821
|
return out;
|
|
12822
12822
|
}
|
|
12823
12823
|
(function() {
|
|
12824
|
-
var vec = create$
|
|
12824
|
+
var vec = create$1();
|
|
12825
12825
|
return function(a2, stride, offset, count2, fn, arg) {
|
|
12826
12826
|
var i2, l2;
|
|
12827
12827
|
if (!stride) {
|
|
@@ -12889,31 +12889,31 @@ class Matrix4 extends Matrix {
|
|
|
12889
12889
|
get INDICES() {
|
|
12890
12890
|
return INDICES;
|
|
12891
12891
|
}
|
|
12892
|
-
constructor(
|
|
12892
|
+
constructor(array) {
|
|
12893
12893
|
super(-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0);
|
|
12894
|
-
if (arguments.length === 1 && Array.isArray(
|
|
12895
|
-
this.copy(
|
|
12894
|
+
if (arguments.length === 1 && Array.isArray(array)) {
|
|
12895
|
+
this.copy(array);
|
|
12896
12896
|
} else {
|
|
12897
12897
|
this.identity();
|
|
12898
12898
|
}
|
|
12899
12899
|
}
|
|
12900
|
-
copy(
|
|
12901
|
-
this[0] =
|
|
12902
|
-
this[1] =
|
|
12903
|
-
this[2] =
|
|
12904
|
-
this[3] =
|
|
12905
|
-
this[4] =
|
|
12906
|
-
this[5] =
|
|
12907
|
-
this[6] =
|
|
12908
|
-
this[7] =
|
|
12909
|
-
this[8] =
|
|
12910
|
-
this[9] =
|
|
12911
|
-
this[10] =
|
|
12912
|
-
this[11] =
|
|
12913
|
-
this[12] =
|
|
12914
|
-
this[13] =
|
|
12915
|
-
this[14] =
|
|
12916
|
-
this[15] =
|
|
12900
|
+
copy(array) {
|
|
12901
|
+
this[0] = array[0];
|
|
12902
|
+
this[1] = array[1];
|
|
12903
|
+
this[2] = array[2];
|
|
12904
|
+
this[3] = array[3];
|
|
12905
|
+
this[4] = array[4];
|
|
12906
|
+
this[5] = array[5];
|
|
12907
|
+
this[6] = array[6];
|
|
12908
|
+
this[7] = array[7];
|
|
12909
|
+
this[8] = array[8];
|
|
12910
|
+
this[9] = array[9];
|
|
12911
|
+
this[10] = array[10];
|
|
12912
|
+
this[11] = array[11];
|
|
12913
|
+
this[12] = array[12];
|
|
12914
|
+
this[13] = array[13];
|
|
12915
|
+
this[14] = array[14];
|
|
12916
|
+
this[15] = array[15];
|
|
12917
12917
|
return this.check();
|
|
12918
12918
|
}
|
|
12919
12919
|
set(m00, m10, m20, m30, m01, m11, m21, m31, m02, m12, m22, m32, m03, m13, m23, m33) {
|
|
@@ -13257,7 +13257,7 @@ function computeInfinitePerspectiveOffCenter(result, left, right, bottom, top, n
|
|
|
13257
13257
|
result[15] = 0;
|
|
13258
13258
|
return result;
|
|
13259
13259
|
}
|
|
13260
|
-
function create
|
|
13260
|
+
function create() {
|
|
13261
13261
|
var out = new ARRAY_TYPE(4);
|
|
13262
13262
|
if (ARRAY_TYPE != Float32Array) {
|
|
13263
13263
|
out[0] = 0;
|
|
@@ -13409,7 +13409,7 @@ var length$2 = length$3;
|
|
|
13409
13409
|
var squaredLength = squaredLength$1;
|
|
13410
13410
|
var normalize$2 = normalize$3;
|
|
13411
13411
|
var rotationTo = function() {
|
|
13412
|
-
var tmpvec3 = create$
|
|
13412
|
+
var tmpvec3 = create$3();
|
|
13413
13413
|
var xUnitVec3 = fromValues(1, 0, 0);
|
|
13414
13414
|
var yUnitVec3 = fromValues(0, 1, 0);
|
|
13415
13415
|
return function(out, a2, b) {
|
|
@@ -13438,8 +13438,8 @@ var rotationTo = function() {
|
|
|
13438
13438
|
};
|
|
13439
13439
|
}();
|
|
13440
13440
|
(function() {
|
|
13441
|
-
var temp1 = create
|
|
13442
|
-
var temp2 = create
|
|
13441
|
+
var temp1 = create();
|
|
13442
|
+
var temp2 = create();
|
|
13443
13443
|
return function(out, a2, b, c, d, t2) {
|
|
13444
13444
|
slerp(temp1, a2, d, t2);
|
|
13445
13445
|
slerp(temp2, b, c, t2);
|
|
@@ -13448,7 +13448,7 @@ var rotationTo = function() {
|
|
|
13448
13448
|
};
|
|
13449
13449
|
})();
|
|
13450
13450
|
(function() {
|
|
13451
|
-
var matr = create$
|
|
13451
|
+
var matr = create$2();
|
|
13452
13452
|
return function(out, view, right, up) {
|
|
13453
13453
|
matr[0] = right[0];
|
|
13454
13454
|
matr[3] = right[1];
|
|
@@ -13472,11 +13472,11 @@ class Quaternion extends MathArray {
|
|
|
13472
13472
|
this.set(x2, y2, z2, w2);
|
|
13473
13473
|
}
|
|
13474
13474
|
}
|
|
13475
|
-
copy(
|
|
13476
|
-
this[0] =
|
|
13477
|
-
this[1] =
|
|
13478
|
-
this[2] =
|
|
13479
|
-
this[3] =
|
|
13475
|
+
copy(array) {
|
|
13476
|
+
this[0] = array[0];
|
|
13477
|
+
this[1] = array[1];
|
|
13478
|
+
this[2] = array[2];
|
|
13479
|
+
this[3] = array[3];
|
|
13480
13480
|
return this.check();
|
|
13481
13481
|
}
|
|
13482
13482
|
set(x2, y2, z2, w2) {
|
|
@@ -13837,11 +13837,11 @@ class Euler extends MathArray {
|
|
|
13837
13837
|
fromObject(object2) {
|
|
13838
13838
|
throw new Error("not implemented");
|
|
13839
13839
|
}
|
|
13840
|
-
copy(
|
|
13841
|
-
this[0] =
|
|
13842
|
-
this[1] =
|
|
13843
|
-
this[2] =
|
|
13844
|
-
this[3] = Number.isFinite(
|
|
13840
|
+
copy(array) {
|
|
13841
|
+
this[0] = array[0];
|
|
13842
|
+
this[1] = array[1];
|
|
13843
|
+
this[2] = array[2];
|
|
13844
|
+
this[3] = Number.isFinite(array[3]) || this.order;
|
|
13845
13845
|
return this.check();
|
|
13846
13846
|
}
|
|
13847
13847
|
set(x2 = 0, y2 = 0, z2 = 0, order) {
|
|
@@ -13854,18 +13854,18 @@ class Euler extends MathArray {
|
|
|
13854
13854
|
validate() {
|
|
13855
13855
|
return validateOrder(this[3]) && Number.isFinite(this[0]) && Number.isFinite(this[1]) && Number.isFinite(this[2]);
|
|
13856
13856
|
}
|
|
13857
|
-
toArray(
|
|
13858
|
-
|
|
13859
|
-
|
|
13860
|
-
|
|
13861
|
-
return
|
|
13857
|
+
toArray(array = [], offset = 0) {
|
|
13858
|
+
array[offset] = this[0];
|
|
13859
|
+
array[offset + 1] = this[1];
|
|
13860
|
+
array[offset + 2] = this[2];
|
|
13861
|
+
return array;
|
|
13862
13862
|
}
|
|
13863
|
-
toArray4(
|
|
13864
|
-
|
|
13865
|
-
|
|
13866
|
-
|
|
13867
|
-
|
|
13868
|
-
return
|
|
13863
|
+
toArray4(array = [], offset = 0) {
|
|
13864
|
+
array[offset] = this[0];
|
|
13865
|
+
array[offset + 1] = this[1];
|
|
13866
|
+
array[offset + 2] = this[2];
|
|
13867
|
+
array[offset + 3] = this[3];
|
|
13868
|
+
return array;
|
|
13869
13869
|
}
|
|
13870
13870
|
toVector3(result = [-0, -0, -0]) {
|
|
13871
13871
|
result[0] = this[0];
|
|
@@ -13954,12 +13954,12 @@ class Euler extends MathArray {
|
|
|
13954
13954
|
fromVector3(v, order) {
|
|
13955
13955
|
return this.set(v[0], v[1], v[2], Number.isFinite(order) ? order : this[3]);
|
|
13956
13956
|
}
|
|
13957
|
-
fromArray(
|
|
13958
|
-
this[0] =
|
|
13959
|
-
this[1] =
|
|
13960
|
-
this[2] =
|
|
13961
|
-
if (
|
|
13962
|
-
this[3] =
|
|
13957
|
+
fromArray(array, offset = 0) {
|
|
13958
|
+
this[0] = array[0 + offset];
|
|
13959
|
+
this[1] = array[1 + offset];
|
|
13960
|
+
this[2] = array[2 + offset];
|
|
13961
|
+
if (array[3] !== void 0) {
|
|
13962
|
+
this[3] = array[3];
|
|
13963
13963
|
}
|
|
13964
13964
|
return this.check();
|
|
13965
13965
|
}
|
|
@@ -15706,8 +15706,8 @@ class TextureTransform {
|
|
|
15706
15706
|
return;
|
|
15707
15707
|
}
|
|
15708
15708
|
const elementIds = new Float32Array(elementCount);
|
|
15709
|
-
elementIds.forEach((_, index2,
|
|
15710
|
-
|
|
15709
|
+
elementIds.forEach((_, index2, array) => {
|
|
15710
|
+
array[index2] = index2;
|
|
15711
15711
|
});
|
|
15712
15712
|
if (!this.elementIDBuffer) {
|
|
15713
15713
|
this.elementIDBuffer = new Buffer$3(this.gl, {
|
|
@@ -18564,11 +18564,11 @@ class TypedArrayManager {
|
|
|
18564
18564
|
const byteLength = Type2.BYTES_PER_ELEMENT * sizeToAllocate;
|
|
18565
18565
|
const i2 = pool.findIndex((b) => b.byteLength >= byteLength);
|
|
18566
18566
|
if (i2 >= 0) {
|
|
18567
|
-
const
|
|
18567
|
+
const array = new Type2(pool.splice(i2, 1)[0], 0, sizeToAllocate);
|
|
18568
18568
|
if (initialize) {
|
|
18569
|
-
|
|
18569
|
+
array.fill(0);
|
|
18570
18570
|
}
|
|
18571
|
-
return
|
|
18571
|
+
return array;
|
|
18572
18572
|
}
|
|
18573
18573
|
return new Type2(sizeToAllocate);
|
|
18574
18574
|
}
|
|
@@ -19515,16 +19515,16 @@ const COMPONENT_SYMBOL = Symbol.for("component");
|
|
|
19515
19515
|
const ASYNC_DEFAULTS_SYMBOL = Symbol.for("asyncPropDefaults");
|
|
19516
19516
|
const ASYNC_ORIGINAL_SYMBOL = Symbol.for("asyncPropOriginal");
|
|
19517
19517
|
const ASYNC_RESOLVED_SYMBOL = Symbol.for("asyncPropResolved");
|
|
19518
|
-
function flatten(
|
|
19519
|
-
if (!Array.isArray(
|
|
19520
|
-
return filter(
|
|
19518
|
+
function flatten(array, filter = () => true) {
|
|
19519
|
+
if (!Array.isArray(array)) {
|
|
19520
|
+
return filter(array) ? [array] : [];
|
|
19521
19521
|
}
|
|
19522
|
-
return flattenArray(
|
|
19522
|
+
return flattenArray(array, filter, []);
|
|
19523
19523
|
}
|
|
19524
|
-
function flattenArray(
|
|
19524
|
+
function flattenArray(array, filter, result) {
|
|
19525
19525
|
let index2 = -1;
|
|
19526
|
-
while (++index2 <
|
|
19527
|
-
const value =
|
|
19526
|
+
while (++index2 < array.length) {
|
|
19527
|
+
const value = array[index2];
|
|
19528
19528
|
if (Array.isArray(value)) {
|
|
19529
19529
|
flattenArray(value, filter, result);
|
|
19530
19530
|
} else if (filter(value)) {
|
|
@@ -19594,7 +19594,7 @@ class Resource2 {
|
|
|
19594
19594
|
const loadCount = ++this._loadCount;
|
|
19595
19595
|
let loader = data;
|
|
19596
19596
|
if (typeof data === "string") {
|
|
19597
|
-
loader = load
|
|
19597
|
+
loader = load(data);
|
|
19598
19598
|
}
|
|
19599
19599
|
if (loader instanceof Promise) {
|
|
19600
19600
|
this.isLoaded = false;
|
|
@@ -25246,9 +25246,9 @@ const MOUSE_INPUT_MAP = {
|
|
|
25246
25246
|
mousemove: INPUT_MOVE,
|
|
25247
25247
|
mouseup: INPUT_END
|
|
25248
25248
|
};
|
|
25249
|
-
function some(
|
|
25250
|
-
for (let i2 = 0; i2 <
|
|
25251
|
-
if (predict(
|
|
25249
|
+
function some(array, predict) {
|
|
25250
|
+
for (let i2 = 0; i2 < array.length; i2++) {
|
|
25251
|
+
if (predict(array[i2])) {
|
|
25252
25252
|
return true;
|
|
25253
25253
|
}
|
|
25254
25254
|
}
|
|
@@ -29534,7 +29534,7 @@ const defaultProps$L = {
|
|
|
29534
29534
|
if (!inResourceManager && !loadOptions) {
|
|
29535
29535
|
resourceManager.add({
|
|
29536
29536
|
resourceId: url,
|
|
29537
|
-
data: load
|
|
29537
|
+
data: load(url, loaders),
|
|
29538
29538
|
persistent: false
|
|
29539
29539
|
});
|
|
29540
29540
|
inResourceManager = true;
|
|
@@ -29550,7 +29550,7 @@ const defaultProps$L = {
|
|
|
29550
29550
|
requestId: propName
|
|
29551
29551
|
});
|
|
29552
29552
|
}
|
|
29553
|
-
return load
|
|
29553
|
+
return load(url, loaders, loadOptions);
|
|
29554
29554
|
},
|
|
29555
29555
|
compare: false
|
|
29556
29556
|
},
|
|
@@ -32166,7 +32166,7 @@ class IconManager {
|
|
|
32166
32166
|
const ctx = this._canvas.getContext("2d");
|
|
32167
32167
|
for (const icon of icons) {
|
|
32168
32168
|
this._pendingCount++;
|
|
32169
|
-
load
|
|
32169
|
+
load(icon.url, ImageLoader, this._loadOptions).then((imageData) => {
|
|
32170
32170
|
const id = getIconId(icon);
|
|
32171
32171
|
const {
|
|
32172
32172
|
x: x2,
|
|
@@ -40933,8 +40933,8 @@ var libh3 = function(libh32) {
|
|
|
40933
40933
|
return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
|
|
40934
40934
|
}
|
|
40935
40935
|
typeof TextDecoder !== "undefined" ? new TextDecoder("utf-16le") : void 0;
|
|
40936
|
-
function writeArrayToMemory(
|
|
40937
|
-
HEAP8.set(
|
|
40936
|
+
function writeArrayToMemory(array, buffer3) {
|
|
40937
|
+
HEAP8.set(array, buffer3);
|
|
40938
40938
|
}
|
|
40939
40939
|
function alignUp(x2, multiple) {
|
|
40940
40940
|
if (x2 % multiple > 0) {
|
|
@@ -53060,13 +53060,13 @@ function accessorToJsArray(accessor) {
|
|
|
53060
53060
|
buffer: buffer2,
|
|
53061
53061
|
byteOffset
|
|
53062
53062
|
} = accessor.bufferView.data;
|
|
53063
|
-
const
|
|
53063
|
+
const array = new ArrayType(buffer2, byteOffset + (accessor.byteOffset || 0), length2);
|
|
53064
53064
|
if (components === 1) {
|
|
53065
|
-
accessor._animation = Array.from(
|
|
53065
|
+
accessor._animation = Array.from(array);
|
|
53066
53066
|
} else {
|
|
53067
53067
|
const slicedArray = [];
|
|
53068
|
-
for (let i2 = 0; i2 <
|
|
53069
|
-
slicedArray.push(Array.from(
|
|
53068
|
+
for (let i2 = 0; i2 < array.length; i2 += components) {
|
|
53069
|
+
slicedArray.push(Array.from(array.slice(i2, i2 + components)));
|
|
53070
53070
|
}
|
|
53071
53071
|
accessor._animation = slicedArray;
|
|
53072
53072
|
}
|
|
@@ -54237,13 +54237,13 @@ class GLTFScenegraph {
|
|
|
54237
54237
|
getBuffer(index2) {
|
|
54238
54238
|
return this.getObject("buffers", index2);
|
|
54239
54239
|
}
|
|
54240
|
-
getObject(
|
|
54240
|
+
getObject(array, index2) {
|
|
54241
54241
|
if (typeof index2 === "object") {
|
|
54242
54242
|
return index2;
|
|
54243
54243
|
}
|
|
54244
|
-
const object2 = this.json[
|
|
54244
|
+
const object2 = this.json[array] && this.json[array][index2];
|
|
54245
54245
|
if (!object2) {
|
|
54246
|
-
throw new Error("glTF file error: Could not find ".concat(
|
|
54246
|
+
throw new Error("glTF file error: Could not find ".concat(array, "[").concat(index2, "]"));
|
|
54247
54247
|
}
|
|
54248
54248
|
return object2;
|
|
54249
54249
|
}
|
|
@@ -54498,12 +54498,12 @@ class GLTFScenegraph {
|
|
|
54498
54498
|
this.gltf.binary = arrayBuffer2;
|
|
54499
54499
|
this.sourceBuffers = [arrayBuffer2];
|
|
54500
54500
|
}
|
|
54501
|
-
_removeStringFromArray(
|
|
54501
|
+
_removeStringFromArray(array, string) {
|
|
54502
54502
|
let found = true;
|
|
54503
54503
|
while (found) {
|
|
54504
|
-
const index2 =
|
|
54504
|
+
const index2 = array.indexOf(string);
|
|
54505
54505
|
if (index2 > -1) {
|
|
54506
|
-
|
|
54506
|
+
array.splice(index2, 1);
|
|
54507
54507
|
} else {
|
|
54508
54508
|
found = false;
|
|
54509
54509
|
}
|
|
@@ -55084,8 +55084,8 @@ class FixedSizeList extends DataType$2 {
|
|
|
55084
55084
|
return "FixedSizeList[".concat(this.listSize, "]<").concat(this.valueType, ">");
|
|
55085
55085
|
}
|
|
55086
55086
|
}
|
|
55087
|
-
function getArrowTypeFromTypedArray(
|
|
55088
|
-
switch (
|
|
55087
|
+
function getArrowTypeFromTypedArray(array) {
|
|
55088
|
+
switch (array.constructor) {
|
|
55089
55089
|
case Int8Array:
|
|
55090
55090
|
return new Int8();
|
|
55091
55091
|
case Uint8Array:
|
|
@@ -55622,17 +55622,17 @@ function getAccessorData(attribute) {
|
|
|
55622
55622
|
count: count2
|
|
55623
55623
|
};
|
|
55624
55624
|
}
|
|
55625
|
-
function toTypedArray(
|
|
55626
|
-
if (!
|
|
55625
|
+
function toTypedArray(array, ArrayType, convertTypedArrays = false) {
|
|
55626
|
+
if (!array) {
|
|
55627
55627
|
return null;
|
|
55628
55628
|
}
|
|
55629
|
-
if (Array.isArray(
|
|
55630
|
-
return new ArrayType(
|
|
55629
|
+
if (Array.isArray(array)) {
|
|
55630
|
+
return new ArrayType(array);
|
|
55631
55631
|
}
|
|
55632
|
-
if (convertTypedArrays && !(
|
|
55633
|
-
return new ArrayType(
|
|
55632
|
+
if (convertTypedArrays && !(array instanceof ArrayType)) {
|
|
55633
|
+
return new ArrayType(array);
|
|
55634
55634
|
}
|
|
55635
|
-
return
|
|
55635
|
+
return array;
|
|
55636
55636
|
}
|
|
55637
55637
|
const KHR_DRACO_MESH_COMPRESSION = "KHR_draco_mesh_compression";
|
|
55638
55638
|
const name$3 = KHR_DRACO_MESH_COMPRESSION;
|
|
@@ -56267,13 +56267,13 @@ class GLTFPostProcessor {
|
|
|
56267
56267
|
getBuffer(index2) {
|
|
56268
56268
|
return this._get("buffers", index2);
|
|
56269
56269
|
}
|
|
56270
|
-
_get(
|
|
56270
|
+
_get(array, index2) {
|
|
56271
56271
|
if (typeof index2 === "object") {
|
|
56272
56272
|
return index2;
|
|
56273
56273
|
}
|
|
56274
|
-
const object2 = this.json[
|
|
56274
|
+
const object2 = this.json[array] && this.json[array][index2];
|
|
56275
56275
|
if (!object2) {
|
|
56276
|
-
console.warn("glTF file error: Could not find ".concat(
|
|
56276
|
+
console.warn("glTF file error: Could not find ".concat(array, "[").concat(index2, "]"));
|
|
56277
56277
|
}
|
|
56278
56278
|
return object2;
|
|
56279
56279
|
}
|
|
@@ -56685,8 +56685,8 @@ async function loadImage(gltf, image2, index2, options, context) {
|
|
|
56685
56685
|
arrayBuffer2 = await response.arrayBuffer();
|
|
56686
56686
|
}
|
|
56687
56687
|
if (Number.isFinite(image2.bufferView)) {
|
|
56688
|
-
const
|
|
56689
|
-
arrayBuffer2 = sliceArrayBuffer(
|
|
56688
|
+
const array = getTypedArrayForBufferView(gltf.json, gltf.buffers, image2.bufferView);
|
|
56689
|
+
arrayBuffer2 = sliceArrayBuffer(array.buffer, array.byteOffset, array.byteLength);
|
|
56690
56690
|
}
|
|
56691
56691
|
assert$3(arrayBuffer2, "glTF image has no data");
|
|
56692
56692
|
let parsedImage = await parse2(arrayBuffer2, [ImageLoader, BasisLoader], {
|
|
@@ -58593,7 +58593,7 @@ class TileHeader {
|
|
|
58593
58593
|
...this._getLoaderSpecificOptions(loader.id)
|
|
58594
58594
|
}
|
|
58595
58595
|
};
|
|
58596
|
-
this.content = await load
|
|
58596
|
+
this.content = await load(contentUrl, loader, options);
|
|
58597
58597
|
if (this.tileset.options.contentLoader) {
|
|
58598
58598
|
await this.tileset.options.contentLoader(this);
|
|
58599
58599
|
}
|
|
@@ -58982,7 +58982,7 @@ class I3STilesetTraverser extends TilesetTraverser {
|
|
|
58982
58982
|
loadContent: false
|
|
58983
58983
|
}
|
|
58984
58984
|
};
|
|
58985
|
-
return await load
|
|
58985
|
+
return await load(nodeUrl, loader, options);
|
|
58986
58986
|
}
|
|
58987
58987
|
_onTileLoad(header, tile, extendedId) {
|
|
58988
58988
|
const childTile = new TileHeader(tile.tileset, header, tile, extendedId);
|
|
@@ -59789,11 +59789,11 @@ class Tile3DFeatureTable {
|
|
|
59789
59789
|
}
|
|
59790
59790
|
return typedArray;
|
|
59791
59791
|
}
|
|
59792
|
-
_getTypedArrayFromArray(propertyName, componentType,
|
|
59792
|
+
_getTypedArrayFromArray(propertyName, componentType, array) {
|
|
59793
59793
|
const cachedTypedArrays = this._cachedTypedArrays;
|
|
59794
59794
|
let typedArray = cachedTypedArrays[propertyName];
|
|
59795
59795
|
if (!typedArray) {
|
|
59796
|
-
typedArray = GLType.createTypedArray(componentType,
|
|
59796
|
+
typedArray = GLType.createTypedArray(componentType, array);
|
|
59797
59797
|
cachedTypedArrays[propertyName] = typedArray;
|
|
59798
59798
|
}
|
|
59799
59799
|
return typedArray;
|
|
@@ -61049,7 +61049,7 @@ async function parseImplicitTiles(params) {
|
|
|
61049
61049
|
if (isChildSubtreeAvailable) {
|
|
61050
61050
|
const subtreePath = "".concat(basePath, "/").concat(subtreesUriTemplate);
|
|
61051
61051
|
const childSubtreeUrl = replaceContentUrlTemplate(subtreePath, lev, x2, y2, z2);
|
|
61052
|
-
const childSubtree = await load
|
|
61052
|
+
const childSubtree = await load(childSubtreeUrl, Tile3DSubtreeLoader);
|
|
61053
61053
|
subtree = childSubtree;
|
|
61054
61054
|
globalData.mortonIndex = childTileMortonIndex;
|
|
61055
61055
|
globalData.x = childTileX;
|
|
@@ -61272,7 +61272,7 @@ async function normalizeImplicitTileHeaders(tileset) {
|
|
|
61272
61272
|
} = implicitTilingExtension;
|
|
61273
61273
|
const subtreeUrl = replaceContentUrlTemplate(subtreesUriTemplate, 0, 0, 0, 0);
|
|
61274
61274
|
const rootSubtreeUrl = resolveUri(subtreeUrl, basePath);
|
|
61275
|
-
const rootSubtree = await load
|
|
61275
|
+
const rootSubtree = await load(rootSubtreeUrl, Tile3DSubtreeLoader);
|
|
61276
61276
|
const contentUrlTemplate = resolveUri(tileset.root.content.uri, basePath);
|
|
61277
61277
|
const refine = tileset.root.refine;
|
|
61278
61278
|
const rootLodMetricValue = tileset.root.geometricError;
|
|
@@ -61546,7 +61546,7 @@ class Tile3DLayer extends CompositeLayer {
|
|
|
61546
61546
|
}
|
|
61547
61547
|
Object.assign(options, preloadOptions);
|
|
61548
61548
|
}
|
|
61549
|
-
const tilesetJson = await load
|
|
61549
|
+
const tilesetJson = await load(tilesetUrl, loader, options.loadOptions);
|
|
61550
61550
|
const tileset3d = new Tileset3D(tilesetJson, {
|
|
61551
61551
|
onTileLoad: this._onTileLoad.bind(this),
|
|
61552
61552
|
onTileUnload: this._onTileUnload.bind(this),
|
|
@@ -64867,9 +64867,9 @@ function getGlobalFeatureId(geomData, featureIndex) {
|
|
|
64867
64867
|
}
|
|
64868
64868
|
return geomData.__ids[featureIndex];
|
|
64869
64869
|
}
|
|
64870
|
-
function findIndex(
|
|
64870
|
+
function findIndex(array, predicate, startIndex, endIndex) {
|
|
64871
64871
|
for (let i2 = startIndex; i2 < endIndex; i2++) {
|
|
64872
|
-
if (predicate(
|
|
64872
|
+
if (predicate(array[i2], i2)) {
|
|
64873
64873
|
return i2;
|
|
64874
64874
|
}
|
|
64875
64875
|
}
|
|
@@ -68778,7 +68778,7 @@ function bearing(start, end, options) {
|
|
|
68778
68778
|
var b = Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon2 - lon1);
|
|
68779
68779
|
return helpers_1$g.radiansToDegrees(Math.atan2(a2, b));
|
|
68780
68780
|
}
|
|
68781
|
-
var _default$
|
|
68781
|
+
var _default$4 = js$s.default = bearing;
|
|
68782
68782
|
function calculateFinalBearing(start, end) {
|
|
68783
68783
|
var bear = bearing(end, start);
|
|
68784
68784
|
bear = (bear + 180) % 360;
|
|
@@ -68801,7 +68801,7 @@ function distance$1(from, to, options) {
|
|
|
68801
68801
|
var a2 = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
|
|
68802
68802
|
return helpers_1$f.radiansToLength(2 * Math.atan2(Math.sqrt(a2), Math.sqrt(1 - a2)), options.units);
|
|
68803
68803
|
}
|
|
68804
|
-
var _default$
|
|
68804
|
+
var _default$2 = js$q.default = distance$1;
|
|
68805
68805
|
var js$p = {};
|
|
68806
68806
|
Object.defineProperty(js$p, "__esModule", { value: true });
|
|
68807
68807
|
var helpers_1$e = js$u;
|
|
@@ -68821,7 +68821,7 @@ function destination(origin, distance2, bearing2, options) {
|
|
|
68821
68821
|
var lat = helpers_1$e.radiansToDegrees(latitude2);
|
|
68822
68822
|
return helpers_1$e.point([lng, lat], options.properties);
|
|
68823
68823
|
}
|
|
68824
|
-
var _default$
|
|
68824
|
+
var _default$1 = js$p.default = destination;
|
|
68825
68825
|
var js$o = {};
|
|
68826
68826
|
const require$$0$5 = /* @__PURE__ */ getAugmentedNamespace(es$2);
|
|
68827
68827
|
const require$$2$3 = /* @__PURE__ */ getAugmentedNamespace(es);
|
|
@@ -68902,7 +68902,7 @@ function intersects$4(line1, line2) {
|
|
|
68902
68902
|
}
|
|
68903
68903
|
return null;
|
|
68904
68904
|
}
|
|
68905
|
-
var _default
|
|
68905
|
+
var _default = js$o.default = lineIntersect$1;
|
|
68906
68906
|
function nearestPointOnLine$2(lines, pt, options) {
|
|
68907
68907
|
if (options === void 0) {
|
|
68908
68908
|
options = {};
|
|
@@ -68915,23 +68915,23 @@ function nearestPointOnLine$2(lines, pt, options) {
|
|
|
68915
68915
|
var coords = getCoords_1(line);
|
|
68916
68916
|
for (var i2 = 0; i2 < coords.length - 1; i2++) {
|
|
68917
68917
|
var start = js$u.point(coords[i2]);
|
|
68918
|
-
start.properties.dist = _default$
|
|
68918
|
+
start.properties.dist = _default$2(pt, start, options);
|
|
68919
68919
|
var stop_1 = js$u.point(coords[i2 + 1]);
|
|
68920
|
-
stop_1.properties.dist = _default$
|
|
68921
|
-
var sectionLength = _default$
|
|
68920
|
+
stop_1.properties.dist = _default$2(pt, stop_1, options);
|
|
68921
|
+
var sectionLength = _default$2(start, stop_1, options);
|
|
68922
68922
|
var heightDistance = Math.max(start.properties.dist, stop_1.properties.dist);
|
|
68923
|
-
var direction = _default$
|
|
68924
|
-
var perpendicularPt1 = _default$
|
|
68925
|
-
var perpendicularPt2 = _default$
|
|
68926
|
-
var intersect2 = _default
|
|
68923
|
+
var direction = _default$4(start, stop_1);
|
|
68924
|
+
var perpendicularPt1 = _default$1(pt, heightDistance, direction + 90, options);
|
|
68925
|
+
var perpendicularPt2 = _default$1(pt, heightDistance, direction - 90, options);
|
|
68926
|
+
var intersect2 = _default(js$u.lineString([
|
|
68927
68927
|
perpendicularPt1.geometry.coordinates,
|
|
68928
68928
|
perpendicularPt2.geometry.coordinates
|
|
68929
68929
|
]), js$u.lineString([start.geometry.coordinates, stop_1.geometry.coordinates]));
|
|
68930
68930
|
var intersectPt = null;
|
|
68931
68931
|
if (intersect2.features.length > 0) {
|
|
68932
68932
|
intersectPt = intersect2.features[0];
|
|
68933
|
-
intersectPt.properties.dist = _default$
|
|
68934
|
-
intersectPt.properties.location = length2 + _default$
|
|
68933
|
+
intersectPt.properties.dist = _default$2(pt, intersectPt, options);
|
|
68934
|
+
intersectPt.properties.location = length2 + _default$2(start, intersectPt, options);
|
|
68935
68935
|
}
|
|
68936
68936
|
if (start.properties.dist < closestPt.properties.dist) {
|
|
68937
68937
|
closestPt = start;
|
|
@@ -81197,16 +81197,16 @@ function clipPolygon(segments, compareIntersection2, startInside, interpolate2,
|
|
|
81197
81197
|
stream.lineEnd();
|
|
81198
81198
|
}
|
|
81199
81199
|
}
|
|
81200
|
-
function link(
|
|
81201
|
-
if (!(n2 =
|
|
81200
|
+
function link(array) {
|
|
81201
|
+
if (!(n2 = array.length))
|
|
81202
81202
|
return;
|
|
81203
|
-
var n2, i2 = 0, a2 =
|
|
81203
|
+
var n2, i2 = 0, a2 = array[0], b;
|
|
81204
81204
|
while (++i2 < n2) {
|
|
81205
|
-
a2.n = b =
|
|
81205
|
+
a2.n = b = array[i2];
|
|
81206
81206
|
b.p = a2;
|
|
81207
81207
|
a2 = b;
|
|
81208
81208
|
}
|
|
81209
|
-
a2.n = b =
|
|
81209
|
+
a2.n = b = array[0];
|
|
81210
81210
|
b.p = a2;
|
|
81211
81211
|
}
|
|
81212
81212
|
function ascending(a2, b) {
|
|
@@ -81261,15 +81261,15 @@ function range$4(start, stop, step) {
|
|
|
81261
81261
|
return range2;
|
|
81262
81262
|
}
|
|
81263
81263
|
function merge(arrays) {
|
|
81264
|
-
var n2 = arrays.length, m, i2 = -1, j = 0, merged,
|
|
81264
|
+
var n2 = arrays.length, m, i2 = -1, j = 0, merged, array;
|
|
81265
81265
|
while (++i2 < n2)
|
|
81266
81266
|
j += arrays[i2].length;
|
|
81267
81267
|
merged = new Array(j);
|
|
81268
81268
|
while (--n2 >= 0) {
|
|
81269
|
-
|
|
81270
|
-
m =
|
|
81269
|
+
array = arrays[n2];
|
|
81270
|
+
m = array.length;
|
|
81271
81271
|
while (--m >= 0) {
|
|
81272
|
-
merged[--j] =
|
|
81272
|
+
merged[--j] = array[m];
|
|
81273
81273
|
}
|
|
81274
81274
|
}
|
|
81275
81275
|
return merged;
|
|
@@ -86922,13 +86922,13 @@ function toDeckColor$2(color) {
|
|
|
86922
86922
|
}
|
|
86923
86923
|
return [color[0] * 255, color[1] * 255, color[2] * 255, color[3] * 255];
|
|
86924
86924
|
}
|
|
86925
|
-
function recursivelyTraverseNestedArrays$2(
|
|
86926
|
-
if (!Array.isArray(
|
|
86925
|
+
function recursivelyTraverseNestedArrays$2(array, prefix, fn) {
|
|
86926
|
+
if (!Array.isArray(array[0])) {
|
|
86927
86927
|
return true;
|
|
86928
86928
|
}
|
|
86929
|
-
for (var i2 = 0; i2 <
|
|
86930
|
-
if (recursivelyTraverseNestedArrays$2(
|
|
86931
|
-
fn(
|
|
86929
|
+
for (var i2 = 0; i2 < array.length; i2++) {
|
|
86930
|
+
if (recursivelyTraverseNestedArrays$2(array[i2], [].concat(_toConsumableArray$h(prefix), [i2]), fn)) {
|
|
86931
|
+
fn(array, prefix);
|
|
86932
86932
|
break;
|
|
86933
86933
|
}
|
|
86934
86934
|
}
|
|
@@ -100236,13 +100236,13 @@ function toDeckColor$1(color) {
|
|
|
100236
100236
|
}
|
|
100237
100237
|
return [color[0] * 255, color[1] * 255, color[2] * 255, color[3] * 255];
|
|
100238
100238
|
}
|
|
100239
|
-
function recursivelyTraverseNestedArrays$1(
|
|
100240
|
-
if (!Array.isArray(
|
|
100239
|
+
function recursivelyTraverseNestedArrays$1(array, prefix, fn) {
|
|
100240
|
+
if (!Array.isArray(array[0])) {
|
|
100241
100241
|
return true;
|
|
100242
100242
|
}
|
|
100243
|
-
for (var i2 = 0; i2 <
|
|
100244
|
-
if (recursivelyTraverseNestedArrays$1(
|
|
100245
|
-
fn(
|
|
100243
|
+
for (var i2 = 0; i2 < array.length; i2++) {
|
|
100244
|
+
if (recursivelyTraverseNestedArrays$1(array[i2], [].concat(_toConsumableArray$1(prefix), [i2]), fn)) {
|
|
100245
|
+
fn(array, prefix);
|
|
100246
100246
|
break;
|
|
100247
100247
|
}
|
|
100248
100248
|
}
|
|
@@ -100451,13 +100451,13 @@ function toDeckColor(color) {
|
|
|
100451
100451
|
}
|
|
100452
100452
|
return [color[0] * 255, color[1] * 255, color[2] * 255, color[3] * 255];
|
|
100453
100453
|
}
|
|
100454
|
-
function recursivelyTraverseNestedArrays(
|
|
100455
|
-
if (!Array.isArray(
|
|
100454
|
+
function recursivelyTraverseNestedArrays(array, prefix, fn) {
|
|
100455
|
+
if (!Array.isArray(array[0])) {
|
|
100456
100456
|
return true;
|
|
100457
100457
|
}
|
|
100458
|
-
for (var i2 = 0; i2 <
|
|
100459
|
-
if (recursivelyTraverseNestedArrays(
|
|
100460
|
-
fn(
|
|
100458
|
+
for (var i2 = 0; i2 < array.length; i2++) {
|
|
100459
|
+
if (recursivelyTraverseNestedArrays(array[i2], [].concat(_toConsumableArray(prefix), [i2]), fn)) {
|
|
100460
|
+
fn(array, prefix);
|
|
100461
100461
|
break;
|
|
100462
100462
|
}
|
|
100463
100463
|
}
|
|
@@ -103333,12 +103333,12 @@ const SafeIteratorPrototype = ObjectCreate(null, {
|
|
|
103333
103333
|
}
|
|
103334
103334
|
}
|
|
103335
103335
|
});
|
|
103336
|
-
function safeIfNeeded(
|
|
103337
|
-
if (
|
|
103338
|
-
return
|
|
103336
|
+
function safeIfNeeded(array) {
|
|
103337
|
+
if (array[SymbolIterator] === NativeArrayPrototypeSymbolIterator) {
|
|
103338
|
+
return array;
|
|
103339
103339
|
}
|
|
103340
103340
|
const safe = ObjectCreate(SafeIteratorPrototype);
|
|
103341
|
-
WeakMapPrototypeSet(arrayIterators, safe, ArrayPrototypeSymbolIterator(
|
|
103341
|
+
WeakMapPrototypeSet(arrayIterators, safe, ArrayPrototypeSymbolIterator(array));
|
|
103342
103342
|
return safe;
|
|
103343
103343
|
}
|
|
103344
103344
|
const generators = new NativeWeakMap();
|
|
@@ -103903,29 +103903,29 @@ async function getDecoder(fileDirectory) {
|
|
|
103903
103903
|
const Decoder = await importFn();
|
|
103904
103904
|
return new Decoder(fileDirectory);
|
|
103905
103905
|
}
|
|
103906
|
-
addDecoder([void 0, 1], () => import("./raw-
|
|
103907
|
-
addDecoder(5, () => import("./lzw-
|
|
103906
|
+
addDecoder([void 0, 1], () => import("./raw-df5c07c8.js").then((m) => m.default));
|
|
103907
|
+
addDecoder(5, () => import("./lzw-984a6040.js").then((m) => m.default));
|
|
103908
103908
|
addDecoder(6, () => {
|
|
103909
103909
|
throw new Error("old style JPEG compression is not supported.");
|
|
103910
103910
|
});
|
|
103911
|
-
addDecoder(7, () => import("./jpeg-
|
|
103912
|
-
addDecoder([8, 32946], () => import("./deflate-
|
|
103913
|
-
addDecoder(32773, () => import("./packbits-
|
|
103914
|
-
addDecoder(34887, () => import("./lerc-
|
|
103915
|
-
addDecoder(50001, () => import("./webimage-
|
|
103916
|
-
function copyNewSize(
|
|
103917
|
-
return new (Object.getPrototypeOf(
|
|
103911
|
+
addDecoder(7, () => import("./jpeg-29bf61b4.js").then((m) => m.default));
|
|
103912
|
+
addDecoder([8, 32946], () => import("./deflate-27838921.js").then((m) => m.default));
|
|
103913
|
+
addDecoder(32773, () => import("./packbits-d5887f3d.js").then((m) => m.default));
|
|
103914
|
+
addDecoder(34887, () => import("./lerc-64265216.js").then((m) => m.default));
|
|
103915
|
+
addDecoder(50001, () => import("./webimage-a12c8ff6.js").then((m) => m.default));
|
|
103916
|
+
function copyNewSize(array, width, height, samplesPerPixel = 1) {
|
|
103917
|
+
return new (Object.getPrototypeOf(array)).constructor(width * height * samplesPerPixel);
|
|
103918
103918
|
}
|
|
103919
103919
|
function resampleNearest(valueArrays, inWidth, inHeight, outWidth, outHeight) {
|
|
103920
103920
|
const relX = inWidth / outWidth;
|
|
103921
103921
|
const relY = inHeight / outHeight;
|
|
103922
|
-
return valueArrays.map((
|
|
103923
|
-
const newArray = copyNewSize(
|
|
103922
|
+
return valueArrays.map((array) => {
|
|
103923
|
+
const newArray = copyNewSize(array, outWidth, outHeight);
|
|
103924
103924
|
for (let y2 = 0; y2 < outHeight; ++y2) {
|
|
103925
103925
|
const cy = Math.min(Math.round(relY * y2), inHeight - 1);
|
|
103926
103926
|
for (let x2 = 0; x2 < outWidth; ++x2) {
|
|
103927
103927
|
const cx = Math.min(Math.round(relX * x2), inWidth - 1);
|
|
103928
|
-
const value =
|
|
103928
|
+
const value = array[cy * inWidth + cx];
|
|
103929
103929
|
newArray[y2 * outWidth + x2] = value;
|
|
103930
103930
|
}
|
|
103931
103931
|
}
|
|
@@ -103938,8 +103938,8 @@ function lerp(v0, v12, t2) {
|
|
|
103938
103938
|
function resampleBilinear(valueArrays, inWidth, inHeight, outWidth, outHeight) {
|
|
103939
103939
|
const relX = inWidth / outWidth;
|
|
103940
103940
|
const relY = inHeight / outHeight;
|
|
103941
|
-
return valueArrays.map((
|
|
103942
|
-
const newArray = copyNewSize(
|
|
103941
|
+
return valueArrays.map((array) => {
|
|
103942
|
+
const newArray = copyNewSize(array, outWidth, outHeight);
|
|
103943
103943
|
for (let y2 = 0; y2 < outHeight; ++y2) {
|
|
103944
103944
|
const rawY = relY * y2;
|
|
103945
103945
|
const yl = Math.floor(rawY);
|
|
@@ -103949,10 +103949,10 @@ function resampleBilinear(valueArrays, inWidth, inHeight, outWidth, outHeight) {
|
|
|
103949
103949
|
const tx = rawX % 1;
|
|
103950
103950
|
const xl = Math.floor(rawX);
|
|
103951
103951
|
const xh = Math.min(Math.ceil(rawX), inWidth - 1);
|
|
103952
|
-
const ll =
|
|
103953
|
-
const hl =
|
|
103954
|
-
const lh =
|
|
103955
|
-
const hh =
|
|
103952
|
+
const ll = array[yl * inWidth + xl];
|
|
103953
|
+
const hl = array[yl * inWidth + xh];
|
|
103954
|
+
const lh = array[yh * inWidth + xl];
|
|
103955
|
+
const hh = array[yh * inWidth + xh];
|
|
103956
103956
|
const value = lerp(
|
|
103957
103957
|
lerp(ll, hl, tx),
|
|
103958
103958
|
lerp(lh, hh, tx),
|
|
@@ -104045,10 +104045,10 @@ function resampleInterleaved(valueArray2, inWidth, inHeight, outWidth, outHeight
|
|
|
104045
104045
|
throw new Error(`Unsupported resampling method: '${method}'`);
|
|
104046
104046
|
}
|
|
104047
104047
|
}
|
|
104048
|
-
function sum(
|
|
104048
|
+
function sum(array, start, end) {
|
|
104049
104049
|
let s2 = 0;
|
|
104050
104050
|
for (let i2 = start; i2 < end; ++i2) {
|
|
104051
|
-
s2 +=
|
|
104051
|
+
s2 += array[i2];
|
|
104052
104052
|
}
|
|
104053
104053
|
return s2;
|
|
104054
104054
|
}
|
|
@@ -107970,77 +107970,6 @@ const registry = /* @__PURE__ */ new Map();
|
|
|
107970
107970
|
function addCodec(id, importFn) {
|
|
107971
107971
|
registry.set(id, importFn);
|
|
107972
107972
|
}
|
|
107973
|
-
async function getCodec(config2) {
|
|
107974
|
-
if (!registry.has(config2.id)) {
|
|
107975
|
-
throw new Error(`Compression codec ${config2.id} is not supported by Zarr.js yet.`);
|
|
107976
|
-
}
|
|
107977
|
-
const codec = await registry.get(config2.id)();
|
|
107978
|
-
return codec.fromConfig(config2);
|
|
107979
|
-
}
|
|
107980
|
-
function createProxy(mapping) {
|
|
107981
|
-
return new Proxy(mapping, {
|
|
107982
|
-
set(target, key, value, _receiver) {
|
|
107983
|
-
return target.setItem(key, value);
|
|
107984
|
-
},
|
|
107985
|
-
get(target, key, _receiver) {
|
|
107986
|
-
return target.getItem(key);
|
|
107987
|
-
},
|
|
107988
|
-
deleteProperty(target, key) {
|
|
107989
|
-
return target.deleteItem(key);
|
|
107990
|
-
},
|
|
107991
|
-
has(target, key) {
|
|
107992
|
-
return target.containsItem(key);
|
|
107993
|
-
}
|
|
107994
|
-
});
|
|
107995
|
-
}
|
|
107996
|
-
function isZarrError(err2) {
|
|
107997
|
-
return typeof err2 === "object" && err2 !== null && "__zarr__" in err2;
|
|
107998
|
-
}
|
|
107999
|
-
function isKeyError(o2) {
|
|
108000
|
-
return isZarrError(o2) && o2.__zarr__ === "KeyError";
|
|
108001
|
-
}
|
|
108002
|
-
class ContainsArrayError extends Error {
|
|
108003
|
-
constructor(path) {
|
|
108004
|
-
super(`path ${path} contains an array`);
|
|
108005
|
-
this.__zarr__ = "ContainsArrayError";
|
|
108006
|
-
Object.setPrototypeOf(this, ContainsArrayError.prototype);
|
|
108007
|
-
}
|
|
108008
|
-
}
|
|
108009
|
-
class ContainsGroupError extends Error {
|
|
108010
|
-
constructor(path) {
|
|
108011
|
-
super(`path ${path} contains a group`);
|
|
108012
|
-
this.__zarr__ = "ContainsGroupError";
|
|
108013
|
-
Object.setPrototypeOf(this, ContainsGroupError.prototype);
|
|
108014
|
-
}
|
|
108015
|
-
}
|
|
108016
|
-
class GroupNotFoundError extends Error {
|
|
108017
|
-
constructor(path) {
|
|
108018
|
-
super(`ground not found at path ${path}`);
|
|
108019
|
-
this.__zarr__ = "GroupNotFoundError";
|
|
108020
|
-
Object.setPrototypeOf(this, GroupNotFoundError.prototype);
|
|
108021
|
-
}
|
|
108022
|
-
}
|
|
108023
|
-
class PermissionError extends Error {
|
|
108024
|
-
constructor(message) {
|
|
108025
|
-
super(message);
|
|
108026
|
-
this.__zarr__ = "PermissionError";
|
|
108027
|
-
Object.setPrototypeOf(this, PermissionError.prototype);
|
|
108028
|
-
}
|
|
108029
|
-
}
|
|
108030
|
-
class KeyError extends Error {
|
|
108031
|
-
constructor(key) {
|
|
108032
|
-
super(`key ${key} not present`);
|
|
108033
|
-
this.__zarr__ = "KeyError";
|
|
108034
|
-
Object.setPrototypeOf(this, KeyError.prototype);
|
|
108035
|
-
}
|
|
108036
|
-
}
|
|
108037
|
-
class TooManyIndicesError extends RangeError {
|
|
108038
|
-
constructor(selection, shape) {
|
|
108039
|
-
super(`too many indices for array; expected ${shape.length}, got ${selection.length}`);
|
|
108040
|
-
this.__zarr__ = "TooManyIndicesError";
|
|
108041
|
-
Object.setPrototypeOf(this, TooManyIndicesError.prototype);
|
|
108042
|
-
}
|
|
108043
|
-
}
|
|
108044
107973
|
class BoundsCheckError extends RangeError {
|
|
108045
107974
|
constructor(message) {
|
|
108046
107975
|
super(message);
|
|
@@ -108055,27 +107984,6 @@ class InvalidSliceError extends RangeError {
|
|
|
108055
107984
|
Object.setPrototypeOf(this, InvalidSliceError.prototype);
|
|
108056
107985
|
}
|
|
108057
107986
|
}
|
|
108058
|
-
class NegativeStepError extends Error {
|
|
108059
|
-
constructor() {
|
|
108060
|
-
super(`Negative step size is not supported when indexing.`);
|
|
108061
|
-
this.__zarr__ = "NegativeStepError";
|
|
108062
|
-
Object.setPrototypeOf(this, NegativeStepError.prototype);
|
|
108063
|
-
}
|
|
108064
|
-
}
|
|
108065
|
-
class ValueError extends Error {
|
|
108066
|
-
constructor(message) {
|
|
108067
|
-
super(message);
|
|
108068
|
-
this.__zarr__ = "ValueError";
|
|
108069
|
-
Object.setPrototypeOf(this, ValueError.prototype);
|
|
108070
|
-
}
|
|
108071
|
-
}
|
|
108072
|
-
class HTTPError extends Error {
|
|
108073
|
-
constructor(code) {
|
|
108074
|
-
super(code);
|
|
108075
|
-
this.__zarr__ = "HTTPError";
|
|
108076
|
-
Object.setPrototypeOf(this, HTTPError.prototype);
|
|
108077
|
-
}
|
|
108078
|
-
}
|
|
108079
107987
|
function slice(start, stop = void 0, step = null) {
|
|
108080
107988
|
if (start === void 0) {
|
|
108081
107989
|
throw new InvalidSliceError(start, stop, step, "The first argument must not be undefined");
|
|
@@ -108094,1125 +108002,12 @@ function slice(start, stop = void 0, step = null) {
|
|
|
108094
108002
|
_slice: true
|
|
108095
108003
|
};
|
|
108096
108004
|
}
|
|
108097
|
-
|
|
108098
|
-
if (start < 0) {
|
|
108099
|
-
start += length2;
|
|
108100
|
-
if (start < 0) {
|
|
108101
|
-
start = step < 0 ? -1 : 0;
|
|
108102
|
-
}
|
|
108103
|
-
} else if (start >= length2) {
|
|
108104
|
-
start = step < 0 ? length2 - 1 : length2;
|
|
108105
|
-
}
|
|
108106
|
-
if (stop < 0) {
|
|
108107
|
-
stop += length2;
|
|
108108
|
-
if (stop < 0) {
|
|
108109
|
-
stop = step < 0 ? -1 : 0;
|
|
108110
|
-
}
|
|
108111
|
-
} else if (stop >= length2) {
|
|
108112
|
-
stop = step < 0 ? length2 - 1 : length2;
|
|
108113
|
-
}
|
|
108114
|
-
if (step < 0) {
|
|
108115
|
-
if (stop < start) {
|
|
108116
|
-
const length3 = Math.floor((start - stop - 1) / -step + 1);
|
|
108117
|
-
return [start, stop, step, length3];
|
|
108118
|
-
}
|
|
108119
|
-
} else {
|
|
108120
|
-
if (start < stop) {
|
|
108121
|
-
const length3 = Math.floor((stop - start - 1) / step + 1);
|
|
108122
|
-
return [start, stop, step, length3];
|
|
108123
|
-
}
|
|
108124
|
-
}
|
|
108125
|
-
return [start, stop, step, 0];
|
|
108126
|
-
}
|
|
108127
|
-
function sliceIndices(slice2, length2) {
|
|
108128
|
-
let start;
|
|
108129
|
-
let stop;
|
|
108130
|
-
let step;
|
|
108131
|
-
if (slice2.step === null) {
|
|
108132
|
-
step = 1;
|
|
108133
|
-
} else {
|
|
108134
|
-
step = slice2.step;
|
|
108135
|
-
}
|
|
108136
|
-
if (slice2.start === null) {
|
|
108137
|
-
start = step < 0 ? Number.MAX_SAFE_INTEGER : 0;
|
|
108138
|
-
} else {
|
|
108139
|
-
start = slice2.start;
|
|
108140
|
-
if (start < 0) {
|
|
108141
|
-
start += length2;
|
|
108142
|
-
}
|
|
108143
|
-
}
|
|
108144
|
-
if (slice2.stop === null) {
|
|
108145
|
-
stop = step < 0 ? -Number.MAX_SAFE_INTEGER : Number.MAX_SAFE_INTEGER;
|
|
108146
|
-
} else {
|
|
108147
|
-
stop = slice2.stop;
|
|
108148
|
-
if (stop < 0) {
|
|
108149
|
-
stop += length2;
|
|
108150
|
-
}
|
|
108151
|
-
}
|
|
108152
|
-
const s2 = adjustIndices(start, stop, step, length2);
|
|
108153
|
-
start = s2[0];
|
|
108154
|
-
stop = s2[1];
|
|
108155
|
-
step = s2[2];
|
|
108156
|
-
length2 = s2[3];
|
|
108157
|
-
if (step === 0)
|
|
108158
|
-
throw new Error("Step size 0 is invalid");
|
|
108159
|
-
return [start, stop, step, length2];
|
|
108160
|
-
}
|
|
108161
|
-
function ensureArray$1(selection) {
|
|
108162
|
-
if (!Array.isArray(selection)) {
|
|
108163
|
-
return [selection];
|
|
108164
|
-
}
|
|
108165
|
-
return selection;
|
|
108166
|
-
}
|
|
108167
|
-
function checkSelectionLength(selection, shape) {
|
|
108168
|
-
if (selection.length > shape.length) {
|
|
108169
|
-
throw new TooManyIndicesError(selection, shape);
|
|
108170
|
-
}
|
|
108171
|
-
}
|
|
108172
|
-
function selectionToSliceIndices(selection, shape) {
|
|
108173
|
-
const sliceIndicesResult = [];
|
|
108174
|
-
const outShape = [];
|
|
108175
|
-
for (let i2 = 0; i2 < selection.length; i2++) {
|
|
108176
|
-
const s2 = selection[i2];
|
|
108177
|
-
if (typeof s2 === "number") {
|
|
108178
|
-
sliceIndicesResult.push(s2);
|
|
108179
|
-
} else {
|
|
108180
|
-
const x2 = sliceIndices(s2, shape[i2]);
|
|
108181
|
-
const dimLength = x2[3];
|
|
108182
|
-
outShape.push(dimLength);
|
|
108183
|
-
sliceIndicesResult.push(x2);
|
|
108184
|
-
}
|
|
108185
|
-
}
|
|
108186
|
-
return [sliceIndicesResult, outShape];
|
|
108187
|
-
}
|
|
108188
|
-
function normalizeArraySelection(selection, shape, convertIntegerSelectionToSlices = false) {
|
|
108189
|
-
selection = replaceEllipsis(selection, shape);
|
|
108190
|
-
for (let i2 = 0; i2 < selection.length; i2++) {
|
|
108191
|
-
const dimSelection = selection[i2];
|
|
108192
|
-
if (typeof dimSelection === "number") {
|
|
108193
|
-
if (convertIntegerSelectionToSlices) {
|
|
108194
|
-
selection[i2] = slice(dimSelection, dimSelection + 1, 1);
|
|
108195
|
-
} else {
|
|
108196
|
-
selection[i2] = normalizeIntegerSelection(dimSelection, shape[i2]);
|
|
108197
|
-
}
|
|
108198
|
-
} else if (isIntegerArray(dimSelection)) {
|
|
108199
|
-
throw new TypeError("Integer array selections are not supported (yet)");
|
|
108200
|
-
} else if (dimSelection === ":" || dimSelection === null) {
|
|
108201
|
-
selection[i2] = slice(null, null, 1);
|
|
108202
|
-
}
|
|
108203
|
-
}
|
|
108204
|
-
return selection;
|
|
108205
|
-
}
|
|
108206
|
-
function replaceEllipsis(selection, shape) {
|
|
108207
|
-
selection = ensureArray$1(selection);
|
|
108208
|
-
let ellipsisIndex = -1;
|
|
108209
|
-
let numEllipsis = 0;
|
|
108210
|
-
for (let i2 = 0; i2 < selection.length; i2++) {
|
|
108211
|
-
if (selection[i2] === "...") {
|
|
108212
|
-
ellipsisIndex = i2;
|
|
108213
|
-
numEllipsis += 1;
|
|
108214
|
-
}
|
|
108215
|
-
}
|
|
108216
|
-
if (numEllipsis > 1) {
|
|
108217
|
-
throw new RangeError("an index can only have a single ellipsis ('...')");
|
|
108218
|
-
}
|
|
108219
|
-
if (numEllipsis === 1) {
|
|
108220
|
-
const numItemsLeft = ellipsisIndex;
|
|
108221
|
-
const numItemsRight = selection.length - (numItemsLeft + 1);
|
|
108222
|
-
const numItems = selection.length - 1;
|
|
108223
|
-
if (numItems >= shape.length) {
|
|
108224
|
-
selection = selection.filter((x2) => x2 !== "...");
|
|
108225
|
-
} else {
|
|
108226
|
-
const numNewItems = shape.length - numItems;
|
|
108227
|
-
let newItem = selection.slice(0, numItemsLeft).concat(new Array(numNewItems).fill(null));
|
|
108228
|
-
if (numItemsRight > 0) {
|
|
108229
|
-
newItem = newItem.concat(selection.slice(selection.length - numItemsRight));
|
|
108230
|
-
}
|
|
108231
|
-
selection = newItem;
|
|
108232
|
-
}
|
|
108233
|
-
}
|
|
108234
|
-
if (selection.length < shape.length) {
|
|
108235
|
-
const numMissing = shape.length - selection.length;
|
|
108236
|
-
selection = selection.concat(new Array(numMissing).fill(null));
|
|
108237
|
-
}
|
|
108238
|
-
checkSelectionLength(selection, shape);
|
|
108239
|
-
return selection;
|
|
108240
|
-
}
|
|
108241
|
-
function normalizeIntegerSelection(dimSelection, dimLength) {
|
|
108242
|
-
if (dimSelection < 0) {
|
|
108243
|
-
dimSelection = dimLength + dimSelection;
|
|
108244
|
-
}
|
|
108245
|
-
if (dimSelection >= dimLength || dimSelection < 0) {
|
|
108246
|
-
throw new BoundsCheckError(`index out of bounds for dimension with length ${dimLength}`);
|
|
108247
|
-
}
|
|
108248
|
-
return dimSelection;
|
|
108249
|
-
}
|
|
108250
|
-
function isInteger(s2) {
|
|
108251
|
-
return typeof s2 === "number";
|
|
108252
|
-
}
|
|
108253
|
-
function isIntegerArray(s2) {
|
|
108254
|
-
if (!Array.isArray(s2)) {
|
|
108255
|
-
return false;
|
|
108256
|
-
}
|
|
108257
|
-
for (const e2 of s2) {
|
|
108258
|
-
if (typeof e2 !== "number") {
|
|
108259
|
-
return false;
|
|
108260
|
-
}
|
|
108261
|
-
}
|
|
108262
|
-
return true;
|
|
108263
|
-
}
|
|
108264
|
-
function isSlice(s2) {
|
|
108265
|
-
if (s2 !== null && s2["_slice"] === true) {
|
|
108266
|
-
return true;
|
|
108267
|
-
}
|
|
108268
|
-
return false;
|
|
108269
|
-
}
|
|
108270
|
-
function isContiguousSlice(s2) {
|
|
108271
|
-
return isSlice(s2) && (s2.step === null || s2.step === 1);
|
|
108272
|
-
}
|
|
108273
|
-
function isContiguousSelection(selection) {
|
|
108274
|
-
selection = ensureArray$1(selection);
|
|
108275
|
-
for (let i2 = 0; i2 < selection.length; i2++) {
|
|
108276
|
-
const s2 = selection[i2];
|
|
108277
|
-
if (!(isIntegerArray(s2) || isContiguousSlice(s2) || s2 === "...")) {
|
|
108278
|
-
return false;
|
|
108279
|
-
}
|
|
108280
|
-
}
|
|
108281
|
-
return true;
|
|
108282
|
-
}
|
|
108283
|
-
function* product(...iterables) {
|
|
108284
|
-
if (iterables.length === 0) {
|
|
108285
|
-
return;
|
|
108286
|
-
}
|
|
108287
|
-
const iterators = iterables.map((it) => it());
|
|
108288
|
-
const results = iterators.map((it) => it.next());
|
|
108289
|
-
for (let i2 = 0; ; ) {
|
|
108290
|
-
if (results[i2].done) {
|
|
108291
|
-
iterators[i2] = iterables[i2]();
|
|
108292
|
-
results[i2] = iterators[i2].next();
|
|
108293
|
-
if (++i2 >= iterators.length) {
|
|
108294
|
-
return;
|
|
108295
|
-
}
|
|
108296
|
-
} else {
|
|
108297
|
-
yield results.map(({ value }) => value);
|
|
108298
|
-
i2 = 0;
|
|
108299
|
-
}
|
|
108300
|
-
results[i2] = iterators[i2].next();
|
|
108301
|
-
}
|
|
108302
|
-
}
|
|
108303
|
-
class BasicIndexer {
|
|
108304
|
-
constructor(selection, array2) {
|
|
108305
|
-
selection = normalizeArraySelection(selection, array2.shape);
|
|
108306
|
-
this.dimIndexers = [];
|
|
108307
|
-
const arrayShape = array2.shape;
|
|
108308
|
-
for (let i2 = 0; i2 < arrayShape.length; i2++) {
|
|
108309
|
-
let dimSelection = selection[i2];
|
|
108310
|
-
const dimLength = arrayShape[i2];
|
|
108311
|
-
const dimChunkLength = array2.chunks[i2];
|
|
108312
|
-
if (dimSelection === null) {
|
|
108313
|
-
dimSelection = slice(null);
|
|
108314
|
-
}
|
|
108315
|
-
if (isInteger(dimSelection)) {
|
|
108316
|
-
this.dimIndexers.push(new IntDimIndexer(dimSelection, dimLength, dimChunkLength));
|
|
108317
|
-
} else if (isSlice(dimSelection)) {
|
|
108318
|
-
this.dimIndexers.push(new SliceDimIndexer(dimSelection, dimLength, dimChunkLength));
|
|
108319
|
-
} else {
|
|
108320
|
-
throw new RangeError(`Unspported selection item for basic indexing; expected integer or slice, got ${dimSelection}`);
|
|
108321
|
-
}
|
|
108322
|
-
}
|
|
108323
|
-
this.shape = [];
|
|
108324
|
-
for (const d of this.dimIndexers) {
|
|
108325
|
-
if (d instanceof SliceDimIndexer) {
|
|
108326
|
-
this.shape.push(d.numItems);
|
|
108327
|
-
}
|
|
108328
|
-
}
|
|
108329
|
-
this.dropAxes = null;
|
|
108330
|
-
}
|
|
108331
|
-
*iter() {
|
|
108332
|
-
const dimIndexerIterables = this.dimIndexers.map((x2) => () => x2.iter());
|
|
108333
|
-
const dimIndexerProduct = product(...dimIndexerIterables);
|
|
108334
|
-
for (const dimProjections of dimIndexerProduct) {
|
|
108335
|
-
const chunkCoords = [];
|
|
108336
|
-
const chunkSelection = [];
|
|
108337
|
-
const outSelection = [];
|
|
108338
|
-
for (const p of dimProjections) {
|
|
108339
|
-
chunkCoords.push(p.dimChunkIndex);
|
|
108340
|
-
chunkSelection.push(p.dimChunkSelection);
|
|
108341
|
-
if (p.dimOutSelection !== null) {
|
|
108342
|
-
outSelection.push(p.dimOutSelection);
|
|
108343
|
-
}
|
|
108344
|
-
}
|
|
108345
|
-
yield {
|
|
108346
|
-
chunkCoords,
|
|
108347
|
-
chunkSelection,
|
|
108348
|
-
outSelection
|
|
108349
|
-
};
|
|
108350
|
-
}
|
|
108351
|
-
}
|
|
108352
|
-
}
|
|
108353
|
-
class IntDimIndexer {
|
|
108354
|
-
constructor(dimSelection, dimLength, dimChunkLength) {
|
|
108355
|
-
dimSelection = normalizeIntegerSelection(dimSelection, dimLength);
|
|
108356
|
-
this.dimSelection = dimSelection;
|
|
108357
|
-
this.dimLength = dimLength;
|
|
108358
|
-
this.dimChunkLength = dimChunkLength;
|
|
108359
|
-
this.numItems = 1;
|
|
108360
|
-
}
|
|
108361
|
-
*iter() {
|
|
108362
|
-
const dimChunkIndex = Math.floor(this.dimSelection / this.dimChunkLength);
|
|
108363
|
-
const dimOffset = dimChunkIndex * this.dimChunkLength;
|
|
108364
|
-
const dimChunkSelection = this.dimSelection - dimOffset;
|
|
108365
|
-
const dimOutSelection = null;
|
|
108366
|
-
yield {
|
|
108367
|
-
dimChunkIndex,
|
|
108368
|
-
dimChunkSelection,
|
|
108369
|
-
dimOutSelection
|
|
108370
|
-
};
|
|
108371
|
-
}
|
|
108372
|
-
}
|
|
108373
|
-
class SliceDimIndexer {
|
|
108374
|
-
constructor(dimSelection, dimLength, dimChunkLength) {
|
|
108375
|
-
const [start, stop, step] = sliceIndices(dimSelection, dimLength);
|
|
108376
|
-
this.start = start;
|
|
108377
|
-
this.stop = stop;
|
|
108378
|
-
this.step = step;
|
|
108379
|
-
if (this.step < 1) {
|
|
108380
|
-
throw new NegativeStepError();
|
|
108381
|
-
}
|
|
108382
|
-
this.dimLength = dimLength;
|
|
108383
|
-
this.dimChunkLength = dimChunkLength;
|
|
108384
|
-
this.numItems = Math.max(0, Math.ceil((this.stop - this.start) / this.step));
|
|
108385
|
-
this.numChunks = Math.ceil(this.dimLength / this.dimChunkLength);
|
|
108386
|
-
}
|
|
108387
|
-
*iter() {
|
|
108388
|
-
const dimChunkIndexFrom = Math.floor(this.start / this.dimChunkLength);
|
|
108389
|
-
const dimChunkIndexTo = Math.ceil(this.stop / this.dimChunkLength);
|
|
108390
|
-
for (let dimChunkIndex = dimChunkIndexFrom; dimChunkIndex < dimChunkIndexTo; dimChunkIndex++) {
|
|
108391
|
-
const dimOffset = dimChunkIndex * this.dimChunkLength;
|
|
108392
|
-
const dimLimit = Math.min(this.dimLength, (dimChunkIndex + 1) * this.dimChunkLength);
|
|
108393
|
-
const dimChunkLength = dimLimit - dimOffset;
|
|
108394
|
-
let dimChunkSelStart;
|
|
108395
|
-
let dimChunkSelStop;
|
|
108396
|
-
let dimOutOffset;
|
|
108397
|
-
if (this.start < dimOffset) {
|
|
108398
|
-
dimChunkSelStart = 0;
|
|
108399
|
-
const remainder = (dimOffset - this.start) % this.step;
|
|
108400
|
-
if (remainder > 0) {
|
|
108401
|
-
dimChunkSelStart += this.step - remainder;
|
|
108402
|
-
}
|
|
108403
|
-
dimOutOffset = Math.ceil((dimOffset - this.start) / this.step);
|
|
108404
|
-
} else {
|
|
108405
|
-
dimChunkSelStart = this.start - dimOffset;
|
|
108406
|
-
dimOutOffset = 0;
|
|
108407
|
-
}
|
|
108408
|
-
if (this.stop > dimLimit) {
|
|
108409
|
-
dimChunkSelStop = dimChunkLength;
|
|
108410
|
-
} else {
|
|
108411
|
-
dimChunkSelStop = this.stop - dimOffset;
|
|
108412
|
-
}
|
|
108413
|
-
const dimChunkSelection = slice(dimChunkSelStart, dimChunkSelStop, this.step);
|
|
108414
|
-
const dimChunkNumItems = Math.ceil((dimChunkSelStop - dimChunkSelStart) / this.step);
|
|
108415
|
-
const dimOutSelection = slice(dimOutOffset, dimOutOffset + dimChunkNumItems);
|
|
108416
|
-
yield {
|
|
108417
|
-
dimChunkIndex,
|
|
108418
|
-
dimChunkSelection,
|
|
108419
|
-
dimOutSelection
|
|
108420
|
-
};
|
|
108421
|
-
}
|
|
108422
|
-
}
|
|
108423
|
-
}
|
|
108424
|
-
const IS_NODE$1 = typeof process !== "undefined" && process.versions && process.versions.node;
|
|
108425
|
-
function normalizeStoragePath(path) {
|
|
108426
|
-
if (path === null) {
|
|
108427
|
-
return "";
|
|
108428
|
-
}
|
|
108429
|
-
if (path instanceof String) {
|
|
108430
|
-
path = path.valueOf();
|
|
108431
|
-
}
|
|
108432
|
-
path = path.replace(/\\/g, "/");
|
|
108433
|
-
while (path.length > 0 && path[0] === "/") {
|
|
108434
|
-
path = path.slice(1);
|
|
108435
|
-
}
|
|
108436
|
-
while (path.length > 0 && path[path.length - 1] === "/") {
|
|
108437
|
-
path = path.slice(0, path.length - 1);
|
|
108438
|
-
}
|
|
108439
|
-
path = path.replace(/\/\/+/g, "/");
|
|
108440
|
-
const segments = path.split("/");
|
|
108441
|
-
for (const s2 of segments) {
|
|
108442
|
-
if (s2 === "." || s2 === "..") {
|
|
108443
|
-
throw Error("path containing '.' or '..' segment not allowed");
|
|
108444
|
-
}
|
|
108445
|
-
}
|
|
108446
|
-
return path;
|
|
108447
|
-
}
|
|
108448
|
-
function normalizeShape(shape) {
|
|
108449
|
-
if (typeof shape === "number") {
|
|
108450
|
-
shape = [shape];
|
|
108451
|
-
}
|
|
108452
|
-
return shape.map((x2) => Math.floor(x2));
|
|
108453
|
-
}
|
|
108454
|
-
function normalizeChunks(chunks, shape) {
|
|
108455
|
-
if (chunks === null || chunks === true) {
|
|
108456
|
-
throw new Error("Chunk guessing is not supported yet");
|
|
108457
|
-
}
|
|
108458
|
-
if (chunks === false) {
|
|
108459
|
-
return shape;
|
|
108460
|
-
}
|
|
108461
|
-
if (typeof chunks === "number") {
|
|
108462
|
-
chunks = [chunks];
|
|
108463
|
-
}
|
|
108464
|
-
if (chunks.length < shape.length) {
|
|
108465
|
-
chunks = chunks.concat(shape.slice(chunks.length));
|
|
108466
|
-
}
|
|
108467
|
-
return chunks.map((x2, idx) => {
|
|
108468
|
-
if (x2 === -1 || x2 === null) {
|
|
108469
|
-
return shape[idx];
|
|
108470
|
-
} else {
|
|
108471
|
-
return Math.floor(x2);
|
|
108472
|
-
}
|
|
108473
|
-
});
|
|
108474
|
-
}
|
|
108475
|
-
function normalizeOrder(order) {
|
|
108476
|
-
order = order.toUpperCase();
|
|
108477
|
-
return order;
|
|
108478
|
-
}
|
|
108479
|
-
function normalizeDtype(dtype) {
|
|
108480
|
-
return dtype;
|
|
108481
|
-
}
|
|
108482
|
-
function normalizeFillValue(fillValue) {
|
|
108483
|
-
return fillValue;
|
|
108484
|
-
}
|
|
108485
|
-
function isTotalSlice(item, shape) {
|
|
108486
|
-
if (item === null) {
|
|
108487
|
-
return true;
|
|
108488
|
-
}
|
|
108489
|
-
if (!Array.isArray(item)) {
|
|
108490
|
-
item = [item];
|
|
108491
|
-
}
|
|
108492
|
-
for (let i2 = 0; i2 < Math.min(item.length, shape.length); i2++) {
|
|
108493
|
-
const it = item[i2];
|
|
108494
|
-
if (it === null)
|
|
108495
|
-
continue;
|
|
108496
|
-
if (isSlice(it)) {
|
|
108497
|
-
const s2 = it;
|
|
108498
|
-
const isStepOne = s2.step === 1 || s2.step === null;
|
|
108499
|
-
if (s2.start === null && s2.stop === null && isStepOne) {
|
|
108500
|
-
continue;
|
|
108501
|
-
}
|
|
108502
|
-
if (s2.stop - s2.start === shape[i2] && isStepOne) {
|
|
108503
|
-
continue;
|
|
108504
|
-
}
|
|
108505
|
-
return false;
|
|
108506
|
-
}
|
|
108507
|
-
return false;
|
|
108508
|
-
}
|
|
108509
|
-
return true;
|
|
108510
|
-
}
|
|
108511
|
-
function arrayEquals1D(a2, b) {
|
|
108512
|
-
if (a2.length !== b.length) {
|
|
108513
|
-
return false;
|
|
108514
|
-
}
|
|
108515
|
-
for (let i2 = 0; i2 < a2.length; i2++) {
|
|
108516
|
-
if (a2[i2] !== b[i2]) {
|
|
108517
|
-
return false;
|
|
108518
|
-
}
|
|
108519
|
-
}
|
|
108520
|
-
return true;
|
|
108521
|
-
}
|
|
108522
|
-
function getStrides(shape) {
|
|
108523
|
-
const ndim = shape.length;
|
|
108524
|
-
const strides = Array(ndim);
|
|
108525
|
-
let step = 1;
|
|
108526
|
-
for (let i2 = ndim - 1; i2 >= 0; i2--) {
|
|
108527
|
-
strides[i2] = step;
|
|
108528
|
-
step *= shape[i2];
|
|
108529
|
-
}
|
|
108530
|
-
return strides;
|
|
108531
|
-
}
|
|
108532
|
-
function joinUrlParts(...args) {
|
|
108533
|
-
return args.map((part, i2) => {
|
|
108534
|
-
if (i2 === 0) {
|
|
108535
|
-
return part.trim().replace(/[\/]*$/g, "");
|
|
108536
|
-
} else {
|
|
108537
|
-
return part.trim().replace(/(^[\/]*|[\/]*$)/g, "");
|
|
108538
|
-
}
|
|
108539
|
-
}).filter((x2) => x2.length).join("/");
|
|
108540
|
-
}
|
|
108541
|
-
function byteSwapInplace(src2) {
|
|
108542
|
-
const b = src2.BYTES_PER_ELEMENT;
|
|
108543
|
-
if (b === 1)
|
|
108544
|
-
return;
|
|
108545
|
-
if (IS_NODE$1) {
|
|
108546
|
-
const bytes = Buffer.from(src2.buffer, src2.byteOffset, src2.length * b);
|
|
108547
|
-
if (b === 2)
|
|
108548
|
-
bytes.swap16();
|
|
108549
|
-
if (b === 4)
|
|
108550
|
-
bytes.swap32();
|
|
108551
|
-
if (b === 8)
|
|
108552
|
-
bytes.swap64();
|
|
108553
|
-
return;
|
|
108554
|
-
}
|
|
108555
|
-
const flipper = new Uint8Array(src2.buffer, src2.byteOffset, src2.length * b);
|
|
108556
|
-
const numFlips = b / 2;
|
|
108557
|
-
const endByteIndex = b - 1;
|
|
108558
|
-
let t2;
|
|
108559
|
-
for (let i2 = 0; i2 < flipper.length; i2 += b) {
|
|
108560
|
-
for (let j = 0; j < numFlips; j++) {
|
|
108561
|
-
t2 = flipper[i2 + j];
|
|
108562
|
-
flipper[i2 + j] = flipper[i2 + endByteIndex - j];
|
|
108563
|
-
flipper[i2 + endByteIndex - j] = t2;
|
|
108564
|
-
}
|
|
108565
|
-
}
|
|
108566
|
-
}
|
|
108567
|
-
function byteSwap(src2) {
|
|
108568
|
-
const copy2 = src2.slice();
|
|
108569
|
-
byteSwapInplace(copy2);
|
|
108570
|
-
return copy2;
|
|
108571
|
-
}
|
|
108572
|
-
const ARRAY_META_KEY = ".zarray";
|
|
108573
|
-
const GROUP_META_KEY = ".zgroup";
|
|
108574
|
-
const ATTRS_META_KEY = ".zattrs";
|
|
108575
|
-
async function containsArray(store, path = null) {
|
|
108576
|
-
path = normalizeStoragePath(path);
|
|
108577
|
-
const prefix = pathToPrefix(path);
|
|
108578
|
-
const key = prefix + ARRAY_META_KEY;
|
|
108579
|
-
return store.containsItem(key);
|
|
108580
|
-
}
|
|
108581
|
-
async function containsGroup(store, path = null) {
|
|
108582
|
-
path = normalizeStoragePath(path);
|
|
108583
|
-
const prefix = pathToPrefix(path);
|
|
108584
|
-
const key = prefix + GROUP_META_KEY;
|
|
108585
|
-
return store.containsItem(key);
|
|
108586
|
-
}
|
|
108587
|
-
function pathToPrefix(path) {
|
|
108588
|
-
if (path.length > 0) {
|
|
108589
|
-
return path + "/";
|
|
108590
|
-
}
|
|
108591
|
-
return "";
|
|
108592
|
-
}
|
|
108593
|
-
async function requireParentGroup(store, path, chunkStore, overwrite) {
|
|
108594
|
-
if (path.length === 0) {
|
|
108595
|
-
return;
|
|
108596
|
-
}
|
|
108597
|
-
const segments = path.split("/");
|
|
108598
|
-
let p = "";
|
|
108599
|
-
for (const s2 of segments.slice(0, segments.length - 1)) {
|
|
108600
|
-
p += s2;
|
|
108601
|
-
if (await containsArray(store, p)) {
|
|
108602
|
-
await initGroupMetadata(store, p, overwrite);
|
|
108603
|
-
} else if (!await containsGroup(store, p)) {
|
|
108604
|
-
await initGroupMetadata(store, p);
|
|
108605
|
-
}
|
|
108606
|
-
p += "/";
|
|
108607
|
-
}
|
|
108608
|
-
}
|
|
108609
|
-
async function initGroupMetadata(store, path = null, overwrite = false) {
|
|
108610
|
-
path = normalizeStoragePath(path);
|
|
108611
|
-
if (overwrite) {
|
|
108612
|
-
throw Error("Group overwriting not implemented yet :(");
|
|
108613
|
-
} else if (await containsArray(store, path)) {
|
|
108614
|
-
throw new ContainsArrayError(path);
|
|
108615
|
-
} else if (await containsGroup(store, path)) {
|
|
108616
|
-
throw new ContainsGroupError(path);
|
|
108617
|
-
}
|
|
108618
|
-
const metadata = { zarr_format: 2 };
|
|
108619
|
-
const key = pathToPrefix(path) + GROUP_META_KEY;
|
|
108620
|
-
await store.setItem(key, JSON.stringify(metadata));
|
|
108621
|
-
}
|
|
108622
|
-
async function initGroup(store, path = null, chunkStore = null, overwrite = false) {
|
|
108623
|
-
path = normalizeStoragePath(path);
|
|
108624
|
-
await requireParentGroup(store, path, chunkStore, overwrite);
|
|
108625
|
-
await initGroupMetadata(store, path, overwrite);
|
|
108626
|
-
}
|
|
108627
|
-
async function initArrayMetadata(store, shape, chunks, dtype, path, compressor, fillValue, order, overwrite, chunkStore, filters, dimensionSeparator) {
|
|
108628
|
-
if (overwrite) {
|
|
108629
|
-
throw Error("Array overwriting not implemented yet :(");
|
|
108630
|
-
} else if (await containsArray(store, path)) {
|
|
108631
|
-
throw new ContainsArrayError(path);
|
|
108632
|
-
} else if (await containsGroup(store, path)) {
|
|
108633
|
-
throw new ContainsGroupError(path);
|
|
108634
|
-
}
|
|
108635
|
-
dtype = normalizeDtype(dtype);
|
|
108636
|
-
shape = normalizeShape(shape);
|
|
108637
|
-
chunks = normalizeChunks(chunks, shape);
|
|
108638
|
-
order = normalizeOrder(order);
|
|
108639
|
-
fillValue = normalizeFillValue(fillValue);
|
|
108640
|
-
if (filters !== null && filters.length > 0) {
|
|
108641
|
-
throw Error("Filters are not supported yet");
|
|
108642
|
-
}
|
|
108643
|
-
let serializedFillValue = fillValue;
|
|
108644
|
-
if (typeof fillValue === "number") {
|
|
108645
|
-
if (Number.isNaN(fillValue))
|
|
108646
|
-
serializedFillValue = "NaN";
|
|
108647
|
-
if (Number.POSITIVE_INFINITY === fillValue)
|
|
108648
|
-
serializedFillValue = "Infinity";
|
|
108649
|
-
if (Number.NEGATIVE_INFINITY === fillValue)
|
|
108650
|
-
serializedFillValue = "-Infinity";
|
|
108651
|
-
}
|
|
108652
|
-
filters = null;
|
|
108653
|
-
const metadata = {
|
|
108654
|
-
zarr_format: 2,
|
|
108655
|
-
shape,
|
|
108656
|
-
chunks,
|
|
108657
|
-
dtype,
|
|
108658
|
-
fill_value: serializedFillValue,
|
|
108659
|
-
order,
|
|
108660
|
-
compressor,
|
|
108661
|
-
filters
|
|
108662
|
-
};
|
|
108663
|
-
if (dimensionSeparator) {
|
|
108664
|
-
metadata.dimension_separator = dimensionSeparator;
|
|
108665
|
-
}
|
|
108666
|
-
const metaKey = pathToPrefix(path) + ARRAY_META_KEY;
|
|
108667
|
-
await store.setItem(metaKey, JSON.stringify(metadata));
|
|
108668
|
-
}
|
|
108669
|
-
async function initArray(store, shape, chunks, dtype, path = null, compressor = null, fillValue = null, order = "C", overwrite = false, chunkStore = null, filters = null, dimensionSeparator) {
|
|
108670
|
-
path = normalizeStoragePath(path);
|
|
108671
|
-
await requireParentGroup(store, path, chunkStore, overwrite);
|
|
108672
|
-
await initArrayMetadata(store, shape, chunks, dtype, path, compressor, fillValue, order, overwrite, chunkStore, filters, dimensionSeparator);
|
|
108673
|
-
}
|
|
108674
|
-
function parseMetadata(s2) {
|
|
108675
|
-
if (typeof s2 !== "string") {
|
|
108676
|
-
if (IS_NODE$1 && Buffer.isBuffer(s2)) {
|
|
108677
|
-
return JSON.parse(s2.toString());
|
|
108678
|
-
} else if (s2 instanceof ArrayBuffer) {
|
|
108679
|
-
const utf8Decoder = new TextDecoder();
|
|
108680
|
-
const bytes = new Uint8Array(s2);
|
|
108681
|
-
return JSON.parse(utf8Decoder.decode(bytes));
|
|
108682
|
-
} else {
|
|
108683
|
-
return s2;
|
|
108684
|
-
}
|
|
108685
|
-
}
|
|
108686
|
-
return JSON.parse(s2);
|
|
108687
|
-
}
|
|
108688
|
-
class Attributes {
|
|
108689
|
-
constructor(store, key, readOnly, cache2 = true) {
|
|
108690
|
-
this.store = store;
|
|
108691
|
-
this.key = key;
|
|
108692
|
-
this.readOnly = readOnly;
|
|
108693
|
-
this.cache = cache2;
|
|
108694
|
-
this.cachedValue = null;
|
|
108695
|
-
}
|
|
108696
|
-
/**
|
|
108697
|
-
* Retrieve all attributes as a JSON object.
|
|
108698
|
-
*/
|
|
108699
|
-
async asObject() {
|
|
108700
|
-
if (this.cache && this.cachedValue !== null) {
|
|
108701
|
-
return this.cachedValue;
|
|
108702
|
-
}
|
|
108703
|
-
const o2 = await this.getNoSync();
|
|
108704
|
-
if (this.cache) {
|
|
108705
|
-
this.cachedValue = o2;
|
|
108706
|
-
}
|
|
108707
|
-
return o2;
|
|
108708
|
-
}
|
|
108709
|
-
async getNoSync() {
|
|
108710
|
-
try {
|
|
108711
|
-
const data = await this.store.getItem(this.key);
|
|
108712
|
-
return parseMetadata(data);
|
|
108713
|
-
} catch (error2) {
|
|
108714
|
-
return {};
|
|
108715
|
-
}
|
|
108716
|
-
}
|
|
108717
|
-
async setNoSync(key, value) {
|
|
108718
|
-
const d = await this.getNoSync();
|
|
108719
|
-
d[key] = value;
|
|
108720
|
-
await this.putNoSync(d);
|
|
108721
|
-
return true;
|
|
108722
|
-
}
|
|
108723
|
-
async putNoSync(m) {
|
|
108724
|
-
await this.store.setItem(this.key, JSON.stringify(m));
|
|
108725
|
-
if (this.cache) {
|
|
108726
|
-
this.cachedValue = m;
|
|
108727
|
-
}
|
|
108728
|
-
}
|
|
108729
|
-
async delNoSync(key) {
|
|
108730
|
-
const d = await this.getNoSync();
|
|
108731
|
-
delete d[key];
|
|
108732
|
-
await this.putNoSync(d);
|
|
108733
|
-
return true;
|
|
108734
|
-
}
|
|
108735
|
-
/**
|
|
108736
|
-
* Overwrite all attributes with the provided object in a single operation
|
|
108737
|
-
*/
|
|
108738
|
-
async put(d) {
|
|
108739
|
-
if (this.readOnly) {
|
|
108740
|
-
throw new PermissionError("attributes are read-only");
|
|
108741
|
-
}
|
|
108742
|
-
return this.putNoSync(d);
|
|
108743
|
-
}
|
|
108744
|
-
async setItem(key, value) {
|
|
108745
|
-
if (this.readOnly) {
|
|
108746
|
-
throw new PermissionError("attributes are read-only");
|
|
108747
|
-
}
|
|
108748
|
-
return this.setNoSync(key, value);
|
|
108749
|
-
}
|
|
108750
|
-
async getItem(key) {
|
|
108751
|
-
return (await this.asObject())[key];
|
|
108752
|
-
}
|
|
108753
|
-
async deleteItem(key) {
|
|
108754
|
-
if (this.readOnly) {
|
|
108755
|
-
throw new PermissionError("attributes are read-only");
|
|
108756
|
-
}
|
|
108757
|
-
return this.delNoSync(key);
|
|
108758
|
-
}
|
|
108759
|
-
async containsItem(key) {
|
|
108760
|
-
return (await this.asObject())[key] !== void 0;
|
|
108761
|
-
}
|
|
108762
|
-
proxy() {
|
|
108763
|
-
return createProxy(this);
|
|
108764
|
-
}
|
|
108765
|
-
}
|
|
108766
|
-
const DTYPE_TYPEDARRAY_MAPPING = {
|
|
108767
|
-
"|b": Int8Array,
|
|
108768
|
-
"|B": Uint8Array,
|
|
108769
|
-
"|u1": Uint8Array,
|
|
108770
|
-
"|i1": Int8Array,
|
|
108771
|
-
"<b": Int8Array,
|
|
108772
|
-
"<B": Uint8Array,
|
|
108773
|
-
"<u1": Uint8Array,
|
|
108774
|
-
"<i1": Int8Array,
|
|
108775
|
-
"<u2": Uint16Array,
|
|
108776
|
-
"<i2": Int16Array,
|
|
108777
|
-
"<u4": Uint32Array,
|
|
108778
|
-
"<i4": Int32Array,
|
|
108779
|
-
"<f4": Float32Array,
|
|
108780
|
-
"<f8": Float64Array,
|
|
108781
|
-
">b": Int8Array,
|
|
108782
|
-
">B": Uint8Array,
|
|
108783
|
-
">u1": Uint8Array,
|
|
108784
|
-
">i1": Int8Array,
|
|
108785
|
-
">u2": Uint16Array,
|
|
108786
|
-
">i2": Int16Array,
|
|
108787
|
-
">u4": Uint32Array,
|
|
108788
|
-
">i4": Int32Array,
|
|
108789
|
-
">f4": Float32Array,
|
|
108790
|
-
">f8": Float64Array
|
|
108791
|
-
};
|
|
108792
|
-
function getTypedArrayCtr(dtype) {
|
|
108793
|
-
const ctr = DTYPE_TYPEDARRAY_MAPPING[dtype];
|
|
108794
|
-
if (!ctr) {
|
|
108795
|
-
throw Error(`Dtype not recognized or not supported in zarr.js, got ${dtype}.`);
|
|
108796
|
-
}
|
|
108797
|
-
return ctr;
|
|
108798
|
-
}
|
|
108799
|
-
function getTypedArrayDtypeString(t2) {
|
|
108800
|
-
if (t2 instanceof Uint8Array)
|
|
108801
|
-
return "|u1";
|
|
108802
|
-
if (t2 instanceof Int8Array)
|
|
108803
|
-
return "|i1";
|
|
108804
|
-
if (t2 instanceof Uint16Array)
|
|
108805
|
-
return "<u2";
|
|
108806
|
-
if (t2 instanceof Int16Array)
|
|
108807
|
-
return "<i2";
|
|
108808
|
-
if (t2 instanceof Uint32Array)
|
|
108809
|
-
return "<u4";
|
|
108810
|
-
if (t2 instanceof Int32Array)
|
|
108811
|
-
return "<i4";
|
|
108812
|
-
if (t2 instanceof Float32Array)
|
|
108813
|
-
return "<f4";
|
|
108814
|
-
if (t2 instanceof Float64Array)
|
|
108815
|
-
return "<f8";
|
|
108816
|
-
throw new ValueError("Mapping for TypedArray to Dtypestring not known");
|
|
108817
|
-
}
|
|
108818
|
-
function getNestedArrayConstructor(arr) {
|
|
108819
|
-
if (arr.byteLength !== void 0) {
|
|
108820
|
-
return arr.constructor;
|
|
108821
|
-
}
|
|
108822
|
-
return getNestedArrayConstructor(arr[0]);
|
|
108823
|
-
}
|
|
108824
|
-
function sliceNestedArray(arr, shape, selection) {
|
|
108825
|
-
const normalizedSelection = normalizeArraySelection(selection, shape);
|
|
108826
|
-
const [sliceIndices2, outShape] = selectionToSliceIndices(normalizedSelection, shape);
|
|
108827
|
-
const outArray = _sliceNestedArray(arr, shape, sliceIndices2);
|
|
108828
|
-
return [outArray, outShape];
|
|
108829
|
-
}
|
|
108830
|
-
function _sliceNestedArray(arr, shape, selection) {
|
|
108831
|
-
const currentSlice = selection[0];
|
|
108832
|
-
if (typeof currentSlice === "number") {
|
|
108833
|
-
if (shape.length === 1) {
|
|
108834
|
-
return arr[currentSlice];
|
|
108835
|
-
} else {
|
|
108836
|
-
return _sliceNestedArray(arr[currentSlice], shape.slice(1), selection.slice(1));
|
|
108837
|
-
}
|
|
108838
|
-
}
|
|
108839
|
-
const [from, to, step, outputSize] = currentSlice;
|
|
108840
|
-
if (outputSize === 0) {
|
|
108841
|
-
return new (getNestedArrayConstructor(arr))(0);
|
|
108842
|
-
}
|
|
108843
|
-
if (shape.length === 1) {
|
|
108844
|
-
if (step === 1) {
|
|
108845
|
-
return arr.slice(from, to);
|
|
108846
|
-
}
|
|
108847
|
-
const newArrData = new arr.constructor(outputSize);
|
|
108848
|
-
for (let i2 = 0; i2 < outputSize; i2++) {
|
|
108849
|
-
newArrData[i2] = arr[from + i2 * step];
|
|
108850
|
-
}
|
|
108851
|
-
return newArrData;
|
|
108852
|
-
}
|
|
108853
|
-
let newArr = new Array(outputSize);
|
|
108854
|
-
for (let i2 = 0; i2 < outputSize; i2++) {
|
|
108855
|
-
newArr[i2] = _sliceNestedArray(arr[from + i2 * step], shape.slice(1), selection.slice(1));
|
|
108856
|
-
}
|
|
108857
|
-
if (outputSize > 0 && typeof newArr[0] === "number") {
|
|
108858
|
-
const typedArrayConstructor = arr[0].constructor;
|
|
108859
|
-
newArr = typedArrayConstructor.from(newArr);
|
|
108860
|
-
}
|
|
108861
|
-
return newArr;
|
|
108862
|
-
}
|
|
108863
|
-
function setNestedArrayToScalar(dstArr, value, destShape, selection) {
|
|
108864
|
-
const normalizedSelection = normalizeArraySelection(selection, destShape, true);
|
|
108865
|
-
const [sliceIndices2, _outShape] = selectionToSliceIndices(normalizedSelection, destShape);
|
|
108866
|
-
_setNestedArrayToScalar(dstArr, value, destShape, sliceIndices2);
|
|
108867
|
-
}
|
|
108868
|
-
function setNestedArray(dstArr, sourceArr, destShape, sourceShape, selection) {
|
|
108869
|
-
const normalizedSelection = normalizeArraySelection(selection, destShape, false);
|
|
108870
|
-
const [sliceIndices2, outShape] = selectionToSliceIndices(normalizedSelection, destShape);
|
|
108871
|
-
if (JSON.stringify(outShape) !== JSON.stringify(sourceShape)) {
|
|
108872
|
-
throw new ValueError(`Shape mismatch in target and source NestedArray: ${outShape} and ${sourceShape}`);
|
|
108873
|
-
}
|
|
108874
|
-
_setNestedArray(dstArr, sourceArr, destShape, sliceIndices2);
|
|
108875
|
-
}
|
|
108876
|
-
function _setNestedArray(dstArr, sourceArr, shape, selection) {
|
|
108877
|
-
const currentSlice = selection[0];
|
|
108878
|
-
if (typeof sourceArr === "number") {
|
|
108879
|
-
_setNestedArrayToScalar(dstArr, sourceArr, shape, selection.map((x2) => typeof x2 === "number" ? [x2, x2 + 1, 1, 1] : x2));
|
|
108880
|
-
return;
|
|
108881
|
-
}
|
|
108882
|
-
if (typeof currentSlice === "number") {
|
|
108883
|
-
_setNestedArray(dstArr[currentSlice], sourceArr, shape.slice(1), selection.slice(1));
|
|
108884
|
-
return;
|
|
108885
|
-
}
|
|
108886
|
-
const [from, _to, step, outputSize] = currentSlice;
|
|
108887
|
-
if (shape.length === 1) {
|
|
108888
|
-
if (step === 1) {
|
|
108889
|
-
dstArr.set(sourceArr, from);
|
|
108890
|
-
} else {
|
|
108891
|
-
for (let i2 = 0; i2 < outputSize; i2++) {
|
|
108892
|
-
dstArr[from + i2 * step] = sourceArr[i2];
|
|
108893
|
-
}
|
|
108894
|
-
}
|
|
108895
|
-
return;
|
|
108896
|
-
}
|
|
108897
|
-
for (let i2 = 0; i2 < outputSize; i2++) {
|
|
108898
|
-
_setNestedArray(dstArr[from + i2 * step], sourceArr[i2], shape.slice(1), selection.slice(1));
|
|
108899
|
-
}
|
|
108900
|
-
}
|
|
108901
|
-
function _setNestedArrayToScalar(dstArr, value, shape, selection) {
|
|
108902
|
-
const currentSlice = selection[0];
|
|
108903
|
-
const [from, to, step, outputSize] = currentSlice;
|
|
108904
|
-
if (shape.length === 1) {
|
|
108905
|
-
if (step === 1) {
|
|
108906
|
-
dstArr.fill(value, from, to);
|
|
108907
|
-
} else {
|
|
108908
|
-
for (let i2 = 0; i2 < outputSize; i2++) {
|
|
108909
|
-
dstArr[from + i2 * step] = value;
|
|
108910
|
-
}
|
|
108911
|
-
}
|
|
108912
|
-
return;
|
|
108913
|
-
}
|
|
108914
|
-
for (let i2 = 0; i2 < outputSize; i2++) {
|
|
108915
|
-
_setNestedArrayToScalar(dstArr[from + i2 * step], value, shape.slice(1), selection.slice(1));
|
|
108916
|
-
}
|
|
108917
|
-
}
|
|
108918
|
-
function flattenNestedArray(arr, shape, constr) {
|
|
108919
|
-
if (constr === void 0) {
|
|
108920
|
-
constr = getNestedArrayConstructor(arr);
|
|
108921
|
-
}
|
|
108922
|
-
const size = shape.reduce((x2, y2) => x2 * y2, 1);
|
|
108923
|
-
const outArr = new constr(size);
|
|
108924
|
-
_flattenNestedArray(arr, shape, outArr, 0);
|
|
108925
|
-
return outArr;
|
|
108926
|
-
}
|
|
108927
|
-
function _flattenNestedArray(arr, shape, outArr, offset) {
|
|
108928
|
-
if (shape.length === 1) {
|
|
108929
|
-
outArr.set(arr, offset);
|
|
108930
|
-
return;
|
|
108931
|
-
}
|
|
108932
|
-
if (shape.length === 2) {
|
|
108933
|
-
for (let i2 = 0; i2 < shape[0]; i2++) {
|
|
108934
|
-
outArr.set(arr[i2], offset + shape[1] * i2);
|
|
108935
|
-
}
|
|
108936
|
-
return arr;
|
|
108937
|
-
}
|
|
108938
|
-
const nextShape = shape.slice(1);
|
|
108939
|
-
const mult = nextShape.reduce((x2, y2) => x2 * y2, 1);
|
|
108940
|
-
for (let i2 = 0; i2 < shape[0]; i2++) {
|
|
108941
|
-
_flattenNestedArray(arr[i2], nextShape, outArr, offset + mult * i2);
|
|
108942
|
-
}
|
|
108943
|
-
return arr;
|
|
108944
|
-
}
|
|
108945
|
-
class NestedArray {
|
|
108946
|
-
constructor(data, shape, dtype) {
|
|
108947
|
-
const dataIsTypedArray = data !== null && !!data.BYTES_PER_ELEMENT;
|
|
108948
|
-
if (shape === void 0) {
|
|
108949
|
-
if (!dataIsTypedArray) {
|
|
108950
|
-
throw new ValueError("Shape argument is required unless you pass in a TypedArray");
|
|
108951
|
-
}
|
|
108952
|
-
shape = [data.length];
|
|
108953
|
-
}
|
|
108954
|
-
if (dtype === void 0) {
|
|
108955
|
-
if (!dataIsTypedArray) {
|
|
108956
|
-
throw new ValueError("Dtype argument is required unless you pass in a TypedArray");
|
|
108957
|
-
}
|
|
108958
|
-
dtype = getTypedArrayDtypeString(data);
|
|
108959
|
-
}
|
|
108960
|
-
shape = normalizeShape(shape);
|
|
108961
|
-
this.shape = shape;
|
|
108962
|
-
this.dtype = dtype;
|
|
108963
|
-
if (dataIsTypedArray && shape.length !== 1) {
|
|
108964
|
-
data = data.buffer;
|
|
108965
|
-
}
|
|
108966
|
-
if (this.shape.length === 0) {
|
|
108967
|
-
this.data = new (getTypedArrayCtr(dtype))(1);
|
|
108968
|
-
} else if (
|
|
108969
|
-
// tslint:disable-next-line: strict-type-predicates
|
|
108970
|
-
IS_NODE$1 && Buffer.isBuffer(data) || data instanceof ArrayBuffer || data === null || data.toString().startsWith("[object ArrayBuffer]")
|
|
108971
|
-
) {
|
|
108972
|
-
const numShapeElements = shape.reduce((x2, y2) => x2 * y2, 1);
|
|
108973
|
-
if (data === null) {
|
|
108974
|
-
data = new ArrayBuffer(numShapeElements * parseInt(dtype[dtype.length - 1], 10));
|
|
108975
|
-
}
|
|
108976
|
-
const numDataElements = data.byteLength / parseInt(dtype[dtype.length - 1], 10);
|
|
108977
|
-
if (numShapeElements !== numDataElements) {
|
|
108978
|
-
throw new Error(`Buffer has ${numDataElements} of dtype ${dtype}, shape is too large or small ${shape} (flat=${numShapeElements})`);
|
|
108979
|
-
}
|
|
108980
|
-
const typeConstructor = getTypedArrayCtr(dtype);
|
|
108981
|
-
this.data = createNestedArray(data, typeConstructor, shape);
|
|
108982
|
-
} else {
|
|
108983
|
-
this.data = data;
|
|
108984
|
-
}
|
|
108985
|
-
}
|
|
108986
|
-
get(selection) {
|
|
108987
|
-
const [sliceResult, outShape] = sliceNestedArray(this.data, this.shape, selection);
|
|
108988
|
-
if (outShape.length === 0) {
|
|
108989
|
-
return sliceResult;
|
|
108990
|
-
} else {
|
|
108991
|
-
return new NestedArray(sliceResult, outShape, this.dtype);
|
|
108992
|
-
}
|
|
108993
|
-
}
|
|
108994
|
-
set(selection = null, value) {
|
|
108995
|
-
if (selection === null) {
|
|
108996
|
-
selection = [slice(null)];
|
|
108997
|
-
}
|
|
108998
|
-
if (typeof value === "number") {
|
|
108999
|
-
if (this.shape.length === 0) {
|
|
109000
|
-
this.data[0] = value;
|
|
109001
|
-
} else {
|
|
109002
|
-
setNestedArrayToScalar(this.data, value, this.shape, selection);
|
|
109003
|
-
}
|
|
109004
|
-
} else {
|
|
109005
|
-
setNestedArray(this.data, value.data, this.shape, value.shape, selection);
|
|
109006
|
-
}
|
|
109007
|
-
}
|
|
109008
|
-
flatten() {
|
|
109009
|
-
if (this.shape.length === 1) {
|
|
109010
|
-
return this.data;
|
|
109011
|
-
}
|
|
109012
|
-
return flattenNestedArray(this.data, this.shape, getTypedArrayCtr(this.dtype));
|
|
109013
|
-
}
|
|
109014
|
-
/**
|
|
109015
|
-
* Currently only supports a single integer as the size, TODO: support start, stop, step.
|
|
109016
|
-
*/
|
|
109017
|
-
static arange(size, dtype = "<i4") {
|
|
109018
|
-
const constr = getTypedArrayCtr(dtype);
|
|
109019
|
-
const data = rangeTypedArray([size], constr);
|
|
109020
|
-
return new NestedArray(data, [size], dtype);
|
|
109021
|
-
}
|
|
109022
|
-
}
|
|
109023
|
-
function rangeTypedArray(shape, tContructor) {
|
|
109024
|
-
const size = shape.reduce((x2, y2) => x2 * y2, 1);
|
|
109025
|
-
const data = new tContructor(size);
|
|
109026
|
-
data.set([...Array(size).keys()]);
|
|
109027
|
-
return data;
|
|
109028
|
-
}
|
|
109029
|
-
function createNestedArray(data, t2, shape, offset = 0) {
|
|
109030
|
-
if (shape.length === 1) {
|
|
109031
|
-
return new t2(data.slice(offset, offset + shape[0] * t2.BYTES_PER_ELEMENT));
|
|
109032
|
-
}
|
|
109033
|
-
const arr = new Array(shape[0]);
|
|
109034
|
-
if (shape.length === 2) {
|
|
109035
|
-
for (let i2 = 0; i2 < shape[0]; i2++) {
|
|
109036
|
-
arr[i2] = new t2(data.slice(offset + shape[1] * i2 * t2.BYTES_PER_ELEMENT, offset + shape[1] * (i2 + 1) * t2.BYTES_PER_ELEMENT));
|
|
109037
|
-
}
|
|
109038
|
-
return arr;
|
|
109039
|
-
}
|
|
109040
|
-
const nextShape = shape.slice(1);
|
|
109041
|
-
const mult = nextShape.reduce((x2, y2) => x2 * y2, 1);
|
|
109042
|
-
for (let i2 = 0; i2 < shape[0]; i2++) {
|
|
109043
|
-
arr[i2] = createNestedArray(data, t2, nextShape, offset + mult * i2 * t2.BYTES_PER_ELEMENT);
|
|
109044
|
-
}
|
|
109045
|
-
return arr;
|
|
109046
|
-
}
|
|
109047
|
-
function setRawArrayToScalar(dstArr, dstStrides, dstShape, dstSelection, value) {
|
|
109048
|
-
const normalizedSelection = normalizeArraySelection(dstSelection, dstShape, true);
|
|
109049
|
-
const [sliceIndices2] = selectionToSliceIndices(normalizedSelection, dstShape);
|
|
109050
|
-
_setRawArrayToScalar(value, dstArr, dstStrides, sliceIndices2);
|
|
109051
|
-
}
|
|
109052
|
-
function setRawArray(dstArr, dstStrides, dstShape, dstSelection, sourceArr, sourceStrides, sourceShape) {
|
|
109053
|
-
const normalizedDstSelection = normalizeArraySelection(dstSelection, dstShape, false);
|
|
109054
|
-
const [dstSliceIndices, outShape] = selectionToSliceIndices(normalizedDstSelection, dstShape);
|
|
109055
|
-
if (JSON.stringify(outShape) !== JSON.stringify(sourceShape)) {
|
|
109056
|
-
throw new ValueError(`Shape mismatch in target and source RawArray: ${outShape} and ${sourceShape}`);
|
|
109057
|
-
}
|
|
109058
|
-
_setRawArray(dstArr, dstStrides, dstSliceIndices, sourceArr, sourceStrides);
|
|
109059
|
-
}
|
|
109060
|
-
function setRawArrayFromChunkItem(dstArr, dstStrides, dstShape, dstSelection, sourceArr, sourceStrides, sourceShape, sourceSelection) {
|
|
109061
|
-
const normalizedDstSelection = normalizeArraySelection(dstSelection, dstShape, true);
|
|
109062
|
-
const [dstSliceIndices] = selectionToSliceIndices(normalizedDstSelection, dstShape);
|
|
109063
|
-
const normalizedSourceSelection = normalizeArraySelection(sourceSelection, sourceShape, false);
|
|
109064
|
-
const [sourceSliceIndicies] = selectionToSliceIndices(normalizedSourceSelection, sourceShape);
|
|
109065
|
-
_setRawArrayFromChunkItem(dstArr, dstStrides, dstSliceIndices, sourceArr, sourceStrides, sourceSliceIndicies);
|
|
109066
|
-
}
|
|
109067
|
-
function _setRawArrayToScalar(value, dstArr, dstStrides, dstSliceIndices) {
|
|
109068
|
-
const [currentDstSlice, ...nextDstSliceIndices] = dstSliceIndices;
|
|
109069
|
-
const [currentDstStride, ...nextDstStrides] = dstStrides;
|
|
109070
|
-
const [from, _to, step, outputSize] = currentDstSlice;
|
|
109071
|
-
if (dstStrides.length === 1) {
|
|
109072
|
-
if (step === 1 && currentDstStride === 1) {
|
|
109073
|
-
dstArr.fill(value, from, from + outputSize);
|
|
109074
|
-
} else {
|
|
109075
|
-
for (let i2 = 0; i2 < outputSize; i2++) {
|
|
109076
|
-
dstArr[currentDstStride * (from + step * i2)] = value;
|
|
109077
|
-
}
|
|
109078
|
-
}
|
|
109079
|
-
return;
|
|
109080
|
-
}
|
|
109081
|
-
for (let i2 = 0; i2 < outputSize; i2++) {
|
|
109082
|
-
_setRawArrayToScalar(value, dstArr.subarray(currentDstStride * (from + step * i2)), nextDstStrides, nextDstSliceIndices);
|
|
109083
|
-
}
|
|
109084
|
-
}
|
|
109085
|
-
function _setRawArray(dstArr, dstStrides, dstSliceIndices, sourceArr, sourceStrides) {
|
|
109086
|
-
if (dstSliceIndices.length === 0) {
|
|
109087
|
-
dstArr.set(sourceArr);
|
|
109088
|
-
return;
|
|
109089
|
-
}
|
|
109090
|
-
const [currentDstSlice, ...nextDstSliceIndices] = dstSliceIndices;
|
|
109091
|
-
const [currentDstStride, ...nextDstStrides] = dstStrides;
|
|
109092
|
-
if (typeof currentDstSlice === "number") {
|
|
109093
|
-
_setRawArray(dstArr.subarray(currentDstSlice * currentDstStride), nextDstStrides, nextDstSliceIndices, sourceArr, sourceStrides);
|
|
109094
|
-
return;
|
|
109095
|
-
}
|
|
109096
|
-
const [currentSourceStride, ...nextSourceStrides] = sourceStrides;
|
|
109097
|
-
const [from, _to, step, outputSize] = currentDstSlice;
|
|
109098
|
-
if (dstStrides.length === 1) {
|
|
109099
|
-
if (step === 1 && currentDstStride === 1 && currentSourceStride === 1) {
|
|
109100
|
-
dstArr.set(sourceArr.subarray(0, outputSize), from);
|
|
109101
|
-
} else {
|
|
109102
|
-
for (let i2 = 0; i2 < outputSize; i2++) {
|
|
109103
|
-
dstArr[currentDstStride * (from + step * i2)] = sourceArr[currentSourceStride * i2];
|
|
109104
|
-
}
|
|
109105
|
-
}
|
|
109106
|
-
return;
|
|
109107
|
-
}
|
|
109108
|
-
for (let i2 = 0; i2 < outputSize; i2++) {
|
|
109109
|
-
_setRawArray(dstArr.subarray(currentDstStride * (from + i2 * step)), nextDstStrides, nextDstSliceIndices, sourceArr.subarray(currentSourceStride * i2), nextSourceStrides);
|
|
109110
|
-
}
|
|
109111
|
-
}
|
|
109112
|
-
function _setRawArrayFromChunkItem(dstArr, dstStrides, dstSliceIndices, sourceArr, sourceStrides, sourceSliceIndices) {
|
|
109113
|
-
if (sourceSliceIndices.length === 0) {
|
|
109114
|
-
dstArr.set(sourceArr.subarray(0, dstArr.length));
|
|
109115
|
-
return;
|
|
109116
|
-
}
|
|
109117
|
-
const [currentDstSlice, ...nextDstSliceIndices] = dstSliceIndices;
|
|
109118
|
-
const [currentSourceSlice, ...nextSourceSliceIndices] = sourceSliceIndices;
|
|
109119
|
-
const [currentDstStride, ...nextDstStrides] = dstStrides;
|
|
109120
|
-
const [currentSourceStride, ...nextSourceStrides] = sourceStrides;
|
|
109121
|
-
if (typeof currentSourceSlice === "number") {
|
|
109122
|
-
_setRawArrayFromChunkItem(
|
|
109123
|
-
// Don't update destination offset/slices, just source
|
|
109124
|
-
dstArr,
|
|
109125
|
-
dstStrides,
|
|
109126
|
-
dstSliceIndices,
|
|
109127
|
-
sourceArr.subarray(currentSourceStride * currentSourceSlice),
|
|
109128
|
-
nextSourceStrides,
|
|
109129
|
-
nextSourceSliceIndices
|
|
109130
|
-
);
|
|
109131
|
-
return;
|
|
109132
|
-
}
|
|
109133
|
-
const [from, _to, step, outputSize] = currentDstSlice;
|
|
109134
|
-
const [sfrom, _sto, sstep, _soutputSize] = currentSourceSlice;
|
|
109135
|
-
if (dstStrides.length === 1 && sourceStrides.length === 1) {
|
|
109136
|
-
if (step === 1 && currentDstStride === 1 && sstep === 1 && currentSourceStride === 1) {
|
|
109137
|
-
dstArr.set(sourceArr.subarray(sfrom, sfrom + outputSize), from);
|
|
109138
|
-
} else {
|
|
109139
|
-
for (let i2 = 0; i2 < outputSize; i2++) {
|
|
109140
|
-
dstArr[currentDstStride * (from + step * i2)] = sourceArr[currentSourceStride * (sfrom + sstep * i2)];
|
|
109141
|
-
}
|
|
109142
|
-
}
|
|
109143
|
-
return;
|
|
109144
|
-
}
|
|
109145
|
-
for (let i2 = 0; i2 < outputSize; i2++) {
|
|
109146
|
-
_setRawArrayFromChunkItem(dstArr.subarray(currentDstStride * (from + i2 * step)), nextDstStrides, nextDstSliceIndices, sourceArr.subarray(currentSourceStride * (sfrom + i2 * sstep)), nextSourceStrides, nextSourceSliceIndices);
|
|
109147
|
-
}
|
|
109148
|
-
}
|
|
109149
|
-
class RawArray {
|
|
109150
|
-
constructor(data, shape, dtype, strides) {
|
|
109151
|
-
const dataIsTypedArray = data !== null && !!data.BYTES_PER_ELEMENT;
|
|
109152
|
-
if (shape === void 0) {
|
|
109153
|
-
if (!dataIsTypedArray) {
|
|
109154
|
-
throw new ValueError("Shape argument is required unless you pass in a TypedArray");
|
|
109155
|
-
}
|
|
109156
|
-
shape = [data.length];
|
|
109157
|
-
}
|
|
109158
|
-
shape = normalizeShape(shape);
|
|
109159
|
-
if (dtype === void 0) {
|
|
109160
|
-
if (!dataIsTypedArray) {
|
|
109161
|
-
throw new ValueError("Dtype argument is required unless you pass in a TypedArray");
|
|
109162
|
-
}
|
|
109163
|
-
dtype = getTypedArrayDtypeString(data);
|
|
109164
|
-
}
|
|
109165
|
-
if (strides === void 0) {
|
|
109166
|
-
strides = getStrides(shape);
|
|
109167
|
-
}
|
|
109168
|
-
this.shape = shape;
|
|
109169
|
-
this.dtype = dtype;
|
|
109170
|
-
this.strides = strides;
|
|
109171
|
-
if (dataIsTypedArray && shape.length !== 1) {
|
|
109172
|
-
data = data.buffer;
|
|
109173
|
-
}
|
|
109174
|
-
if (this.shape.length === 0) {
|
|
109175
|
-
this.data = new (getTypedArrayCtr(dtype))(1);
|
|
109176
|
-
} else if (
|
|
109177
|
-
// tslint:disable-next-line: strict-type-predicates
|
|
109178
|
-
IS_NODE$1 && Buffer.isBuffer(data) || data instanceof ArrayBuffer || data === null || data.toString().startsWith("[object ArrayBuffer]")
|
|
109179
|
-
) {
|
|
109180
|
-
const numShapeElements = shape.reduce((x2, y2) => x2 * y2, 1);
|
|
109181
|
-
if (data === null) {
|
|
109182
|
-
data = new ArrayBuffer(numShapeElements * parseInt(dtype[dtype.length - 1], 10));
|
|
109183
|
-
}
|
|
109184
|
-
const numDataElements = data.byteLength / parseInt(dtype[dtype.length - 1], 10);
|
|
109185
|
-
if (numShapeElements !== numDataElements) {
|
|
109186
|
-
throw new Error(`Buffer has ${numDataElements} of dtype ${dtype}, shape is too large or small ${shape} (flat=${numShapeElements})`);
|
|
109187
|
-
}
|
|
109188
|
-
const typeConstructor = getTypedArrayCtr(dtype);
|
|
109189
|
-
this.data = new typeConstructor(data);
|
|
109190
|
-
} else {
|
|
109191
|
-
this.data = data;
|
|
109192
|
-
}
|
|
109193
|
-
}
|
|
109194
|
-
set(selection = null, value, chunkSelection) {
|
|
109195
|
-
if (selection === null) {
|
|
109196
|
-
selection = [slice(null)];
|
|
109197
|
-
}
|
|
109198
|
-
if (typeof value === "number") {
|
|
109199
|
-
if (this.shape.length === 0) {
|
|
109200
|
-
this.data[0] = value;
|
|
109201
|
-
} else {
|
|
109202
|
-
setRawArrayToScalar(this.data, this.strides, this.shape, selection, value);
|
|
109203
|
-
}
|
|
109204
|
-
} else if (value instanceof RawArray && chunkSelection) {
|
|
109205
|
-
setRawArrayFromChunkItem(this.data, this.strides, this.shape, selection, value.data, value.strides, value.shape, chunkSelection);
|
|
109206
|
-
} else {
|
|
109207
|
-
setRawArray(this.data, this.strides, this.shape, selection, value.data, value.strides, value.shape);
|
|
109208
|
-
}
|
|
109209
|
-
}
|
|
109210
|
-
}
|
|
108005
|
+
typeof process !== "undefined" && process.versions && process.versions.node;
|
|
109211
108006
|
function createCommonjsModule(fn) {
|
|
109212
108007
|
var module2 = { exports: {} };
|
|
109213
108008
|
return fn(module2, module2.exports), module2.exports;
|
|
109214
108009
|
}
|
|
109215
|
-
|
|
108010
|
+
createCommonjsModule(function(module2) {
|
|
109216
108011
|
var has2 = Object.prototype.hasOwnProperty, prefix = "~";
|
|
109217
108012
|
function Events() {
|
|
109218
108013
|
}
|
|
@@ -109426,11 +108221,11 @@ const pTimeout = (promise, milliseconds, fallback) => new Promise((resolve, reje
|
|
|
109426
108221
|
return;
|
|
109427
108222
|
}
|
|
109428
108223
|
const message = typeof fallback === "string" ? fallback : `Promise timed out after ${milliseconds} milliseconds`;
|
|
109429
|
-
const
|
|
108224
|
+
const timeoutError = fallback instanceof Error ? fallback : new TimeoutError(message);
|
|
109430
108225
|
if (typeof promise.cancel === "function") {
|
|
109431
108226
|
promise.cancel();
|
|
109432
108227
|
}
|
|
109433
|
-
reject(
|
|
108228
|
+
reject(timeoutError);
|
|
109434
108229
|
}, milliseconds);
|
|
109435
108230
|
pFinally(
|
|
109436
108231
|
// eslint-disable-next-line promise/prefer-await-to-then
|
|
@@ -109445,1140 +108240,14 @@ var _default$3 = pTimeout;
|
|
|
109445
108240
|
var TimeoutError_1 = TimeoutError;
|
|
109446
108241
|
pTimeout_1.default = _default$3;
|
|
109447
108242
|
pTimeout_1.TimeoutError = TimeoutError_1;
|
|
109448
|
-
|
|
109449
|
-
let first = 0;
|
|
109450
|
-
let count2 = array2.length;
|
|
109451
|
-
while (count2 > 0) {
|
|
109452
|
-
const step = count2 / 2 | 0;
|
|
109453
|
-
let it = first + step;
|
|
109454
|
-
if (comparator2(array2[it], value) <= 0) {
|
|
109455
|
-
first = ++it;
|
|
109456
|
-
count2 -= step + 1;
|
|
109457
|
-
} else {
|
|
109458
|
-
count2 = step;
|
|
109459
|
-
}
|
|
109460
|
-
}
|
|
109461
|
-
return first;
|
|
109462
|
-
}
|
|
109463
|
-
var _default$2 = lowerBound;
|
|
109464
|
-
var lowerBound_1 = /* @__PURE__ */ Object.defineProperty({
|
|
109465
|
-
default: _default$2
|
|
109466
|
-
}, "__esModule", { value: true });
|
|
109467
|
-
class PriorityQueue {
|
|
109468
|
-
constructor() {
|
|
109469
|
-
this._queue = [];
|
|
109470
|
-
}
|
|
109471
|
-
enqueue(run, options) {
|
|
109472
|
-
options = Object.assign({ priority: 0 }, options);
|
|
109473
|
-
const element = {
|
|
109474
|
-
priority: options.priority,
|
|
109475
|
-
run
|
|
109476
|
-
};
|
|
109477
|
-
if (this.size && this._queue[this.size - 1].priority >= options.priority) {
|
|
109478
|
-
this._queue.push(element);
|
|
109479
|
-
return;
|
|
109480
|
-
}
|
|
109481
|
-
const index2 = lowerBound_1.default(this._queue, element, (a2, b) => b.priority - a2.priority);
|
|
109482
|
-
this._queue.splice(index2, 0, element);
|
|
109483
|
-
}
|
|
109484
|
-
dequeue() {
|
|
109485
|
-
const item = this._queue.shift();
|
|
109486
|
-
return item && item.run;
|
|
109487
|
-
}
|
|
109488
|
-
get size() {
|
|
109489
|
-
return this._queue.length;
|
|
109490
|
-
}
|
|
109491
|
-
}
|
|
109492
|
-
var _default$1 = PriorityQueue;
|
|
109493
|
-
var priorityQueue = /* @__PURE__ */ Object.defineProperty({
|
|
109494
|
-
default: _default$1
|
|
109495
|
-
}, "__esModule", { value: true });
|
|
109496
|
-
const empty$1 = () => {
|
|
109497
|
-
};
|
|
109498
|
-
const timeoutError = new pTimeout_1.default.TimeoutError();
|
|
109499
|
-
class PQueue extends eventemitter3 {
|
|
109500
|
-
constructor(options) {
|
|
109501
|
-
super();
|
|
109502
|
-
this._intervalCount = 0;
|
|
109503
|
-
this._intervalEnd = 0;
|
|
109504
|
-
this._pendingCount = 0;
|
|
109505
|
-
this._resolveEmpty = empty$1;
|
|
109506
|
-
this._resolveIdle = empty$1;
|
|
109507
|
-
options = Object.assign(
|
|
109508
|
-
{ carryoverConcurrencyCount: false, intervalCap: Infinity, interval: 0, concurrency: Infinity, autoStart: true, queueClass: priorityQueue.default },
|
|
109509
|
-
options
|
|
109510
|
-
// TODO: Remove this `as`.
|
|
109511
|
-
);
|
|
109512
|
-
if (!(typeof options.intervalCap === "number" && options.intervalCap >= 1)) {
|
|
109513
|
-
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${options.intervalCap}\` (${typeof options.intervalCap})`);
|
|
109514
|
-
}
|
|
109515
|
-
if (options.interval === void 0 || !(Number.isFinite(options.interval) && options.interval >= 0)) {
|
|
109516
|
-
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${options.interval}\` (${typeof options.interval})`);
|
|
109517
|
-
}
|
|
109518
|
-
this._carryoverConcurrencyCount = options.carryoverConcurrencyCount;
|
|
109519
|
-
this._isIntervalIgnored = options.intervalCap === Infinity || options.interval === 0;
|
|
109520
|
-
this._intervalCap = options.intervalCap;
|
|
109521
|
-
this._interval = options.interval;
|
|
109522
|
-
this._queue = new options.queueClass();
|
|
109523
|
-
this._queueClass = options.queueClass;
|
|
109524
|
-
this.concurrency = options.concurrency;
|
|
109525
|
-
this._timeout = options.timeout;
|
|
109526
|
-
this._throwOnTimeout = options.throwOnTimeout === true;
|
|
109527
|
-
this._isPaused = options.autoStart === false;
|
|
109528
|
-
}
|
|
109529
|
-
get _doesIntervalAllowAnother() {
|
|
109530
|
-
return this._isIntervalIgnored || this._intervalCount < this._intervalCap;
|
|
109531
|
-
}
|
|
109532
|
-
get _doesConcurrentAllowAnother() {
|
|
109533
|
-
return this._pendingCount < this._concurrency;
|
|
109534
|
-
}
|
|
109535
|
-
_next() {
|
|
109536
|
-
this._pendingCount--;
|
|
109537
|
-
this._tryToStartAnother();
|
|
109538
|
-
}
|
|
109539
|
-
_resolvePromises() {
|
|
109540
|
-
this._resolveEmpty();
|
|
109541
|
-
this._resolveEmpty = empty$1;
|
|
109542
|
-
if (this._pendingCount === 0) {
|
|
109543
|
-
this._resolveIdle();
|
|
109544
|
-
this._resolveIdle = empty$1;
|
|
109545
|
-
}
|
|
109546
|
-
}
|
|
109547
|
-
_onResumeInterval() {
|
|
109548
|
-
this._onInterval();
|
|
109549
|
-
this._initializeIntervalIfNeeded();
|
|
109550
|
-
this._timeoutId = void 0;
|
|
109551
|
-
}
|
|
109552
|
-
_isIntervalPaused() {
|
|
109553
|
-
const now2 = Date.now();
|
|
109554
|
-
if (this._intervalId === void 0) {
|
|
109555
|
-
const delay = this._intervalEnd - now2;
|
|
109556
|
-
if (delay < 0) {
|
|
109557
|
-
this._intervalCount = this._carryoverConcurrencyCount ? this._pendingCount : 0;
|
|
109558
|
-
} else {
|
|
109559
|
-
if (this._timeoutId === void 0) {
|
|
109560
|
-
this._timeoutId = setTimeout(() => {
|
|
109561
|
-
this._onResumeInterval();
|
|
109562
|
-
}, delay);
|
|
109563
|
-
}
|
|
109564
|
-
return true;
|
|
109565
|
-
}
|
|
109566
|
-
}
|
|
109567
|
-
return false;
|
|
109568
|
-
}
|
|
109569
|
-
_tryToStartAnother() {
|
|
109570
|
-
if (this._queue.size === 0) {
|
|
109571
|
-
if (this._intervalId) {
|
|
109572
|
-
clearInterval(this._intervalId);
|
|
109573
|
-
}
|
|
109574
|
-
this._intervalId = void 0;
|
|
109575
|
-
this._resolvePromises();
|
|
109576
|
-
return false;
|
|
109577
|
-
}
|
|
109578
|
-
if (!this._isPaused) {
|
|
109579
|
-
const canInitializeInterval = !this._isIntervalPaused();
|
|
109580
|
-
if (this._doesIntervalAllowAnother && this._doesConcurrentAllowAnother) {
|
|
109581
|
-
this.emit("active");
|
|
109582
|
-
this._queue.dequeue()();
|
|
109583
|
-
if (canInitializeInterval) {
|
|
109584
|
-
this._initializeIntervalIfNeeded();
|
|
109585
|
-
}
|
|
109586
|
-
return true;
|
|
109587
|
-
}
|
|
109588
|
-
}
|
|
109589
|
-
return false;
|
|
109590
|
-
}
|
|
109591
|
-
_initializeIntervalIfNeeded() {
|
|
109592
|
-
if (this._isIntervalIgnored || this._intervalId !== void 0) {
|
|
109593
|
-
return;
|
|
109594
|
-
}
|
|
109595
|
-
this._intervalId = setInterval(() => {
|
|
109596
|
-
this._onInterval();
|
|
109597
|
-
}, this._interval);
|
|
109598
|
-
this._intervalEnd = Date.now() + this._interval;
|
|
109599
|
-
}
|
|
109600
|
-
_onInterval() {
|
|
109601
|
-
if (this._intervalCount === 0 && this._pendingCount === 0 && this._intervalId) {
|
|
109602
|
-
clearInterval(this._intervalId);
|
|
109603
|
-
this._intervalId = void 0;
|
|
109604
|
-
}
|
|
109605
|
-
this._intervalCount = this._carryoverConcurrencyCount ? this._pendingCount : 0;
|
|
109606
|
-
this._processQueue();
|
|
109607
|
-
}
|
|
109608
|
-
/**
|
|
109609
|
-
Executes all queued functions until it reaches the limit.
|
|
109610
|
-
*/
|
|
109611
|
-
_processQueue() {
|
|
109612
|
-
while (this._tryToStartAnother()) {
|
|
109613
|
-
}
|
|
109614
|
-
}
|
|
109615
|
-
get concurrency() {
|
|
109616
|
-
return this._concurrency;
|
|
109617
|
-
}
|
|
109618
|
-
set concurrency(newConcurrency) {
|
|
109619
|
-
if (!(typeof newConcurrency === "number" && newConcurrency >= 1)) {
|
|
109620
|
-
throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${newConcurrency}\` (${typeof newConcurrency})`);
|
|
109621
|
-
}
|
|
109622
|
-
this._concurrency = newConcurrency;
|
|
109623
|
-
this._processQueue();
|
|
109624
|
-
}
|
|
109625
|
-
/**
|
|
109626
|
-
Adds a sync or async task to the queue. Always returns a promise.
|
|
109627
|
-
*/
|
|
109628
|
-
async add(fn, options = {}) {
|
|
109629
|
-
return new Promise((resolve, reject) => {
|
|
109630
|
-
const run = async () => {
|
|
109631
|
-
this._pendingCount++;
|
|
109632
|
-
this._intervalCount++;
|
|
109633
|
-
try {
|
|
109634
|
-
const operation = this._timeout === void 0 && options.timeout === void 0 ? fn() : pTimeout_1.default(Promise.resolve(fn()), options.timeout === void 0 ? this._timeout : options.timeout, () => {
|
|
109635
|
-
if (options.throwOnTimeout === void 0 ? this._throwOnTimeout : options.throwOnTimeout) {
|
|
109636
|
-
reject(timeoutError);
|
|
109637
|
-
}
|
|
109638
|
-
return void 0;
|
|
109639
|
-
});
|
|
109640
|
-
resolve(await operation);
|
|
109641
|
-
} catch (error2) {
|
|
109642
|
-
reject(error2);
|
|
109643
|
-
}
|
|
109644
|
-
this._next();
|
|
109645
|
-
};
|
|
109646
|
-
this._queue.enqueue(run, options);
|
|
109647
|
-
this._tryToStartAnother();
|
|
109648
|
-
});
|
|
109649
|
-
}
|
|
109650
|
-
/**
|
|
109651
|
-
Same as `.add()`, but accepts an array of sync or async functions.
|
|
109652
|
-
|
|
109653
|
-
@returns A promise that resolves when all functions are resolved.
|
|
109654
|
-
*/
|
|
109655
|
-
async addAll(functions, options) {
|
|
109656
|
-
return Promise.all(functions.map(async (function_) => this.add(function_, options)));
|
|
109657
|
-
}
|
|
109658
|
-
/**
|
|
109659
|
-
Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)
|
|
109660
|
-
*/
|
|
109661
|
-
start() {
|
|
109662
|
-
if (!this._isPaused) {
|
|
109663
|
-
return this;
|
|
109664
|
-
}
|
|
109665
|
-
this._isPaused = false;
|
|
109666
|
-
this._processQueue();
|
|
109667
|
-
return this;
|
|
109668
|
-
}
|
|
109669
|
-
/**
|
|
109670
|
-
Put queue execution on hold.
|
|
109671
|
-
*/
|
|
109672
|
-
pause() {
|
|
109673
|
-
this._isPaused = true;
|
|
109674
|
-
}
|
|
109675
|
-
/**
|
|
109676
|
-
Clear the queue.
|
|
109677
|
-
*/
|
|
109678
|
-
clear() {
|
|
109679
|
-
this._queue = new this._queueClass();
|
|
109680
|
-
}
|
|
109681
|
-
/**
|
|
109682
|
-
Can be called multiple times. Useful if you for example add additional items at a later time.
|
|
109683
|
-
|
|
109684
|
-
@returns A promise that settles when the queue becomes empty.
|
|
109685
|
-
*/
|
|
109686
|
-
async onEmpty() {
|
|
109687
|
-
if (this._queue.size === 0) {
|
|
109688
|
-
return;
|
|
109689
|
-
}
|
|
109690
|
-
return new Promise((resolve) => {
|
|
109691
|
-
const existingResolve = this._resolveEmpty;
|
|
109692
|
-
this._resolveEmpty = () => {
|
|
109693
|
-
existingResolve();
|
|
109694
|
-
resolve();
|
|
109695
|
-
};
|
|
109696
|
-
});
|
|
109697
|
-
}
|
|
109698
|
-
/**
|
|
109699
|
-
The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is empty, but it could mean that some promises haven't completed yet.
|
|
109700
|
-
|
|
109701
|
-
@returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.
|
|
109702
|
-
*/
|
|
109703
|
-
async onIdle() {
|
|
109704
|
-
if (this._pendingCount === 0 && this._queue.size === 0) {
|
|
109705
|
-
return;
|
|
109706
|
-
}
|
|
109707
|
-
return new Promise((resolve) => {
|
|
109708
|
-
const existingResolve = this._resolveIdle;
|
|
109709
|
-
this._resolveIdle = () => {
|
|
109710
|
-
existingResolve();
|
|
109711
|
-
resolve();
|
|
109712
|
-
};
|
|
109713
|
-
});
|
|
109714
|
-
}
|
|
109715
|
-
/**
|
|
109716
|
-
Size of the queue.
|
|
109717
|
-
*/
|
|
109718
|
-
get size() {
|
|
109719
|
-
return this._queue.size;
|
|
109720
|
-
}
|
|
109721
|
-
/**
|
|
109722
|
-
Number of pending promises.
|
|
109723
|
-
*/
|
|
109724
|
-
get pending() {
|
|
109725
|
-
return this._pendingCount;
|
|
109726
|
-
}
|
|
109727
|
-
/**
|
|
109728
|
-
Whether the queue is currently paused.
|
|
109729
|
-
*/
|
|
109730
|
-
get isPaused() {
|
|
109731
|
-
return this._isPaused;
|
|
109732
|
-
}
|
|
109733
|
-
/**
|
|
109734
|
-
Set the timeout for future operations.
|
|
109735
|
-
*/
|
|
109736
|
-
set timeout(milliseconds) {
|
|
109737
|
-
this._timeout = milliseconds;
|
|
109738
|
-
}
|
|
109739
|
-
get timeout() {
|
|
109740
|
-
return this._timeout;
|
|
109741
|
-
}
|
|
109742
|
-
}
|
|
109743
|
-
var _default = PQueue;
|
|
109744
|
-
class ZarrArray {
|
|
109745
|
-
/**
|
|
109746
|
-
* Instantiate an array from an initialized store.
|
|
109747
|
-
* @param store Array store, already initialized.
|
|
109748
|
-
* @param path Storage path.
|
|
109749
|
-
* @param metadata The initial value for the metadata
|
|
109750
|
-
* @param readOnly True if array should be protected against modification.
|
|
109751
|
-
* @param chunkStore Separate storage for chunks. If not provided, `store` will be used for storage of both chunks and metadata.
|
|
109752
|
-
* @param cacheMetadata If true (default), array configuration metadata will be cached for the lifetime of the object.
|
|
109753
|
-
* If false, array metadata will be reloaded prior to all data access and modification operations (may incur overhead depending on storage and data access pattern).
|
|
109754
|
-
* @param cacheAttrs If true (default), user attributes will be cached for attribute read operations.
|
|
109755
|
-
* If false, user attributes are reloaded from the store prior to all attribute read operations.
|
|
109756
|
-
*/
|
|
109757
|
-
constructor(store, path = null, metadata, readOnly = false, chunkStore = null, cacheMetadata = true, cacheAttrs = true) {
|
|
109758
|
-
this.store = store;
|
|
109759
|
-
this._chunkStore = chunkStore;
|
|
109760
|
-
this.path = normalizeStoragePath(path);
|
|
109761
|
-
this.keyPrefix = pathToPrefix(this.path);
|
|
109762
|
-
this.readOnly = readOnly;
|
|
109763
|
-
this.cacheMetadata = cacheMetadata;
|
|
109764
|
-
this.cacheAttrs = cacheAttrs;
|
|
109765
|
-
this.meta = metadata;
|
|
109766
|
-
if (this.meta.compressor !== null) {
|
|
109767
|
-
this.compressor = getCodec(this.meta.compressor);
|
|
109768
|
-
} else {
|
|
109769
|
-
this.compressor = null;
|
|
109770
|
-
}
|
|
109771
|
-
const attrKey = this.keyPrefix + ATTRS_META_KEY;
|
|
109772
|
-
this.attrs = new Attributes(this.store, attrKey, this.readOnly, cacheAttrs);
|
|
109773
|
-
}
|
|
109774
|
-
/**
|
|
109775
|
-
* A `Store` providing the underlying storage for array chunks.
|
|
109776
|
-
*/
|
|
109777
|
-
get chunkStore() {
|
|
109778
|
-
if (this._chunkStore) {
|
|
109779
|
-
return this._chunkStore;
|
|
109780
|
-
}
|
|
109781
|
-
return this.store;
|
|
109782
|
-
}
|
|
109783
|
-
/**
|
|
109784
|
-
* Array name following h5py convention.
|
|
109785
|
-
*/
|
|
109786
|
-
get name() {
|
|
109787
|
-
if (this.path.length > 0) {
|
|
109788
|
-
if (this.path[0] !== "/") {
|
|
109789
|
-
return "/" + this.path;
|
|
109790
|
-
}
|
|
109791
|
-
return this.path;
|
|
109792
|
-
}
|
|
109793
|
-
return null;
|
|
109794
|
-
}
|
|
109795
|
-
/**
|
|
109796
|
-
* Final component of name.
|
|
109797
|
-
*/
|
|
109798
|
-
get basename() {
|
|
109799
|
-
const name2 = this.name;
|
|
109800
|
-
if (name2 === null) {
|
|
109801
|
-
return null;
|
|
109802
|
-
}
|
|
109803
|
-
const parts = name2.split("/");
|
|
109804
|
-
return parts[parts.length - 1];
|
|
109805
|
-
}
|
|
109806
|
-
/**
|
|
109807
|
-
* "A list of integers describing the length of each dimension of the array.
|
|
109808
|
-
*/
|
|
109809
|
-
get shape() {
|
|
109810
|
-
return this.meta.shape;
|
|
109811
|
-
}
|
|
109812
|
-
/**
|
|
109813
|
-
* A list of integers describing the length of each dimension of a chunk of the array.
|
|
109814
|
-
*/
|
|
109815
|
-
get chunks() {
|
|
109816
|
-
return this.meta.chunks;
|
|
109817
|
-
}
|
|
109818
|
-
/**
|
|
109819
|
-
* Integer describing how many element a chunk contains
|
|
109820
|
-
*/
|
|
109821
|
-
get chunkSize() {
|
|
109822
|
-
return this.chunks.reduce((x2, y2) => x2 * y2, 1);
|
|
109823
|
-
}
|
|
109824
|
-
/**
|
|
109825
|
-
* The NumPy data type.
|
|
109826
|
-
*/
|
|
109827
|
-
get dtype() {
|
|
109828
|
-
return this.meta.dtype;
|
|
109829
|
-
}
|
|
109830
|
-
/**
|
|
109831
|
-
* A value used for uninitialized portions of the array.
|
|
109832
|
-
*/
|
|
109833
|
-
get fillValue() {
|
|
109834
|
-
const fillTypeValue = this.meta.fill_value;
|
|
109835
|
-
if (fillTypeValue === "NaN") {
|
|
109836
|
-
return NaN;
|
|
109837
|
-
} else if (fillTypeValue === "Infinity") {
|
|
109838
|
-
return Infinity;
|
|
109839
|
-
} else if (fillTypeValue === "-Infinity") {
|
|
109840
|
-
return -Infinity;
|
|
109841
|
-
}
|
|
109842
|
-
return this.meta.fill_value;
|
|
109843
|
-
}
|
|
109844
|
-
/**
|
|
109845
|
-
* Number of dimensions.
|
|
109846
|
-
*/
|
|
109847
|
-
get nDims() {
|
|
109848
|
-
return this.meta.shape.length;
|
|
109849
|
-
}
|
|
109850
|
-
/**
|
|
109851
|
-
* The total number of elements in the array.
|
|
109852
|
-
*/
|
|
109853
|
-
get size() {
|
|
109854
|
-
return this.meta.shape.reduce((x2, y2) => x2 * y2, 1);
|
|
109855
|
-
}
|
|
109856
|
-
get length() {
|
|
109857
|
-
return this.shape[0];
|
|
109858
|
-
}
|
|
109859
|
-
get _chunkDataShape() {
|
|
109860
|
-
if (this.shape === []) {
|
|
109861
|
-
return [1];
|
|
109862
|
-
} else {
|
|
109863
|
-
const s2 = [];
|
|
109864
|
-
for (let i2 = 0; i2 < this.shape.length; i2++) {
|
|
109865
|
-
s2[i2] = Math.ceil(this.shape[i2] / this.chunks[i2]);
|
|
109866
|
-
}
|
|
109867
|
-
return s2;
|
|
109868
|
-
}
|
|
109869
|
-
}
|
|
109870
|
-
/**
|
|
109871
|
-
* A tuple of integers describing the number of chunks along each
|
|
109872
|
-
* dimension of the array.
|
|
109873
|
-
*/
|
|
109874
|
-
get chunkDataShape() {
|
|
109875
|
-
return this._chunkDataShape;
|
|
109876
|
-
}
|
|
109877
|
-
/**
|
|
109878
|
-
* Total number of chunks.
|
|
109879
|
-
*/
|
|
109880
|
-
get numChunks() {
|
|
109881
|
-
return this.chunkDataShape.reduce((x2, y2) => x2 * y2, 1);
|
|
109882
|
-
}
|
|
109883
|
-
/**
|
|
109884
|
-
* Instantiate an array from an initialized store.
|
|
109885
|
-
* @param store Array store, already initialized.
|
|
109886
|
-
* @param path Storage path.
|
|
109887
|
-
* @param readOnly True if array should be protected against modification.
|
|
109888
|
-
* @param chunkStore Separate storage for chunks. If not provided, `store` will be used for storage of both chunks and metadata.
|
|
109889
|
-
* @param cacheMetadata If true (default), array configuration metadata will be cached for the lifetime of the object.
|
|
109890
|
-
* If false, array metadata will be reloaded prior to all data access and modification operations (may incur overhead depending on storage and data access pattern).
|
|
109891
|
-
* @param cacheAttrs If true (default), user attributes will be cached for attribute read operations.
|
|
109892
|
-
* If false, user attributes are reloaded from the store prior to all attribute read operations.
|
|
109893
|
-
*/
|
|
109894
|
-
static async create(store, path = null, readOnly = false, chunkStore = null, cacheMetadata = true, cacheAttrs = true) {
|
|
109895
|
-
const metadata = await this.loadMetadataForConstructor(store, path);
|
|
109896
|
-
return new ZarrArray(store, path, metadata, readOnly, chunkStore, cacheMetadata, cacheAttrs);
|
|
109897
|
-
}
|
|
109898
|
-
static async loadMetadataForConstructor(store, path) {
|
|
109899
|
-
try {
|
|
109900
|
-
path = normalizeStoragePath(path);
|
|
109901
|
-
const keyPrefix = pathToPrefix(path);
|
|
109902
|
-
const metaStoreValue = await store.getItem(keyPrefix + ARRAY_META_KEY);
|
|
109903
|
-
return parseMetadata(metaStoreValue);
|
|
109904
|
-
} catch (error2) {
|
|
109905
|
-
if (await containsGroup(store, path)) {
|
|
109906
|
-
throw new ContainsGroupError(path !== null && path !== void 0 ? path : "");
|
|
109907
|
-
}
|
|
109908
|
-
throw new Error("Failed to load metadata for ZarrArray:" + error2.toString());
|
|
109909
|
-
}
|
|
109910
|
-
}
|
|
109911
|
-
/**
|
|
109912
|
-
* (Re)load metadata from store
|
|
109913
|
-
*/
|
|
109914
|
-
async reloadMetadata() {
|
|
109915
|
-
const metaKey = this.keyPrefix + ARRAY_META_KEY;
|
|
109916
|
-
const metaStoreValue = this.store.getItem(metaKey);
|
|
109917
|
-
this.meta = parseMetadata(await metaStoreValue);
|
|
109918
|
-
return this.meta;
|
|
109919
|
-
}
|
|
109920
|
-
async refreshMetadata() {
|
|
109921
|
-
if (!this.cacheMetadata) {
|
|
109922
|
-
await this.reloadMetadata();
|
|
109923
|
-
}
|
|
109924
|
-
}
|
|
109925
|
-
get(selection = null, opts2 = {}) {
|
|
109926
|
-
return this.getBasicSelection(selection, false, opts2);
|
|
109927
|
-
}
|
|
109928
|
-
getRaw(selection = null, opts2 = {}) {
|
|
109929
|
-
return this.getBasicSelection(selection, true, opts2);
|
|
109930
|
-
}
|
|
109931
|
-
async getBasicSelection(selection, asRaw = false, { concurrencyLimit = 10, progressCallback } = {}) {
|
|
109932
|
-
if (!this.cacheMetadata) {
|
|
109933
|
-
await this.reloadMetadata();
|
|
109934
|
-
}
|
|
109935
|
-
if (this.shape === []) {
|
|
109936
|
-
throw new Error("Shape [] indexing is not supported yet");
|
|
109937
|
-
} else {
|
|
109938
|
-
return this.getBasicSelectionND(selection, asRaw, concurrencyLimit, progressCallback);
|
|
109939
|
-
}
|
|
109940
|
-
}
|
|
109941
|
-
getBasicSelectionND(selection, asRaw, concurrencyLimit, progressCallback) {
|
|
109942
|
-
const indexer = new BasicIndexer(selection, this);
|
|
109943
|
-
return this.getSelection(indexer, asRaw, concurrencyLimit, progressCallback);
|
|
109944
|
-
}
|
|
109945
|
-
async getSelection(indexer, asRaw, concurrencyLimit, progressCallback) {
|
|
109946
|
-
const outDtype = this.dtype;
|
|
109947
|
-
const outShape = indexer.shape;
|
|
109948
|
-
const outSize = indexer.shape.reduce((x2, y2) => x2 * y2, 1);
|
|
109949
|
-
if (asRaw && outSize === this.chunkSize) {
|
|
109950
|
-
const itr = indexer.iter();
|
|
109951
|
-
const proj = itr.next();
|
|
109952
|
-
if (proj.done === false && itr.next().done === true) {
|
|
109953
|
-
const chunkProjection = proj.value;
|
|
109954
|
-
const out2 = await this.decodeDirectToRawArray(chunkProjection, outShape, outSize);
|
|
109955
|
-
return out2;
|
|
109956
|
-
}
|
|
109957
|
-
}
|
|
109958
|
-
const out = asRaw ? new RawArray(null, outShape, outDtype) : new NestedArray(null, outShape, outDtype);
|
|
109959
|
-
if (outSize === 0) {
|
|
109960
|
-
return out;
|
|
109961
|
-
}
|
|
109962
|
-
const queue = new _default({ concurrency: concurrencyLimit });
|
|
109963
|
-
if (progressCallback) {
|
|
109964
|
-
let progress = 0;
|
|
109965
|
-
let queueSize = 0;
|
|
109966
|
-
for (const _ of indexer.iter())
|
|
109967
|
-
queueSize += 1;
|
|
109968
|
-
progressCallback({ progress: 0, queueSize });
|
|
109969
|
-
for (const proj of indexer.iter()) {
|
|
109970
|
-
(async () => {
|
|
109971
|
-
await queue.add(() => this.chunkGetItem(proj.chunkCoords, proj.chunkSelection, out, proj.outSelection, indexer.dropAxes));
|
|
109972
|
-
progress += 1;
|
|
109973
|
-
progressCallback({ progress, queueSize });
|
|
109974
|
-
})();
|
|
109975
|
-
}
|
|
109976
|
-
} else {
|
|
109977
|
-
for (const proj of indexer.iter()) {
|
|
109978
|
-
queue.add(() => this.chunkGetItem(proj.chunkCoords, proj.chunkSelection, out, proj.outSelection, indexer.dropAxes));
|
|
109979
|
-
}
|
|
109980
|
-
}
|
|
109981
|
-
await queue.onIdle();
|
|
109982
|
-
if (out.shape.length === 0) {
|
|
109983
|
-
return out.data[0];
|
|
109984
|
-
}
|
|
109985
|
-
return out;
|
|
109986
|
-
}
|
|
109987
|
-
/**
|
|
109988
|
-
* Obtain part or whole of a chunk.
|
|
109989
|
-
* @param chunkCoords Indices of the chunk.
|
|
109990
|
-
* @param chunkSelection Location of region within the chunk to extract.
|
|
109991
|
-
* @param out Array to store result in.
|
|
109992
|
-
* @param outSelection Location of region within output array to store results in.
|
|
109993
|
-
* @param dropAxes Axes to squeeze out of the chunk.
|
|
109994
|
-
*/
|
|
109995
|
-
async chunkGetItem(chunkCoords, chunkSelection, out, outSelection, dropAxes) {
|
|
109996
|
-
if (chunkCoords.length !== this._chunkDataShape.length) {
|
|
109997
|
-
throw new ValueError(`Inconsistent shapes: chunkCoordsLength: ${chunkCoords.length}, cDataShapeLength: ${this.chunkDataShape.length}`);
|
|
109998
|
-
}
|
|
109999
|
-
const cKey = this.chunkKey(chunkCoords);
|
|
110000
|
-
try {
|
|
110001
|
-
const cdata = await this.chunkStore.getItem(cKey);
|
|
110002
|
-
const decodedChunk = await this.decodeChunk(cdata);
|
|
110003
|
-
if (out instanceof NestedArray) {
|
|
110004
|
-
if (isContiguousSelection(outSelection) && isTotalSlice(chunkSelection, this.chunks) && !this.meta.filters) {
|
|
110005
|
-
out.set(outSelection, this.toNestedArray(decodedChunk));
|
|
110006
|
-
return;
|
|
110007
|
-
}
|
|
110008
|
-
const chunk = this.toNestedArray(decodedChunk);
|
|
110009
|
-
const tmp = chunk.get(chunkSelection);
|
|
110010
|
-
if (dropAxes !== null) {
|
|
110011
|
-
throw new Error("Drop axes is not supported yet");
|
|
110012
|
-
}
|
|
110013
|
-
out.set(outSelection, tmp);
|
|
110014
|
-
} else {
|
|
110015
|
-
out.set(outSelection, this.chunkBufferToRawArray(decodedChunk), chunkSelection);
|
|
110016
|
-
}
|
|
110017
|
-
} catch (error2) {
|
|
110018
|
-
if (isKeyError(error2)) {
|
|
110019
|
-
if (this.fillValue !== null) {
|
|
110020
|
-
out.set(outSelection, this.fillValue);
|
|
110021
|
-
}
|
|
110022
|
-
} else {
|
|
110023
|
-
throw error2;
|
|
110024
|
-
}
|
|
110025
|
-
}
|
|
110026
|
-
}
|
|
110027
|
-
async getRawChunk(chunkCoords, opts2) {
|
|
110028
|
-
if (chunkCoords.length !== this.shape.length) {
|
|
110029
|
-
throw new Error(`Chunk coordinates ${chunkCoords.join(".")} do not correspond to shape ${this.shape}.`);
|
|
110030
|
-
}
|
|
110031
|
-
try {
|
|
110032
|
-
for (let i2 = 0; i2 < chunkCoords.length; i2++) {
|
|
110033
|
-
const dimLength = Math.ceil(this.shape[i2] / this.chunks[i2]);
|
|
110034
|
-
chunkCoords[i2] = normalizeIntegerSelection(chunkCoords[i2], dimLength);
|
|
110035
|
-
}
|
|
110036
|
-
} catch (error2) {
|
|
110037
|
-
if (error2 instanceof BoundsCheckError) {
|
|
110038
|
-
throw new BoundsCheckError(`index ${chunkCoords.join(".")} is out of bounds for shape: ${this.shape} and chunks ${this.chunks}`);
|
|
110039
|
-
} else {
|
|
110040
|
-
throw error2;
|
|
110041
|
-
}
|
|
110042
|
-
}
|
|
110043
|
-
const cKey = this.chunkKey(chunkCoords);
|
|
110044
|
-
const cdata = this.chunkStore.getItem(cKey, opts2 === null || opts2 === void 0 ? void 0 : opts2.storeOptions);
|
|
110045
|
-
const buffer2 = await this.decodeChunk(await cdata);
|
|
110046
|
-
const outShape = this.chunks.filter((d) => d !== 1);
|
|
110047
|
-
return new RawArray(buffer2, outShape, this.dtype);
|
|
110048
|
-
}
|
|
110049
|
-
chunkKey(chunkCoords) {
|
|
110050
|
-
var _a2;
|
|
110051
|
-
const sep = (_a2 = this.meta.dimension_separator) !== null && _a2 !== void 0 ? _a2 : ".";
|
|
110052
|
-
return this.keyPrefix + chunkCoords.join(sep);
|
|
110053
|
-
}
|
|
110054
|
-
ensureByteArray(chunkData) {
|
|
110055
|
-
if (typeof chunkData === "string") {
|
|
110056
|
-
return new Uint8Array(Buffer.from(chunkData).buffer);
|
|
110057
|
-
}
|
|
110058
|
-
return new Uint8Array(chunkData);
|
|
110059
|
-
}
|
|
110060
|
-
toTypedArray(buffer2) {
|
|
110061
|
-
return new (getTypedArrayCtr(this.dtype))(buffer2);
|
|
110062
|
-
}
|
|
110063
|
-
toNestedArray(data) {
|
|
110064
|
-
const buffer2 = this.ensureByteArray(data).buffer;
|
|
110065
|
-
return new NestedArray(buffer2, this.chunks, this.dtype);
|
|
110066
|
-
}
|
|
110067
|
-
async decodeChunk(chunkData) {
|
|
110068
|
-
let bytes = this.ensureByteArray(chunkData);
|
|
110069
|
-
if (this.compressor !== null) {
|
|
110070
|
-
bytes = await (await this.compressor).decode(bytes);
|
|
110071
|
-
}
|
|
110072
|
-
if (this.dtype.includes(">")) {
|
|
110073
|
-
byteSwapInplace(this.toTypedArray(bytes.buffer));
|
|
110074
|
-
}
|
|
110075
|
-
return bytes.buffer;
|
|
110076
|
-
}
|
|
110077
|
-
chunkBufferToRawArray(buffer2) {
|
|
110078
|
-
return new RawArray(buffer2, this.chunks, this.dtype);
|
|
110079
|
-
}
|
|
110080
|
-
async decodeDirectToRawArray({ chunkCoords }, outShape, outSize) {
|
|
110081
|
-
const cKey = this.chunkKey(chunkCoords);
|
|
110082
|
-
try {
|
|
110083
|
-
const cdata = await this.chunkStore.getItem(cKey);
|
|
110084
|
-
return new RawArray(await this.decodeChunk(cdata), outShape, this.dtype);
|
|
110085
|
-
} catch (error2) {
|
|
110086
|
-
if (isKeyError(error2)) {
|
|
110087
|
-
const data = new (getTypedArrayCtr(this.dtype))(outSize);
|
|
110088
|
-
return new RawArray(data.fill(this.fillValue), outShape);
|
|
110089
|
-
} else {
|
|
110090
|
-
throw error2;
|
|
110091
|
-
}
|
|
110092
|
-
}
|
|
110093
|
-
}
|
|
110094
|
-
async set(selection = null, value, opts2 = {}) {
|
|
110095
|
-
await this.setBasicSelection(selection, value, opts2);
|
|
110096
|
-
}
|
|
110097
|
-
async setBasicSelection(selection, value, { concurrencyLimit = 10, progressCallback } = {}) {
|
|
110098
|
-
if (this.readOnly) {
|
|
110099
|
-
throw new PermissionError("Object is read only");
|
|
110100
|
-
}
|
|
110101
|
-
if (!this.cacheMetadata) {
|
|
110102
|
-
await this.reloadMetadata();
|
|
110103
|
-
}
|
|
110104
|
-
if (this.shape === []) {
|
|
110105
|
-
throw new Error("Shape [] indexing is not supported yet");
|
|
110106
|
-
} else {
|
|
110107
|
-
await this.setBasicSelectionND(selection, value, concurrencyLimit, progressCallback);
|
|
110108
|
-
}
|
|
110109
|
-
}
|
|
110110
|
-
async setBasicSelectionND(selection, value, concurrencyLimit, progressCallback) {
|
|
110111
|
-
const indexer = new BasicIndexer(selection, this);
|
|
110112
|
-
await this.setSelection(indexer, value, concurrencyLimit, progressCallback);
|
|
110113
|
-
}
|
|
110114
|
-
getChunkValue(proj, indexer, value, selectionShape) {
|
|
110115
|
-
let chunkValue;
|
|
110116
|
-
if (selectionShape === []) {
|
|
110117
|
-
chunkValue = value;
|
|
110118
|
-
} else if (typeof value === "number") {
|
|
110119
|
-
chunkValue = value;
|
|
110120
|
-
} else {
|
|
110121
|
-
chunkValue = value.get(proj.outSelection);
|
|
110122
|
-
if (indexer.dropAxes !== null) {
|
|
110123
|
-
throw new Error("Handling drop axes not supported yet");
|
|
110124
|
-
}
|
|
110125
|
-
}
|
|
110126
|
-
return chunkValue;
|
|
110127
|
-
}
|
|
110128
|
-
async setSelection(indexer, value, concurrencyLimit, progressCallback) {
|
|
110129
|
-
const selectionShape = indexer.shape;
|
|
110130
|
-
if (selectionShape === [])
|
|
110131
|
-
;
|
|
110132
|
-
else if (typeof value === "number")
|
|
110133
|
-
;
|
|
110134
|
-
else if (value instanceof NestedArray) {
|
|
110135
|
-
if (!arrayEquals1D(value.shape, selectionShape)) {
|
|
110136
|
-
throw new ValueError(`Shape mismatch in source NestedArray and set selection: ${value.shape} and ${selectionShape}`);
|
|
110137
|
-
}
|
|
110138
|
-
} else {
|
|
110139
|
-
throw new Error("Unknown data type for setting :(");
|
|
110140
|
-
}
|
|
110141
|
-
const queue = new _default({ concurrency: concurrencyLimit });
|
|
110142
|
-
if (progressCallback) {
|
|
110143
|
-
let queueSize = 0;
|
|
110144
|
-
for (const _ of indexer.iter())
|
|
110145
|
-
queueSize += 1;
|
|
110146
|
-
let progress = 0;
|
|
110147
|
-
progressCallback({ progress: 0, queueSize });
|
|
110148
|
-
for (const proj of indexer.iter()) {
|
|
110149
|
-
const chunkValue = this.getChunkValue(proj, indexer, value, selectionShape);
|
|
110150
|
-
(async () => {
|
|
110151
|
-
await queue.add(() => this.chunkSetItem(proj.chunkCoords, proj.chunkSelection, chunkValue));
|
|
110152
|
-
progress += 1;
|
|
110153
|
-
progressCallback({ progress, queueSize });
|
|
110154
|
-
})();
|
|
110155
|
-
}
|
|
110156
|
-
} else {
|
|
110157
|
-
for (const proj of indexer.iter()) {
|
|
110158
|
-
const chunkValue = this.getChunkValue(proj, indexer, value, selectionShape);
|
|
110159
|
-
queue.add(() => this.chunkSetItem(proj.chunkCoords, proj.chunkSelection, chunkValue));
|
|
110160
|
-
}
|
|
110161
|
-
}
|
|
110162
|
-
await queue.onIdle();
|
|
110163
|
-
}
|
|
110164
|
-
async chunkSetItem(chunkCoords, chunkSelection, value) {
|
|
110165
|
-
const chunkKey = this.chunkKey(chunkCoords);
|
|
110166
|
-
let chunk = null;
|
|
110167
|
-
const dtypeConstr = getTypedArrayCtr(this.dtype);
|
|
110168
|
-
const chunkSize = this.chunkSize;
|
|
110169
|
-
if (isTotalSlice(chunkSelection, this.chunks)) {
|
|
110170
|
-
if (typeof value === "number") {
|
|
110171
|
-
chunk = new dtypeConstr(chunkSize);
|
|
110172
|
-
chunk.fill(value);
|
|
110173
|
-
} else {
|
|
110174
|
-
chunk = value.flatten();
|
|
110175
|
-
}
|
|
110176
|
-
} else {
|
|
110177
|
-
let chunkData2;
|
|
110178
|
-
try {
|
|
110179
|
-
const chunkStoreData = await this.chunkStore.getItem(chunkKey);
|
|
110180
|
-
const dBytes = await this.decodeChunk(chunkStoreData);
|
|
110181
|
-
chunkData2 = this.toTypedArray(dBytes);
|
|
110182
|
-
} catch (error2) {
|
|
110183
|
-
if (isKeyError(error2)) {
|
|
110184
|
-
chunkData2 = new dtypeConstr(chunkSize);
|
|
110185
|
-
if (this.fillValue !== null) {
|
|
110186
|
-
chunkData2.fill(this.fillValue);
|
|
110187
|
-
}
|
|
110188
|
-
} else {
|
|
110189
|
-
throw error2;
|
|
110190
|
-
}
|
|
110191
|
-
}
|
|
110192
|
-
const chunkNestedArray = new NestedArray(chunkData2, this.chunks, this.dtype);
|
|
110193
|
-
chunkNestedArray.set(chunkSelection, value);
|
|
110194
|
-
chunk = chunkNestedArray.flatten();
|
|
110195
|
-
}
|
|
110196
|
-
const chunkData = await this.encodeChunk(chunk);
|
|
110197
|
-
this.chunkStore.setItem(chunkKey, chunkData);
|
|
110198
|
-
}
|
|
110199
|
-
async encodeChunk(chunk) {
|
|
110200
|
-
if (this.dtype.includes(">")) {
|
|
110201
|
-
chunk = byteSwap(chunk);
|
|
110202
|
-
}
|
|
110203
|
-
if (this.compressor !== null) {
|
|
110204
|
-
const bytes = new Uint8Array(chunk.buffer);
|
|
110205
|
-
const cbytes = await (await this.compressor).encode(bytes);
|
|
110206
|
-
return cbytes.buffer;
|
|
110207
|
-
}
|
|
110208
|
-
return chunk.buffer;
|
|
110209
|
-
}
|
|
110210
|
-
}
|
|
110211
|
-
class MemoryStore {
|
|
110212
|
-
constructor(root2 = {}) {
|
|
110213
|
-
this.root = root2;
|
|
110214
|
-
}
|
|
110215
|
-
proxy() {
|
|
110216
|
-
return createProxy(this);
|
|
110217
|
-
}
|
|
110218
|
-
getParent(item) {
|
|
110219
|
-
let parent = this.root;
|
|
110220
|
-
const segments = item.split("/");
|
|
110221
|
-
for (const k of segments.slice(0, segments.length - 1)) {
|
|
110222
|
-
parent = parent[k];
|
|
110223
|
-
if (!parent) {
|
|
110224
|
-
throw Error(item);
|
|
110225
|
-
}
|
|
110226
|
-
}
|
|
110227
|
-
return [parent, segments[segments.length - 1]];
|
|
110228
|
-
}
|
|
110229
|
-
requireParent(item) {
|
|
110230
|
-
let parent = this.root;
|
|
110231
|
-
const segments = item.split("/");
|
|
110232
|
-
for (const k of segments.slice(0, segments.length - 1)) {
|
|
110233
|
-
if (parent[k] === void 0) {
|
|
110234
|
-
parent[k] = {};
|
|
110235
|
-
}
|
|
110236
|
-
parent = parent[k];
|
|
110237
|
-
}
|
|
110238
|
-
return [parent, segments[segments.length - 1]];
|
|
110239
|
-
}
|
|
110240
|
-
getItem(item) {
|
|
110241
|
-
const [parent, key] = this.getParent(item);
|
|
110242
|
-
const value = parent[key];
|
|
110243
|
-
if (value === void 0) {
|
|
110244
|
-
throw new KeyError(item);
|
|
110245
|
-
}
|
|
110246
|
-
return value;
|
|
110247
|
-
}
|
|
110248
|
-
setItem(item, value) {
|
|
110249
|
-
const [parent, key] = this.requireParent(item);
|
|
110250
|
-
parent[key] = value;
|
|
110251
|
-
return true;
|
|
110252
|
-
}
|
|
110253
|
-
deleteItem(item) {
|
|
110254
|
-
const [parent, key] = this.getParent(item);
|
|
110255
|
-
return delete parent[key];
|
|
110256
|
-
}
|
|
110257
|
-
containsItem(item) {
|
|
110258
|
-
try {
|
|
110259
|
-
return this.getItem(item) !== void 0;
|
|
110260
|
-
} catch (e2) {
|
|
110261
|
-
return false;
|
|
110262
|
-
}
|
|
110263
|
-
}
|
|
110264
|
-
keys() {
|
|
110265
|
-
throw new Error("Method not implemented.");
|
|
110266
|
-
}
|
|
110267
|
-
}
|
|
108243
|
+
new pTimeout_1.default.TimeoutError();
|
|
110268
108244
|
var HTTPMethod;
|
|
110269
108245
|
(function(HTTPMethod2) {
|
|
110270
108246
|
HTTPMethod2["HEAD"] = "HEAD";
|
|
110271
108247
|
HTTPMethod2["GET"] = "GET";
|
|
110272
108248
|
HTTPMethod2["PUT"] = "PUT";
|
|
110273
108249
|
})(HTTPMethod || (HTTPMethod = {}));
|
|
110274
|
-
|
|
110275
|
-
class HTTPStore {
|
|
110276
|
-
constructor(url, options = {}) {
|
|
110277
|
-
this.url = url;
|
|
110278
|
-
const { fetchOptions = {}, supportedMethods = DEFAULT_METHODS } = options;
|
|
110279
|
-
this.fetchOptions = fetchOptions;
|
|
110280
|
-
this.supportedMethods = new Set(supportedMethods);
|
|
110281
|
-
}
|
|
110282
|
-
keys() {
|
|
110283
|
-
throw new Error("Method not implemented.");
|
|
110284
|
-
}
|
|
110285
|
-
async getItem(item, opts2) {
|
|
110286
|
-
const url = joinUrlParts(this.url, item);
|
|
110287
|
-
const value = await fetch(url, { ...this.fetchOptions, ...opts2 });
|
|
110288
|
-
if (value.status === 404) {
|
|
110289
|
-
throw new KeyError(item);
|
|
110290
|
-
} else if (value.status !== 200) {
|
|
110291
|
-
throw new HTTPError(String(value.status));
|
|
110292
|
-
}
|
|
110293
|
-
if (IS_NODE$1) {
|
|
110294
|
-
return Buffer.from(await value.arrayBuffer());
|
|
110295
|
-
} else {
|
|
110296
|
-
return value.arrayBuffer();
|
|
110297
|
-
}
|
|
110298
|
-
}
|
|
110299
|
-
async setItem(item, value) {
|
|
110300
|
-
if (!this.supportedMethods.has(HTTPMethod.PUT)) {
|
|
110301
|
-
throw new Error("HTTP PUT no a supported method for store.");
|
|
110302
|
-
}
|
|
110303
|
-
const url = joinUrlParts(this.url, item);
|
|
110304
|
-
if (typeof value === "string") {
|
|
110305
|
-
value = new TextEncoder().encode(value).buffer;
|
|
110306
|
-
}
|
|
110307
|
-
const set = await fetch(url, { ...this.fetchOptions, method: HTTPMethod.PUT, body: value });
|
|
110308
|
-
return set.status.toString()[0] === "2";
|
|
110309
|
-
}
|
|
110310
|
-
deleteItem(_item) {
|
|
110311
|
-
throw new Error("Method not implemented.");
|
|
110312
|
-
}
|
|
110313
|
-
async containsItem(item) {
|
|
110314
|
-
const url = joinUrlParts(this.url, item);
|
|
110315
|
-
const method = this.supportedMethods.has(HTTPMethod.HEAD) ? HTTPMethod.HEAD : HTTPMethod.GET;
|
|
110316
|
-
const value = await fetch(url, { ...this.fetchOptions, method });
|
|
110317
|
-
return value.status === 200;
|
|
110318
|
-
}
|
|
110319
|
-
}
|
|
110320
|
-
async function create({ shape, chunks = true, dtype = "<i4", compressor = null, fillValue = null, order = "C", store, overwrite = false, path, chunkStore, filters, cacheMetadata = true, cacheAttrs = true, readOnly = false, dimensionSeparator }) {
|
|
110321
|
-
store = normalizeStoreArgument(store);
|
|
110322
|
-
await initArray(store, shape, chunks, dtype, path, compressor, fillValue, order, overwrite, chunkStore, filters, dimensionSeparator);
|
|
110323
|
-
const z2 = await ZarrArray.create(store, path, readOnly, chunkStore, cacheMetadata, cacheAttrs);
|
|
110324
|
-
return z2;
|
|
110325
|
-
}
|
|
110326
|
-
async function empty(shape, opts2 = {}) {
|
|
110327
|
-
opts2.fillValue = null;
|
|
110328
|
-
return create({ shape, ...opts2 });
|
|
110329
|
-
}
|
|
110330
|
-
async function zeros(shape, opts2 = {}) {
|
|
110331
|
-
opts2.fillValue = 0;
|
|
110332
|
-
return create({ shape, ...opts2 });
|
|
110333
|
-
}
|
|
110334
|
-
async function ones(shape, opts2 = {}) {
|
|
110335
|
-
opts2.fillValue = 1;
|
|
110336
|
-
return create({ shape, ...opts2 });
|
|
110337
|
-
}
|
|
110338
|
-
async function full(shape, fillValue, opts2 = {}) {
|
|
110339
|
-
opts2.fillValue = fillValue;
|
|
110340
|
-
return create({ shape, ...opts2 });
|
|
110341
|
-
}
|
|
110342
|
-
async function array(data, opts2 = {}) {
|
|
110343
|
-
let shape = null;
|
|
110344
|
-
if (data instanceof NestedArray) {
|
|
110345
|
-
shape = data.shape;
|
|
110346
|
-
opts2.dtype = opts2.dtype === void 0 ? data.dtype : opts2.dtype;
|
|
110347
|
-
} else {
|
|
110348
|
-
shape = data.byteLength;
|
|
110349
|
-
}
|
|
110350
|
-
const wasReadOnly = opts2.readOnly === void 0 ? false : opts2.readOnly;
|
|
110351
|
-
opts2.readOnly = false;
|
|
110352
|
-
const z2 = await create({ shape, ...opts2 });
|
|
110353
|
-
await z2.set(null, data);
|
|
110354
|
-
z2.readOnly = wasReadOnly;
|
|
110355
|
-
return z2;
|
|
110356
|
-
}
|
|
110357
|
-
function normalizeStoreArgument(store) {
|
|
110358
|
-
if (store === void 0) {
|
|
110359
|
-
return new MemoryStore();
|
|
110360
|
-
} else if (typeof store === "string") {
|
|
110361
|
-
return new HTTPStore(store);
|
|
110362
|
-
}
|
|
110363
|
-
return store;
|
|
110364
|
-
}
|
|
110365
|
-
class Group {
|
|
110366
|
-
constructor(store, path = null, metadata, readOnly = false, chunkStore = null, cacheAttrs = true) {
|
|
110367
|
-
this.store = store;
|
|
110368
|
-
this._chunkStore = chunkStore;
|
|
110369
|
-
this.path = normalizeStoragePath(path);
|
|
110370
|
-
this.keyPrefix = pathToPrefix(this.path);
|
|
110371
|
-
this.readOnly = readOnly;
|
|
110372
|
-
this.meta = metadata;
|
|
110373
|
-
const attrKey = this.keyPrefix + ATTRS_META_KEY;
|
|
110374
|
-
this.attrs = new Attributes(this.store, attrKey, this.readOnly, cacheAttrs);
|
|
110375
|
-
}
|
|
110376
|
-
/**
|
|
110377
|
-
* Group name following h5py convention.
|
|
110378
|
-
*/
|
|
110379
|
-
get name() {
|
|
110380
|
-
if (this.path.length > 0) {
|
|
110381
|
-
if (this.path[0] !== "/") {
|
|
110382
|
-
return "/" + this.path;
|
|
110383
|
-
}
|
|
110384
|
-
return this.path;
|
|
110385
|
-
}
|
|
110386
|
-
return "/";
|
|
110387
|
-
}
|
|
110388
|
-
/**
|
|
110389
|
-
* Final component of name.
|
|
110390
|
-
*/
|
|
110391
|
-
get basename() {
|
|
110392
|
-
const parts = this.name.split("/");
|
|
110393
|
-
return parts[parts.length - 1];
|
|
110394
|
-
}
|
|
110395
|
-
/**
|
|
110396
|
-
* A `Store` providing the underlying storage for array chunks.
|
|
110397
|
-
*/
|
|
110398
|
-
get chunkStore() {
|
|
110399
|
-
if (this._chunkStore) {
|
|
110400
|
-
return this._chunkStore;
|
|
110401
|
-
}
|
|
110402
|
-
return this.store;
|
|
110403
|
-
}
|
|
110404
|
-
static async create(store, path = null, readOnly = false, chunkStore = null, cacheAttrs = true) {
|
|
110405
|
-
const metadata = await this.loadMetadataForConstructor(store, path);
|
|
110406
|
-
return new Group(store, path, metadata, readOnly, chunkStore, cacheAttrs);
|
|
110407
|
-
}
|
|
110408
|
-
static async loadMetadataForConstructor(store, path) {
|
|
110409
|
-
path = normalizeStoragePath(path);
|
|
110410
|
-
const keyPrefix = pathToPrefix(path);
|
|
110411
|
-
try {
|
|
110412
|
-
const metaStoreValue = await store.getItem(keyPrefix + GROUP_META_KEY);
|
|
110413
|
-
return parseMetadata(metaStoreValue);
|
|
110414
|
-
} catch (error2) {
|
|
110415
|
-
if (await containsArray(store, path)) {
|
|
110416
|
-
throw new ContainsArrayError(path);
|
|
110417
|
-
}
|
|
110418
|
-
throw new GroupNotFoundError(path);
|
|
110419
|
-
}
|
|
110420
|
-
}
|
|
110421
|
-
itemPath(item) {
|
|
110422
|
-
const absolute = typeof item === "string" && item.length > 0 && item[0] === "/";
|
|
110423
|
-
const path = normalizeStoragePath(item);
|
|
110424
|
-
if (!absolute && this.path.length > 0) {
|
|
110425
|
-
return this.keyPrefix + path;
|
|
110426
|
-
}
|
|
110427
|
-
return path;
|
|
110428
|
-
}
|
|
110429
|
-
/**
|
|
110430
|
-
* Create a sub-group.
|
|
110431
|
-
*/
|
|
110432
|
-
async createGroup(name2, overwrite = false) {
|
|
110433
|
-
if (this.readOnly) {
|
|
110434
|
-
throw new PermissionError("group is read only");
|
|
110435
|
-
}
|
|
110436
|
-
const path = this.itemPath(name2);
|
|
110437
|
-
await initGroup(this.store, path, this._chunkStore, overwrite);
|
|
110438
|
-
return Group.create(this.store, path, this.readOnly, this._chunkStore, this.attrs.cache);
|
|
110439
|
-
}
|
|
110440
|
-
/**
|
|
110441
|
-
* Obtain a sub-group, creating one if it doesn't exist.
|
|
110442
|
-
*/
|
|
110443
|
-
async requireGroup(name2, overwrite = false) {
|
|
110444
|
-
if (this.readOnly) {
|
|
110445
|
-
throw new PermissionError("group is read only");
|
|
110446
|
-
}
|
|
110447
|
-
const path = this.itemPath(name2);
|
|
110448
|
-
if (!await containsGroup(this.store, path)) {
|
|
110449
|
-
await initGroup(this.store, path, this._chunkStore, overwrite);
|
|
110450
|
-
}
|
|
110451
|
-
return Group.create(this.store, path, this.readOnly, this._chunkStore, this.attrs.cache);
|
|
110452
|
-
}
|
|
110453
|
-
getOptsForArrayCreation(name2, opts2 = {}) {
|
|
110454
|
-
const path = this.itemPath(name2);
|
|
110455
|
-
opts2.path = path;
|
|
110456
|
-
if (opts2.cacheAttrs === void 0) {
|
|
110457
|
-
opts2.cacheAttrs = this.attrs.cache;
|
|
110458
|
-
}
|
|
110459
|
-
opts2.store = this.store;
|
|
110460
|
-
opts2.chunkStore = this.chunkStore;
|
|
110461
|
-
return opts2;
|
|
110462
|
-
}
|
|
110463
|
-
/**
|
|
110464
|
-
* Creates an array
|
|
110465
|
-
*/
|
|
110466
|
-
array(name2, data, opts2, overwrite) {
|
|
110467
|
-
if (this.readOnly) {
|
|
110468
|
-
throw new PermissionError("group is read only");
|
|
110469
|
-
}
|
|
110470
|
-
opts2 = this.getOptsForArrayCreation(name2, opts2);
|
|
110471
|
-
opts2.overwrite = overwrite === void 0 ? opts2.overwrite : overwrite;
|
|
110472
|
-
return array(data, opts2);
|
|
110473
|
-
}
|
|
110474
|
-
empty(name2, shape, opts2 = {}) {
|
|
110475
|
-
if (this.readOnly) {
|
|
110476
|
-
throw new PermissionError("group is read only");
|
|
110477
|
-
}
|
|
110478
|
-
opts2 = this.getOptsForArrayCreation(name2, opts2);
|
|
110479
|
-
return empty(shape, opts2);
|
|
110480
|
-
}
|
|
110481
|
-
zeros(name2, shape, opts2 = {}) {
|
|
110482
|
-
if (this.readOnly) {
|
|
110483
|
-
throw new PermissionError("group is read only");
|
|
110484
|
-
}
|
|
110485
|
-
opts2 = this.getOptsForArrayCreation(name2, opts2);
|
|
110486
|
-
return zeros(shape, opts2);
|
|
110487
|
-
}
|
|
110488
|
-
ones(name2, shape, opts2 = {}) {
|
|
110489
|
-
if (this.readOnly) {
|
|
110490
|
-
throw new PermissionError("group is read only");
|
|
110491
|
-
}
|
|
110492
|
-
opts2 = this.getOptsForArrayCreation(name2, opts2);
|
|
110493
|
-
return ones(shape, opts2);
|
|
110494
|
-
}
|
|
110495
|
-
full(name2, shape, fillValue, opts2 = {}) {
|
|
110496
|
-
if (this.readOnly) {
|
|
110497
|
-
throw new PermissionError("group is read only");
|
|
110498
|
-
}
|
|
110499
|
-
opts2 = this.getOptsForArrayCreation(name2, opts2);
|
|
110500
|
-
return full(shape, fillValue, opts2);
|
|
110501
|
-
}
|
|
110502
|
-
createDataset(name2, shape, data, opts2) {
|
|
110503
|
-
if (this.readOnly) {
|
|
110504
|
-
throw new PermissionError("group is read only");
|
|
110505
|
-
}
|
|
110506
|
-
opts2 = this.getOptsForArrayCreation(name2, opts2);
|
|
110507
|
-
let z2;
|
|
110508
|
-
if (data === void 0) {
|
|
110509
|
-
if (shape === void 0) {
|
|
110510
|
-
throw new ValueError("Shape must be set if no data is passed to CreateDataset");
|
|
110511
|
-
}
|
|
110512
|
-
z2 = create({ shape, ...opts2 });
|
|
110513
|
-
} else {
|
|
110514
|
-
z2 = array(data, opts2);
|
|
110515
|
-
}
|
|
110516
|
-
return z2;
|
|
110517
|
-
}
|
|
110518
|
-
async getItem(item) {
|
|
110519
|
-
const path = this.itemPath(item);
|
|
110520
|
-
if (await containsArray(this.store, path)) {
|
|
110521
|
-
return ZarrArray.create(this.store, path, this.readOnly, this.chunkStore, void 0, this.attrs.cache);
|
|
110522
|
-
} else if (await containsGroup(this.store, path)) {
|
|
110523
|
-
return Group.create(this.store, path, this.readOnly, this._chunkStore, this.attrs.cache);
|
|
110524
|
-
}
|
|
110525
|
-
throw new KeyError(item);
|
|
110526
|
-
}
|
|
110527
|
-
async setItem(item, value) {
|
|
110528
|
-
await this.array(item, value, {}, true);
|
|
110529
|
-
return true;
|
|
110530
|
-
}
|
|
110531
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
110532
|
-
async deleteItem(_item) {
|
|
110533
|
-
if (this.readOnly) {
|
|
110534
|
-
throw new PermissionError("group is read only");
|
|
110535
|
-
}
|
|
110536
|
-
throw new Error("Method not implemented.");
|
|
110537
|
-
}
|
|
110538
|
-
async containsItem(item) {
|
|
110539
|
-
const path = this.itemPath(item);
|
|
110540
|
-
return await containsArray(this.store, path) || containsGroup(this.store, path);
|
|
110541
|
-
}
|
|
110542
|
-
proxy() {
|
|
110543
|
-
return createProxy(this);
|
|
110544
|
-
}
|
|
110545
|
-
}
|
|
110546
|
-
async function openGroup(store, path = null, mode = "a", chunkStore, cacheAttrs = true) {
|
|
110547
|
-
store = normalizeStoreArgument(store);
|
|
110548
|
-
if (chunkStore !== void 0) {
|
|
110549
|
-
chunkStore = normalizeStoreArgument(store);
|
|
110550
|
-
}
|
|
110551
|
-
path = normalizeStoragePath(path);
|
|
110552
|
-
if (mode === "r" || mode === "r+") {
|
|
110553
|
-
if (!await containsGroup(store, path)) {
|
|
110554
|
-
if (await containsArray(store, path)) {
|
|
110555
|
-
throw new ContainsArrayError(path);
|
|
110556
|
-
}
|
|
110557
|
-
throw new GroupNotFoundError(path);
|
|
110558
|
-
}
|
|
110559
|
-
} else if (mode === "w") {
|
|
110560
|
-
await initGroup(store, path, chunkStore, true);
|
|
110561
|
-
} else if (mode === "a") {
|
|
110562
|
-
if (!await containsGroup(store, path)) {
|
|
110563
|
-
if (await containsArray(store, path)) {
|
|
110564
|
-
throw new ContainsArrayError(path);
|
|
110565
|
-
}
|
|
110566
|
-
await initGroup(store, path, chunkStore);
|
|
110567
|
-
}
|
|
110568
|
-
} else if (mode === "w-" || mode === "x") {
|
|
110569
|
-
if (await containsArray(store, path)) {
|
|
110570
|
-
throw new ContainsArrayError(path);
|
|
110571
|
-
} else if (await containsGroup(store, path)) {
|
|
110572
|
-
throw new ContainsGroupError(path);
|
|
110573
|
-
} else {
|
|
110574
|
-
await initGroup(store, path, chunkStore);
|
|
110575
|
-
}
|
|
110576
|
-
} else {
|
|
110577
|
-
throw new ValueError(`Invalid mode argument: ${mode}`);
|
|
110578
|
-
}
|
|
110579
|
-
const readOnly = mode === "r";
|
|
110580
|
-
return Group.create(store, path, readOnly, chunkStore, cacheAttrs);
|
|
110581
|
-
}
|
|
108250
|
+
[HTTPMethod.HEAD, HTTPMethod.GET, HTTPMethod.PUT];
|
|
110582
108251
|
/*! pako 2.0.3 https://github.com/nodeca/pako @license (MIT AND Zlib) */
|
|
110583
108252
|
const Z_FIXED = 4;
|
|
110584
108253
|
const Z_BINARY = 0;
|
|
@@ -116128,41 +113797,6 @@ async function loadOmeTiff(source, opts2 = {}) {
|
|
|
116128
113797
|
const loaders = await load$3(tiff, pool);
|
|
116129
113798
|
return images === "all" ? loaders : loaders[0];
|
|
116130
113799
|
}
|
|
116131
|
-
function isAxis(axisOrLabel) {
|
|
116132
|
-
return typeof axisOrLabel[0] !== "string";
|
|
116133
|
-
}
|
|
116134
|
-
function castLabels(dimnames) {
|
|
116135
|
-
return dimnames;
|
|
116136
|
-
}
|
|
116137
|
-
async function loadMultiscales(store, path = "") {
|
|
116138
|
-
const grp = await openGroup(store, path);
|
|
116139
|
-
const rootAttrs = await grp.attrs.asObject();
|
|
116140
|
-
let paths = ["0"];
|
|
116141
|
-
let labels = castLabels(["t", "c", "z", "y", "x"]);
|
|
116142
|
-
if ("multiscales" in rootAttrs) {
|
|
116143
|
-
const { datasets, axes } = rootAttrs.multiscales[0];
|
|
116144
|
-
paths = datasets.map((d) => d.path);
|
|
116145
|
-
if (axes) {
|
|
116146
|
-
if (isAxis(axes)) {
|
|
116147
|
-
labels = castLabels(axes.map((axis) => axis.name));
|
|
116148
|
-
} else {
|
|
116149
|
-
labels = castLabels(axes);
|
|
116150
|
-
}
|
|
116151
|
-
}
|
|
116152
|
-
}
|
|
116153
|
-
const data = paths.map((path2) => grp.getItem(path2));
|
|
116154
|
-
return {
|
|
116155
|
-
data: await Promise.all(data),
|
|
116156
|
-
rootAttrs,
|
|
116157
|
-
labels
|
|
116158
|
-
};
|
|
116159
|
-
}
|
|
116160
|
-
function guessTileSize(arr) {
|
|
116161
|
-
const interleaved = isInterleaved(arr.shape);
|
|
116162
|
-
const [yChunk, xChunk] = arr.chunks.slice(interleaved ? -3 : -2);
|
|
116163
|
-
const size = Math.min(yChunk, xChunk);
|
|
116164
|
-
return prevPowerOf2(size);
|
|
116165
|
-
}
|
|
116166
113800
|
function getIndexer(labels) {
|
|
116167
113801
|
const size = labels.length;
|
|
116168
113802
|
const dims = getDims(labels);
|
|
@@ -116261,22 +113895,6 @@ class ZarrPixelSource {
|
|
|
116261
113895
|
}
|
|
116262
113896
|
}
|
|
116263
113897
|
}
|
|
116264
|
-
async function load(store) {
|
|
116265
|
-
const { data, rootAttrs, labels } = await loadMultiscales(store);
|
|
116266
|
-
const tileSize = guessTileSize(data[0]);
|
|
116267
|
-
const pyramid = data.map((arr) => new ZarrPixelSource(arr, labels, tileSize));
|
|
116268
|
-
return {
|
|
116269
|
-
data: pyramid,
|
|
116270
|
-
metadata: rootAttrs
|
|
116271
|
-
};
|
|
116272
|
-
}
|
|
116273
|
-
async function loadOmeZarr(source, options = {}) {
|
|
116274
|
-
const store = new HTTPStore(source, options);
|
|
116275
|
-
if ((options == null ? void 0 : options.type) !== "multiscales") {
|
|
116276
|
-
throw Error("Only multiscale OME-Zarr is supported.");
|
|
116277
|
-
}
|
|
116278
|
-
return load(store);
|
|
116279
|
-
}
|
|
116280
113898
|
const MAX_COLOR_INTENSITY = 255;
|
|
116281
113899
|
const DEFAULT_COLOR_OFF = [0, 0, 0];
|
|
116282
113900
|
const MAX_CHANNELS$1 = 6;
|
|
@@ -120955,13 +118573,13 @@ var baseCreate = function() {
|
|
|
120955
118573
|
};
|
|
120956
118574
|
}();
|
|
120957
118575
|
const baseCreate$1 = baseCreate;
|
|
120958
|
-
function copyArray(source,
|
|
118576
|
+
function copyArray(source, array) {
|
|
120959
118577
|
var index2 = -1, length2 = source.length;
|
|
120960
|
-
|
|
118578
|
+
array || (array = Array(length2));
|
|
120961
118579
|
while (++index2 < length2) {
|
|
120962
|
-
|
|
118580
|
+
array[index2] = source[index2];
|
|
120963
118581
|
}
|
|
120964
|
-
return
|
|
118582
|
+
return array;
|
|
120965
118583
|
}
|
|
120966
118584
|
var defineProperty = function() {
|
|
120967
118585
|
try {
|
|
@@ -120972,14 +118590,14 @@ var defineProperty = function() {
|
|
|
120972
118590
|
}
|
|
120973
118591
|
}();
|
|
120974
118592
|
const defineProperty$1 = defineProperty;
|
|
120975
|
-
function arrayEach(
|
|
120976
|
-
var index2 = -1, length2 =
|
|
118593
|
+
function arrayEach(array, iteratee) {
|
|
118594
|
+
var index2 = -1, length2 = array == null ? 0 : array.length;
|
|
120977
118595
|
while (++index2 < length2) {
|
|
120978
|
-
if (iteratee(
|
|
118596
|
+
if (iteratee(array[index2], index2, array) === false) {
|
|
120979
118597
|
break;
|
|
120980
118598
|
}
|
|
120981
118599
|
}
|
|
120982
|
-
return
|
|
118600
|
+
return array;
|
|
120983
118601
|
}
|
|
120984
118602
|
var MAX_SAFE_INTEGER$3 = 9007199254740991;
|
|
120985
118603
|
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
@@ -121229,10 +118847,10 @@ function listCacheClear() {
|
|
|
121229
118847
|
this.__data__ = [];
|
|
121230
118848
|
this.size = 0;
|
|
121231
118849
|
}
|
|
121232
|
-
function assocIndexOf(
|
|
121233
|
-
var length2 =
|
|
118850
|
+
function assocIndexOf(array, key) {
|
|
118851
|
+
var length2 = array.length;
|
|
121234
118852
|
while (length2--) {
|
|
121235
|
-
if (eq$4(
|
|
118853
|
+
if (eq$4(array[length2][0], key)) {
|
|
121236
118854
|
return length2;
|
|
121237
118855
|
}
|
|
121238
118856
|
}
|
|
@@ -121332,12 +118950,12 @@ MapCache.prototype["delete"] = mapCacheDelete;
|
|
|
121332
118950
|
MapCache.prototype.get = mapCacheGet;
|
|
121333
118951
|
MapCache.prototype.has = mapCacheHas;
|
|
121334
118952
|
MapCache.prototype.set = mapCacheSet;
|
|
121335
|
-
function arrayPush(
|
|
121336
|
-
var index2 = -1, length2 = values2.length, offset =
|
|
118953
|
+
function arrayPush(array, values2) {
|
|
118954
|
+
var index2 = -1, length2 = values2.length, offset = array.length;
|
|
121337
118955
|
while (++index2 < length2) {
|
|
121338
|
-
|
|
118956
|
+
array[offset + index2] = values2[index2];
|
|
121339
118957
|
}
|
|
121340
|
-
return
|
|
118958
|
+
return array;
|
|
121341
118959
|
}
|
|
121342
118960
|
var getPrototype = overArg(Object.getPrototypeOf, Object);
|
|
121343
118961
|
const getPrototype$1 = getPrototype;
|
|
@@ -121399,11 +119017,11 @@ function cloneBuffer(buffer2, isDeep) {
|
|
|
121399
119017
|
buffer2.copy(result);
|
|
121400
119018
|
return result;
|
|
121401
119019
|
}
|
|
121402
|
-
function arrayFilter(
|
|
121403
|
-
var index2 = -1, length2 =
|
|
119020
|
+
function arrayFilter(array, predicate) {
|
|
119021
|
+
var index2 = -1, length2 = array == null ? 0 : array.length, resIndex = 0, result = [];
|
|
121404
119022
|
while (++index2 < length2) {
|
|
121405
|
-
var value =
|
|
121406
|
-
if (predicate(value, index2,
|
|
119023
|
+
var value = array[index2];
|
|
119024
|
+
if (predicate(value, index2, array)) {
|
|
121407
119025
|
result[resIndex++] = value;
|
|
121408
119026
|
}
|
|
121409
119027
|
}
|
|
@@ -121484,11 +119102,11 @@ if (DataView$2 && getTag(new DataView$2(new ArrayBuffer(1))) != dataViewTag$2 ||
|
|
|
121484
119102
|
const getTag$1 = getTag;
|
|
121485
119103
|
var objectProto = Object.prototype;
|
|
121486
119104
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
121487
|
-
function initCloneArray(
|
|
121488
|
-
var length2 =
|
|
121489
|
-
if (length2 && typeof
|
|
121490
|
-
result.index =
|
|
121491
|
-
result.input =
|
|
119105
|
+
function initCloneArray(array) {
|
|
119106
|
+
var length2 = array.length, result = new array.constructor(length2);
|
|
119107
|
+
if (length2 && typeof array[0] == "string" && hasOwnProperty.call(array, "index")) {
|
|
119108
|
+
result.index = array.index;
|
|
119109
|
+
result.input = array.input;
|
|
121492
119110
|
}
|
|
121493
119111
|
return result;
|
|
121494
119112
|
}
|
|
@@ -122189,8 +119807,8 @@ var util;
|
|
|
122189
119807
|
return void 0;
|
|
122190
119808
|
};
|
|
122191
119809
|
util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
|
|
122192
|
-
function joinValues(
|
|
122193
|
-
return
|
|
119810
|
+
function joinValues(array, separator = " | ") {
|
|
119811
|
+
return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
|
|
122194
119812
|
}
|
|
122195
119813
|
util2.joinValues = joinValues;
|
|
122196
119814
|
util2.jsonStringifyReplacer = (_, value) => {
|
|
@@ -128698,6 +126316,7 @@ const DataType$1 = {
|
|
|
128698
126316
|
const FileType$1 = {
|
|
128699
126317
|
// Joint file types
|
|
128700
126318
|
ANNDATA_ZARR: "anndata.zarr",
|
|
126319
|
+
SPATIALDATA_ZARR: "spatialdata.zarr",
|
|
128701
126320
|
// Atomic file types
|
|
128702
126321
|
OBS_EMBEDDING_CSV: "obsEmbedding.csv",
|
|
128703
126322
|
OBS_SPOTS_CSV: "obsSpots.csv",
|
|
@@ -128720,6 +126339,16 @@ const FileType$1 = {
|
|
|
128720
126339
|
OBS_SEGMENTATIONS_ANNDATA_ZARR: "obsSegmentations.anndata.zarr",
|
|
128721
126340
|
OBS_LABELS_ANNDATA_ZARR: "obsLabels.anndata.zarr",
|
|
128722
126341
|
FEATURE_LABELS_ANNDATA_ZARR: "featureLabels.anndata.zarr",
|
|
126342
|
+
// SpatialData
|
|
126343
|
+
IMAGE_SPATIALDATA_ZARR: "image.spatialdata.zarr",
|
|
126344
|
+
LABELS_SPATIALDATA_ZARR: "labels.spatialdata.zarr",
|
|
126345
|
+
SHAPES_SPATIALDATA_ZARR: "shapes.spatialdata.zarr",
|
|
126346
|
+
OBS_FEATURE_MATRIX_SPATIALDATA_ZARR: "obsFeatureMatrix.spatialdata.zarr",
|
|
126347
|
+
OBS_SETS_SPATIALDATA_ZARR: "obsSets.spatialdata.zarr",
|
|
126348
|
+
OBS_SPOTS_SPATIALDATA_ZARR: "obsSpots.spatialdata.zarr",
|
|
126349
|
+
// TODO:
|
|
126350
|
+
// OBS_POINTS_SPATIALDATA_ZARR: 'obsPoints.spatialdata.zarr',
|
|
126351
|
+
// OBS_LOCATIONS_SPATIALDATA_ZARR: 'obsLocations.spatialdata.zarr',
|
|
128723
126352
|
// MuData
|
|
128724
126353
|
OBS_FEATURE_MATRIX_MUDATA_ZARR: "obsFeatureMatrix.mudata.zarr",
|
|
128725
126354
|
OBS_SETS_MUDATA_ZARR: "obsSets.mudata.zarr",
|
|
@@ -129156,9 +126785,30 @@ z.object({
|
|
|
129156
126785
|
offsetsUrl: z.string().optional(),
|
|
129157
126786
|
coordinateTransformations: omeCoordinateTransformations.optional()
|
|
129158
126787
|
});
|
|
129159
|
-
z.object({
|
|
126788
|
+
const imageOmeZarrSchema = z.object({
|
|
129160
126789
|
coordinateTransformations: omeCoordinateTransformations.optional()
|
|
129161
126790
|
});
|
|
126791
|
+
imageOmeZarrSchema.extend({
|
|
126792
|
+
path: z.string()
|
|
126793
|
+
});
|
|
126794
|
+
z.object({
|
|
126795
|
+
path: z.string()
|
|
126796
|
+
});
|
|
126797
|
+
z.object({
|
|
126798
|
+
path: z.string()
|
|
126799
|
+
});
|
|
126800
|
+
z.object({
|
|
126801
|
+
path: z.string(),
|
|
126802
|
+
tablePath: z.string().optional().describe("The path to a table which annotates the spots. If available but not specified, the spot identifiers may not be aligned with associated tabular data as expected.")
|
|
126803
|
+
});
|
|
126804
|
+
annDataObsFeatureMatrix.extend({
|
|
126805
|
+
region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional()
|
|
126806
|
+
});
|
|
126807
|
+
z.object({
|
|
126808
|
+
region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional(),
|
|
126809
|
+
tablePath: z.string().optional().describe("The path to a table which contains the index for the set values."),
|
|
126810
|
+
obsSets: annDataObsSets
|
|
126811
|
+
});
|
|
129162
126812
|
z.object({
|
|
129163
126813
|
obsIndex: z.string(),
|
|
129164
126814
|
obsEmbedding: z.array(z.string()).length(2)
|
|
@@ -130839,34 +128489,34 @@ var json2csv_umd = { exports: {} };
|
|
|
130839
128489
|
}
|
|
130840
128490
|
return that;
|
|
130841
128491
|
}
|
|
130842
|
-
function fromArrayLike(that,
|
|
130843
|
-
var length2 =
|
|
128492
|
+
function fromArrayLike(that, array) {
|
|
128493
|
+
var length2 = array.length < 0 ? 0 : checked(array.length) | 0;
|
|
130844
128494
|
that = createBuffer(that, length2);
|
|
130845
128495
|
for (var i2 = 0; i2 < length2; i2 += 1) {
|
|
130846
|
-
that[i2] =
|
|
128496
|
+
that[i2] = array[i2] & 255;
|
|
130847
128497
|
}
|
|
130848
128498
|
return that;
|
|
130849
128499
|
}
|
|
130850
|
-
function fromArrayBuffer(that,
|
|
130851
|
-
|
|
130852
|
-
if (byteOffset < 0 ||
|
|
128500
|
+
function fromArrayBuffer(that, array, byteOffset, length2) {
|
|
128501
|
+
array.byteLength;
|
|
128502
|
+
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
|
130853
128503
|
throw new RangeError("'offset' is out of bounds");
|
|
130854
128504
|
}
|
|
130855
|
-
if (
|
|
128505
|
+
if (array.byteLength < byteOffset + (length2 || 0)) {
|
|
130856
128506
|
throw new RangeError("'length' is out of bounds");
|
|
130857
128507
|
}
|
|
130858
128508
|
if (byteOffset === void 0 && length2 === void 0) {
|
|
130859
|
-
|
|
128509
|
+
array = new Uint8Array(array);
|
|
130860
128510
|
} else if (length2 === void 0) {
|
|
130861
|
-
|
|
128511
|
+
array = new Uint8Array(array, byteOffset);
|
|
130862
128512
|
} else {
|
|
130863
|
-
|
|
128513
|
+
array = new Uint8Array(array, byteOffset, length2);
|
|
130864
128514
|
}
|
|
130865
128515
|
if (Buffer3.TYPED_ARRAY_SUPPORT) {
|
|
130866
|
-
that =
|
|
128516
|
+
that = array;
|
|
130867
128517
|
that.__proto__ = Buffer3.prototype;
|
|
130868
128518
|
} else {
|
|
130869
|
-
that = fromArrayLike(that,
|
|
128519
|
+
that = fromArrayLike(that, array);
|
|
130870
128520
|
}
|
|
130871
128521
|
return that;
|
|
130872
128522
|
}
|
|
@@ -132273,9 +129923,9 @@ var json2csv_umd = { exports: {} };
|
|
|
132273
129923
|
runTimeout(drainQueue);
|
|
132274
129924
|
}
|
|
132275
129925
|
}
|
|
132276
|
-
function Item(fun,
|
|
129926
|
+
function Item(fun, array) {
|
|
132277
129927
|
this.fun = fun;
|
|
132278
|
-
this.array =
|
|
129928
|
+
this.array = array;
|
|
132279
129929
|
}
|
|
132280
129930
|
Item.prototype.run = function() {
|
|
132281
129931
|
this.fun.apply(null, this.array);
|
|
@@ -132450,9 +130100,9 @@ var json2csv_umd = { exports: {} };
|
|
|
132450
130100
|
function stylizeNoColor(str, styleType) {
|
|
132451
130101
|
return str;
|
|
132452
130102
|
}
|
|
132453
|
-
function arrayToHash(
|
|
130103
|
+
function arrayToHash(array) {
|
|
132454
130104
|
var hash = {};
|
|
132455
|
-
|
|
130105
|
+
array.forEach(function(val, idx) {
|
|
132456
130106
|
hash[val] = true;
|
|
132457
130107
|
});
|
|
132458
130108
|
return hash;
|
|
@@ -132494,9 +130144,9 @@ var json2csv_umd = { exports: {} };
|
|
|
132494
130144
|
return formatError(value);
|
|
132495
130145
|
}
|
|
132496
130146
|
}
|
|
132497
|
-
var base = "",
|
|
130147
|
+
var base = "", array = false, braces = ["{", "}"];
|
|
132498
130148
|
if (isArray$12(value)) {
|
|
132499
|
-
|
|
130149
|
+
array = true;
|
|
132500
130150
|
braces = ["[", "]"];
|
|
132501
130151
|
}
|
|
132502
130152
|
if (isFunction2(value)) {
|
|
@@ -132512,7 +130162,7 @@ var json2csv_umd = { exports: {} };
|
|
|
132512
130162
|
if (isError(value)) {
|
|
132513
130163
|
base = " " + formatError(value);
|
|
132514
130164
|
}
|
|
132515
|
-
if (keys4.length === 0 && (!
|
|
130165
|
+
if (keys4.length === 0 && (!array || value.length == 0)) {
|
|
132516
130166
|
return braces[0] + base + braces[1];
|
|
132517
130167
|
}
|
|
132518
130168
|
if (recurseTimes < 0) {
|
|
@@ -132524,11 +130174,11 @@ var json2csv_umd = { exports: {} };
|
|
|
132524
130174
|
}
|
|
132525
130175
|
ctx.seen.push(value);
|
|
132526
130176
|
var output;
|
|
132527
|
-
if (
|
|
130177
|
+
if (array) {
|
|
132528
130178
|
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys4);
|
|
132529
130179
|
} else {
|
|
132530
130180
|
output = keys4.map(function(key) {
|
|
132531
|
-
return formatProperty(ctx, value, recurseTimes, visibleKeys, key,
|
|
130181
|
+
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
|
|
132532
130182
|
});
|
|
132533
130183
|
}
|
|
132534
130184
|
ctx.seen.pop();
|
|
@@ -132581,7 +130231,7 @@ var json2csv_umd = { exports: {} };
|
|
|
132581
130231
|
});
|
|
132582
130232
|
return output;
|
|
132583
130233
|
}
|
|
132584
|
-
function formatProperty(ctx, value, recurseTimes, visibleKeys, key,
|
|
130234
|
+
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
|
132585
130235
|
var name2, str, desc;
|
|
132586
130236
|
desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
|
|
132587
130237
|
if (desc.get) {
|
|
@@ -132606,7 +130256,7 @@ var json2csv_umd = { exports: {} };
|
|
|
132606
130256
|
str = formatValue2(ctx, desc.value, recurseTimes - 1);
|
|
132607
130257
|
}
|
|
132608
130258
|
if (str.indexOf("\n") > -1) {
|
|
132609
|
-
if (
|
|
130259
|
+
if (array) {
|
|
132610
130260
|
str = str.split("\n").map(function(line) {
|
|
132611
130261
|
return " " + line;
|
|
132612
130262
|
}).join("\n").substr(2);
|
|
@@ -132621,7 +130271,7 @@ var json2csv_umd = { exports: {} };
|
|
|
132621
130271
|
}
|
|
132622
130272
|
}
|
|
132623
130273
|
if (isUndefined(name2)) {
|
|
132624
|
-
if (
|
|
130274
|
+
if (array && key.match(/^\d+$/)) {
|
|
132625
130275
|
return str;
|
|
132626
130276
|
}
|
|
132627
130277
|
name2 = JSON.stringify("" + key);
|
|
@@ -134443,10 +132093,10 @@ var json2csv_umd = { exports: {} };
|
|
|
134443
132093
|
MapCache2.prototype.get = mapCacheGet2;
|
|
134444
132094
|
MapCache2.prototype.has = mapCacheHas2;
|
|
134445
132095
|
MapCache2.prototype.set = mapCacheSet2;
|
|
134446
|
-
function assocIndexOf2(
|
|
134447
|
-
var length2 =
|
|
132096
|
+
function assocIndexOf2(array, key) {
|
|
132097
|
+
var length2 = array.length;
|
|
134448
132098
|
while (length2--) {
|
|
134449
|
-
if (eq2(
|
|
132099
|
+
if (eq2(array[length2][0], key)) {
|
|
134450
132100
|
return length2;
|
|
134451
132101
|
}
|
|
134452
132102
|
}
|
|
@@ -135716,9 +133366,9 @@ const schemePlasma = [[13, 8, 135], [16, 7, 136], [19, 7, 137], [22, 7, 138], [2
|
|
|
135716
133366
|
function rgbSpline(spline) {
|
|
135717
133367
|
return (colors) => {
|
|
135718
133368
|
const n2 = colors.length;
|
|
135719
|
-
|
|
135720
|
-
|
|
135721
|
-
|
|
133369
|
+
const r2 = new Array(n2);
|
|
133370
|
+
const g2 = new Array(n2);
|
|
133371
|
+
const b = new Array(n2);
|
|
135722
133372
|
let i2;
|
|
135723
133373
|
let color;
|
|
135724
133374
|
for (i2 = 0; i2 < n2; ++i2) {
|
|
@@ -135727,10 +133377,10 @@ function rgbSpline(spline) {
|
|
|
135727
133377
|
g2[i2] = color[1] || 0;
|
|
135728
133378
|
b[i2] = color[2] || 0;
|
|
135729
133379
|
}
|
|
135730
|
-
|
|
135731
|
-
|
|
135732
|
-
|
|
135733
|
-
return (t2) => [
|
|
133380
|
+
const rFunc = spline(r2);
|
|
133381
|
+
const gFunc = spline(g2);
|
|
133382
|
+
const bFunc = spline(b);
|
|
133383
|
+
return (t2) => [rFunc(t2), gFunc(t2), bFunc(t2)];
|
|
135734
133384
|
};
|
|
135735
133385
|
}
|
|
135736
133386
|
function basis(values2) {
|
|
@@ -136403,8 +134053,7 @@ const viv = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty(
|
|
|
136403
134053
|
ZarrPixelSource,
|
|
136404
134054
|
getChannelStats,
|
|
136405
134055
|
getDefaultInitialViewState,
|
|
136406
|
-
loadOmeTiff
|
|
136407
|
-
loadOmeZarr
|
|
134056
|
+
loadOmeTiff
|
|
136408
134057
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
136409
134058
|
const luma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
136410
134059
|
__proto__: null,
|