bridgeapp-ai-chat-widget 0.2.14 → 0.2.16

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.
@@ -0,0 +1,458 @@
1
+ import { C as S, V as p, M as u, T as _, Q as E, S as P, a as c, R as w, P as O, b as R } from "./Avatar-XISRbl7X.js";
2
+ const D = { type: "change" }, b = { type: "start" }, M = { type: "end" }, f = new w(), T = new O(), j = Math.cos(70 * R.DEG2RAD), n = new p(), r = 2 * Math.PI, o = {
3
+ NONE: -1,
4
+ ROTATE: 0,
5
+ DOLLY: 1,
6
+ PAN: 2,
7
+ TOUCH_ROTATE: 3,
8
+ TOUCH_PAN: 4,
9
+ TOUCH_DOLLY_PAN: 5,
10
+ TOUCH_DOLLY_ROTATE: 6
11
+ }, y = 1e-6;
12
+ class X extends S {
13
+ /**
14
+ * Constructs a new controls instance.
15
+ *
16
+ * @param {Object3D} object - The object that is managed by the controls.
17
+ * @param {?HTMLElement} domElement - The HTML element used for event listeners.
18
+ */
19
+ constructor(t, e = null) {
20
+ super(t, e), this.state = o.NONE, this.target = new p(), this.cursor = new p(), 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: u.ROTATE, MIDDLE: u.DOLLY, RIGHT: u.PAN }, this.touches = { ONE: _.ROTATE, TWO: _.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new p(), this._lastQuaternion = new E(), this._lastTargetPosition = new p(), this._quat = new E().setFromUnitVectors(t.up, new p(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new P(), this._sphericalDelta = new P(), this._scale = 1, this._panOffset = new p(), this._rotateStart = new c(), this._rotateEnd = new c(), this._rotateDelta = new c(), this._panStart = new c(), this._panEnd = new c(), this._panDelta = new c(), this._dollyStart = new c(), this._dollyEnd = new c(), this._dollyDelta = new c(), this._dollyDirection = new p(), this._mouse = new c(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = L.bind(this), this._onPointerDown = A.bind(this), this._onPointerUp = k.bind(this), this._onContextMenu = Z.bind(this), this._onMouseWheel = N.bind(this), this._onKeyDown = Y.bind(this), this._onTouchStart = I.bind(this), this._onTouchMove = U.bind(this), this._onMouseDown = x.bind(this), this._onMouseMove = C.bind(this), this._interceptControlDown = z.bind(this), this._interceptControlUp = K.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
21
+ }
22
+ connect(t) {
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";
24
+ }
25
+ disconnect() {
26
+ this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp), this.domElement.removeEventListener("pointercancel", this._onPointerUp), this.domElement.removeEventListener("wheel", this._onMouseWheel), this.domElement.removeEventListener("contextmenu", this._onContextMenu), this.stopListenToKeyEvents(), this.domElement.getRootNode().removeEventListener("keydown", this._interceptControlDown, { capture: !0 }), this.domElement.style.touchAction = "auto";
27
+ }
28
+ dispose() {
29
+ this.disconnect();
30
+ }
31
+ /**
32
+ * Get the current vertical rotation, in radians.
33
+ *
34
+ * @return {number} The current vertical rotation, in radians.
35
+ */
36
+ getPolarAngle() {
37
+ return this._spherical.phi;
38
+ }
39
+ /**
40
+ * Get the current horizontal rotation, in radians.
41
+ *
42
+ * @return {number} The current horizontal rotation, in radians.
43
+ */
44
+ getAzimuthalAngle() {
45
+ return this._spherical.theta;
46
+ }
47
+ /**
48
+ * Returns the distance from the camera to the target.
49
+ *
50
+ * @return {number} The distance from the camera to the target.
51
+ */
52
+ getDistance() {
53
+ return this.object.position.distanceTo(this.target);
54
+ }
55
+ /**
56
+ * Adds key event listeners to the given DOM element.
57
+ * `window` is a recommended argument for using this method.
58
+ *
59
+ * @param {HTMLElement} domElement - The DOM element
60
+ */
61
+ listenToKeyEvents(t) {
62
+ t.addEventListener("keydown", this._onKeyDown), this._domElementKeyEvents = t;
63
+ }
64
+ /**
65
+ * Removes the key event listener previously defined with `listenToKeyEvents()`.
66
+ */
67
+ stopListenToKeyEvents() {
68
+ this._domElementKeyEvents !== null && (this._domElementKeyEvents.removeEventListener("keydown", this._onKeyDown), this._domElementKeyEvents = null);
69
+ }
70
+ /**
71
+ * Save the current state of the controls. This can later be recovered with `reset()`.
72
+ */
73
+ saveState() {
74
+ this.target0.copy(this.target), this.position0.copy(this.object.position), this.zoom0 = this.object.zoom;
75
+ }
76
+ /**
77
+ * Reset the controls to their state from either the last time the `saveState()`
78
+ * was called, or the initial state.
79
+ */
80
+ reset() {
81
+ this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(D), this.update(), this.state = o.NONE;
82
+ }
83
+ update(t = null) {
84
+ const e = this.object.position;
85
+ n.copy(e).sub(this.target), n.applyQuaternion(this._quat), this._spherical.setFromVector3(n), this.autoRotate && this.state === o.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);
86
+ let s = this.minAzimuthAngle, a = this.maxAzimuthAngle;
87
+ isFinite(s) && isFinite(a) && (s < -Math.PI ? s += r : s > Math.PI && (s -= r), a < -Math.PI ? a += r : a > Math.PI && (a -= r), s <= a ? this._spherical.theta = Math.max(s, Math.min(a, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (s + a) / 2 ? Math.max(s, this._spherical.theta) : Math.min(a, 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);
88
+ let h = !1;
89
+ if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera)
90
+ this._spherical.radius = this._clampDistance(this._spherical.radius);
91
+ else {
92
+ const l = this._spherical.radius;
93
+ this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), h = l != this._spherical.radius;
94
+ }
95
+ if (n.setFromSpherical(this._spherical), n.applyQuaternion(this._quatInverse), e.copy(this.target).add(n), 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 l = null;
97
+ if (this.object.isPerspectiveCamera) {
98
+ const d = n.length();
99
+ l = this._clampDistance(d * this._scale);
100
+ const m = d - l;
101
+ this.object.position.addScaledVector(this._dollyDirection, m), this.object.updateMatrixWorld(), h = !!m;
102
+ } else if (this.object.isOrthographicCamera) {
103
+ const d = new p(this._mouse.x, this._mouse.y, 0);
104
+ d.unproject(this.object);
105
+ const m = this.object.zoom;
106
+ this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), h = m !== this.object.zoom;
107
+ const g = new p(this._mouse.x, this._mouse.y, 0);
108
+ g.unproject(this.object), this.object.position.sub(g).add(d), this.object.updateMatrixWorld(), l = n.length();
109
+ } else
110
+ console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
111
+ l !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(l).add(this.object.position) : (f.origin.copy(this.object.position), f.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(f.direction)) < j ? this.object.lookAt(this.target) : (T.setFromNormalAndCoplanarPoint(this.object.up, this.target), f.intersectPlane(T, this.target))));
112
+ } else if (this.object.isOrthographicCamera) {
113
+ const l = this.object.zoom;
114
+ this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), l !== this.object.zoom && (this.object.updateProjectionMatrix(), h = !0);
115
+ }
116
+ return this._scale = 1, this._performCursorZoom = !1, h || this._lastPosition.distanceToSquared(this.object.position) > y || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > y || this._lastTargetPosition.distanceToSquared(this.target) > y ? (this.dispatchEvent(D), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
117
+ }
118
+ _getAutoRotationAngle(t) {
119
+ return t !== null ? r / 60 * this.autoRotateSpeed * t : r / 60 / 60 * this.autoRotateSpeed;
120
+ }
121
+ _getZoomScale(t) {
122
+ const e = Math.abs(t * 0.01);
123
+ return Math.pow(0.95, this.zoomSpeed * e);
124
+ }
125
+ _rotateLeft(t) {
126
+ this._sphericalDelta.theta -= t;
127
+ }
128
+ _rotateUp(t) {
129
+ this._sphericalDelta.phi -= t;
130
+ }
131
+ _panLeft(t, e) {
132
+ n.setFromMatrixColumn(e, 0), n.multiplyScalar(-t), this._panOffset.add(n);
133
+ }
134
+ _panUp(t, e) {
135
+ this.screenSpacePanning === !0 ? n.setFromMatrixColumn(e, 1) : (n.setFromMatrixColumn(e, 0), n.crossVectors(this.object.up, n)), n.multiplyScalar(t), this._panOffset.add(n);
136
+ }
137
+ // deltaX and deltaY are in pixels; right and down are positive
138
+ _pan(t, e) {
139
+ const s = this.domElement;
140
+ if (this.object.isPerspectiveCamera) {
141
+ const a = this.object.position;
142
+ n.copy(a).sub(this.target);
143
+ let h = n.length();
144
+ h *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * t * h / s.clientHeight, this.object.matrix), this._panUp(2 * e * h / s.clientHeight, this.object.matrix);
145
+ } else this.object.isOrthographicCamera ? (this._panLeft(t * (this.object.right - this.object.left) / this.object.zoom / s.clientWidth, this.object.matrix), this._panUp(e * (this.object.top - this.object.bottom) / this.object.zoom / s.clientHeight, this.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), this.enablePan = !1);
146
+ }
147
+ _dollyOut(t) {
148
+ this.object.isPerspectiveCamera || this.object.isOrthographicCamera ? this._scale /= t : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), this.enableZoom = !1);
149
+ }
150
+ _dollyIn(t) {
151
+ this.object.isPerspectiveCamera || this.object.isOrthographicCamera ? this._scale *= t : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), this.enableZoom = !1);
152
+ }
153
+ _updateZoomParameters(t, e) {
154
+ if (!this.zoomToCursor)
155
+ return;
156
+ this._performCursorZoom = !0;
157
+ const s = this.domElement.getBoundingClientRect(), a = t - s.left, h = e - s.top, l = s.width, d = s.height;
158
+ this._mouse.x = a / l * 2 - 1, this._mouse.y = -(h / d) * 2 + 1, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
159
+ }
160
+ _clampDistance(t) {
161
+ return Math.max(this.minDistance, Math.min(this.maxDistance, t));
162
+ }
163
+ //
164
+ // event callbacks - update the object state
165
+ //
166
+ _handleMouseDownRotate(t) {
167
+ this._rotateStart.set(t.clientX, t.clientY);
168
+ }
169
+ _handleMouseDownDolly(t) {
170
+ this._updateZoomParameters(t.clientX, t.clientX), this._dollyStart.set(t.clientX, t.clientY);
171
+ }
172
+ _handleMouseDownPan(t) {
173
+ this._panStart.set(t.clientX, t.clientY);
174
+ }
175
+ _handleMouseMoveRotate(t) {
176
+ this._rotateEnd.set(t.clientX, t.clientY), this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
177
+ const e = this.domElement;
178
+ this._rotateLeft(r * this._rotateDelta.x / e.clientHeight), this._rotateUp(r * this._rotateDelta.y / e.clientHeight), this._rotateStart.copy(this._rotateEnd), this.update();
179
+ }
180
+ _handleMouseMoveDolly(t) {
181
+ this._dollyEnd.set(t.clientX, t.clientY), this._dollyDelta.subVectors(this._dollyEnd, this._dollyStart), this._dollyDelta.y > 0 ? this._dollyOut(this._getZoomScale(this._dollyDelta.y)) : this._dollyDelta.y < 0 && this._dollyIn(this._getZoomScale(this._dollyDelta.y)), this._dollyStart.copy(this._dollyEnd), this.update();
182
+ }
183
+ _handleMouseMovePan(t) {
184
+ this._panEnd.set(t.clientX, t.clientY), this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed), this._pan(this._panDelta.x, this._panDelta.y), this._panStart.copy(this._panEnd), this.update();
185
+ }
186
+ _handleMouseWheel(t) {
187
+ this._updateZoomParameters(t.clientX, t.clientY), t.deltaY < 0 ? this._dollyIn(this._getZoomScale(t.deltaY)) : t.deltaY > 0 && this._dollyOut(this._getZoomScale(t.deltaY)), this.update();
188
+ }
189
+ _handleKeyDown(t) {
190
+ let e = !1;
191
+ switch (t.code) {
192
+ case this.keys.UP:
193
+ t.ctrlKey || t.metaKey || t.shiftKey ? this.enableRotate && this._rotateUp(r * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, this.keyPanSpeed), e = !0;
194
+ break;
195
+ case this.keys.BOTTOM:
196
+ t.ctrlKey || t.metaKey || t.shiftKey ? this.enableRotate && this._rotateUp(-r * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, -this.keyPanSpeed), e = !0;
197
+ break;
198
+ case this.keys.LEFT:
199
+ t.ctrlKey || t.metaKey || t.shiftKey ? this.enableRotate && this._rotateLeft(r * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(this.keyPanSpeed, 0), e = !0;
200
+ break;
201
+ case this.keys.RIGHT:
202
+ t.ctrlKey || t.metaKey || t.shiftKey ? this.enableRotate && this._rotateLeft(-r * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(-this.keyPanSpeed, 0), e = !0;
203
+ break;
204
+ }
205
+ e && (t.preventDefault(), this.update());
206
+ }
207
+ _handleTouchStartRotate(t) {
208
+ if (this._pointers.length === 1)
209
+ this._rotateStart.set(t.pageX, t.pageY);
210
+ else {
211
+ const e = this._getSecondPointerPosition(t), s = 0.5 * (t.pageX + e.x), a = 0.5 * (t.pageY + e.y);
212
+ this._rotateStart.set(s, a);
213
+ }
214
+ }
215
+ _handleTouchStartPan(t) {
216
+ if (this._pointers.length === 1)
217
+ this._panStart.set(t.pageX, t.pageY);
218
+ else {
219
+ const e = this._getSecondPointerPosition(t), s = 0.5 * (t.pageX + e.x), a = 0.5 * (t.pageY + e.y);
220
+ this._panStart.set(s, a);
221
+ }
222
+ }
223
+ _handleTouchStartDolly(t) {
224
+ const e = this._getSecondPointerPosition(t), s = t.pageX - e.x, a = t.pageY - e.y, h = Math.sqrt(s * s + a * a);
225
+ this._dollyStart.set(0, h);
226
+ }
227
+ _handleTouchStartDollyPan(t) {
228
+ this.enableZoom && this._handleTouchStartDolly(t), this.enablePan && this._handleTouchStartPan(t);
229
+ }
230
+ _handleTouchStartDollyRotate(t) {
231
+ this.enableZoom && this._handleTouchStartDolly(t), this.enableRotate && this._handleTouchStartRotate(t);
232
+ }
233
+ _handleTouchMoveRotate(t) {
234
+ if (this._pointers.length == 1)
235
+ this._rotateEnd.set(t.pageX, t.pageY);
236
+ else {
237
+ const s = this._getSecondPointerPosition(t), a = 0.5 * (t.pageX + s.x), h = 0.5 * (t.pageY + s.y);
238
+ this._rotateEnd.set(a, h);
239
+ }
240
+ this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
241
+ const e = this.domElement;
242
+ this._rotateLeft(r * this._rotateDelta.x / e.clientHeight), this._rotateUp(r * this._rotateDelta.y / e.clientHeight), this._rotateStart.copy(this._rotateEnd);
243
+ }
244
+ _handleTouchMovePan(t) {
245
+ if (this._pointers.length === 1)
246
+ this._panEnd.set(t.pageX, t.pageY);
247
+ else {
248
+ const e = this._getSecondPointerPosition(t), s = 0.5 * (t.pageX + e.x), a = 0.5 * (t.pageY + e.y);
249
+ this._panEnd.set(s, a);
250
+ }
251
+ this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed), this._pan(this._panDelta.x, this._panDelta.y), this._panStart.copy(this._panEnd);
252
+ }
253
+ _handleTouchMoveDolly(t) {
254
+ const e = this._getSecondPointerPosition(t), s = t.pageX - e.x, a = t.pageY - e.y, h = Math.sqrt(s * s + a * a);
255
+ this._dollyEnd.set(0, h), this._dollyDelta.set(0, Math.pow(this._dollyEnd.y / this._dollyStart.y, this.zoomSpeed)), this._dollyOut(this._dollyDelta.y), this._dollyStart.copy(this._dollyEnd);
256
+ const l = (t.pageX + e.x) * 0.5, d = (t.pageY + e.y) * 0.5;
257
+ this._updateZoomParameters(l, d);
258
+ }
259
+ _handleTouchMoveDollyPan(t) {
260
+ this.enableZoom && this._handleTouchMoveDolly(t), this.enablePan && this._handleTouchMovePan(t);
261
+ }
262
+ _handleTouchMoveDollyRotate(t) {
263
+ this.enableZoom && this._handleTouchMoveDolly(t), this.enableRotate && this._handleTouchMoveRotate(t);
264
+ }
265
+ // pointers
266
+ _addPointer(t) {
267
+ this._pointers.push(t.pointerId);
268
+ }
269
+ _removePointer(t) {
270
+ delete this._pointerPositions[t.pointerId];
271
+ for (let e = 0; e < this._pointers.length; e++)
272
+ if (this._pointers[e] == t.pointerId) {
273
+ this._pointers.splice(e, 1);
274
+ return;
275
+ }
276
+ }
277
+ _isTrackingPointer(t) {
278
+ for (let e = 0; e < this._pointers.length; e++)
279
+ if (this._pointers[e] == t.pointerId) return !0;
280
+ return !1;
281
+ }
282
+ _trackPointer(t) {
283
+ let e = this._pointerPositions[t.pointerId];
284
+ e === void 0 && (e = new c(), this._pointerPositions[t.pointerId] = e), e.set(t.pageX, t.pageY);
285
+ }
286
+ _getSecondPointerPosition(t) {
287
+ const e = t.pointerId === this._pointers[0] ? this._pointers[1] : this._pointers[0];
288
+ return this._pointerPositions[e];
289
+ }
290
+ //
291
+ _customWheelEvent(t) {
292
+ const e = t.deltaMode, s = {
293
+ clientX: t.clientX,
294
+ clientY: t.clientY,
295
+ deltaY: t.deltaY
296
+ };
297
+ switch (e) {
298
+ case 1:
299
+ s.deltaY *= 16;
300
+ break;
301
+ case 2:
302
+ s.deltaY *= 100;
303
+ break;
304
+ }
305
+ return t.ctrlKey && !this._controlActive && (s.deltaY *= 10), s;
306
+ }
307
+ }
308
+ function A(i) {
309
+ this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(i.pointerId), this.domElement.ownerDocument.addEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(i) && (this._addPointer(i), i.pointerType === "touch" ? this._onTouchStart(i) : this._onMouseDown(i)));
310
+ }
311
+ function L(i) {
312
+ this.enabled !== !1 && (i.pointerType === "touch" ? this._onTouchMove(i) : this._onMouseMove(i));
313
+ }
314
+ function k(i) {
315
+ switch (this._removePointer(i), this._pointers.length) {
316
+ case 0:
317
+ this.domElement.releasePointerCapture(i.pointerId), this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(M), this.state = o.NONE;
318
+ break;
319
+ case 1:
320
+ const t = this._pointers[0], e = this._pointerPositions[t];
321
+ this._onTouchStart({ pointerId: t, pageX: e.x, pageY: e.y });
322
+ break;
323
+ }
324
+ }
325
+ function x(i) {
326
+ let t;
327
+ switch (i.button) {
328
+ case 0:
329
+ t = this.mouseButtons.LEFT;
330
+ break;
331
+ case 1:
332
+ t = this.mouseButtons.MIDDLE;
333
+ break;
334
+ case 2:
335
+ t = this.mouseButtons.RIGHT;
336
+ break;
337
+ default:
338
+ t = -1;
339
+ }
340
+ switch (t) {
341
+ case u.DOLLY:
342
+ if (this.enableZoom === !1) return;
343
+ this._handleMouseDownDolly(i), this.state = o.DOLLY;
344
+ break;
345
+ case u.ROTATE:
346
+ if (i.ctrlKey || i.metaKey || i.shiftKey) {
347
+ if (this.enablePan === !1) return;
348
+ this._handleMouseDownPan(i), this.state = o.PAN;
349
+ } else {
350
+ if (this.enableRotate === !1) return;
351
+ this._handleMouseDownRotate(i), this.state = o.ROTATE;
352
+ }
353
+ break;
354
+ case u.PAN:
355
+ if (i.ctrlKey || i.metaKey || i.shiftKey) {
356
+ if (this.enableRotate === !1) return;
357
+ this._handleMouseDownRotate(i), this.state = o.ROTATE;
358
+ } else {
359
+ if (this.enablePan === !1) return;
360
+ this._handleMouseDownPan(i), this.state = o.PAN;
361
+ }
362
+ break;
363
+ default:
364
+ this.state = o.NONE;
365
+ }
366
+ this.state !== o.NONE && this.dispatchEvent(b);
367
+ }
368
+ function C(i) {
369
+ switch (this.state) {
370
+ case o.ROTATE:
371
+ if (this.enableRotate === !1) return;
372
+ this._handleMouseMoveRotate(i);
373
+ break;
374
+ case o.DOLLY:
375
+ if (this.enableZoom === !1) return;
376
+ this._handleMouseMoveDolly(i);
377
+ break;
378
+ case o.PAN:
379
+ if (this.enablePan === !1) return;
380
+ this._handleMouseMovePan(i);
381
+ break;
382
+ }
383
+ }
384
+ function N(i) {
385
+ this.enabled === !1 || this.enableZoom === !1 || this.state !== o.NONE || (i.preventDefault(), this.dispatchEvent(b), this._handleMouseWheel(this._customWheelEvent(i)), this.dispatchEvent(M));
386
+ }
387
+ function Y(i) {
388
+ this.enabled !== !1 && this._handleKeyDown(i);
389
+ }
390
+ function I(i) {
391
+ switch (this._trackPointer(i), this._pointers.length) {
392
+ case 1:
393
+ switch (this.touches.ONE) {
394
+ case _.ROTATE:
395
+ if (this.enableRotate === !1) return;
396
+ this._handleTouchStartRotate(i), this.state = o.TOUCH_ROTATE;
397
+ break;
398
+ case _.PAN:
399
+ if (this.enablePan === !1) return;
400
+ this._handleTouchStartPan(i), this.state = o.TOUCH_PAN;
401
+ break;
402
+ default:
403
+ this.state = o.NONE;
404
+ }
405
+ break;
406
+ case 2:
407
+ switch (this.touches.TWO) {
408
+ case _.DOLLY_PAN:
409
+ if (this.enableZoom === !1 && this.enablePan === !1) return;
410
+ this._handleTouchStartDollyPan(i), this.state = o.TOUCH_DOLLY_PAN;
411
+ break;
412
+ case _.DOLLY_ROTATE:
413
+ if (this.enableZoom === !1 && this.enableRotate === !1) return;
414
+ this._handleTouchStartDollyRotate(i), this.state = o.TOUCH_DOLLY_ROTATE;
415
+ break;
416
+ default:
417
+ this.state = o.NONE;
418
+ }
419
+ break;
420
+ default:
421
+ this.state = o.NONE;
422
+ }
423
+ this.state !== o.NONE && this.dispatchEvent(b);
424
+ }
425
+ function U(i) {
426
+ switch (this._trackPointer(i), this.state) {
427
+ case o.TOUCH_ROTATE:
428
+ if (this.enableRotate === !1) return;
429
+ this._handleTouchMoveRotate(i), this.update();
430
+ break;
431
+ case o.TOUCH_PAN:
432
+ if (this.enablePan === !1) return;
433
+ this._handleTouchMovePan(i), this.update();
434
+ break;
435
+ case o.TOUCH_DOLLY_PAN:
436
+ if (this.enableZoom === !1 && this.enablePan === !1) return;
437
+ this._handleTouchMoveDollyPan(i), this.update();
438
+ break;
439
+ case o.TOUCH_DOLLY_ROTATE:
440
+ if (this.enableZoom === !1 && this.enableRotate === !1) return;
441
+ this._handleTouchMoveDollyRotate(i), this.update();
442
+ break;
443
+ default:
444
+ this.state = o.NONE;
445
+ }
446
+ }
447
+ function Z(i) {
448
+ this.enabled !== !1 && i.preventDefault();
449
+ }
450
+ function z(i) {
451
+ i.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
452
+ }
453
+ function K(i) {
454
+ i.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
455
+ }
456
+ export {
457
+ X as OrbitControls
458
+ };
@@ -1,4 +1,13 @@
1
- import { type JSONContent } from "@tiptap/core";
1
+ export interface JSONContent {
2
+ type?: string;
3
+ attrs?: Record<string, unknown>;
4
+ content?: JSONContent[];
5
+ marks?: {
6
+ type: string;
7
+ attrs?: Record<string, unknown>;
8
+ }[];
9
+ text?: string;
10
+ }
2
11
  export declare enum ParticipantType {
3
12
  Customer = "PARTICIPANT_TYPE_CUSTOMER",
4
13
  Agent = "PARTICIPANT_TYPE_AGENT"
@@ -1,6 +1,6 @@
1
1
  import type { ChatParticipant } from "./messages.api.types";
2
2
  import type { AppApi } from "@/App";
3
- import type { GetTurnBootstrapPayload, StartVoiceSessionResponse, VoiceSessionData, VoiceTurn } from "./voice.api.types";
3
+ import type { GetTurnBootstrapPayload, SendVoiceSessionDirectivePayload, StartVoiceSessionResponse, VoiceSessionData, VoiceSessionDirective, VoiceTurn } from "./voice.api.types";
4
4
  import type { WidgetConfig } from "@/index.types";
5
5
  export declare const startVoiceSession: (config: WidgetConfig, api: AppApi) => Promise<StartVoiceSessionResponse>;
6
6
  export declare function getVoiceSession(config: WidgetConfig, api: AppApi, id: string): Promise<VoiceSessionData>;
@@ -62,4 +62,5 @@ type EndWebRtcSessionPayload = {
62
62
  };
63
63
  export declare function endWebRtcSession({ voiceBaseUrl, voiceSessionId, sessionToken, clientInstanceId, connectionId, connectionGeneration, reason, }: EndWebRtcSessionPayload): Promise<void>;
64
64
  export declare function getTurnBootstrap({ voiceBaseUrl, voiceSessionId, sessionToken, clientInstanceId, protocolVersion, }: GetTurnBootstrapPayload): Promise<VoiceTurn>;
65
+ export declare function SendVoiceSessionDirective({ config, voiceSessionId, directive }: SendVoiceSessionDirectivePayload): Promise<VoiceSessionDirective | void>;
65
66
  export {};
@@ -1,3 +1,4 @@
1
+ import type { WidgetConfig } from "@/index.types";
1
2
  import type { ChatParticipant } from "./messages.api.types";
2
3
  export type StartVoiceSessionResponse = {
3
4
  status: number;
@@ -35,3 +36,23 @@ export type VoiceTurn = {
35
36
  realm: string;
36
37
  useSessionTokenCredential: boolean;
37
38
  };
39
+ export type SendVoiceSessionDirectivePayload = {
40
+ config: WidgetConfig;
41
+ voiceSessionId: string;
42
+ directive: string;
43
+ idempotencyKey?: string;
44
+ };
45
+ export type VoiceSessionDirectiveStatus = "VOICE_SESSION_DIRECTIVE_STATUS_QUEUED" | "VOICE_SESSION_DIRECTIVE_STATUS_IN_PROGRESS" | "VOICE_SESSION_DIRECTIVE_STATUS_COMPLETED" | "VOICE_SESSION_DIRECTIVE_STATUS_FAILED";
46
+ export type VoiceSessionDirective = {
47
+ id: string;
48
+ companyId: string;
49
+ voiceSessionId: string;
50
+ directive: string;
51
+ status: VoiceSessionDirectiveStatus;
52
+ idempotencyKey?: string | null;
53
+ assistantMessageId?: string | null;
54
+ failureReason?: string | null;
55
+ createdAt: string;
56
+ updatedAt: string;
57
+ completedAt?: string | null;
58
+ };
@@ -63,6 +63,7 @@ export declare class Avatar extends EventTarget {
63
63
  showcaseBlendShape(shapeName: string): void;
64
64
  render(): void;
65
65
  onAllAssetsLoaded: () => void;
66
+ private initDebugControls;
66
67
  private addDebugGui;
67
68
  }
68
69
  export {};