@idetik/core 0.38.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +8 -1
- package/dist/index.js +927 -801
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +53 -31
- package/dist/index.umd.cjs.map +1 -1
- package/dist/types/src/core/layer.d.ts +3 -1
- package/dist/types/src/core/layer.d.ts.map +1 -1
- package/dist/types/src/layers/volume_layer.d.ts +1 -0
- package/dist/types/src/layers/volume_layer.d.ts.map +1 -1
- package/dist/types/src/objects/cameras/orbit_controls.d.ts +5 -2
- package/dist/types/src/objects/cameras/orbit_controls.d.ts.map +1 -1
- package/dist/types/src/renderers/webgl_depth_target.d.ts +16 -0
- package/dist/types/src/renderers/webgl_depth_target.d.ts.map +1 -0
- package/dist/types/src/renderers/webgl_renderer.d.ts +7 -3
- package/dist/types/src/renderers/webgl_renderer.d.ts.map +1 -1
- package/dist/types/src/renderers/webgl_state.d.ts +1 -1
- package/dist/types/src/renderers/webgl_state.d.ts.map +1 -1
- package/dist/types/src/renderers/webgl_textures.d.ts +2 -0
- package/dist/types/src/renderers/webgl_textures.d.ts.map +1 -1
- package/dist/types/test/camera.test.d.ts +2 -0
- package/dist/types/test/camera.test.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/types/src/math/sort_by_distance.d.ts +0 -13
- package/dist/types/src/math/sort_by_distance.d.ts.map +0 -1
- package/dist/types/test/sort_by_distance.test.d.ts +0 -2
- package/dist/types/test/sort_by_distance.test.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class kC {
|
|
2
2
|
canvas_;
|
|
3
3
|
width_ = 0;
|
|
4
4
|
height_ = 0;
|
|
@@ -87,7 +87,7 @@ void main() {
|
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
gl_PointSize = 5.0;
|
|
90
|
-
}`,
|
|
90
|
+
}`, LC = `#version 300 es
|
|
91
91
|
|
|
92
92
|
precision mediump float;
|
|
93
93
|
|
|
@@ -159,7 +159,7 @@ void main() {
|
|
|
159
159
|
gl_PointSize = a_size;
|
|
160
160
|
v_color = a_color;
|
|
161
161
|
v_marker = uint(a_marker);
|
|
162
|
-
}`,
|
|
162
|
+
}`, JC = `#version 300 es
|
|
163
163
|
|
|
164
164
|
precision mediump float;
|
|
165
165
|
|
|
@@ -179,7 +179,7 @@ void main() {
|
|
|
179
179
|
discard;
|
|
180
180
|
}
|
|
181
181
|
fragColor = vec4(v_color.rgb, u_opacity * alpha * v_color.a);
|
|
182
|
-
}`,
|
|
182
|
+
}`, YC = `#version 300 es
|
|
183
183
|
|
|
184
184
|
layout (location = 0) in vec3 a_position;
|
|
185
185
|
layout (location = 1) in vec3 a_normal;
|
|
@@ -189,7 +189,7 @@ uniform mat4 u_modelView;
|
|
|
189
189
|
|
|
190
190
|
void main() {
|
|
191
191
|
gl_Position = u_projection * u_modelView * vec4(a_position, 1.0);
|
|
192
|
-
}`,
|
|
192
|
+
}`, MC = `#version 300 es
|
|
193
193
|
|
|
194
194
|
precision mediump float;
|
|
195
195
|
|
|
@@ -209,10 +209,12 @@ layout (location = 0) in vec3 a_position;
|
|
|
209
209
|
uniform mat4 u_projection;
|
|
210
210
|
uniform mat4 u_modelView;
|
|
211
211
|
out highp vec3 v_positionModel;
|
|
212
|
+
out highp vec4 v_clipPosition;
|
|
212
213
|
|
|
213
214
|
void main() {
|
|
214
215
|
v_positionModel = a_position;
|
|
215
216
|
gl_Position = u_projection * u_modelView * vec4(a_position, 1.0);
|
|
217
|
+
v_clipPosition = gl_Position;
|
|
216
218
|
}`, pI = `#version 300 es
|
|
217
219
|
#pragma inject_defines
|
|
218
220
|
precision highp float;
|
|
@@ -242,6 +244,7 @@ uniform sampler3D u_channel3Sampler;
|
|
|
242
244
|
uniform highp vec3 u_cameraPositionModel;
|
|
243
245
|
uniform vec3 u_voxelScale;
|
|
244
246
|
in highp vec3 v_positionModel;
|
|
247
|
+
in highp vec4 v_clipPosition;
|
|
245
248
|
|
|
246
249
|
vec3 boundingboxMin = vec3(-0.50);
|
|
247
250
|
vec3 boundingboxMax = vec3(0.50);
|
|
@@ -257,6 +260,16 @@ uniform vec4 u_valueScale;
|
|
|
257
260
|
uniform vec4 u_channelOpacity;
|
|
258
261
|
uniform vec3 u_color[4];
|
|
259
262
|
|
|
263
|
+
uniform bool u_hasSceneDepth;
|
|
264
|
+
uniform highp sampler2D u_sceneDepth;
|
|
265
|
+
uniform mat4 u_mvpInverse;
|
|
266
|
+
|
|
267
|
+
float distanceAlongRayAtWindowDepth(float windowDepth, vec3 rayOrigin, vec3 rayDir) {
|
|
268
|
+
vec3 ndc = vec3(v_clipPosition.xy / v_clipPosition.w, windowDepth * 2.0 - 1.0);
|
|
269
|
+
vec4 positionModel = u_mvpInverse * vec4(ndc, 1.0);
|
|
270
|
+
return dot(positionModel.xyz / positionModel.w - rayOrigin, rayDir);
|
|
271
|
+
}
|
|
272
|
+
|
|
260
273
|
vec2 findBoxIntersectionsAlongRay(vec3 rayOrigin, vec3 rayDir, vec3 boxMin, vec3 boxMax) {
|
|
261
274
|
vec3 reciprocalRayDir = 1.0 / rayDir;
|
|
262
275
|
vec3 t0 = (boxMin - rayOrigin) * reciprocalRayDir;
|
|
@@ -307,6 +320,15 @@ void main() {
|
|
|
307
320
|
return;
|
|
308
321
|
}
|
|
309
322
|
|
|
323
|
+
if (u_hasSceneDepth) {
|
|
324
|
+
float sceneWindowDepth = texelFetch(u_sceneDepth, ivec2(gl_FragCoord.xy), 0).r;
|
|
325
|
+
if (sceneWindowDepth < 1.0) {
|
|
326
|
+
float tScene = distanceAlongRayAtWindowDepth(sceneWindowDepth, u_cameraPositionModel, RayDirModel);
|
|
327
|
+
if (tScene < tEnter) discard;
|
|
328
|
+
tExit = min(tExit, tScene);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
310
332
|
vec3 entryPoint = u_cameraPositionModel + RayDirModel * tEnter;
|
|
311
333
|
entryPoint = clamp(entryPoint + 0.5, 0.0, 1.0);
|
|
312
334
|
vec3 exitPoint = u_cameraPositionModel + RayDirModel * tExit;
|
|
@@ -455,7 +477,7 @@ void main() {
|
|
|
455
477
|
fragColor = vec4(color.rgb, alpha);
|
|
456
478
|
}`, vg = `#version 300 es
|
|
457
479
|
|
|
458
|
-
void main() {}`,
|
|
480
|
+
void main() {}`, dC = `#version 300 es
|
|
459
481
|
|
|
460
482
|
precision mediump float;
|
|
461
483
|
|
|
@@ -468,18 +490,18 @@ void main() {
|
|
|
468
490
|
discard;
|
|
469
491
|
}
|
|
470
492
|
}`;
|
|
471
|
-
const
|
|
493
|
+
const KC = {
|
|
472
494
|
projectedLine: {
|
|
473
495
|
vertex: Pg,
|
|
474
|
-
fragment:
|
|
496
|
+
fragment: LC
|
|
475
497
|
},
|
|
476
498
|
points: {
|
|
477
499
|
vertex: Og,
|
|
478
|
-
fragment:
|
|
500
|
+
fragment: JC
|
|
479
501
|
},
|
|
480
502
|
wireframe: {
|
|
481
|
-
vertex:
|
|
482
|
-
fragment:
|
|
503
|
+
vertex: YC,
|
|
504
|
+
fragment: MC
|
|
483
505
|
},
|
|
484
506
|
floatScalarImage: {
|
|
485
507
|
vertex: kA,
|
|
@@ -524,7 +546,7 @@ const HC = {
|
|
|
524
546
|
},
|
|
525
547
|
pointsDepth: {
|
|
526
548
|
vertex: Og,
|
|
527
|
-
fragment:
|
|
549
|
+
fragment: dC
|
|
528
550
|
},
|
|
529
551
|
projectedLineDepth: {
|
|
530
552
|
vertex: Pg,
|
|
@@ -535,7 +557,7 @@ const HC = {
|
|
|
535
557
|
info: 20,
|
|
536
558
|
warn: 30,
|
|
537
559
|
error: 40
|
|
538
|
-
},
|
|
560
|
+
}, HC = {
|
|
539
561
|
debug: "\x1B[90m",
|
|
540
562
|
// gray
|
|
541
563
|
info: "\x1B[36m",
|
|
@@ -545,7 +567,7 @@ const HC = {
|
|
|
545
567
|
error: "\x1B[31m"
|
|
546
568
|
// red
|
|
547
569
|
};
|
|
548
|
-
function
|
|
570
|
+
function qC() {
|
|
549
571
|
const g = typeof process < "u" && typeof process.env?.NODE_ENV == "string" ? process.env.NODE_ENV : void 0;
|
|
550
572
|
if (g === "production" || g === "development" || g === "test")
|
|
551
573
|
return g;
|
|
@@ -557,7 +579,7 @@ function lC() {
|
|
|
557
579
|
return "development";
|
|
558
580
|
}
|
|
559
581
|
class k {
|
|
560
|
-
static logLevel_ =
|
|
582
|
+
static logLevel_ = qC() === "production" ? "warn" : "debug";
|
|
561
583
|
static setLogLevel(A) {
|
|
562
584
|
k.logLevel_ = A;
|
|
563
585
|
}
|
|
@@ -575,7 +597,7 @@ class k {
|
|
|
575
597
|
}
|
|
576
598
|
static log(A, I, B, ...C) {
|
|
577
599
|
if (Xg[A] < Xg[k.logLevel_]) return;
|
|
578
|
-
const Q = (/* @__PURE__ */ new Date()).toISOString(), E =
|
|
600
|
+
const Q = (/* @__PURE__ */ new Date()).toISOString(), E = HC[A], i = `[${Q}][${A.toUpperCase()}][${I}]`, o = [`${E}${i}`, B, ...C];
|
|
579
601
|
switch (A) {
|
|
580
602
|
case "debug":
|
|
581
603
|
console.debug(...o);
|
|
@@ -592,7 +614,7 @@ class k {
|
|
|
592
614
|
}
|
|
593
615
|
}
|
|
594
616
|
}
|
|
595
|
-
class
|
|
617
|
+
class lC {
|
|
596
618
|
gl_;
|
|
597
619
|
program_;
|
|
598
620
|
uniformInfo_ = /* @__PURE__ */ new Map();
|
|
@@ -674,7 +696,7 @@ class fC {
|
|
|
674
696
|
for (let I = 0; I < A; I++) {
|
|
675
697
|
const B = this.gl_.getActiveUniform(this.program_, I);
|
|
676
698
|
if (B) {
|
|
677
|
-
if (!
|
|
699
|
+
if (!pC.has(B.type))
|
|
678
700
|
throw new Error(
|
|
679
701
|
`Unsupported uniform type "${B.type}" (GLenum) found in shader program for uniform "${B.name}"`
|
|
680
702
|
);
|
|
@@ -715,7 +737,7 @@ class fC {
|
|
|
715
737
|
return Array.from(this.uniformInfo_.keys());
|
|
716
738
|
}
|
|
717
739
|
}
|
|
718
|
-
const
|
|
740
|
+
const fC = typeof window < "u" ? [
|
|
719
741
|
WebGL2RenderingContext.BOOL,
|
|
720
742
|
WebGL2RenderingContext.FLOAT,
|
|
721
743
|
WebGL2RenderingContext.INT,
|
|
@@ -740,10 +762,10 @@ const pC = typeof window < "u" ? [
|
|
|
740
762
|
WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_3D,
|
|
741
763
|
WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_CUBE,
|
|
742
764
|
WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_2D_ARRAY
|
|
743
|
-
] : [],
|
|
744
|
-
|
|
765
|
+
] : [], pC = new Set(
|
|
766
|
+
fC
|
|
745
767
|
), mI = "#pragma inject_defines";
|
|
746
|
-
class
|
|
768
|
+
class mC {
|
|
747
769
|
gl_;
|
|
748
770
|
programs_ = /* @__PURE__ */ new Map();
|
|
749
771
|
constructor(A) {
|
|
@@ -752,14 +774,14 @@ class uC {
|
|
|
752
774
|
use(A) {
|
|
753
775
|
let I = this.programs_.get(A);
|
|
754
776
|
if (I === void 0) {
|
|
755
|
-
const B =
|
|
777
|
+
const B = KC[A], C = jg(
|
|
756
778
|
B.vertex,
|
|
757
779
|
B.vertexDefines
|
|
758
780
|
), Q = jg(
|
|
759
781
|
B.fragment,
|
|
760
782
|
B.fragmentDefines
|
|
761
783
|
);
|
|
762
|
-
I = new
|
|
784
|
+
I = new lC(
|
|
763
785
|
this.gl_,
|
|
764
786
|
C,
|
|
765
787
|
Q
|
|
@@ -784,26 +806,26 @@ function jg(g, A) {
|
|
|
784
806
|
${C}`;
|
|
785
807
|
return g.replace(mI, Q);
|
|
786
808
|
}
|
|
787
|
-
const
|
|
788
|
-
function
|
|
809
|
+
const BI = {};
|
|
810
|
+
function OB(g) {
|
|
789
811
|
const A = g ?? "";
|
|
790
|
-
return
|
|
812
|
+
return BI[A] = (BI[A] ?? 0) + 1, g ? `${g}-${BI[A]}` : String(BI[A]);
|
|
791
813
|
}
|
|
792
|
-
class
|
|
793
|
-
id =
|
|
814
|
+
class YI {
|
|
815
|
+
id = OB();
|
|
794
816
|
}
|
|
795
|
-
var T = 1e-6, X = typeof Float32Array < "u" ? Float32Array : Array,
|
|
796
|
-
function
|
|
797
|
-
return g *
|
|
817
|
+
var T = 1e-6, X = typeof Float32Array < "u" ? Float32Array : Array, uC = Math.PI / 180;
|
|
818
|
+
function TC(g) {
|
|
819
|
+
return g * uC;
|
|
798
820
|
}
|
|
799
|
-
function
|
|
821
|
+
function VB() {
|
|
800
822
|
var g = new X(9);
|
|
801
823
|
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;
|
|
802
824
|
}
|
|
803
|
-
function
|
|
825
|
+
function xC(g, A) {
|
|
804
826
|
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;
|
|
805
827
|
}
|
|
806
|
-
function
|
|
828
|
+
function WC(g, A, I, B, C, Q, E, i, o) {
|
|
807
829
|
var a = new X(9);
|
|
808
830
|
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;
|
|
809
831
|
}
|
|
@@ -811,26 +833,26 @@ function $() {
|
|
|
811
833
|
var g = new X(16);
|
|
812
834
|
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;
|
|
813
835
|
}
|
|
814
|
-
function
|
|
815
|
-
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], s = A[8], D = 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 = s * n - D * y, j = s * F - h * y, b = s * G - t * y, z = D * F - h * n,
|
|
816
|
-
return P ? (P = 1 / P, g[0] = (i *
|
|
836
|
+
function OA(g, A) {
|
|
837
|
+
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], s = A[8], D = 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 = s * n - D * y, j = s * F - h * y, b = s * G - t * y, z = D * F - h * n, oA = D * G - t * n, aA = h * G - t * F, P = J * aA - U * oA + S * z + r * b - c * j + f * Z;
|
|
838
|
+
return P ? (P = 1 / P, g[0] = (i * aA - o * oA + a * z) * P, g[1] = (C * oA - B * aA - Q * z) * P, g[2] = (n * f - F * c + G * r) * P, g[3] = (h * c - D * f - t * r) * P, g[4] = (o * b - E * aA - a * j) * P, g[5] = (I * aA - C * b + Q * j) * P, g[6] = (F * S - y * f - G * U) * P, g[7] = (s * f - h * S + t * U) * P, g[8] = (E * oA - i * b + a * Z) * P, g[9] = (B * b - I * oA - Q * Z) * P, g[10] = (y * c - n * S + G * J) * P, g[11] = (D * S - s * 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] = (s * r - D * U + h * J) * P, g) : null;
|
|
817
839
|
}
|
|
818
|
-
function
|
|
840
|
+
function QI(g, A, I) {
|
|
819
841
|
var B = A[0], C = A[1], Q = A[2], E = A[3], i = A[4], o = A[5], a = A[6], s = A[7], D = 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];
|
|
820
842
|
return g[0] = U * B + S * i + r * D + 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 * s + r * y + c * J, U = I[4], S = I[5], r = I[6], c = I[7], g[4] = U * B + S * i + r * D + 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 * s + r * y + c * J, U = I[8], S = I[9], r = I[10], c = I[11], g[8] = U * B + S * i + r * D + 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 * s + r * y + c * J, U = I[12], S = I[13], r = I[14], c = I[15], g[12] = U * B + S * i + r * D + 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 * s + r * y + c * J, g;
|
|
821
843
|
}
|
|
822
|
-
function
|
|
844
|
+
function bC(g, A, I) {
|
|
823
845
|
var B = I[0], C = I[1], Q = I[2], E, i, o, a, s, D, h, t, y, n, F, G;
|
|
824
846
|
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], s = A[4], D = 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] = s, g[5] = D, g[6] = h, g[7] = t, g[8] = y, g[9] = n, g[10] = F, g[11] = G, g[12] = E * B + s * C + y * Q + A[12], g[13] = i * B + D * 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;
|
|
825
847
|
}
|
|
826
|
-
function
|
|
848
|
+
function vB(g, A) {
|
|
827
849
|
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;
|
|
828
850
|
}
|
|
829
|
-
function
|
|
851
|
+
function ZC(g, A, I, B) {
|
|
830
852
|
var C = A[0], Q = A[1], E = A[2], i = A[3], o = C + C, a = Q + Q, s = E + E, D = C * o, h = C * a, t = C * s, y = Q * a, n = Q * s, F = E * s, G = i * o, J = i * a, U = i * s, S = B[0], r = B[1], c = B[2];
|
|
831
853
|
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 - (D + F)) * r, g[6] = (n + G) * r, g[7] = 0, g[8] = (t + J) * c, g[9] = (n - G) * c, g[10] = (1 - (D + y)) * c, g[11] = 0, g[12] = I[0], g[13] = I[1], g[14] = I[2], g[15] = 1, g;
|
|
832
854
|
}
|
|
833
|
-
function
|
|
855
|
+
function PC(g, A, I, B, C) {
|
|
834
856
|
var Q = 1 / Math.tan(A / 2);
|
|
835
857
|
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) {
|
|
836
858
|
var E = 1 / (B - C);
|
|
@@ -839,27 +861,27 @@ function OC(g, A, I, B, C) {
|
|
|
839
861
|
g[10] = -1, g[14] = -2 * B;
|
|
840
862
|
return g;
|
|
841
863
|
}
|
|
842
|
-
var
|
|
843
|
-
function
|
|
864
|
+
var OC = PC;
|
|
865
|
+
function VC(g, A, I, B, C, Q, E) {
|
|
844
866
|
var i = 1 / (A - I), o = 1 / (B - C), a = 1 / (Q - E);
|
|
845
867
|
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;
|
|
846
868
|
}
|
|
847
|
-
var
|
|
848
|
-
function
|
|
869
|
+
var vC = VC;
|
|
870
|
+
function XC(g, A, I, B) {
|
|
849
871
|
var C = A[0], Q = A[1], E = A[2], i = B[0], o = B[1], a = B[2], s = C - I[0], D = Q - I[1], h = E - I[2], t = s * s + D * D + h * h;
|
|
850
872
|
t > 0 && (t = 1 / Math.sqrt(t), s *= t, D *= t, h *= t);
|
|
851
873
|
var y = o * h - a * D, n = a * s - i * h, F = i * D - o * s;
|
|
852
874
|
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] = D * F - h * n, g[5] = h * y - s * F, g[6] = s * n - D * y, g[7] = 0, g[8] = s, g[9] = D, g[10] = h, g[11] = 0, g[12] = C, g[13] = Q, g[14] = E, g[15] = 1, g;
|
|
853
875
|
}
|
|
854
|
-
function
|
|
855
|
-
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], s = g[8], D = 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],
|
|
856
|
-
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(s - b) <= T * Math.max(1, Math.abs(s), Math.abs(b)) && Math.abs(D - z) <= T * Math.max(1, Math.abs(D), Math.abs(z)) && Math.abs(h -
|
|
876
|
+
function jC(g, A) {
|
|
877
|
+
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], s = g[8], D = 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], oA = A[10], aA = A[11], P = A[12], Wg = A[13], bg = A[14], Zg = A[15];
|
|
878
|
+
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(s - b) <= T * Math.max(1, Math.abs(s), Math.abs(b)) && Math.abs(D - z) <= T * Math.max(1, Math.abs(D), Math.abs(z)) && Math.abs(h - oA) <= T * Math.max(1, Math.abs(h), Math.abs(oA)) && Math.abs(t - aA) <= T * Math.max(1, Math.abs(t), Math.abs(aA)) && Math.abs(y - P) <= T * Math.max(1, Math.abs(y), Math.abs(P)) && Math.abs(n - Wg) <= T * Math.max(1, Math.abs(n), Math.abs(Wg)) && Math.abs(F - bg) <= T * Math.max(1, Math.abs(F), Math.abs(bg)) && Math.abs(G - Zg) <= T * Math.max(1, Math.abs(G), Math.abs(Zg));
|
|
857
879
|
}
|
|
858
880
|
function d() {
|
|
859
881
|
var g = new X(3);
|
|
860
882
|
return X != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0), g;
|
|
861
883
|
}
|
|
862
|
-
function
|
|
884
|
+
function EA(g) {
|
|
863
885
|
var A = new X(3);
|
|
864
886
|
return A[0] = g[0], A[1] = g[1], A[2] = g[2], A;
|
|
865
887
|
}
|
|
@@ -871,36 +893,36 @@ function p(g, A, I) {
|
|
|
871
893
|
var B = new X(3);
|
|
872
894
|
return B[0] = g, B[1] = A, B[2] = I, B;
|
|
873
895
|
}
|
|
874
|
-
function
|
|
896
|
+
function jI(g, A) {
|
|
875
897
|
return g[0] = A[0], g[1] = A[1], g[2] = A[2], g;
|
|
876
898
|
}
|
|
877
899
|
function rA(g, A, I, B) {
|
|
878
900
|
return g[0] = A, g[1] = I, g[2] = B, g;
|
|
879
901
|
}
|
|
880
|
-
function
|
|
902
|
+
function aI(g, A, I) {
|
|
881
903
|
return g[0] = A[0] + I[0], g[1] = A[1] + I[1], g[2] = A[2] + I[2], g;
|
|
882
904
|
}
|
|
883
905
|
function eg(g, A, I) {
|
|
884
906
|
return g[0] = A[0] - I[0], g[1] = A[1] - I[1], g[2] = A[2] - I[2], g;
|
|
885
907
|
}
|
|
886
|
-
function
|
|
908
|
+
function zC(g, A, I) {
|
|
887
909
|
return g[0] = A[0] * I[0], g[1] = A[1] * I[1], g[2] = A[2] * I[2], g;
|
|
888
910
|
}
|
|
889
|
-
function
|
|
911
|
+
function zI(g, A, I) {
|
|
890
912
|
return g[0] = A[0] * I, g[1] = A[1] * I, g[2] = A[2] * I, g;
|
|
891
913
|
}
|
|
892
914
|
function _I(g, A, I, B) {
|
|
893
915
|
return g[0] = A[0] + I[0] * B, g[1] = A[1] + I[1] * B, g[2] = A[2] + I[2] * B, g;
|
|
894
916
|
}
|
|
895
|
-
function
|
|
917
|
+
function _C(g, A) {
|
|
896
918
|
var I = A[0] - g[0], B = A[1] - g[1], C = A[2] - g[2];
|
|
897
919
|
return I * I + B * B + C * C;
|
|
898
920
|
}
|
|
899
|
-
function
|
|
921
|
+
function XB(g, A) {
|
|
900
922
|
var I = A[0], B = A[1], C = A[2], Q = I * I + B * B + C * C;
|
|
901
923
|
return Q > 0 && (Q = 1 / Math.sqrt(Q)), g[0] = A[0] * Q, g[1] = A[1] * Q, g[2] = A[2] * Q, g;
|
|
902
924
|
}
|
|
903
|
-
function
|
|
925
|
+
function sI(g, A) {
|
|
904
926
|
return g[0] * A[0] + g[1] * A[1] + g[2] * A[2];
|
|
905
927
|
}
|
|
906
928
|
function EI(g, A, I) {
|
|
@@ -911,7 +933,7 @@ function ng(g, A, I) {
|
|
|
911
933
|
var B = A[0], C = A[1], Q = A[2], E = I[3] * B + I[7] * C + I[11] * Q + I[15];
|
|
912
934
|
return E = E || 1, g[0] = (I[0] * B + I[4] * C + I[8] * Q + I[12]) / E, g[1] = (I[1] * B + I[5] * C + I[9] * Q + I[13]) / E, g[2] = (I[2] * B + I[6] * C + I[10] * Q + I[14]) / E, g;
|
|
913
935
|
}
|
|
914
|
-
function
|
|
936
|
+
function jB(g, A, I) {
|
|
915
937
|
var B = I[0], C = I[1], Q = I[2], E = I[3], i = A[0], o = A[1], a = A[2], s = C * a - Q * o, D = Q * i - B * a, h = B * o - C * i;
|
|
916
938
|
return s = s + s, D = D + D, h = h + h, g[0] = i + E * s + C * h - Q * D, g[1] = o + E * D + Q * s - B * h, g[2] = a + E * h + B * D - C * s, g;
|
|
917
939
|
}
|
|
@@ -932,7 +954,7 @@ var $I = eg, AQ = yg;
|
|
|
932
954
|
return A;
|
|
933
955
|
};
|
|
934
956
|
})();
|
|
935
|
-
function
|
|
957
|
+
function YA() {
|
|
936
958
|
var g = new X(4);
|
|
937
959
|
return X != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0, g[3] = 0), g;
|
|
938
960
|
}
|
|
@@ -940,7 +962,7 @@ function IQ(g) {
|
|
|
940
962
|
var A = new X(4);
|
|
941
963
|
return A[0] = g[0], A[1] = g[1], A[2] = g[2], A[3] = g[3], A;
|
|
942
964
|
}
|
|
943
|
-
function
|
|
965
|
+
function DI(g, A, I, B) {
|
|
944
966
|
var C = new X(4);
|
|
945
967
|
return C[0] = g, C[1] = A, C[2] = I, C[3] = B, C;
|
|
946
968
|
}
|
|
@@ -954,12 +976,12 @@ function CQ(g, A) {
|
|
|
954
976
|
var I = A[0], B = A[1], C = A[2], Q = A[3], E = I * I + B * B + C * C + Q * Q;
|
|
955
977
|
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;
|
|
956
978
|
}
|
|
957
|
-
function
|
|
979
|
+
function VA(g, A, I) {
|
|
958
980
|
var B = A[0], C = A[1], Q = A[2], E = A[3];
|
|
959
981
|
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;
|
|
960
982
|
}
|
|
961
983
|
(function() {
|
|
962
|
-
var g =
|
|
984
|
+
var g = YA();
|
|
963
985
|
return function(A, I, B, C, Q, E) {
|
|
964
986
|
var i, o;
|
|
965
987
|
for (I || (I = 4), B || (B = 0), C ? o = Math.min(C * I + B, A.length) : o = A.length, i = B; i < o; i += I)
|
|
@@ -967,7 +989,7 @@ function vA(g, A, I) {
|
|
|
967
989
|
return A;
|
|
968
990
|
};
|
|
969
991
|
})();
|
|
970
|
-
function
|
|
992
|
+
function hI() {
|
|
971
993
|
var g = new X(4);
|
|
972
994
|
return X != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0), g[3] = 1, g;
|
|
973
995
|
}
|
|
@@ -1000,27 +1022,27 @@ var iQ = IQ, oQ = gQ, MI = CQ;
|
|
|
1000
1022
|
(function() {
|
|
1001
1023
|
var g = d(), A = p(1, 0, 0), I = p(0, 1, 0);
|
|
1002
1024
|
return function(B, C, Q) {
|
|
1003
|
-
var E =
|
|
1004
|
-
return E < -0.999999 ? (EI(g, A, C), AQ(g) < 1e-6 && EI(g, I, C),
|
|
1025
|
+
var E = sI(C, Q);
|
|
1026
|
+
return E < -0.999999 ? (EI(g, A, C), AQ(g) < 1e-6 && EI(g, I, C), XB(g, g), QQ(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, MI(B, B));
|
|
1005
1027
|
};
|
|
1006
1028
|
})();
|
|
1007
1029
|
(function() {
|
|
1008
|
-
var g =
|
|
1030
|
+
var g = hI(), A = hI();
|
|
1009
1031
|
return function(I, B, C, Q, E, i) {
|
|
1010
1032
|
return uI(g, B, E, i), uI(A, C, Q, i), uI(I, g, A, 2 * i * (1 - i)), I;
|
|
1011
1033
|
};
|
|
1012
1034
|
})();
|
|
1013
1035
|
(function() {
|
|
1014
|
-
var g =
|
|
1036
|
+
var g = VB();
|
|
1015
1037
|
return function(A, I, B, C) {
|
|
1016
1038
|
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], MI(A, wg(A, g));
|
|
1017
1039
|
};
|
|
1018
1040
|
})();
|
|
1019
|
-
function
|
|
1041
|
+
function zB() {
|
|
1020
1042
|
var g = new X(2);
|
|
1021
1043
|
return X != Float32Array && (g[0] = 0, g[1] = 0), g;
|
|
1022
1044
|
}
|
|
1023
|
-
function
|
|
1045
|
+
function zg(g) {
|
|
1024
1046
|
var A = new X(2);
|
|
1025
1047
|
return A[0] = g[0], A[1] = g[1], A;
|
|
1026
1048
|
}
|
|
@@ -1040,7 +1062,7 @@ function DQ(g, A, I, B) {
|
|
|
1040
1062
|
var C = A[0], Q = A[1];
|
|
1041
1063
|
return g[0] = C + B * (I[0] - C), g[1] = Q + B * (I[1] - Q), g;
|
|
1042
1064
|
}
|
|
1043
|
-
function
|
|
1065
|
+
function _g(g, A) {
|
|
1044
1066
|
return g[0] === A[0] && g[1] === A[1];
|
|
1045
1067
|
}
|
|
1046
1068
|
function TI(g, A) {
|
|
@@ -1048,7 +1070,7 @@ function TI(g, A) {
|
|
|
1048
1070
|
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));
|
|
1049
1071
|
}
|
|
1050
1072
|
(function() {
|
|
1051
|
-
var g =
|
|
1073
|
+
var g = zB();
|
|
1052
1074
|
return function(A, I, B, C, Q, E) {
|
|
1053
1075
|
var i, o;
|
|
1054
1076
|
for (I || (I = 2), B || (B = 0), C ? o = Math.min(C * I + B, A.length) : o = A.length, i = B; i < o; i += I)
|
|
@@ -1066,7 +1088,7 @@ class SA {
|
|
|
1066
1088
|
* the first element, and avoids biasing toward (0,0,0).
|
|
1067
1089
|
*/
|
|
1068
1090
|
constructor(A, I) {
|
|
1069
|
-
this.min = A ?
|
|
1091
|
+
this.min = A ? EA(A) : p(1 / 0, 1 / 0, 1 / 0), this.max = I ? EA(I) : p(-1 / 0, -1 / 0, -1 / 0);
|
|
1070
1092
|
}
|
|
1071
1093
|
clone() {
|
|
1072
1094
|
return new SA(this.min, this.max);
|
|
@@ -1109,7 +1131,7 @@ const hQ = {
|
|
|
1109
1131
|
size: 7,
|
|
1110
1132
|
marker: 8
|
|
1111
1133
|
};
|
|
1112
|
-
class
|
|
1134
|
+
class mA extends YI {
|
|
1113
1135
|
boundingBox_ = null;
|
|
1114
1136
|
primitive_;
|
|
1115
1137
|
attributes_;
|
|
@@ -1287,7 +1309,7 @@ function GQ(g) {
|
|
|
1287
1309
|
return [0, 1];
|
|
1288
1310
|
}
|
|
1289
1311
|
}
|
|
1290
|
-
class rg extends
|
|
1312
|
+
class rg extends YI {
|
|
1291
1313
|
dataFormat = "rgba";
|
|
1292
1314
|
dataType = "unsigned_byte";
|
|
1293
1315
|
maxFilter = "nearest";
|
|
@@ -1323,11 +1345,12 @@ class wQ {
|
|
|
1323
1345
|
textures_ = /* @__PURE__ */ new Map();
|
|
1324
1346
|
currentTexture_ = null;
|
|
1325
1347
|
maxTextureUnits_;
|
|
1348
|
+
nextPersistentUnit_;
|
|
1326
1349
|
gpuTextureBytes_ = 0;
|
|
1327
1350
|
textureCount_ = 0;
|
|
1328
1351
|
readFramebuffer_ = null;
|
|
1329
1352
|
constructor(A) {
|
|
1330
|
-
this.gl_ = A, this.maxTextureUnits_ = A.getParameter(A.MAX_TEXTURE_IMAGE_UNITS);
|
|
1353
|
+
this.gl_ = A, this.maxTextureUnits_ = A.getParameter(A.MAX_TEXTURE_IMAGE_UNITS), this.nextPersistentUnit_ = this.maxTextureUnits_ - 1;
|
|
1331
1354
|
}
|
|
1332
1355
|
get gpuTextureBytes() {
|
|
1333
1356
|
return this.gpuTextureBytes_;
|
|
@@ -1335,11 +1358,18 @@ class wQ {
|
|
|
1335
1358
|
get textureCount() {
|
|
1336
1359
|
return this.textureCount_;
|
|
1337
1360
|
}
|
|
1361
|
+
reservePersistentUnit() {
|
|
1362
|
+
if (this.nextPersistentUnit_ < 0)
|
|
1363
|
+
throw new Error(
|
|
1364
|
+
`No texture units left to reserve (${this.maxTextureUnits_} total)`
|
|
1365
|
+
);
|
|
1366
|
+
return this.nextPersistentUnit_--;
|
|
1367
|
+
}
|
|
1338
1368
|
bindTexture(A, I) {
|
|
1339
1369
|
if (this.alreadyActive(A)) return;
|
|
1340
|
-
if (I < 0 || I
|
|
1370
|
+
if (I < 0 || I > this.nextPersistentUnit_)
|
|
1341
1371
|
throw new Error(
|
|
1342
|
-
`Texture index ${I} must be in [0, ${this.
|
|
1372
|
+
`Texture index ${I} must be in [0, ${this.nextPersistentUnit_}]; units above that are reserved`
|
|
1343
1373
|
);
|
|
1344
1374
|
const B = this.textures_.get(A);
|
|
1345
1375
|
B && !A.needsUpdate ? (this.gl_.activeTexture(this.gl_.TEXTURE0 + I), this.gl_.bindTexture(this.getTextureType(A), B)) : this.uploadTexture(A, I), this.currentTexture_ = A;
|
|
@@ -1590,7 +1620,7 @@ class AA {
|
|
|
1590
1620
|
* the first element, and avoids biasing toward (0,0).
|
|
1591
1621
|
*/
|
|
1592
1622
|
constructor(A, I) {
|
|
1593
|
-
this.min = A ?
|
|
1623
|
+
this.min = A ? zg(A) : V(1 / 0, 1 / 0), this.max = I ? zg(I) : V(-1 / 0, -1 / 0);
|
|
1594
1624
|
}
|
|
1595
1625
|
clone() {
|
|
1596
1626
|
return new AA(this.min, this.max);
|
|
@@ -1603,7 +1633,7 @@ class AA {
|
|
|
1603
1633
|
return !(A.max[0] <= I.min[0] || A.min[0] >= I.max[0] || A.max[1] <= I.min[1] || A.min[1] >= I.max[1]);
|
|
1604
1634
|
}
|
|
1605
1635
|
static equals(A, I) {
|
|
1606
|
-
return
|
|
1636
|
+
return _g(A.min, I.min) && _g(A.max, I.max);
|
|
1607
1637
|
}
|
|
1608
1638
|
floor() {
|
|
1609
1639
|
return new AA(
|
|
@@ -1687,8 +1717,8 @@ class FQ {
|
|
|
1687
1717
|
case "subtractive":
|
|
1688
1718
|
this.setBlendFunc(this.gl_.ZERO, this.gl_.ONE_MINUS_SRC_COLOR);
|
|
1689
1719
|
break;
|
|
1690
|
-
case "
|
|
1691
|
-
this.setBlendFunc(this.gl_.
|
|
1720
|
+
case "premultipliedOver":
|
|
1721
|
+
this.setBlendFunc(this.gl_.ONE, this.gl_.ONE_MINUS_SRC_ALPHA);
|
|
1692
1722
|
break;
|
|
1693
1723
|
case "normal":
|
|
1694
1724
|
default:
|
|
@@ -1744,16 +1774,69 @@ class FQ {
|
|
|
1744
1774
|
(this.stencilFunc_ !== A || this.stencilRef_ !== I || this.stencilFuncMask_ !== B) && (this.gl_.stencilFunc(A, I, B), this.stencilFunc_ = A, this.stencilRef_ = I, this.stencilFuncMask_ = B);
|
|
1745
1775
|
}
|
|
1746
1776
|
}
|
|
1747
|
-
|
|
1748
|
-
|
|
1777
|
+
class rQ {
|
|
1778
|
+
textureUnit;
|
|
1779
|
+
gl_;
|
|
1780
|
+
framebuffer_ = null;
|
|
1781
|
+
texture_ = null;
|
|
1782
|
+
width_ = 0;
|
|
1783
|
+
height_ = 0;
|
|
1784
|
+
constructor(A, I) {
|
|
1785
|
+
this.gl_ = A, this.textureUnit = I;
|
|
1786
|
+
}
|
|
1787
|
+
bind(A, I) {
|
|
1788
|
+
this.hasValidTarget(A, I) || this.createRenderTarget(A, I), this.gl_.bindFramebuffer(this.gl_.FRAMEBUFFER, this.framebuffer_);
|
|
1789
|
+
}
|
|
1790
|
+
unbind() {
|
|
1791
|
+
this.gl_.bindFramebuffer(this.gl_.FRAMEBUFFER, null);
|
|
1792
|
+
}
|
|
1793
|
+
dispose() {
|
|
1794
|
+
this.texture_ && this.gl_.deleteTexture(this.texture_), this.framebuffer_ && this.gl_.deleteFramebuffer(this.framebuffer_), this.texture_ = null, this.framebuffer_ = null, this.width_ = 0, this.height_ = 0;
|
|
1795
|
+
}
|
|
1796
|
+
hasValidTarget(A, I) {
|
|
1797
|
+
return this.texture_ !== null && this.width_ === A && this.height_ === I;
|
|
1798
|
+
}
|
|
1799
|
+
createRenderTarget(A, I) {
|
|
1800
|
+
const B = this.gl_;
|
|
1801
|
+
if (this.texture_ && B.deleteTexture(this.texture_), this.framebuffer_ ??= B.createFramebuffer(), !this.framebuffer_)
|
|
1802
|
+
throw new Error("Failed to create scene depth framebuffer");
|
|
1803
|
+
const C = this.createDepthTexture(A, I);
|
|
1804
|
+
B.bindFramebuffer(B.FRAMEBUFFER, this.framebuffer_), B.framebufferTexture2D(
|
|
1805
|
+
B.FRAMEBUFFER,
|
|
1806
|
+
B.DEPTH_ATTACHMENT,
|
|
1807
|
+
B.TEXTURE_2D,
|
|
1808
|
+
C,
|
|
1809
|
+
0
|
|
1810
|
+
), B.drawBuffers([B.NONE]), B.readBuffer(B.NONE), B.bindFramebuffer(B.FRAMEBUFFER, null), this.texture_ = C, this.width_ = A, this.height_ = I;
|
|
1811
|
+
}
|
|
1812
|
+
createDepthTexture(A, I) {
|
|
1813
|
+
const B = this.gl_, C = B.createTexture();
|
|
1814
|
+
if (!C) throw new Error("Failed to create scene depth texture");
|
|
1815
|
+
return B.activeTexture(B.TEXTURE0 + this.textureUnit), B.bindTexture(B.TEXTURE_2D, C), B.texImage2D(
|
|
1816
|
+
B.TEXTURE_2D,
|
|
1817
|
+
0,
|
|
1818
|
+
B.DEPTH_COMPONENT24,
|
|
1819
|
+
A,
|
|
1820
|
+
I,
|
|
1821
|
+
0,
|
|
1822
|
+
B.DEPTH_COMPONENT,
|
|
1823
|
+
B.UNSIGNED_INT,
|
|
1824
|
+
null
|
|
1825
|
+
), B.texParameteri(B.TEXTURE_2D, B.TEXTURE_MIN_FILTER, B.NEAREST), B.texParameteri(B.TEXTURE_2D, B.TEXTURE_MAG_FILTER, B.NEAREST), B.texParameteri(B.TEXTURE_2D, B.TEXTURE_WRAP_S, B.CLAMP_TO_EDGE), B.texParameteri(B.TEXTURE_2D, B.TEXTURE_WRAP_T, B.CLAMP_TO_EDGE), C;
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
const SQ = vB($(), [1, -1, 1]);
|
|
1829
|
+
class RQ extends kC {
|
|
1749
1830
|
gl_;
|
|
1750
|
-
programs_;
|
|
1751
1831
|
bindings_;
|
|
1752
|
-
|
|
1832
|
+
depthTarget_;
|
|
1833
|
+
programs_;
|
|
1753
1834
|
state_;
|
|
1835
|
+
textures_;
|
|
1754
1836
|
renderedObjectsPerFrame_ = 0;
|
|
1755
1837
|
stencilRef_ = 0;
|
|
1756
1838
|
currentViewportSize_ = [0, 0];
|
|
1839
|
+
currentViewportHasSceneDepth_ = !1;
|
|
1757
1840
|
constructor(A) {
|
|
1758
1841
|
super(A);
|
|
1759
1842
|
const I = this.canvas.getContext("webgl2", {
|
|
@@ -1766,7 +1849,10 @@ class SQ extends LC {
|
|
|
1766
1849
|
this.gl_ = I, k.info(
|
|
1767
1850
|
"WebGLRenderer",
|
|
1768
1851
|
`WebGL version ${I.getParameter(I.VERSION)}`
|
|
1769
|
-
), I.getExtension("EXT_color_buffer_float"), this.programs_ = new
|
|
1852
|
+
), I.getExtension("EXT_color_buffer_float"), this.programs_ = new mC(I), this.bindings_ = new tQ(I), this.textures_ = new wQ(I), this.state_ = new FQ(I), this.depthTarget_ = new rQ(
|
|
1853
|
+
I,
|
|
1854
|
+
this.textures_.reservePersistentUnit()
|
|
1855
|
+
), this.resize(this.canvas.width, this.canvas.height);
|
|
1770
1856
|
}
|
|
1771
1857
|
get gpuTextureBytes() {
|
|
1772
1858
|
return this.textures_.gpuTextureBytes;
|
|
@@ -1800,13 +1886,18 @@ class SQ extends LC {
|
|
|
1800
1886
|
const i = A.camera.frustum, o = [], a = [];
|
|
1801
1887
|
for (const s of A.layers)
|
|
1802
1888
|
s.state === "ready" && (s.occludes ? o : a).push(s);
|
|
1803
|
-
this.
|
|
1889
|
+
this.currentViewportHasSceneDepth_ = o.length > 0 && a.some((s) => s.requiresSceneDepth), this.primeDepthBuffer(o, A.camera, i), this.currentViewportHasSceneDepth_ && this.renderDepthTexture(o, A.camera, i), this.state_.setDepthMask(!1);
|
|
1804
1890
|
for (const s of [...o, ...a])
|
|
1805
1891
|
this.renderLayer(s, A.camera, i);
|
|
1806
1892
|
this.resetState(), this.renderedObjects_ = this.renderedObjectsPerFrame_;
|
|
1807
1893
|
}
|
|
1808
|
-
|
|
1809
|
-
this.state_.setColorMask(!1), this.state_.setDepthFunc(this.gl_.LESS), this.state_.setPolygonOffset(!0);
|
|
1894
|
+
primeDepthBuffer(A, I, B) {
|
|
1895
|
+
this.state_.setColorMask(!1), this.state_.setDepthFunc(this.gl_.LESS), this.state_.setPolygonOffset(!0), this.drawDepthOnly(A, I, B), this.resetState();
|
|
1896
|
+
}
|
|
1897
|
+
renderDepthTexture(A, I, B) {
|
|
1898
|
+
this.depthTarget_.bind(this.width, this.height), this.state_.setDepthMask(!0), this.state_.setDepthFunc(this.gl_.LESS), this.gl_.clear(this.gl_.DEPTH_BUFFER_BIT), this.drawDepthOnly(A, I, B), this.depthTarget_.unbind(), this.resetState();
|
|
1899
|
+
}
|
|
1900
|
+
drawDepthOnly(A, I, B) {
|
|
1810
1901
|
for (const C of A)
|
|
1811
1902
|
for (const Q of C.coverageGroups.values())
|
|
1812
1903
|
for (const E of Q) {
|
|
@@ -1857,13 +1948,13 @@ class SQ extends LC {
|
|
|
1857
1948
|
}
|
|
1858
1949
|
}
|
|
1859
1950
|
drawGeometry(A, I, B, C, Q) {
|
|
1860
|
-
const E =
|
|
1951
|
+
const E = QI(
|
|
1861
1952
|
$(),
|
|
1862
1953
|
Q.viewMatrix,
|
|
1863
1954
|
I.transform.matrix
|
|
1864
|
-
), i =
|
|
1955
|
+
), i = QI(
|
|
1865
1956
|
$(),
|
|
1866
|
-
|
|
1957
|
+
SQ,
|
|
1867
1958
|
Q.projectionMatrix
|
|
1868
1959
|
), o = this.currentViewportSize_, a = I.getUniforms(), D = {
|
|
1869
1960
|
...B.getUniforms(),
|
|
@@ -1883,6 +1974,22 @@ class SQ extends LC {
|
|
|
1883
1974
|
case "u_resolution":
|
|
1884
1975
|
C.setUniform(y, o);
|
|
1885
1976
|
break;
|
|
1977
|
+
case "u_hasSceneDepth":
|
|
1978
|
+
C.setUniform(
|
|
1979
|
+
y,
|
|
1980
|
+
Number(
|
|
1981
|
+
B.requiresSceneDepth && this.currentViewportHasSceneDepth_
|
|
1982
|
+
)
|
|
1983
|
+
);
|
|
1984
|
+
break;
|
|
1985
|
+
case "u_sceneDepth":
|
|
1986
|
+
C.setUniform(y, this.depthTarget_.textureUnit);
|
|
1987
|
+
break;
|
|
1988
|
+
case "u_mvpInverse": {
|
|
1989
|
+
const n = QI($(), i, E), F = OA($(), n);
|
|
1990
|
+
C.setUniform(y, F);
|
|
1991
|
+
break;
|
|
1992
|
+
}
|
|
1886
1993
|
case "u_opacity":
|
|
1887
1994
|
C.setUniform(
|
|
1888
1995
|
y,
|
|
@@ -1890,8 +1997,8 @@ class SQ extends LC {
|
|
|
1890
1997
|
);
|
|
1891
1998
|
break;
|
|
1892
1999
|
case "u_cameraPositionModel": {
|
|
1893
|
-
const n =
|
|
1894
|
-
|
|
2000
|
+
const n = OA($(), E), F = DI(0, 0, 0, 1), G = VA(
|
|
2001
|
+
YA(),
|
|
1895
2002
|
F,
|
|
1896
2003
|
n
|
|
1897
2004
|
);
|
|
@@ -1947,11 +2054,11 @@ class SQ extends LC {
|
|
|
1947
2054
|
this.state_.setColorMask(!0), this.state_.setDepthMask(!0), this.state_.setDepthTesting(!0), this.state_.setDepthFunc(this.gl_.LEQUAL), this.state_.setPolygonOffset(!1), this.state_.setStencilTest(!1), this.state_.setBlendingMode("none");
|
|
1948
2055
|
}
|
|
1949
2056
|
}
|
|
1950
|
-
function
|
|
2057
|
+
function WA(g, A) {
|
|
1951
2058
|
const I = g.priority ?? Number.MAX_SAFE_INTEGER, B = A.priority ?? Number.MAX_SAFE_INTEGER;
|
|
1952
2059
|
return I === B ? (g.orderKey ?? Number.MAX_SAFE_INTEGER) - (A.orderKey ?? Number.MAX_SAFE_INTEGER) : I - B;
|
|
1953
2060
|
}
|
|
1954
|
-
class
|
|
2061
|
+
class NQ {
|
|
1955
2062
|
maxConcurrent_;
|
|
1956
2063
|
pending_ = [];
|
|
1957
2064
|
running_ = /* @__PURE__ */ new Map();
|
|
@@ -1981,7 +2088,7 @@ class RQ {
|
|
|
1981
2088
|
}
|
|
1982
2089
|
pump() {
|
|
1983
2090
|
if (!(this.running_.size >= this.maxConcurrent_ || this.pending_.length === 0))
|
|
1984
|
-
for (this.pending_.sort((A, I) =>
|
|
2091
|
+
for (this.pending_.sort((A, I) => WA(A.chunk, I.chunk)); this.running_.size < this.maxConcurrent_ && this.pending_.length > 0; )
|
|
1985
2092
|
this.start(this.pending_.shift());
|
|
1986
2093
|
}
|
|
1987
2094
|
start(A) {
|
|
@@ -2000,17 +2107,17 @@ class RQ {
|
|
|
2000
2107
|
this.running_.set(I, { controller: C, promise: Q });
|
|
2001
2108
|
}
|
|
2002
2109
|
}
|
|
2003
|
-
let
|
|
2004
|
-
function
|
|
2005
|
-
g.data && (
|
|
2110
|
+
let tI = 0, yI = 0;
|
|
2111
|
+
function cQ(g, A) {
|
|
2112
|
+
g.data && (tI -= g.data.byteLength, yI -= 1), g.data = A, tI += A.byteLength, yI += 1;
|
|
2006
2113
|
}
|
|
2007
|
-
function
|
|
2008
|
-
g.data && (
|
|
2114
|
+
function $g(g) {
|
|
2115
|
+
g.data && (tI -= g.data.byteLength, yI -= 1), g.data = void 0, g.texture?.releaseCpuData();
|
|
2009
2116
|
}
|
|
2010
|
-
function
|
|
2011
|
-
return { cpuChunkBytes:
|
|
2117
|
+
function UQ() {
|
|
2118
|
+
return { cpuChunkBytes: tI, cpuChunkCount: yI };
|
|
2012
2119
|
}
|
|
2013
|
-
function
|
|
2120
|
+
function AB(g, A, I = 1e-6) {
|
|
2014
2121
|
return Math.abs(g - A) <= I;
|
|
2015
2122
|
}
|
|
2016
2123
|
const W = {
|
|
@@ -2018,7 +2125,7 @@ const W = {
|
|
|
2018
2125
|
y: 1,
|
|
2019
2126
|
z: 2
|
|
2020
2127
|
};
|
|
2021
|
-
function
|
|
2128
|
+
function MA(g) {
|
|
2022
2129
|
switch (g) {
|
|
2023
2130
|
case "XY":
|
|
2024
2131
|
return { u: "x", v: "y", w: "z" };
|
|
@@ -2028,10 +2135,10 @@ function dA(g) {
|
|
|
2028
2135
|
return { u: "y", v: "z", w: "x" };
|
|
2029
2136
|
}
|
|
2030
2137
|
}
|
|
2031
|
-
function
|
|
2138
|
+
function dA(g) {
|
|
2032
2139
|
const A = d(), I = d();
|
|
2033
2140
|
A[W[g.u]] = 1, I[W[g.v]] = 1;
|
|
2034
|
-
const B = EI(d(), A, I), C =
|
|
2141
|
+
const B = EI(d(), A, I), C = WC(
|
|
2035
2142
|
A[0],
|
|
2036
2143
|
A[1],
|
|
2037
2144
|
A[2],
|
|
@@ -2041,10 +2148,10 @@ function KA(g) {
|
|
|
2041
2148
|
B[0],
|
|
2042
2149
|
B[1],
|
|
2043
2150
|
B[2]
|
|
2044
|
-
), Q = wg(
|
|
2151
|
+
), Q = wg(hI(), C);
|
|
2045
2152
|
return MI(Q, Q);
|
|
2046
2153
|
}
|
|
2047
|
-
const
|
|
2154
|
+
const IB = [
|
|
2048
2155
|
Int8Array,
|
|
2049
2156
|
Int16Array,
|
|
2050
2157
|
Int32Array,
|
|
@@ -2053,32 +2160,32 @@ const gB = [
|
|
|
2053
2160
|
Uint32Array,
|
|
2054
2161
|
Float32Array
|
|
2055
2162
|
];
|
|
2056
|
-
function
|
|
2057
|
-
if (
|
|
2163
|
+
function kQ(g) {
|
|
2164
|
+
if (IB.some((I) => g instanceof I))
|
|
2058
2165
|
return !0;
|
|
2059
|
-
const A =
|
|
2166
|
+
const A = IB.map((I) => I.name);
|
|
2060
2167
|
return k.debug(
|
|
2061
2168
|
"Chunk",
|
|
2062
2169
|
`Unsupported chunk data type: ${g}. Supported data types: ${A}`
|
|
2063
2170
|
), !1;
|
|
2064
2171
|
}
|
|
2065
|
-
function
|
|
2172
|
+
function LQ(g, A) {
|
|
2066
2173
|
return Math.round((A - g.translation) / g.scale);
|
|
2067
2174
|
}
|
|
2068
|
-
function
|
|
2175
|
+
function _B(g, A) {
|
|
2069
2176
|
const I = d(), B = d();
|
|
2070
2177
|
for (const Q of ["x", "y", "z"]) {
|
|
2071
2178
|
const E = Q === A.w ? 0.5 * g.scale[Q] : 0, i = W[Q];
|
|
2072
2179
|
I[i] = 1 / (g.scale[Q] * g.shape[Q]), B[i] = E - g.offset[Q];
|
|
2073
2180
|
}
|
|
2074
|
-
const C =
|
|
2075
|
-
return
|
|
2181
|
+
const C = vB($(), I);
|
|
2182
|
+
return bC(C, C, B);
|
|
2076
2183
|
}
|
|
2077
2184
|
function hA(g, A, I) {
|
|
2078
2185
|
return Math.max(A, Math.min(I, g));
|
|
2079
2186
|
}
|
|
2080
2187
|
const dI = Symbol("INTERNAL_POLICY_KEY");
|
|
2081
|
-
class
|
|
2188
|
+
class JQ {
|
|
2082
2189
|
store_;
|
|
2083
2190
|
policy_;
|
|
2084
2191
|
policyChanged_ = !1;
|
|
@@ -2145,13 +2252,13 @@ class LQ {
|
|
|
2145
2252
|
k.warn(
|
|
2146
2253
|
"ChunkStoreView",
|
|
2147
2254
|
"updateChunkViewStates called with no chunks initialized"
|
|
2148
|
-
), this.chunkViewStates_.forEach(
|
|
2255
|
+
), this.chunkViewStates_.forEach(xA);
|
|
2149
2256
|
return;
|
|
2150
2257
|
}
|
|
2151
|
-
const D =
|
|
2258
|
+
const D = zB();
|
|
2152
2259
|
DQ(D, B.min, B.max, 0.5);
|
|
2153
2260
|
const h = this.makeViewBounds3D(B, o);
|
|
2154
|
-
this.chunkViewStates_.forEach(
|
|
2261
|
+
this.chunkViewStates_.forEach(xA);
|
|
2155
2262
|
const t = this.channelsOfInterest(A), y = this.fallbackLOD(), n = this.getPaddedBounds(h), F = this.currentLOD_ === y ? [this.currentLOD_] : [this.currentLOD_, y];
|
|
2156
2263
|
for (const G of F) {
|
|
2157
2264
|
const J = G === this.currentLOD_, U = G === y;
|
|
@@ -2191,10 +2298,10 @@ class LQ {
|
|
|
2191
2298
|
k.warn(
|
|
2192
2299
|
"ChunkStoreView",
|
|
2193
2300
|
"updateChunksForVolume called with no chunks initialized"
|
|
2194
|
-
), this.chunkViewStates_.forEach(
|
|
2301
|
+
), this.chunkViewStates_.forEach(xA);
|
|
2195
2302
|
return;
|
|
2196
2303
|
}
|
|
2197
|
-
this.currentLOD_ = this.policy_.lod.min, this.chunkViewStates_.forEach(
|
|
2304
|
+
this.currentLOD_ = this.policy_.lod.min, this.chunkViewStates_.forEach(xA);
|
|
2198
2305
|
const Q = this.channelsOfInterest(A), E = this.fallbackLOD(), i = (o) => {
|
|
2199
2306
|
const a = o.lod === E, s = o.lod === this.currentLOD_, D = this.computePriority(
|
|
2200
2307
|
a,
|
|
@@ -2238,7 +2345,7 @@ class LQ {
|
|
|
2238
2345
|
I && (I.visible || I.prefetch || I.priority !== null) || this.chunkViewStates_.delete(A);
|
|
2239
2346
|
}
|
|
2240
2347
|
dispose() {
|
|
2241
|
-
this.isDisposed_ = !0, this.chunkViewStates_.forEach(
|
|
2348
|
+
this.isDisposed_ = !0, this.chunkViewStates_.forEach(xA);
|
|
2242
2349
|
}
|
|
2243
2350
|
setImageSourcePolicy(A, I) {
|
|
2244
2351
|
if (I !== dI)
|
|
@@ -2359,7 +2466,7 @@ class LQ {
|
|
|
2359
2466
|
}
|
|
2360
2467
|
timeIndex(A) {
|
|
2361
2468
|
const I = this.store_.dimensions.t;
|
|
2362
|
-
return A.t === void 0 || I === void 0 ? 0 :
|
|
2469
|
+
return A.t === void 0 || I === void 0 ? 0 : LQ(I.lods[0], A.t);
|
|
2363
2470
|
}
|
|
2364
2471
|
getSliceAxisBounds(A) {
|
|
2365
2472
|
const I = this.store_.dimensions[this.axes_.w];
|
|
@@ -2387,7 +2494,7 @@ class LQ {
|
|
|
2387
2494
|
return this.lastViewBounds2D_ === null || !TI(this.lastViewBounds2D_.min, A.min) || !TI(this.lastViewBounds2D_.max, A.max);
|
|
2388
2495
|
}
|
|
2389
2496
|
hasViewProjectionChanged(A) {
|
|
2390
|
-
return this.lastViewProjection_ === null || !
|
|
2497
|
+
return this.lastViewProjection_ === null || !jC(this.lastViewProjection_, A);
|
|
2391
2498
|
}
|
|
2392
2499
|
sliceBoundsChanged(A) {
|
|
2393
2500
|
return !this.lastSliceBounds_ || !TI(this.lastSliceBounds_, A);
|
|
@@ -2399,7 +2506,7 @@ class LQ {
|
|
|
2399
2506
|
const { u: I, v: B, w: C } = this.axes_, Q = this.store_.dimensions, E = Q[I].lods[this.currentLOD_], i = Q[B].lods[this.currentLOD_], o = Q[C]?.lods[this.currentLOD_], a = d();
|
|
2400
2507
|
return a[W[I]] = E.chunkSize * E.scale * this.policy_.prefetch.x, a[W[B]] = i.chunkSize * i.scale * this.policy_.prefetch.y, o && (a[W[C]] = o.chunkSize * o.scale * this.policy_.prefetch.z), new SA(
|
|
2401
2508
|
eg(d(), A.min, a),
|
|
2402
|
-
|
|
2509
|
+
aI(d(), A.max, a)
|
|
2403
2510
|
);
|
|
2404
2511
|
}
|
|
2405
2512
|
squareDistance2D(A, I) {
|
|
@@ -2410,10 +2517,10 @@ class LQ {
|
|
|
2410
2517
|
return E * E + i * i;
|
|
2411
2518
|
}
|
|
2412
2519
|
}
|
|
2413
|
-
function
|
|
2520
|
+
function xA(g) {
|
|
2414
2521
|
g.visible = !1, g.prefetch = !1, g.priority = null, g.orderKey = null;
|
|
2415
2522
|
}
|
|
2416
|
-
class
|
|
2523
|
+
class YQ {
|
|
2417
2524
|
// Chunks indexed as chunks_[lod][t][c][z][y][x].
|
|
2418
2525
|
chunks_;
|
|
2419
2526
|
lowestResLOD_;
|
|
@@ -2493,7 +2600,7 @@ class JQ {
|
|
|
2493
2600
|
return this.lowestResLOD_;
|
|
2494
2601
|
}
|
|
2495
2602
|
addView(A, I) {
|
|
2496
|
-
const B = new
|
|
2603
|
+
const B = new JQ(this, A, I);
|
|
2497
2604
|
return this.views_.push(B), this.hasHadViews_ = !0, B;
|
|
2498
2605
|
}
|
|
2499
2606
|
get views() {
|
|
@@ -2531,7 +2638,7 @@ class JQ {
|
|
|
2531
2638
|
const A = this.dimensions_.x, I = this.dimensions_.y;
|
|
2532
2639
|
for (let B = 1; B < this.dimensions_.numLods; B++) {
|
|
2533
2640
|
const C = A.lods[B].scale / A.lods[B - 1].scale, Q = I.lods[B].scale / I.lods[B - 1].scale;
|
|
2534
|
-
if (!
|
|
2641
|
+
if (!AB(C, 2, 0.02) || !AB(Q, 2, 0.02))
|
|
2535
2642
|
throw new Error(
|
|
2536
2643
|
`Invalid downsampling factor between levels ${B - 1} → ${B}: expected (2× in X and Y), but got (${C.toFixed(2)}×, ${Q.toFixed(2)}×) from scale [${A.lods[B - 1].scale}, ${I.lods[B - 1].scale}] → [${A.lods[B].scale}, ${I.lods[B].scale}]`
|
|
2537
2644
|
);
|
|
@@ -2607,8 +2714,8 @@ class Sg extends rg {
|
|
|
2607
2714
|
return B.unpackAlignment = A.rowAlignmentBytes, B;
|
|
2608
2715
|
}
|
|
2609
2716
|
}
|
|
2610
|
-
const
|
|
2611
|
-
class
|
|
2717
|
+
const MQ = 8, dQ = 4;
|
|
2718
|
+
class KQ {
|
|
2612
2719
|
stores_ = [];
|
|
2613
2720
|
queue_;
|
|
2614
2721
|
uploadTexture_;
|
|
@@ -2617,8 +2724,8 @@ class dQ {
|
|
|
2617
2724
|
memoryLimitBytes_;
|
|
2618
2725
|
maxGpuUploadsPerUpdate_;
|
|
2619
2726
|
resident_ = /* @__PURE__ */ new Set();
|
|
2620
|
-
constructor(A, I, B = () => 0, C = 1 / 0, Q =
|
|
2621
|
-
this.uploadTexture_ = A, this.disposeTexture_ = I, this.getGpuResidentBytes_ = B, this.memoryLimitBytes_ = C, this.maxGpuUploadsPerUpdate_ = Math.max(1, E), this.queue_ = new
|
|
2727
|
+
constructor(A, I, B = () => 0, C = 1 / 0, Q = MQ, E = dQ) {
|
|
2728
|
+
this.uploadTexture_ = A, this.disposeTexture_ = I, this.getGpuResidentBytes_ = B, this.memoryLimitBytes_ = C, this.maxGpuUploadsPerUpdate_ = Math.max(1, E), this.queue_ = new NQ(Q);
|
|
2622
2729
|
}
|
|
2623
2730
|
get memoryLimitBytes() {
|
|
2624
2731
|
return this.memoryLimitBytes_;
|
|
@@ -2633,11 +2740,11 @@ class dQ {
|
|
|
2633
2740
|
};
|
|
2634
2741
|
}
|
|
2635
2742
|
get memoryStats() {
|
|
2636
|
-
return
|
|
2743
|
+
return UQ();
|
|
2637
2744
|
}
|
|
2638
2745
|
addView(A, I, B) {
|
|
2639
2746
|
let C = this.stores_.find((Q) => Q.source === A)?.store;
|
|
2640
|
-
return C || (C = new
|
|
2747
|
+
return C || (C = new YQ(A.loader.getSourceDimensionMap()), this.stores_.push({ source: A, store: C })), C.addView(I, B);
|
|
2641
2748
|
}
|
|
2642
2749
|
update() {
|
|
2643
2750
|
const A = [];
|
|
@@ -2656,11 +2763,11 @@ class dQ {
|
|
|
2656
2763
|
A.releasedAt ??= performance.now();
|
|
2657
2764
|
return;
|
|
2658
2765
|
}
|
|
2659
|
-
|
|
2766
|
+
$g(A), A.state === "loaded" && (A.state = "unloaded");
|
|
2660
2767
|
}
|
|
2661
2768
|
enqueueWithinBudget(A) {
|
|
2662
2769
|
if (A.length === 0) return;
|
|
2663
|
-
A.sort((C, Q) =>
|
|
2770
|
+
A.sort((C, Q) => WA(C.chunk, Q.chunk));
|
|
2664
2771
|
let I = this.getGpuResidentBytes_(), B = null;
|
|
2665
2772
|
for (const { source: C, chunk: Q } of A) {
|
|
2666
2773
|
const E = this.chunkBytes(C, Q);
|
|
@@ -2680,12 +2787,12 @@ class dQ {
|
|
|
2680
2787
|
for (const I of this.resident_)
|
|
2681
2788
|
I.visible || A.push(I);
|
|
2682
2789
|
return A.sort((I, B) => {
|
|
2683
|
-
const C = -
|
|
2790
|
+
const C = -WA(I, B);
|
|
2684
2791
|
return C !== 0 ? C : (I.releasedAt ?? 0) - (B.releasedAt ?? 0);
|
|
2685
2792
|
});
|
|
2686
2793
|
}
|
|
2687
2794
|
evictWorseChunks(A, I, B, C) {
|
|
2688
|
-
for (; A + I > this.memoryLimitBytes_ && C.length > 0 &&
|
|
2795
|
+
for (; A + I > this.memoryLimitBytes_ && C.length > 0 && WA(C[0], B) > 0; ) {
|
|
2689
2796
|
const Q = C.shift();
|
|
2690
2797
|
Q.texture !== void 0 && (A -= Ag(Q.texture), this.disposeChunkTexture(Q), Q.state = "unloaded", Q.releasedAt = void 0);
|
|
2691
2798
|
}
|
|
@@ -2701,18 +2808,18 @@ class dQ {
|
|
|
2701
2808
|
for (const C of A)
|
|
2702
2809
|
C.state === "loaded" && C.texture === void 0 && I.push(C);
|
|
2703
2810
|
if (I.length === 0) return;
|
|
2704
|
-
I.sort(
|
|
2811
|
+
I.sort(WA);
|
|
2705
2812
|
const B = Math.min(I.length, this.maxGpuUploadsPerUpdate_);
|
|
2706
2813
|
for (let C = 0; C < B; C++) {
|
|
2707
2814
|
const Q = I[C], E = Sg.createWithChunk(Q);
|
|
2708
|
-
this.uploadTexture_(E), Q.texture = E, this.resident_.add(Q),
|
|
2815
|
+
this.uploadTexture_(E), Q.texture = E, this.resident_.add(Q), $g(Q);
|
|
2709
2816
|
}
|
|
2710
2817
|
}
|
|
2711
2818
|
disposeChunkTexture(A) {
|
|
2712
2819
|
this.disposeTexture_ && A.texture !== void 0 && (this.disposeTexture_(A.texture), A.texture = void 0, this.resident_.delete(A));
|
|
2713
2820
|
}
|
|
2714
2821
|
}
|
|
2715
|
-
var
|
|
2822
|
+
var PA = function(g = 1) {
|
|
2716
2823
|
var A = 0, I = document.createElement("div");
|
|
2717
2824
|
I.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000", I.addEventListener("click", function(D) {
|
|
2718
2825
|
D.preventDefault(), C(++A % I.children.length);
|
|
@@ -2725,9 +2832,9 @@ var OA = function(g = 1) {
|
|
|
2725
2832
|
I.children[h].style.display = h === D ? "block" : "none";
|
|
2726
2833
|
A = D;
|
|
2727
2834
|
}
|
|
2728
|
-
var Q = (performance || Date).now(), E = Q, i = 0, o = B(new
|
|
2835
|
+
var Q = (performance || Date).now(), E = Q, i = 0, o = B(new PA.Panel("FPS", "#0ff", "#002", g)), a = B(new PA.Panel("MS", "#0f0", "#020", g));
|
|
2729
2836
|
if (self.performance && self.performance.memory)
|
|
2730
|
-
var s = B(new
|
|
2837
|
+
var s = B(new PA.Panel("MB", "#f08", "#201", g));
|
|
2731
2838
|
return C(0), {
|
|
2732
2839
|
REVISION: 16,
|
|
2733
2840
|
dom: I,
|
|
@@ -2753,7 +2860,7 @@ var OA = function(g = 1) {
|
|
|
2753
2860
|
setMode: C
|
|
2754
2861
|
};
|
|
2755
2862
|
};
|
|
2756
|
-
|
|
2863
|
+
PA.Panel = function(g, A, I, B) {
|
|
2757
2864
|
var C = 1 / 0, Q = 0, E = Math.round, i = E(window.devicePixelRatio || 1), o = E(80 * i * B), a = E(48 * i * B), s = E(3 * i * B), D = 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");
|
|
2758
2865
|
F.width = o, F.height = a, F.style.cssText = `width:${E(B * 80)}px;height:${E(B * 48)}px`;
|
|
2759
2866
|
var G = F.getContext("2d");
|
|
@@ -2764,8 +2871,8 @@ OA.Panel = function(g, A, I, B) {
|
|
|
2764
2871
|
}
|
|
2765
2872
|
};
|
|
2766
2873
|
};
|
|
2767
|
-
function
|
|
2768
|
-
const A = new
|
|
2874
|
+
function HQ({ scale: g } = { scale: 1.5 }) {
|
|
2875
|
+
const A = new PA(g);
|
|
2769
2876
|
return A.showPanel(
|
|
2770
2877
|
0
|
|
2771
2878
|
/* 0 = fps, 1 = ms, 2 = mb */
|
|
@@ -2778,10 +2885,10 @@ const Ig = [
|
|
|
2778
2885
|
"pointercancel",
|
|
2779
2886
|
"wheel"
|
|
2780
2887
|
];
|
|
2781
|
-
function
|
|
2888
|
+
function qQ(g) {
|
|
2782
2889
|
return Ig.includes(g);
|
|
2783
2890
|
}
|
|
2784
|
-
class
|
|
2891
|
+
class lQ {
|
|
2785
2892
|
propagationStopped_ = !1;
|
|
2786
2893
|
type;
|
|
2787
2894
|
event;
|
|
@@ -2798,7 +2905,7 @@ class qQ {
|
|
|
2798
2905
|
this.propagationStopped_ = !0;
|
|
2799
2906
|
}
|
|
2800
2907
|
}
|
|
2801
|
-
class
|
|
2908
|
+
class fQ {
|
|
2802
2909
|
listeners_ = [];
|
|
2803
2910
|
element_;
|
|
2804
2911
|
isConnected_ = !1;
|
|
@@ -2843,31 +2950,31 @@ class lQ {
|
|
|
2843
2950
|
});
|
|
2844
2951
|
}
|
|
2845
2952
|
handleEvent = (A) => {
|
|
2846
|
-
if (!
|
|
2953
|
+
if (!qQ(A.type)) {
|
|
2847
2954
|
k.error("EventDispatcher", `Unsupported event type ${A.type}`);
|
|
2848
2955
|
return;
|
|
2849
2956
|
}
|
|
2850
|
-
const I = new
|
|
2957
|
+
const I = new lQ(A.type, A);
|
|
2851
2958
|
for (const B of this.listeners_)
|
|
2852
2959
|
if (B(I), I.propagationStopped) break;
|
|
2853
2960
|
};
|
|
2854
2961
|
}
|
|
2855
|
-
const
|
|
2856
|
-
class
|
|
2962
|
+
const pQ = 1e-12;
|
|
2963
|
+
class mQ {
|
|
2857
2964
|
origin;
|
|
2858
2965
|
direction;
|
|
2859
2966
|
constructor(A, I) {
|
|
2860
|
-
this.origin =
|
|
2967
|
+
this.origin = EA(A), this.direction = XB(d(), I);
|
|
2861
2968
|
}
|
|
2862
2969
|
intersectWithPlane(A) {
|
|
2863
|
-
const I =
|
|
2864
|
-
if (Math.abs(I) <
|
|
2970
|
+
const I = sI(this.direction, A.normal);
|
|
2971
|
+
if (Math.abs(I) < pQ)
|
|
2865
2972
|
return null;
|
|
2866
2973
|
const B = -A.signedDistanceToPoint(this.origin) / I;
|
|
2867
2974
|
return _I(d(), this.origin, this.direction, B);
|
|
2868
2975
|
}
|
|
2869
2976
|
}
|
|
2870
|
-
class
|
|
2977
|
+
class uQ {
|
|
2871
2978
|
id;
|
|
2872
2979
|
element;
|
|
2873
2980
|
camera;
|
|
@@ -2879,12 +2986,12 @@ class mQ {
|
|
|
2879
2986
|
context_;
|
|
2880
2987
|
layers_ = [];
|
|
2881
2988
|
constructor(A) {
|
|
2882
|
-
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
|
|
2989
|
+
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 fQ(this.element), this.events.addEventListener((I) => {
|
|
2883
2990
|
if (I.event instanceof PointerEvent || I.event instanceof WheelEvent) {
|
|
2884
2991
|
const { clientX: B, clientY: C } = I.event, Q = V(B, C);
|
|
2885
2992
|
I.clipPos = this.clientToClip(Q, 0), I.worldPos = this.camera.clipToWorld(I.clipPos);
|
|
2886
2993
|
const E = this.camera.clipToWorld(this.clientToClip(Q, -1)), i = this.camera.clipToWorld(this.clientToClip(Q, 1));
|
|
2887
|
-
I.worldRay = new
|
|
2994
|
+
I.worldRay = new mQ(E, eg(d(), i, E));
|
|
2888
2995
|
}
|
|
2889
2996
|
for (const B of this.layers_)
|
|
2890
2997
|
if (B.onEvent(I), I.propagationStopped) return;
|
|
@@ -2955,7 +3062,7 @@ class mQ {
|
|
|
2955
3062
|
this.camera.setAspectRatio(B);
|
|
2956
3063
|
}
|
|
2957
3064
|
}
|
|
2958
|
-
function
|
|
3065
|
+
function $B(g, A) {
|
|
2959
3066
|
for (const I of A) {
|
|
2960
3067
|
if (I.id === g.id)
|
|
2961
3068
|
throw new Error(
|
|
@@ -2969,23 +3076,23 @@ function AC(g, A) {
|
|
|
2969
3076
|
}
|
|
2970
3077
|
}
|
|
2971
3078
|
}
|
|
2972
|
-
function
|
|
3079
|
+
function TQ(g) {
|
|
2973
3080
|
for (let A = 0; A < g.length; A++)
|
|
2974
|
-
|
|
3081
|
+
$B(g[A], g.slice(0, A));
|
|
2975
3082
|
}
|
|
2976
|
-
function
|
|
3083
|
+
function gB(g, A, I) {
|
|
2977
3084
|
const B = g.map((C) => {
|
|
2978
3085
|
const Q = C.element ?? A;
|
|
2979
3086
|
return {
|
|
2980
3087
|
...C,
|
|
2981
3088
|
element: Q,
|
|
2982
|
-
id: C.id ?? Q.id ??
|
|
3089
|
+
id: C.id ?? Q.id ?? OB("viewport"),
|
|
2983
3090
|
context: I
|
|
2984
3091
|
};
|
|
2985
3092
|
});
|
|
2986
|
-
return
|
|
3093
|
+
return TQ(B), B.map((C) => new uQ(C));
|
|
2987
3094
|
}
|
|
2988
|
-
class
|
|
3095
|
+
class xQ {
|
|
2989
3096
|
elements_;
|
|
2990
3097
|
resizeObserver_;
|
|
2991
3098
|
mediaQuery_;
|
|
@@ -3044,8 +3151,8 @@ class TQ {
|
|
|
3044
3151
|
this.elements_.splice(I, 1), this.resizeObserver_ && this.resizeObserver_.unobserve(A);
|
|
3045
3152
|
}
|
|
3046
3153
|
}
|
|
3047
|
-
const
|
|
3048
|
-
class
|
|
3154
|
+
const WQ = 2048;
|
|
3155
|
+
class no {
|
|
3049
3156
|
chunkManager_;
|
|
3050
3157
|
context_;
|
|
3051
3158
|
renderer_;
|
|
@@ -3105,9 +3212,9 @@ class eo {
|
|
|
3105
3212
|
* @throws {Error} If viewports have duplicate IDs or shared elements
|
|
3106
3213
|
*/
|
|
3107
3214
|
constructor(A) {
|
|
3108
|
-
this.canvas = A.canvas, this.renderer_ = new
|
|
3109
|
-
const B = (A.memoryLimitMB ??
|
|
3110
|
-
this.chunkManager_ = new
|
|
3215
|
+
this.canvas = A.canvas, this.renderer_ = new RQ(this.canvas);
|
|
3216
|
+
const B = (A.memoryLimitMB ?? WQ) * 1024 * 1024;
|
|
3217
|
+
this.chunkManager_ = new KQ(
|
|
3111
3218
|
(Q) => this.renderer_.uploadTexture(Q),
|
|
3112
3219
|
(Q) => this.renderer_.disposeTexture(Q),
|
|
3113
3220
|
() => this.renderer_.gpuTextureBytes,
|
|
@@ -3116,15 +3223,15 @@ class eo {
|
|
|
3116
3223
|
A.maxGpuUploadsPerUpdate
|
|
3117
3224
|
), this.context_ = {
|
|
3118
3225
|
chunkManager: this.chunkManager_
|
|
3119
|
-
}, this.viewports_ =
|
|
3226
|
+
}, this.viewports_ = gB(
|
|
3120
3227
|
A.viewports ?? [],
|
|
3121
3228
|
this.canvas,
|
|
3122
3229
|
this.context_
|
|
3123
|
-
), this.overlays = [...A.overlays ?? []], A.showStats && (this.stats_ =
|
|
3230
|
+
), this.overlays = [...A.overlays ?? []], A.showStats && (this.stats_ = HQ());
|
|
3124
3231
|
const C = [this.canvas];
|
|
3125
3232
|
for (const Q of this.viewports_)
|
|
3126
3233
|
Q.element !== this.canvas && C.push(Q.element);
|
|
3127
|
-
this.sizeObserver_ = new
|
|
3234
|
+
this.sizeObserver_ = new xQ(C, () => {
|
|
3128
3235
|
this.renderer_.updateSize(), this.renderer_.beginFrame();
|
|
3129
3236
|
for (const Q of this.viewports_)
|
|
3130
3237
|
Q.updateSize(), this.renderer_.render(Q);
|
|
@@ -3162,8 +3269,8 @@ class eo {
|
|
|
3162
3269
|
return this.viewports_.find((I) => I.id === A);
|
|
3163
3270
|
}
|
|
3164
3271
|
addViewport(A) {
|
|
3165
|
-
const [I] =
|
|
3166
|
-
return
|
|
3272
|
+
const [I] = gB([A], this.canvas, this.context_);
|
|
3273
|
+
return $B(I, this.viewports_), this.viewports_.push(I), this.running && (I.events.connect(), I.element !== this.canvas && this.sizeObserver_.observe(I.element)), k.info("Idetik", `Added viewport "${I.id}"`), I;
|
|
3167
3274
|
}
|
|
3168
3275
|
removeViewport(A) {
|
|
3169
3276
|
const I = this.viewports_.indexOf(A);
|
|
@@ -3218,7 +3325,7 @@ class eo {
|
|
|
3218
3325
|
}
|
|
3219
3326
|
}
|
|
3220
3327
|
}
|
|
3221
|
-
function
|
|
3328
|
+
function bQ(g, A) {
|
|
3222
3329
|
return {
|
|
3223
3330
|
...g,
|
|
3224
3331
|
...A,
|
|
@@ -3228,20 +3335,20 @@ function WQ(g, A) {
|
|
|
3228
3335
|
}
|
|
3229
3336
|
};
|
|
3230
3337
|
}
|
|
3231
|
-
function
|
|
3338
|
+
function BB(g, A) {
|
|
3232
3339
|
const I = typeof g == "string" ? new URL(g) : g;
|
|
3233
3340
|
I.pathname.endsWith("/") || (I.pathname += "/");
|
|
3234
3341
|
const B = new URL(A.slice(1), I);
|
|
3235
3342
|
return B.search = I.search, B;
|
|
3236
3343
|
}
|
|
3237
|
-
async function
|
|
3344
|
+
async function CB(g) {
|
|
3238
3345
|
if (g.status !== 404) {
|
|
3239
3346
|
if (g.status === 200 || g.status === 206)
|
|
3240
3347
|
return new Uint8Array(await g.arrayBuffer());
|
|
3241
3348
|
throw new Error(`Unexpected response status ${g.status} ${g.statusText}`);
|
|
3242
3349
|
}
|
|
3243
3350
|
}
|
|
3244
|
-
class
|
|
3351
|
+
class zA {
|
|
3245
3352
|
url;
|
|
3246
3353
|
#A;
|
|
3247
3354
|
#I;
|
|
@@ -3250,14 +3357,14 @@ class _A {
|
|
|
3250
3357
|
this.url = A, this.#A = I.fetch ?? ((B) => fetch(B)), this.#I = I.overrides ?? {}, this.#g = I.useSuffixRequest ?? !1;
|
|
3251
3358
|
}
|
|
3252
3359
|
#B(A, I) {
|
|
3253
|
-
return new Request(A,
|
|
3360
|
+
return new Request(A, bQ(this.#I, I));
|
|
3254
3361
|
}
|
|
3255
3362
|
async get(A, I = {}) {
|
|
3256
|
-
let B =
|
|
3257
|
-
return
|
|
3363
|
+
let B = BB(this.url, A).href, C = this.#B(B, I), Q = await this.#A(C);
|
|
3364
|
+
return CB(Q);
|
|
3258
3365
|
}
|
|
3259
3366
|
async getRange(A, I, B = {}) {
|
|
3260
|
-
let C =
|
|
3367
|
+
let C = BB(this.url, A), Q;
|
|
3261
3368
|
if ("suffixLength" in I)
|
|
3262
3369
|
Q = await this.#C(C, I.suffixLength, B);
|
|
3263
3370
|
else {
|
|
@@ -3270,7 +3377,7 @@ class _A {
|
|
|
3270
3377
|
}, i = this.#B(C, E);
|
|
3271
3378
|
Q = await this.#A(i);
|
|
3272
3379
|
}
|
|
3273
|
-
return
|
|
3380
|
+
return CB(Q);
|
|
3274
3381
|
}
|
|
3275
3382
|
async #C(A, I, B) {
|
|
3276
3383
|
if (this.#g) {
|
|
@@ -3296,9 +3403,9 @@ class _A {
|
|
|
3296
3403
|
return this.#A(this.#B(A, a));
|
|
3297
3404
|
}
|
|
3298
3405
|
}
|
|
3299
|
-
class
|
|
3406
|
+
class _A extends Error {
|
|
3300
3407
|
}
|
|
3301
|
-
class
|
|
3408
|
+
class uA extends _A {
|
|
3302
3409
|
_tag = "NotFoundError";
|
|
3303
3410
|
name = "NotFoundError";
|
|
3304
3411
|
path;
|
|
@@ -3307,7 +3414,7 @@ class TA extends $A {
|
|
|
3307
3414
|
super(`Not found: ${A}`, { cause: I.cause }), this.path = I.path, this.found = I.found;
|
|
3308
3415
|
}
|
|
3309
3416
|
}
|
|
3310
|
-
class v extends
|
|
3417
|
+
class v extends _A {
|
|
3311
3418
|
_tag = "InvalidMetadataError";
|
|
3312
3419
|
name = "InvalidMetadataError";
|
|
3313
3420
|
path;
|
|
@@ -3315,7 +3422,7 @@ class v extends $A {
|
|
|
3315
3422
|
super(A, { cause: I.cause }), this.path = I.path;
|
|
3316
3423
|
}
|
|
3317
3424
|
}
|
|
3318
|
-
class
|
|
3425
|
+
class ZQ extends _A {
|
|
3319
3426
|
_tag = "UnknownCodecError";
|
|
3320
3427
|
name = "UnknownCodecError";
|
|
3321
3428
|
codec;
|
|
@@ -3323,7 +3430,7 @@ class bQ extends $A {
|
|
|
3323
3430
|
super(`Unknown codec: ${A}`), this.codec = A;
|
|
3324
3431
|
}
|
|
3325
3432
|
}
|
|
3326
|
-
class
|
|
3433
|
+
class PQ extends _A {
|
|
3327
3434
|
_tag = "CodecPipelineError";
|
|
3328
3435
|
name = "CodecPipelineError";
|
|
3329
3436
|
direction;
|
|
@@ -3338,7 +3445,7 @@ class ZQ extends $A {
|
|
|
3338
3445
|
super(I.join(" "), { cause: A.cause }), this.direction = A.direction, this.codec = A.codec, this.chunkPath = A.chunkPath;
|
|
3339
3446
|
}
|
|
3340
3447
|
}
|
|
3341
|
-
class Rg extends
|
|
3448
|
+
class Rg extends _A {
|
|
3342
3449
|
_tag = "UnsupportedError";
|
|
3343
3450
|
name = "UnsupportedError";
|
|
3344
3451
|
feature;
|
|
@@ -3351,14 +3458,14 @@ function UA(g) {
|
|
|
3351
3458
|
throw new Rg(`${g} encode`);
|
|
3352
3459
|
};
|
|
3353
3460
|
}
|
|
3354
|
-
class
|
|
3461
|
+
class eI {
|
|
3355
3462
|
kind = "array_to_array";
|
|
3356
3463
|
constructor(A, I) {
|
|
3357
3464
|
if (A.keepbits < 0)
|
|
3358
3465
|
throw new v("keepbits must be zero or positive");
|
|
3359
3466
|
}
|
|
3360
3467
|
static fromConfig(A, I) {
|
|
3361
|
-
return new
|
|
3468
|
+
return new eI(A, I);
|
|
3362
3469
|
}
|
|
3363
3470
|
encode = UA("bitround");
|
|
3364
3471
|
/**
|
|
@@ -3373,7 +3480,7 @@ class yI {
|
|
|
3373
3480
|
function Ng(g) {
|
|
3374
3481
|
return g instanceof ArrayBuffer || g instanceof SharedArrayBuffer;
|
|
3375
3482
|
}
|
|
3376
|
-
class
|
|
3483
|
+
class AC {
|
|
3377
3484
|
#A;
|
|
3378
3485
|
constructor(A, I, B) {
|
|
3379
3486
|
typeof A == "number" ? this.#A = new Uint8Array(A) : Ng(A) ? this.#A = new Uint8Array(A, I, B) : this.#A = new Uint8Array(Array.from(A, (C) => C ? 1 : 0));
|
|
@@ -3457,7 +3564,7 @@ class cg {
|
|
|
3457
3564
|
yield this.get(A);
|
|
3458
3565
|
}
|
|
3459
3566
|
}
|
|
3460
|
-
class
|
|
3567
|
+
class $A {
|
|
3461
3568
|
#A;
|
|
3462
3569
|
chars;
|
|
3463
3570
|
constructor(A, I, B, C) {
|
|
@@ -3466,7 +3573,7 @@ class AI {
|
|
|
3466
3573
|
else if (Ng(I))
|
|
3467
3574
|
C && (C *= A), this.#A = new Int32Array(I, B, C);
|
|
3468
3575
|
else {
|
|
3469
|
-
const Q = I, E = new
|
|
3576
|
+
const Q = I, E = new $A(A, 1);
|
|
3470
3577
|
this.#A = new Int32Array((function* () {
|
|
3471
3578
|
for (let i of Q)
|
|
3472
3579
|
E.set(0, i), yield* E.#A;
|
|
@@ -3512,14 +3619,14 @@ class AI {
|
|
|
3512
3619
|
yield this.get(A);
|
|
3513
3620
|
}
|
|
3514
3621
|
}
|
|
3515
|
-
function
|
|
3622
|
+
function OQ() {
|
|
3516
3623
|
if (typeof SharedArrayBuffer > "u")
|
|
3517
3624
|
throw new Error("SharedArrayBuffer is not available. In browsers, this requires Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy headers to be set.");
|
|
3518
3625
|
}
|
|
3519
|
-
function
|
|
3626
|
+
function VQ(g, A) {
|
|
3520
3627
|
return new SharedArrayBuffer(g);
|
|
3521
3628
|
}
|
|
3522
|
-
function
|
|
3629
|
+
function AI(g) {
|
|
3523
3630
|
const A = new TextDecoder().decode(g);
|
|
3524
3631
|
try {
|
|
3525
3632
|
return JSON.parse(A);
|
|
@@ -3527,20 +3634,20 @@ function II(g) {
|
|
|
3527
3634
|
throw new v("Failed to decode JSON", { cause: I });
|
|
3528
3635
|
}
|
|
3529
3636
|
}
|
|
3530
|
-
function
|
|
3637
|
+
function QB(g, A) {
|
|
3531
3638
|
const I = A / 2, B = A - 1;
|
|
3532
3639
|
let C = 0;
|
|
3533
3640
|
for (let Q = 0; Q < g.length; Q += A)
|
|
3534
3641
|
for (let E = 0; E < I; E += 1)
|
|
3535
3642
|
C = g[Q + E], g[Q + E] = g[Q + B - E], g[Q + B - E] = C;
|
|
3536
3643
|
}
|
|
3537
|
-
function
|
|
3644
|
+
function TA(g) {
|
|
3538
3645
|
if (g === "v2:object")
|
|
3539
3646
|
return globalThis.Array;
|
|
3540
3647
|
let A = g.match(/v2:([US])(\d+)/);
|
|
3541
3648
|
if (A) {
|
|
3542
3649
|
let [, B, C] = A;
|
|
3543
|
-
return (B === "U" ?
|
|
3650
|
+
return (B === "U" ? $A : cg).bind(null, Number(C));
|
|
3544
3651
|
}
|
|
3545
3652
|
if (g === "string")
|
|
3546
3653
|
return globalThis.Array;
|
|
@@ -3556,7 +3663,7 @@ function xA(g) {
|
|
|
3556
3663
|
float16: globalThis.Float16Array,
|
|
3557
3664
|
float32: Float32Array,
|
|
3558
3665
|
float64: Float64Array,
|
|
3559
|
-
bool:
|
|
3666
|
+
bool: AC
|
|
3560
3667
|
}[g];
|
|
3561
3668
|
if (!I)
|
|
3562
3669
|
throw new v(`Unknown or unsupported dataType: ${g}`);
|
|
@@ -3570,7 +3677,7 @@ function RA(g, A) {
|
|
|
3570
3677
|
C[A[Q]] = B, B *= g[A[Q]];
|
|
3571
3678
|
return C;
|
|
3572
3679
|
}
|
|
3573
|
-
function
|
|
3680
|
+
function vQ({ name: g, configuration: A }) {
|
|
3574
3681
|
if (g === "default") {
|
|
3575
3682
|
const I = A?.separator ?? "/";
|
|
3576
3683
|
return (B) => ["c", ...B].join(I);
|
|
@@ -3581,7 +3688,7 @@ function VQ({ name: g, configuration: A }) {
|
|
|
3581
3688
|
}
|
|
3582
3689
|
throw new v(`Unknown chunk key encoding: ${g}`);
|
|
3583
3690
|
}
|
|
3584
|
-
function
|
|
3691
|
+
function EB(g) {
|
|
3585
3692
|
if (g === "|O")
|
|
3586
3693
|
return { dataType: "v2:object" };
|
|
3587
3694
|
let A = g.match(/^([<|>])(.*)$/);
|
|
@@ -3605,15 +3712,15 @@ function iB(g) {
|
|
|
3605
3712
|
throw new v(`Unsupported or unknown dtype: ${g}`);
|
|
3606
3713
|
return I === "|" ? { dataType: C } : { dataType: C, endian: I === "<" ? "little" : "big" };
|
|
3607
3714
|
}
|
|
3608
|
-
function
|
|
3715
|
+
function XQ(g) {
|
|
3609
3716
|
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");
|
|
3610
3717
|
}
|
|
3611
|
-
function
|
|
3612
|
-
let I = [], B =
|
|
3718
|
+
function jQ(g, A = {}) {
|
|
3719
|
+
let I = [], B = EB(g.dtype);
|
|
3613
3720
|
g.order === "F" && I.push({ name: "transpose", configuration: { order: "F" } });
|
|
3614
3721
|
for (let Q of g.filters ?? []) {
|
|
3615
3722
|
if (Q.id === "fixedscaleoffset" || Q.id === "numcodecs.fixedscaleoffset") {
|
|
3616
|
-
if (!
|
|
3723
|
+
if (!XQ(Q))
|
|
3617
3724
|
throw new v(`Invalid fixedscaleoffset filter: ${JSON.stringify(Q)}`);
|
|
3618
3725
|
I.push({
|
|
3619
3726
|
name: "scale_offset",
|
|
@@ -3624,7 +3731,7 @@ function XQ(g, A = {}) {
|
|
|
3624
3731
|
});
|
|
3625
3732
|
let o = Q.astype ?? Q.dtype;
|
|
3626
3733
|
if (o !== void 0 && o !== g.dtype) {
|
|
3627
|
-
let a =
|
|
3734
|
+
let a = EB(o).dataType;
|
|
3628
3735
|
if (!gg(a, "number") && !gg(a, "bigint"))
|
|
3629
3736
|
throw new v(`fixedscaleoffset astype must be a numeric data type, got ${o}`);
|
|
3630
3737
|
I.push({
|
|
@@ -3671,7 +3778,7 @@ function XQ(g, A = {}) {
|
|
|
3671
3778
|
attributes: A
|
|
3672
3779
|
};
|
|
3673
3780
|
}
|
|
3674
|
-
function
|
|
3781
|
+
function zQ(g, A = {}) {
|
|
3675
3782
|
return {
|
|
3676
3783
|
zarr_format: 3,
|
|
3677
3784
|
node_type: "group",
|
|
@@ -3693,10 +3800,10 @@ function gg(g, A) {
|
|
|
3693
3800
|
let Q = g === "v2:object";
|
|
3694
3801
|
return A === "object" ? Q : !B && !C && !I && !Q;
|
|
3695
3802
|
}
|
|
3696
|
-
function
|
|
3803
|
+
function _Q(g) {
|
|
3697
3804
|
return g?.name === "sharding_indexed";
|
|
3698
3805
|
}
|
|
3699
|
-
function
|
|
3806
|
+
function IC(g) {
|
|
3700
3807
|
if ((g.data_type === "uint64" || g.data_type === "int64") && g.fill_value != null)
|
|
3701
3808
|
return BigInt(g.fill_value);
|
|
3702
3809
|
let A = g.data_type === "float16" || g.data_type === "float32" || g.data_type === "float64";
|
|
@@ -3711,7 +3818,7 @@ function gC(g) {
|
|
|
3711
3818
|
}
|
|
3712
3819
|
return g.fill_value;
|
|
3713
3820
|
}
|
|
3714
|
-
function
|
|
3821
|
+
function gC(g, ...A) {
|
|
3715
3822
|
if (!A.some((I) => g instanceof I))
|
|
3716
3823
|
throw g;
|
|
3717
3824
|
}
|
|
@@ -3719,7 +3826,7 @@ function IA(g, A = "") {
|
|
|
3719
3826
|
if (!g)
|
|
3720
3827
|
throw new Error(A);
|
|
3721
3828
|
}
|
|
3722
|
-
async function
|
|
3829
|
+
async function BC(g, { format: A, signal: I }) {
|
|
3723
3830
|
let B;
|
|
3724
3831
|
if (g instanceof ArrayBuffer)
|
|
3725
3832
|
B = new Response(g);
|
|
@@ -3734,12 +3841,12 @@ async function CC(g, { format: A, signal: I }) {
|
|
|
3734
3841
|
throw I?.throwIfAborted(), new Error(`Failed to decode ${A}`);
|
|
3735
3842
|
}
|
|
3736
3843
|
}
|
|
3737
|
-
const
|
|
3738
|
-
function
|
|
3844
|
+
const iB = $Q();
|
|
3845
|
+
function $Q() {
|
|
3739
3846
|
const g = new Uint32Array([305419896]);
|
|
3740
3847
|
return new Uint8Array(g.buffer, g.byteOffset, g.byteLength)[0] !== 18;
|
|
3741
3848
|
}
|
|
3742
|
-
function
|
|
3849
|
+
function oB(g) {
|
|
3743
3850
|
return "BYTES_PER_ELEMENT" in g ? g.BYTES_PER_ELEMENT : 4;
|
|
3744
3851
|
}
|
|
3745
3852
|
class KI {
|
|
@@ -3750,7 +3857,7 @@ class KI {
|
|
|
3750
3857
|
#B;
|
|
3751
3858
|
#C;
|
|
3752
3859
|
constructor(A, I) {
|
|
3753
|
-
this.#C = A?.endian, this.#I =
|
|
3860
|
+
this.#C = A?.endian, this.#I = TA(I.dataType), this.#B = I.shape, this.#A = RA(I.shape, "C");
|
|
3754
3861
|
const B = new this.#I(0);
|
|
3755
3862
|
this.#g = B.BYTES_PER_ELEMENT;
|
|
3756
3863
|
}
|
|
@@ -3759,35 +3866,35 @@ class KI {
|
|
|
3759
3866
|
}
|
|
3760
3867
|
encode(A) {
|
|
3761
3868
|
let I = new Uint8Array(A.data.buffer);
|
|
3762
|
-
return
|
|
3869
|
+
return iB && this.#C === "big" && QB(I, oB(this.#I)), I;
|
|
3763
3870
|
}
|
|
3764
3871
|
computeEncodedSize(A) {
|
|
3765
3872
|
return A;
|
|
3766
3873
|
}
|
|
3767
3874
|
decode(A) {
|
|
3768
|
-
return
|
|
3875
|
+
return iB && this.#C === "big" && QB(A, oB(this.#I)), {
|
|
3769
3876
|
data: new this.#I(A.buffer, A.byteOffset, A.byteLength / this.#g),
|
|
3770
3877
|
shape: this.#B,
|
|
3771
3878
|
stride: this.#A
|
|
3772
3879
|
};
|
|
3773
3880
|
}
|
|
3774
3881
|
}
|
|
3775
|
-
const
|
|
3882
|
+
const aB = {
|
|
3776
3883
|
NaN: NaN,
|
|
3777
3884
|
Infinity: 1 / 0,
|
|
3778
3885
|
"-Infinity": -1 / 0
|
|
3779
|
-
},
|
|
3886
|
+
}, CC = {
|
|
3780
3887
|
float16: 2,
|
|
3781
3888
|
float32: 4,
|
|
3782
3889
|
float64: 8
|
|
3783
3890
|
};
|
|
3784
|
-
function
|
|
3785
|
-
return g in
|
|
3891
|
+
function nI(g) {
|
|
3892
|
+
return g in CC;
|
|
3786
3893
|
}
|
|
3787
3894
|
function Bg(g) {
|
|
3788
3895
|
return g === "int64" || g === "uint64";
|
|
3789
3896
|
}
|
|
3790
|
-
function
|
|
3897
|
+
function AE(g, A) {
|
|
3791
3898
|
const I = BigInt(g), B = new ArrayBuffer(A), C = new DataView(B);
|
|
3792
3899
|
if (A === 2) {
|
|
3793
3900
|
if (typeof C.getFloat16 != "function")
|
|
@@ -3796,22 +3903,22 @@ function $Q(g, A) {
|
|
|
3796
3903
|
}
|
|
3797
3904
|
return A === 4 ? (C.setUint32(0, Number(I)), C.getFloat32(0)) : (C.setBigUint64(0, I), C.getFloat64(0));
|
|
3798
3905
|
}
|
|
3799
|
-
function
|
|
3906
|
+
function GI(g, A) {
|
|
3800
3907
|
if (Bg(g)) {
|
|
3801
3908
|
if (typeof A != "number" || !Number.isInteger(A))
|
|
3802
3909
|
throw new v(`Expected an integer value for data type "${g}", got ${JSON.stringify(A)}`);
|
|
3803
3910
|
return BigInt(A);
|
|
3804
3911
|
}
|
|
3805
3912
|
if (typeof A == "number") {
|
|
3806
|
-
if (!
|
|
3913
|
+
if (!nI(g) && !Number.isInteger(A))
|
|
3807
3914
|
throw new v(`Expected an integer value for data type "${g}", got ${A}`);
|
|
3808
3915
|
return A;
|
|
3809
3916
|
}
|
|
3810
|
-
if (!
|
|
3917
|
+
if (!nI(g))
|
|
3811
3918
|
throw new v(`String-encoded scalar "${A}" is not valid for non-float data type "${g}"`);
|
|
3812
|
-
return A in
|
|
3919
|
+
return A in aB ? aB[A] : AE(A, CC[g]);
|
|
3813
3920
|
}
|
|
3814
|
-
const
|
|
3921
|
+
const sB = /* @__PURE__ */ new Set([
|
|
3815
3922
|
"int8",
|
|
3816
3923
|
"uint8",
|
|
3817
3924
|
"int16",
|
|
@@ -3834,13 +3941,13 @@ const DB = /* @__PURE__ */ new Set([
|
|
|
3834
3941
|
int64: [-(2n ** 63n), 2n ** 63n - 1n],
|
|
3835
3942
|
uint64: [0n, 2n ** 64n - 1n]
|
|
3836
3943
|
};
|
|
3837
|
-
function
|
|
3944
|
+
function DB(g, A, I) {
|
|
3838
3945
|
return g.map(([B, C]) => ({
|
|
3839
|
-
src:
|
|
3840
|
-
tgt:
|
|
3946
|
+
src: GI(A, B),
|
|
3947
|
+
tgt: GI(I, C)
|
|
3841
3948
|
}));
|
|
3842
3949
|
}
|
|
3843
|
-
function
|
|
3950
|
+
function IE(g, A) {
|
|
3844
3951
|
for (const I of A)
|
|
3845
3952
|
if (typeof I.src == "number" && Number.isNaN(I.src)) {
|
|
3846
3953
|
if (typeof g == "number" && Number.isNaN(g))
|
|
@@ -3848,7 +3955,7 @@ function AE(g, A) {
|
|
|
3848
3955
|
} else if (g === I.src)
|
|
3849
3956
|
return I.tgt;
|
|
3850
3957
|
}
|
|
3851
|
-
function
|
|
3958
|
+
function gE(g) {
|
|
3852
3959
|
if (!Number.isFinite(g))
|
|
3853
3960
|
return g;
|
|
3854
3961
|
if (Math.abs(g - Math.trunc(g)) === 0.5) {
|
|
@@ -3857,13 +3964,13 @@ function IE(g) {
|
|
|
3857
3964
|
}
|
|
3858
3965
|
return Math.round(g);
|
|
3859
3966
|
}
|
|
3860
|
-
function
|
|
3967
|
+
function BE(g) {
|
|
3861
3968
|
return Math.sign(g) * Math.floor(Math.abs(g) + 0.5);
|
|
3862
3969
|
}
|
|
3863
|
-
function
|
|
3970
|
+
function hB(g) {
|
|
3864
3971
|
switch (g) {
|
|
3865
3972
|
case "nearest-even":
|
|
3866
|
-
return
|
|
3973
|
+
return gE;
|
|
3867
3974
|
case "towards-zero":
|
|
3868
3975
|
return Math.trunc;
|
|
3869
3976
|
case "towards-positive":
|
|
@@ -3871,7 +3978,7 @@ function tB(g) {
|
|
|
3871
3978
|
case "towards-negative":
|
|
3872
3979
|
return Math.floor;
|
|
3873
3980
|
case "nearest-away":
|
|
3874
|
-
return
|
|
3981
|
+
return BE;
|
|
3875
3982
|
}
|
|
3876
3983
|
}
|
|
3877
3984
|
function bI(g, A, I) {
|
|
@@ -3911,7 +4018,7 @@ class Ug {
|
|
|
3911
4018
|
#g;
|
|
3912
4019
|
#B;
|
|
3913
4020
|
constructor(A, I, B, C, Q, E) {
|
|
3914
|
-
this.#A = I, this.#I =
|
|
4021
|
+
this.#A = I, this.#I = TA(A), this.#g = tB(I, A, B, C, Q), this.#B = tB(A, I, B, C, E);
|
|
3915
4022
|
}
|
|
3916
4023
|
/** Return updated metadata reflecting the type and fill value after encoding. */
|
|
3917
4024
|
getEncodedMeta(A) {
|
|
@@ -3920,11 +4027,11 @@ class Ug {
|
|
|
3920
4027
|
}
|
|
3921
4028
|
static fromConfig(A, I) {
|
|
3922
4029
|
const B = I.dataType, C = A.data_type;
|
|
3923
|
-
if (!
|
|
4030
|
+
if (!sB.has(B))
|
|
3924
4031
|
throw new v(`cast_value codec does not support array data type: ${B}`);
|
|
3925
|
-
if (!
|
|
4032
|
+
if (!sB.has(C))
|
|
3926
4033
|
throw new v(`cast_value codec does not support encoded data type: ${C}`);
|
|
3927
|
-
const Q = A.rounding ?? "nearest-even", E = A.scalar_map?.decode ?
|
|
4034
|
+
const Q = A.rounding ?? "nearest-even", E = A.scalar_map?.decode ? DB(A.scalar_map.decode, C, B) : [], i = A.scalar_map?.encode ? DB(A.scalar_map.encode, B, C) : [];
|
|
3928
4035
|
return new Ug(B, C, Q, A.out_of_range, E, i);
|
|
3929
4036
|
}
|
|
3930
4037
|
encode = UA("cast_value");
|
|
@@ -3935,22 +4042,22 @@ class Ug {
|
|
|
3935
4042
|
return { data: B, shape: A.shape, stride: A.stride };
|
|
3936
4043
|
}
|
|
3937
4044
|
}
|
|
3938
|
-
function
|
|
3939
|
-
const Q =
|
|
4045
|
+
function tB(g, A, I, B, C) {
|
|
4046
|
+
const Q = nI(g), E = Bg(g), i = nI(A), o = Bg(A);
|
|
3940
4047
|
let a;
|
|
3941
4048
|
if (Q && i) {
|
|
3942
4049
|
if (I !== "nearest-even")
|
|
3943
4050
|
throw new v(`cast_value float -> float only supports "nearest-even" rounding, got "${I}"`);
|
|
3944
4051
|
a = (D) => D;
|
|
3945
4052
|
} else if (Q && !i && !o) {
|
|
3946
|
-
const D =
|
|
4053
|
+
const D = hB(I), h = bI(...xI[A], B);
|
|
3947
4054
|
a = (t) => {
|
|
3948
4055
|
if (!Number.isFinite(t))
|
|
3949
4056
|
throw new Error(`Cannot cast ${t} to integer type without scalar_map`);
|
|
3950
4057
|
return h(D(t));
|
|
3951
4058
|
};
|
|
3952
4059
|
} else if (Q && o) {
|
|
3953
|
-
const D =
|
|
4060
|
+
const D = hB(I), h = ZI(...WI[A], B);
|
|
3954
4061
|
a = (t) => {
|
|
3955
4062
|
if (!Number.isFinite(t))
|
|
3956
4063
|
throw new Error(`Cannot cast ${t} to integer type without scalar_map`);
|
|
@@ -3973,7 +4080,7 @@ function yB(g, A, I, B, C) {
|
|
|
3973
4080
|
else
|
|
3974
4081
|
throw new Error(`Unhandled type combination: ${g} -> ${A}`);
|
|
3975
4082
|
return C.length === 0 ? a : (D) => {
|
|
3976
|
-
const h =
|
|
4083
|
+
const h = IE(D, C);
|
|
3977
4084
|
return h !== void 0 ? h : a(D);
|
|
3978
4085
|
};
|
|
3979
4086
|
}
|
|
@@ -3990,7 +4097,7 @@ class kg {
|
|
|
3990
4097
|
return A + 4;
|
|
3991
4098
|
}
|
|
3992
4099
|
}
|
|
3993
|
-
const
|
|
4100
|
+
const CE = /* @__PURE__ */ new Set([
|
|
3994
4101
|
"int8",
|
|
3995
4102
|
"uint8",
|
|
3996
4103
|
"int16",
|
|
@@ -4003,7 +4110,7 @@ const BE = /* @__PURE__ */ new Set([
|
|
|
4003
4110
|
"float32",
|
|
4004
4111
|
"float64"
|
|
4005
4112
|
]);
|
|
4006
|
-
function
|
|
4113
|
+
function yB(g, A) {
|
|
4007
4114
|
const I = g.length;
|
|
4008
4115
|
let B = I === 0 || A[I - 1] === 1;
|
|
4009
4116
|
for (let Q = I - 2; Q >= 0 && B; Q--)
|
|
@@ -4023,12 +4130,12 @@ class Lg {
|
|
|
4023
4130
|
this.#A = A;
|
|
4024
4131
|
}
|
|
4025
4132
|
static fromConfig(A, I) {
|
|
4026
|
-
if (!
|
|
4133
|
+
if (!CE.has(I.dataType))
|
|
4027
4134
|
throw new v(`Delta codec does not support data type: ${I.dataType}`);
|
|
4028
|
-
return new Lg(
|
|
4135
|
+
return new Lg(TA(I.dataType));
|
|
4029
4136
|
}
|
|
4030
4137
|
encode(A) {
|
|
4031
|
-
|
|
4138
|
+
yB(A.shape, A.stride);
|
|
4032
4139
|
const I = A.data, B = new this.#A(I.length);
|
|
4033
4140
|
B[0] = I[0];
|
|
4034
4141
|
for (let C = 1; C < I.length; C++)
|
|
@@ -4036,7 +4143,7 @@ class Lg {
|
|
|
4036
4143
|
return { data: B, shape: A.shape, stride: A.stride };
|
|
4037
4144
|
}
|
|
4038
4145
|
decode(A) {
|
|
4039
|
-
|
|
4146
|
+
yB(A.shape, A.stride);
|
|
4040
4147
|
const I = A.data, B = new this.#A(I.length);
|
|
4041
4148
|
B[0] = I[0];
|
|
4042
4149
|
for (let C = 1; C < I.length; C++)
|
|
@@ -4051,17 +4158,17 @@ class Jg {
|
|
|
4051
4158
|
}
|
|
4052
4159
|
encode = UA("gzip");
|
|
4053
4160
|
async decode(A) {
|
|
4054
|
-
const I = await
|
|
4161
|
+
const I = await BC(A, { format: "gzip" });
|
|
4055
4162
|
return new Uint8Array(I);
|
|
4056
4163
|
}
|
|
4057
4164
|
}
|
|
4058
|
-
function
|
|
4165
|
+
function QE(g, A) {
|
|
4059
4166
|
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;
|
|
4060
4167
|
}
|
|
4061
|
-
function
|
|
4168
|
+
function EE(g, A) {
|
|
4062
4169
|
return A instanceof Object && !Array.isArray(A) ? Object.keys(A).sort().reduce((I, B) => (I[B] = A[B], I), {}) : A;
|
|
4063
4170
|
}
|
|
4064
|
-
class
|
|
4171
|
+
class wI {
|
|
4065
4172
|
configuration;
|
|
4066
4173
|
kind = "array_to_bytes";
|
|
4067
4174
|
#A;
|
|
@@ -4082,13 +4189,13 @@ class GI {
|
|
|
4082
4189
|
}, this.#I = { strict: a };
|
|
4083
4190
|
}
|
|
4084
4191
|
static fromConfig(A) {
|
|
4085
|
-
return new
|
|
4192
|
+
return new wI(A);
|
|
4086
4193
|
}
|
|
4087
4194
|
encode(A) {
|
|
4088
4195
|
const { indent: I, encoding: B, ensure_ascii: C, check_circular: Q, allow_nan: E, sort_keys: i } = this.#A;
|
|
4089
4196
|
IA(B === "utf-8", "JsonCodec does not yet support non-utf-8 encoding.");
|
|
4090
4197
|
const o = [];
|
|
4091
|
-
IA(Q, "JsonCodec does not yet support skipping the check for circular references during encoding."), E || o.push(
|
|
4198
|
+
IA(Q, "JsonCodec does not yet support skipping the check for circular references during encoding."), E || o.push(QE), i && o.push(EE);
|
|
4092
4199
|
const a = Array.from(A.data);
|
|
4093
4200
|
a.push("|O"), a.push(A.shape);
|
|
4094
4201
|
let s;
|
|
@@ -4107,13 +4214,13 @@ class GI {
|
|
|
4107
4214
|
decode(A) {
|
|
4108
4215
|
const { strict: I } = this.#I;
|
|
4109
4216
|
IA(I, "JsonCodec does not yet support non-strict decoding.");
|
|
4110
|
-
const B =
|
|
4217
|
+
const B = AI(A), C = B.pop();
|
|
4111
4218
|
B.pop(), IA(C, "0D not implemented for JsonCodec.");
|
|
4112
4219
|
const Q = RA(C, "C");
|
|
4113
4220
|
return { data: B, shape: C, stride: Q };
|
|
4114
4221
|
}
|
|
4115
4222
|
}
|
|
4116
|
-
const
|
|
4223
|
+
const iE = /* @__PURE__ */ new Set([
|
|
4117
4224
|
"int8",
|
|
4118
4225
|
"uint8",
|
|
4119
4226
|
"int16",
|
|
@@ -4135,9 +4242,9 @@ class Yg {
|
|
|
4135
4242
|
this.#I = A, this.#g = I, this.#A = B;
|
|
4136
4243
|
}
|
|
4137
4244
|
static fromConfig(A, I) {
|
|
4138
|
-
if (!
|
|
4245
|
+
if (!iE.has(I.dataType))
|
|
4139
4246
|
throw new v(`scale_offset codec does not support data type: ${I.dataType}`);
|
|
4140
|
-
return new Yg(
|
|
4247
|
+
return new Yg(GI(I.dataType, A.scale ?? 1), GI(I.dataType, A.offset ?? 0), TA(I.dataType));
|
|
4141
4248
|
}
|
|
4142
4249
|
encode = UA("scale_offset");
|
|
4143
4250
|
decode(A) {
|
|
@@ -4152,7 +4259,7 @@ class Mg {
|
|
|
4152
4259
|
#A;
|
|
4153
4260
|
constructor(A, I) {
|
|
4154
4261
|
if (I) {
|
|
4155
|
-
let B = new (
|
|
4262
|
+
let B = new (TA(I.dataType))(0);
|
|
4156
4263
|
IA("BYTES_PER_ELEMENT" in B, `Shuffle codec requires a fixed-size dtype, got "${I.dataType}"`), this.#A = B.BYTES_PER_ELEMENT;
|
|
4157
4264
|
} else
|
|
4158
4265
|
this.#A = A.elementsize ?? 4;
|
|
@@ -4161,28 +4268,28 @@ class Mg {
|
|
|
4161
4268
|
return new Mg(A, I);
|
|
4162
4269
|
}
|
|
4163
4270
|
encode(A) {
|
|
4164
|
-
return
|
|
4271
|
+
return oE(A, this.#A);
|
|
4165
4272
|
}
|
|
4166
4273
|
decode(A) {
|
|
4167
|
-
return
|
|
4274
|
+
return aE(A, this.#A);
|
|
4168
4275
|
}
|
|
4169
4276
|
}
|
|
4170
|
-
function
|
|
4277
|
+
function oE(g, A) {
|
|
4171
4278
|
let I = g.length, B = Math.floor(I / A), C = new Uint8Array(I);
|
|
4172
4279
|
for (let Q = 0; Q < A; Q++)
|
|
4173
4280
|
for (let E = 0; E < B; E++)
|
|
4174
4281
|
C[Q * B + E] = g[E * A + Q];
|
|
4175
4282
|
return C;
|
|
4176
4283
|
}
|
|
4177
|
-
function
|
|
4284
|
+
function aE(g, A) {
|
|
4178
4285
|
let I = g.length, B = Math.floor(I / A), C = new Uint8Array(I);
|
|
4179
4286
|
for (let Q = 0; Q < A; Q++)
|
|
4180
4287
|
for (let E = 0; E < B; E++)
|
|
4181
4288
|
C[E * A + Q] = g[Q * B + E];
|
|
4182
4289
|
return C;
|
|
4183
4290
|
}
|
|
4184
|
-
function
|
|
4185
|
-
return g instanceof
|
|
4291
|
+
function eB(g) {
|
|
4292
|
+
return g instanceof AC || g instanceof cg || g instanceof $A ? new Proxy(g, {
|
|
4186
4293
|
get(I, B) {
|
|
4187
4294
|
return I.get(Number(B));
|
|
4188
4295
|
},
|
|
@@ -4191,9 +4298,9 @@ function nB(g) {
|
|
|
4191
4298
|
}
|
|
4192
4299
|
}) : g;
|
|
4193
4300
|
}
|
|
4194
|
-
function
|
|
4301
|
+
function sE(g, A) {
|
|
4195
4302
|
let I;
|
|
4196
|
-
return g.data instanceof cg || g.data instanceof
|
|
4303
|
+
return g.data instanceof cg || g.data instanceof $A ? I = new g.constructor(
|
|
4197
4304
|
// @ts-expect-error
|
|
4198
4305
|
g.data.length,
|
|
4199
4306
|
g.data.chars
|
|
@@ -4203,8 +4310,8 @@ function aE(g, A) {
|
|
|
4203
4310
|
stride: RA(g.shape, A)
|
|
4204
4311
|
};
|
|
4205
4312
|
}
|
|
4206
|
-
function
|
|
4207
|
-
let I =
|
|
4313
|
+
function DE(g, A) {
|
|
4314
|
+
let I = sE(g, A), B = g.shape.length, C = g.data.length, Q = Array(B).fill(0), E = eB(g.data), i = eB(I.data);
|
|
4208
4315
|
for (let o = 0; o < C; o++) {
|
|
4209
4316
|
let a = 0;
|
|
4210
4317
|
for (let s = 0; s < B; s++)
|
|
@@ -4219,12 +4326,12 @@ function sE(g, A) {
|
|
|
4219
4326
|
}
|
|
4220
4327
|
return I;
|
|
4221
4328
|
}
|
|
4222
|
-
function
|
|
4329
|
+
function hE(g) {
|
|
4223
4330
|
let A = g.shape.length;
|
|
4224
4331
|
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);
|
|
4225
4332
|
}
|
|
4226
|
-
function
|
|
4227
|
-
let I =
|
|
4333
|
+
function tE(g, A) {
|
|
4334
|
+
let I = hE(g);
|
|
4228
4335
|
return IA(I.length === A.length, "Orders must match"), I.every((B, C) => B === A[C]);
|
|
4229
4336
|
}
|
|
4230
4337
|
class dg {
|
|
@@ -4249,7 +4356,7 @@ class dg {
|
|
|
4249
4356
|
return new dg(A, I);
|
|
4250
4357
|
}
|
|
4251
4358
|
encode(A) {
|
|
4252
|
-
return
|
|
4359
|
+
return tE(A, this.#I) ? A : DE(A, this.#I);
|
|
4253
4360
|
}
|
|
4254
4361
|
decode(A) {
|
|
4255
4362
|
return {
|
|
@@ -4259,7 +4366,7 @@ class dg {
|
|
|
4259
4366
|
};
|
|
4260
4367
|
}
|
|
4261
4368
|
}
|
|
4262
|
-
class
|
|
4369
|
+
class FI {
|
|
4263
4370
|
kind = "array_to_bytes";
|
|
4264
4371
|
#A;
|
|
4265
4372
|
#I;
|
|
@@ -4267,7 +4374,7 @@ class wI {
|
|
|
4267
4374
|
this.#A = A, this.#I = RA(A, "C");
|
|
4268
4375
|
}
|
|
4269
4376
|
static fromConfig(A, I) {
|
|
4270
|
-
return new
|
|
4377
|
+
return new FI(I.shape);
|
|
4271
4378
|
}
|
|
4272
4379
|
encode = UA("vlen-utf8");
|
|
4273
4380
|
decode(A) {
|
|
@@ -4286,25 +4393,25 @@ class Kg {
|
|
|
4286
4393
|
}
|
|
4287
4394
|
encode = UA("zlib");
|
|
4288
4395
|
async decode(A) {
|
|
4289
|
-
const I = await
|
|
4396
|
+
const I = await BC(A, { format: "deflate" });
|
|
4290
4397
|
return new Uint8Array(I);
|
|
4291
4398
|
}
|
|
4292
4399
|
}
|
|
4293
|
-
function
|
|
4400
|
+
function yE() {
|
|
4294
4401
|
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 = () => Jg, C = () => Kg;
|
|
4295
|
-
return (/* @__PURE__ */ new Map()).set("blosc", g).set("lz4", A).set("zstd", I).set("gzip", B).set("zlib", C).set("transpose", () => dg).set("bytes", () => KI).set("crc32c", () => kg).set("vlen-utf8", () =>
|
|
4402
|
+
return (/* @__PURE__ */ new Map()).set("blosc", g).set("lz4", A).set("zstd", I).set("gzip", B).set("zlib", C).set("transpose", () => dg).set("bytes", () => KI).set("crc32c", () => kg).set("vlen-utf8", () => FI).set("json2", () => wI).set("bitround", () => eI).set("cast_value", () => Ug).set("scale_offset", () => Yg).set("numcodecs.blosc", g).set("numcodecs.lz4", A).set("numcodecs.zstd", I).set("numcodecs.gzip", B).set("numcodecs.zlib", C).set("numcodecs.vlen-utf8", () => FI).set("numcodecs.shuffle", () => Mg).set("numcodecs.delta", () => Lg).set("numcodecs.bitround", () => eI).set("numcodecs.json2", () => wI);
|
|
4296
4403
|
}
|
|
4297
|
-
const
|
|
4404
|
+
const eE = yE();
|
|
4298
4405
|
function Cg(g) {
|
|
4299
4406
|
let A;
|
|
4300
4407
|
function I() {
|
|
4301
|
-
return A || (A =
|
|
4408
|
+
return A || (A = nE(g)), A;
|
|
4302
4409
|
}
|
|
4303
4410
|
async function B(C, Q, E) {
|
|
4304
4411
|
try {
|
|
4305
4412
|
return await E();
|
|
4306
4413
|
} catch (i) {
|
|
4307
|
-
throw new
|
|
4414
|
+
throw new PQ({ direction: C, codec: Q, cause: i });
|
|
4308
4415
|
}
|
|
4309
4416
|
}
|
|
4310
4417
|
return {
|
|
@@ -4331,23 +4438,23 @@ function Cg(g) {
|
|
|
4331
4438
|
return E;
|
|
4332
4439
|
},
|
|
4333
4440
|
async computeEncodedSize(C) {
|
|
4334
|
-
let Q = await I(), E =
|
|
4441
|
+
let Q = await I(), E = nB(Q.arrayToBytes.name, Q.arrayToBytes.codec, C);
|
|
4335
4442
|
for (const { name: i, codec: o } of Q.bytesToBytes)
|
|
4336
|
-
E =
|
|
4443
|
+
E = nB(i, o, E);
|
|
4337
4444
|
return E;
|
|
4338
4445
|
}
|
|
4339
4446
|
};
|
|
4340
4447
|
}
|
|
4341
|
-
function
|
|
4448
|
+
function nB(g, A, I) {
|
|
4342
4449
|
if (!A.computeEncodedSize)
|
|
4343
4450
|
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`);
|
|
4344
4451
|
return A.computeEncodedSize(I);
|
|
4345
4452
|
}
|
|
4346
|
-
async function
|
|
4453
|
+
async function nE(g) {
|
|
4347
4454
|
let A = g.codecs.map(async (E) => {
|
|
4348
|
-
let i = await
|
|
4455
|
+
let i = await eE.get(E.name)?.();
|
|
4349
4456
|
if (!i)
|
|
4350
|
-
throw new
|
|
4457
|
+
throw new ZQ(E.name);
|
|
4351
4458
|
return { Codec: i, meta: E };
|
|
4352
4459
|
}), I = [], B, C = [], Q = { ...g };
|
|
4353
4460
|
for await (let { Codec: E, meta: i } of A) {
|
|
@@ -4373,7 +4480,7 @@ async function eE(g) {
|
|
|
4373
4480
|
}
|
|
4374
4481
|
}
|
|
4375
4482
|
if (!B) {
|
|
4376
|
-
if (!
|
|
4483
|
+
if (!GE(Q))
|
|
4377
4484
|
throw new v(`Cannot encode ${Q.dataType} to bytes without a codec`);
|
|
4378
4485
|
B = {
|
|
4379
4486
|
name: "bytes",
|
|
@@ -4386,11 +4493,11 @@ async function eE(g) {
|
|
|
4386
4493
|
bytesToBytes: C
|
|
4387
4494
|
};
|
|
4388
4495
|
}
|
|
4389
|
-
function
|
|
4496
|
+
function GE(g) {
|
|
4390
4497
|
return g.dataType !== "v2:object" && g.dataType !== "string";
|
|
4391
4498
|
}
|
|
4392
|
-
const
|
|
4393
|
-
function
|
|
4499
|
+
const GB = 18446744073709551615n;
|
|
4500
|
+
function wE(g, A, I, B) {
|
|
4394
4501
|
if (!g.store.getRange)
|
|
4395
4502
|
throw new Rg("sharding requires a store with getRange");
|
|
4396
4503
|
let C = g.store.getRange.bind(g.store), Q = A.map((a, s) => a / B.chunk_shape[s]), E = Cg({
|
|
@@ -4411,7 +4518,7 @@ function GE(g, A, I, B) {
|
|
|
4411
4518
|
if (t === null)
|
|
4412
4519
|
return;
|
|
4413
4520
|
let { data: y, shape: n, stride: F } = t, G = a.map((S, r) => S % n[r]).reduce((S, r, c) => S + r * F[c], 0), J = y[G], U = y[G + 1];
|
|
4414
|
-
if (!(J ===
|
|
4521
|
+
if (!(J === GB && U === GB))
|
|
4415
4522
|
return C(h, {
|
|
4416
4523
|
offset: Number(J),
|
|
4417
4524
|
length: Number(U)
|
|
@@ -4439,18 +4546,18 @@ class Hg extends CA {
|
|
|
4439
4546
|
return this.#A.attributes;
|
|
4440
4547
|
}
|
|
4441
4548
|
}
|
|
4442
|
-
function
|
|
4549
|
+
function wB(g) {
|
|
4443
4550
|
return g.find((I) => I.name === "transpose")?.configuration?.order ?? "C";
|
|
4444
4551
|
}
|
|
4445
|
-
const
|
|
4446
|
-
function
|
|
4447
|
-
let { configuration: I } = A.codecs.find(
|
|
4448
|
-
encodeChunkKey:
|
|
4449
|
-
TypedArray:
|
|
4552
|
+
const CI = Symbol("zarrita.context");
|
|
4553
|
+
function FE(g, A) {
|
|
4554
|
+
let { configuration: I } = A.codecs.find(_Q) ?? {}, B = {
|
|
4555
|
+
encodeChunkKey: vQ(A.chunk_key_encoding),
|
|
4556
|
+
TypedArray: TA(A.data_type),
|
|
4450
4557
|
fillValue: A.fill_value
|
|
4451
4558
|
};
|
|
4452
4559
|
if (I) {
|
|
4453
|
-
let Q =
|
|
4560
|
+
let Q = wB(I.codecs);
|
|
4454
4561
|
return {
|
|
4455
4562
|
...B,
|
|
4456
4563
|
kind: "sharded",
|
|
@@ -4464,10 +4571,10 @@ function wE(g, A) {
|
|
|
4464
4571
|
getStrides(E) {
|
|
4465
4572
|
return RA(E, Q);
|
|
4466
4573
|
},
|
|
4467
|
-
getChunkBytes:
|
|
4574
|
+
getChunkBytes: wE(g, A.chunk_grid.configuration.chunk_shape, B.encodeChunkKey, I)
|
|
4468
4575
|
};
|
|
4469
4576
|
}
|
|
4470
|
-
let C =
|
|
4577
|
+
let C = wB(A.codecs);
|
|
4471
4578
|
return {
|
|
4472
4579
|
...B,
|
|
4473
4580
|
kind: "regular",
|
|
@@ -4487,15 +4594,15 @@ function wE(g, A) {
|
|
|
4487
4594
|
}
|
|
4488
4595
|
};
|
|
4489
4596
|
}
|
|
4490
|
-
let
|
|
4597
|
+
let rI = class extends CA {
|
|
4491
4598
|
kind = "array";
|
|
4492
4599
|
#A;
|
|
4493
|
-
[
|
|
4600
|
+
[CI];
|
|
4494
4601
|
constructor(A, I, B) {
|
|
4495
4602
|
super(A, I), this.#A = {
|
|
4496
4603
|
...B,
|
|
4497
|
-
fill_value:
|
|
4498
|
-
}, this[
|
|
4604
|
+
fill_value: IC(B)
|
|
4605
|
+
}, this[CI] = FE(this, this.#A);
|
|
4499
4606
|
}
|
|
4500
4607
|
get attrs() {
|
|
4501
4608
|
return this.#A.attributes;
|
|
@@ -4510,14 +4617,14 @@ let FI = class extends CA {
|
|
|
4510
4617
|
return this.#A.shape;
|
|
4511
4618
|
}
|
|
4512
4619
|
get chunks() {
|
|
4513
|
-
return this[
|
|
4620
|
+
return this[CI].chunkShape;
|
|
4514
4621
|
}
|
|
4515
4622
|
get dtype() {
|
|
4516
4623
|
return this.#A.data_type;
|
|
4517
4624
|
}
|
|
4518
4625
|
async getChunk(A, I, B) {
|
|
4519
|
-
B?.useSharedArrayBuffer &&
|
|
4520
|
-
let C = this[
|
|
4626
|
+
B?.useSharedArrayBuffer && OQ();
|
|
4627
|
+
let C = this[CI], Q = await C.getChunkBytes(A, I);
|
|
4521
4628
|
if (!Q) {
|
|
4522
4629
|
let E = C.chunkShape.reduce((o, a) => o * a, 1), i;
|
|
4523
4630
|
if (B?.useSharedArrayBuffer) {
|
|
@@ -4525,7 +4632,7 @@ let FI = class extends CA {
|
|
|
4525
4632
|
if (!("BYTES_PER_ELEMENT" in o))
|
|
4526
4633
|
console.warn("zarrita: useSharedArrayBuffer is not supported for non-buffer-backed data types."), i = new C.TypedArray(E);
|
|
4527
4634
|
else {
|
|
4528
|
-
let a =
|
|
4635
|
+
let a = VQ(E * o.BYTES_PER_ELEMENT);
|
|
4529
4636
|
i = new C.TypedArray(a, 0, E);
|
|
4530
4637
|
}
|
|
4531
4638
|
} else
|
|
@@ -4559,21 +4666,21 @@ let FI = class extends CA {
|
|
|
4559
4666
|
return gg(this.dtype, A);
|
|
4560
4667
|
}
|
|
4561
4668
|
};
|
|
4562
|
-
function
|
|
4669
|
+
function rE(g, A) {
|
|
4563
4670
|
let I = g;
|
|
4564
4671
|
for (let B of A)
|
|
4565
4672
|
I instanceof Promise ? I = I.then((C) => B(C)) : I = B(I);
|
|
4566
4673
|
return I;
|
|
4567
4674
|
}
|
|
4568
|
-
function
|
|
4569
|
-
return
|
|
4675
|
+
function SE(g, ...A) {
|
|
4676
|
+
return rE(g, A);
|
|
4570
4677
|
}
|
|
4571
|
-
async function
|
|
4678
|
+
async function QC(g) {
|
|
4572
4679
|
let A = g.store.arrayExtensions;
|
|
4573
|
-
return A?.length ? await
|
|
4680
|
+
return A?.length ? await SE(g, ...A) : g;
|
|
4574
4681
|
}
|
|
4575
|
-
let HI =
|
|
4576
|
-
function
|
|
4682
|
+
let HI = RE();
|
|
4683
|
+
function RE() {
|
|
4577
4684
|
let g = /* @__PURE__ */ new WeakMap();
|
|
4578
4685
|
function A(I) {
|
|
4579
4686
|
let B = g.get(I) ?? { v2: 0, v3: 0 };
|
|
@@ -4589,52 +4696,52 @@ function SE() {
|
|
|
4589
4696
|
}
|
|
4590
4697
|
};
|
|
4591
4698
|
}
|
|
4592
|
-
async function
|
|
4699
|
+
async function NE(g, A) {
|
|
4593
4700
|
let I = await g.store.get(g.resolve(".zattrs").path, {
|
|
4594
4701
|
signal: A
|
|
4595
4702
|
});
|
|
4596
|
-
return I ?
|
|
4703
|
+
return I ? AI(I) : {};
|
|
4597
4704
|
}
|
|
4598
|
-
async function
|
|
4705
|
+
async function cE(g, A = {}) {
|
|
4599
4706
|
let I = "store" in g ? g : new CA(g), { signal: B } = A, C = {};
|
|
4600
|
-
return (A.attrs ?? !0) && (C = await
|
|
4707
|
+
return (A.attrs ?? !0) && (C = await NE(I, B)), B?.throwIfAborted(), A.kind === "array" ? FB(I, C, B) : A.kind === "group" ? rB(I, C, B) : FB(I, C, B).catch((Q) => (gC(Q, uA, v), rB(I, C, B)));
|
|
4601
4708
|
}
|
|
4602
|
-
async function
|
|
4709
|
+
async function FB(g, A, I) {
|
|
4603
4710
|
let { path: B } = g.resolve(".zarray"), C = await g.store.get(B, { signal: I });
|
|
4604
4711
|
if (!C)
|
|
4605
|
-
throw new
|
|
4606
|
-
return HI.increment(g.store, "v2"),
|
|
4712
|
+
throw new uA("v2 array", { path: B });
|
|
4713
|
+
return HI.increment(g.store, "v2"), QC(new rI(g.store, g.path, jQ(AI(C), A)));
|
|
4607
4714
|
}
|
|
4608
|
-
async function
|
|
4715
|
+
async function rB(g, A, I) {
|
|
4609
4716
|
let { path: B } = g.resolve(".zgroup"), C = await g.store.get(B, { signal: I });
|
|
4610
4717
|
if (!C)
|
|
4611
|
-
throw new
|
|
4612
|
-
return HI.increment(g.store, "v2"), new Hg(g.store, g.path,
|
|
4718
|
+
throw new uA("v2 group", { path: B });
|
|
4719
|
+
return HI.increment(g.store, "v2"), new Hg(g.store, g.path, zQ(AI(C), A));
|
|
4613
4720
|
}
|
|
4614
|
-
async function
|
|
4721
|
+
async function UE(g, A) {
|
|
4615
4722
|
let { store: I, path: B } = g.resolve("zarr.json"), C = await g.store.get(B, { signal: A });
|
|
4616
4723
|
if (!C)
|
|
4617
|
-
throw new
|
|
4618
|
-
let Q =
|
|
4619
|
-
return Q.node_type === "array" && (Q.fill_value =
|
|
4724
|
+
throw new uA("v3 array or group", { path: B });
|
|
4725
|
+
let Q = AI(C);
|
|
4726
|
+
return Q.node_type === "array" && (Q.fill_value = IC(Q)), Q.node_type === "array" ? QC(new rI(I, g.path, Q)) : new Hg(I, g.path, Q);
|
|
4620
4727
|
}
|
|
4621
|
-
async function
|
|
4622
|
-
let I = "store" in g ? g : new CA(g), B = await
|
|
4623
|
-
if (HI.increment(I.store, "v3"), A.kind === void 0 || A.kind === "array" && B instanceof
|
|
4728
|
+
async function kE(g, A = {}) {
|
|
4729
|
+
let I = "store" in g ? g : new CA(g), B = await UE(I, A.signal);
|
|
4730
|
+
if (HI.increment(I.store, "v3"), A.kind === void 0 || A.kind === "array" && B instanceof rI || A.kind === "group" && B instanceof Hg)
|
|
4624
4731
|
return B;
|
|
4625
|
-
let C = B instanceof
|
|
4626
|
-
throw new
|
|
4732
|
+
let C = B instanceof rI ? "array" : "group";
|
|
4733
|
+
throw new uA(`${A.kind} at ${I.path}`, {
|
|
4627
4734
|
path: I.path,
|
|
4628
4735
|
found: C
|
|
4629
4736
|
});
|
|
4630
4737
|
}
|
|
4631
4738
|
async function BA(g, A = {}) {
|
|
4632
4739
|
let I = "store" in g ? g.store : g, B = HI.versionMax(I), C = B === "v2" ? BA.v2 : BA.v3, Q = B === "v2" ? BA.v3 : BA.v2;
|
|
4633
|
-
return C(g, A).catch((E) => (
|
|
4740
|
+
return C(g, A).catch((E) => (gC(E, uA, v), Q(g, A)));
|
|
4634
4741
|
}
|
|
4635
|
-
BA.v2 =
|
|
4636
|
-
BA.v3 =
|
|
4637
|
-
async function
|
|
4742
|
+
BA.v2 = cE;
|
|
4743
|
+
BA.v3 = kE;
|
|
4744
|
+
async function LE(g, A) {
|
|
4638
4745
|
const I = A.split("/"), B = I.pop();
|
|
4639
4746
|
if (!B)
|
|
4640
4747
|
throw new Error("Invalid path");
|
|
@@ -4651,7 +4758,7 @@ class qg {
|
|
|
4651
4758
|
return this.#A;
|
|
4652
4759
|
}
|
|
4653
4760
|
async get(A) {
|
|
4654
|
-
const I = await
|
|
4761
|
+
const I = await LE(this.#A, A.slice(1)).catch(
|
|
4655
4762
|
() => {
|
|
4656
4763
|
}
|
|
4657
4764
|
);
|
|
@@ -4661,7 +4768,7 @@ class qg {
|
|
|
4661
4768
|
return new Uint8Array(C);
|
|
4662
4769
|
}
|
|
4663
4770
|
}
|
|
4664
|
-
async function
|
|
4771
|
+
async function II(g, A) {
|
|
4665
4772
|
if (A === "v2")
|
|
4666
4773
|
try {
|
|
4667
4774
|
return BA.v2(g, { kind: "group", attrs: !0 });
|
|
@@ -4680,7 +4787,7 @@ async function gI(g, A) {
|
|
|
4680
4787
|
throw new Error(`Failed to open Zarr group at ${g}`);
|
|
4681
4788
|
}
|
|
4682
4789
|
}
|
|
4683
|
-
async function
|
|
4790
|
+
async function JE(g, A) {
|
|
4684
4791
|
if (A === "v2")
|
|
4685
4792
|
try {
|
|
4686
4793
|
return BA.v2(g, { kind: "array", attrs: !1 });
|
|
@@ -4699,11 +4806,11 @@ async function LE(g, A) {
|
|
|
4699
4806
|
throw new Error(`Failed to open Zarr array at ${g}`);
|
|
4700
4807
|
}
|
|
4701
4808
|
}
|
|
4702
|
-
async function
|
|
4809
|
+
async function YE(g) {
|
|
4703
4810
|
let A;
|
|
4704
4811
|
switch (g.type) {
|
|
4705
4812
|
case "fetch": {
|
|
4706
|
-
const B = new
|
|
4813
|
+
const B = new zA(g.url);
|
|
4707
4814
|
A = new CA(B);
|
|
4708
4815
|
break;
|
|
4709
4816
|
}
|
|
@@ -4720,10 +4827,10 @@ async function JE(g) {
|
|
|
4720
4827
|
}
|
|
4721
4828
|
}
|
|
4722
4829
|
const I = g.arrayPath ? A.resolve(g.arrayPath) : A;
|
|
4723
|
-
return
|
|
4830
|
+
return JE(I, g.zarrVersion);
|
|
4724
4831
|
}
|
|
4725
|
-
function
|
|
4726
|
-
if (g.store instanceof
|
|
4832
|
+
function ME(g, A, I) {
|
|
4833
|
+
if (g.store instanceof zA)
|
|
4727
4834
|
return {
|
|
4728
4835
|
type: "fetch",
|
|
4729
4836
|
arrayPath: A,
|
|
@@ -4742,10 +4849,10 @@ function YE(g, A, I) {
|
|
|
4742
4849
|
`Unsupported store type: ${g.store.constructor.name}`
|
|
4743
4850
|
);
|
|
4744
4851
|
}
|
|
4745
|
-
function ME(g, A, I, B) {
|
|
4746
|
-
return dE(g, A, I, B);
|
|
4747
|
-
}
|
|
4748
4852
|
function dE(g, A, I, B) {
|
|
4853
|
+
return KE(g, A, I, B);
|
|
4854
|
+
}
|
|
4855
|
+
function KE(g, A, I, B) {
|
|
4749
4856
|
const { targetShape: C, chunkIndex: Q, dimIndices: E } = B;
|
|
4750
4857
|
let i = 1;
|
|
4751
4858
|
for (let r = A.length - 1; r >= 0; r--) {
|
|
@@ -4780,7 +4887,7 @@ function dE(g, A, I, B) {
|
|
|
4780
4887
|
}
|
|
4781
4888
|
return G;
|
|
4782
4889
|
}
|
|
4783
|
-
const
|
|
4890
|
+
const EC = `function xg(B, A) {
|
|
4784
4891
|
return {
|
|
4785
4892
|
...B,
|
|
4786
4893
|
...A,
|
|
@@ -8434,11 +8541,11 @@ return ret;
|
|
|
8434
8541
|
default: IQ
|
|
8435
8542
|
});
|
|
8436
8543
|
//# sourceMappingURL=worker_kernel-CBlE4MBI.js.map
|
|
8437
|
-
`,
|
|
8438
|
-
function
|
|
8544
|
+
`, SB = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", EC], { type: "text/javascript;charset=utf-8" });
|
|
8545
|
+
function HE(g) {
|
|
8439
8546
|
let A;
|
|
8440
8547
|
try {
|
|
8441
|
-
if (A =
|
|
8548
|
+
if (A = SB && (self.URL || self.webkitURL).createObjectURL(SB), !A) throw "";
|
|
8442
8549
|
const I = new Worker(A, {
|
|
8443
8550
|
type: "module",
|
|
8444
8551
|
name: g?.name
|
|
@@ -8448,7 +8555,7 @@ function KE(g) {
|
|
|
8448
8555
|
}), I;
|
|
8449
8556
|
} catch {
|
|
8450
8557
|
return new Worker(
|
|
8451
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
8558
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(EC),
|
|
8452
8559
|
{
|
|
8453
8560
|
type: "module",
|
|
8454
8561
|
name: g?.name
|
|
@@ -8456,20 +8563,20 @@ function KE(g) {
|
|
|
8456
8563
|
);
|
|
8457
8564
|
}
|
|
8458
8565
|
}
|
|
8459
|
-
const
|
|
8460
|
-
let
|
|
8461
|
-
const NA = /* @__PURE__ */ new Map(),
|
|
8462
|
-
function
|
|
8463
|
-
const A =
|
|
8566
|
+
const qE = Math.max(1, navigator.hardwareConcurrency - 2);
|
|
8567
|
+
let iA = [], lE = 0, iC = 0;
|
|
8568
|
+
const NA = /* @__PURE__ */ new Map(), SI = /* @__PURE__ */ new Set();
|
|
8569
|
+
function oC(g) {
|
|
8570
|
+
const A = iA.find((I) => I.worker === g);
|
|
8464
8571
|
return A || k.error(
|
|
8465
8572
|
"ZarrWorker",
|
|
8466
8573
|
"Worker not found in pool - this should not happen"
|
|
8467
8574
|
), A;
|
|
8468
8575
|
}
|
|
8469
|
-
function
|
|
8576
|
+
function fE(g, A) {
|
|
8470
8577
|
const { id: I, success: B } = g.data, C = NA.get(I);
|
|
8471
8578
|
if (!C) {
|
|
8472
|
-
|
|
8579
|
+
SI.has(I) ? SI.delete(I) : k.warn(
|
|
8473
8580
|
"ZarrWorker",
|
|
8474
8581
|
`Received response for unknown message ID ${I}:`,
|
|
8475
8582
|
g.data
|
|
@@ -8477,13 +8584,13 @@ function lE(g, A) {
|
|
|
8477
8584
|
return;
|
|
8478
8585
|
}
|
|
8479
8586
|
NA.delete(I), C.abortListener && C.abortSignal && C.abortSignal.removeEventListener("abort", C.abortListener);
|
|
8480
|
-
const Q =
|
|
8587
|
+
const Q = oC(A);
|
|
8481
8588
|
Q && Q.pendingCount > 0 ? Q.pendingCount-- : Q && k.error(
|
|
8482
8589
|
"ZarrWorker",
|
|
8483
8590
|
"Received message but no pending tasks - this should not happen"
|
|
8484
8591
|
), B && g.data.type === "getChunk" ? C.resolve(g.data.data) : B || C.reject(new Error(g.data.error || "Unknown worker error"));
|
|
8485
8592
|
}
|
|
8486
|
-
function
|
|
8593
|
+
function RB(g, A) {
|
|
8487
8594
|
if (g instanceof MessageEvent) {
|
|
8488
8595
|
k.error(
|
|
8489
8596
|
"ZarrWorker",
|
|
@@ -8496,41 +8603,41 @@ function NB(g, A) {
|
|
|
8496
8603
|
"Worker failed - replacing worker and canceling its in-flight messages",
|
|
8497
8604
|
g.message
|
|
8498
8605
|
);
|
|
8499
|
-
const I =
|
|
8606
|
+
const I = oC(A);
|
|
8500
8607
|
if (I) {
|
|
8501
|
-
const C =
|
|
8502
|
-
|
|
8608
|
+
const C = iA.indexOf(I);
|
|
8609
|
+
iA.splice(C, 1);
|
|
8503
8610
|
}
|
|
8504
8611
|
const B = I?.workerId;
|
|
8505
8612
|
if (B !== void 0)
|
|
8506
8613
|
for (const [C, Q] of NA.entries())
|
|
8507
8614
|
Q.workerId === B && (Q.reject(new Error(`Worker error: ${g.message}`)), NA.delete(C));
|
|
8508
8615
|
try {
|
|
8509
|
-
const C =
|
|
8510
|
-
|
|
8616
|
+
const C = aC();
|
|
8617
|
+
iA.push({
|
|
8511
8618
|
worker: C,
|
|
8512
8619
|
pendingCount: 0,
|
|
8513
|
-
workerId:
|
|
8620
|
+
workerId: iC++
|
|
8514
8621
|
}), k.debug("ZarrWorker", "Replacement worker created successfully");
|
|
8515
8622
|
} catch (C) {
|
|
8516
8623
|
k.error("ZarrWorker", "Failed to create replacement worker", C);
|
|
8517
8624
|
}
|
|
8518
8625
|
}
|
|
8519
|
-
function
|
|
8520
|
-
const g = new
|
|
8521
|
-
return g.addEventListener("message", (A) =>
|
|
8626
|
+
function aC() {
|
|
8627
|
+
const g = new HE();
|
|
8628
|
+
return g.addEventListener("message", (A) => fE(A, g)), g.addEventListener("error", (A) => RB(A, g)), g.addEventListener(
|
|
8522
8629
|
"messageerror",
|
|
8523
|
-
(A) =>
|
|
8630
|
+
(A) => RB(A, g)
|
|
8524
8631
|
), g;
|
|
8525
8632
|
}
|
|
8526
|
-
function
|
|
8527
|
-
if (
|
|
8633
|
+
function pE() {
|
|
8634
|
+
if (iA.length === 0)
|
|
8528
8635
|
throw new Error("Worker pool is not initialized");
|
|
8529
|
-
return
|
|
8636
|
+
return iA.sort((g, A) => g.pendingCount - A.pendingCount)[0];
|
|
8530
8637
|
}
|
|
8531
|
-
async function
|
|
8638
|
+
async function mE(g, A, I, B) {
|
|
8532
8639
|
return new Promise((C, Q) => {
|
|
8533
|
-
const E =
|
|
8640
|
+
const E = pE(), i = lE++, o = {
|
|
8534
8641
|
resolve: C,
|
|
8535
8642
|
reject: Q,
|
|
8536
8643
|
workerId: E.workerId
|
|
@@ -8540,10 +8647,10 @@ async function pE(g, A, I, B) {
|
|
|
8540
8647
|
E.worker.postMessage({
|
|
8541
8648
|
id: i,
|
|
8542
8649
|
type: "cancel"
|
|
8543
|
-
}), NA.delete(i),
|
|
8650
|
+
}), NA.delete(i), SI.add(i), E.pendingCount--, Q(new DOMException("Operation was aborted", "AbortError"));
|
|
8544
8651
|
};
|
|
8545
8652
|
if (B.signal.aborted) {
|
|
8546
|
-
a(),
|
|
8653
|
+
a(), SI.delete(i);
|
|
8547
8654
|
return;
|
|
8548
8655
|
}
|
|
8549
8656
|
B.signal.addEventListener("abort", a, { once: !0 }), o.abortListener = a, o.abortSignal = B.signal;
|
|
@@ -8557,30 +8664,30 @@ async function pE(g, A, I, B) {
|
|
|
8557
8664
|
});
|
|
8558
8665
|
});
|
|
8559
8666
|
}
|
|
8560
|
-
function
|
|
8561
|
-
if (!(
|
|
8667
|
+
function uE() {
|
|
8668
|
+
if (!(iA.length > 0))
|
|
8562
8669
|
try {
|
|
8563
|
-
for (let g = 0; g <
|
|
8564
|
-
const A =
|
|
8565
|
-
|
|
8670
|
+
for (let g = 0; g < qE; g++) {
|
|
8671
|
+
const A = aC();
|
|
8672
|
+
iA.push({
|
|
8566
8673
|
worker: A,
|
|
8567
8674
|
pendingCount: 0,
|
|
8568
|
-
workerId:
|
|
8675
|
+
workerId: iC++
|
|
8569
8676
|
});
|
|
8570
8677
|
}
|
|
8571
8678
|
k.debug(
|
|
8572
8679
|
"ZarrWorker",
|
|
8573
|
-
`Initialized worker pool with ${
|
|
8680
|
+
`Initialized worker pool with ${iA.length} workers`
|
|
8574
8681
|
);
|
|
8575
8682
|
} catch {
|
|
8576
|
-
k.warn("ZarrWorker", "Failed to create workers - clearing pool"),
|
|
8683
|
+
k.warn("ZarrWorker", "Failed to create workers - clearing pool"), xE();
|
|
8577
8684
|
return;
|
|
8578
8685
|
}
|
|
8579
8686
|
}
|
|
8580
|
-
async function
|
|
8581
|
-
|
|
8687
|
+
async function TE(g, A, I, B, C) {
|
|
8688
|
+
uE();
|
|
8582
8689
|
try {
|
|
8583
|
-
return await
|
|
8690
|
+
return await mE(
|
|
8584
8691
|
A,
|
|
8585
8692
|
I,
|
|
8586
8693
|
B,
|
|
@@ -8591,11 +8698,11 @@ async function uE(g, A, I, B, C) {
|
|
|
8591
8698
|
throw Q;
|
|
8592
8699
|
k.warn("ZarrWorker", "Falling back to main thread", Q);
|
|
8593
8700
|
const E = await g.getChunk(I, C);
|
|
8594
|
-
if (!
|
|
8701
|
+
if (!kQ(E.data))
|
|
8595
8702
|
throw new Error(
|
|
8596
8703
|
`Unsupported chunk data type: ${E.data.constructor.name}`
|
|
8597
8704
|
);
|
|
8598
|
-
return
|
|
8705
|
+
return dE(
|
|
8599
8706
|
E.data,
|
|
8600
8707
|
E.shape,
|
|
8601
8708
|
E.stride,
|
|
@@ -8603,19 +8710,19 @@ async function uE(g, A, I, B, C) {
|
|
|
8603
8710
|
);
|
|
8604
8711
|
}
|
|
8605
8712
|
}
|
|
8606
|
-
function
|
|
8607
|
-
for (const g of
|
|
8713
|
+
function xE() {
|
|
8714
|
+
for (const g of iA)
|
|
8608
8715
|
g.worker.terminate();
|
|
8609
|
-
|
|
8716
|
+
iA = [], NA.clear();
|
|
8610
8717
|
}
|
|
8611
|
-
class
|
|
8718
|
+
class WE {
|
|
8612
8719
|
metadata_;
|
|
8613
8720
|
arrays_;
|
|
8614
8721
|
arrayParams_;
|
|
8615
8722
|
dimensions_;
|
|
8616
8723
|
bytesPerElement_;
|
|
8617
8724
|
constructor(A) {
|
|
8618
|
-
this.metadata_ = A.metadata, this.arrays_ = A.arrays, this.arrayParams_ = A.arrayParams, this.dimensions_ =
|
|
8725
|
+
this.metadata_ = A.metadata, this.arrays_ = A.arrays, this.arrayParams_ = A.arrayParams, this.dimensions_ = ZE(this.metadata_, this.arrays_), this.bytesPerElement_ = bE(this.arrays_[0].dtype);
|
|
8619
8726
|
}
|
|
8620
8727
|
getSourceDimensionMap() {
|
|
8621
8728
|
return this.dimensions_;
|
|
@@ -8649,7 +8756,7 @@ class xE {
|
|
|
8649
8756
|
},
|
|
8650
8757
|
cChunkSize: E?.chunkSize,
|
|
8651
8758
|
tChunkSize: i?.chunkSize
|
|
8652
|
-
}, a = await
|
|
8759
|
+
}, a = await TE(
|
|
8653
8760
|
C,
|
|
8654
8761
|
Q,
|
|
8655
8762
|
B,
|
|
@@ -8660,10 +8767,10 @@ class xE {
|
|
|
8660
8767
|
throw new Error(
|
|
8661
8768
|
"Invalid row alignment value. Possible values are 1, 2, 4, or 8"
|
|
8662
8769
|
);
|
|
8663
|
-
A.rowAlignmentBytes = s,
|
|
8770
|
+
A.rowAlignmentBytes = s, cQ(A, a);
|
|
8664
8771
|
}
|
|
8665
8772
|
}
|
|
8666
|
-
const
|
|
8773
|
+
const NB = {
|
|
8667
8774
|
int8: 1,
|
|
8668
8775
|
uint8: 1,
|
|
8669
8776
|
int16: 2,
|
|
@@ -8672,16 +8779,16 @@ const cB = {
|
|
|
8672
8779
|
uint32: 4,
|
|
8673
8780
|
float32: 4
|
|
8674
8781
|
};
|
|
8675
|
-
function
|
|
8676
|
-
const A =
|
|
8782
|
+
function bE(g) {
|
|
8783
|
+
const A = NB[g];
|
|
8677
8784
|
if (A === void 0)
|
|
8678
8785
|
throw new Error(
|
|
8679
|
-
`Unsupported zarr dtype "${g}". Supported dtypes: ${Object.keys(
|
|
8786
|
+
`Unsupported zarr dtype "${g}". Supported dtypes: ${Object.keys(NB).join(", ")}`
|
|
8680
8787
|
);
|
|
8681
8788
|
return A;
|
|
8682
8789
|
}
|
|
8683
|
-
function
|
|
8684
|
-
const I = g.axes.map((D) => D.name), B = g.axes.length, C =
|
|
8790
|
+
function ZE(g, A) {
|
|
8791
|
+
const I = g.axes.map((D) => D.name), B = g.axes.length, C = cB(I, "x"), Q = cB(I, "y"), E = (D, h) => {
|
|
8685
8792
|
const t = [];
|
|
8686
8793
|
for (let y = 0; y < g.datasets.length; y++) {
|
|
8687
8794
|
const n = g.datasets[y], F = A[y], G = n.coordinateTransformations[0].scale, J = n.coordinateTransformations.length === 2 ? n.coordinateTransformations[1].translation : new Array(B).fill(0);
|
|
@@ -8692,7 +8799,7 @@ function bE(g, A) {
|
|
|
8692
8799
|
translation: J[h]
|
|
8693
8800
|
});
|
|
8694
8801
|
}
|
|
8695
|
-
if (g.axes[h].type === "space" &&
|
|
8802
|
+
if (g.axes[h].type === "space" && OE(t))
|
|
8696
8803
|
for (const y of t) y.translation -= 0.5 * y.scale;
|
|
8697
8804
|
return {
|
|
8698
8805
|
name: D,
|
|
@@ -8711,10 +8818,10 @@ function bE(g, A) {
|
|
|
8711
8818
|
const s = iI(I, "t");
|
|
8712
8819
|
return s !== -1 && (i.t = E(I[s], s)), i;
|
|
8713
8820
|
}
|
|
8714
|
-
function
|
|
8821
|
+
function PE(g, A) {
|
|
8715
8822
|
return g.toLowerCase() === A.toLowerCase();
|
|
8716
8823
|
}
|
|
8717
|
-
function
|
|
8824
|
+
function cB(g, A) {
|
|
8718
8825
|
const I = iI(g, A);
|
|
8719
8826
|
if (I === -1)
|
|
8720
8827
|
throw new Error(
|
|
@@ -8723,9 +8830,9 @@ function UB(g, A) {
|
|
|
8723
8830
|
return I;
|
|
8724
8831
|
}
|
|
8725
8832
|
function iI(g, A) {
|
|
8726
|
-
return g.findIndex((I) =>
|
|
8833
|
+
return g.findIndex((I) => PE(I, A));
|
|
8727
8834
|
}
|
|
8728
|
-
function
|
|
8835
|
+
function OE(g) {
|
|
8729
8836
|
if (g.length <= 1) return !1;
|
|
8730
8837
|
for (let A = 1; A < g.length; A++) {
|
|
8731
8838
|
const I = 0.5 * (g[A].scale - g[A - 1].scale), B = g[A].translation - g[A - 1].translation;
|
|
@@ -8770,14 +8877,14 @@ var l;
|
|
|
8770
8877
|
}
|
|
8771
8878
|
g.joinValues = B, g.jsonStringifyReplacer = (C, Q) => typeof Q == "bigint" ? Q.toString() : Q;
|
|
8772
8879
|
})(l || (l = {}));
|
|
8773
|
-
var
|
|
8880
|
+
var UB;
|
|
8774
8881
|
(function(g) {
|
|
8775
8882
|
g.mergeShapes = (A, I) => ({
|
|
8776
8883
|
...A,
|
|
8777
8884
|
...I
|
|
8778
8885
|
// second overwrites first
|
|
8779
8886
|
});
|
|
8780
|
-
})(
|
|
8887
|
+
})(UB || (UB = {}));
|
|
8781
8888
|
const R = l.arrayToEnum([
|
|
8782
8889
|
"string",
|
|
8783
8890
|
"nan",
|
|
@@ -8958,11 +9065,11 @@ const Qg = (g, A) => {
|
|
|
8958
9065
|
}
|
|
8959
9066
|
return { message: I };
|
|
8960
9067
|
};
|
|
8961
|
-
let
|
|
8962
|
-
function
|
|
8963
|
-
return
|
|
9068
|
+
let VE = Qg;
|
|
9069
|
+
function vE() {
|
|
9070
|
+
return VE;
|
|
8964
9071
|
}
|
|
8965
|
-
const
|
|
9072
|
+
const XE = (g) => {
|
|
8966
9073
|
const { data: A, path: I, errorMaps: B, issueData: C } = g, Q = [...I, ...C.path || []], E = {
|
|
8967
9074
|
...C,
|
|
8968
9075
|
path: Q
|
|
@@ -8984,7 +9091,7 @@ const vE = (g) => {
|
|
|
8984
9091
|
};
|
|
8985
9092
|
};
|
|
8986
9093
|
function w(g, A) {
|
|
8987
|
-
const I =
|
|
9094
|
+
const I = vE(), B = XE({
|
|
8988
9095
|
issueData: A,
|
|
8989
9096
|
data: g.data,
|
|
8990
9097
|
path: g.path,
|
|
@@ -9044,7 +9151,7 @@ class gA {
|
|
|
9044
9151
|
}
|
|
9045
9152
|
const Y = Object.freeze({
|
|
9046
9153
|
status: "aborted"
|
|
9047
|
-
}),
|
|
9154
|
+
}), bA = (g) => ({ status: "dirty", value: g }), QA = (g) => ({ status: "valid", value: g }), kB = (g) => g.status === "aborted", LB = (g) => g.status === "dirty", KA = (g) => g.status === "valid", RI = (g) => typeof Promise < "u" && g instanceof Promise;
|
|
9048
9155
|
var N;
|
|
9049
9156
|
(function(g) {
|
|
9050
9157
|
g.errToObj = (A) => typeof A == "string" ? { message: A } : A || {}, g.toString = (A) => typeof A == "string" ? A : A?.message;
|
|
@@ -9057,8 +9164,8 @@ class wA {
|
|
|
9057
9164
|
return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
9058
9165
|
}
|
|
9059
9166
|
}
|
|
9060
|
-
const
|
|
9061
|
-
if (
|
|
9167
|
+
const JB = (g, A) => {
|
|
9168
|
+
if (KA(A))
|
|
9062
9169
|
return { success: !0, data: A.value };
|
|
9063
9170
|
if (!g.common.issues.length)
|
|
9064
9171
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -9115,7 +9222,7 @@ class q {
|
|
|
9115
9222
|
}
|
|
9116
9223
|
_parseSync(A) {
|
|
9117
9224
|
const I = this._parse(A);
|
|
9118
|
-
if (
|
|
9225
|
+
if (RI(I))
|
|
9119
9226
|
throw new Error("Synchronous parse encountered promise.");
|
|
9120
9227
|
return I;
|
|
9121
9228
|
}
|
|
@@ -9142,7 +9249,7 @@ class q {
|
|
|
9142
9249
|
data: A,
|
|
9143
9250
|
parsedType: yA(A)
|
|
9144
9251
|
}, C = this._parseSync({ data: A, path: B.path, parent: B });
|
|
9145
|
-
return
|
|
9252
|
+
return JB(B, C);
|
|
9146
9253
|
}
|
|
9147
9254
|
"~validate"(A) {
|
|
9148
9255
|
const I = {
|
|
@@ -9159,7 +9266,7 @@ class q {
|
|
|
9159
9266
|
if (!this["~standard"].async)
|
|
9160
9267
|
try {
|
|
9161
9268
|
const B = this._parseSync({ data: A, path: [], parent: I });
|
|
9162
|
-
return
|
|
9269
|
+
return KA(B) ? {
|
|
9163
9270
|
value: B.value
|
|
9164
9271
|
} : {
|
|
9165
9272
|
issues: I.common.issues
|
|
@@ -9170,7 +9277,7 @@ class q {
|
|
|
9170
9277
|
async: !0
|
|
9171
9278
|
};
|
|
9172
9279
|
}
|
|
9173
|
-
return this._parseAsync({ data: A, path: [], parent: I }).then((B) =>
|
|
9280
|
+
return this._parseAsync({ data: A, path: [], parent: I }).then((B) => KA(B) ? {
|
|
9174
9281
|
value: B.value
|
|
9175
9282
|
} : {
|
|
9176
9283
|
issues: I.common.issues
|
|
@@ -9194,8 +9301,8 @@ class q {
|
|
|
9194
9301
|
parent: null,
|
|
9195
9302
|
data: A,
|
|
9196
9303
|
parsedType: yA(A)
|
|
9197
|
-
}, C = this._parse({ data: A, path: B.path, parent: B }), Q = await (
|
|
9198
|
-
return
|
|
9304
|
+
}, C = this._parse({ data: A, path: B.path, parent: B }), Q = await (RI(C) ? C : Promise.resolve(C));
|
|
9305
|
+
return JB(B, Q);
|
|
9199
9306
|
}
|
|
9200
9307
|
refine(A, I) {
|
|
9201
9308
|
const B = (C) => typeof I == "string" || typeof I > "u" ? { message: I } : typeof I == "function" ? I(C) : I;
|
|
@@ -9211,7 +9318,7 @@ class q {
|
|
|
9211
9318
|
return this._refinement((B, C) => A(B) ? !0 : (C.addIssue(typeof I == "function" ? I(B, C) : I), !1));
|
|
9212
9319
|
}
|
|
9213
9320
|
_refinement(A) {
|
|
9214
|
-
return new
|
|
9321
|
+
return new lA({
|
|
9215
9322
|
schema: this,
|
|
9216
9323
|
typeName: M.ZodEffects,
|
|
9217
9324
|
effect: { type: "refinement", refinement: A }
|
|
@@ -9231,7 +9338,7 @@ class q {
|
|
|
9231
9338
|
return GA.create(this, this._def);
|
|
9232
9339
|
}
|
|
9233
9340
|
nullable() {
|
|
9234
|
-
return
|
|
9341
|
+
return fA.create(this, this._def);
|
|
9235
9342
|
}
|
|
9236
9343
|
nullish() {
|
|
9237
9344
|
return this.nullable().optional();
|
|
@@ -9240,16 +9347,16 @@ class q {
|
|
|
9240
9347
|
return DA.create(this);
|
|
9241
9348
|
}
|
|
9242
9349
|
promise() {
|
|
9243
|
-
return
|
|
9350
|
+
return kI.create(this, this._def);
|
|
9244
9351
|
}
|
|
9245
9352
|
or(A) {
|
|
9246
|
-
return
|
|
9353
|
+
return cI.create([this, A], this._def);
|
|
9247
9354
|
}
|
|
9248
9355
|
and(A) {
|
|
9249
|
-
return
|
|
9356
|
+
return UI.create(this, A, this._def);
|
|
9250
9357
|
}
|
|
9251
9358
|
transform(A) {
|
|
9252
|
-
return new
|
|
9359
|
+
return new lA({
|
|
9253
9360
|
...K(this._def),
|
|
9254
9361
|
schema: this,
|
|
9255
9362
|
typeName: M.ZodEffects,
|
|
@@ -9266,7 +9373,7 @@ class q {
|
|
|
9266
9373
|
});
|
|
9267
9374
|
}
|
|
9268
9375
|
brand() {
|
|
9269
|
-
return new
|
|
9376
|
+
return new wi({
|
|
9270
9377
|
typeName: M.ZodBranded,
|
|
9271
9378
|
type: this,
|
|
9272
9379
|
...K(this._def)
|
|
@@ -9301,28 +9408,28 @@ class q {
|
|
|
9301
9408
|
return this.safeParse(null).success;
|
|
9302
9409
|
}
|
|
9303
9410
|
}
|
|
9304
|
-
const
|
|
9411
|
+
const jE = /^c[^\s-]{8,}$/i, zE = /^[0-9a-z]+$/, _E = /^[0-9A-HJKMNP-TV-Z]{26}$/i, $E = /^[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, Ai = /^[a-z0-9_-]{21}$/i, Ii = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, gi = /^[-+]?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)?)??$/, Bi = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ci = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
9305
9412
|
let PI;
|
|
9306
|
-
const
|
|
9307
|
-
function
|
|
9413
|
+
const Qi = /^(?:(?: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])$/, Ei = /^(?:(?: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])$/, ii = /^(([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]))$/, oi = /^(([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])$/, ai = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, si = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, sC = "((\\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])))", Di = new RegExp(`^${sC}$`);
|
|
9414
|
+
function DC(g) {
|
|
9308
9415
|
let A = "[0-5]\\d";
|
|
9309
9416
|
g.precision ? A = `${A}\\.\\d{${g.precision}}` : g.precision == null && (A = `${A}(\\.\\d+)?`);
|
|
9310
9417
|
const I = g.precision ? "+" : "?";
|
|
9311
9418
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${A})${I}`;
|
|
9312
9419
|
}
|
|
9313
|
-
function Di(g) {
|
|
9314
|
-
return new RegExp(`^${hC(g)}$`);
|
|
9315
|
-
}
|
|
9316
9420
|
function hi(g) {
|
|
9317
|
-
|
|
9421
|
+
return new RegExp(`^${DC(g)}$`);
|
|
9422
|
+
}
|
|
9423
|
+
function ti(g) {
|
|
9424
|
+
let A = `${sC}T${DC(g)}`;
|
|
9318
9425
|
const I = [];
|
|
9319
9426
|
return I.push(g.local ? "Z?" : "Z"), g.offset && I.push("([+-]\\d{2}:?\\d{2})"), A = `${A}(${I.join("|")})`, new RegExp(`^${A}$`);
|
|
9320
9427
|
}
|
|
9321
|
-
function ti(g, A) {
|
|
9322
|
-
return !!((A === "v4" || !A) && Ci.test(g) || (A === "v6" || !A) && Ei.test(g));
|
|
9323
|
-
}
|
|
9324
9428
|
function yi(g, A) {
|
|
9325
|
-
|
|
9429
|
+
return !!((A === "v4" || !A) && Qi.test(g) || (A === "v6" || !A) && ii.test(g));
|
|
9430
|
+
}
|
|
9431
|
+
function ei(g, A) {
|
|
9432
|
+
if (!Ii.test(g))
|
|
9326
9433
|
return !1;
|
|
9327
9434
|
try {
|
|
9328
9435
|
const [I] = g.split(".");
|
|
@@ -9334,8 +9441,8 @@ function yi(g, A) {
|
|
|
9334
9441
|
return !1;
|
|
9335
9442
|
}
|
|
9336
9443
|
}
|
|
9337
|
-
function
|
|
9338
|
-
return !!((A === "v4" || !A) &&
|
|
9444
|
+
function ni(g, A) {
|
|
9445
|
+
return !!((A === "v4" || !A) && Ei.test(g) || (A === "v6" || !A) && oi.test(g));
|
|
9339
9446
|
}
|
|
9340
9447
|
class eA extends q {
|
|
9341
9448
|
_parse(A) {
|
|
@@ -9386,43 +9493,43 @@ class eA extends q {
|
|
|
9386
9493
|
message: Q.message
|
|
9387
9494
|
}), B.dirty());
|
|
9388
9495
|
} else if (Q.kind === "email")
|
|
9389
|
-
|
|
9496
|
+
Bi.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9390
9497
|
validation: "email",
|
|
9391
9498
|
code: e.invalid_string,
|
|
9392
9499
|
message: Q.message
|
|
9393
9500
|
}), B.dirty());
|
|
9394
9501
|
else if (Q.kind === "emoji")
|
|
9395
|
-
PI || (PI = new RegExp(
|
|
9502
|
+
PI || (PI = new RegExp(Ci, "u")), PI.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9396
9503
|
validation: "emoji",
|
|
9397
9504
|
code: e.invalid_string,
|
|
9398
9505
|
message: Q.message
|
|
9399
9506
|
}), B.dirty());
|
|
9400
9507
|
else if (Q.kind === "uuid")
|
|
9401
|
-
|
|
9508
|
+
$E.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9402
9509
|
validation: "uuid",
|
|
9403
9510
|
code: e.invalid_string,
|
|
9404
9511
|
message: Q.message
|
|
9405
9512
|
}), B.dirty());
|
|
9406
9513
|
else if (Q.kind === "nanoid")
|
|
9407
|
-
|
|
9514
|
+
Ai.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9408
9515
|
validation: "nanoid",
|
|
9409
9516
|
code: e.invalid_string,
|
|
9410
9517
|
message: Q.message
|
|
9411
9518
|
}), B.dirty());
|
|
9412
9519
|
else if (Q.kind === "cuid")
|
|
9413
|
-
|
|
9520
|
+
jE.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9414
9521
|
validation: "cuid",
|
|
9415
9522
|
code: e.invalid_string,
|
|
9416
9523
|
message: Q.message
|
|
9417
9524
|
}), B.dirty());
|
|
9418
9525
|
else if (Q.kind === "cuid2")
|
|
9419
|
-
|
|
9526
|
+
zE.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9420
9527
|
validation: "cuid2",
|
|
9421
9528
|
code: e.invalid_string,
|
|
9422
9529
|
message: Q.message
|
|
9423
9530
|
}), B.dirty());
|
|
9424
9531
|
else if (Q.kind === "ulid")
|
|
9425
|
-
|
|
9532
|
+
_E.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9426
9533
|
validation: "ulid",
|
|
9427
9534
|
code: e.invalid_string,
|
|
9428
9535
|
message: Q.message
|
|
@@ -9453,39 +9560,39 @@ class eA extends q {
|
|
|
9453
9560
|
code: e.invalid_string,
|
|
9454
9561
|
validation: { endsWith: Q.value },
|
|
9455
9562
|
message: Q.message
|
|
9456
|
-
}), B.dirty()) : Q.kind === "datetime" ?
|
|
9563
|
+
}), B.dirty()) : Q.kind === "datetime" ? ti(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9457
9564
|
code: e.invalid_string,
|
|
9458
9565
|
validation: "datetime",
|
|
9459
9566
|
message: Q.message
|
|
9460
|
-
}), B.dirty()) : Q.kind === "date" ?
|
|
9567
|
+
}), B.dirty()) : Q.kind === "date" ? Di.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9461
9568
|
code: e.invalid_string,
|
|
9462
9569
|
validation: "date",
|
|
9463
9570
|
message: Q.message
|
|
9464
|
-
}), B.dirty()) : Q.kind === "time" ?
|
|
9571
|
+
}), B.dirty()) : Q.kind === "time" ? hi(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9465
9572
|
code: e.invalid_string,
|
|
9466
9573
|
validation: "time",
|
|
9467
9574
|
message: Q.message
|
|
9468
|
-
}), B.dirty()) : Q.kind === "duration" ?
|
|
9575
|
+
}), B.dirty()) : Q.kind === "duration" ? gi.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9469
9576
|
validation: "duration",
|
|
9470
9577
|
code: e.invalid_string,
|
|
9471
9578
|
message: Q.message
|
|
9472
|
-
}), B.dirty()) : Q.kind === "ip" ?
|
|
9579
|
+
}), B.dirty()) : Q.kind === "ip" ? yi(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9473
9580
|
validation: "ip",
|
|
9474
9581
|
code: e.invalid_string,
|
|
9475
9582
|
message: Q.message
|
|
9476
|
-
}), B.dirty()) : Q.kind === "jwt" ?
|
|
9583
|
+
}), B.dirty()) : Q.kind === "jwt" ? ei(A.data, Q.alg) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9477
9584
|
validation: "jwt",
|
|
9478
9585
|
code: e.invalid_string,
|
|
9479
9586
|
message: Q.message
|
|
9480
|
-
}), B.dirty()) : Q.kind === "cidr" ?
|
|
9587
|
+
}), B.dirty()) : Q.kind === "cidr" ? ni(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9481
9588
|
validation: "cidr",
|
|
9482
9589
|
code: e.invalid_string,
|
|
9483
9590
|
message: Q.message
|
|
9484
|
-
}), B.dirty()) : Q.kind === "base64" ?
|
|
9591
|
+
}), B.dirty()) : Q.kind === "base64" ? ai.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9485
9592
|
validation: "base64",
|
|
9486
9593
|
code: e.invalid_string,
|
|
9487
9594
|
message: Q.message
|
|
9488
|
-
}), B.dirty()) : Q.kind === "base64url" ?
|
|
9595
|
+
}), B.dirty()) : Q.kind === "base64url" ? si.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
9489
9596
|
validation: "base64url",
|
|
9490
9597
|
code: e.invalid_string,
|
|
9491
9598
|
message: Q.message
|
|
@@ -9720,11 +9827,11 @@ eA.create = (g) => new eA({
|
|
|
9720
9827
|
coerce: g?.coerce ?? !1,
|
|
9721
9828
|
...K(g)
|
|
9722
9829
|
});
|
|
9723
|
-
function
|
|
9830
|
+
function Gi(g, A) {
|
|
9724
9831
|
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(".", ""));
|
|
9725
9832
|
return Q % E / 10 ** C;
|
|
9726
9833
|
}
|
|
9727
|
-
class
|
|
9834
|
+
class HA extends q {
|
|
9728
9835
|
constructor() {
|
|
9729
9836
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
9730
9837
|
}
|
|
@@ -9759,7 +9866,7 @@ class qA extends q {
|
|
|
9759
9866
|
inclusive: Q.inclusive,
|
|
9760
9867
|
exact: !1,
|
|
9761
9868
|
message: Q.message
|
|
9762
|
-
}), C.dirty()) : Q.kind === "multipleOf" ?
|
|
9869
|
+
}), C.dirty()) : Q.kind === "multipleOf" ? Gi(A.data, Q.value) !== 0 && (B = this._getOrReturnCtx(A, B), w(B, {
|
|
9763
9870
|
code: e.not_multiple_of,
|
|
9764
9871
|
multipleOf: Q.value,
|
|
9765
9872
|
message: Q.message
|
|
@@ -9782,7 +9889,7 @@ class qA extends q {
|
|
|
9782
9889
|
return this.setLimit("max", A, !1, N.toString(I));
|
|
9783
9890
|
}
|
|
9784
9891
|
setLimit(A, I, B, C) {
|
|
9785
|
-
return new
|
|
9892
|
+
return new HA({
|
|
9786
9893
|
...this._def,
|
|
9787
9894
|
checks: [
|
|
9788
9895
|
...this._def.checks,
|
|
@@ -9796,7 +9903,7 @@ class qA extends q {
|
|
|
9796
9903
|
});
|
|
9797
9904
|
}
|
|
9798
9905
|
_addCheck(A) {
|
|
9799
|
-
return new
|
|
9906
|
+
return new HA({
|
|
9800
9907
|
...this._def,
|
|
9801
9908
|
checks: [...this._def.checks, A]
|
|
9802
9909
|
});
|
|
@@ -9890,13 +9997,13 @@ class qA extends q {
|
|
|
9890
9997
|
return Number.isFinite(I) && Number.isFinite(A);
|
|
9891
9998
|
}
|
|
9892
9999
|
}
|
|
9893
|
-
|
|
10000
|
+
HA.create = (g) => new HA({
|
|
9894
10001
|
checks: [],
|
|
9895
10002
|
typeName: M.ZodNumber,
|
|
9896
10003
|
coerce: g?.coerce || !1,
|
|
9897
10004
|
...K(g)
|
|
9898
10005
|
});
|
|
9899
|
-
class
|
|
10006
|
+
class vA extends q {
|
|
9900
10007
|
constructor() {
|
|
9901
10008
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
9902
10009
|
}
|
|
@@ -9952,7 +10059,7 @@ class XA extends q {
|
|
|
9952
10059
|
return this.setLimit("max", A, !1, N.toString(I));
|
|
9953
10060
|
}
|
|
9954
10061
|
setLimit(A, I, B, C) {
|
|
9955
|
-
return new
|
|
10062
|
+
return new vA({
|
|
9956
10063
|
...this._def,
|
|
9957
10064
|
checks: [
|
|
9958
10065
|
...this._def.checks,
|
|
@@ -9966,7 +10073,7 @@ class XA extends q {
|
|
|
9966
10073
|
});
|
|
9967
10074
|
}
|
|
9968
10075
|
_addCheck(A) {
|
|
9969
|
-
return new
|
|
10076
|
+
return new vA({
|
|
9970
10077
|
...this._def,
|
|
9971
10078
|
checks: [...this._def.checks, A]
|
|
9972
10079
|
});
|
|
@@ -10023,7 +10130,7 @@ class XA extends q {
|
|
|
10023
10130
|
return A;
|
|
10024
10131
|
}
|
|
10025
10132
|
}
|
|
10026
|
-
|
|
10133
|
+
vA.create = (g) => new vA({
|
|
10027
10134
|
checks: [],
|
|
10028
10135
|
typeName: M.ZodBigInt,
|
|
10029
10136
|
coerce: g?.coerce ?? !1,
|
|
@@ -10047,7 +10154,7 @@ Eg.create = (g) => new Eg({
|
|
|
10047
10154
|
coerce: g?.coerce || !1,
|
|
10048
10155
|
...K(g)
|
|
10049
10156
|
});
|
|
10050
|
-
class
|
|
10157
|
+
class NI extends q {
|
|
10051
10158
|
_parse(A) {
|
|
10052
10159
|
if (this._def.coerce && (A.data = new Date(A.data)), this._getType(A) !== R.date) {
|
|
10053
10160
|
const Q = this._getOrReturnCtx(A);
|
|
@@ -10087,7 +10194,7 @@ class RI extends q {
|
|
|
10087
10194
|
};
|
|
10088
10195
|
}
|
|
10089
10196
|
_addCheck(A) {
|
|
10090
|
-
return new
|
|
10197
|
+
return new NI({
|
|
10091
10198
|
...this._def,
|
|
10092
10199
|
checks: [...this._def.checks, A]
|
|
10093
10200
|
});
|
|
@@ -10119,13 +10226,13 @@ class RI extends q {
|
|
|
10119
10226
|
return A != null ? new Date(A) : null;
|
|
10120
10227
|
}
|
|
10121
10228
|
}
|
|
10122
|
-
|
|
10229
|
+
NI.create = (g) => new NI({
|
|
10123
10230
|
checks: [],
|
|
10124
10231
|
coerce: g?.coerce || !1,
|
|
10125
10232
|
typeName: M.ZodDate,
|
|
10126
10233
|
...K(g)
|
|
10127
10234
|
});
|
|
10128
|
-
class
|
|
10235
|
+
class YB extends q {
|
|
10129
10236
|
_parse(A) {
|
|
10130
10237
|
if (this._getType(A) !== R.symbol) {
|
|
10131
10238
|
const B = this._getOrReturnCtx(A);
|
|
@@ -10138,11 +10245,11 @@ class MB extends q {
|
|
|
10138
10245
|
return QA(A.data);
|
|
10139
10246
|
}
|
|
10140
10247
|
}
|
|
10141
|
-
|
|
10248
|
+
YB.create = (g) => new YB({
|
|
10142
10249
|
typeName: M.ZodSymbol,
|
|
10143
10250
|
...K(g)
|
|
10144
10251
|
});
|
|
10145
|
-
class
|
|
10252
|
+
class MB extends q {
|
|
10146
10253
|
_parse(A) {
|
|
10147
10254
|
if (this._getType(A) !== R.undefined) {
|
|
10148
10255
|
const B = this._getOrReturnCtx(A);
|
|
@@ -10155,11 +10262,11 @@ class dB extends q {
|
|
|
10155
10262
|
return QA(A.data);
|
|
10156
10263
|
}
|
|
10157
10264
|
}
|
|
10158
|
-
|
|
10265
|
+
MB.create = (g) => new MB({
|
|
10159
10266
|
typeName: M.ZodUndefined,
|
|
10160
10267
|
...K(g)
|
|
10161
10268
|
});
|
|
10162
|
-
class
|
|
10269
|
+
class dB extends q {
|
|
10163
10270
|
_parse(A) {
|
|
10164
10271
|
if (this._getType(A) !== R.null) {
|
|
10165
10272
|
const B = this._getOrReturnCtx(A);
|
|
@@ -10172,7 +10279,7 @@ class KB extends q {
|
|
|
10172
10279
|
return QA(A.data);
|
|
10173
10280
|
}
|
|
10174
10281
|
}
|
|
10175
|
-
|
|
10282
|
+
dB.create = (g) => new dB({
|
|
10176
10283
|
typeName: M.ZodNull,
|
|
10177
10284
|
...K(g)
|
|
10178
10285
|
});
|
|
@@ -10188,7 +10295,7 @@ ig.create = (g) => new ig({
|
|
|
10188
10295
|
typeName: M.ZodAny,
|
|
10189
10296
|
...K(g)
|
|
10190
10297
|
});
|
|
10191
|
-
class
|
|
10298
|
+
class KB extends q {
|
|
10192
10299
|
constructor() {
|
|
10193
10300
|
super(...arguments), this._unknown = !0;
|
|
10194
10301
|
}
|
|
@@ -10196,7 +10303,7 @@ class HB extends q {
|
|
|
10196
10303
|
return QA(A.data);
|
|
10197
10304
|
}
|
|
10198
10305
|
}
|
|
10199
|
-
|
|
10306
|
+
KB.create = (g) => new KB({
|
|
10200
10307
|
typeName: M.ZodUnknown,
|
|
10201
10308
|
...K(g)
|
|
10202
10309
|
});
|
|
@@ -10214,7 +10321,7 @@ FA.create = (g) => new FA({
|
|
|
10214
10321
|
typeName: M.ZodNever,
|
|
10215
10322
|
...K(g)
|
|
10216
10323
|
});
|
|
10217
|
-
class
|
|
10324
|
+
class HB extends q {
|
|
10218
10325
|
_parse(A) {
|
|
10219
10326
|
if (this._getType(A) !== R.undefined) {
|
|
10220
10327
|
const B = this._getOrReturnCtx(A);
|
|
@@ -10227,7 +10334,7 @@ class qB extends q {
|
|
|
10227
10334
|
return QA(A.data);
|
|
10228
10335
|
}
|
|
10229
10336
|
}
|
|
10230
|
-
|
|
10337
|
+
HB.create = (g) => new HB({
|
|
10231
10338
|
typeName: M.ZodVoid,
|
|
10232
10339
|
...K(g)
|
|
10233
10340
|
});
|
|
@@ -10318,7 +10425,7 @@ function LA(g) {
|
|
|
10318
10425
|
} else return g instanceof DA ? new DA({
|
|
10319
10426
|
...g._def,
|
|
10320
10427
|
type: LA(g.element)
|
|
10321
|
-
}) : g instanceof GA ? GA.create(LA(g.unwrap())) : g instanceof
|
|
10428
|
+
}) : g instanceof GA ? GA.create(LA(g.unwrap())) : g instanceof fA ? fA.create(LA(g.unwrap())) : g instanceof cA ? cA.create(g.items.map((A) => LA(A))) : g;
|
|
10322
10429
|
}
|
|
10323
10430
|
class O extends q {
|
|
10324
10431
|
constructor() {
|
|
@@ -10583,7 +10690,7 @@ class O extends q {
|
|
|
10583
10690
|
});
|
|
10584
10691
|
}
|
|
10585
10692
|
keyof() {
|
|
10586
|
-
return
|
|
10693
|
+
return hC(l.objectKeys(this.shape));
|
|
10587
10694
|
}
|
|
10588
10695
|
}
|
|
10589
10696
|
O.create = (g, A) => new O({
|
|
@@ -10607,7 +10714,7 @@ O.lazycreate = (g, A) => new O({
|
|
|
10607
10714
|
typeName: M.ZodObject,
|
|
10608
10715
|
...K(A)
|
|
10609
10716
|
});
|
|
10610
|
-
class
|
|
10717
|
+
class cI extends q {
|
|
10611
10718
|
_parse(A) {
|
|
10612
10719
|
const { ctx: I } = this._processInputParams(A), B = this._def.options;
|
|
10613
10720
|
function C(Q) {
|
|
@@ -10675,7 +10782,7 @@ class NI extends q {
|
|
|
10675
10782
|
return this._def.options;
|
|
10676
10783
|
}
|
|
10677
10784
|
}
|
|
10678
|
-
|
|
10785
|
+
cI.create = (g, A) => new cI({
|
|
10679
10786
|
options: g,
|
|
10680
10787
|
typeName: M.ZodUnion,
|
|
10681
10788
|
...K(A)
|
|
@@ -10706,13 +10813,13 @@ function og(g, A) {
|
|
|
10706
10813
|
return { valid: !0, data: C };
|
|
10707
10814
|
} else return I === R.date && B === R.date && +g == +A ? { valid: !0, data: g } : { valid: !1 };
|
|
10708
10815
|
}
|
|
10709
|
-
class
|
|
10816
|
+
class UI extends q {
|
|
10710
10817
|
_parse(A) {
|
|
10711
10818
|
const { status: I, ctx: B } = this._processInputParams(A), C = (Q, E) => {
|
|
10712
|
-
if (
|
|
10819
|
+
if (kB(Q) || kB(E))
|
|
10713
10820
|
return Y;
|
|
10714
10821
|
const i = og(Q.value, E.value);
|
|
10715
|
-
return i.valid ? ((
|
|
10822
|
+
return i.valid ? ((LB(Q) || LB(E)) && I.dirty(), { status: I.value, value: i.data }) : (w(B, {
|
|
10716
10823
|
code: e.invalid_intersection_types
|
|
10717
10824
|
}), Y);
|
|
10718
10825
|
};
|
|
@@ -10738,7 +10845,7 @@ class cI extends q {
|
|
|
10738
10845
|
}));
|
|
10739
10846
|
}
|
|
10740
10847
|
}
|
|
10741
|
-
|
|
10848
|
+
UI.create = (g, A, I) => new UI({
|
|
10742
10849
|
left: g,
|
|
10743
10850
|
right: A,
|
|
10744
10851
|
typeName: M.ZodIntersection,
|
|
@@ -10794,7 +10901,7 @@ cA.create = (g, A) => {
|
|
|
10794
10901
|
...K(A)
|
|
10795
10902
|
});
|
|
10796
10903
|
};
|
|
10797
|
-
class
|
|
10904
|
+
class qB extends q {
|
|
10798
10905
|
get keySchema() {
|
|
10799
10906
|
return this._def.keyType;
|
|
10800
10907
|
}
|
|
@@ -10836,13 +10943,13 @@ class lB extends q {
|
|
|
10836
10943
|
}
|
|
10837
10944
|
}
|
|
10838
10945
|
}
|
|
10839
|
-
|
|
10946
|
+
qB.create = (g, A, I) => new qB({
|
|
10840
10947
|
valueType: A,
|
|
10841
10948
|
keyType: g,
|
|
10842
10949
|
typeName: M.ZodMap,
|
|
10843
10950
|
...K(I)
|
|
10844
10951
|
});
|
|
10845
|
-
class
|
|
10952
|
+
class XA extends q {
|
|
10846
10953
|
_parse(A) {
|
|
10847
10954
|
const { status: I, ctx: B } = this._processInputParams(A);
|
|
10848
10955
|
if (B.parsedType !== R.set)
|
|
@@ -10881,13 +10988,13 @@ class jA extends q {
|
|
|
10881
10988
|
return B.common.async ? Promise.all(i).then((o) => E(o)) : E(i);
|
|
10882
10989
|
}
|
|
10883
10990
|
min(A, I) {
|
|
10884
|
-
return new
|
|
10991
|
+
return new XA({
|
|
10885
10992
|
...this._def,
|
|
10886
10993
|
minSize: { value: A, message: N.toString(I) }
|
|
10887
10994
|
});
|
|
10888
10995
|
}
|
|
10889
10996
|
max(A, I) {
|
|
10890
|
-
return new
|
|
10997
|
+
return new XA({
|
|
10891
10998
|
...this._def,
|
|
10892
10999
|
maxSize: { value: A, message: N.toString(I) }
|
|
10893
11000
|
});
|
|
@@ -10899,14 +11006,14 @@ class jA extends q {
|
|
|
10899
11006
|
return this.min(1, A);
|
|
10900
11007
|
}
|
|
10901
11008
|
}
|
|
10902
|
-
|
|
11009
|
+
XA.create = (g, A) => new XA({
|
|
10903
11010
|
valueType: g,
|
|
10904
11011
|
minSize: null,
|
|
10905
11012
|
maxSize: null,
|
|
10906
11013
|
typeName: M.ZodSet,
|
|
10907
11014
|
...K(A)
|
|
10908
11015
|
});
|
|
10909
|
-
class
|
|
11016
|
+
class lB extends q {
|
|
10910
11017
|
get schema() {
|
|
10911
11018
|
return this._def.getter();
|
|
10912
11019
|
}
|
|
@@ -10915,7 +11022,7 @@ class fB extends q {
|
|
|
10915
11022
|
return this._def.getter()._parse({ data: I.data, path: I.path, parent: I });
|
|
10916
11023
|
}
|
|
10917
11024
|
}
|
|
10918
|
-
|
|
11025
|
+
lB.create = (g, A) => new lB({
|
|
10919
11026
|
getter: g,
|
|
10920
11027
|
typeName: M.ZodLazy,
|
|
10921
11028
|
...K(A)
|
|
@@ -10941,14 +11048,14 @@ ag.create = (g, A) => new ag({
|
|
|
10941
11048
|
typeName: M.ZodLiteral,
|
|
10942
11049
|
...K(A)
|
|
10943
11050
|
});
|
|
10944
|
-
function
|
|
10945
|
-
return new
|
|
11051
|
+
function hC(g, A) {
|
|
11052
|
+
return new qA({
|
|
10946
11053
|
values: g,
|
|
10947
11054
|
typeName: M.ZodEnum,
|
|
10948
11055
|
...K(A)
|
|
10949
11056
|
});
|
|
10950
11057
|
}
|
|
10951
|
-
class
|
|
11058
|
+
class qA extends q {
|
|
10952
11059
|
_parse(A) {
|
|
10953
11060
|
if (typeof A.data != "string") {
|
|
10954
11061
|
const I = this._getOrReturnCtx(A), B = this._def.values;
|
|
@@ -10990,20 +11097,20 @@ class lA extends q {
|
|
|
10990
11097
|
return A;
|
|
10991
11098
|
}
|
|
10992
11099
|
extract(A, I = this._def) {
|
|
10993
|
-
return
|
|
11100
|
+
return qA.create(A, {
|
|
10994
11101
|
...this._def,
|
|
10995
11102
|
...I
|
|
10996
11103
|
});
|
|
10997
11104
|
}
|
|
10998
11105
|
exclude(A, I = this._def) {
|
|
10999
|
-
return
|
|
11106
|
+
return qA.create(this.options.filter((B) => !A.includes(B)), {
|
|
11000
11107
|
...this._def,
|
|
11001
11108
|
...I
|
|
11002
11109
|
});
|
|
11003
11110
|
}
|
|
11004
11111
|
}
|
|
11005
|
-
|
|
11006
|
-
class
|
|
11112
|
+
qA.create = hC;
|
|
11113
|
+
class fB extends q {
|
|
11007
11114
|
_parse(A) {
|
|
11008
11115
|
const I = l.getValidEnumValues(this._def.values), B = this._getOrReturnCtx(A);
|
|
11009
11116
|
if (B.parsedType !== R.string && B.parsedType !== R.number) {
|
|
@@ -11028,12 +11135,12 @@ class pB extends q {
|
|
|
11028
11135
|
return this._def.values;
|
|
11029
11136
|
}
|
|
11030
11137
|
}
|
|
11031
|
-
|
|
11138
|
+
fB.create = (g, A) => new fB({
|
|
11032
11139
|
values: g,
|
|
11033
11140
|
typeName: M.ZodNativeEnum,
|
|
11034
11141
|
...K(A)
|
|
11035
11142
|
});
|
|
11036
|
-
class
|
|
11143
|
+
class kI extends q {
|
|
11037
11144
|
unwrap() {
|
|
11038
11145
|
return this._def.type;
|
|
11039
11146
|
}
|
|
@@ -11052,12 +11159,12 @@ class UI extends q {
|
|
|
11052
11159
|
})));
|
|
11053
11160
|
}
|
|
11054
11161
|
}
|
|
11055
|
-
|
|
11162
|
+
kI.create = (g, A) => new kI({
|
|
11056
11163
|
type: g,
|
|
11057
11164
|
typeName: M.ZodPromise,
|
|
11058
11165
|
...K(A)
|
|
11059
11166
|
});
|
|
11060
|
-
class
|
|
11167
|
+
class lA extends q {
|
|
11061
11168
|
innerType() {
|
|
11062
11169
|
return this._def.schema;
|
|
11063
11170
|
}
|
|
@@ -11084,7 +11191,7 @@ class fA extends q {
|
|
|
11084
11191
|
path: B.path,
|
|
11085
11192
|
parent: B
|
|
11086
11193
|
});
|
|
11087
|
-
return o.status === "aborted" ? Y : o.status === "dirty" || I.value === "dirty" ?
|
|
11194
|
+
return o.status === "aborted" ? Y : o.status === "dirty" || I.value === "dirty" ? bA(o.value) : o;
|
|
11088
11195
|
});
|
|
11089
11196
|
{
|
|
11090
11197
|
if (I.value === "aborted")
|
|
@@ -11094,7 +11201,7 @@ class fA extends q {
|
|
|
11094
11201
|
path: B.path,
|
|
11095
11202
|
parent: B
|
|
11096
11203
|
});
|
|
11097
|
-
return i.status === "aborted" ? Y : i.status === "dirty" || I.value === "dirty" ?
|
|
11204
|
+
return i.status === "aborted" ? Y : i.status === "dirty" || I.value === "dirty" ? bA(i.value) : i;
|
|
11098
11205
|
}
|
|
11099
11206
|
}
|
|
11100
11207
|
if (C.type === "refinement") {
|
|
@@ -11123,27 +11230,27 @@ class fA extends q {
|
|
|
11123
11230
|
path: B.path,
|
|
11124
11231
|
parent: B
|
|
11125
11232
|
});
|
|
11126
|
-
if (!
|
|
11233
|
+
if (!KA(E))
|
|
11127
11234
|
return Y;
|
|
11128
11235
|
const i = C.transform(E.value, Q);
|
|
11129
11236
|
if (i instanceof Promise)
|
|
11130
11237
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
11131
11238
|
return { status: I.value, value: i };
|
|
11132
11239
|
} else
|
|
11133
|
-
return this._def.schema._parseAsync({ data: B.data, path: B.path, parent: B }).then((E) =>
|
|
11240
|
+
return this._def.schema._parseAsync({ data: B.data, path: B.path, parent: B }).then((E) => KA(E) ? Promise.resolve(C.transform(E.value, Q)).then((i) => ({
|
|
11134
11241
|
status: I.value,
|
|
11135
11242
|
value: i
|
|
11136
11243
|
})) : Y);
|
|
11137
11244
|
l.assertNever(C);
|
|
11138
11245
|
}
|
|
11139
11246
|
}
|
|
11140
|
-
|
|
11247
|
+
lA.create = (g, A, I) => new lA({
|
|
11141
11248
|
schema: g,
|
|
11142
11249
|
typeName: M.ZodEffects,
|
|
11143
11250
|
effect: A,
|
|
11144
11251
|
...K(I)
|
|
11145
11252
|
});
|
|
11146
|
-
|
|
11253
|
+
lA.createWithPreprocess = (g, A, I) => new lA({
|
|
11147
11254
|
schema: A,
|
|
11148
11255
|
effect: { type: "preprocess", transform: g },
|
|
11149
11256
|
typeName: M.ZodEffects,
|
|
@@ -11162,7 +11269,7 @@ GA.create = (g, A) => new GA({
|
|
|
11162
11269
|
typeName: M.ZodOptional,
|
|
11163
11270
|
...K(A)
|
|
11164
11271
|
});
|
|
11165
|
-
class
|
|
11272
|
+
class fA extends q {
|
|
11166
11273
|
_parse(A) {
|
|
11167
11274
|
return this._getType(A) === R.null ? QA(null) : this._def.innerType._parse(A);
|
|
11168
11275
|
}
|
|
@@ -11170,7 +11277,7 @@ class pA extends q {
|
|
|
11170
11277
|
return this._def.innerType;
|
|
11171
11278
|
}
|
|
11172
11279
|
}
|
|
11173
|
-
|
|
11280
|
+
fA.create = (g, A) => new fA({
|
|
11174
11281
|
innerType: g,
|
|
11175
11282
|
typeName: M.ZodNullable,
|
|
11176
11283
|
...K(A)
|
|
@@ -11210,7 +11317,7 @@ class Dg extends q {
|
|
|
11210
11317
|
...B
|
|
11211
11318
|
}
|
|
11212
11319
|
});
|
|
11213
|
-
return
|
|
11320
|
+
return RI(C) ? C.then((Q) => ({
|
|
11214
11321
|
status: "valid",
|
|
11215
11322
|
value: Q.status === "valid" ? Q.value : this._def.catchValue({
|
|
11216
11323
|
get error() {
|
|
@@ -11238,7 +11345,7 @@ Dg.create = (g, A) => new Dg({
|
|
|
11238
11345
|
catchValue: typeof A.catch == "function" ? A.catch : () => A.catch,
|
|
11239
11346
|
...K(A)
|
|
11240
11347
|
});
|
|
11241
|
-
class
|
|
11348
|
+
class pB extends q {
|
|
11242
11349
|
_parse(A) {
|
|
11243
11350
|
if (this._getType(A) !== R.nan) {
|
|
11244
11351
|
const B = this._getOrReturnCtx(A);
|
|
@@ -11251,11 +11358,11 @@ class mB extends q {
|
|
|
11251
11358
|
return { status: "valid", value: A.data };
|
|
11252
11359
|
}
|
|
11253
11360
|
}
|
|
11254
|
-
|
|
11361
|
+
pB.create = (g) => new pB({
|
|
11255
11362
|
typeName: M.ZodNaN,
|
|
11256
11363
|
...K(g)
|
|
11257
11364
|
});
|
|
11258
|
-
class
|
|
11365
|
+
class wi extends q {
|
|
11259
11366
|
_parse(A) {
|
|
11260
11367
|
const { ctx: I } = this._processInputParams(A), B = I.data;
|
|
11261
11368
|
return this._def.type._parse({
|
|
@@ -11278,7 +11385,7 @@ class lg extends q {
|
|
|
11278
11385
|
path: B.path,
|
|
11279
11386
|
parent: B
|
|
11280
11387
|
});
|
|
11281
|
-
return Q.status === "aborted" ? Y : Q.status === "dirty" ? (I.dirty(),
|
|
11388
|
+
return Q.status === "aborted" ? Y : Q.status === "dirty" ? (I.dirty(), bA(Q.value)) : this._def.out._parseAsync({
|
|
11282
11389
|
data: Q.value,
|
|
11283
11390
|
path: B.path,
|
|
11284
11391
|
parent: B
|
|
@@ -11310,8 +11417,8 @@ class lg extends q {
|
|
|
11310
11417
|
}
|
|
11311
11418
|
class hg extends q {
|
|
11312
11419
|
_parse(A) {
|
|
11313
|
-
const I = this._def.innerType._parse(A), B = (C) => (
|
|
11314
|
-
return
|
|
11420
|
+
const I = this._def.innerType._parse(A), B = (C) => (KA(C) && (C.value = Object.freeze(C.value)), C);
|
|
11421
|
+
return RI(I) ? I.then((C) => B(C)) : B(I);
|
|
11315
11422
|
}
|
|
11316
11423
|
unwrap() {
|
|
11317
11424
|
return this._def.innerType;
|
|
@@ -11326,17 +11433,17 @@ var M;
|
|
|
11326
11433
|
(function(g) {
|
|
11327
11434
|
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";
|
|
11328
11435
|
})(M || (M = {}));
|
|
11329
|
-
const u = eA.create, H =
|
|
11436
|
+
const u = eA.create, H = HA.create, tC = Eg.create, nA = ig.create;
|
|
11330
11437
|
FA.create;
|
|
11331
11438
|
const m = DA.create, L = O.create;
|
|
11332
|
-
NI.create;
|
|
11333
11439
|
cI.create;
|
|
11334
|
-
cA.create;
|
|
11335
|
-
const _ = ag.create, JA = lA.create;
|
|
11336
11440
|
UI.create;
|
|
11441
|
+
cA.create;
|
|
11442
|
+
const _ = ag.create, JA = qA.create;
|
|
11443
|
+
kI.create;
|
|
11337
11444
|
GA.create;
|
|
11338
|
-
|
|
11339
|
-
const
|
|
11445
|
+
fA.create;
|
|
11446
|
+
const Fi = L({
|
|
11340
11447
|
/**The multiscale datasets for this image*/
|
|
11341
11448
|
multiscales: m(
|
|
11342
11449
|
L({
|
|
@@ -11449,7 +11556,7 @@ const wi = L({
|
|
|
11449
11556
|
label: u().optional(),
|
|
11450
11557
|
family: u().optional(),
|
|
11451
11558
|
color: u(),
|
|
11452
|
-
active:
|
|
11559
|
+
active: tC().optional()
|
|
11453
11560
|
})
|
|
11454
11561
|
),
|
|
11455
11562
|
// The rdefs are not in the JSON schema and are not particularly well
|
|
@@ -11464,7 +11571,7 @@ const wi = L({
|
|
|
11464
11571
|
projection: u().optional()
|
|
11465
11572
|
}).optional()
|
|
11466
11573
|
}).optional()
|
|
11467
|
-
}).describe("JSON from OME-NGFF .zattrs"),
|
|
11574
|
+
}).describe("JSON from OME-NGFF .zattrs"), ri = L({
|
|
11468
11575
|
plate: L({
|
|
11469
11576
|
/**The acquisitions for this plate*/
|
|
11470
11577
|
acquisitions: m(
|
|
@@ -11523,7 +11630,7 @@ const wi = L({
|
|
|
11523
11630
|
})
|
|
11524
11631
|
).min(1).describe("The wells of the plate")
|
|
11525
11632
|
}).optional()
|
|
11526
|
-
}).describe("JSON from OME-NGFF .zattrs"),
|
|
11633
|
+
}).describe("JSON from OME-NGFF .zattrs"), Si = L({
|
|
11527
11634
|
well: L({
|
|
11528
11635
|
/**The fields of view for this well*/
|
|
11529
11636
|
images: m(
|
|
@@ -11537,7 +11644,7 @@ const wi = L({
|
|
|
11537
11644
|
/**The version of the specification*/
|
|
11538
11645
|
version: _("0.4").describe("The version of the specification").optional()
|
|
11539
11646
|
}).optional()
|
|
11540
|
-
}).describe("JSON from OME-NGFF .zattrs"),
|
|
11647
|
+
}).describe("JSON from OME-NGFF .zattrs"), Ri = L({
|
|
11541
11648
|
/**The versioned OME-Zarr Metadata namespace*/
|
|
11542
11649
|
ome: L({
|
|
11543
11650
|
/**The multiscale datasets for this image*/
|
|
@@ -11649,7 +11756,7 @@ const wi = L({
|
|
|
11649
11756
|
label: u().optional(),
|
|
11650
11757
|
family: u().optional(),
|
|
11651
11758
|
color: u().optional(),
|
|
11652
|
-
active:
|
|
11759
|
+
active: tC().optional()
|
|
11653
11760
|
})
|
|
11654
11761
|
),
|
|
11655
11762
|
// The rdefs are not in the JSON schema and are not particularly well
|
|
@@ -11667,7 +11774,7 @@ const wi = L({
|
|
|
11667
11774
|
/**The version of the OME-Zarr Metadata*/
|
|
11668
11775
|
version: _("0.5").describe("The version of the OME-Zarr Metadata")
|
|
11669
11776
|
}).describe("The versioned OME-Zarr Metadata namespace")
|
|
11670
|
-
}).describe("The zarr.json attributes key"),
|
|
11777
|
+
}).describe("The zarr.json attributes key"), Ni = L({
|
|
11671
11778
|
/**The versioned OME-Zarr Metadata namespace*/
|
|
11672
11779
|
ome: L({
|
|
11673
11780
|
plate: L({
|
|
@@ -11729,7 +11836,7 @@ const wi = L({
|
|
|
11729
11836
|
/**The version of the OME-Zarr Metadata*/
|
|
11730
11837
|
version: _("0.5").describe("The version of the OME-Zarr Metadata")
|
|
11731
11838
|
}).describe("The versioned OME-Zarr Metadata namespace")
|
|
11732
|
-
}).describe("The zarr.json attributes key"),
|
|
11839
|
+
}).describe("The zarr.json attributes key"), ci = L({
|
|
11733
11840
|
/**The versioned OME-Zarr Metadata namespace*/
|
|
11734
11841
|
ome: L({
|
|
11735
11842
|
well: L({
|
|
@@ -11748,18 +11855,18 @@ const wi = L({
|
|
|
11748
11855
|
/**The version of the OME-Zarr Metadata*/
|
|
11749
11856
|
version: _("0.5").describe("The version of the OME-Zarr Metadata")
|
|
11750
11857
|
}).describe("The versioned OME-Zarr Metadata namespace")
|
|
11751
|
-
}).describe("JSON from OME-Zarr zarr.json"),
|
|
11752
|
-
function
|
|
11858
|
+
}).describe("JSON from OME-Zarr zarr.json"), Ui = ["0.4", "0.5"], ki = new Set(Ui);
|
|
11859
|
+
function Li(g) {
|
|
11753
11860
|
if (!("ome" in g) || !(g.ome instanceof Object)) return;
|
|
11754
11861
|
const A = g.ome;
|
|
11755
|
-
if ("version" in A && typeof A.version == "string" &&
|
|
11862
|
+
if ("version" in A && typeof A.version == "string" && ki.has(A.version))
|
|
11756
11863
|
return A.version;
|
|
11757
11864
|
}
|
|
11758
11865
|
function fg(g) {
|
|
11759
|
-
const A =
|
|
11866
|
+
const A = Li(g);
|
|
11760
11867
|
return A === void 0 ? "0.4" : A;
|
|
11761
11868
|
}
|
|
11762
|
-
function
|
|
11869
|
+
function pA(g) {
|
|
11763
11870
|
if (g !== void 0)
|
|
11764
11871
|
switch (g) {
|
|
11765
11872
|
case "0.4":
|
|
@@ -11768,14 +11875,14 @@ function mA(g) {
|
|
|
11768
11875
|
return "v3";
|
|
11769
11876
|
}
|
|
11770
11877
|
}
|
|
11771
|
-
function
|
|
11878
|
+
function yC(g, A) {
|
|
11772
11879
|
const I = { ...g };
|
|
11773
11880
|
return delete I[A], I;
|
|
11774
11881
|
}
|
|
11775
|
-
async function
|
|
11776
|
-
const I = new
|
|
11882
|
+
async function wo(g, A) {
|
|
11883
|
+
const I = new zA(g), B = new CA(I), C = pA(A), Q = await II(B, C);
|
|
11777
11884
|
try {
|
|
11778
|
-
return
|
|
11885
|
+
return Ji(Q.attrs);
|
|
11779
11886
|
} catch {
|
|
11780
11887
|
throw Error(
|
|
11781
11888
|
`Failed to parse OME-Zarr plate:
|
|
@@ -11783,58 +11890,58 @@ ${JSON.stringify(Q.attrs)}`
|
|
|
11783
11890
|
);
|
|
11784
11891
|
}
|
|
11785
11892
|
}
|
|
11786
|
-
function
|
|
11893
|
+
function Ji(g) {
|
|
11787
11894
|
switch (fg(g)) {
|
|
11788
11895
|
case "0.5":
|
|
11789
11896
|
return {
|
|
11790
|
-
...
|
|
11897
|
+
...Ni.parse(g).ome,
|
|
11791
11898
|
originalVersion: "0.5"
|
|
11792
11899
|
};
|
|
11793
11900
|
case "0.4":
|
|
11794
11901
|
return {
|
|
11795
|
-
...
|
|
11902
|
+
...Yi(ri.parse(g)).ome,
|
|
11796
11903
|
originalVersion: "0.4"
|
|
11797
11904
|
};
|
|
11798
11905
|
}
|
|
11799
11906
|
}
|
|
11800
|
-
function
|
|
11907
|
+
function Yi(g) {
|
|
11801
11908
|
if (g.plate === void 0)
|
|
11802
11909
|
throw new Error("Plate metadata is missing in OME-Zarr v0.4 plate");
|
|
11803
11910
|
return {
|
|
11804
11911
|
ome: {
|
|
11805
|
-
plate:
|
|
11912
|
+
plate: yC(g.plate, "version"),
|
|
11806
11913
|
version: "0.5"
|
|
11807
11914
|
}
|
|
11808
11915
|
};
|
|
11809
11916
|
}
|
|
11810
|
-
function
|
|
11917
|
+
function Mi(g) {
|
|
11811
11918
|
if (g.well === void 0)
|
|
11812
11919
|
throw new Error("Well metadata is missing in OME-Zarr v0.4 well");
|
|
11813
11920
|
return {
|
|
11814
11921
|
ome: {
|
|
11815
|
-
well:
|
|
11922
|
+
well: yC(g.well, "version"),
|
|
11816
11923
|
version: "0.5"
|
|
11817
11924
|
}
|
|
11818
11925
|
};
|
|
11819
11926
|
}
|
|
11820
|
-
function
|
|
11927
|
+
function di(g) {
|
|
11821
11928
|
switch (fg(g)) {
|
|
11822
11929
|
case "0.5":
|
|
11823
11930
|
return {
|
|
11824
|
-
...
|
|
11931
|
+
...ci.parse(g).ome,
|
|
11825
11932
|
originalVersion: "0.5"
|
|
11826
11933
|
};
|
|
11827
11934
|
case "0.4":
|
|
11828
11935
|
return {
|
|
11829
|
-
...
|
|
11936
|
+
...Mi(Si.parse(g)).ome,
|
|
11830
11937
|
originalVersion: "0.4"
|
|
11831
11938
|
};
|
|
11832
11939
|
}
|
|
11833
11940
|
}
|
|
11834
|
-
async function
|
|
11835
|
-
const B = g + "/" + A, C = new
|
|
11941
|
+
async function Fo(g, A, I) {
|
|
11942
|
+
const B = g + "/" + A, C = new zA(B), Q = new CA(C), E = pA(I), i = await II(Q, E);
|
|
11836
11943
|
try {
|
|
11837
|
-
return
|
|
11944
|
+
return di(i.attrs);
|
|
11838
11945
|
} catch {
|
|
11839
11946
|
throw Error(
|
|
11840
11947
|
`Failed to parse OME-Zarr well:
|
|
@@ -11842,15 +11949,15 @@ ${JSON.stringify(i.attrs)}`
|
|
|
11842
11949
|
);
|
|
11843
11950
|
}
|
|
11844
11951
|
}
|
|
11845
|
-
async function
|
|
11846
|
-
const A =
|
|
11952
|
+
async function ro(g) {
|
|
11953
|
+
const A = pA(g.version), I = await II(g.location, A);
|
|
11847
11954
|
return pg(I.attrs).omero?.channels ?? [];
|
|
11848
11955
|
}
|
|
11849
|
-
async function
|
|
11850
|
-
const A =
|
|
11956
|
+
async function So(g) {
|
|
11957
|
+
const A = pA(g.version), I = await II(g.location, A);
|
|
11851
11958
|
return pg(I.attrs).omero?.rdefs;
|
|
11852
11959
|
}
|
|
11853
|
-
function
|
|
11960
|
+
function Ki(g) {
|
|
11854
11961
|
return {
|
|
11855
11962
|
ome: {
|
|
11856
11963
|
multiscales: g.multiscales,
|
|
@@ -11859,29 +11966,29 @@ function di(g) {
|
|
|
11859
11966
|
}
|
|
11860
11967
|
};
|
|
11861
11968
|
}
|
|
11862
|
-
function
|
|
11969
|
+
function Hi(g) {
|
|
11863
11970
|
switch (fg(g)) {
|
|
11864
11971
|
case "0.5":
|
|
11865
11972
|
return {
|
|
11866
|
-
...
|
|
11973
|
+
...Ri.parse(g).ome,
|
|
11867
11974
|
originalVersion: "0.5"
|
|
11868
11975
|
};
|
|
11869
11976
|
case "0.4":
|
|
11870
11977
|
return {
|
|
11871
|
-
...
|
|
11978
|
+
...Ki(Fi.parse(g)).ome,
|
|
11872
11979
|
originalVersion: "0.4"
|
|
11873
11980
|
};
|
|
11874
11981
|
}
|
|
11875
11982
|
}
|
|
11876
11983
|
function pg(g) {
|
|
11877
11984
|
try {
|
|
11878
|
-
return
|
|
11985
|
+
return Hi(g);
|
|
11879
11986
|
} catch {
|
|
11880
11987
|
throw Error(`Failed to parse OME-Zarr image:
|
|
11881
11988
|
${JSON.stringify(g)}`);
|
|
11882
11989
|
}
|
|
11883
11990
|
}
|
|
11884
|
-
class
|
|
11991
|
+
class ZA {
|
|
11885
11992
|
location;
|
|
11886
11993
|
version;
|
|
11887
11994
|
loader_;
|
|
@@ -11889,8 +11996,8 @@ class PA {
|
|
|
11889
11996
|
this.location = A.location, this.version = A.version, this.loader_ = A.loader;
|
|
11890
11997
|
}
|
|
11891
11998
|
static async openLoader(A, I) {
|
|
11892
|
-
let B =
|
|
11893
|
-
const C = await
|
|
11999
|
+
let B = pA(I);
|
|
12000
|
+
const C = await II(A, B), Q = pg(C.attrs), E = Q.multiscales;
|
|
11894
12001
|
if (E.length !== 1)
|
|
11895
12002
|
throw new Error(
|
|
11896
12003
|
`Exactly one multiscale image is supported. Found ${E.length} images.`
|
|
@@ -11898,17 +12005,17 @@ class PA {
|
|
|
11898
12005
|
const i = E[0];
|
|
11899
12006
|
if (i.datasets.length === 0)
|
|
11900
12007
|
throw new Error("No datasets found in the multiscale image.");
|
|
11901
|
-
B || (B =
|
|
12008
|
+
B || (B = pA(Q.originalVersion));
|
|
11902
12009
|
const o = i.datasets.map(
|
|
11903
|
-
(h) =>
|
|
12010
|
+
(h) => ME(A, h.path, B)
|
|
11904
12011
|
), a = await Promise.all(
|
|
11905
|
-
o.map((h) =>
|
|
12012
|
+
o.map((h) => YE(h))
|
|
11906
12013
|
), s = a[0].shape, D = i.axes;
|
|
11907
12014
|
if (D.length !== s.length)
|
|
11908
12015
|
throw new Error(
|
|
11909
12016
|
`Mismatch between number of axes (${D.length}) and array shape (${s.length})`
|
|
11910
12017
|
);
|
|
11911
|
-
return new
|
|
12018
|
+
return new WE({ metadata: i, arrays: a, arrayParams: o });
|
|
11912
12019
|
}
|
|
11913
12020
|
getDimensions() {
|
|
11914
12021
|
return this.loader_.getSourceDimensionMap();
|
|
@@ -11926,8 +12033,8 @@ class PA {
|
|
|
11926
12033
|
* @param props.version OME-Zarr version
|
|
11927
12034
|
*/
|
|
11928
12035
|
static async fromHttp(A) {
|
|
11929
|
-
const I = new CA(new
|
|
11930
|
-
return new
|
|
12036
|
+
const I = new CA(new zA(A.url)), B = await ZA.openLoader(I, A.version);
|
|
12037
|
+
return new ZA({ location: I, version: A.version, loader: B });
|
|
11931
12038
|
}
|
|
11932
12039
|
/**
|
|
11933
12040
|
* Creates and opens an OmeZarrImageSource from a local filesystem directory.
|
|
@@ -11942,8 +12049,8 @@ class PA {
|
|
|
11942
12049
|
const I = new CA(
|
|
11943
12050
|
new qg(A.directory),
|
|
11944
12051
|
A.path
|
|
11945
|
-
), B = await
|
|
11946
|
-
return new
|
|
12052
|
+
), B = await ZA.openLoader(I, A.version);
|
|
12053
|
+
return new ZA({ location: I, version: A.version, loader: B });
|
|
11947
12054
|
}
|
|
11948
12055
|
}
|
|
11949
12056
|
class qI {
|
|
@@ -11954,6 +12061,7 @@ class qI {
|
|
|
11954
12061
|
opacity_;
|
|
11955
12062
|
blendMode;
|
|
11956
12063
|
occludes;
|
|
12064
|
+
requiresSceneDepth_ = !1;
|
|
11957
12065
|
constructor({
|
|
11958
12066
|
opacity: A = 1,
|
|
11959
12067
|
blendMode: I = "none",
|
|
@@ -11961,6 +12069,9 @@ class qI {
|
|
|
11961
12069
|
} = {}) {
|
|
11962
12070
|
this.opacity_ = hA(A, 0, 1), this.blendMode = I, this.occludes = B ?? I === "none";
|
|
11963
12071
|
}
|
|
12072
|
+
get requiresSceneDepth() {
|
|
12073
|
+
return this.requiresSceneDepth_;
|
|
12074
|
+
}
|
|
11964
12075
|
get opacity() {
|
|
11965
12076
|
return this.opacity_;
|
|
11966
12077
|
}
|
|
@@ -11977,6 +12088,8 @@ class qI {
|
|
|
11977
12088
|
throw new Error(
|
|
11978
12089
|
`${this.type} cannot be attached to multiple viewports simultaneously.`
|
|
11979
12090
|
);
|
|
12091
|
+
if (this.occludes && this.requiresSceneDepth_)
|
|
12092
|
+
throw new Error(`${this.type} cannot both occlude and read scene depth.`);
|
|
11980
12093
|
this.attach(A), this.attached_ = !0;
|
|
11981
12094
|
}
|
|
11982
12095
|
onDetached(A) {
|
|
@@ -12020,7 +12133,7 @@ class qI {
|
|
|
12020
12133
|
return {};
|
|
12021
12134
|
}
|
|
12022
12135
|
}
|
|
12023
|
-
class
|
|
12136
|
+
class qi extends mA {
|
|
12024
12137
|
// this creates the geometry for a screen-space projected line
|
|
12025
12138
|
// each point on the input path is split into two vertices
|
|
12026
12139
|
// these are pushed in opposite directions in screen-space to create width
|
|
@@ -12069,7 +12182,7 @@ class Hi extends uA {
|
|
|
12069
12182
|
return I;
|
|
12070
12183
|
}
|
|
12071
12184
|
}
|
|
12072
|
-
class
|
|
12185
|
+
class li extends mA {
|
|
12073
12186
|
constructor(A) {
|
|
12074
12187
|
if (super(), A.primitive != "triangles") {
|
|
12075
12188
|
k.warn("WireframeGeometry", "Only indexed geometries are supported");
|
|
@@ -12094,11 +12207,11 @@ class qi extends uA {
|
|
|
12094
12207
|
this.indexData_ = new Uint32Array(B);
|
|
12095
12208
|
}
|
|
12096
12209
|
}
|
|
12097
|
-
const
|
|
12098
|
-
class
|
|
12210
|
+
const fi = p(0, 1, 0);
|
|
12211
|
+
class eC {
|
|
12099
12212
|
dirty_ = !0;
|
|
12100
12213
|
matrix_ = $();
|
|
12101
|
-
rotation_ =
|
|
12214
|
+
rotation_ = hI();
|
|
12102
12215
|
translation_ = d();
|
|
12103
12216
|
scale_ = p(1, 1, 1);
|
|
12104
12217
|
addRotation(A) {
|
|
@@ -12111,36 +12224,36 @@ class nC {
|
|
|
12111
12224
|
return iQ(this.rotation_);
|
|
12112
12225
|
}
|
|
12113
12226
|
addTranslation(A) {
|
|
12114
|
-
|
|
12227
|
+
aI(this.translation_, this.translation_, A), this.dirty_ = !0;
|
|
12115
12228
|
}
|
|
12116
12229
|
setTranslation(A) {
|
|
12117
|
-
|
|
12230
|
+
jI(this.translation_, A), this.dirty_ = !0;
|
|
12118
12231
|
}
|
|
12119
12232
|
get translation() {
|
|
12120
|
-
return
|
|
12233
|
+
return EA(this.translation_);
|
|
12121
12234
|
}
|
|
12122
12235
|
addScale(A) {
|
|
12123
|
-
|
|
12236
|
+
zC(this.scale_, this.scale_, A), this.dirty_ = !0;
|
|
12124
12237
|
}
|
|
12125
12238
|
setScale(A) {
|
|
12126
|
-
|
|
12239
|
+
jI(this.scale_, A), this.dirty_ = !0;
|
|
12127
12240
|
}
|
|
12128
12241
|
targetTo(A) {
|
|
12129
|
-
Gg(this.translation_, A) && (A =
|
|
12130
|
-
const I =
|
|
12242
|
+
Gg(this.translation_, A) && (A = EA(A), A[2] += T);
|
|
12243
|
+
const I = XC($(), this.translation_, A, fi), B = xC(VB(), I);
|
|
12131
12244
|
wg(this.rotation_, B), MI(this.rotation_, this.rotation_), this.dirty_ = !0;
|
|
12132
12245
|
}
|
|
12133
12246
|
get scale() {
|
|
12134
|
-
return
|
|
12247
|
+
return EA(this.scale_);
|
|
12135
12248
|
}
|
|
12136
12249
|
get matrix() {
|
|
12137
12250
|
return this.dirty_ && (this.computeMatrix(), this.dirty_ = !1), this.matrix_;
|
|
12138
12251
|
}
|
|
12139
12252
|
get inverse() {
|
|
12140
|
-
return
|
|
12253
|
+
return OA($(), this.matrix);
|
|
12141
12254
|
}
|
|
12142
12255
|
computeMatrix() {
|
|
12143
|
-
|
|
12256
|
+
ZC(
|
|
12144
12257
|
this.matrix_,
|
|
12145
12258
|
this.rotation_,
|
|
12146
12259
|
this.translation_,
|
|
@@ -12216,14 +12329,14 @@ class x {
|
|
|
12216
12329
|
return I.length === 1 ? "0" + I : I;
|
|
12217
12330
|
}
|
|
12218
12331
|
}
|
|
12219
|
-
class
|
|
12332
|
+
class gI extends YI {
|
|
12220
12333
|
wireframeEnabled = !1;
|
|
12221
12334
|
wireframeColor = x.WHITE;
|
|
12222
12335
|
depthTest = !0;
|
|
12223
12336
|
textures_ = [];
|
|
12224
12337
|
staleTextures_ = [];
|
|
12225
|
-
transform_ = new
|
|
12226
|
-
geometry_ = new
|
|
12338
|
+
transform_ = new eC();
|
|
12339
|
+
geometry_ = new mA();
|
|
12227
12340
|
wireframeGeometry_ = null;
|
|
12228
12341
|
programName_ = null;
|
|
12229
12342
|
depthProgramName_ = null;
|
|
@@ -12245,7 +12358,7 @@ class BI extends JI {
|
|
|
12245
12358
|
return this.geometry_;
|
|
12246
12359
|
}
|
|
12247
12360
|
get wireframeGeometry() {
|
|
12248
|
-
return this.wireframeGeometry_ ??= new
|
|
12361
|
+
return this.wireframeGeometry_ ??= new li(this.geometry), this.wireframeGeometry_;
|
|
12249
12362
|
}
|
|
12250
12363
|
get textures() {
|
|
12251
12364
|
return this.textures_;
|
|
@@ -12286,7 +12399,7 @@ class BI extends JI {
|
|
|
12286
12399
|
return {};
|
|
12287
12400
|
}
|
|
12288
12401
|
}
|
|
12289
|
-
class
|
|
12402
|
+
class pi extends gI {
|
|
12290
12403
|
color_;
|
|
12291
12404
|
width_;
|
|
12292
12405
|
constructor({ geometry: A, color: I, width: B }) {
|
|
@@ -12314,7 +12427,7 @@ class fi extends BI {
|
|
|
12314
12427
|
};
|
|
12315
12428
|
}
|
|
12316
12429
|
}
|
|
12317
|
-
class
|
|
12430
|
+
class Ro extends qI {
|
|
12318
12431
|
type = "AxesLayer";
|
|
12319
12432
|
constructor(A) {
|
|
12320
12433
|
super();
|
|
@@ -12343,14 +12456,14 @@ class So extends qI {
|
|
|
12343
12456
|
}
|
|
12344
12457
|
}
|
|
12345
12458
|
function OI(g) {
|
|
12346
|
-
const { end: A, width: I, color: B } = g, C = new
|
|
12347
|
-
return new
|
|
12459
|
+
const { end: A, width: I, color: B } = g, C = new qi([[0, 0, 0], A]);
|
|
12460
|
+
return new pi({
|
|
12348
12461
|
geometry: C,
|
|
12349
12462
|
color: B,
|
|
12350
12463
|
width: I
|
|
12351
12464
|
});
|
|
12352
12465
|
}
|
|
12353
|
-
const
|
|
12466
|
+
const nC = [
|
|
12354
12467
|
"fallbackVisible",
|
|
12355
12468
|
"prefetchTime",
|
|
12356
12469
|
"visibleCurrent",
|
|
@@ -12358,14 +12471,14 @@ const GC = [
|
|
|
12358
12471
|
"prefetchSpace"
|
|
12359
12472
|
];
|
|
12360
12473
|
function mg(g) {
|
|
12361
|
-
|
|
12474
|
+
mi(g);
|
|
12362
12475
|
const A = {
|
|
12363
12476
|
x: g.prefetch.x,
|
|
12364
12477
|
y: g.prefetch.y,
|
|
12365
12478
|
z: g.prefetch.z ?? 0,
|
|
12366
12479
|
t: g.prefetch.t ?? 0
|
|
12367
12480
|
}, I = Object.freeze(
|
|
12368
|
-
|
|
12481
|
+
nC.reduce(
|
|
12369
12482
|
(Q, E) => {
|
|
12370
12483
|
const i = g.priorityOrder.indexOf(E);
|
|
12371
12484
|
return Q[E] = i, Q;
|
|
@@ -12398,7 +12511,7 @@ function ug(g = {}) {
|
|
|
12398
12511
|
]
|
|
12399
12512
|
}, g));
|
|
12400
12513
|
}
|
|
12401
|
-
function
|
|
12514
|
+
function No(g = {}) {
|
|
12402
12515
|
return mg(Tg({
|
|
12403
12516
|
profile: "playback",
|
|
12404
12517
|
prefetch: { x: 0, y: 0, z: 0, t: 20 },
|
|
@@ -12411,7 +12524,7 @@ function Ro(g = {}) {
|
|
|
12411
12524
|
]
|
|
12412
12525
|
}, g));
|
|
12413
12526
|
}
|
|
12414
|
-
function
|
|
12527
|
+
function co(g = {}) {
|
|
12415
12528
|
return mg(Tg({
|
|
12416
12529
|
profile: "no-prefetch",
|
|
12417
12530
|
prefetch: { x: 0, y: 0, z: 0, t: 0 },
|
|
@@ -12424,7 +12537,7 @@ function No(g = {}) {
|
|
|
12424
12537
|
]
|
|
12425
12538
|
}, g));
|
|
12426
12539
|
}
|
|
12427
|
-
function
|
|
12540
|
+
function mi(g) {
|
|
12428
12541
|
for (const [B, C] of Object.entries(g.prefetch))
|
|
12429
12542
|
if (C !== void 0 && C < 0)
|
|
12430
12543
|
throw new Error(`prefetch.${B} must be a non-negative number`);
|
|
@@ -12432,7 +12545,7 @@ function pi(g) {
|
|
|
12432
12545
|
if (A?.min !== void 0 && A?.max !== void 0 && A.min > A.max)
|
|
12433
12546
|
throw new Error("lod.min must be <= lod.max");
|
|
12434
12547
|
const I = g.priorityOrder;
|
|
12435
|
-
if (I.length !==
|
|
12548
|
+
if (I.length !== nC.length || new Set(I).size !== I.length)
|
|
12436
12549
|
throw new Error("priorityOrder must include all categories exactly once");
|
|
12437
12550
|
}
|
|
12438
12551
|
function Tg(g, A = {}) {
|
|
@@ -12443,9 +12556,9 @@ function Tg(g, A = {}) {
|
|
|
12443
12556
|
priorityOrder: A.priorityOrder ?? g.priorityOrder
|
|
12444
12557
|
};
|
|
12445
12558
|
}
|
|
12446
|
-
const
|
|
12447
|
-
function
|
|
12448
|
-
return A ??= !0, I = I === void 0 ? x.WHITE : x.from(I), C = C === void 0 ? 1 : hA(C, 0, 1), g !== null ? B =
|
|
12559
|
+
const mB = 32;
|
|
12560
|
+
function jA(g, { visible: A, color: I, contrastLimits: B, opacity: C }) {
|
|
12561
|
+
return A ??= !0, I = I === void 0 ? x.WHITE : x.from(I), C = C === void 0 ? 1 : hA(C, 0, 1), g !== null ? B = ui(B, g) : B === void 0 && (k.debug(
|
|
12449
12562
|
"Channel",
|
|
12450
12563
|
"No texture provided, defaulting channel contrast limits to [0, 1]."
|
|
12451
12564
|
), B = [0, 1]), {
|
|
@@ -12456,17 +12569,17 @@ function zA(g, { visible: A, color: I, contrastLimits: B, opacity: C }) {
|
|
|
12456
12569
|
};
|
|
12457
12570
|
}
|
|
12458
12571
|
function tg(g, A) {
|
|
12459
|
-
if (A.length >
|
|
12460
|
-
throw new Error(`Maximum number of channels is ${
|
|
12461
|
-
return A.map((I) =>
|
|
12572
|
+
if (A.length > mB)
|
|
12573
|
+
throw new Error(`Maximum number of channels is ${mB}`);
|
|
12574
|
+
return A.map((I) => jA(g, I));
|
|
12462
12575
|
}
|
|
12463
|
-
function
|
|
12576
|
+
function GC(g, A) {
|
|
12464
12577
|
if (g && g.length !== A)
|
|
12465
12578
|
throw new Error(
|
|
12466
12579
|
`channelProps length (${g.length}) must match source channel count (${A}).`
|
|
12467
12580
|
);
|
|
12468
12581
|
}
|
|
12469
|
-
function
|
|
12582
|
+
function ui(g, A) {
|
|
12470
12583
|
if (g === void 0)
|
|
12471
12584
|
return GQ(A);
|
|
12472
12585
|
if (g[1] <= g[0])
|
|
@@ -12475,7 +12588,7 @@ function mi(g, A) {
|
|
|
12475
12588
|
);
|
|
12476
12589
|
return g;
|
|
12477
12590
|
}
|
|
12478
|
-
class
|
|
12591
|
+
class wC extends mA {
|
|
12479
12592
|
constructor(A, I, B, C) {
|
|
12480
12593
|
super();
|
|
12481
12594
|
const Q = [], E = [], i = B, o = C, a = i + 1, s = o + 1, D = A / i, h = I / o;
|
|
@@ -12506,7 +12619,7 @@ class FC extends uA {
|
|
|
12506
12619
|
});
|
|
12507
12620
|
}
|
|
12508
12621
|
}
|
|
12509
|
-
class
|
|
12622
|
+
class Ti extends gI {
|
|
12510
12623
|
channels_;
|
|
12511
12624
|
worldToTexCoord = $();
|
|
12512
12625
|
constructor({
|
|
@@ -12515,7 +12628,7 @@ class ui extends BI {
|
|
|
12515
12628
|
texture: B,
|
|
12516
12629
|
channelProps: C = []
|
|
12517
12630
|
}) {
|
|
12518
|
-
super(), this.geometry = new
|
|
12631
|
+
super(), this.geometry = new wC(A, I, 1, 1), this.setTexture(0, B), this.channels_ = tg(B, C), this.programName = xi(B), this.depthProgramName = "meshDepth";
|
|
12519
12632
|
}
|
|
12520
12633
|
get type() {
|
|
12521
12634
|
return "ImageRenderable";
|
|
@@ -12524,7 +12637,7 @@ class ui extends BI {
|
|
|
12524
12637
|
this.channels_ = tg(this.textures[0], A);
|
|
12525
12638
|
}
|
|
12526
12639
|
setChannelProperty(A, I, B) {
|
|
12527
|
-
const C =
|
|
12640
|
+
const C = jA(this.textures[0], {
|
|
12528
12641
|
...this.channels_[A],
|
|
12529
12642
|
[I]: B
|
|
12530
12643
|
});
|
|
@@ -12534,7 +12647,7 @@ class ui extends BI {
|
|
|
12534
12647
|
const A = this.textures[0];
|
|
12535
12648
|
if (!A)
|
|
12536
12649
|
throw new Error("No texture set");
|
|
12537
|
-
const { color: I, contrastLimits: B, opacity: C } = this.channels_[0] ??
|
|
12650
|
+
const { color: I, contrastLimits: B, opacity: C } = this.channels_[0] ?? jA(A, {});
|
|
12538
12651
|
return {
|
|
12539
12652
|
u_imageSampler: 0,
|
|
12540
12653
|
u_color: I.rgb,
|
|
@@ -12545,7 +12658,7 @@ class ui extends BI {
|
|
|
12545
12658
|
};
|
|
12546
12659
|
}
|
|
12547
12660
|
}
|
|
12548
|
-
function
|
|
12661
|
+
function xi(g) {
|
|
12549
12662
|
switch (g.dataType) {
|
|
12550
12663
|
case "byte":
|
|
12551
12664
|
case "int":
|
|
@@ -12559,30 +12672,30 @@ function Ti(g) {
|
|
|
12559
12672
|
return "floatScalarImage";
|
|
12560
12673
|
}
|
|
12561
12674
|
}
|
|
12562
|
-
class
|
|
12675
|
+
class sA {
|
|
12563
12676
|
normal;
|
|
12564
12677
|
signedDistance;
|
|
12565
12678
|
constructor(A = p(0, 1, 0), I = 0) {
|
|
12566
|
-
this.normal =
|
|
12679
|
+
this.normal = EA(A), this.signedDistance = I;
|
|
12567
12680
|
}
|
|
12568
12681
|
static fromPointAndNormal(A, I) {
|
|
12569
|
-
return new
|
|
12682
|
+
return new sA(I, -sI(I, A));
|
|
12570
12683
|
}
|
|
12571
12684
|
set(A, I) {
|
|
12572
|
-
this.normal =
|
|
12685
|
+
this.normal = EA(A), this.signedDistance = I;
|
|
12573
12686
|
}
|
|
12574
12687
|
signedDistanceToPoint(A) {
|
|
12575
|
-
return
|
|
12688
|
+
return sI(this.normal, A) + this.signedDistance;
|
|
12576
12689
|
}
|
|
12577
12690
|
normalize() {
|
|
12578
12691
|
const A = yg(this.normal);
|
|
12579
12692
|
if (A > 0) {
|
|
12580
12693
|
const I = 1 / A;
|
|
12581
|
-
|
|
12694
|
+
zI(this.normal, this.normal, I), this.signedDistance *= I;
|
|
12582
12695
|
}
|
|
12583
12696
|
}
|
|
12584
12697
|
}
|
|
12585
|
-
function
|
|
12698
|
+
function FC(g, A, I, B, C = 3) {
|
|
12586
12699
|
switch (g.type) {
|
|
12587
12700
|
case "pointerdown": {
|
|
12588
12701
|
const Q = g.event;
|
|
@@ -12623,7 +12736,7 @@ class xg {
|
|
|
12623
12736
|
this.bins_.clear();
|
|
12624
12737
|
}
|
|
12625
12738
|
}
|
|
12626
|
-
class
|
|
12739
|
+
class rC extends qI {
|
|
12627
12740
|
type = "ImageLayer";
|
|
12628
12741
|
source_;
|
|
12629
12742
|
sliceCoords_;
|
|
@@ -12660,14 +12773,14 @@ class SC extends qI {
|
|
|
12660
12773
|
onPickValue: E,
|
|
12661
12774
|
...i
|
|
12662
12775
|
}) {
|
|
12663
|
-
super({ blendMode: "additive", occludes: !0, ...i }), this.setState("initialized"), this.source_ = A, this.policy_ = B ?? ug(), this.sliceCoords_ = I, this.orientation_ = C ?? "XY", this.axes_ =
|
|
12776
|
+
super({ blendMode: "additive", occludes: !0, ...i }), this.setState("initialized"), this.source_ = A, this.policy_ = B ?? ug(), this.sliceCoords_ = I, this.orientation_ = C ?? "XY", this.axes_ = MA(this.orientation_), this.planeRotation_ = dA(this.axes_), this.channelProps_ = Q, this.initialChannelProps_ = Q, this.onPickValue_ = E;
|
|
12664
12777
|
}
|
|
12665
12778
|
attach(A) {
|
|
12666
12779
|
this.context_ = A, this.chunkStoreView_ = A.chunkManager.addView(
|
|
12667
12780
|
this.source_,
|
|
12668
12781
|
this.policy_,
|
|
12669
12782
|
this.axes_
|
|
12670
|
-
),
|
|
12783
|
+
), GC(
|
|
12671
12784
|
this.channelProps_,
|
|
12672
12785
|
this.chunkStoreView_.channelCount
|
|
12673
12786
|
);
|
|
@@ -12693,7 +12806,7 @@ class SC extends qI {
|
|
|
12693
12806
|
* for the new plane, chunks already resident in the shared cache are reused.
|
|
12694
12807
|
*/
|
|
12695
12808
|
setOrientation(A) {
|
|
12696
|
-
A !== this.orientation_ && (this.releaseAndRemoveChunks(this.visibleChunks_.keys()), this.orderedChunks_ = [], this.clearObjects(), this.chunkStoreView_?.dispose(), this.lastPresentationTimeStamp_ = void 0, this.lastPresentationTimeCoord_ = void 0, this.orientation_ = A, this.axes_ =
|
|
12809
|
+
A !== this.orientation_ && (this.releaseAndRemoveChunks(this.visibleChunks_.keys()), this.orderedChunks_ = [], this.clearObjects(), this.chunkStoreView_?.dispose(), this.lastPresentationTimeStamp_ = void 0, this.lastPresentationTimeCoord_ = void 0, this.orientation_ = A, this.axes_ = MA(A), this.planeRotation_ = dA(this.axes_), this.context_ && (this.chunkStoreView_ = this.context_.chunkManager.addView(
|
|
12697
12810
|
this.source_,
|
|
12698
12811
|
this.policy_,
|
|
12699
12812
|
this.axes_
|
|
@@ -12730,10 +12843,10 @@ class SC extends qI {
|
|
|
12730
12843
|
return this.lastPresentationTimeCoord_;
|
|
12731
12844
|
}
|
|
12732
12845
|
isPresentationStale() {
|
|
12733
|
-
return this.lastPresentationTimeStamp_ === void 0 ? !1 : performance.now() - this.lastPresentationTimeStamp_ >
|
|
12846
|
+
return this.lastPresentationTimeStamp_ === void 0 ? !1 : performance.now() - this.lastPresentationTimeStamp_ > rC.STALE_PRESENTATION_MS_;
|
|
12734
12847
|
}
|
|
12735
12848
|
onEvent(A) {
|
|
12736
|
-
this.pointerDownPos_ =
|
|
12849
|
+
this.pointerDownPos_ = FC(
|
|
12737
12850
|
A,
|
|
12738
12851
|
this.pointerDownPos_,
|
|
12739
12852
|
(I) => this.pickAtRay(I),
|
|
@@ -12743,11 +12856,11 @@ class SC extends qI {
|
|
|
12743
12856
|
async pickAtRay(A) {
|
|
12744
12857
|
const I = this.visibleChunks_.values().next();
|
|
12745
12858
|
if (I.done) return null;
|
|
12746
|
-
const B = I.value.transform, C =
|
|
12859
|
+
const B = I.value.transform, C = jB(
|
|
12747
12860
|
d(),
|
|
12748
12861
|
p(0, 0, 1),
|
|
12749
12862
|
B.rotation
|
|
12750
|
-
), Q =
|
|
12863
|
+
), Q = sA.fromPointAndNormal(B.translation, C), E = A.intersectWithPlane(Q);
|
|
12751
12864
|
if (!E) return null;
|
|
12752
12865
|
const i = await this.getValueAtWorld(E);
|
|
12753
12866
|
return i === null ? null : { world: E, value: i };
|
|
@@ -12775,7 +12888,7 @@ class SC extends qI {
|
|
|
12775
12888
|
const B = this.visibleChunks_.get(A);
|
|
12776
12889
|
if (B) return B;
|
|
12777
12890
|
const C = this.pool_.acquire(
|
|
12778
|
-
|
|
12891
|
+
LI(A, this.axes_)
|
|
12779
12892
|
);
|
|
12780
12893
|
return C ? (C.setTexture(0, I), C.setChannelProps(this.getChannelPropsForChunk(A)), this.updateImageChunk(C, A), C) : this.createImage(A, I);
|
|
12781
12894
|
}
|
|
@@ -12783,7 +12896,7 @@ class SC extends qI {
|
|
|
12783
12896
|
return this.channelProps_ ? [this.channelProps_[A.chunkIndex.c] ?? {}] : [{}];
|
|
12784
12897
|
}
|
|
12785
12898
|
createImage(A, I) {
|
|
12786
|
-
const B = new
|
|
12899
|
+
const B = new Ti({
|
|
12787
12900
|
width: A.shape[this.axes_.u],
|
|
12788
12901
|
height: A.shape[this.axes_.v],
|
|
12789
12902
|
texture: I,
|
|
@@ -12805,7 +12918,7 @@ class SC extends qI {
|
|
|
12805
12918
|
updateImageChunk(A, I) {
|
|
12806
12919
|
this.debugMode_ ? (A.wireframeEnabled = !0, A.wireframeColor = this.wireframeColors_[I.lod % this.wireframeColors_.length]) : A.wireframeEnabled = !1;
|
|
12807
12920
|
const { u: B, v: C } = this.axes_;
|
|
12808
|
-
A.transform.setScale([I.scale[B], I.scale[C], 1]), A.transform.setRotation(this.planeRotation_), this.updateSlicePosition(A, I), A.worldToTexCoord =
|
|
12921
|
+
A.transform.setScale([I.scale[B], I.scale[C], 1]), A.transform.setRotation(this.planeRotation_), this.updateSlicePosition(A, I), A.worldToTexCoord = _B(I, this.axes_);
|
|
12809
12922
|
}
|
|
12810
12923
|
async getValueAtWorld(A) {
|
|
12811
12924
|
const I = this.chunkStoreView_?.currentLOD ?? 0;
|
|
@@ -12861,11 +12974,11 @@ class SC extends qI {
|
|
|
12861
12974
|
releaseAndRemoveChunks(A) {
|
|
12862
12975
|
for (const I of A) {
|
|
12863
12976
|
const B = this.visibleChunks_.get(I);
|
|
12864
|
-
B && (this.pool_.release(
|
|
12977
|
+
B && (this.pool_.release(LI(I, this.axes_), B), this.visibleChunks_.delete(I));
|
|
12865
12978
|
}
|
|
12866
12979
|
}
|
|
12867
12980
|
}
|
|
12868
|
-
function
|
|
12981
|
+
function LI(g, A) {
|
|
12869
12982
|
return [
|
|
12870
12983
|
`plane${A.u}${A.v}`,
|
|
12871
12984
|
`lod${g.lod}`,
|
|
@@ -12873,7 +12986,7 @@ function kI(g, A) {
|
|
|
12873
12986
|
`align${g.rowAlignmentBytes}`
|
|
12874
12987
|
].join(":");
|
|
12875
12988
|
}
|
|
12876
|
-
class
|
|
12989
|
+
class Wi extends mA {
|
|
12877
12990
|
constructor(A, I, B, C, Q, E) {
|
|
12878
12991
|
super();
|
|
12879
12992
|
const i = [], o = [], a = Math.floor(C), s = Math.floor(Q), D = Math.floor(E);
|
|
@@ -12900,7 +13013,7 @@ class xi extends uA {
|
|
|
12900
13013
|
b[A] = j * C, b[I] = f * Q, b[B] = J;
|
|
12901
13014
|
const z = { x: 0, y: 0, z: 0 };
|
|
12902
13015
|
z[B] = D;
|
|
12903
|
-
const
|
|
13016
|
+
const oA = Z / a, aA = 1 - c / s;
|
|
12904
13017
|
h.push(
|
|
12905
13018
|
b.x,
|
|
12906
13019
|
b.y,
|
|
@@ -12908,8 +13021,8 @@ class xi extends uA {
|
|
|
12908
13021
|
z.x,
|
|
12909
13022
|
z.y,
|
|
12910
13023
|
z.z,
|
|
12911
|
-
|
|
12912
|
-
|
|
13024
|
+
oA,
|
|
13025
|
+
aA
|
|
12913
13026
|
);
|
|
12914
13027
|
}
|
|
12915
13028
|
}
|
|
@@ -12920,13 +13033,13 @@ class xi extends uA {
|
|
|
12920
13033
|
}
|
|
12921
13034
|
}
|
|
12922
13035
|
}
|
|
12923
|
-
class
|
|
13036
|
+
class bi extends gI {
|
|
12924
13037
|
voxelScale = p(1, 1, 1);
|
|
12925
13038
|
channels_;
|
|
12926
13039
|
loadedChannels_ = /* @__PURE__ */ new Set();
|
|
12927
13040
|
channelToTextureIndex_ = /* @__PURE__ */ new Map();
|
|
12928
13041
|
constructor({ channelProps: A = [] } = {}) {
|
|
12929
|
-
super(), this.geometry = new
|
|
13042
|
+
super(), this.geometry = new Wi(1, 1, 1, 1, 1, 1), this.cullFaceMode = "front", this.depthTest = !1, this.channels_ = [], this.setChannelProps(A);
|
|
12930
13043
|
}
|
|
12931
13044
|
get type() {
|
|
12932
13045
|
return "VolumeRenderable";
|
|
@@ -12939,7 +13052,7 @@ class Wi extends BI {
|
|
|
12939
13052
|
addChannelTexture(A, I) {
|
|
12940
13053
|
const B = this.textures.length;
|
|
12941
13054
|
this.setTexture(B, I), this.channelToTextureIndex_.set(A, B);
|
|
12942
|
-
const C =
|
|
13055
|
+
const C = Zi(I.dataType);
|
|
12943
13056
|
if (this.programName && this.programName !== C)
|
|
12944
13057
|
throw new Error(
|
|
12945
13058
|
`Volume renderable does not support multiple channels with different data types. Existing program: ${this.programName}, new channel data type: ${I.dataType} and program: ${C}`
|
|
@@ -12976,7 +13089,7 @@ class Wi extends BI {
|
|
|
12976
13089
|
for (let o = 0; o < i && E.length < 4; o++) {
|
|
12977
13090
|
const a = this.channelToTextureIndex_.get(o);
|
|
12978
13091
|
if (a === void 0 || !this.loadedChannels_.has(o)) continue;
|
|
12979
|
-
const s = this.textures[a], D =
|
|
13092
|
+
const s = this.textures[a], D = jA(s, this.channels_[o] || {});
|
|
12980
13093
|
if (!D.visible) continue;
|
|
12981
13094
|
const h = E.length;
|
|
12982
13095
|
I[h * 3] = D.color.rgb[0], I[h * 3 + 1] = D.color.rgb[1], I[h * 3 + 2] = D.color.rgb[2], E.push(a), B[h] = -D.contrastLimits[0], C[h] = 1 / (D.contrastLimits[1] - D.contrastLimits[0]), A[h] = 1, Q[h] = D.opacity;
|
|
@@ -13015,7 +13128,7 @@ class Wi extends BI {
|
|
|
13015
13128
|
);
|
|
13016
13129
|
}
|
|
13017
13130
|
setChannelProperty(A, I, B) {
|
|
13018
|
-
const C =
|
|
13131
|
+
const C = jA(
|
|
13019
13132
|
this.getAvailableChannelTexture(A),
|
|
13020
13133
|
{
|
|
13021
13134
|
...this.channels_[A],
|
|
@@ -13025,7 +13138,7 @@ class Wi extends BI {
|
|
|
13025
13138
|
this.channels_[A] = C;
|
|
13026
13139
|
}
|
|
13027
13140
|
}
|
|
13028
|
-
function
|
|
13141
|
+
function Zi(g) {
|
|
13029
13142
|
switch (g) {
|
|
13030
13143
|
case "byte":
|
|
13031
13144
|
case "int":
|
|
@@ -13039,17 +13152,10 @@ function bi(g) {
|
|
|
13039
13152
|
return "floatVolume";
|
|
13040
13153
|
}
|
|
13041
13154
|
}
|
|
13042
|
-
function Zi(g, A) {
|
|
13043
|
-
const I = A.position, B = d(), C = d();
|
|
13044
|
-
return g.sort((Q, E) => {
|
|
13045
|
-
YA(B, Q.boundingBox.max, Q.boundingBox.min), VA(B, B, 0.5), YA(C, E.boundingBox.max, E.boundingBox.min), VA(C, C, 0.5);
|
|
13046
|
-
const i = zg(I, B), o = zg(I, C);
|
|
13047
|
-
return i - o;
|
|
13048
|
-
}), g;
|
|
13049
|
-
}
|
|
13050
13155
|
const Pi = 2;
|
|
13051
|
-
class
|
|
13156
|
+
class Uo extends qI {
|
|
13052
13157
|
type = "VolumeLayer";
|
|
13158
|
+
requiresSceneDepth_ = !0;
|
|
13053
13159
|
source_;
|
|
13054
13160
|
sliceCoords_;
|
|
13055
13161
|
currentVolumes_ = /* @__PURE__ */ new Map();
|
|
@@ -13109,7 +13215,7 @@ class co extends qI {
|
|
|
13109
13215
|
this.channelChangeCallbacks_.splice(I, 1);
|
|
13110
13216
|
}
|
|
13111
13217
|
constructor({ source: A, sliceCoords: I, policy: B, channelProps: C }) {
|
|
13112
|
-
super({ blendMode: "
|
|
13218
|
+
super({ blendMode: "premultipliedOver" }), this.source_ = A, this.sliceCoords_ = I, this.policy_ = B ?? ug(), this.initialChannelProps_ = C, this.channelProps_ = C, this.setState("initialized");
|
|
13113
13219
|
}
|
|
13114
13220
|
getOrCreateVolume(A, I) {
|
|
13115
13221
|
const B = this.currentVolumes_.get(A);
|
|
@@ -13117,7 +13223,7 @@ class co extends qI {
|
|
|
13117
13223
|
for (const E of I) B.updateVolumeWithChunk(E);
|
|
13118
13224
|
return B;
|
|
13119
13225
|
}
|
|
13120
|
-
const C = vi(I[0]), Q = this.pool_.acquire(C) ?? new
|
|
13226
|
+
const C = vi(I[0]), Q = this.pool_.acquire(C) ?? new bi();
|
|
13121
13227
|
Q.setChannelProps(this.channelProps_ ?? []), this.volumeToPoolKey_.set(Q, C);
|
|
13122
13228
|
for (const E of I) Q.updateVolumeWithChunk(E);
|
|
13123
13229
|
return this.updateVolumeTransform(Q, I[0]), Q;
|
|
@@ -13126,7 +13232,7 @@ class co extends qI {
|
|
|
13126
13232
|
this.chunkStoreView_ = A.chunkManager.addView(
|
|
13127
13233
|
this.source_,
|
|
13128
13234
|
this.policy_
|
|
13129
|
-
),
|
|
13235
|
+
), GC(
|
|
13130
13236
|
this.channelProps_,
|
|
13131
13237
|
this.chunkStoreView_.channelCount
|
|
13132
13238
|
);
|
|
@@ -13182,7 +13288,7 @@ class co extends qI {
|
|
|
13182
13288
|
}
|
|
13183
13289
|
rebuildObjects(A) {
|
|
13184
13290
|
const I = Array.from(this.currentVolumes_.values());
|
|
13185
|
-
|
|
13291
|
+
Xi(I, A), this.clearObjects();
|
|
13186
13292
|
for (const B of I)
|
|
13187
13293
|
this.addObject(B);
|
|
13188
13294
|
}
|
|
@@ -13215,7 +13321,15 @@ function vi(g) {
|
|
|
13215
13321
|
`align${g.rowAlignmentBytes}`
|
|
13216
13322
|
].join(":");
|
|
13217
13323
|
}
|
|
13218
|
-
|
|
13324
|
+
function Xi(g, A) {
|
|
13325
|
+
const I = A.position, B = /* @__PURE__ */ new Map();
|
|
13326
|
+
for (const C of g) {
|
|
13327
|
+
const Q = C.transform.translation;
|
|
13328
|
+
B.set(C, _C(I, Q));
|
|
13329
|
+
}
|
|
13330
|
+
g.sort((C, Q) => B.get(Q) - B.get(C));
|
|
13331
|
+
}
|
|
13332
|
+
class uB extends rg {
|
|
13219
13333
|
width_;
|
|
13220
13334
|
height_;
|
|
13221
13335
|
constructor(A, I, B) {
|
|
@@ -13231,7 +13345,7 @@ class TB extends rg {
|
|
|
13231
13345
|
return this.height_;
|
|
13232
13346
|
}
|
|
13233
13347
|
}
|
|
13234
|
-
const
|
|
13348
|
+
const ji = [
|
|
13235
13349
|
[1, 0.5, 0.5],
|
|
13236
13350
|
[0.5, 1, 0.5],
|
|
13237
13351
|
[0.5, 0.5, 1],
|
|
@@ -13239,7 +13353,7 @@ const Xi = [
|
|
|
13239
13353
|
[1, 0.5, 1],
|
|
13240
13354
|
[1, 1, 0.5]
|
|
13241
13355
|
];
|
|
13242
|
-
function
|
|
13356
|
+
function zi(g) {
|
|
13243
13357
|
return g = g ?? /* @__PURE__ */ new Map(), new Map(
|
|
13244
13358
|
Array.from(g.entries()).map(([A, I]) => [
|
|
13245
13359
|
A,
|
|
@@ -13247,42 +13361,42 @@ function ji(g) {
|
|
|
13247
13361
|
])
|
|
13248
13362
|
);
|
|
13249
13363
|
}
|
|
13250
|
-
function
|
|
13251
|
-
return g = g ??
|
|
13364
|
+
function _i(g) {
|
|
13365
|
+
return g = g ?? ji, g.map(x.from);
|
|
13252
13366
|
}
|
|
13253
|
-
function
|
|
13367
|
+
function JI(g = {}) {
|
|
13254
13368
|
return {
|
|
13255
|
-
lookupTable:
|
|
13256
|
-
cycle:
|
|
13369
|
+
lookupTable: zi(g.lookupTable),
|
|
13370
|
+
cycle: _i(g.cycle)
|
|
13257
13371
|
};
|
|
13258
13372
|
}
|
|
13259
|
-
const
|
|
13373
|
+
const SC = /* @__PURE__ */ new Set(["byte", "short", "int"]), $i = /* @__PURE__ */ new Set([
|
|
13260
13374
|
"unsigned_byte",
|
|
13261
13375
|
"unsigned_short",
|
|
13262
13376
|
"unsigned_int"
|
|
13263
13377
|
]);
|
|
13264
|
-
function
|
|
13378
|
+
function Ao(g) {
|
|
13265
13379
|
if (g.dataFormat !== "scalar")
|
|
13266
13380
|
throw new Error(
|
|
13267
13381
|
`Image data format must be scalar, instead found: ${g.dataFormat}`
|
|
13268
13382
|
);
|
|
13269
|
-
if (!
|
|
13383
|
+
if (!SC.has(g.dataType) && !$i.has(g.dataType))
|
|
13270
13384
|
throw new Error(
|
|
13271
13385
|
`Image data type must be an integer, instead found: ${g.dataType}`
|
|
13272
13386
|
);
|
|
13273
13387
|
return g;
|
|
13274
13388
|
}
|
|
13275
|
-
function
|
|
13276
|
-
return
|
|
13389
|
+
function Io(g) {
|
|
13390
|
+
return SC.has(g.dataType) ? "intLabelImage" : "labelImage";
|
|
13277
13391
|
}
|
|
13278
|
-
class
|
|
13392
|
+
class go extends gI {
|
|
13279
13393
|
outlineSelected_;
|
|
13280
13394
|
selectedValue_;
|
|
13281
13395
|
worldToTexCoord = $();
|
|
13282
13396
|
constructor(A) {
|
|
13283
|
-
super(), this.geometry = new
|
|
13284
|
-
const I =
|
|
13285
|
-
this.setTexture(1, this.makeColorCycleTexture(I.cycle)), this.setTexture(2, this.makeColorLookupTableTexture(I.lookupTable)), this.outlineSelected_ = A.outlineSelected ?? !1, this.selectedValue_ = A.selectedValue ?? null, this.programName =
|
|
13397
|
+
super(), this.geometry = new wC(A.width, A.height, 1, 1), this.setTexture(0, Ao(A.imageData));
|
|
13398
|
+
const I = JI(A.colorMap);
|
|
13399
|
+
this.setTexture(1, this.makeColorCycleTexture(I.cycle)), this.setTexture(2, this.makeColorLookupTableTexture(I.lookupTable)), this.outlineSelected_ = A.outlineSelected ?? !1, this.selectedValue_ = A.selectedValue ?? null, this.programName = Io(A.imageData), this.depthProgramName = "meshDepth";
|
|
13286
13400
|
}
|
|
13287
13401
|
get type() {
|
|
13288
13402
|
return "LabelImageRenderable";
|
|
@@ -13298,7 +13412,7 @@ class Io extends BI {
|
|
|
13298
13412
|
};
|
|
13299
13413
|
}
|
|
13300
13414
|
setColorMap(A) {
|
|
13301
|
-
const I =
|
|
13415
|
+
const I = JI(A);
|
|
13302
13416
|
this.markStaleTexture(this.textures[1]), this.markStaleTexture(this.textures[2]), this.setTexture(1, this.makeColorCycleTexture(I.cycle)), this.setTexture(2, this.makeColorLookupTableTexture(I.lookupTable));
|
|
13303
13417
|
}
|
|
13304
13418
|
setSelectedValue(A) {
|
|
@@ -13307,16 +13421,16 @@ class Io extends BI {
|
|
|
13307
13421
|
makeColorCycleTexture(A) {
|
|
13308
13422
|
const I = new Uint8Array(
|
|
13309
13423
|
A.flatMap((C) => C.rgba).map((C) => Math.round(C * 255))
|
|
13310
|
-
), B = new
|
|
13424
|
+
), B = new uB(I, A.length, 1);
|
|
13311
13425
|
return B.dataFormat = "rgba", B;
|
|
13312
13426
|
}
|
|
13313
13427
|
makeColorLookupTableTexture(A) {
|
|
13314
13428
|
A === void 0 ? A = /* @__PURE__ */ new Map([[0, x.TRANSPARENT]]) : A.has(0) || (A = new Map([[0, x.TRANSPARENT], ...A]));
|
|
13315
13429
|
const I = Array.from(A.keys()), B = Array.from(A.values()).map((E) => E.packed), C = A.size, Q = new Uint32Array(C * 2);
|
|
13316
|
-
return Q.set(I, 0), Q.set(B, C), new
|
|
13430
|
+
return Q.set(I, 0), Q.set(B, C), new uB(Q, C, 2);
|
|
13317
13431
|
}
|
|
13318
13432
|
}
|
|
13319
|
-
class
|
|
13433
|
+
class RC extends qI {
|
|
13320
13434
|
type = "LabelLayer";
|
|
13321
13435
|
source_;
|
|
13322
13436
|
sliceCoords_;
|
|
@@ -13346,7 +13460,7 @@ class NC extends qI {
|
|
|
13346
13460
|
outlineSelected: i = !1,
|
|
13347
13461
|
...o
|
|
13348
13462
|
}) {
|
|
13349
|
-
super(o), this.setState("initialized"), this.source_ = A, this.policy_ = B ?? ug(), this.sliceCoords_ = I, this.orientation_ = C ?? "XY", this.axes_ =
|
|
13463
|
+
super(o), this.setState("initialized"), this.source_ = A, this.policy_ = B ?? ug(), this.sliceCoords_ = I, this.orientation_ = C ?? "XY", this.axes_ = MA(this.orientation_), this.planeRotation_ = dA(this.axes_), this.colorMap_ = JI(Q), this.onPickValue_ = E, this.outlineSelected_ = i;
|
|
13350
13464
|
}
|
|
13351
13465
|
attach(A) {
|
|
13352
13466
|
if (this.context_ = A, this.chunkStoreView_ = A.chunkManager.addView(
|
|
@@ -13379,7 +13493,7 @@ class NC extends qI {
|
|
|
13379
13493
|
* for the new plane, chunks already resident in the shared cache are reused.
|
|
13380
13494
|
*/
|
|
13381
13495
|
setOrientation(A) {
|
|
13382
|
-
A !== this.orientation_ && (this.releaseAndRemoveChunks(this.visibleChunks_.keys()), this.clearObjects(), this.chunkStoreView_?.dispose(), this.lastPresentationTimeStamp_ = void 0, this.lastPresentationTimeCoord_ = void 0, this.orientation_ = A, this.axes_ =
|
|
13496
|
+
A !== this.orientation_ && (this.releaseAndRemoveChunks(this.visibleChunks_.keys()), this.clearObjects(), this.chunkStoreView_?.dispose(), this.lastPresentationTimeStamp_ = void 0, this.lastPresentationTimeCoord_ = void 0, this.orientation_ = A, this.axes_ = MA(A), this.planeRotation_ = dA(this.axes_), this.context_ && (this.chunkStoreView_ = this.context_.chunkManager.addView(
|
|
13383
13497
|
this.source_,
|
|
13384
13498
|
this.policy_,
|
|
13385
13499
|
this.axes_
|
|
@@ -13404,10 +13518,10 @@ class NC extends qI {
|
|
|
13404
13518
|
}
|
|
13405
13519
|
}
|
|
13406
13520
|
isPresentationStale() {
|
|
13407
|
-
return this.lastPresentationTimeStamp_ === void 0 ? !1 : performance.now() - this.lastPresentationTimeStamp_ >
|
|
13521
|
+
return this.lastPresentationTimeStamp_ === void 0 ? !1 : performance.now() - this.lastPresentationTimeStamp_ > RC.STALE_PRESENTATION_MS_;
|
|
13408
13522
|
}
|
|
13409
13523
|
onEvent(A) {
|
|
13410
|
-
this.pointerDownPos_ =
|
|
13524
|
+
this.pointerDownPos_ = FC(
|
|
13411
13525
|
A,
|
|
13412
13526
|
this.pointerDownPos_,
|
|
13413
13527
|
(I) => this.pickAtRay(I),
|
|
@@ -13419,11 +13533,11 @@ class NC extends qI {
|
|
|
13419
13533
|
async pickAtRay(A) {
|
|
13420
13534
|
const I = this.visibleChunks_.values().next();
|
|
13421
13535
|
if (I.done) return null;
|
|
13422
|
-
const B = I.value.transform, C =
|
|
13536
|
+
const B = I.value.transform, C = jB(
|
|
13423
13537
|
d(),
|
|
13424
13538
|
p(0, 0, 1),
|
|
13425
13539
|
B.rotation
|
|
13426
|
-
), Q =
|
|
13540
|
+
), Q = sA.fromPointAndNormal(B.translation, C), E = A.intersectWithPlane(Q);
|
|
13427
13541
|
if (!E) return null;
|
|
13428
13542
|
const i = await this.getValueAtWorld(E);
|
|
13429
13543
|
return i === null ? null : { world: E, value: i };
|
|
@@ -13432,7 +13546,7 @@ class NC extends qI {
|
|
|
13432
13546
|
return this.colorMap_;
|
|
13433
13547
|
}
|
|
13434
13548
|
setColorMap(A) {
|
|
13435
|
-
this.colorMap_ =
|
|
13549
|
+
this.colorMap_ = JI(A), this.visibleChunks_.forEach((I) => {
|
|
13436
13550
|
I.setColorMap(this.colorMap_);
|
|
13437
13551
|
});
|
|
13438
13552
|
}
|
|
@@ -13488,12 +13602,12 @@ class NC extends qI {
|
|
|
13488
13602
|
const B = this.visibleChunks_.get(A);
|
|
13489
13603
|
if (B) return B;
|
|
13490
13604
|
const C = this.pool_.acquire(
|
|
13491
|
-
|
|
13605
|
+
LI(A, this.axes_)
|
|
13492
13606
|
);
|
|
13493
13607
|
return C ? (C.setTexture(0, I), C.setColorMap(this.colorMap_), C.setSelectedValue(this.selectedValue_), this.updateLabelChunk(C, A), C) : this.createLabel(A, I);
|
|
13494
13608
|
}
|
|
13495
13609
|
createLabel(A, I) {
|
|
13496
|
-
const B = new
|
|
13610
|
+
const B = new go({
|
|
13497
13611
|
width: A.shape[this.axes_.u],
|
|
13498
13612
|
height: A.shape[this.axes_.v],
|
|
13499
13613
|
imageData: I,
|
|
@@ -13516,16 +13630,16 @@ class NC extends qI {
|
|
|
13516
13630
|
}
|
|
13517
13631
|
updateLabelChunk(A, I) {
|
|
13518
13632
|
const { u: B, v: C } = this.axes_;
|
|
13519
|
-
A.transform.setScale([I.scale[B], I.scale[C], 1]), A.transform.setRotation(this.planeRotation_), this.updateSlicePosition(A, I), A.worldToTexCoord =
|
|
13633
|
+
A.transform.setScale([I.scale[B], I.scale[C], 1]), A.transform.setRotation(this.planeRotation_), this.updateSlicePosition(A, I), A.worldToTexCoord = _B(I, this.axes_);
|
|
13520
13634
|
}
|
|
13521
13635
|
releaseAndRemoveChunks(A) {
|
|
13522
13636
|
for (const I of A) {
|
|
13523
13637
|
const B = this.visibleChunks_.get(I);
|
|
13524
|
-
B && (this.pool_.release(
|
|
13638
|
+
B && (this.pool_.release(LI(I, this.axes_), B), this.visibleChunks_.delete(I));
|
|
13525
13639
|
}
|
|
13526
13640
|
}
|
|
13527
13641
|
}
|
|
13528
|
-
class
|
|
13642
|
+
class Bo extends rg {
|
|
13529
13643
|
width_;
|
|
13530
13644
|
height_;
|
|
13531
13645
|
depth_;
|
|
@@ -13545,12 +13659,12 @@ class go extends rg {
|
|
|
13545
13659
|
return this.depth_;
|
|
13546
13660
|
}
|
|
13547
13661
|
}
|
|
13548
|
-
const
|
|
13662
|
+
const NC = {
|
|
13549
13663
|
circle: 0,
|
|
13550
13664
|
square: 1,
|
|
13551
13665
|
triangle: 2
|
|
13552
13666
|
};
|
|
13553
|
-
class
|
|
13667
|
+
class ko extends gI {
|
|
13554
13668
|
constructor(A) {
|
|
13555
13669
|
super(), this.programName = "points", this.depthProgramName = "pointsDepth";
|
|
13556
13670
|
const I = A.flatMap((C) => {
|
|
@@ -13564,9 +13678,9 @@ class Uo extends BI {
|
|
|
13564
13678
|
Q.b,
|
|
13565
13679
|
Q.a,
|
|
13566
13680
|
C.size,
|
|
13567
|
-
|
|
13681
|
+
NC[C.marker]
|
|
13568
13682
|
];
|
|
13569
|
-
}), B = new
|
|
13683
|
+
}), B = new mA(I, [], "points");
|
|
13570
13684
|
B.addAttribute({
|
|
13571
13685
|
type: "position",
|
|
13572
13686
|
itemSize: 3,
|
|
@@ -13583,17 +13697,17 @@ class Uo extends BI {
|
|
|
13583
13697
|
type: "marker",
|
|
13584
13698
|
itemSize: 1,
|
|
13585
13699
|
offset: B.strideBytes
|
|
13586
|
-
}), this.geometry = B, this.setTexture(0,
|
|
13700
|
+
}), this.geometry = B, this.setTexture(0, Co());
|
|
13587
13701
|
}
|
|
13588
13702
|
get type() {
|
|
13589
13703
|
return "PointsRenderable";
|
|
13590
13704
|
}
|
|
13591
13705
|
}
|
|
13592
13706
|
let VI;
|
|
13593
|
-
function Bo() {
|
|
13594
|
-
return VI || (VI = Co()), VI;
|
|
13595
|
-
}
|
|
13596
13707
|
function Co() {
|
|
13708
|
+
return VI || (VI = Qo()), VI;
|
|
13709
|
+
}
|
|
13710
|
+
function Qo() {
|
|
13597
13711
|
const g = (a) => {
|
|
13598
13712
|
const s = new Float32Array(a * a);
|
|
13599
13713
|
return s.fill(1), s;
|
|
@@ -13615,11 +13729,11 @@ function Co() {
|
|
|
13615
13729
|
triangle: I(256)
|
|
13616
13730
|
}, E = Object.keys(Q).length, i = new Float32Array(E * 65536);
|
|
13617
13731
|
for (const [a, s] of Object.entries(Q))
|
|
13618
|
-
i.set(s,
|
|
13619
|
-
const o = new
|
|
13732
|
+
i.set(s, NC[a] * 65536);
|
|
13733
|
+
const o = new Bo(i, 256, 256);
|
|
13620
13734
|
return o.wrapR = "clamp_to_edge", o.wrapS = "clamp_to_edge", o.wrapT = "clamp_to_edge", o;
|
|
13621
13735
|
}
|
|
13622
|
-
class
|
|
13736
|
+
class TB {
|
|
13623
13737
|
radius;
|
|
13624
13738
|
phi;
|
|
13625
13739
|
theta;
|
|
@@ -13635,26 +13749,38 @@ class xB {
|
|
|
13635
13749
|
);
|
|
13636
13750
|
}
|
|
13637
13751
|
}
|
|
13638
|
-
const vI = -1,
|
|
13639
|
-
class
|
|
13752
|
+
const vI = -1, xB = 0, Eo = 1, WB = 9e-3, io = 1e-3, oo = 9e-4, ao = 0.5, so = 60;
|
|
13753
|
+
class Lo {
|
|
13640
13754
|
camera_;
|
|
13641
|
-
orbitVelocity_ = new
|
|
13755
|
+
orbitVelocity_ = new TB(0, 0, 0);
|
|
13642
13756
|
panVelocity_ = d();
|
|
13643
13757
|
currPos_;
|
|
13644
13758
|
currCenter_ = d();
|
|
13645
13759
|
dampingFactor_;
|
|
13646
13760
|
currMouseButton_ = vI;
|
|
13647
13761
|
constructor(A, I) {
|
|
13648
|
-
this.camera_ = A, this.currPos_ = new
|
|
13762
|
+
this.camera_ = A, this.currPos_ = new TB(
|
|
13649
13763
|
I?.radius ?? 1,
|
|
13650
13764
|
I?.yaw ?? 0,
|
|
13651
13765
|
I?.pitch ?? 0
|
|
13652
|
-
), I?.target &&
|
|
13653
|
-
I?.dampingFactor ??
|
|
13766
|
+
), I?.target && jI(this.currCenter_, I.target), this.dampingFactor_ = hA(
|
|
13767
|
+
I?.dampingFactor ?? ao,
|
|
13654
13768
|
0,
|
|
13655
13769
|
1
|
|
13656
13770
|
), this.updateCamera();
|
|
13657
13771
|
}
|
|
13772
|
+
get radius() {
|
|
13773
|
+
return this.currPos_.radius;
|
|
13774
|
+
}
|
|
13775
|
+
get yaw() {
|
|
13776
|
+
return this.currPos_.phi;
|
|
13777
|
+
}
|
|
13778
|
+
get pitch() {
|
|
13779
|
+
return this.currPos_.theta;
|
|
13780
|
+
}
|
|
13781
|
+
get target() {
|
|
13782
|
+
return EA(this.currCenter_);
|
|
13783
|
+
}
|
|
13658
13784
|
get isMoving() {
|
|
13659
13785
|
return this.orbitVelocity_.phi !== 0 || this.orbitVelocity_.theta !== 0 || this.orbitVelocity_.radius !== 0 || this.panVelocity_[0] !== 0 || this.panVelocity_[1] !== 0 || this.panVelocity_[2] !== 0;
|
|
13660
13786
|
}
|
|
@@ -13678,11 +13804,11 @@ class ko {
|
|
|
13678
13804
|
onUpdate(A) {
|
|
13679
13805
|
if (this.orbitVelocity_.phi === 0 && this.orbitVelocity_.theta === 0 && this.orbitVelocity_.radius === 0 && Gg(this.panVelocity_, p(0, 0, 0)))
|
|
13680
13806
|
return;
|
|
13681
|
-
this.currPos_.phi += this.orbitVelocity_.phi, this.currPos_.theta += this.orbitVelocity_.theta, this.currPos_.radius += this.orbitVelocity_.radius * this.currPos_.radius,
|
|
13807
|
+
this.currPos_.phi += this.orbitVelocity_.phi, this.currPos_.theta += this.orbitVelocity_.theta, this.currPos_.radius += this.orbitVelocity_.radius * this.currPos_.radius, aI(this.currCenter_, this.currCenter_, this.panVelocity_);
|
|
13682
13808
|
const I = Math.PI / 2 - T;
|
|
13683
13809
|
this.currPos_.theta = hA(this.currPos_.theta, -I, I), this.currPos_.radius = Math.max(0.01, this.currPos_.radius), this.updateCamera();
|
|
13684
|
-
const B = Math.pow(1 - this.dampingFactor_, A *
|
|
13685
|
-
this.orbitVelocity_.phi *= B, this.orbitVelocity_.theta *= B, this.orbitVelocity_.radius *= B,
|
|
13810
|
+
const B = Math.pow(1 - this.dampingFactor_, A * so);
|
|
13811
|
+
this.orbitVelocity_.phi *= B, this.orbitVelocity_.theta *= B, this.orbitVelocity_.radius *= B, zI(this.panVelocity_, this.panVelocity_, B), this.cutoffLowVelocity();
|
|
13686
13812
|
}
|
|
13687
13813
|
onPointerDown(A) {
|
|
13688
13814
|
const I = A.event;
|
|
@@ -13690,7 +13816,7 @@ class ko {
|
|
|
13690
13816
|
}
|
|
13691
13817
|
onPointerMove(A) {
|
|
13692
13818
|
if (this.currMouseButton_ == vI) return;
|
|
13693
|
-
const I = A.event, B = I.movementX ?? 0, C = I.movementY ?? 0, Q = this.currMouseButton_ ===
|
|
13819
|
+
const I = A.event, B = I.movementX ?? 0, C = I.movementY ?? 0, Q = this.currMouseButton_ === xB && !I.shiftKey, E = this.currMouseButton_ === xB && I.shiftKey || this.currMouseButton_ === Eo;
|
|
13694
13820
|
Q && this.orbit(B, C), E && this.pan(B, C);
|
|
13695
13821
|
}
|
|
13696
13822
|
onWheel(A) {
|
|
@@ -13705,33 +13831,33 @@ class ko {
|
|
|
13705
13831
|
I.target?.releasePointerCapture?.(I.pointerId);
|
|
13706
13832
|
}
|
|
13707
13833
|
orbit(A, I) {
|
|
13708
|
-
this.orbitVelocity_.phi -= A *
|
|
13834
|
+
this.orbitVelocity_.phi -= A * WB, this.orbitVelocity_.theta += I * WB;
|
|
13709
13835
|
}
|
|
13710
13836
|
pan(A, I) {
|
|
13711
|
-
const B = this.currPos_.radius *
|
|
13712
|
-
_I(C, C, this.camera_.right, A), _I(C, C, this.camera_.up, I),
|
|
13837
|
+
const B = this.currPos_.radius * io, C = d();
|
|
13838
|
+
_I(C, C, this.camera_.right, A), _I(C, C, this.camera_.up, I), zI(C, C, B), $I(this.panVelocity_, this.panVelocity_, C);
|
|
13713
13839
|
}
|
|
13714
13840
|
zoom(A) {
|
|
13715
|
-
this.orbitVelocity_.radius += A *
|
|
13841
|
+
this.orbitVelocity_.radius += A * oo;
|
|
13716
13842
|
}
|
|
13717
13843
|
updateCamera() {
|
|
13718
|
-
const A =
|
|
13844
|
+
const A = aI(d(), this.currCenter_, this.currPos_.toVec3());
|
|
13719
13845
|
this.camera_.transform.setTranslation(A), this.camera_.transform.targetTo(this.currCenter_);
|
|
13720
13846
|
}
|
|
13721
13847
|
cutoffLowVelocity() {
|
|
13722
13848
|
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), yg(this.panVelocity_) < T && $C(this.panVelocity_);
|
|
13723
13849
|
}
|
|
13724
13850
|
}
|
|
13725
|
-
class
|
|
13851
|
+
class Do {
|
|
13726
13852
|
planes_;
|
|
13727
13853
|
constructor(A) {
|
|
13728
13854
|
this.planes_ = [
|
|
13729
|
-
new
|
|
13730
|
-
new
|
|
13731
|
-
new
|
|
13732
|
-
new
|
|
13733
|
-
new
|
|
13734
|
-
new
|
|
13855
|
+
new sA(d(), 0),
|
|
13856
|
+
new sA(d(), 0),
|
|
13857
|
+
new sA(d(), 0),
|
|
13858
|
+
new sA(d(), 0),
|
|
13859
|
+
new sA(d(), 0),
|
|
13860
|
+
new sA(d(), 0)
|
|
13735
13861
|
], this.setWithViewProjection(A);
|
|
13736
13862
|
}
|
|
13737
13863
|
// Uses the fast plane-extraction algorithm described in
|
|
@@ -13768,8 +13894,8 @@ class so {
|
|
|
13768
13894
|
return !0;
|
|
13769
13895
|
}
|
|
13770
13896
|
}
|
|
13771
|
-
class
|
|
13772
|
-
transform_ = new
|
|
13897
|
+
class cC extends YI {
|
|
13898
|
+
transform_ = new eC();
|
|
13773
13899
|
projectionMatrix_ = $();
|
|
13774
13900
|
near_ = 0;
|
|
13775
13901
|
far_ = 0;
|
|
@@ -13794,10 +13920,10 @@ class UC extends JI {
|
|
|
13794
13920
|
return p(A[4], A[5], A[6]);
|
|
13795
13921
|
}
|
|
13796
13922
|
getViewProjection() {
|
|
13797
|
-
return
|
|
13923
|
+
return QI($(), this.projectionMatrix, this.viewMatrix);
|
|
13798
13924
|
}
|
|
13799
13925
|
get frustum() {
|
|
13800
|
-
return new
|
|
13926
|
+
return new Do(this.getViewProjection());
|
|
13801
13927
|
}
|
|
13802
13928
|
pan(A) {
|
|
13803
13929
|
this.transform.addTranslation(A);
|
|
@@ -13806,30 +13932,30 @@ class UC extends JI {
|
|
|
13806
13932
|
return this.transform.translation;
|
|
13807
13933
|
}
|
|
13808
13934
|
clipToWorld(A) {
|
|
13809
|
-
const I =
|
|
13935
|
+
const I = DI(A[0], A[1], A[2], 1), B = OA(
|
|
13810
13936
|
$(),
|
|
13811
13937
|
this.projectionMatrix_
|
|
13812
|
-
), C =
|
|
13813
|
-
|
|
13938
|
+
), C = VA(
|
|
13939
|
+
YA(),
|
|
13814
13940
|
I,
|
|
13815
13941
|
B
|
|
13816
13942
|
);
|
|
13817
13943
|
BQ(C, C, 1 / C[3]);
|
|
13818
|
-
const Q =
|
|
13819
|
-
|
|
13944
|
+
const Q = VA(
|
|
13945
|
+
YA(),
|
|
13820
13946
|
C,
|
|
13821
13947
|
this.transform.matrix
|
|
13822
13948
|
);
|
|
13823
13949
|
return p(Q[0], Q[1], Q[2]);
|
|
13824
13950
|
}
|
|
13825
13951
|
}
|
|
13826
|
-
const
|
|
13827
|
-
class
|
|
13952
|
+
const UC = 1.77, bB = 128, ZB = 128 / UC, ho = -1e6, to = 1e6;
|
|
13953
|
+
class Jo extends cC {
|
|
13828
13954
|
// width_ and height_ should always be defined by constructor (see setFrame)
|
|
13829
|
-
width_ =
|
|
13830
|
-
height_ =
|
|
13831
|
-
viewportAspectRatio_ =
|
|
13832
|
-
viewportSize_ = [
|
|
13955
|
+
width_ = bB;
|
|
13956
|
+
height_ = ZB;
|
|
13957
|
+
viewportAspectRatio_ = UC;
|
|
13958
|
+
viewportSize_ = [bB, ZB];
|
|
13833
13959
|
axes_;
|
|
13834
13960
|
rotation_;
|
|
13835
13961
|
orientation_;
|
|
@@ -13841,7 +13967,7 @@ class Lo extends UC {
|
|
|
13841
13967
|
* the camera faces (default `"XY"`).
|
|
13842
13968
|
*/
|
|
13843
13969
|
constructor(A) {
|
|
13844
|
-
super(), this.near_ = A.near ??
|
|
13970
|
+
super(), this.near_ = A.near ?? ho, this.far_ = A.far ?? to, this.orientation_ = A.orientation ?? "XY", this.axes_ = MA(this.orientation_), this.rotation_ = dA(this.axes_), this.setFrame(A), this.updateProjectionMatrix();
|
|
13845
13971
|
}
|
|
13846
13972
|
get viewportSize() {
|
|
13847
13973
|
return this.viewportSize_;
|
|
@@ -13869,7 +13995,7 @@ class Lo extends UC {
|
|
|
13869
13995
|
if (A === this.orientation_)
|
|
13870
13996
|
return;
|
|
13871
13997
|
const I = this.transform.translation[W[this.axes_.u]], B = this.transform.translation[W[this.axes_.v]];
|
|
13872
|
-
this.orientation_ = A, this.axes_ =
|
|
13998
|
+
this.orientation_ = A, this.axes_ = MA(A), this.rotation_ = dA(this.axes_);
|
|
13873
13999
|
const C = d();
|
|
13874
14000
|
C[W[this.axes_.u]] = I, C[W[this.axes_.v]] = B, this.transform.setTranslation(C), this.transform.setRotation(this.rotation_);
|
|
13875
14001
|
}
|
|
@@ -13880,9 +14006,9 @@ class Lo extends UC {
|
|
|
13880
14006
|
this.transform.addScale([I, I, 1]);
|
|
13881
14007
|
}
|
|
13882
14008
|
getWorldViewRect() {
|
|
13883
|
-
let A =
|
|
13884
|
-
const B =
|
|
13885
|
-
A =
|
|
14009
|
+
let A = DI(-1, -1, 0, 1), I = DI(1, 1, 0, 1);
|
|
14010
|
+
const B = OA($(), this.getViewProjection());
|
|
14011
|
+
A = VA(YA(), A, B), I = VA(YA(), I, B);
|
|
13886
14012
|
const C = W[this.axes_.u], Q = W[this.axes_.v];
|
|
13887
14013
|
return new AA(
|
|
13888
14014
|
V(A[C], A[Q]),
|
|
@@ -13892,7 +14018,7 @@ class Lo extends UC {
|
|
|
13892
14018
|
updateProjectionMatrix() {
|
|
13893
14019
|
const A = this.width_, I = this.height_, B = A / I;
|
|
13894
14020
|
let C = 0.5 * A, Q = 0.5 * I;
|
|
13895
|
-
this.viewportAspectRatio_ > B ? C *= this.viewportAspectRatio_ / B : Q *= B / this.viewportAspectRatio_, this.viewportSize_ = [2 * C, 2 * Q],
|
|
14021
|
+
this.viewportAspectRatio_ > B ? C *= this.viewportAspectRatio_ / B : Q *= B / this.viewportAspectRatio_, this.viewportSize_ = [2 * C, 2 * Q], vC(
|
|
13896
14022
|
this.projectionMatrix_,
|
|
13897
14023
|
-C,
|
|
13898
14024
|
C,
|
|
@@ -13903,8 +14029,8 @@ class Lo extends UC {
|
|
|
13903
14029
|
);
|
|
13904
14030
|
}
|
|
13905
14031
|
}
|
|
13906
|
-
const
|
|
13907
|
-
class
|
|
14032
|
+
const PB = 0;
|
|
14033
|
+
class Yo {
|
|
13908
14034
|
camera_;
|
|
13909
14035
|
dragActive_ = !1;
|
|
13910
14036
|
dragStart_ = d();
|
|
@@ -13937,14 +14063,14 @@ class Jo {
|
|
|
13937
14063
|
if (!A.worldPos || !A.clipPos) return;
|
|
13938
14064
|
const I = A.event;
|
|
13939
14065
|
I.preventDefault();
|
|
13940
|
-
const B =
|
|
14066
|
+
const B = EA(A.worldPos), C = I.deltaY < 0 ? 1.05 : 0.95;
|
|
13941
14067
|
this.camera_.zoom(C);
|
|
13942
14068
|
const Q = this.camera_.clipToWorld(A.clipPos), E = $I(d(), B, Q);
|
|
13943
14069
|
this.camera_.pan(E);
|
|
13944
14070
|
}
|
|
13945
14071
|
onPointerDown(A) {
|
|
13946
14072
|
const I = A.event;
|
|
13947
|
-
!A.worldPos || I.button !==
|
|
14073
|
+
!A.worldPos || I.button !== PB || (this.dragStart_ = EA(A.worldPos), this.dragActive_ = !0, I.target?.setPointerCapture?.(I.pointerId));
|
|
13948
14074
|
}
|
|
13949
14075
|
onPointerMove(A) {
|
|
13950
14076
|
if (!this.dragActive_ || !A.worldPos) return;
|
|
@@ -13953,17 +14079,17 @@ class Jo {
|
|
|
13953
14079
|
}
|
|
13954
14080
|
onPointerEnd(A) {
|
|
13955
14081
|
const I = A.event;
|
|
13956
|
-
!this.dragActive_ || I.button !==
|
|
14082
|
+
!this.dragActive_ || I.button !== PB || (this.dragActive_ = !1, I.target?.releasePointerCapture?.(I.pointerId));
|
|
13957
14083
|
}
|
|
13958
14084
|
}
|
|
13959
|
-
const
|
|
13960
|
-
class
|
|
14085
|
+
const yo = 60, eo = 1.77, oI = 0.1, XI = 180 - oI;
|
|
14086
|
+
class Mo extends cC {
|
|
13961
14087
|
fov_;
|
|
13962
14088
|
aspectRatio_;
|
|
13963
14089
|
constructor(A = {}) {
|
|
13964
14090
|
const {
|
|
13965
|
-
fov: I =
|
|
13966
|
-
aspectRatio: B =
|
|
14091
|
+
fov: I = yo,
|
|
14092
|
+
aspectRatio: B = eo,
|
|
13967
14093
|
near: C = 0.1,
|
|
13968
14094
|
far: Q = 1e4,
|
|
13969
14095
|
position: E = p(0, 0, 0)
|
|
@@ -13989,9 +14115,9 @@ class Yo extends UC {
|
|
|
13989
14115
|
this.fov_ = Math.max(oI, Math.min(XI, this.fov_ / A)), this.updateProjectionMatrix();
|
|
13990
14116
|
}
|
|
13991
14117
|
updateProjectionMatrix() {
|
|
13992
|
-
|
|
14118
|
+
OC(
|
|
13993
14119
|
this.projectionMatrix_,
|
|
13994
|
-
|
|
14120
|
+
TC(this.fov),
|
|
13995
14121
|
this.aspectRatio_,
|
|
13996
14122
|
this.near_,
|
|
13997
14123
|
this.far_
|
|
@@ -13999,30 +14125,30 @@ class Yo extends UC {
|
|
|
13999
14125
|
}
|
|
14000
14126
|
}
|
|
14001
14127
|
export {
|
|
14002
|
-
|
|
14128
|
+
Ro as AxesLayer,
|
|
14003
14129
|
x as Color,
|
|
14004
|
-
|
|
14005
|
-
|
|
14006
|
-
|
|
14007
|
-
|
|
14008
|
-
|
|
14130
|
+
no as Idetik,
|
|
14131
|
+
rC as ImageLayer,
|
|
14132
|
+
Ti as ImageRenderable,
|
|
14133
|
+
go as LabelImageRenderable,
|
|
14134
|
+
RC as LabelLayer,
|
|
14009
14135
|
qI as Layer,
|
|
14010
|
-
|
|
14011
|
-
|
|
14012
|
-
|
|
14013
|
-
|
|
14014
|
-
|
|
14015
|
-
|
|
14016
|
-
|
|
14017
|
-
|
|
14018
|
-
|
|
14136
|
+
ZA as OmeZarrImageSource,
|
|
14137
|
+
Lo as OrbitControls,
|
|
14138
|
+
Jo as OrthographicCamera,
|
|
14139
|
+
Yo as PanZoomControls,
|
|
14140
|
+
Mo as PerspectiveCamera,
|
|
14141
|
+
ko as PointsRenderable,
|
|
14142
|
+
pi as ProjectedLineRenderable,
|
|
14143
|
+
Uo as VolumeLayer,
|
|
14144
|
+
bi as VolumeRenderable,
|
|
14019
14145
|
ug as createExplorationPolicy,
|
|
14020
14146
|
mg as createImageSourcePolicy,
|
|
14021
|
-
|
|
14022
|
-
|
|
14023
|
-
|
|
14024
|
-
|
|
14025
|
-
|
|
14026
|
-
|
|
14147
|
+
co as createNoPrefetchPolicy,
|
|
14148
|
+
No as createPlaybackPolicy,
|
|
14149
|
+
wo as loadOmeZarrPlate,
|
|
14150
|
+
Fo as loadOmeZarrWell,
|
|
14151
|
+
ro as loadOmeroChannels,
|
|
14152
|
+
So as loadOmeroDefaults
|
|
14027
14153
|
};
|
|
14028
14154
|
//# sourceMappingURL=index.js.map
|