@ridp/threejs 1.3.0 → 1.3.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,35 +1,35 @@
1
- import * as F from "three";
2
- import { Matrix4 as dt, Vector3 as x, Quaternion as et, Object3D as yt, Controls as gt, MOUSE as z, TOUCH as G, Spherical as nt, Vector2 as L, Ray as Et, Plane as bt, MathUtils as wt, CameraHelper as Dt, GridHelper as St, BoxHelper as Pt, Raycaster as Tt, AxesHelper as Mt, ArrowHelper as Rt, DataTextureLoader as xt, HalfFloatType as X, FloatType as $, DataUtils as V, LinearSRGBColorSpace as At, LinearFilter as at, EquirectangularReflectionMapping as Ot } from "three";
1
+ import * as M from "three";
2
+ import { Matrix4 as ft, Vector3 as x, Quaternion as nt, Object3D as wt, Controls as Dt, MOUSE as z, TOUCH as F, Spherical as ht, Vector2 as L, Ray as St, Plane as Pt, MathUtils as Tt, CameraHelper as Mt, GridHelper as At, BoxHelper as Rt, Raycaster as xt, AxesHelper as Ot, ArrowHelper as vt, DataTextureLoader as Lt, HalfFloatType as X, FloatType as et, DataUtils as V, LinearSRGBColorSpace as kt, LinearFilter as ct, EquirectangularReflectionMapping as Ct } from "three";
3
3
  var K = function() {
4
4
  var e = 0, t = document.createElement("div");
5
5
  t.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000", t.addEventListener("click", function(m) {
6
- m.preventDefault(), o(++e % t.children.length);
6
+ m.preventDefault(), s(++e % t.children.length);
7
7
  }, !1);
8
8
  function i(m) {
9
9
  return t.appendChild(m.dom), m;
10
10
  }
