@idetik/core 0.12.0 → 0.13.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 +3 -3
- package/dist/index.js +875 -766
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +86 -54
- package/dist/index.umd.cjs.map +1 -1
- package/dist/types/src/core/color.d.ts +1 -1
- package/dist/types/src/core/color.d.ts.map +1 -1
- package/dist/types/src/layers/volume_layer.d.ts +2 -2
- package/dist/types/src/layers/volume_layer.d.ts.map +1 -1
- package/dist/types/src/objects/renderable/volume_renderable.d.ts +14 -4
- package/dist/types/src/objects/renderable/volume_renderable.d.ts.map +1 -1
- package/dist/types/src/renderers/webgl_shader_program.d.ts.map +1 -1
- package/dist/types/src/utilities/logger.d.ts +1 -1
- package/dist/types/src/utilities/logger.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
class
|
|
2
|
-
static RED = new
|
|
3
|
-
static GREEN = new
|
|
4
|
-
static BLUE = new
|
|
5
|
-
static YELLOW = new
|
|
6
|
-
static MAGENTA = new
|
|
7
|
-
static CYAN = new
|
|
8
|
-
static BLACK = new
|
|
9
|
-
static WHITE = new
|
|
10
|
-
static TRANSPARENT = new
|
|
1
|
+
class l {
|
|
2
|
+
static RED = new l(1, 0, 0);
|
|
3
|
+
static GREEN = new l(0, 1, 0);
|
|
4
|
+
static BLUE = new l(0, 0, 1);
|
|
5
|
+
static YELLOW = new l(1, 1, 0);
|
|
6
|
+
static MAGENTA = new l(1, 0, 1);
|
|
7
|
+
static CYAN = new l(0, 1, 1);
|
|
8
|
+
static BLACK = new l(0, 0, 0);
|
|
9
|
+
static WHITE = new l(1, 1, 1);
|
|
10
|
+
static TRANSPARENT = new l(0, 0, 0, 0);
|
|
11
11
|
// RGBA color values in the range [0, 1]
|
|
12
12
|
rgba_;
|
|
13
13
|
constructor(A, I, B, C) {
|
|
@@ -42,17 +42,19 @@ class p {
|
|
|
42
42
|
return Math.round(this.r * 255) << 24 | Math.round(this.g * 255) << 16 | Math.round(this.b * 255) << 8 | Math.round(this.a * 255);
|
|
43
43
|
}
|
|
44
44
|
static from(A) {
|
|
45
|
-
if (A instanceof
|
|
45
|
+
if (A instanceof l)
|
|
46
46
|
return A;
|
|
47
47
|
if (Array.isArray(A))
|
|
48
|
-
return new
|
|
48
|
+
return new l(A[0], A[1], A[2], A[3]);
|
|
49
|
+
if (typeof A == "string")
|
|
50
|
+
return l.fromRgbHex(A);
|
|
49
51
|
throw new Error("Unsupported color format");
|
|
50
52
|
}
|
|
51
53
|
static fromRgbHex(A) {
|
|
52
54
|
const I = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(A);
|
|
53
55
|
if (!I)
|
|
54
56
|
throw new Error("Invalid RGB hex, use form '#RRGGBB'");
|
|
55
|
-
return new
|
|
57
|
+
return new l(
|
|
56
58
|
parseInt(I[1], 16) / 255,
|
|
57
59
|
parseInt(I[2], 16) / 255,
|
|
58
60
|
parseInt(I[3], 16) / 255,
|
|
@@ -64,11 +66,11 @@ class p {
|
|
|
64
66
|
return I.length === 1 ? "0" + I : I;
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
|
-
class
|
|
69
|
+
class sC {
|
|
68
70
|
canvas_;
|
|
69
71
|
width_ = 0;
|
|
70
72
|
height_ = 0;
|
|
71
|
-
backgroundColor_ = new
|
|
73
|
+
backgroundColor_ = new l(0, 0, 0, 0);
|
|
72
74
|
renderedObjects_ = 0;
|
|
73
75
|
constructor(A) {
|
|
74
76
|
this.canvas_ = A, this.updateRendererSize();
|
|
@@ -95,10 +97,10 @@ class aC {
|
|
|
95
97
|
return this.renderedObjects_;
|
|
96
98
|
}
|
|
97
99
|
set backgroundColor(A) {
|
|
98
|
-
this.backgroundColor_ =
|
|
100
|
+
this.backgroundColor_ = l.from(A);
|
|
99
101
|
}
|
|
100
102
|
}
|
|
101
|
-
var
|
|
103
|
+
var DC = `#version 300 es
|
|
102
104
|
|
|
103
105
|
const float PI = 3.14159265;
|
|
104
106
|
|
|
@@ -164,7 +166,7 @@ void main() {
|
|
|
164
166
|
|
|
165
167
|
|
|
166
168
|
gl_PointSize = 5.0;
|
|
167
|
-
}`,
|
|
169
|
+
}`, hC = `#version 300 es
|
|
168
170
|
|
|
169
171
|
precision mediump float;
|
|
170
172
|
|
|
@@ -188,7 +190,7 @@ out vec2 TexCoords;
|
|
|
188
190
|
void main() {
|
|
189
191
|
TexCoords = inUV;
|
|
190
192
|
gl_Position = Projection * ModelView * vec4(inPosition, 1.0);
|
|
191
|
-
}`,
|
|
193
|
+
}`, PI = `#version 300 es
|
|
192
194
|
#pragma inject_defines
|
|
193
195
|
|
|
194
196
|
precision mediump float;
|
|
@@ -214,7 +216,7 @@ void main() {
|
|
|
214
216
|
float texel = float(texture(ImageSampler, TexCoords).r);
|
|
215
217
|
float value = (texel + ValueOffset) * ValueScale;
|
|
216
218
|
fragColor = vec4(value * Color, u_opacity);
|
|
217
|
-
}`,
|
|
219
|
+
}`, OI = `#version 300 es
|
|
218
220
|
#pragma inject_defines
|
|
219
221
|
|
|
220
222
|
precision mediump float;
|
|
@@ -251,7 +253,7 @@ void main() {
|
|
|
251
253
|
rgbColor += value * Color[i];
|
|
252
254
|
}
|
|
253
255
|
fragColor = vec4(rgbColor, u_opacity);
|
|
254
|
-
}`,
|
|
256
|
+
}`, tC = `#version 300 es
|
|
255
257
|
|
|
256
258
|
precision mediump float;
|
|
257
259
|
|
|
@@ -271,7 +273,7 @@ void main() {
|
|
|
271
273
|
gl_PointSize = inSize;
|
|
272
274
|
color = inColor;
|
|
273
275
|
marker = uint(inMarker);
|
|
274
|
-
}`,
|
|
276
|
+
}`, yC = `#version 300 es
|
|
275
277
|
|
|
276
278
|
precision mediump float;
|
|
277
279
|
|
|
@@ -291,7 +293,7 @@ void main() {
|
|
|
291
293
|
discard;
|
|
292
294
|
}
|
|
293
295
|
fragColor = vec4(color.rgb, u_opacity * alpha * color.a);
|
|
294
|
-
}`,
|
|
296
|
+
}`, eC = `#version 300 es
|
|
295
297
|
|
|
296
298
|
layout (location = 0) in vec3 inPosition;
|
|
297
299
|
layout (location = 1) in vec3 inNormal;
|
|
@@ -301,7 +303,7 @@ uniform mat4 ModelView;
|
|
|
301
303
|
|
|
302
304
|
void main() {
|
|
303
305
|
gl_Position = Projection * ModelView * vec4(inPosition, 1.0);
|
|
304
|
-
}`,
|
|
306
|
+
}`, GC = `#version 300 es
|
|
305
307
|
|
|
306
308
|
precision mediump float;
|
|
307
309
|
|
|
@@ -312,7 +314,7 @@ uniform vec3 u_color;
|
|
|
312
314
|
|
|
313
315
|
void main() {
|
|
314
316
|
fragColor = vec4(u_color, u_opacity);
|
|
315
|
-
}`,
|
|
317
|
+
}`, VI = `#version 300 es
|
|
316
318
|
|
|
317
319
|
precision highp float;
|
|
318
320
|
|
|
@@ -325,35 +327,48 @@ out highp vec3 PositionModel;
|
|
|
325
327
|
void main() {
|
|
326
328
|
PositionModel = inPosition;
|
|
327
329
|
gl_Position = Projection * ModelView * vec4(inPosition, 1.0);
|
|
328
|
-
}`,
|
|
330
|
+
}`, vI = `#version 300 es
|
|
329
331
|
#pragma inject_defines
|
|
330
|
-
|
|
331
332
|
precision highp float;
|
|
332
333
|
|
|
333
334
|
layout (location = 0) out vec4 fragColor;
|
|
334
335
|
|
|
335
336
|
#if defined TEXTURE_DATA_TYPE_INT
|
|
336
|
-
|
|
337
|
+
precision mediump isampler3D;
|
|
338
|
+
uniform isampler3D Channel0Sampler;
|
|
339
|
+
uniform isampler3D Channel1Sampler;
|
|
340
|
+
uniform isampler3D Channel2Sampler;
|
|
341
|
+
uniform isampler3D Channel3Sampler;
|
|
337
342
|
#elif defined TEXTURE_DATA_TYPE_UINT
|
|
338
|
-
|
|
343
|
+
precision mediump usampler3D;
|
|
344
|
+
uniform usampler3D Channel0Sampler;
|
|
345
|
+
uniform usampler3D Channel1Sampler;
|
|
346
|
+
uniform usampler3D Channel2Sampler;
|
|
347
|
+
uniform usampler3D Channel3Sampler;
|
|
339
348
|
#else
|
|
340
|
-
|
|
349
|
+
precision mediump sampler3D;
|
|
350
|
+
uniform sampler3D Channel0Sampler;
|
|
351
|
+
uniform sampler3D Channel1Sampler;
|
|
352
|
+
uniform sampler3D Channel2Sampler;
|
|
353
|
+
uniform sampler3D Channel3Sampler;
|
|
341
354
|
#endif
|
|
342
355
|
|
|
343
356
|
uniform highp vec3 CameraPositionModel;
|
|
357
|
+
uniform vec3 VoxelScale;
|
|
344
358
|
in highp vec3 PositionModel;
|
|
345
359
|
|
|
346
360
|
vec3 boundingboxMin = vec3(-0.50);
|
|
347
361
|
vec3 boundingboxMax = vec3(0.50);
|
|
348
362
|
|
|
349
363
|
uniform bool DebugShowDegenerateRays;
|
|
364
|
+
uniform float RelativeStepSize;
|
|
350
365
|
uniform float OpacityMultiplier;
|
|
351
366
|
uniform float EarlyTerminationAlpha;
|
|
352
|
-
|
|
353
|
-
uniform
|
|
354
|
-
uniform
|
|
355
|
-
uniform
|
|
356
|
-
uniform vec3
|
|
367
|
+
|
|
368
|
+
uniform vec4 Visible;
|
|
369
|
+
uniform vec4 ValueOffset;
|
|
370
|
+
uniform vec4 ValueScale;
|
|
371
|
+
uniform vec3 Color[4];
|
|
357
372
|
|
|
358
373
|
vec2 findBoxIntersectionsAlongRay(vec3 rayOrigin, vec3 rayDir, vec3 boxMin, vec3 boxMax) {
|
|
359
374
|
vec3 reciprocalRayDir = 1.0 / rayDir;
|
|
@@ -371,6 +386,25 @@ vec2 findBoxIntersectionsAlongRay(vec3 rayOrigin, vec3 rayDir, vec3 boxMin, vec3
|
|
|
371
386
|
return vec2(tEnter, tExit);
|
|
372
387
|
}
|
|
373
388
|
|
|
389
|
+
vec4 sampleChannels(vec3 uvw) {
|
|
390
|
+
vec4 c = vec4(0.0);
|
|
391
|
+
|
|
392
|
+
if (bool(Visible.x)) c.x = float(texture(Channel0Sampler, uvw).r);
|
|
393
|
+
if (bool(Visible.y)) c.y = float(texture(Channel1Sampler, uvw).r);
|
|
394
|
+
if (bool(Visible.z)) c.z = float(texture(Channel2Sampler, uvw).r);
|
|
395
|
+
if (bool(Visible.w)) c.w = float(texture(Channel3Sampler, uvw).r);
|
|
396
|
+
|
|
397
|
+
return (c + ValueOffset) * ValueScale;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
vec3 getTextureSize() {
|
|
401
|
+
if (bool(Visible.x)) return vec3(textureSize(Channel0Sampler, 0));
|
|
402
|
+
else if (bool(Visible.y)) return vec3(textureSize(Channel1Sampler, 0));
|
|
403
|
+
else if (bool(Visible.z)) return vec3(textureSize(Channel2Sampler, 0));
|
|
404
|
+
else if (bool(Visible.w)) return vec3(textureSize(Channel3Sampler, 0));
|
|
405
|
+
return vec3(1.0);
|
|
406
|
+
}
|
|
407
|
+
|
|
374
408
|
void main() {
|
|
375
409
|
|
|
376
410
|
|
|
@@ -392,13 +426,10 @@ void main() {
|
|
|
392
426
|
exitPoint = clamp(exitPoint + 0.5, 0.0, 1.0);
|
|
393
427
|
|
|
394
428
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
429
|
vec3 rayWithinModel = exitPoint - entryPoint;
|
|
399
430
|
|
|
400
431
|
|
|
401
|
-
vec3 textureSize =
|
|
432
|
+
vec3 textureSize = getTextureSize();
|
|
402
433
|
vec3 rayInVoxels = rayWithinModel * textureSize;
|
|
403
434
|
float rayLengthInVoxels = length(rayInVoxels);
|
|
404
435
|
int numSamples = max(int(ceil(rayLengthInVoxels / RelativeStepSize)), 1);
|
|
@@ -410,31 +441,34 @@ void main() {
|
|
|
410
441
|
|
|
411
442
|
vec3 stepInWorldSpace = stepIncrement * textureSize * VoxelScale;
|
|
412
443
|
float worldSpaceStepSize = length(stepInWorldSpace);
|
|
444
|
+
float intensityScale = OpacityMultiplier * worldSpaceStepSize;
|
|
413
445
|
|
|
414
446
|
|
|
415
447
|
vec3 position = entryPoint;
|
|
416
448
|
vec4 accumulatedColor = vec4(0.0);
|
|
417
|
-
float sampledData, sampleAlpha, blendedSampleAlpha;
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
float intensityScale = OpacityMultiplier * worldSpaceStepSize * ValueScale;
|
|
423
449
|
|
|
424
|
-
|
|
450
|
+
vec3 sampleColor = vec3(0.0);
|
|
451
|
+
float sampleAlpha, blendedSampleAlpha;
|
|
425
452
|
for (int i = 0; i < numSamples && accumulatedColor.a < EarlyTerminationAlpha; i++) {
|
|
426
|
-
sampledData = vec4(texture(ImageSampler, position)).r;
|
|
427
|
-
sampleAlpha = (sampledData + ValueOffset) * intensityScale;
|
|
428
|
-
blendedSampleAlpha = (1.0 - accumulatedColor.a) * sampleAlpha;
|
|
429
453
|
|
|
454
|
+
vec4 sampleValues = sampleChannels(position);
|
|
430
455
|
|
|
431
|
-
|
|
432
|
-
|
|
456
|
+
for (int ch = 0; ch < 4; ch++) {
|
|
457
|
+
if (!bool(Visible[ch]) || sampleValues[ch] == 0.0) continue;
|
|
458
|
+
sampleColor = Color[ch];
|
|
459
|
+
sampleAlpha = clamp(sampleValues[ch] * intensityScale, 0.0, 1.0);
|
|
460
|
+
blendedSampleAlpha = (1.0 - accumulatedColor.a) * sampleAlpha;
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
accumulatedColor.a += blendedSampleAlpha;
|
|
464
|
+
accumulatedColor.rgb += sampleColor * blendedSampleAlpha;
|
|
465
|
+
}
|
|
466
|
+
|
|
433
467
|
position += stepIncrement;
|
|
434
468
|
}
|
|
435
469
|
|
|
436
470
|
fragColor = accumulatedColor;
|
|
437
|
-
}`,
|
|
471
|
+
}`, nC = `#version 300 es
|
|
438
472
|
|
|
439
473
|
precision mediump float;
|
|
440
474
|
precision highp int;
|
|
@@ -524,63 +558,63 @@ void main() {
|
|
|
524
558
|
|
|
525
559
|
fragColor = vec4(color.rgb, alpha);
|
|
526
560
|
}`;
|
|
527
|
-
const
|
|
561
|
+
const wC = {
|
|
528
562
|
projectedLine: {
|
|
529
|
-
vertex:
|
|
530
|
-
fragment:
|
|
563
|
+
vertex: DC,
|
|
564
|
+
fragment: hC
|
|
531
565
|
},
|
|
532
566
|
points: {
|
|
533
|
-
vertex:
|
|
534
|
-
fragment:
|
|
567
|
+
vertex: tC,
|
|
568
|
+
fragment: yC
|
|
535
569
|
},
|
|
536
570
|
wireframe: {
|
|
537
|
-
vertex:
|
|
538
|
-
fragment:
|
|
571
|
+
vertex: eC,
|
|
572
|
+
fragment: GC
|
|
539
573
|
},
|
|
540
574
|
floatScalarImage: {
|
|
541
575
|
vertex: rA,
|
|
542
|
-
fragment:
|
|
576
|
+
fragment: PI
|
|
543
577
|
},
|
|
544
578
|
floatScalarImageArray: {
|
|
545
579
|
vertex: rA,
|
|
546
|
-
fragment:
|
|
580
|
+
fragment: OI
|
|
547
581
|
},
|
|
548
582
|
intScalarImage: {
|
|
549
583
|
vertex: rA,
|
|
550
|
-
fragment:
|
|
584
|
+
fragment: PI,
|
|
551
585
|
fragmentDefines: /* @__PURE__ */ new Map([["TEXTURE_DATA_TYPE_INT", "1"]])
|
|
552
586
|
},
|
|
553
587
|
intScalarImageArray: {
|
|
554
588
|
vertex: rA,
|
|
555
|
-
fragment:
|
|
589
|
+
fragment: OI,
|
|
556
590
|
fragmentDefines: /* @__PURE__ */ new Map([["TEXTURE_DATA_TYPE_INT", "1"]])
|
|
557
591
|
},
|
|
558
592
|
uintScalarImage: {
|
|
559
593
|
vertex: rA,
|
|
560
|
-
fragment:
|
|
594
|
+
fragment: PI,
|
|
561
595
|
fragmentDefines: /* @__PURE__ */ new Map([["TEXTURE_DATA_TYPE_UINT", "1"]])
|
|
562
596
|
},
|
|
563
597
|
uintScalarImageArray: {
|
|
564
598
|
vertex: rA,
|
|
565
|
-
fragment:
|
|
599
|
+
fragment: OI,
|
|
566
600
|
fragmentDefines: /* @__PURE__ */ new Map([["TEXTURE_DATA_TYPE_UINT", "1"]])
|
|
567
601
|
},
|
|
568
602
|
labelImage: {
|
|
569
603
|
vertex: rA,
|
|
570
|
-
fragment:
|
|
604
|
+
fragment: nC
|
|
571
605
|
},
|
|
572
606
|
floatVolume: {
|
|
573
|
-
vertex:
|
|
574
|
-
fragment:
|
|
607
|
+
vertex: VI,
|
|
608
|
+
fragment: vI
|
|
575
609
|
},
|
|
576
610
|
intVolume: {
|
|
577
|
-
vertex:
|
|
578
|
-
fragment:
|
|
611
|
+
vertex: VI,
|
|
612
|
+
fragment: vI,
|
|
579
613
|
fragmentDefines: /* @__PURE__ */ new Map([["TEXTURE_DATA_TYPE_INT", "1"]])
|
|
580
614
|
},
|
|
581
615
|
uintVolume: {
|
|
582
|
-
vertex:
|
|
583
|
-
fragment:
|
|
616
|
+
vertex: VI,
|
|
617
|
+
fragment: vI,
|
|
584
618
|
fragmentDefines: /* @__PURE__ */ new Map([["TEXTURE_DATA_TYPE_UINT", "1"]])
|
|
585
619
|
}
|
|
586
620
|
}, Zg = {
|
|
@@ -588,7 +622,7 @@ const nC = {
|
|
|
588
622
|
info: 20,
|
|
589
623
|
warn: 30,
|
|
590
624
|
error: 40
|
|
591
|
-
},
|
|
625
|
+
}, FC = {
|
|
592
626
|
debug: "\x1B[90m",
|
|
593
627
|
// gray
|
|
594
628
|
info: "\x1B[36m",
|
|
@@ -598,7 +632,7 @@ const nC = {
|
|
|
598
632
|
error: "\x1B[31m"
|
|
599
633
|
// red
|
|
600
634
|
};
|
|
601
|
-
function
|
|
635
|
+
function rC() {
|
|
602
636
|
const g = typeof process < "u" && typeof process.env?.NODE_ENV == "string" ? process.env.NODE_ENV : void 0;
|
|
603
637
|
if (g === "production" || g === "development" || g === "test")
|
|
604
638
|
return g;
|
|
@@ -610,7 +644,7 @@ function FC() {
|
|
|
610
644
|
return "development";
|
|
611
645
|
}
|
|
612
646
|
class U {
|
|
613
|
-
static logLevel_ =
|
|
647
|
+
static logLevel_ = rC() === "production" ? "warn" : "debug";
|
|
614
648
|
static setLogLevel(A) {
|
|
615
649
|
U.logLevel_ = A;
|
|
616
650
|
}
|
|
@@ -628,7 +662,7 @@ class U {
|
|
|
628
662
|
}
|
|
629
663
|
static log(A, I, B, ...C) {
|
|
630
664
|
if (Zg[A] < Zg[U.logLevel_]) return;
|
|
631
|
-
const Q = (/* @__PURE__ */ new Date()).toISOString(), E =
|
|
665
|
+
const Q = (/* @__PURE__ */ new Date()).toISOString(), E = FC[A], i = `[${Q}][${A.toUpperCase()}][${I}]`, o = [`${E}${i}`, B, ...C];
|
|
632
666
|
switch (A) {
|
|
633
667
|
case "debug":
|
|
634
668
|
console.debug(...o);
|
|
@@ -645,7 +679,7 @@ class U {
|
|
|
645
679
|
}
|
|
646
680
|
}
|
|
647
681
|
}
|
|
648
|
-
class
|
|
682
|
+
class SC {
|
|
649
683
|
gl_;
|
|
650
684
|
program_;
|
|
651
685
|
uniformInfo_ = /* @__PURE__ */ new Map();
|
|
@@ -686,6 +720,9 @@ class rC {
|
|
|
686
720
|
case this.gl_.FLOAT_VEC3:
|
|
687
721
|
this.gl_.uniform3fv(B, I);
|
|
688
722
|
break;
|
|
723
|
+
case this.gl_.FLOAT_VEC4:
|
|
724
|
+
this.gl_.uniform4fv(B, I);
|
|
725
|
+
break;
|
|
689
726
|
case this.gl_.FLOAT_MAT4:
|
|
690
727
|
this.gl_.uniformMatrix4fv(B, !1, I);
|
|
691
728
|
break;
|
|
@@ -724,7 +761,7 @@ class rC {
|
|
|
724
761
|
for (let I = 0; I < A; I++) {
|
|
725
762
|
const B = this.gl_.getActiveUniform(this.program_, I);
|
|
726
763
|
if (B) {
|
|
727
|
-
if (!
|
|
764
|
+
if (!NC.has(B.type))
|
|
728
765
|
throw new Error(
|
|
729
766
|
`Unsupported uniform type "${B.type}" (GLenum) found in shader program for uniform "${B.name}"`
|
|
730
767
|
);
|
|
@@ -765,12 +802,13 @@ class rC {
|
|
|
765
802
|
return Array.from(this.uniformInfo_.keys());
|
|
766
803
|
}
|
|
767
804
|
}
|
|
768
|
-
const
|
|
805
|
+
const RC = typeof window < "u" ? [
|
|
769
806
|
WebGL2RenderingContext.BOOL,
|
|
770
807
|
WebGL2RenderingContext.FLOAT,
|
|
771
808
|
WebGL2RenderingContext.INT,
|
|
772
809
|
WebGL2RenderingContext.FLOAT_VEC2,
|
|
773
810
|
WebGL2RenderingContext.FLOAT_VEC3,
|
|
811
|
+
WebGL2RenderingContext.FLOAT_VEC4,
|
|
774
812
|
WebGL2RenderingContext.FLOAT_MAT4,
|
|
775
813
|
WebGL2RenderingContext.SAMPLER_2D,
|
|
776
814
|
WebGL2RenderingContext.SAMPLER_CUBE,
|
|
@@ -789,10 +827,10 @@ const SC = typeof window < "u" ? [
|
|
|
789
827
|
WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_3D,
|
|
790
828
|
WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_CUBE,
|
|
791
829
|
WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_2D_ARRAY
|
|
792
|
-
] : [],
|
|
793
|
-
|
|
794
|
-
),
|
|
795
|
-
class
|
|
830
|
+
] : [], NC = new Set(
|
|
831
|
+
RC
|
|
832
|
+
), XI = "#pragma inject_defines";
|
|
833
|
+
class cC {
|
|
796
834
|
gl_;
|
|
797
835
|
programs_ = /* @__PURE__ */ new Map();
|
|
798
836
|
constructor(A) {
|
|
@@ -801,14 +839,14 @@ class NC {
|
|
|
801
839
|
use(A) {
|
|
802
840
|
let I = this.programs_.get(A);
|
|
803
841
|
if (I === void 0) {
|
|
804
|
-
const B =
|
|
842
|
+
const B = wC[A], C = Pg(
|
|
805
843
|
B.vertex,
|
|
806
844
|
B.vertexDefines
|
|
807
845
|
), Q = Pg(
|
|
808
846
|
B.fragment,
|
|
809
847
|
B.fragmentDefines
|
|
810
848
|
);
|
|
811
|
-
I = new
|
|
849
|
+
I = new SC(
|
|
812
850
|
this.gl_,
|
|
813
851
|
C,
|
|
814
852
|
Q
|
|
@@ -824,14 +862,14 @@ class NC {
|
|
|
824
862
|
}
|
|
825
863
|
function Pg(g, A) {
|
|
826
864
|
if (A === void 0 || A.size == 0) return g;
|
|
827
|
-
if (!g.includes(
|
|
865
|
+
if (!g.includes(XI))
|
|
828
866
|
throw new Error(
|
|
829
|
-
`Shader source does not contain "${
|
|
867
|
+
`Shader source does not contain "${XI}" directive`
|
|
830
868
|
);
|
|
831
869
|
const I = Array(A.entries()).map(([E, i]) => `#define ${E} ${i}`).join(`
|
|
832
870
|
`), C = `#line __LINE__ + ${1 - A.size}`, Q = `${I}
|
|
833
871
|
${C}`;
|
|
834
|
-
return g.replace(
|
|
872
|
+
return g.replace(XI, Q);
|
|
835
873
|
}
|
|
836
874
|
const v = [
|
|
837
875
|
"00",
|
|
@@ -1091,69 +1129,69 @@ const v = [
|
|
|
1091
1129
|
"fe",
|
|
1092
1130
|
"ff"
|
|
1093
1131
|
];
|
|
1094
|
-
function
|
|
1132
|
+
function YB() {
|
|
1095
1133
|
const g = Math.random() * 4294967295 | 0, A = Math.random() * 4294967295 | 0, I = Math.random() * 4294967295 | 0, B = Math.random() * 4294967295 | 0;
|
|
1096
1134
|
return (v[g & 255] + v[g >> 8 & 255] + v[g >> 16 & 255] + v[g >> 24 & 255] + "-" + v[A & 255] + v[A >> 8 & 255] + "-" + v[A >> 16 & 15 | 64] + v[A >> 24 & 255] + "-" + v[I & 63 | 128] + v[I >> 8 & 255] + "-" + v[I >> 16 & 255] + v[I >> 24 & 255] + v[B & 255] + v[B >> 8 & 255] + v[B >> 16 & 255] + v[B >> 24 & 255]).toLowerCase();
|
|
1097
1135
|
}
|
|
1098
|
-
class
|
|
1099
|
-
uuid =
|
|
1136
|
+
class yg {
|
|
1137
|
+
uuid = YB();
|
|
1100
1138
|
}
|
|
1101
|
-
var
|
|
1102
|
-
function
|
|
1103
|
-
return g *
|
|
1139
|
+
var p = 1e-6, b = typeof Float32Array < "u" ? Float32Array : Array, UC = Math.PI / 180;
|
|
1140
|
+
function kC(g) {
|
|
1141
|
+
return g * UC;
|
|
1104
1142
|
}
|
|
1105
1143
|
Math.hypot || (Math.hypot = function() {
|
|
1106
1144
|
for (var g = 0, A = arguments.length; A--; )
|
|
1107
1145
|
g += arguments[A] * arguments[A];
|
|
1108
1146
|
return Math.sqrt(g);
|
|
1109
1147
|
});
|
|
1110
|
-
function
|
|
1148
|
+
function dB() {
|
|
1111
1149
|
var g = new b(9);
|
|
1112
1150
|
return b != 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;
|
|
1113
1151
|
}
|
|
1114
|
-
function
|
|
1152
|
+
function LC(g, A) {
|
|
1115
1153
|
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;
|
|
1116
1154
|
}
|
|
1117
1155
|
function _() {
|
|
1118
1156
|
var g = new b(16);
|
|
1119
1157
|
return b != 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;
|
|
1120
1158
|
}
|
|
1121
|
-
function
|
|
1159
|
+
function uI(g, A) {
|
|
1122
1160
|
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], h = A[9], t = A[10], y = A[11], n = A[12], w = A[13], r = A[14], G = A[15], c = I * i - B * E, N = I * o - C * E, d = I * a - Q * E, L = B * o - C * i, k = B * a - Q * i, T = C * a - Q * o, P = s * w - h * n, O = s * r - t * n, Z = s * G - y * n, V = h * r - t * w, iA = h * G - y * w, oA = t * G - y * r, u = c * oA - N * iA + d * V + L * Z - k * O + T * P;
|
|
1123
1161
|
return u ? (u = 1 / u, g[0] = (i * oA - o * iA + a * V) * u, g[1] = (C * iA - B * oA - Q * V) * u, g[2] = (w * T - r * k + G * L) * u, g[3] = (t * k - h * T - y * L) * u, g[4] = (o * Z - E * oA - a * O) * u, g[5] = (I * oA - C * Z + Q * O) * u, g[6] = (r * d - n * T - G * N) * u, g[7] = (s * T - t * d + y * N) * u, g[8] = (E * iA - i * Z + a * P) * u, g[9] = (B * Z - I * iA - Q * P) * u, g[10] = (n * k - w * d + G * c) * u, g[11] = (h * d - s * k - y * c) * u, g[12] = (i * O - E * V - o * P) * u, g[13] = (I * V - B * O + C * P) * u, g[14] = (w * N - n * L - r * c) * u, g[15] = (s * L - h * N + t * c) * u, g) : null;
|
|
1124
1162
|
}
|
|
1125
|
-
function
|
|
1163
|
+
function zA(g, A, I) {
|
|
1126
1164
|
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], h = A[8], t = A[9], y = A[10], n = A[11], w = A[12], r = A[13], G = A[14], c = A[15], N = I[0], d = I[1], L = I[2], k = I[3];
|
|
1127
1165
|
return g[0] = N * B + d * i + L * h + k * w, g[1] = N * C + d * o + L * t + k * r, g[2] = N * Q + d * a + L * y + k * G, g[3] = N * E + d * s + L * n + k * c, N = I[4], d = I[5], L = I[6], k = I[7], g[4] = N * B + d * i + L * h + k * w, g[5] = N * C + d * o + L * t + k * r, g[6] = N * Q + d * a + L * y + k * G, g[7] = N * E + d * s + L * n + k * c, N = I[8], d = I[9], L = I[10], k = I[11], g[8] = N * B + d * i + L * h + k * w, g[9] = N * C + d * o + L * t + k * r, g[10] = N * Q + d * a + L * y + k * G, g[11] = N * E + d * s + L * n + k * c, N = I[12], d = I[13], L = I[14], k = I[15], g[12] = N * B + d * i + L * h + k * w, g[13] = N * C + d * o + L * t + k * r, g[14] = N * Q + d * a + L * y + k * G, g[15] = N * E + d * s + L * n + k * c, g;
|
|
1128
1166
|
}
|
|
1129
|
-
function
|
|
1167
|
+
function JC(g, A) {
|
|
1130
1168
|
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;
|
|
1131
1169
|
}
|
|
1132
|
-
function
|
|
1170
|
+
function YC(g, A, I, B) {
|
|
1133
1171
|
var C = A[0], Q = A[1], E = A[2], i = A[3], o = C + C, a = Q + Q, s = E + E, h = C * o, t = C * a, y = C * s, n = Q * a, w = Q * s, r = E * s, G = i * o, c = i * a, N = i * s, d = B[0], L = B[1], k = B[2];
|
|
1134
1172
|
return g[0] = (1 - (n + r)) * d, g[1] = (t + N) * d, g[2] = (y - c) * d, g[3] = 0, g[4] = (t - N) * L, g[5] = (1 - (h + r)) * L, g[6] = (w + G) * L, g[7] = 0, g[8] = (y + c) * k, g[9] = (w - G) * k, g[10] = (1 - (h + n)) * k, g[11] = 0, g[12] = I[0], g[13] = I[1], g[14] = I[2], g[15] = 1, g;
|
|
1135
1173
|
}
|
|
1136
|
-
function
|
|
1174
|
+
function dC(g, A, I, B, C) {
|
|
1137
1175
|
var Q = 1 / Math.tan(A / 2), E;
|
|
1138
1176
|
return 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 ? (E = 1 / (B - C), g[10] = (C + B) * E, g[14] = 2 * C * B * E) : (g[10] = -1, g[14] = -2 * B), g;
|
|
1139
1177
|
}
|
|
1140
|
-
var
|
|
1141
|
-
function
|
|
1178
|
+
var MC = dC;
|
|
1179
|
+
function KC(g, A, I, B, C, Q, E) {
|
|
1142
1180
|
var i = 1 / (A - I), o = 1 / (B - C), a = 1 / (Q - E);
|
|
1143
1181
|
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;
|
|
1144
1182
|
}
|
|
1145
|
-
var
|
|
1146
|
-
function
|
|
1183
|
+
var HC = KC;
|
|
1184
|
+
function qC(g, A, I, B) {
|
|
1147
1185
|
var C = A[0], Q = A[1], E = A[2], i = B[0], o = B[1], a = B[2], s = C - I[0], h = Q - I[1], t = E - I[2], y = s * s + h * h + t * t;
|
|
1148
1186
|
y > 0 && (y = 1 / Math.sqrt(y), s *= y, h *= y, t *= y);
|
|
1149
1187
|
var n = o * t - a * h, w = a * s - i * t, r = i * h - o * s;
|
|
1150
1188
|
return y = n * n + w * w + r * r, y > 0 && (y = 1 / Math.sqrt(y), n *= y, w *= y, r *= y), g[0] = n, g[1] = w, g[2] = r, g[3] = 0, g[4] = h * r - t * w, g[5] = t * n - s * r, g[6] = s * w - h * n, g[7] = 0, g[8] = s, g[9] = h, g[10] = t, g[11] = 0, g[12] = C, g[13] = Q, g[14] = E, g[15] = 1, g;
|
|
1151
1189
|
}
|
|
1152
|
-
function
|
|
1153
|
-
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], h = g[9], t = g[10], y = g[11], n = g[12], w = g[13], r = g[14], G = g[15], c = A[0], N = A[1], d = A[2], L = A[3], k = A[4], T = A[5], P = A[6], O = A[7], Z = A[8], V = A[9], iA = A[10], oA = A[11], u = A[12],
|
|
1154
|
-
return Math.abs(I - c) <=
|
|
1190
|
+
function lC(g, A) {
|
|
1191
|
+
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], h = g[9], t = g[10], y = g[11], n = g[12], w = g[13], r = g[14], G = g[15], c = A[0], N = A[1], d = A[2], L = A[3], k = A[4], T = A[5], P = A[6], O = A[7], Z = A[8], V = A[9], iA = A[10], oA = A[11], u = A[12], xg = A[13], Wg = A[14], bg = A[15];
|
|
1192
|
+
return Math.abs(I - c) <= p * Math.max(1, Math.abs(I), Math.abs(c)) && Math.abs(B - N) <= p * Math.max(1, Math.abs(B), Math.abs(N)) && Math.abs(C - d) <= p * Math.max(1, Math.abs(C), Math.abs(d)) && Math.abs(Q - L) <= p * Math.max(1, Math.abs(Q), Math.abs(L)) && Math.abs(E - k) <= p * Math.max(1, Math.abs(E), Math.abs(k)) && Math.abs(i - T) <= p * Math.max(1, Math.abs(i), Math.abs(T)) && Math.abs(o - P) <= p * Math.max(1, Math.abs(o), Math.abs(P)) && Math.abs(a - O) <= p * Math.max(1, Math.abs(a), Math.abs(O)) && Math.abs(s - Z) <= p * Math.max(1, Math.abs(s), Math.abs(Z)) && Math.abs(h - V) <= p * Math.max(1, Math.abs(h), Math.abs(V)) && Math.abs(t - iA) <= p * Math.max(1, Math.abs(t), Math.abs(iA)) && Math.abs(y - oA) <= p * Math.max(1, Math.abs(y), Math.abs(oA)) && Math.abs(n - u) <= p * Math.max(1, Math.abs(n), Math.abs(u)) && Math.abs(w - xg) <= p * Math.max(1, Math.abs(w), Math.abs(xg)) && Math.abs(r - Wg) <= p * Math.max(1, Math.abs(r), Math.abs(Wg)) && Math.abs(G - bg) <= p * Math.max(1, Math.abs(G), Math.abs(bg));
|
|
1155
1193
|
}
|
|
1156
|
-
function
|
|
1194
|
+
function f() {
|
|
1157
1195
|
var g = new b(3);
|
|
1158
1196
|
return b != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0), g;
|
|
1159
1197
|
}
|
|
@@ -1161,7 +1199,7 @@ function BA(g) {
|
|
|
1161
1199
|
var A = new b(3);
|
|
1162
1200
|
return A[0] = g[0], A[1] = g[1], A[2] = g[2], A;
|
|
1163
1201
|
}
|
|
1164
|
-
function
|
|
1202
|
+
function eg(g) {
|
|
1165
1203
|
var A = g[0], I = g[1], B = g[2];
|
|
1166
1204
|
return Math.hypot(A, I, B);
|
|
1167
1205
|
}
|
|
@@ -1178,16 +1216,16 @@ function SA(g, A, I, B) {
|
|
|
1178
1216
|
function lA(g, A, I) {
|
|
1179
1217
|
return g[0] = A[0] + I[0], g[1] = A[1] + I[1], g[2] = A[2] + I[2], g;
|
|
1180
1218
|
}
|
|
1181
|
-
function
|
|
1219
|
+
function fC(g, A, I) {
|
|
1182
1220
|
return g[0] = A[0] - I[0], g[1] = A[1] - I[1], g[2] = A[2] - I[2], g;
|
|
1183
1221
|
}
|
|
1184
|
-
function
|
|
1222
|
+
function pC(g, A, I) {
|
|
1185
1223
|
return g[0] = A[0] * I[0], g[1] = A[1] * I[1], g[2] = A[2] * I[2], g;
|
|
1186
1224
|
}
|
|
1187
1225
|
function fA(g, A, I) {
|
|
1188
1226
|
return g[0] = A[0] * I, g[1] = A[1] * I, g[2] = A[2] * I, g;
|
|
1189
1227
|
}
|
|
1190
|
-
function
|
|
1228
|
+
function cI(g, A, I, B) {
|
|
1191
1229
|
return g[0] = A[0] + I[0] * B, g[1] = A[1] + I[1] * B, g[2] = A[2] + I[2] * B, g;
|
|
1192
1230
|
}
|
|
1193
1231
|
function Og(g, A) {
|
|
@@ -1198,35 +1236,35 @@ function Vg(g, A) {
|
|
|
1198
1236
|
var I = A[0] - g[0], B = A[1] - g[1], C = A[2] - g[2];
|
|
1199
1237
|
return I * I + B * B + C * C;
|
|
1200
1238
|
}
|
|
1201
|
-
function
|
|
1239
|
+
function mC(g, A) {
|
|
1202
1240
|
var I = A[0], B = A[1], C = A[2], Q = I * I + B * B + C * C;
|
|
1203
1241
|
return Q > 0 && (Q = 1 / Math.sqrt(Q)), g[0] = A[0] * Q, g[1] = A[1] * Q, g[2] = A[2] * Q, g;
|
|
1204
1242
|
}
|
|
1205
|
-
function
|
|
1243
|
+
function MB(g, A) {
|
|
1206
1244
|
return g[0] * A[0] + g[1] * A[1] + g[2] * A[2];
|
|
1207
1245
|
}
|
|
1208
|
-
function
|
|
1246
|
+
function jI(g, A, I) {
|
|
1209
1247
|
var B = A[0], C = A[1], Q = A[2], E = I[0], i = I[1], o = I[2];
|
|
1210
1248
|
return g[0] = C * o - Q * i, g[1] = Q * E - B * o, g[2] = B * i - C * E, g;
|
|
1211
1249
|
}
|
|
1212
|
-
function
|
|
1250
|
+
function uC(g, A, I, B, C, Q) {
|
|
1213
1251
|
var E = 1 - Q, i = E * E, o = Q * Q, a = i * E, s = 3 * Q * i, h = 3 * o * E, t = o * Q;
|
|
1214
1252
|
return g[0] = A[0] * a + I[0] * s + B[0] * h + C[0] * t, g[1] = A[1] * a + I[1] * s + B[1] * h + C[1] * t, g[2] = A[2] * a + I[2] * s + B[2] * h + C[2] * t, g;
|
|
1215
1253
|
}
|
|
1216
|
-
function
|
|
1254
|
+
function TI(g, A, I) {
|
|
1217
1255
|
var B = A[0], C = A[1], Q = A[2], E = I[3] * B + I[7] * C + I[11] * Q + I[15];
|
|
1218
1256
|
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;
|
|
1219
1257
|
}
|
|
1220
|
-
function
|
|
1258
|
+
function TC(g) {
|
|
1221
1259
|
return g[0] = 0, g[1] = 0, g[2] = 0, g;
|
|
1222
1260
|
}
|
|
1223
|
-
function
|
|
1261
|
+
function KB(g, A) {
|
|
1224
1262
|
var I = g[0], B = g[1], C = g[2], Q = A[0], E = A[1], i = A[2];
|
|
1225
|
-
return Math.abs(I - Q) <=
|
|
1263
|
+
return Math.abs(I - Q) <= p * Math.max(1, Math.abs(I), Math.abs(Q)) && Math.abs(B - E) <= p * Math.max(1, Math.abs(B), Math.abs(E)) && Math.abs(C - i) <= p * Math.max(1, Math.abs(C), Math.abs(i));
|
|
1226
1264
|
}
|
|
1227
|
-
var
|
|
1265
|
+
var UI = fC, xC = eg;
|
|
1228
1266
|
(function() {
|
|
1229
|
-
var g =
|
|
1267
|
+
var g = f();
|
|
1230
1268
|
return function(A, I, B, C, Q, E) {
|
|
1231
1269
|
var i, o;
|
|
1232
1270
|
for (I || (I = 3), B || (B = 0), C ? o = Math.min(C * I + B, A.length) : o = A.length, i = B; i < o; i += I)
|
|
@@ -1242,21 +1280,21 @@ function WC(g) {
|
|
|
1242
1280
|
var A = new b(4);
|
|
1243
1281
|
return A[0] = g[0], A[1] = g[1], A[2] = g[2], A[3] = g[3], A;
|
|
1244
1282
|
}
|
|
1245
|
-
function
|
|
1283
|
+
function kI(g, A, I, B) {
|
|
1246
1284
|
var C = new b(4);
|
|
1247
1285
|
return C[0] = g, C[1] = A, C[2] = I, C[3] = B, C;
|
|
1248
1286
|
}
|
|
1249
|
-
function
|
|
1287
|
+
function bC(g, A) {
|
|
1250
1288
|
return g[0] = A[0], g[1] = A[1], g[2] = A[2], g[3] = A[3], g;
|
|
1251
1289
|
}
|
|
1252
|
-
function
|
|
1290
|
+
function ZC(g, A, I) {
|
|
1253
1291
|
return g[0] = A[0] * I, g[1] = A[1] * I, g[2] = A[2] * I, g[3] = A[3] * I, g;
|
|
1254
1292
|
}
|
|
1255
|
-
function
|
|
1293
|
+
function PC(g, A) {
|
|
1256
1294
|
var I = A[0], B = A[1], C = A[2], Q = A[3], E = I * I + B * B + C * C + Q * Q;
|
|
1257
1295
|
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;
|
|
1258
1296
|
}
|
|
1259
|
-
function
|
|
1297
|
+
function _A(g, A, I) {
|
|
1260
1298
|
var B = A[0], C = A[1], Q = A[2], E = A[3];
|
|
1261
1299
|
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;
|
|
1262
1300
|
}
|
|
@@ -1269,24 +1307,24 @@ function zA(g, A, I) {
|
|
|
1269
1307
|
return A;
|
|
1270
1308
|
};
|
|
1271
1309
|
})();
|
|
1272
|
-
function
|
|
1310
|
+
function Qg() {
|
|
1273
1311
|
var g = new b(4);
|
|
1274
1312
|
return b != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0), g[3] = 1, g;
|
|
1275
1313
|
}
|
|
1276
|
-
function
|
|
1314
|
+
function OC(g, A, I) {
|
|
1277
1315
|
I = I * 0.5;
|
|
1278
1316
|
var B = Math.sin(I);
|
|
1279
1317
|
return g[0] = B * A[0], g[1] = B * A[1], g[2] = B * A[2], g[3] = Math.cos(I), g;
|
|
1280
1318
|
}
|
|
1281
|
-
function
|
|
1319
|
+
function VC(g, A, I) {
|
|
1282
1320
|
var B = A[0], C = A[1], Q = A[2], E = A[3], i = I[0], o = I[1], a = I[2], s = I[3];
|
|
1283
1321
|
return g[0] = B * s + E * i + C * a - Q * o, g[1] = C * s + E * o + Q * i - B * a, g[2] = Q * s + E * a + B * o - C * i, g[3] = E * s - B * i - C * o - Q * a, g;
|
|
1284
1322
|
}
|
|
1285
|
-
function
|
|
1323
|
+
function zI(g, A, I, B) {
|
|
1286
1324
|
var C = A[0], Q = A[1], E = A[2], i = A[3], o = I[0], a = I[1], s = I[2], h = I[3], t, y, n, w, r;
|
|
1287
|
-
return y = C * o + Q * a + E * s + i * h, y < 0 && (y = -y, o = -o, a = -a, s = -s, h = -h), 1 - y >
|
|
1325
|
+
return y = C * o + Q * a + E * s + i * h, y < 0 && (y = -y, o = -o, a = -a, s = -s, h = -h), 1 - y > p ? (t = Math.acos(y), n = Math.sin(t), w = Math.sin((1 - B) * t) / n, r = Math.sin(B * t) / n) : (w = 1 - B, r = B), g[0] = w * C + r * o, g[1] = w * Q + r * a, g[2] = w * E + r * s, g[3] = w * i + r * h, g;
|
|
1288
1326
|
}
|
|
1289
|
-
function
|
|
1327
|
+
function HB(g, A) {
|
|
1290
1328
|
var I = A[0] + A[4] + A[8], B;
|
|
1291
1329
|
if (I > 0)
|
|
1292
1330
|
B = Math.sqrt(I + 1), g[3] = 0.5 * B, B = 0.5 / B, g[0] = (A[5] - A[7]) * B, g[1] = (A[6] - A[2]) * B, g[2] = (A[1] - A[3]) * B;
|
|
@@ -1298,27 +1336,27 @@ function KB(g, A) {
|
|
|
1298
1336
|
}
|
|
1299
1337
|
return g;
|
|
1300
1338
|
}
|
|
1301
|
-
var
|
|
1339
|
+
var vC = WC, XC = bC, Gg = PC;
|
|
1302
1340
|
(function() {
|
|
1303
|
-
var g =
|
|
1341
|
+
var g = f(), A = q(1, 0, 0), I = q(0, 1, 0);
|
|
1304
1342
|
return function(B, C, Q) {
|
|
1305
|
-
var E =
|
|
1306
|
-
return E < -0.999999 ? (
|
|
1343
|
+
var E = MB(C, Q);
|
|
1344
|
+
return E < -0.999999 ? (jI(g, A, C), xC(g) < 1e-6 && jI(g, I, C), mC(g, g), OC(B, g, Math.PI), B) : E > 0.999999 ? (B[0] = 0, B[1] = 0, B[2] = 0, B[3] = 1, B) : (jI(g, C, Q), B[0] = g[0], B[1] = g[1], B[2] = g[2], B[3] = 1 + E, Gg(B, B));
|
|
1307
1345
|
};
|
|
1308
1346
|
})();
|
|
1309
1347
|
(function() {
|
|
1310
|
-
var g =
|
|
1348
|
+
var g = Qg(), A = Qg();
|
|
1311
1349
|
return function(I, B, C, Q, E, i) {
|
|
1312
|
-
return
|
|
1350
|
+
return zI(g, B, E, i), zI(A, C, Q, i), zI(I, g, A, 2 * i * (1 - i)), I;
|
|
1313
1351
|
};
|
|
1314
1352
|
})();
|
|
1315
1353
|
(function() {
|
|
1316
|
-
var g =
|
|
1354
|
+
var g = dB();
|
|
1317
1355
|
return function(A, I, B, C) {
|
|
1318
|
-
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],
|
|
1356
|
+
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], Gg(A, HB(A, g));
|
|
1319
1357
|
};
|
|
1320
1358
|
})();
|
|
1321
|
-
function
|
|
1359
|
+
function qB() {
|
|
1322
1360
|
var g = new b(2);
|
|
1323
1361
|
return b != Float32Array && (g[0] = 0, g[1] = 0), g;
|
|
1324
1362
|
}
|
|
@@ -1326,31 +1364,31 @@ function vg(g) {
|
|
|
1326
1364
|
var A = new b(2);
|
|
1327
1365
|
return A[0] = g[0], A[1] = g[1], A;
|
|
1328
1366
|
}
|
|
1329
|
-
function
|
|
1367
|
+
function W(g, A) {
|
|
1330
1368
|
var I = new b(2);
|
|
1331
1369
|
return I[0] = g, I[1] = A, I;
|
|
1332
1370
|
}
|
|
1333
|
-
function
|
|
1371
|
+
function jC(g, A) {
|
|
1334
1372
|
var I = A[0] - g[0], B = A[1] - g[1];
|
|
1335
1373
|
return Math.hypot(I, B);
|
|
1336
1374
|
}
|
|
1337
|
-
function
|
|
1375
|
+
function zC(g) {
|
|
1338
1376
|
var A = g[0], I = g[1];
|
|
1339
1377
|
return A * A + I * I;
|
|
1340
1378
|
}
|
|
1341
|
-
function
|
|
1379
|
+
function _C(g, A, I, B) {
|
|
1342
1380
|
var C = A[0], Q = A[1];
|
|
1343
1381
|
return g[0] = C + B * (I[0] - C), g[1] = Q + B * (I[1] - Q), g;
|
|
1344
1382
|
}
|
|
1345
1383
|
function Xg(g, A) {
|
|
1346
1384
|
return g[0] === A[0] && g[1] === A[1];
|
|
1347
1385
|
}
|
|
1348
|
-
function
|
|
1386
|
+
function _I(g, A) {
|
|
1349
1387
|
var I = g[0], B = g[1], C = A[0], Q = A[1];
|
|
1350
|
-
return Math.abs(I - C) <=
|
|
1388
|
+
return Math.abs(I - C) <= p * Math.max(1, Math.abs(I), Math.abs(C)) && Math.abs(B - Q) <= p * Math.max(1, Math.abs(B), Math.abs(Q));
|
|
1351
1389
|
}
|
|
1352
1390
|
(function() {
|
|
1353
|
-
var g =
|
|
1391
|
+
var g = qB();
|
|
1354
1392
|
return function(A, I, B, C, Q, E) {
|
|
1355
1393
|
var i, o;
|
|
1356
1394
|
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)
|
|
@@ -1395,12 +1433,12 @@ class RA {
|
|
|
1395
1433
|
q(B[0], B[1], B[2])
|
|
1396
1434
|
];
|
|
1397
1435
|
this.min = q(1 / 0, 1 / 0, 1 / 0), this.max = q(-1 / 0, -1 / 0, -1 / 0);
|
|
1398
|
-
const Q =
|
|
1436
|
+
const Q = f();
|
|
1399
1437
|
for (const E of C)
|
|
1400
|
-
|
|
1438
|
+
TI(Q, E, A), this.expandWithPoint(Q);
|
|
1401
1439
|
}
|
|
1402
1440
|
}
|
|
1403
|
-
const
|
|
1441
|
+
const $C = {
|
|
1404
1442
|
position: 0,
|
|
1405
1443
|
normal: 1,
|
|
1406
1444
|
uv: 2,
|
|
@@ -1412,7 +1450,7 @@ const _C = {
|
|
|
1412
1450
|
size: 8,
|
|
1413
1451
|
marker: 9
|
|
1414
1452
|
};
|
|
1415
|
-
class bA extends
|
|
1453
|
+
class bA extends yg {
|
|
1416
1454
|
boundingBox_ = null;
|
|
1417
1455
|
primitive_;
|
|
1418
1456
|
attributes_;
|
|
@@ -1450,7 +1488,7 @@ class bA extends tg {
|
|
|
1450
1488
|
const A = this.getAttribute("position");
|
|
1451
1489
|
if (!A || this.vertexCount === 0)
|
|
1452
1490
|
throw new Error("Failed to generate bounding box");
|
|
1453
|
-
const I = (A.offset ?? 0) / Float32Array.BYTES_PER_ELEMENT, B = new RA(), C =
|
|
1491
|
+
const I = (A.offset ?? 0) / Float32Array.BYTES_PER_ELEMENT, B = new RA(), C = f();
|
|
1454
1492
|
for (let Q = 0; Q < this.vertexData_.length; Q += this.stride)
|
|
1455
1493
|
C[0] = this.vertexData_[Q + I + 0], C[1] = this.vertexData_[Q + I + 1], C[2] = this.vertexData_[Q + I + 2], B.expandWithPoint(C);
|
|
1456
1494
|
this.boundingBox_ = B;
|
|
@@ -1464,7 +1502,7 @@ class bA extends tg {
|
|
|
1464
1502
|
return this.attributes_.find((I) => I.type === A);
|
|
1465
1503
|
}
|
|
1466
1504
|
}
|
|
1467
|
-
class
|
|
1505
|
+
class AQ {
|
|
1468
1506
|
gl_;
|
|
1469
1507
|
buffers_ = /* @__PURE__ */ new Map();
|
|
1470
1508
|
currentGeometry_ = null;
|
|
@@ -1500,7 +1538,7 @@ class $C {
|
|
|
1500
1538
|
this.gl_.bindBuffer(C, Q), this.gl_.bufferData(C, B, this.gl_.STATIC_DRAW);
|
|
1501
1539
|
const { attributes: E, strideBytes: i } = A;
|
|
1502
1540
|
E.forEach((s) => {
|
|
1503
|
-
const h =
|
|
1541
|
+
const h = $C[s.type];
|
|
1504
1542
|
this.gl_.vertexAttribPointer(
|
|
1505
1543
|
h,
|
|
1506
1544
|
s.itemSize,
|
|
@@ -1519,7 +1557,7 @@ class $C {
|
|
|
1519
1557
|
this.buffers_.set(A, o), this.gl_.bindVertexArray(null);
|
|
1520
1558
|
}
|
|
1521
1559
|
}
|
|
1522
|
-
class
|
|
1560
|
+
class IQ {
|
|
1523
1561
|
gl_;
|
|
1524
1562
|
textures_ = /* @__PURE__ */ new Map();
|
|
1525
1563
|
currentTexture_ = null;
|
|
@@ -1773,7 +1811,7 @@ class AA {
|
|
|
1773
1811
|
* the first element, and avoids biasing toward (0,0).
|
|
1774
1812
|
*/
|
|
1775
1813
|
constructor(A, I) {
|
|
1776
|
-
this.min = A ? vg(A) :
|
|
1814
|
+
this.min = A ? vg(A) : W(1 / 0, 1 / 0), this.max = I ? vg(I) : W(-1 / 0, -1 / 0);
|
|
1777
1815
|
}
|
|
1778
1816
|
clone() {
|
|
1779
1817
|
return new AA(this.min, this.max);
|
|
@@ -1790,8 +1828,8 @@ class AA {
|
|
|
1790
1828
|
}
|
|
1791
1829
|
floor() {
|
|
1792
1830
|
return new AA(
|
|
1793
|
-
|
|
1794
|
-
|
|
1831
|
+
W(Math.floor(this.min[0]), Math.floor(this.min[1])),
|
|
1832
|
+
W(Math.floor(this.max[0]), Math.floor(this.max[1]))
|
|
1795
1833
|
);
|
|
1796
1834
|
}
|
|
1797
1835
|
toRect() {
|
|
@@ -1799,7 +1837,7 @@ class AA {
|
|
|
1799
1837
|
return { x: A, y: I, width: B, height: C };
|
|
1800
1838
|
}
|
|
1801
1839
|
}
|
|
1802
|
-
class
|
|
1840
|
+
class gQ {
|
|
1803
1841
|
gl_;
|
|
1804
1842
|
enabledCapabilities_ = /* @__PURE__ */ new Map();
|
|
1805
1843
|
depthMaskEnabled_ = null;
|
|
@@ -1899,8 +1937,8 @@ class IQ {
|
|
|
1899
1937
|
A ? this.enable(this.gl_.STENCIL_TEST) : this.disable(this.gl_.STENCIL_TEST);
|
|
1900
1938
|
}
|
|
1901
1939
|
}
|
|
1902
|
-
const
|
|
1903
|
-
class
|
|
1940
|
+
const BQ = JC(_(), [1, -1, 1]);
|
|
1941
|
+
class CQ extends sC {
|
|
1904
1942
|
gl_;
|
|
1905
1943
|
programs_;
|
|
1906
1944
|
bindings_;
|
|
@@ -1919,12 +1957,12 @@ class BQ extends aC {
|
|
|
1919
1957
|
this.gl_ = I, U.info(
|
|
1920
1958
|
"WebGLRenderer",
|
|
1921
1959
|
`WebGL version ${I.getParameter(I.VERSION)}`
|
|
1922
|
-
), this.programs_ = new
|
|
1960
|
+
), this.programs_ = new cC(I), this.bindings_ = new AQ(I), this.textures_ = new IQ(I), this.state_ = new gQ(I), this.initStencil(), this.resize(this.canvas.width, this.canvas.height);
|
|
1923
1961
|
}
|
|
1924
1962
|
render(A) {
|
|
1925
1963
|
const I = A.getBoxRelativeTo(this.canvas), B = new AA(
|
|
1926
|
-
|
|
1927
|
-
|
|
1964
|
+
W(0, 0),
|
|
1965
|
+
W(this.width, this.height)
|
|
1928
1966
|
);
|
|
1929
1967
|
if (AA.equals(I.floor(), B.floor()))
|
|
1930
1968
|
this.state_.setScissorTest(!1);
|
|
@@ -1983,13 +2021,13 @@ class BQ extends aC {
|
|
|
1983
2021
|
}
|
|
1984
2022
|
}
|
|
1985
2023
|
drawGeometry(A, I, B, C, Q) {
|
|
1986
|
-
const E =
|
|
2024
|
+
const E = zA(
|
|
1987
2025
|
_(),
|
|
1988
2026
|
Q.viewMatrix,
|
|
1989
2027
|
I.transform.matrix
|
|
1990
|
-
), i =
|
|
2028
|
+
), i = zA(
|
|
1991
2029
|
_(),
|
|
1992
|
-
|
|
2030
|
+
BQ,
|
|
1993
2031
|
Q.projectionMatrix
|
|
1994
2032
|
), o = [this.canvas.width, this.canvas.height], a = I.getUniforms(), h = {
|
|
1995
2033
|
...B.getUniforms(),
|
|
@@ -2010,7 +2048,7 @@ class BQ extends aC {
|
|
|
2010
2048
|
C.setUniform(n, B.opacity);
|
|
2011
2049
|
break;
|
|
2012
2050
|
case "CameraPositionModel": {
|
|
2013
|
-
const w =
|
|
2051
|
+
const w = uI(_(), E), r = kI(0, 0, 0, 1), G = _A(
|
|
2014
2052
|
pA(),
|
|
2015
2053
|
r,
|
|
2016
2054
|
w
|
|
@@ -2047,8 +2085,8 @@ class BQ extends aC {
|
|
|
2047
2085
|
}
|
|
2048
2086
|
resize(A, I) {
|
|
2049
2087
|
const B = new AA(
|
|
2050
|
-
|
|
2051
|
-
|
|
2088
|
+
W(0, 0),
|
|
2089
|
+
W(A, I)
|
|
2052
2090
|
);
|
|
2053
2091
|
this.state_.setViewport(B);
|
|
2054
2092
|
}
|
|
@@ -2056,12 +2094,12 @@ class BQ extends aC {
|
|
|
2056
2094
|
this.gl_.clearColor(...this.backgroundColor.rgba), this.gl_.clear(this.gl_.COLOR_BUFFER_BIT | this.gl_.DEPTH_BUFFER_BIT), this.state_.setDepthTesting(!0), this.gl_.depthFunc(this.gl_.LEQUAL);
|
|
2057
2095
|
}
|
|
2058
2096
|
}
|
|
2059
|
-
const
|
|
2060
|
-
class
|
|
2097
|
+
const QQ = 8;
|
|
2098
|
+
class EQ {
|
|
2061
2099
|
maxConcurrent_;
|
|
2062
2100
|
pending_ = [];
|
|
2063
2101
|
running_ = /* @__PURE__ */ new Map();
|
|
2064
|
-
constructor(A =
|
|
2102
|
+
constructor(A = QQ) {
|
|
2065
2103
|
this.maxConcurrent_ = Math.max(1, A);
|
|
2066
2104
|
}
|
|
2067
2105
|
enqueue(A, I) {
|
|
@@ -2127,17 +2165,17 @@ function zg(g) {
|
|
|
2127
2165
|
`Unsupported chunk data type: ${g}. Supported data types: ${A}`
|
|
2128
2166
|
), !1;
|
|
2129
2167
|
}
|
|
2130
|
-
function
|
|
2168
|
+
function iQ(g, A) {
|
|
2131
2169
|
return Math.round((A - g.translation) / g.scale);
|
|
2132
2170
|
}
|
|
2133
|
-
function
|
|
2171
|
+
function Eg(g, A, I = 1e-6) {
|
|
2134
2172
|
return Math.abs(g - A) <= I;
|
|
2135
2173
|
}
|
|
2136
2174
|
function cA(g, A, I) {
|
|
2137
2175
|
return Math.max(A, Math.min(I, g));
|
|
2138
2176
|
}
|
|
2139
|
-
const
|
|
2140
|
-
class
|
|
2177
|
+
const ng = Symbol("INTERNAL_POLICY_KEY");
|
|
2178
|
+
class oQ {
|
|
2141
2179
|
store_;
|
|
2142
2180
|
policy_;
|
|
2143
2181
|
policyChanged_ = !1;
|
|
@@ -2156,8 +2194,8 @@ class iQ {
|
|
|
2156
2194
|
this.policy_.profile
|
|
2157
2195
|
);
|
|
2158
2196
|
const B = this.store_.dimensions, C = B.x.lods[0], Q = B.y.lods[0];
|
|
2159
|
-
this.sourceMaxSquareDistance2D_ =
|
|
2160
|
-
|
|
2197
|
+
this.sourceMaxSquareDistance2D_ = zC(
|
|
2198
|
+
W(C.size * C.scale, Q.size * Q.scale)
|
|
2161
2199
|
);
|
|
2162
2200
|
}
|
|
2163
2201
|
get chunkViewStates() {
|
|
@@ -2205,13 +2243,13 @@ class iQ {
|
|
|
2205
2243
|
), this.chunkViewStates_.clear();
|
|
2206
2244
|
return;
|
|
2207
2245
|
}
|
|
2208
|
-
const w =
|
|
2209
|
-
|
|
2246
|
+
const w = qB();
|
|
2247
|
+
_C(w, Q.min, Q.max, 0.5);
|
|
2210
2248
|
const [r, G] = this.getZBounds(A), c = new RA(
|
|
2211
2249
|
q(Q.min[0], Q.min[1], r),
|
|
2212
2250
|
q(Q.max[0], Q.max[1], G)
|
|
2213
2251
|
);
|
|
2214
|
-
this.chunkViewStates_.forEach(
|
|
2252
|
+
this.chunkViewStates_.forEach($I), this.updateChunksAtTimeIndex(
|
|
2215
2253
|
y,
|
|
2216
2254
|
A,
|
|
2217
2255
|
c,
|
|
@@ -2224,7 +2262,7 @@ class iQ {
|
|
|
2224
2262
|
), this.policyChanged_ = !1, this.lastViewBounds2D_ = Q.clone(), this.lastZBounds_ = h, this.lastTCoord_ = A.t;
|
|
2225
2263
|
}
|
|
2226
2264
|
updateChunksForVolume(A, I) {
|
|
2227
|
-
const B =
|
|
2265
|
+
const B = zA(
|
|
2228
2266
|
_(),
|
|
2229
2267
|
I.camera.projectionMatrix,
|
|
2230
2268
|
I.camera.viewMatrix
|
|
@@ -2238,7 +2276,7 @@ class iQ {
|
|
|
2238
2276
|
), this.chunkViewStates_.clear();
|
|
2239
2277
|
return;
|
|
2240
2278
|
}
|
|
2241
|
-
this.currentLOD_ = this.policy_.lod.min, this.chunkViewStates_.forEach(
|
|
2279
|
+
this.currentLOD_ = this.policy_.lod.min, this.chunkViewStates_.forEach($I);
|
|
2242
2280
|
const i = this.fallbackLOD();
|
|
2243
2281
|
for (const o of E) {
|
|
2244
2282
|
const a = o.lod === this.currentLOD_, s = o.lod === i;
|
|
@@ -2275,10 +2313,10 @@ class iQ {
|
|
|
2275
2313
|
I && (I.visible || I.prefetch || I.priority !== null) || this.chunkViewStates_.delete(A);
|
|
2276
2314
|
}
|
|
2277
2315
|
dispose() {
|
|
2278
|
-
this.isDisposed_ = !0, this.chunkViewStates_.forEach(
|
|
2316
|
+
this.isDisposed_ = !0, this.chunkViewStates_.forEach($I);
|
|
2279
2317
|
}
|
|
2280
2318
|
setImageSourcePolicy(A, I) {
|
|
2281
|
-
if (I !==
|
|
2319
|
+
if (I !== ng)
|
|
2282
2320
|
throw new Error("Unauthorized policy mutation");
|
|
2283
2321
|
this.policy_ !== A && (this.policy_ = A, this.policyChanged_ = !0, U.info(
|
|
2284
2322
|
"ChunkStoreView",
|
|
@@ -2401,13 +2439,13 @@ class iQ {
|
|
|
2401
2439
|
];
|
|
2402
2440
|
}
|
|
2403
2441
|
viewBounds2DChanged(A) {
|
|
2404
|
-
return this.lastViewBounds2D_ === null || !
|
|
2442
|
+
return this.lastViewBounds2D_ === null || !_I(this.lastViewBounds2D_.min, A.min) || !_I(this.lastViewBounds2D_.max, A.max);
|
|
2405
2443
|
}
|
|
2406
2444
|
hasViewProjectionChanged(A) {
|
|
2407
|
-
return this.lastViewProjection_ === null || !
|
|
2445
|
+
return this.lastViewProjection_ === null || !lC(this.lastViewProjection_, A);
|
|
2408
2446
|
}
|
|
2409
2447
|
zBoundsChanged(A) {
|
|
2410
|
-
return !this.lastZBounds_ || !
|
|
2448
|
+
return !this.lastZBounds_ || !_I(this.lastZBounds_, A);
|
|
2411
2449
|
}
|
|
2412
2450
|
getPaddedBounds(A) {
|
|
2413
2451
|
const I = this.store_.dimensions, B = I.x.lods[this.currentLOD_], C = I.y.lods[this.currentLOD_], Q = I.z?.lods[this.currentLOD_], E = B.chunkSize * B.scale * this.policy_.prefetch.x, i = C.chunkSize * C.scale * this.policy_.prefetch.y;
|
|
@@ -2433,10 +2471,10 @@ class iQ {
|
|
|
2433
2471
|
return C * C + Q * Q;
|
|
2434
2472
|
}
|
|
2435
2473
|
}
|
|
2436
|
-
function
|
|
2474
|
+
function $I(g) {
|
|
2437
2475
|
g.visible = !1, g.prefetch = !1, g.priority = null, g.orderKey = null;
|
|
2438
2476
|
}
|
|
2439
|
-
class
|
|
2477
|
+
class aQ {
|
|
2440
2478
|
chunks_;
|
|
2441
2479
|
loader_;
|
|
2442
2480
|
lowestResLOD_;
|
|
@@ -2494,7 +2532,7 @@ class oQ {
|
|
|
2494
2532
|
return this.chunks_[A];
|
|
2495
2533
|
}
|
|
2496
2534
|
getTimeIndex(A) {
|
|
2497
|
-
return A.t === void 0 || this.dimensions_.t === void 0 ? 0 :
|
|
2535
|
+
return A.t === void 0 || this.dimensions_.t === void 0 ? 0 : iQ(this.dimensions_.t.lods[0], A.t);
|
|
2498
2536
|
}
|
|
2499
2537
|
get lodCount() {
|
|
2500
2538
|
return this.lowestResLOD_ + 1;
|
|
@@ -2509,7 +2547,7 @@ class oQ {
|
|
|
2509
2547
|
return this.loader_.loadChunkData(A, I);
|
|
2510
2548
|
}
|
|
2511
2549
|
createView(A) {
|
|
2512
|
-
const I = new
|
|
2550
|
+
const I = new oQ(this, A);
|
|
2513
2551
|
return this.views_.push(I), this.hasHadViews_ = !0, I;
|
|
2514
2552
|
}
|
|
2515
2553
|
get views() {
|
|
@@ -2560,7 +2598,7 @@ class oQ {
|
|
|
2560
2598
|
const A = this.dimensions_.x, I = this.dimensions_.y;
|
|
2561
2599
|
for (let B = 1; B < this.dimensions_.numLods; B++) {
|
|
2562
2600
|
const C = A.lods[B].scale / A.lods[B - 1].scale, Q = I.lods[B].scale / I.lods[B - 1].scale;
|
|
2563
|
-
if (!
|
|
2601
|
+
if (!Eg(C, 2, 0.02) || !Eg(Q, 2, 0.02))
|
|
2564
2602
|
throw new Error(
|
|
2565
2603
|
`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}]`
|
|
2566
2604
|
);
|
|
@@ -2611,10 +2649,10 @@ class oQ {
|
|
|
2611
2649
|
};
|
|
2612
2650
|
}
|
|
2613
2651
|
}
|
|
2614
|
-
class
|
|
2652
|
+
class sQ {
|
|
2615
2653
|
stores_ = /* @__PURE__ */ new Map();
|
|
2616
2654
|
pendingStores_ = /* @__PURE__ */ new Map();
|
|
2617
|
-
queue_ = new
|
|
2655
|
+
queue_ = new EQ();
|
|
2618
2656
|
async addView(A, I) {
|
|
2619
2657
|
return (await this.getOrCreateStore(A)).createView(I);
|
|
2620
2658
|
}
|
|
@@ -2627,7 +2665,7 @@ class aQ {
|
|
|
2627
2665
|
return B;
|
|
2628
2666
|
const Q = (async () => {
|
|
2629
2667
|
const i = await A.open();
|
|
2630
|
-
return new
|
|
2668
|
+
return new aQ(i);
|
|
2631
2669
|
})();
|
|
2632
2670
|
this.pendingStores_.set(A, Q);
|
|
2633
2671
|
const E = await Q;
|
|
@@ -2699,14 +2737,14 @@ XA.Panel = function(g, A, I, B) {
|
|
|
2699
2737
|
}
|
|
2700
2738
|
};
|
|
2701
2739
|
};
|
|
2702
|
-
function
|
|
2740
|
+
function DQ({ scale: g } = { scale: 1.5 }) {
|
|
2703
2741
|
const A = new XA(g);
|
|
2704
2742
|
return A.showPanel(
|
|
2705
2743
|
0
|
|
2706
2744
|
/* 0 = fps, 1 = ms, 2 = mb */
|
|
2707
2745
|
), document.body.appendChild(A.dom), A;
|
|
2708
2746
|
}
|
|
2709
|
-
class
|
|
2747
|
+
class hQ {
|
|
2710
2748
|
layers_ = [];
|
|
2711
2749
|
callbacks_ = [];
|
|
2712
2750
|
context_;
|
|
@@ -2756,17 +2794,17 @@ class DQ {
|
|
|
2756
2794
|
this.callbacks_.splice(I, 1);
|
|
2757
2795
|
}
|
|
2758
2796
|
}
|
|
2759
|
-
const
|
|
2797
|
+
const ig = [
|
|
2760
2798
|
"pointerdown",
|
|
2761
2799
|
"pointermove",
|
|
2762
2800
|
"pointerup",
|
|
2763
2801
|
"pointercancel",
|
|
2764
2802
|
"wheel"
|
|
2765
2803
|
];
|
|
2766
|
-
function
|
|
2767
|
-
return
|
|
2804
|
+
function tQ(g) {
|
|
2805
|
+
return ig.includes(g);
|
|
2768
2806
|
}
|
|
2769
|
-
class
|
|
2807
|
+
class yQ {
|
|
2770
2808
|
propagationStopped_ = !1;
|
|
2771
2809
|
type;
|
|
2772
2810
|
event;
|
|
@@ -2782,7 +2820,7 @@ class tQ {
|
|
|
2782
2820
|
this.propagationStopped_ = !0;
|
|
2783
2821
|
}
|
|
2784
2822
|
}
|
|
2785
|
-
class
|
|
2823
|
+
class eQ {
|
|
2786
2824
|
listeners_ = [];
|
|
2787
2825
|
element_;
|
|
2788
2826
|
isConnected_ = !1;
|
|
@@ -2801,7 +2839,7 @@ class yQ {
|
|
|
2801
2839
|
);
|
|
2802
2840
|
return;
|
|
2803
2841
|
}
|
|
2804
|
-
this.isConnected_ = !0,
|
|
2842
|
+
this.isConnected_ = !0, ig.forEach((A) => {
|
|
2805
2843
|
this.element_.addEventListener(A, this.handleEvent, {
|
|
2806
2844
|
passive: !1
|
|
2807
2845
|
});
|
|
@@ -2816,21 +2854,21 @@ class yQ {
|
|
|
2816
2854
|
);
|
|
2817
2855
|
return;
|
|
2818
2856
|
}
|
|
2819
|
-
this.isConnected_ = !1,
|
|
2857
|
+
this.isConnected_ = !1, ig.forEach((A) => {
|
|
2820
2858
|
this.element_.removeEventListener(A, this.handleEvent);
|
|
2821
2859
|
});
|
|
2822
2860
|
}
|
|
2823
2861
|
handleEvent = (A) => {
|
|
2824
|
-
if (!
|
|
2862
|
+
if (!tQ(A.type)) {
|
|
2825
2863
|
U.error("EventDispatcher", `Unsupported event type ${A.type}`);
|
|
2826
2864
|
return;
|
|
2827
2865
|
}
|
|
2828
|
-
const I = new
|
|
2866
|
+
const I = new yQ(A.type, A);
|
|
2829
2867
|
for (const B of this.listeners_)
|
|
2830
2868
|
if (B(I), I.propagationStopped) break;
|
|
2831
2869
|
};
|
|
2832
2870
|
}
|
|
2833
|
-
class
|
|
2871
|
+
class GQ {
|
|
2834
2872
|
id;
|
|
2835
2873
|
element;
|
|
2836
2874
|
camera;
|
|
@@ -2838,9 +2876,9 @@ class eQ {
|
|
|
2838
2876
|
events;
|
|
2839
2877
|
cameraControls;
|
|
2840
2878
|
constructor(A) {
|
|
2841
|
-
this.id = A.id, this.element = A.element, this.camera = A.camera, this.layerManager = A.layerManager, this.cameraControls = A.cameraControls, this.updateAspectRatio(), this.events = new
|
|
2879
|
+
this.id = A.id, this.element = A.element, this.camera = A.camera, this.layerManager = A.layerManager, this.cameraControls = A.cameraControls, this.updateAspectRatio(), this.events = new eQ(this.element), this.events.addEventListener((I) => {
|
|
2842
2880
|
if (I.event instanceof PointerEvent || I.event instanceof WheelEvent) {
|
|
2843
|
-
const { clientX: B, clientY: C } = I.event, Q =
|
|
2881
|
+
const { clientX: B, clientY: C } = I.event, Q = W(B, C);
|
|
2844
2882
|
I.clipPos = this.clientToClip(Q, 0), I.worldPos = this.camera.clipToWorld(I.clipPos);
|
|
2845
2883
|
}
|
|
2846
2884
|
for (const B of this.layerManager.layers)
|
|
@@ -2856,8 +2894,8 @@ class eQ {
|
|
|
2856
2894
|
getBoxRelativeTo(A) {
|
|
2857
2895
|
const I = this.getBox().toRect(), B = A.getBoundingClientRect(), C = window.devicePixelRatio || 1, Q = B.left * C, E = B.top * C, i = B.height * C, o = I.x - Q, a = I.y - E, s = Math.floor(o), h = Math.floor(i - a - I.height), t = Math.floor(I.width), y = Math.floor(I.height);
|
|
2858
2896
|
return new AA(
|
|
2859
|
-
|
|
2860
|
-
|
|
2897
|
+
W(s, h),
|
|
2898
|
+
W(s + t, h + y)
|
|
2861
2899
|
);
|
|
2862
2900
|
}
|
|
2863
2901
|
clientToClip(A, I = 0) {
|
|
@@ -2875,8 +2913,8 @@ class eQ {
|
|
|
2875
2913
|
getBox() {
|
|
2876
2914
|
const A = this.element.getBoundingClientRect(), I = window.devicePixelRatio || 1, B = A.left * I, C = A.top * I, Q = A.width * I, E = A.height * I;
|
|
2877
2915
|
return new AA(
|
|
2878
|
-
|
|
2879
|
-
|
|
2916
|
+
W(B, C),
|
|
2917
|
+
W(B + Q, C + E)
|
|
2880
2918
|
);
|
|
2881
2919
|
}
|
|
2882
2920
|
updateAspectRatio() {
|
|
@@ -2892,7 +2930,7 @@ class eQ {
|
|
|
2892
2930
|
this.camera.setAspectRatio(B);
|
|
2893
2931
|
}
|
|
2894
2932
|
}
|
|
2895
|
-
function
|
|
2933
|
+
function nQ(g) {
|
|
2896
2934
|
const A = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Set();
|
|
2897
2935
|
for (const B of g) {
|
|
2898
2936
|
if (I.has(B.id))
|
|
@@ -2908,19 +2946,19 @@ function GQ(g) {
|
|
|
2908
2946
|
A.set(B.element, B.id);
|
|
2909
2947
|
}
|
|
2910
2948
|
}
|
|
2911
|
-
function
|
|
2949
|
+
function wQ(g, A, I) {
|
|
2912
2950
|
const B = g.map((C) => {
|
|
2913
2951
|
const Q = C.element ?? A;
|
|
2914
2952
|
return {
|
|
2915
2953
|
...C,
|
|
2916
2954
|
element: Q,
|
|
2917
|
-
id: C.id ?? Q.id ??
|
|
2918
|
-
layerManager: new
|
|
2955
|
+
id: C.id ?? Q.id ?? YB(),
|
|
2956
|
+
layerManager: new hQ(I)
|
|
2919
2957
|
};
|
|
2920
2958
|
});
|
|
2921
|
-
return
|
|
2959
|
+
return nQ(B), B.map((C) => new GQ(C));
|
|
2922
2960
|
}
|
|
2923
|
-
class
|
|
2961
|
+
class FQ {
|
|
2924
2962
|
elements_;
|
|
2925
2963
|
resizeObserver_;
|
|
2926
2964
|
mediaQuery_;
|
|
@@ -3027,17 +3065,17 @@ class Yo {
|
|
|
3027
3065
|
constructor(A) {
|
|
3028
3066
|
if (this.canvas = A.canvas, A.viewports.length === 0)
|
|
3029
3067
|
throw new Error("At least one viewport config must be specified.");
|
|
3030
|
-
this.renderer_ = new
|
|
3068
|
+
this.renderer_ = new CQ(this.canvas), this.chunkManager_ = new sQ(), this.context_ = {
|
|
3031
3069
|
chunkManager: this.chunkManager_
|
|
3032
|
-
}, this.viewports_ =
|
|
3070
|
+
}, this.viewports_ = wQ(
|
|
3033
3071
|
A.viewports,
|
|
3034
3072
|
this.canvas,
|
|
3035
3073
|
this.context_
|
|
3036
|
-
), this.overlays = A.overlays ?? [], A.showStats && (this.stats_ =
|
|
3074
|
+
), this.overlays = A.overlays ?? [], A.showStats && (this.stats_ = DQ());
|
|
3037
3075
|
const I = [this.canvas];
|
|
3038
3076
|
for (const B of this.viewports_)
|
|
3039
3077
|
B.element !== this.canvas && I.push(B.element);
|
|
3040
|
-
this.sizeObserver_ = new
|
|
3078
|
+
this.sizeObserver_ = new FQ(I, () => {
|
|
3041
3079
|
this.renderer_.updateSize();
|
|
3042
3080
|
for (const B of this.viewports_)
|
|
3043
3081
|
B.updateSize(), this.renderer_.render(B);
|
|
@@ -3096,7 +3134,7 @@ class Yo {
|
|
|
3096
3134
|
}
|
|
3097
3135
|
}
|
|
3098
3136
|
}
|
|
3099
|
-
class
|
|
3137
|
+
class rQ extends bA {
|
|
3100
3138
|
constructor(A) {
|
|
3101
3139
|
if (super(), A.primitive != "triangles") {
|
|
3102
3140
|
U.warn("WireframeGeometry", "Only indexed geometries are supported");
|
|
@@ -3121,21 +3159,21 @@ class FQ extends bA {
|
|
|
3121
3159
|
this.indexData_ = new Uint32Array(B);
|
|
3122
3160
|
}
|
|
3123
3161
|
}
|
|
3124
|
-
const
|
|
3125
|
-
class
|
|
3162
|
+
const SQ = q(0, 1, 0);
|
|
3163
|
+
class RQ {
|
|
3126
3164
|
dirty_ = !0;
|
|
3127
3165
|
matrix_ = _();
|
|
3128
|
-
rotation_ =
|
|
3129
|
-
translation_ =
|
|
3166
|
+
rotation_ = Qg();
|
|
3167
|
+
translation_ = f();
|
|
3130
3168
|
scale_ = q(1, 1, 1);
|
|
3131
3169
|
addRotation(A) {
|
|
3132
|
-
|
|
3170
|
+
VC(this.rotation_, this.rotation_, A), this.dirty_ = !0;
|
|
3133
3171
|
}
|
|
3134
3172
|
setRotation(A) {
|
|
3135
|
-
|
|
3173
|
+
XC(this.rotation_, A), this.dirty_ = !0;
|
|
3136
3174
|
}
|
|
3137
3175
|
get rotation() {
|
|
3138
|
-
return
|
|
3176
|
+
return vC(this.rotation_);
|
|
3139
3177
|
}
|
|
3140
3178
|
addTranslation(A) {
|
|
3141
3179
|
lA(this.translation_, this.translation_, A), this.dirty_ = !0;
|
|
@@ -3147,15 +3185,15 @@ class SQ {
|
|
|
3147
3185
|
return BA(this.translation_);
|
|
3148
3186
|
}
|
|
3149
3187
|
addScale(A) {
|
|
3150
|
-
|
|
3188
|
+
pC(this.scale_, this.scale_, A), this.dirty_ = !0;
|
|
3151
3189
|
}
|
|
3152
3190
|
setScale(A) {
|
|
3153
3191
|
HA(this.scale_, A), this.dirty_ = !0;
|
|
3154
3192
|
}
|
|
3155
3193
|
targetTo(A) {
|
|
3156
|
-
|
|
3157
|
-
const I =
|
|
3158
|
-
|
|
3194
|
+
KB(this.translation_, A) && (A = BA(A), A[2] += p);
|
|
3195
|
+
const I = qC(_(), this.translation_, A, SQ), B = LC(dB(), I);
|
|
3196
|
+
HB(this.rotation_, B), Gg(this.rotation_, this.rotation_), this.dirty_ = !0;
|
|
3159
3197
|
}
|
|
3160
3198
|
get scale() {
|
|
3161
3199
|
return BA(this.scale_);
|
|
@@ -3164,10 +3202,10 @@ class SQ {
|
|
|
3164
3202
|
return this.dirty_ && (this.computeMatrix(), this.dirty_ = !1), this.matrix_;
|
|
3165
3203
|
}
|
|
3166
3204
|
get inverse() {
|
|
3167
|
-
return
|
|
3205
|
+
return uI(_(), this.matrix);
|
|
3168
3206
|
}
|
|
3169
3207
|
computeMatrix() {
|
|
3170
|
-
|
|
3208
|
+
YC(
|
|
3171
3209
|
this.matrix_,
|
|
3172
3210
|
this.rotation_,
|
|
3173
3211
|
this.translation_,
|
|
@@ -3175,13 +3213,13 @@ class SQ {
|
|
|
3175
3213
|
);
|
|
3176
3214
|
}
|
|
3177
3215
|
}
|
|
3178
|
-
class ZA extends
|
|
3216
|
+
class ZA extends yg {
|
|
3179
3217
|
wireframeEnabled = !1;
|
|
3180
|
-
wireframeColor =
|
|
3218
|
+
wireframeColor = l.WHITE;
|
|
3181
3219
|
depthTest = !0;
|
|
3182
3220
|
textures_ = [];
|
|
3183
3221
|
staleTextures_ = [];
|
|
3184
|
-
transform_ = new
|
|
3222
|
+
transform_ = new RQ();
|
|
3185
3223
|
geometry_ = new bA();
|
|
3186
3224
|
wireframeGeometry_ = null;
|
|
3187
3225
|
programName_ = null;
|
|
@@ -3198,7 +3236,7 @@ class ZA extends tg {
|
|
|
3198
3236
|
return this.geometry_;
|
|
3199
3237
|
}
|
|
3200
3238
|
get wireframeGeometry() {
|
|
3201
|
-
return this.wireframeGeometry_ ??= new
|
|
3239
|
+
return this.wireframeGeometry_ ??= new rQ(this.geometry), this.wireframeGeometry_;
|
|
3202
3240
|
}
|
|
3203
3241
|
get textures() {
|
|
3204
3242
|
return this.textures_;
|
|
@@ -3245,32 +3283,32 @@ class dA {
|
|
|
3245
3283
|
this.normal = BA(A), this.signedDistance = I;
|
|
3246
3284
|
}
|
|
3247
3285
|
signedDistanceToPoint(A) {
|
|
3248
|
-
return
|
|
3286
|
+
return MB(this.normal, A) + this.signedDistance;
|
|
3249
3287
|
}
|
|
3250
3288
|
normalize() {
|
|
3251
|
-
const A =
|
|
3289
|
+
const A = eg(this.normal);
|
|
3252
3290
|
if (A > 0) {
|
|
3253
3291
|
const I = 1 / A;
|
|
3254
3292
|
fA(this.normal, this.normal, I), this.signedDistance *= I;
|
|
3255
3293
|
}
|
|
3256
3294
|
}
|
|
3257
3295
|
}
|
|
3258
|
-
class
|
|
3296
|
+
class NQ {
|
|
3259
3297
|
planes_;
|
|
3260
3298
|
constructor(A) {
|
|
3261
3299
|
this.planes_ = [
|
|
3262
|
-
new dA(
|
|
3263
|
-
new dA(
|
|
3264
|
-
new dA(
|
|
3265
|
-
new dA(
|
|
3266
|
-
new dA(
|
|
3267
|
-
new dA(
|
|
3300
|
+
new dA(f(), 0),
|
|
3301
|
+
new dA(f(), 0),
|
|
3302
|
+
new dA(f(), 0),
|
|
3303
|
+
new dA(f(), 0),
|
|
3304
|
+
new dA(f(), 0),
|
|
3305
|
+
new dA(f(), 0)
|
|
3268
3306
|
], this.setWithViewProjection(A);
|
|
3269
3307
|
}
|
|
3270
3308
|
// Uses the fast plane-extraction algorithm described in
|
|
3271
3309
|
// Gribb & Hartmann (1997): https://tinyurl.com/5x5htcwm
|
|
3272
3310
|
setWithViewProjection(A) {
|
|
3273
|
-
const I =
|
|
3311
|
+
const I = f();
|
|
3274
3312
|
this.planes_[0].set(
|
|
3275
3313
|
SA(I, A[3] + A[0], A[7] + A[4], A[11] + A[8]),
|
|
3276
3314
|
A[15] + A[12]
|
|
@@ -3293,7 +3331,7 @@ class RQ {
|
|
|
3293
3331
|
for (const B of this.planes_) B.normalize();
|
|
3294
3332
|
}
|
|
3295
3333
|
intersectsWithBox3(A) {
|
|
3296
|
-
const I =
|
|
3334
|
+
const I = f();
|
|
3297
3335
|
for (const B of this.planes_) {
|
|
3298
3336
|
const C = B.normal;
|
|
3299
3337
|
if (I[0] = C[0] > 0 ? A.max[0] : A.min[0], I[1] = C[1] > 0 ? A.max[1] : A.min[1], I[2] = C[2] > 0 ? A.max[2] : A.min[2], B.signedDistanceToPoint(I) < 0) return !1;
|
|
@@ -3301,7 +3339,7 @@ class RQ {
|
|
|
3301
3339
|
return !0;
|
|
3302
3340
|
}
|
|
3303
3341
|
}
|
|
3304
|
-
class
|
|
3342
|
+
class lB extends ZA {
|
|
3305
3343
|
projectionMatrix_ = _();
|
|
3306
3344
|
near_ = 0;
|
|
3307
3345
|
far_ = 0;
|
|
@@ -3323,8 +3361,8 @@ class qB extends ZA {
|
|
|
3323
3361
|
return q(A[4], A[5], A[6]);
|
|
3324
3362
|
}
|
|
3325
3363
|
get frustum() {
|
|
3326
|
-
return new
|
|
3327
|
-
|
|
3364
|
+
return new NQ(
|
|
3365
|
+
zA(_(), this.projectionMatrix, this.viewMatrix)
|
|
3328
3366
|
);
|
|
3329
3367
|
}
|
|
3330
3368
|
pan(A) {
|
|
@@ -3334,16 +3372,16 @@ class qB extends ZA {
|
|
|
3334
3372
|
return this.transform.translation;
|
|
3335
3373
|
}
|
|
3336
3374
|
clipToWorld(A) {
|
|
3337
|
-
const I =
|
|
3375
|
+
const I = kI(A[0], A[1], A[2], 1), B = uI(
|
|
3338
3376
|
_(),
|
|
3339
3377
|
this.projectionMatrix_
|
|
3340
|
-
), C =
|
|
3378
|
+
), C = _A(
|
|
3341
3379
|
pA(),
|
|
3342
3380
|
I,
|
|
3343
3381
|
B
|
|
3344
3382
|
);
|
|
3345
|
-
|
|
3346
|
-
const Q =
|
|
3383
|
+
ZC(C, C, 1 / C[3]);
|
|
3384
|
+
const Q = _A(
|
|
3347
3385
|
pA(),
|
|
3348
3386
|
C,
|
|
3349
3387
|
this.transform.matrix
|
|
@@ -3351,12 +3389,12 @@ class qB extends ZA {
|
|
|
3351
3389
|
return q(Q[0], Q[1], Q[2]);
|
|
3352
3390
|
}
|
|
3353
3391
|
}
|
|
3354
|
-
const
|
|
3355
|
-
class Mo extends
|
|
3392
|
+
const fB = 1.77, _g = 128, $g = 128 / fB;
|
|
3393
|
+
class Mo extends lB {
|
|
3356
3394
|
// width_ and height_ should always be defined by constructor (see setFrame)
|
|
3357
3395
|
width_ = _g;
|
|
3358
3396
|
height_ = $g;
|
|
3359
|
-
viewportAspectRatio_ =
|
|
3397
|
+
viewportAspectRatio_ = fB;
|
|
3360
3398
|
viewportSize_ = [_g, $g];
|
|
3361
3399
|
constructor(A, I, B, C, Q = 0, E = 100) {
|
|
3362
3400
|
super(), this.near_ = Q, this.far_ = E, this.setFrame(A, I, C, B), this.updateProjectionMatrix();
|
|
@@ -3382,21 +3420,21 @@ class Mo extends qB {
|
|
|
3382
3420
|
this.transform.addScale([I, I, 1]);
|
|
3383
3421
|
}
|
|
3384
3422
|
getWorldViewRect() {
|
|
3385
|
-
let A =
|
|
3386
|
-
const B =
|
|
3423
|
+
let A = kI(-1, -1, 0, 1), I = kI(1, 1, 0, 1);
|
|
3424
|
+
const B = zA(
|
|
3387
3425
|
_(),
|
|
3388
3426
|
this.projectionMatrix,
|
|
3389
3427
|
this.viewMatrix
|
|
3390
|
-
), C =
|
|
3391
|
-
return A =
|
|
3392
|
-
|
|
3393
|
-
|
|
3428
|
+
), C = uI(_(), B);
|
|
3429
|
+
return A = _A(pA(), A, C), I = _A(pA(), I, C), new AA(
|
|
3430
|
+
W(A[0], A[1]),
|
|
3431
|
+
W(I[0], I[1])
|
|
3394
3432
|
);
|
|
3395
3433
|
}
|
|
3396
3434
|
updateProjectionMatrix() {
|
|
3397
3435
|
const A = this.width_, I = this.height_, B = A / I;
|
|
3398
3436
|
let C = 0.5 * A, Q = 0.5 * I;
|
|
3399
|
-
this.viewportAspectRatio_ > B ? C *= this.viewportAspectRatio_ / B : Q *= B / this.viewportAspectRatio_, this.viewportSize_ = [2 * C, 2 * Q],
|
|
3437
|
+
this.viewportAspectRatio_ > B ? C *= this.viewportAspectRatio_ / B : Q *= B / this.viewportAspectRatio_, this.viewportSize_ = [2 * C, 2 * Q], HC(
|
|
3400
3438
|
this.projectionMatrix_,
|
|
3401
3439
|
-C,
|
|
3402
3440
|
C,
|
|
@@ -3407,21 +3445,21 @@ class Mo extends qB {
|
|
|
3407
3445
|
);
|
|
3408
3446
|
}
|
|
3409
3447
|
}
|
|
3410
|
-
const
|
|
3411
|
-
class Ko extends
|
|
3448
|
+
const cQ = 60, UQ = 1.77, rI = 0.1, Ag = 180 - rI;
|
|
3449
|
+
class Ko extends lB {
|
|
3412
3450
|
fov_;
|
|
3413
3451
|
aspectRatio_;
|
|
3414
3452
|
constructor(A = {}) {
|
|
3415
3453
|
const {
|
|
3416
|
-
fov: I =
|
|
3417
|
-
aspectRatio: B =
|
|
3454
|
+
fov: I = cQ,
|
|
3455
|
+
aspectRatio: B = UQ,
|
|
3418
3456
|
near: C = 0.1,
|
|
3419
3457
|
far: Q = 1e4,
|
|
3420
3458
|
position: E = q(0, 0, 0)
|
|
3421
3459
|
} = A;
|
|
3422
|
-
if (I <
|
|
3460
|
+
if (I < rI || I > Ag)
|
|
3423
3461
|
throw new Error(
|
|
3424
|
-
`Invalid field of view: ${I}, must be in [${
|
|
3462
|
+
`Invalid field of view: ${I}, must be in [${rI}, ${Ag}] degrees`
|
|
3425
3463
|
);
|
|
3426
3464
|
super(), this.fov_ = I, this.aspectRatio_ = B, this.near_ = C, this.far_ = Q, this.transform.setTranslation(E), this.updateProjectionMatrix();
|
|
3427
3465
|
}
|
|
@@ -3437,12 +3475,12 @@ class Ko extends qB {
|
|
|
3437
3475
|
zoom(A) {
|
|
3438
3476
|
if (A <= 0)
|
|
3439
3477
|
throw new Error(`Invalid zoom factor: ${A}`);
|
|
3440
|
-
this.fov_ = Math.max(
|
|
3478
|
+
this.fov_ = Math.max(rI, Math.min(Ag, this.fov_ / A)), this.updateProjectionMatrix();
|
|
3441
3479
|
}
|
|
3442
3480
|
updateProjectionMatrix() {
|
|
3443
|
-
|
|
3481
|
+
MC(
|
|
3444
3482
|
this.projectionMatrix_,
|
|
3445
|
-
|
|
3483
|
+
kC(this.fov),
|
|
3446
3484
|
this.aspectRatio_,
|
|
3447
3485
|
this.near_,
|
|
3448
3486
|
this.far_
|
|
@@ -3453,7 +3491,7 @@ const AB = 0;
|
|
|
3453
3491
|
class Ho {
|
|
3454
3492
|
camera_;
|
|
3455
3493
|
dragActive_ = !1;
|
|
3456
|
-
dragStart_ =
|
|
3494
|
+
dragStart_ = f();
|
|
3457
3495
|
constructor(A) {
|
|
3458
3496
|
this.camera_ = A;
|
|
3459
3497
|
}
|
|
@@ -3485,7 +3523,7 @@ class Ho {
|
|
|
3485
3523
|
I.preventDefault();
|
|
3486
3524
|
const B = BA(A.worldPos), C = I.deltaY < 0 ? 1.05 : 0.95;
|
|
3487
3525
|
this.camera_.zoom(C);
|
|
3488
|
-
const Q = this.camera_.clipToWorld(A.clipPos), E =
|
|
3526
|
+
const Q = this.camera_.clipToWorld(A.clipPos), E = UI(f(), B, Q);
|
|
3489
3527
|
this.camera_.pan(E);
|
|
3490
3528
|
}
|
|
3491
3529
|
onPointerDown(A) {
|
|
@@ -3494,7 +3532,7 @@ class Ho {
|
|
|
3494
3532
|
}
|
|
3495
3533
|
onPointerMove(A) {
|
|
3496
3534
|
if (!this.dragActive_ || !A.worldPos) return;
|
|
3497
|
-
const I =
|
|
3535
|
+
const I = UI(f(), this.dragStart_, A.worldPos);
|
|
3498
3536
|
this.camera_.pan(I);
|
|
3499
3537
|
}
|
|
3500
3538
|
onPointerEnd(A) {
|
|
@@ -3518,22 +3556,22 @@ class IB {
|
|
|
3518
3556
|
);
|
|
3519
3557
|
}
|
|
3520
3558
|
}
|
|
3521
|
-
const
|
|
3559
|
+
const Ig = -1, gB = 0, kQ = 1, BB = 9e-3, LQ = 1e-3, JQ = 9e-4, YQ = 0.5, dQ = 60;
|
|
3522
3560
|
class qo {
|
|
3523
3561
|
camera_;
|
|
3524
3562
|
orbitVelocity_ = new IB(0, 0, 0);
|
|
3525
|
-
panVelocity_ =
|
|
3563
|
+
panVelocity_ = f();
|
|
3526
3564
|
currPos_;
|
|
3527
|
-
currCenter_ =
|
|
3565
|
+
currCenter_ = f();
|
|
3528
3566
|
dampingFactor_;
|
|
3529
|
-
currMouseButton_ =
|
|
3567
|
+
currMouseButton_ = Ig;
|
|
3530
3568
|
constructor(A, I) {
|
|
3531
3569
|
this.camera_ = A, this.currPos_ = new IB(
|
|
3532
3570
|
I?.radius ?? 1,
|
|
3533
3571
|
I?.yaw ?? 0,
|
|
3534
3572
|
I?.pitch ?? 0
|
|
3535
3573
|
), I?.target && HA(this.currCenter_, I.target), this.dampingFactor_ = cA(
|
|
3536
|
-
I?.dampingFactor ??
|
|
3574
|
+
I?.dampingFactor ?? YQ,
|
|
3537
3575
|
0,
|
|
3538
3576
|
1
|
|
3539
3577
|
), this.updateCamera();
|
|
@@ -3559,12 +3597,12 @@ class qo {
|
|
|
3559
3597
|
}
|
|
3560
3598
|
}
|
|
3561
3599
|
onUpdate(A) {
|
|
3562
|
-
if (this.orbitVelocity_.phi === 0 && this.orbitVelocity_.theta === 0 && this.orbitVelocity_.radius === 0 &&
|
|
3600
|
+
if (this.orbitVelocity_.phi === 0 && this.orbitVelocity_.theta === 0 && this.orbitVelocity_.radius === 0 && KB(this.panVelocity_, q(0, 0, 0)))
|
|
3563
3601
|
return;
|
|
3564
3602
|
this.currPos_.phi += this.orbitVelocity_.phi, this.currPos_.theta += this.orbitVelocity_.theta, this.currPos_.radius += this.orbitVelocity_.radius * this.currPos_.radius, lA(this.currCenter_, this.currCenter_, this.panVelocity_);
|
|
3565
|
-
const I = Math.PI / 2 -
|
|
3603
|
+
const I = Math.PI / 2 - p;
|
|
3566
3604
|
this.currPos_.theta = cA(this.currPos_.theta, -I, I), this.currPos_.radius = Math.max(0.01, this.currPos_.radius), this.updateCamera();
|
|
3567
|
-
const B = Math.pow(1 - this.dampingFactor_, A *
|
|
3605
|
+
const B = Math.pow(1 - this.dampingFactor_, A * dQ);
|
|
3568
3606
|
this.orbitVelocity_.phi *= B, this.orbitVelocity_.theta *= B, this.orbitVelocity_.radius *= B, fA(this.panVelocity_, this.panVelocity_, B), this.cutoffLowVelocity();
|
|
3569
3607
|
}
|
|
3570
3608
|
onPointerDown(A) {
|
|
@@ -3572,8 +3610,8 @@ class qo {
|
|
|
3572
3610
|
this.currMouseButton_ = I.button, I.target?.setPointerCapture?.(I.pointerId);
|
|
3573
3611
|
}
|
|
3574
3612
|
onPointerMove(A) {
|
|
3575
|
-
if (this.currMouseButton_ ==
|
|
3576
|
-
const I = A.event, B = I.movementX ?? 0, C = I.movementY ?? 0, Q = this.currMouseButton_ === gB && !I.shiftKey, E = this.currMouseButton_ === gB && I.shiftKey || this.currMouseButton_ ===
|
|
3613
|
+
if (this.currMouseButton_ == Ig) return;
|
|
3614
|
+
const I = A.event, B = I.movementX ?? 0, C = I.movementY ?? 0, Q = this.currMouseButton_ === gB && !I.shiftKey, E = this.currMouseButton_ === gB && I.shiftKey || this.currMouseButton_ === kQ;
|
|
3577
3615
|
Q && this.orbit(B, C), E && this.pan(B, C);
|
|
3578
3616
|
}
|
|
3579
3617
|
onWheel(A) {
|
|
@@ -3583,7 +3621,7 @@ class qo {
|
|
|
3583
3621
|
this.zoom(B);
|
|
3584
3622
|
}
|
|
3585
3623
|
onPointerEnd(A) {
|
|
3586
|
-
this.currMouseButton_ =
|
|
3624
|
+
this.currMouseButton_ = Ig;
|
|
3587
3625
|
const I = A.event;
|
|
3588
3626
|
I.target?.releasePointerCapture?.(I.pointerId);
|
|
3589
3627
|
}
|
|
@@ -3591,18 +3629,18 @@ class qo {
|
|
|
3591
3629
|
this.orbitVelocity_.phi -= A * BB, this.orbitVelocity_.theta += I * BB;
|
|
3592
3630
|
}
|
|
3593
3631
|
pan(A, I) {
|
|
3594
|
-
const B = this.currPos_.radius *
|
|
3595
|
-
|
|
3632
|
+
const B = this.currPos_.radius * LQ, C = f();
|
|
3633
|
+
cI(C, C, this.camera_.right, A), cI(C, C, this.camera_.up, I), fA(C, C, B), UI(this.panVelocity_, this.panVelocity_, C);
|
|
3596
3634
|
}
|
|
3597
3635
|
zoom(A) {
|
|
3598
|
-
this.orbitVelocity_.radius += A *
|
|
3636
|
+
this.orbitVelocity_.radius += A * JQ;
|
|
3599
3637
|
}
|
|
3600
3638
|
updateCamera() {
|
|
3601
|
-
const A = lA(
|
|
3639
|
+
const A = lA(f(), this.currCenter_, this.currPos_.toVec3());
|
|
3602
3640
|
this.camera_.transform.setTranslation(A), this.camera_.transform.targetTo(this.currCenter_);
|
|
3603
3641
|
}
|
|
3604
3642
|
cutoffLowVelocity() {
|
|
3605
|
-
Math.abs(this.orbitVelocity_.phi) <
|
|
3643
|
+
Math.abs(this.orbitVelocity_.phi) < p && (this.orbitVelocity_.phi = 0), Math.abs(this.orbitVelocity_.theta) < p && (this.orbitVelocity_.theta = 0), Math.abs(this.orbitVelocity_.radius) < p && (this.orbitVelocity_.radius = 0), eg(this.panVelocity_) < p && TC(this.panVelocity_);
|
|
3606
3644
|
}
|
|
3607
3645
|
}
|
|
3608
3646
|
class FA {
|
|
@@ -3681,7 +3719,7 @@ class FA {
|
|
|
3681
3719
|
return {};
|
|
3682
3720
|
}
|
|
3683
3721
|
}
|
|
3684
|
-
class
|
|
3722
|
+
class LI extends bA {
|
|
3685
3723
|
// this creates the geometry for a screen-space projected line
|
|
3686
3724
|
// each point on the input path is split into two vertices
|
|
3687
3725
|
// these are pushed in opposite directions in screen-space to create width
|
|
@@ -3737,7 +3775,7 @@ class kI extends bA {
|
|
|
3737
3775
|
return I;
|
|
3738
3776
|
}
|
|
3739
3777
|
}
|
|
3740
|
-
class
|
|
3778
|
+
class wg extends ZA {
|
|
3741
3779
|
color_;
|
|
3742
3780
|
width_;
|
|
3743
3781
|
taperOffset_ = 0.5;
|
|
@@ -3749,7 +3787,7 @@ class ng extends ZA {
|
|
|
3749
3787
|
taperOffset: C,
|
|
3750
3788
|
taperPower: Q
|
|
3751
3789
|
}) {
|
|
3752
|
-
super(), this.geometry = A, this.color_ =
|
|
3790
|
+
super(), this.geometry = A, this.color_ = l.from(I), this.width_ = B, this.taperOffset_ = C ?? this.taperOffset_, this.taperPower_ = Q ?? this.taperPower_, this.programName = "projectedLine";
|
|
3753
3791
|
}
|
|
3754
3792
|
get type() {
|
|
3755
3793
|
return "ProjectedLine";
|
|
@@ -3758,7 +3796,7 @@ class ng extends ZA {
|
|
|
3758
3796
|
return this.color_;
|
|
3759
3797
|
}
|
|
3760
3798
|
set color(A) {
|
|
3761
|
-
this.color_ =
|
|
3799
|
+
this.color_ = l.from(A);
|
|
3762
3800
|
}
|
|
3763
3801
|
get width() {
|
|
3764
3802
|
return this.width_;
|
|
@@ -3793,19 +3831,19 @@ class lo extends FA {
|
|
|
3793
3831
|
super();
|
|
3794
3832
|
const { length: I, width: B } = A;
|
|
3795
3833
|
this.addObject(
|
|
3796
|
-
|
|
3834
|
+
gg({
|
|
3797
3835
|
end: [I, 0, 0],
|
|
3798
3836
|
width: B,
|
|
3799
3837
|
color: [1, 0, 0]
|
|
3800
3838
|
})
|
|
3801
3839
|
), this.addObject(
|
|
3802
|
-
|
|
3840
|
+
gg({
|
|
3803
3841
|
end: [0, I, 0],
|
|
3804
3842
|
width: B,
|
|
3805
3843
|
color: [0, 1, 0]
|
|
3806
3844
|
})
|
|
3807
3845
|
), this.addObject(
|
|
3808
|
-
|
|
3846
|
+
gg({
|
|
3809
3847
|
end: [0, 0, I],
|
|
3810
3848
|
width: B,
|
|
3811
3849
|
color: [0, 0, 1]
|
|
@@ -3815,9 +3853,9 @@ class lo extends FA {
|
|
|
3815
3853
|
update() {
|
|
3816
3854
|
}
|
|
3817
3855
|
}
|
|
3818
|
-
function
|
|
3819
|
-
const { end: A, width: I, color: B } = g, C = new
|
|
3820
|
-
return new
|
|
3856
|
+
function gg(g) {
|
|
3857
|
+
const { end: A, width: I, color: B } = g, C = new LI([[0, 0, 0], A]);
|
|
3858
|
+
return new wg({
|
|
3821
3859
|
geometry: C,
|
|
3822
3860
|
color: B,
|
|
3823
3861
|
width: I
|
|
@@ -3832,18 +3870,18 @@ class fo extends FA {
|
|
|
3832
3870
|
addLine(A) {
|
|
3833
3871
|
const { path: I, color: B, width: C } = A;
|
|
3834
3872
|
this.paths_.push(I);
|
|
3835
|
-
const Q = new
|
|
3836
|
-
this.addObject(new
|
|
3873
|
+
const Q = new LI(I);
|
|
3874
|
+
this.addObject(new wg({ geometry: Q, color: B, width: C }));
|
|
3837
3875
|
}
|
|
3838
3876
|
update() {
|
|
3839
3877
|
}
|
|
3840
3878
|
// TODO: this is temporary - we may want to generalize this to all layers
|
|
3841
3879
|
// for now it is used to set the initial camera position to be centered on the tracks
|
|
3842
3880
|
get extent() {
|
|
3843
|
-
return
|
|
3881
|
+
return MQ(this.paths_.flat());
|
|
3844
3882
|
}
|
|
3845
3883
|
}
|
|
3846
|
-
function
|
|
3884
|
+
function MQ(g) {
|
|
3847
3885
|
function A(o) {
|
|
3848
3886
|
const a = g.map((s) => s[o]);
|
|
3849
3887
|
return [Math.min(...a), Math.max(...a)];
|
|
@@ -3861,17 +3899,17 @@ class po extends FA {
|
|
|
3861
3899
|
this.tracks_.push(A);
|
|
3862
3900
|
let I;
|
|
3863
3901
|
if (A.interpolation) {
|
|
3864
|
-
const i =
|
|
3902
|
+
const i = HQ({
|
|
3865
3903
|
path: A.path,
|
|
3866
3904
|
pointsPerSegment: A.interpolation.pointsPerSegment,
|
|
3867
3905
|
tangentFactor: A.interpolation.tangentFactor
|
|
3868
3906
|
});
|
|
3869
|
-
I = new
|
|
3907
|
+
I = new LI(i);
|
|
3870
3908
|
} else
|
|
3871
|
-
I = new
|
|
3909
|
+
I = new LI(A.path);
|
|
3872
3910
|
const { color: B, width: C } = A, Q = 0.5, E = 1.5;
|
|
3873
3911
|
this.addObject(
|
|
3874
|
-
new
|
|
3912
|
+
new wg({ geometry: I, color: B, width: C, taperOffset: Q, taperPower: E })
|
|
3875
3913
|
);
|
|
3876
3914
|
}
|
|
3877
3915
|
setTimeIndex(A) {
|
|
@@ -3892,10 +3930,10 @@ class po extends FA {
|
|
|
3892
3930
|
// for now it is used to set the initial camera position to be centered on the tracks
|
|
3893
3931
|
get extent() {
|
|
3894
3932
|
const A = this.tracks_.map((I) => I.path);
|
|
3895
|
-
return
|
|
3933
|
+
return KQ(A.flat());
|
|
3896
3934
|
}
|
|
3897
3935
|
}
|
|
3898
|
-
function
|
|
3936
|
+
function KQ(g) {
|
|
3899
3937
|
function A(o) {
|
|
3900
3938
|
const a = g.map((s) => s[o]);
|
|
3901
3939
|
return [Math.min(...a), Math.max(...a)];
|
|
@@ -3903,35 +3941,35 @@ function MQ(g) {
|
|
|
3903
3941
|
const [I, B] = A(0), [C, Q] = A(1), [E, i] = A(2);
|
|
3904
3942
|
return { xMin: I, xMax: B, yMin: C, yMax: Q, zMin: E, zMax: i };
|
|
3905
3943
|
}
|
|
3906
|
-
function
|
|
3944
|
+
function HQ({
|
|
3907
3945
|
path: g,
|
|
3908
3946
|
pointsPerSegment: A,
|
|
3909
3947
|
tangentFactor: I = 1 / 3
|
|
3910
3948
|
}) {
|
|
3911
|
-
const B =
|
|
3949
|
+
const B = qQ(g), C = Array((g.length - 1) * A);
|
|
3912
3950
|
for (let Q = 0; Q < g.length - 1; Q++) {
|
|
3913
3951
|
const E = g[Q], i = g[Q + 1], o = BA(B[Q]);
|
|
3914
|
-
|
|
3952
|
+
cI(o, E, o, I);
|
|
3915
3953
|
const a = BA(B[Q + 1]);
|
|
3916
|
-
|
|
3954
|
+
cI(a, i, a, -I);
|
|
3917
3955
|
for (let s = 0; s < A; s++) {
|
|
3918
|
-
const h = s / A, t = C[Q * A + s] =
|
|
3919
|
-
|
|
3956
|
+
const h = s / A, t = C[Q * A + s] = f();
|
|
3957
|
+
uC(t, E, o, a, i, h);
|
|
3920
3958
|
}
|
|
3921
3959
|
}
|
|
3922
3960
|
return C;
|
|
3923
3961
|
}
|
|
3924
|
-
function
|
|
3962
|
+
function qQ(g) {
|
|
3925
3963
|
if (g.length < 2)
|
|
3926
3964
|
throw new Error("Path must contain at least 2 points");
|
|
3927
|
-
const A = Array(g.length), I =
|
|
3965
|
+
const A = Array(g.length), I = f(), B = f();
|
|
3928
3966
|
for (let C = 0; C < g.length; C++) {
|
|
3929
3967
|
const Q = g[C], E = g[C + 1] ?? g[C];
|
|
3930
|
-
A[C] =
|
|
3968
|
+
A[C] = f(), C !== 0 && HA(I, B), C !== g.length - 1 && UI(B, E, Q), C === 0 ? HA(A[C], B) : C == g.length - 1 ? HA(A[C], I) : (lA(A[C], I, B), fA(A[C], A[C], 0.5));
|
|
3931
3969
|
}
|
|
3932
3970
|
return A;
|
|
3933
3971
|
}
|
|
3934
|
-
class
|
|
3972
|
+
class pB extends bA {
|
|
3935
3973
|
constructor(A, I, B, C) {
|
|
3936
3974
|
super();
|
|
3937
3975
|
const Q = [], E = [], i = B, o = C, a = i + 1, s = o + 1, h = A / i, t = I / o;
|
|
@@ -3982,7 +4020,7 @@ function mA(g) {
|
|
|
3982
4020
|
return "float";
|
|
3983
4021
|
throw new Error("Unsupported buffer type.");
|
|
3984
4022
|
}
|
|
3985
|
-
function
|
|
4023
|
+
function lQ(g) {
|
|
3986
4024
|
if (g.dataFormat === "rgb" || g.dataFormat === "rgba")
|
|
3987
4025
|
return [0, 1];
|
|
3988
4026
|
switch (g.dataType) {
|
|
@@ -4002,7 +4040,7 @@ function qQ(g) {
|
|
|
4002
4040
|
return [0, 1];
|
|
4003
4041
|
}
|
|
4004
4042
|
}
|
|
4005
|
-
class
|
|
4043
|
+
class Fg extends yg {
|
|
4006
4044
|
dataFormat = "rgba";
|
|
4007
4045
|
dataType = "unsigned_byte";
|
|
4008
4046
|
maxFilter = "nearest";
|
|
@@ -4018,8 +4056,8 @@ class wg extends tg {
|
|
|
4018
4056
|
}
|
|
4019
4057
|
}
|
|
4020
4058
|
const QB = 32;
|
|
4021
|
-
function
|
|
4022
|
-
return A === void 0 && (A = !0), I === void 0 ? I =
|
|
4059
|
+
function $A(g, { visible: A, color: I, contrastLimits: B }) {
|
|
4060
|
+
return A === void 0 && (A = !0), I === void 0 ? I = l.WHITE : I = l.from(I), g !== null ? B = fQ(B, g) : B === void 0 && (U.debug(
|
|
4023
4061
|
"Channel",
|
|
4024
4062
|
"No texture provided, defaulting channel contrast limits to [0, 1]."
|
|
4025
4063
|
), B = [0, 1]), {
|
|
@@ -4028,7 +4066,7 @@ function _A(g, { visible: A, color: I, contrastLimits: B }) {
|
|
|
4028
4066
|
contrastLimits: B
|
|
4029
4067
|
};
|
|
4030
4068
|
}
|
|
4031
|
-
function
|
|
4069
|
+
function JI(g, A) {
|
|
4032
4070
|
if (A.length > QB)
|
|
4033
4071
|
throw new Error(`Maximum number of channels is ${QB}`);
|
|
4034
4072
|
if (g?.type === "Texture2DArray") {
|
|
@@ -4038,30 +4076,30 @@ function LI(g, A) {
|
|
|
4038
4076
|
`Number of channels (${A.length}) must match depth of texture (${I}).`
|
|
4039
4077
|
);
|
|
4040
4078
|
}
|
|
4041
|
-
return A.map((I) =>
|
|
4079
|
+
return A.map((I) => $A(g, I));
|
|
4042
4080
|
}
|
|
4043
|
-
function
|
|
4081
|
+
function fQ(g, A) {
|
|
4044
4082
|
if (g === void 0)
|
|
4045
|
-
return
|
|
4083
|
+
return lQ(A);
|
|
4046
4084
|
if (g[1] <= g[0])
|
|
4047
4085
|
throw new Error(
|
|
4048
4086
|
`Contrast limits must be strictly increasing: ${g}.`
|
|
4049
4087
|
);
|
|
4050
4088
|
return g;
|
|
4051
4089
|
}
|
|
4052
|
-
class
|
|
4090
|
+
class rg extends ZA {
|
|
4053
4091
|
channels_;
|
|
4054
4092
|
constructor(A, I, B, C = []) {
|
|
4055
|
-
super(), this.geometry = new
|
|
4093
|
+
super(), this.geometry = new pB(A, I, 1, 1), this.setTexture(0, B), this.channels_ = JI(B, C), this.programName = pQ(B);
|
|
4056
4094
|
}
|
|
4057
4095
|
get type() {
|
|
4058
4096
|
return "ImageRenderable";
|
|
4059
4097
|
}
|
|
4060
4098
|
setChannelProps(A) {
|
|
4061
|
-
this.channels_ =
|
|
4099
|
+
this.channels_ = JI(this.textures[0], A);
|
|
4062
4100
|
}
|
|
4063
4101
|
setChannelProperty(A, I, B) {
|
|
4064
|
-
const C =
|
|
4102
|
+
const C = $A(this.textures[0], {
|
|
4065
4103
|
...this.channels_[A],
|
|
4066
4104
|
[I]: B
|
|
4067
4105
|
});
|
|
@@ -4072,7 +4110,7 @@ class Fg extends ZA {
|
|
|
4072
4110
|
if (!A)
|
|
4073
4111
|
throw new Error("No texture set");
|
|
4074
4112
|
if (A.type === "Texture2D") {
|
|
4075
|
-
const { color: I, contrastLimits: B } = this.channels_[0] ??
|
|
4113
|
+
const { color: I, contrastLimits: B } = this.channels_[0] ?? $A(A, {});
|
|
4076
4114
|
return {
|
|
4077
4115
|
ImageSampler: 0,
|
|
4078
4116
|
Color: I.rgb,
|
|
@@ -4097,14 +4135,14 @@ class Fg extends ZA {
|
|
|
4097
4135
|
}
|
|
4098
4136
|
}
|
|
4099
4137
|
}
|
|
4100
|
-
function
|
|
4138
|
+
function pQ(g) {
|
|
4101
4139
|
if (g.type === "Texture2D")
|
|
4102
|
-
return pQ(g.dataType);
|
|
4103
|
-
if (g.type === "Texture2DArray")
|
|
4104
4140
|
return mQ(g.dataType);
|
|
4141
|
+
if (g.type === "Texture2DArray")
|
|
4142
|
+
return uQ(g.dataType);
|
|
4105
4143
|
throw new Error(`Unsupported image texture type: ${g.type}`);
|
|
4106
4144
|
}
|
|
4107
|
-
function
|
|
4145
|
+
function mQ(g) {
|
|
4108
4146
|
switch (g) {
|
|
4109
4147
|
case "byte":
|
|
4110
4148
|
case "int":
|
|
@@ -4118,7 +4156,7 @@ function pQ(g) {
|
|
|
4118
4156
|
return "floatScalarImage";
|
|
4119
4157
|
}
|
|
4120
4158
|
}
|
|
4121
|
-
function
|
|
4159
|
+
function uQ(g) {
|
|
4122
4160
|
switch (g) {
|
|
4123
4161
|
case "byte":
|
|
4124
4162
|
case "int":
|
|
@@ -4132,7 +4170,7 @@ function mQ(g) {
|
|
|
4132
4170
|
return "floatScalarImageArray";
|
|
4133
4171
|
}
|
|
4134
4172
|
}
|
|
4135
|
-
class
|
|
4173
|
+
class yI extends Fg {
|
|
4136
4174
|
data_;
|
|
4137
4175
|
width_;
|
|
4138
4176
|
height_;
|
|
@@ -4176,20 +4214,20 @@ class tI extends wg {
|
|
|
4176
4214
|
throw new Error(
|
|
4177
4215
|
"Unable to create texture, chunk data is not initialized."
|
|
4178
4216
|
);
|
|
4179
|
-
const C = new
|
|
4217
|
+
const C = new yI(B, A.shape.x, A.shape.y);
|
|
4180
4218
|
return C.unpackAlignment = A.rowAlignmentBytes, C;
|
|
4181
4219
|
}
|
|
4182
4220
|
}
|
|
4183
|
-
function
|
|
4221
|
+
function Sg(g, A, I, B, C = 3) {
|
|
4184
4222
|
switch (g.type) {
|
|
4185
4223
|
case "pointerdown": {
|
|
4186
4224
|
const Q = g.event;
|
|
4187
|
-
return
|
|
4225
|
+
return W(Q.clientX, Q.clientY);
|
|
4188
4226
|
}
|
|
4189
4227
|
case "pointerup": {
|
|
4190
4228
|
if (!A) return A;
|
|
4191
|
-
const Q = g.event, E =
|
|
4192
|
-
if (
|
|
4229
|
+
const Q = g.event, E = W(Q.clientX, Q.clientY);
|
|
4230
|
+
if (jC(A, E) < C) {
|
|
4193
4231
|
if (!B) return null;
|
|
4194
4232
|
const o = g.worldPos;
|
|
4195
4233
|
if (o) {
|
|
@@ -4206,7 +4244,7 @@ function rg(g, A, I, B, C = 3) {
|
|
|
4206
4244
|
return A;
|
|
4207
4245
|
}
|
|
4208
4246
|
}
|
|
4209
|
-
class
|
|
4247
|
+
class mB {
|
|
4210
4248
|
bins_ = /* @__PURE__ */ new Map();
|
|
4211
4249
|
acquire(A) {
|
|
4212
4250
|
const B = this.bins_.get(A)?.pop();
|
|
@@ -4221,13 +4259,13 @@ class pB {
|
|
|
4221
4259
|
this.bins_.clear();
|
|
4222
4260
|
}
|
|
4223
4261
|
}
|
|
4224
|
-
class
|
|
4262
|
+
class uB extends FA {
|
|
4225
4263
|
type = "ChunkedImageLayer";
|
|
4226
4264
|
source_;
|
|
4227
4265
|
sliceCoords_;
|
|
4228
4266
|
onPickValue_;
|
|
4229
4267
|
visibleChunks_ = /* @__PURE__ */ new Map();
|
|
4230
|
-
pool_ = new
|
|
4268
|
+
pool_ = new mB();
|
|
4231
4269
|
initialChannelProps_;
|
|
4232
4270
|
channelChangeCallbacks_ = [];
|
|
4233
4271
|
policy_;
|
|
@@ -4240,10 +4278,10 @@ class mB extends FA {
|
|
|
4240
4278
|
lastPresentationTimeStamp_;
|
|
4241
4279
|
lastPresentationTimeCoord_;
|
|
4242
4280
|
wireframeColors_ = [
|
|
4243
|
-
new
|
|
4244
|
-
new
|
|
4245
|
-
new
|
|
4246
|
-
new
|
|
4281
|
+
new l(0.6, 0.3, 0.3),
|
|
4282
|
+
new l(0.3, 0.6, 0.4),
|
|
4283
|
+
new l(0.4, 0.4, 0.7),
|
|
4284
|
+
new l(0.6, 0.5, 0.3)
|
|
4247
4285
|
];
|
|
4248
4286
|
constructor({
|
|
4249
4287
|
source: A,
|
|
@@ -4297,7 +4335,7 @@ class mB extends FA {
|
|
|
4297
4335
|
return this.lastPresentationTimeCoord_;
|
|
4298
4336
|
}
|
|
4299
4337
|
isPresentationStale() {
|
|
4300
|
-
return this.lastPresentationTimeStamp_ === void 0 ? !1 : performance.now() - this.lastPresentationTimeStamp_ >
|
|
4338
|
+
return this.lastPresentationTimeStamp_ === void 0 ? !1 : performance.now() - this.lastPresentationTimeStamp_ > uB.STALE_PRESENTATION_MS_;
|
|
4301
4339
|
}
|
|
4302
4340
|
resliceIfZChanged() {
|
|
4303
4341
|
const A = this.sliceCoords_.z;
|
|
@@ -4311,7 +4349,7 @@ class mB extends FA {
|
|
|
4311
4349
|
}
|
|
4312
4350
|
}
|
|
4313
4351
|
onEvent(A) {
|
|
4314
|
-
this.pointerDownPos_ =
|
|
4352
|
+
this.pointerDownPos_ = Sg(
|
|
4315
4353
|
A,
|
|
4316
4354
|
this.pointerDownPos_,
|
|
4317
4355
|
(I) => this.getValueAtWorld(I),
|
|
@@ -4334,13 +4372,13 @@ class mB extends FA {
|
|
|
4334
4372
|
set imageSourcePolicy(A) {
|
|
4335
4373
|
this.policy_ !== A && (this.policy_ = A, this.chunkStoreView_ && this.chunkStoreView_.setImageSourcePolicy(
|
|
4336
4374
|
A,
|
|
4337
|
-
|
|
4375
|
+
ng
|
|
4338
4376
|
));
|
|
4339
4377
|
}
|
|
4340
4378
|
slicePlane(A, I) {
|
|
4341
4379
|
if (!A.data) return;
|
|
4342
4380
|
const B = (I - A.offset.z) / A.scale.z, C = Math.round(B), Q = cA(C, 0, A.shape.z - 1);
|
|
4343
|
-
|
|
4381
|
+
Eg(B, Q, 1 + 1e-6) || U.error("ImageLayer", "slicePlane zValue outside extent");
|
|
4344
4382
|
const E = A.shape.x * A.shape.y, i = E * Q;
|
|
4345
4383
|
return A.data.slice(i, i + E);
|
|
4346
4384
|
}
|
|
@@ -4351,10 +4389,10 @@ class mB extends FA {
|
|
|
4351
4389
|
return B ? (B.textures[0].updateWithChunk(A, this.getDataForImage(A)), this.updateImageChunk(B, A), this.channelProps_ && B.setChannelProps(this.channelProps_), B) : this.createImage(A);
|
|
4352
4390
|
}
|
|
4353
4391
|
createImage(A) {
|
|
4354
|
-
const I = new
|
|
4392
|
+
const I = new rg(
|
|
4355
4393
|
A.shape.x,
|
|
4356
4394
|
A.shape.y,
|
|
4357
|
-
|
|
4395
|
+
yI.createWithChunk(A, this.getDataForImage(A)),
|
|
4358
4396
|
this.channelProps_ ?? [{}]
|
|
4359
4397
|
);
|
|
4360
4398
|
return this.updateImageChunk(I, A), I;
|
|
@@ -4386,8 +4424,8 @@ class mB extends FA {
|
|
|
4386
4424
|
}
|
|
4387
4425
|
getValueFromChunk(A, I, B) {
|
|
4388
4426
|
if (!A.data) return null;
|
|
4389
|
-
const C =
|
|
4390
|
-
|
|
4427
|
+
const C = TI(
|
|
4428
|
+
f(),
|
|
4391
4429
|
B,
|
|
4392
4430
|
I.transform.inverse
|
|
4393
4431
|
), Q = Math.floor(C[0]), E = Math.floor(C[1]);
|
|
@@ -4441,7 +4479,7 @@ function EB(g) {
|
|
|
4441
4479
|
`align${g.rowAlignmentBytes}`
|
|
4442
4480
|
].join(":");
|
|
4443
4481
|
}
|
|
4444
|
-
class
|
|
4482
|
+
class TQ extends bA {
|
|
4445
4483
|
constructor(A, I, B, C, Q, E) {
|
|
4446
4484
|
super();
|
|
4447
4485
|
const i = [], o = [], a = Math.floor(C), s = Math.floor(Q), h = Math.floor(E);
|
|
@@ -4488,50 +4526,7 @@ class uQ extends bA {
|
|
|
4488
4526
|
}
|
|
4489
4527
|
}
|
|
4490
4528
|
}
|
|
4491
|
-
class
|
|
4492
|
-
voxelScale = q(1, 1, 1);
|
|
4493
|
-
channels_;
|
|
4494
|
-
constructor(A, I = []) {
|
|
4495
|
-
super(), this.geometry = new uQ(1, 1, 1, 1, 1, 1), this.setTexture(0, A), this.programName = WQ(A.dataType), this.cullFaceMode = "front", this.depthTest = !1, this.channels_ = LI(A, I);
|
|
4496
|
-
}
|
|
4497
|
-
get type() {
|
|
4498
|
-
return "VolumeRenderable";
|
|
4499
|
-
}
|
|
4500
|
-
getUniforms() {
|
|
4501
|
-
const A = this.channels_[0] ?? _A(this.textures[0], {}), { color: I, contrastLimits: B } = A;
|
|
4502
|
-
return {
|
|
4503
|
-
VoxelScale: this.voxelScale,
|
|
4504
|
-
Color: I.rgb,
|
|
4505
|
-
ValueOffset: -B[0],
|
|
4506
|
-
ValueScale: 1 / (B[1] - B[0])
|
|
4507
|
-
};
|
|
4508
|
-
}
|
|
4509
|
-
setChannelProps(A) {
|
|
4510
|
-
this.channels_ = LI(this.textures[0], A);
|
|
4511
|
-
}
|
|
4512
|
-
setChannelProperty(A, I, B) {
|
|
4513
|
-
const C = _A(this.textures[0], {
|
|
4514
|
-
...this.channels_[A],
|
|
4515
|
-
[I]: B
|
|
4516
|
-
});
|
|
4517
|
-
this.channels_[A] = C;
|
|
4518
|
-
}
|
|
4519
|
-
}
|
|
4520
|
-
function WQ(g) {
|
|
4521
|
-
switch (g) {
|
|
4522
|
-
case "byte":
|
|
4523
|
-
case "int":
|
|
4524
|
-
case "short":
|
|
4525
|
-
return "intVolume";
|
|
4526
|
-
case "unsigned_short":
|
|
4527
|
-
case "unsigned_byte":
|
|
4528
|
-
case "unsigned_int":
|
|
4529
|
-
return "uintVolume";
|
|
4530
|
-
case "float":
|
|
4531
|
-
return "floatVolume";
|
|
4532
|
-
}
|
|
4533
|
-
}
|
|
4534
|
-
class Sg extends wg {
|
|
4529
|
+
class jA extends Fg {
|
|
4535
4530
|
data_;
|
|
4536
4531
|
width_;
|
|
4537
4532
|
height_;
|
|
@@ -4575,7 +4570,7 @@ class Sg extends wg {
|
|
|
4575
4570
|
throw new Error(
|
|
4576
4571
|
"Unable to create texture, chunk data is not initialized."
|
|
4577
4572
|
);
|
|
4578
|
-
const B = new
|
|
4573
|
+
const B = new jA(
|
|
4579
4574
|
I,
|
|
4580
4575
|
A.shape.x,
|
|
4581
4576
|
A.shape.y,
|
|
@@ -4584,8 +4579,122 @@ class Sg extends wg {
|
|
|
4584
4579
|
return B.unpackAlignment = A.rowAlignmentBytes, B;
|
|
4585
4580
|
}
|
|
4586
4581
|
}
|
|
4587
|
-
|
|
4588
|
-
|
|
4582
|
+
class xQ extends ZA {
|
|
4583
|
+
voxelScale = q(1, 1, 1);
|
|
4584
|
+
channels_;
|
|
4585
|
+
channelToTextureIndex_ = /* @__PURE__ */ new Map();
|
|
4586
|
+
loadedChannels_ = /* @__PURE__ */ new Set();
|
|
4587
|
+
constructor(A = []) {
|
|
4588
|
+
super(), this.geometry = new TQ(1, 1, 1, 1, 1, 1), this.cullFaceMode = "front", this.depthTest = !1, this.channels_ = JI(null, A), this.programName = iB("float");
|
|
4589
|
+
}
|
|
4590
|
+
get type() {
|
|
4591
|
+
return "VolumeRenderable";
|
|
4592
|
+
}
|
|
4593
|
+
updateVolumeWithChunk(A) {
|
|
4594
|
+
const I = A.chunkIndex.c, B = this.channelToTextureIndex_.get(I);
|
|
4595
|
+
B !== void 0 ? this.updateChannelTexture(B, A) : this.addChannelTexture(I, A), this.loadedChannels_.add(I);
|
|
4596
|
+
}
|
|
4597
|
+
addChannelTexture(A, I) {
|
|
4598
|
+
const B = jA.createWithChunk(I), C = this.textures.length;
|
|
4599
|
+
this.setTexture(C, B), this.channelToTextureIndex_.set(A, C), this.programName = iB(B.dataType);
|
|
4600
|
+
}
|
|
4601
|
+
updateChannelTexture(A, I) {
|
|
4602
|
+
const B = this.textures[A];
|
|
4603
|
+
if (!(B instanceof jA)) {
|
|
4604
|
+
const C = jA.createWithChunk(I);
|
|
4605
|
+
this.setTexture(A, C);
|
|
4606
|
+
return;
|
|
4607
|
+
}
|
|
4608
|
+
B.updateWithChunk(I);
|
|
4609
|
+
}
|
|
4610
|
+
clearLoadedChannels() {
|
|
4611
|
+
this.loadedChannels_ = /* @__PURE__ */ new Set();
|
|
4612
|
+
}
|
|
4613
|
+
getUniforms() {
|
|
4614
|
+
const A = [0, 0, 0, 0], I = [
|
|
4615
|
+
1,
|
|
4616
|
+
1,
|
|
4617
|
+
1,
|
|
4618
|
+
1,
|
|
4619
|
+
1,
|
|
4620
|
+
1,
|
|
4621
|
+
1,
|
|
4622
|
+
1,
|
|
4623
|
+
1,
|
|
4624
|
+
1,
|
|
4625
|
+
1,
|
|
4626
|
+
1
|
|
4627
|
+
], B = [0, 0, 0, 0], C = [1, 1, 1, 1], Q = [], E = Math.max(
|
|
4628
|
+
this.channels_.length,
|
|
4629
|
+
this.channelToTextureIndex_.size
|
|
4630
|
+
);
|
|
4631
|
+
for (let i = 0; i < E && Q.length < 4; i++) {
|
|
4632
|
+
const o = this.channelToTextureIndex_.get(i);
|
|
4633
|
+
if (o === void 0 || !this.loadedChannels_.has(i)) continue;
|
|
4634
|
+
const a = this.textures[o], s = $A(a, this.channels_[i] || {});
|
|
4635
|
+
if (!s.visible) continue;
|
|
4636
|
+
const h = Q.length;
|
|
4637
|
+
I[h * 3] = s.color.rgb[0], I[h * 3 + 1] = s.color.rgb[1], I[h * 3 + 2] = s.color.rgb[2], Q.push(o), B[h] = -s.contrastLimits[0], C[h] = 1 / (s.contrastLimits[1] - s.contrastLimits[0]), A[h] = 1;
|
|
4638
|
+
}
|
|
4639
|
+
return Q.reduce(
|
|
4640
|
+
(i, o, a) => (i[`Channel${a}Sampler`] = o, i),
|
|
4641
|
+
{
|
|
4642
|
+
Visible: A,
|
|
4643
|
+
"Color[0]": I,
|
|
4644
|
+
ValueOffset: B,
|
|
4645
|
+
ValueScale: C,
|
|
4646
|
+
VoxelScale: [
|
|
4647
|
+
this.voxelScale[0],
|
|
4648
|
+
this.voxelScale[1],
|
|
4649
|
+
this.voxelScale[2]
|
|
4650
|
+
]
|
|
4651
|
+
}
|
|
4652
|
+
);
|
|
4653
|
+
}
|
|
4654
|
+
/**
|
|
4655
|
+
* Get an available texture for a channel. If desiredChannelIndex is provided, it will try to return the texture for that channel index. If that texture is not available, or no desiredChannelIndex is passed, return the first available channel texture. This is used to determine which texture to use when updating channel properties, since channel properties can be updated even if the channel's texture hasn't been loaded yet. If no textures are available, it returns null, which signals that default contrast limits should be used when validating the channel properties.
|
|
4656
|
+
*/
|
|
4657
|
+
getAvailableChannelTexture(A) {
|
|
4658
|
+
if (A !== void 0) {
|
|
4659
|
+
const B = this.channelToTextureIndex_.get(A);
|
|
4660
|
+
if (B !== void 0) return this.textures[B];
|
|
4661
|
+
}
|
|
4662
|
+
const I = this.channelToTextureIndex_.values().next().value;
|
|
4663
|
+
return I !== void 0 ? this.textures[I] : null;
|
|
4664
|
+
}
|
|
4665
|
+
setChannelProps(A) {
|
|
4666
|
+
this.channels_ = JI(
|
|
4667
|
+
this.getAvailableChannelTexture(),
|
|
4668
|
+
A
|
|
4669
|
+
);
|
|
4670
|
+
}
|
|
4671
|
+
setChannelProperty(A, I, B) {
|
|
4672
|
+
const C = $A(
|
|
4673
|
+
this.getAvailableChannelTexture(A),
|
|
4674
|
+
{
|
|
4675
|
+
...this.channels_[A],
|
|
4676
|
+
[I]: B
|
|
4677
|
+
}
|
|
4678
|
+
);
|
|
4679
|
+
this.channels_[A] = C;
|
|
4680
|
+
}
|
|
4681
|
+
}
|
|
4682
|
+
function iB(g) {
|
|
4683
|
+
switch (g) {
|
|
4684
|
+
case "byte":
|
|
4685
|
+
case "int":
|
|
4686
|
+
case "short":
|
|
4687
|
+
return "intVolume";
|
|
4688
|
+
case "unsigned_short":
|
|
4689
|
+
case "unsigned_byte":
|
|
4690
|
+
case "unsigned_int":
|
|
4691
|
+
return "uintVolume";
|
|
4692
|
+
case "float":
|
|
4693
|
+
return "floatVolume";
|
|
4694
|
+
}
|
|
4695
|
+
}
|
|
4696
|
+
function WQ(g, A) {
|
|
4697
|
+
const I = A.position, B = f(), C = f();
|
|
4589
4698
|
return g.sort((Q, E) => {
|
|
4590
4699
|
lA(B, Q.boundingBox.max, Q.boundingBox.min), fA(B, B, 0.5), lA(C, E.boundingBox.max, E.boundingBox.min), fA(C, C, 0.5);
|
|
4591
4700
|
const i = Vg(I, B), o = Vg(I, C);
|
|
@@ -4598,7 +4707,7 @@ class mo extends FA {
|
|
|
4598
4707
|
source_;
|
|
4599
4708
|
sliceCoords_;
|
|
4600
4709
|
currentChunks_ = /* @__PURE__ */ new Map();
|
|
4601
|
-
pool_ = new
|
|
4710
|
+
pool_ = new mB();
|
|
4602
4711
|
initialChannelProps_;
|
|
4603
4712
|
channelChangeCallbacks_ = [];
|
|
4604
4713
|
sourcePolicy_;
|
|
@@ -4610,26 +4719,24 @@ class mo extends FA {
|
|
|
4610
4719
|
debugShowWireframes_ = !1;
|
|
4611
4720
|
debugShowDegenerateRays = !1;
|
|
4612
4721
|
relativeStepSize = 1;
|
|
4613
|
-
opacityMultiplier =
|
|
4722
|
+
opacityMultiplier = 1;
|
|
4614
4723
|
earlyTerminationAlpha = 0.99;
|
|
4615
4724
|
get debugShowWireframes() {
|
|
4616
4725
|
return this.debugShowWireframes_;
|
|
4617
4726
|
}
|
|
4618
4727
|
set debugShowWireframes(A) {
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
this.debugShowWireframes_ = A;
|
|
4623
|
-
}
|
|
4728
|
+
this.debugShowWireframes_ !== A && (this.currentVolumes().forEach((I) => {
|
|
4729
|
+
I.wireframeEnabled = A;
|
|
4730
|
+
}), this.debugShowWireframes_ = A);
|
|
4624
4731
|
}
|
|
4625
4732
|
set sourcePolicy(A) {
|
|
4626
4733
|
this.sourcePolicy_ !== A && (this.sourcePolicy_ = A, this.chunkStoreView_ && this.chunkStoreView_.setImageSourcePolicy(
|
|
4627
4734
|
A,
|
|
4628
|
-
|
|
4735
|
+
ng
|
|
4629
4736
|
));
|
|
4630
4737
|
}
|
|
4631
4738
|
setChannelProps(A) {
|
|
4632
|
-
this.channelProps_ = A, this.
|
|
4739
|
+
this.channelProps_ = A, this.currentVolumes().forEach((I) => {
|
|
4633
4740
|
I.setChannelProps(A);
|
|
4634
4741
|
}), this.channelChangeCallbacks_.forEach((I) => {
|
|
4635
4742
|
I();
|
|
@@ -4650,12 +4757,8 @@ class mo extends FA {
|
|
|
4650
4757
|
throw new Error(`Callback to remove could not be found: ${A}`);
|
|
4651
4758
|
this.channelChangeCallbacks_.splice(I, 1);
|
|
4652
4759
|
}
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
Sg.createWithChunk(A),
|
|
4656
|
-
this.channelProps_
|
|
4657
|
-
);
|
|
4658
|
-
return this.updateVolumeChunk(I, A), I;
|
|
4760
|
+
currentVolumes() {
|
|
4761
|
+
return new Set(this.currentChunks_.values());
|
|
4659
4762
|
}
|
|
4660
4763
|
constructor({ source: A, sliceCoords: I, policy: B, channelProps: C }) {
|
|
4661
4764
|
super({ transparent: !0, blendMode: "premultiplied" }), this.source_ = A, this.sliceCoords_ = I, this.sourcePolicy_ = B, this.initialChannelProps_ = C, this.channelProps_ = C, this.setState("initialized");
|
|
@@ -4663,8 +4766,11 @@ class mo extends FA {
|
|
|
4663
4766
|
getVolumeForChunk(A) {
|
|
4664
4767
|
const I = this.currentChunks_.get(A);
|
|
4665
4768
|
if (I) return I;
|
|
4666
|
-
const
|
|
4667
|
-
|
|
4769
|
+
for (const [C, Q] of this.currentChunks_)
|
|
4770
|
+
if (C.chunkIndex.x === A.chunkIndex.x && C.chunkIndex.y === A.chunkIndex.y && C.chunkIndex.z === A.chunkIndex.z && C.chunkIndex.t === A.chunkIndex.t)
|
|
4771
|
+
return Q.updateVolumeWithChunk(A), Q;
|
|
4772
|
+
let B = this.pool_.acquire(oB(A));
|
|
4773
|
+
return B && this.channelProps_ ? B.setChannelProps(this.channelProps_) : B = new xQ(this.channelProps_), B.updateVolumeWithChunk(A), this.updateVolumeTransform(B, A), B;
|
|
4668
4774
|
}
|
|
4669
4775
|
async onAttached(A) {
|
|
4670
4776
|
this.chunkStoreView_ = await A.chunkManager.addView(
|
|
@@ -4687,11 +4793,13 @@ class mo extends FA {
|
|
|
4687
4793
|
this.releaseAndRemoveChunks(Q), this.clearObjects();
|
|
4688
4794
|
for (const E of A) {
|
|
4689
4795
|
const i = this.getVolumeForChunk(E);
|
|
4690
|
-
i.wireframeEnabled = this.debugShowWireframes, this.currentChunks_.set(E, i)
|
|
4796
|
+
i.wireframeEnabled = this.debugShowWireframes, this.currentChunks_.set(E, i);
|
|
4691
4797
|
}
|
|
4692
|
-
this.
|
|
4798
|
+
this.currentVolumes().forEach((E) => {
|
|
4799
|
+
this.addObject(E);
|
|
4800
|
+
}), this.lastLoadedTime_ = I, this.state !== "ready" && this.setState("ready");
|
|
4693
4801
|
}
|
|
4694
|
-
|
|
4802
|
+
updateVolumeTransform(A, I) {
|
|
4695
4803
|
const B = {
|
|
4696
4804
|
x: I.shape.x * I.scale.x,
|
|
4697
4805
|
y: I.shape.y * I.scale.y,
|
|
@@ -4710,9 +4818,10 @@ class mo extends FA {
|
|
|
4710
4818
|
]);
|
|
4711
4819
|
}
|
|
4712
4820
|
releaseAndRemoveChunks(A) {
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4821
|
+
const I = /* @__PURE__ */ new Set();
|
|
4822
|
+
for (const B of A) {
|
|
4823
|
+
const C = this.currentChunks_.get(B);
|
|
4824
|
+
C && !I.has(C) && (C.clearLoadedChannels(), this.pool_.release(oB(B), C), I.add(C)), this.currentChunks_.delete(B);
|
|
4716
4825
|
}
|
|
4717
4826
|
}
|
|
4718
4827
|
update(A) {
|
|
@@ -4726,7 +4835,7 @@ class mo extends FA {
|
|
|
4726
4835
|
A.viewport
|
|
4727
4836
|
);
|
|
4728
4837
|
const I = A.viewport.cameraControls?.isMoving ?? !1;
|
|
4729
|
-
this.interactiveStepSizeScale_ = I ? bQ : 1, this.updateChunks(),
|
|
4838
|
+
this.interactiveStepSizeScale_ = I ? bQ : 1, this.updateChunks(), WQ(this.objects, A.viewport.camera);
|
|
4730
4839
|
}
|
|
4731
4840
|
getUniforms() {
|
|
4732
4841
|
return {
|
|
@@ -4737,7 +4846,7 @@ class mo extends FA {
|
|
|
4737
4846
|
};
|
|
4738
4847
|
}
|
|
4739
4848
|
}
|
|
4740
|
-
function
|
|
4849
|
+
function oB(g) {
|
|
4741
4850
|
return [
|
|
4742
4851
|
`lod${g.lod}`,
|
|
4743
4852
|
`shape${g.shape.x}x${g.shape.y}x${g.shape.z}`,
|
|
@@ -4782,7 +4891,7 @@ class uo extends FA {
|
|
|
4782
4891
|
}
|
|
4783
4892
|
}
|
|
4784
4893
|
onEvent(A) {
|
|
4785
|
-
this.pointerDownPos_ =
|
|
4894
|
+
this.pointerDownPos_ = Sg(
|
|
4786
4895
|
A,
|
|
4787
4896
|
this.pointerDownPos_,
|
|
4788
4897
|
(I) => this.getValueAtWorld(I),
|
|
@@ -4825,18 +4934,18 @@ class uo extends FA {
|
|
|
4825
4934
|
return this.extent_;
|
|
4826
4935
|
}
|
|
4827
4936
|
createImage(A) {
|
|
4828
|
-
const I = new
|
|
4937
|
+
const I = new rg(
|
|
4829
4938
|
A.shape.x,
|
|
4830
4939
|
A.shape.y,
|
|
4831
|
-
|
|
4940
|
+
yI.createWithChunk(A),
|
|
4832
4941
|
this.channelProps
|
|
4833
4942
|
);
|
|
4834
4943
|
return I.transform.setScale([A.scale.x, A.scale.y, 1]), I.transform.setTranslation([A.offset.x, A.offset.y, 0]), I;
|
|
4835
4944
|
}
|
|
4836
4945
|
getValueAtWorld(A) {
|
|
4837
4946
|
if (!this.image_ || !this.chunk_?.data) return null;
|
|
4838
|
-
const I =
|
|
4839
|
-
|
|
4947
|
+
const I = TI(
|
|
4948
|
+
f(),
|
|
4840
4949
|
A,
|
|
4841
4950
|
this.image_.transform.inverse
|
|
4842
4951
|
), B = Math.floor(I[0]), C = Math.floor(I[1]);
|
|
@@ -4847,7 +4956,7 @@ class uo extends FA {
|
|
|
4847
4956
|
return null;
|
|
4848
4957
|
}
|
|
4849
4958
|
}
|
|
4850
|
-
class
|
|
4959
|
+
class AI extends Fg {
|
|
4851
4960
|
data_;
|
|
4852
4961
|
width_;
|
|
4853
4962
|
height_;
|
|
@@ -4887,7 +4996,7 @@ class $A extends wg {
|
|
|
4887
4996
|
throw new Error(
|
|
4888
4997
|
"Unable to create texture, chunk data is not initialized."
|
|
4889
4998
|
);
|
|
4890
|
-
const C = new
|
|
4999
|
+
const C = new AI(B, A.shape.x, A.shape.y);
|
|
4891
5000
|
return C.unpackAlignment = A.rowAlignmentBytes, C;
|
|
4892
5001
|
}
|
|
4893
5002
|
}
|
|
@@ -4903,14 +5012,14 @@ function PQ(g) {
|
|
|
4903
5012
|
return g = g ?? /* @__PURE__ */ new Map(), new Map(
|
|
4904
5013
|
Array.from(g.entries()).map(([A, I]) => [
|
|
4905
5014
|
A,
|
|
4906
|
-
|
|
5015
|
+
l.from(I)
|
|
4907
5016
|
])
|
|
4908
5017
|
);
|
|
4909
5018
|
}
|
|
4910
5019
|
function OQ(g) {
|
|
4911
|
-
return g = g ?? ZQ, g.map(
|
|
5020
|
+
return g = g ?? ZQ, g.map(l.from);
|
|
4912
5021
|
}
|
|
4913
|
-
class
|
|
5022
|
+
class aB {
|
|
4914
5023
|
lookupTable;
|
|
4915
5024
|
cycle;
|
|
4916
5025
|
constructor(A = {}) {
|
|
@@ -4937,7 +5046,7 @@ class XQ extends ZA {
|
|
|
4937
5046
|
outlineSelected_;
|
|
4938
5047
|
selectedValue_;
|
|
4939
5048
|
constructor(A) {
|
|
4940
|
-
super(), this.geometry = new
|
|
5049
|
+
super(), this.geometry = new pB(A.width, A.height, 1, 1), this.setTexture(0, vQ(A.imageData));
|
|
4941
5050
|
const I = this.makeColorCycleTexture(A.colorMap.cycle);
|
|
4942
5051
|
this.setTexture(1, I);
|
|
4943
5052
|
const B = this.makeColorLookupTableTexture(
|
|
@@ -4966,13 +5075,13 @@ class XQ extends ZA {
|
|
|
4966
5075
|
makeColorCycleTexture(A) {
|
|
4967
5076
|
const I = new Uint8Array(
|
|
4968
5077
|
A.flatMap((C) => C.rgba).map((C) => Math.round(C * 255))
|
|
4969
|
-
), B = new
|
|
5078
|
+
), B = new AI(I, A.length, 1);
|
|
4970
5079
|
return B.dataFormat = "rgba", B;
|
|
4971
5080
|
}
|
|
4972
5081
|
makeColorLookupTableTexture(A) {
|
|
4973
|
-
A === void 0 ? A = /* @__PURE__ */ new Map([[0,
|
|
5082
|
+
A === void 0 ? A = /* @__PURE__ */ new Map([[0, l.TRANSPARENT]]) : A.has(0) || (A = new Map([[0, l.TRANSPARENT], ...A]));
|
|
4974
5083
|
const I = Array.from(A.keys()), B = Array.from(A.values()).map((E) => E.packed), C = A.size, Q = new Uint32Array(C * 2);
|
|
4975
|
-
return Q.set(I, 0), Q.set(B, C), new
|
|
5084
|
+
return Q.set(I, 0), Q.set(B, C), new AI(Q, C, 2);
|
|
4976
5085
|
}
|
|
4977
5086
|
}
|
|
4978
5087
|
class To extends FA {
|
|
@@ -4996,7 +5105,7 @@ class To extends FA {
|
|
|
4996
5105
|
outlineSelected: E = !1,
|
|
4997
5106
|
...i
|
|
4998
5107
|
}) {
|
|
4999
|
-
super(i), this.setState("initialized"), this.source_ = A, this.region_ = I, this.colorMap_ = new
|
|
5108
|
+
super(i), this.setState("initialized"), this.source_ = A, this.region_ = I, this.colorMap_ = new aB(B), this.onPickValue_ = C, this.lod_ = Q, this.outlineSelected_ = E;
|
|
5000
5109
|
}
|
|
5001
5110
|
update() {
|
|
5002
5111
|
switch (this.state) {
|
|
@@ -5016,13 +5125,13 @@ class To extends FA {
|
|
|
5016
5125
|
return this.colorMap_;
|
|
5017
5126
|
}
|
|
5018
5127
|
setColorMap(A) {
|
|
5019
|
-
this.colorMap_ = new
|
|
5128
|
+
this.colorMap_ = new aB(A), this.image_ && this.image_.setColorMap(this.colorMap_);
|
|
5020
5129
|
}
|
|
5021
5130
|
setSelectedValue(A) {
|
|
5022
5131
|
this.selectedValue_ = A, this.image_ && this.image_.setSelectedValue(this.selectedValue_);
|
|
5023
5132
|
}
|
|
5024
5133
|
onEvent(A) {
|
|
5025
|
-
this.pointerDownPos_ =
|
|
5134
|
+
this.pointerDownPos_ = Sg(
|
|
5026
5135
|
A,
|
|
5027
5136
|
this.pointerDownPos_,
|
|
5028
5137
|
(I) => this.getValueAtWorld(I),
|
|
@@ -5043,7 +5152,7 @@ class To extends FA {
|
|
|
5043
5152
|
const I = new XQ({
|
|
5044
5153
|
width: A.shape.x,
|
|
5045
5154
|
height: A.shape.y,
|
|
5046
|
-
imageData:
|
|
5155
|
+
imageData: AI.createWithChunk(A),
|
|
5047
5156
|
colorMap: this.colorMap_,
|
|
5048
5157
|
outlineSelected: this.outlineSelected_,
|
|
5049
5158
|
selectedValue: this.selectedValue_
|
|
@@ -5053,8 +5162,8 @@ class To extends FA {
|
|
|
5053
5162
|
getValueAtWorld(A) {
|
|
5054
5163
|
if (!this.image_ || !this.imageChunk_?.data)
|
|
5055
5164
|
return null;
|
|
5056
|
-
const I =
|
|
5057
|
-
|
|
5165
|
+
const I = TI(
|
|
5166
|
+
f(),
|
|
5058
5167
|
A,
|
|
5059
5168
|
this.image_.transform.inverse
|
|
5060
5169
|
), B = Math.floor(I[0]), C = Math.floor(I[1]);
|
|
@@ -5064,9 +5173,9 @@ class To extends FA {
|
|
|
5064
5173
|
return this.imageChunk_.data[Q];
|
|
5065
5174
|
}
|
|
5066
5175
|
}
|
|
5067
|
-
class
|
|
5176
|
+
class xI extends Error {
|
|
5068
5177
|
constructor(A) {
|
|
5069
|
-
super(A), this.name = "AbortError", Object.setPrototypeOf(this,
|
|
5178
|
+
super(A), this.name = "AbortError", Object.setPrototypeOf(this, xI.prototype);
|
|
5070
5179
|
}
|
|
5071
5180
|
}
|
|
5072
5181
|
class jQ {
|
|
@@ -5104,7 +5213,7 @@ class jQ {
|
|
|
5104
5213
|
return this.abortController_.signal;
|
|
5105
5214
|
}
|
|
5106
5215
|
shutdown() {
|
|
5107
|
-
this.abortController_.abort(new
|
|
5216
|
+
this.abortController_.abort(new xI("shutdown"));
|
|
5108
5217
|
}
|
|
5109
5218
|
get numRunning() {
|
|
5110
5219
|
return this.numRunning_;
|
|
@@ -5219,7 +5328,7 @@ class zQ {
|
|
|
5219
5328
|
const B = await Promise.allSettled(I);
|
|
5220
5329
|
for (const C of B)
|
|
5221
5330
|
if (C.status === "rejected") {
|
|
5222
|
-
if (C.reason instanceof
|
|
5331
|
+
if (C.reason instanceof xI)
|
|
5223
5332
|
return Promise.reject(C.reason);
|
|
5224
5333
|
U.error(
|
|
5225
5334
|
"ImageSeriesLoader",
|
|
@@ -5231,7 +5340,7 @@ class zQ {
|
|
|
5231
5340
|
return this.loader_ ??= await this.source_.open(), this.loader_;
|
|
5232
5341
|
}
|
|
5233
5342
|
}
|
|
5234
|
-
class
|
|
5343
|
+
class xo extends FA {
|
|
5235
5344
|
type = "ImageSeriesLayer";
|
|
5236
5345
|
seriesLoader_;
|
|
5237
5346
|
initialChannelProps_;
|
|
@@ -5299,13 +5408,13 @@ class Wo extends FA {
|
|
|
5299
5408
|
return A.chunk && (this.setData(A.chunk), this.setState("ready")), A;
|
|
5300
5409
|
}
|
|
5301
5410
|
setData(A) {
|
|
5302
|
-
!this.texture_ || !this.image_ ? (this.texture_ =
|
|
5411
|
+
!this.texture_ || !this.image_ ? (this.texture_ = yI.createWithChunk(A), this.image_ = this.createImage(A, this.texture_, this.channelProps_), this.addObject(this.image_), this.extent_ = {
|
|
5303
5412
|
x: A.shape.x * A.scale.x,
|
|
5304
5413
|
y: A.shape.y * A.scale.y
|
|
5305
5414
|
}) : A.data && this.texture_.updateWithChunk(A);
|
|
5306
5415
|
}
|
|
5307
5416
|
createImage(A, I, B) {
|
|
5308
|
-
const C = new
|
|
5417
|
+
const C = new rg(
|
|
5309
5418
|
A.shape.x,
|
|
5310
5419
|
A.shape.y,
|
|
5311
5420
|
I,
|
|
@@ -5314,7 +5423,7 @@ class Wo extends FA {
|
|
|
5314
5423
|
return C.transform.setScale([A.scale.x, A.scale.y, 1]), C.transform.setTranslation([A.offset.x, A.offset.y, 0]), C;
|
|
5315
5424
|
}
|
|
5316
5425
|
}
|
|
5317
|
-
function
|
|
5426
|
+
function TB(g, A, I, B = {}) {
|
|
5318
5427
|
return A !== void 0 && I !== void 0 && (B = {
|
|
5319
5428
|
...B,
|
|
5320
5429
|
headers: {
|
|
@@ -5333,13 +5442,13 @@ function _Q(g, A) {
|
|
|
5333
5442
|
}
|
|
5334
5443
|
};
|
|
5335
5444
|
}
|
|
5336
|
-
function
|
|
5445
|
+
function sB(g, A) {
|
|
5337
5446
|
const I = typeof g == "string" ? new URL(g) : g;
|
|
5338
5447
|
I.pathname.endsWith("/") || (I.pathname += "/");
|
|
5339
5448
|
const B = new URL(A.slice(1), I);
|
|
5340
5449
|
return B.search = I.search, B;
|
|
5341
5450
|
}
|
|
5342
|
-
async function
|
|
5451
|
+
async function DB(g) {
|
|
5343
5452
|
if (g.status !== 404) {
|
|
5344
5453
|
if (g.status === 200 || g.status === 206)
|
|
5345
5454
|
return new Uint8Array(await g.arrayBuffer());
|
|
@@ -5356,7 +5465,7 @@ async function $Q(g, A, I, B) {
|
|
|
5356
5465
|
if (!C.ok)
|
|
5357
5466
|
return C;
|
|
5358
5467
|
let Q = C.headers.get("Content-Length"), E = Number(Q);
|
|
5359
|
-
return
|
|
5468
|
+
return TB(g, E - A, E, I);
|
|
5360
5469
|
}
|
|
5361
5470
|
class PA {
|
|
5362
5471
|
url;
|
|
@@ -5369,15 +5478,15 @@ class PA {
|
|
|
5369
5478
|
return _Q(this.#A, A);
|
|
5370
5479
|
}
|
|
5371
5480
|
async get(A, I = {}) {
|
|
5372
|
-
let B =
|
|
5373
|
-
return
|
|
5481
|
+
let B = sB(this.url, A).href, C = await fetch(B, this.#g(I));
|
|
5482
|
+
return DB(C);
|
|
5374
5483
|
}
|
|
5375
5484
|
async getRange(A, I, B = {}) {
|
|
5376
|
-
let C =
|
|
5377
|
-
return "suffixLength" in I ? E = await $Q(C, I.suffixLength, Q, this.#I) : E = await
|
|
5485
|
+
let C = sB(this.url, A), Q = this.#g(B), E;
|
|
5486
|
+
return "suffixLength" in I ? E = await $Q(C, I.suffixLength, Q, this.#I) : E = await TB(C, I.offset, I.length, Q), DB(E);
|
|
5378
5487
|
}
|
|
5379
5488
|
}
|
|
5380
|
-
class
|
|
5489
|
+
class xB {
|
|
5381
5490
|
#A;
|
|
5382
5491
|
constructor(A, I, B) {
|
|
5383
5492
|
typeof A == "number" ? this.#A = new Uint8Array(A) : A instanceof ArrayBuffer ? this.#A = new Uint8Array(A, I, B) : this.#A = new Uint8Array(Array.from(A, (C) => C ? 1 : 0));
|
|
@@ -5461,7 +5570,7 @@ class Rg {
|
|
|
5461
5570
|
yield this.get(A);
|
|
5462
5571
|
}
|
|
5463
5572
|
}
|
|
5464
|
-
class
|
|
5573
|
+
class eI {
|
|
5465
5574
|
#A;
|
|
5466
5575
|
chars;
|
|
5467
5576
|
constructor(A, I, B, C) {
|
|
@@ -5470,7 +5579,7 @@ class yI {
|
|
|
5470
5579
|
else if (I instanceof ArrayBuffer)
|
|
5471
5580
|
C && (C *= A), this.#A = new Int32Array(I, B, C);
|
|
5472
5581
|
else {
|
|
5473
|
-
const Q = I, E = new
|
|
5582
|
+
const Q = I, E = new eI(A, 1);
|
|
5474
5583
|
this.#A = new Int32Array(function* () {
|
|
5475
5584
|
for (let i of Q)
|
|
5476
5585
|
E.set(0, i), yield* E.#A;
|
|
@@ -5516,11 +5625,11 @@ class yI {
|
|
|
5516
5625
|
yield this.get(A);
|
|
5517
5626
|
}
|
|
5518
5627
|
}
|
|
5519
|
-
function
|
|
5628
|
+
function GI(g) {
|
|
5520
5629
|
const A = new TextDecoder().decode(g);
|
|
5521
5630
|
return JSON.parse(A);
|
|
5522
5631
|
}
|
|
5523
|
-
function
|
|
5632
|
+
function hB(g, A) {
|
|
5524
5633
|
const I = A / 2, B = A - 1;
|
|
5525
5634
|
let C = 0;
|
|
5526
5635
|
for (let Q = 0; Q < g.length; Q += A)
|
|
@@ -5533,7 +5642,7 @@ function WB(g) {
|
|
|
5533
5642
|
let A = g.match(/v2:([US])(\d+)/);
|
|
5534
5643
|
if (A) {
|
|
5535
5644
|
let [, B, C] = A;
|
|
5536
|
-
return (B === "U" ?
|
|
5645
|
+
return (B === "U" ? eI : Rg).bind(null, Number(C));
|
|
5537
5646
|
}
|
|
5538
5647
|
let I = {
|
|
5539
5648
|
int8: Int8Array,
|
|
@@ -5547,13 +5656,13 @@ function WB(g) {
|
|
|
5547
5656
|
float16: globalThis.Float16Array,
|
|
5548
5657
|
float32: Float32Array,
|
|
5549
5658
|
float64: Float64Array,
|
|
5550
|
-
bool:
|
|
5659
|
+
bool: xB
|
|
5551
5660
|
}[g];
|
|
5552
|
-
return
|
|
5661
|
+
return x(I, `Unknown or unsupported data_type: ${g}`), I;
|
|
5553
5662
|
}
|
|
5554
5663
|
function UA(g, A) {
|
|
5555
5664
|
const I = g.length;
|
|
5556
|
-
typeof A == "string" && (A = A === "C" ? Array.from({ length: I }, (Q, E) => E) : Array.from({ length: I }, (Q, E) => I - 1 - E)),
|
|
5665
|
+
typeof A == "string" && (A = A === "C" ? Array.from({ length: I }, (Q, E) => E) : Array.from({ length: I }, (Q, E) => I - 1 - E)), x(I === A.length, "Order length must match the number of dimensions.");
|
|
5557
5666
|
let B = 1, C = new Array(I);
|
|
5558
5667
|
for (let Q = A.length - 1; Q >= 0; Q--)
|
|
5559
5668
|
C[A[Q]] = B, B *= g[A[Q]];
|
|
@@ -5574,7 +5683,7 @@ function IE(g) {
|
|
|
5574
5683
|
if (g === "|O")
|
|
5575
5684
|
return { data_type: "v2:object" };
|
|
5576
5685
|
let A = g.match(/^([<|>])(.*)$/);
|
|
5577
|
-
|
|
5686
|
+
x(A, `Invalid dtype: ${g}`);
|
|
5578
5687
|
let [, I, B] = A, C = {
|
|
5579
5688
|
b1: "bool",
|
|
5580
5689
|
i1: "int8",
|
|
@@ -5589,7 +5698,7 @@ function IE(g) {
|
|
|
5589
5698
|
f4: "float32",
|
|
5590
5699
|
f8: "float64"
|
|
5591
5700
|
}[B] ?? (B.startsWith("S") || B.startsWith("U") ? `v2:${B}` : void 0);
|
|
5592
|
-
return
|
|
5701
|
+
return x(C, `Unsupported or unknown dtype: ${g}`), I === "|" ? { data_type: C } : { data_type: C, endian: I === "<" ? "little" : "big" };
|
|
5593
5702
|
}
|
|
5594
5703
|
function gE(g, A = {}) {
|
|
5595
5704
|
let I = [], B = IE(g.dtype);
|
|
@@ -5647,20 +5756,20 @@ function CE(g, A) {
|
|
|
5647
5756
|
function QE(g) {
|
|
5648
5757
|
return g?.name === "sharding_indexed";
|
|
5649
5758
|
}
|
|
5650
|
-
function
|
|
5759
|
+
function bB(g) {
|
|
5651
5760
|
return (g.data_type === "uint64" || g.data_type === "int64") && g.fill_value != null ? BigInt(g.fill_value) : g.fill_value;
|
|
5652
5761
|
}
|
|
5653
|
-
function
|
|
5762
|
+
function ZB(g, ...A) {
|
|
5654
5763
|
if (!A.some((I) => g instanceof I))
|
|
5655
5764
|
throw g;
|
|
5656
5765
|
}
|
|
5657
|
-
function
|
|
5766
|
+
function x(g, A = "") {
|
|
5658
5767
|
if (!g)
|
|
5659
5768
|
throw new Error(A);
|
|
5660
5769
|
}
|
|
5661
|
-
async function
|
|
5770
|
+
async function PB(g, { format: A, signal: I }) {
|
|
5662
5771
|
const B = g instanceof Response ? g : new Response(g);
|
|
5663
|
-
|
|
5772
|
+
x(B.body, "Response does not contain body.");
|
|
5664
5773
|
try {
|
|
5665
5774
|
return await new Response(B.body.pipeThrough(new DecompressionStream(A), { signal: I })).arrayBuffer();
|
|
5666
5775
|
} catch {
|
|
@@ -5670,7 +5779,7 @@ async function ZB(g, { format: A, signal: I }) {
|
|
|
5670
5779
|
class Ng {
|
|
5671
5780
|
kind = "array_to_array";
|
|
5672
5781
|
constructor(A, I) {
|
|
5673
|
-
|
|
5782
|
+
x(A.keepbits >= 0, "keepbits must be zero or positive");
|
|
5674
5783
|
}
|
|
5675
5784
|
static fromConfig(A, I) {
|
|
5676
5785
|
return new Ng(A, I);
|
|
@@ -5691,12 +5800,12 @@ class Ng {
|
|
|
5691
5800
|
return A;
|
|
5692
5801
|
}
|
|
5693
5802
|
}
|
|
5694
|
-
const
|
|
5803
|
+
const tB = EE();
|
|
5695
5804
|
function EE() {
|
|
5696
5805
|
const g = new Uint32Array([305419896]);
|
|
5697
5806
|
return new Uint8Array(g.buffer, g.byteOffset, g.byteLength)[0] !== 18;
|
|
5698
5807
|
}
|
|
5699
|
-
function
|
|
5808
|
+
function yB(g) {
|
|
5700
5809
|
return "BYTES_PER_ELEMENT" in g ? g.BYTES_PER_ELEMENT : 4;
|
|
5701
5810
|
}
|
|
5702
5811
|
class WI {
|
|
@@ -5716,10 +5825,10 @@ class WI {
|
|
|
5716
5825
|
}
|
|
5717
5826
|
encode(A) {
|
|
5718
5827
|
let I = new Uint8Array(A.data.buffer);
|
|
5719
|
-
return
|
|
5828
|
+
return tB && this.#B === "big" && hB(I, yB(this.#I)), I;
|
|
5720
5829
|
}
|
|
5721
5830
|
decode(A) {
|
|
5722
|
-
return
|
|
5831
|
+
return tB && this.#B === "big" && hB(A, yB(this.#I)), {
|
|
5723
5832
|
data: new this.#I(A.buffer, A.byteOffset, A.byteLength / this.#g),
|
|
5724
5833
|
shape: this.#C,
|
|
5725
5834
|
stride: this.#A
|
|
@@ -5747,12 +5856,12 @@ class Ug {
|
|
|
5747
5856
|
throw new Error("Gzip encoding is not enabled by default. Please register a custom codec with `numcodecs/gzip`.");
|
|
5748
5857
|
}
|
|
5749
5858
|
async decode(A) {
|
|
5750
|
-
const I = await
|
|
5859
|
+
const I = await PB(A, { format: "gzip" });
|
|
5751
5860
|
return new Uint8Array(I);
|
|
5752
5861
|
}
|
|
5753
5862
|
}
|
|
5754
5863
|
function iE(g, A) {
|
|
5755
|
-
return
|
|
5864
|
+
return x(!Number.isNaN(A), "JsonCodec allow_nan is false but NaN was encountered during encoding."), x(A !== Number.POSITIVE_INFINITY, "JsonCodec allow_nan is false but Infinity was encountered during encoding."), x(A !== Number.NEGATIVE_INFINITY, "JsonCodec allow_nan is false but -Infinity was encountered during encoding."), A;
|
|
5756
5865
|
}
|
|
5757
5866
|
function oE(g, A) {
|
|
5758
5867
|
return A instanceof Object && !Array.isArray(A) ? Object.keys(A).sort().reduce((I, B) => (I[B] = A[B], I), {}) : A;
|
|
@@ -5782,9 +5891,9 @@ class kg {
|
|
|
5782
5891
|
}
|
|
5783
5892
|
encode(A) {
|
|
5784
5893
|
const { indent: I, encoding: B, ensure_ascii: C, check_circular: Q, allow_nan: E, sort_keys: i } = this.#A;
|
|
5785
|
-
|
|
5894
|
+
x(B === "utf-8", "JsonCodec does not yet support non-utf-8 encoding.");
|
|
5786
5895
|
const o = [];
|
|
5787
|
-
|
|
5896
|
+
x(Q, "JsonCodec does not yet support skipping the check for circular references during encoding."), E || o.push(iE), i && o.push(oE);
|
|
5788
5897
|
const a = Array.from(A.data);
|
|
5789
5898
|
a.push("|O"), a.push(A.shape);
|
|
5790
5899
|
let s;
|
|
@@ -5802,15 +5911,15 @@ class kg {
|
|
|
5802
5911
|
}
|
|
5803
5912
|
decode(A) {
|
|
5804
5913
|
const { strict: I } = this.#I;
|
|
5805
|
-
|
|
5806
|
-
const B =
|
|
5807
|
-
B.pop(),
|
|
5914
|
+
x(I, "JsonCodec does not yet support non-strict decoding.");
|
|
5915
|
+
const B = GI(A), C = B.pop();
|
|
5916
|
+
B.pop(), x(C, "0D not implemented for JsonCodec.");
|
|
5808
5917
|
const Q = UA(C, "C");
|
|
5809
5918
|
return { data: B, shape: C, stride: Q };
|
|
5810
5919
|
}
|
|
5811
5920
|
}
|
|
5812
|
-
function
|
|
5813
|
-
return g instanceof
|
|
5921
|
+
function eB(g) {
|
|
5922
|
+
return g instanceof xB || g instanceof Rg || g instanceof eI ? new Proxy(g, {
|
|
5814
5923
|
get(I, B) {
|
|
5815
5924
|
return I.get(Number(B));
|
|
5816
5925
|
},
|
|
@@ -5821,7 +5930,7 @@ function yB(g) {
|
|
|
5821
5930
|
}
|
|
5822
5931
|
function aE(g, A) {
|
|
5823
5932
|
let I;
|
|
5824
|
-
return g.data instanceof Rg || g.data instanceof
|
|
5933
|
+
return g.data instanceof Rg || g.data instanceof eI ? I = new g.constructor(
|
|
5825
5934
|
// @ts-expect-error
|
|
5826
5935
|
g.data.length,
|
|
5827
5936
|
g.data.chars
|
|
@@ -5832,7 +5941,7 @@ function aE(g, A) {
|
|
|
5832
5941
|
};
|
|
5833
5942
|
}
|
|
5834
5943
|
function sE(g, A) {
|
|
5835
|
-
let I = aE(g, A), B = g.shape.length, C = g.data.length, Q = Array(B).fill(0), E =
|
|
5944
|
+
let I = aE(g, A), B = g.shape.length, C = g.data.length, Q = Array(B).fill(0), E = eB(g.data), i = eB(I.data);
|
|
5836
5945
|
for (let o = 0; o < C; o++) {
|
|
5837
5946
|
let a = 0;
|
|
5838
5947
|
for (let s = 0; s < B; s++)
|
|
@@ -5849,11 +5958,11 @@ function sE(g, A) {
|
|
|
5849
5958
|
}
|
|
5850
5959
|
function DE(g) {
|
|
5851
5960
|
let A = g.shape.length;
|
|
5852
|
-
return
|
|
5961
|
+
return x(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);
|
|
5853
5962
|
}
|
|
5854
5963
|
function hE(g, A) {
|
|
5855
5964
|
let I = DE(g);
|
|
5856
|
-
return
|
|
5965
|
+
return x(I.length === A.length, "Orders must match"), I.every((B, C) => B === A[C]);
|
|
5857
5966
|
}
|
|
5858
5967
|
class Lg {
|
|
5859
5968
|
kind = "array_to_array";
|
|
@@ -5869,7 +5978,7 @@ class Lg {
|
|
|
5869
5978
|
Q[i] = C - i - 1, E[i] = C - i - 1;
|
|
5870
5979
|
else
|
|
5871
5980
|
Q = B, Q.forEach((i, o) => {
|
|
5872
|
-
|
|
5981
|
+
x(E[i] === void 0, `Invalid permutation: ${JSON.stringify(B)}`), E[i] = o;
|
|
5873
5982
|
});
|
|
5874
5983
|
this.#A = Q, this.#I = E;
|
|
5875
5984
|
}
|
|
@@ -5918,7 +6027,7 @@ class Yg {
|
|
|
5918
6027
|
throw new Error("Zlib encoding is not enabled by default. Please register a codec with `numcodecs/zlib`.");
|
|
5919
6028
|
}
|
|
5920
6029
|
async decode(A) {
|
|
5921
|
-
const I = await
|
|
6030
|
+
const I = await PB(A, { format: "deflate" });
|
|
5922
6031
|
return new Uint8Array(I);
|
|
5923
6032
|
}
|
|
5924
6033
|
}
|
|
@@ -5926,11 +6035,11 @@ function tE() {
|
|
|
5926
6035
|
return (/* @__PURE__ */ new Map()).set("blosc", () => import("./blosc-BOWv2fO7.js").then((g) => g.default)).set("lz4", () => import("./lz4-DUlZKApi.js").then((g) => g.default)).set("zstd", () => import("./zstd-DnzmycJs.js").then((g) => g.default)).set("gzip", () => Ug).set("zlib", () => Yg).set("transpose", () => Lg).set("bytes", () => WI).set("crc32c", () => cg).set("vlen-utf8", () => Jg).set("json2", () => kg).set("bitround", () => Ng);
|
|
5927
6036
|
}
|
|
5928
6037
|
const yE = tE();
|
|
5929
|
-
function
|
|
6038
|
+
function og(g) {
|
|
5930
6039
|
let A;
|
|
5931
6040
|
return {
|
|
5932
6041
|
async encode(I) {
|
|
5933
|
-
A || (A = await
|
|
6042
|
+
A || (A = await GB(g));
|
|
5934
6043
|
for (const C of A.array_to_array)
|
|
5935
6044
|
I = await C.encode(I);
|
|
5936
6045
|
let B = await A.array_to_bytes.encode(I);
|
|
@@ -5939,7 +6048,7 @@ function ig(g) {
|
|
|
5939
6048
|
return B;
|
|
5940
6049
|
},
|
|
5941
6050
|
async decode(I) {
|
|
5942
|
-
A || (A = await
|
|
6051
|
+
A || (A = await GB(g));
|
|
5943
6052
|
for (let C = A.bytes_to_bytes.length - 1; C >= 0; C--)
|
|
5944
6053
|
I = await A.bytes_to_bytes[C].decode(I);
|
|
5945
6054
|
let B = await A.array_to_bytes.decode(I);
|
|
@@ -5949,10 +6058,10 @@ function ig(g) {
|
|
|
5949
6058
|
}
|
|
5950
6059
|
};
|
|
5951
6060
|
}
|
|
5952
|
-
async function
|
|
6061
|
+
async function GB(g) {
|
|
5953
6062
|
let A = g.codecs.map(async (Q) => {
|
|
5954
6063
|
let E = await yE.get(Q.name)?.();
|
|
5955
|
-
return
|
|
6064
|
+
return x(E, `Unknown codec: ${Q.name}`), { Codec: E, meta: Q };
|
|
5956
6065
|
}), I = [], B, C = [];
|
|
5957
6066
|
for await (let { Codec: Q, meta: E } of A) {
|
|
5958
6067
|
let i = Q.fromConfig(E.configuration, g);
|
|
@@ -5967,12 +6076,12 @@ async function eB(g) {
|
|
|
5967
6076
|
C.push(i);
|
|
5968
6077
|
}
|
|
5969
6078
|
}
|
|
5970
|
-
return B || (
|
|
6079
|
+
return B || (x(eE(g), `Cannot encode ${g.data_type} to bytes without a codec`), B = WI.fromConfig({ endian: "little" }, g)), { array_to_array: I, array_to_bytes: B, bytes_to_bytes: C };
|
|
5971
6080
|
}
|
|
5972
6081
|
function eE(g) {
|
|
5973
6082
|
return g.data_type !== "v2:object";
|
|
5974
6083
|
}
|
|
5975
|
-
class
|
|
6084
|
+
class nI extends Error {
|
|
5976
6085
|
constructor(A, I = {}) {
|
|
5977
6086
|
super(`Node not found: ${A}`, I), this.name = "NodeNotFoundError";
|
|
5978
6087
|
}
|
|
@@ -5982,10 +6091,10 @@ class dg extends Error {
|
|
|
5982
6091
|
super(`Missing key: ${A}`), this.name = "KeyError";
|
|
5983
6092
|
}
|
|
5984
6093
|
}
|
|
5985
|
-
const
|
|
6094
|
+
const nB = 18446744073709551615n;
|
|
5986
6095
|
function GE(g, A, I, B) {
|
|
5987
|
-
|
|
5988
|
-
let C = g.store.getRange.bind(g.store), Q = A.map((o, a) => o / B.chunk_shape[a]), E =
|
|
6096
|
+
x(g.store.getRange, "Store does not support range requests");
|
|
6097
|
+
let C = g.store.getRange.bind(g.store), Q = A.map((o, a) => o / B.chunk_shape[a]), E = og({
|
|
5989
6098
|
data_type: "uint64",
|
|
5990
6099
|
shape: [...Q, 2],
|
|
5991
6100
|
codecs: B.index_codecs
|
|
@@ -6003,7 +6112,7 @@ function GE(g, A, I, B) {
|
|
|
6003
6112
|
if (h === null)
|
|
6004
6113
|
return;
|
|
6005
6114
|
let { data: t, shape: y, stride: n } = h, w = o.map((c, N) => c % y[N]).reduce((c, N, d) => c + N * n[d], 0), r = t[w], G = t[w + 1];
|
|
6006
|
-
if (!(r ===
|
|
6115
|
+
if (!(r === nB && G === nB))
|
|
6007
6116
|
return C(s, {
|
|
6008
6117
|
offset: Number(r),
|
|
6009
6118
|
length: Number(G)
|
|
@@ -6031,7 +6140,7 @@ class Mg extends z {
|
|
|
6031
6140
|
return this.#A.attributes;
|
|
6032
6141
|
}
|
|
6033
6142
|
}
|
|
6034
|
-
function
|
|
6143
|
+
function wB(g) {
|
|
6035
6144
|
return g.find((I) => I.name === "transpose")?.configuration?.order ?? "C";
|
|
6036
6145
|
}
|
|
6037
6146
|
const OA = Symbol("zarrita.context");
|
|
@@ -6045,12 +6154,12 @@ function wE(g, A) {
|
|
|
6045
6154
|
fill_value: A.fill_value
|
|
6046
6155
|
};
|
|
6047
6156
|
if (I) {
|
|
6048
|
-
let Q =
|
|
6157
|
+
let Q = wB(I.codecs);
|
|
6049
6158
|
return {
|
|
6050
6159
|
...B,
|
|
6051
6160
|
kind: "sharded",
|
|
6052
6161
|
chunk_shape: I.chunk_shape,
|
|
6053
|
-
codec:
|
|
6162
|
+
codec: og({
|
|
6054
6163
|
data_type: A.data_type,
|
|
6055
6164
|
shape: I.chunk_shape,
|
|
6056
6165
|
codecs: I.codecs
|
|
@@ -6061,12 +6170,12 @@ function wE(g, A) {
|
|
|
6061
6170
|
get_chunk_bytes: GE(g, A.chunk_grid.configuration.chunk_shape, B.encode_chunk_key, I)
|
|
6062
6171
|
};
|
|
6063
6172
|
}
|
|
6064
|
-
let C =
|
|
6173
|
+
let C = wB(A.codecs);
|
|
6065
6174
|
return {
|
|
6066
6175
|
...B,
|
|
6067
6176
|
kind: "regular",
|
|
6068
6177
|
chunk_shape: A.chunk_grid.configuration.chunk_shape,
|
|
6069
|
-
codec:
|
|
6178
|
+
codec: og({
|
|
6070
6179
|
data_type: A.data_type,
|
|
6071
6180
|
shape: A.chunk_grid.configuration.chunk_shape,
|
|
6072
6181
|
codecs: A.codecs
|
|
@@ -6080,14 +6189,14 @@ function wE(g, A) {
|
|
|
6080
6189
|
}
|
|
6081
6190
|
};
|
|
6082
6191
|
}
|
|
6083
|
-
let
|
|
6192
|
+
let YI = class extends z {
|
|
6084
6193
|
kind = "array";
|
|
6085
6194
|
#A;
|
|
6086
6195
|
[OA];
|
|
6087
6196
|
constructor(A, I, B) {
|
|
6088
6197
|
super(A, I), this.#A = {
|
|
6089
6198
|
...B,
|
|
6090
|
-
fill_value:
|
|
6199
|
+
fill_value: bB(B)
|
|
6091
6200
|
}, this[OA] = wE(this, B);
|
|
6092
6201
|
}
|
|
6093
6202
|
get attrs() {
|
|
@@ -6162,7 +6271,7 @@ function SE({ start: g, stop: A, step: I }, B) {
|
|
|
6162
6271
|
const C = I < 0, [Q, E] = C ? [-1, B - 1] : [0, B];
|
|
6163
6272
|
return g === null ? g = C ? E : Q : g < 0 ? (g += B, g < Q && (g = Q)) : g > E && (g = E), A === null ? A = C ? Q : E : A < 0 ? (A += B, A < Q && (A = Q)) : A > E && (A = E), [g, A, I];
|
|
6164
6273
|
}
|
|
6165
|
-
function
|
|
6274
|
+
function dI(g, A, I = null) {
|
|
6166
6275
|
return A === void 0 && (A = g, g = null), {
|
|
6167
6276
|
start: g,
|
|
6168
6277
|
stop: A,
|
|
@@ -6209,7 +6318,7 @@ class JE {
|
|
|
6209
6318
|
yield { dim_chunk_ix: A, dim_chunk_sel: B };
|
|
6210
6319
|
}
|
|
6211
6320
|
}
|
|
6212
|
-
class
|
|
6321
|
+
class FB {
|
|
6213
6322
|
start;
|
|
6214
6323
|
stop;
|
|
6215
6324
|
step;
|
|
@@ -6246,18 +6355,18 @@ class wB {
|
|
|
6246
6355
|
}
|
|
6247
6356
|
function YE(g, A) {
|
|
6248
6357
|
let I = [];
|
|
6249
|
-
return g === null ? I = A.map((B) =>
|
|
6358
|
+
return g === null ? I = A.map((B) => dI(null)) : Array.isArray(g) && (I = g.map((B) => B ?? dI(null))), kE(I, A), I;
|
|
6250
6359
|
}
|
|
6251
6360
|
class dE {
|
|
6252
6361
|
dim_indexers;
|
|
6253
6362
|
shape;
|
|
6254
6363
|
constructor({ selection: A, shape: I, chunk_shape: B }) {
|
|
6255
|
-
this.dim_indexers = YE(A, I).map((C, Q) => new (typeof C == "number" ? JE :
|
|
6364
|
+
this.dim_indexers = YE(A, I).map((C, Q) => new (typeof C == "number" ? JE : FB)({
|
|
6256
6365
|
// @ts-expect-error ts inference not strong enough to know correct chunk
|
|
6257
6366
|
dim_sel: C,
|
|
6258
6367
|
dim_len: I[Q],
|
|
6259
6368
|
dim_chunk_len: B[Q]
|
|
6260
|
-
})), this.shape = this.dim_indexers.filter((C) => C instanceof
|
|
6369
|
+
})), this.shape = this.dim_indexers.filter((C) => C instanceof FB).map((C) => C.nitems);
|
|
6261
6370
|
}
|
|
6262
6371
|
*[Symbol.iterator]() {
|
|
6263
6372
|
for (const A of rE(...this.dim_indexers)) {
|
|
@@ -6298,7 +6407,7 @@ function Hg(g, A = 0, I) {
|
|
|
6298
6407
|
}
|
|
6299
6408
|
};
|
|
6300
6409
|
}
|
|
6301
|
-
function
|
|
6410
|
+
function Bg(g) {
|
|
6302
6411
|
return globalThis.Array.isArray(g.data) ? {
|
|
6303
6412
|
// @ts-expect-error
|
|
6304
6413
|
data: Hg(g.data),
|
|
@@ -6324,21 +6433,21 @@ const lE = {
|
|
|
6324
6433
|
return { data: g, shape: A, stride: I };
|
|
6325
6434
|
},
|
|
6326
6435
|
set_scalar(g, A, I) {
|
|
6327
|
-
let B =
|
|
6328
|
-
|
|
6436
|
+
let B = Bg(g);
|
|
6437
|
+
ag(B, A, qE(g, I), B.bytes_per_element);
|
|
6329
6438
|
},
|
|
6330
6439
|
set_from_chunk(g, A, I) {
|
|
6331
|
-
let B =
|
|
6332
|
-
|
|
6440
|
+
let B = Bg(g);
|
|
6441
|
+
SI(B, Bg(A), B.bytes_per_element, I);
|
|
6333
6442
|
}
|
|
6334
6443
|
};
|
|
6335
6444
|
async function fE(g, A = null, I = {}) {
|
|
6336
6445
|
return KE(g, A, I, lE);
|
|
6337
6446
|
}
|
|
6338
|
-
function
|
|
6447
|
+
function OB(g, A, I) {
|
|
6339
6448
|
return I < 0 && A < g ? Math.floor((g - A - 1) / -I) + 1 : g < A ? Math.floor((A - g - 1) / I) + 1 : 0;
|
|
6340
6449
|
}
|
|
6341
|
-
function
|
|
6450
|
+
function ag(g, A, I, B) {
|
|
6342
6451
|
if (A.length === 0) {
|
|
6343
6452
|
g.data.set(I, 0);
|
|
6344
6453
|
return;
|
|
@@ -6346,10 +6455,10 @@ function og(g, A, I, B) {
|
|
|
6346
6455
|
const [C, ...Q] = A, [E, ...i] = g.stride;
|
|
6347
6456
|
if (typeof C == "number") {
|
|
6348
6457
|
const t = g.data.subarray(E * C * B);
|
|
6349
|
-
|
|
6458
|
+
ag({ data: t, stride: i }, Q, I, B);
|
|
6350
6459
|
return;
|
|
6351
6460
|
}
|
|
6352
|
-
const [o, a, s] = C, h =
|
|
6461
|
+
const [o, a, s] = C, h = OB(o, a, s);
|
|
6353
6462
|
if (Q.length === 0) {
|
|
6354
6463
|
for (let t = 0; t < h; t++)
|
|
6355
6464
|
g.data.set(I, E * (o + s * t) * B);
|
|
@@ -6357,17 +6466,17 @@ function og(g, A, I, B) {
|
|
|
6357
6466
|
}
|
|
6358
6467
|
for (let t = 0; t < h; t++) {
|
|
6359
6468
|
const y = g.data.subarray(E * (o + s * t) * B);
|
|
6360
|
-
|
|
6469
|
+
ag({ data: y, stride: i }, Q, I, B);
|
|
6361
6470
|
}
|
|
6362
6471
|
}
|
|
6363
|
-
function
|
|
6472
|
+
function SI(g, A, I, B) {
|
|
6364
6473
|
const [C, ...Q] = B, [E, ...i] = g.stride, [o, ...a] = A.stride;
|
|
6365
6474
|
if (C.from === null) {
|
|
6366
6475
|
if (Q.length === 0) {
|
|
6367
6476
|
g.data.set(A.data.subarray(0, I), C.to * I);
|
|
6368
6477
|
return;
|
|
6369
6478
|
}
|
|
6370
|
-
|
|
6479
|
+
SI({
|
|
6371
6480
|
data: g.data.subarray(E * C.to * I),
|
|
6372
6481
|
stride: i
|
|
6373
6482
|
}, A, I, Q);
|
|
@@ -6379,13 +6488,13 @@ function rI(g, A, I, B) {
|
|
|
6379
6488
|
g.data.set(A.data.subarray(G, G + I), 0);
|
|
6380
6489
|
return;
|
|
6381
6490
|
}
|
|
6382
|
-
|
|
6491
|
+
SI(g, {
|
|
6383
6492
|
data: A.data.subarray(o * C.from * I),
|
|
6384
6493
|
stride: a
|
|
6385
6494
|
}, I, Q);
|
|
6386
6495
|
return;
|
|
6387
6496
|
}
|
|
6388
|
-
const [s, h, t] = C.to, [y, n, w] = C.from, r =
|
|
6497
|
+
const [s, h, t] = C.to, [y, n, w] = C.from, r = OB(s, h, t);
|
|
6389
6498
|
if (Q.length === 0) {
|
|
6390
6499
|
if (t === 1 && w === 1 && E === 1 && o === 1) {
|
|
6391
6500
|
let G = y * I, c = r * I;
|
|
@@ -6399,7 +6508,7 @@ function rI(g, A, I, B) {
|
|
|
6399
6508
|
return;
|
|
6400
6509
|
}
|
|
6401
6510
|
for (let G = 0; G < r; G++)
|
|
6402
|
-
|
|
6511
|
+
SI({
|
|
6403
6512
|
data: g.data.subarray(E * (s + G * t) * I),
|
|
6404
6513
|
stride: i
|
|
6405
6514
|
}, {
|
|
@@ -6407,7 +6516,7 @@ function rI(g, A, I, B) {
|
|
|
6407
6516
|
stride: a
|
|
6408
6517
|
}, I, Q);
|
|
6409
6518
|
}
|
|
6410
|
-
let
|
|
6519
|
+
let bI = pE();
|
|
6411
6520
|
function pE() {
|
|
6412
6521
|
let g = /* @__PURE__ */ new WeakMap();
|
|
6413
6522
|
function A(I) {
|
|
@@ -6426,51 +6535,51 @@ function pE() {
|
|
|
6426
6535
|
}
|
|
6427
6536
|
async function mE(g) {
|
|
6428
6537
|
let A = await g.store.get(g.resolve(".zattrs").path);
|
|
6429
|
-
return A ?
|
|
6538
|
+
return A ? GI(A) : {};
|
|
6430
6539
|
}
|
|
6431
6540
|
async function uE(g, A = {}) {
|
|
6432
6541
|
let I = "store" in g ? g : new z(g), B = {};
|
|
6433
|
-
return (A.attrs ?? !0) && (B = await mE(I)), A.kind === "array" ?
|
|
6542
|
+
return (A.attrs ?? !0) && (B = await mE(I)), A.kind === "array" ? rB(I, B) : A.kind === "group" ? SB(I, B) : rB(I, B).catch((C) => (ZB(C, nI), SB(I, B)));
|
|
6434
6543
|
}
|
|
6435
|
-
async function
|
|
6544
|
+
async function rB(g, A) {
|
|
6436
6545
|
let { path: I } = g.resolve(".zarray"), B = await g.store.get(I);
|
|
6437
6546
|
if (!B)
|
|
6438
|
-
throw new
|
|
6547
|
+
throw new nI("v2 array", {
|
|
6439
6548
|
cause: new dg(I)
|
|
6440
6549
|
});
|
|
6441
|
-
return
|
|
6550
|
+
return bI.increment(g.store, "v2"), new YI(g.store, g.path, gE(GI(B), A));
|
|
6442
6551
|
}
|
|
6443
|
-
async function
|
|
6552
|
+
async function SB(g, A) {
|
|
6444
6553
|
let { path: I } = g.resolve(".zgroup"), B = await g.store.get(I);
|
|
6445
6554
|
if (!B)
|
|
6446
|
-
throw new
|
|
6555
|
+
throw new nI("v2 group", {
|
|
6447
6556
|
cause: new dg(I)
|
|
6448
6557
|
});
|
|
6449
|
-
return
|
|
6558
|
+
return bI.increment(g.store, "v2"), new Mg(g.store, g.path, BE(GI(B), A));
|
|
6450
6559
|
}
|
|
6451
6560
|
async function TE(g) {
|
|
6452
6561
|
let { store: A, path: I } = g.resolve("zarr.json"), B = await g.store.get(I);
|
|
6453
6562
|
if (!B)
|
|
6454
|
-
throw new
|
|
6563
|
+
throw new nI("v3 array or group", {
|
|
6455
6564
|
cause: new dg(I)
|
|
6456
6565
|
});
|
|
6457
|
-
let C =
|
|
6458
|
-
return C.node_type === "array" && (C.fill_value =
|
|
6566
|
+
let C = GI(B);
|
|
6567
|
+
return C.node_type === "array" && (C.fill_value = bB(C)), C.node_type === "array" ? new YI(A, g.path, C) : new Mg(A, g.path, C);
|
|
6459
6568
|
}
|
|
6460
|
-
async function
|
|
6569
|
+
async function xE(g, A = {}) {
|
|
6461
6570
|
let I = "store" in g ? g : new z(g), B = await TE(I);
|
|
6462
|
-
if (
|
|
6571
|
+
if (bI.increment(I.store, "v3"), A.kind === void 0 || A.kind === "array" && B instanceof YI || A.kind === "group" && B instanceof Mg)
|
|
6463
6572
|
return B;
|
|
6464
|
-
let C = B instanceof
|
|
6573
|
+
let C = B instanceof YI ? "array" : "group";
|
|
6465
6574
|
throw new Error(`Expected node of kind ${A.kind}, found ${C}.`);
|
|
6466
6575
|
}
|
|
6467
6576
|
async function IA(g, A = {}) {
|
|
6468
|
-
let I = "store" in g ? g.store : g, B =
|
|
6469
|
-
return C(g, A).catch((E) => (
|
|
6577
|
+
let I = "store" in g ? g.store : g, B = bI.version_max(I), C = B === "v2" ? IA.v2 : IA.v3, Q = B === "v2" ? IA.v3 : IA.v2;
|
|
6578
|
+
return C(g, A).catch((E) => (ZB(E, nI), Q(g, A)));
|
|
6470
6579
|
}
|
|
6471
6580
|
IA.v2 = uE;
|
|
6472
|
-
IA.v3 =
|
|
6473
|
-
async function
|
|
6581
|
+
IA.v3 = xE;
|
|
6582
|
+
async function WE(g, A) {
|
|
6474
6583
|
const I = A.split("/"), B = I.pop();
|
|
6475
6584
|
if (!B)
|
|
6476
6585
|
throw new Error("Invalid path");
|
|
@@ -6487,7 +6596,7 @@ class qg {
|
|
|
6487
6596
|
return this.#A;
|
|
6488
6597
|
}
|
|
6489
6598
|
async get(A) {
|
|
6490
|
-
const I = await
|
|
6599
|
+
const I = await WE(this.#A, A.slice(1)).catch(
|
|
6491
6600
|
() => {
|
|
6492
6601
|
}
|
|
6493
6602
|
);
|
|
@@ -6633,7 +6742,7 @@ ${d}`, k = await this.getSignatureKey(
|
|
|
6633
6742
|
return Array.from(A).map((I) => I.toString(16).padStart(2, "0")).join("");
|
|
6634
6743
|
}
|
|
6635
6744
|
}
|
|
6636
|
-
async function
|
|
6745
|
+
async function wI(g, A) {
|
|
6637
6746
|
if (A === "v2")
|
|
6638
6747
|
try {
|
|
6639
6748
|
return IA.v2(g, { kind: "group", attrs: !0 });
|
|
@@ -6730,7 +6839,7 @@ function OE(g, A, I) {
|
|
|
6730
6839
|
`Unsupported store type: ${g.store.constructor.name}`
|
|
6731
6840
|
);
|
|
6732
6841
|
}
|
|
6733
|
-
const
|
|
6842
|
+
const VB = `function Bg(i, A, g, E = {}) {
|
|
6734
6843
|
return A !== void 0 && g !== void 0 && (E = {
|
|
6735
6844
|
...E,
|
|
6736
6845
|
headers: {
|
|
@@ -9873,11 +9982,11 @@ return ret;
|
|
|
9873
9982
|
default: FB
|
|
9874
9983
|
});
|
|
9875
9984
|
//# sourceMappingURL=worker_kernel-uaRPnPAm.js.map
|
|
9876
|
-
`,
|
|
9985
|
+
`, RB = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", VB], { type: "text/javascript;charset=utf-8" });
|
|
9877
9986
|
function VE(g) {
|
|
9878
9987
|
let A;
|
|
9879
9988
|
try {
|
|
9880
|
-
if (A =
|
|
9989
|
+
if (A = RB && (self.URL || self.webkitURL).createObjectURL(RB), !A) throw "";
|
|
9881
9990
|
const I = new Worker(A, {
|
|
9882
9991
|
type: "module",
|
|
9883
9992
|
name: g?.name
|
|
@@ -9887,7 +9996,7 @@ function VE(g) {
|
|
|
9887
9996
|
}), I;
|
|
9888
9997
|
} catch {
|
|
9889
9998
|
return new Worker(
|
|
9890
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
9999
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(VB),
|
|
9891
10000
|
{
|
|
9892
10001
|
type: "module",
|
|
9893
10002
|
name: g?.name
|
|
@@ -9896,9 +10005,9 @@ function VE(g) {
|
|
|
9896
10005
|
}
|
|
9897
10006
|
}
|
|
9898
10007
|
const vE = Math.min(navigator.hardwareConcurrency, 8);
|
|
9899
|
-
let CA = [], XE = 0,
|
|
9900
|
-
const kA = /* @__PURE__ */ new Map(),
|
|
9901
|
-
function
|
|
10008
|
+
let CA = [], XE = 0, vB = 0;
|
|
10009
|
+
const kA = /* @__PURE__ */ new Map(), MI = /* @__PURE__ */ new Set();
|
|
10010
|
+
function XB(g) {
|
|
9902
10011
|
const A = CA.find((I) => I.worker === g);
|
|
9903
10012
|
return A || U.error(
|
|
9904
10013
|
"ZarrWorker",
|
|
@@ -9908,7 +10017,7 @@ function vB(g) {
|
|
|
9908
10017
|
function jE(g, A) {
|
|
9909
10018
|
const { id: I, success: B } = g.data, C = kA.get(I);
|
|
9910
10019
|
if (!C) {
|
|
9911
|
-
|
|
10020
|
+
MI.has(I) ? MI.delete(I) : U.warn(
|
|
9912
10021
|
"ZarrWorker",
|
|
9913
10022
|
`Received response for unknown message ID ${I}:`,
|
|
9914
10023
|
g.data
|
|
@@ -9916,13 +10025,13 @@ function jE(g, A) {
|
|
|
9916
10025
|
return;
|
|
9917
10026
|
}
|
|
9918
10027
|
kA.delete(I), C.abortListener && C.abortSignal && C.abortSignal.removeEventListener("abort", C.abortListener);
|
|
9919
|
-
const Q =
|
|
10028
|
+
const Q = XB(A);
|
|
9920
10029
|
Q && Q.pendingCount > 0 ? Q.pendingCount-- : Q && U.error(
|
|
9921
10030
|
"ZarrWorker",
|
|
9922
10031
|
"Received message but no pending tasks - this should not happen"
|
|
9923
10032
|
), B && g.data.type === "getChunk" ? C.resolve(g.data.chunk) : B || C.reject(new Error(g.data.error || "Unknown worker error"));
|
|
9924
10033
|
}
|
|
9925
|
-
function
|
|
10034
|
+
function NB(g, A) {
|
|
9926
10035
|
if (g instanceof MessageEvent) {
|
|
9927
10036
|
U.error(
|
|
9928
10037
|
"ZarrWorker",
|
|
@@ -9935,7 +10044,7 @@ function RB(g, A) {
|
|
|
9935
10044
|
"Worker failed - replacing worker and canceling its in-flight messages",
|
|
9936
10045
|
g.message
|
|
9937
10046
|
);
|
|
9938
|
-
const I =
|
|
10047
|
+
const I = XB(A);
|
|
9939
10048
|
if (I) {
|
|
9940
10049
|
const C = CA.indexOf(I);
|
|
9941
10050
|
CA.splice(C, 1);
|
|
@@ -9945,21 +10054,21 @@ function RB(g, A) {
|
|
|
9945
10054
|
for (const [C, Q] of kA.entries())
|
|
9946
10055
|
Q.workerId === B && (Q.reject(new Error(`Worker error: ${g.message}`)), kA.delete(C));
|
|
9947
10056
|
try {
|
|
9948
|
-
const C =
|
|
10057
|
+
const C = jB();
|
|
9949
10058
|
CA.push({
|
|
9950
10059
|
worker: C,
|
|
9951
10060
|
pendingCount: 0,
|
|
9952
|
-
workerId:
|
|
10061
|
+
workerId: vB++
|
|
9953
10062
|
}), U.debug("ZarrWorker", "Replacement worker created successfully");
|
|
9954
10063
|
} catch (C) {
|
|
9955
10064
|
U.error("ZarrWorker", "Failed to create replacement worker", C);
|
|
9956
10065
|
}
|
|
9957
10066
|
}
|
|
9958
|
-
function
|
|
10067
|
+
function jB() {
|
|
9959
10068
|
const g = new VE();
|
|
9960
|
-
return g.addEventListener("message", (A) => jE(A, g)), g.addEventListener("error", (A) =>
|
|
10069
|
+
return g.addEventListener("message", (A) => jE(A, g)), g.addEventListener("error", (A) => NB(A, g)), g.addEventListener(
|
|
9961
10070
|
"messageerror",
|
|
9962
|
-
(A) =>
|
|
10071
|
+
(A) => NB(A, g)
|
|
9963
10072
|
), g;
|
|
9964
10073
|
}
|
|
9965
10074
|
function zE() {
|
|
@@ -9979,10 +10088,10 @@ async function _E(g, A, I) {
|
|
|
9979
10088
|
Q.worker.postMessage({
|
|
9980
10089
|
id: E,
|
|
9981
10090
|
type: "cancel"
|
|
9982
|
-
}), kA.delete(E),
|
|
10091
|
+
}), kA.delete(E), MI.add(E), Q.pendingCount--, C(new DOMException("Operation was aborted", "AbortError"));
|
|
9983
10092
|
};
|
|
9984
10093
|
if (I.signal.aborted) {
|
|
9985
|
-
o(),
|
|
10094
|
+
o(), MI.delete(E);
|
|
9986
10095
|
return;
|
|
9987
10096
|
}
|
|
9988
10097
|
I.signal.addEventListener("abort", o, { once: !0 }), i.abortListener = o, i.abortSignal = I.signal;
|
|
@@ -9999,11 +10108,11 @@ function $E() {
|
|
|
9999
10108
|
if (!(CA.length > 0))
|
|
10000
10109
|
try {
|
|
10001
10110
|
for (let g = 0; g < vE; g++) {
|
|
10002
|
-
const A =
|
|
10111
|
+
const A = jB();
|
|
10003
10112
|
CA.push({
|
|
10004
10113
|
worker: A,
|
|
10005
10114
|
pendingCount: 0,
|
|
10006
|
-
workerId:
|
|
10115
|
+
workerId: vB++
|
|
10007
10116
|
});
|
|
10008
10117
|
}
|
|
10009
10118
|
U.debug(
|
|
@@ -10064,7 +10173,7 @@ class Bi {
|
|
|
10064
10173
|
throw new Error(
|
|
10065
10174
|
`Received chunk has an unsupported data type, data=${E.data.constructor.name}`
|
|
10066
10175
|
);
|
|
10067
|
-
|
|
10176
|
+
UB(E);
|
|
10068
10177
|
const i = {
|
|
10069
10178
|
x: E.shape[this.dimensions_.x.index],
|
|
10070
10179
|
y: E.shape[this.dimensions_.y.index],
|
|
@@ -10115,7 +10224,7 @@ class Bi {
|
|
|
10115
10224
|
throw new Error(
|
|
10116
10225
|
`Subarray has an unsupported data type, data=${i.data.constructor.name}`
|
|
10117
10226
|
);
|
|
10118
|
-
if (
|
|
10227
|
+
if (UB(i), i.shape.length !== 2 && i.shape.length !== 3)
|
|
10119
10228
|
throw new Error(
|
|
10120
10229
|
`Expected to receive a 2D or 3D subarray. Instead chunk has shape ${i.shape}`
|
|
10121
10230
|
);
|
|
@@ -10158,13 +10267,13 @@ class Bi {
|
|
|
10158
10267
|
this.dimensions_.t
|
|
10159
10268
|
].filter((Q) => Q !== void 0).sort((Q, E) => Q.index - E.index), C = [];
|
|
10160
10269
|
for (const Q of B) {
|
|
10161
|
-
const E = A.find((s) =>
|
|
10270
|
+
const E = A.find((s) => zB(s.dimension, Q.name));
|
|
10162
10271
|
if (!E)
|
|
10163
10272
|
throw new Error(`Region does not contain a slice for ${Q.name}`);
|
|
10164
10273
|
const i = Q.lods[I];
|
|
10165
10274
|
let o;
|
|
10166
10275
|
const a = E.index;
|
|
10167
|
-
a.type === "full" ? o =
|
|
10276
|
+
a.type === "full" ? o = dI(null) : a.type === "point" ? o = Math.round((a.value - i.translation) / i.scale) : o = dI(
|
|
10168
10277
|
Math.floor((a.start - i.translation) / i.scale),
|
|
10169
10278
|
Math.ceil((a.stop - i.translation) / i.scale)
|
|
10170
10279
|
), C.push(o);
|
|
@@ -10173,7 +10282,7 @@ class Bi {
|
|
|
10173
10282
|
}
|
|
10174
10283
|
}
|
|
10175
10284
|
function Ci(g, A) {
|
|
10176
|
-
const I = g.axes.map((h) => h.name), B = g.axes.length, C =
|
|
10285
|
+
const I = g.axes.map((h) => h.name), B = g.axes.length, C = cB(I, "x"), Q = cB(I, "y"), E = (h, t) => {
|
|
10177
10286
|
const y = [];
|
|
10178
10287
|
for (let n = 0; n < g.datasets.length; n++) {
|
|
10179
10288
|
const w = g.datasets[n], r = A[n], G = w.coordinateTransformations[0].scale, c = w.coordinateTransformations.length === 2 ? w.coordinateTransformations[1].translation : new Array(B).fill(0);
|
|
@@ -10194,28 +10303,28 @@ function Ci(g, A) {
|
|
|
10194
10303
|
x: E(I[C], C),
|
|
10195
10304
|
y: E(I[Q], Q),
|
|
10196
10305
|
numLods: A.length
|
|
10197
|
-
}, o =
|
|
10306
|
+
}, o = RI(I, "z");
|
|
10198
10307
|
o !== -1 && (i.z = E(I[o], o));
|
|
10199
|
-
const a =
|
|
10308
|
+
const a = RI(I, "c");
|
|
10200
10309
|
a !== -1 && (i.c = E(I[a], a));
|
|
10201
|
-
const s =
|
|
10310
|
+
const s = RI(I, "t");
|
|
10202
10311
|
return s !== -1 && (i.t = E(I[s], s)), i;
|
|
10203
10312
|
}
|
|
10204
|
-
function
|
|
10313
|
+
function zB(g, A) {
|
|
10205
10314
|
return g.toLowerCase() === A.toLowerCase();
|
|
10206
10315
|
}
|
|
10207
|
-
function
|
|
10208
|
-
const I =
|
|
10316
|
+
function cB(g, A) {
|
|
10317
|
+
const I = RI(g, A);
|
|
10209
10318
|
if (I === -1)
|
|
10210
10319
|
throw new Error(
|
|
10211
10320
|
`Could not find "${A}" dimension in [${g.join(", ")}]`
|
|
10212
10321
|
);
|
|
10213
10322
|
return I;
|
|
10214
10323
|
}
|
|
10215
|
-
function
|
|
10216
|
-
return g.findIndex((I) =>
|
|
10324
|
+
function RI(g, A) {
|
|
10325
|
+
return g.findIndex((I) => zB(I, A));
|
|
10217
10326
|
}
|
|
10218
|
-
function
|
|
10327
|
+
function UB(g) {
|
|
10219
10328
|
let A = 1;
|
|
10220
10329
|
for (let I = g.shape.length - 1; I >= 0; I--) {
|
|
10221
10330
|
if (g.stride[I] !== A)
|
|
@@ -10261,14 +10370,14 @@ var H;
|
|
|
10261
10370
|
}
|
|
10262
10371
|
g.joinValues = B, g.jsonStringifyReplacer = (C, Q) => typeof Q == "bigint" ? Q.toString() : Q;
|
|
10263
10372
|
})(H || (H = {}));
|
|
10264
|
-
var
|
|
10373
|
+
var sg;
|
|
10265
10374
|
(function(g) {
|
|
10266
10375
|
g.mergeShapes = (A, I) => ({
|
|
10267
10376
|
...A,
|
|
10268
10377
|
...I
|
|
10269
10378
|
// second overwrites first
|
|
10270
10379
|
});
|
|
10271
|
-
})(
|
|
10380
|
+
})(sg || (sg = {}));
|
|
10272
10381
|
const S = H.arrayToEnum([
|
|
10273
10382
|
"string",
|
|
10274
10383
|
"nan",
|
|
@@ -10445,14 +10554,14 @@ const uA = (g, A) => {
|
|
|
10445
10554
|
}
|
|
10446
10555
|
return { message: I };
|
|
10447
10556
|
};
|
|
10448
|
-
let
|
|
10557
|
+
let _B = uA;
|
|
10449
10558
|
function Ei(g) {
|
|
10450
|
-
|
|
10559
|
+
_B = g;
|
|
10451
10560
|
}
|
|
10452
|
-
function
|
|
10453
|
-
return
|
|
10561
|
+
function KI() {
|
|
10562
|
+
return _B;
|
|
10454
10563
|
}
|
|
10455
|
-
const
|
|
10564
|
+
const HI = (g) => {
|
|
10456
10565
|
const { data: A, path: I, errorMaps: B, issueData: C } = g, Q = [...I, ...C.path || []], E = {
|
|
10457
10566
|
...C,
|
|
10458
10567
|
path: Q
|
|
@@ -10474,7 +10583,7 @@ const KI = (g) => {
|
|
|
10474
10583
|
};
|
|
10475
10584
|
}, ii = [];
|
|
10476
10585
|
function F(g, A) {
|
|
10477
|
-
const I =
|
|
10586
|
+
const I = KI(), B = HI({
|
|
10478
10587
|
issueData: A,
|
|
10479
10588
|
data: g.data,
|
|
10480
10589
|
path: g.path,
|
|
@@ -10534,12 +10643,12 @@ class X {
|
|
|
10534
10643
|
}
|
|
10535
10644
|
const Y = Object.freeze({
|
|
10536
10645
|
status: "aborted"
|
|
10537
|
-
}), KA = (g) => ({ status: "dirty", value: g }), j = (g) => ({ status: "valid", value: g }),
|
|
10538
|
-
function
|
|
10646
|
+
}), KA = (g) => ({ status: "dirty", value: g }), j = (g) => ({ status: "valid", value: g }), Dg = (g) => g.status === "aborted", hg = (g) => g.status === "dirty", LA = (g) => g.status === "valid", II = (g) => typeof Promise < "u" && g instanceof Promise;
|
|
10647
|
+
function qI(g, A, I, B) {
|
|
10539
10648
|
if (typeof A == "function" ? g !== A || !0 : !A.has(g)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10540
10649
|
return A.get(g);
|
|
10541
10650
|
}
|
|
10542
|
-
function
|
|
10651
|
+
function $B(g, A, I, B, C) {
|
|
10543
10652
|
if (typeof A == "function" ? g !== A || !0 : !A.has(g)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10544
10653
|
return A.set(g, I), I;
|
|
10545
10654
|
}
|
|
@@ -10556,7 +10665,7 @@ class sA {
|
|
|
10556
10665
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
10557
10666
|
}
|
|
10558
10667
|
}
|
|
10559
|
-
const
|
|
10668
|
+
const kB = (g, A) => {
|
|
10560
10669
|
if (LA(A))
|
|
10561
10670
|
return { success: !0, data: A.value };
|
|
10562
10671
|
if (!g.common.issues.length)
|
|
@@ -10615,7 +10724,7 @@ class K {
|
|
|
10615
10724
|
}
|
|
10616
10725
|
_parseSync(A) {
|
|
10617
10726
|
const I = this._parse(A);
|
|
10618
|
-
if (
|
|
10727
|
+
if (II(I))
|
|
10619
10728
|
throw new Error("Synchronous parse encountered promise.");
|
|
10620
10729
|
return I;
|
|
10621
10730
|
}
|
|
@@ -10643,7 +10752,7 @@ class K {
|
|
|
10643
10752
|
data: A,
|
|
10644
10753
|
parsedType: tA(A)
|
|
10645
10754
|
}, Q = this._parseSync({ data: A, path: C.path, parent: C });
|
|
10646
|
-
return
|
|
10755
|
+
return kB(C, Q);
|
|
10647
10756
|
}
|
|
10648
10757
|
"~validate"(A) {
|
|
10649
10758
|
var I, B;
|
|
@@ -10696,8 +10805,8 @@ class K {
|
|
|
10696
10805
|
parent: null,
|
|
10697
10806
|
data: A,
|
|
10698
10807
|
parsedType: tA(A)
|
|
10699
|
-
}, C = this._parse({ data: A, path: B.path, parent: B }), Q = await (
|
|
10700
|
-
return
|
|
10808
|
+
}, C = this._parse({ data: A, path: B.path, parent: B }), Q = await (II(C) ? C : Promise.resolve(C));
|
|
10809
|
+
return kB(B, Q);
|
|
10701
10810
|
}
|
|
10702
10811
|
refine(A, I) {
|
|
10703
10812
|
const B = (C) => typeof I == "string" || typeof I > "u" ? { message: I } : typeof I == "function" ? I(C) : I;
|
|
@@ -10742,13 +10851,13 @@ class K {
|
|
|
10742
10851
|
return QA.create(this);
|
|
10743
10852
|
}
|
|
10744
10853
|
promise() {
|
|
10745
|
-
return
|
|
10854
|
+
return xA.create(this, this._def);
|
|
10746
10855
|
}
|
|
10747
10856
|
or(A) {
|
|
10748
|
-
return
|
|
10857
|
+
return QI.create([this, A], this._def);
|
|
10749
10858
|
}
|
|
10750
10859
|
and(A) {
|
|
10751
|
-
return
|
|
10860
|
+
return EI.create(this, A, this._def);
|
|
10752
10861
|
}
|
|
10753
10862
|
transform(A) {
|
|
10754
10863
|
return new EA({
|
|
@@ -10760,7 +10869,7 @@ class K {
|
|
|
10760
10869
|
}
|
|
10761
10870
|
default(A) {
|
|
10762
10871
|
const I = typeof A == "function" ? A : () => A;
|
|
10763
|
-
return new
|
|
10872
|
+
return new DI({
|
|
10764
10873
|
...M(this._def),
|
|
10765
10874
|
innerType: this,
|
|
10766
10875
|
defaultValue: I,
|
|
@@ -10776,7 +10885,7 @@ class K {
|
|
|
10776
10885
|
}
|
|
10777
10886
|
catch(A) {
|
|
10778
10887
|
const I = typeof A == "function" ? A : () => A;
|
|
10779
|
-
return new
|
|
10888
|
+
return new hI({
|
|
10780
10889
|
...M(this._def),
|
|
10781
10890
|
innerType: this,
|
|
10782
10891
|
catchValue: I,
|
|
@@ -10791,10 +10900,10 @@ class K {
|
|
|
10791
10900
|
});
|
|
10792
10901
|
}
|
|
10793
10902
|
pipe(A) {
|
|
10794
|
-
return
|
|
10903
|
+
return FI.create(this, A);
|
|
10795
10904
|
}
|
|
10796
10905
|
readonly() {
|
|
10797
|
-
return
|
|
10906
|
+
return tI.create(this);
|
|
10798
10907
|
}
|
|
10799
10908
|
isOptional() {
|
|
10800
10909
|
return this.safeParse(void 0).success;
|
|
@@ -10804,17 +10913,17 @@ class K {
|
|
|
10804
10913
|
}
|
|
10805
10914
|
}
|
|
10806
10915
|
const oi = /^c[^\s-]{8,}$/i, ai = /^[0-9a-z]+$/, si = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Di = /^[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, hi = /^[a-z0-9_-]{21}$/i, ti = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, yi = /^[-+]?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)?)??$/, ei = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Gi = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
10807
|
-
let
|
|
10808
|
-
const ni = /^(?:(?: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])$/, wi = /^(?:(?: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])$/, Fi = /^(([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]))$/, ri = /^(([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])$/, Si = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Ri = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
|
|
10809
|
-
function
|
|
10916
|
+
let Cg;
|
|
10917
|
+
const ni = /^(?:(?: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])$/, wi = /^(?:(?: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])$/, Fi = /^(([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]))$/, ri = /^(([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])$/, Si = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Ri = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, AC = "((\\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])))", Ni = new RegExp(`^${AC}$`);
|
|
10918
|
+
function IC(g) {
|
|
10810
10919
|
let A = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
10811
10920
|
return g.precision ? A = `${A}\\.\\d{${g.precision}}` : g.precision == null && (A = `${A}(\\.\\d+)?`), A;
|
|
10812
10921
|
}
|
|
10813
10922
|
function ci(g) {
|
|
10814
|
-
return new RegExp(`^${
|
|
10923
|
+
return new RegExp(`^${IC(g)}$`);
|
|
10815
10924
|
}
|
|
10816
|
-
function
|
|
10817
|
-
let A = `${
|
|
10925
|
+
function gC(g) {
|
|
10926
|
+
let A = `${AC}T${IC(g)}`;
|
|
10818
10927
|
const I = [];
|
|
10819
10928
|
return I.push(g.local ? "Z?" : "Z"), g.offset && I.push("([+-]\\d{2}:?\\d{2})"), A = `${A}(${I.join("|")})`, new RegExp(`^${A}$`);
|
|
10820
10929
|
}
|
|
@@ -10889,7 +10998,7 @@ class gA extends K {
|
|
|
10889
10998
|
message: Q.message
|
|
10890
10999
|
}), B.dirty());
|
|
10891
11000
|
else if (Q.kind === "emoji")
|
|
10892
|
-
|
|
11001
|
+
Cg || (Cg = new RegExp(Gi, "u")), Cg.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
|
|
10893
11002
|
validation: "emoji",
|
|
10894
11003
|
code: e.invalid_string,
|
|
10895
11004
|
message: Q.message
|
|
@@ -10950,7 +11059,7 @@ class gA extends K {
|
|
|
10950
11059
|
code: e.invalid_string,
|
|
10951
11060
|
validation: { endsWith: Q.value },
|
|
10952
11061
|
message: Q.message
|
|
10953
|
-
}), B.dirty()) : Q.kind === "datetime" ?
|
|
11062
|
+
}), B.dirty()) : Q.kind === "datetime" ? gC(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
|
|
10954
11063
|
code: e.invalid_string,
|
|
10955
11064
|
validation: "datetime",
|
|
10956
11065
|
message: Q.message
|
|
@@ -11533,7 +11642,7 @@ GA.create = (g) => {
|
|
|
11533
11642
|
...M(g)
|
|
11534
11643
|
});
|
|
11535
11644
|
};
|
|
11536
|
-
class
|
|
11645
|
+
class gI extends K {
|
|
11537
11646
|
_parse(A) {
|
|
11538
11647
|
if (this._def.coerce && (A.data = !!A.data), this._getType(A) !== S.boolean) {
|
|
11539
11648
|
const B = this._getOrReturnCtx(A);
|
|
@@ -11546,7 +11655,7 @@ class II extends K {
|
|
|
11546
11655
|
return j(A.data);
|
|
11547
11656
|
}
|
|
11548
11657
|
}
|
|
11549
|
-
|
|
11658
|
+
gI.create = (g) => new gI({
|
|
11550
11659
|
typeName: J.ZodBoolean,
|
|
11551
11660
|
coerce: g?.coerce || !1,
|
|
11552
11661
|
...M(g)
|
|
@@ -11629,7 +11738,7 @@ JA.create = (g) => new JA({
|
|
|
11629
11738
|
typeName: J.ZodDate,
|
|
11630
11739
|
...M(g)
|
|
11631
11740
|
});
|
|
11632
|
-
class
|
|
11741
|
+
class lI extends K {
|
|
11633
11742
|
_parse(A) {
|
|
11634
11743
|
if (this._getType(A) !== S.symbol) {
|
|
11635
11744
|
const B = this._getOrReturnCtx(A);
|
|
@@ -11642,11 +11751,11 @@ class qI extends K {
|
|
|
11642
11751
|
return j(A.data);
|
|
11643
11752
|
}
|
|
11644
11753
|
}
|
|
11645
|
-
|
|
11754
|
+
lI.create = (g) => new lI({
|
|
11646
11755
|
typeName: J.ZodSymbol,
|
|
11647
11756
|
...M(g)
|
|
11648
11757
|
});
|
|
11649
|
-
class
|
|
11758
|
+
class BI extends K {
|
|
11650
11759
|
_parse(A) {
|
|
11651
11760
|
if (this._getType(A) !== S.undefined) {
|
|
11652
11761
|
const B = this._getOrReturnCtx(A);
|
|
@@ -11659,11 +11768,11 @@ class gI extends K {
|
|
|
11659
11768
|
return j(A.data);
|
|
11660
11769
|
}
|
|
11661
11770
|
}
|
|
11662
|
-
|
|
11771
|
+
BI.create = (g) => new BI({
|
|
11663
11772
|
typeName: J.ZodUndefined,
|
|
11664
11773
|
...M(g)
|
|
11665
11774
|
});
|
|
11666
|
-
class
|
|
11775
|
+
class CI extends K {
|
|
11667
11776
|
_parse(A) {
|
|
11668
11777
|
if (this._getType(A) !== S.null) {
|
|
11669
11778
|
const B = this._getOrReturnCtx(A);
|
|
@@ -11676,7 +11785,7 @@ class BI extends K {
|
|
|
11676
11785
|
return j(A.data);
|
|
11677
11786
|
}
|
|
11678
11787
|
}
|
|
11679
|
-
|
|
11788
|
+
CI.create = (g) => new CI({
|
|
11680
11789
|
typeName: J.ZodNull,
|
|
11681
11790
|
...M(g)
|
|
11682
11791
|
});
|
|
@@ -11718,7 +11827,7 @@ yA.create = (g) => new yA({
|
|
|
11718
11827
|
typeName: J.ZodNever,
|
|
11719
11828
|
...M(g)
|
|
11720
11829
|
});
|
|
11721
|
-
class
|
|
11830
|
+
class fI extends K {
|
|
11722
11831
|
_parse(A) {
|
|
11723
11832
|
if (this._getType(A) !== S.undefined) {
|
|
11724
11833
|
const B = this._getOrReturnCtx(A);
|
|
@@ -11731,7 +11840,7 @@ class lI extends K {
|
|
|
11731
11840
|
return j(A.data);
|
|
11732
11841
|
}
|
|
11733
11842
|
}
|
|
11734
|
-
|
|
11843
|
+
fI.create = (g) => new fI({
|
|
11735
11844
|
typeName: J.ZodVoid,
|
|
11736
11845
|
...M(g)
|
|
11737
11846
|
});
|
|
@@ -12087,7 +12196,7 @@ class m extends K {
|
|
|
12087
12196
|
});
|
|
12088
12197
|
}
|
|
12089
12198
|
keyof() {
|
|
12090
|
-
return
|
|
12199
|
+
return BC(H.objectKeys(this.shape));
|
|
12091
12200
|
}
|
|
12092
12201
|
}
|
|
12093
12202
|
m.create = (g, A) => new m({
|
|
@@ -12111,7 +12220,7 @@ m.lazycreate = (g, A) => new m({
|
|
|
12111
12220
|
typeName: J.ZodObject,
|
|
12112
12221
|
...M(A)
|
|
12113
12222
|
});
|
|
12114
|
-
class
|
|
12223
|
+
class QI extends K {
|
|
12115
12224
|
_parse(A) {
|
|
12116
12225
|
const { ctx: I } = this._processInputParams(A), B = this._def.options;
|
|
12117
12226
|
function C(Q) {
|
|
@@ -12179,13 +12288,13 @@ class CI extends K {
|
|
|
12179
12288
|
return this._def.options;
|
|
12180
12289
|
}
|
|
12181
12290
|
}
|
|
12182
|
-
|
|
12291
|
+
QI.create = (g, A) => new QI({
|
|
12183
12292
|
options: g,
|
|
12184
12293
|
typeName: J.ZodUnion,
|
|
12185
12294
|
...M(A)
|
|
12186
12295
|
});
|
|
12187
|
-
const hA = (g) => g instanceof
|
|
12188
|
-
class
|
|
12296
|
+
const hA = (g) => g instanceof oI ? hA(g.schema) : g instanceof EA ? hA(g.innerType()) : g instanceof aI ? [g.value] : g instanceof nA ? g.options : g instanceof sI ? H.objectValues(g.enum) : g instanceof DI ? hA(g._def.innerType) : g instanceof BI ? [void 0] : g instanceof CI ? [null] : g instanceof aA ? [void 0, ...hA(g.unwrap())] : g instanceof wA ? [null, ...hA(g.unwrap())] : g instanceof fg || g instanceof tI ? hA(g.unwrap()) : g instanceof hI ? hA(g._def.innerType) : [];
|
|
12297
|
+
class ZI extends K {
|
|
12189
12298
|
_parse(A) {
|
|
12190
12299
|
const { ctx: I } = this._processInputParams(A);
|
|
12191
12300
|
if (I.parsedType !== S.object)
|
|
@@ -12238,7 +12347,7 @@ class bI extends K {
|
|
|
12238
12347
|
C.set(i, Q);
|
|
12239
12348
|
}
|
|
12240
12349
|
}
|
|
12241
|
-
return new
|
|
12350
|
+
return new ZI({
|
|
12242
12351
|
typeName: J.ZodDiscriminatedUnion,
|
|
12243
12352
|
discriminator: A,
|
|
12244
12353
|
options: I,
|
|
@@ -12247,14 +12356,14 @@ class bI extends K {
|
|
|
12247
12356
|
});
|
|
12248
12357
|
}
|
|
12249
12358
|
}
|
|
12250
|
-
function
|
|
12359
|
+
function tg(g, A) {
|
|
12251
12360
|
const I = tA(g), B = tA(A);
|
|
12252
12361
|
if (g === A)
|
|
12253
12362
|
return { valid: !0, data: g };
|
|
12254
12363
|
if (I === S.object && B === S.object) {
|
|
12255
12364
|
const C = H.objectKeys(A), Q = H.objectKeys(g).filter((i) => C.indexOf(i) !== -1), E = { ...g, ...A };
|
|
12256
12365
|
for (const i of Q) {
|
|
12257
|
-
const o =
|
|
12366
|
+
const o = tg(g[i], A[i]);
|
|
12258
12367
|
if (!o.valid)
|
|
12259
12368
|
return { valid: !1 };
|
|
12260
12369
|
E[i] = o.data;
|
|
@@ -12265,7 +12374,7 @@ function hg(g, A) {
|
|
|
12265
12374
|
return { valid: !1 };
|
|
12266
12375
|
const C = [];
|
|
12267
12376
|
for (let Q = 0; Q < g.length; Q++) {
|
|
12268
|
-
const E = g[Q], i = A[Q], o =
|
|
12377
|
+
const E = g[Q], i = A[Q], o = tg(E, i);
|
|
12269
12378
|
if (!o.valid)
|
|
12270
12379
|
return { valid: !1 };
|
|
12271
12380
|
C.push(o.data);
|
|
@@ -12273,13 +12382,13 @@ function hg(g, A) {
|
|
|
12273
12382
|
return { valid: !0, data: C };
|
|
12274
12383
|
} else return I === S.date && B === S.date && +g == +A ? { valid: !0, data: g } : { valid: !1 };
|
|
12275
12384
|
}
|
|
12276
|
-
class
|
|
12385
|
+
class EI extends K {
|
|
12277
12386
|
_parse(A) {
|
|
12278
12387
|
const { status: I, ctx: B } = this._processInputParams(A), C = (Q, E) => {
|
|
12279
|
-
if (
|
|
12388
|
+
if (Dg(Q) || Dg(E))
|
|
12280
12389
|
return Y;
|
|
12281
|
-
const i =
|
|
12282
|
-
return i.valid ? ((
|
|
12390
|
+
const i = tg(Q.value, E.value);
|
|
12391
|
+
return i.valid ? ((hg(Q) || hg(E)) && I.dirty(), { status: I.value, value: i.data }) : (F(B, {
|
|
12283
12392
|
code: e.invalid_intersection_types
|
|
12284
12393
|
}), Y);
|
|
12285
12394
|
};
|
|
@@ -12305,7 +12414,7 @@ class QI extends K {
|
|
|
12305
12414
|
}));
|
|
12306
12415
|
}
|
|
12307
12416
|
}
|
|
12308
|
-
|
|
12417
|
+
EI.create = (g, A, I) => new EI({
|
|
12309
12418
|
left: g,
|
|
12310
12419
|
right: A,
|
|
12311
12420
|
typeName: J.ZodIntersection,
|
|
@@ -12361,7 +12470,7 @@ DA.create = (g, A) => {
|
|
|
12361
12470
|
...M(A)
|
|
12362
12471
|
});
|
|
12363
12472
|
};
|
|
12364
|
-
class
|
|
12473
|
+
class iI extends K {
|
|
12365
12474
|
get keySchema() {
|
|
12366
12475
|
return this._def.keyType;
|
|
12367
12476
|
}
|
|
@@ -12389,12 +12498,12 @@ class EI extends K {
|
|
|
12389
12498
|
return this._def.valueType;
|
|
12390
12499
|
}
|
|
12391
12500
|
static create(A, I, B) {
|
|
12392
|
-
return I instanceof K ? new
|
|
12501
|
+
return I instanceof K ? new iI({
|
|
12393
12502
|
keyType: A,
|
|
12394
12503
|
valueType: I,
|
|
12395
12504
|
typeName: J.ZodRecord,
|
|
12396
12505
|
...M(B)
|
|
12397
|
-
}) : new
|
|
12506
|
+
}) : new iI({
|
|
12398
12507
|
keyType: gA.create(),
|
|
12399
12508
|
valueType: A,
|
|
12400
12509
|
typeName: J.ZodRecord,
|
|
@@ -12402,7 +12511,7 @@ class EI extends K {
|
|
|
12402
12511
|
});
|
|
12403
12512
|
}
|
|
12404
12513
|
}
|
|
12405
|
-
class
|
|
12514
|
+
class pI extends K {
|
|
12406
12515
|
get keySchema() {
|
|
12407
12516
|
return this._def.keyType;
|
|
12408
12517
|
}
|
|
@@ -12444,7 +12553,7 @@ class fI extends K {
|
|
|
12444
12553
|
}
|
|
12445
12554
|
}
|
|
12446
12555
|
}
|
|
12447
|
-
|
|
12556
|
+
pI.create = (g, A, I) => new pI({
|
|
12448
12557
|
valueType: A,
|
|
12449
12558
|
keyType: g,
|
|
12450
12559
|
typeName: J.ZodMap,
|
|
@@ -12527,13 +12636,13 @@ class qA extends K {
|
|
|
12527
12636
|
received: I.parsedType
|
|
12528
12637
|
}), Y;
|
|
12529
12638
|
function B(i, o) {
|
|
12530
|
-
return
|
|
12639
|
+
return HI({
|
|
12531
12640
|
data: i,
|
|
12532
12641
|
path: I.path,
|
|
12533
12642
|
errorMaps: [
|
|
12534
12643
|
I.common.contextualErrorMap,
|
|
12535
12644
|
I.schemaErrorMap,
|
|
12536
|
-
|
|
12645
|
+
KI(),
|
|
12537
12646
|
uA
|
|
12538
12647
|
].filter((a) => !!a),
|
|
12539
12648
|
issueData: {
|
|
@@ -12543,13 +12652,13 @@ class qA extends K {
|
|
|
12543
12652
|
});
|
|
12544
12653
|
}
|
|
12545
12654
|
function C(i, o) {
|
|
12546
|
-
return
|
|
12655
|
+
return HI({
|
|
12547
12656
|
data: i,
|
|
12548
12657
|
path: I.path,
|
|
12549
12658
|
errorMaps: [
|
|
12550
12659
|
I.common.contextualErrorMap,
|
|
12551
12660
|
I.schemaErrorMap,
|
|
12552
|
-
|
|
12661
|
+
KI(),
|
|
12553
12662
|
uA
|
|
12554
12663
|
].filter((a) => !!a),
|
|
12555
12664
|
issueData: {
|
|
@@ -12559,7 +12668,7 @@ class qA extends K {
|
|
|
12559
12668
|
});
|
|
12560
12669
|
}
|
|
12561
12670
|
const Q = { errorMap: I.common.contextualErrorMap }, E = I.data;
|
|
12562
|
-
if (this._def.returns instanceof
|
|
12671
|
+
if (this._def.returns instanceof xA) {
|
|
12563
12672
|
const i = this;
|
|
12564
12673
|
return j(async function(...o) {
|
|
12565
12674
|
const a = new $([]), s = await i._def.args.parseAsync(o, Q).catch((y) => {
|
|
@@ -12615,7 +12724,7 @@ class qA extends K {
|
|
|
12615
12724
|
});
|
|
12616
12725
|
}
|
|
12617
12726
|
}
|
|
12618
|
-
class
|
|
12727
|
+
class oI extends K {
|
|
12619
12728
|
get schema() {
|
|
12620
12729
|
return this._def.getter();
|
|
12621
12730
|
}
|
|
@@ -12624,12 +12733,12 @@ class iI extends K {
|
|
|
12624
12733
|
return this._def.getter()._parse({ data: I.data, path: I.path, parent: I });
|
|
12625
12734
|
}
|
|
12626
12735
|
}
|
|
12627
|
-
|
|
12736
|
+
oI.create = (g, A) => new oI({
|
|
12628
12737
|
getter: g,
|
|
12629
12738
|
typeName: J.ZodLazy,
|
|
12630
12739
|
...M(A)
|
|
12631
12740
|
});
|
|
12632
|
-
class
|
|
12741
|
+
class aI extends K {
|
|
12633
12742
|
_parse(A) {
|
|
12634
12743
|
if (A.data !== this._def.value) {
|
|
12635
12744
|
const I = this._getOrReturnCtx(A);
|
|
@@ -12645,12 +12754,12 @@ class oI extends K {
|
|
|
12645
12754
|
return this._def.value;
|
|
12646
12755
|
}
|
|
12647
12756
|
}
|
|
12648
|
-
|
|
12757
|
+
aI.create = (g, A) => new aI({
|
|
12649
12758
|
value: g,
|
|
12650
12759
|
typeName: J.ZodLiteral,
|
|
12651
12760
|
...M(A)
|
|
12652
12761
|
});
|
|
12653
|
-
function
|
|
12762
|
+
function BC(g, A) {
|
|
12654
12763
|
return new nA({
|
|
12655
12764
|
values: g,
|
|
12656
12765
|
typeName: J.ZodEnum,
|
|
@@ -12670,7 +12779,7 @@ class nA extends K {
|
|
|
12670
12779
|
code: e.invalid_type
|
|
12671
12780
|
}), Y;
|
|
12672
12781
|
}
|
|
12673
|
-
if (
|
|
12782
|
+
if (qI(this, VA) || $B(this, VA, new Set(this._def.values)), !qI(this, VA).has(A.data)) {
|
|
12674
12783
|
const I = this._getOrReturnCtx(A), B = this._def.values;
|
|
12675
12784
|
return F(I, {
|
|
12676
12785
|
received: I.data,
|
|
@@ -12715,8 +12824,8 @@ class nA extends K {
|
|
|
12715
12824
|
}
|
|
12716
12825
|
}
|
|
12717
12826
|
VA = /* @__PURE__ */ new WeakMap();
|
|
12718
|
-
nA.create =
|
|
12719
|
-
class
|
|
12827
|
+
nA.create = BC;
|
|
12828
|
+
class sI extends K {
|
|
12720
12829
|
constructor() {
|
|
12721
12830
|
super(...arguments), vA.set(this, void 0);
|
|
12722
12831
|
}
|
|
@@ -12730,7 +12839,7 @@ class aI extends K {
|
|
|
12730
12839
|
code: e.invalid_type
|
|
12731
12840
|
}), Y;
|
|
12732
12841
|
}
|
|
12733
|
-
if (
|
|
12842
|
+
if (qI(this, vA) || $B(this, vA, new Set(H.getValidEnumValues(this._def.values))), !qI(this, vA).has(A.data)) {
|
|
12734
12843
|
const C = H.objectValues(I);
|
|
12735
12844
|
return F(B, {
|
|
12736
12845
|
received: B.data,
|
|
@@ -12745,12 +12854,12 @@ class aI extends K {
|
|
|
12745
12854
|
}
|
|
12746
12855
|
}
|
|
12747
12856
|
vA = /* @__PURE__ */ new WeakMap();
|
|
12748
|
-
|
|
12857
|
+
sI.create = (g, A) => new sI({
|
|
12749
12858
|
values: g,
|
|
12750
12859
|
typeName: J.ZodNativeEnum,
|
|
12751
12860
|
...M(A)
|
|
12752
12861
|
});
|
|
12753
|
-
class
|
|
12862
|
+
class xA extends K {
|
|
12754
12863
|
unwrap() {
|
|
12755
12864
|
return this._def.type;
|
|
12756
12865
|
}
|
|
@@ -12769,7 +12878,7 @@ class WA extends K {
|
|
|
12769
12878
|
})));
|
|
12770
12879
|
}
|
|
12771
12880
|
}
|
|
12772
|
-
|
|
12881
|
+
xA.create = (g, A) => new xA({
|
|
12773
12882
|
type: g,
|
|
12774
12883
|
typeName: J.ZodPromise,
|
|
12775
12884
|
...M(A)
|
|
@@ -12889,7 +12998,7 @@ wA.create = (g, A) => new wA({
|
|
|
12889
12998
|
typeName: J.ZodNullable,
|
|
12890
12999
|
...M(A)
|
|
12891
13000
|
});
|
|
12892
|
-
class
|
|
13001
|
+
class DI extends K {
|
|
12893
13002
|
_parse(A) {
|
|
12894
13003
|
const { ctx: I } = this._processInputParams(A);
|
|
12895
13004
|
let B = I.data;
|
|
@@ -12903,13 +13012,13 @@ class sI extends K {
|
|
|
12903
13012
|
return this._def.innerType;
|
|
12904
13013
|
}
|
|
12905
13014
|
}
|
|
12906
|
-
|
|
13015
|
+
DI.create = (g, A) => new DI({
|
|
12907
13016
|
innerType: g,
|
|
12908
13017
|
typeName: J.ZodDefault,
|
|
12909
13018
|
defaultValue: typeof A.default == "function" ? A.default : () => A.default,
|
|
12910
13019
|
...M(A)
|
|
12911
13020
|
});
|
|
12912
|
-
class
|
|
13021
|
+
class hI extends K {
|
|
12913
13022
|
_parse(A) {
|
|
12914
13023
|
const { ctx: I } = this._processInputParams(A), B = {
|
|
12915
13024
|
...I,
|
|
@@ -12924,7 +13033,7 @@ class DI extends K {
|
|
|
12924
13033
|
...B
|
|
12925
13034
|
}
|
|
12926
13035
|
});
|
|
12927
|
-
return
|
|
13036
|
+
return II(C) ? C.then((Q) => ({
|
|
12928
13037
|
status: "valid",
|
|
12929
13038
|
value: Q.status === "valid" ? Q.value : this._def.catchValue({
|
|
12930
13039
|
get error() {
|
|
@@ -12946,13 +13055,13 @@ class DI extends K {
|
|
|
12946
13055
|
return this._def.innerType;
|
|
12947
13056
|
}
|
|
12948
13057
|
}
|
|
12949
|
-
|
|
13058
|
+
hI.create = (g, A) => new hI({
|
|
12950
13059
|
innerType: g,
|
|
12951
13060
|
typeName: J.ZodCatch,
|
|
12952
13061
|
catchValue: typeof A.catch == "function" ? A.catch : () => A.catch,
|
|
12953
13062
|
...M(A)
|
|
12954
13063
|
});
|
|
12955
|
-
class
|
|
13064
|
+
class mI extends K {
|
|
12956
13065
|
_parse(A) {
|
|
12957
13066
|
if (this._getType(A) !== S.nan) {
|
|
12958
13067
|
const B = this._getOrReturnCtx(A);
|
|
@@ -12965,7 +13074,7 @@ class pI extends K {
|
|
|
12965
13074
|
return { status: "valid", value: A.data };
|
|
12966
13075
|
}
|
|
12967
13076
|
}
|
|
12968
|
-
|
|
13077
|
+
mI.create = (g) => new mI({
|
|
12969
13078
|
typeName: J.ZodNaN,
|
|
12970
13079
|
...M(g)
|
|
12971
13080
|
});
|
|
@@ -12983,7 +13092,7 @@ class fg extends K {
|
|
|
12983
13092
|
return this._def.type;
|
|
12984
13093
|
}
|
|
12985
13094
|
}
|
|
12986
|
-
class
|
|
13095
|
+
class FI extends K {
|
|
12987
13096
|
_parse(A) {
|
|
12988
13097
|
const { status: I, ctx: B } = this._processInputParams(A);
|
|
12989
13098
|
if (B.common.async)
|
|
@@ -13016,32 +13125,32 @@ class wI extends K {
|
|
|
13016
13125
|
}
|
|
13017
13126
|
}
|
|
13018
13127
|
static create(A, I) {
|
|
13019
|
-
return new
|
|
13128
|
+
return new FI({
|
|
13020
13129
|
in: A,
|
|
13021
13130
|
out: I,
|
|
13022
13131
|
typeName: J.ZodPipeline
|
|
13023
13132
|
});
|
|
13024
13133
|
}
|
|
13025
13134
|
}
|
|
13026
|
-
class
|
|
13135
|
+
class tI extends K {
|
|
13027
13136
|
_parse(A) {
|
|
13028
13137
|
const I = this._def.innerType._parse(A), B = (C) => (LA(C) && (C.value = Object.freeze(C.value)), C);
|
|
13029
|
-
return
|
|
13138
|
+
return II(I) ? I.then((C) => B(C)) : B(I);
|
|
13030
13139
|
}
|
|
13031
13140
|
unwrap() {
|
|
13032
13141
|
return this._def.innerType;
|
|
13033
13142
|
}
|
|
13034
13143
|
}
|
|
13035
|
-
|
|
13144
|
+
tI.create = (g, A) => new tI({
|
|
13036
13145
|
innerType: g,
|
|
13037
13146
|
typeName: J.ZodReadonly,
|
|
13038
13147
|
...M(A)
|
|
13039
13148
|
});
|
|
13040
|
-
function
|
|
13149
|
+
function LB(g, A) {
|
|
13041
13150
|
const I = typeof g == "function" ? g(A) : typeof g == "string" ? { message: g } : g;
|
|
13042
13151
|
return typeof I == "string" ? { message: I } : I;
|
|
13043
13152
|
}
|
|
13044
|
-
function
|
|
13153
|
+
function CC(g, A = {}, I) {
|
|
13045
13154
|
return g ? TA.create().superRefine((B, C) => {
|
|
13046
13155
|
var Q, E;
|
|
13047
13156
|
const i = g(B);
|
|
@@ -13049,12 +13158,12 @@ function BC(g, A = {}, I) {
|
|
|
13049
13158
|
return i.then((o) => {
|
|
13050
13159
|
var a, s;
|
|
13051
13160
|
if (!o) {
|
|
13052
|
-
const h =
|
|
13161
|
+
const h = LB(A, B), t = (s = (a = h.fatal) !== null && a !== void 0 ? a : I) !== null && s !== void 0 ? s : !0;
|
|
13053
13162
|
C.addIssue({ code: "custom", ...h, fatal: t });
|
|
13054
13163
|
}
|
|
13055
13164
|
});
|
|
13056
13165
|
if (!i) {
|
|
13057
|
-
const o =
|
|
13166
|
+
const o = LB(A, B), a = (E = (Q = o.fatal) !== null && Q !== void 0 ? Q : I) !== null && E !== void 0 ? E : !0;
|
|
13058
13167
|
C.addIssue({ code: "custom", ...o, fatal: a });
|
|
13059
13168
|
}
|
|
13060
13169
|
}) : TA.create();
|
|
@@ -13068,10 +13177,10 @@ var J;
|
|
|
13068
13177
|
})(J || (J = {}));
|
|
13069
13178
|
const Mi = (g, A = {
|
|
13070
13179
|
message: `Input not instance of ${g.name}`
|
|
13071
|
-
}) =>
|
|
13180
|
+
}) => CC((I) => I instanceof g, A), QC = gA.create, EC = eA.create, Ki = mI.create, Hi = GA.create, iC = gI.create, qi = JA.create, li = lI.create, fi = BI.create, pi = CI.create, mi = TA.create, ui = NA.create, Ti = yA.create, xi = fI.create, Wi = QA.create, bi = m.create, Zi = m.strictCreate, Pi = QI.create, Oi = ZI.create, Vi = EI.create, vi = DA.create, Xi = iI.create, ji = pI.create, zi = YA.create, _i = qA.create, $i = oI.create, Ao = aI.create, Io = nA.create, go = sI.create, Bo = xA.create, JB = EA.create, Co = aA.create, Qo = wA.create, Eo = EA.createWithPreprocess, io = FI.create, oo = () => QC().optional(), ao = () => EC().optional(), so = () => iC().optional(), Do = {
|
|
13072
13181
|
string: (g) => gA.create({ ...g, coerce: !0 }),
|
|
13073
13182
|
number: (g) => eA.create({ ...g, coerce: !0 }),
|
|
13074
|
-
boolean: (g) =>
|
|
13183
|
+
boolean: (g) => gI.create({
|
|
13075
13184
|
...g,
|
|
13076
13185
|
coerce: !0
|
|
13077
13186
|
}),
|
|
@@ -13082,67 +13191,67 @@ var D = /* @__PURE__ */ Object.freeze({
|
|
|
13082
13191
|
__proto__: null,
|
|
13083
13192
|
defaultErrorMap: uA,
|
|
13084
13193
|
setErrorMap: Ei,
|
|
13085
|
-
getErrorMap:
|
|
13086
|
-
makeIssue:
|
|
13194
|
+
getErrorMap: KI,
|
|
13195
|
+
makeIssue: HI,
|
|
13087
13196
|
EMPTY_PATH: ii,
|
|
13088
13197
|
addIssueToContext: F,
|
|
13089
13198
|
ParseStatus: X,
|
|
13090
13199
|
INVALID: Y,
|
|
13091
13200
|
DIRTY: KA,
|
|
13092
13201
|
OK: j,
|
|
13093
|
-
isAborted:
|
|
13094
|
-
isDirty:
|
|
13202
|
+
isAborted: Dg,
|
|
13203
|
+
isDirty: hg,
|
|
13095
13204
|
isValid: LA,
|
|
13096
|
-
isAsync:
|
|
13205
|
+
isAsync: II,
|
|
13097
13206
|
get util() {
|
|
13098
13207
|
return H;
|
|
13099
13208
|
},
|
|
13100
13209
|
get objectUtil() {
|
|
13101
|
-
return
|
|
13210
|
+
return sg;
|
|
13102
13211
|
},
|
|
13103
13212
|
ZodParsedType: S,
|
|
13104
13213
|
getParsedType: tA,
|
|
13105
13214
|
ZodType: K,
|
|
13106
|
-
datetimeRegex:
|
|
13215
|
+
datetimeRegex: gC,
|
|
13107
13216
|
ZodString: gA,
|
|
13108
13217
|
ZodNumber: eA,
|
|
13109
13218
|
ZodBigInt: GA,
|
|
13110
|
-
ZodBoolean:
|
|
13219
|
+
ZodBoolean: gI,
|
|
13111
13220
|
ZodDate: JA,
|
|
13112
|
-
ZodSymbol:
|
|
13113
|
-
ZodUndefined:
|
|
13114
|
-
ZodNull:
|
|
13221
|
+
ZodSymbol: lI,
|
|
13222
|
+
ZodUndefined: BI,
|
|
13223
|
+
ZodNull: CI,
|
|
13115
13224
|
ZodAny: TA,
|
|
13116
13225
|
ZodUnknown: NA,
|
|
13117
13226
|
ZodNever: yA,
|
|
13118
|
-
ZodVoid:
|
|
13227
|
+
ZodVoid: fI,
|
|
13119
13228
|
ZodArray: QA,
|
|
13120
13229
|
ZodObject: m,
|
|
13121
|
-
ZodUnion:
|
|
13122
|
-
ZodDiscriminatedUnion:
|
|
13123
|
-
ZodIntersection:
|
|
13230
|
+
ZodUnion: QI,
|
|
13231
|
+
ZodDiscriminatedUnion: ZI,
|
|
13232
|
+
ZodIntersection: EI,
|
|
13124
13233
|
ZodTuple: DA,
|
|
13125
|
-
ZodRecord:
|
|
13126
|
-
ZodMap:
|
|
13234
|
+
ZodRecord: iI,
|
|
13235
|
+
ZodMap: pI,
|
|
13127
13236
|
ZodSet: YA,
|
|
13128
13237
|
ZodFunction: qA,
|
|
13129
|
-
ZodLazy:
|
|
13130
|
-
ZodLiteral:
|
|
13238
|
+
ZodLazy: oI,
|
|
13239
|
+
ZodLiteral: aI,
|
|
13131
13240
|
ZodEnum: nA,
|
|
13132
|
-
ZodNativeEnum:
|
|
13133
|
-
ZodPromise:
|
|
13241
|
+
ZodNativeEnum: sI,
|
|
13242
|
+
ZodPromise: xA,
|
|
13134
13243
|
ZodEffects: EA,
|
|
13135
13244
|
ZodTransformer: EA,
|
|
13136
13245
|
ZodOptional: aA,
|
|
13137
13246
|
ZodNullable: wA,
|
|
13138
|
-
ZodDefault:
|
|
13139
|
-
ZodCatch:
|
|
13140
|
-
ZodNaN:
|
|
13247
|
+
ZodDefault: DI,
|
|
13248
|
+
ZodCatch: hI,
|
|
13249
|
+
ZodNaN: mI,
|
|
13141
13250
|
BRAND: Yi,
|
|
13142
13251
|
ZodBranded: fg,
|
|
13143
|
-
ZodPipeline:
|
|
13144
|
-
ZodReadonly:
|
|
13145
|
-
custom:
|
|
13252
|
+
ZodPipeline: FI,
|
|
13253
|
+
ZodReadonly: tI,
|
|
13254
|
+
custom: CC,
|
|
13146
13255
|
Schema: K,
|
|
13147
13256
|
ZodSchema: K,
|
|
13148
13257
|
late: di,
|
|
@@ -13151,12 +13260,12 @@ var D = /* @__PURE__ */ Object.freeze({
|
|
|
13151
13260
|
},
|
|
13152
13261
|
coerce: Do,
|
|
13153
13262
|
any: mi,
|
|
13154
|
-
array:
|
|
13263
|
+
array: Wi,
|
|
13155
13264
|
bigint: Hi,
|
|
13156
|
-
boolean:
|
|
13265
|
+
boolean: iC,
|
|
13157
13266
|
date: qi,
|
|
13158
13267
|
discriminatedUnion: Oi,
|
|
13159
|
-
effect:
|
|
13268
|
+
effect: JB,
|
|
13160
13269
|
enum: Io,
|
|
13161
13270
|
function: _i,
|
|
13162
13271
|
instanceof: Mi,
|
|
@@ -13169,7 +13278,7 @@ var D = /* @__PURE__ */ Object.freeze({
|
|
|
13169
13278
|
never: Ti,
|
|
13170
13279
|
null: pi,
|
|
13171
13280
|
nullable: Qo,
|
|
13172
|
-
number:
|
|
13281
|
+
number: EC,
|
|
13173
13282
|
object: bi,
|
|
13174
13283
|
oboolean: so,
|
|
13175
13284
|
onumber: ao,
|
|
@@ -13181,14 +13290,14 @@ var D = /* @__PURE__ */ Object.freeze({
|
|
|
13181
13290
|
record: Xi,
|
|
13182
13291
|
set: zi,
|
|
13183
13292
|
strictObject: Zi,
|
|
13184
|
-
string:
|
|
13293
|
+
string: QC,
|
|
13185
13294
|
symbol: li,
|
|
13186
|
-
transformer:
|
|
13295
|
+
transformer: JB,
|
|
13187
13296
|
tuple: vi,
|
|
13188
13297
|
undefined: fi,
|
|
13189
13298
|
union: Pi,
|
|
13190
13299
|
unknown: ui,
|
|
13191
|
-
void:
|
|
13300
|
+
void: xi,
|
|
13192
13301
|
NEVER: ho,
|
|
13193
13302
|
ZodIssueCode: e,
|
|
13194
13303
|
quotelessJson: Qi,
|
|
@@ -13617,7 +13726,7 @@ function pg(g) {
|
|
|
13617
13726
|
const A = So(g);
|
|
13618
13727
|
return A === void 0 ? "0.4" : A;
|
|
13619
13728
|
}
|
|
13620
|
-
function
|
|
13729
|
+
function WA(g) {
|
|
13621
13730
|
if (g !== void 0)
|
|
13622
13731
|
switch (g) {
|
|
13623
13732
|
case "0.4":
|
|
@@ -13626,12 +13735,12 @@ function xA(g) {
|
|
|
13626
13735
|
return "v3";
|
|
13627
13736
|
}
|
|
13628
13737
|
}
|
|
13629
|
-
function
|
|
13738
|
+
function oC(g, A) {
|
|
13630
13739
|
const I = { ...g };
|
|
13631
13740
|
return delete I[A], I;
|
|
13632
13741
|
}
|
|
13633
13742
|
async function bo(g, A) {
|
|
13634
|
-
const I = new PA(g), B = new z(I), C =
|
|
13743
|
+
const I = new PA(g), B = new z(I), C = WA(A), Q = await wI(B, C);
|
|
13635
13744
|
try {
|
|
13636
13745
|
return Ro(Q.attrs);
|
|
13637
13746
|
} catch {
|
|
@@ -13660,7 +13769,7 @@ function No(g) {
|
|
|
13660
13769
|
throw new Error("Plate metadata is missing in OME-Zarr v0.4 plate");
|
|
13661
13770
|
return {
|
|
13662
13771
|
ome: {
|
|
13663
|
-
plate:
|
|
13772
|
+
plate: oC(g.plate, "version"),
|
|
13664
13773
|
version: "0.5"
|
|
13665
13774
|
}
|
|
13666
13775
|
};
|
|
@@ -13670,7 +13779,7 @@ function co(g) {
|
|
|
13670
13779
|
throw new Error("Well metadata is missing in OME-Zarr v0.4 well");
|
|
13671
13780
|
return {
|
|
13672
13781
|
ome: {
|
|
13673
|
-
well:
|
|
13782
|
+
well: oC(g.well, "version"),
|
|
13674
13783
|
version: "0.5"
|
|
13675
13784
|
}
|
|
13676
13785
|
};
|
|
@@ -13690,7 +13799,7 @@ function Uo(g) {
|
|
|
13690
13799
|
}
|
|
13691
13800
|
}
|
|
13692
13801
|
async function Zo(g, A, I) {
|
|
13693
|
-
const B = g + "/" + A, C = new PA(B), Q = new z(C), E =
|
|
13802
|
+
const B = g + "/" + A, C = new PA(B), Q = new z(C), E = WA(I), i = await wI(Q, E);
|
|
13694
13803
|
try {
|
|
13695
13804
|
return Uo(i.attrs);
|
|
13696
13805
|
} catch {
|
|
@@ -13701,11 +13810,11 @@ ${JSON.stringify(i.attrs)}`
|
|
|
13701
13810
|
}
|
|
13702
13811
|
}
|
|
13703
13812
|
async function Po(g) {
|
|
13704
|
-
const A =
|
|
13813
|
+
const A = WA(g.version), I = await wI(g.location, A);
|
|
13705
13814
|
return mg(I.attrs).omero?.channels ?? [];
|
|
13706
13815
|
}
|
|
13707
13816
|
async function Oo(g) {
|
|
13708
|
-
const A =
|
|
13817
|
+
const A = WA(g.version), I = await wI(g.location, A);
|
|
13709
13818
|
return mg(I.attrs).omero?.rdefs;
|
|
13710
13819
|
}
|
|
13711
13820
|
function ko(g) {
|
|
@@ -13739,15 +13848,15 @@ function mg(g) {
|
|
|
13739
13848
|
${JSON.stringify(g)}`);
|
|
13740
13849
|
}
|
|
13741
13850
|
}
|
|
13742
|
-
class
|
|
13851
|
+
class NI {
|
|
13743
13852
|
location;
|
|
13744
13853
|
version;
|
|
13745
13854
|
constructor(A) {
|
|
13746
13855
|
this.location = A.location, this.version = A.version;
|
|
13747
13856
|
}
|
|
13748
13857
|
async open() {
|
|
13749
|
-
let A =
|
|
13750
|
-
const I = await
|
|
13858
|
+
let A = WA(this.version);
|
|
13859
|
+
const I = await wI(this.location, A), B = mg(I.attrs), C = B.multiscales;
|
|
13751
13860
|
if (C.length !== 1)
|
|
13752
13861
|
throw new Error(
|
|
13753
13862
|
`Exactly one multiscale image is supported. Found ${C.length} images.`
|
|
@@ -13755,7 +13864,7 @@ class RI {
|
|
|
13755
13864
|
const Q = C[0];
|
|
13756
13865
|
if (Q.datasets.length === 0)
|
|
13757
13866
|
throw new Error("No datasets found in the multiscale image.");
|
|
13758
|
-
A || (A =
|
|
13867
|
+
A || (A = WA(B.originalVersion));
|
|
13759
13868
|
const E = Q.datasets.map(
|
|
13760
13869
|
(s) => OE(this.location, s.path, A)
|
|
13761
13870
|
), i = await Promise.all(
|
|
@@ -13779,7 +13888,7 @@ class RI {
|
|
|
13779
13888
|
*/
|
|
13780
13889
|
static fromHttp(A) {
|
|
13781
13890
|
const I = new PA(A.url);
|
|
13782
|
-
return new
|
|
13891
|
+
return new NI({
|
|
13783
13892
|
location: new z(I),
|
|
13784
13893
|
version: A.version
|
|
13785
13894
|
});
|
|
@@ -13796,7 +13905,7 @@ class RI {
|
|
|
13796
13905
|
*/
|
|
13797
13906
|
static fromS3(A) {
|
|
13798
13907
|
const I = new lg(A);
|
|
13799
|
-
return new
|
|
13908
|
+
return new NI({
|
|
13800
13909
|
location: new z(I),
|
|
13801
13910
|
version: A.version
|
|
13802
13911
|
});
|
|
@@ -13812,13 +13921,13 @@ class RI {
|
|
|
13812
13921
|
*/
|
|
13813
13922
|
static fromFileSystem(A) {
|
|
13814
13923
|
const I = new qg(A.directory);
|
|
13815
|
-
return new
|
|
13924
|
+
return new NI({
|
|
13816
13925
|
location: new z(I, A.path),
|
|
13817
13926
|
version: A.version
|
|
13818
13927
|
});
|
|
13819
13928
|
}
|
|
13820
13929
|
}
|
|
13821
|
-
const
|
|
13930
|
+
const aC = [
|
|
13822
13931
|
"fallbackVisible",
|
|
13823
13932
|
"prefetchTime",
|
|
13824
13933
|
"visibleCurrent",
|
|
@@ -13833,7 +13942,7 @@ function ug(g) {
|
|
|
13833
13942
|
z: g.prefetch.z ?? 0,
|
|
13834
13943
|
t: g.prefetch.t ?? 0
|
|
13835
13944
|
}, I = Object.freeze(
|
|
13836
|
-
|
|
13945
|
+
aC.reduce(
|
|
13837
13946
|
(Q, E) => {
|
|
13838
13947
|
const i = g.priorityOrder.indexOf(E);
|
|
13839
13948
|
return Q[E] = i, Q;
|
|
@@ -13900,7 +14009,7 @@ function Jo(g) {
|
|
|
13900
14009
|
if (A?.min !== void 0 && A?.max !== void 0 && A.min > A.max)
|
|
13901
14010
|
throw new Error("lod.min must be <= lod.max");
|
|
13902
14011
|
const I = g.priorityOrder;
|
|
13903
|
-
if (I.length !==
|
|
14012
|
+
if (I.length !== aC.length || new Set(I).size !== I.length)
|
|
13904
14013
|
throw new Error("priorityOrder must include all categories exactly once");
|
|
13905
14014
|
}
|
|
13906
14015
|
function Tg(g, A = {}) {
|
|
@@ -13958,16 +14067,16 @@ export {
|
|
|
13958
14067
|
lo as AxesLayer,
|
|
13959
14068
|
AA as Box2,
|
|
13960
14069
|
RA as Box3,
|
|
13961
|
-
|
|
13962
|
-
|
|
13963
|
-
|
|
14070
|
+
uB as ChunkedImageLayer,
|
|
14071
|
+
l as Color,
|
|
14072
|
+
NQ as Frustum,
|
|
13964
14073
|
Yo as Idetik,
|
|
13965
14074
|
uo as ImageLayer,
|
|
13966
|
-
|
|
14075
|
+
xo as ImageSeriesLayer,
|
|
13967
14076
|
To as LabelImageLayer,
|
|
13968
14077
|
FA as Layer,
|
|
13969
|
-
|
|
13970
|
-
|
|
14078
|
+
hQ as LayerManager,
|
|
14079
|
+
NI as OmeZarrImageSource,
|
|
13971
14080
|
qo as OrbitControls,
|
|
13972
14081
|
Mo as OrthographicCamera,
|
|
13973
14082
|
Ho as PanZoomControls,
|
|
@@ -13976,12 +14085,12 @@ export {
|
|
|
13976
14085
|
jo as Points,
|
|
13977
14086
|
fo as ProjectedLineLayer,
|
|
13978
14087
|
IB as Spherical,
|
|
13979
|
-
|
|
13980
|
-
|
|
14088
|
+
yI as Texture2DArray,
|
|
14089
|
+
jA as Texture3D,
|
|
13981
14090
|
po as TracksLayer,
|
|
13982
|
-
|
|
14091
|
+
GQ as Viewport,
|
|
13983
14092
|
mo as VolumeLayer,
|
|
13984
|
-
|
|
14093
|
+
CQ as WebGLRenderer,
|
|
13985
14094
|
Vo as createExplorationPolicy,
|
|
13986
14095
|
ug as createImageSourcePolicy,
|
|
13987
14096
|
Xo as createNoPrefetchPolicy,
|
|
@@ -13990,6 +14099,6 @@ export {
|
|
|
13990
14099
|
Zo as loadOmeZarrWell,
|
|
13991
14100
|
Po as loadOmeroChannels,
|
|
13992
14101
|
Oo as loadOmeroDefaults,
|
|
13993
|
-
|
|
14102
|
+
wQ as parseViewportConfigs
|
|
13994
14103
|
};
|
|
13995
14104
|
//# sourceMappingURL=index.js.map
|