@extrabinoss/three-plot 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,5 @@
1
- import * as r from "three";
2
- import { Controls as Q, Vector3 as y, MOUSE as b, TOUCH as x, Quaternion as I, Spherical as U, Vector2 as g, Ray as $, Plane as J, MathUtils as tt } from "three";
3
- const W = { type: "change" }, j = { type: "start" }, H = { type: "end" }, w = new $(), Y = new J(), et = Math.cos(70 * tt.DEG2RAD), u = new y(), f = 2 * Math.PI, l = {
1
+ import { Controls as ot, Vector3 as g, MOUSE as x, TOUCH as b, Quaternion as F, Spherical as N, Vector2 as d, Ray as rt, Plane as ht, MathUtils as lt, Color as _, PlaneGeometry as U, InstancedBufferGeometry as ct, InstancedBufferAttribute as I, ShaderMaterial as M, AdditiveBlending as W, InstancedMesh as Q, Object3D as $, Points as ut, BufferGeometry as dt, BufferAttribute as mt, DoubleSide as ft, TextureLoader as pt, LinearFilter as H, Mesh as gt, Scene as xt, OrthographicCamera as L, WebGLRenderer as yt, PerspectiveCamera as Z } from "three";
2
+ const K = { type: "change" }, Y = { type: "start" }, J = { type: "end" }, w = new rt(), q = new ht(), _t = Math.cos(70 * lt.DEG2RAD), c = new g(), f = 2 * Math.PI, h = {
4
3
  NONE: -1,
5
4
  ROTATE: 0,
6
5
  DOLLY: 1,
@@ -9,8 +8,8 @@ const W = { type: "change" }, j = { type: "start" }, H = { type: "end" }, w = ne
9
8
  TOUCH_PAN: 4,
10
9
  TOUCH_DOLLY_PAN: 5,
11
10
  TOUCH_DOLLY_ROTATE: 6
12
- }, z = 1e-6;
13
- class it extends Q {
11
+ }, j = 1e-6;
12
+ class bt extends ot {
14
13
  /**
15
14
  * Constructs a new controls instance.
16
15
  *
@@ -18,7 +17,7 @@ class it extends Q {
18
17
  * @param {?HTMLElement} domElement - The HTML element used for event listeners.
19
18
  */
20
19
  constructor(t, e = null) {
21
- super(t, e), this.state = l.NONE, this.target = new y(), this.cursor = new y(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: b.ROTATE, MIDDLE: b.DOLLY, RIGHT: b.PAN }, this.touches = { ONE: x.ROTATE, TWO: x.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new y(), this._lastQuaternion = new I(), this._lastTargetPosition = new y(), this._quat = new I().setFromUnitVectors(t.up, new y(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new U(), this._sphericalDelta = new U(), this._scale = 1, this._panOffset = new y(), this._rotateStart = new g(), this._rotateEnd = new g(), this._rotateDelta = new g(), this._panStart = new g(), this._panEnd = new g(), this._panDelta = new g(), this._dollyStart = new g(), this._dollyEnd = new g(), this._dollyDelta = new g(), this._dollyDirection = new y(), this._mouse = new g(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = nt.bind(this), this._onPointerDown = st.bind(this), this._onPointerUp = ot.bind(this), this._onContextMenu = dt.bind(this), this._onMouseWheel = ht.bind(this), this._onKeyDown = lt.bind(this), this._onTouchStart = ct.bind(this), this._onTouchMove = ut.bind(this), this._onMouseDown = at.bind(this), this._onMouseMove = rt.bind(this), this._interceptControlDown = mt.bind(this), this._interceptControlUp = ft.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
20
+ super(t, e), this.state = h.NONE, this.target = new g(), this.cursor = new g(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: x.ROTATE, MIDDLE: x.DOLLY, RIGHT: x.PAN }, this.touches = { ONE: b.ROTATE, TWO: b.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new g(), this._lastQuaternion = new F(), this._lastTargetPosition = new g(), this._quat = new F().setFromUnitVectors(t.up, new g(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new N(), this._sphericalDelta = new N(), this._scale = 1, this._panOffset = new g(), this._rotateStart = new d(), this._rotateEnd = new d(), this._rotateDelta = new d(), this._panStart = new d(), this._panEnd = new d(), this._panDelta = new d(), this._dollyStart = new d(), this._dollyEnd = new d(), this._dollyDelta = new d(), this._dollyDirection = new g(), this._mouse = new d(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = vt.bind(this), this._onPointerDown = Pt.bind(this), this._onPointerUp = wt.bind(this), this._onContextMenu = At.bind(this), this._onMouseWheel = Mt.bind(this), this._onKeyDown = Et.bind(this), this._onTouchStart = Dt.bind(this), this._onTouchMove = kt.bind(this), this._onMouseDown = St.bind(this), this._onMouseMove = Tt.bind(this), this._interceptControlDown = Rt.bind(this), this._interceptControlUp = Ot.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
22
21
  }
23
22
  connect(t) {
24
23
  super.connect(t), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, { passive: !0, capture: !0 }), this.domElement.style.touchAction = "none";
@@ -79,42 +78,42 @@ class it extends Q {
79
78
  * was called, or the initial state.
80
79
  */
81
80
  reset() {
82
- this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(W), this.update(), this.state = l.NONE;
81
+ this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(K), this.update(), this.state = h.NONE;
83
82
  }
84
83
  update(t = null) {
85
84
  const e = this.object.position;
86
- u.copy(e).sub(this.target), u.applyQuaternion(this._quat), this._spherical.setFromVector3(u), this.autoRotate && this.state === l.NONE && this._rotateLeft(this._getAutoRotationAngle(t)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
85
+ c.copy(e).sub(this.target), c.applyQuaternion(this._quat), this._spherical.setFromVector3(c), this.autoRotate && this.state === h.NONE && this._rotateLeft(this._getAutoRotationAngle(t)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
87
86
  let i = this.minAzimuthAngle, s = this.maxAzimuthAngle;
88
87
  isFinite(i) && isFinite(s) && (i < -Math.PI ? i += f : i > Math.PI && (i -= f), s < -Math.PI ? s += f : s > Math.PI && (s -= f), i <= s ? this._spherical.theta = Math.max(i, Math.min(s, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (i + s) / 2 ? Math.max(i, this._spherical.theta) : Math.min(s, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
89
88
  let n = !1;
90
89
  if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera)
91
90
  this._spherical.radius = this._clampDistance(this._spherical.radius);
92
91
  else {
93
- const a = this._spherical.radius;
94
- this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), n = a != this._spherical.radius;
92
+ const o = this._spherical.radius;
93
+ this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), n = o != this._spherical.radius;
95
94
  }
96
- if (u.setFromSpherical(this._spherical), u.applyQuaternion(this._quatInverse), e.copy(this.target).add(u), this.object.lookAt(this.target), this.enableDamping === !0 ? (this._sphericalDelta.theta *= 1 - this.dampingFactor, this._sphericalDelta.phi *= 1 - this.dampingFactor, this._panOffset.multiplyScalar(1 - this.dampingFactor)) : (this._sphericalDelta.set(0, 0, 0), this._panOffset.set(0, 0, 0)), this.zoomToCursor && this._performCursorZoom) {
97
- let a = null;
95
+ if (c.setFromSpherical(this._spherical), c.applyQuaternion(this._quatInverse), e.copy(this.target).add(c), this.object.lookAt(this.target), this.enableDamping === !0 ? (this._sphericalDelta.theta *= 1 - this.dampingFactor, this._sphericalDelta.phi *= 1 - this.dampingFactor, this._panOffset.multiplyScalar(1 - this.dampingFactor)) : (this._sphericalDelta.set(0, 0, 0), this._panOffset.set(0, 0, 0)), this.zoomToCursor && this._performCursorZoom) {
96
+ let o = null;
98
97
  if (this.object.isPerspectiveCamera) {
99
- const h = u.length();
100
- a = this._clampDistance(h * this._scale);
101
- const c = h - a;
102
- this.object.position.addScaledVector(this._dollyDirection, c), this.object.updateMatrixWorld(), n = !!c;
98
+ const r = c.length();
99
+ o = this._clampDistance(r * this._scale);
100
+ const l = r - o;
101
+ this.object.position.addScaledVector(this._dollyDirection, l), this.object.updateMatrixWorld(), n = !!l;
103
102
  } else if (this.object.isOrthographicCamera) {
104
- const h = new y(this._mouse.x, this._mouse.y, 0);
105
- h.unproject(this.object);
106
- const c = this.object.zoom;
107
- this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), n = c !== this.object.zoom;
108
- const m = new y(this._mouse.x, this._mouse.y, 0);
109
- m.unproject(this.object), this.object.position.sub(m).add(h), this.object.updateMatrixWorld(), a = u.length();
103
+ const r = new g(this._mouse.x, this._mouse.y, 0);
104
+ r.unproject(this.object);
105
+ const l = this.object.zoom;
106
+ this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), n = l !== this.object.zoom;
107
+ const u = new g(this._mouse.x, this._mouse.y, 0);
108
+ u.unproject(this.object), this.object.position.sub(u).add(r), this.object.updateMatrixWorld(), o = c.length();
110
109
  } else
111
110
  console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
112
- a !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position) : (w.origin.copy(this.object.position), w.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(w.direction)) < et ? this.object.lookAt(this.target) : (Y.setFromNormalAndCoplanarPoint(this.object.up, this.target), w.intersectPlane(Y, this.target))));
111
+ o !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position) : (w.origin.copy(this.object.position), w.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(w.direction)) < _t ? this.object.lookAt(this.target) : (q.setFromNormalAndCoplanarPoint(this.object.up, this.target), w.intersectPlane(q, this.target))));
113
112
  } else if (this.object.isOrthographicCamera) {
114
- const a = this.object.zoom;
115
- this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), a !== this.object.zoom && (this.object.updateProjectionMatrix(), n = !0);
113
+ const o = this.object.zoom;
114
+ this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), o !== this.object.zoom && (this.object.updateProjectionMatrix(), n = !0);
116
115
  }
117
- return this._scale = 1, this._performCursorZoom = !1, n || this._lastPosition.distanceToSquared(this.object.position) > z || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > z || this._lastTargetPosition.distanceToSquared(this.target) > z ? (this.dispatchEvent(W), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
116
+ return this._scale = 1, this._performCursorZoom = !1, n || this._lastPosition.distanceToSquared(this.object.position) > j || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > j || this._lastTargetPosition.distanceToSquared(this.target) > j ? (this.dispatchEvent(K), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
118
117
  }
119
118
  _getAutoRotationAngle(t) {
120
119
  return t !== null ? f / 60 * this.autoRotateSpeed * t : f / 60 / 60 * this.autoRotateSpeed;
@@ -130,18 +129,18 @@ class it extends Q {
130
129
  this._sphericalDelta.phi -= t;
131
130
  }
132
131
  _panLeft(t, e) {
133
- u.setFromMatrixColumn(e, 0), u.multiplyScalar(-t), this._panOffset.add(u);
132
+ c.setFromMatrixColumn(e, 0), c.multiplyScalar(-t), this._panOffset.add(c);
134
133
  }
135
134
  _panUp(t, e) {
136
- this.screenSpacePanning === !0 ? u.setFromMatrixColumn(e, 1) : (u.setFromMatrixColumn(e, 0), u.crossVectors(this.object.up, u)), u.multiplyScalar(t), this._panOffset.add(u);
135
+ this.screenSpacePanning === !0 ? c.setFromMatrixColumn(e, 1) : (c.setFromMatrixColumn(e, 0), c.crossVectors(this.object.up, c)), c.multiplyScalar(t), this._panOffset.add(c);
137
136
  }
138
137
  // deltaX and deltaY are in pixels; right and down are positive
139
138
  _pan(t, e) {
140
139
  const i = this.domElement;
141
140
  if (this.object.isPerspectiveCamera) {
142
141
  const s = this.object.position;
143
- u.copy(s).sub(this.target);
144
- let n = u.length();
142
+ c.copy(s).sub(this.target);
143
+ let n = c.length();
145
144
  n *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * t * n / i.clientHeight, this.object.matrix), this._panUp(2 * e * n / i.clientHeight, this.object.matrix);
146
145
  } else this.object.isOrthographicCamera ? (this._panLeft(t * (this.object.right - this.object.left) / this.object.zoom / i.clientWidth, this.object.matrix), this._panUp(e * (this.object.top - this.object.bottom) / this.object.zoom / i.clientHeight, this.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), this.enablePan = !1);
147
146
  }
@@ -155,8 +154,8 @@ class it extends Q {
155
154
  if (!this.zoomToCursor)
156
155
  return;
157
156
  this._performCursorZoom = !0;
158
- const i = this.domElement.getBoundingClientRect(), s = t - i.left, n = e - i.top, a = i.width, h = i.height;
159
- this._mouse.x = s / a * 2 - 1, this._mouse.y = -(n / h) * 2 + 1, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
157
+ const i = this.domElement.getBoundingClientRect(), s = t - i.left, n = e - i.top, o = i.width, r = i.height;
158
+ this._mouse.x = s / o * 2 - 1, this._mouse.y = -(n / r) * 2 + 1, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
160
159
  }
161
160
  _clampDistance(t) {
162
161
  return Math.max(this.minDistance, Math.min(this.maxDistance, t));
@@ -254,8 +253,8 @@ class it extends Q {
254
253
  _handleTouchMoveDolly(t) {
255
254
  const e = this._getSecondPointerPosition(t), i = t.pageX - e.x, s = t.pageY - e.y, n = Math.sqrt(i * i + s * s);
256
255
  this._dollyEnd.set(0, n), this._dollyDelta.set(0, Math.pow(this._dollyEnd.y / this._dollyStart.y, this.zoomSpeed)), this._dollyOut(this._dollyDelta.y), this._dollyStart.copy(this._dollyEnd);
257
- const a = (t.pageX + e.x) * 0.5, h = (t.pageY + e.y) * 0.5;
258
- this._updateZoomParameters(a, h);
256
+ const o = (t.pageX + e.x) * 0.5, r = (t.pageY + e.y) * 0.5;
257
+ this._updateZoomParameters(o, r);
259
258
  }
260
259
  _handleTouchMoveDollyPan(t) {
261
260
  this.enableZoom && this._handleTouchMoveDolly(t), this.enablePan && this._handleTouchMovePan(t);
@@ -282,7 +281,7 @@ class it extends Q {
282
281
  }
283
282
  _trackPointer(t) {
284
283
  let e = this._pointerPositions[t.pointerId];
285
- e === void 0 && (e = new g(), this._pointerPositions[t.pointerId] = e), e.set(t.pageX, t.pageY);
284
+ e === void 0 && (e = new d(), this._pointerPositions[t.pointerId] = e), e.set(t.pageX, t.pageY);
286
285
  }
287
286
  _getSecondPointerPosition(t) {
288
287
  const e = t.pointerId === this._pointers[0] ? this._pointers[1] : this._pointers[0];
@@ -306,16 +305,16 @@ class it extends Q {
306
305
  return t.ctrlKey && !this._controlActive && (i.deltaY *= 10), i;
307
306
  }
308
307
  }
309
- function st(o) {
310
- this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(o.pointerId), this.domElement.ownerDocument.addEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(o) && (this._addPointer(o), o.pointerType === "touch" ? this._onTouchStart(o) : this._onMouseDown(o)));
308
+ function Pt(a) {
309
+ this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(a.pointerId), this.domElement.ownerDocument.addEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(a) && (this._addPointer(a), a.pointerType === "touch" ? this._onTouchStart(a) : this._onMouseDown(a)));
311
310
  }
312
- function nt(o) {
313
- this.enabled !== !1 && (o.pointerType === "touch" ? this._onTouchMove(o) : this._onMouseMove(o));
311
+ function vt(a) {
312
+ this.enabled !== !1 && (a.pointerType === "touch" ? this._onTouchMove(a) : this._onMouseMove(a));
314
313
  }
315
- function ot(o) {
316
- switch (this._removePointer(o), this._pointers.length) {
314
+ function wt(a) {
315
+ switch (this._removePointer(a), this._pointers.length) {
317
316
  case 0:
318
- this.domElement.releasePointerCapture(o.pointerId), this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(H), this.state = l.NONE;
317
+ this.domElement.releasePointerCapture(a.pointerId), this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(J), this.state = h.NONE;
319
318
  break;
320
319
  case 1:
321
320
  const t = this._pointers[0], e = this._pointerPositions[t];
@@ -323,9 +322,9 @@ function ot(o) {
323
322
  break;
324
323
  }
325
324
  }
326
- function at(o) {
325
+ function St(a) {
327
326
  let t;
328
- switch (o.button) {
327
+ switch (a.button) {
329
328
  case 0:
330
329
  t = this.mouseButtons.LEFT;
331
330
  break;
@@ -339,122 +338,122 @@ function at(o) {
339
338
  t = -1;
340
339
  }
341
340
  switch (t) {
342
- case b.DOLLY:
341
+ case x.DOLLY:
343
342
  if (this.enableZoom === !1) return;
344
- this._handleMouseDownDolly(o), this.state = l.DOLLY;
343
+ this._handleMouseDownDolly(a), this.state = h.DOLLY;
345
344
  break;
346
- case b.ROTATE:
347
- if (o.ctrlKey || o.metaKey || o.shiftKey) {
345
+ case x.ROTATE:
346
+ if (a.ctrlKey || a.metaKey || a.shiftKey) {
348
347
  if (this.enablePan === !1) return;
349
- this._handleMouseDownPan(o), this.state = l.PAN;
348
+ this._handleMouseDownPan(a), this.state = h.PAN;
350
349
  } else {
351
350
  if (this.enableRotate === !1) return;
352
- this._handleMouseDownRotate(o), this.state = l.ROTATE;
351
+ this._handleMouseDownRotate(a), this.state = h.ROTATE;
353
352
  }
354
353
  break;
355
- case b.PAN:
356
- if (o.ctrlKey || o.metaKey || o.shiftKey) {
354
+ case x.PAN:
355
+ if (a.ctrlKey || a.metaKey || a.shiftKey) {
357
356
  if (this.enableRotate === !1) return;
358
- this._handleMouseDownRotate(o), this.state = l.ROTATE;
357
+ this._handleMouseDownRotate(a), this.state = h.ROTATE;
359
358
  } else {
360
359
  if (this.enablePan === !1) return;
361
- this._handleMouseDownPan(o), this.state = l.PAN;
360
+ this._handleMouseDownPan(a), this.state = h.PAN;
362
361
  }
363
362
  break;
364
363
  default:
365
- this.state = l.NONE;
364
+ this.state = h.NONE;
366
365
  }
367
- this.state !== l.NONE && this.dispatchEvent(j);
366
+ this.state !== h.NONE && this.dispatchEvent(Y);
368
367
  }
369
- function rt(o) {
368
+ function Tt(a) {
370
369
  switch (this.state) {
371
- case l.ROTATE:
370
+ case h.ROTATE:
372
371
  if (this.enableRotate === !1) return;
373
- this._handleMouseMoveRotate(o);
372
+ this._handleMouseMoveRotate(a);
374
373
  break;
375
- case l.DOLLY:
374
+ case h.DOLLY:
376
375
  if (this.enableZoom === !1) return;
377
- this._handleMouseMoveDolly(o);
376
+ this._handleMouseMoveDolly(a);
378
377
  break;
379
- case l.PAN:
378
+ case h.PAN:
380
379
  if (this.enablePan === !1) return;
381
- this._handleMouseMovePan(o);
380
+ this._handleMouseMovePan(a);
382
381
  break;
383
382
  }
384
383
  }
385
- function ht(o) {
386
- this.enabled === !1 || this.enableZoom === !1 || this.state !== l.NONE || (o.preventDefault(), this.dispatchEvent(j), this._handleMouseWheel(this._customWheelEvent(o)), this.dispatchEvent(H));
384
+ function Mt(a) {
385
+ this.enabled === !1 || this.enableZoom === !1 || this.state !== h.NONE || (a.preventDefault(), this.dispatchEvent(Y), this._handleMouseWheel(this._customWheelEvent(a)), this.dispatchEvent(J));
387
386
  }
388
- function lt(o) {
389
- this.enabled !== !1 && this._handleKeyDown(o);
387
+ function Et(a) {
388
+ this.enabled !== !1 && this._handleKeyDown(a);
390
389
  }
391
- function ct(o) {
392
- switch (this._trackPointer(o), this._pointers.length) {
390
+ function Dt(a) {
391
+ switch (this._trackPointer(a), this._pointers.length) {
393
392
  case 1:
394
393
  switch (this.touches.ONE) {
395
- case x.ROTATE:
394
+ case b.ROTATE:
396
395
  if (this.enableRotate === !1) return;
397
- this._handleTouchStartRotate(o), this.state = l.TOUCH_ROTATE;
396
+ this._handleTouchStartRotate(a), this.state = h.TOUCH_ROTATE;
398
397
  break;
399
- case x.PAN:
398
+ case b.PAN:
400
399
  if (this.enablePan === !1) return;
401
- this._handleTouchStartPan(o), this.state = l.TOUCH_PAN;
400
+ this._handleTouchStartPan(a), this.state = h.TOUCH_PAN;
402
401
  break;
403
402
  default:
404
- this.state = l.NONE;
403
+ this.state = h.NONE;
405
404
  }
406
405
  break;
407
406
  case 2:
408
407
  switch (this.touches.TWO) {
409
- case x.DOLLY_PAN:
408
+ case b.DOLLY_PAN:
410
409
  if (this.enableZoom === !1 && this.enablePan === !1) return;
411
- this._handleTouchStartDollyPan(o), this.state = l.TOUCH_DOLLY_PAN;
410
+ this._handleTouchStartDollyPan(a), this.state = h.TOUCH_DOLLY_PAN;
412
411
  break;
413
- case x.DOLLY_ROTATE:
412
+ case b.DOLLY_ROTATE:
414
413
  if (this.enableZoom === !1 && this.enableRotate === !1) return;
415
- this._handleTouchStartDollyRotate(o), this.state = l.TOUCH_DOLLY_ROTATE;
414
+ this._handleTouchStartDollyRotate(a), this.state = h.TOUCH_DOLLY_ROTATE;
416
415
  break;
417
416
  default:
418
- this.state = l.NONE;
417
+ this.state = h.NONE;
419
418
  }
420
419
  break;
421
420
  default:
422
- this.state = l.NONE;
421
+ this.state = h.NONE;
423
422
  }
424
- this.state !== l.NONE && this.dispatchEvent(j);
423
+ this.state !== h.NONE && this.dispatchEvent(Y);
425
424
  }
426
- function ut(o) {
427
- switch (this._trackPointer(o), this.state) {
428
- case l.TOUCH_ROTATE:
425
+ function kt(a) {
426
+ switch (this._trackPointer(a), this.state) {
427
+ case h.TOUCH_ROTATE:
429
428
  if (this.enableRotate === !1) return;
430
- this._handleTouchMoveRotate(o), this.update();
429
+ this._handleTouchMoveRotate(a), this.update();
431
430
  break;
432
- case l.TOUCH_PAN:
431
+ case h.TOUCH_PAN:
433
432
  if (this.enablePan === !1) return;
434
- this._handleTouchMovePan(o), this.update();
433
+ this._handleTouchMovePan(a), this.update();
435
434
  break;
436
- case l.TOUCH_DOLLY_PAN:
435
+ case h.TOUCH_DOLLY_PAN:
437
436
  if (this.enableZoom === !1 && this.enablePan === !1) return;
438
- this._handleTouchMoveDollyPan(o), this.update();
437
+ this._handleTouchMoveDollyPan(a), this.update();
439
438
  break;
440
- case l.TOUCH_DOLLY_ROTATE:
439
+ case h.TOUCH_DOLLY_ROTATE:
441
440
  if (this.enableZoom === !1 && this.enableRotate === !1) return;
442
- this._handleTouchMoveDollyRotate(o), this.update();
441
+ this._handleTouchMoveDollyRotate(a), this.update();
443
442
  break;
444
443
  default:
445
- this.state = l.NONE;
444
+ this.state = h.NONE;
446
445
  }
447
446
  }
448
- function dt(o) {
449
- this.enabled !== !1 && o.preventDefault();
447
+ function At(a) {
448
+ this.enabled !== !1 && a.preventDefault();
450
449
  }
451
- function mt(o) {
452
- o.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
450
+ function Rt(a) {
451
+ a.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
453
452
  }
454
- function ft(o) {
455
- o.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
453
+ function Ot(a) {
454
+ a.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
456
455
  }
457
- var X = `precision highp float;
456
+ var V = `precision highp float;
458
457
 
459
458
  attribute float instanceIndex;
460
459
 
@@ -569,7 +568,7 @@ void main() {
569
568
  currentScreen += normal * position.y * effectiveLineWidth * 2.0;
570
569
 
571
570
  gl_Position = vec4((currentScreen / uResolution * 2.0 - 1.0), 0.0, 1.0);
572
- }`, pt = `precision highp float;
571
+ }`, Ct = `precision highp float;
573
572
  uniform vec3 uColor;
574
573
  uniform vec3 uOutlineColor;
575
574
  uniform float uOutlineWidth;
@@ -621,7 +620,7 @@ class S {
621
620
  material;
622
621
  params;
623
622
  static customInjection = "";
624
- constructor(t, e = new r.Color(65416)) {
623
+ constructor(t, e = new _(65416)) {
625
624
  this.params = {
626
625
  count: t,
627
626
  frequency: 0.1,
@@ -632,16 +631,16 @@ class S {
632
631
  lodFactor: 1,
633
632
  pointSize: 2
634
633
  };
635
- const i = new r.PlaneGeometry(1, 1);
636
- this.geometry = new r.InstancedBufferGeometry(), this.geometry.index = i.index, i.attributes.position && this.geometry.setAttribute("position", i.attributes.position);
634
+ const i = new U(1, 1);
635
+ this.geometry = new ct(), this.geometry.index = i.index, i.attributes.position && this.geometry.setAttribute("position", i.attributes.position);
637
636
  const s = new Float32Array(t);
638
- for (let c = 0; c < t; c++) s[c] = c;
639
- this.geometry.setAttribute("instanceIndex", new r.InstancedBufferAttribute(s, 1));
640
- const n = /else\s*{\s*y\s*=\s*0\.0;\s*}/g, a = X.replace(
637
+ for (let l = 0; l < t; l++) s[l] = l;
638
+ this.geometry.setAttribute("instanceIndex", new I(s, 1));
639
+ const n = /else\s*{\s*y\s*=\s*0\.0;\s*}/g, o = V.replace(
641
640
  n,
642
641
  S.customInjection || "else { y = 0.0; }"
643
642
  );
644
- this.material = new r.ShaderMaterial({
643
+ this.material = new M({
645
644
  uniforms: {
646
645
  uTime: { value: 0 },
647
646
  uCount: { value: Number(t) },
@@ -651,23 +650,23 @@ class S {
651
650
  uPreset: { value: Number(this.params.presetIndex) },
652
651
  uColor: { value: e.clone() },
653
652
  uLodFactor: { value: 1 },
654
- uResolution: { value: new r.Vector2(100, 100) },
653
+ uResolution: { value: new d(100, 100) },
655
654
  uLineWidth: { value: 2 },
656
- uOutlineColor: { value: new r.Color(0) },
655
+ uOutlineColor: { value: new _(0) },
657
656
  uOutlineWidth: { value: 0 },
658
657
  uDashScale: { value: 0 },
659
- uOffset: { value: new r.Vector2(0, 0) }
658
+ uOffset: { value: new d(0, 0) }
660
659
  },
661
- vertexShader: a,
662
- fragmentShader: pt,
660
+ vertexShader: o,
661
+ fragmentShader: Ct,
663
662
  transparent: !1,
664
663
  depthWrite: !1,
665
664
  depthTest: !1,
666
- blending: r.AdditiveBlending
667
- }), this.instancedMesh = new r.InstancedMesh(this.geometry, this.material, t), this.instancedMesh.frustumCulled = !1;
668
- const h = new r.Object3D();
669
- h.updateMatrix();
670
- for (let c = 0; c < t; c++) this.instancedMesh.setMatrixAt(c, h.matrix);
665
+ blending: W
666
+ }), this.instancedMesh = new Q(this.geometry, this.material, t), this.instancedMesh.frustumCulled = !1;
667
+ const r = new $();
668
+ r.updateMatrix();
669
+ for (let l = 0; l < t; l++) this.instancedMesh.setMatrixAt(l, r.matrix);
671
670
  }
672
671
  setParams(t) {
673
672
  return this.params = { ...this.params, ...t }, this;
@@ -692,13 +691,13 @@ class S {
692
691
  }
693
692
  injectPresets(t) {
694
693
  let e = "", i = 8;
695
- t.forEach((a, h) => {
696
- e += `else if (preset == ${i}) { // ${h}
697
- y = ${a};
694
+ t.forEach((o, r) => {
695
+ e += `else if (preset == ${i}) { // ${r}
696
+ y = ${o};
698
697
  }
699
698
  `, i++;
700
699
  }), e += "else { y = 0.0; }", S.customInjection = e;
701
- const s = /else\s*{\s*y\s*=\s*0\.0;\s*}/g, n = X.replace(s, e);
700
+ const s = /else\s*{\s*y\s*=\s*0\.0;\s*}/g, n = V.replace(s, e);
702
701
  this.material.vertexShader !== n && (this.material.vertexShader = n, this.material.needsUpdate = !0);
703
702
  }
704
703
  update(t, e) {
@@ -707,16 +706,16 @@ class S {
707
706
  e && i.uResolution.value.set(e.pixelWidth, e.pixelHeight);
708
707
  const s = this.params, n = s.autoUpdate !== !1 ? t : 0;
709
708
  this.updateUniform(i.uTime, n), this.updateUniform(i.uFrequency, s.frequency), this.updateUniform(i.uAmplitude, s.amplitude), this.updateUniform(i.uPlotWidth, s.width ?? 400), this.updateUniform(i.uPreset, Number(s.presetIndex)), this.updateUniform(i.uLodFactor, s.lodFactor ?? 1), this.updateUniform(i.uLineWidth, s.pointSize ?? 2), s.color !== void 0 && i.uColor.value.set(s.color), s.borderColor !== void 0 && i.uOutlineColor.value.set(s.borderColor), this.updateUniform(i.uOutlineWidth, s.borderWidth ?? 0), this.updateUniform(i.uDashScale, s.dashScale ?? 0), s.offset && i.uOffset.value.set(s.offset.x, s.offset.y);
710
- const a = this.calculateEffectiveCount(s, e);
711
- this.updateUniform(i.uCount, a), this.instancedMesh.count = Math.max(0, a);
709
+ const o = this.calculateEffectiveCount(s, e);
710
+ this.updateUniform(i.uCount, o), this.instancedMesh.count = Math.max(0, o);
712
711
  }
713
712
  updateUniform(t, e) {
714
713
  t.value !== e && (t.value = e);
715
714
  }
716
715
  calculateEffectiveCount(t, e) {
717
716
  if (!e) return t.count;
718
- const n = (t.width ?? 400) / Math.max(e.maxX - e.minX, 1e-3), a = Math.ceil(e.pixelWidth * 2 * n);
719
- return Math.min(t.count, a);
717
+ const n = (t.width ?? 400) / Math.max(e.maxX - e.minX, 1e-3), o = Math.ceil(e.pixelWidth * 2 * n);
718
+ return Math.min(t.count, o);
720
719
  }
721
720
  get mesh() {
722
721
  return this.instancedMesh;
@@ -728,7 +727,7 @@ class S {
728
727
  this.geometry.dispose(), Array.isArray(this.material) ? this.material.forEach((t) => t.dispose()) : this.material.dispose();
729
728
  }
730
729
  }
731
- var F = `precision highp float;
730
+ var G = `precision highp float;
732
731
  attribute float pIndex;
733
732
  uniform float uTime;
734
733
  uniform float uCount;
@@ -805,7 +804,7 @@ void main() {
805
804
  vec4 mvPosition = modelViewMatrix * worldPos;
806
805
  gl_PointSize = uPointSize;
807
806
  gl_Position = projectionMatrix * mvPosition;
808
- }`, gt = `precision mediump float;
807
+ }`, zt = `precision mediump float;
809
808
  uniform vec3 uColor;
810
809
 
811
810
  void main() {
@@ -825,7 +824,7 @@ class T {
825
824
  material;
826
825
  params;
827
826
  static customInjection = "";
828
- constructor(t, e = new r.Color(65416)) {
827
+ constructor(t, e = new _(65416)) {
829
828
  this.params = {
830
829
  count: t,
831
830
  frequency: 0.1,
@@ -838,19 +837,19 @@ class T {
838
837
  adaptive: !0,
839
838
  autoSubsampling: !0,
840
839
  autoCulling: !0
841
- }, this.geometry = this.initGeometry(t), this.material = this.initMaterial(t, e), this.points = new r.Points(this.geometry, this.material), this.points.frustumCulled = !1;
840
+ }, this.geometry = this.initGeometry(t), this.material = this.initMaterial(t, e), this.points = new ut(this.geometry, this.material), this.points.frustumCulled = !1;
842
841
  }
843
842
  initGeometry(t) {
844
- const e = new r.BufferGeometry(), i = new Float32Array(t);
843
+ const e = new dt(), i = new Float32Array(t);
845
844
  for (let s = 0; s < t; s++) i[s] = s;
846
- return e.setAttribute("pIndex", new r.BufferAttribute(i, 1)), e.setDrawRange(0, t), e;
845
+ return e.setAttribute("pIndex", new mt(i, 1)), e.setDrawRange(0, t), e;
847
846
  }
848
847
  initMaterial(t, e) {
849
- const i = /else\s*{\s*y\s*=\s*0\.0;\s*}/g, s = F.replace(
848
+ const i = /else\s*{\s*y\s*=\s*0\.0;\s*}/g, s = G.replace(
850
849
  i,
851
850
  T.customInjection || "else { y = 0.0; }"
852
851
  );
853
- return new r.ShaderMaterial({
852
+ return new M({
854
853
  uniforms: {
855
854
  uTime: { value: 0 },
856
855
  uCount: { value: Number(t) },
@@ -862,14 +861,14 @@ class T {
862
861
  uColor: { value: e.clone() },
863
862
  uAdaptive: { value: 1 },
864
863
  uLodFactor: { value: 1 },
865
- uOffset: { value: new r.Vector2(0, 0) }
864
+ uOffset: { value: new d(0, 0) }
866
865
  },
867
866
  vertexShader: s,
868
- fragmentShader: gt,
867
+ fragmentShader: zt,
869
868
  transparent: !1,
870
869
  depthWrite: !1,
871
870
  depthTest: !1,
872
- blending: r.AdditiveBlending
871
+ blending: W
873
872
  });
874
873
  }
875
874
  setParams(t) {
@@ -901,13 +900,13 @@ class T {
901
900
  }
902
901
  injectPresets(t) {
903
902
  let e = "", i = 8;
904
- t.forEach((a, h) => {
905
- e += `else if (preset == ${i}) { // ${h}
906
- y = ${a};
903
+ t.forEach((o, r) => {
904
+ e += `else if (preset == ${i}) { // ${r}
905
+ y = ${o};
907
906
  }
908
907
  `, i++;
909
908
  }), e += "else { y = 0.0; }", T.customInjection = e;
910
- const s = /else\s*{\s*y\s*=\s*0\.0;\s*}/g, n = F.replace(s, e);
909
+ const s = /else\s*{\s*y\s*=\s*0\.0;\s*}/g, n = G.replace(s, e);
911
910
  this.material.vertexShader !== n && (this.material.vertexShader = n, this.material.needsUpdate = !0);
912
911
  }
913
912
  update(t, e) {
@@ -915,8 +914,8 @@ class T {
915
914
  if (!i) return;
916
915
  const s = this.params, n = s.autoUpdate !== !1 ? t : 0;
917
916
  this.updateUniform(i.uTime, n), this.updateUniform(i.uFrequency, s.frequency), this.updateUniform(i.uAmplitude, s.amplitude), this.updateUniform(i.uPlotWidth, s.width ?? 400), this.updateUniform(i.uPreset, Number(s.presetIndex)), this.updateUniform(i.uLodFactor, s.lodFactor ?? 1), this.updateUniform(i.uAdaptive, s.adaptive ? 1 : 0), s.color !== void 0 && i.uColor.value.set(s.color), s.offset && i.uOffset.value.set(s.offset.x, s.offset.y);
918
- const a = this.calculateEffectiveCount(s, e), { drawStart: h, drawCount: c } = this.calculateDrawRange(a, s, e), m = this.calculatePointSize(s.pointSize ?? 5, s.count, s.adaptive ?? !0);
919
- this.updateUniform(i.uPointSize, m), this.updateUniform(i.uCount, a), this.geometry.setDrawRange(h, c);
917
+ const o = this.calculateEffectiveCount(s, e), { drawStart: r, drawCount: l } = this.calculateDrawRange(o, s, e), u = this.calculatePointSize(s.pointSize ?? 5, s.count, s.adaptive ?? !0);
918
+ this.updateUniform(i.uPointSize, u), this.updateUniform(i.uCount, o), this.geometry.setDrawRange(r, l);
920
919
  }
921
920
  updateUniform(t, e) {
922
921
  t.value !== e && (t.value = e);
@@ -928,8 +927,8 @@ class T {
928
927
  }
929
928
  calculateDrawRange(t, e, i) {
930
929
  if (!(e.autoCulling ?? !0) || !i) return { drawStart: 0, drawCount: t };
931
- const s = e.width ?? 400, n = -(s * 0.5), a = (i.minX - n) / s, h = (i.maxX - n) / s, c = Math.max(0, Math.floor(a * (t - 1))), m = Math.min(t - 1, Math.ceil(h * (t - 1)));
932
- return { drawStart: c, drawCount: Math.max(1, m - c + 1) };
930
+ const s = e.width ?? 400, n = -(s * 0.5), o = (i.minX - n) / s, r = (i.maxX - n) / s, l = Math.max(0, Math.floor(o * (t - 1))), u = Math.min(t - 1, Math.ceil(r * (t - 1)));
931
+ return { drawStart: l, drawCount: Math.max(1, u - l + 1) };
933
932
  }
934
933
  calculatePointSize(t, e, i) {
935
934
  return i ? Math.max(0.1, t * Math.sqrt(1e5 / e)) : t;
@@ -944,14 +943,14 @@ class T {
944
943
  this.geometry.dispose(), Array.isArray(this.material) ? this.material.forEach((t) => t.dispose()) : this.material.dispose();
945
944
  }
946
945
  }
947
- var yt = `varying vec2 vUv;
946
+ var Lt = `varying vec2 vUv;
948
947
  varying vec3 vWorldPos;
949
948
 
950
949
  void main() {
951
950
  vUv = uv;
952
951
  vWorldPos = (modelMatrix * vec4(position, 1.0)).xyz;
953
952
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
954
- }`, _t = `precision highp float;
953
+ }`, jt = `precision highp float;
955
954
 
956
955
  varying vec3 vWorldPos;
957
956
 
@@ -1049,7 +1048,7 @@ void main() {
1049
1048
 
1050
1049
  gl_FragColor = vec4(uColor, finalAlpha * 0.8);
1051
1050
  }`;
1052
- const xt = `
1051
+ const It = `
1053
1052
  attribute vec4 aUvOffset;
1054
1053
  attribute vec3 aColor;
1055
1054
  varying vec2 vUv;
@@ -1060,7 +1059,7 @@ void main() {
1060
1059
  vColor = aColor;
1061
1060
  gl_Position = projectionMatrix * modelViewMatrix * instanceMatrix * vec4(position, 1.0);
1062
1061
  }
1063
- `, bt = `
1062
+ `, Ut = `
1064
1063
  varying vec2 vUv;
1065
1064
  varying vec3 vColor;
1066
1065
  uniform sampler2D uMap;
@@ -1094,7 +1093,7 @@ void main() {
1094
1093
  gl_FragColor = vec4(vColor, opacity);
1095
1094
  }
1096
1095
  `;
1097
- class Pt {
1096
+ class Wt {
1098
1097
  mesh;
1099
1098
  material;
1100
1099
  charMap = /* @__PURE__ */ new Map();
@@ -1102,19 +1101,19 @@ class Pt {
1102
1101
  instances = [];
1103
1102
  capacity;
1104
1103
  constructor(t = 100) {
1105
- this.capacity = t, this.material = new r.ShaderMaterial({
1106
- vertexShader: xt,
1107
- fragmentShader: bt,
1104
+ this.capacity = t, this.material = new M({
1105
+ vertexShader: It,
1106
+ fragmentShader: Ut,
1108
1107
  uniforms: { uMap: { value: null } },
1109
1108
  transparent: !0,
1110
- side: r.DoubleSide,
1109
+ side: ft,
1111
1110
  depthWrite: !1
1112
1111
  }), this.mesh = this.createMesh(this.capacity);
1113
1112
  }
1114
1113
  createMesh(t) {
1115
- const e = new r.PlaneGeometry(1, 1);
1116
- e.setAttribute("aUvOffset", new r.InstancedBufferAttribute(new Float32Array(t * 4), 4)), e.setAttribute("aColor", new r.InstancedBufferAttribute(new Float32Array(t * 3), 3));
1117
- const i = new r.InstancedMesh(e, this.material, t);
1114
+ const e = new U(1, 1);
1115
+ e.setAttribute("aUvOffset", new I(new Float32Array(t * 4), 4)), e.setAttribute("aColor", new I(new Float32Array(t * 3), 3));
1116
+ const i = new Q(e, this.material, t);
1118
1117
  return i.count = 0, i.frustumCulled = !1, i;
1119
1118
  }
1120
1119
  grow(t) {
@@ -1124,17 +1123,17 @@ class Pt {
1124
1123
  async load(t, e) {
1125
1124
  const [i, s] = await Promise.all([
1126
1125
  fetch(t).then((n) => n.json()),
1127
- new r.TextureLoader().loadAsync(e)
1126
+ new pt().loadAsync(e)
1128
1127
  ]);
1129
- this.fontData = i, this.fontData && this.fontData.chars && this.fontData.chars.forEach((n) => this.charMap.set(n.char, n)), s.minFilter = r.LinearFilter, s.magFilter = r.LinearFilter, s.generateMipmaps = !1, this.material.uniforms.uMap && (this.material.uniforms.uMap.value = s);
1128
+ this.fontData = i, this.fontData && this.fontData.chars && this.fontData.chars.forEach((n) => this.charMap.set(n.char, n)), s.minFilter = H, s.magFilter = H, s.generateMipmaps = !1, this.material.uniforms.uMap && (this.material.uniforms.uMap.value = s);
1130
1129
  }
1131
- addText(t, e, i, s = 0.1, n = "#ffffff", a = "left") {
1130
+ addText(t, e, i, s = 0.1, n = "#ffffff", o = "left") {
1132
1131
  return this.instances.push({
1133
1132
  text: t,
1134
- position: new r.Vector3(e, i, 0),
1133
+ position: new g(e, i, 0),
1135
1134
  scale: s,
1136
- color: new r.Color(n),
1137
- align: a
1135
+ color: new _(n),
1136
+ align: o
1138
1137
  }), this;
1139
1138
  }
1140
1139
  clear() {
@@ -1143,34 +1142,34 @@ class Pt {
1143
1142
  update() {
1144
1143
  if (!this.fontData) return;
1145
1144
  let t = 0;
1146
- for (const _ of this.instances)
1147
- t += _.text.length;
1145
+ for (const y of this.instances)
1146
+ t += y.text.length;
1148
1147
  t > this.capacity && this.grow(t);
1149
1148
  let e = 0;
1150
- const i = this.mesh.instanceMatrix.array, s = this.mesh.geometry.getAttribute("aUvOffset"), n = s.array, a = this.mesh.geometry.getAttribute("aColor"), h = a.array, c = this.fontData.common.scaleW, m = this.fontData.common.scaleH, Z = this.charMap;
1151
- for (const _ of this.instances) {
1152
- const M = _.text, V = M.length, P = _.scale, E = _.position, D = _.color;
1149
+ const i = this.mesh.instanceMatrix.array, s = this.mesh.geometry.getAttribute("aUvOffset"), n = s.array, o = this.mesh.geometry.getAttribute("aColor"), r = o.array, l = this.fontData.common.scaleW, u = this.fontData.common.scaleH, tt = this.charMap;
1150
+ for (const y of this.instances) {
1151
+ const E = y.text, et = E.length, P = y.scale, D = y.position, k = y.color;
1153
1152
  let A = 0;
1154
- const L = this.calculateWidth(M) * P;
1155
- let k = 0;
1156
- _.align === "center" ? k = -L / 2 : _.align === "right" && (k = -L);
1157
- for (let R = 0; R < V && !(e >= this.capacity); R++) {
1158
- const O = M[R];
1159
- if (O === void 0) continue;
1160
- const p = Z.get(O);
1153
+ const X = this.calculateWidth(E) * P;
1154
+ let R = 0;
1155
+ y.align === "center" ? R = -X / 2 : y.align === "right" && (R = -X);
1156
+ for (let O = 0; O < et && !(e >= this.capacity); O++) {
1157
+ const C = E[O];
1158
+ if (C === void 0) continue;
1159
+ const p = tt.get(C);
1161
1160
  if (!p) {
1162
- O === " " && (A += 20);
1161
+ C === " " && (A += 20);
1163
1162
  continue;
1164
1163
  }
1165
- const d = e * 16, K = p.width * P, q = p.height * P, G = E.x + k + (A + p.xoffset + p.width / 2) * P, B = E.y - (p.yoffset + p.height / 2) * P;
1166
- i[d + 0] = K, i[d + 1] = 0, i[d + 2] = 0, i[d + 3] = 0, i[d + 4] = 0, i[d + 5] = q, i[d + 6] = 0, i[d + 7] = 0, i[d + 8] = 0, i[d + 9] = 0, i[d + 10] = 1, i[d + 11] = 0, i[d + 12] = G, i[d + 13] = B, i[d + 14] = E.z, i[d + 15] = 1;
1164
+ const m = e * 16, it = p.width * P, st = p.height * P, nt = D.x + R + (A + p.xoffset + p.width / 2) * P, at = D.y - (p.yoffset + p.height / 2) * P;
1165
+ i[m + 0] = it, i[m + 1] = 0, i[m + 2] = 0, i[m + 3] = 0, i[m + 4] = 0, i[m + 5] = st, i[m + 6] = 0, i[m + 7] = 0, i[m + 8] = 0, i[m + 9] = 0, i[m + 10] = 1, i[m + 11] = 0, i[m + 12] = nt, i[m + 13] = at, i[m + 14] = D.z, i[m + 15] = 1;
1167
1166
  const v = e * 4;
1168
- n[v + 0] = p.x / c, n[v + 1] = 1 - (p.y + p.height) / m, n[v + 2] = p.width / c, n[v + 3] = p.height / m;
1169
- const C = e * 3;
1170
- h[C + 0] = D.r, h[C + 1] = D.g, h[C + 2] = D.b, A += p.xadvance, e++;
1167
+ n[v + 0] = p.x / l, n[v + 1] = 1 - (p.y + p.height) / u, n[v + 2] = p.width / l, n[v + 3] = p.height / u;
1168
+ const z = e * 3;
1169
+ r[z + 0] = k.r, r[z + 1] = k.g, r[z + 2] = k.b, A += p.xadvance, e++;
1171
1170
  }
1172
1171
  }
1173
- this.mesh.count = e, this.mesh.instanceMatrix.needsUpdate = !0, s.needsUpdate = !0, a.needsUpdate = !0;
1172
+ this.mesh.count = e, this.mesh.instanceMatrix.needsUpdate = !0, s.needsUpdate = !0, o.needsUpdate = !0;
1174
1173
  }
1175
1174
  calculateWidth(t) {
1176
1175
  if (!this.fontData) return 0;
@@ -1192,17 +1191,17 @@ class Pt {
1192
1191
  return this.mesh;
1193
1192
  }
1194
1193
  }
1195
- class N {
1194
+ class B {
1196
1195
  engine;
1197
1196
  params = { offset: { x: 0, y: 0 } };
1198
1197
  constructor(t = 100) {
1199
- this.engine = new Pt(t);
1198
+ this.engine = new Wt(t);
1200
1199
  }
1201
1200
  async load(t, e) {
1202
1201
  await this.engine.load(t, e);
1203
1202
  }
1204
- add(t, e, i, s = 0.1, n = "#ffffff", a = "left") {
1205
- return this.engine.addText(t, e, i, s, n, a), this;
1203
+ add(t, e, i, s = 0.1, n = "#ffffff", o = "left") {
1204
+ return this.engine.addText(t, e, i, s, n, o), this;
1206
1205
  }
1207
1206
  setParams(t) {
1208
1207
  return this.params = { ...this.params, ...t }, this;
@@ -1227,7 +1226,7 @@ class N {
1227
1226
  this.engine.meshObj.geometry.dispose(), Array.isArray(this.engine.meshObj.material) ? this.engine.meshObj.material.forEach((t) => t.dispose()) : this.engine.meshObj.material.dispose();
1228
1227
  }
1229
1228
  }
1230
- class vt {
1229
+ class Yt {
1231
1230
  meshObj;
1232
1231
  geometry;
1233
1232
  material;
@@ -1235,7 +1234,7 @@ class vt {
1235
1234
  textEngine;
1236
1235
  constructor(t = "#ffffff") {
1237
1236
  this.params = {
1238
- color: new r.Color(t),
1237
+ color: new _(t),
1239
1238
  offset: { x: 0, y: 0 },
1240
1239
  tickStep: 50,
1241
1240
  tickSize: 8,
@@ -1250,25 +1249,25 @@ class vt {
1250
1249
  showLabels: !1,
1251
1250
  labelPrecision: 0,
1252
1251
  thickness: 1.5
1253
- }, this.geometry = new r.PlaneGeometry(4e3, 4e3), this.material = new r.ShaderMaterial({
1252
+ }, this.geometry = new U(4e3, 4e3), this.material = new M({
1254
1253
  uniforms: {
1255
1254
  uColor: { value: this.params.color },
1256
- uOffset: { value: new r.Vector2(0, 0) },
1255
+ uOffset: { value: new d(0, 0) },
1257
1256
  uTickStep: { value: 50 },
1258
1257
  uTickSize: { value: 8 },
1259
1258
  uSubTicks: { value: 0 },
1260
1259
  uSubTickSize: { value: 4 },
1261
- uRangeX: { value: new r.Vector2(-200, 200) },
1262
- uRangeY: { value: new r.Vector2(-50, 50) },
1260
+ uRangeX: { value: new d(-200, 200) },
1261
+ uRangeY: { value: new d(-50, 50) },
1263
1262
  uZoom: { value: 1 },
1264
1263
  uThickness: { value: 1.5 }
1265
1264
  },
1266
- vertexShader: yt,
1267
- fragmentShader: _t,
1265
+ vertexShader: Lt,
1266
+ fragmentShader: jt,
1268
1267
  transparent: !0,
1269
1268
  depthWrite: !1,
1270
- blending: r.AdditiveBlending
1271
- }), this.meshObj = new r.Mesh(this.geometry, this.material), this.meshObj.position.z = -0.1;
1269
+ blending: W
1270
+ }), this.meshObj = new gt(this.geometry, this.material), this.meshObj.position.z = -0.1;
1272
1271
  }
1273
1272
  setParams(t) {
1274
1273
  return this.params = { ...this.params, ...t }, this;
@@ -1311,11 +1310,11 @@ class vt {
1311
1310
  }
1312
1311
  renderLabels() {
1313
1312
  if (!this.textEngine) return;
1314
- const t = this.params, e = this.textEngine, i = t.offset.x, s = t.offset.y, n = t.labelPrecision, a = t.minX + i - 4;
1315
- e.add(t.maxY.toFixed(n), a, s + t.maxY, t.labelSize, t.labelColor, "right"), e.add(0 .toFixed(n), a, s, t.labelSize, t.labelColor, "right"), e.add(t.minY.toFixed(n), a, s + t.minY, t.labelSize, t.labelColor, "right");
1316
- const h = t.tickStep, c = Math.ceil(t.minX / h) * h;
1317
- for (let m = c; m <= t.maxX; m += h)
1318
- Math.abs(m - t.minX) < 10 || e.add(m.toFixed(n), m + i, s - 8, t.labelSize * 0.8, t.labelColor, "center");
1313
+ const t = this.params, e = this.textEngine, i = t.offset.x, s = t.offset.y, n = t.labelPrecision, o = t.minX + i - 4;
1314
+ e.add(t.maxY.toFixed(n), o, s + t.maxY, t.labelSize, t.labelColor, "right"), e.add(0 .toFixed(n), o, s, t.labelSize, t.labelColor, "right"), e.add(t.minY.toFixed(n), o, s + t.minY, t.labelSize, t.labelColor, "right");
1315
+ const r = t.tickStep, l = Math.ceil(t.minX / r) * r;
1316
+ for (let u = l; u <= t.maxX; u += r)
1317
+ Math.abs(u - t.minX) < 10 || e.add(u.toFixed(n), u + i, s - 8, t.labelSize * 0.8, t.labelColor, "center");
1319
1318
  }
1320
1319
  updateUniform(t, e) {
1321
1320
  t.value !== e && (t.value = e);
@@ -1330,7 +1329,7 @@ class vt {
1330
1329
  this.geometry.dispose(), this.material.dispose();
1331
1330
  }
1332
1331
  }
1333
- class wt {
1332
+ class Xt {
1334
1333
  params;
1335
1334
  textEngine;
1336
1335
  dummyMesh;
@@ -1348,7 +1347,7 @@ class wt {
1348
1347
  showRangeX: !1,
1349
1348
  position: "right",
1350
1349
  offset: { x: 0, y: 0 }
1351
- }, this.dummyMesh = new r.Object3D();
1350
+ }, this.dummyMesh = new $();
1352
1351
  }
1353
1352
  setParams(t) {
1354
1353
  return this.params = { ...this.params, ...t }, this;
@@ -1382,16 +1381,16 @@ class wt {
1382
1381
  }
1383
1382
  update(t, e) {
1384
1383
  if (!this.textEngine) return;
1385
- const i = this.params, s = this.textEngine, n = i.precision, a = i.offset;
1384
+ const i = this.params, s = this.textEngine, n = i.precision, o = i.offset;
1386
1385
  if (i.position === "left" || i.position === "both") {
1387
- const h = i.minX + a.x - 5;
1388
- i.showMax && s.add(i.maxY.toFixed(n), h, i.maxY + a.y, i.size, i.color, "right"), i.showMin && s.add(i.minY.toFixed(n), h, i.minY + a.y, i.size, i.color, "right");
1386
+ const r = i.minX + o.x - 5;
1387
+ i.showMax && s.add(i.maxY.toFixed(n), r, i.maxY + o.y, i.size, i.color, "right"), i.showMin && s.add(i.minY.toFixed(n), r, i.minY + o.y, i.size, i.color, "right");
1389
1388
  }
1390
1389
  if (i.position === "right" || i.position === "both") {
1391
- const h = i.maxX + a.x + 5;
1392
- i.showMax && s.add(i.maxY.toFixed(n), h, i.maxY + a.y, i.size, i.color, "left"), i.showMin && s.add(i.minY.toFixed(n), h, i.minY + a.y, i.size, i.color, "left");
1390
+ const r = i.maxX + o.x + 5;
1391
+ i.showMax && s.add(i.maxY.toFixed(n), r, i.maxY + o.y, i.size, i.color, "left"), i.showMin && s.add(i.minY.toFixed(n), r, i.minY + o.y, i.size, i.color, "left");
1393
1392
  }
1394
- i.showRangeX && (s.add(i.minX.toFixed(n), i.minX + a.x, i.minY + a.y - 12, i.size * 0.8, i.color, "center"), s.add(i.maxX.toFixed(n), i.maxX + a.x, i.minY + a.y - 12, i.size * 0.8, i.color, "center"));
1393
+ i.showRangeX && (s.add(i.minX.toFixed(n), i.minX + o.x, i.minY + o.y - 12, i.size * 0.8, i.color, "center"), s.add(i.maxX.toFixed(n), i.maxX + o.x, i.minY + o.y - 12, i.size * 0.8, i.color, "center"));
1395
1394
  }
1396
1395
  get mesh() {
1397
1396
  return this.dummyMesh;
@@ -1402,7 +1401,7 @@ class wt {
1402
1401
  dispose() {
1403
1402
  }
1404
1403
  }
1405
- class St {
1404
+ class Ft {
1406
1405
  scene;
1407
1406
  camera;
1408
1407
  renderer;
@@ -1418,30 +1417,38 @@ class St {
1418
1417
  customPresets = /* @__PURE__ */ new Map();
1419
1418
  onUpdate;
1420
1419
  constructor(t, e = {}) {
1421
- this.container = t, this.autoRender = e.autoRender !== !1, this.fontConfig = e.font, this.scene = e.scene || new r.Scene(), e.scene || (this.scene.background = new r.Color(657930));
1422
- const i = this.container.clientWidth, s = this.container.clientHeight, n = i / s, a = 250;
1423
- this.camera = e.camera || new r.OrthographicCamera(
1424
- -a * n,
1425
- a * n,
1426
- a,
1427
- -a,
1428
- 0.1,
1429
- 2e3
1430
- ), e.camera || this.camera.position.set(0, 0, 500), e.renderer ? (this.renderer = e.renderer, this.isExternalRenderer = !0) : (this.renderer = new r.WebGLRenderer({
1431
- antialias: e.antialias ?? !1,
1432
- alpha: e.alpha ?? !1,
1433
- powerPreference: "high-performance"
1434
- }), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2)), this.renderer.setSize(i, s), this.container.appendChild(this.renderer.domElement)), this.controls = new it(this.camera, this.renderer.domElement), this.controls.enableDamping = !0, this.controls.enableRotate = !1, this.controls.mouseButtons = {
1435
- LEFT: r.MOUSE.PAN,
1436
- MIDDLE: r.MOUSE.DOLLY,
1437
- RIGHT: r.MOUSE.ROTATE
1438
- }, this.resizeObserver = new ResizeObserver(() => this.onResize()), this.resizeObserver.observe(this.container), this.autoRender && this.animate();
1420
+ this.container = t, this.autoRender = e.autoRender !== !1, this.fontConfig = e.font, this.scene = e.scene || new xt(), !e.scene && !this.scene.background && (this.scene.background = new _(657930));
1421
+ const i = this.container.clientWidth, s = this.container.clientHeight, n = i / s, o = 250;
1422
+ if (e.camera)
1423
+ this.camera = e.camera;
1424
+ else {
1425
+ const r = new L(
1426
+ -o * n,
1427
+ o * n,
1428
+ o,
1429
+ -o,
1430
+ 0.1,
1431
+ 2e3
1432
+ );
1433
+ r.position.set(0, 0, 500), this.camera = r;
1434
+ }
1435
+ if (e.renderer)
1436
+ this.renderer = e.renderer, this.isExternalRenderer = !0;
1437
+ else
1438
+ try {
1439
+ this.renderer = new yt({
1440
+ antialias: e.antialias ?? !1,
1441
+ alpha: e.alpha ?? !1
1442
+ }), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2)), this.renderer.setSize(i, s), this.container.appendChild(this.renderer.domElement);
1443
+ } catch (r) {
1444
+ throw console.error("ThreePlot: Failed to create WebGL context", r), new Error("WebGL not supported or context creation failed");
1445
+ }
1446
+ e.controls !== !1 && (this.controls = new bt(this.camera, this.renderer.domElement), this.controls.enableDamping = !0, this.controls.enableRotate = !1, this.controls.mouseButtons = {
1447
+ LEFT: x.PAN,
1448
+ MIDDLE: x.DOLLY,
1449
+ RIGHT: x.ROTATE
1450
+ }), this.isExternalRenderer || (this.resizeObserver = new ResizeObserver(() => this.onResize()), this.resizeObserver.observe(this.container)), this.autoRender && this.animate();
1439
1451
  }
1440
- /**
1441
- * Registers a custom signal preset that can be used by Line and Point plots.
1442
- * @param name The name of the preset
1443
- * @param glsl The GLSL function body that returns a float. Available variables: t (time+freq), x (world pos).
1444
- */
1445
1452
  registerPreset(t, e) {
1446
1453
  return this.customPresets.set(t, e), this.plots.forEach((i) => {
1447
1454
  i.injectPresets && i.injectPresets(this.customPresets);
@@ -1449,7 +1456,7 @@ class St {
1449
1456
  }
1450
1457
  add(t, e, i) {
1451
1458
  let s;
1452
- return t === "line" ? s = new S(e, new r.Color(i || "#00ff88")) : t === "point" ? s = new T(e, new r.Color(i || "#00ff88")) : t === "axis" ? s = new vt(e || "#ffffff") : t === "legend" ? s = new wt() : t === "text" && (s = new N(e || 100), this.fontConfig && this.fontConfig.json && this.fontConfig.texture && s.load(this.fontConfig.json, this.fontConfig.texture), this.textPlots.add(s)), t !== "text" && (this.plots.add(s), s.injectPresets && this.customPresets.size > 0 && s.injectPresets(this.customPresets)), this.scene.add(s.mesh), s;
1459
+ return t === "line" ? s = new S(e, new _(i || "#00ff88")) : t === "point" ? s = new T(e, new _(i || "#00ff88")) : t === "axis" ? s = new Yt(e || "#ffffff") : t === "legend" ? s = new Xt() : t === "text" && (s = new B(e || 100), this.fontConfig && this.fontConfig.json && this.fontConfig.texture && s.load(this.fontConfig.json, this.fontConfig.texture), this.textPlots.add(s)), t !== "text" && (this.plots.add(s), s.injectPresets && this.customPresets.size > 0 && s.injectPresets(this.customPresets)), this.scene.add(s.mesh), s;
1453
1460
  }
1454
1461
  line(t, e) {
1455
1462
  return this.add("line", t, e);
@@ -1467,7 +1474,7 @@ class St {
1467
1474
  return this.add("text", t);
1468
1475
  }
1469
1476
  remove(t) {
1470
- return this.plots.delete(t), t instanceof N && this.textPlots.delete(t), this.scene.remove(t.mesh), t.dispose(), this;
1477
+ return this.plots.delete(t), t instanceof B && this.textPlots.delete(t), this.scene.remove(t.mesh), t.dispose(), this;
1471
1478
  }
1472
1479
  clear() {
1473
1480
  return this.plots.forEach((t) => {
@@ -1478,11 +1485,18 @@ class St {
1478
1485
  }
1479
1486
  onResize() {
1480
1487
  const t = this.container.clientWidth, e = this.container.clientHeight, i = t / e, s = 250;
1481
- this.camera.left = -s * i, this.camera.right = s * i, this.camera.top = s, this.camera.bottom = -s, this.camera.updateProjectionMatrix(), this.renderer.setSize(t, e);
1488
+ this.camera instanceof L ? (this.camera.left = -s * i, this.camera.right = s * i, this.camera.top = s, this.camera.bottom = -s, this.camera.updateProjectionMatrix()) : this.camera instanceof Z && (this.camera.aspect = i, this.camera.updateProjectionMatrix()), this.renderer.setSize(t, e);
1482
1489
  }
1483
1490
  getViewportStats() {
1484
- const t = this.container.clientWidth, e = this.container.clientHeight, i = this.camera.zoom, s = this.camera.position.x + this.camera.left / i, n = this.camera.position.x + this.camera.right / i;
1485
- return { pixelWidth: t, pixelHeight: e, minX: s, maxX: n, zoom: i };
1491
+ const t = this.container.clientWidth, e = this.container.clientHeight;
1492
+ let i = -100, s = 100, n = 1;
1493
+ if (this.camera instanceof L)
1494
+ n = this.camera.zoom, i = this.camera.position.x + this.camera.left / n, s = this.camera.position.x + this.camera.right / n;
1495
+ else if (this.camera instanceof Z) {
1496
+ const o = this.camera.position.z, r = this.camera.fov * Math.PI / 180, u = 2 * Math.tan(r / 2) * o * (t / e);
1497
+ i = this.camera.position.x - u / 2, s = this.camera.position.x + u / 2, n = 1;
1498
+ }
1499
+ return { pixelWidth: t, pixelHeight: e, minX: i, maxX: s, zoom: n };
1486
1500
  }
1487
1501
  getRendererInfo() {
1488
1502
  return {
@@ -1494,21 +1508,32 @@ class St {
1494
1508
  }
1495
1509
  render() {
1496
1510
  const t = performance.now(), e = this.getViewportStats();
1497
- this.onUpdate && this.onUpdate(t), this.plots.forEach((i) => i.update(t / 1e3, e)), this.textPlots.forEach((i) => i.update(t / 1e3, e)), this.controls.update(), this.renderer.render(this.scene, this.camera);
1511
+ this.onUpdate && this.onUpdate(t), this.plots.forEach((i) => i.update(t / 1e3, e)), this.textPlots.forEach((i) => i.update(t / 1e3, e)), this.controls && this.controls.update(), this.renderer.render(this.scene, this.camera);
1498
1512
  }
1499
1513
  animate() {
1500
1514
  this.autoRender && (this.animationId = requestAnimationFrame(() => this.animate()), this.render());
1501
1515
  }
1502
1516
  destroy() {
1503
- this.animationId !== null && cancelAnimationFrame(this.animationId), this.resizeObserver.disconnect(), this.clear(), this.isExternalRenderer || (this.renderer.dispose(), this.renderer.domElement.remove()), this.controls.dispose();
1517
+ this.animationId !== null && cancelAnimationFrame(this.animationId), this.resizeObserver && this.resizeObserver.disconnect(), this.clear(), this.isExternalRenderer || (this.renderer.dispose(), this.renderer.domElement.remove()), this.controls && this.controls.dispose();
1504
1518
  }
1505
1519
  }
1506
- const Mt = {
1520
+ const Ht = {
1507
1521
  /**
1508
1522
  * Initializes a new PlotContainer in the given element.
1509
1523
  */
1510
- init(o, t) {
1511
- return new St(o, t);
1524
+ init(a, t) {
1525
+ return new Ft(a, t);
1526
+ },
1527
+ /**
1528
+ * Checks if WebGL is available in the current environment.
1529
+ */
1530
+ isSupported() {
1531
+ try {
1532
+ const a = document.createElement("canvas");
1533
+ return !!(window.WebGLRenderingContext && (a.getContext("webgl") || a.getContext("experimental-webgl")));
1534
+ } catch {
1535
+ return !1;
1536
+ }
1512
1537
  },
1513
1538
  /**
1514
1539
  * Version info
@@ -1516,12 +1541,12 @@ const Mt = {
1516
1541
  version: "1.2.0"
1517
1542
  };
1518
1543
  export {
1519
- vt as AxisPlot,
1520
- wt as LegendPlot,
1544
+ Yt as AxisPlot,
1545
+ Xt as LegendPlot,
1521
1546
  S as LinePlot,
1522
- Pt as MSDFText,
1523
- St as PlotContainer,
1547
+ Wt as MSDFText,
1548
+ Ft as PlotContainer,
1524
1549
  T as PointPlot,
1525
- N as TextPlot,
1526
- Mt as ThreePlot
1550
+ B as TextPlot,
1551
+ Ht as ThreePlot
1527
1552
  };