11
- function o(m) {
11
+ function s(m) {
12
12
  for (var h = 0; h < t.children.length; h++)
13
13
  t.children[h].style.display = h === m ? "block" : "none";
14
14
  e = m;
15
15
  }
16
- var r = (performance || Date).now(), c = r, a = 0, f = i(new K.Panel("FPS", "#0ff", "#002")), P = i(new K.Panel("MS", "#0f0", "#020"));
16
+ var r = (performance || Date).now(), a = r, n = 0, c = i(new K.Panel("FPS", "#0ff", "#002")), d = i(new K.Panel("MS", "#0f0", "#020"));
17
17
  if (self.performance && self.performance.memory)
18
- var b = i(new K.Panel("MB", "#f08", "#201"));
19
- return o(0), {
18
+ var g = i(new K.Panel("MB", "#f08", "#201"));
19
+ return s(0), {
20
20
  REVISION: 16,
21
21
  dom: t,
22
22
  addPanel: i,
23
- showPanel: o,
23
+ showPanel: s,
24
24
  begin: function() {
25
25
  r = (performance || Date).now();
26
26
  },
27
27
  end: function() {
28
- a++;
28
+ n++;
29
29
  var m = (performance || Date).now();
30
- if (P.update(m - r, 200), m >= c + 1e3 && (f.update(a * 1e3 / (m - c), 100), c = m, a = 0, b)) {
30
+ if (d.update(m - r, 200), m >= a + 1e3 && (c.update(n * 1e3 / (m - a), 100), a = m, n = 0, g)) {
31
31
  var h = performance.memory;
32
- b.update(h.usedJSHeapSize / 1048576, h.jsHeapSizeLimit / 1048576);
32
+ g.update(h.usedJSHeapSize / 1048576, h.jsHeapSizeLimit / 1048576);
33
33
  }
34
34
  return m;
35
35
  },
@@ -38,22 +38,22 @@ var K = function() {
38
38
  },
39
39
  // Backwards Compatibility
40
40
  domElement: t,
41
- setMode: o
41
+ setMode: s
42
42
  };
43
43
  };
44
44
  K.Panel = function(e, t, i) {
45
- var o = 1 / 0, r = 0, c = Math.round, a = c(window.devicePixelRatio || 1), f = 80 * a, P = 48 * a, b = 3 * a, m = 2 * a, h = 3 * a, O = 15 * a, v = 74 * a, C = 30 * a, k = document.createElement("canvas");
46
- k.width = f, k.height = P, k.style.cssText = "width:80px;height:48px";
47
- var n = k.getContext("2d");
48
- return n.font = "bold " + 9 * a + "px Helvetica,Arial,sans-serif", n.textBaseline = "top", n.fillStyle = i, n.fillRect(0, 0, f, P), n.fillStyle = t, n.fillText(e, b, m), n.fillRect(h, O, v, C), n.fillStyle = i, n.globalAlpha = 0.9, n.fillRect(h, O, v, C), {
49
- dom: k,
50
- update: function(s, T) {
51
- o = Math.min(o, s), r = Math.max(r, s), n.fillStyle = i, n.globalAlpha = 1, n.fillRect(0, 0, f, O), n.fillStyle = t, n.fillText(c(s) + " " + e + " (" + c(o) + "-" + c(r) + ")", b, m), n.drawImage(k, h + a, O, v - a, C, h, O, v - a, C), n.fillRect(h + v - a, O, a, C), n.fillStyle = i, n.globalAlpha = 0.9, n.fillRect(h + v - a, O, a, c((1 - s / T) * C));
45
+ var s = 1 / 0, r = 0, a = Math.round, n = a(window.devicePixelRatio || 1), c = 80 * n, d = 48 * n, g = 3 * n, m = 2 * n, h = 3 * n, v = 15 * n, k = 74 * n, C = 30 * n, I = document.createElement("canvas");
46
+ I.width = c, I.height = d, I.style.cssText = "width:80px;height:48px";
47
+ var l = I.getContext("2d");
48
+ return l.font = "bold " + 9 * n + "px Helvetica,Arial,sans-serif", l.textBaseline = "top", l.fillStyle = i, l.fillRect(0, 0, c, d), l.fillStyle = t, l.fillText(e, g, m), l.fillRect(h, v, k, C), l.fillStyle = i, l.globalAlpha = 0.9, l.fillRect(h, v, k, C), {
49
+ dom: I,
50
+ update: function(o, T) {
51
+ s = Math.min(s, o), r = Math.max(r, o), l.fillStyle = i, l.globalAlpha = 1, l.fillRect(0, 0, c, v), l.fillStyle = t, l.fillText(a(o) + " " + e + " (" + a(s) + "-" + a(r) + ")", g, m), l.drawImage(I, h + n, v, k - n, C, h, v, k - n, C), l.fillRect(h + k - n, v, n, C), l.fillStyle = i, l.globalAlpha = 0.9, l.fillRect(h + k - n, v, n, a((1 - o / T) * C));
52
52
  }
53
53
  };
54
54
  };
55
- const rt = new x(), Lt = new et(), ht = new x();
56
- class vt extends yt {
55
+ const pt = new x(), It = new nt(), dt = new x();
56
+ class jt extends wt {
57
57
  /**
58
58
  * Constructs a new CSS3D object.
59
59
  *
@@ -70,7 +70,7 @@ class vt extends yt {
70
70
  return super.copy(t, i), this.element = t.element.cloneNode(!0), this;
71
71
  }
72
72
  }
73
- class se extends vt {
73
+ class ee extends jt {
74
74
  /**
75
75
  * Constructs a new CSS3D sprite object.
76
76
  *
@@ -83,8 +83,8 @@ class se extends vt {
83
83
  return super.copy(t, i), this.rotation2D = t.rotation2D, this;
84
84
  }
85
85
  }
86
- const H = new dt(), Ct = new dt();
87
- class oe {
86
+ const H = new ft(), Nt = new ft();
87
+ class ie {
88
88
  /**
89
89
  * Constructs a new CSS3D renderer.
90
90
  *
@@ -92,72 +92,72 @@ class oe {
92
92
  */
93
93
  constructor(t = {}) {
94
94
  const i = this;
95
- let o, r, c, a;
96
- const f = {
95
+ let s, r, a, n;
96
+ const c = {
97
97
  camera: { style: "" },
98
98
  objects: /* @__PURE__ */ new WeakMap()
99
- }, P = t.element !== void 0 ? t.element : document.createElement("div");
100
- P.style.overflow = "hidden", this.domElement = P;
101
- const b = document.createElement("div");
102
- b.style.transformOrigin = "0 0", b.style.pointerEvents = "none", P.appendChild(b);
99
+ }, d = t.element !== void 0 ? t.element : document.createElement("div");
100
+ d.style.overflow = "hidden", this.domElement = d;
101
+ const g = document.createElement("div");
102
+ g.style.transformOrigin = "0 0", g.style.pointerEvents = "none", d.appendChild(g);
103
103
  const m = document.createElement("div");
104
- m.style.transformStyle = "preserve-3d", b.appendChild(m), this.getSize = function() {
104
+ m.style.transformStyle = "preserve-3d", g.appendChild(m), this.getSize = function() {
105
105
  return {
106
- width: o,
106
+ width: s,
107
107
  height: r
108
108
  };
109
- }, this.render = function(n, s) {
110
- const T = s.projectionMatrix.elements[5] * a;
111
- s.view && s.view.enabled ? (b.style.transform = `translate( ${-s.view.offsetX * (o / s.view.width)}px, ${-s.view.offsetY * (r / s.view.height)}px )`, b.style.transform += `scale( ${s.view.fullWidth / s.view.width}, ${s.view.fullHeight / s.view.height} )`) : b.style.transform = "", n.matrixWorldAutoUpdate === !0 && n.updateMatrixWorld(), s.parent === null && s.matrixWorldAutoUpdate === !0 && s.updateMatrixWorld();
112
- let B, M;
113
- s.isOrthographicCamera && (B = -(s.right + s.left) / 2, M = (s.top + s.bottom) / 2);
114
- const A = s.view && s.view.enabled ? s.view.height / s.view.fullHeight : 1, I = s.isOrthographicCamera ? `scale( ${A} )scale(` + T + ")translate(" + h(B) + "px," + h(M) + "px)" + O(s.matrixWorldInverse) : `scale( ${A} )translateZ(` + T + "px)" + O(s.matrixWorldInverse), l = (s.isPerspectiveCamera ? "perspective(" + T + "px) " : "") + I + "translate(" + c + "px," + a + "px)";
115
- f.camera.style !== l && (m.style.transform = l, f.camera.style = l), k(n, n, s);
116
- }, this.setSize = function(n, s) {
117
- o = n, r = s, c = o / 2, a = r / 2, P.style.width = n + "px", P.style.height = s + "px", b.style.width = n + "px", b.style.height = s + "px", m.style.width = n + "px", m.style.height = s + "px";
109
+ }, this.render = function(l, o) {
110
+ const T = o.projectionMatrix.elements[5] * n;
111
+ o.view && o.view.enabled ? (g.style.transform = `translate( ${-o.view.offsetX * (s / o.view.width)}px, ${-o.view.offsetY * (r / o.view.height)}px )`, g.style.transform += `scale( ${o.view.fullWidth / o.view.width}, ${o.view.fullHeight / o.view.height} )`) : g.style.transform = "", l.matrixWorldAutoUpdate === !0 && l.updateMatrixWorld(), o.parent === null && o.matrixWorldAutoUpdate === !0 && o.updateMatrixWorld();
112
+ let B, A;
113
+ o.isOrthographicCamera && (B = -(o.right + o.left) / 2, A = (o.top + o.bottom) / 2);
114
+ const O = o.view && o.view.enabled ? o.view.height / o.view.fullHeight : 1, j = o.isOrthographicCamera ? `scale( ${O} )scale(` + T + ")translate(" + h(B) + "px," + h(A) + "px)" + v(o.matrixWorldInverse) : `scale( ${O} )translateZ(` + T + "px)" + v(o.matrixWorldInverse), p = (o.isPerspectiveCamera ? "perspective(" + T + "px) " : "") + j + "translate(" + a + "px," + n + "px)";
115
+ c.camera.style !== p && (m.style.transform = p, c.camera.style = p), I(l, l, o);
116
+ }, this.setSize = function(l, o) {
117
+ s = l, r = o, a = s / 2, n = r / 2, d.style.width = l + "px", d.style.height = o + "px", g.style.width = l + "px", g.style.height = o + "px", m.style.width = l + "px", m.style.height = o + "px";
118
118
  };
119
- function h(n) {
120
- return Math.abs(n) < 1e-10 ? 0 : n;
119
+ function h(l) {
120
+ return Math.abs(l) < 1e-10 ? 0 : l;
121
121
  }
122
- function O(n) {
123
- const s = n.elements;
124
- return "matrix3d(" + h(s[0]) + "," + h(-s[1]) + "," + h(s[2]) + "," + h(s[3]) + "," + h(s[4]) + "," + h(-s[5]) + "," + h(s[6]) + "," + h(s[7]) + "," + h(s[8]) + "," + h(-s[9]) + "," + h(s[10]) + "," + h(s[11]) + "," + h(s[12]) + "," + h(-s[13]) + "," + h(s[14]) + "," + h(s[15]) + ")";
122
+ function v(l) {
123
+ const o = l.elements;
124
+ return "matrix3d(" + h(o[0]) + "," + h(-o[1]) + "," + h(o[2]) + "," + h(o[3]) + "," + h(o[4]) + "," + h(-o[5]) + "," + h(o[6]) + "," + h(o[7]) + "," + h(o[8]) + "," + h(-o[9]) + "," + h(o[10]) + "," + h(o[11]) + "," + h(o[12]) + "," + h(-o[13]) + "," + h(o[14]) + "," + h(o[15]) + ")";
125
125
  }
126
- function v(n) {
127
- const s = n.elements;
128
- return "translate(-50%,-50%)" + ("matrix3d(" + h(s[0]) + "," + h(s[1]) + "," + h(s[2]) + "," + h(s[3]) + "," + h(-s[4]) + "," + h(-s[5]) + "," + h(-s[6]) + "," + h(-s[7]) + "," + h(s[8]) + "," + h(s[9]) + "," + h(s[10]) + "," + h(s[11]) + "," + h(s[12]) + "," + h(s[13]) + "," + h(s[14]) + "," + h(s[15]) + ")");
126
+ function k(l) {
127
+ const o = l.elements;
128
+ return "translate(-50%,-50%)" + ("matrix3d(" + h(o[0]) + "," + h(o[1]) + "," + h(o[2]) + "," + h(o[3]) + "," + h(-o[4]) + "," + h(-o[5]) + "," + h(-o[6]) + "," + h(-o[7]) + "," + h(o[8]) + "," + h(o[9]) + "," + h(o[10]) + "," + h(o[11]) + "," + h(o[12]) + "," + h(o[13]) + "," + h(o[14]) + "," + h(o[15]) + ")");
129
129
  }
130
- function C(n) {
131
- n.isCSS3DObject && (n.element.style.display = "none");
132
- for (let s = 0, T = n.children.length; s < T; s++)
133
- C(n.children[s]);
130
+ function C(l) {
131
+ l.isCSS3DObject && (l.element.style.display = "none");
132
+ for (let o = 0, T = l.children.length; o < T; o++)
133
+ C(l.children[o]);
134
134
  }
135
- function k(n, s, T, B) {
136
- if (n.visible === !1) {
137
- C(n);
135
+ function I(l, o, T, B) {
136
+ if (l.visible === !1) {
137
+ C(l);
138
138
  return;
139
139
  }
140
- if (n.isCSS3DObject) {
141
- const M = n.layers.test(T.layers) === !0, A = n.element;
142
- if (A.style.display = M === !0 ? "" : "none", M === !0) {
143
- n.onBeforeRender(i, s, T);
144
- let I;
145
- n.isCSS3DSprite ? (H.copy(T.matrixWorldInverse), H.transpose(), n.rotation2D !== 0 && H.multiply(Ct.makeRotationZ(n.rotation2D)), n.matrixWorld.decompose(rt, Lt, ht), H.setPosition(rt), H.scale(ht), H.elements[3] = 0, H.elements[7] = 0, H.elements[11] = 0, H.elements[15] = 1, I = v(H)) : I = v(n.matrixWorld);
146
- const N = f.objects.get(n);
147
- if (N === void 0 || N.style !== I) {
148
- A.style.transform = I;
149
- const l = { style: I };
150
- f.objects.set(n, l);
140
+ if (l.isCSS3DObject) {
141
+ const A = l.layers.test(T.layers) === !0, O = l.element;
142
+ if (O.style.display = A === !0 ? "" : "none", A === !0) {
143
+ l.onBeforeRender(i, o, T);
144
+ let j;
145
+ l.isCSS3DSprite ? (H.copy(T.matrixWorldInverse), H.transpose(), l.rotation2D !== 0 && H.multiply(Nt.makeRotationZ(l.rotation2D)), l.matrixWorld.decompose(pt, It, dt), H.setPosition(pt), H.scale(dt), H.elements[3] = 0, H.elements[7] = 0, H.elements[11] = 0, H.elements[15] = 1, j = k(H)) : j = k(l.matrixWorld);
146
+ const N = c.objects.get(l);
147
+ if (N === void 0 || N.style !== j) {
148
+ O.style.transform = j;
149
+ const p = { style: j };
150
+ c.objects.set(l, p);
151
151
  }
152
- A.parentNode !== m && m.appendChild(A), n.onAfterRender(i, s, T);
152
+ O.parentNode !== m && m.appendChild(O), l.onAfterRender(i, o, T);
153
153
  }
154
154
  }
155
- for (let M = 0, A = n.children.length; M < A; M++)
156
- k(n.children[M], s, T);
155
+ for (let A = 0, O = l.children.length; A < O; A++)
156
+ I(l.children[A], o, T);
157
157
  }
158
158
  }
159
159
  }
160
- const lt = { type: "change" }, it = { type: "start" }, ut = { type: "end" }, q = new Et(), ct = new bt(), kt = Math.cos(70 * wt.DEG2RAD), S = new x(), R = 2 * Math.PI, d = {
160
+ const ut = { type: "change" }, at = { type: "start" }, yt = { type: "end" }, q = new St(), mt = new Pt(), Ht = Math.cos(70 * Tt.DEG2RAD), P = new x(), R = 2 * Math.PI, _ = {
161
161
  NONE: -1,
162
162
  ROTATE: 0,
163
163
  DOLLY: 1,
@@ -166,8 +166,8 @@ const lt = { type: "change" }, it = { type: "start" }, ut = { type: "end" }, q =
166
166
  TOUCH_PAN: 4,
167
167
  TOUCH_DOLLY_PAN: 5,
168
168
  TOUCH_DOLLY_ROTATE: 6
169
- }, Q = 1e-6;
170
- class mt extends gt {
169
+ }, it = 1e-6;
170
+ class gt extends Dt {
171
171
  /**
172
172
  * Constructs a new controls instance.
173
173
  *
@@ -175,7 +175,7 @@ class mt extends gt {
175
175
  * @param {?HTMLDOMElement} domElement - The HTML element used for event listeners.
176
176
  */
177
177
  constructor(t, i = null) {
178
- super(t, i), this.state = d.NONE, this.target = new x(), this.cursor = new x(), 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: G.ROTATE, TWO: G.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new x(), this._lastQuaternion = new et(), this._lastTargetPosition = new x(), this._quat = new et().setFromUnitVectors(t.up, new x(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new nt(), this._sphericalDelta = new nt(), this._scale = 1, this._panOffset = new x(), this._rotateStart = new L(), this._rotateEnd = new L(), this._rotateDelta = new L(), this._panStart = new L(), this._panEnd = new L(), this._panDelta = new L(), this._dollyStart = new L(), this._dollyEnd = new L(), this._dollyDelta = new L(), this._dollyDirection = new x(), this._mouse = new L(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = Nt.bind(this), this._onPointerDown = It.bind(this), this._onPointerUp = Ht.bind(this), this._onContextMenu = Bt.bind(this), this._onMouseWheel = Yt.bind(this), this._onKeyDown = zt.bind(this), this._onTouchStart = Gt.bind(this), this._onTouchMove = Ft.bind(this), this._onMouseDown = jt.bind(this), this._onMouseMove = Ut.bind(this), this._interceptControlDown = Zt.bind(this), this._interceptControlUp = Wt.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
178
+ super(t, i), this.state = _.NONE, this.target = new x(), this.cursor = new x(), 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: F.ROTATE, TWO: F.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new x(), this._lastQuaternion = new nt(), this._lastTargetPosition = new x(), this._quat = new nt().setFromUnitVectors(t.up, new x(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new ht(), this._sphericalDelta = new ht(), this._scale = 1, this._panOffset = new x(), this._rotateStart = new L(), this._rotateEnd = new L(), this._rotateDelta = new L(), this._panStart = new L(), this._panEnd = new L(), this._panDelta = new L(), this._dollyStart = new L(), this._dollyEnd = new L(), this._dollyDelta = new L(), this._dollyDirection = new x(), this._mouse = new L(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = Ut.bind(this), this._onPointerDown = Gt.bind(this), this._onPointerUp = Yt.bind(this), this._onContextMenu = Xt.bind(this), this._onMouseWheel = Bt.bind(this), this._onKeyDown = Zt.bind(this), this._onTouchStart = Wt.bind(this), this._onTouchMove = Kt.bind(this), this._onMouseDown = zt.bind(this), this._onMouseMove = Ft.bind(this), this._interceptControlDown = Vt.bind(this), this._interceptControlUp = qt.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
179
179
  }
180
180
  connect(t) {
181
181
  super.connect(t), 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";
@@ -236,42 +236,42 @@ class mt extends gt {
236
236
  * was called, or the initial state.
237
237
  */
238
238
  reset() {
239
- this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(lt), this.update(), this.state = d.NONE;
239
+ this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(ut), this.update(), this.state = _.NONE;
240
240
  }
241
241
  update(t = null) {
242
242
  const i = this.object.position;
243
- S.copy(i).sub(this.target), S.applyQuaternion(this._quat), this._spherical.setFromVector3(S), this.autoRotate && this.state === d.NONE && this._rotateLeft(this._getAutoRotationAngle(t)), 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);
244
- let o = this.minAzimuthAngle, r = this.maxAzimuthAngle;
245
- isFinite(o) && isFinite(r) && (o < -Math.PI ? o += R : o > Math.PI && (o -= R), r < -Math.PI ? r += R : r > Math.PI && (r -= R), o <= r ? this._spherical.theta = Math.max(o, Math.min(r, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (o + r) / 2 ? Math.max(o, this._spherical.theta) : Math.min(r, 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);
246
- let c = !1;
243
+ P.copy(i).sub(this.target), P.applyQuaternion(this._quat), this._spherical.setFromVector3(P), this.autoRotate && this.state === _.NONE && this._rotateLeft(this._getAutoRotationAngle(t)), 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);
244
+ let s = this.minAzimuthAngle, r = this.maxAzimuthAngle;
245
+ isFinite(s) && isFinite(r) && (s < -Math.PI ? s += R : s > Math.PI && (s -= R), r < -Math.PI ? r += R : r > Math.PI && (r -= R), s <= r ? this._spherical.theta = Math.max(s, Math.min(r, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (s + r) / 2 ? Math.max(s, this._spherical.theta) : Math.min(r, 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);
246
+ let a = !1;
247
247
  if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera)
248
248
  this._spherical.radius = this._clampDistance(this._spherical.radius);
249
249
  else {
250
- const a = this._spherical.radius;
251
- this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), c = a != this._spherical.radius;
250
+ const n = this._spherical.radius;
251
+ this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), a = n != this._spherical.radius;
252
252
  }
253
- if (S.setFromSpherical(this._spherical), S.applyQuaternion(this._quatInverse), i.copy(this.target).add(S), 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) {
254
- let a = null;
253
+ if (P.setFromSpherical(this._spherical), P.applyQuaternion(this._quatInverse), i.copy(this.target).add(P), 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) {
254
+ let n = null;
255
255
  if (this.object.isPerspectiveCamera) {
256
- const f = S.length();
257
- a = this._clampDistance(f * this._scale);
258
- const P = f - a;
259
- this.object.position.addScaledVector(this._dollyDirection, P), this.object.updateMatrixWorld(), c = !!P;
256
+ const c = P.length();
257
+ n = this._clampDistance(c * this._scale);
258
+ const d = c - n;
259
+ this.object.position.addScaledVector(this._dollyDirection, d), this.object.updateMatrixWorld(), a = !!d;
260
260
  } else if (this.object.isOrthographicCamera) {
261
- const f = new x(this._mouse.x, this._mouse.y, 0);
262
- f.unproject(this.object);
263
- const P = this.object.zoom;
264
- this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), c = P !== this.object.zoom;
265
- const b = new x(this._mouse.x, this._mouse.y, 0);
266
- b.unproject(this.object), this.object.position.sub(b).add(f), this.object.updateMatrixWorld(), a = S.length();
261
+ const c = new x(this._mouse.x, this._mouse.y, 0);
262
+ c.unproject(this.object);
263
+ const d = this.object.zoom;
264
+ this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), a = d !== this.object.zoom;
265
+ const g = new x(this._mouse.x, this._mouse.y, 0);
266
+ g.unproject(this.object), this.object.position.sub(g).add(c), this.object.updateMatrixWorld(), n = P.length();
267
267
  } else
268
268
  console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
269
- a !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position) : (q.origin.copy(this.object.position), q.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(q.direction)) < kt ? this.object.lookAt(this.target) : (ct.setFromNormalAndCoplanarPoint(this.object.up, this.target), q.intersectPlane(ct, this.target))));
269
+ n !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(n).add(this.object.position) : (q.origin.copy(this.object.position), q.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(q.direction)) < Ht ? this.object.lookAt(this.target) : (mt.setFromNormalAndCoplanarPoint(this.object.up, this.target), q.intersectPlane(mt, this.target))));
270
270
  } else if (this.object.isOrthographicCamera) {
271
- const a = this.object.zoom;
272
- this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), a !== this.object.zoom && (this.object.updateProjectionMatrix(), c = !0);
271
+ const n = this.object.zoom;
272
+ this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), n !== this.object.zoom && (this.object.updateProjectionMatrix(), a = !0);
273
273
  }
274
- return this._scale = 1, this._performCursorZoom = !1, c || this._lastPosition.distanceToSquared(this.object.position) > Q || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > Q || this._lastTargetPosition.distanceToSquared(this.target) > Q ? (this.dispatchEvent(lt), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
274
+ return this._scale = 1, this._performCursorZoom = !1, a || this._lastPosition.distanceToSquared(this.object.position) > it || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > it || this._lastTargetPosition.distanceToSquared(this.target) > it ? (this.dispatchEvent(ut), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
275
275
  }
276
276
  _getAutoRotationAngle(t) {
277
277
  return t !== null ? R / 60 * this.autoRotateSpeed * t : R / 60 / 60 * this.autoRotateSpeed;
@@ -287,20 +287,20 @@ class mt extends gt {
287
287
  this._sphericalDelta.phi -= t;
288
288
  }
289
289
  _panLeft(t, i) {
290
- S.setFromMatrixColumn(i, 0), S.multiplyScalar(-t), this._panOffset.add(S);
290
+ P.setFromMatrixColumn(i, 0), P.multiplyScalar(-t), this._panOffset.add(P);
291
291
  }
292
292
  _panUp(t, i) {
293
- this.screenSpacePanning === !0 ? S.setFromMatrixColumn(i, 1) : (S.setFromMatrixColumn(i, 0), S.crossVectors(this.object.up, S)), S.multiplyScalar(t), this._panOffset.add(S);
293
+ this.screenSpacePanning === !0 ? P.setFromMatrixColumn(i, 1) : (P.setFromMatrixColumn(i, 0), P.crossVectors(this.object.up, P)), P.multiplyScalar(t), this._panOffset.add(P);
294
294
  }
295
295
  // deltaX and deltaY are in pixels; right and down are positive
296
296
  _pan(t, i) {
297
- const o = this.domElement;
297
+ const s = this.domElement;
298
298
  if (this.object.isPerspectiveCamera) {
299
299
  const r = this.object.position;
300
- S.copy(r).sub(this.target);
301
- let c = S.length();
302
- c *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * t * c / o.clientHeight, this.object.matrix), this._panUp(2 * i * c / o.clientHeight, this.object.matrix);
303
- } else this.object.isOrthographicCamera ? (this._panLeft(t * (this.object.right - this.object.left) / this.object.zoom / o.clientWidth, this.object.matrix), this._panUp(i * (this.object.top - this.object.bottom) / this.object.zoom / o.clientHeight, this.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), this.enablePan = !1);
300
+ P.copy(r).sub(this.target);
301
+ let a = P.length();
302
+ a *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * t * a / s.clientHeight, this.object.matrix), this._panUp(2 * i * a / s.clientHeight, this.object.matrix);
303
+ } else this.object.isOrthographicCamera ? (this._panLeft(t * (this.object.right - this.object.left) / this.object.zoom / s.clientWidth, this.object.matrix), this._panUp(i * (this.object.top - this.object.bottom) / this.object.zoom / s.clientHeight, this.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), this.enablePan = !1);
304
304
  }
305
305
  _dollyOut(t) {
306
306
  this.object.isPerspectiveCamera || this.object.isOrthographicCamera ? this._scale /= t : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), this.enableZoom = !1);
@@ -312,8 +312,8 @@ class mt extends gt {
312
312
  if (!this.zoomToCursor)
313
313
  return;
314
314
  this._performCursorZoom = !0;
315
- const o = this.domElement.getBoundingClientRect(), r = t - o.left, c = i - o.top, a = o.width, f = o.height;
316
- this._mouse.x = r / a * 2 - 1, this._mouse.y = -(c / f) * 2 + 1, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
315
+ const s = this.domElement.getBoundingClientRect(), r = t - s.left, a = i - s.top, n = s.width, c = s.height;
316
+ this._mouse.x = r / n * 2 - 1, this._mouse.y = -(a / c) * 2 + 1, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
317
317
  }
318
318
  _clampDistance(t) {
319
319
  return Math.max(this.minDistance, Math.min(this.maxDistance, t));
@@ -366,21 +366,21 @@ class mt extends gt {
366
366
  if (this._pointers.length === 1)
367
367
  this._rotateStart.set(t.pageX, t.pageY);
368
368
  else {
369
- const i = this._getSecondPointerPosition(t), o = 0.5 * (t.pageX + i.x), r = 0.5 * (t.pageY + i.y);
370
- this._rotateStart.set(o, r);
369
+ const i = this._getSecondPointerPosition(t), s = 0.5 * (t.pageX + i.x), r = 0.5 * (t.pageY + i.y);
370
+ this._rotateStart.set(s, r);
371
371
  }
372
372
  }
373
373
  _handleTouchStartPan(t) {
374
374
  if (this._pointers.length === 1)
375
375
  this._panStart.set(t.pageX, t.pageY);
376
376
  else {
377
- const i = this._getSecondPointerPosition(t), o = 0.5 * (t.pageX + i.x), r = 0.5 * (t.pageY + i.y);
378
- this._panStart.set(o, r);
377
+ const i = this._getSecondPointerPosition(t), s = 0.5 * (t.pageX + i.x), r = 0.5 * (t.pageY + i.y);
378
+ this._panStart.set(s, r);
379
379
  }
380
380
  }
381
381
  _handleTouchStartDolly(t) {
382
- const i = this._getSecondPointerPosition(t), o = t.pageX - i.x, r = t.pageY - i.y, c = Math.sqrt(o * o + r * r);
383
- this._dollyStart.set(0, c);
382
+ const i = this._getSecondPointerPosition(t), s = t.pageX - i.x, r = t.pageY - i.y, a = Math.sqrt(s * s + r * r);
383
+ this._dollyStart.set(0, a);
384
384
  }
385
385
  _handleTouchStartDollyPan(t) {
386
386
  this.enableZoom && this._handleTouchStartDolly(t), this.enablePan && this._handleTouchStartPan(t);
@@ -392,8 +392,8 @@ class mt extends gt {
392
392
  if (this._pointers.length == 1)
393
393
  this._rotateEnd.set(t.pageX, t.pageY);
394
394
  else {
395
- const o = this._getSecondPointerPosition(t), r = 0.5 * (t.pageX + o.x), c = 0.5 * (t.pageY + o.y);
396
- this._rotateEnd.set(r, c);
395
+ const s = this._getSecondPointerPosition(t), r = 0.5 * (t.pageX + s.x), a = 0.5 * (t.pageY + s.y);
396
+ this._rotateEnd.set(r, a);
397
397
  }
398
398
  this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
399
399
  const i = this.domElement;
@@ -403,16 +403,16 @@ class mt extends gt {
403
403
  if (this._pointers.length === 1)
404
404
  this._panEnd.set(t.pageX, t.pageY);
405
405
  else {
406
- const i = this._getSecondPointerPosition(t), o = 0.5 * (t.pageX + i.x), r = 0.5 * (t.pageY + i.y);
407
- this._panEnd.set(o, r);
406
+ const i = this._getSecondPointerPosition(t), s = 0.5 * (t.pageX + i.x), r = 0.5 * (t.pageY + i.y);
407
+ this._panEnd.set(s, r);
408
408
  }
409
409
  this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed), this._pan(this._panDelta.x, this._panDelta.y), this._panStart.copy(this._panEnd);
410
410
  }
411
411
  _handleTouchMoveDolly(t) {
412
- const i = this._getSecondPointerPosition(t), o = t.pageX - i.x, r = t.pageY - i.y, c = Math.sqrt(o * o + r * r);
413
- this._dollyEnd.set(0, c), this._dollyDelta.set(0, Math.pow(this._dollyEnd.y / this._dollyStart.y, this.zoomSpeed)), this._dollyOut(this._dollyDelta.y), this._dollyStart.copy(this._dollyEnd);
414
- const a = (t.pageX + i.x) * 0.5, f = (t.pageY + i.y) * 0.5;
415
- this._updateZoomParameters(a, f);
412
+ const i = this._getSecondPointerPosition(t), s = t.pageX - i.x, r = t.pageY - i.y, a = Math.sqrt(s * s + r * r);
413
+ this._dollyEnd.set(0, a), this._dollyDelta.set(0, Math.pow(this._dollyEnd.y / this._dollyStart.y, this.zoomSpeed)), this._dollyOut(this._dollyDelta.y), this._dollyStart.copy(this._dollyEnd);
414
+ const n = (t.pageX + i.x) * 0.5, c = (t.pageY + i.y) * 0.5;
415
+ this._updateZoomParameters(n, c);
416
416
  }
417
417
  _handleTouchMoveDollyPan(t) {
418
418
  this.enableZoom && this._handleTouchMoveDolly(t), this.enablePan && this._handleTouchMovePan(t);
@@ -447,32 +447,32 @@ class mt extends gt {
447
447
  }
448
448
  //
449
449
  _customWheelEvent(t) {
450
- const i = t.deltaMode, o = {
450
+ const i = t.deltaMode, s = {
451
451
  clientX: t.clientX,
452
452
  clientY: t.clientY,
453
453
  deltaY: t.deltaY
454
454
  };
455
455
  switch (i) {
456
456
  case 1:
457
- o.deltaY *= 16;
457
+ s.deltaY *= 16;
458
458
  break;
459
459
  case 2:
460
- o.deltaY *= 100;
460
+ s.deltaY *= 100;
461
461
  break;
462
462
  }
463
- return t.ctrlKey && !this._controlActive && (o.deltaY *= 10), o;
463
+ return t.ctrlKey && !this._controlActive && (s.deltaY *= 10), s;
464
464
  }
465
465
  }
466
- function It(e) {
466
+ function Gt(e) {
467
467
  this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(e.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.domElement.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(e) && (this._addPointer(e), e.pointerType === "touch" ? this._onTouchStart(e) : this._onMouseDown(e)));
468
468
  }
469
- function Nt(e) {
469
+ function Ut(e) {
470
470
  this.enabled !== !1 && (e.pointerType === "touch" ? this._onTouchMove(e) : this._onMouseMove(e));
471
471
  }
472
- function Ht(e) {
472
+ function Yt(e) {
473
473
  switch (this._removePointer(e), this._pointers.length) {
474
474
  case 0:
475
- this.domElement.releasePointerCapture(e.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(ut), this.state = d.NONE;
475
+ this.domElement.releasePointerCapture(e.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(yt), this.state = _.NONE;
476
476
  break;
477
477
  case 1:
478
478
  const t = this._pointers[0], i = this._pointerPositions[t];
@@ -480,7 +480,7 @@ function Ht(e) {
480
480
  break;
481
481
  }
482
482
  }
483
- function jt(e) {
483
+ function zt(e) {
484
484
  let t;
485
485
  switch (e.button) {
486
486
  case 0:
@@ -498,157 +498,157 @@ function jt(e) {
498
498
  switch (t) {
499
499
  case z.DOLLY:
500
500
  if (this.enableZoom === !1) return;
501
- this._handleMouseDownDolly(e), this.state = d.DOLLY;
501
+ this._handleMouseDownDolly(e), this.state = _.DOLLY;
502
502
  break;
503
503
  case z.ROTATE:
504
504
  if (e.ctrlKey || e.metaKey || e.shiftKey) {
505
505
  if (this.enablePan === !1) return;
506
- this._handleMouseDownPan(e), this.state = d.PAN;
506
+ this._handleMouseDownPan(e), this.state = _.PAN;
507
507
  } else {
508
508
  if (this.enableRotate === !1) return;
509
- this._handleMouseDownRotate(e), this.state = d.ROTATE;
509
+ this._handleMouseDownRotate(e), this.state = _.ROTATE;
510
510
  }
511
511
  break;
512
512
  case z.PAN:
513
513
  if (e.ctrlKey || e.metaKey || e.shiftKey) {
514
514
  if (this.enableRotate === !1) return;
515
- this._handleMouseDownRotate(e), this.state = d.ROTATE;
515
+ this._handleMouseDownRotate(e), this.state = _.ROTATE;
516
516
  } else {
517
517
  if (this.enablePan === !1) return;
518
- this._handleMouseDownPan(e), this.state = d.PAN;
518
+ this._handleMouseDownPan(e), this.state = _.PAN;
519
519
  }
520
520
  break;
521
521
  default:
522
- this.state = d.NONE;
522
+ this.state = _.NONE;
523
523
  }
524
- this.state !== d.NONE && this.dispatchEvent(it);
524
+ this.state !== _.NONE && this.dispatchEvent(at);
525
525
  }
526
- function Ut(e) {
526
+ function Ft(e) {
527
527
  switch (this.state) {
528
- case d.ROTATE:
528
+ case _.ROTATE:
529
529
  if (this.enableRotate === !1) return;
530
530
  this._handleMouseMoveRotate(e);
531
531
  break;
532
- case d.DOLLY:
532
+ case _.DOLLY:
533
533
  if (this.enableZoom === !1) return;
534
534
  this._handleMouseMoveDolly(e);
535
535
  break;
536
- case d.PAN:
536
+ case _.PAN:
537
537
  if (this.enablePan === !1) return;
538
538
  this._handleMouseMovePan(e);
539
539
  break;
540
540
  }
541
541
  }
542
- function Yt(e) {
543
- this.enabled === !1 || this.enableZoom === !1 || this.state !== d.NONE || (e.preventDefault(), this.dispatchEvent(it), this._handleMouseWheel(this._customWheelEvent(e)), this.dispatchEvent(ut));
542
+ function Bt(e) {
543
+ this.enabled === !1 || this.enableZoom === !1 || this.state !== _.NONE || (e.preventDefault(), this.dispatchEvent(at), this._handleMouseWheel(this._customWheelEvent(e)), this.dispatchEvent(yt));
544
544
  }
545
- function zt(e) {
545
+ function Zt(e) {
546
546
  this.enabled !== !1 && this._handleKeyDown(e);
547
547
  }
548
- function Gt(e) {
548
+ function Wt(e) {
549
549
  switch (this._trackPointer(e), this._pointers.length) {
550
550
  case 1:
551
551
  switch (this.touches.ONE) {
552
- case G.ROTATE:
552
+ case F.ROTATE:
553
553
  if (this.enableRotate === !1) return;
554
- this._handleTouchStartRotate(e), this.state = d.TOUCH_ROTATE;
554
+ this._handleTouchStartRotate(e), this.state = _.TOUCH_ROTATE;
555
555
  break;
556
- case G.PAN:
556
+ case F.PAN:
557
557
  if (this.enablePan === !1) return;
558
- this._handleTouchStartPan(e), this.state = d.TOUCH_PAN;
558
+ this._handleTouchStartPan(e), this.state = _.TOUCH_PAN;
559
559
  break;
560
560
  default:
561
- this.state = d.NONE;
561
+ this.state = _.NONE;
562
562
  }
563
563
  break;
564
564
  case 2:
565
565
  switch (this.touches.TWO) {
566
- case G.DOLLY_PAN:
566
+ case F.DOLLY_PAN:
567
567
  if (this.enableZoom === !1 && this.enablePan === !1) return;
568
- this._handleTouchStartDollyPan(e), this.state = d.TOUCH_DOLLY_PAN;
568
+ this._handleTouchStartDollyPan(e), this.state = _.TOUCH_DOLLY_PAN;
569
569
  break;
570
- case G.DOLLY_ROTATE:
570
+ case F.DOLLY_ROTATE:
571
571
  if (this.enableZoom === !1 && this.enableRotate === !1) return;
572
- this._handleTouchStartDollyRotate(e), this.state = d.TOUCH_DOLLY_ROTATE;
572
+ this._handleTouchStartDollyRotate(e), this.state = _.TOUCH_DOLLY_ROTATE;
573
573
  break;
574
574
  default:
575
- this.state = d.NONE;
575
+ this.state = _.NONE;
576
576
  }
577
577
  break;
578
578
  default:
579
- this.state = d.NONE;
579
+ this.state = _.NONE;
580
580
  }
581
- this.state !== d.NONE && this.dispatchEvent(it);
581
+ this.state !== _.NONE && this.dispatchEvent(at);
582
582
  }
583
- function Ft(e) {
583
+ function Kt(e) {
584
584
  switch (this._trackPointer(e), this.state) {
585
- case d.TOUCH_ROTATE:
585
+ case _.TOUCH_ROTATE:
586
586
  if (this.enableRotate === !1) return;
587
587
  this._handleTouchMoveRotate(e), this.update();
588
588
  break;
589
- case d.TOUCH_PAN:
589
+ case _.TOUCH_PAN:
590
590
  if (this.enablePan === !1) return;
591
591
  this._handleTouchMovePan(e), this.update();
592
592
  break;
593
- case d.TOUCH_DOLLY_PAN:
593
+ case _.TOUCH_DOLLY_PAN:
594
594
  if (this.enableZoom === !1 && this.enablePan === !1) return;
595
595
  this._handleTouchMoveDollyPan(e), this.update();
596
596
  break;
597
- case d.TOUCH_DOLLY_ROTATE:
597
+ case _.TOUCH_DOLLY_ROTATE:
598
598
  if (this.enableZoom === !1 && this.enableRotate === !1) return;
599
599
  this._handleTouchMoveDollyRotate(e), this.update();
600
600
  break;
601
601
  default:
602
- this.state = d.NONE;
602
+ this.state = _.NONE;
603
603
  }
604
604
  }
605
- function Bt(e) {
605
+ function Xt(e) {
606
606
  this.enabled !== !1 && e.preventDefault();
607
607
  }
608
- function Zt(e) {
608
+ function Vt(e) {
609
609
  e.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
610
610
  }
611
- function Wt(e) {
611
+ function qt(e) {
612
612
  e.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
613
613
  }
614
- class Kt extends mt {
614
+ class $t extends gt {
615
615
  constructor(t, i) {
616
- super(t, i), this.screenSpacePanning = !1, this.mouseButtons = { LEFT: z.PAN, MIDDLE: z.DOLLY, RIGHT: z.ROTATE }, this.touches = { ONE: G.PAN, TWO: G.DOLLY_ROTATE };
616
+ super(t, i), this.screenSpacePanning = !1, this.mouseButtons = { LEFT: z.PAN, MIDDLE: z.DOLLY, RIGHT: z.ROTATE }, this.touches = { ONE: F.PAN, TWO: F.DOLLY_ROTATE };
617
617
  }
618
618
  }
619
- function ne(e) {
620
- return new Dt(e);
619
+ function se(e) {
620
+ return new Mt(e);
621
621
  }
622
- function ae(e = 150, ...t) {
623
- return new St(e, e / 10, ...t);
622
+ function oe(e = 150, ...t) {
623
+ return new At(e, e / 10, ...t);
624
624
  }
625
- function re(e) {
626
- return new Pt(e, 16776960);
625
+ function ne(e) {
626
+ return new Rt(e, 16776960);
627
627
  }
628
- function he(e, t) {
629
- return new mt(e, t);
628
+ function ae(e, t) {
629
+ return new gt(e, t);
630
630
  }
631
- function le(e, t) {
632
- return new Kt(e, t);
631
+ function re(e, t) {
632
+ return new $t(e, t);
633
633
  }
634
- function ce() {
635
- const e = new Tt(), t = new L(0, 0);
634
+ function le() {
635
+ const e = new xt(), t = new L(0, 0);
636
636
  return {
637
637
  raycaster: e,
638
638
  pointer: t
639
639
  };
640
640
  }
641
- function pe(e = 10) {
642
- return new Mt(e);
641
+ function he(e = 10) {
642
+ return new Ot(e);
643
643
  }
644
- function de(e = new x(1, 1, 1), t = new x(10, 10, 10), i = 5, o = 16776960) {
645
- return e.normalize(), new Rt(e, t, i, o);
644
+ function ce(e = new x(1, 1, 1), t = new x(10, 10, 10), i = 5, s = 16776960) {
645
+ return e.normalize(), new vt(e, t, i, s);
646
646
  }
647
- function ue() {
647
+ function pe() {
648
648
  const e = new K();
649
649
  return e.dom.style.cssText = "position:absolute;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000", e;
650
650
  }
651
- class Xt extends xt {
651
+ class Qt extends Lt {
652
652
  /**
653
653
  * Constructs a new RGBE loader.
654
654
  *
@@ -664,27 +664,27 @@ class Xt extends xt {
664
664
  * @return {DataTextureLoader~TexData} An object representing the parsed texture data.
665
665
  */
666
666
  parse(t) {
667
- const a = function(l, u) {
668
- switch (l) {
667
+ const n = function(p, f) {
668
+ switch (p) {
669
669
  case 1:
670
- throw new Error("THREE.RGBELoader: Read Error: " + (u || ""));
670
+ throw new Error("THREE.RGBELoader: Read Error: " + (f || ""));
671
671
  case 2:
672
- throw new Error("THREE.RGBELoader: Write Error: " + (u || ""));
672
+ throw new Error("THREE.RGBELoader: Write Error: " + (f || ""));
673
673
  case 3:
674
- throw new Error("THREE.RGBELoader: Bad File Format: " + (u || ""));
674
+ throw new Error("THREE.RGBELoader: Bad File Format: " + (f || ""));
675
675
  default:
676
676
  case 4:
677
- throw new Error("THREE.RGBELoader: Memory Error: " + (u || ""));
677
+ throw new Error("THREE.RGBELoader: Memory Error: " + (f || ""));
678
678
  }
679
679
  }, m = `
680
- `, h = function(l, u, y) {
681
- u = u || 1024;
682
- let w = l.pos, E = -1, p = 0, D = "", _ = String.fromCharCode.apply(null, new Uint16Array(l.subarray(w, w + 128)));
683
- for (; 0 > (E = _.indexOf(m)) && p < u && w < l.byteLength; )
684
- D += _, p += _.length, w += 128, _ += String.fromCharCode.apply(null, new Uint16Array(l.subarray(w, w + 128)));
685
- return -1 < E ? (l.pos += p + E + 1, D + _.slice(0, E)) : !1;
686
- }, O = function(l) {
687
- const u = /^#\?(\S+)/, y = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/, g = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/, w = /^\s*FORMAT=(\S+)\s*$/, E = /^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/, p = {
680
+ `, h = function(p, f, b) {
681
+ f = f || 1024;
682
+ let D = p.pos, w = -1, u = 0, S = "", y = String.fromCharCode.apply(null, new Uint16Array(p.subarray(D, D + 128)));
683
+ for (; 0 > (w = y.indexOf(m)) && u < f && D < p.byteLength; )
684
+ S += y, u += y.length, D += 128, y += String.fromCharCode.apply(null, new Uint16Array(p.subarray(D, D + 128)));
685
+ return -1 < w ? (p.pos += u + w + 1, S + y.slice(0, w)) : !1;
686
+ }, v = function(p) {
687
+ const f = /^#\?(\S+)/, b = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/, E = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/, D = /^\s*FORMAT=(\S+)\s*$/, w = /^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/, u = {
688
688
  valid: 0,
689
689
  /* indicate which fields are valid */
690
690
  string: "",
@@ -703,77 +703,77 @@ class Xt extends xt {
703
703
  height: 0
704
704
  /* image dimensions, width/height */
705
705
  };
706
- let D, _;
707
- for ((l.pos >= l.byteLength || !(D = h(l))) && a(1, "no header found"), (_ = D.match(u)) || a(3, "bad initial token"), p.valid |= 1, p.programtype = _[1], p.string += D + `
708
- `; D = h(l), D !== !1; ) {
709
- if (p.string += D + `
710
- `, D.charAt(0) === "#") {
711
- p.comments += D + `
706
+ let S, y;
707
+ for ((p.pos >= p.byteLength || !(S = h(p))) && n(1, "no header found"), (y = S.match(f)) || n(3, "bad initial token"), u.valid |= 1, u.programtype = y[1], u.string += S + `
708
+ `; S = h(p), S !== !1; ) {
709
+ if (u.string += S + `
710
+ `, S.charAt(0) === "#") {
711
+ u.comments += S + `
712
712
  `;
713
713
  continue;
714
714
  }
715
- if ((_ = D.match(y)) && (p.gamma = parseFloat(_[1])), (_ = D.match(g)) && (p.exposure = parseFloat(_[1])), (_ = D.match(w)) && (p.valid |= 2, p.format = _[1]), (_ = D.match(E)) && (p.valid |= 4, p.height = parseInt(_[1], 10), p.width = parseInt(_[2], 10)), p.valid & 2 && p.valid & 4) break;
715
+ if ((y = S.match(b)) && (u.gamma = parseFloat(y[1])), (y = S.match(E)) && (u.exposure = parseFloat(y[1])), (y = S.match(D)) && (u.valid |= 2, u.format = y[1]), (y = S.match(w)) && (u.valid |= 4, u.height = parseInt(y[1], 10), u.width = parseInt(y[2], 10)), u.valid & 2 && u.valid & 4) break;
716
716
  }
717
- return p.valid & 2 || a(3, "missing format specifier"), p.valid & 4 || a(3, "missing image size specifier"), p;
718
- }, v = function(l, u, y) {
719
- const g = u;
717
+ return u.valid & 2 || n(3, "missing format specifier"), u.valid & 4 || n(3, "missing image size specifier"), u;
718
+ }, k = function(p, f, b) {
719
+ const E = f;
720
720
  if (
721
721
  // run length encoding is not allowed so read flat
722
- g < 8 || g > 32767 || // this file is not run length encoded
723
- l[0] !== 2 || l[1] !== 2 || l[2] & 128
722
+ E < 8 || E > 32767 || // this file is not run length encoded
723
+ p[0] !== 2 || p[1] !== 2 || p[2] & 128
724
724
  )
725
- return new Uint8Array(l);
726
- g !== (l[2] << 8 | l[3]) && a(3, "wrong scanline width");
727
- const w = new Uint8Array(4 * u * y);
728
- w.length || a(4, "unable to allocate buffer space");
729
- let E = 0, p = 0;
730
- const D = 4 * g, _ = new Uint8Array(4), Z = new Uint8Array(D);
731
- let st = y;
732
- for (; st > 0 && p < l.byteLength; ) {
733
- p + 4 > l.byteLength && a(1), _[0] = l[p++], _[1] = l[p++], _[2] = l[p++], _[3] = l[p++], (_[0] != 2 || _[1] != 2 || (_[2] << 8 | _[3]) != g) && a(3, "bad rgbe scanline format");
734
- let W = 0, j;
735
- for (; W < D && p < l.byteLength; ) {
736
- j = l[p++];
737
- const U = j > 128;
738
- if (U && (j -= 128), (j === 0 || W + j > D) && a(3, "bad scanline data"), U) {
739
- const Y = l[p++];
740
- for (let ot = 0; ot < j; ot++)
725
+ return new Uint8Array(p);
726
+ E !== (p[2] << 8 | p[3]) && n(3, "wrong scanline width");
727
+ const D = new Uint8Array(4 * f * b);
728
+ D.length || n(4, "unable to allocate buffer space");
729
+ let w = 0, u = 0;
730
+ const S = 4 * E, y = new Uint8Array(4), Z = new Uint8Array(S);
731
+ let rt = b;
732
+ for (; rt > 0 && u < p.byteLength; ) {
733
+ u + 4 > p.byteLength && n(1), y[0] = p[u++], y[1] = p[u++], y[2] = p[u++], y[3] = p[u++], (y[0] != 2 || y[1] != 2 || (y[2] << 8 | y[3]) != E) && n(3, "bad rgbe scanline format");
734
+ let W = 0, G;
735
+ for (; W < S && u < p.byteLength; ) {
736
+ G = p[u++];
737
+ const U = G > 128;
738
+ if (U && (G -= 128), (G === 0 || W + G > S) && n(3, "bad scanline data"), U) {
739
+ const Y = p[u++];
740
+ for (let lt = 0; lt < G; lt++)
741
741
  Z[W++] = Y;
742
742
  } else
743
- Z.set(l.subarray(p, p + j), W), W += j, p += j;
743
+ Z.set(p.subarray(u, u + G), W), W += G, u += G;
744
744
  }
745
- const ft = g;
746
- for (let U = 0; U < ft; U++) {
745
+ const Et = E;
746
+ for (let U = 0; U < Et; U++) {
747
747
  let Y = 0;
748
- w[E] = Z[U + Y], Y += g, w[E + 1] = Z[U + Y], Y += g, w[E + 2] = Z[U + Y], Y += g, w[E + 3] = Z[U + Y], E += 4;
748
+ D[w] = Z[U + Y], Y += E, D[w + 1] = Z[U + Y], Y += E, D[w + 2] = Z[U + Y], Y += E, D[w + 3] = Z[U + Y], w += 4;
749
749
  }
750
- st--;
750
+ rt--;
751
751
  }
752
- return w;
753
- }, C = function(l, u, y, g) {
754
- const w = l[u + 3], E = Math.pow(2, w - 128) / 255;
755
- y[g + 0] = l[u + 0] * E, y[g + 1] = l[u + 1] * E, y[g + 2] = l[u + 2] * E, y[g + 3] = 1;
756
- }, k = function(l, u, y, g) {
757
- const w = l[u + 3], E = Math.pow(2, w - 128) / 255;
758
- y[g + 0] = V.toHalfFloat(Math.min(l[u + 0] * E, 65504)), y[g + 1] = V.toHalfFloat(Math.min(l[u + 1] * E, 65504)), y[g + 2] = V.toHalfFloat(Math.min(l[u + 2] * E, 65504)), y[g + 3] = V.toHalfFloat(1);
759
- }, n = new Uint8Array(t);
760
- n.pos = 0;
761
- const s = O(n), T = s.width, B = s.height, M = v(n.subarray(n.pos), T, B);
762
- let A, I, N;
752
+ return D;
753
+ }, C = function(p, f, b, E) {
754
+ const D = p[f + 3], w = Math.pow(2, D - 128) / 255;
755
+ b[E + 0] = p[f + 0] * w, b[E + 1] = p[f + 1] * w, b[E + 2] = p[f + 2] * w, b[E + 3] = 1;
756
+ }, I = function(p, f, b, E) {
757
+ const D = p[f + 3], w = Math.pow(2, D - 128) / 255;
758
+ b[E + 0] = V.toHalfFloat(Math.min(p[f + 0] * w, 65504)), b[E + 1] = V.toHalfFloat(Math.min(p[f + 1] * w, 65504)), b[E + 2] = V.toHalfFloat(Math.min(p[f + 2] * w, 65504)), b[E + 3] = V.toHalfFloat(1);
759
+ }, l = new Uint8Array(t);
760
+ l.pos = 0;
761
+ const o = v(l), T = o.width, B = o.height, A = k(l.subarray(l.pos), T, B);
762
+ let O, j, N;
763
763
  switch (this.type) {
764
- case $:
765
- N = M.length / 4;
766
- const l = new Float32Array(N * 4);
767
- for (let y = 0; y < N; y++)
768
- C(M, y * 4, l, y * 4);
769
- A = l, I = $;
764
+ case et:
765
+ N = A.length / 4;
766
+ const p = new Float32Array(N * 4);
767
+ for (let b = 0; b < N; b++)
768
+ C(A, b * 4, p, b * 4);
769
+ O = p, j = et;
770
770
  break;
771
771
  case X:
772
- N = M.length / 4;
773
- const u = new Uint16Array(N * 4);
774
- for (let y = 0; y < N; y++)
775
- k(M, y * 4, u, y * 4);
776
- A = u, I = X;
772
+ N = A.length / 4;
773
+ const f = new Uint16Array(N * 4);
774
+ for (let b = 0; b < N; b++)
775
+ I(A, b * 4, f, b * 4);
776
+ O = f, j = X;
777
777
  break;
778
778
  default:
779
779
  throw new Error("THREE.RGBELoader: Unsupported type: " + this.type);
@@ -781,11 +781,11 @@ class Xt extends xt {
781
781
  return {
782
782
  width: T,
783
783
  height: B,
784
- data: A,
785
- header: s.string,
786
- gamma: s.gamma,
787
- exposure: s.exposure,
788
- type: I
784
+ data: O,
785
+ header: o.string,
786
+ gamma: o.gamma,
787
+ exposure: o.exposure,
788
+ type: j
789
789
  };
790
790
  }
791
791
  /**
@@ -797,53 +797,89 @@ class Xt extends xt {
797
797
  setDataType(t) {
798
798
  return this.type = t, this;
799
799
  }
800
- load(t, i, o, r) {
801
- function c(a, f) {
802
- switch (a.type) {
803
- case $:
800
+ load(t, i, s, r) {
801
+ function a(n, c) {
802
+ switch (n.type) {
803
+ case et:
804
804
  case X:
805
- a.colorSpace = At, a.minFilter = at, a.magFilter = at, a.generateMipmaps = !1, a.flipY = !0;
805
+ n.colorSpace = kt, n.minFilter = ct, n.magFilter = ct, n.generateMipmaps = !1, n.flipY = !0;
806
806
  break;
807
807
  }
808
- i && i(a, f);
808
+ i && i(n, c);
809
809
  }
810
- return super.load(t, c, o, r);
810
+ return super.load(t, a, s, r);
811
811
  }
812
812
  }
813
- const Vt = (e) => {
813
+ const Jt = (e) => {
814
814
  e.geometry && e.geometry.dispose(), e.material && (Array.isArray(e.material) ? e.material.forEach((t) => {
815
- pt(t);
816
- }) : pt(e.material)), e.children && e.children.forEach((t) => Vt(t));
815
+ _t(t);
816
+ }) : _t(e.material)), e.children && e.children.forEach((t) => Jt(t));
817
817
  };
818
- function pt(e) {
818
+ function _t(e) {
819
819
  for (const t in e)
820
820
  e[t] && e[t].isTexture && e[t].dispose();
821
821
  e.dispose();
822
822
  }
823
- const J = {}, _t = new Xt();
824
- async function me(e, t) {
823
+ const st = {}, bt = new Qt();
824
+ async function de(e, t) {
825
825
  if (t) {
826
- if (J[t]) {
827
- const i = J[t];
826
+ if (st[t]) {
827
+ const i = st[t];
828
828
  e.environment = i;
829
829
  return;
830
830
  }
831
- return new Promise((i, o) => {
832
- _t.load(t, i, void 0, o);
831
+ return new Promise((i, s) => {
832
+ bt.load(t, i, void 0, s);
833
833
  }).then((i) => {
834
- i.mapping = Ot, e.environment = i, J[t] = i;
834
+ i.mapping = Ct, e.environment = i, st[t] = i;
835
835
  }).catch((i) => {
836
836
  console.log(" =====> e:", i);
837
837
  });
838
838
  }
839
839
  }
840
- async function _e(e) {
840
+ async function ue(e) {
841
841
  return new Promise((t, i) => {
842
- _t.load(e, t, void 0, i);
842
+ bt.load(e, t, void 0, i);
843
843
  });
844
844
  }
845
- const tt = {};
846
- function qt(e) {
845
+ const ot = {};
846
+ async function me(e, t = 50) {
847
+ const i = {
848
+ type: e.type,
849
+ name: e.name,
850
+ position: e.position.toArray(),
851
+ rotation: e.rotation.toArray(),
852
+ scale: e.scale.toArray(),
853
+ visible: e.visible,
854
+ children: [],
855
+ geometry: null,
856
+ material: null,
857
+ userData: e.userData
858
+ };
859
+ e.isMesh && (i.geometry = $(e.geometry), i.material = J(e.material));
860
+ const s = [{ object: e, parentData: i }];
861
+ let r = 0;
862
+ for (; s.length > 0; ) {
863
+ const { object: a, parentData: n } = s.pop();
864
+ for (const c of a.children) {
865
+ const d = {
866
+ type: c.type,
867
+ name: c.name,
868
+ position: c.position.toArray(),
869
+ rotation: c.rotation.toArray(),
870
+ scale: c.scale.toArray(),
871
+ visible: c.visible,
872
+ children: [],
873
+ geometry: null,
874
+ material: null,
875
+ userData: c.userData
876
+ };
877
+ c.isMesh && (d.geometry = $(c.geometry), d.material = J(c.material)), n.children.push(d), s.push({ object: c, parentData: d }), r++, r % t === 0 && await new Promise((g) => requestAnimationFrame(g));
878
+ }
879
+ }
880
+ return i;
881
+ }
882
+ function _e(e) {
847
883
  const t = {
848
884
  type: e.type,
849
885
  name: e.name,
@@ -856,36 +892,114 @@ function qt(e) {
856
892
  material: null,
857
893
  userData: e.userData
858
894
  };
859
- e.isMesh && (t.geometry = Qt(e.geometry), t.material = te(e.material));
860
- for (const i of e.children)
861
- t.children.push(qt(i));
895
+ e.isMesh && (t.geometry = $(e.geometry), t.material = J(e.material));
896
+ const i = [{ object: e, parentData: t }];
897
+ for (; i.length > 0; ) {
898
+ const { object: s, parentData: r } = i.pop();
899
+ for (const a of s.children) {
900
+ const n = {
901
+ type: a.type,
902
+ name: a.name,
903
+ position: a.position.toArray(),
904
+ rotation: a.rotation.toArray(),
905
+ scale: a.scale.toArray(),
906
+ visible: a.visible,
907
+ children: [],
908
+ geometry: null,
909
+ material: null,
910
+ userData: a.userData
911
+ };
912
+ a.isMesh && (n.geometry = $(a.geometry), n.material = J(a.material)), r.children.push(n), i.push({ object: a, parentData: n });
913
+ }
914
+ }
862
915
  return t;
863
916
  }
864
- function $t(e) {
865
- let t;
917
+ async function fe(e, t = 50) {
918
+ const i = [];
919
+ let s;
866
920
  switch (e.type) {
867
921
  case "Mesh":
868
- const i = Jt(e.geometry), o = ee(e.material);
869
- t = new F.Mesh(i, o);
922
+ const a = Q(e.geometry), n = tt(e.material);
923
+ s = new M.Mesh(a, n);
870
924
  break;
871
925
  case "Group":
872
- t = new F.Group();
926
+ s = new M.Group();
873
927
  break;
874
928
  case "Object3D":
875
- t = new F.Object3D();
929
+ s = new M.Object3D();
876
930
  break;
877
931
  default:
878
932
  return console.warn(`Unsupported object type: ${e.type}`), null;
879
933
  }
880
- t.name = e.name, t.position.fromArray(e.position), t.rotation.fromArray(e.rotation), t.scale.fromArray(e.scale), t.visible = e.visible, t.userData = e.userData;
881
- for (const i of e.children) {
882
- const o = $t(i);
883
- o && t.add(o);
934
+ s.name = e.name, s.position.fromArray(e.position), s.rotation.fromArray(e.rotation), s.scale.fromArray(e.scale), s.visible = e.visible, s.userData = e.userData, i.push({ data: e, object: s });
935
+ let r = 0;
936
+ for (; i.length > 0; ) {
937
+ const { data: a, object: n } = i.pop();
938
+ for (const c of [...a.children].reverse()) {
939
+ let d;
940
+ switch (c.type) {
941
+ case "Mesh":
942
+ const g = Q(c.geometry), m = tt(c.material);
943
+ d = new M.Mesh(g, m);
944
+ break;
945
+ case "Group":
946
+ d = new M.Group();
947
+ break;
948
+ case "Object3D":
949
+ d = new M.Object3D();
950
+ break;
951
+ default:
952
+ console.warn(`Unsupported object type: ${c.type}`);
953
+ continue;
954
+ }
955
+ d && (d.name = c.name, d.position.fromArray(c.position), d.rotation.fromArray(c.rotation), d.scale.fromArray(c.scale), d.visible = c.visible, d.userData = c.userData, n.add(d), i.push({ data: c, object: d }), r++, r % t === 0 && await new Promise((g) => requestAnimationFrame(g)));
956
+ }
884
957
  }
885
- return t;
958
+ return s;
959
+ }
960
+ function ye(e) {
961
+ const t = [];
962
+ let i;
963
+ switch (e.type) {
964
+ case "Mesh":
965
+ const s = Q(e.geometry), r = tt(e.material);
966
+ i = new M.Mesh(s, r);
967
+ break;
968
+ case "Group":
969
+ i = new M.Group();
970
+ break;
971
+ case "Object3D":
972
+ i = new M.Object3D();
973
+ break;
974
+ default:
975
+ return console.warn(`Unsupported object type: ${e.type}`), null;
976
+ }
977
+ for (i.name = e.name, i.position.fromArray(e.position), i.rotation.fromArray(e.rotation), i.scale.fromArray(e.scale), i.visible = e.visible, i.userData = e.userData, t.push({ data: e, object: i }); t.length > 0; ) {
978
+ const { data: s, object: r } = t.pop();
979
+ for (const a of [...s.children].reverse()) {
980
+ let n;
981
+ switch (a.type) {
982
+ case "Mesh":
983
+ const c = Q(a.geometry), d = tt(a.material);
984
+ n = new M.Mesh(c, d);
985
+ break;
986
+ case "Group":
987
+ n = new M.Group();
988
+ break;
989
+ case "Object3D":
990
+ n = new M.Object3D();
991
+ break;
992
+ default:
993
+ console.warn(`Unsupported object type: ${a.type}`);
994
+ continue;
995
+ }
996
+ n && (n.name = a.name, n.position.fromArray(a.position), n.rotation.fromArray(a.rotation), n.scale.fromArray(a.scale), n.visible = a.visible, n.userData = a.userData, r.add(n), t.push({ data: a, object: n }));
997
+ }
998
+ }
999
+ return i;
886
1000
  }
887
- function Qt(e) {
888
- const t = [], { attributes: i, index: o, type: r } = e;
1001
+ function $(e) {
1002
+ const t = {}, { attributes: i, index: s, type: r } = e;
889
1003
  i.position && (t.position = {
890
1004
  type: "Float32Array",
891
1005
  array: Array.from(i.position.array),
@@ -899,27 +1013,29 @@ function Qt(e) {
899
1013
  array: Array.from(i.uv.array),
900
1014
  itemSize: 2
901
1015
  });
902
- const c = {
1016
+ const a = {
903
1017
  type: r,
904
1018
  attributes: t
905
1019
  };
906
- return o && o.array && (c.index = {
1020
+ return s && s.array && (a.index = {
907
1021
  type: "Uint32Array",
908
- array: Array.from(o.array),
1022
+ array: Array.from(s.array),
909
1023
  itemSize: 1
910
- }), c;
911
- }
912
- function Jt(e) {
913
- const { type: t, attributes: i, index: o } = e, r = new F.BufferGeometry();
914
- return Object.keys(i).forEach((c) => {
915
- const { type: a, array: f, itemSize: P } = i[c];
916
- r.setAttribute(
917
- c,
918
- new F.BufferAttribute(new Float32Array(f), P)
919
- );
920
- }), o && r.setIndex(o.array), r;
921
- }
922
- function te(e) {
1024
+ }), a;
1025
+ }
1026
+ function Q(e) {
1027
+ const { type: t, attributes: i, index: s } = e, r = new M.BufferGeometry();
1028
+ for (const a in i)
1029
+ if (i.hasOwnProperty(a)) {
1030
+ const { type: n, array: c, itemSize: d } = i[a];
1031
+ r.setAttribute(
1032
+ a,
1033
+ new M.BufferAttribute(new Float32Array(c), d)
1034
+ );
1035
+ }
1036
+ return s && r.setIndex(s.array), r;
1037
+ }
1038
+ function J(e) {
923
1039
  return {
924
1040
  type: e.type,
925
1041
  color: e.color.getHex(),
@@ -935,31 +1051,33 @@ function te(e) {
935
1051
  emissive: e.emissive.getHex()
936
1052
  };
937
1053
  }
938
- function ee(e) {
939
- if (tt[e.name]) return tt[e.name];
940
- const { type: t, ...i } = e, o = t || "MeshStandardMaterial", r = new F[o]({ ...i });
1054
+ function tt(e) {
1055
+ if (ot[e.name]) return ot[e.name];
1056
+ const { type: t, ...i } = e, s = t || "MeshStandardMaterial", r = new M[s]({ ...i });
941
1057
  if (e.map) {
942
- const c = new F.TextureLoader().load(e.map);
943
- r.map = c;
1058
+ const a = new M.TextureLoader().load(e.map);
1059
+ r.map = a;
944
1060
  }
945
- return r.needsUpdate = !0, tt[e.name] = r, r;
1061
+ return r.needsUpdate = !0, ot[e.name] = r, r;
946
1062
  }
947
1063
  export {
948
- oe as C,
949
- _e as I,
1064
+ ie as C,
1065
+ ue as I,
950
1066
  K as S,
951
- ae as a,
952
- re as b,
953
- ne as c,
954
- he as d,
955
- le as e,
956
- ce as f,
957
- pe as g,
958
- de as h,
959
- ue as i,
960
- Vt as j,
961
- me as k,
962
- $t as l,
963
- se as m,
964
- qt as o
1067
+ oe as a,
1068
+ ne as b,
1069
+ se as c,
1070
+ ae as d,
1071
+ re as e,
1072
+ le as f,
1073
+ he as g,
1074
+ ce as h,
1075
+ pe as i,
1076
+ Jt as j,
1077
+ de as k,
1078
+ _e as l,
1079
+ fe as m,
1080
+ ye as n,
1081
+ me as o,
1082
+ ee as p
965
1083
  };