@tresjs/leches 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.
@@ -0,0 +1,1199 @@
1
+ /**
2
+ * name: @tresjs/leches
3
+ * version: v0.1.0
4
+ * (c) 2023
5
+ * description: Tasty GUI for Vue controls 🍰
6
+ * author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
7
+ */
8
+ import { unref as z, getCurrentScope as st, onScopeDispose as it, toRef as nt, readonly as rt, customRef as ot, ref as w, defineComponent as C, computed as v, reactive as W, h as ht, watch as E, inject as at, isReactive as lt, toRefs as ct, isRef as F, openBlock as g, createElementBlock as b, createElementVNode as d, toDisplayString as $, normalizeClass as q, withDirectives as ut, vShow as yt, normalizeStyle as xt, Fragment as L, renderList as B, createCommentVNode as U, createBlock as k, withCtx as _t } from "vue";
9
+ import { useStorage as dt, isClient as mt, useDraggable as gt, useMouse as V, useWindowSize as ft } from "@vueuse/core";
10
+ function K(i) {
11
+ return st() ? (it(i), !0) : !1;
12
+ }
13
+ function I(i) {
14
+ return typeof i == "function" ? i() : z(i);
15
+ }
16
+ const G = typeof window < "u", J = () => {
17
+ }, Y = /* @__PURE__ */ pt();
18
+ function pt() {
19
+ var i;
20
+ return G && ((i = window == null ? void 0 : window.navigator) == null ? void 0 : i.userAgent) && /* @__PURE__ */ /iP(ad|hone|od)/.test(window.navigator.userAgent);
21
+ }
22
+ function zt(...i) {
23
+ if (i.length !== 1)
24
+ return nt(...i);
25
+ const t = i[0];
26
+ return typeof t == "function" ? rt(ot(() => ({ get: t, set: J }))) : w(t);
27
+ }
28
+ function Mt(i) {
29
+ var t;
30
+ const e = I(i);
31
+ return (t = e == null ? void 0 : e.$el) != null ? t : e;
32
+ }
33
+ const wt = G ? window : void 0;
34
+ function bt(...i) {
35
+ let t, e, s, n;
36
+ if (typeof i[0] == "string" || Array.isArray(i[0]) ? ([e, s, n] = i, t = wt) : [t, e, s, n] = i, !t)
37
+ return J;
38
+ Array.isArray(e) || (e = [e]), Array.isArray(s) || (s = [s]);
39
+ const r = [], a = () => {
40
+ r.forEach((l) => l()), r.length = 0;
41
+ }, h = (l, o, x, c) => (l.addEventListener(o, x, c), () => l.removeEventListener(o, x, c)), y = E(
42
+ () => [Mt(t), I(n)],
43
+ ([l, o]) => {
44
+ a(), l && r.push(
45
+ ...e.flatMap((x) => s.map((c) => h(l, x, c, o)))
46
+ );
47
+ },
48
+ { immediate: !0, flush: "post" }
49
+ ), u = () => {
50
+ y(), a();
51
+ };
52
+ return K(u), u;
53
+ }
54
+ var vt = Object.defineProperty, Ct = Object.defineProperties, St = Object.getOwnPropertyDescriptors, H = Object.getOwnPropertySymbols, kt = Object.prototype.hasOwnProperty, $t = Object.prototype.propertyIsEnumerable, O = (i, t, e) => t in i ? vt(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, Et = (i, t) => {
55
+ for (var e in t || (t = {}))
56
+ kt.call(t, e) && O(i, e, t[e]);
57
+ if (H)
58
+ for (var e of H(t))
59
+ $t.call(t, e) && O(i, e, t[e]);
60
+ return i;
61
+ }, At = (i, t) => Ct(i, St(t));
62
+ const It = /* @__PURE__ */ C({
63
+ name: "UseDraggable",
64
+ props: [
65
+ "storageKey",
66
+ "storageType",
67
+ "initialValue",
68
+ "exact",
69
+ "preventDefault",
70
+ "stopPropagation",
71
+ "pointerTypes",
72
+ "as",
73
+ "handle",
74
+ "axis"
75
+ ],
76
+ setup(i, { slots: t }) {
77
+ const e = w(), s = v(() => {
78
+ var y;
79
+ return (y = i.handle) != null ? y : e.value;
80
+ }), n = i.storageKey && dt(
81
+ i.storageKey,
82
+ I(i.initialValue) || { x: 0, y: 0 },
83
+ mt ? i.storageType === "session" ? sessionStorage : localStorage : void 0
84
+ ), r = n || i.initialValue || { x: 0, y: 0 }, a = (y) => {
85
+ n && (n.value.x = y.x, n.value.y = y.y);
86
+ }, h = W(gt(e, At(Et({}, i), {
87
+ handle: s,
88
+ initialValue: r,
89
+ onEnd: a
90
+ })));
91
+ return () => {
92
+ if (t.default)
93
+ return ht(i.as || "div", { ref: e, style: `touch-action:none;${h.style}` }, t.default(h));
94
+ };
95
+ }
96
+ });
97
+ function tt(i) {
98
+ const t = window.getComputedStyle(i);
99
+ if (t.overflowX === "scroll" || t.overflowY === "scroll" || t.overflowX === "auto" && i.clientHeight < i.scrollHeight || t.overflowY === "auto" && i.clientWidth < i.scrollWidth)
100
+ return !0;
101
+ {
102
+ const e = i.parentNode;
103
+ return !e || e.tagName === "BODY" ? !1 : tt(e);
104
+ }
105
+ }
106
+ function Tt(i) {
107
+ const t = i || window.event, e = t.target;
108
+ return tt(e) ? !1 : t.touches.length > 1 ? !0 : (t.preventDefault && t.preventDefault(), !1);
109
+ }
110
+ function qt(i, t = !1) {
111
+ const e = w(t);
112
+ let s = null, n;
113
+ E(zt(i), (h) => {
114
+ if (h) {
115
+ const y = h;
116
+ n = y.style.overflow, e.value && (y.style.overflow = "hidden");
117
+ }
118
+ }, {
119
+ immediate: !0
120
+ });
121
+ const r = () => {
122
+ const h = I(i);
123
+ !h || e.value || (Y && (s = bt(
124
+ h,
125
+ "touchmove",
126
+ (y) => {
127
+ Tt(y);
128
+ },
129
+ { passive: !1 }
130
+ )), h.style.overflow = "hidden", e.value = !0);
131
+ }, a = () => {
132
+ const h = I(i);
133
+ !h || !e.value || (Y && (s == null || s()), h.style.overflow = n, e.value = !1);
134
+ };
135
+ return K(a), v({
136
+ get() {
137
+ return e.value;
138
+ },
139
+ set(h) {
140
+ h ? r() : a();
141
+ }
142
+ });
143
+ }
144
+ function Dt() {
145
+ let i = !1;
146
+ const t = w(!1);
147
+ return (e, s) => {
148
+ if (t.value = s.value, i)
149
+ return;
150
+ i = !0;
151
+ const n = qt(e, s.value);
152
+ E(t, (r) => n.value = r);
153
+ };
154
+ }
155
+ Dt();
156
+ const Pt = Symbol("CONTROLS_CONTEXT_KEY"), j = W({
157
+ controls: []
158
+ });
159
+ function jt() {
160
+ return j;
161
+ }
162
+ function Q(i) {
163
+ return Object.entries(i).map(([t, e]) => !F(e) && e.value ? {
164
+ ...e,
165
+ label: e.label || t,
166
+ value: e.value,
167
+ type: typeof e.value.value,
168
+ visible: !0
169
+ } : {
170
+ label: e.label || t,
171
+ value: e,
172
+ type: F(e) ? typeof e.value : typeof e,
173
+ visible: !0
174
+ });
175
+ }
176
+ function Se(i) {
177
+ const t = at(Pt, {});
178
+ let e = [];
179
+ if (typeof i != "string")
180
+ if (lt(i)) {
181
+ const s = ct(i);
182
+ e = Q(s);
183
+ } else
184
+ e = Q(i);
185
+ return j.controls = [...j.controls, ...e], t;
186
+ }
187
+ /**
188
+ * @license
189
+ * Copyright 2010-2023 Three.js Authors
190
+ * SPDX-License-Identifier: MIT
191
+ */
192
+ const et = "152";
193
+ function X(i, t, e) {
194
+ return Math.max(t, Math.min(e, i));
195
+ }
196
+ class D {
197
+ constructor(t = 0, e = 0) {
198
+ D.prototype.isVector2 = !0, this.x = t, this.y = e;
199
+ }
200
+ get width() {
201
+ return this.x;
202
+ }
203
+ set width(t) {
204
+ this.x = t;
205
+ }
206
+ get height() {
207
+ return this.y;
208
+ }
209
+ set height(t) {
210
+ this.y = t;
211
+ }
212
+ set(t, e) {
213
+ return this.x = t, this.y = e, this;
214
+ }
215
+ setScalar(t) {
216
+ return this.x = t, this.y = t, this;
217
+ }
218
+ setX(t) {
219
+ return this.x = t, this;
220
+ }
221
+ setY(t) {
222
+ return this.y = t, this;
223
+ }
224
+ setComponent(t, e) {
225
+ switch (t) {
226
+ case 0:
227
+ this.x = e;
228
+ break;
229
+ case 1:
230
+ this.y = e;
231
+ break;
232
+ default:
233
+ throw new Error("index is out of range: " + t);
234
+ }
235
+ return this;
236
+ }
237
+ getComponent(t) {
238
+ switch (t) {
239
+ case 0:
240
+ return this.x;
241
+ case 1:
242
+ return this.y;
243
+ default:
244
+ throw new Error("index is out of range: " + t);
245
+ }
246
+ }
247
+ clone() {
248
+ return new this.constructor(this.x, this.y);
249
+ }
250
+ copy(t) {
251
+ return this.x = t.x, this.y = t.y, this;
252
+ }
253
+ add(t) {
254
+ return this.x += t.x, this.y += t.y, this;
255
+ }
256
+ addScalar(t) {
257
+ return this.x += t, this.y += t, this;
258
+ }
259
+ addVectors(t, e) {
260
+ return this.x = t.x + e.x, this.y = t.y + e.y, this;
261
+ }
262
+ addScaledVector(t, e) {
263
+ return this.x += t.x * e, this.y += t.y * e, this;
264
+ }
265
+ sub(t) {
266
+ return this.x -= t.x, this.y -= t.y, this;
267
+ }
268
+ subScalar(t) {
269
+ return this.x -= t, this.y -= t, this;
270
+ }
271
+ subVectors(t, e) {
272
+ return this.x = t.x - e.x, this.y = t.y - e.y, this;
273
+ }
274
+ multiply(t) {
275
+ return this.x *= t.x, this.y *= t.y, this;
276
+ }
277
+ multiplyScalar(t) {
278
+ return this.x *= t, this.y *= t, this;
279
+ }
280
+ divide(t) {
281
+ return this.x /= t.x, this.y /= t.y, this;
282
+ }
283
+ divideScalar(t) {
284
+ return this.multiplyScalar(1 / t);
285
+ }
286
+ applyMatrix3(t) {
287
+ const e = this.x, s = this.y, n = t.elements;
288
+ return this.x = n[0] * e + n[3] * s + n[6], this.y = n[1] * e + n[4] * s + n[7], this;
289
+ }
290
+ min(t) {
291
+ return this.x = Math.min(this.x, t.x), this.y = Math.min(this.y, t.y), this;
292
+ }
293
+ max(t) {
294
+ return this.x = Math.max(this.x, t.x), this.y = Math.max(this.y, t.y), this;
295
+ }
296
+ clamp(t, e) {
297
+ return this.x = Math.max(t.x, Math.min(e.x, this.x)), this.y = Math.max(t.y, Math.min(e.y, this.y)), this;
298
+ }
299
+ clampScalar(t, e) {
300
+ return this.x = Math.max(t, Math.min(e, this.x)), this.y = Math.max(t, Math.min(e, this.y)), this;
301
+ }
302
+ clampLength(t, e) {
303
+ const s = this.length();
304
+ return this.divideScalar(s || 1).multiplyScalar(Math.max(t, Math.min(e, s)));
305
+ }
306
+ floor() {
307
+ return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this;
308
+ }
309
+ ceil() {
310
+ return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this;
311
+ }
312
+ round() {
313
+ return this.x = Math.round(this.x), this.y = Math.round(this.y), this;
314
+ }
315
+ roundToZero() {
316
+ return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this;
317
+ }
318
+ negate() {
319
+ return this.x = -this.x, this.y = -this.y, this;
320
+ }
321
+ dot(t) {
322
+ return this.x * t.x + this.y * t.y;
323
+ }
324
+ cross(t) {
325
+ return this.x * t.y - this.y * t.x;
326
+ }
327
+ lengthSq() {
328
+ return this.x * this.x + this.y * this.y;
329
+ }
330
+ length() {
331
+ return Math.sqrt(this.x * this.x + this.y * this.y);
332
+ }
333
+ manhattanLength() {
334
+ return Math.abs(this.x) + Math.abs(this.y);
335
+ }
336
+ normalize() {
337
+ return this.divideScalar(this.length() || 1);
338
+ }
339
+ angle() {
340
+ return Math.atan2(-this.y, -this.x) + Math.PI;
341
+ }
342
+ angleTo(t) {
343
+ const e = Math.sqrt(this.lengthSq() * t.lengthSq());
344
+ if (e === 0)
345
+ return Math.PI / 2;
346
+ const s = this.dot(t) / e;
347
+ return Math.acos(X(s, -1, 1));
348
+ }
349
+ distanceTo(t) {
350
+ return Math.sqrt(this.distanceToSquared(t));
351
+ }
352
+ distanceToSquared(t) {
353
+ const e = this.x - t.x, s = this.y - t.y;
354
+ return e * e + s * s;
355
+ }
356
+ manhattanDistanceTo(t) {
357
+ return Math.abs(this.x - t.x) + Math.abs(this.y - t.y);
358
+ }
359
+ setLength(t) {
360
+ return this.normalize().multiplyScalar(t);
361
+ }
362
+ lerp(t, e) {
363
+ return this.x += (t.x - this.x) * e, this.y += (t.y - this.y) * e, this;
364
+ }
365
+ lerpVectors(t, e, s) {
366
+ return this.x = t.x + (e.x - t.x) * s, this.y = t.y + (e.y - t.y) * s, this;
367
+ }
368
+ equals(t) {
369
+ return t.x === this.x && t.y === this.y;
370
+ }
371
+ fromArray(t, e = 0) {
372
+ return this.x = t[e], this.y = t[e + 1], this;
373
+ }
374
+ toArray(t = [], e = 0) {
375
+ return t[e] = this.x, t[e + 1] = this.y, t;
376
+ }
377
+ fromBufferAttribute(t, e) {
378
+ return this.x = t.getX(e), this.y = t.getY(e), this;
379
+ }
380
+ rotateAround(t, e) {
381
+ const s = Math.cos(e), n = Math.sin(e), r = this.x - t.x, a = this.y - t.y;
382
+ return this.x = r * s - a * n + t.x, this.y = r * n + a * s + t.y, this;
383
+ }
384
+ random() {
385
+ return this.x = Math.random(), this.y = Math.random(), this;
386
+ }
387
+ *[Symbol.iterator]() {
388
+ yield this.x, yield this.y;
389
+ }
390
+ }
391
+ class Lt {
392
+ constructor(t = 0, e = 0, s = 0, n = 1) {
393
+ this.isQuaternion = !0, this._x = t, this._y = e, this._z = s, this._w = n;
394
+ }
395
+ static slerpFlat(t, e, s, n, r, a, h) {
396
+ let y = s[n + 0], u = s[n + 1], l = s[n + 2], o = s[n + 3];
397
+ const x = r[a + 0], c = r[a + 1], _ = r[a + 2], f = r[a + 3];
398
+ if (h === 0) {
399
+ t[e + 0] = y, t[e + 1] = u, t[e + 2] = l, t[e + 3] = o;
400
+ return;
401
+ }
402
+ if (h === 1) {
403
+ t[e + 0] = x, t[e + 1] = c, t[e + 2] = _, t[e + 3] = f;
404
+ return;
405
+ }
406
+ if (o !== f || y !== x || u !== c || l !== _) {
407
+ let p = 1 - h;
408
+ const m = y * x + u * c + l * _ + o * f, M = m >= 0 ? 1 : -1, N = 1 - m * m;
409
+ if (N > Number.EPSILON) {
410
+ const S = Math.sqrt(N), R = Math.atan2(S, m * M);
411
+ p = Math.sin(p * R) / S, h = Math.sin(h * R) / S;
412
+ }
413
+ const T = h * M;
414
+ if (y = y * p + x * T, u = u * p + c * T, l = l * p + _ * T, o = o * p + f * T, p === 1 - h) {
415
+ const S = 1 / Math.sqrt(y * y + u * u + l * l + o * o);
416
+ y *= S, u *= S, l *= S, o *= S;
417
+ }
418
+ }
419
+ t[e] = y, t[e + 1] = u, t[e + 2] = l, t[e + 3] = o;
420
+ }
421
+ static multiplyQuaternionsFlat(t, e, s, n, r, a) {
422
+ const h = s[n], y = s[n + 1], u = s[n + 2], l = s[n + 3], o = r[a], x = r[a + 1], c = r[a + 2], _ = r[a + 3];
423
+ return t[e] = h * _ + l * o + y * c - u * x, t[e + 1] = y * _ + l * x + u * o - h * c, t[e + 2] = u * _ + l * c + h * x - y * o, t[e + 3] = l * _ - h * o - y * x - u * c, t;
424
+ }
425
+ get x() {
426
+ return this._x;
427
+ }
428
+ set x(t) {
429
+ this._x = t, this._onChangeCallback();
430
+ }
431
+ get y() {
432
+ return this._y;
433
+ }
434
+ set y(t) {
435
+ this._y = t, this._onChangeCallback();
436
+ }
437
+ get z() {
438
+ return this._z;
439
+ }
440
+ set z(t) {
441
+ this._z = t, this._onChangeCallback();
442
+ }
443
+ get w() {
444
+ return this._w;
445
+ }
446
+ set w(t) {
447
+ this._w = t, this._onChangeCallback();
448
+ }
449
+ set(t, e, s, n) {
450
+ return this._x = t, this._y = e, this._z = s, this._w = n, this._onChangeCallback(), this;
451
+ }
452
+ clone() {
453
+ return new this.constructor(this._x, this._y, this._z, this._w);
454
+ }
455
+ copy(t) {
456
+ return this._x = t.x, this._y = t.y, this._z = t.z, this._w = t.w, this._onChangeCallback(), this;
457
+ }
458
+ setFromEuler(t, e) {
459
+ const s = t._x, n = t._y, r = t._z, a = t._order, h = Math.cos, y = Math.sin, u = h(s / 2), l = h(n / 2), o = h(r / 2), x = y(s / 2), c = y(n / 2), _ = y(r / 2);
460
+ switch (a) {
461
+ case "XYZ":
462
+ this._x = x * l * o + u * c * _, this._y = u * c * o - x * l * _, this._z = u * l * _ + x * c * o, this._w = u * l * o - x * c * _;
463
+ break;
464
+ case "YXZ":
465
+ this._x = x * l * o + u * c * _, this._y = u * c * o - x * l * _, this._z = u * l * _ - x * c * o, this._w = u * l * o + x * c * _;
466
+ break;
467
+ case "ZXY":
468
+ this._x = x * l * o - u * c * _, this._y = u * c * o + x * l * _, this._z = u * l * _ + x * c * o, this._w = u * l * o - x * c * _;
469
+ break;
470
+ case "ZYX":
471
+ this._x = x * l * o - u * c * _, this._y = u * c * o + x * l * _, this._z = u * l * _ - x * c * o, this._w = u * l * o + x * c * _;
472
+ break;
473
+ case "YZX":
474
+ this._x = x * l * o + u * c * _, this._y = u * c * o + x * l * _, this._z = u * l * _ - x * c * o, this._w = u * l * o - x * c * _;
475
+ break;
476
+ case "XZY":
477
+ this._x = x * l * o - u * c * _, this._y = u * c * o - x * l * _, this._z = u * l * _ + x * c * o, this._w = u * l * o + x * c * _;
478
+ break;
479
+ default:
480
+ console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " + a);
481
+ }
482
+ return e !== !1 && this._onChangeCallback(), this;
483
+ }
484
+ setFromAxisAngle(t, e) {
485
+ const s = e / 2, n = Math.sin(s);
486
+ return this._x = t.x * n, this._y = t.y * n, this._z = t.z * n, this._w = Math.cos(s), this._onChangeCallback(), this;
487
+ }
488
+ setFromRotationMatrix(t) {
489
+ const e = t.elements, s = e[0], n = e[4], r = e[8], a = e[1], h = e[5], y = e[9], u = e[2], l = e[6], o = e[10], x = s + h + o;
490
+ if (x > 0) {
491
+ const c = 0.5 / Math.sqrt(x + 1);
492
+ this._w = 0.25 / c, this._x = (l - y) * c, this._y = (r - u) * c, this._z = (a - n) * c;
493
+ } else if (s > h && s > o) {
494
+ const c = 2 * Math.sqrt(1 + s - h - o);
495
+ this._w = (l - y) / c, this._x = 0.25 * c, this._y = (n + a) / c, this._z = (r + u) / c;
496
+ } else if (h > o) {
497
+ const c = 2 * Math.sqrt(1 + h - s - o);
498
+ this._w = (r - u) / c, this._x = (n + a) / c, this._y = 0.25 * c, this._z = (y + l) / c;
499
+ } else {
500
+ const c = 2 * Math.sqrt(1 + o - s - h);
501
+ this._w = (a - n) / c, this._x = (r + u) / c, this._y = (y + l) / c, this._z = 0.25 * c;
502
+ }
503
+ return this._onChangeCallback(), this;
504
+ }
505
+ setFromUnitVectors(t, e) {
506
+ let s = t.dot(e) + 1;
507
+ return s < Number.EPSILON ? (s = 0, Math.abs(t.x) > Math.abs(t.z) ? (this._x = -t.y, this._y = t.x, this._z = 0, this._w = s) : (this._x = 0, this._y = -t.z, this._z = t.y, this._w = s)) : (this._x = t.y * e.z - t.z * e.y, this._y = t.z * e.x - t.x * e.z, this._z = t.x * e.y - t.y * e.x, this._w = s), this.normalize();
508
+ }
509
+ angleTo(t) {
510
+ return 2 * Math.acos(Math.abs(X(this.dot(t), -1, 1)));
511
+ }
512
+ rotateTowards(t, e) {
513
+ const s = this.angleTo(t);
514
+ if (s === 0)
515
+ return this;
516
+ const n = Math.min(1, e / s);
517
+ return this.slerp(t, n), this;
518
+ }
519
+ identity() {
520
+ return this.set(0, 0, 0, 1);
521
+ }
522
+ invert() {
523
+ return this.conjugate();
524
+ }
525
+ conjugate() {
526
+ return this._x *= -1, this._y *= -1, this._z *= -1, this._onChangeCallback(), this;
527
+ }
528
+ dot(t) {
529
+ return this._x * t._x + this._y * t._y + this._z * t._z + this._w * t._w;
530
+ }
531
+ lengthSq() {
532
+ return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;
533
+ }
534
+ length() {
535
+ return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w);
536
+ }
537
+ normalize() {
538
+ let t = this.length();
539
+ return t === 0 ? (this._x = 0, this._y = 0, this._z = 0, this._w = 1) : (t = 1 / t, this._x = this._x * t, this._y = this._y * t, this._z = this._z * t, this._w = this._w * t), this._onChangeCallback(), this;
540
+ }
541
+ multiply(t) {
542
+ return this.multiplyQuaternions(this, t);
543
+ }
544
+ premultiply(t) {
545
+ return this.multiplyQuaternions(t, this);
546
+ }
547
+ multiplyQuaternions(t, e) {
548
+ const s = t._x, n = t._y, r = t._z, a = t._w, h = e._x, y = e._y, u = e._z, l = e._w;
549
+ return this._x = s * l + a * h + n * u - r * y, this._y = n * l + a * y + r * h - s * u, this._z = r * l + a * u + s * y - n * h, this._w = a * l - s * h - n * y - r * u, this._onChangeCallback(), this;
550
+ }
551
+ slerp(t, e) {
552
+ if (e === 0)
553
+ return this;
554
+ if (e === 1)
555
+ return this.copy(t);
556
+ const s = this._x, n = this._y, r = this._z, a = this._w;
557
+ let h = a * t._w + s * t._x + n * t._y + r * t._z;
558
+ if (h < 0 ? (this._w = -t._w, this._x = -t._x, this._y = -t._y, this._z = -t._z, h = -h) : this.copy(t), h >= 1)
559
+ return this._w = a, this._x = s, this._y = n, this._z = r, this;
560
+ const y = 1 - h * h;
561
+ if (y <= Number.EPSILON) {
562
+ const c = 1 - e;
563
+ return this._w = c * a + e * this._w, this._x = c * s + e * this._x, this._y = c * n + e * this._y, this._z = c * r + e * this._z, this.normalize(), this._onChangeCallback(), this;
564
+ }
565
+ const u = Math.sqrt(y), l = Math.atan2(u, h), o = Math.sin((1 - e) * l) / u, x = Math.sin(e * l) / u;
566
+ return this._w = a * o + this._w * x, this._x = s * o + this._x * x, this._y = n * o + this._y * x, this._z = r * o + this._z * x, this._onChangeCallback(), this;
567
+ }
568
+ slerpQuaternions(t, e, s) {
569
+ return this.copy(t).slerp(e, s);
570
+ }
571
+ random() {
572
+ const t = Math.random(), e = Math.sqrt(1 - t), s = Math.sqrt(t), n = 2 * Math.PI * Math.random(), r = 2 * Math.PI * Math.random();
573
+ return this.set(
574
+ e * Math.cos(n),
575
+ s * Math.sin(r),
576
+ s * Math.cos(r),
577
+ e * Math.sin(n)
578
+ );
579
+ }
580
+ equals(t) {
581
+ return t._x === this._x && t._y === this._y && t._z === this._z && t._w === this._w;
582
+ }
583
+ fromArray(t, e = 0) {
584
+ return this._x = t[e], this._y = t[e + 1], this._z = t[e + 2], this._w = t[e + 3], this._onChangeCallback(), this;
585
+ }
586
+ toArray(t = [], e = 0) {
587
+ return t[e] = this._x, t[e + 1] = this._y, t[e + 2] = this._z, t[e + 3] = this._w, t;
588
+ }
589
+ fromBufferAttribute(t, e) {
590
+ return this._x = t.getX(e), this._y = t.getY(e), this._z = t.getZ(e), this._w = t.getW(e), this;
591
+ }
592
+ toJSON() {
593
+ return this.toArray();
594
+ }
595
+ _onChange(t) {
596
+ return this._onChangeCallback = t, this;
597
+ }
598
+ _onChangeCallback() {
599
+ }
600
+ *[Symbol.iterator]() {
601
+ yield this._x, yield this._y, yield this._z, yield this._w;
602
+ }
603
+ }
604
+ class A {
605
+ constructor(t = 0, e = 0, s = 0) {
606
+ A.prototype.isVector3 = !0, this.x = t, this.y = e, this.z = s;
607
+ }
608
+ set(t, e, s) {
609
+ return s === void 0 && (s = this.z), this.x = t, this.y = e, this.z = s, this;
610
+ }
611
+ setScalar(t) {
612
+ return this.x = t, this.y = t, this.z = t, this;
613
+ }
614
+ setX(t) {
615
+ return this.x = t, this;
616
+ }
617
+ setY(t) {
618
+ return this.y = t, this;
619
+ }
620
+ setZ(t) {
621
+ return this.z = t, this;
622
+ }
623
+ setComponent(t, e) {
624
+ switch (t) {
625
+ case 0:
626
+ this.x = e;
627
+ break;
628
+ case 1:
629
+ this.y = e;
630
+ break;
631
+ case 2:
632
+ this.z = e;
633
+ break;
634
+ default:
635
+ throw new Error("index is out of range: " + t);
636
+ }
637
+ return this;
638
+ }
639
+ getComponent(t) {
640
+ switch (t) {
641
+ case 0:
642
+ return this.x;
643
+ case 1:
644
+ return this.y;
645
+ case 2:
646
+ return this.z;
647
+ default:
648
+ throw new Error("index is out of range: " + t);
649
+ }
650
+ }
651
+ clone() {
652
+ return new this.constructor(this.x, this.y, this.z);
653
+ }
654
+ copy(t) {
655
+ return this.x = t.x, this.y = t.y, this.z = t.z, this;
656
+ }
657
+ add(t) {
658
+ return this.x += t.x, this.y += t.y, this.z += t.z, this;
659
+ }
660
+ addScalar(t) {
661
+ return this.x += t, this.y += t, this.z += t, this;
662
+ }
663
+ addVectors(t, e) {
664
+ return this.x = t.x + e.x, this.y = t.y + e.y, this.z = t.z + e.z, this;
665
+ }
666
+ addScaledVector(t, e) {
667
+ return this.x += t.x * e, this.y += t.y * e, this.z += t.z * e, this;
668
+ }
669
+ sub(t) {
670
+ return this.x -= t.x, this.y -= t.y, this.z -= t.z, this;
671
+ }
672
+ subScalar(t) {
673
+ return this.x -= t, this.y -= t, this.z -= t, this;
674
+ }
675
+ subVectors(t, e) {
676
+ return this.x = t.x - e.x, this.y = t.y - e.y, this.z = t.z - e.z, this;
677
+ }
678
+ multiply(t) {
679
+ return this.x *= t.x, this.y *= t.y, this.z *= t.z, this;
680
+ }
681
+ multiplyScalar(t) {
682
+ return this.x *= t, this.y *= t, this.z *= t, this;
683
+ }
684
+ multiplyVectors(t, e) {
685
+ return this.x = t.x * e.x, this.y = t.y * e.y, this.z = t.z * e.z, this;
686
+ }
687
+ applyEuler(t) {
688
+ return this.applyQuaternion(Z.setFromEuler(t));
689
+ }
690
+ applyAxisAngle(t, e) {
691
+ return this.applyQuaternion(Z.setFromAxisAngle(t, e));
692
+ }
693
+ applyMatrix3(t) {
694
+ const e = this.x, s = this.y, n = this.z, r = t.elements;
695
+ return this.x = r[0] * e + r[3] * s + r[6] * n, this.y = r[1] * e + r[4] * s + r[7] * n, this.z = r[2] * e + r[5] * s + r[8] * n, this;
696
+ }
697
+ applyNormalMatrix(t) {
698
+ return this.applyMatrix3(t).normalize();
699
+ }
700
+ applyMatrix4(t) {
701
+ const e = this.x, s = this.y, n = this.z, r = t.elements, a = 1 / (r[3] * e + r[7] * s + r[11] * n + r[15]);
702
+ return this.x = (r[0] * e + r[4] * s + r[8] * n + r[12]) * a, this.y = (r[1] * e + r[5] * s + r[9] * n + r[13]) * a, this.z = (r[2] * e + r[6] * s + r[10] * n + r[14]) * a, this;
703
+ }
704
+ applyQuaternion(t) {
705
+ const e = this.x, s = this.y, n = this.z, r = t.x, a = t.y, h = t.z, y = t.w, u = y * e + a * n - h * s, l = y * s + h * e - r * n, o = y * n + r * s - a * e, x = -r * e - a * s - h * n;
706
+ return this.x = u * y + x * -r + l * -h - o * -a, this.y = l * y + x * -a + o * -r - u * -h, this.z = o * y + x * -h + u * -a - l * -r, this;
707
+ }
708
+ project(t) {
709
+ return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix);
710
+ }
711
+ unproject(t) {
712
+ return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld);
713
+ }
714
+ transformDirection(t) {
715
+ const e = this.x, s = this.y, n = this.z, r = t.elements;
716
+ return this.x = r[0] * e + r[4] * s + r[8] * n, this.y = r[1] * e + r[5] * s + r[9] * n, this.z = r[2] * e + r[6] * s + r[10] * n, this.normalize();
717
+ }
718
+ divide(t) {
719
+ return this.x /= t.x, this.y /= t.y, this.z /= t.z, this;
720
+ }
721
+ divideScalar(t) {
722
+ return this.multiplyScalar(1 / t);
723
+ }
724
+ min(t) {
725
+ return this.x = Math.min(this.x, t.x), this.y = Math.min(this.y, t.y), this.z = Math.min(this.z, t.z), this;
726
+ }
727
+ max(t) {
728
+ return this.x = Math.max(this.x, t.x), this.y = Math.max(this.y, t.y), this.z = Math.max(this.z, t.z), this;
729
+ }
730
+ clamp(t, e) {
731
+ return this.x = Math.max(t.x, Math.min(e.x, this.x)), this.y = Math.max(t.y, Math.min(e.y, this.y)), this.z = Math.max(t.z, Math.min(e.z, this.z)), this;
732
+ }
733
+ clampScalar(t, e) {
734
+ return this.x = Math.max(t, Math.min(e, this.x)), this.y = Math.max(t, Math.min(e, this.y)), this.z = Math.max(t, Math.min(e, this.z)), this;
735
+ }
736
+ clampLength(t, e) {
737
+ const s = this.length();
738
+ return this.divideScalar(s || 1).multiplyScalar(Math.max(t, Math.min(e, s)));
739
+ }
740
+ floor() {
741
+ return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this.z = Math.floor(this.z), this;
742
+ }
743
+ ceil() {
744
+ return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this.z = Math.ceil(this.z), this;
745
+ }
746
+ round() {
747
+ return this.x = Math.round(this.x), this.y = Math.round(this.y), this.z = Math.round(this.z), this;
748
+ }
749
+ roundToZero() {
750
+ return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z), this;
751
+ }
752
+ negate() {
753
+ return this.x = -this.x, this.y = -this.y, this.z = -this.z, this;
754
+ }
755
+ dot(t) {
756
+ return this.x * t.x + this.y * t.y + this.z * t.z;
757
+ }
758
+ // TODO lengthSquared?
759
+ lengthSq() {
760
+ return this.x * this.x + this.y * this.y + this.z * this.z;
761
+ }
762
+ length() {
763
+ return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
764
+ }
765
+ manhattanLength() {
766
+ return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z);
767
+ }
768
+ normalize() {
769
+ return this.divideScalar(this.length() || 1);
770
+ }
771
+ setLength(t) {
772
+ return this.normalize().multiplyScalar(t);
773
+ }
774
+ lerp(t, e) {
775
+ return this.x += (t.x - this.x) * e, this.y += (t.y - this.y) * e, this.z += (t.z - this.z) * e, this;
776
+ }
777
+ lerpVectors(t, e, s) {
778
+ return this.x = t.x + (e.x - t.x) * s, this.y = t.y + (e.y - t.y) * s, this.z = t.z + (e.z - t.z) * s, this;
779
+ }
780
+ cross(t) {
781
+ return this.crossVectors(this, t);
782
+ }
783
+ crossVectors(t, e) {
784
+ const s = t.x, n = t.y, r = t.z, a = e.x, h = e.y, y = e.z;
785
+ return this.x = n * y - r * h, this.y = r * a - s * y, this.z = s * h - n * a, this;
786
+ }
787
+ projectOnVector(t) {
788
+ const e = t.lengthSq();
789
+ if (e === 0)
790
+ return this.set(0, 0, 0);
791
+ const s = t.dot(this) / e;
792
+ return this.copy(t).multiplyScalar(s);
793
+ }
794
+ projectOnPlane(t) {
795
+ return P.copy(this).projectOnVector(t), this.sub(P);
796
+ }
797
+ reflect(t) {
798
+ return this.sub(P.copy(t).multiplyScalar(2 * this.dot(t)));
799
+ }
800
+ angleTo(t) {
801
+ const e = Math.sqrt(this.lengthSq() * t.lengthSq());
802
+ if (e === 0)
803
+ return Math.PI / 2;
804
+ const s = this.dot(t) / e;
805
+ return Math.acos(X(s, -1, 1));
806
+ }
807
+ distanceTo(t) {
808
+ return Math.sqrt(this.distanceToSquared(t));
809
+ }
810
+ distanceToSquared(t) {
811
+ const e = this.x - t.x, s = this.y - t.y, n = this.z - t.z;
812
+ return e * e + s * s + n * n;
813
+ }
814
+ manhattanDistanceTo(t) {
815
+ return Math.abs(this.x - t.x) + Math.abs(this.y - t.y) + Math.abs(this.z - t.z);
816
+ }
817
+ setFromSpherical(t) {
818
+ return this.setFromSphericalCoords(t.radius, t.phi, t.theta);
819
+ }
820
+ setFromSphericalCoords(t, e, s) {
821
+ const n = Math.sin(e) * t;
822
+ return this.x = n * Math.sin(s), this.y = Math.cos(e) * t, this.z = n * Math.cos(s), this;
823
+ }
824
+ setFromCylindrical(t) {
825
+ return this.setFromCylindricalCoords(t.radius, t.theta, t.y);
826
+ }
827
+ setFromCylindricalCoords(t, e, s) {
828
+ return this.x = t * Math.sin(e), this.y = s, this.z = t * Math.cos(e), this;
829
+ }
830
+ setFromMatrixPosition(t) {
831
+ const e = t.elements;
832
+ return this.x = e[12], this.y = e[13], this.z = e[14], this;
833
+ }
834
+ setFromMatrixScale(t) {
835
+ const e = this.setFromMatrixColumn(t, 0).length(), s = this.setFromMatrixColumn(t, 1).length(), n = this.setFromMatrixColumn(t, 2).length();
836
+ return this.x = e, this.y = s, this.z = n, this;
837
+ }
838
+ setFromMatrixColumn(t, e) {
839
+ return this.fromArray(t.elements, e * 4);
840
+ }
841
+ setFromMatrix3Column(t, e) {
842
+ return this.fromArray(t.elements, e * 3);
843
+ }
844
+ setFromEuler(t) {
845
+ return this.x = t._x, this.y = t._y, this.z = t._z, this;
846
+ }
847
+ setFromColor(t) {
848
+ return this.x = t.r, this.y = t.g, this.z = t.b, this;
849
+ }
850
+ equals(t) {
851
+ return t.x === this.x && t.y === this.y && t.z === this.z;
852
+ }
853
+ fromArray(t, e = 0) {
854
+ return this.x = t[e], this.y = t[e + 1], this.z = t[e + 2], this;
855
+ }
856
+ toArray(t = [], e = 0) {
857
+ return t[e] = this.x, t[e + 1] = this.y, t[e + 2] = this.z, t;
858
+ }
859
+ fromBufferAttribute(t, e) {
860
+ return this.x = t.getX(e), this.y = t.getY(e), this.z = t.getZ(e), this;
861
+ }
862
+ random() {
863
+ return this.x = Math.random(), this.y = Math.random(), this.z = Math.random(), this;
864
+ }
865
+ randomDirection() {
866
+ const t = (Math.random() - 0.5) * 2, e = Math.random() * Math.PI * 2, s = Math.sqrt(1 - t ** 2);
867
+ return this.x = s * Math.cos(e), this.y = s * Math.sin(e), this.z = t, this;
868
+ }
869
+ *[Symbol.iterator]() {
870
+ yield this.x, yield this.y, yield this.z;
871
+ }
872
+ }
873
+ const P = /* @__PURE__ */ new A(), Z = /* @__PURE__ */ new Lt();
874
+ typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register", { detail: {
875
+ revision: et
876
+ } }));
877
+ typeof window < "u" && (window.__THREE__ ? console.warn("WARNING: Multiple instances of Three.js being imported.") : window.__THREE__ = et);
878
+ const Vt = { class: "flex justify-between gap-4 items-center mb-2" }, Xt = { class: "text-gray-500 w-1/3" }, Nt = ["value", "min", "max", "step"], Rt = /* @__PURE__ */ C({
879
+ __name: "NumberControl",
880
+ props: {
881
+ label: null,
882
+ control: null
883
+ },
884
+ emits: ["change"],
885
+ setup(i, { emit: t }) {
886
+ const e = i;
887
+ function s(l) {
888
+ const { target: o } = l;
889
+ t("change", o.valueAsNumber);
890
+ }
891
+ const n = V(), r = w(0), a = w(!1), h = (l) => {
892
+ r.value = l.clientX, a.value = !0;
893
+ }, y = () => {
894
+ a.value = !1;
895
+ }, u = (l) => Math.floor(Math.abs(l) / 10);
896
+ return E(n.x, (l) => {
897
+ if (a.value) {
898
+ const o = l - r.value, x = u(o);
899
+ o > 0 ? t("change", e.control.value + 1 + x) : o < 0 && t("change", e.control.value - 1 + x), e.control.min !== void 0 && e.control.value < e.control.min && t("change", e.control.min), e.control.max !== void 0 && e.control.value > e.control.max && t("change", e.control.max), r.value = l;
900
+ }
901
+ }), (l, o) => (g(), b("div", Vt, [
902
+ d("label", Xt, $(i.label), 1),
903
+ d("input", {
904
+ value: i.control.value,
905
+ class: q(["p-2 w-1/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans", { "cursor-ew-resize": a.value }]),
906
+ type: "number",
907
+ min: i.control.min,
908
+ max: i.control.max,
909
+ step: i.control.step,
910
+ onInput: s,
911
+ onMousedown: h,
912
+ onMouseup: y
913
+ }, null, 42, Nt)
914
+ ]));
915
+ }
916
+ }), Ft = { class: "flex justify-between gap-4 items-center mb-2 min-h-32px" }, Yt = { class: "text-gray-500 w-1/3" }, Ht = ["value"], Ot = /* @__PURE__ */ C({
917
+ __name: "TextControl",
918
+ props: {
919
+ label: null,
920
+ control: null
921
+ },
922
+ emits: ["change"],
923
+ setup(i, { emit: t }) {
924
+ function e(s) {
925
+ t("change", s);
926
+ }
927
+ return (s, n) => (g(), b("div", Ft, [
928
+ d("label", Yt, $(i.label), 1),
929
+ d("input", {
930
+ value: i.control.value,
931
+ type: "string",
932
+ class: "p-2 w-2/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",
933
+ onChange: e
934
+ }, null, 40, Ht)
935
+ ]));
936
+ }
937
+ }), Qt = { class: "flex justify-start gap-2 items-center mb-2 min-h-32px" }, Zt = { class: "text-gray-500 w-1/3" }, Wt = ["id", "checked"], Bt = ["for"], Ut = { class: "i-ic:baseline-check text-light" }, Kt = /* @__PURE__ */ C({
938
+ __name: "BooleanControl",
939
+ props: {
940
+ label: null,
941
+ control: null
942
+ },
943
+ emits: ["change"],
944
+ setup(i, { emit: t }) {
945
+ function e(s) {
946
+ const { target: n } = s;
947
+ t("change", n.checked);
948
+ }
949
+ return (s, n) => (g(), b("div", Qt, [
950
+ d("label", Zt, $(i.label), 1),
951
+ d("input", {
952
+ id: i.control.label,
953
+ checked: i.control.value,
954
+ class: "hidden",
955
+ type: "checkbox",
956
+ onInput: e
957
+ }, null, 40, Wt),
958
+ d("label", {
959
+ for: i.control.label,
960
+ class: "inline-flex items-center cursor-pointer"
961
+ }, [
962
+ d("span", {
963
+ class: q([{ "bg-dark-500": i.control.value, "bg-gray-200": !i.control.value }, "w-4 h-4 flex justify-center items-center rounded border border-gray-300 mr-2 transition-colors duration-200"])
964
+ }, [
965
+ ut(d("i", Ut, null, 512), [
966
+ [yt, i.control.value]
967
+ ])
968
+ ], 2)
969
+ ], 8, Bt)
970
+ ]));
971
+ }
972
+ }), Gt = { class: "relative flex justify-between gap-4 items-center mb-2" }, Jt = { class: "text-gray-500 w-1/3" }, te = ["value", "min", "max", "step"], ee = ["value", "min", "max", "step"], se = /* @__PURE__ */ C({
973
+ __name: "SliderControl",
974
+ props: {
975
+ label: null,
976
+ control: null
977
+ },
978
+ emits: ["change"],
979
+ setup(i, { emit: t }) {
980
+ const e = i;
981
+ function s(o) {
982
+ const { target: x } = o;
983
+ t("change", x.valueAsNumber);
984
+ }
985
+ const n = v(() => ({
986
+ backgroundImage: `linear-gradient(to right, #333 0% ${100 * (e.control.value - (e.control.min || 0)) / ((e.control.max || 100) - (e.control.min || 0))}%, #e2e2e2 0%)`
987
+ })), r = V(), a = w(0), h = w(!1), y = (o) => {
988
+ a.value = o.clientX, h.value = !0;
989
+ }, u = () => {
990
+ h.value = !1;
991
+ }, l = (o) => Math.floor(Math.abs(o) / 10);
992
+ return E(r.x, (o) => {
993
+ if (h.value) {
994
+ const x = o - a.value, c = l(x);
995
+ x > 0 ? t("change", e.control.value + 1 + c) : x < 0 && t("change", e.control.value - 1 + c), e.control.min !== void 0 && e.control.value < e.control.min && t("change", e.control.min), e.control.max !== void 0 && e.control.value > e.control.max && t("change", e.control.max), a.value = o;
996
+ }
997
+ }), (o, x) => (g(), b("div", Gt, [
998
+ d("label", Jt, $(i.label), 1),
999
+ d("input", {
1000
+ value: i.control.value,
1001
+ class: "w-1/2 h-0.75 bg-dark-200 rounded-full appearance-none",
1002
+ style: xt(z(n)),
1003
+ type: "range",
1004
+ min: i.control.min,
1005
+ max: i.control.max,
1006
+ step: i.control.step,
1007
+ onInput: s
1008
+ }, null, 44, te),
1009
+ d("input", {
1010
+ value: i.control.value,
1011
+ class: q(["p-2 w-1/4 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans", { "cursor-ew-resize": h.value }]),
1012
+ type: "number",
1013
+ min: i.control.min,
1014
+ max: i.control.max,
1015
+ step: i.control.step,
1016
+ onInput: s,
1017
+ onMousedown: y,
1018
+ onMouseup: u
1019
+ }, null, 42, ee)
1020
+ ]));
1021
+ }
1022
+ });
1023
+ const ie = (i, t) => {
1024
+ const e = i.__vccOpts || i;
1025
+ for (const [s, n] of t)
1026
+ e[s] = n;
1027
+ return e;
1028
+ }, ne = /* @__PURE__ */ ie(se, [["__scopeId", "data-v-546d47fc"]]), re = { class: "flex justify-between gap-4 items-center mb-2" }, oe = { class: "text-gray-500 w-1/3" }, he = ["value"], ae = ["value"], le = /* @__PURE__ */ C({
1029
+ __name: "ColorControl",
1030
+ props: {
1031
+ label: null,
1032
+ control: null
1033
+ },
1034
+ emits: ["change"],
1035
+ setup(i, { emit: t }) {
1036
+ function e(s) {
1037
+ const { target: n } = s;
1038
+ t("change", n.value);
1039
+ }
1040
+ return (s, n) => (g(), b("div", re, [
1041
+ d("label", oe, $(i.label), 1),
1042
+ d("input", {
1043
+ value: i.control.value,
1044
+ type: "color",
1045
+ onInput: e
1046
+ }, null, 40, he),
1047
+ d("input", {
1048
+ value: i.control.value,
1049
+ class: "p-2 w-2/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",
1050
+ type: "text",
1051
+ onInput: e
1052
+ }, null, 40, ae)
1053
+ ]));
1054
+ }
1055
+ });
1056
+ function ce(i) {
1057
+ return typeof i == "number" ? [i, i, i] : i instanceof A ? [i.x, i.y, i.z] : i;
1058
+ }
1059
+ const ue = { class: "flex justify-between gap-2 items-center mb-2" }, ye = { class: "text-gray-500 w-1/3" }, xe = { class: "w-2/3 flex justify-between gap-1" }, _e = {
1060
+ key: 0,
1061
+ class: "font-bold px-0.5 py-1 text-0.65rem text-gray-300"
1062
+ }, de = ["value", "onInput", "onMousedown", "onMouseup"], me = /* @__PURE__ */ C({
1063
+ __name: "VectorControl",
1064
+ props: {
1065
+ label: null,
1066
+ control: null
1067
+ },
1068
+ emits: ["change"],
1069
+ setup(i, { emit: t }) {
1070
+ const e = i, s = V(), n = w(0), r = w(!1), a = w(0), h = (_, f) => {
1071
+ a.value = f, n.value = _.clientX, r.value = !0;
1072
+ }, y = (_, f) => {
1073
+ a.value = f, r.value = !1;
1074
+ }, u = (_) => Math.floor(Math.abs(_) / 10), l = v(() => ce(e.control.value)), o = v(() => Object.keys(e.control.value)), x = v(() => e.control.value instanceof D || e.control.value instanceof A);
1075
+ function c(_, f) {
1076
+ const { value: p } = e.control, { target: m } = _;
1077
+ a.value = f, p[x.value ? o.value[a.value] : a.value] = parseInt(m.value, 10), t("change", p);
1078
+ }
1079
+ return E(s.x, (_) => {
1080
+ if (r.value) {
1081
+ const f = _ - n.value, p = u(f), { value: m } = e.control, M = x.value ? o.value[a.value] : a.value;
1082
+ f > 0 ? m[M] += 1 + p : f < 0 && (m[M] -= 1 + p), e.control.min !== void 0 && m < e.control.min && (m[M] = e.control.min), e.control.max !== void 0 && m > e.control.max && (m[M] = e.control.max), t("change", m), n.value = _;
1083
+ }
1084
+ }), (_, f) => (g(), b("div", ue, [
1085
+ d("label", ye, $(i.label), 1),
1086
+ d("div", xe, [
1087
+ (g(!0), b(L, null, B(z(l), (p, m) => (g(), b("div", {
1088
+ key: i.label + m,
1089
+ class: "flex items-center w-1/3 bg-gray-100 rounded"
1090
+ }, [
1091
+ z(o)[m] && z(x) ? (g(), b("span", _e, $(z(o)[m]), 1)) : U("", !0),
1092
+ d("input", {
1093
+ type: "text",
1094
+ class: q(["w-full pl-0 p-1 text-right text-0.65rem text-gray-400 bg-transparent focus:border-gray-200 outline-none border-none font-sans", { "cursor-ew-resize": r.value }]),
1095
+ value: z(l)[m].toFixed(2),
1096
+ onInput: (M) => c(M, m),
1097
+ onMousedown: (M) => h(M, m),
1098
+ onMouseup: (M) => y(M, m)
1099
+ }, null, 42, de)
1100
+ ]))), 128))
1101
+ ])
1102
+ ]));
1103
+ }
1104
+ }), ge = /* @__PURE__ */ C({
1105
+ __name: "ControlInput",
1106
+ props: {
1107
+ control: null
1108
+ },
1109
+ emits: ["change"],
1110
+ setup(i, { emit: t }) {
1111
+ const e = i, s = v(
1112
+ () => e.control.type === "number" && (e.control.step || e.control.max || e.control.min)
1113
+ ), n = v(() => {
1114
+ const h = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$|^0x([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
1115
+ return e.control.type === "color" || h.test(e.control.value);
1116
+ }), r = v(
1117
+ () => e.control.value instanceof Array || e.control.value instanceof D || e.control.value instanceof A
1118
+ );
1119
+ function a(h) {
1120
+ t("change", h);
1121
+ }
1122
+ return (h, y) => i.control.visible ? (g(), b(L, { key: 0 }, [
1123
+ z(n) ? (g(), k(le, {
1124
+ key: 0,
1125
+ label: i.control.label,
1126
+ control: i.control,
1127
+ onChange: a
1128
+ }, null, 8, ["label", "control"])) : z(r) ? (g(), k(me, {
1129
+ key: 1,
1130
+ label: i.control.label,
1131
+ control: i.control,
1132
+ onChange: a
1133
+ }, null, 8, ["label", "control"])) : i.control.type === "boolean" ? (g(), k(Kt, {
1134
+ key: 2,
1135
+ label: i.control.label,
1136
+ control: i.control,
1137
+ onChange: a
1138
+ }, null, 8, ["label", "control"])) : z(s) ? z(s) ? (g(), k(ne, {
1139
+ key: 4,
1140
+ label: i.control.label,
1141
+ control: i.control,
1142
+ onChange: a
1143
+ }, null, 8, ["label", "control"])) : (g(), k(Ot, {
1144
+ key: 5,
1145
+ label: i.control.label,
1146
+ control: i.control,
1147
+ onChange: a
1148
+ }, null, 8, ["label", "control"])) : (g(), k(Rt, {
1149
+ key: 3,
1150
+ label: i.control.label,
1151
+ control: i.control,
1152
+ onChange: a
1153
+ }, null, 8, ["label", "control"]))
1154
+ ], 64)) : U("", !0);
1155
+ }
1156
+ }), fe = { class: "bg-white shadow-xl rounded border-4 border-solid border-black" }, pe = /* @__PURE__ */ d("i", { class: "h-4 w-4 p-1.5 flex items-center line-height-0 rounded-full bg-gray-100 text-xs" }, "🍰", -1), ze = /* @__PURE__ */ d("div", null, [
1157
+ /* @__PURE__ */ d("i", { class: "i-ic-baseline-drag-indicator" }),
1158
+ /* @__PURE__ */ d("i", { class: "i-ic-baseline-drag-indicator" }),
1159
+ /* @__PURE__ */ d("i", { class: "i-ic-baseline-drag-indicator" })
1160
+ ], -1), Me = /* @__PURE__ */ d("div", null, null, -1), we = [
1161
+ pe,
1162
+ ze,
1163
+ Me
1164
+ ], be = { class: "p-4" }, ke = /* @__PURE__ */ C({
1165
+ __name: "TresLeches",
1166
+ setup(i) {
1167
+ const { width: t } = ft(), e = 280, s = w(null), n = jt();
1168
+ function r(a, h) {
1169
+ h.value = a;
1170
+ }
1171
+ return (a, h) => (g(), k(z(It), {
1172
+ "initial-value": { x: z(t) - e - 20, y: 10 },
1173
+ class: "fixed select-none z-24 w-280px font-sans text-xs",
1174
+ handle: s.value
1175
+ }, {
1176
+ default: _t(() => [
1177
+ d("div", fe, [
1178
+ d("header", {
1179
+ ref_key: "handle",
1180
+ ref: s,
1181
+ class: "relative cursor-grabbing p-4 flex justify-between text-gray-200 relative"
1182
+ }, we, 512),
1183
+ d("div", be, [
1184
+ (g(!0), b(L, null, B(z(n).controls, (y) => (g(), k(ge, {
1185
+ key: y.label,
1186
+ control: y,
1187
+ onChange: (u) => r(u, y)
1188
+ }, null, 8, ["control", "onChange"]))), 128))
1189
+ ])
1190
+ ])
1191
+ ]),
1192
+ _: 1
1193
+ }, 8, ["initial-value", "handle"]));
1194
+ }
1195
+ });
1196
+ export {
1197
+ ke as TresLeches,
1198
+ Se as useControls
1199
+ };