@idetik/core 0.36.1 → 0.36.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +51 -49
- package/dist/index.js +564 -550
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +28 -28
- package/dist/index.umd.cjs.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/renderers/webgl_renderer.d.ts.map +1 -1
- package/dist/types/src/renderers/webgl_state.d.ts +2 -0
- package/dist/types/src/renderers/webgl_state.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 NC {
|
|
|
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,18 +189,18 @@ 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
|
|
|
196
196
|
layout (location = 0) out vec4 fragColor;
|
|
197
197
|
|
|
198
198
|
uniform float u_opacity;
|
|
199
|
-
uniform vec3
|
|
199
|
+
uniform vec3 u_wireframeColor;
|
|
200
200
|
|
|
201
201
|
void main() {
|
|
202
|
-
fragColor = vec4(
|
|
203
|
-
}`,
|
|
202
|
+
fragColor = vec4(u_wireframeColor, u_opacity);
|
|
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
|
|
|
@@ -454,54 +454,54 @@ void main() {
|
|
|
454
454
|
|
|
455
455
|
fragColor = vec4(color.rgb, alpha);
|
|
456
456
|
}`;
|
|
457
|
-
const
|
|
457
|
+
const dC = {
|
|
458
458
|
projectedLine: {
|
|
459
|
-
vertex:
|
|
460
|
-
fragment:
|
|
459
|
+
vertex: UC,
|
|
460
|
+
fragment: kC
|
|
461
461
|
},
|
|
462
462
|
points: {
|
|
463
|
-
vertex:
|
|
464
|
-
fragment:
|
|
463
|
+
vertex: LC,
|
|
464
|
+
fragment: JC
|
|
465
465
|
},
|
|
466
466
|
wireframe: {
|
|
467
|
-
vertex:
|
|
468
|
-
fragment:
|
|
467
|
+
vertex: YC,
|
|
468
|
+
fragment: MC
|
|
469
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:
|
|
485
|
+
vertex: xA,
|
|
486
486
|
fragment: Zg
|
|
487
487
|
},
|
|
488
488
|
intLabelImage: {
|
|
489
|
-
vertex:
|
|
489
|
+
vertex: xA,
|
|
490
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 = {
|
|
@@ -509,7 +509,7 @@ const MC = {
|
|
|
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 MC = {
|
|
|
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 KC() {
|
|
|
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
|
}
|
|
@@ -549,7 +549,7 @@ class k {
|
|
|
549
549
|
}
|
|
550
550
|
static log(A, I, B, ...C) {
|
|
551
551
|
if (Pg[A] < Pg[k.logLevel_]) return;
|
|
552
|
-
const Q = (/* @__PURE__ */ new Date()).toISOString(), E =
|
|
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 HC {
|
|
|
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 HC {
|
|
|
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 qC = 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 fC {
|
|
|
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
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
|
|
@@ -749,35 +749,35 @@ class fC {
|
|
|
749
749
|
}
|
|
750
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
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
|
|
766
|
+
class LI {
|
|
767
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
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
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,19 +813,19 @@ function bC(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
|
|
828
|
+
function XC(g, A) {
|
|
829
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
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
|
}
|
|
@@ -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,13 +857,13 @@ 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
869
|
function Vg(g, A) {
|
|
@@ -889,14 +889,14 @@ 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,24 +970,24 @@ 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
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
993
|
function XB() {
|
|
@@ -1002,22 +1002,22 @@ 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
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
|
}
|
|
@@ -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 aQ = {
|
|
|
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 DQ {
|
|
|
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 DQ {
|
|
|
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 hQ(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 tQ(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 yQ(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 eQ {
|
|
|
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 eQ {
|
|
|
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);
|
|
@@ -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;
|
|
@@ -1624,6 +1624,12 @@ class nQ {
|
|
|
1624
1624
|
setDepthMask(A) {
|
|
1625
1625
|
this.depthMaskEnabled_ !== A && (this.gl_.depthMask(A), this.depthMaskEnabled_ = A);
|
|
1626
1626
|
}
|
|
1627
|
+
get stencilTestEnabled() {
|
|
1628
|
+
return this.enabledCapabilities_.get(this.gl_.STENCIL_TEST) ?? !1;
|
|
1629
|
+
}
|
|
1630
|
+
get blendingMode() {
|
|
1631
|
+
return this.currentBlendingMode_;
|
|
1632
|
+
}
|
|
1627
1633
|
setBlendingMode(A) {
|
|
1628
1634
|
if (this.currentBlendingMode_ !== A) {
|
|
1629
1635
|
if (A === "none")
|
|
@@ -1696,8 +1702,8 @@ class nQ {
|
|
|
1696
1702
|
(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
1703
|
}
|
|
1698
1704
|
}
|
|
1699
|
-
const
|
|
1700
|
-
class
|
|
1705
|
+
const wQ = OB($(), [1, -1, 1]);
|
|
1706
|
+
class FQ extends cC {
|
|
1701
1707
|
gl_;
|
|
1702
1708
|
programs_;
|
|
1703
1709
|
bindings_;
|
|
@@ -1718,7 +1724,7 @@ class wQ extends NC {
|
|
|
1718
1724
|
this.gl_ = I, k.info(
|
|
1719
1725
|
"WebGLRenderer",
|
|
1720
1726
|
`WebGL version ${I.getParameter(I.VERSION)}`
|
|
1721
|
-
), I.getExtension("EXT_color_buffer_float"), this.programs_ = new
|
|
1727
|
+
), 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
1728
|
}
|
|
1723
1729
|
get gpuTextureBytes() {
|
|
1724
1730
|
return this.textures_.gpuTextureBytes;
|
|
@@ -1787,25 +1793,29 @@ class wQ extends NC {
|
|
|
1787
1793
|
});
|
|
1788
1794
|
const C = this.programs_.use(I.programName);
|
|
1789
1795
|
if (this.drawGeometry(I.geometry, I, A, C, B), I.wireframeEnabled) {
|
|
1790
|
-
this.
|
|
1791
|
-
|
|
1792
|
-
|
|
1796
|
+
const Q = this.state_.stencilTestEnabled, E = this.state_.blendingMode;
|
|
1797
|
+
this.state_.setStencilTest(!1), this.state_.setBlendingMode("none"), this.bindings_.bindGeometry(I.wireframeGeometry);
|
|
1798
|
+
const i = this.programs_.use("wireframe");
|
|
1799
|
+
i.setUniform(
|
|
1800
|
+
"u_wireframeColor",
|
|
1801
|
+
I.wireframeColor.rgb
|
|
1802
|
+
), this.drawGeometry(
|
|
1793
1803
|
I.wireframeGeometry,
|
|
1794
1804
|
I,
|
|
1795
1805
|
A,
|
|
1796
|
-
|
|
1806
|
+
i,
|
|
1797
1807
|
B
|
|
1798
|
-
);
|
|
1808
|
+
), E !== null && this.state_.setBlendingMode(E), this.state_.setStencilTest(Q);
|
|
1799
1809
|
}
|
|
1800
1810
|
}
|
|
1801
1811
|
drawGeometry(A, I, B, C, Q) {
|
|
1802
|
-
const E =
|
|
1812
|
+
const E = XI(
|
|
1803
1813
|
$(),
|
|
1804
1814
|
Q.viewMatrix,
|
|
1805
1815
|
I.transform.matrix
|
|
1806
|
-
), i =
|
|
1816
|
+
), i = XI(
|
|
1807
1817
|
$(),
|
|
1808
|
-
|
|
1818
|
+
wQ,
|
|
1809
1819
|
Q.projectionMatrix
|
|
1810
1820
|
), o = this.currentViewportSize_, a = I.getUniforms(), s = {
|
|
1811
1821
|
...B.getUniforms(),
|
|
@@ -1832,7 +1842,7 @@ class wQ extends NC {
|
|
|
1832
1842
|
);
|
|
1833
1843
|
break;
|
|
1834
1844
|
case "u_cameraPositionModel": {
|
|
1835
|
-
const n =
|
|
1845
|
+
const n = JI($(), E), F = DI(0, 0, 0, 1), G = vA(
|
|
1836
1846
|
YA(),
|
|
1837
1847
|
F,
|
|
1838
1848
|
n
|
|
@@ -1886,11 +1896,11 @@ class wQ extends NC {
|
|
|
1886
1896
|
), this.state_.setDepthTesting(!0), this.gl_.depthFunc(this.gl_.LEQUAL);
|
|
1887
1897
|
}
|
|
1888
1898
|
}
|
|
1889
|
-
function
|
|
1899
|
+
function bA(g, A) {
|
|
1890
1900
|
const I = g.priority ?? Number.MAX_SAFE_INTEGER, B = A.priority ?? Number.MAX_SAFE_INTEGER;
|
|
1891
1901
|
return I === B ? (g.orderKey ?? Number.MAX_SAFE_INTEGER) - (A.orderKey ?? Number.MAX_SAFE_INTEGER) : I - B;
|
|
1892
1902
|
}
|
|
1893
|
-
class
|
|
1903
|
+
class rQ {
|
|
1894
1904
|
maxConcurrent_;
|
|
1895
1905
|
pending_ = [];
|
|
1896
1906
|
running_ = /* @__PURE__ */ new Map();
|
|
@@ -1920,7 +1930,7 @@ class FQ {
|
|
|
1920
1930
|
}
|
|
1921
1931
|
pump() {
|
|
1922
1932
|
if (!(this.running_.size >= this.maxConcurrent_ || this.pending_.length === 0))
|
|
1923
|
-
for (this.pending_.sort((A, I) =>
|
|
1933
|
+
for (this.pending_.sort((A, I) => bA(A.chunk, I.chunk)); this.running_.size < this.maxConcurrent_ && this.pending_.length > 0; )
|
|
1924
1934
|
this.start(this.pending_.shift());
|
|
1925
1935
|
}
|
|
1926
1936
|
start(A) {
|
|
@@ -1940,13 +1950,13 @@ class FQ {
|
|
|
1940
1950
|
}
|
|
1941
1951
|
}
|
|
1942
1952
|
let hI = 0, tI = 0;
|
|
1943
|
-
function
|
|
1953
|
+
function SQ(g, A) {
|
|
1944
1954
|
g.data && (hI -= g.data.byteLength, tI -= 1), g.data = A, hI += A.byteLength, tI += 1;
|
|
1945
1955
|
}
|
|
1946
1956
|
function jg(g) {
|
|
1947
1957
|
g.data && (hI -= g.data.byteLength, tI -= 1), g.data = void 0, g.texture?.releaseCpuData();
|
|
1948
1958
|
}
|
|
1949
|
-
function
|
|
1959
|
+
function RQ() {
|
|
1950
1960
|
return { cpuChunkBytes: hI, cpuChunkCount: tI };
|
|
1951
1961
|
}
|
|
1952
1962
|
function zg(g, A, I = 1e-6) {
|
|
@@ -1970,7 +1980,7 @@ function MA(g) {
|
|
|
1970
1980
|
function dA(g) {
|
|
1971
1981
|
const A = d(), I = d();
|
|
1972
1982
|
A[W[g.u]] = 1, I[W[g.v]] = 1;
|
|
1973
|
-
const B = EI(d(), A, I), C =
|
|
1983
|
+
const B = EI(d(), A, I), C = xC(
|
|
1974
1984
|
A[0],
|
|
1975
1985
|
A[1],
|
|
1976
1986
|
A[2],
|
|
@@ -1981,7 +1991,7 @@ function dA(g) {
|
|
|
1981
1991
|
B[1],
|
|
1982
1992
|
B[2]
|
|
1983
1993
|
), Q = Gg(sI(), C);
|
|
1984
|
-
return
|
|
1994
|
+
return YI(Q, Q);
|
|
1985
1995
|
}
|
|
1986
1996
|
const _g = [
|
|
1987
1997
|
Int8Array,
|
|
@@ -1992,7 +2002,7 @@ const _g = [
|
|
|
1992
2002
|
Uint32Array,
|
|
1993
2003
|
Float32Array
|
|
1994
2004
|
];
|
|
1995
|
-
function
|
|
2005
|
+
function NQ(g) {
|
|
1996
2006
|
if (_g.some((I) => g instanceof I))
|
|
1997
2007
|
return !0;
|
|
1998
2008
|
const A = _g.map((I) => I.name);
|
|
@@ -2001,7 +2011,7 @@ function RQ(g) {
|
|
|
2001
2011
|
`Unsupported chunk data type: ${g}. Supported data types: ${A}`
|
|
2002
2012
|
), !1;
|
|
2003
2013
|
}
|
|
2004
|
-
function
|
|
2014
|
+
function cQ(g, A) {
|
|
2005
2015
|
return Math.round((A - g.translation) / g.scale);
|
|
2006
2016
|
}
|
|
2007
2017
|
function jB(g, A) {
|
|
@@ -2011,13 +2021,13 @@ function jB(g, A) {
|
|
|
2011
2021
|
I[i] = 1 / (g.scale[Q] * g.shape[Q]), B[i] = E - g.offset[Q];
|
|
2012
2022
|
}
|
|
2013
2023
|
const C = OB($(), I);
|
|
2014
|
-
return
|
|
2024
|
+
return WC(C, C, B);
|
|
2015
2025
|
}
|
|
2016
2026
|
function hA(g, A, I) {
|
|
2017
2027
|
return Math.max(A, Math.min(I, g));
|
|
2018
2028
|
}
|
|
2019
|
-
const
|
|
2020
|
-
class
|
|
2029
|
+
const MI = Symbol("INTERNAL_POLICY_KEY");
|
|
2030
|
+
class UQ {
|
|
2021
2031
|
store_;
|
|
2022
2032
|
policy_;
|
|
2023
2033
|
policyChanged_ = !1;
|
|
@@ -2044,7 +2054,7 @@ class cQ {
|
|
|
2044
2054
|
`Source is missing dimensions for slice plane axes "${this.axes_.u}" and "${this.axes_.v}"`
|
|
2045
2055
|
);
|
|
2046
2056
|
const i = Q.lods[0], o = E.lods[0];
|
|
2047
|
-
this.scale0_ = i.scale, this.sourceMaxSquareDistance2D_ =
|
|
2057
|
+
this.scale0_ = i.scale, this.sourceMaxSquareDistance2D_ = oQ(
|
|
2048
2058
|
V(i.size * i.scale, o.size * o.scale)
|
|
2049
2059
|
);
|
|
2050
2060
|
}
|
|
@@ -2084,13 +2094,13 @@ class cQ {
|
|
|
2084
2094
|
k.warn(
|
|
2085
2095
|
"ChunkStoreView",
|
|
2086
2096
|
"updateChunkViewStates called with no chunks initialized"
|
|
2087
|
-
), this.chunkViewStates_.forEach(
|
|
2097
|
+
), this.chunkViewStates_.forEach(WA);
|
|
2088
2098
|
return;
|
|
2089
2099
|
}
|
|
2090
2100
|
const s = XB();
|
|
2091
|
-
|
|
2101
|
+
aQ(s, B.min, B.max, 0.5);
|
|
2092
2102
|
const h = this.makeViewBounds3D(B, o);
|
|
2093
|
-
this.chunkViewStates_.forEach(
|
|
2103
|
+
this.chunkViewStates_.forEach(WA);
|
|
2094
2104
|
const t = this.channelsOfInterest(A), y = this.fallbackLOD(), n = this.getPaddedBounds(h), F = this.currentLOD_ === y ? [this.currentLOD_] : [this.currentLOD_, y];
|
|
2095
2105
|
for (const G of F) {
|
|
2096
2106
|
const J = G === this.currentLOD_, U = G === y;
|
|
@@ -2130,10 +2140,10 @@ class cQ {
|
|
|
2130
2140
|
k.warn(
|
|
2131
2141
|
"ChunkStoreView",
|
|
2132
2142
|
"updateChunksForVolume called with no chunks initialized"
|
|
2133
|
-
), this.chunkViewStates_.forEach(
|
|
2143
|
+
), this.chunkViewStates_.forEach(WA);
|
|
2134
2144
|
return;
|
|
2135
2145
|
}
|
|
2136
|
-
this.currentLOD_ = this.policy_.lod.min, this.chunkViewStates_.forEach(
|
|
2146
|
+
this.currentLOD_ = this.policy_.lod.min, this.chunkViewStates_.forEach(WA);
|
|
2137
2147
|
const Q = this.channelsOfInterest(A), E = this.fallbackLOD(), i = (o) => {
|
|
2138
2148
|
const a = o.lod === E, D = o.lod === this.currentLOD_, s = this.computePriority(
|
|
2139
2149
|
a,
|
|
@@ -2177,10 +2187,10 @@ class cQ {
|
|
|
2177
2187
|
I && (I.visible || I.prefetch || I.priority !== null) || this.chunkViewStates_.delete(A);
|
|
2178
2188
|
}
|
|
2179
2189
|
dispose() {
|
|
2180
|
-
this.isDisposed_ = !0, this.chunkViewStates_.forEach(
|
|
2190
|
+
this.isDisposed_ = !0, this.chunkViewStates_.forEach(WA);
|
|
2181
2191
|
}
|
|
2182
2192
|
setImageSourcePolicy(A, I) {
|
|
2183
|
-
if (I !==
|
|
2193
|
+
if (I !== MI)
|
|
2184
2194
|
throw new Error("Unauthorized policy mutation");
|
|
2185
2195
|
this.policy_ !== A && (this.policy_ = A, this.policyChanged_ = !0, k.info(
|
|
2186
2196
|
"ChunkStoreView",
|
|
@@ -2298,7 +2308,7 @@ class cQ {
|
|
|
2298
2308
|
}
|
|
2299
2309
|
timeIndex(A) {
|
|
2300
2310
|
const I = this.store_.dimensions.t;
|
|
2301
|
-
return A.t === void 0 || I === void 0 ? 0 :
|
|
2311
|
+
return A.t === void 0 || I === void 0 ? 0 : cQ(I.lods[0], A.t);
|
|
2302
2312
|
}
|
|
2303
2313
|
getSliceAxisBounds(A) {
|
|
2304
2314
|
const I = this.store_.dimensions[this.axes_.w];
|
|
@@ -2323,13 +2333,13 @@ class cQ {
|
|
|
2323
2333
|
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
2334
|
}
|
|
2325
2335
|
viewBounds2DChanged(A) {
|
|
2326
|
-
return this.lastViewBounds2D_ === null || !
|
|
2336
|
+
return this.lastViewBounds2D_ === null || !uI(this.lastViewBounds2D_.min, A.min) || !uI(this.lastViewBounds2D_.max, A.max);
|
|
2327
2337
|
}
|
|
2328
2338
|
hasViewProjectionChanged(A) {
|
|
2329
|
-
return this.lastViewProjection_ === null || !
|
|
2339
|
+
return this.lastViewProjection_ === null || !XC(this.lastViewProjection_, A);
|
|
2330
2340
|
}
|
|
2331
2341
|
sliceBoundsChanged(A) {
|
|
2332
|
-
return !this.lastSliceBounds_ || !
|
|
2342
|
+
return !this.lastSliceBounds_ || !uI(this.lastSliceBounds_, A);
|
|
2333
2343
|
}
|
|
2334
2344
|
cCoordsChanged(A) {
|
|
2335
2345
|
return !this.lastCCoords_ && !A ? !1 : !this.lastCCoords_ || !A || this.lastCCoords_.length !== A.length ? !0 : !this.lastCCoords_.every((I, B) => I === A[B]);
|
|
@@ -2349,10 +2359,10 @@ class cQ {
|
|
|
2349
2359
|
return E * E + i * i;
|
|
2350
2360
|
}
|
|
2351
2361
|
}
|
|
2352
|
-
function
|
|
2362
|
+
function WA(g) {
|
|
2353
2363
|
g.visible = !1, g.prefetch = !1, g.priority = null, g.orderKey = null;
|
|
2354
2364
|
}
|
|
2355
|
-
class
|
|
2365
|
+
class kQ {
|
|
2356
2366
|
// Chunks indexed as chunks_[lod][t][c][z][y][x].
|
|
2357
2367
|
chunks_;
|
|
2358
2368
|
lowestResLOD_;
|
|
@@ -2432,7 +2442,7 @@ class UQ {
|
|
|
2432
2442
|
return this.lowestResLOD_;
|
|
2433
2443
|
}
|
|
2434
2444
|
addView(A, I) {
|
|
2435
|
-
const B = new
|
|
2445
|
+
const B = new UQ(this, A, I);
|
|
2436
2446
|
return this.views_.push(B), this.hasHadViews_ = !0, B;
|
|
2437
2447
|
}
|
|
2438
2448
|
get views() {
|
|
@@ -2546,8 +2556,8 @@ class rg extends Fg {
|
|
|
2546
2556
|
return B.unpackAlignment = A.rowAlignmentBytes, B;
|
|
2547
2557
|
}
|
|
2548
2558
|
}
|
|
2549
|
-
const
|
|
2550
|
-
class
|
|
2559
|
+
const LQ = 8, JQ = 4;
|
|
2560
|
+
class YQ {
|
|
2551
2561
|
stores_ = [];
|
|
2552
2562
|
queue_;
|
|
2553
2563
|
uploadTexture_;
|
|
@@ -2556,8 +2566,8 @@ class JQ {
|
|
|
2556
2566
|
memoryLimitBytes_;
|
|
2557
2567
|
maxGpuUploadsPerUpdate_;
|
|
2558
2568
|
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
|
|
2569
|
+
constructor(A, I, B = () => 0, C = 1 / 0, Q = LQ, E = JQ) {
|
|
2570
|
+
this.uploadTexture_ = A, this.disposeTexture_ = I, this.getGpuResidentBytes_ = B, this.memoryLimitBytes_ = C, this.maxGpuUploadsPerUpdate_ = Math.max(1, E), this.queue_ = new rQ(Q);
|
|
2561
2571
|
}
|
|
2562
2572
|
get memoryLimitBytes() {
|
|
2563
2573
|
return this.memoryLimitBytes_;
|
|
@@ -2572,11 +2582,11 @@ class JQ {
|
|
|
2572
2582
|
};
|
|
2573
2583
|
}
|
|
2574
2584
|
get memoryStats() {
|
|
2575
|
-
return
|
|
2585
|
+
return RQ();
|
|
2576
2586
|
}
|
|
2577
2587
|
addView(A, I, B) {
|
|
2578
2588
|
let C = this.stores_.find((Q) => Q.source === A)?.store;
|
|
2579
|
-
return C || (C = new
|
|
2589
|
+
return C || (C = new kQ(A.loader.getSourceDimensionMap()), this.stores_.push({ source: A, store: C })), C.addView(I, B);
|
|
2580
2590
|
}
|
|
2581
2591
|
update() {
|
|
2582
2592
|
const A = [];
|
|
@@ -2599,7 +2609,7 @@ class JQ {
|
|
|
2599
2609
|
}
|
|
2600
2610
|
enqueueWithinBudget(A) {
|
|
2601
2611
|
if (A.length === 0) return;
|
|
2602
|
-
A.sort((C, Q) =>
|
|
2612
|
+
A.sort((C, Q) => bA(C.chunk, Q.chunk));
|
|
2603
2613
|
let I = this.getGpuResidentBytes_(), B = null;
|
|
2604
2614
|
for (const { source: C, chunk: Q } of A) {
|
|
2605
2615
|
const E = this.chunkBytes(C, Q);
|
|
@@ -2619,14 +2629,14 @@ class JQ {
|
|
|
2619
2629
|
for (const I of this.resident_)
|
|
2620
2630
|
I.visible || A.push(I);
|
|
2621
2631
|
return A.sort((I, B) => {
|
|
2622
|
-
const C = -
|
|
2632
|
+
const C = -bA(I, B);
|
|
2623
2633
|
return C !== 0 ? C : (I.releasedAt ?? 0) - (B.releasedAt ?? 0);
|
|
2624
2634
|
});
|
|
2625
2635
|
}
|
|
2626
2636
|
evictWorseChunks(A, I, B, C) {
|
|
2627
|
-
for (; A + I > this.memoryLimitBytes_ && C.length > 0 &&
|
|
2637
|
+
for (; A + I > this.memoryLimitBytes_ && C.length > 0 && bA(C[0], B) > 0; ) {
|
|
2628
2638
|
const Q = C.shift();
|
|
2629
|
-
Q.texture !== void 0 && (A -=
|
|
2639
|
+
Q.texture !== void 0 && (A -= $I(Q.texture), this.disposeChunkTexture(Q), Q.state = "unloaded", Q.releasedAt = void 0);
|
|
2630
2640
|
}
|
|
2631
2641
|
return A;
|
|
2632
2642
|
}
|
|
@@ -2640,7 +2650,7 @@ class JQ {
|
|
|
2640
2650
|
for (const C of A)
|
|
2641
2651
|
C.state === "loaded" && C.texture === void 0 && I.push(C);
|
|
2642
2652
|
if (I.length === 0) return;
|
|
2643
|
-
I.sort(
|
|
2653
|
+
I.sort(bA);
|
|
2644
2654
|
const B = Math.min(I.length, this.maxGpuUploadsPerUpdate_);
|
|
2645
2655
|
for (let C = 0; C < B; C++) {
|
|
2646
2656
|
const Q = I[C], E = rg.createWithChunk(Q);
|
|
@@ -2651,7 +2661,7 @@ class JQ {
|
|
|
2651
2661
|
this.disposeTexture_ && A.texture !== void 0 && (this.disposeTexture_(A.texture), A.texture = void 0, this.resident_.delete(A));
|
|
2652
2662
|
}
|
|
2653
2663
|
}
|
|
2654
|
-
var
|
|
2664
|
+
var OA = function(g = 1) {
|
|
2655
2665
|
var A = 0, I = document.createElement("div");
|
|
2656
2666
|
I.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000", I.addEventListener("click", function(s) {
|
|
2657
2667
|
s.preventDefault(), C(++A % I.children.length);
|
|
@@ -2664,9 +2674,9 @@ var VA = function(g = 1) {
|
|
|
2664
2674
|
I.children[h].style.display = h === s ? "block" : "none";
|
|
2665
2675
|
A = s;
|
|
2666
2676
|
}
|
|
2667
|
-
var Q = (performance || Date).now(), E = Q, i = 0, o = B(new
|
|
2677
|
+
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
2678
|
if (self.performance && self.performance.memory)
|
|
2669
|
-
var D = B(new
|
|
2679
|
+
var D = B(new OA.Panel("MB", "#f08", "#201", g));
|
|
2670
2680
|
return C(0), {
|
|
2671
2681
|
REVISION: 16,
|
|
2672
2682
|
dom: I,
|
|
@@ -2692,7 +2702,7 @@ var VA = function(g = 1) {
|
|
|
2692
2702
|
setMode: C
|
|
2693
2703
|
};
|
|
2694
2704
|
};
|
|
2695
|
-
|
|
2705
|
+
OA.Panel = function(g, A, I, B) {
|
|
2696
2706
|
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
2707
|
F.width = o, F.height = a, F.style.cssText = `width:${E(B * 80)}px;height:${E(B * 48)}px`;
|
|
2698
2708
|
var G = F.getContext("2d");
|
|
@@ -2703,24 +2713,24 @@ VA.Panel = function(g, A, I, B) {
|
|
|
2703
2713
|
}
|
|
2704
2714
|
};
|
|
2705
2715
|
};
|
|
2706
|
-
function
|
|
2707
|
-
const A = new
|
|
2716
|
+
function MQ({ scale: g } = { scale: 1.5 }) {
|
|
2717
|
+
const A = new OA(g);
|
|
2708
2718
|
return A.showPanel(
|
|
2709
2719
|
0
|
|
2710
2720
|
/* 0 = fps, 1 = ms, 2 = mb */
|
|
2711
2721
|
), document.body.appendChild(A.dom), A;
|
|
2712
2722
|
}
|
|
2713
|
-
const
|
|
2723
|
+
const Ag = [
|
|
2714
2724
|
"pointerdown",
|
|
2715
2725
|
"pointermove",
|
|
2716
2726
|
"pointerup",
|
|
2717
2727
|
"pointercancel",
|
|
2718
2728
|
"wheel"
|
|
2719
2729
|
];
|
|
2720
|
-
function
|
|
2721
|
-
return
|
|
2730
|
+
function dQ(g) {
|
|
2731
|
+
return Ag.includes(g);
|
|
2722
2732
|
}
|
|
2723
|
-
class
|
|
2733
|
+
class KQ {
|
|
2724
2734
|
propagationStopped_ = !1;
|
|
2725
2735
|
type;
|
|
2726
2736
|
event;
|
|
@@ -2737,7 +2747,7 @@ class dQ {
|
|
|
2737
2747
|
this.propagationStopped_ = !0;
|
|
2738
2748
|
}
|
|
2739
2749
|
}
|
|
2740
|
-
class
|
|
2750
|
+
class HQ {
|
|
2741
2751
|
listeners_ = [];
|
|
2742
2752
|
element_;
|
|
2743
2753
|
isConnected_ = !1;
|
|
@@ -2762,7 +2772,7 @@ class KQ {
|
|
|
2762
2772
|
);
|
|
2763
2773
|
return;
|
|
2764
2774
|
}
|
|
2765
|
-
this.isConnected_ = !0,
|
|
2775
|
+
this.isConnected_ = !0, Ag.forEach((A) => {
|
|
2766
2776
|
this.element_.addEventListener(A, this.handleEvent, {
|
|
2767
2777
|
passive: !1
|
|
2768
2778
|
});
|
|
@@ -2777,22 +2787,22 @@ class KQ {
|
|
|
2777
2787
|
);
|
|
2778
2788
|
return;
|
|
2779
2789
|
}
|
|
2780
|
-
this.isConnected_ = !1,
|
|
2790
|
+
this.isConnected_ = !1, Ag.forEach((A) => {
|
|
2781
2791
|
this.element_.removeEventListener(A, this.handleEvent);
|
|
2782
2792
|
});
|
|
2783
2793
|
}
|
|
2784
2794
|
handleEvent = (A) => {
|
|
2785
|
-
if (!
|
|
2795
|
+
if (!dQ(A.type)) {
|
|
2786
2796
|
k.error("EventDispatcher", `Unsupported event type ${A.type}`);
|
|
2787
2797
|
return;
|
|
2788
2798
|
}
|
|
2789
|
-
const I = new
|
|
2799
|
+
const I = new KQ(A.type, A);
|
|
2790
2800
|
for (const B of this.listeners_)
|
|
2791
2801
|
if (B(I), I.propagationStopped) break;
|
|
2792
2802
|
};
|
|
2793
2803
|
}
|
|
2794
|
-
const
|
|
2795
|
-
class
|
|
2804
|
+
const qQ = 1e-12;
|
|
2805
|
+
class lQ {
|
|
2796
2806
|
origin;
|
|
2797
2807
|
direction;
|
|
2798
2808
|
constructor(A, I) {
|
|
@@ -2800,13 +2810,13 @@ class qQ {
|
|
|
2800
2810
|
}
|
|
2801
2811
|
intersectWithPlane(A) {
|
|
2802
2812
|
const I = aI(this.direction, A.normal);
|
|
2803
|
-
if (Math.abs(I) <
|
|
2813
|
+
if (Math.abs(I) < qQ)
|
|
2804
2814
|
return null;
|
|
2805
2815
|
const B = -A.signedDistanceToPoint(this.origin) / I;
|
|
2806
|
-
return
|
|
2816
|
+
return zI(d(), this.origin, this.direction, B);
|
|
2807
2817
|
}
|
|
2808
2818
|
}
|
|
2809
|
-
class
|
|
2819
|
+
class fQ {
|
|
2810
2820
|
id;
|
|
2811
2821
|
element;
|
|
2812
2822
|
camera;
|
|
@@ -2818,12 +2828,12 @@ class lQ {
|
|
|
2818
2828
|
context_;
|
|
2819
2829
|
layers_ = [];
|
|
2820
2830
|
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
|
|
2831
|
+
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
2832
|
if (I.event instanceof PointerEvent || I.event instanceof WheelEvent) {
|
|
2823
2833
|
const { clientX: B, clientY: C } = I.event, Q = V(B, C);
|
|
2824
2834
|
I.clipPos = this.clientToClip(Q, 0), I.worldPos = this.camera.clipToWorld(I.clipPos);
|
|
2825
2835
|
const E = this.camera.clipToWorld(this.clientToClip(Q, -1)), i = this.camera.clipToWorld(this.clientToClip(Q, 1));
|
|
2826
|
-
I.worldRay = new
|
|
2836
|
+
I.worldRay = new lQ(E, yg(d(), i, E));
|
|
2827
2837
|
}
|
|
2828
2838
|
for (const B of this.layers_)
|
|
2829
2839
|
if (B.onEvent(I), I.propagationStopped) return;
|
|
@@ -2908,7 +2918,7 @@ function zB(g, A) {
|
|
|
2908
2918
|
}
|
|
2909
2919
|
}
|
|
2910
2920
|
}
|
|
2911
|
-
function
|
|
2921
|
+
function pQ(g) {
|
|
2912
2922
|
for (let A = 0; A < g.length; A++)
|
|
2913
2923
|
zB(g[A], g.slice(0, A));
|
|
2914
2924
|
}
|
|
@@ -2922,9 +2932,9 @@ function $g(g, A, I) {
|
|
|
2922
2932
|
context: I
|
|
2923
2933
|
};
|
|
2924
2934
|
});
|
|
2925
|
-
return
|
|
2935
|
+
return pQ(B), B.map((C) => new fQ(C));
|
|
2926
2936
|
}
|
|
2927
|
-
class
|
|
2937
|
+
class mQ {
|
|
2928
2938
|
elements_;
|
|
2929
2939
|
resizeObserver_;
|
|
2930
2940
|
mediaQuery_;
|
|
@@ -2983,7 +2993,7 @@ class pQ {
|
|
|
2983
2993
|
this.elements_.splice(I, 1), this.resizeObserver_ && this.resizeObserver_.unobserve(A);
|
|
2984
2994
|
}
|
|
2985
2995
|
}
|
|
2986
|
-
const
|
|
2996
|
+
const uQ = 2048;
|
|
2987
2997
|
class to {
|
|
2988
2998
|
chunkManager_;
|
|
2989
2999
|
context_;
|
|
@@ -3044,9 +3054,9 @@ class to {
|
|
|
3044
3054
|
* @throws {Error} If viewports have duplicate IDs or shared elements
|
|
3045
3055
|
*/
|
|
3046
3056
|
constructor(A) {
|
|
3047
|
-
this.canvas = A.canvas, this.renderer_ = new
|
|
3048
|
-
const B = (A.memoryLimitMB ??
|
|
3049
|
-
this.chunkManager_ = new
|
|
3057
|
+
this.canvas = A.canvas, this.renderer_ = new FQ(this.canvas);
|
|
3058
|
+
const B = (A.memoryLimitMB ?? uQ) * 1024 * 1024;
|
|
3059
|
+
this.chunkManager_ = new YQ(
|
|
3050
3060
|
(Q) => this.renderer_.uploadTexture(Q),
|
|
3051
3061
|
(Q) => this.renderer_.disposeTexture(Q),
|
|
3052
3062
|
() => this.renderer_.gpuTextureBytes,
|
|
@@ -3059,11 +3069,11 @@ class to {
|
|
|
3059
3069
|
A.viewports ?? [],
|
|
3060
3070
|
this.canvas,
|
|
3061
3071
|
this.context_
|
|
3062
|
-
), this.overlays = [...A.overlays ?? []], A.showStats && (this.stats_ =
|
|
3072
|
+
), this.overlays = [...A.overlays ?? []], A.showStats && (this.stats_ = MQ());
|
|
3063
3073
|
const C = [this.canvas];
|
|
3064
3074
|
for (const Q of this.viewports_)
|
|
3065
3075
|
Q.element !== this.canvas && C.push(Q.element);
|
|
3066
|
-
this.sizeObserver_ = new
|
|
3076
|
+
this.sizeObserver_ = new mQ(C, () => {
|
|
3067
3077
|
this.renderer_.updateSize(), this.renderer_.beginFrame();
|
|
3068
3078
|
for (const Q of this.viewports_)
|
|
3069
3079
|
Q.updateSize(), this.renderer_.render(Q);
|
|
@@ -3157,7 +3167,7 @@ class to {
|
|
|
3157
3167
|
}
|
|
3158
3168
|
}
|
|
3159
3169
|
}
|
|
3160
|
-
function
|
|
3170
|
+
function TQ(g, A) {
|
|
3161
3171
|
return {
|
|
3162
3172
|
...g,
|
|
3163
3173
|
...A,
|
|
@@ -3180,7 +3190,7 @@ async function IB(g) {
|
|
|
3180
3190
|
throw new Error(`Unexpected response status ${g.status} ${g.statusText}`);
|
|
3181
3191
|
}
|
|
3182
3192
|
}
|
|
3183
|
-
class
|
|
3193
|
+
class _A {
|
|
3184
3194
|
url;
|
|
3185
3195
|
#A;
|
|
3186
3196
|
#I;
|
|
@@ -3189,7 +3199,7 @@ class $A {
|
|
|
3189
3199
|
this.url = A, this.#A = I.fetch ?? ((B) => fetch(B)), this.#I = I.overrides ?? {}, this.#g = I.useSuffixRequest ?? !1;
|
|
3190
3200
|
}
|
|
3191
3201
|
#B(A, I) {
|
|
3192
|
-
return new Request(A,
|
|
3202
|
+
return new Request(A, TQ(this.#I, I));
|
|
3193
3203
|
}
|
|
3194
3204
|
async get(A, I = {}) {
|
|
3195
3205
|
let B = AB(this.url, A).href, C = this.#B(B, I), Q = await this.#A(C);
|
|
@@ -3235,9 +3245,9 @@ class $A {
|
|
|
3235
3245
|
return this.#A(this.#B(A, a));
|
|
3236
3246
|
}
|
|
3237
3247
|
}
|
|
3238
|
-
class
|
|
3248
|
+
class $A extends Error {
|
|
3239
3249
|
}
|
|
3240
|
-
class uA extends
|
|
3250
|
+
class uA extends $A {
|
|
3241
3251
|
_tag = "NotFoundError";
|
|
3242
3252
|
name = "NotFoundError";
|
|
3243
3253
|
path;
|
|
@@ -3246,7 +3256,7 @@ class uA extends AI {
|
|
|
3246
3256
|
super(`Not found: ${A}`, { cause: I.cause }), this.path = I.path, this.found = I.found;
|
|
3247
3257
|
}
|
|
3248
3258
|
}
|
|
3249
|
-
class v extends
|
|
3259
|
+
class v extends $A {
|
|
3250
3260
|
_tag = "InvalidMetadataError";
|
|
3251
3261
|
name = "InvalidMetadataError";
|
|
3252
3262
|
path;
|
|
@@ -3254,7 +3264,7 @@ class v extends AI {
|
|
|
3254
3264
|
super(A, { cause: I.cause }), this.path = I.path;
|
|
3255
3265
|
}
|
|
3256
3266
|
}
|
|
3257
|
-
class
|
|
3267
|
+
class xQ extends $A {
|
|
3258
3268
|
_tag = "UnknownCodecError";
|
|
3259
3269
|
name = "UnknownCodecError";
|
|
3260
3270
|
codec;
|
|
@@ -3262,7 +3272,7 @@ class TQ extends AI {
|
|
|
3262
3272
|
super(`Unknown codec: ${A}`), this.codec = A;
|
|
3263
3273
|
}
|
|
3264
3274
|
}
|
|
3265
|
-
class
|
|
3275
|
+
class WQ extends $A {
|
|
3266
3276
|
_tag = "CodecPipelineError";
|
|
3267
3277
|
name = "CodecPipelineError";
|
|
3268
3278
|
direction;
|
|
@@ -3277,7 +3287,7 @@ class xQ extends AI {
|
|
|
3277
3287
|
super(I.join(" "), { cause: A.cause }), this.direction = A.direction, this.codec = A.codec, this.chunkPath = A.chunkPath;
|
|
3278
3288
|
}
|
|
3279
3289
|
}
|
|
3280
|
-
class Sg extends
|
|
3290
|
+
class Sg extends $A {
|
|
3281
3291
|
_tag = "UnsupportedError";
|
|
3282
3292
|
name = "UnsupportedError";
|
|
3283
3293
|
feature;
|
|
@@ -3396,7 +3406,7 @@ class Ng {
|
|
|
3396
3406
|
yield this.get(A);
|
|
3397
3407
|
}
|
|
3398
3408
|
}
|
|
3399
|
-
class
|
|
3409
|
+
class AI {
|
|
3400
3410
|
#A;
|
|
3401
3411
|
chars;
|
|
3402
3412
|
constructor(A, I, B, C) {
|
|
@@ -3405,7 +3415,7 @@ class II {
|
|
|
3405
3415
|
else if (Rg(I))
|
|
3406
3416
|
C && (C *= A), this.#A = new Int32Array(I, B, C);
|
|
3407
3417
|
else {
|
|
3408
|
-
const Q = I, E = new
|
|
3418
|
+
const Q = I, E = new AI(A, 1);
|
|
3409
3419
|
this.#A = new Int32Array((function* () {
|
|
3410
3420
|
for (let i of Q)
|
|
3411
3421
|
E.set(0, i), yield* E.#A;
|
|
@@ -3451,14 +3461,14 @@ class II {
|
|
|
3451
3461
|
yield this.get(A);
|
|
3452
3462
|
}
|
|
3453
3463
|
}
|
|
3454
|
-
function
|
|
3464
|
+
function bQ() {
|
|
3455
3465
|
if (typeof SharedArrayBuffer > "u")
|
|
3456
3466
|
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
3467
|
}
|
|
3458
|
-
function
|
|
3468
|
+
function ZQ(g, A) {
|
|
3459
3469
|
return new SharedArrayBuffer(g);
|
|
3460
3470
|
}
|
|
3461
|
-
function
|
|
3471
|
+
function II(g) {
|
|
3462
3472
|
const A = new TextDecoder().decode(g);
|
|
3463
3473
|
try {
|
|
3464
3474
|
return JSON.parse(A);
|
|
@@ -3479,7 +3489,7 @@ function TA(g) {
|
|
|
3479
3489
|
let A = g.match(/v2:([US])(\d+)/);
|
|
3480
3490
|
if (A) {
|
|
3481
3491
|
let [, B, C] = A;
|
|
3482
|
-
return (B === "U" ?
|
|
3492
|
+
return (B === "U" ? AI : Ng).bind(null, Number(C));
|
|
3483
3493
|
}
|
|
3484
3494
|
if (g === "string")
|
|
3485
3495
|
return globalThis.Array;
|
|
@@ -3509,7 +3519,7 @@ function RA(g, A) {
|
|
|
3509
3519
|
C[A[Q]] = B, B *= g[A[Q]];
|
|
3510
3520
|
return C;
|
|
3511
3521
|
}
|
|
3512
|
-
function
|
|
3522
|
+
function PQ({ name: g, configuration: A }) {
|
|
3513
3523
|
if (g === "default") {
|
|
3514
3524
|
const I = A?.separator ?? "/";
|
|
3515
3525
|
return (B) => ["c", ...B].join(I);
|
|
@@ -3544,15 +3554,15 @@ function BB(g) {
|
|
|
3544
3554
|
throw new v(`Unsupported or unknown dtype: ${g}`);
|
|
3545
3555
|
return I === "|" ? { dataType: C } : { dataType: C, endian: I === "<" ? "little" : "big" };
|
|
3546
3556
|
}
|
|
3547
|
-
function
|
|
3557
|
+
function OQ(g) {
|
|
3548
3558
|
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
3559
|
}
|
|
3550
|
-
function
|
|
3560
|
+
function VQ(g, A = {}) {
|
|
3551
3561
|
let I = [], B = BB(g.dtype);
|
|
3552
3562
|
g.order === "F" && I.push({ name: "transpose", configuration: { order: "F" } });
|
|
3553
3563
|
for (let Q of g.filters ?? []) {
|
|
3554
3564
|
if (Q.id === "fixedscaleoffset" || Q.id === "numcodecs.fixedscaleoffset") {
|
|
3555
|
-
if (!
|
|
3565
|
+
if (!OQ(Q))
|
|
3556
3566
|
throw new v(`Invalid fixedscaleoffset filter: ${JSON.stringify(Q)}`);
|
|
3557
3567
|
I.push({
|
|
3558
3568
|
name: "scale_offset",
|
|
@@ -3564,7 +3574,7 @@ function OQ(g, A = {}) {
|
|
|
3564
3574
|
let o = Q.astype ?? Q.dtype;
|
|
3565
3575
|
if (o !== void 0 && o !== g.dtype) {
|
|
3566
3576
|
let a = BB(o).dataType;
|
|
3567
|
-
if (!
|
|
3577
|
+
if (!Ig(a, "number") && !Ig(a, "bigint"))
|
|
3568
3578
|
throw new v(`fixedscaleoffset astype must be a numeric data type, got ${o}`);
|
|
3569
3579
|
I.push({
|
|
3570
3580
|
name: "cast_value",
|
|
@@ -3610,14 +3620,14 @@ function OQ(g, A = {}) {
|
|
|
3610
3620
|
attributes: A
|
|
3611
3621
|
};
|
|
3612
3622
|
}
|
|
3613
|
-
function
|
|
3623
|
+
function vQ(g, A = {}) {
|
|
3614
3624
|
return {
|
|
3615
3625
|
zarr_format: 3,
|
|
3616
3626
|
node_type: "group",
|
|
3617
3627
|
attributes: A
|
|
3618
3628
|
};
|
|
3619
3629
|
}
|
|
3620
|
-
function
|
|
3630
|
+
function Ig(g, A) {
|
|
3621
3631
|
if (A !== "number" && A !== "bigint" && A !== "boolean" && A !== "object" && A !== "string")
|
|
3622
3632
|
return g === A;
|
|
3623
3633
|
let I = g === "bool";
|
|
@@ -3632,7 +3642,7 @@ function Ag(g, A) {
|
|
|
3632
3642
|
let Q = g === "v2:object";
|
|
3633
3643
|
return A === "object" ? Q : !B && !C && !I && !Q;
|
|
3634
3644
|
}
|
|
3635
|
-
function
|
|
3645
|
+
function XQ(g) {
|
|
3636
3646
|
return g?.name === "sharding_indexed";
|
|
3637
3647
|
}
|
|
3638
3648
|
function $B(g) {
|
|
@@ -3673,15 +3683,15 @@ async function IC(g, { format: A, signal: I }) {
|
|
|
3673
3683
|
throw I?.throwIfAborted(), new Error(`Failed to decode ${A}`);
|
|
3674
3684
|
}
|
|
3675
3685
|
}
|
|
3676
|
-
const CB =
|
|
3677
|
-
function
|
|
3686
|
+
const CB = jQ();
|
|
3687
|
+
function jQ() {
|
|
3678
3688
|
const g = new Uint32Array([305419896]);
|
|
3679
3689
|
return new Uint8Array(g.buffer, g.byteOffset, g.byteLength)[0] !== 18;
|
|
3680
3690
|
}
|
|
3681
3691
|
function QB(g) {
|
|
3682
3692
|
return "BYTES_PER_ELEMENT" in g ? g.BYTES_PER_ELEMENT : 4;
|
|
3683
3693
|
}
|
|
3684
|
-
class
|
|
3694
|
+
class dI {
|
|
3685
3695
|
kind = "array_to_bytes";
|
|
3686
3696
|
#A;
|
|
3687
3697
|
#I;
|
|
@@ -3694,7 +3704,7 @@ class MI {
|
|
|
3694
3704
|
this.#g = B.BYTES_PER_ELEMENT;
|
|
3695
3705
|
}
|
|
3696
3706
|
static fromConfig(A, I) {
|
|
3697
|
-
return new
|
|
3707
|
+
return new dI(A, I);
|
|
3698
3708
|
}
|
|
3699
3709
|
encode(A) {
|
|
3700
3710
|
let I = new Uint8Array(A.data.buffer);
|
|
@@ -3723,10 +3733,10 @@ const EB = {
|
|
|
3723
3733
|
function eI(g) {
|
|
3724
3734
|
return g in gC;
|
|
3725
3735
|
}
|
|
3726
|
-
function
|
|
3736
|
+
function gg(g) {
|
|
3727
3737
|
return g === "int64" || g === "uint64";
|
|
3728
3738
|
}
|
|
3729
|
-
function
|
|
3739
|
+
function zQ(g, A) {
|
|
3730
3740
|
const I = BigInt(g), B = new ArrayBuffer(A), C = new DataView(B);
|
|
3731
3741
|
if (A === 2) {
|
|
3732
3742
|
if (typeof C.getFloat16 != "function")
|
|
@@ -3736,7 +3746,7 @@ function jQ(g, A) {
|
|
|
3736
3746
|
return A === 4 ? (C.setUint32(0, Number(I)), C.getFloat32(0)) : (C.setBigUint64(0, I), C.getFloat64(0));
|
|
3737
3747
|
}
|
|
3738
3748
|
function nI(g, A) {
|
|
3739
|
-
if (
|
|
3749
|
+
if (gg(g)) {
|
|
3740
3750
|
if (typeof A != "number" || !Number.isInteger(A))
|
|
3741
3751
|
throw new v(`Expected an integer value for data type "${g}", got ${JSON.stringify(A)}`);
|
|
3742
3752
|
return BigInt(A);
|
|
@@ -3748,7 +3758,7 @@ function nI(g, A) {
|
|
|
3748
3758
|
}
|
|
3749
3759
|
if (!eI(g))
|
|
3750
3760
|
throw new v(`String-encoded scalar "${A}" is not valid for non-float data type "${g}"`);
|
|
3751
|
-
return A in EB ? EB[A] :
|
|
3761
|
+
return A in EB ? EB[A] : zQ(A, gC[g]);
|
|
3752
3762
|
}
|
|
3753
3763
|
const iB = /* @__PURE__ */ new Set([
|
|
3754
3764
|
"int8",
|
|
@@ -3762,14 +3772,14 @@ const iB = /* @__PURE__ */ new Set([
|
|
|
3762
3772
|
"float16",
|
|
3763
3773
|
"float32",
|
|
3764
3774
|
"float64"
|
|
3765
|
-
]),
|
|
3775
|
+
]), TI = {
|
|
3766
3776
|
int8: [-128, 2 ** 7 - 1],
|
|
3767
3777
|
uint8: [0, 2 ** 8 - 1],
|
|
3768
3778
|
int16: [-32768, 2 ** 15 - 1],
|
|
3769
3779
|
uint16: [0, 2 ** 16 - 1],
|
|
3770
3780
|
int32: [-2147483648, 2 ** 31 - 1],
|
|
3771
3781
|
uint32: [0, 2 ** 32 - 1]
|
|
3772
|
-
},
|
|
3782
|
+
}, xI = {
|
|
3773
3783
|
int64: [-(2n ** 63n), 2n ** 63n - 1n],
|
|
3774
3784
|
uint64: [0n, 2n ** 64n - 1n]
|
|
3775
3785
|
};
|
|
@@ -3779,7 +3789,7 @@ function oB(g, A, I) {
|
|
|
3779
3789
|
tgt: nI(I, C)
|
|
3780
3790
|
}));
|
|
3781
3791
|
}
|
|
3782
|
-
function
|
|
3792
|
+
function _Q(g, A) {
|
|
3783
3793
|
for (const I of A)
|
|
3784
3794
|
if (typeof I.src == "number" && Number.isNaN(I.src)) {
|
|
3785
3795
|
if (typeof g == "number" && Number.isNaN(g))
|
|
@@ -3787,7 +3797,7 @@ function zQ(g, A) {
|
|
|
3787
3797
|
} else if (g === I.src)
|
|
3788
3798
|
return I.tgt;
|
|
3789
3799
|
}
|
|
3790
|
-
function
|
|
3800
|
+
function $Q(g) {
|
|
3791
3801
|
if (!Number.isFinite(g))
|
|
3792
3802
|
return g;
|
|
3793
3803
|
if (Math.abs(g - Math.trunc(g)) === 0.5) {
|
|
@@ -3796,13 +3806,13 @@ function _Q(g) {
|
|
|
3796
3806
|
}
|
|
3797
3807
|
return Math.round(g);
|
|
3798
3808
|
}
|
|
3799
|
-
function
|
|
3809
|
+
function AE(g) {
|
|
3800
3810
|
return Math.sign(g) * Math.floor(Math.abs(g) + 0.5);
|
|
3801
3811
|
}
|
|
3802
3812
|
function aB(g) {
|
|
3803
3813
|
switch (g) {
|
|
3804
3814
|
case "nearest-even":
|
|
3805
|
-
return
|
|
3815
|
+
return $Q;
|
|
3806
3816
|
case "towards-zero":
|
|
3807
3817
|
return Math.trunc;
|
|
3808
3818
|
case "towards-positive":
|
|
@@ -3810,10 +3820,10 @@ function aB(g) {
|
|
|
3810
3820
|
case "towards-negative":
|
|
3811
3821
|
return Math.floor;
|
|
3812
3822
|
case "nearest-away":
|
|
3813
|
-
return
|
|
3823
|
+
return AE;
|
|
3814
3824
|
}
|
|
3815
3825
|
}
|
|
3816
|
-
function
|
|
3826
|
+
function WI(g, A, I) {
|
|
3817
3827
|
const B = A - g + 1;
|
|
3818
3828
|
switch (I) {
|
|
3819
3829
|
case "clamp":
|
|
@@ -3828,7 +3838,7 @@ function xI(g, A, I) {
|
|
|
3828
3838
|
};
|
|
3829
3839
|
}
|
|
3830
3840
|
}
|
|
3831
|
-
function
|
|
3841
|
+
function bI(g, A, I) {
|
|
3832
3842
|
const B = A - g + 1n;
|
|
3833
3843
|
switch (I) {
|
|
3834
3844
|
case "clamp":
|
|
@@ -3875,21 +3885,21 @@ class cg {
|
|
|
3875
3885
|
}
|
|
3876
3886
|
}
|
|
3877
3887
|
function DB(g, A, I, B, C) {
|
|
3878
|
-
const Q = eI(g), E =
|
|
3888
|
+
const Q = eI(g), E = gg(g), i = eI(A), o = gg(A);
|
|
3879
3889
|
let a;
|
|
3880
3890
|
if (Q && i) {
|
|
3881
3891
|
if (I !== "nearest-even")
|
|
3882
3892
|
throw new v(`cast_value float -> float only supports "nearest-even" rounding, got "${I}"`);
|
|
3883
3893
|
a = (s) => s;
|
|
3884
3894
|
} else if (Q && !i && !o) {
|
|
3885
|
-
const s = aB(I), h =
|
|
3895
|
+
const s = aB(I), h = WI(...TI[A], B);
|
|
3886
3896
|
a = (t) => {
|
|
3887
3897
|
if (!Number.isFinite(t))
|
|
3888
3898
|
throw new Error(`Cannot cast ${t} to integer type without scalar_map`);
|
|
3889
3899
|
return h(s(t));
|
|
3890
3900
|
};
|
|
3891
3901
|
} else if (Q && o) {
|
|
3892
|
-
const s = aB(I), h =
|
|
3902
|
+
const s = aB(I), h = bI(...xI[A], B);
|
|
3893
3903
|
a = (t) => {
|
|
3894
3904
|
if (!Number.isFinite(t))
|
|
3895
3905
|
throw new Error(`Cannot cast ${t} to integer type without scalar_map`);
|
|
@@ -3900,19 +3910,19 @@ function DB(g, A, I, B, C) {
|
|
|
3900
3910
|
else if (E && i)
|
|
3901
3911
|
a = (s) => Number(s);
|
|
3902
3912
|
else if (!Q && !E && !i && !o)
|
|
3903
|
-
a =
|
|
3913
|
+
a = WI(...TI[A], B);
|
|
3904
3914
|
else if (!Q && !E && o) {
|
|
3905
|
-
const s =
|
|
3915
|
+
const s = bI(...xI[A], B);
|
|
3906
3916
|
a = (h) => s(BigInt(h));
|
|
3907
3917
|
} else if (E && !i && !o) {
|
|
3908
|
-
const s =
|
|
3918
|
+
const s = WI(...TI[A], B);
|
|
3909
3919
|
a = (h) => s(Number(h));
|
|
3910
3920
|
} else if (E && o)
|
|
3911
|
-
a =
|
|
3921
|
+
a = bI(...xI[A], B);
|
|
3912
3922
|
else
|
|
3913
3923
|
throw new Error(`Unhandled type combination: ${g} -> ${A}`);
|
|
3914
3924
|
return C.length === 0 ? a : (s) => {
|
|
3915
|
-
const h =
|
|
3925
|
+
const h = _Q(s, C);
|
|
3916
3926
|
return h !== void 0 ? h : a(s);
|
|
3917
3927
|
};
|
|
3918
3928
|
}
|
|
@@ -3929,7 +3939,7 @@ class Ug {
|
|
|
3929
3939
|
return A + 4;
|
|
3930
3940
|
}
|
|
3931
3941
|
}
|
|
3932
|
-
const
|
|
3942
|
+
const IE = /* @__PURE__ */ new Set([
|
|
3933
3943
|
"int8",
|
|
3934
3944
|
"uint8",
|
|
3935
3945
|
"int16",
|
|
@@ -3962,7 +3972,7 @@ class kg {
|
|
|
3962
3972
|
this.#A = A;
|
|
3963
3973
|
}
|
|
3964
3974
|
static fromConfig(A, I) {
|
|
3965
|
-
if (!
|
|
3975
|
+
if (!IE.has(I.dataType))
|
|
3966
3976
|
throw new v(`Delta codec does not support data type: ${I.dataType}`);
|
|
3967
3977
|
return new kg(TA(I.dataType));
|
|
3968
3978
|
}
|
|
@@ -3994,10 +4004,10 @@ class Lg {
|
|
|
3994
4004
|
return new Uint8Array(I);
|
|
3995
4005
|
}
|
|
3996
4006
|
}
|
|
3997
|
-
function
|
|
4007
|
+
function gE(g, A) {
|
|
3998
4008
|
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
4009
|
}
|
|
4000
|
-
function
|
|
4010
|
+
function BE(g, A) {
|
|
4001
4011
|
return A instanceof Object && !Array.isArray(A) ? Object.keys(A).sort().reduce((I, B) => (I[B] = A[B], I), {}) : A;
|
|
4002
4012
|
}
|
|
4003
4013
|
class GI {
|
|
@@ -4027,7 +4037,7 @@ class GI {
|
|
|
4027
4037
|
const { indent: I, encoding: B, ensure_ascii: C, check_circular: Q, allow_nan: E, sort_keys: i } = this.#A;
|
|
4028
4038
|
IA(B === "utf-8", "JsonCodec does not yet support non-utf-8 encoding.");
|
|
4029
4039
|
const o = [];
|
|
4030
|
-
IA(Q, "JsonCodec does not yet support skipping the check for circular references during encoding."), E || o.push(
|
|
4040
|
+
IA(Q, "JsonCodec does not yet support skipping the check for circular references during encoding."), E || o.push(gE), i && o.push(BE);
|
|
4031
4041
|
const a = Array.from(A.data);
|
|
4032
4042
|
a.push("|O"), a.push(A.shape);
|
|
4033
4043
|
let D;
|
|
@@ -4046,13 +4056,13 @@ class GI {
|
|
|
4046
4056
|
decode(A) {
|
|
4047
4057
|
const { strict: I } = this.#I;
|
|
4048
4058
|
IA(I, "JsonCodec does not yet support non-strict decoding.");
|
|
4049
|
-
const B =
|
|
4059
|
+
const B = II(A), C = B.pop();
|
|
4050
4060
|
B.pop(), IA(C, "0D not implemented for JsonCodec.");
|
|
4051
4061
|
const Q = RA(C, "C");
|
|
4052
4062
|
return { data: B, shape: C, stride: Q };
|
|
4053
4063
|
}
|
|
4054
4064
|
}
|
|
4055
|
-
const
|
|
4065
|
+
const CE = /* @__PURE__ */ new Set([
|
|
4056
4066
|
"int8",
|
|
4057
4067
|
"uint8",
|
|
4058
4068
|
"int16",
|
|
@@ -4074,7 +4084,7 @@ class Jg {
|
|
|
4074
4084
|
this.#I = A, this.#g = I, this.#A = B;
|
|
4075
4085
|
}
|
|
4076
4086
|
static fromConfig(A, I) {
|
|
4077
|
-
if (!
|
|
4087
|
+
if (!CE.has(I.dataType))
|
|
4078
4088
|
throw new v(`scale_offset codec does not support data type: ${I.dataType}`);
|
|
4079
4089
|
return new Jg(nI(I.dataType, A.scale ?? 1), nI(I.dataType, A.offset ?? 0), TA(I.dataType));
|
|
4080
4090
|
}
|
|
@@ -4100,20 +4110,20 @@ class Yg {
|
|
|
4100
4110
|
return new Yg(A, I);
|
|
4101
4111
|
}
|
|
4102
4112
|
encode(A) {
|
|
4103
|
-
return
|
|
4113
|
+
return QE(A, this.#A);
|
|
4104
4114
|
}
|
|
4105
4115
|
decode(A) {
|
|
4106
|
-
return
|
|
4116
|
+
return EE(A, this.#A);
|
|
4107
4117
|
}
|
|
4108
4118
|
}
|
|
4109
|
-
function
|
|
4119
|
+
function QE(g, A) {
|
|
4110
4120
|
let I = g.length, B = Math.floor(I / A), C = new Uint8Array(I);
|
|
4111
4121
|
for (let Q = 0; Q < A; Q++)
|
|
4112
4122
|
for (let E = 0; E < B; E++)
|
|
4113
4123
|
C[Q * B + E] = g[E * A + Q];
|
|
4114
4124
|
return C;
|
|
4115
4125
|
}
|
|
4116
|
-
function
|
|
4126
|
+
function EE(g, A) {
|
|
4117
4127
|
let I = g.length, B = Math.floor(I / A), C = new Uint8Array(I);
|
|
4118
4128
|
for (let Q = 0; Q < A; Q++)
|
|
4119
4129
|
for (let E = 0; E < B; E++)
|
|
@@ -4121,7 +4131,7 @@ function QE(g, A) {
|
|
|
4121
4131
|
return C;
|
|
4122
4132
|
}
|
|
4123
4133
|
function hB(g) {
|
|
4124
|
-
return g instanceof _B || g instanceof Ng || g instanceof
|
|
4134
|
+
return g instanceof _B || g instanceof Ng || g instanceof AI ? new Proxy(g, {
|
|
4125
4135
|
get(I, B) {
|
|
4126
4136
|
return I.get(Number(B));
|
|
4127
4137
|
},
|
|
@@ -4130,9 +4140,9 @@ function hB(g) {
|
|
|
4130
4140
|
}
|
|
4131
4141
|
}) : g;
|
|
4132
4142
|
}
|
|
4133
|
-
function
|
|
4143
|
+
function iE(g, A) {
|
|
4134
4144
|
let I;
|
|
4135
|
-
return g.data instanceof Ng || g.data instanceof
|
|
4145
|
+
return g.data instanceof Ng || g.data instanceof AI ? I = new g.constructor(
|
|
4136
4146
|
// @ts-expect-error
|
|
4137
4147
|
g.data.length,
|
|
4138
4148
|
g.data.chars
|
|
@@ -4142,8 +4152,8 @@ function EE(g, A) {
|
|
|
4142
4152
|
stride: RA(g.shape, A)
|
|
4143
4153
|
};
|
|
4144
4154
|
}
|
|
4145
|
-
function
|
|
4146
|
-
let I =
|
|
4155
|
+
function oE(g, A) {
|
|
4156
|
+
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
4157
|
for (let o = 0; o < C; o++) {
|
|
4148
4158
|
let a = 0;
|
|
4149
4159
|
for (let D = 0; D < B; D++)
|
|
@@ -4158,12 +4168,12 @@ function iE(g, A) {
|
|
|
4158
4168
|
}
|
|
4159
4169
|
return I;
|
|
4160
4170
|
}
|
|
4161
|
-
function
|
|
4171
|
+
function aE(g) {
|
|
4162
4172
|
let A = g.shape.length;
|
|
4163
4173
|
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
4174
|
}
|
|
4165
|
-
function
|
|
4166
|
-
let I =
|
|
4175
|
+
function DE(g, A) {
|
|
4176
|
+
let I = aE(g);
|
|
4167
4177
|
return IA(I.length === A.length, "Orders must match"), I.every((B, C) => B === A[C]);
|
|
4168
4178
|
}
|
|
4169
4179
|
class Mg {
|
|
@@ -4188,7 +4198,7 @@ class Mg {
|
|
|
4188
4198
|
return new Mg(A, I);
|
|
4189
4199
|
}
|
|
4190
4200
|
encode(A) {
|
|
4191
|
-
return
|
|
4201
|
+
return DE(A, this.#I) ? A : oE(A, this.#I);
|
|
4192
4202
|
}
|
|
4193
4203
|
decode(A) {
|
|
4194
4204
|
return {
|
|
@@ -4229,21 +4239,21 @@ class dg {
|
|
|
4229
4239
|
return new Uint8Array(I);
|
|
4230
4240
|
}
|
|
4231
4241
|
}
|
|
4232
|
-
function
|
|
4242
|
+
function sE() {
|
|
4233
4243
|
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", () =>
|
|
4244
|
+
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
4245
|
}
|
|
4236
|
-
const
|
|
4237
|
-
function
|
|
4246
|
+
const hE = sE();
|
|
4247
|
+
function Bg(g) {
|
|
4238
4248
|
let A;
|
|
4239
4249
|
function I() {
|
|
4240
|
-
return A || (A =
|
|
4250
|
+
return A || (A = tE(g)), A;
|
|
4241
4251
|
}
|
|
4242
4252
|
async function B(C, Q, E) {
|
|
4243
4253
|
try {
|
|
4244
4254
|
return await E();
|
|
4245
4255
|
} catch (i) {
|
|
4246
|
-
throw new
|
|
4256
|
+
throw new WQ({ direction: C, codec: Q, cause: i });
|
|
4247
4257
|
}
|
|
4248
4258
|
}
|
|
4249
4259
|
return {
|
|
@@ -4282,11 +4292,11 @@ function tB(g, A, I) {
|
|
|
4282
4292
|
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
4293
|
return A.computeEncodedSize(I);
|
|
4284
4294
|
}
|
|
4285
|
-
async function
|
|
4295
|
+
async function tE(g) {
|
|
4286
4296
|
let A = g.codecs.map(async (E) => {
|
|
4287
|
-
let i = await
|
|
4297
|
+
let i = await hE.get(E.name)?.();
|
|
4288
4298
|
if (!i)
|
|
4289
|
-
throw new
|
|
4299
|
+
throw new xQ(E.name);
|
|
4290
4300
|
return { Codec: i, meta: E };
|
|
4291
4301
|
}), I = [], B, C = [], Q = { ...g };
|
|
4292
4302
|
for await (let { Codec: E, meta: i } of A) {
|
|
@@ -4312,11 +4322,11 @@ async function hE(g) {
|
|
|
4312
4322
|
}
|
|
4313
4323
|
}
|
|
4314
4324
|
if (!B) {
|
|
4315
|
-
if (!
|
|
4325
|
+
if (!yE(Q))
|
|
4316
4326
|
throw new v(`Cannot encode ${Q.dataType} to bytes without a codec`);
|
|
4317
4327
|
B = {
|
|
4318
4328
|
name: "bytes",
|
|
4319
|
-
codec:
|
|
4329
|
+
codec: dI.fromConfig({ endian: "little" }, Q)
|
|
4320
4330
|
};
|
|
4321
4331
|
}
|
|
4322
4332
|
return {
|
|
@@ -4325,14 +4335,14 @@ async function hE(g) {
|
|
|
4325
4335
|
bytesToBytes: C
|
|
4326
4336
|
};
|
|
4327
4337
|
}
|
|
4328
|
-
function
|
|
4338
|
+
function yE(g) {
|
|
4329
4339
|
return g.dataType !== "v2:object" && g.dataType !== "string";
|
|
4330
4340
|
}
|
|
4331
4341
|
const yB = 18446744073709551615n;
|
|
4332
|
-
function
|
|
4342
|
+
function eE(g, A, I, B) {
|
|
4333
4343
|
if (!g.store.getRange)
|
|
4334
4344
|
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 =
|
|
4345
|
+
let C = g.store.getRange.bind(g.store), Q = A.map((a, D) => a / B.chunk_shape[D]), E = Bg({
|
|
4336
4346
|
dataType: "uint64",
|
|
4337
4347
|
shape: [...Q, 2],
|
|
4338
4348
|
codecs: B.index_codecs,
|
|
@@ -4382,9 +4392,9 @@ function eB(g) {
|
|
|
4382
4392
|
return g.find((I) => I.name === "transpose")?.configuration?.order ?? "C";
|
|
4383
4393
|
}
|
|
4384
4394
|
const QI = Symbol("zarrita.context");
|
|
4385
|
-
function
|
|
4386
|
-
let { configuration: I } = A.codecs.find(
|
|
4387
|
-
encodeChunkKey:
|
|
4395
|
+
function nE(g, A) {
|
|
4396
|
+
let { configuration: I } = A.codecs.find(XQ) ?? {}, B = {
|
|
4397
|
+
encodeChunkKey: PQ(A.chunk_key_encoding),
|
|
4388
4398
|
TypedArray: TA(A.data_type),
|
|
4389
4399
|
fillValue: A.fill_value
|
|
4390
4400
|
};
|
|
@@ -4394,7 +4404,7 @@ function eE(g, A) {
|
|
|
4394
4404
|
...B,
|
|
4395
4405
|
kind: "sharded",
|
|
4396
4406
|
chunkShape: I.chunk_shape,
|
|
4397
|
-
codec:
|
|
4407
|
+
codec: Bg({
|
|
4398
4408
|
dataType: A.data_type,
|
|
4399
4409
|
shape: I.chunk_shape,
|
|
4400
4410
|
codecs: I.codecs,
|
|
@@ -4403,7 +4413,7 @@ function eE(g, A) {
|
|
|
4403
4413
|
getStrides(E) {
|
|
4404
4414
|
return RA(E, Q);
|
|
4405
4415
|
},
|
|
4406
|
-
getChunkBytes:
|
|
4416
|
+
getChunkBytes: eE(g, A.chunk_grid.configuration.chunk_shape, B.encodeChunkKey, I)
|
|
4407
4417
|
};
|
|
4408
4418
|
}
|
|
4409
4419
|
let C = eB(A.codecs);
|
|
@@ -4411,7 +4421,7 @@ function eE(g, A) {
|
|
|
4411
4421
|
...B,
|
|
4412
4422
|
kind: "regular",
|
|
4413
4423
|
chunkShape: A.chunk_grid.configuration.chunk_shape,
|
|
4414
|
-
codec:
|
|
4424
|
+
codec: Bg({
|
|
4415
4425
|
dataType: A.data_type,
|
|
4416
4426
|
shape: A.chunk_grid.configuration.chunk_shape,
|
|
4417
4427
|
codecs: A.codecs,
|
|
@@ -4434,7 +4444,7 @@ let FI = class extends CA {
|
|
|
4434
4444
|
super(A, I), this.#A = {
|
|
4435
4445
|
...B,
|
|
4436
4446
|
fill_value: $B(B)
|
|
4437
|
-
}, this[QI] =
|
|
4447
|
+
}, this[QI] = nE(this, this.#A);
|
|
4438
4448
|
}
|
|
4439
4449
|
get attrs() {
|
|
4440
4450
|
return this.#A.attributes;
|
|
@@ -4455,7 +4465,7 @@ let FI = class extends CA {
|
|
|
4455
4465
|
return this.#A.data_type;
|
|
4456
4466
|
}
|
|
4457
4467
|
async getChunk(A, I, B) {
|
|
4458
|
-
B?.useSharedArrayBuffer &&
|
|
4468
|
+
B?.useSharedArrayBuffer && bQ();
|
|
4459
4469
|
let C = this[QI], Q = await C.getChunkBytes(A, I);
|
|
4460
4470
|
if (!Q) {
|
|
4461
4471
|
let E = C.chunkShape.reduce((o, a) => o * a, 1), i;
|
|
@@ -4464,7 +4474,7 @@ let FI = class extends CA {
|
|
|
4464
4474
|
if (!("BYTES_PER_ELEMENT" in o))
|
|
4465
4475
|
console.warn("zarrita: useSharedArrayBuffer is not supported for non-buffer-backed data types."), i = new C.TypedArray(E);
|
|
4466
4476
|
else {
|
|
4467
|
-
let a =
|
|
4477
|
+
let a = ZQ(E * o.BYTES_PER_ELEMENT);
|
|
4468
4478
|
i = new C.TypedArray(a, 0, E);
|
|
4469
4479
|
}
|
|
4470
4480
|
} else
|
|
@@ -4495,24 +4505,24 @@ let FI = class extends CA {
|
|
|
4495
4505
|
* ```
|
|
4496
4506
|
*/
|
|
4497
4507
|
is(A) {
|
|
4498
|
-
return
|
|
4508
|
+
return Ig(this.dtype, A);
|
|
4499
4509
|
}
|
|
4500
4510
|
};
|
|
4501
|
-
function
|
|
4511
|
+
function GE(g, A) {
|
|
4502
4512
|
let I = g;
|
|
4503
4513
|
for (let B of A)
|
|
4504
4514
|
I instanceof Promise ? I = I.then((C) => B(C)) : I = B(I);
|
|
4505
4515
|
return I;
|
|
4506
4516
|
}
|
|
4507
|
-
function
|
|
4508
|
-
return
|
|
4517
|
+
function wE(g, ...A) {
|
|
4518
|
+
return GE(g, A);
|
|
4509
4519
|
}
|
|
4510
4520
|
async function BC(g) {
|
|
4511
4521
|
let A = g.store.arrayExtensions;
|
|
4512
|
-
return A?.length ? await
|
|
4522
|
+
return A?.length ? await wE(g, ...A) : g;
|
|
4513
4523
|
}
|
|
4514
|
-
let
|
|
4515
|
-
function
|
|
4524
|
+
let KI = FE();
|
|
4525
|
+
function FE() {
|
|
4516
4526
|
let g = /* @__PURE__ */ new WeakMap();
|
|
4517
4527
|
function A(I) {
|
|
4518
4528
|
let B = g.get(I) ?? { v2: 0, v3: 0 };
|
|
@@ -4528,38 +4538,38 @@ function wE() {
|
|
|
4528
4538
|
}
|
|
4529
4539
|
};
|
|
4530
4540
|
}
|
|
4531
|
-
async function
|
|
4541
|
+
async function rE(g, A) {
|
|
4532
4542
|
let I = await g.store.get(g.resolve(".zattrs").path, {
|
|
4533
4543
|
signal: A
|
|
4534
4544
|
});
|
|
4535
|
-
return I ?
|
|
4545
|
+
return I ? II(I) : {};
|
|
4536
4546
|
}
|
|
4537
|
-
async function
|
|
4547
|
+
async function SE(g, A = {}) {
|
|
4538
4548
|
let I = "store" in g ? g : new CA(g), { signal: B } = A, C = {};
|
|
4539
|
-
return (A.attrs ?? !0) && (C = await
|
|
4549
|
+
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
4550
|
}
|
|
4541
4551
|
async function nB(g, A, I) {
|
|
4542
4552
|
let { path: B } = g.resolve(".zarray"), C = await g.store.get(B, { signal: I });
|
|
4543
4553
|
if (!C)
|
|
4544
4554
|
throw new uA("v2 array", { path: B });
|
|
4545
|
-
return
|
|
4555
|
+
return KI.increment(g.store, "v2"), BC(new FI(g.store, g.path, VQ(II(C), A)));
|
|
4546
4556
|
}
|
|
4547
4557
|
async function GB(g, A, I) {
|
|
4548
4558
|
let { path: B } = g.resolve(".zgroup"), C = await g.store.get(B, { signal: I });
|
|
4549
4559
|
if (!C)
|
|
4550
4560
|
throw new uA("v2 group", { path: B });
|
|
4551
|
-
return
|
|
4561
|
+
return KI.increment(g.store, "v2"), new Kg(g.store, g.path, vQ(II(C), A));
|
|
4552
4562
|
}
|
|
4553
|
-
async function
|
|
4563
|
+
async function RE(g, A) {
|
|
4554
4564
|
let { store: I, path: B } = g.resolve("zarr.json"), C = await g.store.get(B, { signal: A });
|
|
4555
4565
|
if (!C)
|
|
4556
4566
|
throw new uA("v3 array or group", { path: B });
|
|
4557
|
-
let Q =
|
|
4567
|
+
let Q = II(C);
|
|
4558
4568
|
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
4569
|
}
|
|
4560
|
-
async function
|
|
4561
|
-
let I = "store" in g ? g : new CA(g), B = await
|
|
4562
|
-
if (
|
|
4570
|
+
async function NE(g, A = {}) {
|
|
4571
|
+
let I = "store" in g ? g : new CA(g), B = await RE(I, A.signal);
|
|
4572
|
+
if (KI.increment(I.store, "v3"), A.kind === void 0 || A.kind === "array" && B instanceof FI || A.kind === "group" && B instanceof Kg)
|
|
4563
4573
|
return B;
|
|
4564
4574
|
let C = B instanceof FI ? "array" : "group";
|
|
4565
4575
|
throw new uA(`${A.kind} at ${I.path}`, {
|
|
@@ -4568,12 +4578,12 @@ async function RE(g, A = {}) {
|
|
|
4568
4578
|
});
|
|
4569
4579
|
}
|
|
4570
4580
|
async function BA(g, A = {}) {
|
|
4571
|
-
let I = "store" in g ? g.store : g, B =
|
|
4581
|
+
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
4582
|
return C(g, A).catch((E) => (AC(E, uA, v), Q(g, A)));
|
|
4573
4583
|
}
|
|
4574
|
-
BA.v2 =
|
|
4575
|
-
BA.v3 =
|
|
4576
|
-
async function
|
|
4584
|
+
BA.v2 = SE;
|
|
4585
|
+
BA.v3 = NE;
|
|
4586
|
+
async function cE(g, A) {
|
|
4577
4587
|
const I = A.split("/"), B = I.pop();
|
|
4578
4588
|
if (!B)
|
|
4579
4589
|
throw new Error("Invalid path");
|
|
@@ -4590,7 +4600,7 @@ class Hg {
|
|
|
4590
4600
|
return this.#A;
|
|
4591
4601
|
}
|
|
4592
4602
|
async get(A) {
|
|
4593
|
-
const I = await
|
|
4603
|
+
const I = await cE(this.#A, A.slice(1)).catch(
|
|
4594
4604
|
() => {
|
|
4595
4605
|
}
|
|
4596
4606
|
);
|
|
@@ -4600,7 +4610,7 @@ class Hg {
|
|
|
4600
4610
|
return new Uint8Array(C);
|
|
4601
4611
|
}
|
|
4602
4612
|
}
|
|
4603
|
-
async function
|
|
4613
|
+
async function gI(g, A) {
|
|
4604
4614
|
if (A === "v2")
|
|
4605
4615
|
try {
|
|
4606
4616
|
return BA.v2(g, { kind: "group", attrs: !0 });
|
|
@@ -4619,7 +4629,7 @@ async function BI(g, A) {
|
|
|
4619
4629
|
throw new Error(`Failed to open Zarr group at ${g}`);
|
|
4620
4630
|
}
|
|
4621
4631
|
}
|
|
4622
|
-
async function
|
|
4632
|
+
async function UE(g, A) {
|
|
4623
4633
|
if (A === "v2")
|
|
4624
4634
|
try {
|
|
4625
4635
|
return BA.v2(g, { kind: "array", attrs: !1 });
|
|
@@ -4638,11 +4648,11 @@ async function cE(g, A) {
|
|
|
4638
4648
|
throw new Error(`Failed to open Zarr array at ${g}`);
|
|
4639
4649
|
}
|
|
4640
4650
|
}
|
|
4641
|
-
async function
|
|
4651
|
+
async function kE(g) {
|
|
4642
4652
|
let A;
|
|
4643
4653
|
switch (g.type) {
|
|
4644
4654
|
case "fetch": {
|
|
4645
|
-
const B = new
|
|
4655
|
+
const B = new _A(g.url);
|
|
4646
4656
|
A = new CA(B);
|
|
4647
4657
|
break;
|
|
4648
4658
|
}
|
|
@@ -4659,10 +4669,10 @@ async function UE(g) {
|
|
|
4659
4669
|
}
|
|
4660
4670
|
}
|
|
4661
4671
|
const I = g.arrayPath ? A.resolve(g.arrayPath) : A;
|
|
4662
|
-
return
|
|
4672
|
+
return UE(I, g.zarrVersion);
|
|
4663
4673
|
}
|
|
4664
|
-
function
|
|
4665
|
-
if (g.store instanceof
|
|
4674
|
+
function LE(g, A, I) {
|
|
4675
|
+
if (g.store instanceof _A)
|
|
4666
4676
|
return {
|
|
4667
4677
|
type: "fetch",
|
|
4668
4678
|
arrayPath: A,
|
|
@@ -4681,10 +4691,10 @@ function kE(g, A, I) {
|
|
|
4681
4691
|
`Unsupported store type: ${g.store.constructor.name}`
|
|
4682
4692
|
);
|
|
4683
4693
|
}
|
|
4684
|
-
function LE(g, A, I, B) {
|
|
4685
|
-
return JE(g, A, I, B);
|
|
4686
|
-
}
|
|
4687
4694
|
function JE(g, A, I, B) {
|
|
4695
|
+
return YE(g, A, I, B);
|
|
4696
|
+
}
|
|
4697
|
+
function YE(g, A, I, B) {
|
|
4688
4698
|
const { targetShape: C, chunkIndex: Q, dimIndices: E } = B;
|
|
4689
4699
|
let i = 1;
|
|
4690
4700
|
for (let r = A.length - 1; r >= 0; r--) {
|
|
@@ -8374,7 +8384,7 @@ return ret;
|
|
|
8374
8384
|
});
|
|
8375
8385
|
//# sourceMappingURL=worker_kernel-CBlE4MBI.js.map
|
|
8376
8386
|
`, wB = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", CC], { type: "text/javascript;charset=utf-8" });
|
|
8377
|
-
function
|
|
8387
|
+
function ME(g) {
|
|
8378
8388
|
let A;
|
|
8379
8389
|
try {
|
|
8380
8390
|
if (A = wB && (self.URL || self.webkitURL).createObjectURL(wB), !A) throw "";
|
|
@@ -8395,8 +8405,8 @@ function YE(g) {
|
|
|
8395
8405
|
);
|
|
8396
8406
|
}
|
|
8397
8407
|
}
|
|
8398
|
-
const
|
|
8399
|
-
let EA = [],
|
|
8408
|
+
const dE = Math.max(1, navigator.hardwareConcurrency - 2);
|
|
8409
|
+
let EA = [], KE = 0, QC = 0;
|
|
8400
8410
|
const NA = /* @__PURE__ */ new Map(), rI = /* @__PURE__ */ new Set();
|
|
8401
8411
|
function EC(g) {
|
|
8402
8412
|
const A = EA.find((I) => I.worker === g);
|
|
@@ -8405,7 +8415,7 @@ function EC(g) {
|
|
|
8405
8415
|
"Worker not found in pool - this should not happen"
|
|
8406
8416
|
), A;
|
|
8407
8417
|
}
|
|
8408
|
-
function
|
|
8418
|
+
function HE(g, A) {
|
|
8409
8419
|
const { id: I, success: B } = g.data, C = NA.get(I);
|
|
8410
8420
|
if (!C) {
|
|
8411
8421
|
rI.has(I) ? rI.delete(I) : k.warn(
|
|
@@ -8456,20 +8466,20 @@ function FB(g, A) {
|
|
|
8456
8466
|
}
|
|
8457
8467
|
}
|
|
8458
8468
|
function iC() {
|
|
8459
|
-
const g = new
|
|
8460
|
-
return g.addEventListener("message", (A) =>
|
|
8469
|
+
const g = new ME();
|
|
8470
|
+
return g.addEventListener("message", (A) => HE(A, g)), g.addEventListener("error", (A) => FB(A, g)), g.addEventListener(
|
|
8461
8471
|
"messageerror",
|
|
8462
8472
|
(A) => FB(A, g)
|
|
8463
8473
|
), g;
|
|
8464
8474
|
}
|
|
8465
|
-
function
|
|
8475
|
+
function qE() {
|
|
8466
8476
|
if (EA.length === 0)
|
|
8467
8477
|
throw new Error("Worker pool is not initialized");
|
|
8468
8478
|
return EA.sort((g, A) => g.pendingCount - A.pendingCount)[0];
|
|
8469
8479
|
}
|
|
8470
|
-
async function
|
|
8480
|
+
async function lE(g, A, I, B) {
|
|
8471
8481
|
return new Promise((C, Q) => {
|
|
8472
|
-
const E =
|
|
8482
|
+
const E = qE(), i = KE++, o = {
|
|
8473
8483
|
resolve: C,
|
|
8474
8484
|
reject: Q,
|
|
8475
8485
|
workerId: E.workerId
|
|
@@ -8496,10 +8506,10 @@ async function qE(g, A, I, B) {
|
|
|
8496
8506
|
});
|
|
8497
8507
|
});
|
|
8498
8508
|
}
|
|
8499
|
-
function
|
|
8509
|
+
function fE() {
|
|
8500
8510
|
if (!(EA.length > 0))
|
|
8501
8511
|
try {
|
|
8502
|
-
for (let g = 0; g <
|
|
8512
|
+
for (let g = 0; g < dE; g++) {
|
|
8503
8513
|
const A = iC();
|
|
8504
8514
|
EA.push({
|
|
8505
8515
|
worker: A,
|
|
@@ -8512,14 +8522,14 @@ function lE() {
|
|
|
8512
8522
|
`Initialized worker pool with ${EA.length} workers`
|
|
8513
8523
|
);
|
|
8514
8524
|
} catch {
|
|
8515
|
-
k.warn("ZarrWorker", "Failed to create workers - clearing pool"),
|
|
8525
|
+
k.warn("ZarrWorker", "Failed to create workers - clearing pool"), mE();
|
|
8516
8526
|
return;
|
|
8517
8527
|
}
|
|
8518
8528
|
}
|
|
8519
|
-
async function
|
|
8520
|
-
|
|
8529
|
+
async function pE(g, A, I, B, C) {
|
|
8530
|
+
fE();
|
|
8521
8531
|
try {
|
|
8522
|
-
return await
|
|
8532
|
+
return await lE(
|
|
8523
8533
|
A,
|
|
8524
8534
|
I,
|
|
8525
8535
|
B,
|
|
@@ -8530,11 +8540,11 @@ async function fE(g, A, I, B, C) {
|
|
|
8530
8540
|
throw Q;
|
|
8531
8541
|
k.warn("ZarrWorker", "Falling back to main thread", Q);
|
|
8532
8542
|
const E = await g.getChunk(I, C);
|
|
8533
|
-
if (!
|
|
8543
|
+
if (!NQ(E.data))
|
|
8534
8544
|
throw new Error(
|
|
8535
8545
|
`Unsupported chunk data type: ${E.data.constructor.name}`
|
|
8536
8546
|
);
|
|
8537
|
-
return
|
|
8547
|
+
return JE(
|
|
8538
8548
|
E.data,
|
|
8539
8549
|
E.shape,
|
|
8540
8550
|
E.stride,
|
|
@@ -8542,19 +8552,19 @@ async function fE(g, A, I, B, C) {
|
|
|
8542
8552
|
);
|
|
8543
8553
|
}
|
|
8544
8554
|
}
|
|
8545
|
-
function
|
|
8555
|
+
function mE() {
|
|
8546
8556
|
for (const g of EA)
|
|
8547
8557
|
g.worker.terminate();
|
|
8548
8558
|
EA = [], NA.clear();
|
|
8549
8559
|
}
|
|
8550
|
-
class
|
|
8560
|
+
class uE {
|
|
8551
8561
|
metadata_;
|
|
8552
8562
|
arrays_;
|
|
8553
8563
|
arrayParams_;
|
|
8554
8564
|
dimensions_;
|
|
8555
8565
|
bytesPerElement_;
|
|
8556
8566
|
constructor(A) {
|
|
8557
|
-
this.metadata_ = A.metadata, this.arrays_ = A.arrays, this.arrayParams_ = A.arrayParams, this.dimensions_ =
|
|
8567
|
+
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
8568
|
}
|
|
8559
8569
|
getSourceDimensionMap() {
|
|
8560
8570
|
return this.dimensions_;
|
|
@@ -8588,18 +8598,18 @@ class mE {
|
|
|
8588
8598
|
},
|
|
8589
8599
|
cChunkSize: E?.chunkSize,
|
|
8590
8600
|
tChunkSize: i?.chunkSize
|
|
8591
|
-
}, a = await
|
|
8601
|
+
}, a = await pE(
|
|
8592
8602
|
C,
|
|
8593
8603
|
Q,
|
|
8594
8604
|
B,
|
|
8595
8605
|
o,
|
|
8596
8606
|
{ signal: I }
|
|
8597
8607
|
), D = a.BYTES_PER_ELEMENT;
|
|
8598
|
-
if (!
|
|
8608
|
+
if (!hQ(D))
|
|
8599
8609
|
throw new Error(
|
|
8600
8610
|
"Invalid row alignment value. Possible values are 1, 2, 4, or 8"
|
|
8601
8611
|
);
|
|
8602
|
-
A.rowAlignmentBytes = D,
|
|
8612
|
+
A.rowAlignmentBytes = D, SQ(A, a);
|
|
8603
8613
|
}
|
|
8604
8614
|
}
|
|
8605
8615
|
const rB = {
|
|
@@ -8611,7 +8621,7 @@ const rB = {
|
|
|
8611
8621
|
uint32: 4,
|
|
8612
8622
|
float32: 4
|
|
8613
8623
|
};
|
|
8614
|
-
function
|
|
8624
|
+
function TE(g) {
|
|
8615
8625
|
const A = rB[g];
|
|
8616
8626
|
if (A === void 0)
|
|
8617
8627
|
throw new Error(
|
|
@@ -8619,7 +8629,7 @@ function uE(g) {
|
|
|
8619
8629
|
);
|
|
8620
8630
|
return A;
|
|
8621
8631
|
}
|
|
8622
|
-
function
|
|
8632
|
+
function xE(g, A) {
|
|
8623
8633
|
const I = g.axes.map((s) => s.name), B = g.axes.length, C = SB(I, "x"), Q = SB(I, "y"), E = (s, h) => {
|
|
8624
8634
|
const t = [];
|
|
8625
8635
|
for (let y = 0; y < g.datasets.length; y++) {
|
|
@@ -8631,7 +8641,7 @@ function TE(g, A) {
|
|
|
8631
8641
|
translation: J[h]
|
|
8632
8642
|
});
|
|
8633
8643
|
}
|
|
8634
|
-
if (g.axes[h].type === "space" &&
|
|
8644
|
+
if (g.axes[h].type === "space" && bE(t))
|
|
8635
8645
|
for (const y of t) y.translation -= 0.5 * y.scale;
|
|
8636
8646
|
return {
|
|
8637
8647
|
name: s,
|
|
@@ -8650,7 +8660,7 @@ function TE(g, A) {
|
|
|
8650
8660
|
const D = iI(I, "t");
|
|
8651
8661
|
return D !== -1 && (i.t = E(I[D], D)), i;
|
|
8652
8662
|
}
|
|
8653
|
-
function
|
|
8663
|
+
function WE(g, A) {
|
|
8654
8664
|
return g.toLowerCase() === A.toLowerCase();
|
|
8655
8665
|
}
|
|
8656
8666
|
function SB(g, A) {
|
|
@@ -8662,9 +8672,9 @@ function SB(g, A) {
|
|
|
8662
8672
|
return I;
|
|
8663
8673
|
}
|
|
8664
8674
|
function iI(g, A) {
|
|
8665
|
-
return g.findIndex((I) =>
|
|
8675
|
+
return g.findIndex((I) => WE(I, A));
|
|
8666
8676
|
}
|
|
8667
|
-
function
|
|
8677
|
+
function bE(g) {
|
|
8668
8678
|
if (g.length <= 1) return !1;
|
|
8669
8679
|
for (let A = 1; A < g.length; A++) {
|
|
8670
8680
|
const I = 0.5 * (g[A].scale - g[A - 1].scale), B = g[A].translation - g[A - 1].translation;
|
|
@@ -8841,7 +8851,7 @@ class tA extends Error {
|
|
|
8841
8851
|
}
|
|
8842
8852
|
}
|
|
8843
8853
|
tA.create = (g) => new tA(g);
|
|
8844
|
-
const
|
|
8854
|
+
const Cg = (g, A) => {
|
|
8845
8855
|
let I;
|
|
8846
8856
|
switch (g.code) {
|
|
8847
8857
|
case e.invalid_type:
|
|
@@ -8897,11 +8907,11 @@ const Bg = (g, A) => {
|
|
|
8897
8907
|
}
|
|
8898
8908
|
return { message: I };
|
|
8899
8909
|
};
|
|
8900
|
-
let
|
|
8901
|
-
function
|
|
8902
|
-
return
|
|
8910
|
+
let ZE = Cg;
|
|
8911
|
+
function PE() {
|
|
8912
|
+
return ZE;
|
|
8903
8913
|
}
|
|
8904
|
-
const
|
|
8914
|
+
const OE = (g) => {
|
|
8905
8915
|
const { data: A, path: I, errorMaps: B, issueData: C } = g, Q = [...I, ...C.path || []], E = {
|
|
8906
8916
|
...C,
|
|
8907
8917
|
path: Q
|
|
@@ -8923,7 +8933,7 @@ const PE = (g) => {
|
|
|
8923
8933
|
};
|
|
8924
8934
|
};
|
|
8925
8935
|
function w(g, A) {
|
|
8926
|
-
const I =
|
|
8936
|
+
const I = PE(), B = OE({
|
|
8927
8937
|
issueData: A,
|
|
8928
8938
|
data: g.data,
|
|
8929
8939
|
path: g.path,
|
|
@@ -8934,7 +8944,7 @@ function w(g, A) {
|
|
|
8934
8944
|
// then schema-bound map if available
|
|
8935
8945
|
I,
|
|
8936
8946
|
// then global override map
|
|
8937
|
-
I ===
|
|
8947
|
+
I === Cg ? void 0 : Cg
|
|
8938
8948
|
// then global default map
|
|
8939
8949
|
].filter((C) => !!C)
|
|
8940
8950
|
});
|
|
@@ -8983,7 +8993,7 @@ class gA {
|
|
|
8983
8993
|
}
|
|
8984
8994
|
const Y = Object.freeze({
|
|
8985
8995
|
status: "aborted"
|
|
8986
|
-
}),
|
|
8996
|
+
}), 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
8997
|
var N;
|
|
8988
8998
|
(function(g) {
|
|
8989
8999
|
g.errToObj = (A) => typeof A == "string" ? { message: A } : A || {}, g.toString = (A) => typeof A == "string" ? A : A?.message;
|
|
@@ -9197,7 +9207,7 @@ class q {
|
|
|
9197
9207
|
}
|
|
9198
9208
|
default(A) {
|
|
9199
9209
|
const I = typeof A == "function" ? A : () => A;
|
|
9200
|
-
return new
|
|
9210
|
+
return new ag({
|
|
9201
9211
|
...K(this._def),
|
|
9202
9212
|
innerType: this,
|
|
9203
9213
|
defaultValue: I,
|
|
@@ -9205,7 +9215,7 @@ class q {
|
|
|
9205
9215
|
});
|
|
9206
9216
|
}
|
|
9207
9217
|
brand() {
|
|
9208
|
-
return new
|
|
9218
|
+
return new ei({
|
|
9209
9219
|
typeName: M.ZodBranded,
|
|
9210
9220
|
type: this,
|
|
9211
9221
|
...K(this._def)
|
|
@@ -9213,7 +9223,7 @@ class q {
|
|
|
9213
9223
|
}
|
|
9214
9224
|
catch(A) {
|
|
9215
9225
|
const I = typeof A == "function" ? A : () => A;
|
|
9216
|
-
return new
|
|
9226
|
+
return new Dg({
|
|
9217
9227
|
...K(this._def),
|
|
9218
9228
|
innerType: this,
|
|
9219
9229
|
catchValue: I,
|
|
@@ -9231,7 +9241,7 @@ class q {
|
|
|
9231
9241
|
return qg.create(this, A);
|
|
9232
9242
|
}
|
|
9233
9243
|
readonly() {
|
|
9234
|
-
return
|
|
9244
|
+
return sg.create(this);
|
|
9235
9245
|
}
|
|
9236
9246
|
isOptional() {
|
|
9237
9247
|
return this.safeParse(void 0).success;
|
|
@@ -9240,28 +9250,28 @@ class q {
|
|
|
9240
9250
|
return this.safeParse(null).success;
|
|
9241
9251
|
}
|
|
9242
9252
|
}
|
|
9243
|
-
const
|
|
9244
|
-
let
|
|
9245
|
-
const
|
|
9253
|
+
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})+$";
|
|
9254
|
+
let ZI;
|
|
9255
|
+
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
9256
|
function aC(g) {
|
|
9247
9257
|
let A = "[0-5]\\d";
|
|
9248
9258
|
g.precision ? A = `${A}\\.\\d{${g.precision}}` : g.precision == null && (A = `${A}(\\.\\d+)?`);
|
|
9249
9259
|
const I = g.precision ? "+" : "?";
|
|
9250
9260
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${A})${I}`;
|
|
9251
9261
|
}
|
|
9252
|
-
function
|
|
9262
|
+
function ai(g) {
|
|
9253
9263
|
return new RegExp(`^${aC(g)}$`);
|
|
9254
9264
|
}
|
|
9255
|
-
function
|
|
9265
|
+
function Di(g) {
|
|
9256
9266
|
let A = `${oC}T${aC(g)}`;
|
|
9257
9267
|
const I = [];
|
|
9258
9268
|
return I.push(g.local ? "Z?" : "Z"), g.offset && I.push("([+-]\\d{2}:?\\d{2})"), A = `${A}(${I.join("|")})`, new RegExp(`^${A}$`);
|
|
9259
9269
|
}
|
|
9260
|
-
function Di(g, A) {
|
|
9261
|
-
return !!((A === "v4" || !A) && Ii.test(g) || (A === "v6" || !A) && Bi.test(g));
|
|
9262
|
-
}
|
|
9263
9270
|
function si(g, A) {
|
|
9264
|
-
|
|
9271
|
+
return !!((A === "v4" || !A) && gi.test(g) || (A === "v6" || !A) && Ci.test(g));
|
|
9272
|
+
}
|
|
9273
|
+
function hi(g, A) {
|
|
9274
|
+
if (!_E.test(g))
|
|
9265
9275
|
return !1;
|
|
9266
9276
|
try {
|
|
9267
9277
|
const [I] = g.split(".");
|
|
@@ -9273,8 +9283,8 @@ function si(g, A) {
|
|
|
9273
9283
|
return !1;
|
|
9274
9284
|
}
|
|
9275
9285
|
}
|
|
9276
|
-
function
|
|
9277
|
-
return !!((A === "v4" || !A) &&
|
|
9286
|
+
function ti(g, A) {
|
|
9287
|
+
return !!((A === "v4" || !A) && Bi.test(g) || (A === "v6" || !A) && Qi.test(g));
|
|
9278
9288
|
}
|
|
9279
9289
|
class eA extends q {
|
|
9280
9290
|
_parse(A) {
|
|
@@ -9325,43 +9335,43 @@ class eA extends q {
|
|
|
9325
9335
|
message: Q.message
|
|
9326
9336
|
}), B.dirty());
|
|
9327
9337
|
} else if (Q.kind === "email")
|
|
9328
|
-
|
|
9338
|
+
Ai.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9329
9339
|
validation: "email",
|
|
9330
9340
|
code: e.invalid_string,
|
|
9331
9341
|
message: Q.message
|
|
9332
9342
|
}), B.dirty());
|
|
9333
9343
|
else if (Q.kind === "emoji")
|
|
9334
|
-
|
|
9344
|
+
ZI || (ZI = new RegExp(Ii, "u")), ZI.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9335
9345
|
validation: "emoji",
|
|
9336
9346
|
code: e.invalid_string,
|
|
9337
9347
|
message: Q.message
|
|
9338
9348
|
}), B.dirty());
|
|
9339
9349
|
else if (Q.kind === "uuid")
|
|
9340
|
-
|
|
9350
|
+
jE.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9341
9351
|
validation: "uuid",
|
|
9342
9352
|
code: e.invalid_string,
|
|
9343
9353
|
message: Q.message
|
|
9344
9354
|
}), B.dirty());
|
|
9345
9355
|
else if (Q.kind === "nanoid")
|
|
9346
|
-
|
|
9356
|
+
zE.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9347
9357
|
validation: "nanoid",
|
|
9348
9358
|
code: e.invalid_string,
|
|
9349
9359
|
message: Q.message
|
|
9350
9360
|
}), B.dirty());
|
|
9351
9361
|
else if (Q.kind === "cuid")
|
|
9352
|
-
|
|
9362
|
+
VE.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9353
9363
|
validation: "cuid",
|
|
9354
9364
|
code: e.invalid_string,
|
|
9355
9365
|
message: Q.message
|
|
9356
9366
|
}), B.dirty());
|
|
9357
9367
|
else if (Q.kind === "cuid2")
|
|
9358
|
-
|
|
9368
|
+
vE.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9359
9369
|
validation: "cuid2",
|
|
9360
9370
|
code: e.invalid_string,
|
|
9361
9371
|
message: Q.message
|
|
9362
9372
|
}), B.dirty());
|
|
9363
9373
|
else if (Q.kind === "ulid")
|
|
9364
|
-
|
|
9374
|
+
XE.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9365
9375
|
validation: "ulid",
|
|
9366
9376
|
code: e.invalid_string,
|
|
9367
9377
|
message: Q.message
|
|
@@ -9392,39 +9402,39 @@ class eA extends q {
|
|
|
9392
9402
|
code: e.invalid_string,
|
|
9393
9403
|
validation: { endsWith: Q.value },
|
|
9394
9404
|
message: Q.message
|
|
9395
|
-
}), B.dirty()) : Q.kind === "datetime" ?
|
|
9405
|
+
}), B.dirty()) : Q.kind === "datetime" ? Di(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9396
9406
|
code: e.invalid_string,
|
|
9397
9407
|
validation: "datetime",
|
|
9398
9408
|
message: Q.message
|
|
9399
|
-
}), B.dirty()) : Q.kind === "date" ?
|
|
9409
|
+
}), B.dirty()) : Q.kind === "date" ? oi.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9400
9410
|
code: e.invalid_string,
|
|
9401
9411
|
validation: "date",
|
|
9402
9412
|
message: Q.message
|
|
9403
|
-
}), B.dirty()) : Q.kind === "time" ?
|
|
9413
|
+
}), B.dirty()) : Q.kind === "time" ? ai(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9404
9414
|
code: e.invalid_string,
|
|
9405
9415
|
validation: "time",
|
|
9406
9416
|
message: Q.message
|
|
9407
|
-
}), B.dirty()) : Q.kind === "duration" ?
|
|
9417
|
+
}), B.dirty()) : Q.kind === "duration" ? $E.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9408
9418
|
validation: "duration",
|
|
9409
9419
|
code: e.invalid_string,
|
|
9410
9420
|
message: Q.message
|
|
9411
|
-
}), B.dirty()) : Q.kind === "ip" ?
|
|
9421
|
+
}), B.dirty()) : Q.kind === "ip" ? si(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9412
9422
|
validation: "ip",
|
|
9413
9423
|
code: e.invalid_string,
|
|
9414
9424
|
message: Q.message
|
|
9415
|
-
}), B.dirty()) : Q.kind === "jwt" ?
|
|
9425
|
+
}), B.dirty()) : Q.kind === "jwt" ? hi(A.data, Q.alg) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9416
9426
|
validation: "jwt",
|
|
9417
9427
|
code: e.invalid_string,
|
|
9418
9428
|
message: Q.message
|
|
9419
|
-
}), B.dirty()) : Q.kind === "cidr" ?
|
|
9429
|
+
}), B.dirty()) : Q.kind === "cidr" ? ti(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9420
9430
|
validation: "cidr",
|
|
9421
9431
|
code: e.invalid_string,
|
|
9422
9432
|
message: Q.message
|
|
9423
|
-
}), B.dirty()) : Q.kind === "base64" ?
|
|
9433
|
+
}), B.dirty()) : Q.kind === "base64" ? Ei.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9424
9434
|
validation: "base64",
|
|
9425
9435
|
code: e.invalid_string,
|
|
9426
9436
|
message: Q.message
|
|
9427
|
-
}), B.dirty()) : Q.kind === "base64url" ?
|
|
9437
|
+
}), B.dirty()) : Q.kind === "base64url" ? ii.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9428
9438
|
validation: "base64url",
|
|
9429
9439
|
code: e.invalid_string,
|
|
9430
9440
|
message: Q.message
|
|
@@ -9659,7 +9669,7 @@ eA.create = (g) => new eA({
|
|
|
9659
9669
|
coerce: g?.coerce ?? !1,
|
|
9660
9670
|
...K(g)
|
|
9661
9671
|
});
|
|
9662
|
-
function
|
|
9672
|
+
function yi(g, A) {
|
|
9663
9673
|
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
9674
|
return Q % E / 10 ** C;
|
|
9665
9675
|
}
|
|
@@ -9698,7 +9708,7 @@ class HA extends q {
|
|
|
9698
9708
|
inclusive: Q.inclusive,
|
|
9699
9709
|
exact: !1,
|
|
9700
9710
|
message: Q.message
|
|
9701
|
-
}), C.dirty()) : Q.kind === "multipleOf" ?
|
|
9711
|
+
}), C.dirty()) : Q.kind === "multipleOf" ? yi(A.data, Q.value) !== 0 && (B = this._getOrReturnCtx(A, B), w(B, {
|
|
9702
9712
|
code: e.not_multiple_of,
|
|
9703
9713
|
multipleOf: Q.value,
|
|
9704
9714
|
message: Q.message
|
|
@@ -9835,7 +9845,7 @@ HA.create = (g) => new HA({
|
|
|
9835
9845
|
coerce: g?.coerce || !1,
|
|
9836
9846
|
...K(g)
|
|
9837
9847
|
});
|
|
9838
|
-
class
|
|
9848
|
+
class XA extends q {
|
|
9839
9849
|
constructor() {
|
|
9840
9850
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
9841
9851
|
}
|
|
@@ -9891,7 +9901,7 @@ class jA extends q {
|
|
|
9891
9901
|
return this.setLimit("max", A, !1, N.toString(I));
|
|
9892
9902
|
}
|
|
9893
9903
|
setLimit(A, I, B, C) {
|
|
9894
|
-
return new
|
|
9904
|
+
return new XA({
|
|
9895
9905
|
...this._def,
|
|
9896
9906
|
checks: [
|
|
9897
9907
|
...this._def.checks,
|
|
@@ -9905,7 +9915,7 @@ class jA extends q {
|
|
|
9905
9915
|
});
|
|
9906
9916
|
}
|
|
9907
9917
|
_addCheck(A) {
|
|
9908
|
-
return new
|
|
9918
|
+
return new XA({
|
|
9909
9919
|
...this._def,
|
|
9910
9920
|
checks: [...this._def.checks, A]
|
|
9911
9921
|
});
|
|
@@ -9962,13 +9972,13 @@ class jA extends q {
|
|
|
9962
9972
|
return A;
|
|
9963
9973
|
}
|
|
9964
9974
|
}
|
|
9965
|
-
|
|
9975
|
+
XA.create = (g) => new XA({
|
|
9966
9976
|
checks: [],
|
|
9967
9977
|
typeName: M.ZodBigInt,
|
|
9968
9978
|
coerce: g?.coerce ?? !1,
|
|
9969
9979
|
...K(g)
|
|
9970
9980
|
});
|
|
9971
|
-
class
|
|
9981
|
+
class Qg extends q {
|
|
9972
9982
|
_parse(A) {
|
|
9973
9983
|
if (this._def.coerce && (A.data = !!A.data), this._getType(A) !== R.boolean) {
|
|
9974
9984
|
const B = this._getOrReturnCtx(A);
|
|
@@ -9981,7 +9991,7 @@ class Cg extends q {
|
|
|
9981
9991
|
return QA(A.data);
|
|
9982
9992
|
}
|
|
9983
9993
|
}
|
|
9984
|
-
|
|
9994
|
+
Qg.create = (g) => new Qg({
|
|
9985
9995
|
typeName: M.ZodBoolean,
|
|
9986
9996
|
coerce: g?.coerce || !1,
|
|
9987
9997
|
...K(g)
|
|
@@ -10115,7 +10125,7 @@ JB.create = (g) => new JB({
|
|
|
10115
10125
|
typeName: M.ZodNull,
|
|
10116
10126
|
...K(g)
|
|
10117
10127
|
});
|
|
10118
|
-
class
|
|
10128
|
+
class Eg extends q {
|
|
10119
10129
|
constructor() {
|
|
10120
10130
|
super(...arguments), this._any = !0;
|
|
10121
10131
|
}
|
|
@@ -10123,7 +10133,7 @@ class Qg extends q {
|
|
|
10123
10133
|
return QA(A.data);
|
|
10124
10134
|
}
|
|
10125
10135
|
}
|
|
10126
|
-
|
|
10136
|
+
Eg.create = (g) => new Eg({
|
|
10127
10137
|
typeName: M.ZodAny,
|
|
10128
10138
|
...K(g)
|
|
10129
10139
|
});
|
|
@@ -10619,14 +10629,14 @@ NI.create = (g, A) => new NI({
|
|
|
10619
10629
|
typeName: M.ZodUnion,
|
|
10620
10630
|
...K(A)
|
|
10621
10631
|
});
|
|
10622
|
-
function
|
|
10632
|
+
function ig(g, A) {
|
|
10623
10633
|
const I = yA(g), B = yA(A);
|
|
10624
10634
|
if (g === A)
|
|
10625
10635
|
return { valid: !0, data: g };
|
|
10626
10636
|
if (I === R.object && B === R.object) {
|
|
10627
10637
|
const C = l.objectKeys(A), Q = l.objectKeys(g).filter((i) => C.indexOf(i) !== -1), E = { ...g, ...A };
|
|
10628
10638
|
for (const i of Q) {
|
|
10629
|
-
const o =
|
|
10639
|
+
const o = ig(g[i], A[i]);
|
|
10630
10640
|
if (!o.valid)
|
|
10631
10641
|
return { valid: !1 };
|
|
10632
10642
|
E[i] = o.data;
|
|
@@ -10637,7 +10647,7 @@ function Eg(g, A) {
|
|
|
10637
10647
|
return { valid: !1 };
|
|
10638
10648
|
const C = [];
|
|
10639
10649
|
for (let Q = 0; Q < g.length; Q++) {
|
|
10640
|
-
const E = g[Q], i = A[Q], o =
|
|
10650
|
+
const E = g[Q], i = A[Q], o = ig(E, i);
|
|
10641
10651
|
if (!o.valid)
|
|
10642
10652
|
return { valid: !1 };
|
|
10643
10653
|
C.push(o.data);
|
|
@@ -10650,7 +10660,7 @@ class cI extends q {
|
|
|
10650
10660
|
const { status: I, ctx: B } = this._processInputParams(A), C = (Q, E) => {
|
|
10651
10661
|
if (NB(Q) || NB(E))
|
|
10652
10662
|
return Y;
|
|
10653
|
-
const i =
|
|
10663
|
+
const i = ig(Q.value, E.value);
|
|
10654
10664
|
return i.valid ? ((cB(Q) || cB(E)) && I.dirty(), { status: I.value, value: i.data }) : (w(B, {
|
|
10655
10665
|
code: e.invalid_intersection_types
|
|
10656
10666
|
}), Y);
|
|
@@ -10781,7 +10791,7 @@ dB.create = (g, A, I) => new dB({
|
|
|
10781
10791
|
typeName: M.ZodMap,
|
|
10782
10792
|
...K(I)
|
|
10783
10793
|
});
|
|
10784
|
-
class
|
|
10794
|
+
class jA extends q {
|
|
10785
10795
|
_parse(A) {
|
|
10786
10796
|
const { status: I, ctx: B } = this._processInputParams(A);
|
|
10787
10797
|
if (B.parsedType !== R.set)
|
|
@@ -10820,13 +10830,13 @@ class zA extends q {
|
|
|
10820
10830
|
return B.common.async ? Promise.all(i).then((o) => E(o)) : E(i);
|
|
10821
10831
|
}
|
|
10822
10832
|
min(A, I) {
|
|
10823
|
-
return new
|
|
10833
|
+
return new jA({
|
|
10824
10834
|
...this._def,
|
|
10825
10835
|
minSize: { value: A, message: N.toString(I) }
|
|
10826
10836
|
});
|
|
10827
10837
|
}
|
|
10828
10838
|
max(A, I) {
|
|
10829
|
-
return new
|
|
10839
|
+
return new jA({
|
|
10830
10840
|
...this._def,
|
|
10831
10841
|
maxSize: { value: A, message: N.toString(I) }
|
|
10832
10842
|
});
|
|
@@ -10838,7 +10848,7 @@ class zA extends q {
|
|
|
10838
10848
|
return this.min(1, A);
|
|
10839
10849
|
}
|
|
10840
10850
|
}
|
|
10841
|
-
|
|
10851
|
+
jA.create = (g, A) => new jA({
|
|
10842
10852
|
valueType: g,
|
|
10843
10853
|
minSize: null,
|
|
10844
10854
|
maxSize: null,
|
|
@@ -10859,7 +10869,7 @@ KB.create = (g, A) => new KB({
|
|
|
10859
10869
|
typeName: M.ZodLazy,
|
|
10860
10870
|
...K(A)
|
|
10861
10871
|
});
|
|
10862
|
-
class
|
|
10872
|
+
class og extends q {
|
|
10863
10873
|
_parse(A) {
|
|
10864
10874
|
if (A.data !== this._def.value) {
|
|
10865
10875
|
const I = this._getOrReturnCtx(A);
|
|
@@ -10875,7 +10885,7 @@ class ig extends q {
|
|
|
10875
10885
|
return this._def.value;
|
|
10876
10886
|
}
|
|
10877
10887
|
}
|
|
10878
|
-
|
|
10888
|
+
og.create = (g, A) => new og({
|
|
10879
10889
|
value: g,
|
|
10880
10890
|
typeName: M.ZodLiteral,
|
|
10881
10891
|
...K(A)
|
|
@@ -11023,7 +11033,7 @@ class lA extends q {
|
|
|
11023
11033
|
path: B.path,
|
|
11024
11034
|
parent: B
|
|
11025
11035
|
});
|
|
11026
|
-
return o.status === "aborted" ? Y : o.status === "dirty" || I.value === "dirty" ?
|
|
11036
|
+
return o.status === "aborted" ? Y : o.status === "dirty" || I.value === "dirty" ? ZA(o.value) : o;
|
|
11027
11037
|
});
|
|
11028
11038
|
{
|
|
11029
11039
|
if (I.value === "aborted")
|
|
@@ -11033,7 +11043,7 @@ class lA extends q {
|
|
|
11033
11043
|
path: B.path,
|
|
11034
11044
|
parent: B
|
|
11035
11045
|
});
|
|
11036
|
-
return i.status === "aborted" ? Y : i.status === "dirty" || I.value === "dirty" ?
|
|
11046
|
+
return i.status === "aborted" ? Y : i.status === "dirty" || I.value === "dirty" ? ZA(i.value) : i;
|
|
11037
11047
|
}
|
|
11038
11048
|
}
|
|
11039
11049
|
if (C.type === "refinement") {
|
|
@@ -11114,7 +11124,7 @@ fA.create = (g, A) => new fA({
|
|
|
11114
11124
|
typeName: M.ZodNullable,
|
|
11115
11125
|
...K(A)
|
|
11116
11126
|
});
|
|
11117
|
-
class
|
|
11127
|
+
class ag extends q {
|
|
11118
11128
|
_parse(A) {
|
|
11119
11129
|
const { ctx: I } = this._processInputParams(A);
|
|
11120
11130
|
let B = I.data;
|
|
@@ -11128,13 +11138,13 @@ class og extends q {
|
|
|
11128
11138
|
return this._def.innerType;
|
|
11129
11139
|
}
|
|
11130
11140
|
}
|
|
11131
|
-
|
|
11141
|
+
ag.create = (g, A) => new ag({
|
|
11132
11142
|
innerType: g,
|
|
11133
11143
|
typeName: M.ZodDefault,
|
|
11134
11144
|
defaultValue: typeof A.default == "function" ? A.default : () => A.default,
|
|
11135
11145
|
...K(A)
|
|
11136
11146
|
});
|
|
11137
|
-
class
|
|
11147
|
+
class Dg extends q {
|
|
11138
11148
|
_parse(A) {
|
|
11139
11149
|
const { ctx: I } = this._processInputParams(A), B = {
|
|
11140
11150
|
...I,
|
|
@@ -11171,7 +11181,7 @@ class ag extends q {
|
|
|
11171
11181
|
return this._def.innerType;
|
|
11172
11182
|
}
|
|
11173
11183
|
}
|
|
11174
|
-
|
|
11184
|
+
Dg.create = (g, A) => new Dg({
|
|
11175
11185
|
innerType: g,
|
|
11176
11186
|
typeName: M.ZodCatch,
|
|
11177
11187
|
catchValue: typeof A.catch == "function" ? A.catch : () => A.catch,
|
|
@@ -11194,7 +11204,7 @@ qB.create = (g) => new qB({
|
|
|
11194
11204
|
typeName: M.ZodNaN,
|
|
11195
11205
|
...K(g)
|
|
11196
11206
|
});
|
|
11197
|
-
class
|
|
11207
|
+
class ei extends q {
|
|
11198
11208
|
_parse(A) {
|
|
11199
11209
|
const { ctx: I } = this._processInputParams(A), B = I.data;
|
|
11200
11210
|
return this._def.type._parse({
|
|
@@ -11217,7 +11227,7 @@ class qg extends q {
|
|
|
11217
11227
|
path: B.path,
|
|
11218
11228
|
parent: B
|
|
11219
11229
|
});
|
|
11220
|
-
return Q.status === "aborted" ? Y : Q.status === "dirty" ? (I.dirty(),
|
|
11230
|
+
return Q.status === "aborted" ? Y : Q.status === "dirty" ? (I.dirty(), ZA(Q.value)) : this._def.out._parseAsync({
|
|
11221
11231
|
data: Q.value,
|
|
11222
11232
|
path: B.path,
|
|
11223
11233
|
parent: B
|
|
@@ -11247,7 +11257,7 @@ class qg extends q {
|
|
|
11247
11257
|
});
|
|
11248
11258
|
}
|
|
11249
11259
|
}
|
|
11250
|
-
class
|
|
11260
|
+
class sg extends q {
|
|
11251
11261
|
_parse(A) {
|
|
11252
11262
|
const I = this._def.innerType._parse(A), B = (C) => (KA(C) && (C.value = Object.freeze(C.value)), C);
|
|
11253
11263
|
return SI(I) ? I.then((C) => B(C)) : B(I);
|
|
@@ -11256,7 +11266,7 @@ class Dg extends q {
|
|
|
11256
11266
|
return this._def.innerType;
|
|
11257
11267
|
}
|
|
11258
11268
|
}
|
|
11259
|
-
|
|
11269
|
+
sg.create = (g, A) => new sg({
|
|
11260
11270
|
innerType: g,
|
|
11261
11271
|
typeName: M.ZodReadonly,
|
|
11262
11272
|
...K(A)
|
|
@@ -11265,17 +11275,17 @@ var M;
|
|
|
11265
11275
|
(function(g) {
|
|
11266
11276
|
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
11277
|
})(M || (M = {}));
|
|
11268
|
-
const u = eA.create, H = HA.create, sC =
|
|
11278
|
+
const u = eA.create, H = HA.create, sC = Qg.create, nA = Eg.create;
|
|
11269
11279
|
FA.create;
|
|
11270
11280
|
const m = sA.create, L = O.create;
|
|
11271
11281
|
NI.create;
|
|
11272
11282
|
cI.create;
|
|
11273
11283
|
cA.create;
|
|
11274
|
-
const _ =
|
|
11284
|
+
const _ = og.create, LA = qA.create;
|
|
11275
11285
|
UI.create;
|
|
11276
11286
|
GA.create;
|
|
11277
11287
|
fA.create;
|
|
11278
|
-
const
|
|
11288
|
+
const ni = L({
|
|
11279
11289
|
/**The multiscale datasets for this image*/
|
|
11280
11290
|
multiscales: m(
|
|
11281
11291
|
L({
|
|
@@ -11403,7 +11413,7 @@ const ei = L({
|
|
|
11403
11413
|
projection: u().optional()
|
|
11404
11414
|
}).optional()
|
|
11405
11415
|
}).optional()
|
|
11406
|
-
}).describe("JSON from OME-NGFF .zattrs"),
|
|
11416
|
+
}).describe("JSON from OME-NGFF .zattrs"), Gi = L({
|
|
11407
11417
|
plate: L({
|
|
11408
11418
|
/**The acquisitions for this plate*/
|
|
11409
11419
|
acquisitions: m(
|
|
@@ -11462,7 +11472,7 @@ const ei = L({
|
|
|
11462
11472
|
})
|
|
11463
11473
|
).min(1).describe("The wells of the plate")
|
|
11464
11474
|
}).optional()
|
|
11465
|
-
}).describe("JSON from OME-NGFF .zattrs"),
|
|
11475
|
+
}).describe("JSON from OME-NGFF .zattrs"), wi = L({
|
|
11466
11476
|
well: L({
|
|
11467
11477
|
/**The fields of view for this well*/
|
|
11468
11478
|
images: m(
|
|
@@ -11476,7 +11486,7 @@ const ei = L({
|
|
|
11476
11486
|
/**The version of the specification*/
|
|
11477
11487
|
version: _("0.4").describe("The version of the specification").optional()
|
|
11478
11488
|
}).optional()
|
|
11479
|
-
}).describe("JSON from OME-NGFF .zattrs"),
|
|
11489
|
+
}).describe("JSON from OME-NGFF .zattrs"), Fi = L({
|
|
11480
11490
|
/**The versioned OME-Zarr Metadata namespace*/
|
|
11481
11491
|
ome: L({
|
|
11482
11492
|
/**The multiscale datasets for this image*/
|
|
@@ -11606,7 +11616,7 @@ const ei = L({
|
|
|
11606
11616
|
/**The version of the OME-Zarr Metadata*/
|
|
11607
11617
|
version: _("0.5").describe("The version of the OME-Zarr Metadata")
|
|
11608
11618
|
}).describe("The versioned OME-Zarr Metadata namespace")
|
|
11609
|
-
}).describe("The zarr.json attributes key"),
|
|
11619
|
+
}).describe("The zarr.json attributes key"), ri = L({
|
|
11610
11620
|
/**The versioned OME-Zarr Metadata namespace*/
|
|
11611
11621
|
ome: L({
|
|
11612
11622
|
plate: L({
|
|
@@ -11668,7 +11678,7 @@ const ei = L({
|
|
|
11668
11678
|
/**The version of the OME-Zarr Metadata*/
|
|
11669
11679
|
version: _("0.5").describe("The version of the OME-Zarr Metadata")
|
|
11670
11680
|
}).describe("The versioned OME-Zarr Metadata namespace")
|
|
11671
|
-
}).describe("The zarr.json attributes key"),
|
|
11681
|
+
}).describe("The zarr.json attributes key"), Si = L({
|
|
11672
11682
|
/**The versioned OME-Zarr Metadata namespace*/
|
|
11673
11683
|
ome: L({
|
|
11674
11684
|
well: L({
|
|
@@ -11687,15 +11697,15 @@ const ei = L({
|
|
|
11687
11697
|
/**The version of the OME-Zarr Metadata*/
|
|
11688
11698
|
version: _("0.5").describe("The version of the OME-Zarr Metadata")
|
|
11689
11699
|
}).describe("The versioned OME-Zarr Metadata namespace")
|
|
11690
|
-
}).describe("JSON from OME-Zarr zarr.json"),
|
|
11691
|
-
function
|
|
11700
|
+
}).describe("JSON from OME-Zarr zarr.json"), Ri = ["0.4", "0.5"], Ni = new Set(Ri);
|
|
11701
|
+
function ci(g) {
|
|
11692
11702
|
if (!("ome" in g) || !(g.ome instanceof Object)) return;
|
|
11693
11703
|
const A = g.ome;
|
|
11694
|
-
if ("version" in A && typeof A.version == "string" &&
|
|
11704
|
+
if ("version" in A && typeof A.version == "string" && Ni.has(A.version))
|
|
11695
11705
|
return A.version;
|
|
11696
11706
|
}
|
|
11697
11707
|
function lg(g) {
|
|
11698
|
-
const A =
|
|
11708
|
+
const A = ci(g);
|
|
11699
11709
|
return A === void 0 ? "0.4" : A;
|
|
11700
11710
|
}
|
|
11701
11711
|
function pA(g) {
|
|
@@ -11712,9 +11722,9 @@ function hC(g, A) {
|
|
|
11712
11722
|
return delete I[A], I;
|
|
11713
11723
|
}
|
|
11714
11724
|
async function eo(g, A) {
|
|
11715
|
-
const I = new
|
|
11725
|
+
const I = new _A(g), B = new CA(I), C = pA(A), Q = await gI(B, C);
|
|
11716
11726
|
try {
|
|
11717
|
-
return
|
|
11727
|
+
return Ui(Q.attrs);
|
|
11718
11728
|
} catch {
|
|
11719
11729
|
throw Error(
|
|
11720
11730
|
`Failed to parse OME-Zarr plate:
|
|
@@ -11722,21 +11732,21 @@ ${JSON.stringify(Q.attrs)}`
|
|
|
11722
11732
|
);
|
|
11723
11733
|
}
|
|
11724
11734
|
}
|
|
11725
|
-
function
|
|
11735
|
+
function Ui(g) {
|
|
11726
11736
|
switch (lg(g)) {
|
|
11727
11737
|
case "0.5":
|
|
11728
11738
|
return {
|
|
11729
|
-
...
|
|
11739
|
+
...ri.parse(g).ome,
|
|
11730
11740
|
originalVersion: "0.5"
|
|
11731
11741
|
};
|
|
11732
11742
|
case "0.4":
|
|
11733
11743
|
return {
|
|
11734
|
-
...
|
|
11744
|
+
...ki(Gi.parse(g)).ome,
|
|
11735
11745
|
originalVersion: "0.4"
|
|
11736
11746
|
};
|
|
11737
11747
|
}
|
|
11738
11748
|
}
|
|
11739
|
-
function
|
|
11749
|
+
function ki(g) {
|
|
11740
11750
|
if (g.plate === void 0)
|
|
11741
11751
|
throw new Error("Plate metadata is missing in OME-Zarr v0.4 plate");
|
|
11742
11752
|
return {
|
|
@@ -11746,7 +11756,7 @@ function Ui(g) {
|
|
|
11746
11756
|
}
|
|
11747
11757
|
};
|
|
11748
11758
|
}
|
|
11749
|
-
function
|
|
11759
|
+
function Li(g) {
|
|
11750
11760
|
if (g.well === void 0)
|
|
11751
11761
|
throw new Error("Well metadata is missing in OME-Zarr v0.4 well");
|
|
11752
11762
|
return {
|
|
@@ -11756,24 +11766,24 @@ function ki(g) {
|
|
|
11756
11766
|
}
|
|
11757
11767
|
};
|
|
11758
11768
|
}
|
|
11759
|
-
function
|
|
11769
|
+
function Ji(g) {
|
|
11760
11770
|
switch (lg(g)) {
|
|
11761
11771
|
case "0.5":
|
|
11762
11772
|
return {
|
|
11763
|
-
...
|
|
11773
|
+
...Si.parse(g).ome,
|
|
11764
11774
|
originalVersion: "0.5"
|
|
11765
11775
|
};
|
|
11766
11776
|
case "0.4":
|
|
11767
11777
|
return {
|
|
11768
|
-
...
|
|
11778
|
+
...Li(wi.parse(g)).ome,
|
|
11769
11779
|
originalVersion: "0.4"
|
|
11770
11780
|
};
|
|
11771
11781
|
}
|
|
11772
11782
|
}
|
|
11773
11783
|
async function no(g, A, I) {
|
|
11774
|
-
const B = g + "/" + A, C = new
|
|
11784
|
+
const B = g + "/" + A, C = new _A(B), Q = new CA(C), E = pA(I), i = await gI(Q, E);
|
|
11775
11785
|
try {
|
|
11776
|
-
return
|
|
11786
|
+
return Ji(i.attrs);
|
|
11777
11787
|
} catch {
|
|
11778
11788
|
throw Error(
|
|
11779
11789
|
`Failed to parse OME-Zarr well:
|
|
@@ -11782,14 +11792,14 @@ ${JSON.stringify(i.attrs)}`
|
|
|
11782
11792
|
}
|
|
11783
11793
|
}
|
|
11784
11794
|
async function Go(g) {
|
|
11785
|
-
const A = pA(g.version), I = await
|
|
11795
|
+
const A = pA(g.version), I = await gI(g.location, A);
|
|
11786
11796
|
return fg(I.attrs).omero?.channels ?? [];
|
|
11787
11797
|
}
|
|
11788
11798
|
async function wo(g) {
|
|
11789
|
-
const A = pA(g.version), I = await
|
|
11799
|
+
const A = pA(g.version), I = await gI(g.location, A);
|
|
11790
11800
|
return fg(I.attrs).omero?.rdefs;
|
|
11791
11801
|
}
|
|
11792
|
-
function
|
|
11802
|
+
function Yi(g) {
|
|
11793
11803
|
return {
|
|
11794
11804
|
ome: {
|
|
11795
11805
|
multiscales: g.multiscales,
|
|
@@ -11798,29 +11808,29 @@ function Ji(g) {
|
|
|
11798
11808
|
}
|
|
11799
11809
|
};
|
|
11800
11810
|
}
|
|
11801
|
-
function
|
|
11811
|
+
function Mi(g) {
|
|
11802
11812
|
switch (lg(g)) {
|
|
11803
11813
|
case "0.5":
|
|
11804
11814
|
return {
|
|
11805
|
-
...
|
|
11815
|
+
...Fi.parse(g).ome,
|
|
11806
11816
|
originalVersion: "0.5"
|
|
11807
11817
|
};
|
|
11808
11818
|
case "0.4":
|
|
11809
11819
|
return {
|
|
11810
|
-
...
|
|
11820
|
+
...Yi(ni.parse(g)).ome,
|
|
11811
11821
|
originalVersion: "0.4"
|
|
11812
11822
|
};
|
|
11813
11823
|
}
|
|
11814
11824
|
}
|
|
11815
11825
|
function fg(g) {
|
|
11816
11826
|
try {
|
|
11817
|
-
return
|
|
11827
|
+
return Mi(g);
|
|
11818
11828
|
} catch {
|
|
11819
11829
|
throw Error(`Failed to parse OME-Zarr image:
|
|
11820
11830
|
${JSON.stringify(g)}`);
|
|
11821
11831
|
}
|
|
11822
11832
|
}
|
|
11823
|
-
class
|
|
11833
|
+
class PA {
|
|
11824
11834
|
location;
|
|
11825
11835
|
version;
|
|
11826
11836
|
loader_;
|
|
@@ -11829,7 +11839,7 @@ class OA {
|
|
|
11829
11839
|
}
|
|
11830
11840
|
static async openLoader(A, I) {
|
|
11831
11841
|
let B = pA(I);
|
|
11832
|
-
const C = await
|
|
11842
|
+
const C = await gI(A, B), Q = fg(C.attrs), E = Q.multiscales;
|
|
11833
11843
|
if (E.length !== 1)
|
|
11834
11844
|
throw new Error(
|
|
11835
11845
|
`Exactly one multiscale image is supported. Found ${E.length} images.`
|
|
@@ -11839,15 +11849,15 @@ class OA {
|
|
|
11839
11849
|
throw new Error("No datasets found in the multiscale image.");
|
|
11840
11850
|
B || (B = pA(Q.originalVersion));
|
|
11841
11851
|
const o = i.datasets.map(
|
|
11842
|
-
(h) =>
|
|
11852
|
+
(h) => LE(A, h.path, B)
|
|
11843
11853
|
), a = await Promise.all(
|
|
11844
|
-
o.map((h) =>
|
|
11854
|
+
o.map((h) => kE(h))
|
|
11845
11855
|
), D = a[0].shape, s = i.axes;
|
|
11846
11856
|
if (s.length !== D.length)
|
|
11847
11857
|
throw new Error(
|
|
11848
11858
|
`Mismatch between number of axes (${s.length}) and array shape (${D.length})`
|
|
11849
11859
|
);
|
|
11850
|
-
return new
|
|
11860
|
+
return new uE({ metadata: i, arrays: a, arrayParams: o });
|
|
11851
11861
|
}
|
|
11852
11862
|
getDimensions() {
|
|
11853
11863
|
return this.loader_.getSourceDimensionMap();
|
|
@@ -11865,8 +11875,8 @@ class OA {
|
|
|
11865
11875
|
* @param props.version OME-Zarr version
|
|
11866
11876
|
*/
|
|
11867
11877
|
static async fromHttp(A) {
|
|
11868
|
-
const I = new CA(new
|
|
11869
|
-
return new
|
|
11878
|
+
const I = new CA(new _A(A.url)), B = await PA.openLoader(I, A.version);
|
|
11879
|
+
return new PA({ location: I, version: A.version, loader: B });
|
|
11870
11880
|
}
|
|
11871
11881
|
/**
|
|
11872
11882
|
* Creates and opens an OmeZarrImageSource from a local filesystem directory.
|
|
@@ -11881,11 +11891,11 @@ class OA {
|
|
|
11881
11891
|
const I = new CA(
|
|
11882
11892
|
new Hg(A.directory),
|
|
11883
11893
|
A.path
|
|
11884
|
-
), B = await
|
|
11885
|
-
return new
|
|
11894
|
+
), B = await PA.openLoader(I, A.version);
|
|
11895
|
+
return new PA({ location: I, version: A.version, loader: B });
|
|
11886
11896
|
}
|
|
11887
11897
|
}
|
|
11888
|
-
class
|
|
11898
|
+
class HI {
|
|
11889
11899
|
coverageGroups_ = /* @__PURE__ */ new Map();
|
|
11890
11900
|
state_ = "initialized";
|
|
11891
11901
|
attached_ = !1;
|
|
@@ -11954,7 +11964,7 @@ class KI {
|
|
|
11954
11964
|
return {};
|
|
11955
11965
|
}
|
|
11956
11966
|
}
|
|
11957
|
-
class
|
|
11967
|
+
class di extends mA {
|
|
11958
11968
|
// this creates the geometry for a screen-space projected line
|
|
11959
11969
|
// each point on the input path is split into two vertices
|
|
11960
11970
|
// these are pushed in opposite directions in screen-space to create width
|
|
@@ -12003,7 +12013,7 @@ class Mi extends mA {
|
|
|
12003
12013
|
return I;
|
|
12004
12014
|
}
|
|
12005
12015
|
}
|
|
12006
|
-
class
|
|
12016
|
+
class Ki extends mA {
|
|
12007
12017
|
constructor(A) {
|
|
12008
12018
|
if (super(), A.primitive != "triangles") {
|
|
12009
12019
|
k.warn("WireframeGeometry", "Only indexed geometries are supported");
|
|
@@ -12028,41 +12038,41 @@ class di extends mA {
|
|
|
12028
12038
|
this.indexData_ = new Uint32Array(B);
|
|
12029
12039
|
}
|
|
12030
12040
|
}
|
|
12031
|
-
const
|
|
12032
|
-
class
|
|
12041
|
+
const Hi = p(0, 1, 0);
|
|
12042
|
+
class tC {
|
|
12033
12043
|
dirty_ = !0;
|
|
12034
12044
|
matrix_ = $();
|
|
12035
12045
|
rotation_ = sI();
|
|
12036
12046
|
translation_ = d();
|
|
12037
12047
|
scale_ = p(1, 1, 1);
|
|
12038
12048
|
addRotation(A) {
|
|
12039
|
-
|
|
12049
|
+
CQ(this.rotation_, this.rotation_, A), this.dirty_ = !0;
|
|
12040
12050
|
}
|
|
12041
12051
|
setRotation(A) {
|
|
12042
|
-
|
|
12052
|
+
EQ(this.rotation_, A), this.dirty_ = !0;
|
|
12043
12053
|
}
|
|
12044
12054
|
get rotation() {
|
|
12045
|
-
return
|
|
12055
|
+
return QQ(this.rotation_);
|
|
12046
12056
|
}
|
|
12047
12057
|
addTranslation(A) {
|
|
12048
12058
|
JA(this.translation_, this.translation_, A), this.dirty_ = !0;
|
|
12049
12059
|
}
|
|
12050
12060
|
setTranslation(A) {
|
|
12051
|
-
|
|
12061
|
+
jI(this.translation_, A), this.dirty_ = !0;
|
|
12052
12062
|
}
|
|
12053
12063
|
get translation() {
|
|
12054
12064
|
return DA(this.translation_);
|
|
12055
12065
|
}
|
|
12056
12066
|
addScale(A) {
|
|
12057
|
-
|
|
12067
|
+
jC(this.scale_, this.scale_, A), this.dirty_ = !0;
|
|
12058
12068
|
}
|
|
12059
12069
|
setScale(A) {
|
|
12060
|
-
|
|
12070
|
+
jI(this.scale_, A), this.dirty_ = !0;
|
|
12061
12071
|
}
|
|
12062
12072
|
targetTo(A) {
|
|
12063
12073
|
ng(this.translation_, A) && (A = DA(A), A[2] += T);
|
|
12064
|
-
const I =
|
|
12065
|
-
Gg(this.rotation_, B),
|
|
12074
|
+
const I = vC($(), this.translation_, A, Hi), B = TC(PB(), I);
|
|
12075
|
+
Gg(this.rotation_, B), YI(this.rotation_, this.rotation_), this.dirty_ = !0;
|
|
12066
12076
|
}
|
|
12067
12077
|
get scale() {
|
|
12068
12078
|
return DA(this.scale_);
|
|
@@ -12071,10 +12081,10 @@ class Hi {
|
|
|
12071
12081
|
return this.dirty_ && (this.computeMatrix(), this.dirty_ = !1), this.matrix_;
|
|
12072
12082
|
}
|
|
12073
12083
|
get inverse() {
|
|
12074
|
-
return
|
|
12084
|
+
return JI($(), this.matrix);
|
|
12075
12085
|
}
|
|
12076
12086
|
computeMatrix() {
|
|
12077
|
-
|
|
12087
|
+
bC(
|
|
12078
12088
|
this.matrix_,
|
|
12079
12089
|
this.rotation_,
|
|
12080
12090
|
this.translation_,
|
|
@@ -12150,13 +12160,13 @@ class x {
|
|
|
12150
12160
|
return I.length === 1 ? "0" + I : I;
|
|
12151
12161
|
}
|
|
12152
12162
|
}
|
|
12153
|
-
class
|
|
12163
|
+
class BI extends LI {
|
|
12154
12164
|
wireframeEnabled = !1;
|
|
12155
12165
|
wireframeColor = x.WHITE;
|
|
12156
12166
|
depthTest = !0;
|
|
12157
12167
|
textures_ = [];
|
|
12158
12168
|
staleTextures_ = [];
|
|
12159
|
-
transform_ = new
|
|
12169
|
+
transform_ = new tC();
|
|
12160
12170
|
geometry_ = new mA();
|
|
12161
12171
|
wireframeGeometry_ = null;
|
|
12162
12172
|
programName_ = null;
|
|
@@ -12178,7 +12188,7 @@ class xA extends hg {
|
|
|
12178
12188
|
return this.geometry_;
|
|
12179
12189
|
}
|
|
12180
12190
|
get wireframeGeometry() {
|
|
12181
|
-
return this.wireframeGeometry_ ??= new
|
|
12191
|
+
return this.wireframeGeometry_ ??= new Ki(this.geometry), this.wireframeGeometry_;
|
|
12182
12192
|
}
|
|
12183
12193
|
get textures() {
|
|
12184
12194
|
return this.textures_;
|
|
@@ -12213,7 +12223,7 @@ class xA extends hg {
|
|
|
12213
12223
|
return {};
|
|
12214
12224
|
}
|
|
12215
12225
|
}
|
|
12216
|
-
class qi extends
|
|
12226
|
+
class qi extends BI {
|
|
12217
12227
|
color_;
|
|
12218
12228
|
width_;
|
|
12219
12229
|
constructor({ geometry: A, color: I, width: B }) {
|
|
@@ -12241,25 +12251,25 @@ class qi extends xA {
|
|
|
12241
12251
|
};
|
|
12242
12252
|
}
|
|
12243
12253
|
}
|
|
12244
|
-
class Fo extends
|
|
12254
|
+
class Fo extends HI {
|
|
12245
12255
|
type = "AxesLayer";
|
|
12246
12256
|
constructor(A) {
|
|
12247
12257
|
super();
|
|
12248
12258
|
const { length: I, width: B } = A;
|
|
12249
12259
|
this.addObject(
|
|
12250
|
-
|
|
12260
|
+
PI({
|
|
12251
12261
|
end: [I, 0, 0],
|
|
12252
12262
|
width: B,
|
|
12253
12263
|
color: [1, 0, 0]
|
|
12254
12264
|
})
|
|
12255
12265
|
), this.addObject(
|
|
12256
|
-
|
|
12266
|
+
PI({
|
|
12257
12267
|
end: [0, I, 0],
|
|
12258
12268
|
width: B,
|
|
12259
12269
|
color: [0, 1, 0]
|
|
12260
12270
|
})
|
|
12261
12271
|
), this.addObject(
|
|
12262
|
-
|
|
12272
|
+
PI({
|
|
12263
12273
|
end: [0, 0, I],
|
|
12264
12274
|
width: B,
|
|
12265
12275
|
color: [0, 0, 1]
|
|
@@ -12269,15 +12279,15 @@ class Fo extends KI {
|
|
|
12269
12279
|
update() {
|
|
12270
12280
|
}
|
|
12271
12281
|
}
|
|
12272
|
-
function
|
|
12273
|
-
const { end: A, width: I, color: B } = g, C = new
|
|
12282
|
+
function PI(g) {
|
|
12283
|
+
const { end: A, width: I, color: B } = g, C = new di([[0, 0, 0], A]);
|
|
12274
12284
|
return new qi({
|
|
12275
12285
|
geometry: C,
|
|
12276
12286
|
color: B,
|
|
12277
12287
|
width: I
|
|
12278
12288
|
});
|
|
12279
12289
|
}
|
|
12280
|
-
const
|
|
12290
|
+
const yC = [
|
|
12281
12291
|
"fallbackVisible",
|
|
12282
12292
|
"prefetchTime",
|
|
12283
12293
|
"visibleCurrent",
|
|
@@ -12292,7 +12302,7 @@ function pg(g) {
|
|
|
12292
12302
|
z: g.prefetch.z ?? 0,
|
|
12293
12303
|
t: g.prefetch.t ?? 0
|
|
12294
12304
|
}, I = Object.freeze(
|
|
12295
|
-
|
|
12305
|
+
yC.reduce(
|
|
12296
12306
|
(Q, E) => {
|
|
12297
12307
|
const i = g.priorityOrder.indexOf(E);
|
|
12298
12308
|
return Q[E] = i, Q;
|
|
@@ -12359,7 +12369,7 @@ function li(g) {
|
|
|
12359
12369
|
if (A?.min !== void 0 && A?.max !== void 0 && A.min > A.max)
|
|
12360
12370
|
throw new Error("lod.min must be <= lod.max");
|
|
12361
12371
|
const I = g.priorityOrder;
|
|
12362
|
-
if (I.length !==
|
|
12372
|
+
if (I.length !== yC.length || new Set(I).size !== I.length)
|
|
12363
12373
|
throw new Error("priorityOrder must include all categories exactly once");
|
|
12364
12374
|
}
|
|
12365
12375
|
function ug(g, A = {}) {
|
|
@@ -12371,7 +12381,7 @@ function ug(g, A = {}) {
|
|
|
12371
12381
|
};
|
|
12372
12382
|
}
|
|
12373
12383
|
const lB = 32;
|
|
12374
|
-
function
|
|
12384
|
+
function zA(g, { visible: A, color: I, contrastLimits: B, opacity: C }) {
|
|
12375
12385
|
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(
|
|
12376
12386
|
"Channel",
|
|
12377
12387
|
"No texture provided, defaulting channel contrast limits to [0, 1]."
|
|
@@ -12382,12 +12392,12 @@ function _A(g, { visible: A, color: I, contrastLimits: B, opacity: C }) {
|
|
|
12382
12392
|
opacity: C
|
|
12383
12393
|
};
|
|
12384
12394
|
}
|
|
12385
|
-
function
|
|
12395
|
+
function hg(g, A) {
|
|
12386
12396
|
if (A.length > lB)
|
|
12387
12397
|
throw new Error(`Maximum number of channels is ${lB}`);
|
|
12388
|
-
return A.map((I) =>
|
|
12398
|
+
return A.map((I) => zA(g, I));
|
|
12389
12399
|
}
|
|
12390
|
-
function
|
|
12400
|
+
function eC(g, A) {
|
|
12391
12401
|
if (g && g.length !== A)
|
|
12392
12402
|
throw new Error(
|
|
12393
12403
|
`channelProps length (${g.length}) must match source channel count (${A}).`
|
|
@@ -12395,14 +12405,14 @@ function yC(g, A) {
|
|
|
12395
12405
|
}
|
|
12396
12406
|
function fi(g, A) {
|
|
12397
12407
|
if (g === void 0)
|
|
12398
|
-
return
|
|
12408
|
+
return eQ(A);
|
|
12399
12409
|
if (g[1] <= g[0])
|
|
12400
12410
|
throw new Error(
|
|
12401
12411
|
`Contrast limits must be strictly increasing: ${g}.`
|
|
12402
12412
|
);
|
|
12403
12413
|
return g;
|
|
12404
12414
|
}
|
|
12405
|
-
class
|
|
12415
|
+
class nC extends mA {
|
|
12406
12416
|
constructor(A, I, B, C) {
|
|
12407
12417
|
super();
|
|
12408
12418
|
const Q = [], E = [], i = B, o = C, a = i + 1, D = o + 1, s = A / i, h = I / o;
|
|
@@ -12433,7 +12443,7 @@ class eC extends mA {
|
|
|
12433
12443
|
});
|
|
12434
12444
|
}
|
|
12435
12445
|
}
|
|
12436
|
-
class pi extends
|
|
12446
|
+
class pi extends BI {
|
|
12437
12447
|
channels_;
|
|
12438
12448
|
worldToTexCoord = $();
|
|
12439
12449
|
constructor({
|
|
@@ -12442,16 +12452,16 @@ class pi extends xA {
|
|
|
12442
12452
|
texture: B,
|
|
12443
12453
|
channelProps: C = []
|
|
12444
12454
|
}) {
|
|
12445
|
-
super(), this.geometry = new
|
|
12455
|
+
super(), this.geometry = new nC(A, I, 1, 1), this.setTexture(0, B), this.channels_ = hg(B, C), this.programName = mi(B);
|
|
12446
12456
|
}
|
|
12447
12457
|
get type() {
|
|
12448
12458
|
return "ImageRenderable";
|
|
12449
12459
|
}
|
|
12450
12460
|
setChannelProps(A) {
|
|
12451
|
-
this.channels_ =
|
|
12461
|
+
this.channels_ = hg(this.textures[0], A);
|
|
12452
12462
|
}
|
|
12453
12463
|
setChannelProperty(A, I, B) {
|
|
12454
|
-
const C =
|
|
12464
|
+
const C = zA(this.textures[0], {
|
|
12455
12465
|
...this.channels_[A],
|
|
12456
12466
|
[I]: B
|
|
12457
12467
|
});
|
|
@@ -12461,7 +12471,7 @@ class pi extends xA {
|
|
|
12461
12471
|
const A = this.textures[0];
|
|
12462
12472
|
if (!A)
|
|
12463
12473
|
throw new Error("No texture set");
|
|
12464
|
-
const { color: I, contrastLimits: B, opacity: C } = this.channels_[0] ??
|
|
12474
|
+
const { color: I, contrastLimits: B, opacity: C } = this.channels_[0] ?? zA(A, {});
|
|
12465
12475
|
return {
|
|
12466
12476
|
u_imageSampler: 0,
|
|
12467
12477
|
u_color: I.rgb,
|
|
@@ -12505,11 +12515,11 @@ class aA {
|
|
|
12505
12515
|
const A = tg(this.normal);
|
|
12506
12516
|
if (A > 0) {
|
|
12507
12517
|
const I = 1 / A;
|
|
12508
|
-
|
|
12518
|
+
VA(this.normal, this.normal, I), this.signedDistance *= I;
|
|
12509
12519
|
}
|
|
12510
12520
|
}
|
|
12511
12521
|
}
|
|
12512
|
-
function
|
|
12522
|
+
function GC(g, A, I, B, C = 3) {
|
|
12513
12523
|
switch (g.type) {
|
|
12514
12524
|
case "pointerdown": {
|
|
12515
12525
|
const Q = g.event;
|
|
@@ -12518,7 +12528,7 @@ function nC(g, A, I, B, C = 3) {
|
|
|
12518
12528
|
case "pointerup": {
|
|
12519
12529
|
if (!A) return A;
|
|
12520
12530
|
const Q = g.event, E = V(Q.clientX, Q.clientY);
|
|
12521
|
-
if (
|
|
12531
|
+
if (iQ(A, E) < C) {
|
|
12522
12532
|
if (!B) return null;
|
|
12523
12533
|
const o = g.worldRay;
|
|
12524
12534
|
return o && I(o).then((a) => {
|
|
@@ -12550,7 +12560,7 @@ class Tg {
|
|
|
12550
12560
|
this.bins_.clear();
|
|
12551
12561
|
}
|
|
12552
12562
|
}
|
|
12553
|
-
class
|
|
12563
|
+
class wC extends HI {
|
|
12554
12564
|
type = "ImageLayer";
|
|
12555
12565
|
source_;
|
|
12556
12566
|
sliceCoords_;
|
|
@@ -12594,7 +12604,7 @@ class GC extends KI {
|
|
|
12594
12604
|
this.source_,
|
|
12595
12605
|
this.policy_,
|
|
12596
12606
|
this.axes_
|
|
12597
|
-
),
|
|
12607
|
+
), eC(
|
|
12598
12608
|
this.channelProps_,
|
|
12599
12609
|
this.chunkStoreView_.channelCount
|
|
12600
12610
|
);
|
|
@@ -12657,10 +12667,10 @@ class GC extends KI {
|
|
|
12657
12667
|
return this.lastPresentationTimeCoord_;
|
|
12658
12668
|
}
|
|
12659
12669
|
isPresentationStale() {
|
|
12660
|
-
return this.lastPresentationTimeStamp_ === void 0 ? !1 : performance.now() - this.lastPresentationTimeStamp_ >
|
|
12670
|
+
return this.lastPresentationTimeStamp_ === void 0 ? !1 : performance.now() - this.lastPresentationTimeStamp_ > wC.STALE_PRESENTATION_MS_;
|
|
12661
12671
|
}
|
|
12662
12672
|
onEvent(A) {
|
|
12663
|
-
this.pointerDownPos_ =
|
|
12673
|
+
this.pointerDownPos_ = GC(
|
|
12664
12674
|
A,
|
|
12665
12675
|
this.pointerDownPos_,
|
|
12666
12676
|
(I) => this.pickAtRay(I),
|
|
@@ -12695,7 +12705,7 @@ class GC extends KI {
|
|
|
12695
12705
|
set imageSourcePolicy(A) {
|
|
12696
12706
|
this.policy_ !== A && (this.policy_ = A, this.chunkStoreView_ && this.chunkStoreView_.setImageSourcePolicy(
|
|
12697
12707
|
A,
|
|
12698
|
-
|
|
12708
|
+
MI
|
|
12699
12709
|
));
|
|
12700
12710
|
}
|
|
12701
12711
|
getImageForChunk(A, I) {
|
|
@@ -12847,7 +12857,7 @@ class ui extends mA {
|
|
|
12847
12857
|
}
|
|
12848
12858
|
}
|
|
12849
12859
|
}
|
|
12850
|
-
class Ti extends
|
|
12860
|
+
class Ti extends BI {
|
|
12851
12861
|
voxelScale = p(1, 1, 1);
|
|
12852
12862
|
channels_;
|
|
12853
12863
|
loadedChannels_ = /* @__PURE__ */ new Set();
|
|
@@ -12903,7 +12913,7 @@ class Ti extends xA {
|
|
|
12903
12913
|
for (let o = 0; o < i && E.length < 4; o++) {
|
|
12904
12914
|
const a = this.channelToTextureIndex_.get(o);
|
|
12905
12915
|
if (a === void 0 || !this.loadedChannels_.has(o)) continue;
|
|
12906
|
-
const D = this.textures[a], s =
|
|
12916
|
+
const D = this.textures[a], s = zA(D, this.channels_[o] || {});
|
|
12907
12917
|
if (!s.visible) continue;
|
|
12908
12918
|
const h = E.length;
|
|
12909
12919
|
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;
|
|
@@ -12936,13 +12946,13 @@ class Ti extends xA {
|
|
|
12936
12946
|
return I !== void 0 ? this.textures[I] : null;
|
|
12937
12947
|
}
|
|
12938
12948
|
setChannelProps(A) {
|
|
12939
|
-
this.channels_ =
|
|
12949
|
+
this.channels_ = hg(
|
|
12940
12950
|
this.getAvailableChannelTexture(),
|
|
12941
12951
|
A
|
|
12942
12952
|
);
|
|
12943
12953
|
}
|
|
12944
12954
|
setChannelProperty(A, I, B) {
|
|
12945
|
-
const C =
|
|
12955
|
+
const C = zA(
|
|
12946
12956
|
this.getAvailableChannelTexture(A),
|
|
12947
12957
|
{
|
|
12948
12958
|
...this.channels_[A],
|
|
@@ -12969,13 +12979,13 @@ function xi(g) {
|
|
|
12969
12979
|
function Wi(g, A) {
|
|
12970
12980
|
const I = A.position, B = d(), C = d();
|
|
12971
12981
|
return g.sort((Q, E) => {
|
|
12972
|
-
JA(B, Q.boundingBox.max, Q.boundingBox.min),
|
|
12982
|
+
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
12983
|
const i = Vg(I, B), o = Vg(I, C);
|
|
12974
12984
|
return i - o;
|
|
12975
12985
|
}), g;
|
|
12976
12986
|
}
|
|
12977
12987
|
const bi = 2;
|
|
12978
|
-
class Ro extends
|
|
12988
|
+
class Ro extends HI {
|
|
12979
12989
|
type = "VolumeLayer";
|
|
12980
12990
|
source_;
|
|
12981
12991
|
sliceCoords_;
|
|
@@ -13009,7 +13019,7 @@ class Ro extends KI {
|
|
|
13009
13019
|
set imageSourcePolicy(A) {
|
|
13010
13020
|
this.policy_ !== A && (this.policy_ = A, this.chunkStoreView_ && this.chunkStoreView_.setImageSourcePolicy(
|
|
13011
13021
|
A,
|
|
13012
|
-
|
|
13022
|
+
MI
|
|
13013
13023
|
));
|
|
13014
13024
|
}
|
|
13015
13025
|
setChannelProps(A) {
|
|
@@ -13053,7 +13063,7 @@ class Ro extends KI {
|
|
|
13053
13063
|
this.chunkStoreView_ = A.chunkManager.addView(
|
|
13054
13064
|
this.source_,
|
|
13055
13065
|
this.policy_
|
|
13056
|
-
),
|
|
13066
|
+
), eC(
|
|
13057
13067
|
this.channelProps_,
|
|
13058
13068
|
this.chunkStoreView_.channelCount
|
|
13059
13069
|
);
|
|
@@ -13184,7 +13194,7 @@ class pB {
|
|
|
13184
13194
|
this.lookupTable = vi(A.lookupTable), this.cycle = Xi(A.cycle);
|
|
13185
13195
|
}
|
|
13186
13196
|
}
|
|
13187
|
-
const
|
|
13197
|
+
const FC = /* @__PURE__ */ new Set(["byte", "short", "int"]), ji = /* @__PURE__ */ new Set([
|
|
13188
13198
|
"unsigned_byte",
|
|
13189
13199
|
"unsigned_short",
|
|
13190
13200
|
"unsigned_int"
|
|
@@ -13194,21 +13204,21 @@ function zi(g) {
|
|
|
13194
13204
|
throw new Error(
|
|
13195
13205
|
`Image data format must be scalar, instead found: ${g.dataFormat}`
|
|
13196
13206
|
);
|
|
13197
|
-
if (!
|
|
13207
|
+
if (!FC.has(g.dataType) && !ji.has(g.dataType))
|
|
13198
13208
|
throw new Error(
|
|
13199
13209
|
`Image data type must be an integer, instead found: ${g.dataType}`
|
|
13200
13210
|
);
|
|
13201
13211
|
return g;
|
|
13202
13212
|
}
|
|
13203
13213
|
function _i(g) {
|
|
13204
|
-
return
|
|
13214
|
+
return FC.has(g.dataType) ? "intLabelImage" : "labelImage";
|
|
13205
13215
|
}
|
|
13206
|
-
class $i extends
|
|
13216
|
+
class $i extends BI {
|
|
13207
13217
|
outlineSelected_;
|
|
13208
13218
|
selectedValue_;
|
|
13209
13219
|
worldToTexCoord = $();
|
|
13210
13220
|
constructor(A) {
|
|
13211
|
-
super(), this.geometry = new
|
|
13221
|
+
super(), this.geometry = new nC(A.width, A.height, 1, 1), this.setTexture(0, zi(A.imageData));
|
|
13212
13222
|
const I = this.makeColorCycleTexture(A.colorMap.cycle);
|
|
13213
13223
|
this.setTexture(1, I);
|
|
13214
13224
|
const B = this.makeColorLookupTableTexture(
|
|
@@ -13247,7 +13257,7 @@ class $i extends xA {
|
|
|
13247
13257
|
return Q.set(I, 0), Q.set(B, C), new fB(Q, C, 2);
|
|
13248
13258
|
}
|
|
13249
13259
|
}
|
|
13250
|
-
class
|
|
13260
|
+
class rC extends HI {
|
|
13251
13261
|
type = "LabelLayer";
|
|
13252
13262
|
source_;
|
|
13253
13263
|
sliceCoords_;
|
|
@@ -13335,10 +13345,10 @@ class FC extends KI {
|
|
|
13335
13345
|
}
|
|
13336
13346
|
}
|
|
13337
13347
|
isPresentationStale() {
|
|
13338
|
-
return this.lastPresentationTimeStamp_ === void 0 ? !1 : performance.now() - this.lastPresentationTimeStamp_ >
|
|
13348
|
+
return this.lastPresentationTimeStamp_ === void 0 ? !1 : performance.now() - this.lastPresentationTimeStamp_ > rC.STALE_PRESENTATION_MS_;
|
|
13339
13349
|
}
|
|
13340
13350
|
onEvent(A) {
|
|
13341
|
-
this.pointerDownPos_ =
|
|
13351
|
+
this.pointerDownPos_ = GC(
|
|
13342
13352
|
A,
|
|
13343
13353
|
this.pointerDownPos_,
|
|
13344
13354
|
(I) => this.pickAtRay(I),
|
|
@@ -13384,7 +13394,7 @@ class FC extends KI {
|
|
|
13384
13394
|
set imageSourcePolicy(A) {
|
|
13385
13395
|
this.policy_ !== A && (this.policy_ = A, this.chunkStoreView_ && this.chunkStoreView_.setImageSourcePolicy(
|
|
13386
13396
|
A,
|
|
13387
|
-
|
|
13397
|
+
MI
|
|
13388
13398
|
));
|
|
13389
13399
|
}
|
|
13390
13400
|
// exposed for use in chunk info overlay
|
|
@@ -13476,12 +13486,12 @@ class Ao extends Fg {
|
|
|
13476
13486
|
return this.depth_;
|
|
13477
13487
|
}
|
|
13478
13488
|
}
|
|
13479
|
-
const
|
|
13489
|
+
const SC = {
|
|
13480
13490
|
circle: 0,
|
|
13481
13491
|
square: 1,
|
|
13482
13492
|
triangle: 2
|
|
13483
13493
|
};
|
|
13484
|
-
class No extends
|
|
13494
|
+
class No extends BI {
|
|
13485
13495
|
constructor(A) {
|
|
13486
13496
|
super(), this.programName = "points";
|
|
13487
13497
|
const I = A.flatMap((C) => {
|
|
@@ -13495,7 +13505,7 @@ class No extends xA {
|
|
|
13495
13505
|
Q.b,
|
|
13496
13506
|
Q.a,
|
|
13497
13507
|
C.size,
|
|
13498
|
-
|
|
13508
|
+
SC[C.marker]
|
|
13499
13509
|
];
|
|
13500
13510
|
}), B = new mA(I, [], "points");
|
|
13501
13511
|
B.addAttribute({
|
|
@@ -13520,9 +13530,9 @@ class No extends xA {
|
|
|
13520
13530
|
return "PointsRenderable";
|
|
13521
13531
|
}
|
|
13522
13532
|
}
|
|
13523
|
-
let
|
|
13533
|
+
let OI;
|
|
13524
13534
|
function Io() {
|
|
13525
|
-
return
|
|
13535
|
+
return OI || (OI = go()), OI;
|
|
13526
13536
|
}
|
|
13527
13537
|
function go() {
|
|
13528
13538
|
const g = (a) => {
|
|
@@ -13546,7 +13556,7 @@ function go() {
|
|
|
13546
13556
|
triangle: I(256)
|
|
13547
13557
|
}, E = Object.keys(Q).length, i = new Float32Array(E * 65536);
|
|
13548
13558
|
for (const [a, D] of Object.entries(Q))
|
|
13549
|
-
i.set(D,
|
|
13559
|
+
i.set(D, SC[a] * 65536);
|
|
13550
13560
|
const o = new Ao(i, 256, 256);
|
|
13551
13561
|
return o.wrapR = "clamp_to_edge", o.wrapS = "clamp_to_edge", o.wrapT = "clamp_to_edge", o;
|
|
13552
13562
|
}
|
|
@@ -13566,7 +13576,7 @@ class mB {
|
|
|
13566
13576
|
);
|
|
13567
13577
|
}
|
|
13568
13578
|
}
|
|
13569
|
-
const
|
|
13579
|
+
const VI = -1, uB = 0, Bo = 1, TB = 9e-3, Co = 1e-3, Qo = 9e-4, Eo = 0.5, io = 60;
|
|
13570
13580
|
class co {
|
|
13571
13581
|
camera_;
|
|
13572
13582
|
orbitVelocity_ = new mB(0, 0, 0);
|
|
@@ -13574,13 +13584,13 @@ class co {
|
|
|
13574
13584
|
currPos_;
|
|
13575
13585
|
currCenter_ = d();
|
|
13576
13586
|
dampingFactor_;
|
|
13577
|
-
currMouseButton_ =
|
|
13587
|
+
currMouseButton_ = VI;
|
|
13578
13588
|
constructor(A, I) {
|
|
13579
13589
|
this.camera_ = A, this.currPos_ = new mB(
|
|
13580
13590
|
I?.radius ?? 1,
|
|
13581
13591
|
I?.yaw ?? 0,
|
|
13582
13592
|
I?.pitch ?? 0
|
|
13583
|
-
), I?.target &&
|
|
13593
|
+
), I?.target && jI(this.currCenter_, I.target), this.dampingFactor_ = hA(
|
|
13584
13594
|
I?.dampingFactor ?? Eo,
|
|
13585
13595
|
0,
|
|
13586
13596
|
1
|
|
@@ -13613,14 +13623,14 @@ class co {
|
|
|
13613
13623
|
const I = Math.PI / 2 - T;
|
|
13614
13624
|
this.currPos_.theta = hA(this.currPos_.theta, -I, I), this.currPos_.radius = Math.max(0.01, this.currPos_.radius), this.updateCamera();
|
|
13615
13625
|
const B = Math.pow(1 - this.dampingFactor_, A * io);
|
|
13616
|
-
this.orbitVelocity_.phi *= B, this.orbitVelocity_.theta *= B, this.orbitVelocity_.radius *= B,
|
|
13626
|
+
this.orbitVelocity_.phi *= B, this.orbitVelocity_.theta *= B, this.orbitVelocity_.radius *= B, VA(this.panVelocity_, this.panVelocity_, B), this.cutoffLowVelocity();
|
|
13617
13627
|
}
|
|
13618
13628
|
onPointerDown(A) {
|
|
13619
13629
|
const I = A.event;
|
|
13620
13630
|
this.currMouseButton_ = I.button, I.target?.setPointerCapture?.(I.pointerId);
|
|
13621
13631
|
}
|
|
13622
13632
|
onPointerMove(A) {
|
|
13623
|
-
if (this.currMouseButton_ ==
|
|
13633
|
+
if (this.currMouseButton_ == VI) return;
|
|
13624
13634
|
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;
|
|
13625
13635
|
Q && this.orbit(B, C), E && this.pan(B, C);
|
|
13626
13636
|
}
|
|
@@ -13631,7 +13641,7 @@ class co {
|
|
|
13631
13641
|
this.zoom(B);
|
|
13632
13642
|
}
|
|
13633
13643
|
onPointerEnd(A) {
|
|
13634
|
-
this.currMouseButton_ =
|
|
13644
|
+
this.currMouseButton_ = VI;
|
|
13635
13645
|
const I = A.event;
|
|
13636
13646
|
I.target?.releasePointerCapture?.(I.pointerId);
|
|
13637
13647
|
}
|
|
@@ -13640,7 +13650,7 @@ class co {
|
|
|
13640
13650
|
}
|
|
13641
13651
|
pan(A, I) {
|
|
13642
13652
|
const B = this.currPos_.radius * Co, C = d();
|
|
13643
|
-
|
|
13653
|
+
zI(C, C, this.camera_.right, A), zI(C, C, this.camera_.up, I), VA(C, C, B), _I(this.panVelocity_, this.panVelocity_, C);
|
|
13644
13654
|
}
|
|
13645
13655
|
zoom(A) {
|
|
13646
13656
|
this.orbitVelocity_.radius += A * Qo;
|
|
@@ -13650,7 +13660,7 @@ class co {
|
|
|
13650
13660
|
this.camera_.transform.setTranslation(A), this.camera_.transform.targetTo(this.currCenter_);
|
|
13651
13661
|
}
|
|
13652
13662
|
cutoffLowVelocity() {
|
|
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 &&
|
|
13663
|
+
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_);
|
|
13654
13664
|
}
|
|
13655
13665
|
}
|
|
13656
13666
|
class oo {
|
|
@@ -13699,7 +13709,8 @@ class oo {
|
|
|
13699
13709
|
return !0;
|
|
13700
13710
|
}
|
|
13701
13711
|
}
|
|
13702
|
-
class
|
|
13712
|
+
class RC extends LI {
|
|
13713
|
+
transform_ = new tC();
|
|
13703
13714
|
projectionMatrix_ = $();
|
|
13704
13715
|
near_ = 0;
|
|
13705
13716
|
far_ = 0;
|
|
@@ -13709,6 +13720,9 @@ class SC extends xA {
|
|
|
13709
13720
|
get projectionMatrix() {
|
|
13710
13721
|
return this.projectionMatrix_;
|
|
13711
13722
|
}
|
|
13723
|
+
get transform() {
|
|
13724
|
+
return this.transform_;
|
|
13725
|
+
}
|
|
13712
13726
|
get viewMatrix() {
|
|
13713
13727
|
return this.transform.inverse;
|
|
13714
13728
|
}
|
|
@@ -13721,7 +13735,7 @@ class SC extends xA {
|
|
|
13721
13735
|
return p(A[4], A[5], A[6]);
|
|
13722
13736
|
}
|
|
13723
13737
|
getViewProjection() {
|
|
13724
|
-
return
|
|
13738
|
+
return XI($(), this.projectionMatrix, this.viewMatrix);
|
|
13725
13739
|
}
|
|
13726
13740
|
get frustum() {
|
|
13727
13741
|
return new oo(this.getViewProjection());
|
|
@@ -13733,16 +13747,16 @@ class SC extends xA {
|
|
|
13733
13747
|
return this.transform.translation;
|
|
13734
13748
|
}
|
|
13735
13749
|
clipToWorld(A) {
|
|
13736
|
-
const I = DI(A[0], A[1], A[2], 1), B =
|
|
13750
|
+
const I = DI(A[0], A[1], A[2], 1), B = JI(
|
|
13737
13751
|
$(),
|
|
13738
13752
|
this.projectionMatrix_
|
|
13739
|
-
), C =
|
|
13753
|
+
), C = vA(
|
|
13740
13754
|
YA(),
|
|
13741
13755
|
I,
|
|
13742
13756
|
B
|
|
13743
13757
|
);
|
|
13744
|
-
|
|
13745
|
-
const Q =
|
|
13758
|
+
IQ(C, C, 1 / C[3]);
|
|
13759
|
+
const Q = vA(
|
|
13746
13760
|
YA(),
|
|
13747
13761
|
C,
|
|
13748
13762
|
this.transform.matrix
|
|
@@ -13750,12 +13764,12 @@ class SC extends xA {
|
|
|
13750
13764
|
return p(Q[0], Q[1], Q[2]);
|
|
13751
13765
|
}
|
|
13752
13766
|
}
|
|
13753
|
-
const
|
|
13754
|
-
class Uo extends
|
|
13767
|
+
const NC = 1.77, xB = 128, WB = 128 / NC, ao = -1e6, Do = 1e6;
|
|
13768
|
+
class Uo extends RC {
|
|
13755
13769
|
// width_ and height_ should always be defined by constructor (see setFrame)
|
|
13756
13770
|
width_ = xB;
|
|
13757
13771
|
height_ = WB;
|
|
13758
|
-
viewportAspectRatio_ =
|
|
13772
|
+
viewportAspectRatio_ = NC;
|
|
13759
13773
|
viewportSize_ = [xB, WB];
|
|
13760
13774
|
axes_;
|
|
13761
13775
|
rotation_;
|
|
@@ -13808,8 +13822,8 @@ class Uo extends SC {
|
|
|
13808
13822
|
}
|
|
13809
13823
|
getWorldViewRect() {
|
|
13810
13824
|
let A = DI(-1, -1, 0, 1), I = DI(1, 1, 0, 1);
|
|
13811
|
-
const B =
|
|
13812
|
-
A =
|
|
13825
|
+
const B = JI($(), this.getViewProjection());
|
|
13826
|
+
A = vA(YA(), A, B), I = vA(YA(), I, B);
|
|
13813
13827
|
const C = W[this.axes_.u], Q = W[this.axes_.v];
|
|
13814
13828
|
return new AA(
|
|
13815
13829
|
V(A[C], A[Q]),
|
|
@@ -13819,7 +13833,7 @@ class Uo extends SC {
|
|
|
13819
13833
|
updateProjectionMatrix() {
|
|
13820
13834
|
const A = this.width_, I = this.height_, B = A / I;
|
|
13821
13835
|
let C = 0.5 * A, Q = 0.5 * I;
|
|
13822
|
-
this.viewportAspectRatio_ > B ? C *= this.viewportAspectRatio_ / B : Q *= B / this.viewportAspectRatio_, this.viewportSize_ = [2 * C, 2 * Q],
|
|
13836
|
+
this.viewportAspectRatio_ > B ? C *= this.viewportAspectRatio_ / B : Q *= B / this.viewportAspectRatio_, this.viewportSize_ = [2 * C, 2 * Q], VC(
|
|
13823
13837
|
this.projectionMatrix_,
|
|
13824
13838
|
-C,
|
|
13825
13839
|
C,
|
|
@@ -13866,7 +13880,7 @@ class ko {
|
|
|
13866
13880
|
I.preventDefault();
|
|
13867
13881
|
const B = DA(A.worldPos), C = I.deltaY < 0 ? 1.05 : 0.95;
|
|
13868
13882
|
this.camera_.zoom(C);
|
|
13869
|
-
const Q = this.camera_.clipToWorld(A.clipPos), E =
|
|
13883
|
+
const Q = this.camera_.clipToWorld(A.clipPos), E = _I(d(), B, Q);
|
|
13870
13884
|
this.camera_.pan(E);
|
|
13871
13885
|
}
|
|
13872
13886
|
onPointerDown(A) {
|
|
@@ -13875,7 +13889,7 @@ class ko {
|
|
|
13875
13889
|
}
|
|
13876
13890
|
onPointerMove(A) {
|
|
13877
13891
|
if (!this.dragActive_ || !A.worldPos) return;
|
|
13878
|
-
const I =
|
|
13892
|
+
const I = _I(d(), this.dragStart_, A.worldPos);
|
|
13879
13893
|
this.camera_.pan(I);
|
|
13880
13894
|
}
|
|
13881
13895
|
onPointerEnd(A) {
|
|
@@ -13883,8 +13897,8 @@ class ko {
|
|
|
13883
13897
|
!this.dragActive_ || I.button !== bB || (this.dragActive_ = !1, I.target?.releasePointerCapture?.(I.pointerId));
|
|
13884
13898
|
}
|
|
13885
13899
|
}
|
|
13886
|
-
const so = 60, ho = 1.77, oI = 0.1,
|
|
13887
|
-
class Lo extends
|
|
13900
|
+
const so = 60, ho = 1.77, oI = 0.1, vI = 180 - oI;
|
|
13901
|
+
class Lo extends RC {
|
|
13888
13902
|
fov_;
|
|
13889
13903
|
aspectRatio_;
|
|
13890
13904
|
constructor(A = {}) {
|
|
@@ -13895,9 +13909,9 @@ class Lo extends SC {
|
|
|
13895
13909
|
far: Q = 1e4,
|
|
13896
13910
|
position: E = p(0, 0, 0)
|
|
13897
13911
|
} = A;
|
|
13898
|
-
if (I < oI || I >
|
|
13912
|
+
if (I < oI || I > vI)
|
|
13899
13913
|
throw new Error(
|
|
13900
|
-
`Invalid field of view: ${I}, must be in [${oI}, ${
|
|
13914
|
+
`Invalid field of view: ${I}, must be in [${oI}, ${vI}] degrees`
|
|
13901
13915
|
);
|
|
13902
13916
|
super(), this.fov_ = I, this.aspectRatio_ = B, this.near_ = C, this.far_ = Q, this.transform.setTranslation(E), this.updateProjectionMatrix();
|
|
13903
13917
|
}
|
|
@@ -13913,12 +13927,12 @@ class Lo extends SC {
|
|
|
13913
13927
|
zoom(A) {
|
|
13914
13928
|
if (A <= 0)
|
|
13915
13929
|
throw new Error(`Invalid zoom factor: ${A}`);
|
|
13916
|
-
this.fov_ = Math.max(oI, Math.min(
|
|
13930
|
+
this.fov_ = Math.max(oI, Math.min(vI, this.fov_ / A)), this.updateProjectionMatrix();
|
|
13917
13931
|
}
|
|
13918
13932
|
updateProjectionMatrix() {
|
|
13919
|
-
|
|
13933
|
+
PC(
|
|
13920
13934
|
this.projectionMatrix_,
|
|
13921
|
-
|
|
13935
|
+
uC(this.fov),
|
|
13922
13936
|
this.aspectRatio_,
|
|
13923
13937
|
this.near_,
|
|
13924
13938
|
this.far_
|
|
@@ -13929,13 +13943,13 @@ export {
|
|
|
13929
13943
|
Fo as AxesLayer,
|
|
13930
13944
|
x as Color,
|
|
13931
13945
|
to as Idetik,
|
|
13932
|
-
|
|
13946
|
+
wC as ImageLayer,
|
|
13933
13947
|
pi as ImageRenderable,
|
|
13934
13948
|
pB as LabelColorMap,
|
|
13935
13949
|
$i as LabelImageRenderable,
|
|
13936
|
-
|
|
13937
|
-
|
|
13938
|
-
|
|
13950
|
+
rC as LabelLayer,
|
|
13951
|
+
HI as Layer,
|
|
13952
|
+
PA as OmeZarrImageSource,
|
|
13939
13953
|
co as OrbitControls,
|
|
13940
13954
|
Uo as OrthographicCamera,
|
|
13941
13955
|
ko as PanZoomControls,
|