@shopware-ag/dive 2.0.1-beta.0 → 2.0.1-beta.1

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.
Files changed (52) hide show
  1. package/build/chunks/{SelectTool-BRKko7uz.cjs → SelectTool-BAXTVyWs.cjs} +1 -1
  2. package/build/chunks/{SelectTool-mTRiZYaC.mjs → SelectTool-Bd8cC9nb.mjs} +15 -15
  3. package/build/chunks/{package-BvoZkrge.mjs → package-BHjZWYD6.mjs} +1 -1
  4. package/build/chunks/{package-BFpY3sIj.cjs → package-JHvTSNgQ.cjs} +1 -1
  5. package/build/dive.cjs +2 -2
  6. package/build/dive.mjs +471 -565
  7. package/build/src/components/floor/Floor.d.ts +2 -2
  8. package/build/src/components/grid/Grid.d.ts +1 -1
  9. package/build/src/components/light/AmbientLight.d.ts +3 -3
  10. package/build/src/components/light/PointLight.d.ts +3 -3
  11. package/build/src/components/light/SceneLight.d.ts +3 -3
  12. package/build/src/components/model/Model.d.ts +7 -4
  13. package/build/src/components/node/Node.d.ts +2 -2
  14. package/build/src/components/primitive/Primitive.d.ts +3 -3
  15. package/build/src/components/root/Root.d.ts +19 -29
  16. package/build/src/core/Dive.d.ts +4 -4
  17. package/build/src/engine/Engine.d.ts +2 -6
  18. package/build/src/engine/scene/Scene.d.ts +4 -22
  19. package/build/src/modules/asset/draco/README.md +32 -0
  20. package/build/src/modules/asset/draco/draco_decoder.js +33 -0
  21. package/build/src/modules/asset/draco/draco_decoder.wasm +0 -0
  22. package/build/src/modules/asset/draco/draco_encoder.js +33 -0
  23. package/build/src/modules/asset/draco/draco_wasm_wrapper.js +116 -0
  24. package/build/src/modules/asset/draco/gltf/draco_decoder.js +33 -0
  25. package/build/src/modules/asset/draco/gltf/draco_decoder.wasm +0 -0
  26. package/build/src/modules/asset/draco/gltf/draco_encoder.js +33 -0
  27. package/build/src/modules/asset/draco/gltf/draco_wasm_wrapper.js +116 -0
  28. package/build/src/modules/asset/loader/AssetLoader.cjs +3 -2
  29. package/build/src/modules/asset/loader/AssetLoader.mjs +1274 -1039
  30. package/build/src/modules/state/State.cjs +9 -9
  31. package/build/src/modules/state/State.mjs +579 -554
  32. package/build/src/modules/state/actions/camera/movecamera.d.ts +2 -2
  33. package/build/src/modules/state/actions/object/addobject.d.ts +1 -1
  34. package/build/src/modules/state/actions/object/deleteobject.d.ts +2 -2
  35. package/build/src/modules/state/actions/object/deselectobject.d.ts +2 -2
  36. package/build/src/modules/state/actions/object/dropit.d.ts +2 -2
  37. package/build/src/modules/state/actions/object/getobjects.d.ts +2 -2
  38. package/build/src/modules/state/actions/object/placeonfloor.d.ts +2 -2
  39. package/build/src/modules/state/actions/object/selectobject.d.ts +2 -2
  40. package/build/src/modules/state/actions/object/setparent.d.ts +2 -2
  41. package/build/src/modules/state/actions/object/updateobject.d.ts +2 -2
  42. package/build/src/modules/state/actions/scene/getallscenedata.d.ts +1 -1
  43. package/build/src/modules/state/types/COMEntity.d.ts +5 -0
  44. package/build/src/modules/state/types/COMGroup.d.ts +1 -0
  45. package/build/src/modules/state/types/COMLight.d.ts +18 -2
  46. package/build/src/modules/state/types/COMModel.d.ts +1 -0
  47. package/build/src/modules/state/types/COMPov.d.ts +1 -0
  48. package/build/src/modules/state/types/COMPrimitive.d.ts +1 -0
  49. package/build/src/modules/toolbox/Toolbox.cjs +1 -1
  50. package/build/src/modules/toolbox/Toolbox.mjs +1 -1
  51. package/build/src/types/SceneObjects.d.ts +3 -1
  52. package/package.json +2 -1
@@ -1,140 +1,140 @@
1
- var ve = Object.defineProperty;
2
- var Ge = (d, t, e) => t in d ? ve(d, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[t] = e;
3
- var J = (d, t, e) => Ge(d, typeof t != "symbol" ? t + "" : t, e);
4
- import { TrianglesDrawMode as Be, TriangleFanDrawMode as ne, TriangleStripDrawMode as Se, Loader as we, LoaderUtils as V, FileLoader as W, MeshPhysicalMaterial as C, Vector2 as z, Color as G, LinearSRGBColorSpace as O, SRGBColorSpace as P, SpotLight as Ue, PointLight as je, DirectionalLight as Ke, Matrix4 as q, Vector3 as B, Quaternion as _e, InstancedMesh as Ve, InstancedBufferAttribute as Xe, Object3D as ie, TextureLoader as ye, ImageBitmapLoader as We, BufferAttribute as v, InterleavedBuffer as ze, InterleavedBufferAttribute as qe, LinearMipmapLinearFilter as Le, NearestMipmapLinearFilter as Ye, LinearMipmapNearestFilter as Qe, NearestMipmapNearestFilter as Je, LinearFilter as Me, NearestFilter as Ze, RepeatWrapping as Y, MirroredRepeatWrapping as be, ClampToEdgeWrapping as Ne, PointsMaterial as $e, Material as Z, LineBasicMaterial as et, MeshStandardMaterial as Ie, DoubleSide as tt, MeshBasicMaterial as K, PropertyBinding as nt, BufferGeometry as Ce, SkinnedMesh as st, Mesh as Oe, LineSegments as rt, Line as it, LineLoop as ot, Points as at, Group as X, PerspectiveCamera as ct, MathUtils as ut, OrthographicCamera as lt, Skeleton as ft, AnimationClip as dt, Bone as ht, InterpolateDiscrete as pt, InterpolateLinear as Fe, Texture as ce, VectorKeyframeTrack as ue, NumberKeyframeTrack as le, QuaternionKeyframeTrack as fe, ColorManagement as de, FrontSide as mt, Interpolant as gt, Box3 as At, Sphere as Tt, NoColorSpace as k } from "three";
5
- import { u as xt, a as he, F as pe, P as me } from "../../../../chunks/parse-error-DRBVHL9E.mjs";
6
- import { g as Rt, i as Et, S as St } from "../../../../chunks/FileTypes-qgYnI0Jg.mjs";
7
- function ge(d, t) {
8
- if (t === Be)
9
- return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), d;
10
- if (t === ne || t === Se) {
11
- let e = d.getIndex();
12
- if (e === null) {
13
- const s = [], a = d.getAttribute("position");
1
+ var Ge = Object.defineProperty;
2
+ var ve = (h, e, t) => e in h ? Ge(h, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[e] = t;
3
+ var Q = (h, e, t) => ve(h, typeof e != "symbol" ? e + "" : e, t);
4
+ import { TrianglesDrawMode as Be, TriangleFanDrawMode as se, TriangleStripDrawMode as Se, Loader as ie, LoaderUtils as X, FileLoader as j, MeshPhysicalMaterial as k, Vector2 as z, Color as H, LinearSRGBColorSpace as O, SRGBColorSpace as C, SpotLight as je, PointLight as Ke, DirectionalLight as Ve, Matrix4 as q, Vector3 as v, Quaternion as Le, InstancedMesh as Xe, InstancedBufferAttribute as We, Object3D as ae, TextureLoader as be, ImageBitmapLoader as ze, BufferAttribute as D, InterleavedBuffer as qe, InterleavedBufferAttribute as Ye, LinearMipmapLinearFilter as Me, NearestMipmapLinearFilter as Je, LinearMipmapNearestFilter as Qe, NearestMipmapNearestFilter as Ze, LinearFilter as Ne, NearestFilter as $e, RepeatWrapping as Y, MirroredRepeatWrapping as Ie, ClampToEdgeWrapping as Ce, PointsMaterial as et, Material as Z, LineBasicMaterial as tt, MeshStandardMaterial as Oe, DoubleSide as nt, MeshBasicMaterial as V, PropertyBinding as st, BufferGeometry as ce, SkinnedMesh as rt, Mesh as ke, LineSegments as ot, Line as it, LineLoop as at, Points as ct, Group as W, PerspectiveCamera as lt, MathUtils as ut, OrthographicCamera as ft, Skeleton as dt, AnimationClip as ht, Bone as pt, InterpolateDiscrete as mt, InterpolateLinear as De, Texture as fe, VectorKeyframeTrack as de, NumberKeyframeTrack as he, QuaternionKeyframeTrack as pe, ColorManagement as me, FrontSide as gt, Interpolant as At, Box3 as Tt, Sphere as xt, NoColorSpace as U } from "three";
5
+ import { u as Rt, a as ge, F as Ae, P as Te } from "../../../../chunks/parse-error-DRBVHL9E.mjs";
6
+ import { g as yt, i as wt, S as _t } from "../../../../chunks/FileTypes-qgYnI0Jg.mjs";
7
+ function xe(h, e) {
8
+ if (e === Be)
9
+ return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), h;
10
+ if (e === se || e === Se) {
11
+ let t = h.getIndex();
12
+ if (t === null) {
13
+ const s = [], a = h.getAttribute("position");
14
14
  if (a !== void 0) {
15
- for (let o = 0; o < a.count; o++)
16
- s.push(o);
17
- d.setIndex(s), e = d.getIndex();
15
+ for (let i = 0; i < a.count; i++)
16
+ s.push(i);
17
+ h.setIndex(s), t = h.getIndex();
18
18
  } else
19
- return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), d;
19
+ return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), h;
20
20
  }
21
- const i = e.count - 2, n = [];
22
- if (t === ne)
23
- for (let s = 1; s <= i; s++)
24
- n.push(e.getX(0)), n.push(e.getX(s)), n.push(e.getX(s + 1));
21
+ const o = t.count - 2, n = [];
22
+ if (e === se)
23
+ for (let s = 1; s <= o; s++)
24
+ n.push(t.getX(0)), n.push(t.getX(s)), n.push(t.getX(s + 1));
25
25
  else
26
- for (let s = 0; s < i; s++)
27
- s % 2 === 0 ? (n.push(e.getX(s)), n.push(e.getX(s + 1)), n.push(e.getX(s + 2))) : (n.push(e.getX(s + 2)), n.push(e.getX(s + 1)), n.push(e.getX(s)));
28
- n.length / 3 !== i && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
29
- const r = d.clone();
26
+ for (let s = 0; s < o; s++)
27
+ s % 2 === 0 ? (n.push(t.getX(s)), n.push(t.getX(s + 1)), n.push(t.getX(s + 2))) : (n.push(t.getX(s + 2)), n.push(t.getX(s + 1)), n.push(t.getX(s)));
28
+ n.length / 3 !== o && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
29
+ const r = h.clone();
30
30
  return r.setIndex(n), r.clearGroups(), r;
31
31
  } else
32
- return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", t), d;
32
+ return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), h;
33
33
  }
