@ddict/popup 1.0.6 → 1.0.8

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/popup.es.js CHANGED
@@ -1,1067 +1,2952 @@
1
- import { openBlock, createElementBlock, Fragment, withDirectives, createElementVNode, renderList, toDisplayString, vModelSelect, createCommentVNode, normalizeStyle, vModelText, vModelCheckbox, createVNode } from "vue";
2
- var helper = {
3
- isRTL
4
- };
5
- function isRTL(locale) {
6
- return ["ar", "fa", "iw", "yi", "ur", "pa"].indexOf(locale) > -1;
7
- }
8
- var _export_sfc = (sfc, props) => {
9
- const target = sfc.__vccOpts || sfc;
10
- for (const [key, val] of props) {
11
- target[key] = val;
12
- }
13
- return target;
14
- };
15
- const _sfc_main$8 = {
16
- props: {
17
- select: {
18
- type: Object,
19
- default: null
1
+ import { computed as _, unref as R, shallowRef as an, watch as j, triggerRef as rt, onScopeDispose as Ye, ref as S, onUnmounted as St, inject as Ce, watchEffect as le, onMounted as de, cloneVNode as Ot, h as Oe, Fragment as X, defineComponent as se, provide as Qe, reactive as Et, nextTick as Q, toRaw as K, openBlock as P, createElementBlock as V, createElementVNode as I, mergeModels as un, useModel as cn, createBlock as xe, withCtx as Pe, createVNode as H, renderList as ge, normalizeClass as it, toDisplayString as ne, effectScope as It, markRaw as ae, hasInjectionContext as dn, getCurrentInstance as $t, isRef as be, isReactive as Ze, toRef as Be, getCurrentScope as Ct, toRefs as at, createCommentVNode as ue, withModifiers as fn, withDirectives as Xe, vModelCheckbox as vn, createTextVNode as pn, vModelText as Tt } from "vue";
2
+ function _e(e, o, t) {
3
+ let n = t.initialDeps ?? [], l;
4
+ return () => {
5
+ var r, i, s, a;
6
+ let u;
7
+ t.key && ((r = t.debug) != null && r.call(t)) && (u = Date.now());
8
+ const v = e();
9
+ if (!(v.length !== n.length || v.some((m, w) => n[w] !== m)))
10
+ return l;
11
+ n = v;
12
+ let b;
13
+ if (t.key && ((i = t.debug) != null && i.call(t)) && (b = Date.now()), l = o(...v), t.key && ((s = t.debug) != null && s.call(t))) {
14
+ const m = Math.round((Date.now() - u) * 100) / 100, w = Math.round((Date.now() - b) * 100) / 100, $ = w / 16, M = (E, O) => {
15
+ for (E = String(E); E.length < O; )
16
+ E = " " + E;
17
+ return E;
18
+ };
19
+ console.info(
20
+ `%c⏱ ${M(w, 5)} /${M(m, 5)} ms`,
21
+ `
22
+ font-size: .6rem;
23
+ font-weight: bold;
24
+ color: hsl(${Math.max(
25
+ 0,
26
+ Math.min(120 - 120 * $, 120)
27
+ )}deg 100% 31%);`,
28
+ t == null ? void 0 : t.key
29
+ );
20
30
  }
21
- },
22
- emits: ["select"],
23
- data() {
24
- return {
25
- src: "",
26
- target: "",
27
- recents: {
28
- src: [],
29
- target: []
30
- }
31
+ return (a = t == null ? void 0 : t.onChange) == null || a.call(t, l), l;
32
+ };
33
+ }
34
+ function Ue(e, o) {
35
+ if (e === void 0)
36
+ throw new Error("Unexpected undefined");
37
+ return e;
38
+ }
39
+ const hn = (e, o) => Math.abs(e - o) < 1, mn = (e, o, t) => {
40
+ let n;
41
+ return function(...l) {
42
+ e.clearTimeout(n), n = e.setTimeout(() => o.apply(this, l), t);
43
+ };
44
+ }, gn = (e) => e, bn = (e) => {
45
+ const o = Math.max(e.startIndex - e.overscan, 0), t = Math.min(e.endIndex + e.overscan, e.count - 1), n = [];
46
+ for (let l = o; l <= t; l++)
47
+ n.push(l);
48
+ return n;
49
+ }, yn = (e, o) => {
50
+ const t = e.scrollElement;
51
+ if (!t)
52
+ return;
53
+ const n = e.targetWindow;
54
+ if (!n)
55
+ return;
56
+ const l = (i) => {
57
+ const { width: s, height: a } = i;
58
+ o({ width: Math.round(s), height: Math.round(a) });
59
+ };
60
+ if (l(t.getBoundingClientRect()), !n.ResizeObserver)
61
+ return () => {
31
62
  };
32
- },
33
- watch: {
34
- select(val) {
35
- if (!val)
63
+ const r = new n.ResizeObserver((i) => {
64
+ const s = i[0];
65
+ if (s != null && s.borderBoxSize) {
66
+ const a = s.borderBoxSize[0];
67
+ if (a) {
68
+ l({ width: a.inlineSize, height: a.blockSize });
36
69
  return;
37
- this.src = val.src;
38
- this.target = val.target;
39
- this.loadRecents();
70
+ }
40
71
  }
41
- },
42
- methods: {
43
- onRecentSrc(src) {
44
- this.src = src;
45
- this.onSelect();
46
- },
47
- onRecentTarget(target) {
48
- this.target = target;
49
- this.onSelect();
72
+ l(t.getBoundingClientRect());
73
+ });
74
+ return r.observe(t, { box: "border-box" }), () => {
75
+ r.unobserve(t);
76
+ };
77
+ }, ut = {
78
+ passive: !0
79
+ }, _n = typeof window > "u" ? !0 : "onscrollend" in window, wn = (e, o) => {
80
+ const t = e.scrollElement;
81
+ if (!t)
82
+ return;
83
+ const n = e.targetWindow;
84
+ if (!n)
85
+ return;
86
+ let l = 0;
87
+ const r = _n ? () => {
88
+ } : mn(
89
+ n,
90
+ () => {
91
+ o(l, !1);
50
92
  },
51
- swap() {
52
- if (this.src === "auto")
93
+ e.options.isScrollingResetDelay
94
+ ), i = (u) => () => {
95
+ l = t[e.options.horizontal ? "scrollLeft" : "scrollTop"], r(), o(l, u);
96
+ }, s = i(!0), a = i(!1);
97
+ return a(), t.addEventListener("scroll", s, ut), t.addEventListener("scrollend", a, ut), () => {
98
+ t.removeEventListener("scroll", s), t.removeEventListener("scrollend", a);
99
+ };
100
+ }, xn = (e, o, t) => {
101
+ if (o != null && o.borderBoxSize) {
102
+ const n = o.borderBoxSize[0];
103
+ if (n)
104
+ return Math.round(
105
+ n[t.options.horizontal ? "inlineSize" : "blockSize"]
106
+ );
107
+ }
108
+ return Math.round(
109
+ e.getBoundingClientRect()[t.options.horizontal ? "width" : "height"]
110
+ );
111
+ }, Sn = (e, {
112
+ adjustments: o = 0,
113
+ behavior: t
114
+ }, n) => {
115
+ var l, r;
116
+ const i = e + o;
117
+ (r = (l = n.scrollElement) == null ? void 0 : l.scrollTo) == null || r.call(l, {
118
+ [n.options.horizontal ? "left" : "top"]: i,
119
+ behavior: t
120
+ });
121
+ };
122
+ class On {
123
+ constructor(o) {
124
+ this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.scrollToIndexTimeoutId = null, this.measurementsCache = [], this.itemSizeCache = /* @__PURE__ */ new Map(), this.pendingMeasuredCacheIndexes = [], this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this.elementsCache = /* @__PURE__ */ new Map(), this.observer = /* @__PURE__ */ (() => {
125
+ let t = null;
126
+ const n = () => t || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : t = new this.targetWindow.ResizeObserver((l) => {
127
+ l.forEach((r) => {
128
+ this._measureElement(r.target, r);
129
+ });
130
+ }));
131
+ return {
132
+ disconnect: () => {
133
+ var l;
134
+ return (l = n()) == null ? void 0 : l.disconnect();
135
+ },
136
+ observe: (l) => {
137
+ var r;
138
+ return (r = n()) == null ? void 0 : r.observe(l, { box: "border-box" });
139
+ },
140
+ unobserve: (l) => {
141
+ var r;
142
+ return (r = n()) == null ? void 0 : r.unobserve(l);
143
+ }
144
+ };
145
+ })(), this.range = null, this.setOptions = (t) => {
146
+ Object.entries(t).forEach(([n, l]) => {
147
+ typeof l > "u" && delete t[n];
148
+ }), this.options = {
149
+ debug: !1,
150
+ initialOffset: 0,
151
+ overscan: 1,
152
+ paddingStart: 0,
153
+ paddingEnd: 0,
154
+ scrollPaddingStart: 0,
155
+ scrollPaddingEnd: 0,
156
+ horizontal: !1,
157
+ getItemKey: gn,
158
+ rangeExtractor: bn,
159
+ onChange: () => {
160
+ },
161
+ measureElement: xn,
162
+ initialRect: { width: 0, height: 0 },
163
+ scrollMargin: 0,
164
+ gap: 0,
165
+ indexAttribute: "data-index",
166
+ initialMeasurementsCache: [],
167
+ lanes: 1,
168
+ isScrollingResetDelay: 150,
169
+ enabled: !0,
170
+ ...t
171
+ };
172
+ }, this.notify = (t, n) => {
173
+ var l, r;
174
+ const { startIndex: i, endIndex: s } = this.range ?? {
175
+ startIndex: void 0,
176
+ endIndex: void 0
177
+ }, a = this.calculateRange();
178
+ (t || i !== (a == null ? void 0 : a.startIndex) || s !== (a == null ? void 0 : a.endIndex)) && ((r = (l = this.options).onChange) == null || r.call(l, this, n));
179
+ }, this.cleanup = () => {
180
+ this.unsubs.filter(Boolean).forEach((t) => t()), this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.observer.disconnect(), this.elementsCache.clear();
181
+ }, this._didMount = () => () => {
182
+ this.cleanup();
183
+ }, this._willUpdate = () => {
184
+ var t;
185
+ const n = this.options.enabled ? this.options.getScrollElement() : null;
186
+ if (this.scrollElement !== n) {
187
+ if (this.cleanup(), !n) {
188
+ this.notify(!1, !1);
189
+ return;
190
+ }
191
+ this.scrollElement = n, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = ((t = this.scrollElement) == null ? void 0 : t.window) ?? null, this._scrollToOffset(this.getScrollOffset(), {
192
+ adjustments: void 0,
193
+ behavior: void 0
194
+ }), this.unsubs.push(
195
+ this.options.observeElementRect(this, (l) => {
196
+ this.scrollRect = l, this.notify(!1, !1);
197
+ })
198
+ ), this.unsubs.push(
199
+ this.options.observeElementOffset(this, (l, r) => {
200
+ this.scrollAdjustments = 0, this.scrollDirection = r ? this.getScrollOffset() < l ? "forward" : "backward" : null, this.scrollOffset = l;
201
+ const i = this.isScrolling;
202
+ this.isScrolling = r, this.notify(i !== r, r);
203
+ })
204
+ );
205
+ }
206
+ }, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getFurthestMeasurement = (t, n) => {
207
+ const l = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
208
+ for (let i = n - 1; i >= 0; i--) {
209
+ const s = t[i];
210
+ if (l.has(s.lane))
211
+ continue;
212
+ const a = r.get(
213
+ s.lane
214
+ );
215
+ if (a == null || s.end > a.end ? r.set(s.lane, s) : s.end < a.end && l.set(s.lane, !0), l.size === this.options.lanes)
216
+ break;
217
+ }
218
+ return r.size === this.options.lanes ? Array.from(r.values()).sort((i, s) => i.end === s.end ? i.index - s.index : i.end - s.end)[0] : void 0;
219
+ }, this.getMeasurementOptions = _e(
220
+ () => [
221
+ this.options.count,
222
+ this.options.paddingStart,
223
+ this.options.scrollMargin,
224
+ this.options.getItemKey,
225
+ this.options.enabled
226
+ ],
227
+ (t, n, l, r, i) => (this.pendingMeasuredCacheIndexes = [], {
228
+ count: t,
229
+ paddingStart: n,
230
+ scrollMargin: l,
231
+ getItemKey: r,
232
+ enabled: i
233
+ }),
234
+ {
235
+ key: !1
236
+ }
237
+ ), this.getMeasurements = _e(
238
+ () => [this.getMeasurementOptions(), this.itemSizeCache],
239
+ ({ count: t, paddingStart: n, scrollMargin: l, getItemKey: r, enabled: i }, s) => {
240
+ var a;
241
+ if (!i)
242
+ return this.measurementsCache = [], this.itemSizeCache.clear(), [];
243
+ this.measurementsCache.length === 0 && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((c) => {
244
+ this.itemSizeCache.set(c.key, c.size);
245
+ }));
246
+ const u = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
247
+ this.pendingMeasuredCacheIndexes = [];
248
+ const v = this.measurementsCache.slice(0, u);
249
+ for (let c = u; c < t; c++) {
250
+ let b = (a = this.measurementsCache[c]) == null ? void 0 : a.measureElement;
251
+ b || (b = (A) => {
252
+ const g = r(c), T = this.elementsCache.get(g);
253
+ if (!A) {
254
+ T && (this.observer.unobserve(T), this.elementsCache.delete(g));
255
+ return;
256
+ }
257
+ T !== A && (T && this.observer.unobserve(T), this.observer.observe(A), this.elementsCache.set(g, A)), A.isConnected && this.resizeItem(
258
+ c,
259
+ this.options.measureElement(A, void 0, this)
260
+ );
261
+ });
262
+ const m = r(c), w = this.options.lanes === 1 ? v[c - 1] : this.getFurthestMeasurement(v, c), $ = w ? w.end + this.options.gap : n + l, M = s.get(m), E = typeof M == "number" ? M : this.options.estimateSize(c), O = $ + E, D = w ? w.lane : c % this.options.lanes;
263
+ v[c] = {
264
+ index: c,
265
+ start: $,
266
+ size: E,
267
+ end: O,
268
+ key: m,
269
+ lane: D,
270
+ measureElement: b
271
+ };
272
+ }
273
+ return this.measurementsCache = v, v;
274
+ },
275
+ {
276
+ key: process.env.NODE_ENV !== "production" && "getMeasurements",
277
+ debug: () => this.options.debug
278
+ }
279
+ ), this.calculateRange = _e(
280
+ () => [this.getMeasurements(), this.getSize(), this.getScrollOffset()],
281
+ (t, n, l) => this.range = t.length > 0 && n > 0 ? En({
282
+ measurements: t,
283
+ outerSize: n,
284
+ scrollOffset: l
285
+ }) : null,
286
+ {
287
+ key: process.env.NODE_ENV !== "production" && "calculateRange",
288
+ debug: () => this.options.debug
289
+ }
290
+ ), this.getIndexes = _e(
291
+ () => [
292
+ this.options.rangeExtractor,
293
+ this.calculateRange(),
294
+ this.options.overscan,
295
+ this.options.count
296
+ ],
297
+ (t, n, l, r) => n === null ? [] : t({
298
+ startIndex: n.startIndex,
299
+ endIndex: n.endIndex,
300
+ overscan: l,
301
+ count: r
302
+ }),
303
+ {
304
+ key: process.env.NODE_ENV !== "production" && "getIndexes",
305
+ debug: () => this.options.debug
306
+ }
307
+ ), this.indexFromElement = (t) => {
308
+ const n = this.options.indexAttribute, l = t.getAttribute(n);
309
+ return l ? parseInt(l, 10) : (console.warn(
310
+ `Missing attribute name '${n}={index}' on measured element.`
311
+ ), -1);
312
+ }, this._measureElement = (t, n) => {
313
+ const l = this.indexFromElement(t), r = this.getMeasurements()[l];
314
+ if (!r || !t.isConnected) {
315
+ this.elementsCache.forEach((s, a) => {
316
+ s === t && (this.observer.unobserve(t), this.elementsCache.delete(a));
317
+ });
53
318
  return;
54
- if (!this.select.srcs[this.target] || !this.select.targets[this.src]) {
319
+ }
320
+ const i = this.elementsCache.get(r.key);
321
+ i !== t && (i && this.observer.unobserve(i), this.observer.observe(t), this.elementsCache.set(r.key, t)), this.resizeItem(l, this.options.measureElement(t, n, this));
322
+ }, this.resizeItem = (t, n) => {
323
+ const l = this.getMeasurements()[t];
324
+ if (!l)
55
325
  return;
326
+ const r = this.itemSizeCache.get(l.key) ?? l.size, i = n - r;
327
+ i !== 0 && ((this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(l, i, this) : l.start < this.getScrollOffset() + this.scrollAdjustments) && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", i), this._scrollToOffset(this.getScrollOffset(), {
328
+ adjustments: this.scrollAdjustments += i,
329
+ behavior: void 0
330
+ })), this.pendingMeasuredCacheIndexes.push(l.index), this.itemSizeCache = new Map(this.itemSizeCache.set(l.key, n)), this.notify(!0, !1));
331
+ }, this.measureElement = (t) => {
332
+ t && this._measureElement(t, void 0);
333
+ }, this.getVirtualItems = _e(
334
+ () => [this.getIndexes(), this.getMeasurements()],
335
+ (t, n) => {
336
+ const l = [];
337
+ for (let r = 0, i = t.length; r < i; r++) {
338
+ const s = t[r], a = n[s];
339
+ l.push(a);
340
+ }
341
+ return l;
342
+ },
343
+ {
344
+ key: process.env.NODE_ENV !== "production" && "getIndexes",
345
+ debug: () => this.options.debug
56
346
  }
57
- const tmp = this.target;
58
- this.target = this.src;
59
- this.src = tmp;
60
- this.onSelect();
347
+ ), this.getVirtualItemForOffset = (t) => {
348
+ const n = this.getMeasurements();
349
+ if (n.length !== 0)
350
+ return Ue(
351
+ n[Pt(
352
+ 0,
353
+ n.length - 1,
354
+ (l) => Ue(n[l]).start,
355
+ t
356
+ )]
357
+ );
358
+ }, this.getOffsetForAlignment = (t, n) => {
359
+ const l = this.getSize(), r = this.getScrollOffset();
360
+ n === "auto" && (t <= r ? n = "start" : t >= r + l ? n = "end" : n = "start"), n === "start" ? t = t : n === "end" ? t = t - l : n === "center" && (t = t - l / 2);
361
+ const i = this.options.horizontal ? "scrollWidth" : "scrollHeight", a = (this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[i] : this.scrollElement[i] : 0) - l;
362
+ return Math.max(Math.min(a, t), 0);
363
+ }, this.getOffsetForIndex = (t, n = "auto") => {
364
+ t = Math.max(0, Math.min(t, this.options.count - 1));
365
+ const l = this.getMeasurements()[t];
366
+ if (!l)
367
+ return;
368
+ const r = this.getSize(), i = this.getScrollOffset();
369
+ if (n === "auto")
370
+ if (l.end >= i + r - this.options.scrollPaddingEnd)
371
+ n = "end";
372
+ else if (l.start <= i + this.options.scrollPaddingStart)
373
+ n = "start";
374
+ else
375
+ return [i, n];
376
+ const s = n === "end" ? l.end + this.options.scrollPaddingEnd : l.start - this.options.scrollPaddingStart;
377
+ return [this.getOffsetForAlignment(s, n), n];
378
+ }, this.isDynamicMode = () => this.elementsCache.size > 0, this.cancelScrollToIndex = () => {
379
+ this.scrollToIndexTimeoutId !== null && this.targetWindow && (this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId), this.scrollToIndexTimeoutId = null);
380
+ }, this.scrollToOffset = (t, { align: n = "start", behavior: l } = {}) => {
381
+ this.cancelScrollToIndex(), l === "smooth" && this.isDynamicMode() && console.warn(
382
+ "The `smooth` scroll behavior is not fully supported with dynamic size."
383
+ ), this._scrollToOffset(this.getOffsetForAlignment(t, n), {
384
+ adjustments: void 0,
385
+ behavior: l
386
+ });
387
+ }, this.scrollToIndex = (t, { align: n = "auto", behavior: l } = {}) => {
388
+ t = Math.max(0, Math.min(t, this.options.count - 1)), this.cancelScrollToIndex(), l === "smooth" && this.isDynamicMode() && console.warn(
389
+ "The `smooth` scroll behavior is not fully supported with dynamic size."
390
+ );
391
+ const r = this.getOffsetForIndex(t, n);
392
+ if (!r) return;
393
+ const [i, s] = r;
394
+ this._scrollToOffset(i, { adjustments: void 0, behavior: l }), l !== "smooth" && this.isDynamicMode() && this.targetWindow && (this.scrollToIndexTimeoutId = this.targetWindow.setTimeout(() => {
395
+ if (this.scrollToIndexTimeoutId = null, this.elementsCache.has(
396
+ this.options.getItemKey(t)
397
+ )) {
398
+ const [u] = Ue(
399
+ this.getOffsetForIndex(t, s)
400
+ );
401
+ hn(u, this.getScrollOffset()) || this.scrollToIndex(t, { align: s, behavior: l });
402
+ } else
403
+ this.scrollToIndex(t, { align: s, behavior: l });
404
+ }));
405
+ }, this.scrollBy = (t, { behavior: n } = {}) => {
406
+ this.cancelScrollToIndex(), n === "smooth" && this.isDynamicMode() && console.warn(
407
+ "The `smooth` scroll behavior is not fully supported with dynamic size."
408
+ ), this._scrollToOffset(this.getScrollOffset() + t, {
409
+ adjustments: void 0,
410
+ behavior: n
411
+ });
412
+ }, this.getTotalSize = () => {
413
+ var t;
414
+ const n = this.getMeasurements();
415
+ let l;
416
+ return n.length === 0 ? l = this.options.paddingStart : l = this.options.lanes === 1 ? ((t = n[n.length - 1]) == null ? void 0 : t.end) ?? 0 : Math.max(
417
+ ...n.slice(-this.options.lanes).map((r) => r.end)
418
+ ), l - this.options.scrollMargin + this.options.paddingEnd;
419
+ }, this._scrollToOffset = (t, {
420
+ adjustments: n,
421
+ behavior: l
422
+ }) => {
423
+ this.options.scrollToFn(t, { behavior: l, adjustments: n }, this);
424
+ }, this.measure = () => {
425
+ var t, n;
426
+ this.itemSizeCache = /* @__PURE__ */ new Map(), (n = (t = this.options).onChange) == null || n.call(t, this, !1);
427
+ }, this.setOptions(o);
428
+ }
429
+ }
430
+ const Pt = (e, o, t, n) => {
431
+ for (; e <= o; ) {
432
+ const l = (e + o) / 2 | 0, r = t(l);
433
+ if (r < n)
434
+ e = l + 1;
435
+ else if (r > n)
436
+ o = l - 1;
437
+ else
438
+ return l;
439
+ }
440
+ return e > 0 ? e - 1 : 0;
441
+ };
442
+ function En({
443
+ measurements: e,
444
+ outerSize: o,
445
+ scrollOffset: t
446
+ }) {
447
+ const n = e.length - 1, r = Pt(0, n, (s) => e[s].start, t);
448
+ let i = r;
449
+ for (; i < n && e[i].end < t + o; )
450
+ i++;
451
+ return { startIndex: r, endIndex: i };
452
+ }
453
+ function In(e) {
454
+ const o = new On(R(e)), t = an(o), n = o._didMount();
455
+ return j(
456
+ () => R(e).getScrollElement(),
457
+ (l) => {
458
+ l && o._willUpdate();
61
459
  },
62
- onSelect() {
63
- const select = JSON.parse(JSON.stringify(this.select));
64
- select.src = this.src;
65
- select.target = this.target;
66
- this.$emit("select", select);
67
- this.saveRecents(this.src, this.target);
460
+ {
461
+ immediate: !0
462
+ }
463
+ ), j(
464
+ () => R(e),
465
+ (l) => {
466
+ o.setOptions({
467
+ ...l,
468
+ onChange: (r, i) => {
469
+ var s;
470
+ rt(t), (s = l.onChange) == null || s.call(l, r, i);
471
+ }
472
+ }), o._willUpdate(), rt(t);
68
473
  },
69
- loadRecents() {
70
- const recents = JSON.parse(localStorage.getItem("recents"));
71
- if (!recents)
474
+ {
475
+ immediate: !0
476
+ }
477
+ ), Ye(n), t;
478
+ }
479
+ function $n(e) {
480
+ return In(
481
+ _(() => ({
482
+ observeElementRect: yn,
483
+ observeElementOffset: wn,
484
+ scrollToFn: Sn,
485
+ ...R(e)
486
+ }))
487
+ );
488
+ }
489
+ function Cn(e, o, t) {
490
+ let n = S(t == null ? void 0 : t.value), l = _(() => e.value !== void 0);
491
+ return [_(() => l.value ? e.value : n.value), function(r) {
492
+ return l.value || (n.value = r), o == null ? void 0 : o(r);
493
+ }];
494
+ }
495
+ function Tn(e) {
496
+ typeof queueMicrotask == "function" ? queueMicrotask(e) : Promise.resolve().then(e).catch((o) => setTimeout(() => {
497
+ throw o;
498
+ }));
499
+ }
500
+ function Le() {
501
+ let e = [], o = { addEventListener(t, n, l, r) {
502
+ return t.addEventListener(n, l, r), o.add(() => t.removeEventListener(n, l, r));
503
+ }, requestAnimationFrame(...t) {
504
+ let n = requestAnimationFrame(...t);
505
+ o.add(() => cancelAnimationFrame(n));
506
+ }, nextFrame(...t) {
507
+ o.requestAnimationFrame(() => {
508
+ o.requestAnimationFrame(...t);
509
+ });
510
+ }, setTimeout(...t) {
511
+ let n = setTimeout(...t);
512
+ o.add(() => clearTimeout(n));
513
+ }, microTask(...t) {
514
+ let n = { current: !0 };
515
+ return Tn(() => {
516
+ n.current && t[0]();
517
+ }), o.add(() => {
518
+ n.current = !1;
519
+ });
520
+ }, style(t, n, l) {
521
+ let r = t.style.getPropertyValue(n);
522
+ return Object.assign(t.style, { [n]: l }), this.add(() => {
523
+ Object.assign(t.style, { [n]: r });
524
+ });
525
+ }, group(t) {
526
+ let n = Le();
527
+ return t(n), this.add(() => n.dispose());
528
+ }, add(t) {
529
+ return e.push(t), () => {
530
+ let n = e.indexOf(t);
531
+ if (n >= 0) for (let l of e.splice(n, 1)) l();
532
+ };
533
+ }, dispose() {
534
+ for (let t of e.splice(0)) t();
535
+ } };
536
+ return o;
537
+ }
538
+ function Pn() {
539
+ let e = Le();
540
+ return St(() => e.dispose()), e;
541
+ }
542
+ function Rn() {
543
+ let e = Pn();
544
+ return (o) => {
545
+ e.dispose(), e.nextFrame(o);
546
+ };
547
+ }
548
+ let kn = Symbol("headlessui.useid"), Nn = 0;
549
+ function Te() {
550
+ return Ce(kn, () => `${++Nn}`)();
551
+ }
552
+ function k(e) {
553
+ var o;
554
+ if (e == null || e.value == null) return null;
555
+ let t = (o = e.value.$el) != null ? o : e.value;
556
+ return t instanceof Node ? t : null;
557
+ }
558
+ function te(e, o, ...t) {
559
+ if (e in o) {
560
+ let l = o[e];
561
+ return typeof l == "function" ? l(...t) : l;
562
+ }
563
+ let n = new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(o).map((l) => `"${l}"`).join(", ")}.`);
564
+ throw Error.captureStackTrace && Error.captureStackTrace(n, te), n;
565
+ }
566
+ var Vn = Object.defineProperty, Dn = (e, o, t) => o in e ? Vn(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t, ct = (e, o, t) => (Dn(e, typeof o != "symbol" ? o + "" : o, t), t);
567
+ let Ln = class {
568
+ constructor() {
569
+ ct(this, "current", this.detect()), ct(this, "currentId", 0);
570
+ }
571
+ set(o) {
572
+ this.current !== o && (this.currentId = 0, this.current = o);
573
+ }
574
+ reset() {
575
+ this.set(this.detect());
576
+ }
577
+ nextId() {
578
+ return ++this.currentId;
579
+ }
580
+ get isServer() {
581
+ return this.current === "server";
582
+ }
583
+ get isClient() {
584
+ return this.current === "client";
585
+ }
586
+ detect() {
587
+ return typeof window > "u" || typeof document > "u" ? "server" : "client";
588
+ }
589
+ }, et = new Ln();
590
+ function tt(e) {
591
+ if (et.isServer) return null;
592
+ if (e instanceof Node) return e.ownerDocument;
593
+ if (e != null && e.hasOwnProperty("value")) {
594
+ let o = k(e);
595
+ if (o) return o.ownerDocument;
596
+ }
597
+ return document;
598
+ }
599
+ let dt = ["[contentEditable=true]", "[tabindex]", "a[href]", "area[href]", "button:not([disabled])", "iframe", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].map((e) => `${e}:not([tabindex='-1'])`).join(",");
600
+ var Mn = ((e) => (e[e.First = 1] = "First", e[e.Previous = 2] = "Previous", e[e.Next = 4] = "Next", e[e.Last = 8] = "Last", e[e.WrapAround = 16] = "WrapAround", e[e.NoScroll = 32] = "NoScroll", e))(Mn || {}), An = ((e) => (e[e.Error = 0] = "Error", e[e.Overflow = 1] = "Overflow", e[e.Success = 2] = "Success", e[e.Underflow = 3] = "Underflow", e))(An || {}), jn = ((e) => (e[e.Previous = -1] = "Previous", e[e.Next = 1] = "Next", e))(jn || {}), Rt = ((e) => (e[e.Strict = 0] = "Strict", e[e.Loose = 1] = "Loose", e))(Rt || {});
601
+ function Fn(e, o = 0) {
602
+ var t;
603
+ return e === ((t = tt(e)) == null ? void 0 : t.body) ? !1 : te(o, { 0() {
604
+ return e.matches(dt);
605
+ }, 1() {
606
+ let n = e;
607
+ for (; n !== null; ) {
608
+ if (n.matches(dt)) return !0;
609
+ n = n.parentElement;
610
+ }
611
+ return !1;
612
+ } });
613
+ }
614
+ var zn = ((e) => (e[e.Keyboard = 0] = "Keyboard", e[e.Mouse = 1] = "Mouse", e))(zn || {});
615
+ typeof window < "u" && typeof document < "u" && (document.addEventListener("keydown", (e) => {
616
+ e.metaKey || e.altKey || e.ctrlKey || (document.documentElement.dataset.headlessuiFocusVisible = "");
617
+ }, !0), document.addEventListener("click", (e) => {
618
+ e.detail === 1 ? delete document.documentElement.dataset.headlessuiFocusVisible : e.detail === 0 && (document.documentElement.dataset.headlessuiFocusVisible = "");
619
+ }, !0));
620
+ function Bn(e, o = (t) => t) {
621
+ return e.slice().sort((t, n) => {
622
+ let l = o(t), r = o(n);
623
+ if (l === null || r === null) return 0;
624
+ let i = l.compareDocumentPosition(r);
625
+ return i & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : i & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
626
+ });
627
+ }
628
+ function Un() {
629
+ return /iPhone/gi.test(window.navigator.platform) || /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0;
630
+ }
631
+ function Hn() {
632
+ return /Android/gi.test(window.navigator.userAgent);
633
+ }
634
+ function kt() {
635
+ return Un() || Hn();
636
+ }
637
+ function Re(e, o, t) {
638
+ et.isServer || le((n) => {
639
+ document.addEventListener(e, o, t), n(() => document.removeEventListener(e, o, t));
640
+ });
641
+ }
642
+ function Wn(e, o, t) {
643
+ et.isServer || le((n) => {
644
+ window.addEventListener(e, o, t), n(() => window.removeEventListener(e, o, t));
645
+ });
646
+ }
647
+ function Gn(e, o, t = _(() => !0)) {
648
+ function n(r, i) {
649
+ if (!t.value || r.defaultPrevented) return;
650
+ let s = i(r);
651
+ if (s === null || !s.getRootNode().contains(s)) return;
652
+ let a = function u(v) {
653
+ return typeof v == "function" ? u(v()) : Array.isArray(v) || v instanceof Set ? v : [v];
654
+ }(e);
655
+ for (let u of a) {
656
+ if (u === null) continue;
657
+ let v = u instanceof HTMLElement ? u : k(u);
658
+ if (v != null && v.contains(s) || r.composed && r.composedPath().includes(v)) return;
659
+ }
660
+ return !Fn(s, Rt.Loose) && s.tabIndex !== -1 && r.preventDefault(), o(r, s);
661
+ }
662
+ let l = S(null);
663
+ Re("pointerdown", (r) => {
664
+ var i, s;
665
+ t.value && (l.value = ((s = (i = r.composedPath) == null ? void 0 : i.call(r)) == null ? void 0 : s[0]) || r.target);
666
+ }, !0), Re("mousedown", (r) => {
667
+ var i, s;
668
+ t.value && (l.value = ((s = (i = r.composedPath) == null ? void 0 : i.call(r)) == null ? void 0 : s[0]) || r.target);
669
+ }, !0), Re("click", (r) => {
670
+ kt() || l.value && (n(r, () => l.value), l.value = null);
671
+ }, !0), Re("touchend", (r) => n(r, () => r.target instanceof HTMLElement ? r.target : null), !0), Wn("blur", (r) => n(r, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), !0);
672
+ }
673
+ function ft(e, o) {
674
+ if (e) return e;
675
+ let t = o ?? "button";
676
+ if (typeof t == "string" && t.toLowerCase() === "button") return "button";
677
+ }
678
+ function qn(e, o) {
679
+ let t = S(ft(e.value.type, e.value.as));
680
+ return de(() => {
681
+ t.value = ft(e.value.type, e.value.as);
682
+ }), le(() => {
683
+ var n;
684
+ t.value || k(o) && k(o) instanceof HTMLButtonElement && !((n = k(o)) != null && n.hasAttribute("type")) && (t.value = "button");
685
+ }), t;
686
+ }
687
+ function vt(e) {
688
+ return [e.screenX, e.screenY];
689
+ }
690
+ function Jn() {
691
+ let e = S([-1, -1]);
692
+ return { wasMoved(o) {
693
+ let t = vt(o);
694
+ return e.value[0] === t[0] && e.value[1] === t[1] ? !1 : (e.value = t, !0);
695
+ }, update(o) {
696
+ e.value = vt(o);
697
+ } };
698
+ }
699
+ function Kn({ container: e, accept: o, walk: t, enabled: n }) {
700
+ le(() => {
701
+ let l = e.value;
702
+ if (!l || n !== void 0 && !n.value) return;
703
+ let r = tt(e);
704
+ if (!r) return;
705
+ let i = Object.assign((a) => o(a), { acceptNode: o }), s = r.createTreeWalker(l, NodeFilter.SHOW_ELEMENT, i, !1);
706
+ for (; s.nextNode(); ) t(s.currentNode);
707
+ });
708
+ }
709
+ var Ee = ((e) => (e[e.None = 0] = "None", e[e.RenderStrategy = 1] = "RenderStrategy", e[e.Static = 2] = "Static", e))(Ee || {}), Yn = ((e) => (e[e.Unmount = 0] = "Unmount", e[e.Hidden = 1] = "Hidden", e))(Yn || {});
710
+ function fe({ visible: e = !0, features: o = 0, ourProps: t, theirProps: n, ...l }) {
711
+ var r;
712
+ let i = Vt(n, t), s = Object.assign(l, { props: i });
713
+ if (e || o & 2 && i.static) return He(s);
714
+ if (o & 1) {
715
+ let a = (r = i.unmount) == null || r ? 0 : 1;
716
+ return te(a, { 0() {
717
+ return null;
718
+ }, 1() {
719
+ return He({ ...l, props: { ...i, hidden: !0, style: { display: "none" } } });
720
+ } });
721
+ }
722
+ return He(s);
723
+ }
724
+ function He({ props: e, attrs: o, slots: t, slot: n, name: l }) {
725
+ var r, i;
726
+ let { as: s, ...a } = je(e, ["unmount", "static"]), u = (r = t.default) == null ? void 0 : r.call(t, n), v = {};
727
+ if (n) {
728
+ let c = !1, b = [];
729
+ for (let [m, w] of Object.entries(n)) typeof w == "boolean" && (c = !0), w === !0 && b.push(m);
730
+ c && (v["data-headlessui-state"] = b.join(" "));
731
+ }
732
+ if (s === "template") {
733
+ if (u = Nt(u ?? []), Object.keys(a).length > 0 || Object.keys(o).length > 0) {
734
+ let [c, ...b] = u ?? [];
735
+ if (!Zn(c) || b.length > 0) throw new Error(['Passing props on "template"!', "", `The current component <${l} /> is rendering a "template".`, "However we need to passthrough the following props:", Object.keys(a).concat(Object.keys(o)).map(($) => $.trim()).filter(($, M, E) => E.indexOf($) === M).sort(($, M) => $.localeCompare(M)).map(($) => ` - ${$}`).join(`
736
+ `), "", "You can apply a few solutions:", ['Add an `as="..."` prop, to ensure that we render an actual element instead of a "template".', "Render a single element as the child so that we can forward the props onto that element."].map(($) => ` - ${$}`).join(`
737
+ `)].join(`
738
+ `));
739
+ let m = Vt((i = c.props) != null ? i : {}, a, v), w = Ot(c, m, !0);
740
+ for (let $ in m) $.startsWith("on") && (w.props || (w.props = {}), w.props[$] = m[$]);
741
+ return w;
742
+ }
743
+ return Array.isArray(u) && u.length === 1 ? u[0] : u;
744
+ }
745
+ return Oe(s, Object.assign({}, a, v), { default: () => u });
746
+ }
747
+ function Nt(e) {
748
+ return e.flatMap((o) => o.type === X ? Nt(o.children) : [o]);
749
+ }
750
+ function Vt(...e) {
751
+ if (e.length === 0) return {};
752
+ if (e.length === 1) return e[0];
753
+ let o = {}, t = {};
754
+ for (let n of e) for (let l in n) l.startsWith("on") && typeof n[l] == "function" ? (t[l] != null || (t[l] = []), t[l].push(n[l])) : o[l] = n[l];
755
+ if (o.disabled || o["aria-disabled"]) return Object.assign(o, Object.fromEntries(Object.keys(t).map((n) => [n, void 0])));
756
+ for (let n in t) Object.assign(o, { [n](l, ...r) {
757
+ let i = t[n];
758
+ for (let s of i) {
759
+ if (l instanceof Event && l.defaultPrevented) return;
760
+ s(l, ...r);
761
+ }
762
+ } });
763
+ return o;
764
+ }
765
+ function Qn(e) {
766
+ let o = Object.assign({}, e);
767
+ for (let t in o) o[t] === void 0 && delete o[t];
768
+ return o;
769
+ }
770
+ function je(e, o = []) {
771
+ let t = Object.assign({}, e);
772
+ for (let n of o) n in t && delete t[n];
773
+ return t;
774
+ }
775
+ function Zn(e) {
776
+ return e == null ? !1 : typeof e.type == "string" || typeof e.type == "object" || typeof e.type == "function";
777
+ }
778
+ var Dt = ((e) => (e[e.None = 1] = "None", e[e.Focusable = 2] = "Focusable", e[e.Hidden = 4] = "Hidden", e))(Dt || {});
779
+ let Xn = se({ name: "Hidden", props: { as: { type: [Object, String], default: "div" }, features: { type: Number, default: 1 } }, setup(e, { slots: o, attrs: t }) {
780
+ return () => {
781
+ var n;
782
+ let { features: l, ...r } = e, i = { "aria-hidden": (l & 2) === 2 ? !0 : (n = r["aria-hidden"]) != null ? n : void 0, hidden: (l & 4) === 4 ? !0 : void 0, style: { position: "fixed", top: 1, left: 1, width: 1, height: 0, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0", ...(l & 4) === 4 && (l & 2) !== 2 && { display: "none" } } };
783
+ return fe({ ourProps: i, theirProps: r, slot: {}, attrs: t, slots: o, name: "Hidden" });
784
+ };
785
+ } }), Lt = Symbol("Context");
786
+ var Ie = ((e) => (e[e.Open = 1] = "Open", e[e.Closed = 2] = "Closed", e[e.Closing = 4] = "Closing", e[e.Opening = 8] = "Opening", e))(Ie || {});
787
+ function eo() {
788
+ return Ce(Lt, null);
789
+ }
790
+ function to(e) {
791
+ Qe(Lt, e);
792
+ }
793
+ var W = ((e) => (e.Space = " ", e.Enter = "Enter", e.Escape = "Escape", e.Backspace = "Backspace", e.Delete = "Delete", e.ArrowLeft = "ArrowLeft", e.ArrowUp = "ArrowUp", e.ArrowRight = "ArrowRight", e.ArrowDown = "ArrowDown", e.Home = "Home", e.End = "End", e.PageUp = "PageUp", e.PageDown = "PageDown", e.Tab = "Tab", e))(W || {}), Mt = ((e) => (e[e.Left = 0] = "Left", e[e.Right = 2] = "Right", e))(Mt || {});
794
+ function no(e) {
795
+ function o() {
796
+ document.readyState !== "loading" && (e(), document.removeEventListener("DOMContentLoaded", o));
797
+ }
798
+ typeof window < "u" && typeof document < "u" && (document.addEventListener("DOMContentLoaded", o), o());
799
+ }
800
+ let ie = [];
801
+ no(() => {
802
+ function e(o) {
803
+ o.target instanceof HTMLElement && o.target !== document.body && ie[0] !== o.target && (ie.unshift(o.target), ie = ie.filter((t) => t != null && t.isConnected), ie.splice(10));
804
+ }
805
+ window.addEventListener("click", e, { capture: !0 }), window.addEventListener("mousedown", e, { capture: !0 }), window.addEventListener("focus", e, { capture: !0 }), document.body.addEventListener("click", e, { capture: !0 }), document.body.addEventListener("mousedown", e, { capture: !0 }), document.body.addEventListener("focus", e, { capture: !0 });
806
+ });
807
+ function oo(e) {
808
+ throw new Error("Unexpected object: " + e);
809
+ }
810
+ var B = ((e) => (e[e.First = 0] = "First", e[e.Previous = 1] = "Previous", e[e.Next = 2] = "Next", e[e.Last = 3] = "Last", e[e.Specific = 4] = "Specific", e[e.Nothing = 5] = "Nothing", e))(B || {});
811
+ function pt(e, o) {
812
+ let t = o.resolveItems();
813
+ if (t.length <= 0) return null;
814
+ let n = o.resolveActiveIndex(), l = n ?? -1;
815
+ switch (e.focus) {
816
+ case 0: {
817
+ for (let r = 0; r < t.length; ++r) if (!o.resolveDisabled(t[r], r, t)) return r;
818
+ return n;
819
+ }
820
+ case 1: {
821
+ l === -1 && (l = t.length);
822
+ for (let r = l - 1; r >= 0; --r) if (!o.resolveDisabled(t[r], r, t)) return r;
823
+ return n;
824
+ }
825
+ case 2: {
826
+ for (let r = l + 1; r < t.length; ++r) if (!o.resolveDisabled(t[r], r, t)) return r;
827
+ return n;
828
+ }
829
+ case 3: {
830
+ for (let r = t.length - 1; r >= 0; --r) if (!o.resolveDisabled(t[r], r, t)) return r;
831
+ return n;
832
+ }
833
+ case 4: {
834
+ for (let r = 0; r < t.length; ++r) if (o.resolveId(t[r], r, t) === e.id) return r;
835
+ return n;
836
+ }
837
+ case 5:
838
+ return null;
839
+ default:
840
+ oo(e);
841
+ }
842
+ }
843
+ function At(e = {}, o = null, t = []) {
844
+ for (let [n, l] of Object.entries(e)) Ft(t, jt(o, n), l);
845
+ return t;
846
+ }
847
+ function jt(e, o) {
848
+ return e ? e + "[" + o + "]" : o;
849
+ }
850
+ function Ft(e, o, t) {
851
+ if (Array.isArray(t)) for (let [n, l] of t.entries()) Ft(e, jt(o, n.toString()), l);
852
+ else t instanceof Date ? e.push([o, t.toISOString()]) : typeof t == "boolean" ? e.push([o, t ? "1" : "0"]) : typeof t == "string" ? e.push([o, t]) : typeof t == "number" ? e.push([o, `${t}`]) : t == null ? e.push([o, ""]) : At(t, o, e);
853
+ }
854
+ function lo(e, o) {
855
+ return e === o;
856
+ }
857
+ var so = ((e) => (e[e.Open = 0] = "Open", e[e.Closed = 1] = "Closed", e))(so || {}), ro = ((e) => (e[e.Single = 0] = "Single", e[e.Multi = 1] = "Multi", e))(ro || {}), io = ((e) => (e[e.Pointer = 0] = "Pointer", e[e.Focus = 1] = "Focus", e[e.Other = 2] = "Other", e))(io || {});
858
+ let zt = Symbol("ComboboxContext");
859
+ function ve(e) {
860
+ let o = Ce(zt, null);
861
+ if (o === null) {
862
+ let t = new Error(`<${e} /> is missing a parent <Combobox /> component.`);
863
+ throw Error.captureStackTrace && Error.captureStackTrace(t, ve), t;
864
+ }
865
+ return o;
866
+ }
867
+ let Bt = Symbol("VirtualContext"), ao = se({ name: "VirtualProvider", setup(e, { slots: o }) {
868
+ let t = ve("VirtualProvider"), n = _(() => {
869
+ let s = k(t.optionsRef);
870
+ if (!s) return { start: 0, end: 0 };
871
+ let a = window.getComputedStyle(s);
872
+ return { start: parseFloat(a.paddingBlockStart || a.paddingTop), end: parseFloat(a.paddingBlockEnd || a.paddingBottom) };
873
+ }), l = $n(_(() => ({ scrollPaddingStart: n.value.start, scrollPaddingEnd: n.value.end, count: t.virtual.value.options.length, estimateSize() {
874
+ return 40;
875
+ }, getScrollElement() {
876
+ return k(t.optionsRef);
877
+ }, overscan: 12 }))), r = _(() => {
878
+ var s;
879
+ return (s = t.virtual.value) == null ? void 0 : s.options;
880
+ }), i = S(0);
881
+ return j([r], () => {
882
+ i.value += 1;
883
+ }), Qe(Bt, t.virtual.value ? l : null), () => [Oe("div", { style: { position: "relative", width: "100%", height: `${l.value.getTotalSize()}px` }, ref: (s) => {
884
+ if (s) {
885
+ if (typeof process < "u" && process.env.JEST_WORKER_ID !== void 0 || t.activationTrigger.value === 0) return;
886
+ t.activeOptionIndex.value !== null && t.virtual.value.options.length > t.activeOptionIndex.value && l.value.scrollToIndex(t.activeOptionIndex.value);
887
+ }
888
+ } }, l.value.getVirtualItems().map((s) => Ot(o.default({ option: t.virtual.value.options[s.index], open: t.comboboxState.value === 0 })[0], { key: `${i.value}-${s.index}`, "data-index": s.index, "aria-setsize": t.virtual.value.options.length, "aria-posinset": s.index + 1, style: { position: "absolute", top: 0, left: 0, transform: `translateY(${s.start}px)`, overflowAnchor: "none" } })))];
889
+ } }), uo = se({ name: "Combobox", emits: { "update:modelValue": (e) => !0 }, props: { as: { type: [Object, String], default: "template" }, disabled: { type: [Boolean], default: !1 }, by: { type: [String, Function], nullable: !0, default: null }, modelValue: { type: [Object, String, Number, Boolean], default: void 0 }, defaultValue: { type: [Object, String, Number, Boolean], default: void 0 }, form: { type: String, optional: !0 }, name: { type: String, optional: !0 }, nullable: { type: Boolean, default: !1 }, multiple: { type: [Boolean], default: !1 }, immediate: { type: [Boolean], default: !1 }, virtual: { type: Object, default: null } }, inheritAttrs: !1, setup(e, { slots: o, attrs: t, emit: n }) {
890
+ let l = S(1), r = S(null), i = S(null), s = S(null), a = S(null), u = S({ static: !1, hold: !1 }), v = S([]), c = S(null), b = S(2), m = S(!1);
891
+ function w(d = (f) => f) {
892
+ let f = c.value !== null ? v.value[c.value] : null, y = d(v.value.slice()), x = y.length > 0 && y[0].dataRef.order.value !== null ? y.sort((L, G) => L.dataRef.order.value - G.dataRef.order.value) : Bn(y, (L) => k(L.dataRef.domRef)), N = f ? x.indexOf(f) : null;
893
+ return N === -1 && (N = null), { options: x, activeOptionIndex: N };
894
+ }
895
+ let $ = _(() => e.multiple ? 1 : 0), M = _(() => e.nullable), [E, O] = Cn(_(() => e.modelValue), (d) => n("update:modelValue", d), _(() => e.defaultValue)), D = _(() => E.value === void 0 ? te($.value, { 1: [], 0: void 0 }) : E.value), A = null, g = null;
896
+ function T(d) {
897
+ return te($.value, { 0() {
898
+ return O == null ? void 0 : O(d);
899
+ }, 1: () => {
900
+ let f = K(p.value.value).slice(), y = K(d), x = f.findIndex((N) => p.compare(y, K(N)));
901
+ return x === -1 ? f.push(y) : f.splice(x, 1), O == null ? void 0 : O(f);
902
+ } });
903
+ }
904
+ let h = _(() => {
905
+ });
906
+ j([h], ([d], [f]) => {
907
+ if (p.virtual.value && d && f && c.value !== null) {
908
+ let y = d.indexOf(f[c.value]);
909
+ y !== -1 ? c.value = y : c.value = null;
910
+ }
911
+ });
912
+ let p = { comboboxState: l, value: D, mode: $, compare(d, f) {
913
+ if (typeof e.by == "string") {
914
+ let y = e.by;
915
+ return (d == null ? void 0 : d[y]) === (f == null ? void 0 : f[y]);
916
+ }
917
+ return e.by === null ? lo(d, f) : e.by(d, f);
918
+ }, calculateIndex(d) {
919
+ return p.virtual.value ? e.by === null ? p.virtual.value.options.indexOf(d) : p.virtual.value.options.findIndex((f) => p.compare(f, d)) : v.value.findIndex((f) => p.compare(f.dataRef.value, d));
920
+ }, defaultValue: _(() => e.defaultValue), nullable: M, immediate: _(() => !1), virtual: _(() => null), inputRef: i, labelRef: r, buttonRef: s, optionsRef: a, disabled: _(() => e.disabled), options: v, change(d) {
921
+ O(d);
922
+ }, activeOptionIndex: _(() => {
923
+ if (m.value && c.value === null && (p.virtual.value ? p.virtual.value.options.length > 0 : v.value.length > 0)) {
924
+ if (p.virtual.value) {
925
+ let f = p.virtual.value.options.findIndex((y) => {
926
+ var x;
927
+ return !((x = p.virtual.value) != null && x.disabled(y));
928
+ });
929
+ if (f !== -1) return f;
930
+ }
931
+ let d = v.value.findIndex((f) => !f.dataRef.disabled);
932
+ if (d !== -1) return d;
933
+ }
934
+ return c.value;
935
+ }), activationTrigger: b, optionsPropsRef: u, closeCombobox() {
936
+ m.value = !1, !e.disabled && l.value !== 1 && (l.value = 1, c.value = null);
937
+ }, openCombobox() {
938
+ if (m.value = !0, !e.disabled && l.value !== 0) {
939
+ if (p.value.value) {
940
+ let d = p.calculateIndex(p.value.value);
941
+ d !== -1 && (c.value = d);
942
+ }
943
+ l.value = 0;
944
+ }
945
+ }, setActivationTrigger(d) {
946
+ b.value = d;
947
+ }, goToOption(d, f, y) {
948
+ m.value = !1, A !== null && cancelAnimationFrame(A), A = requestAnimationFrame(() => {
949
+ if (e.disabled || a.value && !u.value.static && l.value === 1) return;
950
+ if (p.virtual.value) {
951
+ c.value = d === B.Specific ? f : pt({ focus: d }, { resolveItems: () => p.virtual.value.options, resolveActiveIndex: () => {
952
+ var L, G;
953
+ return (G = (L = p.activeOptionIndex.value) != null ? L : p.virtual.value.options.findIndex((q) => {
954
+ var F;
955
+ return !((F = p.virtual.value) != null && F.disabled(q));
956
+ })) != null ? G : null;
957
+ }, resolveDisabled: (L) => p.virtual.value.disabled(L), resolveId() {
958
+ throw new Error("Function not implemented.");
959
+ } }), b.value = y ?? 2;
72
960
  return;
73
- this.recents = recents;
74
- },
75
- saveRecents(src, target) {
76
- if (!this.recents.src.includes(src)) {
77
- this.recents.src.push(src);
78
961
  }
79
- if (!this.recents.target.includes(target))
80
- this.recents.target.push(target);
81
- if (this.recents.src.length > 3)
82
- this.recents.src.shift();
83
- if (this.recents.target.length > 3)
84
- this.recents.target.shift();
85
- localStorage.setItem("recents", JSON.stringify(this.recents));
962
+ let x = w();
963
+ if (x.activeOptionIndex === null) {
964
+ let L = x.options.findIndex((G) => !G.dataRef.disabled);
965
+ L !== -1 && (x.activeOptionIndex = L);
966
+ }
967
+ let N = d === B.Specific ? f : pt({ focus: d }, { resolveItems: () => x.options, resolveActiveIndex: () => x.activeOptionIndex, resolveId: (L) => L.id, resolveDisabled: (L) => L.dataRef.disabled });
968
+ c.value = N, b.value = y ?? 2, v.value = x.options;
969
+ });
970
+ }, selectOption(d) {
971
+ let f = v.value.find((x) => x.id === d);
972
+ if (!f) return;
973
+ let { dataRef: y } = f;
974
+ T(y.value);
975
+ }, selectActiveOption() {
976
+ if (p.activeOptionIndex.value !== null) {
977
+ if (p.virtual.value) T(p.virtual.value.options[p.activeOptionIndex.value]);
978
+ else {
979
+ let { dataRef: d } = v.value[p.activeOptionIndex.value];
980
+ T(d.value);
981
+ }
982
+ p.goToOption(B.Specific, p.activeOptionIndex.value);
983
+ }
984
+ }, registerOption(d, f) {
985
+ let y = Et({ id: d, dataRef: f });
986
+ if (p.virtual.value) {
987
+ v.value.push(y);
988
+ return;
989
+ }
990
+ g && cancelAnimationFrame(g);
991
+ let x = w((N) => (N.push(y), N));
992
+ c.value === null && p.isSelected(f.value.value) && (x.activeOptionIndex = x.options.indexOf(y)), v.value = x.options, c.value = x.activeOptionIndex, b.value = 2, x.options.some((N) => !k(N.dataRef.domRef)) && (g = requestAnimationFrame(() => {
993
+ let N = w();
994
+ v.value = N.options, c.value = N.activeOptionIndex;
995
+ }));
996
+ }, unregisterOption(d, f) {
997
+ if (A !== null && cancelAnimationFrame(A), f && (m.value = !0), p.virtual.value) {
998
+ v.value = v.value.filter((x) => x.id !== d);
999
+ return;
86
1000
  }
1001
+ let y = w((x) => {
1002
+ let N = x.findIndex((L) => L.id === d);
1003
+ return N !== -1 && x.splice(N, 1), x;
1004
+ });
1005
+ v.value = y.options, c.value = y.activeOptionIndex, b.value = 2;
1006
+ }, isSelected(d) {
1007
+ return te($.value, { 0: () => p.compare(K(p.value.value), K(d)), 1: () => K(p.value.value).some((f) => p.compare(K(f), K(d))) });
1008
+ }, isActive(d) {
1009
+ return c.value === p.calculateIndex(d);
1010
+ } };
1011
+ Gn([i, s, a], () => p.closeCombobox(), _(() => l.value === 0)), Qe(zt, p), to(_(() => te(l.value, { 0: Ie.Open, 1: Ie.Closed })));
1012
+ let C = _(() => {
1013
+ var d;
1014
+ return (d = k(i)) == null ? void 0 : d.closest("form");
1015
+ });
1016
+ return de(() => {
1017
+ j([C], () => {
1018
+ if (!C.value || e.defaultValue === void 0) return;
1019
+ function d() {
1020
+ p.change(e.defaultValue);
1021
+ }
1022
+ return C.value.addEventListener("reset", d), () => {
1023
+ var f;
1024
+ (f = C.value) == null || f.removeEventListener("reset", d);
1025
+ };
1026
+ }, { immediate: !0 });
1027
+ }), () => {
1028
+ var d, f, y;
1029
+ let { name: x, disabled: N, form: L, ...G } = e, q = { open: l.value === 0, disabled: N, activeIndex: p.activeOptionIndex.value, activeOption: p.activeOptionIndex.value === null ? null : p.virtual.value ? p.virtual.value.options[(d = p.activeOptionIndex.value) != null ? d : 0] : (y = (f = p.options.value[p.activeOptionIndex.value]) == null ? void 0 : f.dataRef.value) != null ? y : null, value: D.value };
1030
+ return Oe(X, [...x != null && D.value != null ? At({ [x]: D.value }).map(([F, rn]) => Oe(Xn, Qn({ features: Dt.Hidden, key: F, as: "input", type: "hidden", hidden: !0, readOnly: !0, form: L, disabled: N, name: F, value: rn }))) : [], fe({ theirProps: { ...t, ...je(G, ["by", "defaultValue", "immediate", "modelValue", "multiple", "nullable", "onUpdate:modelValue", "virtual"]) }, ourProps: {}, slot: q, slots: o, attrs: t, name: "Combobox" })]);
1031
+ };
1032
+ } });
1033
+ se({ name: "ComboboxLabel", props: { as: { type: [Object, String], default: "label" }, id: { type: String, default: null } }, setup(e, { attrs: o, slots: t }) {
1034
+ var n;
1035
+ let l = (n = e.id) != null ? n : `headlessui-combobox-label-${Te()}`, r = ve("ComboboxLabel");
1036
+ function i() {
1037
+ var s;
1038
+ (s = k(r.inputRef)) == null || s.focus({ preventScroll: !0 });
87
1039
  }
88
- };
89
- const _hoisted_1$8 = {
90
- key: 0,
91
- class: "flex flex-row"
92
- };
93
- const _hoisted_2$8 = ["value"];
94
- const _hoisted_3$8 = {
95
- key: 0,
1040
+ return () => {
1041
+ let s = { open: r.comboboxState.value === 0, disabled: r.disabled.value }, { ...a } = e, u = { id: l, ref: r.labelRef, onClick: i };
1042
+ return fe({ ourProps: u, theirProps: a, slot: s, attrs: o, slots: t, name: "ComboboxLabel" });
1043
+ };
1044
+ } });
1045
+ let co = se({ name: "ComboboxButton", props: { as: { type: [Object, String], default: "button" }, id: { type: String, default: null } }, setup(e, { attrs: o, slots: t, expose: n }) {
1046
+ var l;
1047
+ let r = (l = e.id) != null ? l : `headlessui-combobox-button-${Te()}`, i = ve("ComboboxButton");
1048
+ n({ el: i.buttonRef, $el: i.buttonRef });
1049
+ function s(v) {
1050
+ i.disabled.value || (i.comboboxState.value === 0 ? i.closeCombobox() : (v.preventDefault(), i.openCombobox()), Q(() => {
1051
+ var c;
1052
+ return (c = k(i.inputRef)) == null ? void 0 : c.focus({ preventScroll: !0 });
1053
+ }));
1054
+ }
1055
+ function a(v) {
1056
+ switch (v.key) {
1057
+ case W.ArrowDown:
1058
+ v.preventDefault(), v.stopPropagation(), i.comboboxState.value === 1 && i.openCombobox(), Q(() => {
1059
+ var c;
1060
+ return (c = i.inputRef.value) == null ? void 0 : c.focus({ preventScroll: !0 });
1061
+ });
1062
+ return;
1063
+ case W.ArrowUp:
1064
+ v.preventDefault(), v.stopPropagation(), i.comboboxState.value === 1 && (i.openCombobox(), Q(() => {
1065
+ i.value.value || i.goToOption(B.Last);
1066
+ })), Q(() => {
1067
+ var c;
1068
+ return (c = i.inputRef.value) == null ? void 0 : c.focus({ preventScroll: !0 });
1069
+ });
1070
+ return;
1071
+ case W.Escape:
1072
+ if (i.comboboxState.value !== 0) return;
1073
+ v.preventDefault(), i.optionsRef.value && !i.optionsPropsRef.value.static && v.stopPropagation(), i.closeCombobox(), Q(() => {
1074
+ var c;
1075
+ return (c = i.inputRef.value) == null ? void 0 : c.focus({ preventScroll: !0 });
1076
+ });
1077
+ return;
1078
+ }
1079
+ }
1080
+ let u = qn(_(() => ({ as: e.as, type: o.type })), i.buttonRef);
1081
+ return () => {
1082
+ var v, c;
1083
+ let b = { open: i.comboboxState.value === 0, disabled: i.disabled.value, value: i.value.value }, { ...m } = e, w = { ref: i.buttonRef, id: r, type: u.value, tabindex: "-1", "aria-haspopup": "listbox", "aria-controls": (v = k(i.optionsRef)) == null ? void 0 : v.id, "aria-expanded": i.comboboxState.value === 0, "aria-labelledby": i.labelRef.value ? [(c = k(i.labelRef)) == null ? void 0 : c.id, r].join(" ") : void 0, disabled: i.disabled.value === !0 ? !0 : void 0, onKeydown: a, onClick: s };
1084
+ return fe({ ourProps: w, theirProps: m, slot: b, attrs: o, slots: t, name: "ComboboxButton" });
1085
+ };
1086
+ } }), fo = se({ name: "ComboboxInput", props: { as: { type: [Object, String], default: "input" }, static: { type: Boolean, default: !1 }, unmount: { type: Boolean, default: !0 }, displayValue: { type: Function }, defaultValue: { type: String, default: void 0 }, id: { type: String, default: null } }, emits: { change: (e) => !0 }, setup(e, { emit: o, attrs: t, slots: n, expose: l }) {
1087
+ var r;
1088
+ let i = (r = e.id) != null ? r : `headlessui-combobox-input-${Te()}`, s = ve("ComboboxInput"), a = _(() => tt(k(s.inputRef))), u = { value: !1 };
1089
+ l({ el: s.inputRef, $el: s.inputRef });
1090
+ function v() {
1091
+ s.change(null);
1092
+ let g = k(s.optionsRef);
1093
+ g && (g.scrollTop = 0), s.goToOption(B.Nothing);
1094
+ }
1095
+ let c = _(() => {
1096
+ var g;
1097
+ let T = s.value.value;
1098
+ return k(s.inputRef) ? typeof e.displayValue < "u" && T !== void 0 ? (g = e.displayValue(T)) != null ? g : "" : typeof T == "string" ? T : "" : "";
1099
+ });
1100
+ de(() => {
1101
+ j([c, s.comboboxState, a], ([g, T], [h, p]) => {
1102
+ if (u.value) return;
1103
+ let C = k(s.inputRef);
1104
+ C && ((p === 0 && T === 1 || g !== h) && (C.value = g), requestAnimationFrame(() => {
1105
+ var d;
1106
+ if (u.value || !C || ((d = a.value) == null ? void 0 : d.activeElement) !== C) return;
1107
+ let { selectionStart: f, selectionEnd: y } = C;
1108
+ Math.abs((y ?? 0) - (f ?? 0)) === 0 && f === 0 && C.setSelectionRange(C.value.length, C.value.length);
1109
+ }));
1110
+ }, { immediate: !0 }), j([s.comboboxState], ([g], [T]) => {
1111
+ if (g === 0 && T === 1) {
1112
+ if (u.value) return;
1113
+ let h = k(s.inputRef);
1114
+ if (!h) return;
1115
+ let p = h.value, { selectionStart: C, selectionEnd: d, selectionDirection: f } = h;
1116
+ h.value = "", h.value = p, f !== null ? h.setSelectionRange(C, d, f) : h.setSelectionRange(C, d);
1117
+ }
1118
+ });
1119
+ });
1120
+ let b = S(!1);
1121
+ function m() {
1122
+ b.value = !0;
1123
+ }
1124
+ function w() {
1125
+ Le().nextFrame(() => {
1126
+ b.value = !1;
1127
+ });
1128
+ }
1129
+ let $ = Rn();
1130
+ function M(g) {
1131
+ switch (u.value = !0, $(() => {
1132
+ u.value = !1;
1133
+ }), g.key) {
1134
+ case W.Enter:
1135
+ if (u.value = !1, s.comboboxState.value !== 0 || b.value) return;
1136
+ if (g.preventDefault(), g.stopPropagation(), s.activeOptionIndex.value === null) {
1137
+ s.closeCombobox();
1138
+ return;
1139
+ }
1140
+ s.selectActiveOption(), s.mode.value === 0 && s.closeCombobox();
1141
+ break;
1142
+ case W.ArrowDown:
1143
+ return u.value = !1, g.preventDefault(), g.stopPropagation(), te(s.comboboxState.value, { 0: () => s.goToOption(B.Next), 1: () => s.openCombobox() });
1144
+ case W.ArrowUp:
1145
+ return u.value = !1, g.preventDefault(), g.stopPropagation(), te(s.comboboxState.value, { 0: () => s.goToOption(B.Previous), 1: () => {
1146
+ s.openCombobox(), Q(() => {
1147
+ s.value.value || s.goToOption(B.Last);
1148
+ });
1149
+ } });
1150
+ case W.Home:
1151
+ if (g.shiftKey) break;
1152
+ return u.value = !1, g.preventDefault(), g.stopPropagation(), s.goToOption(B.First);
1153
+ case W.PageUp:
1154
+ return u.value = !1, g.preventDefault(), g.stopPropagation(), s.goToOption(B.First);
1155
+ case W.End:
1156
+ if (g.shiftKey) break;
1157
+ return u.value = !1, g.preventDefault(), g.stopPropagation(), s.goToOption(B.Last);
1158
+ case W.PageDown:
1159
+ return u.value = !1, g.preventDefault(), g.stopPropagation(), s.goToOption(B.Last);
1160
+ case W.Escape:
1161
+ if (u.value = !1, s.comboboxState.value !== 0) return;
1162
+ g.preventDefault(), s.optionsRef.value && !s.optionsPropsRef.value.static && g.stopPropagation(), s.nullable.value && s.mode.value === 0 && s.value.value === null && v(), s.closeCombobox();
1163
+ break;
1164
+ case W.Tab:
1165
+ if (u.value = !1, s.comboboxState.value !== 0) return;
1166
+ s.mode.value === 0 && s.activationTrigger.value !== 1 && s.selectActiveOption(), s.closeCombobox();
1167
+ break;
1168
+ }
1169
+ }
1170
+ function E(g) {
1171
+ o("change", g), s.nullable.value && s.mode.value === 0 && g.target.value === "" && v(), s.openCombobox();
1172
+ }
1173
+ function O(g) {
1174
+ var T, h, p;
1175
+ let C = (T = g.relatedTarget) != null ? T : ie.find((d) => d !== g.currentTarget);
1176
+ if (u.value = !1, !((h = k(s.optionsRef)) != null && h.contains(C)) && !((p = k(s.buttonRef)) != null && p.contains(C)) && s.comboboxState.value === 0) return g.preventDefault(), s.mode.value === 0 && (s.nullable.value && s.value.value === null ? v() : s.activationTrigger.value !== 1 && s.selectActiveOption()), s.closeCombobox();
1177
+ }
1178
+ function D(g) {
1179
+ var T, h, p;
1180
+ let C = (T = g.relatedTarget) != null ? T : ie.find((d) => d !== g.currentTarget);
1181
+ (h = k(s.buttonRef)) != null && h.contains(C) || (p = k(s.optionsRef)) != null && p.contains(C) || s.disabled.value || s.immediate.value && s.comboboxState.value !== 0 && (s.openCombobox(), Le().nextFrame(() => {
1182
+ s.setActivationTrigger(1);
1183
+ }));
1184
+ }
1185
+ let A = _(() => {
1186
+ var g, T, h, p;
1187
+ return (p = (h = (T = e.defaultValue) != null ? T : s.defaultValue.value !== void 0 ? (g = e.displayValue) == null ? void 0 : g.call(e, s.defaultValue.value) : null) != null ? h : s.defaultValue.value) != null ? p : "";
1188
+ });
1189
+ return () => {
1190
+ var g, T, h, p, C, d, f;
1191
+ let y = { open: s.comboboxState.value === 0 }, { displayValue: x, onChange: N, ...L } = e, G = { "aria-controls": (g = s.optionsRef.value) == null ? void 0 : g.id, "aria-expanded": s.comboboxState.value === 0, "aria-activedescendant": s.activeOptionIndex.value === null ? void 0 : s.virtual.value ? (T = s.options.value.find((q) => !s.virtual.value.disabled(q.dataRef.value) && s.compare(q.dataRef.value, s.virtual.value.options[s.activeOptionIndex.value]))) == null ? void 0 : T.id : (h = s.options.value[s.activeOptionIndex.value]) == null ? void 0 : h.id, "aria-labelledby": (d = (p = k(s.labelRef)) == null ? void 0 : p.id) != null ? d : (C = k(s.buttonRef)) == null ? void 0 : C.id, "aria-autocomplete": "list", id: i, onCompositionstart: m, onCompositionend: w, onKeydown: M, onInput: E, onFocus: D, onBlur: O, role: "combobox", type: (f = t.type) != null ? f : "text", tabIndex: 0, ref: s.inputRef, defaultValue: A.value, disabled: s.disabled.value === !0 ? !0 : void 0 };
1192
+ return fe({ ourProps: G, theirProps: L, slot: y, attrs: t, slots: n, features: Ee.RenderStrategy | Ee.Static, name: "ComboboxInput" });
1193
+ };
1194
+ } }), vo = se({ name: "ComboboxOptions", props: { as: { type: [Object, String], default: "ul" }, static: { type: Boolean, default: !1 }, unmount: { type: Boolean, default: !0 }, hold: { type: [Boolean], default: !1 } }, setup(e, { attrs: o, slots: t, expose: n }) {
1195
+ let l = ve("ComboboxOptions"), r = `headlessui-combobox-options-${Te()}`;
1196
+ n({ el: l.optionsRef, $el: l.optionsRef }), le(() => {
1197
+ l.optionsPropsRef.value.static = e.static;
1198
+ }), le(() => {
1199
+ l.optionsPropsRef.value.hold = e.hold;
1200
+ });
1201
+ let i = eo(), s = _(() => i !== null ? (i.value & Ie.Open) === Ie.Open : l.comboboxState.value === 0);
1202
+ Kn({ container: _(() => k(l.optionsRef)), enabled: _(() => l.comboboxState.value === 0), accept(u) {
1203
+ return u.getAttribute("role") === "option" ? NodeFilter.FILTER_REJECT : u.hasAttribute("role") ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
1204
+ }, walk(u) {
1205
+ u.setAttribute("role", "none");
1206
+ } });
1207
+ function a(u) {
1208
+ u.preventDefault();
1209
+ }
1210
+ return () => {
1211
+ var u, v, c;
1212
+ let b = { open: l.comboboxState.value === 0 }, m = { "aria-labelledby": (c = (u = k(l.labelRef)) == null ? void 0 : u.id) != null ? c : (v = k(l.buttonRef)) == null ? void 0 : v.id, id: r, ref: l.optionsRef, role: "listbox", "aria-multiselectable": l.mode.value === 1 ? !0 : void 0, onMousedown: a }, w = je(e, ["hold"]);
1213
+ return fe({ ourProps: m, theirProps: w, slot: b, attrs: o, slots: l.virtual.value && l.comboboxState.value === 0 ? { ...t, default: () => [Oe(ao, {}, t.default)] } : t, features: Ee.RenderStrategy | Ee.Static, visible: s.value, name: "ComboboxOptions" });
1214
+ };
1215
+ } }), po = se({ name: "ComboboxOption", props: { as: { type: [Object, String], default: "li" }, value: { type: [Object, String, Number, Boolean] }, disabled: { type: Boolean, default: !1 }, order: { type: [Number], default: null } }, setup(e, { slots: o, attrs: t, expose: n }) {
1216
+ let l = ve("ComboboxOption"), r = `headlessui-combobox-option-${Te()}`, i = S(null), s = _(() => e.disabled);
1217
+ n({ el: i, $el: i });
1218
+ let a = _(() => {
1219
+ var O;
1220
+ return l.virtual.value ? l.activeOptionIndex.value === l.calculateIndex(e.value) : l.activeOptionIndex.value === null ? !1 : ((O = l.options.value[l.activeOptionIndex.value]) == null ? void 0 : O.id) === r;
1221
+ }), u = _(() => l.isSelected(e.value)), v = Ce(Bt, null), c = _(() => ({ disabled: e.disabled, value: e.value, domRef: i, order: _(() => e.order) }));
1222
+ de(() => l.registerOption(r, c)), St(() => l.unregisterOption(r, a.value)), le(() => {
1223
+ let O = k(i);
1224
+ O && (v == null || v.value.measureElement(O));
1225
+ }), le(() => {
1226
+ l.comboboxState.value === 0 && a.value && (l.virtual.value || l.activationTrigger.value !== 0 && Q(() => {
1227
+ var O, D;
1228
+ return (D = (O = k(i)) == null ? void 0 : O.scrollIntoView) == null ? void 0 : D.call(O, { block: "nearest" });
1229
+ }));
1230
+ });
1231
+ function b(O) {
1232
+ O.preventDefault(), O.button === Mt.Left && (s.value || (l.selectOption(r), kt() || requestAnimationFrame(() => {
1233
+ var D;
1234
+ return (D = k(l.inputRef)) == null ? void 0 : D.focus({ preventScroll: !0 });
1235
+ }), l.mode.value === 0 && l.closeCombobox()));
1236
+ }
1237
+ function m() {
1238
+ var O;
1239
+ if (e.disabled || (O = l.virtual.value) != null && O.disabled(e.value)) return l.goToOption(B.Nothing);
1240
+ let D = l.calculateIndex(e.value);
1241
+ l.goToOption(B.Specific, D);
1242
+ }
1243
+ let w = Jn();
1244
+ function $(O) {
1245
+ w.update(O);
1246
+ }
1247
+ function M(O) {
1248
+ var D;
1249
+ if (!w.wasMoved(O) || e.disabled || (D = l.virtual.value) != null && D.disabled(e.value) || a.value) return;
1250
+ let A = l.calculateIndex(e.value);
1251
+ l.goToOption(B.Specific, A, 0);
1252
+ }
1253
+ function E(O) {
1254
+ var D;
1255
+ w.wasMoved(O) && (e.disabled || (D = l.virtual.value) != null && D.disabled(e.value) || a.value && (l.optionsPropsRef.value.hold || l.goToOption(B.Nothing)));
1256
+ }
1257
+ return () => {
1258
+ let { disabled: O } = e, D = { active: a.value, selected: u.value, disabled: O }, A = { id: r, ref: i, role: "option", tabIndex: O === !0 ? void 0 : -1, "aria-disabled": O === !0 ? !0 : void 0, "aria-selected": u.value, disabled: void 0, onMousedown: b, onFocus: m, onPointerenter: $, onMouseenter: $, onPointermove: M, onMousemove: M, onPointerleave: E, onMouseleave: E }, g = je(e, ["order", "value"]);
1259
+ return fe({ ourProps: A, theirProps: g, slot: D, attrs: t, slots: o, name: "ComboboxOption" });
1260
+ };
1261
+ } });
1262
+ function ho(e, o) {
1263
+ return P(), V("svg", {
1264
+ xmlns: "http://www.w3.org/2000/svg",
1265
+ viewBox: "0 0 20 20",
1266
+ fill: "currentColor",
1267
+ "aria-hidden": "true",
1268
+ "data-slot": "icon"
1269
+ }, [
1270
+ I("path", {
1271
+ "fill-rule": "evenodd",
1272
+ d: "M10.53 3.47a.75.75 0 0 0-1.06 0L6.22 6.72a.75.75 0 0 0 1.06 1.06L10 5.06l2.72 2.72a.75.75 0 1 0 1.06-1.06l-3.25-3.25Zm-4.31 9.81 3.25 3.25a.75.75 0 0 0 1.06 0l3.25-3.25a.75.75 0 1 0-1.06-1.06L10 14.94l-2.72-2.72a.75.75 0 0 0-1.06 1.06Z",
1273
+ "clip-rule": "evenodd"
1274
+ })
1275
+ ]);
1276
+ }
1277
+ const ht = {
1278
+ __name: "Select",
1279
+ props: /* @__PURE__ */ un({
1280
+ languages: {
1281
+ type: Object,
1282
+ required: !0
1283
+ }
1284
+ }, {
1285
+ modelValue: {},
1286
+ modelModifiers: {}
1287
+ }),
1288
+ emits: ["update:modelValue"],
1289
+ setup(e) {
1290
+ const o = e, t = cn(e, "modelValue"), n = S(""), l = S(null), r = _(() => Object.entries(o.languages).filter(
1291
+ ([, s]) => s.toLowerCase().includes(n.value.toLowerCase())
1292
+ )), i = (s) => {
1293
+ s.target.value = "", n.value = "", l.value && l.value.$el.click();
1294
+ };
1295
+ return (s, a) => (P(), xe(R(uo), {
1296
+ modelValue: t.value,
1297
+ "onUpdate:modelValue": a[2] || (a[2] = (u) => t.value = u),
1298
+ as: "div",
1299
+ class: "relative mt-1"
1300
+ }, {
1301
+ default: Pe(() => [
1302
+ H(R(fo), {
1303
+ class: "w-full border border-gray-300 rounded-md py-2 pl-3 pr-10 text-sm leading-5 focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",
1304
+ onChange: a[0] || (a[0] = (u) => n.value = u.target.value),
1305
+ displayValue: (u) => e.languages[u],
1306
+ onFocus: a[1] || (a[1] = (u) => i(u))
1307
+ }, null, 8, ["displayValue"]),
1308
+ H(R(co), {
1309
+ ref_key: "btnSelect",
1310
+ ref: l,
1311
+ class: "absolute inset-y-0 right-0 flex items-center pr-2"
1312
+ }, {
1313
+ default: Pe(() => [
1314
+ H(R(ho), {
1315
+ class: "h-5 w-5 text-gray-400",
1316
+ "aria-hidden": "true"
1317
+ })
1318
+ ]),
1319
+ _: 1
1320
+ }, 512),
1321
+ H(R(vo), { class: "absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm z-50" }, {
1322
+ default: Pe(() => [
1323
+ (P(!0), V(X, null, ge(r.value, ([u, v]) => (P(), xe(R(po), {
1324
+ key: u,
1325
+ value: u
1326
+ }, {
1327
+ default: Pe(({ active: c, selected: b }) => [
1328
+ I("li", {
1329
+ class: it([
1330
+ "relative cursor-default select-none py-2 pl-3 pr-9",
1331
+ c ? "bg-[#3B5695] text-white" : "text-gray-900"
1332
+ ])
1333
+ }, [
1334
+ I("span", {
1335
+ class: it(["block truncate", b && "font-semibold"])
1336
+ }, ne(v), 3)
1337
+ ], 2)
1338
+ ]),
1339
+ _: 2
1340
+ }, 1032, ["value"]))), 128))
1341
+ ]),
1342
+ _: 1
1343
+ })
1344
+ ]),
1345
+ _: 1
1346
+ }, 8, ["modelValue"]));
1347
+ }
1348
+ }, mo = { key: 0 }, go = /* @__PURE__ */ I("svg", {
96
1349
  xmlns: "http://www.w3.org/2000/svg",
97
1350
  class: "h-6 w-6",
98
1351
  fill: "none",
99
1352
  viewBox: "0 0 24 24",
100
1353
  stroke: "currentColor"
101
- };
102
- const _hoisted_4$8 = /* @__PURE__ */ createElementVNode("path", {
103
- "stroke-linecap": "round",
104
- "stroke-linejoin": "round",
105
- "stroke-width": "2",
106
- d: "M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"
107
- }, null, -1);
108
- const _hoisted_5$7 = [
109
- _hoisted_4$8
110
- ];
111
- const _hoisted_6$5 = {
112
- key: 1,
1354
+ }, [
1355
+ /* @__PURE__ */ I("path", {
1356
+ "stroke-linecap": "round",
1357
+ "stroke-linejoin": "round",
1358
+ "stroke-width": "2",
1359
+ d: "M13 7l5 5m0 0l-5 5m5-5H6"
1360
+ })
1361
+ ], -1), bo = [
1362
+ go
1363
+ ], yo = /* @__PURE__ */ I("svg", {
113
1364
  xmlns: "http://www.w3.org/2000/svg",
114
1365
  class: "h-6 w-6",
115
1366
  fill: "none",
116
1367
  viewBox: "0 0 24 24",
117
1368
  stroke: "currentColor"
1369
+ }, [
1370
+ /* @__PURE__ */ I("path", {
1371
+ "stroke-linecap": "round",
1372
+ "stroke-linejoin": "round",
1373
+ "stroke-width": "2",
1374
+ d: "M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"
1375
+ })
1376
+ ], -1), _o = [
1377
+ yo
1378
+ ], wo = {
1379
+ __name: "SwapBtn",
1380
+ props: {
1381
+ isBidirect: {
1382
+ type: Boolean,
1383
+ default: !1
1384
+ }
1385
+ },
1386
+ emits: ["swap"],
1387
+ setup(e, { emit: o }) {
1388
+ const t = o;
1389
+ return (n, l) => e.isBidirect ? (P(), V("button", {
1390
+ key: 1,
1391
+ onClick: l[0] || (l[0] = (r) => t("swap"))
1392
+ }, _o)) : (P(), V("button", mo, bo));
1393
+ }
118
1394
  };
119
- const _hoisted_7$3 = /* @__PURE__ */ createElementVNode("path", {
120
- "stroke-linecap": "round",
121
- "stroke-linejoin": "round",
122
- "stroke-width": "2",
123
- d: "M13 7l5 5m0 0l-5 5m5-5H6"
124
- }, null, -1);
125
- const _hoisted_8$2 = [
126
- _hoisted_7$3
127
- ];
128
- const _hoisted_9$2 = ["value"];
129
- const _hoisted_10$2 = {
130
- key: 1,
131
- class: "flex flex-row"
132
- };
133
- const _hoisted_11$2 = { class: "grow" };
134
- const _hoisted_12$2 = ["onClick"];
135
- const _hoisted_13$1 = { class: "grow" };
136
- const _hoisted_14$1 = ["onClick"];
137
- function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
138
- return openBlock(), createElementBlock(Fragment, null, [
139
- $props.select ? (openBlock(), createElementBlock("div", _hoisted_1$8, [
140
- withDirectives(createElementVNode("select", {
141
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.src = $event),
142
- class: "select select-bordered grow",
143
- onChange: _cache[1] || (_cache[1] = (...args) => $options.onSelect && $options.onSelect(...args))
144
- }, [
145
- (openBlock(true), createElementBlock(Fragment, null, renderList($props.select.srcs, (value, key) => {
146
- return openBlock(), createElementBlock("option", {
147
- value: key,
148
- key
149
- }, toDisplayString(value), 9, _hoisted_2$8);
150
- }), 128))
151
- ], 544), [
152
- [vModelSelect, $data.src]
153
- ]),
154
- createElementVNode("button", {
155
- class: "grow-0 ml-2 mr-2",
156
- onClick: _cache[2] || (_cache[2] = (...args) => $options.swap && $options.swap(...args))
157
- }, [
158
- $data.src != "auto" ? (openBlock(), createElementBlock("svg", _hoisted_3$8, _hoisted_5$7)) : createCommentVNode("", true),
159
- $data.src == "auto" ? (openBlock(), createElementBlock("svg", _hoisted_6$5, _hoisted_8$2)) : createCommentVNode("", true)
160
- ]),
161
- withDirectives(createElementVNode("select", {
162
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.target = $event),
163
- class: "select select-bordered grow",
164
- onChange: _cache[4] || (_cache[4] = (...args) => $options.onSelect && $options.onSelect(...args))
165
- }, [
166
- (openBlock(true), createElementBlock(Fragment, null, renderList($props.select.targets, (value, key) => {
167
- return openBlock(), createElementBlock("option", {
168
- value: key,
169
- key
170
- }, toDisplayString(value), 9, _hoisted_9$2);
171
- }), 128))
172
- ], 544), [
173
- [vModelSelect, $data.target]
174
- ])
175
- ])) : createCommentVNode("", true),
176
- $props.select && $data.src && $data.target && $data.recents ? (openBlock(), createElementBlock("div", _hoisted_10$2, [
177
- createElementVNode("div", _hoisted_11$2, [
178
- (openBlock(true), createElementBlock(Fragment, null, renderList($data.recents.src, (src) => {
179
- return openBlock(), createElementBlock("span", {
180
- key: src,
181
- onClick: ($event) => $options.onRecentSrc(src),
182
- class: "badge badge-sm ml-1 badge-outline"
183
- }, toDisplayString($props.select.srcs[src]), 9, _hoisted_12$2);
184
- }), 128))
185
- ]),
186
- createElementVNode("div", _hoisted_13$1, [
187
- (openBlock(true), createElementBlock(Fragment, null, renderList($data.recents.target, (target) => {
188
- return openBlock(), createElementBlock("span", {
189
- key: target,
190
- onClick: ($event) => $options.onRecentTarget(target),
191
- class: "badge badge-sm ml-1 float-right mt-1"
192
- }, toDisplayString($props.select.targets[target]), 9, _hoisted_14$1);
193
- }), 128))
194
- ])
195
- ])) : createCommentVNode("", true)
196
- ], 64);
1395
+ var Ut = !1;
1396
+ function ke(e, o, t) {
1397
+ return Array.isArray(e) ? (e.length = Math.max(e.length, o), e.splice(o, 1, t), t) : (e[o] = t, t);
197
1398
  }
198
- var Selects = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$7]]);
199
- var config = {
200
- INPUT_MAX_LENGTH: 5e3,
201
- INPUT_DELAY: 1e3
202
- };
203
- var textarea = {
204
- init,
205
- autoResize
206
- };
207
- const MIN_HEIGHT = 100;
208
- const MAX_HEIGHT = 600;
209
- const PADDING = 10;
210
- function init(el, max_length) {
211
- if (max_length) {
212
- el.maxlength = max_length;
213
- }
214
- el.spellcheck = false;
215
- setHeigtht(el, MIN_HEIGHT);
216
- }
217
- function autoResize(el) {
218
- if (el.value == "") {
219
- setHeigtht(el, MIN_HEIGHT);
1399
+ function We(e, o) {
1400
+ if (Array.isArray(e)) {
1401
+ e.splice(o, 1);
220
1402
  return;
221
1403
  }
222
- if (el.scrollHeight < MIN_HEIGHT) {
223
- setHeigtht(el, MIN_HEIGHT);
224
- return;
1404
+ delete e[o];
1405
+ }
1406
+ function xo() {
1407
+ return Ht().__VUE_DEVTOOLS_GLOBAL_HOOK__;
1408
+ }
1409
+ function Ht() {
1410
+ return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
1411
+ }
1412
+ const So = typeof Proxy == "function", Oo = "devtools-plugin:setup", Eo = "plugin:settings:set";
1413
+ let pe, Ge;
1414
+ function Io() {
1415
+ var e;
1416
+ return pe !== void 0 || (typeof window < "u" && window.performance ? (pe = !0, Ge = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (pe = !0, Ge = globalThis.perf_hooks.performance) : pe = !1), pe;
1417
+ }
1418
+ function $o() {
1419
+ return Io() ? Ge.now() : Date.now();
1420
+ }
1421
+ class Co {
1422
+ constructor(o, t) {
1423
+ this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = o, this.hook = t;
1424
+ const n = {};
1425
+ if (o.settings)
1426
+ for (const i in o.settings) {
1427
+ const s = o.settings[i];
1428
+ n[i] = s.defaultValue;
1429
+ }
1430
+ const l = `__vue-devtools-plugin-settings__${o.id}`;
1431
+ let r = Object.assign({}, n);
1432
+ try {
1433
+ const i = localStorage.getItem(l), s = JSON.parse(i);
1434
+ Object.assign(r, s);
1435
+ } catch {
1436
+ }
1437
+ this.fallbacks = {
1438
+ getSettings() {
1439
+ return r;
1440
+ },
1441
+ setSettings(i) {
1442
+ try {
1443
+ localStorage.setItem(l, JSON.stringify(i));
1444
+ } catch {
1445
+ }
1446
+ r = i;
1447
+ },
1448
+ now() {
1449
+ return $o();
1450
+ }
1451
+ }, t && t.on(Eo, (i, s) => {
1452
+ i === this.plugin.id && this.fallbacks.setSettings(s);
1453
+ }), this.proxiedOn = new Proxy({}, {
1454
+ get: (i, s) => this.target ? this.target.on[s] : (...a) => {
1455
+ this.onQueue.push({
1456
+ method: s,
1457
+ args: a
1458
+ });
1459
+ }
1460
+ }), this.proxiedTarget = new Proxy({}, {
1461
+ get: (i, s) => this.target ? this.target[s] : s === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(s) ? (...a) => (this.targetQueue.push({
1462
+ method: s,
1463
+ args: a,
1464
+ resolve: () => {
1465
+ }
1466
+ }), this.fallbacks[s](...a)) : (...a) => new Promise((u) => {
1467
+ this.targetQueue.push({
1468
+ method: s,
1469
+ args: a,
1470
+ resolve: u
1471
+ });
1472
+ })
1473
+ });
225
1474
  }
226
- if (el.scrollHeight > MAX_HEIGHT) {
227
- setHeigtht(el, MAX_HEIGHT);
228
- return;
1475
+ async setRealTarget(o) {
1476
+ this.target = o;
1477
+ for (const t of this.onQueue)
1478
+ this.target.on[t.method](...t.args);
1479
+ for (const t of this.targetQueue)
1480
+ t.resolve(await this.target[t.method](...t.args));
1481
+ }
1482
+ }
1483
+ function Wt(e, o) {
1484
+ const t = e, n = Ht(), l = xo(), r = So && t.enableEarlyProxy;
1485
+ if (l && (n.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !r))
1486
+ l.emit(Oo, e, o);
1487
+ else {
1488
+ const i = r ? new Co(t, l) : null;
1489
+ (n.__VUE_DEVTOOLS_PLUGINS__ = n.__VUE_DEVTOOLS_PLUGINS__ || []).push({
1490
+ pluginDescriptor: t,
1491
+ setupFn: o,
1492
+ proxy: i
1493
+ }), i && o(i.proxiedTarget);
1494
+ }
1495
+ }
1496
+ /*!
1497
+ * pinia v2.1.7
1498
+ * (c) 2023 Eduardo San Martin Morote
1499
+ * @license MIT
1500
+ */
1501
+ let we;
1502
+ const $e = (e) => we = e, Gt = process.env.NODE_ENV !== "production" ? Symbol("pinia") : (
1503
+ /* istanbul ignore next */
1504
+ Symbol()
1505
+ );
1506
+ function ce(e) {
1507
+ return e && typeof e == "object" && Object.prototype.toString.call(e) === "[object Object]" && typeof e.toJSON != "function";
1508
+ }
1509
+ var Z;
1510
+ (function(e) {
1511
+ e.direct = "direct", e.patchObject = "patch object", e.patchFunction = "patch function";
1512
+ })(Z || (Z = {}));
1513
+ const Fe = typeof window < "u", Se = (process.env.NODE_ENV !== "production" || !1) && process.env.NODE_ENV !== "test" && Fe, mt = typeof window == "object" && window.window === window ? window : typeof self == "object" && self.self === self ? self : typeof global == "object" && global.global === global ? global : typeof globalThis == "object" ? globalThis : { HTMLElement: null };
1514
+ function To(e, { autoBom: o = !1 } = {}) {
1515
+ return o && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type) ? new Blob(["\uFEFF", e], { type: e.type }) : e;
1516
+ }
1517
+ function nt(e, o, t) {
1518
+ const n = new XMLHttpRequest();
1519
+ n.open("GET", e), n.responseType = "blob", n.onload = function() {
1520
+ Kt(n.response, o, t);
1521
+ }, n.onerror = function() {
1522
+ console.error("could not download file");
1523
+ }, n.send();
1524
+ }
1525
+ function qt(e) {
1526
+ const o = new XMLHttpRequest();
1527
+ o.open("HEAD", e, !1);
1528
+ try {
1529
+ o.send();
1530
+ } catch {
1531
+ }
1532
+ return o.status >= 200 && o.status <= 299;
1533
+ }
1534
+ function Ne(e) {
1535
+ try {
1536
+ e.dispatchEvent(new MouseEvent("click"));
1537
+ } catch {
1538
+ const t = document.createEvent("MouseEvents");
1539
+ t.initMouseEvent("click", !0, !0, window, 0, 0, 0, 80, 20, !1, !1, !1, !1, 0, null), e.dispatchEvent(t);
1540
+ }
1541
+ }
1542
+ const Ve = typeof navigator == "object" ? navigator : { userAgent: "" }, Jt = /Macintosh/.test(Ve.userAgent) && /AppleWebKit/.test(Ve.userAgent) && !/Safari/.test(Ve.userAgent), Kt = Fe ? (
1543
+ // Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView or mini program
1544
+ typeof HTMLAnchorElement < "u" && "download" in HTMLAnchorElement.prototype && !Jt ? Po : (
1545
+ // Use msSaveOrOpenBlob as a second approach
1546
+ "msSaveOrOpenBlob" in Ve ? Ro : (
1547
+ // Fallback to using FileReader and a popup
1548
+ ko
1549
+ )
1550
+ )
1551
+ ) : () => {
1552
+ };
1553
+ function Po(e, o = "download", t) {
1554
+ const n = document.createElement("a");
1555
+ n.download = o, n.rel = "noopener", typeof e == "string" ? (n.href = e, n.origin !== location.origin ? qt(n.href) ? nt(e, o, t) : (n.target = "_blank", Ne(n)) : Ne(n)) : (n.href = URL.createObjectURL(e), setTimeout(function() {
1556
+ URL.revokeObjectURL(n.href);
1557
+ }, 4e4), setTimeout(function() {
1558
+ Ne(n);
1559
+ }, 0));
1560
+ }
1561
+ function Ro(e, o = "download", t) {
1562
+ if (typeof e == "string")
1563
+ if (qt(e))
1564
+ nt(e, o, t);
1565
+ else {
1566
+ const n = document.createElement("a");
1567
+ n.href = e, n.target = "_blank", setTimeout(function() {
1568
+ Ne(n);
1569
+ });
1570
+ }
1571
+ else
1572
+ navigator.msSaveOrOpenBlob(To(e, t), o);
1573
+ }
1574
+ function ko(e, o, t, n) {
1575
+ if (n = n || open("", "_blank"), n && (n.document.title = n.document.body.innerText = "downloading..."), typeof e == "string")
1576
+ return nt(e, o, t);
1577
+ const l = e.type === "application/octet-stream", r = /constructor/i.test(String(mt.HTMLElement)) || "safari" in mt, i = /CriOS\/[\d]+/.test(navigator.userAgent);
1578
+ if ((i || l && r || Jt) && typeof FileReader < "u") {
1579
+ const s = new FileReader();
1580
+ s.onloadend = function() {
1581
+ let a = s.result;
1582
+ if (typeof a != "string")
1583
+ throw n = null, new Error("Wrong reader.result type");
1584
+ a = i ? a : a.replace(/^data:[^;]*;/, "data:attachment/file;"), n ? n.location.href = a : location.assign(a), n = null;
1585
+ }, s.readAsDataURL(e);
1586
+ } else {
1587
+ const s = URL.createObjectURL(e);
1588
+ n ? n.location.assign(s) : location.href = s, n = null, setTimeout(function() {
1589
+ URL.revokeObjectURL(s);
1590
+ }, 4e4);
1591
+ }
1592
+ }
1593
+ function z(e, o) {
1594
+ const t = "🍍 " + e;
1595
+ typeof __VUE_DEVTOOLS_TOAST__ == "function" ? __VUE_DEVTOOLS_TOAST__(t, o) : o === "error" ? console.error(t) : o === "warn" ? console.warn(t) : console.log(t);
1596
+ }
1597
+ function ot(e) {
1598
+ return "_a" in e && "install" in e;
1599
+ }
1600
+ function Yt() {
1601
+ if (!("clipboard" in navigator))
1602
+ return z("Your browser doesn't support the Clipboard API", "error"), !0;
1603
+ }
1604
+ function Qt(e) {
1605
+ return e instanceof Error && e.message.toLowerCase().includes("document is not focused") ? (z('You need to activate the "Emulate a focused page" setting in the "Rendering" panel of devtools.', "warn"), !0) : !1;
1606
+ }
1607
+ async function No(e) {
1608
+ if (!Yt())
1609
+ try {
1610
+ await navigator.clipboard.writeText(JSON.stringify(e.state.value)), z("Global state copied to clipboard.");
1611
+ } catch (o) {
1612
+ if (Qt(o))
1613
+ return;
1614
+ z("Failed to serialize the state. Check the console for more details.", "error"), console.error(o);
1615
+ }
1616
+ }
1617
+ async function Vo(e) {
1618
+ if (!Yt())
1619
+ try {
1620
+ Zt(e, JSON.parse(await navigator.clipboard.readText())), z("Global state pasted from clipboard.");
1621
+ } catch (o) {
1622
+ if (Qt(o))
1623
+ return;
1624
+ z("Failed to deserialize the state from clipboard. Check the console for more details.", "error"), console.error(o);
1625
+ }
1626
+ }
1627
+ async function Do(e) {
1628
+ try {
1629
+ Kt(new Blob([JSON.stringify(e.state.value)], {
1630
+ type: "text/plain;charset=utf-8"
1631
+ }), "pinia-state.json");
1632
+ } catch (o) {
1633
+ z("Failed to export the state as JSON. Check the console for more details.", "error"), console.error(o);
1634
+ }
1635
+ }
1636
+ let ee;
1637
+ function Lo() {
1638
+ ee || (ee = document.createElement("input"), ee.type = "file", ee.accept = ".json");
1639
+ function e() {
1640
+ return new Promise((o, t) => {
1641
+ ee.onchange = async () => {
1642
+ const n = ee.files;
1643
+ if (!n)
1644
+ return o(null);
1645
+ const l = n.item(0);
1646
+ return o(l ? { text: await l.text(), file: l } : null);
1647
+ }, ee.oncancel = () => o(null), ee.onerror = t, ee.click();
1648
+ });
1649
+ }
1650
+ return e;
1651
+ }
1652
+ async function Mo(e) {
1653
+ try {
1654
+ const t = await Lo()();
1655
+ if (!t)
1656
+ return;
1657
+ const { text: n, file: l } = t;
1658
+ Zt(e, JSON.parse(n)), z(`Global state imported from "${l.name}".`);
1659
+ } catch (o) {
1660
+ z("Failed to import the state from JSON. Check the console for more details.", "error"), console.error(o);
1661
+ }
1662
+ }
1663
+ function Zt(e, o) {
1664
+ for (const t in o) {
1665
+ const n = e.state.value[t];
1666
+ n ? Object.assign(n, o[t]) : e.state.value[t] = o[t];
1667
+ }
1668
+ }
1669
+ function Y(e) {
1670
+ return {
1671
+ _custom: {
1672
+ display: e
1673
+ }
1674
+ };
1675
+ }
1676
+ const Xt = "🍍 Pinia (root)", qe = "_root";
1677
+ function Ao(e) {
1678
+ return ot(e) ? {
1679
+ id: qe,
1680
+ label: Xt
1681
+ } : {
1682
+ id: e.$id,
1683
+ label: e.$id
1684
+ };
1685
+ }
1686
+ function jo(e) {
1687
+ if (ot(e)) {
1688
+ const t = Array.from(e._s.keys()), n = e._s;
1689
+ return {
1690
+ state: t.map((r) => ({
1691
+ editable: !0,
1692
+ key: r,
1693
+ value: e.state.value[r]
1694
+ })),
1695
+ getters: t.filter((r) => n.get(r)._getters).map((r) => {
1696
+ const i = n.get(r);
1697
+ return {
1698
+ editable: !1,
1699
+ key: r,
1700
+ value: i._getters.reduce((s, a) => (s[a] = i[a], s), {})
1701
+ };
1702
+ })
1703
+ };
1704
+ }
1705
+ const o = {
1706
+ state: Object.keys(e.$state).map((t) => ({
1707
+ editable: !0,
1708
+ key: t,
1709
+ value: e.$state[t]
1710
+ }))
1711
+ };
1712
+ return e._getters && e._getters.length && (o.getters = e._getters.map((t) => ({
1713
+ editable: !1,
1714
+ key: t,
1715
+ value: e[t]
1716
+ }))), e._customProperties.size && (o.customProperties = Array.from(e._customProperties).map((t) => ({
1717
+ editable: !0,
1718
+ key: t,
1719
+ value: e[t]
1720
+ }))), o;
1721
+ }
1722
+ function Fo(e) {
1723
+ return e ? Array.isArray(e) ? e.reduce((o, t) => (o.keys.push(t.key), o.operations.push(t.type), o.oldValue[t.key] = t.oldValue, o.newValue[t.key] = t.newValue, o), {
1724
+ oldValue: {},
1725
+ keys: [],
1726
+ operations: [],
1727
+ newValue: {}
1728
+ }) : {
1729
+ operation: Y(e.type),
1730
+ key: Y(e.key),
1731
+ oldValue: e.oldValue,
1732
+ newValue: e.newValue
1733
+ } : {};
1734
+ }
1735
+ function zo(e) {
1736
+ switch (e) {
1737
+ case Z.direct:
1738
+ return "mutation";
1739
+ case Z.patchFunction:
1740
+ return "$patch";
1741
+ case Z.patchObject:
1742
+ return "$patch";
1743
+ default:
1744
+ return "unknown";
229
1745
  }
230
- const el_height = el.style.height.replace("px", "");
231
- if (el_height > el.scrollHeight) {
1746
+ }
1747
+ let me = !0;
1748
+ const De = [], re = "pinia:mutations", U = "pinia", { assign: Bo } = Object, Me = (e) => "🍍 " + e;
1749
+ function Uo(e, o) {
1750
+ Wt({
1751
+ id: "dev.esm.pinia",
1752
+ label: "Pinia 🍍",
1753
+ logo: "https://pinia.vuejs.org/logo.svg",
1754
+ packageName: "pinia",
1755
+ homepage: "https://pinia.vuejs.org",
1756
+ componentStateTypes: De,
1757
+ app: e
1758
+ }, (t) => {
1759
+ typeof t.now != "function" && z("You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html."), t.addTimelineLayer({
1760
+ id: re,
1761
+ label: "Pinia 🍍",
1762
+ color: 15064968
1763
+ }), t.addInspector({
1764
+ id: U,
1765
+ label: "Pinia 🍍",
1766
+ icon: "storage",
1767
+ treeFilterPlaceholder: "Search stores",
1768
+ actions: [
1769
+ {
1770
+ icon: "content_copy",
1771
+ action: () => {
1772
+ No(o);
1773
+ },
1774
+ tooltip: "Serialize and copy the state"
1775
+ },
1776
+ {
1777
+ icon: "content_paste",
1778
+ action: async () => {
1779
+ await Vo(o), t.sendInspectorTree(U), t.sendInspectorState(U);
1780
+ },
1781
+ tooltip: "Replace the state with the content of your clipboard"
1782
+ },
1783
+ {
1784
+ icon: "save",
1785
+ action: () => {
1786
+ Do(o);
1787
+ },
1788
+ tooltip: "Save the state as a JSON file"
1789
+ },
1790
+ {
1791
+ icon: "folder_open",
1792
+ action: async () => {
1793
+ await Mo(o), t.sendInspectorTree(U), t.sendInspectorState(U);
1794
+ },
1795
+ tooltip: "Import the state from a JSON file"
1796
+ }
1797
+ ],
1798
+ nodeActions: [
1799
+ {
1800
+ icon: "restore",
1801
+ tooltip: 'Reset the state (with "$reset")',
1802
+ action: (n) => {
1803
+ const l = o._s.get(n);
1804
+ l ? typeof l.$reset != "function" ? z(`Cannot reset "${n}" store because it doesn't have a "$reset" method implemented.`, "warn") : (l.$reset(), z(`Store "${n}" reset.`)) : z(`Cannot reset "${n}" store because it wasn't found.`, "warn");
1805
+ }
1806
+ }
1807
+ ]
1808
+ }), t.on.inspectComponent((n, l) => {
1809
+ const r = n.componentInstance && n.componentInstance.proxy;
1810
+ if (r && r._pStores) {
1811
+ const i = n.componentInstance.proxy._pStores;
1812
+ Object.values(i).forEach((s) => {
1813
+ n.instanceData.state.push({
1814
+ type: Me(s.$id),
1815
+ key: "state",
1816
+ editable: !0,
1817
+ value: s._isOptionsAPI ? {
1818
+ _custom: {
1819
+ value: K(s.$state),
1820
+ actions: [
1821
+ {
1822
+ icon: "restore",
1823
+ tooltip: "Reset the state of this store",
1824
+ action: () => s.$reset()
1825
+ }
1826
+ ]
1827
+ }
1828
+ } : (
1829
+ // NOTE: workaround to unwrap transferred refs
1830
+ Object.keys(s.$state).reduce((a, u) => (a[u] = s.$state[u], a), {})
1831
+ )
1832
+ }), s._getters && s._getters.length && n.instanceData.state.push({
1833
+ type: Me(s.$id),
1834
+ key: "getters",
1835
+ editable: !1,
1836
+ value: s._getters.reduce((a, u) => {
1837
+ try {
1838
+ a[u] = s[u];
1839
+ } catch (v) {
1840
+ a[u] = v;
1841
+ }
1842
+ return a;
1843
+ }, {})
1844
+ });
1845
+ });
1846
+ }
1847
+ }), t.on.getInspectorTree((n) => {
1848
+ if (n.app === e && n.inspectorId === U) {
1849
+ let l = [o];
1850
+ l = l.concat(Array.from(o._s.values())), n.rootNodes = (n.filter ? l.filter((r) => "$id" in r ? r.$id.toLowerCase().includes(n.filter.toLowerCase()) : Xt.toLowerCase().includes(n.filter.toLowerCase())) : l).map(Ao);
1851
+ }
1852
+ }), t.on.getInspectorState((n) => {
1853
+ if (n.app === e && n.inspectorId === U) {
1854
+ const l = n.nodeId === qe ? o : o._s.get(n.nodeId);
1855
+ if (!l)
1856
+ return;
1857
+ l && (n.state = jo(l));
1858
+ }
1859
+ }), t.on.editInspectorState((n, l) => {
1860
+ if (n.app === e && n.inspectorId === U) {
1861
+ const r = n.nodeId === qe ? o : o._s.get(n.nodeId);
1862
+ if (!r)
1863
+ return z(`store "${n.nodeId}" not found`, "error");
1864
+ const { path: i } = n;
1865
+ ot(r) ? i.unshift("state") : (i.length !== 1 || !r._customProperties.has(i[0]) || i[0] in r.$state) && i.unshift("$state"), me = !1, n.set(r, i, n.state.value), me = !0;
1866
+ }
1867
+ }), t.on.editComponentState((n) => {
1868
+ if (n.type.startsWith("🍍")) {
1869
+ const l = n.type.replace(/^🍍\s*/, ""), r = o._s.get(l);
1870
+ if (!r)
1871
+ return z(`store "${l}" not found`, "error");
1872
+ const { path: i } = n;
1873
+ if (i[0] !== "state")
1874
+ return z(`Invalid path for store "${l}":
1875
+ ${i}
1876
+ Only state can be modified.`);
1877
+ i[0] = "$state", me = !1, n.set(r, i, n.state.value), me = !0;
1878
+ }
1879
+ });
1880
+ });
1881
+ }
1882
+ function Ho(e, o) {
1883
+ De.includes(Me(o.$id)) || De.push(Me(o.$id)), Wt({
1884
+ id: "dev.esm.pinia",
1885
+ label: "Pinia 🍍",
1886
+ logo: "https://pinia.vuejs.org/logo.svg",
1887
+ packageName: "pinia",
1888
+ homepage: "https://pinia.vuejs.org",
1889
+ componentStateTypes: De,
1890
+ app: e,
1891
+ settings: {
1892
+ logStoreChanges: {
1893
+ label: "Notify about new/deleted stores",
1894
+ type: "boolean",
1895
+ defaultValue: !0
1896
+ }
1897
+ // useEmojis: {
1898
+ // label: 'Use emojis in messages ⚡️',
1899
+ // type: 'boolean',
1900
+ // defaultValue: true,
1901
+ // },
1902
+ }
1903
+ }, (t) => {
1904
+ const n = typeof t.now == "function" ? t.now.bind(t) : Date.now;
1905
+ o.$onAction(({ after: i, onError: s, name: a, args: u }) => {
1906
+ const v = en++;
1907
+ t.addTimelineEvent({
1908
+ layerId: re,
1909
+ event: {
1910
+ time: n(),
1911
+ title: "🛫 " + a,
1912
+ subtitle: "start",
1913
+ data: {
1914
+ store: Y(o.$id),
1915
+ action: Y(a),
1916
+ args: u
1917
+ },
1918
+ groupId: v
1919
+ }
1920
+ }), i((c) => {
1921
+ oe = void 0, t.addTimelineEvent({
1922
+ layerId: re,
1923
+ event: {
1924
+ time: n(),
1925
+ title: "🛬 " + a,
1926
+ subtitle: "end",
1927
+ data: {
1928
+ store: Y(o.$id),
1929
+ action: Y(a),
1930
+ args: u,
1931
+ result: c
1932
+ },
1933
+ groupId: v
1934
+ }
1935
+ });
1936
+ }), s((c) => {
1937
+ oe = void 0, t.addTimelineEvent({
1938
+ layerId: re,
1939
+ event: {
1940
+ time: n(),
1941
+ logType: "error",
1942
+ title: "💥 " + a,
1943
+ subtitle: "end",
1944
+ data: {
1945
+ store: Y(o.$id),
1946
+ action: Y(a),
1947
+ args: u,
1948
+ error: c
1949
+ },
1950
+ groupId: v
1951
+ }
1952
+ });
1953
+ });
1954
+ }, !0), o._customProperties.forEach((i) => {
1955
+ j(() => R(o[i]), (s, a) => {
1956
+ t.notifyComponentUpdate(), t.sendInspectorState(U), me && t.addTimelineEvent({
1957
+ layerId: re,
1958
+ event: {
1959
+ time: n(),
1960
+ title: "Change",
1961
+ subtitle: i,
1962
+ data: {
1963
+ newValue: s,
1964
+ oldValue: a
1965
+ },
1966
+ groupId: oe
1967
+ }
1968
+ });
1969
+ }, { deep: !0 });
1970
+ }), o.$subscribe(({ events: i, type: s }, a) => {
1971
+ if (t.notifyComponentUpdate(), t.sendInspectorState(U), !me)
1972
+ return;
1973
+ const u = {
1974
+ time: n(),
1975
+ title: zo(s),
1976
+ data: Bo({ store: Y(o.$id) }, Fo(i)),
1977
+ groupId: oe
1978
+ };
1979
+ s === Z.patchFunction ? u.subtitle = "⤵️" : s === Z.patchObject ? u.subtitle = "🧩" : i && !Array.isArray(i) && (u.subtitle = i.type), i && (u.data["rawEvent(s)"] = {
1980
+ _custom: {
1981
+ display: "DebuggerEvent",
1982
+ type: "object",
1983
+ tooltip: "raw DebuggerEvent[]",
1984
+ value: i
1985
+ }
1986
+ }), t.addTimelineEvent({
1987
+ layerId: re,
1988
+ event: u
1989
+ });
1990
+ }, { detached: !0, flush: "sync" });
1991
+ const l = o._hotUpdate;
1992
+ o._hotUpdate = ae((i) => {
1993
+ l(i), t.addTimelineEvent({
1994
+ layerId: re,
1995
+ event: {
1996
+ time: n(),
1997
+ title: "🔥 " + o.$id,
1998
+ subtitle: "HMR update",
1999
+ data: {
2000
+ store: Y(o.$id),
2001
+ info: Y("HMR update")
2002
+ }
2003
+ }
2004
+ }), t.notifyComponentUpdate(), t.sendInspectorTree(U), t.sendInspectorState(U);
2005
+ });
2006
+ const { $dispose: r } = o;
2007
+ o.$dispose = () => {
2008
+ r(), t.notifyComponentUpdate(), t.sendInspectorTree(U), t.sendInspectorState(U), t.getSettings().logStoreChanges && z(`Disposed "${o.$id}" store 🗑`);
2009
+ }, t.notifyComponentUpdate(), t.sendInspectorTree(U), t.sendInspectorState(U), t.getSettings().logStoreChanges && z(`"${o.$id}" store installed 🆕`);
2010
+ });
2011
+ }
2012
+ let en = 0, oe;
2013
+ function gt(e, o, t) {
2014
+ const n = o.reduce((l, r) => (l[r] = K(e)[r], l), {});
2015
+ for (const l in n)
2016
+ e[l] = function() {
2017
+ const r = en, i = t ? new Proxy(e, {
2018
+ get(...a) {
2019
+ return oe = r, Reflect.get(...a);
2020
+ },
2021
+ set(...a) {
2022
+ return oe = r, Reflect.set(...a);
2023
+ }
2024
+ }) : e;
2025
+ oe = r;
2026
+ const s = n[l].apply(i, arguments);
2027
+ return oe = void 0, s;
2028
+ };
2029
+ }
2030
+ function Wo({ app: e, store: o, options: t }) {
2031
+ if (o.$id.startsWith("__hot:"))
232
2032
  return;
2033
+ o._isOptionsAPI = !!t.state, gt(o, Object.keys(t.actions), o._isOptionsAPI);
2034
+ const n = o._hotUpdate;
2035
+ K(o)._hotUpdate = function(l) {
2036
+ n.apply(this, arguments), gt(o, Object.keys(l._hmrPayload.actions), !!o._isOptionsAPI);
2037
+ }, Ho(
2038
+ e,
2039
+ // FIXME: is there a way to allow the assignment from Store<Id, S, G, A> to StoreGeneric?
2040
+ o
2041
+ );
2042
+ }
2043
+ function Go() {
2044
+ const e = It(!0), o = e.run(() => S({}));
2045
+ let t = [], n = [];
2046
+ const l = ae({
2047
+ install(r) {
2048
+ $e(l), l._a = r, r.provide(Gt, l), r.config.globalProperties.$pinia = l, Se && Uo(r, l), n.forEach((i) => t.push(i)), n = [];
2049
+ },
2050
+ use(r) {
2051
+ return !this._a && !Ut ? n.push(r) : t.push(r), this;
2052
+ },
2053
+ _p: t,
2054
+ // it's actually undefined here
2055
+ // @ts-expect-error
2056
+ _a: null,
2057
+ _e: e,
2058
+ _s: /* @__PURE__ */ new Map(),
2059
+ state: o
2060
+ });
2061
+ return Se && typeof Proxy < "u" && l.use(Wo), l;
2062
+ }
2063
+ function tn(e, o) {
2064
+ for (const t in o) {
2065
+ const n = o[t];
2066
+ if (!(t in e))
2067
+ continue;
2068
+ const l = e[t];
2069
+ ce(l) && ce(n) && !be(n) && !Ze(n) ? e[t] = tn(l, n) : e[t] = n;
233
2070
  }
234
- setHeigtht(el, el.scrollHeight + PADDING);
2071
+ return e;
235
2072
  }
236
- function setHeigtht(el, height) {
237
- el.style.height = `${height}px`;
2073
+ const nn = () => {
2074
+ };
2075
+ function bt(e, o, t, n = nn) {
2076
+ e.push(o);
2077
+ const l = () => {
2078
+ const r = e.indexOf(o);
2079
+ r > -1 && (e.splice(r, 1), n());
2080
+ };
2081
+ return !t && Ct() && Ye(l), l;
238
2082
  }
239
- const LABEL_AUTO_TRANSLATE = "auto_translate";
240
- const _sfc_main$7 = {
241
- props: {
242
- data: {
243
- type: Object,
244
- default: null
2083
+ function he(e, ...o) {
2084
+ e.slice().forEach((t) => {
2085
+ t(...o);
2086
+ });
2087
+ }
2088
+ const qo = (e) => e();
2089
+ function Je(e, o) {
2090
+ e instanceof Map && o instanceof Map && o.forEach((t, n) => e.set(n, t)), e instanceof Set && o instanceof Set && o.forEach(e.add, e);
2091
+ for (const t in o) {
2092
+ if (!o.hasOwnProperty(t))
2093
+ continue;
2094
+ const n = o[t], l = e[t];
2095
+ ce(l) && ce(n) && e.hasOwnProperty(t) && !be(n) && !Ze(n) ? e[t] = Je(l, n) : e[t] = n;
2096
+ }
2097
+ return e;
2098
+ }
2099
+ const Jo = process.env.NODE_ENV !== "production" ? Symbol("pinia:skipHydration") : (
2100
+ /* istanbul ignore next */
2101
+ Symbol()
2102
+ );
2103
+ function Ko(e) {
2104
+ return !ce(e) || !e.hasOwnProperty(Jo);
2105
+ }
2106
+ const { assign: J } = Object;
2107
+ function yt(e) {
2108
+ return !!(be(e) && e.effect);
2109
+ }
2110
+ function _t(e, o, t, n) {
2111
+ const { state: l, actions: r, getters: i } = o, s = t.state.value[e];
2112
+ let a;
2113
+ function u() {
2114
+ !s && (process.env.NODE_ENV === "production" || !n) && (t.state.value[e] = l ? l() : {});
2115
+ const v = process.env.NODE_ENV !== "production" && n ? (
2116
+ // use ref() to unwrap refs inside state TODO: check if this is still necessary
2117
+ at(S(l ? l() : {}).value)
2118
+ ) : at(t.state.value[e]);
2119
+ return J(v, r, Object.keys(i || {}).reduce((c, b) => (process.env.NODE_ENV !== "production" && b in v && console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${b}" in store "${e}".`), c[b] = ae(_(() => {
2120
+ $e(t);
2121
+ const m = t._s.get(e);
2122
+ return i[b].call(m, m);
2123
+ })), c), {}));
2124
+ }
2125
+ return a = Ke(e, u, o, t, n, !0), a;
2126
+ }
2127
+ function Ke(e, o, t = {}, n, l, r) {
2128
+ let i;
2129
+ const s = J({ actions: {} }, t);
2130
+ if (process.env.NODE_ENV !== "production" && !n._e.active)
2131
+ throw new Error("Pinia destroyed");
2132
+ const a = {
2133
+ deep: !0
2134
+ // flush: 'post',
2135
+ };
2136
+ process.env.NODE_ENV !== "production" && !Ut && (a.onTrigger = (d) => {
2137
+ u ? m = d : u == !1 && !h._hotUpdating && (Array.isArray(m) ? m.push(d) : console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."));
2138
+ });
2139
+ let u, v, c = [], b = [], m;
2140
+ const w = n.state.value[e];
2141
+ !r && !w && (process.env.NODE_ENV === "production" || !l) && (n.state.value[e] = {});
2142
+ const $ = S({});
2143
+ let M;
2144
+ function E(d) {
2145
+ let f;
2146
+ u = v = !1, process.env.NODE_ENV !== "production" && (m = []), typeof d == "function" ? (d(n.state.value[e]), f = {
2147
+ type: Z.patchFunction,
2148
+ storeId: e,
2149
+ events: m
2150
+ }) : (Je(n.state.value[e], d), f = {
2151
+ type: Z.patchObject,
2152
+ payload: d,
2153
+ storeId: e,
2154
+ events: m
2155
+ });
2156
+ const y = M = Symbol();
2157
+ Q().then(() => {
2158
+ M === y && (u = !0);
2159
+ }), v = !0, he(c, f, n.state.value[e]);
2160
+ }
2161
+ const O = r ? function() {
2162
+ const { state: f } = t, y = f ? f() : {};
2163
+ this.$patch((x) => {
2164
+ J(x, y);
2165
+ });
2166
+ } : (
2167
+ /* istanbul ignore next */
2168
+ process.env.NODE_ENV !== "production" ? () => {
2169
+ throw new Error(`🍍: Store "${e}" is built using the setup syntax and does not implement $reset().`);
2170
+ } : nn
2171
+ );
2172
+ function D() {
2173
+ i.stop(), c = [], b = [], n._s.delete(e);
2174
+ }
2175
+ function A(d, f) {
2176
+ return function() {
2177
+ $e(n);
2178
+ const y = Array.from(arguments), x = [], N = [];
2179
+ function L(F) {
2180
+ x.push(F);
2181
+ }
2182
+ function G(F) {
2183
+ N.push(F);
2184
+ }
2185
+ he(b, {
2186
+ args: y,
2187
+ name: d,
2188
+ store: h,
2189
+ after: L,
2190
+ onError: G
2191
+ });
2192
+ let q;
2193
+ try {
2194
+ q = f.apply(this && this.$id === e ? this : h, y);
2195
+ } catch (F) {
2196
+ throw he(N, F), F;
2197
+ }
2198
+ return q instanceof Promise ? q.then((F) => (he(x, F), F)).catch((F) => (he(N, F), Promise.reject(F))) : (he(x, q), q);
2199
+ };
2200
+ }
2201
+ const g = /* @__PURE__ */ ae({
2202
+ actions: {},
2203
+ getters: {},
2204
+ state: [],
2205
+ hotState: $
2206
+ }), T = {
2207
+ _p: n,
2208
+ // _s: scope,
2209
+ $id: e,
2210
+ $onAction: bt.bind(null, b),
2211
+ $patch: E,
2212
+ $reset: O,
2213
+ $subscribe(d, f = {}) {
2214
+ const y = bt(c, d, f.detached, () => x()), x = i.run(() => j(() => n.state.value[e], (N) => {
2215
+ (f.flush === "sync" ? v : u) && d({
2216
+ storeId: e,
2217
+ type: Z.direct,
2218
+ events: m
2219
+ }, N);
2220
+ }, J({}, a, f)));
2221
+ return y;
245
2222
  },
246
- tts: {
247
- type: Object,
248
- default: null
2223
+ $dispose: D
2224
+ }, h = Et(process.env.NODE_ENV !== "production" || Se ? J(
2225
+ {
2226
+ _hmrPayload: g,
2227
+ _customProperties: ae(/* @__PURE__ */ new Set())
2228
+ // devtools custom properties
249
2229
  },
250
- replace: {
251
- type: String,
252
- default: ""
2230
+ T
2231
+ // must be added later
2232
+ // setupStore
2233
+ ) : T);
2234
+ n._s.set(e, h);
2235
+ const C = (n._a && n._a.runWithContext || qo)(() => n._e.run(() => (i = It()).run(o)));
2236
+ for (const d in C) {
2237
+ const f = C[d];
2238
+ if (be(f) && !yt(f) || Ze(f))
2239
+ process.env.NODE_ENV !== "production" && l ? ke($.value, d, Be(C, d)) : r || (w && Ko(f) && (be(f) ? f.value = w[d] : Je(f, w[d])), n.state.value[e][d] = f), process.env.NODE_ENV !== "production" && g.state.push(d);
2240
+ else if (typeof f == "function") {
2241
+ const y = process.env.NODE_ENV !== "production" && l ? f : A(d, f);
2242
+ C[d] = y, process.env.NODE_ENV !== "production" && (g.actions[d] = f), s.actions[d] = f;
2243
+ } else process.env.NODE_ENV !== "production" && yt(f) && (g.getters[d] = r ? (
2244
+ // @ts-expect-error
2245
+ t.getters[d]
2246
+ ) : f, Fe && (C._getters || // @ts-expect-error: same
2247
+ (C._getters = ae([]))).push(d));
2248
+ }
2249
+ if (J(h, C), J(K(h), C), Object.defineProperty(h, "$state", {
2250
+ get: () => process.env.NODE_ENV !== "production" && l ? $.value : n.state.value[e],
2251
+ set: (d) => {
2252
+ if (process.env.NODE_ENV !== "production" && l)
2253
+ throw new Error("cannot set hotState");
2254
+ E((f) => {
2255
+ J(f, d);
2256
+ });
2257
+ }
2258
+ }), process.env.NODE_ENV !== "production" && (h._hotUpdate = ae((d) => {
2259
+ h._hotUpdating = !0, d._hmrPayload.state.forEach((f) => {
2260
+ if (f in h.$state) {
2261
+ const y = d.$state[f], x = h.$state[f];
2262
+ typeof y == "object" && ce(y) && ce(x) ? tn(y, x) : d.$state[f] = x;
2263
+ }
2264
+ ke(h, f, Be(d.$state, f));
2265
+ }), Object.keys(h.$state).forEach((f) => {
2266
+ f in d.$state || We(h, f);
2267
+ }), u = !1, v = !1, n.state.value[e] = Be(d._hmrPayload, "hotState"), v = !0, Q().then(() => {
2268
+ u = !0;
2269
+ });
2270
+ for (const f in d._hmrPayload.actions) {
2271
+ const y = d[f];
2272
+ ke(h, f, A(f, y));
2273
+ }
2274
+ for (const f in d._hmrPayload.getters) {
2275
+ const y = d._hmrPayload.getters[f], x = r ? (
2276
+ // special handling of options api
2277
+ _(() => ($e(n), y.call(h, h)))
2278
+ ) : y;
2279
+ ke(h, f, x);
2280
+ }
2281
+ Object.keys(h._hmrPayload.getters).forEach((f) => {
2282
+ f in d._hmrPayload.getters || We(h, f);
2283
+ }), Object.keys(h._hmrPayload.actions).forEach((f) => {
2284
+ f in d._hmrPayload.actions || We(h, f);
2285
+ }), h._hmrPayload = d._hmrPayload, h._getters = d._getters, h._hotUpdating = !1;
2286
+ })), Se) {
2287
+ const d = {
2288
+ writable: !0,
2289
+ configurable: !0,
2290
+ // avoid warning on devtools trying to display this property
2291
+ enumerable: !1
2292
+ };
2293
+ ["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((f) => {
2294
+ Object.defineProperty(h, f, J({ value: h[f] }, d));
2295
+ });
2296
+ }
2297
+ return n._p.forEach((d) => {
2298
+ if (Se) {
2299
+ const f = i.run(() => d({
2300
+ store: h,
2301
+ app: n._a,
2302
+ pinia: n,
2303
+ options: s
2304
+ }));
2305
+ Object.keys(f || {}).forEach((y) => h._customProperties.add(y)), J(h, f);
2306
+ } else
2307
+ J(h, i.run(() => d({
2308
+ store: h,
2309
+ app: n._a,
2310
+ pinia: n,
2311
+ options: s
2312
+ })));
2313
+ }), process.env.NODE_ENV !== "production" && h.$state && typeof h.$state == "object" && typeof h.$state.constructor == "function" && !h.$state.constructor.toString().includes("[native code]") && console.warn(`[🍍]: The "state" must be a plain object. It cannot be
2314
+ state: () => new MyClass()
2315
+ Found in store "${h.$id}".`), w && r && t.hydrate && t.hydrate(h.$state, w), u = !0, v = !0, h;
2316
+ }
2317
+ function lt(e, o, t) {
2318
+ let n, l;
2319
+ const r = typeof o == "function";
2320
+ if (typeof e == "string")
2321
+ n = e, l = r ? t : o;
2322
+ else if (l = e, n = e.id, process.env.NODE_ENV !== "production" && typeof n != "string")
2323
+ throw new Error('[🍍]: "defineStore()" must be passed a store id as its first argument.');
2324
+ function i(s, a) {
2325
+ const u = dn();
2326
+ if (s = // in test mode, ignore the argument provided as we can always retrieve a
2327
+ // pinia instance with getActivePinia()
2328
+ (process.env.NODE_ENV === "test" && we && we._testing ? null : s) || (u ? Ce(Gt, null) : null), s && $e(s), process.env.NODE_ENV !== "production" && !we)
2329
+ throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
2330
+ See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
2331
+ This will fail in production.`);
2332
+ s = we, s._s.has(n) || (r ? Ke(n, o, l, s) : _t(n, l, s), process.env.NODE_ENV !== "production" && (i._pinia = s));
2333
+ const v = s._s.get(n);
2334
+ if (process.env.NODE_ENV !== "production" && a) {
2335
+ const c = "__hot:" + n, b = r ? Ke(c, o, l, s, !0) : _t(c, J({}, l), s, !0);
2336
+ a._hotUpdate(b), delete s.state.value[c], s._s.delete(c);
2337
+ }
2338
+ if (process.env.NODE_ENV !== "production" && Fe) {
2339
+ const c = $t();
2340
+ if (c && c.proxy && // avoid adding stores that are just built for hot module replacement
2341
+ !a) {
2342
+ const b = c.proxy, m = "_pStores" in b ? b._pStores : b._pStores = {};
2343
+ m[n] = v;
2344
+ }
2345
+ }
2346
+ return v;
2347
+ }
2348
+ return i.$id = n, i;
2349
+ }
2350
+ const st = lt("language", () => {
2351
+ const e = S("auto"), o = S("en"), t = S({
2352
+ src: [],
2353
+ target: []
2354
+ }), n = _(() => t.value.src[e.value]), l = _(() => t.value.target[o.value]);
2355
+ function r(a, u) {
2356
+ e.value = a == null ? void 0 : a.src, o.value = a == null ? void 0 : a.target, t.value = u;
2357
+ }
2358
+ function i() {
2359
+ if (!t.value.src[o.value] || !t.value.target[e.value]) return;
2360
+ const a = e.value;
2361
+ e.value = o.value, o.value = a;
2362
+ }
2363
+ function s(a) {
2364
+ return t.value.src[a] || t.value.target[a];
2365
+ }
2366
+ return { languages: t, src: e, target: o, srcLabel: n, targetLabel: l, init: r, swap: i, getLabel: s };
2367
+ }), Yo = {
2368
+ key: 0,
2369
+ class: "flex flex-row"
2370
+ }, Qo = {
2371
+ __name: "Selects",
2372
+ setup(e) {
2373
+ const o = st();
2374
+ function t() {
2375
+ o.swap();
2376
+ }
2377
+ return (n, l) => R(o).languages ? (P(), V("div", Yo, [
2378
+ H(ht, {
2379
+ modelValue: R(o).src,
2380
+ "onUpdate:modelValue": l[0] || (l[0] = (r) => R(o).src = r),
2381
+ languages: R(o).languages.src,
2382
+ class: "grow"
2383
+ }, null, 8, ["modelValue", "languages"]),
2384
+ H(wo, {
2385
+ isBidirect: R(o).src !== "auto",
2386
+ class: "grow-0",
2387
+ onSwap: t
2388
+ }, null, 8, ["isBidirect"]),
2389
+ H(ht, {
2390
+ modelValue: R(o).target,
2391
+ "onUpdate:modelValue": l[1] || (l[1] = (r) => R(o).target = r),
2392
+ languages: R(o).languages.target,
2393
+ class: "grow"
2394
+ }, null, 8, ["modelValue", "languages"])
2395
+ ])) : ue("", !0);
2396
+ }
2397
+ }, Zo = {
2398
+ INPUT_MAX_LENGTH: 5e3,
2399
+ INPUT_DEBOUNCE: 500
2400
+ }, ze = (e, o) => {
2401
+ const t = e.__vccOpts || e;
2402
+ for (const [n, l] of o)
2403
+ t[n] = l;
2404
+ return t;
2405
+ }, Xo = {}, el = { class: "mr-2 loading loading-dots loading-xs" };
2406
+ function tl(e, o) {
2407
+ return P(), V("span", el);
2408
+ }
2409
+ const nl = /* @__PURE__ */ ze(Xo, [["render", tl]]);
2410
+ function ol(e, { volume: o = 1, playbackRate: t = 1, soundEnabled: n = !0, interrupt: l = !1, autoplay: r = !1, onload: i, ...s } = {}) {
2411
+ const a = S(null), u = S(!1), v = S(null), c = S(null);
2412
+ function b() {
2413
+ var E;
2414
+ typeof i == "function" && i.call(this), v.value = (v.value || ((E = c.value) == null ? void 0 : E.duration()) || 0) * 1e3, r === !0 && (u.value = !0);
2415
+ }
2416
+ return de(async () => {
2417
+ const E = await import("./howler-DJIW9wc6.js").then((O) => O.h);
2418
+ a.value = E.default.Howl, c.value = new a.value({
2419
+ src: R(e),
2420
+ volume: R(o),
2421
+ rate: R(t),
2422
+ onload: b,
2423
+ ...s
2424
+ });
2425
+ }), j(
2426
+ () => [e],
2427
+ () => {
2428
+ a.value && a.value && c && c.value && (c.value = new a.value({
2429
+ src: R(e),
2430
+ volume: R(o),
2431
+ rate: R(t),
2432
+ onload: b,
2433
+ ...s
2434
+ }));
253
2435
  }
254
- },
255
- data() {
256
- return {
257
- input: "",
258
- INPUT_MAX_LENGTH: config.INPUT_MAX_LENGTH,
259
- input_timeout: null,
260
- player: new Audio(),
261
- playing: false,
262
- ttsIndex: 0,
263
- auto_translate: true,
264
- firstTime: true
265
- };
266
- },
267
- computed: {
268
- rtl() {
269
- if (!this.data)
270
- return false;
271
- return helper.isRTL(this.data.src);
2436
+ ), j(
2437
+ () => [R(o), R(t)],
2438
+ () => {
2439
+ c.value && (c.value.volume(R(o)), c.value.rate(R(t)));
272
2440
  }
273
- },
274
- watch: {
275
- replace(new_input) {
276
- this.input = new_input;
277
- if (this.firstTime || !this.auto_translate) {
278
- setTimeout(() => {
279
- this.$refs.input.select();
280
- }, 100);
281
- }
282
- this.firstTime = false;
2441
+ ), {
2442
+ play: (E) => {
2443
+ typeof E > "u" && (E = {}), !(!c.value || !n && !E.forceSoundEnabled) && (l && c.value.stop(), E.playbackRate && c.value.rate(E.playbackRate), c.value.play(E.id), c.value.once("end", () => {
2444
+ c.value && c.value && !c.value.playing() && (u.value = !1);
2445
+ }), u.value = !0);
283
2446
  },
284
- tts() {
285
- this.ttsIndex = 0;
2447
+ sound: c,
2448
+ isPlaying: u,
2449
+ duration: v,
2450
+ pause: (E) => {
2451
+ c.value && (c.value.pause(typeof E == "number" ? E : void 0), u.value = !1);
286
2452
  },
287
- auto_translate(val) {
288
- if (val)
289
- this.translate();
290
- localStorage.setItem(LABEL_AUTO_TRANSLATE, val);
2453
+ stop: (E) => {
2454
+ c.value && (c.value.stop(typeof E == "number" ? E : void 0), u.value = !1);
2455
+ }
2456
+ };
2457
+ }
2458
+ const ll = { class: "swap" }, sl = /* @__PURE__ */ I("svg", {
2459
+ class: "swap-off fill-current h-4 w-4",
2460
+ xmlns: "http://www.w3.org/2000/svg",
2461
+ viewBox: "0 0 24 24"
2462
+ }, [
2463
+ /* @__PURE__ */ I("path", { d: "M14,3.23V5.29C16.89,6.15 19,8.83 19,12C19,15.17 16.89,17.84 14,18.7V20.77C18,19.86 21,16.28 21,12C21,7.72 18,4.14 14,3.23M16.5,12C16.5,10.23 15.5,8.71 14,7.97V16C15.5,15.29 16.5,13.76 16.5,12M3,9V15H7L12,20V4L7,9H3Z" })
2464
+ ], -1), rl = /* @__PURE__ */ I("svg", {
2465
+ class: "swap-on fill-current h-4 w-4",
2466
+ xmlns: "http://www.w3.org/2000/svg",
2467
+ viewBox: "0 0 24 24"
2468
+ }, [
2469
+ /* @__PURE__ */ I("path", {
2470
+ "fill-rule": "evenodd",
2471
+ d: "M4.5 7.5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-9a3 3 0 0 1-3-3v-9Z",
2472
+ "clip-rule": "evenodd"
2473
+ })
2474
+ ], -1), il = {
2475
+ __name: "SpeakBtn",
2476
+ props: {
2477
+ url: {
2478
+ type: String,
2479
+ default: ""
291
2480
  }
292
2481
  },
293
- mounted() {
294
- textarea.init(this.$refs.input, config.INPUT_MAX_LENGTH);
295
- this.player.addEventListener("ended", () => {
296
- this.ttsIndex++;
297
- if (this.ttsIndex >= this.tts.src.length) {
298
- this.stop();
299
- return;
300
- }
301
- this.play();
302
- });
303
- this.$refs.input.addEventListener("input", () => {
304
- textarea.autoResize(this.$refs.input);
305
- if (!this.auto_translate)
306
- return;
307
- clearTimeout(this.input_timeout);
308
- this.input_timeout = setTimeout(this.translate, config.INPUT_DELAY);
309
- });
310
- this.$refs.input.addEventListener("keyup", (e) => {
311
- if (this.auto_translate)
312
- return;
313
- if (e && e.keyCode === 13)
314
- this.translate();
315
- });
316
- },
317
- created() {
318
- const auto_translate = localStorage.getItem(LABEL_AUTO_TRANSLATE);
319
- if (auto_translate === "false")
320
- this.auto_translate = false;
321
- },
322
- methods: {
323
- play() {
324
- if (!this.tts.src) {
325
- return;
2482
+ setup(e) {
2483
+ const o = e, { play: t, stop: n, isPlaying: l } = ol(o.url), r = S(!1);
2484
+ j(
2485
+ () => l.value,
2486
+ (s) => {
2487
+ r.value = s;
326
2488
  }
327
- this.player.src = this.tts.src[this.ttsIndex];
328
- this.playing = true;
329
- this.player.play().catch(() => {
330
- this.playing = false;
331
- });
332
- },
333
- stop() {
334
- this.playing = false;
335
- this.ttsIndex = 0;
336
- this.player.pause();
337
- },
338
- clear() {
339
- this.$emit("clear");
340
- this.input = "";
341
- textarea.init(this.$refs.input, config.INPUT_MAX_LENGTH);
342
- this.$refs.input.focus();
343
- },
344
- translate() {
345
- if (!this.input) {
346
- this.clear();
2489
+ );
2490
+ function i() {
2491
+ if (l.value) {
2492
+ n();
347
2493
  return;
348
2494
  }
349
- this.$emit("translate", this.input);
2495
+ t();
350
2496
  }
2497
+ return (s, a) => (P(), V("button", {
2498
+ class: "btn btn-xs btn-ghost btn-circle",
2499
+ onClick: fn(i, ["prevent"])
2500
+ }, [
2501
+ I("label", ll, [
2502
+ Xe(I("input", {
2503
+ "onUpdate:modelValue": a[0] || (a[0] = (u) => r.value = u),
2504
+ type: "checkbox"
2505
+ }, null, 512), [
2506
+ [vn, r.value]
2507
+ ]),
2508
+ sl,
2509
+ rl
2510
+ ])
2511
+ ]));
351
2512
  }
352
- };
353
- const _hoisted_1$7 = { class: "relative indicator w-full" };
354
- const _hoisted_2$7 = {
355
- key: 0,
356
- class: "absolute top-0 left-0 w-4/5 ml-2 text-sm truncate"
357
- };
358
- const _hoisted_3$7 = /* @__PURE__ */ createElementVNode("svg", {
359
- xmlns: "http://www.w3.org/2000/svg",
360
- class: "h-4 w-4 inline",
361
- fill: "none",
362
- viewBox: "0 0 24 24",
363
- stroke: "currentColor"
364
- }, [
365
- /* @__PURE__ */ createElementVNode("path", {
366
- "stroke-linecap": "round",
367
- "stroke-linejoin": "round",
368
- "stroke-width": "2",
369
- d: "M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z"
370
- })
371
- ], -1);
372
- const _hoisted_4$7 = [
373
- _hoisted_3$7
374
- ];
375
- const _hoisted_5$6 = /* @__PURE__ */ createElementVNode("svg", {
376
- xmlns: "http://www.w3.org/2000/svg",
377
- class: "h-4 w-4 inline",
378
- fill: "none",
379
- viewBox: "0 0 24 24",
380
- stroke: "currentColor"
381
- }, [
382
- /* @__PURE__ */ createElementVNode("path", {
383
- "stroke-linecap": "round",
384
- "stroke-linejoin": "round",
385
- "stroke-width": "2",
386
- d: "M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
387
- }),
388
- /* @__PURE__ */ createElementVNode("path", {
389
- "stroke-linecap": "round",
390
- "stroke-linejoin": "round",
391
- "stroke-width": "2",
392
- d: "M9 10a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"
393
- })
394
- ], -1);
395
- const _hoisted_6$4 = [
396
- _hoisted_5$6
397
- ];
398
- const _hoisted_7$2 = {
399
- key: 2,
400
- class: "ml-1"
401
- };
402
- const _hoisted_8$1 = { key: 0 };
403
- const _hoisted_9$1 = /* @__PURE__ */ createElementVNode("svg", {
2513
+ }, al = {}, ul = /* @__PURE__ */ I("svg", {
404
2514
  xmlns: "http://www.w3.org/2000/svg",
405
- class: "h-5 w-5",
406
2515
  fill: "none",
407
2516
  viewBox: "0 0 24 24",
408
- stroke: "currentColor"
2517
+ "stroke-width": "1.5",
2518
+ stroke: "currentColor",
2519
+ class: "w-5 h-5"
409
2520
  }, [
410
- /* @__PURE__ */ createElementVNode("path", {
2521
+ /* @__PURE__ */ I("path", {
411
2522
  "stroke-linecap": "round",
412
2523
  "stroke-linejoin": "round",
413
- "stroke-width": "2",
414
- d: "M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"
2524
+ d: "m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"
415
2525
  })
416
- ], -1);
417
- const _hoisted_10$1 = [
418
- _hoisted_9$1
2526
+ ], -1), cl = [
2527
+ ul
419
2528
  ];
420
- const _hoisted_11$1 = { class: "cursor-pointer label justify-start" };
421
- const _hoisted_12$1 = /* @__PURE__ */ createElementVNode("span", { class: "ml-1 label-text text-xs" }, "Auto translate", -1);
422
- function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
423
- return openBlock(), createElementBlock("div", null, [
424
- createElementVNode("div", _hoisted_1$7, [
425
- $props.data ? (openBlock(), createElementBlock("div", _hoisted_2$7, [
426
- !$data.playing ? (openBlock(), createElementBlock("span", {
427
- key: 0,
428
- class: "pointer",
429
- onClick: _cache[0] || (_cache[0] = (...args) => $options.play && $options.play(...args))
430
- }, _hoisted_4$7)) : createCommentVNode("", true),
431
- $data.playing ? (openBlock(), createElementBlock("span", {
432
- key: 1,
433
- class: "pointer",
434
- onClick: _cache[1] || (_cache[1] = (...args) => $options.stop && $options.stop(...args))
435
- }, _hoisted_6$4)) : createCommentVNode("", true),
436
- $props.data.ddictSrc ? (openBlock(), createElementBlock("span", _hoisted_7$2, toDisplayString($props.data.ddictSrc), 1)) : createCommentVNode("", true),
437
- (openBlock(true), createElementBlock(Fragment, null, renderList($props.data.sentences, (sentence, index) => {
438
- return openBlock(), createElementBlock("span", {
439
- key: `${sentence.src_translit}-${index}`,
440
- class: "italic"
441
- }, [
442
- sentence.src_translit ? (openBlock(), createElementBlock("span", _hoisted_8$1, " \u2015 " + toDisplayString(sentence.src_translit), 1)) : createCommentVNode("", true)
443
- ]);
444
- }), 128))
445
- ])) : createCommentVNode("", true),
446
- $data.input != "" ? (openBlock(), createElementBlock("div", {
447
- key: 1,
448
- onClick: _cache[2] || (_cache[2] = (...args) => $options.clear && $options.clear(...args)),
449
- class: "indicator-item m-3"
450
- }, _hoisted_10$1)) : createCommentVNode("", true),
451
- withDirectives(createElementVNode("textarea", {
452
- id: "input",
453
- ref: "input",
454
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.input = $event),
455
- class: "text-lg textarea textarea-bordered w-full pt-5",
456
- style: normalizeStyle({ "text-align": $options.rtl ? "right" : "left" }),
457
- autofocus: ""
458
- }, null, 4), [
459
- [
460
- vModelText,
461
- $data.input,
462
- void 0,
463
- { trim: true }
464
- ]
465
- ])
466
- ]),
467
- createElementVNode("label", _hoisted_11$1, [
468
- withDirectives(createElementVNode("input", {
469
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => $data.auto_translate = $event),
470
- type: "checkbox",
471
- class: "toggle toggle-xs"
472
- }, null, 512), [
473
- [vModelCheckbox, $data.auto_translate]
474
- ]),
475
- _hoisted_12$1
476
- ])
477
- ]);
2529
+ function dl(e, o) {
2530
+ return P(), V("button", {
2531
+ class: "btn btn-xs btn-ghost btn-circle p-0",
2532
+ onClick: o[0] || (o[0] = (...t) => e.onClick && e.onClick(...t))
2533
+ }, cl);
478
2534
  }
479
- var Input = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$6]]);
480
- const _sfc_main$6 = {
2535
+ const fl = /* @__PURE__ */ ze(al, [["render", dl]]), vl = { class: "flex flex-row rounded-t-lg bg-white border border-b-0 px-1 pr-1 pt-1 gap-1 items-center" }, pl = { class: "text-sm italic" }, hl = { key: 0 }, ml = /* @__PURE__ */ I("div", { class: "flex-grow" }, " ", -1), on = {
2536
+ __name: "TranslationBtnGroup",
481
2537
  props: {
482
- data: {
483
- type: Object,
484
- default: null
2538
+ loading: {
2539
+ type: Boolean,
2540
+ default: !1
2541
+ },
2542
+ src: {
2543
+ type: String,
2544
+ default: ""
2545
+ },
2546
+ srcLabel: {
2547
+ type: String,
2548
+ default: ""
485
2549
  },
486
2550
  tts: {
487
- type: Object,
488
- default: null
2551
+ type: String,
2552
+ default: ""
2553
+ },
2554
+ phonetic: {
2555
+ type: String,
2556
+ default: ""
2557
+ },
2558
+ isClearBtn: {
2559
+ type: Boolean,
2560
+ default: !1
489
2561
  }
490
2562
  },
491
- data() {
492
- return {
493
- player: new Audio(),
494
- playing: false,
495
- copied: false,
496
- ttsIndex: 0
2563
+ emits: ["clear"],
2564
+ setup(e, { emit: o }) {
2565
+ const t = e, n = o;
2566
+ return (l, r) => (P(), V("div", vl, [
2567
+ t.tts ? (P(), xe(il, {
2568
+ key: 0,
2569
+ url: t.tts
2570
+ }, null, 8, ["url"])) : ue("", !0),
2571
+ I("div", pl, [
2572
+ pn(ne(e.srcLabel) + " ", 1),
2573
+ e.phonetic ? (P(), V("span", hl, "― " + ne(t.phonetic), 1)) : ue("", !0)
2574
+ ]),
2575
+ ml,
2576
+ t.loading ? (P(), xe(nl, { key: 1 })) : ue("", !0),
2577
+ t.src && t.isClearBtn ? (P(), xe(fl, {
2578
+ key: 2,
2579
+ onClick: r[0] || (r[0] = (i) => n("clear"))
2580
+ })) : ue("", !0)
2581
+ ]));
2582
+ }
2583
+ }, ye = lt("translation", () => {
2584
+ const e = S(null), o = S(null), t = S({
2585
+ src: null,
2586
+ target: null
2587
+ }), n = S(null), l = S([]), r = S([]), i = S([]), s = S({
2588
+ src: null,
2589
+ target: null
2590
+ }), a = st(), u = _(() => a.getLabel(e.value)), v = _(() => a.getLabel(o.value));
2591
+ function c(m) {
2592
+ e.value = m.src, o.value = m.target, t.value = m.phonetic, n.value = m.result, l.value = m.dictionary, r.value = m.definitions, i.value = m.examples, s.value = m.tts;
2593
+ }
2594
+ function b() {
2595
+ e.value = null, o.value = null, t.value = {
2596
+ src: null,
2597
+ target: null
2598
+ }, n.value = null, l.value = [], r.value = [], i.value = [], s.value = {
2599
+ src: null,
2600
+ target: null
497
2601
  };
498
- },
499
- computed: {
500
- rtl() {
501
- if (!this.data)
502
- return false;
503
- return helper.isRTL(this.data.target);
504
- }
505
- },
506
- watch: {
507
- data(data) {
508
- if (!data) {
509
- this.$refs.input.value = "";
510
- textarea.init(this.$refs.input);
511
- return;
2602
+ }
2603
+ return {
2604
+ src: e,
2605
+ srcLabel: u,
2606
+ target: o,
2607
+ targetLabel: v,
2608
+ phonetic: t,
2609
+ result: n,
2610
+ dictionary: l,
2611
+ definitions: r,
2612
+ examples: i,
2613
+ tts: s,
2614
+ init: c,
2615
+ reset: b
2616
+ };
2617
+ });
2618
+ function gl(e) {
2619
+ return Ct() ? (Ye(e), !0) : !1;
2620
+ }
2621
+ function Ae(e) {
2622
+ return typeof e == "function" ? e() : R(e);
2623
+ }
2624
+ const bl = typeof window < "u" && typeof document < "u";
2625
+ typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
2626
+ const wt = () => {
2627
+ };
2628
+ function yl(e, o) {
2629
+ function t(...n) {
2630
+ return new Promise((l, r) => {
2631
+ Promise.resolve(e(() => o.apply(this, n), { fn: o, thisArg: this, args: n })).then(l).catch(r);
2632
+ });
2633
+ }
2634
+ return t;
2635
+ }
2636
+ function _l(e, o = {}) {
2637
+ let t, n, l = wt;
2638
+ const r = (s) => {
2639
+ clearTimeout(s), l(), l = wt;
2640
+ };
2641
+ return (s) => {
2642
+ const a = Ae(e), u = Ae(o.maxWait);
2643
+ return t && r(t), a <= 0 || u !== void 0 && u <= 0 ? (n && (r(n), n = null), Promise.resolve(s())) : new Promise((v, c) => {
2644
+ l = o.rejectOnCancel ? c : v, u && !n && (n = setTimeout(() => {
2645
+ t && r(t), n = null, v(s());
2646
+ }, u)), t = setTimeout(() => {
2647
+ n && r(n), n = null, v(s());
2648
+ }, a);
2649
+ });
2650
+ };
2651
+ }
2652
+ function wl(e, o = 200, t = {}) {
2653
+ return yl(
2654
+ _l(o, t),
2655
+ e
2656
+ );
2657
+ }
2658
+ function xt(e) {
2659
+ var o;
2660
+ const t = Ae(e);
2661
+ return (o = t == null ? void 0 : t.$el) != null ? o : t;
2662
+ }
2663
+ const xl = bl ? window : void 0;
2664
+ function Sl() {
2665
+ const e = S(!1), o = $t();
2666
+ return o && de(() => {
2667
+ e.value = !0;
2668
+ }, o), e;
2669
+ }
2670
+ function Ol(e) {
2671
+ const o = Sl();
2672
+ return _(() => (o.value, !!e()));
2673
+ }
2674
+ function El(e, o, t = {}) {
2675
+ const { window: n = xl, ...l } = t;
2676
+ let r;
2677
+ const i = Ol(() => n && "ResizeObserver" in n), s = () => {
2678
+ r && (r.disconnect(), r = void 0);
2679
+ }, a = _(() => Array.isArray(e) ? e.map((c) => xt(c)) : [xt(e)]), u = j(
2680
+ a,
2681
+ (c) => {
2682
+ if (s(), i.value && n) {
2683
+ r = new ResizeObserver(o);
2684
+ for (const b of c)
2685
+ b && r.observe(b, l);
512
2686
  }
513
- this.$refs.input.value = data.sentences.map((sentence) => sentence.trans).join("");
514
- textarea.autoResize(this.$refs.input);
515
2687
  },
516
- tts() {
517
- this.ttsIndex = 0;
2688
+ { immediate: !0, flush: "post" }
2689
+ ), v = () => {
2690
+ s(), u();
2691
+ };
2692
+ return gl(v), {
2693
+ isSupported: i,
2694
+ stop: v
2695
+ };
2696
+ }
2697
+ function ln(e) {
2698
+ var o;
2699
+ const t = S(e == null ? void 0 : e.element), n = S(e == null ? void 0 : e.input), l = (o = e == null ? void 0 : e.styleProp) != null ? o : "height", r = S(1);
2700
+ function i() {
2701
+ var s;
2702
+ if (!t.value)
2703
+ return;
2704
+ let a = "";
2705
+ t.value.style[l] = "1px", r.value = (s = t.value) == null ? void 0 : s.scrollHeight, e != null && e.styleTarget ? Ae(e.styleTarget).style[l] = `${r.value}px` : a = `${r.value}px`, t.value.style[l] = a;
2706
+ }
2707
+ return j([n, t], () => Q(i), { immediate: !0 }), j(r, () => {
2708
+ var s;
2709
+ return (s = e == null ? void 0 : e.onResize) == null ? void 0 : s.call(e);
2710
+ }), El(t, () => i()), e != null && e.watch && j(e.watch, i, { immediate: !0, deep: !0 }), {
2711
+ textarea: t,
2712
+ input: n,
2713
+ triggerResize: i
2714
+ };
2715
+ }
2716
+ const Il = {
2717
+ __name: "Input",
2718
+ props: {
2719
+ text: {
2720
+ type: String,
2721
+ default: ""
518
2722
  }
519
2723
  },
520
- mounted() {
521
- textarea.init(this.$refs.input);
522
- textarea.autoResize(this.$refs.input);
523
- this.player.addEventListener("ended", () => {
524
- this.ttsIndex++;
525
- if (this.ttsIndex >= this.tts.target.length) {
526
- this.stop();
527
- return;
528
- }
529
- this.play();
530
- });
531
- },
532
- methods: {
533
- play() {
534
- if (!this.tts.target) {
2724
+ emits: ["change", "clear"],
2725
+ setup(e, { emit: o }) {
2726
+ const t = ye(), l = S(e.text), r = _(() => t.src), i = _(() => t.srcLabel), s = _(() => {
2727
+ var w;
2728
+ return (w = t.phonetic) == null ? void 0 : w.src;
2729
+ }), a = _(() => {
2730
+ var w;
2731
+ return (w = t.tts) == null ? void 0 : w.src;
2732
+ }), { textarea: u } = ln({ input: l, styleProp: "minHeight" }), v = o, c = wl(() => {
2733
+ v("change", l.value);
2734
+ }, Zo.INPUT_DEBOUNCE);
2735
+ function b() {
2736
+ if (!l.value) {
2737
+ m();
535
2738
  return;
536
2739
  }
537
- this.player.src = this.tts.target[this.ttsIndex];
538
- this.playing = true;
539
- this.player.play().catch(() => {
540
- this.playing = false;
541
- });
542
- },
543
- stop() {
544
- this.playing = false;
545
- this.ttsIndex = 0;
546
- this.player.pause();
547
- },
548
- copy() {
549
- const val = this.$refs.input.value;
550
- if (!val)
551
- return;
552
- navigator.clipboard.writeText(val);
553
- this.copied = true;
554
- setTimeout(() => {
555
- this.copied = false;
556
- }, 500);
2740
+ c();
2741
+ }
2742
+ function m() {
2743
+ v("clear"), l.value = "", u.value.focus();
557
2744
  }
2745
+ return (w, $) => (P(), V(X, null, [
2746
+ H(on, {
2747
+ src: r.value,
2748
+ srcLabel: i.value,
2749
+ tts: a.value,
2750
+ phonetic: s.value,
2751
+ isClearBtn: !0,
2752
+ onClear: m
2753
+ }, null, 8, ["src", "srcLabel", "tts", "phonetic"]),
2754
+ Xe(I("textarea", {
2755
+ ref_key: "textarea",
2756
+ ref: u,
2757
+ "onUpdate:modelValue": $[0] || ($[0] = (M) => l.value = M),
2758
+ class: "w-full border border-t-0 rounded-b-lg outline-none outline-0 p-3 pt-0",
2759
+ autofocus: "",
2760
+ rows: "2",
2761
+ onInput: b
2762
+ }, null, 544), [
2763
+ [
2764
+ Tt,
2765
+ l.value,
2766
+ void 0,
2767
+ { trim: !0 }
2768
+ ]
2769
+ ])
2770
+ ], 64));
558
2771
  }
559
- };
560
- const _hoisted_1$6 = { class: "relative indicator w-full" };
561
- const _hoisted_2$6 = {
562
- key: 0,
563
- class: "absolute top-0 left-0 w-2/3 ml-2 text-sm truncate"
564
- };
565
- const _hoisted_3$6 = /* @__PURE__ */ createElementVNode("svg", {
566
- xmlns: "http://www.w3.org/2000/svg",
567
- class: "h-4 w-4 inline",
568
- fill: "none",
569
- viewBox: "0 0 24 24",
570
- stroke: "currentColor"
571
- }, [
572
- /* @__PURE__ */ createElementVNode("path", {
573
- "stroke-linecap": "round",
574
- "stroke-linejoin": "round",
575
- "stroke-width": "2",
576
- d: "M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z"
577
- })
578
- ], -1);
579
- const _hoisted_4$6 = [
580
- _hoisted_3$6
581
- ];
582
- const _hoisted_5$5 = /* @__PURE__ */ createElementVNode("svg", {
583
- xmlns: "http://www.w3.org/2000/svg",
584
- class: "h-4 w-4 inline",
585
- fill: "none",
586
- viewBox: "0 0 24 24",
587
- stroke: "currentColor"
588
- }, [
589
- /* @__PURE__ */ createElementVNode("path", {
590
- "stroke-linecap": "round",
591
- "stroke-linejoin": "round",
592
- "stroke-width": "2",
593
- d: "M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
594
- }),
595
- /* @__PURE__ */ createElementVNode("path", {
596
- "stroke-linecap": "round",
597
- "stroke-linejoin": "round",
598
- "stroke-width": "2",
599
- d: "M9 10a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"
600
- })
601
- ], -1);
602
- const _hoisted_6$3 = [
603
- _hoisted_5$5
604
- ];
605
- const _hoisted_7$1 = {
606
- key: 2,
607
- class: "ml-1"
608
- };
609
- const _hoisted_8 = {
610
- key: 0,
611
- xmlns: "http://www.w3.org/2000/svg",
612
- class: "h-5 w-5",
613
- fill: "none",
614
- viewBox: "0 0 24 24",
615
- stroke: "currentColor"
616
- };
617
- const _hoisted_9 = /* @__PURE__ */ createElementVNode("path", {
618
- "stroke-linecap": "round",
619
- "stroke-linejoin": "round",
620
- "stroke-width": "2",
621
- d: "M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"
622
- }, null, -1);
623
- const _hoisted_10 = [
624
- _hoisted_9
625
- ];
626
- const _hoisted_11 = {
627
- key: 1,
628
- xmlns: "http://www.w3.org/2000/svg",
629
- class: "h-5 w-5",
630
- viewBox: "0 0 20 20",
631
- fill: "currentColor"
632
- };
633
- const _hoisted_12 = /* @__PURE__ */ createElementVNode("path", { d: "M8 2a1 1 0 000 2h2a1 1 0 100-2H8z" }, null, -1);
634
- const _hoisted_13 = /* @__PURE__ */ createElementVNode("path", { d: "M3 5a2 2 0 012-2 3 3 0 003 3h2a3 3 0 003-3 2 2 0 012 2v6h-4.586l1.293-1.293a1 1 0 00-1.414-1.414l-3 3a1 1 0 000 1.414l3 3a1 1 0 001.414-1.414L10.414 13H15v3a2 2 0 01-2 2H5a2 2 0 01-2-2V5zM15 11h2a1 1 0 110 2h-2v-2z" }, null, -1);
635
- const _hoisted_14 = [
636
- _hoisted_12,
637
- _hoisted_13
638
- ];
639
- const _hoisted_15 = {
640
- key: 0,
641
- class: "label justify-end"
642
- };
643
- const _hoisted_16 = /* @__PURE__ */ createElementVNode("span", { class: "text-xs" }, "Powered by Google Translate.", -1);
644
- const _hoisted_17 = [
645
- _hoisted_16
646
- ];
647
- function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
648
- return openBlock(), createElementBlock(Fragment, null, [
649
- createElementVNode("div", _hoisted_1$6, [
650
- $props.data ? (openBlock(), createElementBlock("div", _hoisted_2$6, [
651
- !$data.playing ? (openBlock(), createElementBlock("span", {
652
- key: 0,
653
- class: "pointer",
654
- onClick: _cache[0] || (_cache[0] = (...args) => $options.play && $options.play(...args))
655
- }, _hoisted_4$6)) : createCommentVNode("", true),
656
- $data.playing ? (openBlock(), createElementBlock("span", {
657
- key: 1,
658
- class: "pointer",
659
- onClick: _cache[1] || (_cache[1] = (...args) => $options.stop && $options.stop(...args))
660
- }, _hoisted_6$3)) : createCommentVNode("", true),
661
- $props.data.ddictTarget ? (openBlock(), createElementBlock("span", _hoisted_7$1, toDisplayString($props.data.ddictTarget), 1)) : createCommentVNode("", true)
662
- ])) : createCommentVNode("", true),
663
- $props.data ? (openBlock(), createElementBlock("div", {
664
- key: 1,
665
- onClick: _cache[2] || (_cache[2] = (...args) => $options.copy && $options.copy(...args)),
666
- class: "indicator-item m-3"
667
- }, [
668
- !$data.copied ? (openBlock(), createElementBlock("svg", _hoisted_8, _hoisted_10)) : createCommentVNode("", true),
669
- $data.copied ? (openBlock(), createElementBlock("svg", _hoisted_11, _hoisted_14)) : createCommentVNode("", true)
670
- ])) : createCommentVNode("", true),
671
- createElementVNode("textarea", {
672
- ref: "input",
673
- class: "text-lg textarea textarea-bordered w-full pt-5",
674
- style: normalizeStyle({ "text-align": $options.rtl ? "right" : "left" }),
2772
+ }, $l = /* @__PURE__ */ ze(Il, [["__scopeId", "data-v-601b7a18"]]), sn = lt("loader", () => ({ loading: S(!1) })), Cl = {
2773
+ __name: "Result",
2774
+ setup(e) {
2775
+ const o = ye(), t = _(() => o.result), n = _(() => o.target), l = _(() => o.targetLabel), r = _(() => {
2776
+ var v;
2777
+ return (v = o.phonetic) == null ? void 0 : v.target;
2778
+ }), i = _(() => {
2779
+ var v;
2780
+ return (v = o.tts) == null ? void 0 : v.target;
2781
+ }), s = sn(), { textarea: a, input: u } = ln({ input: t, styleProp: "minHeight" });
2782
+ return (v, c) => (P(), V(X, null, [
2783
+ H(on, {
2784
+ loading: R(s).loading,
2785
+ src: n.value,
2786
+ srcLabel: l.value,
2787
+ tts: i.value,
2788
+ phonetic: r.value
2789
+ }, null, 8, ["loading", "src", "srcLabel", "tts", "phonetic"]),
2790
+ Xe(I("textarea", {
2791
+ ref_key: "textarea",
2792
+ ref: a,
2793
+ "onUpdate:modelValue": c[0] || (c[0] = (b) => be(u) ? u.value = b : null),
2794
+ class: "w-full border border-t-0 rounded-b-lg outline-none outline-0 p-3 pt-0",
675
2795
  readonly: "",
2796
+ rows: "2",
676
2797
  spellcheck: "false"
677
- }, null, 4)
678
- ]),
679
- $props.data ? (openBlock(), createElementBlock("p", _hoisted_15, _hoisted_17)) : createCommentVNode("", true)
680
- ], 64);
681
- }
682
- var Result = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$5]]);
683
- const _sfc_main$5 = {
684
- props: {
685
- data: {
686
- type: Object,
687
- default: null
688
- }
689
- },
690
- data() {
691
- return {
692
- name: "Definitions"
693
- };
2798
+ }, null, 512), [
2799
+ [Tt, R(u)]
2800
+ ])
2801
+ ], 64));
694
2802
  }
695
- };
696
- const _hoisted_1$5 = { key: 0 };
697
- const _hoisted_2$5 = { class: "card-body p-4" };
698
- const _hoisted_3$5 = { class: "card-title font-bold" };
699
- const _hoisted_4$5 = { class: "list-decimal" };
700
- const _hoisted_5$4 = { class: "capitalize font-bold" };
701
- const _hoisted_6$2 = /* @__PURE__ */ createElementVNode("br", null, null, -1);
702
- const _hoisted_7 = {
703
- key: 0,
704
- class: "italic"
705
- };
706
- function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
707
- return $props.data.definitions ? (openBlock(), createElementBlock("div", _hoisted_1$5, [
708
- createElementVNode("div", _hoisted_2$5, [
709
- createElementVNode("h2", _hoisted_3$5, toDisplayString($data.name), 1),
710
- createElementVNode("ul", null, [
711
- (openBlock(true), createElementBlock(Fragment, null, renderList($props.data.definitions, (dict, index) => {
712
- return openBlock(), createElementBlock("li", {
713
- key: `${dict.pos}-${index}`,
714
- class: "mb-2"
2803
+ }, Tl = /* @__PURE__ */ ze(Cl, [["__scopeId", "data-v-6c3a2370"]]), Pl = { class: "card border bg-white rounded-lg" }, Rl = { class: "card-body p-4" }, kl = /* @__PURE__ */ I("h2", { class: "card-title" }, "Translations", -1), Nl = { class: "capitalize font-bold" }, Vl = { class: "list-none list-inside" }, Dl = ["onClick"], Ll = { class: "italic" }, Ml = {
2804
+ __name: "Dictionary",
2805
+ setup(e) {
2806
+ const o = ye(), t = _(() => o.dictionary);
2807
+ return (n, l) => (P(), V("div", Pl, [
2808
+ I("div", Rl, [
2809
+ kl,
2810
+ I("ul", null, [
2811
+ (P(!0), V(X, null, ge(t.value, (r, i) => (P(), V("li", {
2812
+ key: `${r.pos}-${i}`,
2813
+ class: "mb-3"
715
2814
  }, [
716
- createElementVNode("ul", _hoisted_4$5, [
717
- createElementVNode("h5", _hoisted_5$4, toDisplayString(dict.pos), 1),
718
- (openBlock(true), createElementBlock(Fragment, null, renderList(dict.entry, (entry, index2) => {
719
- return openBlock(), createElementBlock("li", {
720
- key: `${entry.definition_id}-${index2}`,
721
- class: "ml-5 mb-2"
722
- }, [
723
- createElementVNode("span", null, toDisplayString(entry.gloss), 1),
724
- _hoisted_6$2,
725
- entry.example ? (openBlock(), createElementBlock("small", _hoisted_7, '"' + toDisplayString(entry.example) + '"', 1)) : createCommentVNode("", true)
726
- ]);
727
- }), 128))
2815
+ I("h5", Nl, ne(r.pos), 1),
2816
+ I("ul", Vl, [
2817
+ (P(!0), V(X, null, ge(r.items, (s, a) => (P(), V("li", {
2818
+ key: `${s.word}-${a}`
2819
+ }, [
2820
+ I("span", {
2821
+ class: "badge badge-neutral text-white cursor-pointer",
2822
+ onClick: (u) => n.translate(s.word)
2823
+ }, ne(s.word), 9, Dl),
2824
+ I("small", Ll, " ― " + ne(s.reverse_translation.join(", ")), 1)
2825
+ ]))), 128))
728
2826
  ])
729
- ]);
730
- }), 128))
2827
+ ]))), 128))
2828
+ ])
731
2829
  ])
732
- ])
733
- ])) : createCommentVNode("", true);
734
- }
735
- var DictSrc = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$4]]);
736
- const _sfc_main$4 = {
737
- props: {
738
- data: {
739
- type: Object,
740
- default: null
741
- }
742
- },
743
- data() {
744
- return {
745
- name: "Translations"
746
- };
747
- },
748
- methods: {
749
- translate(word) {
750
- this.$emit("translate", word);
751
- }
2830
+ ]));
752
2831
  }
753
- };
754
- const _hoisted_1$4 = { key: 0 };
755
- const _hoisted_2$4 = { class: "card-body p-4" };
756
- const _hoisted_3$4 = { class: "card-title" };
757
- const _hoisted_4$4 = { class: "capitalize font-bold" };
758
- const _hoisted_5$3 = ["onClick"];
759
- const _hoisted_6$1 = {
2832
+ }, Al = { class: "card border bg-white rounded-lg" }, jl = { class: "card-body p-4" }, Fl = /* @__PURE__ */ I("h2", { class: "card-title font-bold" }, "Definitions", -1), zl = { class: "capitalize font-bold mb-0" }, Bl = { class: "list-decimal list-outside ml-5" }, Ul = /* @__PURE__ */ I("br", null, null, -1), Hl = {
760
2833
  key: 0,
761
2834
  class: "italic"
762
- };
763
- function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
764
- return $props.data.dict ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
765
- createElementVNode("div", _hoisted_2$4, [
766
- createElementVNode("h2", _hoisted_3$4, toDisplayString($data.name), 1),
767
- createElementVNode("ul", null, [
768
- (openBlock(true), createElementBlock(Fragment, null, renderList($props.data.dict, (dict, index) => {
769
- return openBlock(), createElementBlock("li", {
770
- key: `${dict.pos}-${index}`,
771
- class: "mb-2"
2835
+ }, Wl = {
2836
+ __name: "Definition",
2837
+ setup(e) {
2838
+ const o = ye(), t = _(() => o.definitions);
2839
+ return (n, l) => (P(), V("div", Al, [
2840
+ I("div", jl, [
2841
+ Fl,
2842
+ I("ul", null, [
2843
+ (P(!0), V(X, null, ge(t.value, (r, i) => (P(), V("li", {
2844
+ key: `${r.pos}-${i}`,
2845
+ class: "mb-3"
772
2846
  }, [
773
- createElementVNode("h5", _hoisted_4$4, toDisplayString(dict.pos), 1),
774
- (openBlock(true), createElementBlock(Fragment, null, renderList(dict.entry, (entry, index2) => {
775
- return openBlock(), createElementBlock("div", {
776
- key: `${entry.word}-${index2}`
2847
+ I("h5", zl, ne(r.pos), 1),
2848
+ I("ul", Bl, [
2849
+ (P(!0), V(X, null, ge(r.items, (s, a) => (P(), V("li", {
2850
+ key: `${s.gloss}-${a}`,
2851
+ class: "mb-1"
777
2852
  }, [
778
- createElementVNode("span", {
779
- class: "badge bg-neutral",
780
- onClick: ($event) => $options.translate(entry.word)
781
- }, toDisplayString(entry.word), 9, _hoisted_5$3),
782
- entry.reverse_translation ? (openBlock(), createElementBlock("small", _hoisted_6$1, " \u2015 " + toDisplayString(entry.reverse_translation.join(", ")), 1)) : createCommentVNode("", true)
783
- ]);
784
- }), 128))
785
- ]);
786
- }), 128))
787
- ])
788
- ])
789
- ])) : createCommentVNode("", true);
790
- }
791
- var DictTarget = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$3]]);
792
- const _sfc_main$3 = {
793
- props: {
794
- data: {
795
- type: Object,
796
- default: null
797
- }
798
- },
799
- data() {
800
- return {
801
- name: "Examples"
802
- };
803
- }
804
- };
805
- const _hoisted_1$3 = { key: 0 };
806
- const _hoisted_2$3 = { class: "card-body p-4" };
807
- const _hoisted_3$3 = { class: "card-title font-bold" };
808
- const _hoisted_4$3 = { class: "list-disc" };
809
- const _hoisted_5$2 = ["innerHTML"];
810
- function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
811
- return $props.data.examples && $props.data.examples.example ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
812
- createElementVNode("div", _hoisted_2$3, [
813
- createElementVNode("h2", _hoisted_3$3, toDisplayString($data.name), 1),
814
- createElementVNode("ul", _hoisted_4$3, [
815
- (openBlock(true), createElementBlock(Fragment, null, renderList($props.data.examples.example, (example, index) => {
816
- return openBlock(), createElementBlock("li", {
817
- key: `${example.definition_id}-${index}`,
818
- class: "ml-4 mb-2",
819
- innerHTML: example.text
820
- }, null, 8, _hoisted_5$2);
821
- }), 128))
2853
+ I("span", null, ne(s.gloss), 1),
2854
+ Ul,
2855
+ s.example ? (P(), V("small", Hl, '"' + ne(s.example) + '"', 1)) : ue("", !0)
2856
+ ]))), 128))
2857
+ ])
2858
+ ]))), 128))
2859
+ ])
822
2860
  ])
823
- ])
824
- ])) : createCommentVNode("", true);
825
- }
826
- var Example = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$2]]);
827
- const _sfc_main$2 = {
828
- props: {
829
- data: {
830
- type: Object,
831
- default: null
832
- }
833
- },
834
- data() {
835
- return {
836
- name: "Synonyms"
837
- };
2861
+ ]));
838
2862
  }
839
- };
840
- const _hoisted_1$2 = { key: 0 };
841
- const _hoisted_2$2 = { class: "card-body p-4" };
842
- const _hoisted_3$2 = { class: "card-title font-bold" };
843
- const _hoisted_4$2 = { class: "capitalize font-bold" };
844
- const _hoisted_5$1 = ["onClick"];
845
- const _hoisted_6 = /* @__PURE__ */ createElementVNode("span", null, null, -1);
846
- function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
847
- return $props.data.synsets ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
848
- createElementVNode("div", _hoisted_2$2, [
849
- createElementVNode("h2", _hoisted_3$2, toDisplayString($data.name), 1),
850
- createElementVNode("ul", null, [
851
- (openBlock(true), createElementBlock(Fragment, null, renderList($props.data.synsets, (dict, index) => {
852
- return openBlock(), createElementBlock("li", {
853
- key: `${dict.pos}-${index}`,
854
- class: "mb-2"
855
- }, [
856
- createElementVNode("h5", _hoisted_4$2, toDisplayString(dict.pos), 1),
857
- (openBlock(true), createElementBlock(Fragment, null, renderList(dict.entry, (entry, index2) => {
858
- return openBlock(), createElementBlock("div", {
859
- key: `${entry.definition_id}-${index2}`
860
- }, [
861
- (openBlock(true), createElementBlock(Fragment, null, renderList(entry.synonym, (synonym, index3) => {
862
- return openBlock(), createElementBlock("span", {
863
- key: `${synonym}-${index3}`
864
- }, [
865
- createElementVNode("span", {
866
- class: "badge bg-neutral mr-1",
867
- onClick: ($event) => _ctx.$emit("translate", synonym)
868
- }, toDisplayString(synonym), 9, _hoisted_5$1),
869
- _hoisted_6
870
- ]);
871
- }), 128))
872
- ]);
873
- }), 128))
874
- ]);
875
- }), 128))
2863
+ }, Gl = { class: "card border bg-white rounded-lg" }, ql = { class: "card-body p-4" }, Jl = /* @__PURE__ */ I("h2", { class: "card-title font-bold" }, "Examples", -1), Kl = { class: "list-disc list-outside ml-5" }, Yl = ["innerHTML"], Ql = {
2864
+ __name: "Example",
2865
+ setup(e) {
2866
+ const o = ye(), t = _(() => o.examples);
2867
+ return (n, l) => (P(), V("div", Gl, [
2868
+ I("div", ql, [
2869
+ Jl,
2870
+ I("ul", Kl, [
2871
+ (P(!0), V(X, null, ge(t.value, (r, i) => (P(), V("li", {
2872
+ key: `${r.definition_id}-${i}`,
2873
+ innerHTML: r
2874
+ }, null, 8, Yl))), 128))
2875
+ ])
876
2876
  ])
877
- ])
878
- ])) : createCommentVNode("", true);
879
- }
880
- var Syno = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1]]);
881
- const _sfc_main$1 = {
882
- props: {
883
- data: {
884
- type: Object,
885
- default: null
886
- }
887
- },
888
- data() {
889
- return {
890
- name: "See also"
891
- };
2877
+ ]));
892
2878
  }
893
- };
894
- const _hoisted_1$1 = { key: 0 };
895
- const _hoisted_2$1 = { class: "card-body p-4" };
896
- const _hoisted_3$1 = { class: "card-title font-bold" };
897
- const _hoisted_4$1 = ["onClick"];
898
- const _hoisted_5 = /* @__PURE__ */ createElementVNode("span", null, null, -1);
899
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
900
- return $props.data.related_words && $props.data.related_words.word ? (openBlock(), createElementBlock("div", _hoisted_1$1, [
901
- createElementVNode("div", _hoisted_2$1, [
902
- createElementVNode("h2", _hoisted_3$1, toDisplayString($data.name), 1),
903
- (openBlock(true), createElementBlock(Fragment, null, renderList($props.data.related_words.word, (word, index) => {
904
- return openBlock(), createElementBlock("span", {
905
- key: `${word}-${index}`
906
- }, [
907
- createElementVNode("span", {
908
- class: "badge bg-neutral",
909
- onClick: ($event) => _ctx.$emit("translate", word)
910
- }, toDisplayString(word), 9, _hoisted_4$1),
911
- _hoisted_5
912
- ]);
913
- }), 128))
914
- ])
915
- ])) : createCommentVNode("", true);
916
- }
917
- var More = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render]]);
918
- const _hoisted_1 = { class: "p-2" };
919
- const _hoisted_2 = { class: "mt-2 grid grid-cols-1 md:grid-cols-2 gap-3" };
920
- const _hoisted_3 = { class: "w-full" };
921
- const _hoisted_4 = { class: "w-full" };
922
- const __default__ = {
923
- name: "Popup",
2879
+ }, Zl = { class: "p-2 bg-neutral-100" }, Xl = { class: "mt-2 grid grid-cols-1 md:grid-cols-2 gap-3" }, es = { class: "w-full" }, ts = { class: "w-full" }, ns = {
2880
+ key: 0,
2881
+ class: "mt-3 grid grid-cols-1 md:grid-cols-3 gap-3"
2882
+ }, ss = {
2883
+ __name: "Popup",
924
2884
  props: {
925
- export_data: {
2885
+ opt: {
926
2886
  type: Object,
927
2887
  default: null
928
2888
  },
929
- export_select: {
2889
+ languages: {
930
2890
  type: Object,
931
2891
  default: null
932
2892
  },
933
- export_tts: {
2893
+ translation: {
934
2894
  type: Object,
935
2895
  default: null
936
2896
  }
937
2897
  },
938
- data() {
939
- return {
940
- data: null,
941
- select: null,
942
- tts: null,
943
- replace: ""
944
- };
945
- },
946
- computed: {
947
- rtl() {
948
- if (!this.data)
949
- return false;
950
- return helper.isRTL(this.data.target);
2898
+ emits: ["opt", "translate"],
2899
+ setup(e, { emit: o }) {
2900
+ var b;
2901
+ const t = Go(), n = ye(t), l = st(t), r = sn(t), i = e, s = o, a = S((b = i.translation) == null ? void 0 : b.text);
2902
+ j(
2903
+ () => i.translation,
2904
+ (m) => {
2905
+ r.loading = !1, n.init(m);
2906
+ },
2907
+ { immediate: !0 }
2908
+ ), j([() => i.opt, () => i.languages], ([m, w]) => {
2909
+ l.init(m, w);
2910
+ }), j([() => l.src, () => l.target], ([m, w]) => {
2911
+ s("opt", { src: m, target: w }), a.value && c();
2912
+ }), de(() => {
2913
+ l.init(i.opt, i.languages);
2914
+ });
2915
+ function u() {
2916
+ a.value = "", n.reset();
951
2917
  }
952
- },
953
- watch: {
954
- export_data(data) {
955
- this.data = data;
956
- if (data.text && this.replace != data.text)
957
- this.replace = data.text;
958
- },
959
- export_select(select) {
960
- this.select = select;
961
- },
962
- export_tts(tts) {
963
- this.tts = tts;
2918
+ function v(m) {
2919
+ m && (a.value = m, c());
964
2920
  }
965
- },
966
- methods: {
967
- clear() {
968
- this.data = null;
969
- this.$emit("clear");
970
- },
971
- translateReplace(input) {
972
- return this.translate(input, true);
973
- },
974
- translateSwap(input) {
975
- return this.translate(input, true, true);
976
- },
977
- translate(input, is_replace, is_swap) {
978
- if (is_swap) {
979
- if (!this.data.src || this.data.src === "auto" || !this.data.target) {
980
- return;
981
- }
982
- const select = JSON.parse(JSON.stringify(this.select));
983
- select.src = this.data.target;
984
- select.target = this.data.src;
985
- this.$emit("srctarget", select);
986
- }
987
- window.scrollTo(0, 0);
988
- this.clear();
989
- if (is_replace) {
990
- this.replace = input;
991
- }
992
- this.$emit("translate", input);
993
- },
994
- onSelect(select) {
995
- this.$emit("srctarget", select);
996
- if (this.data) {
997
- const input = this.data.sentences.map((sentence) => sentence.orig).join("");
998
- this.$emit("translate", input);
999
- }
2921
+ function c() {
2922
+ r.loading = !0, s("translate", {
2923
+ src: l.src,
2924
+ target: l.target,
2925
+ text: a.value
2926
+ });
1000
2927
  }
1001
- }
1002
- };
1003
- const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
1004
- setup(__props) {
1005
- return (_ctx, _cache) => {
1006
- return openBlock(), createElementBlock("div", _hoisted_1, [
1007
- createVNode(Selects, {
1008
- select: _ctx.select,
1009
- onSelect: _ctx.onSelect
1010
- }, null, 8, ["select", "onSelect"]),
1011
- createElementVNode("div", _hoisted_2, [
1012
- createElementVNode("div", _hoisted_3, [
1013
- createVNode(Input, {
1014
- data: _ctx.data,
1015
- tts: _ctx.tts,
1016
- replace: _ctx.replace,
1017
- onTranslate: _ctx.translate,
1018
- onClear: _ctx.clear
1019
- }, null, 8, ["data", "tts", "replace", "onTranslate", "onClear"])
1020
- ]),
1021
- createElementVNode("div", _hoisted_4, [
1022
- createVNode(Result, {
1023
- data: _ctx.data,
1024
- tts: _ctx.tts
1025
- }, null, 8, ["data", "tts"])
1026
- ])
2928
+ return (m, w) => (P(), V("div", Zl, [
2929
+ H(Qo),
2930
+ I("div", Xl, [
2931
+ I("div", es, [
2932
+ H($l, {
2933
+ text: a.value,
2934
+ onChange: v,
2935
+ onClear: u
2936
+ }, null, 8, ["text"])
1027
2937
  ]),
1028
- _ctx.data ? (openBlock(), createElementBlock("div", {
1029
- key: 0,
1030
- class: "mt-3 grid grid-cols-1 md:grid-cols-3 gap-3",
1031
- style: normalizeStyle({ "text-align": _ctx.rtl ? "right" : "left" })
1032
- }, [
1033
- createVNode(DictSrc, {
1034
- class: "card border",
1035
- data: _ctx.data
1036
- }, null, 8, ["data"]),
1037
- createVNode(DictTarget, {
1038
- class: "card border",
1039
- data: _ctx.data,
1040
- onTranslate: _ctx.translateSwap
1041
- }, null, 8, ["data", "onTranslate"]),
1042
- createVNode(Syno, {
1043
- class: "card border",
1044
- data: _ctx.data,
1045
- onTranslate: _ctx.translateReplace
1046
- }, null, 8, ["data", "onTranslate"]),
1047
- createVNode(More, {
1048
- class: "card border",
1049
- data: _ctx.data,
1050
- onTranslate: _ctx.translateReplace
1051
- }, null, 8, ["data", "onTranslate"])
1052
- ], 4)) : createCommentVNode("", true),
1053
- _ctx.data ? (openBlock(), createElementBlock("div", {
1054
- key: 1,
1055
- class: "mt-5 grid grid-cols-1 gap-6",
1056
- style: normalizeStyle({ "text-align": _ctx.rtl ? "right" : "left" })
1057
- }, [
1058
- createVNode(Example, {
1059
- class: "card border",
1060
- data: _ctx.data
1061
- }, null, 8, ["data"])
1062
- ], 4)) : createCommentVNode("", true)
1063
- ]);
1064
- };
2938
+ I("div", ts, [
2939
+ H(Tl)
2940
+ ])
2941
+ ]),
2942
+ i.translation ? (P(), V("div", ns, [
2943
+ H(Ml),
2944
+ H(Wl),
2945
+ H(Ql)
2946
+ ])) : ue("", !0)
2947
+ ]));
1065
2948
  }
1066
- });
1067
- export { _sfc_main as default };
2949
+ };
2950
+ export {
2951
+ ss as default
2952
+ };