@formatica/vue 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2764 @@
1
+ import { titleCase as Fe, evaluateCondition as se, getRule as Te, extractFields as P, sanitizeHtml as Ie, isFieldNode as Ce } from "@formatica/core";
2
+ export * from "@formatica/core";
3
+ import { inject as J, provide as ie, ref as D, reactive as re, computed as h, watch as Y, isRef as Le, defineComponent as j, openBlock as c, createElementBlock as f, normalizeClass as S, Fragment as z, renderList as G, createElementVNode as p, normalizeStyle as O, createCommentVNode as T, toDisplayString as L, withKeys as he, withModifiers as q, createTextVNode as _, onMounted as ue, withDirectives as de, vModelText as ve, nextTick as te, onBeforeUnmount as Ve, unref as H, createVNode as Z, Transition as ae, withCtx as W, renderSlot as Ae, TransitionGroup as Ne, createBlock as U, resolveDynamicComponent as Se, mergeProps as De, vShow as Me, resolveComponent as Ee, toRef as Re } from "vue";
4
+ import { getCountries as xe, getCountryCallingCode as ke, parsePhoneNumber as je, AsYouType as Oe } from "libphonenumber-js";
5
+ const Be = Symbol("FormaticaComponents"), le = /* @__PURE__ */ new Map();
6
+ function ze(e, i) {
7
+ le.set(e, i);
8
+ }
9
+ function Bl(e) {
10
+ le.delete(e);
11
+ }
12
+ function Ke(e) {
13
+ return le.get(e);
14
+ }
15
+ function Pe(e) {
16
+ return le.has(e);
17
+ }
18
+ function Fl() {
19
+ return Array.from(le.keys());
20
+ }
21
+ function Ue() {
22
+ const e = /* @__PURE__ */ new Map();
23
+ function i(a, r) {
24
+ e.has(a) || e.set(a, /* @__PURE__ */ new Set());
25
+ const u = e.get(a);
26
+ return u ? (u.add(r), () => {
27
+ u.delete(r);
28
+ }) : () => {
29
+ };
30
+ }
31
+ function t(a, r) {
32
+ const u = e.get(a);
33
+ if (u)
34
+ for (const d of u)
35
+ d(r);
36
+ }
37
+ return { on: i, emit: t };
38
+ }
39
+ const ye = Symbol("FormaticaI18n"), He = {
40
+ required: "This field is required",
41
+ email: "Please enter a valid email address",
42
+ url: "Please enter a valid URL",
43
+ min: "Must be at least {min}",
44
+ max: "Must be at most {max}",
45
+ minLength: "Must be at least {min} characters",
46
+ maxLength: "Must be at most {max} characters",
47
+ between: "Must be between {min} and {max}",
48
+ pattern: "Invalid format",
49
+ numeric: "Must be a number",
50
+ integer: "Must be an integer",
51
+ alpha: "Must contain only letters",
52
+ alphaNumeric: "Must contain only letters and numbers",
53
+ confirmed: "Confirmation does not match",
54
+ date: "Please enter a valid date"
55
+ };
56
+ function Ge(e) {
57
+ const {
58
+ locale: i,
59
+ fallbackLocale: t = "en",
60
+ fieldTranslations: a = {},
61
+ formTranslations: r = {}
62
+ } = e;
63
+ function u(o, s) {
64
+ const g = a[o];
65
+ if (g) {
66
+ const $ = g[i.value];
67
+ if ($) {
68
+ const b = $[s];
69
+ if (typeof b == "string") return b;
70
+ }
71
+ const V = g[t];
72
+ if (V) {
73
+ const b = V[s];
74
+ if (typeof b == "string") return b;
75
+ }
76
+ }
77
+ return s === "label" ? Fe(o) : "";
78
+ }
79
+ function d(o, s) {
80
+ var $, V;
81
+ const g = a[o];
82
+ if (g) {
83
+ const b = g[i.value];
84
+ if (($ = b == null ? void 0 : b.options) != null && $[s]) return b.options[s];
85
+ const v = g[t];
86
+ if ((V = v == null ? void 0 : v.options) != null && V[s]) return v.options[s];
87
+ }
88
+ return s;
89
+ }
90
+ function l(o, s) {
91
+ var b, v;
92
+ const g = (b = r[i.value]) == null ? void 0 : b.messages;
93
+ if (g != null && g[o])
94
+ return fe(g[o], s ?? {});
95
+ const $ = (v = r[t]) == null ? void 0 : v.messages;
96
+ if ($ != null && $[o])
97
+ return fe($[o], s ?? {});
98
+ const V = He[o];
99
+ return V ? fe(V, s ?? {}) : `Validation failed: ${o}`;
100
+ }
101
+ const n = {
102
+ locale: i,
103
+ fallbackLocale: t,
104
+ t: u,
105
+ tOption: d,
106
+ tValidation: l
107
+ };
108
+ return ie(ye, n), n;
109
+ }
110
+ function Ze() {
111
+ return J(ye);
112
+ }
113
+ function fe(e, i) {
114
+ return e.replace(/\{(\w+)\}/g, (t, a) => i[a] !== void 0 ? String(i[a]) : `{${a}}`);
115
+ }
116
+ function we(e) {
117
+ return e.split("|").map((i) => {
118
+ const [t, ...a] = i.split(":"), r = {};
119
+ if (a.length > 0) {
120
+ const d = a.join(":").split(",");
121
+ t === "between" && d.length === 2 ? (r.min = d[0], r.max = d[1]) : d.length === 1 ? r[t] = d[0] : r.values = d;
122
+ }
123
+ return { name: t, params: r };
124
+ });
125
+ }
126
+ function qe(e) {
127
+ const i = e.rules;
128
+ if (!i) {
129
+ const a = [];
130
+ return e.required && a.push({ name: "required" }), a;
131
+ }
132
+ if (typeof i == "string")
133
+ return we(i);
134
+ if (Array.isArray(i))
135
+ return i.flatMap((a) => typeof a == "string" ? we(a) : []);
136
+ const t = [];
137
+ for (const [a, r] of Object.entries(i)) {
138
+ if (r === !1) continue;
139
+ const u = {};
140
+ typeof r == "object" && r !== null && !Array.isArray(r) ? Object.assign(u, r) : r !== !0 && (u[a] = r), t.push({ name: a, params: u });
141
+ }
142
+ return t;
143
+ }
144
+ function Ye(e, i) {
145
+ let t = null, a = null;
146
+ return (...r) => new Promise((u) => {
147
+ t !== null && (clearTimeout(t), a && a([])), a = u, t = setTimeout(async () => {
148
+ t = null;
149
+ const d = await e(...r);
150
+ u(d), a = null;
151
+ }, i);
152
+ });
153
+ }
154
+ function Je(e) {
155
+ const { fields: i, values: t, settings: a } = e, r = D({}), u = /* @__PURE__ */ new Map();
156
+ function d($, V) {
157
+ const b = `${$}:${V}`;
158
+ u.has(b) || u.set(
159
+ b,
160
+ Ye(async (...m) => l(m[0], m[1]), V)
161
+ );
162
+ const v = u.get(b);
163
+ if (!v) throw new Error(`Debounced validator not found for ${b}`);
164
+ return v;
165
+ }
166
+ async function l($, V) {
167
+ var F;
168
+ const b = i.value.find((k) => k.name === $);
169
+ if (!b) return [];
170
+ const v = qe(b), m = t.value[$], y = [];
171
+ for (const k of v) {
172
+ if ((F = k.params) != null && F.when) {
173
+ const w = k.params.when;
174
+ if (("field" in w || "and" in w || "or" in w) && !se(
175
+ w,
176
+ t.value
177
+ ))
178
+ continue;
179
+ }
180
+ if (k.optional && We(m)) continue;
181
+ let C;
182
+ if (k.validator)
183
+ C = await k.validator(m, k.params ?? {}, V);
184
+ else {
185
+ const w = Te(k.name);
186
+ if (!w) continue;
187
+ C = await w(m, k.params ?? {}, V);
188
+ }
189
+ if (C !== !0) {
190
+ const w = k.message ? _e(k.message, k.params ?? {}) : typeof C == "string" ? C : `Validation failed for rule: ${k.name}`;
191
+ if (y.push(w), k.bail) break;
192
+ }
193
+ }
194
+ return r.value[$] = y, y;
195
+ }
196
+ async function n($, V) {
197
+ const b = a == null ? void 0 : a.debounce;
198
+ return b && b > 0 ? d($, b)($, V) : l($, V);
199
+ }
200
+ async function o($) {
201
+ const V = {}, b = i.value.map(async (v) => {
202
+ const m = await l(v.name, $);
203
+ m.length > 0 && (V[v.name] = m);
204
+ });
205
+ return await Promise.all(b), r.value = { ...V }, V;
206
+ }
207
+ function s($) {
208
+ delete r.value[$];
209
+ }
210
+ function g() {
211
+ r.value = {};
212
+ }
213
+ return {
214
+ errors: r,
215
+ validateField: n,
216
+ validateAll: o,
217
+ clearFieldErrors: s,
218
+ clearAllErrors: g
219
+ };
220
+ }
221
+ function We(e) {
222
+ return !!(e == null || e === "" || Array.isArray(e) && e.length === 0);
223
+ }
224
+ function _e(e, i) {
225
+ return e.replace(/\{(\w+)\}/g, (t, a) => i[a] !== void 0 ? String(i[a]) : `{${a}}`);
226
+ }
227
+ const ce = Symbol("FormaticaContext");
228
+ function Qe(e) {
229
+ switch (e.type) {
230
+ case "tags":
231
+ return [];
232
+ case "checkbox-group":
233
+ return [];
234
+ case "checkbox":
235
+ return !1;
236
+ case "switch":
237
+ return !1;
238
+ case "number":
239
+ case "slider":
240
+ return null;
241
+ case "file":
242
+ return null;
243
+ default:
244
+ return "";
245
+ }
246
+ }
247
+ function me(e) {
248
+ const i = {};
249
+ for (const t of e)
250
+ i[t.name] = t.defaultValue ?? Qe(t);
251
+ return i;
252
+ }
253
+ function Xe(e) {
254
+ const i = {};
255
+ for (const t of e)
256
+ t.translations && (i[t.name] = t.translations);
257
+ return i;
258
+ }
259
+ function et(e, i) {
260
+ const t = D((i == null ? void 0 : i.locale) ?? "en"), a = (i == null ? void 0 : i.fallbackLocale) ?? "en";
261
+ let r = e;
262
+ const u = D(P(e.fields)), d = re(me(P(e.fields))), l = re({}), n = re({}), o = re({}), s = D(!1), g = D(0), $ = h(() => Object.values(l).every((x) => x.length === 0)), V = h(() => Object.values(o).some(Boolean)), b = Ue();
263
+ function v() {
264
+ return { values: { ...d }, getFieldValue: (x) => d[x] };
265
+ }
266
+ const m = h(() => ({ ...d })), y = Je({
267
+ fields: u,
268
+ values: m,
269
+ settings: e.settings
270
+ });
271
+ Ge({
272
+ locale: t,
273
+ fallbackLocale: a,
274
+ fieldTranslations: Xe(P(e.fields)),
275
+ formTranslations: e.translations
276
+ });
277
+ let F = me(P(e.fields));
278
+ Y(
279
+ () => ({ ...d }),
280
+ (x, I) => {
281
+ var M;
282
+ if (I) {
283
+ for (const E of Object.keys(x))
284
+ x[E] !== I[E] && (o[E] = !0, b.emit("field:change", {
285
+ field: E,
286
+ value: x[E],
287
+ previousValue: I[E]
288
+ }), (M = e.settings) != null && M.validateOnChange && N(E));
289
+ b.emit("change", { values: x });
290
+ }
291
+ },
292
+ { deep: !0 }
293
+ );
294
+ const k = /* @__PURE__ */ new Map();
295
+ function C(x) {
296
+ const I = x.name;
297
+ return {
298
+ name: I,
299
+ value: h({
300
+ get: () => d[I],
301
+ set: (M) => {
302
+ d[I] = M;
303
+ }
304
+ }),
305
+ errors: h(() => l[I] ?? []),
306
+ touched: h({
307
+ get: () => n[I] ?? !1,
308
+ set: (M) => {
309
+ n[I] = M;
310
+ }
311
+ }),
312
+ dirty: h({
313
+ get: () => o[I] ?? !1,
314
+ set: (M) => {
315
+ o[I] = M;
316
+ }
317
+ }),
318
+ disabled: h(
319
+ () => typeof x.disabled == "function" ? x.disabled(v()) : x.disabled ?? !1
320
+ ),
321
+ visible: h(() => x.condition ? se(x.condition, d) : typeof x.visible == "function" ? x.visible(v()) : x.visible ?? !0),
322
+ schema: x,
323
+ validate: () => N(I),
324
+ reset: () => {
325
+ d[I] = F[I] ?? null, delete l[I], n[I] = !1, o[I] = !1;
326
+ },
327
+ clear: () => {
328
+ d[I] = null, delete l[I];
329
+ }
330
+ };
331
+ }
332
+ function w() {
333
+ k.clear();
334
+ for (const x of P(r.fields))
335
+ k.set(x.name, C(x));
336
+ }
337
+ w();
338
+ async function N(x) {
339
+ const I = await y.validateField(x, v());
340
+ return l[x] = I, b.emit("validate:field", {
341
+ field: x,
342
+ valid: I.length === 0,
343
+ errors: I
344
+ }), I;
345
+ }
346
+ async function B() {
347
+ const x = await y.validateAll(v());
348
+ for (const M of Object.keys(l))
349
+ M in x || delete l[M];
350
+ for (const [M, E] of Object.entries(x))
351
+ l[M] = E;
352
+ const I = Object.values(x).every((M) => M.length === 0);
353
+ return b.emit("validate", { valid: I, errors: { ...x } }), I;
354
+ }
355
+ async function A(x) {
356
+ s.value = !0, g.value += 1;
357
+ try {
358
+ for (const M of P(r.fields)) n[M.name] = !0;
359
+ if (!await B()) {
360
+ b.emit("submit:error", {
361
+ values: { ...d },
362
+ error: new Error("Validation failed")
363
+ });
364
+ return;
365
+ }
366
+ b.emit("submit", { values: { ...d } }), x && await x({ ...d }, v()), b.emit("submit:success", { values: { ...d }, result: void 0 });
367
+ } catch (I) {
368
+ throw b.emit("submit:error", { values: { ...d }, error: I }), I;
369
+ } finally {
370
+ s.value = !1;
371
+ }
372
+ }
373
+ function R() {
374
+ for (const x of P(r.fields))
375
+ d[x.name] = F[x.name] ?? null, delete l[x.name], n[x.name] = !1, o[x.name] = !1;
376
+ y.clearAllErrors(), b.emit("reset", void 0);
377
+ }
378
+ function Q() {
379
+ for (const x of P(r.fields))
380
+ d[x.name] = null, delete l[x.name];
381
+ y.clearAllErrors();
382
+ }
383
+ function ee(x) {
384
+ r = x;
385
+ const I = P(x.fields);
386
+ u.value = I, F = me(I);
387
+ for (const E of I)
388
+ E.name in d || (d[E.name] = E.defaultValue ?? null);
389
+ const M = new Set(I.map((E) => E.name));
390
+ for (const E of Object.keys(d))
391
+ M.has(E) || (delete d[E], delete l[E], delete n[E], delete o[E]);
392
+ w();
393
+ }
394
+ const ge = {
395
+ values: d,
396
+ errors: l,
397
+ touched: n,
398
+ dirty: o,
399
+ isValid: $,
400
+ isDirty: V,
401
+ isSubmitting: s,
402
+ submitCount: g,
403
+ validate: B,
404
+ validateField: N,
405
+ submit: A,
406
+ reset: R,
407
+ clear: Q,
408
+ setError: (x, I) => {
409
+ l[x] = I;
410
+ },
411
+ clearError: (x) => {
412
+ delete l[x], y.clearFieldErrors(x);
413
+ },
414
+ clearErrors: () => {
415
+ for (const x of Object.keys(l)) delete l[x];
416
+ y.clearAllErrors();
417
+ },
418
+ getField: (x) => k.get(x),
419
+ setFieldValue: (x, I) => {
420
+ d[x] = I;
421
+ },
422
+ setFieldDisabled: (x, I) => {
423
+ const M = P(r.fields).find((E) => E.name === x);
424
+ M && (M.disabled = I);
425
+ },
426
+ setFieldVisible: (x, I) => {
427
+ const M = P(r.fields).find((E) => E.name === x);
428
+ M && (M.visible = I);
429
+ },
430
+ on: b.on,
431
+ locale: t,
432
+ setLocale: (x) => {
433
+ t.value = x;
434
+ },
435
+ schema: r,
436
+ updateSchema: ee
437
+ };
438
+ return ie(ce, ge), ge;
439
+ }
440
+ const pe = Symbol("FormaticaTheme"), be = {
441
+ name: "default",
442
+ colors: {
443
+ primary: "#3b82f6",
444
+ primaryHover: "#2563eb",
445
+ error: "#ef4444",
446
+ errorHover: "#dc2626",
447
+ success: "#22c55e",
448
+ warning: "#f59e0b",
449
+ info: "#3b82f6",
450
+ text: "#1f2937",
451
+ textSecondary: "#6b7280",
452
+ textDisabled: "#9ca3af",
453
+ background: "#ffffff",
454
+ backgroundDisabled: "#f3f4f6",
455
+ border: "#d1d5db",
456
+ borderFocus: "#3b82f6",
457
+ borderError: "#ef4444",
458
+ placeholder: "#9ca3af"
459
+ },
460
+ typography: {
461
+ fontFamily: "inherit",
462
+ fontSize: "0.875rem",
463
+ fontSizeSmall: "0.75rem",
464
+ fontSizeLarge: "1rem",
465
+ lineHeight: "1.5",
466
+ labelFontWeight: "500"
467
+ },
468
+ spacing: {
469
+ fieldGap: "1rem",
470
+ rowGap: "1rem",
471
+ inputPaddingX: "0.75rem",
472
+ inputPaddingY: "0.5rem",
473
+ labelMarginBottom: "0.375rem"
474
+ },
475
+ borders: {
476
+ radius: "0.375rem",
477
+ radiusSmall: "0.25rem",
478
+ radiusLarge: "0.5rem",
479
+ width: "1px",
480
+ style: "solid"
481
+ },
482
+ shadows: {
483
+ focus: "0 0 0 3px rgba(59, 130, 246, 0.1)",
484
+ error: "0 0 0 3px rgba(239, 68, 68, 0.1)",
485
+ dropdown: "0 4px 6px -1px rgba(0, 0, 0, 0.1)"
486
+ },
487
+ transitions: {
488
+ duration: "150ms",
489
+ timingFunction: "ease-in-out"
490
+ }
491
+ };
492
+ function tt(e) {
493
+ const i = Le(e) ? h(() => e.value ?? be) : D(e ?? be), t = h(() => {
494
+ const u = i.value.components ?? {};
495
+ return {
496
+ form: u.form ?? "fc-form",
497
+ field: u.field ?? "fc-field",
498
+ label: u.label ?? "fc-label",
499
+ input: u.input ?? "fc-input",
500
+ error: u.error ?? "fc-error",
501
+ helpText: u.helpText ?? "fc-help-text",
502
+ group: u.group ?? "fc-group",
503
+ row: u.row ?? "fc-row",
504
+ steps: u.steps ?? "fc-steps",
505
+ tabs: u.tabs ?? "fc-tabs",
506
+ button: u.button ?? "fc-button"
507
+ };
508
+ }), a = h(() => {
509
+ const u = i.value, d = {};
510
+ if (u.colors)
511
+ for (const [l, n] of Object.entries(u.colors))
512
+ n && (d[`--fc-color-${X(l)}`] = n);
513
+ if (u.typography)
514
+ for (const [l, n] of Object.entries(u.typography))
515
+ n && (d[`--fc-${X(l)}`] = n);
516
+ if (u.spacing)
517
+ for (const [l, n] of Object.entries(u.spacing))
518
+ n && (d[`--fc-${X(l)}`] = n);
519
+ if (u.borders)
520
+ for (const [l, n] of Object.entries(u.borders))
521
+ n && (d[`--fc-border-${X(l)}`] = n);
522
+ if (u.shadows)
523
+ for (const [l, n] of Object.entries(u.shadows))
524
+ n && (d[`--fc-shadow-${X(l)}`] = n);
525
+ if (u.transitions)
526
+ for (const [l, n] of Object.entries(u.transitions))
527
+ n && (d[`--fc-transition-${X(l)}`] = n);
528
+ return u.cssVars && Object.assign(d, u.cssVars), d;
529
+ }), r = {
530
+ config: i.value,
531
+ classes: t,
532
+ cssVars: a
533
+ };
534
+ return ie(pe, r), r;
535
+ }
536
+ function K() {
537
+ const e = J(pe);
538
+ return e || at();
539
+ }
540
+ function at() {
541
+ const e = h(() => ({
542
+ form: "fc-form",
543
+ field: "fc-field",
544
+ label: "fc-label",
545
+ input: "fc-input",
546
+ error: "fc-error",
547
+ helpText: "fc-help-text",
548
+ group: "fc-group",
549
+ row: "fc-row",
550
+ steps: "fc-steps",
551
+ tabs: "fc-tabs",
552
+ button: "fc-button"
553
+ })), i = h(() => ({}));
554
+ return { config: be, classes: e, cssVars: i };
555
+ }
556
+ function X(e) {
557
+ return e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
558
+ }
559
+ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disabled", "onClick", "onKeydown"], ot = {
560
+ key: 0,
561
+ class: "h-3 w-3",
562
+ viewBox: "0 0 12 12",
563
+ fill: "none",
564
+ stroke: "currentColor",
565
+ "stroke-width": "2",
566
+ "aria-hidden": "true"
567
+ }, rt = { class: "text-sm text-gray-700" }, st = /* @__PURE__ */ j({
568
+ __name: "CheckboxGroupInput",
569
+ props: {
570
+ modelValue: {},
571
+ options: {},
572
+ inline: { type: Boolean, default: !1 },
573
+ disabled: { type: Boolean, default: !1 },
574
+ minSelect: {},
575
+ maxSelect: {}
576
+ },
577
+ emits: ["update:modelValue", "blur"],
578
+ setup(e, { emit: i }) {
579
+ const t = e, a = i;
580
+ K();
581
+ function r(n) {
582
+ return t.modelValue.includes(n);
583
+ }
584
+ function u(n) {
585
+ return !!(t.disabled || n.disabled || t.maxSelect && !r(n.value) && t.modelValue.length >= t.maxSelect);
586
+ }
587
+ function d(n) {
588
+ if (u(n)) return;
589
+ const o = [...t.modelValue], s = o.indexOf(n.value);
590
+ if (s >= 0) {
591
+ if (t.minSelect && o.length <= t.minSelect) return;
592
+ o.splice(s, 1);
593
+ } else
594
+ o.push(n.value);
595
+ a("update:modelValue", o);
596
+ }
597
+ function l(n, o) {
598
+ (n.key === " " || n.key === "Enter") && (n.preventDefault(), d(o));
599
+ }
600
+ return (n, o) => (c(), f("div", {
601
+ role: "group",
602
+ class: S(e.inline ? "flex flex-wrap gap-4" : "flex flex-col gap-2")
603
+ }, [
604
+ (c(!0), f(z, null, G(e.options, (s) => (c(), f("label", {
605
+ key: String(s.value),
606
+ class: S([
607
+ "inline-flex items-center gap-2 select-none",
608
+ u(s) ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
609
+ ])
610
+ }, [
611
+ p("input", {
612
+ type: "checkbox",
613
+ checked: r(s.value),
614
+ disabled: u(s),
615
+ class: "sr-only",
616
+ onChange: (g) => d(s),
617
+ onBlur: o[0] || (o[0] = (g) => a("blur", g))
618
+ }, null, 40, lt),
619
+ p("div", {
620
+ role: "checkbox",
621
+ "aria-checked": r(s.value),
622
+ "aria-disabled": u(s) || void 0,
623
+ tabindex: "0",
624
+ class: S([
625
+ "flex h-5 w-5 shrink-0 items-center justify-center rounded border-2 transition-colors duration-200",
626
+ r(s.value) ? "text-white" : "border-gray-300 bg-white"
627
+ ]),
628
+ style: O(r(s.value) ? { borderColor: "var(--fc-color-primary, #3b82f6)", backgroundColor: "var(--fc-color-primary, #3b82f6)" } : {}),
629
+ onClick: (g) => d(s),
630
+ onKeydown: (g) => l(g, s)
631
+ }, [
632
+ r(s.value) ? (c(), f("svg", ot, [...o[1] || (o[1] = [
633
+ p("path", {
634
+ d: "M2 6l3 3 5-5",
635
+ "stroke-linecap": "round",
636
+ "stroke-linejoin": "round"
637
+ }, null, -1)
638
+ ])])) : T("", !0)
639
+ ], 46, nt),
640
+ p("span", rt, L(s.label), 1)
641
+ ], 2))), 128))
642
+ ], 2));
643
+ }
644
+ }), it = ["checked", "disabled"], ut = ["aria-checked", "aria-disabled"], dt = {
645
+ key: 0,
646
+ class: "h-3 w-3",
647
+ viewBox: "0 0 12 12",
648
+ fill: "none",
649
+ stroke: "currentColor",
650
+ "stroke-width": "2",
651
+ "aria-hidden": "true"
652
+ }, ct = {
653
+ key: 0,
654
+ class: "text-sm text-gray-700"
655
+ }, ft = /* @__PURE__ */ j({
656
+ __name: "CheckboxInput",
657
+ props: {
658
+ modelValue: { type: Boolean },
659
+ checkboxLabel: {},
660
+ disabled: { type: Boolean, default: !1 }
661
+ },
662
+ emits: ["update:modelValue", "blur"],
663
+ setup(e, { emit: i }) {
664
+ const t = e, a = i;
665
+ K();
666
+ const r = h(() => [
667
+ "inline-flex items-center gap-2 select-none",
668
+ t.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
669
+ ]);
670
+ function u() {
671
+ t.disabled || a("update:modelValue", !t.modelValue);
672
+ }
673
+ function d(l) {
674
+ (l.key === " " || l.key === "Enter") && (l.preventDefault(), u());
675
+ }
676
+ return (l, n) => (c(), f("label", {
677
+ class: S(r.value)
678
+ }, [
679
+ p("input", {
680
+ type: "checkbox",
681
+ checked: e.modelValue,
682
+ disabled: e.disabled,
683
+ class: "sr-only",
684
+ onChange: u,
685
+ onBlur: n[0] || (n[0] = (o) => a("blur", o))
686
+ }, null, 40, it),
687
+ p("div", {
688
+ role: "checkbox",
689
+ "aria-checked": e.modelValue,
690
+ "aria-disabled": e.disabled || void 0,
691
+ tabindex: "0",
692
+ class: S([
693
+ "flex h-5 w-5 shrink-0 items-center justify-center rounded border-2 transition-colors duration-200",
694
+ e.modelValue ? "text-white" : "border-gray-300 bg-white"
695
+ ]),
696
+ style: O(e.modelValue ? { borderColor: "var(--fc-color-primary, #3b82f6)", backgroundColor: "var(--fc-color-primary, #3b82f6)" } : {}),
697
+ onClick: u,
698
+ onKeydown: d
699
+ }, [
700
+ e.modelValue ? (c(), f("svg", dt, [...n[1] || (n[1] = [
701
+ p("path", {
702
+ d: "M2 6l3 3 5-5",
703
+ "stroke-linecap": "round",
704
+ "stroke-linejoin": "round"
705
+ }, null, -1)
706
+ ])])) : T("", !0)
707
+ ], 46, ut),
708
+ e.checkboxLabel ? (c(), f("span", ct, L(e.checkboxLabel), 1)) : T("", !0)
709
+ ], 2));
710
+ }
711
+ }), mt = ["value", "min", "max", "placeholder", "disabled", "aria-disabled"], bt = /* @__PURE__ */ j({
712
+ __name: "DateInput",
713
+ props: {
714
+ modelValue: {},
715
+ format: {},
716
+ minDate: {},
717
+ maxDate: {},
718
+ placeholder: { default: "" },
719
+ disabled: { type: Boolean, default: !1 }
720
+ },
721
+ emits: ["update:modelValue", "blur", "focus"],
722
+ setup(e, { emit: i }) {
723
+ const t = e, a = i, r = K(), u = h(
724
+ () => [
725
+ "w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm",
726
+ "focus:outline-none focus:ring-2 focus:ring-blue-500/20 fc-date-input",
727
+ "transition-colors duration-200",
728
+ t.disabled ? "opacity-50 cursor-not-allowed bg-gray-100" : "",
729
+ r.classes.value.input
730
+ ].filter(Boolean).join(" ")
731
+ );
732
+ function d(l) {
733
+ const n = l.target;
734
+ a("update:modelValue", n.value);
735
+ }
736
+ return (l, n) => (c(), f("input", {
737
+ type: "date",
738
+ value: e.modelValue,
739
+ min: e.minDate,
740
+ max: e.maxDate,
741
+ placeholder: e.placeholder,
742
+ disabled: e.disabled,
743
+ class: S(u.value),
744
+ "aria-disabled": e.disabled || void 0,
745
+ onInput: d,
746
+ onBlur: n[0] || (n[0] = (o) => a("blur", o)),
747
+ onFocus: n[1] || (n[1] = (o) => a("focus", o))
748
+ }, null, 42, mt));
749
+ }
750
+ }), ne = (e, i) => {
751
+ const t = e.__vccOpts || e;
752
+ for (const [a, r] of i)
753
+ t[a] = r;
754
+ return t;
755
+ }, vt = /* @__PURE__ */ ne(bt, [["__scopeId", "data-v-7d4bc9b7"]]), yt = ["aria-disabled", "onKeydown"], pt = {
756
+ key: 0,
757
+ class: "mt-1 text-xs text-gray-400"
758
+ }, gt = ["accept", "multiple"], ht = {
759
+ key: 0,
760
+ class: "mt-3 space-y-2"
761
+ }, xt = { class: "flex items-center gap-2 truncate" }, kt = { class: "truncate" }, wt = { class: "shrink-0 text-xs text-gray-400" }, $t = ["onClick"], Ct = /* @__PURE__ */ j({
762
+ __name: "FileInput",
763
+ props: {
764
+ modelValue: {},
765
+ accept: {},
766
+ maxSize: {},
767
+ multiple: { type: Boolean, default: !1 },
768
+ maxFiles: {},
769
+ disabled: { type: Boolean, default: !1 }
770
+ },
771
+ emits: ["update:modelValue", "blur"],
772
+ setup(e, { emit: i }) {
773
+ const t = e, a = i;
774
+ K();
775
+ const r = D(null), u = D(!1), d = h(() => t.modelValue ? Array.isArray(t.modelValue) ? t.modelValue : [t.modelValue] : []);
776
+ function l(m) {
777
+ return m < 1024 ? `${m} B` : m < 1024 * 1024 ? `${(m / 1024).toFixed(1)} KB` : `${(m / (1024 * 1024)).toFixed(1)} MB`;
778
+ }
779
+ function n(m) {
780
+ let y = m;
781
+ if (t.maxSize) {
782
+ const F = t.maxSize;
783
+ y = y.filter((k) => k.size <= F);
784
+ }
785
+ if (t.multiple && t.maxFiles) {
786
+ const F = t.maxFiles - d.value.length;
787
+ y = y.slice(0, Math.max(0, F));
788
+ }
789
+ return y;
790
+ }
791
+ function o(m) {
792
+ const y = n(m);
793
+ y.length !== 0 && (t.multiple ? a("update:modelValue", [...d.value, ...y]) : a("update:modelValue", y[0]));
794
+ }
795
+ function s(m) {
796
+ const y = m.target;
797
+ y.files && (o(Array.from(y.files)), y.value = "");
798
+ }
799
+ function g(m) {
800
+ if (t.disabled) return;
801
+ const y = d.value.filter((F, k) => k !== m);
802
+ t.multiple ? a("update:modelValue", y.length ? y : []) : a("update:modelValue", null);
803
+ }
804
+ function $(m) {
805
+ m.preventDefault(), t.disabled || (u.value = !0);
806
+ }
807
+ function V() {
808
+ u.value = !1;
809
+ }
810
+ function b(m) {
811
+ var y;
812
+ m.preventDefault(), u.value = !1, !(t.disabled || !((y = m.dataTransfer) != null && y.files)) && o(Array.from(m.dataTransfer.files));
813
+ }
814
+ function v() {
815
+ var m;
816
+ t.disabled || (m = r.value) == null || m.click();
817
+ }
818
+ return (m, y) => (c(), f("div", {
819
+ class: S(e.disabled ? "opacity-50 cursor-not-allowed" : "")
820
+ }, [
821
+ p("div", {
822
+ role: "button",
823
+ tabindex: "0",
824
+ "aria-disabled": e.disabled || void 0,
825
+ class: S([
826
+ "flex flex-col items-center justify-center rounded-lg border-2 border-dashed p-6 text-center transition-colors duration-200",
827
+ u.value ? "" : "border-gray-300 bg-gray-50",
828
+ e.disabled ? "pointer-events-none" : "cursor-pointer hover:border-gray-400"
829
+ ]),
830
+ style: O(u.value ? { borderColor: "var(--fc-color-primary, #3b82f6)", backgroundColor: "color-mix(in srgb, var(--fc-color-primary, #3b82f6) 8%, white)" } : {}),
831
+ onClick: v,
832
+ onKeydown: [
833
+ he(v, ["enter"]),
834
+ he(q(v, ["prevent"]), ["space"])
835
+ ],
836
+ onDragover: $,
837
+ onDragleave: V,
838
+ onDrop: b,
839
+ onBlur: y[0] || (y[0] = (F) => a("blur", F))
840
+ }, [
841
+ y[1] || (y[1] = p("svg", {
842
+ class: "mb-2 h-8 w-8 text-gray-400",
843
+ fill: "none",
844
+ viewBox: "0 0 24 24",
845
+ stroke: "currentColor",
846
+ "stroke-width": "1.5",
847
+ "aria-hidden": "true"
848
+ }, [
849
+ p("path", {
850
+ "stroke-linecap": "round",
851
+ "stroke-linejoin": "round",
852
+ d: "M12 16v-8m0 0l-3 3m3-3l3 3M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1"
853
+ })
854
+ ], -1)),
855
+ y[2] || (y[2] = p("p", { class: "text-sm text-gray-600" }, [
856
+ _(" Drop files here or "),
857
+ p("span", {
858
+ class: "font-medium",
859
+ style: { color: "var(--fc-color-primary, #3b82f6)" }
860
+ }, "browse")
861
+ ], -1)),
862
+ e.accept ? (c(), f("p", pt, "Accepted: " + L(e.accept), 1)) : T("", !0)
863
+ ], 46, yt),
864
+ p("input", {
865
+ ref_key: "fileInputRef",
866
+ ref: r,
867
+ type: "file",
868
+ accept: e.accept,
869
+ multiple: e.multiple,
870
+ class: "hidden",
871
+ onChange: s
872
+ }, null, 40, gt),
873
+ d.value.length > 0 ? (c(), f("ul", ht, [
874
+ (c(!0), f(z, null, G(d.value, (F, k) => (c(), f("li", {
875
+ key: `${F.name}-${k}`,
876
+ class: "flex items-center justify-between rounded-md border border-gray-200 bg-white px-3 py-2 text-sm"
877
+ }, [
878
+ p("div", xt, [
879
+ y[3] || (y[3] = p("svg", {
880
+ class: "h-4 w-4 shrink-0 text-gray-400",
881
+ fill: "none",
882
+ viewBox: "0 0 24 24",
883
+ stroke: "currentColor",
884
+ "stroke-width": "2",
885
+ "aria-hidden": "true"
886
+ }, [
887
+ p("path", {
888
+ "stroke-linecap": "round",
889
+ "stroke-linejoin": "round",
890
+ d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
891
+ })
892
+ ], -1)),
893
+ p("span", kt, L(F.name), 1),
894
+ p("span", wt, "(" + L(l(F.size)) + ")", 1)
895
+ ]),
896
+ e.disabled ? T("", !0) : (c(), f("button", {
897
+ key: 0,
898
+ type: "button",
899
+ class: "ml-2 shrink-0 text-gray-400 hover:text-red-500 transition-colors duration-200",
900
+ "aria-label": "Remove file",
901
+ onClick: q((C) => g(k), ["stop"])
902
+ }, " × ", 8, $t))
903
+ ]))), 128))
904
+ ])) : T("", !0)
905
+ ], 2));
906
+ }
907
+ }), Vt = {
908
+ key: 0,
909
+ class: "flex items-stretch"
910
+ }, St = {
911
+ key: 0,
912
+ class: "inline-flex items-center rounded-l-md border border-r-0 border-gray-300 bg-gray-50 px-3 text-sm text-gray-500"
913
+ }, Bt = ["value", "min", "max", "step", "disabled", "readonly", "aria-disabled", "aria-readonly"], Ft = {
914
+ key: 1,
915
+ class: "inline-flex items-center rounded-r-md border border-l-0 border-gray-300 bg-gray-50 px-3 text-sm text-gray-500"
916
+ }, Tt = ["value", "min", "max", "step", "disabled", "readonly", "aria-disabled", "aria-readonly"], It = /* @__PURE__ */ j({
917
+ __name: "NumberInput",
918
+ props: {
919
+ modelValue: {},
920
+ min: {},
921
+ max: {},
922
+ step: { default: 1 },
923
+ precision: {},
924
+ prefix: {},
925
+ suffix: {},
926
+ disabled: { type: Boolean, default: !1 },
927
+ readonly: { type: Boolean, default: !1 }
928
+ },
929
+ emits: ["update:modelValue", "blur", "focus"],
930
+ setup(e, { emit: i }) {
931
+ const t = e, a = i, r = K(), u = h(() => !!t.prefix || !!t.suffix), d = h(
932
+ () => [
933
+ "w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm",
934
+ "placeholder:text-gray-400",
935
+ "focus:outline-none focus:ring-2 focus:ring-blue-500/20 fc-number-input",
936
+ "transition-colors duration-200",
937
+ t.disabled ? "opacity-50 cursor-not-allowed bg-gray-100" : "",
938
+ t.prefix ? "rounded-l-none" : "",
939
+ t.suffix ? "rounded-r-none" : "",
940
+ r.classes.value.input
941
+ ].filter(Boolean).join(" ")
942
+ );
943
+ function l(n) {
944
+ const s = n.target.value;
945
+ if (s === "") {
946
+ a("update:modelValue", null);
947
+ return;
948
+ }
949
+ let g = parseFloat(s);
950
+ Number.isNaN(g) || (t.precision !== void 0 && (g = parseFloat(g.toFixed(t.precision))), a("update:modelValue", g));
951
+ }
952
+ return (n, o) => u.value ? (c(), f("div", Vt, [
953
+ e.prefix ? (c(), f("span", St, L(e.prefix), 1)) : T("", !0),
954
+ p("input", {
955
+ type: "number",
956
+ value: e.modelValue ?? "",
957
+ min: e.min,
958
+ max: e.max,
959
+ step: e.step,
960
+ disabled: e.disabled,
961
+ readonly: e.readonly,
962
+ class: S(d.value),
963
+ "aria-disabled": e.disabled || void 0,
964
+ "aria-readonly": e.readonly || void 0,
965
+ onInput: l,
966
+ onBlur: o[0] || (o[0] = (s) => a("blur", s)),
967
+ onFocus: o[1] || (o[1] = (s) => a("focus", s))
968
+ }, null, 42, Bt),
969
+ e.suffix ? (c(), f("span", Ft, L(e.suffix), 1)) : T("", !0)
970
+ ])) : (c(), f("input", {
971
+ key: 1,
972
+ type: "number",
973
+ value: e.modelValue ?? "",
974
+ min: e.min,
975
+ max: e.max,
976
+ step: e.step,
977
+ disabled: e.disabled,
978
+ readonly: e.readonly,
979
+ class: S(d.value),
980
+ "aria-disabled": e.disabled || void 0,
981
+ "aria-readonly": e.readonly || void 0,
982
+ onInput: l,
983
+ onBlur: o[2] || (o[2] = (s) => a("blur", s)),
984
+ onFocus: o[3] || (o[3] = (s) => a("focus", s))
985
+ }, null, 42, Tt));
986
+ }
987
+ }), Lt = /* @__PURE__ */ ne(It, [["__scopeId", "data-v-4e51299b"]]), At = { class: "relative" }, Nt = ["disabled"], Dt = { class: "text-lg leading-none" }, Mt = { class: "text-xs text-gray-500 dark:text-gray-400 font-medium" }, Et = ["value", "placeholder", "disabled"], Rt = {
988
+ key: 1,
989
+ class: "absolute left-0 top-full z-50 mt-1 w-72 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-xl overflow-hidden"
990
+ }, jt = { class: "border-b border-gray-200 dark:border-gray-700 p-2" }, Ot = { class: "max-h-48 overflow-y-auto" }, zt = ["onMousedown"], Kt = { class: "text-lg leading-none" }, Pt = { class: "flex-1 truncate text-xs" }, Ut = { class: "text-[11px] text-gray-400 dark:text-gray-500 font-mono" }, Ht = {
991
+ key: 0,
992
+ class: "px-3 py-4 text-center text-xs text-gray-400 dark:text-gray-500"
993
+ }, Gt = /* @__PURE__ */ j({
994
+ __name: "PhoneInput",
995
+ props: {
996
+ modelValue: {},
997
+ defaultCountry: { default: "US" },
998
+ countries: {},
999
+ showDialCode: { type: Boolean, default: !0 },
1000
+ placeholder: {},
1001
+ disabled: { type: Boolean, default: !1 }
1002
+ },
1003
+ emits: ["update:modelValue", "blur"],
1004
+ setup(e, { emit: i }) {
1005
+ const t = e, a = i, r = {
1006
+ AF: "Afghanistan",
1007
+ AL: "Albania",
1008
+ DZ: "Algeria",
1009
+ AD: "Andorra",
1010
+ AO: "Angola",
1011
+ AR: "Argentina",
1012
+ AM: "Armenia",
1013
+ AU: "Australia",
1014
+ AT: "Austria",
1015
+ AZ: "Azerbaijan",
1016
+ BH: "Bahrain",
1017
+ BD: "Bangladesh",
1018
+ BY: "Belarus",
1019
+ BE: "Belgium",
1020
+ BZ: "Belize",
1021
+ BJ: "Benin",
1022
+ BT: "Bhutan",
1023
+ BO: "Bolivia",
1024
+ BA: "Bosnia",
1025
+ BW: "Botswana",
1026
+ BR: "Brazil",
1027
+ BN: "Brunei",
1028
+ BG: "Bulgaria",
1029
+ BF: "Burkina Faso",
1030
+ BI: "Burundi",
1031
+ KH: "Cambodia",
1032
+ CM: "Cameroon",
1033
+ CA: "Canada",
1034
+ CL: "Chile",
1035
+ CN: "China",
1036
+ CO: "Colombia",
1037
+ CR: "Costa Rica",
1038
+ HR: "Croatia",
1039
+ CU: "Cuba",
1040
+ CY: "Cyprus",
1041
+ CZ: "Czechia",
1042
+ DK: "Denmark",
1043
+ DO: "Dominican Rep.",
1044
+ EC: "Ecuador",
1045
+ EG: "Egypt",
1046
+ SV: "El Salvador",
1047
+ EE: "Estonia",
1048
+ ET: "Ethiopia",
1049
+ FI: "Finland",
1050
+ FR: "France",
1051
+ GE: "Georgia",
1052
+ DE: "Germany",
1053
+ GH: "Ghana",
1054
+ GR: "Greece",
1055
+ GT: "Guatemala",
1056
+ HN: "Honduras",
1057
+ HK: "Hong Kong",
1058
+ HU: "Hungary",
1059
+ IS: "Iceland",
1060
+ IN: "India",
1061
+ ID: "Indonesia",
1062
+ IR: "Iran",
1063
+ IQ: "Iraq",
1064
+ IE: "Ireland",
1065
+ IL: "Israel",
1066
+ IT: "Italy",
1067
+ JM: "Jamaica",
1068
+ JP: "Japan",
1069
+ JO: "Jordan",
1070
+ KZ: "Kazakhstan",
1071
+ KE: "Kenya",
1072
+ KR: "South Korea",
1073
+ KW: "Kuwait",
1074
+ LV: "Latvia",
1075
+ LB: "Lebanon",
1076
+ LY: "Libya",
1077
+ LT: "Lithuania",
1078
+ LU: "Luxembourg",
1079
+ MO: "Macau",
1080
+ MY: "Malaysia",
1081
+ MX: "Mexico",
1082
+ MA: "Morocco",
1083
+ MZ: "Mozambique",
1084
+ MM: "Myanmar",
1085
+ NP: "Nepal",
1086
+ NL: "Netherlands",
1087
+ NZ: "New Zealand",
1088
+ NI: "Nicaragua",
1089
+ NG: "Nigeria",
1090
+ NO: "Norway",
1091
+ OM: "Oman",
1092
+ PK: "Pakistan",
1093
+ PA: "Panama",
1094
+ PY: "Paraguay",
1095
+ PE: "Peru",
1096
+ PH: "Philippines",
1097
+ PL: "Poland",
1098
+ PT: "Portugal",
1099
+ QA: "Qatar",
1100
+ RO: "Romania",
1101
+ RU: "Russia",
1102
+ SA: "Saudi Arabia",
1103
+ RS: "Serbia",
1104
+ SG: "Singapore",
1105
+ SK: "Slovakia",
1106
+ SI: "Slovenia",
1107
+ ZA: "South Africa",
1108
+ ES: "Spain",
1109
+ LK: "Sri Lanka",
1110
+ SE: "Sweden",
1111
+ CH: "Switzerland",
1112
+ TW: "Taiwan",
1113
+ TZ: "Tanzania",
1114
+ TH: "Thailand",
1115
+ TR: "Turkey",
1116
+ UA: "Ukraine",
1117
+ AE: "UAE",
1118
+ GB: "United Kingdom",
1119
+ US: "United States",
1120
+ UY: "Uruguay",
1121
+ VE: "Venezuela",
1122
+ VN: "Vietnam",
1123
+ ZW: "Zimbabwe"
1124
+ };
1125
+ function u(C) {
1126
+ return C.toUpperCase().split("").map((w) => String.fromCodePoint(127462 + w.charCodeAt(0) - 65)).join("");
1127
+ }
1128
+ const d = h(() => {
1129
+ var w;
1130
+ return ((w = t.countries) != null && w.length ? t.countries.filter(
1131
+ (N) => xe().includes(N)
1132
+ ) : xe()).map((N) => ({
1133
+ code: N,
1134
+ name: r[N] ?? N,
1135
+ dialCode: `+${ke(N)}`,
1136
+ flag: u(N)
1137
+ })).sort((N, B) => N.name.localeCompare(B.name));
1138
+ }), l = D(t.defaultCountry), n = D(""), o = D(!1), s = D(""), g = D(null), $ = h(() => {
1139
+ const C = s.value.toLowerCase();
1140
+ return C ? d.value.filter(
1141
+ (w) => w.name.toLowerCase().includes(C) || w.code.toLowerCase().includes(C) || w.dialCode.includes(C)
1142
+ ) : d.value;
1143
+ }), V = h(
1144
+ () => d.value.find((C) => C.code === l.value) ?? d.value[0]
1145
+ );
1146
+ ue(() => {
1147
+ t.modelValue && b(t.modelValue);
1148
+ }), Y(
1149
+ () => t.modelValue,
1150
+ (C) => {
1151
+ C && b(C);
1152
+ }
1153
+ );
1154
+ function b(C) {
1155
+ try {
1156
+ const w = je(C);
1157
+ if (w != null && w.country) {
1158
+ l.value = w.country, n.value = w.nationalNumber;
1159
+ return;
1160
+ }
1161
+ } catch {
1162
+ }
1163
+ n.value = C.replace(/^\+\d+\s*/, "");
1164
+ }
1165
+ function v() {
1166
+ if (!n.value.trim()) {
1167
+ a("update:modelValue", "");
1168
+ return;
1169
+ }
1170
+ const C = new Oe(l.value);
1171
+ C.input(`+${ke(l.value)}${n.value}`);
1172
+ const w = C.getNumber();
1173
+ a("update:modelValue", (w == null ? void 0 : w.format("E.164")) ?? n.value);
1174
+ }
1175
+ function m(C) {
1176
+ const w = C.target;
1177
+ n.value = w.value, v();
1178
+ }
1179
+ function y(C) {
1180
+ l.value = C, o.value = !1, s.value = "", v();
1181
+ }
1182
+ function F() {
1183
+ t.disabled || (o.value = !0, s.value = "", te(() => {
1184
+ var C;
1185
+ return (C = g.value) == null ? void 0 : C.focus();
1186
+ }));
1187
+ }
1188
+ function k() {
1189
+ o.value = !1, s.value = "";
1190
+ }
1191
+ return (C, w) => {
1192
+ var N, B;
1193
+ return c(), f("div", At, [
1194
+ p("div", {
1195
+ class: S([
1196
+ "flex items-stretch rounded-lg border transition-colors",
1197
+ e.disabled ? "opacity-50 cursor-not-allowed bg-gray-50 dark:bg-gray-800 border-gray-200 dark:border-gray-700" : "border-gray-300 dark:border-gray-600 focus-within:border-primary-500 focus-within:ring-2 focus-within:ring-primary-500/20"
1198
+ ])
1199
+ }, [
1200
+ e.showDialCode ? (c(), f("button", {
1201
+ key: 0,
1202
+ type: "button",
1203
+ disabled: e.disabled,
1204
+ class: "flex items-center gap-1.5 px-3 border-r border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 rounded-l-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors shrink-0",
1205
+ onMousedown: w[0] || (w[0] = q((A) => o.value ? k() : F(), ["prevent"]))
1206
+ }, [
1207
+ p("span", Dt, L((N = V.value) == null ? void 0 : N.flag), 1),
1208
+ p("span", Mt, L((B = V.value) == null ? void 0 : B.dialCode), 1),
1209
+ (c(), f("svg", {
1210
+ class: S(["h-3 w-3 text-gray-400 transition-transform", o.value ? "rotate-180" : ""]),
1211
+ viewBox: "0 0 24 24",
1212
+ fill: "none",
1213
+ stroke: "currentColor",
1214
+ "stroke-width": "2",
1215
+ "stroke-linecap": "round",
1216
+ "stroke-linejoin": "round"
1217
+ }, [...w[3] || (w[3] = [
1218
+ p("polyline", { points: "6 9 12 15 18 9" }, null, -1)
1219
+ ])], 2))
1220
+ ], 40, Nt)) : T("", !0),
1221
+ p("input", {
1222
+ type: "tel",
1223
+ value: n.value,
1224
+ placeholder: e.placeholder || "Phone number",
1225
+ disabled: e.disabled,
1226
+ autocomplete: "tel-national",
1227
+ class: S(["flex-1 bg-transparent px-3 py-2 text-sm text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 outline-none min-w-0", e.showDialCode ? "rounded-r-lg" : "rounded-lg"]),
1228
+ onInput: m,
1229
+ onBlur: w[1] || (w[1] = (A) => a("blur", A))
1230
+ }, null, 42, Et)
1231
+ ], 2),
1232
+ o.value ? (c(), f("div", {
1233
+ key: 0,
1234
+ class: "fixed inset-0 z-40",
1235
+ onMousedown: k
1236
+ }, null, 32)) : T("", !0),
1237
+ o.value ? (c(), f("div", Rt, [
1238
+ p("div", jt, [
1239
+ de(p("input", {
1240
+ ref_key: "searchInputRef",
1241
+ ref: g,
1242
+ "onUpdate:modelValue": w[2] || (w[2] = (A) => s.value = A),
1243
+ type: "text",
1244
+ placeholder: "Search country...",
1245
+ class: "w-full rounded-md border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 px-3 py-1.5 text-xs text-gray-900 dark:text-white placeholder-gray-400 outline-none focus:border-primary-500"
1246
+ }, null, 512), [
1247
+ [ve, s.value]
1248
+ ])
1249
+ ]),
1250
+ p("div", Ot, [
1251
+ (c(!0), f(z, null, G($.value, (A) => (c(), f("button", {
1252
+ key: A.code,
1253
+ type: "button",
1254
+ class: S([
1255
+ "flex w-full items-center gap-3 px-3 py-2 text-left text-sm transition-colors hover:bg-gray-50 dark:hover:bg-gray-800",
1256
+ A.code === l.value ? "bg-primary-50 dark:bg-primary-950/30 text-primary-700 dark:text-primary-300" : "text-gray-700 dark:text-gray-300"
1257
+ ]),
1258
+ onMousedown: q((R) => y(A.code), ["prevent"])
1259
+ }, [
1260
+ p("span", Kt, L(A.flag), 1),
1261
+ p("span", Pt, L(A.name), 1),
1262
+ p("span", Ut, L(A.dialCode), 1)
1263
+ ], 42, zt))), 128)),
1264
+ $.value.length === 0 ? (c(), f("p", Ht, " No countries found ")) : T("", !0)
1265
+ ])
1266
+ ])) : T("", !0)
1267
+ ]);
1268
+ };
1269
+ }
1270
+ }), Zt = ["checked", "disabled", "onChange"], qt = ["aria-checked", "aria-disabled", "onClick", "onKeydown"], Yt = {
1271
+ key: 0,
1272
+ class: "h-2.5 w-2.5 rounded-full",
1273
+ style: { backgroundColor: "var(--fc-color-primary, #3b82f6)" }
1274
+ }, Jt = { class: "text-sm text-gray-700" }, Wt = /* @__PURE__ */ j({
1275
+ __name: "RadioInput",
1276
+ props: {
1277
+ modelValue: { type: [String, Number, Boolean, null] },
1278
+ options: {},
1279
+ inline: { type: Boolean, default: !1 },
1280
+ disabled: { type: Boolean, default: !1 }
1281
+ },
1282
+ emits: ["update:modelValue", "blur"],
1283
+ setup(e, { emit: i }) {
1284
+ const t = e, a = i;
1285
+ K();
1286
+ function r(n) {
1287
+ return t.modelValue === n;
1288
+ }
1289
+ function u(n) {
1290
+ return t.disabled || !!n.disabled;
1291
+ }
1292
+ function d(n) {
1293
+ u(n) || a("update:modelValue", n.value);
1294
+ }
1295
+ function l(n, o) {
1296
+ (n.key === " " || n.key === "Enter") && (n.preventDefault(), d(o));
1297
+ }
1298
+ return (n, o) => (c(), f("div", {
1299
+ role: "radiogroup",
1300
+ class: S(e.inline ? "flex flex-wrap gap-4" : "flex flex-col gap-2")
1301
+ }, [
1302
+ (c(!0), f(z, null, G(e.options, (s) => (c(), f("label", {
1303
+ key: String(s.value),
1304
+ class: S([
1305
+ "inline-flex items-center gap-2 select-none",
1306
+ u(s) ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
1307
+ ])
1308
+ }, [
1309
+ p("input", {
1310
+ type: "radio",
1311
+ checked: r(s.value),
1312
+ disabled: u(s),
1313
+ class: "sr-only",
1314
+ onChange: (g) => d(s),
1315
+ onBlur: o[0] || (o[0] = (g) => a("blur", g))
1316
+ }, null, 40, Zt),
1317
+ p("div", {
1318
+ role: "radio",
1319
+ "aria-checked": r(s.value),
1320
+ "aria-disabled": u(s) || void 0,
1321
+ tabindex: "0",
1322
+ class: S([
1323
+ "flex h-5 w-5 shrink-0 items-center justify-center rounded-full border-2 transition-colors duration-200",
1324
+ r(s.value) ? "" : "border-gray-300"
1325
+ ]),
1326
+ style: O(r(s.value) ? { borderColor: "var(--fc-color-primary, #3b82f6)" } : {}),
1327
+ onClick: (g) => d(s),
1328
+ onKeydown: (g) => l(g, s)
1329
+ }, [
1330
+ r(s.value) ? (c(), f("div", Yt)) : T("", !0)
1331
+ ], 46, qt),
1332
+ p("span", Jt, L(s.label), 1)
1333
+ ], 2))), 128))
1334
+ ], 2));
1335
+ }
1336
+ }), _t = ["aria-expanded"], Qt = { class: "flex flex-1 flex-wrap items-center gap-1" }, Xt = ["onClick"], ea = {
1337
+ key: 1,
1338
+ class: "truncate"
1339
+ }, ta = {
1340
+ key: 2,
1341
+ class: "text-gray-400"
1342
+ }, aa = {
1343
+ key: 0,
1344
+ class: "absolute z-50 mt-1 w-full rounded-md border border-gray-200 bg-white shadow-lg"
1345
+ }, la = {
1346
+ key: 0,
1347
+ class: "border-b border-gray-200 p-2"
1348
+ }, na = {
1349
+ role: "listbox",
1350
+ class: "max-h-60 overflow-auto py-1"
1351
+ }, oa = ["aria-selected", "onClick", "onMouseenter"], ra = {
1352
+ key: 0,
1353
+ class: "px-3 py-2 text-sm text-gray-400"
1354
+ }, sa = /* @__PURE__ */ j({
1355
+ __name: "SelectInput",
1356
+ props: {
1357
+ modelValue: { type: [String, Number, Boolean, Array, null] },
1358
+ options: {},
1359
+ multiple: { type: Boolean, default: !1 },
1360
+ searchable: { type: Boolean, default: !1 },
1361
+ clearable: { type: Boolean, default: !1 },
1362
+ placeholder: { default: "Select..." },
1363
+ disabled: { type: Boolean, default: !1 }
1364
+ },
1365
+ emits: ["update:modelValue", "blur"],
1366
+ setup(e, { emit: i }) {
1367
+ const t = e, a = i, r = K(), u = D(!1), d = D(""), l = D(-1), n = D(null), o = D(null), s = h(() => t.modelValue === null || t.modelValue === void 0 ? [] : Array.isArray(t.modelValue) ? t.modelValue : [t.modelValue]), g = h(() => {
1368
+ if (s.value.length === 0 || t.multiple) return "";
1369
+ const B = t.options.find((A) => A.value === s.value[0]);
1370
+ return (B == null ? void 0 : B.label) ?? String(s.value[0]);
1371
+ }), $ = h(() => {
1372
+ if (!d.value) return t.options;
1373
+ const B = d.value.toLowerCase();
1374
+ return t.options.filter((A) => A.label.toLowerCase().includes(B));
1375
+ });
1376
+ function V(B) {
1377
+ return s.value.includes(B);
1378
+ }
1379
+ function b() {
1380
+ t.disabled || (u.value ? m() : v());
1381
+ }
1382
+ function v() {
1383
+ u.value = !0, l.value = -1, d.value = "", te(() => {
1384
+ var B;
1385
+ return (B = o.value) == null ? void 0 : B.focus();
1386
+ });
1387
+ }
1388
+ function m() {
1389
+ u.value = !1, d.value = "";
1390
+ }
1391
+ function y(B) {
1392
+ if (!B.disabled)
1393
+ if (t.multiple) {
1394
+ const A = [...s.value], R = A.indexOf(B.value);
1395
+ R >= 0 ? A.splice(R, 1) : A.push(B.value), a("update:modelValue", A);
1396
+ } else
1397
+ a("update:modelValue", B.value), m();
1398
+ }
1399
+ function F(B) {
1400
+ if (t.disabled) return;
1401
+ const A = s.value.filter((R) => R !== B);
1402
+ a("update:modelValue", A.length ? A : t.multiple ? [] : null);
1403
+ }
1404
+ function k(B) {
1405
+ B.stopPropagation(), a("update:modelValue", t.multiple ? [] : null);
1406
+ }
1407
+ function C(B) {
1408
+ if (!u.value) {
1409
+ (B.key === "Enter" || B.key === " " || B.key === "ArrowDown") && (B.preventDefault(), v());
1410
+ return;
1411
+ }
1412
+ switch (B.key) {
1413
+ case "ArrowDown":
1414
+ B.preventDefault(), l.value = Math.min(
1415
+ l.value + 1,
1416
+ $.value.length - 1
1417
+ );
1418
+ break;
1419
+ case "ArrowUp":
1420
+ B.preventDefault(), l.value = Math.max(l.value - 1, 0);
1421
+ break;
1422
+ case "Enter":
1423
+ B.preventDefault(), l.value >= 0 && $.value[l.value] && y($.value[l.value]);
1424
+ break;
1425
+ case "Escape":
1426
+ B.preventDefault(), m();
1427
+ break;
1428
+ }
1429
+ }
1430
+ function w(B) {
1431
+ n.value && !n.value.contains(B.target) && m();
1432
+ }
1433
+ function N(B) {
1434
+ const A = t.options.find((R) => R.value === B);
1435
+ return (A == null ? void 0 : A.label) ?? String(B);
1436
+ }
1437
+ return ue(() => document.addEventListener("mousedown", w)), Ve(() => document.removeEventListener("mousedown", w)), Y(u, (B) => {
1438
+ B || a("blur", new FocusEvent("blur"));
1439
+ }), (B, A) => (c(), f("div", {
1440
+ ref_key: "containerRef",
1441
+ ref: n,
1442
+ class: S([
1443
+ "relative w-full",
1444
+ H(r).classes.value.input,
1445
+ e.disabled ? "opacity-50 cursor-not-allowed" : ""
1446
+ ])
1447
+ }, [
1448
+ p("div", {
1449
+ role: "combobox",
1450
+ "aria-expanded": u.value,
1451
+ "aria-haspopup": "listbox",
1452
+ tabindex: "0",
1453
+ class: S([
1454
+ "flex min-h-[38px] w-full cursor-pointer items-center rounded-md border border-gray-300 bg-white px-3 py-1.5 text-sm",
1455
+ "transition-colors duration-200",
1456
+ u.value ? "ring-2 ring-blue-500/20" : "",
1457
+ e.disabled ? "pointer-events-none bg-gray-100" : ""
1458
+ ]),
1459
+ style: O(u.value ? { borderColor: "var(--fc-color-primary, #3b82f6)" } : {}),
1460
+ onClick: b,
1461
+ onKeydown: C
1462
+ }, [
1463
+ p("div", Qt, [
1464
+ e.multiple ? (c(!0), f(z, { key: 0 }, G(s.value, (R) => (c(), f("span", {
1465
+ key: String(R),
1466
+ class: "inline-flex items-center gap-1 rounded px-2 py-0.5 text-xs",
1467
+ style: { backgroundColor: "color-mix(in srgb, var(--fc-color-primary, #3b82f6) 15%, white)", color: "var(--fc-color-primary, #3b82f6)" }
1468
+ }, [
1469
+ _(L(N(R)) + " ", 1),
1470
+ p("button", {
1471
+ type: "button",
1472
+ class: "ml-0.5",
1473
+ style: { color: "var(--fc-color-primary, #3b82f6)" },
1474
+ "aria-label": "Remove",
1475
+ onClick: q((Q) => F(R), ["stop"])
1476
+ }, " × ", 8, Xt)
1477
+ ]))), 128)) : g.value ? (c(), f("span", ea, L(g.value), 1)) : (c(), f("span", ta, L(e.placeholder), 1))
1478
+ ]),
1479
+ e.clearable && s.value.length > 0 && !e.disabled ? (c(), f("button", {
1480
+ key: 0,
1481
+ type: "button",
1482
+ class: "ml-1 shrink-0 text-gray-400 hover:text-gray-600 transition-colors duration-200",
1483
+ "aria-label": "Clear selection",
1484
+ onClick: k
1485
+ }, " × ")) : T("", !0),
1486
+ (c(), f("svg", {
1487
+ class: S(["ml-1 h-4 w-4 shrink-0 text-gray-400 transition-transform duration-200", u.value ? "rotate-180" : ""]),
1488
+ viewBox: "0 0 20 20",
1489
+ fill: "currentColor",
1490
+ "aria-hidden": "true"
1491
+ }, [...A[1] || (A[1] = [
1492
+ p("path", {
1493
+ "fill-rule": "evenodd",
1494
+ d: "M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",
1495
+ "clip-rule": "evenodd"
1496
+ }, null, -1)
1497
+ ])], 2))
1498
+ ], 46, _t),
1499
+ u.value ? (c(), f("div", aa, [
1500
+ e.searchable ? (c(), f("div", la, [
1501
+ de(p("input", {
1502
+ ref_key: "searchInputRef",
1503
+ ref: o,
1504
+ "onUpdate:modelValue": A[0] || (A[0] = (R) => d.value = R),
1505
+ type: "text",
1506
+ class: "w-full rounded border border-gray-300 px-2 py-1 text-sm focus:outline-none fc-select-search",
1507
+ placeholder: "Search...",
1508
+ onKeydown: C
1509
+ }, null, 544), [
1510
+ [ve, d.value]
1511
+ ])
1512
+ ])) : T("", !0),
1513
+ p("ul", na, [
1514
+ (c(!0), f(z, null, G($.value, (R, Q) => (c(), f("li", {
1515
+ key: String(R.value),
1516
+ role: "option",
1517
+ "aria-selected": V(R.value),
1518
+ class: S([
1519
+ "cursor-pointer px-3 py-2 text-sm transition-colors duration-200",
1520
+ V(R.value) ? "" : "text-gray-900",
1521
+ l.value === Q ? "bg-gray-100" : "",
1522
+ R.disabled ? "opacity-50 cursor-not-allowed" : "hover:bg-gray-50"
1523
+ ]),
1524
+ style: O(V(R.value) ? { backgroundColor: "color-mix(in srgb, var(--fc-color-primary, #3b82f6) 8%, white)", color: "var(--fc-color-primary, #3b82f6)" } : {}),
1525
+ onClick: (ee) => y(R),
1526
+ onMouseenter: (ee) => l.value = Q
1527
+ }, L(R.label), 47, oa))), 128)),
1528
+ $.value.length === 0 ? (c(), f("li", ra, " No options found ")) : T("", !0)
1529
+ ])
1530
+ ])) : T("", !0)
1531
+ ], 2));
1532
+ }
1533
+ }), ia = /* @__PURE__ */ ne(sa, [["__scopeId", "data-v-b34f2a7d"]]), ua = ["value", "min", "max", "step", "disabled", "aria-valuenow", "aria-valuemin", "aria-valuemax", "aria-disabled"], da = { class: "mt-1 flex justify-between text-xs text-gray-400" }, ca = /* @__PURE__ */ j({
1534
+ __name: "SliderInput",
1535
+ props: {
1536
+ modelValue: {},
1537
+ min: { default: 0 },
1538
+ max: { default: 100 },
1539
+ step: { default: 1 },
1540
+ showTooltip: { type: Boolean, default: !0 },
1541
+ disabled: { type: Boolean, default: !1 }
1542
+ },
1543
+ emits: ["update:modelValue", "blur"],
1544
+ setup(e, { emit: i }) {
1545
+ const t = e, a = i;
1546
+ K();
1547
+ const r = D(!1), u = h(() => {
1548
+ const l = t.max - t.min;
1549
+ return l === 0 ? 0 : (t.modelValue - t.min) / l * 100;
1550
+ });
1551
+ function d(l) {
1552
+ const n = l.target;
1553
+ a("update:modelValue", parseFloat(n.value));
1554
+ }
1555
+ return (l, n) => (c(), f("div", {
1556
+ class: S([
1557
+ "relative w-full py-2",
1558
+ e.disabled ? "opacity-50 cursor-not-allowed" : ""
1559
+ ])
1560
+ }, [
1561
+ e.showTooltip && r.value ? (c(), f("div", {
1562
+ key: 0,
1563
+ class: "absolute -top-8 rounded bg-gray-800 px-2 py-1 text-xs text-white shadow-sm transition-opacity duration-200",
1564
+ style: O({ left: `calc(${u.value}% - 16px)` })
1565
+ }, L(e.modelValue), 5)) : T("", !0),
1566
+ p("input", {
1567
+ type: "range",
1568
+ value: e.modelValue,
1569
+ min: e.min,
1570
+ max: e.max,
1571
+ step: e.step,
1572
+ disabled: e.disabled,
1573
+ "aria-valuenow": e.modelValue,
1574
+ "aria-valuemin": e.min,
1575
+ "aria-valuemax": e.max,
1576
+ "aria-disabled": e.disabled || void 0,
1577
+ class: "h-2 w-full cursor-pointer appearance-none rounded-full bg-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500/20 disabled:pointer-events-none",
1578
+ style: { accentColor: "var(--fc-color-primary, #3b82f6)" },
1579
+ onInput: d,
1580
+ onMousedown: n[0] || (n[0] = (o) => r.value = !0),
1581
+ onMouseup: n[1] || (n[1] = (o) => r.value = !1),
1582
+ onTouchstart: n[2] || (n[2] = (o) => r.value = !0),
1583
+ onTouchend: n[3] || (n[3] = (o) => r.value = !1),
1584
+ onFocus: n[4] || (n[4] = (o) => r.value = !0),
1585
+ onBlur: n[5] || (n[5] = (o) => {
1586
+ r.value = !1, a("blur", o);
1587
+ })
1588
+ }, null, 40, ua),
1589
+ p("div", da, [
1590
+ p("span", null, L(e.min), 1),
1591
+ p("span", null, L(e.max), 1)
1592
+ ])
1593
+ ], 2));
1594
+ }
1595
+ }), fa = {
1596
+ key: 0,
1597
+ class: "text-sm text-gray-600"
1598
+ }, ma = ["checked", "disabled"], ba = ["aria-checked", "aria-disabled"], va = {
1599
+ key: 1,
1600
+ class: "text-sm text-gray-600"
1601
+ }, ya = /* @__PURE__ */ j({
1602
+ __name: "SwitchInput",
1603
+ props: {
1604
+ modelValue: { type: Boolean },
1605
+ activeLabel: {},
1606
+ inactiveLabel: {},
1607
+ disabled: { type: Boolean, default: !1 }
1608
+ },
1609
+ emits: ["update:modelValue", "blur"],
1610
+ setup(e, { emit: i }) {
1611
+ const t = e, a = i;
1612
+ K();
1613
+ const r = h(() => [
1614
+ "inline-flex items-center gap-2 select-none",
1615
+ t.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
1616
+ ]);
1617
+ function u() {
1618
+ t.disabled || a("update:modelValue", !t.modelValue);
1619
+ }
1620
+ function d(l) {
1621
+ (l.key === " " || l.key === "Enter") && (l.preventDefault(), u());
1622
+ }
1623
+ return (l, n) => (c(), f("label", {
1624
+ class: S(r.value)
1625
+ }, [
1626
+ e.inactiveLabel ? (c(), f("span", fa, L(e.inactiveLabel), 1)) : T("", !0),
1627
+ p("input", {
1628
+ type: "checkbox",
1629
+ checked: e.modelValue,
1630
+ disabled: e.disabled,
1631
+ class: "sr-only",
1632
+ onChange: u,
1633
+ onBlur: n[0] || (n[0] = (o) => a("blur", o))
1634
+ }, null, 40, ma),
1635
+ p("button", {
1636
+ type: "button",
1637
+ role: "switch",
1638
+ "aria-checked": e.modelValue,
1639
+ "aria-disabled": e.disabled || void 0,
1640
+ tabindex: "0",
1641
+ class: S([
1642
+ "relative inline-flex h-6 w-11 shrink-0 rounded-full border-2 border-transparent transition-colors duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)]",
1643
+ e.modelValue ? "" : "bg-gray-300",
1644
+ e.disabled ? "pointer-events-none" : "focus:outline-none focus:ring-2 focus:ring-blue-500/20"
1645
+ ]),
1646
+ style: O(e.modelValue ? { backgroundColor: "var(--fc-color-primary, #3b82f6)" } : {}),
1647
+ onClick: u,
1648
+ onKeydown: d
1649
+ }, [
1650
+ p("span", {
1651
+ class: S([
1652
+ "pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow-sm transition-transform duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)]",
1653
+ e.modelValue ? "translate-x-5" : "translate-x-0"
1654
+ ]),
1655
+ "aria-hidden": "true"
1656
+ }, null, 2)
1657
+ ], 46, ba),
1658
+ e.activeLabel ? (c(), f("span", va, L(e.activeLabel), 1)) : T("", !0)
1659
+ ], 2));
1660
+ }
1661
+ }), pa = ["onClick"], ga = ["placeholder", "disabled"], ha = {
1662
+ key: 0,
1663
+ class: "absolute z-50 mt-1 w-full rounded-md border border-gray-200 bg-white py-1 shadow-lg",
1664
+ role: "listbox"
1665
+ }, xa = ["aria-selected", "onMousedown", "onMouseenter"], ka = /* @__PURE__ */ j({
1666
+ __name: "TagsInput",
1667
+ props: {
1668
+ modelValue: { default: () => [] },
1669
+ maxTags: {},
1670
+ suggestions: { default: () => [] },
1671
+ placeholder: { default: "Add a tag..." },
1672
+ disabled: { type: Boolean, default: !1 }
1673
+ },
1674
+ emits: ["update:modelValue", "blur"],
1675
+ setup(e, { emit: i }) {
1676
+ const t = e, a = h(() => Array.isArray(t.modelValue) ? t.modelValue : []), r = i, u = K(), d = D(""), l = D(!1), n = D(!1), o = D(-1), s = D(null), g = D(null), $ = h(() => !t.maxTags || a.value.length < t.maxTags), V = h(() => {
1677
+ if (!d.value || t.suggestions.length === 0) return [];
1678
+ const k = d.value.toLowerCase();
1679
+ return t.suggestions.filter(
1680
+ (C) => C.toLowerCase().includes(k) && !a.value.includes(C)
1681
+ );
1682
+ });
1683
+ function b(k) {
1684
+ const C = k.trim();
1685
+ !C || !$.value || a.value.includes(C) || (r("update:modelValue", [...a.value, C]), d.value = "", n.value = !1, o.value = -1);
1686
+ }
1687
+ function v(k) {
1688
+ if (t.disabled) return;
1689
+ const C = a.value.filter((w, N) => N !== k);
1690
+ r("update:modelValue", C);
1691
+ }
1692
+ function m(k) {
1693
+ if (k.key === "Enter" || k.key === ",") {
1694
+ k.preventDefault(), o.value >= 0 && V.value[o.value] ? b(V.value[o.value]) : b(d.value);
1695
+ return;
1696
+ }
1697
+ if (k.key === "Backspace" && d.value === "" && a.value.length > 0) {
1698
+ v(a.value.length - 1);
1699
+ return;
1700
+ }
1701
+ if (k.key === "ArrowDown" && n.value) {
1702
+ k.preventDefault(), o.value = Math.min(
1703
+ o.value + 1,
1704
+ V.value.length - 1
1705
+ );
1706
+ return;
1707
+ }
1708
+ if (k.key === "ArrowUp" && n.value) {
1709
+ k.preventDefault(), o.value = Math.max(o.value - 1, 0);
1710
+ return;
1711
+ }
1712
+ k.key === "Escape" && (n.value = !1, o.value = -1);
1713
+ }
1714
+ function y() {
1715
+ n.value = d.value.length > 0 && V.value.length > 0, o.value = -1;
1716
+ }
1717
+ function F(k) {
1718
+ s.value && !s.value.contains(k.target) && (n.value = !1);
1719
+ }
1720
+ return ue(() => document.addEventListener("mousedown", F)), Ve(() => document.removeEventListener("mousedown", F)), Y(d, () => {
1721
+ te(y);
1722
+ }), (k, C) => (c(), f("div", {
1723
+ ref_key: "containerRef",
1724
+ ref: s,
1725
+ class: S([
1726
+ "relative w-full",
1727
+ e.disabled ? "opacity-50 cursor-not-allowed" : ""
1728
+ ])
1729
+ }, [
1730
+ p("div", {
1731
+ class: S([
1732
+ "flex flex-wrap items-center gap-1.5 rounded-md border bg-white px-2 py-1.5 text-sm transition-colors duration-200",
1733
+ l.value ? "ring-2 ring-blue-500/20" : "border-gray-300",
1734
+ H(u).classes.value.input
1735
+ ]),
1736
+ style: O(l.value ? { borderColor: "var(--fc-color-primary, #3b82f6)" } : {}),
1737
+ onClick: C[3] || (C[3] = (w) => {
1738
+ var N;
1739
+ return (N = g.value) == null ? void 0 : N.focus();
1740
+ })
1741
+ }, [
1742
+ (c(!0), f(z, null, G(a.value, (w, N) => (c(), f("span", {
1743
+ key: w,
1744
+ class: "inline-flex items-center gap-1 rounded px-2 py-0.5 text-xs",
1745
+ style: { backgroundColor: "color-mix(in srgb, var(--fc-color-primary, #3b82f6) 15%, white)", color: "var(--fc-color-primary, #3b82f6)" }
1746
+ }, [
1747
+ _(L(w) + " ", 1),
1748
+ e.disabled ? T("", !0) : (c(), f("button", {
1749
+ key: 0,
1750
+ type: "button",
1751
+ class: "ml-0.5 transition-colors duration-200",
1752
+ style: { color: "var(--fc-color-primary, #3b82f6)" },
1753
+ "aria-label": "Remove tag",
1754
+ onClick: q((B) => v(N), ["stop"])
1755
+ }, " × ", 8, pa))
1756
+ ]))), 128)),
1757
+ de(p("input", {
1758
+ ref_key: "inputRef",
1759
+ ref: g,
1760
+ "onUpdate:modelValue": C[0] || (C[0] = (w) => d.value = w),
1761
+ type: "text",
1762
+ placeholder: a.value.length === 0 ? e.placeholder : "",
1763
+ disabled: e.disabled,
1764
+ class: "min-w-[80px] flex-1 border-0 bg-transparent p-0 text-sm outline-none placeholder:text-gray-400",
1765
+ onKeydown: m,
1766
+ onFocus: C[1] || (C[1] = (w) => l.value = !0),
1767
+ onBlur: C[2] || (C[2] = (w) => {
1768
+ l.value = !1, r("blur", w);
1769
+ })
1770
+ }, null, 40, ga), [
1771
+ [ve, d.value]
1772
+ ])
1773
+ ], 6),
1774
+ n.value && V.value.length > 0 ? (c(), f("ul", ha, [
1775
+ (c(!0), f(z, null, G(V.value, (w, N) => (c(), f("li", {
1776
+ key: w,
1777
+ role: "option",
1778
+ "aria-selected": o.value === N,
1779
+ class: S([
1780
+ "cursor-pointer px-3 py-2 text-sm transition-colors duration-200",
1781
+ o.value !== N ? "text-gray-900 hover:bg-gray-50" : ""
1782
+ ]),
1783
+ style: O(o.value === N ? { backgroundColor: "color-mix(in srgb, var(--fc-color-primary, #3b82f6) 8%, white)", color: "var(--fc-color-primary, #3b82f6)" } : {}),
1784
+ onMousedown: q((B) => b(w), ["prevent"]),
1785
+ onMouseenter: (B) => o.value = N
1786
+ }, L(w), 47, xa))), 128))
1787
+ ])) : T("", !0)
1788
+ ], 2));
1789
+ }
1790
+ }), wa = ["value", "rows", "maxlength", "placeholder", "disabled", "readonly", "aria-disabled", "aria-readonly"], $a = /* @__PURE__ */ j({
1791
+ __name: "TextareaInput",
1792
+ props: {
1793
+ modelValue: {},
1794
+ rows: { default: 3 },
1795
+ autoResize: { type: Boolean, default: !1 },
1796
+ maxLength: {},
1797
+ placeholder: { default: "" },
1798
+ disabled: { type: Boolean, default: !1 },
1799
+ readonly: { type: Boolean, default: !1 }
1800
+ },
1801
+ emits: ["update:modelValue", "blur", "focus"],
1802
+ setup(e, { emit: i }) {
1803
+ const t = e, a = i, r = K(), u = D(null), d = h(
1804
+ () => [
1805
+ "w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm",
1806
+ "placeholder:text-gray-400 resize-y",
1807
+ "focus:outline-none focus:ring-2 focus:ring-blue-500/20 fc-textarea-input",
1808
+ "transition-colors duration-200",
1809
+ t.disabled ? "opacity-50 cursor-not-allowed bg-gray-100" : "",
1810
+ t.autoResize ? "resize-none overflow-hidden" : "",
1811
+ r.classes.value.input
1812
+ ].filter(Boolean).join(" ")
1813
+ );
1814
+ function l() {
1815
+ if (!t.autoResize || !u.value) return;
1816
+ const o = u.value;
1817
+ o.style.height = "auto", o.style.height = `${o.scrollHeight}px`;
1818
+ }
1819
+ function n(o) {
1820
+ const s = o.target;
1821
+ a("update:modelValue", s.value), t.autoResize && te(l);
1822
+ }
1823
+ return Y(
1824
+ () => t.modelValue,
1825
+ () => {
1826
+ t.autoResize && te(l);
1827
+ }
1828
+ ), ue(() => {
1829
+ t.autoResize && l();
1830
+ }), (o, s) => (c(), f("textarea", {
1831
+ ref_key: "textareaRef",
1832
+ ref: u,
1833
+ value: e.modelValue,
1834
+ rows: e.rows,
1835
+ maxlength: e.maxLength,
1836
+ placeholder: e.placeholder,
1837
+ disabled: e.disabled,
1838
+ readonly: e.readonly,
1839
+ class: S(d.value),
1840
+ "aria-disabled": e.disabled || void 0,
1841
+ "aria-readonly": e.readonly || void 0,
1842
+ onInput: n,
1843
+ onBlur: s[0] || (s[0] = (g) => a("blur", g)),
1844
+ onFocus: s[1] || (s[1] = (g) => a("focus", g))
1845
+ }, null, 42, wa));
1846
+ }
1847
+ }), Ca = /* @__PURE__ */ ne($a, [["__scopeId", "data-v-67f80d90"]]), Va = {
1848
+ key: 0,
1849
+ class: "flex items-stretch"
1850
+ }, Sa = {
1851
+ key: 0,
1852
+ class: "inline-flex items-center rounded-l-md border border-r-0 border-gray-300 bg-gray-50 px-3 text-sm text-gray-500"
1853
+ }, Ba = ["type", "value", "placeholder", "maxlength", "disabled", "readonly", "aria-disabled", "aria-readonly"], Fa = {
1854
+ key: 1,
1855
+ class: "inline-flex items-center rounded-r-md border border-l-0 border-gray-300 bg-gray-50 px-3 text-sm text-gray-500"
1856
+ }, Ta = ["type", "value", "placeholder", "maxlength", "disabled", "readonly", "aria-disabled", "aria-readonly"], Ia = /* @__PURE__ */ j({
1857
+ __name: "TextInput",
1858
+ props: {
1859
+ modelValue: {},
1860
+ inputType: { default: "text" },
1861
+ placeholder: { default: "" },
1862
+ maxLength: {},
1863
+ prefix: {},
1864
+ suffix: {},
1865
+ disabled: { type: Boolean, default: !1 },
1866
+ readonly: { type: Boolean, default: !1 },
1867
+ mask: {}
1868
+ },
1869
+ emits: ["update:modelValue", "blur", "focus"],
1870
+ setup(e, { emit: i }) {
1871
+ const t = e, a = i, r = K(), u = h(() => !!t.prefix || !!t.suffix), d = h(
1872
+ () => [
1873
+ "w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm",
1874
+ "placeholder:text-gray-400",
1875
+ "focus:outline-none focus:ring-2 focus:ring-blue-500/20 fc-text-input",
1876
+ "transition-colors duration-200",
1877
+ t.disabled ? "opacity-50 cursor-not-allowed bg-gray-100" : "",
1878
+ t.prefix ? "rounded-l-none" : "",
1879
+ t.suffix ? "rounded-r-none" : "",
1880
+ r.classes.value.input
1881
+ ].filter(Boolean).join(" ")
1882
+ );
1883
+ function l(n) {
1884
+ const o = n.target;
1885
+ a("update:modelValue", o.value);
1886
+ }
1887
+ return (n, o) => u.value ? (c(), f("div", Va, [
1888
+ e.prefix ? (c(), f("span", Sa, L(e.prefix), 1)) : T("", !0),
1889
+ p("input", {
1890
+ type: e.inputType,
1891
+ value: e.modelValue,
1892
+ placeholder: e.placeholder,
1893
+ maxlength: e.maxLength,
1894
+ disabled: e.disabled,
1895
+ readonly: e.readonly,
1896
+ class: S(d.value),
1897
+ "aria-disabled": e.disabled || void 0,
1898
+ "aria-readonly": e.readonly || void 0,
1899
+ onInput: l,
1900
+ onBlur: o[0] || (o[0] = (s) => a("blur", s)),
1901
+ onFocus: o[1] || (o[1] = (s) => a("focus", s))
1902
+ }, null, 42, Ba),
1903
+ e.suffix ? (c(), f("span", Fa, L(e.suffix), 1)) : T("", !0)
1904
+ ])) : (c(), f("input", {
1905
+ key: 1,
1906
+ type: e.inputType,
1907
+ value: e.modelValue,
1908
+ placeholder: e.placeholder,
1909
+ maxlength: e.maxLength,
1910
+ disabled: e.disabled,
1911
+ readonly: e.readonly,
1912
+ class: S(d.value),
1913
+ "aria-disabled": e.disabled || void 0,
1914
+ "aria-readonly": e.readonly || void 0,
1915
+ onInput: l,
1916
+ onBlur: o[2] || (o[2] = (s) => a("blur", s)),
1917
+ onFocus: o[3] || (o[3] = (s) => a("focus", s))
1918
+ }, null, 42, Ta));
1919
+ }
1920
+ }), La = /* @__PURE__ */ ne(Ia, [["__scopeId", "data-v-a42b4343"]]), Aa = {
1921
+ key: 0,
1922
+ class: "mb-1.5 flex items-center gap-1"
1923
+ }, Na = ["for"], Da = {
1924
+ key: 0,
1925
+ class: "text-red-500 ml-0.5",
1926
+ "aria-hidden": "true"
1927
+ }, Ma = ["aria-label"], Ea = {
1928
+ key: 0,
1929
+ role: "tooltip",
1930
+ class: "absolute bottom-full left-1/2 z-10 mb-2 -translate-x-1/2 rounded-md bg-gray-900 px-3 py-1.5 text-xs text-white shadow-lg whitespace-nowrap"
1931
+ }, Ra = ["id"], ja = ["id"], Oa = /* @__PURE__ */ j({
1932
+ __name: "BaseField",
1933
+ props: {
1934
+ fieldSchema: {},
1935
+ fieldName: {},
1936
+ errors: { default: () => [] },
1937
+ touched: { type: Boolean, default: !1 }
1938
+ },
1939
+ setup(e) {
1940
+ const i = e, t = J(ye), a = J(pe), r = D(!1), u = h(() => {
1941
+ if (t) {
1942
+ const $ = t.t(i.fieldName, "label");
1943
+ if ($) return $;
1944
+ }
1945
+ return i.fieldSchema.label ?? i.fieldName;
1946
+ }), d = h(() => {
1947
+ if (t) {
1948
+ const $ = t.t(i.fieldName, "helpText");
1949
+ if ($) return $;
1950
+ }
1951
+ return i.fieldSchema.helpText ?? "";
1952
+ }), l = h(() => {
1953
+ if (t) {
1954
+ const $ = t.t(i.fieldName, "tooltip");
1955
+ if ($) return $;
1956
+ }
1957
+ return i.fieldSchema.tooltip ?? "";
1958
+ }), n = h(() => i.touched && i.errors.length > 0), o = h(() => [
1959
+ (a == null ? void 0 : a.classes.value.field) ?? "fc-field",
1960
+ i.fieldSchema.className ?? "",
1961
+ i.fieldSchema.disabled ? "opacity-50 cursor-not-allowed" : "",
1962
+ i.fieldSchema.readOnly ? "fc-readonly" : ""
1963
+ ]), s = h(() => `fc-field-${i.fieldName}`), g = h(() => `fc-error-${i.fieldName}`);
1964
+ return ($, V) => {
1965
+ var b, v;
1966
+ return c(), f("div", {
1967
+ class: S([o.value, "relative mb-4"]),
1968
+ style: O(e.fieldSchema.style)
1969
+ }, [
1970
+ e.fieldSchema.type !== "hidden" ? (c(), f("div", Aa, [
1971
+ p("label", {
1972
+ for: s.value,
1973
+ class: S([((b = H(a)) == null ? void 0 : b.classes.value.label) ?? "fc-label", "block text-sm font-medium text-gray-700"])
1974
+ }, [
1975
+ _(L(u.value) + " ", 1),
1976
+ e.fieldSchema.required ? (c(), f("span", Da, "*")) : T("", !0)
1977
+ ], 10, Na),
1978
+ l.value ? (c(), f("span", {
1979
+ key: 0,
1980
+ class: "relative inline-flex",
1981
+ onMouseenter: V[0] || (V[0] = (m) => r.value = !0),
1982
+ onMouseleave: V[1] || (V[1] = (m) => r.value = !1),
1983
+ onFocusin: V[2] || (V[2] = (m) => r.value = !0),
1984
+ onFocusout: V[3] || (V[3] = (m) => r.value = !1)
1985
+ }, [
1986
+ p("button", {
1987
+ type: "button",
1988
+ class: "inline-flex h-4 w-4 items-center justify-center rounded-full bg-gray-200 text-gray-500 text-xs hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500/40",
1989
+ "aria-label": `Info: ${l.value}`,
1990
+ tabindex: "0"
1991
+ }, " i ", 8, Ma),
1992
+ Z(ae, {
1993
+ "enter-active-class": "motion-safe:transition motion-safe:duration-200 motion-safe:ease-out",
1994
+ "enter-from-class": "opacity-0 scale-95",
1995
+ "enter-to-class": "opacity-100 scale-100",
1996
+ "leave-active-class": "motion-safe:transition motion-safe:duration-150 motion-safe:ease-in",
1997
+ "leave-from-class": "opacity-100 scale-100",
1998
+ "leave-to-class": "opacity-0 scale-95"
1999
+ }, {
2000
+ default: W(() => [
2001
+ r.value ? (c(), f("div", Ea, [
2002
+ _(L(l.value) + " ", 1),
2003
+ V[4] || (V[4] = p("div", { class: "absolute left-1/2 top-full -translate-x-1/2 border-4 border-transparent border-t-gray-900" }, null, -1))
2004
+ ])) : T("", !0)
2005
+ ]),
2006
+ _: 1
2007
+ })
2008
+ ], 32)) : T("", !0)
2009
+ ])) : T("", !0),
2010
+ p("div", { id: s.value }, [
2011
+ Ae($.$slots, "default")
2012
+ ], 8, Ra),
2013
+ Z(Ne, {
2014
+ tag: "div",
2015
+ "enter-active-class": "motion-safe:transition-all motion-safe:duration-200 motion-safe:ease-out",
2016
+ "enter-from-class": "opacity-0 -translate-y-1 max-h-0",
2017
+ "enter-to-class": "opacity-100 translate-y-0 max-h-8",
2018
+ "leave-active-class": "motion-safe:transition-all motion-safe:duration-150 motion-safe:ease-in",
2019
+ "leave-from-class": "opacity-100 translate-y-0 max-h-8",
2020
+ "leave-to-class": "opacity-0 -translate-y-1 max-h-0",
2021
+ class: ""
2022
+ }, {
2023
+ default: W(() => [
2024
+ (c(!0), f(z, null, G(n.value ? e.errors : [], (m, y) => {
2025
+ var F;
2026
+ return c(), f("p", {
2027
+ key: m + y,
2028
+ id: y === 0 ? g.value : void 0,
2029
+ class: S([((F = H(a)) == null ? void 0 : F.classes.value.error) ?? "fc-error", "mt-1 text-xs text-red-500"]),
2030
+ role: "alert"
2031
+ }, L(m), 11, ja);
2032
+ }), 128))
2033
+ ]),
2034
+ _: 1
2035
+ }),
2036
+ d.value && !n.value ? (c(), f("p", {
2037
+ key: 1,
2038
+ class: S([((v = H(a)) == null ? void 0 : v.classes.value.helpText) ?? "fc-help-text", "mt-1 text-xs text-gray-400"])
2039
+ }, L(d.value), 3)) : T("", !0)
2040
+ ], 6);
2041
+ };
2042
+ }
2043
+ }), za = {
2044
+ key: 1,
2045
+ class: "rounded-md border border-dashed border-amber-400 bg-amber-50 px-3 py-2 text-xs text-amber-700"
2046
+ }, $e = /* @__PURE__ */ j({
2047
+ __name: "FormField",
2048
+ props: {
2049
+ name: {}
2050
+ },
2051
+ setup(e) {
2052
+ const i = e, t = J(ce);
2053
+ if (!t)
2054
+ throw new Error(
2055
+ "FormField must be used inside a FormBuilder (FormContextKey not provided)"
2056
+ );
2057
+ const a = J(
2058
+ Be,
2059
+ null
2060
+ ), r = h(
2061
+ () => P(t.schema.fields).find((b) => b.name === i.name)
2062
+ ), u = h(() => {
2063
+ var m;
2064
+ const b = r.value;
2065
+ if (!b) return;
2066
+ const v = (m = a == null ? void 0 : a.value) == null ? void 0 : m[b.type];
2067
+ return v || Ke(b.type);
2068
+ }), d = h(() => t.values[i.name]), l = h(() => t.errors[i.name] ?? []), n = h(() => t.touched[i.name] ?? !1), o = h(() => {
2069
+ const b = r.value;
2070
+ return b ? b.condition ? se(b.condition, t.values) : typeof b.visible == "function" ? b.visible({
2071
+ values: { ...t.values },
2072
+ getFieldValue: (v) => t.values[v]
2073
+ }) : b.visible ?? !0 : !1;
2074
+ }), s = h(() => {
2075
+ const b = r.value;
2076
+ return b ? typeof b.disabled == "function" ? b.disabled({
2077
+ values: { ...t.values },
2078
+ getFieldValue: (v) => t.values[v]
2079
+ }) : b.disabled ?? !1 : !1;
2080
+ }), g = h(() => {
2081
+ const b = r.value;
2082
+ if (!b) return {};
2083
+ const {
2084
+ name: v,
2085
+ label: m,
2086
+ helpText: y,
2087
+ tooltip: F,
2088
+ condition: k,
2089
+ translations: C,
2090
+ meta: w,
2091
+ rules: N,
2092
+ visible: B,
2093
+ className: A,
2094
+ style: R,
2095
+ defaultValue: Q,
2096
+ ...ee
2097
+ } = b;
2098
+ return {
2099
+ ...ee,
2100
+ modelValue: d.value,
2101
+ disabled: s.value,
2102
+ readonly: b.readOnly ?? !1,
2103
+ placeholder: b.placeholder ?? ""
2104
+ };
2105
+ });
2106
+ function $(b) {
2107
+ t.setFieldValue(i.name, b);
2108
+ }
2109
+ function V() {
2110
+ var b;
2111
+ t.touched[i.name] = !0, ((b = t.schema.settings) == null ? void 0 : b.validateOnBlur) !== !1 && t.validateField(i.name);
2112
+ }
2113
+ return (b, v) => (c(), U(ae, {
2114
+ "enter-active-class": "motion-safe:transition-all motion-safe:duration-300 motion-safe:ease-out",
2115
+ "enter-from-class": "opacity-0 max-h-0",
2116
+ "enter-to-class": "opacity-100 max-h-96",
2117
+ "leave-active-class": "motion-safe:transition-all motion-safe:duration-200 motion-safe:ease-in",
2118
+ "leave-from-class": "opacity-100 max-h-96",
2119
+ "leave-to-class": "opacity-0 max-h-0"
2120
+ }, {
2121
+ default: W(() => [
2122
+ o.value && r.value ? (c(), U(Oa, {
2123
+ key: 0,
2124
+ "field-schema": r.value,
2125
+ "field-name": e.name,
2126
+ errors: l.value,
2127
+ touched: n.value
2128
+ }, {
2129
+ default: W(() => [
2130
+ u.value ? (c(), U(Se(u.value), De({ key: 0 }, g.value, {
2131
+ "aria-invalid": n.value && l.value.length > 0 ? !0 : void 0,
2132
+ "aria-describedby": n.value && l.value.length > 0 ? `fc-error-${e.name}` : void 0,
2133
+ "onUpdate:modelValue": $,
2134
+ onBlur: V
2135
+ }), null, 16, ["aria-invalid", "aria-describedby"])) : (c(), f("div", za, ' No component registered for field type "' + L(r.value.type) + '" ', 1))
2136
+ ]),
2137
+ _: 1
2138
+ }, 8, ["field-schema", "field-name", "errors", "touched"])) : T("", !0)
2139
+ ]),
2140
+ _: 1
2141
+ }));
2142
+ }
2143
+ }), Ka = {
2144
+ key: 0,
2145
+ class: "relative flex justify-center"
2146
+ }, Pa = { class: "bg-white px-3 text-xs text-gray-500" }, Ua = /* @__PURE__ */ j({
2147
+ __name: "FormDivider",
2148
+ props: {
2149
+ label: {},
2150
+ className: {}
2151
+ },
2152
+ setup(e) {
2153
+ return (i, t) => (c(), f("div", {
2154
+ class: S([e.className ?? "", "relative my-4"]),
2155
+ role: "separator"
2156
+ }, [
2157
+ t[0] || (t[0] = p("div", {
2158
+ class: "absolute inset-0 flex items-center",
2159
+ "aria-hidden": "true"
2160
+ }, [
2161
+ p("div", { class: "w-full border-t border-gray-200" })
2162
+ ], -1)),
2163
+ e.label ? (c(), f("div", Ka, [
2164
+ p("span", Pa, L(e.label), 1)
2165
+ ])) : T("", !0)
2166
+ ], 2));
2167
+ }
2168
+ }), Ha = ["aria-labelledby"], Ga = {
2169
+ key: 0,
2170
+ class: "border-b border-gray-100 px-4 py-3"
2171
+ }, Za = ["id"], qa = {
2172
+ key: 1,
2173
+ class: "mt-0.5 text-xs text-gray-500"
2174
+ }, Ya = ["id"], Ja = /* @__PURE__ */ j({
2175
+ __name: "FormGroup",
2176
+ props: {
2177
+ title: {},
2178
+ description: {},
2179
+ collapsible: { type: Boolean, default: !1 },
2180
+ collapsed: { type: Boolean, default: !1 },
2181
+ children: {},
2182
+ className: {}
2183
+ },
2184
+ setup(e) {
2185
+ const i = e, t = D(i.collapsed);
2186
+ function a() {
2187
+ i.collapsible && (t.value = !t.value);
2188
+ }
2189
+ const r = h(
2190
+ () => i.title ? `fc-group-${i.title.toLowerCase().replace(/\s+/g, "-")}` : void 0
2191
+ );
2192
+ return (u, d) => (c(), f("fieldset", {
2193
+ class: S([[e.className ?? ""], "rounded-lg border border-gray-200 bg-white"]),
2194
+ "aria-labelledby": r.value
2195
+ }, [
2196
+ e.title || e.description ? (c(), f("div", Ga, [
2197
+ (c(), U(Se(e.collapsible ? "button" : "div"), {
2198
+ type: e.collapsible ? "button" : void 0,
2199
+ class: S(["flex w-full items-center justify-between text-left", e.collapsible ? "cursor-pointer focus:outline-none focus:ring-2 focus:ring-blue-500/40 rounded" : ""]),
2200
+ "aria-expanded": e.collapsible ? !t.value : void 0,
2201
+ "aria-controls": e.collapsible ? `fc-group-body-${r.value}` : void 0,
2202
+ onClick: a
2203
+ }, {
2204
+ default: W(() => [
2205
+ p("div", null, [
2206
+ e.title ? (c(), f("legend", {
2207
+ key: 0,
2208
+ id: r.value,
2209
+ class: "text-sm font-semibold text-gray-800"
2210
+ }, L(e.title), 9, Za)) : T("", !0),
2211
+ e.description ? (c(), f("p", qa, L(e.description), 1)) : T("", !0)
2212
+ ]),
2213
+ e.collapsible ? (c(), f("svg", {
2214
+ key: 0,
2215
+ class: S(["h-4 w-4 shrink-0 text-gray-400 motion-safe:transition-transform motion-safe:duration-200", t.value ? "" : "rotate-180"]),
2216
+ xmlns: "http://www.w3.org/2000/svg",
2217
+ viewBox: "0 0 20 20",
2218
+ fill: "currentColor",
2219
+ "aria-hidden": "true"
2220
+ }, [...d[0] || (d[0] = [
2221
+ p("path", {
2222
+ "fill-rule": "evenodd",
2223
+ d: "M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",
2224
+ "clip-rule": "evenodd"
2225
+ }, null, -1)
2226
+ ])], 2)) : T("", !0)
2227
+ ]),
2228
+ _: 1
2229
+ }, 8, ["type", "class", "aria-expanded", "aria-controls"]))
2230
+ ])) : T("", !0),
2231
+ Z(ae, {
2232
+ "enter-active-class": "motion-safe:transition-all motion-safe:duration-300 motion-safe:ease-out",
2233
+ "enter-from-class": "max-h-0 opacity-0 overflow-hidden",
2234
+ "enter-to-class": "max-h-[2000px] opacity-100 overflow-hidden",
2235
+ "leave-active-class": "motion-safe:transition-all motion-safe:duration-200 motion-safe:ease-in",
2236
+ "leave-from-class": "max-h-[2000px] opacity-100 overflow-hidden",
2237
+ "leave-to-class": "max-h-0 opacity-0 overflow-hidden"
2238
+ }, {
2239
+ default: W(() => [
2240
+ de(p("div", {
2241
+ id: e.collapsible ? `fc-group-body-${r.value}` : void 0,
2242
+ class: "p-4"
2243
+ }, [
2244
+ Z(oe, { nodes: e.children }, null, 8, ["nodes"])
2245
+ ], 8, Ya), [
2246
+ [Me, !t.value]
2247
+ ])
2248
+ ]),
2249
+ _: 1
2250
+ })
2251
+ ], 10, Ha));
2252
+ }
2253
+ }), Wa = ["innerHTML"], _a = /* @__PURE__ */ j({
2254
+ __name: "FormHtml",
2255
+ props: {
2256
+ content: {},
2257
+ className: {}
2258
+ },
2259
+ setup(e) {
2260
+ const i = e, t = h(() => Ie(i.content));
2261
+ return (a, r) => (c(), f("div", {
2262
+ class: S([e.className ?? "", "fc-html prose prose-sm max-w-none text-gray-700"]),
2263
+ innerHTML: t.value
2264
+ }, null, 10, Wa));
2265
+ }
2266
+ }), Qa = /* @__PURE__ */ j({
2267
+ __name: "FormRow",
2268
+ props: {
2269
+ children: {},
2270
+ gap: {},
2271
+ align: { default: "stretch" },
2272
+ className: {}
2273
+ },
2274
+ setup(e) {
2275
+ const i = e, t = h(() => ({
2276
+ start: "items-start",
2277
+ center: "items-center",
2278
+ end: "items-end",
2279
+ stretch: "items-stretch"
2280
+ })[i.align] ?? "items-stretch"), a = h(() => i.gap ? typeof i.gap == "number" ? `${i.gap}px` : i.gap : "");
2281
+ return (r, u) => (c(), f("div", {
2282
+ class: S(["grid grid-cols-12", [t.value, e.className ?? ""]]),
2283
+ style: O(a.value ? { gap: a.value } : { gap: "1rem" }),
2284
+ role: "group"
2285
+ }, [
2286
+ Z(oe, { nodes: e.children }, null, 8, ["nodes"])
2287
+ ], 6));
2288
+ }
2289
+ }), Xa = {
2290
+ "aria-label": "Form steps",
2291
+ class: "flex items-center justify-center"
2292
+ }, el = { class: "flex items-center gap-0" }, tl = ["disabled", "aria-current", "aria-label", "onClick"], al = {
2293
+ key: 0,
2294
+ class: "h-4 w-4 motion-safe:transition-transform motion-safe:duration-200",
2295
+ xmlns: "http://www.w3.org/2000/svg",
2296
+ viewBox: "0 0 20 20",
2297
+ fill: "currentColor",
2298
+ "aria-hidden": "true"
2299
+ }, ll = { key: 1 }, nl = {
2300
+ key: 0,
2301
+ class: "text-center"
2302
+ }, ol = { class: "text-base font-semibold text-gray-800" }, rl = {
2303
+ key: 0,
2304
+ class: "mt-1 text-sm text-gray-500"
2305
+ }, sl = { class: "flex items-center justify-between border-t border-gray-100 pt-4" }, il = ["disabled"], ul = { class: "text-xs text-gray-400" }, dl = {
2306
+ key: 1,
2307
+ class: "w-[72px]"
2308
+ }, cl = /* @__PURE__ */ j({
2309
+ __name: "FormSteps",
2310
+ props: {
2311
+ steps: {},
2312
+ linear: { type: Boolean, default: !1 },
2313
+ className: {}
2314
+ },
2315
+ setup(e) {
2316
+ const i = e, t = J(ce), a = D(0), r = D(/* @__PURE__ */ new Set()), u = h(() => i.steps), d = h(() => u.value.length), l = h(() => a.value === 0), n = h(() => a.value === d.value - 1);
2317
+ function o(b) {
2318
+ const v = [];
2319
+ function m(y) {
2320
+ for (const F of y)
2321
+ if (Ce(F))
2322
+ v.push(F.name);
2323
+ else if (F.type === "row" || F.type === "group")
2324
+ m(F.children);
2325
+ else if (F.type === "steps")
2326
+ for (const k of F.steps) m(k.children);
2327
+ else if (F.type === "tabs")
2328
+ for (const k of F.tabs) m(k.children);
2329
+ }
2330
+ return m(b.children), v;
2331
+ }
2332
+ async function s() {
2333
+ if (!t || !i.linear) return !0;
2334
+ const b = u.value[a.value];
2335
+ if (!b) return !0;
2336
+ const v = o(b);
2337
+ let m = !0;
2338
+ for (const y of v) {
2339
+ const F = await t.validateField(y);
2340
+ t.touched[y] = !0, F.length > 0 && (m = !1);
2341
+ }
2342
+ return m;
2343
+ }
2344
+ async function g() {
2345
+ n.value || i.linear && !await s() || (r.value.add(a.value), a.value++);
2346
+ }
2347
+ function $() {
2348
+ l.value || a.value--;
2349
+ }
2350
+ function V(b) {
2351
+ i.linear && b > a.value || (a.value = b);
2352
+ }
2353
+ return (b, v) => (c(), f("div", {
2354
+ class: S([e.className ?? "", "space-y-6"])
2355
+ }, [
2356
+ p("nav", Xa, [
2357
+ p("ol", el, [
2358
+ (c(!0), f(z, null, G(u.value, (m, y) => (c(), f("li", {
2359
+ key: y,
2360
+ class: "flex items-center"
2361
+ }, [
2362
+ p("button", {
2363
+ type: "button",
2364
+ disabled: e.linear && y > a.value,
2365
+ "aria-current": y === a.value ? "step" : void 0,
2366
+ "aria-label": `Step ${y + 1}: ${m.title}`,
2367
+ class: S(["relative flex h-8 w-8 shrink-0 items-center justify-center rounded-full border-2 text-xs font-semibold motion-safe:transition-all motion-safe:duration-300 focus:outline-none focus:ring-2 focus:ring-blue-500/40", [
2368
+ r.value.has(y) && y !== a.value ? "border-green-500 bg-green-500 text-white" : y !== a.value ? "border-gray-300 bg-white text-gray-500" : "text-white",
2369
+ e.linear && y > a.value ? "cursor-not-allowed" : "cursor-pointer hover:shadow-md"
2370
+ ]]),
2371
+ style: O(y === a.value ? { borderColor: "var(--fc-color-primary, #3b82f6)", backgroundColor: "var(--fc-color-primary, #3b82f6)" } : {}),
2372
+ onClick: (F) => V(y)
2373
+ }, [
2374
+ r.value.has(y) && y !== a.value ? (c(), f("svg", al, [...v[0] || (v[0] = [
2375
+ p("path", {
2376
+ "fill-rule": "evenodd",
2377
+ d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",
2378
+ "clip-rule": "evenodd"
2379
+ }, null, -1)
2380
+ ])])) : (c(), f("span", ll, L(y + 1), 1))
2381
+ ], 14, tl),
2382
+ y < u.value.length - 1 ? (c(), f("div", {
2383
+ key: 0,
2384
+ class: S(["mx-1 h-0.5 w-8 motion-safe:transition-colors motion-safe:duration-300 sm:w-12", r.value.has(y) ? "bg-green-500" : "bg-gray-200"])
2385
+ }, null, 2)) : T("", !0)
2386
+ ]))), 128))
2387
+ ])
2388
+ ]),
2389
+ u.value[a.value] ? (c(), f("div", nl, [
2390
+ p("h3", ol, L(u.value[a.value].title), 1),
2391
+ u.value[a.value].description ? (c(), f("p", rl, L(u.value[a.value].description), 1)) : T("", !0)
2392
+ ])) : T("", !0),
2393
+ Z(ae, {
2394
+ mode: "out-in",
2395
+ "enter-active-class": "motion-safe:transition-all motion-safe:duration-200 motion-safe:ease-out",
2396
+ "enter-from-class": "opacity-0 translate-x-2",
2397
+ "enter-to-class": "opacity-100 translate-x-0",
2398
+ "leave-active-class": "motion-safe:transition-all motion-safe:duration-150 motion-safe:ease-in",
2399
+ "leave-from-class": "opacity-100 translate-x-0",
2400
+ "leave-to-class": "opacity-0 -translate-x-2"
2401
+ }, {
2402
+ default: W(() => [
2403
+ u.value[a.value] ? (c(), f("div", { key: a.value }, [
2404
+ Z(oe, {
2405
+ nodes: u.value[a.value].children
2406
+ }, null, 8, ["nodes"])
2407
+ ])) : T("", !0)
2408
+ ]),
2409
+ _: 1
2410
+ }),
2411
+ p("div", sl, [
2412
+ p("button", {
2413
+ type: "button",
2414
+ disabled: l.value,
2415
+ class: "rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 motion-safe:transition-colors motion-safe:duration-150 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500/40 disabled:cursor-not-allowed disabled:opacity-50 fc-steps-prev-btn",
2416
+ onClick: $
2417
+ }, " Previous ", 8, il),
2418
+ p("span", ul, L(a.value + 1) + " / " + L(d.value), 1),
2419
+ n.value ? (c(), f("div", dl)) : (c(), f("button", {
2420
+ key: 0,
2421
+ type: "button",
2422
+ class: "rounded-md px-4 py-2 text-sm font-medium text-white motion-safe:transition-colors motion-safe:duration-150 focus:outline-none focus:ring-2 focus:ring-blue-500/40 fc-steps-next-btn",
2423
+ style: { backgroundColor: "var(--fc-color-primary, #3b82f6)" },
2424
+ onClick: g
2425
+ }, " Next "))
2426
+ ])
2427
+ ], 2));
2428
+ }
2429
+ }), fl = {
2430
+ class: "relative flex border-b border-gray-200",
2431
+ role: "tablist",
2432
+ "aria-orientation": "horizontal"
2433
+ }, ml = ["id", "aria-selected", "aria-controls", "aria-disabled", "tabindex", "onClick", "onKeydown"], bl = {
2434
+ key: 0,
2435
+ class: "absolute inset-x-0 -bottom-px h-0.5 motion-safe:transition-all motion-safe:duration-200",
2436
+ style: { backgroundColor: "var(--fc-color-primary, #3b82f6)" }
2437
+ }, vl = ["id", "aria-labelledby"], yl = /* @__PURE__ */ j({
2438
+ __name: "FormTabs",
2439
+ props: {
2440
+ tabs: {},
2441
+ className: {}
2442
+ },
2443
+ setup(e) {
2444
+ const i = e, t = D(0), a = h(() => i.tabs);
2445
+ function r(l) {
2446
+ const n = a.value[l];
2447
+ n != null && n.disabled || (t.value = l);
2448
+ }
2449
+ function u(l, n) {
2450
+ var $;
2451
+ const o = a.value.length;
2452
+ let s = n;
2453
+ if (l.key === "ArrowRight" || l.key === "ArrowDown")
2454
+ l.preventDefault(), s = (n + 1) % o;
2455
+ else if (l.key === "ArrowLeft" || l.key === "ArrowUp")
2456
+ l.preventDefault(), s = (n - 1 + o) % o;
2457
+ else if (l.key === "Home")
2458
+ l.preventDefault(), s = 0;
2459
+ else if (l.key === "End")
2460
+ l.preventDefault(), s = o - 1;
2461
+ else
2462
+ return;
2463
+ for (; ($ = a.value[s]) != null && $.disabled && s !== n; )
2464
+ l.key === "ArrowLeft" || l.key === "ArrowUp" ? s = (s - 1 + o) % o : s = (s + 1) % o;
2465
+ r(s);
2466
+ const g = document.getElementById(`fc-tab-${s}`);
2467
+ g == null || g.focus();
2468
+ }
2469
+ const d = h(() => `fc-tabpanel-${t.value}`);
2470
+ return (l, n) => (c(), f("div", {
2471
+ class: S(e.className ?? "")
2472
+ }, [
2473
+ p("div", fl, [
2474
+ (c(!0), f(z, null, G(a.value, (o, s) => (c(), f("button", {
2475
+ key: s,
2476
+ id: `fc-tab-${s}`,
2477
+ type: "button",
2478
+ role: "tab",
2479
+ "aria-selected": s === t.value,
2480
+ "aria-controls": d.value,
2481
+ "aria-disabled": o.disabled || void 0,
2482
+ tabindex: s === t.value ? 0 : -1,
2483
+ class: S(["relative px-4 py-2.5 text-sm font-medium motion-safe:transition-colors motion-safe:duration-150 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-blue-500/40", [
2484
+ s !== t.value ? o.disabled ? "cursor-not-allowed text-gray-300" : "text-gray-500 hover:text-gray-700" : ""
2485
+ ]]),
2486
+ style: O(s === t.value ? { color: "var(--fc-color-primary, #3b82f6)" } : {}),
2487
+ onClick: (g) => r(s),
2488
+ onKeydown: (g) => u(g, s)
2489
+ }, [
2490
+ _(L(o.title) + " ", 1),
2491
+ s === t.value ? (c(), f("span", bl)) : T("", !0)
2492
+ ], 46, ml))), 128))
2493
+ ]),
2494
+ Z(ae, {
2495
+ mode: "out-in",
2496
+ "enter-active-class": "motion-safe:transition-all motion-safe:duration-200 motion-safe:ease-out",
2497
+ "enter-from-class": "opacity-0 translate-y-1",
2498
+ "enter-to-class": "opacity-100 translate-y-0",
2499
+ "leave-active-class": "motion-safe:transition-all motion-safe:duration-150 motion-safe:ease-in",
2500
+ "leave-from-class": "opacity-100 translate-y-0",
2501
+ "leave-to-class": "opacity-0 -translate-y-1"
2502
+ }, {
2503
+ default: W(() => [
2504
+ a.value[t.value] ? (c(), f("div", {
2505
+ key: t.value,
2506
+ id: d.value,
2507
+ role: "tabpanel",
2508
+ "aria-labelledby": `fc-tab-${t.value}`,
2509
+ tabindex: "0",
2510
+ class: "pt-4"
2511
+ }, [
2512
+ Z(oe, {
2513
+ nodes: a.value[t.value].children
2514
+ }, null, 8, ["nodes"])
2515
+ ], 8, vl)) : T("", !0)
2516
+ ]),
2517
+ _: 1
2518
+ })
2519
+ ], 2));
2520
+ }
2521
+ }), oe = /* @__PURE__ */ j({
2522
+ __name: "LayoutRenderer",
2523
+ props: {
2524
+ nodes: {}
2525
+ },
2526
+ setup(e) {
2527
+ const i = J(ce);
2528
+ function t(r) {
2529
+ return i ? se(r.condition, i.values) : !0;
2530
+ }
2531
+ function a(r) {
2532
+ return r === "full" ? { gridColumn: "1 / -1" } : r === "auto" ? { gridColumn: "auto" } : typeof r == "number" ? { gridColumn: `span ${r} / span ${r}` } : { gridColumn: "span 12 / span 12" };
2533
+ }
2534
+ return (r, u) => {
2535
+ const d = Ee("LayoutRenderer", !0);
2536
+ return c(!0), f(z, null, G(e.nodes, (l, n) => {
2537
+ var o;
2538
+ return c(), f(z, { key: n }, [
2539
+ H(Ce)(l) ? (c(), f("div", {
2540
+ key: 0,
2541
+ class: S(l.className ?? ""),
2542
+ style: O(a(l.span))
2543
+ }, [
2544
+ Z($e, {
2545
+ name: l.name
2546
+ }, null, 8, ["name"])
2547
+ ], 6)) : l.type === "field" ? (c(), f("div", {
2548
+ key: 1,
2549
+ class: S(l.className ?? ""),
2550
+ style: O(a(l.span))
2551
+ }, [
2552
+ Z($e, {
2553
+ name: l.name
2554
+ }, null, 8, ["name"])
2555
+ ], 6)) : l.type === "row" ? (c(), U(Qa, {
2556
+ key: 2,
2557
+ children: l.children,
2558
+ gap: l.gap,
2559
+ align: l.align,
2560
+ "class-name": l.className
2561
+ }, null, 8, ["children", "gap", "align", "class-name"])) : l.type === "group" ? (c(), U(Ja, {
2562
+ key: 3,
2563
+ title: l.title,
2564
+ description: l.description,
2565
+ collapsible: l.collapsible,
2566
+ collapsed: l.collapsed,
2567
+ children: l.children,
2568
+ "class-name": l.className
2569
+ }, null, 8, ["title", "description", "collapsible", "collapsed", "children", "class-name"])) : l.type === "steps" ? (c(), U(cl, {
2570
+ key: 4,
2571
+ steps: l.steps,
2572
+ linear: l.linear,
2573
+ "class-name": l.className
2574
+ }, null, 8, ["steps", "linear", "class-name"])) : l.type === "tabs" ? (c(), U(yl, {
2575
+ key: 5,
2576
+ tabs: l.tabs,
2577
+ "class-name": l.className
2578
+ }, null, 8, ["tabs", "class-name"])) : l.type === "divider" ? (c(), U(Ua, {
2579
+ key: 6,
2580
+ label: l.label,
2581
+ "class-name": l.className
2582
+ }, null, 8, ["label", "class-name"])) : l.type === "html" ? (c(), U(_a, {
2583
+ key: 7,
2584
+ content: l.content,
2585
+ "class-name": l.className
2586
+ }, null, 8, ["content", "class-name"])) : l.type === "conditional" ? (c(), f(z, { key: 8 }, [
2587
+ t(l) ? (c(), U(d, {
2588
+ key: 0,
2589
+ nodes: l.children
2590
+ }, null, 8, ["nodes"])) : (o = l.elseChildren) != null && o.length ? (c(), U(d, {
2591
+ key: 1,
2592
+ nodes: l.elseChildren
2593
+ }, null, 8, ["nodes"])) : T("", !0)
2594
+ ], 64)) : T("", !0)
2595
+ ], 64);
2596
+ }), 128);
2597
+ };
2598
+ }
2599
+ }), pl = {
2600
+ key: 0,
2601
+ class: "mb-6"
2602
+ }, gl = {
2603
+ key: 0,
2604
+ class: "text-lg font-semibold text-gray-900"
2605
+ }, hl = {
2606
+ key: 1,
2607
+ class: "mt-1 text-sm text-gray-500"
2608
+ }, xl = { class: "mt-6 flex items-center gap-3" }, kl = ["disabled"], wl = {
2609
+ key: 0,
2610
+ class: "mr-2 inline-block h-3.5 w-3.5 animate-spin rounded-full border-2 border-white border-t-transparent",
2611
+ "aria-hidden": "true"
2612
+ }, $l = ["disabled"], Tl = /* @__PURE__ */ j({
2613
+ __name: "FormBuilder",
2614
+ props: {
2615
+ schema: {},
2616
+ layout: {},
2617
+ locale: { default: "en" },
2618
+ fallbackLocale: { default: "en" },
2619
+ modelValue: {},
2620
+ theme: {},
2621
+ components: {}
2622
+ },
2623
+ emits: ["submit", "error", "update:modelValue"],
2624
+ setup(e, { expose: i, emit: t }) {
2625
+ const a = e, r = t, u = [
2626
+ ["text", La],
2627
+ ["number", Lt],
2628
+ ["textarea", Ca],
2629
+ ["select", ia],
2630
+ ["checkbox", ft],
2631
+ ["checkbox-group", st],
2632
+ ["radio", Wt],
2633
+ ["switch", ya],
2634
+ ["date", vt],
2635
+ ["file", Ct],
2636
+ ["slider", ca],
2637
+ ["tags", ka],
2638
+ ["phone", Gt]
2639
+ ];
2640
+ for (const [v, m] of u)
2641
+ Pe(v) || ze(v, m);
2642
+ ie(
2643
+ Be,
2644
+ h(() => a.components ?? {})
2645
+ ), tt(Re(a, "theme"));
2646
+ const d = K(), l = et(a.schema, {
2647
+ locale: a.locale,
2648
+ fallbackLocale: a.fallbackLocale
2649
+ });
2650
+ if (a.modelValue)
2651
+ for (const [v, m] of Object.entries(a.modelValue))
2652
+ l.setFieldValue(v, m);
2653
+ Y(
2654
+ () => a.modelValue,
2655
+ (v) => {
2656
+ if (v)
2657
+ for (const [m, y] of Object.entries(v))
2658
+ l.values[m] !== y && l.setFieldValue(m, y);
2659
+ },
2660
+ { deep: !0 }
2661
+ ), Y(
2662
+ () => ({ ...l.values }),
2663
+ (v) => {
2664
+ r("update:modelValue", v);
2665
+ },
2666
+ { deep: !0 }
2667
+ ), Y(
2668
+ () => a.locale,
2669
+ (v) => {
2670
+ v && l.setLocale(v);
2671
+ }
2672
+ ), Ze();
2673
+ const n = h(() => {
2674
+ var F, k;
2675
+ const v = a.schema.translations;
2676
+ if (!v) return "";
2677
+ const m = v[a.locale];
2678
+ if ((F = m == null ? void 0 : m.messages) != null && F.title) return m.messages.title;
2679
+ const y = v[a.fallbackLocale];
2680
+ return ((k = y == null ? void 0 : y.messages) == null ? void 0 : k.title) ?? "";
2681
+ }), o = h(() => {
2682
+ var F, k;
2683
+ const v = a.schema.translations;
2684
+ if (!v) return "";
2685
+ const m = v[a.locale];
2686
+ if ((F = m == null ? void 0 : m.messages) != null && F.description) return m.messages.description;
2687
+ const y = v[a.fallbackLocale];
2688
+ return ((k = y == null ? void 0 : y.messages) == null ? void 0 : k.description) ?? "";
2689
+ }), s = h(() => {
2690
+ const v = a.schema.translations;
2691
+ if (!v) return "Submit";
2692
+ const m = v[a.locale];
2693
+ if (m != null && m.submit) return m.submit;
2694
+ const y = v[a.fallbackLocale];
2695
+ return (y == null ? void 0 : y.submit) ?? "Submit";
2696
+ }), g = h(() => {
2697
+ const v = a.schema.translations;
2698
+ if (!v) return "Reset";
2699
+ const m = v[a.locale];
2700
+ if (m != null && m.reset) return m.reset;
2701
+ const y = v[a.fallbackLocale];
2702
+ return (y == null ? void 0 : y.reset) ?? "Reset";
2703
+ }), $ = h(() => {
2704
+ var v, m;
2705
+ return (m = (v = a.layout) == null ? void 0 : v.nodes) != null && m.length ? a.layout.nodes : a.schema.fields;
2706
+ });
2707
+ async function V() {
2708
+ try {
2709
+ await l.submit(async (v) => {
2710
+ r("submit", v);
2711
+ });
2712
+ } catch (v) {
2713
+ r("error", v);
2714
+ }
2715
+ }
2716
+ function b() {
2717
+ l.reset();
2718
+ }
2719
+ return i({ form: l }), (v, m) => (c(), f("form", {
2720
+ class: S([H(d).classes.value.form, "fc-form-builder"]),
2721
+ style: O(H(d).cssVars.value),
2722
+ novalidate: "",
2723
+ onSubmit: q(V, ["prevent"]),
2724
+ onReset: q(b, ["prevent"])
2725
+ }, [
2726
+ n.value || o.value ? (c(), f("div", pl, [
2727
+ n.value ? (c(), f("h2", gl, L(n.value), 1)) : T("", !0),
2728
+ o.value ? (c(), f("p", hl, L(o.value), 1)) : T("", !0)
2729
+ ])) : T("", !0),
2730
+ Z(oe, { nodes: $.value }, null, 8, ["nodes"]),
2731
+ p("div", xl, [
2732
+ p("button", {
2733
+ type: "submit",
2734
+ disabled: H(l).isSubmitting.value,
2735
+ class: S([H(d).classes.value.button, "fc-submit-btn rounded-md px-4 py-2 text-sm font-medium text-white motion-safe:transition-colors motion-safe:duration-150 focus:outline-none focus:ring-2 focus:ring-blue-500/40 disabled:cursor-not-allowed disabled:opacity-50"]),
2736
+ style: { "background-color": "var(--fc-color-primary, #3b82f6)" }
2737
+ }, [
2738
+ H(l).isSubmitting.value ? (c(), f("span", wl)) : T("", !0),
2739
+ _(" " + L(s.value), 1)
2740
+ ], 10, kl),
2741
+ p("button", {
2742
+ type: "reset",
2743
+ disabled: H(l).isSubmitting.value,
2744
+ class: "rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 motion-safe:transition-colors motion-safe:duration-150 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500/40 disabled:cursor-not-allowed disabled:opacity-50"
2745
+ }, L(g.value), 9, $l)
2746
+ ])
2747
+ ], 38));
2748
+ }
2749
+ });
2750
+ export {
2751
+ Tl as FormBuilder,
2752
+ Be as FormComponentsKey,
2753
+ ce as FormContextKey,
2754
+ ye as FormI18nKey,
2755
+ Ke as getFieldComponent,
2756
+ Fl as getRegisteredFieldTypes,
2757
+ Pe as hasFieldType,
2758
+ ze as registerFieldType,
2759
+ Bl as unregisterFieldType,
2760
+ et as useForm,
2761
+ Ge as useFormI18n,
2762
+ Ze as useFormI18nContext
2763
+ };
2764
+ //# sourceMappingURL=formatica.es.js.map