@souldi/try-on 0.1.51 → 0.1.52

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.
@@ -0,0 +1,1381 @@
1
+ import { AnimationClip as e, Bone as t, Box3 as n, BufferAttribute as r, BufferGeometry as i, ClampToEdgeWrapping as a, Color as o, ColorManagement as s, DirectionalLight as c, FileLoader as l, Group as u, ImageBitmapLoader as d, InstancedBufferAttribute as f, InstancedMesh as p, InterleavedBuffer as m, InterleavedBufferAttribute as h, Interpolant as g, InterpolateDiscrete as _, InterpolateLinear as v, Line as ee, LineBasicMaterial as te, LineLoop as ne, LineSegments as re, LinearFilter as ie, LinearMipmapLinearFilter as ae, LinearMipmapNearestFilter as oe, LinearSRGBColorSpace as y, Loader as se, LoaderUtils as b, Material as x, MathUtils as ce, Matrix4 as S, Mesh as le, MeshBasicMaterial as C, MeshPhysicalMaterial as w, MeshStandardMaterial as ue, MirroredRepeatWrapping as de, NearestFilter as fe, NearestMipmapLinearFilter as pe, NearestMipmapNearestFilter as me, NumberKeyframeTrack as T, Object3D as E, OrthographicCamera as he, PerspectiveCamera as ge, PointLight as _e, Points as ve, PointsMaterial as ye, PropertyBinding as be, Quaternion as D, QuaternionKeyframeTrack as O, RepeatWrapping as xe, SRGBColorSpace as k, Skeleton as Se, SkinnedMesh as Ce, Sphere as we, SpotLight as Te, Texture as A, TextureLoader as Ee, Vector2 as j, Vector3 as M, VectorKeyframeTrack as N } from "./three.module-BqUhHzuP.mjs";
2
+ //#region node_modules/three/examples/jsm/utils/BufferGeometryUtils.js
3
+ function P(e, t) {
4
+ if (t === 0) return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), e;
5
+ if (t === 2 || t === 1) {
6
+ let n = e.getIndex();
7
+ if (n === null) {
8
+ let t = [], r = e.getAttribute("position");
9
+ if (r !== void 0) {
10
+ for (let e = 0; e < r.count; e++) t.push(e);
11
+ e.setIndex(t), n = e.getIndex();
12
+ } else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), e;
13
+ }
14
+ let r = n.count - 2, i = [];
15
+ if (t === 2) for (let e = 1; e <= r; e++) i.push(n.getX(0)), i.push(n.getX(e)), i.push(n.getX(e + 1));
16
+ else for (let e = 0; e < r; e++) e % 2 == 0 ? (i.push(n.getX(e)), i.push(n.getX(e + 1)), i.push(n.getX(e + 2))) : (i.push(n.getX(e + 2)), i.push(n.getX(e + 1)), i.push(n.getX(e)));
17
+ i.length / 3 !== r && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
18
+ let a = e.clone();
19
+ return a.setIndex(i), a.clearGroups(), a;
20
+ } else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", t), e;
21
+ }
22
+ //#endregion
23
+ //#region node_modules/three/examples/jsm/utils/SkeletonUtils.js
24
+ function De(e) {
25
+ let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = e.clone();
26
+ return F(e, r, function(e, r) {
27
+ t.set(r, e), n.set(e, r);
28
+ }), r.traverse(function(e) {
29
+ if (!e.isSkinnedMesh) return;
30
+ let r = e, i = t.get(e), a = i.skeleton.bones;
31
+ r.skeleton = i.skeleton.clone(), r.bindMatrix.copy(i.bindMatrix), r.skeleton.bones = a.map(function(e) {
32
+ return n.get(e);
33
+ }), r.bind(r.skeleton, r.bindMatrix);
34
+ }), r;
35
+ }
36
+ function F(e, t, n) {
37
+ n(e, t);
38
+ for (let r = 0; r < e.children.length; r++) F(e.children[r], t.children[r], n);
39
+ }
40
+ //#endregion
41
+ //#region node_modules/three/examples/jsm/loaders/GLTFLoader.js
42
+ var Oe = class extends se {
43
+ constructor(e) {
44
+ super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(e) {
45
+ return new Ne(e);
46
+ }), this.register(function(e) {
47
+ return new Pe(e);
48
+ }), this.register(function(e) {
49
+ return new Ue(e);
50
+ }), this.register(function(e) {
51
+ return new We(e);
52
+ }), this.register(function(e) {
53
+ return new Ge(e);
54
+ }), this.register(function(e) {
55
+ return new Ie(e);
56
+ }), this.register(function(e) {
57
+ return new Le(e);
58
+ }), this.register(function(e) {
59
+ return new Re(e);
60
+ }), this.register(function(e) {
61
+ return new ze(e);
62
+ }), this.register(function(e) {
63
+ return new Me(e);
64
+ }), this.register(function(e) {
65
+ return new Be(e);
66
+ }), this.register(function(e) {
67
+ return new Fe(e);
68
+ }), this.register(function(e) {
69
+ return new He(e);
70
+ }), this.register(function(e) {
71
+ return new Ve(e);
72
+ }), this.register(function(e) {
73
+ return new Ae(e);
74
+ }), this.register(function(e) {
75
+ return new R(e, L.EXT_MESHOPT_COMPRESSION);
76
+ }), this.register(function(e) {
77
+ return new R(e, L.KHR_MESHOPT_COMPRESSION);
78
+ }), this.register(function(e) {
79
+ return new Ke(e);
80
+ });
81
+ }
82
+ load(e, t, n, r) {
83
+ let i = this, a;
84
+ if (this.resourcePath !== "") a = this.resourcePath;
85
+ else if (this.path !== "") {
86
+ let t = b.extractUrlBase(e);
87
+ a = b.resolveURL(t, this.path);
88
+ } else a = b.extractUrlBase(e);
89
+ this.manager.itemStart(e);
90
+ let o = function(t) {
91
+ r ? r(t) : console.error(t), i.manager.itemError(e), i.manager.itemEnd(e);
92
+ }, s = new l(this.manager);
93
+ s.setPath(this.path), s.setResponseType("arraybuffer"), s.setRequestHeader(this.requestHeader), s.setWithCredentials(this.withCredentials), s.load(e, function(n) {
94
+ try {
95
+ i.parse(n, a, function(n) {
96
+ t(n), i.manager.itemEnd(e);
97
+ }, o);
98
+ } catch (e) {
99
+ o(e);
100
+ }
101
+ }, n, o);
102
+ }
103
+ setDRACOLoader(e) {
104
+ return this.dracoLoader = e, this;
105
+ }
106
+ setKTX2Loader(e) {
107
+ return this.ktx2Loader = e, this;
108
+ }
109
+ setMeshoptDecoder(e) {
110
+ return this.meshoptDecoder = e, this;
111
+ }
112
+ register(e) {
113
+ return this.pluginCallbacks.indexOf(e) === -1 && this.pluginCallbacks.push(e), this;
114
+ }
115
+ unregister(e) {
116
+ return this.pluginCallbacks.indexOf(e) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e), 1), this;
117
+ }
118
+ parse(e, t, n, r) {
119
+ let i, a = {}, o = {}, s = new TextDecoder();
120
+ if (typeof e == "string") i = JSON.parse(e);
121
+ else if (e instanceof ArrayBuffer) if (s.decode(new Uint8Array(e, 0, 4)) === z) {
122
+ try {
123
+ a[L.KHR_BINARY_GLTF] = new qe(e);
124
+ } catch (e) {
125
+ r && r(e);
126
+ return;
127
+ }
128
+ i = JSON.parse(a[L.KHR_BINARY_GLTF].content);
129
+ } else i = JSON.parse(s.decode(e));
130
+ else i = e;
131
+ if (i.asset === void 0 || i.asset.version[0] < 2) {
132
+ r && r(/* @__PURE__ */ Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
133
+ return;
134
+ }
135
+ let c = new st(i, {
136
+ path: t || this.resourcePath || "",
137
+ crossOrigin: this.crossOrigin,
138
+ requestHeader: this.requestHeader,
139
+ manager: this.manager,
140
+ ktx2Loader: this.ktx2Loader,
141
+ meshoptDecoder: this.meshoptDecoder
142
+ });
143
+ c.fileLoader.setRequestHeader(this.requestHeader);
144
+ for (let e = 0; e < this.pluginCallbacks.length; e++) {
145
+ let t = this.pluginCallbacks[e](c);
146
+ t.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), o[t.name] = t, a[t.name] = !0;
147
+ }
148
+ if (i.extensionsUsed) for (let e = 0; e < i.extensionsUsed.length; ++e) {
149
+ let t = i.extensionsUsed[e], n = i.extensionsRequired || [];
150
+ switch (t) {
151
+ case L.KHR_MATERIALS_UNLIT:
152
+ a[t] = new je();
153
+ break;
154
+ case L.KHR_DRACO_MESH_COMPRESSION:
155
+ a[t] = new Je(i, this.dracoLoader);
156
+ break;
157
+ case L.KHR_TEXTURE_TRANSFORM:
158
+ a[t] = new Ye();
159
+ break;
160
+ case L.KHR_MESH_QUANTIZATION:
161
+ a[t] = new Xe();
162
+ break;
163
+ default: n.indexOf(t) >= 0 && o[t] === void 0 && console.warn("THREE.GLTFLoader: Unknown extension \"" + t + "\".");
164
+ }
165
+ }
166
+ c.setExtensions(a), c.setPlugins(o), c.parse(n, r);
167
+ }
168
+ parseAsync(e, t) {
169
+ let n = this;
170
+ return new Promise(function(r, i) {
171
+ n.parse(e, t, r, i);
172
+ });
173
+ }
174
+ };
175
+ function ke() {
176
+ let e = {};
177
+ return {
178
+ get: function(t) {
179
+ return e[t];
180
+ },
181
+ add: function(t, n) {
182
+ e[t] = n;
183
+ },
184
+ remove: function(t) {
185
+ delete e[t];
186
+ },
187
+ removeAll: function() {
188
+ e = {};
189
+ }
190
+ };
191
+ }
192
+ function I(e, t, n) {
193
+ let r = e.json.materials[t];
194
+ return r.extensions && r.extensions[n] ? r.extensions[n] : null;
195
+ }
196
+ var L = {
197
+ KHR_BINARY_GLTF: "KHR_binary_glTF",
198
+ KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
199
+ KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
200
+ KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat",
201
+ KHR_MATERIALS_DISPERSION: "KHR_materials_dispersion",
202
+ KHR_MATERIALS_IOR: "KHR_materials_ior",
203
+ KHR_MATERIALS_SHEEN: "KHR_materials_sheen",
204
+ KHR_MATERIALS_SPECULAR: "KHR_materials_specular",
205
+ KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
206
+ KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence",
207
+ KHR_MATERIALS_ANISOTROPY: "KHR_materials_anisotropy",
208
+ KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
209
+ KHR_MATERIALS_VOLUME: "KHR_materials_volume",
210
+ KHR_TEXTURE_BASISU: "KHR_texture_basisu",
211
+ KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
212
+ KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
213
+ KHR_MATERIALS_EMISSIVE_STRENGTH: "KHR_materials_emissive_strength",
214
+ EXT_MATERIALS_BUMP: "EXT_materials_bump",
215
+ EXT_TEXTURE_WEBP: "EXT_texture_webp",
216
+ EXT_TEXTURE_AVIF: "EXT_texture_avif",
217
+ EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
218
+ KHR_MESHOPT_COMPRESSION: "KHR_meshopt_compression",
219
+ EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
220
+ }, Ae = class {
221
+ constructor(e) {
222
+ this.parser = e, this.name = L.KHR_LIGHTS_PUNCTUAL, this.cache = {
223
+ refs: {},
224
+ uses: {}
225
+ };
226
+ }
227
+ _markDefs() {
228
+ let e = this.parser, t = this.parser.json.nodes || [];
229
+ for (let n = 0, r = t.length; n < r; n++) {
230
+ let r = t[n];
231
+ r.extensions && r.extensions[this.name] && r.extensions[this.name].light !== void 0 && e._addNodeRef(this.cache, r.extensions[this.name].light);
232
+ }
233
+ }
234
+ _loadLight(e) {
235
+ let t = this.parser, n = "light:" + e, r = t.cache.get(n);
236
+ if (r) return r;
237
+ let i = t.json, a = ((i.extensions && i.extensions[this.name] || {}).lights || [])[e], s, l = new o(16777215);
238
+ a.color !== void 0 && l.setRGB(a.color[0], a.color[1], a.color[2], y);
239
+ let u = a.range === void 0 ? 0 : a.range;
240
+ switch (a.type) {
241
+ case "directional":
242
+ s = new c(l), s.target.position.set(0, 0, -1), s.add(s.target);
243
+ break;
244
+ case "point":
245
+ s = new _e(l), s.distance = u;
246
+ break;
247
+ case "spot":
248
+ s = new Te(l), s.distance = u, a.spot = a.spot || {}, a.spot.innerConeAngle = a.spot.innerConeAngle === void 0 ? 0 : a.spot.innerConeAngle, a.spot.outerConeAngle = a.spot.outerConeAngle === void 0 ? Math.PI / 4 : a.spot.outerConeAngle, s.angle = a.spot.outerConeAngle, s.penumbra = 1 - a.spot.innerConeAngle / a.spot.outerConeAngle, s.target.position.set(0, 0, -1), s.add(s.target);
249
+ break;
250
+ default: throw Error("THREE.GLTFLoader: Unexpected light type: " + a.type);
251
+ }
252
+ return s.position.set(0, 0, 0), Z(s, a), a.intensity !== void 0 && (s.intensity = a.intensity), s.name = t.createUniqueName(a.name || "light_" + e), r = Promise.resolve(s), t.cache.add(n, r), r;
253
+ }
254
+ getDependency(e, t) {
255
+ if (e === "light") return this._loadLight(t);
256
+ }
257
+ createNodeAttachment(e) {
258
+ let t = this, n = this.parser, r = n.json.nodes[e], i = (r.extensions && r.extensions[this.name] || {}).light;
259
+ return i === void 0 ? null : this._loadLight(i).then(function(e) {
260
+ return n._getNodeRef(t.cache, i, e);
261
+ });
262
+ }
263
+ }, je = class {
264
+ constructor() {
265
+ this.name = L.KHR_MATERIALS_UNLIT;
266
+ }
267
+ getMaterialType() {
268
+ return C;
269
+ }
270
+ extendParams(e, t, n) {
271
+ let r = [];
272
+ e.color = new o(1, 1, 1), e.opacity = 1;
273
+ let i = t.pbrMetallicRoughness;
274
+ if (i) {
275
+ if (Array.isArray(i.baseColorFactor)) {
276
+ let t = i.baseColorFactor;
277
+ e.color.setRGB(t[0], t[1], t[2], y), e.opacity = t[3];
278
+ }
279
+ i.baseColorTexture !== void 0 && r.push(n.assignTexture(e, "map", i.baseColorTexture, k));
280
+ }
281
+ return Promise.all(r);
282
+ }
283
+ }, Me = class {
284
+ constructor(e) {
285
+ this.parser = e, this.name = L.KHR_MATERIALS_EMISSIVE_STRENGTH;
286
+ }
287
+ extendMaterialParams(e, t) {
288
+ let n = I(this.parser, e, this.name);
289
+ return n === null || n.emissiveStrength !== void 0 && (t.emissiveIntensity = n.emissiveStrength), Promise.resolve();
290
+ }
291
+ }, Ne = class {
292
+ constructor(e) {
293
+ this.parser = e, this.name = L.KHR_MATERIALS_CLEARCOAT;
294
+ }
295
+ getMaterialType(e) {
296
+ return I(this.parser, e, this.name) === null ? null : w;
297
+ }
298
+ extendMaterialParams(e, t) {
299
+ let n = I(this.parser, e, this.name);
300
+ if (n === null) return Promise.resolve();
301
+ let r = [];
302
+ if (n.clearcoatFactor !== void 0 && (t.clearcoat = n.clearcoatFactor), n.clearcoatTexture !== void 0 && r.push(this.parser.assignTexture(t, "clearcoatMap", n.clearcoatTexture)), n.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = n.clearcoatRoughnessFactor), n.clearcoatRoughnessTexture !== void 0 && r.push(this.parser.assignTexture(t, "clearcoatRoughnessMap", n.clearcoatRoughnessTexture)), n.clearcoatNormalTexture !== void 0 && (r.push(this.parser.assignTexture(t, "clearcoatNormalMap", n.clearcoatNormalTexture)), n.clearcoatNormalTexture.scale !== void 0)) {
303
+ let e = n.clearcoatNormalTexture.scale;
304
+ t.clearcoatNormalScale = new j(e, e);
305
+ }
306
+ return Promise.all(r);
307
+ }
308
+ }, Pe = class {
309
+ constructor(e) {
310
+ this.parser = e, this.name = L.KHR_MATERIALS_DISPERSION;
311
+ }
312
+ getMaterialType(e) {
313
+ return I(this.parser, e, this.name) === null ? null : w;
314
+ }
315
+ extendMaterialParams(e, t) {
316
+ let n = I(this.parser, e, this.name);
317
+ return n === null || (t.dispersion = n.dispersion === void 0 ? 0 : n.dispersion), Promise.resolve();
318
+ }
319
+ }, Fe = class {
320
+ constructor(e) {
321
+ this.parser = e, this.name = L.KHR_MATERIALS_IRIDESCENCE;
322
+ }
323
+ getMaterialType(e) {
324
+ return I(this.parser, e, this.name) === null ? null : w;
325
+ }
326
+ extendMaterialParams(e, t) {
327
+ let n = I(this.parser, e, this.name);
328
+ if (n === null) return Promise.resolve();
329
+ let r = [];
330
+ return n.iridescenceFactor !== void 0 && (t.iridescence = n.iridescenceFactor), n.iridescenceTexture !== void 0 && r.push(this.parser.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(this.parser.assignTexture(t, "iridescenceThicknessMap", n.iridescenceThicknessTexture)), Promise.all(r);
331
+ }
332
+ }, Ie = class {
333
+ constructor(e) {
334
+ this.parser = e, this.name = L.KHR_MATERIALS_SHEEN;
335
+ }
336
+ getMaterialType(e) {
337
+ return I(this.parser, e, this.name) === null ? null : w;
338
+ }
339
+ extendMaterialParams(e, t) {
340
+ let n = I(this.parser, e, this.name);
341
+ if (n === null) return Promise.resolve();
342
+ let r = [];
343
+ if (t.sheenColor = new o(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1, n.sheenColorFactor !== void 0) {
344
+ let e = n.sheenColorFactor;
345
+ t.sheenColor.setRGB(e[0], e[1], e[2], y);
346
+ }
347
+ return n.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = n.sheenRoughnessFactor), n.sheenColorTexture !== void 0 && r.push(this.parser.assignTexture(t, "sheenColorMap", n.sheenColorTexture, k)), n.sheenRoughnessTexture !== void 0 && r.push(this.parser.assignTexture(t, "sheenRoughnessMap", n.sheenRoughnessTexture)), Promise.all(r);
348
+ }
349
+ }, Le = class {
350
+ constructor(e) {
351
+ this.parser = e, this.name = L.KHR_MATERIALS_TRANSMISSION;
352
+ }
353
+ getMaterialType(e) {
354
+ return I(this.parser, e, this.name) === null ? null : w;
355
+ }
356
+ extendMaterialParams(e, t) {
357
+ let n = I(this.parser, e, this.name);
358
+ if (n === null) return Promise.resolve();
359
+ let r = [];
360
+ return n.transmissionFactor !== void 0 && (t.transmission = n.transmissionFactor), n.transmissionTexture !== void 0 && r.push(this.parser.assignTexture(t, "transmissionMap", n.transmissionTexture)), Promise.all(r);
361
+ }
362
+ }, Re = class {
363
+ constructor(e) {
364
+ this.parser = e, this.name = L.KHR_MATERIALS_VOLUME;
365
+ }
366
+ getMaterialType(e) {
367
+ return I(this.parser, e, this.name) === null ? null : w;
368
+ }
369
+ extendMaterialParams(e, t) {
370
+ let n = I(this.parser, e, this.name);
371
+ if (n === null) return Promise.resolve();
372
+ let r = [];
373
+ t.thickness = n.thicknessFactor === void 0 ? 0 : n.thicknessFactor, n.thicknessTexture !== void 0 && r.push(this.parser.assignTexture(t, "thicknessMap", n.thicknessTexture)), t.attenuationDistance = n.attenuationDistance || Infinity;
374
+ let i = n.attenuationColor || [
375
+ 1,
376
+ 1,
377
+ 1
378
+ ];
379
+ return t.attenuationColor = new o().setRGB(i[0], i[1], i[2], y), Promise.all(r);
380
+ }
381
+ }, ze = class {
382
+ constructor(e) {
383
+ this.parser = e, this.name = L.KHR_MATERIALS_IOR;
384
+ }
385
+ getMaterialType(e) {
386
+ return I(this.parser, e, this.name) === null ? null : w;
387
+ }
388
+ extendMaterialParams(e, t) {
389
+ let n = I(this.parser, e, this.name);
390
+ return n === null ? Promise.resolve() : (t.ior = n.ior === void 0 ? 1.5 : n.ior, t.ior === 0 && (t.ior = 1e3), Promise.resolve());
391
+ }
392
+ }, Be = class {
393
+ constructor(e) {
394
+ this.parser = e, this.name = L.KHR_MATERIALS_SPECULAR;
395
+ }
396
+ getMaterialType(e) {
397
+ return I(this.parser, e, this.name) === null ? null : w;
398
+ }
399
+ extendMaterialParams(e, t) {
400
+ let n = I(this.parser, e, this.name);
401
+ if (n === null) return Promise.resolve();
402
+ let r = [];
403
+ t.specularIntensity = n.specularFactor === void 0 ? 1 : n.specularFactor, n.specularTexture !== void 0 && r.push(this.parser.assignTexture(t, "specularIntensityMap", n.specularTexture));
404
+ let i = n.specularColorFactor || [
405
+ 1,
406
+ 1,
407
+ 1
408
+ ];
409
+ return t.specularColor = new o().setRGB(i[0], i[1], i[2], y), n.specularColorTexture !== void 0 && r.push(this.parser.assignTexture(t, "specularColorMap", n.specularColorTexture, k)), Promise.all(r);
410
+ }
411
+ }, Ve = class {
412
+ constructor(e) {
413
+ this.parser = e, this.name = L.EXT_MATERIALS_BUMP;
414
+ }
415
+ getMaterialType(e) {
416
+ return I(this.parser, e, this.name) === null ? null : w;
417
+ }
418
+ extendMaterialParams(e, t) {
419
+ let n = I(this.parser, e, this.name);
420
+ if (n === null) return Promise.resolve();
421
+ let r = [];
422
+ return t.bumpScale = n.bumpFactor === void 0 ? 1 : n.bumpFactor, n.bumpTexture !== void 0 && r.push(this.parser.assignTexture(t, "bumpMap", n.bumpTexture)), Promise.all(r);
423
+ }
424
+ }, He = class {
425
+ constructor(e) {
426
+ this.parser = e, this.name = L.KHR_MATERIALS_ANISOTROPY;
427
+ }
428
+ getMaterialType(e) {
429
+ return I(this.parser, e, this.name) === null ? null : w;
430
+ }
431
+ extendMaterialParams(e, t) {
432
+ let n = I(this.parser, e, this.name);
433
+ if (n === null) return Promise.resolve();
434
+ let r = [];
435
+ return n.anisotropyStrength !== void 0 && (t.anisotropy = n.anisotropyStrength), n.anisotropyRotation !== void 0 && (t.anisotropyRotation = n.anisotropyRotation), n.anisotropyTexture !== void 0 && r.push(this.parser.assignTexture(t, "anisotropyMap", n.anisotropyTexture)), Promise.all(r);
436
+ }
437
+ }, Ue = class {
438
+ constructor(e) {
439
+ this.parser = e, this.name = L.KHR_TEXTURE_BASISU;
440
+ }
441
+ loadTexture(e) {
442
+ let t = this.parser, n = t.json, r = n.textures[e];
443
+ if (!r.extensions || !r.extensions[this.name]) return null;
444
+ let i = r.extensions[this.name], a = t.options.ktx2Loader;
445
+ if (!a) {
446
+ if (n.extensionsRequired && n.extensionsRequired.indexOf(this.name) >= 0) throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
447
+ return null;
448
+ }
449
+ return t.loadTextureImage(e, i.source, a);
450
+ }
451
+ }, We = class {
452
+ constructor(e) {
453
+ this.parser = e, this.name = L.EXT_TEXTURE_WEBP;
454
+ }
455
+ loadTexture(e) {
456
+ let t = this.name, n = this.parser, r = n.json, i = r.textures[e];
457
+ if (!i.extensions || !i.extensions[t]) return null;
458
+ let a = i.extensions[t], o = r.images[a.source], s = n.textureLoader;
459
+ if (o.uri) {
460
+ let e = n.options.manager.getHandler(o.uri);
461
+ e !== null && (s = e);
462
+ }
463
+ return n.loadTextureImage(e, a.source, s);
464
+ }
465
+ }, Ge = class {
466
+ constructor(e) {
467
+ this.parser = e, this.name = L.EXT_TEXTURE_AVIF;
468
+ }
469
+ loadTexture(e) {
470
+ let t = this.name, n = this.parser, r = n.json, i = r.textures[e];
471
+ if (!i.extensions || !i.extensions[t]) return null;
472
+ let a = i.extensions[t], o = r.images[a.source], s = n.textureLoader;
473
+ if (o.uri) {
474
+ let e = n.options.manager.getHandler(o.uri);
475
+ e !== null && (s = e);
476
+ }
477
+ return n.loadTextureImage(e, a.source, s);
478
+ }
479
+ }, R = class {
480
+ constructor(e, t) {
481
+ this.name = t, this.parser = e;
482
+ }
483
+ loadBufferView(e) {
484
+ let t = this.parser.json, n = t.bufferViews[e];
485
+ if (n.extensions && n.extensions[this.name]) {
486
+ let e = n.extensions[this.name], r = this.parser.getDependency("buffer", e.buffer), i = this.parser.options.meshoptDecoder;
487
+ if (!i || !i.supported) {
488
+ if (t.extensionsRequired && t.extensionsRequired.indexOf(this.name) >= 0) throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
489
+ return null;
490
+ }
491
+ return r.then(function(t) {
492
+ let n = e.byteOffset || 0, r = e.byteLength || 0, a = e.count, o = e.byteStride, s = new Uint8Array(t, n, r);
493
+ return i.decodeGltfBufferAsync ? i.decodeGltfBufferAsync(a, o, s, e.mode, e.filter).then(function(e) {
494
+ return e.buffer;
495
+ }) : i.ready.then(function() {
496
+ let t = new ArrayBuffer(a * o);
497
+ return i.decodeGltfBuffer(new Uint8Array(t), a, o, s, e.mode, e.filter), t;
498
+ });
499
+ });
500
+ } else return null;
501
+ }
502
+ }, Ke = class {
503
+ constructor(e) {
504
+ this.name = L.EXT_MESH_GPU_INSTANCING, this.parser = e;
505
+ }
506
+ createNodeMesh(e) {
507
+ let t = this.parser.json, n = t.nodes[e];
508
+ if (!n.extensions || !n.extensions[this.name] || n.mesh === void 0) return null;
509
+ let r = t.meshes[n.mesh];
510
+ for (let e of r.primitives) if (e.mode !== U.TRIANGLES && e.mode !== U.TRIANGLE_STRIP && e.mode !== U.TRIANGLE_FAN && e.mode !== void 0) return null;
511
+ let i = n.extensions[this.name].attributes, a = [], o = {};
512
+ for (let e in i) a.push(this.parser.getDependency("accessor", i[e]).then((t) => (o[e] = t, o[e])));
513
+ return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((e) => {
514
+ let t = e.pop(), n = t.isGroup ? t.children : [t], r = e[0].count, i = [];
515
+ for (let e of n) {
516
+ let t = new S(), n = new M(), a = new D(), s = new M(1, 1, 1), c = new p(e.geometry, e.material, r);
517
+ for (let e = 0; e < r; e++) o.TRANSLATION && n.fromBufferAttribute(o.TRANSLATION, e), o.ROTATION && a.fromBufferAttribute(o.ROTATION, e), o.SCALE && s.fromBufferAttribute(o.SCALE, e), c.setMatrixAt(e, t.compose(n, a, s));
518
+ for (let t in o) if (t === "_COLOR_0") {
519
+ let e = o[t];
520
+ c.instanceColor = new f(e.array, e.itemSize, e.normalized);
521
+ } else t !== "TRANSLATION" && t !== "ROTATION" && t !== "SCALE" && e.geometry.setAttribute(t, o[t]);
522
+ E.prototype.copy.call(c, e), this.parser.assignFinalMaterial(c), i.push(c);
523
+ }
524
+ return t.isGroup ? (t.clear(), t.add(...i), t) : i[0];
525
+ }));
526
+ }
527
+ }, z = "glTF", B = 12, V = {
528
+ JSON: 1313821514,
529
+ BIN: 5130562
530
+ }, qe = class {
531
+ constructor(e) {
532
+ this.name = L.KHR_BINARY_GLTF, this.content = null, this.body = null;
533
+ let t = new DataView(e, 0, B), n = new TextDecoder();
534
+ if (this.header = {
535
+ magic: n.decode(new Uint8Array(e.slice(0, 4))),
536
+ version: t.getUint32(4, !0),
537
+ length: t.getUint32(8, !0)
538
+ }, this.header.magic !== z) throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
539
+ if (this.header.version < 2) throw Error("THREE.GLTFLoader: Legacy binary file detected.");
540
+ let r = this.header.length - B, i = new DataView(e, B), a = 0;
541
+ for (; a < r;) {
542
+ let t = i.getUint32(a, !0);
543
+ a += 4;
544
+ let r = i.getUint32(a, !0);
545
+ if (a += 4, r === V.JSON) {
546
+ let r = new Uint8Array(e, B + a, t);
547
+ this.content = n.decode(r);
548
+ } else if (r === V.BIN) {
549
+ let n = B + a;
550
+ this.body = e.slice(n, n + t);
551
+ }
552
+ a += t;
553
+ }
554
+ if (this.content === null) throw Error("THREE.GLTFLoader: JSON content not found.");
555
+ }
556
+ }, Je = class {
557
+ constructor(e, t) {
558
+ if (!t) throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
559
+ this.name = L.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
560
+ }
561
+ decodePrimitive(e, t) {
562
+ let n = this.json, r = this.dracoLoader, i = e.extensions[this.name].bufferView, a = e.extensions[this.name].attributes, o = {}, s = {}, c = {};
563
+ for (let e in a) {
564
+ let t = q[e] || e.toLowerCase();
565
+ o[t] = a[e];
566
+ }
567
+ for (let t in e.attributes) {
568
+ let r = q[t] || t.toLowerCase();
569
+ if (a[t] !== void 0) {
570
+ let i = n.accessors[e.attributes[t]];
571
+ c[r] = W[i.componentType].name, s[r] = i.normalized === !0;
572
+ }
573
+ }
574
+ return t.getDependency("bufferView", i).then(function(e) {
575
+ return new Promise(function(t, n) {
576
+ r.decodeDracoFile(e, function(e) {
577
+ for (let t in e.attributes) {
578
+ let n = e.attributes[t], r = s[t];
579
+ r !== void 0 && (n.normalized = r);
580
+ }
581
+ t(e);
582
+ }, o, c, y, n);
583
+ });
584
+ });
585
+ }
586
+ }, Ye = class {
587
+ constructor() {
588
+ this.name = L.KHR_TEXTURE_TRANSFORM;
589
+ }
590
+ extendTexture(e, t) {
591
+ return (t.texCoord === void 0 || t.texCoord === e.channel) && t.offset === void 0 && t.rotation === void 0 && t.scale === void 0 ? e : (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);
592
+ }
593
+ }, Xe = class {
594
+ constructor() {
595
+ this.name = L.KHR_MESH_QUANTIZATION;
596
+ }
597
+ }, H = class extends g {
598
+ constructor(e, t, n, r) {
599
+ super(e, t, n, r);
600
+ }
601
+ copySampleValue_(e) {
602
+ let t = this.resultBuffer, n = this.sampleValues, r = this.valueSize, i = e * r * 3 + r;
603
+ for (let e = 0; e !== r; e++) t[e] = n[i + e];
604
+ return t;
605
+ }
606
+ interpolate_(e, t, n, r) {
607
+ let i = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = o * 2, c = o * 3, l = r - t, u = (n - t) / l, d = u * u, f = d * u, p = e * c, m = p - c, h = -2 * f + 3 * d, g = f - d, _ = 1 - h, v = g - d + u;
608
+ for (let e = 0; e !== o; e++) {
609
+ let t = a[m + e + o], n = a[m + e + s] * l, r = a[p + e + o], c = a[p + e] * l;
610
+ i[e] = _ * t + v * n + h * r + g * c;
611
+ }
612
+ return i;
613
+ }
614
+ }, Ze = new D(), Qe = class extends H {
615
+ interpolate_(e, t, n, r) {
616
+ let i = super.interpolate_(e, t, n, r);
617
+ return Ze.fromArray(i).normalize().toArray(i), i;
618
+ }
619
+ }, U = {
620
+ FLOAT: 5126,
621
+ FLOAT_MAT3: 35675,
622
+ FLOAT_MAT4: 35676,
623
+ FLOAT_VEC2: 35664,
624
+ FLOAT_VEC3: 35665,
625
+ FLOAT_VEC4: 35666,
626
+ LINEAR: 9729,
627
+ REPEAT: 10497,
628
+ SAMPLER_2D: 35678,
629
+ POINTS: 0,
630
+ LINES: 1,
631
+ LINE_LOOP: 2,
632
+ LINE_STRIP: 3,
633
+ TRIANGLES: 4,
634
+ TRIANGLE_STRIP: 5,
635
+ TRIANGLE_FAN: 6,
636
+ UNSIGNED_BYTE: 5121,
637
+ UNSIGNED_SHORT: 5123
638
+ }, W = {
639
+ 5120: Int8Array,
640
+ 5121: Uint8Array,
641
+ 5122: Int16Array,
642
+ 5123: Uint16Array,
643
+ 5125: Uint32Array,
644
+ 5126: Float32Array
645
+ }, G = {
646
+ 9728: fe,
647
+ 9729: ie,
648
+ 9984: me,
649
+ 9985: oe,
650
+ 9986: pe,
651
+ 9987: ae
652
+ }, $e = {
653
+ 33071: a,
654
+ 33648: de,
655
+ 10497: xe
656
+ }, K = {
657
+ SCALAR: 1,
658
+ VEC2: 2,
659
+ VEC3: 3,
660
+ VEC4: 4,
661
+ MAT2: 4,
662
+ MAT3: 9,
663
+ MAT4: 16
664
+ }, q = {
665
+ POSITION: "position",
666
+ NORMAL: "normal",
667
+ TANGENT: "tangent",
668
+ TEXCOORD_0: "uv",
669
+ TEXCOORD_1: "uv1",
670
+ TEXCOORD_2: "uv2",
671
+ TEXCOORD_3: "uv3",
672
+ COLOR_0: "color",
673
+ WEIGHTS_0: "skinWeight",
674
+ JOINTS_0: "skinIndex"
675
+ }, J = {
676
+ scale: "scale",
677
+ translation: "position",
678
+ rotation: "quaternion",
679
+ weights: "morphTargetInfluences"
680
+ }, et = {
681
+ CUBICSPLINE: void 0,
682
+ LINEAR: v,
683
+ STEP: _
684
+ }, Y = {
685
+ OPAQUE: "OPAQUE",
686
+ MASK: "MASK",
687
+ BLEND: "BLEND"
688
+ };
689
+ function tt(e) {
690
+ return e.DefaultMaterial === void 0 && (e.DefaultMaterial = new ue({
691
+ color: 16777215,
692
+ emissive: 0,
693
+ metalness: 1,
694
+ roughness: 1,
695
+ transparent: !1,
696
+ depthTest: !0,
697
+ side: 0
698
+ })), e.DefaultMaterial;
699
+ }
700
+ function X(e, t, n) {
701
+ for (let r in n.extensions) e[r] === void 0 && (t.userData.gltfExtensions = t.userData.gltfExtensions || {}, t.userData.gltfExtensions[r] = n.extensions[r]);
702
+ }
703
+ function Z(e, t) {
704
+ t.extras !== void 0 && (typeof t.extras == "object" ? Object.assign(e.userData, t.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + t.extras));
705
+ }
706
+ function nt(e, t, n) {
707
+ let r = !1, i = !1, a = !1;
708
+ for (let e = 0, n = t.length; e < n; e++) {
709
+ let n = t[e];
710
+ if (n.POSITION !== void 0 && (r = !0), n.NORMAL !== void 0 && (i = !0), n.COLOR_0 !== void 0 && (a = !0), r && i && a) break;
711
+ }
712
+ if (!r && !i && !a) return Promise.resolve(e);
713
+ let o = [], s = [], c = [];
714
+ for (let l = 0, u = t.length; l < u; l++) {
715
+ let u = t[l];
716
+ if (r) {
717
+ let t = u.POSITION === void 0 ? e.attributes.position : n.getDependency("accessor", u.POSITION);
718
+ o.push(t);
719
+ }
720
+ if (i) {
721
+ let t = u.NORMAL === void 0 ? e.attributes.normal : n.getDependency("accessor", u.NORMAL);
722
+ s.push(t);
723
+ }
724
+ if (a) {
725
+ let t = u.COLOR_0 === void 0 ? e.attributes.color : n.getDependency("accessor", u.COLOR_0);
726
+ c.push(t);
727
+ }
728
+ }
729
+ return Promise.all([
730
+ Promise.all(o),
731
+ Promise.all(s),
732
+ Promise.all(c)
733
+ ]).then(function(t) {
734
+ let n = t[0], o = t[1], s = t[2];
735
+ return r && (e.morphAttributes.position = n), i && (e.morphAttributes.normal = o), a && (e.morphAttributes.color = s), e.morphTargetsRelative = !0, e;
736
+ });
737
+ }
738
+ function rt(e, t) {
739
+ if (e.updateMorphTargets(), t.weights !== void 0) for (let n = 0, r = t.weights.length; n < r; n++) e.morphTargetInfluences[n] = t.weights[n];
740
+ if (t.extras && Array.isArray(t.extras.targetNames)) {
741
+ let n = t.extras.targetNames;
742
+ if (e.morphTargetInfluences.length === n.length) {
743
+ e.morphTargetDictionary = {};
744
+ for (let t = 0, r = n.length; t < r; t++) e.morphTargetDictionary[n[t]] = t;
745
+ } else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
746
+ }
747
+ }
748
+ function it(e) {
749
+ let t, n = e.extensions && e.extensions[L.KHR_DRACO_MESH_COMPRESSION];
750
+ if (t = n ? "draco:" + n.bufferView + ":" + n.indices + ":" + Q(n.attributes) : e.indices + ":" + Q(e.attributes) + ":" + e.mode, e.targets !== void 0) for (let n = 0, r = e.targets.length; n < r; n++) t += ":" + Q(e.targets[n]);
751
+ return t;
752
+ }
753
+ function Q(e) {
754
+ let t = "", n = Object.keys(e).sort();
755
+ for (let r = 0, i = n.length; r < i; r++) t += n[r] + ":" + e[n[r]] + ";";
756
+ return t;
757
+ }
758
+ function $(e) {
759
+ switch (e) {
760
+ case Int8Array: return 1 / 127;
761
+ case Uint8Array: return 1 / 255;
762
+ case Int16Array: return 1 / 32767;
763
+ case Uint16Array: return 1 / 65535;
764
+ default: throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
765
+ }
766
+ }
767
+ function at(e) {
768
+ return e.search(/\.jpe?g($|\?)/i) > 0 || e.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : e.search(/\.webp($|\?)/i) > 0 || e.search(/^data\:image\/webp/) === 0 ? "image/webp" : e.search(/\.ktx2($|\?)/i) > 0 || e.search(/^data\:image\/ktx2/) === 0 ? "image/ktx2" : "image/png";
769
+ }
770
+ var ot = new S(), st = class {
771
+ constructor(e = {}, t = {}) {
772
+ this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new ke(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.nodeCache = {}, this.meshCache = {
773
+ refs: {},
774
+ uses: {}
775
+ }, this.cameraCache = {
776
+ refs: {},
777
+ uses: {}
778
+ }, this.lightCache = {
779
+ refs: {},
780
+ uses: {}
781
+ }, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
782
+ let n = !1, r = -1, i = !1, a = -1;
783
+ if (typeof navigator < "u" && navigator.userAgent !== void 0) {
784
+ let e = navigator.userAgent;
785
+ n = /^((?!chrome|android).)*safari/i.test(e) === !0;
786
+ let t = e.match(/Version\/(\d+)/);
787
+ r = n && t ? parseInt(t[1], 10) : -1, i = e.indexOf("Firefox") > -1, a = i ? e.match(/Firefox\/([0-9]+)\./)[1] : -1;
788
+ }
789
+ typeof createImageBitmap > "u" || n && r < 17 || i && a < 98 ? this.textureLoader = new Ee(this.options.manager) : this.textureLoader = new d(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new l(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
790
+ }
791
+ setExtensions(e) {
792
+ this.extensions = e;
793
+ }
794
+ setPlugins(e) {
795
+ this.plugins = e;
796
+ }
797
+ parse(e, t) {
798
+ let n = this, r = this.json, i = this.extensions;
799
+ this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(e) {
800
+ return e._markDefs && e._markDefs();
801
+ }), Promise.all(this._invokeAll(function(e) {
802
+ return e.beforeRoot && e.beforeRoot();
803
+ })).then(function() {
804
+ return Promise.all([
805
+ n.getDependencies("scene"),
806
+ n.getDependencies("animation"),
807
+ n.getDependencies("camera")
808
+ ]);
809
+ }).then(function(t) {
810
+ let a = {
811
+ scene: t[0][r.scene || 0],
812
+ scenes: t[0],
813
+ animations: t[1],
814
+ cameras: t[2],
815
+ asset: r.asset,
816
+ parser: n,
817
+ userData: {}
818
+ };
819
+ return X(i, a, r), Z(a, r), Promise.all(n._invokeAll(function(e) {
820
+ return e.afterRoot && e.afterRoot(a);
821
+ })).then(function() {
822
+ for (let e of a.scenes) e.updateMatrixWorld();
823
+ e(a);
824
+ });
825
+ }).catch(t);
826
+ }
827
+ _markDefs() {
828
+ let e = this.json.nodes || [], t = this.json.skins || [], n = this.json.meshes || [];
829
+ for (let n = 0, r = t.length; n < r; n++) {
830
+ let r = t[n].joints;
831
+ for (let t = 0, n = r.length; t < n; t++) e[r[t]].isBone = !0;
832
+ }
833
+ for (let t = 0, r = e.length; t < r; t++) {
834
+ let r = e[t];
835
+ r.mesh !== void 0 && (this._addNodeRef(this.meshCache, r.mesh), r.skin !== void 0 && (n[r.mesh].isSkinnedMesh = !0)), r.camera !== void 0 && this._addNodeRef(this.cameraCache, r.camera);
836
+ }
837
+ }
838
+ _addNodeRef(e, t) {
839
+ t !== void 0 && (e.refs[t] === void 0 && (e.refs[t] = e.uses[t] = 0), e.refs[t]++);
840
+ }
841
+ _getNodeRef(e, t, n) {
842
+ if (e.refs[t] <= 1) return n;
843
+ let r = n.clone(), i = (e, t) => {
844
+ let n = this.associations.get(e);
845
+ n != null && this.associations.set(t, n);
846
+ for (let [n, r] of e.children.entries()) i(r, t.children[n]);
847
+ };
848
+ return i(n, r), r.name += "_instance_" + e.uses[t]++, r;
849
+ }
850
+ _invokeOne(e) {
851
+ let t = Object.values(this.plugins);
852
+ t.push(this);
853
+ for (let n = 0; n < t.length; n++) {
854
+ let r = e(t[n]);
855
+ if (r) return r;
856
+ }
857
+ return null;
858
+ }
859
+ _invokeAll(e) {
860
+ let t = Object.values(this.plugins);
861
+ t.unshift(this);
862
+ let n = [];
863
+ for (let r = 0; r < t.length; r++) {
864
+ let i = e(t[r]);
865
+ i && n.push(i);
866
+ }
867
+ return n;
868
+ }
869
+ getDependency(e, t) {
870
+ let n = e + ":" + t, r = this.cache.get(n);
871
+ if (!r) {
872
+ switch (e) {
873
+ case "scene":
874
+ r = this.loadScene(t);
875
+ break;
876
+ case "node":
877
+ r = this._invokeOne(function(e) {
878
+ return e.loadNode && e.loadNode(t);
879
+ });
880
+ break;
881
+ case "mesh":
882
+ r = this._invokeOne(function(e) {
883
+ return e.loadMesh && e.loadMesh(t);
884
+ });
885
+ break;
886
+ case "accessor":
887
+ r = this.loadAccessor(t);
888
+ break;
889
+ case "bufferView":
890
+ r = this._invokeOne(function(e) {
891
+ return e.loadBufferView && e.loadBufferView(t);
892
+ });
893
+ break;
894
+ case "buffer":
895
+ r = this.loadBuffer(t);
896
+ break;
897
+ case "material":
898
+ r = this._invokeOne(function(e) {
899
+ return e.loadMaterial && e.loadMaterial(t);
900
+ });
901
+ break;
902
+ case "texture":
903
+ r = this._invokeOne(function(e) {
904
+ return e.loadTexture && e.loadTexture(t);
905
+ });
906
+ break;
907
+ case "skin":
908
+ r = this.loadSkin(t);
909
+ break;
910
+ case "animation":
911
+ r = this._invokeOne(function(e) {
912
+ return e.loadAnimation && e.loadAnimation(t);
913
+ });
914
+ break;
915
+ case "camera":
916
+ r = this.loadCamera(t);
917
+ break;
918
+ default:
919
+ if (r = this._invokeOne(function(n) {
920
+ return n != this && n.getDependency && n.getDependency(e, t);
921
+ }), !r) throw Error("Unknown type: " + e);
922
+ break;
923
+ }
924
+ this.cache.add(n, r);
925
+ }
926
+ return r;
927
+ }
928
+ getDependencies(e) {
929
+ let t = this.cache.get(e);
930
+ if (!t) {
931
+ let n = this, r = this.json[e + (e === "mesh" ? "es" : "s")] || [];
932
+ t = Promise.all(r.map(function(t, r) {
933
+ return n.getDependency(e, r);
934
+ })), this.cache.add(e, t);
935
+ }
936
+ return t;
937
+ }
938
+ loadBuffer(e) {
939
+ let t = this.json.buffers[e], n = this.fileLoader;
940
+ if (t.type && t.type !== "arraybuffer") throw Error("THREE.GLTFLoader: " + t.type + " buffer type is not supported.");
941
+ if (t.uri === void 0 && e === 0) return Promise.resolve(this.extensions[L.KHR_BINARY_GLTF].body);
942
+ let r = this.options;
943
+ return new Promise(function(e, i) {
944
+ n.load(b.resolveURL(t.uri, r.path), e, void 0, function() {
945
+ i(/* @__PURE__ */ Error("THREE.GLTFLoader: Failed to load buffer \"" + t.uri + "\"."));
946
+ });
947
+ });
948
+ }
949
+ loadBufferView(e) {
950
+ let t = this.json.bufferViews[e];
951
+ return this.getDependency("buffer", t.buffer).then(function(e) {
952
+ let n = t.byteLength || 0, r = t.byteOffset || 0;
953
+ return e.slice(r, r + n);
954
+ });
955
+ }
956
+ loadAccessor(e) {
957
+ let t = this, n = this.json, i = this.json.accessors[e];
958
+ if (i.bufferView === void 0 && i.sparse === void 0) {
959
+ let e = K[i.type], t = W[i.componentType], n = i.normalized === !0, a = new t(i.count * e);
960
+ return Promise.resolve(new r(a, e, n));
961
+ }
962
+ let a = [];
963
+ return i.bufferView === void 0 ? a.push(null) : a.push(this.getDependency("bufferView", i.bufferView)), i.sparse !== void 0 && (a.push(this.getDependency("bufferView", i.sparse.indices.bufferView)), a.push(this.getDependency("bufferView", i.sparse.values.bufferView))), Promise.all(a).then(function(e) {
964
+ let a = e[0], o = K[i.type], s = W[i.componentType], c = s.BYTES_PER_ELEMENT, l = c * o, u = i.byteOffset || 0, d = i.bufferView === void 0 ? void 0 : n.bufferViews[i.bufferView].byteStride, f = i.normalized === !0, p, g;
965
+ if (d && d !== l) {
966
+ let e = Math.floor(u / d), n = "InterleavedBuffer:" + i.bufferView + ":" + i.componentType + ":" + e + ":" + i.count, r = t.cache.get(n);
967
+ r || (p = new s(a, e * d, i.count * d / c), r = new m(p, d / c), t.cache.add(n, r)), g = new h(r, o, u % d / c, f);
968
+ } else p = a === null ? new s(i.count * o) : new s(a, u, i.count * o), g = new r(p, o, f);
969
+ if (i.sparse !== void 0) {
970
+ let t = K.SCALAR, n = W[i.sparse.indices.componentType], c = i.sparse.indices.byteOffset || 0, l = i.sparse.values.byteOffset || 0, u = new n(e[1], c, i.sparse.count * t), d = new s(e[2], l, i.sparse.count * o);
971
+ a !== null && (g = new r(g.array.slice(), g.itemSize, g.normalized)), g.normalized = !1;
972
+ for (let e = 0, t = u.length; e < t; e++) {
973
+ let t = u[e];
974
+ if (g.setX(t, d[e * o]), o >= 2 && g.setY(t, d[e * o + 1]), o >= 3 && g.setZ(t, d[e * o + 2]), o >= 4 && g.setW(t, d[e * o + 3]), o >= 5) throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
975
+ }
976
+ g.normalized = f;
977
+ }
978
+ return g;
979
+ });
980
+ }
981
+ loadTexture(e) {
982
+ let t = this.json, n = this.options, r = t.textures[e].source, i = t.images[r], a = this.textureLoader;
983
+ if (i.uri) {
984
+ let e = n.manager.getHandler(i.uri);
985
+ e !== null && (a = e);
986
+ }
987
+ return this.loadTextureImage(e, r, a);
988
+ }
989
+ loadTextureImage(e, t, n) {
990
+ let r = this, i = this.json, a = i.textures[e], o = i.images[t], s = (o.uri || o.bufferView) + ":" + a.sampler;
991
+ if (this.textureCache[s]) return this.textureCache[s];
992
+ let c = this.loadImageSource(t, n).then(function(t) {
993
+ t.flipY = !1, t.name = a.name || o.name || "", t.name === "" && typeof o.uri == "string" && o.uri.startsWith("data:image/") === !1 && (t.name = o.uri);
994
+ let n = (i.samplers || {})[a.sampler] || {};
995
+ return t.magFilter = G[n.magFilter] || 1006, t.minFilter = G[n.minFilter] || 1008, t.wrapS = $e[n.wrapS] || 1e3, t.wrapT = $e[n.wrapT] || 1e3, t.generateMipmaps = !t.isCompressedTexture && t.minFilter !== 1003 && t.minFilter !== 1006, r.associations.set(t, { textures: e }), t;
996
+ }).catch(function() {
997
+ return null;
998
+ });
999
+ return this.textureCache[s] = c, c;
1000
+ }
1001
+ loadImageSource(e, t) {
1002
+ let n = this, r = this.json, i = this.options;
1003
+ if (this.sourceCache[e] !== void 0) return this.sourceCache[e].then((e) => e.clone());
1004
+ let a = r.images[e], o = self.URL || self.webkitURL, s = a.uri || "", c = !1;
1005
+ if (a.bufferView !== void 0) s = n.getDependency("bufferView", a.bufferView).then(function(e) {
1006
+ c = !0;
1007
+ let t = new Blob([e], { type: a.mimeType });
1008
+ return s = o.createObjectURL(t), s;
1009
+ });
1010
+ else if (a.uri === void 0) throw Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
1011
+ let l = Promise.resolve(s).then(function(e) {
1012
+ return new Promise(function(n, r) {
1013
+ let a = n;
1014
+ t.isImageBitmapLoader === !0 && (a = function(e) {
1015
+ let t = new A(e);
1016
+ t.needsUpdate = !0, n(t);
1017
+ }), t.load(b.resolveURL(e, i.path), a, void 0, r);
1018
+ });
1019
+ }).then(function(e) {
1020
+ return c === !0 && o.revokeObjectURL(s), Z(e, a), e.userData.mimeType = a.mimeType || at(a.uri), e;
1021
+ }).catch(function(e) {
1022
+ throw console.error("THREE.GLTFLoader: Couldn't load texture", s), e;
1023
+ });
1024
+ return this.sourceCache[e] = l, l;
1025
+ }
1026
+ assignTexture(e, t, n, r) {
1027
+ let i = this;
1028
+ return this.getDependency("texture", n.index).then(function(a) {
1029
+ if (!a) return null;
1030
+ if (n.texCoord !== void 0 && n.texCoord > 0 && (a = a.clone(), a.channel = n.texCoord), i.extensions[L.KHR_TEXTURE_TRANSFORM]) {
1031
+ let e = n.extensions === void 0 ? void 0 : n.extensions[L.KHR_TEXTURE_TRANSFORM];
1032
+ if (e) {
1033
+ let t = i.associations.get(a);
1034
+ a = i.extensions[L.KHR_TEXTURE_TRANSFORM].extendTexture(a, e), i.associations.set(a, t);
1035
+ }
1036
+ }
1037
+ return r !== void 0 && (a.colorSpace = r), e[t] = a, a;
1038
+ });
1039
+ }
1040
+ assignFinalMaterial(e) {
1041
+ let t = e.geometry, n = e.material, r = t.attributes.tangent === void 0, i = t.attributes.color !== void 0, a = t.attributes.normal === void 0;
1042
+ if (e.isPoints) {
1043
+ let e = "PointsMaterial:" + n.uuid, t = this.cache.get(e);
1044
+ t || (t = new ye(), x.prototype.copy.call(t, n), t.color.copy(n.color), t.map = n.map, t.sizeAttenuation = !1, this.cache.add(e, t)), n = t;
1045
+ } else if (e.isLine) {
1046
+ let e = "LineBasicMaterial:" + n.uuid, t = this.cache.get(e);
1047
+ t || (t = new te(), x.prototype.copy.call(t, n), t.color.copy(n.color), t.map = n.map, this.cache.add(e, t)), n = t;
1048
+ }
1049
+ if (r || i || a) {
1050
+ let e = "ClonedMaterial:" + n.uuid + ":";
1051
+ r && (e += "derivative-tangents:"), i && (e += "vertex-colors:"), a && (e += "flat-shading:");
1052
+ let t = this.cache.get(e);
1053
+ t || (t = n.clone(), i && (t.vertexColors = !0), a && (t.flatShading = !0), r && (t.normalScale && (t.normalScale.y *= -1), t.clearcoatNormalScale && (t.clearcoatNormalScale.y *= -1)), this.cache.add(e, t), this.associations.set(t, this.associations.get(n))), n = t;
1054
+ }
1055
+ e.material = n;
1056
+ }
1057
+ getMaterialType() {
1058
+ return ue;
1059
+ }
1060
+ loadMaterial(e) {
1061
+ let t = this, n = this.json, r = this.extensions, i = n.materials[e], a, s = {}, c = i.extensions || {}, l = [];
1062
+ if (c[L.KHR_MATERIALS_UNLIT]) {
1063
+ let e = r[L.KHR_MATERIALS_UNLIT];
1064
+ a = e.getMaterialType(), l.push(e.extendParams(s, i, t));
1065
+ } else {
1066
+ let n = i.pbrMetallicRoughness || {};
1067
+ if (s.color = new o(1, 1, 1), s.opacity = 1, Array.isArray(n.baseColorFactor)) {
1068
+ let e = n.baseColorFactor;
1069
+ s.color.setRGB(e[0], e[1], e[2], y), s.opacity = e[3];
1070
+ }
1071
+ n.baseColorTexture !== void 0 && l.push(t.assignTexture(s, "map", n.baseColorTexture, k)), s.metalness = n.metallicFactor === void 0 ? 1 : n.metallicFactor, s.roughness = n.roughnessFactor === void 0 ? 1 : n.roughnessFactor, n.metallicRoughnessTexture !== void 0 && (l.push(t.assignTexture(s, "metalnessMap", n.metallicRoughnessTexture)), l.push(t.assignTexture(s, "roughnessMap", n.metallicRoughnessTexture))), a = this._invokeOne(function(t) {
1072
+ return t.getMaterialType && t.getMaterialType(e);
1073
+ }), l.push(Promise.all(this._invokeAll(function(t) {
1074
+ return t.extendMaterialParams && t.extendMaterialParams(e, s);
1075
+ })));
1076
+ }
1077
+ i.doubleSided === !0 && (s.side = 2);
1078
+ let u = i.alphaMode || Y.OPAQUE;
1079
+ if (u === Y.BLEND ? (s.transparent = !0, s.depthWrite = !1) : (s.transparent = !1, u === Y.MASK && (s.alphaTest = i.alphaCutoff === void 0 ? .5 : i.alphaCutoff)), i.normalTexture !== void 0 && a !== C && (l.push(t.assignTexture(s, "normalMap", i.normalTexture)), s.normalScale = new j(1, 1), i.normalTexture.scale !== void 0)) {
1080
+ let e = i.normalTexture.scale;
1081
+ s.normalScale.set(e, e);
1082
+ }
1083
+ if (i.occlusionTexture !== void 0 && a !== C && (l.push(t.assignTexture(s, "aoMap", i.occlusionTexture)), i.occlusionTexture.strength !== void 0 && (s.aoMapIntensity = i.occlusionTexture.strength)), i.emissiveFactor !== void 0 && a !== C) {
1084
+ let e = i.emissiveFactor;
1085
+ s.emissive = new o().setRGB(e[0], e[1], e[2], y);
1086
+ }
1087
+ return i.emissiveTexture !== void 0 && a !== C && l.push(t.assignTexture(s, "emissiveMap", i.emissiveTexture, k)), Promise.all(l).then(function() {
1088
+ let n = new a(s);
1089
+ return i.name && (n.name = i.name), Z(n, i), t.associations.set(n, { materials: e }), i.extensions && X(r, n, i), n;
1090
+ });
1091
+ }
1092
+ createUniqueName(e) {
1093
+ let t = be.sanitizeNodeName(e || "");
1094
+ return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);
1095
+ }
1096
+ loadGeometries(e) {
1097
+ let t = this, n = this.extensions, r = this.primitiveCache;
1098
+ function a(e) {
1099
+ return n[L.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e, t).then(function(n) {
1100
+ return lt(n, e, t);
1101
+ });
1102
+ }
1103
+ let o = [];
1104
+ for (let n = 0, s = e.length; n < s; n++) {
1105
+ let s = e[n], c = it(s), l = r[c];
1106
+ if (l) o.push(l.promise);
1107
+ else {
1108
+ let e;
1109
+ e = s.extensions && s.extensions[L.KHR_DRACO_MESH_COMPRESSION] ? a(s) : lt(new i(), s, t), r[c] = {
1110
+ primitive: s,
1111
+ promise: e
1112
+ }, o.push(e);
1113
+ }
1114
+ }
1115
+ return Promise.all(o);
1116
+ }
1117
+ loadMesh(e) {
1118
+ let t = this, n = this.json, r = this.extensions, i = n.meshes[e], a = i.primitives, o = [];
1119
+ for (let e = 0, t = a.length; e < t; e++) {
1120
+ let t = a[e].material === void 0 ? tt(this.cache) : this.getDependency("material", a[e].material);
1121
+ o.push(t);
1122
+ }
1123
+ return o.push(t.loadGeometries(a)), Promise.all(o).then(function(n) {
1124
+ let o = n.slice(0, n.length - 1), s = n[n.length - 1], c = [];
1125
+ for (let n = 0, l = s.length; n < l; n++) {
1126
+ let l = s[n], u = a[n], d, f = o[n];
1127
+ if (u.mode === U.TRIANGLES || u.mode === U.TRIANGLE_STRIP || u.mode === U.TRIANGLE_FAN || u.mode === void 0) d = i.isSkinnedMesh === !0 ? new Ce(l, f) : new le(l, f), d.isSkinnedMesh === !0 && d.normalizeSkinWeights(), u.mode === U.TRIANGLE_STRIP ? d.geometry = P(d.geometry, 1) : u.mode === U.TRIANGLE_FAN && (d.geometry = P(d.geometry, 2));
1128
+ else if (u.mode === U.LINES) d = new re(l, f);
1129
+ else if (u.mode === U.LINE_STRIP) d = new ee(l, f);
1130
+ else if (u.mode === U.LINE_LOOP) d = new ne(l, f);
1131
+ else if (u.mode === U.POINTS) d = new ve(l, f);
1132
+ else throw Error("THREE.GLTFLoader: Primitive mode unsupported: " + u.mode);
1133
+ Object.keys(d.geometry.morphAttributes).length > 0 && rt(d, i), d.name = t.createUniqueName(i.name || "mesh_" + e), Z(d, i), u.extensions && X(r, d, u), t.assignFinalMaterial(d), c.push(d);
1134
+ }
1135
+ for (let n = 0, r = c.length; n < r; n++) t.associations.set(c[n], {
1136
+ meshes: e,
1137
+ primitives: n
1138
+ });
1139
+ if (c.length === 1) return i.extensions && X(r, c[0], i), c[0];
1140
+ let l = new u();
1141
+ i.extensions && X(r, l, i), t.associations.set(l, { meshes: e });
1142
+ for (let e = 0, t = c.length; e < t; e++) l.add(c[e]);
1143
+ return l;
1144
+ });
1145
+ }
1146
+ loadCamera(e) {
1147
+ let t, n = this.json.cameras[e], r = n[n.type];
1148
+ if (!r) {
1149
+ console.warn("THREE.GLTFLoader: Missing camera parameters.");
1150
+ return;
1151
+ }
1152
+ return n.type === "perspective" ? t = new ge(ce.radToDeg(r.yfov), r.aspectRatio || 1, r.znear || 1, r.zfar || 2e6) : n.type === "orthographic" && (t = new he(-r.xmag, r.xmag, r.ymag, -r.ymag, r.znear, r.zfar)), n.name && (t.name = this.createUniqueName(n.name)), Z(t, n), Promise.resolve(t);
1153
+ }
1154
+ loadSkin(e) {
1155
+ let t = this.json.skins[e], n = [];
1156
+ for (let e = 0, r = t.joints.length; e < r; e++) n.push(this._loadNodeShallow(t.joints[e]));
1157
+ return t.inverseBindMatrices === void 0 ? n.push(null) : n.push(this.getDependency("accessor", t.inverseBindMatrices)), Promise.all(n).then(function(e) {
1158
+ let n = e.pop(), r = e, i = [], a = [];
1159
+ for (let e = 0, o = r.length; e < o; e++) {
1160
+ let o = r[e];
1161
+ if (o) {
1162
+ i.push(o);
1163
+ let t = new S();
1164
+ n !== null && t.fromArray(n.array, e * 16), a.push(t);
1165
+ } else console.warn("THREE.GLTFLoader: Joint \"%s\" could not be found.", t.joints[e]);
1166
+ }
1167
+ return new Se(i, a);
1168
+ });
1169
+ }
1170
+ loadAnimation(t) {
1171
+ let n = this.json, r = this, i = n.animations[t], a = i.name ? i.name : "animation_" + t, o = [], s = [], c = [], l = [], u = [];
1172
+ for (let e = 0, t = i.channels.length; e < t; e++) {
1173
+ let t = i.channels[e], n = i.samplers[t.sampler], r = t.target, a = r.node, d = i.parameters === void 0 ? n.input : i.parameters[n.input], f = i.parameters === void 0 ? n.output : i.parameters[n.output];
1174
+ r.node !== void 0 && (o.push(this.getDependency("node", a)), s.push(this.getDependency("accessor", d)), c.push(this.getDependency("accessor", f)), l.push(n), u.push(r));
1175
+ }
1176
+ return Promise.all([
1177
+ Promise.all(o),
1178
+ Promise.all(s),
1179
+ Promise.all(c),
1180
+ Promise.all(l),
1181
+ Promise.all(u)
1182
+ ]).then(function(t) {
1183
+ let n = t[0], o = t[1], s = t[2], c = t[3], l = t[4], u = [];
1184
+ for (let e = 0, t = n.length; e < t; e++) {
1185
+ let t = n[e], i = o[e], a = s[e], d = c[e], f = l[e];
1186
+ if (t === void 0) continue;
1187
+ t.updateMatrix && t.updateMatrix();
1188
+ let p = r._createAnimationTracks(t, i, a, d, f);
1189
+ if (p) for (let e = 0; e < p.length; e++) u.push(p[e]);
1190
+ }
1191
+ let d = new e(a, void 0, u);
1192
+ return Z(d, i), d;
1193
+ });
1194
+ }
1195
+ createNodeMesh(e) {
1196
+ let t = this.json, n = this, r = t.nodes[e];
1197
+ return r.mesh === void 0 ? null : n.getDependency("mesh", r.mesh).then(function(e) {
1198
+ let t = n._getNodeRef(n.meshCache, r.mesh, e);
1199
+ return r.weights !== void 0 && t.traverse(function(e) {
1200
+ if (e.isMesh) for (let t = 0, n = r.weights.length; t < n; t++) e.morphTargetInfluences[t] = r.weights[t];
1201
+ }), t;
1202
+ });
1203
+ }
1204
+ loadNode(e) {
1205
+ let t = this.json, n = this, r = t.nodes[e], i = n._loadNodeShallow(e), a = [], o = r.children || [];
1206
+ for (let e = 0, t = o.length; e < t; e++) a.push(n.getDependency("node", o[e]));
1207
+ let s = r.skin === void 0 ? Promise.resolve(null) : n.getDependency("skin", r.skin);
1208
+ return Promise.all([
1209
+ i,
1210
+ Promise.all(a),
1211
+ s
1212
+ ]).then(function(e) {
1213
+ let t = e[0], n = e[1], r = e[2];
1214
+ r !== null && t.traverse(function(e) {
1215
+ e.isSkinnedMesh && e.bind(r, ot);
1216
+ });
1217
+ for (let e = 0, r = n.length; e < r; e++) t.add(n[e]);
1218
+ if (t.userData.pivot !== void 0 && n.length > 0) {
1219
+ let e = t.userData.pivot, r = n[0];
1220
+ t.pivot = new M().fromArray(e), t.position.x -= e[0], t.position.y -= e[1], t.position.z -= e[2], r.position.set(0, 0, 0), delete t.userData.pivot;
1221
+ }
1222
+ return t;
1223
+ });
1224
+ }
1225
+ _loadNodeShallow(e) {
1226
+ let n = this.json, r = this.extensions, i = this;
1227
+ if (this.nodeCache[e] !== void 0) return this.nodeCache[e];
1228
+ let a = n.nodes[e], o = a.name ? i.createUniqueName(a.name) : "", s = [], c = i._invokeOne(function(t) {
1229
+ return t.createNodeMesh && t.createNodeMesh(e);
1230
+ });
1231
+ return c && s.push(c), a.camera !== void 0 && s.push(i.getDependency("camera", a.camera).then(function(e) {
1232
+ return i._getNodeRef(i.cameraCache, a.camera, e);
1233
+ })), i._invokeAll(function(t) {
1234
+ return t.createNodeAttachment && t.createNodeAttachment(e);
1235
+ }).forEach(function(e) {
1236
+ s.push(e);
1237
+ }), this.nodeCache[e] = Promise.all(s).then(function(n) {
1238
+ let s;
1239
+ if (s = a.isBone === !0 ? new t() : n.length > 1 ? new u() : n.length === 1 ? n[0] : new E(), s !== n[0]) for (let e = 0, t = n.length; e < t; e++) s.add(n[e]);
1240
+ if (a.name && (s.userData.name = a.name, s.name = o), Z(s, a), a.extensions && X(r, s, a), a.matrix !== void 0) {
1241
+ let e = new S();
1242
+ e.fromArray(a.matrix), s.applyMatrix4(e);
1243
+ } else a.translation !== void 0 && s.position.fromArray(a.translation), a.rotation !== void 0 && s.quaternion.fromArray(a.rotation), a.scale !== void 0 && s.scale.fromArray(a.scale);
1244
+ if (!i.associations.has(s)) i.associations.set(s, {});
1245
+ else if (a.mesh !== void 0 && i.meshCache.refs[a.mesh] > 1) {
1246
+ let e = i.associations.get(s);
1247
+ i.associations.set(s, { ...e });
1248
+ }
1249
+ return i.associations.get(s).nodes = e, s;
1250
+ }), this.nodeCache[e];
1251
+ }
1252
+ loadScene(e) {
1253
+ let t = this.extensions, n = this.json.scenes[e], r = this, i = new u();
1254
+ n.name && (i.name = r.createUniqueName(n.name)), Z(i, n), n.extensions && X(t, i, n);
1255
+ let a = n.nodes || [], o = [];
1256
+ for (let e = 0, t = a.length; e < t; e++) o.push(r.getDependency("node", a[e]));
1257
+ return Promise.all(o).then(function(e) {
1258
+ for (let t = 0, n = e.length; t < n; t++) {
1259
+ let n = e[t];
1260
+ n.parent === null ? i.add(n) : i.add(De(n));
1261
+ }
1262
+ return r.associations = ((e) => {
1263
+ let t = /* @__PURE__ */ new Map();
1264
+ for (let [e, n] of r.associations) (e instanceof x || e instanceof A) && t.set(e, n);
1265
+ return e.traverse((e) => {
1266
+ let n = r.associations.get(e);
1267
+ n != null && t.set(e, n);
1268
+ }), t;
1269
+ })(i), i;
1270
+ });
1271
+ }
1272
+ _createAnimationTracks(e, t, n, r, i) {
1273
+ let a = [], o = e.name ? e.name : e.uuid, s = [];
1274
+ function c(e) {
1275
+ e.morphTargetInfluences && s.push(e.name ? e.name : e.uuid);
1276
+ }
1277
+ J[i.path] === J.weights ? (c(e), e.isGroup && e.children.forEach(c)) : s.push(o);
1278
+ let l;
1279
+ switch (J[i.path]) {
1280
+ case J.weights:
1281
+ l = T;
1282
+ break;
1283
+ case J.rotation:
1284
+ l = O;
1285
+ break;
1286
+ case J.translation:
1287
+ case J.scale:
1288
+ l = N;
1289
+ break;
1290
+ default:
1291
+ switch (n.itemSize) {
1292
+ case 1:
1293
+ l = T;
1294
+ break;
1295
+ default:
1296
+ l = N;
1297
+ break;
1298
+ }
1299
+ break;
1300
+ }
1301
+ let u = r.interpolation === void 0 ? v : et[r.interpolation], d = this._getArrayFromAccessor(n);
1302
+ for (let e = 0, n = s.length; e < n; e++) {
1303
+ let n = new l(s[e] + "." + J[i.path], t.array, d, u);
1304
+ r.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(n), a.push(n);
1305
+ }
1306
+ return a;
1307
+ }
1308
+ _getArrayFromAccessor(e) {
1309
+ let t = e.array;
1310
+ if (e.normalized) {
1311
+ let e = $(t.constructor), n = new Float32Array(t.length);
1312
+ for (let r = 0, i = t.length; r < i; r++) n[r] = t[r] * e;
1313
+ t = n;
1314
+ }
1315
+ return t;
1316
+ }
1317
+ _createCubicSplineTrackInterpolant(e) {
1318
+ e.createInterpolant = function(e) {
1319
+ return new (this instanceof O ? Qe : H)(this.times, this.values, this.getValueSize() / 3, e);
1320
+ }, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
1321
+ }
1322
+ };
1323
+ function ct(e, t, r) {
1324
+ let i = t.attributes, a = new n();
1325
+ if (i.POSITION !== void 0) {
1326
+ let e = r.json.accessors[i.POSITION], t = e.min, n = e.max;
1327
+ if (t !== void 0 && n !== void 0) {
1328
+ if (a.set(new M(t[0], t[1], t[2]), new M(n[0], n[1], n[2])), e.normalized) {
1329
+ let t = $(W[e.componentType]);
1330
+ a.min.multiplyScalar(t), a.max.multiplyScalar(t);
1331
+ }
1332
+ } else {
1333
+ console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
1334
+ return;
1335
+ }
1336
+ } else return;
1337
+ let o = t.targets;
1338
+ if (o !== void 0) {
1339
+ let e = new M(), t = new M();
1340
+ for (let n = 0, i = o.length; n < i; n++) {
1341
+ let i = o[n];
1342
+ if (i.POSITION !== void 0) {
1343
+ let n = r.json.accessors[i.POSITION], a = n.min, o = n.max;
1344
+ if (a !== void 0 && o !== void 0) {
1345
+ if (t.setX(Math.max(Math.abs(a[0]), Math.abs(o[0]))), t.setY(Math.max(Math.abs(a[1]), Math.abs(o[1]))), t.setZ(Math.max(Math.abs(a[2]), Math.abs(o[2]))), n.normalized) {
1346
+ let e = $(W[n.componentType]);
1347
+ t.multiplyScalar(e);
1348
+ }
1349
+ e.max(t);
1350
+ } else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
1351
+ }
1352
+ }
1353
+ a.expandByVector(e);
1354
+ }
1355
+ e.boundingBox = a;
1356
+ let s = new we();
1357
+ a.getCenter(s.center), s.radius = a.min.distanceTo(a.max) / 2, e.boundingSphere = s;
1358
+ }
1359
+ function lt(e, t, n) {
1360
+ let r = t.attributes, i = [];
1361
+ function a(t, r) {
1362
+ return n.getDependency("accessor", t).then(function(t) {
1363
+ e.setAttribute(r, t);
1364
+ });
1365
+ }
1366
+ for (let t in r) {
1367
+ let n = q[t] || t.toLowerCase();
1368
+ n in e.attributes || i.push(a(r[t], n));
1369
+ }
1370
+ if (t.indices !== void 0 && !e.index) {
1371
+ let r = n.getDependency("accessor", t.indices).then(function(t) {
1372
+ e.setIndex(t);
1373
+ });
1374
+ i.push(r);
1375
+ }
1376
+ return s.workingColorSpace !== "srgb-linear" && "COLOR_0" in r && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${s.workingColorSpace}" not supported.`), Z(e, t), ct(e, t, n), Promise.all(i).then(function() {
1377
+ return t.targets === void 0 ? e : nt(e, t.targets, n);
1378
+ });
1379
+ }
1380
+ //#endregion
1381
+ export { Oe as GLTFLoader };