inertia-bootstrap-forms 3.0.2 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.fa.md +86 -6
  2. package/README.md +95 -8
  3. package/dist/chunks/UppyInput-Dt8CPfgC.js +210 -0
  4. package/dist/chunks/UppyInput-ldc834tZ.cjs +1 -0
  5. package/dist/chunks/_plugin-vue_export-helper-13TPlHFF.js +81 -0
  6. package/dist/chunks/_plugin-vue_export-helper-BHyUve4F.cjs +1 -0
  7. package/dist/chunks/http-CDPNmbjF.cjs +1 -0
  8. package/dist/chunks/http-DV3dRBe5.js +158 -0
  9. package/dist/country-codes.cjs +1 -0
  10. package/dist/country-codes.js +245 -0
  11. package/dist/dropzone.cjs +1 -0
  12. package/dist/dropzone.js +81 -0
  13. package/dist/editor.cjs +1 -0
  14. package/dist/editor.js +52 -0
  15. package/dist/index.cjs +1 -0
  16. package/dist/index.js +3128 -0
  17. package/dist/location.cjs +1 -0
  18. package/dist/location.js +84 -0
  19. package/dist/persian-date.cjs +1 -0
  20. package/dist/persian-date.js +73 -0
  21. package/dist/tel.cjs +1 -0
  22. package/dist/tel.js +85 -0
  23. package/dist/uppy-dashboard.cjs +1 -0
  24. package/dist/uppy-dashboard.js +31 -0
  25. package/dist/uppy.cjs +1 -0
  26. package/dist/uppy.js +4 -0
  27. package/index.d.ts +44 -30
  28. package/package.json +99 -16
  29. package/src/CheckboxToggle.vue +1 -1
  30. package/src/ComboboxInput.vue +495 -496
  31. package/src/PasswordInput.vue +124 -123
  32. package/src/StarRatingInput.vue +1 -1
  33. package/src/UppyDashboardInput.vue +45 -0
  34. package/src/UppyInput.vue +36 -3
  35. package/src/VoiceRecorderInput.vue +657 -0
  36. package/src/entries/country-codes.js +1 -0
  37. package/src/entries/dropzone.js +1 -0
  38. package/src/entries/editor.js +1 -0
  39. package/src/entries/location.js +1 -0
  40. package/src/entries/persian-date.js +1 -0
  41. package/src/entries/tel.js +1 -0
  42. package/src/entries/uppy-dashboard.js +1 -0
  43. package/src/entries/uppy.js +1 -0
  44. package/src/index.js +3 -19
  45. package/types/country-codes.d.ts +1 -0
  46. package/types/dropzone.d.ts +2 -0
  47. package/types/editor.d.ts +2 -0
  48. package/types/location.d.ts +2 -0
  49. package/types/persian-date.d.ts +2 -0
  50. package/types/tel.d.ts +2 -0
  51. package/types/uppy-dashboard.d.ts +12 -0
  52. package/types/uppy.d.ts +10 -0
  53. package/dist/inertia-bootstrap-forms.cjs.js +0 -1
  54. package/dist/inertia-bootstrap-forms.es.js +0 -3536
  55. package/src/RangeSliderInput.vue +0 -103
  56. package/src/Select2Input.vue +0 -251