34
- class wt extends we {
35
- constructor(t) {
36
- super(t), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(e) {
37
- return new bt(e);
38
- }), this.register(function(e) {
39
- return new Ht(e);
40
- }), this.register(function(e) {
41
- return new vt(e);
42
- }), this.register(function(e) {
43
- return new Gt(e);
44
- }), this.register(function(e) {
45
- return new It(e);
46
- }), this.register(function(e) {
47
- return new Ct(e);
48
- }), this.register(function(e) {
49
- return new Ot(e);
50
- }), this.register(function(e) {
51
- return new Ft(e);
52
- }), this.register(function(e) {
53
- return new Mt(e);
54
- }), this.register(function(e) {
55
- return new Dt(e);
56
- }), this.register(function(e) {
57
- return new Nt(e);
58
- }), this.register(function(e) {
59
- return new kt(e);
60
- }), this.register(function(e) {
61
- return new Pt(e);
62
- }), this.register(function(e) {
63
- return new yt(e);
64
- }), this.register(function(e) {
65
- return new Bt(e);
66
- }), this.register(function(e) {
67
- return new Ut(e);
34
+ class Et extends ie {
35
+ constructor(e) {
36
+ super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
37
+ return new Nt(t);
38
+ }), this.register(function(t) {
39
+ return new Ut(t);
40
+ }), this.register(function(t) {
41
+ return new Gt(t);
42
+ }), this.register(function(t) {
43
+ return new vt(t);
44
+ }), this.register(function(t) {
45
+ return new Ct(t);
46
+ }), this.register(function(t) {
47
+ return new Ot(t);
48
+ }), this.register(function(t) {
49
+ return new kt(t);
50
+ }), this.register(function(t) {
51
+ return new Dt(t);
52
+ }), this.register(function(t) {
53
+ return new Mt(t);
54
+ }), this.register(function(t) {
55
+ return new Ft(t);
56
+ }), this.register(function(t) {
57
+ return new It(t);
58
+ }), this.register(function(t) {
59
+ return new Ht(t);
60
+ }), this.register(function(t) {
61
+ return new Pt(t);
62
+ }), this.register(function(t) {
63
+ return new Lt(t);
64
+ }), this.register(function(t) {
65
+ return new Bt(t);
66
+ }), this.register(function(t) {
67
+ return new jt(t);
68
68
  });
69
69
  }
70
- load(t, e, i, n) {
70
+ load(e, t, o, n) {
71
71
  const r = this;
72
72
  let s;
73
73
  if (this.resourcePath !== "")
74
74
  s = this.resourcePath;
75
75
  else if (this.path !== "") {
76
- const c = V.extractUrlBase(t);
77
- s = V.resolveURL(c, this.path);
76
+ const c = X.extractUrlBase(e);
77
+ s = X.resolveURL(c, this.path);
78
78
  } else
79
- s = V.extractUrlBase(t);
80
- this.manager.itemStart(t);
79
+ s = X.extractUrlBase(e);
80
+ this.manager.itemStart(e);
81
81
  const a = function(c) {
82
- n ? n(c) : console.error(c), r.manager.itemError(t), r.manager.itemEnd(t);
83
- }, o = new W(this.manager);
84
- o.setPath(this.path), o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(t, function(c) {
82
+ n ? n(c) : console.error(c), r.manager.itemError(e), r.manager.itemEnd(e);
83
+ }, i = new j(this.manager);
84
+ i.setPath(this.path), i.setResponseType("arraybuffer"), i.setRequestHeader(this.requestHeader), i.setWithCredentials(this.withCredentials), i.load(e, function(c) {
85
85
  try {
86
86
  r.parse(c, s, function(l) {
87
- e(l), r.manager.itemEnd(t);
87
+ t(l), r.manager.itemEnd(e);
88
88
  }, a);
89
89
  } catch (l) {
90
90
  a(l);
91
91
  }
92
- }, i, a);
92
+ }, o, a);
93
93
  }
94
- setDRACOLoader(t) {
95
- return this.dracoLoader = t, this;
94
+ setDRACOLoader(e) {
95
+ return this.dracoLoader = e, this;
96
96
  }
97
97
  setDDSLoader() {
98
98
  throw new Error(
99
99
  'THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".'
100
100
  );
101
101
  }
102
- setKTX2Loader(t) {
103
- return this.ktx2Loader = t, this;
102
+ setKTX2Loader(e) {
103
+ return this.ktx2Loader = e, this;
104
104
  }
105
- setMeshoptDecoder(t) {
106
- return this.meshoptDecoder = t, this;
105
+ setMeshoptDecoder(e) {
106
+ return this.meshoptDecoder = e, this;
107
107
  }
108
- register(t) {
109
- return this.pluginCallbacks.indexOf(t) === -1 && this.pluginCallbacks.push(t), this;
108
+ register(e) {
109
+ return this.pluginCallbacks.indexOf(e) === -1 && this.pluginCallbacks.push(e), this;
110
110
  }
111
- unregister(t) {
112
- return this.pluginCallbacks.indexOf(t) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t), 1), this;
111
+ unregister(e) {
112
+ return this.pluginCallbacks.indexOf(e) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e), 1), this;
113
113
  }
114
- parse(t, e, i, n) {
114
+ parse(e, t, o, n) {
115
115
  let r;
116
- const s = {}, a = {}, o = new TextDecoder();
117
- if (typeof t == "string")
118
- r = JSON.parse(t);
119
- else if (t instanceof ArrayBuffer)
120
- if (o.decode(new Uint8Array(t, 0, 4)) === De) {
116
+ const s = {}, a = {}, i = new TextDecoder();
117
+ if (typeof e == "string")
118
+ r = JSON.parse(e);
119
+ else if (e instanceof ArrayBuffer)
120
+ if (i.decode(new Uint8Array(e, 0, 4)) === Fe) {
121
121
  try {
122
- s[w.KHR_BINARY_GLTF] = new jt(t);
122
+ s[E.KHR_BINARY_GLTF] = new Kt(e);
123
123
  } catch (u) {
124
124
  n && n(u);
125
125
  return;
126
126
  }
127
- r = JSON.parse(s[w.KHR_BINARY_GLTF].content);
127
+ r = JSON.parse(s[E.KHR_BINARY_GLTF].content);
128
128
  } else
129
- r = JSON.parse(o.decode(t));
129
+ r = JSON.parse(i.decode(e));
130
130
  else
131
- r = t;
131
+ r = e;
132
132
  if (r.asset === void 0 || r.asset.version[0] < 2) {
133
133
  n && n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
134
134
  return;
135
135
  }
136
- const c = new tn(r, {
137
- path: e || this.resourcePath || "",
136
+ const c = new nn(r, {
137
+ path: t || this.resourcePath || "",
138
138
  crossOrigin: this.crossOrigin,
139
139
  requestHeader: this.requestHeader,
140
140
  manager: this.manager,
@@ -148,51 +148,51 @@ class wt extends we {
148
148
  }
149
149
  if (r.extensionsUsed)
150
150
  for (let l = 0; l < r.extensionsUsed.length; ++l) {
151
- const u = r.extensionsUsed[l], p = r.extensionsRequired || [];
151
+ const u = r.extensionsUsed[l], f = r.extensionsRequired || [];
152
152
  switch (u) {
153
- case w.KHR_MATERIALS_UNLIT:
154
- s[u] = new Lt();
153
+ case E.KHR_MATERIALS_UNLIT:
154
+ s[u] = new bt();
155
155
  break;
156
- case w.KHR_DRACO_MESH_COMPRESSION:
157
- s[u] = new Kt(r, this.dracoLoader);
156
+ case E.KHR_DRACO_MESH_COMPRESSION:
157
+ s[u] = new Vt(r, this.dracoLoader);
158
158
  break;
159
- case w.KHR_TEXTURE_TRANSFORM:
160
- s[u] = new Vt();
161
- break;
162
- case w.KHR_MESH_QUANTIZATION:
159
+ case E.KHR_TEXTURE_TRANSFORM:
163
160
  s[u] = new Xt();
164
161
  break;
162
+ case E.KHR_MESH_QUANTIZATION:
163
+ s[u] = new Wt();
164
+ break;
165
165
  default:
166
- p.indexOf(u) >= 0 && a[u] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + u + '".');
166
+ f.indexOf(u) >= 0 && a[u] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + u + '".');
167
167
  }
168
168
  }
169
- c.setExtensions(s), c.setPlugins(a), c.parse(i, n);
169
+ c.setExtensions(s), c.setPlugins(a), c.parse(o, n);
170
170
  }
171
- parseAsync(t, e) {
172
- const i = this;
171
+ parseAsync(e, t) {
172
+ const o = this;
173
173
  return new Promise(function(n, r) {
174
- i.parse(t, e, n, r);
174
+ o.parse(e, t, n, r);
175
175
  });
176
176
  }
177
177
  }
178
- function _t() {
179
- let d = {};
178
+ function St() {
179
+ let h = {};
180
180
  return {
181
- get: function(t) {
182
- return d[t];
181
+ get: function(e) {
182
+ return h[e];
183
183
  },
184
- add: function(t, e) {
185
- d[t] = e;
184
+ add: function(e, t) {
185
+ h[e] = t;
186
186
  },
187
- remove: function(t) {
188
- delete d[t];
187
+ remove: function(e) {
188
+ delete h[e];
189
189
  },
190
190
  removeAll: function() {
191
- d = {};
191
+ h = {};
192
192
  }
193
193
  };
194
194
  }
195
- const w = {
195
+ const E = {
196
196
  KHR_BINARY_GLTF: "KHR_binary_glTF",
197
197
  KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
198
198
  KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
@@ -215,403 +215,403 @@ const w = {
215
215
  EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
216
216
  EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
217
217
  };
218
- class yt {
219
- constructor(t) {
220
- this.parser = t, this.name = w.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
218
+ class Lt {
219
+ constructor(e) {
220
+ this.parser = e, this.name = E.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
221
221
  }
222
222
  _markDefs() {
223
- const t = this.parser, e = this.parser.json.nodes || [];
224
- for (let i = 0, n = e.length; i < n; i++) {
225
- const r = e[i];
226
- r.extensions && r.extensions[this.name] && r.extensions[this.name].light !== void 0 && t._addNodeRef(this.cache, r.extensions[this.name].light);
223
+ const e = this.parser, t = this.parser.json.nodes || [];
224
+ for (let o = 0, n = t.length; o < n; o++) {
225
+ const r = t[o];
226
+ r.extensions && r.extensions[this.name] && r.extensions[this.name].light !== void 0 && e._addNodeRef(this.cache, r.extensions[this.name].light);
227
227
  }
228
228
  }
229
- _loadLight(t) {
230
- const e = this.parser, i = "light:" + t;
231
- let n = e.cache.get(i);
229
+ _loadLight(e) {
230
+ const t = this.parser, o = "light:" + e;
231
+ let n = t.cache.get(o);
232
232
  if (n) return n;
233
- const r = e.json, o = ((r.extensions && r.extensions[this.name] || {}).lights || [])[t];
233
+ const r = t.json, i = ((r.extensions && r.extensions[this.name] || {}).lights || [])[e];
234
234
  let c;
235
- const l = new G(16777215);
236
- o.color !== void 0 && l.setRGB(o.color[0], o.color[1], o.color[2], O);
237
- const u = o.range !== void 0 ? o.range : 0;
238
- switch (o.type) {
235
+ const l = new H(16777215);
236
+ i.color !== void 0 && l.setRGB(i.color[0], i.color[1], i.color[2], O);
237
+ const u = i.range !== void 0 ? i.range : 0;
238
+ switch (i.type) {
239
239
  case "directional":
240
- c = new Ke(l), c.target.position.set(0, 0, -1), c.add(c.target);
240
+ c = new Ve(l), c.target.position.set(0, 0, -1), c.add(c.target);
241
241
  break;
242
242
  case "point":
243
- c = new je(l), c.distance = u;
243
+ c = new Ke(l), c.distance = u;
244
244
  break;
245
245
  case "spot":
246
- c = new Ue(l), c.distance = u, o.spot = o.spot || {}, o.spot.innerConeAngle = o.spot.innerConeAngle !== void 0 ? o.spot.innerConeAngle : 0, o.spot.outerConeAngle = o.spot.outerConeAngle !== void 0 ? o.spot.outerConeAngle : Math.PI / 4, c.angle = o.spot.outerConeAngle, c.penumbra = 1 - o.spot.innerConeAngle / o.spot.outerConeAngle, c.target.position.set(0, 0, -1), c.add(c.target);
246
+ c = new je(l), c.distance = u, 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, c.angle = i.spot.outerConeAngle, c.penumbra = 1 - i.spot.innerConeAngle / i.spot.outerConeAngle, c.target.position.set(0, 0, -1), c.add(c.target);
247
247
  break;
248
248
  default:
249
- throw new Error("THREE.GLTFLoader: Unexpected light type: " + o.type);
249
+ throw new Error("THREE.GLTFLoader: Unexpected light type: " + i.type);
250
250
  }
251
- return c.position.set(0, 0, 0), c.decay = 2, D(c, o), o.intensity !== void 0 && (c.intensity = o.intensity), c.name = e.createUniqueName(o.name || "light_" + t), n = Promise.resolve(c), e.cache.add(i, n), n;
251
+ return c.position.set(0, 0, 0), c.decay = 2, P(c, i), i.intensity !== void 0 && (c.intensity = i.intensity), c.name = t.createUniqueName(i.name || "light_" + e), n = Promise.resolve(c), t.cache.add(o, n), n;
252
252
  }
253
- getDependency(t, e) {
254
- if (t === "light")
255
- return this._loadLight(e);
253
+ getDependency(e, t) {
254
+ if (e === "light")
255
+ return this._loadLight(t);
256
256
  }
257
- createNodeAttachment(t) {
258
- const e = this, i = this.parser, r = i.json.nodes[t], a = (r.extensions && r.extensions[this.name] || {}).light;
259
- return a === void 0 ? null : this._loadLight(a).then(function(o) {
260
- return i._getNodeRef(e.cache, a, o);
257
+ createNodeAttachment(e) {
258
+ const t = this, o = this.parser, r = o.json.nodes[e], a = (r.extensions && r.extensions[this.name] || {}).light;
259
+ return a === void 0 ? null : this._loadLight(a).then(function(i) {
260
+ return o._getNodeRef(t.cache, a, i);
261
261
  });
262
262
  }
263
263
  }
264
- class Lt {
264
+ class bt {
265
265
  constructor() {
266
- this.name = w.KHR_MATERIALS_UNLIT;
266
+ this.name = E.KHR_MATERIALS_UNLIT;
267
267
  }
268
268
  getMaterialType() {
269
- return K;
269
+ return V;
270
270
  }
271
- extendParams(t, e, i) {
271
+ extendParams(e, t, o) {
272
272
  const n = [];
273
- t.color = new G(1, 1, 1), t.opacity = 1;
274
- const r = e.pbrMetallicRoughness;
273
+ e.color = new H(1, 1, 1), e.opacity = 1;
274
+ const r = t.pbrMetallicRoughness;
275
275
  if (r) {
276
276
  if (Array.isArray(r.baseColorFactor)) {
277
277
  const s = r.baseColorFactor;
278
- t.color.setRGB(s[0], s[1], s[2], O), t.opacity = s[3];
278
+ e.color.setRGB(s[0], s[1], s[2], O), e.opacity = s[3];
279
279
  }
280
- r.baseColorTexture !== void 0 && n.push(i.assignTexture(t, "map", r.baseColorTexture, P));
280
+ r.baseColorTexture !== void 0 && n.push(o.assignTexture(e, "map", r.baseColorTexture, C));
281
281
  }
282
282
  return Promise.all(n);
283
283
  }
284
284
  }
285
285
  class Mt {
286
- constructor(t) {
287
- this.parser = t, this.name = w.KHR_MATERIALS_EMISSIVE_STRENGTH;
286
+ constructor(e) {
287
+ this.parser = e, this.name = E.KHR_MATERIALS_EMISSIVE_STRENGTH;
288
288
  }
289
- extendMaterialParams(t, e) {
290
- const n = this.parser.json.materials[t];
289
+ extendMaterialParams(e, t) {
290
+ const n = this.parser.json.materials[e];
291
291
  if (!n.extensions || !n.extensions[this.name])
292
292
  return Promise.resolve();
293
293
  const r = n.extensions[this.name].emissiveStrength;
294
- return r !== void 0 && (e.emissiveIntensity = r), Promise.resolve();
294
+ return r !== void 0 && (t.emissiveIntensity = r), Promise.resolve();
295
295
  }
296
296
  }
297
- class bt {
298
- constructor(t) {
299
- this.parser = t, this.name = w.KHR_MATERIALS_CLEARCOAT;
297
+ class Nt {
298
+ constructor(e) {
299
+ this.parser = e, this.name = E.KHR_MATERIALS_CLEARCOAT;
300
300
  }
301
- getMaterialType(t) {
302
- const i = this.parser.json.materials[t];
303
- return !i.extensions || !i.extensions[this.name] ? null : C;
301
+ getMaterialType(e) {
302
+ const o = this.parser.json.materials[e];
303
+ return !o.extensions || !o.extensions[this.name] ? null : k;
304
304
  }
305
- extendMaterialParams(t, e) {
306
- const i = this.parser, n = i.json.materials[t];
305
+ extendMaterialParams(e, t) {
306
+ const o = this.parser, n = o.json.materials[e];
307
307
  if (!n.extensions || !n.extensions[this.name])
308
308
  return Promise.resolve();
309
309
  const r = [], s = n.extensions[this.name];
310
- if (s.clearcoatFactor !== void 0 && (e.clearcoat = s.clearcoatFactor), s.clearcoatTexture !== void 0 && r.push(i.assignTexture(e, "clearcoatMap", s.clearcoatTexture)), s.clearcoatRoughnessFactor !== void 0 && (e.clearcoatRoughness = s.clearcoatRoughnessFactor), s.clearcoatRoughnessTexture !== void 0 && r.push(i.assignTexture(e, "clearcoatRoughnessMap", s.clearcoatRoughnessTexture)), s.clearcoatNormalTexture !== void 0 && (r.push(i.assignTexture(e, "clearcoatNormalMap", s.clearcoatNormalTexture)), s.clearcoatNormalTexture.scale !== void 0)) {
310
+ if (s.clearcoatFactor !== void 0 && (t.clearcoat = s.clearcoatFactor), s.clearcoatTexture !== void 0 && r.push(o.assignTexture(t, "clearcoatMap", s.clearcoatTexture)), s.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = s.clearcoatRoughnessFactor), s.clearcoatRoughnessTexture !== void 0 && r.push(o.assignTexture(t, "clearcoatRoughnessMap", s.clearcoatRoughnessTexture)), s.clearcoatNormalTexture !== void 0 && (r.push(o.assignTexture(t, "clearcoatNormalMap", s.clearcoatNormalTexture)), s.clearcoatNormalTexture.scale !== void 0)) {
311
311
  const a = s.clearcoatNormalTexture.scale;
312
- e.clearcoatNormalScale = new z(a, a);
312
+ t.clearcoatNormalScale = new z(a, a);
313
313
  }
314
314
  return Promise.all(r);
315
315
  }
316
316
  }
317
- class Nt {
318
- constructor(t) {
319
- this.parser = t, this.name = w.KHR_MATERIALS_IRIDESCENCE;
317
+ class It {
318
+ constructor(e) {
319
+ this.parser = e, this.name = E.KHR_MATERIALS_IRIDESCENCE;
320
320
  }
321
- getMaterialType(t) {
322
- const i = this.parser.json.materials[t];
323
- return !i.extensions || !i.extensions[this.name] ? null : C;
321
+ getMaterialType(e) {
322
+ const o = this.parser.json.materials[e];
323
+ return !o.extensions || !o.extensions[this.name] ? null : k;
324
324
  }
325
- extendMaterialParams(t, e) {
326
- const i = this.parser, n = i.json.materials[t];
325
+ extendMaterialParams(e, t) {
326
+ const o = this.parser, n = o.json.materials[e];
327
327
  if (!n.extensions || !n.extensions[this.name])
328
328
  return Promise.resolve();
329
329
  const r = [], s = n.extensions[this.name];
330
- return s.iridescenceFactor !== void 0 && (e.iridescence = s.iridescenceFactor), s.iridescenceTexture !== void 0 && r.push(i.assignTexture(e, "iridescenceMap", s.iridescenceTexture)), s.iridescenceIor !== void 0 && (e.iridescenceIOR = s.iridescenceIor), e.iridescenceThicknessRange === void 0 && (e.iridescenceThicknessRange = [100, 400]), s.iridescenceThicknessMinimum !== void 0 && (e.iridescenceThicknessRange[0] = s.iridescenceThicknessMinimum), s.iridescenceThicknessMaximum !== void 0 && (e.iridescenceThicknessRange[1] = s.iridescenceThicknessMaximum), s.iridescenceThicknessTexture !== void 0 && r.push(i.assignTexture(e, "iridescenceThicknessMap", s.iridescenceThicknessTexture)), Promise.all(r);
330
+ return s.iridescenceFactor !== void 0 && (t.iridescence = s.iridescenceFactor), s.iridescenceTexture !== void 0 && r.push(o.assignTexture(t, "iridescenceMap", s.iridescenceTexture)), s.iridescenceIor !== void 0 && (t.iridescenceIOR = s.iridescenceIor), t.iridescenceThicknessRange === void 0 && (t.iridescenceThicknessRange = [100, 400]), s.iridescenceThicknessMinimum !== void 0 && (t.iridescenceThicknessRange[0] = s.iridescenceThicknessMinimum), s.iridescenceThicknessMaximum !== void 0 && (t.iridescenceThicknessRange[1] = s.iridescenceThicknessMaximum), s.iridescenceThicknessTexture !== void 0 && r.push(o.assignTexture(t, "iridescenceThicknessMap", s.iridescenceThicknessTexture)), Promise.all(r);
331
331
  }
332
332
  }
333
- class It {
334
- constructor(t) {
335
- this.parser = t, this.name = w.KHR_MATERIALS_SHEEN;
333
+ class Ct {
334
+ constructor(e) {
335
+ this.parser = e, this.name = E.KHR_MATERIALS_SHEEN;
336
336
  }
337
- getMaterialType(t) {
338
- const i = this.parser.json.materials[t];
339
- return !i.extensions || !i.extensions[this.name] ? null : C;
337
+ getMaterialType(e) {
338
+ const o = this.parser.json.materials[e];
339
+ return !o.extensions || !o.extensions[this.name] ? null : k;
340
340
  }
341
- extendMaterialParams(t, e) {
342
- const i = this.parser, n = i.json.materials[t];
341
+ extendMaterialParams(e, t) {
342
+ const o = this.parser, n = o.json.materials[e];
343
343
  if (!n.extensions || !n.extensions[this.name])
344
344
  return Promise.resolve();
345
345
  const r = [];
346
- e.sheenColor = new G(0, 0, 0), e.sheenRoughness = 0, e.sheen = 1;
346
+ t.sheenColor = new H(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1;
347
347
  const s = n.extensions[this.name];
348
348
  if (s.sheenColorFactor !== void 0) {
349
349
  const a = s.sheenColorFactor;
350
- e.sheenColor.setRGB(a[0], a[1], a[2], O);
350
+ t.sheenColor.setRGB(a[0], a[1], a[2], O);
351
351
  }
352
- return s.sheenRoughnessFactor !== void 0 && (e.sheenRoughness = s.sheenRoughnessFactor), s.sheenColorTexture !== void 0 && r.push(i.assignTexture(e, "sheenColorMap", s.sheenColorTexture, P)), s.sheenRoughnessTexture !== void 0 && r.push(i.assignTexture(e, "sheenRoughnessMap", s.sheenRoughnessTexture)), Promise.all(r);
352
+ return s.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = s.sheenRoughnessFactor), s.sheenColorTexture !== void 0 && r.push(o.assignTexture(t, "sheenColorMap", s.sheenColorTexture, C)), s.sheenRoughnessTexture !== void 0 && r.push(o.assignTexture(t, "sheenRoughnessMap", s.sheenRoughnessTexture)), Promise.all(r);
353
353
  }
354
354
  }
355
- class Ct {
356
- constructor(t) {
357
- this.parser = t, this.name = w.KHR_MATERIALS_TRANSMISSION;
355
+ class Ot {
356
+ constructor(e) {
357
+ this.parser = e, this.name = E.KHR_MATERIALS_TRANSMISSION;
358
358
  }
359
- getMaterialType(t) {
360
- const i = this.parser.json.materials[t];
361
- return !i.extensions || !i.extensions[this.name] ? null : C;
359
+ getMaterialType(e) {
360
+ const o = this.parser.json.materials[e];
361
+ return !o.extensions || !o.extensions[this.name] ? null : k;
362
362
  }
363
- extendMaterialParams(t, e) {
364
- const i = this.parser, n = i.json.materials[t];
363
+ extendMaterialParams(e, t) {
364
+ const o = this.parser, n = o.json.materials[e];
365
365
  if (!n.extensions || !n.extensions[this.name])
366
366
  return Promise.resolve();
367
367
  const r = [], s = n.extensions[this.name];
368
- return s.transmissionFactor !== void 0 && (e.transmission = s.transmissionFactor), s.transmissionTexture !== void 0 && r.push(i.assignTexture(e, "transmissionMap", s.transmissionTexture)), Promise.all(r);
368
+ return s.transmissionFactor !== void 0 && (t.transmission = s.transmissionFactor), s.transmissionTexture !== void 0 && r.push(o.assignTexture(t, "transmissionMap", s.transmissionTexture)), Promise.all(r);
369
369
  }
370
370
  }
371
- class Ot {
372
- constructor(t) {
373
- this.parser = t, this.name = w.KHR_MATERIALS_VOLUME;
371
+ class kt {
372
+ constructor(e) {
373
+ this.parser = e, this.name = E.KHR_MATERIALS_VOLUME;
374
374
  }
375
- getMaterialType(t) {
376
- const i = this.parser.json.materials[t];
377
- return !i.extensions || !i.extensions[this.name] ? null : C;
375
+ getMaterialType(e) {
376
+ const o = this.parser.json.materials[e];
377
+ return !o.extensions || !o.extensions[this.name] ? null : k;
378
378
  }
379
- extendMaterialParams(t, e) {
380
- const i = this.parser, n = i.json.materials[t];
379
+ extendMaterialParams(e, t) {
380
+ const o = this.parser, n = o.json.materials[e];
381
381
  if (!n.extensions || !n.extensions[this.name])
382
382
  return Promise.resolve();
383
383
  const r = [], s = n.extensions[this.name];
384
- e.thickness = s.thicknessFactor !== void 0 ? s.thicknessFactor : 0, s.thicknessTexture !== void 0 && r.push(i.assignTexture(e, "thicknessMap", s.thicknessTexture)), e.attenuationDistance = s.attenuationDistance || 1 / 0;
384
+ t.thickness = s.thicknessFactor !== void 0 ? s.thicknessFactor : 0, s.thicknessTexture !== void 0 && r.push(o.assignTexture(t, "thicknessMap", s.thicknessTexture)), t.attenuationDistance = s.attenuationDistance || 1 / 0;
385
385
  const a = s.attenuationColor || [1, 1, 1];
386
- return e.attenuationColor = new G().setRGB(a[0], a[1], a[2], O), Promise.all(r);
386
+ return t.attenuationColor = new H().setRGB(a[0], a[1], a[2], O), Promise.all(r);
387
387
  }
388
388
  }
389
- class Ft {
390
- constructor(t) {
391
- this.parser = t, this.name = w.KHR_MATERIALS_IOR;
389
+ class Dt {
390
+ constructor(e) {
391
+ this.parser = e, this.name = E.KHR_MATERIALS_IOR;
392
392
  }
393
- getMaterialType(t) {
394
- const i = this.parser.json.materials[t];
395
- return !i.extensions || !i.extensions[this.name] ? null : C;
393
+ getMaterialType(e) {
394
+ const o = this.parser.json.materials[e];
395
+ return !o.extensions || !o.extensions[this.name] ? null : k;
396
396
  }
397
- extendMaterialParams(t, e) {
398
- const n = this.parser.json.materials[t];
397
+ extendMaterialParams(e, t) {
398
+ const n = this.parser.json.materials[e];
399
399
  if (!n.extensions || !n.extensions[this.name])
400
400
  return Promise.resolve();
401
401
  const r = n.extensions[this.name];
402
- return e.ior = r.ior !== void 0 ? r.ior : 1.5, Promise.resolve();
402
+ return t.ior = r.ior !== void 0 ? r.ior : 1.5, Promise.resolve();
403
403
  }
404
404
  }
405
- class Dt {
406
- constructor(t) {
407
- this.parser = t, this.name = w.KHR_MATERIALS_SPECULAR;
405
+ class Ft {
406
+ constructor(e) {
407
+ this.parser = e, this.name = E.KHR_MATERIALS_SPECULAR;
408
408
  }
409
- getMaterialType(t) {
410
- const i = this.parser.json.materials[t];
411
- return !i.extensions || !i.extensions[this.name] ? null : C;
409
+ getMaterialType(e) {
410
+ const o = this.parser.json.materials[e];
411
+ return !o.extensions || !o.extensions[this.name] ? null : k;
412
412
  }
413
- extendMaterialParams(t, e) {
414
- const i = this.parser, n = i.json.materials[t];
413
+ extendMaterialParams(e, t) {
414
+ const o = this.parser, n = o.json.materials[e];
415
415
  if (!n.extensions || !n.extensions[this.name])
416
416
  return Promise.resolve();
417
417
  const r = [], s = n.extensions[this.name];
418
- e.specularIntensity = s.specularFactor !== void 0 ? s.specularFactor : 1, s.specularTexture !== void 0 && r.push(i.assignTexture(e, "specularIntensityMap", s.specularTexture));
418
+ t.specularIntensity = s.specularFactor !== void 0 ? s.specularFactor : 1, s.specularTexture !== void 0 && r.push(o.assignTexture(t, "specularIntensityMap", s.specularTexture));
419
419
  const a = s.specularColorFactor || [1, 1, 1];
420
- return e.specularColor = new G().setRGB(a[0], a[1], a[2], O), s.specularColorTexture !== void 0 && r.push(i.assignTexture(e, "specularColorMap", s.specularColorTexture, P)), Promise.all(r);
420
+ return t.specularColor = new H().setRGB(a[0], a[1], a[2], O), s.specularColorTexture !== void 0 && r.push(o.assignTexture(t, "specularColorMap", s.specularColorTexture, C)), Promise.all(r);
421
421
  }
422
422
  }
423
423
  class Pt {
424
- constructor(t) {
425
- this.parser = t, this.name = w.EXT_MATERIALS_BUMP;
424
+ constructor(e) {
425
+ this.parser = e, this.name = E.EXT_MATERIALS_BUMP;
426
426
  }
427
- getMaterialType(t) {
428
- const i = this.parser.json.materials[t];
429
- return !i.extensions || !i.extensions[this.name] ? null : C;
427
+ getMaterialType(e) {
428
+ const o = this.parser.json.materials[e];
429
+ return !o.extensions || !o.extensions[this.name] ? null : k;
430
430
  }
431
- extendMaterialParams(t, e) {
432
- const i = this.parser, n = i.json.materials[t];
431
+ extendMaterialParams(e, t) {
432
+ const o = this.parser, n = o.json.materials[e];
433
433
  if (!n.extensions || !n.extensions[this.name])
434
434
  return Promise.resolve();
435
435
  const r = [], s = n.extensions[this.name];
436
- return e.bumpScale = s.bumpFactor !== void 0 ? s.bumpFactor : 1, s.bumpTexture !== void 0 && r.push(i.assignTexture(e, "bumpMap", s.bumpTexture)), Promise.all(r);
436
+ return t.bumpScale = s.bumpFactor !== void 0 ? s.bumpFactor : 1, s.bumpTexture !== void 0 && r.push(o.assignTexture(t, "bumpMap", s.bumpTexture)), Promise.all(r);
437
437
  }
438
438
  }
439
- class kt {
440
- constructor(t) {
441
- this.parser = t, this.name = w.KHR_MATERIALS_ANISOTROPY;
439
+ class Ht {
440
+ constructor(e) {
441
+ this.parser = e, this.name = E.KHR_MATERIALS_ANISOTROPY;
442
442
  }
443
- getMaterialType(t) {
444
- const i = this.parser.json.materials[t];
445
- return !i.extensions || !i.extensions[this.name] ? null : C;
443
+ getMaterialType(e) {
444
+ const o = this.parser.json.materials[e];
445
+ return !o.extensions || !o.extensions[this.name] ? null : k;
446
446
  }
447
- extendMaterialParams(t, e) {
448
- const i = this.parser, n = i.json.materials[t];
447
+ extendMaterialParams(e, t) {
448
+ const o = this.parser, n = o.json.materials[e];
449
449
  if (!n.extensions || !n.extensions[this.name])
450
450
  return Promise.resolve();
451
451
  const r = [], s = n.extensions[this.name];
452
- return s.anisotropyStrength !== void 0 && (e.anisotropy = s.anisotropyStrength), s.anisotropyRotation !== void 0 && (e.anisotropyRotation = s.anisotropyRotation), s.anisotropyTexture !== void 0 && r.push(i.assignTexture(e, "anisotropyMap", s.anisotropyTexture)), Promise.all(r);
452
+ return s.anisotropyStrength !== void 0 && (t.anisotropy = s.anisotropyStrength), s.anisotropyRotation !== void 0 && (t.anisotropyRotation = s.anisotropyRotation), s.anisotropyTexture !== void 0 && r.push(o.assignTexture(t, "anisotropyMap", s.anisotropyTexture)), Promise.all(r);
453
453
  }
454
454
  }
455
- class Ht {
456
- constructor(t) {
457
- this.parser = t, this.name = w.KHR_TEXTURE_BASISU;
455
+ class Ut {
456
+ constructor(e) {
457
+ this.parser = e, this.name = E.KHR_TEXTURE_BASISU;
458
458
  }
459
- loadTexture(t) {
460
- const e = this.parser, i = e.json, n = i.textures[t];
459
+ loadTexture(e) {
460
+ const t = this.parser, o = t.json, n = o.textures[e];
461
461
  if (!n.extensions || !n.extensions[this.name])
462
462
  return null;
463
- const r = n.extensions[this.name], s = e.options.ktx2Loader;
463
+ const r = n.extensions[this.name], s = t.options.ktx2Loader;
464
464
  if (!s) {
465
- if (i.extensionsRequired && i.extensionsRequired.indexOf(this.name) >= 0)
465
+ if (o.extensionsRequired && o.extensionsRequired.indexOf(this.name) >= 0)
466
466
  throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
467
467
  return null;
468
468
  }
469
- return e.loadTextureImage(t, r.source, s);
469
+ return t.loadTextureImage(e, r.source, s);
470
470
  }
471
471
  }
472
- class vt {
473
- constructor(t) {
474
- this.parser = t, this.name = w.EXT_TEXTURE_WEBP, this.isSupported = null;
472
+ class Gt {
473
+ constructor(e) {
474
+ this.parser = e, this.name = E.EXT_TEXTURE_WEBP, this.isSupported = null;
475
475
  }
476
- loadTexture(t) {
477
- const e = this.name, i = this.parser, n = i.json, r = n.textures[t];
478
- if (!r.extensions || !r.extensions[e])
476
+ loadTexture(e) {
477
+ const t = this.name, o = this.parser, n = o.json, r = n.textures[e];
478
+ if (!r.extensions || !r.extensions[t])
479
479
  return null;
480
- const s = r.extensions[e], a = n.images[s.source];
481
- let o = i.textureLoader;
480
+ const s = r.extensions[t], a = n.images[s.source];
481
+ let i = o.textureLoader;
482
482
  if (a.uri) {
483
- const c = i.options.manager.getHandler(a.uri);
484
- c !== null && (o = c);
483
+ const c = o.options.manager.getHandler(a.uri);
484
+ c !== null && (i = c);
485
485
  }
486
486
  return this.detectSupport().then(function(c) {
487
- if (c) return i.loadTextureImage(t, s.source, o);
488
- if (n.extensionsRequired && n.extensionsRequired.indexOf(e) >= 0)
487
+ if (c) return o.loadTextureImage(e, s.source, i);
488
+ if (n.extensionsRequired && n.extensionsRequired.indexOf(t) >= 0)
489
489
  throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
490
- return i.loadTexture(t);
490
+ return o.loadTexture(e);
491
491
  });
492
492
  }
493
493
  detectSupport() {
494
- return this.isSupported || (this.isSupported = new Promise(function(t) {
495
- const e = new Image();
496
- e.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", e.onload = e.onerror = function() {
497
- t(e.height === 1);
494
+ return this.isSupported || (this.isSupported = new Promise(function(e) {
495
+ const t = new Image();
496
+ t.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", t.onload = t.onerror = function() {
497
+ e(t.height === 1);
498
498
  };
499
499
  })), this.isSupported;
500
500
  }
501
501
  }
502
- class Gt {
503
- constructor(t) {
504
- this.parser = t, this.name = w.EXT_TEXTURE_AVIF, this.isSupported = null;
502
+ class vt {
503
+ constructor(e) {
504
+ this.parser = e, this.name = E.EXT_TEXTURE_AVIF, this.isSupported = null;
505
505
  }
506
- loadTexture(t) {
507
- const e = this.name, i = this.parser, n = i.json, r = n.textures[t];
508
- if (!r.extensions || !r.extensions[e])
506
+ loadTexture(e) {
507
+ const t = this.name, o = this.parser, n = o.json, r = n.textures[e];
508
+ if (!r.extensions || !r.extensions[t])
509
509
  return null;
510
- const s = r.extensions[e], a = n.images[s.source];
511
- let o = i.textureLoader;
510
+ const s = r.extensions[t], a = n.images[s.source];
511
+ let i = o.textureLoader;
512
512
  if (a.uri) {
513
- const c = i.options.manager.getHandler(a.uri);
514
- c !== null && (o = c);
513
+ const c = o.options.manager.getHandler(a.uri);
514
+ c !== null && (i = c);
515
515
  }
516
516
  return this.detectSupport().then(function(c) {
517
- if (c) return i.loadTextureImage(t, s.source, o);
518
- if (n.extensionsRequired && n.extensionsRequired.indexOf(e) >= 0)
517
+ if (c) return o.loadTextureImage(e, s.source, i);
518
+ if (n.extensionsRequired && n.extensionsRequired.indexOf(t) >= 0)
519
519
  throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");
520
- return i.loadTexture(t);
520
+ return o.loadTexture(e);
521
521
  });
522
522
  }
523
523
  detectSupport() {
524
- return this.isSupported || (this.isSupported = new Promise(function(t) {
525
- const e = new Image();
526
- e.src = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=", e.onload = e.onerror = function() {
527
- t(e.height === 1);
524
+ return this.isSupported || (this.isSupported = new Promise(function(e) {
525
+ const t = new Image();
526
+ t.src = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=", t.onload = t.onerror = function() {
527
+ e(t.height === 1);
528
528
  };
529
529
  })), this.isSupported;
530
530
  }
531
531
  }
532
532
  class Bt {
533
- constructor(t) {
534
- this.name = w.EXT_MESHOPT_COMPRESSION, this.parser = t;
533
+ constructor(e) {
534
+ this.name = E.EXT_MESHOPT_COMPRESSION, this.parser = e;
535
535
  }
536
- loadBufferView(t) {
537
- const e = this.parser.json, i = e.bufferViews[t];
538
- if (i.extensions && i.extensions[this.name]) {
539
- const n = i.extensions[this.name], r = this.parser.getDependency("buffer", n.buffer), s = this.parser.options.meshoptDecoder;
536
+ loadBufferView(e) {
537
+ const t = this.parser.json, o = t.bufferViews[e];
538
+ if (o.extensions && o.extensions[this.name]) {
539
+ const n = o.extensions[this.name], r = this.parser.getDependency("buffer", n.buffer), s = this.parser.options.meshoptDecoder;
540
540
  if (!s || !s.supported) {
541
- if (e.extensionsRequired && e.extensionsRequired.indexOf(this.name) >= 0)
541
+ if (t.extensionsRequired && t.extensionsRequired.indexOf(this.name) >= 0)
542
542
  throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
543
543
  return null;
544
544
  }
545
545
  return r.then(function(a) {
546
- const o = n.byteOffset || 0, c = n.byteLength || 0, l = n.count, u = n.byteStride, p = new Uint8Array(a, o, c);
547
- return s.decodeGltfBufferAsync ? s.decodeGltfBufferAsync(l, u, p, n.mode, n.filter).then(function(A) {
548
- return A.buffer;
546
+ const i = n.byteOffset || 0, c = n.byteLength || 0, l = n.count, u = n.byteStride, f = new Uint8Array(a, i, c);
547
+ return s.decodeGltfBufferAsync ? s.decodeGltfBufferAsync(l, u, f, n.mode, n.filter).then(function(m) {
548
+ return m.buffer;
549
549
  }) : s.ready.then(function() {
550
- const A = new ArrayBuffer(l * u);
551
- return s.decodeGltfBuffer(new Uint8Array(A), l, u, p, n.mode, n.filter), A;
550
+ const m = new ArrayBuffer(l * u);
551
+ return s.decodeGltfBuffer(new Uint8Array(m), l, u, f, n.mode, n.filter), m;
552
552
  });
553
553
  });
554
554
  } else
555
555
  return null;
556
556
  }
557
557
  }
558
- class Ut {
559
- constructor(t) {
560
- this.name = w.EXT_MESH_GPU_INSTANCING, this.parser = t;
558
+ class jt {
559
+ constructor(e) {
560
+ this.name = E.EXT_MESH_GPU_INSTANCING, this.parser = e;
561
561
  }
562
- createNodeMesh(t) {
563
- const e = this.parser.json, i = e.nodes[t];
564
- if (!i.extensions || !i.extensions[this.name] || i.mesh === void 0)
562
+ createNodeMesh(e) {
563
+ const t = this.parser.json, o = t.nodes[e];
564
+ if (!o.extensions || !o.extensions[this.name] || o.mesh === void 0)
565
565
  return null;
566
- const n = e.meshes[i.mesh];
566
+ const n = t.meshes[o.mesh];
567
567
  for (const c of n.primitives)
568
568
  if (c.mode !== I.TRIANGLES && c.mode !== I.TRIANGLE_STRIP && c.mode !== I.TRIANGLE_FAN && c.mode !== void 0)
569
569
  return null;
570
- const s = i.extensions[this.name].attributes, a = [], o = {};
570
+ const s = o.extensions[this.name].attributes, a = [], i = {};
571
571
  for (const c in s)
572
- a.push(this.parser.getDependency("accessor", s[c]).then((l) => (o[c] = l, o[c])));
573
- return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(t)), Promise.all(a).then((c) => {
574
- const l = c.pop(), u = l.isGroup ? l.children : [l], p = c[0].count, A = [];
575
- for (const x of u) {
576
- const _ = new q(), T = new B(), R = new _e(), y = new B(1, 1, 1), L = new Ve(x.geometry, x.material, p);
577
- for (let S = 0; S < p; S++)
578
- o.TRANSLATION && T.fromBufferAttribute(o.TRANSLATION, S), o.ROTATION && R.fromBufferAttribute(o.ROTATION, S), o.SCALE && y.fromBufferAttribute(o.SCALE, S), L.setMatrixAt(S, _.compose(T, R, y));
579
- for (const S in o)
580
- if (S === "_COLOR_0") {
581
- const b = o[S];
582
- L.instanceColor = new Xe(b.array, b.itemSize, b.normalized);
583
- } else S !== "TRANSLATION" && S !== "ROTATION" && S !== "SCALE" && x.geometry.setAttribute(S, o[S]);
584
- ie.prototype.copy.call(L, x), this.parser.assignFinalMaterial(L), A.push(L);
572
+ a.push(this.parser.getDependency("accessor", s[c]).then((l) => (i[c] = l, i[c])));
573
+ return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((c) => {
574
+ const l = c.pop(), u = l.isGroup ? l.children : [l], f = c[0].count, m = [];
575
+ for (const T of u) {
576
+ const _ = new q(), x = new v(), R = new Le(), S = new v(1, 1, 1), L = new Xe(T.geometry, T.material, f);
577
+ for (let y = 0; y < f; y++)
578
+ i.TRANSLATION && x.fromBufferAttribute(i.TRANSLATION, y), i.ROTATION && R.fromBufferAttribute(i.ROTATION, y), i.SCALE && S.fromBufferAttribute(i.SCALE, y), L.setMatrixAt(y, _.compose(x, R, S));
579
+ for (const y in i)
580
+ if (y === "_COLOR_0") {
581
+ const M = i[y];
582
+ L.instanceColor = new We(M.array, M.itemSize, M.normalized);
583
+ } else y !== "TRANSLATION" && y !== "ROTATION" && y !== "SCALE" && T.geometry.setAttribute(y, i[y]);
584
+ ae.prototype.copy.call(L, T), this.parser.assignFinalMaterial(L), m.push(L);
585
585
  }
586
- return l.isGroup ? (l.clear(), l.add(...A), l) : A[0];
586
+ return l.isGroup ? (l.clear(), l.add(...m), l) : m[0];
587
587
  }));
588
588
  }
589
589
  }
590
- const De = "glTF", j = 12, Ae = { JSON: 1313821514, BIN: 5130562 };
591
- class jt {
592
- constructor(t) {
593
- this.name = w.KHR_BINARY_GLTF, this.content = null, this.body = null;
594
- const e = new DataView(t, 0, j), i = new TextDecoder();
590
+ const Fe = "glTF", K = 12, Re = { JSON: 1313821514, BIN: 5130562 };
591
+ class Kt {
592
+ constructor(e) {
593
+ this.name = E.KHR_BINARY_GLTF, this.content = null, this.body = null;
594
+ const t = new DataView(e, 0, K), o = new TextDecoder();
595
595
  if (this.header = {
596
- magic: i.decode(new Uint8Array(t.slice(0, 4))),
597
- version: e.getUint32(4, !0),
598
- length: e.getUint32(8, !0)
599
- }, this.header.magic !== De)
596
+ magic: o.decode(new Uint8Array(e.slice(0, 4))),
597
+ version: t.getUint32(4, !0),
598
+ length: t.getUint32(8, !0)
599
+ }, this.header.magic !== Fe)
600
600
  throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
601
601
  if (this.header.version < 2)
602
602
  throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
603
- const n = this.header.length - j, r = new DataView(t, j);
603
+ const n = this.header.length - K, r = new DataView(e, K);
604
604
  let s = 0;
605
605
  for (; s < n; ) {
606
606
  const a = r.getUint32(s, !0);
607
607
  s += 4;
608
- const o = r.getUint32(s, !0);
609
- if (s += 4, o === Ae.JSON) {
610
- const c = new Uint8Array(t, j + s, a);
611
- this.content = i.decode(c);
612
- } else if (o === Ae.BIN) {
613
- const c = j + s;
614
- this.body = t.slice(c, c + a);
608
+ const i = r.getUint32(s, !0);
609
+ if (s += 4, i === Re.JSON) {
610
+ const c = new Uint8Array(e, K + s, a);
611
+ this.content = o.decode(c);
612
+ } else if (i === Re.BIN) {
613
+ const c = K + s;
614
+ this.body = e.slice(c, c + a);
615
615
  }
616
616
  s += a;
617
617
  }
@@ -619,75 +619,75 @@ class jt {
619
619
  throw new Error("THREE.GLTFLoader: JSON content not found.");
620
620
  }
621
621
  }
622
- class Kt {
623
- constructor(t, e) {
624
- if (!e)
622
+ class Vt {
623
+ constructor(e, t) {
624
+ if (!t)
625
625
  throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
626
- this.name = w.KHR_DRACO_MESH_COMPRESSION, this.json = t, this.dracoLoader = e, this.dracoLoader.preload();
626
+ this.name = E.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
627
627
  }
628
- decodePrimitive(t, e) {
629
- const i = this.json, n = this.dracoLoader, r = t.extensions[this.name].bufferView, s = t.extensions[this.name].attributes, a = {}, o = {}, c = {};
628
+ decodePrimitive(e, t) {
629
+ const o = this.json, n = this.dracoLoader, r = e.extensions[this.name].bufferView, s = e.extensions[this.name].attributes, a = {}, i = {}, c = {};
630
630
  for (const l in s) {
631
- const u = se[l] || l.toLowerCase();
631
+ const u = re[l] || l.toLowerCase();
632
632
  a[u] = s[l];
633
633
  }
634
- for (const l in t.attributes) {
635
- const u = se[l] || l.toLowerCase();
634
+ for (const l in e.attributes) {
635
+ const u = re[l] || l.toLowerCase();
636
636
  if (s[l] !== void 0) {
637
- const p = i.accessors[t.attributes[l]], A = U[p.componentType];
638
- c[u] = A.name, o[u] = p.normalized === !0;
637
+ const f = o.accessors[e.attributes[l]], m = B[f.componentType];
638
+ c[u] = m.name, i[u] = f.normalized === !0;
639
639
  }
640
640
  }
641
- return e.getDependency("bufferView", r).then(function(l) {
642
- return new Promise(function(u, p) {
643
- n.decodeDracoFile(l, function(A) {
644
- for (const x in A.attributes) {
645
- const _ = A.attributes[x], T = o[x];
646
- T !== void 0 && (_.normalized = T);
641
+ return t.getDependency("bufferView", r).then(function(l) {
642
+ return new Promise(function(u, f) {
643
+ n.decodeDracoFile(l, function(m) {
644
+ for (const T in m.attributes) {
645
+ const _ = m.attributes[T], x = i[T];
646
+ x !== void 0 && (_.normalized = x);
647
647
  }
648
- u(A);
649
- }, a, c, O, p);
648
+ u(m);
649
+ }, a, c, O, f);
650
650
  });
651
651
  });
652
652
  }
653
653
  }
654
- class Vt {
654
+ class Xt {
655
655
  constructor() {
656
- this.name = w.KHR_TEXTURE_TRANSFORM;
656
+ this.name = E.KHR_TEXTURE_TRANSFORM;
657
657
  }
658
- extendTexture(t, e) {
659
- return (e.texCoord === void 0 || e.texCoord === t.channel) && e.offset === void 0 && e.rotation === void 0 && e.scale === void 0 || (t = t.clone(), e.texCoord !== void 0 && (t.channel = e.texCoord), e.offset !== void 0 && t.offset.fromArray(e.offset), e.rotation !== void 0 && (t.rotation = e.rotation), e.scale !== void 0 && t.repeat.fromArray(e.scale), t.needsUpdate = !0), t;
658
+ extendTexture(e, t) {
659
+ 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;
660
660
  }
661
661
  }
662
- class Xt {
662
+ class Wt {
663
663
  constructor() {
664
- this.name = w.KHR_MESH_QUANTIZATION;
664
+ this.name = E.KHR_MESH_QUANTIZATION;
665
665
  }
666
666
  }
667
- class Pe extends gt {
668
- constructor(t, e, i, n) {
669
- super(t, e, i, n);
667
+ class Pe extends At {
668
+ constructor(e, t, o, n) {
669
+ super(e, t, o, n);
670
670
  }
671
- copySampleValue_(t) {
672
- const e = this.resultBuffer, i = this.sampleValues, n = this.valueSize, r = t * n * 3 + n;
671
+ copySampleValue_(e) {
672
+ const t = this.resultBuffer, o = this.sampleValues, n = this.valueSize, r = e * n * 3 + n;
673
673
  for (let s = 0; s !== n; s++)
674
- e[s] = i[r + s];
675
- return e;
676
- }
677
- interpolate_(t, e, i, n) {
678
- const r = this.resultBuffer, s = this.sampleValues, a = this.valueSize, o = a * 2, c = a * 3, l = n - e, u = (i - e) / l, p = u * u, A = p * u, x = t * c, _ = x - c, T = -2 * A + 3 * p, R = A - p, y = 1 - T, L = R - p + u;
679
- for (let S = 0; S !== a; S++) {
680
- const b = s[_ + S + a], N = s[_ + S + o] * l, M = s[x + S + a], f = s[x + S] * l;
681
- r[S] = y * b + L * N + T * M + R * f;
674
+ t[s] = o[r + s];
675
+ return t;
676
+ }
677
+ interpolate_(e, t, o, n) {
678
+ const r = this.resultBuffer, s = this.sampleValues, a = this.valueSize, i = a * 2, c = a * 3, l = n - t, u = (o - t) / l, f = u * u, m = f * u, T = e * c, _ = T - c, x = -2 * m + 3 * f, R = m - f, S = 1 - x, L = R - f + u;
679
+ for (let y = 0; y !== a; y++) {
680
+ const M = s[_ + y + a], N = s[_ + y + i] * l, b = s[T + y + a], d = s[T + y] * l;
681
+ r[y] = S * M + L * N + x * b + R * d;
682
682
  }
683
683
  return r;
684
684
  }
685
685
  }
686
- const Wt = new _e();
687
- class zt extends Pe {
688
- interpolate_(t, e, i, n) {
689
- const r = super.interpolate_(t, e, i, n);
690
- return Wt.fromArray(r).normalize().toArray(r), r;
686
+ const zt = new Le();
687
+ class qt extends Pe {
688
+ interpolate_(e, t, o, n) {
689
+ const r = super.interpolate_(e, t, o, n);
690
+ return zt.fromArray(r).normalize().toArray(r), r;
691
691
  }
692
692
  }
693
693
  const I = {
@@ -698,23 +698,23 @@ const I = {
698
698
  TRIANGLES: 4,
699
699
  TRIANGLE_STRIP: 5,
700
700
  TRIANGLE_FAN: 6
701
- }, U = {
701
+ }, B = {
702
702
  5120: Int8Array,
703
703
  5121: Uint8Array,
704
704
  5122: Int16Array,
705
705
  5123: Uint16Array,
706
706
  5125: Uint32Array,
707
707
  5126: Float32Array
708
- }, Te = {
709
- 9728: Ze,
710
- 9729: Me,
711
- 9984: Je,
708
+ }, ye = {
709
+ 9728: $e,
710
+ 9729: Ne,
711
+ 9984: Ze,
712
712
  9985: Qe,
713
- 9986: Ye,
714
- 9987: Le
715
- }, xe = {
716
- 33071: Ne,
717
- 33648: be,
713
+ 9986: Je,
714
+ 9987: Me
715
+ }, we = {
716
+ 33071: Ce,
717
+ 33648: Ie,
718
718
  10497: Y
719
719
  }, $ = {
720
720
  SCALAR: 1,
@@ -724,7 +724,7 @@ const I = {
724
724
  MAT2: 4,
725
725
  MAT3: 9,
726
726
  MAT4: 16
727
- }, se = {
727
+ }, re = {
728
728
  POSITION: "position",
729
729
  NORMAL: "normal",
730
730
  TANGENT: "tangent",
@@ -740,98 +740,98 @@ const I = {
740
740
  translation: "position",
741
741
  rotation: "quaternion",
742
742
  weights: "morphTargetInfluences"
743
- }, qt = {
743
+ }, Yt = {
744
744
  CUBICSPLINE: void 0,
745
745
  // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
746
746
  // keyframe track will be initialized with a default interpolation type, then modified.
747
- LINEAR: Fe,
748
- STEP: pt
747
+ LINEAR: De,
748
+ STEP: mt
749
749
  }, ee = {
750
750
  OPAQUE: "OPAQUE",
751
751
  MASK: "MASK",
752
752
  BLEND: "BLEND"
753
753
  };
754
- function Yt(d) {
755
- return d.DefaultMaterial === void 0 && (d.DefaultMaterial = new Ie({
754
+ function Jt(h) {
755
+ return h.DefaultMaterial === void 0 && (h.DefaultMaterial = new Oe({
756
756
  color: 16777215,
757
757
  emissive: 0,
758
758
  metalness: 1,
759
759
  roughness: 1,
760
760
  transparent: !1,
761
761
  depthTest: !0,
762
- side: mt
763
- })), d.DefaultMaterial;
762
+ side: gt
763
+ })), h.DefaultMaterial;
764
764
  }
765
- function H(d, t, e) {
766
- for (const i in e.extensions)
767
- d[i] === void 0 && (t.userData.gltfExtensions = t.userData.gltfExtensions || {}, t.userData.gltfExtensions[i] = e.extensions[i]);
765
+ function G(h, e, t) {
766
+ for (const o in t.extensions)
767
+ h[o] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[o] = t.extensions[o]);
768
768
  }
769
- function D(d, t) {
770
- t.extras !== void 0 && (typeof t.extras == "object" ? Object.assign(d.userData, t.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + t.extras));
769
+ function P(h, e) {
770
+ e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(h.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
771
771
  }
772
- function Qt(d, t, e) {
773
- let i = !1, n = !1, r = !1;
774
- for (let c = 0, l = t.length; c < l; c++) {
775
- const u = t[c];
776
- if (u.POSITION !== void 0 && (i = !0), u.NORMAL !== void 0 && (n = !0), u.COLOR_0 !== void 0 && (r = !0), i && n && r) break;
777
- }
778
- if (!i && !n && !r) return Promise.resolve(d);
779
- const s = [], a = [], o = [];
780
- for (let c = 0, l = t.length; c < l; c++) {
781
- const u = t[c];
782
- if (i) {
783
- const p = u.POSITION !== void 0 ? e.getDependency("accessor", u.POSITION) : d.attributes.position;
784
- s.push(p);
772
+ function Qt(h, e, t) {
773
+ let o = !1, n = !1, r = !1;
774
+ for (let c = 0, l = e.length; c < l; c++) {
775
+ const u = e[c];
776
+ if (u.POSITION !== void 0 && (o = !0), u.NORMAL !== void 0 && (n = !0), u.COLOR_0 !== void 0 && (r = !0), o && n && r) break;
777
+ }
778
+ if (!o && !n && !r) return Promise.resolve(h);
779
+ const s = [], a = [], i = [];
780
+ for (let c = 0, l = e.length; c < l; c++) {
781
+ const u = e[c];
782
+ if (o) {
783
+ const f = u.POSITION !== void 0 ? t.getDependency("accessor", u.POSITION) : h.attributes.position;
784
+ s.push(f);
785
785
  }
786
786
  if (n) {
787
- const p = u.NORMAL !== void 0 ? e.getDependency("accessor", u.NORMAL) : d.attributes.normal;
788
- a.push(p);
787
+ const f = u.NORMAL !== void 0 ? t.getDependency("accessor", u.NORMAL) : h.attributes.normal;
788
+ a.push(f);
789
789
  }
790
790
  if (r) {
791
- const p = u.COLOR_0 !== void 0 ? e.getDependency("accessor", u.COLOR_0) : d.attributes.color;
792
- o.push(p);
791
+ const f = u.COLOR_0 !== void 0 ? t.getDependency("accessor", u.COLOR_0) : h.attributes.color;
792
+ i.push(f);
793
793
  }
794
794
  }
795
795
  return Promise.all([
796
796
  Promise.all(s),
797
797
  Promise.all(a),
798
- Promise.all(o)
798
+ Promise.all(i)
799
799
  ]).then(function(c) {
800
- const l = c[0], u = c[1], p = c[2];
801
- return i && (d.morphAttributes.position = l), n && (d.morphAttributes.normal = u), r && (d.morphAttributes.color = p), d.morphTargetsRelative = !0, d;
800
+ const l = c[0], u = c[1], f = c[2];
801
+ return o && (h.morphAttributes.position = l), n && (h.morphAttributes.normal = u), r && (h.morphAttributes.color = f), h.morphTargetsRelative = !0, h;
802
802
  });
803
803
  }
804
- function Jt(d, t) {
805
- if (d.updateMorphTargets(), t.weights !== void 0)
806
- for (let e = 0, i = t.weights.length; e < i; e++)
807
- d.morphTargetInfluences[e] = t.weights[e];
808
- if (t.extras && Array.isArray(t.extras.targetNames)) {
809
- const e = t.extras.targetNames;
810
- if (d.morphTargetInfluences.length === e.length) {
811
- d.morphTargetDictionary = {};
812
- for (let i = 0, n = e.length; i < n; i++)
813
- d.morphTargetDictionary[e[i]] = i;
804
+ function Zt(h, e) {
805
+ if (h.updateMorphTargets(), e.weights !== void 0)
806
+ for (let t = 0, o = e.weights.length; t < o; t++)
807
+ h.morphTargetInfluences[t] = e.weights[t];
808
+ if (e.extras && Array.isArray(e.extras.targetNames)) {
809
+ const t = e.extras.targetNames;
810
+ if (h.morphTargetInfluences.length === t.length) {
811
+ h.morphTargetDictionary = {};
812
+ for (let o = 0, n = t.length; o < n; o++)
813
+ h.morphTargetDictionary[t[o]] = o;
814
814
  } else
815
815
  console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
816
816
  }
817
817
  }
818
- function Zt(d) {
819
- let t;
820
- const e = d.extensions && d.extensions[w.KHR_DRACO_MESH_COMPRESSION];
821
- if (e ? t = "draco:" + e.bufferView + ":" + e.indices + ":" + te(e.attributes) : t = d.indices + ":" + te(d.attributes) + ":" + d.mode, d.targets !== void 0)
822
- for (let i = 0, n = d.targets.length; i < n; i++)
823
- t += ":" + te(d.targets[i]);
824
- return t;
818
+ function $t(h) {
819
+ let e;
820
+ const t = h.extensions && h.extensions[E.KHR_DRACO_MESH_COMPRESSION];
821
+ if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + te(t.attributes) : e = h.indices + ":" + te(h.attributes) + ":" + h.mode, h.targets !== void 0)
822
+ for (let o = 0, n = h.targets.length; o < n; o++)
823
+ e += ":" + te(h.targets[o]);
824
+ return e;
825
825
  }
826
- function te(d) {
827
- let t = "";
828
- const e = Object.keys(d).sort();
829
- for (let i = 0, n = e.length; i < n; i++)
830
- t += e[i] + ":" + d[e[i]] + ";";
831
- return t;
826
+ function te(h) {
827
+ let e = "";
828
+ const t = Object.keys(h).sort();
829
+ for (let o = 0, n = t.length; o < n; o++)
830
+ e += t[o] + ":" + h[t[o]] + ";";
831
+ return e;
832
832
  }
833
- function re(d) {
834
- switch (d) {
833
+ function oe(h) {
834
+ switch (h) {
835
835
  case Int8Array:
836
836
  return 1 / 127;
837
837
  case Uint8Array:
@@ -844,33 +844,33 @@ function re(d) {
844
844
  throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
845
845
  }
846
846
  }
847
- function $t(d) {
848
- return d.search(/\.jpe?g($|\?)/i) > 0 || d.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : d.search(/\.webp($|\?)/i) > 0 || d.search(/^data\:image\/webp/) === 0 ? "image/webp" : "image/png";
847
+ function en(h) {
848
+ return h.search(/\.jpe?g($|\?)/i) > 0 || h.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : h.search(/\.webp($|\?)/i) > 0 || h.search(/^data\:image\/webp/) === 0 ? "image/webp" : "image/png";
849
849
  }
850
- const en = new q();
851
- class tn {
852
- constructor(t = {}, e = {}) {
853
- this.json = t, this.extensions = {}, this.plugins = {}, this.options = e, this.cache = new _t(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.nodeCache = {}, this.meshCache = { refs: {}, uses: {} }, this.cameraCache = { refs: {}, uses: {} }, this.lightCache = { refs: {}, uses: {} }, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
854
- let i = !1, n = !1, r = -1;
855
- typeof navigator < "u" && (i = /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === !0, n = navigator.userAgent.indexOf("Firefox") > -1, r = n ? navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1] : -1), typeof createImageBitmap > "u" || i || n && r < 98 ? this.textureLoader = new ye(this.options.manager) : this.textureLoader = new We(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new W(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
850
+ const tn = new q();
851
+ class nn {
852
+ constructor(e = {}, t = {}) {
853
+ this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new St(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.nodeCache = {}, this.meshCache = { refs: {}, uses: {} }, this.cameraCache = { refs: {}, uses: {} }, this.lightCache = { refs: {}, uses: {} }, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
854
+ let o = !1, n = !1, r = -1;
855
+ typeof navigator < "u" && (o = /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === !0, n = navigator.userAgent.indexOf("Firefox") > -1, r = n ? navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1] : -1), typeof createImageBitmap > "u" || o || n && r < 98 ? this.textureLoader = new be(this.options.manager) : this.textureLoader = new ze(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new j(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
856
856
  }
857
- setExtensions(t) {
858
- this.extensions = t;
857
+ setExtensions(e) {
858
+ this.extensions = e;
859
859
  }
860
- setPlugins(t) {
861
- this.plugins = t;
860
+ setPlugins(e) {
861
+ this.plugins = e;
862
862
  }
863
- parse(t, e) {
864
- const i = this, n = this.json, r = this.extensions;
863
+ parse(e, t) {
864
+ const o = this, n = this.json, r = this.extensions;
865
865
  this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(s) {
866
866
  return s._markDefs && s._markDefs();
867
867
  }), Promise.all(this._invokeAll(function(s) {
868
868
  return s.beforeRoot && s.beforeRoot();
869
869
  })).then(function() {
870
870
  return Promise.all([
871
- i.getDependencies("scene"),
872
- i.getDependencies("animation"),
873
- i.getDependencies("camera")
871
+ o.getDependencies("scene"),
872
+ o.getDependencies("animation"),
873
+ o.getDependencies("camera")
874
874
  ]);
875
875
  }).then(function(s) {
876
876
  const a = {
@@ -879,31 +879,31 @@ class tn {
879
879
  animations: s[1],
880
880
  cameras: s[2],
881
881
  asset: n.asset,
882
- parser: i,
882
+ parser: o,
883
883
  userData: {}
884
884
  };
885
- return H(r, a, n), D(a, n), Promise.all(i._invokeAll(function(o) {
886
- return o.afterRoot && o.afterRoot(a);
885
+ return G(r, a, n), P(a, n), Promise.all(o._invokeAll(function(i) {
886
+ return i.afterRoot && i.afterRoot(a);
887
887
  })).then(function() {
888
- for (const o of a.scenes)
889
- o.updateMatrixWorld();
890
- t(a);
888
+ for (const i of a.scenes)
889
+ i.updateMatrixWorld();
890
+ e(a);
891
891
  });
892
- }).catch(e);
892
+ }).catch(t);
893
893
  }
894
894
  /**
895
895
  * Marks the special nodes/meshes in json for efficient parse.
896
896
  */
897
897
  _markDefs() {
898
- const t = this.json.nodes || [], e = this.json.skins || [], i = this.json.meshes || [];
899
- for (let n = 0, r = e.length; n < r; n++) {
900
- const s = e[n].joints;
901
- for (let a = 0, o = s.length; a < o; a++)
902
- t[s[a]].isBone = !0;
903
- }
898
+ const e = this.json.nodes || [], t = this.json.skins || [], o = this.json.meshes || [];
904
899
  for (let n = 0, r = t.length; n < r; n++) {
905
- const s = t[n];
906
- s.mesh !== void 0 && (this._addNodeRef(this.meshCache, s.mesh), s.skin !== void 0 && (i[s.mesh].isSkinnedMesh = !0)), s.camera !== void 0 && this._addNodeRef(this.cameraCache, s.camera);
900
+ const s = t[n].joints;
901
+ for (let a = 0, i = s.length; a < i; a++)
902
+ e[s[a]].isBone = !0;
903
+ }
904
+ for (let n = 0, r = e.length; n < r; n++) {
905
+ const s = e[n];
906
+ s.mesh !== void 0 && (this._addNodeRef(this.meshCache, s.mesh), s.skin !== void 0 && (o[s.mesh].isSkinnedMesh = !0)), s.camera !== void 0 && this._addNodeRef(this.cameraCache, s.camera);
907
907
  }
908
908
  }
909
909
  /**
@@ -915,38 +915,38 @@ class tn {
915
915
  *
916
916
  * Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
917
917
  */
918
- _addNodeRef(t, e) {
919
- e !== void 0 && (t.refs[e] === void 0 && (t.refs[e] = t.uses[e] = 0), t.refs[e]++);
918
+ _addNodeRef(e, t) {
919
+ t !== void 0 && (e.refs[t] === void 0 && (e.refs[t] = e.uses[t] = 0), e.refs[t]++);
920
920
  }
921
921
  /** Returns a reference to a shared resource, cloning it if necessary. */
922
- _getNodeRef(t, e, i) {
923
- if (t.refs[e] <= 1) return i;
924
- const n = i.clone(), r = (s, a) => {
925
- const o = this.associations.get(s);
926
- o != null && this.associations.set(a, o);
922
+ _getNodeRef(e, t, o) {
923
+ if (e.refs[t] <= 1) return o;
924
+ const n = o.clone(), r = (s, a) => {
925
+ const i = this.associations.get(s);
926
+ i != null && this.associations.set(a, i);
927
927
  for (const [c, l] of s.children.entries())
928
928
  r(l, a.children[c]);
929
929
  };
930
- return r(i, n), n.name += "_instance_" + t.uses[e]++, n;
930
+ return r(o, n), n.name += "_instance_" + e.uses[t]++, n;
931
931
  }
932
- _invokeOne(t) {
933
- const e = Object.values(this.plugins);
934
- e.push(this);
935
- for (let i = 0; i < e.length; i++) {
936
- const n = t(e[i]);
932
+ _invokeOne(e) {
933
+ const t = Object.values(this.plugins);
934
+ t.push(this);
935
+ for (let o = 0; o < t.length; o++) {
936
+ const n = e(t[o]);
937
937
  if (n) return n;
938
938
  }
939
939
  return null;
940
940
  }
941
- _invokeAll(t) {
942
- const e = Object.values(this.plugins);
943
- e.unshift(this);
944
- const i = [];
945
- for (let n = 0; n < e.length; n++) {
946
- const r = t(e[n]);
947
- r && i.push(r);
941
+ _invokeAll(e) {
942
+ const t = Object.values(this.plugins);
943
+ t.unshift(this);
944
+ const o = [];
945
+ for (let n = 0; n < t.length; n++) {
946
+ const r = e(t[n]);
947
+ r && o.push(r);
948
948
  }
949
- return i;
949
+ return o;
950
950
  }
951
951
  /**
952
952
  * Requests the specified dependency asynchronously, with caching.
@@ -954,64 +954,64 @@ class tn {
954
954
  * @param {number} index
955
955
  * @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
956
956
  */
957
- getDependency(t, e) {
958
- const i = t + ":" + e;
959
- let n = this.cache.get(i);
957
+ getDependency(e, t) {
958
+ const o = e + ":" + t;
959
+ let n = this.cache.get(o);
960
960
  if (!n) {
961
- switch (t) {
961
+ switch (e) {
962
962
  case "scene":
963
- n = this.loadScene(e);
963
+ n = this.loadScene(t);
964
964
  break;
965
965
  case "node":
966
966
  n = this._invokeOne(function(r) {
967
- return r.loadNode && r.loadNode(e);
967
+ return r.loadNode && r.loadNode(t);
968
968
  });
969
969
  break;
970
970
  case "mesh":
971
971
  n = this._invokeOne(function(r) {
972
- return r.loadMesh && r.loadMesh(e);
972
+ return r.loadMesh && r.loadMesh(t);
973
973
  });
974
974
  break;
975
975
  case "accessor":
976
- n = this.loadAccessor(e);
976
+ n = this.loadAccessor(t);
977
977
  break;
978
978
  case "bufferView":
979
979
  n = this._invokeOne(function(r) {
980
- return r.loadBufferView && r.loadBufferView(e);
980
+ return r.loadBufferView && r.loadBufferView(t);
981
981
  });
982
982
  break;
983
983
  case "buffer":
984
- n = this.loadBuffer(e);
984
+ n = this.loadBuffer(t);
985
985
  break;
986
986
  case "material":
987
987
  n = this._invokeOne(function(r) {
988
- return r.loadMaterial && r.loadMaterial(e);
988
+ return r.loadMaterial && r.loadMaterial(t);
989
989
  });
990
990
  break;
991
991
  case "texture":
992
992
  n = this._invokeOne(function(r) {
993
- return r.loadTexture && r.loadTexture(e);
993
+ return r.loadTexture && r.loadTexture(t);
994
994
  });
995
995
  break;
996
996
  case "skin":
997
- n = this.loadSkin(e);
997
+ n = this.loadSkin(t);
998
998
  break;
999
999
  case "animation":
1000
1000
  n = this._invokeOne(function(r) {
1001
- return r.loadAnimation && r.loadAnimation(e);
1001
+ return r.loadAnimation && r.loadAnimation(t);
1002
1002
  });
1003
1003
  break;
1004
1004
  case "camera":
1005
- n = this.loadCamera(e);
1005
+ n = this.loadCamera(t);
1006
1006
  break;
1007
1007
  default:
1008
1008
  if (n = this._invokeOne(function(r) {
1009
- return r != this && r.getDependency && r.getDependency(t, e);
1009
+ return r != this && r.getDependency && r.getDependency(e, t);
1010
1010
  }), !n)
1011
- throw new Error("Unknown type: " + t);
1011
+ throw new Error("Unknown type: " + e);
1012
1012
  break;
1013
1013
  }
1014
- this.cache.add(i, n);
1014
+ this.cache.add(o, n);
1015
1015
  }
1016
1016
  return n;
1017
1017
  }
@@ -1020,31 +1020,31 @@ class tn {
1020
1020
  * @param {string} type
1021
1021
  * @return {Promise<Array<Object>>}
1022
1022
  */
1023
- getDependencies(t) {
1024
- let e = this.cache.get(t);
1025
- if (!e) {
1026
- const i = this, n = this.json[t + (t === "mesh" ? "es" : "s")] || [];
1027
- e = Promise.all(n.map(function(r, s) {
1028
- return i.getDependency(t, s);
1029
- })), this.cache.add(t, e);
1023
+ getDependencies(e) {
1024
+ let t = this.cache.get(e);
1025
+ if (!t) {
1026
+ const o = this, n = this.json[e + (e === "mesh" ? "es" : "s")] || [];
1027
+ t = Promise.all(n.map(function(r, s) {
1028
+ return o.getDependency(e, s);
1029
+ })), this.cache.add(e, t);
1030
1030
  }
1031
- return e;
1031
+ return t;
1032
1032
  }
1033
1033
  /**
1034
1034
  * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
1035
1035
  * @param {number} bufferIndex
1036
1036
  * @return {Promise<ArrayBuffer>}
1037
1037
  */
1038
- loadBuffer(t) {
1039
- const e = this.json.buffers[t], i = this.fileLoader;
1040
- if (e.type && e.type !== "arraybuffer")
1041
- throw new Error("THREE.GLTFLoader: " + e.type + " buffer type is not supported.");
1042
- if (e.uri === void 0 && t === 0)
1043
- return Promise.resolve(this.extensions[w.KHR_BINARY_GLTF].body);
1038
+ loadBuffer(e) {
1039
+ const t = this.json.buffers[e], o = this.fileLoader;
1040
+ if (t.type && t.type !== "arraybuffer")
1041
+ throw new Error("THREE.GLTFLoader: " + t.type + " buffer type is not supported.");
1042
+ if (t.uri === void 0 && e === 0)
1043
+ return Promise.resolve(this.extensions[E.KHR_BINARY_GLTF].body);
1044
1044
  const n = this.options;
1045
1045
  return new Promise(function(r, s) {
1046
- i.load(V.resolveURL(e.uri, n.path), r, void 0, function() {
1047
- s(new Error('THREE.GLTFLoader: Failed to load buffer "' + e.uri + '".'));
1046
+ o.load(X.resolveURL(t.uri, n.path), r, void 0, function() {
1047
+ s(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
1048
1048
  });
1049
1049
  });
1050
1050
  }
@@ -1053,11 +1053,11 @@ class tn {
1053
1053
  * @param {number} bufferViewIndex
1054
1054
  * @return {Promise<ArrayBuffer>}
1055
1055
  */
1056
- loadBufferView(t) {
1057
- const e = this.json.bufferViews[t];
1058
- return this.getDependency("buffer", e.buffer).then(function(i) {
1059
- const n = e.byteLength || 0, r = e.byteOffset || 0;
1060
- return i.slice(r, r + n);
1056
+ loadBufferView(e) {
1057
+ const t = this.json.bufferViews[e];
1058
+ return this.getDependency("buffer", t.buffer).then(function(o) {
1059
+ const n = t.byteLength || 0, r = t.byteOffset || 0;
1060
+ return o.slice(r, r + n);
1061
1061
  });
1062
1062
  }
1063
1063
  /**
@@ -1065,31 +1065,31 @@ class tn {
1065
1065
  * @param {number} accessorIndex
1066
1066
  * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
1067
1067
  */
1068
- loadAccessor(t) {
1069
- const e = this, i = this.json, n = this.json.accessors[t];
1068
+ loadAccessor(e) {
1069
+ const t = this, o = this.json, n = this.json.accessors[e];
1070
1070
  if (n.bufferView === void 0 && n.sparse === void 0) {
1071
- const s = $[n.type], a = U[n.componentType], o = n.normalized === !0, c = new a(n.count * s);
1072
- return Promise.resolve(new v(c, s, o));
1071
+ const s = $[n.type], a = B[n.componentType], i = n.normalized === !0, c = new a(n.count * s);
1072
+ return Promise.resolve(new D(c, s, i));
1073
1073
  }
1074
1074
  const r = [];
1075
1075
  return n.bufferView !== void 0 ? r.push(this.getDependency("bufferView", n.bufferView)) : r.push(null), n.sparse !== void 0 && (r.push(this.getDependency("bufferView", n.sparse.indices.bufferView)), r.push(this.getDependency("bufferView", n.sparse.values.bufferView))), Promise.all(r).then(function(s) {
1076
- const a = s[0], o = $[n.type], c = U[n.componentType], l = c.BYTES_PER_ELEMENT, u = l * o, p = n.byteOffset || 0, A = n.bufferView !== void 0 ? i.bufferViews[n.bufferView].byteStride : void 0, x = n.normalized === !0;
1077
- let _, T;
1078
- if (A && A !== u) {
1079
- const R = Math.floor(p / A), y = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + R + ":" + n.count;
1080
- let L = e.cache.get(y);
1081
- L || (_ = new c(a, R * A, n.count * A / l), L = new ze(_, A / l), e.cache.add(y, L)), T = new qe(L, o, p % A / l, x);
1076
+ const a = s[0], i = $[n.type], c = B[n.componentType], l = c.BYTES_PER_ELEMENT, u = l * i, f = n.byteOffset || 0, m = n.bufferView !== void 0 ? o.bufferViews[n.bufferView].byteStride : void 0, T = n.normalized === !0;
1077
+ let _, x;
1078
+ if (m && m !== u) {
1079
+ const R = Math.floor(f / m), S = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + R + ":" + n.count;
1080
+ let L = t.cache.get(S);
1081
+ L || (_ = new c(a, R * m, n.count * m / l), L = new qe(_, m / l), t.cache.add(S, L)), x = new Ye(L, i, f % m / l, T);
1082
1082
  } else
1083
- a === null ? _ = new c(n.count * o) : _ = new c(a, p, n.count * o), T = new v(_, o, x);
1083
+ a === null ? _ = new c(n.count * i) : _ = new c(a, f, n.count * i), x = new D(_, i, T);
1084
1084
  if (n.sparse !== void 0) {
1085
- const R = $.SCALAR, y = U[n.sparse.indices.componentType], L = n.sparse.indices.byteOffset || 0, S = n.sparse.values.byteOffset || 0, b = new y(s[1], L, n.sparse.count * R), N = new c(s[2], S, n.sparse.count * o);
1086
- a !== null && (T = new v(T.array.slice(), T.itemSize, T.normalized));
1087
- for (let M = 0, f = b.length; M < f; M++) {
1088
- const h = b[M];
1089
- if (T.setX(h, N[M * o]), o >= 2 && T.setY(h, N[M * o + 1]), o >= 3 && T.setZ(h, N[M * o + 2]), o >= 4 && T.setW(h, N[M * o + 3]), o >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
1085
+ const R = $.SCALAR, S = B[n.sparse.indices.componentType], L = n.sparse.indices.byteOffset || 0, y = n.sparse.values.byteOffset || 0, M = new S(s[1], L, n.sparse.count * R), N = new c(s[2], y, n.sparse.count * i);
1086
+ a !== null && (x = new D(x.array.slice(), x.itemSize, x.normalized));
1087
+ for (let b = 0, d = M.length; b < d; b++) {
1088
+ const p = M[b];
1089
+ if (x.setX(p, N[b * i]), i >= 2 && x.setY(p, N[b * i + 1]), i >= 3 && x.setZ(p, N[b * i + 2]), i >= 4 && x.setW(p, N[b * i + 3]), i >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
1090
1090
  }
1091
1091
  }
1092
- return T;
1092
+ return x;
1093
1093
  });
1094
1094
  }
1095
1095
  /**
@@ -1097,56 +1097,56 @@ class tn {
1097
1097
  * @param {number} textureIndex
1098
1098
  * @return {Promise<THREE.Texture|null>}
1099
1099
  */
1100
- loadTexture(t) {
1101
- const e = this.json, i = this.options, r = e.textures[t].source, s = e.images[r];
1100
+ loadTexture(e) {
1101
+ const t = this.json, o = this.options, r = t.textures[e].source, s = t.images[r];
1102
1102
  let a = this.textureLoader;
1103
1103
  if (s.uri) {
1104
- const o = i.manager.getHandler(s.uri);
1105
- o !== null && (a = o);
1104
+ const i = o.manager.getHandler(s.uri);
1105
+ i !== null && (a = i);
1106
1106
  }
1107
- return this.loadTextureImage(t, r, a);
1107
+ return this.loadTextureImage(e, r, a);
1108
1108
  }
1109
- loadTextureImage(t, e, i) {
1110
- const n = this, r = this.json, s = r.textures[t], a = r.images[e], o = (a.uri || a.bufferView) + ":" + s.sampler;
1111
- if (this.textureCache[o])
1112
- return this.textureCache[o];
1113
- const c = this.loadImageSource(e, i).then(function(l) {
1109
+ loadTextureImage(e, t, o) {
1110
+ const n = this, r = this.json, s = r.textures[e], a = r.images[t], i = (a.uri || a.bufferView) + ":" + s.sampler;
1111
+ if (this.textureCache[i])
1112
+ return this.textureCache[i];
1113
+ const c = this.loadImageSource(t, o).then(function(l) {
1114
1114
  l.flipY = !1, l.name = s.name || a.name || "", l.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (l.name = a.uri);
1115
- const p = (r.samplers || {})[s.sampler] || {};
1116
- return l.magFilter = Te[p.magFilter] || Me, l.minFilter = Te[p.minFilter] || Le, l.wrapS = xe[p.wrapS] || Y, l.wrapT = xe[p.wrapT] || Y, n.associations.set(l, { textures: t }), l;
1115
+ const f = (r.samplers || {})[s.sampler] || {};
1116
+ return l.magFilter = ye[f.magFilter] || Ne, l.minFilter = ye[f.minFilter] || Me, l.wrapS = we[f.wrapS] || Y, l.wrapT = we[f.wrapT] || Y, n.associations.set(l, { textures: e }), l;
1117
1117
  }).catch(function() {
1118
1118
  return null;
1119
1119
  });
1120
- return this.textureCache[o] = c, c;
1121
- }
1122
- loadImageSource(t, e) {
1123
- const i = this, n = this.json, r = this.options;
1124
- if (this.sourceCache[t] !== void 0)
1125
- return this.sourceCache[t].then((u) => u.clone());
1126
- const s = n.images[t], a = self.URL || self.webkitURL;
1127
- let o = s.uri || "", c = !1;
1120
+ return this.textureCache[i] = c, c;
1121
+ }
1122
+ loadImageSource(e, t) {
1123
+ const o = this, n = this.json, r = this.options;
1124
+ if (this.sourceCache[e] !== void 0)
1125
+ return this.sourceCache[e].then((u) => u.clone());
1126
+ const s = n.images[e], a = self.URL || self.webkitURL;
1127
+ let i = s.uri || "", c = !1;
1128
1128
  if (s.bufferView !== void 0)
1129
- o = i.getDependency("bufferView", s.bufferView).then(function(u) {
1129
+ i = o.getDependency("bufferView", s.bufferView).then(function(u) {
1130
1130
  c = !0;
1131
- const p = new Blob([u], { type: s.mimeType });
1132
- return o = a.createObjectURL(p), o;
1131
+ const f = new Blob([u], { type: s.mimeType });
1132
+ return i = a.createObjectURL(f), i;
1133
1133
  });
1134
1134
  else if (s.uri === void 0)
1135
- throw new Error("THREE.GLTFLoader: Image " + t + " is missing URI and bufferView");
1136
- const l = Promise.resolve(o).then(function(u) {
1137
- return new Promise(function(p, A) {
1138
- let x = p;
1139
- e.isImageBitmapLoader === !0 && (x = function(_) {
1140
- const T = new ce(_);
1141
- T.needsUpdate = !0, p(T);
1142
- }), e.load(V.resolveURL(u, r.path), x, void 0, A);
1135
+ throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
1136
+ const l = Promise.resolve(i).then(function(u) {
1137
+ return new Promise(function(f, m) {
1138
+ let T = f;
1139
+ t.isImageBitmapLoader === !0 && (T = function(_) {
1140
+ const x = new fe(_);
1141
+ x.needsUpdate = !0, f(x);
1142
+ }), t.load(X.resolveURL(u, r.path), T, void 0, m);
1143
1143
  });
1144
1144
  }).then(function(u) {
1145
- return c === !0 && a.revokeObjectURL(o), u.userData.mimeType = s.mimeType || $t(s.uri), u;
1145
+ return c === !0 && a.revokeObjectURL(i), u.userData.mimeType = s.mimeType || en(s.uri), u;
1146
1146
  }).catch(function(u) {
1147
- throw console.error("THREE.GLTFLoader: Couldn't load texture", o), u;
1147
+ throw console.error("THREE.GLTFLoader: Couldn't load texture", i), u;
1148
1148
  });
1149
- return this.sourceCache[t] = l, l;
1149
+ return this.sourceCache[e] = l, l;
1150
1150
  }
1151
1151
  /**
1152
1152
  * Asynchronously assigns a texture to the given material parameters.
@@ -1155,18 +1155,18 @@ class tn {
1155
1155
  * @param {Object} mapDef
1156
1156
  * @return {Promise<Texture>}
1157
1157
  */
1158
- assignTexture(t, e, i, n) {
1158
+ assignTexture(e, t, o, n) {
1159
1159
  const r = this;
1160
- return this.getDependency("texture", i.index).then(function(s) {
1160
+ return this.getDependency("texture", o.index).then(function(s) {
1161
1161
  if (!s) return null;
1162
- if (i.texCoord !== void 0 && i.texCoord > 0 && (s = s.clone(), s.channel = i.texCoord), r.extensions[w.KHR_TEXTURE_TRANSFORM]) {
1163
- const a = i.extensions !== void 0 ? i.extensions[w.KHR_TEXTURE_TRANSFORM] : void 0;
1162
+ if (o.texCoord !== void 0 && o.texCoord > 0 && (s = s.clone(), s.channel = o.texCoord), r.extensions[E.KHR_TEXTURE_TRANSFORM]) {
1163
+ const a = o.extensions !== void 0 ? o.extensions[E.KHR_TEXTURE_TRANSFORM] : void 0;
1164
1164
  if (a) {
1165
- const o = r.associations.get(s);
1166
- s = r.extensions[w.KHR_TEXTURE_TRANSFORM].extendTexture(s, a), r.associations.set(s, o);
1165
+ const i = r.associations.get(s);
1166
+ s = r.extensions[E.KHR_TEXTURE_TRANSFORM].extendTexture(s, a), r.associations.set(s, i);
1167
1167
  }
1168
1168
  }
1169
- return n !== void 0 && (s.colorSpace = n), t[e] = s, s;
1169
+ return n !== void 0 && (s.colorSpace = n), e[t] = s, s;
1170
1170
  });
1171
1171
  }
1172
1172
  /**
@@ -1177,73 +1177,73 @@ class tn {
1177
1177
  * be created if necessary, and reused from a cache.
1178
1178
  * @param {Object3D} mesh Mesh, Line, or Points instance.
1179
1179
  */
1180
- assignFinalMaterial(t) {
1181
- const e = t.geometry;
1182
- let i = t.material;
1183
- const n = e.attributes.tangent === void 0, r = e.attributes.color !== void 0, s = e.attributes.normal === void 0;
1184
- if (t.isPoints) {
1185
- const a = "PointsMaterial:" + i.uuid;
1186
- let o = this.cache.get(a);
1187
- o || (o = new $e(), Z.prototype.copy.call(o, i), o.color.copy(i.color), o.map = i.map, o.sizeAttenuation = !1, this.cache.add(a, o)), i = o;
1188
- } else if (t.isLine) {
1189
- const a = "LineBasicMaterial:" + i.uuid;
1190
- let o = this.cache.get(a);
1191
- o || (o = new et(), Z.prototype.copy.call(o, i), o.color.copy(i.color), o.map = i.map, this.cache.add(a, o)), i = o;
1180
+ assignFinalMaterial(e) {
1181
+ const t = e.geometry;
1182
+ let o = e.material;
1183
+ const n = t.attributes.tangent === void 0, r = t.attributes.color !== void 0, s = t.attributes.normal === void 0;
1184
+ if (e.isPoints) {
1185
+ const a = "PointsMaterial:" + o.uuid;
1186
+ let i = this.cache.get(a);
1187
+ i || (i = new et(), Z.prototype.copy.call(i, o), i.color.copy(o.color), i.map = o.map, i.sizeAttenuation = !1, this.cache.add(a, i)), o = i;
1188
+ } else if (e.isLine) {
1189
+ const a = "LineBasicMaterial:" + o.uuid;
1190
+ let i = this.cache.get(a);
1191
+ i || (i = new tt(), Z.prototype.copy.call(i, o), i.color.copy(o.color), i.map = o.map, this.cache.add(a, i)), o = i;
1192
1192
  }
1193
1193
  if (n || r || s) {
1194
- let a = "ClonedMaterial:" + i.uuid + ":";
1194
+ let a = "ClonedMaterial:" + o.uuid + ":";
1195
1195
  n && (a += "derivative-tangents:"), r && (a += "vertex-colors:"), s && (a += "flat-shading:");
1196
- let o = this.cache.get(a);
1197
- o || (o = i.clone(), r && (o.vertexColors = !0), s && (o.flatShading = !0), n && (o.normalScale && (o.normalScale.y *= -1), o.clearcoatNormalScale && (o.clearcoatNormalScale.y *= -1)), this.cache.add(a, o), this.associations.set(o, this.associations.get(i))), i = o;
1196
+ let i = this.cache.get(a);
1197
+ i || (i = o.clone(), r && (i.vertexColors = !0), s && (i.flatShading = !0), n && (i.normalScale && (i.normalScale.y *= -1), i.clearcoatNormalScale && (i.clearcoatNormalScale.y *= -1)), this.cache.add(a, i), this.associations.set(i, this.associations.get(o))), o = i;
1198
1198
  }
1199
- t.material = i;
1199
+ e.material = o;
1200
1200
  }
1201
1201
  getMaterialType() {
1202
- return Ie;
1202
+ return Oe;
1203
1203
  }
1204
1204
  /**
1205
1205
  * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
1206
1206
  * @param {number} materialIndex
1207
1207
  * @return {Promise<Material>}
1208
1208
  */
1209
- loadMaterial(t) {
1210
- const e = this, i = this.json, n = this.extensions, r = i.materials[t];
1209
+ loadMaterial(e) {
1210
+ const t = this, o = this.json, n = this.extensions, r = o.materials[e];
1211
1211
  let s;
1212
- const a = {}, o = r.extensions || {}, c = [];
1213
- if (o[w.KHR_MATERIALS_UNLIT]) {
1214
- const u = n[w.KHR_MATERIALS_UNLIT];
1215
- s = u.getMaterialType(), c.push(u.extendParams(a, r, e));
1212
+ const a = {}, i = r.extensions || {}, c = [];
1213
+ if (i[E.KHR_MATERIALS_UNLIT]) {
1214
+ const u = n[E.KHR_MATERIALS_UNLIT];
1215
+ s = u.getMaterialType(), c.push(u.extendParams(a, r, t));
1216
1216
  } else {
1217
1217
  const u = r.pbrMetallicRoughness || {};
1218
- if (a.color = new G(1, 1, 1), a.opacity = 1, Array.isArray(u.baseColorFactor)) {
1219
- const p = u.baseColorFactor;
1220
- a.color.setRGB(p[0], p[1], p[2], O), a.opacity = p[3];
1218
+ if (a.color = new H(1, 1, 1), a.opacity = 1, Array.isArray(u.baseColorFactor)) {
1219
+ const f = u.baseColorFactor;
1220
+ a.color.setRGB(f[0], f[1], f[2], O), a.opacity = f[3];
1221
1221
  }
1222
- u.baseColorTexture !== void 0 && c.push(e.assignTexture(a, "map", u.baseColorTexture, P)), a.metalness = u.metallicFactor !== void 0 ? u.metallicFactor : 1, a.roughness = u.roughnessFactor !== void 0 ? u.roughnessFactor : 1, u.metallicRoughnessTexture !== void 0 && (c.push(e.assignTexture(a, "metalnessMap", u.metallicRoughnessTexture)), c.push(e.assignTexture(a, "roughnessMap", u.metallicRoughnessTexture))), s = this._invokeOne(function(p) {
1223
- return p.getMaterialType && p.getMaterialType(t);
1224
- }), c.push(Promise.all(this._invokeAll(function(p) {
1225
- return p.extendMaterialParams && p.extendMaterialParams(t, a);
1222
+ u.baseColorTexture !== void 0 && c.push(t.assignTexture(a, "map", u.baseColorTexture, C)), a.metalness = u.metallicFactor !== void 0 ? u.metallicFactor : 1, a.roughness = u.roughnessFactor !== void 0 ? u.roughnessFactor : 1, u.metallicRoughnessTexture !== void 0 && (c.push(t.assignTexture(a, "metalnessMap", u.metallicRoughnessTexture)), c.push(t.assignTexture(a, "roughnessMap", u.metallicRoughnessTexture))), s = this._invokeOne(function(f) {
1223
+ return f.getMaterialType && f.getMaterialType(e);
1224
+ }), c.push(Promise.all(this._invokeAll(function(f) {
1225
+ return f.extendMaterialParams && f.extendMaterialParams(e, a);
1226
1226
  })));
1227
1227
  }
1228
- r.doubleSided === !0 && (a.side = tt);
1228
+ r.doubleSided === !0 && (a.side = nt);
1229
1229
  const l = r.alphaMode || ee.OPAQUE;
1230
- if (l === ee.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, l === ee.MASK && (a.alphaTest = r.alphaCutoff !== void 0 ? r.alphaCutoff : 0.5)), r.normalTexture !== void 0 && s !== K && (c.push(e.assignTexture(a, "normalMap", r.normalTexture)), a.normalScale = new z(1, 1), r.normalTexture.scale !== void 0)) {
1230
+ if (l === ee.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, l === ee.MASK && (a.alphaTest = r.alphaCutoff !== void 0 ? r.alphaCutoff : 0.5)), r.normalTexture !== void 0 && s !== V && (c.push(t.assignTexture(a, "normalMap", r.normalTexture)), a.normalScale = new z(1, 1), r.normalTexture.scale !== void 0)) {
1231
1231
  const u = r.normalTexture.scale;
1232
1232
  a.normalScale.set(u, u);
1233
1233
  }
1234
- if (r.occlusionTexture !== void 0 && s !== K && (c.push(e.assignTexture(a, "aoMap", r.occlusionTexture)), r.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = r.occlusionTexture.strength)), r.emissiveFactor !== void 0 && s !== K) {
1234
+ if (r.occlusionTexture !== void 0 && s !== V && (c.push(t.assignTexture(a, "aoMap", r.occlusionTexture)), r.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = r.occlusionTexture.strength)), r.emissiveFactor !== void 0 && s !== V) {
1235
1235
  const u = r.emissiveFactor;
1236
- a.emissive = new G().setRGB(u[0], u[1], u[2], O);
1236
+ a.emissive = new H().setRGB(u[0], u[1], u[2], O);
1237
1237
  }
1238
- return r.emissiveTexture !== void 0 && s !== K && c.push(e.assignTexture(a, "emissiveMap", r.emissiveTexture, P)), Promise.all(c).then(function() {
1238
+ return r.emissiveTexture !== void 0 && s !== V && c.push(t.assignTexture(a, "emissiveMap", r.emissiveTexture, C)), Promise.all(c).then(function() {
1239
1239
  const u = new s(a);
1240
- return r.name && (u.name = r.name), D(u, r), e.associations.set(u, { materials: t }), r.extensions && H(n, u, r), u;
1240
+ return r.name && (u.name = r.name), P(u, r), t.associations.set(u, { materials: e }), r.extensions && G(n, u, r), u;
1241
1241
  });
1242
1242
  }
1243
1243
  /** When Object3D instances are targeted by animation, they need unique names. */
1244
- createUniqueName(t) {
1245
- const e = nt.sanitizeNodeName(t || "");
1246
- return e in this.nodeNamesUsed ? e + "_" + ++this.nodeNamesUsed[e] : (this.nodeNamesUsed[e] = 0, e);
1244
+ createUniqueName(e) {
1245
+ const t = st.sanitizeNodeName(e || "");
1246
+ return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);
1247
1247
  }
1248
1248
  /**
1249
1249
  * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
@@ -1253,21 +1253,21 @@ class tn {
1253
1253
  * @param {Array<GLTF.Primitive>} primitives
1254
1254
  * @return {Promise<Array<BufferGeometry>>}
1255
1255
  */
1256
- loadGeometries(t) {
1257
- const e = this, i = this.extensions, n = this.primitiveCache;
1256
+ loadGeometries(e) {
1257
+ const t = this, o = this.extensions, n = this.primitiveCache;
1258
1258
  function r(a) {
1259
- return i[w.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, e).then(function(o) {
1260
- return Re(o, a, e);
1259
+ return o[E.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(i) {
1260
+ return _e(i, a, t);
1261
1261
  });
1262
1262
  }
1263
1263
  const s = [];
1264
- for (let a = 0, o = t.length; a < o; a++) {
1265
- const c = t[a], l = Zt(c), u = n[l];
1264
+ for (let a = 0, i = e.length; a < i; a++) {
1265
+ const c = e[a], l = $t(c), u = n[l];
1266
1266
  if (u)
1267
1267
  s.push(u.promise);
1268
1268
  else {
1269
- let p;
1270
- c.extensions && c.extensions[w.KHR_DRACO_MESH_COMPRESSION] ? p = r(c) : p = Re(new Ce(), c, e), n[l] = { primitive: c, promise: p }, s.push(p);
1269
+ let f;
1270
+ c.extensions && c.extensions[E.KHR_DRACO_MESH_COMPRESSION] ? f = r(c) : f = _e(new ce(), c, t), n[l] = { primitive: c, promise: f }, s.push(f);
1271
1271
  }
1272
1272
  }
1273
1273
  return Promise.all(s);
@@ -1277,44 +1277,44 @@ class tn {
1277
1277
  * @param {number} meshIndex
1278
1278
  * @return {Promise<Group|Mesh|SkinnedMesh>}
1279
1279
  */
1280
- loadMesh(t) {
1281
- const e = this, i = this.json, n = this.extensions, r = i.meshes[t], s = r.primitives, a = [];
1282
- for (let o = 0, c = s.length; o < c; o++) {
1283
- const l = s[o].material === void 0 ? Yt(this.cache) : this.getDependency("material", s[o].material);
1280
+ loadMesh(e) {
1281
+ const t = this, o = this.json, n = this.extensions, r = o.meshes[e], s = r.primitives, a = [];
1282
+ for (let i = 0, c = s.length; i < c; i++) {
1283
+ const l = s[i].material === void 0 ? Jt(this.cache) : this.getDependency("material", s[i].material);
1284
1284
  a.push(l);
1285
1285
  }
1286
- return a.push(e.loadGeometries(s)), Promise.all(a).then(function(o) {
1287
- const c = o.slice(0, o.length - 1), l = o[o.length - 1], u = [];
1288
- for (let A = 0, x = l.length; A < x; A++) {
1289
- const _ = l[A], T = s[A];
1286
+ return a.push(t.loadGeometries(s)), Promise.all(a).then(function(i) {
1287
+ const c = i.slice(0, i.length - 1), l = i[i.length - 1], u = [];
1288
+ for (let m = 0, T = l.length; m < T; m++) {
1289
+ const _ = l[m], x = s[m];
1290
1290
  let R;
1291
- const y = c[A];
1292
- if (T.mode === I.TRIANGLES || T.mode === I.TRIANGLE_STRIP || T.mode === I.TRIANGLE_FAN || T.mode === void 0)
1293
- R = r.isSkinnedMesh === !0 ? new st(_, y) : new Oe(_, y), R.isSkinnedMesh === !0 && R.normalizeSkinWeights(), T.mode === I.TRIANGLE_STRIP ? R.geometry = ge(R.geometry, Se) : T.mode === I.TRIANGLE_FAN && (R.geometry = ge(R.geometry, ne));
1294
- else if (T.mode === I.LINES)
1295
- R = new rt(_, y);
1296
- else if (T.mode === I.LINE_STRIP)
1297
- R = new it(_, y);
1298
- else if (T.mode === I.LINE_LOOP)
1299
- R = new ot(_, y);
1300
- else if (T.mode === I.POINTS)
1301
- R = new at(_, y);
1291
+ const S = c[m];
1292
+ if (x.mode === I.TRIANGLES || x.mode === I.TRIANGLE_STRIP || x.mode === I.TRIANGLE_FAN || x.mode === void 0)
1293
+ R = r.isSkinnedMesh === !0 ? new rt(_, S) : new ke(_, S), R.isSkinnedMesh === !0 && R.normalizeSkinWeights(), x.mode === I.TRIANGLE_STRIP ? R.geometry = xe(R.geometry, Se) : x.mode === I.TRIANGLE_FAN && (R.geometry = xe(R.geometry, se));
1294
+ else if (x.mode === I.LINES)
1295
+ R = new ot(_, S);
1296
+ else if (x.mode === I.LINE_STRIP)
1297
+ R = new it(_, S);
1298
+ else if (x.mode === I.LINE_LOOP)
1299
+ R = new at(_, S);
1300
+ else if (x.mode === I.POINTS)
1301
+ R = new ct(_, S);
1302
1302
  else
1303
- throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + T.mode);
1304
- Object.keys(R.geometry.morphAttributes).length > 0 && Jt(R, r), R.name = e.createUniqueName(r.name || "mesh_" + t), D(R, r), T.extensions && H(n, R, T), e.assignFinalMaterial(R), u.push(R);
1303
+ throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + x.mode);
1304
+ Object.keys(R.geometry.morphAttributes).length > 0 && Zt(R, r), R.name = t.createUniqueName(r.name || "mesh_" + e), P(R, r), x.extensions && G(n, R, x), t.assignFinalMaterial(R), u.push(R);
1305
1305
  }
1306
- for (let A = 0, x = u.length; A < x; A++)
1307
- e.associations.set(u[A], {
1308
- meshes: t,
1309
- primitives: A
1306
+ for (let m = 0, T = u.length; m < T; m++)
1307
+ t.associations.set(u[m], {
1308
+ meshes: e,
1309
+ primitives: m
1310
1310
  });
1311
1311
  if (u.length === 1)
1312
- return r.extensions && H(n, u[0], r), u[0];
1313
- const p = new X();
1314
- r.extensions && H(n, p, r), e.associations.set(p, { meshes: t });
1315
- for (let A = 0, x = u.length; A < x; A++)
1316
- p.add(u[A]);
1317
- return p;
1312
+ return r.extensions && G(n, u[0], r), u[0];
1313
+ const f = new W();
1314
+ r.extensions && G(n, f, r), t.associations.set(f, { meshes: e });
1315
+ for (let m = 0, T = u.length; m < T; m++)
1316
+ f.add(u[m]);
1317
+ return f;
1318
1318
  });
1319
1319
  }
1320
1320
  /**
@@ -1322,36 +1322,36 @@ class tn {
1322
1322
  * @param {number} cameraIndex
1323
1323
  * @return {Promise<THREE.Camera>}
1324
1324
  */
1325
- loadCamera(t) {
1326
- let e;
1327
- const i = this.json.cameras[t], n = i[i.type];
1325
+ loadCamera(e) {
1326
+ let t;
1327
+ const o = this.json.cameras[e], n = o[o.type];
1328
1328
  if (!n) {
1329
1329
  console.warn("THREE.GLTFLoader: Missing camera parameters.");
1330
1330
  return;
1331
1331
  }
1332
- return i.type === "perspective" ? e = new ct(ut.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : i.type === "orthographic" && (e = new lt(-n.xmag, n.xmag, n.ymag, -n.ymag, n.znear, n.zfar)), i.name && (e.name = this.createUniqueName(i.name)), D(e, i), Promise.resolve(e);
1332
+ return o.type === "perspective" ? t = new lt(ut.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : o.type === "orthographic" && (t = new ft(-n.xmag, n.xmag, n.ymag, -n.ymag, n.znear, n.zfar)), o.name && (t.name = this.createUniqueName(o.name)), P(t, o), Promise.resolve(t);
1333
1333
  }
1334
1334
  /**
1335
1335
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
1336
1336
  * @param {number} skinIndex
1337
1337
  * @return {Promise<Skeleton>}
1338
1338
  */
1339
- loadSkin(t) {
1340
- const e = this.json.skins[t], i = [];
1341
- for (let n = 0, r = e.joints.length; n < r; n++)
1342
- i.push(this._loadNodeShallow(e.joints[n]));
1343
- return e.inverseBindMatrices !== void 0 ? i.push(this.getDependency("accessor", e.inverseBindMatrices)) : i.push(null), Promise.all(i).then(function(n) {
1344
- const r = n.pop(), s = n, a = [], o = [];
1339
+ loadSkin(e) {
1340
+ const t = this.json.skins[e], o = [];
1341
+ for (let n = 0, r = t.joints.length; n < r; n++)
1342
+ o.push(this._loadNodeShallow(t.joints[n]));
1343
+ return t.inverseBindMatrices !== void 0 ? o.push(this.getDependency("accessor", t.inverseBindMatrices)) : o.push(null), Promise.all(o).then(function(n) {
1344
+ const r = n.pop(), s = n, a = [], i = [];
1345
1345
  for (let c = 0, l = s.length; c < l; c++) {
1346
1346
  const u = s[c];
1347
1347
  if (u) {
1348
1348
  a.push(u);
1349
- const p = new q();
1350
- r !== null && p.fromArray(r.array, c * 16), o.push(p);
1349
+ const f = new q();
1350
+ r !== null && f.fromArray(r.array, c * 16), i.push(f);
1351
1351
  } else
1352
- console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', e.joints[c]);
1352
+ console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[c]);
1353
1353
  }
1354
- return new ft(a, o);
1354
+ return new dt(a, i);
1355
1355
  });
1356
1356
  }
1357
1357
  /**
@@ -1359,40 +1359,40 @@ class tn {
1359
1359
  * @param {number} animationIndex
1360
1360
  * @return {Promise<AnimationClip>}
1361
1361
  */
1362
- loadAnimation(t) {
1363
- const e = this.json, i = this, n = e.animations[t], r = n.name ? n.name : "animation_" + t, s = [], a = [], o = [], c = [], l = [];
1364
- for (let u = 0, p = n.channels.length; u < p; u++) {
1365
- const A = n.channels[u], x = n.samplers[A.sampler], _ = A.target, T = _.node, R = n.parameters !== void 0 ? n.parameters[x.input] : x.input, y = n.parameters !== void 0 ? n.parameters[x.output] : x.output;
1366
- _.node !== void 0 && (s.push(this.getDependency("node", T)), a.push(this.getDependency("accessor", R)), o.push(this.getDependency("accessor", y)), c.push(x), l.push(_));
1362
+ loadAnimation(e) {
1363
+ const t = this.json, o = this, n = t.animations[e], r = n.name ? n.name : "animation_" + e, s = [], a = [], i = [], c = [], l = [];
1364
+ for (let u = 0, f = n.channels.length; u < f; u++) {
1365
+ const m = n.channels[u], T = n.samplers[m.sampler], _ = m.target, x = _.node, R = n.parameters !== void 0 ? n.parameters[T.input] : T.input, S = n.parameters !== void 0 ? n.parameters[T.output] : T.output;
1366
+ _.node !== void 0 && (s.push(this.getDependency("node", x)), a.push(this.getDependency("accessor", R)), i.push(this.getDependency("accessor", S)), c.push(T), l.push(_));
1367
1367
  }
1368
1368
  return Promise.all([
1369
1369
  Promise.all(s),
1370
1370
  Promise.all(a),
1371
- Promise.all(o),
1371
+ Promise.all(i),
1372
1372
  Promise.all(c),
1373
1373
  Promise.all(l)
1374
1374
  ]).then(function(u) {
1375
- const p = u[0], A = u[1], x = u[2], _ = u[3], T = u[4], R = [];
1376
- for (let y = 0, L = p.length; y < L; y++) {
1377
- const S = p[y], b = A[y], N = x[y], M = _[y], f = T[y];
1378
- if (S === void 0) continue;
1379
- S.updateMatrix && S.updateMatrix();
1380
- const h = i._createAnimationTracks(S, b, N, M, f);
1381
- if (h)
1382
- for (let m = 0; m < h.length; m++)
1383
- R.push(h[m]);
1375
+ const f = u[0], m = u[1], T = u[2], _ = u[3], x = u[4], R = [];
1376
+ for (let S = 0, L = f.length; S < L; S++) {
1377
+ const y = f[S], M = m[S], N = T[S], b = _[S], d = x[S];
1378
+ if (y === void 0) continue;
1379
+ y.updateMatrix && y.updateMatrix();
1380
+ const p = o._createAnimationTracks(y, M, N, b, d);
1381
+ if (p)
1382
+ for (let g = 0; g < p.length; g++)
1383
+ R.push(p[g]);
1384
1384
  }
1385
- return new dt(r, void 0, R);
1385
+ return new ht(r, void 0, R);
1386
1386
  });
1387
1387
  }
1388
- createNodeMesh(t) {
1389
- const e = this.json, i = this, n = e.nodes[t];
1390
- return n.mesh === void 0 ? null : i.getDependency("mesh", n.mesh).then(function(r) {
1391
- const s = i._getNodeRef(i.meshCache, n.mesh, r);
1388
+ createNodeMesh(e) {
1389
+ const t = this.json, o = this, n = t.nodes[e];
1390
+ return n.mesh === void 0 ? null : o.getDependency("mesh", n.mesh).then(function(r) {
1391
+ const s = o._getNodeRef(o.meshCache, n.mesh, r);
1392
1392
  return n.weights !== void 0 && s.traverse(function(a) {
1393
1393
  if (a.isMesh)
1394
- for (let o = 0, c = n.weights.length; o < c; o++)
1395
- a.morphTargetInfluences[o] = n.weights[o];
1394
+ for (let i = 0, c = n.weights.length; i < c; i++)
1395
+ a.morphTargetInfluences[i] = n.weights[i];
1396
1396
  }), s;
1397
1397
  });
1398
1398
  }
@@ -1401,148 +1401,148 @@ class tn {
1401
1401
  * @param {number} nodeIndex
1402
1402
  * @return {Promise<Object3D>}
1403
1403
  */
1404
- loadNode(t) {
1405
- const e = this.json, i = this, n = e.nodes[t], r = i._loadNodeShallow(t), s = [], a = n.children || [];
1404
+ loadNode(e) {
1405
+ const t = this.json, o = this, n = t.nodes[e], r = o._loadNodeShallow(e), s = [], a = n.children || [];
1406
1406
  for (let c = 0, l = a.length; c < l; c++)
1407
- s.push(i.getDependency("node", a[c]));
1408
- const o = n.skin === void 0 ? Promise.resolve(null) : i.getDependency("skin", n.skin);
1407
+ s.push(o.getDependency("node", a[c]));
1408
+ const i = n.skin === void 0 ? Promise.resolve(null) : o.getDependency("skin", n.skin);
1409
1409
  return Promise.all([
1410
1410
  r,
1411
1411
  Promise.all(s),
1412
- o
1412
+ i
1413
1413
  ]).then(function(c) {
1414
- const l = c[0], u = c[1], p = c[2];
1415
- p !== null && l.traverse(function(A) {
1416
- A.isSkinnedMesh && A.bind(p, en);
1414
+ const l = c[0], u = c[1], f = c[2];
1415
+ f !== null && l.traverse(function(m) {
1416
+ m.isSkinnedMesh && m.bind(f, tn);
1417
1417
  });
1418
- for (let A = 0, x = u.length; A < x; A++)
1419
- l.add(u[A]);
1418
+ for (let m = 0, T = u.length; m < T; m++)
1419
+ l.add(u[m]);
1420
1420
  return l;
1421
1421
  });
1422
1422
  }
1423
1423
  // ._loadNodeShallow() parses a single node.
1424
1424
  // skin and child nodes are created and added in .loadNode() (no '_' prefix).
1425
- _loadNodeShallow(t) {
1426
- const e = this.json, i = this.extensions, n = this;
1427
- if (this.nodeCache[t] !== void 0)
1428
- return this.nodeCache[t];
1429
- const r = e.nodes[t], s = r.name ? n.createUniqueName(r.name) : "", a = [], o = n._invokeOne(function(c) {
1430
- return c.createNodeMesh && c.createNodeMesh(t);
1425
+ _loadNodeShallow(e) {
1426
+ const t = this.json, o = this.extensions, n = this;
1427
+ if (this.nodeCache[e] !== void 0)
1428
+ return this.nodeCache[e];
1429
+ const r = t.nodes[e], s = r.name ? n.createUniqueName(r.name) : "", a = [], i = n._invokeOne(function(c) {
1430
+ return c.createNodeMesh && c.createNodeMesh(e);
1431
1431
  });
1432
- return o && a.push(o), r.camera !== void 0 && a.push(n.getDependency("camera", r.camera).then(function(c) {
1432
+ return i && a.push(i), r.camera !== void 0 && a.push(n.getDependency("camera", r.camera).then(function(c) {
1433
1433
  return n._getNodeRef(n.cameraCache, r.camera, c);
1434
1434
  })), n._invokeAll(function(c) {
1435
- return c.createNodeAttachment && c.createNodeAttachment(t);
1435
+ return c.createNodeAttachment && c.createNodeAttachment(e);
1436
1436
  }).forEach(function(c) {
1437
1437
  a.push(c);
1438
- }), this.nodeCache[t] = Promise.all(a).then(function(c) {
1438
+ }), this.nodeCache[e] = Promise.all(a).then(function(c) {
1439
1439
  let l;
1440
- if (r.isBone === !0 ? l = new ht() : c.length > 1 ? l = new X() : c.length === 1 ? l = c[0] : l = new ie(), l !== c[0])
1441
- for (let u = 0, p = c.length; u < p; u++)
1440
+ if (r.isBone === !0 ? l = new pt() : c.length > 1 ? l = new W() : c.length === 1 ? l = c[0] : l = new ae(), l !== c[0])
1441
+ for (let u = 0, f = c.length; u < f; u++)
1442
1442
  l.add(c[u]);
1443
- if (r.name && (l.userData.name = r.name, l.name = s), D(l, r), r.extensions && H(i, l, r), r.matrix !== void 0) {
1443
+ if (r.name && (l.userData.name = r.name, l.name = s), P(l, r), r.extensions && G(o, l, r), r.matrix !== void 0) {
1444
1444
  const u = new q();
1445
1445
  u.fromArray(r.matrix), l.applyMatrix4(u);
1446
1446
  } else
1447
1447
  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);
1448
- return n.associations.has(l) || n.associations.set(l, {}), n.associations.get(l).nodes = t, l;
1449
- }), this.nodeCache[t];
1448
+ return n.associations.has(l) || n.associations.set(l, {}), n.associations.get(l).nodes = e, l;
1449
+ }), this.nodeCache[e];
1450
1450
  }
1451
1451
  /**
1452
1452
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
1453
1453
  * @param {number} sceneIndex
1454
1454
  * @return {Promise<Group>}
1455
1455
  */
1456
- loadScene(t) {
1457
- const e = this.extensions, i = this.json.scenes[t], n = this, r = new X();
1458
- i.name && (r.name = n.createUniqueName(i.name)), D(r, i), i.extensions && H(e, r, i);
1459
- const s = i.nodes || [], a = [];
1460
- for (let o = 0, c = s.length; o < c; o++)
1461
- a.push(n.getDependency("node", s[o]));
1462
- return Promise.all(a).then(function(o) {
1463
- for (let l = 0, u = o.length; l < u; l++)
1464
- r.add(o[l]);
1456
+ loadScene(e) {
1457
+ const t = this.extensions, o = this.json.scenes[e], n = this, r = new W();
1458
+ o.name && (r.name = n.createUniqueName(o.name)), P(r, o), o.extensions && G(t, r, o);
1459
+ const s = o.nodes || [], a = [];
1460
+ for (let i = 0, c = s.length; i < c; i++)
1461
+ a.push(n.getDependency("node", s[i]));
1462
+ return Promise.all(a).then(function(i) {
1463
+ for (let l = 0, u = i.length; l < u; l++)
1464
+ r.add(i[l]);
1465
1465
  const c = (l) => {
1466
1466
  const u = /* @__PURE__ */ new Map();
1467
- for (const [p, A] of n.associations)
1468
- (p instanceof Z || p instanceof ce) && u.set(p, A);
1469
- return l.traverse((p) => {
1470
- const A = n.associations.get(p);
1471
- A != null && u.set(p, A);
1467
+ for (const [f, m] of n.associations)
1468
+ (f instanceof Z || f instanceof fe) && u.set(f, m);
1469
+ return l.traverse((f) => {
1470
+ const m = n.associations.get(f);
1471
+ m != null && u.set(f, m);
1472
1472
  }), u;
1473
1473
  };
1474
1474
  return n.associations = c(r), r;
1475
1475
  });
1476
1476
  }
1477
- _createAnimationTracks(t, e, i, n, r) {
1478
- const s = [], a = t.name ? t.name : t.uuid, o = [];
1479
- F[r.path] === F.weights ? t.traverse(function(p) {
1480
- p.morphTargetInfluences && o.push(p.name ? p.name : p.uuid);
1481
- }) : o.push(a);
1477
+ _createAnimationTracks(e, t, o, n, r) {
1478
+ const s = [], a = e.name ? e.name : e.uuid, i = [];
1479
+ F[r.path] === F.weights ? e.traverse(function(f) {
1480
+ f.morphTargetInfluences && i.push(f.name ? f.name : f.uuid);
1481
+ }) : i.push(a);
1482
1482
  let c;
1483
1483
  switch (F[r.path]) {
1484
1484
  case F.weights:
1485
- c = le;
1485
+ c = he;
1486
1486
  break;
1487
1487
  case F.rotation:
1488
- c = fe;
1488
+ c = pe;
1489
1489
  break;
1490
1490
  case F.position:
1491
1491
  case F.scale:
1492
- c = ue;
1492
+ c = de;
1493
1493
  break;
1494
1494
  default:
1495
- switch (i.itemSize) {
1495
+ switch (o.itemSize) {
1496
1496
  case 1:
1497
- c = le;
1497
+ c = he;
1498
1498
  break;
1499
1499
  case 2:
1500
1500
  case 3:
1501
1501
  default:
1502
- c = ue;
1502
+ c = de;
1503
1503
  break;
1504
1504
  }
1505
1505
  break;
1506
1506
  }
1507
- const l = n.interpolation !== void 0 ? qt[n.interpolation] : Fe, u = this._getArrayFromAccessor(i);
1508
- for (let p = 0, A = o.length; p < A; p++) {
1509
- const x = new c(
1510
- o[p] + "." + F[r.path],
1511
- e.array,
1507
+ const l = n.interpolation !== void 0 ? Yt[n.interpolation] : De, u = this._getArrayFromAccessor(o);
1508
+ for (let f = 0, m = i.length; f < m; f++) {
1509
+ const T = new c(
1510
+ i[f] + "." + F[r.path],
1511
+ t.array,
1512
1512
  u,
1513
1513
  l
1514
1514
  );
1515
- n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(x), s.push(x);
1515
+ n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(T), s.push(T);
1516
1516
  }
1517
1517
  return s;
1518
1518
  }
1519
- _getArrayFromAccessor(t) {
1520
- let e = t.array;
1521
- if (t.normalized) {
1522
- const i = re(e.constructor), n = new Float32Array(e.length);
1523
- for (let r = 0, s = e.length; r < s; r++)
1524
- n[r] = e[r] * i;
1525
- e = n;
1519
+ _getArrayFromAccessor(e) {
1520
+ let t = e.array;
1521
+ if (e.normalized) {
1522
+ const o = oe(t.constructor), n = new Float32Array(t.length);
1523
+ for (let r = 0, s = t.length; r < s; r++)
1524
+ n[r] = t[r] * o;
1525
+ t = n;
1526
1526
  }
1527
- return e;
1527
+ return t;
1528
1528
  }
1529
- _createCubicSplineTrackInterpolant(t) {
1530
- t.createInterpolant = function(i) {
1531
- const n = this instanceof fe ? zt : Pe;
1532
- return new n(this.times, this.values, this.getValueSize() / 3, i);
1533
- }, t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
1529
+ _createCubicSplineTrackInterpolant(e) {
1530
+ e.createInterpolant = function(o) {
1531
+ const n = this instanceof pe ? qt : Pe;
1532
+ return new n(this.times, this.values, this.getValueSize() / 3, o);
1533
+ }, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
1534
1534
  }
1535
1535
  }
1536
- function nn(d, t, e) {
1537
- const i = t.attributes, n = new At();
1538
- if (i.POSITION !== void 0) {
1539
- const a = e.json.accessors[i.POSITION], o = a.min, c = a.max;
1540
- if (o !== void 0 && c !== void 0) {
1536
+ function sn(h, e, t) {
1537
+ const o = e.attributes, n = new Tt();
1538
+ if (o.POSITION !== void 0) {
1539
+ const a = t.json.accessors[o.POSITION], i = a.min, c = a.max;
1540
+ if (i !== void 0 && c !== void 0) {
1541
1541
  if (n.set(
1542
- new B(o[0], o[1], o[2]),
1543
- new B(c[0], c[1], c[2])
1542
+ new v(i[0], i[1], i[2]),
1543
+ new v(c[0], c[1], c[2])
1544
1544
  ), a.normalized) {
1545
- const l = re(U[a.componentType]);
1545
+ const l = oe(B[a.componentType]);
1546
1546
  n.min.multiplyScalar(l), n.max.multiplyScalar(l);
1547
1547
  }
1548
1548
  } else {
@@ -1551,369 +1551,604 @@ function nn(d, t, e) {
1551
1551
  }
1552
1552
  } else
1553
1553
  return;
1554
- const r = t.targets;
1554
+ const r = e.targets;
1555
1555
  if (r !== void 0) {
1556
- const a = new B(), o = new B();
1556
+ const a = new v(), i = new v();
1557
1557
  for (let c = 0, l = r.length; c < l; c++) {
1558
1558
  const u = r[c];
1559
1559
  if (u.POSITION !== void 0) {
1560
- const p = e.json.accessors[u.POSITION], A = p.min, x = p.max;
1561
- if (A !== void 0 && x !== void 0) {
1562
- if (o.setX(Math.max(Math.abs(A[0]), Math.abs(x[0]))), o.setY(Math.max(Math.abs(A[1]), Math.abs(x[1]))), o.setZ(Math.max(Math.abs(A[2]), Math.abs(x[2]))), p.normalized) {
1563
- const _ = re(U[p.componentType]);
1564
- o.multiplyScalar(_);
1560
+ const f = t.json.accessors[u.POSITION], m = f.min, T = f.max;
1561
+ if (m !== void 0 && T !== void 0) {
1562
+ if (i.setX(Math.max(Math.abs(m[0]), Math.abs(T[0]))), i.setY(Math.max(Math.abs(m[1]), Math.abs(T[1]))), i.setZ(Math.max(Math.abs(m[2]), Math.abs(T[2]))), f.normalized) {
1563
+ const _ = oe(B[f.componentType]);
1564
+ i.multiplyScalar(_);
1565
1565
  }
1566
- a.max(o);
1566
+ a.max(i);
1567
1567
  } else
1568
1568
  console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
1569
1569
  }
1570
1570
  }
1571
1571
  n.expandByVector(a);
1572
1572
  }
1573
- d.boundingBox = n;
1574
- const s = new Tt();
1575
- n.getCenter(s.center), s.radius = n.min.distanceTo(n.max) / 2, d.boundingSphere = s;
1573
+ h.boundingBox = n;
1574
+ const s = new xt();
1575
+ n.getCenter(s.center), s.radius = n.min.distanceTo(n.max) / 2, h.boundingSphere = s;
1576
1576
  }
1577
- function Re(d, t, e) {
1578
- const i = t.attributes, n = [];
1577
+ function _e(h, e, t) {
1578
+ const o = e.attributes, n = [];
1579
1579
  function r(s, a) {
1580
- return e.getDependency("accessor", s).then(function(o) {
1581
- d.setAttribute(a, o);
1580
+ return t.getDependency("accessor", s).then(function(i) {
1581
+ h.setAttribute(a, i);
1582
1582
  });
1583
1583
  }
1584
- for (const s in i) {
1585
- const a = se[s] || s.toLowerCase();
1586
- a in d.attributes || n.push(r(i[s], a));
1584
+ for (const s in o) {
1585
+ const a = re[s] || s.toLowerCase();
1586
+ a in h.attributes || n.push(r(o[s], a));
1587
1587
  }
1588
- if (t.indices !== void 0 && !d.index) {
1589
- const s = e.getDependency("accessor", t.indices).then(function(a) {
1590
- d.setIndex(a);
1588
+ if (e.indices !== void 0 && !h.index) {
1589
+ const s = t.getDependency("accessor", e.indices).then(function(a) {
1590
+ h.setIndex(a);
1591
1591
  });
1592
1592
  n.push(s);
1593
1593
  }
1594
- return de.workingColorSpace !== O && "COLOR_0" in i && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${de.workingColorSpace}" not supported.`), D(d, t), nn(d, t, e), Promise.all(n).then(function() {
1595
- return t.targets !== void 0 ? Qt(d, t.targets, e) : d;
1594
+ return me.workingColorSpace !== O && "COLOR_0" in o && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${me.workingColorSpace}" not supported.`), P(h, e), sn(h, e, t), Promise.all(n).then(function() {
1595
+ return e.targets !== void 0 ? Qt(h, e.targets, t) : h;
1596
1596
  });
1597
1597
  }
1598
- class sn {
1599
- parse(t) {
1600
- const e = {}, i = t.split(`
1598
+ class rn {
1599
+ parse(e) {
1600
+ const t = {}, o = e.split(`
1601
1601
  `);
1602
- let n = null, r = e;
1603
- const s = [e];
1604
- for (const a of i)
1602
+ let n = null, r = t;
1603
+ const s = [t];
1604
+ for (const a of o)
1605
1605
  if (a.includes("=")) {
1606
- const o = a.split("="), c = o[0].trim(), l = o[1].trim();
1606
+ const i = a.split("="), c = i[0].trim(), l = i[1].trim();
1607
1607
  if (l.endsWith("{")) {
1608
1608
  const u = {};
1609
1609
  s.push(u), r[c] = u, r = u;
1610
1610
  } else
1611
1611
  r[c] = l;
1612
1612
  } else if (a.endsWith("{")) {
1613
- const o = r[n] || {};
1614
- s.push(o), r[n] = o, r = o;
1613
+ const i = r[n] || {};
1614
+ s.push(i), r[n] = i, r = i;
1615
1615
  } else if (a.endsWith("}")) {
1616
1616
  if (s.pop(), s.length === 0) continue;
1617
1617
  r = s[s.length - 1];
1618
1618
  } else if (a.endsWith("(")) {
1619
- const o = {};
1620
- s.push(o), n = a.split("(")[0].trim() || n, r[n] = o, r = o;
1619
+ const i = {};
1620
+ s.push(i), n = a.split("(")[0].trim() || n, r[n] = i, r = i;
1621
1621
  } else a.endsWith(")") ? (s.pop(), r = s[s.length - 1]) : n = a.trim();
1622
- return e;
1622
+ return t;
1623
1623
  }
1624
1624
  }
1625
- class rn extends we {
1626
- constructor(t) {
1627
- super(t);
1625
+ class on extends ie {
1626
+ constructor(e) {
1627
+ super(e);
1628
1628
  }
1629
- load(t, e, i, n) {
1630
- const r = this, s = new W(r.manager);
1631
- s.setPath(r.path), s.setResponseType("arraybuffer"), s.setRequestHeader(r.requestHeader), s.setWithCredentials(r.withCredentials), s.load(t, function(a) {
1629
+ load(e, t, o, n) {
1630
+ const r = this, s = new j(r.manager);
1631
+ s.setPath(r.path), s.setResponseType("arraybuffer"), s.setRequestHeader(r.requestHeader), s.setWithCredentials(r.withCredentials), s.load(e, function(a) {
1632
1632
  try {
1633
- e(r.parse(a));
1634
- } catch (o) {
1635
- n ? n(o) : console.error(o), r.manager.itemError(t);
1633
+ t(r.parse(a));
1634
+ } catch (i) {
1635
+ n ? n(i) : console.error(i), r.manager.itemError(e);
1636
1636
  }
1637
- }, i, n);
1638
- }
1639
- parse(t) {
1640
- const e = new sn();
1641
- function i(f) {
1642
- const h = {};
1643
- new W().setResponseType("arraybuffer");
1644
- for (const g in f) {
1645
- if (g.endsWith("png")) {
1646
- const E = new Blob([f[g]], { type: { type: "image/png" } });
1647
- h[g] = URL.createObjectURL(E);
1637
+ }, o, n);
1638
+ }
1639
+ parse(e) {
1640
+ const t = new rn();
1641
+ function o(d) {
1642
+ const p = {};
1643
+ new j().setResponseType("arraybuffer");
1644
+ for (const A in d) {
1645
+ if (A.endsWith("png")) {
1646
+ const w = new Blob([d[A]], { type: { type: "image/png" } });
1647
+ p[A] = URL.createObjectURL(w);
1648
1648
  }
1649
- if (g.endsWith("usd") || g.endsWith("usda")) {
1650
- if (n(f[g])) {
1649
+ if (A.endsWith("usd") || A.endsWith("usda")) {
1650
+ if (n(d[A])) {
1651
1651
  console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.");
1652
1652
  continue;
1653
1653
  }
1654
- const E = he(f[g]);
1655
- h[g] = e.parse(E);
1654
+ const w = ge(d[A]);
1655
+ p[A] = t.parse(w);
1656
1656
  }
1657
1657
  }
1658
- return h;
1659
- }
1660
- function n(f) {
1661
- const h = f.slice(0, 7), m = new Uint8Array([80, 88, 82, 45, 85, 83, 68, 67]);
1662
- return h.every((g, E) => g === m[E]);
1663
- }
1664
- function r(f) {
1665
- if (f.length < 1) return;
1666
- const h = Object.keys(f)[0];
1667
- let m = !1;
1668
- if (h.endsWith("usda")) return f[h];
1669
- if (h.endsWith("usdc"))
1670
- m = !0;
1671
- else if (h.endsWith("usd"))
1672
- if (n(f[h]))
1673
- m = !0;
1658
+ return p;
1659
+ }
1660
+ function n(d) {
1661
+ const p = d.slice(0, 7), g = new Uint8Array([80, 88, 82, 45, 85, 83, 68, 67]);
1662
+ return p.every((A, w) => A === g[w]);
1663
+ }
1664
+ function r(d) {
1665
+ if (d.length < 1) return;
1666
+ const p = Object.keys(d)[0];
1667
+ let g = !1;
1668
+ if (p.endsWith("usda")) return d[p];
1669
+ if (p.endsWith("usdc"))
1670
+ g = !0;
1671
+ else if (p.endsWith("usd"))
1672
+ if (n(d[p]))
1673
+ g = !0;
1674
1674
  else
1675
- return f[h];
1676
- m && console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.");
1677
- }
1678
- const s = xt(new Uint8Array(t)), a = i(s), o = r(s);
1679
- if (o === void 0)
1680
- return console.warn("THREE.USDZLoader: No usda file found."), new X();
1681
- const c = he(o), l = e.parse(c);
1682
- function u(f) {
1683
- if (f) {
1684
- if ("prepend references" in f) {
1685
- const m = f["prepend references"].split("@"), g = m[1].replace(/^.\//, ""), E = m[2].replace(/^<\//, "").replace(/>$/, "");
1686
- return p(a[g], E);
1675
+ return d[p];
1676
+ g && console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.");
1677
+ }
1678
+ const s = Rt(new Uint8Array(e)), a = o(s), i = r(s);
1679
+ if (i === void 0)
1680
+ return console.warn("THREE.USDZLoader: No usda file found."), new W();
1681
+ const c = ge(i), l = t.parse(c);
1682
+ function u(d) {
1683
+ if (d) {
1684
+ if ("prepend references" in d) {
1685
+ const g = d["prepend references"].split("@"), A = g[1].replace(/^.\//, ""), w = g[2].replace(/^<\//, "").replace(/>$/, "");
1686
+ return f(a[A], w);
1687
1687
  }
1688
- return p(f);
1688
+ return f(d);
1689
1689
  }
1690
1690
  }
1691
- function p(f, h) {
1692
- if (f) {
1693
- if (h !== void 0) {
1694
- const m = `def Mesh "${h}"`;
1695
- if (m in f)
1696
- return f[m];
1691
+ function f(d, p) {
1692
+ if (d) {
1693
+ if (p !== void 0) {
1694
+ const g = `def Mesh "${p}"`;
1695
+ if (g in d)
1696
+ return d[g];
1697
1697
  }
1698
- for (const m in f) {
1699
- const g = f[m];
1700
- if (m.startsWith("def Mesh"))
1701
- return "point3f[] points" in f && (g["point3f[] points"] = f["point3f[] points"]), "texCoord2f[] primvars:st" in f && (g["texCoord2f[] primvars:st"] = f["texCoord2f[] primvars:st"]), "int[] primvars:st:indices" in f && (g["int[] primvars:st:indices"] = f["int[] primvars:st:indices"]), g;
1702
- if (typeof g == "object") {
1703
- const E = p(g);
1704
- if (E) return E;
1698
+ for (const g in d) {
1699
+ const A = d[g];
1700
+ if (g.startsWith("def Mesh"))
1701
+ return "point3f[] points" in d && (A["point3f[] points"] = d["point3f[] points"]), "texCoord2f[] primvars:st" in d && (A["texCoord2f[] primvars:st"] = d["texCoord2f[] primvars:st"]), "int[] primvars:st:indices" in d && (A["int[] primvars:st:indices"] = d["int[] primvars:st:indices"]), A;
1702
+ if (typeof A == "object") {
1703
+ const w = f(A);
1704
+ if (w) return w;
1705
1705
  }
1706
1706
  }
1707
1707
  }
1708
1708
  }
1709
- function A(f) {
1710
- if (!f) return;
1711
- let h = new Ce();
1712
- if ("int[] faceVertexIndices" in f) {
1713
- const m = JSON.parse(f["int[] faceVertexIndices"]);
1714
- h.setIndex(m);
1709
+ function m(d) {
1710
+ if (!d) return;
1711
+ let p = new ce();
1712
+ if ("int[] faceVertexIndices" in d) {
1713
+ const g = JSON.parse(d["int[] faceVertexIndices"]);
1714
+ p.setIndex(g);
1715
1715
  }
1716
- if ("point3f[] points" in f) {
1717
- const m = JSON.parse(f["point3f[] points"].replace(/[()]*/g, "")), g = new v(new Float32Array(m), 3);
1718
- h.setAttribute("position", g);
1716
+ if ("point3f[] points" in d) {
1717
+ const g = JSON.parse(d["point3f[] points"].replace(/[()]*/g, "")), A = new D(new Float32Array(g), 3);
1718
+ p.setAttribute("position", A);
1719
1719
  }
1720
- if ("normal3f[] normals" in f) {
1721
- const m = JSON.parse(f["normal3f[] normals"].replace(/[()]*/g, "")), g = new v(new Float32Array(m), 3);
1722
- h.setAttribute("normal", g);
1720
+ if ("normal3f[] normals" in d) {
1721
+ const g = JSON.parse(d["normal3f[] normals"].replace(/[()]*/g, "")), A = new D(new Float32Array(g), 3);
1722
+ p.setAttribute("normal", A);
1723
1723
  } else
1724
- h.computeVertexNormals();
1725
- if ("float2[] primvars:st" in f && (f["texCoord2f[] primvars:st"] = f["float2[] primvars:st"]), "texCoord2f[] primvars:st" in f) {
1726
- const m = JSON.parse(f["texCoord2f[] primvars:st"].replace(/[()]*/g, "")), g = new v(new Float32Array(m), 2);
1727
- if ("int[] primvars:st:indices" in f) {
1728
- h = h.toNonIndexed();
1729
- const E = JSON.parse(f["int[] primvars:st:indices"]);
1730
- h.setAttribute("uv", x(g, E));
1724
+ p.computeVertexNormals();
1725
+ if ("float2[] primvars:st" in d && (d["texCoord2f[] primvars:st"] = d["float2[] primvars:st"]), "texCoord2f[] primvars:st" in d) {
1726
+ const g = JSON.parse(d["texCoord2f[] primvars:st"].replace(/[()]*/g, "")), A = new D(new Float32Array(g), 2);
1727
+ if ("int[] primvars:st:indices" in d) {
1728
+ p = p.toNonIndexed();
1729
+ const w = JSON.parse(d["int[] primvars:st:indices"]);
1730
+ p.setAttribute("uv", T(A, w));
1731
1731
  } else
1732
- h.setAttribute("uv", g);
1732
+ p.setAttribute("uv", A);
1733
1733
  }
1734
- return h;
1735
- }
1736
- function x(f, h) {
1737
- const m = f.array, g = f.itemSize, E = new m.constructor(h.length * g);
1738
- let oe = 0, ke = 0;
1739
- for (let Q = 0, He = h.length; Q < He; Q++) {
1740
- oe = h[Q] * g;
1741
- for (let ae = 0; ae < g; ae++)
1742
- E[ke++] = m[oe++];
1734
+ return p;
1735
+ }
1736
+ function T(d, p) {
1737
+ const g = d.array, A = d.itemSize, w = new g.constructor(p.length * A);
1738
+ let le = 0, He = 0;
1739
+ for (let J = 0, Ue = p.length; J < Ue; J++) {
1740
+ le = p[J] * A;
1741
+ for (let ue = 0; ue < A; ue++)
1742
+ w[He++] = g[le++];
1743
1743
  }
1744
- return new v(E, g);
1744
+ return new D(w, A);
1745
1745
  }
1746
- function _(f) {
1747
- if (f) {
1748
- if ("rel material:binding" in f) {
1749
- const g = f["rel material:binding"].replace(/^<\//, "").replace(/>$/, "").split("/");
1750
- return T(l, ` "${g[1]}"`);
1746
+ function _(d) {
1747
+ if (d) {
1748
+ if ("rel material:binding" in d) {
1749
+ const A = d["rel material:binding"].replace(/^<\//, "").replace(/>$/, "").split("/");
1750
+ return x(l, ` "${A[1]}"`);
1751
1751
  }
1752
- return T(f);
1752
+ return x(d);
1753
1753
  }
1754
1754
  }
1755
- function T(f, h = "") {
1756
- for (const m in f) {
1757
- const g = f[m];
1758
- if (m.startsWith("def Material" + h))
1759
- return g;
1760
- if (typeof g == "object") {
1761
- const E = T(g, h);
1762
- if (E) return E;
1755
+ function x(d, p = "") {
1756
+ for (const g in d) {
1757
+ const A = d[g];
1758
+ if (g.startsWith("def Material" + p))
1759
+ return A;
1760
+ if (typeof A == "object") {
1761
+ const w = x(A, p);
1762
+ if (w) return w;
1763
1763
  }
1764
1764
  }
1765
1765
  }
1766
- function R(f, h) {
1767
- h["float inputs:rotation"] && (f.rotation = parseFloat(h["float inputs:rotation"])), h["float2 inputs:scale"] && (f.repeat = new z().fromArray(JSON.parse("[" + h["float2 inputs:scale"].replace(/[()]*/g, "") + "]"))), h["float2 inputs:translation"] && (f.offset = new z().fromArray(JSON.parse("[" + h["float2 inputs:translation"].replace(/[()]*/g, "") + "]")));
1768
- }
1769
- function y(f) {
1770
- const h = new C();
1771
- if (f !== void 0) {
1772
- if ('def Shader "PreviewSurface"' in f) {
1773
- const m = f['def Shader "PreviewSurface"'];
1774
- if ("color3f inputs:diffuseColor.connect" in m) {
1775
- const g = m["color3f inputs:diffuseColor.connect"], E = L(l, /(\w+).output/.exec(g)[1]);
1776
- h.map = S(E), h.map.colorSpace = P, 'def Shader "Transform2d_diffuse"' in f && R(h.map, f['def Shader "Transform2d_diffuse"']);
1777
- } else if ("color3f inputs:diffuseColor" in m) {
1778
- const g = m["color3f inputs:diffuseColor"].replace(/[()]*/g, "");
1779
- h.color.fromArray(JSON.parse("[" + g + "]"));
1766
+ function R(d, p) {
1767
+ p["float inputs:rotation"] && (d.rotation = parseFloat(p["float inputs:rotation"])), p["float2 inputs:scale"] && (d.repeat = new z().fromArray(JSON.parse("[" + p["float2 inputs:scale"].replace(/[()]*/g, "") + "]"))), p["float2 inputs:translation"] && (d.offset = new z().fromArray(JSON.parse("[" + p["float2 inputs:translation"].replace(/[()]*/g, "") + "]")));
1768
+ }
1769
+ function S(d) {
1770
+ const p = new k();
1771
+ if (d !== void 0) {
1772
+ if ('def Shader "PreviewSurface"' in d) {
1773
+ const g = d['def Shader "PreviewSurface"'];
1774
+ if ("color3f inputs:diffuseColor.connect" in g) {
1775
+ const A = g["color3f inputs:diffuseColor.connect"], w = L(l, /(\w+).output/.exec(A)[1]);
1776
+ p.map = y(w), p.map.colorSpace = C, 'def Shader "Transform2d_diffuse"' in d && R(p.map, d['def Shader "Transform2d_diffuse"']);
1777
+ } else if ("color3f inputs:diffuseColor" in g) {
1778
+ const A = g["color3f inputs:diffuseColor"].replace(/[()]*/g, "");
1779
+ p.color.fromArray(JSON.parse("[" + A + "]"));
1780
1780
  }
1781
- if ("color3f inputs:emissiveColor.connect" in m) {
1782
- const g = m["color3f inputs:emissiveColor.connect"], E = L(l, /(\w+).output/.exec(g)[1]);
1783
- h.emissiveMap = S(E), h.emissiveMap.colorSpace = P, h.emissive.set(16777215), 'def Shader "Transform2d_emissive"' in f && R(h.emissiveMap, f['def Shader "Transform2d_emissive"']);
1784
- } else if ("color3f inputs:emissiveColor" in m) {
1785
- const g = m["color3f inputs:emissiveColor"].replace(/[()]*/g, "");
1786
- h.emissive.fromArray(JSON.parse("[" + g + "]"));
1781
+ if ("color3f inputs:emissiveColor.connect" in g) {
1782
+ const A = g["color3f inputs:emissiveColor.connect"], w = L(l, /(\w+).output/.exec(A)[1]);
1783
+ p.emissiveMap = y(w), p.emissiveMap.colorSpace = C, p.emissive.set(16777215), 'def Shader "Transform2d_emissive"' in d && R(p.emissiveMap, d['def Shader "Transform2d_emissive"']);
1784
+ } else if ("color3f inputs:emissiveColor" in g) {
1785
+ const A = g["color3f inputs:emissiveColor"].replace(/[()]*/g, "");
1786
+ p.emissive.fromArray(JSON.parse("[" + A + "]"));
1787
1787
  }
1788
- if ("normal3f inputs:normal.connect" in m) {
1789
- const g = m["normal3f inputs:normal.connect"], E = L(l, /(\w+).output/.exec(g)[1]);
1790
- h.normalMap = S(E), h.normalMap.colorSpace = k, 'def Shader "Transform2d_normal"' in f && R(h.normalMap, f['def Shader "Transform2d_normal"']);
1788
+ if ("normal3f inputs:normal.connect" in g) {
1789
+ const A = g["normal3f inputs:normal.connect"], w = L(l, /(\w+).output/.exec(A)[1]);
1790
+ p.normalMap = y(w), p.normalMap.colorSpace = U, 'def Shader "Transform2d_normal"' in d && R(p.normalMap, d['def Shader "Transform2d_normal"']);
1791
1791
  }
1792
- if ("float inputs:roughness.connect" in m) {
1793
- const g = m["float inputs:roughness.connect"], E = L(l, /(\w+).output/.exec(g)[1]);
1794
- h.roughness = 1, h.roughnessMap = S(E), h.roughnessMap.colorSpace = k, 'def Shader "Transform2d_roughness"' in f && R(h.roughnessMap, f['def Shader "Transform2d_roughness"']);
1795
- } else "float inputs:roughness" in m && (h.roughness = parseFloat(m["float inputs:roughness"]));
1796
- if ("float inputs:metallic.connect" in m) {
1797
- const g = m["float inputs:metallic.connect"], E = L(l, /(\w+).output/.exec(g)[1]);
1798
- h.metalness = 1, h.metalnessMap = S(E), h.metalnessMap.colorSpace = k, 'def Shader "Transform2d_metallic"' in f && R(h.metalnessMap, f['def Shader "Transform2d_metallic"']);
1799
- } else "float inputs:metallic" in m && (h.metalness = parseFloat(m["float inputs:metallic"]));
1800
- if ("float inputs:clearcoat.connect" in m) {
1801
- const g = m["float inputs:clearcoat.connect"], E = L(l, /(\w+).output/.exec(g)[1]);
1802
- h.clearcoat = 1, h.clearcoatMap = S(E), h.clearcoatMap.colorSpace = k, 'def Shader "Transform2d_clearcoat"' in f && R(h.clearcoatMap, f['def Shader "Transform2d_clearcoat"']);
1803
- } else "float inputs:clearcoat" in m && (h.clearcoat = parseFloat(m["float inputs:clearcoat"]));
1804
- if ("float inputs:clearcoatRoughness.connect" in m) {
1805
- const g = m["float inputs:clearcoatRoughness.connect"], E = L(l, /(\w+).output/.exec(g)[1]);
1806
- h.clearcoatRoughness = 1, h.clearcoatRoughnessMap = S(E), h.clearcoatRoughnessMap.colorSpace = k, 'def Shader "Transform2d_clearcoatRoughness"' in f && R(h.clearcoatRoughnessMap, f['def Shader "Transform2d_clearcoatRoughness"']);
1807
- } else "float inputs:clearcoatRoughness" in m && (h.clearcoatRoughness = parseFloat(m["float inputs:clearcoatRoughness"]));
1808
- if ("float inputs:ior" in m && (h.ior = parseFloat(m["float inputs:ior"])), "float inputs:occlusion.connect" in m) {
1809
- const g = m["float inputs:occlusion.connect"], E = L(l, /(\w+).output/.exec(g)[1]);
1810
- h.aoMap = S(E), h.aoMap.colorSpace = k, 'def Shader "Transform2d_occlusion"' in f && R(h.aoMap, f['def Shader "Transform2d_occlusion"']);
1792
+ if ("float inputs:roughness.connect" in g) {
1793
+ const A = g["float inputs:roughness.connect"], w = L(l, /(\w+).output/.exec(A)[1]);
1794
+ p.roughness = 1, p.roughnessMap = y(w), p.roughnessMap.colorSpace = U, 'def Shader "Transform2d_roughness"' in d && R(p.roughnessMap, d['def Shader "Transform2d_roughness"']);
1795
+ } else "float inputs:roughness" in g && (p.roughness = parseFloat(g["float inputs:roughness"]));
1796
+ if ("float inputs:metallic.connect" in g) {
1797
+ const A = g["float inputs:metallic.connect"], w = L(l, /(\w+).output/.exec(A)[1]);
1798
+ p.metalness = 1, p.metalnessMap = y(w), p.metalnessMap.colorSpace = U, 'def Shader "Transform2d_metallic"' in d && R(p.metalnessMap, d['def Shader "Transform2d_metallic"']);
1799
+ } else "float inputs:metallic" in g && (p.metalness = parseFloat(g["float inputs:metallic"]));
1800
+ if ("float inputs:clearcoat.connect" in g) {
1801
+ const A = g["float inputs:clearcoat.connect"], w = L(l, /(\w+).output/.exec(A)[1]);
1802
+ p.clearcoat = 1, p.clearcoatMap = y(w), p.clearcoatMap.colorSpace = U, 'def Shader "Transform2d_clearcoat"' in d && R(p.clearcoatMap, d['def Shader "Transform2d_clearcoat"']);
1803
+ } else "float inputs:clearcoat" in g && (p.clearcoat = parseFloat(g["float inputs:clearcoat"]));
1804
+ if ("float inputs:clearcoatRoughness.connect" in g) {
1805
+ const A = g["float inputs:clearcoatRoughness.connect"], w = L(l, /(\w+).output/.exec(A)[1]);
1806
+ p.clearcoatRoughness = 1, p.clearcoatRoughnessMap = y(w), p.clearcoatRoughnessMap.colorSpace = U, 'def Shader "Transform2d_clearcoatRoughness"' in d && R(p.clearcoatRoughnessMap, d['def Shader "Transform2d_clearcoatRoughness"']);
1807
+ } else "float inputs:clearcoatRoughness" in g && (p.clearcoatRoughness = parseFloat(g["float inputs:clearcoatRoughness"]));
1808
+ if ("float inputs:ior" in g && (p.ior = parseFloat(g["float inputs:ior"])), "float inputs:occlusion.connect" in g) {
1809
+ const A = g["float inputs:occlusion.connect"], w = L(l, /(\w+).output/.exec(A)[1]);
1810
+ p.aoMap = y(w), p.aoMap.colorSpace = U, 'def Shader "Transform2d_occlusion"' in d && R(p.aoMap, d['def Shader "Transform2d_occlusion"']);
1811
1811
  }
1812
1812
  }
1813
- if ('def Shader "diffuseColor_texture"' in f) {
1814
- const m = f['def Shader "diffuseColor_texture"'];
1815
- h.map = S(m), h.map.colorSpace = P;
1813
+ if ('def Shader "diffuseColor_texture"' in d) {
1814
+ const g = d['def Shader "diffuseColor_texture"'];
1815
+ p.map = y(g), p.map.colorSpace = C;
1816
1816
  }
1817
- if ('def Shader "normal_texture"' in f) {
1818
- const m = f['def Shader "normal_texture"'];
1819
- h.normalMap = S(m), h.normalMap.colorSpace = k;
1817
+ if ('def Shader "normal_texture"' in d) {
1818
+ const g = d['def Shader "normal_texture"'];
1819
+ p.normalMap = y(g), p.normalMap.colorSpace = U;
1820
1820
  }
1821
1821
  }
1822
- return h;
1823
- }
1824
- function L(f, h) {
1825
- for (const m in f) {
1826
- const g = f[m];
1827
- if (m.startsWith(`def Shader "${h}"`))
1828
- return g;
1829
- if (typeof g == "object") {
1830
- const E = L(g, h);
1831
- if (E) return E;
1822
+ return p;
1823
+ }
1824
+ function L(d, p) {
1825
+ for (const g in d) {
1826
+ const A = d[g];
1827
+ if (g.startsWith(`def Shader "${p}"`))
1828
+ return A;
1829
+ if (typeof A == "object") {
1830
+ const w = L(A, p);
1831
+ if (w) return w;
1832
1832
  }
1833
1833
  }
1834
1834
  }
1835
- function S(f) {
1836
- if ("asset inputs:file" in f) {
1837
- const h = f["asset inputs:file"].replace(/@*/g, ""), g = new ye().load(a[h]), E = {
1838
- '"clamp"': Ne,
1839
- '"mirror"': be,
1835
+ function y(d) {
1836
+ if ("asset inputs:file" in d) {
1837
+ const p = d["asset inputs:file"].replace(/@*/g, ""), A = new be().load(a[p]), w = {
1838
+ '"clamp"': Ce,
1839
+ '"mirror"': Ie,
1840
1840
  '"repeat"': Y
1841
1841
  };
1842
- return "token inputs:wrapS" in f && (g.wrapS = E[f["token inputs:wrapS"]]), "token inputs:wrapT" in f && (g.wrapT = E[f["token inputs:wrapT"]]), g;
1842
+ return "token inputs:wrapS" in d && (A.wrapS = w[d["token inputs:wrapS"]]), "token inputs:wrapT" in d && (A.wrapT = w[d["token inputs:wrapT"]]), A;
1843
1843
  }
1844
1844
  return null;
1845
1845
  }
1846
- function b(f) {
1847
- const h = A(u(f)), m = y(_(f)), g = h ? new Oe(h, m) : new ie();
1848
- if ("matrix4d xformOp:transform" in f) {
1849
- const E = JSON.parse("[" + f["matrix4d xformOp:transform"].replace(/[()]*/g, "") + "]");
1850
- g.matrix.fromArray(E), g.matrix.decompose(g.position, g.quaternion, g.scale);
1846
+ function M(d) {
1847
+ const p = m(u(d)), g = S(_(d)), A = p ? new ke(p, g) : new ae();
1848
+ if ("matrix4d xformOp:transform" in d) {
1849
+ const w = JSON.parse("[" + d["matrix4d xformOp:transform"].replace(/[()]*/g, "") + "]");
1850
+ A.matrix.fromArray(w), A.matrix.decompose(A.position, A.quaternion, A.scale);
1851
1851
  }
1852
- return g;
1853
- }
1854
- function N(f, h) {
1855
- for (const m in f)
1856
- if (m.startsWith("def Scope"))
1857
- N(f[m], h);
1858
- else if (m.startsWith("def Xform")) {
1859
- const g = b(f[m]);
1860
- /def Xform "(\w+)"/.test(m) && (g.name = /def Xform "(\w+)"/.exec(m)[1]), h.add(g), N(f[m], g);
1852
+ return A;
1853
+ }
1854
+ function N(d, p) {
1855
+ for (const g in d)
1856
+ if (g.startsWith("def Scope"))
1857
+ N(d[g], p);
1858
+ else if (g.startsWith("def Xform")) {
1859
+ const A = M(d[g]);
1860
+ /def Xform "(\w+)"/.test(g) && (A.name = /def Xform "(\w+)"/.exec(g)[1]), p.add(A), N(d[g], A);
1861
1861
  }
1862
1862
  }
1863
- const M = new X();
1864
- return N(l, M), M;
1863
+ const b = new W();
1864
+ return N(l, b), b;
1865
+ }
1866
+ }
1867
+ const ne = /* @__PURE__ */ new WeakMap();
1868
+ class an extends ie {
1869
+ constructor(e) {
1870
+ super(e), this.decoderPath = "", this.decoderConfig = {}, this.decoderBinary = null, this.decoderPending = null, this.workerLimit = 4, this.workerPool = [], this.workerNextTaskID = 1, this.workerSourceURL = "", this.defaultAttributeIDs = {
1871
+ position: "POSITION",
1872
+ normal: "NORMAL",
1873
+ color: "COLOR",
1874
+ uv: "TEX_COORD"
1875
+ }, this.defaultAttributeTypes = {
1876
+ position: "Float32Array",
1877
+ normal: "Float32Array",
1878
+ color: "Float32Array",
1879
+ uv: "Float32Array"
1880
+ };
1881
+ }
1882
+ setDecoderPath(e) {
1883
+ return this.decoderPath = e, this;
1884
+ }
1885
+ setDecoderConfig(e) {
1886
+ return this.decoderConfig = e, this;
1887
+ }
1888
+ setWorkerLimit(e) {
1889
+ return this.workerLimit = e, this;
1890
+ }
1891
+ load(e, t, o, n) {
1892
+ const r = new j(this.manager);
1893
+ r.setPath(this.path), r.setResponseType("arraybuffer"), r.setRequestHeader(this.requestHeader), r.setWithCredentials(this.withCredentials), r.load(e, (s) => {
1894
+ this.parse(s, t, n);
1895
+ }, o, n);
1896
+ }
1897
+ parse(e, t, o = () => {
1898
+ }) {
1899
+ this.decodeDracoFile(e, t, null, null, C).catch(o);
1900
+ }
1901
+ decodeDracoFile(e, t, o, n, r = O, s = () => {
1902
+ }) {
1903
+ const a = {
1904
+ attributeIDs: o || this.defaultAttributeIDs,
1905
+ attributeTypes: n || this.defaultAttributeTypes,
1906
+ useUniqueIDs: !!o,
1907
+ vertexColorSpace: r
1908
+ };
1909
+ return this.decodeGeometry(e, a).then(t).catch(s);
1910
+ }
1911
+ decodeGeometry(e, t) {
1912
+ const o = JSON.stringify(t);
1913
+ if (ne.has(e)) {
1914
+ const i = ne.get(e);
1915
+ if (i.key === o)
1916
+ return i.promise;
1917
+ if (e.byteLength === 0)
1918
+ throw new Error(
1919
+ "THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred."
1920
+ );
1921
+ }
1922
+ let n;
1923
+ const r = this.workerNextTaskID++, s = e.byteLength, a = this._getWorker(r, s).then((i) => (n = i, new Promise((c, l) => {
1924
+ n._callbacks[r] = { resolve: c, reject: l }, n.postMessage({ type: "decode", id: r, taskConfig: t, buffer: e }, [e]);
1925
+ }))).then((i) => this._createGeometry(i.geometry));
1926
+ return a.catch(() => !0).then(() => {
1927
+ n && r && this._releaseTask(n, r);
1928
+ }), ne.set(e, {
1929
+ key: o,
1930
+ promise: a
1931
+ }), a;
1932
+ }
1933
+ _createGeometry(e) {
1934
+ const t = new ce();
1935
+ e.index && t.setIndex(new D(e.index.array, 1));
1936
+ for (let o = 0; o < e.attributes.length; o++) {
1937
+ const n = e.attributes[o], r = n.name, s = n.array, a = n.itemSize, i = new D(s, a);
1938
+ r === "color" && (this._assignVertexColorSpace(i, n.vertexColorSpace), i.normalized = !(s instanceof Float32Array)), t.setAttribute(r, i);
1939
+ }
1940
+ return t;
1941
+ }
1942
+ _assignVertexColorSpace(e, t) {
1943
+ if (t !== C) return;
1944
+ const o = new H();
1945
+ for (let n = 0, r = e.count; n < r; n++)
1946
+ o.fromBufferAttribute(e, n).convertSRGBToLinear(), e.setXYZ(n, o.r, o.g, o.b);
1947
+ }
1948
+ _loadLibrary(e, t) {
1949
+ const o = new j(this.manager);
1950
+ return o.setPath(this.decoderPath), o.setResponseType(t), o.setWithCredentials(this.withCredentials), new Promise((n, r) => {
1951
+ o.load(e, n, void 0, r);
1952
+ });
1953
+ }
1954
+ preload() {
1955
+ return this._initDecoder(), this;
1956
+ }
1957
+ _initDecoder() {
1958
+ if (this.decoderPending) return this.decoderPending;
1959
+ const e = typeof WebAssembly != "object" || this.decoderConfig.type === "js", t = [];
1960
+ return e ? t.push(this._loadLibrary("draco_decoder.js", "text")) : (t.push(this._loadLibrary("draco_wasm_wrapper.js", "text")), t.push(this._loadLibrary("draco_decoder.wasm", "arraybuffer"))), this.decoderPending = Promise.all(t).then((o) => {
1961
+ const n = o[0];
1962
+ e || (this.decoderConfig.wasmBinary = o[1]);
1963
+ const r = cn.toString(), s = [
1964
+ "/* draco decoder */",
1965
+ n,
1966
+ "",
1967
+ "/* worker */",
1968
+ r.substring(r.indexOf("{") + 1, r.lastIndexOf("}"))
1969
+ ].join(`
1970
+ `);
1971
+ this.workerSourceURL = URL.createObjectURL(new Blob([s]));
1972
+ }), this.decoderPending;
1973
+ }
1974
+ _getWorker(e, t) {
1975
+ return this._initDecoder().then(() => {
1976
+ if (this.workerPool.length < this.workerLimit) {
1977
+ const n = new Worker(this.workerSourceURL);
1978
+ n._callbacks = {}, n._taskCosts = {}, n._taskLoad = 0, n.postMessage({ type: "init", decoderConfig: this.decoderConfig }), n.onmessage = function(r) {
1979
+ const s = r.data;
1980
+ switch (s.type) {
1981
+ case "decode":
1982
+ n._callbacks[s.id].resolve(s);
1983
+ break;
1984
+ case "error":
1985
+ n._callbacks[s.id].reject(s);
1986
+ break;
1987
+ default:
1988
+ console.error('THREE.DRACOLoader: Unexpected message, "' + s.type + '"');
1989
+ }
1990
+ }, this.workerPool.push(n);
1991
+ } else
1992
+ this.workerPool.sort(function(n, r) {
1993
+ return n._taskLoad > r._taskLoad ? -1 : 1;
1994
+ });
1995
+ const o = this.workerPool[this.workerPool.length - 1];
1996
+ return o._taskCosts[e] = t, o._taskLoad += t, o;
1997
+ });
1998
+ }
1999
+ _releaseTask(e, t) {
2000
+ e._taskLoad -= e._taskCosts[t], delete e._callbacks[t], delete e._taskCosts[t];
2001
+ }
2002
+ debug() {
2003
+ console.log("Task load: ", this.workerPool.map((e) => e._taskLoad));
2004
+ }
2005
+ dispose() {
2006
+ for (let e = 0; e < this.workerPool.length; ++e)
2007
+ this.workerPool[e].terminate();
2008
+ return this.workerPool.length = 0, this.workerSourceURL !== "" && URL.revokeObjectURL(this.workerSourceURL), this;
2009
+ }
2010
+ }
2011
+ function cn() {
2012
+ let h, e;
2013
+ onmessage = function(s) {
2014
+ const a = s.data;
2015
+ switch (a.type) {
2016
+ case "init":
2017
+ h = a.decoderConfig, e = new Promise(function(l) {
2018
+ h.onModuleLoaded = function(u) {
2019
+ l({ draco: u });
2020
+ }, DracoDecoderModule(h);
2021
+ });
2022
+ break;
2023
+ case "decode":
2024
+ const i = a.buffer, c = a.taskConfig;
2025
+ e.then((l) => {
2026
+ const u = l.draco, f = new u.Decoder();
2027
+ try {
2028
+ const m = t(u, f, new Int8Array(i), c), T = m.attributes.map((_) => _.array.buffer);
2029
+ m.index && T.push(m.index.array.buffer), self.postMessage({ type: "decode", id: a.id, geometry: m }, T);
2030
+ } catch (m) {
2031
+ console.error(m), self.postMessage({ type: "error", id: a.id, error: m.message });
2032
+ } finally {
2033
+ u.destroy(f);
2034
+ }
2035
+ });
2036
+ break;
2037
+ }
2038
+ };
2039
+ function t(s, a, i, c) {
2040
+ const l = c.attributeIDs, u = c.attributeTypes;
2041
+ let f, m;
2042
+ const T = a.GetEncodedGeometryType(i);
2043
+ if (T === s.TRIANGULAR_MESH)
2044
+ f = new s.Mesh(), m = a.DecodeArrayToMesh(i, i.byteLength, f);
2045
+ else if (T === s.POINT_CLOUD)
2046
+ f = new s.PointCloud(), m = a.DecodeArrayToPointCloud(i, i.byteLength, f);
2047
+ else
2048
+ throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
2049
+ if (!m.ok() || f.ptr === 0)
2050
+ throw new Error("THREE.DRACOLoader: Decoding failed: " + m.error_msg());
2051
+ const _ = { index: null, attributes: [] };
2052
+ for (const x in l) {
2053
+ const R = self[u[x]];
2054
+ let S, L;
2055
+ if (c.useUniqueIDs)
2056
+ L = l[x], S = a.GetAttributeByUniqueId(f, L);
2057
+ else {
2058
+ if (L = a.GetAttributeId(f, s[l[x]]), L === -1) continue;
2059
+ S = a.GetAttribute(f, L);
2060
+ }
2061
+ const y = n(s, a, f, x, R, S);
2062
+ x === "color" && (y.vertexColorSpace = c.vertexColorSpace), _.attributes.push(y);
2063
+ }
2064
+ return T === s.TRIANGULAR_MESH && (_.index = o(s, a, f)), s.destroy(f), _;
2065
+ }
2066
+ function o(s, a, i) {
2067
+ const l = i.num_faces() * 3, u = l * 4, f = s._malloc(u);
2068
+ a.GetTrianglesUInt32Array(i, u, f);
2069
+ const m = new Uint32Array(s.HEAPF32.buffer, f, l).slice();
2070
+ return s._free(f), { array: m, itemSize: 1 };
2071
+ }
2072
+ function n(s, a, i, c, l, u) {
2073
+ const f = u.num_components(), T = i.num_points() * f, _ = T * l.BYTES_PER_ELEMENT, x = r(s, l), R = s._malloc(_);
2074
+ a.GetAttributeDataArrayForAllPoints(i, u, x, _, R);
2075
+ const S = new l(s.HEAPF32.buffer, R, T).slice();
2076
+ return s._free(R), {
2077
+ name: c,
2078
+ array: S,
2079
+ itemSize: f
2080
+ };
2081
+ }
2082
+ function r(s, a) {
2083
+ switch (a) {
2084
+ case Float32Array:
2085
+ return s.DT_FLOAT32;
2086
+ case Int8Array:
2087
+ return s.DT_INT8;
2088
+ case Int16Array:
2089
+ return s.DT_INT16;
2090
+ case Int32Array:
2091
+ return s.DT_INT32;
2092
+ case Uint8Array:
2093
+ return s.DT_UINT8;
2094
+ case Uint16Array:
2095
+ return s.DT_UINT16;
2096
+ case Uint32Array:
2097
+ return s.DT_UINT32;
2098
+ }
1865
2099
  }
1866
2100
  }
1867
2101
  class Ee extends Error {
1868
- constructor(t, e, i) {
1869
- super(e), this.url = t, this.cause = i, this.name = "NetworkError";
2102
+ constructor(e, t, o) {
2103
+ super(t), this.url = e, this.cause = o, this.name = "NetworkError";
1870
2104
  }
1871
2105
  }
1872
- class ln {
2106
+ class hn {
1873
2107
  constructor() {
1874
- J(this, "_gltfLoader");
1875
- J(this, "_usdzLoader");
1876
- this._gltfLoader = new wt(), this._usdzLoader = new rn();
1877
- }
1878
- async _loadFile(t) {
1879
- const e = await fetch(t);
1880
- if (!e.ok)
1881
- throw new Ee(t, `Failed to fetch file from ${t}`);
2108
+ Q(this, "_gltfLoader");
2109
+ Q(this, "_usdzLoader");
2110
+ const e = new an();
2111
+ e.setDecoderPath("../draco/"), this._gltfLoader = new Et(), this._gltfLoader.setDRACOLoader(e), this._usdzLoader = new on();
2112
+ }
2113
+ async _loadFile(e) {
2114
+ const t = await fetch(e);
2115
+ if (!t.ok)
2116
+ throw new Ee(e, `Failed to fetch file from ${e}`);
1882
2117
  try {
1883
- return await e.arrayBuffer();
2118
+ return await t.arrayBuffer();
1884
2119
  } catch {
1885
- throw new Ee(t, `Failed to fetch file from ${t}`);
2120
+ throw new Ee(e, `Failed to fetch file from ${e}`);
1886
2121
  }
1887
2122
  }
1888
- async load(t) {
1889
- const e = Rt(t);
1890
- if (e.length === 0)
1891
- throw new pe("No file extension found in URI", "");
1892
- if (!Et(e))
1893
- throw new pe(
1894
- `Unsupported file type: ${e}. Supported types: ${St.join(", ")}`,
1895
- e
2123
+ async load(e) {
2124
+ const t = yt(e);
2125
+ if (t.length === 0)
2126
+ throw new Ae("No file extension found in URI", "");
2127
+ if (!wt(t))
2128
+ throw new Ae(
2129
+ `Unsupported file type: ${t}. Supported types: ${_t.join(", ")}`,
2130
+ t
1896
2131
  );
1897
- const i = await this._loadFile(t);
2132
+ const o = await this._loadFile(e);
1898
2133
  try {
1899
- switch (e) {
2134
+ switch (t) {
1900
2135
  case "glb":
1901
2136
  case "gltf":
1902
2137
  return (await this._gltfLoader.parseAsync(
1903
- i,
2138
+ o,
1904
2139
  ""
1905
2140
  )).scene;
1906
2141
  case "usdz":
1907
- return await this._usdzLoader.parse(i);
2142
+ return await this._usdzLoader.parse(o);
1908
2143
  }
1909
2144
  } catch (n) {
1910
- throw n instanceof Error ? new me(
1911
- `Failed to parse ${e} file: ${n.message}`,
2145
+ throw n instanceof Error ? new Te(
2146
+ `Failed to parse ${t} file: ${n.message}`,
1912
2147
  n
1913
- ) : new me(`Failed to parse ${e} file`);
2148
+ ) : new Te(`Failed to parse ${t} file`);
1914
2149
  }
1915
2150
  }
1916
2151
  }
1917
2152
  export {
1918
- ln as AssetLoader
2153
+ hn as AssetLoader
1919
2154
  };