@ridp/threejs 1.5.1 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,10 @@
1
- import * as A from "three";
2
- import { Controls as mt, Vector3 as S, MOUSE as z, TOUCH as Y, Quaternion as le, Spherical as je, Vector2 as I, Ray as gt, Plane as yt, MathUtils as st, TrianglesDrawMode as _t, TriangleFanDrawMode as Ce, TriangleStripDrawMode as nt, Loader as it, FileLoader as fe, SRGBColorSpace as $, LinearSRGBColorSpace as j, BufferGeometry as ot, BufferAttribute as oe, Color as q, ColorManagement as Pe, LoaderUtils as re, MeshPhysicalMaterial as G, SpotLight as Tt, PointLight as wt, DirectionalLight as bt, Matrix4 as se, InstancedMesh as Et, InstancedBufferAttribute as xt, Object3D as He, TextureLoader as At, ImageBitmapLoader as Rt, InterleavedBuffer as Mt, InterleavedBufferAttribute as St, LinearMipmapLinearFilter as rt, NearestMipmapLinearFilter as Lt, LinearMipmapNearestFilter as Dt, NearestMipmapNearestFilter as Ct, LinearFilter as Oe, NearestFilter as at, RepeatWrapping as Ie, MirroredRepeatWrapping as Pt, ClampToEdgeWrapping as Ot, PointsMaterial as It, Material as we, LineBasicMaterial as kt, MeshStandardMaterial as ct, DoubleSide as Nt, MeshBasicMaterial as ie, PropertyBinding as vt, SkinnedMesh as Ht, Mesh as Ft, LineSegments as Ut, Line as jt, LineLoop as Gt, Points as Bt, Group as be, PerspectiveCamera as zt, OrthographicCamera as Kt, Skeleton as Wt, AnimationClip as Vt, Bone as Xt, InterpolateDiscrete as Yt, InterpolateLinear as lt, Texture as Ge, VectorKeyframeTrack as Be, NumberKeyframeTrack as ze, QuaternionKeyframeTrack as Ke, FrontSide as $t, Interpolant as qt, Box3 as Zt, Sphere as Qt, CameraHelper as Jt, GridHelper as es, BoxHelper as ts, Raycaster as ss, AxesHelper as ns, ArrowHelper as is } from "three";
3
- import os from "dexie";
4
- const We = { type: "change" }, Fe = { type: "start" }, ht = { type: "end" }, ue = new gt(), Ve = new yt(), rs = Math.cos(70 * st.DEG2RAD), L = new S(), O = 2 * Math.PI, R = {
1
+ var xt = Object.defineProperty;
2
+ var Mt = (o, e, t) => e in o ? xt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var je = (o, e, t) => Mt(o, typeof e != "symbol" ? e + "" : e, t);
4
+ import * as x from "three";
5
+ import { Controls as St, Vector3 as R, MOUSE as z, TOUCH as V, Quaternion as ue, Spherical as ze, Vector2 as I, Ray as Rt, Plane as Lt, MathUtils as ut, TrianglesDrawMode as Dt, TriangleFanDrawMode as Ce, TriangleStripDrawMode as dt, Loader as ft, FileLoader as me, SRGBColorSpace as Y, LinearSRGBColorSpace as U, BufferGeometry as pt, BufferAttribute as oe, Color as q, ColorManagement as Oe, LoaderUtils as ae, MeshPhysicalMaterial as G, SpotLight as Pt, PointLight as Ct, DirectionalLight as Ot, Matrix4 as se, InstancedMesh as It, InstancedBufferAttribute as kt, Object3D as Fe, TextureLoader as Nt, ImageBitmapLoader as vt, InterleavedBuffer as Ht, InterleavedBufferAttribute as Ft, LinearMipmapLinearFilter as mt, NearestMipmapLinearFilter as Ut, LinearMipmapNearestFilter as Gt, NearestMipmapNearestFilter as jt, LinearFilter as Ie, NearestFilter as gt, RepeatWrapping as ke, MirroredRepeatWrapping as zt, ClampToEdgeWrapping as Bt, PointsMaterial as Kt, Material as we, LineBasicMaterial as Wt, MeshStandardMaterial as yt, DoubleSide as Xt, MeshBasicMaterial as re, PropertyBinding as Vt, SkinnedMesh as Yt, Mesh as qt, LineSegments as $t, Line as Zt, LineLoop as Qt, Points as Jt, Group as Ee, PerspectiveCamera as es, OrthographicCamera as ts, Skeleton as ss, AnimationClip as ns, Bone as is, InterpolateDiscrete as rs, InterpolateLinear as _t, Texture as Be, VectorKeyframeTrack as Ke, NumberKeyframeTrack as We, QuaternionKeyframeTrack as Xe, FrontSide as os, Interpolant as as, Box3 as cs, Sphere as ls, CameraHelper as hs, GridHelper as us, BoxHelper as ds, Raycaster as fs, AxesHelper as ps, ArrowHelper as ms } from "three";
6
+ import gs from "dexie";
7
+ const Ve = { type: "change" }, Ue = { type: "start" }, Tt = { type: "end" }, fe = new Rt(), Ye = new Lt(), ys = Math.cos(70 * ut.DEG2RAD), L = new R(), O = 2 * Math.PI, M = {
5
8
  NONE: -1,
6
9
  ROTATE: 0,
7
10
  DOLLY: 1,
@@ -10,8 +13,8 @@ const We = { type: "change" }, Fe = { type: "start" }, ht = { type: "end" }, ue
10
13
  TOUCH_PAN: 4,
11
14
  TOUCH_DOLLY_PAN: 5,
12
15
  TOUCH_DOLLY_ROTATE: 6
13
- }, Ee = 1e-6;
14
- class ut extends mt {
16
+ }, Ae = 1e-6;
17
+ class bt extends St {
15
18
  /**
16
19
  * Constructs a new controls instance.
17
20
  *
@@ -19,7 +22,7 @@ class ut extends mt {
19
22
  * @param {?HTMLDOMElement} domElement - The HTML element used for event listeners.
20
23
  */
21
24
  constructor(e, t = null) {
22
- super(e, t), this.state = R.NONE, this.target = new S(), this.cursor = new S(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: z.ROTATE, MIDDLE: z.DOLLY, RIGHT: z.PAN }, this.touches = { ONE: Y.ROTATE, TWO: Y.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new S(), this._lastQuaternion = new le(), this._lastTargetPosition = new S(), this._quat = new le().setFromUnitVectors(e.up, new S(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new je(), this._sphericalDelta = new je(), this._scale = 1, this._panOffset = new S(), this._rotateStart = new I(), this._rotateEnd = new I(), this._rotateDelta = new I(), this._panStart = new I(), this._panEnd = new I(), this._panDelta = new I(), this._dollyStart = new I(), this._dollyEnd = new I(), this._dollyDelta = new I(), this._dollyDirection = new S(), this._mouse = new I(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = cs.bind(this), this._onPointerDown = as.bind(this), this._onPointerUp = ls.bind(this), this._onContextMenu = gs.bind(this), this._onMouseWheel = ds.bind(this), this._onKeyDown = fs.bind(this), this._onTouchStart = ps.bind(this), this._onTouchMove = ms.bind(this), this._onMouseDown = hs.bind(this), this._onMouseMove = us.bind(this), this._interceptControlDown = ys.bind(this), this._interceptControlUp = _s.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
25
+ super(e, t), this.state = M.NONE, this.target = new R(), this.cursor = new R(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: z.ROTATE, MIDDLE: z.DOLLY, RIGHT: z.PAN }, this.touches = { ONE: V.ROTATE, TWO: V.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new R(), this._lastQuaternion = new ue(), this._lastTargetPosition = new R(), this._quat = new ue().setFromUnitVectors(e.up, new R(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new ze(), this._sphericalDelta = new ze(), this._scale = 1, this._panOffset = new R(), this._rotateStart = new I(), this._rotateEnd = new I(), this._rotateDelta = new I(), this._panStart = new I(), this._panEnd = new I(), this._panDelta = new I(), this._dollyStart = new I(), this._dollyEnd = new I(), this._dollyDelta = new I(), this._dollyDirection = new R(), this._mouse = new I(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = Ts.bind(this), this._onPointerDown = _s.bind(this), this._onPointerUp = bs.bind(this), this._onContextMenu = Rs.bind(this), this._onMouseWheel = As.bind(this), this._onKeyDown = xs.bind(this), this._onTouchStart = Ms.bind(this), this._onTouchMove = Ss.bind(this), this._onMouseDown = ws.bind(this), this._onMouseMove = Es.bind(this), this._interceptControlDown = Ls.bind(this), this._interceptControlUp = Ds.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
23
26
  }
24
27
  connect(e) {
25
28
  super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, { passive: !0, capture: !0 }), this.domElement.style.touchAction = "none";
@@ -80,42 +83,42 @@ class ut extends mt {
80
83
  * was called, or the initial state.
81
84
  */
82
85
  reset() {
83
- this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(We), this.update(), this.state = R.NONE;
86
+ this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(Ve), this.update(), this.state = M.NONE;
84
87
  }
85
88
  update(e = null) {
86
89
  const t = this.object.position;
87
- L.copy(t).sub(this.target), L.applyQuaternion(this._quat), this._spherical.setFromVector3(L), this.autoRotate && this.state === R.NONE && this._rotateLeft(this._getAutoRotationAngle(e)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
90
+ L.copy(t).sub(this.target), L.applyQuaternion(this._quat), this._spherical.setFromVector3(L), this.autoRotate && this.state === M.NONE && this._rotateLeft(this._getAutoRotationAngle(e)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
88
91
  let n = this.minAzimuthAngle, s = this.maxAzimuthAngle;
89
92
  isFinite(n) && isFinite(s) && (n < -Math.PI ? n += O : n > Math.PI && (n -= O), s < -Math.PI ? s += O : s > Math.PI && (s -= O), n <= s ? this._spherical.theta = Math.max(n, Math.min(s, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (n + s) / 2 ? Math.max(n, this._spherical.theta) : Math.min(s, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
90
- let o = !1;
93
+ let r = !1;
91
94
  if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera)
92
95
  this._spherical.radius = this._clampDistance(this._spherical.radius);
93
96
  else {
94
97
  const i = this._spherical.radius;
95
- this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), o = i != this._spherical.radius;
98
+ this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), r = i != this._spherical.radius;
96
99
  }
97
100
  if (L.setFromSpherical(this._spherical), L.applyQuaternion(this._quatInverse), t.copy(this.target).add(L), this.object.lookAt(this.target), this.enableDamping === !0 ? (this._sphericalDelta.theta *= 1 - this.dampingFactor, this._sphericalDelta.phi *= 1 - this.dampingFactor, this._panOffset.multiplyScalar(1 - this.dampingFactor)) : (this._sphericalDelta.set(0, 0, 0), this._panOffset.set(0, 0, 0)), this.zoomToCursor && this._performCursorZoom) {
98
101
  let i = null;
99
102
  if (this.object.isPerspectiveCamera) {
100
- const c = L.length();
101
- i = this._clampDistance(c * this._scale);
102
- const a = c - i;
103
- this.object.position.addScaledVector(this._dollyDirection, a), this.object.updateMatrixWorld(), o = !!a;
103
+ const a = L.length();
104
+ i = this._clampDistance(a * this._scale);
105
+ const c = a - i;
106
+ this.object.position.addScaledVector(this._dollyDirection, c), this.object.updateMatrixWorld(), r = !!c;
104
107
  } else if (this.object.isOrthographicCamera) {
105
- const c = new S(this._mouse.x, this._mouse.y, 0);
106
- c.unproject(this.object);
107
- const a = this.object.zoom;
108
- this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), o = a !== this.object.zoom;
109
- const l = new S(this._mouse.x, this._mouse.y, 0);
110
- l.unproject(this.object), this.object.position.sub(l).add(c), this.object.updateMatrixWorld(), i = L.length();
108
+ const a = new R(this._mouse.x, this._mouse.y, 0);
109
+ a.unproject(this.object);
110
+ const c = this.object.zoom;
111
+ this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), r = c !== this.object.zoom;
112
+ const l = new R(this._mouse.x, this._mouse.y, 0);
113
+ l.unproject(this.object), this.object.position.sub(l).add(a), this.object.updateMatrixWorld(), i = L.length();
111
114
  } else
112
115
  console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
113
- i !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(i).add(this.object.position) : (ue.origin.copy(this.object.position), ue.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(ue.direction)) < rs ? this.object.lookAt(this.target) : (Ve.setFromNormalAndCoplanarPoint(this.object.up, this.target), ue.intersectPlane(Ve, this.target))));
116
+ i !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(i).add(this.object.position) : (fe.origin.copy(this.object.position), fe.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(fe.direction)) < ys ? this.object.lookAt(this.target) : (Ye.setFromNormalAndCoplanarPoint(this.object.up, this.target), fe.intersectPlane(Ye, this.target))));
114
117
  } else if (this.object.isOrthographicCamera) {
115
118
  const i = this.object.zoom;
116
- this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), i !== this.object.zoom && (this.object.updateProjectionMatrix(), o = !0);
119
+ this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), i !== this.object.zoom && (this.object.updateProjectionMatrix(), r = !0);
117
120
  }
118
- return this._scale = 1, this._performCursorZoom = !1, o || this._lastPosition.distanceToSquared(this.object.position) > Ee || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > Ee || this._lastTargetPosition.distanceToSquared(this.target) > Ee ? (this.dispatchEvent(We), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
121
+ return this._scale = 1, this._performCursorZoom = !1, r || this._lastPosition.distanceToSquared(this.object.position) > Ae || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > Ae || this._lastTargetPosition.distanceToSquared(this.target) > Ae ? (this.dispatchEvent(Ve), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
119
122
  }
120
123
  _getAutoRotationAngle(e) {
121
124
  return e !== null ? O / 60 * this.autoRotateSpeed * e : O / 60 / 60 * this.autoRotateSpeed;
@@ -142,8 +145,8 @@ class ut extends mt {
142
145
  if (this.object.isPerspectiveCamera) {
143
146
  const s = this.object.position;
144
147
  L.copy(s).sub(this.target);
145
- let o = L.length();
146
- o *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * e * o / n.clientHeight, this.object.matrix), this._panUp(2 * t * o / n.clientHeight, this.object.matrix);
148
+ let r = L.length();
149
+ r *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * e * r / n.clientHeight, this.object.matrix), this._panUp(2 * t * r / n.clientHeight, this.object.matrix);
147
150
  } else this.object.isOrthographicCamera ? (this._panLeft(e * (this.object.right - this.object.left) / this.object.zoom / n.clientWidth, this.object.matrix), this._panUp(t * (this.object.top - this.object.bottom) / this.object.zoom / n.clientHeight, this.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), this.enablePan = !1);
148
151
  }
149
152
  _dollyOut(e) {
@@ -156,8 +159,8 @@ class ut extends mt {
156
159
  if (!this.zoomToCursor)
157
160
  return;
158
161
  this._performCursorZoom = !0;
159
- const n = this.domElement.getBoundingClientRect(), s = e - n.left, o = t - n.top, i = n.width, c = n.height;
160
- this._mouse.x = s / i * 2 - 1, this._mouse.y = -(o / c) * 2 + 1, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
162
+ const n = this.domElement.getBoundingClientRect(), s = e - n.left, r = t - n.top, i = n.width, a = n.height;
163
+ this._mouse.x = s / i * 2 - 1, this._mouse.y = -(r / a) * 2 + 1, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
161
164
  }
162
165
  _clampDistance(e) {
163
166
  return Math.max(this.minDistance, Math.min(this.maxDistance, e));
@@ -223,8 +226,8 @@ class ut extends mt {
223
226
  }
224
227
  }
225
228
  _handleTouchStartDolly(e) {
226
- const t = this._getSecondPointerPosition(e), n = e.pageX - t.x, s = e.pageY - t.y, o = Math.sqrt(n * n + s * s);
227
- this._dollyStart.set(0, o);
229
+ const t = this._getSecondPointerPosition(e), n = e.pageX - t.x, s = e.pageY - t.y, r = Math.sqrt(n * n + s * s);
230
+ this._dollyStart.set(0, r);
228
231
  }
229
232
  _handleTouchStartDollyPan(e) {
230
233
  this.enableZoom && this._handleTouchStartDolly(e), this.enablePan && this._handleTouchStartPan(e);
@@ -236,8 +239,8 @@ class ut extends mt {
236
239
  if (this._pointers.length == 1)
237
240
  this._rotateEnd.set(e.pageX, e.pageY);
238
241
  else {
239
- const n = this._getSecondPointerPosition(e), s = 0.5 * (e.pageX + n.x), o = 0.5 * (e.pageY + n.y);
240
- this._rotateEnd.set(s, o);
242
+ const n = this._getSecondPointerPosition(e), s = 0.5 * (e.pageX + n.x), r = 0.5 * (e.pageY + n.y);
243
+ this._rotateEnd.set(s, r);
241
244
  }
242
245
  this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
243
246
  const t = this.domElement;
@@ -253,10 +256,10 @@ class ut extends mt {
253
256
  this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed), this._pan(this._panDelta.x, this._panDelta.y), this._panStart.copy(this._panEnd);
254
257
  }
255
258
  _handleTouchMoveDolly(e) {
256
- const t = this._getSecondPointerPosition(e), n = e.pageX - t.x, s = e.pageY - t.y, o = Math.sqrt(n * n + s * s);
257
- this._dollyEnd.set(0, o), this._dollyDelta.set(0, Math.pow(this._dollyEnd.y / this._dollyStart.y, this.zoomSpeed)), this._dollyOut(this._dollyDelta.y), this._dollyStart.copy(this._dollyEnd);
258
- const i = (e.pageX + t.x) * 0.5, c = (e.pageY + t.y) * 0.5;
259
- this._updateZoomParameters(i, c);
259
+ const t = this._getSecondPointerPosition(e), n = e.pageX - t.x, s = e.pageY - t.y, r = Math.sqrt(n * n + s * s);
260
+ this._dollyEnd.set(0, r), this._dollyDelta.set(0, Math.pow(this._dollyEnd.y / this._dollyStart.y, this.zoomSpeed)), this._dollyOut(this._dollyDelta.y), this._dollyStart.copy(this._dollyEnd);
261
+ const i = (e.pageX + t.x) * 0.5, a = (e.pageY + t.y) * 0.5;
262
+ this._updateZoomParameters(i, a);
260
263
  }
261
264
  _handleTouchMoveDollyPan(e) {
262
265
  this.enableZoom && this._handleTouchMoveDolly(e), this.enablePan && this._handleTouchMovePan(e);
@@ -307,16 +310,16 @@ class ut extends mt {
307
310
  return e.ctrlKey && !this._controlActive && (n.deltaY *= 10), n;
308
311
  }
309
312
  }
310
- function as(r) {
311
- this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(r.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.domElement.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(r) && (this._addPointer(r), r.pointerType === "touch" ? this._onTouchStart(r) : this._onMouseDown(r)));
313
+ function _s(o) {
314
+ this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(o.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.domElement.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(o) && (this._addPointer(o), o.pointerType === "touch" ? this._onTouchStart(o) : this._onMouseDown(o)));
312
315
  }
313
- function cs(r) {
314
- this.enabled !== !1 && (r.pointerType === "touch" ? this._onTouchMove(r) : this._onMouseMove(r));
316
+ function Ts(o) {
317
+ this.enabled !== !1 && (o.pointerType === "touch" ? this._onTouchMove(o) : this._onMouseMove(o));
315
318
  }
316
- function ls(r) {
317
- switch (this._removePointer(r), this._pointers.length) {
319
+ function bs(o) {
320
+ switch (this._removePointer(o), this._pointers.length) {
318
321
  case 0:
319
- this.domElement.releasePointerCapture(r.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(ht), this.state = R.NONE;
322
+ this.domElement.releasePointerCapture(o.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(Tt), this.state = M.NONE;
320
323
  break;
321
324
  case 1:
322
325
  const e = this._pointers[0], t = this._pointerPositions[e];
@@ -324,9 +327,9 @@ function ls(r) {
324
327
  break;
325
328
  }
326
329
  }
327
- function hs(r) {
330
+ function ws(o) {
328
331
  let e;
329
- switch (r.button) {
332
+ switch (o.button) {
330
333
  case 0:
331
334
  e = this.mouseButtons.LEFT;
332
335
  break;
@@ -342,137 +345,137 @@ function hs(r) {
342
345
  switch (e) {
343
346
  case z.DOLLY:
344
347
  if (this.enableZoom === !1) return;
345
- this._handleMouseDownDolly(r), this.state = R.DOLLY;
348
+ this._handleMouseDownDolly(o), this.state = M.DOLLY;
346
349
  break;
347
350
  case z.ROTATE:
348
- if (r.ctrlKey || r.metaKey || r.shiftKey) {
351
+ if (o.ctrlKey || o.metaKey || o.shiftKey) {
349
352
  if (this.enablePan === !1) return;
350
- this._handleMouseDownPan(r), this.state = R.PAN;
353
+ this._handleMouseDownPan(o), this.state = M.PAN;
351
354
  } else {
352
355
  if (this.enableRotate === !1) return;
353
- this._handleMouseDownRotate(r), this.state = R.ROTATE;
356
+ this._handleMouseDownRotate(o), this.state = M.ROTATE;
354
357
  }
355
358
  break;
356
359
  case z.PAN:
357
- if (r.ctrlKey || r.metaKey || r.shiftKey) {
360
+ if (o.ctrlKey || o.metaKey || o.shiftKey) {
358
361
  if (this.enableRotate === !1) return;
359
- this._handleMouseDownRotate(r), this.state = R.ROTATE;
362
+ this._handleMouseDownRotate(o), this.state = M.ROTATE;
360
363
  } else {
361
364
  if (this.enablePan === !1) return;
362
- this._handleMouseDownPan(r), this.state = R.PAN;
365
+ this._handleMouseDownPan(o), this.state = M.PAN;
363
366
  }
364
367
  break;
365
368
  default:
366
- this.state = R.NONE;
369
+ this.state = M.NONE;
367
370
  }
368
- this.state !== R.NONE && this.dispatchEvent(Fe);
371
+ this.state !== M.NONE && this.dispatchEvent(Ue);
369
372
  }
370
- function us(r) {
373
+ function Es(o) {
371
374
  switch (this.state) {
372
- case R.ROTATE:
375
+ case M.ROTATE:
373
376
  if (this.enableRotate === !1) return;
374
- this._handleMouseMoveRotate(r);
377
+ this._handleMouseMoveRotate(o);
375
378
  break;
376
- case R.DOLLY:
379
+ case M.DOLLY:
377
380
  if (this.enableZoom === !1) return;
378
- this._handleMouseMoveDolly(r);
381
+ this._handleMouseMoveDolly(o);
379
382
  break;
380
- case R.PAN:
383
+ case M.PAN:
381
384
  if (this.enablePan === !1) return;
382
- this._handleMouseMovePan(r);
385
+ this._handleMouseMovePan(o);
383
386
  break;
384
387
  }
385
388
  }
386
- function ds(r) {
387
- this.enabled === !1 || this.enableZoom === !1 || this.state !== R.NONE || (r.preventDefault(), this.dispatchEvent(Fe), this._handleMouseWheel(this._customWheelEvent(r)), this.dispatchEvent(ht));
389
+ function As(o) {
390
+ this.enabled === !1 || this.enableZoom === !1 || this.state !== M.NONE || (o.preventDefault(), this.dispatchEvent(Ue), this._handleMouseWheel(this._customWheelEvent(o)), this.dispatchEvent(Tt));
388
391
  }
389
- function fs(r) {
390
- this.enabled !== !1 && this._handleKeyDown(r);
392
+ function xs(o) {
393
+ this.enabled !== !1 && this._handleKeyDown(o);
391
394
  }
392
- function ps(r) {
393
- switch (this._trackPointer(r), this._pointers.length) {
395
+ function Ms(o) {
396
+ switch (this._trackPointer(o), this._pointers.length) {
394
397
  case 1:
395
398
  switch (this.touches.ONE) {
396
- case Y.ROTATE:
399
+ case V.ROTATE:
397
400
  if (this.enableRotate === !1) return;
398
- this._handleTouchStartRotate(r), this.state = R.TOUCH_ROTATE;
401
+ this._handleTouchStartRotate(o), this.state = M.TOUCH_ROTATE;
399
402
  break;
400
- case Y.PAN:
403
+ case V.PAN:
401
404
  if (this.enablePan === !1) return;
402
- this._handleTouchStartPan(r), this.state = R.TOUCH_PAN;
405
+ this._handleTouchStartPan(o), this.state = M.TOUCH_PAN;
403
406
  break;
404
407
  default:
405
- this.state = R.NONE;
408
+ this.state = M.NONE;
406
409
  }
407
410
  break;
408
411
  case 2:
409
412
  switch (this.touches.TWO) {
410
- case Y.DOLLY_PAN:
413
+ case V.DOLLY_PAN:
411
414
  if (this.enableZoom === !1 && this.enablePan === !1) return;
412
- this._handleTouchStartDollyPan(r), this.state = R.TOUCH_DOLLY_PAN;
415
+ this._handleTouchStartDollyPan(o), this.state = M.TOUCH_DOLLY_PAN;
413
416
  break;
414
- case Y.DOLLY_ROTATE:
417
+ case V.DOLLY_ROTATE:
415
418
  if (this.enableZoom === !1 && this.enableRotate === !1) return;
416
- this._handleTouchStartDollyRotate(r), this.state = R.TOUCH_DOLLY_ROTATE;
419
+ this._handleTouchStartDollyRotate(o), this.state = M.TOUCH_DOLLY_ROTATE;
417
420
  break;
418
421
  default:
419
- this.state = R.NONE;
422
+ this.state = M.NONE;
420
423
  }
421
424
  break;
422
425
  default:
423
- this.state = R.NONE;
426
+ this.state = M.NONE;
424
427
  }
425
- this.state !== R.NONE && this.dispatchEvent(Fe);
428
+ this.state !== M.NONE && this.dispatchEvent(Ue);
426
429
  }
427
- function ms(r) {
428
- switch (this._trackPointer(r), this.state) {
429
- case R.TOUCH_ROTATE:
430
+ function Ss(o) {
431
+ switch (this._trackPointer(o), this.state) {
432
+ case M.TOUCH_ROTATE:
430
433
  if (this.enableRotate === !1) return;
431
- this._handleTouchMoveRotate(r), this.update();
434
+ this._handleTouchMoveRotate(o), this.update();
432
435
  break;
433
- case R.TOUCH_PAN:
436
+ case M.TOUCH_PAN:
434
437
  if (this.enablePan === !1) return;
435
- this._handleTouchMovePan(r), this.update();
438
+ this._handleTouchMovePan(o), this.update();
436
439
  break;
437
- case R.TOUCH_DOLLY_PAN:
440
+ case M.TOUCH_DOLLY_PAN:
438
441
  if (this.enableZoom === !1 && this.enablePan === !1) return;
439
- this._handleTouchMoveDollyPan(r), this.update();
442
+ this._handleTouchMoveDollyPan(o), this.update();
440
443
  break;
441
- case R.TOUCH_DOLLY_ROTATE:
444
+ case M.TOUCH_DOLLY_ROTATE:
442
445
  if (this.enableZoom === !1 && this.enableRotate === !1) return;
443
- this._handleTouchMoveDollyRotate(r), this.update();
446
+ this._handleTouchMoveDollyRotate(o), this.update();
444
447
  break;
445
448
  default:
446
- this.state = R.NONE;
449
+ this.state = M.NONE;
447
450
  }
448
451
  }
449
- function gs(r) {
450
- this.enabled !== !1 && r.preventDefault();
452
+ function Rs(o) {
453
+ this.enabled !== !1 && o.preventDefault();
451
454
  }
452
- function ys(r) {
453
- r.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
455
+ function Ls(o) {
456
+ o.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
454
457
  }
455
- function _s(r) {
456
- r.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
458
+ function Ds(o) {
459
+ o.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
457
460
  }
458
- class Ts extends ut {
461
+ class Ps extends bt {
459
462
  constructor(e, t) {
460
- super(e, t), this.screenSpacePanning = !1, this.mouseButtons = { LEFT: z.PAN, MIDDLE: z.DOLLY, RIGHT: z.ROTATE }, this.touches = { ONE: Y.PAN, TWO: Y.DOLLY_ROTATE };
463
+ super(e, t), this.screenSpacePanning = !1, this.mouseButtons = { LEFT: z.PAN, MIDDLE: z.DOLLY, RIGHT: z.ROTATE }, this.touches = { ONE: V.PAN, TWO: V.DOLLY_ROTATE };
461
464
  }
462
465
  }
463
- function Xe(r, e) {
464
- if (e === _t)
465
- return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), r;
466
- if (e === Ce || e === nt) {
467
- let t = r.getIndex();
466
+ function qe(o, e) {
467
+ if (e === Dt)
468
+ return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), o;
469
+ if (e === Ce || e === dt) {
470
+ let t = o.getIndex();
468
471
  if (t === null) {
469
- const i = [], c = r.getAttribute("position");
470
- if (c !== void 0) {
471
- for (let a = 0; a < c.count; a++)
472
- i.push(a);
473
- r.setIndex(i), t = r.getIndex();
472
+ const i = [], a = o.getAttribute("position");
473
+ if (a !== void 0) {
474
+ for (let c = 0; c < a.count; c++)
475
+ i.push(c);
476
+ o.setIndex(i), t = o.getIndex();
474
477
  } else
475
- return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), r;
478
+ return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), o;
476
479
  }
477
480
  const n = t.count - 2, s = [];
478
481
  if (e === Ce)
@@ -482,13 +485,13 @@ function Xe(r, e) {
482
485
  for (let i = 0; i < n; i++)
483
486
  i % 2 === 0 ? (s.push(t.getX(i)), s.push(t.getX(i + 1)), s.push(t.getX(i + 2))) : (s.push(t.getX(i + 2)), s.push(t.getX(i + 1)), s.push(t.getX(i)));
484
487
  s.length / 3 !== n && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
485
- const o = r.clone();
486
- return o.setIndex(s), o.clearGroups(), o;
488
+ const r = o.clone();
489
+ return r.setIndex(s), r.clearGroups(), r;
487
490
  } else
488
- return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), r;
491
+ return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), o;
489
492
  }
490
493
  const xe = /* @__PURE__ */ new WeakMap();
491
- class ws extends it {
494
+ class Cs extends ft {
492
495
  /**
493
496
  * Constructs a new Draco loader.
494
497
  *
@@ -545,8 +548,8 @@ class ws extends it {
545
548
  * @param {onErrorCallback} onError - Executed when errors occur.
546
549
  */
547
550
  load(e, t, n, s) {
548
- const o = new fe(this.manager);
549
- o.setPath(this.path), o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(e, (i) => {
551
+ const r = new me(this.manager);
552
+ r.setPath(this.path), r.setResponseType("arraybuffer"), r.setRequestHeader(this.requestHeader), r.setWithCredentials(this.withCredentials), r.load(e, (i) => {
550
553
  this.parse(i, t, s);
551
554
  }, n, s);
552
555
  }
@@ -559,60 +562,60 @@ class ws extends it {
559
562
  */
560
563
  parse(e, t, n = () => {
561
564
  }) {
562
- this.decodeDracoFile(e, t, null, null, $, n).catch(n);
565
+ this.decodeDracoFile(e, t, null, null, Y, n).catch(n);
563
566
  }
564
567
  //
565
- decodeDracoFile(e, t, n, s, o = j, i = () => {
568
+ decodeDracoFile(e, t, n, s, r = U, i = () => {
566
569
  }) {
567
- const c = {
570
+ const a = {
568
571
  attributeIDs: n || this.defaultAttributeIDs,
569
572
  attributeTypes: s || this.defaultAttributeTypes,
570
573
  useUniqueIDs: !!n,
571
- vertexColorSpace: o
574
+ vertexColorSpace: r
572
575
  };
573
- return this.decodeGeometry(e, c).then(t).catch(i);
576
+ return this.decodeGeometry(e, a).then(t).catch(i);
574
577
  }
575
578
  decodeGeometry(e, t) {
576
579
  const n = JSON.stringify(t);
577
580
  if (xe.has(e)) {
578
- const a = xe.get(e);
579
- if (a.key === n)
580
- return a.promise;
581
+ const c = xe.get(e);
582
+ if (c.key === n)
583
+ return c.promise;
581
584
  if (e.byteLength === 0)
582
585
  throw new Error(
583
586
  "THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred."
584
587
  );
585
588
  }
586
589
  let s;
587
- const o = this.workerNextTaskID++, i = e.byteLength, c = this._getWorker(o, i).then((a) => (s = a, new Promise((l, u) => {
588
- s._callbacks[o] = { resolve: l, reject: u }, s.postMessage({ type: "decode", id: o, taskConfig: t, buffer: e }, [e]);
589
- }))).then((a) => this._createGeometry(a.geometry));
590
- return c.catch(() => !0).then(() => {
591
- s && o && this._releaseTask(s, o);
590
+ const r = this.workerNextTaskID++, i = e.byteLength, a = this._getWorker(r, i).then((c) => (s = c, new Promise((l, u) => {
591
+ s._callbacks[r] = { resolve: l, reject: u }, s.postMessage({ type: "decode", id: r, taskConfig: t, buffer: e }, [e]);
592
+ }))).then((c) => this._createGeometry(c.geometry));
593
+ return a.catch(() => !0).then(() => {
594
+ s && r && this._releaseTask(s, r);
592
595
  }), xe.set(e, {
593
596
  key: n,
594
- promise: c
595
- }), c;
597
+ promise: a
598
+ }), a;
596
599
  }
597
600
  _createGeometry(e) {
598
- const t = new ot();
601
+ const t = new pt();
599
602
  e.index && t.setIndex(new oe(e.index.array, 1));
600
603
  for (let n = 0; n < e.attributes.length; n++) {
601
- const s = e.attributes[n], o = s.name, i = s.array, c = s.itemSize, a = new oe(i, c);
602
- o === "color" && (this._assignVertexColorSpace(a, s.vertexColorSpace), a.normalized = !(i instanceof Float32Array)), t.setAttribute(o, a);
604
+ const s = e.attributes[n], r = s.name, i = s.array, a = s.itemSize, c = new oe(i, a);
605
+ r === "color" && (this._assignVertexColorSpace(c, s.vertexColorSpace), c.normalized = !(i instanceof Float32Array)), t.setAttribute(r, c);
603
606
  }
604
607
  return t;
605
608
  }
606
609
  _assignVertexColorSpace(e, t) {
607
- if (t !== $) return;
610
+ if (t !== Y) return;
608
611
  const n = new q();
609
- for (let s = 0, o = e.count; s < o; s++)
610
- n.fromBufferAttribute(e, s), Pe.colorSpaceToWorking(n, $), e.setXYZ(s, n.r, n.g, n.b);
612
+ for (let s = 0, r = e.count; s < r; s++)
613
+ n.fromBufferAttribute(e, s), Oe.colorSpaceToWorking(n, Y), e.setXYZ(s, n.r, n.g, n.b);
611
614
  }
612
615
  _loadLibrary(e, t) {
613
- const n = new fe(this.manager);
614
- return n.setPath(this.decoderPath), n.setResponseType(t), n.setWithCredentials(this.withCredentials), new Promise((s, o) => {
615
- n.load(e, s, void 0, o);
616
+ const n = new me(this.manager);
617
+ return n.setPath(this.decoderPath), n.setResponseType(t), n.setWithCredentials(this.withCredentials), new Promise((s, r) => {
618
+ n.load(e, s, void 0, r);
616
619
  });
617
620
  }
618
621
  preload() {
@@ -624,12 +627,12 @@ class ws extends it {
624
627
  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((n) => {
625
628
  const s = n[0];
626
629
  e || (this.decoderConfig.wasmBinary = n[1]);
627
- const o = bs.toString(), i = [
630
+ const r = Os.toString(), i = [
628
631
  "/* draco decoder */",
629
632
  s,
630
633
  "",
631
634
  "/* worker */",
632
- o.substring(o.indexOf("{") + 1, o.lastIndexOf("}"))
635
+ r.substring(r.indexOf("{") + 1, r.lastIndexOf("}"))
633
636
  ].join(`
634
637
  `);
635
638
  this.workerSourceURL = URL.createObjectURL(new Blob([i]));
@@ -639,8 +642,8 @@ class ws extends it {
639
642
  return this._initDecoder().then(() => {
640
643
  if (this.workerPool.length < this.workerLimit) {
641
644
  const s = new Worker(this.workerSourceURL);
642
- s._callbacks = {}, s._taskCosts = {}, s._taskLoad = 0, s.postMessage({ type: "init", decoderConfig: this.decoderConfig }), s.onmessage = function(o) {
643
- const i = o.data;
645
+ s._callbacks = {}, s._taskCosts = {}, s._taskLoad = 0, s.postMessage({ type: "init", decoderConfig: this.decoderConfig }), s.onmessage = function(r) {
646
+ const i = r.data;
644
647
  switch (i.type) {
645
648
  case "decode":
646
649
  s._callbacks[i.id].resolve(i);
@@ -653,8 +656,8 @@ class ws extends it {
653
656
  }
654
657
  }, this.workerPool.push(s);
655
658
  } else
656
- this.workerPool.sort(function(s, o) {
657
- return s._taskLoad > o._taskLoad ? -1 : 1;
659
+ this.workerPool.sort(function(s, r) {
660
+ return s._taskLoad > r._taskLoad ? -1 : 1;
658
661
  });
659
662
  const n = this.workerPool[this.workerPool.length - 1];
660
663
  return n._taskCosts[e] = t, n._taskLoad += t, n;
@@ -672,27 +675,27 @@ class ws extends it {
672
675
  return this.workerPool.length = 0, this.workerSourceURL !== "" && URL.revokeObjectURL(this.workerSourceURL), this;
673
676
  }
674
677
  }
675
- function bs() {
676
- let r, e;
678
+ function Os() {
679
+ let o, e;
677
680
  onmessage = function(i) {
678
- const c = i.data;
679
- switch (c.type) {
681
+ const a = i.data;
682
+ switch (a.type) {
680
683
  case "init":
681
- r = c.decoderConfig, e = new Promise(function(u) {
682
- r.onModuleLoaded = function(h) {
684
+ o = a.decoderConfig, e = new Promise(function(u) {
685
+ o.onModuleLoaded = function(h) {
683
686
  u({ draco: h });
684
- }, DracoDecoderModule(r);
687
+ }, DracoDecoderModule(o);
685
688
  });
686
689
  break;
687
690
  case "decode":
688
- const a = c.buffer, l = c.taskConfig;
691
+ const c = a.buffer, l = a.taskConfig;
689
692
  e.then((u) => {
690
693
  const h = u.draco, p = new h.Decoder();
691
694
  try {
692
- const m = t(h, p, new Int8Array(a), l), _ = m.attributes.map((w) => w.array.buffer);
693
- m.index && _.push(m.index.array.buffer), self.postMessage({ type: "decode", id: c.id, geometry: m }, _);
695
+ const m = t(h, p, new Int8Array(c), l), _ = m.attributes.map((b) => b.array.buffer);
696
+ m.index && _.push(m.index.array.buffer), self.postMessage({ type: "decode", id: a.id, geometry: m }, _);
694
697
  } catch (m) {
695
- console.error(m), self.postMessage({ type: "error", id: c.id, error: m.message });
698
+ console.error(m), self.postMessage({ type: "error", id: a.id, error: m.message });
696
699
  } finally {
697
700
  h.destroy(p);
698
701
  }
@@ -700,42 +703,42 @@ function bs() {
700
703
  break;
701
704
  }
702
705
  };
703
- function t(i, c, a, l) {
706
+ function t(i, a, c, l) {
704
707
  const u = l.attributeIDs, h = l.attributeTypes;
705
708
  let p, m;
706
- const _ = c.GetEncodedGeometryType(a);
709
+ const _ = a.GetEncodedGeometryType(c);
707
710
  if (_ === i.TRIANGULAR_MESH)
708
- p = new i.Mesh(), m = c.DecodeArrayToMesh(a, a.byteLength, p);
711
+ p = new i.Mesh(), m = a.DecodeArrayToMesh(c, c.byteLength, p);
709
712
  else if (_ === i.POINT_CLOUD)
710
- p = new i.PointCloud(), m = c.DecodeArrayToPointCloud(a, a.byteLength, p);
713
+ p = new i.PointCloud(), m = a.DecodeArrayToPointCloud(c, c.byteLength, p);
711
714
  else
712
715
  throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
713
716
  if (!m.ok() || p.ptr === 0)
714
717
  throw new Error("THREE.DRACOLoader: Decoding failed: " + m.error_msg());
715
- const w = { index: null, attributes: [] };
718
+ const b = { index: null, attributes: [] };
716
719
  for (const d in u) {
717
720
  const f = self[h[d]];
718
721
  let g, T;
719
722
  if (l.useUniqueIDs)
720
- T = u[d], g = c.GetAttributeByUniqueId(p, T);
723
+ T = u[d], g = a.GetAttributeByUniqueId(p, T);
721
724
  else {
722
- if (T = c.GetAttributeId(p, i[u[d]]), T === -1) continue;
723
- g = c.GetAttribute(p, T);
725
+ if (T = a.GetAttributeId(p, i[u[d]]), T === -1) continue;
726
+ g = a.GetAttribute(p, T);
724
727
  }
725
- const y = s(i, c, p, d, f, g);
726
- d === "color" && (y.vertexColorSpace = l.vertexColorSpace), w.attributes.push(y);
728
+ const y = s(i, a, p, d, f, g);
729
+ d === "color" && (y.vertexColorSpace = l.vertexColorSpace), b.attributes.push(y);
727
730
  }
728
- return _ === i.TRIANGULAR_MESH && (w.index = n(i, c, p)), i.destroy(p), w;
731
+ return _ === i.TRIANGULAR_MESH && (b.index = n(i, a, p)), i.destroy(p), b;
729
732
  }
730
- function n(i, c, a) {
731
- const u = a.num_faces() * 3, h = u * 4, p = i._malloc(h);
732
- c.GetTrianglesUInt32Array(a, h, p);
733
+ function n(i, a, c) {
734
+ const u = c.num_faces() * 3, h = u * 4, p = i._malloc(h);
735
+ a.GetTrianglesUInt32Array(c, h, p);
733
736
  const m = new Uint32Array(i.HEAPF32.buffer, p, u).slice();
734
737
  return i._free(p), { array: m, itemSize: 1 };
735
738
  }
736
- function s(i, c, a, l, u, h) {
737
- const p = h.num_components(), _ = a.num_points() * p, w = _ * u.BYTES_PER_ELEMENT, d = o(i, u), f = i._malloc(w);
738
- c.GetAttributeDataArrayForAllPoints(a, h, d, w, f);
739
+ function s(i, a, c, l, u, h) {
740
+ const p = h.num_components(), _ = c.num_points() * p, b = _ * u.BYTES_PER_ELEMENT, d = r(i, u), f = i._malloc(b);
741
+ a.GetAttributeDataArrayForAllPoints(c, h, d, b, f);
739
742
  const g = new u(i.HEAPF32.buffer, f, _).slice();
740
743
  return i._free(f), {
741
744
  name: l,
@@ -743,8 +746,8 @@ function bs() {
743
746
  itemSize: p
744
747
  };
745
748
  }
746
- function o(i, c) {
747
- switch (c) {
749
+ function r(i, a) {
750
+ switch (a) {
748
751
  case Float32Array:
749
752
  return i.DT_FLOAT32;
750
753
  case Int8Array:
@@ -762,7 +765,7 @@ function bs() {
762
765
  }
763
766
  }
764
767
  }
765
- class Es extends it {
768
+ class Is extends ft {
766
769
  /**
767
770
  * Constructs a new glTF loader.
768
771
  *
@@ -770,39 +773,39 @@ class Es extends it {
770
773
  */
771
774
  constructor(e) {
772
775
  super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
773
- return new Ss(t);
776
+ return new Fs(t);
777
+ }), this.register(function(t) {
778
+ return new Us(t);
774
779
  }), this.register(function(t) {
775
- return new Ls(t);
780
+ return new Ys(t);
776
781
  }), this.register(function(t) {
777
- return new Hs(t);
782
+ return new qs(t);
778
783
  }), this.register(function(t) {
779
- return new Fs(t);
784
+ return new $s(t);
780
785
  }), this.register(function(t) {
781
- return new Us(t);
786
+ return new js(t);
782
787
  }), this.register(function(t) {
783
- return new Cs(t);
788
+ return new zs(t);
784
789
  }), this.register(function(t) {
785
- return new Ps(t);
790
+ return new Bs(t);
786
791
  }), this.register(function(t) {
787
- return new Os(t);
792
+ return new Ks(t);
788
793
  }), this.register(function(t) {
789
- return new Is(t);
794
+ return new Hs(t);
790
795
  }), this.register(function(t) {
791
- return new Ms(t);
796
+ return new Ws(t);
792
797
  }), this.register(function(t) {
793
- return new ks(t);
798
+ return new Gs(t);
794
799
  }), this.register(function(t) {
795
- return new Ds(t);
800
+ return new Vs(t);
796
801
  }), this.register(function(t) {
797
- return new vs(t);
802
+ return new Xs(t);
798
803
  }), this.register(function(t) {
799
804
  return new Ns(t);
800
805
  }), this.register(function(t) {
801
- return new As(t);
802
- }), this.register(function(t) {
803
- return new js(t);
806
+ return new Zs(t);
804
807
  }), this.register(function(t) {
805
- return new Gs(t);
808
+ return new Qs(t);
806
809
  });
807
810
  }
808
811
  /**
@@ -815,28 +818,28 @@ class Es extends it {
815
818
  * @param {onErrorCallback} onError - Executed when errors occur.
816
819
  */
817
820
  load(e, t, n, s) {
818
- const o = this;
821
+ const r = this;
819
822
  let i;
820
823
  if (this.resourcePath !== "")
821
824
  i = this.resourcePath;
822
825
  else if (this.path !== "") {
823
- const l = re.extractUrlBase(e);
824
- i = re.resolveURL(l, this.path);
826
+ const l = ae.extractUrlBase(e);
827
+ i = ae.resolveURL(l, this.path);
825
828
  } else
826
- i = re.extractUrlBase(e);
829
+ i = ae.extractUrlBase(e);
827
830
  this.manager.itemStart(e);
828
- const c = function(l) {
829
- s ? s(l) : console.error(l), o.manager.itemError(e), o.manager.itemEnd(e);
830
- }, a = new fe(this.manager);
831
- a.setPath(this.path), a.setResponseType("arraybuffer"), a.setRequestHeader(this.requestHeader), a.setWithCredentials(this.withCredentials), a.load(e, function(l) {
831
+ const a = function(l) {
832
+ s ? s(l) : console.error(l), r.manager.itemError(e), r.manager.itemEnd(e);
833
+ }, c = new me(this.manager);
834
+ c.setPath(this.path), c.setResponseType("arraybuffer"), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(e, function(l) {
832
835
  try {
833
- o.parse(l, i, function(u) {
834
- t(u), o.manager.itemEnd(e);
835
- }, c);
836
+ r.parse(l, i, function(u) {
837
+ t(u), r.manager.itemEnd(e);
838
+ }, a);
836
839
  } catch (u) {
837
- c(u);
840
+ a(u);
838
841
  }
839
- }, n, c);
842
+ }, n, a);
840
843
  }
841
844
  /**
842
845
  * Sets the given Draco loader to this loader. Required for decoding assets
@@ -897,28 +900,28 @@ class Es extends it {
897
900
  * @param {onErrorCallback} onError - Executed when errors occur.
898
901
  */
899
902
  parse(e, t, n, s) {
900
- let o;
901
- const i = {}, c = {}, a = new TextDecoder();
903
+ let r;
904
+ const i = {}, a = {}, c = new TextDecoder();
902
905
  if (typeof e == "string")
903
- o = JSON.parse(e);
906
+ r = JSON.parse(e);
904
907
  else if (e instanceof ArrayBuffer)
905
- if (a.decode(new Uint8Array(e, 0, 4)) === dt) {
908
+ if (c.decode(new Uint8Array(e, 0, 4)) === wt) {
906
909
  try {
907
- i[b.KHR_BINARY_GLTF] = new Bs(e);
910
+ i[w.KHR_BINARY_GLTF] = new Js(e);
908
911
  } catch (h) {
909
912
  s && s(h);
910
913
  return;
911
914
  }
912
- o = JSON.parse(i[b.KHR_BINARY_GLTF].content);
915
+ r = JSON.parse(i[w.KHR_BINARY_GLTF].content);
913
916
  } else
914
- o = JSON.parse(a.decode(e));
917
+ r = JSON.parse(c.decode(e));
915
918
  else
916
- o = e;
917
- if (o.asset === void 0 || o.asset.version[0] < 2) {
919
+ r = e;
920
+ if (r.asset === void 0 || r.asset.version[0] < 2) {
918
921
  s && s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
919
922
  return;
920
923
  }
921
- const l = new tn(o, {
924
+ const l = new fn(r, {
922
925
  path: t || this.resourcePath || "",
923
926
  crossOrigin: this.crossOrigin,
924
927
  requestHeader: this.requestHeader,
@@ -929,29 +932,29 @@ class Es extends it {
929
932
  l.fileLoader.setRequestHeader(this.requestHeader);
930
933
  for (let u = 0; u < this.pluginCallbacks.length; u++) {
931
934
  const h = this.pluginCallbacks[u](l);
932
- h.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), c[h.name] = h, i[h.name] = !0;
935
+ h.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), a[h.name] = h, i[h.name] = !0;
933
936
  }
934
- if (o.extensionsUsed)
935
- for (let u = 0; u < o.extensionsUsed.length; ++u) {
936
- const h = o.extensionsUsed[u], p = o.extensionsRequired || [];
937
+ if (r.extensionsUsed)
938
+ for (let u = 0; u < r.extensionsUsed.length; ++u) {
939
+ const h = r.extensionsUsed[u], p = r.extensionsRequired || [];
937
940
  switch (h) {
938
- case b.KHR_MATERIALS_UNLIT:
939
- i[h] = new Rs();
941
+ case w.KHR_MATERIALS_UNLIT:
942
+ i[h] = new vs();
940
943
  break;
941
- case b.KHR_DRACO_MESH_COMPRESSION:
942
- i[h] = new zs(o, this.dracoLoader);
944
+ case w.KHR_DRACO_MESH_COMPRESSION:
945
+ i[h] = new en(r, this.dracoLoader);
943
946
  break;
944
- case b.KHR_TEXTURE_TRANSFORM:
945
- i[h] = new Ks();
947
+ case w.KHR_TEXTURE_TRANSFORM:
948
+ i[h] = new tn();
946
949
  break;
947
- case b.KHR_MESH_QUANTIZATION:
948
- i[h] = new Ws();
950
+ case w.KHR_MESH_QUANTIZATION:
951
+ i[h] = new sn();
949
952
  break;
950
953
  default:
951
- p.indexOf(h) >= 0 && c[h] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + h + '".');
954
+ p.indexOf(h) >= 0 && a[h] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + h + '".');
952
955
  }
953
956
  }
954
- l.setExtensions(i), l.setPlugins(c), l.parse(n, s);
957
+ l.setExtensions(i), l.setPlugins(a), l.parse(n, s);
955
958
  }
956
959
  /**
957
960
  * Async version of {@link GLTFLoader#parse}.
@@ -963,29 +966,29 @@ class Es extends it {
963
966
  */
964
967
  parseAsync(e, t) {
965
968
  const n = this;
966
- return new Promise(function(s, o) {
967
- n.parse(e, t, s, o);
969
+ return new Promise(function(s, r) {
970
+ n.parse(e, t, s, r);
968
971
  });
969
972
  }
970
973
  }
971
- function xs() {
972
- let r = {};
974
+ function ks() {
975
+ let o = {};
973
976
  return {
974
977
  get: function(e) {
975
- return r[e];
978
+ return o[e];
976
979
  },
977
980
  add: function(e, t) {
978
- r[e] = t;
981
+ o[e] = t;
979
982
  },
980
983
  remove: function(e) {
981
- delete r[e];
984
+ delete o[e];
982
985
  },
983
986
  removeAll: function() {
984
- r = {};
987
+ o = {};
985
988
  }
986
989
  };
987
990
  }
988
- const b = {
991
+ const w = {
989
992
  KHR_BINARY_GLTF: "KHR_binary_glTF",
990
993
  KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
991
994
  KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
@@ -1009,88 +1012,88 @@ const b = {
1009
1012
  EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
1010
1013
  EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
1011
1014
  };
1012
- class As {
1015
+ class Ns {
1013
1016
  constructor(e) {
1014
- this.parser = e, this.name = b.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
1017
+ this.parser = e, this.name = w.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
1015
1018
  }
1016
1019
  _markDefs() {
1017
1020
  const e = this.parser, t = this.parser.json.nodes || [];
1018
1021
  for (let n = 0, s = t.length; n < s; n++) {
1019
- const o = t[n];
1020
- o.extensions && o.extensions[this.name] && o.extensions[this.name].light !== void 0 && e._addNodeRef(this.cache, o.extensions[this.name].light);
1022
+ const r = t[n];
1023
+ r.extensions && r.extensions[this.name] && r.extensions[this.name].light !== void 0 && e._addNodeRef(this.cache, r.extensions[this.name].light);
1021
1024
  }
1022
1025
  }
1023
1026
  _loadLight(e) {
1024
1027
  const t = this.parser, n = "light:" + e;
1025
1028
  let s = t.cache.get(n);
1026
1029
  if (s) return s;
1027
- const o = t.json, a = ((o.extensions && o.extensions[this.name] || {}).lights || [])[e];
1030
+ const r = t.json, c = ((r.extensions && r.extensions[this.name] || {}).lights || [])[e];
1028
1031
  let l;
1029
1032
  const u = new q(16777215);
1030
- a.color !== void 0 && u.setRGB(a.color[0], a.color[1], a.color[2], j);
1031
- const h = a.range !== void 0 ? a.range : 0;
1032
- switch (a.type) {
1033
+ c.color !== void 0 && u.setRGB(c.color[0], c.color[1], c.color[2], U);
1034
+ const h = c.range !== void 0 ? c.range : 0;
1035
+ switch (c.type) {
1033
1036
  case "directional":
1034
- l = new bt(u), l.target.position.set(0, 0, -1), l.add(l.target);
1037
+ l = new Ot(u), l.target.position.set(0, 0, -1), l.add(l.target);
1035
1038
  break;
1036
1039
  case "point":
1037
- l = new wt(u), l.distance = h;
1040
+ l = new Ct(u), l.distance = h;
1038
1041
  break;
1039
1042
  case "spot":
1040
- l = new Tt(u), l.distance = h, a.spot = a.spot || {}, a.spot.innerConeAngle = a.spot.innerConeAngle !== void 0 ? a.spot.innerConeAngle : 0, a.spot.outerConeAngle = a.spot.outerConeAngle !== void 0 ? a.spot.outerConeAngle : Math.PI / 4, l.angle = a.spot.outerConeAngle, l.penumbra = 1 - a.spot.innerConeAngle / a.spot.outerConeAngle, l.target.position.set(0, 0, -1), l.add(l.target);
1043
+ l = new Pt(u), l.distance = h, c.spot = c.spot || {}, c.spot.innerConeAngle = c.spot.innerConeAngle !== void 0 ? c.spot.innerConeAngle : 0, c.spot.outerConeAngle = c.spot.outerConeAngle !== void 0 ? c.spot.outerConeAngle : Math.PI / 4, l.angle = c.spot.outerConeAngle, l.penumbra = 1 - c.spot.innerConeAngle / c.spot.outerConeAngle, l.target.position.set(0, 0, -1), l.add(l.target);
1041
1044
  break;
1042
1045
  default:
1043
- throw new Error("THREE.GLTFLoader: Unexpected light type: " + a.type);
1046
+ throw new Error("THREE.GLTFLoader: Unexpected light type: " + c.type);
1044
1047
  }
1045
- return l.position.set(0, 0, 0), B(l, a), a.intensity !== void 0 && (l.intensity = a.intensity), l.name = t.createUniqueName(a.name || "light_" + e), s = Promise.resolve(l), t.cache.add(n, s), s;
1048
+ return l.position.set(0, 0, 0), j(l, c), c.intensity !== void 0 && (l.intensity = c.intensity), l.name = t.createUniqueName(c.name || "light_" + e), s = Promise.resolve(l), t.cache.add(n, s), s;
1046
1049
  }
1047
1050
  getDependency(e, t) {
1048
1051
  if (e === "light")
1049
1052
  return this._loadLight(t);
1050
1053
  }
1051
1054
  createNodeAttachment(e) {
1052
- const t = this, n = this.parser, o = n.json.nodes[e], c = (o.extensions && o.extensions[this.name] || {}).light;
1053
- return c === void 0 ? null : this._loadLight(c).then(function(a) {
1054
- return n._getNodeRef(t.cache, c, a);
1055
+ const t = this, n = this.parser, r = n.json.nodes[e], a = (r.extensions && r.extensions[this.name] || {}).light;
1056
+ return a === void 0 ? null : this._loadLight(a).then(function(c) {
1057
+ return n._getNodeRef(t.cache, a, c);
1055
1058
  });
1056
1059
  }
1057
1060
  }
1058
- class Rs {
1061
+ class vs {
1059
1062
  constructor() {
1060
- this.name = b.KHR_MATERIALS_UNLIT;
1063
+ this.name = w.KHR_MATERIALS_UNLIT;
1061
1064
  }
1062
1065
  getMaterialType() {
1063
- return ie;
1066
+ return re;
1064
1067
  }
1065
1068
  extendParams(e, t, n) {
1066
1069
  const s = [];
1067
1070
  e.color = new q(1, 1, 1), e.opacity = 1;
1068
- const o = t.pbrMetallicRoughness;
1069
- if (o) {
1070
- if (Array.isArray(o.baseColorFactor)) {
1071
- const i = o.baseColorFactor;
1072
- e.color.setRGB(i[0], i[1], i[2], j), e.opacity = i[3];
1071
+ const r = t.pbrMetallicRoughness;
1072
+ if (r) {
1073
+ if (Array.isArray(r.baseColorFactor)) {
1074
+ const i = r.baseColorFactor;
1075
+ e.color.setRGB(i[0], i[1], i[2], U), e.opacity = i[3];
1073
1076
  }
1074
- o.baseColorTexture !== void 0 && s.push(n.assignTexture(e, "map", o.baseColorTexture, $));
1077
+ r.baseColorTexture !== void 0 && s.push(n.assignTexture(e, "map", r.baseColorTexture, Y));
1075
1078
  }
1076
1079
  return Promise.all(s);
1077
1080
  }
1078
1081
  }
1079
- class Ms {
1082
+ class Hs {
1080
1083
  constructor(e) {
1081
- this.parser = e, this.name = b.KHR_MATERIALS_EMISSIVE_STRENGTH;
1084
+ this.parser = e, this.name = w.KHR_MATERIALS_EMISSIVE_STRENGTH;
1082
1085
  }
1083
1086
  extendMaterialParams(e, t) {
1084
1087
  const s = this.parser.json.materials[e];
1085
1088
  if (!s.extensions || !s.extensions[this.name])
1086
1089
  return Promise.resolve();
1087
- const o = s.extensions[this.name].emissiveStrength;
1088
- return o !== void 0 && (t.emissiveIntensity = o), Promise.resolve();
1090
+ const r = s.extensions[this.name].emissiveStrength;
1091
+ return r !== void 0 && (t.emissiveIntensity = r), Promise.resolve();
1089
1092
  }
1090
1093
  }
1091
- class Ss {
1094
+ class Fs {
1092
1095
  constructor(e) {
1093
- this.parser = e, this.name = b.KHR_MATERIALS_CLEARCOAT;
1096
+ this.parser = e, this.name = w.KHR_MATERIALS_CLEARCOAT;
1094
1097
  }
1095
1098
  getMaterialType(e) {
1096
1099
  const n = this.parser.json.materials[e];
@@ -1100,17 +1103,17 @@ class Ss {
1100
1103
  const n = this.parser, s = n.json.materials[e];
1101
1104
  if (!s.extensions || !s.extensions[this.name])
1102
1105
  return Promise.resolve();
1103
- const o = [], i = s.extensions[this.name];
1104
- if (i.clearcoatFactor !== void 0 && (t.clearcoat = i.clearcoatFactor), i.clearcoatTexture !== void 0 && o.push(n.assignTexture(t, "clearcoatMap", i.clearcoatTexture)), i.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = i.clearcoatRoughnessFactor), i.clearcoatRoughnessTexture !== void 0 && o.push(n.assignTexture(t, "clearcoatRoughnessMap", i.clearcoatRoughnessTexture)), i.clearcoatNormalTexture !== void 0 && (o.push(n.assignTexture(t, "clearcoatNormalMap", i.clearcoatNormalTexture)), i.clearcoatNormalTexture.scale !== void 0)) {
1105
- const c = i.clearcoatNormalTexture.scale;
1106
- t.clearcoatNormalScale = new I(c, c);
1106
+ const r = [], i = s.extensions[this.name];
1107
+ if (i.clearcoatFactor !== void 0 && (t.clearcoat = i.clearcoatFactor), i.clearcoatTexture !== void 0 && r.push(n.assignTexture(t, "clearcoatMap", i.clearcoatTexture)), i.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = i.clearcoatRoughnessFactor), i.clearcoatRoughnessTexture !== void 0 && r.push(n.assignTexture(t, "clearcoatRoughnessMap", i.clearcoatRoughnessTexture)), i.clearcoatNormalTexture !== void 0 && (r.push(n.assignTexture(t, "clearcoatNormalMap", i.clearcoatNormalTexture)), i.clearcoatNormalTexture.scale !== void 0)) {
1108
+ const a = i.clearcoatNormalTexture.scale;
1109
+ t.clearcoatNormalScale = new I(a, a);
1107
1110
  }
1108
- return Promise.all(o);
1111
+ return Promise.all(r);
1109
1112
  }
1110
1113
  }
1111
- class Ls {
1114
+ class Us {
1112
1115
  constructor(e) {
1113
- this.parser = e, this.name = b.KHR_MATERIALS_DISPERSION;
1116
+ this.parser = e, this.name = w.KHR_MATERIALS_DISPERSION;
1114
1117
  }
1115
1118
  getMaterialType(e) {
1116
1119
  const n = this.parser.json.materials[e];
@@ -1120,13 +1123,13 @@ class Ls {
1120
1123
  const s = this.parser.json.materials[e];
1121
1124
  if (!s.extensions || !s.extensions[this.name])
1122
1125
  return Promise.resolve();
1123
- const o = s.extensions[this.name];
1124
- return t.dispersion = o.dispersion !== void 0 ? o.dispersion : 0, Promise.resolve();
1126
+ const r = s.extensions[this.name];
1127
+ return t.dispersion = r.dispersion !== void 0 ? r.dispersion : 0, Promise.resolve();
1125
1128
  }
1126
1129
  }
1127
- class Ds {
1130
+ class Gs {
1128
1131
  constructor(e) {
1129
- this.parser = e, this.name = b.KHR_MATERIALS_IRIDESCENCE;
1132
+ this.parser = e, this.name = w.KHR_MATERIALS_IRIDESCENCE;
1130
1133
  }
1131
1134
  getMaterialType(e) {
1132
1135
  const n = this.parser.json.materials[e];
@@ -1136,13 +1139,13 @@ class Ds {
1136
1139
  const n = this.parser, s = n.json.materials[e];
1137
1140
  if (!s.extensions || !s.extensions[this.name])
1138
1141
  return Promise.resolve();
1139
- const o = [], i = s.extensions[this.name];
1140
- return i.iridescenceFactor !== void 0 && (t.iridescence = i.iridescenceFactor), i.iridescenceTexture !== void 0 && o.push(n.assignTexture(t, "iridescenceMap", i.iridescenceTexture)), i.iridescenceIor !== void 0 && (t.iridescenceIOR = i.iridescenceIor), t.iridescenceThicknessRange === void 0 && (t.iridescenceThicknessRange = [100, 400]), i.iridescenceThicknessMinimum !== void 0 && (t.iridescenceThicknessRange[0] = i.iridescenceThicknessMinimum), i.iridescenceThicknessMaximum !== void 0 && (t.iridescenceThicknessRange[1] = i.iridescenceThicknessMaximum), i.iridescenceThicknessTexture !== void 0 && o.push(n.assignTexture(t, "iridescenceThicknessMap", i.iridescenceThicknessTexture)), Promise.all(o);
1142
+ const r = [], i = s.extensions[this.name];
1143
+ return i.iridescenceFactor !== void 0 && (t.iridescence = i.iridescenceFactor), i.iridescenceTexture !== void 0 && r.push(n.assignTexture(t, "iridescenceMap", i.iridescenceTexture)), i.iridescenceIor !== void 0 && (t.iridescenceIOR = i.iridescenceIor), t.iridescenceThicknessRange === void 0 && (t.iridescenceThicknessRange = [100, 400]), i.iridescenceThicknessMinimum !== void 0 && (t.iridescenceThicknessRange[0] = i.iridescenceThicknessMinimum), i.iridescenceThicknessMaximum !== void 0 && (t.iridescenceThicknessRange[1] = i.iridescenceThicknessMaximum), i.iridescenceThicknessTexture !== void 0 && r.push(n.assignTexture(t, "iridescenceThicknessMap", i.iridescenceThicknessTexture)), Promise.all(r);
1141
1144
  }
1142
1145
  }
1143
- class Cs {
1146
+ class js {
1144
1147
  constructor(e) {
1145
- this.parser = e, this.name = b.KHR_MATERIALS_SHEEN;
1148
+ this.parser = e, this.name = w.KHR_MATERIALS_SHEEN;
1146
1149
  }
1147
1150
  getMaterialType(e) {
1148
1151
  const n = this.parser.json.materials[e];
@@ -1152,19 +1155,19 @@ class Cs {
1152
1155
  const n = this.parser, s = n.json.materials[e];
1153
1156
  if (!s.extensions || !s.extensions[this.name])
1154
1157
  return Promise.resolve();
1155
- const o = [];
1158
+ const r = [];
1156
1159
  t.sheenColor = new q(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1;
1157
1160
  const i = s.extensions[this.name];
1158
1161
  if (i.sheenColorFactor !== void 0) {
1159
- const c = i.sheenColorFactor;
1160
- t.sheenColor.setRGB(c[0], c[1], c[2], j);
1162
+ const a = i.sheenColorFactor;
1163
+ t.sheenColor.setRGB(a[0], a[1], a[2], U);
1161
1164
  }
1162
- return i.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = i.sheenRoughnessFactor), i.sheenColorTexture !== void 0 && o.push(n.assignTexture(t, "sheenColorMap", i.sheenColorTexture, $)), i.sheenRoughnessTexture !== void 0 && o.push(n.assignTexture(t, "sheenRoughnessMap", i.sheenRoughnessTexture)), Promise.all(o);
1165
+ return i.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = i.sheenRoughnessFactor), i.sheenColorTexture !== void 0 && r.push(n.assignTexture(t, "sheenColorMap", i.sheenColorTexture, Y)), i.sheenRoughnessTexture !== void 0 && r.push(n.assignTexture(t, "sheenRoughnessMap", i.sheenRoughnessTexture)), Promise.all(r);
1163
1166
  }
1164
1167
  }
1165
- class Ps {
1168
+ class zs {
1166
1169
  constructor(e) {
1167
- this.parser = e, this.name = b.KHR_MATERIALS_TRANSMISSION;
1170
+ this.parser = e, this.name = w.KHR_MATERIALS_TRANSMISSION;
1168
1171
  }
1169
1172
  getMaterialType(e) {
1170
1173
  const n = this.parser.json.materials[e];
@@ -1174,13 +1177,13 @@ class Ps {
1174
1177
  const n = this.parser, s = n.json.materials[e];
1175
1178
  if (!s.extensions || !s.extensions[this.name])
1176
1179
  return Promise.resolve();
1177
- const o = [], i = s.extensions[this.name];
1178
- return i.transmissionFactor !== void 0 && (t.transmission = i.transmissionFactor), i.transmissionTexture !== void 0 && o.push(n.assignTexture(t, "transmissionMap", i.transmissionTexture)), Promise.all(o);
1180
+ const r = [], i = s.extensions[this.name];
1181
+ return i.transmissionFactor !== void 0 && (t.transmission = i.transmissionFactor), i.transmissionTexture !== void 0 && r.push(n.assignTexture(t, "transmissionMap", i.transmissionTexture)), Promise.all(r);
1179
1182
  }
1180
1183
  }
1181
- class Os {
1184
+ class Bs {
1182
1185
  constructor(e) {
1183
- this.parser = e, this.name = b.KHR_MATERIALS_VOLUME;
1186
+ this.parser = e, this.name = w.KHR_MATERIALS_VOLUME;
1184
1187
  }
1185
1188
  getMaterialType(e) {
1186
1189
  const n = this.parser.json.materials[e];
@@ -1190,15 +1193,15 @@ class Os {
1190
1193
  const n = this.parser, s = n.json.materials[e];
1191
1194
  if (!s.extensions || !s.extensions[this.name])
1192
1195
  return Promise.resolve();
1193
- const o = [], i = s.extensions[this.name];
1194
- t.thickness = i.thicknessFactor !== void 0 ? i.thicknessFactor : 0, i.thicknessTexture !== void 0 && o.push(n.assignTexture(t, "thicknessMap", i.thicknessTexture)), t.attenuationDistance = i.attenuationDistance || 1 / 0;
1195
- const c = i.attenuationColor || [1, 1, 1];
1196
- return t.attenuationColor = new q().setRGB(c[0], c[1], c[2], j), Promise.all(o);
1196
+ const r = [], i = s.extensions[this.name];
1197
+ t.thickness = i.thicknessFactor !== void 0 ? i.thicknessFactor : 0, i.thicknessTexture !== void 0 && r.push(n.assignTexture(t, "thicknessMap", i.thicknessTexture)), t.attenuationDistance = i.attenuationDistance || 1 / 0;
1198
+ const a = i.attenuationColor || [1, 1, 1];
1199
+ return t.attenuationColor = new q().setRGB(a[0], a[1], a[2], U), Promise.all(r);
1197
1200
  }
1198
1201
  }
1199
- class Is {
1202
+ class Ks {
1200
1203
  constructor(e) {
1201
- this.parser = e, this.name = b.KHR_MATERIALS_IOR;
1204
+ this.parser = e, this.name = w.KHR_MATERIALS_IOR;
1202
1205
  }
1203
1206
  getMaterialType(e) {
1204
1207
  const n = this.parser.json.materials[e];
@@ -1208,13 +1211,13 @@ class Is {
1208
1211
  const s = this.parser.json.materials[e];
1209
1212
  if (!s.extensions || !s.extensions[this.name])
1210
1213
  return Promise.resolve();
1211
- const o = s.extensions[this.name];
1212
- return t.ior = o.ior !== void 0 ? o.ior : 1.5, Promise.resolve();
1214
+ const r = s.extensions[this.name];
1215
+ return t.ior = r.ior !== void 0 ? r.ior : 1.5, Promise.resolve();
1213
1216
  }
1214
1217
  }
1215
- class ks {
1218
+ class Ws {
1216
1219
  constructor(e) {
1217
- this.parser = e, this.name = b.KHR_MATERIALS_SPECULAR;
1220
+ this.parser = e, this.name = w.KHR_MATERIALS_SPECULAR;
1218
1221
  }
1219
1222
  getMaterialType(e) {
1220
1223
  const n = this.parser.json.materials[e];
@@ -1224,15 +1227,15 @@ class ks {
1224
1227
  const n = this.parser, s = n.json.materials[e];
1225
1228
  if (!s.extensions || !s.extensions[this.name])
1226
1229
  return Promise.resolve();
1227
- const o = [], i = s.extensions[this.name];
1228
- t.specularIntensity = i.specularFactor !== void 0 ? i.specularFactor : 1, i.specularTexture !== void 0 && o.push(n.assignTexture(t, "specularIntensityMap", i.specularTexture));
1229
- const c = i.specularColorFactor || [1, 1, 1];
1230
- return t.specularColor = new q().setRGB(c[0], c[1], c[2], j), i.specularColorTexture !== void 0 && o.push(n.assignTexture(t, "specularColorMap", i.specularColorTexture, $)), Promise.all(o);
1230
+ const r = [], i = s.extensions[this.name];
1231
+ t.specularIntensity = i.specularFactor !== void 0 ? i.specularFactor : 1, i.specularTexture !== void 0 && r.push(n.assignTexture(t, "specularIntensityMap", i.specularTexture));
1232
+ const a = i.specularColorFactor || [1, 1, 1];
1233
+ return t.specularColor = new q().setRGB(a[0], a[1], a[2], U), i.specularColorTexture !== void 0 && r.push(n.assignTexture(t, "specularColorMap", i.specularColorTexture, Y)), Promise.all(r);
1231
1234
  }
1232
1235
  }
1233
- class Ns {
1236
+ class Xs {
1234
1237
  constructor(e) {
1235
- this.parser = e, this.name = b.EXT_MATERIALS_BUMP;
1238
+ this.parser = e, this.name = w.EXT_MATERIALS_BUMP;
1236
1239
  }
1237
1240
  getMaterialType(e) {
1238
1241
  const n = this.parser.json.materials[e];
@@ -1242,13 +1245,13 @@ class Ns {
1242
1245
  const n = this.parser, s = n.json.materials[e];
1243
1246
  if (!s.extensions || !s.extensions[this.name])
1244
1247
  return Promise.resolve();
1245
- const o = [], i = s.extensions[this.name];
1246
- return t.bumpScale = i.bumpFactor !== void 0 ? i.bumpFactor : 1, i.bumpTexture !== void 0 && o.push(n.assignTexture(t, "bumpMap", i.bumpTexture)), Promise.all(o);
1248
+ const r = [], i = s.extensions[this.name];
1249
+ return t.bumpScale = i.bumpFactor !== void 0 ? i.bumpFactor : 1, i.bumpTexture !== void 0 && r.push(n.assignTexture(t, "bumpMap", i.bumpTexture)), Promise.all(r);
1247
1250
  }
1248
1251
  }
1249
- class vs {
1252
+ class Vs {
1250
1253
  constructor(e) {
1251
- this.parser = e, this.name = b.KHR_MATERIALS_ANISOTROPY;
1254
+ this.parser = e, this.name = w.KHR_MATERIALS_ANISOTROPY;
1252
1255
  }
1253
1256
  getMaterialType(e) {
1254
1257
  const n = this.parser.json.materials[e];
@@ -1258,76 +1261,76 @@ class vs {
1258
1261
  const n = this.parser, s = n.json.materials[e];
1259
1262
  if (!s.extensions || !s.extensions[this.name])
1260
1263
  return Promise.resolve();
1261
- const o = [], i = s.extensions[this.name];
1262
- return i.anisotropyStrength !== void 0 && (t.anisotropy = i.anisotropyStrength), i.anisotropyRotation !== void 0 && (t.anisotropyRotation = i.anisotropyRotation), i.anisotropyTexture !== void 0 && o.push(n.assignTexture(t, "anisotropyMap", i.anisotropyTexture)), Promise.all(o);
1264
+ const r = [], i = s.extensions[this.name];
1265
+ return i.anisotropyStrength !== void 0 && (t.anisotropy = i.anisotropyStrength), i.anisotropyRotation !== void 0 && (t.anisotropyRotation = i.anisotropyRotation), i.anisotropyTexture !== void 0 && r.push(n.assignTexture(t, "anisotropyMap", i.anisotropyTexture)), Promise.all(r);
1263
1266
  }
1264
1267
  }
1265
- class Hs {
1268
+ class Ys {
1266
1269
  constructor(e) {
1267
- this.parser = e, this.name = b.KHR_TEXTURE_BASISU;
1270
+ this.parser = e, this.name = w.KHR_TEXTURE_BASISU;
1268
1271
  }
1269
1272
  loadTexture(e) {
1270
1273
  const t = this.parser, n = t.json, s = n.textures[e];
1271
1274
  if (!s.extensions || !s.extensions[this.name])
1272
1275
  return null;
1273
- const o = s.extensions[this.name], i = t.options.ktx2Loader;
1276
+ const r = s.extensions[this.name], i = t.options.ktx2Loader;
1274
1277
  if (!i) {
1275
1278
  if (n.extensionsRequired && n.extensionsRequired.indexOf(this.name) >= 0)
1276
1279
  throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
1277
1280
  return null;
1278
1281
  }
1279
- return t.loadTextureImage(e, o.source, i);
1282
+ return t.loadTextureImage(e, r.source, i);
1280
1283
  }
1281
1284
  }
1282
- class Fs {
1285
+ class qs {
1283
1286
  constructor(e) {
1284
- this.parser = e, this.name = b.EXT_TEXTURE_WEBP;
1287
+ this.parser = e, this.name = w.EXT_TEXTURE_WEBP;
1285
1288
  }
1286
1289
  loadTexture(e) {
1287
- const t = this.name, n = this.parser, s = n.json, o = s.textures[e];
1288
- if (!o.extensions || !o.extensions[t])
1290
+ const t = this.name, n = this.parser, s = n.json, r = s.textures[e];
1291
+ if (!r.extensions || !r.extensions[t])
1289
1292
  return null;
1290
- const i = o.extensions[t], c = s.images[i.source];
1291
- let a = n.textureLoader;
1292
- if (c.uri) {
1293
- const l = n.options.manager.getHandler(c.uri);
1294
- l !== null && (a = l);
1293
+ const i = r.extensions[t], a = s.images[i.source];
1294
+ let c = n.textureLoader;
1295
+ if (a.uri) {
1296
+ const l = n.options.manager.getHandler(a.uri);
1297
+ l !== null && (c = l);
1295
1298
  }
1296
- return n.loadTextureImage(e, i.source, a);
1299
+ return n.loadTextureImage(e, i.source, c);
1297
1300
  }
1298
1301
  }
1299
- class Us {
1302
+ class $s {
1300
1303
  constructor(e) {
1301
- this.parser = e, this.name = b.EXT_TEXTURE_AVIF;
1304
+ this.parser = e, this.name = w.EXT_TEXTURE_AVIF;
1302
1305
  }
1303
1306
  loadTexture(e) {
1304
- const t = this.name, n = this.parser, s = n.json, o = s.textures[e];
1305
- if (!o.extensions || !o.extensions[t])
1307
+ const t = this.name, n = this.parser, s = n.json, r = s.textures[e];
1308
+ if (!r.extensions || !r.extensions[t])
1306
1309
  return null;
1307
- const i = o.extensions[t], c = s.images[i.source];
1308
- let a = n.textureLoader;
1309
- if (c.uri) {
1310
- const l = n.options.manager.getHandler(c.uri);
1311
- l !== null && (a = l);
1310
+ const i = r.extensions[t], a = s.images[i.source];
1311
+ let c = n.textureLoader;
1312
+ if (a.uri) {
1313
+ const l = n.options.manager.getHandler(a.uri);
1314
+ l !== null && (c = l);
1312
1315
  }
1313
- return n.loadTextureImage(e, i.source, a);
1316
+ return n.loadTextureImage(e, i.source, c);
1314
1317
  }
1315
1318
  }
1316
- class js {
1319
+ class Zs {
1317
1320
  constructor(e) {
1318
- this.name = b.EXT_MESHOPT_COMPRESSION, this.parser = e;
1321
+ this.name = w.EXT_MESHOPT_COMPRESSION, this.parser = e;
1319
1322
  }
1320
1323
  loadBufferView(e) {
1321
1324
  const t = this.parser.json, n = t.bufferViews[e];
1322
1325
  if (n.extensions && n.extensions[this.name]) {
1323
- const s = n.extensions[this.name], o = this.parser.getDependency("buffer", s.buffer), i = this.parser.options.meshoptDecoder;
1326
+ const s = n.extensions[this.name], r = this.parser.getDependency("buffer", s.buffer), i = this.parser.options.meshoptDecoder;
1324
1327
  if (!i || !i.supported) {
1325
1328
  if (t.extensionsRequired && t.extensionsRequired.indexOf(this.name) >= 0)
1326
1329
  throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
1327
1330
  return null;
1328
1331
  }
1329
- return o.then(function(c) {
1330
- const a = s.byteOffset || 0, l = s.byteLength || 0, u = s.count, h = s.byteStride, p = new Uint8Array(c, a, l);
1332
+ return r.then(function(a) {
1333
+ const c = s.byteOffset || 0, l = s.byteLength || 0, u = s.count, h = s.byteStride, p = new Uint8Array(a, c, l);
1331
1334
  return i.decodeGltfBufferAsync ? i.decodeGltfBufferAsync(u, h, p, s.mode, s.filter).then(function(m) {
1332
1335
  return m.buffer;
1333
1336
  }) : i.ready.then(function() {
@@ -1339,9 +1342,9 @@ class js {
1339
1342
  return null;
1340
1343
  }
1341
1344
  }
1342
- class Gs {
1345
+ class Qs {
1343
1346
  constructor(e) {
1344
- this.name = b.EXT_MESH_GPU_INSTANCING, this.parser = e;
1347
+ this.name = w.EXT_MESH_GPU_INSTANCING, this.parser = e;
1345
1348
  }
1346
1349
  createNodeMesh(e) {
1347
1350
  const t = this.parser.json, n = t.nodes[e];
@@ -1351,127 +1354,127 @@ class Gs {
1351
1354
  for (const l of s.primitives)
1352
1355
  if (l.mode !== k.TRIANGLES && l.mode !== k.TRIANGLE_STRIP && l.mode !== k.TRIANGLE_FAN && l.mode !== void 0)
1353
1356
  return null;
1354
- const i = n.extensions[this.name].attributes, c = [], a = {};
1357
+ const i = n.extensions[this.name].attributes, a = [], c = {};
1355
1358
  for (const l in i)
1356
- c.push(this.parser.getDependency("accessor", i[l]).then((u) => (a[l] = u, a[l])));
1357
- return c.length < 1 ? null : (c.push(this.parser.createNodeMesh(e)), Promise.all(c).then((l) => {
1359
+ a.push(this.parser.getDependency("accessor", i[l]).then((u) => (c[l] = u, c[l])));
1360
+ return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((l) => {
1358
1361
  const u = l.pop(), h = u.isGroup ? u.children : [u], p = l[0].count, m = [];
1359
1362
  for (const _ of h) {
1360
- const w = new se(), d = new S(), f = new le(), g = new S(1, 1, 1), T = new Et(_.geometry, _.material, p);
1363
+ const b = new se(), d = new R(), f = new ue(), g = new R(1, 1, 1), T = new It(_.geometry, _.material, p);
1361
1364
  for (let y = 0; y < p; y++)
1362
- a.TRANSLATION && d.fromBufferAttribute(a.TRANSLATION, y), a.ROTATION && f.fromBufferAttribute(a.ROTATION, y), a.SCALE && g.fromBufferAttribute(a.SCALE, y), T.setMatrixAt(y, w.compose(d, f, g));
1363
- for (const y in a)
1365
+ c.TRANSLATION && d.fromBufferAttribute(c.TRANSLATION, y), c.ROTATION && f.fromBufferAttribute(c.ROTATION, y), c.SCALE && g.fromBufferAttribute(c.SCALE, y), T.setMatrixAt(y, b.compose(d, f, g));
1366
+ for (const y in c)
1364
1367
  if (y === "_COLOR_0") {
1365
- const E = a[y];
1366
- T.instanceColor = new xt(E.array, E.itemSize, E.normalized);
1367
- } else y !== "TRANSLATION" && y !== "ROTATION" && y !== "SCALE" && _.geometry.setAttribute(y, a[y]);
1368
- He.prototype.copy.call(T, _), this.parser.assignFinalMaterial(T), m.push(T);
1368
+ const E = c[y];
1369
+ T.instanceColor = new kt(E.array, E.itemSize, E.normalized);
1370
+ } else y !== "TRANSLATION" && y !== "ROTATION" && y !== "SCALE" && _.geometry.setAttribute(y, c[y]);
1371
+ Fe.prototype.copy.call(T, _), this.parser.assignFinalMaterial(T), m.push(T);
1369
1372
  }
1370
1373
  return u.isGroup ? (u.clear(), u.add(...m), u) : m[0];
1371
1374
  }));
1372
1375
  }
1373
1376
  }
1374
- const dt = "glTF", ne = 12, Ye = { JSON: 1313821514, BIN: 5130562 };
1375
- class Bs {
1377
+ const wt = "glTF", ie = 12, $e = { JSON: 1313821514, BIN: 5130562 };
1378
+ class Js {
1376
1379
  constructor(e) {
1377
- this.name = b.KHR_BINARY_GLTF, this.content = null, this.body = null;
1378
- const t = new DataView(e, 0, ne), n = new TextDecoder();
1380
+ this.name = w.KHR_BINARY_GLTF, this.content = null, this.body = null;
1381
+ const t = new DataView(e, 0, ie), n = new TextDecoder();
1379
1382
  if (this.header = {
1380
1383
  magic: n.decode(new Uint8Array(e.slice(0, 4))),
1381
1384
  version: t.getUint32(4, !0),
1382
1385
  length: t.getUint32(8, !0)
1383
- }, this.header.magic !== dt)
1386
+ }, this.header.magic !== wt)
1384
1387
  throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
1385
1388
  if (this.header.version < 2)
1386
1389
  throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
1387
- const s = this.header.length - ne, o = new DataView(e, ne);
1390
+ const s = this.header.length - ie, r = new DataView(e, ie);
1388
1391
  let i = 0;
1389
1392
  for (; i < s; ) {
1390
- const c = o.getUint32(i, !0);
1393
+ const a = r.getUint32(i, !0);
1391
1394
  i += 4;
1392
- const a = o.getUint32(i, !0);
1393
- if (i += 4, a === Ye.JSON) {
1394
- const l = new Uint8Array(e, ne + i, c);
1395
+ const c = r.getUint32(i, !0);
1396
+ if (i += 4, c === $e.JSON) {
1397
+ const l = new Uint8Array(e, ie + i, a);
1395
1398
  this.content = n.decode(l);
1396
- } else if (a === Ye.BIN) {
1397
- const l = ne + i;
1398
- this.body = e.slice(l, l + c);
1399
+ } else if (c === $e.BIN) {
1400
+ const l = ie + i;
1401
+ this.body = e.slice(l, l + a);
1399
1402
  }
1400
- i += c;
1403
+ i += a;
1401
1404
  }
1402
1405
  if (this.content === null)
1403
1406
  throw new Error("THREE.GLTFLoader: JSON content not found.");
1404
1407
  }
1405
1408
  }
1406
- class zs {
1409
+ class en {
1407
1410
  constructor(e, t) {
1408
1411
  if (!t)
1409
1412
  throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
1410
- this.name = b.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
1413
+ this.name = w.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
1411
1414
  }
1412
1415
  decodePrimitive(e, t) {
1413
- const n = this.json, s = this.dracoLoader, o = e.extensions[this.name].bufferView, i = e.extensions[this.name].attributes, c = {}, a = {}, l = {};
1416
+ const n = this.json, s = this.dracoLoader, r = e.extensions[this.name].bufferView, i = e.extensions[this.name].attributes, a = {}, c = {}, l = {};
1414
1417
  for (const u in i) {
1415
- const h = ke[u] || u.toLowerCase();
1416
- c[h] = i[u];
1418
+ const h = Ne[u] || u.toLowerCase();
1419
+ a[h] = i[u];
1417
1420
  }
1418
1421
  for (const u in e.attributes) {
1419
- const h = ke[u] || u.toLowerCase();
1422
+ const h = Ne[u] || u.toLowerCase();
1420
1423
  if (i[u] !== void 0) {
1421
1424
  const p = n.accessors[e.attributes[u]], m = te[p.componentType];
1422
- l[h] = m.name, a[h] = p.normalized === !0;
1425
+ l[h] = m.name, c[h] = p.normalized === !0;
1423
1426
  }
1424
1427
  }
1425
- return t.getDependency("bufferView", o).then(function(u) {
1428
+ return t.getDependency("bufferView", r).then(function(u) {
1426
1429
  return new Promise(function(h, p) {
1427
1430
  s.decodeDracoFile(u, function(m) {
1428
1431
  for (const _ in m.attributes) {
1429
- const w = m.attributes[_], d = a[_];
1430
- d !== void 0 && (w.normalized = d);
1432
+ const b = m.attributes[_], d = c[_];
1433
+ d !== void 0 && (b.normalized = d);
1431
1434
  }
1432
1435
  h(m);
1433
- }, c, l, j, p);
1436
+ }, a, l, U, p);
1434
1437
  });
1435
1438
  });
1436
1439
  }
1437
1440
  }
1438
- class Ks {
1441
+ class tn {
1439
1442
  constructor() {
1440
- this.name = b.KHR_TEXTURE_TRANSFORM;
1443
+ this.name = w.KHR_TEXTURE_TRANSFORM;
1441
1444
  }
1442
1445
  extendTexture(e, t) {
1443
1446
  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;
1444
1447
  }
1445
1448
  }
1446
- class Ws {
1449
+ class sn {
1447
1450
  constructor() {
1448
- this.name = b.KHR_MESH_QUANTIZATION;
1451
+ this.name = w.KHR_MESH_QUANTIZATION;
1449
1452
  }
1450
1453
  }
1451
- class ft extends qt {
1454
+ class Et extends as {
1452
1455
  constructor(e, t, n, s) {
1453
1456
  super(e, t, n, s);
1454
1457
  }
1455
1458
  copySampleValue_(e) {
1456
- const t = this.resultBuffer, n = this.sampleValues, s = this.valueSize, o = e * s * 3 + s;
1459
+ const t = this.resultBuffer, n = this.sampleValues, s = this.valueSize, r = e * s * 3 + s;
1457
1460
  for (let i = 0; i !== s; i++)
1458
- t[i] = n[o + i];
1461
+ t[i] = n[r + i];
1459
1462
  return t;
1460
1463
  }
1461
1464
  interpolate_(e, t, n, s) {
1462
- const o = this.resultBuffer, i = this.sampleValues, c = this.valueSize, a = c * 2, l = c * 3, u = s - t, h = (n - t) / u, p = h * h, m = p * h, _ = e * l, w = _ - l, d = -2 * m + 3 * p, f = m - p, g = 1 - d, T = f - p + h;
1463
- for (let y = 0; y !== c; y++) {
1464
- const E = i[w + y + c], x = i[w + y + a] * u, M = i[_ + y + c], C = i[_ + y] * u;
1465
- o[y] = g * E + T * x + d * M + f * C;
1465
+ const r = this.resultBuffer, i = this.sampleValues, a = this.valueSize, c = a * 2, l = a * 3, u = s - t, h = (n - t) / u, p = h * h, m = p * h, _ = e * l, b = _ - l, d = -2 * m + 3 * p, f = m - p, g = 1 - d, T = f - p + h;
1466
+ for (let y = 0; y !== a; y++) {
1467
+ const E = i[b + y + a], A = i[b + y + c] * u, S = i[_ + y + a], P = i[_ + y] * u;
1468
+ r[y] = g * E + T * A + d * S + f * P;
1466
1469
  }
1467
- return o;
1470
+ return r;
1468
1471
  }
1469
1472
  }
1470
- const Vs = new le();
1471
- class Xs extends ft {
1473
+ const nn = new ue();
1474
+ class rn extends Et {
1472
1475
  interpolate_(e, t, n, s) {
1473
- const o = super.interpolate_(e, t, n, s);
1474
- return Vs.fromArray(o).normalize().toArray(o), o;
1476
+ const r = super.interpolate_(e, t, n, s);
1477
+ return nn.fromArray(r).normalize().toArray(r), r;
1475
1478
  }
1476
1479
  }
1477
1480
  const k = {
@@ -1489,18 +1492,18 @@ const k = {
1489
1492
  5123: Uint16Array,
1490
1493
  5125: Uint32Array,
1491
1494
  5126: Float32Array
1492
- }, $e = {
1493
- 9728: at,
1494
- 9729: Oe,
1495
- 9984: Ct,
1496
- 9985: Dt,
1497
- 9986: Lt,
1498
- 9987: rt
1499
- }, qe = {
1500
- 33071: Ot,
1501
- 33648: Pt,
1502
- 10497: Ie
1503
- }, Ae = {
1495
+ }, Ze = {
1496
+ 9728: gt,
1497
+ 9729: Ie,
1498
+ 9984: jt,
1499
+ 9985: Gt,
1500
+ 9986: Ut,
1501
+ 9987: mt
1502
+ }, Qe = {
1503
+ 33071: Bt,
1504
+ 33648: zt,
1505
+ 10497: ke
1506
+ }, Me = {
1504
1507
  SCALAR: 1,
1505
1508
  VEC2: 2,
1506
1509
  VEC3: 3,
@@ -1508,7 +1511,7 @@ const k = {
1508
1511
  MAT2: 4,
1509
1512
  MAT3: 9,
1510
1513
  MAT4: 16
1511
- }, ke = {
1514
+ }, Ne = {
1512
1515
  POSITION: "position",
1513
1516
  NORMAL: "normal",
1514
1517
  TANGENT: "tangent",
@@ -1519,103 +1522,103 @@ const k = {
1519
1522
  COLOR_0: "color",
1520
1523
  WEIGHTS_0: "skinWeight",
1521
1524
  JOINTS_0: "skinIndex"
1522
- }, W = {
1525
+ }, K = {
1523
1526
  scale: "scale",
1524
1527
  translation: "position",
1525
1528
  rotation: "quaternion",
1526
1529
  weights: "morphTargetInfluences"
1527
- }, Ys = {
1530
+ }, on = {
1528
1531
  CUBICSPLINE: void 0,
1529
1532
  // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
1530
1533
  // keyframe track will be initialized with a default interpolation type, then modified.
1531
- LINEAR: lt,
1532
- STEP: Yt
1533
- }, Re = {
1534
+ LINEAR: _t,
1535
+ STEP: rs
1536
+ }, Se = {
1534
1537
  OPAQUE: "OPAQUE",
1535
1538
  MASK: "MASK",
1536
1539
  BLEND: "BLEND"
1537
1540
  };
1538
- function $s(r) {
1539
- return r.DefaultMaterial === void 0 && (r.DefaultMaterial = new ct({
1541
+ function an(o) {
1542
+ return o.DefaultMaterial === void 0 && (o.DefaultMaterial = new yt({
1540
1543
  color: 16777215,
1541
1544
  emissive: 0,
1542
1545
  metalness: 1,
1543
1546
  roughness: 1,
1544
1547
  transparent: !1,
1545
1548
  depthTest: !0,
1546
- side: $t
1547
- })), r.DefaultMaterial;
1549
+ side: os
1550
+ })), o.DefaultMaterial;
1548
1551
  }
1549
- function Q(r, e, t) {
1552
+ function Z(o, e, t) {
1550
1553
  for (const n in t.extensions)
1551
- r[n] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[n] = t.extensions[n]);
1554
+ o[n] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[n] = t.extensions[n]);
1552
1555
  }
1553
- function B(r, e) {
1554
- e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(r.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
1556
+ function j(o, e) {
1557
+ e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(o.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
1555
1558
  }
1556
- function qs(r, e, t) {
1557
- let n = !1, s = !1, o = !1;
1559
+ function cn(o, e, t) {
1560
+ let n = !1, s = !1, r = !1;
1558
1561
  for (let l = 0, u = e.length; l < u; l++) {
1559
1562
  const h = e[l];
1560
- if (h.POSITION !== void 0 && (n = !0), h.NORMAL !== void 0 && (s = !0), h.COLOR_0 !== void 0 && (o = !0), n && s && o) break;
1563
+ if (h.POSITION !== void 0 && (n = !0), h.NORMAL !== void 0 && (s = !0), h.COLOR_0 !== void 0 && (r = !0), n && s && r) break;
1561
1564
  }
1562
- if (!n && !s && !o) return Promise.resolve(r);
1563
- const i = [], c = [], a = [];
1565
+ if (!n && !s && !r) return Promise.resolve(o);
1566
+ const i = [], a = [], c = [];
1564
1567
  for (let l = 0, u = e.length; l < u; l++) {
1565
1568
  const h = e[l];
1566
1569
  if (n) {
1567
- const p = h.POSITION !== void 0 ? t.getDependency("accessor", h.POSITION) : r.attributes.position;
1570
+ const p = h.POSITION !== void 0 ? t.getDependency("accessor", h.POSITION) : o.attributes.position;
1568
1571
  i.push(p);
1569
1572
  }
1570
1573
  if (s) {
1571
- const p = h.NORMAL !== void 0 ? t.getDependency("accessor", h.NORMAL) : r.attributes.normal;
1572
- c.push(p);
1573
- }
1574
- if (o) {
1575
- const p = h.COLOR_0 !== void 0 ? t.getDependency("accessor", h.COLOR_0) : r.attributes.color;
1574
+ const p = h.NORMAL !== void 0 ? t.getDependency("accessor", h.NORMAL) : o.attributes.normal;
1576
1575
  a.push(p);
1577
1576
  }
1577
+ if (r) {
1578
+ const p = h.COLOR_0 !== void 0 ? t.getDependency("accessor", h.COLOR_0) : o.attributes.color;
1579
+ c.push(p);
1580
+ }
1578
1581
  }
1579
1582
  return Promise.all([
1580
1583
  Promise.all(i),
1581
- Promise.all(c),
1582
- Promise.all(a)
1584
+ Promise.all(a),
1585
+ Promise.all(c)
1583
1586
  ]).then(function(l) {
1584
1587
  const u = l[0], h = l[1], p = l[2];
1585
- return n && (r.morphAttributes.position = u), s && (r.morphAttributes.normal = h), o && (r.morphAttributes.color = p), r.morphTargetsRelative = !0, r;
1588
+ return n && (o.morphAttributes.position = u), s && (o.morphAttributes.normal = h), r && (o.morphAttributes.color = p), o.morphTargetsRelative = !0, o;
1586
1589
  });
1587
1590
  }
1588
- function Zs(r, e) {
1589
- if (r.updateMorphTargets(), e.weights !== void 0)
1591
+ function ln(o, e) {
1592
+ if (o.updateMorphTargets(), e.weights !== void 0)
1590
1593
  for (let t = 0, n = e.weights.length; t < n; t++)
1591
- r.morphTargetInfluences[t] = e.weights[t];
1594
+ o.morphTargetInfluences[t] = e.weights[t];
1592
1595
  if (e.extras && Array.isArray(e.extras.targetNames)) {
1593
1596
  const t = e.extras.targetNames;
1594
- if (r.morphTargetInfluences.length === t.length) {
1595
- r.morphTargetDictionary = {};
1597
+ if (o.morphTargetInfluences.length === t.length) {
1598
+ o.morphTargetDictionary = {};
1596
1599
  for (let n = 0, s = t.length; n < s; n++)
1597
- r.morphTargetDictionary[t[n]] = n;
1600
+ o.morphTargetDictionary[t[n]] = n;
1598
1601
  } else
1599
1602
  console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
1600
1603
  }
1601
1604
  }
1602
- function Qs(r) {
1605
+ function hn(o) {
1603
1606
  let e;
1604
- const t = r.extensions && r.extensions[b.KHR_DRACO_MESH_COMPRESSION];
1605
- if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + Me(t.attributes) : e = r.indices + ":" + Me(r.attributes) + ":" + r.mode, r.targets !== void 0)
1606
- for (let n = 0, s = r.targets.length; n < s; n++)
1607
- e += ":" + Me(r.targets[n]);
1607
+ const t = o.extensions && o.extensions[w.KHR_DRACO_MESH_COMPRESSION];
1608
+ if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + Re(t.attributes) : e = o.indices + ":" + Re(o.attributes) + ":" + o.mode, o.targets !== void 0)
1609
+ for (let n = 0, s = o.targets.length; n < s; n++)
1610
+ e += ":" + Re(o.targets[n]);
1608
1611
  return e;
1609
1612
  }
1610
- function Me(r) {
1613
+ function Re(o) {
1611
1614
  let e = "";
1612
- const t = Object.keys(r).sort();
1615
+ const t = Object.keys(o).sort();
1613
1616
  for (let n = 0, s = t.length; n < s; n++)
1614
- e += t[n] + ":" + r[t[n]] + ";";
1617
+ e += t[n] + ":" + o[t[n]] + ";";
1615
1618
  return e;
1616
1619
  }
1617
- function Ne(r) {
1618
- switch (r) {
1620
+ function ve(o) {
1621
+ switch (o) {
1619
1622
  case Int8Array:
1620
1623
  return 1 / 127;
1621
1624
  case Uint8Array:
@@ -1628,21 +1631,21 @@ function Ne(r) {
1628
1631
  throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
1629
1632
  }
1630
1633
  }
1631
- function Js(r) {
1632
- return r.search(/\.jpe?g($|\?)/i) > 0 || r.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : r.search(/\.webp($|\?)/i) > 0 || r.search(/^data\:image\/webp/) === 0 ? "image/webp" : r.search(/\.ktx2($|\?)/i) > 0 || r.search(/^data\:image\/ktx2/) === 0 ? "image/ktx2" : "image/png";
1634
+ function un(o) {
1635
+ return o.search(/\.jpe?g($|\?)/i) > 0 || o.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : o.search(/\.webp($|\?)/i) > 0 || o.search(/^data\:image\/webp/) === 0 ? "image/webp" : o.search(/\.ktx2($|\?)/i) > 0 || o.search(/^data\:image\/ktx2/) === 0 ? "image/ktx2" : "image/png";
1633
1636
  }
1634
- const en = new se();
1635
- class tn {
1637
+ const dn = new se();
1638
+ class fn {
1636
1639
  constructor(e = {}, t = {}) {
1637
- this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new xs(), 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 = {};
1638
- let n = !1, s = -1, o = !1, i = -1;
1640
+ this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new ks(), 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 = {};
1641
+ let n = !1, s = -1, r = !1, i = -1;
1639
1642
  if (typeof navigator < "u") {
1640
- const c = navigator.userAgent;
1641
- n = /^((?!chrome|android).)*safari/i.test(c) === !0;
1642
- const a = c.match(/Version\/(\d+)/);
1643
- s = n && a ? parseInt(a[1], 10) : -1, o = c.indexOf("Firefox") > -1, i = o ? c.match(/Firefox\/([0-9]+)\./)[1] : -1;
1643
+ const a = navigator.userAgent;
1644
+ n = /^((?!chrome|android).)*safari/i.test(a) === !0;
1645
+ const c = a.match(/Version\/(\d+)/);
1646
+ s = n && c ? parseInt(c[1], 10) : -1, r = a.indexOf("Firefox") > -1, i = r ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
1644
1647
  }
1645
- typeof createImageBitmap > "u" || n && s < 17 || o && i < 98 ? this.textureLoader = new At(this.options.manager) : this.textureLoader = new Rt(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new fe(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
1648
+ typeof createImageBitmap > "u" || n && s < 17 || r && i < 98 ? this.textureLoader = new Nt(this.options.manager) : this.textureLoader = new vt(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new me(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
1646
1649
  }
1647
1650
  setExtensions(e) {
1648
1651
  this.extensions = e;
@@ -1651,7 +1654,7 @@ class tn {
1651
1654
  this.plugins = e;
1652
1655
  }
1653
1656
  parse(e, t) {
1654
- const n = this, s = this.json, o = this.extensions;
1657
+ const n = this, s = this.json, r = this.extensions;
1655
1658
  this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(i) {
1656
1659
  return i._markDefs && i._markDefs();
1657
1660
  }), Promise.all(this._invokeAll(function(i) {
@@ -1663,7 +1666,7 @@ class tn {
1663
1666
  n.getDependencies("camera")
1664
1667
  ]);
1665
1668
  }).then(function(i) {
1666
- const c = {
1669
+ const a = {
1667
1670
  scene: i[0][s.scene || 0],
1668
1671
  scenes: i[0],
1669
1672
  animations: i[1],
@@ -1672,12 +1675,12 @@ class tn {
1672
1675
  parser: n,
1673
1676
  userData: {}
1674
1677
  };
1675
- return Q(o, c, s), B(c, s), Promise.all(n._invokeAll(function(a) {
1676
- return a.afterRoot && a.afterRoot(c);
1678
+ return Z(r, a, s), j(a, s), Promise.all(n._invokeAll(function(c) {
1679
+ return c.afterRoot && c.afterRoot(a);
1677
1680
  })).then(function() {
1678
- for (const a of c.scenes)
1679
- a.updateMatrixWorld();
1680
- e(c);
1681
+ for (const c of a.scenes)
1682
+ c.updateMatrixWorld();
1683
+ e(a);
1681
1684
  });
1682
1685
  }).catch(t);
1683
1686
  }
@@ -1688,12 +1691,12 @@ class tn {
1688
1691
  */
1689
1692
  _markDefs() {
1690
1693
  const e = this.json.nodes || [], t = this.json.skins || [], n = this.json.meshes || [];
1691
- for (let s = 0, o = t.length; s < o; s++) {
1694
+ for (let s = 0, r = t.length; s < r; s++) {
1692
1695
  const i = t[s].joints;
1693
- for (let c = 0, a = i.length; c < a; c++)
1694
- e[i[c]].isBone = !0;
1696
+ for (let a = 0, c = i.length; a < c; a++)
1697
+ e[i[a]].isBone = !0;
1695
1698
  }
1696
- for (let s = 0, o = e.length; s < o; s++) {
1699
+ for (let s = 0, r = e.length; s < r; s++) {
1697
1700
  const i = e[s];
1698
1701
  i.mesh !== void 0 && (this._addNodeRef(this.meshCache, i.mesh), i.skin !== void 0 && (n[i.mesh].isSkinnedMesh = !0)), i.camera !== void 0 && this._addNodeRef(this.cameraCache, i.camera);
1699
1702
  }
@@ -1725,13 +1728,13 @@ class tn {
1725
1728
  */
1726
1729
  _getNodeRef(e, t, n) {
1727
1730
  if (e.refs[t] <= 1) return n;
1728
- const s = n.clone(), o = (i, c) => {
1729
- const a = this.associations.get(i);
1730
- a != null && this.associations.set(c, a);
1731
+ const s = n.clone(), r = (i, a) => {
1732
+ const c = this.associations.get(i);
1733
+ c != null && this.associations.set(a, c);
1731
1734
  for (const [l, u] of i.children.entries())
1732
- o(u, c.children[l]);
1735
+ r(u, a.children[l]);
1733
1736
  };
1734
- return o(n, s), s.name += "_instance_" + e.uses[t]++, s;
1737
+ return r(n, s), s.name += "_instance_" + e.uses[t]++, s;
1735
1738
  }
1736
1739
  _invokeOne(e) {
1737
1740
  const t = Object.values(this.plugins);
@@ -1747,8 +1750,8 @@ class tn {
1747
1750
  t.unshift(this);
1748
1751
  const n = [];
1749
1752
  for (let s = 0; s < t.length; s++) {
1750
- const o = e(t[s]);
1751
- o && n.push(o);
1753
+ const r = e(t[s]);
1754
+ r && n.push(r);
1752
1755
  }
1753
1756
  return n;
1754
1757
  }
@@ -1769,50 +1772,50 @@ class tn {
1769
1772
  s = this.loadScene(t);
1770
1773
  break;
1771
1774
  case "node":
1772
- s = this._invokeOne(function(o) {
1773
- return o.loadNode && o.loadNode(t);
1775
+ s = this._invokeOne(function(r) {
1776
+ return r.loadNode && r.loadNode(t);
1774
1777
  });
1775
1778
  break;
1776
1779
  case "mesh":
1777
- s = this._invokeOne(function(o) {
1778
- return o.loadMesh && o.loadMesh(t);
1780
+ s = this._invokeOne(function(r) {
1781
+ return r.loadMesh && r.loadMesh(t);
1779
1782
  });
1780
1783
  break;
1781
1784
  case "accessor":
1782
1785
  s = this.loadAccessor(t);
1783
1786
  break;
1784
1787
  case "bufferView":
1785
- s = this._invokeOne(function(o) {
1786
- return o.loadBufferView && o.loadBufferView(t);
1788
+ s = this._invokeOne(function(r) {
1789
+ return r.loadBufferView && r.loadBufferView(t);
1787
1790
  });
1788
1791
  break;
1789
1792
  case "buffer":
1790
1793
  s = this.loadBuffer(t);
1791
1794
  break;
1792
1795
  case "material":
1793
- s = this._invokeOne(function(o) {
1794
- return o.loadMaterial && o.loadMaterial(t);
1796
+ s = this._invokeOne(function(r) {
1797
+ return r.loadMaterial && r.loadMaterial(t);
1795
1798
  });
1796
1799
  break;
1797
1800
  case "texture":
1798
- s = this._invokeOne(function(o) {
1799
- return o.loadTexture && o.loadTexture(t);
1801
+ s = this._invokeOne(function(r) {
1802
+ return r.loadTexture && r.loadTexture(t);
1800
1803
  });
1801
1804
  break;
1802
1805
  case "skin":
1803
1806
  s = this.loadSkin(t);
1804
1807
  break;
1805
1808
  case "animation":
1806
- s = this._invokeOne(function(o) {
1807
- return o.loadAnimation && o.loadAnimation(t);
1809
+ s = this._invokeOne(function(r) {
1810
+ return r.loadAnimation && r.loadAnimation(t);
1808
1811
  });
1809
1812
  break;
1810
1813
  case "camera":
1811
1814
  s = this.loadCamera(t);
1812
1815
  break;
1813
1816
  default:
1814
- if (s = this._invokeOne(function(o) {
1815
- return o != this && o.getDependency && o.getDependency(e, t);
1817
+ if (s = this._invokeOne(function(r) {
1818
+ return r != this && r.getDependency && r.getDependency(e, t);
1816
1819
  }), !s)
1817
1820
  throw new Error("Unknown type: " + e);
1818
1821
  break;
@@ -1832,7 +1835,7 @@ class tn {
1832
1835
  let t = this.cache.get(e);
1833
1836
  if (!t) {
1834
1837
  const n = this, s = this.json[e + (e === "mesh" ? "es" : "s")] || [];
1835
- t = Promise.all(s.map(function(o, i) {
1838
+ t = Promise.all(s.map(function(r, i) {
1836
1839
  return n.getDependency(e, i);
1837
1840
  })), this.cache.add(e, t);
1838
1841
  }
@@ -1850,10 +1853,10 @@ class tn {
1850
1853
  if (t.type && t.type !== "arraybuffer")
1851
1854
  throw new Error("THREE.GLTFLoader: " + t.type + " buffer type is not supported.");
1852
1855
  if (t.uri === void 0 && e === 0)
1853
- return Promise.resolve(this.extensions[b.KHR_BINARY_GLTF].body);
1856
+ return Promise.resolve(this.extensions[w.KHR_BINARY_GLTF].body);
1854
1857
  const s = this.options;
1855
- return new Promise(function(o, i) {
1856
- n.load(re.resolveURL(t.uri, s.path), o, void 0, function() {
1858
+ return new Promise(function(r, i) {
1859
+ n.load(ae.resolveURL(t.uri, s.path), r, void 0, function() {
1857
1860
  i(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
1858
1861
  });
1859
1862
  });
@@ -1868,8 +1871,8 @@ class tn {
1868
1871
  loadBufferView(e) {
1869
1872
  const t = this.json.bufferViews[e];
1870
1873
  return this.getDependency("buffer", t.buffer).then(function(n) {
1871
- const s = t.byteLength || 0, o = t.byteOffset || 0;
1872
- return n.slice(o, o + s);
1874
+ const s = t.byteLength || 0, r = t.byteOffset || 0;
1875
+ return n.slice(r, r + s);
1873
1876
  });
1874
1877
  }
1875
1878
  /**
@@ -1882,25 +1885,25 @@ class tn {
1882
1885
  loadAccessor(e) {
1883
1886
  const t = this, n = this.json, s = this.json.accessors[e];
1884
1887
  if (s.bufferView === void 0 && s.sparse === void 0) {
1885
- const i = Ae[s.type], c = te[s.componentType], a = s.normalized === !0, l = new c(s.count * i);
1886
- return Promise.resolve(new oe(l, i, a));
1888
+ const i = Me[s.type], a = te[s.componentType], c = s.normalized === !0, l = new a(s.count * i);
1889
+ return Promise.resolve(new oe(l, i, c));
1887
1890
  }
1888
- const o = [];
1889
- return s.bufferView !== void 0 ? o.push(this.getDependency("bufferView", s.bufferView)) : o.push(null), s.sparse !== void 0 && (o.push(this.getDependency("bufferView", s.sparse.indices.bufferView)), o.push(this.getDependency("bufferView", s.sparse.values.bufferView))), Promise.all(o).then(function(i) {
1890
- const c = i[0], a = Ae[s.type], l = te[s.componentType], u = l.BYTES_PER_ELEMENT, h = u * a, p = s.byteOffset || 0, m = s.bufferView !== void 0 ? n.bufferViews[s.bufferView].byteStride : void 0, _ = s.normalized === !0;
1891
- let w, d;
1891
+ const r = [];
1892
+ return s.bufferView !== void 0 ? r.push(this.getDependency("bufferView", s.bufferView)) : r.push(null), s.sparse !== void 0 && (r.push(this.getDependency("bufferView", s.sparse.indices.bufferView)), r.push(this.getDependency("bufferView", s.sparse.values.bufferView))), Promise.all(r).then(function(i) {
1893
+ const a = i[0], c = Me[s.type], l = te[s.componentType], u = l.BYTES_PER_ELEMENT, h = u * c, p = s.byteOffset || 0, m = s.bufferView !== void 0 ? n.bufferViews[s.bufferView].byteStride : void 0, _ = s.normalized === !0;
1894
+ let b, d;
1892
1895
  if (m && m !== h) {
1893
1896
  const f = Math.floor(p / m), g = "InterleavedBuffer:" + s.bufferView + ":" + s.componentType + ":" + f + ":" + s.count;
1894
1897
  let T = t.cache.get(g);
1895
- T || (w = new l(c, f * m, s.count * m / u), T = new Mt(w, m / u), t.cache.add(g, T)), d = new St(T, a, p % m / u, _);
1898
+ T || (b = new l(a, f * m, s.count * m / u), T = new Ht(b, m / u), t.cache.add(g, T)), d = new Ft(T, c, p % m / u, _);
1896
1899
  } else
1897
- c === null ? w = new l(s.count * a) : w = new l(c, p, s.count * a), d = new oe(w, a, _);
1900
+ a === null ? b = new l(s.count * c) : b = new l(a, p, s.count * c), d = new oe(b, c, _);
1898
1901
  if (s.sparse !== void 0) {
1899
- const f = Ae.SCALAR, g = te[s.sparse.indices.componentType], T = s.sparse.indices.byteOffset || 0, y = s.sparse.values.byteOffset || 0, E = new g(i[1], T, s.sparse.count * f), x = new l(i[2], y, s.sparse.count * a);
1900
- c !== null && (d = new oe(d.array.slice(), d.itemSize, d.normalized)), d.normalized = !1;
1901
- for (let M = 0, C = E.length; M < C; M++) {
1902
- const P = E[M];
1903
- if (d.setX(P, x[M * a]), a >= 2 && d.setY(P, x[M * a + 1]), a >= 3 && d.setZ(P, x[M * a + 2]), a >= 4 && d.setW(P, x[M * a + 3]), a >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
1902
+ const f = Me.SCALAR, g = te[s.sparse.indices.componentType], T = s.sparse.indices.byteOffset || 0, y = s.sparse.values.byteOffset || 0, E = new g(i[1], T, s.sparse.count * f), A = new l(i[2], y, s.sparse.count * c);
1903
+ a !== null && (d = new oe(d.array.slice(), d.itemSize, d.normalized)), d.normalized = !1;
1904
+ for (let S = 0, P = E.length; S < P; S++) {
1905
+ const C = E[S];
1906
+ if (d.setX(C, A[S * c]), c >= 2 && d.setY(C, A[S * c + 1]), c >= 3 && d.setZ(C, A[S * c + 2]), c >= 4 && d.setW(C, A[S * c + 3]), c >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
1904
1907
  }
1905
1908
  d.normalized = _;
1906
1909
  }
@@ -1915,53 +1918,53 @@ class tn {
1915
1918
  * @return {Promise<THREE.Texture|null>}
1916
1919
  */
1917
1920
  loadTexture(e) {
1918
- const t = this.json, n = this.options, o = t.textures[e].source, i = t.images[o];
1919
- let c = this.textureLoader;
1921
+ const t = this.json, n = this.options, r = t.textures[e].source, i = t.images[r];
1922
+ let a = this.textureLoader;
1920
1923
  if (i.uri) {
1921
- const a = n.manager.getHandler(i.uri);
1922
- a !== null && (c = a);
1924
+ const c = n.manager.getHandler(i.uri);
1925
+ c !== null && (a = c);
1923
1926
  }
1924
- return this.loadTextureImage(e, o, c);
1927
+ return this.loadTextureImage(e, r, a);
1925
1928
  }
1926
1929
  loadTextureImage(e, t, n) {
1927
- const s = this, o = this.json, i = o.textures[e], c = o.images[t], a = (c.uri || c.bufferView) + ":" + i.sampler;
1928
- if (this.textureCache[a])
1929
- return this.textureCache[a];
1930
+ const s = this, r = this.json, i = r.textures[e], a = r.images[t], c = (a.uri || a.bufferView) + ":" + i.sampler;
1931
+ if (this.textureCache[c])
1932
+ return this.textureCache[c];
1930
1933
  const l = this.loadImageSource(t, n).then(function(u) {
1931
- u.flipY = !1, u.name = i.name || c.name || "", u.name === "" && typeof c.uri == "string" && c.uri.startsWith("data:image/") === !1 && (u.name = c.uri);
1932
- const p = (o.samplers || {})[i.sampler] || {};
1933
- return u.magFilter = $e[p.magFilter] || Oe, u.minFilter = $e[p.minFilter] || rt, u.wrapS = qe[p.wrapS] || Ie, u.wrapT = qe[p.wrapT] || Ie, u.generateMipmaps = !u.isCompressedTexture && u.minFilter !== at && u.minFilter !== Oe, s.associations.set(u, { textures: e }), u;
1934
+ u.flipY = !1, u.name = i.name || a.name || "", u.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (u.name = a.uri);
1935
+ const p = (r.samplers || {})[i.sampler] || {};
1936
+ return u.magFilter = Ze[p.magFilter] || Ie, u.minFilter = Ze[p.minFilter] || mt, u.wrapS = Qe[p.wrapS] || ke, u.wrapT = Qe[p.wrapT] || ke, u.generateMipmaps = !u.isCompressedTexture && u.minFilter !== gt && u.minFilter !== Ie, s.associations.set(u, { textures: e }), u;
1934
1937
  }).catch(function() {
1935
1938
  return null;
1936
1939
  });
1937
- return this.textureCache[a] = l, l;
1940
+ return this.textureCache[c] = l, l;
1938
1941
  }
1939
1942
  loadImageSource(e, t) {
1940
- const n = this, s = this.json, o = this.options;
1943
+ const n = this, s = this.json, r = this.options;
1941
1944
  if (this.sourceCache[e] !== void 0)
1942
1945
  return this.sourceCache[e].then((h) => h.clone());
1943
- const i = s.images[e], c = self.URL || self.webkitURL;
1944
- let a = i.uri || "", l = !1;
1946
+ const i = s.images[e], a = self.URL || self.webkitURL;
1947
+ let c = i.uri || "", l = !1;
1945
1948
  if (i.bufferView !== void 0)
1946
- a = n.getDependency("bufferView", i.bufferView).then(function(h) {
1949
+ c = n.getDependency("bufferView", i.bufferView).then(function(h) {
1947
1950
  l = !0;
1948
1951
  const p = new Blob([h], { type: i.mimeType });
1949
- return a = c.createObjectURL(p), a;
1952
+ return c = a.createObjectURL(p), c;
1950
1953
  });
1951
1954
  else if (i.uri === void 0)
1952
1955
  throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
1953
- const u = Promise.resolve(a).then(function(h) {
1956
+ const u = Promise.resolve(c).then(function(h) {
1954
1957
  return new Promise(function(p, m) {
1955
1958
  let _ = p;
1956
- t.isImageBitmapLoader === !0 && (_ = function(w) {
1957
- const d = new Ge(w);
1959
+ t.isImageBitmapLoader === !0 && (_ = function(b) {
1960
+ const d = new Be(b);
1958
1961
  d.needsUpdate = !0, p(d);
1959
- }), t.load(re.resolveURL(h, o.path), _, void 0, m);
1962
+ }), t.load(ae.resolveURL(h, r.path), _, void 0, m);
1960
1963
  });
1961
1964
  }).then(function(h) {
1962
- return l === !0 && c.revokeObjectURL(a), B(h, i), h.userData.mimeType = i.mimeType || Js(i.uri), h;
1965
+ return l === !0 && a.revokeObjectURL(c), j(h, i), h.userData.mimeType = i.mimeType || un(i.uri), h;
1963
1966
  }).catch(function(h) {
1964
- throw console.error("THREE.GLTFLoader: Couldn't load texture", a), h;
1967
+ throw console.error("THREE.GLTFLoader: Couldn't load texture", c), h;
1965
1968
  });
1966
1969
  return this.sourceCache[e] = u, u;
1967
1970
  }
@@ -1976,14 +1979,14 @@ class tn {
1976
1979
  * @return {Promise<Texture>}
1977
1980
  */
1978
1981
  assignTexture(e, t, n, s) {
1979
- const o = this;
1982
+ const r = this;
1980
1983
  return this.getDependency("texture", n.index).then(function(i) {
1981
1984
  if (!i) return null;
1982
- if (n.texCoord !== void 0 && n.texCoord > 0 && (i = i.clone(), i.channel = n.texCoord), o.extensions[b.KHR_TEXTURE_TRANSFORM]) {
1983
- const c = n.extensions !== void 0 ? n.extensions[b.KHR_TEXTURE_TRANSFORM] : void 0;
1984
- if (c) {
1985
- const a = o.associations.get(i);
1986
- i = o.extensions[b.KHR_TEXTURE_TRANSFORM].extendTexture(i, c), o.associations.set(i, a);
1985
+ if (n.texCoord !== void 0 && n.texCoord > 0 && (i = i.clone(), i.channel = n.texCoord), r.extensions[w.KHR_TEXTURE_TRANSFORM]) {
1986
+ const a = n.extensions !== void 0 ? n.extensions[w.KHR_TEXTURE_TRANSFORM] : void 0;
1987
+ if (a) {
1988
+ const c = r.associations.get(i);
1989
+ i = r.extensions[w.KHR_TEXTURE_TRANSFORM].extendTexture(i, a), r.associations.set(i, c);
1987
1990
  }
1988
1991
  }
1989
1992
  return s !== void 0 && (i.colorSpace = s), e[t] = i, i;
@@ -2002,26 +2005,26 @@ class tn {
2002
2005
  assignFinalMaterial(e) {
2003
2006
  const t = e.geometry;
2004
2007
  let n = e.material;
2005
- const s = t.attributes.tangent === void 0, o = t.attributes.color !== void 0, i = t.attributes.normal === void 0;
2008
+ const s = t.attributes.tangent === void 0, r = t.attributes.color !== void 0, i = t.attributes.normal === void 0;
2006
2009
  if (e.isPoints) {
2007
- const c = "PointsMaterial:" + n.uuid;
2008
- let a = this.cache.get(c);
2009
- a || (a = new It(), we.prototype.copy.call(a, n), a.color.copy(n.color), a.map = n.map, a.sizeAttenuation = !1, this.cache.add(c, a)), n = a;
2010
+ const a = "PointsMaterial:" + n.uuid;
2011
+ let c = this.cache.get(a);
2012
+ c || (c = new Kt(), we.prototype.copy.call(c, n), c.color.copy(n.color), c.map = n.map, c.sizeAttenuation = !1, this.cache.add(a, c)), n = c;
2010
2013
  } else if (e.isLine) {
2011
- const c = "LineBasicMaterial:" + n.uuid;
2012
- let a = this.cache.get(c);
2013
- a || (a = new kt(), we.prototype.copy.call(a, n), a.color.copy(n.color), a.map = n.map, this.cache.add(c, a)), n = a;
2014
+ const a = "LineBasicMaterial:" + n.uuid;
2015
+ let c = this.cache.get(a);
2016
+ c || (c = new Wt(), we.prototype.copy.call(c, n), c.color.copy(n.color), c.map = n.map, this.cache.add(a, c)), n = c;
2014
2017
  }
2015
- if (s || o || i) {
2016
- let c = "ClonedMaterial:" + n.uuid + ":";
2017
- s && (c += "derivative-tangents:"), o && (c += "vertex-colors:"), i && (c += "flat-shading:");
2018
- let a = this.cache.get(c);
2019
- a || (a = n.clone(), o && (a.vertexColors = !0), i && (a.flatShading = !0), s && (a.normalScale && (a.normalScale.y *= -1), a.clearcoatNormalScale && (a.clearcoatNormalScale.y *= -1)), this.cache.add(c, a), this.associations.set(a, this.associations.get(n))), n = a;
2018
+ if (s || r || i) {
2019
+ let a = "ClonedMaterial:" + n.uuid + ":";
2020
+ s && (a += "derivative-tangents:"), r && (a += "vertex-colors:"), i && (a += "flat-shading:");
2021
+ let c = this.cache.get(a);
2022
+ c || (c = n.clone(), r && (c.vertexColors = !0), i && (c.flatShading = !0), s && (c.normalScale && (c.normalScale.y *= -1), c.clearcoatNormalScale && (c.clearcoatNormalScale.y *= -1)), this.cache.add(a, c), this.associations.set(c, this.associations.get(n))), n = c;
2020
2023
  }
2021
2024
  e.material = n;
2022
2025
  }
2023
2026
  getMaterialType() {
2024
- return ct;
2027
+ return yt;
2025
2028
  }
2026
2029
  /**
2027
2030
  * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
@@ -2031,37 +2034,37 @@ class tn {
2031
2034
  * @return {Promise<Material>}
2032
2035
  */
2033
2036
  loadMaterial(e) {
2034
- const t = this, n = this.json, s = this.extensions, o = n.materials[e];
2037
+ const t = this, n = this.json, s = this.extensions, r = n.materials[e];
2035
2038
  let i;
2036
- const c = {}, a = o.extensions || {}, l = [];
2037
- if (a[b.KHR_MATERIALS_UNLIT]) {
2038
- const h = s[b.KHR_MATERIALS_UNLIT];
2039
- i = h.getMaterialType(), l.push(h.extendParams(c, o, t));
2039
+ const a = {}, c = r.extensions || {}, l = [];
2040
+ if (c[w.KHR_MATERIALS_UNLIT]) {
2041
+ const h = s[w.KHR_MATERIALS_UNLIT];
2042
+ i = h.getMaterialType(), l.push(h.extendParams(a, r, t));
2040
2043
  } else {
2041
- const h = o.pbrMetallicRoughness || {};
2042
- if (c.color = new q(1, 1, 1), c.opacity = 1, Array.isArray(h.baseColorFactor)) {
2044
+ const h = r.pbrMetallicRoughness || {};
2045
+ if (a.color = new q(1, 1, 1), a.opacity = 1, Array.isArray(h.baseColorFactor)) {
2043
2046
  const p = h.baseColorFactor;
2044
- c.color.setRGB(p[0], p[1], p[2], j), c.opacity = p[3];
2047
+ a.color.setRGB(p[0], p[1], p[2], U), a.opacity = p[3];
2045
2048
  }
2046
- h.baseColorTexture !== void 0 && l.push(t.assignTexture(c, "map", h.baseColorTexture, $)), c.metalness = h.metallicFactor !== void 0 ? h.metallicFactor : 1, c.roughness = h.roughnessFactor !== void 0 ? h.roughnessFactor : 1, h.metallicRoughnessTexture !== void 0 && (l.push(t.assignTexture(c, "metalnessMap", h.metallicRoughnessTexture)), l.push(t.assignTexture(c, "roughnessMap", h.metallicRoughnessTexture))), i = this._invokeOne(function(p) {
2049
+ h.baseColorTexture !== void 0 && l.push(t.assignTexture(a, "map", h.baseColorTexture, Y)), a.metalness = h.metallicFactor !== void 0 ? h.metallicFactor : 1, a.roughness = h.roughnessFactor !== void 0 ? h.roughnessFactor : 1, h.metallicRoughnessTexture !== void 0 && (l.push(t.assignTexture(a, "metalnessMap", h.metallicRoughnessTexture)), l.push(t.assignTexture(a, "roughnessMap", h.metallicRoughnessTexture))), i = this._invokeOne(function(p) {
2047
2050
  return p.getMaterialType && p.getMaterialType(e);
2048
2051
  }), l.push(Promise.all(this._invokeAll(function(p) {
2049
- return p.extendMaterialParams && p.extendMaterialParams(e, c);
2052
+ return p.extendMaterialParams && p.extendMaterialParams(e, a);
2050
2053
  })));
2051
2054
  }
2052
- o.doubleSided === !0 && (c.side = Nt);
2053
- const u = o.alphaMode || Re.OPAQUE;
2054
- if (u === Re.BLEND ? (c.transparent = !0, c.depthWrite = !1) : (c.transparent = !1, u === Re.MASK && (c.alphaTest = o.alphaCutoff !== void 0 ? o.alphaCutoff : 0.5)), o.normalTexture !== void 0 && i !== ie && (l.push(t.assignTexture(c, "normalMap", o.normalTexture)), c.normalScale = new I(1, 1), o.normalTexture.scale !== void 0)) {
2055
- const h = o.normalTexture.scale;
2056
- c.normalScale.set(h, h);
2055
+ r.doubleSided === !0 && (a.side = Xt);
2056
+ const u = r.alphaMode || Se.OPAQUE;
2057
+ if (u === Se.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, u === Se.MASK && (a.alphaTest = r.alphaCutoff !== void 0 ? r.alphaCutoff : 0.5)), r.normalTexture !== void 0 && i !== re && (l.push(t.assignTexture(a, "normalMap", r.normalTexture)), a.normalScale = new I(1, 1), r.normalTexture.scale !== void 0)) {
2058
+ const h = r.normalTexture.scale;
2059
+ a.normalScale.set(h, h);
2057
2060
  }
2058
- if (o.occlusionTexture !== void 0 && i !== ie && (l.push(t.assignTexture(c, "aoMap", o.occlusionTexture)), o.occlusionTexture.strength !== void 0 && (c.aoMapIntensity = o.occlusionTexture.strength)), o.emissiveFactor !== void 0 && i !== ie) {
2059
- const h = o.emissiveFactor;
2060
- c.emissive = new q().setRGB(h[0], h[1], h[2], j);
2061
+ if (r.occlusionTexture !== void 0 && i !== re && (l.push(t.assignTexture(a, "aoMap", r.occlusionTexture)), r.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = r.occlusionTexture.strength)), r.emissiveFactor !== void 0 && i !== re) {
2062
+ const h = r.emissiveFactor;
2063
+ a.emissive = new q().setRGB(h[0], h[1], h[2], U);
2061
2064
  }
2062
- return o.emissiveTexture !== void 0 && i !== ie && l.push(t.assignTexture(c, "emissiveMap", o.emissiveTexture, $)), Promise.all(l).then(function() {
2063
- const h = new i(c);
2064
- return o.name && (h.name = o.name), B(h, o), t.associations.set(h, { materials: e }), o.extensions && Q(s, h, o), h;
2065
+ return r.emissiveTexture !== void 0 && i !== re && l.push(t.assignTexture(a, "emissiveMap", r.emissiveTexture, Y)), Promise.all(l).then(function() {
2066
+ const h = new i(a);
2067
+ return r.name && (h.name = r.name), j(h, r), t.associations.set(h, { materials: e }), r.extensions && Z(s, h, r), h;
2065
2068
  });
2066
2069
  }
2067
2070
  /**
@@ -2072,7 +2075,7 @@ class tn {
2072
2075
  * @return {string}
2073
2076
  */
2074
2077
  createUniqueName(e) {
2075
- const t = vt.sanitizeNodeName(e || "");
2078
+ const t = Vt.sanitizeNodeName(e || "");
2076
2079
  return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);
2077
2080
  }
2078
2081
  /**
@@ -2086,19 +2089,19 @@ class tn {
2086
2089
  */
2087
2090
  loadGeometries(e) {
2088
2091
  const t = this, n = this.extensions, s = this.primitiveCache;
2089
- function o(c) {
2090
- return n[b.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(c, t).then(function(a) {
2091
- return Ze(a, c, t);
2092
+ function r(a) {
2093
+ return n[w.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(c) {
2094
+ return Je(c, a, t);
2092
2095
  });
2093
2096
  }
2094
2097
  const i = [];
2095
- for (let c = 0, a = e.length; c < a; c++) {
2096
- const l = e[c], u = Qs(l), h = s[u];
2098
+ for (let a = 0, c = e.length; a < c; a++) {
2099
+ const l = e[a], u = hn(l), h = s[u];
2097
2100
  if (h)
2098
2101
  i.push(h.promise);
2099
2102
  else {
2100
2103
  let p;
2101
- l.extensions && l.extensions[b.KHR_DRACO_MESH_COMPRESSION] ? p = o(l) : p = Ze(new ot(), l, t), s[u] = { primitive: l, promise: p }, i.push(p);
2104
+ l.extensions && l.extensions[w.KHR_DRACO_MESH_COMPRESSION] ? p = r(l) : p = Je(new pt(), l, t), s[u] = { primitive: l, promise: p }, i.push(p);
2102
2105
  }
2103
2106
  }
2104
2107
  return Promise.all(i);
@@ -2111,30 +2114,30 @@ class tn {
2111
2114
  * @return {Promise<Group|Mesh|SkinnedMesh|Line|Points>}
2112
2115
  */
2113
2116
  loadMesh(e) {
2114
- const t = this, n = this.json, s = this.extensions, o = n.meshes[e], i = o.primitives, c = [];
2115
- for (let a = 0, l = i.length; a < l; a++) {
2116
- const u = i[a].material === void 0 ? $s(this.cache) : this.getDependency("material", i[a].material);
2117
- c.push(u);
2117
+ const t = this, n = this.json, s = this.extensions, r = n.meshes[e], i = r.primitives, a = [];
2118
+ for (let c = 0, l = i.length; c < l; c++) {
2119
+ const u = i[c].material === void 0 ? an(this.cache) : this.getDependency("material", i[c].material);
2120
+ a.push(u);
2118
2121
  }
2119
- return c.push(t.loadGeometries(i)), Promise.all(c).then(function(a) {
2120
- const l = a.slice(0, a.length - 1), u = a[a.length - 1], h = [];
2122
+ return a.push(t.loadGeometries(i)), Promise.all(a).then(function(c) {
2123
+ const l = c.slice(0, c.length - 1), u = c[c.length - 1], h = [];
2121
2124
  for (let m = 0, _ = u.length; m < _; m++) {
2122
- const w = u[m], d = i[m];
2125
+ const b = u[m], d = i[m];
2123
2126
  let f;
2124
2127
  const g = l[m];
2125
2128
  if (d.mode === k.TRIANGLES || d.mode === k.TRIANGLE_STRIP || d.mode === k.TRIANGLE_FAN || d.mode === void 0)
2126
- f = o.isSkinnedMesh === !0 ? new Ht(w, g) : new Ft(w, g), f.isSkinnedMesh === !0 && f.normalizeSkinWeights(), d.mode === k.TRIANGLE_STRIP ? f.geometry = Xe(f.geometry, nt) : d.mode === k.TRIANGLE_FAN && (f.geometry = Xe(f.geometry, Ce));
2129
+ f = r.isSkinnedMesh === !0 ? new Yt(b, g) : new qt(b, g), f.isSkinnedMesh === !0 && f.normalizeSkinWeights(), d.mode === k.TRIANGLE_STRIP ? f.geometry = qe(f.geometry, dt) : d.mode === k.TRIANGLE_FAN && (f.geometry = qe(f.geometry, Ce));
2127
2130
  else if (d.mode === k.LINES)
2128
- f = new Ut(w, g);
2131
+ f = new $t(b, g);
2129
2132
  else if (d.mode === k.LINE_STRIP)
2130
- f = new jt(w, g);
2133
+ f = new Zt(b, g);
2131
2134
  else if (d.mode === k.LINE_LOOP)
2132
- f = new Gt(w, g);
2135
+ f = new Qt(b, g);
2133
2136
  else if (d.mode === k.POINTS)
2134
- f = new Bt(w, g);
2137
+ f = new Jt(b, g);
2135
2138
  else
2136
2139
  throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + d.mode);
2137
- Object.keys(f.geometry.morphAttributes).length > 0 && Zs(f, o), f.name = t.createUniqueName(o.name || "mesh_" + e), B(f, o), d.extensions && Q(s, f, d), t.assignFinalMaterial(f), h.push(f);
2140
+ Object.keys(f.geometry.morphAttributes).length > 0 && ln(f, r), f.name = t.createUniqueName(r.name || "mesh_" + e), j(f, r), d.extensions && Z(s, f, d), t.assignFinalMaterial(f), h.push(f);
2138
2141
  }
2139
2142
  for (let m = 0, _ = h.length; m < _; m++)
2140
2143
  t.associations.set(h[m], {
@@ -2142,9 +2145,9 @@ class tn {
2142
2145
  primitives: m
2143
2146
  });
2144
2147
  if (h.length === 1)
2145
- return o.extensions && Q(s, h[0], o), h[0];
2146
- const p = new be();
2147
- o.extensions && Q(s, p, o), t.associations.set(p, { meshes: e });
2148
+ return r.extensions && Z(s, h[0], r), h[0];
2149
+ const p = new Ee();
2150
+ r.extensions && Z(s, p, r), t.associations.set(p, { meshes: e });
2148
2151
  for (let m = 0, _ = h.length; m < _; m++)
2149
2152
  p.add(h[m]);
2150
2153
  return p;
@@ -2164,7 +2167,7 @@ class tn {
2164
2167
  console.warn("THREE.GLTFLoader: Missing camera parameters.");
2165
2168
  return;
2166
2169
  }
2167
- return n.type === "perspective" ? t = new zt(st.radToDeg(s.yfov), s.aspectRatio || 1, s.znear || 1, s.zfar || 2e6) : n.type === "orthographic" && (t = new Kt(-s.xmag, s.xmag, s.ymag, -s.ymag, s.znear, s.zfar)), n.name && (t.name = this.createUniqueName(n.name)), B(t, n), Promise.resolve(t);
2170
+ return n.type === "perspective" ? t = new es(ut.radToDeg(s.yfov), s.aspectRatio || 1, s.znear || 1, s.zfar || 2e6) : n.type === "orthographic" && (t = new ts(-s.xmag, s.xmag, s.ymag, -s.ymag, s.znear, s.zfar)), n.name && (t.name = this.createUniqueName(n.name)), j(t, n), Promise.resolve(t);
2168
2171
  }
2169
2172
  /**
2170
2173
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
@@ -2175,20 +2178,20 @@ class tn {
2175
2178
  */
2176
2179
  loadSkin(e) {
2177
2180
  const t = this.json.skins[e], n = [];
2178
- for (let s = 0, o = t.joints.length; s < o; s++)
2181
+ for (let s = 0, r = t.joints.length; s < r; s++)
2179
2182
  n.push(this._loadNodeShallow(t.joints[s]));
2180
2183
  return t.inverseBindMatrices !== void 0 ? n.push(this.getDependency("accessor", t.inverseBindMatrices)) : n.push(null), Promise.all(n).then(function(s) {
2181
- const o = s.pop(), i = s, c = [], a = [];
2184
+ const r = s.pop(), i = s, a = [], c = [];
2182
2185
  for (let l = 0, u = i.length; l < u; l++) {
2183
2186
  const h = i[l];
2184
2187
  if (h) {
2185
- c.push(h);
2188
+ a.push(h);
2186
2189
  const p = new se();
2187
- o !== null && p.fromArray(o.array, l * 16), a.push(p);
2190
+ r !== null && p.fromArray(r.array, l * 16), c.push(p);
2188
2191
  } else
2189
2192
  console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[l]);
2190
2193
  }
2191
- return new Wt(c, a);
2194
+ return new ss(a, c);
2192
2195
  });
2193
2196
  }
2194
2197
  /**
@@ -2199,39 +2202,39 @@ class tn {
2199
2202
  * @return {Promise<AnimationClip>}
2200
2203
  */
2201
2204
  loadAnimation(e) {
2202
- const t = this.json, n = this, s = t.animations[e], o = s.name ? s.name : "animation_" + e, i = [], c = [], a = [], l = [], u = [];
2205
+ const t = this.json, n = this, s = t.animations[e], r = s.name ? s.name : "animation_" + e, i = [], a = [], c = [], l = [], u = [];
2203
2206
  for (let h = 0, p = s.channels.length; h < p; h++) {
2204
- const m = s.channels[h], _ = s.samplers[m.sampler], w = m.target, d = w.node, f = s.parameters !== void 0 ? s.parameters[_.input] : _.input, g = s.parameters !== void 0 ? s.parameters[_.output] : _.output;
2205
- w.node !== void 0 && (i.push(this.getDependency("node", d)), c.push(this.getDependency("accessor", f)), a.push(this.getDependency("accessor", g)), l.push(_), u.push(w));
2207
+ const m = s.channels[h], _ = s.samplers[m.sampler], b = m.target, d = b.node, f = s.parameters !== void 0 ? s.parameters[_.input] : _.input, g = s.parameters !== void 0 ? s.parameters[_.output] : _.output;
2208
+ b.node !== void 0 && (i.push(this.getDependency("node", d)), a.push(this.getDependency("accessor", f)), c.push(this.getDependency("accessor", g)), l.push(_), u.push(b));
2206
2209
  }
2207
2210
  return Promise.all([
2208
2211
  Promise.all(i),
2209
- Promise.all(c),
2210
2212
  Promise.all(a),
2213
+ Promise.all(c),
2211
2214
  Promise.all(l),
2212
2215
  Promise.all(u)
2213
2216
  ]).then(function(h) {
2214
- const p = h[0], m = h[1], _ = h[2], w = h[3], d = h[4], f = [];
2217
+ const p = h[0], m = h[1], _ = h[2], b = h[3], d = h[4], f = [];
2215
2218
  for (let g = 0, T = p.length; g < T; g++) {
2216
- const y = p[g], E = m[g], x = _[g], M = w[g], C = d[g];
2219
+ const y = p[g], E = m[g], A = _[g], S = b[g], P = d[g];
2217
2220
  if (y === void 0) continue;
2218
2221
  y.updateMatrix && y.updateMatrix();
2219
- const P = n._createAnimationTracks(y, E, x, M, C);
2220
- if (P)
2221
- for (let K = 0; K < P.length; K++)
2222
- f.push(P[K]);
2222
+ const C = n._createAnimationTracks(y, E, A, S, P);
2223
+ if (C)
2224
+ for (let B = 0; B < C.length; B++)
2225
+ f.push(C[B]);
2223
2226
  }
2224
- return new Vt(o, void 0, f);
2227
+ return new ns(r, void 0, f);
2225
2228
  });
2226
2229
  }
2227
2230
  createNodeMesh(e) {
2228
2231
  const t = this.json, n = this, s = t.nodes[e];
2229
- return s.mesh === void 0 ? null : n.getDependency("mesh", s.mesh).then(function(o) {
2230
- const i = n._getNodeRef(n.meshCache, s.mesh, o);
2231
- return s.weights !== void 0 && i.traverse(function(c) {
2232
- if (c.isMesh)
2233
- for (let a = 0, l = s.weights.length; a < l; a++)
2234
- c.morphTargetInfluences[a] = s.weights[a];
2232
+ return s.mesh === void 0 ? null : n.getDependency("mesh", s.mesh).then(function(r) {
2233
+ const i = n._getNodeRef(n.meshCache, s.mesh, r);
2234
+ return s.weights !== void 0 && i.traverse(function(a) {
2235
+ if (a.isMesh)
2236
+ for (let c = 0, l = s.weights.length; c < l; c++)
2237
+ a.morphTargetInfluences[c] = s.weights[c];
2235
2238
  }), i;
2236
2239
  });
2237
2240
  }
@@ -2243,18 +2246,18 @@ class tn {
2243
2246
  * @return {Promise<Object3D>}
2244
2247
  */
2245
2248
  loadNode(e) {
2246
- const t = this.json, n = this, s = t.nodes[e], o = n._loadNodeShallow(e), i = [], c = s.children || [];
2247
- for (let l = 0, u = c.length; l < u; l++)
2248
- i.push(n.getDependency("node", c[l]));
2249
- const a = s.skin === void 0 ? Promise.resolve(null) : n.getDependency("skin", s.skin);
2249
+ const t = this.json, n = this, s = t.nodes[e], r = n._loadNodeShallow(e), i = [], a = s.children || [];
2250
+ for (let l = 0, u = a.length; l < u; l++)
2251
+ i.push(n.getDependency("node", a[l]));
2252
+ const c = s.skin === void 0 ? Promise.resolve(null) : n.getDependency("skin", s.skin);
2250
2253
  return Promise.all([
2251
- o,
2254
+ r,
2252
2255
  Promise.all(i),
2253
- a
2256
+ c
2254
2257
  ]).then(function(l) {
2255
2258
  const u = l[0], h = l[1], p = l[2];
2256
2259
  p !== null && u.traverse(function(m) {
2257
- m.isSkinnedMesh && m.bind(p, en);
2260
+ m.isSkinnedMesh && m.bind(p, dn);
2258
2261
  });
2259
2262
  for (let m = 0, _ = h.length; m < _; m++)
2260
2263
  u.add(h[m]);
@@ -2267,28 +2270,28 @@ class tn {
2267
2270
  const t = this.json, n = this.extensions, s = this;
2268
2271
  if (this.nodeCache[e] !== void 0)
2269
2272
  return this.nodeCache[e];
2270
- const o = t.nodes[e], i = o.name ? s.createUniqueName(o.name) : "", c = [], a = s._invokeOne(function(l) {
2273
+ const r = t.nodes[e], i = r.name ? s.createUniqueName(r.name) : "", a = [], c = s._invokeOne(function(l) {
2271
2274
  return l.createNodeMesh && l.createNodeMesh(e);
2272
2275
  });
2273
- return a && c.push(a), o.camera !== void 0 && c.push(s.getDependency("camera", o.camera).then(function(l) {
2274
- return s._getNodeRef(s.cameraCache, o.camera, l);
2276
+ return c && a.push(c), r.camera !== void 0 && a.push(s.getDependency("camera", r.camera).then(function(l) {
2277
+ return s._getNodeRef(s.cameraCache, r.camera, l);
2275
2278
  })), s._invokeAll(function(l) {
2276
2279
  return l.createNodeAttachment && l.createNodeAttachment(e);
2277
2280
  }).forEach(function(l) {
2278
- c.push(l);
2279
- }), this.nodeCache[e] = Promise.all(c).then(function(l) {
2281
+ a.push(l);
2282
+ }), this.nodeCache[e] = Promise.all(a).then(function(l) {
2280
2283
  let u;
2281
- if (o.isBone === !0 ? u = new Xt() : l.length > 1 ? u = new be() : l.length === 1 ? u = l[0] : u = new He(), u !== l[0])
2284
+ if (r.isBone === !0 ? u = new is() : l.length > 1 ? u = new Ee() : l.length === 1 ? u = l[0] : u = new Fe(), u !== l[0])
2282
2285
  for (let h = 0, p = l.length; h < p; h++)
2283
2286
  u.add(l[h]);
2284
- if (o.name && (u.userData.name = o.name, u.name = i), B(u, o), o.extensions && Q(n, u, o), o.matrix !== void 0) {
2287
+ if (r.name && (u.userData.name = r.name, u.name = i), j(u, r), r.extensions && Z(n, u, r), r.matrix !== void 0) {
2285
2288
  const h = new se();
2286
- h.fromArray(o.matrix), u.applyMatrix4(h);
2289
+ h.fromArray(r.matrix), u.applyMatrix4(h);
2287
2290
  } else
2288
- o.translation !== void 0 && u.position.fromArray(o.translation), o.rotation !== void 0 && u.quaternion.fromArray(o.rotation), o.scale !== void 0 && u.scale.fromArray(o.scale);
2291
+ r.translation !== void 0 && u.position.fromArray(r.translation), r.rotation !== void 0 && u.quaternion.fromArray(r.rotation), r.scale !== void 0 && u.scale.fromArray(r.scale);
2289
2292
  if (!s.associations.has(u))
2290
2293
  s.associations.set(u, {});
2291
- else if (o.mesh !== void 0 && s.meshCache.refs[o.mesh] > 1) {
2294
+ else if (r.mesh !== void 0 && s.meshCache.refs[r.mesh] > 1) {
2292
2295
  const h = s.associations.get(u);
2293
2296
  s.associations.set(u, { ...h });
2294
2297
  }
@@ -2303,60 +2306,60 @@ class tn {
2303
2306
  * @return {Promise<Group>}
2304
2307
  */
2305
2308
  loadScene(e) {
2306
- const t = this.extensions, n = this.json.scenes[e], s = this, o = new be();
2307
- n.name && (o.name = s.createUniqueName(n.name)), B(o, n), n.extensions && Q(t, o, n);
2308
- const i = n.nodes || [], c = [];
2309
- for (let a = 0, l = i.length; a < l; a++)
2310
- c.push(s.getDependency("node", i[a]));
2311
- return Promise.all(c).then(function(a) {
2312
- for (let u = 0, h = a.length; u < h; u++)
2313
- o.add(a[u]);
2309
+ const t = this.extensions, n = this.json.scenes[e], s = this, r = new Ee();
2310
+ n.name && (r.name = s.createUniqueName(n.name)), j(r, n), n.extensions && Z(t, r, n);
2311
+ const i = n.nodes || [], a = [];
2312
+ for (let c = 0, l = i.length; c < l; c++)
2313
+ a.push(s.getDependency("node", i[c]));
2314
+ return Promise.all(a).then(function(c) {
2315
+ for (let u = 0, h = c.length; u < h; u++)
2316
+ r.add(c[u]);
2314
2317
  const l = (u) => {
2315
2318
  const h = /* @__PURE__ */ new Map();
2316
2319
  for (const [p, m] of s.associations)
2317
- (p instanceof we || p instanceof Ge) && h.set(p, m);
2320
+ (p instanceof we || p instanceof Be) && h.set(p, m);
2318
2321
  return u.traverse((p) => {
2319
2322
  const m = s.associations.get(p);
2320
2323
  m != null && h.set(p, m);
2321
2324
  }), h;
2322
2325
  };
2323
- return s.associations = l(o), o;
2326
+ return s.associations = l(r), r;
2324
2327
  });
2325
2328
  }
2326
- _createAnimationTracks(e, t, n, s, o) {
2327
- const i = [], c = e.name ? e.name : e.uuid, a = [];
2328
- W[o.path] === W.weights ? e.traverse(function(p) {
2329
- p.morphTargetInfluences && a.push(p.name ? p.name : p.uuid);
2330
- }) : a.push(c);
2329
+ _createAnimationTracks(e, t, n, s, r) {
2330
+ const i = [], a = e.name ? e.name : e.uuid, c = [];
2331
+ K[r.path] === K.weights ? e.traverse(function(p) {
2332
+ p.morphTargetInfluences && c.push(p.name ? p.name : p.uuid);
2333
+ }) : c.push(a);
2331
2334
  let l;
2332
- switch (W[o.path]) {
2333
- case W.weights:
2334
- l = ze;
2335
+ switch (K[r.path]) {
2336
+ case K.weights:
2337
+ l = We;
2335
2338
  break;
2336
- case W.rotation:
2337
- l = Ke;
2339
+ case K.rotation:
2340
+ l = Xe;
2338
2341
  break;
2339
- case W.translation:
2340
- case W.scale:
2341
- l = Be;
2342
+ case K.translation:
2343
+ case K.scale:
2344
+ l = Ke;
2342
2345
  break;
2343
2346
  default:
2344
2347
  switch (n.itemSize) {
2345
2348
  case 1:
2346
- l = ze;
2349
+ l = We;
2347
2350
  break;
2348
2351
  case 2:
2349
2352
  case 3:
2350
2353
  default:
2351
- l = Be;
2354
+ l = Ke;
2352
2355
  break;
2353
2356
  }
2354
2357
  break;
2355
2358
  }
2356
- const u = s.interpolation !== void 0 ? Ys[s.interpolation] : lt, h = this._getArrayFromAccessor(n);
2357
- for (let p = 0, m = a.length; p < m; p++) {
2359
+ const u = s.interpolation !== void 0 ? on[s.interpolation] : _t, h = this._getArrayFromAccessor(n);
2360
+ for (let p = 0, m = c.length; p < m; p++) {
2358
2361
  const _ = new l(
2359
- a[p] + "." + W[o.path],
2362
+ c[p] + "." + K[r.path],
2360
2363
  t.array,
2361
2364
  h,
2362
2365
  u
@@ -2368,30 +2371,30 @@ class tn {
2368
2371
  _getArrayFromAccessor(e) {
2369
2372
  let t = e.array;
2370
2373
  if (e.normalized) {
2371
- const n = Ne(t.constructor), s = new Float32Array(t.length);
2372
- for (let o = 0, i = t.length; o < i; o++)
2373
- s[o] = t[o] * n;
2374
+ const n = ve(t.constructor), s = new Float32Array(t.length);
2375
+ for (let r = 0, i = t.length; r < i; r++)
2376
+ s[r] = t[r] * n;
2374
2377
  t = s;
2375
2378
  }
2376
2379
  return t;
2377
2380
  }
2378
2381
  _createCubicSplineTrackInterpolant(e) {
2379
2382
  e.createInterpolant = function(n) {
2380
- const s = this instanceof Ke ? Xs : ft;
2383
+ const s = this instanceof Xe ? rn : Et;
2381
2384
  return new s(this.times, this.values, this.getValueSize() / 3, n);
2382
2385
  }, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
2383
2386
  }
2384
2387
  }
2385
- function sn(r, e, t) {
2386
- const n = e.attributes, s = new Zt();
2388
+ function pn(o, e, t) {
2389
+ const n = e.attributes, s = new cs();
2387
2390
  if (n.POSITION !== void 0) {
2388
- const c = t.json.accessors[n.POSITION], a = c.min, l = c.max;
2389
- if (a !== void 0 && l !== void 0) {
2391
+ const a = t.json.accessors[n.POSITION], c = a.min, l = a.max;
2392
+ if (c !== void 0 && l !== void 0) {
2390
2393
  if (s.set(
2391
- new S(a[0], a[1], a[2]),
2392
- new S(l[0], l[1], l[2])
2393
- ), c.normalized) {
2394
- const u = Ne(te[c.componentType]);
2394
+ new R(c[0], c[1], c[2]),
2395
+ new R(l[0], l[1], l[2])
2396
+ ), a.normalized) {
2397
+ const u = ve(te[a.componentType]);
2395
2398
  s.min.multiplyScalar(u), s.max.multiplyScalar(u);
2396
2399
  }
2397
2400
  } else {
@@ -2400,52 +2403,52 @@ function sn(r, e, t) {
2400
2403
  }
2401
2404
  } else
2402
2405
  return;
2403
- const o = e.targets;
2404
- if (o !== void 0) {
2405
- const c = new S(), a = new S();
2406
- for (let l = 0, u = o.length; l < u; l++) {
2407
- const h = o[l];
2406
+ const r = e.targets;
2407
+ if (r !== void 0) {
2408
+ const a = new R(), c = new R();
2409
+ for (let l = 0, u = r.length; l < u; l++) {
2410
+ const h = r[l];
2408
2411
  if (h.POSITION !== void 0) {
2409
2412
  const p = t.json.accessors[h.POSITION], m = p.min, _ = p.max;
2410
2413
  if (m !== void 0 && _ !== void 0) {
2411
- if (a.setX(Math.max(Math.abs(m[0]), Math.abs(_[0]))), a.setY(Math.max(Math.abs(m[1]), Math.abs(_[1]))), a.setZ(Math.max(Math.abs(m[2]), Math.abs(_[2]))), p.normalized) {
2412
- const w = Ne(te[p.componentType]);
2413
- a.multiplyScalar(w);
2414
+ if (c.setX(Math.max(Math.abs(m[0]), Math.abs(_[0]))), c.setY(Math.max(Math.abs(m[1]), Math.abs(_[1]))), c.setZ(Math.max(Math.abs(m[2]), Math.abs(_[2]))), p.normalized) {
2415
+ const b = ve(te[p.componentType]);
2416
+ c.multiplyScalar(b);
2414
2417
  }
2415
- c.max(a);
2418
+ a.max(c);
2416
2419
  } else
2417
2420
  console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
2418
2421
  }
2419
2422
  }
2420
- s.expandByVector(c);
2423
+ s.expandByVector(a);
2421
2424
  }
2422
- r.boundingBox = s;
2423
- const i = new Qt();
2424
- s.getCenter(i.center), i.radius = s.min.distanceTo(s.max) / 2, r.boundingSphere = i;
2425
+ o.boundingBox = s;
2426
+ const i = new ls();
2427
+ s.getCenter(i.center), i.radius = s.min.distanceTo(s.max) / 2, o.boundingSphere = i;
2425
2428
  }
2426
- function Ze(r, e, t) {
2429
+ function Je(o, e, t) {
2427
2430
  const n = e.attributes, s = [];
2428
- function o(i, c) {
2429
- return t.getDependency("accessor", i).then(function(a) {
2430
- r.setAttribute(c, a);
2431
+ function r(i, a) {
2432
+ return t.getDependency("accessor", i).then(function(c) {
2433
+ o.setAttribute(a, c);
2431
2434
  });
2432
2435
  }
2433
2436
  for (const i in n) {
2434
- const c = ke[i] || i.toLowerCase();
2435
- c in r.attributes || s.push(o(n[i], c));
2437
+ const a = Ne[i] || i.toLowerCase();
2438
+ a in o.attributes || s.push(r(n[i], a));
2436
2439
  }
2437
- if (e.indices !== void 0 && !r.index) {
2438
- const i = t.getDependency("accessor", e.indices).then(function(c) {
2439
- r.setIndex(c);
2440
+ if (e.indices !== void 0 && !o.index) {
2441
+ const i = t.getDependency("accessor", e.indices).then(function(a) {
2442
+ o.setIndex(a);
2440
2443
  });
2441
2444
  s.push(i);
2442
2445
  }
2443
- return Pe.workingColorSpace !== j && "COLOR_0" in n && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Pe.workingColorSpace}" not supported.`), B(r, e), sn(r, e, t), Promise.all(s).then(function() {
2444
- return e.targets !== void 0 ? qs(r, e.targets, t) : r;
2446
+ return Oe.workingColorSpace !== U && "COLOR_0" in n && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Oe.workingColorSpace}" not supported.`), j(o, e), pn(o, e, t), Promise.all(s).then(function() {
2447
+ return e.targets !== void 0 ? cn(o, e.targets, t) : o;
2445
2448
  });
2446
2449
  }
2447
- const Qe = new S(), nn = new le(), Je = new S();
2448
- class on extends He {
2450
+ const et = new R(), mn = new ue(), tt = new R();
2451
+ class gn extends Fe {
2449
2452
  /**
2450
2453
  * Constructs a new CSS3D object.
2451
2454
  *
@@ -2462,7 +2465,7 @@ class on extends He {
2462
2465
  return super.copy(e, t), this.element = e.element.cloneNode(!0), this;
2463
2466
  }
2464
2467
  }
2465
- class Tn extends on {
2468
+ class Pn extends gn {
2466
2469
  /**
2467
2470
  * Constructs a new CSS3D sprite object.
2468
2471
  *
@@ -2475,8 +2478,8 @@ class Tn extends on {
2475
2478
  return super.copy(e, t), this.rotation2D = e.rotation2D, this;
2476
2479
  }
2477
2480
  }
2478
- const F = new se(), rn = new se();
2479
- class wn {
2481
+ const F = new se(), yn = new se();
2482
+ class Cn {
2480
2483
  /**
2481
2484
  * Constructs a new CSS3D renderer.
2482
2485
  *
@@ -2484,14 +2487,14 @@ class wn {
2484
2487
  */
2485
2488
  constructor(e = {}) {
2486
2489
  const t = this;
2487
- let n, s, o, i;
2488
- const c = {
2490
+ let n, s, r, i;
2491
+ const a = {
2489
2492
  camera: { style: "" },
2490
2493
  objects: /* @__PURE__ */ new WeakMap()
2491
- }, a = e.element !== void 0 ? e.element : document.createElement("div");
2492
- a.style.overflow = "hidden", this.domElement = a;
2494
+ }, c = e.element !== void 0 ? e.element : document.createElement("div");
2495
+ c.style.overflow = "hidden", this.domElement = c;
2493
2496
  const l = document.createElement("div");
2494
- l.style.transformOrigin = "0 0", l.style.pointerEvents = "none", a.appendChild(l);
2497
+ l.style.transformOrigin = "0 0", l.style.pointerEvents = "none", c.appendChild(l);
2495
2498
  const u = document.createElement("div");
2496
2499
  u.style.transformStyle = "preserve-3d", l.appendChild(u), this.getSize = function() {
2497
2500
  return {
@@ -2503,10 +2506,10 @@ class wn {
2503
2506
  f.view && f.view.enabled ? (l.style.transform = `translate( ${-f.view.offsetX * (n / f.view.width)}px, ${-f.view.offsetY * (s / f.view.height)}px )`, l.style.transform += `scale( ${f.view.fullWidth / f.view.width}, ${f.view.fullHeight / f.view.height} )`) : l.style.transform = "", d.matrixWorldAutoUpdate === !0 && d.updateMatrixWorld(), f.parent === null && f.matrixWorldAutoUpdate === !0 && f.updateMatrixWorld();
2504
2507
  let T, y;
2505
2508
  f.isOrthographicCamera && (T = -(f.right + f.left) / 2, y = (f.top + f.bottom) / 2);
2506
- const E = f.view && f.view.enabled ? f.view.height / f.view.fullHeight : 1, x = f.isOrthographicCamera ? `scale( ${E} )scale(` + g + ")translate(" + h(T) + "px," + h(y) + "px)" + p(f.matrixWorldInverse) : `scale( ${E} )translateZ(` + g + "px)" + p(f.matrixWorldInverse), C = (f.isPerspectiveCamera ? "perspective(" + g + "px) " : "") + x + "translate(" + o + "px," + i + "px)";
2507
- c.camera.style !== C && (u.style.transform = C, c.camera.style = C), w(d, d, f);
2509
+ const E = f.view && f.view.enabled ? f.view.height / f.view.fullHeight : 1, A = f.isOrthographicCamera ? `scale( ${E} )scale(` + g + ")translate(" + h(T) + "px," + h(y) + "px)" + p(f.matrixWorldInverse) : `scale( ${E} )translateZ(` + g + "px)" + p(f.matrixWorldInverse), P = (f.isPerspectiveCamera ? "perspective(" + g + "px) " : "") + A + "translate(" + r + "px," + i + "px)";
2510
+ a.camera.style !== P && (u.style.transform = P, a.camera.style = P), b(d, d, f);
2508
2511
  }, this.setSize = function(d, f) {
2509
- n = d, s = f, o = n / 2, i = s / 2, a.style.width = d + "px", a.style.height = f + "px", l.style.width = d + "px", l.style.height = f + "px", u.style.width = d + "px", u.style.height = f + "px";
2512
+ n = d, s = f, r = n / 2, i = s / 2, c.style.width = d + "px", c.style.height = f + "px", l.style.width = d + "px", l.style.height = f + "px", u.style.width = d + "px", u.style.height = f + "px";
2510
2513
  };
2511
2514
  function h(d) {
2512
2515
  return Math.abs(d) < 1e-10 ? 0 : d;
@@ -2524,7 +2527,7 @@ class wn {
2524
2527
  for (let f = 0, g = d.children.length; f < g; f++)
2525
2528
  _(d.children[f]);
2526
2529
  }
2527
- function w(d, f, g, T) {
2530
+ function b(d, f, g, T) {
2528
2531
  if (d.visible === !1) {
2529
2532
  _(d);
2530
2533
  return;
@@ -2533,26 +2536,26 @@ class wn {
2533
2536
  const y = d.layers.test(g.layers) === !0, E = d.element;
2534
2537
  if (E.style.display = y === !0 ? "" : "none", y === !0) {
2535
2538
  d.onBeforeRender(t, f, g);
2536
- let x;
2537
- d.isCSS3DSprite ? (F.copy(g.matrixWorldInverse), F.transpose(), d.rotation2D !== 0 && F.multiply(rn.makeRotationZ(d.rotation2D)), d.matrixWorld.decompose(Qe, nn, Je), F.setPosition(Qe), F.scale(Je), F.elements[3] = 0, F.elements[7] = 0, F.elements[11] = 0, F.elements[15] = 1, x = m(F)) : x = m(d.matrixWorld);
2538
- const M = c.objects.get(d);
2539
- if (M === void 0 || M.style !== x) {
2540
- E.style.transform = x;
2541
- const C = { style: x };
2542
- c.objects.set(d, C);
2539
+ let A;
2540
+ d.isCSS3DSprite ? (F.copy(g.matrixWorldInverse), F.transpose(), d.rotation2D !== 0 && F.multiply(yn.makeRotationZ(d.rotation2D)), d.matrixWorld.decompose(et, mn, tt), F.setPosition(et), F.scale(tt), F.elements[3] = 0, F.elements[7] = 0, F.elements[11] = 0, F.elements[15] = 1, A = m(F)) : A = m(d.matrixWorld);
2541
+ const S = a.objects.get(d);
2542
+ if (S === void 0 || S.style !== A) {
2543
+ E.style.transform = A;
2544
+ const P = { style: A };
2545
+ a.objects.set(d, P);
2543
2546
  }
2544
2547
  E.parentNode !== u && u.appendChild(E), d.onAfterRender(t, f, g);
2545
2548
  }
2546
2549
  }
2547
2550
  for (let y = 0, E = d.children.length; y < E; y++)
2548
- w(d.children[y], f, g);
2551
+ b(d.children[y], f, g);
2549
2552
  }
2550
2553
  }
2551
2554
  }
2552
- var ae = function() {
2553
- var r = 0, e = document.createElement("div");
2555
+ var ce = function() {
2556
+ var o = 0, e = document.createElement("div");
2554
2557
  e.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000", e.addEventListener("click", function(u) {
2555
- u.preventDefault(), n(++r % e.children.length);
2558
+ u.preventDefault(), n(++o % e.children.length);
2556
2559
  }, !1);
2557
2560
  function t(u) {
2558
2561
  return e.appendChild(u.dom), u;
@@ -2560,11 +2563,11 @@ var ae = function() {
2560
2563
  function n(u) {
2561
2564
  for (var h = 0; h < e.children.length; h++)
2562
2565
  e.children[h].style.display = h === u ? "block" : "none";
2563
- r = u;
2566
+ o = u;
2564
2567
  }
2565
- var s = (performance || Date).now(), o = s, i = 0, c = t(new ae.Panel("FPS", "#0ff", "#002")), a = t(new ae.Panel("MS", "#0f0", "#020"));
2568
+ var s = (performance || Date).now(), r = s, i = 0, a = t(new ce.Panel("FPS", "#0ff", "#002")), c = t(new ce.Panel("MS", "#0f0", "#020"));
2566
2569
  if (self.performance && self.performance.memory)
2567
- var l = t(new ae.Panel("MB", "#f08", "#201"));
2570
+ var l = t(new ce.Panel("MB", "#f08", "#201"));
2568
2571
  return n(0), {
2569
2572
  REVISION: 16,
2570
2573
  dom: e,
@@ -2576,7 +2579,7 @@ var ae = function() {
2576
2579
  end: function() {
2577
2580
  i++;
2578
2581
  var u = (performance || Date).now();
2579
- if (a.update(u - s, 200), u >= o + 1e3 && (c.update(i * 1e3 / (u - o), 100), o = u, i = 0, l)) {
2582
+ if (c.update(u - s, 200), u >= r + 1e3 && (a.update(i * 1e3 / (u - r), 100), r = u, i = 0, l)) {
2580
2583
  var h = performance.memory;
2581
2584
  l.update(h.usedJSHeapSize / 1048576, h.jsHeapSizeLimit / 1048576);
2582
2585
  }
@@ -2590,278 +2593,421 @@ var ae = function() {
2590
2593
  setMode: n
2591
2594
  };
2592
2595
  };
2593
- ae.Panel = function(r, e, t) {
2594
- var n = 1 / 0, s = 0, o = Math.round, i = o(window.devicePixelRatio || 1), c = 80 * i, a = 48 * i, l = 3 * i, u = 2 * i, h = 3 * i, p = 15 * i, m = 74 * i, _ = 30 * i, w = document.createElement("canvas");
2595
- w.width = c, w.height = a, w.style.cssText = "width:80px;height:48px";
2596
- var d = w.getContext("2d");
2597
- return d.font = "bold " + 9 * i + "px Helvetica,Arial,sans-serif", d.textBaseline = "top", d.fillStyle = t, d.fillRect(0, 0, c, a), d.fillStyle = e, d.fillText(r, l, u), d.fillRect(h, p, m, _), d.fillStyle = t, d.globalAlpha = 0.9, d.fillRect(h, p, m, _), {
2598
- dom: w,
2596
+ ce.Panel = function(o, e, t) {
2597
+ var n = 1 / 0, s = 0, r = Math.round, i = r(window.devicePixelRatio || 1), a = 80 * i, c = 48 * i, l = 3 * i, u = 2 * i, h = 3 * i, p = 15 * i, m = 74 * i, _ = 30 * i, b = document.createElement("canvas");
2598
+ b.width = a, b.height = c, b.style.cssText = "width:80px;height:48px";
2599
+ var d = b.getContext("2d");
2600
+ return d.font = "bold " + 9 * i + "px Helvetica,Arial,sans-serif", d.textBaseline = "top", d.fillStyle = t, d.fillRect(0, 0, a, c), d.fillStyle = e, d.fillText(o, l, u), d.fillRect(h, p, m, _), d.fillStyle = t, d.globalAlpha = 0.9, d.fillRect(h, p, m, _), {
2601
+ dom: b,
2599
2602
  update: function(f, g) {
2600
- n = Math.min(n, f), s = Math.max(s, f), d.fillStyle = t, d.globalAlpha = 1, d.fillRect(0, 0, c, p), d.fillStyle = e, d.fillText(o(f) + " " + r + " (" + o(n) + "-" + o(s) + ")", l, u), d.drawImage(w, h + i, p, m - i, _, h, p, m - i, _), d.fillRect(h + m - i, p, i, _), d.fillStyle = t, d.globalAlpha = 0.9, d.fillRect(h + m - i, p, i, o((1 - f / g) * _));
2603
+ n = Math.min(n, f), s = Math.max(s, f), d.fillStyle = t, d.globalAlpha = 1, d.fillRect(0, 0, a, p), d.fillStyle = e, d.fillText(r(f) + " " + o + " (" + r(n) + "-" + r(s) + ")", l, u), d.drawImage(b, h + i, p, m - i, _, h, p, m - i, _), d.fillRect(h + m - i, p, i, _), d.fillStyle = t, d.globalAlpha = 0.9, d.fillRect(h + m - i, p, i, r((1 - f / g) * _));
2601
2604
  }
2602
2605
  };
2603
2606
  };
2604
- function bn(r) {
2605
- return new Jt(r);
2607
+ function On(o) {
2608
+ return new hs(o);
2606
2609
  }
2607
- function En(r = 150, ...e) {
2608
- return new es(r, r / 10, ...e);
2610
+ function In(o = 150, ...e) {
2611
+ return new us(o, o / 10, ...e);
2609
2612
  }
2610
- function xn(r) {
2611
- return new ts(r, 16776960);
2613
+ function kn(o) {
2614
+ return new ds(o, 16776960);
2612
2615
  }
2613
- function An(r, e) {
2614
- return new ut(r, e);
2616
+ function Nn(o, e) {
2617
+ return new bt(o, e);
2615
2618
  }
2616
- function Rn(r, e) {
2617
- return new Ts(r, e);
2619
+ function vn(o, e) {
2620
+ return new Ps(o, e);
2618
2621
  }
2619
- function Mn() {
2620
- const r = new ss(), e = new I(0, 0);
2622
+ function Hn() {
2623
+ const o = new fs(), e = new I(0, 0);
2621
2624
  return {
2622
- raycaster: r,
2625
+ raycaster: o,
2623
2626
  pointer: e
2624
2627
  };
2625
2628
  }
2626
- function Sn(r = 10) {
2627
- return new ns(r);
2629
+ function Fn(o = 10) {
2630
+ return new ps(o);
2628
2631
  }
2629
- function Ln(r = new S(1, 1, 1), e = new S(10, 10, 10), t = 5, n = 16776960) {
2630
- return r.normalize(), new is(r, e, t, n);
2632
+ function Un(o = new R(1, 1, 1), e = new R(10, 10, 10), t = 5, n = 16776960) {
2633
+ return o.normalize(), new ms(o, e, t, n);
2631
2634
  }
2632
- function Dn() {
2633
- const r = new ae();
2634
- return r.dom.style.cssText = "position:absolute;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000", r;
2635
+ function Gn() {
2636
+ const o = new ce();
2637
+ return o.dom.style.cssText = "position:absolute;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000", o;
2635
2638
  }
2636
- const an = (r) => {
2637
- r.geometry && r.geometry.dispose(), r.material && (Array.isArray(r.material) ? r.material.forEach((e) => {
2638
- et(e);
2639
- }) : et(r.material)), r.children && r.children.forEach((e) => an(e));
2639
+ const _n = (o) => {
2640
+ o.geometry && o.geometry.dispose(), o.material && (Array.isArray(o.material) ? o.material.forEach((e) => {
2641
+ st(e);
2642
+ }) : st(o.material)), o.children && o.children.forEach((e) => _n(e));
2640
2643
  };
2641
- function et(r) {
2642
- for (const e in r)
2643
- r[e] && r[e].isTexture && r[e].dispose();
2644
- r.dispose();
2644
+ function st(o) {
2645
+ for (const e in o)
2646
+ o[e] && o[e].isTexture && o[e].dispose();
2647
+ o.dispose();
2645
2648
  }
2646
- const Se = {};
2647
- async function Cn(r, e = 50) {
2649
+ const nt = /* @__PURE__ */ new WeakMap(), le = /* @__PURE__ */ new Map(), Le = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new Map();
2650
+ async function jn(o, e = 50) {
2648
2651
  const t = {
2649
- type: r.type,
2650
- name: r.name,
2651
- position: r.position.toArray(),
2652
- rotation: r.rotation.toArray(),
2653
- scale: r.scale.toArray(),
2654
- visible: r.visible,
2652
+ type: o.type,
2653
+ name: o.name,
2654
+ position: o.position.toArray(),
2655
+ rotation: o.rotation.toArray(),
2656
+ scale: o.scale.toArray(),
2657
+ visible: o.visible,
2655
2658
  children: [],
2656
2659
  geometry: null,
2657
2660
  material: null,
2658
- userData: r.userData
2661
+ userData: o.userData
2659
2662
  };
2660
- r.isMesh && (t.geometry = pe(r.geometry), t.material = ge(r.material));
2661
- const n = [{ object: r, parentData: t }];
2663
+ o.isMesh && (t.geometry = ge(o.geometry), t.material = ne(o.material));
2664
+ const n = [{ object: o, parentData: t }];
2662
2665
  let s = 0;
2663
2666
  for (; n.length > 0; ) {
2664
- const { object: o, parentData: i } = n.pop();
2665
- for (const c of o.children) {
2666
- const a = {
2667
- type: c.type,
2668
- name: c.name,
2669
- position: c.position.toArray(),
2670
- rotation: c.rotation.toArray(),
2671
- scale: c.scale.toArray(),
2672
- visible: c.visible,
2667
+ const { object: r, parentData: i } = n.pop();
2668
+ for (const a of r.children) {
2669
+ const c = {
2670
+ type: a.type,
2671
+ name: a.name,
2672
+ position: a.position.toArray(),
2673
+ rotation: a.rotation.toArray(),
2674
+ scale: a.scale.toArray(),
2675
+ visible: a.visible,
2673
2676
  children: [],
2674
2677
  geometry: null,
2675
2678
  material: null,
2676
- userData: c.userData
2679
+ userData: a.userData
2677
2680
  };
2678
- c.isMesh && (a.geometry = pe(c.geometry), a.material = ge(c.material)), i.children.push(a), n.push({ object: c, parentData: a }), s++, s % e === 0 && await new Promise((l) => requestAnimationFrame(l));
2681
+ a.isMesh && (c.geometry = ge(a.geometry), c.material = ne(a.material)), i.children.push(c), n.push({ object: a, parentData: c }), s++, s % e === 0 && await new Promise((l) => requestAnimationFrame(l));
2679
2682
  }
2680
2683
  }
2681
2684
  return t;
2682
2685
  }
2683
- function Pn(r) {
2686
+ function zn(o) {
2684
2687
  const e = {
2685
- type: r.type,
2686
- name: r.name,
2687
- position: r.position.toArray(),
2688
- rotation: r.rotation.toArray(),
2689
- scale: r.scale.toArray(),
2690
- visible: r.visible,
2688
+ type: o.type,
2689
+ name: o.name,
2690
+ position: o.position.toArray(),
2691
+ rotation: o.rotation.toArray(),
2692
+ scale: o.scale.toArray(),
2693
+ visible: o.visible,
2691
2694
  children: [],
2692
2695
  geometry: null,
2693
2696
  material: null,
2694
- userData: r.userData
2697
+ userData: o.userData
2695
2698
  };
2696
- r.isMesh && (e.geometry = pe(r.geometry), e.material = ge(r.material));
2697
- const t = [{ object: r, parentData: e }];
2699
+ o.isMesh && (e.geometry = ge(o.geometry), e.material = ne(o.material));
2700
+ const t = [{ object: o, parentData: e }];
2698
2701
  for (; t.length > 0; ) {
2699
2702
  const { object: n, parentData: s } = t.pop();
2700
- for (const o of n.children) {
2703
+ for (const r of n.children) {
2701
2704
  const i = {
2702
- type: o.type,
2703
- name: o.name,
2704
- position: o.position.toArray(),
2705
- rotation: o.rotation.toArray(),
2706
- scale: o.scale.toArray(),
2707
- visible: o.visible,
2705
+ type: r.type,
2706
+ name: r.name,
2707
+ position: r.position.toArray(),
2708
+ rotation: r.rotation.toArray(),
2709
+ scale: r.scale.toArray(),
2710
+ visible: r.visible,
2708
2711
  children: [],
2709
2712
  geometry: null,
2710
2713
  material: null,
2711
- userData: o.userData
2714
+ userData: r.userData
2712
2715
  };
2713
- o.isMesh && (i.geometry = pe(o.geometry), i.material = ge(o.material)), s.children.push(i), t.push({ object: o, parentData: i });
2716
+ r.isMesh && (i.geometry = ge(r.geometry), i.material = ne(r.material)), s.children.push(i), t.push({ object: r, parentData: i });
2714
2717
  }
2715
2718
  }
2716
2719
  return e;
2717
2720
  }
2718
- async function cn(r, e = 50) {
2721
+ async function Tn(o, e = 50) {
2719
2722
  const t = [];
2720
2723
  let n;
2721
- switch (r.type) {
2724
+ switch (o.type) {
2722
2725
  case "Mesh":
2723
- const o = me(r.geometry), i = ye(r.material);
2724
- n = new A.Mesh(o, i);
2726
+ const r = ye(o.geometry), i = _e(o.material);
2727
+ n = new x.Mesh(r, i);
2725
2728
  break;
2726
2729
  case "Group":
2727
- n = new A.Group();
2730
+ n = new x.Group();
2728
2731
  break;
2729
2732
  case "Object3D":
2730
- n = new A.Object3D();
2733
+ n = new x.Object3D();
2731
2734
  break;
2732
2735
  default:
2733
- return console.warn(`Unsupported object type: ${r.type}`), null;
2736
+ return console.warn(`Unsupported object type: ${o.type}`), null;
2734
2737
  }
2735
- n.name = r.name, n.position.fromArray(r.position), n.rotation.fromArray(r.rotation), n.scale.fromArray(r.scale), n.visible = r.visible, n.userData = r.userData, t.push({ data: r, object: n });
2738
+ n.name = o.name, n.position.fromArray(o.position), n.rotation.fromArray(o.rotation), n.scale.fromArray(o.scale), n.visible = o.visible, n.userData = o.userData, t.push({ data: o, object: n });
2736
2739
  let s = 0;
2737
2740
  for (; t.length > 0; ) {
2738
- const { data: o, object: i } = t.pop();
2739
- for (const c of [...o.children].reverse()) {
2740
- let a;
2741
- switch (c.type) {
2741
+ const { data: r, object: i } = t.pop();
2742
+ for (const a of [...r.children].reverse()) {
2743
+ let c;
2744
+ switch (a.type) {
2742
2745
  case "Mesh":
2743
- const l = me(c.geometry), u = ye(c.material);
2744
- a = new A.Mesh(l, u);
2746
+ const l = ye(a.geometry), u = _e(a.material);
2747
+ c = new x.Mesh(l, u);
2745
2748
  break;
2746
2749
  case "Group":
2747
- a = new A.Group();
2750
+ c = new x.Group();
2748
2751
  break;
2749
2752
  case "Object3D":
2750
- a = new A.Object3D();
2753
+ c = new x.Object3D();
2751
2754
  break;
2752
2755
  default:
2753
- console.warn(`Unsupported object type: ${c.type}`);
2756
+ console.warn(`Unsupported object type: ${a.type}`);
2754
2757
  continue;
2755
2758
  }
2756
- a && (a.name = c.name, a.position.fromArray(c.position), a.rotation.fromArray(c.rotation), a.scale.fromArray(c.scale), a.visible = c.visible, a.userData = c.userData, i.add(a), t.push({ data: c, object: a }), s++, s % e === 0 && await new Promise((l) => requestAnimationFrame(l)));
2759
+ c && (c.name = a.name, c.position.fromArray(a.position), c.rotation.fromArray(a.rotation), c.scale.fromArray(a.scale), c.visible = a.visible, c.userData = a.userData, i.add(c), t.push({ data: a, object: c }), s++, s % e === 0 && await new Promise((l) => requestAnimationFrame(l)));
2757
2760
  }
2758
2761
  }
2759
2762
  return n;
2760
2763
  }
2761
- function On(r) {
2764
+ function Bn(o) {
2762
2765
  const e = [];
2763
2766
  let t;
2764
- switch (r.type) {
2767
+ switch (o.type) {
2765
2768
  case "Mesh":
2766
- const n = me(r.geometry), s = ye(r.material);
2767
- t = new A.Mesh(n, s);
2769
+ const n = ye(o.geometry), s = _e(o.material);
2770
+ t = new x.Mesh(n, s);
2768
2771
  break;
2769
2772
  case "Group":
2770
- t = new A.Group();
2773
+ t = new x.Group();
2771
2774
  break;
2772
2775
  case "Object3D":
2773
- t = new A.Object3D();
2776
+ t = new x.Object3D();
2774
2777
  break;
2775
2778
  default:
2776
- return console.warn(`Unsupported object type: ${r.type}`), null;
2779
+ return console.warn(`Unsupported object type: ${o.type}`), null;
2777
2780
  }
2778
- for (t.name = r.name, t.position.fromArray(r.position), t.rotation.fromArray(r.rotation), t.scale.fromArray(r.scale), t.visible = r.visible, t.userData = r.userData, e.push({ data: r, object: t }); e.length > 0; ) {
2781
+ for (t.name = o.name, t.position.fromArray(o.position), t.rotation.fromArray(o.rotation), t.scale.fromArray(o.scale), t.visible = o.visible, t.userData = o.userData, e.push({ data: o, object: t }); e.length > 0; ) {
2779
2782
  const { data: n, object: s } = e.pop();
2780
- for (const o of [...n.children].reverse()) {
2783
+ for (const r of [...n.children].reverse()) {
2781
2784
  let i;
2782
- switch (o.type) {
2785
+ switch (r.type) {
2783
2786
  case "Mesh":
2784
- const c = me(o.geometry), a = ye(o.material);
2785
- i = new A.Mesh(c, a);
2787
+ const a = ye(r.geometry), c = _e(r.material);
2788
+ i = new x.Mesh(a, c);
2786
2789
  break;
2787
2790
  case "Group":
2788
- i = new A.Group();
2791
+ i = new x.Group();
2789
2792
  break;
2790
2793
  case "Object3D":
2791
- i = new A.Object3D();
2794
+ i = new x.Object3D();
2792
2795
  break;
2793
2796
  default:
2794
- console.warn(`Unsupported object type: ${o.type}`);
2797
+ console.warn(`Unsupported object type: ${r.type}`);
2795
2798
  continue;
2796
2799
  }
2797
- i && (i.name = o.name, i.position.fromArray(o.position), i.rotation.fromArray(o.rotation), i.scale.fromArray(o.scale), i.visible = o.visible, i.userData = o.userData, s.add(i), e.push({ data: o, object: i }));
2800
+ i && (i.name = r.name, i.position.fromArray(r.position), i.rotation.fromArray(r.rotation), i.scale.fromArray(r.scale), i.visible = r.visible, i.userData = r.userData, s.add(i), e.push({ data: r, object: i }));
2798
2801
  }
2799
2802
  }
2800
2803
  return t;
2801
2804
  }
2802
- function pe(r) {
2803
- const e = {}, { attributes: t, index: n, type: s } = r;
2804
- t.position && (e.position = {
2805
- type: "Float32Array",
2806
- array: Array.from(t.position.array),
2807
- itemSize: 3
2808
- }), t.normal && (e.normal = {
2809
- type: "Float32Array",
2810
- array: Array.from(t.normal.array),
2811
- itemSize: 3
2812
- }), t.uv && (e.uv = {
2813
- type: "Float32Array",
2814
- array: Array.from(t.uv.array),
2815
- itemSize: 2
2816
- });
2817
- const o = {
2818
- type: s,
2819
- attributes: e
2805
+ function ge(o, e = {}) {
2806
+ const { useBinary: t = !0, useCache: n = !0 } = e;
2807
+ if (n && Le.has(o))
2808
+ return Le.get(o);
2809
+ const s = {}, { attributes: r, index: i, type: a, uuid: c } = o;
2810
+ r.position && (s.position = pe(r.position, "Float32Array", t)), r.normal && (s.normal = pe(r.normal, "Float32Array", t)), r.uv && (s.uv = pe(r.uv, "Float32Array", t));
2811
+ const l = {
2812
+ type: a,
2813
+ uuid: c,
2814
+ attributes: s
2820
2815
  };
2821
- return n && n.array && (o.index = {
2822
- type: "Uint32Array",
2823
- array: Array.from(n.array),
2824
- itemSize: 1
2825
- }), o;
2826
- }
2827
- function me(r) {
2828
- const { type: e, attributes: t, index: n } = r, s = new A.BufferGeometry();
2829
- for (const o in t)
2830
- if (t.hasOwnProperty(o)) {
2831
- const { type: i, array: c, itemSize: a } = t[o];
2832
- s.setAttribute(
2833
- o,
2834
- new A.BufferAttribute(new Float32Array(c), a)
2835
- );
2816
+ return i && i.array && (l.index = pe(i, "Uint32Array", t)), n && Le.set(o, l), l;
2817
+ }
2818
+ function pe(o, e, t) {
2819
+ const { array: n, itemSize: s } = o;
2820
+ return t && n.buffer instanceof ArrayBuffer ? {
2821
+ type: e,
2822
+ binary: !0,
2823
+ buffer: n.buffer.slice(n.byteOffset, n.byteOffset + n.byteLength),
2824
+ byteOffset: 0,
2825
+ byteLength: n.byteLength,
2826
+ itemSize: s,
2827
+ count: n.length
2828
+ } : {
2829
+ type: e,
2830
+ binary: !1,
2831
+ array: Array.from(n),
2832
+ itemSize: s
2833
+ };
2834
+ }
2835
+ function ye(o) {
2836
+ const { type: e, attributes: t, index: n } = o, s = new x.BufferGeometry();
2837
+ for (const r in t)
2838
+ if (t.hasOwnProperty(r)) {
2839
+ const i = t[r];
2840
+ if (i.binary && i.buffer) {
2841
+ const a = it(i.type), c = new a(
2842
+ i.buffer,
2843
+ i.byteOffset,
2844
+ i.byteLength / a.BYTES_PER_ELEMENT
2845
+ );
2846
+ s.setAttribute(r, new x.BufferAttribute(c, i.itemSize));
2847
+ } else
2848
+ s.setAttribute(
2849
+ r,
2850
+ new x.BufferAttribute(new Float32Array(i.array), i.itemSize)
2851
+ );
2836
2852
  }
2837
- return n && s.setIndex(n.array), s;
2853
+ if (n)
2854
+ if (n.binary && n.buffer) {
2855
+ const r = it(n.type), i = new r(
2856
+ n.buffer,
2857
+ n.byteOffset,
2858
+ n.byteLength / r.BYTES_PER_ELEMENT
2859
+ );
2860
+ s.setIndex(i);
2861
+ } else
2862
+ s.setIndex(n.array);
2863
+ return s;
2864
+ }
2865
+ function it(o) {
2866
+ switch (o) {
2867
+ case "Int8Array":
2868
+ return Int8Array;
2869
+ case "Uint8Array":
2870
+ return Uint8Array;
2871
+ case "Int16Array":
2872
+ return Int16Array;
2873
+ case "Uint16Array":
2874
+ return Uint16Array;
2875
+ case "Int32Array":
2876
+ return Int32Array;
2877
+ case "Uint32Array":
2878
+ return Uint32Array;
2879
+ case "Float32Array":
2880
+ return Float32Array;
2881
+ case "Float64Array":
2882
+ return Float64Array;
2883
+ default:
2884
+ return Float32Array;
2885
+ }
2838
2886
  }
2839
- function ge(r) {
2887
+ function rt(o) {
2888
+ return o instanceof Int8Array ? "Int8Array" : o instanceof Uint8Array ? "Uint8Array" : o instanceof Int16Array ? "Int16Array" : o instanceof Uint16Array ? "Uint16Array" : o instanceof Int32Array ? "Int32Array" : o instanceof Uint32Array ? "Uint32Array" : o instanceof Float32Array ? "Float32Array" : o instanceof Float64Array ? "Float64Array" : "Float32Array";
2889
+ }
2890
+ function ne(o) {
2840
2891
  return {
2841
- type: r.type,
2842
- color: r.color.getHex(),
2843
- map: r.map ? r.map.image.src : null,
2844
- opacity: r.opacity,
2845
- name: r.name,
2846
- depthTest: r.depthTest,
2847
- depthWrite: r.depthWrite,
2848
- transparent: r.transparent,
2849
- side: r.side,
2850
- roughness: r.roughness,
2851
- metalness: r.metalness,
2852
- emissive: r.emissive.getHex()
2892
+ type: o.type,
2893
+ color: o.color.getHex(),
2894
+ map: o.map ? o.map.image.src : null,
2895
+ opacity: o.opacity,
2896
+ name: o.name,
2897
+ depthTest: o.depthTest,
2898
+ depthWrite: o.depthWrite,
2899
+ transparent: o.transparent,
2900
+ side: o.side,
2901
+ roughness: o.roughness,
2902
+ metalness: o.metalness,
2903
+ emissive: o.emissive.getHex()
2853
2904
  };
2854
2905
  }
2855
- function ye(r) {
2856
- if (Se[r.name]) return Se[r.name];
2857
- const { type: e, ...t } = r, n = e || "MeshStandardMaterial", s = new A[n]({ ...t });
2858
- if (r.map) {
2859
- const o = new A.TextureLoader().load(r.map);
2860
- s.map = o;
2906
+ function _e(o) {
2907
+ if (le.has(o.name)) {
2908
+ const r = le.get(o.name);
2909
+ return nt.set(o, r), r;
2910
+ }
2911
+ const { type: e, ...t } = o, n = e || "MeshStandardMaterial", s = new x[n]({ ...t });
2912
+ if (o.map) {
2913
+ const r = new x.TextureLoader().load(o.map);
2914
+ s.map = r;
2861
2915
  }
2862
- return s.needsUpdate = !0, Se[r.name] = s, s;
2916
+ return s.needsUpdate = !0, le.set(o.name, s), nt.set(o, s), s;
2917
+ }
2918
+ function Kn() {
2919
+ le.clear(), console.log("[ modelSerialize ] 材质缓存已清理");
2920
+ }
2921
+ function Wn() {
2922
+ return {
2923
+ cacheSize: le.size
2924
+ };
2925
+ }
2926
+ function Xn() {
2927
+ He.clear(), console.log("[ modelSerialize ] 几何体缓存已清理");
2928
+ }
2929
+ function Vn() {
2930
+ return {
2931
+ cacheSize: He.size,
2932
+ dataCacheSize: He.size
2933
+ };
2863
2934
  }
2864
- class ln {
2935
+ function Yn(o) {
2936
+ const e = {
2937
+ type: o.type,
2938
+ name: o.name,
2939
+ position: o.position.toArray(),
2940
+ rotation: o.rotation.toArray(),
2941
+ scale: o.scale.toArray(),
2942
+ visible: o.visible,
2943
+ userData: o.userData,
2944
+ children: [],
2945
+ geometry: null,
2946
+ material: null
2947
+ }, t = [];
2948
+ if (o.isMesh && o.geometry) {
2949
+ const s = ot(o.geometry);
2950
+ e.geometry = s.data, t.push(...s.transferables);
2951
+ }
2952
+ o.material && (e.material = ne(o.material));
2953
+ const n = [{ object: o, parentData: e }];
2954
+ for (; n.length > 0; ) {
2955
+ const { object: s, parentData: r } = n.pop();
2956
+ for (const i of s.children) {
2957
+ const a = {
2958
+ type: i.type,
2959
+ name: i.name,
2960
+ position: i.position.toArray(),
2961
+ rotation: i.rotation.toArray(),
2962
+ scale: i.scale.toArray(),
2963
+ visible: i.visible,
2964
+ userData: i.userData,
2965
+ children: [],
2966
+ geometry: null,
2967
+ material: null
2968
+ };
2969
+ if (i.isMesh && i.geometry) {
2970
+ const c = ot(i.geometry);
2971
+ a.geometry = c.data, t.push(...c.transferables);
2972
+ }
2973
+ i.material && (a.material = ne(i.material)), r.children.push(a), n.push({ object: i, parentData: a });
2974
+ }
2975
+ }
2976
+ return { data: e, transferables: t };
2977
+ }
2978
+ function ot(o) {
2979
+ const e = o.attributes, t = o.index, n = {
2980
+ type: o.type,
2981
+ uuid: o.uuid,
2982
+ attributes: {},
2983
+ index: null
2984
+ }, s = [];
2985
+ for (const r in e)
2986
+ if (e.hasOwnProperty(r)) {
2987
+ const i = e[r];
2988
+ if (i && i.array) {
2989
+ const a = i.array.buffer;
2990
+ a instanceof ArrayBuffer && (n.attributes[r] = {
2991
+ type: rt(i.array),
2992
+ buffer: a,
2993
+ byteOffset: i.array.byteOffset,
2994
+ byteLength: i.array.byteLength,
2995
+ itemSize: i.itemSize
2996
+ }, s.push(a));
2997
+ }
2998
+ }
2999
+ if (t && t.array) {
3000
+ const r = t.array.buffer;
3001
+ r instanceof ArrayBuffer && (n.index = {
3002
+ type: rt(t.array),
3003
+ buffer: r,
3004
+ byteOffset: t.array.byteOffset,
3005
+ byteLength: t.array.byteLength
3006
+ }, s.push(r));
3007
+ }
3008
+ return { data: n, transferables: s };
3009
+ }
3010
+ class bn {
2865
3011
  constructor() {
2866
3012
  this.stats = {
2867
3013
  hits: 0,
@@ -2981,8 +3127,8 @@ class ln {
2981
3127
  }), console.groupEnd();
2982
3128
  }
2983
3129
  }
2984
- const V = new ln();
2985
- class _e {
3130
+ const W = new bn();
3131
+ class Te {
2986
3132
  /**
2987
3133
  * 异步操作并支持重试
2988
3134
  * @param {Function} operation - 要执行的异步操作
@@ -2993,23 +3139,23 @@ class _e {
2993
3139
  const {
2994
3140
  maxRetries: n = 3,
2995
3141
  initialDelay: s = 1e3,
2996
- maxDelay: o = 1e4,
3142
+ maxDelay: r = 1e4,
2997
3143
  backoffFactor: i = 2,
2998
- shouldRetry: c = _e.defaultShouldRetry
3144
+ shouldRetry: a = Te.defaultShouldRetry
2999
3145
  } = t;
3000
- let a, l = s;
3146
+ let c, l = s;
3001
3147
  for (let u = 0; u <= n; u++)
3002
3148
  try {
3003
3149
  return await e();
3004
3150
  } catch (h) {
3005
- if (a = h, u === n || !c(h, u))
3151
+ if (c = h, u === n || !a(h, u))
3006
3152
  throw h;
3007
3153
  console.warn(
3008
3154
  `[ RetryHelper ] 操作失败,第 ${u + 1} 次尝试失败,${l}ms 后进行第 ${u + 2} 次尝试...`,
3009
3155
  h
3010
- ), await _e.delay(l), l = Math.min(l * i, o);
3156
+ ), await Te.delay(l), l = Math.min(l * i, r);
3011
3157
  }
3012
- throw a;
3158
+ throw c;
3013
3159
  }
3014
3160
  /**
3015
3161
  * 默认的重试判断逻辑
@@ -3038,7 +3184,7 @@ class _e {
3038
3184
  return new Promise((t) => setTimeout(t, e));
3039
3185
  }
3040
3186
  }
3041
- const Le = {
3187
+ const De = {
3042
3188
  NETWORK: "NETWORK",
3043
3189
  // 网络错误
3044
3190
  PARSE: "PARSE",
@@ -3048,7 +3194,7 @@ const Le = {
3048
3194
  UNKNOWN: "UNKNOWN"
3049
3195
  // 未知错误
3050
3196
  };
3051
- class ce extends Error {
3197
+ class he extends Error {
3052
3198
  constructor(e, t, n, s) {
3053
3199
  super(e), this.name = "ModelLoadError", this.type = t, this.path = n, this.originalError = s, this.timestamp = Date.now();
3054
3200
  }
@@ -3056,9 +3202,9 @@ class ce extends Error {
3056
3202
  * 创建网络错误
3057
3203
  */
3058
3204
  static networkError(e, t) {
3059
- return new ce(
3205
+ return new he(
3060
3206
  `网络加载失败: ${e}`,
3061
- Le.NETWORK,
3207
+ De.NETWORK,
3062
3208
  e,
3063
3209
  t
3064
3210
  );
@@ -3067,9 +3213,9 @@ class ce extends Error {
3067
3213
  * 创建解析错误
3068
3214
  */
3069
3215
  static parseError(e, t) {
3070
- return new ce(
3216
+ return new he(
3071
3217
  `模型解析失败: ${e}`,
3072
- Le.PARSE,
3218
+ De.PARSE,
3073
3219
  e,
3074
3220
  t
3075
3221
  );
@@ -3078,22 +3224,24 @@ class ce extends Error {
3078
3224
  * 创建版本不匹配错误
3079
3225
  */
3080
3226
  static versionMismatchError(e, t, n) {
3081
- return new ce(
3227
+ return new he(
3082
3228
  `版本不匹配: ${e} (期望: ${t}, 实际: ${n})`,
3083
- Le.VERSION_MISMATCH,
3229
+ De.VERSION_MISMATCH,
3084
3230
  e
3085
3231
  );
3086
3232
  }
3087
3233
  }
3088
- const hn = 5;
3089
- class de {
3234
+ const at = 4;
3235
+ class ct {
3090
3236
  /**
3091
3237
  * 构造函数
3092
3238
  * @param {string} dbName - 数据库名称
3093
3239
  * @param {CacheOptions} options - 缓存配置选项
3094
3240
  */
3095
3241
  constructor(e = "threeJsIDBCache", t = {}) {
3096
- this.version = hn, this.dbName = e, this.options = {
3242
+ // 缓存容量信息(用于减少全表扫描)
3243
+ je(this, "_capacityInfo", null);
3244
+ this.version = at, this.dbName = e, this.options = {
3097
3245
  maxSize: t.maxSize || 500 * 1024 * 1024,
3098
3246
  // 默认 500MB
3099
3247
  maxEntries: t.maxEntries || 50,
@@ -3103,16 +3251,13 @@ class de {
3103
3251
  }, this.dbInit();
3104
3252
  }
3105
3253
  dbInit() {
3106
- this.db = new os(this.dbName), this.db.version(this.version).stores({
3107
- models: "&path, version, timestamp, accessCount, size, format"
3254
+ this.db = new gs(this.dbName), this.db.version(this.version).stores({
3255
+ models: "&path, version, timestamp, accessCount, size"
3108
3256
  }).upgrade(async (e) => {
3109
- console.log("[ IDBCache 版本更新 ] ====> 从旧版本升级到 v5");
3257
+ console.log("[ IDBCache 版本更新 ] ====> version", at);
3110
3258
  const t = e.table("models"), n = await t.toArray();
3111
- console.log(`[ IDBCache ] 发现 ${n.length} 条旧缓存记录,开始验证...`);
3112
- let s = 0, o = 0;
3113
- for (const i of n)
3114
- i.data instanceof ArrayBuffer ? (await t.update(i.path, { format: "arraybuffer" }), s++) : i.data && typeof i.data == "object" ? i.data.metadata || i.data.type === "Object3D" || i.data.uuid ? (console.warn(`[ IDBCache ] 检测到旧版本序列化格式: ${i.path},标记为待删除`), await t.delete(i.path), o++) : (console.warn(`[ IDBCache ] 检测到无法识别的数据格式: ${i.path},删除`), await t.delete(i.path), o++) : (console.warn(`[ IDBCache ] 检测到无效数据: ${i.path},删除`), await t.delete(i.path), o++);
3115
- console.log(`[ IDBCache ] 升级完成: 保留 ${s} 条,删除 ${o} 条旧格式记录`);
3259
+ for (const s of n)
3260
+ s.data instanceof ArrayBuffer || await t.delete(s.path);
3116
3261
  });
3117
3262
  }
3118
3263
  /**
@@ -3123,47 +3268,43 @@ class de {
3123
3268
  return this.db;
3124
3269
  }
3125
3270
  async saveModel(e, t, n) {
3126
- if (!n || !(n instanceof ArrayBuffer))
3127
- throw new Error(`[ IDBCache ] 无效的 ArrayBuffer: ${e}`);
3128
- if (n.byteLength === 0)
3129
- throw new Error(`[ IDBCache ] ArrayBuffer 为空: ${e}`);
3130
3271
  await this.ensureCapacity(n.byteLength), await this.db.table("models").put({
3131
3272
  path: e,
3132
3273
  version: t,
3133
3274
  data: n,
3134
3275
  size: n.byteLength,
3135
3276
  timestamp: Date.now(),
3136
- accessCount: 0,
3137
- format: "arraybuffer"
3138
- // 标记数据格式
3277
+ accessCount: 0
3139
3278
  });
3140
3279
  }
3141
3280
  /**
3142
3281
  * 确保缓存容量足够,不足时执行 LRU 淘汰
3143
3282
  * @param {number} requiredSize - 需要的额外空间(字节)
3283
+ * @returns {Promise<void>}
3144
3284
  */
3145
3285
  async ensureCapacity(e) {
3146
- const t = await this.db.table("models").toArray(), n = t.reduce((c, a) => c + (a.size || 0), 0), s = t.length, o = n + e > this.options.maxSize, i = s >= this.options.maxEntries;
3147
- (o || i) && (console.log(`[ IDBCache ] ====> 容量不足,开始 LRU 淘汰. 总大小: ${(n / 1024 / 1024).toFixed(2)}MB, 条目数: ${s}`), await this.evictLRU(t));
3286
+ const t = await this.db.table("models").toArray();
3287
+ let n = this._capacityInfo;
3288
+ n || (n = { totalSize: t.reduce((l, u) => l + (u.size || 0), 0), count: t.length }, this._capacityInfo = n);
3289
+ const { totalSize: s, count: r } = n, i = s + e > this.options.maxSize, a = r >= this.options.maxEntries;
3290
+ (i || a) && (console.log(`[ IDBCache ] ====> 容量不足,开始 LRU 淘汰. 总大小: ${(s / 1024 / 1024).toFixed(2)}MB, 条目数: ${r}`), await this.evictLRU(t), this._capacityInfo = null);
3148
3291
  }
3149
3292
  /**
3150
3293
  * 执行 LRU 淘汰策略
3151
3294
  * @param {Array} models - 所有缓存记录
3152
3295
  */
3153
3296
  async evictLRU(e) {
3154
- const t = e.sort((c, a) => (c.accessCount || 0) !== (a.accessCount || 0) ? (c.accessCount || 0) - (a.accessCount || 0) : (c.timestamp || 0) - (a.timestamp || 0)), n = Math.max(1, Math.floor(t.length * this.options.evictRatio)), s = t.slice(0, n), o = s.map((c) => c.path);
3155
- await this.db.table("models").bulkDelete(o);
3156
- const i = s.reduce((c, a) => c + (a.size || 0), 0);
3297
+ const t = e.sort((a, c) => (a.accessCount || 0) !== (c.accessCount || 0) ? (a.accessCount || 0) - (c.accessCount || 0) : (a.timestamp || 0) - (c.timestamp || 0)), n = Math.max(1, Math.floor(t.length * this.options.evictRatio)), s = t.slice(0, n), r = s.map((a) => a.path);
3298
+ await this.db.table("models").bulkDelete(r);
3299
+ const i = s.reduce((a, c) => a + (c.size || 0), 0);
3157
3300
  console.log(`[ IDBCache ] ====> LRU 淘汰完成. 删除 ${n} 个条目,释放 ${(i / 1024 / 1024).toFixed(2)}MB`);
3158
3301
  }
3159
3302
  async getModel(e, t) {
3160
3303
  const n = await this.db.table("models").get(e);
3161
- return n ? n.version !== t ? (console.log(`[ IDBCache ] 模型版本不一致,清除当前记录 (缓存: ${n.version}, 请求: ${t})`), await this.db.table("models").delete(e), null) : n.data ? n.data instanceof ArrayBuffer ? n.data.byteLength === 0 ? (console.warn(`[ IDBCache ] ArrayBuffer 为空,删除记录: ${e}`), await this.db.table("models").delete(e), null) : (await this.db.table("models").update(e, {
3304
+ return n ? n.version !== t ? (console.log("模型版本不一致, 清除当前记录"), await this.db.table("models").delete(e), null) : (await this.db.table("models").update(e, {
3162
3305
  accessCount: (n.accessCount || 0) + 1,
3163
- timestamp: Date.now(),
3164
- format: "arraybuffer"
3165
- // 确保格式字段存在
3166
- }), n.data) : (console.warn(`[ IDBCache ] 检测到旧版本序列化格式,删除记录: ${e}`), await this.db.table("models").delete(e), null) : (console.warn(`[ IDBCache ] 数据为空,删除记录: ${e}`), await this.db.table("models").delete(e), null) : (console.warn(`Model "${e}" not found in table models`), null);
3306
+ timestamp: Date.now()
3307
+ }), n.data) : (console.warn(`Model "${e}" not found in table models`), null);
3167
3308
  }
3168
3309
  // ---------------------------- ---------------------------------
3169
3310
  /**
@@ -3207,7 +3348,7 @@ class de {
3207
3348
  * @returns {Promise<Object>} 缓存统计数据
3208
3349
  */
3209
3350
  async getStats() {
3210
- const e = await this.db.table("models").toArray(), t = e.reduce((s, o) => s + (o.size || 0), 0), n = e.reduce((s, o) => s + (o.accessCount || 0), 0);
3351
+ const e = await this.db.table("models").toArray(), t = e.reduce((s, r) => s + (r.size || 0), 0), n = e.reduce((s, r) => s + (r.accessCount || 0), 0);
3211
3352
  return {
3212
3353
  count: e.length,
3213
3354
  totalSize: t,
@@ -3232,86 +3373,45 @@ class de {
3232
3373
  async deleteModel(e) {
3233
3374
  await this.db.table("models").delete(e);
3234
3375
  }
3235
- /**
3236
- * 清理所有旧版本格式的缓存数据
3237
- * 适用于手动清理,不需要等待版本升级
3238
- * @returns {Promise<Object>} 清理统计信息
3239
- */
3240
- async cleanLegacyFormats() {
3241
- console.log("[ IDBCache ] 开始清理旧版本格式的缓存...");
3242
- const e = await this.db.table("models").toArray();
3243
- let t = 0, n = 0;
3244
- const s = [];
3245
- for (const i of e) {
3246
- let c = !1;
3247
- i.data ? i.data instanceof ArrayBuffer ? i.data.byteLength === 0 && (c = !0, console.warn(`[ IDBCache ] 清理空 ArrayBuffer: ${i.path}`)) : (c = !0, console.warn(`[ IDBCache ] 清理非 ArrayBuffer 格式: ${i.path}`)) : (c = !0, console.warn(`[ IDBCache ] 清理空数据: ${i.path}`)), c ? (await this.db.table("models").delete(i.path), t++, s.push(i.path)) : (n++, i.format || await this.db.table("models").update(i.path, { format: "arraybuffer" }));
3248
- }
3249
- const o = {
3250
- total: e.length,
3251
- deleted: t,
3252
- kept: n,
3253
- deletedPaths: s
3254
- };
3255
- return console.log("[ IDBCache ] 清理完成:", o), o;
3376
+ }
3377
+ function At(o) {
3378
+ const { geometries: e, materials: t, hierarchy: n } = o, s = /* @__PURE__ */ new Map();
3379
+ for (let c = 0, l = e.length; c < l; c++) {
3380
+ const u = wn(e[c]);
3381
+ s.set(c, u);
3256
3382
  }
3257
- /**
3258
- * 验证缓存完整性并修复问题
3259
- * @returns {Promise<Object>} 验证结果
3260
- */
3261
- async validateAndRepair() {
3262
- console.log("[ IDBCache ] 开始验证缓存完整性...");
3263
- const e = await this.db.table("models").toArray();
3264
- let t = 0, n = 0;
3265
- const s = [];
3266
- for (const i of e) {
3267
- let c = !0;
3268
- const a = [];
3269
- i.data || (c = !1, a.push("missing_data")), i.data && !(i.data instanceof ArrayBuffer) && (c = !1, a.push("invalid_format")), i.data && i.data.byteLength === 0 && (c = !1, a.push("empty_buffer")), i.version || (c = !1, a.push("missing_version")), i.format || (s.push({ path: i.path, action: "add_format_field" }), await this.db.table("models").update(i.path, { format: "arraybuffer" })), c ? t++ : (console.warn(`[ IDBCache ] 发现无效记录: ${i.path}`, a), await this.db.table("models").delete(i.path), n++);
3270
- }
3271
- const o = {
3272
- total: e.length,
3273
- valid: t,
3274
- invalid: n,
3275
- repairs: s.length
3276
- };
3277
- return console.log("[ IDBCache ] 验证完成:", o), o;
3383
+ const r = /* @__PURE__ */ new Map();
3384
+ for (let c = 0, l = t.length; c < l; c++) {
3385
+ const u = En(t[c]);
3386
+ r.set(c, u);
3278
3387
  }
3279
- }
3280
- function pt(r) {
3281
- const { geometries: e, materials: t, hierarchy: n } = r, s = /* @__PURE__ */ new Map();
3282
- e.forEach((a, l) => {
3283
- const u = un(a);
3284
- s.set(l, u);
3285
- });
3286
- const o = /* @__PURE__ */ new Map();
3287
- t.forEach((a, l) => {
3288
- const u = dn(a);
3289
- o.set(l, u);
3290
- });
3291
- const i = new A.Group();
3388
+ const i = new x.Group();
3292
3389
  i.name = "Scene";
3293
- const c = /* @__PURE__ */ new Map();
3294
- return n.forEach((a) => {
3295
- let l;
3296
- if (a.type === "Mesh") {
3297
- const u = a.geometryIndex >= 0 ? s.get(a.geometryIndex) : null, h = a.materialIndex >= 0 ? o.get(a.materialIndex) : null;
3298
- l = new A.Mesh(u, h);
3299
- } else a.type === "Group" ? l = new A.Group() : a.type === "Object3D" ? l = new A.Object3D() : l = new A.Object3D();
3300
- l.name = a.name, l.position.fromArray(a.position), l.rotation.fromArray(a.rotation), l.scale.fromArray(a.scale), l.visible = a.visible, l.userData = a.userData || {}, c.set(a.id, l);
3301
- }), n.forEach((a) => {
3302
- const l = c.get(a.id);
3303
- if (a.parentId !== null) {
3304
- const u = c.get(a.parentId);
3305
- u && u.add(l);
3390
+ const a = /* @__PURE__ */ new Map();
3391
+ for (let c = 0, l = n.length; c < l; c++) {
3392
+ const u = n[c];
3393
+ let h;
3394
+ if (u.type === "Mesh") {
3395
+ const p = u.geometryIndex >= 0 ? s.get(u.geometryIndex) : null, m = u.materialIndex >= 0 ? r.get(u.materialIndex) : null;
3396
+ h = new x.Mesh(p, m);
3397
+ } else u.type === "Group" ? h = new x.Group() : u.type === "Object3D" ? h = new x.Object3D() : h = new x.Object3D();
3398
+ h.name = u.name, h.position.fromArray(u.position), h.rotation.fromArray(u.rotation), h.scale.fromArray(u.scale), h.visible = u.visible, h.userData = u.userData || {}, a.set(u.id, h);
3399
+ }
3400
+ for (let c = 0, l = n.length; c < l; c++) {
3401
+ const u = n[c], h = a.get(u.id);
3402
+ if (u.parentId !== null) {
3403
+ const p = a.get(u.parentId);
3404
+ p && p.add(h);
3306
3405
  } else
3307
- i.add(l);
3308
- }), i;
3309
- }
3310
- function un(r) {
3311
- const e = new A.BufferGeometry();
3312
- for (const t in r.attributes) {
3313
- const n = r.attributes[t], s = n.array;
3314
- let o;
3406
+ i.add(h);
3407
+ }
3408
+ return i;
3409
+ }
3410
+ function wn(o) {
3411
+ const e = new x.BufferGeometry();
3412
+ for (const t in o.attributes) {
3413
+ const n = o.attributes[t], s = n.array;
3414
+ let r;
3315
3415
  if (s.byteLength === 0) {
3316
3416
  console.warn(`[ sceneRebuilder ] 属性 ${t} 的数组为空`);
3317
3417
  continue;
@@ -3320,78 +3420,86 @@ function un(r) {
3320
3420
  console.warn(`[ sceneRebuilder ] 属性 ${t} 的 buffer 已被转移,尝试重建`);
3321
3421
  continue;
3322
3422
  }
3323
- o = s;
3324
- const i = new A.BufferAttribute(o, n.itemSize);
3423
+ r = s;
3424
+ const i = new x.BufferAttribute(r, n.itemSize);
3325
3425
  i.normalized = n.normalized, e.setAttribute(t, i);
3326
3426
  }
3327
- if (r.index) {
3328
- const t = r.index, n = t.array;
3427
+ if (o.index) {
3428
+ const t = o.index, n = t.array;
3329
3429
  if (n && n.byteLength > 0) {
3330
- const s = new A.BufferAttribute(n, t.itemSize);
3430
+ const s = new x.BufferAttribute(n, t.itemSize);
3331
3431
  e.setIndex(s);
3332
3432
  }
3333
3433
  }
3334
3434
  return e;
3335
3435
  }
3336
- function dn(r) {
3436
+ function En(o) {
3337
3437
  let e;
3338
3438
  const t = {
3339
- name: r.name,
3340
- color: r.color !== void 0 ? r.color : 16777215,
3341
- opacity: r.opacity !== void 0 ? r.opacity : 1,
3342
- transparent: r.transparent !== void 0 ? r.transparent : !1,
3343
- alphaTest: r.alphaTest !== void 0 ? r.alphaTest : 0,
3439
+ name: o.name,
3440
+ color: o.color !== void 0 ? o.color : 16777215,
3441
+ opacity: o.opacity !== void 0 ? o.opacity : 1,
3442
+ transparent: o.transparent !== void 0 ? o.transparent : !1,
3443
+ alphaTest: o.alphaTest !== void 0 ? o.alphaTest : 0,
3344
3444
  // 关键渲染属性 - 这些缺失会导致渲染抖动和显示错误
3345
- side: r.side !== void 0 ? r.side : A.FrontSide,
3346
- depthTest: r.depthTest !== void 0 ? r.depthTest : !0,
3347
- depthWrite: r.depthWrite !== void 0 ? r.depthWrite : !0,
3348
- wireframe: r.wireframe !== void 0 ? r.wireframe : !1,
3349
- vertexColors: r.vertexColors !== void 0 ? r.vertexColors : !1
3445
+ side: o.side !== void 0 ? o.side : x.FrontSide,
3446
+ depthTest: o.depthTest !== void 0 ? o.depthTest : !0,
3447
+ depthWrite: o.depthWrite !== void 0 ? o.depthWrite : !0,
3448
+ wireframe: o.wireframe !== void 0 ? o.wireframe : !1,
3449
+ vertexColors: o.vertexColors !== void 0 ? o.vertexColors : !1
3350
3450
  };
3351
- switch (r.type) {
3451
+ switch (o.type) {
3352
3452
  case "MeshStandardMaterial":
3353
- e = new A.MeshStandardMaterial({
3453
+ e = new x.MeshStandardMaterial({
3354
3454
  ...t,
3355
- roughness: r.roughness !== void 0 ? r.roughness : 0.5,
3356
- metalness: r.metalness !== void 0 ? r.metalness : 0.5,
3357
- emissive: r.emissive !== void 0 ? r.emissive : 0,
3358
- emissiveIntensity: r.emissiveIntensity !== void 0 ? r.emissiveIntensity : 1
3455
+ roughness: o.roughness !== void 0 ? o.roughness : 0.5,
3456
+ metalness: o.metalness !== void 0 ? o.metalness : 0.5,
3457
+ emissive: o.emissive !== void 0 ? o.emissive : 0,
3458
+ emissiveIntensity: o.emissiveIntensity !== void 0 ? o.emissiveIntensity : 1
3359
3459
  });
3360
3460
  break;
3361
3461
  case "MeshBasicMaterial":
3362
- e = new A.MeshBasicMaterial({
3462
+ e = new x.MeshBasicMaterial({
3363
3463
  ...t
3364
3464
  });
3365
3465
  break;
3366
3466
  case "MeshPhongMaterial":
3367
- e = new A.MeshPhongMaterial({
3467
+ e = new x.MeshPhongMaterial({
3368
3468
  ...t,
3369
- shininess: r.shininess !== void 0 ? r.shininess : 30,
3370
- specular: r.specular !== void 0 ? r.specular : 1118481,
3371
- emissive: r.emissive !== void 0 ? r.emissive : 0,
3372
- emissiveIntensity: r.emissiveIntensity !== void 0 ? r.emissiveIntensity : 1
3469
+ shininess: o.shininess !== void 0 ? o.shininess : 30,
3470
+ specular: o.specular !== void 0 ? o.specular : 1118481,
3471
+ emissive: o.emissive !== void 0 ? o.emissive : 0,
3472
+ emissiveIntensity: o.emissiveIntensity !== void 0 ? o.emissiveIntensity : 1
3373
3473
  });
3374
3474
  break;
3375
3475
  default:
3376
- e = new A.MeshStandardMaterial(t);
3476
+ e = new x.MeshStandardMaterial(t);
3377
3477
  }
3378
- return e.uuid = r.uuid, e;
3478
+ return e.uuid = o.uuid, e;
3379
3479
  }
3380
- class In {
3480
+ class qn {
3381
3481
  constructor() {
3382
3482
  this.geometries = [], this.materials = [], this.hierarchy = [], this.geometryMap = /* @__PURE__ */ new Map(), this.materialMap = /* @__PURE__ */ new Map();
3383
3483
  }
3384
3484
  /**
3385
- * 添加场景数据块
3485
+ * 添加场景数据块 - 使用 for 循环优化
3386
3486
  */
3387
3487
  addChunk(e) {
3388
- e.geometries && e.geometries.forEach((t) => {
3389
- const n = this.geometries.length;
3390
- this.geometries.push(t), this.geometryMap.set(t.uuid, n);
3391
- }), e.materials && e.materials.forEach((t) => {
3392
- const n = this.materials.length;
3393
- this.materials.push(t), this.materialMap.set(t.uuid, n);
3394
- }), e.hierarchy && this.hierarchy.push(...e.hierarchy);
3488
+ if (e.geometries) {
3489
+ const t = e.geometries;
3490
+ for (let n = 0, s = t.length; n < s; n++) {
3491
+ const r = t[n], i = this.geometries.length;
3492
+ this.geometries.push(r), this.geometryMap.set(r.uuid, i);
3493
+ }
3494
+ }
3495
+ if (e.materials) {
3496
+ const t = e.materials;
3497
+ for (let n = 0, s = t.length; n < s; n++) {
3498
+ const r = t[n], i = this.materials.length;
3499
+ this.materials.push(r), this.materialMap.set(r.uuid, i);
3500
+ }
3501
+ }
3502
+ e.hierarchy && this.hierarchy.push(...e.hierarchy);
3395
3503
  }
3396
3504
  /**
3397
3505
  * 构建当前可渲染的场景
@@ -3402,7 +3510,7 @@ class In {
3402
3510
  materials: this.materials,
3403
3511
  hierarchy: this.hierarchy
3404
3512
  };
3405
- return pt(e);
3513
+ return At(e);
3406
3514
  }
3407
3515
  /**
3408
3516
  * 完成构建
@@ -3411,38 +3519,39 @@ class In {
3411
3519
  return this.buildCurrent();
3412
3520
  }
3413
3521
  }
3414
- function fn(r) {
3522
+ function An(o) {
3415
3523
  return new Worker(
3416
- "" + new URL("assets/gltfParser.worker-D2lwod50.js", import.meta.url).href,
3524
+ "" + new URL("assets/gltfParser.worker-BJvxfZUb.js", import.meta.url).href,
3417
3525
  {
3418
- name: r == null ? void 0 : r.name
3526
+ name: o == null ? void 0 : o.name
3419
3527
  }
3420
3528
  );
3421
3529
  }
3422
- function pn(r) {
3530
+ function xn(o) {
3423
3531
  return new Worker(
3424
3532
  "" + new URL("assets/gltfParserOptimized.worker-BHgPWvd-.js", import.meta.url).href,
3425
3533
  {
3426
- name: r == null ? void 0 : r.name
3534
+ name: o == null ? void 0 : o.name
3427
3535
  }
3428
3536
  );
3429
3537
  }
3430
- let U;
3431
- const De = "/draco/";
3432
- let J, ee, tt = 0;
3538
+ let ee;
3539
+ const Pe = "/draco/";
3540
+ let Q, J, lt = 0;
3433
3541
  const X = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map();
3434
- function ve(r) {
3435
- const e = r.clone(!1);
3436
- r.userData && typeof r.userData == "object" ? e.userData = JSON.parse(JSON.stringify(r.userData)) : e.userData = r.userData;
3437
- for (const t of r.children) {
3438
- const n = ve(t);
3439
- e.add(n);
3440
- }
3441
- return e;
3542
+ function ht(o, e = null) {
3543
+ const t = o.clone(!0);
3544
+ if (o.userData && typeof o.userData == "object")
3545
+ try {
3546
+ t.userData = structuredClone(o.userData);
3547
+ } catch {
3548
+ t.userData = { ...o.userData };
3549
+ }
3550
+ return e && e.info("[ deepCloneObject3D ] 克隆完成"), t;
3442
3551
  }
3443
- const mn = (r = {}) => {
3444
- const { debug: e = !1 } = r, t = new Es(), n = new ws();
3445
- n.setDecoderPath(De), t.setDRACOLoader(n);
3552
+ const Mn = (o = {}) => {
3553
+ const { debug: e = !1 } = o, t = new Is(), n = new Cs();
3554
+ n.setDecoderPath(Pe), t.setDRACOLoader(n);
3446
3555
  const s = {
3447
3556
  info: (...d) => e && console.log(...d),
3448
3557
  warn: (...d) => e && console.warn(...d),
@@ -3451,7 +3560,7 @@ const mn = (r = {}) => {
3451
3560
  time: (d) => e && console.time(d),
3452
3561
  timeEnd: (d) => e && console.timeEnd(d)
3453
3562
  };
3454
- function o(d, f, g, T) {
3563
+ function r(d, f, g, T) {
3455
3564
  return t.load(d, f, g, T);
3456
3565
  }
3457
3566
  function i(d, f) {
@@ -3459,25 +3568,25 @@ const mn = (r = {}) => {
3459
3568
  t.load(d, g, f, T);
3460
3569
  });
3461
3570
  }
3462
- async function c(d, f, g, T = {}) {
3571
+ async function a(d, f, g, T = {}) {
3463
3572
  const y = performance.now();
3464
3573
  let E = !1;
3465
3574
  const {
3466
- maxRetries: x = 3,
3467
- optimizeMaterials: M = !1,
3468
- simplifyGeometry: C = !1,
3469
- simplifyRatio: P = 0.5,
3470
- simplifyOptions: K = {},
3471
- useMemoryCache: he = !0
3575
+ maxRetries: A = 3,
3576
+ optimizeMaterials: S = !1,
3577
+ simplifyGeometry: P = !1,
3578
+ simplifyRatio: C = 0.5,
3579
+ simplifyOptions: B = {},
3580
+ useMemoryCache: de = !0
3472
3581
  // 是否使用内存缓存(默认 true)
3473
3582
  } = T;
3474
- if (he) {
3583
+ if (de) {
3475
3584
  const D = H.get(d);
3476
3585
  if (D && D.has(f)) {
3477
3586
  const N = D.get(f);
3478
3587
  s.info(`[ 内存缓存命中 ] ${d} (version: ${f})`), s.time("[ 内存缓存克隆耗时 ]");
3479
- const Z = ve(N);
3480
- return s.timeEnd("[ 内存缓存克隆耗时 ]"), V.recordHit(performance.now() - y), Z;
3588
+ const $ = ht(N);
3589
+ return s.timeEnd("[ 内存缓存克隆耗时 ]"), W.recordHit(performance.now() - y), $;
3481
3590
  }
3482
3591
  }
3483
3592
  try {
@@ -3485,70 +3594,70 @@ const mn = (r = {}) => {
3485
3594
  if (D)
3486
3595
  s.info(`[ asyncFetch ] ====> IndexedDB 缓存命中: ${d}`), E = !0;
3487
3596
  else {
3488
- s.info(`[ asyncFetch ] ====> 缓存未命中: ${d}`), s.time("[ fetchArrayBuffer ] 加载模型耗时"), D = await _e.retry(
3489
- () => a(d, g),
3597
+ s.info(`[ asyncFetch ] ====> 缓存未命中: ${d}`), s.time("[ fetchArrayBuffer ] 加载模型耗时"), D = await Te.retry(
3598
+ () => c(d, g),
3490
3599
  {
3491
- maxRetries: x,
3492
- shouldRetry: (Ue) => !!(Ue.name === "TypeError" || Ue.message.includes("HTTP error! status: 5"))
3600
+ maxRetries: A,
3601
+ shouldRetry: (Ge) => !!(Ge.name === "TypeError" || Ge.message.includes("HTTP error! status: 5"))
3493
3602
  }
3494
3603
  ), s.timeEnd("[ fetchArrayBuffer ] 加载模型耗时");
3495
3604
  const v = performance.now();
3496
- await U.saveModel(d, f, D);
3497
- const Te = performance.now() - v;
3498
- V.recordCacheSave(Te), E = !1;
3605
+ await ee.saveModel(d, f, D);
3606
+ const be = performance.now() - v;
3607
+ W.recordCacheSave(be), E = !1;
3499
3608
  }
3500
3609
  s.time("[ 解析模型耗时 ]");
3501
3610
  let N = await u(D);
3502
- if (s.timeEnd("[ 解析模型耗时 ]"), s.time("[ 模型优化耗时 ]"), M) {
3611
+ if (s.timeEnd("[ 解析模型耗时 ]"), s.time("[ 模型优化耗时 ]"), S) {
3503
3612
  s.info("🔧 [ 材质优化 ] 开始合并相同材质...");
3504
- const { modelOptimizer: v } = await import("./modelOptimizer-D6fRg-DF.js");
3613
+ const { modelOptimizer: v } = await import("./modelOptimizer-B7zPcU53.js");
3505
3614
  N = v.optimizeMaterials(N);
3506
3615
  }
3507
- if (C) {
3508
- s.info(`🔧 [ 几何体简化 ] 开始简化模型 (比例: ${P})...`);
3509
- const { modelOptimizer: v } = await import("./modelOptimizer-D6fRg-DF.js"), Te = {
3616
+ if (P) {
3617
+ s.info(`🔧 [ 几何体简化 ] 开始简化模型 (比例: ${C})...`);
3618
+ const { modelOptimizer: v } = await import("./modelOptimizer-B7zPcU53.js"), be = {
3510
3619
  minFaceCount: 100,
3511
3620
  preserveUVs: !0,
3512
- ...K
3621
+ ...B
3513
3622
  };
3514
- N = v.simplifyModel(N, P, Te);
3623
+ N = v.simplifyModel(N, C, be);
3515
3624
  }
3516
- if (s.timeEnd("[ 模型优化耗时 ]"), he) {
3625
+ if (s.timeEnd("[ 模型优化耗时 ]"), de) {
3517
3626
  H.has(d) || H.set(d, /* @__PURE__ */ new Map());
3518
3627
  const v = H.get(d);
3519
- v.has(f) || (s.info(`[ 内存缓存 ] 存储模型 ${d} (version: ${f})`), v.set(f, ve(N)));
3628
+ v.has(f) || (s.info(`[ 内存缓存 ] 存储模型 ${d} (version: ${f})`), v.set(f, ht(N)));
3520
3629
  }
3521
- const Z = performance.now() - y;
3522
- return E ? V.recordHit(Z) : V.recordMiss(Z), N;
3630
+ const $ = performance.now() - y;
3631
+ return E ? W.recordHit($) : W.recordMiss($), N;
3523
3632
  } catch (D) {
3524
- throw s.error(`加载模型 ${d} 失败:`, D), V.recordError(d, D), D.name === "TypeError" && D.message.includes("fetch") ? ce.networkError(d, D) : D;
3633
+ throw s.error(`加载模型 ${d} 失败:`, D), W.recordError(d, D), D.name === "TypeError" && D.message.includes("fetch") ? he.networkError(d, D) : D;
3525
3634
  }
3526
3635
  }
3527
- async function a(d, f) {
3636
+ async function c(d, f) {
3528
3637
  return new Promise((g, T) => {
3529
3638
  fetch(d).then((y) => {
3530
3639
  if (!y.ok)
3531
3640
  throw new Error(`HTTP error! status: ${y.status}`);
3532
3641
  return y;
3533
3642
  }).then((y) => {
3534
- const E = y.headers.get("content-length"), x = E ? parseInt(E, 10) : 0;
3535
- if (f && x > 0) {
3536
- const M = y.body.getReader();
3537
- let C = 0;
3538
- const P = [], K = () => {
3539
- M.read().then(({ done: he, value: D }) => {
3540
- if (he) {
3541
- const N = new Uint8Array(C);
3542
- let Z = 0;
3543
- for (const v of P)
3544
- N.set(v, Z), Z += v.length;
3643
+ const E = y.headers.get("content-length"), A = E ? parseInt(E, 10) : 0;
3644
+ if (f && A > 0) {
3645
+ const S = y.body.getReader();
3646
+ let P = 0;
3647
+ const C = [], B = () => {
3648
+ S.read().then(({ done: de, value: D }) => {
3649
+ if (de) {
3650
+ const N = new Uint8Array(P);
3651
+ let $ = 0;
3652
+ for (const v of C)
3653
+ N.set(v, $), $ += v.length;
3545
3654
  g(N.buffer);
3546
3655
  return;
3547
3656
  }
3548
- P.push(D), C += D.length, f(Math.round(C / x * 100)), K();
3657
+ C.push(D), P += D.length, f(Math.round(P / A * 100)), B();
3549
3658
  }).catch(T);
3550
3659
  };
3551
- K();
3660
+ B();
3552
3661
  } else
3553
3662
  return y.arrayBuffer();
3554
3663
  }).then((y) => g(y)).catch((y) => {
@@ -3557,110 +3666,110 @@ const mn = (r = {}) => {
3557
3666
  });
3558
3667
  }
3559
3668
  async function l(d, f) {
3560
- return U || (U = new de()), U.getModel(d, f);
3669
+ return ee || (ee = new ct()), ee.getModel(d, f);
3561
3670
  }
3562
3671
  async function u(d, f = {}) {
3563
3672
  if (!d) return null;
3564
3673
  const { useOptimizedParser: g = !0, useProgressive: T = !1 } = f;
3565
3674
  if (g) {
3566
- const x = p();
3567
- if (x)
3675
+ const A = p();
3676
+ if (A)
3568
3677
  try {
3569
3678
  s.time("[ 优化解析 ] 使用 Transferable Objects 解析");
3570
- const M = await m(x, d, T);
3571
- return s.timeEnd("[ 优化解析 ] 使用 Transferable Objects 解析"), pt(M);
3572
- } catch (M) {
3573
- s.warn("[ 优化解析 ] 失败,回退到标准解析", M);
3679
+ const S = await m(A, d, T);
3680
+ return s.timeEnd("[ 优化解析 ] 使用 Transferable Objects 解析"), At(S);
3681
+ } catch (S) {
3682
+ s.warn("[ 优化解析 ] 失败,回退到标准解析", S);
3574
3683
  }
3575
3684
  }
3576
3685
  const y = h();
3577
3686
  if (y)
3578
3687
  try {
3579
- const x = await _(y, d);
3580
- return cn(x);
3581
- } catch (x) {
3582
- s.warn("[ GLTF Worker ] ====> 解析失败,回退到主线程解析", x);
3688
+ const A = await _(y, d);
3689
+ return Tn(A);
3690
+ } catch (A) {
3691
+ s.warn("[ GLTF Worker ] ====> 解析失败,回退到主线程解析", A);
3583
3692
  }
3584
- return (await w(d)).scene;
3693
+ return (await b(d)).scene;
3585
3694
  }
3586
3695
  const h = () => {
3587
3696
  if (typeof window > "u" || typeof Worker > "u")
3588
3697
  return null;
3589
- if (!J)
3698
+ if (!Q)
3590
3699
  try {
3591
- s.info("[GLTF Worker] 使用 ?worker 工厂函数创建 Worker..."), J = fn(), s.info("[GLTF Worker] Worker 创建成功:", J), J.onmessage = (d) => {
3700
+ s.info("[GLTF Worker] 使用 ?worker 工厂函数创建 Worker..."), Q = An(), s.info("[GLTF Worker] Worker 创建成功:", Q), Q.onmessage = (d) => {
3592
3701
  const { id: f, data: g, error: T } = d.data || {};
3593
3702
  if (!f || !X.has(f)) return;
3594
3703
  const { resolve: y, reject: E } = X.get(f);
3595
3704
  X.delete(f), T ? E(new Error(T)) : y(g);
3596
- }, J.onmessageerror = (d) => {
3705
+ }, Q.onmessageerror = (d) => {
3597
3706
  console.error("[ GLTF Worker ] ====> 消息解析失败", d);
3598
- }, J.onerror = (d) => {
3707
+ }, Q.onerror = (d) => {
3599
3708
  console.error("[ GLTF Worker ] ====> 运行错误", d);
3600
3709
  };
3601
3710
  } catch (d) {
3602
3711
  console.error("[GLTF Worker] 创建 Worker 失败:", d), console.error("[GLTF Worker] 错误堆栈:", d.stack);
3603
3712
  }
3604
- return J;
3713
+ return Q;
3605
3714
  }, p = () => {
3606
3715
  if (typeof window > "u" || typeof Worker > "u")
3607
3716
  return null;
3608
- if (!ee)
3717
+ if (!J)
3609
3718
  try {
3610
- s.info("[Optimized Worker] 使用 ?worker 工厂函数创建 Worker..."), ee = pn(), s.info("[Optimized Worker] Worker 创建成功:", ee), ee.onmessage = (d) => {
3719
+ s.info("[Optimized Worker] 使用 ?worker 工厂函数创建 Worker..."), J = xn(), s.info("[Optimized Worker] Worker 创建成功:", J), J.onmessage = (d) => {
3611
3720
  const { id: f, data: g, error: T, type: y } = d.data || {};
3612
3721
  if (!f || !X.has(f) || y === "progress")
3613
3722
  return;
3614
- const { resolve: E, reject: x } = X.get(f);
3615
- X.delete(f), T ? x(new Error(T)) : E(g);
3616
- }, ee.onmessageerror = (d) => {
3723
+ const { resolve: E, reject: A } = X.get(f);
3724
+ X.delete(f), T ? A(new Error(T)) : E(g);
3725
+ }, J.onmessageerror = (d) => {
3617
3726
  console.error("[ 优化 Worker ] ====> 消息解析失败", d);
3618
- }, ee.onerror = (d) => {
3727
+ }, J.onerror = (d) => {
3619
3728
  console.error("[ 优化 Worker ] ====> 运行错误", d);
3620
3729
  };
3621
3730
  } catch (d) {
3622
3731
  return s.warn("[ 优化 Worker ] ====> 创建失败,可能不支持模块化 Worker", d), null;
3623
3732
  }
3624
- return ee;
3733
+ return J;
3625
3734
  }, m = (d, f, g = !1) => new Promise((T, y) => {
3626
- const E = ++tt;
3735
+ const E = ++lt;
3627
3736
  X.set(E, { resolve: T, reject: y });
3628
- const x = {
3737
+ const A = {
3629
3738
  id: E,
3630
3739
  arrayBuffer: f,
3631
- dracoPath: De,
3740
+ dracoPath: Pe,
3632
3741
  mode: g ? "progressive" : "standard"
3633
3742
  };
3634
- d.postMessage(x, [f]);
3743
+ d.postMessage(A, [f]);
3635
3744
  }), _ = (d, f) => new Promise((g, T) => {
3636
- const y = ++tt;
3637
- X.set(y, { resolve: g, reject: T }), d.postMessage({ id: y, arrayBuffer: f, dracoPath: De });
3638
- }), w = (d) => new Promise((f, g) => {
3745
+ const y = ++lt;
3746
+ X.set(y, { resolve: g, reject: T }), d.postMessage({ id: y, arrayBuffer: f, dracoPath: Pe });
3747
+ }), b = (d) => new Promise((f, g) => {
3639
3748
  t.parse(d, "", f, g);
3640
3749
  });
3641
3750
  return {
3642
- load: o,
3751
+ load: r,
3643
3752
  asyncLoad: i,
3644
- asyncCacheLoad: c,
3645
- asyncFetch: c,
3753
+ asyncCacheLoad: a,
3754
+ asyncFetch: a,
3646
3755
  /**
3647
3756
  * 获取缓存统计信息
3648
3757
  * @returns {Object} 统计数据
3649
3758
  */
3650
- getCacheStats: () => V.getStats(),
3759
+ getCacheStats: () => W.getStats(),
3651
3760
  /**
3652
3761
  * 获取缓存实例
3653
3762
  * @returns {IDBCache} 缓存实例
3654
3763
  */
3655
- getCache: () => U || (U = new de()),
3764
+ getCache: () => ee || (ee = new ct()),
3656
3765
  /**
3657
3766
  * 打印缓存性能报告
3658
3767
  */
3659
- logCacheReport: () => V.logReport(),
3768
+ logCacheReport: () => W.logReport(),
3660
3769
  /**
3661
3770
  * 重置缓存统计
3662
3771
  */
3663
- resetCacheStats: () => V.reset(),
3772
+ resetCacheStats: () => W.reset(),
3664
3773
  /**
3665
3774
  * 清空内存缓存
3666
3775
  * 释放已缓存的 3D 模型对象内存
@@ -3713,35 +3822,16 @@ const mn = (r = {}) => {
3713
3822
  const T = g.size;
3714
3823
  return H.delete(d), s.info(`[ 内存缓存 ] 删除模型 ${d} 及其所有版本 (共 ${T} 个)`), T > 0;
3715
3824
  }
3716
- },
3717
- /**
3718
- * 清理旧版本格式的缓存数据
3719
- * 手动触发清理,不需要等待数据库版本升级
3720
- * @returns {Promise<Object>} 清理结果
3721
- * @returns {number} returns.total - 总记录数
3722
- * @returns {number} returns.deleted - 删除的记录数
3723
- * @returns {number} returns.kept - 保留的记录数
3724
- * @returns {Array} returns.deletedPaths - 被删除的路径列表
3725
- */
3726
- cleanLegacyCache: async () => await (U || (U = new de())).cleanLegacyFormats(),
3727
- /**
3728
- * 验证并修复缓存
3729
- * @returns {Promise<Object>} 验证结果
3730
- * @returns {number} returns.total - 总记录数
3731
- * @returns {number} returns.valid - 有效记录数
3732
- * @returns {number} returns.invalid - 无效记录数
3733
- * @returns {number} returns.repairs - 修复的操作数
3734
- */
3735
- validateCache: async () => await (U || (U = new de())).validateAndRepair()
3825
+ }
3736
3826
  };
3737
3827
  };
3738
- class gn {
3828
+ class Sn {
3739
3829
  constructor(e = {}) {
3740
3830
  this.options = {
3741
3831
  maxPreloadCount: e.maxPreloadCount || 5,
3742
3832
  preloadDelay: e.preloadDelay || 1e3,
3743
3833
  enableLearning: e.enableLearning !== !1
3744
- }, this.loadHistory = /* @__PURE__ */ new Map(), this.loadSequence = [], this.associations = /* @__PURE__ */ new Map(), this.preloadQueue = /* @__PURE__ */ new Set(), this.isPreloading = !1, this.loader = null, this.getLoader = () => (this.loader || (this.loader = mn()), this.loader);
3834
+ }, this.loadHistory = /* @__PURE__ */ new Map(), this.loadSequence = [], this.associations = /* @__PURE__ */ new Map(), this.preloadQueue = /* @__PURE__ */ new Set(), this.isPreloading = !1, this.loader = null, this.getLoader = () => (this.loader || (this.loader = Mn()), this.loader);
3745
3835
  }
3746
3836
  /**
3747
3837
  * 记录模型加载
@@ -3764,11 +3854,11 @@ class gn {
3764
3854
  _learnAssociations(e) {
3765
3855
  const n = this.loadSequence.length - 1;
3766
3856
  for (let s = Math.max(0, n - 10); s < n; s++) {
3767
- const { path: o } = this.loadSequence[s];
3768
- if (this.loadSequence[n].timestamp - this.loadSequence[s].timestamp < 5 * 60 * 1e3 && o !== e) {
3769
- this.associations.has(o) || this.associations.set(o, /* @__PURE__ */ new Map());
3770
- const c = this.associations.get(o), a = c.get(e) || 0;
3771
- c.set(e, a + 1);
3857
+ const { path: r } = this.loadSequence[s];
3858
+ if (this.loadSequence[n].timestamp - this.loadSequence[s].timestamp < 5 * 60 * 1e3 && r !== e) {
3859
+ this.associations.has(r) || this.associations.set(r, /* @__PURE__ */ new Map());
3860
+ const a = this.associations.get(r), c = a.get(e) || 0;
3861
+ a.set(e, c + 1);
3772
3862
  }
3773
3863
  }
3774
3864
  }
@@ -3791,20 +3881,20 @@ class gn {
3791
3881
  */
3792
3882
  predictNext(e) {
3793
3883
  const t = /* @__PURE__ */ new Map(), n = this.associations.get(e);
3794
- n && n.forEach((c, a) => {
3795
- t.set(a, (t.get(a) || 0) + c * 2);
3884
+ n && n.forEach((a, c) => {
3885
+ t.set(c, (t.get(c) || 0) + a * 2);
3796
3886
  });
3797
- const s = Array.from(this.loadHistory.values()).reduce((c, a) => c + a.count, 0) / (this.loadHistory.size || 1);
3798
- this.loadHistory.forEach((c, a) => {
3799
- if (a !== e) {
3800
- const l = c.count / s;
3801
- t.set(a, (t.get(a) || 0) + l);
3887
+ const s = Array.from(this.loadHistory.values()).reduce((a, c) => a + c.count, 0) / (this.loadHistory.size || 1);
3888
+ this.loadHistory.forEach((a, c) => {
3889
+ if (c !== e) {
3890
+ const l = a.count / s;
3891
+ t.set(c, (t.get(c) || 0) + l);
3802
3892
  }
3803
3893
  });
3804
- const o = this.loadSequence.slice(-10);
3805
- return new Set(o.map((c) => c.path)).forEach((c) => {
3806
- c !== e && t.set(c, (t.get(c) || 0) + 0.5);
3807
- }), Array.from(t.entries()).sort((c, a) => a[1] - c[1]).slice(0, this.options.maxPreloadCount).map(([c]) => c);
3894
+ const r = this.loadSequence.slice(-10);
3895
+ return new Set(r.map((a) => a.path)).forEach((a) => {
3896
+ a !== e && t.set(a, (t.get(a) || 0) + 0.5);
3897
+ }), Array.from(t.entries()).sort((a, c) => c[1] - a[1]).slice(0, this.options.maxPreloadCount).map(([a]) => a);
3808
3898
  }
3809
3899
  /**
3810
3900
  * 预加载模型列表
@@ -3815,14 +3905,14 @@ class gn {
3815
3905
  if (this.isPreloading)
3816
3906
  return;
3817
3907
  this.isPreloading = !0;
3818
- const { asyncFetch: n } = this.getLoader(), s = e.filter((o) => !this.preloadQueue.has(o)).slice(0, this.options.maxPreloadCount).map(async (o) => {
3819
- this.preloadQueue.add(o);
3908
+ const { asyncFetch: n } = this.getLoader(), s = e.filter((r) => !this.preloadQueue.has(r)).slice(0, this.options.maxPreloadCount).map(async (r) => {
3909
+ this.preloadQueue.add(r);
3820
3910
  try {
3821
- console.log(`[ 智能预加载 ] 开始预加载: ${o}`), await n(o, t), console.log(`[ 智能预加载 ] 完成: ${o}`);
3911
+ console.log(`[ 智能预加载 ] 开始预加载: ${r}`), await n(r, t), console.log(`[ 智能预加载 ] 完成: ${r}`);
3822
3912
  } catch (i) {
3823
- console.warn(`[ 智能预加载 ] 失败: ${o}`, i);
3913
+ console.warn(`[ 智能预加载 ] 失败: ${r}`, i);
3824
3914
  } finally {
3825
- this.preloadQueue.delete(o);
3915
+ this.preloadQueue.delete(r);
3826
3916
  }
3827
3917
  });
3828
3918
  await Promise.all(s), this.isPreloading = !1;
@@ -3836,8 +3926,8 @@ class gn {
3836
3926
  this.associations.has(e) || this.associations.set(e, /* @__PURE__ */ new Map());
3837
3927
  const n = this.associations.get(e);
3838
3928
  t.forEach((s) => {
3839
- const o = n.get(s) || 0;
3840
- n.set(s, o + 10);
3929
+ const r = n.get(s) || 0;
3930
+ n.set(s, r + 10);
3841
3931
  });
3842
3932
  }
3843
3933
  /**
@@ -3884,34 +3974,39 @@ class gn {
3884
3974
  });
3885
3975
  }
3886
3976
  }
3887
- const kn = new gn();
3977
+ const $n = new Sn();
3888
3978
  export {
3889
- ln as C,
3890
- Le as E,
3891
- de as I,
3892
- ce as M,
3893
- gn as P,
3894
- _e as R,
3895
- ae as S,
3896
- En as a,
3897
- xn as b,
3898
- bn as c,
3899
- An as d,
3900
- Rn as e,
3901
- Mn as f,
3902
- Sn as g,
3903
- Ln as h,
3904
- Dn as i,
3905
- an as j,
3906
- Pn as k,
3907
- cn as l,
3908
- On as m,
3909
- V as n,
3910
- Cn as o,
3911
- kn as p,
3912
- In as q,
3913
- pt as r,
3914
- wn as s,
3915
- Tn as t,
3916
- mn as u
3979
+ bn as C,
3980
+ De as E,
3981
+ ct as I,
3982
+ he as M,
3983
+ Sn as P,
3984
+ Te as R,
3985
+ ce as S,
3986
+ In as a,
3987
+ kn as b,
3988
+ On as c,
3989
+ Nn as d,
3990
+ vn as e,
3991
+ Hn as f,
3992
+ Fn as g,
3993
+ Un as h,
3994
+ Gn as i,
3995
+ _n as j,
3996
+ zn as k,
3997
+ Tn as l,
3998
+ Bn as m,
3999
+ Kn as n,
4000
+ jn as o,
4001
+ Wn as p,
4002
+ Xn as q,
4003
+ Vn as r,
4004
+ Yn as s,
4005
+ W as t,
4006
+ Mn as u,
4007
+ $n as v,
4008
+ At as w,
4009
+ qn as x,
4010
+ Cn as y,
4011
+ Pn as z
3917
4012
  };