pptx-svelte-viewer 0.1.1 → 0.1.2

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