@quick-threejs/reactive 0.1.28 → 0.1.30

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/main.mjs CHANGED
@@ -1,35 +1,35 @@
1
- var $e = Object.defineProperty;
2
- var We = (c, e, t) => e in c ? $e(c, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[e] = t;
3
- var E = (c, e, t) => We(c, typeof e != "symbol" ? e + "" : e, t);
4
- import { s as V, C as qe, P as Ye, a as Ce, f as Qe, m as le, b as Me, J as ee, K as Je, i as y, S as Ze, c as et, W as te, d as Ie, e as tt, L as st, R as nt, U as rt, g as it, h as Oe, A as z, D as X, j as _e, Q as ot } from "./app.module-n-JVGlLg.mjs";
5
- import { k as sn, o as nn, n as rn, l as on } from "./app.module-n-JVGlLg.mjs";
6
- import { TrianglesDrawMode as at, TriangleFanDrawMode as ue, TriangleStripDrawMode as Ne, Loader as De, LoaderUtils as j, FileLoader as $, Color as D, LinearSRGBColorSpace as S, SpotLight as ct, PointLight as lt, DirectionalLight as ut, MeshBasicMaterial as B, SRGBColorSpace as N, MeshPhysicalMaterial as v, Vector2 as Pe, Matrix4 as W, Vector3 as F, Quaternion as ke, InstancedMesh as dt, InstancedBufferAttribute as ht, Object3D as Fe, TextureLoader as ft, ImageBitmapLoader as He, BufferAttribute as K, InterleavedBuffer as pt, InterleavedBufferAttribute as mt, LinearFilter as de, LinearMipmapLinearFilter as Ue, RepeatWrapping as he, NearestFilter as Ge, PointsMaterial as gt, Material as se, LineBasicMaterial as At, MeshStandardMaterial as Be, DoubleSide as Tt, PropertyBinding as _t, BufferGeometry as je, SkinnedMesh as Rt, Mesh as Et, LineSegments as wt, Line as Lt, LineLoop as xt, Points as yt, Group as ne, PerspectiveCamera as bt, MathUtils as St, OrthographicCamera as vt, Skeleton as Ct, AnimationClip as Mt, Bone as It, InterpolateLinear as Ke, ColorManagement as fe, NearestMipmapNearestFilter as Ot, LinearMipmapNearestFilter as Nt, NearestMipmapLinearFilter as Dt, ClampToEdgeWrapping as Pt, MirroredRepeatWrapping as kt, InterpolateDiscrete as Ft, FrontSide as Ht, Texture as Re, VectorKeyframeTrack as Ee, NumberKeyframeTrack as we, QuaternionKeyframeTrack as Le, Box3 as Ut, Sphere as Gt, Interpolant as Bt, LoadingManager as jt, CubeTextureLoader as Kt, AudioLoader as Vt, VideoTexture as Ve, CanvasTexture as zt } from "three";
7
- class Te {
1
+ var Xe = Object.defineProperty;
2
+ var We = (o, e, t) => e in o ? Xe(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var _ = (o, e, t) => We(o, typeof e != "symbol" ? e + "" : e, t);
4
+ import { s as V, C as $e, P as qe, a as Ce, f as Ye, m as ce, b as Me, J as ee, K as Qe, i as L, S as Je, c as Ze, W as Te, d as Ie, e as et, L as tt, R as st, U as nt, g as rt, h as Oe, A as z, D as X, j as _e, Q as it } from "./app.module-BHCAJZLN.mjs";
5
+ import { k as Zs, o as en, n as tn, l as sn } from "./app.module-BHCAJZLN.mjs";
6
+ import { TrianglesDrawMode as ot, TriangleFanDrawMode as le, TriangleStripDrawMode as Ne, Loader as Pe, FileLoader as W, SRGBColorSpace as N, LinearSRGBColorSpace as S, BufferGeometry as De, BufferAttribute as j, Color as P, ColorManagement as ue, LoaderUtils as K, SpotLight as at, PointLight as ct, DirectionalLight as lt, MeshBasicMaterial as B, MeshPhysicalMaterial as v, Vector2 as ke, Matrix4 as $, Vector3 as F, Quaternion as Fe, InstancedMesh as ut, InstancedBufferAttribute as dt, Object3D as He, TextureLoader as ht, ImageBitmapLoader as Ue, InterleavedBuffer as ft, InterleavedBufferAttribute as pt, LinearFilter as de, LinearMipmapLinearFilter as Ge, RepeatWrapping as he, NearestFilter as Be, PointsMaterial as mt, Material as te, LineBasicMaterial as gt, MeshStandardMaterial as je, DoubleSide as At, PropertyBinding as Tt, SkinnedMesh as _t, Mesh as Rt, LineSegments as Et, Line as wt, LineLoop as xt, Points as yt, Group as se, PerspectiveCamera as Lt, MathUtils as bt, OrthographicCamera as St, Skeleton as vt, AnimationClip as Ct, Bone as Mt, InterpolateLinear as Ke, NearestMipmapNearestFilter as It, LinearMipmapNearestFilter as Ot, NearestMipmapLinearFilter as Nt, ClampToEdgeWrapping as Pt, MirroredRepeatWrapping as Dt, InterpolateDiscrete as kt, FrontSide as Ft, Texture as Re, VectorKeyframeTrack as Ee, NumberKeyframeTrack as we, QuaternionKeyframeTrack as xe, Box3 as Ht, Sphere as Ut, Interpolant as Gt, LoadingManager as Bt, AudioLoader as jt } from "three";
7
+ class Ae {
8
8
  constructor() {
9
9
  /**
10
10
  * @description The app worker logic location.
11
11
  *
12
12
  * @required
13
13
  */
14
- E(this, "location");
14
+ _(this, "location");
15
15
  /**
16
16
  * @description Initialize the app on construct.
17
17
  *
18
18
  * @default true
19
19
  */
20
- E(this, "initOnConstruct");
20
+ _(this, "initOnConstruct");
21
21
  /**
22
22
  * @description App `canvas` element reference.
23
23
  *
24
24
  * @default undefined
25
25
  */
26
- E(this, "canvas");
26
+ _(this, "canvas");
27
27
  /**
28
28
  * @description Set the `canvas` view in fullscreen and auto-resize it.
29
29
  *
30
30
  * @default true
31
31
  */
32
- E(this, "fullScreen");
32
+ _(this, "fullScreen");
33
33
  /**
34
34
  * Default used camera.
35
35
  *
@@ -37,19 +37,19 @@ class Te {
37
37
  *
38
38
  * @default DefaultCameraType.PERSPECTIVE
39
39
  */
40
- E(this, "defaultCamera");
40
+ _(this, "defaultCamera");
41
41
  /**
42
42
  * @description Start timer update on launch.
43
43
  *
44
44
  * @default true
45
45
  */
46
- E(this, "startTimer");
46
+ _(this, "startTimer");
47
47
  /**
48
48
  * @description Resources to load.
49
49
  *
50
50
  * @default []
51
51
  */
52
- E(this, "loaderDataSources", []);
52
+ _(this, "loaderDataSources", []);
53
53
  /**
54
54
  * @description Will directly load the resources on initialization.
55
55
  *
@@ -57,13 +57,24 @@ class Te {
57
57
  *
58
58
  * @default true
59
59
  */
60
- E(this, "loadResourcesOnInit");
60
+ _(this, "loadResourcesOnInit");
61
61
  /**
62
62
  * @description Enable the debug mode
63
63
  *
64
+ * @remark __Deactivated if the value is `false` or `undefined`__
65
+ *
64
66
  * @default undefined
65
67
  */
66
- E(this, "enableDebug");
68
+ _(this, "enableDebug");
69
+ /**
70
+ * Will enable orbit controls for the cameras.
71
+ *
72
+ * @remark __Deactivated if the value is `false` or `undefined`__
73
+ * @remark __This property depends on {@link RegisterPropsBlueprint.enableDebug enableDebug}__
74
+ *
75
+ * @default undefined
76
+ */
77
+ _(this, "enableControls");
67
78
  /**
68
79
  * Define the {@link THREE.AxesHelper} sizes.
69
80
  *
@@ -72,7 +83,7 @@ class Te {
72
83
  *
73
84
  * @default undefined
74
85
  */
75
- E(this, "axesSizes");
86
+ _(this, "axesSizes");
76
87
  /**
77
88
  * Define the {@link THREE.GridHelper} sizes.
78
89
  *
@@ -81,231 +92,361 @@ class Te {
81
92
  *
82
93
  * @default undefined
83
94
  */
84
- E(this, "gridSizes");
95
+ _(this, "gridSizes");
85
96
  /**
86
97
  * Display a mini perfective camera at the top right corner of the screen.
87
98
  *
99
+ * @remark __Deactivated if the value is `false` or `undefined`__
100
+ * @remark __This property depends on {@link RegisterPropsBlueprint.enableDebug enableDebug}__
101
+ *
102
+ * @default undefined
103
+ */
104
+ _(this, "withMiniCamera");
105
+ /**
106
+ * Display the camera helper.
107
+ *
108
+ * @remark __Deactivated if the value is `false` or `undefined`__
88
109
  * @remark __This property depends on {@link RegisterPropsBlueprint.enableDebug enableDebug}__
89
110
  *
90
- * @default false
111
+ * @default undefined
91
112
  */
92
- E(this, "withMiniCamera");
113
+ _(this, "withCameraHelper");
93
114
  /**
94
115
  * @description Handler called when the app is ready.
95
116
  *
96
117
  * @default undefined
97
118
  */
98
- E(this, "onReady");
119
+ _(this, "onReady");
99
120
  }
100
121
  }
101
- class Js {
122
+ class qs {
102
123
  constructor() {
103
124
  /** @description Handler triggered when the app is ready. */
104
- E(this, "onReady");
125
+ _(this, "onReady");
105
126
  }
106
127
  }
107
- var Xt = Object.defineProperty, $t = Object.getOwnPropertyDescriptor, Wt = (c, e, t, r) => {
108
- for (var s = r > 1 ? void 0 : r ? $t(e, t) : e, i = c.length - 1, n; i >= 0; i--)
109
- (n = c[i]) && (s = (r ? n(e, t, s) : n(s)) || s);
110
- return r && s && Xt(e, t, s), s;
111
- };
112
- let q = class {
113
- constructor() {
114
- E(this, "workerPool", qe(void 0, !0));
115
- E(this, "canvas");
116
- E(this, "worker");
117
- E(this, "thread");
128
+ function ye(o, e) {
129
+ if (e === ot)
130
+ return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), o;
131
+ if (e === le || e === Ne) {
132
+ let t = o.getIndex();
133
+ if (t === null) {
134
+ const n = [], c = o.getAttribute("position");
135
+ if (c !== void 0) {
136
+ for (let a = 0; a < c.count; a++)
137
+ n.push(a);
138
+ o.setIndex(n), t = o.getIndex();
139
+ } else
140
+ return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), o;
141
+ }
142
+ const i = t.count - 2, s = [];
143
+ if (e === le)
144
+ for (let n = 1; n <= i; n++)
145
+ s.push(t.getX(0)), s.push(t.getX(n)), s.push(t.getX(n + 1));
146
+ else
147
+ for (let n = 0; n < i; n++)
148
+ n % 2 === 0 ? (s.push(t.getX(n)), s.push(t.getX(n + 1)), s.push(t.getX(n + 2))) : (s.push(t.getX(n + 2)), s.push(t.getX(n + 1)), s.push(t.getX(n)));
149
+ s.length / 3 !== i && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
150
+ const r = o.clone();
151
+ return r.setIndex(s), r.clearGroups(), r;
152
+ } else
153
+ return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), o;
154
+ }
155
+ const ne = /* @__PURE__ */ new WeakMap();
156
+ class Kt extends Pe {
157
+ constructor(e) {
158
+ super(e), this.decoderPath = "", this.decoderConfig = {}, this.decoderBinary = null, this.decoderPending = null, this.workerLimit = 4, this.workerPool = [], this.workerNextTaskID = 1, this.workerSourceURL = "", this.defaultAttributeIDs = {
159
+ position: "POSITION",
160
+ normal: "NORMAL",
161
+ color: "COLOR",
162
+ uv: "TEX_COORD"
163
+ }, this.defaultAttributeTypes = {
164
+ position: "Float32Array",
165
+ normal: "Float32Array",
166
+ color: "Float32Array",
167
+ uv: "Float32Array"
168
+ };
118
169
  }
119
- init(c) {
120
- this.worker = c.worker, this.thread = c.thread;
170
+ setDecoderPath(e) {
171
+ return this.decoderPath = e, this;
121
172
  }
122
- };
123
- q = Wt([
124
- V()
125
- ], q);
126
- var qt = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, Qt = (c, e, t, r) => {
127
- for (var s = r > 1 ? void 0 : r ? Yt(e, t) : e, i = c.length - 1, n; i >= 0; i--)
128
- (n = c[i]) && (s = (r ? n(e, t, s) : n(s)) || s);
129
- return r && s && qt(e, t, s), s;
130
- }, Jt = (c, e) => (t, r) => e(t, r, c);
131
- let pe = class extends Ye {
132
- constructor(e) {
133
- super();
134
- E(this, "canvas");
135
- this._service = e;
173
+ setDecoderConfig(e) {
174
+ return this.decoderConfig = e, this;
136
175
  }
137
- init(e) {
138
- this.canvas = e;
139
- for (const t of Ce) {
140
- const r = t.startsWith("mouse") || t.startsWith("pointer") || t.startsWith("touch") ? this.mouseEventHandler : t.startsWith("key") ? this.keyEventHandler : t === "resize" ? this.uiEventHandler : t === "wheel" ? this.wheelEventHandler : this.preventDefaultHandler;
141
- this[`${t}$`] = Qe(
142
- t === "resize" ? window : e,
143
- t
144
- ).pipe(
145
- // @ts-ignore
146
- le(r.bind(this)),
147
- Me((s) => !(t === "keydown" && !s))
148
- ), this[`${t}$`].subscribe((s) => {
149
- var i, n;
150
- (n = (i = this._service.thread) == null ? void 0 : i[t]) == null || n.call(i, s);
151
- });
152
- }
176
+ setWorkerLimit(e) {
177
+ return this.workerLimit = e, this;
153
178
  }
154
- preventDefaultHandler(e) {
155
- return e.preventDefault(), {
156
- type: e.type
157
- };
179
+ load(e, t, i, s) {
180
+ const r = new W(this.manager);
181
+ r.setPath(this.path), r.setResponseType("arraybuffer"), r.setRequestHeader(this.requestHeader), r.setWithCredentials(this.withCredentials), r.load(e, (n) => {
182
+ this.parse(n, t, s);
183
+ }, i, s);
158
184
  }
159
- getScreenSizes() {
160
- return {
161
- width: this.canvas.width,
162
- height: this.canvas.height,
163
- windowWidth: (window == null ? void 0 : window.innerWidth) ?? 0,
164
- windowHeight: (window == null ? void 0 : window.innerHeight) ?? 0
165
- };
185
+ parse(e, t, i = () => {
186
+ }) {
187
+ this.decodeDracoFile(e, t, null, null, N, i).catch(i);
166
188
  }
167
- uiEventHandler(e) {
168
- const t = this.canvas.getBoundingClientRect();
169
- return {
170
- ...this.getScreenSizes(),
171
- type: e.type,
172
- top: t.top,
173
- left: t.left
189
+ decodeDracoFile(e, t, i, s, r = S, n = () => {
190
+ }) {
191
+ const c = {
192
+ attributeIDs: i || this.defaultAttributeIDs,
193
+ attributeTypes: s || this.defaultAttributeTypes,
194
+ useUniqueIDs: !!i,
195
+ vertexColorSpace: r
174
196
  };
197
+ return this.decodeGeometry(e, c).then(t).catch(n);
175
198
  }
176
- mouseEventHandler(e) {
177
- return {
178
- ...this.getScreenSizes(),
179
- ...ee(e, [
180
- "ctrlKey",
181
- "metaKey",
182
- "shiftKey",
183
- "button",
184
- "pointerType",
185
- "clientX",
186
- "clientY",
187
- "pageX",
188
- "pageY"
189
- ])
190
- };
199
+ decodeGeometry(e, t) {
200
+ const i = JSON.stringify(t);
201
+ if (ne.has(e)) {
202
+ const a = ne.get(e);
203
+ if (a.key === i)
204
+ return a.promise;
205
+ if (e.byteLength === 0)
206
+ throw new Error(
207
+ "THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred."
208
+ );
209
+ }
210
+ let s;
211
+ const r = this.workerNextTaskID++, n = e.byteLength, c = this._getWorker(r, n).then((a) => (s = a, new Promise((l, d) => {
212
+ s._callbacks[r] = { resolve: l, reject: d }, s.postMessage({ type: "decode", id: r, taskConfig: t, buffer: e }, [e]);
213
+ }))).then((a) => this._createGeometry(a.geometry));
214
+ return c.catch(() => !0).then(() => {
215
+ s && r && this._releaseTask(s, r);
216
+ }), ne.set(e, {
217
+ key: i,
218
+ promise: c
219
+ }), c;
191
220
  }
192
- touchEventHandler(e) {
193
- const t = [], r = { type: e.type, touches: t };
194
- for (let s = 0; s < e.touches.length; ++s) {
195
- const i = e.touches[s];
196
- t.push({
197
- pageX: (i == null ? void 0 : i.pageX) ?? 0,
198
- pageY: (i == null ? void 0 : i.pageY) ?? 0
199
- });
221
+ _createGeometry(e) {
222
+ const t = new De();
223
+ e.index && t.setIndex(new j(e.index.array, 1));
224
+ for (let i = 0; i < e.attributes.length; i++) {
225
+ const s = e.attributes[i], r = s.name, n = s.array, c = s.itemSize, a = new j(n, c);
226
+ r === "color" && (this._assignVertexColorSpace(a, s.vertexColorSpace), a.normalized = !(n instanceof Float32Array)), t.setAttribute(r, a);
200
227
  }
201
- return { ...this.getScreenSizes(), ...r };
228
+ return t;
202
229
  }
203
- wheelEventHandler(e) {
204
- return e.preventDefault(), {
205
- ...this.getScreenSizes(),
206
- ...ee(e, ["deltaX", "deltaY"])
207
- };
230
+ _assignVertexColorSpace(e, t) {
231
+ if (t !== N) return;
232
+ const i = new P();
233
+ for (let s = 0, r = e.count; s < r; s++)
234
+ i.fromBufferAttribute(e, s), ue.toWorkingColorSpace(i, N), e.setXYZ(s, i.r, i.g, i.b);
208
235
  }
209
- keyEventHandler(e) {
210
- if (Je.includes(e.code))
211
- return e.preventDefault(), {
212
- ...this.getScreenSizes(),
213
- ...ee(e, ["ctrlKey", "metaKey", "shiftKey", "keyCode"])
214
- };
236
+ _loadLibrary(e, t) {
237
+ const i = new W(this.manager);
238
+ return i.setPath(this.decoderPath), i.setResponseType(t), i.setWithCredentials(this.withCredentials), new Promise((s, r) => {
239
+ i.load(e, s, void 0, r);
240
+ });
215
241
  }
216
- };
217
- pe = Qt([
218
- V(),
219
- Jt(0, y(q))
220
- ], pe);
221
- function xe(c, e) {
222
- if (e === at)
223
- return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), c;
224
- if (e === ue || e === Ne) {
225
- let t = c.getIndex();
226
- if (t === null) {
227
- const n = [], a = c.getAttribute("position");
228
- if (a !== void 0) {
229
- for (let o = 0; o < a.count; o++)
230
- n.push(o);
231
- c.setIndex(n), t = c.getIndex();
242
+ preload() {
243
+ return this._initDecoder(), this;
244
+ }
245
+ _initDecoder() {
246
+ if (this.decoderPending) return this.decoderPending;
247
+ const e = typeof WebAssembly != "object" || this.decoderConfig.type === "js", t = [];
248
+ return e ? t.push(this._loadLibrary("draco_decoder.js", "text")) : (t.push(this._loadLibrary("draco_wasm_wrapper.js", "text")), t.push(this._loadLibrary("draco_decoder.wasm", "arraybuffer"))), this.decoderPending = Promise.all(t).then((i) => {
249
+ const s = i[0];
250
+ e || (this.decoderConfig.wasmBinary = i[1]);
251
+ const r = Vt.toString(), n = [
252
+ "/* draco decoder */",
253
+ s,
254
+ "",
255
+ "/* worker */",
256
+ r.substring(r.indexOf("{") + 1, r.lastIndexOf("}"))
257
+ ].join(`
258
+ `);
259
+ this.workerSourceURL = URL.createObjectURL(new Blob([n]));
260
+ }), this.decoderPending;
261
+ }
262
+ _getWorker(e, t) {
263
+ return this._initDecoder().then(() => {
264
+ if (this.workerPool.length < this.workerLimit) {
265
+ const s = new Worker(this.workerSourceURL);
266
+ s._callbacks = {}, s._taskCosts = {}, s._taskLoad = 0, s.postMessage({ type: "init", decoderConfig: this.decoderConfig }), s.onmessage = function(r) {
267
+ const n = r.data;
268
+ switch (n.type) {
269
+ case "decode":
270
+ s._callbacks[n.id].resolve(n);
271
+ break;
272
+ case "error":
273
+ s._callbacks[n.id].reject(n);
274
+ break;
275
+ default:
276
+ console.error('THREE.DRACOLoader: Unexpected message, "' + n.type + '"');
277
+ }
278
+ }, this.workerPool.push(s);
232
279
  } else
233
- return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), c;
280
+ this.workerPool.sort(function(s, r) {
281
+ return s._taskLoad > r._taskLoad ? -1 : 1;
282
+ });
283
+ const i = this.workerPool[this.workerPool.length - 1];
284
+ return i._taskCosts[e] = t, i._taskLoad += t, i;
285
+ });
286
+ }
287
+ _releaseTask(e, t) {
288
+ e._taskLoad -= e._taskCosts[t], delete e._callbacks[t], delete e._taskCosts[t];
289
+ }
290
+ debug() {
291
+ console.log("Task load: ", this.workerPool.map((e) => e._taskLoad));
292
+ }
293
+ dispose() {
294
+ for (let e = 0; e < this.workerPool.length; ++e)
295
+ this.workerPool[e].terminate();
296
+ return this.workerPool.length = 0, this.workerSourceURL !== "" && URL.revokeObjectURL(this.workerSourceURL), this;
297
+ }
298
+ }
299
+ function Vt() {
300
+ let o, e;
301
+ onmessage = function(n) {
302
+ const c = n.data;
303
+ switch (c.type) {
304
+ case "init":
305
+ o = c.decoderConfig, e = new Promise(function(d) {
306
+ o.onModuleLoaded = function(u) {
307
+ d({ draco: u });
308
+ }, DracoDecoderModule(o);
309
+ });
310
+ break;
311
+ case "decode":
312
+ const a = c.buffer, l = c.taskConfig;
313
+ e.then((d) => {
314
+ const u = d.draco, h = new u.Decoder();
315
+ try {
316
+ const f = t(u, h, new Int8Array(a), l), p = f.attributes.map((A) => A.array.buffer);
317
+ f.index && p.push(f.index.array.buffer), self.postMessage({ type: "decode", id: c.id, geometry: f }, p);
318
+ } catch (f) {
319
+ console.error(f), self.postMessage({ type: "error", id: c.id, error: f.message });
320
+ } finally {
321
+ u.destroy(h);
322
+ }
323
+ });
324
+ break;
234
325
  }
235
- const r = t.count - 2, s = [];
236
- if (e === ue)
237
- for (let n = 1; n <= r; n++)
238
- s.push(t.getX(0)), s.push(t.getX(n)), s.push(t.getX(n + 1));
326
+ };
327
+ function t(n, c, a, l) {
328
+ const d = l.attributeIDs, u = l.attributeTypes;
329
+ let h, f;
330
+ const p = c.GetEncodedGeometryType(a);
331
+ if (p === n.TRIANGULAR_MESH)
332
+ h = new n.Mesh(), f = c.DecodeArrayToMesh(a, a.byteLength, h);
333
+ else if (p === n.POINT_CLOUD)
334
+ h = new n.PointCloud(), f = c.DecodeArrayToPointCloud(a, a.byteLength, h);
239
335
  else
240
- for (let n = 0; n < r; n++)
241
- n % 2 === 0 ? (s.push(t.getX(n)), s.push(t.getX(n + 1)), s.push(t.getX(n + 2))) : (s.push(t.getX(n + 2)), s.push(t.getX(n + 1)), s.push(t.getX(n)));
242
- s.length / 3 !== r && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
243
- const i = c.clone();
244
- return i.setIndex(s), i.clearGroups(), i;
245
- } else
246
- return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), c;
336
+ throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
337
+ if (!f.ok() || h.ptr === 0)
338
+ throw new Error("THREE.DRACOLoader: Decoding failed: " + f.error_msg());
339
+ const A = { index: null, attributes: [] };
340
+ for (const m in d) {
341
+ const g = self[u[m]];
342
+ let R, w;
343
+ if (l.useUniqueIDs)
344
+ w = d[m], R = c.GetAttributeByUniqueId(h, w);
345
+ else {
346
+ if (w = c.GetAttributeId(h, n[d[m]]), w === -1) continue;
347
+ R = c.GetAttribute(h, w);
348
+ }
349
+ const E = s(n, c, h, m, g, R);
350
+ m === "color" && (E.vertexColorSpace = l.vertexColorSpace), A.attributes.push(E);
351
+ }
352
+ return p === n.TRIANGULAR_MESH && (A.index = i(n, c, h)), n.destroy(h), A;
353
+ }
354
+ function i(n, c, a) {
355
+ const d = a.num_faces() * 3, u = d * 4, h = n._malloc(u);
356
+ c.GetTrianglesUInt32Array(a, u, h);
357
+ const f = new Uint32Array(n.HEAPF32.buffer, h, d).slice();
358
+ return n._free(h), { array: f, itemSize: 1 };
359
+ }
360
+ function s(n, c, a, l, d, u) {
361
+ const h = u.num_components(), p = a.num_points() * h, A = p * d.BYTES_PER_ELEMENT, m = r(n, d), g = n._malloc(A);
362
+ c.GetAttributeDataArrayForAllPoints(a, u, m, A, g);
363
+ const R = new d(n.HEAPF32.buffer, g, p).slice();
364
+ return n._free(g), {
365
+ name: l,
366
+ array: R,
367
+ itemSize: h
368
+ };
369
+ }
370
+ function r(n, c) {
371
+ switch (c) {
372
+ case Float32Array:
373
+ return n.DT_FLOAT32;
374
+ case Int8Array:
375
+ return n.DT_INT8;
376
+ case Int16Array:
377
+ return n.DT_INT16;
378
+ case Int32Array:
379
+ return n.DT_INT32;
380
+ case Uint8Array:
381
+ return n.DT_UINT8;
382
+ case Uint16Array:
383
+ return n.DT_UINT16;
384
+ case Uint32Array:
385
+ return n.DT_UINT32;
386
+ }
387
+ }
247
388
  }
248
- class Zt extends De {
389
+ class zt extends Pe {
249
390
  constructor(e) {
250
391
  super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
251
- return new rs(t);
392
+ return new Yt(t);
252
393
  }), this.register(function(t) {
253
- return new is(t);
254
- }), this.register(function(t) {
255
- return new ps(t);
394
+ return new Qt(t);
256
395
  }), this.register(function(t) {
257
- return new ms(t);
258
- }), this.register(function(t) {
259
- return new gs(t);
396
+ return new os(t);
260
397
  }), this.register(function(t) {
261
398
  return new as(t);
262
399
  }), this.register(function(t) {
263
400
  return new cs(t);
264
401
  }), this.register(function(t) {
265
- return new ls(t);
402
+ return new Zt(t);
266
403
  }), this.register(function(t) {
267
- return new us(t);
404
+ return new es(t);
268
405
  }), this.register(function(t) {
269
- return new ns(t);
406
+ return new ts(t);
270
407
  }), this.register(function(t) {
271
- return new ds(t);
408
+ return new ss(t);
272
409
  }), this.register(function(t) {
273
- return new os(t);
410
+ return new qt(t);
274
411
  }), this.register(function(t) {
275
- return new fs(t);
412
+ return new ns(t);
276
413
  }), this.register(function(t) {
277
- return new hs(t);
414
+ return new Jt(t);
278
415
  }), this.register(function(t) {
279
- return new ts(t);
416
+ return new is(t);
280
417
  }), this.register(function(t) {
281
- return new As(t);
418
+ return new rs(t);
282
419
  }), this.register(function(t) {
283
- return new Ts(t);
420
+ return new Wt(t);
421
+ }), this.register(function(t) {
422
+ return new ls(t);
423
+ }), this.register(function(t) {
424
+ return new us(t);
284
425
  });
285
426
  }
286
- load(e, t, r, s) {
287
- const i = this;
427
+ load(e, t, i, s) {
428
+ const r = this;
288
429
  let n;
289
430
  if (this.resourcePath !== "")
290
431
  n = this.resourcePath;
291
432
  else if (this.path !== "") {
292
- const l = j.extractUrlBase(e);
293
- n = j.resolveURL(l, this.path);
433
+ const l = K.extractUrlBase(e);
434
+ n = K.resolveURL(l, this.path);
294
435
  } else
295
- n = j.extractUrlBase(e);
436
+ n = K.extractUrlBase(e);
296
437
  this.manager.itemStart(e);
297
- const a = function(l) {
298
- s ? s(l) : console.error(l), i.manager.itemError(e), i.manager.itemEnd(e);
299
- }, o = new $(this.manager);
300
- o.setPath(this.path), o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(e, function(l) {
438
+ const c = function(l) {
439
+ s ? s(l) : console.error(l), r.manager.itemError(e), r.manager.itemEnd(e);
440
+ }, a = new W(this.manager);
441
+ a.setPath(this.path), a.setResponseType("arraybuffer"), a.setRequestHeader(this.requestHeader), a.setWithCredentials(this.withCredentials), a.load(e, function(l) {
301
442
  try {
302
- i.parse(l, n, function(d) {
303
- t(d), i.manager.itemEnd(e);
304
- }, a);
443
+ r.parse(l, n, function(d) {
444
+ t(d), r.manager.itemEnd(e);
445
+ }, c);
305
446
  } catch (d) {
306
- a(d);
447
+ c(d);
307
448
  }
308
- }, r, a);
449
+ }, i, c);
309
450
  }
310
451
  setDRACOLoader(e) {
311
452
  return this.dracoLoader = e, this;
@@ -322,29 +463,29 @@ class Zt extends De {
322
463
  unregister(e) {
323
464
  return this.pluginCallbacks.indexOf(e) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e), 1), this;
324
465
  }
325
- parse(e, t, r, s) {
326
- let i;
327
- const n = {}, a = {}, o = new TextDecoder();
466
+ parse(e, t, i, s) {
467
+ let r;
468
+ const n = {}, c = {}, a = new TextDecoder();
328
469
  if (typeof e == "string")
329
- i = JSON.parse(e);
470
+ r = JSON.parse(e);
330
471
  else if (e instanceof ArrayBuffer)
331
- if (o.decode(new Uint8Array(e, 0, 4)) === ze) {
472
+ if (a.decode(new Uint8Array(e, 0, 4)) === Ve) {
332
473
  try {
333
- n[T.KHR_BINARY_GLTF] = new _s(e);
474
+ n[T.KHR_BINARY_GLTF] = new ds(e);
334
475
  } catch (u) {
335
476
  s && s(u);
336
477
  return;
337
478
  }
338
- i = JSON.parse(n[T.KHR_BINARY_GLTF].content);
479
+ r = JSON.parse(n[T.KHR_BINARY_GLTF].content);
339
480
  } else
340
- i = JSON.parse(o.decode(e));
481
+ r = JSON.parse(a.decode(e));
341
482
  else
342
- i = e;
343
- if (i.asset === void 0 || i.asset.version[0] < 2) {
483
+ r = e;
484
+ if (r.asset === void 0 || r.asset.version[0] < 2) {
344
485
  s && s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
345
486
  return;
346
487
  }
347
- const l = new Os(i, {
488
+ const l = new ys(r, {
348
489
  path: t || this.resourcePath || "",
349
490
  crossOrigin: this.crossOrigin,
350
491
  requestHeader: this.requestHeader,
@@ -355,51 +496,51 @@ class Zt extends De {
355
496
  l.fileLoader.setRequestHeader(this.requestHeader);
356
497
  for (let d = 0; d < this.pluginCallbacks.length; d++) {
357
498
  const u = this.pluginCallbacks[d](l);
358
- u.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), a[u.name] = u, n[u.name] = !0;
499
+ u.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), c[u.name] = u, n[u.name] = !0;
359
500
  }
360
- if (i.extensionsUsed)
361
- for (let d = 0; d < i.extensionsUsed.length; ++d) {
362
- const u = i.extensionsUsed[d], h = i.extensionsRequired || [];
501
+ if (r.extensionsUsed)
502
+ for (let d = 0; d < r.extensionsUsed.length; ++d) {
503
+ const u = r.extensionsUsed[d], h = r.extensionsRequired || [];
363
504
  switch (u) {
364
505
  case T.KHR_MATERIALS_UNLIT:
365
- n[u] = new ss();
506
+ n[u] = new $t();
366
507
  break;
367
508
  case T.KHR_DRACO_MESH_COMPRESSION:
368
- n[u] = new Rs(i, this.dracoLoader);
509
+ n[u] = new hs(r, this.dracoLoader);
369
510
  break;
370
511
  case T.KHR_TEXTURE_TRANSFORM:
371
- n[u] = new Es();
512
+ n[u] = new fs();
372
513
  break;
373
514
  case T.KHR_MESH_QUANTIZATION:
374
- n[u] = new ws();
515
+ n[u] = new ps();
375
516
  break;
376
517
  default:
377
- h.indexOf(u) >= 0 && a[u] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + u + '".');
518
+ h.indexOf(u) >= 0 && c[u] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + u + '".');
378
519
  }
379
520
  }
380
- l.setExtensions(n), l.setPlugins(a), l.parse(r, s);
521
+ l.setExtensions(n), l.setPlugins(c), l.parse(i, s);
381
522
  }
382
523
  parseAsync(e, t) {
383
- const r = this;
384
- return new Promise(function(s, i) {
385
- r.parse(e, t, s, i);
524
+ const i = this;
525
+ return new Promise(function(s, r) {
526
+ i.parse(e, t, s, r);
386
527
  });
387
528
  }
388
529
  }
389
- function es() {
390
- let c = {};
530
+ function Xt() {
531
+ let o = {};
391
532
  return {
392
533
  get: function(e) {
393
- return c[e];
534
+ return o[e];
394
535
  },
395
536
  add: function(e, t) {
396
- c[e] = t;
537
+ o[e] = t;
397
538
  },
398
539
  remove: function(e) {
399
- delete c[e];
540
+ delete o[e];
400
541
  },
401
542
  removeAll: function() {
402
- c = {};
543
+ o = {};
403
544
  }
404
545
  };
405
546
  }
@@ -427,74 +568,74 @@ const T = {
427
568
  EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
428
569
  EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
429
570
  };
430
- class ts {
571
+ class Wt {
431
572
  constructor(e) {
432
573
  this.parser = e, this.name = T.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
433
574
  }
434
575
  _markDefs() {
435
576
  const e = this.parser, t = this.parser.json.nodes || [];
436
- for (let r = 0, s = t.length; r < s; r++) {
437
- const i = t[r];
438
- i.extensions && i.extensions[this.name] && i.extensions[this.name].light !== void 0 && e._addNodeRef(this.cache, i.extensions[this.name].light);
577
+ for (let i = 0, s = t.length; i < s; i++) {
578
+ const r = t[i];
579
+ r.extensions && r.extensions[this.name] && r.extensions[this.name].light !== void 0 && e._addNodeRef(this.cache, r.extensions[this.name].light);
439
580
  }
440
581
  }
441
582
  _loadLight(e) {
442
- const t = this.parser, r = "light:" + e;
443
- let s = t.cache.get(r);
583
+ const t = this.parser, i = "light:" + e;
584
+ let s = t.cache.get(i);
444
585
  if (s) return s;
445
- const i = t.json, o = ((i.extensions && i.extensions[this.name] || {}).lights || [])[e];
586
+ const r = t.json, a = ((r.extensions && r.extensions[this.name] || {}).lights || [])[e];
446
587
  let l;
447
- const d = new D(16777215);
448
- o.color !== void 0 && d.setRGB(o.color[0], o.color[1], o.color[2], S);
449
- const u = o.range !== void 0 ? o.range : 0;
450
- switch (o.type) {
588
+ const d = new P(16777215);
589
+ a.color !== void 0 && d.setRGB(a.color[0], a.color[1], a.color[2], S);
590
+ const u = a.range !== void 0 ? a.range : 0;
591
+ switch (a.type) {
451
592
  case "directional":
452
- l = new ut(d), l.target.position.set(0, 0, -1), l.add(l.target);
593
+ l = new lt(d), l.target.position.set(0, 0, -1), l.add(l.target);
453
594
  break;
454
595
  case "point":
455
- l = new lt(d), l.distance = u;
596
+ l = new ct(d), l.distance = u;
456
597
  break;
457
598
  case "spot":
458
- l = new ct(d), l.distance = u, o.spot = o.spot || {}, o.spot.innerConeAngle = o.spot.innerConeAngle !== void 0 ? o.spot.innerConeAngle : 0, o.spot.outerConeAngle = o.spot.outerConeAngle !== void 0 ? o.spot.outerConeAngle : Math.PI / 4, l.angle = o.spot.outerConeAngle, l.penumbra = 1 - o.spot.innerConeAngle / o.spot.outerConeAngle, l.target.position.set(0, 0, -1), l.add(l.target);
599
+ l = new at(d), l.distance = u, a.spot = a.spot || {}, a.spot.innerConeAngle = a.spot.innerConeAngle !== void 0 ? a.spot.innerConeAngle : 0, a.spot.outerConeAngle = a.spot.outerConeAngle !== void 0 ? a.spot.outerConeAngle : Math.PI / 4, l.angle = a.spot.outerConeAngle, l.penumbra = 1 - a.spot.innerConeAngle / a.spot.outerConeAngle, l.target.position.set(0, 0, -1), l.add(l.target);
459
600
  break;
460
601
  default:
461
- throw new Error("THREE.GLTFLoader: Unexpected light type: " + o.type);
602
+ throw new Error("THREE.GLTFLoader: Unexpected light type: " + a.type);
462
603
  }
463
- return l.position.set(0, 0, 0), l.decay = 2, C(l, o), o.intensity !== void 0 && (l.intensity = o.intensity), l.name = t.createUniqueName(o.name || "light_" + e), s = Promise.resolve(l), t.cache.add(r, s), s;
604
+ return l.position.set(0, 0, 0), l.decay = 2, C(l, a), a.intensity !== void 0 && (l.intensity = a.intensity), l.name = t.createUniqueName(a.name || "light_" + e), s = Promise.resolve(l), t.cache.add(i, s), s;
464
605
  }
465
606
  getDependency(e, t) {
466
607
  if (e === "light")
467
608
  return this._loadLight(t);
468
609
  }
469
610
  createNodeAttachment(e) {
470
- const t = this, r = this.parser, i = r.json.nodes[e], a = (i.extensions && i.extensions[this.name] || {}).light;
471
- return a === void 0 ? null : this._loadLight(a).then(function(o) {
472
- return r._getNodeRef(t.cache, a, o);
611
+ const t = this, i = this.parser, r = i.json.nodes[e], c = (r.extensions && r.extensions[this.name] || {}).light;
612
+ return c === void 0 ? null : this._loadLight(c).then(function(a) {
613
+ return i._getNodeRef(t.cache, c, a);
473
614
  });
474
615
  }
475
616
  }
476
- class ss {
617
+ class $t {
477
618
  constructor() {
478
619
  this.name = T.KHR_MATERIALS_UNLIT;
479
620
  }
480
621
  getMaterialType() {
481
622
  return B;
482
623
  }
483
- extendParams(e, t, r) {
624
+ extendParams(e, t, i) {
484
625
  const s = [];
485
- e.color = new D(1, 1, 1), e.opacity = 1;
486
- const i = t.pbrMetallicRoughness;
487
- if (i) {
488
- if (Array.isArray(i.baseColorFactor)) {
489
- const n = i.baseColorFactor;
626
+ e.color = new P(1, 1, 1), e.opacity = 1;
627
+ const r = t.pbrMetallicRoughness;
628
+ if (r) {
629
+ if (Array.isArray(r.baseColorFactor)) {
630
+ const n = r.baseColorFactor;
490
631
  e.color.setRGB(n[0], n[1], n[2], S), e.opacity = n[3];
491
632
  }
492
- i.baseColorTexture !== void 0 && s.push(r.assignTexture(e, "map", i.baseColorTexture, N));
633
+ r.baseColorTexture !== void 0 && s.push(i.assignTexture(e, "map", r.baseColorTexture, N));
493
634
  }
494
635
  return Promise.all(s);
495
636
  }
496
637
  }
497
- class ns {
638
+ class qt {
498
639
  constructor(e) {
499
640
  this.parser = e, this.name = T.KHR_MATERIALS_EMISSIVE_STRENGTH;
500
641
  }
@@ -502,220 +643,220 @@ class ns {
502
643
  const s = this.parser.json.materials[e];
503
644
  if (!s.extensions || !s.extensions[this.name])
504
645
  return Promise.resolve();
505
- const i = s.extensions[this.name].emissiveStrength;
506
- return i !== void 0 && (t.emissiveIntensity = i), Promise.resolve();
646
+ const r = s.extensions[this.name].emissiveStrength;
647
+ return r !== void 0 && (t.emissiveIntensity = r), Promise.resolve();
507
648
  }
508
649
  }
509
- class rs {
650
+ class Yt {
510
651
  constructor(e) {
511
652
  this.parser = e, this.name = T.KHR_MATERIALS_CLEARCOAT;
512
653
  }
513
654
  getMaterialType(e) {
514
- const r = this.parser.json.materials[e];
515
- return !r.extensions || !r.extensions[this.name] ? null : v;
655
+ const i = this.parser.json.materials[e];
656
+ return !i.extensions || !i.extensions[this.name] ? null : v;
516
657
  }
517
658
  extendMaterialParams(e, t) {
518
- const r = this.parser, s = r.json.materials[e];
659
+ const i = this.parser, s = i.json.materials[e];
519
660
  if (!s.extensions || !s.extensions[this.name])
520
661
  return Promise.resolve();
521
- const i = [], n = s.extensions[this.name];
522
- if (n.clearcoatFactor !== void 0 && (t.clearcoat = n.clearcoatFactor), n.clearcoatTexture !== void 0 && i.push(r.assignTexture(t, "clearcoatMap", n.clearcoatTexture)), n.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = n.clearcoatRoughnessFactor), n.clearcoatRoughnessTexture !== void 0 && i.push(r.assignTexture(t, "clearcoatRoughnessMap", n.clearcoatRoughnessTexture)), n.clearcoatNormalTexture !== void 0 && (i.push(r.assignTexture(t, "clearcoatNormalMap", n.clearcoatNormalTexture)), n.clearcoatNormalTexture.scale !== void 0)) {
523
- const a = n.clearcoatNormalTexture.scale;
524
- t.clearcoatNormalScale = new Pe(a, a);
662
+ const r = [], n = s.extensions[this.name];
663
+ if (n.clearcoatFactor !== void 0 && (t.clearcoat = n.clearcoatFactor), n.clearcoatTexture !== void 0 && r.push(i.assignTexture(t, "clearcoatMap", n.clearcoatTexture)), n.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = n.clearcoatRoughnessFactor), n.clearcoatRoughnessTexture !== void 0 && r.push(i.assignTexture(t, "clearcoatRoughnessMap", n.clearcoatRoughnessTexture)), n.clearcoatNormalTexture !== void 0 && (r.push(i.assignTexture(t, "clearcoatNormalMap", n.clearcoatNormalTexture)), n.clearcoatNormalTexture.scale !== void 0)) {
664
+ const c = n.clearcoatNormalTexture.scale;
665
+ t.clearcoatNormalScale = new ke(c, c);
525
666
  }
526
- return Promise.all(i);
667
+ return Promise.all(r);
527
668
  }
528
669
  }
529
- class is {
670
+ class Qt {
530
671
  constructor(e) {
531
672
  this.parser = e, this.name = T.KHR_MATERIALS_DISPERSION;
532
673
  }
533
674
  getMaterialType(e) {
534
- const r = this.parser.json.materials[e];
535
- return !r.extensions || !r.extensions[this.name] ? null : v;
675
+ const i = this.parser.json.materials[e];
676
+ return !i.extensions || !i.extensions[this.name] ? null : v;
536
677
  }
537
678
  extendMaterialParams(e, t) {
538
679
  const s = this.parser.json.materials[e];
539
680
  if (!s.extensions || !s.extensions[this.name])
540
681
  return Promise.resolve();
541
- const i = s.extensions[this.name];
542
- return t.dispersion = i.dispersion !== void 0 ? i.dispersion : 0, Promise.resolve();
682
+ const r = s.extensions[this.name];
683
+ return t.dispersion = r.dispersion !== void 0 ? r.dispersion : 0, Promise.resolve();
543
684
  }
544
685
  }
545
- class os {
686
+ class Jt {
546
687
  constructor(e) {
547
688
  this.parser = e, this.name = T.KHR_MATERIALS_IRIDESCENCE;
548
689
  }
549
690
  getMaterialType(e) {
550
- const r = this.parser.json.materials[e];
551
- return !r.extensions || !r.extensions[this.name] ? null : v;
691
+ const i = this.parser.json.materials[e];
692
+ return !i.extensions || !i.extensions[this.name] ? null : v;
552
693
  }
553
694
  extendMaterialParams(e, t) {
554
- const r = this.parser, s = r.json.materials[e];
695
+ const i = this.parser, s = i.json.materials[e];
555
696
  if (!s.extensions || !s.extensions[this.name])
556
697
  return Promise.resolve();
557
- const i = [], n = s.extensions[this.name];
558
- return n.iridescenceFactor !== void 0 && (t.iridescence = n.iridescenceFactor), n.iridescenceTexture !== void 0 && i.push(r.assignTexture(t, "iridescenceMap", n.iridescenceTexture)), n.iridescenceIor !== void 0 && (t.iridescenceIOR = n.iridescenceIor), t.iridescenceThicknessRange === void 0 && (t.iridescenceThicknessRange = [100, 400]), n.iridescenceThicknessMinimum !== void 0 && (t.iridescenceThicknessRange[0] = n.iridescenceThicknessMinimum), n.iridescenceThicknessMaximum !== void 0 && (t.iridescenceThicknessRange[1] = n.iridescenceThicknessMaximum), n.iridescenceThicknessTexture !== void 0 && i.push(r.assignTexture(t, "iridescenceThicknessMap", n.iridescenceThicknessTexture)), Promise.all(i);
698
+ const r = [], n = s.extensions[this.name];
699
+ return n.iridescenceFactor !== void 0 && (t.iridescence = n.iridescenceFactor), n.iridescenceTexture !== void 0 && r.push(i.assignTexture(t, "iridescenceMap", n.iridescenceTexture)), n.iridescenceIor !== void 0 && (t.iridescenceIOR = n.iridescenceIor), t.iridescenceThicknessRange === void 0 && (t.iridescenceThicknessRange = [100, 400]), n.iridescenceThicknessMinimum !== void 0 && (t.iridescenceThicknessRange[0] = n.iridescenceThicknessMinimum), n.iridescenceThicknessMaximum !== void 0 && (t.iridescenceThicknessRange[1] = n.iridescenceThicknessMaximum), n.iridescenceThicknessTexture !== void 0 && r.push(i.assignTexture(t, "iridescenceThicknessMap", n.iridescenceThicknessTexture)), Promise.all(r);
559
700
  }
560
701
  }
561
- class as {
702
+ class Zt {
562
703
  constructor(e) {
563
704
  this.parser = e, this.name = T.KHR_MATERIALS_SHEEN;
564
705
  }
565
706
  getMaterialType(e) {
566
- const r = this.parser.json.materials[e];
567
- return !r.extensions || !r.extensions[this.name] ? null : v;
707
+ const i = this.parser.json.materials[e];
708
+ return !i.extensions || !i.extensions[this.name] ? null : v;
568
709
  }
569
710
  extendMaterialParams(e, t) {
570
- const r = this.parser, s = r.json.materials[e];
711
+ const i = this.parser, s = i.json.materials[e];
571
712
  if (!s.extensions || !s.extensions[this.name])
572
713
  return Promise.resolve();
573
- const i = [];
574
- t.sheenColor = new D(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1;
714
+ const r = [];
715
+ t.sheenColor = new P(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1;
575
716
  const n = s.extensions[this.name];
576
717
  if (n.sheenColorFactor !== void 0) {
577
- const a = n.sheenColorFactor;
578
- t.sheenColor.setRGB(a[0], a[1], a[2], S);
718
+ const c = n.sheenColorFactor;
719
+ t.sheenColor.setRGB(c[0], c[1], c[2], S);
579
720
  }
580
- return n.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = n.sheenRoughnessFactor), n.sheenColorTexture !== void 0 && i.push(r.assignTexture(t, "sheenColorMap", n.sheenColorTexture, N)), n.sheenRoughnessTexture !== void 0 && i.push(r.assignTexture(t, "sheenRoughnessMap", n.sheenRoughnessTexture)), Promise.all(i);
721
+ return n.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = n.sheenRoughnessFactor), n.sheenColorTexture !== void 0 && r.push(i.assignTexture(t, "sheenColorMap", n.sheenColorTexture, N)), n.sheenRoughnessTexture !== void 0 && r.push(i.assignTexture(t, "sheenRoughnessMap", n.sheenRoughnessTexture)), Promise.all(r);
581
722
  }
582
723
  }
583
- class cs {
724
+ class es {
584
725
  constructor(e) {
585
726
  this.parser = e, this.name = T.KHR_MATERIALS_TRANSMISSION;
586
727
  }
587
728
  getMaterialType(e) {
588
- const r = this.parser.json.materials[e];
589
- return !r.extensions || !r.extensions[this.name] ? null : v;
729
+ const i = this.parser.json.materials[e];
730
+ return !i.extensions || !i.extensions[this.name] ? null : v;
590
731
  }
591
732
  extendMaterialParams(e, t) {
592
- const r = this.parser, s = r.json.materials[e];
733
+ const i = this.parser, s = i.json.materials[e];
593
734
  if (!s.extensions || !s.extensions[this.name])
594
735
  return Promise.resolve();
595
- const i = [], n = s.extensions[this.name];
596
- return n.transmissionFactor !== void 0 && (t.transmission = n.transmissionFactor), n.transmissionTexture !== void 0 && i.push(r.assignTexture(t, "transmissionMap", n.transmissionTexture)), Promise.all(i);
736
+ const r = [], n = s.extensions[this.name];
737
+ return n.transmissionFactor !== void 0 && (t.transmission = n.transmissionFactor), n.transmissionTexture !== void 0 && r.push(i.assignTexture(t, "transmissionMap", n.transmissionTexture)), Promise.all(r);
597
738
  }
598
739
  }
599
- class ls {
740
+ class ts {
600
741
  constructor(e) {
601
742
  this.parser = e, this.name = T.KHR_MATERIALS_VOLUME;
602
743
  }
603
744
  getMaterialType(e) {
604
- const r = this.parser.json.materials[e];
605
- return !r.extensions || !r.extensions[this.name] ? null : v;
745
+ const i = this.parser.json.materials[e];
746
+ return !i.extensions || !i.extensions[this.name] ? null : v;
606
747
  }
607
748
  extendMaterialParams(e, t) {
608
- const r = this.parser, s = r.json.materials[e];
749
+ const i = this.parser, s = i.json.materials[e];
609
750
  if (!s.extensions || !s.extensions[this.name])
610
751
  return Promise.resolve();
611
- const i = [], n = s.extensions[this.name];
612
- t.thickness = n.thicknessFactor !== void 0 ? n.thicknessFactor : 0, n.thicknessTexture !== void 0 && i.push(r.assignTexture(t, "thicknessMap", n.thicknessTexture)), t.attenuationDistance = n.attenuationDistance || 1 / 0;
613
- const a = n.attenuationColor || [1, 1, 1];
614
- return t.attenuationColor = new D().setRGB(a[0], a[1], a[2], S), Promise.all(i);
752
+ const r = [], n = s.extensions[this.name];
753
+ t.thickness = n.thicknessFactor !== void 0 ? n.thicknessFactor : 0, n.thicknessTexture !== void 0 && r.push(i.assignTexture(t, "thicknessMap", n.thicknessTexture)), t.attenuationDistance = n.attenuationDistance || 1 / 0;
754
+ const c = n.attenuationColor || [1, 1, 1];
755
+ return t.attenuationColor = new P().setRGB(c[0], c[1], c[2], S), Promise.all(r);
615
756
  }
616
757
  }
617
- class us {
758
+ class ss {
618
759
  constructor(e) {
619
760
  this.parser = e, this.name = T.KHR_MATERIALS_IOR;
620
761
  }
621
762
  getMaterialType(e) {
622
- const r = this.parser.json.materials[e];
623
- return !r.extensions || !r.extensions[this.name] ? null : v;
763
+ const i = this.parser.json.materials[e];
764
+ return !i.extensions || !i.extensions[this.name] ? null : v;
624
765
  }
625
766
  extendMaterialParams(e, t) {
626
767
  const s = this.parser.json.materials[e];
627
768
  if (!s.extensions || !s.extensions[this.name])
628
769
  return Promise.resolve();
629
- const i = s.extensions[this.name];
630
- return t.ior = i.ior !== void 0 ? i.ior : 1.5, Promise.resolve();
770
+ const r = s.extensions[this.name];
771
+ return t.ior = r.ior !== void 0 ? r.ior : 1.5, Promise.resolve();
631
772
  }
632
773
  }
633
- class ds {
774
+ class ns {
634
775
  constructor(e) {
635
776
  this.parser = e, this.name = T.KHR_MATERIALS_SPECULAR;
636
777
  }
637
778
  getMaterialType(e) {
638
- const r = this.parser.json.materials[e];
639
- return !r.extensions || !r.extensions[this.name] ? null : v;
779
+ const i = this.parser.json.materials[e];
780
+ return !i.extensions || !i.extensions[this.name] ? null : v;
640
781
  }
641
782
  extendMaterialParams(e, t) {
642
- const r = this.parser, s = r.json.materials[e];
783
+ const i = this.parser, s = i.json.materials[e];
643
784
  if (!s.extensions || !s.extensions[this.name])
644
785
  return Promise.resolve();
645
- const i = [], n = s.extensions[this.name];
646
- t.specularIntensity = n.specularFactor !== void 0 ? n.specularFactor : 1, n.specularTexture !== void 0 && i.push(r.assignTexture(t, "specularIntensityMap", n.specularTexture));
647
- const a = n.specularColorFactor || [1, 1, 1];
648
- return t.specularColor = new D().setRGB(a[0], a[1], a[2], S), n.specularColorTexture !== void 0 && i.push(r.assignTexture(t, "specularColorMap", n.specularColorTexture, N)), Promise.all(i);
786
+ const r = [], n = s.extensions[this.name];
787
+ t.specularIntensity = n.specularFactor !== void 0 ? n.specularFactor : 1, n.specularTexture !== void 0 && r.push(i.assignTexture(t, "specularIntensityMap", n.specularTexture));
788
+ const c = n.specularColorFactor || [1, 1, 1];
789
+ return t.specularColor = new P().setRGB(c[0], c[1], c[2], S), n.specularColorTexture !== void 0 && r.push(i.assignTexture(t, "specularColorMap", n.specularColorTexture, N)), Promise.all(r);
649
790
  }
650
791
  }
651
- class hs {
792
+ class rs {
652
793
  constructor(e) {
653
794
  this.parser = e, this.name = T.EXT_MATERIALS_BUMP;
654
795
  }
655
796
  getMaterialType(e) {
656
- const r = this.parser.json.materials[e];
657
- return !r.extensions || !r.extensions[this.name] ? null : v;
797
+ const i = this.parser.json.materials[e];
798
+ return !i.extensions || !i.extensions[this.name] ? null : v;
658
799
  }
659
800
  extendMaterialParams(e, t) {
660
- const r = this.parser, s = r.json.materials[e];
801
+ const i = this.parser, s = i.json.materials[e];
661
802
  if (!s.extensions || !s.extensions[this.name])
662
803
  return Promise.resolve();
663
- const i = [], n = s.extensions[this.name];
664
- return t.bumpScale = n.bumpFactor !== void 0 ? n.bumpFactor : 1, n.bumpTexture !== void 0 && i.push(r.assignTexture(t, "bumpMap", n.bumpTexture)), Promise.all(i);
804
+ const r = [], n = s.extensions[this.name];
805
+ return t.bumpScale = n.bumpFactor !== void 0 ? n.bumpFactor : 1, n.bumpTexture !== void 0 && r.push(i.assignTexture(t, "bumpMap", n.bumpTexture)), Promise.all(r);
665
806
  }
666
807
  }
667
- class fs {
808
+ class is {
668
809
  constructor(e) {
669
810
  this.parser = e, this.name = T.KHR_MATERIALS_ANISOTROPY;
670
811
  }
671
812
  getMaterialType(e) {
672
- const r = this.parser.json.materials[e];
673
- return !r.extensions || !r.extensions[this.name] ? null : v;
813
+ const i = this.parser.json.materials[e];
814
+ return !i.extensions || !i.extensions[this.name] ? null : v;
674
815
  }
675
816
  extendMaterialParams(e, t) {
676
- const r = this.parser, s = r.json.materials[e];
817
+ const i = this.parser, s = i.json.materials[e];
677
818
  if (!s.extensions || !s.extensions[this.name])
678
819
  return Promise.resolve();
679
- const i = [], n = s.extensions[this.name];
680
- return n.anisotropyStrength !== void 0 && (t.anisotropy = n.anisotropyStrength), n.anisotropyRotation !== void 0 && (t.anisotropyRotation = n.anisotropyRotation), n.anisotropyTexture !== void 0 && i.push(r.assignTexture(t, "anisotropyMap", n.anisotropyTexture)), Promise.all(i);
820
+ const r = [], n = s.extensions[this.name];
821
+ return n.anisotropyStrength !== void 0 && (t.anisotropy = n.anisotropyStrength), n.anisotropyRotation !== void 0 && (t.anisotropyRotation = n.anisotropyRotation), n.anisotropyTexture !== void 0 && r.push(i.assignTexture(t, "anisotropyMap", n.anisotropyTexture)), Promise.all(r);
681
822
  }
682
823
  }
683
- class ps {
824
+ class os {
684
825
  constructor(e) {
685
826
  this.parser = e, this.name = T.KHR_TEXTURE_BASISU;
686
827
  }
687
828
  loadTexture(e) {
688
- const t = this.parser, r = t.json, s = r.textures[e];
829
+ const t = this.parser, i = t.json, s = i.textures[e];
689
830
  if (!s.extensions || !s.extensions[this.name])
690
831
  return null;
691
- const i = s.extensions[this.name], n = t.options.ktx2Loader;
832
+ const r = s.extensions[this.name], n = t.options.ktx2Loader;
692
833
  if (!n) {
693
- if (r.extensionsRequired && r.extensionsRequired.indexOf(this.name) >= 0)
834
+ if (i.extensionsRequired && i.extensionsRequired.indexOf(this.name) >= 0)
694
835
  throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
695
836
  return null;
696
837
  }
697
- return t.loadTextureImage(e, i.source, n);
838
+ return t.loadTextureImage(e, r.source, n);
698
839
  }
699
840
  }
700
- class ms {
841
+ class as {
701
842
  constructor(e) {
702
843
  this.parser = e, this.name = T.EXT_TEXTURE_WEBP, this.isSupported = null;
703
844
  }
704
845
  loadTexture(e) {
705
- const t = this.name, r = this.parser, s = r.json, i = s.textures[e];
706
- if (!i.extensions || !i.extensions[t])
846
+ const t = this.name, i = this.parser, s = i.json, r = s.textures[e];
847
+ if (!r.extensions || !r.extensions[t])
707
848
  return null;
708
- const n = i.extensions[t], a = s.images[n.source];
709
- let o = r.textureLoader;
710
- if (a.uri) {
711
- const l = r.options.manager.getHandler(a.uri);
712
- l !== null && (o = l);
849
+ const n = r.extensions[t], c = s.images[n.source];
850
+ let a = i.textureLoader;
851
+ if (c.uri) {
852
+ const l = i.options.manager.getHandler(c.uri);
853
+ l !== null && (a = l);
713
854
  }
714
855
  return this.detectSupport().then(function(l) {
715
- if (l) return r.loadTextureImage(e, n.source, o);
856
+ if (l) return i.loadTextureImage(e, n.source, a);
716
857
  if (s.extensionsRequired && s.extensionsRequired.indexOf(t) >= 0)
717
858
  throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
718
- return r.loadTexture(e);
859
+ return i.loadTexture(e);
719
860
  });
720
861
  }
721
862
  detectSupport() {
@@ -727,25 +868,25 @@ class ms {
727
868
  })), this.isSupported;
728
869
  }
729
870
  }
730
- class gs {
871
+ class cs {
731
872
  constructor(e) {
732
873
  this.parser = e, this.name = T.EXT_TEXTURE_AVIF, this.isSupported = null;
733
874
  }
734
875
  loadTexture(e) {
735
- const t = this.name, r = this.parser, s = r.json, i = s.textures[e];
736
- if (!i.extensions || !i.extensions[t])
876
+ const t = this.name, i = this.parser, s = i.json, r = s.textures[e];
877
+ if (!r.extensions || !r.extensions[t])
737
878
  return null;
738
- const n = i.extensions[t], a = s.images[n.source];
739
- let o = r.textureLoader;
740
- if (a.uri) {
741
- const l = r.options.manager.getHandler(a.uri);
742
- l !== null && (o = l);
879
+ const n = r.extensions[t], c = s.images[n.source];
880
+ let a = i.textureLoader;
881
+ if (c.uri) {
882
+ const l = i.options.manager.getHandler(c.uri);
883
+ l !== null && (a = l);
743
884
  }
744
885
  return this.detectSupport().then(function(l) {
745
- if (l) return r.loadTextureImage(e, n.source, o);
886
+ if (l) return i.loadTextureImage(e, n.source, a);
746
887
  if (s.extensionsRequired && s.extensionsRequired.indexOf(t) >= 0)
747
888
  throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");
748
- return r.loadTexture(e);
889
+ return i.loadTexture(e);
749
890
  });
750
891
  }
751
892
  detectSupport() {
@@ -757,21 +898,21 @@ class gs {
757
898
  })), this.isSupported;
758
899
  }
759
900
  }
760
- class As {
901
+ class ls {
761
902
  constructor(e) {
762
903
  this.name = T.EXT_MESHOPT_COMPRESSION, this.parser = e;
763
904
  }
764
905
  loadBufferView(e) {
765
- const t = this.parser.json, r = t.bufferViews[e];
766
- if (r.extensions && r.extensions[this.name]) {
767
- const s = r.extensions[this.name], i = this.parser.getDependency("buffer", s.buffer), n = this.parser.options.meshoptDecoder;
906
+ const t = this.parser.json, i = t.bufferViews[e];
907
+ if (i.extensions && i.extensions[this.name]) {
908
+ const s = i.extensions[this.name], r = this.parser.getDependency("buffer", s.buffer), n = this.parser.options.meshoptDecoder;
768
909
  if (!n || !n.supported) {
769
910
  if (t.extensionsRequired && t.extensionsRequired.indexOf(this.name) >= 0)
770
911
  throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
771
912
  return null;
772
913
  }
773
- return i.then(function(a) {
774
- const o = s.byteOffset || 0, l = s.byteLength || 0, d = s.count, u = s.byteStride, h = new Uint8Array(a, o, l);
914
+ return r.then(function(c) {
915
+ const a = s.byteOffset || 0, l = s.byteLength || 0, d = s.count, u = s.byteStride, h = new Uint8Array(c, a, l);
775
916
  return n.decodeGltfBufferAsync ? n.decodeGltfBufferAsync(d, u, h, s.mode, s.filter).then(function(f) {
776
917
  return f.buffer;
777
918
  }) : n.ready.then(function() {
@@ -783,103 +924,103 @@ class As {
783
924
  return null;
784
925
  }
785
926
  }
786
- class Ts {
927
+ class us {
787
928
  constructor(e) {
788
929
  this.name = T.EXT_MESH_GPU_INSTANCING, this.parser = e;
789
930
  }
790
931
  createNodeMesh(e) {
791
- const t = this.parser.json, r = t.nodes[e];
792
- if (!r.extensions || !r.extensions[this.name] || r.mesh === void 0)
932
+ const t = this.parser.json, i = t.nodes[e];
933
+ if (!i.extensions || !i.extensions[this.name] || i.mesh === void 0)
793
934
  return null;
794
- const s = t.meshes[r.mesh];
935
+ const s = t.meshes[i.mesh];
795
936
  for (const l of s.primitives)
796
- if (l.mode !== L.TRIANGLES && l.mode !== L.TRIANGLE_STRIP && l.mode !== L.TRIANGLE_FAN && l.mode !== void 0)
937
+ if (l.mode !== x.TRIANGLES && l.mode !== x.TRIANGLE_STRIP && l.mode !== x.TRIANGLE_FAN && l.mode !== void 0)
797
938
  return null;
798
- const n = r.extensions[this.name].attributes, a = [], o = {};
939
+ const n = i.extensions[this.name].attributes, c = [], a = {};
799
940
  for (const l in n)
800
- a.push(this.parser.getDependency("accessor", n[l]).then((d) => (o[l] = d, o[l])));
801
- return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((l) => {
941
+ c.push(this.parser.getDependency("accessor", n[l]).then((d) => (a[l] = d, a[l])));
942
+ return c.length < 1 ? null : (c.push(this.parser.createNodeMesh(e)), Promise.all(c).then((l) => {
802
943
  const d = l.pop(), u = d.isGroup ? d.children : [d], h = l[0].count, f = [];
803
944
  for (const p of u) {
804
- const A = new W(), m = new F(), g = new ke(), _ = new F(1, 1, 1), w = new dt(p.geometry, p.material, h);
805
- for (let R = 0; R < h; R++)
806
- o.TRANSLATION && m.fromBufferAttribute(o.TRANSLATION, R), o.ROTATION && g.fromBufferAttribute(o.ROTATION, R), o.SCALE && _.fromBufferAttribute(o.SCALE, R), w.setMatrixAt(R, A.compose(m, g, _));
807
- for (const R in o)
808
- if (R === "_COLOR_0") {
809
- const b = o[R];
810
- w.instanceColor = new ht(b.array, b.itemSize, b.normalized);
811
- } else R !== "TRANSLATION" && R !== "ROTATION" && R !== "SCALE" && p.geometry.setAttribute(R, o[R]);
812
- Fe.prototype.copy.call(w, p), this.parser.assignFinalMaterial(w), f.push(w);
945
+ const A = new $(), m = new F(), g = new Fe(), R = new F(1, 1, 1), w = new ut(p.geometry, p.material, h);
946
+ for (let E = 0; E < h; E++)
947
+ a.TRANSLATION && m.fromBufferAttribute(a.TRANSLATION, E), a.ROTATION && g.fromBufferAttribute(a.ROTATION, E), a.SCALE && R.fromBufferAttribute(a.SCALE, E), w.setMatrixAt(E, A.compose(m, g, R));
948
+ for (const E in a)
949
+ if (E === "_COLOR_0") {
950
+ const b = a[E];
951
+ w.instanceColor = new dt(b.array, b.itemSize, b.normalized);
952
+ } else E !== "TRANSLATION" && E !== "ROTATION" && E !== "SCALE" && p.geometry.setAttribute(E, a[E]);
953
+ He.prototype.copy.call(w, p), this.parser.assignFinalMaterial(w), f.push(w);
813
954
  }
814
955
  return d.isGroup ? (d.clear(), d.add(...f), d) : f[0];
815
956
  }));
816
957
  }
817
958
  }
818
- const ze = "glTF", G = 12, ye = { JSON: 1313821514, BIN: 5130562 };
819
- class _s {
959
+ const Ve = "glTF", G = 12, Le = { JSON: 1313821514, BIN: 5130562 };
960
+ class ds {
820
961
  constructor(e) {
821
962
  this.name = T.KHR_BINARY_GLTF, this.content = null, this.body = null;
822
- const t = new DataView(e, 0, G), r = new TextDecoder();
963
+ const t = new DataView(e, 0, G), i = new TextDecoder();
823
964
  if (this.header = {
824
- magic: r.decode(new Uint8Array(e.slice(0, 4))),
965
+ magic: i.decode(new Uint8Array(e.slice(0, 4))),
825
966
  version: t.getUint32(4, !0),
826
967
  length: t.getUint32(8, !0)
827
- }, this.header.magic !== ze)
968
+ }, this.header.magic !== Ve)
828
969
  throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
829
970
  if (this.header.version < 2)
830
971
  throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
831
- const s = this.header.length - G, i = new DataView(e, G);
972
+ const s = this.header.length - G, r = new DataView(e, G);
832
973
  let n = 0;
833
974
  for (; n < s; ) {
834
- const a = i.getUint32(n, !0);
975
+ const c = r.getUint32(n, !0);
835
976
  n += 4;
836
- const o = i.getUint32(n, !0);
837
- if (n += 4, o === ye.JSON) {
838
- const l = new Uint8Array(e, G + n, a);
839
- this.content = r.decode(l);
840
- } else if (o === ye.BIN) {
977
+ const a = r.getUint32(n, !0);
978
+ if (n += 4, a === Le.JSON) {
979
+ const l = new Uint8Array(e, G + n, c);
980
+ this.content = i.decode(l);
981
+ } else if (a === Le.BIN) {
841
982
  const l = G + n;
842
- this.body = e.slice(l, l + a);
983
+ this.body = e.slice(l, l + c);
843
984
  }
844
- n += a;
985
+ n += c;
845
986
  }
846
987
  if (this.content === null)
847
988
  throw new Error("THREE.GLTFLoader: JSON content not found.");
848
989
  }
849
990
  }
850
- class Rs {
991
+ class hs {
851
992
  constructor(e, t) {
852
993
  if (!t)
853
994
  throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
854
995
  this.name = T.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
855
996
  }
856
997
  decodePrimitive(e, t) {
857
- const r = this.json, s = this.dracoLoader, i = e.extensions[this.name].bufferView, n = e.extensions[this.name].attributes, a = {}, o = {}, l = {};
998
+ const i = this.json, s = this.dracoLoader, r = e.extensions[this.name].bufferView, n = e.extensions[this.name].attributes, c = {}, a = {}, l = {};
858
999
  for (const d in n) {
859
- const u = me[d] || d.toLowerCase();
860
- a[u] = n[d];
1000
+ const u = fe[d] || d.toLowerCase();
1001
+ c[u] = n[d];
861
1002
  }
862
1003
  for (const d in e.attributes) {
863
- const u = me[d] || d.toLowerCase();
1004
+ const u = fe[d] || d.toLowerCase();
864
1005
  if (n[d] !== void 0) {
865
- const h = r.accessors[e.attributes[d]], f = H[h.componentType];
866
- l[u] = f.name, o[u] = h.normalized === !0;
1006
+ const h = i.accessors[e.attributes[d]], f = H[h.componentType];
1007
+ l[u] = f.name, a[u] = h.normalized === !0;
867
1008
  }
868
1009
  }
869
- return t.getDependency("bufferView", i).then(function(d) {
1010
+ return t.getDependency("bufferView", r).then(function(d) {
870
1011
  return new Promise(function(u, h) {
871
1012
  s.decodeDracoFile(d, function(f) {
872
1013
  for (const p in f.attributes) {
873
- const A = f.attributes[p], m = o[p];
1014
+ const A = f.attributes[p], m = a[p];
874
1015
  m !== void 0 && (A.normalized = m);
875
1016
  }
876
1017
  u(f);
877
- }, a, l, S, h);
1018
+ }, c, l, S, h);
878
1019
  });
879
1020
  });
880
1021
  }
881
1022
  }
882
- class Es {
1023
+ class fs {
883
1024
  constructor() {
884
1025
  this.name = T.KHR_TEXTURE_TRANSFORM;
885
1026
  }
@@ -887,38 +1028,38 @@ class Es {
887
1028
  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;
888
1029
  }
889
1030
  }
890
- class ws {
1031
+ class ps {
891
1032
  constructor() {
892
1033
  this.name = T.KHR_MESH_QUANTIZATION;
893
1034
  }
894
1035
  }
895
- class Xe extends Bt {
896
- constructor(e, t, r, s) {
897
- super(e, t, r, s);
1036
+ class ze extends Gt {
1037
+ constructor(e, t, i, s) {
1038
+ super(e, t, i, s);
898
1039
  }
899
1040
  copySampleValue_(e) {
900
- const t = this.resultBuffer, r = this.sampleValues, s = this.valueSize, i = e * s * 3 + s;
1041
+ const t = this.resultBuffer, i = this.sampleValues, s = this.valueSize, r = e * s * 3 + s;
901
1042
  for (let n = 0; n !== s; n++)
902
- t[n] = r[i + n];
1043
+ t[n] = i[r + n];
903
1044
  return t;
904
1045
  }
905
- interpolate_(e, t, r, s) {
906
- const i = this.resultBuffer, n = this.sampleValues, a = this.valueSize, o = a * 2, l = a * 3, d = s - t, u = (r - t) / d, h = u * u, f = h * u, p = e * l, A = p - l, m = -2 * f + 3 * h, g = f - h, _ = 1 - m, w = g - h + u;
907
- for (let R = 0; R !== a; R++) {
908
- const b = n[A + R + a], M = n[A + R + o] * d, x = n[p + R + a], U = n[p + R] * d;
909
- i[R] = _ * b + w * M + m * x + g * U;
1046
+ interpolate_(e, t, i, s) {
1047
+ const r = this.resultBuffer, n = this.sampleValues, c = this.valueSize, a = c * 2, l = c * 3, d = s - t, u = (i - t) / d, h = u * u, f = h * u, p = e * l, A = p - l, m = -2 * f + 3 * h, g = f - h, R = 1 - m, w = g - h + u;
1048
+ for (let E = 0; E !== c; E++) {
1049
+ const b = n[A + E + c], M = n[A + E + a] * d, y = n[p + E + c], U = n[p + E] * d;
1050
+ r[E] = R * b + w * M + m * y + g * U;
910
1051
  }
911
- return i;
1052
+ return r;
912
1053
  }
913
1054
  }
914
- const Ls = new ke();
915
- class xs extends Xe {
916
- interpolate_(e, t, r, s) {
917
- const i = super.interpolate_(e, t, r, s);
918
- return Ls.fromArray(i).normalize().toArray(i), i;
1055
+ const ms = new Fe();
1056
+ class gs extends ze {
1057
+ interpolate_(e, t, i, s) {
1058
+ const r = super.interpolate_(e, t, i, s);
1059
+ return ms.fromArray(r).normalize().toArray(r), r;
919
1060
  }
920
1061
  }
921
- const L = {
1062
+ const x = {
922
1063
  FLOAT: 5126,
923
1064
  //FLOAT_MAT2: 35674,
924
1065
  FLOAT_MAT3: 35675,
@@ -946,15 +1087,15 @@ const L = {
946
1087
  5125: Uint32Array,
947
1088
  5126: Float32Array
948
1089
  }, be = {
949
- 9728: Ge,
1090
+ 9728: Be,
950
1091
  9729: de,
951
- 9984: Ot,
952
- 9985: Nt,
953
- 9986: Dt,
954
- 9987: Ue
1092
+ 9984: It,
1093
+ 9985: Ot,
1094
+ 9986: Nt,
1095
+ 9987: Ge
955
1096
  }, Se = {
956
1097
  33071: Pt,
957
- 33648: kt,
1098
+ 33648: Dt,
958
1099
  10497: he
959
1100
  }, re = {
960
1101
  SCALAR: 1,
@@ -964,7 +1105,7 @@ const L = {
964
1105
  MAT2: 4,
965
1106
  MAT3: 9,
966
1107
  MAT4: 16
967
- }, me = {
1108
+ }, fe = {
968
1109
  POSITION: "position",
969
1110
  NORMAL: "normal",
970
1111
  TANGENT: "tangent",
@@ -980,98 +1121,98 @@ const L = {
980
1121
  translation: "position",
981
1122
  rotation: "quaternion",
982
1123
  weights: "morphTargetInfluences"
983
- }, ys = {
1124
+ }, As = {
984
1125
  CUBICSPLINE: void 0,
985
1126
  // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
986
1127
  // keyframe track will be initialized with a default interpolation type, then modified.
987
1128
  LINEAR: Ke,
988
- STEP: Ft
1129
+ STEP: kt
989
1130
  }, ie = {
990
1131
  OPAQUE: "OPAQUE",
991
1132
  MASK: "MASK",
992
1133
  BLEND: "BLEND"
993
1134
  };
994
- function bs(c) {
995
- return c.DefaultMaterial === void 0 && (c.DefaultMaterial = new Be({
1135
+ function Ts(o) {
1136
+ return o.DefaultMaterial === void 0 && (o.DefaultMaterial = new je({
996
1137
  color: 16777215,
997
1138
  emissive: 0,
998
1139
  metalness: 1,
999
1140
  roughness: 1,
1000
1141
  transparent: !1,
1001
1142
  depthTest: !0,
1002
- side: Ht
1003
- })), c.DefaultMaterial;
1143
+ side: Ft
1144
+ })), o.DefaultMaterial;
1004
1145
  }
1005
- function P(c, e, t) {
1006
- for (const r in t.extensions)
1007
- c[r] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[r] = t.extensions[r]);
1146
+ function D(o, e, t) {
1147
+ for (const i in t.extensions)
1148
+ o[i] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[i] = t.extensions[i]);
1008
1149
  }
1009
- function C(c, e) {
1010
- e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(c.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
1150
+ function C(o, e) {
1151
+ e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(o.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
1011
1152
  }
1012
- function Ss(c, e, t) {
1013
- let r = !1, s = !1, i = !1;
1153
+ function _s(o, e, t) {
1154
+ let i = !1, s = !1, r = !1;
1014
1155
  for (let l = 0, d = e.length; l < d; l++) {
1015
1156
  const u = e[l];
1016
- if (u.POSITION !== void 0 && (r = !0), u.NORMAL !== void 0 && (s = !0), u.COLOR_0 !== void 0 && (i = !0), r && s && i) break;
1157
+ if (u.POSITION !== void 0 && (i = !0), u.NORMAL !== void 0 && (s = !0), u.COLOR_0 !== void 0 && (r = !0), i && s && r) break;
1017
1158
  }
1018
- if (!r && !s && !i) return Promise.resolve(c);
1019
- const n = [], a = [], o = [];
1159
+ if (!i && !s && !r) return Promise.resolve(o);
1160
+ const n = [], c = [], a = [];
1020
1161
  for (let l = 0, d = e.length; l < d; l++) {
1021
1162
  const u = e[l];
1022
- if (r) {
1023
- const h = u.POSITION !== void 0 ? t.getDependency("accessor", u.POSITION) : c.attributes.position;
1163
+ if (i) {
1164
+ const h = u.POSITION !== void 0 ? t.getDependency("accessor", u.POSITION) : o.attributes.position;
1024
1165
  n.push(h);
1025
1166
  }
1026
1167
  if (s) {
1027
- const h = u.NORMAL !== void 0 ? t.getDependency("accessor", u.NORMAL) : c.attributes.normal;
1028
- a.push(h);
1168
+ const h = u.NORMAL !== void 0 ? t.getDependency("accessor", u.NORMAL) : o.attributes.normal;
1169
+ c.push(h);
1029
1170
  }
1030
- if (i) {
1031
- const h = u.COLOR_0 !== void 0 ? t.getDependency("accessor", u.COLOR_0) : c.attributes.color;
1032
- o.push(h);
1171
+ if (r) {
1172
+ const h = u.COLOR_0 !== void 0 ? t.getDependency("accessor", u.COLOR_0) : o.attributes.color;
1173
+ a.push(h);
1033
1174
  }
1034
1175
  }
1035
1176
  return Promise.all([
1036
1177
  Promise.all(n),
1037
- Promise.all(a),
1038
- Promise.all(o)
1178
+ Promise.all(c),
1179
+ Promise.all(a)
1039
1180
  ]).then(function(l) {
1040
1181
  const d = l[0], u = l[1], h = l[2];
1041
- return r && (c.morphAttributes.position = d), s && (c.morphAttributes.normal = u), i && (c.morphAttributes.color = h), c.morphTargetsRelative = !0, c;
1182
+ return i && (o.morphAttributes.position = d), s && (o.morphAttributes.normal = u), r && (o.morphAttributes.color = h), o.morphTargetsRelative = !0, o;
1042
1183
  });
1043
1184
  }
1044
- function vs(c, e) {
1045
- if (c.updateMorphTargets(), e.weights !== void 0)
1046
- for (let t = 0, r = e.weights.length; t < r; t++)
1047
- c.morphTargetInfluences[t] = e.weights[t];
1185
+ function Rs(o, e) {
1186
+ if (o.updateMorphTargets(), e.weights !== void 0)
1187
+ for (let t = 0, i = e.weights.length; t < i; t++)
1188
+ o.morphTargetInfluences[t] = e.weights[t];
1048
1189
  if (e.extras && Array.isArray(e.extras.targetNames)) {
1049
1190
  const t = e.extras.targetNames;
1050
- if (c.morphTargetInfluences.length === t.length) {
1051
- c.morphTargetDictionary = {};
1052
- for (let r = 0, s = t.length; r < s; r++)
1053
- c.morphTargetDictionary[t[r]] = r;
1191
+ if (o.morphTargetInfluences.length === t.length) {
1192
+ o.morphTargetDictionary = {};
1193
+ for (let i = 0, s = t.length; i < s; i++)
1194
+ o.morphTargetDictionary[t[i]] = i;
1054
1195
  } else
1055
1196
  console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
1056
1197
  }
1057
1198
  }
1058
- function Cs(c) {
1199
+ function Es(o) {
1059
1200
  let e;
1060
- const t = c.extensions && c.extensions[T.KHR_DRACO_MESH_COMPRESSION];
1061
- if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + oe(t.attributes) : e = c.indices + ":" + oe(c.attributes) + ":" + c.mode, c.targets !== void 0)
1062
- for (let r = 0, s = c.targets.length; r < s; r++)
1063
- e += ":" + oe(c.targets[r]);
1201
+ const t = o.extensions && o.extensions[T.KHR_DRACO_MESH_COMPRESSION];
1202
+ if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + oe(t.attributes) : e = o.indices + ":" + oe(o.attributes) + ":" + o.mode, o.targets !== void 0)
1203
+ for (let i = 0, s = o.targets.length; i < s; i++)
1204
+ e += ":" + oe(o.targets[i]);
1064
1205
  return e;
1065
1206
  }
1066
- function oe(c) {
1207
+ function oe(o) {
1067
1208
  let e = "";
1068
- const t = Object.keys(c).sort();
1069
- for (let r = 0, s = t.length; r < s; r++)
1070
- e += t[r] + ":" + c[t[r]] + ";";
1209
+ const t = Object.keys(o).sort();
1210
+ for (let i = 0, s = t.length; i < s; i++)
1211
+ e += t[i] + ":" + o[t[i]] + ";";
1071
1212
  return e;
1072
1213
  }
1073
- function ge(c) {
1074
- switch (c) {
1214
+ function pe(o) {
1215
+ switch (o) {
1075
1216
  case Int8Array:
1076
1217
  return 1 / 127;
1077
1218
  case Uint8Array:
@@ -1084,21 +1225,21 @@ function ge(c) {
1084
1225
  throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
1085
1226
  }
1086
1227
  }
1087
- function Ms(c) {
1088
- return c.search(/\.jpe?g($|\?)/i) > 0 || c.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : c.search(/\.webp($|\?)/i) > 0 || c.search(/^data\:image\/webp/) === 0 ? "image/webp" : c.search(/\.ktx2($|\?)/i) > 0 || c.search(/^data\:image\/ktx2/) === 0 ? "image/ktx2" : "image/png";
1228
+ function ws(o) {
1229
+ return o.search(/\.jpe?g($|\?)/i) > 0 || o.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : o.search(/\.webp($|\?)/i) > 0 || o.search(/^data\:image\/webp/) === 0 ? "image/webp" : o.search(/\.ktx2($|\?)/i) > 0 || o.search(/^data\:image\/ktx2/) === 0 ? "image/ktx2" : "image/png";
1089
1230
  }
1090
- const Is = new W();
1091
- class Os {
1231
+ const xs = new $();
1232
+ class ys {
1092
1233
  constructor(e = {}, t = {}) {
1093
- this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new es(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.nodeCache = {}, this.meshCache = { refs: {}, uses: {} }, this.cameraCache = { refs: {}, uses: {} }, this.lightCache = { refs: {}, uses: {} }, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
1094
- let r = !1, s = -1, i = !1, n = -1;
1234
+ this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new Xt(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.nodeCache = {}, this.meshCache = { refs: {}, uses: {} }, this.cameraCache = { refs: {}, uses: {} }, this.lightCache = { refs: {}, uses: {} }, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
1235
+ let i = !1, s = -1, r = !1, n = -1;
1095
1236
  if (typeof navigator < "u") {
1096
- const a = navigator.userAgent;
1097
- r = /^((?!chrome|android).)*safari/i.test(a) === !0;
1098
- const o = a.match(/Version\/(\d+)/);
1099
- s = r && o ? parseInt(o[1], 10) : -1, i = a.indexOf("Firefox") > -1, n = i ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
1237
+ const c = navigator.userAgent;
1238
+ i = /^((?!chrome|android).)*safari/i.test(c) === !0;
1239
+ const a = c.match(/Version\/(\d+)/);
1240
+ s = i && a ? parseInt(a[1], 10) : -1, r = c.indexOf("Firefox") > -1, n = r ? c.match(/Firefox\/([0-9]+)\./)[1] : -1;
1100
1241
  }
1101
- typeof createImageBitmap > "u" || r && s < 17 || i && n < 98 ? this.textureLoader = new ft(this.options.manager) : this.textureLoader = new He(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new $(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
1242
+ typeof createImageBitmap > "u" || i && s < 17 || r && n < 98 ? this.textureLoader = new ht(this.options.manager) : this.textureLoader = new Ue(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new W(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
1102
1243
  }
1103
1244
  setExtensions(e) {
1104
1245
  this.extensions = e;
@@ -1107,33 +1248,33 @@ class Os {
1107
1248
  this.plugins = e;
1108
1249
  }
1109
1250
  parse(e, t) {
1110
- const r = this, s = this.json, i = this.extensions;
1251
+ const i = this, s = this.json, r = this.extensions;
1111
1252
  this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(n) {
1112
1253
  return n._markDefs && n._markDefs();
1113
1254
  }), Promise.all(this._invokeAll(function(n) {
1114
1255
  return n.beforeRoot && n.beforeRoot();
1115
1256
  })).then(function() {
1116
1257
  return Promise.all([
1117
- r.getDependencies("scene"),
1118
- r.getDependencies("animation"),
1119
- r.getDependencies("camera")
1258
+ i.getDependencies("scene"),
1259
+ i.getDependencies("animation"),
1260
+ i.getDependencies("camera")
1120
1261
  ]);
1121
1262
  }).then(function(n) {
1122
- const a = {
1263
+ const c = {
1123
1264
  scene: n[0][s.scene || 0],
1124
1265
  scenes: n[0],
1125
1266
  animations: n[1],
1126
1267
  cameras: n[2],
1127
1268
  asset: s.asset,
1128
- parser: r,
1269
+ parser: i,
1129
1270
  userData: {}
1130
1271
  };
1131
- return P(i, a, s), C(a, s), Promise.all(r._invokeAll(function(o) {
1132
- return o.afterRoot && o.afterRoot(a);
1272
+ return D(r, c, s), C(c, s), Promise.all(i._invokeAll(function(a) {
1273
+ return a.afterRoot && a.afterRoot(c);
1133
1274
  })).then(function() {
1134
- for (const o of a.scenes)
1135
- o.updateMatrixWorld();
1136
- e(a);
1275
+ for (const a of c.scenes)
1276
+ a.updateMatrixWorld();
1277
+ e(c);
1137
1278
  });
1138
1279
  }).catch(t);
1139
1280
  }
@@ -1141,15 +1282,15 @@ class Os {
1141
1282
  * Marks the special nodes/meshes in json for efficient parse.
1142
1283
  */
1143
1284
  _markDefs() {
1144
- const e = this.json.nodes || [], t = this.json.skins || [], r = this.json.meshes || [];
1145
- for (let s = 0, i = t.length; s < i; s++) {
1285
+ const e = this.json.nodes || [], t = this.json.skins || [], i = this.json.meshes || [];
1286
+ for (let s = 0, r = t.length; s < r; s++) {
1146
1287
  const n = t[s].joints;
1147
- for (let a = 0, o = n.length; a < o; a++)
1148
- e[n[a]].isBone = !0;
1288
+ for (let c = 0, a = n.length; c < a; c++)
1289
+ e[n[c]].isBone = !0;
1149
1290
  }
1150
- for (let s = 0, i = e.length; s < i; s++) {
1291
+ for (let s = 0, r = e.length; s < r; s++) {
1151
1292
  const n = e[s];
1152
- n.mesh !== void 0 && (this._addNodeRef(this.meshCache, n.mesh), n.skin !== void 0 && (r[n.mesh].isSkinnedMesh = !0)), n.camera !== void 0 && this._addNodeRef(this.cameraCache, n.camera);
1293
+ n.mesh !== void 0 && (this._addNodeRef(this.meshCache, n.mesh), n.skin !== void 0 && (i[n.mesh].isSkinnedMesh = !0)), n.camera !== void 0 && this._addNodeRef(this.cameraCache, n.camera);
1153
1294
  }
1154
1295
  }
1155
1296
  /**
@@ -1160,26 +1301,36 @@ class Os {
1160
1301
  * Textures) can be reused directly and are not marked here.
1161
1302
  *
1162
1303
  * Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
1304
+ *
1305
+ * @param {Object} cache
1306
+ * @param {Object3D} index
1163
1307
  */
1164
1308
  _addNodeRef(e, t) {
1165
1309
  t !== void 0 && (e.refs[t] === void 0 && (e.refs[t] = e.uses[t] = 0), e.refs[t]++);
1166
1310
  }
1167
- /** Returns a reference to a shared resource, cloning it if necessary. */
1168
- _getNodeRef(e, t, r) {
1169
- if (e.refs[t] <= 1) return r;
1170
- const s = r.clone(), i = (n, a) => {
1171
- const o = this.associations.get(n);
1172
- o != null && this.associations.set(a, o);
1311
+ /**
1312
+ * Returns a reference to a shared resource, cloning it if necessary.
1313
+ *
1314
+ * @param {Object} cache
1315
+ * @param {Number} index
1316
+ * @param {Object} object
1317
+ * @return {Object}
1318
+ */
1319
+ _getNodeRef(e, t, i) {
1320
+ if (e.refs[t] <= 1) return i;
1321
+ const s = i.clone(), r = (n, c) => {
1322
+ const a = this.associations.get(n);
1323
+ a != null && this.associations.set(c, a);
1173
1324
  for (const [l, d] of n.children.entries())
1174
- i(d, a.children[l]);
1325
+ r(d, c.children[l]);
1175
1326
  };
1176
- return i(r, s), s.name += "_instance_" + e.uses[t]++, s;
1327
+ return r(i, s), s.name += "_instance_" + e.uses[t]++, s;
1177
1328
  }
1178
1329
  _invokeOne(e) {
1179
1330
  const t = Object.values(this.plugins);
1180
1331
  t.push(this);
1181
- for (let r = 0; r < t.length; r++) {
1182
- const s = e(t[r]);
1332
+ for (let i = 0; i < t.length; i++) {
1333
+ const s = e(t[i]);
1183
1334
  if (s) return s;
1184
1335
  }
1185
1336
  return null;
@@ -1187,12 +1338,12 @@ class Os {
1187
1338
  _invokeAll(e) {
1188
1339
  const t = Object.values(this.plugins);
1189
1340
  t.unshift(this);
1190
- const r = [];
1341
+ const i = [];
1191
1342
  for (let s = 0; s < t.length; s++) {
1192
- const i = e(t[s]);
1193
- i && r.push(i);
1343
+ const r = e(t[s]);
1344
+ r && i.push(r);
1194
1345
  }
1195
- return r;
1346
+ return i;
1196
1347
  }
1197
1348
  /**
1198
1349
  * Requests the specified dependency asynchronously, with caching.
@@ -1201,63 +1352,63 @@ class Os {
1201
1352
  * @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
1202
1353
  */
1203
1354
  getDependency(e, t) {
1204
- const r = e + ":" + t;
1205
- let s = this.cache.get(r);
1355
+ const i = e + ":" + t;
1356
+ let s = this.cache.get(i);
1206
1357
  if (!s) {
1207
1358
  switch (e) {
1208
1359
  case "scene":
1209
1360
  s = this.loadScene(t);
1210
1361
  break;
1211
1362
  case "node":
1212
- s = this._invokeOne(function(i) {
1213
- return i.loadNode && i.loadNode(t);
1363
+ s = this._invokeOne(function(r) {
1364
+ return r.loadNode && r.loadNode(t);
1214
1365
  });
1215
1366
  break;
1216
1367
  case "mesh":
1217
- s = this._invokeOne(function(i) {
1218
- return i.loadMesh && i.loadMesh(t);
1368
+ s = this._invokeOne(function(r) {
1369
+ return r.loadMesh && r.loadMesh(t);
1219
1370
  });
1220
1371
  break;
1221
1372
  case "accessor":
1222
1373
  s = this.loadAccessor(t);
1223
1374
  break;
1224
1375
  case "bufferView":
1225
- s = this._invokeOne(function(i) {
1226
- return i.loadBufferView && i.loadBufferView(t);
1376
+ s = this._invokeOne(function(r) {
1377
+ return r.loadBufferView && r.loadBufferView(t);
1227
1378
  });
1228
1379
  break;
1229
1380
  case "buffer":
1230
1381
  s = this.loadBuffer(t);
1231
1382
  break;
1232
1383
  case "material":
1233
- s = this._invokeOne(function(i) {
1234
- return i.loadMaterial && i.loadMaterial(t);
1384
+ s = this._invokeOne(function(r) {
1385
+ return r.loadMaterial && r.loadMaterial(t);
1235
1386
  });
1236
1387
  break;
1237
1388
  case "texture":
1238
- s = this._invokeOne(function(i) {
1239
- return i.loadTexture && i.loadTexture(t);
1389
+ s = this._invokeOne(function(r) {
1390
+ return r.loadTexture && r.loadTexture(t);
1240
1391
  });
1241
1392
  break;
1242
1393
  case "skin":
1243
1394
  s = this.loadSkin(t);
1244
1395
  break;
1245
1396
  case "animation":
1246
- s = this._invokeOne(function(i) {
1247
- return i.loadAnimation && i.loadAnimation(t);
1397
+ s = this._invokeOne(function(r) {
1398
+ return r.loadAnimation && r.loadAnimation(t);
1248
1399
  });
1249
1400
  break;
1250
1401
  case "camera":
1251
1402
  s = this.loadCamera(t);
1252
1403
  break;
1253
1404
  default:
1254
- if (s = this._invokeOne(function(i) {
1255
- return i != this && i.getDependency && i.getDependency(e, t);
1405
+ if (s = this._invokeOne(function(r) {
1406
+ return r != this && r.getDependency && r.getDependency(e, t);
1256
1407
  }), !s)
1257
1408
  throw new Error("Unknown type: " + e);
1258
1409
  break;
1259
1410
  }
1260
- this.cache.add(r, s);
1411
+ this.cache.add(i, s);
1261
1412
  }
1262
1413
  return s;
1263
1414
  }
@@ -1269,9 +1420,9 @@ class Os {
1269
1420
  getDependencies(e) {
1270
1421
  let t = this.cache.get(e);
1271
1422
  if (!t) {
1272
- const r = this, s = this.json[e + (e === "mesh" ? "es" : "s")] || [];
1273
- t = Promise.all(s.map(function(i, n) {
1274
- return r.getDependency(e, n);
1423
+ const i = this, s = this.json[e + (e === "mesh" ? "es" : "s")] || [];
1424
+ t = Promise.all(s.map(function(r, n) {
1425
+ return i.getDependency(e, n);
1275
1426
  })), this.cache.add(e, t);
1276
1427
  }
1277
1428
  return t;
@@ -1282,14 +1433,14 @@ class Os {
1282
1433
  * @return {Promise<ArrayBuffer>}
1283
1434
  */
1284
1435
  loadBuffer(e) {
1285
- const t = this.json.buffers[e], r = this.fileLoader;
1436
+ const t = this.json.buffers[e], i = this.fileLoader;
1286
1437
  if (t.type && t.type !== "arraybuffer")
1287
1438
  throw new Error("THREE.GLTFLoader: " + t.type + " buffer type is not supported.");
1288
1439
  if (t.uri === void 0 && e === 0)
1289
1440
  return Promise.resolve(this.extensions[T.KHR_BINARY_GLTF].body);
1290
1441
  const s = this.options;
1291
- return new Promise(function(i, n) {
1292
- r.load(j.resolveURL(t.uri, s.path), i, void 0, function() {
1442
+ return new Promise(function(r, n) {
1443
+ i.load(K.resolveURL(t.uri, s.path), r, void 0, function() {
1293
1444
  n(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
1294
1445
  });
1295
1446
  });
@@ -1301,9 +1452,9 @@ class Os {
1301
1452
  */
1302
1453
  loadBufferView(e) {
1303
1454
  const t = this.json.bufferViews[e];
1304
- return this.getDependency("buffer", t.buffer).then(function(r) {
1305
- const s = t.byteLength || 0, i = t.byteOffset || 0;
1306
- return r.slice(i, i + s);
1455
+ return this.getDependency("buffer", t.buffer).then(function(i) {
1456
+ const s = t.byteLength || 0, r = t.byteOffset || 0;
1457
+ return i.slice(r, r + s);
1307
1458
  });
1308
1459
  }
1309
1460
  /**
@@ -1312,27 +1463,27 @@ class Os {
1312
1463
  * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
1313
1464
  */
1314
1465
  loadAccessor(e) {
1315
- const t = this, r = this.json, s = this.json.accessors[e];
1466
+ const t = this, i = this.json, s = this.json.accessors[e];
1316
1467
  if (s.bufferView === void 0 && s.sparse === void 0) {
1317
- const n = re[s.type], a = H[s.componentType], o = s.normalized === !0, l = new a(s.count * n);
1318
- return Promise.resolve(new K(l, n, o));
1468
+ const n = re[s.type], c = H[s.componentType], a = s.normalized === !0, l = new c(s.count * n);
1469
+ return Promise.resolve(new j(l, n, a));
1319
1470
  }
1320
- const i = [];
1321
- return s.bufferView !== void 0 ? i.push(this.getDependency("bufferView", s.bufferView)) : i.push(null), s.sparse !== void 0 && (i.push(this.getDependency("bufferView", s.sparse.indices.bufferView)), i.push(this.getDependency("bufferView", s.sparse.values.bufferView))), Promise.all(i).then(function(n) {
1322
- const a = n[0], o = re[s.type], l = H[s.componentType], d = l.BYTES_PER_ELEMENT, u = d * o, h = s.byteOffset || 0, f = s.bufferView !== void 0 ? r.bufferViews[s.bufferView].byteStride : void 0, p = s.normalized === !0;
1471
+ const r = [];
1472
+ return s.bufferView !== void 0 ? r.push(this.getDependency("bufferView", s.bufferView)) : r.push(null), s.sparse !== void 0 && (r.push(this.getDependency("bufferView", s.sparse.indices.bufferView)), r.push(this.getDependency("bufferView", s.sparse.values.bufferView))), Promise.all(r).then(function(n) {
1473
+ const c = n[0], a = re[s.type], l = H[s.componentType], d = l.BYTES_PER_ELEMENT, u = d * a, h = s.byteOffset || 0, f = s.bufferView !== void 0 ? i.bufferViews[s.bufferView].byteStride : void 0, p = s.normalized === !0;
1323
1474
  let A, m;
1324
1475
  if (f && f !== u) {
1325
- const g = Math.floor(h / f), _ = "InterleavedBuffer:" + s.bufferView + ":" + s.componentType + ":" + g + ":" + s.count;
1326
- let w = t.cache.get(_);
1327
- w || (A = new l(a, g * f, s.count * f / d), w = new pt(A, f / d), t.cache.add(_, w)), m = new mt(w, o, h % f / d, p);
1476
+ const g = Math.floor(h / f), R = "InterleavedBuffer:" + s.bufferView + ":" + s.componentType + ":" + g + ":" + s.count;
1477
+ let w = t.cache.get(R);
1478
+ w || (A = new l(c, g * f, s.count * f / d), w = new ft(A, f / d), t.cache.add(R, w)), m = new pt(w, a, h % f / d, p);
1328
1479
  } else
1329
- a === null ? A = new l(s.count * o) : A = new l(a, h, s.count * o), m = new K(A, o, p);
1480
+ c === null ? A = new l(s.count * a) : A = new l(c, h, s.count * a), m = new j(A, a, p);
1330
1481
  if (s.sparse !== void 0) {
1331
- const g = re.SCALAR, _ = H[s.sparse.indices.componentType], w = s.sparse.indices.byteOffset || 0, R = s.sparse.values.byteOffset || 0, b = new _(n[1], w, s.sparse.count * g), M = new l(n[2], R, s.sparse.count * o);
1332
- a !== null && (m = new K(m.array.slice(), m.itemSize, m.normalized)), m.normalized = !1;
1333
- for (let x = 0, U = b.length; x < U; x++) {
1334
- const I = b[x];
1335
- if (m.setX(I, M[x * o]), o >= 2 && m.setY(I, M[x * o + 1]), o >= 3 && m.setZ(I, M[x * o + 2]), o >= 4 && m.setW(I, M[x * o + 3]), o >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
1482
+ const g = re.SCALAR, R = H[s.sparse.indices.componentType], w = s.sparse.indices.byteOffset || 0, E = s.sparse.values.byteOffset || 0, b = new R(n[1], w, s.sparse.count * g), M = new l(n[2], E, s.sparse.count * a);
1483
+ c !== null && (m = new j(m.array.slice(), m.itemSize, m.normalized)), m.normalized = !1;
1484
+ for (let y = 0, U = b.length; y < U; y++) {
1485
+ const I = b[y];
1486
+ if (m.setX(I, M[y * a]), a >= 2 && m.setY(I, M[y * a + 1]), a >= 3 && m.setZ(I, M[y * a + 2]), a >= 4 && m.setW(I, M[y * a + 3]), a >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
1336
1487
  }
1337
1488
  m.normalized = p;
1338
1489
  }
@@ -1345,72 +1496,74 @@ class Os {
1345
1496
  * @return {Promise<THREE.Texture|null>}
1346
1497
  */
1347
1498
  loadTexture(e) {
1348
- const t = this.json, r = this.options, i = t.textures[e].source, n = t.images[i];
1349
- let a = this.textureLoader;
1499
+ const t = this.json, i = this.options, r = t.textures[e].source, n = t.images[r];
1500
+ let c = this.textureLoader;
1350
1501
  if (n.uri) {
1351
- const o = r.manager.getHandler(n.uri);
1352
- o !== null && (a = o);
1502
+ const a = i.manager.getHandler(n.uri);
1503
+ a !== null && (c = a);
1353
1504
  }
1354
- return this.loadTextureImage(e, i, a);
1355
- }
1356
- loadTextureImage(e, t, r) {
1357
- const s = this, i = this.json, n = i.textures[e], a = i.images[t], o = (a.uri || a.bufferView) + ":" + n.sampler;
1358
- if (this.textureCache[o])
1359
- return this.textureCache[o];
1360
- const l = this.loadImageSource(t, r).then(function(d) {
1361
- d.flipY = !1, d.name = n.name || a.name || "", d.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (d.name = a.uri);
1362
- const h = (i.samplers || {})[n.sampler] || {};
1363
- return d.magFilter = be[h.magFilter] || de, d.minFilter = be[h.minFilter] || Ue, d.wrapS = Se[h.wrapS] || he, d.wrapT = Se[h.wrapT] || he, d.generateMipmaps = !d.isCompressedTexture && d.minFilter !== Ge && d.minFilter !== de, s.associations.set(d, { textures: e }), d;
1505
+ return this.loadTextureImage(e, r, c);
1506
+ }
1507
+ loadTextureImage(e, t, i) {
1508
+ const s = this, r = this.json, n = r.textures[e], c = r.images[t], a = (c.uri || c.bufferView) + ":" + n.sampler;
1509
+ if (this.textureCache[a])
1510
+ return this.textureCache[a];
1511
+ const l = this.loadImageSource(t, i).then(function(d) {
1512
+ d.flipY = !1, d.name = n.name || c.name || "", d.name === "" && typeof c.uri == "string" && c.uri.startsWith("data:image/") === !1 && (d.name = c.uri);
1513
+ const h = (r.samplers || {})[n.sampler] || {};
1514
+ return d.magFilter = be[h.magFilter] || de, d.minFilter = be[h.minFilter] || Ge, d.wrapS = Se[h.wrapS] || he, d.wrapT = Se[h.wrapT] || he, d.generateMipmaps = !d.isCompressedTexture && d.minFilter !== Be && d.minFilter !== de, s.associations.set(d, { textures: e }), d;
1364
1515
  }).catch(function() {
1365
1516
  return null;
1366
1517
  });
1367
- return this.textureCache[o] = l, l;
1518
+ return this.textureCache[a] = l, l;
1368
1519
  }
1369
1520
  loadImageSource(e, t) {
1370
- const r = this, s = this.json, i = this.options;
1521
+ const i = this, s = this.json, r = this.options;
1371
1522
  if (this.sourceCache[e] !== void 0)
1372
1523
  return this.sourceCache[e].then((u) => u.clone());
1373
- const n = s.images[e], a = self.URL || self.webkitURL;
1374
- let o = n.uri || "", l = !1;
1524
+ const n = s.images[e], c = self.URL || self.webkitURL;
1525
+ let a = n.uri || "", l = !1;
1375
1526
  if (n.bufferView !== void 0)
1376
- o = r.getDependency("bufferView", n.bufferView).then(function(u) {
1527
+ a = i.getDependency("bufferView", n.bufferView).then(function(u) {
1377
1528
  l = !0;
1378
1529
  const h = new Blob([u], { type: n.mimeType });
1379
- return o = a.createObjectURL(h), o;
1530
+ return a = c.createObjectURL(h), a;
1380
1531
  });
1381
1532
  else if (n.uri === void 0)
1382
1533
  throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
1383
- const d = Promise.resolve(o).then(function(u) {
1534
+ const d = Promise.resolve(a).then(function(u) {
1384
1535
  return new Promise(function(h, f) {
1385
1536
  let p = h;
1386
1537
  t.isImageBitmapLoader === !0 && (p = function(A) {
1387
1538
  const m = new Re(A);
1388
1539
  m.needsUpdate = !0, h(m);
1389
- }), t.load(j.resolveURL(u, i.path), p, void 0, f);
1540
+ }), t.load(K.resolveURL(u, r.path), p, void 0, f);
1390
1541
  });
1391
1542
  }).then(function(u) {
1392
- return l === !0 && a.revokeObjectURL(o), C(u, n), u.userData.mimeType = n.mimeType || Ms(n.uri), u;
1543
+ return l === !0 && c.revokeObjectURL(a), C(u, n), u.userData.mimeType = n.mimeType || ws(n.uri), u;
1393
1544
  }).catch(function(u) {
1394
- throw console.error("THREE.GLTFLoader: Couldn't load texture", o), u;
1545
+ throw console.error("THREE.GLTFLoader: Couldn't load texture", a), u;
1395
1546
  });
1396
1547
  return this.sourceCache[e] = d, d;
1397
1548
  }
1398
1549
  /**
1399
1550
  * Asynchronously assigns a texture to the given material parameters.
1551
+ *
1400
1552
  * @param {Object} materialParams
1401
1553
  * @param {string} mapName
1402
1554
  * @param {Object} mapDef
1555
+ * @param {string} colorSpace
1403
1556
  * @return {Promise<Texture>}
1404
1557
  */
1405
- assignTexture(e, t, r, s) {
1406
- const i = this;
1407
- return this.getDependency("texture", r.index).then(function(n) {
1558
+ assignTexture(e, t, i, s) {
1559
+ const r = this;
1560
+ return this.getDependency("texture", i.index).then(function(n) {
1408
1561
  if (!n) return null;
1409
- if (r.texCoord !== void 0 && r.texCoord > 0 && (n = n.clone(), n.channel = r.texCoord), i.extensions[T.KHR_TEXTURE_TRANSFORM]) {
1410
- const a = r.extensions !== void 0 ? r.extensions[T.KHR_TEXTURE_TRANSFORM] : void 0;
1411
- if (a) {
1412
- const o = i.associations.get(n);
1413
- n = i.extensions[T.KHR_TEXTURE_TRANSFORM].extendTexture(n, a), i.associations.set(n, o);
1562
+ if (i.texCoord !== void 0 && i.texCoord > 0 && (n = n.clone(), n.channel = i.texCoord), r.extensions[T.KHR_TEXTURE_TRANSFORM]) {
1563
+ const c = i.extensions !== void 0 ? i.extensions[T.KHR_TEXTURE_TRANSFORM] : void 0;
1564
+ if (c) {
1565
+ const a = r.associations.get(n);
1566
+ n = r.extensions[T.KHR_TEXTURE_TRANSFORM].extendTexture(n, c), r.associations.set(n, a);
1414
1567
  }
1415
1568
  }
1416
1569
  return s !== void 0 && (n.colorSpace = s), e[t] = n, n;
@@ -1426,27 +1579,27 @@ class Os {
1426
1579
  */
1427
1580
  assignFinalMaterial(e) {
1428
1581
  const t = e.geometry;
1429
- let r = e.material;
1430
- const s = t.attributes.tangent === void 0, i = t.attributes.color !== void 0, n = t.attributes.normal === void 0;
1582
+ let i = e.material;
1583
+ const s = t.attributes.tangent === void 0, r = t.attributes.color !== void 0, n = t.attributes.normal === void 0;
1431
1584
  if (e.isPoints) {
1432
- const a = "PointsMaterial:" + r.uuid;
1433
- let o = this.cache.get(a);
1434
- o || (o = new gt(), se.prototype.copy.call(o, r), o.color.copy(r.color), o.map = r.map, o.sizeAttenuation = !1, this.cache.add(a, o)), r = o;
1585
+ const c = "PointsMaterial:" + i.uuid;
1586
+ let a = this.cache.get(c);
1587
+ a || (a = new mt(), te.prototype.copy.call(a, i), a.color.copy(i.color), a.map = i.map, a.sizeAttenuation = !1, this.cache.add(c, a)), i = a;
1435
1588
  } else if (e.isLine) {
1436
- const a = "LineBasicMaterial:" + r.uuid;
1437
- let o = this.cache.get(a);
1438
- o || (o = new At(), se.prototype.copy.call(o, r), o.color.copy(r.color), o.map = r.map, this.cache.add(a, o)), r = o;
1589
+ const c = "LineBasicMaterial:" + i.uuid;
1590
+ let a = this.cache.get(c);
1591
+ a || (a = new gt(), te.prototype.copy.call(a, i), a.color.copy(i.color), a.map = i.map, this.cache.add(c, a)), i = a;
1439
1592
  }
1440
- if (s || i || n) {
1441
- let a = "ClonedMaterial:" + r.uuid + ":";
1442
- s && (a += "derivative-tangents:"), i && (a += "vertex-colors:"), n && (a += "flat-shading:");
1443
- let o = this.cache.get(a);
1444
- o || (o = r.clone(), i && (o.vertexColors = !0), n && (o.flatShading = !0), s && (o.normalScale && (o.normalScale.y *= -1), o.clearcoatNormalScale && (o.clearcoatNormalScale.y *= -1)), this.cache.add(a, o), this.associations.set(o, this.associations.get(r))), r = o;
1593
+ if (s || r || n) {
1594
+ let c = "ClonedMaterial:" + i.uuid + ":";
1595
+ s && (c += "derivative-tangents:"), r && (c += "vertex-colors:"), n && (c += "flat-shading:");
1596
+ let a = this.cache.get(c);
1597
+ a || (a = i.clone(), r && (a.vertexColors = !0), n && (a.flatShading = !0), s && (a.normalScale && (a.normalScale.y *= -1), a.clearcoatNormalScale && (a.clearcoatNormalScale.y *= -1)), this.cache.add(c, a), this.associations.set(a, this.associations.get(i))), i = a;
1445
1598
  }
1446
- e.material = r;
1599
+ e.material = i;
1447
1600
  }
1448
1601
  getMaterialType() {
1449
- return Be;
1602
+ return je;
1450
1603
  }
1451
1604
  /**
1452
1605
  * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
@@ -1454,42 +1607,47 @@ class Os {
1454
1607
  * @return {Promise<Material>}
1455
1608
  */
1456
1609
  loadMaterial(e) {
1457
- const t = this, r = this.json, s = this.extensions, i = r.materials[e];
1610
+ const t = this, i = this.json, s = this.extensions, r = i.materials[e];
1458
1611
  let n;
1459
- const a = {}, o = i.extensions || {}, l = [];
1460
- if (o[T.KHR_MATERIALS_UNLIT]) {
1612
+ const c = {}, a = r.extensions || {}, l = [];
1613
+ if (a[T.KHR_MATERIALS_UNLIT]) {
1461
1614
  const u = s[T.KHR_MATERIALS_UNLIT];
1462
- n = u.getMaterialType(), l.push(u.extendParams(a, i, t));
1615
+ n = u.getMaterialType(), l.push(u.extendParams(c, r, t));
1463
1616
  } else {
1464
- const u = i.pbrMetallicRoughness || {};
1465
- if (a.color = new D(1, 1, 1), a.opacity = 1, Array.isArray(u.baseColorFactor)) {
1617
+ const u = r.pbrMetallicRoughness || {};
1618
+ if (c.color = new P(1, 1, 1), c.opacity = 1, Array.isArray(u.baseColorFactor)) {
1466
1619
  const h = u.baseColorFactor;
1467
- a.color.setRGB(h[0], h[1], h[2], S), a.opacity = h[3];
1620
+ c.color.setRGB(h[0], h[1], h[2], S), c.opacity = h[3];
1468
1621
  }
1469
- u.baseColorTexture !== void 0 && l.push(t.assignTexture(a, "map", u.baseColorTexture, N)), a.metalness = u.metallicFactor !== void 0 ? u.metallicFactor : 1, a.roughness = u.roughnessFactor !== void 0 ? u.roughnessFactor : 1, u.metallicRoughnessTexture !== void 0 && (l.push(t.assignTexture(a, "metalnessMap", u.metallicRoughnessTexture)), l.push(t.assignTexture(a, "roughnessMap", u.metallicRoughnessTexture))), n = this._invokeOne(function(h) {
1622
+ u.baseColorTexture !== void 0 && l.push(t.assignTexture(c, "map", u.baseColorTexture, N)), c.metalness = u.metallicFactor !== void 0 ? u.metallicFactor : 1, c.roughness = u.roughnessFactor !== void 0 ? u.roughnessFactor : 1, u.metallicRoughnessTexture !== void 0 && (l.push(t.assignTexture(c, "metalnessMap", u.metallicRoughnessTexture)), l.push(t.assignTexture(c, "roughnessMap", u.metallicRoughnessTexture))), n = this._invokeOne(function(h) {
1470
1623
  return h.getMaterialType && h.getMaterialType(e);
1471
1624
  }), l.push(Promise.all(this._invokeAll(function(h) {
1472
- return h.extendMaterialParams && h.extendMaterialParams(e, a);
1625
+ return h.extendMaterialParams && h.extendMaterialParams(e, c);
1473
1626
  })));
1474
1627
  }
1475
- i.doubleSided === !0 && (a.side = Tt);
1476
- const d = i.alphaMode || ie.OPAQUE;
1477
- if (d === ie.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, d === ie.MASK && (a.alphaTest = i.alphaCutoff !== void 0 ? i.alphaCutoff : 0.5)), i.normalTexture !== void 0 && n !== B && (l.push(t.assignTexture(a, "normalMap", i.normalTexture)), a.normalScale = new Pe(1, 1), i.normalTexture.scale !== void 0)) {
1478
- const u = i.normalTexture.scale;
1479
- a.normalScale.set(u, u);
1628
+ r.doubleSided === !0 && (c.side = At);
1629
+ const d = r.alphaMode || ie.OPAQUE;
1630
+ if (d === ie.BLEND ? (c.transparent = !0, c.depthWrite = !1) : (c.transparent = !1, d === ie.MASK && (c.alphaTest = r.alphaCutoff !== void 0 ? r.alphaCutoff : 0.5)), r.normalTexture !== void 0 && n !== B && (l.push(t.assignTexture(c, "normalMap", r.normalTexture)), c.normalScale = new ke(1, 1), r.normalTexture.scale !== void 0)) {
1631
+ const u = r.normalTexture.scale;
1632
+ c.normalScale.set(u, u);
1480
1633
  }
1481
- if (i.occlusionTexture !== void 0 && n !== B && (l.push(t.assignTexture(a, "aoMap", i.occlusionTexture)), i.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = i.occlusionTexture.strength)), i.emissiveFactor !== void 0 && n !== B) {
1482
- const u = i.emissiveFactor;
1483
- a.emissive = new D().setRGB(u[0], u[1], u[2], S);
1634
+ if (r.occlusionTexture !== void 0 && n !== B && (l.push(t.assignTexture(c, "aoMap", r.occlusionTexture)), r.occlusionTexture.strength !== void 0 && (c.aoMapIntensity = r.occlusionTexture.strength)), r.emissiveFactor !== void 0 && n !== B) {
1635
+ const u = r.emissiveFactor;
1636
+ c.emissive = new P().setRGB(u[0], u[1], u[2], S);
1484
1637
  }
1485
- return i.emissiveTexture !== void 0 && n !== B && l.push(t.assignTexture(a, "emissiveMap", i.emissiveTexture, N)), Promise.all(l).then(function() {
1486
- const u = new n(a);
1487
- return i.name && (u.name = i.name), C(u, i), t.associations.set(u, { materials: e }), i.extensions && P(s, u, i), u;
1638
+ return r.emissiveTexture !== void 0 && n !== B && l.push(t.assignTexture(c, "emissiveMap", r.emissiveTexture, N)), Promise.all(l).then(function() {
1639
+ const u = new n(c);
1640
+ return r.name && (u.name = r.name), C(u, r), t.associations.set(u, { materials: e }), r.extensions && D(s, u, r), u;
1488
1641
  });
1489
1642
  }
1490
- /** When Object3D instances are targeted by animation, they need unique names. */
1643
+ /**
1644
+ * When Object3D instances are targeted by animation, they need unique names.
1645
+ *
1646
+ * @param {String} originalName
1647
+ * @return {String}
1648
+ */
1491
1649
  createUniqueName(e) {
1492
- const t = _t.sanitizeNodeName(e || "");
1650
+ const t = Tt.sanitizeNodeName(e || "");
1493
1651
  return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);
1494
1652
  }
1495
1653
  /**
@@ -1501,20 +1659,20 @@ class Os {
1501
1659
  * @return {Promise<Array<BufferGeometry>>}
1502
1660
  */
1503
1661
  loadGeometries(e) {
1504
- const t = this, r = this.extensions, s = this.primitiveCache;
1505
- function i(a) {
1506
- return r[T.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(o) {
1507
- return ve(o, a, t);
1662
+ const t = this, i = this.extensions, s = this.primitiveCache;
1663
+ function r(c) {
1664
+ return i[T.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(c, t).then(function(a) {
1665
+ return ve(a, c, t);
1508
1666
  });
1509
1667
  }
1510
1668
  const n = [];
1511
- for (let a = 0, o = e.length; a < o; a++) {
1512
- const l = e[a], d = Cs(l), u = s[d];
1669
+ for (let c = 0, a = e.length; c < a; c++) {
1670
+ const l = e[c], d = Es(l), u = s[d];
1513
1671
  if (u)
1514
1672
  n.push(u.promise);
1515
1673
  else {
1516
1674
  let h;
1517
- l.extensions && l.extensions[T.KHR_DRACO_MESH_COMPRESSION] ? h = i(l) : h = ve(new je(), l, t), s[d] = { primitive: l, promise: h }, n.push(h);
1675
+ l.extensions && l.extensions[T.KHR_DRACO_MESH_COMPRESSION] ? h = r(l) : h = ve(new De(), l, t), s[d] = { primitive: l, promise: h }, n.push(h);
1518
1676
  }
1519
1677
  }
1520
1678
  return Promise.all(n);
@@ -1525,30 +1683,30 @@ class Os {
1525
1683
  * @return {Promise<Group|Mesh|SkinnedMesh>}
1526
1684
  */
1527
1685
  loadMesh(e) {
1528
- const t = this, r = this.json, s = this.extensions, i = r.meshes[e], n = i.primitives, a = [];
1529
- for (let o = 0, l = n.length; o < l; o++) {
1530
- const d = n[o].material === void 0 ? bs(this.cache) : this.getDependency("material", n[o].material);
1531
- a.push(d);
1686
+ const t = this, i = this.json, s = this.extensions, r = i.meshes[e], n = r.primitives, c = [];
1687
+ for (let a = 0, l = n.length; a < l; a++) {
1688
+ const d = n[a].material === void 0 ? Ts(this.cache) : this.getDependency("material", n[a].material);
1689
+ c.push(d);
1532
1690
  }
1533
- return a.push(t.loadGeometries(n)), Promise.all(a).then(function(o) {
1534
- const l = o.slice(0, o.length - 1), d = o[o.length - 1], u = [];
1691
+ return c.push(t.loadGeometries(n)), Promise.all(c).then(function(a) {
1692
+ const l = a.slice(0, a.length - 1), d = a[a.length - 1], u = [];
1535
1693
  for (let f = 0, p = d.length; f < p; f++) {
1536
1694
  const A = d[f], m = n[f];
1537
1695
  let g;
1538
- const _ = l[f];
1539
- if (m.mode === L.TRIANGLES || m.mode === L.TRIANGLE_STRIP || m.mode === L.TRIANGLE_FAN || m.mode === void 0)
1540
- g = i.isSkinnedMesh === !0 ? new Rt(A, _) : new Et(A, _), g.isSkinnedMesh === !0 && g.normalizeSkinWeights(), m.mode === L.TRIANGLE_STRIP ? g.geometry = xe(g.geometry, Ne) : m.mode === L.TRIANGLE_FAN && (g.geometry = xe(g.geometry, ue));
1541
- else if (m.mode === L.LINES)
1542
- g = new wt(A, _);
1543
- else if (m.mode === L.LINE_STRIP)
1544
- g = new Lt(A, _);
1545
- else if (m.mode === L.LINE_LOOP)
1546
- g = new xt(A, _);
1547
- else if (m.mode === L.POINTS)
1548
- g = new yt(A, _);
1696
+ const R = l[f];
1697
+ if (m.mode === x.TRIANGLES || m.mode === x.TRIANGLE_STRIP || m.mode === x.TRIANGLE_FAN || m.mode === void 0)
1698
+ g = r.isSkinnedMesh === !0 ? new _t(A, R) : new Rt(A, R), g.isSkinnedMesh === !0 && g.normalizeSkinWeights(), m.mode === x.TRIANGLE_STRIP ? g.geometry = ye(g.geometry, Ne) : m.mode === x.TRIANGLE_FAN && (g.geometry = ye(g.geometry, le));
1699
+ else if (m.mode === x.LINES)
1700
+ g = new Et(A, R);
1701
+ else if (m.mode === x.LINE_STRIP)
1702
+ g = new wt(A, R);
1703
+ else if (m.mode === x.LINE_LOOP)
1704
+ g = new xt(A, R);
1705
+ else if (m.mode === x.POINTS)
1706
+ g = new yt(A, R);
1549
1707
  else
1550
1708
  throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + m.mode);
1551
- Object.keys(g.geometry.morphAttributes).length > 0 && vs(g, i), g.name = t.createUniqueName(i.name || "mesh_" + e), C(g, i), m.extensions && P(s, g, m), t.assignFinalMaterial(g), u.push(g);
1709
+ Object.keys(g.geometry.morphAttributes).length > 0 && Rs(g, r), g.name = t.createUniqueName(r.name || "mesh_" + e), C(g, r), m.extensions && D(s, g, m), t.assignFinalMaterial(g), u.push(g);
1552
1710
  }
1553
1711
  for (let f = 0, p = u.length; f < p; f++)
1554
1712
  t.associations.set(u[f], {
@@ -1556,9 +1714,9 @@ class Os {
1556
1714
  primitives: f
1557
1715
  });
1558
1716
  if (u.length === 1)
1559
- return i.extensions && P(s, u[0], i), u[0];
1560
- const h = new ne();
1561
- i.extensions && P(s, h, i), t.associations.set(h, { meshes: e });
1717
+ return r.extensions && D(s, u[0], r), u[0];
1718
+ const h = new se();
1719
+ r.extensions && D(s, h, r), t.associations.set(h, { meshes: e });
1562
1720
  for (let f = 0, p = u.length; f < p; f++)
1563
1721
  h.add(u[f]);
1564
1722
  return h;
@@ -1571,12 +1729,12 @@ class Os {
1571
1729
  */
1572
1730
  loadCamera(e) {
1573
1731
  let t;
1574
- const r = this.json.cameras[e], s = r[r.type];
1732
+ const i = this.json.cameras[e], s = i[i.type];
1575
1733
  if (!s) {
1576
1734
  console.warn("THREE.GLTFLoader: Missing camera parameters.");
1577
1735
  return;
1578
1736
  }
1579
- return r.type === "perspective" ? t = new bt(St.radToDeg(s.yfov), s.aspectRatio || 1, s.znear || 1, s.zfar || 2e6) : r.type === "orthographic" && (t = new vt(-s.xmag, s.xmag, s.ymag, -s.ymag, s.znear, s.zfar)), r.name && (t.name = this.createUniqueName(r.name)), C(t, r), Promise.resolve(t);
1737
+ return i.type === "perspective" ? t = new Lt(bt.radToDeg(s.yfov), s.aspectRatio || 1, s.znear || 1, s.zfar || 2e6) : i.type === "orthographic" && (t = new St(-s.xmag, s.xmag, s.ymag, -s.ymag, s.znear, s.zfar)), i.name && (t.name = this.createUniqueName(i.name)), C(t, i), Promise.resolve(t);
1580
1738
  }
1581
1739
  /**
1582
1740
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
@@ -1584,21 +1742,21 @@ class Os {
1584
1742
  * @return {Promise<Skeleton>}
1585
1743
  */
1586
1744
  loadSkin(e) {
1587
- const t = this.json.skins[e], r = [];
1588
- for (let s = 0, i = t.joints.length; s < i; s++)
1589
- r.push(this._loadNodeShallow(t.joints[s]));
1590
- return t.inverseBindMatrices !== void 0 ? r.push(this.getDependency("accessor", t.inverseBindMatrices)) : r.push(null), Promise.all(r).then(function(s) {
1591
- const i = s.pop(), n = s, a = [], o = [];
1745
+ const t = this.json.skins[e], i = [];
1746
+ for (let s = 0, r = t.joints.length; s < r; s++)
1747
+ i.push(this._loadNodeShallow(t.joints[s]));
1748
+ return t.inverseBindMatrices !== void 0 ? i.push(this.getDependency("accessor", t.inverseBindMatrices)) : i.push(null), Promise.all(i).then(function(s) {
1749
+ const r = s.pop(), n = s, c = [], a = [];
1592
1750
  for (let l = 0, d = n.length; l < d; l++) {
1593
1751
  const u = n[l];
1594
1752
  if (u) {
1595
- a.push(u);
1596
- const h = new W();
1597
- i !== null && h.fromArray(i.array, l * 16), o.push(h);
1753
+ c.push(u);
1754
+ const h = new $();
1755
+ r !== null && h.fromArray(r.array, l * 16), a.push(h);
1598
1756
  } else
1599
1757
  console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[l]);
1600
1758
  }
1601
- return new Ct(a, o);
1759
+ return new vt(c, a);
1602
1760
  });
1603
1761
  }
1604
1762
  /**
@@ -1607,39 +1765,39 @@ class Os {
1607
1765
  * @return {Promise<AnimationClip>}
1608
1766
  */
1609
1767
  loadAnimation(e) {
1610
- const t = this.json, r = this, s = t.animations[e], i = s.name ? s.name : "animation_" + e, n = [], a = [], o = [], l = [], d = [];
1768
+ const t = this.json, i = this, s = t.animations[e], r = s.name ? s.name : "animation_" + e, n = [], c = [], a = [], l = [], d = [];
1611
1769
  for (let u = 0, h = s.channels.length; u < h; u++) {
1612
- const f = s.channels[u], p = s.samplers[f.sampler], A = f.target, m = A.node, g = s.parameters !== void 0 ? s.parameters[p.input] : p.input, _ = s.parameters !== void 0 ? s.parameters[p.output] : p.output;
1613
- A.node !== void 0 && (n.push(this.getDependency("node", m)), a.push(this.getDependency("accessor", g)), o.push(this.getDependency("accessor", _)), l.push(p), d.push(A));
1770
+ const f = s.channels[u], p = s.samplers[f.sampler], A = f.target, m = A.node, g = s.parameters !== void 0 ? s.parameters[p.input] : p.input, R = s.parameters !== void 0 ? s.parameters[p.output] : p.output;
1771
+ A.node !== void 0 && (n.push(this.getDependency("node", m)), c.push(this.getDependency("accessor", g)), a.push(this.getDependency("accessor", R)), l.push(p), d.push(A));
1614
1772
  }
1615
1773
  return Promise.all([
1616
1774
  Promise.all(n),
1775
+ Promise.all(c),
1617
1776
  Promise.all(a),
1618
- Promise.all(o),
1619
1777
  Promise.all(l),
1620
1778
  Promise.all(d)
1621
1779
  ]).then(function(u) {
1622
1780
  const h = u[0], f = u[1], p = u[2], A = u[3], m = u[4], g = [];
1623
- for (let _ = 0, w = h.length; _ < w; _++) {
1624
- const R = h[_], b = f[_], M = p[_], x = A[_], U = m[_];
1625
- if (R === void 0) continue;
1626
- R.updateMatrix && R.updateMatrix();
1627
- const I = r._createAnimationTracks(R, b, M, x, U);
1781
+ for (let R = 0, w = h.length; R < w; R++) {
1782
+ const E = h[R], b = f[R], M = p[R], y = A[R], U = m[R];
1783
+ if (E === void 0) continue;
1784
+ E.updateMatrix && E.updateMatrix();
1785
+ const I = i._createAnimationTracks(E, b, M, y, U);
1628
1786
  if (I)
1629
1787
  for (let Z = 0; Z < I.length; Z++)
1630
1788
  g.push(I[Z]);
1631
1789
  }
1632
- return new Mt(i, void 0, g);
1790
+ return new Ct(r, void 0, g);
1633
1791
  });
1634
1792
  }
1635
1793
  createNodeMesh(e) {
1636
- const t = this.json, r = this, s = t.nodes[e];
1637
- return s.mesh === void 0 ? null : r.getDependency("mesh", s.mesh).then(function(i) {
1638
- const n = r._getNodeRef(r.meshCache, s.mesh, i);
1639
- return s.weights !== void 0 && n.traverse(function(a) {
1640
- if (a.isMesh)
1641
- for (let o = 0, l = s.weights.length; o < l; o++)
1642
- a.morphTargetInfluences[o] = s.weights[o];
1794
+ const t = this.json, i = this, s = t.nodes[e];
1795
+ return s.mesh === void 0 ? null : i.getDependency("mesh", s.mesh).then(function(r) {
1796
+ const n = i._getNodeRef(i.meshCache, s.mesh, r);
1797
+ return s.weights !== void 0 && n.traverse(function(c) {
1798
+ if (c.isMesh)
1799
+ for (let a = 0, l = s.weights.length; a < l; a++)
1800
+ c.morphTargetInfluences[a] = s.weights[a];
1643
1801
  }), n;
1644
1802
  });
1645
1803
  }
@@ -1649,18 +1807,18 @@ class Os {
1649
1807
  * @return {Promise<Object3D>}
1650
1808
  */
1651
1809
  loadNode(e) {
1652
- const t = this.json, r = this, s = t.nodes[e], i = r._loadNodeShallow(e), n = [], a = s.children || [];
1653
- for (let l = 0, d = a.length; l < d; l++)
1654
- n.push(r.getDependency("node", a[l]));
1655
- const o = s.skin === void 0 ? Promise.resolve(null) : r.getDependency("skin", s.skin);
1810
+ const t = this.json, i = this, s = t.nodes[e], r = i._loadNodeShallow(e), n = [], c = s.children || [];
1811
+ for (let l = 0, d = c.length; l < d; l++)
1812
+ n.push(i.getDependency("node", c[l]));
1813
+ const a = s.skin === void 0 ? Promise.resolve(null) : i.getDependency("skin", s.skin);
1656
1814
  return Promise.all([
1657
- i,
1815
+ r,
1658
1816
  Promise.all(n),
1659
- o
1817
+ a
1660
1818
  ]).then(function(l) {
1661
1819
  const d = l[0], u = l[1], h = l[2];
1662
1820
  h !== null && d.traverse(function(f) {
1663
- f.isSkinnedMesh && f.bind(h, Is);
1821
+ f.isSkinnedMesh && f.bind(h, xs);
1664
1822
  });
1665
1823
  for (let f = 0, p = u.length; f < p; f++)
1666
1824
  d.add(u[f]);
@@ -1670,28 +1828,28 @@ class Os {
1670
1828
  // ._loadNodeShallow() parses a single node.
1671
1829
  // skin and child nodes are created and added in .loadNode() (no '_' prefix).
1672
1830
  _loadNodeShallow(e) {
1673
- const t = this.json, r = this.extensions, s = this;
1831
+ const t = this.json, i = this.extensions, s = this;
1674
1832
  if (this.nodeCache[e] !== void 0)
1675
1833
  return this.nodeCache[e];
1676
- const i = t.nodes[e], n = i.name ? s.createUniqueName(i.name) : "", a = [], o = s._invokeOne(function(l) {
1834
+ const r = t.nodes[e], n = r.name ? s.createUniqueName(r.name) : "", c = [], a = s._invokeOne(function(l) {
1677
1835
  return l.createNodeMesh && l.createNodeMesh(e);
1678
1836
  });
1679
- return o && a.push(o), i.camera !== void 0 && a.push(s.getDependency("camera", i.camera).then(function(l) {
1680
- return s._getNodeRef(s.cameraCache, i.camera, l);
1837
+ return a && c.push(a), r.camera !== void 0 && c.push(s.getDependency("camera", r.camera).then(function(l) {
1838
+ return s._getNodeRef(s.cameraCache, r.camera, l);
1681
1839
  })), s._invokeAll(function(l) {
1682
1840
  return l.createNodeAttachment && l.createNodeAttachment(e);
1683
1841
  }).forEach(function(l) {
1684
- a.push(l);
1685
- }), this.nodeCache[e] = Promise.all(a).then(function(l) {
1842
+ c.push(l);
1843
+ }), this.nodeCache[e] = Promise.all(c).then(function(l) {
1686
1844
  let d;
1687
- if (i.isBone === !0 ? d = new It() : l.length > 1 ? d = new ne() : l.length === 1 ? d = l[0] : d = new Fe(), d !== l[0])
1845
+ if (r.isBone === !0 ? d = new Mt() : l.length > 1 ? d = new se() : l.length === 1 ? d = l[0] : d = new He(), d !== l[0])
1688
1846
  for (let u = 0, h = l.length; u < h; u++)
1689
1847
  d.add(l[u]);
1690
- if (i.name && (d.userData.name = i.name, d.name = n), C(d, i), i.extensions && P(r, d, i), i.matrix !== void 0) {
1691
- const u = new W();
1692
- u.fromArray(i.matrix), d.applyMatrix4(u);
1848
+ if (r.name && (d.userData.name = r.name, d.name = n), C(d, r), r.extensions && D(i, d, r), r.matrix !== void 0) {
1849
+ const u = new $();
1850
+ u.fromArray(r.matrix), d.applyMatrix4(u);
1693
1851
  } else
1694
- i.translation !== void 0 && d.position.fromArray(i.translation), i.rotation !== void 0 && d.quaternion.fromArray(i.rotation), i.scale !== void 0 && d.scale.fromArray(i.scale);
1852
+ r.translation !== void 0 && d.position.fromArray(r.translation), r.rotation !== void 0 && d.quaternion.fromArray(r.rotation), r.scale !== void 0 && d.scale.fromArray(r.scale);
1695
1853
  return s.associations.has(d) || s.associations.set(d, {}), s.associations.get(d).nodes = e, d;
1696
1854
  }), this.nodeCache[e];
1697
1855
  }
@@ -1701,45 +1859,45 @@ class Os {
1701
1859
  * @return {Promise<Group>}
1702
1860
  */
1703
1861
  loadScene(e) {
1704
- const t = this.extensions, r = this.json.scenes[e], s = this, i = new ne();
1705
- r.name && (i.name = s.createUniqueName(r.name)), C(i, r), r.extensions && P(t, i, r);
1706
- const n = r.nodes || [], a = [];
1707
- for (let o = 0, l = n.length; o < l; o++)
1708
- a.push(s.getDependency("node", n[o]));
1709
- return Promise.all(a).then(function(o) {
1710
- for (let d = 0, u = o.length; d < u; d++)
1711
- i.add(o[d]);
1862
+ const t = this.extensions, i = this.json.scenes[e], s = this, r = new se();
1863
+ i.name && (r.name = s.createUniqueName(i.name)), C(r, i), i.extensions && D(t, r, i);
1864
+ const n = i.nodes || [], c = [];
1865
+ for (let a = 0, l = n.length; a < l; a++)
1866
+ c.push(s.getDependency("node", n[a]));
1867
+ return Promise.all(c).then(function(a) {
1868
+ for (let d = 0, u = a.length; d < u; d++)
1869
+ r.add(a[d]);
1712
1870
  const l = (d) => {
1713
1871
  const u = /* @__PURE__ */ new Map();
1714
1872
  for (const [h, f] of s.associations)
1715
- (h instanceof se || h instanceof Re) && u.set(h, f);
1873
+ (h instanceof te || h instanceof Re) && u.set(h, f);
1716
1874
  return d.traverse((h) => {
1717
1875
  const f = s.associations.get(h);
1718
1876
  f != null && u.set(h, f);
1719
1877
  }), u;
1720
1878
  };
1721
- return s.associations = l(i), i;
1879
+ return s.associations = l(r), r;
1722
1880
  });
1723
1881
  }
1724
- _createAnimationTracks(e, t, r, s, i) {
1725
- const n = [], a = e.name ? e.name : e.uuid, o = [];
1726
- O[i.path] === O.weights ? e.traverse(function(h) {
1727
- h.morphTargetInfluences && o.push(h.name ? h.name : h.uuid);
1728
- }) : o.push(a);
1882
+ _createAnimationTracks(e, t, i, s, r) {
1883
+ const n = [], c = e.name ? e.name : e.uuid, a = [];
1884
+ O[r.path] === O.weights ? e.traverse(function(h) {
1885
+ h.morphTargetInfluences && a.push(h.name ? h.name : h.uuid);
1886
+ }) : a.push(c);
1729
1887
  let l;
1730
- switch (O[i.path]) {
1888
+ switch (O[r.path]) {
1731
1889
  case O.weights:
1732
1890
  l = we;
1733
1891
  break;
1734
1892
  case O.rotation:
1735
- l = Le;
1893
+ l = xe;
1736
1894
  break;
1737
1895
  case O.position:
1738
1896
  case O.scale:
1739
1897
  l = Ee;
1740
1898
  break;
1741
1899
  default:
1742
- switch (r.itemSize) {
1900
+ switch (i.itemSize) {
1743
1901
  case 1:
1744
1902
  l = we;
1745
1903
  break;
@@ -1751,10 +1909,10 @@ class Os {
1751
1909
  }
1752
1910
  break;
1753
1911
  }
1754
- const d = s.interpolation !== void 0 ? ys[s.interpolation] : Ke, u = this._getArrayFromAccessor(r);
1755
- for (let h = 0, f = o.length; h < f; h++) {
1912
+ const d = s.interpolation !== void 0 ? As[s.interpolation] : Ke, u = this._getArrayFromAccessor(i);
1913
+ for (let h = 0, f = a.length; h < f; h++) {
1756
1914
  const p = new l(
1757
- o[h] + "." + O[i.path],
1915
+ a[h] + "." + O[r.path],
1758
1916
  t.array,
1759
1917
  u,
1760
1918
  d
@@ -1766,30 +1924,30 @@ class Os {
1766
1924
  _getArrayFromAccessor(e) {
1767
1925
  let t = e.array;
1768
1926
  if (e.normalized) {
1769
- const r = ge(t.constructor), s = new Float32Array(t.length);
1770
- for (let i = 0, n = t.length; i < n; i++)
1771
- s[i] = t[i] * r;
1927
+ const i = pe(t.constructor), s = new Float32Array(t.length);
1928
+ for (let r = 0, n = t.length; r < n; r++)
1929
+ s[r] = t[r] * i;
1772
1930
  t = s;
1773
1931
  }
1774
1932
  return t;
1775
1933
  }
1776
1934
  _createCubicSplineTrackInterpolant(e) {
1777
- e.createInterpolant = function(r) {
1778
- const s = this instanceof Le ? xs : Xe;
1779
- return new s(this.times, this.values, this.getValueSize() / 3, r);
1935
+ e.createInterpolant = function(i) {
1936
+ const s = this instanceof xe ? gs : ze;
1937
+ return new s(this.times, this.values, this.getValueSize() / 3, i);
1780
1938
  }, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
1781
1939
  }
1782
1940
  }
1783
- function Ns(c, e, t) {
1784
- const r = e.attributes, s = new Ut();
1785
- if (r.POSITION !== void 0) {
1786
- const a = t.json.accessors[r.POSITION], o = a.min, l = a.max;
1787
- if (o !== void 0 && l !== void 0) {
1941
+ function Ls(o, e, t) {
1942
+ const i = e.attributes, s = new Ht();
1943
+ if (i.POSITION !== void 0) {
1944
+ const c = t.json.accessors[i.POSITION], a = c.min, l = c.max;
1945
+ if (a !== void 0 && l !== void 0) {
1788
1946
  if (s.set(
1789
- new F(o[0], o[1], o[2]),
1947
+ new F(a[0], a[1], a[2]),
1790
1948
  new F(l[0], l[1], l[2])
1791
- ), a.normalized) {
1792
- const d = ge(H[a.componentType]);
1949
+ ), c.normalized) {
1950
+ const d = pe(H[c.componentType]);
1793
1951
  s.min.multiplyScalar(d), s.max.multiplyScalar(d);
1794
1952
  }
1795
1953
  } else {
@@ -1798,442 +1956,343 @@ function Ns(c, e, t) {
1798
1956
  }
1799
1957
  } else
1800
1958
  return;
1801
- const i = e.targets;
1802
- if (i !== void 0) {
1803
- const a = new F(), o = new F();
1804
- for (let l = 0, d = i.length; l < d; l++) {
1805
- const u = i[l];
1959
+ const r = e.targets;
1960
+ if (r !== void 0) {
1961
+ const c = new F(), a = new F();
1962
+ for (let l = 0, d = r.length; l < d; l++) {
1963
+ const u = r[l];
1806
1964
  if (u.POSITION !== void 0) {
1807
1965
  const h = t.json.accessors[u.POSITION], f = h.min, p = h.max;
1808
1966
  if (f !== void 0 && p !== void 0) {
1809
- if (o.setX(Math.max(Math.abs(f[0]), Math.abs(p[0]))), o.setY(Math.max(Math.abs(f[1]), Math.abs(p[1]))), o.setZ(Math.max(Math.abs(f[2]), Math.abs(p[2]))), h.normalized) {
1810
- const A = ge(H[h.componentType]);
1811
- o.multiplyScalar(A);
1967
+ if (a.setX(Math.max(Math.abs(f[0]), Math.abs(p[0]))), a.setY(Math.max(Math.abs(f[1]), Math.abs(p[1]))), a.setZ(Math.max(Math.abs(f[2]), Math.abs(p[2]))), h.normalized) {
1968
+ const A = pe(H[h.componentType]);
1969
+ a.multiplyScalar(A);
1812
1970
  }
1813
- a.max(o);
1971
+ c.max(a);
1814
1972
  } else
1815
1973
  console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
1816
1974
  }
1817
1975
  }
1818
- s.expandByVector(a);
1976
+ s.expandByVector(c);
1819
1977
  }
1820
- c.boundingBox = s;
1821
- const n = new Gt();
1822
- s.getCenter(n.center), n.radius = s.min.distanceTo(s.max) / 2, c.boundingSphere = n;
1978
+ o.boundingBox = s;
1979
+ const n = new Ut();
1980
+ s.getCenter(n.center), n.radius = s.min.distanceTo(s.max) / 2, o.boundingSphere = n;
1823
1981
  }
1824
- function ve(c, e, t) {
1825
- const r = e.attributes, s = [];
1826
- function i(n, a) {
1827
- return t.getDependency("accessor", n).then(function(o) {
1828
- c.setAttribute(a, o);
1982
+ function ve(o, e, t) {
1983
+ const i = e.attributes, s = [];
1984
+ function r(n, c) {
1985
+ return t.getDependency("accessor", n).then(function(a) {
1986
+ o.setAttribute(c, a);
1829
1987
  });
1830
1988
  }
1831
- for (const n in r) {
1832
- const a = me[n] || n.toLowerCase();
1833
- a in c.attributes || s.push(i(r[n], a));
1989
+ for (const n in i) {
1990
+ const c = fe[n] || n.toLowerCase();
1991
+ c in o.attributes || s.push(r(i[n], c));
1834
1992
  }
1835
- if (e.indices !== void 0 && !c.index) {
1836
- const n = t.getDependency("accessor", e.indices).then(function(a) {
1837
- c.setIndex(a);
1993
+ if (e.indices !== void 0 && !o.index) {
1994
+ const n = t.getDependency("accessor", e.indices).then(function(c) {
1995
+ o.setIndex(c);
1838
1996
  });
1839
1997
  s.push(n);
1840
1998
  }
1841
- return fe.workingColorSpace !== S && "COLOR_0" in r && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${fe.workingColorSpace}" not supported.`), C(c, e), Ns(c, e, t), Promise.all(s).then(function() {
1842
- return e.targets !== void 0 ? Ss(c, e.targets, t) : c;
1999
+ return ue.workingColorSpace !== S && "COLOR_0" in i && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ue.workingColorSpace}" not supported.`), C(o, e), Ls(o, e, t), Promise.all(s).then(function() {
2000
+ return e.targets !== void 0 ? _s(o, e.targets, t) : o;
1843
2001
  });
1844
2002
  }
1845
- const ae = /* @__PURE__ */ new WeakMap();
1846
- class Ds extends De {
1847
- constructor(e) {
1848
- super(e), this.decoderPath = "", this.decoderConfig = {}, this.decoderBinary = null, this.decoderPending = null, this.workerLimit = 4, this.workerPool = [], this.workerNextTaskID = 1, this.workerSourceURL = "", this.defaultAttributeIDs = {
1849
- position: "POSITION",
1850
- normal: "NORMAL",
1851
- color: "COLOR",
1852
- uv: "TEX_COORD"
1853
- }, this.defaultAttributeTypes = {
1854
- position: "Float32Array",
1855
- normal: "Float32Array",
1856
- color: "Float32Array",
1857
- uv: "Float32Array"
1858
- };
1859
- }
1860
- setDecoderPath(e) {
1861
- return this.decoderPath = e, this;
1862
- }
1863
- setDecoderConfig(e) {
1864
- return this.decoderConfig = e, this;
1865
- }
1866
- setWorkerLimit(e) {
1867
- return this.workerLimit = e, this;
1868
- }
1869
- load(e, t, r, s) {
1870
- const i = new $(this.manager);
1871
- i.setPath(this.path), i.setResponseType("arraybuffer"), i.setRequestHeader(this.requestHeader), i.setWithCredentials(this.withCredentials), i.load(e, (n) => {
1872
- this.parse(n, t, s);
1873
- }, r, s);
1874
- }
1875
- parse(e, t, r = () => {
1876
- }) {
1877
- this.decodeDracoFile(e, t, null, null, N, r).catch(r);
2003
+ var bs = Object.defineProperty, Ss = Object.getOwnPropertyDescriptor, vs = (o, e, t, i) => {
2004
+ for (var s = i > 1 ? void 0 : i ? Ss(e, t) : e, r = o.length - 1, n; r >= 0; r--)
2005
+ (n = o[r]) && (s = (i ? n(e, t, s) : n(s)) || s);
2006
+ return i && s && bs(e, t, s), s;
2007
+ };
2008
+ let q = class {
2009
+ constructor() {
2010
+ _(this, "workerPool", $e(void 0, !0));
2011
+ _(this, "canvas");
2012
+ _(this, "worker");
2013
+ _(this, "thread");
1878
2014
  }
1879
- decodeDracoFile(e, t, r, s, i = S, n = () => {
1880
- }) {
1881
- const a = {
1882
- attributeIDs: r || this.defaultAttributeIDs,
1883
- attributeTypes: s || this.defaultAttributeTypes,
1884
- useUniqueIDs: !!r,
1885
- vertexColorSpace: i
1886
- };
1887
- return this.decodeGeometry(e, a).then(t).catch(n);
2015
+ init(o) {
2016
+ this.worker = o.worker, this.thread = o.thread;
1888
2017
  }
1889
- decodeGeometry(e, t) {
1890
- const r = JSON.stringify(t);
1891
- if (ae.has(e)) {
1892
- const o = ae.get(e);
1893
- if (o.key === r)
1894
- return o.promise;
1895
- if (e.byteLength === 0)
1896
- throw new Error(
1897
- "THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred."
1898
- );
1899
- }
1900
- let s;
1901
- const i = this.workerNextTaskID++, n = e.byteLength, a = this._getWorker(i, n).then((o) => (s = o, new Promise((l, d) => {
1902
- s._callbacks[i] = { resolve: l, reject: d }, s.postMessage({ type: "decode", id: i, taskConfig: t, buffer: e }, [e]);
1903
- }))).then((o) => this._createGeometry(o.geometry));
1904
- return a.catch(() => !0).then(() => {
1905
- s && i && this._releaseTask(s, i);
1906
- }), ae.set(e, {
1907
- key: r,
1908
- promise: a
1909
- }), a;
2018
+ };
2019
+ q = vs([
2020
+ V()
2021
+ ], q);
2022
+ var Cs = Object.defineProperty, Ms = Object.getOwnPropertyDescriptor, Is = (o, e, t, i) => {
2023
+ for (var s = i > 1 ? void 0 : i ? Ms(e, t) : e, r = o.length - 1, n; r >= 0; r--)
2024
+ (n = o[r]) && (s = (i ? n(e, t, s) : n(s)) || s);
2025
+ return i && s && Cs(e, t, s), s;
2026
+ }, Os = (o, e) => (t, i) => e(t, i, o);
2027
+ let me = class extends qe {
2028
+ constructor(e) {
2029
+ super();
2030
+ _(this, "canvas");
2031
+ this._service = e;
1910
2032
  }
1911
- _createGeometry(e) {
1912
- const t = new je();
1913
- e.index && t.setIndex(new K(e.index.array, 1));
1914
- for (let r = 0; r < e.attributes.length; r++) {
1915
- const s = e.attributes[r], i = s.name, n = s.array, a = s.itemSize, o = new K(n, a);
1916
- i === "color" && (this._assignVertexColorSpace(o, s.vertexColorSpace), o.normalized = !(n instanceof Float32Array)), t.setAttribute(i, o);
2033
+ init(e) {
2034
+ this.canvas = e;
2035
+ for (const t of Ce) {
2036
+ const i = t.startsWith("mouse") || t.startsWith("pointer") || t.startsWith("touch") ? this.mouseEventHandler : t.startsWith("key") ? this.keyEventHandler : t === "resize" ? this.uiEventHandler : t === "wheel" ? this.wheelEventHandler : this.preventDefaultHandler;
2037
+ this[`${t}$`] = Ye(
2038
+ t === "resize" ? window : e,
2039
+ t
2040
+ ).pipe(
2041
+ // @ts-ignore
2042
+ ce(i.bind(this)),
2043
+ Me((s) => !(t === "keydown" && !s))
2044
+ ), this[`${t}$`].subscribe((s) => {
2045
+ var r, n;
2046
+ (n = (r = this._service.thread) == null ? void 0 : r[t]) == null || n.call(r, s);
2047
+ });
1917
2048
  }
1918
- return t;
1919
- }
1920
- _assignVertexColorSpace(e, t) {
1921
- if (t !== N) return;
1922
- const r = new D();
1923
- for (let s = 0, i = e.count; s < i; s++)
1924
- r.fromBufferAttribute(e, s), fe.toWorkingColorSpace(r, N), e.setXYZ(s, r.r, r.g, r.b);
1925
- }
1926
- _loadLibrary(e, t) {
1927
- const r = new $(this.manager);
1928
- return r.setPath(this.decoderPath), r.setResponseType(t), r.setWithCredentials(this.withCredentials), new Promise((s, i) => {
1929
- r.load(e, s, void 0, i);
1930
- });
1931
- }
1932
- preload() {
1933
- return this._initDecoder(), this;
1934
- }
1935
- _initDecoder() {
1936
- if (this.decoderPending) return this.decoderPending;
1937
- const e = typeof WebAssembly != "object" || this.decoderConfig.type === "js", t = [];
1938
- return e ? t.push(this._loadLibrary("draco_decoder.js", "text")) : (t.push(this._loadLibrary("draco_wasm_wrapper.js", "text")), t.push(this._loadLibrary("draco_decoder.wasm", "arraybuffer"))), this.decoderPending = Promise.all(t).then((r) => {
1939
- const s = r[0];
1940
- e || (this.decoderConfig.wasmBinary = r[1]);
1941
- const i = Ps.toString(), n = [
1942
- "/* draco decoder */",
1943
- s,
1944
- "",
1945
- "/* worker */",
1946
- i.substring(i.indexOf("{") + 1, i.lastIndexOf("}"))
1947
- ].join(`
1948
- `);
1949
- this.workerSourceURL = URL.createObjectURL(new Blob([n]));
1950
- }), this.decoderPending;
1951
2049
  }
1952
- _getWorker(e, t) {
1953
- return this._initDecoder().then(() => {
1954
- if (this.workerPool.length < this.workerLimit) {
1955
- const s = new Worker(this.workerSourceURL);
1956
- s._callbacks = {}, s._taskCosts = {}, s._taskLoad = 0, s.postMessage({ type: "init", decoderConfig: this.decoderConfig }), s.onmessage = function(i) {
1957
- const n = i.data;
1958
- switch (n.type) {
1959
- case "decode":
1960
- s._callbacks[n.id].resolve(n);
1961
- break;
1962
- case "error":
1963
- s._callbacks[n.id].reject(n);
1964
- break;
1965
- default:
1966
- console.error('THREE.DRACOLoader: Unexpected message, "' + n.type + '"');
1967
- }
1968
- }, this.workerPool.push(s);
1969
- } else
1970
- this.workerPool.sort(function(s, i) {
1971
- return s._taskLoad > i._taskLoad ? -1 : 1;
1972
- });
1973
- const r = this.workerPool[this.workerPool.length - 1];
1974
- return r._taskCosts[e] = t, r._taskLoad += t, r;
1975
- });
2050
+ preventDefaultHandler(e) {
2051
+ return e.preventDefault(), {
2052
+ type: e.type
2053
+ };
1976
2054
  }
1977
- _releaseTask(e, t) {
1978
- e._taskLoad -= e._taskCosts[t], delete e._callbacks[t], delete e._taskCosts[t];
2055
+ getScreenSizes() {
2056
+ return {
2057
+ width: this.canvas.width,
2058
+ height: this.canvas.height,
2059
+ windowWidth: (window == null ? void 0 : window.innerWidth) ?? 0,
2060
+ windowHeight: (window == null ? void 0 : window.innerHeight) ?? 0
2061
+ };
1979
2062
  }
1980
- debug() {
1981
- console.log("Task load: ", this.workerPool.map((e) => e._taskLoad));
2063
+ uiEventHandler(e) {
2064
+ const t = this.canvas.getBoundingClientRect();
2065
+ return {
2066
+ ...this.getScreenSizes(),
2067
+ type: e.type,
2068
+ top: t.top,
2069
+ left: t.left
2070
+ };
1982
2071
  }
1983
- dispose() {
1984
- for (let e = 0; e < this.workerPool.length; ++e)
1985
- this.workerPool[e].terminate();
1986
- return this.workerPool.length = 0, this.workerSourceURL !== "" && URL.revokeObjectURL(this.workerSourceURL), this;
2072
+ mouseEventHandler(e) {
2073
+ return {
2074
+ ...this.getScreenSizes(),
2075
+ ...ee(e, [
2076
+ "ctrlKey",
2077
+ "metaKey",
2078
+ "shiftKey",
2079
+ "button",
2080
+ "pointerType",
2081
+ "clientX",
2082
+ "clientY",
2083
+ "pageX",
2084
+ "pageY"
2085
+ ])
2086
+ };
1987
2087
  }
1988
- }
1989
- function Ps() {
1990
- let c, e;
1991
- onmessage = function(n) {
1992
- const a = n.data;
1993
- switch (a.type) {
1994
- case "init":
1995
- c = a.decoderConfig, e = new Promise(function(d) {
1996
- c.onModuleLoaded = function(u) {
1997
- d({ draco: u });
1998
- }, DracoDecoderModule(c);
1999
- });
2000
- break;
2001
- case "decode":
2002
- const o = a.buffer, l = a.taskConfig;
2003
- e.then((d) => {
2004
- const u = d.draco, h = new u.Decoder();
2005
- try {
2006
- const f = t(u, h, new Int8Array(o), l), p = f.attributes.map((A) => A.array.buffer);
2007
- f.index && p.push(f.index.array.buffer), self.postMessage({ type: "decode", id: a.id, geometry: f }, p);
2008
- } catch (f) {
2009
- console.error(f), self.postMessage({ type: "error", id: a.id, error: f.message });
2010
- } finally {
2011
- u.destroy(h);
2012
- }
2013
- });
2014
- break;
2015
- }
2016
- };
2017
- function t(n, a, o, l) {
2018
- const d = l.attributeIDs, u = l.attributeTypes;
2019
- let h, f;
2020
- const p = a.GetEncodedGeometryType(o);
2021
- if (p === n.TRIANGULAR_MESH)
2022
- h = new n.Mesh(), f = a.DecodeArrayToMesh(o, o.byteLength, h);
2023
- else if (p === n.POINT_CLOUD)
2024
- h = new n.PointCloud(), f = a.DecodeArrayToPointCloud(o, o.byteLength, h);
2025
- else
2026
- throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
2027
- if (!f.ok() || h.ptr === 0)
2028
- throw new Error("THREE.DRACOLoader: Decoding failed: " + f.error_msg());
2029
- const A = { index: null, attributes: [] };
2030
- for (const m in d) {
2031
- const g = self[u[m]];
2032
- let _, w;
2033
- if (l.useUniqueIDs)
2034
- w = d[m], _ = a.GetAttributeByUniqueId(h, w);
2035
- else {
2036
- if (w = a.GetAttributeId(h, n[d[m]]), w === -1) continue;
2037
- _ = a.GetAttribute(h, w);
2038
- }
2039
- const R = s(n, a, h, m, g, _);
2040
- m === "color" && (R.vertexColorSpace = l.vertexColorSpace), A.attributes.push(R);
2088
+ touchEventHandler(e) {
2089
+ const t = [], i = { type: e.type, touches: t };
2090
+ for (let s = 0; s < e.touches.length; ++s) {
2091
+ const r = e.touches[s];
2092
+ t.push({
2093
+ pageX: (r == null ? void 0 : r.pageX) ?? 0,
2094
+ pageY: (r == null ? void 0 : r.pageY) ?? 0
2095
+ });
2041
2096
  }
2042
- return p === n.TRIANGULAR_MESH && (A.index = r(n, a, h)), n.destroy(h), A;
2043
- }
2044
- function r(n, a, o) {
2045
- const d = o.num_faces() * 3, u = d * 4, h = n._malloc(u);
2046
- a.GetTrianglesUInt32Array(o, u, h);
2047
- const f = new Uint32Array(n.HEAPF32.buffer, h, d).slice();
2048
- return n._free(h), { array: f, itemSize: 1 };
2097
+ return { ...this.getScreenSizes(), ...i };
2049
2098
  }
2050
- function s(n, a, o, l, d, u) {
2051
- const h = u.num_components(), p = o.num_points() * h, A = p * d.BYTES_PER_ELEMENT, m = i(n, d), g = n._malloc(A);
2052
- a.GetAttributeDataArrayForAllPoints(o, u, m, A, g);
2053
- const _ = new d(n.HEAPF32.buffer, g, p).slice();
2054
- return n._free(g), {
2055
- name: l,
2056
- array: _,
2057
- itemSize: h
2099
+ wheelEventHandler(e) {
2100
+ return e.preventDefault(), {
2101
+ ...this.getScreenSizes(),
2102
+ ...ee(e, ["deltaX", "deltaY"])
2058
2103
  };
2059
2104
  }
2060
- function i(n, a) {
2061
- switch (a) {
2062
- case Float32Array:
2063
- return n.DT_FLOAT32;
2064
- case Int8Array:
2065
- return n.DT_INT8;
2066
- case Int16Array:
2067
- return n.DT_INT16;
2068
- case Int32Array:
2069
- return n.DT_INT32;
2070
- case Uint8Array:
2071
- return n.DT_UINT8;
2072
- case Uint16Array:
2073
- return n.DT_UINT16;
2074
- case Uint32Array:
2075
- return n.DT_UINT32;
2076
- }
2105
+ keyEventHandler(e) {
2106
+ if (Qe.includes(e.code))
2107
+ return e.preventDefault(), {
2108
+ ...this.getScreenSizes(),
2109
+ ...ee(e, ["ctrlKey", "metaKey", "shiftKey", "keyCode"])
2110
+ };
2077
2111
  }
2078
- }
2079
- var ks = Object.defineProperty, Fs = Object.getOwnPropertyDescriptor, Hs = (c, e, t, r) => {
2080
- for (var s = r > 1 ? void 0 : r ? Fs(e, t) : e, i = c.length - 1, n; i >= 0; i--)
2081
- (n = c[i]) && (s = (r ? n(e, t, s) : n(s)) || s);
2082
- return r && s && ks(e, t, s), s;
2112
+ };
2113
+ me = Is([
2114
+ V(),
2115
+ Os(0, L(q))
2116
+ ], me);
2117
+ var Ns = Object.defineProperty, Ps = Object.getOwnPropertyDescriptor, Ds = (o, e, t, i) => {
2118
+ for (var s = i > 1 ? void 0 : i ? Ps(e, t) : e, r = o.length - 1, n; r >= 0; r--)
2119
+ (n = o[r]) && (s = (i ? n(e, t, s) : n(s)) || s);
2120
+ return i && s && Ns(e, t, s), s;
2083
2121
  };
2084
2122
  let Y = class {
2085
2123
  constructor() {
2086
- E(this, "loadingManager", new jt());
2087
- E(this, "loaders", {});
2088
- E(this, "sources", []);
2089
- E(this, "loadedResources", {});
2090
- E(this, "toLoadCount", 0);
2091
- E(this, "loadedCount", 0);
2124
+ _(this, "loadingManager", new Bt());
2125
+ _(this, "loaders", {});
2126
+ _(this, "sources", []);
2127
+ _(this, "loadedResources", {});
2128
+ _(this, "toLoadCount", 0);
2129
+ _(this, "loadedCount", 0);
2092
2130
  }
2093
2131
  /** @description The video loader. based on {@link HTMLVideoElement}. */
2094
2132
  get videoLoader() {
2095
2133
  return {
2096
- load: (c, e) => {
2134
+ load: (o, e) => {
2097
2135
  const t = document.createElement("video");
2098
- t.muted = !0, t.loop = !0, t.controls = !1, t.playsInline = !0, t.src = c, t.autoplay = !0;
2099
- const r = () => {
2136
+ t.muted = !0, t.loop = !0, t.crossOrigin = "anonymous", t.controls = !1, t.playsInline = !0, t.src = o, t.autoplay = !0;
2137
+ async function i(r) {
2138
+ const n = new OffscreenCanvas(
2139
+ r.videoWidth,
2140
+ r.videoHeight
2141
+ ), c = n.getContext("2d"), a = 30, l = [];
2142
+ return console.log("Extracting frames from video"), new Promise((d) => {
2143
+ for (r.currentTime = 0; r.currentTime < r.duration; ) {
2144
+ c == null || c.drawImage(
2145
+ r,
2146
+ 0,
2147
+ 0,
2148
+ n.width,
2149
+ n.height
2150
+ );
2151
+ const u = n.transferToImageBitmap();
2152
+ l.push(u), r.currentTime < r.duration && (r.currentTime += 1 / a);
2153
+ }
2154
+ d(l), r.onerror = (u) => {
2155
+ console.error("Error while extracting frames:", u);
2156
+ }, r.currentTime = 0;
2157
+ });
2158
+ }
2159
+ const s = async () => {
2100
2160
  if (!t) return;
2101
- t.play();
2102
- const s = new Ve(t), i = s.dispose.bind(s);
2103
- s.dispose = () => {
2104
- var n;
2105
- (n = s.image) == null || n.remove(), i();
2106
- }, e(s), t.removeEventListener("canplaythrough", r);
2161
+ const r = await i(t);
2162
+ console.log("Video loaded", r), e(r), t.removeEventListener("loadeddata", s);
2107
2163
  };
2108
- t.addEventListener("canplaythrough", r);
2164
+ t.addEventListener("loadeddata", s);
2109
2165
  }
2110
2166
  };
2111
2167
  }
2112
2168
  _initLoaders() {
2113
- this.loaders.gltfLoader = new Zt(this.loadingManager), this.loaders.textureLoader = new He(this.loadingManager), this.loaders.cubeTextureLoader = new Kt(this.loadingManager), this.loaders.audioLoader = new Vt(this.loadingManager), this.loaders.dracoLoader = new Ds(this.loadingManager), this.loaders.videoLoader = this.videoLoader;
2169
+ this.loaders.dracoLoader = new Kt(this.loadingManager), this.loaders.audioLoader = new jt(this.loadingManager), this.loaders.gltfLoader = new zt(this.loadingManager), this.loaders.imageLoader = new Ue(this.loadingManager), this.loaders.videoLoader = this.videoLoader;
2114
2170
  }
2115
- _initSources(c) {
2116
- this.sources = c, this.toLoadCount = this.sources.length, this.loadedCount = 0;
2171
+ _initSources(o) {
2172
+ this.sources = o, this.toLoadCount = this.sources.length, this.loadedCount = 0;
2117
2173
  }
2118
- init(c = []) {
2119
- this._initLoaders(), this._initSources(c);
2174
+ init(o = []) {
2175
+ this._initLoaders(), this._initSources(o);
2120
2176
  }
2121
- setDracoDecoder(c) {
2177
+ setDracoDecoder(o) {
2122
2178
  var e;
2123
2179
  this.loaders.dracoLoader && (this.loaders.dracoLoader.setDecoderPath(
2124
- c ?? "https://www.gstatic.com/draco/versioned/decoders/1.4.3/"
2180
+ o ?? "https://www.gstatic.com/draco/versioned/decoders/1.4.3/"
2125
2181
  ), (e = this.loaders.gltfLoader) == null || e.setDRACOLoader(this.loaders.dracoLoader));
2126
2182
  }
2127
2183
  handleLoad({
2128
- source: c,
2184
+ source: o,
2129
2185
  resource: e,
2130
2186
  toLoadCount: t,
2131
- loadedCount: r
2187
+ loadedCount: i
2132
2188
  }) {
2133
- e && (this.loadedResources[c.name] = e, this.loadedCount = r, this.toLoadCount = t);
2189
+ e && (this.loadedResources[o.name] = e, this.loadedCount = i, this.toLoadCount = t);
2190
+ }
2191
+ load(o) {
2192
+ var t, i, s, r;
2193
+ const e = this.sources[0];
2194
+ if (e) {
2195
+ o == null || o(e);
2196
+ for (const n of this.sources) {
2197
+ if (this.loadedResources[n.name] || typeof n.path != "string")
2198
+ return;
2199
+ n.type === "gltf" && ((t = this.loaders.gltfLoader) == null || t.load(
2200
+ n.path,
2201
+ (c) => o == null ? void 0 : o(n, c)
2202
+ )), n.type === "audio" && ((i = this.loaders.audioLoader) == null || i.load(n.path, (c) => {
2203
+ o == null || o(n, c);
2204
+ })), n.type === "image" && ((s = this.loaders.imageLoader) == null || s.load(n.path, (c) => {
2205
+ o == null || o(n, c);
2206
+ })), n.type === "video" && ((r = this.loaders.videoLoader) == null || r.load(
2207
+ n.path,
2208
+ (c) => o == null ? void 0 : o(n, c)
2209
+ ));
2210
+ }
2211
+ }
2134
2212
  }
2135
2213
  };
2136
- Y = Hs([
2214
+ Y = Ds([
2137
2215
  V()
2138
2216
  ], Y);
2139
- var Us = Object.defineProperty, Gs = Object.getOwnPropertyDescriptor, Bs = (c, e, t, r) => {
2140
- for (var s = r > 1 ? void 0 : r ? Gs(e, t) : e, i = c.length - 1, n; i >= 0; i--)
2141
- (n = c[i]) && (s = (r ? n(e, t, s) : n(s)) || s);
2142
- return r && s && Us(e, t, s), s;
2143
- }, js = (c, e) => (t, r) => e(t, r, c);
2217
+ var ks = Object.defineProperty, Fs = Object.getOwnPropertyDescriptor, Hs = (o, e, t, i) => {
2218
+ for (var s = i > 1 ? void 0 : i ? Fs(e, t) : e, r = o.length - 1, n; r >= 0; r--)
2219
+ (n = o[r]) && (s = (i ? n(e, t, s) : n(s)) || s);
2220
+ return i && s && ks(e, t, s), s;
2221
+ }, Us = (o, e) => (t, i) => e(t, i, o);
2144
2222
  let Q = class {
2145
- constructor(c) {
2146
- E(this, "load$$", new Ze());
2147
- E(this, "load$", this.load$$.pipe(
2148
- le((c) => ({
2149
- ...c,
2150
- loadedCount: c.resource ? this._service.loadedCount + 1 : this._service.loadedCount,
2223
+ constructor(o) {
2224
+ _(this, "load$$", new Je());
2225
+ _(this, "load$", this.load$$.pipe(
2226
+ ce((o) => ({
2227
+ ...o,
2228
+ loadedCount: o.resource ? this._service.loadedCount + 1 : this._service.loadedCount,
2151
2229
  toLoadCount: this._service.toLoadCount
2152
2230
  })),
2153
- et()
2231
+ Ze()
2154
2232
  ));
2155
- E(this, "serializedLoad$", this.load$.pipe(
2156
- le((c) => {
2157
- var t;
2158
- let e = c.resource;
2159
- if ((t = c == null ? void 0 : c.resource) != null && t.parser) {
2160
- const r = c.resource;
2233
+ _(this, "serializedLoad$", this.load$.pipe(
2234
+ ce((o) => {
2235
+ var t, i;
2236
+ let e = o.resource;
2237
+ if ((t = o == null ? void 0 : o.resource) != null && t.parser) {
2238
+ const s = o.resource, r = s.scenes.map(
2239
+ (n) => Te(n)
2240
+ );
2161
2241
  e = {
2162
- animations: (c == null ? void 0 : c.resource).animations.map(
2242
+ animations: (o == null ? void 0 : o.resource).animations.map(
2163
2243
  // @ts-ignore <<toJSON methods doesn't require a parameter>>
2164
- (s) => s.toJSON()
2244
+ (n) => n.toJSON()
2165
2245
  ),
2166
- cameras: r.cameras.map(
2167
- (s) => te(s)
2246
+ cameras: s.cameras.map(
2247
+ (n) => Te(n)
2168
2248
  ),
2169
- parser: { json: r.parser.json },
2170
- scene: te(r.scene),
2171
- scenes: r.scenes.map((s) => te(s)),
2172
- userData: r.userData
2249
+ parser: { json: s.parser.json },
2250
+ scene: r == null ? void 0 : r[0],
2251
+ scenes: r,
2252
+ userData: s.userData
2173
2253
  };
2174
2254
  }
2175
- return (c == null ? void 0 : c.resource) instanceof Ve && (e = c.resource.toJSON()), {
2176
- ...c,
2255
+ return ((i = o == null ? void 0 : o.source) == null ? void 0 : i.type) === "video" && Array.isArray(o.resource) && console.log("Serialized Texture ===>", o.resource), {
2256
+ ...o,
2177
2257
  resource: e
2178
2258
  };
2179
2259
  })
2180
2260
  ));
2181
- E(this, "loadCompleted$", this.load$.pipe(
2182
- Me((c) => c.toLoadCount === c.loadedCount)
2261
+ _(this, "loadCompleted$", this.load$.pipe(
2262
+ Me((o) => o.toLoadCount === o.loadedCount)
2183
2263
  ));
2184
- this._service = c;
2264
+ this._service = o;
2185
2265
  }
2186
2266
  };
2187
- Q = Bs([
2267
+ Q = Hs([
2188
2268
  V(),
2189
- js(0, y(Y))
2269
+ Us(0, L(Y))
2190
2270
  ], Q);
2191
- var Ks = Object.defineProperty, Vs = Object.getOwnPropertyDescriptor, zs = (c, e, t, r) => {
2192
- for (var s = r > 1 ? void 0 : r ? Vs(e, t) : e, i = c.length - 1, n; i >= 0; i--)
2193
- (n = c[i]) && (s = (r ? n(e, t, s) : n(s)) || s);
2194
- return r && s && Ks(e, t, s), s;
2195
- }, ce = (c, e) => (t, r) => e(t, r, c);
2271
+ var Gs = Object.defineProperty, Bs = Object.getOwnPropertyDescriptor, js = (o, e, t, i) => {
2272
+ for (var s = i > 1 ? void 0 : i ? Bs(e, t) : e, r = o.length - 1, n; r >= 0; r--)
2273
+ (n = o[r]) && (s = (i ? n(e, t, s) : n(s)) || s);
2274
+ return i && s && Gs(e, t, s), s;
2275
+ }, ae = (o, e) => (t, i) => e(t, i, o);
2196
2276
  let J = class {
2197
- constructor(c, e, t) {
2198
- E(this, "_subscriptions", []);
2199
- this._controller = c, this._service = e, this._props = t, this._subscriptions.push(
2277
+ constructor(o, e, t) {
2278
+ _(this, "_subscriptions", []);
2279
+ this._controller = o, this._service = e, this._props = t, this._subscriptions.push(
2200
2280
  this._controller.load$.subscribe(
2201
2281
  this._service.handleLoad.bind(this._service)
2202
2282
  )
2203
2283
  );
2204
2284
  }
2205
- _performLoad(c, e) {
2285
+ _listenToLoad(o, e) {
2206
2286
  this._controller.load$$.next({
2207
- source: c,
2287
+ source: o,
2208
2288
  resource: e
2209
2289
  });
2210
2290
  }
2211
- init(c = []) {
2212
- this._service.init(c), this._service.setDracoDecoder(), [void 0, !0].includes(this._props.loadResourcesOnInit) && this.load();
2291
+ init(o = []) {
2292
+ this._service.init(o), this._service.setDracoDecoder(), [void 0, !0].includes(this._props.loadResourcesOnInit) && this.load();
2213
2293
  }
2214
2294
  load() {
2215
- var e, t, r, s, i;
2216
- const c = this._service.sources[0];
2217
- if (c) {
2218
- this._performLoad(c);
2219
- for (const n of this._service.sources) {
2220
- if (this._service.loadedResources[n.name]) return;
2221
- n.type === "gltfModel" && typeof n.path == "string" && ((e = this._service.loaders.gltfLoader) == null || e.load(
2222
- n.path,
2223
- (a) => this._performLoad(n, a)
2224
- )), n.type === "texture" && typeof n.path == "string" && ((t = this._service.loaders.textureLoader) == null || t.load(n.path, (a) => {
2225
- this._performLoad(n, new zt(a));
2226
- })), n.type === "cubeTexture" && typeof n.path == "object" && ((r = this._service.loaders.cubeTextureLoader) == null || r.load(
2227
- n.path,
2228
- (a) => this._performLoad(n, a)
2229
- )), n.type === "video" && typeof n.path == "string" && ((s = this._service.loaders.videoLoader) == null || s.load(
2230
- n.path,
2231
- (a) => this._performLoad(n, a)
2232
- )), n.type === "audio" && typeof n.path == "string" && ((i = this._service.loaders.audioLoader) == null || i.load(n.path, (a) => {
2233
- this._performLoad(n, a);
2234
- }));
2235
- }
2236
- }
2295
+ this._service.load(this._listenToLoad.bind(this));
2237
2296
  }
2238
2297
  getLoadedResources() {
2239
2298
  return this._service.loadedResources;
@@ -2256,30 +2315,30 @@ let J = class {
2256
2315
  getLoadCompleted$() {
2257
2316
  return this._controller.loadCompleted$;
2258
2317
  }
2259
- setDracoDecoder(c) {
2260
- this._service.setDracoDecoder(c);
2318
+ setDracoDecoder(o) {
2319
+ this._service.setDracoDecoder(o);
2261
2320
  }
2262
2321
  dispose() {
2263
2322
  this._controller.load$$.complete();
2264
2323
  }
2265
2324
  };
2266
- J = zs([
2325
+ J = js([
2267
2326
  V(),
2268
- ce(0, y(Q)),
2269
- ce(1, y(Y)),
2270
- ce(2, y(Te))
2327
+ ae(0, L(Q)),
2328
+ ae(1, L(Y)),
2329
+ ae(2, L(Ae))
2271
2330
  ], J);
2272
2331
  Ie.resolve(J);
2273
- var Xs = Object.defineProperty, $s = Object.getOwnPropertyDescriptor, Ws = (c, e, t, r) => {
2274
- for (var s = r > 1 ? void 0 : r ? $s(e, t) : e, i = c.length - 1, n; i >= 0; i--)
2275
- (n = c[i]) && (s = (r ? n(e, t, s) : n(s)) || s);
2276
- return r && s && Xs(e, t, s), s;
2277
- }, k = (c, e) => (t, r) => e(t, r, c);
2278
- let Ae = class extends nt {
2279
- constructor(e, t, r, s, i, n) {
2332
+ var Ks = Object.defineProperty, Vs = Object.getOwnPropertyDescriptor, zs = (o, e, t, i) => {
2333
+ for (var s = i > 1 ? void 0 : i ? Vs(e, t) : e, r = o.length - 1, n; r >= 0; r--)
2334
+ (n = o[r]) && (s = (i ? n(e, t, s) : n(s)) || s);
2335
+ return i && s && Ks(e, t, s), s;
2336
+ }, k = (o, e) => (t, i) => e(t, i, o);
2337
+ let ge = class extends st {
2338
+ constructor(e, t, i, s, r, n) {
2280
2339
  super();
2281
- E(this, "initialized", !1);
2282
- this._service = e, this._controller = t, this._loaderController = r, this.props = s, this.loader = i, this.container = n, this.props.initOnConstruct && this.init();
2340
+ _(this, "initialized", !1);
2341
+ this._service = e, this._controller = t, this._loaderController = i, this.props = s, this.loader = r, this.container = n, this.props.initOnConstruct && this.init();
2283
2342
  }
2284
2343
  async _initCanvas() {
2285
2344
  try {
@@ -2314,11 +2373,11 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
2314
2373
  throw new Error("Canvas element is not initialized.");
2315
2374
  const e = this._service.canvas.transferControlToOffscreen();
2316
2375
  e.width = this._service.canvas.clientWidth, e.height = this._service.canvas.clientHeight;
2317
- const [t, r] = await this._service.workerPool.run({
2376
+ const [t, i] = await this._service.workerPool.run({
2318
2377
  payload: {
2319
2378
  path: this.props.location,
2320
2379
  subject: {
2321
- ...rt(this.props, [
2380
+ ...nt(this.props, [
2322
2381
  "canvas",
2323
2382
  "location",
2324
2383
  "onReady",
@@ -2329,7 +2388,7 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
2329
2388
  transferSubject: [e]
2330
2389
  }
2331
2390
  });
2332
- if (!t || r)
2391
+ if (!t || i)
2333
2392
  throw new Error("Unable to retrieve the worker-thread info.");
2334
2393
  this._service.worker = t.worker, this._service.thread = t.thread;
2335
2394
  }
@@ -2346,7 +2405,7 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
2346
2405
  (e) => {
2347
2406
  var t;
2348
2407
  return (t = this._service.worker) == null ? void 0 : t.postMessage({
2349
- token: it,
2408
+ token: rt,
2350
2409
  payload: e
2351
2410
  });
2352
2411
  }
@@ -2376,42 +2435,42 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
2376
2435
  await this._service.workerPool.terminateAll(), ((e = this._service.canvas) == null ? void 0 : e.dataset.reactive) === "true" && (this._service.canvas.remove(), this._service.canvas = void 0), this.initialized = !1;
2377
2436
  }
2378
2437
  };
2379
- Ae = Ws([
2380
- tt(st.ContainerScoped),
2381
- k(0, y(q)),
2382
- k(1, y(pe)),
2383
- k(2, y(Q)),
2384
- k(3, y(Te)),
2385
- k(4, y(J)),
2386
- k(5, y(Oe))
2387
- ], Ae);
2388
- const Zs = (c) => {
2389
- if (typeof (c == null ? void 0 : c.location) != "string" && !((c == null ? void 0 : c.location) instanceof URL))
2438
+ ge = zs([
2439
+ et(tt.ContainerScoped),
2440
+ k(0, L(q)),
2441
+ k(1, L(me)),
2442
+ k(2, L(Q)),
2443
+ k(3, L(Ae)),
2444
+ k(4, L(J)),
2445
+ k(5, L(Oe))
2446
+ ], ge);
2447
+ const Ys = (o) => {
2448
+ if (typeof (o == null ? void 0 : o.location) != "string" && !((o == null ? void 0 : o.location) instanceof URL))
2390
2449
  throw new Error(
2391
2450
  "Invalid register props detected. location path is required"
2392
2451
  );
2393
2452
  const e = Ie.createChildContainer();
2394
- c.initOnConstruct = z(c.initOnConstruct) || !X(c.initOnConstruct) ? !0 : c.initOnConstruct, c.defaultCamera = c != null && c.defaultCamera && c.defaultCamera in _e ? c.defaultCamera : _e.PERSPECTIVE, c.withMiniCamera = z(c.withMiniCamera) || !X(c.withMiniCamera) ? !1 : c.withMiniCamera, c.startTimer = z(c.startTimer) || !X(c.startTimer) ? !0 : c.startTimer, c.fullScreen = z(c.fullScreen) || !X(c.fullScreen) ? !0 : c.fullScreen, c.onReady = ot(c.onReady) ? c.onReady : void 0, e.register(Oe, { useValue: e }), e.register(Te, { useValue: c });
2395
- const t = e.resolve(Ae);
2453
+ o.initOnConstruct = z(o.initOnConstruct) || !X(o.initOnConstruct) ? !0 : o.initOnConstruct, o.defaultCamera = o != null && o.defaultCamera && o.defaultCamera in _e ? o.defaultCamera : _e.PERSPECTIVE, o.withMiniCamera = z(o.withMiniCamera) || !X(o.withMiniCamera) ? !1 : o.withMiniCamera, o.startTimer = z(o.startTimer) || !X(o.startTimer) ? !0 : o.startTimer, o.fullScreen = z(o.fullScreen) || !X(o.fullScreen) ? !0 : o.fullScreen, o.onReady = it(o.onReady) ? o.onReady : void 0, e.register(Oe, { useValue: e }), e.register(Ae, { useValue: o });
2454
+ const t = e.resolve(ge);
2396
2455
  return t.initialized = !0, {
2397
2456
  container: e,
2398
2457
  module: t
2399
2458
  };
2400
2459
  };
2401
2460
  export {
2402
- sn as AppModule,
2403
- nn as AppProxyEventHandlersBlueprint,
2461
+ Zs as AppModule,
2462
+ en as AppProxyEventHandlersBlueprint,
2404
2463
  Oe as CONTAINER_TOKEN,
2405
2464
  _e as DefaultCameraType,
2406
- Je as KEYBOARD_EVENT_CODES,
2407
- it as LOADER_SERIALIZED_LOAD_TOKEN,
2408
- Js as LaunchAppProps,
2465
+ Qe as KEYBOARD_EVENT_CODES,
2466
+ rt as LOADER_SERIALIZED_LOAD_TOKEN,
2467
+ qs as LaunchAppProps,
2409
2468
  Ce as PROXY_EVENT_LISTENERS,
2410
- Ye as ProxyEventHandlersBlueprint,
2411
- rn as ProxyEventObservablesBlueprint,
2412
- on as ProxyEventSubjectsBlueprint,
2413
- Ae as RegisterModule,
2414
- Te as RegisterPropsBlueprint,
2415
- nt as RegisterProxyEventHandlersBlueprint,
2416
- Zs as register
2469
+ qe as ProxyEventHandlersBlueprint,
2470
+ tn as ProxyEventObservablesBlueprint,
2471
+ sn as ProxyEventSubjectsBlueprint,
2472
+ ge as RegisterModule,
2473
+ Ae as RegisterPropsBlueprint,
2474
+ st as RegisterProxyEventHandlersBlueprint,
2475
+ Ys as register
2417
2476
  };