@idetik/core 0.36.0 → 0.36.2
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/README.md +63 -119
- package/dist/index.d.ts +135 -144
- package/dist/index.js +912 -906
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +29 -29
- package/dist/index.umd.cjs.map +1 -1
- package/dist/types/src/idetik.d.ts +2 -3
- package/dist/types/src/idetik.d.ts.map +1 -1
- package/dist/types/src/layers/image_layer.d.ts +1 -1
- package/dist/types/src/layers/image_layer.d.ts.map +1 -1
- package/dist/types/src/layers/label_layer.d.ts +1 -1
- package/dist/types/src/layers/label_layer.d.ts.map +1 -1
- package/dist/types/src/layers/volume_layer.d.ts +1 -1
- package/dist/types/src/layers/volume_layer.d.ts.map +1 -1
- package/dist/types/src/objects/cameras/camera.d.ts +5 -2
- package/dist/types/src/objects/cameras/camera.d.ts.map +1 -1
- package/dist/types/src/objects/cameras/orthographic_camera.d.ts +12 -9
- package/dist/types/src/objects/cameras/orthographic_camera.d.ts.map +1 -1
- package/dist/types/src/objects/cameras/perspective_camera.d.ts +1 -1
- package/dist/types/src/objects/cameras/perspective_camera.d.ts.map +1 -1
- package/dist/types/src/objects/renderable/image_renderable.d.ts +7 -1
- package/dist/types/src/objects/renderable/image_renderable.d.ts.map +1 -1
- package/dist/types/src/objects/renderable/volume_renderable.d.ts +5 -1
- package/dist/types/src/objects/renderable/volume_renderable.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class cC {
|
|
2
2
|
canvas_;
|
|
3
3
|
width_ = 0;
|
|
4
4
|
height_ = 0;
|
|
@@ -27,7 +27,7 @@ class RC {
|
|
|
27
27
|
return this.renderedObjects_;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
var
|
|
30
|
+
var UC = `#version 300 es
|
|
31
31
|
|
|
32
32
|
layout (location = 0) in vec3 a_position;
|
|
33
33
|
layout (location = 3) in vec3 a_prevPosition;
|
|
@@ -87,7 +87,7 @@ void main() {
|
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
gl_PointSize = 5.0;
|
|
90
|
-
}`,
|
|
90
|
+
}`, kC = `#version 300 es
|
|
91
91
|
|
|
92
92
|
precision mediump float;
|
|
93
93
|
|
|
@@ -98,7 +98,7 @@ uniform float u_opacity;
|
|
|
98
98
|
|
|
99
99
|
void main() {
|
|
100
100
|
fragColor = vec4(u_lineColor, u_opacity);
|
|
101
|
-
}`,
|
|
101
|
+
}`, xA = `#version 300 es
|
|
102
102
|
|
|
103
103
|
layout (location = 0) in vec3 a_position;
|
|
104
104
|
layout (location = 1) in vec3 a_normal;
|
|
@@ -113,7 +113,7 @@ out vec3 v_texCoords;
|
|
|
113
113
|
void main() {
|
|
114
114
|
v_texCoords = (u_worldToTexCoord * u_model * vec4(a_position, 1.0)).xyz;
|
|
115
115
|
gl_Position = u_projection * u_modelView * vec4(a_position, 1.0);
|
|
116
|
-
}`,
|
|
116
|
+
}`, qI = `#version 300 es
|
|
117
117
|
#pragma inject_defines
|
|
118
118
|
|
|
119
119
|
precision highp float;
|
|
@@ -139,7 +139,7 @@ void main() {
|
|
|
139
139
|
float texel = float(texture(u_imageSampler, v_texCoords).r);
|
|
140
140
|
float value = (texel + u_valueOffset) * u_valueScale;
|
|
141
141
|
fragColor = vec4(value * u_color, u_opacity);
|
|
142
|
-
}`,
|
|
142
|
+
}`, LC = `#version 300 es
|
|
143
143
|
|
|
144
144
|
precision mediump float;
|
|
145
145
|
|
|
@@ -159,7 +159,7 @@ void main() {
|
|
|
159
159
|
gl_PointSize = a_size;
|
|
160
160
|
v_color = a_color;
|
|
161
161
|
v_marker = uint(a_marker);
|
|
162
|
-
}`,
|
|
162
|
+
}`, JC = `#version 300 es
|
|
163
163
|
|
|
164
164
|
precision mediump float;
|
|
165
165
|
|
|
@@ -179,7 +179,7 @@ void main() {
|
|
|
179
179
|
discard;
|
|
180
180
|
}
|
|
181
181
|
fragColor = vec4(v_color.rgb, u_opacity * alpha * v_color.a);
|
|
182
|
-
}`,
|
|
182
|
+
}`, YC = `#version 300 es
|
|
183
183
|
|
|
184
184
|
layout (location = 0) in vec3 a_position;
|
|
185
185
|
layout (location = 1) in vec3 a_normal;
|
|
@@ -189,7 +189,7 @@ uniform mat4 u_modelView;
|
|
|
189
189
|
|
|
190
190
|
void main() {
|
|
191
191
|
gl_Position = u_projection * u_modelView * vec4(a_position, 1.0);
|
|
192
|
-
}`,
|
|
192
|
+
}`, MC = `#version 300 es
|
|
193
193
|
|
|
194
194
|
precision mediump float;
|
|
195
195
|
|
|
@@ -200,7 +200,7 @@ uniform vec3 u_color;
|
|
|
200
200
|
|
|
201
201
|
void main() {
|
|
202
202
|
fragColor = vec4(u_color, u_opacity);
|
|
203
|
-
}`,
|
|
203
|
+
}`, lI = `#version 300 es
|
|
204
204
|
|
|
205
205
|
precision highp float;
|
|
206
206
|
|
|
@@ -213,7 +213,7 @@ out highp vec3 v_positionModel;
|
|
|
213
213
|
void main() {
|
|
214
214
|
v_positionModel = a_position;
|
|
215
215
|
gl_Position = u_projection * u_modelView * vec4(a_position, 1.0);
|
|
216
|
-
}`,
|
|
216
|
+
}`, fI = `#version 300 es
|
|
217
217
|
#pragma inject_defines
|
|
218
218
|
precision highp float;
|
|
219
219
|
|
|
@@ -355,7 +355,7 @@ void main() {
|
|
|
355
355
|
}
|
|
356
356
|
|
|
357
357
|
fragColor = accumulatedColor;
|
|
358
|
-
}`,
|
|
358
|
+
}`, Zg = `#version 300 es
|
|
359
359
|
#pragma inject_defines
|
|
360
360
|
|
|
361
361
|
precision highp float;
|
|
@@ -454,62 +454,62 @@ void main() {
|
|
|
454
454
|
|
|
455
455
|
fragColor = vec4(color.rgb, alpha);
|
|
456
456
|
}`;
|
|
457
|
-
const
|
|
457
|
+
const dC = {
|
|
458
458
|
projectedLine: {
|
|
459
|
-
vertex: NC,
|
|
460
|
-
fragment: cC
|
|
461
|
-
},
|
|
462
|
-
points: {
|
|
463
459
|
vertex: UC,
|
|
464
460
|
fragment: kC
|
|
465
461
|
},
|
|
466
|
-
|
|
462
|
+
points: {
|
|
467
463
|
vertex: LC,
|
|
468
464
|
fragment: JC
|
|
469
465
|
},
|
|
466
|
+
wireframe: {
|
|
467
|
+
vertex: YC,
|
|
468
|
+
fragment: MC
|
|
469
|
+
},
|
|
470
470
|
floatScalarImage: {
|
|
471
|
-
vertex:
|
|
472
|
-
fragment:
|
|
471
|
+
vertex: xA,
|
|
472
|
+
fragment: qI
|
|
473
473
|
},
|
|
474
474
|
intScalarImage: {
|
|
475
|
-
vertex:
|
|
476
|
-
fragment:
|
|
475
|
+
vertex: xA,
|
|
476
|
+
fragment: qI,
|
|
477
477
|
fragmentDefines: /* @__PURE__ */ new Map([["TEXTURE_DATA_TYPE_INT", "1"]])
|
|
478
478
|
},
|
|
479
479
|
uintScalarImage: {
|
|
480
|
-
vertex:
|
|
481
|
-
fragment:
|
|
480
|
+
vertex: xA,
|
|
481
|
+
fragment: qI,
|
|
482
482
|
fragmentDefines: /* @__PURE__ */ new Map([["TEXTURE_DATA_TYPE_UINT", "1"]])
|
|
483
483
|
},
|
|
484
484
|
labelImage: {
|
|
485
|
-
vertex:
|
|
486
|
-
fragment:
|
|
485
|
+
vertex: xA,
|
|
486
|
+
fragment: Zg
|
|
487
487
|
},
|
|
488
488
|
intLabelImage: {
|
|
489
|
-
vertex:
|
|
490
|
-
fragment:
|
|
489
|
+
vertex: xA,
|
|
490
|
+
fragment: Zg,
|
|
491
491
|
fragmentDefines: /* @__PURE__ */ new Map([["TEXTURE_DATA_TYPE_INT", "1"]])
|
|
492
492
|
},
|
|
493
493
|
floatVolume: {
|
|
494
|
-
vertex:
|
|
495
|
-
fragment:
|
|
494
|
+
vertex: lI,
|
|
495
|
+
fragment: fI
|
|
496
496
|
},
|
|
497
497
|
intVolume: {
|
|
498
|
-
vertex:
|
|
499
|
-
fragment:
|
|
498
|
+
vertex: lI,
|
|
499
|
+
fragment: fI,
|
|
500
500
|
fragmentDefines: /* @__PURE__ */ new Map([["TEXTURE_DATA_TYPE_INT", "1"]])
|
|
501
501
|
},
|
|
502
502
|
uintVolume: {
|
|
503
|
-
vertex:
|
|
504
|
-
fragment:
|
|
503
|
+
vertex: lI,
|
|
504
|
+
fragment: fI,
|
|
505
505
|
fragmentDefines: /* @__PURE__ */ new Map([["TEXTURE_DATA_TYPE_UINT", "1"]])
|
|
506
506
|
}
|
|
507
|
-
},
|
|
507
|
+
}, Pg = {
|
|
508
508
|
debug: 10,
|
|
509
509
|
info: 20,
|
|
510
510
|
warn: 30,
|
|
511
511
|
error: 40
|
|
512
|
-
},
|
|
512
|
+
}, KC = {
|
|
513
513
|
debug: "\x1B[90m",
|
|
514
514
|
// gray
|
|
515
515
|
info: "\x1B[36m",
|
|
@@ -519,7 +519,7 @@ const YC = {
|
|
|
519
519
|
error: "\x1B[31m"
|
|
520
520
|
// red
|
|
521
521
|
};
|
|
522
|
-
function
|
|
522
|
+
function HC() {
|
|
523
523
|
const g = typeof process < "u" && typeof process.env?.NODE_ENV == "string" ? process.env.NODE_ENV : void 0;
|
|
524
524
|
if (g === "production" || g === "development" || g === "test")
|
|
525
525
|
return g;
|
|
@@ -531,7 +531,7 @@ function dC() {
|
|
|
531
531
|
return "development";
|
|
532
532
|
}
|
|
533
533
|
class k {
|
|
534
|
-
static logLevel_ =
|
|
534
|
+
static logLevel_ = HC() === "production" ? "warn" : "debug";
|
|
535
535
|
static setLogLevel(A) {
|
|
536
536
|
k.logLevel_ = A;
|
|
537
537
|
}
|
|
@@ -548,8 +548,8 @@ class k {
|
|
|
548
548
|
k.log("error", A, I, ...B);
|
|
549
549
|
}
|
|
550
550
|
static log(A, I, B, ...C) {
|
|
551
|
-
if (
|
|
552
|
-
const Q = (/* @__PURE__ */ new Date()).toISOString(), E =
|
|
551
|
+
if (Pg[A] < Pg[k.logLevel_]) return;
|
|
552
|
+
const Q = (/* @__PURE__ */ new Date()).toISOString(), E = KC[A], i = `[${Q}][${A.toUpperCase()}][${I}]`, o = [`${E}${i}`, B, ...C];
|
|
553
553
|
switch (A) {
|
|
554
554
|
case "debug":
|
|
555
555
|
console.debug(...o);
|
|
@@ -566,7 +566,7 @@ class k {
|
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
568
|
}
|
|
569
|
-
class
|
|
569
|
+
class qC {
|
|
570
570
|
gl_;
|
|
571
571
|
program_;
|
|
572
572
|
uniformInfo_ = /* @__PURE__ */ new Map();
|
|
@@ -648,7 +648,7 @@ class KC {
|
|
|
648
648
|
for (let I = 0; I < A; I++) {
|
|
649
649
|
const B = this.gl_.getActiveUniform(this.program_, I);
|
|
650
650
|
if (B) {
|
|
651
|
-
if (!
|
|
651
|
+
if (!fC.has(B.type))
|
|
652
652
|
throw new Error(
|
|
653
653
|
`Unsupported uniform type "${B.type}" (GLenum) found in shader program for uniform "${B.name}"`
|
|
654
654
|
);
|
|
@@ -689,7 +689,7 @@ class KC {
|
|
|
689
689
|
return Array.from(this.uniformInfo_.keys());
|
|
690
690
|
}
|
|
691
691
|
}
|
|
692
|
-
const
|
|
692
|
+
const lC = typeof window < "u" ? [
|
|
693
693
|
WebGL2RenderingContext.BOOL,
|
|
694
694
|
WebGL2RenderingContext.FLOAT,
|
|
695
695
|
WebGL2RenderingContext.INT,
|
|
@@ -714,10 +714,10 @@ const HC = typeof window < "u" ? [
|
|
|
714
714
|
WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_3D,
|
|
715
715
|
WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_CUBE,
|
|
716
716
|
WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_2D_ARRAY
|
|
717
|
-
] : [],
|
|
718
|
-
|
|
719
|
-
),
|
|
720
|
-
class
|
|
717
|
+
] : [], fC = new Set(
|
|
718
|
+
lC
|
|
719
|
+
), pI = "#pragma inject_defines";
|
|
720
|
+
class pC {
|
|
721
721
|
gl_;
|
|
722
722
|
programs_ = /* @__PURE__ */ new Map();
|
|
723
723
|
constructor(A) {
|
|
@@ -726,14 +726,14 @@ class lC {
|
|
|
726
726
|
use(A) {
|
|
727
727
|
let I = this.programs_.get(A);
|
|
728
728
|
if (I === void 0) {
|
|
729
|
-
const B =
|
|
729
|
+
const B = dC[A], C = Og(
|
|
730
730
|
B.vertex,
|
|
731
731
|
B.vertexDefines
|
|
732
|
-
), Q =
|
|
732
|
+
), Q = Og(
|
|
733
733
|
B.fragment,
|
|
734
734
|
B.fragmentDefines
|
|
735
735
|
);
|
|
736
|
-
I = new
|
|
736
|
+
I = new qC(
|
|
737
737
|
this.gl_,
|
|
738
738
|
C,
|
|
739
739
|
Q
|
|
@@ -747,37 +747,37 @@ class lC {
|
|
|
747
747
|
return I;
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
|
-
function
|
|
750
|
+
function Og(g, A) {
|
|
751
751
|
if (A === void 0 || A.size == 0) return g;
|
|
752
|
-
if (!g.includes(
|
|
752
|
+
if (!g.includes(pI))
|
|
753
753
|
throw new Error(
|
|
754
|
-
`Shader source does not contain "${
|
|
754
|
+
`Shader source does not contain "${pI}" directive`
|
|
755
755
|
);
|
|
756
756
|
const I = Array.from(A.entries()).map(([E, i]) => `#define ${E} ${i}`).join(`
|
|
757
757
|
`), C = `#line __LINE__ + ${1 - A.size}`, Q = `${I}
|
|
758
758
|
${C}`;
|
|
759
|
-
return g.replace(
|
|
759
|
+
return g.replace(pI, Q);
|
|
760
760
|
}
|
|
761
761
|
const CI = {};
|
|
762
|
-
function
|
|
762
|
+
function ZB(g) {
|
|
763
763
|
const A = g ?? "";
|
|
764
764
|
return CI[A] = (CI[A] ?? 0) + 1, g ? `${g}-${CI[A]}` : String(CI[A]);
|
|
765
765
|
}
|
|
766
|
-
class
|
|
767
|
-
id =
|
|
766
|
+
class LI {
|
|
767
|
+
id = ZB();
|
|
768
768
|
}
|
|
769
|
-
var T = 1e-6, X = typeof Float32Array < "u" ? Float32Array : Array,
|
|
770
|
-
function
|
|
771
|
-
return g *
|
|
769
|
+
var T = 1e-6, X = typeof Float32Array < "u" ? Float32Array : Array, mC = Math.PI / 180;
|
|
770
|
+
function uC(g) {
|
|
771
|
+
return g * mC;
|
|
772
772
|
}
|
|
773
|
-
function
|
|
773
|
+
function PB() {
|
|
774
774
|
var g = new X(9);
|
|
775
775
|
return X != Float32Array && (g[1] = 0, g[2] = 0, g[3] = 0, g[5] = 0, g[6] = 0, g[7] = 0), g[0] = 1, g[4] = 1, g[8] = 1, g;
|
|
776
776
|
}
|
|
777
|
-
function
|
|
777
|
+
function TC(g, A) {
|
|
778
778
|
return g[0] = A[0], g[1] = A[1], g[2] = A[2], g[3] = A[4], g[4] = A[5], g[5] = A[6], g[6] = A[8], g[7] = A[9], g[8] = A[10], g;
|
|
779
779
|
}
|
|
780
|
-
function
|
|
780
|
+
function xC(g, A, I, B, C, Q, E, i, o) {
|
|
781
781
|
var a = new X(9);
|
|
782
782
|
return a[0] = g, a[1] = A, a[2] = I, a[3] = B, a[4] = C, a[5] = Q, a[6] = E, a[7] = i, a[8] = o, a;
|
|
783
783
|
}
|
|
@@ -785,26 +785,26 @@ function $() {
|
|
|
785
785
|
var g = new X(16);
|
|
786
786
|
return X != Float32Array && (g[1] = 0, g[2] = 0, g[3] = 0, g[4] = 0, g[6] = 0, g[7] = 0, g[8] = 0, g[9] = 0, g[11] = 0, g[12] = 0, g[13] = 0, g[14] = 0), g[0] = 1, g[5] = 1, g[10] = 1, g[15] = 1, g;
|
|
787
787
|
}
|
|
788
|
-
function
|
|
788
|
+
function JI(g, A) {
|
|
789
789
|
var I = A[0], B = A[1], C = A[2], Q = A[3], E = A[4], i = A[5], o = A[6], a = A[7], D = A[8], s = A[9], h = A[10], t = A[11], y = A[12], n = A[13], F = A[14], G = A[15], J = I * i - B * E, U = I * o - C * E, S = I * a - Q * E, r = B * o - C * i, c = B * a - Q * i, f = C * a - Q * o, Z = D * n - s * y, j = D * F - h * y, b = D * G - t * y, z = s * F - h * n, iA = s * G - t * n, oA = h * G - t * F, P = J * oA - U * iA + S * z + r * b - c * j + f * Z;
|
|
790
790
|
return P ? (P = 1 / P, g[0] = (i * oA - o * iA + a * z) * P, g[1] = (C * iA - B * oA - Q * z) * P, g[2] = (n * f - F * c + G * r) * P, g[3] = (h * c - s * f - t * r) * P, g[4] = (o * b - E * oA - a * j) * P, g[5] = (I * oA - C * b + Q * j) * P, g[6] = (F * S - y * f - G * U) * P, g[7] = (D * f - h * S + t * U) * P, g[8] = (E * iA - i * b + a * Z) * P, g[9] = (B * b - I * iA - Q * Z) * P, g[10] = (y * c - n * S + G * J) * P, g[11] = (s * S - D * c - t * J) * P, g[12] = (i * j - E * z - o * Z) * P, g[13] = (I * z - B * j + C * Z) * P, g[14] = (n * U - y * r - F * J) * P, g[15] = (D * r - s * U + h * J) * P, g) : null;
|
|
791
791
|
}
|
|
792
|
-
function
|
|
792
|
+
function XI(g, A, I) {
|
|
793
793
|
var B = A[0], C = A[1], Q = A[2], E = A[3], i = A[4], o = A[5], a = A[6], D = A[7], s = A[8], h = A[9], t = A[10], y = A[11], n = A[12], F = A[13], G = A[14], J = A[15], U = I[0], S = I[1], r = I[2], c = I[3];
|
|
794
794
|
return g[0] = U * B + S * i + r * s + c * n, g[1] = U * C + S * o + r * h + c * F, g[2] = U * Q + S * a + r * t + c * G, g[3] = U * E + S * D + r * y + c * J, U = I[4], S = I[5], r = I[6], c = I[7], g[4] = U * B + S * i + r * s + c * n, g[5] = U * C + S * o + r * h + c * F, g[6] = U * Q + S * a + r * t + c * G, g[7] = U * E + S * D + r * y + c * J, U = I[8], S = I[9], r = I[10], c = I[11], g[8] = U * B + S * i + r * s + c * n, g[9] = U * C + S * o + r * h + c * F, g[10] = U * Q + S * a + r * t + c * G, g[11] = U * E + S * D + r * y + c * J, U = I[12], S = I[13], r = I[14], c = I[15], g[12] = U * B + S * i + r * s + c * n, g[13] = U * C + S * o + r * h + c * F, g[14] = U * Q + S * a + r * t + c * G, g[15] = U * E + S * D + r * y + c * J, g;
|
|
795
795
|
}
|
|
796
|
-
function
|
|
796
|
+
function WC(g, A, I) {
|
|
797
797
|
var B = I[0], C = I[1], Q = I[2], E, i, o, a, D, s, h, t, y, n, F, G;
|
|
798
798
|
return A === g ? (g[12] = A[0] * B + A[4] * C + A[8] * Q + A[12], g[13] = A[1] * B + A[5] * C + A[9] * Q + A[13], g[14] = A[2] * B + A[6] * C + A[10] * Q + A[14], g[15] = A[3] * B + A[7] * C + A[11] * Q + A[15]) : (E = A[0], i = A[1], o = A[2], a = A[3], D = A[4], s = A[5], h = A[6], t = A[7], y = A[8], n = A[9], F = A[10], G = A[11], g[0] = E, g[1] = i, g[2] = o, g[3] = a, g[4] = D, g[5] = s, g[6] = h, g[7] = t, g[8] = y, g[9] = n, g[10] = F, g[11] = G, g[12] = E * B + D * C + y * Q + A[12], g[13] = i * B + s * C + n * Q + A[13], g[14] = o * B + h * C + F * Q + A[14], g[15] = a * B + t * C + G * Q + A[15]), g;
|
|
799
799
|
}
|
|
800
|
-
function
|
|
800
|
+
function OB(g, A) {
|
|
801
801
|
return g[0] = A[0], g[1] = 0, g[2] = 0, g[3] = 0, g[4] = 0, g[5] = A[1], g[6] = 0, g[7] = 0, g[8] = 0, g[9] = 0, g[10] = A[2], g[11] = 0, g[12] = 0, g[13] = 0, g[14] = 0, g[15] = 1, g;
|
|
802
802
|
}
|
|
803
|
-
function
|
|
803
|
+
function bC(g, A, I, B) {
|
|
804
804
|
var C = A[0], Q = A[1], E = A[2], i = A[3], o = C + C, a = Q + Q, D = E + E, s = C * o, h = C * a, t = C * D, y = Q * a, n = Q * D, F = E * D, G = i * o, J = i * a, U = i * D, S = B[0], r = B[1], c = B[2];
|
|
805
805
|
return g[0] = (1 - (y + F)) * S, g[1] = (h + U) * S, g[2] = (t - J) * S, g[3] = 0, g[4] = (h - U) * r, g[5] = (1 - (s + F)) * r, g[6] = (n + G) * r, g[7] = 0, g[8] = (t + J) * c, g[9] = (n - G) * c, g[10] = (1 - (s + y)) * c, g[11] = 0, g[12] = I[0], g[13] = I[1], g[14] = I[2], g[15] = 1, g;
|
|
806
806
|
}
|
|
807
|
-
function
|
|
807
|
+
function ZC(g, A, I, B, C) {
|
|
808
808
|
var Q = 1 / Math.tan(A / 2);
|
|
809
809
|
if (g[0] = Q / I, g[1] = 0, g[2] = 0, g[3] = 0, g[4] = 0, g[5] = Q, g[6] = 0, g[7] = 0, g[8] = 0, g[9] = 0, g[11] = -1, g[12] = 0, g[13] = 0, g[15] = 0, C != null && C !== 1 / 0) {
|
|
810
810
|
var E = 1 / (B - C);
|
|
@@ -813,21 +813,21 @@ function WC(g, A, I, B, C) {
|
|
|
813
813
|
g[10] = -1, g[14] = -2 * B;
|
|
814
814
|
return g;
|
|
815
815
|
}
|
|
816
|
-
var
|
|
817
|
-
function
|
|
816
|
+
var PC = ZC;
|
|
817
|
+
function OC(g, A, I, B, C, Q, E) {
|
|
818
818
|
var i = 1 / (A - I), o = 1 / (B - C), a = 1 / (Q - E);
|
|
819
819
|
return g[0] = -2 * i, g[1] = 0, g[2] = 0, g[3] = 0, g[4] = 0, g[5] = -2 * o, g[6] = 0, g[7] = 0, g[8] = 0, g[9] = 0, g[10] = 2 * a, g[11] = 0, g[12] = (A + I) * i, g[13] = (C + B) * o, g[14] = (E + Q) * a, g[15] = 1, g;
|
|
820
820
|
}
|
|
821
|
-
var
|
|
822
|
-
function
|
|
821
|
+
var VC = OC;
|
|
822
|
+
function vC(g, A, I, B) {
|
|
823
823
|
var C = A[0], Q = A[1], E = A[2], i = B[0], o = B[1], a = B[2], D = C - I[0], s = Q - I[1], h = E - I[2], t = D * D + s * s + h * h;
|
|
824
824
|
t > 0 && (t = 1 / Math.sqrt(t), D *= t, s *= t, h *= t);
|
|
825
825
|
var y = o * h - a * s, n = a * D - i * h, F = i * s - o * D;
|
|
826
826
|
return t = y * y + n * n + F * F, t > 0 && (t = 1 / Math.sqrt(t), y *= t, n *= t, F *= t), g[0] = y, g[1] = n, g[2] = F, g[3] = 0, g[4] = s * F - h * n, g[5] = h * y - D * F, g[6] = D * n - s * y, g[7] = 0, g[8] = D, g[9] = s, g[10] = h, g[11] = 0, g[12] = C, g[13] = Q, g[14] = E, g[15] = 1, g;
|
|
827
827
|
}
|
|
828
|
-
function
|
|
829
|
-
var I = g[0], B = g[1], C = g[2], Q = g[3], E = g[4], i = g[5], o = g[6], a = g[7], D = g[8], s = g[9], h = g[10], t = g[11], y = g[12], n = g[13], F = g[14], G = g[15], J = A[0], U = A[1], S = A[2], r = A[3], c = A[4], f = A[5], Z = A[6], j = A[7], b = A[8], z = A[9], iA = A[10], oA = A[11], P = A[12],
|
|
830
|
-
return Math.abs(I - J) <= T * Math.max(1, Math.abs(I), Math.abs(J)) && Math.abs(B - U) <= T * Math.max(1, Math.abs(B), Math.abs(U)) && Math.abs(C - S) <= T * Math.max(1, Math.abs(C), Math.abs(S)) && Math.abs(Q - r) <= T * Math.max(1, Math.abs(Q), Math.abs(r)) && Math.abs(E - c) <= T * Math.max(1, Math.abs(E), Math.abs(c)) && Math.abs(i - f) <= T * Math.max(1, Math.abs(i), Math.abs(f)) && Math.abs(o - Z) <= T * Math.max(1, Math.abs(o), Math.abs(Z)) && Math.abs(a - j) <= T * Math.max(1, Math.abs(a), Math.abs(j)) && Math.abs(D - b) <= T * Math.max(1, Math.abs(D), Math.abs(b)) && Math.abs(s - z) <= T * Math.max(1, Math.abs(s), Math.abs(z)) && Math.abs(h - iA) <= T * Math.max(1, Math.abs(h), Math.abs(iA)) && Math.abs(t - oA) <= T * Math.max(1, Math.abs(t), Math.abs(oA)) && Math.abs(y - P) <= T * Math.max(1, Math.abs(y), Math.abs(P)) && Math.abs(n -
|
|
828
|
+
function XC(g, A) {
|
|
829
|
+
var I = g[0], B = g[1], C = g[2], Q = g[3], E = g[4], i = g[5], o = g[6], a = g[7], D = g[8], s = g[9], h = g[10], t = g[11], y = g[12], n = g[13], F = g[14], G = g[15], J = A[0], U = A[1], S = A[2], r = A[3], c = A[4], f = A[5], Z = A[6], j = A[7], b = A[8], z = A[9], iA = A[10], oA = A[11], P = A[12], xg = A[13], Wg = A[14], bg = A[15];
|
|
830
|
+
return Math.abs(I - J) <= T * Math.max(1, Math.abs(I), Math.abs(J)) && Math.abs(B - U) <= T * Math.max(1, Math.abs(B), Math.abs(U)) && Math.abs(C - S) <= T * Math.max(1, Math.abs(C), Math.abs(S)) && Math.abs(Q - r) <= T * Math.max(1, Math.abs(Q), Math.abs(r)) && Math.abs(E - c) <= T * Math.max(1, Math.abs(E), Math.abs(c)) && Math.abs(i - f) <= T * Math.max(1, Math.abs(i), Math.abs(f)) && Math.abs(o - Z) <= T * Math.max(1, Math.abs(o), Math.abs(Z)) && Math.abs(a - j) <= T * Math.max(1, Math.abs(a), Math.abs(j)) && Math.abs(D - b) <= T * Math.max(1, Math.abs(D), Math.abs(b)) && Math.abs(s - z) <= T * Math.max(1, Math.abs(s), Math.abs(z)) && Math.abs(h - iA) <= T * Math.max(1, Math.abs(h), Math.abs(iA)) && Math.abs(t - oA) <= T * Math.max(1, Math.abs(t), Math.abs(oA)) && Math.abs(y - P) <= T * Math.max(1, Math.abs(y), Math.abs(P)) && Math.abs(n - xg) <= T * Math.max(1, Math.abs(n), Math.abs(xg)) && Math.abs(F - Wg) <= T * Math.max(1, Math.abs(F), Math.abs(Wg)) && Math.abs(G - bg) <= T * Math.max(1, Math.abs(G), Math.abs(bg));
|
|
831
831
|
}
|
|
832
832
|
function d() {
|
|
833
833
|
var g = new X(3);
|
|
@@ -845,7 +845,7 @@ function p(g, A, I) {
|
|
|
845
845
|
var B = new X(3);
|
|
846
846
|
return B[0] = g, B[1] = A, B[2] = I, B;
|
|
847
847
|
}
|
|
848
|
-
function
|
|
848
|
+
function jI(g, A) {
|
|
849
849
|
return g[0] = A[0], g[1] = A[1], g[2] = A[2], g;
|
|
850
850
|
}
|
|
851
851
|
function rA(g, A, I, B) {
|
|
@@ -857,20 +857,20 @@ function JA(g, A, I) {
|
|
|
857
857
|
function yg(g, A, I) {
|
|
858
858
|
return g[0] = A[0] - I[0], g[1] = A[1] - I[1], g[2] = A[2] - I[2], g;
|
|
859
859
|
}
|
|
860
|
-
function
|
|
860
|
+
function jC(g, A, I) {
|
|
861
861
|
return g[0] = A[0] * I[0], g[1] = A[1] * I[1], g[2] = A[2] * I[2], g;
|
|
862
862
|
}
|
|
863
|
-
function
|
|
863
|
+
function VA(g, A, I) {
|
|
864
864
|
return g[0] = A[0] * I, g[1] = A[1] * I, g[2] = A[2] * I, g;
|
|
865
865
|
}
|
|
866
|
-
function
|
|
866
|
+
function zI(g, A, I, B) {
|
|
867
867
|
return g[0] = A[0] + I[0] * B, g[1] = A[1] + I[1] * B, g[2] = A[2] + I[2] * B, g;
|
|
868
868
|
}
|
|
869
|
-
function
|
|
869
|
+
function Vg(g, A) {
|
|
870
870
|
var I = A[0] - g[0], B = A[1] - g[1], C = A[2] - g[2];
|
|
871
871
|
return I * I + B * B + C * C;
|
|
872
872
|
}
|
|
873
|
-
function
|
|
873
|
+
function VB(g, A) {
|
|
874
874
|
var I = A[0], B = A[1], C = A[2], Q = I * I + B * B + C * C;
|
|
875
875
|
return Q > 0 && (Q = 1 / Math.sqrt(Q)), g[0] = A[0] * Q, g[1] = A[1] * Q, g[2] = A[2] * Q, g;
|
|
876
876
|
}
|
|
@@ -885,18 +885,18 @@ function eg(g, A, I) {
|
|
|
885
885
|
var B = A[0], C = A[1], Q = A[2], E = I[3] * B + I[7] * C + I[11] * Q + I[15];
|
|
886
886
|
return E = E || 1, g[0] = (I[0] * B + I[4] * C + I[8] * Q + I[12]) / E, g[1] = (I[1] * B + I[5] * C + I[9] * Q + I[13]) / E, g[2] = (I[2] * B + I[6] * C + I[10] * Q + I[14]) / E, g;
|
|
887
887
|
}
|
|
888
|
-
function
|
|
888
|
+
function vB(g, A, I) {
|
|
889
889
|
var B = I[0], C = I[1], Q = I[2], E = I[3], i = A[0], o = A[1], a = A[2], D = C * a - Q * o, s = Q * i - B * a, h = B * o - C * i;
|
|
890
890
|
return D = D + D, s = s + s, h = h + h, g[0] = i + E * D + C * h - Q * s, g[1] = o + E * s + Q * D - B * h, g[2] = a + E * h + B * s - C * D, g;
|
|
891
891
|
}
|
|
892
|
-
function
|
|
892
|
+
function zC(g) {
|
|
893
893
|
return g[0] = 0, g[1] = 0, g[2] = 0, g;
|
|
894
894
|
}
|
|
895
895
|
function ng(g, A) {
|
|
896
896
|
var I = g[0], B = g[1], C = g[2], Q = A[0], E = A[1], i = A[2];
|
|
897
897
|
return Math.abs(I - Q) <= T * Math.max(1, Math.abs(I), Math.abs(Q)) && Math.abs(B - E) <= T * Math.max(1, Math.abs(B), Math.abs(E)) && Math.abs(C - i) <= T * Math.max(1, Math.abs(C), Math.abs(i));
|
|
898
898
|
}
|
|
899
|
-
var
|
|
899
|
+
var _I = yg, _C = tg;
|
|
900
900
|
(function() {
|
|
901
901
|
var g = d();
|
|
902
902
|
return function(A, I, B, C, Q, E) {
|
|
@@ -910,7 +910,7 @@ function YA() {
|
|
|
910
910
|
var g = new X(4);
|
|
911
911
|
return X != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0, g[3] = 0), g;
|
|
912
912
|
}
|
|
913
|
-
function
|
|
913
|
+
function $C(g) {
|
|
914
914
|
var A = new X(4);
|
|
915
915
|
return A[0] = g[0], A[1] = g[1], A[2] = g[2], A[3] = g[3], A;
|
|
916
916
|
}
|
|
@@ -918,17 +918,17 @@ function DI(g, A, I, B) {
|
|
|
918
918
|
var C = new X(4);
|
|
919
919
|
return C[0] = g, C[1] = A, C[2] = I, C[3] = B, C;
|
|
920
920
|
}
|
|
921
|
-
function
|
|
921
|
+
function AQ(g, A) {
|
|
922
922
|
return g[0] = A[0], g[1] = A[1], g[2] = A[2], g[3] = A[3], g;
|
|
923
923
|
}
|
|
924
|
-
function
|
|
924
|
+
function IQ(g, A, I) {
|
|
925
925
|
return g[0] = A[0] * I, g[1] = A[1] * I, g[2] = A[2] * I, g[3] = A[3] * I, g;
|
|
926
926
|
}
|
|
927
|
-
function
|
|
927
|
+
function gQ(g, A) {
|
|
928
928
|
var I = A[0], B = A[1], C = A[2], Q = A[3], E = I * I + B * B + C * C + Q * Q;
|
|
929
929
|
return E > 0 && (E = 1 / Math.sqrt(E)), g[0] = I * E, g[1] = B * E, g[2] = C * E, g[3] = Q * E, g;
|
|
930
930
|
}
|
|
931
|
-
function
|
|
931
|
+
function vA(g, A, I) {
|
|
932
932
|
var B = A[0], C = A[1], Q = A[2], E = A[3];
|
|
933
933
|
return g[0] = I[0] * B + I[4] * C + I[8] * Q + I[12] * E, g[1] = I[1] * B + I[5] * C + I[9] * Q + I[13] * E, g[2] = I[2] * B + I[6] * C + I[10] * Q + I[14] * E, g[3] = I[3] * B + I[7] * C + I[11] * Q + I[15] * E, g;
|
|
934
934
|
}
|
|
@@ -945,16 +945,16 @@ function sI() {
|
|
|
945
945
|
var g = new X(4);
|
|
946
946
|
return X != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0), g[3] = 1, g;
|
|
947
947
|
}
|
|
948
|
-
function
|
|
948
|
+
function BQ(g, A, I) {
|
|
949
949
|
I = I * 0.5;
|
|
950
950
|
var B = Math.sin(I);
|
|
951
951
|
return g[0] = B * A[0], g[1] = B * A[1], g[2] = B * A[2], g[3] = Math.cos(I), g;
|
|
952
952
|
}
|
|
953
|
-
function
|
|
953
|
+
function CQ(g, A, I) {
|
|
954
954
|
var B = A[0], C = A[1], Q = A[2], E = A[3], i = I[0], o = I[1], a = I[2], D = I[3];
|
|
955
955
|
return g[0] = B * D + E * i + C * a - Q * o, g[1] = C * D + E * o + Q * i - B * a, g[2] = Q * D + E * a + B * o - C * i, g[3] = E * D - B * i - C * o - Q * a, g;
|
|
956
956
|
}
|
|
957
|
-
function
|
|
957
|
+
function mI(g, A, I, B) {
|
|
958
958
|
var C = A[0], Q = A[1], E = A[2], i = A[3], o = I[0], a = I[1], D = I[2], s = I[3], h, t, y, n, F;
|
|
959
959
|
return t = C * o + Q * a + E * D + i * s, t < 0 && (t = -t, o = -o, a = -a, D = -D, s = -s), 1 - t > T ? (h = Math.acos(t), y = Math.sin(h), n = Math.sin((1 - B) * h) / y, F = Math.sin(B * h) / y) : (n = 1 - B, F = B), g[0] = n * C + F * o, g[1] = n * Q + F * a, g[2] = n * E + F * D, g[3] = n * i + F * s, g;
|
|
960
960
|
}
|
|
@@ -970,31 +970,31 @@ function Gg(g, A) {
|
|
|
970
970
|
}
|
|
971
971
|
return g;
|
|
972
972
|
}
|
|
973
|
-
var
|
|
973
|
+
var QQ = $C, EQ = AQ, YI = gQ;
|
|
974
974
|
(function() {
|
|
975
975
|
var g = d(), A = p(1, 0, 0), I = p(0, 1, 0);
|
|
976
976
|
return function(B, C, Q) {
|
|
977
977
|
var E = aI(C, Q);
|
|
978
|
-
return E < -0.999999 ? (EI(g, A, C),
|
|
978
|
+
return E < -0.999999 ? (EI(g, A, C), _C(g) < 1e-6 && EI(g, I, C), VB(g, g), BQ(B, g, Math.PI), B) : E > 0.999999 ? (B[0] = 0, B[1] = 0, B[2] = 0, B[3] = 1, B) : (EI(g, C, Q), B[0] = g[0], B[1] = g[1], B[2] = g[2], B[3] = 1 + E, YI(B, B));
|
|
979
979
|
};
|
|
980
980
|
})();
|
|
981
981
|
(function() {
|
|
982
982
|
var g = sI(), A = sI();
|
|
983
983
|
return function(I, B, C, Q, E, i) {
|
|
984
|
-
return
|
|
984
|
+
return mI(g, B, E, i), mI(A, C, Q, i), mI(I, g, A, 2 * i * (1 - i)), I;
|
|
985
985
|
};
|
|
986
986
|
})();
|
|
987
987
|
(function() {
|
|
988
|
-
var g =
|
|
988
|
+
var g = PB();
|
|
989
989
|
return function(A, I, B, C) {
|
|
990
|
-
return g[0] = B[0], g[3] = B[1], g[6] = B[2], g[1] = C[0], g[4] = C[1], g[7] = C[2], g[2] = -I[0], g[5] = -I[1], g[8] = -I[2],
|
|
990
|
+
return g[0] = B[0], g[3] = B[1], g[6] = B[2], g[1] = C[0], g[4] = C[1], g[7] = C[2], g[2] = -I[0], g[5] = -I[1], g[8] = -I[2], YI(A, Gg(A, g));
|
|
991
991
|
};
|
|
992
992
|
})();
|
|
993
|
-
function
|
|
993
|
+
function XB() {
|
|
994
994
|
var g = new X(2);
|
|
995
995
|
return X != Float32Array && (g[0] = 0, g[1] = 0), g;
|
|
996
996
|
}
|
|
997
|
-
function
|
|
997
|
+
function vg(g) {
|
|
998
998
|
var A = new X(2);
|
|
999
999
|
return A[0] = g[0], A[1] = g[1], A;
|
|
1000
1000
|
}
|
|
@@ -1002,27 +1002,27 @@ function V(g, A) {
|
|
|
1002
1002
|
var I = new X(2);
|
|
1003
1003
|
return I[0] = g, I[1] = A, I;
|
|
1004
1004
|
}
|
|
1005
|
-
function
|
|
1005
|
+
function iQ(g, A) {
|
|
1006
1006
|
var I = A[0] - g[0], B = A[1] - g[1];
|
|
1007
1007
|
return Math.sqrt(I * I + B * B);
|
|
1008
1008
|
}
|
|
1009
|
-
function
|
|
1009
|
+
function oQ(g) {
|
|
1010
1010
|
var A = g[0], I = g[1];
|
|
1011
1011
|
return A * A + I * I;
|
|
1012
1012
|
}
|
|
1013
|
-
function
|
|
1013
|
+
function aQ(g, A, I, B) {
|
|
1014
1014
|
var C = A[0], Q = A[1];
|
|
1015
1015
|
return g[0] = C + B * (I[0] - C), g[1] = Q + B * (I[1] - Q), g;
|
|
1016
1016
|
}
|
|
1017
|
-
function
|
|
1017
|
+
function Xg(g, A) {
|
|
1018
1018
|
return g[0] === A[0] && g[1] === A[1];
|
|
1019
1019
|
}
|
|
1020
|
-
function
|
|
1020
|
+
function uI(g, A) {
|
|
1021
1021
|
var I = g[0], B = g[1], C = A[0], Q = A[1];
|
|
1022
1022
|
return Math.abs(I - C) <= T * Math.max(1, Math.abs(I), Math.abs(C)) && Math.abs(B - Q) <= T * Math.max(1, Math.abs(B), Math.abs(Q));
|
|
1023
1023
|
}
|
|
1024
1024
|
(function() {
|
|
1025
|
-
var g =
|
|
1025
|
+
var g = XB();
|
|
1026
1026
|
return function(A, I, B, C, Q, E) {
|
|
1027
1027
|
var i, o;
|
|
1028
1028
|
for (I || (I = 2), B || (B = 0), C ? o = Math.min(C * I + B, A.length) : o = A.length, i = B; i < o; i += I)
|
|
@@ -1072,7 +1072,7 @@ class SA {
|
|
|
1072
1072
|
eg(Q, E, A), this.expandWithPoint(Q);
|
|
1073
1073
|
}
|
|
1074
1074
|
}
|
|
1075
|
-
const
|
|
1075
|
+
const DQ = {
|
|
1076
1076
|
position: 0,
|
|
1077
1077
|
normal: 1,
|
|
1078
1078
|
uv: 2,
|
|
@@ -1083,7 +1083,7 @@ const oQ = {
|
|
|
1083
1083
|
size: 7,
|
|
1084
1084
|
marker: 8
|
|
1085
1085
|
};
|
|
1086
|
-
class mA extends
|
|
1086
|
+
class mA extends LI {
|
|
1087
1087
|
boundingBox_ = null;
|
|
1088
1088
|
primitive_;
|
|
1089
1089
|
attributes_;
|
|
@@ -1135,7 +1135,7 @@ class mA extends hg {
|
|
|
1135
1135
|
return this.attributes_.find((I) => I.type === A);
|
|
1136
1136
|
}
|
|
1137
1137
|
}
|
|
1138
|
-
class
|
|
1138
|
+
class sQ {
|
|
1139
1139
|
gl_;
|
|
1140
1140
|
buffers_ = /* @__PURE__ */ new Map();
|
|
1141
1141
|
currentGeometry_ = null;
|
|
@@ -1171,7 +1171,7 @@ class aQ {
|
|
|
1171
1171
|
this.gl_.bindBuffer(C, Q), this.gl_.bufferData(C, B, this.gl_.STATIC_DRAW);
|
|
1172
1172
|
const { attributes: E, strideBytes: i } = A;
|
|
1173
1173
|
E.forEach((D) => {
|
|
1174
|
-
const s =
|
|
1174
|
+
const s = DQ[D.type];
|
|
1175
1175
|
this.gl_.vertexAttribPointer(
|
|
1176
1176
|
s,
|
|
1177
1177
|
D.itemSize,
|
|
@@ -1190,7 +1190,7 @@ class aQ {
|
|
|
1190
1190
|
this.buffers_.set(A, o), this.gl_.bindVertexArray(null);
|
|
1191
1191
|
}
|
|
1192
1192
|
}
|
|
1193
|
-
function
|
|
1193
|
+
function hQ(g) {
|
|
1194
1194
|
return g === 1 || g === 2 || g === 4 || g === 8;
|
|
1195
1195
|
}
|
|
1196
1196
|
function wg(g) {
|
|
@@ -1210,7 +1210,7 @@ function wg(g) {
|
|
|
1210
1210
|
return "float";
|
|
1211
1211
|
throw new Error("Unsupported buffer type.");
|
|
1212
1212
|
}
|
|
1213
|
-
function
|
|
1213
|
+
function tQ(g) {
|
|
1214
1214
|
switch (g.dataFormat) {
|
|
1215
1215
|
case "scalar":
|
|
1216
1216
|
return 1;
|
|
@@ -1220,7 +1220,7 @@ function sQ(g) {
|
|
|
1220
1220
|
return 4;
|
|
1221
1221
|
}
|
|
1222
1222
|
}
|
|
1223
|
-
function
|
|
1223
|
+
function yQ(g) {
|
|
1224
1224
|
switch (g.dataType) {
|
|
1225
1225
|
case "byte":
|
|
1226
1226
|
case "unsigned_byte":
|
|
@@ -1234,14 +1234,14 @@ function hQ(g) {
|
|
|
1234
1234
|
return 4;
|
|
1235
1235
|
}
|
|
1236
1236
|
}
|
|
1237
|
-
function
|
|
1238
|
-
const A =
|
|
1237
|
+
function $I(g) {
|
|
1238
|
+
const A = tQ(g) * yQ(g), I = Math.max(1, g.mipmapLevels);
|
|
1239
1239
|
let B = Math.max(1, g.width), C = Math.max(1, g.height), Q = Math.max(1, g.depth), E = 0;
|
|
1240
1240
|
for (let i = 0; i < I; ++i)
|
|
1241
1241
|
E += A * Q * B * C, B = Math.max(1, B >> 1), C = Math.max(1, C >> 1), g.type === "Texture3D" && (Q = Math.max(1, Q >> 1));
|
|
1242
1242
|
return E;
|
|
1243
1243
|
}
|
|
1244
|
-
function
|
|
1244
|
+
function eQ(g) {
|
|
1245
1245
|
if (g.dataFormat === "rgb" || g.dataFormat === "rgba")
|
|
1246
1246
|
return [0, 1];
|
|
1247
1247
|
switch (g.dataType) {
|
|
@@ -1261,7 +1261,7 @@ function tQ(g) {
|
|
|
1261
1261
|
return [0, 1];
|
|
1262
1262
|
}
|
|
1263
1263
|
}
|
|
1264
|
-
class Fg extends
|
|
1264
|
+
class Fg extends LI {
|
|
1265
1265
|
dataFormat = "rgba";
|
|
1266
1266
|
dataType = "unsigned_byte";
|
|
1267
1267
|
maxFilter = "nearest";
|
|
@@ -1292,7 +1292,7 @@ class Fg extends hg {
|
|
|
1292
1292
|
return "Texture";
|
|
1293
1293
|
}
|
|
1294
1294
|
}
|
|
1295
|
-
class
|
|
1295
|
+
class nQ {
|
|
1296
1296
|
gl_;
|
|
1297
1297
|
textures_ = /* @__PURE__ */ new Map();
|
|
1298
1298
|
currentTexture_ = null;
|
|
@@ -1370,7 +1370,7 @@ class yQ {
|
|
|
1370
1370
|
const I = this.textures_.get(A);
|
|
1371
1371
|
if (I) {
|
|
1372
1372
|
this.gl_.deleteTexture(I), this.textures_.delete(A), A.readTexel = void 0, this.currentTexture_ === A && (this.currentTexture_ = null);
|
|
1373
|
-
const B =
|
|
1373
|
+
const B = $I(A);
|
|
1374
1374
|
this.gpuTextureBytes_ = Math.max(0, this.gpuTextureBytes_ - B), this.textureCount_ = Math.max(0, this.textureCount_ - 1);
|
|
1375
1375
|
}
|
|
1376
1376
|
}
|
|
@@ -1404,7 +1404,7 @@ class yQ {
|
|
|
1404
1404
|
);
|
|
1405
1405
|
else
|
|
1406
1406
|
throw new Error(`Unknown texture type ${A.type}`);
|
|
1407
|
-
this.gpuTextureBytes_ +=
|
|
1407
|
+
this.gpuTextureBytes_ += $I(A), this.textureCount_ += 1, this.textures_.set(A, C), this.gl_.bindTexture(B, null), A.readTexel = (Q, E, i) => Promise.resolve(this.readTexel(A, Q, E, i));
|
|
1408
1408
|
}
|
|
1409
1409
|
configureTextureParameters(A, I) {
|
|
1410
1410
|
const B = this.gl_, C = this.getFilter(A.minFilter, A), Q = this.getFilter(A.maxFilter, A);
|
|
@@ -1564,7 +1564,7 @@ class AA {
|
|
|
1564
1564
|
* the first element, and avoids biasing toward (0,0).
|
|
1565
1565
|
*/
|
|
1566
1566
|
constructor(A, I) {
|
|
1567
|
-
this.min = A ?
|
|
1567
|
+
this.min = A ? vg(A) : V(1 / 0, 1 / 0), this.max = I ? vg(I) : V(-1 / 0, -1 / 0);
|
|
1568
1568
|
}
|
|
1569
1569
|
clone() {
|
|
1570
1570
|
return new AA(this.min, this.max);
|
|
@@ -1577,7 +1577,7 @@ class AA {
|
|
|
1577
1577
|
return !(A.max[0] <= I.min[0] || A.min[0] >= I.max[0] || A.max[1] <= I.min[1] || A.min[1] >= I.max[1]);
|
|
1578
1578
|
}
|
|
1579
1579
|
static equals(A, I) {
|
|
1580
|
-
return
|
|
1580
|
+
return Xg(A.min, I.min) && Xg(A.max, I.max);
|
|
1581
1581
|
}
|
|
1582
1582
|
floor() {
|
|
1583
1583
|
return new AA(
|
|
@@ -1590,7 +1590,7 @@ class AA {
|
|
|
1590
1590
|
return { x: A, y: I, width: B, height: C };
|
|
1591
1591
|
}
|
|
1592
1592
|
}
|
|
1593
|
-
class
|
|
1593
|
+
class GQ {
|
|
1594
1594
|
gl_;
|
|
1595
1595
|
enabledCapabilities_ = /* @__PURE__ */ new Map();
|
|
1596
1596
|
depthMaskEnabled_ = null;
|
|
@@ -1696,8 +1696,8 @@ class eQ {
|
|
|
1696
1696
|
(this.stencilFunc_ !== A || this.stencilRef_ !== I || this.stencilFuncMask_ !== B) && (this.gl_.stencilFunc(A, I, B), this.stencilFunc_ = A, this.stencilRef_ = I, this.stencilFuncMask_ = B);
|
|
1697
1697
|
}
|
|
1698
1698
|
}
|
|
1699
|
-
const
|
|
1700
|
-
class
|
|
1699
|
+
const wQ = OB($(), [1, -1, 1]);
|
|
1700
|
+
class FQ extends cC {
|
|
1701
1701
|
gl_;
|
|
1702
1702
|
programs_;
|
|
1703
1703
|
bindings_;
|
|
@@ -1718,7 +1718,7 @@ class GQ extends RC {
|
|
|
1718
1718
|
this.gl_ = I, k.info(
|
|
1719
1719
|
"WebGLRenderer",
|
|
1720
1720
|
`WebGL version ${I.getParameter(I.VERSION)}`
|
|
1721
|
-
), I.getExtension("EXT_color_buffer_float"), this.programs_ = new
|
|
1721
|
+
), I.getExtension("EXT_color_buffer_float"), this.programs_ = new pC(I), this.bindings_ = new sQ(I), this.textures_ = new nQ(I), this.state_ = new GQ(I), this.initStencil(), this.resize(this.canvas.width, this.canvas.height);
|
|
1722
1722
|
}
|
|
1723
1723
|
get gpuTextureBytes() {
|
|
1724
1724
|
return this.textures_.gpuTextureBytes;
|
|
@@ -1799,13 +1799,13 @@ class GQ extends RC {
|
|
|
1799
1799
|
}
|
|
1800
1800
|
}
|
|
1801
1801
|
drawGeometry(A, I, B, C, Q) {
|
|
1802
|
-
const E =
|
|
1802
|
+
const E = XI(
|
|
1803
1803
|
$(),
|
|
1804
1804
|
Q.viewMatrix,
|
|
1805
1805
|
I.transform.matrix
|
|
1806
|
-
), i =
|
|
1806
|
+
), i = XI(
|
|
1807
1807
|
$(),
|
|
1808
|
-
|
|
1808
|
+
wQ,
|
|
1809
1809
|
Q.projectionMatrix
|
|
1810
1810
|
), o = this.currentViewportSize_, a = I.getUniforms(), s = {
|
|
1811
1811
|
...B.getUniforms(),
|
|
@@ -1832,7 +1832,7 @@ class GQ extends RC {
|
|
|
1832
1832
|
);
|
|
1833
1833
|
break;
|
|
1834
1834
|
case "u_cameraPositionModel": {
|
|
1835
|
-
const n =
|
|
1835
|
+
const n = JI($(), E), F = DI(0, 0, 0, 1), G = vA(
|
|
1836
1836
|
YA(),
|
|
1837
1837
|
F,
|
|
1838
1838
|
n
|
|
@@ -1886,11 +1886,11 @@ class GQ extends RC {
|
|
|
1886
1886
|
), this.state_.setDepthTesting(!0), this.gl_.depthFunc(this.gl_.LEQUAL);
|
|
1887
1887
|
}
|
|
1888
1888
|
}
|
|
1889
|
-
function
|
|
1889
|
+
function bA(g, A) {
|
|
1890
1890
|
const I = g.priority ?? Number.MAX_SAFE_INTEGER, B = A.priority ?? Number.MAX_SAFE_INTEGER;
|
|
1891
1891
|
return I === B ? (g.orderKey ?? Number.MAX_SAFE_INTEGER) - (A.orderKey ?? Number.MAX_SAFE_INTEGER) : I - B;
|
|
1892
1892
|
}
|
|
1893
|
-
class
|
|
1893
|
+
class rQ {
|
|
1894
1894
|
maxConcurrent_;
|
|
1895
1895
|
pending_ = [];
|
|
1896
1896
|
running_ = /* @__PURE__ */ new Map();
|
|
@@ -1920,7 +1920,7 @@ class wQ {
|
|
|
1920
1920
|
}
|
|
1921
1921
|
pump() {
|
|
1922
1922
|
if (!(this.running_.size >= this.maxConcurrent_ || this.pending_.length === 0))
|
|
1923
|
-
for (this.pending_.sort((A, I) =>
|
|
1923
|
+
for (this.pending_.sort((A, I) => bA(A.chunk, I.chunk)); this.running_.size < this.maxConcurrent_ && this.pending_.length > 0; )
|
|
1924
1924
|
this.start(this.pending_.shift());
|
|
1925
1925
|
}
|
|
1926
1926
|
start(A) {
|
|
@@ -1940,16 +1940,16 @@ class wQ {
|
|
|
1940
1940
|
}
|
|
1941
1941
|
}
|
|
1942
1942
|
let hI = 0, tI = 0;
|
|
1943
|
-
function
|
|
1943
|
+
function SQ(g, A) {
|
|
1944
1944
|
g.data && (hI -= g.data.byteLength, tI -= 1), g.data = A, hI += A.byteLength, tI += 1;
|
|
1945
1945
|
}
|
|
1946
|
-
function
|
|
1946
|
+
function jg(g) {
|
|
1947
1947
|
g.data && (hI -= g.data.byteLength, tI -= 1), g.data = void 0, g.texture?.releaseCpuData();
|
|
1948
1948
|
}
|
|
1949
|
-
function
|
|
1949
|
+
function RQ() {
|
|
1950
1950
|
return { cpuChunkBytes: hI, cpuChunkCount: tI };
|
|
1951
1951
|
}
|
|
1952
|
-
function
|
|
1952
|
+
function zg(g, A, I = 1e-6) {
|
|
1953
1953
|
return Math.abs(g - A) <= I;
|
|
1954
1954
|
}
|
|
1955
1955
|
const W = {
|
|
@@ -1970,7 +1970,7 @@ function MA(g) {
|
|
|
1970
1970
|
function dA(g) {
|
|
1971
1971
|
const A = d(), I = d();
|
|
1972
1972
|
A[W[g.u]] = 1, I[W[g.v]] = 1;
|
|
1973
|
-
const B = EI(d(), A, I), C =
|
|
1973
|
+
const B = EI(d(), A, I), C = xC(
|
|
1974
1974
|
A[0],
|
|
1975
1975
|
A[1],
|
|
1976
1976
|
A[2],
|
|
@@ -1981,9 +1981,9 @@ function dA(g) {
|
|
|
1981
1981
|
B[1],
|
|
1982
1982
|
B[2]
|
|
1983
1983
|
), Q = Gg(sI(), C);
|
|
1984
|
-
return
|
|
1984
|
+
return YI(Q, Q);
|
|
1985
1985
|
}
|
|
1986
|
-
const
|
|
1986
|
+
const _g = [
|
|
1987
1987
|
Int8Array,
|
|
1988
1988
|
Int16Array,
|
|
1989
1989
|
Int32Array,
|
|
@@ -1992,32 +1992,32 @@ const zg = [
|
|
|
1992
1992
|
Uint32Array,
|
|
1993
1993
|
Float32Array
|
|
1994
1994
|
];
|
|
1995
|
-
function
|
|
1996
|
-
if (
|
|
1995
|
+
function NQ(g) {
|
|
1996
|
+
if (_g.some((I) => g instanceof I))
|
|
1997
1997
|
return !0;
|
|
1998
|
-
const A =
|
|
1998
|
+
const A = _g.map((I) => I.name);
|
|
1999
1999
|
return k.debug(
|
|
2000
2000
|
"Chunk",
|
|
2001
2001
|
`Unsupported chunk data type: ${g}. Supported data types: ${A}`
|
|
2002
2002
|
), !1;
|
|
2003
2003
|
}
|
|
2004
|
-
function
|
|
2004
|
+
function cQ(g, A) {
|
|
2005
2005
|
return Math.round((A - g.translation) / g.scale);
|
|
2006
2006
|
}
|
|
2007
|
-
function
|
|
2007
|
+
function jB(g, A) {
|
|
2008
2008
|
const I = d(), B = d();
|
|
2009
2009
|
for (const Q of ["x", "y", "z"]) {
|
|
2010
2010
|
const E = Q === A.w ? 0.5 * g.scale[Q] : 0, i = W[Q];
|
|
2011
2011
|
I[i] = 1 / (g.scale[Q] * g.shape[Q]), B[i] = E - g.offset[Q];
|
|
2012
2012
|
}
|
|
2013
|
-
const C =
|
|
2014
|
-
return
|
|
2013
|
+
const C = OB($(), I);
|
|
2014
|
+
return WC(C, C, B);
|
|
2015
2015
|
}
|
|
2016
2016
|
function hA(g, A, I) {
|
|
2017
2017
|
return Math.max(A, Math.min(I, g));
|
|
2018
2018
|
}
|
|
2019
|
-
const
|
|
2020
|
-
class
|
|
2019
|
+
const MI = Symbol("INTERNAL_POLICY_KEY");
|
|
2020
|
+
class UQ {
|
|
2021
2021
|
store_;
|
|
2022
2022
|
policy_;
|
|
2023
2023
|
policyChanged_ = !1;
|
|
@@ -2044,7 +2044,7 @@ class NQ {
|
|
|
2044
2044
|
`Source is missing dimensions for slice plane axes "${this.axes_.u}" and "${this.axes_.v}"`
|
|
2045
2045
|
);
|
|
2046
2046
|
const i = Q.lods[0], o = E.lods[0];
|
|
2047
|
-
this.scale0_ = i.scale, this.sourceMaxSquareDistance2D_ =
|
|
2047
|
+
this.scale0_ = i.scale, this.sourceMaxSquareDistance2D_ = oQ(
|
|
2048
2048
|
V(i.size * i.scale, o.size * o.scale)
|
|
2049
2049
|
);
|
|
2050
2050
|
}
|
|
@@ -2084,13 +2084,13 @@ class NQ {
|
|
|
2084
2084
|
k.warn(
|
|
2085
2085
|
"ChunkStoreView",
|
|
2086
2086
|
"updateChunkViewStates called with no chunks initialized"
|
|
2087
|
-
), this.chunkViewStates_.forEach(
|
|
2087
|
+
), this.chunkViewStates_.forEach(WA);
|
|
2088
2088
|
return;
|
|
2089
2089
|
}
|
|
2090
|
-
const s =
|
|
2091
|
-
|
|
2090
|
+
const s = XB();
|
|
2091
|
+
aQ(s, B.min, B.max, 0.5);
|
|
2092
2092
|
const h = this.makeViewBounds3D(B, o);
|
|
2093
|
-
this.chunkViewStates_.forEach(
|
|
2093
|
+
this.chunkViewStates_.forEach(WA);
|
|
2094
2094
|
const t = this.channelsOfInterest(A), y = this.fallbackLOD(), n = this.getPaddedBounds(h), F = this.currentLOD_ === y ? [this.currentLOD_] : [this.currentLOD_, y];
|
|
2095
2095
|
for (const G of F) {
|
|
2096
2096
|
const J = G === this.currentLOD_, U = G === y;
|
|
@@ -2130,10 +2130,10 @@ class NQ {
|
|
|
2130
2130
|
k.warn(
|
|
2131
2131
|
"ChunkStoreView",
|
|
2132
2132
|
"updateChunksForVolume called with no chunks initialized"
|
|
2133
|
-
), this.chunkViewStates_.forEach(
|
|
2133
|
+
), this.chunkViewStates_.forEach(WA);
|
|
2134
2134
|
return;
|
|
2135
2135
|
}
|
|
2136
|
-
this.currentLOD_ = this.policy_.lod.min, this.chunkViewStates_.forEach(
|
|
2136
|
+
this.currentLOD_ = this.policy_.lod.min, this.chunkViewStates_.forEach(WA);
|
|
2137
2137
|
const Q = this.channelsOfInterest(A), E = this.fallbackLOD(), i = (o) => {
|
|
2138
2138
|
const a = o.lod === E, D = o.lod === this.currentLOD_, s = this.computePriority(
|
|
2139
2139
|
a,
|
|
@@ -2177,10 +2177,10 @@ class NQ {
|
|
|
2177
2177
|
I && (I.visible || I.prefetch || I.priority !== null) || this.chunkViewStates_.delete(A);
|
|
2178
2178
|
}
|
|
2179
2179
|
dispose() {
|
|
2180
|
-
this.isDisposed_ = !0, this.chunkViewStates_.forEach(
|
|
2180
|
+
this.isDisposed_ = !0, this.chunkViewStates_.forEach(WA);
|
|
2181
2181
|
}
|
|
2182
2182
|
setImageSourcePolicy(A, I) {
|
|
2183
|
-
if (I !==
|
|
2183
|
+
if (I !== MI)
|
|
2184
2184
|
throw new Error("Unauthorized policy mutation");
|
|
2185
2185
|
this.policy_ !== A && (this.policy_ = A, this.policyChanged_ = !0, k.info(
|
|
2186
2186
|
"ChunkStoreView",
|
|
@@ -2298,7 +2298,7 @@ class NQ {
|
|
|
2298
2298
|
}
|
|
2299
2299
|
timeIndex(A) {
|
|
2300
2300
|
const I = this.store_.dimensions.t;
|
|
2301
|
-
return A.t === void 0 || I === void 0 ? 0 :
|
|
2301
|
+
return A.t === void 0 || I === void 0 ? 0 : cQ(I.lods[0], A.t);
|
|
2302
2302
|
}
|
|
2303
2303
|
getSliceAxisBounds(A) {
|
|
2304
2304
|
const I = this.store_.dimensions[this.axes_.w];
|
|
@@ -2323,13 +2323,13 @@ class NQ {
|
|
|
2323
2323
|
return B[W[this.axes_.u]] = A.min[0], C[W[this.axes_.u]] = A.max[0], B[W[this.axes_.v]] = A.min[1], C[W[this.axes_.v]] = A.max[1], B[W[this.axes_.w]] = I[0], C[W[this.axes_.w]] = I[1], new SA(B, C);
|
|
2324
2324
|
}
|
|
2325
2325
|
viewBounds2DChanged(A) {
|
|
2326
|
-
return this.lastViewBounds2D_ === null || !
|
|
2326
|
+
return this.lastViewBounds2D_ === null || !uI(this.lastViewBounds2D_.min, A.min) || !uI(this.lastViewBounds2D_.max, A.max);
|
|
2327
2327
|
}
|
|
2328
2328
|
hasViewProjectionChanged(A) {
|
|
2329
|
-
return this.lastViewProjection_ === null || !
|
|
2329
|
+
return this.lastViewProjection_ === null || !XC(this.lastViewProjection_, A);
|
|
2330
2330
|
}
|
|
2331
2331
|
sliceBoundsChanged(A) {
|
|
2332
|
-
return !this.lastSliceBounds_ || !
|
|
2332
|
+
return !this.lastSliceBounds_ || !uI(this.lastSliceBounds_, A);
|
|
2333
2333
|
}
|
|
2334
2334
|
cCoordsChanged(A) {
|
|
2335
2335
|
return !this.lastCCoords_ && !A ? !1 : !this.lastCCoords_ || !A || this.lastCCoords_.length !== A.length ? !0 : !this.lastCCoords_.every((I, B) => I === A[B]);
|
|
@@ -2349,10 +2349,10 @@ class NQ {
|
|
|
2349
2349
|
return E * E + i * i;
|
|
2350
2350
|
}
|
|
2351
2351
|
}
|
|
2352
|
-
function
|
|
2352
|
+
function WA(g) {
|
|
2353
2353
|
g.visible = !1, g.prefetch = !1, g.priority = null, g.orderKey = null;
|
|
2354
2354
|
}
|
|
2355
|
-
class
|
|
2355
|
+
class kQ {
|
|
2356
2356
|
// Chunks indexed as chunks_[lod][t][c][z][y][x].
|
|
2357
2357
|
chunks_;
|
|
2358
2358
|
lowestResLOD_;
|
|
@@ -2432,7 +2432,7 @@ class cQ {
|
|
|
2432
2432
|
return this.lowestResLOD_;
|
|
2433
2433
|
}
|
|
2434
2434
|
addView(A, I) {
|
|
2435
|
-
const B = new
|
|
2435
|
+
const B = new UQ(this, A, I);
|
|
2436
2436
|
return this.views_.push(B), this.hasHadViews_ = !0, B;
|
|
2437
2437
|
}
|
|
2438
2438
|
get views() {
|
|
@@ -2470,7 +2470,7 @@ class cQ {
|
|
|
2470
2470
|
const A = this.dimensions_.x, I = this.dimensions_.y;
|
|
2471
2471
|
for (let B = 1; B < this.dimensions_.numLods; B++) {
|
|
2472
2472
|
const C = A.lods[B].scale / A.lods[B - 1].scale, Q = I.lods[B].scale / I.lods[B - 1].scale;
|
|
2473
|
-
if (!
|
|
2473
|
+
if (!zg(C, 2, 0.02) || !zg(Q, 2, 0.02))
|
|
2474
2474
|
throw new Error(
|
|
2475
2475
|
`Invalid downsampling factor between levels ${B - 1} → ${B}: expected (2× in X and Y), but got (${C.toFixed(2)}×, ${Q.toFixed(2)}×) from scale [${A.lods[B - 1].scale}, ${I.lods[B - 1].scale}] → [${A.lods[B].scale}, ${I.lods[B].scale}]`
|
|
2476
2476
|
);
|
|
@@ -2546,8 +2546,8 @@ class rg extends Fg {
|
|
|
2546
2546
|
return B.unpackAlignment = A.rowAlignmentBytes, B;
|
|
2547
2547
|
}
|
|
2548
2548
|
}
|
|
2549
|
-
const
|
|
2550
|
-
class
|
|
2549
|
+
const LQ = 8, JQ = 4;
|
|
2550
|
+
class YQ {
|
|
2551
2551
|
stores_ = [];
|
|
2552
2552
|
queue_;
|
|
2553
2553
|
uploadTexture_;
|
|
@@ -2556,8 +2556,8 @@ class LQ {
|
|
|
2556
2556
|
memoryLimitBytes_;
|
|
2557
2557
|
maxGpuUploadsPerUpdate_;
|
|
2558
2558
|
resident_ = /* @__PURE__ */ new Set();
|
|
2559
|
-
constructor(A, I, B = () => 0, C = 1 / 0, Q =
|
|
2560
|
-
this.uploadTexture_ = A, this.disposeTexture_ = I, this.getGpuResidentBytes_ = B, this.memoryLimitBytes_ = C, this.maxGpuUploadsPerUpdate_ = Math.max(1, E), this.queue_ = new
|
|
2559
|
+
constructor(A, I, B = () => 0, C = 1 / 0, Q = LQ, E = JQ) {
|
|
2560
|
+
this.uploadTexture_ = A, this.disposeTexture_ = I, this.getGpuResidentBytes_ = B, this.memoryLimitBytes_ = C, this.maxGpuUploadsPerUpdate_ = Math.max(1, E), this.queue_ = new rQ(Q);
|
|
2561
2561
|
}
|
|
2562
2562
|
get memoryLimitBytes() {
|
|
2563
2563
|
return this.memoryLimitBytes_;
|
|
@@ -2572,11 +2572,11 @@ class LQ {
|
|
|
2572
2572
|
};
|
|
2573
2573
|
}
|
|
2574
2574
|
get memoryStats() {
|
|
2575
|
-
return
|
|
2575
|
+
return RQ();
|
|
2576
2576
|
}
|
|
2577
2577
|
addView(A, I, B) {
|
|
2578
2578
|
let C = this.stores_.find((Q) => Q.source === A)?.store;
|
|
2579
|
-
return C || (C = new
|
|
2579
|
+
return C || (C = new kQ(A.loader.getSourceDimensionMap()), this.stores_.push({ source: A, store: C })), C.addView(I, B);
|
|
2580
2580
|
}
|
|
2581
2581
|
update() {
|
|
2582
2582
|
const A = [];
|
|
@@ -2595,11 +2595,11 @@ class LQ {
|
|
|
2595
2595
|
A.releasedAt ??= performance.now();
|
|
2596
2596
|
return;
|
|
2597
2597
|
}
|
|
2598
|
-
|
|
2598
|
+
jg(A), A.state === "loaded" && (A.state = "unloaded");
|
|
2599
2599
|
}
|
|
2600
2600
|
enqueueWithinBudget(A) {
|
|
2601
2601
|
if (A.length === 0) return;
|
|
2602
|
-
A.sort((C, Q) =>
|
|
2602
|
+
A.sort((C, Q) => bA(C.chunk, Q.chunk));
|
|
2603
2603
|
let I = this.getGpuResidentBytes_(), B = null;
|
|
2604
2604
|
for (const { source: C, chunk: Q } of A) {
|
|
2605
2605
|
const E = this.chunkBytes(C, Q);
|
|
@@ -2619,14 +2619,14 @@ class LQ {
|
|
|
2619
2619
|
for (const I of this.resident_)
|
|
2620
2620
|
I.visible || A.push(I);
|
|
2621
2621
|
return A.sort((I, B) => {
|
|
2622
|
-
const C = -
|
|
2622
|
+
const C = -bA(I, B);
|
|
2623
2623
|
return C !== 0 ? C : (I.releasedAt ?? 0) - (B.releasedAt ?? 0);
|
|
2624
2624
|
});
|
|
2625
2625
|
}
|
|
2626
2626
|
evictWorseChunks(A, I, B, C) {
|
|
2627
|
-
for (; A + I > this.memoryLimitBytes_ && C.length > 0 &&
|
|
2627
|
+
for (; A + I > this.memoryLimitBytes_ && C.length > 0 && bA(C[0], B) > 0; ) {
|
|
2628
2628
|
const Q = C.shift();
|
|
2629
|
-
Q.texture !== void 0 && (A -=
|
|
2629
|
+
Q.texture !== void 0 && (A -= $I(Q.texture), this.disposeChunkTexture(Q), Q.state = "unloaded", Q.releasedAt = void 0);
|
|
2630
2630
|
}
|
|
2631
2631
|
return A;
|
|
2632
2632
|
}
|
|
@@ -2640,18 +2640,18 @@ class LQ {
|
|
|
2640
2640
|
for (const C of A)
|
|
2641
2641
|
C.state === "loaded" && C.texture === void 0 && I.push(C);
|
|
2642
2642
|
if (I.length === 0) return;
|
|
2643
|
-
I.sort(
|
|
2643
|
+
I.sort(bA);
|
|
2644
2644
|
const B = Math.min(I.length, this.maxGpuUploadsPerUpdate_);
|
|
2645
2645
|
for (let C = 0; C < B; C++) {
|
|
2646
2646
|
const Q = I[C], E = rg.createWithChunk(Q);
|
|
2647
|
-
this.uploadTexture_(E), Q.texture = E, this.resident_.add(Q),
|
|
2647
|
+
this.uploadTexture_(E), Q.texture = E, this.resident_.add(Q), jg(Q);
|
|
2648
2648
|
}
|
|
2649
2649
|
}
|
|
2650
2650
|
disposeChunkTexture(A) {
|
|
2651
2651
|
this.disposeTexture_ && A.texture !== void 0 && (this.disposeTexture_(A.texture), A.texture = void 0, this.resident_.delete(A));
|
|
2652
2652
|
}
|
|
2653
2653
|
}
|
|
2654
|
-
var
|
|
2654
|
+
var OA = function(g = 1) {
|
|
2655
2655
|
var A = 0, I = document.createElement("div");
|
|
2656
2656
|
I.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000", I.addEventListener("click", function(s) {
|
|
2657
2657
|
s.preventDefault(), C(++A % I.children.length);
|
|
@@ -2664,9 +2664,9 @@ var VA = function(g = 1) {
|
|
|
2664
2664
|
I.children[h].style.display = h === s ? "block" : "none";
|
|
2665
2665
|
A = s;
|
|
2666
2666
|
}
|
|
2667
|
-
var Q = (performance || Date).now(), E = Q, i = 0, o = B(new
|
|
2667
|
+
var Q = (performance || Date).now(), E = Q, i = 0, o = B(new OA.Panel("FPS", "#0ff", "#002", g)), a = B(new OA.Panel("MS", "#0f0", "#020", g));
|
|
2668
2668
|
if (self.performance && self.performance.memory)
|
|
2669
|
-
var D = B(new
|
|
2669
|
+
var D = B(new OA.Panel("MB", "#f08", "#201", g));
|
|
2670
2670
|
return C(0), {
|
|
2671
2671
|
REVISION: 16,
|
|
2672
2672
|
dom: I,
|
|
@@ -2692,7 +2692,7 @@ var VA = function(g = 1) {
|
|
|
2692
2692
|
setMode: C
|
|
2693
2693
|
};
|
|
2694
2694
|
};
|
|
2695
|
-
|
|
2695
|
+
OA.Panel = function(g, A, I, B) {
|
|
2696
2696
|
var C = 1 / 0, Q = 0, E = Math.round, i = E(window.devicePixelRatio || 1), o = E(80 * i * B), a = E(48 * i * B), D = E(3 * i * B), s = E(2 * i * B), h = E(3 * i * B), t = E(15 * i * B), y = E(74 * i * B), n = E(30 * i * B), F = document.createElement("canvas");
|
|
2697
2697
|
F.width = o, F.height = a, F.style.cssText = `width:${E(B * 80)}px;height:${E(B * 48)}px`;
|
|
2698
2698
|
var G = F.getContext("2d");
|
|
@@ -2703,24 +2703,24 @@ VA.Panel = function(g, A, I, B) {
|
|
|
2703
2703
|
}
|
|
2704
2704
|
};
|
|
2705
2705
|
};
|
|
2706
|
-
function
|
|
2707
|
-
const A = new
|
|
2706
|
+
function MQ({ scale: g } = { scale: 1.5 }) {
|
|
2707
|
+
const A = new OA(g);
|
|
2708
2708
|
return A.showPanel(
|
|
2709
2709
|
0
|
|
2710
2710
|
/* 0 = fps, 1 = ms, 2 = mb */
|
|
2711
2711
|
), document.body.appendChild(A.dom), A;
|
|
2712
2712
|
}
|
|
2713
|
-
const
|
|
2713
|
+
const Ag = [
|
|
2714
2714
|
"pointerdown",
|
|
2715
2715
|
"pointermove",
|
|
2716
2716
|
"pointerup",
|
|
2717
2717
|
"pointercancel",
|
|
2718
2718
|
"wheel"
|
|
2719
2719
|
];
|
|
2720
|
-
function
|
|
2721
|
-
return
|
|
2720
|
+
function dQ(g) {
|
|
2721
|
+
return Ag.includes(g);
|
|
2722
2722
|
}
|
|
2723
|
-
class
|
|
2723
|
+
class KQ {
|
|
2724
2724
|
propagationStopped_ = !1;
|
|
2725
2725
|
type;
|
|
2726
2726
|
event;
|
|
@@ -2737,7 +2737,7 @@ class MQ {
|
|
|
2737
2737
|
this.propagationStopped_ = !0;
|
|
2738
2738
|
}
|
|
2739
2739
|
}
|
|
2740
|
-
class
|
|
2740
|
+
class HQ {
|
|
2741
2741
|
listeners_ = [];
|
|
2742
2742
|
element_;
|
|
2743
2743
|
isConnected_ = !1;
|
|
@@ -2762,7 +2762,7 @@ class dQ {
|
|
|
2762
2762
|
);
|
|
2763
2763
|
return;
|
|
2764
2764
|
}
|
|
2765
|
-
this.isConnected_ = !0,
|
|
2765
|
+
this.isConnected_ = !0, Ag.forEach((A) => {
|
|
2766
2766
|
this.element_.addEventListener(A, this.handleEvent, {
|
|
2767
2767
|
passive: !1
|
|
2768
2768
|
});
|
|
@@ -2777,36 +2777,36 @@ class dQ {
|
|
|
2777
2777
|
);
|
|
2778
2778
|
return;
|
|
2779
2779
|
}
|
|
2780
|
-
this.isConnected_ = !1,
|
|
2780
|
+
this.isConnected_ = !1, Ag.forEach((A) => {
|
|
2781
2781
|
this.element_.removeEventListener(A, this.handleEvent);
|
|
2782
2782
|
});
|
|
2783
2783
|
}
|
|
2784
2784
|
handleEvent = (A) => {
|
|
2785
|
-
if (!
|
|
2785
|
+
if (!dQ(A.type)) {
|
|
2786
2786
|
k.error("EventDispatcher", `Unsupported event type ${A.type}`);
|
|
2787
2787
|
return;
|
|
2788
2788
|
}
|
|
2789
|
-
const I = new
|
|
2789
|
+
const I = new KQ(A.type, A);
|
|
2790
2790
|
for (const B of this.listeners_)
|
|
2791
2791
|
if (B(I), I.propagationStopped) break;
|
|
2792
2792
|
};
|
|
2793
2793
|
}
|
|
2794
|
-
const
|
|
2795
|
-
class
|
|
2794
|
+
const qQ = 1e-12;
|
|
2795
|
+
class lQ {
|
|
2796
2796
|
origin;
|
|
2797
2797
|
direction;
|
|
2798
2798
|
constructor(A, I) {
|
|
2799
|
-
this.origin = DA(A), this.direction =
|
|
2799
|
+
this.origin = DA(A), this.direction = VB(d(), I);
|
|
2800
2800
|
}
|
|
2801
2801
|
intersectWithPlane(A) {
|
|
2802
2802
|
const I = aI(this.direction, A.normal);
|
|
2803
|
-
if (Math.abs(I) <
|
|
2803
|
+
if (Math.abs(I) < qQ)
|
|
2804
2804
|
return null;
|
|
2805
2805
|
const B = -A.signedDistanceToPoint(this.origin) / I;
|
|
2806
|
-
return
|
|
2806
|
+
return zI(d(), this.origin, this.direction, B);
|
|
2807
2807
|
}
|
|
2808
2808
|
}
|
|
2809
|
-
class
|
|
2809
|
+
class fQ {
|
|
2810
2810
|
id;
|
|
2811
2811
|
element;
|
|
2812
2812
|
camera;
|
|
@@ -2818,12 +2818,12 @@ class qQ {
|
|
|
2818
2818
|
context_;
|
|
2819
2819
|
layers_ = [];
|
|
2820
2820
|
constructor(A) {
|
|
2821
|
-
this.id = A.id, this.element = A.element, this.camera = A.camera, this.context_ = A.context, this.cameraControls = A.cameraControls, this.updateAspectRatio(), this.events = new
|
|
2821
|
+
this.id = A.id, this.element = A.element, this.camera = A.camera, this.context_ = A.context, this.cameraControls = A.cameraControls, this.updateAspectRatio(), this.events = new HQ(this.element), this.events.addEventListener((I) => {
|
|
2822
2822
|
if (I.event instanceof PointerEvent || I.event instanceof WheelEvent) {
|
|
2823
2823
|
const { clientX: B, clientY: C } = I.event, Q = V(B, C);
|
|
2824
2824
|
I.clipPos = this.clientToClip(Q, 0), I.worldPos = this.camera.clipToWorld(I.clipPos);
|
|
2825
2825
|
const E = this.camera.clipToWorld(this.clientToClip(Q, -1)), i = this.camera.clipToWorld(this.clientToClip(Q, 1));
|
|
2826
|
-
I.worldRay = new
|
|
2826
|
+
I.worldRay = new lQ(E, yg(d(), i, E));
|
|
2827
2827
|
}
|
|
2828
2828
|
for (const B of this.layers_)
|
|
2829
2829
|
if (B.onEvent(I), I.propagationStopped) return;
|
|
@@ -2894,7 +2894,7 @@ class qQ {
|
|
|
2894
2894
|
this.camera.setAspectRatio(B);
|
|
2895
2895
|
}
|
|
2896
2896
|
}
|
|
2897
|
-
function
|
|
2897
|
+
function zB(g, A) {
|
|
2898
2898
|
for (const I of A) {
|
|
2899
2899
|
if (I.id === g.id)
|
|
2900
2900
|
throw new Error(
|
|
@@ -2908,23 +2908,23 @@ function jB(g, A) {
|
|
|
2908
2908
|
}
|
|
2909
2909
|
}
|
|
2910
2910
|
}
|
|
2911
|
-
function
|
|
2911
|
+
function pQ(g) {
|
|
2912
2912
|
for (let A = 0; A < g.length; A++)
|
|
2913
|
-
|
|
2913
|
+
zB(g[A], g.slice(0, A));
|
|
2914
2914
|
}
|
|
2915
|
-
function
|
|
2915
|
+
function $g(g, A, I) {
|
|
2916
2916
|
const B = g.map((C) => {
|
|
2917
2917
|
const Q = C.element ?? A;
|
|
2918
2918
|
return {
|
|
2919
2919
|
...C,
|
|
2920
2920
|
element: Q,
|
|
2921
|
-
id: C.id ?? Q.id ??
|
|
2921
|
+
id: C.id ?? Q.id ?? ZB("viewport"),
|
|
2922
2922
|
context: I
|
|
2923
2923
|
};
|
|
2924
2924
|
});
|
|
2925
|
-
return
|
|
2925
|
+
return pQ(B), B.map((C) => new fQ(C));
|
|
2926
2926
|
}
|
|
2927
|
-
class
|
|
2927
|
+
class mQ {
|
|
2928
2928
|
elements_;
|
|
2929
2929
|
resizeObserver_;
|
|
2930
2930
|
mediaQuery_;
|
|
@@ -2983,8 +2983,8 @@ class fQ {
|
|
|
2983
2983
|
this.elements_.splice(I, 1), this.resizeObserver_ && this.resizeObserver_.unobserve(A);
|
|
2984
2984
|
}
|
|
2985
2985
|
}
|
|
2986
|
-
const
|
|
2987
|
-
class
|
|
2986
|
+
const uQ = 2048;
|
|
2987
|
+
class to {
|
|
2988
2988
|
chunkManager_;
|
|
2989
2989
|
context_;
|
|
2990
2990
|
renderer_;
|
|
@@ -3011,7 +3011,7 @@ class ho {
|
|
|
3011
3011
|
*
|
|
3012
3012
|
* @example
|
|
3013
3013
|
* // Single viewport (element defaults to canvas)
|
|
3014
|
-
* const camera = new OrthographicCamera(0, 1024, 0, 1024);
|
|
3014
|
+
* const camera = new OrthographicCamera({ left: 0, right: 1024, top: 0, bottom: 1024 });
|
|
3015
3015
|
* const idetik = new Idetik({
|
|
3016
3016
|
* canvas: document.querySelector('canvas')!,
|
|
3017
3017
|
* viewports: [{
|
|
@@ -3043,30 +3043,30 @@ class ho {
|
|
|
3043
3043
|
*
|
|
3044
3044
|
* @throws {Error} If viewports have duplicate IDs or shared elements
|
|
3045
3045
|
*/
|
|
3046
|
-
constructor(A
|
|
3047
|
-
this.canvas = A.canvas, this.renderer_ =
|
|
3048
|
-
const
|
|
3049
|
-
this.chunkManager_ = new
|
|
3050
|
-
(
|
|
3051
|
-
(
|
|
3046
|
+
constructor(A) {
|
|
3047
|
+
this.canvas = A.canvas, this.renderer_ = new FQ(this.canvas);
|
|
3048
|
+
const B = (A.memoryLimitMB ?? uQ) * 1024 * 1024;
|
|
3049
|
+
this.chunkManager_ = new YQ(
|
|
3050
|
+
(Q) => this.renderer_.uploadTexture(Q),
|
|
3051
|
+
(Q) => this.renderer_.disposeTexture(Q),
|
|
3052
3052
|
() => this.renderer_.gpuTextureBytes,
|
|
3053
|
-
|
|
3053
|
+
B,
|
|
3054
3054
|
A.maxConcurrentRequests,
|
|
3055
3055
|
A.maxGpuUploadsPerUpdate
|
|
3056
3056
|
), this.context_ = {
|
|
3057
3057
|
chunkManager: this.chunkManager_
|
|
3058
|
-
}, this.viewports_ =
|
|
3058
|
+
}, this.viewports_ = $g(
|
|
3059
3059
|
A.viewports ?? [],
|
|
3060
3060
|
this.canvas,
|
|
3061
3061
|
this.context_
|
|
3062
|
-
), this.overlays = [...A.overlays ?? []], A.showStats && (this.stats_ =
|
|
3063
|
-
const
|
|
3064
|
-
for (const
|
|
3065
|
-
|
|
3066
|
-
this.sizeObserver_ = new
|
|
3062
|
+
), this.overlays = [...A.overlays ?? []], A.showStats && (this.stats_ = MQ());
|
|
3063
|
+
const C = [this.canvas];
|
|
3064
|
+
for (const Q of this.viewports_)
|
|
3065
|
+
Q.element !== this.canvas && C.push(Q.element);
|
|
3066
|
+
this.sizeObserver_ = new mQ(C, () => {
|
|
3067
3067
|
this.renderer_.updateSize(), this.renderer_.beginFrame();
|
|
3068
|
-
for (const
|
|
3069
|
-
|
|
3068
|
+
for (const Q of this.viewports_)
|
|
3069
|
+
Q.updateSize(), this.renderer_.render(Q);
|
|
3070
3070
|
});
|
|
3071
3071
|
}
|
|
3072
3072
|
get chunkQueueStats() {
|
|
@@ -3101,8 +3101,8 @@ class ho {
|
|
|
3101
3101
|
return this.viewports_.find((I) => I.id === A);
|
|
3102
3102
|
}
|
|
3103
3103
|
addViewport(A) {
|
|
3104
|
-
const [I] =
|
|
3105
|
-
return
|
|
3104
|
+
const [I] = $g([A], this.canvas, this.context_);
|
|
3105
|
+
return zB(I, this.viewports_), this.viewports_.push(I), this.running && (I.events.connect(), I.element !== this.canvas && this.sizeObserver_.observe(I.element)), k.info("Idetik", `Added viewport "${I.id}"`), I;
|
|
3106
3106
|
}
|
|
3107
3107
|
removeViewport(A) {
|
|
3108
3108
|
const I = this.viewports_.indexOf(A);
|
|
@@ -3157,7 +3157,7 @@ class ho {
|
|
|
3157
3157
|
}
|
|
3158
3158
|
}
|
|
3159
3159
|
}
|
|
3160
|
-
function
|
|
3160
|
+
function TQ(g, A) {
|
|
3161
3161
|
return {
|
|
3162
3162
|
...g,
|
|
3163
3163
|
...A,
|
|
@@ -3167,20 +3167,20 @@ function mQ(g, A) {
|
|
|
3167
3167
|
}
|
|
3168
3168
|
};
|
|
3169
3169
|
}
|
|
3170
|
-
function
|
|
3170
|
+
function AB(g, A) {
|
|
3171
3171
|
const I = typeof g == "string" ? new URL(g) : g;
|
|
3172
3172
|
I.pathname.endsWith("/") || (I.pathname += "/");
|
|
3173
3173
|
const B = new URL(A.slice(1), I);
|
|
3174
3174
|
return B.search = I.search, B;
|
|
3175
3175
|
}
|
|
3176
|
-
async function
|
|
3176
|
+
async function IB(g) {
|
|
3177
3177
|
if (g.status !== 404) {
|
|
3178
3178
|
if (g.status === 200 || g.status === 206)
|
|
3179
3179
|
return new Uint8Array(await g.arrayBuffer());
|
|
3180
3180
|
throw new Error(`Unexpected response status ${g.status} ${g.statusText}`);
|
|
3181
3181
|
}
|
|
3182
3182
|
}
|
|
3183
|
-
class
|
|
3183
|
+
class _A {
|
|
3184
3184
|
url;
|
|
3185
3185
|
#A;
|
|
3186
3186
|
#I;
|
|
@@ -3189,14 +3189,14 @@ class $A {
|
|
|
3189
3189
|
this.url = A, this.#A = I.fetch ?? ((B) => fetch(B)), this.#I = I.overrides ?? {}, this.#g = I.useSuffixRequest ?? !1;
|
|
3190
3190
|
}
|
|
3191
3191
|
#B(A, I) {
|
|
3192
|
-
return new Request(A,
|
|
3192
|
+
return new Request(A, TQ(this.#I, I));
|
|
3193
3193
|
}
|
|
3194
3194
|
async get(A, I = {}) {
|
|
3195
|
-
let B =
|
|
3196
|
-
return
|
|
3195
|
+
let B = AB(this.url, A).href, C = this.#B(B, I), Q = await this.#A(C);
|
|
3196
|
+
return IB(Q);
|
|
3197
3197
|
}
|
|
3198
3198
|
async getRange(A, I, B = {}) {
|
|
3199
|
-
let C =
|
|
3199
|
+
let C = AB(this.url, A), Q;
|
|
3200
3200
|
if ("suffixLength" in I)
|
|
3201
3201
|
Q = await this.#C(C, I.suffixLength, B);
|
|
3202
3202
|
else {
|
|
@@ -3209,7 +3209,7 @@ class $A {
|
|
|
3209
3209
|
}, i = this.#B(C, E);
|
|
3210
3210
|
Q = await this.#A(i);
|
|
3211
3211
|
}
|
|
3212
|
-
return
|
|
3212
|
+
return IB(Q);
|
|
3213
3213
|
}
|
|
3214
3214
|
async #C(A, I, B) {
|
|
3215
3215
|
if (this.#g) {
|
|
@@ -3235,9 +3235,9 @@ class $A {
|
|
|
3235
3235
|
return this.#A(this.#B(A, a));
|
|
3236
3236
|
}
|
|
3237
3237
|
}
|
|
3238
|
-
class
|
|
3238
|
+
class $A extends Error {
|
|
3239
3239
|
}
|
|
3240
|
-
class uA extends
|
|
3240
|
+
class uA extends $A {
|
|
3241
3241
|
_tag = "NotFoundError";
|
|
3242
3242
|
name = "NotFoundError";
|
|
3243
3243
|
path;
|
|
@@ -3246,7 +3246,7 @@ class uA extends AI {
|
|
|
3246
3246
|
super(`Not found: ${A}`, { cause: I.cause }), this.path = I.path, this.found = I.found;
|
|
3247
3247
|
}
|
|
3248
3248
|
}
|
|
3249
|
-
class v extends
|
|
3249
|
+
class v extends $A {
|
|
3250
3250
|
_tag = "InvalidMetadataError";
|
|
3251
3251
|
name = "InvalidMetadataError";
|
|
3252
3252
|
path;
|
|
@@ -3254,7 +3254,7 @@ class v extends AI {
|
|
|
3254
3254
|
super(A, { cause: I.cause }), this.path = I.path;
|
|
3255
3255
|
}
|
|
3256
3256
|
}
|
|
3257
|
-
class
|
|
3257
|
+
class xQ extends $A {
|
|
3258
3258
|
_tag = "UnknownCodecError";
|
|
3259
3259
|
name = "UnknownCodecError";
|
|
3260
3260
|
codec;
|
|
@@ -3262,7 +3262,7 @@ class uQ extends AI {
|
|
|
3262
3262
|
super(`Unknown codec: ${A}`), this.codec = A;
|
|
3263
3263
|
}
|
|
3264
3264
|
}
|
|
3265
|
-
class
|
|
3265
|
+
class WQ extends $A {
|
|
3266
3266
|
_tag = "CodecPipelineError";
|
|
3267
3267
|
name = "CodecPipelineError";
|
|
3268
3268
|
direction;
|
|
@@ -3277,7 +3277,7 @@ class TQ extends AI {
|
|
|
3277
3277
|
super(I.join(" "), { cause: A.cause }), this.direction = A.direction, this.codec = A.codec, this.chunkPath = A.chunkPath;
|
|
3278
3278
|
}
|
|
3279
3279
|
}
|
|
3280
|
-
class Sg extends
|
|
3280
|
+
class Sg extends $A {
|
|
3281
3281
|
_tag = "UnsupportedError";
|
|
3282
3282
|
name = "UnsupportedError";
|
|
3283
3283
|
feature;
|
|
@@ -3312,7 +3312,7 @@ class yI {
|
|
|
3312
3312
|
function Rg(g) {
|
|
3313
3313
|
return g instanceof ArrayBuffer || g instanceof SharedArrayBuffer;
|
|
3314
3314
|
}
|
|
3315
|
-
class
|
|
3315
|
+
class _B {
|
|
3316
3316
|
#A;
|
|
3317
3317
|
constructor(A, I, B) {
|
|
3318
3318
|
typeof A == "number" ? this.#A = new Uint8Array(A) : Rg(A) ? this.#A = new Uint8Array(A, I, B) : this.#A = new Uint8Array(Array.from(A, (C) => C ? 1 : 0));
|
|
@@ -3396,7 +3396,7 @@ class Ng {
|
|
|
3396
3396
|
yield this.get(A);
|
|
3397
3397
|
}
|
|
3398
3398
|
}
|
|
3399
|
-
class
|
|
3399
|
+
class AI {
|
|
3400
3400
|
#A;
|
|
3401
3401
|
chars;
|
|
3402
3402
|
constructor(A, I, B, C) {
|
|
@@ -3405,7 +3405,7 @@ class II {
|
|
|
3405
3405
|
else if (Rg(I))
|
|
3406
3406
|
C && (C *= A), this.#A = new Int32Array(I, B, C);
|
|
3407
3407
|
else {
|
|
3408
|
-
const Q = I, E = new
|
|
3408
|
+
const Q = I, E = new AI(A, 1);
|
|
3409
3409
|
this.#A = new Int32Array((function* () {
|
|
3410
3410
|
for (let i of Q)
|
|
3411
3411
|
E.set(0, i), yield* E.#A;
|
|
@@ -3451,14 +3451,14 @@ class II {
|
|
|
3451
3451
|
yield this.get(A);
|
|
3452
3452
|
}
|
|
3453
3453
|
}
|
|
3454
|
-
function
|
|
3454
|
+
function bQ() {
|
|
3455
3455
|
if (typeof SharedArrayBuffer > "u")
|
|
3456
3456
|
throw new Error("SharedArrayBuffer is not available. In browsers, this requires Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy headers to be set.");
|
|
3457
3457
|
}
|
|
3458
|
-
function
|
|
3458
|
+
function ZQ(g, A) {
|
|
3459
3459
|
return new SharedArrayBuffer(g);
|
|
3460
3460
|
}
|
|
3461
|
-
function
|
|
3461
|
+
function II(g) {
|
|
3462
3462
|
const A = new TextDecoder().decode(g);
|
|
3463
3463
|
try {
|
|
3464
3464
|
return JSON.parse(A);
|
|
@@ -3466,7 +3466,7 @@ function gI(g) {
|
|
|
3466
3466
|
throw new v("Failed to decode JSON", { cause: I });
|
|
3467
3467
|
}
|
|
3468
3468
|
}
|
|
3469
|
-
function
|
|
3469
|
+
function gB(g, A) {
|
|
3470
3470
|
const I = A / 2, B = A - 1;
|
|
3471
3471
|
let C = 0;
|
|
3472
3472
|
for (let Q = 0; Q < g.length; Q += A)
|
|
@@ -3479,7 +3479,7 @@ function TA(g) {
|
|
|
3479
3479
|
let A = g.match(/v2:([US])(\d+)/);
|
|
3480
3480
|
if (A) {
|
|
3481
3481
|
let [, B, C] = A;
|
|
3482
|
-
return (B === "U" ?
|
|
3482
|
+
return (B === "U" ? AI : Ng).bind(null, Number(C));
|
|
3483
3483
|
}
|
|
3484
3484
|
if (g === "string")
|
|
3485
3485
|
return globalThis.Array;
|
|
@@ -3495,7 +3495,7 @@ function TA(g) {
|
|
|
3495
3495
|
float16: globalThis.Float16Array,
|
|
3496
3496
|
float32: Float32Array,
|
|
3497
3497
|
float64: Float64Array,
|
|
3498
|
-
bool:
|
|
3498
|
+
bool: _B
|
|
3499
3499
|
}[g];
|
|
3500
3500
|
if (!I)
|
|
3501
3501
|
throw new v(`Unknown or unsupported dataType: ${g}`);
|
|
@@ -3509,7 +3509,7 @@ function RA(g, A) {
|
|
|
3509
3509
|
C[A[Q]] = B, B *= g[A[Q]];
|
|
3510
3510
|
return C;
|
|
3511
3511
|
}
|
|
3512
|
-
function
|
|
3512
|
+
function PQ({ name: g, configuration: A }) {
|
|
3513
3513
|
if (g === "default") {
|
|
3514
3514
|
const I = A?.separator ?? "/";
|
|
3515
3515
|
return (B) => ["c", ...B].join(I);
|
|
@@ -3520,7 +3520,7 @@ function bQ({ name: g, configuration: A }) {
|
|
|
3520
3520
|
}
|
|
3521
3521
|
throw new v(`Unknown chunk key encoding: ${g}`);
|
|
3522
3522
|
}
|
|
3523
|
-
function
|
|
3523
|
+
function BB(g) {
|
|
3524
3524
|
if (g === "|O")
|
|
3525
3525
|
return { dataType: "v2:object" };
|
|
3526
3526
|
let A = g.match(/^([<|>])(.*)$/);
|
|
@@ -3544,15 +3544,15 @@ function gB(g) {
|
|
|
3544
3544
|
throw new v(`Unsupported or unknown dtype: ${g}`);
|
|
3545
3545
|
return I === "|" ? { dataType: C } : { dataType: C, endian: I === "<" ? "little" : "big" };
|
|
3546
3546
|
}
|
|
3547
|
-
function
|
|
3547
|
+
function OQ(g) {
|
|
3548
3548
|
return (g.id === "fixedscaleoffset" || g.id === "numcodecs.fixedscaleoffset") && typeof g.scale == "number" && typeof g.offset == "number" && (g.astype === void 0 || typeof g.astype == "string") && (g.dtype === void 0 || typeof g.dtype == "string");
|
|
3549
3549
|
}
|
|
3550
|
-
function
|
|
3551
|
-
let I = [], B =
|
|
3550
|
+
function VQ(g, A = {}) {
|
|
3551
|
+
let I = [], B = BB(g.dtype);
|
|
3552
3552
|
g.order === "F" && I.push({ name: "transpose", configuration: { order: "F" } });
|
|
3553
3553
|
for (let Q of g.filters ?? []) {
|
|
3554
3554
|
if (Q.id === "fixedscaleoffset" || Q.id === "numcodecs.fixedscaleoffset") {
|
|
3555
|
-
if (!
|
|
3555
|
+
if (!OQ(Q))
|
|
3556
3556
|
throw new v(`Invalid fixedscaleoffset filter: ${JSON.stringify(Q)}`);
|
|
3557
3557
|
I.push({
|
|
3558
3558
|
name: "scale_offset",
|
|
@@ -3563,8 +3563,8 @@ function PQ(g, A = {}) {
|
|
|
3563
3563
|
});
|
|
3564
3564
|
let o = Q.astype ?? Q.dtype;
|
|
3565
3565
|
if (o !== void 0 && o !== g.dtype) {
|
|
3566
|
-
let a =
|
|
3567
|
-
if (!
|
|
3566
|
+
let a = BB(o).dataType;
|
|
3567
|
+
if (!Ig(a, "number") && !Ig(a, "bigint"))
|
|
3568
3568
|
throw new v(`fixedscaleoffset astype must be a numeric data type, got ${o}`);
|
|
3569
3569
|
I.push({
|
|
3570
3570
|
name: "cast_value",
|
|
@@ -3610,14 +3610,14 @@ function PQ(g, A = {}) {
|
|
|
3610
3610
|
attributes: A
|
|
3611
3611
|
};
|
|
3612
3612
|
}
|
|
3613
|
-
function
|
|
3613
|
+
function vQ(g, A = {}) {
|
|
3614
3614
|
return {
|
|
3615
3615
|
zarr_format: 3,
|
|
3616
3616
|
node_type: "group",
|
|
3617
3617
|
attributes: A
|
|
3618
3618
|
};
|
|
3619
3619
|
}
|
|
3620
|
-
function
|
|
3620
|
+
function Ig(g, A) {
|
|
3621
3621
|
if (A !== "number" && A !== "bigint" && A !== "boolean" && A !== "object" && A !== "string")
|
|
3622
3622
|
return g === A;
|
|
3623
3623
|
let I = g === "bool";
|
|
@@ -3632,10 +3632,10 @@ function Ag(g, A) {
|
|
|
3632
3632
|
let Q = g === "v2:object";
|
|
3633
3633
|
return A === "object" ? Q : !B && !C && !I && !Q;
|
|
3634
3634
|
}
|
|
3635
|
-
function
|
|
3635
|
+
function XQ(g) {
|
|
3636
3636
|
return g?.name === "sharding_indexed";
|
|
3637
3637
|
}
|
|
3638
|
-
function
|
|
3638
|
+
function $B(g) {
|
|
3639
3639
|
if ((g.data_type === "uint64" || g.data_type === "int64") && g.fill_value != null)
|
|
3640
3640
|
return BigInt(g.fill_value);
|
|
3641
3641
|
let A = g.data_type === "float16" || g.data_type === "float32" || g.data_type === "float64";
|
|
@@ -3650,7 +3650,7 @@ function _B(g) {
|
|
|
3650
3650
|
}
|
|
3651
3651
|
return g.fill_value;
|
|
3652
3652
|
}
|
|
3653
|
-
function
|
|
3653
|
+
function AC(g, ...A) {
|
|
3654
3654
|
if (!A.some((I) => g instanceof I))
|
|
3655
3655
|
throw g;
|
|
3656
3656
|
}
|
|
@@ -3658,7 +3658,7 @@ function IA(g, A = "") {
|
|
|
3658
3658
|
if (!g)
|
|
3659
3659
|
throw new Error(A);
|
|
3660
3660
|
}
|
|
3661
|
-
async function
|
|
3661
|
+
async function IC(g, { format: A, signal: I }) {
|
|
3662
3662
|
let B;
|
|
3663
3663
|
if (g instanceof ArrayBuffer)
|
|
3664
3664
|
B = new Response(g);
|
|
@@ -3673,15 +3673,15 @@ async function AC(g, { format: A, signal: I }) {
|
|
|
3673
3673
|
throw I?.throwIfAborted(), new Error(`Failed to decode ${A}`);
|
|
3674
3674
|
}
|
|
3675
3675
|
}
|
|
3676
|
-
const
|
|
3677
|
-
function
|
|
3676
|
+
const CB = jQ();
|
|
3677
|
+
function jQ() {
|
|
3678
3678
|
const g = new Uint32Array([305419896]);
|
|
3679
3679
|
return new Uint8Array(g.buffer, g.byteOffset, g.byteLength)[0] !== 18;
|
|
3680
3680
|
}
|
|
3681
|
-
function
|
|
3681
|
+
function QB(g) {
|
|
3682
3682
|
return "BYTES_PER_ELEMENT" in g ? g.BYTES_PER_ELEMENT : 4;
|
|
3683
3683
|
}
|
|
3684
|
-
class
|
|
3684
|
+
class dI {
|
|
3685
3685
|
kind = "array_to_bytes";
|
|
3686
3686
|
#A;
|
|
3687
3687
|
#I;
|
|
@@ -3694,39 +3694,39 @@ class MI {
|
|
|
3694
3694
|
this.#g = B.BYTES_PER_ELEMENT;
|
|
3695
3695
|
}
|
|
3696
3696
|
static fromConfig(A, I) {
|
|
3697
|
-
return new
|
|
3697
|
+
return new dI(A, I);
|
|
3698
3698
|
}
|
|
3699
3699
|
encode(A) {
|
|
3700
3700
|
let I = new Uint8Array(A.data.buffer);
|
|
3701
|
-
return
|
|
3701
|
+
return CB && this.#C === "big" && gB(I, QB(this.#I)), I;
|
|
3702
3702
|
}
|
|
3703
3703
|
computeEncodedSize(A) {
|
|
3704
3704
|
return A;
|
|
3705
3705
|
}
|
|
3706
3706
|
decode(A) {
|
|
3707
|
-
return
|
|
3707
|
+
return CB && this.#C === "big" && gB(A, QB(this.#I)), {
|
|
3708
3708
|
data: new this.#I(A.buffer, A.byteOffset, A.byteLength / this.#g),
|
|
3709
3709
|
shape: this.#B,
|
|
3710
3710
|
stride: this.#A
|
|
3711
3711
|
};
|
|
3712
3712
|
}
|
|
3713
3713
|
}
|
|
3714
|
-
const
|
|
3714
|
+
const EB = {
|
|
3715
3715
|
NaN: NaN,
|
|
3716
3716
|
Infinity: 1 / 0,
|
|
3717
3717
|
"-Infinity": -1 / 0
|
|
3718
|
-
},
|
|
3718
|
+
}, gC = {
|
|
3719
3719
|
float16: 2,
|
|
3720
3720
|
float32: 4,
|
|
3721
3721
|
float64: 8
|
|
3722
3722
|
};
|
|
3723
3723
|
function eI(g) {
|
|
3724
|
-
return g in
|
|
3724
|
+
return g in gC;
|
|
3725
3725
|
}
|
|
3726
|
-
function
|
|
3726
|
+
function gg(g) {
|
|
3727
3727
|
return g === "int64" || g === "uint64";
|
|
3728
3728
|
}
|
|
3729
|
-
function
|
|
3729
|
+
function zQ(g, A) {
|
|
3730
3730
|
const I = BigInt(g), B = new ArrayBuffer(A), C = new DataView(B);
|
|
3731
3731
|
if (A === 2) {
|
|
3732
3732
|
if (typeof C.getFloat16 != "function")
|
|
@@ -3736,7 +3736,7 @@ function XQ(g, A) {
|
|
|
3736
3736
|
return A === 4 ? (C.setUint32(0, Number(I)), C.getFloat32(0)) : (C.setBigUint64(0, I), C.getFloat64(0));
|
|
3737
3737
|
}
|
|
3738
3738
|
function nI(g, A) {
|
|
3739
|
-
if (
|
|
3739
|
+
if (gg(g)) {
|
|
3740
3740
|
if (typeof A != "number" || !Number.isInteger(A))
|
|
3741
3741
|
throw new v(`Expected an integer value for data type "${g}", got ${JSON.stringify(A)}`);
|
|
3742
3742
|
return BigInt(A);
|
|
@@ -3748,9 +3748,9 @@ function nI(g, A) {
|
|
|
3748
3748
|
}
|
|
3749
3749
|
if (!eI(g))
|
|
3750
3750
|
throw new v(`String-encoded scalar "${A}" is not valid for non-float data type "${g}"`);
|
|
3751
|
-
return A in
|
|
3751
|
+
return A in EB ? EB[A] : zQ(A, gC[g]);
|
|
3752
3752
|
}
|
|
3753
|
-
const
|
|
3753
|
+
const iB = /* @__PURE__ */ new Set([
|
|
3754
3754
|
"int8",
|
|
3755
3755
|
"uint8",
|
|
3756
3756
|
"int16",
|
|
@@ -3762,24 +3762,24 @@ const EB = /* @__PURE__ */ new Set([
|
|
|
3762
3762
|
"float16",
|
|
3763
3763
|
"float32",
|
|
3764
3764
|
"float64"
|
|
3765
|
-
]),
|
|
3765
|
+
]), TI = {
|
|
3766
3766
|
int8: [-128, 2 ** 7 - 1],
|
|
3767
3767
|
uint8: [0, 2 ** 8 - 1],
|
|
3768
3768
|
int16: [-32768, 2 ** 15 - 1],
|
|
3769
3769
|
uint16: [0, 2 ** 16 - 1],
|
|
3770
3770
|
int32: [-2147483648, 2 ** 31 - 1],
|
|
3771
3771
|
uint32: [0, 2 ** 32 - 1]
|
|
3772
|
-
},
|
|
3772
|
+
}, xI = {
|
|
3773
3773
|
int64: [-(2n ** 63n), 2n ** 63n - 1n],
|
|
3774
3774
|
uint64: [0n, 2n ** 64n - 1n]
|
|
3775
3775
|
};
|
|
3776
|
-
function
|
|
3776
|
+
function oB(g, A, I) {
|
|
3777
3777
|
return g.map(([B, C]) => ({
|
|
3778
3778
|
src: nI(A, B),
|
|
3779
3779
|
tgt: nI(I, C)
|
|
3780
3780
|
}));
|
|
3781
3781
|
}
|
|
3782
|
-
function
|
|
3782
|
+
function _Q(g, A) {
|
|
3783
3783
|
for (const I of A)
|
|
3784
3784
|
if (typeof I.src == "number" && Number.isNaN(I.src)) {
|
|
3785
3785
|
if (typeof g == "number" && Number.isNaN(g))
|
|
@@ -3787,7 +3787,7 @@ function jQ(g, A) {
|
|
|
3787
3787
|
} else if (g === I.src)
|
|
3788
3788
|
return I.tgt;
|
|
3789
3789
|
}
|
|
3790
|
-
function
|
|
3790
|
+
function $Q(g) {
|
|
3791
3791
|
if (!Number.isFinite(g))
|
|
3792
3792
|
return g;
|
|
3793
3793
|
if (Math.abs(g - Math.trunc(g)) === 0.5) {
|
|
@@ -3796,13 +3796,13 @@ function zQ(g) {
|
|
|
3796
3796
|
}
|
|
3797
3797
|
return Math.round(g);
|
|
3798
3798
|
}
|
|
3799
|
-
function
|
|
3799
|
+
function AE(g) {
|
|
3800
3800
|
return Math.sign(g) * Math.floor(Math.abs(g) + 0.5);
|
|
3801
3801
|
}
|
|
3802
|
-
function
|
|
3802
|
+
function aB(g) {
|
|
3803
3803
|
switch (g) {
|
|
3804
3804
|
case "nearest-even":
|
|
3805
|
-
return
|
|
3805
|
+
return $Q;
|
|
3806
3806
|
case "towards-zero":
|
|
3807
3807
|
return Math.trunc;
|
|
3808
3808
|
case "towards-positive":
|
|
@@ -3810,10 +3810,10 @@ function oB(g) {
|
|
|
3810
3810
|
case "towards-negative":
|
|
3811
3811
|
return Math.floor;
|
|
3812
3812
|
case "nearest-away":
|
|
3813
|
-
return
|
|
3813
|
+
return AE;
|
|
3814
3814
|
}
|
|
3815
3815
|
}
|
|
3816
|
-
function
|
|
3816
|
+
function WI(g, A, I) {
|
|
3817
3817
|
const B = A - g + 1;
|
|
3818
3818
|
switch (I) {
|
|
3819
3819
|
case "clamp":
|
|
@@ -3828,7 +3828,7 @@ function xI(g, A, I) {
|
|
|
3828
3828
|
};
|
|
3829
3829
|
}
|
|
3830
3830
|
}
|
|
3831
|
-
function
|
|
3831
|
+
function bI(g, A, I) {
|
|
3832
3832
|
const B = A - g + 1n;
|
|
3833
3833
|
switch (I) {
|
|
3834
3834
|
case "clamp":
|
|
@@ -3850,7 +3850,7 @@ class cg {
|
|
|
3850
3850
|
#g;
|
|
3851
3851
|
#B;
|
|
3852
3852
|
constructor(A, I, B, C, Q, E) {
|
|
3853
|
-
this.#A = I, this.#I = TA(A), this.#g =
|
|
3853
|
+
this.#A = I, this.#I = TA(A), this.#g = DB(I, A, B, C, Q), this.#B = DB(A, I, B, C, E);
|
|
3854
3854
|
}
|
|
3855
3855
|
/** Return updated metadata reflecting the type and fill value after encoding. */
|
|
3856
3856
|
getEncodedMeta(A) {
|
|
@@ -3859,11 +3859,11 @@ class cg {
|
|
|
3859
3859
|
}
|
|
3860
3860
|
static fromConfig(A, I) {
|
|
3861
3861
|
const B = I.dataType, C = A.data_type;
|
|
3862
|
-
if (!
|
|
3862
|
+
if (!iB.has(B))
|
|
3863
3863
|
throw new v(`cast_value codec does not support array data type: ${B}`);
|
|
3864
|
-
if (!
|
|
3864
|
+
if (!iB.has(C))
|
|
3865
3865
|
throw new v(`cast_value codec does not support encoded data type: ${C}`);
|
|
3866
|
-
const Q = A.rounding ?? "nearest-even", E = A.scalar_map?.decode ?
|
|
3866
|
+
const Q = A.rounding ?? "nearest-even", E = A.scalar_map?.decode ? oB(A.scalar_map.decode, C, B) : [], i = A.scalar_map?.encode ? oB(A.scalar_map.encode, B, C) : [];
|
|
3867
3867
|
return new cg(B, C, Q, A.out_of_range, E, i);
|
|
3868
3868
|
}
|
|
3869
3869
|
encode = UA("cast_value");
|
|
@@ -3874,22 +3874,22 @@ class cg {
|
|
|
3874
3874
|
return { data: B, shape: A.shape, stride: A.stride };
|
|
3875
3875
|
}
|
|
3876
3876
|
}
|
|
3877
|
-
function
|
|
3878
|
-
const Q = eI(g), E =
|
|
3877
|
+
function DB(g, A, I, B, C) {
|
|
3878
|
+
const Q = eI(g), E = gg(g), i = eI(A), o = gg(A);
|
|
3879
3879
|
let a;
|
|
3880
3880
|
if (Q && i) {
|
|
3881
3881
|
if (I !== "nearest-even")
|
|
3882
3882
|
throw new v(`cast_value float -> float only supports "nearest-even" rounding, got "${I}"`);
|
|
3883
3883
|
a = (s) => s;
|
|
3884
3884
|
} else if (Q && !i && !o) {
|
|
3885
|
-
const s =
|
|
3885
|
+
const s = aB(I), h = WI(...TI[A], B);
|
|
3886
3886
|
a = (t) => {
|
|
3887
3887
|
if (!Number.isFinite(t))
|
|
3888
3888
|
throw new Error(`Cannot cast ${t} to integer type without scalar_map`);
|
|
3889
3889
|
return h(s(t));
|
|
3890
3890
|
};
|
|
3891
3891
|
} else if (Q && o) {
|
|
3892
|
-
const s =
|
|
3892
|
+
const s = aB(I), h = bI(...xI[A], B);
|
|
3893
3893
|
a = (t) => {
|
|
3894
3894
|
if (!Number.isFinite(t))
|
|
3895
3895
|
throw new Error(`Cannot cast ${t} to integer type without scalar_map`);
|
|
@@ -3900,19 +3900,19 @@ function aB(g, A, I, B, C) {
|
|
|
3900
3900
|
else if (E && i)
|
|
3901
3901
|
a = (s) => Number(s);
|
|
3902
3902
|
else if (!Q && !E && !i && !o)
|
|
3903
|
-
a =
|
|
3903
|
+
a = WI(...TI[A], B);
|
|
3904
3904
|
else if (!Q && !E && o) {
|
|
3905
|
-
const s =
|
|
3905
|
+
const s = bI(...xI[A], B);
|
|
3906
3906
|
a = (h) => s(BigInt(h));
|
|
3907
3907
|
} else if (E && !i && !o) {
|
|
3908
|
-
const s =
|
|
3908
|
+
const s = WI(...TI[A], B);
|
|
3909
3909
|
a = (h) => s(Number(h));
|
|
3910
3910
|
} else if (E && o)
|
|
3911
|
-
a =
|
|
3911
|
+
a = bI(...xI[A], B);
|
|
3912
3912
|
else
|
|
3913
3913
|
throw new Error(`Unhandled type combination: ${g} -> ${A}`);
|
|
3914
3914
|
return C.length === 0 ? a : (s) => {
|
|
3915
|
-
const h =
|
|
3915
|
+
const h = _Q(s, C);
|
|
3916
3916
|
return h !== void 0 ? h : a(s);
|
|
3917
3917
|
};
|
|
3918
3918
|
}
|
|
@@ -3929,7 +3929,7 @@ class Ug {
|
|
|
3929
3929
|
return A + 4;
|
|
3930
3930
|
}
|
|
3931
3931
|
}
|
|
3932
|
-
const
|
|
3932
|
+
const IE = /* @__PURE__ */ new Set([
|
|
3933
3933
|
"int8",
|
|
3934
3934
|
"uint8",
|
|
3935
3935
|
"int16",
|
|
@@ -3942,7 +3942,7 @@ const $Q = /* @__PURE__ */ new Set([
|
|
|
3942
3942
|
"float32",
|
|
3943
3943
|
"float64"
|
|
3944
3944
|
]);
|
|
3945
|
-
function
|
|
3945
|
+
function sB(g, A) {
|
|
3946
3946
|
const I = g.length;
|
|
3947
3947
|
let B = I === 0 || A[I - 1] === 1;
|
|
3948
3948
|
for (let Q = I - 2; Q >= 0 && B; Q--)
|
|
@@ -3962,12 +3962,12 @@ class kg {
|
|
|
3962
3962
|
this.#A = A;
|
|
3963
3963
|
}
|
|
3964
3964
|
static fromConfig(A, I) {
|
|
3965
|
-
if (
|
|
3965
|
+
if (!IE.has(I.dataType))
|
|
3966
3966
|
throw new v(`Delta codec does not support data type: ${I.dataType}`);
|
|
3967
3967
|
return new kg(TA(I.dataType));
|
|
3968
3968
|
}
|
|
3969
3969
|
encode(A) {
|
|
3970
|
-
|
|
3970
|
+
sB(A.shape, A.stride);
|
|
3971
3971
|
const I = A.data, B = new this.#A(I.length);
|
|
3972
3972
|
B[0] = I[0];
|
|
3973
3973
|
for (let C = 1; C < I.length; C++)
|
|
@@ -3975,7 +3975,7 @@ class kg {
|
|
|
3975
3975
|
return { data: B, shape: A.shape, stride: A.stride };
|
|
3976
3976
|
}
|
|
3977
3977
|
decode(A) {
|
|
3978
|
-
|
|
3978
|
+
sB(A.shape, A.stride);
|
|
3979
3979
|
const I = A.data, B = new this.#A(I.length);
|
|
3980
3980
|
B[0] = I[0];
|
|
3981
3981
|
for (let C = 1; C < I.length; C++)
|
|
@@ -3990,14 +3990,14 @@ class Lg {
|
|
|
3990
3990
|
}
|
|
3991
3991
|
encode = UA("gzip");
|
|
3992
3992
|
async decode(A) {
|
|
3993
|
-
const I = await
|
|
3993
|
+
const I = await IC(A, { format: "gzip" });
|
|
3994
3994
|
return new Uint8Array(I);
|
|
3995
3995
|
}
|
|
3996
3996
|
}
|
|
3997
|
-
function
|
|
3997
|
+
function gE(g, A) {
|
|
3998
3998
|
return IA(!Number.isNaN(A), "JsonCodec allow_nan is false but NaN was encountered during encoding."), IA(A !== Number.POSITIVE_INFINITY, "JsonCodec allow_nan is false but Infinity was encountered during encoding."), IA(A !== Number.NEGATIVE_INFINITY, "JsonCodec allow_nan is false but -Infinity was encountered during encoding."), A;
|
|
3999
3999
|
}
|
|
4000
|
-
function
|
|
4000
|
+
function BE(g, A) {
|
|
4001
4001
|
return A instanceof Object && !Array.isArray(A) ? Object.keys(A).sort().reduce((I, B) => (I[B] = A[B], I), {}) : A;
|
|
4002
4002
|
}
|
|
4003
4003
|
class GI {
|
|
@@ -4027,7 +4027,7 @@ class GI {
|
|
|
4027
4027
|
const { indent: I, encoding: B, ensure_ascii: C, check_circular: Q, allow_nan: E, sort_keys: i } = this.#A;
|
|
4028
4028
|
IA(B === "utf-8", "JsonCodec does not yet support non-utf-8 encoding.");
|
|
4029
4029
|
const o = [];
|
|
4030
|
-
IA(Q, "JsonCodec does not yet support skipping the check for circular references during encoding."), E || o.push(
|
|
4030
|
+
IA(Q, "JsonCodec does not yet support skipping the check for circular references during encoding."), E || o.push(gE), i && o.push(BE);
|
|
4031
4031
|
const a = Array.from(A.data);
|
|
4032
4032
|
a.push("|O"), a.push(A.shape);
|
|
4033
4033
|
let D;
|
|
@@ -4046,13 +4046,13 @@ class GI {
|
|
|
4046
4046
|
decode(A) {
|
|
4047
4047
|
const { strict: I } = this.#I;
|
|
4048
4048
|
IA(I, "JsonCodec does not yet support non-strict decoding.");
|
|
4049
|
-
const B =
|
|
4049
|
+
const B = II(A), C = B.pop();
|
|
4050
4050
|
B.pop(), IA(C, "0D not implemented for JsonCodec.");
|
|
4051
4051
|
const Q = RA(C, "C");
|
|
4052
4052
|
return { data: B, shape: C, stride: Q };
|
|
4053
4053
|
}
|
|
4054
4054
|
}
|
|
4055
|
-
const
|
|
4055
|
+
const CE = /* @__PURE__ */ new Set([
|
|
4056
4056
|
"int8",
|
|
4057
4057
|
"uint8",
|
|
4058
4058
|
"int16",
|
|
@@ -4074,7 +4074,7 @@ class Jg {
|
|
|
4074
4074
|
this.#I = A, this.#g = I, this.#A = B;
|
|
4075
4075
|
}
|
|
4076
4076
|
static fromConfig(A, I) {
|
|
4077
|
-
if (!
|
|
4077
|
+
if (!CE.has(I.dataType))
|
|
4078
4078
|
throw new v(`scale_offset codec does not support data type: ${I.dataType}`);
|
|
4079
4079
|
return new Jg(nI(I.dataType, A.scale ?? 1), nI(I.dataType, A.offset ?? 0), TA(I.dataType));
|
|
4080
4080
|
}
|
|
@@ -4100,28 +4100,28 @@ class Yg {
|
|
|
4100
4100
|
return new Yg(A, I);
|
|
4101
4101
|
}
|
|
4102
4102
|
encode(A) {
|
|
4103
|
-
return
|
|
4103
|
+
return QE(A, this.#A);
|
|
4104
4104
|
}
|
|
4105
4105
|
decode(A) {
|
|
4106
|
-
return
|
|
4106
|
+
return EE(A, this.#A);
|
|
4107
4107
|
}
|
|
4108
4108
|
}
|
|
4109
|
-
function
|
|
4109
|
+
function QE(g, A) {
|
|
4110
4110
|
let I = g.length, B = Math.floor(I / A), C = new Uint8Array(I);
|
|
4111
4111
|
for (let Q = 0; Q < A; Q++)
|
|
4112
4112
|
for (let E = 0; E < B; E++)
|
|
4113
4113
|
C[Q * B + E] = g[E * A + Q];
|
|
4114
4114
|
return C;
|
|
4115
4115
|
}
|
|
4116
|
-
function
|
|
4116
|
+
function EE(g, A) {
|
|
4117
4117
|
let I = g.length, B = Math.floor(I / A), C = new Uint8Array(I);
|
|
4118
4118
|
for (let Q = 0; Q < A; Q++)
|
|
4119
4119
|
for (let E = 0; E < B; E++)
|
|
4120
4120
|
C[E * A + Q] = g[Q * B + E];
|
|
4121
4121
|
return C;
|
|
4122
4122
|
}
|
|
4123
|
-
function
|
|
4124
|
-
return g instanceof
|
|
4123
|
+
function hB(g) {
|
|
4124
|
+
return g instanceof _B || g instanceof Ng || g instanceof AI ? new Proxy(g, {
|
|
4125
4125
|
get(I, B) {
|
|
4126
4126
|
return I.get(Number(B));
|
|
4127
4127
|
},
|
|
@@ -4130,9 +4130,9 @@ function sB(g) {
|
|
|
4130
4130
|
}
|
|
4131
4131
|
}) : g;
|
|
4132
4132
|
}
|
|
4133
|
-
function
|
|
4133
|
+
function iE(g, A) {
|
|
4134
4134
|
let I;
|
|
4135
|
-
return g.data instanceof Ng || g.data instanceof
|
|
4135
|
+
return g.data instanceof Ng || g.data instanceof AI ? I = new g.constructor(
|
|
4136
4136
|
// @ts-expect-error
|
|
4137
4137
|
g.data.length,
|
|
4138
4138
|
g.data.chars
|
|
@@ -4142,8 +4142,8 @@ function QE(g, A) {
|
|
|
4142
4142
|
stride: RA(g.shape, A)
|
|
4143
4143
|
};
|
|
4144
4144
|
}
|
|
4145
|
-
function
|
|
4146
|
-
let I =
|
|
4145
|
+
function oE(g, A) {
|
|
4146
|
+
let I = iE(g, A), B = g.shape.length, C = g.data.length, Q = Array(B).fill(0), E = hB(g.data), i = hB(I.data);
|
|
4147
4147
|
for (let o = 0; o < C; o++) {
|
|
4148
4148
|
let a = 0;
|
|
4149
4149
|
for (let D = 0; D < B; D++)
|
|
@@ -4158,12 +4158,12 @@ function EE(g, A) {
|
|
|
4158
4158
|
}
|
|
4159
4159
|
return I;
|
|
4160
4160
|
}
|
|
4161
|
-
function
|
|
4161
|
+
function aE(g) {
|
|
4162
4162
|
let A = g.shape.length;
|
|
4163
4163
|
return IA(A === g.stride.length, "Shape and stride must have the same length."), g.stride.map((I, B) => ({ stride: I, index: B })).sort((I, B) => B.stride - I.stride).map((I) => I.index);
|
|
4164
4164
|
}
|
|
4165
|
-
function
|
|
4166
|
-
let I =
|
|
4165
|
+
function DE(g, A) {
|
|
4166
|
+
let I = aE(g);
|
|
4167
4167
|
return IA(I.length === A.length, "Orders must match"), I.every((B, C) => B === A[C]);
|
|
4168
4168
|
}
|
|
4169
4169
|
class Mg {
|
|
@@ -4188,7 +4188,7 @@ class Mg {
|
|
|
4188
4188
|
return new Mg(A, I);
|
|
4189
4189
|
}
|
|
4190
4190
|
encode(A) {
|
|
4191
|
-
return
|
|
4191
|
+
return DE(A, this.#I) ? A : oE(A, this.#I);
|
|
4192
4192
|
}
|
|
4193
4193
|
decode(A) {
|
|
4194
4194
|
return {
|
|
@@ -4225,25 +4225,25 @@ class dg {
|
|
|
4225
4225
|
}
|
|
4226
4226
|
encode = UA("zlib");
|
|
4227
4227
|
async decode(A) {
|
|
4228
|
-
const I = await
|
|
4228
|
+
const I = await IC(A, { format: "deflate" });
|
|
4229
4229
|
return new Uint8Array(I);
|
|
4230
4230
|
}
|
|
4231
4231
|
}
|
|
4232
|
-
function
|
|
4232
|
+
function sE() {
|
|
4233
4233
|
let g = () => import("./blosc-D1xNXZJs.js").then((Q) => Q.default), A = () => import("./lz4-1Ws5oVWR.js").then((Q) => Q.default), I = () => import("./zstd-C4EcZnjq.js").then((Q) => Q.default), B = () => Lg, C = () => dg;
|
|
4234
|
-
return (/* @__PURE__ */ new Map()).set("blosc", g).set("lz4", A).set("zstd", I).set("gzip", B).set("zlib", C).set("transpose", () => Mg).set("bytes", () =>
|
|
4234
|
+
return (/* @__PURE__ */ new Map()).set("blosc", g).set("lz4", A).set("zstd", I).set("gzip", B).set("zlib", C).set("transpose", () => Mg).set("bytes", () => dI).set("crc32c", () => Ug).set("vlen-utf8", () => wI).set("json2", () => GI).set("bitround", () => yI).set("cast_value", () => cg).set("scale_offset", () => Jg).set("numcodecs.blosc", g).set("numcodecs.lz4", A).set("numcodecs.zstd", I).set("numcodecs.gzip", B).set("numcodecs.zlib", C).set("numcodecs.vlen-utf8", () => wI).set("numcodecs.shuffle", () => Yg).set("numcodecs.delta", () => kg).set("numcodecs.bitround", () => yI).set("numcodecs.json2", () => GI);
|
|
4235
4235
|
}
|
|
4236
|
-
const
|
|
4237
|
-
function
|
|
4236
|
+
const hE = sE();
|
|
4237
|
+
function Bg(g) {
|
|
4238
4238
|
let A;
|
|
4239
4239
|
function I() {
|
|
4240
|
-
return A || (A =
|
|
4240
|
+
return A || (A = tE(g)), A;
|
|
4241
4241
|
}
|
|
4242
4242
|
async function B(C, Q, E) {
|
|
4243
4243
|
try {
|
|
4244
4244
|
return await E();
|
|
4245
4245
|
} catch (i) {
|
|
4246
|
-
throw new
|
|
4246
|
+
throw new WQ({ direction: C, codec: Q, cause: i });
|
|
4247
4247
|
}
|
|
4248
4248
|
}
|
|
4249
4249
|
return {
|
|
@@ -4270,23 +4270,23 @@ function gg(g) {
|
|
|
4270
4270
|
return E;
|
|
4271
4271
|
},
|
|
4272
4272
|
async computeEncodedSize(C) {
|
|
4273
|
-
let Q = await I(), E =
|
|
4273
|
+
let Q = await I(), E = tB(Q.arrayToBytes.name, Q.arrayToBytes.codec, C);
|
|
4274
4274
|
for (const { name: i, codec: o } of Q.bytesToBytes)
|
|
4275
|
-
E =
|
|
4275
|
+
E = tB(i, o, E);
|
|
4276
4276
|
return E;
|
|
4277
4277
|
}
|
|
4278
4278
|
};
|
|
4279
4279
|
}
|
|
4280
|
-
function
|
|
4280
|
+
function tB(g, A, I) {
|
|
4281
4281
|
if (!A.computeEncodedSize)
|
|
4282
4282
|
throw new v(`Codec "${g}" cannot compute its encoded size; it is not a fixed-size codec and cannot be used in a sharding index pipeline`);
|
|
4283
4283
|
return A.computeEncodedSize(I);
|
|
4284
4284
|
}
|
|
4285
|
-
async function
|
|
4285
|
+
async function tE(g) {
|
|
4286
4286
|
let A = g.codecs.map(async (E) => {
|
|
4287
|
-
let i = await
|
|
4287
|
+
let i = await hE.get(E.name)?.();
|
|
4288
4288
|
if (!i)
|
|
4289
|
-
throw new
|
|
4289
|
+
throw new xQ(E.name);
|
|
4290
4290
|
return { Codec: i, meta: E };
|
|
4291
4291
|
}), I = [], B, C = [], Q = { ...g };
|
|
4292
4292
|
for await (let { Codec: E, meta: i } of A) {
|
|
@@ -4312,11 +4312,11 @@ async function sE(g) {
|
|
|
4312
4312
|
}
|
|
4313
4313
|
}
|
|
4314
4314
|
if (!B) {
|
|
4315
|
-
if (!
|
|
4315
|
+
if (!yE(Q))
|
|
4316
4316
|
throw new v(`Cannot encode ${Q.dataType} to bytes without a codec`);
|
|
4317
4317
|
B = {
|
|
4318
4318
|
name: "bytes",
|
|
4319
|
-
codec:
|
|
4319
|
+
codec: dI.fromConfig({ endian: "little" }, Q)
|
|
4320
4320
|
};
|
|
4321
4321
|
}
|
|
4322
4322
|
return {
|
|
@@ -4325,14 +4325,14 @@ async function sE(g) {
|
|
|
4325
4325
|
bytesToBytes: C
|
|
4326
4326
|
};
|
|
4327
4327
|
}
|
|
4328
|
-
function
|
|
4328
|
+
function yE(g) {
|
|
4329
4329
|
return g.dataType !== "v2:object" && g.dataType !== "string";
|
|
4330
4330
|
}
|
|
4331
|
-
const
|
|
4332
|
-
function
|
|
4331
|
+
const yB = 18446744073709551615n;
|
|
4332
|
+
function eE(g, A, I, B) {
|
|
4333
4333
|
if (!g.store.getRange)
|
|
4334
4334
|
throw new Sg("sharding requires a store with getRange");
|
|
4335
|
-
let C = g.store.getRange.bind(g.store), Q = A.map((a, D) => a / B.chunk_shape[D]), E =
|
|
4335
|
+
let C = g.store.getRange.bind(g.store), Q = A.map((a, D) => a / B.chunk_shape[D]), E = Bg({
|
|
4336
4336
|
dataType: "uint64",
|
|
4337
4337
|
shape: [...Q, 2],
|
|
4338
4338
|
codecs: B.index_codecs,
|
|
@@ -4350,7 +4350,7 @@ function tE(g, A, I, B) {
|
|
|
4350
4350
|
if (t === null)
|
|
4351
4351
|
return;
|
|
4352
4352
|
let { data: y, shape: n, stride: F } = t, G = a.map((S, r) => S % n[r]).reduce((S, r, c) => S + r * F[c], 0), J = y[G], U = y[G + 1];
|
|
4353
|
-
if (!(J ===
|
|
4353
|
+
if (!(J === yB && U === yB))
|
|
4354
4354
|
return C(h, {
|
|
4355
4355
|
offset: Number(J),
|
|
4356
4356
|
length: Number(U)
|
|
@@ -4378,23 +4378,23 @@ class Kg extends CA {
|
|
|
4378
4378
|
return this.#A.attributes;
|
|
4379
4379
|
}
|
|
4380
4380
|
}
|
|
4381
|
-
function
|
|
4381
|
+
function eB(g) {
|
|
4382
4382
|
return g.find((I) => I.name === "transpose")?.configuration?.order ?? "C";
|
|
4383
4383
|
}
|
|
4384
4384
|
const QI = Symbol("zarrita.context");
|
|
4385
|
-
function
|
|
4386
|
-
let { configuration: I } = A.codecs.find(
|
|
4387
|
-
encodeChunkKey:
|
|
4385
|
+
function nE(g, A) {
|
|
4386
|
+
let { configuration: I } = A.codecs.find(XQ) ?? {}, B = {
|
|
4387
|
+
encodeChunkKey: PQ(A.chunk_key_encoding),
|
|
4388
4388
|
TypedArray: TA(A.data_type),
|
|
4389
4389
|
fillValue: A.fill_value
|
|
4390
4390
|
};
|
|
4391
4391
|
if (I) {
|
|
4392
|
-
let Q =
|
|
4392
|
+
let Q = eB(I.codecs);
|
|
4393
4393
|
return {
|
|
4394
4394
|
...B,
|
|
4395
4395
|
kind: "sharded",
|
|
4396
4396
|
chunkShape: I.chunk_shape,
|
|
4397
|
-
codec:
|
|
4397
|
+
codec: Bg({
|
|
4398
4398
|
dataType: A.data_type,
|
|
4399
4399
|
shape: I.chunk_shape,
|
|
4400
4400
|
codecs: I.codecs,
|
|
@@ -4403,15 +4403,15 @@ function yE(g, A) {
|
|
|
4403
4403
|
getStrides(E) {
|
|
4404
4404
|
return RA(E, Q);
|
|
4405
4405
|
},
|
|
4406
|
-
getChunkBytes:
|
|
4406
|
+
getChunkBytes: eE(g, A.chunk_grid.configuration.chunk_shape, B.encodeChunkKey, I)
|
|
4407
4407
|
};
|
|
4408
4408
|
}
|
|
4409
|
-
let C =
|
|
4409
|
+
let C = eB(A.codecs);
|
|
4410
4410
|
return {
|
|
4411
4411
|
...B,
|
|
4412
4412
|
kind: "regular",
|
|
4413
4413
|
chunkShape: A.chunk_grid.configuration.chunk_shape,
|
|
4414
|
-
codec:
|
|
4414
|
+
codec: Bg({
|
|
4415
4415
|
dataType: A.data_type,
|
|
4416
4416
|
shape: A.chunk_grid.configuration.chunk_shape,
|
|
4417
4417
|
codecs: A.codecs,
|
|
@@ -4433,8 +4433,8 @@ let FI = class extends CA {
|
|
|
4433
4433
|
constructor(A, I, B) {
|
|
4434
4434
|
super(A, I), this.#A = {
|
|
4435
4435
|
...B,
|
|
4436
|
-
fill_value:
|
|
4437
|
-
}, this[QI] =
|
|
4436
|
+
fill_value: $B(B)
|
|
4437
|
+
}, this[QI] = nE(this, this.#A);
|
|
4438
4438
|
}
|
|
4439
4439
|
get attrs() {
|
|
4440
4440
|
return this.#A.attributes;
|
|
@@ -4455,7 +4455,7 @@ let FI = class extends CA {
|
|
|
4455
4455
|
return this.#A.data_type;
|
|
4456
4456
|
}
|
|
4457
4457
|
async getChunk(A, I, B) {
|
|
4458
|
-
B?.useSharedArrayBuffer &&
|
|
4458
|
+
B?.useSharedArrayBuffer && bQ();
|
|
4459
4459
|
let C = this[QI], Q = await C.getChunkBytes(A, I);
|
|
4460
4460
|
if (!Q) {
|
|
4461
4461
|
let E = C.chunkShape.reduce((o, a) => o * a, 1), i;
|
|
@@ -4464,7 +4464,7 @@ let FI = class extends CA {
|
|
|
4464
4464
|
if (!("BYTES_PER_ELEMENT" in o))
|
|
4465
4465
|
console.warn("zarrita: useSharedArrayBuffer is not supported for non-buffer-backed data types."), i = new C.TypedArray(E);
|
|
4466
4466
|
else {
|
|
4467
|
-
let a =
|
|
4467
|
+
let a = ZQ(E * o.BYTES_PER_ELEMENT);
|
|
4468
4468
|
i = new C.TypedArray(a, 0, E);
|
|
4469
4469
|
}
|
|
4470
4470
|
} else
|
|
@@ -4495,24 +4495,24 @@ let FI = class extends CA {
|
|
|
4495
4495
|
* ```
|
|
4496
4496
|
*/
|
|
4497
4497
|
is(A) {
|
|
4498
|
-
return
|
|
4498
|
+
return Ig(this.dtype, A);
|
|
4499
4499
|
}
|
|
4500
4500
|
};
|
|
4501
|
-
function
|
|
4501
|
+
function GE(g, A) {
|
|
4502
4502
|
let I = g;
|
|
4503
4503
|
for (let B of A)
|
|
4504
4504
|
I instanceof Promise ? I = I.then((C) => B(C)) : I = B(I);
|
|
4505
4505
|
return I;
|
|
4506
4506
|
}
|
|
4507
|
-
function
|
|
4508
|
-
return
|
|
4507
|
+
function wE(g, ...A) {
|
|
4508
|
+
return GE(g, A);
|
|
4509
4509
|
}
|
|
4510
|
-
async function
|
|
4510
|
+
async function BC(g) {
|
|
4511
4511
|
let A = g.store.arrayExtensions;
|
|
4512
|
-
return A?.length ? await
|
|
4512
|
+
return A?.length ? await wE(g, ...A) : g;
|
|
4513
4513
|
}
|
|
4514
|
-
let
|
|
4515
|
-
function
|
|
4514
|
+
let KI = FE();
|
|
4515
|
+
function FE() {
|
|
4516
4516
|
let g = /* @__PURE__ */ new WeakMap();
|
|
4517
4517
|
function A(I) {
|
|
4518
4518
|
let B = g.get(I) ?? { v2: 0, v3: 0 };
|
|
@@ -4528,38 +4528,38 @@ function GE() {
|
|
|
4528
4528
|
}
|
|
4529
4529
|
};
|
|
4530
4530
|
}
|
|
4531
|
-
async function
|
|
4531
|
+
async function rE(g, A) {
|
|
4532
4532
|
let I = await g.store.get(g.resolve(".zattrs").path, {
|
|
4533
4533
|
signal: A
|
|
4534
4534
|
});
|
|
4535
|
-
return I ?
|
|
4535
|
+
return I ? II(I) : {};
|
|
4536
4536
|
}
|
|
4537
|
-
async function
|
|
4537
|
+
async function SE(g, A = {}) {
|
|
4538
4538
|
let I = "store" in g ? g : new CA(g), { signal: B } = A, C = {};
|
|
4539
|
-
return (A.attrs ?? !0) && (C = await
|
|
4539
|
+
return (A.attrs ?? !0) && (C = await rE(I, B)), B?.throwIfAborted(), A.kind === "array" ? nB(I, C, B) : A.kind === "group" ? GB(I, C, B) : nB(I, C, B).catch((Q) => (AC(Q, uA, v), GB(I, C, B)));
|
|
4540
4540
|
}
|
|
4541
|
-
async function
|
|
4541
|
+
async function nB(g, A, I) {
|
|
4542
4542
|
let { path: B } = g.resolve(".zarray"), C = await g.store.get(B, { signal: I });
|
|
4543
4543
|
if (!C)
|
|
4544
4544
|
throw new uA("v2 array", { path: B });
|
|
4545
|
-
return
|
|
4545
|
+
return KI.increment(g.store, "v2"), BC(new FI(g.store, g.path, VQ(II(C), A)));
|
|
4546
4546
|
}
|
|
4547
|
-
async function
|
|
4547
|
+
async function GB(g, A, I) {
|
|
4548
4548
|
let { path: B } = g.resolve(".zgroup"), C = await g.store.get(B, { signal: I });
|
|
4549
4549
|
if (!C)
|
|
4550
4550
|
throw new uA("v2 group", { path: B });
|
|
4551
|
-
return
|
|
4551
|
+
return KI.increment(g.store, "v2"), new Kg(g.store, g.path, vQ(II(C), A));
|
|
4552
4552
|
}
|
|
4553
|
-
async function
|
|
4553
|
+
async function RE(g, A) {
|
|
4554
4554
|
let { store: I, path: B } = g.resolve("zarr.json"), C = await g.store.get(B, { signal: A });
|
|
4555
4555
|
if (!C)
|
|
4556
4556
|
throw new uA("v3 array or group", { path: B });
|
|
4557
|
-
let Q =
|
|
4558
|
-
return Q.node_type === "array" && (Q.fill_value =
|
|
4557
|
+
let Q = II(C);
|
|
4558
|
+
return Q.node_type === "array" && (Q.fill_value = $B(Q)), Q.node_type === "array" ? BC(new FI(I, g.path, Q)) : new Kg(I, g.path, Q);
|
|
4559
4559
|
}
|
|
4560
|
-
async function
|
|
4561
|
-
let I = "store" in g ? g : new CA(g), B = await
|
|
4562
|
-
if (
|
|
4560
|
+
async function NE(g, A = {}) {
|
|
4561
|
+
let I = "store" in g ? g : new CA(g), B = await RE(I, A.signal);
|
|
4562
|
+
if (KI.increment(I.store, "v3"), A.kind === void 0 || A.kind === "array" && B instanceof FI || A.kind === "group" && B instanceof Kg)
|
|
4563
4563
|
return B;
|
|
4564
4564
|
let C = B instanceof FI ? "array" : "group";
|
|
4565
4565
|
throw new uA(`${A.kind} at ${I.path}`, {
|
|
@@ -4568,12 +4568,12 @@ async function SE(g, A = {}) {
|
|
|
4568
4568
|
});
|
|
4569
4569
|
}
|
|
4570
4570
|
async function BA(g, A = {}) {
|
|
4571
|
-
let I = "store" in g ? g.store : g, B =
|
|
4572
|
-
return C(g, A).catch((E) => (
|
|
4571
|
+
let I = "store" in g ? g.store : g, B = KI.versionMax(I), C = B === "v2" ? BA.v2 : BA.v3, Q = B === "v2" ? BA.v3 : BA.v2;
|
|
4572
|
+
return C(g, A).catch((E) => (AC(E, uA, v), Q(g, A)));
|
|
4573
4573
|
}
|
|
4574
|
-
BA.v2 =
|
|
4575
|
-
BA.v3 =
|
|
4576
|
-
async function
|
|
4574
|
+
BA.v2 = SE;
|
|
4575
|
+
BA.v3 = NE;
|
|
4576
|
+
async function cE(g, A) {
|
|
4577
4577
|
const I = A.split("/"), B = I.pop();
|
|
4578
4578
|
if (!B)
|
|
4579
4579
|
throw new Error("Invalid path");
|
|
@@ -4590,7 +4590,7 @@ class Hg {
|
|
|
4590
4590
|
return this.#A;
|
|
4591
4591
|
}
|
|
4592
4592
|
async get(A) {
|
|
4593
|
-
const I = await
|
|
4593
|
+
const I = await cE(this.#A, A.slice(1)).catch(
|
|
4594
4594
|
() => {
|
|
4595
4595
|
}
|
|
4596
4596
|
);
|
|
@@ -4600,7 +4600,7 @@ class Hg {
|
|
|
4600
4600
|
return new Uint8Array(C);
|
|
4601
4601
|
}
|
|
4602
4602
|
}
|
|
4603
|
-
async function
|
|
4603
|
+
async function gI(g, A) {
|
|
4604
4604
|
if (A === "v2")
|
|
4605
4605
|
try {
|
|
4606
4606
|
return BA.v2(g, { kind: "group", attrs: !0 });
|
|
@@ -4619,7 +4619,7 @@ async function BI(g, A) {
|
|
|
4619
4619
|
throw new Error(`Failed to open Zarr group at ${g}`);
|
|
4620
4620
|
}
|
|
4621
4621
|
}
|
|
4622
|
-
async function
|
|
4622
|
+
async function UE(g, A) {
|
|
4623
4623
|
if (A === "v2")
|
|
4624
4624
|
try {
|
|
4625
4625
|
return BA.v2(g, { kind: "array", attrs: !1 });
|
|
@@ -4638,11 +4638,11 @@ async function NE(g, A) {
|
|
|
4638
4638
|
throw new Error(`Failed to open Zarr array at ${g}`);
|
|
4639
4639
|
}
|
|
4640
4640
|
}
|
|
4641
|
-
async function
|
|
4641
|
+
async function kE(g) {
|
|
4642
4642
|
let A;
|
|
4643
4643
|
switch (g.type) {
|
|
4644
4644
|
case "fetch": {
|
|
4645
|
-
const B = new
|
|
4645
|
+
const B = new _A(g.url);
|
|
4646
4646
|
A = new CA(B);
|
|
4647
4647
|
break;
|
|
4648
4648
|
}
|
|
@@ -4659,10 +4659,10 @@ async function cE(g) {
|
|
|
4659
4659
|
}
|
|
4660
4660
|
}
|
|
4661
4661
|
const I = g.arrayPath ? A.resolve(g.arrayPath) : A;
|
|
4662
|
-
return
|
|
4662
|
+
return UE(I, g.zarrVersion);
|
|
4663
4663
|
}
|
|
4664
|
-
function
|
|
4665
|
-
if (g.store instanceof
|
|
4664
|
+
function LE(g, A, I) {
|
|
4665
|
+
if (g.store instanceof _A)
|
|
4666
4666
|
return {
|
|
4667
4667
|
type: "fetch",
|
|
4668
4668
|
arrayPath: A,
|
|
@@ -4681,10 +4681,10 @@ function UE(g, A, I) {
|
|
|
4681
4681
|
`Unsupported store type: ${g.store.constructor.name}`
|
|
4682
4682
|
);
|
|
4683
4683
|
}
|
|
4684
|
-
function
|
|
4685
|
-
return
|
|
4684
|
+
function JE(g, A, I, B) {
|
|
4685
|
+
return YE(g, A, I, B);
|
|
4686
4686
|
}
|
|
4687
|
-
function
|
|
4687
|
+
function YE(g, A, I, B) {
|
|
4688
4688
|
const { targetShape: C, chunkIndex: Q, dimIndices: E } = B;
|
|
4689
4689
|
let i = 1;
|
|
4690
4690
|
for (let r = A.length - 1; r >= 0; r--) {
|
|
@@ -4719,7 +4719,7 @@ function LE(g, A, I, B) {
|
|
|
4719
4719
|
}
|
|
4720
4720
|
return G;
|
|
4721
4721
|
}
|
|
4722
|
-
const
|
|
4722
|
+
const CC = `function xg(B, A) {
|
|
4723
4723
|
return {
|
|
4724
4724
|
...B,
|
|
4725
4725
|
...A,
|
|
@@ -8373,11 +8373,11 @@ return ret;
|
|
|
8373
8373
|
default: IQ
|
|
8374
8374
|
});
|
|
8375
8375
|
//# sourceMappingURL=worker_kernel-CBlE4MBI.js.map
|
|
8376
|
-
`,
|
|
8377
|
-
function
|
|
8376
|
+
`, wB = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", CC], { type: "text/javascript;charset=utf-8" });
|
|
8377
|
+
function ME(g) {
|
|
8378
8378
|
let A;
|
|
8379
8379
|
try {
|
|
8380
|
-
if (A =
|
|
8380
|
+
if (A = wB && (self.URL || self.webkitURL).createObjectURL(wB), !A) throw "";
|
|
8381
8381
|
const I = new Worker(A, {
|
|
8382
8382
|
type: "module",
|
|
8383
8383
|
name: g?.name
|
|
@@ -8387,7 +8387,7 @@ function JE(g) {
|
|
|
8387
8387
|
}), I;
|
|
8388
8388
|
} catch {
|
|
8389
8389
|
return new Worker(
|
|
8390
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
8390
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(CC),
|
|
8391
8391
|
{
|
|
8392
8392
|
type: "module",
|
|
8393
8393
|
name: g?.name
|
|
@@ -8395,17 +8395,17 @@ function JE(g) {
|
|
|
8395
8395
|
);
|
|
8396
8396
|
}
|
|
8397
8397
|
}
|
|
8398
|
-
const
|
|
8399
|
-
let EA = [],
|
|
8398
|
+
const dE = Math.max(1, navigator.hardwareConcurrency - 2);
|
|
8399
|
+
let EA = [], KE = 0, QC = 0;
|
|
8400
8400
|
const NA = /* @__PURE__ */ new Map(), rI = /* @__PURE__ */ new Set();
|
|
8401
|
-
function
|
|
8401
|
+
function EC(g) {
|
|
8402
8402
|
const A = EA.find((I) => I.worker === g);
|
|
8403
8403
|
return A || k.error(
|
|
8404
8404
|
"ZarrWorker",
|
|
8405
8405
|
"Worker not found in pool - this should not happen"
|
|
8406
8406
|
), A;
|
|
8407
8407
|
}
|
|
8408
|
-
function
|
|
8408
|
+
function HE(g, A) {
|
|
8409
8409
|
const { id: I, success: B } = g.data, C = NA.get(I);
|
|
8410
8410
|
if (!C) {
|
|
8411
8411
|
rI.has(I) ? rI.delete(I) : k.warn(
|
|
@@ -8416,13 +8416,13 @@ function dE(g, A) {
|
|
|
8416
8416
|
return;
|
|
8417
8417
|
}
|
|
8418
8418
|
NA.delete(I), C.abortListener && C.abortSignal && C.abortSignal.removeEventListener("abort", C.abortListener);
|
|
8419
|
-
const Q =
|
|
8419
|
+
const Q = EC(A);
|
|
8420
8420
|
Q && Q.pendingCount > 0 ? Q.pendingCount-- : Q && k.error(
|
|
8421
8421
|
"ZarrWorker",
|
|
8422
8422
|
"Received message but no pending tasks - this should not happen"
|
|
8423
8423
|
), B && g.data.type === "getChunk" ? C.resolve(g.data.data) : B || C.reject(new Error(g.data.error || "Unknown worker error"));
|
|
8424
8424
|
}
|
|
8425
|
-
function
|
|
8425
|
+
function FB(g, A) {
|
|
8426
8426
|
if (g instanceof MessageEvent) {
|
|
8427
8427
|
k.error(
|
|
8428
8428
|
"ZarrWorker",
|
|
@@ -8435,7 +8435,7 @@ function wB(g, A) {
|
|
|
8435
8435
|
"Worker failed - replacing worker and canceling its in-flight messages",
|
|
8436
8436
|
g.message
|
|
8437
8437
|
);
|
|
8438
|
-
const I =
|
|
8438
|
+
const I = EC(A);
|
|
8439
8439
|
if (I) {
|
|
8440
8440
|
const C = EA.indexOf(I);
|
|
8441
8441
|
EA.splice(C, 1);
|
|
@@ -8445,31 +8445,31 @@ function wB(g, A) {
|
|
|
8445
8445
|
for (const [C, Q] of NA.entries())
|
|
8446
8446
|
Q.workerId === B && (Q.reject(new Error(`Worker error: ${g.message}`)), NA.delete(C));
|
|
8447
8447
|
try {
|
|
8448
|
-
const C =
|
|
8448
|
+
const C = iC();
|
|
8449
8449
|
EA.push({
|
|
8450
8450
|
worker: C,
|
|
8451
8451
|
pendingCount: 0,
|
|
8452
|
-
workerId:
|
|
8452
|
+
workerId: QC++
|
|
8453
8453
|
}), k.debug("ZarrWorker", "Replacement worker created successfully");
|
|
8454
8454
|
} catch (C) {
|
|
8455
8455
|
k.error("ZarrWorker", "Failed to create replacement worker", C);
|
|
8456
8456
|
}
|
|
8457
8457
|
}
|
|
8458
|
-
function
|
|
8459
|
-
const g = new
|
|
8460
|
-
return g.addEventListener("message", (A) =>
|
|
8458
|
+
function iC() {
|
|
8459
|
+
const g = new ME();
|
|
8460
|
+
return g.addEventListener("message", (A) => HE(A, g)), g.addEventListener("error", (A) => FB(A, g)), g.addEventListener(
|
|
8461
8461
|
"messageerror",
|
|
8462
|
-
(A) =>
|
|
8462
|
+
(A) => FB(A, g)
|
|
8463
8463
|
), g;
|
|
8464
8464
|
}
|
|
8465
|
-
function
|
|
8465
|
+
function qE() {
|
|
8466
8466
|
if (EA.length === 0)
|
|
8467
8467
|
throw new Error("Worker pool is not initialized");
|
|
8468
8468
|
return EA.sort((g, A) => g.pendingCount - A.pendingCount)[0];
|
|
8469
8469
|
}
|
|
8470
|
-
async function
|
|
8470
|
+
async function lE(g, A, I, B) {
|
|
8471
8471
|
return new Promise((C, Q) => {
|
|
8472
|
-
const E =
|
|
8472
|
+
const E = qE(), i = KE++, o = {
|
|
8473
8473
|
resolve: C,
|
|
8474
8474
|
reject: Q,
|
|
8475
8475
|
workerId: E.workerId
|
|
@@ -8496,15 +8496,15 @@ async function HE(g, A, I, B) {
|
|
|
8496
8496
|
});
|
|
8497
8497
|
});
|
|
8498
8498
|
}
|
|
8499
|
-
function
|
|
8499
|
+
function fE() {
|
|
8500
8500
|
if (!(EA.length > 0))
|
|
8501
8501
|
try {
|
|
8502
|
-
for (let g = 0; g <
|
|
8503
|
-
const A =
|
|
8502
|
+
for (let g = 0; g < dE; g++) {
|
|
8503
|
+
const A = iC();
|
|
8504
8504
|
EA.push({
|
|
8505
8505
|
worker: A,
|
|
8506
8506
|
pendingCount: 0,
|
|
8507
|
-
workerId:
|
|
8507
|
+
workerId: QC++
|
|
8508
8508
|
});
|
|
8509
8509
|
}
|
|
8510
8510
|
k.debug(
|
|
@@ -8512,14 +8512,14 @@ function qE() {
|
|
|
8512
8512
|
`Initialized worker pool with ${EA.length} workers`
|
|
8513
8513
|
);
|
|
8514
8514
|
} catch {
|
|
8515
|
-
k.warn("ZarrWorker", "Failed to create workers - clearing pool"),
|
|
8515
|
+
k.warn("ZarrWorker", "Failed to create workers - clearing pool"), mE();
|
|
8516
8516
|
return;
|
|
8517
8517
|
}
|
|
8518
8518
|
}
|
|
8519
|
-
async function
|
|
8520
|
-
|
|
8519
|
+
async function pE(g, A, I, B, C) {
|
|
8520
|
+
fE();
|
|
8521
8521
|
try {
|
|
8522
|
-
return await
|
|
8522
|
+
return await lE(
|
|
8523
8523
|
A,
|
|
8524
8524
|
I,
|
|
8525
8525
|
B,
|
|
@@ -8530,11 +8530,11 @@ async function lE(g, A, I, B, C) {
|
|
|
8530
8530
|
throw Q;
|
|
8531
8531
|
k.warn("ZarrWorker", "Falling back to main thread", Q);
|
|
8532
8532
|
const E = await g.getChunk(I, C);
|
|
8533
|
-
if (!
|
|
8533
|
+
if (!NQ(E.data))
|
|
8534
8534
|
throw new Error(
|
|
8535
8535
|
`Unsupported chunk data type: ${E.data.constructor.name}`
|
|
8536
8536
|
);
|
|
8537
|
-
return
|
|
8537
|
+
return JE(
|
|
8538
8538
|
E.data,
|
|
8539
8539
|
E.shape,
|
|
8540
8540
|
E.stride,
|
|
@@ -8542,19 +8542,19 @@ async function lE(g, A, I, B, C) {
|
|
|
8542
8542
|
);
|
|
8543
8543
|
}
|
|
8544
8544
|
}
|
|
8545
|
-
function
|
|
8545
|
+
function mE() {
|
|
8546
8546
|
for (const g of EA)
|
|
8547
8547
|
g.worker.terminate();
|
|
8548
8548
|
EA = [], NA.clear();
|
|
8549
8549
|
}
|
|
8550
|
-
class
|
|
8550
|
+
class uE {
|
|
8551
8551
|
metadata_;
|
|
8552
8552
|
arrays_;
|
|
8553
8553
|
arrayParams_;
|
|
8554
8554
|
dimensions_;
|
|
8555
8555
|
bytesPerElement_;
|
|
8556
8556
|
constructor(A) {
|
|
8557
|
-
this.metadata_ = A.metadata, this.arrays_ = A.arrays, this.arrayParams_ = A.arrayParams, this.dimensions_ =
|
|
8557
|
+
this.metadata_ = A.metadata, this.arrays_ = A.arrays, this.arrayParams_ = A.arrayParams, this.dimensions_ = xE(this.metadata_, this.arrays_), this.bytesPerElement_ = TE(this.arrays_[0].dtype);
|
|
8558
8558
|
}
|
|
8559
8559
|
getSourceDimensionMap() {
|
|
8560
8560
|
return this.dimensions_;
|
|
@@ -8588,21 +8588,21 @@ class pE {
|
|
|
8588
8588
|
},
|
|
8589
8589
|
cChunkSize: E?.chunkSize,
|
|
8590
8590
|
tChunkSize: i?.chunkSize
|
|
8591
|
-
}, a = await
|
|
8591
|
+
}, a = await pE(
|
|
8592
8592
|
C,
|
|
8593
8593
|
Q,
|
|
8594
8594
|
B,
|
|
8595
8595
|
o,
|
|
8596
8596
|
{ signal: I }
|
|
8597
8597
|
), D = a.BYTES_PER_ELEMENT;
|
|
8598
|
-
if (!
|
|
8598
|
+
if (!hQ(D))
|
|
8599
8599
|
throw new Error(
|
|
8600
8600
|
"Invalid row alignment value. Possible values are 1, 2, 4, or 8"
|
|
8601
8601
|
);
|
|
8602
|
-
A.rowAlignmentBytes = D,
|
|
8602
|
+
A.rowAlignmentBytes = D, SQ(A, a);
|
|
8603
8603
|
}
|
|
8604
8604
|
}
|
|
8605
|
-
const
|
|
8605
|
+
const rB = {
|
|
8606
8606
|
int8: 1,
|
|
8607
8607
|
uint8: 1,
|
|
8608
8608
|
int16: 2,
|
|
@@ -8611,16 +8611,16 @@ const FB = {
|
|
|
8611
8611
|
uint32: 4,
|
|
8612
8612
|
float32: 4
|
|
8613
8613
|
};
|
|
8614
|
-
function
|
|
8615
|
-
const A =
|
|
8614
|
+
function TE(g) {
|
|
8615
|
+
const A = rB[g];
|
|
8616
8616
|
if (A === void 0)
|
|
8617
8617
|
throw new Error(
|
|
8618
|
-
`Unsupported zarr dtype "${g}". Supported dtypes: ${Object.keys(
|
|
8618
|
+
`Unsupported zarr dtype "${g}". Supported dtypes: ${Object.keys(rB).join(", ")}`
|
|
8619
8619
|
);
|
|
8620
8620
|
return A;
|
|
8621
8621
|
}
|
|
8622
|
-
function
|
|
8623
|
-
const I = g.axes.map((s) => s.name), B = g.axes.length, C =
|
|
8622
|
+
function xE(g, A) {
|
|
8623
|
+
const I = g.axes.map((s) => s.name), B = g.axes.length, C = SB(I, "x"), Q = SB(I, "y"), E = (s, h) => {
|
|
8624
8624
|
const t = [];
|
|
8625
8625
|
for (let y = 0; y < g.datasets.length; y++) {
|
|
8626
8626
|
const n = g.datasets[y], F = A[y], G = n.coordinateTransformations[0].scale, J = n.coordinateTransformations.length === 2 ? n.coordinateTransformations[1].translation : new Array(B).fill(0);
|
|
@@ -8631,7 +8631,7 @@ function uE(g, A) {
|
|
|
8631
8631
|
translation: J[h]
|
|
8632
8632
|
});
|
|
8633
8633
|
}
|
|
8634
|
-
if (g.axes[h].type === "space" &&
|
|
8634
|
+
if (g.axes[h].type === "space" && bE(t))
|
|
8635
8635
|
for (const y of t) y.translation -= 0.5 * y.scale;
|
|
8636
8636
|
return {
|
|
8637
8637
|
name: s,
|
|
@@ -8650,10 +8650,10 @@ function uE(g, A) {
|
|
|
8650
8650
|
const D = iI(I, "t");
|
|
8651
8651
|
return D !== -1 && (i.t = E(I[D], D)), i;
|
|
8652
8652
|
}
|
|
8653
|
-
function
|
|
8653
|
+
function WE(g, A) {
|
|
8654
8654
|
return g.toLowerCase() === A.toLowerCase();
|
|
8655
8655
|
}
|
|
8656
|
-
function
|
|
8656
|
+
function SB(g, A) {
|
|
8657
8657
|
const I = iI(g, A);
|
|
8658
8658
|
if (I === -1)
|
|
8659
8659
|
throw new Error(
|
|
@@ -8662,9 +8662,9 @@ function rB(g, A) {
|
|
|
8662
8662
|
return I;
|
|
8663
8663
|
}
|
|
8664
8664
|
function iI(g, A) {
|
|
8665
|
-
return g.findIndex((I) =>
|
|
8665
|
+
return g.findIndex((I) => WE(I, A));
|
|
8666
8666
|
}
|
|
8667
|
-
function
|
|
8667
|
+
function bE(g) {
|
|
8668
8668
|
if (g.length <= 1) return !1;
|
|
8669
8669
|
for (let A = 1; A < g.length; A++) {
|
|
8670
8670
|
const I = 0.5 * (g[A].scale - g[A - 1].scale), B = g[A].translation - g[A - 1].translation;
|
|
@@ -8709,14 +8709,14 @@ var l;
|
|
|
8709
8709
|
}
|
|
8710
8710
|
g.joinValues = B, g.jsonStringifyReplacer = (C, Q) => typeof Q == "bigint" ? Q.toString() : Q;
|
|
8711
8711
|
})(l || (l = {}));
|
|
8712
|
-
var
|
|
8712
|
+
var RB;
|
|
8713
8713
|
(function(g) {
|
|
8714
8714
|
g.mergeShapes = (A, I) => ({
|
|
8715
8715
|
...A,
|
|
8716
8716
|
...I
|
|
8717
8717
|
// second overwrites first
|
|
8718
8718
|
});
|
|
8719
|
-
})(
|
|
8719
|
+
})(RB || (RB = {}));
|
|
8720
8720
|
const R = l.arrayToEnum([
|
|
8721
8721
|
"string",
|
|
8722
8722
|
"nan",
|
|
@@ -8841,7 +8841,7 @@ class tA extends Error {
|
|
|
8841
8841
|
}
|
|
8842
8842
|
}
|
|
8843
8843
|
tA.create = (g) => new tA(g);
|
|
8844
|
-
const
|
|
8844
|
+
const Cg = (g, A) => {
|
|
8845
8845
|
let I;
|
|
8846
8846
|
switch (g.code) {
|
|
8847
8847
|
case e.invalid_type:
|
|
@@ -8897,11 +8897,11 @@ const Bg = (g, A) => {
|
|
|
8897
8897
|
}
|
|
8898
8898
|
return { message: I };
|
|
8899
8899
|
};
|
|
8900
|
-
let
|
|
8901
|
-
function
|
|
8902
|
-
return
|
|
8900
|
+
let ZE = Cg;
|
|
8901
|
+
function PE() {
|
|
8902
|
+
return ZE;
|
|
8903
8903
|
}
|
|
8904
|
-
const
|
|
8904
|
+
const OE = (g) => {
|
|
8905
8905
|
const { data: A, path: I, errorMaps: B, issueData: C } = g, Q = [...I, ...C.path || []], E = {
|
|
8906
8906
|
...C,
|
|
8907
8907
|
path: Q
|
|
@@ -8923,7 +8923,7 @@ const ZE = (g) => {
|
|
|
8923
8923
|
};
|
|
8924
8924
|
};
|
|
8925
8925
|
function w(g, A) {
|
|
8926
|
-
const I =
|
|
8926
|
+
const I = PE(), B = OE({
|
|
8927
8927
|
issueData: A,
|
|
8928
8928
|
data: g.data,
|
|
8929
8929
|
path: g.path,
|
|
@@ -8934,7 +8934,7 @@ function w(g, A) {
|
|
|
8934
8934
|
// then schema-bound map if available
|
|
8935
8935
|
I,
|
|
8936
8936
|
// then global override map
|
|
8937
|
-
I ===
|
|
8937
|
+
I === Cg ? void 0 : Cg
|
|
8938
8938
|
// then global default map
|
|
8939
8939
|
].filter((C) => !!C)
|
|
8940
8940
|
});
|
|
@@ -8983,7 +8983,7 @@ class gA {
|
|
|
8983
8983
|
}
|
|
8984
8984
|
const Y = Object.freeze({
|
|
8985
8985
|
status: "aborted"
|
|
8986
|
-
}),
|
|
8986
|
+
}), ZA = (g) => ({ status: "dirty", value: g }), QA = (g) => ({ status: "valid", value: g }), NB = (g) => g.status === "aborted", cB = (g) => g.status === "dirty", KA = (g) => g.status === "valid", SI = (g) => typeof Promise < "u" && g instanceof Promise;
|
|
8987
8987
|
var N;
|
|
8988
8988
|
(function(g) {
|
|
8989
8989
|
g.errToObj = (A) => typeof A == "string" ? { message: A } : A || {}, g.toString = (A) => typeof A == "string" ? A : A?.message;
|
|
@@ -8996,7 +8996,7 @@ class wA {
|
|
|
8996
8996
|
return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
8997
8997
|
}
|
|
8998
8998
|
}
|
|
8999
|
-
const
|
|
8999
|
+
const UB = (g, A) => {
|
|
9000
9000
|
if (KA(A))
|
|
9001
9001
|
return { success: !0, data: A.value };
|
|
9002
9002
|
if (!g.common.issues.length)
|
|
@@ -9081,7 +9081,7 @@ class q {
|
|
|
9081
9081
|
data: A,
|
|
9082
9082
|
parsedType: yA(A)
|
|
9083
9083
|
}, C = this._parseSync({ data: A, path: B.path, parent: B });
|
|
9084
|
-
return
|
|
9084
|
+
return UB(B, C);
|
|
9085
9085
|
}
|
|
9086
9086
|
"~validate"(A) {
|
|
9087
9087
|
const I = {
|
|
@@ -9134,7 +9134,7 @@ class q {
|
|
|
9134
9134
|
data: A,
|
|
9135
9135
|
parsedType: yA(A)
|
|
9136
9136
|
}, C = this._parse({ data: A, path: B.path, parent: B }), Q = await (SI(C) ? C : Promise.resolve(C));
|
|
9137
|
-
return
|
|
9137
|
+
return UB(B, Q);
|
|
9138
9138
|
}
|
|
9139
9139
|
refine(A, I) {
|
|
9140
9140
|
const B = (C) => typeof I == "string" || typeof I > "u" ? { message: I } : typeof I == "function" ? I(C) : I;
|
|
@@ -9197,7 +9197,7 @@ class q {
|
|
|
9197
9197
|
}
|
|
9198
9198
|
default(A) {
|
|
9199
9199
|
const I = typeof A == "function" ? A : () => A;
|
|
9200
|
-
return new
|
|
9200
|
+
return new ag({
|
|
9201
9201
|
...K(this._def),
|
|
9202
9202
|
innerType: this,
|
|
9203
9203
|
defaultValue: I,
|
|
@@ -9205,7 +9205,7 @@ class q {
|
|
|
9205
9205
|
});
|
|
9206
9206
|
}
|
|
9207
9207
|
brand() {
|
|
9208
|
-
return new
|
|
9208
|
+
return new ei({
|
|
9209
9209
|
typeName: M.ZodBranded,
|
|
9210
9210
|
type: this,
|
|
9211
9211
|
...K(this._def)
|
|
@@ -9213,7 +9213,7 @@ class q {
|
|
|
9213
9213
|
}
|
|
9214
9214
|
catch(A) {
|
|
9215
9215
|
const I = typeof A == "function" ? A : () => A;
|
|
9216
|
-
return new
|
|
9216
|
+
return new Dg({
|
|
9217
9217
|
...K(this._def),
|
|
9218
9218
|
innerType: this,
|
|
9219
9219
|
catchValue: I,
|
|
@@ -9231,7 +9231,7 @@ class q {
|
|
|
9231
9231
|
return qg.create(this, A);
|
|
9232
9232
|
}
|
|
9233
9233
|
readonly() {
|
|
9234
|
-
return
|
|
9234
|
+
return sg.create(this);
|
|
9235
9235
|
}
|
|
9236
9236
|
isOptional() {
|
|
9237
9237
|
return this.safeParse(void 0).success;
|
|
@@ -9240,28 +9240,28 @@ class q {
|
|
|
9240
9240
|
return this.safeParse(null).success;
|
|
9241
9241
|
}
|
|
9242
9242
|
}
|
|
9243
|
-
const
|
|
9244
|
-
let
|
|
9245
|
-
const
|
|
9246
|
-
function
|
|
9243
|
+
const VE = /^c[^\s-]{8,}$/i, vE = /^[0-9a-z]+$/, XE = /^[0-9A-HJKMNP-TV-Z]{26}$/i, jE = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, zE = /^[a-z0-9_-]{21}$/i, _E = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, $E = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Ai = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ii = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
9244
|
+
let ZI;
|
|
9245
|
+
const gi = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Bi = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Ci = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Qi = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Ei = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, ii = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, oC = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", oi = new RegExp(`^${oC}$`);
|
|
9246
|
+
function aC(g) {
|
|
9247
9247
|
let A = "[0-5]\\d";
|
|
9248
9248
|
g.precision ? A = `${A}\\.\\d{${g.precision}}` : g.precision == null && (A = `${A}(\\.\\d+)?`);
|
|
9249
9249
|
const I = g.precision ? "+" : "?";
|
|
9250
9250
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${A})${I}`;
|
|
9251
9251
|
}
|
|
9252
|
-
function
|
|
9253
|
-
return new RegExp(`^${
|
|
9252
|
+
function ai(g) {
|
|
9253
|
+
return new RegExp(`^${aC(g)}$`);
|
|
9254
9254
|
}
|
|
9255
|
-
function
|
|
9256
|
-
let A = `${
|
|
9255
|
+
function Di(g) {
|
|
9256
|
+
let A = `${oC}T${aC(g)}`;
|
|
9257
9257
|
const I = [];
|
|
9258
9258
|
return I.push(g.local ? "Z?" : "Z"), g.offset && I.push("([+-]\\d{2}:?\\d{2})"), A = `${A}(${I.join("|")})`, new RegExp(`^${A}$`);
|
|
9259
9259
|
}
|
|
9260
|
-
function
|
|
9261
|
-
return !!((A === "v4" || !A) &&
|
|
9260
|
+
function si(g, A) {
|
|
9261
|
+
return !!((A === "v4" || !A) && gi.test(g) || (A === "v6" || !A) && Ci.test(g));
|
|
9262
9262
|
}
|
|
9263
|
-
function
|
|
9264
|
-
if (!
|
|
9263
|
+
function hi(g, A) {
|
|
9264
|
+
if (!_E.test(g))
|
|
9265
9265
|
return !1;
|
|
9266
9266
|
try {
|
|
9267
9267
|
const [I] = g.split(".");
|
|
@@ -9273,8 +9273,8 @@ function Di(g, A) {
|
|
|
9273
9273
|
return !1;
|
|
9274
9274
|
}
|
|
9275
9275
|
}
|
|
9276
|
-
function
|
|
9277
|
-
return !!((A === "v4" || !A) &&
|
|
9276
|
+
function ti(g, A) {
|
|
9277
|
+
return !!((A === "v4" || !A) && Bi.test(g) || (A === "v6" || !A) && Qi.test(g));
|
|
9278
9278
|
}
|
|
9279
9279
|
class eA extends q {
|
|
9280
9280
|
_parse(A) {
|
|
@@ -9325,43 +9325,43 @@ class eA extends q {
|
|
|
9325
9325
|
message: Q.message
|
|
9326
9326
|
}), B.dirty());
|
|
9327
9327
|
} else if (Q.kind === "email")
|
|
9328
|
-
|
|
9328
|
+
Ai.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9329
9329
|
validation: "email",
|
|
9330
9330
|
code: e.invalid_string,
|
|
9331
9331
|
message: Q.message
|
|
9332
9332
|
}), B.dirty());
|
|
9333
9333
|
else if (Q.kind === "emoji")
|
|
9334
|
-
|
|
9334
|
+
ZI || (ZI = new RegExp(Ii, "u")), ZI.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9335
9335
|
validation: "emoji",
|
|
9336
9336
|
code: e.invalid_string,
|
|
9337
9337
|
message: Q.message
|
|
9338
9338
|
}), B.dirty());
|
|
9339
9339
|
else if (Q.kind === "uuid")
|
|
9340
|
-
|
|
9340
|
+
jE.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9341
9341
|
validation: "uuid",
|
|
9342
9342
|
code: e.invalid_string,
|
|
9343
9343
|
message: Q.message
|
|
9344
9344
|
}), B.dirty());
|
|
9345
9345
|
else if (Q.kind === "nanoid")
|
|
9346
|
-
|
|
9346
|
+
zE.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9347
9347
|
validation: "nanoid",
|
|
9348
9348
|
code: e.invalid_string,
|
|
9349
9349
|
message: Q.message
|
|
9350
9350
|
}), B.dirty());
|
|
9351
9351
|
else if (Q.kind === "cuid")
|
|
9352
|
-
|
|
9352
|
+
VE.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9353
9353
|
validation: "cuid",
|
|
9354
9354
|
code: e.invalid_string,
|
|
9355
9355
|
message: Q.message
|
|
9356
9356
|
}), B.dirty());
|
|
9357
9357
|
else if (Q.kind === "cuid2")
|
|
9358
|
-
|
|
9358
|
+
vE.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9359
9359
|
validation: "cuid2",
|
|
9360
9360
|
code: e.invalid_string,
|
|
9361
9361
|
message: Q.message
|
|
9362
9362
|
}), B.dirty());
|
|
9363
9363
|
else if (Q.kind === "ulid")
|
|
9364
|
-
|
|
9364
|
+
XE.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9365
9365
|
validation: "ulid",
|
|
9366
9366
|
code: e.invalid_string,
|
|
9367
9367
|
message: Q.message
|
|
@@ -9392,39 +9392,39 @@ class eA extends q {
|
|
|
9392
9392
|
code: e.invalid_string,
|
|
9393
9393
|
validation: { endsWith: Q.value },
|
|
9394
9394
|
message: Q.message
|
|
9395
|
-
}), B.dirty()) : Q.kind === "datetime" ?
|
|
9395
|
+
}), B.dirty()) : Q.kind === "datetime" ? Di(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9396
9396
|
code: e.invalid_string,
|
|
9397
9397
|
validation: "datetime",
|
|
9398
9398
|
message: Q.message
|
|
9399
|
-
}), B.dirty()) : Q.kind === "date" ?
|
|
9399
|
+
}), B.dirty()) : Q.kind === "date" ? oi.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9400
9400
|
code: e.invalid_string,
|
|
9401
9401
|
validation: "date",
|
|
9402
9402
|
message: Q.message
|
|
9403
|
-
}), B.dirty()) : Q.kind === "time" ?
|
|
9403
|
+
}), B.dirty()) : Q.kind === "time" ? ai(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9404
9404
|
code: e.invalid_string,
|
|
9405
9405
|
validation: "time",
|
|
9406
9406
|
message: Q.message
|
|
9407
|
-
}), B.dirty()) : Q.kind === "duration" ?
|
|
9407
|
+
}), B.dirty()) : Q.kind === "duration" ? $E.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9408
9408
|
validation: "duration",
|
|
9409
9409
|
code: e.invalid_string,
|
|
9410
9410
|
message: Q.message
|
|
9411
|
-
}), B.dirty()) : Q.kind === "ip" ?
|
|
9411
|
+
}), B.dirty()) : Q.kind === "ip" ? si(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9412
9412
|
validation: "ip",
|
|
9413
9413
|
code: e.invalid_string,
|
|
9414
9414
|
message: Q.message
|
|
9415
|
-
}), B.dirty()) : Q.kind === "jwt" ?
|
|
9415
|
+
}), B.dirty()) : Q.kind === "jwt" ? hi(A.data, Q.alg) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9416
9416
|
validation: "jwt",
|
|
9417
9417
|
code: e.invalid_string,
|
|
9418
9418
|
message: Q.message
|
|
9419
|
-
}), B.dirty()) : Q.kind === "cidr" ?
|
|
9419
|
+
}), B.dirty()) : Q.kind === "cidr" ? ti(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9420
9420
|
validation: "cidr",
|
|
9421
9421
|
code: e.invalid_string,
|
|
9422
9422
|
message: Q.message
|
|
9423
|
-
}), B.dirty()) : Q.kind === "base64" ?
|
|
9423
|
+
}), B.dirty()) : Q.kind === "base64" ? Ei.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9424
9424
|
validation: "base64",
|
|
9425
9425
|
code: e.invalid_string,
|
|
9426
9426
|
message: Q.message
|
|
9427
|
-
}), B.dirty()) : Q.kind === "base64url" ?
|
|
9427
|
+
}), B.dirty()) : Q.kind === "base64url" ? ii.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9428
9428
|
validation: "base64url",
|
|
9429
9429
|
code: e.invalid_string,
|
|
9430
9430
|
message: Q.message
|
|
@@ -9659,7 +9659,7 @@ eA.create = (g) => new eA({
|
|
|
9659
9659
|
coerce: g?.coerce ?? !1,
|
|
9660
9660
|
...K(g)
|
|
9661
9661
|
});
|
|
9662
|
-
function
|
|
9662
|
+
function yi(g, A) {
|
|
9663
9663
|
const I = (g.toString().split(".")[1] || "").length, B = (A.toString().split(".")[1] || "").length, C = I > B ? I : B, Q = Number.parseInt(g.toFixed(C).replace(".", "")), E = Number.parseInt(A.toFixed(C).replace(".", ""));
|
|
9664
9664
|
return Q % E / 10 ** C;
|
|
9665
9665
|
}
|
|
@@ -9698,7 +9698,7 @@ class HA extends q {
|
|
|
9698
9698
|
inclusive: Q.inclusive,
|
|
9699
9699
|
exact: !1,
|
|
9700
9700
|
message: Q.message
|
|
9701
|
-
}), C.dirty()) : Q.kind === "multipleOf" ?
|
|
9701
|
+
}), C.dirty()) : Q.kind === "multipleOf" ? yi(A.data, Q.value) !== 0 && (B = this._getOrReturnCtx(A, B), w(B, {
|
|
9702
9702
|
code: e.not_multiple_of,
|
|
9703
9703
|
multipleOf: Q.value,
|
|
9704
9704
|
message: Q.message
|
|
@@ -9835,7 +9835,7 @@ HA.create = (g) => new HA({
|
|
|
9835
9835
|
coerce: g?.coerce || !1,
|
|
9836
9836
|
...K(g)
|
|
9837
9837
|
});
|
|
9838
|
-
class
|
|
9838
|
+
class XA extends q {
|
|
9839
9839
|
constructor() {
|
|
9840
9840
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
9841
9841
|
}
|
|
@@ -9891,7 +9891,7 @@ class jA extends q {
|
|
|
9891
9891
|
return this.setLimit("max", A, !1, N.toString(I));
|
|
9892
9892
|
}
|
|
9893
9893
|
setLimit(A, I, B, C) {
|
|
9894
|
-
return new
|
|
9894
|
+
return new XA({
|
|
9895
9895
|
...this._def,
|
|
9896
9896
|
checks: [
|
|
9897
9897
|
...this._def.checks,
|
|
@@ -9905,7 +9905,7 @@ class jA extends q {
|
|
|
9905
9905
|
});
|
|
9906
9906
|
}
|
|
9907
9907
|
_addCheck(A) {
|
|
9908
|
-
return new
|
|
9908
|
+
return new XA({
|
|
9909
9909
|
...this._def,
|
|
9910
9910
|
checks: [...this._def.checks, A]
|
|
9911
9911
|
});
|
|
@@ -9962,13 +9962,13 @@ class jA extends q {
|
|
|
9962
9962
|
return A;
|
|
9963
9963
|
}
|
|
9964
9964
|
}
|
|
9965
|
-
|
|
9965
|
+
XA.create = (g) => new XA({
|
|
9966
9966
|
checks: [],
|
|
9967
9967
|
typeName: M.ZodBigInt,
|
|
9968
9968
|
coerce: g?.coerce ?? !1,
|
|
9969
9969
|
...K(g)
|
|
9970
9970
|
});
|
|
9971
|
-
class
|
|
9971
|
+
class Qg extends q {
|
|
9972
9972
|
_parse(A) {
|
|
9973
9973
|
if (this._def.coerce && (A.data = !!A.data), this._getType(A) !== R.boolean) {
|
|
9974
9974
|
const B = this._getOrReturnCtx(A);
|
|
@@ -9981,7 +9981,7 @@ class Cg extends q {
|
|
|
9981
9981
|
return QA(A.data);
|
|
9982
9982
|
}
|
|
9983
9983
|
}
|
|
9984
|
-
|
|
9984
|
+
Qg.create = (g) => new Qg({
|
|
9985
9985
|
typeName: M.ZodBoolean,
|
|
9986
9986
|
coerce: g?.coerce || !1,
|
|
9987
9987
|
...K(g)
|
|
@@ -10064,7 +10064,7 @@ RI.create = (g) => new RI({
|
|
|
10064
10064
|
typeName: M.ZodDate,
|
|
10065
10065
|
...K(g)
|
|
10066
10066
|
});
|
|
10067
|
-
class
|
|
10067
|
+
class kB extends q {
|
|
10068
10068
|
_parse(A) {
|
|
10069
10069
|
if (this._getType(A) !== R.symbol) {
|
|
10070
10070
|
const B = this._getOrReturnCtx(A);
|
|
@@ -10077,11 +10077,11 @@ class UB extends q {
|
|
|
10077
10077
|
return QA(A.data);
|
|
10078
10078
|
}
|
|
10079
10079
|
}
|
|
10080
|
-
|
|
10080
|
+
kB.create = (g) => new kB({
|
|
10081
10081
|
typeName: M.ZodSymbol,
|
|
10082
10082
|
...K(g)
|
|
10083
10083
|
});
|
|
10084
|
-
class
|
|
10084
|
+
class LB extends q {
|
|
10085
10085
|
_parse(A) {
|
|
10086
10086
|
if (this._getType(A) !== R.undefined) {
|
|
10087
10087
|
const B = this._getOrReturnCtx(A);
|
|
@@ -10094,11 +10094,11 @@ class kB extends q {
|
|
|
10094
10094
|
return QA(A.data);
|
|
10095
10095
|
}
|
|
10096
10096
|
}
|
|
10097
|
-
|
|
10097
|
+
LB.create = (g) => new LB({
|
|
10098
10098
|
typeName: M.ZodUndefined,
|
|
10099
10099
|
...K(g)
|
|
10100
10100
|
});
|
|
10101
|
-
class
|
|
10101
|
+
class JB extends q {
|
|
10102
10102
|
_parse(A) {
|
|
10103
10103
|
if (this._getType(A) !== R.null) {
|
|
10104
10104
|
const B = this._getOrReturnCtx(A);
|
|
@@ -10111,11 +10111,11 @@ class LB extends q {
|
|
|
10111
10111
|
return QA(A.data);
|
|
10112
10112
|
}
|
|
10113
10113
|
}
|
|
10114
|
-
|
|
10114
|
+
JB.create = (g) => new JB({
|
|
10115
10115
|
typeName: M.ZodNull,
|
|
10116
10116
|
...K(g)
|
|
10117
10117
|
});
|
|
10118
|
-
class
|
|
10118
|
+
class Eg extends q {
|
|
10119
10119
|
constructor() {
|
|
10120
10120
|
super(...arguments), this._any = !0;
|
|
10121
10121
|
}
|
|
@@ -10123,11 +10123,11 @@ class Qg extends q {
|
|
|
10123
10123
|
return QA(A.data);
|
|
10124
10124
|
}
|
|
10125
10125
|
}
|
|
10126
|
-
|
|
10126
|
+
Eg.create = (g) => new Eg({
|
|
10127
10127
|
typeName: M.ZodAny,
|
|
10128
10128
|
...K(g)
|
|
10129
10129
|
});
|
|
10130
|
-
class
|
|
10130
|
+
class YB extends q {
|
|
10131
10131
|
constructor() {
|
|
10132
10132
|
super(...arguments), this._unknown = !0;
|
|
10133
10133
|
}
|
|
@@ -10135,7 +10135,7 @@ class JB extends q {
|
|
|
10135
10135
|
return QA(A.data);
|
|
10136
10136
|
}
|
|
10137
10137
|
}
|
|
10138
|
-
|
|
10138
|
+
YB.create = (g) => new YB({
|
|
10139
10139
|
typeName: M.ZodUnknown,
|
|
10140
10140
|
...K(g)
|
|
10141
10141
|
});
|
|
@@ -10153,7 +10153,7 @@ FA.create = (g) => new FA({
|
|
|
10153
10153
|
typeName: M.ZodNever,
|
|
10154
10154
|
...K(g)
|
|
10155
10155
|
});
|
|
10156
|
-
class
|
|
10156
|
+
class MB extends q {
|
|
10157
10157
|
_parse(A) {
|
|
10158
10158
|
if (this._getType(A) !== R.undefined) {
|
|
10159
10159
|
const B = this._getOrReturnCtx(A);
|
|
@@ -10166,7 +10166,7 @@ class YB extends q {
|
|
|
10166
10166
|
return QA(A.data);
|
|
10167
10167
|
}
|
|
10168
10168
|
}
|
|
10169
|
-
|
|
10169
|
+
MB.create = (g) => new MB({
|
|
10170
10170
|
typeName: M.ZodVoid,
|
|
10171
10171
|
...K(g)
|
|
10172
10172
|
});
|
|
@@ -10522,7 +10522,7 @@ class O extends q {
|
|
|
10522
10522
|
});
|
|
10523
10523
|
}
|
|
10524
10524
|
keyof() {
|
|
10525
|
-
return
|
|
10525
|
+
return DC(l.objectKeys(this.shape));
|
|
10526
10526
|
}
|
|
10527
10527
|
}
|
|
10528
10528
|
O.create = (g, A) => new O({
|
|
@@ -10619,14 +10619,14 @@ NI.create = (g, A) => new NI({
|
|
|
10619
10619
|
typeName: M.ZodUnion,
|
|
10620
10620
|
...K(A)
|
|
10621
10621
|
});
|
|
10622
|
-
function
|
|
10622
|
+
function ig(g, A) {
|
|
10623
10623
|
const I = yA(g), B = yA(A);
|
|
10624
10624
|
if (g === A)
|
|
10625
10625
|
return { valid: !0, data: g };
|
|
10626
10626
|
if (I === R.object && B === R.object) {
|
|
10627
10627
|
const C = l.objectKeys(A), Q = l.objectKeys(g).filter((i) => C.indexOf(i) !== -1), E = { ...g, ...A };
|
|
10628
10628
|
for (const i of Q) {
|
|
10629
|
-
const o =
|
|
10629
|
+
const o = ig(g[i], A[i]);
|
|
10630
10630
|
if (!o.valid)
|
|
10631
10631
|
return { valid: !1 };
|
|
10632
10632
|
E[i] = o.data;
|
|
@@ -10637,7 +10637,7 @@ function Eg(g, A) {
|
|
|
10637
10637
|
return { valid: !1 };
|
|
10638
10638
|
const C = [];
|
|
10639
10639
|
for (let Q = 0; Q < g.length; Q++) {
|
|
10640
|
-
const E = g[Q], i = A[Q], o =
|
|
10640
|
+
const E = g[Q], i = A[Q], o = ig(E, i);
|
|
10641
10641
|
if (!o.valid)
|
|
10642
10642
|
return { valid: !1 };
|
|
10643
10643
|
C.push(o.data);
|
|
@@ -10648,10 +10648,10 @@ function Eg(g, A) {
|
|
|
10648
10648
|
class cI extends q {
|
|
10649
10649
|
_parse(A) {
|
|
10650
10650
|
const { status: I, ctx: B } = this._processInputParams(A), C = (Q, E) => {
|
|
10651
|
-
if (
|
|
10651
|
+
if (NB(Q) || NB(E))
|
|
10652
10652
|
return Y;
|
|
10653
|
-
const i =
|
|
10654
|
-
return i.valid ? ((
|
|
10653
|
+
const i = ig(Q.value, E.value);
|
|
10654
|
+
return i.valid ? ((cB(Q) || cB(E)) && I.dirty(), { status: I.value, value: i.data }) : (w(B, {
|
|
10655
10655
|
code: e.invalid_intersection_types
|
|
10656
10656
|
}), Y);
|
|
10657
10657
|
};
|
|
@@ -10733,7 +10733,7 @@ cA.create = (g, A) => {
|
|
|
10733
10733
|
...K(A)
|
|
10734
10734
|
});
|
|
10735
10735
|
};
|
|
10736
|
-
class
|
|
10736
|
+
class dB extends q {
|
|
10737
10737
|
get keySchema() {
|
|
10738
10738
|
return this._def.keyType;
|
|
10739
10739
|
}
|
|
@@ -10775,13 +10775,13 @@ class MB extends q {
|
|
|
10775
10775
|
}
|
|
10776
10776
|
}
|
|
10777
10777
|
}
|
|
10778
|
-
|
|
10778
|
+
dB.create = (g, A, I) => new dB({
|
|
10779
10779
|
valueType: A,
|
|
10780
10780
|
keyType: g,
|
|
10781
10781
|
typeName: M.ZodMap,
|
|
10782
10782
|
...K(I)
|
|
10783
10783
|
});
|
|
10784
|
-
class
|
|
10784
|
+
class jA extends q {
|
|
10785
10785
|
_parse(A) {
|
|
10786
10786
|
const { status: I, ctx: B } = this._processInputParams(A);
|
|
10787
10787
|
if (B.parsedType !== R.set)
|
|
@@ -10820,13 +10820,13 @@ class zA extends q {
|
|
|
10820
10820
|
return B.common.async ? Promise.all(i).then((o) => E(o)) : E(i);
|
|
10821
10821
|
}
|
|
10822
10822
|
min(A, I) {
|
|
10823
|
-
return new
|
|
10823
|
+
return new jA({
|
|
10824
10824
|
...this._def,
|
|
10825
10825
|
minSize: { value: A, message: N.toString(I) }
|
|
10826
10826
|
});
|
|
10827
10827
|
}
|
|
10828
10828
|
max(A, I) {
|
|
10829
|
-
return new
|
|
10829
|
+
return new jA({
|
|
10830
10830
|
...this._def,
|
|
10831
10831
|
maxSize: { value: A, message: N.toString(I) }
|
|
10832
10832
|
});
|
|
@@ -10838,14 +10838,14 @@ class zA extends q {
|
|
|
10838
10838
|
return this.min(1, A);
|
|
10839
10839
|
}
|
|
10840
10840
|
}
|
|
10841
|
-
|
|
10841
|
+
jA.create = (g, A) => new jA({
|
|
10842
10842
|
valueType: g,
|
|
10843
10843
|
minSize: null,
|
|
10844
10844
|
maxSize: null,
|
|
10845
10845
|
typeName: M.ZodSet,
|
|
10846
10846
|
...K(A)
|
|
10847
10847
|
});
|
|
10848
|
-
class
|
|
10848
|
+
class KB extends q {
|
|
10849
10849
|
get schema() {
|
|
10850
10850
|
return this._def.getter();
|
|
10851
10851
|
}
|
|
@@ -10854,12 +10854,12 @@ class dB extends q {
|
|
|
10854
10854
|
return this._def.getter()._parse({ data: I.data, path: I.path, parent: I });
|
|
10855
10855
|
}
|
|
10856
10856
|
}
|
|
10857
|
-
|
|
10857
|
+
KB.create = (g, A) => new KB({
|
|
10858
10858
|
getter: g,
|
|
10859
10859
|
typeName: M.ZodLazy,
|
|
10860
10860
|
...K(A)
|
|
10861
10861
|
});
|
|
10862
|
-
class
|
|
10862
|
+
class og extends q {
|
|
10863
10863
|
_parse(A) {
|
|
10864
10864
|
if (A.data !== this._def.value) {
|
|
10865
10865
|
const I = this._getOrReturnCtx(A);
|
|
@@ -10875,12 +10875,12 @@ class ig extends q {
|
|
|
10875
10875
|
return this._def.value;
|
|
10876
10876
|
}
|
|
10877
10877
|
}
|
|
10878
|
-
|
|
10878
|
+
og.create = (g, A) => new og({
|
|
10879
10879
|
value: g,
|
|
10880
10880
|
typeName: M.ZodLiteral,
|
|
10881
10881
|
...K(A)
|
|
10882
10882
|
});
|
|
10883
|
-
function
|
|
10883
|
+
function DC(g, A) {
|
|
10884
10884
|
return new qA({
|
|
10885
10885
|
values: g,
|
|
10886
10886
|
typeName: M.ZodEnum,
|
|
@@ -10941,8 +10941,8 @@ class qA extends q {
|
|
|
10941
10941
|
});
|
|
10942
10942
|
}
|
|
10943
10943
|
}
|
|
10944
|
-
qA.create =
|
|
10945
|
-
class
|
|
10944
|
+
qA.create = DC;
|
|
10945
|
+
class HB extends q {
|
|
10946
10946
|
_parse(A) {
|
|
10947
10947
|
const I = l.getValidEnumValues(this._def.values), B = this._getOrReturnCtx(A);
|
|
10948
10948
|
if (B.parsedType !== R.string && B.parsedType !== R.number) {
|
|
@@ -10967,7 +10967,7 @@ class KB extends q {
|
|
|
10967
10967
|
return this._def.values;
|
|
10968
10968
|
}
|
|
10969
10969
|
}
|
|
10970
|
-
|
|
10970
|
+
HB.create = (g, A) => new HB({
|
|
10971
10971
|
values: g,
|
|
10972
10972
|
typeName: M.ZodNativeEnum,
|
|
10973
10973
|
...K(A)
|
|
@@ -11023,7 +11023,7 @@ class lA extends q {
|
|
|
11023
11023
|
path: B.path,
|
|
11024
11024
|
parent: B
|
|
11025
11025
|
});
|
|
11026
|
-
return o.status === "aborted" ? Y : o.status === "dirty" || I.value === "dirty" ?
|
|
11026
|
+
return o.status === "aborted" ? Y : o.status === "dirty" || I.value === "dirty" ? ZA(o.value) : o;
|
|
11027
11027
|
});
|
|
11028
11028
|
{
|
|
11029
11029
|
if (I.value === "aborted")
|
|
@@ -11033,7 +11033,7 @@ class lA extends q {
|
|
|
11033
11033
|
path: B.path,
|
|
11034
11034
|
parent: B
|
|
11035
11035
|
});
|
|
11036
|
-
return i.status === "aborted" ? Y : i.status === "dirty" || I.value === "dirty" ?
|
|
11036
|
+
return i.status === "aborted" ? Y : i.status === "dirty" || I.value === "dirty" ? ZA(i.value) : i;
|
|
11037
11037
|
}
|
|
11038
11038
|
}
|
|
11039
11039
|
if (C.type === "refinement") {
|
|
@@ -11114,7 +11114,7 @@ fA.create = (g, A) => new fA({
|
|
|
11114
11114
|
typeName: M.ZodNullable,
|
|
11115
11115
|
...K(A)
|
|
11116
11116
|
});
|
|
11117
|
-
class
|
|
11117
|
+
class ag extends q {
|
|
11118
11118
|
_parse(A) {
|
|
11119
11119
|
const { ctx: I } = this._processInputParams(A);
|
|
11120
11120
|
let B = I.data;
|
|
@@ -11128,13 +11128,13 @@ class og extends q {
|
|
|
11128
11128
|
return this._def.innerType;
|
|
11129
11129
|
}
|
|
11130
11130
|
}
|
|
11131
|
-
|
|
11131
|
+
ag.create = (g, A) => new ag({
|
|
11132
11132
|
innerType: g,
|
|
11133
11133
|
typeName: M.ZodDefault,
|
|
11134
11134
|
defaultValue: typeof A.default == "function" ? A.default : () => A.default,
|
|
11135
11135
|
...K(A)
|
|
11136
11136
|
});
|
|
11137
|
-
class
|
|
11137
|
+
class Dg extends q {
|
|
11138
11138
|
_parse(A) {
|
|
11139
11139
|
const { ctx: I } = this._processInputParams(A), B = {
|
|
11140
11140
|
...I,
|
|
@@ -11171,13 +11171,13 @@ class ag extends q {
|
|
|
11171
11171
|
return this._def.innerType;
|
|
11172
11172
|
}
|
|
11173
11173
|
}
|
|
11174
|
-
|
|
11174
|
+
Dg.create = (g, A) => new Dg({
|
|
11175
11175
|
innerType: g,
|
|
11176
11176
|
typeName: M.ZodCatch,
|
|
11177
11177
|
catchValue: typeof A.catch == "function" ? A.catch : () => A.catch,
|
|
11178
11178
|
...K(A)
|
|
11179
11179
|
});
|
|
11180
|
-
class
|
|
11180
|
+
class qB extends q {
|
|
11181
11181
|
_parse(A) {
|
|
11182
11182
|
if (this._getType(A) !== R.nan) {
|
|
11183
11183
|
const B = this._getOrReturnCtx(A);
|
|
@@ -11190,11 +11190,11 @@ class HB extends q {
|
|
|
11190
11190
|
return { status: "valid", value: A.data };
|
|
11191
11191
|
}
|
|
11192
11192
|
}
|
|
11193
|
-
|
|
11193
|
+
qB.create = (g) => new qB({
|
|
11194
11194
|
typeName: M.ZodNaN,
|
|
11195
11195
|
...K(g)
|
|
11196
11196
|
});
|
|
11197
|
-
class
|
|
11197
|
+
class ei extends q {
|
|
11198
11198
|
_parse(A) {
|
|
11199
11199
|
const { ctx: I } = this._processInputParams(A), B = I.data;
|
|
11200
11200
|
return this._def.type._parse({
|
|
@@ -11217,7 +11217,7 @@ class qg extends q {
|
|
|
11217
11217
|
path: B.path,
|
|
11218
11218
|
parent: B
|
|
11219
11219
|
});
|
|
11220
|
-
return Q.status === "aborted" ? Y : Q.status === "dirty" ? (I.dirty(),
|
|
11220
|
+
return Q.status === "aborted" ? Y : Q.status === "dirty" ? (I.dirty(), ZA(Q.value)) : this._def.out._parseAsync({
|
|
11221
11221
|
data: Q.value,
|
|
11222
11222
|
path: B.path,
|
|
11223
11223
|
parent: B
|
|
@@ -11247,7 +11247,7 @@ class qg extends q {
|
|
|
11247
11247
|
});
|
|
11248
11248
|
}
|
|
11249
11249
|
}
|
|
11250
|
-
class
|
|
11250
|
+
class sg extends q {
|
|
11251
11251
|
_parse(A) {
|
|
11252
11252
|
const I = this._def.innerType._parse(A), B = (C) => (KA(C) && (C.value = Object.freeze(C.value)), C);
|
|
11253
11253
|
return SI(I) ? I.then((C) => B(C)) : B(I);
|
|
@@ -11256,7 +11256,7 @@ class Dg extends q {
|
|
|
11256
11256
|
return this._def.innerType;
|
|
11257
11257
|
}
|
|
11258
11258
|
}
|
|
11259
|
-
|
|
11259
|
+
sg.create = (g, A) => new sg({
|
|
11260
11260
|
innerType: g,
|
|
11261
11261
|
typeName: M.ZodReadonly,
|
|
11262
11262
|
...K(A)
|
|
@@ -11265,17 +11265,17 @@ var M;
|
|
|
11265
11265
|
(function(g) {
|
|
11266
11266
|
g.ZodString = "ZodString", g.ZodNumber = "ZodNumber", g.ZodNaN = "ZodNaN", g.ZodBigInt = "ZodBigInt", g.ZodBoolean = "ZodBoolean", g.ZodDate = "ZodDate", g.ZodSymbol = "ZodSymbol", g.ZodUndefined = "ZodUndefined", g.ZodNull = "ZodNull", g.ZodAny = "ZodAny", g.ZodUnknown = "ZodUnknown", g.ZodNever = "ZodNever", g.ZodVoid = "ZodVoid", g.ZodArray = "ZodArray", g.ZodObject = "ZodObject", g.ZodUnion = "ZodUnion", g.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", g.ZodIntersection = "ZodIntersection", g.ZodTuple = "ZodTuple", g.ZodRecord = "ZodRecord", g.ZodMap = "ZodMap", g.ZodSet = "ZodSet", g.ZodFunction = "ZodFunction", g.ZodLazy = "ZodLazy", g.ZodLiteral = "ZodLiteral", g.ZodEnum = "ZodEnum", g.ZodEffects = "ZodEffects", g.ZodNativeEnum = "ZodNativeEnum", g.ZodOptional = "ZodOptional", g.ZodNullable = "ZodNullable", g.ZodDefault = "ZodDefault", g.ZodCatch = "ZodCatch", g.ZodPromise = "ZodPromise", g.ZodBranded = "ZodBranded", g.ZodPipeline = "ZodPipeline", g.ZodReadonly = "ZodReadonly";
|
|
11267
11267
|
})(M || (M = {}));
|
|
11268
|
-
const u = eA.create, H = HA.create,
|
|
11268
|
+
const u = eA.create, H = HA.create, sC = Qg.create, nA = Eg.create;
|
|
11269
11269
|
FA.create;
|
|
11270
11270
|
const m = sA.create, L = O.create;
|
|
11271
11271
|
NI.create;
|
|
11272
11272
|
cI.create;
|
|
11273
11273
|
cA.create;
|
|
11274
|
-
const _ =
|
|
11274
|
+
const _ = og.create, LA = qA.create;
|
|
11275
11275
|
UI.create;
|
|
11276
11276
|
GA.create;
|
|
11277
11277
|
fA.create;
|
|
11278
|
-
const
|
|
11278
|
+
const ni = L({
|
|
11279
11279
|
/**The multiscale datasets for this image*/
|
|
11280
11280
|
multiscales: m(
|
|
11281
11281
|
L({
|
|
@@ -11388,7 +11388,7 @@ const yi = L({
|
|
|
11388
11388
|
label: u().optional(),
|
|
11389
11389
|
family: u().optional(),
|
|
11390
11390
|
color: u(),
|
|
11391
|
-
active:
|
|
11391
|
+
active: sC().optional()
|
|
11392
11392
|
})
|
|
11393
11393
|
),
|
|
11394
11394
|
// The rdefs are not in the JSON schema and are not particularly well
|
|
@@ -11403,7 +11403,7 @@ const yi = L({
|
|
|
11403
11403
|
projection: u().optional()
|
|
11404
11404
|
}).optional()
|
|
11405
11405
|
}).optional()
|
|
11406
|
-
}).describe("JSON from OME-NGFF .zattrs"),
|
|
11406
|
+
}).describe("JSON from OME-NGFF .zattrs"), Gi = L({
|
|
11407
11407
|
plate: L({
|
|
11408
11408
|
/**The acquisitions for this plate*/
|
|
11409
11409
|
acquisitions: m(
|
|
@@ -11462,7 +11462,7 @@ const yi = L({
|
|
|
11462
11462
|
})
|
|
11463
11463
|
).min(1).describe("The wells of the plate")
|
|
11464
11464
|
}).optional()
|
|
11465
|
-
}).describe("JSON from OME-NGFF .zattrs"),
|
|
11465
|
+
}).describe("JSON from OME-NGFF .zattrs"), wi = L({
|
|
11466
11466
|
well: L({
|
|
11467
11467
|
/**The fields of view for this well*/
|
|
11468
11468
|
images: m(
|
|
@@ -11476,7 +11476,7 @@ const yi = L({
|
|
|
11476
11476
|
/**The version of the specification*/
|
|
11477
11477
|
version: _("0.4").describe("The version of the specification").optional()
|
|
11478
11478
|
}).optional()
|
|
11479
|
-
}).describe("JSON from OME-NGFF .zattrs"),
|
|
11479
|
+
}).describe("JSON from OME-NGFF .zattrs"), Fi = L({
|
|
11480
11480
|
/**The versioned OME-Zarr Metadata namespace*/
|
|
11481
11481
|
ome: L({
|
|
11482
11482
|
/**The multiscale datasets for this image*/
|
|
@@ -11588,7 +11588,7 @@ const yi = L({
|
|
|
11588
11588
|
label: u().optional(),
|
|
11589
11589
|
family: u().optional(),
|
|
11590
11590
|
color: u().optional(),
|
|
11591
|
-
active:
|
|
11591
|
+
active: sC().optional()
|
|
11592
11592
|
})
|
|
11593
11593
|
),
|
|
11594
11594
|
// The rdefs are not in the JSON schema and are not particularly well
|
|
@@ -11606,7 +11606,7 @@ const yi = L({
|
|
|
11606
11606
|
/**The version of the OME-Zarr Metadata*/
|
|
11607
11607
|
version: _("0.5").describe("The version of the OME-Zarr Metadata")
|
|
11608
11608
|
}).describe("The versioned OME-Zarr Metadata namespace")
|
|
11609
|
-
}).describe("The zarr.json attributes key"),
|
|
11609
|
+
}).describe("The zarr.json attributes key"), ri = L({
|
|
11610
11610
|
/**The versioned OME-Zarr Metadata namespace*/
|
|
11611
11611
|
ome: L({
|
|
11612
11612
|
plate: L({
|
|
@@ -11668,7 +11668,7 @@ const yi = L({
|
|
|
11668
11668
|
/**The version of the OME-Zarr Metadata*/
|
|
11669
11669
|
version: _("0.5").describe("The version of the OME-Zarr Metadata")
|
|
11670
11670
|
}).describe("The versioned OME-Zarr Metadata namespace")
|
|
11671
|
-
}).describe("The zarr.json attributes key"),
|
|
11671
|
+
}).describe("The zarr.json attributes key"), Si = L({
|
|
11672
11672
|
/**The versioned OME-Zarr Metadata namespace*/
|
|
11673
11673
|
ome: L({
|
|
11674
11674
|
well: L({
|
|
@@ -11687,15 +11687,15 @@ const yi = L({
|
|
|
11687
11687
|
/**The version of the OME-Zarr Metadata*/
|
|
11688
11688
|
version: _("0.5").describe("The version of the OME-Zarr Metadata")
|
|
11689
11689
|
}).describe("The versioned OME-Zarr Metadata namespace")
|
|
11690
|
-
}).describe("JSON from OME-Zarr zarr.json"),
|
|
11691
|
-
function
|
|
11690
|
+
}).describe("JSON from OME-Zarr zarr.json"), Ri = ["0.4", "0.5"], Ni = new Set(Ri);
|
|
11691
|
+
function ci(g) {
|
|
11692
11692
|
if (!("ome" in g) || !(g.ome instanceof Object)) return;
|
|
11693
11693
|
const A = g.ome;
|
|
11694
|
-
if ("version" in A && typeof A.version == "string" &&
|
|
11694
|
+
if ("version" in A && typeof A.version == "string" && Ni.has(A.version))
|
|
11695
11695
|
return A.version;
|
|
11696
11696
|
}
|
|
11697
11697
|
function lg(g) {
|
|
11698
|
-
const A =
|
|
11698
|
+
const A = ci(g);
|
|
11699
11699
|
return A === void 0 ? "0.4" : A;
|
|
11700
11700
|
}
|
|
11701
11701
|
function pA(g) {
|
|
@@ -11707,14 +11707,14 @@ function pA(g) {
|
|
|
11707
11707
|
return "v3";
|
|
11708
11708
|
}
|
|
11709
11709
|
}
|
|
11710
|
-
function
|
|
11710
|
+
function hC(g, A) {
|
|
11711
11711
|
const I = { ...g };
|
|
11712
11712
|
return delete I[A], I;
|
|
11713
11713
|
}
|
|
11714
|
-
async function
|
|
11715
|
-
const I = new
|
|
11714
|
+
async function eo(g, A) {
|
|
11715
|
+
const I = new _A(g), B = new CA(I), C = pA(A), Q = await gI(B, C);
|
|
11716
11716
|
try {
|
|
11717
|
-
return
|
|
11717
|
+
return Ui(Q.attrs);
|
|
11718
11718
|
} catch {
|
|
11719
11719
|
throw Error(
|
|
11720
11720
|
`Failed to parse OME-Zarr plate:
|
|
@@ -11722,58 +11722,58 @@ ${JSON.stringify(Q.attrs)}`
|
|
|
11722
11722
|
);
|
|
11723
11723
|
}
|
|
11724
11724
|
}
|
|
11725
|
-
function
|
|
11725
|
+
function Ui(g) {
|
|
11726
11726
|
switch (lg(g)) {
|
|
11727
11727
|
case "0.5":
|
|
11728
11728
|
return {
|
|
11729
|
-
...
|
|
11729
|
+
...ri.parse(g).ome,
|
|
11730
11730
|
originalVersion: "0.5"
|
|
11731
11731
|
};
|
|
11732
11732
|
case "0.4":
|
|
11733
11733
|
return {
|
|
11734
|
-
...
|
|
11734
|
+
...ki(Gi.parse(g)).ome,
|
|
11735
11735
|
originalVersion: "0.4"
|
|
11736
11736
|
};
|
|
11737
11737
|
}
|
|
11738
11738
|
}
|
|
11739
|
-
function
|
|
11739
|
+
function ki(g) {
|
|
11740
11740
|
if (g.plate === void 0)
|
|
11741
11741
|
throw new Error("Plate metadata is missing in OME-Zarr v0.4 plate");
|
|
11742
11742
|
return {
|
|
11743
11743
|
ome: {
|
|
11744
|
-
plate:
|
|
11744
|
+
plate: hC(g.plate, "version"),
|
|
11745
11745
|
version: "0.5"
|
|
11746
11746
|
}
|
|
11747
11747
|
};
|
|
11748
11748
|
}
|
|
11749
|
-
function
|
|
11749
|
+
function Li(g) {
|
|
11750
11750
|
if (g.well === void 0)
|
|
11751
11751
|
throw new Error("Well metadata is missing in OME-Zarr v0.4 well");
|
|
11752
11752
|
return {
|
|
11753
11753
|
ome: {
|
|
11754
|
-
well:
|
|
11754
|
+
well: hC(g.well, "version"),
|
|
11755
11755
|
version: "0.5"
|
|
11756
11756
|
}
|
|
11757
11757
|
};
|
|
11758
11758
|
}
|
|
11759
|
-
function
|
|
11759
|
+
function Ji(g) {
|
|
11760
11760
|
switch (lg(g)) {
|
|
11761
11761
|
case "0.5":
|
|
11762
11762
|
return {
|
|
11763
|
-
...
|
|
11763
|
+
...Si.parse(g).ome,
|
|
11764
11764
|
originalVersion: "0.5"
|
|
11765
11765
|
};
|
|
11766
11766
|
case "0.4":
|
|
11767
11767
|
return {
|
|
11768
|
-
...
|
|
11768
|
+
...Li(wi.parse(g)).ome,
|
|
11769
11769
|
originalVersion: "0.4"
|
|
11770
11770
|
};
|
|
11771
11771
|
}
|
|
11772
11772
|
}
|
|
11773
|
-
async function
|
|
11774
|
-
const B = g + "/" + A, C = new
|
|
11773
|
+
async function no(g, A, I) {
|
|
11774
|
+
const B = g + "/" + A, C = new _A(B), Q = new CA(C), E = pA(I), i = await gI(Q, E);
|
|
11775
11775
|
try {
|
|
11776
|
-
return
|
|
11776
|
+
return Ji(i.attrs);
|
|
11777
11777
|
} catch {
|
|
11778
11778
|
throw Error(
|
|
11779
11779
|
`Failed to parse OME-Zarr well:
|
|
@@ -11781,15 +11781,15 @@ ${JSON.stringify(i.attrs)}`
|
|
|
11781
11781
|
);
|
|
11782
11782
|
}
|
|
11783
11783
|
}
|
|
11784
|
-
async function
|
|
11785
|
-
const A = pA(g.version), I = await
|
|
11784
|
+
async function Go(g) {
|
|
11785
|
+
const A = pA(g.version), I = await gI(g.location, A);
|
|
11786
11786
|
return fg(I.attrs).omero?.channels ?? [];
|
|
11787
11787
|
}
|
|
11788
|
-
async function
|
|
11789
|
-
const A = pA(g.version), I = await
|
|
11788
|
+
async function wo(g) {
|
|
11789
|
+
const A = pA(g.version), I = await gI(g.location, A);
|
|
11790
11790
|
return fg(I.attrs).omero?.rdefs;
|
|
11791
11791
|
}
|
|
11792
|
-
function
|
|
11792
|
+
function Yi(g) {
|
|
11793
11793
|
return {
|
|
11794
11794
|
ome: {
|
|
11795
11795
|
multiscales: g.multiscales,
|
|
@@ -11798,29 +11798,29 @@ function Li(g) {
|
|
|
11798
11798
|
}
|
|
11799
11799
|
};
|
|
11800
11800
|
}
|
|
11801
|
-
function
|
|
11801
|
+
function Mi(g) {
|
|
11802
11802
|
switch (lg(g)) {
|
|
11803
11803
|
case "0.5":
|
|
11804
11804
|
return {
|
|
11805
|
-
...
|
|
11805
|
+
...Fi.parse(g).ome,
|
|
11806
11806
|
originalVersion: "0.5"
|
|
11807
11807
|
};
|
|
11808
11808
|
case "0.4":
|
|
11809
11809
|
return {
|
|
11810
|
-
...
|
|
11810
|
+
...Yi(ni.parse(g)).ome,
|
|
11811
11811
|
originalVersion: "0.4"
|
|
11812
11812
|
};
|
|
11813
11813
|
}
|
|
11814
11814
|
}
|
|
11815
11815
|
function fg(g) {
|
|
11816
11816
|
try {
|
|
11817
|
-
return
|
|
11817
|
+
return Mi(g);
|
|
11818
11818
|
} catch {
|
|
11819
11819
|
throw Error(`Failed to parse OME-Zarr image:
|
|
11820
11820
|
${JSON.stringify(g)}`);
|
|
11821
11821
|
}
|
|
11822
11822
|
}
|
|
11823
|
-
class
|
|
11823
|
+
class PA {
|
|
11824
11824
|
location;
|
|
11825
11825
|
version;
|
|
11826
11826
|
loader_;
|
|
@@ -11829,7 +11829,7 @@ class OA {
|
|
|
11829
11829
|
}
|
|
11830
11830
|
static async openLoader(A, I) {
|
|
11831
11831
|
let B = pA(I);
|
|
11832
|
-
const C = await
|
|
11832
|
+
const C = await gI(A, B), Q = fg(C.attrs), E = Q.multiscales;
|
|
11833
11833
|
if (E.length !== 1)
|
|
11834
11834
|
throw new Error(
|
|
11835
11835
|
`Exactly one multiscale image is supported. Found ${E.length} images.`
|
|
@@ -11839,15 +11839,15 @@ class OA {
|
|
|
11839
11839
|
throw new Error("No datasets found in the multiscale image.");
|
|
11840
11840
|
B || (B = pA(Q.originalVersion));
|
|
11841
11841
|
const o = i.datasets.map(
|
|
11842
|
-
(h) =>
|
|
11842
|
+
(h) => LE(A, h.path, B)
|
|
11843
11843
|
), a = await Promise.all(
|
|
11844
|
-
o.map((h) =>
|
|
11844
|
+
o.map((h) => kE(h))
|
|
11845
11845
|
), D = a[0].shape, s = i.axes;
|
|
11846
11846
|
if (s.length !== D.length)
|
|
11847
11847
|
throw new Error(
|
|
11848
11848
|
`Mismatch between number of axes (${s.length}) and array shape (${D.length})`
|
|
11849
11849
|
);
|
|
11850
|
-
return new
|
|
11850
|
+
return new uE({ metadata: i, arrays: a, arrayParams: o });
|
|
11851
11851
|
}
|
|
11852
11852
|
getDimensions() {
|
|
11853
11853
|
return this.loader_.getSourceDimensionMap();
|
|
@@ -11865,8 +11865,8 @@ class OA {
|
|
|
11865
11865
|
* @param props.version OME-Zarr version
|
|
11866
11866
|
*/
|
|
11867
11867
|
static async fromHttp(A) {
|
|
11868
|
-
const I = new CA(new
|
|
11869
|
-
return new
|
|
11868
|
+
const I = new CA(new _A(A.url)), B = await PA.openLoader(I, A.version);
|
|
11869
|
+
return new PA({ location: I, version: A.version, loader: B });
|
|
11870
11870
|
}
|
|
11871
11871
|
/**
|
|
11872
11872
|
* Creates and opens an OmeZarrImageSource from a local filesystem directory.
|
|
@@ -11881,11 +11881,11 @@ class OA {
|
|
|
11881
11881
|
const I = new CA(
|
|
11882
11882
|
new Hg(A.directory),
|
|
11883
11883
|
A.path
|
|
11884
|
-
), B = await
|
|
11885
|
-
return new
|
|
11884
|
+
), B = await PA.openLoader(I, A.version);
|
|
11885
|
+
return new PA({ location: I, version: A.version, loader: B });
|
|
11886
11886
|
}
|
|
11887
11887
|
}
|
|
11888
|
-
class
|
|
11888
|
+
class HI {
|
|
11889
11889
|
coverageGroups_ = /* @__PURE__ */ new Map();
|
|
11890
11890
|
state_ = "initialized";
|
|
11891
11891
|
attached_ = !1;
|
|
@@ -11954,7 +11954,7 @@ class KI {
|
|
|
11954
11954
|
return {};
|
|
11955
11955
|
}
|
|
11956
11956
|
}
|
|
11957
|
-
class
|
|
11957
|
+
class di extends mA {
|
|
11958
11958
|
// this creates the geometry for a screen-space projected line
|
|
11959
11959
|
// each point on the input path is split into two vertices
|
|
11960
11960
|
// these are pushed in opposite directions in screen-space to create width
|
|
@@ -12003,7 +12003,7 @@ class Yi extends mA {
|
|
|
12003
12003
|
return I;
|
|
12004
12004
|
}
|
|
12005
12005
|
}
|
|
12006
|
-
class
|
|
12006
|
+
class Ki extends mA {
|
|
12007
12007
|
constructor(A) {
|
|
12008
12008
|
if (super(), A.primitive != "triangles") {
|
|
12009
12009
|
k.warn("WireframeGeometry", "Only indexed geometries are supported");
|
|
@@ -12028,41 +12028,41 @@ class Mi extends mA {
|
|
|
12028
12028
|
this.indexData_ = new Uint32Array(B);
|
|
12029
12029
|
}
|
|
12030
12030
|
}
|
|
12031
|
-
const
|
|
12032
|
-
class
|
|
12031
|
+
const Hi = p(0, 1, 0);
|
|
12032
|
+
class tC {
|
|
12033
12033
|
dirty_ = !0;
|
|
12034
12034
|
matrix_ = $();
|
|
12035
12035
|
rotation_ = sI();
|
|
12036
12036
|
translation_ = d();
|
|
12037
12037
|
scale_ = p(1, 1, 1);
|
|
12038
12038
|
addRotation(A) {
|
|
12039
|
-
|
|
12039
|
+
CQ(this.rotation_, this.rotation_, A), this.dirty_ = !0;
|
|
12040
12040
|
}
|
|
12041
12041
|
setRotation(A) {
|
|
12042
|
-
|
|
12042
|
+
EQ(this.rotation_, A), this.dirty_ = !0;
|
|
12043
12043
|
}
|
|
12044
12044
|
get rotation() {
|
|
12045
|
-
return
|
|
12045
|
+
return QQ(this.rotation_);
|
|
12046
12046
|
}
|
|
12047
12047
|
addTranslation(A) {
|
|
12048
12048
|
JA(this.translation_, this.translation_, A), this.dirty_ = !0;
|
|
12049
12049
|
}
|
|
12050
12050
|
setTranslation(A) {
|
|
12051
|
-
|
|
12051
|
+
jI(this.translation_, A), this.dirty_ = !0;
|
|
12052
12052
|
}
|
|
12053
12053
|
get translation() {
|
|
12054
12054
|
return DA(this.translation_);
|
|
12055
12055
|
}
|
|
12056
12056
|
addScale(A) {
|
|
12057
|
-
|
|
12057
|
+
jC(this.scale_, this.scale_, A), this.dirty_ = !0;
|
|
12058
12058
|
}
|
|
12059
12059
|
setScale(A) {
|
|
12060
|
-
|
|
12060
|
+
jI(this.scale_, A), this.dirty_ = !0;
|
|
12061
12061
|
}
|
|
12062
12062
|
targetTo(A) {
|
|
12063
12063
|
ng(this.translation_, A) && (A = DA(A), A[2] += T);
|
|
12064
|
-
const I =
|
|
12065
|
-
Gg(this.rotation_, B),
|
|
12064
|
+
const I = vC($(), this.translation_, A, Hi), B = TC(PB(), I);
|
|
12065
|
+
Gg(this.rotation_, B), YI(this.rotation_, this.rotation_), this.dirty_ = !0;
|
|
12066
12066
|
}
|
|
12067
12067
|
get scale() {
|
|
12068
12068
|
return DA(this.scale_);
|
|
@@ -12071,10 +12071,10 @@ class Ki {
|
|
|
12071
12071
|
return this.dirty_ && (this.computeMatrix(), this.dirty_ = !1), this.matrix_;
|
|
12072
12072
|
}
|
|
12073
12073
|
get inverse() {
|
|
12074
|
-
return
|
|
12074
|
+
return JI($(), this.matrix);
|
|
12075
12075
|
}
|
|
12076
12076
|
computeMatrix() {
|
|
12077
|
-
|
|
12077
|
+
bC(
|
|
12078
12078
|
this.matrix_,
|
|
12079
12079
|
this.rotation_,
|
|
12080
12080
|
this.translation_,
|
|
@@ -12150,13 +12150,13 @@ class x {
|
|
|
12150
12150
|
return I.length === 1 ? "0" + I : I;
|
|
12151
12151
|
}
|
|
12152
12152
|
}
|
|
12153
|
-
class
|
|
12153
|
+
class BI extends LI {
|
|
12154
12154
|
wireframeEnabled = !1;
|
|
12155
12155
|
wireframeColor = x.WHITE;
|
|
12156
12156
|
depthTest = !0;
|
|
12157
12157
|
textures_ = [];
|
|
12158
12158
|
staleTextures_ = [];
|
|
12159
|
-
transform_ = new
|
|
12159
|
+
transform_ = new tC();
|
|
12160
12160
|
geometry_ = new mA();
|
|
12161
12161
|
wireframeGeometry_ = null;
|
|
12162
12162
|
programName_ = null;
|
|
@@ -12178,7 +12178,7 @@ class xA extends hg {
|
|
|
12178
12178
|
return this.geometry_;
|
|
12179
12179
|
}
|
|
12180
12180
|
get wireframeGeometry() {
|
|
12181
|
-
return this.wireframeGeometry_ ??= new
|
|
12181
|
+
return this.wireframeGeometry_ ??= new Ki(this.geometry), this.wireframeGeometry_;
|
|
12182
12182
|
}
|
|
12183
12183
|
get textures() {
|
|
12184
12184
|
return this.textures_;
|
|
@@ -12213,7 +12213,7 @@ class xA extends hg {
|
|
|
12213
12213
|
return {};
|
|
12214
12214
|
}
|
|
12215
12215
|
}
|
|
12216
|
-
class
|
|
12216
|
+
class qi extends BI {
|
|
12217
12217
|
color_;
|
|
12218
12218
|
width_;
|
|
12219
12219
|
constructor({ geometry: A, color: I, width: B }) {
|
|
@@ -12241,25 +12241,25 @@ class Hi extends xA {
|
|
|
12241
12241
|
};
|
|
12242
12242
|
}
|
|
12243
12243
|
}
|
|
12244
|
-
class
|
|
12244
|
+
class Fo extends HI {
|
|
12245
12245
|
type = "AxesLayer";
|
|
12246
12246
|
constructor(A) {
|
|
12247
12247
|
super();
|
|
12248
12248
|
const { length: I, width: B } = A;
|
|
12249
12249
|
this.addObject(
|
|
12250
|
-
|
|
12250
|
+
PI({
|
|
12251
12251
|
end: [I, 0, 0],
|
|
12252
12252
|
width: B,
|
|
12253
12253
|
color: [1, 0, 0]
|
|
12254
12254
|
})
|
|
12255
12255
|
), this.addObject(
|
|
12256
|
-
|
|
12256
|
+
PI({
|
|
12257
12257
|
end: [0, I, 0],
|
|
12258
12258
|
width: B,
|
|
12259
12259
|
color: [0, 1, 0]
|
|
12260
12260
|
})
|
|
12261
12261
|
), this.addObject(
|
|
12262
|
-
|
|
12262
|
+
PI({
|
|
12263
12263
|
end: [0, 0, I],
|
|
12264
12264
|
width: B,
|
|
12265
12265
|
color: [0, 0, 1]
|
|
@@ -12269,17 +12269,110 @@ class wo extends KI {
|
|
|
12269
12269
|
update() {
|
|
12270
12270
|
}
|
|
12271
12271
|
}
|
|
12272
|
-
function
|
|
12273
|
-
const { end: A, width: I, color: B } = g, C = new
|
|
12274
|
-
return new
|
|
12272
|
+
function PI(g) {
|
|
12273
|
+
const { end: A, width: I, color: B } = g, C = new di([[0, 0, 0], A]);
|
|
12274
|
+
return new qi({
|
|
12275
12275
|
geometry: C,
|
|
12276
12276
|
color: B,
|
|
12277
12277
|
width: I
|
|
12278
12278
|
});
|
|
12279
12279
|
}
|
|
12280
|
-
const
|
|
12281
|
-
|
|
12282
|
-
|
|
12280
|
+
const yC = [
|
|
12281
|
+
"fallbackVisible",
|
|
12282
|
+
"prefetchTime",
|
|
12283
|
+
"visibleCurrent",
|
|
12284
|
+
"fallbackBackground",
|
|
12285
|
+
"prefetchSpace"
|
|
12286
|
+
];
|
|
12287
|
+
function pg(g) {
|
|
12288
|
+
li(g);
|
|
12289
|
+
const A = {
|
|
12290
|
+
x: g.prefetch.x,
|
|
12291
|
+
y: g.prefetch.y,
|
|
12292
|
+
z: g.prefetch.z ?? 0,
|
|
12293
|
+
t: g.prefetch.t ?? 0
|
|
12294
|
+
}, I = Object.freeze(
|
|
12295
|
+
yC.reduce(
|
|
12296
|
+
(Q, E) => {
|
|
12297
|
+
const i = g.priorityOrder.indexOf(E);
|
|
12298
|
+
return Q[E] = i, Q;
|
|
12299
|
+
},
|
|
12300
|
+
{}
|
|
12301
|
+
)
|
|
12302
|
+
), B = {
|
|
12303
|
+
min: g.lod?.min ?? 0,
|
|
12304
|
+
max: g.lod?.max ?? Number.MAX_SAFE_INTEGER,
|
|
12305
|
+
bias: g.lod?.bias ?? 0.5
|
|
12306
|
+
}, C = {
|
|
12307
|
+
profile: g.profile ?? "custom",
|
|
12308
|
+
prefetch: A,
|
|
12309
|
+
priorityOrder: Object.freeze([...g.priorityOrder]),
|
|
12310
|
+
priorityMap: I,
|
|
12311
|
+
lod: B
|
|
12312
|
+
};
|
|
12313
|
+
return Object.freeze(C);
|
|
12314
|
+
}
|
|
12315
|
+
function mg(g = {}) {
|
|
12316
|
+
return pg(ug({
|
|
12317
|
+
profile: "exploration",
|
|
12318
|
+
prefetch: { x: 1, y: 1, z: 1, t: 0 },
|
|
12319
|
+
priorityOrder: [
|
|
12320
|
+
"fallbackVisible",
|
|
12321
|
+
"visibleCurrent",
|
|
12322
|
+
"prefetchSpace",
|
|
12323
|
+
"prefetchTime",
|
|
12324
|
+
"fallbackBackground"
|
|
12325
|
+
]
|
|
12326
|
+
}, g));
|
|
12327
|
+
}
|
|
12328
|
+
function ro(g = {}) {
|
|
12329
|
+
return pg(ug({
|
|
12330
|
+
profile: "playback",
|
|
12331
|
+
prefetch: { x: 0, y: 0, z: 0, t: 20 },
|
|
12332
|
+
priorityOrder: [
|
|
12333
|
+
"fallbackVisible",
|
|
12334
|
+
"prefetchTime",
|
|
12335
|
+
"visibleCurrent",
|
|
12336
|
+
"fallbackBackground",
|
|
12337
|
+
"prefetchSpace"
|
|
12338
|
+
]
|
|
12339
|
+
}, g));
|
|
12340
|
+
}
|
|
12341
|
+
function So(g = {}) {
|
|
12342
|
+
return pg(ug({
|
|
12343
|
+
profile: "no-prefetch",
|
|
12344
|
+
prefetch: { x: 0, y: 0, z: 0, t: 0 },
|
|
12345
|
+
priorityOrder: [
|
|
12346
|
+
"fallbackVisible",
|
|
12347
|
+
"visibleCurrent",
|
|
12348
|
+
"fallbackBackground",
|
|
12349
|
+
"prefetchSpace",
|
|
12350
|
+
"prefetchTime"
|
|
12351
|
+
]
|
|
12352
|
+
}, g));
|
|
12353
|
+
}
|
|
12354
|
+
function li(g) {
|
|
12355
|
+
for (const [B, C] of Object.entries(g.prefetch))
|
|
12356
|
+
if (C !== void 0 && C < 0)
|
|
12357
|
+
throw new Error(`prefetch.${B} must be a non-negative number`);
|
|
12358
|
+
const A = g.lod;
|
|
12359
|
+
if (A?.min !== void 0 && A?.max !== void 0 && A.min > A.max)
|
|
12360
|
+
throw new Error("lod.min must be <= lod.max");
|
|
12361
|
+
const I = g.priorityOrder;
|
|
12362
|
+
if (I.length !== yC.length || new Set(I).size !== I.length)
|
|
12363
|
+
throw new Error("priorityOrder must include all categories exactly once");
|
|
12364
|
+
}
|
|
12365
|
+
function ug(g, A = {}) {
|
|
12366
|
+
return {
|
|
12367
|
+
profile: A.profile ?? g.profile,
|
|
12368
|
+
prefetch: { ...g.prefetch, ...A.prefetch ?? {} },
|
|
12369
|
+
lod: { ...g.lod, ...A.lod ?? {} },
|
|
12370
|
+
priorityOrder: A.priorityOrder ?? g.priorityOrder
|
|
12371
|
+
};
|
|
12372
|
+
}
|
|
12373
|
+
const lB = 32;
|
|
12374
|
+
function zA(g, { visible: A, color: I, contrastLimits: B, opacity: C }) {
|
|
12375
|
+
return A ??= !0, I = I === void 0 ? x.WHITE : x.from(I), C = C === void 0 ? 1 : hA(C, 0, 1), g !== null ? B = fi(B, g) : B === void 0 && (k.debug(
|
|
12283
12376
|
"Channel",
|
|
12284
12377
|
"No texture provided, defaulting channel contrast limits to [0, 1]."
|
|
12285
12378
|
), B = [0, 1]), {
|
|
@@ -12289,27 +12382,27 @@ function _A(g, { visible: A, color: I, contrastLimits: B, opacity: C }) {
|
|
|
12289
12382
|
opacity: C
|
|
12290
12383
|
};
|
|
12291
12384
|
}
|
|
12292
|
-
function
|
|
12293
|
-
if (A.length >
|
|
12294
|
-
throw new Error(`Maximum number of channels is ${
|
|
12295
|
-
return A.map((I) =>
|
|
12385
|
+
function hg(g, A) {
|
|
12386
|
+
if (A.length > lB)
|
|
12387
|
+
throw new Error(`Maximum number of channels is ${lB}`);
|
|
12388
|
+
return A.map((I) => zA(g, I));
|
|
12296
12389
|
}
|
|
12297
|
-
function
|
|
12390
|
+
function eC(g, A) {
|
|
12298
12391
|
if (g && g.length !== A)
|
|
12299
12392
|
throw new Error(
|
|
12300
12393
|
`channelProps length (${g.length}) must match source channel count (${A}).`
|
|
12301
12394
|
);
|
|
12302
12395
|
}
|
|
12303
|
-
function
|
|
12396
|
+
function fi(g, A) {
|
|
12304
12397
|
if (g === void 0)
|
|
12305
|
-
return
|
|
12398
|
+
return eQ(A);
|
|
12306
12399
|
if (g[1] <= g[0])
|
|
12307
12400
|
throw new Error(
|
|
12308
12401
|
`Contrast limits must be strictly increasing: ${g}.`
|
|
12309
12402
|
);
|
|
12310
12403
|
return g;
|
|
12311
12404
|
}
|
|
12312
|
-
class
|
|
12405
|
+
class nC extends mA {
|
|
12313
12406
|
constructor(A, I, B, C) {
|
|
12314
12407
|
super();
|
|
12315
12408
|
const Q = [], E = [], i = B, o = C, a = i + 1, D = o + 1, s = A / i, h = I / o;
|
|
@@ -12340,20 +12433,25 @@ class tC extends mA {
|
|
|
12340
12433
|
});
|
|
12341
12434
|
}
|
|
12342
12435
|
}
|
|
12343
|
-
class
|
|
12436
|
+
class pi extends BI {
|
|
12344
12437
|
channels_;
|
|
12345
12438
|
worldToTexCoord = $();
|
|
12346
|
-
constructor(
|
|
12347
|
-
|
|
12439
|
+
constructor({
|
|
12440
|
+
width: A,
|
|
12441
|
+
height: I,
|
|
12442
|
+
texture: B,
|
|
12443
|
+
channelProps: C = []
|
|
12444
|
+
}) {
|
|
12445
|
+
super(), this.geometry = new nC(A, I, 1, 1), this.setTexture(0, B), this.channels_ = hg(B, C), this.programName = mi(B);
|
|
12348
12446
|
}
|
|
12349
12447
|
get type() {
|
|
12350
12448
|
return "ImageRenderable";
|
|
12351
12449
|
}
|
|
12352
12450
|
setChannelProps(A) {
|
|
12353
|
-
this.channels_ =
|
|
12451
|
+
this.channels_ = hg(this.textures[0], A);
|
|
12354
12452
|
}
|
|
12355
12453
|
setChannelProperty(A, I, B) {
|
|
12356
|
-
const C =
|
|
12454
|
+
const C = zA(this.textures[0], {
|
|
12357
12455
|
...this.channels_[A],
|
|
12358
12456
|
[I]: B
|
|
12359
12457
|
});
|
|
@@ -12363,7 +12461,7 @@ class li extends xA {
|
|
|
12363
12461
|
const A = this.textures[0];
|
|
12364
12462
|
if (!A)
|
|
12365
12463
|
throw new Error("No texture set");
|
|
12366
|
-
const { color: I, contrastLimits: B, opacity: C } = this.channels_[0] ??
|
|
12464
|
+
const { color: I, contrastLimits: B, opacity: C } = this.channels_[0] ?? zA(A, {});
|
|
12367
12465
|
return {
|
|
12368
12466
|
u_imageSampler: 0,
|
|
12369
12467
|
u_color: I.rgb,
|
|
@@ -12374,7 +12472,7 @@ class li extends xA {
|
|
|
12374
12472
|
};
|
|
12375
12473
|
}
|
|
12376
12474
|
}
|
|
12377
|
-
function
|
|
12475
|
+
function mi(g) {
|
|
12378
12476
|
switch (g.dataType) {
|
|
12379
12477
|
case "byte":
|
|
12380
12478
|
case "int":
|
|
@@ -12407,11 +12505,11 @@ class aA {
|
|
|
12407
12505
|
const A = tg(this.normal);
|
|
12408
12506
|
if (A > 0) {
|
|
12409
12507
|
const I = 1 / A;
|
|
12410
|
-
|
|
12508
|
+
VA(this.normal, this.normal, I), this.signedDistance *= I;
|
|
12411
12509
|
}
|
|
12412
12510
|
}
|
|
12413
12511
|
}
|
|
12414
|
-
function
|
|
12512
|
+
function GC(g, A, I, B, C = 3) {
|
|
12415
12513
|
switch (g.type) {
|
|
12416
12514
|
case "pointerdown": {
|
|
12417
12515
|
const Q = g.event;
|
|
@@ -12420,7 +12518,7 @@ function yC(g, A, I, B, C = 3) {
|
|
|
12420
12518
|
case "pointerup": {
|
|
12421
12519
|
if (!A) return A;
|
|
12422
12520
|
const Q = g.event, E = V(Q.clientX, Q.clientY);
|
|
12423
|
-
if (
|
|
12521
|
+
if (iQ(A, E) < C) {
|
|
12424
12522
|
if (!B) return null;
|
|
12425
12523
|
const o = g.worldRay;
|
|
12426
12524
|
return o && I(o).then((a) => {
|
|
@@ -12437,7 +12535,7 @@ function yC(g, A, I, B, C = 3) {
|
|
|
12437
12535
|
return A;
|
|
12438
12536
|
}
|
|
12439
12537
|
}
|
|
12440
|
-
class
|
|
12538
|
+
class Tg {
|
|
12441
12539
|
bins_ = /* @__PURE__ */ new Map();
|
|
12442
12540
|
acquire(A) {
|
|
12443
12541
|
const B = this.bins_.get(A)?.pop();
|
|
@@ -12452,7 +12550,7 @@ class pg {
|
|
|
12452
12550
|
this.bins_.clear();
|
|
12453
12551
|
}
|
|
12454
12552
|
}
|
|
12455
|
-
class
|
|
12553
|
+
class wC extends HI {
|
|
12456
12554
|
type = "ImageLayer";
|
|
12457
12555
|
source_;
|
|
12458
12556
|
sliceCoords_;
|
|
@@ -12462,7 +12560,7 @@ class eC extends KI {
|
|
|
12462
12560
|
onPickValue_;
|
|
12463
12561
|
visibleChunks_ = /* @__PURE__ */ new Map();
|
|
12464
12562
|
orderedChunks_ = [];
|
|
12465
|
-
pool_ = new
|
|
12563
|
+
pool_ = new Tg();
|
|
12466
12564
|
initialChannelProps_;
|
|
12467
12565
|
channelChangeCallbacks_ = [];
|
|
12468
12566
|
policy_;
|
|
@@ -12489,14 +12587,14 @@ class eC extends KI {
|
|
|
12489
12587
|
onPickValue: E,
|
|
12490
12588
|
...i
|
|
12491
12589
|
}) {
|
|
12492
|
-
super({ blendMode: "additive", ...i }), this.setState("initialized"), this.source_ = A, this.policy_ = B, this.sliceCoords_ = I, this.orientation_ = C ?? "XY", this.axes_ = MA(this.orientation_), this.planeRotation_ = dA(this.axes_), this.channelProps_ = Q, this.initialChannelProps_ = Q, this.onPickValue_ = E;
|
|
12590
|
+
super({ blendMode: "additive", ...i }), this.setState("initialized"), this.source_ = A, this.policy_ = B ?? mg(), this.sliceCoords_ = I, this.orientation_ = C ?? "XY", this.axes_ = MA(this.orientation_), this.planeRotation_ = dA(this.axes_), this.channelProps_ = Q, this.initialChannelProps_ = Q, this.onPickValue_ = E;
|
|
12493
12591
|
}
|
|
12494
12592
|
attach(A) {
|
|
12495
12593
|
this.context_ = A, this.chunkStoreView_ = A.chunkManager.addView(
|
|
12496
12594
|
this.source_,
|
|
12497
12595
|
this.policy_,
|
|
12498
12596
|
this.axes_
|
|
12499
|
-
),
|
|
12597
|
+
), eC(
|
|
12500
12598
|
this.channelProps_,
|
|
12501
12599
|
this.chunkStoreView_.channelCount
|
|
12502
12600
|
);
|
|
@@ -12559,10 +12657,10 @@ class eC extends KI {
|
|
|
12559
12657
|
return this.lastPresentationTimeCoord_;
|
|
12560
12658
|
}
|
|
12561
12659
|
isPresentationStale() {
|
|
12562
|
-
return this.lastPresentationTimeStamp_ === void 0 ? !1 : performance.now() - this.lastPresentationTimeStamp_ >
|
|
12660
|
+
return this.lastPresentationTimeStamp_ === void 0 ? !1 : performance.now() - this.lastPresentationTimeStamp_ > wC.STALE_PRESENTATION_MS_;
|
|
12563
12661
|
}
|
|
12564
12662
|
onEvent(A) {
|
|
12565
|
-
this.pointerDownPos_ =
|
|
12663
|
+
this.pointerDownPos_ = GC(
|
|
12566
12664
|
A,
|
|
12567
12665
|
this.pointerDownPos_,
|
|
12568
12666
|
(I) => this.pickAtRay(I),
|
|
@@ -12572,7 +12670,7 @@ class eC extends KI {
|
|
|
12572
12670
|
async pickAtRay(A) {
|
|
12573
12671
|
const I = this.visibleChunks_.values().next();
|
|
12574
12672
|
if (I.done) return null;
|
|
12575
|
-
const B = I.value.transform, C =
|
|
12673
|
+
const B = I.value.transform, C = vB(
|
|
12576
12674
|
d(),
|
|
12577
12675
|
p(0, 0, 1),
|
|
12578
12676
|
B.rotation
|
|
@@ -12597,7 +12695,7 @@ class eC extends KI {
|
|
|
12597
12695
|
set imageSourcePolicy(A) {
|
|
12598
12696
|
this.policy_ !== A && (this.policy_ = A, this.chunkStoreView_ && this.chunkStoreView_.setImageSourcePolicy(
|
|
12599
12697
|
A,
|
|
12600
|
-
|
|
12698
|
+
MI
|
|
12601
12699
|
));
|
|
12602
12700
|
}
|
|
12603
12701
|
getImageForChunk(A, I) {
|
|
@@ -12612,12 +12710,12 @@ class eC extends KI {
|
|
|
12612
12710
|
return this.channelProps_ ? [this.channelProps_[A.chunkIndex.c] ?? {}] : [{}];
|
|
12613
12711
|
}
|
|
12614
12712
|
createImage(A, I) {
|
|
12615
|
-
const B = new
|
|
12616
|
-
A.shape[this.axes_.u],
|
|
12617
|
-
A.shape[this.axes_.v],
|
|
12618
|
-
I,
|
|
12619
|
-
this.getChannelPropsForChunk(A)
|
|
12620
|
-
);
|
|
12713
|
+
const B = new pi({
|
|
12714
|
+
width: A.shape[this.axes_.u],
|
|
12715
|
+
height: A.shape[this.axes_.v],
|
|
12716
|
+
texture: I,
|
|
12717
|
+
channelProps: this.getChannelPropsForChunk(A)
|
|
12718
|
+
});
|
|
12621
12719
|
return this.updateImageChunk(B, A), B;
|
|
12622
12720
|
}
|
|
12623
12721
|
updateSlicePosition(A, I) {
|
|
@@ -12634,7 +12732,7 @@ class eC extends KI {
|
|
|
12634
12732
|
updateImageChunk(A, I) {
|
|
12635
12733
|
this.debugMode_ ? (A.wireframeEnabled = !0, A.wireframeColor = this.wireframeColors_[I.lod % this.wireframeColors_.length]) : A.wireframeEnabled = !1;
|
|
12636
12734
|
const { u: B, v: C } = this.axes_;
|
|
12637
|
-
A.transform.setScale([I.scale[B], I.scale[C], 1]), A.transform.setRotation(this.planeRotation_), this.updateSlicePosition(A, I), A.worldToTexCoord =
|
|
12735
|
+
A.transform.setScale([I.scale[B], I.scale[C], 1]), A.transform.setRotation(this.planeRotation_), this.updateSlicePosition(A, I), A.worldToTexCoord = jB(I, this.axes_);
|
|
12638
12736
|
}
|
|
12639
12737
|
async getValueAtWorld(A) {
|
|
12640
12738
|
const I = this.chunkStoreView_?.currentLOD ?? 0;
|
|
@@ -12702,7 +12800,7 @@ function kI(g, A) {
|
|
|
12702
12800
|
`align${g.rowAlignmentBytes}`
|
|
12703
12801
|
].join(":");
|
|
12704
12802
|
}
|
|
12705
|
-
class
|
|
12803
|
+
class ui extends mA {
|
|
12706
12804
|
constructor(A, I, B, C, Q, E) {
|
|
12707
12805
|
super();
|
|
12708
12806
|
const i = [], o = [], a = Math.floor(C), D = Math.floor(Q), s = Math.floor(E);
|
|
@@ -12749,13 +12847,13 @@ class pi extends mA {
|
|
|
12749
12847
|
}
|
|
12750
12848
|
}
|
|
12751
12849
|
}
|
|
12752
|
-
class
|
|
12850
|
+
class Ti extends BI {
|
|
12753
12851
|
voxelScale = p(1, 1, 1);
|
|
12754
12852
|
channels_;
|
|
12755
12853
|
loadedChannels_ = /* @__PURE__ */ new Set();
|
|
12756
12854
|
channelToTextureIndex_ = /* @__PURE__ */ new Map();
|
|
12757
|
-
constructor() {
|
|
12758
|
-
super(), this.geometry = new
|
|
12855
|
+
constructor({ channelProps: A = [] } = {}) {
|
|
12856
|
+
super(), this.geometry = new ui(1, 1, 1, 1, 1, 1), this.cullFaceMode = "front", this.depthTest = !1, this.channels_ = [], this.setChannelProps(A);
|
|
12759
12857
|
}
|
|
12760
12858
|
get type() {
|
|
12761
12859
|
return "VolumeRenderable";
|
|
@@ -12768,7 +12866,7 @@ class mi extends xA {
|
|
|
12768
12866
|
addChannelTexture(A, I) {
|
|
12769
12867
|
const B = this.textures.length;
|
|
12770
12868
|
this.setTexture(B, I), this.channelToTextureIndex_.set(A, B);
|
|
12771
|
-
const C =
|
|
12869
|
+
const C = xi(I.dataType);
|
|
12772
12870
|
if (this.programName && this.programName !== C)
|
|
12773
12871
|
throw new Error(
|
|
12774
12872
|
`Volume renderable does not support multiple channels with different data types. Existing program: ${this.programName}, new channel data type: ${I.dataType} and program: ${C}`
|
|
@@ -12805,7 +12903,7 @@ class mi extends xA {
|
|
|
12805
12903
|
for (let o = 0; o < i && E.length < 4; o++) {
|
|
12806
12904
|
const a = this.channelToTextureIndex_.get(o);
|
|
12807
12905
|
if (a === void 0 || !this.loadedChannels_.has(o)) continue;
|
|
12808
|
-
const D = this.textures[a], s =
|
|
12906
|
+
const D = this.textures[a], s = zA(D, this.channels_[o] || {});
|
|
12809
12907
|
if (!s.visible) continue;
|
|
12810
12908
|
const h = E.length;
|
|
12811
12909
|
I[h * 3] = s.color.rgb[0], I[h * 3 + 1] = s.color.rgb[1], I[h * 3 + 2] = s.color.rgb[2], E.push(a), B[h] = -s.contrastLimits[0], C[h] = 1 / (s.contrastLimits[1] - s.contrastLimits[0]), A[h] = 1, Q[h] = s.opacity;
|
|
@@ -12838,13 +12936,13 @@ class mi extends xA {
|
|
|
12838
12936
|
return I !== void 0 ? this.textures[I] : null;
|
|
12839
12937
|
}
|
|
12840
12938
|
setChannelProps(A) {
|
|
12841
|
-
this.channels_ =
|
|
12939
|
+
this.channels_ = hg(
|
|
12842
12940
|
this.getAvailableChannelTexture(),
|
|
12843
12941
|
A
|
|
12844
12942
|
);
|
|
12845
12943
|
}
|
|
12846
12944
|
setChannelProperty(A, I, B) {
|
|
12847
|
-
const C =
|
|
12945
|
+
const C = zA(
|
|
12848
12946
|
this.getAvailableChannelTexture(A),
|
|
12849
12947
|
{
|
|
12850
12948
|
...this.channels_[A],
|
|
@@ -12854,7 +12952,7 @@ class mi extends xA {
|
|
|
12854
12952
|
this.channels_[A] = C;
|
|
12855
12953
|
}
|
|
12856
12954
|
}
|
|
12857
|
-
function
|
|
12955
|
+
function xi(g) {
|
|
12858
12956
|
switch (g) {
|
|
12859
12957
|
case "byte":
|
|
12860
12958
|
case "int":
|
|
@@ -12868,22 +12966,22 @@ function ui(g) {
|
|
|
12868
12966
|
return "floatVolume";
|
|
12869
12967
|
}
|
|
12870
12968
|
}
|
|
12871
|
-
function
|
|
12969
|
+
function Wi(g, A) {
|
|
12872
12970
|
const I = A.position, B = d(), C = d();
|
|
12873
12971
|
return g.sort((Q, E) => {
|
|
12874
|
-
JA(B, Q.boundingBox.max, Q.boundingBox.min),
|
|
12875
|
-
const i =
|
|
12972
|
+
JA(B, Q.boundingBox.max, Q.boundingBox.min), VA(B, B, 0.5), JA(C, E.boundingBox.max, E.boundingBox.min), VA(C, C, 0.5);
|
|
12973
|
+
const i = Vg(I, B), o = Vg(I, C);
|
|
12876
12974
|
return i - o;
|
|
12877
12975
|
}), g;
|
|
12878
12976
|
}
|
|
12879
|
-
const
|
|
12880
|
-
class
|
|
12977
|
+
const bi = 2;
|
|
12978
|
+
class Ro extends HI {
|
|
12881
12979
|
type = "VolumeLayer";
|
|
12882
12980
|
source_;
|
|
12883
12981
|
sliceCoords_;
|
|
12884
12982
|
currentVolumes_ = /* @__PURE__ */ new Map();
|
|
12885
12983
|
volumeToPoolKey_ = /* @__PURE__ */ new Map();
|
|
12886
|
-
pool_ = new
|
|
12984
|
+
pool_ = new Tg();
|
|
12887
12985
|
initialChannelProps_;
|
|
12888
12986
|
channelChangeCallbacks_ = [];
|
|
12889
12987
|
policy_;
|
|
@@ -12911,7 +13009,7 @@ class Fo extends KI {
|
|
|
12911
13009
|
set imageSourcePolicy(A) {
|
|
12912
13010
|
this.policy_ !== A && (this.policy_ = A, this.chunkStoreView_ && this.chunkStoreView_.setImageSourcePolicy(
|
|
12913
13011
|
A,
|
|
12914
|
-
|
|
13012
|
+
MI
|
|
12915
13013
|
));
|
|
12916
13014
|
}
|
|
12917
13015
|
setChannelProps(A) {
|
|
@@ -12938,7 +13036,7 @@ class Fo extends KI {
|
|
|
12938
13036
|
this.channelChangeCallbacks_.splice(I, 1);
|
|
12939
13037
|
}
|
|
12940
13038
|
constructor({ source: A, sliceCoords: I, policy: B, channelProps: C }) {
|
|
12941
|
-
super({ blendMode: "premultiplied" }), this.source_ = A, this.sliceCoords_ = I, this.policy_ = B, this.initialChannelProps_ = C, this.channelProps_ = C, this.setState("initialized");
|
|
13039
|
+
super({ blendMode: "premultiplied" }), this.source_ = A, this.sliceCoords_ = I, this.policy_ = B ?? mg(), this.initialChannelProps_ = C, this.channelProps_ = C, this.setState("initialized");
|
|
12942
13040
|
}
|
|
12943
13041
|
getOrCreateVolume(A, I) {
|
|
12944
13042
|
const B = this.currentVolumes_.get(A);
|
|
@@ -12946,7 +13044,7 @@ class Fo extends KI {
|
|
|
12946
13044
|
for (const E of I) B.updateVolumeWithChunk(E);
|
|
12947
13045
|
return B;
|
|
12948
13046
|
}
|
|
12949
|
-
const C =
|
|
13047
|
+
const C = Oi(I[0]), Q = this.pool_.acquire(C) ?? new Ti();
|
|
12950
13048
|
Q.setChannelProps(this.channelProps_ ?? []), this.volumeToPoolKey_.set(Q, C);
|
|
12951
13049
|
for (const E of I) Q.updateVolumeWithChunk(E);
|
|
12952
13050
|
return this.updateVolumeTransform(Q, I[0]), Q;
|
|
@@ -12955,7 +13053,7 @@ class Fo extends KI {
|
|
|
12955
13053
|
this.chunkStoreView_ = A.chunkManager.addView(
|
|
12956
13054
|
this.source_,
|
|
12957
13055
|
this.policy_
|
|
12958
|
-
),
|
|
13056
|
+
), eC(
|
|
12959
13057
|
this.channelProps_,
|
|
12960
13058
|
this.chunkStoreView_.channelCount
|
|
12961
13059
|
);
|
|
@@ -12968,7 +13066,7 @@ class Fo extends KI {
|
|
|
12968
13066
|
updateChunks() {
|
|
12969
13067
|
if (!this.chunkStoreView_) return;
|
|
12970
13068
|
this.state !== "ready" && this.setState("ready");
|
|
12971
|
-
const A = this.chunkStoreView_.getChunksToRender(), I = this.sliceCoords_.t ?? -1, B =
|
|
13069
|
+
const A = this.chunkStoreView_.getChunksToRender(), I = this.sliceCoords_.t ?? -1, B = Pi(A);
|
|
12972
13070
|
if (this.lastLoadedTime_ !== I || B.size !== this.currentVolumes_.size || this.lastNumRenderedChannelChunks_ !== A.length) {
|
|
12973
13071
|
for (const [Q, E] of this.currentVolumes_)
|
|
12974
13072
|
B.has(Q) || (this.releaseAndRemoveVolume(E), this.currentVolumes_.delete(Q));
|
|
@@ -13007,11 +13105,11 @@ class Fo extends KI {
|
|
|
13007
13105
|
A.camera.getViewProjection()
|
|
13008
13106
|
);
|
|
13009
13107
|
const I = A.cameraControls?.isMoving ?? !1;
|
|
13010
|
-
this.interactiveStepSizeScale_ = I ?
|
|
13108
|
+
this.interactiveStepSizeScale_ = I ? bi : 1, this.updateChunks(), this.rebuildObjects(A.camera);
|
|
13011
13109
|
}
|
|
13012
13110
|
rebuildObjects(A) {
|
|
13013
13111
|
const I = Array.from(this.currentVolumes_.values());
|
|
13014
|
-
|
|
13112
|
+
Wi(I, A), this.clearObjects();
|
|
13015
13113
|
for (const B of I)
|
|
13016
13114
|
this.addObject(B);
|
|
13017
13115
|
}
|
|
@@ -13024,27 +13122,27 @@ class Fo extends KI {
|
|
|
13024
13122
|
};
|
|
13025
13123
|
}
|
|
13026
13124
|
}
|
|
13027
|
-
function
|
|
13125
|
+
function Zi(g) {
|
|
13028
13126
|
const { x: A, y: I, z: B, t: C } = g.chunkIndex;
|
|
13029
13127
|
return `${A}:${I}:${B}:${C}`;
|
|
13030
13128
|
}
|
|
13031
|
-
function
|
|
13129
|
+
function Pi(g) {
|
|
13032
13130
|
const A = /* @__PURE__ */ new Map();
|
|
13033
13131
|
for (const I of g) {
|
|
13034
|
-
const B =
|
|
13132
|
+
const B = Zi(I);
|
|
13035
13133
|
let C = A.get(B);
|
|
13036
13134
|
C || (C = [], A.set(B, C)), C.push(I);
|
|
13037
13135
|
}
|
|
13038
13136
|
return A;
|
|
13039
13137
|
}
|
|
13040
|
-
function
|
|
13138
|
+
function Oi(g) {
|
|
13041
13139
|
return [
|
|
13042
13140
|
`lod${g.lod}`,
|
|
13043
13141
|
`shape${g.shape.x}x${g.shape.y}x${g.shape.z}`,
|
|
13044
13142
|
`align${g.rowAlignmentBytes}`
|
|
13045
13143
|
].join(":");
|
|
13046
13144
|
}
|
|
13047
|
-
class
|
|
13145
|
+
class fB extends Fg {
|
|
13048
13146
|
width_;
|
|
13049
13147
|
height_;
|
|
13050
13148
|
constructor(A, I, B) {
|
|
@@ -13060,7 +13158,7 @@ class lB extends Fg {
|
|
|
13060
13158
|
return this.height_;
|
|
13061
13159
|
}
|
|
13062
13160
|
}
|
|
13063
|
-
const
|
|
13161
|
+
const Vi = [
|
|
13064
13162
|
[1, 0.5, 0.5],
|
|
13065
13163
|
[0.5, 1, 0.5],
|
|
13066
13164
|
[0.5, 0.5, 1],
|
|
@@ -13068,7 +13166,7 @@ const Pi = [
|
|
|
13068
13166
|
[1, 0.5, 1],
|
|
13069
13167
|
[1, 1, 0.5]
|
|
13070
13168
|
];
|
|
13071
|
-
function
|
|
13169
|
+
function vi(g) {
|
|
13072
13170
|
return g = g ?? /* @__PURE__ */ new Map(), new Map(
|
|
13073
13171
|
Array.from(g.entries()).map(([A, I]) => [
|
|
13074
13172
|
A,
|
|
@@ -13076,47 +13174,47 @@ function Oi(g) {
|
|
|
13076
13174
|
])
|
|
13077
13175
|
);
|
|
13078
13176
|
}
|
|
13079
|
-
function
|
|
13080
|
-
return g = g ??
|
|
13177
|
+
function Xi(g) {
|
|
13178
|
+
return g = g ?? Vi, g.map(x.from);
|
|
13081
13179
|
}
|
|
13082
|
-
class
|
|
13180
|
+
class pB {
|
|
13083
13181
|
lookupTable;
|
|
13084
13182
|
cycle;
|
|
13085
13183
|
constructor(A = {}) {
|
|
13086
|
-
this.lookupTable =
|
|
13184
|
+
this.lookupTable = vi(A.lookupTable), this.cycle = Xi(A.cycle);
|
|
13087
13185
|
}
|
|
13088
13186
|
}
|
|
13089
|
-
const
|
|
13187
|
+
const FC = /* @__PURE__ */ new Set(["byte", "short", "int"]), ji = /* @__PURE__ */ new Set([
|
|
13090
13188
|
"unsigned_byte",
|
|
13091
13189
|
"unsigned_short",
|
|
13092
13190
|
"unsigned_int"
|
|
13093
13191
|
]);
|
|
13094
|
-
function
|
|
13192
|
+
function zi(g) {
|
|
13095
13193
|
if (g.dataFormat !== "scalar")
|
|
13096
13194
|
throw new Error(
|
|
13097
13195
|
`Image data format must be scalar, instead found: ${g.dataFormat}`
|
|
13098
13196
|
);
|
|
13099
|
-
if (!
|
|
13197
|
+
if (!FC.has(g.dataType) && !ji.has(g.dataType))
|
|
13100
13198
|
throw new Error(
|
|
13101
13199
|
`Image data type must be an integer, instead found: ${g.dataType}`
|
|
13102
13200
|
);
|
|
13103
13201
|
return g;
|
|
13104
13202
|
}
|
|
13105
|
-
function
|
|
13106
|
-
return
|
|
13203
|
+
function _i(g) {
|
|
13204
|
+
return FC.has(g.dataType) ? "intLabelImage" : "labelImage";
|
|
13107
13205
|
}
|
|
13108
|
-
class
|
|
13206
|
+
class $i extends BI {
|
|
13109
13207
|
outlineSelected_;
|
|
13110
13208
|
selectedValue_;
|
|
13111
13209
|
worldToTexCoord = $();
|
|
13112
13210
|
constructor(A) {
|
|
13113
|
-
super(), this.geometry = new
|
|
13211
|
+
super(), this.geometry = new nC(A.width, A.height, 1, 1), this.setTexture(0, zi(A.imageData));
|
|
13114
13212
|
const I = this.makeColorCycleTexture(A.colorMap.cycle);
|
|
13115
13213
|
this.setTexture(1, I);
|
|
13116
13214
|
const B = this.makeColorLookupTableTexture(
|
|
13117
13215
|
A.colorMap.lookupTable
|
|
13118
13216
|
);
|
|
13119
|
-
this.setTexture(2, B), this.outlineSelected_ = A.outlineSelected ?? !1, this.selectedValue_ = A.selectedValue ?? null, this.programName =
|
|
13217
|
+
this.setTexture(2, B), this.outlineSelected_ = A.outlineSelected ?? !1, this.selectedValue_ = A.selectedValue ?? null, this.programName = _i(A.imageData);
|
|
13120
13218
|
}
|
|
13121
13219
|
get type() {
|
|
13122
13220
|
return "LabelImageRenderable";
|
|
@@ -13140,16 +13238,16 @@ class zi extends xA {
|
|
|
13140
13238
|
makeColorCycleTexture(A) {
|
|
13141
13239
|
const I = new Uint8Array(
|
|
13142
13240
|
A.flatMap((C) => C.rgba).map((C) => Math.round(C * 255))
|
|
13143
|
-
), B = new
|
|
13241
|
+
), B = new fB(I, A.length, 1);
|
|
13144
13242
|
return B.dataFormat = "rgba", B;
|
|
13145
13243
|
}
|
|
13146
13244
|
makeColorLookupTableTexture(A) {
|
|
13147
13245
|
A === void 0 ? A = /* @__PURE__ */ new Map([[0, x.TRANSPARENT]]) : A.has(0) || (A = new Map([[0, x.TRANSPARENT], ...A]));
|
|
13148
13246
|
const I = Array.from(A.keys()), B = Array.from(A.values()).map((E) => E.packed), C = A.size, Q = new Uint32Array(C * 2);
|
|
13149
|
-
return Q.set(I, 0), Q.set(B, C), new
|
|
13247
|
+
return Q.set(I, 0), Q.set(B, C), new fB(Q, C, 2);
|
|
13150
13248
|
}
|
|
13151
13249
|
}
|
|
13152
|
-
class
|
|
13250
|
+
class rC extends HI {
|
|
13153
13251
|
type = "LabelLayer";
|
|
13154
13252
|
source_;
|
|
13155
13253
|
sliceCoords_;
|
|
@@ -13159,7 +13257,7 @@ class GC extends KI {
|
|
|
13159
13257
|
onPickValue_;
|
|
13160
13258
|
outlineSelected_;
|
|
13161
13259
|
visibleChunks_ = /* @__PURE__ */ new Map();
|
|
13162
|
-
pool_ = new
|
|
13260
|
+
pool_ = new Tg();
|
|
13163
13261
|
colorMap_;
|
|
13164
13262
|
selectedValue_ = null;
|
|
13165
13263
|
policy_;
|
|
@@ -13179,7 +13277,7 @@ class GC extends KI {
|
|
|
13179
13277
|
outlineSelected: i = !1,
|
|
13180
13278
|
...o
|
|
13181
13279
|
}) {
|
|
13182
|
-
super(o), this.setState("initialized"), this.source_ = A, this.policy_ = B, this.sliceCoords_ = I, this.orientation_ = C ?? "XY", this.axes_ = MA(this.orientation_), this.planeRotation_ = dA(this.axes_), this.colorMap_ = new
|
|
13280
|
+
super(o), this.setState("initialized"), this.source_ = A, this.policy_ = B ?? mg(), this.sliceCoords_ = I, this.orientation_ = C ?? "XY", this.axes_ = MA(this.orientation_), this.planeRotation_ = dA(this.axes_), this.colorMap_ = new pB(Q), this.onPickValue_ = E, this.outlineSelected_ = i;
|
|
13183
13281
|
}
|
|
13184
13282
|
attach(A) {
|
|
13185
13283
|
if (this.context_ = A, this.chunkStoreView_ = A.chunkManager.addView(
|
|
@@ -13237,10 +13335,10 @@ class GC extends KI {
|
|
|
13237
13335
|
}
|
|
13238
13336
|
}
|
|
13239
13337
|
isPresentationStale() {
|
|
13240
|
-
return this.lastPresentationTimeStamp_ === void 0 ? !1 : performance.now() - this.lastPresentationTimeStamp_ >
|
|
13338
|
+
return this.lastPresentationTimeStamp_ === void 0 ? !1 : performance.now() - this.lastPresentationTimeStamp_ > rC.STALE_PRESENTATION_MS_;
|
|
13241
13339
|
}
|
|
13242
13340
|
onEvent(A) {
|
|
13243
|
-
this.pointerDownPos_ =
|
|
13341
|
+
this.pointerDownPos_ = GC(
|
|
13244
13342
|
A,
|
|
13245
13343
|
this.pointerDownPos_,
|
|
13246
13344
|
(I) => this.pickAtRay(I),
|
|
@@ -13252,7 +13350,7 @@ class GC extends KI {
|
|
|
13252
13350
|
async pickAtRay(A) {
|
|
13253
13351
|
const I = this.visibleChunks_.values().next();
|
|
13254
13352
|
if (I.done) return null;
|
|
13255
|
-
const B = I.value.transform, C =
|
|
13353
|
+
const B = I.value.transform, C = vB(
|
|
13256
13354
|
d(),
|
|
13257
13355
|
p(0, 0, 1),
|
|
13258
13356
|
B.rotation
|
|
@@ -13265,7 +13363,7 @@ class GC extends KI {
|
|
|
13265
13363
|
return this.colorMap_;
|
|
13266
13364
|
}
|
|
13267
13365
|
setColorMap(A) {
|
|
13268
|
-
this.colorMap_ = new
|
|
13366
|
+
this.colorMap_ = new pB(A), this.visibleChunks_.forEach((I) => {
|
|
13269
13367
|
I.setColorMap(this.colorMap_);
|
|
13270
13368
|
});
|
|
13271
13369
|
}
|
|
@@ -13286,7 +13384,7 @@ class GC extends KI {
|
|
|
13286
13384
|
set imageSourcePolicy(A) {
|
|
13287
13385
|
this.policy_ !== A && (this.policy_ = A, this.chunkStoreView_ && this.chunkStoreView_.setImageSourcePolicy(
|
|
13288
13386
|
A,
|
|
13289
|
-
|
|
13387
|
+
MI
|
|
13290
13388
|
));
|
|
13291
13389
|
}
|
|
13292
13390
|
// exposed for use in chunk info overlay
|
|
@@ -13326,7 +13424,7 @@ class GC extends KI {
|
|
|
13326
13424
|
return C ? (C.setTexture(0, I), C.setColorMap(this.colorMap_), C.setSelectedValue(this.selectedValue_), this.updateLabelChunk(C, A), C) : this.createLabel(A, I);
|
|
13327
13425
|
}
|
|
13328
13426
|
createLabel(A, I) {
|
|
13329
|
-
const B = new
|
|
13427
|
+
const B = new $i({
|
|
13330
13428
|
width: A.shape[this.axes_.u],
|
|
13331
13429
|
height: A.shape[this.axes_.v],
|
|
13332
13430
|
imageData: I,
|
|
@@ -13349,7 +13447,7 @@ class GC extends KI {
|
|
|
13349
13447
|
}
|
|
13350
13448
|
updateLabelChunk(A, I) {
|
|
13351
13449
|
const { u: B, v: C } = this.axes_;
|
|
13352
|
-
A.transform.setScale([I.scale[B], I.scale[C], 1]), A.transform.setRotation(this.planeRotation_), this.updateSlicePosition(A, I), A.worldToTexCoord =
|
|
13450
|
+
A.transform.setScale([I.scale[B], I.scale[C], 1]), A.transform.setRotation(this.planeRotation_), this.updateSlicePosition(A, I), A.worldToTexCoord = jB(I, this.axes_);
|
|
13353
13451
|
}
|
|
13354
13452
|
releaseAndRemoveChunks(A) {
|
|
13355
13453
|
for (const I of A) {
|
|
@@ -13358,7 +13456,7 @@ class GC extends KI {
|
|
|
13358
13456
|
}
|
|
13359
13457
|
}
|
|
13360
13458
|
}
|
|
13361
|
-
class
|
|
13459
|
+
class Ao extends Fg {
|
|
13362
13460
|
width_;
|
|
13363
13461
|
height_;
|
|
13364
13462
|
depth_;
|
|
@@ -13378,12 +13476,12 @@ class _i extends Fg {
|
|
|
13378
13476
|
return this.depth_;
|
|
13379
13477
|
}
|
|
13380
13478
|
}
|
|
13381
|
-
const
|
|
13479
|
+
const SC = {
|
|
13382
13480
|
circle: 0,
|
|
13383
13481
|
square: 1,
|
|
13384
13482
|
triangle: 2
|
|
13385
13483
|
};
|
|
13386
|
-
class
|
|
13484
|
+
class No extends BI {
|
|
13387
13485
|
constructor(A) {
|
|
13388
13486
|
super(), this.programName = "points";
|
|
13389
13487
|
const I = A.flatMap((C) => {
|
|
@@ -13397,7 +13495,7 @@ class ro extends xA {
|
|
|
13397
13495
|
Q.b,
|
|
13398
13496
|
Q.a,
|
|
13399
13497
|
C.size,
|
|
13400
|
-
|
|
13498
|
+
SC[C.marker]
|
|
13401
13499
|
];
|
|
13402
13500
|
}), B = new mA(I, [], "points");
|
|
13403
13501
|
B.addAttribute({
|
|
@@ -13416,17 +13514,17 @@ class ro extends xA {
|
|
|
13416
13514
|
type: "marker",
|
|
13417
13515
|
itemSize: 1,
|
|
13418
13516
|
offset: B.strideBytes
|
|
13419
|
-
}), this.geometry = B, this.setTexture(0,
|
|
13517
|
+
}), this.geometry = B, this.setTexture(0, Io());
|
|
13420
13518
|
}
|
|
13421
13519
|
get type() {
|
|
13422
13520
|
return "PointsRenderable";
|
|
13423
13521
|
}
|
|
13424
13522
|
}
|
|
13425
|
-
let
|
|
13426
|
-
function
|
|
13427
|
-
return
|
|
13523
|
+
let OI;
|
|
13524
|
+
function Io() {
|
|
13525
|
+
return OI || (OI = go()), OI;
|
|
13428
13526
|
}
|
|
13429
|
-
function
|
|
13527
|
+
function go() {
|
|
13430
13528
|
const g = (a) => {
|
|
13431
13529
|
const D = new Float32Array(a * a);
|
|
13432
13530
|
return D.fill(1), D;
|
|
@@ -13448,11 +13546,11 @@ function Ao() {
|
|
|
13448
13546
|
triangle: I(256)
|
|
13449
13547
|
}, E = Object.keys(Q).length, i = new Float32Array(E * 65536);
|
|
13450
13548
|
for (const [a, D] of Object.entries(Q))
|
|
13451
|
-
i.set(D,
|
|
13452
|
-
const o = new
|
|
13549
|
+
i.set(D, SC[a] * 65536);
|
|
13550
|
+
const o = new Ao(i, 256, 256);
|
|
13453
13551
|
return o.wrapR = "clamp_to_edge", o.wrapS = "clamp_to_edge", o.wrapT = "clamp_to_edge", o;
|
|
13454
13552
|
}
|
|
13455
|
-
class
|
|
13553
|
+
class mB {
|
|
13456
13554
|
radius;
|
|
13457
13555
|
phi;
|
|
13458
13556
|
theta;
|
|
@@ -13468,22 +13566,22 @@ class pB {
|
|
|
13468
13566
|
);
|
|
13469
13567
|
}
|
|
13470
13568
|
}
|
|
13471
|
-
const
|
|
13472
|
-
class
|
|
13569
|
+
const VI = -1, uB = 0, Bo = 1, TB = 9e-3, Co = 1e-3, Qo = 9e-4, Eo = 0.5, io = 60;
|
|
13570
|
+
class co {
|
|
13473
13571
|
camera_;
|
|
13474
|
-
orbitVelocity_ = new
|
|
13572
|
+
orbitVelocity_ = new mB(0, 0, 0);
|
|
13475
13573
|
panVelocity_ = d();
|
|
13476
13574
|
currPos_;
|
|
13477
13575
|
currCenter_ = d();
|
|
13478
13576
|
dampingFactor_;
|
|
13479
|
-
currMouseButton_ =
|
|
13577
|
+
currMouseButton_ = VI;
|
|
13480
13578
|
constructor(A, I) {
|
|
13481
|
-
this.camera_ = A, this.currPos_ = new
|
|
13579
|
+
this.camera_ = A, this.currPos_ = new mB(
|
|
13482
13580
|
I?.radius ?? 1,
|
|
13483
13581
|
I?.yaw ?? 0,
|
|
13484
13582
|
I?.pitch ?? 0
|
|
13485
|
-
), I?.target &&
|
|
13486
|
-
I?.dampingFactor ??
|
|
13583
|
+
), I?.target && jI(this.currCenter_, I.target), this.dampingFactor_ = hA(
|
|
13584
|
+
I?.dampingFactor ?? Eo,
|
|
13487
13585
|
0,
|
|
13488
13586
|
1
|
|
13489
13587
|
), this.updateCamera();
|
|
@@ -13514,16 +13612,16 @@ class So {
|
|
|
13514
13612
|
this.currPos_.phi += this.orbitVelocity_.phi, this.currPos_.theta += this.orbitVelocity_.theta, this.currPos_.radius += this.orbitVelocity_.radius * this.currPos_.radius, JA(this.currCenter_, this.currCenter_, this.panVelocity_);
|
|
13515
13613
|
const I = Math.PI / 2 - T;
|
|
13516
13614
|
this.currPos_.theta = hA(this.currPos_.theta, -I, I), this.currPos_.radius = Math.max(0.01, this.currPos_.radius), this.updateCamera();
|
|
13517
|
-
const B = Math.pow(1 - this.dampingFactor_, A *
|
|
13518
|
-
this.orbitVelocity_.phi *= B, this.orbitVelocity_.theta *= B, this.orbitVelocity_.radius *= B,
|
|
13615
|
+
const B = Math.pow(1 - this.dampingFactor_, A * io);
|
|
13616
|
+
this.orbitVelocity_.phi *= B, this.orbitVelocity_.theta *= B, this.orbitVelocity_.radius *= B, VA(this.panVelocity_, this.panVelocity_, B), this.cutoffLowVelocity();
|
|
13519
13617
|
}
|
|
13520
13618
|
onPointerDown(A) {
|
|
13521
13619
|
const I = A.event;
|
|
13522
13620
|
this.currMouseButton_ = I.button, I.target?.setPointerCapture?.(I.pointerId);
|
|
13523
13621
|
}
|
|
13524
13622
|
onPointerMove(A) {
|
|
13525
|
-
if (this.currMouseButton_ ==
|
|
13526
|
-
const I = A.event, B = I.movementX ?? 0, C = I.movementY ?? 0, Q = this.currMouseButton_ ===
|
|
13623
|
+
if (this.currMouseButton_ == VI) return;
|
|
13624
|
+
const I = A.event, B = I.movementX ?? 0, C = I.movementY ?? 0, Q = this.currMouseButton_ === uB && !I.shiftKey, E = this.currMouseButton_ === uB && I.shiftKey || this.currMouseButton_ === Bo;
|
|
13527
13625
|
Q && this.orbit(B, C), E && this.pan(B, C);
|
|
13528
13626
|
}
|
|
13529
13627
|
onWheel(A) {
|
|
@@ -13533,29 +13631,29 @@ class So {
|
|
|
13533
13631
|
this.zoom(B);
|
|
13534
13632
|
}
|
|
13535
13633
|
onPointerEnd(A) {
|
|
13536
|
-
this.currMouseButton_ =
|
|
13634
|
+
this.currMouseButton_ = VI;
|
|
13537
13635
|
const I = A.event;
|
|
13538
13636
|
I.target?.releasePointerCapture?.(I.pointerId);
|
|
13539
13637
|
}
|
|
13540
13638
|
orbit(A, I) {
|
|
13541
|
-
this.orbitVelocity_.phi -= A *
|
|
13639
|
+
this.orbitVelocity_.phi -= A * TB, this.orbitVelocity_.theta += I * TB;
|
|
13542
13640
|
}
|
|
13543
13641
|
pan(A, I) {
|
|
13544
|
-
const B = this.currPos_.radius *
|
|
13545
|
-
|
|
13642
|
+
const B = this.currPos_.radius * Co, C = d();
|
|
13643
|
+
zI(C, C, this.camera_.right, A), zI(C, C, this.camera_.up, I), VA(C, C, B), _I(this.panVelocity_, this.panVelocity_, C);
|
|
13546
13644
|
}
|
|
13547
13645
|
zoom(A) {
|
|
13548
|
-
this.orbitVelocity_.radius += A *
|
|
13646
|
+
this.orbitVelocity_.radius += A * Qo;
|
|
13549
13647
|
}
|
|
13550
13648
|
updateCamera() {
|
|
13551
13649
|
const A = JA(d(), this.currCenter_, this.currPos_.toVec3());
|
|
13552
13650
|
this.camera_.transform.setTranslation(A), this.camera_.transform.targetTo(this.currCenter_);
|
|
13553
13651
|
}
|
|
13554
13652
|
cutoffLowVelocity() {
|
|
13555
|
-
Math.abs(this.orbitVelocity_.phi) < T && (this.orbitVelocity_.phi = 0), Math.abs(this.orbitVelocity_.theta) < T && (this.orbitVelocity_.theta = 0), Math.abs(this.orbitVelocity_.radius) < T && (this.orbitVelocity_.radius = 0), tg(this.panVelocity_) < T &&
|
|
13653
|
+
Math.abs(this.orbitVelocity_.phi) < T && (this.orbitVelocity_.phi = 0), Math.abs(this.orbitVelocity_.theta) < T && (this.orbitVelocity_.theta = 0), Math.abs(this.orbitVelocity_.radius) < T && (this.orbitVelocity_.radius = 0), tg(this.panVelocity_) < T && zC(this.panVelocity_);
|
|
13556
13654
|
}
|
|
13557
13655
|
}
|
|
13558
|
-
class
|
|
13656
|
+
class oo {
|
|
13559
13657
|
planes_;
|
|
13560
13658
|
constructor(A) {
|
|
13561
13659
|
this.planes_ = [
|
|
@@ -13601,7 +13699,8 @@ class Eo {
|
|
|
13601
13699
|
return !0;
|
|
13602
13700
|
}
|
|
13603
13701
|
}
|
|
13604
|
-
class
|
|
13702
|
+
class RC extends LI {
|
|
13703
|
+
transform_ = new tC();
|
|
13605
13704
|
projectionMatrix_ = $();
|
|
13606
13705
|
near_ = 0;
|
|
13607
13706
|
far_ = 0;
|
|
@@ -13611,6 +13710,9 @@ class FC extends xA {
|
|
|
13611
13710
|
get projectionMatrix() {
|
|
13612
13711
|
return this.projectionMatrix_;
|
|
13613
13712
|
}
|
|
13713
|
+
get transform() {
|
|
13714
|
+
return this.transform_;
|
|
13715
|
+
}
|
|
13614
13716
|
get viewMatrix() {
|
|
13615
13717
|
return this.transform.inverse;
|
|
13616
13718
|
}
|
|
@@ -13623,10 +13725,10 @@ class FC extends xA {
|
|
|
13623
13725
|
return p(A[4], A[5], A[6]);
|
|
13624
13726
|
}
|
|
13625
13727
|
getViewProjection() {
|
|
13626
|
-
return
|
|
13728
|
+
return XI($(), this.projectionMatrix, this.viewMatrix);
|
|
13627
13729
|
}
|
|
13628
13730
|
get frustum() {
|
|
13629
|
-
return new
|
|
13731
|
+
return new oo(this.getViewProjection());
|
|
13630
13732
|
}
|
|
13631
13733
|
pan(A) {
|
|
13632
13734
|
this.transform.addTranslation(A);
|
|
@@ -13635,16 +13737,16 @@ class FC extends xA {
|
|
|
13635
13737
|
return this.transform.translation;
|
|
13636
13738
|
}
|
|
13637
13739
|
clipToWorld(A) {
|
|
13638
|
-
const I = DI(A[0], A[1], A[2], 1), B =
|
|
13740
|
+
const I = DI(A[0], A[1], A[2], 1), B = JI(
|
|
13639
13741
|
$(),
|
|
13640
13742
|
this.projectionMatrix_
|
|
13641
|
-
), C =
|
|
13743
|
+
), C = vA(
|
|
13642
13744
|
YA(),
|
|
13643
13745
|
I,
|
|
13644
13746
|
B
|
|
13645
13747
|
);
|
|
13646
|
-
|
|
13647
|
-
const Q =
|
|
13748
|
+
IQ(C, C, 1 / C[3]);
|
|
13749
|
+
const Q = vA(
|
|
13648
13750
|
YA(),
|
|
13649
13751
|
C,
|
|
13650
13752
|
this.transform.matrix
|
|
@@ -13652,28 +13754,25 @@ class FC extends xA {
|
|
|
13652
13754
|
return p(Q[0], Q[1], Q[2]);
|
|
13653
13755
|
}
|
|
13654
13756
|
}
|
|
13655
|
-
const
|
|
13656
|
-
class
|
|
13757
|
+
const NC = 1.77, xB = 128, WB = 128 / NC, ao = -1e6, Do = 1e6;
|
|
13758
|
+
class Uo extends RC {
|
|
13657
13759
|
// width_ and height_ should always be defined by constructor (see setFrame)
|
|
13658
|
-
width_ =
|
|
13659
|
-
height_ =
|
|
13660
|
-
viewportAspectRatio_ =
|
|
13661
|
-
viewportSize_ = [
|
|
13760
|
+
width_ = xB;
|
|
13761
|
+
height_ = WB;
|
|
13762
|
+
viewportAspectRatio_ = NC;
|
|
13763
|
+
viewportSize_ = [xB, WB];
|
|
13662
13764
|
axes_;
|
|
13663
13765
|
rotation_;
|
|
13664
13766
|
orientation_;
|
|
13665
13767
|
/**
|
|
13666
13768
|
* Creates an orthographic camera framing the given world-space rectangle.
|
|
13667
13769
|
*
|
|
13668
|
-
* @param
|
|
13669
|
-
*
|
|
13670
|
-
*
|
|
13671
|
-
* @param bottom - Bottom edge of the view frame, in world units.
|
|
13672
|
-
* @param options - Near/far clipping plane distances (default `-1e6` and
|
|
13673
|
-
* `1e6`) and the slice orientation the camera faces (default `"XY"`).
|
|
13770
|
+
* @param props - The view frame edges in world units, near/far clipping
|
|
13771
|
+
* plane distances (default `-1e6` and `1e6`), and the slice orientation
|
|
13772
|
+
* the camera faces (default `"XY"`).
|
|
13674
13773
|
*/
|
|
13675
|
-
constructor(A
|
|
13676
|
-
super(), this.near_ =
|
|
13774
|
+
constructor(A) {
|
|
13775
|
+
super(), this.near_ = A.near ?? ao, this.far_ = A.far ?? Do, this.orientation_ = A.orientation ?? "XY", this.axes_ = MA(this.orientation_), this.rotation_ = dA(this.axes_), this.setFrame(A), this.updateProjectionMatrix();
|
|
13677
13776
|
}
|
|
13678
13777
|
get viewportSize() {
|
|
13679
13778
|
return this.viewportSize_;
|
|
@@ -13681,10 +13780,10 @@ class Ro extends FC {
|
|
|
13681
13780
|
setAspectRatio(A) {
|
|
13682
13781
|
this.viewportAspectRatio_ = A, this.updateProjectionMatrix();
|
|
13683
13782
|
}
|
|
13684
|
-
setFrame(A, I, B, C) {
|
|
13685
|
-
this.width_ = Math.abs(I - A), this.height_ = Math.abs(
|
|
13783
|
+
setFrame({ left: A, right: I, top: B, bottom: C }) {
|
|
13784
|
+
this.width_ = Math.abs(I - A), this.height_ = Math.abs(B - C), this.updateProjectionMatrix();
|
|
13686
13785
|
const Q = d();
|
|
13687
|
-
Q[W[this.axes_.u]] = 0.5 * (A + I), Q[W[this.axes_.v]] = 0.5 * (
|
|
13786
|
+
Q[W[this.axes_.u]] = 0.5 * (A + I), Q[W[this.axes_.v]] = 0.5 * (C + B), this.transform.setTranslation(Q), this.transform.setScale([1, 1, 1]), this.transform.setRotation(this.rotation_);
|
|
13688
13787
|
}
|
|
13689
13788
|
get type() {
|
|
13690
13789
|
return "OrthographicCamera";
|
|
@@ -13713,8 +13812,8 @@ class Ro extends FC {
|
|
|
13713
13812
|
}
|
|
13714
13813
|
getWorldViewRect() {
|
|
13715
13814
|
let A = DI(-1, -1, 0, 1), I = DI(1, 1, 0, 1);
|
|
13716
|
-
const B =
|
|
13717
|
-
A =
|
|
13815
|
+
const B = JI($(), this.getViewProjection());
|
|
13816
|
+
A = vA(YA(), A, B), I = vA(YA(), I, B);
|
|
13718
13817
|
const C = W[this.axes_.u], Q = W[this.axes_.v];
|
|
13719
13818
|
return new AA(
|
|
13720
13819
|
V(A[C], A[Q]),
|
|
@@ -13724,7 +13823,7 @@ class Ro extends FC {
|
|
|
13724
13823
|
updateProjectionMatrix() {
|
|
13725
13824
|
const A = this.width_, I = this.height_, B = A / I;
|
|
13726
13825
|
let C = 0.5 * A, Q = 0.5 * I;
|
|
13727
|
-
this.viewportAspectRatio_ > B ? C *= this.viewportAspectRatio_ / B : Q *= B / this.viewportAspectRatio_, this.viewportSize_ = [2 * C, 2 * Q],
|
|
13826
|
+
this.viewportAspectRatio_ > B ? C *= this.viewportAspectRatio_ / B : Q *= B / this.viewportAspectRatio_, this.viewportSize_ = [2 * C, 2 * Q], VC(
|
|
13728
13827
|
this.projectionMatrix_,
|
|
13729
13828
|
-C,
|
|
13730
13829
|
C,
|
|
@@ -13735,8 +13834,8 @@ class Ro extends FC {
|
|
|
13735
13834
|
);
|
|
13736
13835
|
}
|
|
13737
13836
|
}
|
|
13738
|
-
const
|
|
13739
|
-
class
|
|
13837
|
+
const bB = 0;
|
|
13838
|
+
class ko {
|
|
13740
13839
|
camera_;
|
|
13741
13840
|
dragActive_ = !1;
|
|
13742
13841
|
dragStart_ = d();
|
|
@@ -13771,38 +13870,38 @@ class No {
|
|
|
13771
13870
|
I.preventDefault();
|
|
13772
13871
|
const B = DA(A.worldPos), C = I.deltaY < 0 ? 1.05 : 0.95;
|
|
13773
13872
|
this.camera_.zoom(C);
|
|
13774
|
-
const Q = this.camera_.clipToWorld(A.clipPos), E =
|
|
13873
|
+
const Q = this.camera_.clipToWorld(A.clipPos), E = _I(d(), B, Q);
|
|
13775
13874
|
this.camera_.pan(E);
|
|
13776
13875
|
}
|
|
13777
13876
|
onPointerDown(A) {
|
|
13778
13877
|
const I = A.event;
|
|
13779
|
-
!A.worldPos || I.button !==
|
|
13878
|
+
!A.worldPos || I.button !== bB || (this.dragStart_ = DA(A.worldPos), this.dragActive_ = !0, I.target?.setPointerCapture?.(I.pointerId));
|
|
13780
13879
|
}
|
|
13781
13880
|
onPointerMove(A) {
|
|
13782
13881
|
if (!this.dragActive_ || !A.worldPos) return;
|
|
13783
|
-
const I =
|
|
13882
|
+
const I = _I(d(), this.dragStart_, A.worldPos);
|
|
13784
13883
|
this.camera_.pan(I);
|
|
13785
13884
|
}
|
|
13786
13885
|
onPointerEnd(A) {
|
|
13787
13886
|
const I = A.event;
|
|
13788
|
-
!this.dragActive_ || I.button !==
|
|
13887
|
+
!this.dragActive_ || I.button !== bB || (this.dragActive_ = !1, I.target?.releasePointerCapture?.(I.pointerId));
|
|
13789
13888
|
}
|
|
13790
13889
|
}
|
|
13791
|
-
const
|
|
13792
|
-
class
|
|
13890
|
+
const so = 60, ho = 1.77, oI = 0.1, vI = 180 - oI;
|
|
13891
|
+
class Lo extends RC {
|
|
13793
13892
|
fov_;
|
|
13794
13893
|
aspectRatio_;
|
|
13795
13894
|
constructor(A = {}) {
|
|
13796
13895
|
const {
|
|
13797
|
-
fov: I =
|
|
13798
|
-
aspectRatio: B =
|
|
13896
|
+
fov: I = so,
|
|
13897
|
+
aspectRatio: B = ho,
|
|
13799
13898
|
near: C = 0.1,
|
|
13800
13899
|
far: Q = 1e4,
|
|
13801
13900
|
position: E = p(0, 0, 0)
|
|
13802
13901
|
} = A;
|
|
13803
|
-
if (I < oI || I >
|
|
13902
|
+
if (I < oI || I > vI)
|
|
13804
13903
|
throw new Error(
|
|
13805
|
-
`Invalid field of view: ${I}, must be in [${oI}, ${
|
|
13904
|
+
`Invalid field of view: ${I}, must be in [${oI}, ${vI}] degrees`
|
|
13806
13905
|
);
|
|
13807
13906
|
super(), this.fov_ = I, this.aspectRatio_ = B, this.near_ = C, this.far_ = Q, this.transform.setTranslation(E), this.updateProjectionMatrix();
|
|
13808
13907
|
}
|
|
@@ -13818,137 +13917,44 @@ class co extends FC {
|
|
|
13818
13917
|
zoom(A) {
|
|
13819
13918
|
if (A <= 0)
|
|
13820
13919
|
throw new Error(`Invalid zoom factor: ${A}`);
|
|
13821
|
-
this.fov_ = Math.max(oI, Math.min(
|
|
13920
|
+
this.fov_ = Math.max(oI, Math.min(vI, this.fov_ / A)), this.updateProjectionMatrix();
|
|
13822
13921
|
}
|
|
13823
13922
|
updateProjectionMatrix() {
|
|
13824
|
-
|
|
13923
|
+
PC(
|
|
13825
13924
|
this.projectionMatrix_,
|
|
13826
|
-
|
|
13925
|
+
uC(this.fov),
|
|
13827
13926
|
this.aspectRatio_,
|
|
13828
13927
|
this.near_,
|
|
13829
13928
|
this.far_
|
|
13830
13929
|
);
|
|
13831
13930
|
}
|
|
13832
13931
|
}
|
|
13833
|
-
const SC = [
|
|
13834
|
-
"fallbackVisible",
|
|
13835
|
-
"prefetchTime",
|
|
13836
|
-
"visibleCurrent",
|
|
13837
|
-
"fallbackBackground",
|
|
13838
|
-
"prefetchSpace"
|
|
13839
|
-
];
|
|
13840
|
-
function mg(g) {
|
|
13841
|
-
so(g);
|
|
13842
|
-
const A = {
|
|
13843
|
-
x: g.prefetch.x,
|
|
13844
|
-
y: g.prefetch.y,
|
|
13845
|
-
z: g.prefetch.z ?? 0,
|
|
13846
|
-
t: g.prefetch.t ?? 0
|
|
13847
|
-
}, I = Object.freeze(
|
|
13848
|
-
SC.reduce(
|
|
13849
|
-
(Q, E) => {
|
|
13850
|
-
const i = g.priorityOrder.indexOf(E);
|
|
13851
|
-
return Q[E] = i, Q;
|
|
13852
|
-
},
|
|
13853
|
-
{}
|
|
13854
|
-
)
|
|
13855
|
-
), B = {
|
|
13856
|
-
min: g.lod?.min ?? 0,
|
|
13857
|
-
max: g.lod?.max ?? Number.MAX_SAFE_INTEGER,
|
|
13858
|
-
bias: g.lod?.bias ?? 0.5
|
|
13859
|
-
}, C = {
|
|
13860
|
-
profile: g.profile ?? "custom",
|
|
13861
|
-
prefetch: A,
|
|
13862
|
-
priorityOrder: Object.freeze([...g.priorityOrder]),
|
|
13863
|
-
priorityMap: I,
|
|
13864
|
-
lod: B
|
|
13865
|
-
};
|
|
13866
|
-
return Object.freeze(C);
|
|
13867
|
-
}
|
|
13868
|
-
function Uo(g = {}) {
|
|
13869
|
-
return mg(ug({
|
|
13870
|
-
profile: "exploration",
|
|
13871
|
-
prefetch: { x: 1, y: 1, z: 1, t: 0 },
|
|
13872
|
-
priorityOrder: [
|
|
13873
|
-
"fallbackVisible",
|
|
13874
|
-
"visibleCurrent",
|
|
13875
|
-
"prefetchSpace",
|
|
13876
|
-
"prefetchTime",
|
|
13877
|
-
"fallbackBackground"
|
|
13878
|
-
]
|
|
13879
|
-
}, g));
|
|
13880
|
-
}
|
|
13881
|
-
function ko(g = {}) {
|
|
13882
|
-
return mg(ug({
|
|
13883
|
-
profile: "playback",
|
|
13884
|
-
prefetch: { x: 0, y: 0, z: 0, t: 20 },
|
|
13885
|
-
priorityOrder: [
|
|
13886
|
-
"fallbackVisible",
|
|
13887
|
-
"prefetchTime",
|
|
13888
|
-
"visibleCurrent",
|
|
13889
|
-
"fallbackBackground",
|
|
13890
|
-
"prefetchSpace"
|
|
13891
|
-
]
|
|
13892
|
-
}, g));
|
|
13893
|
-
}
|
|
13894
|
-
function Lo(g = {}) {
|
|
13895
|
-
return mg(ug({
|
|
13896
|
-
profile: "no-prefetch",
|
|
13897
|
-
prefetch: { x: 0, y: 0, z: 0, t: 0 },
|
|
13898
|
-
priorityOrder: [
|
|
13899
|
-
"fallbackVisible",
|
|
13900
|
-
"visibleCurrent",
|
|
13901
|
-
"fallbackBackground",
|
|
13902
|
-
"prefetchSpace",
|
|
13903
|
-
"prefetchTime"
|
|
13904
|
-
]
|
|
13905
|
-
}, g));
|
|
13906
|
-
}
|
|
13907
|
-
function so(g) {
|
|
13908
|
-
for (const [B, C] of Object.entries(g.prefetch))
|
|
13909
|
-
if (C !== void 0 && C < 0)
|
|
13910
|
-
throw new Error(`prefetch.${B} must be a non-negative number`);
|
|
13911
|
-
const A = g.lod;
|
|
13912
|
-
if (A?.min !== void 0 && A?.max !== void 0 && A.min > A.max)
|
|
13913
|
-
throw new Error("lod.min must be <= lod.max");
|
|
13914
|
-
const I = g.priorityOrder;
|
|
13915
|
-
if (I.length !== SC.length || new Set(I).size !== I.length)
|
|
13916
|
-
throw new Error("priorityOrder must include all categories exactly once");
|
|
13917
|
-
}
|
|
13918
|
-
function ug(g, A = {}) {
|
|
13919
|
-
return {
|
|
13920
|
-
profile: A.profile ?? g.profile,
|
|
13921
|
-
prefetch: { ...g.prefetch, ...A.prefetch ?? {} },
|
|
13922
|
-
lod: { ...g.lod, ...A.lod ?? {} },
|
|
13923
|
-
priorityOrder: A.priorityOrder ?? g.priorityOrder
|
|
13924
|
-
};
|
|
13925
|
-
}
|
|
13926
13932
|
export {
|
|
13927
|
-
|
|
13933
|
+
Fo as AxesLayer,
|
|
13928
13934
|
x as Color,
|
|
13929
|
-
|
|
13930
|
-
|
|
13931
|
-
|
|
13932
|
-
|
|
13933
|
-
|
|
13934
|
-
|
|
13935
|
-
|
|
13936
|
-
|
|
13937
|
-
|
|
13938
|
-
|
|
13939
|
-
|
|
13940
|
-
|
|
13941
|
-
|
|
13942
|
-
|
|
13943
|
-
|
|
13944
|
-
|
|
13945
|
-
|
|
13946
|
-
|
|
13947
|
-
|
|
13948
|
-
|
|
13949
|
-
|
|
13950
|
-
|
|
13951
|
-
|
|
13952
|
-
|
|
13935
|
+
to as Idetik,
|
|
13936
|
+
wC as ImageLayer,
|
|
13937
|
+
pi as ImageRenderable,
|
|
13938
|
+
pB as LabelColorMap,
|
|
13939
|
+
$i as LabelImageRenderable,
|
|
13940
|
+
rC as LabelLayer,
|
|
13941
|
+
HI as Layer,
|
|
13942
|
+
PA as OmeZarrImageSource,
|
|
13943
|
+
co as OrbitControls,
|
|
13944
|
+
Uo as OrthographicCamera,
|
|
13945
|
+
ko as PanZoomControls,
|
|
13946
|
+
Lo as PerspectiveCamera,
|
|
13947
|
+
No as PointsRenderable,
|
|
13948
|
+
qi as ProjectedLineRenderable,
|
|
13949
|
+
Ro as VolumeLayer,
|
|
13950
|
+
Ti as VolumeRenderable,
|
|
13951
|
+
mg as createExplorationPolicy,
|
|
13952
|
+
pg as createImageSourcePolicy,
|
|
13953
|
+
So as createNoPrefetchPolicy,
|
|
13954
|
+
ro as createPlaybackPolicy,
|
|
13955
|
+
eo as loadOmeZarrPlate,
|
|
13956
|
+
no as loadOmeZarrWell,
|
|
13957
|
+
Go as loadOmeroChannels,
|
|
13958
|
+
wo as loadOmeroDefaults
|
|
13953
13959
|
};
|
|
13954
13960
|
//# sourceMappingURL=index.js.map
|