gl-draw 0.15.0-beta.9 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,48 +1,48 @@
1
- var St = Object.defineProperty, At = Object.defineProperties;
1
+ var At = Object.defineProperty, St = Object.defineProperties;
2
2
  var Mt = Object.getOwnPropertyDescriptors;
3
3
  var Me = Object.getOwnPropertySymbols;
4
4
  var Rt = Object.prototype.hasOwnProperty, Dt = Object.prototype.propertyIsEnumerable;
5
- var Re = (h, e, t) => e in h ? St(h, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[e] = t, U = (h, e) => {
5
+ var Re = (h, e, t) => e in h ? At(h, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[e] = t, U = (h, e) => {
6
6
  for (var t in e || (e = {}))
7
7
  Rt.call(e, t) && Re(h, t, e[t]);
8
8
  if (Me)
9
9
  for (var t of Me(e))
10
10
  Dt.call(e, t) && Re(h, t, e[t]);
11
11
  return h;
12
- }, te = (h, e) => At(h, Mt(e));
12
+ }, te = (h, e) => St(h, Mt(e));
13
13
  var se = (h, e, t) => new Promise((s, i) => {
14
- var r = (l) => {
14
+ var r = (a) => {
15
15
  try {
16
- n(t.next(l));
17
- } catch (d) {
18
- i(d);
16
+ n(t.next(a));
17
+ } catch (c) {
18
+ i(c);
19
19
  }
20
- }, o = (l) => {
20
+ }, o = (a) => {
21
21
  try {
22
- n(t.throw(l));
23
- } catch (d) {
24
- i(d);
22
+ n(t.throw(a));
23
+ } catch (c) {
24
+ i(c);
25
25
  }
26
- }, n = (l) => l.done ? s(l.value) : Promise.resolve(l.value).then(r, o);
26
+ }, n = (a) => a.done ? s(a.value) : Promise.resolve(a.value).then(r, o);
27
27
  n((t = t.apply(h, e)).next());
28
28
  });
29
- import { WebGLRenderer as Ut, Vector2 as B, Vector3 as I, PerspectiveCamera as zt, Matrix4 as W, Scene as nt, AxesHelper as De, CameraHelper as kt, PointLightHelper as Ft, DirectionalLightHelper as Nt, SpotLightHelper as jt, HemisphereLightHelper as It, Box3 as at, Box3Helper as Ue, MathUtils as Ht, Vector4 as Bt, Quaternion as lt, Spherical as Vt, Sphere as Yt, Raycaster as ht, REVISION as Zt, Object3D as Wt, UniformsUtils as Gt, RawShaderMaterial as Kt, ShaderMaterial as Xt, MeshBasicMaterial as $t, PointsMaterial as ct, SpriteMaterial as dt, Layers as qt, WebGLRenderTarget as Qt, HalfFloatType as Jt, Loader as pt, Texture as fe, VideoTexture as mt, FileLoader as Se, LoadingManager as es, DataTexture as ts, Mesh as ss } from "three";
30
- import { Timer as is } from "three/examples/jsm/misc/Timer";
29
+ import { WebGLRenderer as Ut, Vector3 as I, PerspectiveCamera as zt, Matrix4 as W, Scene as nt, AxesHelper as De, CameraHelper as kt, PointLightHelper as Ft, DirectionalLightHelper as Nt, SpotLightHelper as Ht, HemisphereLightHelper as It, Box3 as at, Box3Helper as Ue, MathUtils as jt, Vector2 as B, Vector4 as Bt, Quaternion as lt, Spherical as Vt, Sphere as Yt, Raycaster as ht, REVISION as Zt, Object3D as Wt, UniformsUtils as Kt, RawShaderMaterial as Gt, ShaderMaterial as $t, MeshBasicMaterial as Xt, PointsMaterial as ct, SpriteMaterial as dt, Layers as qt, WebGLRenderTarget as Qt, HalfFloatType as Jt, Loader as mt, Texture as fe, VideoTexture as pt, FileLoader as Ae, LoadingManager as es, DataTexture as ts, Group as ze } from "three";
30
+ import { Timer as ss } from "three/examples/jsm/misc/Timer";
31
31
  import * as Ce from "@tweenjs/tween.js";
32
- import rs from "deepmerge";
33
- import os from "stats-gl";
34
- import { C as ns, c as as, i as ls } from "./isPlainObject.module.js";
35
- import { R as Pe, M as ut, B as hs, G as ze } from "./index.module2.js";
36
- import { RectAreaLightHelper as cs } from "three/examples/jsm/helpers/RectAreaLightHelper";
37
- import { ViewHelper as ds } from "three/examples/jsm/helpers/ViewHelper";
38
- import { TransformControls as ps } from "three/examples/jsm/controls/TransformControls";
32
+ import is from "deepmerge";
33
+ import rs from "stats-gl";
34
+ import { C as os, c as ns, i as as } from "./isPlainObject.module.js";
35
+ import { R as Pe, M as ut, B as ls } from "./index.module2.js";
36
+ import { RectAreaLightHelper as hs } from "three/examples/jsm/helpers/RectAreaLightHelper";
37
+ import { ViewHelper as cs } from "three/examples/jsm/helpers/ViewHelper";
38
+ import { TransformControls as ds } from "three/examples/jsm/controls/TransformControls";
39
39
  import { EffectComposer as ke } from "three/examples/jsm/postprocessing/EffectComposer";
40
40
  import { RenderPass as ms } from "three/examples/jsm/postprocessing/RenderPass";
41
- import { SSAOPass as us } from "three/examples/jsm/postprocessing/SSAOPass";
41
+ import { SSAOPass as ps } from "three/examples/jsm/postprocessing/SSAOPass";
42
42
  import { FullScreenQuad as Fe } from "three/examples/jsm/postprocessing/Pass";
43
- import { OutputPass as fs } from "three/examples/jsm/postprocessing/OutputPass";
44
- import { ShaderPass as _s } from "three/examples/jsm/postprocessing/ShaderPass";
45
- import { UnrealBloomPass as gs } from "three/examples/jsm/postprocessing/UnrealBloomPass";
43
+ import { OutputPass as us } from "three/examples/jsm/postprocessing/OutputPass";
44
+ import { ShaderPass as fs } from "three/examples/jsm/postprocessing/ShaderPass";
45
+ import { UnrealBloomPass as _s } from "three/examples/jsm/postprocessing/UnrealBloomPass";
46
46
  import "three/examples/jsm/renderers/CSS2DRenderer";
47
47
  import "three/examples/jsm/renderers/CSS3DRenderer";
48
48
  import "d3-geo";
@@ -54,15 +54,15 @@ import "three/examples/jsm/lines/LineSegmentsGeometry";
54
54
  import "three/examples/jsm/lines/LineMaterial";
55
55
  import "three-bvh-csg";
56
56
  import { GLTFLoader as Ne } from "three/examples/jsm/loaders/GLTFLoader";
57
- import { DRACOLoader as vs } from "three/examples/jsm/loaders/DRACOLoader";
57
+ import { DRACOLoader as gs } from "three/examples/jsm/loaders/DRACOLoader";
58
58
  import { EXRLoader as ys } from "three/examples/jsm/loaders/EXRLoader";
59
- import { LottieLoader as Cs } from "three/examples/jsm/loaders/LottieLoader";
60
- import { makePromiseCreator as Os, generateUUID as je } from "esus-lite";
59
+ import { LottieLoader as vs } from "three/examples/jsm/loaders/LottieLoader";
60
+ import { makePromiseCreator as Cs, generateUUID as He } from "esus-lite";
61
61
  const M = {
62
62
  LEFT: 1,
63
63
  RIGHT: 2,
64
64
  MIDDLE: 4
65
- }, c = Object.freeze({
65
+ }, d = Object.freeze({
66
66
  NONE: 0,
67
67
  ROTATE: 1,
68
68
  TRUCK: 2,
@@ -84,7 +84,7 @@ const M = {
84
84
  TOUCH_SCREEN_PAN: 131072,
85
85
  TOUCH_DOLLY_SCREEN_PAN: 262144,
86
86
  TOUCH_ZOOM_SCREEN_PAN: 524288
87
- }), G = {
87
+ }), K = {
88
88
  NONE: 0,
89
89
  IN: 1,
90
90
  OUT: -1
@@ -92,20 +92,20 @@ const M = {
92
92
  function Y(h) {
93
93
  return h.isPerspectiveCamera;
94
94
  }
95
- function H(h) {
95
+ function j(h) {
96
96
  return h.isOrthographicCamera;
97
97
  }
98
- const K = Math.PI * 2, Ie = Math.PI / 2, ft = 1e-5, ie = Math.PI / 180;
98
+ const G = Math.PI * 2, Ie = Math.PI / 2, ft = 1e-5, ie = Math.PI / 180;
99
99
  function k(h, e, t) {
100
100
  return Math.max(e, Math.min(t, h));
101
101
  }
102
- function A(h, e = ft) {
102
+ function S(h, e = ft) {
103
103
  return Math.abs(h) < e;
104
104
  }
105
105
  function P(h, e, t = ft) {
106
- return A(h - e, t);
106
+ return S(h - e, t);
107
107
  }
108
- function He(h, e) {
108
+ function je(h, e) {
109
109
  return Math.round(h / e) * e;
110
110
  }
111
111
  function re(h) {
@@ -116,29 +116,29 @@ function oe(h) {
116
116
  }
117
117
  function he(h, e, t, s, i = 1 / 0, r) {
118
118
  s = Math.max(1e-4, s);
119
- const o = 2 / s, n = o * r, l = 1 / (1 + n + 0.48 * n * n + 0.235 * n * n * n);
120
- let d = h - e;
121
- const _ = e, p = i * s;
122
- d = k(d, -p, p), e = h - d;
123
- const O = (t.value + o * d) * r;
124
- t.value = (t.value - o * O) * l;
125
- let v = e + (d + O) * l;
126
- return _ - h > 0 == v > _ && (v = _, t.value = (v - _) / r), v;
119
+ const o = 2 / s, n = o * r, a = 1 / (1 + n + 0.48 * n * n + 0.235 * n * n * n);
120
+ let c = h - e;
121
+ const f = e, m = i * s;
122
+ c = k(c, -m, m), e = h - c;
123
+ const v = (t.value + o * c) * r;
124
+ t.value = (t.value - o * v) * a;
125
+ let p = e + (c + v) * a;
126
+ return f - h > 0 == p > f && (p = f, t.value = (p - f) / r), p;
127
127
  }
128
128
  function Be(h, e, t, s, i = 1 / 0, r, o) {
129
129
  s = Math.max(1e-4, s);
130
- const n = 2 / s, l = n * r, d = 1 / (1 + l + 0.48 * l * l + 0.235 * l * l * l);
131
- let _ = e.x, p = e.y, O = e.z, v = h.x - _, m = h.y - p, u = h.z - O;
132
- const f = _, a = p, g = O, C = i * s, y = C * C, b = v * v + m * m + u * u;
133
- if (b > y) {
134
- const ye = Math.sqrt(b);
135
- v = v / ye * C, m = m / ye * C, u = u / ye * C;
136
- }
137
- _ = h.x - v, p = h.y - m, O = h.z - u;
138
- const E = (t.x + n * v) * r, x = (t.y + n * m) * r, R = (t.z + n * u) * r;
139
- t.x = (t.x - n * E) * d, t.y = (t.y - n * x) * d, t.z = (t.z - n * R) * d, o.x = _ + (v + E) * d, o.y = p + (m + x) * d, o.z = O + (u + R) * d;
140
- const V = f - h.x, le = a - h.y, wt = g - h.z, xt = o.x - f, Lt = o.y - a, Pt = o.z - g;
141
- return V * xt + le * Lt + wt * Pt > 0 && (o.x = f, o.y = a, o.z = g, t.x = (o.x - f) / r, t.y = (o.y - a) / r, t.z = (o.z - g) / r), o;
130
+ const n = 2 / s, a = n * r, c = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
131
+ let f = e.x, m = e.y, v = e.z, p = h.x - f, u = h.y - m, g = h.z - v;
132
+ const y = f, l = m, _ = v, O = i * s, C = O * O, w = p * p + u * u + g * g;
133
+ if (w > C) {
134
+ const ve = Math.sqrt(w);
135
+ p = p / ve * O, u = u / ve * O, g = g / ve * O;
136
+ }
137
+ f = h.x - p, m = h.y - u, v = h.z - g;
138
+ const E = (t.x + n * p) * r, b = (t.y + n * u) * r, R = (t.z + n * g) * r;
139
+ t.x = (t.x - n * E) * c, t.y = (t.y - n * b) * c, t.z = (t.z - n * R) * c, o.x = f + (p + E) * c, o.y = m + (u + b) * c, o.z = v + (g + R) * c;
140
+ const V = y - h.x, le = l - h.y, xt = _ - h.z, bt = o.x - y, Lt = o.y - l, Pt = o.z - _;
141
+ return V * bt + le * Lt + xt * Pt > 0 && (o.x = y, o.y = l, o.z = _, t.x = (o.x - y) / r, t.y = (o.y - l) / r, t.z = (o.z - _) / r), o;
142
142
  }
143
143
  function Oe(h, e) {
144
144
  e.set(0, 0), h.forEach((t) => {
@@ -146,9 +146,9 @@ function Oe(h, e) {
146
146
  }), e.x /= h.length, e.y /= h.length;
147
147
  }
148
148
  function Ee(h, e) {
149
- return H(h) ? (console.warn(`${e} is not supported in OrthographicCamera`), !0) : !1;
149
+ return j(h) ? (console.warn(`${e} is not supported in OrthographicCamera`), !0) : !1;
150
150
  }
151
- class Es {
151
+ class Os {
152
152
  constructor() {
153
153
  this._listeners = {};
154
154
  }
@@ -212,18 +212,18 @@ class Es {
212
212
  }
213
213
  }
214
214
  }
215
- const ce = 1 / 8, Ts = /Mac/.test(navigator.platform);
216
- let T, Ve, de, Te, D, w, L, X, ne, F, N, Z, Ye, Ze, z, ae, $, We, be, Ge, we, xe, pe;
217
- class J extends Es {
215
+ const ce = 1 / 8, Es = /Mac/.test(navigator.platform);
216
+ let T, Ve, de, Te, D, x, L, $, ne, F, N, Z, Ye, Ze, z, ae, X, We, we, Ke, xe, be, me;
217
+ class J extends Os {
218
218
  static install(e) {
219
- T = e.THREE, Ve = Object.freeze(new T.Vector3(0, 0, 0)), de = Object.freeze(new T.Vector3(0, 1, 0)), Te = Object.freeze(new T.Vector3(0, 0, 1)), D = new T.Vector2(), w = new T.Vector3(), L = new T.Vector3(), X = new T.Vector3(), ne = new T.Vector3(), F = new T.Vector3(), N = new T.Vector3(), Z = new T.Vector3(), Ye = new T.Vector3(), Ze = new T.Vector3(), z = new T.Spherical(), ae = new T.Spherical(), $ = new T.Box3(), We = new T.Box3(), be = new T.Sphere(), Ge = new T.Quaternion(), we = new T.Quaternion(), xe = new T.Matrix4(), pe = new T.Raycaster();
219
+ T = e.THREE, Ve = Object.freeze(new T.Vector3(0, 0, 0)), de = Object.freeze(new T.Vector3(0, 1, 0)), Te = Object.freeze(new T.Vector3(0, 0, 1)), D = new T.Vector2(), x = new T.Vector3(), L = new T.Vector3(), $ = new T.Vector3(), ne = new T.Vector3(), F = new T.Vector3(), N = new T.Vector3(), Z = new T.Vector3(), Ye = new T.Vector3(), Ze = new T.Vector3(), z = new T.Spherical(), ae = new T.Spherical(), X = new T.Box3(), We = new T.Box3(), we = new T.Sphere(), Ke = new T.Quaternion(), xe = new T.Quaternion(), be = new T.Matrix4(), me = new T.Raycaster();
220
220
  }
221
221
  /**
222
222
  * list all ACTIONs
223
223
  * @category Statics
224
224
  */
225
225
  static get ACTION() {
226
- return c;
226
+ return d;
227
227
  }
228
228
  /**
229
229
  * Creates a `CameraControls` instance.
@@ -244,47 +244,47 @@ class J extends Es {
244
244
  */
245
245
  constructor(e, t) {
246
246
  super(), this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.minDistance = Number.EPSILON, this.maxDistance = 1 / 0, this.infinityDolly = !1, this.minZoom = 0.01, this.maxZoom = 1 / 0, this.smoothTime = 0.25, this.draggingSmoothTime = 0.125, this.maxSpeed = 1 / 0, this.azimuthRotateSpeed = 1, this.polarRotateSpeed = 1, this.dollySpeed = 1, this.dollyDragInverted = !1, this.truckSpeed = 2, this.dollyToCursor = !1, this.dragToOffset = !1, this.boundaryFriction = 0, this.restThreshold = 0.01, this.colliderMeshes = [], this.cancel = () => {
247
- }, this._enabled = !0, this._state = c.NONE, this._viewport = null, this._changedDolly = 0, this._changedZoom = 0, this._hasRested = !0, this._boundaryEnclosesCamera = !1, this._needsUpdate = !0, this._updatedLastTime = !1, this._elementRect = new DOMRect(), this._isDragging = !1, this._dragNeedsUpdate = !0, this._activePointers = [], this._lockedPointer = null, this._interactiveArea = new DOMRect(0, 0, 1, 1), this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._lastDollyDirection = G.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new T.Vector3(), this._focalOffsetVelocity = new T.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (a, g, C, y) => {
248
- let b, E;
247
+ }, this._enabled = !0, this._state = d.NONE, this._viewport = null, this._changedDolly = 0, this._changedZoom = 0, this._hasRested = !0, this._boundaryEnclosesCamera = !1, this._needsUpdate = !0, this._updatedLastTime = !1, this._elementRect = new DOMRect(), this._isDragging = !1, this._dragNeedsUpdate = !0, this._activePointers = [], this._lockedPointer = null, this._interactiveArea = new DOMRect(0, 0, 1, 1), this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._lastDollyDirection = K.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new T.Vector3(), this._focalOffsetVelocity = new T.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (l, _, O, C) => {
248
+ let w, E;
249
249
  if (Y(this._camera)) {
250
- const x = w.copy(this._camera.position).sub(this._target), R = this._camera.getEffectiveFOV() * ie, V = x.length() * Math.tan(R * 0.5);
251
- b = this.truckSpeed * a * V / this._elementRect.height, E = this.truckSpeed * g * V / this._elementRect.height;
252
- } else if (H(this._camera)) {
253
- const x = this._camera;
254
- b = this.truckSpeed * a * (x.right - x.left) / x.zoom / this._elementRect.width, E = this.truckSpeed * g * (x.top - x.bottom) / x.zoom / this._elementRect.height;
250
+ const b = x.copy(this._camera.position).sub(this._target), R = this._camera.getEffectiveFOV() * ie, V = b.length() * Math.tan(R * 0.5);
251
+ w = this.truckSpeed * l * V / this._elementRect.height, E = this.truckSpeed * _ * V / this._elementRect.height;
252
+ } else if (j(this._camera)) {
253
+ const b = this._camera;
254
+ w = this.truckSpeed * l * (b.right - b.left) / b.zoom / this._elementRect.width, E = this.truckSpeed * _ * (b.top - b.bottom) / b.zoom / this._elementRect.height;
255
255
  } else
256
256
  return;
257
- y ? (C ? this.setFocalOffset(
258
- this._focalOffsetEnd.x + b,
257
+ C ? (O ? this.setFocalOffset(
258
+ this._focalOffsetEnd.x + w,
259
259
  this._focalOffsetEnd.y,
260
260
  this._focalOffsetEnd.z,
261
261
  !0
262
- ) : this.truck(b, 0, !0), this.forward(-E, !0)) : C ? this.setFocalOffset(
263
- this._focalOffsetEnd.x + b,
262
+ ) : this.truck(w, 0, !0), this.forward(-E, !0)) : O ? this.setFocalOffset(
263
+ this._focalOffsetEnd.x + w,
264
264
  this._focalOffsetEnd.y + E,
265
265
  this._focalOffsetEnd.z,
266
266
  !0
267
- ) : this.truck(b, E, !0);
268
- }, this._rotateInternal = (a, g) => {
269
- const C = K * this.azimuthRotateSpeed * a / this._elementRect.height, y = K * this.polarRotateSpeed * g / this._elementRect.height;
270
- this.rotate(C, y, !0);
271
- }, this._dollyInternal = (a, g, C) => {
272
- const y = Math.pow(0.95, -a * this.dollySpeed), b = this._sphericalEnd.radius, E = this._sphericalEnd.radius * y, x = k(
267
+ ) : this.truck(w, E, !0);
268
+ }, this._rotateInternal = (l, _) => {
269
+ const O = G * this.azimuthRotateSpeed * l / this._elementRect.height, C = G * this.polarRotateSpeed * _ / this._elementRect.height;
270
+ this.rotate(O, C, !0);
271
+ }, this._dollyInternal = (l, _, O) => {
272
+ const C = Math.pow(0.95, -l * this.dollySpeed), w = this._sphericalEnd.radius, E = this._sphericalEnd.radius * C, b = k(
273
273
  E,
274
274
  this.minDistance,
275
275
  this.maxDistance
276
- ), R = x - E;
277
- this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(E, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(R, !0), this._dollyToNoClamp(x, !0)) : this._dollyToNoClamp(x, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? E : x) - b, this._dollyControlCoord.set(g, C)), this._lastDollyDirection = Math.sign(-a);
278
- }, this._zoomInternal = (a, g, C) => {
279
- const y = Math.pow(0.95, a * this.dollySpeed), b = this._zoom, E = this._zoom * y;
280
- this.zoomTo(E, !0), this.dollyToCursor && (this._changedZoom += E - b, this._dollyControlCoord.set(g, C));
276
+ ), R = b - E;
277
+ this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(E, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(R, !0), this._dollyToNoClamp(b, !0)) : this._dollyToNoClamp(b, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? E : b) - w, this._dollyControlCoord.set(_, O)), this._lastDollyDirection = Math.sign(-l);
278
+ }, this._zoomInternal = (l, _, O) => {
279
+ const C = Math.pow(0.95, l * this.dollySpeed), w = this._zoom, E = this._zoom * C;
280
+ this.zoomTo(E, !0), this.dollyToCursor && (this._changedZoom += E - w, this._dollyControlCoord.set(_, O));
281
281
  }, typeof T == "undefined" && console.error(
282
282
  "camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."
283
283
  ), this._camera = e, this._yAxisUpSpace = new T.Quaternion().setFromUnitVectors(
284
284
  this._camera.up,
285
285
  de
286
- ), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = c.NONE, this._target = new T.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new T.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new T.Spherical().setFromVector3(
287
- w.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)
286
+ ), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = d.NONE, this._target = new T.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new T.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new T.Spherical().setFromVector3(
287
+ x.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)
288
288
  ), this._sphericalEnd = this._spherical.clone(), this._lastDistance = this._spherical.radius, this._zoom = this._camera.zoom, this._zoomEnd = this._zoom, this._lastZoom = this._zoom, this._nearPlaneCorners = [
289
289
  new T.Vector3(),
290
290
  new T.Vector3(),
@@ -294,54 +294,54 @@ class J extends Es {
294
294
  new T.Vector3(-1 / 0, -1 / 0, -1 / 0),
295
295
  new T.Vector3(1 / 0, 1 / 0, 1 / 0)
296
296
  ), this._cameraUp0 = this._camera.up.clone(), this._target0 = this._target.clone(), this._position0 = this._camera.position.clone(), this._zoom0 = this._zoom, this._focalOffset0 = this._focalOffset.clone(), this._dollyControlCoord = new T.Vector2(), this.mouseButtons = {
297
- left: c.ROTATE,
298
- middle: c.DOLLY,
299
- right: c.TRUCK,
300
- wheel: Y(this._camera) ? c.DOLLY : H(this._camera) ? c.ZOOM : c.NONE
297
+ left: d.ROTATE,
298
+ middle: d.DOLLY,
299
+ right: d.TRUCK,
300
+ wheel: Y(this._camera) ? d.DOLLY : j(this._camera) ? d.ZOOM : d.NONE
301
301
  }, this.touches = {
302
- one: c.TOUCH_ROTATE,
303
- two: Y(this._camera) ? c.TOUCH_DOLLY_TRUCK : H(this._camera) ? c.TOUCH_ZOOM_TRUCK : c.NONE,
304
- three: c.TOUCH_TRUCK
302
+ one: d.TOUCH_ROTATE,
303
+ two: Y(this._camera) ? d.TOUCH_DOLLY_TRUCK : j(this._camera) ? d.TOUCH_ZOOM_TRUCK : d.NONE,
304
+ three: d.TOUCH_TRUCK
305
305
  };
306
- const s = new T.Vector2(), i = new T.Vector2(), r = new T.Vector2(), o = (a) => {
306
+ const s = new T.Vector2(), i = new T.Vector2(), r = new T.Vector2(), o = (l) => {
307
307
  if (!this._enabled || !this._domElement) return;
308
308
  if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
309
- const y = this._domElement.getBoundingClientRect(), b = (a.clientX - y.left) / (y.right - y.left), E = (a.clientY - y.top) / (y.bottom - y.top);
310
- if (b < this._interactiveArea.left || b > this._interactiveArea.right || E < this._interactiveArea.top || E > this._interactiveArea.bottom)
309
+ const C = this._domElement.getBoundingClientRect(), w = (l.clientX - C.left) / (C.right - C.left), E = (l.clientY - C.top) / (C.bottom - C.top);
310
+ if (w < this._interactiveArea.left || w > this._interactiveArea.right || E < this._interactiveArea.top || E > this._interactiveArea.bottom)
311
311
  return;
312
312
  }
313
- const g = a.pointerType !== "mouse" ? null : (a.buttons & M.LEFT) === M.LEFT ? M.LEFT : (a.buttons & M.MIDDLE) === M.MIDDLE ? M.MIDDLE : (a.buttons & M.RIGHT) === M.RIGHT ? M.RIGHT : null;
314
- if (g !== null) {
315
- const y = this._findPointerByMouseButton(g);
316
- y && this._disposePointer(y);
313
+ const _ = l.pointerType !== "mouse" ? null : (l.buttons & M.LEFT) === M.LEFT ? M.LEFT : (l.buttons & M.MIDDLE) === M.MIDDLE ? M.MIDDLE : (l.buttons & M.RIGHT) === M.RIGHT ? M.RIGHT : null;
314
+ if (_ !== null) {
315
+ const C = this._findPointerByMouseButton(_);
316
+ C && this._disposePointer(C);
317
317
  }
318
- if ((a.buttons & M.LEFT) === M.LEFT && this._lockedPointer)
318
+ if ((l.buttons & M.LEFT) === M.LEFT && this._lockedPointer)
319
319
  return;
320
- const C = {
321
- pointerId: a.pointerId,
322
- clientX: a.clientX,
323
- clientY: a.clientY,
320
+ const O = {
321
+ pointerId: l.pointerId,
322
+ clientX: l.clientX,
323
+ clientY: l.clientY,
324
324
  deltaX: 0,
325
325
  deltaY: 0,
326
- mouseButton: g
326
+ mouseButton: _
327
327
  };
328
- this._activePointers.push(C), this._domElement.ownerDocument.removeEventListener(
328
+ this._activePointers.push(O), this._domElement.ownerDocument.removeEventListener(
329
329
  "pointermove",
330
330
  n,
331
331
  { passive: !1 }
332
332
  ), this._domElement.ownerDocument.removeEventListener(
333
333
  "pointerup",
334
- l
334
+ a
335
335
  ), this._domElement.ownerDocument.addEventListener(
336
336
  "pointermove",
337
337
  n,
338
338
  { passive: !1 }
339
- ), this._domElement.ownerDocument.addEventListener("pointerup", l), this._isDragging = !0, O(a);
340
- }, n = (a) => {
341
- a.cancelable && a.preventDefault();
342
- const g = a.pointerId, C = this._lockedPointer || this._findPointerById(g);
343
- if (C) {
344
- if (C.clientX = a.clientX, C.clientY = a.clientY, C.deltaX = a.movementX, C.deltaY = a.movementY, this._state = 0, a.pointerType === "touch")
339
+ ), this._domElement.ownerDocument.addEventListener("pointerup", a), this._isDragging = !0, v(l);
340
+ }, n = (l) => {
341
+ l.cancelable && l.preventDefault();
342
+ const _ = l.pointerId, O = this._lockedPointer || this._findPointerById(_);
343
+ if (O) {
344
+ if (O.clientX = l.clientX, O.clientY = l.clientY, O.deltaX = l.movementX, O.deltaY = l.movementY, this._state = 0, l.pointerType === "touch")
345
345
  switch (this._activePointers.length) {
346
346
  case 1:
347
347
  this._state = this.touches.one;
@@ -354,16 +354,16 @@ class J extends Es {
354
354
  break;
355
355
  }
356
356
  else
357
- (!this._isDragging && this._lockedPointer || this._isDragging && (a.buttons & M.LEFT) === M.LEFT) && (this._state = this._state | this.mouseButtons.left), this._isDragging && (a.buttons & M.MIDDLE) === M.MIDDLE && (this._state = this._state | this.mouseButtons.middle), this._isDragging && (a.buttons & M.RIGHT) === M.RIGHT && (this._state = this._state | this.mouseButtons.right);
358
- v();
357
+ (!this._isDragging && this._lockedPointer || this._isDragging && (l.buttons & M.LEFT) === M.LEFT) && (this._state = this._state | this.mouseButtons.left), this._isDragging && (l.buttons & M.MIDDLE) === M.MIDDLE && (this._state = this._state | this.mouseButtons.middle), this._isDragging && (l.buttons & M.RIGHT) === M.RIGHT && (this._state = this._state | this.mouseButtons.right);
358
+ p();
359
359
  }
360
- }, l = (a) => {
361
- const g = this._findPointerById(a.pointerId);
362
- if (!(g && g === this._lockedPointer)) {
363
- if (g && this._disposePointer(g), a.pointerType === "touch")
360
+ }, a = (l) => {
361
+ const _ = this._findPointerById(l.pointerId);
362
+ if (!(_ && _ === this._lockedPointer)) {
363
+ if (_ && this._disposePointer(_), l.pointerType === "touch")
364
364
  switch (this._activePointers.length) {
365
365
  case 0:
366
- this._state = c.NONE;
366
+ this._state = d.NONE;
367
367
  break;
368
368
  case 1:
369
369
  this._state = this.touches.one;
@@ -376,77 +376,77 @@ class J extends Es {
376
376
  break;
377
377
  }
378
378
  else
379
- this._state = c.NONE;
380
- m();
379
+ this._state = d.NONE;
380
+ u();
381
381
  }
382
382
  };
383
- let d = -1;
384
- const _ = (a) => {
385
- if (!this._domElement || !this._enabled || this.mouseButtons.wheel === c.NONE) return;
383
+ let c = -1;
384
+ const f = (l) => {
385
+ if (!this._domElement || !this._enabled || this.mouseButtons.wheel === d.NONE) return;
386
386
  if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
387
- const E = this._domElement.getBoundingClientRect(), x = (a.clientX - E.left) / (E.right - E.left), R = (a.clientY - E.top) / (E.bottom - E.top);
388
- if (x < this._interactiveArea.left || x > this._interactiveArea.right || R < this._interactiveArea.top || R > this._interactiveArea.bottom)
387
+ const E = this._domElement.getBoundingClientRect(), b = (l.clientX - E.left) / (E.right - E.left), R = (l.clientY - E.top) / (E.bottom - E.top);
388
+ if (b < this._interactiveArea.left || b > this._interactiveArea.right || R < this._interactiveArea.top || R > this._interactiveArea.bottom)
389
389
  return;
390
390
  }
391
- if (a.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel === c.ROTATE || this.mouseButtons.wheel === c.TRUCK) {
391
+ if (l.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel === d.ROTATE || this.mouseButtons.wheel === d.TRUCK) {
392
392
  const E = performance.now();
393
- d - E < 1e3 && this._getClientRect(this._elementRect), d = E;
393
+ c - E < 1e3 && this._getClientRect(this._elementRect), c = E;
394
394
  }
395
- const g = Ts ? -1 : -3, C = a.deltaMode === 1 || a.ctrlKey ? a.deltaY / g : a.deltaY / (g * 10), y = this.dollyToCursor ? (a.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, b = this.dollyToCursor ? (a.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
395
+ const _ = Es ? -1 : -3, O = l.deltaMode === 1 || l.ctrlKey ? l.deltaY / _ : l.deltaY / (_ * 10), C = this.dollyToCursor ? (l.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, w = this.dollyToCursor ? (l.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
396
396
  switch (this.mouseButtons.wheel) {
397
- case c.ROTATE: {
398
- this._rotateInternal(a.deltaX, a.deltaY), this._isUserControllingRotate = !0;
397
+ case d.ROTATE: {
398
+ this._rotateInternal(l.deltaX, l.deltaY), this._isUserControllingRotate = !0;
399
399
  break;
400
400
  }
401
- case c.TRUCK: {
402
- this._truckInternal(a.deltaX, a.deltaY, !1, !1), this._isUserControllingTruck = !0;
401
+ case d.TRUCK: {
402
+ this._truckInternal(l.deltaX, l.deltaY, !1, !1), this._isUserControllingTruck = !0;
403
403
  break;
404
404
  }
405
- case c.SCREEN_PAN: {
406
- this._truckInternal(a.deltaX, a.deltaY, !1, !0), this._isUserControllingTruck = !0;
405
+ case d.SCREEN_PAN: {
406
+ this._truckInternal(l.deltaX, l.deltaY, !1, !0), this._isUserControllingTruck = !0;
407
407
  break;
408
408
  }
409
- case c.OFFSET: {
410
- this._truckInternal(a.deltaX, a.deltaY, !0, !1), this._isUserControllingOffset = !0;
409
+ case d.OFFSET: {
410
+ this._truckInternal(l.deltaX, l.deltaY, !0, !1), this._isUserControllingOffset = !0;
411
411
  break;
412
412
  }
413
- case c.DOLLY: {
414
- this._dollyInternal(-C, y, b), this._isUserControllingDolly = !0;
413
+ case d.DOLLY: {
414
+ this._dollyInternal(-O, C, w), this._isUserControllingDolly = !0;
415
415
  break;
416
416
  }
417
- case c.ZOOM: {
418
- this._zoomInternal(-C, y, b), this._isUserControllingZoom = !0;
417
+ case d.ZOOM: {
418
+ this._zoomInternal(-O, C, w), this._isUserControllingZoom = !0;
419
419
  break;
420
420
  }
421
421
  }
422
422
  this.dispatchEvent({ type: "control" });
423
- }, p = (a) => {
423
+ }, m = (l) => {
424
424
  if (!(!this._domElement || !this._enabled)) {
425
425
  if (this.mouseButtons.right === J.ACTION.NONE) {
426
- const g = a instanceof PointerEvent ? a.pointerId : 0, C = this._findPointerById(g);
427
- C && this._disposePointer(C), this._domElement.ownerDocument.removeEventListener(
426
+ const _ = l instanceof PointerEvent ? l.pointerId : 0, O = this._findPointerById(_);
427
+ O && this._disposePointer(O), this._domElement.ownerDocument.removeEventListener(
428
428
  "pointermove",
429
429
  n,
430
430
  { passive: !1 }
431
431
  ), this._domElement.ownerDocument.removeEventListener(
432
432
  "pointerup",
433
- l
433
+ a
434
434
  );
435
435
  return;
436
436
  }
437
- a.preventDefault();
437
+ l.preventDefault();
438
438
  }
439
- }, O = (a) => {
439
+ }, v = (l) => {
440
440
  if (!this._enabled) return;
441
441
  if (Oe(this._activePointers, D), this._getClientRect(this._elementRect), s.copy(D), i.copy(D), this._activePointers.length >= 2) {
442
- const C = D.x - this._activePointers[1].clientX, y = D.y - this._activePointers[1].clientY, b = Math.sqrt(C * C + y * y);
443
- r.set(0, b);
444
- const E = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, x = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
445
- i.set(E, x);
442
+ const O = D.x - this._activePointers[1].clientX, C = D.y - this._activePointers[1].clientY, w = Math.sqrt(O * O + C * C);
443
+ r.set(0, w);
444
+ const E = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, b = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
445
+ i.set(E, b);
446
446
  }
447
- if (this._state = 0, !a)
447
+ if (this._state = 0, !l)
448
448
  this._lockedPointer && (this._state = this._state | this.mouseButtons.left);
449
- else if ("pointerType" in a && a.pointerType === "touch")
449
+ else if ("pointerType" in l && l.pointerType === "touch")
450
450
  switch (this._activePointers.length) {
451
451
  case 1:
452
452
  this._state = this.touches.one;
@@ -459,39 +459,39 @@ class J extends Es {
459
459
  break;
460
460
  }
461
461
  else
462
- !this._lockedPointer && (a.buttons & M.LEFT) === M.LEFT && (this._state = this._state | this.mouseButtons.left), (a.buttons & M.MIDDLE) === M.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (a.buttons & M.RIGHT) === M.RIGHT && (this._state = this._state | this.mouseButtons.right);
463
- ((this._state & c.ROTATE) === c.ROTATE || (this._state & c.TOUCH_ROTATE) === c.TOUCH_ROTATE || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE || (this._state & c.TOUCH_ZOOM_ROTATE) === c.TOUCH_ZOOM_ROTATE) && (this._sphericalEnd.theta = this._spherical.theta, this._sphericalEnd.phi = this._spherical.phi, this._thetaVelocity.value = 0, this._phiVelocity.value = 0), ((this._state & c.TRUCK) === c.TRUCK || (this._state & c.SCREEN_PAN) === c.SCREEN_PAN || (this._state & c.TOUCH_TRUCK) === c.TOUCH_TRUCK || (this._state & c.TOUCH_SCREEN_PAN) === c.TOUCH_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_ZOOM_TRUCK) === c.TOUCH_ZOOM_TRUCK || (this._state & c.TOUCH_ZOOM_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN) && (this._targetEnd.copy(this._target), this._targetVelocity.set(0, 0, 0)), ((this._state & c.DOLLY) === c.DOLLY || (this._state & c.TOUCH_DOLLY) === c.TOUCH_DOLLY || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE) && (this._sphericalEnd.radius = this._spherical.radius, this._radiusVelocity.value = 0), ((this._state & c.ZOOM) === c.ZOOM || (this._state & c.TOUCH_ZOOM) === c.TOUCH_ZOOM || (this._state & c.TOUCH_ZOOM_TRUCK) === c.TOUCH_ZOOM_TRUCK || (this._state & c.TOUCH_ZOOM_SCREEN_PAN) === c.TOUCH_ZOOM_SCREEN_PAN || (this._state & c.TOUCH_ZOOM_OFFSET) === c.TOUCH_ZOOM_OFFSET || (this._state & c.TOUCH_ZOOM_ROTATE) === c.TOUCH_ZOOM_ROTATE) && (this._zoomEnd = this._zoom, this._zoomVelocity.value = 0), ((this._state & c.OFFSET) === c.OFFSET || (this._state & c.TOUCH_OFFSET) === c.TOUCH_OFFSET || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET || (this._state & c.TOUCH_ZOOM_OFFSET) === c.TOUCH_ZOOM_OFFSET) && (this._focalOffsetEnd.copy(this._focalOffset), this._focalOffsetVelocity.set(0, 0, 0)), this.dispatchEvent({ type: "controlstart" });
464
- }, v = () => {
462
+ !this._lockedPointer && (l.buttons & M.LEFT) === M.LEFT && (this._state = this._state | this.mouseButtons.left), (l.buttons & M.MIDDLE) === M.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (l.buttons & M.RIGHT) === M.RIGHT && (this._state = this._state | this.mouseButtons.right);
463
+ ((this._state & d.ROTATE) === d.ROTATE || (this._state & d.TOUCH_ROTATE) === d.TOUCH_ROTATE || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) && (this._sphericalEnd.theta = this._spherical.theta, this._sphericalEnd.phi = this._spherical.phi, this._thetaVelocity.value = 0, this._phiVelocity.value = 0), ((this._state & d.TRUCK) === d.TRUCK || (this._state & d.SCREEN_PAN) === d.SCREEN_PAN || (this._state & d.TOUCH_TRUCK) === d.TOUCH_TRUCK || (this._state & d.TOUCH_SCREEN_PAN) === d.TOUCH_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN) && (this._targetEnd.copy(this._target), this._targetVelocity.set(0, 0, 0)), ((this._state & d.DOLLY) === d.DOLLY || (this._state & d.TOUCH_DOLLY) === d.TOUCH_DOLLY || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE) && (this._sphericalEnd.radius = this._spherical.radius, this._radiusVelocity.value = 0), ((this._state & d.ZOOM) === d.ZOOM || (this._state & d.TOUCH_ZOOM) === d.TOUCH_ZOOM || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_ZOOM_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) && (this._zoomEnd = this._zoom, this._zoomVelocity.value = 0), ((this._state & d.OFFSET) === d.OFFSET || (this._state & d.TOUCH_OFFSET) === d.TOUCH_OFFSET || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET) && (this._focalOffsetEnd.copy(this._focalOffset), this._focalOffsetVelocity.set(0, 0, 0)), this.dispatchEvent({ type: "controlstart" });
464
+ }, p = () => {
465
465
  if (!this._enabled || !this._dragNeedsUpdate) return;
466
466
  this._dragNeedsUpdate = !1, Oe(this._activePointers, D);
467
- const g = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, C = g ? -g.deltaX : i.x - D.x, y = g ? -g.deltaY : i.y - D.y;
468
- if (i.copy(D), ((this._state & c.ROTATE) === c.ROTATE || (this._state & c.TOUCH_ROTATE) === c.TOUCH_ROTATE || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE || (this._state & c.TOUCH_ZOOM_ROTATE) === c.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(C, y), this._isUserControllingRotate = !0), (this._state & c.DOLLY) === c.DOLLY || (this._state & c.ZOOM) === c.ZOOM) {
469
- const b = this.dollyToCursor ? (s.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, E = this.dollyToCursor ? (s.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, x = this.dollyDragInverted ? -1 : 1;
470
- (this._state & c.DOLLY) === c.DOLLY ? (this._dollyInternal(
471
- x * y * ce,
472
- b,
467
+ const _ = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, O = _ ? -_.deltaX : i.x - D.x, C = _ ? -_.deltaY : i.y - D.y;
468
+ if (i.copy(D), ((this._state & d.ROTATE) === d.ROTATE || (this._state & d.TOUCH_ROTATE) === d.TOUCH_ROTATE || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(O, C), this._isUserControllingRotate = !0), (this._state & d.DOLLY) === d.DOLLY || (this._state & d.ZOOM) === d.ZOOM) {
469
+ const w = this.dollyToCursor ? (s.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, E = this.dollyToCursor ? (s.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, b = this.dollyDragInverted ? -1 : 1;
470
+ (this._state & d.DOLLY) === d.DOLLY ? (this._dollyInternal(
471
+ b * C * ce,
472
+ w,
473
473
  E
474
474
  ), this._isUserControllingDolly = !0) : (this._zoomInternal(
475
- x * y * ce,
476
- b,
475
+ b * C * ce,
476
+ w,
477
477
  E
478
478
  ), this._isUserControllingZoom = !0);
479
479
  }
480
- if ((this._state & c.TOUCH_DOLLY) === c.TOUCH_DOLLY || (this._state & c.TOUCH_ZOOM) === c.TOUCH_ZOOM || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_ZOOM_TRUCK) === c.TOUCH_ZOOM_TRUCK || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_ZOOM_SCREEN_PAN) === c.TOUCH_ZOOM_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET || (this._state & c.TOUCH_ZOOM_OFFSET) === c.TOUCH_ZOOM_OFFSET || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE || (this._state & c.TOUCH_ZOOM_ROTATE) === c.TOUCH_ZOOM_ROTATE) {
481
- const b = D.x - this._activePointers[1].clientX, E = D.y - this._activePointers[1].clientY, x = Math.sqrt(b * b + E * E), R = r.y - x;
482
- r.set(0, x);
480
+ if ((this._state & d.TOUCH_DOLLY) === d.TOUCH_DOLLY || (this._state & d.TOUCH_ZOOM) === d.TOUCH_ZOOM || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_ZOOM_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) {
481
+ const w = D.x - this._activePointers[1].clientX, E = D.y - this._activePointers[1].clientY, b = Math.sqrt(w * w + E * E), R = r.y - b;
482
+ r.set(0, b);
483
483
  const V = this.dollyToCursor ? (i.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, le = this.dollyToCursor ? (i.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
484
- (this._state & c.TOUCH_DOLLY) === c.TOUCH_DOLLY || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(R * ce, V, le), this._isUserControllingDolly = !0) : (this._zoomInternal(R * ce, V, le), this._isUserControllingZoom = !0);
484
+ (this._state & d.TOUCH_DOLLY) === d.TOUCH_DOLLY || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(R * ce, V, le), this._isUserControllingDolly = !0) : (this._zoomInternal(R * ce, V, le), this._isUserControllingZoom = !0);
485
485
  }
486
- ((this._state & c.TRUCK) === c.TRUCK || (this._state & c.TOUCH_TRUCK) === c.TOUCH_TRUCK || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_ZOOM_TRUCK) === c.TOUCH_ZOOM_TRUCK) && (this._truckInternal(C, y, !1, !1), this._isUserControllingTruck = !0), ((this._state & c.SCREEN_PAN) === c.SCREEN_PAN || (this._state & c.TOUCH_SCREEN_PAN) === c.TOUCH_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_ZOOM_SCREEN_PAN) === c.TOUCH_ZOOM_SCREEN_PAN) && (this._truckInternal(C, y, !1, !0), this._isUserControllingTruck = !0), ((this._state & c.OFFSET) === c.OFFSET || (this._state & c.TOUCH_OFFSET) === c.TOUCH_OFFSET || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET || (this._state & c.TOUCH_ZOOM_OFFSET) === c.TOUCH_ZOOM_OFFSET) && (this._truckInternal(C, y, !0, !1), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
487
- }, m = () => {
486
+ ((this._state & d.TRUCK) === d.TRUCK || (this._state & d.TOUCH_TRUCK) === d.TOUCH_TRUCK || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK) && (this._truckInternal(O, C, !1, !1), this._isUserControllingTruck = !0), ((this._state & d.SCREEN_PAN) === d.SCREEN_PAN || (this._state & d.TOUCH_SCREEN_PAN) === d.TOUCH_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_ZOOM_SCREEN_PAN) && (this._truckInternal(O, C, !1, !0), this._isUserControllingTruck = !0), ((this._state & d.OFFSET) === d.OFFSET || (this._state & d.TOUCH_OFFSET) === d.TOUCH_OFFSET || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET) && (this._truckInternal(O, C, !0, !1), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
487
+ }, u = () => {
488
488
  Oe(this._activePointers, D), i.copy(D), this._dragNeedsUpdate = !1, (this._activePointers.length === 0 || this._activePointers.length === 1 && this._activePointers[0] === this._lockedPointer) && (this._isDragging = !1), this._activePointers.length === 0 && this._domElement && (this._domElement.ownerDocument.removeEventListener(
489
489
  "pointermove",
490
490
  n,
491
491
  { passive: !1 }
492
492
  ), this._domElement.ownerDocument.removeEventListener(
493
493
  "pointerup",
494
- l
494
+ a
495
495
  ), this.dispatchEvent({ type: "controlend" }));
496
496
  };
497
497
  this.lockPointer = () => {
@@ -508,56 +508,56 @@ class J extends Es {
508
508
  { passive: !1 }
509
509
  ), this._domElement.ownerDocument.removeEventListener(
510
510
  "pointerup",
511
- l
511
+ a
512
512
  ), this._domElement.requestPointerLock(), this._domElement.ownerDocument.addEventListener(
513
513
  "pointerlockchange",
514
- u
514
+ g
515
515
  ), this._domElement.ownerDocument.addEventListener(
516
516
  "pointerlockerror",
517
- f
517
+ y
518
518
  ), this._domElement.ownerDocument.addEventListener(
519
519
  "pointermove",
520
520
  n,
521
521
  { passive: !1 }
522
- ), this._domElement.ownerDocument.addEventListener("pointerup", l), O());
522
+ ), this._domElement.ownerDocument.addEventListener("pointerup", a), v());
523
523
  }, this.unlockPointer = () => {
524
- var a, g, C;
525
- this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), (a = this._domElement) === null || a === void 0 || a.ownerDocument.exitPointerLock(), (g = this._domElement) === null || g === void 0 || g.ownerDocument.removeEventListener(
524
+ var l, _, O;
525
+ this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), (l = this._domElement) === null || l === void 0 || l.ownerDocument.exitPointerLock(), (_ = this._domElement) === null || _ === void 0 || _.ownerDocument.removeEventListener(
526
526
  "pointerlockchange",
527
- u
528
- ), (C = this._domElement) === null || C === void 0 || C.ownerDocument.removeEventListener(
527
+ g
528
+ ), (O = this._domElement) === null || O === void 0 || O.ownerDocument.removeEventListener(
529
529
  "pointerlockerror",
530
- f
530
+ y
531
531
  ), this.cancel();
532
532
  };
533
- const u = () => {
533
+ const g = () => {
534
534
  this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement || this.unlockPointer();
535
- }, f = () => {
535
+ }, y = () => {
536
536
  this.unlockPointer();
537
537
  };
538
- this._addAllEventListeners = (a) => {
539
- this._domElement = a, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", o), this._domElement.addEventListener("pointercancel", l), this._domElement.addEventListener("wheel", _, {
538
+ this._addAllEventListeners = (l) => {
539
+ this._domElement = l, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", o), this._domElement.addEventListener("pointercancel", a), this._domElement.addEventListener("wheel", f, {
540
540
  passive: !1
541
- }), this._domElement.addEventListener("contextmenu", p);
541
+ }), this._domElement.addEventListener("contextmenu", m);
542
542
  }, this._removeAllEventListeners = () => {
543
- this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", o), this._domElement.removeEventListener("pointercancel", l), this._domElement.removeEventListener("wheel", _, {
543
+ this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", o), this._domElement.removeEventListener("pointercancel", a), this._domElement.removeEventListener("wheel", f, {
544
544
  passive: !1
545
- }), this._domElement.removeEventListener("contextmenu", p), this._domElement.ownerDocument.removeEventListener(
545
+ }), this._domElement.removeEventListener("contextmenu", m), this._domElement.ownerDocument.removeEventListener(
546
546
  "pointermove",
547
547
  n,
548
548
  { passive: !1 }
549
549
  ), this._domElement.ownerDocument.removeEventListener(
550
550
  "pointerup",
551
- l
551
+ a
552
552
  ), this._domElement.ownerDocument.removeEventListener(
553
553
  "pointerlockchange",
554
- u
554
+ g
555
555
  ), this._domElement.ownerDocument.removeEventListener(
556
556
  "pointerlockerror",
557
- f
557
+ y
558
558
  ));
559
559
  }, this.cancel = () => {
560
- this._state !== c.NONE && (this._state = c.NONE, this._activePointers.length = 0, m());
560
+ this._state !== d.NONE && (this._state = d.NONE, this._activePointers.length = 0, u());
561
561
  }, t && this.connect(t), this.update(0);
562
562
  }
563
563
  /**
@@ -822,7 +822,7 @@ class J extends Es {
822
822
  * @category Methods
823
823
  */
824
824
  dollyTo(e, t = !1) {
825
- return this._isUserControllingDolly = !1, this._lastDollyDirection = G.NONE, this._changedDolly = 0, this._dollyToNoClamp(
825
+ return this._isUserControllingDolly = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0, this._dollyToNoClamp(
826
826
  k(e, this.minDistance, this.maxDistance),
827
827
  t
828
828
  );
@@ -901,7 +901,7 @@ class J extends Es {
901
901
  */
902
902
  truck(e, t, s = !1) {
903
903
  this._camera.updateMatrix(), F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), F.multiplyScalar(e), N.multiplyScalar(-t);
904
- const i = w.copy(F).add(N), r = L.copy(this._targetEnd).add(i);
904
+ const i = x.copy(F).add(N), r = L.copy(this._targetEnd).add(i);
905
905
  return this.moveTo(r.x, r.y, r.z, s);
906
906
  }
907
907
  /**
@@ -911,8 +911,8 @@ class J extends Es {
911
911
  * @category Methods
912
912
  */
913
913
  forward(e, t = !1) {
914
- w.setFromMatrixColumn(this._camera.matrix, 0), w.crossVectors(this._camera.up, w), w.multiplyScalar(e);
915
- const s = L.copy(this._targetEnd).add(w);
914
+ x.setFromMatrixColumn(this._camera.matrix, 0), x.crossVectors(this._camera.up, x), x.multiplyScalar(e);
915
+ const s = L.copy(this._targetEnd).add(x);
916
916
  return this.moveTo(s.x, s.y, s.z, t);
917
917
  }
918
918
  /**
@@ -922,10 +922,10 @@ class J extends Es {
922
922
  * @category Methods
923
923
  */
924
924
  elevate(e, t = !1) {
925
- return w.copy(this._camera.up).multiplyScalar(e), this.moveTo(
926
- this._targetEnd.x + w.x,
927
- this._targetEnd.y + w.y,
928
- this._targetEnd.z + w.z,
925
+ return x.copy(this._camera.up).multiplyScalar(e), this.moveTo(
926
+ this._targetEnd.x + x.x,
927
+ this._targetEnd.y + x.y,
928
+ this._targetEnd.z + x.z,
929
929
  t
930
930
  );
931
931
  }
@@ -939,7 +939,7 @@ class J extends Es {
939
939
  */
940
940
  moveTo(e, t, s, i = !1) {
941
941
  this._isUserControllingTruck = !1;
942
- const r = w.set(e, t, s).sub(this._targetEnd);
942
+ const r = x.set(e, t, s).sub(this._targetEnd);
943
943
  this._encloseToBoundary(this._targetEnd, r, this.boundaryFriction), this._needsUpdate = !0, i || this._target.copy(this._targetEnd);
944
944
  const o = !i || P(this._target.x, this._targetEnd.x, this.restThreshold) && P(this._target.y, this._targetEnd.y, this.restThreshold) && P(this._target.z, this._targetEnd.z, this.restThreshold);
945
945
  return this._createOnRestPromise(o);
@@ -954,7 +954,7 @@ class J extends Es {
954
954
  * @category Methods
955
955
  */
956
956
  lookInDirectionOf(e, t, s, i = !1) {
957
- const n = w.set(e, t, s).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);
957
+ const n = x.set(e, t, s).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);
958
958
  return this.setPosition(
959
959
  n.x,
960
960
  n.y,
@@ -982,34 +982,34 @@ class J extends Es {
982
982
  paddingBottom: o = 0,
983
983
  paddingTop: n = 0
984
984
  } = {}) {
985
- const l = [], d = e.isBox3 ? $.copy(e) : $.setFromObject(e);
986
- d.isEmpty() && (console.warn(
985
+ const a = [], c = e.isBox3 ? X.copy(e) : X.setFromObject(e);
986
+ c.isEmpty() && (console.warn(
987
987
  "camera-controls: fitTo() cannot be used with an empty box. Aborting"
988
988
  ), Promise.resolve());
989
- const _ = He(this._sphericalEnd.theta, Ie), p = He(this._sphericalEnd.phi, Ie);
990
- l.push(this.rotateTo(_, p, t));
991
- const O = w.setFromSpherical(this._sphericalEnd).normalize(), v = Ge.setFromUnitVectors(O, Te), m = P(Math.abs(O.y), 1);
992
- m && v.multiply(we.setFromAxisAngle(de, _)), v.multiply(this._yAxisUpSpaceInverse);
993
- const u = We.makeEmpty();
994
- L.copy(d.min).applyQuaternion(v), u.expandByPoint(L), L.copy(d.min).setX(d.max.x).applyQuaternion(v), u.expandByPoint(L), L.copy(d.min).setY(d.max.y).applyQuaternion(v), u.expandByPoint(L), L.copy(d.max).setZ(d.min.z).applyQuaternion(v), u.expandByPoint(L), L.copy(d.min).setZ(d.max.z).applyQuaternion(v), u.expandByPoint(L), L.copy(d.max).setY(d.min.y).applyQuaternion(v), u.expandByPoint(L), L.copy(d.max).setX(d.min.x).applyQuaternion(v), u.expandByPoint(L), L.copy(d.max).applyQuaternion(v), u.expandByPoint(L), u.min.x -= i, u.min.y -= o, u.max.x += r, u.max.y += n, v.setFromUnitVectors(Te, O), m && v.premultiply(we.invert()), v.premultiply(this._yAxisUpSpace);
995
- const f = u.getSize(w), a = u.getCenter(L).applyQuaternion(v);
989
+ const f = je(this._sphericalEnd.theta, Ie), m = je(this._sphericalEnd.phi, Ie);
990
+ a.push(this.rotateTo(f, m, t));
991
+ const v = x.setFromSpherical(this._sphericalEnd).normalize(), p = Ke.setFromUnitVectors(v, Te), u = P(Math.abs(v.y), 1);
992
+ u && p.multiply(xe.setFromAxisAngle(de, f)), p.multiply(this._yAxisUpSpaceInverse);
993
+ const g = We.makeEmpty();
994
+ L.copy(c.min).applyQuaternion(p), g.expandByPoint(L), L.copy(c.min).setX(c.max.x).applyQuaternion(p), g.expandByPoint(L), L.copy(c.min).setY(c.max.y).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).setZ(c.min.z).applyQuaternion(p), g.expandByPoint(L), L.copy(c.min).setZ(c.max.z).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).setY(c.min.y).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).setX(c.min.x).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).applyQuaternion(p), g.expandByPoint(L), g.min.x -= i, g.min.y -= o, g.max.x += r, g.max.y += n, p.setFromUnitVectors(Te, v), u && p.premultiply(xe.invert()), p.premultiply(this._yAxisUpSpace);
995
+ const y = g.getSize(x), l = g.getCenter(L).applyQuaternion(p);
996
996
  if (Y(this._camera)) {
997
- const g = this.getDistanceToFitBox(
998
- f.x,
999
- f.y,
1000
- f.z,
997
+ const _ = this.getDistanceToFitBox(
998
+ y.x,
999
+ y.y,
1000
+ y.z,
1001
1001
  s
1002
1002
  );
1003
- l.push(
1004
- this.moveTo(a.x, a.y, a.z, t)
1005
- ), l.push(this.dollyTo(g, t)), l.push(this.setFocalOffset(0, 0, 0, t));
1006
- } else if (H(this._camera)) {
1007
- const g = this._camera, C = g.right - g.left, y = g.top - g.bottom, b = s ? Math.max(C / f.x, y / f.y) : Math.min(C / f.x, y / f.y);
1008
- l.push(
1009
- this.moveTo(a.x, a.y, a.z, t)
1010
- ), l.push(this.zoomTo(b, t)), l.push(this.setFocalOffset(0, 0, 0, t));
1003
+ a.push(
1004
+ this.moveTo(l.x, l.y, l.z, t)
1005
+ ), a.push(this.dollyTo(_, t)), a.push(this.setFocalOffset(0, 0, 0, t));
1006
+ } else if (j(this._camera)) {
1007
+ const _ = this._camera, O = _.right - _.left, C = _.top - _.bottom, w = s ? Math.max(O / y.x, C / y.y) : Math.min(O / y.x, C / y.y);
1008
+ a.push(
1009
+ this.moveTo(l.x, l.y, l.z, t)
1010
+ ), a.push(this.zoomTo(w, t)), a.push(this.setFocalOffset(0, 0, 0, t));
1011
1011
  }
1012
- return Promise.all(l);
1012
+ return Promise.all(a);
1013
1013
  }
1014
1014
  /**
1015
1015
  * Fit the viewport to the sphere or the bounding sphere of the object.
@@ -1018,7 +1018,7 @@ class J extends Es {
1018
1018
  * @category Methods
1019
1019
  */
1020
1020
  fitToSphere(e, t) {
1021
- const s = [], r = "isObject3D" in e ? J.createBoundingSphere(e, be) : be.copy(e);
1021
+ const s = [], r = "isObject3D" in e ? J.createBoundingSphere(e, we) : we.copy(e);
1022
1022
  if (s.push(
1023
1023
  this.moveTo(
1024
1024
  r.center.x,
@@ -1029,9 +1029,9 @@ class J extends Es {
1029
1029
  ), Y(this._camera)) {
1030
1030
  const o = this.getDistanceToFitSphere(r.radius);
1031
1031
  s.push(this.dollyTo(o, t));
1032
- } else if (H(this._camera)) {
1033
- const o = this._camera.right - this._camera.left, n = this._camera.top - this._camera.bottom, l = 2 * r.radius, d = Math.min(o / l, n / l);
1034
- s.push(this.zoomTo(d, t));
1032
+ } else if (j(this._camera)) {
1033
+ const o = this._camera.right - this._camera.left, n = this._camera.top - this._camera.bottom, a = 2 * r.radius, c = Math.min(o / a, n / a);
1034
+ s.push(this.zoomTo(c, t));
1035
1035
  }
1036
1036
  return s.push(this.setFocalOffset(0, 0, 0, t)), Promise.all(s);
1037
1037
  }
@@ -1047,12 +1047,12 @@ class J extends Es {
1047
1047
  * @category Methods
1048
1048
  */
1049
1049
  setLookAt(e, t, s, i, r, o, n = !1) {
1050
- this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = G.NONE, this._changedDolly = 0;
1051
- const l = L.set(i, r, o), d = w.set(e, t, s);
1052
- this._targetEnd.copy(l), this._sphericalEnd.setFromVector3(
1053
- d.sub(l).applyQuaternion(this._yAxisUpSpace)
1050
+ this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0;
1051
+ const a = L.set(i, r, o), c = x.set(e, t, s);
1052
+ this._targetEnd.copy(a), this._sphericalEnd.setFromVector3(
1053
+ c.sub(a).applyQuaternion(this._yAxisUpSpace)
1054
1054
  ), this.normalizeRotations(), this._needsUpdate = !0, n || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
1055
- const _ = !n || P(this._target.x, this._targetEnd.x, this.restThreshold) && P(this._target.y, this._targetEnd.y, this.restThreshold) && P(this._target.z, this._targetEnd.z, this.restThreshold) && P(
1055
+ const f = !n || P(this._target.x, this._targetEnd.x, this.restThreshold) && P(this._target.y, this._targetEnd.y, this.restThreshold) && P(this._target.z, this._targetEnd.z, this.restThreshold) && P(
1056
1056
  this._spherical.theta,
1057
1057
  this._sphericalEnd.theta,
1058
1058
  this.restThreshold
@@ -1065,7 +1065,7 @@ class J extends Es {
1065
1065
  this._sphericalEnd.radius,
1066
1066
  this.restThreshold
1067
1067
  );
1068
- return this._createOnRestPromise(_);
1068
+ return this._createOnRestPromise(f);
1069
1069
  }
1070
1070
  /**
1071
1071
  * Similar to setLookAt, but it interpolates between two states.
@@ -1085,23 +1085,23 @@ class J extends Es {
1085
1085
  * @param enableTransition
1086
1086
  * @category Methods
1087
1087
  */
1088
- lerpLookAt(e, t, s, i, r, o, n, l, d, _, p, O, v, m = !1) {
1089
- this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = G.NONE, this._changedDolly = 0;
1090
- const u = w.set(i, r, o), f = L.set(e, t, s);
1088
+ lerpLookAt(e, t, s, i, r, o, n, a, c, f, m, v, p, u = !1) {
1089
+ this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0;
1090
+ const g = x.set(i, r, o), y = L.set(e, t, s);
1091
1091
  z.setFromVector3(
1092
- f.sub(u).applyQuaternion(this._yAxisUpSpace)
1092
+ y.sub(g).applyQuaternion(this._yAxisUpSpace)
1093
1093
  );
1094
- const a = X.set(_, p, O), g = L.set(n, l, d);
1094
+ const l = $.set(f, m, v), _ = L.set(n, a, c);
1095
1095
  ae.setFromVector3(
1096
- g.sub(a).applyQuaternion(this._yAxisUpSpace)
1097
- ), this._targetEnd.copy(u.lerp(a, v));
1098
- const C = ae.theta - z.theta, y = ae.phi - z.phi, b = ae.radius - z.radius;
1096
+ _.sub(l).applyQuaternion(this._yAxisUpSpace)
1097
+ ), this._targetEnd.copy(g.lerp(l, p));
1098
+ const O = ae.theta - z.theta, C = ae.phi - z.phi, w = ae.radius - z.radius;
1099
1099
  this._sphericalEnd.set(
1100
- z.radius + b * v,
1101
- z.phi + y * v,
1102
- z.theta + C * v
1103
- ), this.normalizeRotations(), this._needsUpdate = !0, m || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
1104
- const E = !m || P(this._target.x, this._targetEnd.x, this.restThreshold) && P(this._target.y, this._targetEnd.y, this.restThreshold) && P(this._target.z, this._targetEnd.z, this.restThreshold) && P(
1100
+ z.radius + w * p,
1101
+ z.phi + C * p,
1102
+ z.theta + O * p
1103
+ ), this.normalizeRotations(), this._needsUpdate = !0, u || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
1104
+ const E = !u || P(this._target.x, this._targetEnd.x, this.restThreshold) && P(this._target.y, this._targetEnd.y, this.restThreshold) && P(this._target.z, this._targetEnd.z, this.restThreshold) && P(
1105
1105
  this._spherical.theta,
1106
1106
  this._sphericalEnd.theta,
1107
1107
  this.restThreshold
@@ -1146,7 +1146,7 @@ class J extends Es {
1146
1146
  * @category Methods
1147
1147
  */
1148
1148
  setTarget(e, t, s, i = !1) {
1149
- const r = this.getPosition(w), o = this.setLookAt(
1149
+ const r = this.getPosition(x), o = this.setLookAt(
1150
1150
  r.x,
1151
1151
  r.y,
1152
1152
  r.z,
@@ -1196,8 +1196,8 @@ class J extends Es {
1196
1196
  */
1197
1197
  setOrbitPoint(e, t, s) {
1198
1198
  this._camera.updateMatrixWorld(), F.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), N.setFromMatrixColumn(this._camera.matrixWorldInverse, 1), Z.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);
1199
- const i = w.set(e, t, s), r = i.distanceTo(this._camera.position), o = i.sub(this._camera.position);
1200
- F.multiplyScalar(o.x), N.multiplyScalar(o.y), Z.multiplyScalar(o.z), w.copy(F).add(N).add(Z), w.z = w.z + r, this.dollyTo(r, !1), this.setFocalOffset(-w.x, w.y, -w.z, !1), this.moveTo(e, t, s, !1);
1199
+ const i = x.set(e, t, s), r = i.distanceTo(this._camera.position), o = i.sub(this._camera.position);
1200
+ F.multiplyScalar(o.x), N.multiplyScalar(o.y), Z.multiplyScalar(o.z), x.copy(F).add(N).add(Z), x.z = x.z + r, this.dollyTo(r, !1), this.setFocalOffset(-x.x, x.y, -x.z, !1), this.moveTo(e, t, s, !1);
1201
1201
  }
1202
1202
  /**
1203
1203
  * Set the boundary box that encloses the target of the camera. box3 is in THREE.Box3
@@ -1296,7 +1296,7 @@ class J extends Es {
1296
1296
  * @category Methods
1297
1297
  */
1298
1298
  normalizeRotations() {
1299
- this._sphericalEnd.theta = this._sphericalEnd.theta % K, this._sphericalEnd.theta < 0 && (this._sphericalEnd.theta += K), this._spherical.theta += K * Math.round((this._sphericalEnd.theta - this._spherical.theta) / K);
1299
+ this._sphericalEnd.theta = this._sphericalEnd.theta % G, this._sphericalEnd.theta < 0 && (this._sphericalEnd.theta += G), this._spherical.theta += G * Math.round((this._sphericalEnd.theta - this._spherical.theta) / G);
1300
1300
  }
1301
1301
  /**
1302
1302
  * stop all transitions.
@@ -1312,7 +1312,7 @@ class J extends Es {
1312
1312
  reset(e = !1) {
1313
1313
  if (!P(this._camera.up.x, this._cameraUp0.x) || !P(this._camera.up.y, this._cameraUp0.y) || !P(this._camera.up.z, this._cameraUp0.z)) {
1314
1314
  this._camera.up.copy(this._cameraUp0);
1315
- const s = this.getPosition(w);
1315
+ const s = this.getPosition(x);
1316
1316
  this.updateCameraUp(), this.setPosition(s.x, s.y, s.z);
1317
1317
  }
1318
1318
  const t = [
@@ -1356,9 +1356,9 @@ class J extends Es {
1356
1356
  * @category Methods
1357
1357
  */
1358
1358
  applyCameraUp() {
1359
- const e = w.subVectors(this._target, this._camera.position).normalize(), t = L.crossVectors(e, this._camera.up);
1359
+ const e = x.subVectors(this._target, this._camera.position).normalize(), t = L.crossVectors(e, this._camera.up);
1360
1360
  this._camera.up.crossVectors(t, e).normalize(), this._camera.updateMatrixWorld();
1361
- const s = this.getPosition(w);
1361
+ const s = this.getPosition(x);
1362
1362
  this.updateCameraUp(), this.setPosition(s.x, s.y, s.z);
1363
1363
  }
1364
1364
  /**
@@ -1373,127 +1373,127 @@ class J extends Es {
1373
1373
  this._focalOffsetEnd,
1374
1374
  this._focalOffset
1375
1375
  ), n = this._zoomEnd - this._zoom;
1376
- if (A(t))
1376
+ if (S(t))
1377
1377
  this._thetaVelocity.value = 0, this._spherical.theta = this._sphericalEnd.theta;
1378
1378
  else {
1379
- const p = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
1379
+ const m = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
1380
1380
  this._spherical.theta = he(
1381
1381
  this._spherical.theta,
1382
1382
  this._sphericalEnd.theta,
1383
1383
  this._thetaVelocity,
1384
- p,
1384
+ m,
1385
1385
  1 / 0,
1386
1386
  e
1387
1387
  ), this._needsUpdate = !0;
1388
1388
  }
1389
- if (A(s))
1389
+ if (S(s))
1390
1390
  this._phiVelocity.value = 0, this._spherical.phi = this._sphericalEnd.phi;
1391
1391
  else {
1392
- const p = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
1392
+ const m = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
1393
1393
  this._spherical.phi = he(
1394
1394
  this._spherical.phi,
1395
1395
  this._sphericalEnd.phi,
1396
1396
  this._phiVelocity,
1397
- p,
1397
+ m,
1398
1398
  1 / 0,
1399
1399
  e
1400
1400
  ), this._needsUpdate = !0;
1401
1401
  }
1402
- if (A(i))
1402
+ if (S(i))
1403
1403
  this._radiusVelocity.value = 0, this._spherical.radius = this._sphericalEnd.radius;
1404
1404
  else {
1405
- const p = this._isUserControllingDolly ? this.draggingSmoothTime : this.smoothTime;
1405
+ const m = this._isUserControllingDolly ? this.draggingSmoothTime : this.smoothTime;
1406
1406
  this._spherical.radius = he(
1407
1407
  this._spherical.radius,
1408
1408
  this._sphericalEnd.radius,
1409
1409
  this._radiusVelocity,
1410
- p,
1410
+ m,
1411
1411
  this.maxSpeed,
1412
1412
  e
1413
1413
  ), this._needsUpdate = !0;
1414
1414
  }
1415
- if (A(r.x) && A(r.y) && A(r.z))
1415
+ if (S(r.x) && S(r.y) && S(r.z))
1416
1416
  this._targetVelocity.set(0, 0, 0), this._target.copy(this._targetEnd);
1417
1417
  else {
1418
- const p = this._isUserControllingTruck ? this.draggingSmoothTime : this.smoothTime;
1418
+ const m = this._isUserControllingTruck ? this.draggingSmoothTime : this.smoothTime;
1419
1419
  Be(
1420
1420
  this._target,
1421
1421
  this._targetEnd,
1422
1422
  this._targetVelocity,
1423
- p,
1423
+ m,
1424
1424
  this.maxSpeed,
1425
1425
  e,
1426
1426
  this._target
1427
1427
  ), this._needsUpdate = !0;
1428
1428
  }
1429
- if (A(o.x) && A(o.y) && A(o.z))
1429
+ if (S(o.x) && S(o.y) && S(o.z))
1430
1430
  this._focalOffsetVelocity.set(0, 0, 0), this._focalOffset.copy(this._focalOffsetEnd);
1431
1431
  else {
1432
- const p = this._isUserControllingOffset ? this.draggingSmoothTime : this.smoothTime;
1432
+ const m = this._isUserControllingOffset ? this.draggingSmoothTime : this.smoothTime;
1433
1433
  Be(
1434
1434
  this._focalOffset,
1435
1435
  this._focalOffsetEnd,
1436
1436
  this._focalOffsetVelocity,
1437
- p,
1437
+ m,
1438
1438
  this.maxSpeed,
1439
1439
  e,
1440
1440
  this._focalOffset
1441
1441
  ), this._needsUpdate = !0;
1442
1442
  }
1443
- if (A(n))
1443
+ if (S(n))
1444
1444
  this._zoomVelocity.value = 0, this._zoom = this._zoomEnd;
1445
1445
  else {
1446
- const p = this._isUserControllingZoom ? this.draggingSmoothTime : this.smoothTime;
1446
+ const m = this._isUserControllingZoom ? this.draggingSmoothTime : this.smoothTime;
1447
1447
  this._zoom = he(
1448
1448
  this._zoom,
1449
1449
  this._zoomEnd,
1450
1450
  this._zoomVelocity,
1451
- p,
1451
+ m,
1452
1452
  1 / 0,
1453
1453
  e
1454
1454
  );
1455
1455
  }
1456
1456
  if (this.dollyToCursor) {
1457
1457
  if (Y(this._camera) && this._changedDolly !== 0) {
1458
- const p = this._spherical.radius - this._lastDistance, O = this._camera, v = this._getCameraDirection(ne), m = w.copy(v).cross(O.up).normalize();
1459
- m.lengthSq() === 0 && (m.x = 1);
1460
- const u = L.crossVectors(m, v), f = this._sphericalEnd.radius * Math.tan(O.getEffectiveFOV() * ie * 0.5), g = (this._sphericalEnd.radius - p - this._sphericalEnd.radius) / this._sphericalEnd.radius, C = X.copy(this._targetEnd).add(
1461
- m.multiplyScalar(
1462
- this._dollyControlCoord.x * f * O.aspect
1458
+ const m = this._spherical.radius - this._lastDistance, v = this._camera, p = this._getCameraDirection(ne), u = x.copy(p).cross(v.up).normalize();
1459
+ u.lengthSq() === 0 && (u.x = 1);
1460
+ const g = L.crossVectors(u, p), y = this._sphericalEnd.radius * Math.tan(v.getEffectiveFOV() * ie * 0.5), _ = (this._sphericalEnd.radius - m - this._sphericalEnd.radius) / this._sphericalEnd.radius, O = $.copy(this._targetEnd).add(
1461
+ u.multiplyScalar(
1462
+ this._dollyControlCoord.x * y * v.aspect
1463
1463
  )
1464
1464
  ).add(
1465
- u.multiplyScalar(this._dollyControlCoord.y * f)
1466
- ), y = w.copy(this._targetEnd).lerp(C, g), b = this._lastDollyDirection === G.IN && this._spherical.radius <= this.minDistance, E = this._lastDollyDirection === G.OUT && this.maxDistance <= this._spherical.radius;
1467
- if (this.infinityDolly && (b || E)) {
1468
- this._sphericalEnd.radius -= p, this._spherical.radius -= p;
1469
- const R = L.copy(v).multiplyScalar(-p);
1470
- y.add(R);
1465
+ g.multiplyScalar(this._dollyControlCoord.y * y)
1466
+ ), C = x.copy(this._targetEnd).lerp(O, _), w = this._lastDollyDirection === K.IN && this._spherical.radius <= this.minDistance, E = this._lastDollyDirection === K.OUT && this.maxDistance <= this._spherical.radius;
1467
+ if (this.infinityDolly && (w || E)) {
1468
+ this._sphericalEnd.radius -= m, this._spherical.radius -= m;
1469
+ const R = L.copy(p).multiplyScalar(-m);
1470
+ C.add(R);
1471
1471
  }
1472
- this._boundary.clampPoint(y, y);
1473
- const x = L.subVectors(y, this._targetEnd);
1474
- this._targetEnd.copy(y), this._target.add(x), this._changedDolly -= p, A(this._changedDolly) && (this._changedDolly = 0);
1475
- } else if (H(this._camera) && this._changedZoom !== 0) {
1476
- const p = this._zoom - this._lastZoom, O = this._camera, v = w.set(
1472
+ this._boundary.clampPoint(C, C);
1473
+ const b = L.subVectors(C, this._targetEnd);
1474
+ this._targetEnd.copy(C), this._target.add(b), this._changedDolly -= m, S(this._changedDolly) && (this._changedDolly = 0);
1475
+ } else if (j(this._camera) && this._changedZoom !== 0) {
1476
+ const m = this._zoom - this._lastZoom, v = this._camera, p = x.set(
1477
1477
  this._dollyControlCoord.x,
1478
1478
  this._dollyControlCoord.y,
1479
- (O.near + O.far) / (O.near - O.far)
1480
- ).unproject(O), m = L.set(0, 0, -1).applyQuaternion(O.quaternion), u = X.copy(v).add(m.multiplyScalar(-v.dot(O.up))), a = -(this._zoom - p - this._zoom) / this._zoom, g = this._getCameraDirection(ne), C = this._targetEnd.dot(g), y = w.copy(this._targetEnd).lerp(u, a), b = y.dot(g), E = g.multiplyScalar(
1481
- b - C
1479
+ (v.near + v.far) / (v.near - v.far)
1480
+ ).unproject(v), u = L.set(0, 0, -1).applyQuaternion(v.quaternion), g = $.copy(p).add(u.multiplyScalar(-p.dot(v.up))), l = -(this._zoom - m - this._zoom) / this._zoom, _ = this._getCameraDirection(ne), O = this._targetEnd.dot(_), C = x.copy(this._targetEnd).lerp(g, l), w = C.dot(_), E = _.multiplyScalar(
1481
+ w - O
1482
1482
  );
1483
- y.sub(E), this._boundary.clampPoint(y, y);
1484
- const x = L.subVectors(y, this._targetEnd);
1485
- this._targetEnd.copy(y), this._target.add(x), this._changedZoom -= p, A(this._changedZoom) && (this._changedZoom = 0);
1483
+ C.sub(E), this._boundary.clampPoint(C, C);
1484
+ const b = L.subVectors(C, this._targetEnd);
1485
+ this._targetEnd.copy(C), this._target.add(b), this._changedZoom -= m, S(this._changedZoom) && (this._changedZoom = 0);
1486
1486
  }
1487
1487
  }
1488
1488
  this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
1489
- const l = this._collisionTest();
1490
- this._spherical.radius = Math.min(this._spherical.radius, l), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!A(this._focalOffset.x) || !A(this._focalOffset.y) || !A(this._focalOffset.z)) && (F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), Z.setFromMatrixColumn(this._camera.matrix, 2), F.multiplyScalar(this._focalOffset.x), N.multiplyScalar(-this._focalOffset.y), Z.multiplyScalar(this._focalOffset.z), w.copy(F).add(N).add(Z), this._camera.position.add(w), this._camera.updateMatrixWorld()), this._boundaryEnclosesCamera && this._encloseToBoundary(
1489
+ const a = this._collisionTest();
1490
+ this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!S(this._focalOffset.x) || !S(this._focalOffset.y) || !S(this._focalOffset.z)) && (F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), Z.setFromMatrixColumn(this._camera.matrix, 2), F.multiplyScalar(this._focalOffset.x), N.multiplyScalar(-this._focalOffset.y), Z.multiplyScalar(this._focalOffset.z), x.copy(F).add(N).add(Z), this._camera.position.add(x), this._camera.updateMatrixWorld()), this._boundaryEnclosesCamera && this._encloseToBoundary(
1491
1491
  this._camera.position.copy(this._target),
1492
- w.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),
1492
+ x.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),
1493
1493
  1
1494
1494
  );
1495
- const _ = this._needsUpdate;
1496
- return _ && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : _ ? (this.dispatchEvent({ type: "update" }), A(t, this.restThreshold) && A(s, this.restThreshold) && A(i, this.restThreshold) && A(r.x, this.restThreshold) && A(r.y, this.restThreshold) && A(r.z, this.restThreshold) && A(o.x, this.restThreshold) && A(o.y, this.restThreshold) && A(o.z, this.restThreshold) && A(n, this.restThreshold) && !this._hasRested && (this._hasRested = !0, this.dispatchEvent({ type: "rest" }))) : !_ && this._updatedLastTime && (this._hasRested || (this._hasRested = !0, this.dispatchEvent({ type: "rest" })), this.dispatchEvent({ type: "sleep" })), this._lastDistance = this._spherical.radius, this._lastZoom = this._zoom, this._updatedLastTime = _, this._needsUpdate = !1, _;
1495
+ const f = this._needsUpdate;
1496
+ return f && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : f ? (this.dispatchEvent({ type: "update" }), S(t, this.restThreshold) && S(s, this.restThreshold) && S(i, this.restThreshold) && S(r.x, this.restThreshold) && S(r.y, this.restThreshold) && S(r.z, this.restThreshold) && S(o.x, this.restThreshold) && S(o.y, this.restThreshold) && S(o.z, this.restThreshold) && S(n, this.restThreshold) && !this._hasRested && (this._hasRested = !0, this.dispatchEvent({ type: "rest" }))) : !f && this._updatedLastTime && (this._hasRested || (this._hasRested = !0, this.dispatchEvent({ type: "rest" })), this.dispatchEvent({ type: "sleep" })), this._lastDistance = this._spherical.radius, this._lastZoom = this._zoom, this._updatedLastTime = f, this._needsUpdate = !1, f;
1497
1497
  }
1498
1498
  /**
1499
1499
  * Get all state in JSON string
@@ -1516,7 +1516,7 @@ class J extends Es {
1516
1516
  truckSpeed: this.truckSpeed,
1517
1517
  dollyToCursor: this.dollyToCursor,
1518
1518
  target: this._targetEnd.toArray(),
1519
- position: w.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),
1519
+ position: x.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),
1520
1520
  zoom: this._zoomEnd,
1521
1521
  focalOffset: this._focalOffsetEnd.toArray(),
1522
1522
  target0: this._target0.toArray(),
@@ -1534,7 +1534,7 @@ class J extends Es {
1534
1534
  fromJSON(e, t = !1) {
1535
1535
  const s = JSON.parse(e);
1536
1536
  this.enabled = s.enabled, this.minDistance = s.minDistance, this.maxDistance = oe(s.maxDistance), this.minZoom = s.minZoom, this.maxZoom = oe(s.maxZoom), this.minPolarAngle = s.minPolarAngle, this.maxPolarAngle = oe(s.maxPolarAngle), this.minAzimuthAngle = oe(s.minAzimuthAngle), this.maxAzimuthAngle = oe(s.maxAzimuthAngle), this.smoothTime = s.smoothTime, this.draggingSmoothTime = s.draggingSmoothTime, this.dollySpeed = s.dollySpeed, this.truckSpeed = s.truckSpeed, this.dollyToCursor = s.dollyToCursor, this._target0.fromArray(s.target0), this._position0.fromArray(s.position0), this._zoom0 = s.zoom0, this._focalOffset0.fromArray(s.focalOffset0), this.moveTo(s.target[0], s.target[1], s.target[2], t), z.setFromVector3(
1537
- w.fromArray(s.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)
1537
+ x.fromArray(s.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)
1538
1538
  ), this.rotateTo(z.theta, z.phi, t), this.dollyTo(z.radius, t), this.zoomTo(s.zoom, t), this.setFocalOffset(
1539
1539
  s.focalOffset[0],
1540
1540
  s.focalOffset[1],
@@ -1591,23 +1591,23 @@ class J extends Es {
1591
1591
  const i = t.lengthSq();
1592
1592
  if (i === 0)
1593
1593
  return e;
1594
- const r = L.copy(t).add(e), n = this._boundary.clampPoint(r, X).sub(r), l = n.lengthSq();
1595
- if (l === 0)
1594
+ const r = L.copy(t).add(e), n = this._boundary.clampPoint(r, $).sub(r), a = n.lengthSq();
1595
+ if (a === 0)
1596
1596
  return e.add(t);
1597
- if (l === i)
1597
+ if (a === i)
1598
1598
  return e;
1599
1599
  if (s === 0)
1600
1600
  return e.add(t).add(n);
1601
1601
  {
1602
- const d = 1 + s * l / t.dot(n);
1603
- return e.add(L.copy(t).multiplyScalar(d)).add(n.multiplyScalar(1 - s));
1602
+ const c = 1 + s * a / t.dot(n);
1603
+ return e.add(L.copy(t).multiplyScalar(c)).add(n.multiplyScalar(1 - s));
1604
1604
  }
1605
1605
  }
1606
1606
  _updateNearPlaneCorners() {
1607
1607
  if (Y(this._camera)) {
1608
1608
  const e = this._camera, t = e.near, s = e.getEffectiveFOV() * ie, i = Math.tan(s * 0.5) * t, r = i * e.aspect;
1609
1609
  this._nearPlaneCorners[0].set(-r, -i, 0), this._nearPlaneCorners[1].set(r, -i, 0), this._nearPlaneCorners[2].set(r, i, 0), this._nearPlaneCorners[3].set(-r, i, 0);
1610
- } else if (H(this._camera)) {
1610
+ } else if (j(this._camera)) {
1611
1611
  const e = this._camera, t = 1 / e.zoom, s = e.left * t, i = e.right * t, r = e.top * t, o = e.bottom * t;
1612
1612
  this._nearPlaneCorners[0].set(s, r, 0), this._nearPlaneCorners[1].set(i, r, 0), this._nearPlaneCorners[2].set(i, o, 0), this._nearPlaneCorners[3].set(s, o, 0);
1613
1613
  }
@@ -1618,13 +1618,13 @@ class J extends Es {
1618
1618
  if (!(this.colliderMeshes.length >= 1) || Ee(this._camera, "_collisionTest"))
1619
1619
  return e;
1620
1620
  const s = this._getTargetDirection(ne);
1621
- xe.lookAt(Ve, s, this._camera.up);
1621
+ be.lookAt(Ve, s, this._camera.up);
1622
1622
  for (let i = 0; i < 4; i++) {
1623
1623
  const r = L.copy(this._nearPlaneCorners[i]);
1624
- r.applyMatrix4(xe);
1625
- const o = X.addVectors(this._target, r);
1626
- pe.set(o, s), pe.far = this._spherical.radius + 1;
1627
- const n = pe.intersectObjects(this.colliderMeshes);
1624
+ r.applyMatrix4(be);
1625
+ const o = $.addVectors(this._target, r);
1626
+ me.set(o, s), me.far = this._spherical.radius + 1;
1627
+ const n = me.intersectObjects(this.colliderMeshes);
1628
1628
  n.length !== 0 && n[0].distance < e && (e = n[0].distance);
1629
1629
  }
1630
1630
  return e;
@@ -1692,23 +1692,23 @@ class J extends Es {
1692
1692
  }
1693
1693
  static createBoundingSphere(e, t = new T.Sphere()) {
1694
1694
  const s = t, i = s.center;
1695
- $.makeEmpty(), e.traverseVisible((o) => {
1696
- o.isMesh && $.expandByObject(o);
1697
- }), $.getCenter(i);
1695
+ X.makeEmpty(), e.traverseVisible((o) => {
1696
+ o.isMesh && X.expandByObject(o);
1697
+ }), X.getCenter(i);
1698
1698
  let r = 0;
1699
1699
  return e.traverseVisible((o) => {
1700
1700
  if (!o.isMesh) return;
1701
1701
  const n = o;
1702
1702
  if (!n.geometry) return;
1703
- const l = n.geometry.clone();
1704
- l.applyMatrix4(n.matrixWorld);
1705
- const _ = l.attributes.position;
1706
- for (let p = 0, O = _.count; p < O; p++)
1707
- w.fromBufferAttribute(_, p), r = Math.max(r, i.distanceToSquared(w));
1703
+ const a = n.geometry.clone();
1704
+ a.applyMatrix4(n.matrixWorld);
1705
+ const f = a.attributes.position;
1706
+ for (let m = 0, v = f.count; m < v; m++)
1707
+ x.fromBufferAttribute(f, m), r = Math.max(r, i.distanceToSquared(x));
1708
1708
  }), s.radius = Math.sqrt(r), s;
1709
1709
  }
1710
1710
  }
1711
- var Ae = { exports: {} }, Q = typeof Reflect == "object" ? Reflect : null, Ke = Q && typeof Q.apply == "function" ? Q.apply : function(e, t, s) {
1711
+ var Se = { exports: {} }, Q = typeof Reflect == "object" ? Reflect : null, Ge = Q && typeof Q.apply == "function" ? Q.apply : function(e, t, s) {
1712
1712
  return Function.prototype.apply.call(e, t, s);
1713
1713
  }, ue;
1714
1714
  Q && typeof Q.ownKeys == "function" ? ue = Q.ownKeys : Object.getOwnPropertySymbols ? ue = function(e) {
@@ -1716,52 +1716,52 @@ Q && typeof Q.ownKeys == "function" ? ue = Q.ownKeys : Object.getOwnPropertySymb
1716
1716
  } : ue = function(e) {
1717
1717
  return Object.getOwnPropertyNames(e);
1718
1718
  };
1719
- function bs(h) {
1719
+ function Ts(h) {
1720
1720
  console && console.warn && console.warn(h);
1721
1721
  }
1722
1722
  var _t = Number.isNaN || function(e) {
1723
1723
  return e !== e;
1724
1724
  };
1725
- function S() {
1726
- S.init.call(this);
1725
+ function A() {
1726
+ A.init.call(this);
1727
1727
  }
1728
- Ae.exports = S;
1729
- Ae.exports.once = Ps;
1730
- S.EventEmitter = S;
1731
- S.prototype._events = void 0;
1732
- S.prototype._eventsCount = 0;
1733
- S.prototype._maxListeners = void 0;
1734
- var Xe = 10;
1728
+ Se.exports = A;
1729
+ Se.exports.once = Ls;
1730
+ A.EventEmitter = A;
1731
+ A.prototype._events = void 0;
1732
+ A.prototype._eventsCount = 0;
1733
+ A.prototype._maxListeners = void 0;
1734
+ var $e = 10;
1735
1735
  function ge(h) {
1736
1736
  if (typeof h != "function")
1737
1737
  throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof h);
1738
1738
  }
1739
- Object.defineProperty(S, "defaultMaxListeners", {
1739
+ Object.defineProperty(A, "defaultMaxListeners", {
1740
1740
  enumerable: !0,
1741
1741
  get: function() {
1742
- return Xe;
1742
+ return $e;
1743
1743
  },
1744
1744
  set: function(h) {
1745
1745
  if (typeof h != "number" || h < 0 || _t(h))
1746
1746
  throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + h + ".");
1747
- Xe = h;
1747
+ $e = h;
1748
1748
  }
1749
1749
  });
1750
- S.init = function() {
1750
+ A.init = function() {
1751
1751
  (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
1752
1752
  };
1753
- S.prototype.setMaxListeners = function(e) {
1753
+ A.prototype.setMaxListeners = function(e) {
1754
1754
  if (typeof e != "number" || e < 0 || _t(e))
1755
1755
  throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + ".");
1756
1756
  return this._maxListeners = e, this;
1757
1757
  };
1758
1758
  function gt(h) {
1759
- return h._maxListeners === void 0 ? S.defaultMaxListeners : h._maxListeners;
1759
+ return h._maxListeners === void 0 ? A.defaultMaxListeners : h._maxListeners;
1760
1760
  }
1761
- S.prototype.getMaxListeners = function() {
1761
+ A.prototype.getMaxListeners = function() {
1762
1762
  return gt(this);
1763
1763
  };
1764
- S.prototype.emit = function(e) {
1764
+ A.prototype.emit = function(e) {
1765
1765
  for (var t = [], s = 1; s < arguments.length; s++) t.push(arguments[s]);
1766
1766
  var i = e === "error", r = this._events;
1767
1767
  if (r !== void 0)
@@ -1775,17 +1775,17 @@ S.prototype.emit = function(e) {
1775
1775
  var n = new Error("Unhandled error." + (o ? " (" + o.message + ")" : ""));
1776
1776
  throw n.context = o, n;
1777
1777
  }
1778
- var l = r[e];
1779
- if (l === void 0)
1778
+ var a = r[e];
1779
+ if (a === void 0)
1780
1780
  return !1;
1781
- if (typeof l == "function")
1782
- Ke(l, this, t);
1781
+ if (typeof a == "function")
1782
+ Ge(a, this, t);
1783
1783
  else
1784
- for (var d = l.length, _ = Et(l, d), s = 0; s < d; ++s)
1785
- Ke(_[s], this, t);
1784
+ for (var c = a.length, f = Et(a, c), s = 0; s < c; ++s)
1785
+ Ge(f[s], this, t);
1786
1786
  return !0;
1787
1787
  };
1788
- function vt(h, e, t, s) {
1788
+ function yt(h, e, t, s) {
1789
1789
  var i, r, o;
1790
1790
  if (ge(t), r = h._events, r === void 0 ? (r = h._events = /* @__PURE__ */ Object.create(null), h._eventsCount = 0) : (r.newListener !== void 0 && (h.emit(
1791
1791
  "newListener",
@@ -1796,32 +1796,32 @@ function vt(h, e, t, s) {
1796
1796
  else if (typeof o == "function" ? o = r[e] = s ? [t, o] : [o, t] : s ? o.unshift(t) : o.push(t), i = gt(h), i > 0 && o.length > i && !o.warned) {
1797
1797
  o.warned = !0;
1798
1798
  var n = new Error("Possible EventEmitter memory leak detected. " + o.length + " " + String(e) + " listeners added. Use emitter.setMaxListeners() to increase limit");
1799
- n.name = "MaxListenersExceededWarning", n.emitter = h, n.type = e, n.count = o.length, bs(n);
1799
+ n.name = "MaxListenersExceededWarning", n.emitter = h, n.type = e, n.count = o.length, Ts(n);
1800
1800
  }
1801
1801
  return h;
1802
1802
  }
1803
- S.prototype.addListener = function(e, t) {
1804
- return vt(this, e, t, !1);
1803
+ A.prototype.addListener = function(e, t) {
1804
+ return yt(this, e, t, !1);
1805
1805
  };
1806
- S.prototype.on = S.prototype.addListener;
1807
- S.prototype.prependListener = function(e, t) {
1808
- return vt(this, e, t, !0);
1806
+ A.prototype.on = A.prototype.addListener;
1807
+ A.prototype.prependListener = function(e, t) {
1808
+ return yt(this, e, t, !0);
1809
1809
  };
1810
1810
  function ws() {
1811
1811
  if (!this.fired)
1812
1812
  return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
1813
1813
  }
1814
- function yt(h, e, t) {
1814
+ function vt(h, e, t) {
1815
1815
  var s = { fired: !1, wrapFn: void 0, target: h, type: e, listener: t }, i = ws.bind(s);
1816
1816
  return i.listener = t, s.wrapFn = i, i;
1817
1817
  }
1818
- S.prototype.once = function(e, t) {
1819
- return ge(t), this.on(e, yt(this, e, t)), this;
1818
+ A.prototype.once = function(e, t) {
1819
+ return ge(t), this.on(e, vt(this, e, t)), this;
1820
1820
  };
1821
- S.prototype.prependOnceListener = function(e, t) {
1822
- return ge(t), this.prependListener(e, yt(this, e, t)), this;
1821
+ A.prototype.prependOnceListener = function(e, t) {
1822
+ return ge(t), this.prependListener(e, vt(this, e, t)), this;
1823
1823
  };
1824
- S.prototype.removeListener = function(e, t) {
1824
+ A.prototype.removeListener = function(e, t) {
1825
1825
  var s, i, r, o, n;
1826
1826
  if (ge(t), i = this._events, i === void 0)
1827
1827
  return this;
@@ -1841,8 +1841,8 @@ S.prototype.removeListener = function(e, t) {
1841
1841
  }
1842
1842
  return this;
1843
1843
  };
1844
- S.prototype.off = S.prototype.removeListener;
1845
- S.prototype.removeAllListeners = function(e) {
1844
+ A.prototype.off = A.prototype.removeListener;
1845
+ A.prototype.removeAllListeners = function(e) {
1846
1846
  var t, s, i;
1847
1847
  if (s = this._events, s === void 0)
1848
1848
  return this;
@@ -1866,18 +1866,18 @@ function Ct(h, e, t) {
1866
1866
  if (s === void 0)
1867
1867
  return [];
1868
1868
  var i = s[e];
1869
- return i === void 0 ? [] : typeof i == "function" ? t ? [i.listener || i] : [i] : t ? Ls(i) : Et(i, i.length);
1869
+ return i === void 0 ? [] : typeof i == "function" ? t ? [i.listener || i] : [i] : t ? bs(i) : Et(i, i.length);
1870
1870
  }
1871
- S.prototype.listeners = function(e) {
1871
+ A.prototype.listeners = function(e) {
1872
1872
  return Ct(this, e, !0);
1873
1873
  };
1874
- S.prototype.rawListeners = function(e) {
1874
+ A.prototype.rawListeners = function(e) {
1875
1875
  return Ct(this, e, !1);
1876
1876
  };
1877
- S.listenerCount = function(h, e) {
1877
+ A.listenerCount = function(h, e) {
1878
1878
  return typeof h.listenerCount == "function" ? h.listenerCount(e) : Ot.call(h, e);
1879
1879
  };
1880
- S.prototype.listenerCount = Ot;
1880
+ A.prototype.listenerCount = Ot;
1881
1881
  function Ot(h) {
1882
1882
  var e = this._events;
1883
1883
  if (e !== void 0) {
@@ -1889,7 +1889,7 @@ function Ot(h) {
1889
1889
  }
1890
1890
  return 0;
1891
1891
  }
1892
- S.prototype.eventNames = function() {
1892
+ A.prototype.eventNames = function() {
1893
1893
  return this._eventsCount > 0 ? ue(this._events) : [];
1894
1894
  };
1895
1895
  function Et(h, e) {
@@ -1902,12 +1902,12 @@ function xs(h, e) {
1902
1902
  h[e] = h[e + 1];
1903
1903
  h.pop();
1904
1904
  }
1905
- function Ls(h) {
1905
+ function bs(h) {
1906
1906
  for (var e = new Array(h.length), t = 0; t < e.length; ++t)
1907
1907
  e[t] = h[t].listener || h[t];
1908
1908
  return e;
1909
1909
  }
1910
- function Ps(h, e) {
1910
+ function Ls(h, e) {
1911
1911
  return new Promise(function(t, s) {
1912
1912
  function i(o) {
1913
1913
  h.removeListener(e, r), s(o);
@@ -1915,10 +1915,10 @@ function Ps(h, e) {
1915
1915
  function r() {
1916
1916
  typeof h.removeListener == "function" && h.removeListener("error", i), t([].slice.call(arguments));
1917
1917
  }
1918
- Tt(h, e, r, { once: !0 }), e !== "error" && Ss(h, i, { once: !0 });
1918
+ Tt(h, e, r, { once: !0 }), e !== "error" && Ps(h, i, { once: !0 });
1919
1919
  });
1920
1920
  }
1921
- function Ss(h, e, t) {
1921
+ function Ps(h, e, t) {
1922
1922
  typeof h.on == "function" && Tt(h, "error", e, t);
1923
1923
  }
1924
1924
  function Tt(h, e, t, s) {
@@ -1931,43 +1931,43 @@ function Tt(h, e, t, s) {
1931
1931
  else
1932
1932
  throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof h);
1933
1933
  }
1934
- var ve = Ae.exports;
1934
+ var ye = Se.exports;
1935
1935
  const As = {
1936
1936
  antialias: !1,
1937
1937
  devicePixelRatio: window.devicePixelRatio,
1938
1938
  powerPreference: "high-performance",
1939
1939
  toneMappingExposure: 1,
1940
1940
  alpha: !1,
1941
- outputColorSpace: ns.sRGB,
1941
+ outputColorSpace: os.sRGB,
1942
1942
  logarithmicDepthBuffer: !1,
1943
1943
  preserveDrawingBuffer: !1,
1944
1944
  stencil: !1,
1945
1945
  depth: !1
1946
1946
  };
1947
- class Ms {
1947
+ class Ss {
1948
1948
  constructor(e) {
1949
1949
  this.options = e;
1950
1950
  const { width: t, height: s, rendererParams: i } = e, {
1951
1951
  alpha: r,
1952
1952
  devicePixelRatio: o,
1953
1953
  antialias: n,
1954
- powerPreference: l,
1955
- toneMappingExposure: d,
1956
- outputColorSpace: _,
1957
- logarithmicDepthBuffer: p,
1958
- preserveDrawingBuffer: O,
1959
- stencil: v,
1960
- depth: m
1961
- } = i, u = new Ut({
1954
+ powerPreference: a,
1955
+ toneMappingExposure: c,
1956
+ outputColorSpace: f,
1957
+ logarithmicDepthBuffer: m,
1958
+ preserveDrawingBuffer: v,
1959
+ stencil: p,
1960
+ depth: u
1961
+ } = i, g = new Ut({
1962
1962
  alpha: r,
1963
1963
  antialias: n,
1964
- powerPreference: l,
1965
- logarithmicDepthBuffer: p,
1966
- preserveDrawingBuffer: O,
1967
- stencil: v,
1968
- depth: m
1964
+ powerPreference: a,
1965
+ logarithmicDepthBuffer: m,
1966
+ preserveDrawingBuffer: v,
1967
+ stencil: p,
1968
+ depth: u
1969
1969
  });
1970
- u.setSize(t, s), u.setPixelRatio(o), u.toneMappingExposure = d, u.outputColorSpace = _, this.renderer = u;
1970
+ g.setSize(t, s), g.setPixelRatio(o), g.toneMappingExposure = c, g.outputColorSpace = f, this.renderer = g;
1971
1971
  }
1972
1972
  setSize(e, t) {
1973
1973
  this.renderer.setSize(e, t);
@@ -1979,35 +1979,26 @@ class Ms {
1979
1979
  this.renderer.render(e, t);
1980
1980
  }
1981
1981
  setViewport(e) {
1982
- var l, d;
1983
- const { x: t, y: s, width: i, height: r } = e, o = (l = e.scissor) != null ? l : !1, n = (d = e.scissorTest) != null ? d : !1;
1982
+ var a, c;
1983
+ const { x: t, y: s, width: i, height: r } = e, o = (a = e.scissor) != null ? a : !1, n = (c = e.scissorTest) != null ? c : !1;
1984
1984
  this.renderer.setViewport(t, s, i, r), o && (this.renderer.setScissor(t, s, i, r), this.renderer.setScissorTest(n));
1985
1985
  }
1986
- setViewPadding(e = 0, t = 0, s = 0, i = 0) {
1987
- const { width: r, height: o } = this.renderer.getSize(new B()), n = {
1988
- x: i,
1989
- y: s,
1990
- width: r - i - t,
1991
- height: o - e - s
1992
- };
1993
- this.setViewport(n);
1994
- }
1995
1986
  dispose() {
1996
1987
  var e, t;
1997
1988
  this.setSize(1, 1), (e = this.renderer) == null || e.clear(), (t = this.renderer) == null || t.dispose();
1998
1989
  }
1999
1990
  }
2000
- const Rs = {
1991
+ const Ms = {
2001
1992
  antialias: !0,
2002
1993
  devicePixelRatio: window.devicePixelRatio
2003
1994
  };
2004
- class Ds {
1995
+ class Rs {
2005
1996
  constructor(e) {
2006
1997
  this.options = e;
2007
- const { width: t, height: s, rendererParams: i, renderer: r } = e, { devicePixelRatio: o, antialias: n } = i, l = new r({
1998
+ const { width: t, height: s, rendererParams: i, renderer: r } = e, { devicePixelRatio: o, antialias: n } = i, a = new r({
2008
1999
  antialias: n
2009
2000
  });
2010
- l.setSize(t, s), l.setPixelRatio(o), this.renderer = l;
2001
+ a.setSize(t, s), a.setPixelRatio(o), this.renderer = a;
2011
2002
  }
2012
2003
  setSize(e, t) {
2013
2004
  this.renderer.setSize(e, t);
@@ -2020,7 +2011,7 @@ class Ds {
2020
2011
  this.setSize(1, 1), (e = this.renderer) == null || e.clear(), (t = this.renderer) == null || t.dispose();
2021
2012
  }
2022
2013
  }
2023
- let Us = class {
2014
+ let Ds = class {
2024
2015
  constructor() {
2025
2016
  this.mask = 1;
2026
2017
  }
@@ -2048,10 +2039,10 @@ let Us = class {
2048
2039
  };
2049
2040
  class ee {
2050
2041
  constructor() {
2051
- this.event = new ve.EventEmitter(), this.controllerMap = /* @__PURE__ */ new Map(), this.activeIndex = -1, this.activeControllerSet = /* @__PURE__ */ new Set();
2042
+ this.event = new ye.EventEmitter(), this.controllerMap = /* @__PURE__ */ new Map(), this.activeIndex = -1, this.activeControllerSet = /* @__PURE__ */ new Set();
2052
2043
  }
2053
2044
  addController(e, t) {
2054
- const s = new Us();
2045
+ const s = new Ds();
2055
2046
  return s.disableAll(), t !== void 0 && s.set(t), this.controllerMap.set(e, s), t === this.activeIndex && this.activeControllerSet.add(e), e;
2056
2047
  }
2057
2048
  removePage(e, t) {
@@ -2079,22 +2070,22 @@ class ee {
2079
2070
  }), this.removePage(0), this.controllerMap.clear(), this.event.removeAllListeners(), this.activeControllerSet.clear();
2080
2071
  }
2081
2072
  }
2082
- const bt = {
2073
+ const wt = {
2083
2074
  fov: 45,
2084
2075
  near: 1,
2085
2076
  far: 1e3,
2086
2077
  up: new I(0, 1, 0)
2087
2078
  };
2088
- class zs extends ee {
2079
+ class Us extends ee {
2089
2080
  constructor(e) {
2090
2081
  super(), this.width = 0, this.height = 0, this.width = e.width, this.height = e.height;
2091
2082
  }
2092
2083
  get camera() {
2093
2084
  return this.controller;
2094
2085
  }
2095
- addPerspectiveCamera(e = bt, t) {
2096
- const { fov: s, far: i, near: r, up: o, aspect: n } = e, l = n != null ? n : this.width / this.height, d = new zt(s, l, r, i);
2097
- return d.up = o, this.addController(d, t);
2086
+ addPerspectiveCamera(e = wt, t) {
2087
+ const { fov: s, far: i, near: r, up: o, aspect: n } = e, a = n != null ? n : this.width / this.height, c = new zt(s, a, r, i);
2088
+ return c.up = o, this.addController(c, t);
2098
2089
  }
2099
2090
  setPageActive(e) {
2100
2091
  super.setPageActive(e, (t, s) => {
@@ -2160,15 +2151,15 @@ class zs extends ee {
2160
2151
  s[7],
2161
2152
  s[11],
2162
2153
  s[15]
2163
- ), { width: n, height: l } = this, d = n / l;
2164
- (this.camera.fov !== t.fov || this.camera.aspect !== d || !this.camera.matrixWorld.equals(r) || !this.camera.matrixWorldInverse.equals(o)) && (this.camera.fov = t.fov, this.camera.updateProjectionMatrix(), this.camera.matrixAutoUpdate = !1, this.camera.matrixWorld.copy(r), this.camera.matrixWorldInverse.copy(o), this.camera.aspect = d, this.camera.updateProjectionMatrix());
2154
+ ), { width: n, height: a } = this, c = n / a;
2155
+ (this.camera.fov !== t.fov || this.camera.aspect !== c || !this.camera.matrixWorld.equals(r) || !this.camera.matrixWorldInverse.equals(o)) && (this.camera.fov = t.fov, this.camera.updateProjectionMatrix(), this.camera.matrixAutoUpdate = !1, this.camera.matrixWorld.copy(r), this.camera.matrixWorldInverse.copy(o), this.camera.aspect = c, this.camera.updateProjectionMatrix());
2165
2156
  }
2166
2157
  }
2167
2158
  }
2168
- const ks = {
2159
+ const zs = {
2169
2160
  background: null
2170
2161
  };
2171
- class Fs extends ee {
2162
+ class ks extends ee {
2172
2163
  get scene() {
2173
2164
  return this.controller;
2174
2165
  }
@@ -2191,7 +2182,7 @@ class Fs extends ee {
2191
2182
  });
2192
2183
  }
2193
2184
  }
2194
- class Ns {
2185
+ class Fs {
2195
2186
  constructor(e) {
2196
2187
  this.helpers = {}, this.options = e;
2197
2188
  }
@@ -2208,11 +2199,11 @@ class Ns {
2208
2199
  else if (e.isDirectionalLight)
2209
2200
  i = new Nt(e, 1);
2210
2201
  else if (e.isSpotLight)
2211
- i = new jt(e);
2202
+ i = new Ht(e);
2212
2203
  else if (e.isHemisphereLight)
2213
2204
  i = new It(e, 10);
2214
2205
  else if (e.isRectAreaLight)
2215
- i = new cs(e);
2206
+ i = new hs(e);
2216
2207
  else {
2217
2208
  const r = new at();
2218
2209
  if (r.setFromObject(e, !0), r.isEmpty() === !1) {
@@ -2226,7 +2217,7 @@ class Ns {
2226
2217
  }
2227
2218
  }
2228
2219
  addViewHelper() {
2229
- const { cameraController: e, container: t } = this.options, s = new ds(e.camera, t);
2220
+ const { cameraController: e, container: t } = this.options, s = new cs(e.camera, t);
2230
2221
  t.addEventListener("pointerdown", (i) => {
2231
2222
  i.preventDefault(), s.handleClick(i);
2232
2223
  }), this.viewHelper = s;
@@ -2258,8 +2249,8 @@ class Ns {
2258
2249
  const { cameraController: i } = this.options;
2259
2250
  Object.values(this.helpers).forEach((n) => {
2260
2251
  if (n.update && n.update(), n instanceof Ue) {
2261
- const l = n.material, { object: d } = l.userData;
2262
- d && n.box.setFromObject(d, !0);
2252
+ const a = n.material, { object: c } = a.userData;
2253
+ c && n.box.setFromObject(c, !0);
2263
2254
  }
2264
2255
  }), ((r = this.viewHelper) == null ? void 0 : r.animating) === !0 && (this.viewHelper.update(e), (o = t.cameraControls) == null || o.setPosition(
2265
2256
  ...i.camera.position.toArray()
@@ -2276,7 +2267,7 @@ class Ns {
2276
2267
  this.helpers = {}, (e = this.viewHelper) == null || e.dispose();
2277
2268
  }
2278
2269
  }
2279
- class js extends ee {
2270
+ class Ns extends ee {
2280
2271
  constructor(e) {
2281
2272
  super(), this.autoRotateSpeed = 0, this.options = e;
2282
2273
  const t = {
@@ -2320,13 +2311,13 @@ class js extends ee {
2320
2311
  });
2321
2312
  }
2322
2313
  update(e, t) {
2323
- super.update(e, t), this.autoRotateSpeed && this.cameraControls && (this.cameraControls.azimuthAngle += this.autoRotateSpeed * e * Ht.DEG2RAD);
2314
+ super.update(e, t), this.autoRotateSpeed && this.cameraControls && (this.cameraControls.azimuthAngle += this.autoRotateSpeed * e * jt.DEG2RAD);
2324
2315
  }
2325
2316
  }
2326
- class Is {
2317
+ class Hs {
2327
2318
  constructor(e) {
2328
- this.event = new ve.EventEmitter();
2329
- const { renderer: t, scene: s, camera: i } = e, r = new ps(
2319
+ this.event = new ye.EventEmitter();
2320
+ const { renderer: t, scene: s, camera: i } = e, r = new ds(
2330
2321
  i,
2331
2322
  t.domElement
2332
2323
  );
@@ -2335,8 +2326,8 @@ class Is {
2335
2326
  if (s.add(o), +Zt < 170) {
2336
2327
  const n = r._root;
2337
2328
  n.dispose = () => {
2338
- n.traverse((l) => {
2339
- l.geometry && l.geometry.dispose(), l.material && l.material.dispose();
2329
+ n.traverse((a) => {
2330
+ a.geometry && a.geometry.dispose(), a.material && a.material.dispose();
2340
2331
  });
2341
2332
  }, r.dispose = () => {
2342
2333
  r.disconnect(), n.dispose();
@@ -2392,8 +2383,8 @@ class Is {
2392
2383
  this.event.removeAllListeners(), (e = this.controls) == null || e.dispose();
2393
2384
  }
2394
2385
  }
2395
- const $e = new I(), Hs = new lt(), qe = new I(), j = new W(), Bs = new W();
2396
- class Vs {
2386
+ const Xe = new I(), Is = new lt(), qe = new I(), H = new W(), js = new W();
2387
+ class Bs {
2397
2388
  /**
2398
2389
  * Constructs a new CSS3D renderer.
2399
2390
  *
@@ -2405,69 +2396,69 @@ class Vs {
2405
2396
  const n = {
2406
2397
  camera: { style: "" },
2407
2398
  objects: /* @__PURE__ */ new WeakMap()
2408
- }, l = e.element !== void 0 ? e.element : document.createElement("div");
2409
- l.style.overflow = "hidden", this.domElement = l;
2410
- const d = document.createElement("div");
2411
- d.style.transformOrigin = "0 0", d.style.pointerEvents = "none", l.appendChild(d);
2412
- const _ = document.createElement("div");
2413
- _.style.transformStyle = "preserve-3d", d.appendChild(_), this.getSize = function() {
2399
+ }, a = e.element !== void 0 ? e.element : document.createElement("div");
2400
+ a.style.overflow = "hidden", this.domElement = a;
2401
+ const c = document.createElement("div");
2402
+ c.style.transformOrigin = "0 0", c.style.pointerEvents = "none", a.appendChild(c);
2403
+ const f = document.createElement("div");
2404
+ f.style.transformStyle = "preserve-3d", c.appendChild(f), this.getSize = function() {
2414
2405
  return {
2415
2406
  width: s,
2416
2407
  height: i
2417
2408
  };
2418
- }, this.render = function(f, a) {
2419
- const g = a.projectionMatrix.elements[5] * o;
2420
- a.view && a.view.enabled ? (d.style.transform = `translate( ${-a.view.offsetX * (s / a.view.width)}px, ${-a.view.offsetY * (i / a.view.height)}px )`, d.style.transform += `scale( ${a.view.fullWidth / a.view.width}, ${a.view.fullHeight / a.view.height} )`) : d.style.transform = "", f.matrixWorldAutoUpdate === !0 && f.updateMatrixWorld(), a.parent === null && a.matrixWorldAutoUpdate === !0 && a.updateMatrixWorld();
2421
- let C, y;
2422
- a.isOrthographicCamera && (C = -(a.right + a.left) / 2, y = (a.top + a.bottom) / 2);
2423
- const b = a.view && a.view.enabled ? a.view.height / a.view.fullHeight : 1, E = a.isOrthographicCamera ? `scale( ${b} )scale(` + g + ")translate(" + p(C) + "px," + p(y) + "px)" + O(a.matrixWorldInverse) : `scale( ${b} )translateZ(` + g + "px)" + O(a.matrixWorldInverse), R = (a.isPerspectiveCamera ? "perspective(" + g + "px) " : "") + E + "translate(" + r + "px," + o + "px)";
2424
- n.camera.style !== R && (_.style.transform = R, n.camera.style = R), u(f, f, a);
2425
- }, this.setSize = function(f, a) {
2426
- s = f, i = a, r = s / 2, o = i / 2, l.style.width = f + "px", l.style.height = a + "px", d.style.width = f + "px", d.style.height = a + "px", _.style.width = f + "px", _.style.height = a + "px";
2409
+ }, this.render = function(y, l) {
2410
+ const _ = l.projectionMatrix.elements[5] * o;
2411
+ l.view && l.view.enabled ? (c.style.transform = `translate( ${-l.view.offsetX * (s / l.view.width)}px, ${-l.view.offsetY * (i / l.view.height)}px )`, c.style.transform += `scale( ${l.view.fullWidth / l.view.width}, ${l.view.fullHeight / l.view.height} )`) : c.style.transform = "", y.matrixWorldAutoUpdate === !0 && y.updateMatrixWorld(), l.parent === null && l.matrixWorldAutoUpdate === !0 && l.updateMatrixWorld();
2412
+ let O, C;
2413
+ l.isOrthographicCamera && (O = -(l.right + l.left) / 2, C = (l.top + l.bottom) / 2);
2414
+ const w = l.view && l.view.enabled ? l.view.height / l.view.fullHeight : 1, E = l.isOrthographicCamera ? `scale( ${w} )scale(` + _ + ")translate(" + m(O) + "px," + m(C) + "px)" + v(l.matrixWorldInverse) : `scale( ${w} )translateZ(` + _ + "px)" + v(l.matrixWorldInverse), R = (l.isPerspectiveCamera ? "perspective(" + _ + "px) " : "") + E + "translate(" + r + "px," + o + "px)";
2415
+ n.camera.style !== R && (f.style.transform = R, n.camera.style = R), g(y, y, l);
2416
+ }, this.setSize = function(y, l) {
2417
+ s = y, i = l, r = s / 2, o = i / 2, a.style.width = y + "px", a.style.height = l + "px", c.style.width = y + "px", c.style.height = l + "px", f.style.width = y + "px", f.style.height = l + "px";
2427
2418
  };
2428
- function p(f) {
2429
- return Math.abs(f) < 1e-10 ? 0 : f;
2419
+ function m(y) {
2420
+ return Math.abs(y) < 1e-10 ? 0 : y;
2430
2421
  }
2431
- function O(f) {
2432
- const a = f.elements;
2433
- return "matrix3d(" + p(a[0]) + "," + p(-a[1]) + "," + p(a[2]) + "," + p(a[3]) + "," + p(a[4]) + "," + p(-a[5]) + "," + p(a[6]) + "," + p(a[7]) + "," + p(a[8]) + "," + p(-a[9]) + "," + p(a[10]) + "," + p(a[11]) + "," + p(a[12]) + "," + p(-a[13]) + "," + p(a[14]) + "," + p(a[15]) + ")";
2422
+ function v(y) {
2423
+ const l = y.elements;
2424
+ return "matrix3d(" + m(l[0]) + "," + m(-l[1]) + "," + m(l[2]) + "," + m(l[3]) + "," + m(l[4]) + "," + m(-l[5]) + "," + m(l[6]) + "," + m(l[7]) + "," + m(l[8]) + "," + m(-l[9]) + "," + m(l[10]) + "," + m(l[11]) + "," + m(l[12]) + "," + m(-l[13]) + "," + m(l[14]) + "," + m(l[15]) + ")";
2434
2425
  }
2435
- function v(f) {
2436
- const a = f.elements;
2437
- return "translate(-50%,-50%)" + ("matrix3d(" + p(a[0]) + "," + p(a[1]) + "," + p(a[2]) + "," + p(a[3]) + "," + p(-a[4]) + "," + p(-a[5]) + "," + p(-a[6]) + "," + p(-a[7]) + "," + p(a[8]) + "," + p(a[9]) + "," + p(a[10]) + "," + p(a[11]) + "," + p(a[12]) + "," + p(a[13]) + "," + p(a[14]) + "," + p(a[15]) + ")");
2426
+ function p(y) {
2427
+ const l = y.elements;
2428
+ return "translate(-50%,-50%)" + ("matrix3d(" + m(l[0]) + "," + m(l[1]) + "," + m(l[2]) + "," + m(l[3]) + "," + m(-l[4]) + "," + m(-l[5]) + "," + m(-l[6]) + "," + m(-l[7]) + "," + m(l[8]) + "," + m(l[9]) + "," + m(l[10]) + "," + m(l[11]) + "," + m(l[12]) + "," + m(l[13]) + "," + m(l[14]) + "," + m(l[15]) + ")");
2438
2429
  }
2439
- function m(f) {
2440
- f.isCSS3DObject && (f.element.style.display = "none");
2441
- for (let a = 0, g = f.children.length; a < g; a++)
2442
- m(f.children[a]);
2430
+ function u(y) {
2431
+ y.isCSS3DObject && (y.element.style.display = "none");
2432
+ for (let l = 0, _ = y.children.length; l < _; l++)
2433
+ u(y.children[l]);
2443
2434
  }
2444
- function u(f, a, g, C) {
2445
- if (f.visible === !1) {
2446
- m(f);
2435
+ function g(y, l, _, O) {
2436
+ if (y.visible === !1) {
2437
+ u(y);
2447
2438
  return;
2448
2439
  }
2449
- if (f.isCSS3DObject) {
2450
- const y = f.layers.test(g.layers) === !0, b = f.element;
2451
- if (b.style.display = y === !0 ? "" : "none", y === !0) {
2452
- f.onBeforeRender(t, a, g);
2440
+ if (y.isCSS3DObject) {
2441
+ const C = y.layers.test(_.layers) === !0, w = y.element;
2442
+ if (w.style.display = C === !0 ? "" : "none", C === !0) {
2443
+ y.onBeforeRender(t, l, _);
2453
2444
  let E;
2454
- f.isCSS3DSprite ? (j.copy(g.matrixWorldInverse), j.transpose(), f.rotation2D !== 0 && j.multiply(Bs.makeRotationZ(f.rotation2D)), f.matrixWorld.decompose($e, Hs, qe), j.setPosition($e), j.scale(qe), j.elements[3] = 0, j.elements[7] = 0, j.elements[11] = 0, j.elements[15] = 1, E = v(j)) : E = v(f.matrixWorld);
2455
- const x = n.objects.get(f);
2456
- if (x === void 0 || x.style !== E) {
2457
- b.style.transform = E;
2445
+ y.isCSS3DSprite ? (H.copy(_.matrixWorldInverse), H.transpose(), y.rotation2D !== 0 && H.multiply(js.makeRotationZ(y.rotation2D)), y.matrixWorld.decompose(Xe, Is, qe), H.setPosition(Xe), H.scale(qe), H.elements[3] = 0, H.elements[7] = 0, H.elements[11] = 0, H.elements[15] = 1, E = p(H)) : E = p(y.matrixWorld);
2446
+ const b = n.objects.get(y);
2447
+ if (b === void 0 || b.style !== E) {
2448
+ w.style.transform = E;
2458
2449
  const R = { style: E };
2459
- n.objects.set(f, R);
2450
+ n.objects.set(y, R);
2460
2451
  }
2461
- b.parentNode !== _ && _.appendChild(b), f.onAfterRender(t, a, g);
2452
+ w.parentNode !== f && f.appendChild(w), y.onAfterRender(t, l, _);
2462
2453
  }
2463
2454
  }
2464
- for (let y = 0, b = f.children.length; y < b; y++)
2465
- u(f.children[y], a, g);
2455
+ for (let C = 0, w = y.children.length; C < w; C++)
2456
+ g(y.children[C], l, _);
2466
2457
  }
2467
2458
  }
2468
2459
  }
2469
2460
  const q = new I(), Qe = new W(), Je = new W(), et = new I(), tt = new I();
2470
- class Ys {
2461
+ class Vs {
2471
2462
  /**
2472
2463
  * Constructs a new CSS2D renderer.
2473
2464
  *
@@ -2478,69 +2469,69 @@ class Ys {
2478
2469
  let s, i, r, o;
2479
2470
  const n = {
2480
2471
  objects: /* @__PURE__ */ new WeakMap()
2481
- }, l = e.element !== void 0 ? e.element : document.createElement("div");
2482
- l.style.overflow = "hidden", this.domElement = l, this.getSize = function() {
2472
+ }, a = e.element !== void 0 ? e.element : document.createElement("div");
2473
+ a.style.overflow = "hidden", this.domElement = a, this.getSize = function() {
2483
2474
  return {
2484
2475
  width: s,
2485
2476
  height: i
2486
2477
  };
2487
- }, this.render = function(m, u) {
2488
- m.matrixWorldAutoUpdate === !0 && m.updateMatrixWorld(), u.parent === null && u.matrixWorldAutoUpdate === !0 && u.updateMatrixWorld(), Qe.copy(u.matrixWorldInverse), Je.multiplyMatrices(u.projectionMatrix, Qe), _(m, m, u), v(m);
2489
- }, this.setSize = function(m, u) {
2490
- s = m, i = u, r = s / 2, o = i / 2, l.style.width = m + "px", l.style.height = u + "px";
2478
+ }, this.render = function(u, g) {
2479
+ u.matrixWorldAutoUpdate === !0 && u.updateMatrixWorld(), g.parent === null && g.matrixWorldAutoUpdate === !0 && g.updateMatrixWorld(), Qe.copy(g.matrixWorldInverse), Je.multiplyMatrices(g.projectionMatrix, Qe), f(u, u, g), p(u);
2480
+ }, this.setSize = function(u, g) {
2481
+ s = u, i = g, r = s / 2, o = i / 2, a.style.width = u + "px", a.style.height = g + "px";
2491
2482
  };
2492
- function d(m) {
2493
- m.isCSS2DObject && (m.element.style.display = "none");
2494
- for (let u = 0, f = m.children.length; u < f; u++)
2495
- d(m.children[u]);
2483
+ function c(u) {
2484
+ u.isCSS2DObject && (u.element.style.display = "none");
2485
+ for (let g = 0, y = u.children.length; g < y; g++)
2486
+ c(u.children[g]);
2496
2487
  }
2497
- function _(m, u, f) {
2498
- if (m.visible === !1) {
2499
- d(m);
2488
+ function f(u, g, y) {
2489
+ if (u.visible === !1) {
2490
+ c(u);
2500
2491
  return;
2501
2492
  }
2502
- if (m.isCSS2DObject) {
2503
- q.setFromMatrixPosition(m.matrixWorld), q.applyMatrix4(Je);
2504
- const a = q.z >= -1 && q.z <= 1 && m.layers.test(f.layers) === !0, g = m.element;
2505
- g.style.display = a === !0 ? "" : "none", a === !0 && (m.onBeforeRender(t, u, f), g.style.transform = "translate(" + -100 * m.center.x + "%," + -100 * m.center.y + "%)translate(" + (q.x * r + r) + "px," + (-q.y * o + o) + "px)", g.parentNode !== l && l.appendChild(g), m.onAfterRender(t, u, f));
2506
- const C = {
2507
- distanceToCameraSquared: p(f, m)
2493
+ if (u.isCSS2DObject) {
2494
+ q.setFromMatrixPosition(u.matrixWorld), q.applyMatrix4(Je);
2495
+ const l = q.z >= -1 && q.z <= 1 && u.layers.test(y.layers) === !0, _ = u.element;
2496
+ _.style.display = l === !0 ? "" : "none", l === !0 && (u.onBeforeRender(t, g, y), _.style.transform = "translate(" + -100 * u.center.x + "%," + -100 * u.center.y + "%)translate(" + (q.x * r + r) + "px," + (-q.y * o + o) + "px)", _.parentNode !== a && a.appendChild(_), u.onAfterRender(t, g, y));
2497
+ const O = {
2498
+ distanceToCameraSquared: m(y, u)
2508
2499
  };
2509
- n.objects.set(m, C);
2500
+ n.objects.set(u, O);
2510
2501
  }
2511
- for (let a = 0, g = m.children.length; a < g; a++)
2512
- _(m.children[a], u, f);
2502
+ for (let l = 0, _ = u.children.length; l < _; l++)
2503
+ f(u.children[l], g, y);
2513
2504
  }
2514
- function p(m, u) {
2515
- return et.setFromMatrixPosition(m.matrixWorld), tt.setFromMatrixPosition(u.matrixWorld), et.distanceToSquared(tt);
2505
+ function m(u, g) {
2506
+ return et.setFromMatrixPosition(u.matrixWorld), tt.setFromMatrixPosition(g.matrixWorld), et.distanceToSquared(tt);
2516
2507
  }
2517
- function O(m) {
2518
- const u = [];
2519
- return m.traverseVisible(function(f) {
2520
- f.isCSS2DObject && u.push(f);
2521
- }), u;
2508
+ function v(u) {
2509
+ const g = [];
2510
+ return u.traverseVisible(function(y) {
2511
+ y.isCSS2DObject && g.push(y);
2512
+ }), g;
2522
2513
  }
2523
- function v(m) {
2524
- const u = O(m).sort(function(a, g) {
2525
- if (a.renderOrder !== g.renderOrder)
2526
- return g.renderOrder - a.renderOrder;
2527
- const C = n.objects.get(a).distanceToCameraSquared, y = n.objects.get(g).distanceToCameraSquared;
2528
- return C - y;
2529
- }), f = u.length;
2530
- for (let a = 0, g = u.length; a < g; a++)
2531
- u[a].element.style.zIndex = f - a;
2514
+ function p(u) {
2515
+ const g = v(u).sort(function(l, _) {
2516
+ if (l.renderOrder !== _.renderOrder)
2517
+ return _.renderOrder - l.renderOrder;
2518
+ const O = n.objects.get(l).distanceToCameraSquared, C = n.objects.get(_).distanceToCameraSquared;
2519
+ return O - C;
2520
+ }), y = g.length;
2521
+ for (let l = 0, _ = g.length; l < _; l++)
2522
+ g[l].element.style.zIndex = y - l;
2532
2523
  }
2533
2524
  }
2534
2525
  }
2535
2526
  const st = {
2536
2527
  zIndex: "auto"
2537
2528
  };
2538
- class Zs {
2529
+ class Ys {
2539
2530
  constructor(e) {
2540
2531
  this.container = e;
2541
2532
  }
2542
2533
  addRenderer(e, t) {
2543
- const s = t.container || this.container, i = s.offsetWidth, r = s.offsetHeight, o = e === "css2d" ? new Ys() : new Vs();
2534
+ const s = t.container || this.container, i = s.offsetWidth, r = s.offsetHeight, o = e === "css2d" ? new Vs() : new Bs();
2544
2535
  o.domElement.style.position = "absolute", o.domElement.style.top = "0", o.domElement.style.pointerEvents = "none", o.domElement.style.zIndex = t.zIndex, o.setSize(i, r), s.appendChild(o.domElement), e === "css2d" ? this.css2Drenderer = o : e === "css3d" && (this.css3Drenderer = o);
2545
2536
  }
2546
2537
  setSize(e, t) {
@@ -2556,7 +2547,7 @@ class Zs {
2556
2547
  (e = this.css2Drenderer) == null || e.domElement.remove(), (t = this.css3Drenderer) == null || t.domElement.remove(), this.css2Drenderer = void 0, this.css3Drenderer = void 0;
2557
2548
  }
2558
2549
  }
2559
- const Ws = {
2550
+ const Zs = {
2560
2551
  name: "OutputShader",
2561
2552
  uniforms: {
2562
2553
  tDiffuse: { value: null },
@@ -2650,11 +2641,11 @@ const Ws = {
2650
2641
  }`
2651
2642
  )
2652
2643
  };
2653
- class Gs extends fs {
2644
+ class Ws extends us {
2654
2645
  constructor() {
2655
2646
  super();
2656
- const e = Ws;
2657
- this.uniforms = Gt.clone(e.uniforms), this.material = new Kt({
2647
+ const e = Zs;
2648
+ this.uniforms = Kt.clone(e.uniforms), this.material = new Gt({
2658
2649
  name: e.name,
2659
2650
  uniforms: this.uniforms,
2660
2651
  vertexShader: e.vertexShader,
@@ -2663,8 +2654,8 @@ class Gs extends fs {
2663
2654
  }
2664
2655
  }
2665
2656
  const Ks = (h) => {
2666
- const e = new _s(
2667
- new Xt({
2657
+ const e = new fs(
2658
+ new $t({
2668
2659
  uniforms: {
2669
2660
  baseTexture: { value: null },
2670
2661
  bloomTexture: { value: h.renderTarget2.texture },
@@ -2698,36 +2689,36 @@ const Ks = (h) => {
2698
2689
  "baseTexture"
2699
2690
  );
2700
2691
  return e.needsSwap = !0, e;
2701
- }, Le = 1, me = !1, Xs = new $t({ color: "black" }), $s = new ct({
2692
+ }, Le = 1, pe = !1, Gs = new Xt({ color: "black" }), $s = new ct({
2702
2693
  color: "black",
2703
2694
  sizeAttenuation: !1
2704
- }), qs = new ct({
2695
+ }), Xs = new ct({
2705
2696
  color: "black",
2706
2697
  sizeAttenuation: !0
2707
- }), Qs = new dt({
2698
+ }), qs = new dt({
2708
2699
  color: "black",
2709
2700
  sizeAttenuation: !0
2710
- }), Js = new dt({
2701
+ }), Qs = new dt({
2711
2702
  color: "black",
2712
2703
  sizeAttenuation: !1
2713
- }), ei = new ut({
2704
+ }), Js = new ut({
2714
2705
  color: "black",
2715
2706
  sizeAttenuation: 0,
2716
2707
  lineWidth: 0
2717
- }), ti = {
2708
+ }), ei = {
2718
2709
  kernelRadius: 8,
2719
2710
  minDistance: 5e-3,
2720
2711
  maxDistance: 0.1
2721
- }, si = {
2712
+ }, ti = {
2722
2713
  threshold: 0,
2723
2714
  strength: 0.4,
2724
2715
  radius: 0.1,
2725
2716
  bloomAlphaType: 0
2726
- }, ii = {
2717
+ }, si = {
2727
2718
  multisampling: 4,
2728
2719
  premultiplieAlpha: !1
2729
2720
  };
2730
- class ri {
2721
+ class ii {
2731
2722
  constructor(e) {
2732
2723
  this.bloomComposerActive = !1, this.active = !0, this.bloomSelection = /* @__PURE__ */ new Set(), this.bloomLayer = new qt(), this.bloomMaterials = {}, this.bloomVisible = {}, this.bloomComposerRenderIng = !1, this.pipViewportState = null, this.options = e;
2733
2724
  const {
@@ -2737,23 +2728,23 @@ class ri {
2737
2728
  composerParams: r
2738
2729
  } = e, { renderer: o } = t;
2739
2730
  this.renderer = o;
2740
- const { multisampling: n } = r, { maxSamples: l } = o.capabilities, d = o.getDrawingBufferSize(new B()), _ = new Qt(
2741
- d.width,
2742
- d.height,
2731
+ const { multisampling: n } = r, { maxSamples: a } = o.capabilities, c = o.getDrawingBufferSize(new B()), f = new Qt(
2732
+ c.width,
2733
+ c.height,
2743
2734
  {
2744
- samples: Math.min(n, l),
2735
+ samples: Math.min(n, a),
2745
2736
  type: Jt
2746
2737
  }
2747
- ), p = new ke(o, _), O = this.getSize();
2748
- p.setSize(O.width, O.height);
2749
- const v = new ms(
2738
+ ), m = new ke(o, f), v = this.getSize();
2739
+ m.setSize(v.width, v.height);
2740
+ const p = new ms(
2750
2741
  s.scene,
2751
2742
  i.camera
2752
2743
  );
2753
- p.addPass(v), this.scene = s.scene, this.camera = i.camera, this.finalComposer = p, this.renderPass = v, i.event.on("pageChange", (m) => {
2754
- this.changeCamera(m);
2755
- }), s.event.on("pageChange", (m) => {
2756
- this.changeScene(m);
2744
+ m.addPass(p), this.scene = s.scene, this.camera = i.camera, this.finalComposer = m, this.renderPass = p, i.event.on("pageChange", (u) => {
2745
+ this.changeCamera(u);
2746
+ }), s.event.on("pageChange", (u) => {
2747
+ this.changeScene(u);
2757
2748
  });
2758
2749
  }
2759
2750
  changeCamera(e) {
@@ -2763,28 +2754,28 @@ class ri {
2763
2754
  this.renderPass.scene = e, this.ssaoPass && (this.ssaoPass.scene = e), this.scene = e;
2764
2755
  }
2765
2756
  addOutputPass() {
2766
- const { premultiplieAlpha: e } = this.options.composerParams, t = new Gs();
2757
+ const { premultiplieAlpha: e } = this.options.composerParams, t = new Ws();
2767
2758
  this.outputPass = t, this.setPremultiplieAlpha(e), this.finalComposer.addPass(t);
2768
2759
  }
2769
2760
  setPremultiplieAlpha(e) {
2770
2761
  this.outputPass && (this.outputPass.uniforms.premultiplieAlpha.value = e ? 1 : 0);
2771
2762
  }
2772
2763
  addSSAOPass(e) {
2773
- const { scene: t, camera: s, renderer: i } = this, r = i.getSize(new B()), o = r.width, n = r.height, l = new us(t, s, o, n);
2774
- l.kernelRadius = e.kernelRadius, l.minDistance = e.minDistance, l.maxDistance = e.maxDistance, this.ssaoPass = l, this.finalComposer.addPass(l);
2764
+ const { scene: t, camera: s, renderer: i } = this, r = i.getSize(new B()), o = r.width, n = r.height, a = new ps(t, s, o, n);
2765
+ a.kernelRadius = e.kernelRadius, a.minDistance = e.minDistance, a.maxDistance = e.maxDistance, this.ssaoPass = a, this.finalComposer.addPass(a);
2775
2766
  }
2776
2767
  addBloomPass(e) {
2777
- const { renderer: t } = this, { threshold: s, strength: i, radius: r, bloomAlphaType: o } = e, n = new gs(
2768
+ const { renderer: t } = this, { threshold: s, strength: i, radius: r, bloomAlphaType: o } = e, n = new _s(
2778
2769
  new B(window.innerWidth, window.innerHeight),
2779
2770
  i,
2780
2771
  r,
2781
2772
  s
2782
2773
  );
2783
2774
  this.bloomPass = n;
2784
- const l = new ke(t);
2785
- l.renderToScreen = !1, l.addPass(this.renderPass), l.addPass(n), this.bloomComposer = l;
2786
- const d = Ks(l);
2787
- d.uniforms.bloomAlphaType.value = o, this.bloomComposer = l, this.finalComposer.addPass(d), this.mixPass = d, this.bloomLayer.set(Le);
2775
+ const a = new ke(t);
2776
+ a.renderToScreen = !1, a.addPass(this.renderPass), a.addPass(n), this.bloomComposer = a;
2777
+ const c = Ks(a);
2778
+ c.uniforms.bloomAlphaType.value = o, this.bloomComposer = a, this.finalComposer.addPass(c), this.mixPass = c, this.bloomLayer.set(Le);
2788
2779
  }
2789
2780
  setBloomSelection(e, t) {
2790
2781
  if (!this.bloomComposer) {
@@ -2816,9 +2807,9 @@ class ri {
2816
2807
  s.isTransformControls || s.isTransformControlsRoot || s.type === "RectAreaLightHelper" ? e.push(s) : t.push(s);
2817
2808
  }), t.forEach((s) => {
2818
2809
  s.traverse((i) => {
2819
- var l;
2810
+ var a;
2820
2811
  const r = i, o = i, n = i;
2821
- (l = r.material) != null && l.isShadowMaterial ? e.push(r) : r.material && this.bloomLayer.test(r.layers) === !1 && (this.bloomMaterials[r.uuid] = r.material, o.isSprite ? o.material.sizeAttenuation ? o.material = Qs : o.material = Js : r.material instanceof ut ? r.material = ei : n.isPoints ? n.material.sizeAttenuation ? n.material = qs : n.material = $s : r.material = Xs);
2812
+ (a = r.material) != null && a.isShadowMaterial ? e.push(r) : r.material && this.bloomLayer.test(r.layers) === !1 && (this.bloomMaterials[r.uuid] = r.material, o.isSprite ? o.material.sizeAttenuation ? o.material = qs : o.material = Qs : r.material instanceof ut ? r.material = Js : n.isPoints ? n.material.sizeAttenuation ? n.material = Xs : n.material = $s : r.material = Gs);
2822
2813
  });
2823
2814
  }), e.forEach((s) => {
2824
2815
  this.bloomVisible[s.uuid] = s.visible, s.visible = !1;
@@ -2862,7 +2853,7 @@ class ri {
2862
2853
  this.bloomMaterials = {}, this.bloomVisible = {}, this.bloomSelection.clear(), this.finalComposer.dispose(), (e = this.bloomComposer) == null || e.dispose();
2863
2854
  }
2864
2855
  }
2865
- class it extends pt {
2856
+ class it extends mt {
2866
2857
  constructor(e) {
2867
2858
  super(e), this.options = { type: "image" };
2868
2859
  }
@@ -2871,44 +2862,44 @@ class it extends pt {
2871
2862
  }
2872
2863
  load(e, t, s, i) {
2873
2864
  let r, o;
2874
- this.options.type === "image" ? (o = document.createElement("img"), r = new fe(o)) : this.options.type === "video" ? (o = document.createElement("video"), o.preload = "auto", o.autoplay = !1, o.loop = !1, o.muted = !0, o.setAttribute("webkit-playsinline", "webkit-playsinline"), o.setAttribute("playsinline", ""), r = new mt(o)) : r = new fe();
2875
- const n = new Se(this.manager);
2865
+ this.options.type === "image" ? (o = document.createElement("img"), r = new fe(o)) : this.options.type === "video" ? (o = document.createElement("video"), o.preload = "auto", o.autoplay = !1, o.loop = !1, o.muted = !0, o.setAttribute("webkit-playsinline", "webkit-playsinline"), o.setAttribute("playsinline", ""), r = new pt(o)) : r = new fe();
2866
+ const n = new Ae(this.manager);
2876
2867
  return n.setResponseType("blob"), n.setRequestHeader(this.requestHeader), n.setPath(this.path), n.setWithCredentials(this.withCredentials), n.load(
2877
2868
  e,
2878
- (l) => {
2879
- let d = l;
2880
- const _ = e.split(".").pop(), p = this.options.type === "image" ? `image/${_ || "png"}` : `video/${_ || "mp4"}`;
2881
- d = d.slice(0, l.size, p);
2882
- const O = () => {
2883
- o.removeEventListener("load", v, !1), o.removeEventListener("error", m, !1);
2884
- }, v = () => {
2885
- O(), r.needsUpdate = !0, t && t(r);
2886
- }, m = (f) => {
2887
- O(), i && i(f), this.manager.itemError(e), this.manager.itemEnd(e);
2869
+ (a) => {
2870
+ let c = a;
2871
+ const f = e.split(".").pop(), m = this.options.type === "image" ? `image/${f || "png"}` : `video/${f || "mp4"}`;
2872
+ c = c.slice(0, a.size, m);
2873
+ const v = () => {
2874
+ o.removeEventListener("load", p, !1), o.removeEventListener("error", u, !1);
2875
+ }, p = () => {
2876
+ v(), r.needsUpdate = !0, t && t(r);
2877
+ }, u = (y) => {
2878
+ v(), i && i(y), this.manager.itemError(e), this.manager.itemEnd(e);
2888
2879
  };
2889
- o.addEventListener("load", v, !1), o.addEventListener("error", m, !1);
2890
- const u = window.URL.createObjectURL(d);
2891
- o.src = u;
2880
+ o.addEventListener("load", p, !1), o.addEventListener("error", u, !1);
2881
+ const g = window.URL.createObjectURL(c);
2882
+ o.src = g;
2892
2883
  },
2893
2884
  s,
2894
2885
  i
2895
2886
  ), r;
2896
2887
  }
2897
2888
  }
2898
- class oi extends pt {
2889
+ class ri extends mt {
2899
2890
  constructor(e) {
2900
2891
  super(e);
2901
2892
  }
2902
2893
  load(e, t, s, i) {
2903
- const r = new Se(this.manager);
2894
+ const r = new Ae(this.manager);
2904
2895
  r.setResponseType("blob"), r.setRequestHeader(this.requestHeader), r.setPath(this.path), r.setWithCredentials(this.withCredentials), r.load(
2905
2896
  e,
2906
2897
  (o) => {
2907
- const n = o, l = new DecompressionStream("gzip"), d = n.stream().pipeThrough(l);
2908
- new Response(d).json().then((p) => {
2909
- t == null || t(p);
2910
- }).catch((p) => {
2911
- i == null || i(p);
2898
+ const n = o, a = new DecompressionStream("gzip"), c = n.stream().pipeThrough(a);
2899
+ new Response(c).json().then((m) => {
2900
+ t == null || t(m);
2901
+ }).catch((m) => {
2902
+ i == null || i(m);
2912
2903
  });
2913
2904
  },
2914
2905
  s,
@@ -2916,7 +2907,7 @@ class oi extends pt {
2916
2907
  );
2917
2908
  }
2918
2909
  }
2919
- const ni = {
2910
+ const oi = {
2920
2911
  images: ["png", "jpg", "jpeg", "ico", "webp", "avif"],
2921
2912
  media: ["mp4", "webm", "ogg"],
2922
2913
  gltf: ["gltf", "glb"],
@@ -2925,9 +2916,9 @@ const ni = {
2925
2916
  exr: ["exr"],
2926
2917
  lottie: ["lottie.json"]
2927
2918
  };
2928
- class ai {
2919
+ class ni {
2929
2920
  constructor(e) {
2930
- this.loadObj = [], this.delLoadArr = [], this.assets = /* @__PURE__ */ new Map(), this.event = new ve.EventEmitter(), this.options = U({
2921
+ this.loadObj = [], this.delLoadArr = [], this.assets = /* @__PURE__ */ new Map(), this.event = new ye.EventEmitter(), this.options = U({
2931
2922
  simpleTexture4deleted: !1,
2932
2923
  prefix: ""
2933
2924
  }, e), this.loadingManager = new es(
@@ -2968,7 +2959,7 @@ class ai {
2968
2959
  if (e.endsWith("json.gzip"))
2969
2960
  return "gzipJson";
2970
2961
  } else return;
2971
- for (const [i, r] of Object.entries(ni))
2962
+ for (const [i, r] of Object.entries(oi))
2972
2963
  if (r.includes(t))
2973
2964
  return i;
2974
2965
  }
@@ -2978,15 +2969,15 @@ class ai {
2978
2969
  if (e === "media")
2979
2970
  return this.videoTextureLoader || (this.videoTextureLoader = new it(this.loadingManager), this.videoTextureLoader.setOptions({ type: "video" }), this.options.prefix && this.videoTextureLoader.setPath(this.options.prefix)), this.videoTextureLoader;
2980
2971
  if (e === "gltf" && (t != null && t.dracoPath))
2981
- return this.dracoGltfLoader || (this.dracoGltfLoader = new Ne(this.loadingManager), this.dracoLoader = new vs(), this.dracoLoader.setDecoderPath(t == null ? void 0 : t.dracoPath), this.dracoGltfLoader.setDRACOLoader(this.dracoLoader), this.options.prefix && this.dracoGltfLoader.setPath(this.options.prefix)), this.dracoGltfLoader;
2972
+ return this.dracoGltfLoader || (this.dracoGltfLoader = new Ne(this.loadingManager), this.dracoLoader = new gs(), this.dracoLoader.setDecoderPath(t == null ? void 0 : t.dracoPath), this.dracoGltfLoader.setDRACOLoader(this.dracoLoader), this.options.prefix && this.dracoGltfLoader.setPath(this.options.prefix)), this.dracoGltfLoader;
2982
2973
  if (e === "gltf")
2983
2974
  return this.gltfLoader || (this.gltfLoader = new Ne(this.loadingManager), this.options.prefix && this.gltfLoader.setPath(this.options.prefix)), this.gltfLoader;
2984
2975
  if (e === "lottie")
2985
- return this.lottieLoader || (this.lottieLoader = new Cs(this.loadingManager), this.options.prefix && this.lottieLoader.setPath(this.options.prefix)), this.lottieLoader;
2976
+ return this.lottieLoader || (this.lottieLoader = new vs(this.loadingManager), this.options.prefix && this.lottieLoader.setPath(this.options.prefix)), this.lottieLoader;
2986
2977
  if (e === "gzipJson")
2987
- return this.gzipJsonLoader || (this.gzipJsonLoader = new oi(this.loadingManager), this.options.prefix && this.gzipJsonLoader.setPath(this.options.prefix)), this.gzipJsonLoader;
2978
+ return this.gzipJsonLoader || (this.gzipJsonLoader = new ri(this.loadingManager), this.options.prefix && this.gzipJsonLoader.setPath(this.options.prefix)), this.gzipJsonLoader;
2988
2979
  if (e === "json")
2989
- return this.jsonLoader || (this.jsonLoader = new Se(this.loadingManager), this.jsonLoader.setResponseType("json"), this.options.prefix && this.jsonLoader.setPath(this.options.prefix)), this.jsonLoader;
2980
+ return this.jsonLoader || (this.jsonLoader = new Ae(this.loadingManager), this.jsonLoader.setResponseType("json"), this.options.prefix && this.jsonLoader.setPath(this.options.prefix)), this.jsonLoader;
2990
2981
  if (e === "exr")
2991
2982
  return this.exrLoader || (this.exrLoader = new ys(this.loadingManager), this.options.prefix && this.exrLoader.setPath(this.options.prefix)), this.exrLoader;
2992
2983
  }
@@ -3007,7 +2998,7 @@ class ai {
3007
2998
  get textureAssets() {
3008
2999
  const e = /* @__PURE__ */ new Map();
3009
3000
  return this.assets.forEach((t, s) => {
3010
- (t instanceof fe || t instanceof ts || t instanceof mt) && e.set(s, t);
3001
+ (t instanceof fe || t instanceof ts || t instanceof pt) && e.set(s, t);
3011
3002
  }), e;
3012
3003
  }
3013
3004
  loadAll() {
@@ -3020,11 +3011,11 @@ class ai {
3020
3011
  }
3021
3012
  load(e, t) {
3022
3013
  return se(this, null, function* () {
3023
- var n, l;
3014
+ var n, a;
3024
3015
  const s = (n = t == null ? void 0 : t.type) != null ? n : this.getAssetType(e);
3025
3016
  if (!s)
3026
3017
  return;
3027
- const i = (t == null ? void 0 : t.cache) !== !1, r = Os();
3018
+ const i = (t == null ? void 0 : t.cache) !== !1, r = Cs();
3028
3019
  if (i) {
3029
3020
  if (this.assets.has(e))
3030
3021
  return this.assets.get(e);
@@ -3032,14 +3023,14 @@ class ai {
3032
3023
  }
3033
3024
  const o = this.getLoader(s, t);
3034
3025
  try {
3035
- const d = yield o.loadAsync(e);
3036
- if (this.assets.set(e, d), r.resolve(d), s === "images" || s === "media" || s === "exr" || s === "lottie") {
3037
- (t == null ? void 0 : t.colorCorrection) !== !1 && as({ texture: d });
3038
- const _ = (l = t == null ? void 0 : t.anisotropy) != null ? l : this.options.anisotropy;
3039
- d.anisotropy = _;
3026
+ const c = yield o.loadAsync(e);
3027
+ if (this.assets.set(e, c), r.resolve(c), s === "images" || s === "media" || s === "exr" || s === "lottie") {
3028
+ (t == null ? void 0 : t.colorCorrection) !== !1 && ns({ texture: c });
3029
+ const f = (a = t == null ? void 0 : t.anisotropy) != null ? a : this.options.anisotropy;
3030
+ c.anisotropy = f;
3040
3031
  }
3041
- return d;
3042
- } catch (d) {
3032
+ return c;
3033
+ } catch (c) {
3043
3034
  r.reject(`Failed to load ${e}`);
3044
3035
  return;
3045
3036
  }
@@ -3052,18 +3043,18 @@ class ai {
3052
3043
  const t = /* @__PURE__ */ new Set(), s = this.textureAssets;
3053
3044
  e.traverse((r) => {
3054
3045
  const o = r;
3055
- o.material && (Array.isArray(o.material) ? o.material : [o.material]).forEach((l) => {
3046
+ o.material && (Array.isArray(o.material) ? o.material : [o.material]).forEach((a) => {
3056
3047
  [
3057
- l.map,
3058
- l.emissiveMap,
3059
- l.normalMap,
3060
- l.roughnessMap,
3061
- l.metalnessMap,
3062
- l.aoMap
3063
- ].forEach((d) => {
3064
- if (d) {
3065
- const _ = this.getSrcByAsset(d, s);
3066
- _ && t.add(_);
3048
+ a.map,
3049
+ a.emissiveMap,
3050
+ a.normalMap,
3051
+ a.roughnessMap,
3052
+ a.metalnessMap,
3053
+ a.aoMap
3054
+ ].forEach((c) => {
3055
+ if (c) {
3056
+ const f = this.getSrcByAsset(c, s);
3057
+ f && t.add(f);
3067
3058
  }
3068
3059
  });
3069
3060
  });
@@ -3078,10 +3069,10 @@ class ai {
3078
3069
  this.assets.clear(), (e = this.dracoLoader) == null || e.dispose(), this.event.removeAllListeners(), this.delLoadArr.length = 0, this.loadObj.length = 0;
3079
3070
  }
3080
3071
  }
3081
- const li = {
3072
+ const ai = {
3082
3073
  prefix: ""
3083
3074
  };
3084
- class hi extends ee {
3075
+ class li extends ee {
3085
3076
  get loader() {
3086
3077
  return this.controller;
3087
3078
  }
@@ -3089,7 +3080,7 @@ class hi extends ee {
3089
3080
  super(), this.options = e;
3090
3081
  }
3091
3082
  addLoader(e, t) {
3092
- const { loaderParams: s } = this.options, i = new ai(te(U({}, s), {
3083
+ const { loaderParams: s } = this.options, i = new ni(te(U({}, s), {
3093
3084
  scene: e
3094
3085
  }));
3095
3086
  return this.addController(i, t);
@@ -3100,15 +3091,6 @@ class hi extends ee {
3100
3091
  });
3101
3092
  }
3102
3093
  }
3103
- class ci extends hs {
3104
- constructor(e) {
3105
- super(), this.options = U({}, e);
3106
- }
3107
- create() {
3108
- var e;
3109
- this.object3d = (e = this.options.scene) != null ? e : new nt();
3110
- }
3111
- }
3112
3094
  function rt(h) {
3113
3095
  let e = !1, t = [];
3114
3096
  return function(...s) {
@@ -3117,7 +3099,7 @@ function rt(h) {
3117
3099
  }));
3118
3100
  };
3119
3101
  }
3120
- class di {
3102
+ class hi {
3121
3103
  constructor(e) {
3122
3104
  var t;
3123
3105
  this.enabled = !0, this.pickFunctionsMap = /* @__PURE__ */ new Map(), this.pickNodeFunctionsMap = /* @__PURE__ */ new Map(), this.pickFunctionsMapIndex = -1, this.pickNodeFunctionsMapIndex = -1, this.activeObjects = /* @__PURE__ */ new Set(), this.prevActiveObjects = /* @__PURE__ */ new Set(), this.objCallbackMap = /* @__PURE__ */ new Map(), this.pickListener = {
@@ -3132,37 +3114,32 @@ class di {
3132
3114
  return;
3133
3115
  r.preventDefault();
3134
3116
  const o = e === "move" ? t : s, n = [];
3135
- if (this.pickFunctionsMap.forEach((m) => {
3136
- o.has(m.type) && n.push(te(U({}, m), {
3137
- objArr: m.objArr instanceof Function ? m.objArr() : m.objArr
3117
+ if (this.pickFunctionsMap.forEach((p) => {
3118
+ o.has(p.type) && n.push(te(U({}, p), {
3119
+ objArr: p.objArr instanceof Function ? p.objArr() : p.objArr
3138
3120
  }));
3139
3121
  }), n.length === 0) return;
3140
3122
  this.activeObjects.clear(), this.objCallbackMap.clear();
3141
- const l = this.objCallbackMap, d = [];
3142
- for (const m of n)
3143
- for (const u of m.objArr) {
3123
+ const a = this.objCallbackMap;
3124
+ for (const p of n)
3125
+ for (const u of p.objArr) {
3144
3126
  if (!u.object3d || !u.visibleWithAncestors) continue;
3145
- l.has(u) || (l.set(u, /* @__PURE__ */ new Map()), d.push(u));
3146
- const f = l.get(u);
3147
- f.has(m.type) || f.set(m.type, []), f.get(m.type).push(m.cb);
3127
+ a.has(u) || a.set(u, /* @__PURE__ */ new Map());
3128
+ const g = a.get(u);
3129
+ g.has(p.type) || g.set(p.type, []), g.get(p.type).push(p.cb);
3148
3130
  }
3149
- if (d.length === 0) return;
3150
- const _ = d.map((m) => m.object3d);
3151
- _.forEach((m) => {
3152
- m.isGroup && m.traverse((u) => {
3153
- u instanceof ss && _.push(u);
3154
- });
3155
- });
3156
- const p = (v = this.pencil.pick(r, _, !1)) == null ? void 0 : v.intersects;
3157
- if (!p || p.length === 0)
3131
+ if (a.size === 0) return;
3132
+ const c = [...a.keys()].map((p) => p.object3d);
3133
+ console.time(`Pick:listener:${e}:pick`);
3134
+ const f = (v = this.pencil.pick(r, c, !0)) == null ? void 0 : v.intersects;
3135
+ if (console.timeEnd(`Pick:listener:${e}:pick`), !f || f.length === 0)
3158
3136
  e === "down" ? this.handleDownOutside(r) : e === "move" && this.handleLeaveEvents(r);
3159
3137
  else {
3160
- this.sortIntersections(p);
3161
- const m = p[0];
3162
- this.processIntersection(m, r, e);
3138
+ const p = f[0];
3139
+ this.processIntersection(p, r, e);
3163
3140
  }
3164
- const O = this.prevActiveObjects;
3165
- this.prevActiveObjects = this.activeObjects, this.activeObjects = O, this.activeObjects.clear();
3141
+ const m = this.prevActiveObjects;
3142
+ this.prevActiveObjects = this.activeObjects, this.activeObjects = m, this.activeObjects.clear();
3166
3143
  };
3167
3144
  this.domElement.addEventListener(
3168
3145
  `pointer${e}`,
@@ -3170,9 +3147,6 @@ class di {
3170
3147
  { passive: !1 }
3171
3148
  );
3172
3149
  }
3173
- sortIntersections(e) {
3174
- e.sort((t, s) => t.distance === s.distance ? t.object.getObjectById(s.object.id) ? 1 : s.object.getObjectById(t.object.id) ? -1 : 0 : t.distance - s.distance);
3175
- }
3176
3150
  processIntersection(e, t, s) {
3177
3151
  const i = this.objCallbackMap, r = e.index || -1;
3178
3152
  let o = e.object;
@@ -3190,53 +3164,53 @@ class di {
3190
3164
  };
3191
3165
  for (const n of this.activeObjects) {
3192
3166
  if (r) break;
3193
- const l = i.get(n);
3194
- if (l)
3167
+ const a = i.get(n);
3168
+ if (a)
3195
3169
  if (t === "move") {
3196
- const d = l.get("enter");
3197
- if (d && !this.prevActiveObjects.has(n))
3198
- for (const p of d)
3199
- p({
3170
+ const c = a.get("enter");
3171
+ if (c && !this.prevActiveObjects.has(n))
3172
+ for (const m of c)
3173
+ m({
3200
3174
  baseObject: n,
3201
3175
  mouseEvent: e,
3202
3176
  sp: o,
3203
3177
  intersectionIndex: s
3204
3178
  });
3205
- const _ = l.get("move");
3206
- if (_)
3207
- for (const p of _)
3208
- p({
3179
+ const f = a.get("move");
3180
+ if (f)
3181
+ for (const m of f)
3182
+ m({
3209
3183
  baseObject: n,
3210
3184
  mouseEvent: e,
3211
3185
  sp: o,
3212
3186
  intersectionIndex: s
3213
3187
  });
3214
3188
  } else {
3215
- const d = l.get("down");
3216
- if (d)
3217
- for (const p of d)
3218
- p({
3189
+ const c = a.get("down");
3190
+ if (c)
3191
+ for (const m of c)
3192
+ m({
3219
3193
  baseObject: n,
3220
3194
  mouseEvent: e,
3221
3195
  sp: o,
3222
3196
  intersectionIndex: s
3223
3197
  });
3224
- const _ = l.get("click");
3225
- if (_) {
3226
- const p = (O) => {
3227
- O.preventDefault();
3228
- const v = 5;
3229
- if (!r && Math.abs(O.clientX - e.clientX) <= v && Math.abs(O.clientY - e.clientY) <= v)
3230
- for (const m of _)
3231
- m({
3198
+ const f = a.get("click");
3199
+ if (f) {
3200
+ const m = (v) => {
3201
+ v.preventDefault();
3202
+ const p = 5;
3203
+ if (!r && Math.abs(v.clientX - e.clientX) <= p && Math.abs(v.clientY - e.clientY) <= p)
3204
+ for (const u of f)
3205
+ u({
3232
3206
  baseObject: n,
3233
3207
  mouseEvent: e,
3234
3208
  sp: o,
3235
3209
  intersectionIndex: s
3236
3210
  });
3237
- this.domElement.removeEventListener("pointerup", p);
3211
+ this.domElement.removeEventListener("pointerup", m);
3238
3212
  };
3239
- this.domElement.addEventListener("pointerup", p);
3213
+ this.domElement.addEventListener("pointerup", m);
3240
3214
  }
3241
3215
  }
3242
3216
  }
@@ -3282,15 +3256,15 @@ class di {
3282
3256
  this.pickNodeFunctionsMapIndex += 1;
3283
3257
  const i = this.pickNodeFunctionsMapIndex, r = e instanceof Function ? e() : e, o = [];
3284
3258
  for (const n of r) {
3285
- const l = n;
3286
- l.element.style.pointerEvents = "auto";
3287
- const d = (p) => {
3288
- this.enabled && (p.preventDefault(), s({
3289
- baseObject: l,
3290
- mouseEvent: p
3259
+ const a = n;
3260
+ a.element.style.pointerEvents = "auto";
3261
+ const c = (m) => {
3262
+ this.enabled && (m.preventDefault(), s({
3263
+ baseObject: a,
3264
+ mouseEvent: m
3291
3265
  }));
3292
- }, _ = `pointer${t}`;
3293
- l.element.addEventListener(_, rt(d), !1), o.push({ arr: l, type: _, listener: d });
3266
+ }, f = `pointer${t}`;
3267
+ a.element.addEventListener(f, rt(c), !1), o.push({ arr: a, type: f, listener: c });
3294
3268
  }
3295
3269
  return this.pickNodeFunctionsMap.set(i, o), i;
3296
3270
  }
@@ -3310,15 +3284,28 @@ class di {
3310
3284
  this.pickFunctionsMap.clear(), this.pickNodeFunctionsMap.clear(), this.activeObjects.clear(), this.prevActiveObjects.clear(), this.objCallbackMap.clear();
3311
3285
  }
3312
3286
  }
3313
- class pi extends di {
3287
+ class ci extends hi {
3314
3288
  constructor(e, t) {
3315
- super(e), this.objMap = /* @__PURE__ */ new Map(), this.objects = /* @__PURE__ */ new Map(), this.objectsPm = /* @__PURE__ */ new Map(), this.objectNamesToFactories = /* @__PURE__ */ new Map(), this.scene = new ci({
3316
- scene: t.scene
3317
- }), this.mList = t.mList, this.scene.create(), this.scene.lead = this, this.scene.pencil = e, this.scene.mList = this.mList, this.scene.key = "Scene", this.scene.object3d.name = "场景", this.group = new ze(), this.group.create(), this.group.lead = this, this.group.pencil = e, this.group.mList = this.mList, this.group.key = "@Group", this.group.object3d.name = "物体组", this.prefabGroup = new ze(), this.prefabGroup.create(), this.prefabGroup.lead = this, this.prefabGroup.pencil = e, this.prefabGroup.mList = this.mList, this.prefabGroup.key = "@PrefabGroup", this.prefabGroup.object3d.name = "预制组", this.scene.add(this.group.object3d, this.prefabGroup.object3d), this.objects.set("@Scene", this.scene), this.objects.set("@Group", this.group), this.objects.set("@PrefabGroup", this.prefabGroup), this.objMap.set(this.scene.object3d, this.scene), this.objMap.set(this.group.object3d, this.group), this.objMap.set(this.prefabGroup.object3d, this.prefabGroup);
3289
+ super(e), this.objMap = /* @__PURE__ */ new Map(), this.objects = /* @__PURE__ */ new Map(), this.objectsPm = /* @__PURE__ */ new Map(), this.objectNamesToFactories = /* @__PURE__ */ new Map(), this.mList = t.mList, this.scene = this.createBaseObject(t.scene || new nt(), {
3290
+ key: "@Scene",
3291
+ name: "场景"
3292
+ }), this.group = this.createBaseObject(new ze(), {
3293
+ key: "@Group",
3294
+ name: "物体组",
3295
+ target: this.scene
3296
+ }), this.prefabGroup = this.createBaseObject(new ze(), {
3297
+ key: "@PrefabGroup",
3298
+ name: "预制组",
3299
+ target: this.scene
3300
+ });
3318
3301
  }
3319
3302
  get objectsPromise() {
3320
3303
  return this.objectsPm.values();
3321
3304
  }
3305
+ createBaseObject(e, t) {
3306
+ const s = new ls();
3307
+ return s.object3d = e, s.pencil = this.pencil, s.lead = this, s.mList = this.mList, t != null && t.key && (s.key = t.key), t != null && t.name && (e.name = t.name), t != null && t.target && (t == null || t.target.add(s.object3d)), this.objects.set(s.key, s), this.objMap.set(s.object3d, s), s;
3308
+ }
3322
3309
  init(e) {
3323
3310
  return Object.keys(e).forEach((t) => {
3324
3311
  const s = class {
@@ -3343,23 +3330,23 @@ class pi extends di {
3343
3330
  }
3344
3331
  draw(e, t, s) {
3345
3332
  return se(this, null, function* () {
3346
- var r, o, n, l;
3333
+ var r, o, n, a;
3347
3334
  const i = this.objectNamesToFactories.get(e);
3348
3335
  if (i) {
3349
3336
  t || (t = {}), t.target === void 0 && (t.target = s);
3350
- const d = t.target, _ = (r = t.onTop) != null ? r : 0, p = (o = t.prefab) != null ? o : !1, O = (n = t.create) != null ? n : !0, v = new i().create(t);
3351
- let m;
3352
- return d === null ? m = null : typeof d == "string" ? m = this.objects.get(d) : (l = d == null ? void 0 : d.objectType) != null && l.startsWith("BaseObject") || d ? m = d : p ? m = this.prefabGroup : m = this.group, O === !1 ? v.create = () => {
3353
- } : O !== !0 && (v.create = () => {
3354
- O(v);
3355
- }), v.pencil = this.pencil, v.lead = this, v.mList = this.mList, v.prefab = p, v.objectType = `BaseObject#${e}`, v.objectOptions = t, this.setBaseObjectKey(
3356
- v,
3337
+ const c = t.target, f = (r = t.onTop) != null ? r : 0, m = (o = t.prefab) != null ? o : !1, v = (n = t.create) != null ? n : !0, p = new i().create(t);
3338
+ let u;
3339
+ return c === null ? u = null : typeof c == "string" ? u = this.objects.get(c) : (a = c == null ? void 0 : c.objectType) != null && a.startsWith("BaseObject") || c ? u = c : m ? u = this.prefabGroup : u = this.group, v === !1 ? p.create = () => {
3340
+ } : v !== !0 && (p.create = () => {
3341
+ v(p);
3342
+ }), p.pencil = this.pencil, p.lead = this, p.mList = this.mList, p.prefab = m, p.objectType = `BaseObject#${e}`, p.objectOptions = t, this.setBaseObjectKey(
3343
+ p,
3357
3344
  t.key ? `$t:#${t.key}` : "$t:",
3358
- m == null ? void 0 : m.key
3345
+ u == null ? void 0 : u.key
3359
3346
  ), this.objectsPm.set(
3360
- v,
3361
- this.addBaseObject(v, m, _)
3362
- ), yield this.objectsPm.get(v), this.objectsPm.delete(v), v;
3347
+ p,
3348
+ this.addBaseObject(p, u, f)
3349
+ ), yield this.objectsPm.get(p), this.objectsPm.delete(p), p;
3363
3350
  }
3364
3351
  throw new Error(`Unrecognized:${e}`);
3365
3352
  });
@@ -3371,13 +3358,13 @@ class pi extends di {
3371
3358
  const [, n] = s.split("#");
3372
3359
  o = o.replace("$p:", n);
3373
3360
  }
3374
- return this.objects.has(o) && (o.includes("#") ? o += `-${je()}` : o += `#${je()}`), e.key = o, this.objects.set(o, e), o;
3361
+ return this.objects.has(o) && (o.includes("#") ? o += `-${He()}` : o += `#${He()}`), e.key = o, this.objects.set(o, e), o;
3375
3362
  }
3376
3363
  updateBaseObjectKey(e, t) {
3377
3364
  var o;
3378
3365
  let s;
3379
- for (const [n, l] of this.objects.entries())
3380
- if (l === e) {
3366
+ for (const [n, a] of this.objects.entries())
3367
+ if (a === e) {
3381
3368
  s = n;
3382
3369
  break;
3383
3370
  }
@@ -3386,7 +3373,11 @@ class pi extends di {
3386
3373
  }
3387
3374
  addBaseObject(e, t, s) {
3388
3375
  return se(this, null, function* () {
3389
- yield e.create(), e.object3d && (this.mList.proxyBaseObject(e), this.mList.addBaseObjectMap(e), s && e.setTop(s), t !== null && (t.add(e.object3d), this.objMap.set(e.object3d, e))), e.render(), this.pencil.event.emit("draw", e);
3376
+ if (yield e.create(), e.object3d) {
3377
+ const i = e.object3d;
3378
+ i.material && Array.isArray(i.material) && (i.material = i.material.slice()), this.pencil.options.mList && (this.mList.proxyBaseObject(e), this.mList.addBaseObjectMap(e)), s && e.setTop(s), t !== null && (t.add(e.object3d), this.objMap.set(e.object3d, e));
3379
+ }
3380
+ e.render(), this.pencil.event.emit("draw", e);
3390
3381
  });
3391
3382
  }
3392
3383
  erase(...e) {
@@ -3429,7 +3420,7 @@ class pi extends di {
3429
3420
  }), this.objects.clear(), this.objectsPm.clear(), this.objMap.clear(), this.objectNamesToFactories.clear();
3430
3421
  }
3431
3422
  }
3432
- class mi extends ee {
3423
+ class di extends ee {
3433
3424
  get lead() {
3434
3425
  return this.controller;
3435
3426
  }
@@ -3437,7 +3428,7 @@ class mi extends ee {
3437
3428
  super(), this.options = e;
3438
3429
  }
3439
3430
  addLead(e, t, s) {
3440
- const { pencil: i } = this.options, r = new pi(i, {
3431
+ const { pencil: i } = this.options, r = new ci(i, {
3441
3432
  scene: e,
3442
3433
  mList: t
3443
3434
  });
@@ -3459,7 +3450,7 @@ class mi extends ee {
3459
3450
  });
3460
3451
  }
3461
3452
  }
3462
- class ui {
3453
+ class mi {
3463
3454
  constructor(e) {
3464
3455
  this.materials = /* @__PURE__ */ new Map(), this.fixBaseObjects = /* @__PURE__ */ new Map(), this.materialBaseObjectMap = /* @__PURE__ */ new Map(), this.pencil = e;
3465
3456
  }
@@ -3474,25 +3465,37 @@ class ui {
3474
3465
  set: (i, r, o) => {
3475
3466
  var n;
3476
3467
  if (r === "material" && !((n = this.pencil.composerController) != null && n.bloomComposerRenderIng)) {
3477
- const l = i.material;
3478
- return i.material = o, this.materials.set(e, o), this.disposeMaterial(l), this.syncChangeMaterial(l, o), !0;
3468
+ const a = i.material;
3469
+ return i.material = o, this.materials.set(e, o), this.disposeMaterial(a), this.syncChangeMaterial(a, o), !0;
3479
3470
  }
3480
- return Reflect.set(i, r, o);
3471
+ return i[r] = o, !0;
3481
3472
  }
3482
3473
  }
3483
3474
  )
3484
3475
  };
3485
- this.fixBaseObjects.set(e, s), this.emitObject3dChange();
3476
+ this.fixBaseObjects.set(e, s);
3486
3477
  }
3487
3478
  get(e) {
3488
3479
  const t = this.materials.get(e);
3489
3480
  return t || console.warn(`Material with key "${e}" not found.`), t;
3490
3481
  }
3482
+ getByName(e) {
3483
+ for (const [t, s] of this.materials.entries())
3484
+ if (s.name === e)
3485
+ return s;
3486
+ console.warn(`Material with name "${e}" not found.`);
3487
+ }
3491
3488
  getKey(e) {
3492
3489
  for (const [t, s] of this.materials.entries())
3493
3490
  if (s === e)
3494
3491
  return t;
3495
3492
  }
3493
+ getKeyByName(e) {
3494
+ for (const [t, s] of this.materials.entries())
3495
+ if (s.name === e)
3496
+ return t;
3497
+ console.warn(`Material key with name "${e}" not found.`);
3498
+ }
3496
3499
  getFixBaseObject(e) {
3497
3500
  const t = this.fixBaseObjects.get(e);
3498
3501
  return t || null;
@@ -3513,73 +3516,129 @@ class ui {
3513
3516
  }
3514
3517
  return i ? t : null;
3515
3518
  }
3519
+ copy(e, t) {
3520
+ const s = this.get(e);
3521
+ if (!s)
3522
+ return console.warn(`Material with key "${e}" not found.`), null;
3523
+ const i = s.clone();
3524
+ return this.add(t, i), i;
3525
+ }
3516
3526
  copyMultiple(e, t) {
3517
3527
  const s = {}, i = `${e}#`;
3518
3528
  for (const [r, o] of this.materials.entries())
3519
3529
  if (r.startsWith(i)) {
3520
- const n = r.substring(i.length), l = o.clone();
3521
- s[n] = l;
3522
- const d = `${t}#${n}`;
3523
- this.add(d, l);
3530
+ const n = r.substring(i.length), a = o.clone();
3531
+ s[n] = a;
3532
+ const c = `${t}#${n}`;
3533
+ this.add(c, a);
3524
3534
  }
3525
3535
  return s;
3526
3536
  }
3527
3537
  disposeMaterial(e) {
3528
3538
  if (!e) return;
3529
3539
  const t = new Pe();
3530
- t.track([e]), t.dispose();
3540
+ t.track(Array.isArray(e) ? e : [e]), t.dispose();
3531
3541
  }
3532
3542
  remove(e) {
3533
3543
  const t = this.materials.get(e);
3534
- t && this.disposeMaterial(t), this.materials.delete(e), this.fixBaseObjects.delete(e), this.emitObject3dChange();
3544
+ t && this.disposeMaterial(t), this.materials.delete(e), this.fixBaseObjects.delete(e);
3535
3545
  }
3536
3546
  removeByMaterial(e) {
3537
3547
  [...this.materials.entries()].some(([t, s]) => s === e ? (this.remove(t), !0) : !1);
3538
3548
  }
3539
3549
  proxyBaseObject(e) {
3540
- const t = e.object3d, s = (i) => new Proxy(i, {
3541
- set: (r, o, n) => {
3542
- if (typeof o == "string" && !isNaN(Number(o))) {
3543
- const l = Number(o);
3544
- if (l >= 0 && l < r.length) {
3545
- const d = r[l];
3546
- return this.rmBaseObjectMap(e, d), r[l] = n, this.addBaseObjectMap(e), !0;
3550
+ const t = e.object3d, s = (o) => {
3551
+ if (o.hasOwnProperty("__isProxy"))
3552
+ return o;
3553
+ const n = new Proxy(o, {
3554
+ set: (a, c, f) => {
3555
+ if (typeof c == "string" && !isNaN(Number(c))) {
3556
+ const m = Number(c);
3557
+ if (m >= 0 && m < a.length) {
3558
+ const v = a[m];
3559
+ return this.rmBaseObjectMap(e, v), a[m] = f, f && this.addBaseObjectMap(e), !0;
3560
+ }
3561
+ }
3562
+ return a[c] = f, !0;
3563
+ }
3564
+ });
3565
+ return Object.defineProperty(n, "__isProxy", {
3566
+ value: !0,
3567
+ enumerable: !1
3568
+ }), n;
3569
+ };
3570
+ e.materialList && (e.materialList = new Proxy(e.materialList, {
3571
+ set: (o, n, a) => {
3572
+ if (typeof n == "string") {
3573
+ const c = o[n];
3574
+ return this.rmBaseObjectMap(e, c), o[n] = a, a && this.addBaseObjectMap(e), !0;
3575
+ }
3576
+ return o[n] = a, !0;
3577
+ },
3578
+ get: (o, n) => {
3579
+ if (typeof n == "string" && o[n]) {
3580
+ const a = o[n];
3581
+ if (Array.isArray(a)) {
3582
+ const c = s(a);
3583
+ return c !== a && (o[n] = c), c;
3547
3584
  }
3585
+ return a;
3548
3586
  }
3549
- return Reflect.set(r, o, n);
3587
+ return o[n];
3588
+ },
3589
+ deleteProperty: (o, n) => {
3590
+ if (typeof n == "string" && o[n]) {
3591
+ const a = o[n];
3592
+ this.rmBaseObjectMap(e, a);
3593
+ }
3594
+ return delete o[n], !0;
3550
3595
  }
3551
- });
3552
- e.object3d = new Proxy(t, {
3553
- set: (i, r, o) => {
3596
+ }));
3597
+ const i = t.material, r = "_enhancedMaterial";
3598
+ t[r] = i, Object.defineProperty(t, "material", {
3599
+ get: () => {
3554
3600
  var n;
3555
- return r === "material" && !((n = this.pencil.composerController) != null && n.bloomComposerRenderIng) ? (this.rmBaseObjectMap(e), i.material = o, this.addBaseObjectMap(e), !0) : Reflect.set(i, r, o);
3601
+ const o = t[r];
3602
+ if (!((n = this.pencil.composerController) != null && n.bloomComposerRenderIng) && Array.isArray(o)) {
3603
+ const a = s(o);
3604
+ return a !== o && (t[r] = a), a;
3605
+ }
3606
+ return o;
3556
3607
  },
3557
- get: (i, r) => {
3558
- var o;
3559
- if (r === "material" && !((o = this.pencil.composerController) != null && o.bloomComposerRenderIng)) {
3560
- const n = i.material;
3561
- if (Array.isArray(n) && !n.hasOwnProperty("__isProxy")) {
3562
- const l = s(n);
3563
- Object.defineProperty(l, "__isProxy", {
3564
- value: !0,
3565
- enumerable: !1
3566
- }), i.material = l;
3608
+ set: (o) => {
3609
+ var n;
3610
+ if ((n = this.pencil.composerController) != null && n.bloomComposerRenderIng)
3611
+ t[r] = o;
3612
+ else {
3613
+ if (e.materialList && Object.values(e.materialList).includes(o)) {
3614
+ t[r] = o;
3615
+ return;
3567
3616
  }
3617
+ this.rmBaseObjectMap(e), t[r] = o, this.addBaseObjectMap(e);
3568
3618
  }
3569
- return Reflect.get(i, r);
3570
- }
3619
+ },
3620
+ enumerable: !0,
3621
+ configurable: !0
3571
3622
  });
3572
3623
  }
3624
+ material2array(e) {
3625
+ return Array.isArray(e) ? e : [e];
3626
+ }
3573
3627
  addBaseObjectMap(e) {
3574
3628
  const t = e.object3d;
3575
- t.material && (Array.isArray(t.material) ? t.material : [t.material]).forEach((i) => {
3576
- const r = this.materialBaseObjectMap.get(i);
3577
- r ? r.add(e) : this.materialBaseObjectMap.set(i, /* @__PURE__ */ new Set([e]));
3578
- });
3629
+ [...Object.values(e.materialList), t.material].forEach(
3630
+ (s) => {
3631
+ s && this.material2array(s).forEach((r) => {
3632
+ const o = this.materialBaseObjectMap.get(r);
3633
+ o ? o.add(e) : this.materialBaseObjectMap.set(r, /* @__PURE__ */ new Set([e]));
3634
+ });
3635
+ }
3636
+ );
3579
3637
  }
3580
3638
  rmBaseObjectMap(e, t, s = !0) {
3581
- this.materialBaseObjectMap.forEach((i, r) => {
3582
- t && r !== t || i.has(e) && (i.delete(e), i.size === 0 && s && (this.materialBaseObjectMap.delete(r), this.disposeMaterial(r)));
3639
+ const i = t && this.material2array(t);
3640
+ this.materialBaseObjectMap.forEach((r, o) => {
3641
+ i && !i.includes(o) || r.has(e) && (r.delete(e), r.size === 0 && s && (this.materialBaseObjectMap.delete(o), this.disposeMaterial(o)));
3583
3642
  });
3584
3643
  }
3585
3644
  syncChangeMaterial(e, t) {
@@ -3590,18 +3649,21 @@ class ui {
3590
3649
  const n = o.indexOf(e);
3591
3650
  n !== -1 && (o[n] = t);
3592
3651
  } else o === e && (r.material = t);
3652
+ i.materialList && Object.keys(i.materialList).forEach((n) => {
3653
+ const a = i.materialList[n];
3654
+ if (Array.isArray(a)) {
3655
+ const c = a.indexOf(e);
3656
+ c !== -1 && (a[c] = t);
3657
+ } else a === e && (i.materialList[n] = t);
3658
+ });
3593
3659
  });
3594
3660
  }
3595
- emitObject3dChange() {
3596
- var e;
3597
- (e = this.pencil) == null || e.event.emit("baseObjectListChange");
3598
- }
3599
3661
  dispose() {
3600
3662
  const e = new Pe();
3601
3663
  e.track([...this.materials.values()]), e.dispose(), this.materials.clear(), this.fixBaseObjects.clear(), this.materialBaseObjectMap.clear();
3602
3664
  }
3603
3665
  }
3604
- class fi extends ee {
3666
+ class pi extends ee {
3605
3667
  get mList() {
3606
3668
  return this.controller;
3607
3669
  }
@@ -3609,7 +3671,7 @@ class fi extends ee {
3609
3671
  super(), this.options = e;
3610
3672
  }
3611
3673
  addMList(e, t) {
3612
- const { pencil: s } = this.options, i = new ui(s);
3674
+ const { pencil: s } = this.options, i = new mi(s);
3613
3675
  return this.addController(i, t);
3614
3676
  }
3615
3677
  removePage(e) {
@@ -3621,8 +3683,8 @@ class fi extends ee {
3621
3683
  const _e = class _e {
3622
3684
  constructor(e) {
3623
3685
  var r, o;
3624
- this.raycaster = new ht(), this.maxBackufferArea = 5760 * 5760, this.installPlugins = /* @__PURE__ */ new Map(), this._cameraPositon = new I(), this._cameraTarget = new I(), this.event = new ve.EventEmitter(), this.timer = new is(), this.userData = {}, this.pageActiveIndex = 0, this.pageCountIndex = 0, this.userSetDprCache = 1, this.event.setMaxListeners(1 / 0), (o = (r = this.timer).connect) == null || o.call(r, document), this.options = rs(_e.options, e, {
3625
- isMergeableObject: ls
3686
+ this.raycaster = new ht(), this.maxBackufferArea = 5760 * 5760, this.installPlugins = /* @__PURE__ */ new Map(), this._cameraPositon = new I(), this._cameraTarget = new I(), this.event = new ye.EventEmitter(), this.timer = new ss(), this.userData = {}, this.pageActiveIndex = 0, this.pageCountIndex = 0, this.userSetDprCache = 1, this.viewPadding = [0, 0, 0, 0], this.event.setMaxListeners(1 / 0), (o = (r = this.timer).connect) == null || o.call(r, document), this.options = is(_e.options, e, {
3687
+ isMergeableObject: as
3626
3688
  }), this.userSetDprCache = this.options.renderer.devicePixelRatio;
3627
3689
  const {
3628
3690
  container: t,
@@ -3630,7 +3692,7 @@ const _e = class _e {
3630
3692
  transformControls: i
3631
3693
  } = this.options;
3632
3694
  if (this.init(), this.options.WebGPUTHREE || this.initComposer(), this.initCSSRenderer(), i && this.initTransformControls(), s) {
3633
- const n = new os({
3695
+ const n = new rs({
3634
3696
  horizontal: !1
3635
3697
  });
3636
3698
  n.dom.style.position = "absolute", n.init(this.renderer), t.appendChild(n.dom), this.stats = n;
@@ -3698,7 +3760,7 @@ const _e = class _e {
3698
3760
  this.sceneController.setPageActive(e), t && ((s = this.cssRendererController) == null || s.render(t, this.camera)), this.cameraController.setPageActive(e), this.controlsController.setPageActive(e), this.loaderController.setPageActive(e), this.mListController.setPageActive(e), this.leadController.setPageActive(e), this.pageActiveIndex = e;
3699
3761
  }
3700
3762
  init() {
3701
- var g;
3763
+ var _;
3702
3764
  const {
3703
3765
  container: e,
3704
3766
  WebGPUTHREE: t,
@@ -3707,47 +3769,47 @@ const _e = class _e {
3707
3769
  renderer: r,
3708
3770
  controls: o,
3709
3771
  loader: n
3710
- } = this.options, { width: l, height: d } = this.getSize(), _ = t ? new Ds({
3711
- width: l,
3712
- height: d,
3772
+ } = this.options, { width: a, height: c } = this.getSize(), f = t ? new Rs({
3773
+ width: a,
3774
+ height: c,
3713
3775
  renderer: t.WebGPURenderer,
3714
- rendererParams: Rs
3715
- }) : new Ms({
3716
- width: l,
3717
- height: d,
3776
+ rendererParams: Ms
3777
+ }) : new Ss({
3778
+ width: a,
3779
+ height: c,
3718
3780
  rendererParams: te(U({}, r), {
3719
3781
  antialias: !1
3720
3782
  })
3721
- }), p = new zs({
3722
- width: l,
3723
- height: d
3724
- }), O = new Fs({}), v = new js({
3783
+ }), m = new Us({
3784
+ width: a,
3785
+ height: c
3786
+ }), v = new ks({}), p = new Ns({
3725
3787
  controlsParams: {
3726
- domElement: (g = o == null ? void 0 : o.domElement) != null ? g : _.renderer.domElement
3788
+ domElement: (_ = o == null ? void 0 : o.domElement) != null ? _ : f.renderer.domElement
3727
3789
  }
3728
- }), m = new hi({
3790
+ }), u = new li({
3729
3791
  loaderParams: U({
3730
- anisotropy: _.renderer.capabilities.getMaxAnisotropy()
3792
+ anisotropy: f.renderer.capabilities.getMaxAnisotropy()
3731
3793
  }, n)
3732
- }), u = new fi({
3794
+ }), g = new pi({
3733
3795
  pencil: this
3734
- }), f = new mi({
3796
+ }), y = new di({
3735
3797
  pencil: this
3736
3798
  });
3737
- this.sceneController = O, this.cameraController = p, this.controlsController = v, this.rendererController = _, this.loaderController = m, this.mListController = u, this.leadController = f;
3738
- const a = this.addPage({
3799
+ this.sceneController = v, this.cameraController = m, this.controlsController = p, this.rendererController = f, this.loaderController = u, this.mListController = g, this.leadController = y;
3800
+ const l = this.addPage({
3739
3801
  sceneOptions: this.options.scene,
3740
3802
  cameraOptions: this.options.camera
3741
3803
  });
3742
- if (this.showPage(a), s) {
3743
- const C = new Ns({
3804
+ if (this.showPage(l), s) {
3805
+ const O = new Fs({
3744
3806
  container: e,
3745
- sceneController: O,
3746
- cameraController: p
3807
+ sceneController: v,
3808
+ cameraController: m
3747
3809
  });
3748
- C.add(O.scene), this.helperController = C, i && C.addViewHelper();
3810
+ O.add(v.scene), this.helperController = O, i && O.addViewHelper();
3749
3811
  }
3750
- e.appendChild(_.renderer.domElement);
3812
+ e.appendChild(f.renderer.domElement);
3751
3813
  }
3752
3814
  initComposer() {
3753
3815
  const {
@@ -3756,7 +3818,7 @@ const _e = class _e {
3756
3818
  ssao: s,
3757
3819
  ssaoParams: i,
3758
3820
  composer: r
3759
- } = this.options, o = new ri({
3821
+ } = this.options, o = new ii({
3760
3822
  rendererController: this.rendererController,
3761
3823
  sceneController: this.sceneController,
3762
3824
  cameraController: this.cameraController,
@@ -3773,12 +3835,12 @@ const _e = class _e {
3773
3835
  css3DRendererParams: r
3774
3836
  } = this.options;
3775
3837
  if (t || s) {
3776
- const o = new Zs(e);
3838
+ const o = new Ys(e);
3777
3839
  t && o.addRenderer("css2d", i), s && o.addRenderer("css3d", r), this.cssRendererController = o;
3778
3840
  }
3779
3841
  }
3780
3842
  initTransformControls() {
3781
- const e = new Is({
3843
+ const e = new Hs({
3782
3844
  camera: this.camera,
3783
3845
  renderer: this.renderer,
3784
3846
  scene: this.scene
@@ -3815,12 +3877,12 @@ const _e = class _e {
3815
3877
  cameraController: r,
3816
3878
  composerController: o,
3817
3879
  cssRendererController: n,
3818
- leadController: l
3819
- } = this, d = this.renderer.getSize(new B());
3820
- d.x === e && d.y === t || (r.setSize(e, t), i.setSize(e, t), o == null || o.setSize(e, t), n == null || n.setSize(e, t), l.setSize(e, t), this.installPlugins.forEach((_) => {
3821
- var p;
3822
- (p = _.setSize) == null || p.call(_, e, t);
3823
- }), this.render(), s && this.event.emit("resize", { width: e, height: t }));
3880
+ leadController: a
3881
+ } = this, c = this.renderer.getSize(new B());
3882
+ c.x === e && c.y === t || (r.setSize(e, t), i.setSize(e, t), o == null || o.setSize(e, t), n == null || n.setSize(e, t), a.setSize(e, t), this.installPlugins.forEach((f) => {
3883
+ var m;
3884
+ (m = f.setSize) == null || m.call(f, e, t);
3885
+ }), this.viewPadding.some((f) => f !== 0) && this.setViewPadding(...this.viewPadding), this.render(), s && this.event.emit("resize", { width: e, height: t }));
3824
3886
  }
3825
3887
  setDevicePixelRatio(e) {
3826
3888
  var n;
@@ -3836,38 +3898,47 @@ const _e = class _e {
3836
3898
  r
3837
3899
  );
3838
3900
  const o = this.renderer.getPixelRatio();
3839
- r !== o && (this.rendererController.setPixelRatio(r), (n = this.composerController) == null || n.setPixelRatio(r));
3901
+ r !== o && (this.rendererController.setPixelRatio(r), (n = this.composerController) == null || n.setPixelRatio(r), this.viewPadding.some((a) => a !== 0) && this.setViewPadding(...this.viewPadding));
3902
+ }
3903
+ setViewPadding(e = 0, t = 0, s = 0, i = 0) {
3904
+ const { width: r, height: o } = this.renderer.getSize(new B()), n = {
3905
+ x: i,
3906
+ y: s,
3907
+ width: r - i - t,
3908
+ height: o - e - s
3909
+ };
3910
+ this.rendererController.setViewport(n), this.cameraController.setAspect(n.width / n.height), this.viewPadding = [e, t, s, i];
3840
3911
  }
3841
3912
  pick(e, t, s = !0) {
3842
- const { raycaster: i, options: r } = this, { container: o } = r, n = new B(), l = o.getBoundingClientRect();
3843
- if (n.x = (e.clientX - l.left) / (l.right - l.left) * 2 - 1, n.y = -((e.clientY - l.top) / (l.bottom - l.top)) * 2 + 1, this.camera && this.scene) {
3913
+ const { raycaster: i, options: r } = this, { container: o } = r, n = new B(), a = o.getBoundingClientRect();
3914
+ if (n.x = (e.clientX - a.left) / (a.right - a.left) * 2 - 1, n.y = -((e.clientY - a.top) / (a.bottom - a.top)) * 2 + 1, this.camera && this.scene) {
3844
3915
  i.setFromCamera(n, this.camera);
3845
- const d = i.intersectObjects(
3916
+ const c = i.intersectObjects(
3846
3917
  t || this.scene.children,
3847
3918
  s
3848
3919
  );
3849
- if (d.length)
3920
+ if (c.length)
3850
3921
  return {
3851
- object: d[0].object,
3852
- index: d[0].index,
3853
- intersects: d
3922
+ object: c[0].object,
3923
+ index: c[0].index,
3924
+ intersects: c
3854
3925
  };
3855
3926
  }
3856
3927
  }
3857
3928
  render() {
3858
- var s, i, r, o, n, l;
3929
+ var s, i, r, o, n, a;
3859
3930
  if (!this.camera || !this.scene)
3860
3931
  return;
3861
3932
  this.timer.update(), Ce.update();
3862
3933
  const e = this.timer.getDelta(), t = this.timer.getElapsed();
3863
- this.controlsController.update(e, t), this.leadController.update(e, t), this.installPlugins.forEach((d) => {
3864
- var _;
3865
- (_ = d.update) == null || _.call(d, e, t);
3934
+ this.controlsController.update(e, t), this.leadController.update(e, t), this.installPlugins.forEach((c) => {
3935
+ var f;
3936
+ (f = c.update) == null || f.call(c, e, t);
3866
3937
  }), (s = this.helperController) == null || s.update(
3867
3938
  e,
3868
3939
  this.controlsController,
3869
3940
  this.cameraTarget
3870
- ), (i = this.composerController) != null && i.active ? this.composerController.render() : (r = this.rendererController) == null || r.render(this.scene, this.camera), (o = this.helperController) == null || o.renderViewHelper(this.renderer), (n = this.cssRendererController) == null || n.render(this.scene, this.camera), (l = this.stats) == null || l.update(), this.event.emit("render", { delta: e, elapsed: t });
3941
+ ), (i = this.composerController) != null && i.active ? this.composerController.render() : (r = this.rendererController) == null || r.render(this.scene, this.camera), (o = this.helperController) == null || o.renderViewHelper(this.renderer), (n = this.cssRendererController) == null || n.render(this.scene, this.camera), (a = this.stats) == null || a.update(), this.event.emit("render", { delta: e, elapsed: t });
3871
3942
  }
3872
3943
  start() {
3873
3944
  window.cancelAnimationFrame(this.TweenRaf), this.renderer.setAnimationLoop(this.render.bind(this)), this.event.emit("start");
@@ -3905,39 +3976,40 @@ const _e = class _e {
3905
3976
  }
3906
3977
  }
3907
3978
  dispose() {
3908
- var e, t, s, i, r, o, n, l, d, _, p, O, v, m;
3909
- this.stop(), this.timer.dispose(), Ce.removeAll(), this.event.removeAllListeners(), (e = this.resizeObserver) == null || e.unobserve(this.options.container), this.installPlugins.forEach((u) => {
3910
- var f;
3911
- (f = u.dispose) == null || f.call(u);
3912
- }), (t = this.controlsController) == null || t.dispose(), (s = this.transformController) == null || s.dispose(), (i = this.cssRendererController) == null || i.dispose(), (r = this.sceneController) == null || r.dispose(), (o = this.cameraController) == null || o.dispose(), (n = this.helperController) == null || n.dispose(), (l = this.composerController) == null || l.dispose(), (d = this.rendererController) == null || d.dispose(), (_ = this.loaderController) == null || _.dispose(), (p = this.leadController) == null || p.dispose(), (O = this.mListController) == null || O.dispose(), this.cssRendererController = void 0, this.installPlugins.clear(), (v = this.stats) == null || v.dom.remove(), (m = this.renderer) == null || m.domElement.remove();
3979
+ var e, t, s, i, r, o, n, a, c, f, m, v, p, u;
3980
+ this.stop(), this.timer.dispose(), Ce.removeAll(), this.event.removeAllListeners(), (e = this.resizeObserver) == null || e.unobserve(this.options.container), this.installPlugins.forEach((g) => {
3981
+ var y;
3982
+ (y = g.dispose) == null || y.call(g);
3983
+ }), (t = this.controlsController) == null || t.dispose(), (s = this.transformController) == null || s.dispose(), (i = this.cssRendererController) == null || i.dispose(), (r = this.sceneController) == null || r.dispose(), (o = this.cameraController) == null || o.dispose(), (n = this.helperController) == null || n.dispose(), (a = this.composerController) == null || a.dispose(), (c = this.rendererController) == null || c.dispose(), (f = this.loaderController) == null || f.dispose(), (m = this.leadController) == null || m.dispose(), (v = this.mListController) == null || v.dispose(), this.cssRendererController = void 0, this.installPlugins.clear(), (p = this.stats) == null || p.dom.remove(), (u = this.renderer) == null || u.domElement.remove();
3913
3984
  }
3914
3985
  };
3915
3986
  _e.options = {
3916
- stats: me,
3917
- helper: me,
3918
- viewHelper: me,
3987
+ stats: pe,
3988
+ helper: pe,
3989
+ viewHelper: pe,
3919
3990
  controls: !0,
3920
- transformControls: me,
3991
+ transformControls: pe,
3921
3992
  renderer: As,
3922
- composer: ii,
3923
- scene: ks,
3924
- camera: bt,
3993
+ composer: si,
3994
+ scene: zs,
3995
+ camera: wt,
3925
3996
  bloom: !1,
3926
- bloomParams: si,
3997
+ bloomParams: ti,
3927
3998
  ssao: !1,
3928
- loader: li,
3929
- ssaoParams: ti,
3999
+ loader: ai,
4000
+ ssaoParams: ei,
3930
4001
  css2DRenderer: !1,
3931
4002
  css2DRendererParams: U({}, st),
3932
4003
  css3DRenderer: !1,
3933
- css3DRendererParams: U({}, st)
4004
+ css3DRendererParams: U({}, st),
4005
+ mList: !0
3934
4006
  };
3935
4007
  let ot = _e;
3936
- const $i = J.ACTION;
4008
+ const Gi = J.ACTION;
3937
4009
  export {
3938
- hs as BaseObject,
4010
+ ls as BaseObject,
3939
4011
  ot as Pencil,
3940
4012
  Pe as ResourceTracker,
3941
- $i as cameraControlsAction,
4013
+ Gi as cameraControlsAction,
3942
4014
  ot as default
3943
4015
  };