@quick-threejs/reactive 0.1.41 → 0.1.42
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/{FontLoader-Cp39O036.mjs → FontLoader-Dz0z8aMc.mjs} +41 -8
- package/dist/common/blueprints/props.blueprint.d.ts +9 -1
- package/dist/common/interfaces/core.interface.d.ts +2 -1
- package/dist/core/app/app.module.d.ts +2 -2
- package/dist/core/app/app.service.d.ts +2 -2
- package/dist/core/app/sizes/sizes.module.d.ts +1 -1
- package/dist/core/app/sizes/sizes.service.d.ts +1 -1
- package/dist/core/register/register.module.d.ts +7 -5
- package/dist/core/register/register.service.d.ts +2 -2
- package/dist/main.js +4 -4
- package/dist/main.mjs +823 -671
- package/dist/worker.js +1 -1
- package/dist/worker.mjs +351 -298
- package/package.json +2 -2
package/dist/main.mjs
CHANGED
|
@@ -1,35 +1,41 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { g as
|
|
5
|
-
import { A as ui, v as li, u as di } from "./FontLoader-
|
|
6
|
-
import { TrianglesDrawMode as vn, TriangleFanDrawMode as Ke, TriangleStripDrawMode as
|
|
7
|
-
class
|
|
1
|
+
var cn = Object.defineProperty;
|
|
2
|
+
var un = (s, e, t) => e in s ? cn(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var R = (s, e, t) => un(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { g as ln, r as Ot, a as dn, b as rt, c as It, d as fn, e as hn, f as pn, s as ne, L as re, i as P, R as de, K as mn, P as gn, h as Dt, j as Nt, S as Ft, k as _n, m as be, l as jt, F as bn, n as Me, o as ot, E as ze, p as yn, q as Tn, C as Ht, x as me, N as ge, D as at, t as wn } from "./FontLoader-Dz0z8aMc.mjs";
|
|
5
|
+
import { A as ui, v as li, u as di } from "./FontLoader-Dz0z8aMc.mjs";
|
|
6
|
+
import { TrianglesDrawMode as vn, TriangleFanDrawMode as Ke, TriangleStripDrawMode as Ut, Loader as Bt, FileLoader as Te, SRGBColorSpace as G, LinearSRGBColorSpace as D, BufferGeometry as Gt, BufferAttribute as fe, Color as W, ColorManagement as qe, LoaderUtils as he, SpotLight as En, PointLight as Cn, DirectionalLight as Rn, MeshBasicMaterial as le, MeshPhysicalMaterial as N, Vector2 as Wt, Matrix4 as we, Vector3 as Z, Quaternion as $t, InstancedMesh as xn, InstancedBufferAttribute as Sn, Object3D as zt, TextureLoader as kn, ImageBitmapLoader as Kt, InterleavedBuffer as An, InterleavedBufferAttribute as Ln, LinearFilter as Ve, LinearMipmapLinearFilter as qt, RepeatWrapping as Xe, NearestFilter as Vt, PointsMaterial as Mn, Material as Pe, LineBasicMaterial as Pn, MeshStandardMaterial as Xt, DoubleSide as On, PropertyBinding as In, SkinnedMesh as Dn, Mesh as Nn, LineSegments as Fn, Line as jn, LineLoop as Hn, Points as Un, Group as Oe, PerspectiveCamera as Bn, MathUtils as Gn, OrthographicCamera as Wn, Skeleton as $n, AnimationClip as zn, Bone as Kn, InterpolateLinear as Qt, NearestMipmapNearestFilter as qn, LinearMipmapNearestFilter as Vn, NearestMipmapLinearFilter as Xn, ClampToEdgeWrapping as Qn, MirroredRepeatWrapping as Yn, InterpolateDiscrete as Jn, FrontSide as Zn, Texture as ct, VectorKeyframeTrack as ut, NumberKeyframeTrack as lt, QuaternionKeyframeTrack as dt, Box3 as er, Sphere as tr, Interpolant as nr, LoadingManager as rr, AudioLoader as sr } from "three";
|
|
7
|
+
class xe {
|
|
8
8
|
constructor() {
|
|
9
9
|
/**
|
|
10
10
|
* @description The app worker logic location.
|
|
11
11
|
*
|
|
12
12
|
* @required
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
R(this, "location");
|
|
15
15
|
/**
|
|
16
16
|
* @description Initialize the app on construct.
|
|
17
17
|
*
|
|
18
18
|
* @default true
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
R(this, "initOnConstruct");
|
|
21
|
+
/**
|
|
22
|
+
* @description Initialize the app on main thread.
|
|
23
|
+
*
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
R(this, "mainThread");
|
|
21
27
|
/**
|
|
22
28
|
* @description App `canvas` element reference.
|
|
23
29
|
*
|
|
24
30
|
* @default undefined
|
|
25
31
|
*/
|
|
26
|
-
|
|
32
|
+
R(this, "canvas");
|
|
27
33
|
/**
|
|
28
34
|
* @description Set the `canvas` view in fullscreen and auto-resize it.
|
|
29
35
|
*
|
|
30
36
|
* @default true
|
|
31
37
|
*/
|
|
32
|
-
|
|
38
|
+
R(this, "fullScreen");
|
|
33
39
|
/**
|
|
34
40
|
* Default used camera.
|
|
35
41
|
*
|
|
@@ -37,25 +43,25 @@ class Re {
|
|
|
37
43
|
*
|
|
38
44
|
* @default DefaultCameraType.PERSPECTIVE
|
|
39
45
|
*/
|
|
40
|
-
|
|
46
|
+
R(this, "defaultCamera");
|
|
41
47
|
/**
|
|
42
48
|
* @description Start timer update on launch.
|
|
43
49
|
*
|
|
44
50
|
* @default true
|
|
45
51
|
*/
|
|
46
|
-
|
|
52
|
+
R(this, "startTimer");
|
|
47
53
|
/**
|
|
48
54
|
* @description Resources to load.
|
|
49
55
|
*
|
|
50
56
|
* @default []
|
|
51
57
|
*/
|
|
52
|
-
|
|
58
|
+
R(this, "loaderDataSources", []);
|
|
53
59
|
/**
|
|
54
60
|
* @description GLTF Draco decoder path.
|
|
55
61
|
*
|
|
56
62
|
* @default undefined
|
|
57
63
|
*/
|
|
58
|
-
|
|
64
|
+
R(this, "loaderDracoDecoderPath");
|
|
59
65
|
/**
|
|
60
66
|
* @description Will directly load the resources on initialization.
|
|
61
67
|
*
|
|
@@ -63,7 +69,7 @@ class Re {
|
|
|
63
69
|
*
|
|
64
70
|
* @default true
|
|
65
71
|
*/
|
|
66
|
-
|
|
72
|
+
R(this, "loadResourcesOnInit");
|
|
67
73
|
/**
|
|
68
74
|
* @description Enable the debug mode
|
|
69
75
|
*
|
|
@@ -71,7 +77,7 @@ class Re {
|
|
|
71
77
|
*
|
|
72
78
|
* @default undefined
|
|
73
79
|
*/
|
|
74
|
-
|
|
80
|
+
R(this, "enableDebug");
|
|
75
81
|
/**
|
|
76
82
|
* Will enable orbit controls for the cameras.
|
|
77
83
|
*
|
|
@@ -80,7 +86,7 @@ class Re {
|
|
|
80
86
|
*
|
|
81
87
|
* @default undefined
|
|
82
88
|
*/
|
|
83
|
-
|
|
89
|
+
R(this, "enableControls");
|
|
84
90
|
/**
|
|
85
91
|
* Define the {@link THREE.AxesHelper} sizes.
|
|
86
92
|
*
|
|
@@ -89,7 +95,7 @@ class Re {
|
|
|
89
95
|
*
|
|
90
96
|
* @default undefined
|
|
91
97
|
*/
|
|
92
|
-
|
|
98
|
+
R(this, "axesSizes");
|
|
93
99
|
/**
|
|
94
100
|
* Define the {@link THREE.GridHelper} sizes.
|
|
95
101
|
*
|
|
@@ -98,7 +104,7 @@ class Re {
|
|
|
98
104
|
*
|
|
99
105
|
* @default undefined
|
|
100
106
|
*/
|
|
101
|
-
|
|
107
|
+
R(this, "gridSizes");
|
|
102
108
|
/**
|
|
103
109
|
* Display a mini perfective camera at the top right corner of the screen.
|
|
104
110
|
*
|
|
@@ -107,25 +113,27 @@ class Re {
|
|
|
107
113
|
*
|
|
108
114
|
* @default undefined
|
|
109
115
|
*/
|
|
110
|
-
|
|
116
|
+
R(this, "withMiniCamera");
|
|
111
117
|
/**
|
|
112
118
|
* @description Handler called when the app is ready.
|
|
113
119
|
*
|
|
114
120
|
* @default undefined
|
|
115
121
|
*/
|
|
116
|
-
|
|
122
|
+
R(this, "onReady");
|
|
117
123
|
}
|
|
118
124
|
}
|
|
119
125
|
class si {
|
|
120
126
|
constructor() {
|
|
127
|
+
/** @description App `canvas` element reference. */
|
|
128
|
+
R(this, "canvas");
|
|
121
129
|
/** @description Handler triggered when the app is ready. */
|
|
122
|
-
|
|
130
|
+
R(this, "onReady");
|
|
123
131
|
}
|
|
124
132
|
}
|
|
125
|
-
var
|
|
133
|
+
var q = {}, Ie = {}, F = {}, V = {}, ft;
|
|
126
134
|
function ir() {
|
|
127
|
-
if (
|
|
128
|
-
|
|
135
|
+
if (ft) return V;
|
|
136
|
+
ft = 1, Object.defineProperty(V, "__esModule", { value: !0 }), V.getBundleURL = V.getBaseURL = void 0;
|
|
129
137
|
let s;
|
|
130
138
|
function e() {
|
|
131
139
|
return s || (s = t()), s;
|
|
@@ -146,12 +154,12 @@ function ir() {
|
|
|
146
154
|
}
|
|
147
155
|
return V.getBaseURL = n, V;
|
|
148
156
|
}
|
|
149
|
-
var
|
|
150
|
-
function
|
|
151
|
-
if (
|
|
152
|
-
|
|
157
|
+
var ht;
|
|
158
|
+
function Yt() {
|
|
159
|
+
if (ht) return F;
|
|
160
|
+
ht = 1, Object.defineProperty(F, "__esModule", { value: !0 }), F.isWorkerRuntime = F.getWorkerImplementation = F.defaultPoolSize = void 0;
|
|
153
161
|
const s = /* @__PURE__ */ ir();
|
|
154
|
-
|
|
162
|
+
F.defaultPoolSize = typeof navigator < "u" && navigator.hardwareConcurrency ? navigator.hardwareConcurrency : 4;
|
|
155
163
|
const e = (a) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(a);
|
|
156
164
|
function t(a) {
|
|
157
165
|
const c = new Blob([a], { type: "application/javascript" });
|
|
@@ -189,17 +197,17 @@ function Xt() {
|
|
|
189
197
|
function o() {
|
|
190
198
|
return r || (r = n()), r;
|
|
191
199
|
}
|
|
192
|
-
|
|
200
|
+
F.getWorkerImplementation = o;
|
|
193
201
|
function i() {
|
|
194
202
|
const a = typeof self < "u" && typeof Window < "u" && self instanceof Window;
|
|
195
203
|
return !!(typeof self < "u" && self.postMessage && !a);
|
|
196
204
|
}
|
|
197
|
-
return
|
|
205
|
+
return F.isWorkerRuntime = i, F;
|
|
198
206
|
}
|
|
199
|
-
var X = {}, _e = { exports: {} }, De,
|
|
207
|
+
var X = {}, _e = { exports: {} }, De, pt;
|
|
200
208
|
function or() {
|
|
201
|
-
if (
|
|
202
|
-
|
|
209
|
+
if (pt) return De;
|
|
210
|
+
pt = 1;
|
|
203
211
|
var s = 1e3, e = s * 60, t = e * 60, n = t * 24, r = n * 7, o = n * 365.25;
|
|
204
212
|
De = function(u, l) {
|
|
205
213
|
l = l || {};
|
|
@@ -278,10 +286,10 @@ function or() {
|
|
|
278
286
|
}
|
|
279
287
|
return De;
|
|
280
288
|
}
|
|
281
|
-
var Ne,
|
|
289
|
+
var Ne, mt;
|
|
282
290
|
function ar() {
|
|
283
|
-
if (
|
|
284
|
-
|
|
291
|
+
if (mt) return Ne;
|
|
292
|
+
mt = 1;
|
|
285
293
|
function s(e) {
|
|
286
294
|
n.debug = n, n.default = n, n.coerce = d, n.disable = i, n.enable = o, n.enabled = a, n.humanize = or(), n.destroy = u, Object.keys(e).forEach((l) => {
|
|
287
295
|
n[l] = e[l];
|
|
@@ -294,29 +302,29 @@ function ar() {
|
|
|
294
302
|
}
|
|
295
303
|
n.selectColor = t;
|
|
296
304
|
function n(l) {
|
|
297
|
-
let f, h = null, w,
|
|
305
|
+
let f, h = null, w, E;
|
|
298
306
|
function T(...p) {
|
|
299
307
|
if (!T.enabled)
|
|
300
308
|
return;
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
let
|
|
304
|
-
p[0] = p[0].replace(/%([a-zA-Z%])/g, (v,
|
|
309
|
+
const g = T, m = Number(/* @__PURE__ */ new Date()), b = m - (f || m);
|
|
310
|
+
g.diff = b, g.prev = f, g.curr = m, f = m, p[0] = n.coerce(p[0]), typeof p[0] != "string" && p.unshift("%O");
|
|
311
|
+
let _ = 0;
|
|
312
|
+
p[0] = p[0].replace(/%([a-zA-Z%])/g, (v, S) => {
|
|
305
313
|
if (v === "%%")
|
|
306
314
|
return "%";
|
|
307
|
-
|
|
308
|
-
const
|
|
309
|
-
if (typeof
|
|
310
|
-
const
|
|
311
|
-
v =
|
|
315
|
+
_++;
|
|
316
|
+
const C = n.formatters[S];
|
|
317
|
+
if (typeof C == "function") {
|
|
318
|
+
const k = p[_];
|
|
319
|
+
v = C.call(g, k), p.splice(_, 1), _--;
|
|
312
320
|
}
|
|
313
321
|
return v;
|
|
314
|
-
}), n.formatArgs.call(
|
|
322
|
+
}), n.formatArgs.call(g, p), (g.log || n.log).apply(g, p);
|
|
315
323
|
}
|
|
316
324
|
return T.namespace = l, T.useColors = n.useColors(), T.color = n.selectColor(l), T.extend = r, T.destroy = n.destroy, Object.defineProperty(T, "enabled", {
|
|
317
325
|
enumerable: !0,
|
|
318
326
|
configurable: !1,
|
|
319
|
-
get: () => h !== null ? h : (w !== n.namespaces && (w = n.namespaces,
|
|
327
|
+
get: () => h !== null ? h : (w !== n.namespaces && (w = n.namespaces, E = n.enabled(l)), E),
|
|
320
328
|
set: (p) => {
|
|
321
329
|
h = p;
|
|
322
330
|
}
|
|
@@ -365,9 +373,9 @@ function ar() {
|
|
|
365
373
|
}
|
|
366
374
|
return Ne = s, Ne;
|
|
367
375
|
}
|
|
368
|
-
var
|
|
369
|
-
function
|
|
370
|
-
return
|
|
376
|
+
var gt;
|
|
377
|
+
function st() {
|
|
378
|
+
return gt || (gt = 1, function(s, e) {
|
|
371
379
|
e.formatArgs = n, e.save = r, e.load = o, e.useColors = t, e.storage = i(), e.destroy = /* @__PURE__ */ (() => {
|
|
372
380
|
let c = !1;
|
|
373
381
|
return () => {
|
|
@@ -533,7 +541,7 @@ var cr = function(s, e, t, n) {
|
|
|
533
541
|
d((n = n.apply(s, e || [])).next());
|
|
534
542
|
});
|
|
535
543
|
};
|
|
536
|
-
class
|
|
544
|
+
class Se {
|
|
537
545
|
constructor(e) {
|
|
538
546
|
this._baseObserver = e, this._pendingPromises = /* @__PURE__ */ new Set();
|
|
539
547
|
}
|
|
@@ -554,9 +562,9 @@ class xe {
|
|
|
554
562
|
this._pendingPromises.add(o);
|
|
555
563
|
}
|
|
556
564
|
}
|
|
557
|
-
const
|
|
565
|
+
const Jt = () => typeof Symbol == "function", pe = (s) => Jt() && !!Symbol[s], it = (s) => pe(s) ? Symbol[s] : "@@" + s;
|
|
558
566
|
pe("asyncIterator") || (Symbol.asyncIterator = Symbol.asyncIterator || Symbol.for("Symbol.asyncIterator"));
|
|
559
|
-
const ur =
|
|
567
|
+
const ur = it("iterator"), Qe = it("observable"), Zt = it("species");
|
|
560
568
|
function ve(s, e) {
|
|
561
569
|
const t = s[e];
|
|
562
570
|
if (t != null) {
|
|
@@ -567,7 +575,7 @@ function ve(s, e) {
|
|
|
567
575
|
}
|
|
568
576
|
function se(s) {
|
|
569
577
|
let e = s.constructor;
|
|
570
|
-
return e !== void 0 && (e = e[
|
|
578
|
+
return e !== void 0 && (e = e[Zt], e === null && (e = void 0)), e !== void 0 ? e : L;
|
|
571
579
|
}
|
|
572
580
|
function lr(s) {
|
|
573
581
|
return s instanceof L;
|
|
@@ -586,7 +594,7 @@ function ye(s) {
|
|
|
586
594
|
}
|
|
587
595
|
});
|
|
588
596
|
}
|
|
589
|
-
function
|
|
597
|
+
function en(s) {
|
|
590
598
|
const e = s._cleanup;
|
|
591
599
|
if (e !== void 0 && (s._cleanup = void 0, !!e))
|
|
592
600
|
try {
|
|
@@ -600,7 +608,7 @@ function Jt(s) {
|
|
|
600
608
|
te(t);
|
|
601
609
|
}
|
|
602
610
|
}
|
|
603
|
-
function
|
|
611
|
+
function Ye(s) {
|
|
604
612
|
s._observer = void 0, s._queue = void 0, s._state = "closed";
|
|
605
613
|
}
|
|
606
614
|
function dr(s) {
|
|
@@ -608,11 +616,11 @@ function dr(s) {
|
|
|
608
616
|
if (e) {
|
|
609
617
|
s._queue = void 0, s._state = "ready";
|
|
610
618
|
for (const t of e)
|
|
611
|
-
if (
|
|
619
|
+
if (tn(s, t.type, t.value), s._state === "closed")
|
|
612
620
|
break;
|
|
613
621
|
}
|
|
614
622
|
}
|
|
615
|
-
function
|
|
623
|
+
function tn(s, e, t) {
|
|
616
624
|
s._state = "running";
|
|
617
625
|
const n = s._observer;
|
|
618
626
|
try {
|
|
@@ -622,19 +630,19 @@ function Zt(s, e, t) {
|
|
|
622
630
|
r && r.call(n, t);
|
|
623
631
|
break;
|
|
624
632
|
case "error":
|
|
625
|
-
if (
|
|
633
|
+
if (Ye(s), r)
|
|
626
634
|
r.call(n, t);
|
|
627
635
|
else
|
|
628
636
|
throw t;
|
|
629
637
|
break;
|
|
630
638
|
case "complete":
|
|
631
|
-
|
|
639
|
+
Ye(s), r && r.call(n);
|
|
632
640
|
break;
|
|
633
641
|
}
|
|
634
642
|
} catch (r) {
|
|
635
643
|
te(r);
|
|
636
644
|
}
|
|
637
|
-
s._state === "closed" ?
|
|
645
|
+
s._state === "closed" ? en(s) : s._state === "running" && (s._state = "ready");
|
|
638
646
|
}
|
|
639
647
|
function Fe(s, e, t) {
|
|
640
648
|
if (s._state !== "closed") {
|
|
@@ -646,7 +654,7 @@ function Fe(s, e, t) {
|
|
|
646
654
|
s._state = "buffering", s._queue = [{ type: e, value: t }], ye(() => dr(s));
|
|
647
655
|
return;
|
|
648
656
|
}
|
|
649
|
-
|
|
657
|
+
tn(s, e, t);
|
|
650
658
|
}
|
|
651
659
|
}
|
|
652
660
|
class fr {
|
|
@@ -664,7 +672,7 @@ class fr {
|
|
|
664
672
|
return this._state === "closed";
|
|
665
673
|
}
|
|
666
674
|
unsubscribe() {
|
|
667
|
-
this._state !== "closed" && (
|
|
675
|
+
this._state !== "closed" && (Ye(this), en(this));
|
|
668
676
|
}
|
|
669
677
|
}
|
|
670
678
|
class hr {
|
|
@@ -890,14 +898,14 @@ class L {
|
|
|
890
898
|
};
|
|
891
899
|
});
|
|
892
900
|
}
|
|
893
|
-
[
|
|
901
|
+
[Qe]() {
|
|
894
902
|
return this;
|
|
895
903
|
}
|
|
896
904
|
static from(e) {
|
|
897
905
|
const t = typeof this == "function" ? this : L;
|
|
898
906
|
if (e == null)
|
|
899
907
|
throw new TypeError(e + " is not an object");
|
|
900
|
-
const n = ve(e,
|
|
908
|
+
const n = ve(e, Qe);
|
|
901
909
|
if (n) {
|
|
902
910
|
const r = n.call(e);
|
|
903
911
|
if (Object(r) !== r)
|
|
@@ -944,13 +952,13 @@ class L {
|
|
|
944
952
|
});
|
|
945
953
|
});
|
|
946
954
|
}
|
|
947
|
-
static get [
|
|
955
|
+
static get [Zt]() {
|
|
948
956
|
return this;
|
|
949
957
|
}
|
|
950
958
|
}
|
|
951
|
-
|
|
959
|
+
Jt() && Object.defineProperty(L, Symbol("extensions"), {
|
|
952
960
|
value: {
|
|
953
|
-
symbol:
|
|
961
|
+
symbol: Qe,
|
|
954
962
|
hostReportError: te
|
|
955
963
|
},
|
|
956
964
|
configurable: !0
|
|
@@ -987,7 +995,7 @@ var pr = function(s, e, t, n) {
|
|
|
987
995
|
};
|
|
988
996
|
function mr(s) {
|
|
989
997
|
return (e) => new L((t) => {
|
|
990
|
-
const n = new
|
|
998
|
+
const n = new Se(t), r = e.subscribe({
|
|
991
999
|
complete() {
|
|
992
1000
|
n.complete();
|
|
993
1001
|
},
|
|
@@ -1056,7 +1064,7 @@ var br = function(s, e, t, n) {
|
|
|
1056
1064
|
};
|
|
1057
1065
|
function Tr(s) {
|
|
1058
1066
|
return (e) => new L((t) => {
|
|
1059
|
-
const n = new
|
|
1067
|
+
const n = new Se(t), r = e.subscribe({
|
|
1060
1068
|
complete() {
|
|
1061
1069
|
n.complete();
|
|
1062
1070
|
},
|
|
@@ -1126,9 +1134,9 @@ var vr = function(s, e, t, n) {
|
|
|
1126
1134
|
d((n = n.apply(s, e || [])).next());
|
|
1127
1135
|
});
|
|
1128
1136
|
};
|
|
1129
|
-
function
|
|
1137
|
+
function Er(s) {
|
|
1130
1138
|
return (e) => new L((t) => {
|
|
1131
|
-
const n = new
|
|
1139
|
+
const n = new Se(t), r = e.subscribe({
|
|
1132
1140
|
complete() {
|
|
1133
1141
|
n.complete();
|
|
1134
1142
|
},
|
|
@@ -1145,7 +1153,7 @@ function Ar(s) {
|
|
|
1145
1153
|
return () => Y(r);
|
|
1146
1154
|
});
|
|
1147
1155
|
}
|
|
1148
|
-
function
|
|
1156
|
+
function Cr(...s) {
|
|
1149
1157
|
return s.length === 0 ? L.from([]) : new L((e) => {
|
|
1150
1158
|
let t = 0;
|
|
1151
1159
|
const n = s.map((o) => o.subscribe({
|
|
@@ -1164,7 +1172,7 @@ function Er(...s) {
|
|
|
1164
1172
|
return r;
|
|
1165
1173
|
});
|
|
1166
1174
|
}
|
|
1167
|
-
class
|
|
1175
|
+
class nn extends L {
|
|
1168
1176
|
constructor() {
|
|
1169
1177
|
super((e) => (this._observers.add(e), () => this._observers.delete(e))), this._observers = /* @__PURE__ */ new Set();
|
|
1170
1178
|
}
|
|
@@ -1181,8 +1189,8 @@ class en extends L {
|
|
|
1181
1189
|
e.complete();
|
|
1182
1190
|
}
|
|
1183
1191
|
}
|
|
1184
|
-
function
|
|
1185
|
-
const e = new
|
|
1192
|
+
function Rr(s) {
|
|
1193
|
+
const e = new nn();
|
|
1186
1194
|
let t, n = 0;
|
|
1187
1195
|
return new L((r) => {
|
|
1188
1196
|
t || (t = s.subscribe(e));
|
|
@@ -1192,7 +1200,7 @@ function Cr(s) {
|
|
|
1192
1200
|
};
|
|
1193
1201
|
});
|
|
1194
1202
|
}
|
|
1195
|
-
var
|
|
1203
|
+
var xr = function(s, e, t, n) {
|
|
1196
1204
|
function r(o) {
|
|
1197
1205
|
return o instanceof t ? o : new t(function(i) {
|
|
1198
1206
|
i(o);
|
|
@@ -1219,10 +1227,10 @@ var Rr = function(s, e, t, n) {
|
|
|
1219
1227
|
d((n = n.apply(s, e || [])).next());
|
|
1220
1228
|
});
|
|
1221
1229
|
};
|
|
1222
|
-
function
|
|
1230
|
+
function Sr(s, e) {
|
|
1223
1231
|
return (t) => new L((n) => {
|
|
1224
1232
|
let r, o = 0;
|
|
1225
|
-
const i = new
|
|
1233
|
+
const i = new Se(n), a = t.subscribe({
|
|
1226
1234
|
complete() {
|
|
1227
1235
|
i.complete();
|
|
1228
1236
|
},
|
|
@@ -1230,7 +1238,7 @@ function xr(s, e) {
|
|
|
1230
1238
|
i.error(c);
|
|
1231
1239
|
},
|
|
1232
1240
|
next(c) {
|
|
1233
|
-
i.schedule((d) =>
|
|
1241
|
+
i.schedule((d) => xr(this, void 0, void 0, function* () {
|
|
1234
1242
|
r = yield s(o === 0 ? typeof e > "u" ? c : e : r, c, o++), d(r);
|
|
1235
1243
|
}));
|
|
1236
1244
|
}
|
|
@@ -1238,23 +1246,23 @@ function xr(s, e) {
|
|
|
1238
1246
|
return () => Y(a);
|
|
1239
1247
|
});
|
|
1240
1248
|
}
|
|
1241
|
-
const
|
|
1249
|
+
const kr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1242
1250
|
__proto__: null,
|
|
1243
1251
|
Observable: L,
|
|
1244
|
-
Subject:
|
|
1252
|
+
Subject: nn,
|
|
1245
1253
|
filter: mr,
|
|
1246
1254
|
flatMap: Tr,
|
|
1247
1255
|
interval: wr,
|
|
1248
|
-
map:
|
|
1249
|
-
merge:
|
|
1250
|
-
multicast:
|
|
1251
|
-
scan:
|
|
1256
|
+
map: Er,
|
|
1257
|
+
merge: Cr,
|
|
1258
|
+
multicast: Rr,
|
|
1259
|
+
scan: Sr,
|
|
1252
1260
|
unsubscribe: Y
|
|
1253
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1254
|
-
var ie = {},
|
|
1255
|
-
function
|
|
1256
|
-
if (
|
|
1257
|
-
|
|
1261
|
+
}, Symbol.toStringTag, { value: "Module" })), ke = /* @__PURE__ */ ln(kr);
|
|
1262
|
+
var ie = {}, _t;
|
|
1263
|
+
function Ar() {
|
|
1264
|
+
if (_t) return ie;
|
|
1265
|
+
_t = 1, Object.defineProperty(ie, "__esModule", { value: !0 }), ie.allSettled = void 0;
|
|
1258
1266
|
function s(e) {
|
|
1259
1267
|
return Promise.all(e.map((t) => {
|
|
1260
1268
|
const n = (i) => ({ status: "fulfilled", value: i }), r = (i) => ({ status: "rejected", reason: i }), o = Promise.resolve(t);
|
|
@@ -1267,19 +1275,19 @@ function kr() {
|
|
|
1267
1275
|
}
|
|
1268
1276
|
return ie.allSettled = s, ie;
|
|
1269
1277
|
}
|
|
1270
|
-
var je = {},
|
|
1278
|
+
var je = {}, bt;
|
|
1271
1279
|
function Lr() {
|
|
1272
|
-
return
|
|
1280
|
+
return bt || (bt = 1, function(s) {
|
|
1273
1281
|
Object.defineProperty(s, "__esModule", { value: !0 }), s.PoolEventType = void 0, function(e) {
|
|
1274
1282
|
e.initialized = "initialized", e.taskCanceled = "taskCanceled", e.taskCompleted = "taskCompleted", e.taskFailed = "taskFailed", e.taskQueued = "taskQueued", e.taskQueueDrained = "taskQueueDrained", e.taskStart = "taskStart", e.terminated = "terminated";
|
|
1275
1283
|
}(s.PoolEventType || (s.PoolEventType = {}));
|
|
1276
1284
|
}(je)), je;
|
|
1277
1285
|
}
|
|
1278
|
-
var oe = {},
|
|
1279
|
-
function
|
|
1280
|
-
if (
|
|
1281
|
-
|
|
1282
|
-
const s = /* @__PURE__ */
|
|
1286
|
+
var oe = {}, yt;
|
|
1287
|
+
function rn() {
|
|
1288
|
+
if (yt) return oe;
|
|
1289
|
+
yt = 1, Object.defineProperty(oe, "__esModule", { value: !0 }), oe.Thread = void 0;
|
|
1290
|
+
const s = /* @__PURE__ */ Ot();
|
|
1283
1291
|
function e(t) {
|
|
1284
1292
|
throw Error(t);
|
|
1285
1293
|
}
|
|
@@ -1298,74 +1306,74 @@ function tn() {
|
|
|
1298
1306
|
}
|
|
1299
1307
|
}, oe;
|
|
1300
1308
|
}
|
|
1301
|
-
var
|
|
1309
|
+
var Tt;
|
|
1302
1310
|
function Mr() {
|
|
1303
|
-
return
|
|
1304
|
-
var e = X && X.__awaiter || function(p,
|
|
1305
|
-
function
|
|
1306
|
-
return y instanceof
|
|
1311
|
+
return Tt || (Tt = 1, function(s) {
|
|
1312
|
+
var e = X && X.__awaiter || function(p, g, m, b) {
|
|
1313
|
+
function _(y) {
|
|
1314
|
+
return y instanceof m ? y : new m(function(v) {
|
|
1307
1315
|
v(y);
|
|
1308
1316
|
});
|
|
1309
1317
|
}
|
|
1310
|
-
return new (
|
|
1311
|
-
function
|
|
1318
|
+
return new (m || (m = Promise))(function(y, v) {
|
|
1319
|
+
function S(A) {
|
|
1312
1320
|
try {
|
|
1313
|
-
|
|
1321
|
+
k(b.next(A));
|
|
1314
1322
|
} catch (O) {
|
|
1315
1323
|
v(O);
|
|
1316
1324
|
}
|
|
1317
1325
|
}
|
|
1318
|
-
function
|
|
1326
|
+
function C(A) {
|
|
1319
1327
|
try {
|
|
1320
|
-
|
|
1328
|
+
k(b.throw(A));
|
|
1321
1329
|
} catch (O) {
|
|
1322
1330
|
v(O);
|
|
1323
1331
|
}
|
|
1324
1332
|
}
|
|
1325
|
-
function
|
|
1326
|
-
|
|
1333
|
+
function k(A) {
|
|
1334
|
+
A.done ? y(A.value) : _(A.value).then(S, C);
|
|
1327
1335
|
}
|
|
1328
|
-
|
|
1336
|
+
k((b = b.apply(p, g || [])).next());
|
|
1329
1337
|
});
|
|
1330
1338
|
}, t = X && X.__importDefault || function(p) {
|
|
1331
1339
|
return p && p.__esModule ? p : { default: p };
|
|
1332
1340
|
};
|
|
1333
1341
|
Object.defineProperty(s, "__esModule", { value: !0 }), s.Pool = s.Thread = s.PoolEventType = void 0;
|
|
1334
|
-
const n = t(
|
|
1342
|
+
const n = t(st()), r = ke, o = /* @__PURE__ */ Ar(), i = /* @__PURE__ */ Yt(), a = /* @__PURE__ */ Lr();
|
|
1335
1343
|
Object.defineProperty(s, "PoolEventType", { enumerable: !0, get: function() {
|
|
1336
1344
|
return a.PoolEventType;
|
|
1337
1345
|
} });
|
|
1338
|
-
const c = /* @__PURE__ */
|
|
1346
|
+
const c = /* @__PURE__ */ rn();
|
|
1339
1347
|
Object.defineProperty(s, "Thread", { enumerable: !0, get: function() {
|
|
1340
1348
|
return c.Thread;
|
|
1341
1349
|
} });
|
|
1342
1350
|
let d = 1;
|
|
1343
1351
|
function u(p) {
|
|
1344
|
-
const
|
|
1345
|
-
for (let
|
|
1346
|
-
|
|
1347
|
-
return
|
|
1352
|
+
const g = [];
|
|
1353
|
+
for (let m = 0; m < p; m++)
|
|
1354
|
+
g.push(m);
|
|
1355
|
+
return g;
|
|
1348
1356
|
}
|
|
1349
1357
|
function l(p) {
|
|
1350
|
-
return new Promise((
|
|
1358
|
+
return new Promise((g) => setTimeout(g, p));
|
|
1351
1359
|
}
|
|
1352
|
-
function f(p,
|
|
1353
|
-
return p.reduce((
|
|
1360
|
+
function f(p, g) {
|
|
1361
|
+
return p.reduce((m, b) => [...m, ...g(b)], []);
|
|
1354
1362
|
}
|
|
1355
1363
|
function h(p) {
|
|
1356
1364
|
return p.replace(/\W/g, " ").trim().replace(/\s+/g, "-");
|
|
1357
1365
|
}
|
|
1358
|
-
function w(p,
|
|
1359
|
-
return u(
|
|
1366
|
+
function w(p, g) {
|
|
1367
|
+
return u(g).map(() => ({
|
|
1360
1368
|
init: p(),
|
|
1361
1369
|
runningTasks: []
|
|
1362
1370
|
}));
|
|
1363
1371
|
}
|
|
1364
|
-
class
|
|
1365
|
-
constructor(
|
|
1372
|
+
class E {
|
|
1373
|
+
constructor(g, m) {
|
|
1366
1374
|
this.eventSubject = new r.Subject(), this.initErrors = [], this.isClosing = !1, this.nextTaskID = 1, this.taskQueue = [];
|
|
1367
|
-
const
|
|
1368
|
-
this.debug = n.default(`threads:pool:${h(
|
|
1375
|
+
const b = typeof m == "number" ? { size: m } : m || {}, { size: _ = i.defaultPoolSize } = b;
|
|
1376
|
+
this.debug = n.default(`threads:pool:${h(b.name || String(d++))}`), this.options = b, this.workers = w(g, _), this.eventObservable = r.multicast(r.Observable.from(this.eventSubject)), Promise.all(this.workers.map((y) => y.init)).then(() => this.eventSubject.next({
|
|
1369
1377
|
type: a.PoolEventType.initialized,
|
|
1370
1378
|
size: this.workers.length
|
|
1371
1379
|
}), (y) => {
|
|
@@ -1373,129 +1381,129 @@ function Mr() {
|
|
|
1373
1381
|
});
|
|
1374
1382
|
}
|
|
1375
1383
|
findIdlingWorker() {
|
|
1376
|
-
const { concurrency:
|
|
1377
|
-
return this.workers.find((
|
|
1384
|
+
const { concurrency: g = 1 } = this.options;
|
|
1385
|
+
return this.workers.find((m) => m.runningTasks.length < g);
|
|
1378
1386
|
}
|
|
1379
|
-
runPoolTask(
|
|
1387
|
+
runPoolTask(g, m) {
|
|
1380
1388
|
return e(this, void 0, void 0, function* () {
|
|
1381
|
-
const
|
|
1382
|
-
this.debug(`Running task #${
|
|
1389
|
+
const b = this.workers.indexOf(g) + 1;
|
|
1390
|
+
this.debug(`Running task #${m.id} on worker #${b}...`), this.eventSubject.next({
|
|
1383
1391
|
type: a.PoolEventType.taskStart,
|
|
1384
|
-
taskID:
|
|
1385
|
-
workerID:
|
|
1392
|
+
taskID: m.id,
|
|
1393
|
+
workerID: b
|
|
1386
1394
|
});
|
|
1387
1395
|
try {
|
|
1388
|
-
const
|
|
1389
|
-
this.debug(`Task #${
|
|
1396
|
+
const _ = yield m.run(yield g.init);
|
|
1397
|
+
this.debug(`Task #${m.id} completed successfully`), this.eventSubject.next({
|
|
1390
1398
|
type: a.PoolEventType.taskCompleted,
|
|
1391
|
-
returnValue:
|
|
1392
|
-
taskID:
|
|
1393
|
-
workerID:
|
|
1399
|
+
returnValue: _,
|
|
1400
|
+
taskID: m.id,
|
|
1401
|
+
workerID: b
|
|
1394
1402
|
});
|
|
1395
|
-
} catch (
|
|
1396
|
-
this.debug(`Task #${
|
|
1403
|
+
} catch (_) {
|
|
1404
|
+
this.debug(`Task #${m.id} failed`), this.eventSubject.next({
|
|
1397
1405
|
type: a.PoolEventType.taskFailed,
|
|
1398
|
-
taskID:
|
|
1399
|
-
error:
|
|
1400
|
-
workerID:
|
|
1406
|
+
taskID: m.id,
|
|
1407
|
+
error: _,
|
|
1408
|
+
workerID: b
|
|
1401
1409
|
});
|
|
1402
1410
|
}
|
|
1403
1411
|
});
|
|
1404
1412
|
}
|
|
1405
|
-
run(
|
|
1413
|
+
run(g, m) {
|
|
1406
1414
|
return e(this, void 0, void 0, function* () {
|
|
1407
|
-
const
|
|
1408
|
-
const
|
|
1409
|
-
|
|
1415
|
+
const b = e(this, void 0, void 0, function* () {
|
|
1416
|
+
const _ = () => {
|
|
1417
|
+
g.runningTasks = g.runningTasks.filter((y) => y !== b);
|
|
1410
1418
|
};
|
|
1411
1419
|
yield l(0);
|
|
1412
1420
|
try {
|
|
1413
|
-
yield this.runPoolTask(
|
|
1421
|
+
yield this.runPoolTask(g, m);
|
|
1414
1422
|
} finally {
|
|
1415
|
-
|
|
1423
|
+
_(), this.isClosing || this.scheduleWork();
|
|
1416
1424
|
}
|
|
1417
1425
|
});
|
|
1418
|
-
|
|
1426
|
+
g.runningTasks.push(b);
|
|
1419
1427
|
});
|
|
1420
1428
|
}
|
|
1421
1429
|
scheduleWork() {
|
|
1422
1430
|
this.debug("Attempt de-queueing a task in order to run it...");
|
|
1423
|
-
const
|
|
1424
|
-
if (!
|
|
1431
|
+
const g = this.findIdlingWorker();
|
|
1432
|
+
if (!g)
|
|
1425
1433
|
return;
|
|
1426
|
-
const
|
|
1427
|
-
if (!
|
|
1434
|
+
const m = this.taskQueue.shift();
|
|
1435
|
+
if (!m) {
|
|
1428
1436
|
this.debug("Task queue is empty"), this.eventSubject.next({ type: a.PoolEventType.taskQueueDrained });
|
|
1429
1437
|
return;
|
|
1430
1438
|
}
|
|
1431
|
-
this.run(
|
|
1439
|
+
this.run(g, m);
|
|
1432
1440
|
}
|
|
1433
|
-
taskCompletion(
|
|
1434
|
-
return new Promise((
|
|
1435
|
-
const
|
|
1436
|
-
y.type === a.PoolEventType.taskCompleted && y.taskID ===
|
|
1441
|
+
taskCompletion(g) {
|
|
1442
|
+
return new Promise((m, b) => {
|
|
1443
|
+
const _ = this.events().subscribe((y) => {
|
|
1444
|
+
y.type === a.PoolEventType.taskCompleted && y.taskID === g ? (_.unsubscribe(), m(y.returnValue)) : y.type === a.PoolEventType.taskFailed && y.taskID === g ? (_.unsubscribe(), b(y.error)) : y.type === a.PoolEventType.terminated && (_.unsubscribe(), b(Error("Pool has been terminated before task was run.")));
|
|
1437
1445
|
});
|
|
1438
1446
|
});
|
|
1439
1447
|
}
|
|
1440
|
-
settled(
|
|
1448
|
+
settled(g = !1) {
|
|
1441
1449
|
return e(this, void 0, void 0, function* () {
|
|
1442
|
-
const
|
|
1443
|
-
y.type === a.PoolEventType.taskFailed &&
|
|
1450
|
+
const m = () => f(this.workers, (y) => y.runningTasks), b = [], _ = this.eventObservable.subscribe((y) => {
|
|
1451
|
+
y.type === a.PoolEventType.taskFailed && b.push(y.error);
|
|
1444
1452
|
});
|
|
1445
|
-
return this.initErrors.length > 0 ? Promise.reject(this.initErrors[0]) :
|
|
1446
|
-
const
|
|
1447
|
-
next(
|
|
1448
|
-
|
|
1453
|
+
return this.initErrors.length > 0 ? Promise.reject(this.initErrors[0]) : g && this.taskQueue.length === 0 ? (yield o.allSettled(m()), b) : (yield new Promise((y, v) => {
|
|
1454
|
+
const S = this.eventObservable.subscribe({
|
|
1455
|
+
next(C) {
|
|
1456
|
+
C.type === a.PoolEventType.taskQueueDrained && (S.unsubscribe(), y(void 0));
|
|
1449
1457
|
},
|
|
1450
1458
|
error: v
|
|
1451
1459
|
// make a pool-wide error reject the completed() result promise
|
|
1452
1460
|
});
|
|
1453
|
-
}), yield o.allSettled(
|
|
1461
|
+
}), yield o.allSettled(m()), _.unsubscribe(), b);
|
|
1454
1462
|
});
|
|
1455
1463
|
}
|
|
1456
|
-
completed(
|
|
1464
|
+
completed(g = !1) {
|
|
1457
1465
|
return e(this, void 0, void 0, function* () {
|
|
1458
|
-
const
|
|
1459
|
-
const
|
|
1460
|
-
next(
|
|
1461
|
-
|
|
1466
|
+
const m = this.settled(g), b = new Promise((y, v) => {
|
|
1467
|
+
const S = this.eventObservable.subscribe({
|
|
1468
|
+
next(C) {
|
|
1469
|
+
C.type === a.PoolEventType.taskQueueDrained ? (S.unsubscribe(), y(m)) : C.type === a.PoolEventType.taskFailed && (S.unsubscribe(), v(C.error));
|
|
1462
1470
|
},
|
|
1463
1471
|
error: v
|
|
1464
1472
|
// make a pool-wide error reject the completed() result promise
|
|
1465
1473
|
});
|
|
1466
|
-
}),
|
|
1467
|
-
|
|
1468
|
-
|
|
1474
|
+
}), _ = yield Promise.race([
|
|
1475
|
+
m,
|
|
1476
|
+
b
|
|
1469
1477
|
]);
|
|
1470
|
-
if (
|
|
1471
|
-
throw
|
|
1478
|
+
if (_.length > 0)
|
|
1479
|
+
throw _[0];
|
|
1472
1480
|
});
|
|
1473
1481
|
}
|
|
1474
1482
|
events() {
|
|
1475
1483
|
return this.eventObservable;
|
|
1476
1484
|
}
|
|
1477
|
-
queue(
|
|
1478
|
-
const { maxQueuedJobs:
|
|
1485
|
+
queue(g) {
|
|
1486
|
+
const { maxQueuedJobs: m = 1 / 0 } = this.options;
|
|
1479
1487
|
if (this.isClosing)
|
|
1480
1488
|
throw Error("Cannot schedule pool tasks after terminate() has been called.");
|
|
1481
1489
|
if (this.initErrors.length > 0)
|
|
1482
1490
|
throw this.initErrors[0];
|
|
1483
|
-
const
|
|
1484
|
-
|
|
1485
|
-
this.debug(`Task #${
|
|
1491
|
+
const b = this.nextTaskID++, _ = this.taskCompletion(b);
|
|
1492
|
+
_.catch((v) => {
|
|
1493
|
+
this.debug(`Task #${b} errored:`, v);
|
|
1486
1494
|
});
|
|
1487
1495
|
const y = {
|
|
1488
|
-
id:
|
|
1489
|
-
run:
|
|
1496
|
+
id: b,
|
|
1497
|
+
run: g,
|
|
1490
1498
|
cancel: () => {
|
|
1491
1499
|
this.taskQueue.indexOf(y) !== -1 && (this.taskQueue = this.taskQueue.filter((v) => v !== y), this.eventSubject.next({
|
|
1492
1500
|
type: a.PoolEventType.taskCanceled,
|
|
1493
1501
|
taskID: y.id
|
|
1494
1502
|
}));
|
|
1495
1503
|
},
|
|
1496
|
-
then:
|
|
1504
|
+
then: _.then.bind(_)
|
|
1497
1505
|
};
|
|
1498
|
-
if (this.taskQueue.length >=
|
|
1506
|
+
if (this.taskQueue.length >= m)
|
|
1499
1507
|
throw Error(`Maximum number of pool tasks queued. Refusing to queue another one.
|
|
1500
1508
|
This usually happens for one of two reasons: We are either at peak workload right now or some tasks just won't finish, thus blocking the pool.`);
|
|
1501
1509
|
return this.debug(`Queueing task #${y.id}...`), this.taskQueue.push(y), this.eventSubject.next({
|
|
@@ -1503,28 +1511,28 @@ This usually happens for one of two reasons: We are either at peak workload righ
|
|
|
1503
1511
|
taskID: y.id
|
|
1504
1512
|
}), this.scheduleWork(), y;
|
|
1505
1513
|
}
|
|
1506
|
-
terminate(
|
|
1514
|
+
terminate(g) {
|
|
1507
1515
|
return e(this, void 0, void 0, function* () {
|
|
1508
|
-
this.isClosing = !0,
|
|
1516
|
+
this.isClosing = !0, g || (yield this.completed(!0)), this.eventSubject.next({
|
|
1509
1517
|
type: a.PoolEventType.terminated,
|
|
1510
1518
|
remainingQueue: [...this.taskQueue]
|
|
1511
|
-
}), this.eventSubject.complete(), yield Promise.all(this.workers.map((
|
|
1512
|
-
return c.Thread.terminate(yield
|
|
1519
|
+
}), this.eventSubject.complete(), yield Promise.all(this.workers.map((m) => e(this, void 0, void 0, function* () {
|
|
1520
|
+
return c.Thread.terminate(yield m.init);
|
|
1513
1521
|
})));
|
|
1514
1522
|
});
|
|
1515
1523
|
}
|
|
1516
1524
|
}
|
|
1517
|
-
|
|
1518
|
-
function T(p,
|
|
1519
|
-
return new
|
|
1525
|
+
E.EventType = a.PoolEventType;
|
|
1526
|
+
function T(p, g) {
|
|
1527
|
+
return new E(p, g);
|
|
1520
1528
|
}
|
|
1521
1529
|
T.EventType = a.PoolEventType, s.Pool = T;
|
|
1522
1530
|
}(X)), X;
|
|
1523
1531
|
}
|
|
1524
|
-
var
|
|
1532
|
+
var j = {}, ae = {}, wt;
|
|
1525
1533
|
function Pr() {
|
|
1526
|
-
if (
|
|
1527
|
-
|
|
1534
|
+
if (wt) return ae;
|
|
1535
|
+
wt = 1, Object.defineProperty(ae, "__esModule", { value: !0 }), ae.createPromiseWithResolver = void 0;
|
|
1528
1536
|
const s = () => {
|
|
1529
1537
|
};
|
|
1530
1538
|
function e() {
|
|
@@ -1537,19 +1545,19 @@ function Pr() {
|
|
|
1537
1545
|
}
|
|
1538
1546
|
return ae.createPromiseWithResolver = e, ae;
|
|
1539
1547
|
}
|
|
1540
|
-
var He = {},
|
|
1548
|
+
var He = {}, vt;
|
|
1541
1549
|
function Or() {
|
|
1542
|
-
return
|
|
1550
|
+
return vt || (vt = 1, function(s) {
|
|
1543
1551
|
Object.defineProperty(s, "__esModule", { value: !0 }), s.WorkerEventType = void 0, function(e) {
|
|
1544
1552
|
e.internalError = "internalError", e.message = "message", e.termination = "termination";
|
|
1545
1553
|
}(s.WorkerEventType || (s.WorkerEventType = {}));
|
|
1546
1554
|
}(He)), He;
|
|
1547
1555
|
}
|
|
1548
|
-
var
|
|
1556
|
+
var H = {}, ce = {}, Et;
|
|
1549
1557
|
function Ir() {
|
|
1550
|
-
if (
|
|
1551
|
-
|
|
1552
|
-
const s =
|
|
1558
|
+
if (Et) return ce;
|
|
1559
|
+
Et = 1, Object.defineProperty(ce, "__esModule", { value: !0 }), ce.ObservablePromise = void 0;
|
|
1560
|
+
const s = ke, e = () => {
|
|
1553
1561
|
}, t = (a) => a, n = (a) => Promise.resolve().then(a);
|
|
1554
1562
|
function r(a) {
|
|
1555
1563
|
throw a;
|
|
@@ -1595,27 +1603,27 @@ function Ir() {
|
|
|
1595
1603
|
const u = c || t, l = d || r;
|
|
1596
1604
|
let f = !1;
|
|
1597
1605
|
return new Promise((h, w) => {
|
|
1598
|
-
const
|
|
1606
|
+
const E = (p) => {
|
|
1599
1607
|
if (!f) {
|
|
1600
1608
|
f = !0;
|
|
1601
1609
|
try {
|
|
1602
1610
|
h(l(p));
|
|
1603
|
-
} catch (
|
|
1604
|
-
w(
|
|
1611
|
+
} catch (g) {
|
|
1612
|
+
w(g);
|
|
1605
1613
|
}
|
|
1606
1614
|
}
|
|
1607
1615
|
}, T = (p) => {
|
|
1608
1616
|
try {
|
|
1609
1617
|
h(u(p));
|
|
1610
|
-
} catch (
|
|
1611
|
-
|
|
1618
|
+
} catch (g) {
|
|
1619
|
+
E(g);
|
|
1612
1620
|
}
|
|
1613
1621
|
};
|
|
1614
|
-
if (this.initHasRun || this.subscribe({ error:
|
|
1622
|
+
if (this.initHasRun || this.subscribe({ error: E }), this.state === "fulfilled")
|
|
1615
1623
|
return h(u(this.firstValue));
|
|
1616
1624
|
if (this.state === "rejected")
|
|
1617
1625
|
return f = !0, h(l(this.rejection));
|
|
1618
|
-
this.fulfillmentCallbacks.push(T), this.rejectionCallbacks.push(
|
|
1626
|
+
this.fulfillmentCallbacks.push(T), this.rejectionCallbacks.push(E);
|
|
1619
1627
|
});
|
|
1620
1628
|
}
|
|
1621
1629
|
catch(c) {
|
|
@@ -1638,41 +1646,41 @@ function Ir() {
|
|
|
1638
1646
|
}
|
|
1639
1647
|
return ce.ObservablePromise = i, ce;
|
|
1640
1648
|
}
|
|
1641
|
-
var
|
|
1649
|
+
var Ct;
|
|
1642
1650
|
function Dr() {
|
|
1643
|
-
if (
|
|
1644
|
-
|
|
1645
|
-
var s =
|
|
1651
|
+
if (Ct) return H;
|
|
1652
|
+
Ct = 1;
|
|
1653
|
+
var s = H && H.__importDefault || function(p) {
|
|
1646
1654
|
return p && p.__esModule ? p : { default: p };
|
|
1647
1655
|
};
|
|
1648
|
-
Object.defineProperty(
|
|
1649
|
-
const e = s(
|
|
1656
|
+
Object.defineProperty(H, "__esModule", { value: !0 }), H.createProxyModule = H.createProxyFunction = void 0;
|
|
1657
|
+
const e = s(st()), t = ke, n = /* @__PURE__ */ rt(), r = /* @__PURE__ */ Ir(), o = /* @__PURE__ */ It(), i = /* @__PURE__ */ dn(), a = e.default("threads:master:messages");
|
|
1650
1658
|
let c = 1;
|
|
1651
1659
|
const d = (p) => Array.from(new Set(p)), u = (p) => p && p.type === i.WorkerMessageType.error, l = (p) => p && p.type === i.WorkerMessageType.result, f = (p) => p && p.type === i.WorkerMessageType.running;
|
|
1652
|
-
function h(p,
|
|
1653
|
-
return new t.Observable((
|
|
1654
|
-
let
|
|
1655
|
-
const
|
|
1656
|
-
if (a("Message from worker:", y.data), !(!y.data || y.data.uid !==
|
|
1660
|
+
function h(p, g) {
|
|
1661
|
+
return new t.Observable((m) => {
|
|
1662
|
+
let b;
|
|
1663
|
+
const _ = (y) => {
|
|
1664
|
+
if (a("Message from worker:", y.data), !(!y.data || y.data.uid !== g)) {
|
|
1657
1665
|
if (f(y.data))
|
|
1658
|
-
|
|
1666
|
+
b = y.data.resultType;
|
|
1659
1667
|
else if (l(y.data))
|
|
1660
|
-
|
|
1668
|
+
b === "promise" ? (typeof y.data.payload < "u" && m.next(n.deserialize(y.data.payload)), m.complete(), p.removeEventListener("message", _)) : (y.data.payload && m.next(n.deserialize(y.data.payload)), y.data.complete && (m.complete(), p.removeEventListener("message", _)));
|
|
1661
1669
|
else if (u(y.data)) {
|
|
1662
1670
|
const v = n.deserialize(y.data.error);
|
|
1663
|
-
|
|
1671
|
+
m.error(v), p.removeEventListener("message", _);
|
|
1664
1672
|
}
|
|
1665
1673
|
}
|
|
1666
1674
|
};
|
|
1667
|
-
return p.addEventListener("message",
|
|
1668
|
-
if (
|
|
1675
|
+
return p.addEventListener("message", _), () => {
|
|
1676
|
+
if (b === "observable" || !b) {
|
|
1669
1677
|
const y = {
|
|
1670
1678
|
type: i.MasterMessageType.cancel,
|
|
1671
|
-
uid:
|
|
1679
|
+
uid: g
|
|
1672
1680
|
};
|
|
1673
1681
|
p.postMessage(y);
|
|
1674
1682
|
}
|
|
1675
|
-
p.removeEventListener("message",
|
|
1683
|
+
p.removeEventListener("message", _);
|
|
1676
1684
|
};
|
|
1677
1685
|
});
|
|
1678
1686
|
}
|
|
@@ -1682,157 +1690,157 @@ function Dr() {
|
|
|
1682
1690
|
args: [],
|
|
1683
1691
|
transferables: []
|
|
1684
1692
|
};
|
|
1685
|
-
const
|
|
1686
|
-
for (const
|
|
1687
|
-
o.isTransferDescriptor(
|
|
1693
|
+
const g = [], m = [];
|
|
1694
|
+
for (const b of p)
|
|
1695
|
+
o.isTransferDescriptor(b) ? (g.push(n.serialize(b.send)), m.push(...b.transferables)) : g.push(n.serialize(b));
|
|
1688
1696
|
return {
|
|
1689
|
-
args:
|
|
1690
|
-
transferables:
|
|
1697
|
+
args: g,
|
|
1698
|
+
transferables: m.length === 0 ? m : d(m)
|
|
1691
1699
|
};
|
|
1692
1700
|
}
|
|
1693
|
-
function
|
|
1694
|
-
return (...
|
|
1695
|
-
const
|
|
1701
|
+
function E(p, g) {
|
|
1702
|
+
return (...m) => {
|
|
1703
|
+
const b = c++, { args: _, transferables: y } = w(m), v = {
|
|
1696
1704
|
type: i.MasterMessageType.run,
|
|
1697
|
-
uid:
|
|
1698
|
-
method:
|
|
1699
|
-
args:
|
|
1705
|
+
uid: b,
|
|
1706
|
+
method: g,
|
|
1707
|
+
args: _
|
|
1700
1708
|
};
|
|
1701
1709
|
a("Sending command to run function to worker:", v);
|
|
1702
1710
|
try {
|
|
1703
1711
|
p.postMessage(v, y);
|
|
1704
|
-
} catch (
|
|
1705
|
-
return r.ObservablePromise.from(Promise.reject(
|
|
1712
|
+
} catch (S) {
|
|
1713
|
+
return r.ObservablePromise.from(Promise.reject(S));
|
|
1706
1714
|
}
|
|
1707
|
-
return r.ObservablePromise.from(t.multicast(h(p,
|
|
1715
|
+
return r.ObservablePromise.from(t.multicast(h(p, b)));
|
|
1708
1716
|
};
|
|
1709
1717
|
}
|
|
1710
|
-
|
|
1711
|
-
function T(p,
|
|
1712
|
-
const
|
|
1713
|
-
for (const
|
|
1714
|
-
|
|
1715
|
-
return
|
|
1718
|
+
H.createProxyFunction = E;
|
|
1719
|
+
function T(p, g) {
|
|
1720
|
+
const m = {};
|
|
1721
|
+
for (const b of g)
|
|
1722
|
+
m[b] = E(p, b);
|
|
1723
|
+
return m;
|
|
1716
1724
|
}
|
|
1717
|
-
return
|
|
1725
|
+
return H.createProxyModule = T, H;
|
|
1718
1726
|
}
|
|
1719
|
-
var
|
|
1727
|
+
var Rt;
|
|
1720
1728
|
function Nr() {
|
|
1721
|
-
if (
|
|
1722
|
-
|
|
1723
|
-
var s =
|
|
1724
|
-
function
|
|
1725
|
-
return
|
|
1726
|
-
k
|
|
1729
|
+
if (Rt) return j;
|
|
1730
|
+
Rt = 1;
|
|
1731
|
+
var s = j && j.__awaiter || function(_, y, v, S) {
|
|
1732
|
+
function C(k) {
|
|
1733
|
+
return k instanceof v ? k : new v(function(A) {
|
|
1734
|
+
A(k);
|
|
1727
1735
|
});
|
|
1728
1736
|
}
|
|
1729
|
-
return new (v || (v = Promise))(function(
|
|
1730
|
-
function O(
|
|
1737
|
+
return new (v || (v = Promise))(function(k, A) {
|
|
1738
|
+
function O(K) {
|
|
1731
1739
|
try {
|
|
1732
|
-
|
|
1740
|
+
Ae(S.next(K));
|
|
1733
1741
|
} catch (Le) {
|
|
1734
|
-
|
|
1742
|
+
A(Le);
|
|
1735
1743
|
}
|
|
1736
1744
|
}
|
|
1737
|
-
function K
|
|
1745
|
+
function z(K) {
|
|
1738
1746
|
try {
|
|
1739
|
-
|
|
1747
|
+
Ae(S.throw(K));
|
|
1740
1748
|
} catch (Le) {
|
|
1741
|
-
|
|
1749
|
+
A(Le);
|
|
1742
1750
|
}
|
|
1743
1751
|
}
|
|
1744
|
-
function
|
|
1745
|
-
|
|
1752
|
+
function Ae(K) {
|
|
1753
|
+
K.done ? k(K.value) : C(K.value).then(O, z);
|
|
1746
1754
|
}
|
|
1747
|
-
|
|
1755
|
+
Ae((S = S.apply(_, y || [])).next());
|
|
1748
1756
|
});
|
|
1749
|
-
}, e =
|
|
1750
|
-
return
|
|
1757
|
+
}, e = j && j.__importDefault || function(_) {
|
|
1758
|
+
return _ && _.__esModule ? _ : { default: _ };
|
|
1751
1759
|
};
|
|
1752
|
-
Object.defineProperty(
|
|
1753
|
-
const t = e(
|
|
1754
|
-
function
|
|
1760
|
+
Object.defineProperty(j, "__esModule", { value: !0 }), j.spawn = void 0;
|
|
1761
|
+
const t = e(st()), n = ke, r = /* @__PURE__ */ rt(), o = /* @__PURE__ */ Pr(), i = /* @__PURE__ */ Ot(), a = /* @__PURE__ */ Or(), c = /* @__PURE__ */ Dr(), d = t.default("threads:master:messages"), u = t.default("threads:master:spawn"), l = t.default("threads:master:thread-utils"), f = (_) => _ && _.type === "init", h = (_) => _ && _.type === "uncaughtError", w = typeof process < "u" && process.env.THREADS_WORKER_INIT_TIMEOUT ? Number.parseInt(process.env.THREADS_WORKER_INIT_TIMEOUT, 10) : 1e4;
|
|
1762
|
+
function E(_, y, v) {
|
|
1755
1763
|
return s(this, void 0, void 0, function* () {
|
|
1756
|
-
let
|
|
1757
|
-
const
|
|
1758
|
-
|
|
1759
|
-
}),
|
|
1760
|
-
|
|
1761
|
-
|
|
1764
|
+
let S;
|
|
1765
|
+
const C = new Promise((A, O) => {
|
|
1766
|
+
S = setTimeout(() => O(Error(v)), y);
|
|
1767
|
+
}), k = yield Promise.race([
|
|
1768
|
+
_,
|
|
1769
|
+
C
|
|
1762
1770
|
]);
|
|
1763
|
-
return clearTimeout(
|
|
1771
|
+
return clearTimeout(S), k;
|
|
1764
1772
|
});
|
|
1765
1773
|
}
|
|
1766
|
-
function T(
|
|
1774
|
+
function T(_) {
|
|
1767
1775
|
return new Promise((y, v) => {
|
|
1768
|
-
const
|
|
1769
|
-
d("Message from worker before finishing initialization:",
|
|
1776
|
+
const S = (C) => {
|
|
1777
|
+
d("Message from worker before finishing initialization:", C.data), f(C.data) ? (_.removeEventListener("message", S), y(C.data)) : h(C.data) && (_.removeEventListener("message", S), v(r.deserialize(C.data.error)));
|
|
1770
1778
|
};
|
|
1771
|
-
|
|
1779
|
+
_.addEventListener("message", S);
|
|
1772
1780
|
});
|
|
1773
1781
|
}
|
|
1774
|
-
function p(
|
|
1782
|
+
function p(_, y) {
|
|
1775
1783
|
return new n.Observable((v) => {
|
|
1776
|
-
const
|
|
1777
|
-
const
|
|
1784
|
+
const S = (k) => {
|
|
1785
|
+
const A = {
|
|
1778
1786
|
type: a.WorkerEventType.message,
|
|
1779
|
-
data:
|
|
1787
|
+
data: k.data
|
|
1780
1788
|
};
|
|
1781
|
-
v.next(
|
|
1782
|
-
},
|
|
1783
|
-
l("Unhandled promise rejection event in thread:",
|
|
1784
|
-
const
|
|
1789
|
+
v.next(A);
|
|
1790
|
+
}, C = (k) => {
|
|
1791
|
+
l("Unhandled promise rejection event in thread:", k);
|
|
1792
|
+
const A = {
|
|
1785
1793
|
type: a.WorkerEventType.internalError,
|
|
1786
|
-
error: Error(
|
|
1794
|
+
error: Error(k.reason)
|
|
1787
1795
|
};
|
|
1788
|
-
v.next(
|
|
1796
|
+
v.next(A);
|
|
1789
1797
|
};
|
|
1790
|
-
|
|
1791
|
-
const
|
|
1798
|
+
_.addEventListener("message", S), _.addEventListener("unhandledrejection", C), y.then(() => {
|
|
1799
|
+
const k = {
|
|
1792
1800
|
type: a.WorkerEventType.termination
|
|
1793
1801
|
};
|
|
1794
|
-
|
|
1802
|
+
_.removeEventListener("message", S), _.removeEventListener("unhandledrejection", C), v.next(k), v.complete();
|
|
1795
1803
|
});
|
|
1796
1804
|
});
|
|
1797
1805
|
}
|
|
1798
|
-
function
|
|
1806
|
+
function g(_) {
|
|
1799
1807
|
const [y, v] = o.createPromiseWithResolver();
|
|
1800
1808
|
return { terminate: () => s(this, void 0, void 0, function* () {
|
|
1801
|
-
l("Terminating worker"), yield
|
|
1809
|
+
l("Terminating worker"), yield _.terminate(), v();
|
|
1802
1810
|
}), termination: y };
|
|
1803
1811
|
}
|
|
1804
|
-
function
|
|
1805
|
-
const
|
|
1806
|
-
return Object.assign(
|
|
1807
|
-
[i.$errors]:
|
|
1812
|
+
function m(_, y, v, S) {
|
|
1813
|
+
const C = v.filter((k) => k.type === a.WorkerEventType.internalError).map((k) => k.error);
|
|
1814
|
+
return Object.assign(_, {
|
|
1815
|
+
[i.$errors]: C,
|
|
1808
1816
|
[i.$events]: v,
|
|
1809
|
-
[i.$terminate]:
|
|
1817
|
+
[i.$terminate]: S,
|
|
1810
1818
|
[i.$worker]: y
|
|
1811
1819
|
});
|
|
1812
1820
|
}
|
|
1813
|
-
function _
|
|
1821
|
+
function b(_, y) {
|
|
1814
1822
|
return s(this, void 0, void 0, function* () {
|
|
1815
1823
|
u("Initializing new thread");
|
|
1816
|
-
const v = y && y.timeout ? y.timeout : w,
|
|
1817
|
-
if (
|
|
1818
|
-
const
|
|
1819
|
-
return
|
|
1820
|
-
} else if (
|
|
1821
|
-
const
|
|
1822
|
-
return
|
|
1824
|
+
const v = y && y.timeout ? y.timeout : w, C = (yield E(T(_), v, `Timeout: Did not receive an init message from worker after ${v}ms. Make sure the worker calls expose().`)).exposed, { termination: k, terminate: A } = g(_), O = p(_, k);
|
|
1825
|
+
if (C.type === "function") {
|
|
1826
|
+
const z = c.createProxyFunction(_);
|
|
1827
|
+
return m(z, _, O, A);
|
|
1828
|
+
} else if (C.type === "module") {
|
|
1829
|
+
const z = c.createProxyModule(_, C.methods);
|
|
1830
|
+
return m(z, _, O, A);
|
|
1823
1831
|
} else {
|
|
1824
|
-
const
|
|
1825
|
-
throw Error(`Worker init message states unexpected type of expose(): ${
|
|
1832
|
+
const z = C.type;
|
|
1833
|
+
throw Error(`Worker init message states unexpected type of expose(): ${z}`);
|
|
1826
1834
|
}
|
|
1827
1835
|
});
|
|
1828
1836
|
}
|
|
1829
|
-
return
|
|
1837
|
+
return j.spawn = b, j;
|
|
1830
1838
|
}
|
|
1831
|
-
var
|
|
1839
|
+
var xt;
|
|
1832
1840
|
function Fr() {
|
|
1833
|
-
return
|
|
1841
|
+
return xt || (xt = 1, function(s) {
|
|
1834
1842
|
Object.defineProperty(s, "__esModule", { value: !0 }), s.Worker = s.BlobWorker = s.isWorkerRuntime = s.Thread = s.spawn = s.Pool = void 0;
|
|
1835
|
-
const e = /* @__PURE__ */
|
|
1843
|
+
const e = /* @__PURE__ */ Yt();
|
|
1836
1844
|
Object.defineProperty(s, "isWorkerRuntime", { enumerable: !0, get: function() {
|
|
1837
1845
|
return e.isWorkerRuntime;
|
|
1838
1846
|
} });
|
|
@@ -1844,55 +1852,55 @@ function Fr() {
|
|
|
1844
1852
|
Object.defineProperty(s, "spawn", { enumerable: !0, get: function() {
|
|
1845
1853
|
return n.spawn;
|
|
1846
1854
|
} });
|
|
1847
|
-
var r = /* @__PURE__ */
|
|
1855
|
+
var r = /* @__PURE__ */ rn();
|
|
1848
1856
|
Object.defineProperty(s, "Thread", { enumerable: !0, get: function() {
|
|
1849
1857
|
return r.Thread;
|
|
1850
1858
|
} }), s.BlobWorker = e.getWorkerImplementation().blob, s.Worker = e.getWorkerImplementation().default;
|
|
1851
1859
|
}(Ie)), Ie;
|
|
1852
1860
|
}
|
|
1853
|
-
var
|
|
1861
|
+
var St;
|
|
1854
1862
|
function jr() {
|
|
1855
|
-
return
|
|
1856
|
-
var e =
|
|
1863
|
+
return St || (St = 1, function(s) {
|
|
1864
|
+
var e = q && q.__createBinding || (Object.create ? function(a, c, d, u) {
|
|
1857
1865
|
u === void 0 && (u = d), Object.defineProperty(a, u, { enumerable: !0, get: function() {
|
|
1858
1866
|
return c[d];
|
|
1859
1867
|
} });
|
|
1860
1868
|
} : function(a, c, d, u) {
|
|
1861
1869
|
u === void 0 && (u = d), a[u] = c[d];
|
|
1862
|
-
}), t =
|
|
1870
|
+
}), t = q && q.__exportStar || function(a, c) {
|
|
1863
1871
|
for (var d in a) d !== "default" && !Object.prototype.hasOwnProperty.call(c, d) && e(c, a, d);
|
|
1864
1872
|
};
|
|
1865
1873
|
Object.defineProperty(s, "__esModule", { value: !0 }), s.Transfer = s.DefaultSerializer = s.expose = s.registerSerializer = void 0;
|
|
1866
|
-
var n = /* @__PURE__ */
|
|
1874
|
+
var n = /* @__PURE__ */ rt();
|
|
1867
1875
|
Object.defineProperty(s, "registerSerializer", { enumerable: !0, get: function() {
|
|
1868
1876
|
return n.registerSerializer;
|
|
1869
1877
|
} }), t(/* @__PURE__ */ Fr(), s);
|
|
1870
|
-
var r =
|
|
1878
|
+
var r = fn();
|
|
1871
1879
|
Object.defineProperty(s, "expose", { enumerable: !0, get: function() {
|
|
1872
1880
|
return r.expose;
|
|
1873
1881
|
} });
|
|
1874
|
-
var o = /* @__PURE__ */
|
|
1882
|
+
var o = /* @__PURE__ */ hn();
|
|
1875
1883
|
Object.defineProperty(s, "DefaultSerializer", { enumerable: !0, get: function() {
|
|
1876
1884
|
return o.DefaultSerializer;
|
|
1877
1885
|
} });
|
|
1878
|
-
var i = /* @__PURE__ */
|
|
1886
|
+
var i = /* @__PURE__ */ It();
|
|
1879
1887
|
Object.defineProperty(s, "Transfer", { enumerable: !0, get: function() {
|
|
1880
1888
|
return i.Transfer;
|
|
1881
1889
|
} });
|
|
1882
|
-
}(
|
|
1890
|
+
}(q)), q;
|
|
1883
1891
|
}
|
|
1884
1892
|
var Hr = /* @__PURE__ */ jr();
|
|
1885
|
-
const
|
|
1886
|
-
|
|
1887
|
-
const Ur =
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
const Br =
|
|
1892
|
-
|
|
1893
|
-
const Gr =
|
|
1894
|
-
var Wr = Object.defineProperty,
|
|
1895
|
-
const
|
|
1893
|
+
const $ = /* @__PURE__ */ pn(Hr);
|
|
1894
|
+
$.registerSerializer;
|
|
1895
|
+
const Ur = $.spawn;
|
|
1896
|
+
$.BlobWorker;
|
|
1897
|
+
$.DefaultSerializer;
|
|
1898
|
+
$.Pool;
|
|
1899
|
+
const Br = $.Thread;
|
|
1900
|
+
$.Transfer;
|
|
1901
|
+
const Gr = $.Worker;
|
|
1902
|
+
var Wr = Object.defineProperty, $r = (s, e, t) => e in s ? Wr(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, U = (s, e, t) => $r(s, typeof e != "symbol" ? e + "" : e, t);
|
|
1903
|
+
const zr = () => {
|
|
1896
1904
|
try {
|
|
1897
1905
|
if (window) {
|
|
1898
1906
|
if (navigator != null && navigator.hardwareConcurrency)
|
|
@@ -1902,15 +1910,15 @@ const Kr = () => {
|
|
|
1902
1910
|
} catch (s) {
|
|
1903
1911
|
return console.error("🛑 Unable to detect available cores", s), 2;
|
|
1904
1912
|
}
|
|
1905
|
-
},
|
|
1913
|
+
}, Kr = () => zr() - 1, qr = "TERMINATE_THREAD_FROM_WORKER";
|
|
1906
1914
|
let Vr = -1;
|
|
1907
1915
|
class Xr {
|
|
1908
1916
|
constructor(e) {
|
|
1909
|
-
|
|
1917
|
+
U(this, "_handleTerminate"), U(this, "_handleError"), U(this, "_task"), U(this, "id", Vr += 1), U(this, "idle", !0), U(this, "worker"), U(this, "thread"), this._handleTerminate = e == null ? void 0 : e.onTerminate, this._handleError = e == null ? void 0 : e.onError;
|
|
1910
1918
|
}
|
|
1911
1919
|
_handleMessages(e) {
|
|
1912
1920
|
var t;
|
|
1913
|
-
e instanceof MessageEvent && ((t = e.data) == null ? void 0 : t.token) ===
|
|
1921
|
+
e instanceof MessageEvent && ((t = e.data) == null ? void 0 : t.token) === qr && this.terminate();
|
|
1914
1922
|
}
|
|
1915
1923
|
async run(e) {
|
|
1916
1924
|
var t;
|
|
@@ -1941,7 +1949,7 @@ class Xr {
|
|
|
1941
1949
|
}
|
|
1942
1950
|
class Qr {
|
|
1943
1951
|
constructor(e, t, n) {
|
|
1944
|
-
|
|
1952
|
+
U(this, "_workerThreads", []), U(this, "_tasksQueue", []), this.maxWorkersCount = e, this.debugMode = t, this.onWorkerThreadRun = n;
|
|
1945
1953
|
for (let r = 0; r < this.maxWorkersCount; r++)
|
|
1946
1954
|
this._workerThreads.push(this._createWorkerThread());
|
|
1947
1955
|
}
|
|
@@ -2016,19 +2024,19 @@ class Qr {
|
|
|
2016
2024
|
this._tasksQueue = [], await Promise.all(this._workerThreads.map((e) => e.terminate()));
|
|
2017
2025
|
}
|
|
2018
2026
|
}
|
|
2019
|
-
const Yr = (s, e) => new Qr(
|
|
2027
|
+
const Yr = (s, e) => new Qr(Kr(), !!e);
|
|
2020
2028
|
var Jr = Object.defineProperty, Zr = Object.getOwnPropertyDescriptor, es = (s, e, t, n) => {
|
|
2021
2029
|
for (var r = n > 1 ? void 0 : n ? Zr(e, t) : e, o = s.length - 1, i; o >= 0; o--)
|
|
2022
2030
|
(i = s[o]) && (r = (n ? i(e, t, r) : i(r)) || r);
|
|
2023
2031
|
return n && r && Jr(e, t, r), r;
|
|
2024
2032
|
}, ts = (s, e) => (t, n) => e(t, n, s);
|
|
2025
|
-
let
|
|
2033
|
+
let Ee = class {
|
|
2026
2034
|
constructor(s) {
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2035
|
+
R(this, "workerPool");
|
|
2036
|
+
R(this, "canvas");
|
|
2037
|
+
R(this, "offscreenCanvas");
|
|
2038
|
+
R(this, "worker");
|
|
2039
|
+
R(this, "thread");
|
|
2032
2040
|
this._props = s, this.workerPool = Yr(void 0, this._props.enableDebug);
|
|
2033
2041
|
}
|
|
2034
2042
|
init(s) {
|
|
@@ -2092,51 +2100,61 @@ let Ae = class {
|
|
|
2092
2100
|
};
|
|
2093
2101
|
}
|
|
2094
2102
|
keyEventHandler(s) {
|
|
2095
|
-
if (
|
|
2103
|
+
if (mn.includes(s.code))
|
|
2096
2104
|
return s.preventDefault(), {
|
|
2097
2105
|
...this.getScreenSizes(),
|
|
2098
2106
|
...de(s, ["ctrlKey", "metaKey", "shiftKey", "keyCode"])
|
|
2099
2107
|
};
|
|
2100
2108
|
}
|
|
2101
2109
|
};
|
|
2102
|
-
|
|
2110
|
+
Ee = es([
|
|
2103
2111
|
ne(re.ContainerScoped),
|
|
2104
|
-
ts(0, P(
|
|
2105
|
-
],
|
|
2112
|
+
ts(0, P(xe))
|
|
2113
|
+
], Ee);
|
|
2106
2114
|
var ns = Object.defineProperty, rs = Object.getOwnPropertyDescriptor, ss = (s, e, t, n) => {
|
|
2107
2115
|
for (var r = n > 1 ? void 0 : n ? rs(e, t) : e, o = s.length - 1, i; o >= 0; o--)
|
|
2108
2116
|
(i = s[o]) && (r = (n ? i(e, t, r) : i(r)) || r);
|
|
2109
2117
|
return n && r && ns(e, t, r), r;
|
|
2110
2118
|
}, is = (s, e) => (t, n) => e(t, n, s);
|
|
2111
|
-
let
|
|
2119
|
+
let Je = class extends gn {
|
|
2112
2120
|
constructor(s) {
|
|
2113
2121
|
super(), this._service = s;
|
|
2114
2122
|
}
|
|
2115
2123
|
init() {
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2124
|
+
let s;
|
|
2125
|
+
try {
|
|
2126
|
+
s = Dt.resolve("MAIN_THREAD_APP");
|
|
2127
|
+
} catch {
|
|
2128
|
+
s = void 0;
|
|
2129
|
+
}
|
|
2130
|
+
for (const e of Nt) {
|
|
2131
|
+
const t = e.startsWith("mouse") || e.startsWith("pointer") || e.startsWith("touch") ? this._service.mouseEventHandler.bind(this._service) : e.startsWith("key") ? this._service.keyEventHandler.bind(this._service) : e === "resize" ? this._service.uiEventHandler.bind(this._service) : e === "wheel" ? this._service.wheelEventHandler.bind(this._service) : this._service.preventDefaultHandler.bind(this._service);
|
|
2132
|
+
this[`${e}$$`] = new Ft(), _n(
|
|
2133
|
+
e === "resize" ? window : this._service.canvas,
|
|
2134
|
+
e
|
|
2121
2135
|
).pipe(
|
|
2122
2136
|
// @ts-ignore
|
|
2123
|
-
be(
|
|
2124
|
-
|
|
2125
|
-
)
|
|
2126
|
-
|
|
2127
|
-
|
|
2137
|
+
be(t.bind(this)),
|
|
2138
|
+
jt((n) => !(e === "keydown" && !n))
|
|
2139
|
+
).subscribe((n) => {
|
|
2140
|
+
this[`${e}$$`].next(
|
|
2141
|
+
n
|
|
2142
|
+
);
|
|
2143
|
+
}), this[`${e}$`] = this[`${e}$$`].asObservable(), this[`${e}$`].subscribe((n) => {
|
|
2144
|
+
var r, o, i;
|
|
2145
|
+
(o = (r = this._service.thread) == null ? void 0 : r[e]) == null || o.call(r, n), (i = s == null ? void 0 : s[e]) == null || i.call(s, n);
|
|
2128
2146
|
});
|
|
2129
2147
|
}
|
|
2130
2148
|
}
|
|
2131
2149
|
};
|
|
2132
|
-
|
|
2150
|
+
Je = ss([
|
|
2133
2151
|
ne(re.ContainerScoped),
|
|
2134
|
-
is(0, P(
|
|
2135
|
-
],
|
|
2136
|
-
function
|
|
2152
|
+
is(0, P(Ee))
|
|
2153
|
+
], Je);
|
|
2154
|
+
function kt(s, e) {
|
|
2137
2155
|
if (e === vn)
|
|
2138
2156
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), s;
|
|
2139
|
-
if (e === Ke || e ===
|
|
2157
|
+
if (e === Ke || e === Ut) {
|
|
2140
2158
|
let t = s.getIndex();
|
|
2141
2159
|
if (t === null) {
|
|
2142
2160
|
const i = [], a = s.getAttribute("position");
|
|
@@ -2161,7 +2179,12 @@ function xt(s, e) {
|
|
|
2161
2179
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), s;
|
|
2162
2180
|
}
|
|
2163
2181
|
const Ue = /* @__PURE__ */ new WeakMap();
|
|
2164
|
-
class
|
|
2182
|
+
class sn extends Bt {
|
|
2183
|
+
/**
|
|
2184
|
+
* Constructs a new Draco loader.
|
|
2185
|
+
*
|
|
2186
|
+
* @param {LoadingManager} [manager] - The loading manager.
|
|
2187
|
+
*/
|
|
2165
2188
|
constructor(e) {
|
|
2166
2189
|
super(e), this.decoderPath = "", this.decoderConfig = {}, this.decoderBinary = null, this.decoderPending = null, this.workerLimit = 4, this.workerPool = [], this.workerNextTaskID = 1, this.workerSourceURL = "", this.defaultAttributeIDs = {
|
|
2167
2190
|
position: "POSITION",
|
|
@@ -2175,26 +2198,62 @@ class nn extends Ht {
|
|
|
2175
2198
|
uv: "Float32Array"
|
|
2176
2199
|
};
|
|
2177
2200
|
}
|
|
2201
|
+
/**
|
|
2202
|
+
* Provides configuration for the decoder libraries. Configuration cannot be changed after decoding begins.
|
|
2203
|
+
*
|
|
2204
|
+
* @param {string} path - The decoder path.
|
|
2205
|
+
* @return {DRACOLoader} A reference to this loader.
|
|
2206
|
+
*/
|
|
2178
2207
|
setDecoderPath(e) {
|
|
2179
2208
|
return this.decoderPath = e, this;
|
|
2180
2209
|
}
|
|
2210
|
+
/**
|
|
2211
|
+
* Provides configuration for the decoder libraries. Configuration cannot be changed after decoding begins.
|
|
2212
|
+
*
|
|
2213
|
+
* @param {{type:('js'|'wasm')}} config - The decoder config.
|
|
2214
|
+
* @return {DRACOLoader} A reference to this loader.
|
|
2215
|
+
*/
|
|
2181
2216
|
setDecoderConfig(e) {
|
|
2182
2217
|
return this.decoderConfig = e, this;
|
|
2183
2218
|
}
|
|
2219
|
+
/**
|
|
2220
|
+
* Sets the maximum number of Web Workers to be used during decoding.
|
|
2221
|
+
* A lower limit may be preferable if workers are also for other tasks in the application.
|
|
2222
|
+
*
|
|
2223
|
+
* @param {number} workerLimit - The worker limit.
|
|
2224
|
+
* @return {DRACOLoader} A reference to this loader.
|
|
2225
|
+
*/
|
|
2184
2226
|
setWorkerLimit(e) {
|
|
2185
2227
|
return this.workerLimit = e, this;
|
|
2186
2228
|
}
|
|
2229
|
+
/**
|
|
2230
|
+
* Starts loading from the given URL and passes the loaded Draco asset
|
|
2231
|
+
* to the `onLoad()` callback.
|
|
2232
|
+
*
|
|
2233
|
+
* @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
|
|
2234
|
+
* @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished.
|
|
2235
|
+
* @param {onProgressCallback} onProgress - Executed while the loading is in progress.
|
|
2236
|
+
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
2237
|
+
*/
|
|
2187
2238
|
load(e, t, n, r) {
|
|
2188
2239
|
const o = new Te(this.manager);
|
|
2189
2240
|
o.setPath(this.path), o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(e, (i) => {
|
|
2190
2241
|
this.parse(i, t, r);
|
|
2191
2242
|
}, n, r);
|
|
2192
2243
|
}
|
|
2244
|
+
/**
|
|
2245
|
+
* Parses the given Draco data.
|
|
2246
|
+
*
|
|
2247
|
+
* @param {ArrayBuffer} buffer - The raw Draco data as an array buffer.
|
|
2248
|
+
* @param {function(BufferGeometry)} onLoad - Executed when the loading/parsing process has been finished.
|
|
2249
|
+
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
2250
|
+
*/
|
|
2193
2251
|
parse(e, t, n = () => {
|
|
2194
2252
|
}) {
|
|
2195
2253
|
this.decodeDracoFile(e, t, null, null, G, n).catch(n);
|
|
2196
2254
|
}
|
|
2197
|
-
|
|
2255
|
+
//
|
|
2256
|
+
decodeDracoFile(e, t, n, r, o = D, i = () => {
|
|
2198
2257
|
}) {
|
|
2199
2258
|
const a = {
|
|
2200
2259
|
attributeIDs: n || this.defaultAttributeIDs,
|
|
@@ -2227,7 +2286,7 @@ class nn extends Ht {
|
|
|
2227
2286
|
}), a;
|
|
2228
2287
|
}
|
|
2229
2288
|
_createGeometry(e) {
|
|
2230
|
-
const t = new
|
|
2289
|
+
const t = new Gt();
|
|
2231
2290
|
e.index && t.setIndex(new fe(e.index.array, 1));
|
|
2232
2291
|
for (let n = 0; n < e.attributes.length; n++) {
|
|
2233
2292
|
const r = e.attributes[n], o = r.name, i = r.array, a = r.itemSize, c = new fe(i, a);
|
|
@@ -2239,7 +2298,7 @@ class nn extends Ht {
|
|
|
2239
2298
|
if (t !== G) return;
|
|
2240
2299
|
const n = new W();
|
|
2241
2300
|
for (let r = 0, o = e.count; r < o; r++)
|
|
2242
|
-
n.fromBufferAttribute(e, r), qe.
|
|
2301
|
+
n.fromBufferAttribute(e, r), qe.colorSpaceToWorking(n, G), e.setXYZ(r, n.r, n.g, n.b);
|
|
2243
2302
|
}
|
|
2244
2303
|
_loadLibrary(e, t) {
|
|
2245
2304
|
const n = new Te(this.manager);
|
|
@@ -2321,7 +2380,7 @@ function os() {
|
|
|
2321
2380
|
e.then((u) => {
|
|
2322
2381
|
const l = u.draco, f = new l.Decoder();
|
|
2323
2382
|
try {
|
|
2324
|
-
const h = t(l, f, new Int8Array(c), d), w = h.attributes.map((
|
|
2383
|
+
const h = t(l, f, new Int8Array(c), d), w = h.attributes.map((E) => E.array.buffer);
|
|
2325
2384
|
h.index && w.push(h.index.array.buffer), self.postMessage({ type: "decode", id: a.id, geometry: h }, w);
|
|
2326
2385
|
} catch (h) {
|
|
2327
2386
|
console.error(h), self.postMessage({ type: "error", id: a.id, error: h.message });
|
|
@@ -2344,20 +2403,20 @@ function os() {
|
|
|
2344
2403
|
throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
|
|
2345
2404
|
if (!h.ok() || f.ptr === 0)
|
|
2346
2405
|
throw new Error("THREE.DRACOLoader: Decoding failed: " + h.error_msg());
|
|
2347
|
-
const
|
|
2406
|
+
const E = { index: null, attributes: [] };
|
|
2348
2407
|
for (const T in u) {
|
|
2349
2408
|
const p = self[l[T]];
|
|
2350
|
-
let
|
|
2409
|
+
let g, m;
|
|
2351
2410
|
if (d.useUniqueIDs)
|
|
2352
|
-
|
|
2411
|
+
m = u[T], g = a.GetAttributeByUniqueId(f, m);
|
|
2353
2412
|
else {
|
|
2354
|
-
if (
|
|
2355
|
-
|
|
2413
|
+
if (m = a.GetAttributeId(f, i[u[T]]), m === -1) continue;
|
|
2414
|
+
g = a.GetAttribute(f, m);
|
|
2356
2415
|
}
|
|
2357
|
-
const
|
|
2358
|
-
T === "color" && (
|
|
2416
|
+
const b = r(i, a, f, T, p, g);
|
|
2417
|
+
T === "color" && (b.vertexColorSpace = d.vertexColorSpace), E.attributes.push(b);
|
|
2359
2418
|
}
|
|
2360
|
-
return w === i.TRIANGULAR_MESH && (
|
|
2419
|
+
return w === i.TRIANGULAR_MESH && (E.index = n(i, a, f)), i.destroy(f), E;
|
|
2361
2420
|
}
|
|
2362
2421
|
function n(i, a, c) {
|
|
2363
2422
|
const u = c.num_faces() * 3, l = u * 4, f = i._malloc(l);
|
|
@@ -2366,12 +2425,12 @@ function os() {
|
|
|
2366
2425
|
return i._free(f), { array: h, itemSize: 1 };
|
|
2367
2426
|
}
|
|
2368
2427
|
function r(i, a, c, d, u, l) {
|
|
2369
|
-
const f = l.num_components(), w = c.num_points() * f,
|
|
2370
|
-
a.GetAttributeDataArrayForAllPoints(c, l, T,
|
|
2371
|
-
const
|
|
2428
|
+
const f = l.num_components(), w = c.num_points() * f, E = w * u.BYTES_PER_ELEMENT, T = o(i, u), p = i._malloc(E);
|
|
2429
|
+
a.GetAttributeDataArrayForAllPoints(c, l, T, E, p);
|
|
2430
|
+
const g = new u(i.HEAPF32.buffer, p, w).slice();
|
|
2372
2431
|
return i._free(p), {
|
|
2373
2432
|
name: d,
|
|
2374
|
-
array:
|
|
2433
|
+
array: g,
|
|
2375
2434
|
itemSize: f
|
|
2376
2435
|
};
|
|
2377
2436
|
}
|
|
@@ -2394,7 +2453,12 @@ function os() {
|
|
|
2394
2453
|
}
|
|
2395
2454
|
}
|
|
2396
2455
|
}
|
|
2397
|
-
class as extends
|
|
2456
|
+
class as extends Bt {
|
|
2457
|
+
/**
|
|
2458
|
+
* Constructs a new glTF loader.
|
|
2459
|
+
*
|
|
2460
|
+
* @param {LoadingManager} [manager] - The loading manager.
|
|
2461
|
+
*/
|
|
2398
2462
|
constructor(e) {
|
|
2399
2463
|
super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
|
|
2400
2464
|
return new fs(t);
|
|
@@ -2402,10 +2466,10 @@ class as extends Ht {
|
|
|
2402
2466
|
return new hs(t);
|
|
2403
2467
|
}), this.register(function(t) {
|
|
2404
2468
|
return new vs(t);
|
|
2405
|
-
}), this.register(function(t) {
|
|
2406
|
-
return new As(t);
|
|
2407
2469
|
}), this.register(function(t) {
|
|
2408
2470
|
return new Es(t);
|
|
2471
|
+
}), this.register(function(t) {
|
|
2472
|
+
return new Cs(t);
|
|
2409
2473
|
}), this.register(function(t) {
|
|
2410
2474
|
return new ms(t);
|
|
2411
2475
|
}), this.register(function(t) {
|
|
@@ -2426,12 +2490,21 @@ class as extends Ht {
|
|
|
2426
2490
|
return new Ts(t);
|
|
2427
2491
|
}), this.register(function(t) {
|
|
2428
2492
|
return new us(t);
|
|
2429
|
-
}), this.register(function(t) {
|
|
2430
|
-
return new Cs(t);
|
|
2431
2493
|
}), this.register(function(t) {
|
|
2432
2494
|
return new Rs(t);
|
|
2495
|
+
}), this.register(function(t) {
|
|
2496
|
+
return new xs(t);
|
|
2433
2497
|
});
|
|
2434
2498
|
}
|
|
2499
|
+
/**
|
|
2500
|
+
* Starts loading from the given URL and passes the loaded glTF asset
|
|
2501
|
+
* to the `onLoad()` callback.
|
|
2502
|
+
*
|
|
2503
|
+
* @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
|
|
2504
|
+
* @param {function(GLTFLoader~LoadObject)} onLoad - Executed when the loading process has been finished.
|
|
2505
|
+
* @param {onProgressCallback} onProgress - Executed while the loading is in progress.
|
|
2506
|
+
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
2507
|
+
*/
|
|
2435
2508
|
load(e, t, n, r) {
|
|
2436
2509
|
const o = this;
|
|
2437
2510
|
let i;
|
|
@@ -2456,35 +2529,78 @@ class as extends Ht {
|
|
|
2456
2529
|
}
|
|
2457
2530
|
}, n, a);
|
|
2458
2531
|
}
|
|
2532
|
+
/**
|
|
2533
|
+
* Sets the given Draco loader to this loader. Required for decoding assets
|
|
2534
|
+
* compressed with the `KHR_draco_mesh_compression` extension.
|
|
2535
|
+
*
|
|
2536
|
+
* @param {DRACOLoader} dracoLoader - The Draco loader to set.
|
|
2537
|
+
* @return {GLTFLoader} A reference to this loader.
|
|
2538
|
+
*/
|
|
2459
2539
|
setDRACOLoader(e) {
|
|
2460
2540
|
return this.dracoLoader = e, this;
|
|
2461
2541
|
}
|
|
2542
|
+
/**
|
|
2543
|
+
* Sets the given KTX2 loader to this loader. Required for loading KTX2
|
|
2544
|
+
* compressed textures.
|
|
2545
|
+
*
|
|
2546
|
+
* @param {KTX2Loader} ktx2Loader - The KTX2 loader to set.
|
|
2547
|
+
* @return {GLTFLoader} A reference to this loader.
|
|
2548
|
+
*/
|
|
2462
2549
|
setKTX2Loader(e) {
|
|
2463
2550
|
return this.ktx2Loader = e, this;
|
|
2464
2551
|
}
|
|
2552
|
+
/**
|
|
2553
|
+
* Sets the given meshopt decoder. Required for decoding assets
|
|
2554
|
+
* compressed with the `EXT_meshopt_compression` extension.
|
|
2555
|
+
*
|
|
2556
|
+
* @param {Object} meshoptDecoder - The meshopt decoder to set.
|
|
2557
|
+
* @return {GLTFLoader} A reference to this loader.
|
|
2558
|
+
*/
|
|
2465
2559
|
setMeshoptDecoder(e) {
|
|
2466
2560
|
return this.meshoptDecoder = e, this;
|
|
2467
2561
|
}
|
|
2562
|
+
/**
|
|
2563
|
+
* Registers a plugin callback. This API is internally used to implement the various
|
|
2564
|
+
* glTF extensions but can also used by third-party code to add additional logic
|
|
2565
|
+
* to the loader.
|
|
2566
|
+
*
|
|
2567
|
+
* @param {function(parser:GLTFParser)} callback - The callback function to register.
|
|
2568
|
+
* @return {GLTFLoader} A reference to this loader.
|
|
2569
|
+
*/
|
|
2468
2570
|
register(e) {
|
|
2469
2571
|
return this.pluginCallbacks.indexOf(e) === -1 && this.pluginCallbacks.push(e), this;
|
|
2470
2572
|
}
|
|
2573
|
+
/**
|
|
2574
|
+
* Unregisters a plugin callback.
|
|
2575
|
+
*
|
|
2576
|
+
* @param {Function} callback - The callback function to unregister.
|
|
2577
|
+
* @return {GLTFLoader} A reference to this loader.
|
|
2578
|
+
*/
|
|
2471
2579
|
unregister(e) {
|
|
2472
2580
|
return this.pluginCallbacks.indexOf(e) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e), 1), this;
|
|
2473
2581
|
}
|
|
2582
|
+
/**
|
|
2583
|
+
* Parses the given FBX data and returns the resulting group.
|
|
2584
|
+
*
|
|
2585
|
+
* @param {string|ArrayBuffer} data - The raw glTF data.
|
|
2586
|
+
* @param {string} path - The URL base path.
|
|
2587
|
+
* @param {function(GLTFLoader~LoadObject)} onLoad - Executed when the loading process has been finished.
|
|
2588
|
+
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
2589
|
+
*/
|
|
2474
2590
|
parse(e, t, n, r) {
|
|
2475
2591
|
let o;
|
|
2476
2592
|
const i = {}, a = {}, c = new TextDecoder();
|
|
2477
2593
|
if (typeof e == "string")
|
|
2478
2594
|
o = JSON.parse(e);
|
|
2479
2595
|
else if (e instanceof ArrayBuffer)
|
|
2480
|
-
if (c.decode(new Uint8Array(e, 0, 4)) ===
|
|
2596
|
+
if (c.decode(new Uint8Array(e, 0, 4)) === on) {
|
|
2481
2597
|
try {
|
|
2482
|
-
i[
|
|
2598
|
+
i[x.KHR_BINARY_GLTF] = new Ss(e);
|
|
2483
2599
|
} catch (l) {
|
|
2484
2600
|
r && r(l);
|
|
2485
2601
|
return;
|
|
2486
2602
|
}
|
|
2487
|
-
o = JSON.parse(i[
|
|
2603
|
+
o = JSON.parse(i[x.KHR_BINARY_GLTF].content);
|
|
2488
2604
|
} else
|
|
2489
2605
|
o = JSON.parse(c.decode(e));
|
|
2490
2606
|
else
|
|
@@ -2510,16 +2626,16 @@ class as extends Ht {
|
|
|
2510
2626
|
for (let u = 0; u < o.extensionsUsed.length; ++u) {
|
|
2511
2627
|
const l = o.extensionsUsed[u], f = o.extensionsRequired || [];
|
|
2512
2628
|
switch (l) {
|
|
2513
|
-
case
|
|
2629
|
+
case x.KHR_MATERIALS_UNLIT:
|
|
2514
2630
|
i[l] = new ls();
|
|
2515
2631
|
break;
|
|
2516
|
-
case
|
|
2517
|
-
i[l] = new
|
|
2632
|
+
case x.KHR_DRACO_MESH_COMPRESSION:
|
|
2633
|
+
i[l] = new ks(o, this.dracoLoader);
|
|
2518
2634
|
break;
|
|
2519
|
-
case
|
|
2520
|
-
i[l] = new
|
|
2635
|
+
case x.KHR_TEXTURE_TRANSFORM:
|
|
2636
|
+
i[l] = new As();
|
|
2521
2637
|
break;
|
|
2522
|
-
case
|
|
2638
|
+
case x.KHR_MESH_QUANTIZATION:
|
|
2523
2639
|
i[l] = new Ls();
|
|
2524
2640
|
break;
|
|
2525
2641
|
default:
|
|
@@ -2528,6 +2644,14 @@ class as extends Ht {
|
|
|
2528
2644
|
}
|
|
2529
2645
|
d.setExtensions(i), d.setPlugins(a), d.parse(n, r);
|
|
2530
2646
|
}
|
|
2647
|
+
/**
|
|
2648
|
+
* Async version of {@link GLTFLoader#parse}.
|
|
2649
|
+
*
|
|
2650
|
+
* @async
|
|
2651
|
+
* @param {string|ArrayBuffer} data - The raw glTF data.
|
|
2652
|
+
* @param {string} path - The URL base path.
|
|
2653
|
+
* @return {Promise<GLTFLoader~LoadObject>} A Promise that resolves with the loaded glTF when the parsing has been finished.
|
|
2654
|
+
*/
|
|
2531
2655
|
parseAsync(e, t) {
|
|
2532
2656
|
const n = this;
|
|
2533
2657
|
return new Promise(function(r, o) {
|
|
@@ -2552,7 +2676,7 @@ function cs() {
|
|
|
2552
2676
|
}
|
|
2553
2677
|
};
|
|
2554
2678
|
}
|
|
2555
|
-
const
|
|
2679
|
+
const x = {
|
|
2556
2680
|
KHR_BINARY_GLTF: "KHR_binary_glTF",
|
|
2557
2681
|
KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
|
|
2558
2682
|
KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
|
|
@@ -2578,7 +2702,7 @@ const C = {
|
|
|
2578
2702
|
};
|
|
2579
2703
|
class us {
|
|
2580
2704
|
constructor(e) {
|
|
2581
|
-
this.parser = e, this.name =
|
|
2705
|
+
this.parser = e, this.name = x.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
|
|
2582
2706
|
}
|
|
2583
2707
|
_markDefs() {
|
|
2584
2708
|
const e = this.parser, t = this.parser.json.nodes || [];
|
|
@@ -2594,22 +2718,22 @@ class us {
|
|
|
2594
2718
|
const o = t.json, c = ((o.extensions && o.extensions[this.name] || {}).lights || [])[e];
|
|
2595
2719
|
let d;
|
|
2596
2720
|
const u = new W(16777215);
|
|
2597
|
-
c.color !== void 0 && u.setRGB(c.color[0], c.color[1], c.color[2],
|
|
2721
|
+
c.color !== void 0 && u.setRGB(c.color[0], c.color[1], c.color[2], D);
|
|
2598
2722
|
const l = c.range !== void 0 ? c.range : 0;
|
|
2599
2723
|
switch (c.type) {
|
|
2600
2724
|
case "directional":
|
|
2601
|
-
d = new
|
|
2725
|
+
d = new Rn(u), d.target.position.set(0, 0, -1), d.add(d.target);
|
|
2602
2726
|
break;
|
|
2603
2727
|
case "point":
|
|
2604
|
-
d = new
|
|
2728
|
+
d = new Cn(u), d.distance = l;
|
|
2605
2729
|
break;
|
|
2606
2730
|
case "spot":
|
|
2607
|
-
d = new
|
|
2731
|
+
d = new En(u), d.distance = l, c.spot = c.spot || {}, c.spot.innerConeAngle = c.spot.innerConeAngle !== void 0 ? c.spot.innerConeAngle : 0, c.spot.outerConeAngle = c.spot.outerConeAngle !== void 0 ? c.spot.outerConeAngle : Math.PI / 4, d.angle = c.spot.outerConeAngle, d.penumbra = 1 - c.spot.innerConeAngle / c.spot.outerConeAngle, d.target.position.set(0, 0, -1), d.add(d.target);
|
|
2608
2732
|
break;
|
|
2609
2733
|
default:
|
|
2610
2734
|
throw new Error("THREE.GLTFLoader: Unexpected light type: " + c.type);
|
|
2611
2735
|
}
|
|
2612
|
-
return d.position.set(0, 0, 0),
|
|
2736
|
+
return d.position.set(0, 0, 0), I(d, c), c.intensity !== void 0 && (d.intensity = c.intensity), d.name = t.createUniqueName(c.name || "light_" + e), r = Promise.resolve(d), t.cache.add(n, r), r;
|
|
2613
2737
|
}
|
|
2614
2738
|
getDependency(e, t) {
|
|
2615
2739
|
if (e === "light")
|
|
@@ -2624,7 +2748,7 @@ class us {
|
|
|
2624
2748
|
}
|
|
2625
2749
|
class ls {
|
|
2626
2750
|
constructor() {
|
|
2627
|
-
this.name =
|
|
2751
|
+
this.name = x.KHR_MATERIALS_UNLIT;
|
|
2628
2752
|
}
|
|
2629
2753
|
getMaterialType() {
|
|
2630
2754
|
return le;
|
|
@@ -2636,7 +2760,7 @@ class ls {
|
|
|
2636
2760
|
if (o) {
|
|
2637
2761
|
if (Array.isArray(o.baseColorFactor)) {
|
|
2638
2762
|
const i = o.baseColorFactor;
|
|
2639
|
-
e.color.setRGB(i[0], i[1], i[2],
|
|
2763
|
+
e.color.setRGB(i[0], i[1], i[2], D), e.opacity = i[3];
|
|
2640
2764
|
}
|
|
2641
2765
|
o.baseColorTexture !== void 0 && r.push(n.assignTexture(e, "map", o.baseColorTexture, G));
|
|
2642
2766
|
}
|
|
@@ -2645,7 +2769,7 @@ class ls {
|
|
|
2645
2769
|
}
|
|
2646
2770
|
class ds {
|
|
2647
2771
|
constructor(e) {
|
|
2648
|
-
this.parser = e, this.name =
|
|
2772
|
+
this.parser = e, this.name = x.KHR_MATERIALS_EMISSIVE_STRENGTH;
|
|
2649
2773
|
}
|
|
2650
2774
|
extendMaterialParams(e, t) {
|
|
2651
2775
|
const r = this.parser.json.materials[e];
|
|
@@ -2657,11 +2781,11 @@ class ds {
|
|
|
2657
2781
|
}
|
|
2658
2782
|
class fs {
|
|
2659
2783
|
constructor(e) {
|
|
2660
|
-
this.parser = e, this.name =
|
|
2784
|
+
this.parser = e, this.name = x.KHR_MATERIALS_CLEARCOAT;
|
|
2661
2785
|
}
|
|
2662
2786
|
getMaterialType(e) {
|
|
2663
2787
|
const n = this.parser.json.materials[e];
|
|
2664
|
-
return !n.extensions || !n.extensions[this.name] ? null :
|
|
2788
|
+
return !n.extensions || !n.extensions[this.name] ? null : N;
|
|
2665
2789
|
}
|
|
2666
2790
|
extendMaterialParams(e, t) {
|
|
2667
2791
|
const n = this.parser, r = n.json.materials[e];
|
|
@@ -2670,18 +2794,18 @@ class fs {
|
|
|
2670
2794
|
const o = [], i = r.extensions[this.name];
|
|
2671
2795
|
if (i.clearcoatFactor !== void 0 && (t.clearcoat = i.clearcoatFactor), i.clearcoatTexture !== void 0 && o.push(n.assignTexture(t, "clearcoatMap", i.clearcoatTexture)), i.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = i.clearcoatRoughnessFactor), i.clearcoatRoughnessTexture !== void 0 && o.push(n.assignTexture(t, "clearcoatRoughnessMap", i.clearcoatRoughnessTexture)), i.clearcoatNormalTexture !== void 0 && (o.push(n.assignTexture(t, "clearcoatNormalMap", i.clearcoatNormalTexture)), i.clearcoatNormalTexture.scale !== void 0)) {
|
|
2672
2796
|
const a = i.clearcoatNormalTexture.scale;
|
|
2673
|
-
t.clearcoatNormalScale = new
|
|
2797
|
+
t.clearcoatNormalScale = new Wt(a, a);
|
|
2674
2798
|
}
|
|
2675
2799
|
return Promise.all(o);
|
|
2676
2800
|
}
|
|
2677
2801
|
}
|
|
2678
2802
|
class hs {
|
|
2679
2803
|
constructor(e) {
|
|
2680
|
-
this.parser = e, this.name =
|
|
2804
|
+
this.parser = e, this.name = x.KHR_MATERIALS_DISPERSION;
|
|
2681
2805
|
}
|
|
2682
2806
|
getMaterialType(e) {
|
|
2683
2807
|
const n = this.parser.json.materials[e];
|
|
2684
|
-
return !n.extensions || !n.extensions[this.name] ? null :
|
|
2808
|
+
return !n.extensions || !n.extensions[this.name] ? null : N;
|
|
2685
2809
|
}
|
|
2686
2810
|
extendMaterialParams(e, t) {
|
|
2687
2811
|
const r = this.parser.json.materials[e];
|
|
@@ -2693,11 +2817,11 @@ class hs {
|
|
|
2693
2817
|
}
|
|
2694
2818
|
class ps {
|
|
2695
2819
|
constructor(e) {
|
|
2696
|
-
this.parser = e, this.name =
|
|
2820
|
+
this.parser = e, this.name = x.KHR_MATERIALS_IRIDESCENCE;
|
|
2697
2821
|
}
|
|
2698
2822
|
getMaterialType(e) {
|
|
2699
2823
|
const n = this.parser.json.materials[e];
|
|
2700
|
-
return !n.extensions || !n.extensions[this.name] ? null :
|
|
2824
|
+
return !n.extensions || !n.extensions[this.name] ? null : N;
|
|
2701
2825
|
}
|
|
2702
2826
|
extendMaterialParams(e, t) {
|
|
2703
2827
|
const n = this.parser, r = n.json.materials[e];
|
|
@@ -2709,11 +2833,11 @@ class ps {
|
|
|
2709
2833
|
}
|
|
2710
2834
|
class ms {
|
|
2711
2835
|
constructor(e) {
|
|
2712
|
-
this.parser = e, this.name =
|
|
2836
|
+
this.parser = e, this.name = x.KHR_MATERIALS_SHEEN;
|
|
2713
2837
|
}
|
|
2714
2838
|
getMaterialType(e) {
|
|
2715
2839
|
const n = this.parser.json.materials[e];
|
|
2716
|
-
return !n.extensions || !n.extensions[this.name] ? null :
|
|
2840
|
+
return !n.extensions || !n.extensions[this.name] ? null : N;
|
|
2717
2841
|
}
|
|
2718
2842
|
extendMaterialParams(e, t) {
|
|
2719
2843
|
const n = this.parser, r = n.json.materials[e];
|
|
@@ -2724,18 +2848,18 @@ class ms {
|
|
|
2724
2848
|
const i = r.extensions[this.name];
|
|
2725
2849
|
if (i.sheenColorFactor !== void 0) {
|
|
2726
2850
|
const a = i.sheenColorFactor;
|
|
2727
|
-
t.sheenColor.setRGB(a[0], a[1], a[2],
|
|
2851
|
+
t.sheenColor.setRGB(a[0], a[1], a[2], D);
|
|
2728
2852
|
}
|
|
2729
2853
|
return i.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = i.sheenRoughnessFactor), i.sheenColorTexture !== void 0 && o.push(n.assignTexture(t, "sheenColorMap", i.sheenColorTexture, G)), i.sheenRoughnessTexture !== void 0 && o.push(n.assignTexture(t, "sheenRoughnessMap", i.sheenRoughnessTexture)), Promise.all(o);
|
|
2730
2854
|
}
|
|
2731
2855
|
}
|
|
2732
2856
|
class gs {
|
|
2733
2857
|
constructor(e) {
|
|
2734
|
-
this.parser = e, this.name =
|
|
2858
|
+
this.parser = e, this.name = x.KHR_MATERIALS_TRANSMISSION;
|
|
2735
2859
|
}
|
|
2736
2860
|
getMaterialType(e) {
|
|
2737
2861
|
const n = this.parser.json.materials[e];
|
|
2738
|
-
return !n.extensions || !n.extensions[this.name] ? null :
|
|
2862
|
+
return !n.extensions || !n.extensions[this.name] ? null : N;
|
|
2739
2863
|
}
|
|
2740
2864
|
extendMaterialParams(e, t) {
|
|
2741
2865
|
const n = this.parser, r = n.json.materials[e];
|
|
@@ -2747,11 +2871,11 @@ class gs {
|
|
|
2747
2871
|
}
|
|
2748
2872
|
class _s {
|
|
2749
2873
|
constructor(e) {
|
|
2750
|
-
this.parser = e, this.name =
|
|
2874
|
+
this.parser = e, this.name = x.KHR_MATERIALS_VOLUME;
|
|
2751
2875
|
}
|
|
2752
2876
|
getMaterialType(e) {
|
|
2753
2877
|
const n = this.parser.json.materials[e];
|
|
2754
|
-
return !n.extensions || !n.extensions[this.name] ? null :
|
|
2878
|
+
return !n.extensions || !n.extensions[this.name] ? null : N;
|
|
2755
2879
|
}
|
|
2756
2880
|
extendMaterialParams(e, t) {
|
|
2757
2881
|
const n = this.parser, r = n.json.materials[e];
|
|
@@ -2760,16 +2884,16 @@ class _s {
|
|
|
2760
2884
|
const o = [], i = r.extensions[this.name];
|
|
2761
2885
|
t.thickness = i.thicknessFactor !== void 0 ? i.thicknessFactor : 0, i.thicknessTexture !== void 0 && o.push(n.assignTexture(t, "thicknessMap", i.thicknessTexture)), t.attenuationDistance = i.attenuationDistance || 1 / 0;
|
|
2762
2886
|
const a = i.attenuationColor || [1, 1, 1];
|
|
2763
|
-
return t.attenuationColor = new W().setRGB(a[0], a[1], a[2],
|
|
2887
|
+
return t.attenuationColor = new W().setRGB(a[0], a[1], a[2], D), Promise.all(o);
|
|
2764
2888
|
}
|
|
2765
2889
|
}
|
|
2766
2890
|
class bs {
|
|
2767
2891
|
constructor(e) {
|
|
2768
|
-
this.parser = e, this.name =
|
|
2892
|
+
this.parser = e, this.name = x.KHR_MATERIALS_IOR;
|
|
2769
2893
|
}
|
|
2770
2894
|
getMaterialType(e) {
|
|
2771
2895
|
const n = this.parser.json.materials[e];
|
|
2772
|
-
return !n.extensions || !n.extensions[this.name] ? null :
|
|
2896
|
+
return !n.extensions || !n.extensions[this.name] ? null : N;
|
|
2773
2897
|
}
|
|
2774
2898
|
extendMaterialParams(e, t) {
|
|
2775
2899
|
const r = this.parser.json.materials[e];
|
|
@@ -2781,11 +2905,11 @@ class bs {
|
|
|
2781
2905
|
}
|
|
2782
2906
|
class ys {
|
|
2783
2907
|
constructor(e) {
|
|
2784
|
-
this.parser = e, this.name =
|
|
2908
|
+
this.parser = e, this.name = x.KHR_MATERIALS_SPECULAR;
|
|
2785
2909
|
}
|
|
2786
2910
|
getMaterialType(e) {
|
|
2787
2911
|
const n = this.parser.json.materials[e];
|
|
2788
|
-
return !n.extensions || !n.extensions[this.name] ? null :
|
|
2912
|
+
return !n.extensions || !n.extensions[this.name] ? null : N;
|
|
2789
2913
|
}
|
|
2790
2914
|
extendMaterialParams(e, t) {
|
|
2791
2915
|
const n = this.parser, r = n.json.materials[e];
|
|
@@ -2794,16 +2918,16 @@ class ys {
|
|
|
2794
2918
|
const o = [], i = r.extensions[this.name];
|
|
2795
2919
|
t.specularIntensity = i.specularFactor !== void 0 ? i.specularFactor : 1, i.specularTexture !== void 0 && o.push(n.assignTexture(t, "specularIntensityMap", i.specularTexture));
|
|
2796
2920
|
const a = i.specularColorFactor || [1, 1, 1];
|
|
2797
|
-
return t.specularColor = new W().setRGB(a[0], a[1], a[2],
|
|
2921
|
+
return t.specularColor = new W().setRGB(a[0], a[1], a[2], D), i.specularColorTexture !== void 0 && o.push(n.assignTexture(t, "specularColorMap", i.specularColorTexture, G)), Promise.all(o);
|
|
2798
2922
|
}
|
|
2799
2923
|
}
|
|
2800
2924
|
class Ts {
|
|
2801
2925
|
constructor(e) {
|
|
2802
|
-
this.parser = e, this.name =
|
|
2926
|
+
this.parser = e, this.name = x.EXT_MATERIALS_BUMP;
|
|
2803
2927
|
}
|
|
2804
2928
|
getMaterialType(e) {
|
|
2805
2929
|
const n = this.parser.json.materials[e];
|
|
2806
|
-
return !n.extensions || !n.extensions[this.name] ? null :
|
|
2930
|
+
return !n.extensions || !n.extensions[this.name] ? null : N;
|
|
2807
2931
|
}
|
|
2808
2932
|
extendMaterialParams(e, t) {
|
|
2809
2933
|
const n = this.parser, r = n.json.materials[e];
|
|
@@ -2815,11 +2939,11 @@ class Ts {
|
|
|
2815
2939
|
}
|
|
2816
2940
|
class ws {
|
|
2817
2941
|
constructor(e) {
|
|
2818
|
-
this.parser = e, this.name =
|
|
2942
|
+
this.parser = e, this.name = x.KHR_MATERIALS_ANISOTROPY;
|
|
2819
2943
|
}
|
|
2820
2944
|
getMaterialType(e) {
|
|
2821
2945
|
const n = this.parser.json.materials[e];
|
|
2822
|
-
return !n.extensions || !n.extensions[this.name] ? null :
|
|
2946
|
+
return !n.extensions || !n.extensions[this.name] ? null : N;
|
|
2823
2947
|
}
|
|
2824
2948
|
extendMaterialParams(e, t) {
|
|
2825
2949
|
const n = this.parser, r = n.json.materials[e];
|
|
@@ -2831,7 +2955,7 @@ class ws {
|
|
|
2831
2955
|
}
|
|
2832
2956
|
class vs {
|
|
2833
2957
|
constructor(e) {
|
|
2834
|
-
this.parser = e, this.name =
|
|
2958
|
+
this.parser = e, this.name = x.KHR_TEXTURE_BASISU;
|
|
2835
2959
|
}
|
|
2836
2960
|
loadTexture(e) {
|
|
2837
2961
|
const t = this.parser, n = t.json, r = n.textures[e];
|
|
@@ -2846,9 +2970,9 @@ class vs {
|
|
|
2846
2970
|
return t.loadTextureImage(e, o.source, i);
|
|
2847
2971
|
}
|
|
2848
2972
|
}
|
|
2849
|
-
class
|
|
2973
|
+
class Es {
|
|
2850
2974
|
constructor(e) {
|
|
2851
|
-
this.parser = e, this.name =
|
|
2975
|
+
this.parser = e, this.name = x.EXT_TEXTURE_WEBP;
|
|
2852
2976
|
}
|
|
2853
2977
|
loadTexture(e) {
|
|
2854
2978
|
const t = this.name, n = this.parser, r = n.json, o = r.textures[e];
|
|
@@ -2860,25 +2984,12 @@ class As {
|
|
|
2860
2984
|
const d = n.options.manager.getHandler(a.uri);
|
|
2861
2985
|
d !== null && (c = d);
|
|
2862
2986
|
}
|
|
2863
|
-
return
|
|
2864
|
-
if (d) return n.loadTextureImage(e, i.source, c);
|
|
2865
|
-
if (r.extensionsRequired && r.extensionsRequired.indexOf(t) >= 0)
|
|
2866
|
-
throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
|
|
2867
|
-
return n.loadTexture(e);
|
|
2868
|
-
});
|
|
2869
|
-
}
|
|
2870
|
-
detectSupport() {
|
|
2871
|
-
return this.isSupported || (this.isSupported = new Promise(function(e) {
|
|
2872
|
-
const t = new Image();
|
|
2873
|
-
t.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", t.onload = t.onerror = function() {
|
|
2874
|
-
e(t.height === 1);
|
|
2875
|
-
};
|
|
2876
|
-
})), this.isSupported;
|
|
2987
|
+
return n.loadTextureImage(e, i.source, c);
|
|
2877
2988
|
}
|
|
2878
2989
|
}
|
|
2879
|
-
class
|
|
2990
|
+
class Cs {
|
|
2880
2991
|
constructor(e) {
|
|
2881
|
-
this.parser = e, this.name =
|
|
2992
|
+
this.parser = e, this.name = x.EXT_TEXTURE_AVIF;
|
|
2882
2993
|
}
|
|
2883
2994
|
loadTexture(e) {
|
|
2884
2995
|
const t = this.name, n = this.parser, r = n.json, o = r.textures[e];
|
|
@@ -2890,25 +3001,12 @@ class Es {
|
|
|
2890
3001
|
const d = n.options.manager.getHandler(a.uri);
|
|
2891
3002
|
d !== null && (c = d);
|
|
2892
3003
|
}
|
|
2893
|
-
return
|
|
2894
|
-
if (d) return n.loadTextureImage(e, i.source, c);
|
|
2895
|
-
if (r.extensionsRequired && r.extensionsRequired.indexOf(t) >= 0)
|
|
2896
|
-
throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");
|
|
2897
|
-
return n.loadTexture(e);
|
|
2898
|
-
});
|
|
2899
|
-
}
|
|
2900
|
-
detectSupport() {
|
|
2901
|
-
return this.isSupported || (this.isSupported = new Promise(function(e) {
|
|
2902
|
-
const t = new Image();
|
|
2903
|
-
t.src = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=", t.onload = t.onerror = function() {
|
|
2904
|
-
e(t.height === 1);
|
|
2905
|
-
};
|
|
2906
|
-
})), this.isSupported;
|
|
3004
|
+
return n.loadTextureImage(e, i.source, c);
|
|
2907
3005
|
}
|
|
2908
3006
|
}
|
|
2909
|
-
class
|
|
3007
|
+
class Rs {
|
|
2910
3008
|
constructor(e) {
|
|
2911
|
-
this.name =
|
|
3009
|
+
this.name = x.EXT_MESHOPT_COMPRESSION, this.parser = e;
|
|
2912
3010
|
}
|
|
2913
3011
|
loadBufferView(e) {
|
|
2914
3012
|
const t = this.parser.json, n = t.bufferViews[e];
|
|
@@ -2932,9 +3030,9 @@ class Cs {
|
|
|
2932
3030
|
return null;
|
|
2933
3031
|
}
|
|
2934
3032
|
}
|
|
2935
|
-
class
|
|
3033
|
+
class xs {
|
|
2936
3034
|
constructor(e) {
|
|
2937
|
-
this.name =
|
|
3035
|
+
this.name = x.EXT_MESH_GPU_INSTANCING, this.parser = e;
|
|
2938
3036
|
}
|
|
2939
3037
|
createNodeMesh(e) {
|
|
2940
3038
|
const t = this.parser.json, n = t.nodes[e];
|
|
@@ -2950,30 +3048,30 @@ class Rs {
|
|
|
2950
3048
|
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((d) => {
|
|
2951
3049
|
const u = d.pop(), l = u.isGroup ? u.children : [u], f = d[0].count, h = [];
|
|
2952
3050
|
for (const w of l) {
|
|
2953
|
-
const
|
|
2954
|
-
for (let
|
|
2955
|
-
c.TRANSLATION && T.fromBufferAttribute(c.TRANSLATION,
|
|
2956
|
-
for (const
|
|
2957
|
-
if (
|
|
2958
|
-
const
|
|
2959
|
-
|
|
2960
|
-
} else
|
|
2961
|
-
|
|
3051
|
+
const E = new we(), T = new Z(), p = new $t(), g = new Z(1, 1, 1), m = new xn(w.geometry, w.material, f);
|
|
3052
|
+
for (let b = 0; b < f; b++)
|
|
3053
|
+
c.TRANSLATION && T.fromBufferAttribute(c.TRANSLATION, b), c.ROTATION && p.fromBufferAttribute(c.ROTATION, b), c.SCALE && g.fromBufferAttribute(c.SCALE, b), m.setMatrixAt(b, E.compose(T, p, g));
|
|
3054
|
+
for (const b in c)
|
|
3055
|
+
if (b === "_COLOR_0") {
|
|
3056
|
+
const _ = c[b];
|
|
3057
|
+
m.instanceColor = new Sn(_.array, _.itemSize, _.normalized);
|
|
3058
|
+
} else b !== "TRANSLATION" && b !== "ROTATION" && b !== "SCALE" && w.geometry.setAttribute(b, c[b]);
|
|
3059
|
+
zt.prototype.copy.call(m, w), this.parser.assignFinalMaterial(m), h.push(m);
|
|
2962
3060
|
}
|
|
2963
3061
|
return u.isGroup ? (u.clear(), u.add(...h), u) : h[0];
|
|
2964
3062
|
}));
|
|
2965
3063
|
}
|
|
2966
3064
|
}
|
|
2967
|
-
const
|
|
2968
|
-
class
|
|
3065
|
+
const on = "glTF", ue = 12, At = { JSON: 1313821514, BIN: 5130562 };
|
|
3066
|
+
class Ss {
|
|
2969
3067
|
constructor(e) {
|
|
2970
|
-
this.name =
|
|
3068
|
+
this.name = x.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
2971
3069
|
const t = new DataView(e, 0, ue), n = new TextDecoder();
|
|
2972
3070
|
if (this.header = {
|
|
2973
3071
|
magic: n.decode(new Uint8Array(e.slice(0, 4))),
|
|
2974
3072
|
version: t.getUint32(4, !0),
|
|
2975
3073
|
length: t.getUint32(8, !0)
|
|
2976
|
-
}, this.header.magic !==
|
|
3074
|
+
}, this.header.magic !== on)
|
|
2977
3075
|
throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
2978
3076
|
if (this.header.version < 2)
|
|
2979
3077
|
throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
@@ -2983,10 +3081,10 @@ class xs {
|
|
|
2983
3081
|
const a = o.getUint32(i, !0);
|
|
2984
3082
|
i += 4;
|
|
2985
3083
|
const c = o.getUint32(i, !0);
|
|
2986
|
-
if (i += 4, c ===
|
|
3084
|
+
if (i += 4, c === At.JSON) {
|
|
2987
3085
|
const d = new Uint8Array(e, ue + i, a);
|
|
2988
3086
|
this.content = n.decode(d);
|
|
2989
|
-
} else if (c ===
|
|
3087
|
+
} else if (c === At.BIN) {
|
|
2990
3088
|
const d = ue + i;
|
|
2991
3089
|
this.body = e.slice(d, d + a);
|
|
2992
3090
|
}
|
|
@@ -2996,20 +3094,20 @@ class xs {
|
|
|
2996
3094
|
throw new Error("THREE.GLTFLoader: JSON content not found.");
|
|
2997
3095
|
}
|
|
2998
3096
|
}
|
|
2999
|
-
class
|
|
3097
|
+
class ks {
|
|
3000
3098
|
constructor(e, t) {
|
|
3001
3099
|
if (!t)
|
|
3002
3100
|
throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
|
|
3003
|
-
this.name =
|
|
3101
|
+
this.name = x.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
|
|
3004
3102
|
}
|
|
3005
3103
|
decodePrimitive(e, t) {
|
|
3006
3104
|
const n = this.json, r = this.dracoLoader, o = e.extensions[this.name].bufferView, i = e.extensions[this.name].attributes, a = {}, c = {}, d = {};
|
|
3007
3105
|
for (const u in i) {
|
|
3008
|
-
const l =
|
|
3106
|
+
const l = Ze[u] || u.toLowerCase();
|
|
3009
3107
|
a[l] = i[u];
|
|
3010
3108
|
}
|
|
3011
3109
|
for (const u in e.attributes) {
|
|
3012
|
-
const l =
|
|
3110
|
+
const l = Ze[u] || u.toLowerCase();
|
|
3013
3111
|
if (i[u] !== void 0) {
|
|
3014
3112
|
const f = n.accessors[e.attributes[u]], h = ee[f.componentType];
|
|
3015
3113
|
d[l] = h.name, c[l] = f.normalized === !0;
|
|
@@ -3019,18 +3117,18 @@ class Ss {
|
|
|
3019
3117
|
return new Promise(function(l, f) {
|
|
3020
3118
|
r.decodeDracoFile(u, function(h) {
|
|
3021
3119
|
for (const w in h.attributes) {
|
|
3022
|
-
const
|
|
3023
|
-
T !== void 0 && (
|
|
3120
|
+
const E = h.attributes[w], T = c[w];
|
|
3121
|
+
T !== void 0 && (E.normalized = T);
|
|
3024
3122
|
}
|
|
3025
3123
|
l(h);
|
|
3026
|
-
}, a, d,
|
|
3124
|
+
}, a, d, D, f);
|
|
3027
3125
|
});
|
|
3028
3126
|
});
|
|
3029
3127
|
}
|
|
3030
3128
|
}
|
|
3031
|
-
class
|
|
3129
|
+
class As {
|
|
3032
3130
|
constructor() {
|
|
3033
|
-
this.name =
|
|
3131
|
+
this.name = x.KHR_TEXTURE_TRANSFORM;
|
|
3034
3132
|
}
|
|
3035
3133
|
extendTexture(e, t) {
|
|
3036
3134
|
return (t.texCoord === void 0 || t.texCoord === e.channel) && t.offset === void 0 && t.rotation === void 0 && t.scale === void 0 || (e = e.clone(), t.texCoord !== void 0 && (e.channel = t.texCoord), t.offset !== void 0 && e.offset.fromArray(t.offset), t.rotation !== void 0 && (e.rotation = t.rotation), t.scale !== void 0 && e.repeat.fromArray(t.scale), e.needsUpdate = !0), e;
|
|
@@ -3038,10 +3136,10 @@ class ks {
|
|
|
3038
3136
|
}
|
|
3039
3137
|
class Ls {
|
|
3040
3138
|
constructor() {
|
|
3041
|
-
this.name =
|
|
3139
|
+
this.name = x.KHR_MESH_QUANTIZATION;
|
|
3042
3140
|
}
|
|
3043
3141
|
}
|
|
3044
|
-
class
|
|
3142
|
+
class an extends nr {
|
|
3045
3143
|
constructor(e, t, n, r) {
|
|
3046
3144
|
super(e, t, n, r);
|
|
3047
3145
|
}
|
|
@@ -3052,16 +3150,16 @@ class sn extends nr {
|
|
|
3052
3150
|
return t;
|
|
3053
3151
|
}
|
|
3054
3152
|
interpolate_(e, t, n, r) {
|
|
3055
|
-
const o = this.resultBuffer, i = this.sampleValues, a = this.valueSize, c = a * 2, d = a * 3, u = r - t, l = (n - t) / u, f = l * l, h = f * l, w = e * d,
|
|
3056
|
-
for (let
|
|
3057
|
-
const
|
|
3058
|
-
o[
|
|
3153
|
+
const o = this.resultBuffer, i = this.sampleValues, a = this.valueSize, c = a * 2, d = a * 3, u = r - t, l = (n - t) / u, f = l * l, h = f * l, w = e * d, E = w - d, T = -2 * h + 3 * f, p = h - f, g = 1 - T, m = p - f + l;
|
|
3154
|
+
for (let b = 0; b !== a; b++) {
|
|
3155
|
+
const _ = i[E + b + a], y = i[E + b + c] * u, v = i[w + b + a], S = i[w + b] * u;
|
|
3156
|
+
o[b] = g * _ + m * y + T * v + p * S;
|
|
3059
3157
|
}
|
|
3060
3158
|
return o;
|
|
3061
3159
|
}
|
|
3062
3160
|
}
|
|
3063
|
-
const Ms = new
|
|
3064
|
-
class Ps extends
|
|
3161
|
+
const Ms = new $t();
|
|
3162
|
+
class Ps extends an {
|
|
3065
3163
|
interpolate_(e, t, n, r) {
|
|
3066
3164
|
const o = super.interpolate_(e, t, n, r);
|
|
3067
3165
|
return Ms.fromArray(o).normalize().toArray(o), o;
|
|
@@ -3094,17 +3192,17 @@ const M = {
|
|
|
3094
3192
|
5123: Uint16Array,
|
|
3095
3193
|
5125: Uint32Array,
|
|
3096
3194
|
5126: Float32Array
|
|
3097
|
-
},
|
|
3098
|
-
9728:
|
|
3099
|
-
9729:
|
|
3100
|
-
9984:
|
|
3195
|
+
}, Lt = {
|
|
3196
|
+
9728: Vt,
|
|
3197
|
+
9729: Ve,
|
|
3198
|
+
9984: qn,
|
|
3101
3199
|
9985: Vn,
|
|
3102
3200
|
9986: Xn,
|
|
3103
|
-
9987:
|
|
3104
|
-
},
|
|
3201
|
+
9987: qt
|
|
3202
|
+
}, Mt = {
|
|
3105
3203
|
33071: Qn,
|
|
3106
3204
|
33648: Yn,
|
|
3107
|
-
10497:
|
|
3205
|
+
10497: Xe
|
|
3108
3206
|
}, Be = {
|
|
3109
3207
|
SCALAR: 1,
|
|
3110
3208
|
VEC2: 2,
|
|
@@ -3113,7 +3211,7 @@ const M = {
|
|
|
3113
3211
|
MAT2: 4,
|
|
3114
3212
|
MAT3: 9,
|
|
3115
3213
|
MAT4: 16
|
|
3116
|
-
},
|
|
3214
|
+
}, Ze = {
|
|
3117
3215
|
POSITION: "position",
|
|
3118
3216
|
NORMAL: "normal",
|
|
3119
3217
|
TANGENT: "tangent",
|
|
@@ -3133,7 +3231,7 @@ const M = {
|
|
|
3133
3231
|
CUBICSPLINE: void 0,
|
|
3134
3232
|
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
|
|
3135
3233
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
3136
|
-
LINEAR:
|
|
3234
|
+
LINEAR: Qt,
|
|
3137
3235
|
STEP: Jn
|
|
3138
3236
|
}, Ge = {
|
|
3139
3237
|
OPAQUE: "OPAQUE",
|
|
@@ -3141,7 +3239,7 @@ const M = {
|
|
|
3141
3239
|
BLEND: "BLEND"
|
|
3142
3240
|
};
|
|
3143
3241
|
function Is(s) {
|
|
3144
|
-
return s.DefaultMaterial === void 0 && (s.DefaultMaterial = new
|
|
3242
|
+
return s.DefaultMaterial === void 0 && (s.DefaultMaterial = new Xt({
|
|
3145
3243
|
color: 16777215,
|
|
3146
3244
|
emissive: 0,
|
|
3147
3245
|
metalness: 1,
|
|
@@ -3155,7 +3253,7 @@ function Q(s, e, t) {
|
|
|
3155
3253
|
for (const n in t.extensions)
|
|
3156
3254
|
s[n] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[n] = t.extensions[n]);
|
|
3157
3255
|
}
|
|
3158
|
-
function
|
|
3256
|
+
function I(s, e) {
|
|
3159
3257
|
e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(s.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
|
|
3160
3258
|
}
|
|
3161
3259
|
function Ds(s, e, t) {
|
|
@@ -3206,7 +3304,7 @@ function Ns(s, e) {
|
|
|
3206
3304
|
}
|
|
3207
3305
|
function Fs(s) {
|
|
3208
3306
|
let e;
|
|
3209
|
-
const t = s.extensions && s.extensions[
|
|
3307
|
+
const t = s.extensions && s.extensions[x.KHR_DRACO_MESH_COMPRESSION];
|
|
3210
3308
|
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + We(t.attributes) : e = s.indices + ":" + We(s.attributes) + ":" + s.mode, s.targets !== void 0)
|
|
3211
3309
|
for (let n = 0, r = s.targets.length; n < r; n++)
|
|
3212
3310
|
e += ":" + We(s.targets[n]);
|
|
@@ -3219,7 +3317,7 @@ function We(s) {
|
|
|
3219
3317
|
e += t[n] + ":" + s[t[n]] + ";";
|
|
3220
3318
|
return e;
|
|
3221
3319
|
}
|
|
3222
|
-
function
|
|
3320
|
+
function et(s) {
|
|
3223
3321
|
switch (s) {
|
|
3224
3322
|
case Int8Array:
|
|
3225
3323
|
return 1 / 127;
|
|
@@ -3247,7 +3345,7 @@ class Us {
|
|
|
3247
3345
|
const c = a.match(/Version\/(\d+)/);
|
|
3248
3346
|
r = n && c ? parseInt(c[1], 10) : -1, o = a.indexOf("Firefox") > -1, i = o ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
|
|
3249
3347
|
}
|
|
3250
|
-
typeof createImageBitmap > "u" || n && r < 17 || o && i < 98 ? this.textureLoader = new
|
|
3348
|
+
typeof createImageBitmap > "u" || n && r < 17 || o && i < 98 ? this.textureLoader = new kn(this.options.manager) : this.textureLoader = new Kt(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new Te(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
|
|
3251
3349
|
}
|
|
3252
3350
|
setExtensions(e) {
|
|
3253
3351
|
this.extensions = e;
|
|
@@ -3277,7 +3375,7 @@ class Us {
|
|
|
3277
3375
|
parser: n,
|
|
3278
3376
|
userData: {}
|
|
3279
3377
|
};
|
|
3280
|
-
return Q(o, a, r),
|
|
3378
|
+
return Q(o, a, r), I(a, r), Promise.all(n._invokeAll(function(c) {
|
|
3281
3379
|
return c.afterRoot && c.afterRoot(a);
|
|
3282
3380
|
})).then(function() {
|
|
3283
3381
|
for (const c of a.scenes)
|
|
@@ -3288,6 +3386,8 @@ class Us {
|
|
|
3288
3386
|
}
|
|
3289
3387
|
/**
|
|
3290
3388
|
* Marks the special nodes/meshes in json for efficient parse.
|
|
3389
|
+
*
|
|
3390
|
+
* @private
|
|
3291
3391
|
*/
|
|
3292
3392
|
_markDefs() {
|
|
3293
3393
|
const e = this.json.nodes || [], t = this.json.skins || [], n = this.json.meshes || [];
|
|
@@ -3310,6 +3410,7 @@ class Us {
|
|
|
3310
3410
|
*
|
|
3311
3411
|
* Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
|
|
3312
3412
|
*
|
|
3413
|
+
* @private
|
|
3313
3414
|
* @param {Object} cache
|
|
3314
3415
|
* @param {Object3D} index
|
|
3315
3416
|
*/
|
|
@@ -3319,8 +3420,9 @@ class Us {
|
|
|
3319
3420
|
/**
|
|
3320
3421
|
* Returns a reference to a shared resource, cloning it if necessary.
|
|
3321
3422
|
*
|
|
3423
|
+
* @private
|
|
3322
3424
|
* @param {Object} cache
|
|
3323
|
-
* @param {
|
|
3425
|
+
* @param {number} index
|
|
3324
3426
|
* @param {Object} object
|
|
3325
3427
|
* @return {Object}
|
|
3326
3428
|
*/
|
|
@@ -3355,9 +3457,11 @@ class Us {
|
|
|
3355
3457
|
}
|
|
3356
3458
|
/**
|
|
3357
3459
|
* Requests the specified dependency asynchronously, with caching.
|
|
3460
|
+
*
|
|
3461
|
+
* @private
|
|
3358
3462
|
* @param {string} type
|
|
3359
3463
|
* @param {number} index
|
|
3360
|
-
* @return {Promise<Object3D|Material|
|
|
3464
|
+
* @return {Promise<Object3D|Material|Texture|AnimationClip|ArrayBuffer|Object>}
|
|
3361
3465
|
*/
|
|
3362
3466
|
getDependency(e, t) {
|
|
3363
3467
|
const n = e + ":" + t;
|
|
@@ -3422,6 +3526,8 @@ class Us {
|
|
|
3422
3526
|
}
|
|
3423
3527
|
/**
|
|
3424
3528
|
* Requests all dependencies of the specified type asynchronously, with caching.
|
|
3529
|
+
*
|
|
3530
|
+
* @private
|
|
3425
3531
|
* @param {string} type
|
|
3426
3532
|
* @return {Promise<Array<Object>>}
|
|
3427
3533
|
*/
|
|
@@ -3437,6 +3543,8 @@ class Us {
|
|
|
3437
3543
|
}
|
|
3438
3544
|
/**
|
|
3439
3545
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
|
|
3546
|
+
*
|
|
3547
|
+
* @private
|
|
3440
3548
|
* @param {number} bufferIndex
|
|
3441
3549
|
* @return {Promise<ArrayBuffer>}
|
|
3442
3550
|
*/
|
|
@@ -3445,7 +3553,7 @@ class Us {
|
|
|
3445
3553
|
if (t.type && t.type !== "arraybuffer")
|
|
3446
3554
|
throw new Error("THREE.GLTFLoader: " + t.type + " buffer type is not supported.");
|
|
3447
3555
|
if (t.uri === void 0 && e === 0)
|
|
3448
|
-
return Promise.resolve(this.extensions[
|
|
3556
|
+
return Promise.resolve(this.extensions[x.KHR_BINARY_GLTF].body);
|
|
3449
3557
|
const r = this.options;
|
|
3450
3558
|
return new Promise(function(o, i) {
|
|
3451
3559
|
n.load(he.resolveURL(t.uri, r.path), o, void 0, function() {
|
|
@@ -3455,6 +3563,8 @@ class Us {
|
|
|
3455
3563
|
}
|
|
3456
3564
|
/**
|
|
3457
3565
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
|
|
3566
|
+
*
|
|
3567
|
+
* @private
|
|
3458
3568
|
* @param {number} bufferViewIndex
|
|
3459
3569
|
* @return {Promise<ArrayBuffer>}
|
|
3460
3570
|
*/
|
|
@@ -3467,6 +3577,8 @@ class Us {
|
|
|
3467
3577
|
}
|
|
3468
3578
|
/**
|
|
3469
3579
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
|
|
3580
|
+
*
|
|
3581
|
+
* @private
|
|
3470
3582
|
* @param {number} accessorIndex
|
|
3471
3583
|
* @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
|
|
3472
3584
|
*/
|
|
@@ -3479,19 +3591,19 @@ class Us {
|
|
|
3479
3591
|
const o = [];
|
|
3480
3592
|
return r.bufferView !== void 0 ? o.push(this.getDependency("bufferView", r.bufferView)) : o.push(null), r.sparse !== void 0 && (o.push(this.getDependency("bufferView", r.sparse.indices.bufferView)), o.push(this.getDependency("bufferView", r.sparse.values.bufferView))), Promise.all(o).then(function(i) {
|
|
3481
3593
|
const a = i[0], c = Be[r.type], d = ee[r.componentType], u = d.BYTES_PER_ELEMENT, l = u * c, f = r.byteOffset || 0, h = r.bufferView !== void 0 ? n.bufferViews[r.bufferView].byteStride : void 0, w = r.normalized === !0;
|
|
3482
|
-
let
|
|
3594
|
+
let E, T;
|
|
3483
3595
|
if (h && h !== l) {
|
|
3484
|
-
const p = Math.floor(f / h),
|
|
3485
|
-
let
|
|
3486
|
-
|
|
3596
|
+
const p = Math.floor(f / h), g = "InterleavedBuffer:" + r.bufferView + ":" + r.componentType + ":" + p + ":" + r.count;
|
|
3597
|
+
let m = t.cache.get(g);
|
|
3598
|
+
m || (E = new d(a, p * h, r.count * h / u), m = new An(E, h / u), t.cache.add(g, m)), T = new Ln(m, c, f % h / u, w);
|
|
3487
3599
|
} else
|
|
3488
|
-
a === null ?
|
|
3600
|
+
a === null ? E = new d(r.count * c) : E = new d(a, f, r.count * c), T = new fe(E, c, w);
|
|
3489
3601
|
if (r.sparse !== void 0) {
|
|
3490
|
-
const p = Be.SCALAR,
|
|
3602
|
+
const p = Be.SCALAR, g = ee[r.sparse.indices.componentType], m = r.sparse.indices.byteOffset || 0, b = r.sparse.values.byteOffset || 0, _ = new g(i[1], m, r.sparse.count * p), y = new d(i[2], b, r.sparse.count * c);
|
|
3491
3603
|
a !== null && (T = new fe(T.array.slice(), T.itemSize, T.normalized)), T.normalized = !1;
|
|
3492
|
-
for (let v = 0,
|
|
3493
|
-
const
|
|
3494
|
-
if (T.setX(
|
|
3604
|
+
for (let v = 0, S = _.length; v < S; v++) {
|
|
3605
|
+
const C = _[v];
|
|
3606
|
+
if (T.setX(C, y[v * c]), c >= 2 && T.setY(C, y[v * c + 1]), c >= 3 && T.setZ(C, y[v * c + 2]), c >= 4 && T.setW(C, y[v * c + 3]), c >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
3495
3607
|
}
|
|
3496
3608
|
T.normalized = w;
|
|
3497
3609
|
}
|
|
@@ -3500,8 +3612,10 @@ class Us {
|
|
|
3500
3612
|
}
|
|
3501
3613
|
/**
|
|
3502
3614
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
|
|
3615
|
+
*
|
|
3616
|
+
* @private
|
|
3503
3617
|
* @param {number} textureIndex
|
|
3504
|
-
* @return {Promise
|
|
3618
|
+
* @return {Promise<?Texture>}
|
|
3505
3619
|
*/
|
|
3506
3620
|
loadTexture(e) {
|
|
3507
3621
|
const t = this.json, n = this.options, o = t.textures[e].source, i = t.images[o];
|
|
@@ -3519,7 +3633,7 @@ class Us {
|
|
|
3519
3633
|
const d = this.loadImageSource(t, n).then(function(u) {
|
|
3520
3634
|
u.flipY = !1, u.name = i.name || a.name || "", u.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (u.name = a.uri);
|
|
3521
3635
|
const f = (o.samplers || {})[i.sampler] || {};
|
|
3522
|
-
return u.magFilter =
|
|
3636
|
+
return u.magFilter = Lt[f.magFilter] || Ve, u.minFilter = Lt[f.minFilter] || qt, u.wrapS = Mt[f.wrapS] || Xe, u.wrapT = Mt[f.wrapT] || Xe, u.generateMipmaps = !u.isCompressedTexture && u.minFilter !== Vt && u.minFilter !== Ve, r.associations.set(u, { textures: e }), u;
|
|
3523
3637
|
}).catch(function() {
|
|
3524
3638
|
return null;
|
|
3525
3639
|
});
|
|
@@ -3542,13 +3656,13 @@ class Us {
|
|
|
3542
3656
|
const u = Promise.resolve(c).then(function(l) {
|
|
3543
3657
|
return new Promise(function(f, h) {
|
|
3544
3658
|
let w = f;
|
|
3545
|
-
t.isImageBitmapLoader === !0 && (w = function(
|
|
3546
|
-
const T = new
|
|
3659
|
+
t.isImageBitmapLoader === !0 && (w = function(E) {
|
|
3660
|
+
const T = new ct(E);
|
|
3547
3661
|
T.needsUpdate = !0, f(T);
|
|
3548
3662
|
}), t.load(he.resolveURL(l, o.path), w, void 0, h);
|
|
3549
3663
|
});
|
|
3550
3664
|
}).then(function(l) {
|
|
3551
|
-
return d === !0 && a.revokeObjectURL(c),
|
|
3665
|
+
return d === !0 && a.revokeObjectURL(c), I(l, i), l.userData.mimeType = i.mimeType || js(i.uri), l;
|
|
3552
3666
|
}).catch(function(l) {
|
|
3553
3667
|
throw console.error("THREE.GLTFLoader: Couldn't load texture", c), l;
|
|
3554
3668
|
});
|
|
@@ -3557,21 +3671,22 @@ class Us {
|
|
|
3557
3671
|
/**
|
|
3558
3672
|
* Asynchronously assigns a texture to the given material parameters.
|
|
3559
3673
|
*
|
|
3674
|
+
* @private
|
|
3560
3675
|
* @param {Object} materialParams
|
|
3561
3676
|
* @param {string} mapName
|
|
3562
3677
|
* @param {Object} mapDef
|
|
3563
|
-
* @param {string} colorSpace
|
|
3678
|
+
* @param {string} [colorSpace]
|
|
3564
3679
|
* @return {Promise<Texture>}
|
|
3565
3680
|
*/
|
|
3566
3681
|
assignTexture(e, t, n, r) {
|
|
3567
3682
|
const o = this;
|
|
3568
3683
|
return this.getDependency("texture", n.index).then(function(i) {
|
|
3569
3684
|
if (!i) return null;
|
|
3570
|
-
if (n.texCoord !== void 0 && n.texCoord > 0 && (i = i.clone(), i.channel = n.texCoord), o.extensions[
|
|
3571
|
-
const a = n.extensions !== void 0 ? n.extensions[
|
|
3685
|
+
if (n.texCoord !== void 0 && n.texCoord > 0 && (i = i.clone(), i.channel = n.texCoord), o.extensions[x.KHR_TEXTURE_TRANSFORM]) {
|
|
3686
|
+
const a = n.extensions !== void 0 ? n.extensions[x.KHR_TEXTURE_TRANSFORM] : void 0;
|
|
3572
3687
|
if (a) {
|
|
3573
3688
|
const c = o.associations.get(i);
|
|
3574
|
-
i = o.extensions[
|
|
3689
|
+
i = o.extensions[x.KHR_TEXTURE_TRANSFORM].extendTexture(i, a), o.associations.set(i, c);
|
|
3575
3690
|
}
|
|
3576
3691
|
}
|
|
3577
3692
|
return r !== void 0 && (i.colorSpace = r), e[t] = i, i;
|
|
@@ -3583,7 +3698,9 @@ class Us {
|
|
|
3583
3698
|
* but reuse of the same glTF material may require multiple threejs materials
|
|
3584
3699
|
* to accommodate different primitive types, defines, etc. New materials will
|
|
3585
3700
|
* be created if necessary, and reused from a cache.
|
|
3586
|
-
*
|
|
3701
|
+
*
|
|
3702
|
+
* @private
|
|
3703
|
+
* @param {Object3D} mesh Mesh, Line, or Points instance.
|
|
3587
3704
|
*/
|
|
3588
3705
|
assignFinalMaterial(e) {
|
|
3589
3706
|
const t = e.geometry;
|
|
@@ -3607,10 +3724,12 @@ class Us {
|
|
|
3607
3724
|
e.material = n;
|
|
3608
3725
|
}
|
|
3609
3726
|
getMaterialType() {
|
|
3610
|
-
return
|
|
3727
|
+
return Xt;
|
|
3611
3728
|
}
|
|
3612
3729
|
/**
|
|
3613
3730
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
|
|
3731
|
+
*
|
|
3732
|
+
* @private
|
|
3614
3733
|
* @param {number} materialIndex
|
|
3615
3734
|
* @return {Promise<Material>}
|
|
3616
3735
|
*/
|
|
@@ -3618,14 +3737,14 @@ class Us {
|
|
|
3618
3737
|
const t = this, n = this.json, r = this.extensions, o = n.materials[e];
|
|
3619
3738
|
let i;
|
|
3620
3739
|
const a = {}, c = o.extensions || {}, d = [];
|
|
3621
|
-
if (c[
|
|
3622
|
-
const l = r[
|
|
3740
|
+
if (c[x.KHR_MATERIALS_UNLIT]) {
|
|
3741
|
+
const l = r[x.KHR_MATERIALS_UNLIT];
|
|
3623
3742
|
i = l.getMaterialType(), d.push(l.extendParams(a, o, t));
|
|
3624
3743
|
} else {
|
|
3625
3744
|
const l = o.pbrMetallicRoughness || {};
|
|
3626
3745
|
if (a.color = new W(1, 1, 1), a.opacity = 1, Array.isArray(l.baseColorFactor)) {
|
|
3627
3746
|
const f = l.baseColorFactor;
|
|
3628
|
-
a.color.setRGB(f[0], f[1], f[2],
|
|
3747
|
+
a.color.setRGB(f[0], f[1], f[2], D), a.opacity = f[3];
|
|
3629
3748
|
}
|
|
3630
3749
|
l.baseColorTexture !== void 0 && d.push(t.assignTexture(a, "map", l.baseColorTexture, G)), a.metalness = l.metallicFactor !== void 0 ? l.metallicFactor : 1, a.roughness = l.roughnessFactor !== void 0 ? l.roughnessFactor : 1, l.metallicRoughnessTexture !== void 0 && (d.push(t.assignTexture(a, "metalnessMap", l.metallicRoughnessTexture)), d.push(t.assignTexture(a, "roughnessMap", l.metallicRoughnessTexture))), i = this._invokeOne(function(f) {
|
|
3631
3750
|
return f.getMaterialType && f.getMaterialType(e);
|
|
@@ -3635,24 +3754,25 @@ class Us {
|
|
|
3635
3754
|
}
|
|
3636
3755
|
o.doubleSided === !0 && (a.side = On);
|
|
3637
3756
|
const u = o.alphaMode || Ge.OPAQUE;
|
|
3638
|
-
if (u === Ge.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, u === Ge.MASK && (a.alphaTest = o.alphaCutoff !== void 0 ? o.alphaCutoff : 0.5)), o.normalTexture !== void 0 && i !== le && (d.push(t.assignTexture(a, "normalMap", o.normalTexture)), a.normalScale = new
|
|
3757
|
+
if (u === Ge.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, u === Ge.MASK && (a.alphaTest = o.alphaCutoff !== void 0 ? o.alphaCutoff : 0.5)), o.normalTexture !== void 0 && i !== le && (d.push(t.assignTexture(a, "normalMap", o.normalTexture)), a.normalScale = new Wt(1, 1), o.normalTexture.scale !== void 0)) {
|
|
3639
3758
|
const l = o.normalTexture.scale;
|
|
3640
3759
|
a.normalScale.set(l, l);
|
|
3641
3760
|
}
|
|
3642
3761
|
if (o.occlusionTexture !== void 0 && i !== le && (d.push(t.assignTexture(a, "aoMap", o.occlusionTexture)), o.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = o.occlusionTexture.strength)), o.emissiveFactor !== void 0 && i !== le) {
|
|
3643
3762
|
const l = o.emissiveFactor;
|
|
3644
|
-
a.emissive = new W().setRGB(l[0], l[1], l[2],
|
|
3763
|
+
a.emissive = new W().setRGB(l[0], l[1], l[2], D);
|
|
3645
3764
|
}
|
|
3646
3765
|
return o.emissiveTexture !== void 0 && i !== le && d.push(t.assignTexture(a, "emissiveMap", o.emissiveTexture, G)), Promise.all(d).then(function() {
|
|
3647
3766
|
const l = new i(a);
|
|
3648
|
-
return o.name && (l.name = o.name),
|
|
3767
|
+
return o.name && (l.name = o.name), I(l, o), t.associations.set(l, { materials: e }), o.extensions && Q(r, l, o), l;
|
|
3649
3768
|
});
|
|
3650
3769
|
}
|
|
3651
3770
|
/**
|
|
3652
3771
|
* When Object3D instances are targeted by animation, they need unique names.
|
|
3653
3772
|
*
|
|
3654
|
-
* @
|
|
3655
|
-
* @
|
|
3773
|
+
* @private
|
|
3774
|
+
* @param {string} originalName
|
|
3775
|
+
* @return {string}
|
|
3656
3776
|
*/
|
|
3657
3777
|
createUniqueName(e) {
|
|
3658
3778
|
const t = In.sanitizeNodeName(e || "");
|
|
@@ -3663,14 +3783,15 @@ class Us {
|
|
|
3663
3783
|
*
|
|
3664
3784
|
* Creates BufferGeometries from primitives.
|
|
3665
3785
|
*
|
|
3786
|
+
* @private
|
|
3666
3787
|
* @param {Array<GLTF.Primitive>} primitives
|
|
3667
3788
|
* @return {Promise<Array<BufferGeometry>>}
|
|
3668
3789
|
*/
|
|
3669
3790
|
loadGeometries(e) {
|
|
3670
3791
|
const t = this, n = this.extensions, r = this.primitiveCache;
|
|
3671
3792
|
function o(a) {
|
|
3672
|
-
return n[
|
|
3673
|
-
return
|
|
3793
|
+
return n[x.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(c) {
|
|
3794
|
+
return Pt(c, a, t);
|
|
3674
3795
|
});
|
|
3675
3796
|
}
|
|
3676
3797
|
const i = [];
|
|
@@ -3680,15 +3801,17 @@ class Us {
|
|
|
3680
3801
|
i.push(l.promise);
|
|
3681
3802
|
else {
|
|
3682
3803
|
let f;
|
|
3683
|
-
d.extensions && d.extensions[
|
|
3804
|
+
d.extensions && d.extensions[x.KHR_DRACO_MESH_COMPRESSION] ? f = o(d) : f = Pt(new Gt(), d, t), r[u] = { primitive: d, promise: f }, i.push(f);
|
|
3684
3805
|
}
|
|
3685
3806
|
}
|
|
3686
3807
|
return Promise.all(i);
|
|
3687
3808
|
}
|
|
3688
3809
|
/**
|
|
3689
3810
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
|
|
3811
|
+
*
|
|
3812
|
+
* @private
|
|
3690
3813
|
* @param {number} meshIndex
|
|
3691
|
-
* @return {Promise<Group|Mesh|SkinnedMesh>}
|
|
3814
|
+
* @return {Promise<Group|Mesh|SkinnedMesh|Line|Points>}
|
|
3692
3815
|
*/
|
|
3693
3816
|
loadMesh(e) {
|
|
3694
3817
|
const t = this, n = this.json, r = this.extensions, o = n.meshes[e], i = o.primitives, a = [];
|
|
@@ -3699,22 +3822,22 @@ class Us {
|
|
|
3699
3822
|
return a.push(t.loadGeometries(i)), Promise.all(a).then(function(c) {
|
|
3700
3823
|
const d = c.slice(0, c.length - 1), u = c[c.length - 1], l = [];
|
|
3701
3824
|
for (let h = 0, w = u.length; h < w; h++) {
|
|
3702
|
-
const
|
|
3825
|
+
const E = u[h], T = i[h];
|
|
3703
3826
|
let p;
|
|
3704
|
-
const
|
|
3827
|
+
const g = d[h];
|
|
3705
3828
|
if (T.mode === M.TRIANGLES || T.mode === M.TRIANGLE_STRIP || T.mode === M.TRIANGLE_FAN || T.mode === void 0)
|
|
3706
|
-
p = o.isSkinnedMesh === !0 ? new Dn(
|
|
3829
|
+
p = o.isSkinnedMesh === !0 ? new Dn(E, g) : new Nn(E, g), p.isSkinnedMesh === !0 && p.normalizeSkinWeights(), T.mode === M.TRIANGLE_STRIP ? p.geometry = kt(p.geometry, Ut) : T.mode === M.TRIANGLE_FAN && (p.geometry = kt(p.geometry, Ke));
|
|
3707
3830
|
else if (T.mode === M.LINES)
|
|
3708
|
-
p = new Fn(
|
|
3831
|
+
p = new Fn(E, g);
|
|
3709
3832
|
else if (T.mode === M.LINE_STRIP)
|
|
3710
|
-
p = new jn(
|
|
3833
|
+
p = new jn(E, g);
|
|
3711
3834
|
else if (T.mode === M.LINE_LOOP)
|
|
3712
|
-
p = new Hn(
|
|
3835
|
+
p = new Hn(E, g);
|
|
3713
3836
|
else if (T.mode === M.POINTS)
|
|
3714
|
-
p = new Un(
|
|
3837
|
+
p = new Un(E, g);
|
|
3715
3838
|
else
|
|
3716
3839
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + T.mode);
|
|
3717
|
-
Object.keys(p.geometry.morphAttributes).length > 0 && Ns(p, o), p.name = t.createUniqueName(o.name || "mesh_" + e),
|
|
3840
|
+
Object.keys(p.geometry.morphAttributes).length > 0 && Ns(p, o), p.name = t.createUniqueName(o.name || "mesh_" + e), I(p, o), T.extensions && Q(r, p, T), t.assignFinalMaterial(p), l.push(p);
|
|
3718
3841
|
}
|
|
3719
3842
|
for (let h = 0, w = l.length; h < w; h++)
|
|
3720
3843
|
t.associations.set(l[h], {
|
|
@@ -3732,8 +3855,10 @@ class Us {
|
|
|
3732
3855
|
}
|
|
3733
3856
|
/**
|
|
3734
3857
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
|
|
3858
|
+
*
|
|
3859
|
+
* @private
|
|
3735
3860
|
* @param {number} cameraIndex
|
|
3736
|
-
* @return {Promise<
|
|
3861
|
+
* @return {Promise<Camera>|undefined}
|
|
3737
3862
|
*/
|
|
3738
3863
|
loadCamera(e) {
|
|
3739
3864
|
let t;
|
|
@@ -3742,10 +3867,12 @@ class Us {
|
|
|
3742
3867
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
3743
3868
|
return;
|
|
3744
3869
|
}
|
|
3745
|
-
return n.type === "perspective" ? t = new Bn(Gn.radToDeg(r.yfov), r.aspectRatio || 1, r.znear || 1, r.zfar || 2e6) : n.type === "orthographic" && (t = new Wn(-r.xmag, r.xmag, r.ymag, -r.ymag, r.znear, r.zfar)), n.name && (t.name = this.createUniqueName(n.name)),
|
|
3870
|
+
return n.type === "perspective" ? t = new Bn(Gn.radToDeg(r.yfov), r.aspectRatio || 1, r.znear || 1, r.zfar || 2e6) : n.type === "orthographic" && (t = new Wn(-r.xmag, r.xmag, r.ymag, -r.ymag, r.znear, r.zfar)), n.name && (t.name = this.createUniqueName(n.name)), I(t, n), Promise.resolve(t);
|
|
3746
3871
|
}
|
|
3747
3872
|
/**
|
|
3748
3873
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
3874
|
+
*
|
|
3875
|
+
* @private
|
|
3749
3876
|
* @param {number} skinIndex
|
|
3750
3877
|
* @return {Promise<Skeleton>}
|
|
3751
3878
|
*/
|
|
@@ -3764,19 +3891,21 @@ class Us {
|
|
|
3764
3891
|
} else
|
|
3765
3892
|
console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[d]);
|
|
3766
3893
|
}
|
|
3767
|
-
return new
|
|
3894
|
+
return new $n(a, c);
|
|
3768
3895
|
});
|
|
3769
3896
|
}
|
|
3770
3897
|
/**
|
|
3771
3898
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
|
|
3899
|
+
*
|
|
3900
|
+
* @private
|
|
3772
3901
|
* @param {number} animationIndex
|
|
3773
3902
|
* @return {Promise<AnimationClip>}
|
|
3774
3903
|
*/
|
|
3775
3904
|
loadAnimation(e) {
|
|
3776
3905
|
const t = this.json, n = this, r = t.animations[e], o = r.name ? r.name : "animation_" + e, i = [], a = [], c = [], d = [], u = [];
|
|
3777
3906
|
for (let l = 0, f = r.channels.length; l < f; l++) {
|
|
3778
|
-
const h = r.channels[l], w = r.samplers[h.sampler],
|
|
3779
|
-
|
|
3907
|
+
const h = r.channels[l], w = r.samplers[h.sampler], E = h.target, T = E.node, p = r.parameters !== void 0 ? r.parameters[w.input] : w.input, g = r.parameters !== void 0 ? r.parameters[w.output] : w.output;
|
|
3908
|
+
E.node !== void 0 && (i.push(this.getDependency("node", T)), a.push(this.getDependency("accessor", p)), c.push(this.getDependency("accessor", g)), d.push(w), u.push(E));
|
|
3780
3909
|
}
|
|
3781
3910
|
return Promise.all([
|
|
3782
3911
|
Promise.all(i),
|
|
@@ -3785,17 +3914,18 @@ class Us {
|
|
|
3785
3914
|
Promise.all(d),
|
|
3786
3915
|
Promise.all(u)
|
|
3787
3916
|
]).then(function(l) {
|
|
3788
|
-
const f = l[0], h = l[1], w = l[2],
|
|
3789
|
-
for (let m = 0,
|
|
3790
|
-
const _ = f[m],
|
|
3917
|
+
const f = l[0], h = l[1], w = l[2], E = l[3], T = l[4], p = [];
|
|
3918
|
+
for (let m = 0, b = f.length; m < b; m++) {
|
|
3919
|
+
const _ = f[m], y = h[m], v = w[m], S = E[m], C = T[m];
|
|
3791
3920
|
if (_ === void 0) continue;
|
|
3792
3921
|
_.updateMatrix && _.updateMatrix();
|
|
3793
|
-
const
|
|
3794
|
-
if (
|
|
3795
|
-
for (let
|
|
3796
|
-
p.push(
|
|
3922
|
+
const k = n._createAnimationTracks(_, y, v, S, C);
|
|
3923
|
+
if (k)
|
|
3924
|
+
for (let A = 0; A < k.length; A++)
|
|
3925
|
+
p.push(k[A]);
|
|
3797
3926
|
}
|
|
3798
|
-
|
|
3927
|
+
const g = new zn(o, void 0, p);
|
|
3928
|
+
return I(g, r), g;
|
|
3799
3929
|
});
|
|
3800
3930
|
}
|
|
3801
3931
|
createNodeMesh(e) {
|
|
@@ -3811,6 +3941,8 @@ class Us {
|
|
|
3811
3941
|
}
|
|
3812
3942
|
/**
|
|
3813
3943
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
|
|
3944
|
+
*
|
|
3945
|
+
* @private
|
|
3814
3946
|
* @param {number} nodeIndex
|
|
3815
3947
|
* @return {Promise<Object3D>}
|
|
3816
3948
|
*/
|
|
@@ -3850,25 +3982,33 @@ class Us {
|
|
|
3850
3982
|
a.push(d);
|
|
3851
3983
|
}), this.nodeCache[e] = Promise.all(a).then(function(d) {
|
|
3852
3984
|
let u;
|
|
3853
|
-
if (o.isBone === !0 ? u = new
|
|
3985
|
+
if (o.isBone === !0 ? u = new Kn() : d.length > 1 ? u = new Oe() : d.length === 1 ? u = d[0] : u = new zt(), u !== d[0])
|
|
3854
3986
|
for (let l = 0, f = d.length; l < f; l++)
|
|
3855
3987
|
u.add(d[l]);
|
|
3856
|
-
if (o.name && (u.userData.name = o.name, u.name = i),
|
|
3988
|
+
if (o.name && (u.userData.name = o.name, u.name = i), I(u, o), o.extensions && Q(n, u, o), o.matrix !== void 0) {
|
|
3857
3989
|
const l = new we();
|
|
3858
3990
|
l.fromArray(o.matrix), u.applyMatrix4(l);
|
|
3859
3991
|
} else
|
|
3860
3992
|
o.translation !== void 0 && u.position.fromArray(o.translation), o.rotation !== void 0 && u.quaternion.fromArray(o.rotation), o.scale !== void 0 && u.scale.fromArray(o.scale);
|
|
3861
|
-
|
|
3993
|
+
if (!r.associations.has(u))
|
|
3994
|
+
r.associations.set(u, {});
|
|
3995
|
+
else if (o.mesh !== void 0 && r.meshCache.refs[o.mesh] > 1) {
|
|
3996
|
+
const l = r.associations.get(u);
|
|
3997
|
+
r.associations.set(u, { ...l });
|
|
3998
|
+
}
|
|
3999
|
+
return r.associations.get(u).nodes = e, u;
|
|
3862
4000
|
}), this.nodeCache[e];
|
|
3863
4001
|
}
|
|
3864
4002
|
/**
|
|
3865
4003
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
|
|
4004
|
+
*
|
|
4005
|
+
* @private
|
|
3866
4006
|
* @param {number} sceneIndex
|
|
3867
4007
|
* @return {Promise<Group>}
|
|
3868
4008
|
*/
|
|
3869
4009
|
loadScene(e) {
|
|
3870
4010
|
const t = this.extensions, n = this.json.scenes[e], r = this, o = new Oe();
|
|
3871
|
-
n.name && (o.name = r.createUniqueName(n.name)),
|
|
4011
|
+
n.name && (o.name = r.createUniqueName(n.name)), I(o, n), n.extensions && Q(t, o, n);
|
|
3872
4012
|
const i = n.nodes || [], a = [];
|
|
3873
4013
|
for (let c = 0, d = i.length; c < d; c++)
|
|
3874
4014
|
a.push(r.getDependency("node", i[c]));
|
|
@@ -3878,7 +4018,7 @@ class Us {
|
|
|
3878
4018
|
const d = (u) => {
|
|
3879
4019
|
const l = /* @__PURE__ */ new Map();
|
|
3880
4020
|
for (const [f, h] of r.associations)
|
|
3881
|
-
(f instanceof Pe || f instanceof
|
|
4021
|
+
(f instanceof Pe || f instanceof ct) && l.set(f, h);
|
|
3882
4022
|
return u.traverse((f) => {
|
|
3883
4023
|
const h = r.associations.get(f);
|
|
3884
4024
|
h != null && l.set(f, h);
|
|
@@ -3895,29 +4035,29 @@ class Us {
|
|
|
3895
4035
|
let d;
|
|
3896
4036
|
switch (B[o.path]) {
|
|
3897
4037
|
case B.weights:
|
|
3898
|
-
d =
|
|
4038
|
+
d = lt;
|
|
3899
4039
|
break;
|
|
3900
4040
|
case B.rotation:
|
|
3901
|
-
d =
|
|
4041
|
+
d = dt;
|
|
3902
4042
|
break;
|
|
3903
|
-
case B.
|
|
4043
|
+
case B.translation:
|
|
3904
4044
|
case B.scale:
|
|
3905
|
-
d =
|
|
4045
|
+
d = ut;
|
|
3906
4046
|
break;
|
|
3907
4047
|
default:
|
|
3908
4048
|
switch (n.itemSize) {
|
|
3909
4049
|
case 1:
|
|
3910
|
-
d =
|
|
4050
|
+
d = lt;
|
|
3911
4051
|
break;
|
|
3912
4052
|
case 2:
|
|
3913
4053
|
case 3:
|
|
3914
4054
|
default:
|
|
3915
|
-
d =
|
|
4055
|
+
d = ut;
|
|
3916
4056
|
break;
|
|
3917
4057
|
}
|
|
3918
4058
|
break;
|
|
3919
4059
|
}
|
|
3920
|
-
const u = r.interpolation !== void 0 ? Os[r.interpolation] :
|
|
4060
|
+
const u = r.interpolation !== void 0 ? Os[r.interpolation] : Qt, l = this._getArrayFromAccessor(n);
|
|
3921
4061
|
for (let f = 0, h = c.length; f < h; f++) {
|
|
3922
4062
|
const w = new d(
|
|
3923
4063
|
c[f] + "." + B[o.path],
|
|
@@ -3932,7 +4072,7 @@ class Us {
|
|
|
3932
4072
|
_getArrayFromAccessor(e) {
|
|
3933
4073
|
let t = e.array;
|
|
3934
4074
|
if (e.normalized) {
|
|
3935
|
-
const n =
|
|
4075
|
+
const n = et(t.constructor), r = new Float32Array(t.length);
|
|
3936
4076
|
for (let o = 0, i = t.length; o < i; o++)
|
|
3937
4077
|
r[o] = t[o] * n;
|
|
3938
4078
|
t = r;
|
|
@@ -3941,7 +4081,7 @@ class Us {
|
|
|
3941
4081
|
}
|
|
3942
4082
|
_createCubicSplineTrackInterpolant(e) {
|
|
3943
4083
|
e.createInterpolant = function(n) {
|
|
3944
|
-
const r = this instanceof
|
|
4084
|
+
const r = this instanceof dt ? Ps : an;
|
|
3945
4085
|
return new r(this.times, this.values, this.getValueSize() / 3, n);
|
|
3946
4086
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
3947
4087
|
}
|
|
@@ -3955,7 +4095,7 @@ function Bs(s, e, t) {
|
|
|
3955
4095
|
new Z(c[0], c[1], c[2]),
|
|
3956
4096
|
new Z(d[0], d[1], d[2])
|
|
3957
4097
|
), a.normalized) {
|
|
3958
|
-
const u =
|
|
4098
|
+
const u = et(ee[a.componentType]);
|
|
3959
4099
|
r.min.multiplyScalar(u), r.max.multiplyScalar(u);
|
|
3960
4100
|
}
|
|
3961
4101
|
} else {
|
|
@@ -3973,8 +4113,8 @@ function Bs(s, e, t) {
|
|
|
3973
4113
|
const f = t.json.accessors[l.POSITION], h = f.min, w = f.max;
|
|
3974
4114
|
if (h !== void 0 && w !== void 0) {
|
|
3975
4115
|
if (c.setX(Math.max(Math.abs(h[0]), Math.abs(w[0]))), c.setY(Math.max(Math.abs(h[1]), Math.abs(w[1]))), c.setZ(Math.max(Math.abs(h[2]), Math.abs(w[2]))), f.normalized) {
|
|
3976
|
-
const
|
|
3977
|
-
c.multiplyScalar(
|
|
4116
|
+
const E = et(ee[f.componentType]);
|
|
4117
|
+
c.multiplyScalar(E);
|
|
3978
4118
|
}
|
|
3979
4119
|
a.max(c);
|
|
3980
4120
|
} else
|
|
@@ -3987,7 +4127,7 @@ function Bs(s, e, t) {
|
|
|
3987
4127
|
const i = new tr();
|
|
3988
4128
|
r.getCenter(i.center), i.radius = r.min.distanceTo(r.max) / 2, s.boundingSphere = i;
|
|
3989
4129
|
}
|
|
3990
|
-
function
|
|
4130
|
+
function Pt(s, e, t) {
|
|
3991
4131
|
const n = e.attributes, r = [];
|
|
3992
4132
|
function o(i, a) {
|
|
3993
4133
|
return t.getDependency("accessor", i).then(function(c) {
|
|
@@ -3995,7 +4135,7 @@ function Mt(s, e, t) {
|
|
|
3995
4135
|
});
|
|
3996
4136
|
}
|
|
3997
4137
|
for (const i in n) {
|
|
3998
|
-
const a =
|
|
4138
|
+
const a = Ze[i] || i.toLowerCase();
|
|
3999
4139
|
a in s.attributes || r.push(o(n[i], a));
|
|
4000
4140
|
}
|
|
4001
4141
|
if (e.indices !== void 0 && !s.index) {
|
|
@@ -4004,23 +4144,23 @@ function Mt(s, e, t) {
|
|
|
4004
4144
|
});
|
|
4005
4145
|
r.push(i);
|
|
4006
4146
|
}
|
|
4007
|
-
return qe.workingColorSpace !==
|
|
4147
|
+
return qe.workingColorSpace !== D && "COLOR_0" in n && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${qe.workingColorSpace}" not supported.`), I(s, e), Bs(s, e, t), Promise.all(r).then(function() {
|
|
4008
4148
|
return e.targets !== void 0 ? Ds(s, e.targets, t) : s;
|
|
4009
4149
|
});
|
|
4010
4150
|
}
|
|
4011
|
-
var Gs = Object.defineProperty, Ws = Object.getOwnPropertyDescriptor,
|
|
4151
|
+
var Gs = Object.defineProperty, Ws = Object.getOwnPropertyDescriptor, $s = (s, e, t, n) => {
|
|
4012
4152
|
for (var r = n > 1 ? void 0 : n ? Ws(e, t) : e, o = s.length - 1, i; o >= 0; o--)
|
|
4013
4153
|
(i = s[o]) && (r = (n ? i(e, t, r) : i(r)) || r);
|
|
4014
4154
|
return n && r && Gs(e, t, r), r;
|
|
4015
4155
|
};
|
|
4016
|
-
let
|
|
4156
|
+
let Ce = class {
|
|
4017
4157
|
constructor() {
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4158
|
+
R(this, "loadingManager", new rr());
|
|
4159
|
+
R(this, "loaders", {});
|
|
4160
|
+
R(this, "sources", []);
|
|
4161
|
+
R(this, "loadedResources", {});
|
|
4162
|
+
R(this, "toLoadCount", 0);
|
|
4163
|
+
R(this, "loadedCount", 0);
|
|
4024
4164
|
}
|
|
4025
4165
|
/** @description The video loader. based on {@link HTMLVideoElement}. */
|
|
4026
4166
|
get videoLoader() {
|
|
@@ -4036,7 +4176,7 @@ let Ee = class {
|
|
|
4036
4176
|
};
|
|
4037
4177
|
}
|
|
4038
4178
|
_initLoaders() {
|
|
4039
|
-
this.loaders.dracoLoader = new
|
|
4179
|
+
this.loaders.dracoLoader = new sn(this.loadingManager), this.loaders.audioLoader = new sr(this.loadingManager), this.loaders.fontLoader = new bn(this.loadingManager), this.loaders.gltfLoader = new as(this.loadingManager), this.loaders.imageLoader = new Kt(this.loadingManager), this.loaders.videoLoader = this.videoLoader;
|
|
4040
4180
|
}
|
|
4041
4181
|
_initSources(s) {
|
|
4042
4182
|
this.sources = s, this.toLoadCount = this.sources.length, this.loadedCount = 0;
|
|
@@ -4086,18 +4226,18 @@ let Ee = class {
|
|
|
4086
4226
|
}
|
|
4087
4227
|
}
|
|
4088
4228
|
};
|
|
4089
|
-
|
|
4229
|
+
Ce = $s([
|
|
4090
4230
|
ne(re.ContainerScoped)
|
|
4091
|
-
],
|
|
4092
|
-
var
|
|
4093
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
4231
|
+
], Ce);
|
|
4232
|
+
var zs = Object.defineProperty, Ks = Object.getOwnPropertyDescriptor, qs = (s, e, t, n) => {
|
|
4233
|
+
for (var r = n > 1 ? void 0 : n ? Ks(e, t) : e, o = s.length - 1, i; o >= 0; o--)
|
|
4094
4234
|
(i = s[o]) && (r = (n ? i(e, t, r) : i(r)) || r);
|
|
4095
|
-
return n && r &&
|
|
4235
|
+
return n && r && zs(e, t, r), r;
|
|
4096
4236
|
}, Vs = (s, e) => (t, n) => e(t, n, s);
|
|
4097
|
-
let
|
|
4237
|
+
let Re = class {
|
|
4098
4238
|
constructor(s) {
|
|
4099
|
-
|
|
4100
|
-
|
|
4239
|
+
R(this, "load$$", new Ft());
|
|
4240
|
+
R(this, "load$", this.load$$.pipe(
|
|
4101
4241
|
be((s) => ({
|
|
4102
4242
|
...s,
|
|
4103
4243
|
loadedCount: s.resource ? this._service.loadedCount + 1 : this._service.loadedCount,
|
|
@@ -4105,13 +4245,13 @@ let Ce = class {
|
|
|
4105
4245
|
})),
|
|
4106
4246
|
Me()
|
|
4107
4247
|
));
|
|
4108
|
-
|
|
4248
|
+
R(this, "serializedLoad$", this.load$.pipe(
|
|
4109
4249
|
be((s) => {
|
|
4110
4250
|
var t, n, r;
|
|
4111
4251
|
let e = s.resource;
|
|
4112
4252
|
if ((t = s == null ? void 0 : s.resource) != null && t.parser) {
|
|
4113
4253
|
const o = s.resource, i = o.scenes.map(
|
|
4114
|
-
(a) =>
|
|
4254
|
+
(a) => ot(a)
|
|
4115
4255
|
);
|
|
4116
4256
|
e = {
|
|
4117
4257
|
animations: (s == null ? void 0 : s.resource).animations.map(
|
|
@@ -4119,7 +4259,7 @@ let Ce = class {
|
|
|
4119
4259
|
(a) => a.toJSON()
|
|
4120
4260
|
),
|
|
4121
4261
|
cameras: o.cameras.map(
|
|
4122
|
-
(a) =>
|
|
4262
|
+
(a) => ot(a)
|
|
4123
4263
|
),
|
|
4124
4264
|
parser: { json: o.parser.json },
|
|
4125
4265
|
scene: i == null ? void 0 : i[0],
|
|
@@ -4167,7 +4307,7 @@ let Ce = class {
|
|
|
4167
4307
|
"width"
|
|
4168
4308
|
]),
|
|
4169
4309
|
buffered: s.resource.buffered.length,
|
|
4170
|
-
error: s.resource.error ?
|
|
4310
|
+
error: s.resource.error ? ze(s.resource.error, []) : {},
|
|
4171
4311
|
played: s.resource.played.length,
|
|
4172
4312
|
seekable: s.resource.seekable.length,
|
|
4173
4313
|
textTracks: s.resource.textTracks.length
|
|
@@ -4178,8 +4318,8 @@ let Ce = class {
|
|
|
4178
4318
|
}),
|
|
4179
4319
|
Me()
|
|
4180
4320
|
));
|
|
4181
|
-
|
|
4182
|
-
|
|
4321
|
+
R(this, "loadCompleted$", this.load$.pipe(
|
|
4322
|
+
jt((s) => s.toLoadCount === s.loadedCount),
|
|
4183
4323
|
be(
|
|
4184
4324
|
() => de(this._service, [
|
|
4185
4325
|
"loadedCount",
|
|
@@ -4192,18 +4332,18 @@ let Ce = class {
|
|
|
4192
4332
|
this._service = s;
|
|
4193
4333
|
}
|
|
4194
4334
|
};
|
|
4195
|
-
|
|
4335
|
+
Re = qs([
|
|
4196
4336
|
ne(re.ContainerScoped),
|
|
4197
|
-
Vs(0, P(
|
|
4198
|
-
],
|
|
4337
|
+
Vs(0, P(Ce))
|
|
4338
|
+
], Re);
|
|
4199
4339
|
var Xs = Object.defineProperty, Qs = Object.getOwnPropertyDescriptor, Ys = (s, e, t, n) => {
|
|
4200
4340
|
for (var r = n > 1 ? void 0 : n ? Qs(e, t) : e, o = s.length - 1, i; o >= 0; o--)
|
|
4201
4341
|
(i = s[o]) && (r = (n ? i(e, t, r) : i(r)) || r);
|
|
4202
4342
|
return n && r && Xs(e, t, r), r;
|
|
4203
|
-
},
|
|
4204
|
-
let
|
|
4343
|
+
}, $e = (s, e) => (t, n) => e(t, n, s);
|
|
4344
|
+
let tt = class {
|
|
4205
4345
|
constructor(s, e, t) {
|
|
4206
|
-
|
|
4346
|
+
R(this, "_subscriptions", []);
|
|
4207
4347
|
this._controller = s, this._service = e, this._props = t, this._subscriptions.push(
|
|
4208
4348
|
this._controller.load$.subscribe(
|
|
4209
4349
|
this._service.handleLoad.bind(this._service)
|
|
@@ -4248,28 +4388,31 @@ let et = class {
|
|
|
4248
4388
|
dispose() {
|
|
4249
4389
|
this._subscriptions.forEach((s) => s.unsubscribe()), Object.keys(this._service.loaders).forEach((s) => {
|
|
4250
4390
|
const e = this._service.loaders[s];
|
|
4251
|
-
e instanceof
|
|
4391
|
+
e instanceof sn && e.dispose(), this._service.loaders[s] = void 0;
|
|
4252
4392
|
}), this._controller.load$$.complete();
|
|
4253
4393
|
}
|
|
4254
4394
|
};
|
|
4255
|
-
|
|
4395
|
+
tt = Ys([
|
|
4256
4396
|
ne(re.ContainerScoped),
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
],
|
|
4397
|
+
$e(0, P(Re)),
|
|
4398
|
+
$e(1, P(Ce)),
|
|
4399
|
+
$e(2, P(xe))
|
|
4400
|
+
], tt);
|
|
4261
4401
|
var Js = Object.defineProperty, Zs = Object.getOwnPropertyDescriptor, ei = (s, e, t, n) => {
|
|
4262
4402
|
for (var r = n > 1 ? void 0 : n ? Zs(e, t) : e, o = s.length - 1, i; o >= 0; o--)
|
|
4263
4403
|
(i = s[o]) && (r = (n ? i(e, t, r) : i(r)) || r);
|
|
4264
4404
|
return n && r && Js(e, t, r), r;
|
|
4265
4405
|
}, J = (s, e) => (t, n) => e(t, n, s);
|
|
4266
|
-
let
|
|
4406
|
+
let nt = class extends yn {
|
|
4267
4407
|
constructor(e, t, n, r, o, i) {
|
|
4268
4408
|
super();
|
|
4269
|
-
|
|
4270
|
-
|
|
4409
|
+
R(this, "_subscriptions", []);
|
|
4410
|
+
R(this, "_initialized", !1);
|
|
4271
4411
|
this._service = e, this._controller = t, this._loaderController = n, this.container = r, this.props = o, this.loader = i, this.props.initOnConstruct && this.init();
|
|
4272
4412
|
}
|
|
4413
|
+
get currentWorker() {
|
|
4414
|
+
return this.props.mainThread ? self : this._service.worker;
|
|
4415
|
+
}
|
|
4273
4416
|
async _initCanvas() {
|
|
4274
4417
|
try {
|
|
4275
4418
|
if (this.props.canvas instanceof HTMLCanvasElement && (this._service.canvas = this.props.canvas), typeof this.props.canvas == "string") {
|
|
@@ -4284,25 +4427,34 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
|
|
|
4284
4427
|
);
|
|
4285
4428
|
}
|
|
4286
4429
|
}
|
|
4287
|
-
async
|
|
4430
|
+
async _initServiceWorker() {
|
|
4288
4431
|
this._service.init({
|
|
4289
4432
|
worker: this._service.worker,
|
|
4290
4433
|
thread: this._service.thread
|
|
4291
4434
|
});
|
|
4292
4435
|
}
|
|
4293
4436
|
async _initEvents() {
|
|
4294
|
-
var e, t;
|
|
4295
4437
|
if (!this._service.canvas)
|
|
4296
4438
|
throw new Error("Canvas element is not initialized.");
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4439
|
+
this._controller.init(), setTimeout(() => {
|
|
4440
|
+
const e = new UIEvent("resize");
|
|
4441
|
+
e.width = window.innerWidth, e.height = window.innerHeight, e.windowWidth = window.innerWidth, e.windowHeight = window.innerHeight, this._controller.resize$$.next(
|
|
4442
|
+
this._service.uiEventHandler(e)
|
|
4443
|
+
);
|
|
4444
|
+
}, 0);
|
|
4445
|
+
}
|
|
4446
|
+
async _initOnMainThread() {
|
|
4447
|
+
await import(`${this.props.location}`), self.postMessage({
|
|
4448
|
+
mainThread: !0,
|
|
4449
|
+
...ze(this.props, [
|
|
4450
|
+
"canvas",
|
|
4451
|
+
"location",
|
|
4452
|
+
"onReady",
|
|
4453
|
+
"loaderDataSources"
|
|
4454
|
+
])
|
|
4455
|
+
});
|
|
4304
4456
|
}
|
|
4305
|
-
async
|
|
4457
|
+
async _initOnWorkerThread() {
|
|
4306
4458
|
if (!this._service.canvas)
|
|
4307
4459
|
throw new Error("Canvas element is not initialized.");
|
|
4308
4460
|
this._service.offscreenCanvas = this._service.canvas.transferControlToOffscreen(), this._service.offscreenCanvas.width = this._service.canvas.clientWidth, this._service.offscreenCanvas.height = this._service.canvas.clientHeight;
|
|
@@ -4310,7 +4462,7 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
|
|
|
4310
4462
|
payload: {
|
|
4311
4463
|
path: this.props.location,
|
|
4312
4464
|
subject: {
|
|
4313
|
-
...
|
|
4465
|
+
...ze(this.props, [
|
|
4314
4466
|
"canvas",
|
|
4315
4467
|
"location",
|
|
4316
4468
|
"onReady",
|
|
@@ -4325,8 +4477,8 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
|
|
|
4325
4477
|
throw new Error("Unable to retrieve the worker-thread info.");
|
|
4326
4478
|
this._service.worker = e.worker, this._service.thread = e.thread;
|
|
4327
4479
|
}
|
|
4328
|
-
async
|
|
4329
|
-
|
|
4480
|
+
async _initObservables() {
|
|
4481
|
+
Nt.forEach(
|
|
4330
4482
|
(e) => this[`${e}$`] = () => {
|
|
4331
4483
|
var t;
|
|
4332
4484
|
return (t = this._controller) == null ? void 0 : t[`${e}$`];
|
|
@@ -4341,11 +4493,11 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
|
|
|
4341
4493
|
this._loaderController.serializedLoad$.subscribe((e) => {
|
|
4342
4494
|
var t, n;
|
|
4343
4495
|
if (e.resource instanceof ArrayBuffer)
|
|
4344
|
-
return (t = this.
|
|
4496
|
+
return (t = this.currentWorker) == null ? void 0 : t.postMessage(e.resource, [
|
|
4345
4497
|
e.resource
|
|
4346
4498
|
]);
|
|
4347
|
-
(n = this.
|
|
4348
|
-
token:
|
|
4499
|
+
(n = this.currentWorker) == null || n.postMessage({
|
|
4500
|
+
token: Tn,
|
|
4349
4501
|
payload: e
|
|
4350
4502
|
});
|
|
4351
4503
|
})
|
|
@@ -4353,7 +4505,7 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
|
|
|
4353
4505
|
}
|
|
4354
4506
|
async init() {
|
|
4355
4507
|
var e, t;
|
|
4356
|
-
this._initialized || (this._initialized = !0, await this._initCanvas(), await this.
|
|
4508
|
+
this._initialized || (this._initialized = !0, await this._initCanvas(), this.props.mainThread ? await this._initOnMainThread() : await this._initOnWorkerThread(), await this._initServiceWorker(), await this._initObservables(), await this._initLoader(), await this._initEvents(), (t = (e = this.props).onReady) == null || t.call(e, { module: this, container: this.container }));
|
|
4357
4509
|
}
|
|
4358
4510
|
getCanvas() {
|
|
4359
4511
|
return this._service.canvas;
|
|
@@ -4378,23 +4530,23 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
|
|
|
4378
4530
|
this._subscriptions.map((t) => t.unsubscribe()), await this._service.workerPool.terminateAll(), ((e = this._service.canvas) == null ? void 0 : e.dataset.reactive) === "true" && (document.body.removeChild(this._service.canvas), this._service.canvas.remove(), this._service.canvas = void 0), this._initialized = !1;
|
|
4379
4531
|
}
|
|
4380
4532
|
};
|
|
4381
|
-
|
|
4533
|
+
nt = ei([
|
|
4382
4534
|
ne(re.ContainerScoped),
|
|
4383
|
-
J(0, P(
|
|
4384
|
-
J(1, P(
|
|
4385
|
-
J(2, P(
|
|
4386
|
-
J(3, P(
|
|
4387
|
-
J(4, P(
|
|
4388
|
-
J(5, P(
|
|
4389
|
-
],
|
|
4535
|
+
J(0, P(Ee)),
|
|
4536
|
+
J(1, P(Je)),
|
|
4537
|
+
J(2, P(Re)),
|
|
4538
|
+
J(3, P(Ht)),
|
|
4539
|
+
J(4, P(xe)),
|
|
4540
|
+
J(5, P(tt))
|
|
4541
|
+
], nt);
|
|
4390
4542
|
const oi = (s) => {
|
|
4391
4543
|
if (!(s != null && s.location) || !URL.canParse(s.location))
|
|
4392
4544
|
throw new Error(
|
|
4393
4545
|
"Invalid register props detected. location path is required"
|
|
4394
4546
|
);
|
|
4395
|
-
const e =
|
|
4396
|
-
s.initOnConstruct = me(s.initOnConstruct) || !ge(s.initOnConstruct) ? !0 : s.initOnConstruct, s.defaultCamera = s != null && s.defaultCamera && s.defaultCamera in
|
|
4397
|
-
const t = e.resolve(
|
|
4547
|
+
const e = Dt.createChildContainer();
|
|
4548
|
+
s.initOnConstruct = me(s.initOnConstruct) || !ge(s.initOnConstruct) ? !0 : s.initOnConstruct, s.defaultCamera = s != null && s.defaultCamera && s.defaultCamera in at ? s.defaultCamera : at.PERSPECTIVE, s.withMiniCamera = me(s.withMiniCamera) || !ge(s.withMiniCamera) ? !1 : s.withMiniCamera, s.startTimer = me(s.startTimer) || !ge(s.startTimer) ? !0 : s.startTimer, s.fullScreen = me(s.fullScreen) || !ge(s.fullScreen) ? !0 : s.fullScreen, s.onReady = wn(s.onReady) ? s.onReady : void 0, e.register(Ht, { useValue: e }), e.register(xe, { useValue: s });
|
|
4549
|
+
const t = e.resolve(nt);
|
|
4398
4550
|
return {
|
|
4399
4551
|
container: e,
|
|
4400
4552
|
module: t
|
|
@@ -4402,17 +4554,17 @@ const oi = (s) => {
|
|
|
4402
4554
|
};
|
|
4403
4555
|
export {
|
|
4404
4556
|
ui as AppProxyEventHandlersBlueprint,
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4557
|
+
Ht as CONTAINER_TOKEN,
|
|
4558
|
+
at as DefaultCameraType,
|
|
4559
|
+
mn as KEYBOARD_EVENT_CODES,
|
|
4560
|
+
Tn as LOADER_SERIALIZED_LOAD_TOKEN,
|
|
4409
4561
|
si as LaunchAppProps,
|
|
4410
|
-
|
|
4411
|
-
|
|
4562
|
+
Nt as PROXY_EVENT_LISTENERS,
|
|
4563
|
+
gn as ProxyEventHandlersBlueprint,
|
|
4412
4564
|
li as ProxyEventObservablesBlueprint,
|
|
4413
4565
|
di as ProxyEventSubjectsBlueprint,
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4566
|
+
nt as RegisterModule,
|
|
4567
|
+
xe as RegisterPropsBlueprint,
|
|
4568
|
+
yn as RegisterProxyEventHandlersBlueprint,
|
|
4417
4569
|
oi as register
|
|
4418
4570
|
};
|