package/dist/index.js ADDED
@@ -0,0 +1,3128 @@
1
+ import * as Ke from "vue";
2
+ import { defineComponent as V, createElementBlock as v, openBlock as c, normalizeClass as D, renderSlot as F, createElementVNode as m, createCommentVNode as B, toDisplayString as O, computed as C, withDirectives as te, vModelText as nt, normalizeStyle as oe, ref as E, onMounted as Z, watch as z, vModelDynamic as $e, createTextVNode as Y, shallowRef as dt, onBeforeUnmount as ft, nextTick as K, Fragment as X, renderList as ee, reactive as ye, resolveComponent as re, createBlock as be, mergeProps as je, withModifiers as Xe, provide as Ae, inject as ce, withCtx as Pe, createVNode as Ge, h as ct, vModelCheckbox as mt } from "vue";
3
+ import { _ as q, f as j, u as R } from "./chunks/_plugin-vue_export-helper-13TPlHFF.js";
4
+ import { u as G, a as De, l as Oe, c as pt } from "./chunks/http-DV3dRBe5.js";
5
+ import { useForm as ht } from "@inertiajs/vue3";
6
+ const vt = "۰۱۲۳۴۵۶۷۸۹", gt = "٠١٢٣٤٥٦٧٨٩";
7
+ function Ue(e) {
8
+ return String(e ?? "").replace(/[۰-۹٠-٩]/g, (t) => {
9
+ const o = vt.indexOf(t);
10
+ return String(o !== -1 ? o : gt.indexOf(t));
11
+ });
12
+ }
13
+ function Ne(e) {
14
+ if (e == null || e === "") return "";
15
+ const t = Number(e);
16
+ return Number.isNaN(t) ? "" : t.toLocaleString("en-US");
17
+ }
18
+ function lt(e) {
19
+ const t = Ue(e).replace(/\D/g, "");
20
+ return t === "" ? null : parseInt(t, 10);
21
+ }
22
+ const yt = V({
23
+ name: "AmountInput",
24
+ emits: ["update:modelValue", "change", "input", "focus", "blur"],
25
+ props: {
26
+ ...j,
27
+ placeholder: { type: String, default: null },
28
+ unit: { type: String, default: null },
29
+ min: { type: Number, default: null },
30
+ max: { type: Number, default: null },
31
+ inputClass: { type: [String, Array, Object], default: null },
32
+ size: { type: String, default: null },
33
+ locale: { type: String, default: null }
34
+ },
35
+ setup(e, { emit: t }) {
36
+ const o = R(e, t), { t: l } = G(() => e.locale), d = C(() => Ne(o.model.value)), u = C(() => e.unit ?? l("amount.unit")), n = C(() => e.size ? `form-control-${e.size}` : null);
37
+ function p(b) {
38
+ const w = b.target, $ = w.value.slice(0, w.selectionStart ?? 0), k = Ue($).replace(/\D/g, "").length, M = lt(w.value);
39
+ o.model.value = M;
40
+ const r = Ne(M);
41
+ w.value = r;
42
+ let s = 0, i = 0;
43
+ for (; s < r.length && i < k; )
44
+ /\d/.test(r[s]) && i++, s++;
45
+ document.activeElement === w && w.setSelectionRange(s, s), t("input", M, b);
46
+ }
47
+ function h(b) {
48
+ let w = o.model.value;
49
+ w != null && (e.max !== null && w > e.max && (w = e.max), e.min !== null && w < e.min && (w = e.min), w !== o.model.value && (o.model.value = w)), o.emitChange(w, b);
50
+ }
51
+ return { ...o, displayValue: d, unitText: u, sizeClass: n, onInput: p, clamp: h, t: l };
52
+ }
53
+ }), bt = ["name", "id", "value", "placeholder", "required", "readonly", "disabled", "aria-invalid"], $t = {
54
+ key: 0,
55
+ class: "input-group-text fanum"
56
+ };
57
+ function wt(e, t, o, l, d, u) {
58
+ return c(), v("div", {
59
+ class: D(["input-group", { "is-invalid": e.isInvalid }])
60
+ }, [
61
+ F(e.$slots, "prefix"),
62
+ m("input", {
63
+ name: e.name,
64
+ id: e.inputId,
65
+ value: e.displayValue,
66
+ placeholder: e.placeholder ?? e.t("amount.placeholder"),
67
+ required: e.required,
68
+ readonly: e.readonly,
69
+ disabled: e.isDisabled,
70
+ "aria-invalid": e.isInvalid || void 0,
71
+ type: "tel",
72
+ inputmode: "numeric",
73
+ autocomplete: "off",
74
+ class: D(["form-control fanum", [e.sizeClass, e.inputClass, { "is-invalid": e.isInvalid }]]),
75
+ onInput: t[0] || (t[0] = (...n) => e.onInput && e.onInput(...n)),
76
+ onChange: t[1] || (t[1] = (...n) => e.clamp && e.clamp(...n)),
77
+ onFocus: t[2] || (t[2] = (n) => e.$emit("focus", n)),
78
+ onBlur: t[3] || (t[3] = (n) => e.$emit("blur", n))
79
+ }, null, 42, bt),
80
+ e.unitText ? (c(), v("span", $t, O(e.unitText), 1)) : B("", !0),
81
+ F(e.$slots, "suffix")
82
+ ], 2);
83
+ }
84
+ const kt = /* @__PURE__ */ q(yt, [["render", wt]]), St = V({
85
+ name: "CaptchaInput",
86
+ emits: ["update:modelValue", "change", "input", "refresh"],
87
+ props: {
88
+ ...j,
89
+ name: { type: String, default: "captcha" },
90
+ /** Endpoint that returns the captcha image. */
91
+ url: { type: String, default: "/captcha/default" },
92
+ placeholder: { type: String, default: null },
93
+ /** Reload the image (and clear the input) when a submit finishes. */
94
+ refreshOnSubmit: { type: Boolean, default: !0 },
95
+ imageWidth: { type: [Number, String], default: 82 },
96
+ imageHeight: { type: [Number, String], default: 38 },
97
+ locale: { type: String, default: null }
98
+ },
99
+ setup(e, { emit: t, expose: o }) {
100
+ const l = R(e, t), { t: d } = G(() => e.locale), u = De(), n = E(null), p = E(!0);
101
+ function h() {
102
+ p.value = !0, n.value = `${e.url}${e.url.includes("?") ? "&" : "?"}t=${Date.now()}`, u.timeout(() => {
103
+ p.value = !1;
104
+ }, 500), t("refresh");
105
+ }
106
+ return Z(h), z(
107
+ () => {
108
+ var b;
109
+ return (b = l.form.value) == null ? void 0 : b.processing;
110
+ },
111
+ (b, w) => {
112
+ e.refreshOnSubmit && w && !b && (l.model.value = null, h());
113
+ }
114
+ ), o({ refresh: h }), { ...l, t: d, src: n, loading: p, refresh: h };
115
+ }
116
+ }), It = ["name", "id", "placeholder", "required", "readonly", "disabled", "aria-invalid"], Ct = ["src", "alt", "width", "height"], Mt = {
117
+ key: 1,
118
+ class: "placeholder-wave w-100",
119
+ "aria-hidden": "true"
120
+ }, Tt = ["disabled", "aria-label"];
121
+ function Bt(e, t, o, l, d, u) {
122
+ return c(), v("div", {
123
+ class: D(["input-group captcha", { "is-invalid": e.isInvalid }])
124
+ }, [
125
+ te(m("input", {
126
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => e.model = n),
127
+ name: e.name,
128
+ id: e.inputId,
129
+ type: "text",
130
+ inputmode: "numeric",
131
+ autocomplete: "off",
132
+ placeholder: e.placeholder ?? e.t("captcha.placeholder"),
133
+ required: e.required,
134
+ readonly: e.readonly,
135
+ disabled: e.isDisabled,
136
+ "aria-invalid": e.isInvalid || void 0,
137
+ class: D(["form-control text-start", { "is-invalid": e.isInvalid }]),
138
+ onInput: t[1] || (t[1] = (n) => e.$emit("input", e.model, n)),
139
+ onChange: t[2] || (t[2] = (n) => e.emitChange(e.model, n))
140
+ }, null, 42, It), [
141
+ [nt, e.model]
142
+ ]),
143
+ m("span", {
144
+ class: "input-group-text p-0 overflow-hidden",
145
+ style: oe({ width: e.imageWidth + "px", height: "auto" })
146
+ }, [
147
+ e.src && !e.loading ? (c(), v("img", {
148
+ key: 0,
149
+ src: e.src,
150
+ alt: e.t("captcha.alt"),
151
+ width: e.imageWidth,
152
+ height: e.imageHeight,
153
+ class: "captcha-holder",
154
+ style: { cursor: "pointer", objectFit: "contain" },
155
+ onClick: t[3] || (t[3] = (...n) => e.refresh && e.refresh(...n))
156
+ }, null, 8, Ct)) : (c(), v("span", Mt, [
157
+ m("span", {
158
+ class: "placeholder w-100",
159
+ style: oe({ height: e.imageHeight + "px" })
160
+ }, null, 4)
161
+ ]))
162
+ ], 4),
163
+ m("button", {
164
+ type: "button",
165
+ class: "btn-outline theme-secondary btn-icon",
166
+ disabled: e.isDisabled || e.loading,
167
+ "aria-label": e.t("captcha.refresh"),
168
+ onClick: t[4] || (t[4] = (...n) => e.refresh && e.refresh(...n))
169
+ }, t[5] || (t[5] = [
170
+ m("svg", {
171
+ width: "16",
172
+ height: "16",
173
+ viewBox: "0 0 16 16",
174
+ fill: "none",
175
+ stroke: "currentColor",
176
+ "stroke-width": "1.5",
177
+ "stroke-linecap": "round",
178
+ "stroke-linejoin": "round",
179
+ "aria-hidden": "true"
180
+ }, [
181
+ m("path", { d: "M13.5 3v3.5H10M2.5 13V9.5H6" }),
182
+ m("path", { d: "M3.2 6.5A5.5 5.5 0 0 1 13 6.5M12.8 9.5A5.5 5.5 0 0 1 3 9.5" })
183
+ ], -1)
184
+ ]), 8, Tt)
185
+ ], 2);
186
+ }
187
+ const Et = /* @__PURE__ */ q(St, [["render", Bt]]);
188
+ function Ve(e, t, o, { type: l = () => e.type } = {}) {
189
+ function d() {
190
+ if (!e.checked) return;
191
+ const n = t.model.value;
192
+ l() === "radio" ? (n == null || n === "") && (t.model.value = e.value) : Array.isArray(n) ? n.includes(e.value) || (t.model.value = [...n, e.value]) : n || (t.model.value = e.trueValue !== void 0 ? e.trueValue : !0);
193
+ }
194
+ function u() {
195
+ o.value && (o.value.indeterminate = !!e.indeterminate);
196
+ }
197
+ return Z(() => {
198
+ d(), u();
199
+ }), z(() => e.indeterminate, u), { applyInitialChecked: d };
200
+ }
201
+ const At = V({
202
+ name: "CheckboxButtonInput",
203
+ emits: ["update:modelValue", "change", "focus", "blur"],
204
+ props: {
205
+ ...j,
206
+ type: { type: String, default: "radio", validator: (e) => ["checkbox", "radio"].includes(e) },
207
+ value: { type: [String, Number, Boolean, Object], default: "yes" },
208
+ trueValue: { type: null, default: !0 },
209
+ falseValue: { type: null, default: !1 },
210
+ checked: { type: Boolean, default: !1 },
211
+ /** solid | outline | subtle | text | styled */
212
+ variant: { type: String, default: "outline" },
213
+ theme: { type: String, default: "primary" }
214
+ },
215
+ setup(e, { emit: t }) {
216
+ const o = E(null), l = R(e, t, { valued: () => e.value });
217
+ return Ve(e, l, o), { ...l, input: o, onChange: (d) => l.emitChange(l.model.value, d) };
218
+ },
219
+ expose: ["input"]
220
+ }), Ot = ["name", "type", "value", "true-value", "false-value", "required", "disabled", "aria-invalid"];
221
+ function Nt(e, t, o, l, d, u) {
222
+ return c(), v("label", {
223
+ class: D(["btn-check", [`btn-${e.variant}`, `theme-${e.theme}`, { "is-invalid": e.isInvalid, disabled: e.isDisabled }]])
224
+ }, [
225
+ te(m("input", {
226
+ ref: "input",
227
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => e.model = n),
228
+ name: e.name,
229
+ type: e.type,
230
+ value: e.value,
231
+ "true-value": e.trueValue,
232
+ "false-value": e.falseValue,
233
+ required: e.required,
234
+ disabled: e.isDisabled,
235
+ "aria-invalid": e.isInvalid || void 0,
236
+ autocomplete: "off",
237
+ class: D({ "is-invalid": e.isInvalid }),
238
+ onChange: t[1] || (t[1] = (...n) => e.onChange && e.onChange(...n)),
239
+ onFocus: t[2] || (t[2] = (n) => e.$emit("focus", n)),
240
+ onBlur: t[3] || (t[3] = (n) => e.$emit("blur", n))
241
+ }, null, 42, Ot), [
242
+ [$e, e.model]
243
+ ]),
244
+ F(e.$slots, "default")
245
+ ], 2);
246
+ }
247
+ const Dt = /* @__PURE__ */ q(At, [["render", Nt]]), Vt = V({
248
+ name: "CheckboxInput",
249
+ emits: ["update:modelValue", "change", "focus", "blur"],
250
+ props: {
251
+ ...j,
252
+ /** checkbox | radio */
253
+ type: { type: String, default: "checkbox", validator: (e) => ["checkbox", "radio"].includes(e) },
254
+ /** Value added to the model (arrays / radios) when this option is checked. */
255
+ value: { type: [String, Number, Boolean, Object], default: "yes" },
256
+ trueValue: { type: null, default: !0 },
257
+ falseValue: { type: null, default: !1 },
258
+ /** Initial checked state (applied only when the model is still empty). */
259
+ checked: { type: Boolean, default: !1 },
260
+ indeterminate: { type: Boolean, default: !1 },
261
+ label: { type: String, default: null }
262
+ },
263
+ setup(e, { emit: t }) {
264
+ const o = E(null), l = R(e, t, { valued: () => e.value });
265
+ Ve(e, l, o);
266
+ function d(u) {
267
+ l.emitChange(l.model.value, u);
268
+ }
269
+ return { ...l, input: o, onChange: d };
270
+ },
271
+ expose: ["input"]
272
+ }), qt = { class: "form-field" }, Ft = ["name", "id", "type", "value", "true-value", "false-value", "required", "disabled", "aria-invalid"], Lt = ["for"];
273
+ function jt(e, t, o, l, d, u) {
274
+ return c(), v("div", qt, [
275
+ te(m("input", {
276
+ ref: "input",
277
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => e.model = n),
278
+ name: e.name,
279
+ id: e.inputId,
280
+ type: e.type,
281
+ value: e.value,
282
+ "true-value": e.trueValue,
283
+ "false-value": e.falseValue,
284
+ required: e.required,
285
+ disabled: e.isDisabled,
286
+ "aria-invalid": e.isInvalid || void 0,
287
+ class: D([e.type === "radio" ? "radio" : "check", { "is-invalid": e.isInvalid }]),
288
+ onClick: t[1] || (t[1] = (n) => e.readonly && n.preventDefault()),
289
+ onChange: t[2] || (t[2] = (...n) => e.onChange && e.onChange(...n)),
290
+ onFocus: t[3] || (t[3] = (n) => e.$emit("focus", n)),
291
+ onBlur: t[4] || (t[4] = (n) => e.$emit("blur", n))
292
+ }, null, 42, Ft), [
293
+ [$e, e.model]
294
+ ]),
295
+ m("label", { for: e.inputId }, [
296
+ F(e.$slots, "default", {}, () => [
297
+ Y(O(e.label), 1)
298
+ ])
299
+ ], 8, Lt)
300
+ ]);
301
+ }
302
+ const Rt = /* @__PURE__ */ q(Vt, [["render", jt]]), zt = V({
303
+ name: "CheckboxToggle",
304
+ emits: ["update:modelValue", "change", "focus", "blur"],
305
+ props: {
306
+ ...j,
307
+ type: { type: String, default: "checkbox", validator: (e) => ["checkbox", "radio"].includes(e) },
308
+ value: { type: [String, Number, Boolean, Object], default: "yes" },
309
+ trueValue: { type: null, default: !0 },
310
+ falseValue: { type: null, default: !1 },
311
+ checked: { type: Boolean, default: !1 },
312
+ /** Visually hide the check mark (the card highlight is the only indicator). */
313
+ hideInput: { type: Boolean, default: !1 },
314
+ formField: { type: Boolean, default: !0 },
315
+ formFieldCard: { type: Boolean, default: !0 }
316
+ },
317
+ setup(e, { emit: t }) {
318
+ const o = E(null), l = R(e, t, { valued: () => e.value });
319
+ return Ve(e, l, o), { ...l, input: o, onChange: (d) => l.emitChange(l.model.value, d) };
320
+ },
321
+ expose: ["input"]
322
+ }), Pt = ["name", "id", "type", "value", "true-value", "false-value", "required", "disabled", "aria-invalid"], Ut = ["for"];
323
+ function Ht(e, t, o, l, d, u) {
324
+ return c(), v("div", {
325
+ class: D({
326
+ "form-field": e.formField,
327
+ "form-field-card": e.formFieldCard,
328
+ "is-invalid": e.isInvalid,
329
+ disabled: e.isDisabled || e.readonly
330
+ })
331
+ }, [
332
+ te(m("input", {
333
+ ref: "input",
334
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => e.model = n),
335
+ name: e.name,
336
+ id: e.inputId,
337
+ type: e.type,
338
+ value: e.value,
339
+ "true-value": e.trueValue,
340
+ "false-value": e.falseValue,
341
+ required: e.required,
342
+ disabled: e.isDisabled,
343
+ "aria-invalid": e.isInvalid || void 0,
344
+ class: D([e.type === "radio" ? "radio" : "check", { "is-invalid": e.isInvalid, "visually-hidden": e.hideInput }]),
345
+ onClick: t[1] || (t[1] = (n) => e.readonly && n.preventDefault()),
346
+ onChange: t[2] || (t[2] = (...n) => e.onChange && e.onChange(...n)),
347
+ onFocus: t[3] || (t[3] = (n) => e.$emit("focus", n)),
348
+ onBlur: t[4] || (t[4] = (n) => e.$emit("blur", n))
349
+ }, null, 42, Pt), [
350
+ [$e, e.model]
351
+ ]),
352
+ m("label", { for: e.inputId }, [
353
+ F(e.$slots, "default")
354
+ ], 8, Ut)
355
+ ], 2);
356
+ }
357
+ const Kt = /* @__PURE__ */ q(zt, [["render", Ht]]), Re = {}, ge = /* @__PURE__ */ new Map(), We = {
358
+ Combobox: () => import("bootstrap/js/dist/combobox.js"),
359
+ Menu: () => import("bootstrap/js/dist/menu.js"),
360
+ Strength: () => import("bootstrap/js/dist/strength.js"),
361
+ Chips: () => import("bootstrap/js/dist/chips.js"),
362
+ OtpInput: () => import("bootstrap/js/dist/otp-input.js"),
363
+ Range: () => import("bootstrap/js/dist/range.js")
364
+ };
365
+ function Xt(e = {}) {
366
+ Object.assign(Re, e), ge.clear();
367
+ }
368
+ function Gt(e) {
369
+ return Re[e] ? Promise.resolve(Re[e]) : We[e] ? (ge.has(e) || ge.set(
370
+ e,
371
+ We[e]().then((t) => t.default ?? t[e]).catch((t) => {
372
+ throw ge.delete(e), t;
373
+ })
374
+ ), ge.get(e)) : Promise.reject(new Error(`[inertia-bootstrap-forms] Unknown Bootstrap plugin "${e}"`));
375
+ }
376
+ function me(e, t, o, l = {}) {
377
+ const d = dt(null);
378
+ let u = 0, n = !1, p = null;
379
+ function h() {
380
+ var $;
381
+ u++;
382
+ const w = d.value;
383
+ if (d.value = null, w) {
384
+ try {
385
+ ($ = l.onDestroy) == null || $.call(l, w, p);
386
+ } catch {
387
+ }
388
+ try {
389
+ w.dispose();
390
+ } catch {
391
+ }
392
+ }
393
+ p = null;
394
+ }
395
+ async function b() {
396
+ var r, s, i;
397
+ h();
398
+ const w = u, $ = await Gt(e);
399
+ if (n || w !== u) return null;
400
+ const k = t();
401
+ if (!k) return null;
402
+ (s = (r = $.getInstance) == null ? void 0 : r.call($, k)) == null || s.dispose(), p = k;
403
+ const M = new $(k, o());
404
+ return d.value = M, (i = l.onCreate) == null || i.call(l, M, k), M;
405
+ }
406
+ return Z(() => {
407
+ n = !1, b().catch((w) => {
408
+ console.error(`[inertia-bootstrap-forms] Could not start Bootstrap ${e}.`, w);
409
+ });
410
+ }), ft(() => {
411
+ n = !0, h();
412
+ }), { instance: d, create: b, destroy: h };
413
+ }
414
+ const Qe = (e, t) => e.length === t.length && e.every((o, l) => o === t[l]), Wt = V({
415
+ name: "ChipsInput",
416
+ emits: ["update:modelValue", "change", "add", "remove", "select", "rejected", "focus", "blur"],
417
+ props: {
418
+ ...j,
419
+ placeholder: { type: String, default: null },
420
+ /** Character that splits typed / pasted text into chips. Use null to disable. */
421
+ separator: { type: String, default: "," },
422
+ allowDuplicates: { type: Boolean, default: !1 },
423
+ maxChips: { type: Number, default: null },
424
+ dismissible: { type: Boolean, default: !0 },
425
+ /** HTML / SVG of the remove icon (sanitised by Bootstrap). */
426
+ dismissIcon: { type: String, default: null },
427
+ /** Turn the pending text into a chip when the input loses focus. */
428
+ createOnBlur: { type: Boolean, default: !0 },
429
+ /** (value: string) => boolean — return false to reject a chip. */
430
+ validator: { type: Function, default: null },
431
+ locale: { type: String, default: null }
432
+ },
433
+ setup(e, { emit: t, expose: o }) {
434
+ const l = R(e, t), { t: d } = G(() => e.locale), u = E(null), n = E(null);
435
+ let p = !1, h = [];
436
+ const b = (r) => Array.isArray(r) ? r.map(String) : typeof r == "string" && r !== "" ? e.separator ? r.split(e.separator).map((s) => s.trim()).filter(Boolean) : [r] : [];
437
+ function w() {
438
+ const r = k.value;
439
+ if (!r) return;
440
+ const s = b(l.model.value);
441
+ if (Qe(r.getValues(), s)) return;
442
+ p = !0;
443
+ try {
444
+ r.clear(), s.forEach((f) => r.add(f));
445
+ } finally {
446
+ p = !1;
447
+ }
448
+ const i = r.getValues();
449
+ !Qe(i, s) && Array.isArray(l.model.value) && (l.model.value = i);
450
+ }
451
+ const $ = () => e.readonly || l.isDisabled.value, { instance: k, create: M } = me(
452
+ "Chips",
453
+ () => u.value,
454
+ () => {
455
+ const r = {
456
+ separator: e.separator,
457
+ allowDuplicates: e.allowDuplicates,
458
+ maxChips: e.maxChips,
459
+ dismissible: e.dismissible && !$(),
460
+ createOnBlur: e.createOnBlur,
461
+ placeholder: e.placeholder ?? d("chips.placeholder")
462
+ };
463
+ return e.dismissIcon && (r.dismissIcon = e.dismissIcon), r;
464
+ },
465
+ {
466
+ onCreate(r, s) {
467
+ const i = (f, I) => {
468
+ s.addEventListener(f, I), h.push(() => s.removeEventListener(f, I));
469
+ };
470
+ i("add.bs.chips", (f) => {
471
+ if (!p) {
472
+ if (e.validator && !e.validator(f.value)) {
473
+ f.preventDefault(), t("rejected", f.value);
474
+ return;
475
+ }
476
+ t("add", f.value);
477
+ }
478
+ }), i("remove.bs.chips", (f) => !p && t("remove", f.value)), i("select.bs.chips", (f) => t("select", f.selected)), i("change.bs.chips", (f) => {
479
+ p || (l.model.value = f.values, l.emitChange(f.values, f));
480
+ }), w();
481
+ },
482
+ onDestroy() {
483
+ h.forEach((r) => r()), h = [];
484
+ }
485
+ }
486
+ );
487
+ return z(() => l.model.value, w, { deep: !0 }), z(
488
+ () => [e.separator, e.allowDuplicates, e.maxChips, e.dismissible, e.createOnBlur, e.dismissIcon, e.readonly, l.isDisabled.value],
489
+ async () => {
490
+ await K(), M();
491
+ }
492
+ ), o({
493
+ add: (r) => {
494
+ var s;
495
+ return (s = k.value) == null ? void 0 : s.add(r);
496
+ },
497
+ remove: (r) => {
498
+ var s;
499
+ return (s = k.value) == null ? void 0 : s.remove(r);
500
+ },
501
+ clear: () => {
502
+ var r;
503
+ return (r = k.value) == null ? void 0 : r.clear();
504
+ },
505
+ focus: () => {
506
+ var r;
507
+ return (r = n.value) == null ? void 0 : r.focus();
508
+ }
509
+ }), { ...l, t: d, el: u, ghost: n, locked: $ };
510
+ }
511
+ }), Qt = ["aria-disabled"], Jt = ["id", "placeholder", "disabled", "readonly", "aria-invalid"];
512
+ function Zt(e, t, o, l, d, u) {
513
+ return c(), v("div", {
514
+ ref: "el",
515
+ class: "chip-input",
516
+ "aria-disabled": e.isDisabled || void 0
517
+ }, [
518
+ m("input", {
519
+ ref: "ghost",
520
+ type: "text",
521
+ class: D(["form-ghost", { "is-invalid": e.isInvalid }]),
522
+ id: e.inputId,
523
+ placeholder: e.placeholder ?? e.t("chips.placeholder"),
524
+ disabled: e.isDisabled,
525
+ readonly: e.readonly,
526
+ "aria-invalid": e.isInvalid || void 0,
527
+ autocomplete: "off",
528
+ onFocus: t[0] || (t[0] = (n) => e.$emit("focus", n)),
529
+ onBlur: t[1] || (t[1] = (n) => e.$emit("blur", n))
530
+ }, null, 42, Jt)
531
+ ], 8, Qt);
532
+ }
533
+ const Yt = /* @__PURE__ */ q(Wt, [["render", Zt]]), fe = (e) => e !== null && typeof e == "object", Je = (e) => e == null || e === "";
534
+ function xt() {
535
+ if (typeof document > "u") return null;
536
+ const e = document.cookie.match(/(?:^|;\s*)XSRF-TOKEN=([^;]+)/);
537
+ return e ? decodeURIComponent(e[1]) : null;
538
+ }
539
+ const _t = V({
540
+ name: "ComboboxInput",
541
+ emits: [
542
+ "update:modelValue",
543
+ "change",
544
+ "selected",
545
+ "clear",
546
+ "search",
547
+ "search-success",
548
+ "search-error",
549
+ "show",
550
+ "shown",
551
+ "hide",
552
+ "hidden"
553
+ ],
554
+ props: {
555
+ ...j,
556
+ /** Strings, numbers or objects ({ id | value, name | label, description, disabled }). */
557
+ options: { type: Array, default: () => [] },
558
+ /** Property that holds the value of an option object (default: id → value → name → label). */
559
+ valueKey: { type: String, default: null },
560
+ /** Property that holds the label of an option object (default: name → label → title → value). */
561
+ labelKey: { type: String, default: null },
562
+ /** Legacy alias of `labelKey`. */
563
+ label: { type: String, default: null },
564
+ descriptionKey: { type: String, default: "description" },
565
+ multiple: { type: Boolean, default: !1 },
566
+ placeholder: { type: String, default: null },
567
+ /** Show a client-side search box. */
568
+ searchEnabled: { type: Boolean, default: !1 },
569
+ searchPlaceholder: { type: String, default: null },
570
+ /**
571
+ * Remote search: { url, method = 'POST', param = 'query', debounce = 400, minChars = 0, headers = {}, resultsKey }.
572
+ * The endpoint must answer with a JSON array (or { data: [] }).
573
+ */
574
+ search: { type: Object, default: () => ({ url: null }) },
575
+ /** Add an entry at the top of a single select that clears the value. */
576
+ clearable: { type: Boolean, default: !1 },
577
+ clearText: { type: String, default: null },
578
+ noResultsText: { type: String, default: null },
579
+ loadingText: { type: String, default: null },
580
+ /** Text of a multiple select when more than one item is chosen. `{count}` is replaced. */
581
+ selectedText: { type: String, default: null },
582
+ /**
583
+ * Multiple select only: show the chosen options themselves (true) instead of the
584
+ * "N selected" counter (false, default).
585
+ */
586
+ showSelected: { type: Boolean, default: !1 },
587
+ /** With `showSelected`: above this many chosen options the counter is shown instead. */
588
+ maxVisible: { type: Number, default: null },
589
+ /** Separator between the chosen labels (default: "، " for fa, ", " otherwise). */
590
+ selectedSeparator: { type: String, default: null },
591
+ searchNormalize: { type: Boolean, default: !1 },
592
+ /** Floating UI placement of the menu. */
593
+ placement: { type: String, default: "bottom-start" },
594
+ size: { type: String, default: null },
595
+ /** Hide the caret icon. */
596
+ hideDropdown: { type: Boolean, default: !1 },
597
+ locale: { type: String, default: null }
598
+ },
599
+ setup(e, { emit: t, expose: o, slots: l }) {
600
+ const d = R(e, t), { t: u, locale: n } = G(() => e.locale), p = De(), h = E(null), b = E(null), w = E(null), $ = E(null), k = E(null), M = E({}), r = ye({ results: null, loading: !1, error: !1 }), s = C(() => {
601
+ var a;
602
+ return ((a = e.search) == null ? void 0 : a.url) || null;
603
+ }), i = C(() => e.searchEnabled || !!s.value), f = (a) => fe(a) ? e.valueKey ? a[e.valueKey] : a.id ?? a.value ?? a.name ?? a.label : a, I = (a) => {
604
+ if (!fe(a)) return a;
605
+ const g = e.labelKey || e.label;
606
+ return (g ? a[g] : a.name ?? a.label ?? a.title ?? a.value) ?? f(a);
607
+ }, L = (a) => fe(a) ? a[e.descriptionKey] ?? null : null, T = (a) => String(f(a));
608
+ function W(a) {
609
+ const g = { ...M.value };
610
+ (a || []).forEach((S) => {
611
+ g[T(S)] = S;
612
+ }), M.value = g;
613
+ }
614
+ z(() => e.options, (a) => W(a), { immediate: !0, deep: !0 });
615
+ const se = C(() => {
616
+ const a = d.model.value;
617
+ return e.multiple ? Array.isArray(a) ? a : fe(a) ? Object.values(a) : Je(a) ? [] : [a] : Je(a) ? [] : [a];
618
+ }), P = C(() => se.value.map((a) => fe(a) ? T(a) : String(a))), we = (a) => {
619
+ const g = M.value[a];
620
+ return g !== void 0 ? String(I(g)) : a;
621
+ }, ke = C(
622
+ () => P.value.map((a) => {
623
+ const g = M.value[a];
624
+ return {
625
+ key: a,
626
+ raw: g,
627
+ label: g !== void 0 ? String(I(g)) : a,
628
+ description: g !== void 0 ? L(g) : null
629
+ };
630
+ })
631
+ ), Se = C(() => e.selectedSeparator ?? (n.value === "fa" ? "، " : ", ")), Q = C(
632
+ () => e.multiple && e.showSelected && P.value.length > 1 && (e.maxVisible === null || P.value.length <= e.maxVisible)
633
+ ), ie = C(
634
+ () => !!l.selection && P.value.length > 0 && (!e.multiple || P.value.length === 1 || Q.value)
635
+ ), Ie = C(() => {
636
+ const a = P.value;
637
+ return a.length ? e.multiple && a.length > 1 ? Q.value ? ke.value.map((g) => g.label).join(Se.value) : (e.selectedText ?? u("select.selectedCount")).replace("{count}", a.length) : we(a[0]) : e.placeholder ?? u("select.placeholder");
638
+ }), ue = C(() => ie.value ? "" : Ie.value), x = C(() => P.value.length === 0), ne = C(() => {
639
+ let a = r.results ?? e.options;
640
+ if (r.results && e.multiple) {
641
+ const g = new Set(a.map(T));
642
+ a = [...P.value.filter((A) => !g.has(A) && M.value[A] !== void 0).map((A) => M.value[A]), ...a];
643
+ }
644
+ return a.map((g) => ({
645
+ raw: g,
646
+ key: T(g),
647
+ label: I(g),
648
+ description: L(g),
649
+ disabled: fe(g) && !!g.disabled
650
+ }));
651
+ });
652
+ function Ce() {
653
+ if (!w.value) return;
654
+ const a = new Set(P.value);
655
+ w.value.querySelectorAll(".menu-item[data-bs-value]").forEach((g) => {
656
+ const S = a.has(g.dataset.bsValue) && g.dataset.bsValue !== "";
657
+ g.classList.toggle("selected", S), g.setAttribute("aria-selected", S ? "true" : "false");
658
+ });
659
+ }
660
+ function Me() {
661
+ $.value && ($.value.textContent = ue.value, $.value.classList.toggle("combobox-placeholder", x.value));
662
+ }
663
+ function Te() {
664
+ var a;
665
+ (a = b.value) == null || a.classList.toggle("is-invalid", d.isInvalid.value);
666
+ }
667
+ function le() {
668
+ Ce(), Me(), Te();
669
+ }
670
+ z([() => d.model.value, ne, ue, d.isInvalid], () => K(le), { flush: "post" });
671
+ function pe(a) {
672
+ const g = M.value[a];
673
+ return g !== void 0 ? f(g) : a;
674
+ }
675
+ function ae(a) {
676
+ let g, S;
677
+ if (e.multiple) {
678
+ const A = a.value || [];
679
+ g = A.map(pe), S = A.map((H) => M.value[H]);
680
+ } else a.value === "" || a.value === void 0 ? (g = null, S = null) : (g = pe(a.value), S = M.value[a.value]);
681
+ d.model.value = g, g === null && t("clear"), t("selected", S), d.emitChange(g, a), K(le), Me();
682
+ }
683
+ let de = null, U = null;
684
+ p.add(() => {
685
+ clearTimeout(de), U == null || U.abort();
686
+ });
687
+ function he() {
688
+ var a;
689
+ w.value && (w.value.querySelectorAll(".menu-item[data-bs-value]").forEach((g) => {
690
+ g.style.display = "";
691
+ }), (a = w.value.querySelector(".combobox-no-results")) == null || a.classList.toggle("d-none", ne.value.length > 0));
692
+ }
693
+ async function Be(a) {
694
+ const g = e.search || {};
695
+ if (g.url) {
696
+ U == null || U.abort(), U = new AbortController(), r.loading = !0, r.error = !1;
697
+ try {
698
+ const S = new URL(g.url, window.location.origin);
699
+ S.searchParams.set(g.param || "query", a);
700
+ const A = {
701
+ Accept: "application/json",
702
+ "X-Requested-With": "XMLHttpRequest",
703
+ ...g.headers || {}
704
+ }, H = xt();
705
+ H && !A["X-XSRF-TOKEN"] && (A["X-XSRF-TOKEN"] = H);
706
+ const J = await fetch(S, {
707
+ method: (g.method || "POST").toUpperCase(),
708
+ headers: A,
709
+ credentials: "same-origin",
710
+ signal: U.signal
711
+ });
712
+ if (!J.ok) throw new Error(`HTTP ${J.status}`);
713
+ const _ = await J.json(), Fe = Array.isArray(_) ? _ : (_ == null ? void 0 : _[g.resultsKey || "data"]) ?? (_ == null ? void 0 : _.results) ?? [];
714
+ W(Fe), r.results = Fe, r.loading = !1, t("search-success", Fe), await K(), he(), le();
715
+ } catch (S) {
716
+ if ((S == null ? void 0 : S.name) === "AbortError") return;
717
+ r.loading = !1, r.error = !0, r.results = [], t("search-error", S), await K(), he();
718
+ }
719
+ }
720
+ }
721
+ function Ee(a) {
722
+ var A, H;
723
+ const g = a.target.value;
724
+ if (t("search", g), !s.value) return;
725
+ clearTimeout(de);
726
+ const S = ((A = e.search) == null ? void 0 : A.minChars) ?? 0;
727
+ if (g.length < S) {
728
+ U == null || U.abort(), r.results = null, r.loading = !1;
729
+ return;
730
+ }
731
+ r.loading = !0, de = setTimeout(() => Be(g), ((H = e.search) == null ? void 0 : H.debounce) ?? 400);
732
+ }
733
+ let ve = [];
734
+ const { instance: y, create: N } = me(
735
+ "Combobox",
736
+ () => b.value,
737
+ () => ({
738
+ multiple: e.multiple,
739
+ placeholder: e.placeholder ?? u("select.placeholder"),
740
+ placement: e.placement,
741
+ search: i.value,
742
+ searchNormalize: e.searchNormalize
743
+ }),
744
+ {
745
+ onCreate(a, g) {
746
+ const S = (A, H, J) => {
747
+ A.addEventListener(H, J), ve.push(() => A.removeEventListener(H, J));
748
+ };
749
+ S(g, "change.bs.combobox", ae), S(g, "show.bs.combobox", (A) => t("show", A)), S(g, "shown.bs.combobox", (A) => t("shown", A)), S(g, "hide.bs.combobox", (A) => t("hide", A)), S(g, "hidden.bs.combobox", (A) => {
750
+ r.results !== null && (r.results = null, r.error = !1, K(() => {
751
+ he(), le();
752
+ })), t("hidden", A);
753
+ }), k.value && (S(k.value, "input", Ee), S(k.value, "keydown", (A) => A.key === "Enter" && A.preventDefault())), le();
754
+ },
755
+ onDestroy() {
756
+ ve.forEach((a) => a()), ve = [];
757
+ }
758
+ }
759
+ );
760
+ return z(
761
+ () => [e.multiple, i.value, e.placement, e.searchNormalize],
762
+ async () => {
763
+ await K(), N();
764
+ }
765
+ ), o({
766
+ show: () => {
767
+ var a;
768
+ return (a = y.value) == null ? void 0 : a.show();
769
+ },
770
+ hide: () => {
771
+ var a;
772
+ return (a = y.value) == null ? void 0 : a.hide();
773
+ },
774
+ toggle: () => {
775
+ var a;
776
+ return (a = y.value) == null ? void 0 : a.toggle();
777
+ },
778
+ clear: () => {
779
+ d.model.value = e.multiple ? [] : null, t("clear"), d.emitChange(d.model.value);
780
+ },
781
+ focus: () => {
782
+ var a;
783
+ return (a = b.value) == null ? void 0 : a.focus();
784
+ }
785
+ }), {
786
+ ...d,
787
+ t: u,
788
+ root: h,
789
+ toggle: b,
790
+ menu: w,
791
+ valueEl: $,
792
+ searchInput: k,
793
+ remote: r,
794
+ hasSearch: i,
795
+ rendered: ne,
796
+ displayText: Ie,
797
+ plainText: ue,
798
+ selectedItems: ke,
799
+ customSelection: ie,
800
+ separator: Se,
801
+ selectedSet: C(() => new Set(P.value)),
802
+ showingPlaceholder: x,
803
+ sizeClass: C(() => e.size ? `form-control-${e.size}` : null)
804
+ };
805
+ }
806
+ }), en = {
807
+ ref: "root",
808
+ class: "combobox"
809
+ }, tn = ["id", "disabled", "aria-invalid", "aria-required"], nn = {
810
+ key: 0,
811
+ class: "combobox-selection d-flex align-items-center flex-wrap gap-2 text-start"
812
+ }, ln = ["textContent"], an = {
813
+ key: 1,
814
+ class: "combobox-caret",
815
+ width: "16",
816
+ height: "16",
817
+ viewBox: "0 0 16 16",
818
+ fill: "none",
819
+ stroke: "currentColor",
820
+ "stroke-width": "1.5",
821
+ "stroke-linecap": "round",
822
+ "stroke-linejoin": "round",
823
+ "aria-hidden": "true"
824
+ }, on = ["aria-multiselectable"], rn = {
825
+ key: 0,
826
+ class: "combobox-search"
827
+ }, sn = ["placeholder"], un = {
828
+ key: 1,
829
+ class: "menu-header",
830
+ role: "status"
831
+ }, dn = {
832
+ key: 2,
833
+ class: "menu-header",
834
+ role: "alert"
835
+ }, fn = {
836
+ key: 3,
837
+ type: "button",
838
+ class: "menu-item",
839
+ "data-bs-value": "",
840
+ role: "option"
841
+ }, cn = { class: "menu-item-content" }, mn = ["data-bs-value", "disabled"], pn = { class: "menu-item-content" }, hn = {
842
+ key: 0,
843
+ class: "menu-item-description"
844
+ }, vn = { class: "combobox-no-results d-none" };
845
+ function gn(e, t, o, l, d, u) {
846
+ return c(), v("div", en, [
847
+ m("button", {
848
+ ref: "toggle",
849
+ type: "button",
850
+ class: D(["combobox-toggle form-control", e.sizeClass]),
851
+ "data-bs-toggle": "combobox",
852
+ id: e.inputId,
853
+ disabled: e.isDisabled || e.readonly,
854
+ "aria-haspopup": "listbox",
855
+ "aria-invalid": e.isInvalid || void 0,
856
+ "aria-required": e.required || void 0
857
+ }, [
858
+ e.customSelection ? (c(), v("span", nn, [
859
+ (c(!0), v(X, null, ee(e.selectedItems, (n, p) => F(e.$slots, "selection", {
860
+ key: n.key,
861
+ option: n.raw,
862
+ label: n.label,
863
+ description: n.description,
864
+ value: n.key,
865
+ index: p,
866
+ multiple: e.multiple
867
+ }, () => [
868
+ Y(O(n.label), 1)
869
+ ])), 128))
870
+ ])) : B("", !0),
871
+ m("span", {
872
+ ref: "valueEl",
873
+ class: D(["combobox-value", { "combobox-placeholder": e.showingPlaceholder }]),
874
+ textContent: O(e.plainText)
875
+ }, null, 10, ln),
876
+ e.hideDropdown ? B("", !0) : (c(), v("svg", an, t[0] || (t[0] = [
877
+ m("path", { d: "m3 6 5 5 5-5" }, null, -1)
878
+ ])))
879
+ ], 10, tn),
880
+ m("div", {
881
+ ref: "menu",
882
+ class: "menu",
883
+ role: "listbox",
884
+ "aria-multiselectable": e.multiple || void 0
885
+ }, [
886
+ e.hasSearch ? (c(), v("div", rn, [
887
+ m("input", {
888
+ ref: "searchInput",
889
+ type: "search",
890
+ class: "form-control combobox-search-input",
891
+ autocomplete: "off",
892
+ placeholder: e.searchPlaceholder ?? e.t("select.search")
893
+ }, null, 8, sn)
894
+ ])) : B("", !0),
895
+ e.remote.loading ? (c(), v("div", un, O(e.loadingText ?? e.t("select.loading")), 1)) : e.remote.error ? (c(), v("div", dn, O(e.t("select.error")), 1)) : B("", !0),
896
+ e.clearable && !e.multiple ? (c(), v("button", fn, [
897
+ m("span", cn, [
898
+ m("span", null, O(e.clearText ?? e.t("select.clear")), 1)
899
+ ])
900
+ ])) : B("", !0),
901
+ (c(!0), v(X, null, ee(e.rendered, (n) => (c(), v("button", {
902
+ key: n.key,
903
+ type: "button",
904
+ class: "menu-item",
905
+ role: "option",
906
+ "data-bs-value": n.key,
907
+ disabled: n.disabled || void 0
908
+ }, [
909
+ m("span", pn, [
910
+ F(e.$slots, "option", {
911
+ option: n.raw,
912
+ label: n.label,
913
+ description: n.description,
914
+ value: n.key,
915
+ selected: e.selectedSet.has(n.key),
916
+ disabled: n.disabled
917
+ }, () => [
918
+ m("span", null, O(n.label), 1),
919
+ n.description ? (c(), v("span", hn, O(n.description), 1)) : B("", !0)
920
+ ])
921
+ ]),
922
+ t[1] || (t[1] = m("svg", {
923
+ class: "menu-item-check",
924
+ width: "16",
925
+ height: "16",
926
+ viewBox: "0 0 16 16",
927
+ fill: "none",
928
+ stroke: "currentColor",
929
+ "stroke-width": "2",
930
+ "stroke-linecap": "round",
931
+ "stroke-linejoin": "round",
932
+ "aria-hidden": "true"
933
+ }, [
934
+ m("path", { d: "m3.5 8.5 3 3 6-7" })
935
+ ], -1))
936
+ ], 8, mn))), 128)),
937
+ m("div", vn, O(e.noResultsText ?? e.t("select.noResults")), 1)
938
+ ], 8, on)
939
+ ], 512);
940
+ }
941
+ const at = /* @__PURE__ */ q(_t, [["render", gn]]), yn = V({
942
+ name: "TextInput",
943
+ emits: ["update:modelValue", "change", "input", "focus", "blur"],
944
+ props: {
945
+ ...j,
946
+ type: { type: String, default: "text" },
947
+ placeholder: { type: String, default: null },
948
+ /** sm | lg */
949
+ size: { type: String, default: null }
950
+ },
951
+ setup(e, { emit: t }) {
952
+ const o = R(e, t), l = C(() => e.size ? `form-control-${e.size}` : null);
953
+ return { ...o, sizeClass: l, emit: t };
954
+ }
955
+ }), bn = ["name", "id", "type", "placeholder", "required", "readonly", "disabled", "aria-invalid"];
956
+ function $n(e, t, o, l, d, u) {
957
+ return te((c(), v("input", {
958
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => e.model = n),
959
+ name: e.name,
960
+ id: e.inputId,
961
+ type: e.type,
962
+ placeholder: e.placeholder,
963
+ required: e.required,
964
+ readonly: e.readonly,
965
+ disabled: e.isDisabled,
966
+ "aria-invalid": e.isInvalid || void 0,
967
+ class: D(["form-control", [e.sizeClass, { "is-invalid": e.isInvalid }]]),
968
+ onInput: t[1] || (t[1] = (n) => e.emit("input", e.model, n)),
969
+ onChange: t[2] || (t[2] = (n) => e.emitChange(e.model, n)),
970
+ onFocus: t[3] || (t[3] = (n) => e.$emit("focus", n)),
971
+ onBlur: t[4] || (t[4] = (n) => e.$emit("blur", n))
972
+ }, null, 42, bn)), [
973
+ [$e, e.model]
974
+ ]);
975
+ }
976
+ const qe = /* @__PURE__ */ q(yn, [["render", $n]]), wn = V({
977
+ name: "EmailInput",
978
+ components: { TextInput: qe },
979
+ props: {
980
+ name: { type: String, default: "email" },
981
+ placeholder: { type: String, default: null },
982
+ locale: { type: String, default: null }
983
+ },
984
+ setup(e) {
985
+ const { t } = G(() => e.locale);
986
+ return { t };
987
+ }
988
+ });
989
+ function kn(e, t, o, l, d, u) {
990
+ const n = re("TextInput");
991
+ return c(), be(n, {
992
+ type: "email",
993
+ autocomplete: "email",
994
+ name: e.name,
995
+ placeholder: e.placeholder ?? e.t("email.placeholder")
996
+ }, null, 8, ["name", "placeholder"]);
997
+ }
998
+ const Sn = /* @__PURE__ */ q(wn, [["render", kn]]);
999
+ let In = 0;
1000
+ const Cn = V({
1001
+ name: "FileInput",
1002
+ emits: ["update:modelValue", "change", "added", "progress", "uploaded", "error", "removed"],
1003
+ props: {
1004
+ ...j,
1005
+ multiple: { type: Boolean, default: !1 },
1006
+ endpoint: { type: String, default: "/upload" },
1007
+ accept: { type: String, default: null },
1008
+ headers: { type: Object, default: () => ({}) },
1009
+ /** Name of the multipart field. */
1010
+ fieldName: { type: String, default: "file" },
1011
+ locale: { type: String, default: null }
1012
+ },
1013
+ setup(e, { emit: t, expose: o }) {
1014
+ const l = R(e, t), { t: d } = G(() => e.locale), u = De(), n = E(null), p = E([]), h = /* @__PURE__ */ new Map();
1015
+ u.add(() => {
1016
+ h.forEach((i) => i.abort()), h.clear(), l.form.value && (l.form.value.uploading = null);
1017
+ });
1018
+ const b = () => p.value.filter((i) => i.path).map((i) => i.path);
1019
+ function w(i) {
1020
+ const f = e.multiple ? b() : b()[0] ?? null;
1021
+ l.model.value = f, l.emitChange(f, i);
1022
+ }
1023
+ function $() {
1024
+ const i = l.form.value;
1025
+ if (!i) return;
1026
+ const f = p.value.filter((I) => I.uploading);
1027
+ i.uploading = f.length ? Math.min(99, Math.round(f.reduce((I, L) => I + L.percent, 0) / f.length)) : null;
1028
+ }
1029
+ function k(i) {
1030
+ i.error = "", i.percent = 0, i.uploading = !0, $();
1031
+ const f = new FormData();
1032
+ f.append(e.fieldName, i.file);
1033
+ const I = new XMLHttpRequest();
1034
+ h.set(i.id, I), I.open("POST", e.endpoint), Object.entries(Oe(e.headers)).forEach(([T, W]) => I.setRequestHeader(T, W)), I.upload.onprogress = (T) => {
1035
+ T.lengthComputable && (i.percent = Math.round(T.loaded / T.total * 100), t("progress", i, i.percent), $());
1036
+ };
1037
+ const L = (T) => {
1038
+ i.uploading = !1, i.error = T || d("upload.failed"), h.delete(i.id), $(), t("error", i, i.error);
1039
+ };
1040
+ I.onerror = () => L(), I.onload = () => {
1041
+ var se;
1042
+ let T = null;
1043
+ try {
1044
+ T = JSON.parse(I.responseText);
1045
+ } catch {
1046
+ }
1047
+ if (I.status < 200 || I.status >= 300) {
1048
+ const P = T != null && T.errors ? Object.values(T.errors)[0] : null;
1049
+ return L((T == null ? void 0 : T.message) || (Array.isArray(P) ? P[0] : P));
1050
+ }
1051
+ const W = ((se = T == null ? void 0 : T.data) == null ? void 0 : se.path) ?? (T == null ? void 0 : T.path);
1052
+ if (!W) return L();
1053
+ i.path = W, i.percent = 100, i.uploading = !1, h.delete(i.id), $(), w(), t("uploaded", i);
1054
+ }, I.send(f);
1055
+ }
1056
+ function M(i) {
1057
+ const f = ye({ id: `f${++In}`, file: i, percent: 0, error: "", path: null, uploading: !1 });
1058
+ p.value = e.multiple ? [...p.value, f] : [f], t("added", f), k(f);
1059
+ }
1060
+ function r(i) {
1061
+ Array.from(i.target.files).forEach(M), i.target.value = "";
1062
+ }
1063
+ async function s(i) {
1064
+ var f;
1065
+ if ((f = h.get(i.id)) == null || f.abort(), h.delete(i.id), p.value = p.value.filter((I) => I.id !== i.id), $(), i.path) {
1066
+ w();
1067
+ try {
1068
+ await fetch(e.endpoint, {
1069
+ method: "DELETE",
1070
+ headers: Oe(e.headers),
1071
+ credentials: "same-origin",
1072
+ body: i.path
1073
+ });
1074
+ } catch {
1075
+ }
1076
+ }
1077
+ t("removed", i);
1078
+ }
1079
+ return z(
1080
+ () => l.model.value,
1081
+ (i) => {
1082
+ (i == null || i === "" || Array.isArray(i) && !i.length) && p.value.some((I) => I.path) && (p.value = p.value.filter((I) => !I.path));
1083
+ }
1084
+ ), o({ clear: () => p.value.slice().forEach(s) }), { ...l, t: d, input: n, files: p, onSelect: r, remove: s, retry: k, size: (i) => `${Math.round(i / 1024)}KB` };
1085
+ }
1086
+ }), Mn = { class: "file-input-uploader" }, Tn = ["name", "id", "multiple", "accept", "required", "disabled", "aria-invalid"], Bn = {
1087
+ key: 0,
1088
+ class: "list-group mt-2"
1089
+ }, En = { class: "d-flex align-items-center justify-content-between gap-2" }, An = { class: "text-truncate" }, On = { class: "d-flex align-items-center gap-2" }, Nn = {
1090
+ class: "fg-secondary fanum",
1091
+ dir: "ltr"
1092
+ }, Dn = ["aria-label", "onClick"], Vn = ["aria-label", "onClick"], qn = ["aria-valuenow"], Fn = {
1093
+ key: 1,
1094
+ class: "fg-danger mt-1",
1095
+ role: "alert"
1096
+ };
1097
+ function Ln(e, t, o, l, d, u) {
1098
+ return c(), v("div", Mn, [
1099
+ m("input", {
1100
+ ref: "input",
1101
+ type: "file",
1102
+ class: D(["form-control", { "is-invalid": e.isInvalid }]),
1103
+ name: e.name,
1104
+ id: e.inputId,
1105
+ multiple: e.multiple,
1106
+ accept: e.accept || void 0,
1107
+ required: e.required && !e.files.length,
1108
+ disabled: e.isDisabled || e.readonly,
1109
+ "aria-invalid": e.isInvalid || void 0,
1110
+ onChange: t[0] || (t[0] = (...n) => e.onSelect && e.onSelect(...n))
1111
+ }, null, 42, Tn),
1112
+ e.files.length ? (c(), v("ul", Bn, [
1113
+ (c(!0), v(X, null, ee(e.files, (n) => (c(), v("li", {
1114
+ key: n.id,
1115
+ class: "list-group-item"
1116
+ }, [
1117
+ m("div", En, [
1118
+ m("span", An, O(n.file.name), 1),
1119
+ m("span", On, [
1120
+ m("span", Nn, O(e.size(n.file.size)), 1),
1121
+ n.error ? (c(), v("button", {
1122
+ key: 0,
1123
+ type: "button",
1124
+ class: "btn-text theme-secondary btn-icon",
1125
+ "aria-label": e.t("file.retry"),
1126
+ onClick: (p) => e.retry(n)
1127
+ }, t[1] || (t[1] = [
1128
+ m("svg", {
1129
+ width: "16",
1130
+ height: "16",
1131
+ viewBox: "0 0 16 16",
1132
+ fill: "none",
1133
+ stroke: "currentColor",
1134
+ "stroke-width": "1.5",
1135
+ "stroke-linecap": "round",
1136
+ "stroke-linejoin": "round",
1137
+ "aria-hidden": "true"
1138
+ }, [
1139
+ m("path", { d: "M13.5 3v3.5H10" }),
1140
+ m("path", { d: "M3.2 6.5A5.5 5.5 0 0 1 13 6.5M12.8 9.5A5.5 5.5 0 0 1 3 9.5M2.5 13V9.5H6" })
1141
+ ], -1)
1142
+ ]), 8, Dn)) : B("", !0),
1143
+ n.path || n.error ? (c(), v("button", {
1144
+ key: 1,
1145
+ type: "button",
1146
+ class: "btn-text theme-danger btn-icon",
1147
+ "aria-label": e.t("file.remove"),
1148
+ onClick: (p) => e.remove(n)
1149
+ }, t[2] || (t[2] = [
1150
+ m("svg", {
1151
+ width: "16",
1152
+ height: "16",
1153
+ viewBox: "0 0 16 16",
1154
+ fill: "none",
1155
+ stroke: "currentColor",
1156
+ "stroke-width": "1.5",
1157
+ "stroke-linecap": "round",
1158
+ "aria-hidden": "true"
1159
+ }, [
1160
+ m("path", { d: "m4 4 8 8M12 4l-8 8" })
1161
+ ], -1)
1162
+ ]), 8, Vn)) : B("", !0)
1163
+ ])
1164
+ ]),
1165
+ n.uploading ? (c(), v("div", {
1166
+ key: 0,
1167
+ class: "progress mt-2",
1168
+ role: "progressbar",
1169
+ "aria-valuenow": n.percent,
1170
+ "aria-valuemin": "0",
1171
+ "aria-valuemax": "100"
1172
+ }, [
1173
+ m("div", {
1174
+ class: "progress-bar",
1175
+ style: oe({ width: n.percent + "%" })
1176
+ }, null, 4)
1177
+ ], 8, qn)) : B("", !0),
1178
+ n.error ? (c(), v("div", Fn, O(n.error), 1)) : B("", !0)
1179
+ ]))), 128))
1180
+ ])) : B("", !0)
1181
+ ]);
1182
+ }
1183
+ const ot = /* @__PURE__ */ q(Cn, [["render", Ln]]), jn = V({
1184
+ name: "FormAdornInput",
1185
+ inheritAttrs: !1,
1186
+ emits: ["update:modelValue", "change", "input", "focus", "blur"],
1187
+ props: {
1188
+ ...j,
1189
+ type: { type: String, default: "text" },
1190
+ placeholder: { type: String, default: null },
1191
+ /** Text shown before the input. */
1192
+ startText: { type: String, default: null },
1193
+ /** Text shown after the input. */
1194
+ endText: { type: String, default: null },
1195
+ size: { type: String, default: null }
1196
+ },
1197
+ setup(e, { emit: t }) {
1198
+ const o = R(e, t), l = E(null), d = C(() => e.size ? `form-control-${e.size}` : null);
1199
+ function u(n) {
1200
+ var p, h, b;
1201
+ (n.target === n.currentTarget || (h = (p = n.target).closest) != null && h.call(p, ".form-adorn-icon, .form-adorn-text")) && ((b = l.value) == null || b.focus());
1202
+ }
1203
+ return { ...o, input: l, sizeClass: d, focusInput: u, emit: t, focus: () => {
1204
+ var n;
1205
+ return (n = l.value) == null ? void 0 : n.focus();
1206
+ } };
1207
+ },
1208
+ expose: ["focus"]
1209
+ }), Rn = {
1210
+ key: 0,
1211
+ class: "form-adorn-text"
1212
+ }, zn = ["name", "id", "type", "placeholder", "required", "readonly", "disabled", "aria-invalid"], Pn = {
1213
+ key: 0,
1214
+ class: "form-adorn-text"
1215
+ };
1216
+ function Un(e, t, o, l, d, u) {
1217
+ return c(), v("div", {
1218
+ class: D(["form-control form-adorn", [e.sizeClass, { "is-invalid": e.isInvalid }, e.$attrs.class]]),
1219
+ style: oe(e.$attrs.style),
1220
+ onClick: t[5] || (t[5] = (...n) => e.focusInput && e.focusInput(...n))
1221
+ }, [
1222
+ F(e.$slots, "start", {}, () => [
1223
+ e.startText ? (c(), v("span", Rn, O(e.startText), 1)) : B("", !0)
1224
+ ]),
1225
+ te(m("input", je({
1226
+ ref: "input",
1227
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => e.model = n)
1228
+ }, { ...e.$attrs, class: void 0, style: void 0 }, {
1229
+ name: e.name,
1230
+ id: e.inputId,
1231
+ type: e.type,
1232
+ placeholder: e.placeholder,
1233
+ required: e.required,
1234
+ readonly: e.readonly,
1235
+ disabled: e.isDisabled,
1236
+ "aria-invalid": e.isInvalid || void 0,
1237
+ class: ["form-ghost", { "is-invalid": e.isInvalid }],
1238
+ onInput: t[1] || (t[1] = (n) => e.emit("input", e.model, n)),
1239
+ onChange: t[2] || (t[2] = (n) => e.emitChange(e.model, n)),
1240
+ onFocus: t[3] || (t[3] = (n) => e.$emit("focus", n)),
1241
+ onBlur: t[4] || (t[4] = (n) => e.$emit("blur", n))
1242
+ }), null, 16, zn), [
1243
+ [$e, e.model]
1244
+ ]),
1245
+ F(e.$slots, "end", {}, () => [
1246
+ e.endText ? (c(), v("span", Pn, O(e.endText), 1)) : B("", !0)
1247
+ ])
1248
+ ], 6);
1249
+ }
1250
+ const He = /* @__PURE__ */ q(jn, [["render", Un]]), Hn = (e) => e !== null && typeof e == "object" && (Object.getPrototypeOf(e) === Object.prototype || Object.getPrototypeOf(e) === null);
1251
+ function ze(e) {
1252
+ return typeof e == "string" ? Ue(e) : Array.isArray(e) ? e.map(ze) : Hn(e) ? Object.keys(e).reduce((t, o) => (t[o] = ze(e[o]), t), {}) : e;
1253
+ }
1254
+ function Ze(e, t) {
1255
+ try {
1256
+ return JSON.stringify(e) === JSON.stringify(t);
1257
+ } catch {
1258
+ return !1;
1259
+ }
1260
+ }
1261
+ const Kn = V({
1262
+ name: "FormContainer",
1263
+ emits: [
1264
+ "update:modelValue",
1265
+ "change",
1266
+ "submit",
1267
+ "reset",
1268
+ "before",
1269
+ "start",
1270
+ "progress",
1271
+ "success",
1272
+ "error",
1273
+ "cancel",
1274
+ "finish",
1275
+ // Legacy (v2) event names
1276
+ "onStart",
1277
+ "onFinish",
1278
+ "onSuccess",
1279
+ "onError"
1280
+ ],
1281
+ props: {
1282
+ /** The object that holds the value of every field (v-model). */
1283
+ modelValue: { type: Object, default: () => ({}) },
1284
+ url: { type: String, default: "" },
1285
+ method: { type: String, default: "post" },
1286
+ /** Only reload these props after a successful visit (Inertia `only`). */
1287
+ only: { type: Array, default: () => [] },
1288
+ /** Extra form fields that are not part of `modelValue`. */
1289
+ options: { type: Object, default: () => ({}) },
1290
+ /** Extra Inertia visit options (preserveScroll, preserveState, headers, …). */
1291
+ visitOptions: { type: Object, default: () => ({}) },
1292
+ autoTab: { type: Boolean, default: !0 },
1293
+ resetOnSuccess: { type: Boolean, default: !1 },
1294
+ /** Replace the default submit behaviour. Receives (event, form). */
1295
+ submitHandler: { type: Function, default: null },
1296
+ /** Convert Persian/Arabic digits to English digits before submitting. */
1297
+ normalizeDigits: { type: Boolean, default: !0 },
1298
+ /** Enable Bootstrap 6 client-side validation (`data-bs-validate`). */
1299
+ validate: { type: Boolean, default: !1 },
1300
+ /** Render server messages as HTML (only enable for trusted messages). */
1301
+ htmlMessages: { type: Boolean, default: !1 },
1302
+ /** Hide the built-in error / success alerts. */
1303
+ hideAlerts: { type: Boolean, default: !1 }
1304
+ },
1305
+ setup(e, { emit: t, expose: o }) {
1306
+ const l = E(null), d = ye({ hasMessage: !1, successMessage: null }), u = ht({
1307
+ ...e.options,
1308
+ ...e.modelValue
1309
+ });
1310
+ u.uploading = null, u.getID = function(r = {}) {
1311
+ var i;
1312
+ const s = [];
1313
+ return (i = l.value) != null && i.id && s.push(l.value.id), typeof r == "string" && s.push(r), r.group && (r.group.name && s.push(r.group.name), r.group.index !== void 0 && r.group.index !== null && s.push(r.group.index)), r.name && s.push(r.name), r.value !== void 0 && r.value !== null && r.value !== "" && s.push(r.value), s.join("-");
1314
+ };
1315
+ const n = new Set(Object.keys(u)), p = () => Object.keys(u).filter((r) => !n.has(r) && typeof u[r] != "function" && u[r] !== void 0), h = () => {
1316
+ const r = typeof u.data == "function" ? { ...u.data() } : Object.keys(u).reduce((s, i) => (n.has(i) && typeof u[i] != "function" && (s[i] = u[i]), s), {});
1317
+ return p().forEach((s) => {
1318
+ r[s] = u[s];
1319
+ }), r;
1320
+ }, b = () => {
1321
+ p().forEach((r) => delete u[r]), u.reset();
1322
+ };
1323
+ z(
1324
+ () => h(),
1325
+ (r) => {
1326
+ t("change", r), t("update:modelValue", r);
1327
+ },
1328
+ { deep: !0 }
1329
+ ), z(
1330
+ () => e.modelValue,
1331
+ (r) => {
1332
+ !r || Ze(r, h()) || Object.keys(r).forEach((s) => {
1333
+ Ze(u[s], r[s]) || (u[s] = r[s]);
1334
+ });
1335
+ },
1336
+ { deep: !0 }
1337
+ );
1338
+ function w(r) {
1339
+ const s = Array.from(l.value.querySelectorAll("input, select, textarea")).filter(
1340
+ (f) => !f.disabled && f.tabIndex !== -1 && f.type !== "hidden" && f.offsetParent !== null
1341
+ ), i = s[s.indexOf(r) + 1];
1342
+ i && (i.focus(), i.tagName !== "SELECT" && typeof i.select == "function" && i.select());
1343
+ }
1344
+ function $(r) {
1345
+ const s = r.target;
1346
+ if (!["INPUT", "TEXTAREA"].includes(s.tagName)) return;
1347
+ e.autoTab && s.maxLength > 0 && s.value.length >= s.maxLength && w(s);
1348
+ const i = parseInt(s.dataset.autoSubmitLength, 10);
1349
+ !isNaN(i) && s.value.length >= i && M();
1350
+ }
1351
+ function k() {
1352
+ b(), u.clearErrors(), d.hasMessage = !1, d.successMessage = null, t("reset");
1353
+ }
1354
+ async function M(r) {
1355
+ if (e.submitHandler)
1356
+ return e.submitHandler(r, u);
1357
+ t("submit", r), u.transform((s) => {
1358
+ const i = { ...e.modelValue, ...s, ...h() };
1359
+ return e.normalizeDigits ? ze(i) : i;
1360
+ }).submit((e.method || "post").toString().toLowerCase(), e.url, {
1361
+ only: e.only,
1362
+ ...e.visitOptions,
1363
+ onBefore: (s) => {
1364
+ var i, f;
1365
+ return t("before", s), (f = (i = e.visitOptions).onBefore) == null ? void 0 : f.call(i, s);
1366
+ },
1367
+ onStart: (s) => {
1368
+ var i, f;
1369
+ d.hasMessage = !1, d.successMessage = null, u.clearErrors(), t("start", s), t("onStart", s), (f = (i = e.visitOptions).onStart) == null || f.call(i, s);
1370
+ },
1371
+ onProgress: (s) => {
1372
+ var i, f;
1373
+ t("progress", s), (f = (i = e.visitOptions).onProgress) == null || f.call(i, s);
1374
+ },
1375
+ onCancel: () => {
1376
+ var s, i;
1377
+ t("cancel"), (i = (s = e.visitOptions).onCancel) == null || i.call(s);
1378
+ },
1379
+ onFinish: (s) => {
1380
+ var i, f;
1381
+ t("finish", s), t("onFinish", s), (f = (i = e.visitOptions).onFinish) == null || f.call(i, s);
1382
+ },
1383
+ onError: (s) => {
1384
+ var i, f;
1385
+ t("error", s), t("onError", s), (f = (i = e.visitOptions).onError) == null || f.call(i, s);
1386
+ },
1387
+ onSuccess: (s) => {
1388
+ var i, f, I;
1389
+ e.resetOnSuccess && b(), (i = s == null ? void 0 : s.props) != null && i.message && (d.hasMessage = !0, d.successMessage = s.props.message), t("success", s), t("onSuccess", s), (I = (f = e.visitOptions).onSuccess) == null || I.call(f, s);
1390
+ }
1391
+ });
1392
+ }
1393
+ return Ae("form", C(() => u)), Ae("formApi", { submit: M, reset: k, el: l }), o({ submit: M, reset: k, form: u, el: l }), { form: u, formEl: l, ui: d, handleInput: $, reset: k, submit: M };
1394
+ }
1395
+ }), Xn = ["action", "method", "data-bs-validate", "novalidate"], Gn = {
1396
+ key: 0,
1397
+ class: "alert theme-danger",
1398
+ role: "alert"
1399
+ }, Wn = { class: "list-unstyled p-0 m-0 fanum" }, Qn = ["innerHTML"], Jn = {
1400
+ key: 0,
1401
+ class: "alert theme-success",
1402
+ role: "status"
1403
+ }, Zn = ["innerHTML"], Yn = { key: 1 };
1404
+ function xn(e, t, o, l, d, u) {
1405
+ return c(), v("form", {
1406
+ ref: "formEl",
1407
+ action: e.url || void 0,
1408
+ method: e.method,
1409
+ "data-bs-validate": e.validate ? "" : void 0,
1410
+ novalidate: !e.validate || e.form.hasErrors ? !0 : void 0,
1411
+ class: D({ "form-processing": e.form.processing }),
1412
+ onInput: t[0] || (t[0] = (...n) => e.handleInput && e.handleInput(...n)),
1413
+ onSubmit: t[1] || (t[1] = Xe((...n) => e.submit && e.submit(...n), ["prevent"])),
1414
+ onReset: t[2] || (t[2] = Xe((...n) => e.reset && e.reset(...n), ["prevent"]))
1415
+ }, [
1416
+ e.hideAlerts ? B("", !0) : (c(), v(X, { key: 0 }, [
1417
+ F(e.$slots, "errors", {
1418
+ errors: e.form.errors,
1419
+ form: e.form
1420
+ }, () => [
1421
+ e.form.hasErrors ? (c(), v("div", Gn, [
1422
+ m("ul", Wn, [
1423
+ (c(!0), v(X, null, ee(e.form.errors, (n, p) => (c(), v("li", { key: p }, [
1424
+ e.htmlMessages ? (c(), v("span", {
1425
+ key: 0,
1426
+ innerHTML: n
1427
+ }, null, 8, Qn)) : (c(), v(X, { key: 1 }, [
1428
+ Y(O(n), 1)
1429
+ ], 64))
1430
+ ]))), 128))
1431
+ ])
1432
+ ])) : B("", !0)
1433
+ ]),
1434
+ F(e.$slots, "message", {
1435
+ message: e.ui.successMessage
1436
+ }, () => [
1437
+ e.ui.hasMessage && e.ui.successMessage ? (c(), v("div", Jn, [
1438
+ e.htmlMessages ? (c(), v("span", {
1439
+ key: 0,
1440
+ innerHTML: e.ui.successMessage
1441
+ }, null, 8, Zn)) : (c(), v("span", Yn, O(e.ui.successMessage), 1))
1442
+ ])) : B("", !0)
1443
+ ])
1444
+ ], 64)),
1445
+ F(e.$slots, "default", {
1446
+ form: e.form,
1447
+ submit: e.submit,
1448
+ reset: e.reset
1449
+ })
1450
+ ], 42, Xn);
1451
+ }
1452
+ const _n = /* @__PURE__ */ q(Kn, [["render", xn]]), el = V({
1453
+ name: "FormLabel",
1454
+ props: {
1455
+ /** id of the control. Detected automatically inside <FormField> or from the next element. */
1456
+ for: { type: String, default: null },
1457
+ required: { type: Boolean, default: !1 }
1458
+ },
1459
+ setup(e) {
1460
+ const t = ce("formField", null), o = E(null), l = E(null);
1461
+ Z(() => {
1462
+ var n, p;
1463
+ if (e.for || t != null && t.id) return;
1464
+ const u = (n = o.value) == null ? void 0 : n.nextElementSibling;
1465
+ u && (l.value = u.id || ((p = u.querySelector("[id]")) == null ? void 0 : p.id) || null);
1466
+ });
1467
+ const d = C(() => e.for || (t == null ? void 0 : t.id) || l.value || void 0);
1468
+ return { el: o, target: d };
1469
+ }
1470
+ }), tl = ["for"], nl = {
1471
+ key: 0,
1472
+ class: "fg-danger",
1473
+ "aria-hidden": "true"
1474
+ };
1475
+ function ll(e, t, o, l, d, u) {
1476
+ return c(), v("label", {
1477
+ ref: "el",
1478
+ class: "form-label",
1479
+ for: e.target
1480
+ }, [
1481
+ F(e.$slots, "default"),
1482
+ e.required ? (c(), v("span", nl, " *")) : B("", !0)
1483
+ ], 8, tl);
1484
+ }
1485
+ const rt = /* @__PURE__ */ q(el, [["render", ll]]);
1486
+ let al = 0;
1487
+ const ol = V({
1488
+ name: "FormField",
1489
+ components: { FormLabel: rt },
1490
+ props: {
1491
+ /** Field key. Used to read the server-side error of the field. */
1492
+ name: { type: String, default: null },
1493
+ label: { type: String, default: null },
1494
+ help: { type: String, default: null },
1495
+ /** Override the error text (otherwise it is read from the form errors). */
1496
+ error: { type: String, default: null },
1497
+ required: { type: Boolean, default: !1 },
1498
+ id: { type: String, default: null }
1499
+ },
1500
+ setup(e) {
1501
+ const t = ce("form", null), o = Ke.useId ? Ke.useId() : `ff-${++al}`, l = C(() => e.id || (e.name ? `${e.name}-${o}` : o));
1502
+ Ae("formField", {
1503
+ get id() {
1504
+ return l.value;
1505
+ },
1506
+ get name() {
1507
+ return e.name;
1508
+ }
1509
+ });
1510
+ const d = C(() => {
1511
+ var u, n;
1512
+ return e.error ?? (e.name ? (n = (u = t == null ? void 0 : t.value) == null ? void 0 : u.errors) == null ? void 0 : n[e.name] : null) ?? null;
1513
+ });
1514
+ return { fieldId: l, errorText: d };
1515
+ }
1516
+ }), rl = { class: "form-field" }, sl = ["id"], il = ["id"];
1517
+ function ul(e, t, o, l, d, u) {
1518
+ const n = re("FormLabel");
1519
+ return c(), v("div", rl, [
1520
+ F(e.$slots, "label", {}, () => [
1521
+ e.label ? (c(), be(n, {
1522
+ key: 0,
1523
+ for: e.fieldId,
1524
+ required: e.required
1525
+ }, {
1526
+ default: Pe(() => [
1527
+ Y(O(e.label), 1)
1528
+ ]),
1529
+ _: 1
1530
+ }, 8, ["for", "required"])) : B("", !0)
1531
+ ]),
1532
+ F(e.$slots, "default"),
1533
+ F(e.$slots, "help", {}, () => [
1534
+ e.help ? (c(), v("div", {
1535
+ key: 0,
1536
+ id: e.fieldId + "-help",
1537
+ class: "form-text"
1538
+ }, O(e.help), 9, sl)) : B("", !0)
1539
+ ]),
1540
+ F(e.$slots, "error", { error: e.errorText }, () => [
1541
+ e.errorText ? (c(), v("div", {
1542
+ key: 0,
1543
+ id: e.fieldId + "-error",
1544
+ class: "invalid-feedback d-block",
1545
+ role: "alert"
1546
+ }, O(e.errorText), 9, il)) : B("", !0)
1547
+ ])
1548
+ ]);
1549
+ }
1550
+ const dl = /* @__PURE__ */ q(ol, [["render", ul]]), fl = V({
1551
+ name: "GroupControl",
1552
+ props: {
1553
+ /** Key of the object / array inside the form that holds the grouped values. */
1554
+ name: { type: String, required: !0 },
1555
+ /** Explicit item index (repeaters). When omitted it is detected from the DOM position. */
1556
+ index: { type: [Number, String], default: null }
1557
+ },
1558
+ setup(e) {
1559
+ const t = ce("form", null), o = E(null), l = E("0"), d = C(() => e.index !== null ? String(e.index) : l.value);
1560
+ Z(() => {
1561
+ var p, h, b;
1562
+ if (e.index !== null) return;
1563
+ const n = (b = (h = (p = o.value) == null ? void 0 : p.parentNode) == null ? void 0 : h.parentNode) == null ? void 0 : b.querySelectorAll(".form-control-group");
1564
+ n == null || n.forEach((w, $) => {
1565
+ w === o.value && (l.value = String($));
1566
+ });
1567
+ });
1568
+ const u = {
1569
+ get name() {
1570
+ return e.name;
1571
+ },
1572
+ get index() {
1573
+ return d.value;
1574
+ },
1575
+ getData(n) {
1576
+ var h, b;
1577
+ const p = (h = t == null ? void 0 : t.value) == null ? void 0 : h[e.name];
1578
+ return p == null ? null : Array.isArray(p) ? ((b = p[Number(d.value)]) == null ? void 0 : b[n]) ?? null : p[n] ?? null;
1579
+ },
1580
+ setData(n, p) {
1581
+ const h = t == null ? void 0 : t.value;
1582
+ if (h)
1583
+ if ((h[e.name] === null || h[e.name] === void 0) && (h[e.name] = e.index !== null ? [] : {}), Array.isArray(h[e.name])) {
1584
+ const b = Number(d.value);
1585
+ h[e.name][b] || (h[e.name][b] = {}), h[e.name][b][n] = p;
1586
+ } else
1587
+ h[e.name][n] = p;
1588
+ }
1589
+ };
1590
+ return Ae("group", C(() => u)), { groupEl: o, index: d };
1591
+ }
1592
+ }), cl = ["data-name", "data-group-id"];
1593
+ function ml(e, t, o, l, d, u) {
1594
+ return c(), v("div", {
1595
+ ref: "groupEl",
1596
+ class: "form-control-group",
1597
+ "data-name": e.name,
1598
+ "data-group-id": e.index
1599
+ }, [
1600
+ F(e.$slots, "default")
1601
+ ], 8, cl);
1602
+ }
1603
+ const st = /* @__PURE__ */ q(fl, [["render", ml]]), pl = V({
1604
+ name: "MobileInput",
1605
+ components: { TextInput: qe },
1606
+ props: {
1607
+ name: { type: String, default: "mobile" },
1608
+ placeholder: { type: String, default: null },
1609
+ locale: { type: String, default: null }
1610
+ },
1611
+ setup(e) {
1612
+ const { t } = G(() => e.locale);
1613
+ return { t };
1614
+ }
1615
+ });
1616
+ function hl(e, t, o, l, d, u) {
1617
+ const n = re("TextInput");
1618
+ return c(), be(n, {
1619
+ type: "tel",
1620
+ inputmode: "tel",
1621
+ autocomplete: "tel",
1622
+ class: "form-control-mobile fanum",
1623
+ name: e.name,
1624
+ placeholder: e.placeholder ?? e.t("mobile.placeholder")
1625
+ }, null, 8, ["name", "placeholder"]);
1626
+ }
1627
+ const vl = /* @__PURE__ */ q(pl, [["render", hl]]), gl = V({
1628
+ name: "QuantityInput",
1629
+ emits: ["update:modelValue", "change", "input", "increment", "decrement", "focus", "blur"],
1630
+ props: {
1631
+ ...j,
1632
+ min: { type: Number, default: 0 },
1633
+ max: { type: Number, default: null },
1634
+ step: { type: Number, default: 1 },
1635
+ unit: { type: String, default: null },
1636
+ size: { type: String, default: null },
1637
+ locale: { type: String, default: null }
1638
+ },
1639
+ setup(e, { emit: t }) {
1640
+ const o = R(e, t), { t: l } = G(() => e.locale), d = C(() => {
1641
+ const k = Number(o.model.value);
1642
+ return Number.isFinite(k) ? k : e.min;
1643
+ }), u = C(() => e.unit ?? l("quantity.unit")), n = C(() => Ne(d.value)), p = C(() => e.readonly || o.isDisabled.value), h = C(() => !p.value && (e.max === null || d.value + e.step <= e.max)), b = C(() => !p.value && d.value - e.step >= e.min);
1644
+ function w(k, M, r) {
1645
+ let s = k;
1646
+ e.max !== null && (s = Math.min(s, e.max)), s = Math.max(s, e.min), o.model.value = s, r && t(r, s), o.emitChange(s, M);
1647
+ }
1648
+ function $(k) {
1649
+ const M = lt(k.target.value);
1650
+ o.model.value = M === null ? e.min : M, k.target.value = Ne(o.model.value), t("input", o.model.value, k);
1651
+ }
1652
+ return Z(() => {
1653
+ const k = o.model.value;
1654
+ (k == null || k === "") && (o.model.value = e.min);
1655
+ }), {
1656
+ ...o,
1657
+ t: l,
1658
+ unitText: u,
1659
+ display: n,
1660
+ canIncrement: h,
1661
+ canDecrement: b,
1662
+ lock: p,
1663
+ increment: (k) => h.value && w(d.value + e.step, k, "increment"),
1664
+ decrement: (k) => b.value && w(d.value - e.step, k, "decrement"),
1665
+ onInput: $,
1666
+ clampOnBlur: (k) => w(d.value, k)
1667
+ };
1668
+ }
1669
+ }), yl = ["disabled", "aria-label"], bl = ["name", "id", "value", "readonly", "disabled", "aria-invalid"], $l = ["disabled", "aria-label"], wl = {
1670
+ key: 0,
1671
+ class: "input-group-text fanum"
1672
+ };
1673
+ function kl(e, t, o, l, d, u) {
1674
+ return c(), v("div", {
1675
+ class: D(["input-group input-group-quantity", { "is-invalid": e.isInvalid }])
1676
+ }, [
1677
+ m("button", {
1678
+ type: "button",
1679
+ class: "btn-outline theme-secondary btn-icon",
1680
+ disabled: !e.canIncrement,
1681
+ "aria-label": e.t("quantity.increase"),
1682
+ onClick: t[0] || (t[0] = (...n) => e.increment && e.increment(...n))
1683
+ }, t[6] || (t[6] = [
1684
+ m("svg", {
1685
+ width: "14",
1686
+ height: "14",
1687
+ viewBox: "0 0 16 16",
1688
+ fill: "none",
1689
+ stroke: "currentColor",
1690
+ "stroke-width": "2",
1691
+ "stroke-linecap": "round",
1692
+ "aria-hidden": "true"
1693
+ }, [
1694
+ m("path", { d: "M8 3v10M3 8h10" })
1695
+ ], -1)
1696
+ ]), 8, yl),
1697
+ m("input", {
1698
+ name: e.name,
1699
+ id: e.inputId,
1700
+ value: e.display,
1701
+ readonly: e.readonly,
1702
+ disabled: e.isDisabled,
1703
+ "aria-invalid": e.isInvalid || void 0,
1704
+ type: "tel",
1705
+ inputmode: "numeric",
1706
+ autocomplete: "off",
1707
+ class: D(["form-control fanum text-center", { "is-invalid": e.isInvalid }]),
1708
+ onInput: t[1] || (t[1] = (...n) => e.onInput && e.onInput(...n)),
1709
+ onChange: t[2] || (t[2] = (...n) => e.clampOnBlur && e.clampOnBlur(...n)),
1710
+ onFocus: t[3] || (t[3] = (n) => e.$emit("focus", n)),
1711
+ onBlur: t[4] || (t[4] = (n) => e.$emit("blur", n))
1712
+ }, null, 42, bl),
1713
+ m("button", {
1714
+ type: "button",
1715
+ class: "btn-outline theme-secondary btn-icon",
1716
+ disabled: !e.canDecrement,
1717
+ "aria-label": e.t("quantity.decrease"),
1718
+ onClick: t[5] || (t[5] = (...n) => e.decrement && e.decrement(...n))
1719
+ }, t[7] || (t[7] = [
1720
+ m("svg", {
1721
+ width: "14",
1722
+ height: "14",
1723
+ viewBox: "0 0 16 16",
1724
+ fill: "none",
1725
+ stroke: "currentColor",
1726
+ "stroke-width": "2",
1727
+ "stroke-linecap": "round",
1728
+ "aria-hidden": "true"
1729
+ }, [
1730
+ m("path", { d: "M3 8h10" })
1731
+ ], -1)
1732
+ ]), 8, $l),
1733
+ e.unitText ? (c(), v("span", wl, O(e.unitText), 1)) : B("", !0),
1734
+ F(e.$slots, "suffix")
1735
+ ], 2);
1736
+ }
1737
+ const it = /* @__PURE__ */ q(gl, [["render", kl]]), Sl = V({
1738
+ name: "MultiQuantityInput",
1739
+ components: { GroupControl: st, QuantityInput: it },
1740
+ emits: ["update:modelValue", "change", "show", "shown", "hide", "hidden"],
1741
+ props: {
1742
+ ...j,
1743
+ /** Array of strings or { name, min, max, description, html }. */
1744
+ options: { type: Array, default: () => [] },
1745
+ min: { type: Number, default: 0 },
1746
+ max: { type: Number, default: null },
1747
+ totalMin: { type: Number, default: null },
1748
+ totalMax: { type: Number, default: null },
1749
+ unit: { type: String, default: null },
1750
+ placement: { type: String, default: "bottom-start" },
1751
+ locale: { type: String, default: null }
1752
+ },
1753
+ setup(e, { emit: t }) {
1754
+ const o = R(e, t), { t: l } = G(() => e.locale), d = E(null), u = C(() => {
1755
+ const b = o.model.value;
1756
+ return b && typeof b == "object" ? b : {};
1757
+ }), n = C(
1758
+ () => e.options.reduce((b, w, $) => b + (Number(u.value[$]) || 0), 0)
1759
+ ), p = C(() => e.unit ?? l("quantity.unit")), h = C(
1760
+ () => e.options.map((b, w) => {
1761
+ const $ = typeof b == "object" && b !== null ? b : { name: b }, k = Number(u.value[w]) || 0, M = $.max ?? e.max, r = e.totalMax === null ? 1 / 0 : k + (e.totalMax - n.value);
1762
+ return {
1763
+ key: w,
1764
+ name: $.name ?? $.label ?? String(b),
1765
+ description: $.description ?? null,
1766
+ html: !!$.html,
1767
+ min: $.min ?? e.min,
1768
+ max: Math.min(M ?? 1 / 0, r) === 1 / 0 ? null : Math.min(M ?? 1 / 0, r)
1769
+ };
1770
+ })
1771
+ );
1772
+ return Z(() => {
1773
+ (!o.model.value || typeof o.model.value != "object") && (o.model.value = e.options.reduce((b, w, $) => (b[$] = typeof w == "object" && (w == null ? void 0 : w.min) || e.min, b), {}));
1774
+ }), me(
1775
+ "Menu",
1776
+ () => d.value,
1777
+ () => ({ autoClose: "outside", placement: e.placement }),
1778
+ {
1779
+ onCreate(b, w) {
1780
+ ["show", "shown", "hide", "hidden"].forEach(
1781
+ ($) => w.addEventListener(`${$}.bs.menu`, (k) => t($, k))
1782
+ );
1783
+ }
1784
+ }
1785
+ ), { ...o, t: l, toggle: d, total: n, unitText: p, normalized: h };
1786
+ }
1787
+ }), Il = { class: "multi-quantity-input fanum" }, Cl = ["disabled"], Ml = { class: "combobox-value" }, Tl = { class: "menu p-3" }, Bl = ["innerHTML"], El = { key: 1 }, Al = {
1788
+ key: 2,
1789
+ class: "form-text mt-0"
1790
+ };
1791
+ function Ol(e, t, o, l, d, u) {
1792
+ const n = re("QuantityInput"), p = re("GroupControl");
1793
+ return c(), v("div", Il, [
1794
+ m("button", {
1795
+ ref: "toggle",
1796
+ type: "button",
1797
+ class: D(["form-control combobox-toggle", { "is-invalid": e.isInvalid }]),
1798
+ "data-bs-toggle": "menu",
1799
+ "aria-haspopup": "true",
1800
+ disabled: e.isDisabled || e.readonly
1801
+ }, [
1802
+ m("span", Ml, O(e.total) + " " + O(e.unitText), 1)
1803
+ ], 10, Cl),
1804
+ m("div", Tl, [
1805
+ Ge(p, { name: e.name }, {
1806
+ default: Pe(() => [
1807
+ (c(!0), v(X, null, ee(e.normalized, (h) => (c(), v("div", {
1808
+ key: h.key,
1809
+ class: "d-flex align-items-center justify-content-between gap-3 py-1"
1810
+ }, [
1811
+ m("div", null, [
1812
+ h.html ? (c(), v("span", {
1813
+ key: 0,
1814
+ innerHTML: h.name
1815
+ }, null, 8, Bl)) : (c(), v("span", El, O(h.name), 1)),
1816
+ h.description ? (c(), v("div", Al, O(h.description), 1)) : B("", !0)
1817
+ ]),
1818
+ Ge(n, {
1819
+ name: String(h.key),
1820
+ min: h.min,
1821
+ max: h.max,
1822
+ readonly: e.readonly,
1823
+ unit: ""
1824
+ }, null, 8, ["name", "min", "max", "readonly"])
1825
+ ]))), 128))
1826
+ ]),
1827
+ _: 1
1828
+ }, 8, ["name"])
1829
+ ])
1830
+ ]);
1831
+ }
1832
+ const Nl = /* @__PURE__ */ q(Sl, [["render", Ol]]), Dl = V({
1833
+ name: "OTPInput",
1834
+ emits: ["update:modelValue", "change", "input", "complete", "focus", "blur"],
1835
+ props: {
1836
+ ...j,
1837
+ /** Number of characters. */
1838
+ length: { type: Number, default: null },
1839
+ /** Legacy alias of `length`. */
1840
+ maxLength: { type: Number, default: null },
1841
+ /** numeric | alphanumeric | alpha */
1842
+ type: { type: String, default: "numeric", validator: (e) => ["numeric", "alphanumeric", "alpha"].includes(e) },
1843
+ /** Show • instead of the typed character. */
1844
+ mask: { type: Boolean, default: !1 },
1845
+ /** Visual grouping, e.g. [3, 3] renders `123 · 456`. */
1846
+ groups: { type: Array, default: null },
1847
+ separator: { type: String, default: "·" },
1848
+ /** Submit the surrounding FormContainer as soon as the code is complete. */
1849
+ autoSubmit: { type: Boolean, default: !1 },
1850
+ autofocus: { type: Boolean, default: !1 }
1851
+ },
1852
+ setup(e, { emit: t, expose: o }) {
1853
+ const l = R(e, t), d = E(null), u = E(null);
1854
+ let n = !1, p = [];
1855
+ const h = () => e.length ?? e.maxLength ?? 6, b = (r) => r == null ? "" : String(r);
1856
+ function w() {
1857
+ var r;
1858
+ (r = u.value) == null || r.classList.toggle("is-invalid", l.isInvalid.value);
1859
+ }
1860
+ function $() {
1861
+ const r = k.value;
1862
+ if (!r) return;
1863
+ const s = b(l.model.value);
1864
+ if (r.getValue() !== s) {
1865
+ n = !0;
1866
+ try {
1867
+ r.setValue(s);
1868
+ } finally {
1869
+ n = !1;
1870
+ }
1871
+ }
1872
+ }
1873
+ const { instance: k, create: M } = me(
1874
+ "OtpInput",
1875
+ () => d.value,
1876
+ () => ({
1877
+ length: h(),
1878
+ type: e.type,
1879
+ mask: e.mask,
1880
+ groups: e.groups,
1881
+ separator: e.separator
1882
+ }),
1883
+ {
1884
+ onCreate(r, s) {
1885
+ const i = (f, I) => {
1886
+ s.addEventListener(f, I), p.push(() => s.removeEventListener(f, I));
1887
+ };
1888
+ i("input.bs.otpInput", (f) => {
1889
+ n || (l.model.value = f.value, t("input", f.value, f), l.emitChange(f.value, f));
1890
+ }), i("complete.bs.otpInput", (f) => {
1891
+ var I, L;
1892
+ n || (t("complete", f.value), e.autoSubmit && ((L = (I = l.formApi) == null ? void 0 : I.submit) == null || L.call(I)));
1893
+ }), $(), w(), e.autofocus && r.focus();
1894
+ },
1895
+ onDestroy() {
1896
+ p.forEach((r) => r()), p = [];
1897
+ }
1898
+ }
1899
+ );
1900
+ return Z(() => {
1901
+ u.value && (u.value.value = b(l.model.value));
1902
+ }), z(() => l.model.value, $), z(l.isInvalid, w, { flush: "post" }), z(
1903
+ () => [h(), e.type, e.mask, e.groups, e.separator],
1904
+ async () => {
1905
+ await K(), M();
1906
+ },
1907
+ { deep: !0 }
1908
+ ), o({
1909
+ focus: () => {
1910
+ var r;
1911
+ return (r = k.value) == null ? void 0 : r.focus();
1912
+ },
1913
+ clear: () => {
1914
+ var r;
1915
+ (r = k.value) == null || r.clear(), l.model.value = "";
1916
+ }
1917
+ }), { ...l, el: d, input: u };
1918
+ }
1919
+ }), Vl = {
1920
+ ref: "el",
1921
+ class: "otp fanum"
1922
+ }, ql = ["name", "id", "disabled", "readonly", "required", "aria-invalid"];
1923
+ function Fl(e, t, o, l, d, u) {
1924
+ return c(), v("div", Vl, [
1925
+ m("input", {
1926
+ ref: "input",
1927
+ type: "text",
1928
+ name: e.name,
1929
+ id: e.inputId,
1930
+ disabled: e.isDisabled,
1931
+ readonly: e.readonly,
1932
+ required: e.required,
1933
+ "aria-invalid": e.isInvalid || void 0,
1934
+ onFocus: t[0] || (t[0] = (n) => e.$emit("focus", n)),
1935
+ onBlur: t[1] || (t[1] = (n) => e.$emit("blur", n))
1936
+ }, null, 40, ql)
1937
+ ], 512);
1938
+ }
1939
+ const Ll = /* @__PURE__ */ q(Dl, [["render", Fl]]), Ye = {
1940
+ en: { weak: "Weak", fair: "Fair", good: "Good", strong: "Strong" },
1941
+ fa: { weak: "ضعیف", fair: "متوسط", good: "خوب", strong: "قوی" }
1942
+ }, jl = V({
1943
+ name: "PasswordInput",
1944
+ components: { TextInput: qe, FormAdornInput: He },
1945
+ inheritAttrs: !1,
1946
+ emits: ["toggle", "strength"],
1947
+ props: {
1948
+ ...j,
1949
+ name: { type: String, default: "password" },
1950
+ placeholder: { type: String, default: null },
1951
+ /** Show a "reveal password" button. */
1952
+ toggle: { type: Boolean, default: !1 },
1953
+ /** Show the password strength meter. */
1954
+ strength: { type: Boolean, default: !1 },
1955
+ /** Show the text feedback ("Weak", "Strong", …) under the meter. */
1956
+ strengthText: { type: Boolean, default: !0 },
1957
+ /** Override the labels: { weak, fair, good, strong }. */
1958
+ strengthMessages: { type: Object, default: null },
1959
+ /** Bootstrap Strength options: { minLength, thresholds: [2, 4, 6], weights, scorer(password) => number }. */
1960
+ strengthOptions: { type: Object, default: () => ({}) },
1961
+ size: { type: String, default: null },
1962
+ locale: { type: String, default: null }
1963
+ },
1964
+ setup(e, { emit: t, expose: o }) {
1965
+ const { t: l, locale: d } = G(() => e.locale), u = R(e, () => {
1966
+ }), n = E(null), p = E(null), h = E(!1), b = C(() => ({
1967
+ ...Ye[d.value] || Ye.en,
1968
+ ...e.strengthMessages || {}
1969
+ }));
1970
+ function w() {
1971
+ h.value = !h.value, t("toggle", h.value);
1972
+ }
1973
+ let $ = [];
1974
+ const { instance: k, create: M } = me(
1975
+ "Strength",
1976
+ () => e.strength ? p.value : null,
1977
+ () => {
1978
+ var s;
1979
+ return {
1980
+ ...e.strengthOptions,
1981
+ input: (s = n.value) == null ? void 0 : s.querySelector("input"),
1982
+ messages: b.value
1983
+ };
1984
+ },
1985
+ {
1986
+ onCreate(s, i) {
1987
+ const f = (I) => t("strength", I.strength ?? null, I.score ?? 0);
1988
+ i.addEventListener("strengthChange.bs.strength", f), $.push(() => i.removeEventListener("strengthChange.bs.strength", f));
1989
+ },
1990
+ onDestroy() {
1991
+ $.forEach((s) => s()), $ = [];
1992
+ }
1993
+ }
1994
+ );
1995
+ z(
1996
+ () => u.model.value,
1997
+ () => K(() => {
1998
+ var s;
1999
+ return (s = k.value) == null ? void 0 : s.evaluate();
2000
+ })
2001
+ ), z(
2002
+ () => [e.strength, e.toggle, e.strengthText, b.value, e.strengthOptions],
2003
+ async () => {
2004
+ await K(), e.strength && M();
2005
+ },
2006
+ { deep: !0 }
2007
+ ), o({ strength: () => {
2008
+ var s, i;
2009
+ return ((i = (s = k.value) == null ? void 0 : s.getStrength) == null ? void 0 : i.call(s)) ?? null;
2010
+ } });
2011
+ const r = C(() => ({
2012
+ name: e.name,
2013
+ modelValue: e.modelValue,
2014
+ id: e.id,
2015
+ disabled: e.disabled,
2016
+ readonly: e.readonly,
2017
+ required: e.required,
2018
+ invalid: e.invalid,
2019
+ size: e.size,
2020
+ placeholder: e.placeholder ?? l("password.placeholder")
2021
+ }));
2022
+ return { t: l, root: n, meter: p, visible: h, toggleVisible: w, forwarded: r };
2023
+ }
2024
+ }), Rl = {
2025
+ ref: "root",
2026
+ class: "password-input"
2027
+ }, zl = ["aria-label", "aria-pressed"], Pl = {
2028
+ key: 0,
2029
+ width: "16",
2030
+ height: "16",
2031
+ viewBox: "0 0 16 16",
2032
+ fill: "none",
2033
+ stroke: "currentColor",
2034
+ "stroke-width": "1.5",
2035
+ "stroke-linecap": "round",
2036
+ "stroke-linejoin": "round",
2037
+ "aria-hidden": "true"
2038
+ }, Ul = {
2039
+ key: 1,
2040
+ width: "16",
2041
+ height: "16",
2042
+ viewBox: "0 0 16 16",
2043
+ fill: "none",
2044
+ stroke: "currentColor",
2045
+ "stroke-width": "1.5",
2046
+ "stroke-linecap": "round",
2047
+ "stroke-linejoin": "round",
2048
+ "aria-hidden": "true"
2049
+ }, Hl = {
2050
+ ref: "meter",
2051
+ class: "strength",
2052
+ "aria-hidden": "true"
2053
+ }, Kl = {
2054
+ key: 0,
2055
+ class: "strength-text",
2056
+ "aria-live": "polite"
2057
+ };
2058
+ function Xl(e, t, o, l, d, u) {
2059
+ const n = re("FormAdornInput"), p = re("TextInput");
2060
+ return c(), v("div", Rl, [
2061
+ e.toggle ? (c(), be(n, je({ key: 0 }, { ...e.$attrs, ...e.forwarded }, {
2062
+ type: e.visible ? "text" : "password",
2063
+ autocomplete: "current-password"
2064
+ }), {
2065
+ end: Pe(() => [
2066
+ m("button", {
2067
+ type: "button",
2068
+ class: "btn-text theme-secondary btn-icon",
2069
+ "aria-label": e.visible ? e.t("password.hide") : e.t("password.show"),
2070
+ "aria-pressed": e.visible,
2071
+ onClick: t[0] || (t[0] = (...h) => e.toggleVisible && e.toggleVisible(...h))
2072
+ }, [
2073
+ e.visible ? (c(), v("svg", Ul, t[2] || (t[2] = [
2074
+ m("path", { d: "M2 2l12 12M6.6 3.7A7 7 0 0 1 8 3.5C12.5 3.5 15 8 15 8a11 11 0 0 1-2.2 2.6M4 5.4A11 11 0 0 0 1 8s2.5 4.5 7 4.5c1 0 1.9-.2 2.7-.6" }, null, -1)
2075
+ ]))) : (c(), v("svg", Pl, t[1] || (t[1] = [
2076
+ m("path", { d: "M1 8s2.5-4.5 7-4.5S15 8 15 8s-2.5 4.5-7 4.5S1 8 1 8Z" }, null, -1),
2077
+ m("circle", {
2078
+ cx: "8",
2079
+ cy: "8",
2080
+ r: "2"
2081
+ }, null, -1)
2082
+ ])))
2083
+ ], 8, zl)
2084
+ ]),
2085
+ _: 1
2086
+ }, 16, ["type"])) : (c(), be(p, je({ key: 1 }, { ...e.$attrs, ...e.forwarded }, {
2087
+ type: "password",
2088
+ autocomplete: "current-password"
2089
+ }), null, 16)),
2090
+ e.strength ? (c(), v(X, { key: 2 }, [
2091
+ m("div", Hl, t[3] || (t[3] = [
2092
+ m("div", { class: "strength-segment" }, null, -1),
2093
+ m("div", { class: "strength-segment" }, null, -1),
2094
+ m("div", { class: "strength-segment" }, null, -1),
2095
+ m("div", { class: "strength-segment" }, null, -1)
2096
+ ]), 512),
2097
+ e.strengthText ? (c(), v("div", Kl)) : B("", !0)
2098
+ ], 64)) : B("", !0)
2099
+ ], 512);
2100
+ }
2101
+ const Gl = /* @__PURE__ */ q(jl, [["render", Xl]]), Wl = V({
2102
+ name: "RangeInput",
2103
+ emits: ["update:modelValue", "change", "input", "focus", "blur"],
2104
+ props: {
2105
+ ...j,
2106
+ min: { type: Number, default: 0 },
2107
+ max: { type: Number, default: 100 },
2108
+ step: { type: Number, default: 1 },
2109
+ /** Show the current value above the thumb. */
2110
+ bubble: { type: Boolean, default: !1 },
2111
+ /** (value:number) => string — formats the bubble and the tick labels. */
2112
+ formatter: { type: Function, default: null },
2113
+ /** Tick marks: numbers or { value, label } objects. */
2114
+ ticks: { type: Array, default: () => [] }
2115
+ },
2116
+ setup(e, { emit: t }) {
2117
+ const o = R(e, t), l = E(null), d = E(null), u = C(() => {
2118
+ const $ = Number(o.model.value);
2119
+ return o.model.value === null || o.model.value === void 0 || Number.isNaN($) ? e.min : $;
2120
+ }), n = C(() => e.ticks.length ? `${o.inputId.value}-ticks` : void 0), p = C(
2121
+ () => e.ticks.map(($) => typeof $ == "object" && $ !== null ? $ : { value: $, label: e.formatter ? e.formatter($) : String($) })
2122
+ );
2123
+ function h($) {
2124
+ const k = Number($.target.value);
2125
+ o.model.value = k, t("input", k, $);
2126
+ }
2127
+ const { instance: b, create: w } = me(
2128
+ "Range",
2129
+ () => l.value,
2130
+ () => ({ bubble: e.bubble, formatter: e.formatter })
2131
+ );
2132
+ return z(
2133
+ () => [o.model.value, e.min, e.max],
2134
+ () => K(() => {
2135
+ var $;
2136
+ return ($ = b.value) == null ? void 0 : $.update();
2137
+ }),
2138
+ { flush: "post" }
2139
+ ), z(
2140
+ () => [e.bubble, e.formatter, e.ticks, e.min, e.max],
2141
+ async () => {
2142
+ await K(), w();
2143
+ },
2144
+ { deep: !0 }
2145
+ ), { ...o, el: l, input: d, current: u, listId: n, tickItems: p, onInput: h };
2146
+ }
2147
+ }), Ql = {
2148
+ ref: "el",
2149
+ class: "form-range"
2150
+ }, Jl = ["name", "id", "min", "max", "step", "list", "disabled", "aria-invalid", "value"], Zl = ["id"], Yl = ["value", "label"];
2151
+ function xl(e, t, o, l, d, u) {
2152
+ return c(), v("div", Ql, [
2153
+ m("input", {
2154
+ ref: "input",
2155
+ type: "range",
2156
+ class: D(["form-range-input", { "is-invalid": e.isInvalid }]),
2157
+ name: e.name,
2158
+ id: e.inputId,
2159
+ min: e.min,
2160
+ max: e.max,
2161
+ step: e.step,
2162
+ list: e.listId,
2163
+ disabled: e.isDisabled || e.readonly,
2164
+ "aria-invalid": e.isInvalid || void 0,
2165
+ value: e.current,
2166
+ onInput: t[0] || (t[0] = (...n) => e.onInput && e.onInput(...n)),
2167
+ onChange: t[1] || (t[1] = (n) => e.emitChange(Number(n.target.value), n)),
2168
+ onFocus: t[2] || (t[2] = (n) => e.$emit("focus", n)),
2169
+ onBlur: t[3] || (t[3] = (n) => e.$emit("blur", n))
2170
+ }, null, 42, Jl),
2171
+ e.listId ? (c(), v("datalist", {
2172
+ key: 0,
2173
+ id: e.listId
2174
+ }, [
2175
+ (c(!0), v(X, null, ee(e.tickItems, (n) => (c(), v("option", {
2176
+ key: n.value,
2177
+ value: n.value,
2178
+ label: n.label
2179
+ }, null, 8, Yl))), 128))
2180
+ ], 8, Zl)) : B("", !0)
2181
+ ], 512);
2182
+ }
2183
+ const ut = /* @__PURE__ */ q(Wl, [["render", xl]]), _l = V({
2184
+ name: "SimpleUploader",
2185
+ inheritAttrs: !0,
2186
+ setup(e, { attrs: t, slots: o }) {
2187
+ return () => ct(ot, t, o);
2188
+ }
2189
+ }), ea = V({
2190
+ name: "StarRatingInput",
2191
+ emits: ["update:modelValue", "change", "hover"],
2192
+ props: {
2193
+ ...j,
2194
+ /** Initial rating used when the model is empty. */
2195
+ value: { type: Number, default: 0 },
2196
+ maxStars: { type: Number, default: 5 },
2197
+ /** Steps per star: 1 = whole stars, 2 = half stars, 4 = quarter stars… */
2198
+ precision: { type: Number, default: 2 },
2199
+ showValue: { type: Boolean, default: !0 },
2200
+ /** Allow clicking the current rating again to reset it to 0. */
2201
+ clearable: { type: Boolean, default: !1 }
2202
+ },
2203
+ setup(e, { emit: t }) {
2204
+ const o = R(e, t), l = E(null), d = E(null), u = E(!1);
2205
+ Z(() => {
2206
+ l.value && (u.value = getComputedStyle(l.value).direction === "rtl");
2207
+ });
2208
+ const n = C(() => e.readonly || o.isDisabled.value), p = C(() => {
2209
+ const f = Number(o.model.value);
2210
+ return o.model.value === null || o.model.value === void 0 || Number.isNaN(f) ? e.value : f;
2211
+ }), h = C(() => d.value ?? p.value), b = C(() => 1 / e.precision), w = (f) => Math.max(0, Math.min(1, h.value - (f - 1))) * 100;
2212
+ function $(f) {
2213
+ const I = l.value.getBoundingClientRect(), L = u.value ? I.right - f.clientX : f.clientX - I.left, T = I.width / e.maxStars, W = Math.ceil(L / T * e.precision) / e.precision;
2214
+ return Math.min(e.maxStars, Math.max(b.value, W));
2215
+ }
2216
+ function k(f) {
2217
+ n.value || (d.value = $(f), t("hover", d.value));
2218
+ }
2219
+ function M() {
2220
+ d.value = null;
2221
+ }
2222
+ function r(f, I) {
2223
+ if (n.value) return;
2224
+ const L = e.clearable && f === p.value ? 0 : f;
2225
+ o.model.value = L, o.emitChange(L, I);
2226
+ }
2227
+ function s(f) {
2228
+ n.value || r($(f), f);
2229
+ }
2230
+ function i(f) {
2231
+ if (n.value) return;
2232
+ const I = u.value ? "ArrowLeft" : "ArrowRight", L = u.value ? "ArrowRight" : "ArrowLeft";
2233
+ let T = null;
2234
+ f.key === I || f.key === "ArrowUp" ? T = p.value + b.value : f.key === L || f.key === "ArrowDown" ? T = p.value - b.value : f.key === "Home" ? T = 0 : f.key === "End" && (T = e.maxStars), T !== null && (f.preventDefault(), r(Math.min(e.maxStars, Math.max(0, Number(T.toFixed(4)))), f));
2235
+ }
2236
+ return {
2237
+ ...o,
2238
+ container: l,
2239
+ rating: h,
2240
+ stored: p,
2241
+ fillOf: w,
2242
+ onMove: k,
2243
+ leave: M,
2244
+ onClick: s,
2245
+ onKeydown: i,
2246
+ locked: n,
2247
+ display: C(() => h.value.toFixed(1))
2248
+ };
2249
+ }
2250
+ }), ta = ["tabindex", "aria-valuemax", "aria-valuenow", "aria-readonly", "aria-invalid"], na = ["name", "value"], la = {
2251
+ key: 1,
2252
+ class: "rating-value fanum"
2253
+ };
2254
+ function aa(e, t, o, l, d, u) {
2255
+ return c(), v("div", {
2256
+ class: D(["star-rating d-flex align-items-center gap-2", { "is-invalid": e.isInvalid }])
2257
+ }, [
2258
+ m("div", {
2259
+ ref: "container",
2260
+ class: "star-rating-container d-flex position-relative",
2261
+ role: "slider",
2262
+ tabindex: e.locked ? -1 : 0,
2263
+ "aria-valuemin": 0,
2264
+ "aria-valuemax": e.maxStars,
2265
+ "aria-valuenow": e.stored,
2266
+ "aria-readonly": e.locked || void 0,
2267
+ "aria-invalid": e.isInvalid || void 0,
2268
+ style: oe({ cursor: e.locked ? "default" : "pointer" }),
2269
+ onPointermove: t[0] || (t[0] = (...n) => e.onMove && e.onMove(...n)),
2270
+ onPointerleave: t[1] || (t[1] = (...n) => e.leave && e.leave(...n)),
2271
+ onClick: t[2] || (t[2] = (...n) => e.onClick && e.onClick(...n)),
2272
+ onKeydown: t[3] || (t[3] = (...n) => e.onKeydown && e.onKeydown(...n))
2273
+ }, [
2274
+ (c(!0), v(X, null, ee(e.maxStars, (n) => (c(), v("span", {
2275
+ key: n,
2276
+ class: "star-wrapper position-relative d-inline-block fs-2xl lh-1"
2277
+ }, [
2278
+ t[4] || (t[4] = m("span", {
2279
+ class: "star-bg fg-secondary opacity-50",
2280
+ "aria-hidden": "true"
2281
+ }, "★", -1)),
2282
+ m("span", {
2283
+ class: "star-overlay fg-warning",
2284
+ "aria-hidden": "true",
2285
+ style: oe({ position: "absolute", top: 0, insetInlineStart: 0, overflow: "hidden", whiteSpace: "nowrap", width: e.fillOf(n) + "%" })
2286
+ }, "★", 4)
2287
+ ]))), 128))
2288
+ ], 44, ta),
2289
+ e.name ? (c(), v("input", {
2290
+ key: 0,
2291
+ type: "hidden",
2292
+ name: e.name,
2293
+ value: e.stored
2294
+ }, null, 8, na)) : B("", !0),
2295
+ e.showValue && e.rating > 0 ? (c(), v("span", la, O(e.display), 1)) : B("", !0)
2296
+ ], 2);
2297
+ }
2298
+ const oa = /* @__PURE__ */ q(ea, [["render", aa]]), ra = V({
2299
+ name: "SubmitButton",
2300
+ emits: ["click"],
2301
+ props: {
2302
+ disabled: { type: Boolean, default: !1 },
2303
+ /** Force the loading state (otherwise it follows form.processing / form.uploading). */
2304
+ loading: { type: Boolean, default: null },
2305
+ /** Bootstrap 6 button variant: solid | outline | subtle | text | styled | link. Use null to supply your own classes. */
2306
+ variant: { type: String, default: "solid" },
2307
+ /** Bootstrap 6 theme: primary | secondary | accent | success | danger | warning | info | inverse. */
2308
+ theme: { type: String, default: "primary" },
2309
+ locale: { type: String, default: null }
2310
+ },
2311
+ setup(e, { emit: t }) {
2312
+ const o = ce("form", null), l = C(() => (o == null ? void 0 : o.value) ?? null), { t: d } = G(() => e.locale), u = C(
2313
+ () => {
2314
+ var p, h;
2315
+ return e.loading !== null ? e.loading : !!((p = l.value) != null && p.processing || (h = l.value) != null && h.uploading);
2316
+ }
2317
+ ), n = C(() => [
2318
+ e.variant ? `btn-${e.variant}` : null,
2319
+ e.theme && e.variant ? `theme-${e.theme}` : null
2320
+ ]);
2321
+ return { form: l, busy: u, classes: n, t: d, onClick: (p) => t("click", p) };
2322
+ }
2323
+ }), sa = ["disabled", "aria-busy"], ia = {
2324
+ key: 0,
2325
+ class: "spinner-border spinner-sm me-2",
2326
+ role: "status",
2327
+ "aria-hidden": "true"
2328
+ }, ua = {
2329
+ key: 0,
2330
+ class: "fanum"
2331
+ };
2332
+ function da(e, t, o, l, d, u) {
2333
+ var n;
2334
+ return c(), v("button", {
2335
+ type: "submit",
2336
+ class: D(e.classes),
2337
+ disabled: e.disabled || e.busy,
2338
+ "aria-busy": e.busy || void 0,
2339
+ onClick: t[0] || (t[0] = (...p) => e.onClick && e.onClick(...p))
2340
+ }, [
2341
+ e.busy ? (c(), v("span", ia)) : B("", !0),
2342
+ F(e.$slots, "default", {
2343
+ form: e.form,
2344
+ loading: e.busy
2345
+ }, () => [
2346
+ Y(O(e.t("submit.default")), 1)
2347
+ ]),
2348
+ F(e.$slots, "progress", {
2349
+ progress: (n = e.form) == null ? void 0 : n.uploading
2350
+ }, () => {
2351
+ var p;
2352
+ return [
2353
+ (p = e.form) != null && p.uploading ? (c(), v("span", ua, O(e.form.uploading) + "%", 1)) : B("", !0)
2354
+ ];
2355
+ })
2356
+ ], 10, sa);
2357
+ }
2358
+ const fa = /* @__PURE__ */ q(ra, [["render", da]]), ca = V({
2359
+ name: "SwitchInput",
2360
+ emits: ["update:modelValue", "change", "focus", "blur"],
2361
+ props: {
2362
+ ...j,
2363
+ value: { type: [String, Number, Boolean, Object], default: null },
2364
+ trueValue: { type: null, default: !0 },
2365
+ falseValue: { type: null, default: !1 },
2366
+ checked: { type: Boolean, default: !1 },
2367
+ label: { type: String, default: null }
2368
+ },
2369
+ setup(e, { emit: t }) {
2370
+ const o = E(null), l = R(e, t, { valued: () => e.value });
2371
+ return Ve(e, l, o, { type: () => "checkbox" }), {
2372
+ ...l,
2373
+ input: o,
2374
+ onChange: (d) => l.emitChange(l.model.value, d)
2375
+ };
2376
+ },
2377
+ expose: ["input"]
2378
+ }), ma = { class: "form-field" }, pa = { class: "switch" }, ha = ["name", "id", "value", "true-value", "false-value", "required", "disabled", "aria-invalid"], va = ["for"];
2379
+ function ga(e, t, o, l, d, u) {
2380
+ return c(), v("div", ma, [
2381
+ m("div", pa, [
2382
+ te(m("input", {
2383
+ ref: "input",
2384
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => e.model = n),
2385
+ name: e.name,
2386
+ id: e.inputId,
2387
+ type: "checkbox",
2388
+ role: "switch",
2389
+ switch: "",
2390
+ value: e.value ?? void 0,
2391
+ "true-value": e.trueValue,
2392
+ "false-value": e.falseValue,
2393
+ required: e.required,
2394
+ disabled: e.isDisabled,
2395
+ "aria-invalid": e.isInvalid || void 0,
2396
+ class: D({ "is-invalid": e.isInvalid }),
2397
+ onChange: t[1] || (t[1] = (...n) => e.onChange && e.onChange(...n)),
2398
+ onFocus: t[2] || (t[2] = (n) => e.$emit("focus", n)),
2399
+ onBlur: t[3] || (t[3] = (n) => e.$emit("blur", n))
2400
+ }, null, 42, ha), [
2401
+ [mt, e.model]
2402
+ ])
2403
+ ]),
2404
+ m("label", { for: e.inputId }, [
2405
+ F(e.$slots, "default", {}, () => [
2406
+ Y(O(e.label), 1)
2407
+ ])
2408
+ ], 8, va)
2409
+ ]);
2410
+ }
2411
+ const ya = /* @__PURE__ */ q(ca, [["render", ga]]), ba = V({
2412
+ name: "TextAreaInput",
2413
+ emits: ["update:modelValue", "change", "input", "focus", "blur"],
2414
+ props: {
2415
+ ...j,
2416
+ rows: { type: [Number, String], default: 3 },
2417
+ placeholder: { type: String, default: null },
2418
+ size: { type: String, default: null }
2419
+ },
2420
+ setup(e, { emit: t }) {
2421
+ const o = R(e, t), l = C(() => e.size ? `form-control-${e.size}` : null);
2422
+ return { ...o, sizeClass: l, emit: t };
2423
+ }
2424
+ }), $a = ["name", "id", "rows", "placeholder", "required", "readonly", "disabled", "aria-invalid"];
2425
+ function wa(e, t, o, l, d, u) {
2426
+ return te((c(), v("textarea", {
2427
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => e.model = n),
2428
+ name: e.name,
2429
+ id: e.inputId,
2430
+ rows: e.rows,
2431
+ placeholder: e.placeholder,
2432
+ required: e.required,
2433
+ readonly: e.readonly,
2434
+ disabled: e.isDisabled,
2435
+ "aria-invalid": e.isInvalid || void 0,
2436
+ class: D(["form-control", [e.sizeClass, { "is-invalid": e.isInvalid }]]),
2437
+ onInput: t[1] || (t[1] = (n) => e.emit("input", e.model, n)),
2438
+ onChange: t[2] || (t[2] = (n) => e.emitChange(e.model, n)),
2439
+ onFocus: t[3] || (t[3] = (n) => e.$emit("focus", n)),
2440
+ onBlur: t[4] || (t[4] = (n) => e.$emit("blur", n))
2441
+ }, null, 42, $a)), [
2442
+ [nt, e.model]
2443
+ ]);
2444
+ }
2445
+ const ka = /* @__PURE__ */ q(ba, [["render", wa]]), Le = {
2446
+ en: {
2447
+ start: "Record voice",
2448
+ stop: "Stop recording",
2449
+ idle: "Click the microphone to record",
2450
+ starting: "Waiting for microphone permission…",
2451
+ recording: "Recording…",
2452
+ uploading: "Uploading…",
2453
+ retry: "Retry",
2454
+ remove: "Remove",
2455
+ denied: "Microphone access is blocked. Allow the microphone for this site (lock icon in the address bar, or the browser settings) and try again.",
2456
+ noDevice: "No microphone was found on this device. Connect a microphone and try again.",
2457
+ busy: "The microphone cannot be used. It may be in use by another app or tab. Close it and try again.",
2458
+ insecure: "Voice recording only works on secure pages (HTTPS).",
2459
+ unsupported: "This browser does not support voice recording.",
2460
+ recorder: "Recording failed. Please try again.",
2461
+ disconnected: "The microphone was disconnected. The audio recorded so far was kept.",
2462
+ tooShort: "The recording is too short.",
2463
+ unknown: "Could not start the recording.",
2464
+ uploadFailed: "Upload failed"
2465
+ },
2466
+ fa: {
2467
+ start: "ضبط صدا",
2468
+ stop: "پایان ضبط",
2469
+ idle: "برای ضبط صدا اینجا کلیک کنید",
2470
+ starting: "در انتظار اجازه دسترسی به میکروفن…",
2471
+ recording: "در حال ضبط…",
2472
+ uploading: "در حال ارسال…",
2473
+ retry: "تلاش مجدد",
2474
+ remove: "حذف",
2475
+ denied: "دسترسی به میکروفن مسدود است. از آیکن قفل کنار آدرس (یا تنظیمات مرورگر) اجازه استفاده از میکروفن را برای این سایت فعال کنید و دوباره تلاش کنید.",
2476
+ noDevice: "میکروفنی روی این دستگاه پیدا نشد. یک میکروفن وصل کنید و دوباره تلاش کنید.",
2477
+ busy: "امکان استفاده از میکروفن نیست. ممکن است برنامه یا تب دیگری از آن استفاده کند. آن را ببندید و دوباره تلاش کنید.",
2478
+ insecure: "ضبط صدا فقط در صفحه‌های امن (HTTPS) کار می‌کند.",
2479
+ unsupported: "این مرورگر از ضبط صدا پشتیبانی نمی‌کند.",
2480
+ recorder: "ضبط با خطا مواجه شد. دوباره تلاش کنید.",
2481
+ disconnected: "میکروفن قطع شد. صدایی که تا این لحظه ضبط شده بود نگه داشته شد.",
2482
+ tooShort: "مدت ضبط خیلی کوتاه است.",
2483
+ unknown: "شروع ضبط ممکن نشد.",
2484
+ uploadFailed: "خطا در ارسال"
2485
+ }
2486
+ }, Sa = ["audio/ogg;codecs=opus", "audio/webm;codecs=opus", "audio/mp4", "audio/webm", "audio/ogg"];
2487
+ let xe = 0;
2488
+ function _e() {
2489
+ return typeof MediaRecorder > "u" || !MediaRecorder.isTypeSupported ? "" : Sa.find((e) => MediaRecorder.isTypeSupported(e)) || "";
2490
+ }
2491
+ function Ia(e = "") {
2492
+ return /ogg/.test(e) ? "ogg" : /webm/.test(e) ? "webm" : /mp4|aac|m4a/.test(e) ? "m4a" : /mpeg|mp3/.test(e) ? "mp3" : /wav/.test(e) ? "wav" : "audio";
2493
+ }
2494
+ function Ca(e) {
2495
+ switch (e == null ? void 0 : e.name) {
2496
+ case "NotAllowedError":
2497
+ case "PermissionDeniedError":
2498
+ return "denied";
2499
+ case "SecurityError":
2500
+ return typeof window < "u" && window.isSecureContext === !1 ? "insecure" : "denied";
2501
+ case "NotFoundError":
2502
+ case "DevicesNotFoundError":
2503
+ case "OverconstrainedError":
2504
+ case "ConstraintNotSatisfiedError":
2505
+ return "noDevice";
2506
+ case "NotReadableError":
2507
+ case "TrackStartError":
2508
+ case "AbortError":
2509
+ return "busy";
2510
+ default:
2511
+ return "unknown";
2512
+ }
2513
+ }
2514
+ const et = (e) => String(Math.floor(e)).padStart(2, "0"), tt = (e) => `${et(e / 60)}:${et(e % 60)}`, Ma = V({
2515
+ name: "VoiceRecorderInput",
2516
+ emits: ["update:modelValue", "change", "start", "stop", "recorded", "progress", "uploaded", "removed", "error"],
2517
+ props: {
2518
+ ...j,
2519
+ /** box | button */
2520
+ variant: { type: String, default: "box", validator: (e) => ["box", "button"].includes(e) },
2521
+ url: { type: String, default: "/upload" },
2522
+ /** Name of the multipart field. */
2523
+ fieldName: { type: String, default: "file" },
2524
+ multiple: { type: Boolean, default: !1 },
2525
+ headers: { type: Object, default: () => ({}) },
2526
+ /** Stop automatically after this many seconds. */
2527
+ maxDuration: { type: Number, default: null },
2528
+ /** Bitrate of the recording; 32 kbps opus is plenty for speech and keeps files tiny. */
2529
+ audioBitsPerSecond: { type: Number, default: 32e3 },
2530
+ audioConstraints: { type: Object, default: () => ({ echoCancellation: !0, noiseSuppression: !0, autoGainControl: !0 }) },
2531
+ /** Classes of the button in `variant="button"` (idle) … */
2532
+ buttonClass: { type: [String, Array, Object], default: "btn-solid theme-primary" },
2533
+ problemClass: { type: [String, Array, Object], default: "btn-solid theme-danger" },
2534
+ /** … and while recording. */
2535
+ recordingClass: { type: [String, Array, Object], default: "btn-solid theme-danger" },
2536
+ showList: { type: Boolean, default: !0 },
2537
+ /** Ask the server to delete the file (DELETE {url}) when a recording is removed. */
2538
+ deleteOnRemove: { type: Boolean, default: !0 },
2539
+ /** (storedValue) => playable URL — used for recordings that come from the form data (edit pages). */
2540
+ playbackUrl: { type: Function, default: (e) => e },
2541
+ startText: { type: String, default: null },
2542
+ stopText: { type: String, default: null },
2543
+ locale: { type: String, default: null }
2544
+ },
2545
+ setup(e, { emit: t, expose: o }) {
2546
+ const l = R(e, t), { locale: d } = G(() => e.locale), u = De(), n = (y) => (Le[d.value] || Le.en)[y] ?? Le.en[y] ?? y, p = E(null), h = E([]), b = E(!1), w = E(!1), $ = E(0), k = E(null), M = E(!0), r = /* @__PURE__ */ new Map();
2547
+ let s = null, i = null, f = [], I = null, L = 0, T = !1;
2548
+ const W = C(() => e.readonly || l.isDisabled.value), se = C(() => tt($.value)), P = C(() => h.value.some((y) => y.status === "uploading")), we = C(() => !M.value || W.value), ke = C(() => w.value ? n("starting") : b.value ? n("recording") : P.value ? n("uploading") : n("idle")), Se = C(
2549
+ () => b.value ? e.stopText ?? n("stop") : e.startText ?? n("start")
2550
+ );
2551
+ function Q(y, N, a = null) {
2552
+ k.value = { code: y, message: n(y) }, t("error", { code: y, message: k.value.message, error: N ?? null, item: a });
2553
+ }
2554
+ const ie = () => {
2555
+ k.value = null;
2556
+ }, Ie = () => {
2557
+ const y = l.model.value;
2558
+ return e.multiple ? Array.isArray(y) ? y : y ? [y] : [] : y ? [y] : [];
2559
+ };
2560
+ function ue(y) {
2561
+ const N = h.value.filter((g) => g.path).map((g) => g.path), a = e.multiple ? N : N[0] ?? null;
2562
+ l.model.value = a, l.emitChange(a, y);
2563
+ }
2564
+ function x() {
2565
+ const y = l.form.value;
2566
+ if (!y) return;
2567
+ const N = h.value.filter((a) => a.status === "uploading");
2568
+ y.uploading = N.length ? Math.min(99, Math.round(N.reduce((a, g) => a + g.percent, 0) / N.length)) : null;
2569
+ }
2570
+ function ne(y) {
2571
+ y.local && y.src && URL.revokeObjectURL(y.src);
2572
+ }
2573
+ function Ce() {
2574
+ const y = Ie();
2575
+ !y.length && h.value.some((a) => a.path) && (h.value.filter((a) => a.path).forEach(ne), h.value = h.value.filter((a) => !a.path));
2576
+ const N = new Set(h.value.map((a) => a.path).filter(Boolean));
2577
+ y.forEach((a) => {
2578
+ N.has(a) || h.value.push(
2579
+ ye({ id: `v${++xe}`, path: a, src: e.playbackUrl(a), status: "done", percent: 100, seconds: null, error: "", local: !1, file: null })
2580
+ );
2581
+ });
2582
+ }
2583
+ Z(() => {
2584
+ var y;
2585
+ M.value = typeof navigator < "u" && !!((y = navigator.mediaDevices) != null && y.getUserMedia) && typeof MediaRecorder < "u", M.value ? Me() : Q(typeof window < "u" && window.isSecureContext === !1 ? "insecure" : "unsupported"), Ce();
2586
+ }), z(() => l.model.value, Ce, { deep: !0 });
2587
+ async function Me() {
2588
+ var y;
2589
+ try {
2590
+ const N = await ((y = navigator.permissions) == null ? void 0 : y.query({ name: "microphone" }));
2591
+ if (!N || u.isDisposed()) return;
2592
+ const a = () => {
2593
+ var g;
2594
+ N.state === "denied" ? Q("denied") : ((g = k.value) == null ? void 0 : g.code) === "denied" && ie();
2595
+ };
2596
+ a(), N.addEventListener("change", a), u.add(() => N.removeEventListener("change", a));
2597
+ } catch {
2598
+ }
2599
+ }
2600
+ function Te() {
2601
+ i == null || i.getTracks().forEach((y) => y.stop()), i = null;
2602
+ }
2603
+ function le() {
2604
+ $.value = (Date.now() - L) / 1e3, e.maxDuration && $.value >= e.maxDuration && ae();
2605
+ }
2606
+ async function pe() {
2607
+ if (b.value || w.value || we.value) return;
2608
+ ie(), w.value = !0;
2609
+ let y;
2610
+ try {
2611
+ y = await navigator.mediaDevices.getUserMedia({
2612
+ audio: Object.keys(e.audioConstraints || {}).length ? e.audioConstraints : !0
2613
+ });
2614
+ } catch (g) {
2615
+ return w.value = !1, Q(Ca(g), g);
2616
+ }
2617
+ if (w.value = !1, u.isDisposed()) {
2618
+ y.getTracks().forEach((g) => g.stop());
2619
+ return;
2620
+ }
2621
+ const N = _e();
2622
+ let a;
2623
+ try {
2624
+ a = new MediaRecorder(y, { ...N ? { mimeType: N } : {}, audioBitsPerSecond: e.audioBitsPerSecond });
2625
+ } catch {
2626
+ try {
2627
+ a = new MediaRecorder(y);
2628
+ } catch (S) {
2629
+ return y.getTracks().forEach((A) => A.stop()), Q("recorder", S);
2630
+ }
2631
+ }
2632
+ i = y, s = a, f = [], T = !1, a.ondataavailable = (g) => {
2633
+ var S;
2634
+ (S = g.data) != null && S.size && f.push(g.data);
2635
+ }, a.onerror = (g) => {
2636
+ T = !0, Q("recorder", g.error), ae();
2637
+ }, a.onstop = () => de(a), y.getAudioTracks().forEach(
2638
+ (g) => g.addEventListener("ended", () => {
2639
+ b.value && (Q("disconnected"), ae());
2640
+ })
2641
+ ), a.start(500), L = Date.now(), $.value = 0, b.value = !0, I = setInterval(le, 250), t("start");
2642
+ }
2643
+ function ae() {
2644
+ if (clearInterval(I), I = null, s && s.state !== "inactive")
2645
+ try {
2646
+ s.stop();
2647
+ } catch {
2648
+ de(s);
2649
+ }
2650
+ b.value = !1;
2651
+ }
2652
+ function de(y) {
2653
+ clearInterval(I), I = null, b.value = !1;
2654
+ const N = (Date.now() - L) / 1e3, a = f;
2655
+ if (f = [], Te(), s = null, T) return;
2656
+ t("stop", N);
2657
+ const g = y.mimeType || _e() || "audio/webm", S = new Blob(a, { type: g });
2658
+ if (!S.size || N < 0.4) return Q("tooShort");
2659
+ he(S, N);
2660
+ }
2661
+ function U() {
2662
+ return b.value ? ae() : pe();
2663
+ }
2664
+ function he(y, N) {
2665
+ e.multiple || h.value.slice().forEach((S) => Ee(S, !1));
2666
+ const a = new File([y], `voice-${Date.now()}.${Ia(y.type)}`, { type: y.type }), g = ye({
2667
+ id: `v${++xe}`,
2668
+ file: a,
2669
+ src: URL.createObjectURL(a),
2670
+ seconds: Math.round(N),
2671
+ status: "uploading",
2672
+ percent: 0,
2673
+ path: null,
2674
+ error: "",
2675
+ local: !0
2676
+ });
2677
+ h.value = [...h.value, g], t("recorded", g), Be(g);
2678
+ }
2679
+ function Be(y) {
2680
+ y.status = "uploading", y.percent = 0, y.error = "", x();
2681
+ const N = new FormData();
2682
+ N.append(e.fieldName, y.file, y.file.name);
2683
+ const a = new XMLHttpRequest();
2684
+ r.set(y.id, a), a.open("POST", e.url), Object.entries(Oe(e.headers)).forEach(([S, A]) => a.setRequestHeader(S, A)), a.upload.onprogress = (S) => {
2685
+ S.lengthComputable && (y.percent = Math.round(S.loaded / S.total * 100), t("progress", y, y.percent), x());
2686
+ };
2687
+ const g = (S) => {
2688
+ r.delete(y.id), y.status = "error", y.error = S || n("uploadFailed"), x(), Q("uploadFailed", null, y), k.value = { code: "uploadFailed", message: y.error };
2689
+ };
2690
+ a.onerror = () => g(), a.onload = () => {
2691
+ let S = null;
2692
+ try {
2693
+ S = JSON.parse(a.responseText);
2694
+ } catch {
2695
+ }
2696
+ if (a.status < 200 || a.status >= 300) {
2697
+ const J = S != null && S.errors ? Object.values(S.errors)[0] : null;
2698
+ return g((S == null ? void 0 : S.message) || (Array.isArray(J) ? J[0] : J));
2699
+ }
2700
+ const A = (S == null ? void 0 : S.data) ?? S, H = (A == null ? void 0 : A.path) ?? (A == null ? void 0 : A.url);
2701
+ if (!H) return g();
2702
+ r.delete(y.id), y.path = H, y.status = "done", y.percent = 100, x(), ie(), ue(), t("uploaded", y, S);
2703
+ }, a.send(N);
2704
+ }
2705
+ async function Ee(y, N = !0) {
2706
+ var a;
2707
+ if ((a = r.get(y.id)) == null || a.abort(), r.delete(y.id), ne(y), h.value = h.value.filter((g) => g.id !== y.id), x(), y.path && (ue(), e.deleteOnRemove))
2708
+ try {
2709
+ await fetch(e.url, {
2710
+ method: "DELETE",
2711
+ headers: Oe(e.headers),
2712
+ credentials: "same-origin",
2713
+ body: y.path
2714
+ });
2715
+ } catch {
2716
+ }
2717
+ N && t("removed", y);
2718
+ }
2719
+ function ve(y) {
2720
+ var N;
2721
+ (N = p.value) == null || N.querySelectorAll("audio").forEach((a) => {
2722
+ a !== y.target && a.pause();
2723
+ });
2724
+ }
2725
+ return u.add(() => {
2726
+ if (T = !0, clearInterval(I), s && s.state !== "inactive")
2727
+ try {
2728
+ s.stop();
2729
+ } catch {
2730
+ }
2731
+ Te(), r.forEach((y) => y.abort()), r.clear(), h.value.forEach(ne), l.form.value && (l.form.value.uploading = null);
2732
+ }), o({ start: pe, stop: ae, toggle: U }), {
2733
+ ...l,
2734
+ t: n,
2735
+ root: p,
2736
+ items: h,
2737
+ recording: b,
2738
+ starting: w,
2739
+ seconds: $,
2740
+ time: se,
2741
+ problem: k,
2742
+ supported: M,
2743
+ blocked: we,
2744
+ statusText: ke,
2745
+ buttonLabel: Se,
2746
+ toggle: U,
2747
+ upload: Be,
2748
+ remove: Ee,
2749
+ onPlay: ve,
2750
+ formatTime: tt
2751
+ };
2752
+ }
2753
+ }), Ta = ["id"], Ba = {
2754
+ key: 0,
2755
+ class: "card w-100"
2756
+ }, Ea = { class: "card-body" }, Aa = { class: "row gx-5" }, Oa = {
2757
+ key: 0,
2758
+ class: "col-auto mx-auto"
2759
+ }, Na = ["data-code"], Da = { class: "col-12 text-center" }, Va = { class: "row gx-5 align-items-center" }, qa = { class: "col-auto" }, Fa = ["disabled", "aria-label", "aria-pressed"], La = {
2760
+ key: 0,
2761
+ class: "spinner-border spinner-sm",
2762
+ role: "status",
2763
+ "aria-hidden": "true"
2764
+ }, ja = {
2765
+ key: 1,
2766
+ width: "18",
2767
+ height: "18",
2768
+ viewBox: "0 0 16 16",
2769
+ fill: "currentColor",
2770
+ "aria-hidden": "true"
2771
+ }, Ra = {
2772
+ key: 2,
2773
+ width: "18",
2774
+ height: "18",
2775
+ viewBox: "0 0 16 16",
2776
+ fill: "none",
2777
+ stroke: "currentColor",
2778
+ "stroke-width": "1.5",
2779
+ "stroke-linecap": "round",
2780
+ "stroke-linejoin": "round",
2781
+ "aria-hidden": "true"
2782
+ }, za = { class: "col" }, Pa = { class: "flex-grow-1 text-center" }, Ua = {
2783
+ class: "fw-semibold",
2784
+ role: "status",
2785
+ "aria-live": "polite"
2786
+ }, Ha = {
2787
+ class: "fg-secondary fanum",
2788
+ dir: "ltr"
2789
+ }, Ka = {
2790
+ key: 0,
2791
+ class: "col-auto"
2792
+ }, Xa = {
2793
+ key: 0,
2794
+ class: "list-group mt-2"
2795
+ }, Ga = { class: "row gx-3 align-items-center" }, Wa = { class: "col-12 sm:col-4" }, Qa = ["src"], Ja = {
2796
+ key: 0,
2797
+ class: "col-auto"
2798
+ }, Za = {
2799
+ class: "fg-secondary fanum",
2800
+ dir: "ltr"
2801
+ }, Ya = { class: "col" }, xa = ["aria-valuenow"], _a = {
2802
+ key: 1,
2803
+ class: "fg-danger",
2804
+ role: "alert"
2805
+ }, eo = {
2806
+ key: 1,
2807
+ class: "col-auto"
2808
+ }, to = ["aria-label", "onClick"], no = { class: "col-auto" }, lo = ["aria-label", "onClick"], ao = ["disabled", "aria-pressed"], oo = {
2809
+ key: 0,
2810
+ class: "spinner-border spinner-sm me-2",
2811
+ role: "status",
2812
+ "aria-hidden": "true"
2813
+ }, ro = {
2814
+ key: 1,
2815
+ class: "me-2",
2816
+ width: "16",
2817
+ height: "16",
2818
+ viewBox: "0 0 16 16",
2819
+ fill: "currentColor",
2820
+ "aria-hidden": "true"
2821
+ }, so = {
2822
+ key: 2,
2823
+ class: "me-2",
2824
+ width: "16",
2825
+ height: "16",
2826
+ viewBox: "0 0 16 16",
2827
+ fill: "none",
2828
+ stroke: "currentColor",
2829
+ "stroke-width": "1.5",
2830
+ "stroke-linecap": "round",
2831
+ "stroke-linejoin": "round",
2832
+ "aria-hidden": "true"
2833
+ }, io = {
2834
+ key: 3,
2835
+ class: "ms-2 fanum",
2836
+ dir: "ltr"
2837
+ };
2838
+ function uo(e, t, o, l, d, u) {
2839
+ return c(), v("div", {
2840
+ ref: "root",
2841
+ class: D(["voice-recorder", { "is-invalid": e.isInvalid }]),
2842
+ id: e.inputId
2843
+ }, [
2844
+ e.variant === "box" ? (c(), v("div", Ba, [
2845
+ m("div", Ea, [
2846
+ m("div", Aa, [
2847
+ e.problem ? (c(), v("div", Oa, [
2848
+ m("div", {
2849
+ class: "alert theme-danger p-1 text-center mb-4",
2850
+ role: "alert",
2851
+ "data-code": e.problem.code
2852
+ }, O(e.problem.message), 9, Na)
2853
+ ])) : B("", !0),
2854
+ m("div", Da, [
2855
+ m("div", {
2856
+ class: "btn btn-subtle theme-inverse mx-auto",
2857
+ onClick: t[0] || (t[0] = (...n) => e.toggle && e.toggle(...n))
2858
+ }, [
2859
+ m("div", Va, [
2860
+ m("div", qa, [
2861
+ m("button", {
2862
+ type: "button",
2863
+ class: D(["btn", e.recording ? e.recordingClass : e.buttonClass]),
2864
+ disabled: e.blocked || e.starting,
2865
+ "aria-label": e.buttonLabel,
2866
+ "aria-pressed": e.recording
2867
+ }, [
2868
+ e.starting ? (c(), v("span", La)) : e.recording ? (c(), v("svg", ja, t[3] || (t[3] = [
2869
+ m("rect", {
2870
+ x: "3.5",
2871
+ y: "3.5",
2872
+ width: "9",
2873
+ height: "9",
2874
+ rx: "1.5"
2875
+ }, null, -1)
2876
+ ]))) : (c(), v("svg", Ra, t[4] || (t[4] = [
2877
+ m("rect", {
2878
+ x: "5.5",
2879
+ y: "1.5",
2880
+ width: "5",
2881
+ height: "8",
2882
+ rx: "2.5"
2883
+ }, null, -1),
2884
+ m("path", { d: "M3 7.5a5 5 0 0 0 10 0M8 12.5v2" }, null, -1)
2885
+ ])))
2886
+ ], 10, Fa)
2887
+ ]),
2888
+ m("div", za, [
2889
+ m("div", Pa, [
2890
+ m("div", Ua, O(e.statusText), 1),
2891
+ m("div", Ha, [
2892
+ Y(O(e.time) + " ", 1),
2893
+ e.maxDuration ? (c(), v(X, { key: 0 }, [
2894
+ Y(" / " + O(e.formatTime(e.maxDuration)), 1)
2895
+ ], 64)) : B("", !0)
2896
+ ])
2897
+ ])
2898
+ ]),
2899
+ e.recording ? (c(), v("div", Ka, t[5] || (t[5] = [
2900
+ m("span", {
2901
+ class: "spinner-grow spinner-sm fg-danger",
2902
+ role: "status",
2903
+ "aria-hidden": "true"
2904
+ }, null, -1)
2905
+ ]))) : B("", !0)
2906
+ ])
2907
+ ])
2908
+ ])
2909
+ ]),
2910
+ e.showList && e.items.length ? (c(), v("ul", Xa, [
2911
+ (c(!0), v(X, null, ee(e.items, (n) => (c(), v("li", {
2912
+ key: n.id,
2913
+ class: "list-group-item"
2914
+ }, [
2915
+ m("div", Ga, [
2916
+ m("div", Wa, [
2917
+ m("audio", {
2918
+ class: "align-middle w-100",
2919
+ controls: "",
2920
+ preload: "metadata",
2921
+ src: n.src,
2922
+ onPlay: t[1] || (t[1] = (...p) => e.onPlay && e.onPlay(...p))
2923
+ }, null, 40, Qa)
2924
+ ]),
2925
+ n.seconds !== null ? (c(), v("div", Ja, [
2926
+ m("span", Za, O(e.formatTime(n.seconds)), 1)
2927
+ ])) : B("", !0),
2928
+ m("div", Ya, [
2929
+ n.status === "uploading" ? (c(), v("div", {
2930
+ key: 0,
2931
+ class: "progress",
2932
+ role: "progressbar",
2933
+ "aria-valuenow": n.percent,
2934
+ "aria-valuemin": "0",
2935
+ "aria-valuemax": "100"
2936
+ }, [
2937
+ m("div", {
2938
+ class: "progress-bar",
2939
+ style: oe({ width: n.percent + "%" })
2940
+ }, null, 4)
2941
+ ], 8, xa)) : B("", !0),
2942
+ n.status === "error" ? (c(), v("div", _a, O(n.error), 1)) : B("", !0)
2943
+ ]),
2944
+ n.status === "error" ? (c(), v("div", eo, [
2945
+ m("button", {
2946
+ type: "button",
2947
+ class: "btn-text theme-secondary btn-icon",
2948
+ "aria-label": e.t("retry"),
2949
+ onClick: (p) => e.upload(n)
2950
+ }, t[6] || (t[6] = [
2951
+ m("svg", {
2952
+ width: "16",
2953
+ height: "16",
2954
+ viewBox: "0 0 16 16",
2955
+ fill: "none",
2956
+ stroke: "currentColor",
2957
+ "stroke-width": "1.5",
2958
+ "stroke-linecap": "round",
2959
+ "stroke-linejoin": "round",
2960
+ "aria-hidden": "true"
2961
+ }, [
2962
+ m("path", { d: "M13.5 3v3.5H10" }),
2963
+ m("path", { d: "M3.2 6.5A5.5 5.5 0 0 1 13 6.5M12.8 9.5A5.5 5.5 0 0 1 3 9.5M2.5 13V9.5H6" })
2964
+ ], -1)
2965
+ ]), 8, to)
2966
+ ])) : B("", !0),
2967
+ m("div", no, [
2968
+ e.locked ? B("", !0) : (c(), v("button", {
2969
+ key: 0,
2970
+ type: "button",
2971
+ class: "btn-text theme-danger btn-icon",
2972
+ "aria-label": e.t("remove"),
2973
+ onClick: (p) => e.remove(n)
2974
+ }, t[7] || (t[7] = [
2975
+ m("svg", {
2976
+ width: "16",
2977
+ height: "16",
2978
+ viewBox: "0 0 16 16",
2979
+ fill: "none",
2980
+ stroke: "currentColor",
2981
+ "stroke-width": "1.5",
2982
+ "stroke-linecap": "round",
2983
+ "stroke-linejoin": "round",
2984
+ "aria-hidden": "true"
2985
+ }, [
2986
+ m("path", { d: "M2.5 4.5h11M6 4.5V3a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v1.5M4 4.5l.6 8.1a1 1 0 0 0 1 .9h4.8a1 1 0 0 0 1-.9l.6-8.1" })
2987
+ ], -1)
2988
+ ]), 8, lo))
2989
+ ])
2990
+ ])
2991
+ ]))), 128))
2992
+ ])) : B("", !0)
2993
+ ])
2994
+ ])) : (c(), v("button", {
2995
+ key: 1,
2996
+ type: "button",
2997
+ disabled: e.blocked || e.starting,
2998
+ "aria-pressed": e.recording,
2999
+ class: D({
3000
+ [e.recordingClass]: e.recording,
3001
+ [e.buttonClass]: !e.problem && !e.recording,
3002
+ [e.problemClass]: e.problem
3003
+ }),
3004
+ onClick: t[2] || (t[2] = (...n) => e.toggle && e.toggle(...n))
3005
+ }, [
3006
+ F(e.$slots, "default", {
3007
+ recording: e.recording,
3008
+ starting: e.starting,
3009
+ seconds: e.seconds,
3010
+ time: e.time
3011
+ }, () => [
3012
+ e.starting ? (c(), v("span", oo)) : e.recording ? (c(), v("svg", ro, t[8] || (t[8] = [
3013
+ m("rect", {
3014
+ x: "3.5",
3015
+ y: "3.5",
3016
+ width: "9",
3017
+ height: "9",
3018
+ rx: "1.5"
3019
+ }, null, -1)
3020
+ ]))) : (c(), v("svg", so, t[9] || (t[9] = [
3021
+ m("rect", {
3022
+ x: "5.5",
3023
+ y: "1.5",
3024
+ width: "5",
3025
+ height: "8",
3026
+ rx: "2.5"
3027
+ }, null, -1),
3028
+ m("path", { d: "M3 7.5a5 5 0 0 0 10 0M8 12.5v2" }, null, -1)
3029
+ ]))),
3030
+ Y(" " + O(e.buttonLabel) + " ", 1),
3031
+ e.recording ? (c(), v("span", io, O(e.time), 1)) : B("", !0)
3032
+ ])
3033
+ ], 10, ao))
3034
+ ], 10, Ta);
3035
+ }
3036
+ const fo = /* @__PURE__ */ q(Ma, [["render", uo]]);
3037
+ function $o() {
3038
+ const e = ce("form", null), t = ce("formApi", null);
3039
+ return {
3040
+ form: e,
3041
+ submit: (...o) => {
3042
+ var l;
3043
+ return (l = t == null ? void 0 : t.submit) == null ? void 0 : l.call(t, ...o);
3044
+ },
3045
+ reset: () => {
3046
+ var o;
3047
+ return (o = t == null ? void 0 : t.reset) == null ? void 0 : o.call(t);
3048
+ }
3049
+ };
3050
+ }
3051
+ const co = at, mo = ut, po = He, ho = {
3052
+ AmountInput: kt,
3053
+ CaptchaInput: Et,
3054
+ VoiceRecorderInput: fo,
3055
+ CheckboxButtonInput: Dt,
3056
+ CheckboxInput: Rt,
3057
+ CheckboxToggle: Kt,
3058
+ ChipsInput: Yt,
3059
+ ComboboxInput: at,
3060
+ EmailInput: Sn,
3061
+ FileInput: ot,
3062
+ FormAdornInput: He,
3063
+ FormContainer: _n,
3064
+ FormField: dl,
3065
+ FormLabel: rt,
3066
+ GroupControl: st,
3067
+ MobileInput: vl,
3068
+ MultiQuantityInput: Nl,
3069
+ OTPInput: Ll,
3070
+ PasswordInput: Gl,
3071
+ QuantityInput: it,
3072
+ RangeInput: ut,
3073
+ SimpleUploader: _l,
3074
+ StarRatingInput: oa,
3075
+ SubmitButton: fa,
3076
+ SwitchInput: ya,
3077
+ TextAreaInput: ka,
3078
+ TextInput: qe,
3079
+ // aliases
3080
+ Select2Input: co,
3081
+ RangeSliderInput: mo,
3082
+ FormAdorn: po
3083
+ }, wo = {
3084
+ install(e, t = {}) {
3085
+ (t.locale || t.messages) && pt(t), t.bootstrap && Xt(t.bootstrap), Object.entries(ho).forEach(([o, l]) => e.component(o, l));
3086
+ }
3087
+ };
3088
+ export {
3089
+ kt as AmountInput,
3090
+ Et as CaptchaInput,
3091
+ Dt as CheckboxButtonInput,
3092
+ Rt as CheckboxInput,
3093
+ Kt as CheckboxToggle,
3094
+ Yt as ChipsInput,
3095
+ at as ComboboxInput,
3096
+ Sn as EmailInput,
3097
+ ot as FileInput,
3098
+ po as FormAdorn,
3099
+ He as FormAdornInput,
3100
+ _n as FormContainer,
3101
+ dl as FormField,
3102
+ rt as FormLabel,
3103
+ st as GroupControl,
3104
+ vl as MobileInput,
3105
+ Nl as MultiQuantityInput,
3106
+ Ll as OTPInput,
3107
+ Gl as PasswordInput,
3108
+ it as QuantityInput,
3109
+ ut as RangeInput,
3110
+ mo as RangeSliderInput,
3111
+ co as Select2Input,
3112
+ _l as SimpleUploader,
3113
+ oa as StarRatingInput,
3114
+ fa as SubmitButton,
3115
+ ya as SwitchInput,
3116
+ ka as TextAreaInput,
3117
+ qe as TextInput,
3118
+ fo as VoiceRecorderInput,
3119
+ Xt as configureBootstrap,
3120
+ pt as configureI18n,
3121
+ wo as default,
3122
+ j as fieldProps,
3123
+ Ue as toEnglishDigits,
3124
+ me as useBsInstance,
3125
+ De as useDisposables,
3126
+ R as useField,
3127
+ $o as useFormApi
3128
+ };