@gui-chat-plugin/brep 0.0.0-stage → 0.1.0

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.
package/dist/vue.js ADDED
@@ -0,0 +1,938 @@
1
+ import { a as e, o as t, r as n, s as r, t as i } from "./mesh-Cmm66x_I.js";
2
+ import { Fragment as a, computed as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, defineComponent as d, normalizeClass as ee, normalizeStyle as te, onMounted as ne, onUnmounted as re, openBlock as f, ref as p, renderList as m, toDisplayString as h, unref as g, vModelCheckbox as ie, watch as ae, withDirectives as oe, withModifiers as se } from "vue";
3
+ import * as _ from "three";
4
+ import { Controls as ce, MOUSE as v, MathUtils as y, Plane as b, Quaternion as x, Ray as S, Spherical as le, TOUCH as C, Vector2 as w, Vector3 as T } from "three";
5
+ import { createUseT as ue } from "gui-chat-protocol/vue";
6
+ // ../../node_modules/three/examples/jsm/controls/OrbitControls.js
7
+ var E = { type: "change" }, D = { type: "start" }, O = { type: "end" }, k = new S(), de = new b(), A = Math.cos(70 * y.DEG2RAD), j = new T(), M = 2 * Math.PI, N = {
8
+ NONE: -1,
9
+ ROTATE: 0,
10
+ DOLLY: 1,
11
+ PAN: 2,
12
+ TOUCH_ROTATE: 3,
13
+ TOUCH_PAN: 4,
14
+ TOUCH_DOLLY_PAN: 5,
15
+ TOUCH_DOLLY_ROTATE: 6
16
+ }, P = 1e-6, fe = class extends ce {
17
+ constructor(e, t = null) {
18
+ super(e, t), this.state = N.NONE, this.target = new T(), this.cursor = new T(), this.minDistance = 0, this.maxDistance = Infinity, this.minZoom = 0, this.maxZoom = Infinity, this.minTargetRadius = 0, this.maxTargetRadius = Infinity, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -Infinity, this.maxAzimuthAngle = Infinity, this.enableDamping = !1, this.dampingFactor = .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 = {
19
+ LEFT: "ArrowLeft",
20
+ UP: "ArrowUp",
21
+ RIGHT: "ArrowRight",
22
+ BOTTOM: "ArrowDown"
23
+ }, this.mouseButtons = {
24
+ LEFT: v.ROTATE,
25
+ MIDDLE: v.DOLLY,
26
+ RIGHT: v.PAN
27
+ }, this.touches = {
28
+ ONE: C.ROTATE,
29
+ TWO: C.DOLLY_PAN
30
+ }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._cursorStyle = "auto", this._domElementKeyEvents = null, this._lastPosition = new T(), this._lastQuaternion = new x(), this._lastTargetPosition = new T(), this._quat = new x().setFromUnitVectors(e.up, new T(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new le(), this._sphericalDelta = new le(), this._scale = 1, this._panOffset = new T(), this._rotateStart = new w(), this._rotateEnd = new w(), this._rotateDelta = new w(), this._panStart = new w(), this._panEnd = new w(), this._panDelta = new w(), this._dollyStart = new w(), this._dollyEnd = new w(), this._dollyDelta = new w(), this._dollyDirection = new T(), this._mouse = new w(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = I.bind(this), this._onPointerDown = F.bind(this), this._onPointerUp = L.bind(this), this._onContextMenu = he.bind(this), this._onMouseWheel = B.bind(this), this._onKeyDown = pe.bind(this), this._onTouchStart = me.bind(this), this._onTouchMove = V.bind(this), this._onMouseDown = R.bind(this), this._onMouseMove = z.bind(this), this._interceptControlDown = ge.bind(this), this._interceptControlUp = H.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
31
+ }
32
+ set cursorStyle(e) {
33
+ this._cursorStyle = e, e === "grab" ? this.domElement.style.cursor = "grab" : this.domElement.style.cursor = "auto";
34
+ }
35
+ get cursorStyle() {
36
+ return this._cursorStyle;
37
+ }
38
+ connect(e) {
39
+ super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.ownerDocument.addEventListener("keydown", this._interceptControlDown, {
40
+ passive: !0,
41
+ capture: !0
42
+ }), this.domElement.style.touchAction = "none";
43
+ }
44
+ disconnect() {
45
+ this.state = N.NONE, 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.ownerDocument.removeEventListener("keydown", this._interceptControlDown, { capture: !0 }), this.domElement.ownerDocument.removeEventListener("keyup", this._interceptControlUp, { capture: !0 }), this._controlActive = !1, this._pointers.length = 0, this._pointerPositions = {}, this.domElement.style.touchAction = "", this.domElement.style.cursor = "auto";
46
+ }
47
+ dispose() {
48
+ this.disconnect();
49
+ }
50
+ getPolarAngle() {
51
+ return this._spherical.phi;
52
+ }
53
+ getAzimuthalAngle() {
54
+ return this._spherical.theta;
55
+ }
56
+ getDistance() {
57
+ return this.object.position.distanceTo(this.target);
58
+ }
59
+ listenToKeyEvents(e) {
60
+ e.addEventListener("keydown", this._onKeyDown), this._domElementKeyEvents = e;
61
+ }
62
+ stopListenToKeyEvents() {
63
+ this._domElementKeyEvents !== null && (this._domElementKeyEvents.removeEventListener("keydown", this._onKeyDown), this._domElementKeyEvents = null);
64
+ }
65
+ saveState() {
66
+ this.target0.copy(this.target), this.position0.copy(this.object.position), this.zoom0 = this.object.zoom;
67
+ }
68
+ reset() {
69
+ this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(E), this.update(), this.state = N.NONE;
70
+ }
71
+ pan(e, t) {
72
+ this._pan(e, t), this.update();
73
+ }
74
+ dollyIn(e) {
75
+ this._dollyIn(e), this.update();
76
+ }
77
+ dollyOut(e) {
78
+ this._dollyOut(e), this.update();
79
+ }
80
+ rotateLeft(e) {
81
+ this._rotateLeft(e), this.update();
82
+ }
83
+ rotateUp(e) {
84
+ this._rotateUp(e), this.update();
85
+ }
86
+ update(e = null) {
87
+ let t = this.object.position;
88
+ j.copy(t).sub(this.target), j.applyQuaternion(this._quat), this._spherical.setFromVector3(j), this.autoRotate && this.state === N.NONE && this._rotateLeft(this._getAutoRotationAngle(e)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
89
+ let n = this.minAzimuthAngle, r = this.maxAzimuthAngle;
90
+ isFinite(n) && isFinite(r) && (n < -Math.PI ? n += M : n > Math.PI && (n -= M), r < -Math.PI ? r += M : r > Math.PI && (r -= M), n <= r ? this._spherical.theta = Math.max(n, Math.min(r, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (n + r) / 2 ? Math.max(n, this._spherical.theta) : Math.min(r, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
91
+ let i = !1;
92
+ if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera) this._spherical.radius = this._clampDistance(this._spherical.radius);
93
+ else {
94
+ let e = this._spherical.radius;
95
+ this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), i = e != this._spherical.radius;
96
+ }
97
+ if (j.setFromSpherical(this._spherical), j.applyQuaternion(this._quatInverse), t.copy(this.target).add(j), this.object.lookAt(this.target), this.enableDamping === !0 ? (this._sphericalDelta.theta *= 1 - this.dampingFactor, this._sphericalDelta.phi *= 1 - this.dampingFactor, this._panOffset.multiplyScalar(1 - this.dampingFactor)) : (this._sphericalDelta.set(0, 0, 0), this._panOffset.set(0, 0, 0)), this.zoomToCursor && this._performCursorZoom) {
98
+ let e = null;
99
+ if (this.object.isPerspectiveCamera) {
100
+ let t = j.length();
101
+ e = this._clampDistance(t * this._scale);
102
+ let n = t - e;
103
+ this.object.position.addScaledVector(this._dollyDirection, n), this.object.updateMatrixWorld(), i = !!n;
104
+ } else if (this.object.isOrthographicCamera) {
105
+ let t = new T(this._mouse.x, this._mouse.y, 0);
106
+ t.unproject(this.object);
107
+ let n = this.object.zoom;
108
+ this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), i = n !== this.object.zoom;
109
+ let r = new T(this._mouse.x, this._mouse.y, 0);
110
+ r.unproject(this.object), this.object.position.sub(r).add(t), this.object.updateMatrixWorld(), e = j.length();
111
+ } else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
112
+ e !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(e).add(this.object.position) : (k.origin.copy(this.object.position), k.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(k.direction)) < A ? this.object.lookAt(this.target) : (de.setFromNormalAndCoplanarPoint(this.object.up, this.target), k.intersectPlane(de, this.target))));
113
+ } else if (this.object.isOrthographicCamera) {
114
+ let e = this.object.zoom;
115
+ this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), e !== this.object.zoom && (this.object.updateProjectionMatrix(), i = !0);
116
+ }
117
+ return this._scale = 1, this._performCursorZoom = !1, i || this._lastPosition.distanceToSquared(this.object.position) > P || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > P || this._lastTargetPosition.distanceToSquared(this.target) > P ? (this.dispatchEvent(E), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
118
+ }
119
+ _getAutoRotationAngle(e) {
120
+ return e === null ? M / 60 / 60 * this.autoRotateSpeed : M / 60 * this.autoRotateSpeed * e;
121
+ }
122
+ _getZoomScale(e) {
123
+ let t = Math.abs(e * .01);
124
+ return .95 ** (this.zoomSpeed * t);
125
+ }
126
+ _rotateLeft(e) {
127
+ this._sphericalDelta.theta -= e;
128
+ }
129
+ _rotateUp(e) {
130
+ this._sphericalDelta.phi -= e;
131
+ }
132
+ _panLeft(e, t) {
133
+ j.setFromMatrixColumn(t, 0), j.multiplyScalar(-e), this._panOffset.add(j);
134
+ }
135
+ _panUp(e, t) {
136
+ this.screenSpacePanning === !0 ? j.setFromMatrixColumn(t, 1) : (j.setFromMatrixColumn(t, 0), j.crossVectors(this.object.up, j)), j.multiplyScalar(e), this._panOffset.add(j);
137
+ }
138
+ _pan(e, t) {
139
+ let n = this.domElement;
140
+ if (this.object.isPerspectiveCamera) {
141
+ let r = this.object.position;
142
+ j.copy(r).sub(this.target);
143
+ let i = j.length();
144
+ i *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * e * i / n.clientHeight, this.object.matrix), this._panUp(2 * t * i / n.clientHeight, this.object.matrix);
145
+ } else this.object.isOrthographicCamera ? (this._panLeft(e * (this.object.right - this.object.left) / this.object.zoom / n.clientWidth, this.object.matrix), this._panUp(t * (this.object.top - this.object.bottom) / this.object.zoom / n.clientHeight, this.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), this.enablePan = !1);
146
+ }
147
+ _dollyOut(e) {
148
+ this.object.isPerspectiveCamera || this.object.isOrthographicCamera ? this._scale /= e : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), this.enableZoom = !1);
149
+ }
150
+ _dollyIn(e) {
151
+ this.object.isPerspectiveCamera || this.object.isOrthographicCamera ? this._scale *= e : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), this.enableZoom = !1);
152
+ }
153
+ _updateZoomParameters(e, t) {
154
+ if (!this.zoomToCursor) return;
155
+ this._performCursorZoom = !0;
156
+ let n = this.domElement.getBoundingClientRect(), r = e - n.left, i = t - n.top, a = n.width, o = n.height;
157
+ this._mouse.x = r / a * 2 - 1, this._mouse.y = -(i / o) * 2 + 1, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
158
+ }
159
+ _clampDistance(e) {
160
+ return Math.max(this.minDistance, Math.min(this.maxDistance, e));
161
+ }
162
+ _handleMouseDownRotate(e) {
163
+ this._rotateStart.set(e.clientX, e.clientY);
164
+ }
165
+ _handleMouseDownDolly(e) {
166
+ this._updateZoomParameters(e.clientX, e.clientY), this._dollyStart.set(e.clientX, e.clientY);
167
+ }
168
+ _handleMouseDownPan(e) {
169
+ this._panStart.set(e.clientX, e.clientY);
170
+ }
171
+ _handleMouseMoveRotate(e) {
172
+ this._rotateEnd.set(e.clientX, e.clientY), this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
173
+ let t = this.domElement;
174
+ this._rotateLeft(M * this._rotateDelta.x / t.clientHeight), this._rotateUp(M * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd), this.update();
175
+ }
176
+ _handleMouseMoveDolly(e) {
177
+ this._dollyEnd.set(e.clientX, e.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.zoomToCursor && (this._performCursorZoom = !0, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize()), this.update();
178
+ }
179
+ _handleMouseMovePan(e) {
180
+ this._panEnd.set(e.clientX, e.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();
181
+ }
182
+ _handleMouseWheel(e) {
183
+ this._updateZoomParameters(e.clientX, e.clientY), e.deltaY < 0 ? this._dollyIn(this._getZoomScale(e.deltaY)) : e.deltaY > 0 && this._dollyOut(this._getZoomScale(e.deltaY)), this.update();
184
+ }
185
+ _handleKeyDown(e) {
186
+ let t = !1;
187
+ switch (e.code) {
188
+ case this.keys.UP:
189
+ e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(M * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, this.keyPanSpeed), t = !0;
190
+ break;
191
+ case this.keys.BOTTOM:
192
+ e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(-M * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, -this.keyPanSpeed), t = !0;
193
+ break;
194
+ case this.keys.LEFT:
195
+ e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(M * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(this.keyPanSpeed, 0), t = !0;
196
+ break;
197
+ case this.keys.RIGHT: e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(-M * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(-this.keyPanSpeed, 0), t = !0;
198
+ }
199
+ t && (e.preventDefault(), this.update());
200
+ }
201
+ _handleTouchStartRotate(e) {
202
+ if (this._pointers.length === 1) this._rotateStart.set(e.pageX, e.pageY);
203
+ else {
204
+ let t = this._getSecondPointerPosition(e), n = .5 * (e.pageX + t.x), r = .5 * (e.pageY + t.y);
205
+ this._rotateStart.set(n, r);
206
+ }
207
+ }
208
+ _handleTouchStartPan(e) {
209
+ if (this._pointers.length === 1) this._panStart.set(e.pageX, e.pageY);
210
+ else {
211
+ let t = this._getSecondPointerPosition(e), n = .5 * (e.pageX + t.x), r = .5 * (e.pageY + t.y);
212
+ this._panStart.set(n, r);
213
+ }
214
+ }
215
+ _handleTouchStartDolly(e) {
216
+ let t = this._getSecondPointerPosition(e), n = e.pageX - t.x, r = e.pageY - t.y, i = Math.sqrt(n * n + r * r);
217
+ this._dollyStart.set(0, i);
218
+ }
219
+ _handleTouchStartDollyPan(e) {
220
+ this.enableZoom && this._handleTouchStartDolly(e), this.enablePan && this._handleTouchStartPan(e);
221
+ }
222
+ _handleTouchStartDollyRotate(e) {
223
+ this.enableZoom && this._handleTouchStartDolly(e), this.enableRotate && this._handleTouchStartRotate(e);
224
+ }
225
+ _handleTouchMoveRotate(e) {
226
+ if (this._pointers.length == 1) this._rotateEnd.set(e.pageX, e.pageY);
227
+ else {
228
+ let t = this._getSecondPointerPosition(e), n = .5 * (e.pageX + t.x), r = .5 * (e.pageY + t.y);
229
+ this._rotateEnd.set(n, r);
230
+ }
231
+ this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
232
+ let t = this.domElement;
233
+ this._rotateLeft(M * this._rotateDelta.x / t.clientHeight), this._rotateUp(M * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd);
234
+ }
235
+ _handleTouchMovePan(e) {
236
+ if (this._pointers.length === 1) this._panEnd.set(e.pageX, e.pageY);
237
+ else {
238
+ let t = this._getSecondPointerPosition(e), n = .5 * (e.pageX + t.x), r = .5 * (e.pageY + t.y);
239
+ this._panEnd.set(n, r);
240
+ }
241
+ this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed), this._pan(this._panDelta.x, this._panDelta.y), this._panStart.copy(this._panEnd);
242
+ }
243
+ _handleTouchMoveDolly(e) {
244
+ let t = this._getSecondPointerPosition(e), n = e.pageX - t.x, r = e.pageY - t.y, i = Math.sqrt(n * n + r * r);
245
+ this._dollyEnd.set(0, i), this._dollyDelta.set(0, (this._dollyEnd.y / this._dollyStart.y) ** +this.zoomSpeed), this._dollyOut(this._dollyDelta.y), this._dollyStart.copy(this._dollyEnd);
246
+ let a = (e.pageX + t.x) * .5, o = (e.pageY + t.y) * .5;
247
+ this._updateZoomParameters(a, o);
248
+ }
249
+ _handleTouchMoveDollyPan(e) {
250
+ this.enableZoom && this._handleTouchMoveDolly(e), this.enablePan && this._handleTouchMovePan(e);
251
+ }
252
+ _handleTouchMoveDollyRotate(e) {
253
+ this.enableZoom && this._handleTouchMoveDolly(e), this.enableRotate && this._handleTouchMoveRotate(e);
254
+ }
255
+ _addPointer(e) {
256
+ this._pointers.push(e.pointerId);
257
+ }
258
+ _removePointer(e) {
259
+ delete this._pointerPositions[e.pointerId];
260
+ for (let t = 0; t < this._pointers.length; t++) if (this._pointers[t] == e.pointerId) {
261
+ this._pointers.splice(t, 1);
262
+ return;
263
+ }
264
+ }
265
+ _isTrackingPointer(e) {
266
+ for (let t = 0; t < this._pointers.length; t++) if (this._pointers[t] == e.pointerId) return !0;
267
+ return !1;
268
+ }
269
+ _trackPointer(e) {
270
+ let t = this._pointerPositions[e.pointerId];
271
+ t === void 0 && (t = new w(), this._pointerPositions[e.pointerId] = t), t.set(e.pageX, e.pageY);
272
+ }
273
+ _getSecondPointerPosition(e) {
274
+ let t = e.pointerId === this._pointers[0] ? this._pointers[1] : this._pointers[0];
275
+ return this._pointerPositions[t];
276
+ }
277
+ _customWheelEvent(e) {
278
+ let t = e.deltaMode, n = {
279
+ clientX: e.clientX,
280
+ clientY: e.clientY,
281
+ deltaY: e.deltaY
282
+ };
283
+ switch (t) {
284
+ case 1:
285
+ n.deltaY *= 16;
286
+ break;
287
+ case 2: n.deltaY *= 100;
288
+ }
289
+ return e.ctrlKey && !this._controlActive && (n.deltaY *= 10), n;
290
+ }
291
+ };
292
+ function F(e) {
293
+ this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(e.pointerId), this.domElement.ownerDocument.addEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.addEventListener("pointerup", this._onPointerUp)), this._isTrackingPointer(e) || (this._addPointer(e), e.pointerType === "touch" ? this._onTouchStart(e) : this._onMouseDown(e), this._cursorStyle === "grab" && (this.domElement.style.cursor = "grabbing")));
294
+ }
295
+ function I(e) {
296
+ this.enabled !== !1 && (e.pointerType === "touch" ? this._onTouchMove(e) : this._onMouseMove(e));
297
+ }
298
+ function L(e) {
299
+ switch (this._removePointer(e), this._pointers.length) {
300
+ case 0:
301
+ this.domElement.releasePointerCapture(e.pointerId), this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(O), this.state = N.NONE, this._cursorStyle === "grab" && (this.domElement.style.cursor = "grab");
302
+ break;
303
+ case 1:
304
+ let t = this._pointers[0], n = this._pointerPositions[t];
305
+ this._onTouchStart({
306
+ pointerId: t,
307
+ pageX: n.x,
308
+ pageY: n.y
309
+ });
310
+ }
311
+ }
312
+ function R(e) {
313
+ let t;
314
+ switch (e.button) {
315
+ case 0:
316
+ t = this.mouseButtons.LEFT;
317
+ break;
318
+ case 1:
319
+ t = this.mouseButtons.MIDDLE;
320
+ break;
321
+ case 2:
322
+ t = this.mouseButtons.RIGHT;
323
+ break;
324
+ default: t = -1;
325
+ }
326
+ switch (t) {
327
+ case v.DOLLY:
328
+ if (this.enableZoom === !1) return;
329
+ this._handleMouseDownDolly(e), this.state = N.DOLLY;
330
+ break;
331
+ case v.ROTATE:
332
+ if (e.ctrlKey || e.metaKey || e.shiftKey) {
333
+ if (this.enablePan === !1) return;
334
+ this._handleMouseDownPan(e), this.state = N.PAN;
335
+ } else {
336
+ if (this.enableRotate === !1) return;
337
+ this._handleMouseDownRotate(e), this.state = N.ROTATE;
338
+ }
339
+ break;
340
+ case v.PAN:
341
+ if (e.ctrlKey || e.metaKey || e.shiftKey) {
342
+ if (this.enableRotate === !1) return;
343
+ this._handleMouseDownRotate(e), this.state = N.ROTATE;
344
+ } else {
345
+ if (this.enablePan === !1) return;
346
+ this._handleMouseDownPan(e), this.state = N.PAN;
347
+ }
348
+ break;
349
+ default: this.state = N.NONE;
350
+ }
351
+ this.state !== N.NONE && this.dispatchEvent(D);
352
+ }
353
+ function z(e) {
354
+ switch (this.state) {
355
+ case N.ROTATE:
356
+ if (this.enableRotate === !1) return;
357
+ this._handleMouseMoveRotate(e);
358
+ break;
359
+ case N.DOLLY:
360
+ if (this.enableZoom === !1) return;
361
+ this._handleMouseMoveDolly(e);
362
+ break;
363
+ case N.PAN:
364
+ if (this.enablePan === !1) return;
365
+ this._handleMouseMovePan(e);
366
+ }
367
+ }
368
+ function B(e) {
369
+ this.enabled !== !1 && this.enableZoom !== !1 && this.state === N.NONE && (e.preventDefault(), this.dispatchEvent(D), this._handleMouseWheel(this._customWheelEvent(e)), this.dispatchEvent(O));
370
+ }
371
+ function pe(e) {
372
+ this.enabled !== !1 && this._handleKeyDown(e);
373
+ }
374
+ function me(e) {
375
+ switch (this._trackPointer(e), this._pointers.length) {
376
+ case 1:
377
+ switch (this.touches.ONE) {
378
+ case C.ROTATE:
379
+ if (this.enableRotate === !1) {
380
+ this.state = N.NONE;
381
+ break;
382
+ }
383
+ this._handleTouchStartRotate(e), this.state = N.TOUCH_ROTATE;
384
+ break;
385
+ case C.PAN:
386
+ if (this.enablePan === !1) {
387
+ this.state = N.NONE;
388
+ break;
389
+ }
390
+ this._handleTouchStartPan(e), this.state = N.TOUCH_PAN;
391
+ break;
392
+ default: this.state = N.NONE;
393
+ }
394
+ break;
395
+ case 2:
396
+ switch (this.touches.TWO) {
397
+ case C.DOLLY_PAN:
398
+ if (this.enableZoom === !1 && this.enablePan === !1) return;
399
+ this._handleTouchStartDollyPan(e), this.state = N.TOUCH_DOLLY_PAN;
400
+ break;
401
+ case C.DOLLY_ROTATE:
402
+ if (this.enableZoom === !1 && this.enableRotate === !1) return;
403
+ this._handleTouchStartDollyRotate(e), this.state = N.TOUCH_DOLLY_ROTATE;
404
+ break;
405
+ default: this.state = N.NONE;
406
+ }
407
+ break;
408
+ default: this.state = N.NONE;
409
+ }
410
+ this.state !== N.NONE && this.dispatchEvent(D);
411
+ }
412
+ function V(e) {
413
+ switch (this._trackPointer(e), this.state) {
414
+ case N.TOUCH_ROTATE:
415
+ if (this.enableRotate === !1) return;
416
+ this._handleTouchMoveRotate(e), this.update();
417
+ break;
418
+ case N.TOUCH_PAN:
419
+ if (this.enablePan === !1) return;
420
+ this._handleTouchMovePan(e), this.update();
421
+ break;
422
+ case N.TOUCH_DOLLY_PAN:
423
+ if (this.enableZoom === !1 && this.enablePan === !1) return;
424
+ this._handleTouchMoveDollyPan(e), this.update();
425
+ break;
426
+ case N.TOUCH_DOLLY_ROTATE:
427
+ if (this.enableZoom === !1 && this.enableRotate === !1) return;
428
+ this._handleTouchMoveDollyRotate(e), this.update();
429
+ break;
430
+ default: this.state = N.NONE;
431
+ }
432
+ }
433
+ function he(e) {
434
+ this.enabled !== !1 && e.preventDefault();
435
+ }
436
+ function ge(e) {
437
+ e.key === "Control" && (this._controlActive = !0, this.domElement.ownerDocument.addEventListener("keyup", this._interceptControlUp, {
438
+ passive: !0,
439
+ capture: !0
440
+ }));
441
+ }
442
+ function H(e) {
443
+ e.key === "Control" && (this._controlActive = !1, this.domElement.ownerDocument.removeEventListener("keyup", this._interceptControlUp, {
444
+ passive: !0,
445
+ capture: !0
446
+ }));
447
+ }
448
+ var _e = ue({
449
+ en: {
450
+ untitled: "Solid model",
451
+ viewIso: "3D",
452
+ viewTop: "Top",
453
+ viewFront: "Front",
454
+ viewRight: "Right",
455
+ edges: "Edges",
456
+ noMesh: "This result has no model to show.",
457
+ noWebgl: "The 3D view is not available in this browser.",
458
+ size: "Size",
459
+ volume: "Volume",
460
+ surface: "Surface",
461
+ solids: "Solids",
462
+ faces: "Faces",
463
+ edgeKinds: "Edges",
464
+ parts: "Parts",
465
+ operations: "Operations",
466
+ line: "line",
467
+ selectedOf: "selected {selected} of {available}",
468
+ selected: "selected {selected}",
469
+ warnings: "Warnings",
470
+ files: "Files",
471
+ fileScript: "Script",
472
+ fileStep: "STEP",
473
+ fileStl: "STL",
474
+ fileDrawings: "Drawings",
475
+ download: "Download",
476
+ script: "Script",
477
+ copy: "Copy",
478
+ copied: "Copied",
479
+ resizeModel: "Resize the 3D view"
480
+ },
481
+ ja: {
482
+ untitled: "ソリッドモデル",
483
+ viewIso: "3D",
484
+ viewTop: "上面",
485
+ viewFront: "正面",
486
+ viewRight: "右側面",
487
+ edges: "稜線",
488
+ noMesh: "この結果には表示できるモデルがありません。",
489
+ noWebgl: "このブラウザでは3D表示を利用できません。",
490
+ size: "寸法",
491
+ volume: "体積",
492
+ surface: "表面積",
493
+ solids: "ソリッド数",
494
+ faces: "面",
495
+ edgeKinds: "稜線",
496
+ parts: "部品",
497
+ operations: "操作",
498
+ line: "行",
499
+ selectedOf: "{available} 中 {selected} を選択",
500
+ selected: "{selected} を選択",
501
+ warnings: "警告",
502
+ files: "ファイル",
503
+ fileScript: "スクリプト",
504
+ fileStep: "STEP",
505
+ fileStl: "STL",
506
+ fileDrawings: "図面",
507
+ download: "ダウンロード",
508
+ script: "スクリプト",
509
+ copy: "コピー",
510
+ copied: "コピーしました",
511
+ resizeModel: "3Dビューの高さを変更"
512
+ }
513
+ }), U = 12832988, W = 2042167;
514
+ function ve(e) {
515
+ let t = new _.BufferGeometry();
516
+ t.setAttribute("position", new _.BufferAttribute(e.positions, 3)), t.setAttribute("normal", new _.BufferAttribute(e.normals, 3)), t.setIndex(new _.BufferAttribute(e.indices, 1));
517
+ let n = new _.MeshStandardMaterial({
518
+ color: U,
519
+ metalness: .1,
520
+ roughness: .65,
521
+ side: _.DoubleSide,
522
+ polygonOffset: !0,
523
+ polygonOffsetFactor: 1,
524
+ polygonOffsetUnits: 1
525
+ }), r = new _.BufferGeometry();
526
+ r.setAttribute("position", new _.BufferAttribute(e.edges, 3));
527
+ let i = new _.LineBasicMaterial({ color: W });
528
+ return {
529
+ faces: new _.Mesh(t, n),
530
+ edges: new _.LineSegments(r, i),
531
+ dispose() {
532
+ t.dispose(), n.dispose(), r.dispose(), i.dispose();
533
+ }
534
+ };
535
+ }
536
+ var G = {
537
+ iso: [
538
+ 1,
539
+ -1.2,
540
+ .9
541
+ ],
542
+ top: [
543
+ 0,
544
+ -.001,
545
+ 1
546
+ ],
547
+ front: [
548
+ 0,
549
+ -1,
550
+ 0
551
+ ],
552
+ right: [
553
+ 1,
554
+ 0,
555
+ 0
556
+ ]
557
+ }, ye = 1.02;
558
+ function be(e, t, n, r, i) {
559
+ let a = [
560
+ (e[0] + t[0]) / 2,
561
+ (e[1] + t[1]) / 2,
562
+ (e[2] + t[2]) / 2
563
+ ], o = Math.hypot(t[0] - e[0], t[1] - e[1], t[2] - e[2]) / 2 || 1, s = r * Math.PI / 360, c = Math.atan(Math.tan(s) * i), l = o * ye / Math.sin(Math.min(s, c)), u = G[n], d = Math.hypot(...u);
564
+ return {
565
+ position: [
566
+ a[0] + u[0] / d * l,
567
+ a[1] + u[1] / d * l,
568
+ a[2] + u[2] / d * l
569
+ ],
570
+ target: a,
571
+ distance: l,
572
+ radius: o
573
+ };
574
+ }
575
+ var K = .6;
576
+ function xe(e, t) {
577
+ if (!Number.isFinite(t) || t <= 0) return 0;
578
+ if (t < 168) return Math.round(t / 2);
579
+ let n = e === null || !Number.isFinite(e) ? t * K : e;
580
+ return Math.round(Math.min(Math.max(n, 96), t - 72));
581
+ }
582
+ var Se = "@gui-chat-plugin/brep:modelHeight";
583
+ function Ce() {
584
+ try {
585
+ let e = globalThis.localStorage?.getItem(Se);
586
+ if (!e) return null;
587
+ let t = Number(e);
588
+ return Number.isFinite(t) && t > 0 ? t : null;
589
+ } catch {
590
+ return null;
591
+ }
592
+ }
593
+ function we(e) {
594
+ try {
595
+ globalThis.localStorage?.setItem(Se, String(Math.round(e)));
596
+ } catch {}
597
+ }
598
+ // src/vue/View.vue?vue&type=script&setup=true&lang.ts
599
+ var Te = ["title"], Ee = {
600
+ class: "flex items-center gap-1",
601
+ "data-testid": "brep-toolbar"
602
+ }, De = [
603
+ "aria-pressed",
604
+ "data-testid",
605
+ "onClick"
606
+ ], Oe = { class: "ml-2 flex h-8 cursor-pointer items-center gap-1.5 text-slate-700" }, ke = {
607
+ key: 0,
608
+ class: "absolute inset-0 flex items-center justify-center p-4 text-center text-slate-500",
609
+ "data-testid": "brep-viewport-message"
610
+ }, Ae = [
611
+ "aria-label",
612
+ "aria-valuenow",
613
+ "aria-valuemax"
614
+ ], je = {
615
+ class: "brep-below",
616
+ "data-testid": "brep-below"
617
+ }, Me = {
618
+ key: 0,
619
+ class: "p-3",
620
+ "data-testid": "brep-report"
621
+ }, Ne = {
622
+ key: 0,
623
+ class: "mb-3 rounded border border-amber-300 bg-amber-50 p-2 text-amber-900",
624
+ "data-testid": "brep-warnings"
625
+ }, Pe = { class: "font-semibold" }, Fe = { class: "mt-1 list-disc pl-4" }, Ie = { class: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1" }, Le = { class: "text-slate-500" }, Re = {
626
+ class: "tabular-nums",
627
+ "data-testid": "brep-size"
628
+ }, ze = { class: "text-slate-500" }, Be = { class: "tabular-nums" }, Ve = { class: "text-slate-500" }, He = { class: "tabular-nums" }, Ue = { class: "text-slate-500" }, We = { class: "tabular-nums" }, Ge = { class: "text-slate-500" }, Ke = { "data-testid": "brep-faces" }, qe = { class: "text-slate-500" }, Je = { class: "mt-4 font-semibold text-slate-900" }, Ye = { class: "mt-1 space-y-0.5" }, Xe = { class: "mt-4 font-semibold text-slate-900" }, Ze = {
629
+ class: "mt-1 space-y-1",
630
+ "data-testid": "brep-operations"
631
+ }, Qe = {
632
+ key: 0,
633
+ class: "w-12 shrink-0 text-xs tabular-nums text-slate-400"
634
+ }, $e = { class: "font-mono text-slate-900" }, et = {
635
+ key: 1,
636
+ class: "text-slate-600"
637
+ }, tt = {
638
+ key: 2,
639
+ class: "ml-auto tabular-nums text-slate-500"
640
+ }, nt = { class: "mt-4 font-semibold text-slate-900" }, rt = {
641
+ class: "mt-1 flex flex-wrap gap-2",
642
+ "data-testid": "brep-files"
643
+ }, it = [
644
+ "title",
645
+ "data-testid",
646
+ "onClick"
647
+ ], at = {
648
+ key: 1,
649
+ class: "border-t border-slate-200",
650
+ "data-testid": "brep-script"
651
+ }, ot = { class: "flex cursor-pointer items-center gap-2 px-3 py-2 text-slate-700" }, st = { class: "mr-auto" }, ct = { class: "overflow-x-auto bg-slate-50 px-3 py-2 font-mono text-xs leading-5 text-slate-800" }, lt = 35, ut = 15857145, q = /*#__PURE__*/ ((e, t) => {
652
+ let n = e.__vccOpts || e;
653
+ for (let [e, r] of t) n[e] = r;
654
+ return n;
655
+ })(/* @__PURE__ */ d({
656
+ __name: "View",
657
+ props: { selectedResult: {} },
658
+ setup(t) {
659
+ let r = t, d = _e(), ce = [
660
+ "iso",
661
+ "top",
662
+ "front",
663
+ "right"
664
+ ], v = {
665
+ iso: "viewIso",
666
+ top: "viewTop",
667
+ front: "viewFront",
668
+ right: "viewRight"
669
+ }, y = o(() => r.selectedResult.title || d.value.untitled), b = o(() => r.selectedResult.data?.report), x = o(() => r.selectedResult.data?.script ?? ""), S = o(() => {
670
+ let e = r.selectedResult.data?.mesh;
671
+ return n(e) ? e : null;
672
+ }), le = o(() => {
673
+ let e = r.selectedResult.data?.downloads, t = e?.name ?? "model", n = [];
674
+ return x.value && n.push({
675
+ kind: "script",
676
+ label: d.value.fileScript,
677
+ fileName: `${t}.replicad.js`,
678
+ type: "text/javascript",
679
+ content: { text: x.value }
680
+ }), e && n.push({
681
+ kind: "step",
682
+ label: d.value.fileStep,
683
+ fileName: `${t}.step`,
684
+ type: "model/step",
685
+ content: { packed: e.step }
686
+ }, {
687
+ kind: "stl",
688
+ label: d.value.fileStl,
689
+ fileName: `${t}.stl`,
690
+ type: "model/stl",
691
+ content: { packed: e.stl }
692
+ }, {
693
+ kind: "views",
694
+ label: d.value.fileDrawings,
695
+ fileName: `${t}.svg`,
696
+ type: "image/svg+xml",
697
+ content: { packed: e.views }
698
+ }), n;
699
+ });
700
+ async function C(t) {
701
+ let n;
702
+ try {
703
+ n = "text" in t.content ? t.content.text : await e(t.content.packed);
704
+ } catch {
705
+ return;
706
+ }
707
+ let r = URL.createObjectURL(new Blob([n], { type: t.type })), i = document.createElement("a");
708
+ i.href = r, i.download = t.fileName, i.click(), setTimeout(() => URL.revokeObjectURL(r), 1e4);
709
+ }
710
+ let w = (e) => Number.isFinite(e) ? e.toLocaleString("en-US") : "–", T = (e) => `${e > 0 ? "+" : e < 0 ? "−" : ""}${w(Math.abs(e))}`, ue = (e) => Object.entries(e).sort(([, e], [, t]) => t - e).map(([e, t]) => `${t} ${e}`).join(", ");
711
+ function E(e) {
712
+ if (e.selected === void 0) return "";
713
+ let t = String(e.selected);
714
+ return e.count === 1 && e.available !== void 0 ? d.value.selectedOf.replace("{selected}", t).replace("{available}", String(e.available)) : d.value.selected.replace("{selected}", t);
715
+ }
716
+ let D = p(null), O, k = !1;
717
+ async function de(e, t) {
718
+ try {
719
+ await navigator.clipboard.writeText(e);
720
+ } catch {
721
+ return;
722
+ }
723
+ k || (D.value = t, clearTimeout(O), O = setTimeout(() => D.value = null, 1500));
724
+ }
725
+ let A = p(null), j = p(null), M = p(null), N = p(Ce()), P = p(0), F = o(() => xe(N.value, P.value)), I = p(!1), L = null, R = null;
726
+ function z() {
727
+ A.value && (P.value = A.value.clientHeight - (j.value?.offsetHeight ?? 0) - (M.value?.offsetHeight ?? 0));
728
+ }
729
+ function B(e) {
730
+ N.value = xe(e, P.value), we(N.value);
731
+ }
732
+ function pe(e) {
733
+ e.button === 0 && (R = {
734
+ y: e.clientY,
735
+ height: F.value
736
+ }, I.value = !0, M.value?.setPointerCapture(e.pointerId), e.preventDefault());
737
+ }
738
+ function me(e) {
739
+ R && B(R.height + e.clientY - R.y);
740
+ }
741
+ function V() {
742
+ R = null, I.value = !1;
743
+ }
744
+ function he(e) {
745
+ let t = {
746
+ ArrowUp: F.value - 24,
747
+ ArrowDown: F.value + 24,
748
+ Home: 0,
749
+ End: P.value
750
+ }[e.key];
751
+ t !== void 0 && (e.preventDefault(), B(t));
752
+ }
753
+ function ge() {
754
+ N.value = null;
755
+ try {
756
+ globalThis.localStorage?.removeItem(Se);
757
+ } catch {}
758
+ }
759
+ let H = p(null), U = p(!0), W = p("iso"), G = p(!1), ye = o(() => S.value ? G.value ? d.value.noWebgl : "" : d.value.noMesh), K = null, q = null, J = null, Y = null, X = null, Z = null, Q = 0;
760
+ function $() {
761
+ Q &&= (cancelAnimationFrame(Q), 0), K && q && J && K.render(q, J);
762
+ }
763
+ function dt() {
764
+ !Q && K && (Q = requestAnimationFrame(() => {
765
+ Q = 0, $();
766
+ }));
767
+ }
768
+ function ft() {
769
+ let e = H.value;
770
+ if (!e || K) return;
771
+ try {
772
+ K = new _.WebGLRenderer({ antialias: !0 });
773
+ } catch {
774
+ G.value = !0;
775
+ return;
776
+ }
777
+ K.setPixelRatio(window.devicePixelRatio), K.setClearColor(ut), e.appendChild(K.domElement), q = new _.Scene(), J = new _.PerspectiveCamera(lt, 1, .1, 1e3), J.up.set(0, 0, 1);
778
+ let t = new _.DirectionalLight(16777215, 1.5);
779
+ t.position.set(-.5, .8, 1), J.add(t), q.add(J), q.add(new _.HemisphereLight(16777215, 7831692, 2.2)), Y = new fe(J, K.domElement), Y.addEventListener("change", dt), Y.addEventListener("start", () => W.value = null), Z = new ResizeObserver(pt), Z.observe(e), pt();
780
+ }
781
+ function pt() {
782
+ let e = H.value;
783
+ if (!e || !K || !J) return;
784
+ let t = e.clientWidth, n = e.clientHeight;
785
+ t !== 0 && n !== 0 && (K.setSize(t, n), J.aspect = t / n, J.updateProjectionMatrix(), W.value ? mt(W.value) : $());
786
+ }
787
+ function mt(e) {
788
+ W.value = e;
789
+ let t = S.value;
790
+ if (!t || !J || !Y) return;
791
+ let n = be(t.min, t.max, e, lt, J.aspect);
792
+ J.position.set(...n.position), J.near = n.distance / 100, J.far = n.distance + n.radius * 10, J.updateProjectionMatrix(), Y.target.set(...n.target), Y.update(), $();
793
+ }
794
+ function ht() {
795
+ if (!q) return;
796
+ X &&= (q.remove(X.faces, X.edges), X.dispose(), null);
797
+ let e = S.value;
798
+ e ? (X = ve(i(e)), X.edges.visible = U.value, q.add(X.faces, X.edges), mt("iso")) : $();
799
+ }
800
+ return ne(() => {
801
+ A.value && (L = new ResizeObserver(z), L.observe(A.value), j.value && L.observe(j.value)), z(), ft(), ht();
802
+ }), ae(S, ht), ae(U, (e) => {
803
+ X && (X.edges.visible = e), $();
804
+ }), re(() => {
805
+ k = !0, clearTimeout(O), Q && cancelAnimationFrame(Q), Z?.disconnect(), L?.disconnect(), Y?.dispose(), X?.dispose(), K && (K.dispose(), K.forceContextLoss(), K.domElement.remove()), K = null;
806
+ }), (e, t) => (f(), c("div", {
807
+ ref_key: "root",
808
+ ref: A,
809
+ class: "brep-view bg-white text-sm text-slate-800",
810
+ "data-testid": "brep-view"
811
+ }, [
812
+ l("div", {
813
+ ref_key: "header",
814
+ ref: j,
815
+ class: "brep-header flex-wrap items-center gap-2 border-b border-slate-200 bg-white px-3 py-2"
816
+ }, [l("h1", {
817
+ class: "mr-auto min-w-0 truncate text-base font-semibold text-slate-900",
818
+ title: y.value
819
+ }, h(y.value), 9, Te), l("div", Ee, [(f(), c(a, null, m(ce, (e) => l("button", {
820
+ key: e,
821
+ type: "button",
822
+ class: ee(["h-8 rounded border px-2.5", e === W.value ? "border-slate-800 bg-slate-800 text-white" : "border-slate-300 bg-white text-slate-700 hover:bg-slate-100"]),
823
+ "aria-pressed": e === W.value,
824
+ "data-testid": `brep-view-${e}`,
825
+ onClick: (t) => mt(e)
826
+ }, h(g(d)[v[e]]), 11, De)), 64)), l("label", Oe, [oe(l("input", {
827
+ "onUpdate:modelValue": t[0] ||= (e) => U.value = e,
828
+ type: "checkbox",
829
+ "data-testid": "brep-edges"
830
+ }, null, 512), [[ie, U.value]]), u(" " + h(g(d).edges), 1)])])], 512),
831
+ l("div", {
832
+ class: "brep-model bg-slate-100",
833
+ style: te({ height: `${F.value}px` }),
834
+ "data-testid": "brep-model"
835
+ }, [l("div", {
836
+ ref_key: "viewport",
837
+ ref: H,
838
+ class: "absolute inset-0",
839
+ "data-testid": "brep-viewport"
840
+ }, null, 512), ye.value ? (f(), c("p", ke, h(ye.value), 1)) : s("", !0)], 4),
841
+ l("div", {
842
+ ref_key: "bar",
843
+ ref: M,
844
+ class: ee(["brep-bar", { "brep-bar-dragging": I.value }]),
845
+ role: "separator",
846
+ "aria-orientation": "horizontal",
847
+ tabindex: "0",
848
+ "aria-label": g(d).resizeModel,
849
+ "aria-valuenow": F.value,
850
+ "aria-valuemin": 0,
851
+ "aria-valuemax": Math.max(P.value, 0),
852
+ "data-testid": "brep-bar",
853
+ onPointerdown: pe,
854
+ onPointermove: me,
855
+ onPointerup: V,
856
+ onPointercancel: V,
857
+ onKeydown: he,
858
+ onDblclick: ge
859
+ }, [...t[2] ||= [l("span", { class: "brep-bar-grip" }, null, -1)]], 42, Ae),
860
+ l("div", je, [b.value ? (f(), c("section", Me, [
861
+ b.value.warnings.length ? (f(), c("div", Ne, [l("h2", Pe, h(g(d).warnings), 1), l("ul", Fe, [(f(!0), c(a, null, m(b.value.warnings, (e) => (f(), c("li", { key: e }, h(e), 1))), 128))])])) : s("", !0),
862
+ l("dl", Ie, [
863
+ l("dt", Le, h(g(d).size), 1),
864
+ l("dd", Re, h(b.value.size.join(" × ")) + " mm ", 1),
865
+ l("dt", ze, h(g(d).volume), 1),
866
+ l("dd", Be, h(w(b.value.volume)) + " mm³", 1),
867
+ l("dt", Ve, h(g(d).surface), 1),
868
+ l("dd", He, h(w(b.value.area)) + " mm²", 1),
869
+ l("dt", Ue, h(g(d).solids), 1),
870
+ l("dd", We, h(b.value.solids), 1),
871
+ l("dt", Ge, h(g(d).faces), 1),
872
+ l("dd", Ke, h(ue(b.value.faces)), 1),
873
+ l("dt", qe, h(g(d).edgeKinds), 1),
874
+ l("dd", null, h(ue(b.value.edges)), 1)
875
+ ]),
876
+ b.value.parts ? (f(), c(a, { key: 1 }, [l("h2", Je, h(g(d).parts), 1), l("ul", Ye, [(f(!0), c(a, null, m(b.value.parts, (e, t) => (f(), c("li", {
877
+ key: t,
878
+ class: "tabular-nums"
879
+ }, h(e.name ?? t + 1) + ": " + h(e.size.join(" × ")) + " mm, " + h(w(e.volume)) + " mm³ ", 1))), 128))])], 64)) : s("", !0),
880
+ b.value.operations.length ? (f(), c(a, { key: 2 }, [l("h2", Xe, h(g(d).operations), 1), l("ol", Ze, [(f(!0), c(a, null, m(b.value.operations, (e, t) => (f(), c("li", {
881
+ key: t,
882
+ class: "flex flex-wrap items-baseline gap-x-2"
883
+ }, [
884
+ e.line === void 0 ? s("", !0) : (f(), c("span", Qe, h(g(d).line) + " " + h(e.line), 1)),
885
+ l("code", $e, h(e.op) + "(" + h(e.size ?? "") + ")" + h(e.count > 1 ? ` ×${e.count}` : ""), 1),
886
+ E(e) ? (f(), c("span", et, h(E(e)), 1)) : s("", !0),
887
+ e.volumeChange === void 0 ? s("", !0) : (f(), c("span", tt, h(T(e.volumeChange)) + " mm³ ", 1))
888
+ ]))), 128))])], 64)) : s("", !0),
889
+ l("h2", nt, h(g(d).files), 1),
890
+ l("ul", rt, [(f(!0), c(a, null, m(le.value, (e) => (f(), c("li", { key: e.kind }, [l("button", {
891
+ type: "button",
892
+ class: "rounded border border-slate-300 px-2.5 py-1 hover:bg-slate-100",
893
+ title: e.fileName,
894
+ "data-testid": `brep-download-${e.kind}`,
895
+ onClick: (t) => C(e)
896
+ }, h(g(d).download) + " " + h(e.label), 9, it)]))), 128))])
897
+ ])) : s("", !0), x.value ? (f(), c("details", at, [l("summary", ot, [l("span", st, h(g(d).script), 1), l("button", {
898
+ type: "button",
899
+ class: "rounded border border-slate-300 px-1.5 py-0.5 text-xs hover:bg-slate-100",
900
+ onClick: t[1] ||= se((e) => de(x.value, "script"), ["prevent", "stop"])
901
+ }, h(D.value === "script" ? g(d).copied : g(d).copy), 1)]), l("pre", ct, [l("code", null, h(x.value), 1)])])) : s("", !0)])
902
+ ], 512));
903
+ }
904
+ }), [["__scopeId", "data-v-b7767e43"]]), J = {
905
+ class: "flex flex-col gap-0.5 rounded bg-slate-100 p-2 text-slate-800",
906
+ "data-testid": "brep-preview"
907
+ }, Y = ["title"], X = {
908
+ key: 0,
909
+ class: "text-xs tabular-nums text-slate-600"
910
+ }, Z = {
911
+ key: 1,
912
+ class: "text-xs text-amber-700",
913
+ "data-testid": "brep-preview-warnings"
914
+ }, Q = /* @__PURE__ */ d({
915
+ __name: "Preview",
916
+ props: { result: {} },
917
+ setup(e) {
918
+ let t = e, n = _e(), r = o(() => t.result.title || n.value.untitled), i = o(() => t.result.data?.report);
919
+ return (e, t) => (f(), c("div", J, [
920
+ l("div", {
921
+ class: "truncate text-sm font-semibold",
922
+ title: r.value
923
+ }, h(r.value), 9, Y),
924
+ i.value ? (f(), c("div", X, h(i.value.size.join(" × ")) + " mm ", 1)) : s("", !0),
925
+ i.value?.warnings.length ? (f(), c("div", Z, h(g(n).warnings) + ": " + h(i.value.warnings.length), 1)) : s("", !0)
926
+ ]));
927
+ }
928
+ }), $ = `Use the ${r} tool for a part that will be made or that must fit: brackets, enclosures, flanges, jigs, anything with fillets, chamfers, holes to a size, or a STEP file to hand on. It builds a replicad script with a CAD kernel and returns a report to check the result against. For a model that is only looked at, use ShapeScript. Z is up and the user looks from -Y: put the side they should see first at -Y (a chair's seat front at -Y, its backrest at +Y).`, dt = {
929
+ toolDefinition: t,
930
+ execute: async () => ({ message: "presentBrep runs on the host's server (executePresentBrep from @gui-chat-plugin/brep), not in the page." }),
931
+ generatingMessage: "Building the solid model...",
932
+ waitingMessage: "Tell the user that the solid model is being built and will be shown shortly.",
933
+ isEnabled: () => !0,
934
+ viewComponent: q,
935
+ previewComponent: Q,
936
+ systemPrompt: $
937
+ }, ft = { plugin: dt };
938
+ export { Q as Preview, $ as SYSTEM_PROMPT, t as TOOL_DEFINITION, r as TOOL_NAME, q as View, i as decodeMesh, ft as default, n as isBrepMesh, dt as plugin };