@schema-forms-data/renderer 0.3.21 → 0.3.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.js +807 -717
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs as m, jsx as i, Fragment as Ee } from "react/jsx-runtime";
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { useController as P, useFormContext as be, useFieldArray as
|
|
4
|
-
import { useTemplate as
|
|
2
|
+
import { createContext as gr, useContext as ye, useState as R, useRef as te, useCallback as oe, useEffect as G, useMemo as j } from "react";
|
|
3
|
+
import { useController as P, useFormContext as be, useFieldArray as vr, useFormState as Wr, useWatch as de, useForm as qr, FormProvider as Gr } from "react-hook-form";
|
|
4
|
+
import { useTemplate as Yr, getTemplateConfig as Qr, TemplateProvider as et } from "@schema-forms-data/templates";
|
|
5
5
|
import { FieldType as h } from "@schema-forms-data/core";
|
|
6
6
|
import * as Te from "lucide-react";
|
|
7
|
-
import { Trash2 as yr, Plus as
|
|
8
|
-
function
|
|
7
|
+
import { Trash2 as yr, Plus as br, AlertCircle as Nr, CalendarCheck2 as rt, Users as tt, CalendarDays as nt, Info as _r, Smartphone as De, Banknote as xr, CreditCard as wr, ScrollText as He, Loader2 as Cr, ExternalLink as st, CheckCircle2 as ot, X as zr, EyeOff as at, Eye as it, ChevronDown as ct, Star as lt, Check as Er, ChevronLeft as dt, ChevronRight as ut } from "lucide-react";
|
|
8
|
+
function O(e, r, n) {
|
|
9
9
|
function t(c, l) {
|
|
10
10
|
if (c._zod || Object.defineProperty(c, "_zod", {
|
|
11
11
|
value: {
|
|
@@ -19,8 +19,8 @@ function S(e, r, n) {
|
|
|
19
19
|
c._zod.traits.add(e), r(c, l);
|
|
20
20
|
const d = a.prototype, f = Object.keys(d);
|
|
21
21
|
for (let u = 0; u < f.length; u++) {
|
|
22
|
-
const
|
|
23
|
-
|
|
22
|
+
const v = f[u];
|
|
23
|
+
v in c || (c[v] = d[v].bind(c));
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
const s = (n == null ? void 0 : n.Parent) ?? Object;
|
|
@@ -47,14 +47,14 @@ class me extends Error {
|
|
|
47
47
|
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
class
|
|
50
|
+
class Sr extends Error {
|
|
51
51
|
constructor(r) {
|
|
52
52
|
super(`Encountered unidirectional transform during encode: ${r}`), this.name = "ZodEncodeError";
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
const
|
|
55
|
+
const ft = {};
|
|
56
56
|
function ce(e) {
|
|
57
|
-
return
|
|
57
|
+
return ft;
|
|
58
58
|
}
|
|
59
59
|
function Ae(e, r) {
|
|
60
60
|
return typeof r == "bigint" ? r.toString() : r;
|
|
@@ -83,7 +83,7 @@ function $(e, r, n) {
|
|
|
83
83
|
configurable: !0
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function mt(...e) {
|
|
87
87
|
const r = {};
|
|
88
88
|
for (const n of e) {
|
|
89
89
|
const t = Object.getOwnPropertyDescriptors(n);
|
|
@@ -91,7 +91,7 @@ function ft(...e) {
|
|
|
91
91
|
}
|
|
92
92
|
return Object.defineProperties({}, r);
|
|
93
93
|
}
|
|
94
|
-
const
|
|
94
|
+
const Or = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {
|
|
95
95
|
};
|
|
96
96
|
function We(e) {
|
|
97
97
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
@@ -105,10 +105,10 @@ function Ie(e) {
|
|
|
105
105
|
const n = r.prototype;
|
|
106
106
|
return !(We(n) === !1 || Object.prototype.hasOwnProperty.call(n, "isPrototypeOf") === !1);
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function Tr(e) {
|
|
109
109
|
return Ie(e) ? { ...e } : Array.isArray(e) ? [...e] : e;
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function pt(e, r, n) {
|
|
112
112
|
const t = new e._zod.constr(r ?? e._zod.def);
|
|
113
113
|
return (!r || n != null && n.parent) && (t._zod.parent = e), t;
|
|
114
114
|
}
|
|
@@ -134,7 +134,7 @@ function fe(e, r = 0) {
|
|
|
134
134
|
return !0;
|
|
135
135
|
return !1;
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function ht(e, r) {
|
|
138
138
|
return r.map((n) => {
|
|
139
139
|
var t;
|
|
140
140
|
return (t = n).path ?? (t.path = []), n.path.unshift(e), n;
|
|
@@ -164,7 +164,7 @@ function ge(...e) {
|
|
|
164
164
|
inst: t
|
|
165
165
|
} : { ...r };
|
|
166
166
|
}
|
|
167
|
-
const
|
|
167
|
+
const $r = (e, r) => {
|
|
168
168
|
e.name = "$ZodError", Object.defineProperty(e, "_zod", {
|
|
169
169
|
value: e._zod,
|
|
170
170
|
enumerable: !1
|
|
@@ -175,14 +175,14 @@ const Tr = (e, r) => {
|
|
|
175
175
|
value: () => e.message,
|
|
176
176
|
enumerable: !1
|
|
177
177
|
});
|
|
178
|
-
},
|
|
179
|
-
function
|
|
178
|
+
}, kr = O("$ZodError", $r), Pr = O("$ZodError", $r, { Parent: Error });
|
|
179
|
+
function gt(e, r = (n) => n.message) {
|
|
180
180
|
const n = {}, t = [];
|
|
181
181
|
for (const s of e.issues)
|
|
182
182
|
s.path.length > 0 ? (n[s.path[0]] = n[s.path[0]] || [], n[s.path[0]].push(r(s))) : t.push(r(s));
|
|
183
183
|
return { formErrors: t, fieldErrors: n };
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function vt(e, r = (n) => n.message) {
|
|
186
186
|
const n = { _errors: [] }, t = (s) => {
|
|
187
187
|
for (const o of s.issues)
|
|
188
188
|
if (o.code === "invalid_union" && o.errors.length)
|
|
@@ -209,7 +209,7 @@ const Le = (e) => (r, n, t, s) => {
|
|
|
209
209
|
throw new me();
|
|
210
210
|
if (a.issues.length) {
|
|
211
211
|
const c = new ((s == null ? void 0 : s.Err) ?? e)(a.issues.map((l) => le(l, o, ce())));
|
|
212
|
-
throw
|
|
212
|
+
throw Or(c, s == null ? void 0 : s.callee), c;
|
|
213
213
|
}
|
|
214
214
|
return a.value;
|
|
215
215
|
}, Me = (e) => async (r, n, t, s) => {
|
|
@@ -217,7 +217,7 @@ const Le = (e) => (r, n, t, s) => {
|
|
|
217
217
|
let a = r._zod.run({ value: n, issues: [] }, o);
|
|
218
218
|
if (a instanceof Promise && (a = await a), a.issues.length) {
|
|
219
219
|
const c = new ((s == null ? void 0 : s.Err) ?? e)(a.issues.map((l) => le(l, o, ce())));
|
|
220
|
-
throw
|
|
220
|
+
throw Or(c, s == null ? void 0 : s.callee), c;
|
|
221
221
|
}
|
|
222
222
|
return a.value;
|
|
223
223
|
}, $e = (e) => (r, n, t) => {
|
|
@@ -226,31 +226,31 @@ const Le = (e) => (r, n, t, s) => {
|
|
|
226
226
|
throw new me();
|
|
227
227
|
return o.issues.length ? {
|
|
228
228
|
success: !1,
|
|
229
|
-
error: new (e ??
|
|
229
|
+
error: new (e ?? kr)(o.issues.map((a) => le(a, s, ce())))
|
|
230
230
|
} : { success: !0, data: o.value };
|
|
231
|
-
}, yt = /* @__PURE__ */ $e(
|
|
231
|
+
}, yt = /* @__PURE__ */ $e(Pr), ke = (e) => async (r, n, t) => {
|
|
232
232
|
const s = t ? Object.assign(t, { async: !0 }) : { async: !0 };
|
|
233
233
|
let o = r._zod.run({ value: n, issues: [] }, s);
|
|
234
234
|
return o instanceof Promise && (o = await o), o.issues.length ? {
|
|
235
235
|
success: !1,
|
|
236
236
|
error: new e(o.issues.map((a) => le(a, s, ce())))
|
|
237
237
|
} : { success: !0, data: o.value };
|
|
238
|
-
},
|
|
238
|
+
}, bt = /* @__PURE__ */ ke(Pr), Nt = (e) => (r, n, t) => {
|
|
239
239
|
const s = t ? Object.assign(t, { direction: "backward" }) : { direction: "backward" };
|
|
240
240
|
return Le(e)(r, n, s);
|
|
241
|
-
},
|
|
241
|
+
}, _t = (e) => (r, n, t) => Le(e)(r, n, t), xt = (e) => async (r, n, t) => {
|
|
242
242
|
const s = t ? Object.assign(t, { direction: "backward" }) : { direction: "backward" };
|
|
243
243
|
return Me(e)(r, n, s);
|
|
244
|
-
},
|
|
244
|
+
}, wt = (e) => async (r, n, t) => Me(e)(r, n, t), Ct = (e) => (r, n, t) => {
|
|
245
245
|
const s = t ? Object.assign(t, { direction: "backward" }) : { direction: "backward" };
|
|
246
246
|
return $e(e)(r, n, s);
|
|
247
|
-
},
|
|
247
|
+
}, zt = (e) => (r, n, t) => $e(e)(r, n, t), Et = (e) => async (r, n, t) => {
|
|
248
248
|
const s = t ? Object.assign(t, { direction: "backward" }) : { direction: "backward" };
|
|
249
249
|
return ke(e)(r, n, s);
|
|
250
|
-
},
|
|
250
|
+
}, St = (e) => async (r, n, t) => ke(e)(r, n, t), pe = /* @__PURE__ */ O("$ZodCheck", (e, r) => {
|
|
251
251
|
var n;
|
|
252
252
|
e._zod ?? (e._zod = {}), e._zod.def = r, (n = e._zod).onattach ?? (n.onattach = []);
|
|
253
|
-
}),
|
|
253
|
+
}), Ot = /* @__PURE__ */ O("$ZodCheckMaxLength", (e, r) => {
|
|
254
254
|
var n;
|
|
255
255
|
pe.init(e, r), (n = e._zod.def).when ?? (n.when = (t) => {
|
|
256
256
|
const s = t.value;
|
|
@@ -273,7 +273,7 @@ const Le = (e) => (r, n, t, s) => {
|
|
|
273
273
|
continue: !r.abort
|
|
274
274
|
});
|
|
275
275
|
};
|
|
276
|
-
}),
|
|
276
|
+
}), Tt = /* @__PURE__ */ O("$ZodCheckMinLength", (e, r) => {
|
|
277
277
|
var n;
|
|
278
278
|
pe.init(e, r), (n = e._zod.def).when ?? (n.when = (t) => {
|
|
279
279
|
const s = t.value;
|
|
@@ -296,7 +296,7 @@ const Le = (e) => (r, n, t, s) => {
|
|
|
296
296
|
continue: !r.abort
|
|
297
297
|
});
|
|
298
298
|
};
|
|
299
|
-
}),
|
|
299
|
+
}), $t = /* @__PURE__ */ O("$ZodCheckLengthEquals", (e, r) => {
|
|
300
300
|
var n;
|
|
301
301
|
pe.init(e, r), (n = e._zod.def).when ?? (n.when = (t) => {
|
|
302
302
|
const s = t.value;
|
|
@@ -319,18 +319,18 @@ const Le = (e) => (r, n, t, s) => {
|
|
|
319
319
|
continue: !r.abort
|
|
320
320
|
});
|
|
321
321
|
};
|
|
322
|
-
}),
|
|
322
|
+
}), kt = /* @__PURE__ */ O("$ZodCheckOverwrite", (e, r) => {
|
|
323
323
|
pe.init(e, r), e._zod.check = (n) => {
|
|
324
324
|
n.value = r.tx(n.value);
|
|
325
325
|
};
|
|
326
|
-
}),
|
|
326
|
+
}), Pt = {
|
|
327
327
|
major: 4,
|
|
328
328
|
minor: 3,
|
|
329
329
|
patch: 6
|
|
330
|
-
},
|
|
330
|
+
}, L = /* @__PURE__ */ O("$ZodType", (e, r) => {
|
|
331
331
|
var s;
|
|
332
332
|
var n;
|
|
333
|
-
e ?? (e = {}), e._zod.def = r, e._zod.bag = e._zod.bag || {}, e._zod.version =
|
|
333
|
+
e ?? (e = {}), e._zod.def = r, e._zod.bag = e._zod.bag || {}, e._zod.version = Pt;
|
|
334
334
|
const t = [...e._zod.def.checks ?? []];
|
|
335
335
|
e._zod.traits.has("$ZodCheck") && t.unshift(e);
|
|
336
336
|
for (const o of t)
|
|
@@ -343,23 +343,23 @@ const Le = (e) => (r, n, t, s) => {
|
|
|
343
343
|
else {
|
|
344
344
|
const o = (c, l, d) => {
|
|
345
345
|
let f = fe(c), u;
|
|
346
|
-
for (const
|
|
347
|
-
if (
|
|
348
|
-
if (!
|
|
346
|
+
for (const v of l) {
|
|
347
|
+
if (v._zod.def.when) {
|
|
348
|
+
if (!v._zod.def.when(c))
|
|
349
349
|
continue;
|
|
350
350
|
} else if (f)
|
|
351
351
|
continue;
|
|
352
|
-
const
|
|
352
|
+
const y = c.issues.length, N = v._zod.check(c);
|
|
353
353
|
if (N instanceof Promise && (d == null ? void 0 : d.async) === !1)
|
|
354
354
|
throw new me();
|
|
355
355
|
if (u || N instanceof Promise)
|
|
356
356
|
u = (u ?? Promise.resolve()).then(async () => {
|
|
357
|
-
await N, c.issues.length !==
|
|
357
|
+
await N, c.issues.length !== y && (f || (f = fe(c, y)));
|
|
358
358
|
});
|
|
359
359
|
else {
|
|
360
|
-
if (c.issues.length ===
|
|
360
|
+
if (c.issues.length === y)
|
|
361
361
|
continue;
|
|
362
|
-
f || (f = fe(c,
|
|
362
|
+
f || (f = fe(c, y));
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
365
|
return u ? u.then(() => c) : c;
|
|
@@ -397,7 +397,7 @@ const Le = (e) => (r, n, t, s) => {
|
|
|
397
397
|
const c = yt(e, o);
|
|
398
398
|
return c.success ? { value: c.data } : { issues: (a = c.error) == null ? void 0 : a.issues };
|
|
399
399
|
} catch {
|
|
400
|
-
return
|
|
400
|
+
return bt(e, o).then((l) => {
|
|
401
401
|
var d;
|
|
402
402
|
return l.success ? { value: l.data } : { issues: (d = l.error) == null ? void 0 : d.issues };
|
|
403
403
|
});
|
|
@@ -406,14 +406,14 @@ const Le = (e) => (r, n, t, s) => {
|
|
|
406
406
|
vendor: "zod",
|
|
407
407
|
version: 1
|
|
408
408
|
}));
|
|
409
|
-
}),
|
|
410
|
-
|
|
409
|
+
}), Dt = /* @__PURE__ */ O("$ZodUnknown", (e, r) => {
|
|
410
|
+
L.init(e, r), e._zod.parse = (n) => n;
|
|
411
411
|
});
|
|
412
|
-
function
|
|
413
|
-
e.issues.length && r.issues.push(...
|
|
412
|
+
function qe(e, r, n) {
|
|
413
|
+
e.issues.length && r.issues.push(...ht(n, e.issues)), r.value[n] = e.value;
|
|
414
414
|
}
|
|
415
|
-
const
|
|
416
|
-
|
|
415
|
+
const At = /* @__PURE__ */ O("$ZodArray", (e, r) => {
|
|
416
|
+
L.init(e, r), e._zod.parse = (n, t) => {
|
|
417
417
|
const s = n.value;
|
|
418
418
|
if (!Array.isArray(s))
|
|
419
419
|
return n.issues.push({
|
|
@@ -429,12 +429,12 @@ const Dt = /* @__PURE__ */ S("$ZodArray", (e, r) => {
|
|
|
429
429
|
value: c,
|
|
430
430
|
issues: []
|
|
431
431
|
}, t);
|
|
432
|
-
l instanceof Promise ? o.push(l.then((d) =>
|
|
432
|
+
l instanceof Promise ? o.push(l.then((d) => qe(d, n, a))) : qe(l, n, a);
|
|
433
433
|
}
|
|
434
434
|
return o.length ? Promise.all(o).then(() => n) : n;
|
|
435
435
|
};
|
|
436
436
|
});
|
|
437
|
-
function
|
|
437
|
+
function Ge(e, r, n, t) {
|
|
438
438
|
for (const o of e)
|
|
439
439
|
if (o.issues.length === 0)
|
|
440
440
|
return r.value = o.value, r;
|
|
@@ -446,8 +446,8 @@ function qe(e, r, n, t) {
|
|
|
446
446
|
errors: e.map((o) => o.issues.map((a) => le(a, t, ce())))
|
|
447
447
|
}), r);
|
|
448
448
|
}
|
|
449
|
-
const
|
|
450
|
-
|
|
449
|
+
const It = /* @__PURE__ */ O("$ZodUnion", (e, r) => {
|
|
450
|
+
L.init(e, r), $(e._zod, "optin", () => r.options.some((s) => s._zod.optin === "optional") ? "optional" : void 0), $(e._zod, "optout", () => r.options.some((s) => s._zod.optout === "optional") ? "optional" : void 0), $(e._zod, "values", () => {
|
|
451
451
|
if (r.options.every((s) => s._zod.values))
|
|
452
452
|
return new Set(r.options.flatMap((s) => Array.from(s._zod.values)));
|
|
453
453
|
}), $(e._zod, "pattern", () => {
|
|
@@ -475,10 +475,10 @@ const At = /* @__PURE__ */ S("$ZodUnion", (e, r) => {
|
|
|
475
475
|
c.push(d);
|
|
476
476
|
}
|
|
477
477
|
}
|
|
478
|
-
return a ? Promise.all(c).then((l) =>
|
|
478
|
+
return a ? Promise.all(c).then((l) => Ge(l, s, e, o)) : Ge(c, s, e, o);
|
|
479
479
|
};
|
|
480
|
-
}),
|
|
481
|
-
|
|
480
|
+
}), Rt = /* @__PURE__ */ O("$ZodIntersection", (e, r) => {
|
|
481
|
+
L.init(e, r), e._zod.parse = (n, t) => {
|
|
482
482
|
const s = n.value, o = r.left._zod.run({ value: s, issues: [] }, t), a = r.right._zod.run({ value: s, issues: [] }, t);
|
|
483
483
|
return o instanceof Promise || a instanceof Promise ? Promise.all([o, a]).then(([l, d]) => Ye(n, l, d)) : Ye(n, o, a);
|
|
484
484
|
};
|
|
@@ -542,10 +542,10 @@ function Ye(e, r, n) {
|
|
|
542
542
|
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);
|
|
543
543
|
return e.value = a.data, e;
|
|
544
544
|
}
|
|
545
|
-
const
|
|
546
|
-
|
|
545
|
+
const Ft = /* @__PURE__ */ O("$ZodTransform", (e, r) => {
|
|
546
|
+
L.init(e, r), e._zod.parse = (n, t) => {
|
|
547
547
|
if (t.direction === "backward")
|
|
548
|
-
throw new
|
|
548
|
+
throw new Sr(e.constructor.name);
|
|
549
549
|
const s = r.transform(n.value, n);
|
|
550
550
|
if (t.async)
|
|
551
551
|
return (s instanceof Promise ? s : Promise.resolve(s)).then((a) => (n.value = a, n));
|
|
@@ -557,8 +557,8 @@ const Rt = /* @__PURE__ */ S("$ZodTransform", (e, r) => {
|
|
|
557
557
|
function Qe(e, r) {
|
|
558
558
|
return e.issues.length && r === void 0 ? { issues: [], value: void 0 } : e;
|
|
559
559
|
}
|
|
560
|
-
const
|
|
561
|
-
|
|
560
|
+
const Dr = /* @__PURE__ */ O("$ZodOptional", (e, r) => {
|
|
561
|
+
L.init(e, r), e._zod.optin = "optional", e._zod.optout = "optional", $(e._zod, "values", () => r.innerType._zod.values ? /* @__PURE__ */ new Set([...r.innerType._zod.values, void 0]) : void 0), $(e._zod, "pattern", () => {
|
|
562
562
|
const n = r.innerType._zod.pattern;
|
|
563
563
|
return n ? new RegExp(`^(${je(n.source)})?$`) : void 0;
|
|
564
564
|
}), e._zod.parse = (n, t) => {
|
|
@@ -568,15 +568,15 @@ const Pr = /* @__PURE__ */ S("$ZodOptional", (e, r) => {
|
|
|
568
568
|
}
|
|
569
569
|
return n.value === void 0 ? n : r.innerType._zod.run(n, t);
|
|
570
570
|
};
|
|
571
|
-
}),
|
|
572
|
-
|
|
573
|
-
}),
|
|
574
|
-
|
|
571
|
+
}), jt = /* @__PURE__ */ O("$ZodExactOptional", (e, r) => {
|
|
572
|
+
Dr.init(e, r), $(e._zod, "values", () => r.innerType._zod.values), $(e._zod, "pattern", () => r.innerType._zod.pattern), e._zod.parse = (n, t) => r.innerType._zod.run(n, t);
|
|
573
|
+
}), Zt = /* @__PURE__ */ O("$ZodNullable", (e, r) => {
|
|
574
|
+
L.init(e, r), $(e._zod, "optin", () => r.innerType._zod.optin), $(e._zod, "optout", () => r.innerType._zod.optout), $(e._zod, "pattern", () => {
|
|
575
575
|
const n = r.innerType._zod.pattern;
|
|
576
576
|
return n ? new RegExp(`^(${je(n.source)}|null)$`) : void 0;
|
|
577
577
|
}), $(e._zod, "values", () => r.innerType._zod.values ? /* @__PURE__ */ new Set([...r.innerType._zod.values, null]) : void 0), e._zod.parse = (n, t) => n.value === null ? n : r.innerType._zod.run(n, t);
|
|
578
|
-
}),
|
|
579
|
-
|
|
578
|
+
}), Lt = /* @__PURE__ */ O("$ZodDefault", (e, r) => {
|
|
579
|
+
L.init(e, r), e._zod.optin = "optional", $(e._zod, "values", () => r.innerType._zod.values), e._zod.parse = (n, t) => {
|
|
580
580
|
if (t.direction === "backward")
|
|
581
581
|
return r.innerType._zod.run(n, t);
|
|
582
582
|
if (n.value === void 0)
|
|
@@ -588,10 +588,10 @@ const Pr = /* @__PURE__ */ S("$ZodOptional", (e, r) => {
|
|
|
588
588
|
function er(e, r) {
|
|
589
589
|
return e.value === void 0 && (e.value = r.defaultValue), e;
|
|
590
590
|
}
|
|
591
|
-
const
|
|
592
|
-
|
|
593
|
-
}),
|
|
594
|
-
|
|
591
|
+
const Mt = /* @__PURE__ */ O("$ZodPrefault", (e, r) => {
|
|
592
|
+
L.init(e, r), e._zod.optin = "optional", $(e._zod, "values", () => r.innerType._zod.values), e._zod.parse = (n, t) => (t.direction === "backward" || n.value === void 0 && (n.value = r.defaultValue), r.innerType._zod.run(n, t));
|
|
593
|
+
}), Vt = /* @__PURE__ */ O("$ZodNonOptional", (e, r) => {
|
|
594
|
+
L.init(e, r), $(e._zod, "values", () => {
|
|
595
595
|
const n = r.innerType._zod.values;
|
|
596
596
|
return n ? new Set([...n].filter((t) => t !== void 0)) : void 0;
|
|
597
597
|
}), e._zod.parse = (n, t) => {
|
|
@@ -607,8 +607,8 @@ function rr(e, r) {
|
|
|
607
607
|
inst: r
|
|
608
608
|
}), e;
|
|
609
609
|
}
|
|
610
|
-
const
|
|
611
|
-
|
|
610
|
+
const Jt = /* @__PURE__ */ O("$ZodCatch", (e, r) => {
|
|
611
|
+
L.init(e, r), $(e._zod, "optin", () => r.innerType._zod.optin), $(e._zod, "optout", () => r.innerType._zod.optout), $(e._zod, "values", () => r.innerType._zod.values), e._zod.parse = (n, t) => {
|
|
612
612
|
if (t.direction === "backward")
|
|
613
613
|
return r.innerType._zod.run(n, t);
|
|
614
614
|
const s = r.innerType._zod.run(n, t);
|
|
@@ -626,8 +626,8 @@ const Vt = /* @__PURE__ */ S("$ZodCatch", (e, r) => {
|
|
|
626
626
|
input: n.value
|
|
627
627
|
}), n.issues = []), n);
|
|
628
628
|
};
|
|
629
|
-
}),
|
|
630
|
-
|
|
629
|
+
}), Bt = /* @__PURE__ */ O("$ZodPipe", (e, r) => {
|
|
630
|
+
L.init(e, r), $(e._zod, "values", () => r.in._zod.values), $(e._zod, "optin", () => r.in._zod.optin), $(e._zod, "optout", () => r.out._zod.optout), $(e._zod, "propValues", () => r.in._zod.propValues), e._zod.parse = (n, t) => {
|
|
631
631
|
if (t.direction === "backward") {
|
|
632
632
|
const o = r.out._zod.run(n, t);
|
|
633
633
|
return o instanceof Promise ? o.then((a) => we(a, r.in, t)) : we(o, r.in, t);
|
|
@@ -639,8 +639,8 @@ const Vt = /* @__PURE__ */ S("$ZodCatch", (e, r) => {
|
|
|
639
639
|
function we(e, r, n) {
|
|
640
640
|
return e.issues.length ? (e.aborted = !0, e) : r._zod.run({ value: e.value, issues: e.issues }, n);
|
|
641
641
|
}
|
|
642
|
-
const
|
|
643
|
-
|
|
642
|
+
const Ut = /* @__PURE__ */ O("$ZodReadonly", (e, r) => {
|
|
643
|
+
L.init(e, r), $(e._zod, "propValues", () => r.innerType._zod.propValues), $(e._zod, "values", () => r.innerType._zod.values), $(e._zod, "optin", () => {
|
|
644
644
|
var n, t;
|
|
645
645
|
return (t = (n = r.innerType) == null ? void 0 : n._zod) == null ? void 0 : t.optin;
|
|
646
646
|
}), $(e._zod, "optout", () => {
|
|
@@ -656,8 +656,8 @@ const Bt = /* @__PURE__ */ S("$ZodReadonly", (e, r) => {
|
|
|
656
656
|
function tr(e) {
|
|
657
657
|
return e.value = Object.freeze(e.value), e;
|
|
658
658
|
}
|
|
659
|
-
const
|
|
660
|
-
pe.init(e, r),
|
|
659
|
+
const Xt = /* @__PURE__ */ O("$ZodCustom", (e, r) => {
|
|
660
|
+
pe.init(e, r), L.init(e, r), e._zod.parse = (n, t) => n, e._zod.check = (n) => {
|
|
661
661
|
const t = n.value, s = r.fn(t);
|
|
662
662
|
if (s instanceof Promise)
|
|
663
663
|
return s.then((o) => nr(o, n, t, e));
|
|
@@ -680,7 +680,7 @@ function nr(e, r, n, t) {
|
|
|
680
680
|
}
|
|
681
681
|
}
|
|
682
682
|
var sr;
|
|
683
|
-
class
|
|
683
|
+
class Ht {
|
|
684
684
|
constructor() {
|
|
685
685
|
this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
|
|
686
686
|
}
|
|
@@ -709,20 +709,20 @@ class Xt {
|
|
|
709
709
|
return this._map.has(r);
|
|
710
710
|
}
|
|
711
711
|
}
|
|
712
|
-
function
|
|
713
|
-
return new
|
|
712
|
+
function Kt() {
|
|
713
|
+
return new Ht();
|
|
714
714
|
}
|
|
715
|
-
(sr = globalThis).__zod_globalRegistry ?? (sr.__zod_globalRegistry =
|
|
715
|
+
(sr = globalThis).__zod_globalRegistry ?? (sr.__zod_globalRegistry = Kt());
|
|
716
716
|
const he = globalThis.__zod_globalRegistry;
|
|
717
717
|
// @__NO_SIDE_EFFECTS__
|
|
718
|
-
function
|
|
718
|
+
function Wt(e) {
|
|
719
719
|
return new e({
|
|
720
720
|
type: "unknown"
|
|
721
721
|
});
|
|
722
722
|
}
|
|
723
723
|
// @__NO_SIDE_EFFECTS__
|
|
724
|
-
function
|
|
725
|
-
return new
|
|
724
|
+
function qt(e, r) {
|
|
725
|
+
return new Ot({
|
|
726
726
|
check: "max_length",
|
|
727
727
|
...ae(r),
|
|
728
728
|
maximum: e
|
|
@@ -730,7 +730,7 @@ function Wt(e, r) {
|
|
|
730
730
|
}
|
|
731
731
|
// @__NO_SIDE_EFFECTS__
|
|
732
732
|
function or(e, r) {
|
|
733
|
-
return new
|
|
733
|
+
return new Tt({
|
|
734
734
|
check: "min_length",
|
|
735
735
|
...ae(r),
|
|
736
736
|
minimum: e
|
|
@@ -738,21 +738,21 @@ function or(e, r) {
|
|
|
738
738
|
}
|
|
739
739
|
// @__NO_SIDE_EFFECTS__
|
|
740
740
|
function Gt(e, r) {
|
|
741
|
-
return new
|
|
741
|
+
return new $t({
|
|
742
742
|
check: "length_equals",
|
|
743
743
|
...ae(r),
|
|
744
744
|
length: e
|
|
745
745
|
});
|
|
746
746
|
}
|
|
747
747
|
// @__NO_SIDE_EFFECTS__
|
|
748
|
-
function
|
|
749
|
-
return new
|
|
748
|
+
function Yt(e) {
|
|
749
|
+
return new kt({
|
|
750
750
|
check: "overwrite",
|
|
751
751
|
tx: e
|
|
752
752
|
});
|
|
753
753
|
}
|
|
754
754
|
// @__NO_SIDE_EFFECTS__
|
|
755
|
-
function
|
|
755
|
+
function Qt(e, r, n) {
|
|
756
756
|
return new e({
|
|
757
757
|
type: "array",
|
|
758
758
|
element: r,
|
|
@@ -763,7 +763,7 @@ function Yt(e, r, n) {
|
|
|
763
763
|
});
|
|
764
764
|
}
|
|
765
765
|
// @__NO_SIDE_EFFECTS__
|
|
766
|
-
function
|
|
766
|
+
function en(e, r, n) {
|
|
767
767
|
return new e({
|
|
768
768
|
type: "custom",
|
|
769
769
|
check: "custom",
|
|
@@ -772,8 +772,8 @@ function Qt(e, r, n) {
|
|
|
772
772
|
});
|
|
773
773
|
}
|
|
774
774
|
// @__NO_SIDE_EFFECTS__
|
|
775
|
-
function
|
|
776
|
-
const r = /* @__PURE__ */
|
|
775
|
+
function rn(e) {
|
|
776
|
+
const r = /* @__PURE__ */ tn((n) => (n.addIssue = (t) => {
|
|
777
777
|
if (typeof t == "string")
|
|
778
778
|
n.issues.push(ge(t, n.value, r._zod.def));
|
|
779
779
|
else {
|
|
@@ -784,14 +784,14 @@ function en(e) {
|
|
|
784
784
|
return r;
|
|
785
785
|
}
|
|
786
786
|
// @__NO_SIDE_EFFECTS__
|
|
787
|
-
function
|
|
787
|
+
function tn(e, r) {
|
|
788
788
|
const n = new pe({
|
|
789
789
|
check: "custom",
|
|
790
790
|
...ae(r)
|
|
791
791
|
});
|
|
792
792
|
return n._zod.check = e, n;
|
|
793
793
|
}
|
|
794
|
-
function
|
|
794
|
+
function Ar(e) {
|
|
795
795
|
let r = (e == null ? void 0 : e.target) ?? "draft-2020-12";
|
|
796
796
|
return r === "draft-4" && (r = "draft-04"), r === "draft-7" && (r = "draft-07"), {
|
|
797
797
|
processors: e.processors ?? {},
|
|
@@ -808,7 +808,7 @@ function Dr(e) {
|
|
|
808
808
|
external: (e == null ? void 0 : e.external) ?? void 0
|
|
809
809
|
};
|
|
810
810
|
}
|
|
811
|
-
function
|
|
811
|
+
function Z(e, r, n = { path: [], schemaPath: [] }) {
|
|
812
812
|
var f, u;
|
|
813
813
|
var t;
|
|
814
814
|
const s = e._zod.def, o = r.seen.get(e);
|
|
@@ -820,26 +820,26 @@ function j(e, r, n = { path: [], schemaPath: [] }) {
|
|
|
820
820
|
if (c)
|
|
821
821
|
a.schema = c;
|
|
822
822
|
else {
|
|
823
|
-
const
|
|
823
|
+
const v = {
|
|
824
824
|
...n,
|
|
825
825
|
schemaPath: [...n.schemaPath, e],
|
|
826
826
|
path: n.path
|
|
827
827
|
};
|
|
828
828
|
if (e._zod.processJSONSchema)
|
|
829
|
-
e._zod.processJSONSchema(r, a.schema,
|
|
829
|
+
e._zod.processJSONSchema(r, a.schema, v);
|
|
830
830
|
else {
|
|
831
831
|
const N = a.schema, b = r.processors[s.type];
|
|
832
832
|
if (!b)
|
|
833
833
|
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);
|
|
834
|
-
b(e, r, N,
|
|
834
|
+
b(e, r, N, v);
|
|
835
835
|
}
|
|
836
|
-
const
|
|
837
|
-
|
|
836
|
+
const y = e._zod.parent;
|
|
837
|
+
y && (a.ref || (a.ref = y), Z(y, r, v), r.seen.get(y).isParent = !0);
|
|
838
838
|
}
|
|
839
839
|
const l = r.metadataRegistry.get(e);
|
|
840
|
-
return l && Object.assign(a.schema, l), r.io === "input" &&
|
|
840
|
+
return l && Object.assign(a.schema, l), r.io === "input" && F(e) && (delete a.schema.examples, delete a.schema.default), r.io === "input" && a.schema._prefault && ((t = a.schema).default ?? (t.default = a.schema._prefault)), delete a.schema._prefault, r.seen.get(e).schema;
|
|
841
841
|
}
|
|
842
|
-
function
|
|
842
|
+
function Ir(e, r) {
|
|
843
843
|
var a, c, l, d;
|
|
844
844
|
const n = e.seen.get(r);
|
|
845
845
|
if (!n)
|
|
@@ -848,8 +848,8 @@ function Ar(e, r) {
|
|
|
848
848
|
for (const f of e.seen.entries()) {
|
|
849
849
|
const u = (a = e.metadataRegistry.get(f[0])) == null ? void 0 : a.id;
|
|
850
850
|
if (u) {
|
|
851
|
-
const
|
|
852
|
-
if (
|
|
851
|
+
const v = t.get(u);
|
|
852
|
+
if (v && v !== f[0])
|
|
853
853
|
throw new Error(`Duplicate schema id "${u}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
854
854
|
t.set(u, f[0]);
|
|
855
855
|
}
|
|
@@ -858,25 +858,25 @@ function Ar(e, r) {
|
|
|
858
858
|
var b;
|
|
859
859
|
const u = e.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
860
860
|
if (e.external) {
|
|
861
|
-
const
|
|
862
|
-
if (
|
|
863
|
-
return { ref:
|
|
861
|
+
const w = (b = e.external.registry.get(f[0])) == null ? void 0 : b.id, E = e.external.uri ?? ((p) => p);
|
|
862
|
+
if (w)
|
|
863
|
+
return { ref: E(w) };
|
|
864
864
|
const g = f[1].defId ?? f[1].schema.id ?? `schema${e.counter++}`;
|
|
865
|
-
return f[1].defId = g, { defId: g, ref: `${
|
|
865
|
+
return f[1].defId = g, { defId: g, ref: `${E("__shared")}#/${u}/${g}` };
|
|
866
866
|
}
|
|
867
867
|
if (f[1] === n)
|
|
868
868
|
return { ref: "#" };
|
|
869
|
-
const
|
|
870
|
-
return { defId: N, ref:
|
|
869
|
+
const y = `#/${u}/`, N = f[1].schema.id ?? `__schema${e.counter++}`;
|
|
870
|
+
return { defId: N, ref: y + N };
|
|
871
871
|
}, o = (f) => {
|
|
872
872
|
if (f[1].schema.$ref)
|
|
873
873
|
return;
|
|
874
|
-
const u = f[1], { ref:
|
|
875
|
-
u.def = { ...u.schema },
|
|
874
|
+
const u = f[1], { ref: v, defId: y } = s(f);
|
|
875
|
+
u.def = { ...u.schema }, y && (u.defId = y);
|
|
876
876
|
const N = u.schema;
|
|
877
877
|
for (const b in N)
|
|
878
878
|
delete N[b];
|
|
879
|
-
N.$ref =
|
|
879
|
+
N.$ref = v;
|
|
880
880
|
};
|
|
881
881
|
if (e.cycles === "throw")
|
|
882
882
|
for (const f of e.seen.entries()) {
|
|
@@ -893,8 +893,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
893
893
|
continue;
|
|
894
894
|
}
|
|
895
895
|
if (e.external) {
|
|
896
|
-
const
|
|
897
|
-
if (r !== f[0] &&
|
|
896
|
+
const y = (l = e.external.registry.get(f[0])) == null ? void 0 : l.id;
|
|
897
|
+
if (r !== f[0] && y) {
|
|
898
898
|
o(f);
|
|
899
899
|
continue;
|
|
900
900
|
}
|
|
@@ -913,7 +913,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
913
913
|
}
|
|
914
914
|
}
|
|
915
915
|
}
|
|
916
|
-
function
|
|
916
|
+
function Rr(e, r) {
|
|
917
917
|
var a, c, l;
|
|
918
918
|
const n = e.seen.get(r);
|
|
919
919
|
if (!n)
|
|
@@ -922,24 +922,24 @@ function Ir(e, r) {
|
|
|
922
922
|
const f = e.seen.get(d);
|
|
923
923
|
if (f.ref === null)
|
|
924
924
|
return;
|
|
925
|
-
const u = f.def ?? f.schema,
|
|
926
|
-
if (f.ref = null,
|
|
927
|
-
t(
|
|
928
|
-
const b = e.seen.get(
|
|
929
|
-
if (
|
|
925
|
+
const u = f.def ?? f.schema, v = { ...u }, y = f.ref;
|
|
926
|
+
if (f.ref = null, y) {
|
|
927
|
+
t(y);
|
|
928
|
+
const b = e.seen.get(y), w = b.schema;
|
|
929
|
+
if (w.$ref && (e.target === "draft-07" || e.target === "draft-04" || e.target === "openapi-3.0") ? (u.allOf = u.allOf ?? [], u.allOf.push(w)) : Object.assign(u, w), Object.assign(u, v), d._zod.parent === y)
|
|
930
930
|
for (const g in u)
|
|
931
|
-
g === "$ref" || g === "allOf" || g in
|
|
932
|
-
if (
|
|
931
|
+
g === "$ref" || g === "allOf" || g in v || delete u[g];
|
|
932
|
+
if (w.$ref && b.def)
|
|
933
933
|
for (const g in u)
|
|
934
934
|
g === "$ref" || g === "allOf" || g in b.def && JSON.stringify(u[g]) === JSON.stringify(b.def[g]) && delete u[g];
|
|
935
935
|
}
|
|
936
936
|
const N = d._zod.parent;
|
|
937
|
-
if (N && N !==
|
|
937
|
+
if (N && N !== y) {
|
|
938
938
|
t(N);
|
|
939
939
|
const b = e.seen.get(N);
|
|
940
940
|
if (b != null && b.schema.$ref && (u.$ref = b.schema.$ref, b.def))
|
|
941
|
-
for (const
|
|
942
|
-
|
|
941
|
+
for (const w in u)
|
|
942
|
+
w === "$ref" || w === "allOf" || w in b.def && JSON.stringify(u[w]) === JSON.stringify(b.def[w]) && delete u[w];
|
|
943
943
|
}
|
|
944
944
|
e.override({
|
|
945
945
|
zodSchema: d,
|
|
@@ -980,7 +980,7 @@ function Ir(e, r) {
|
|
|
980
980
|
throw new Error("Error converting schema to JSON.");
|
|
981
981
|
}
|
|
982
982
|
}
|
|
983
|
-
function
|
|
983
|
+
function F(e, r) {
|
|
984
984
|
const n = r ?? { seen: /* @__PURE__ */ new Set() };
|
|
985
985
|
if (n.seen.has(e))
|
|
986
986
|
return !1;
|
|
@@ -989,66 +989,66 @@ function I(e, r) {
|
|
|
989
989
|
if (t.type === "transform")
|
|
990
990
|
return !0;
|
|
991
991
|
if (t.type === "array")
|
|
992
|
-
return
|
|
992
|
+
return F(t.element, n);
|
|
993
993
|
if (t.type === "set")
|
|
994
|
-
return
|
|
994
|
+
return F(t.valueType, n);
|
|
995
995
|
if (t.type === "lazy")
|
|
996
|
-
return
|
|
996
|
+
return F(t.getter(), n);
|
|
997
997
|
if (t.type === "promise" || t.type === "optional" || t.type === "nonoptional" || t.type === "nullable" || t.type === "readonly" || t.type === "default" || t.type === "prefault")
|
|
998
|
-
return
|
|
998
|
+
return F(t.innerType, n);
|
|
999
999
|
if (t.type === "intersection")
|
|
1000
|
-
return
|
|
1000
|
+
return F(t.left, n) || F(t.right, n);
|
|
1001
1001
|
if (t.type === "record" || t.type === "map")
|
|
1002
|
-
return
|
|
1002
|
+
return F(t.keyType, n) || F(t.valueType, n);
|
|
1003
1003
|
if (t.type === "pipe")
|
|
1004
|
-
return
|
|
1004
|
+
return F(t.in, n) || F(t.out, n);
|
|
1005
1005
|
if (t.type === "object") {
|
|
1006
1006
|
for (const s in t.shape)
|
|
1007
|
-
if (
|
|
1007
|
+
if (F(t.shape[s], n))
|
|
1008
1008
|
return !0;
|
|
1009
1009
|
return !1;
|
|
1010
1010
|
}
|
|
1011
1011
|
if (t.type === "union") {
|
|
1012
1012
|
for (const s of t.options)
|
|
1013
|
-
if (
|
|
1013
|
+
if (F(s, n))
|
|
1014
1014
|
return !0;
|
|
1015
1015
|
return !1;
|
|
1016
1016
|
}
|
|
1017
1017
|
if (t.type === "tuple") {
|
|
1018
1018
|
for (const s of t.items)
|
|
1019
|
-
if (
|
|
1019
|
+
if (F(s, n))
|
|
1020
1020
|
return !0;
|
|
1021
|
-
return !!(t.rest &&
|
|
1021
|
+
return !!(t.rest && F(t.rest, n));
|
|
1022
1022
|
}
|
|
1023
1023
|
return !1;
|
|
1024
1024
|
}
|
|
1025
|
-
const
|
|
1026
|
-
const t =
|
|
1027
|
-
return
|
|
1025
|
+
const nn = (e, r = {}) => (n) => {
|
|
1026
|
+
const t = Ar({ ...n, processors: r });
|
|
1027
|
+
return Z(e, t), Ir(t, e), Rr(t, e);
|
|
1028
1028
|
}, Oe = (e, r, n = {}) => (t) => {
|
|
1029
|
-
const { libraryOptions: s, target: o } = t ?? {}, a =
|
|
1030
|
-
return
|
|
1031
|
-
}, nn = (e, r, n, t) => {
|
|
1029
|
+
const { libraryOptions: s, target: o } = t ?? {}, a = Ar({ ...s ?? {}, target: o, io: r, processors: n });
|
|
1030
|
+
return Z(e, a), Ir(a, e), Rr(a, e);
|
|
1032
1031
|
}, sn = (e, r, n, t) => {
|
|
1032
|
+
}, on = (e, r, n, t) => {
|
|
1033
1033
|
if (r.unrepresentable === "throw")
|
|
1034
1034
|
throw new Error("Custom types cannot be represented in JSON Schema");
|
|
1035
|
-
},
|
|
1035
|
+
}, an = (e, r, n, t) => {
|
|
1036
1036
|
if (r.unrepresentable === "throw")
|
|
1037
1037
|
throw new Error("Transforms cannot be represented in JSON Schema");
|
|
1038
|
-
}, an = (e, r, n, t) => {
|
|
1039
|
-
const s = n, o = e._zod.def, { minimum: a, maximum: c } = e._zod.bag;
|
|
1040
|
-
typeof a == "number" && (s.minItems = a), typeof c == "number" && (s.maxItems = c), s.type = "array", s.items = j(o.element, r, { ...t, path: [...t.path, "items"] });
|
|
1041
1038
|
}, cn = (e, r, n, t) => {
|
|
1042
|
-
const s = e._zod.def,
|
|
1039
|
+
const s = n, o = e._zod.def, { minimum: a, maximum: c } = e._zod.bag;
|
|
1040
|
+
typeof a == "number" && (s.minItems = a), typeof c == "number" && (s.maxItems = c), s.type = "array", s.items = Z(o.element, r, { ...t, path: [...t.path, "items"] });
|
|
1041
|
+
}, ln = (e, r, n, t) => {
|
|
1042
|
+
const s = e._zod.def, o = s.inclusive === !1, a = s.options.map((c, l) => Z(c, r, {
|
|
1043
1043
|
...t,
|
|
1044
1044
|
path: [...t.path, o ? "oneOf" : "anyOf", l]
|
|
1045
1045
|
}));
|
|
1046
1046
|
o ? n.oneOf = a : n.anyOf = a;
|
|
1047
|
-
},
|
|
1048
|
-
const s = e._zod.def, o =
|
|
1047
|
+
}, dn = (e, r, n, t) => {
|
|
1048
|
+
const s = e._zod.def, o = Z(s.left, r, {
|
|
1049
1049
|
...t,
|
|
1050
1050
|
path: [...t.path, "allOf", 0]
|
|
1051
|
-
}), a =
|
|
1051
|
+
}), a = Z(s.right, r, {
|
|
1052
1052
|
...t,
|
|
1053
1053
|
path: [...t.path, "allOf", 1]
|
|
1054
1054
|
}), c = (d) => "allOf" in d && Object.keys(d).length === 1, l = [
|
|
@@ -1056,27 +1056,27 @@ const tn = (e, r = {}) => (n) => {
|
|
|
1056
1056
|
...c(a) ? a.allOf : [a]
|
|
1057
1057
|
];
|
|
1058
1058
|
n.allOf = l;
|
|
1059
|
-
}, dn = (e, r, n, t) => {
|
|
1060
|
-
const s = e._zod.def, o = j(s.innerType, r, t), a = r.seen.get(e);
|
|
1061
|
-
r.target === "openapi-3.0" ? (a.ref = s.innerType, n.nullable = !0) : n.anyOf = [o, { type: "null" }];
|
|
1062
1059
|
}, un = (e, r, n, t) => {
|
|
1060
|
+
const s = e._zod.def, o = Z(s.innerType, r, t), a = r.seen.get(e);
|
|
1061
|
+
r.target === "openapi-3.0" ? (a.ref = s.innerType, n.nullable = !0) : n.anyOf = [o, { type: "null" }];
|
|
1062
|
+
}, fn = (e, r, n, t) => {
|
|
1063
1063
|
const s = e._zod.def;
|
|
1064
|
-
|
|
1064
|
+
Z(s.innerType, r, t);
|
|
1065
1065
|
const o = r.seen.get(e);
|
|
1066
1066
|
o.ref = s.innerType;
|
|
1067
|
-
},
|
|
1067
|
+
}, mn = (e, r, n, t) => {
|
|
1068
1068
|
const s = e._zod.def;
|
|
1069
|
-
|
|
1069
|
+
Z(s.innerType, r, t);
|
|
1070
1070
|
const o = r.seen.get(e);
|
|
1071
1071
|
o.ref = s.innerType, n.default = JSON.parse(JSON.stringify(s.defaultValue));
|
|
1072
|
-
},
|
|
1072
|
+
}, pn = (e, r, n, t) => {
|
|
1073
1073
|
const s = e._zod.def;
|
|
1074
|
-
|
|
1074
|
+
Z(s.innerType, r, t);
|
|
1075
1075
|
const o = r.seen.get(e);
|
|
1076
1076
|
o.ref = s.innerType, r.io === "input" && (n._prefault = JSON.parse(JSON.stringify(s.defaultValue)));
|
|
1077
|
-
},
|
|
1077
|
+
}, hn = (e, r, n, t) => {
|
|
1078
1078
|
const s = e._zod.def;
|
|
1079
|
-
|
|
1079
|
+
Z(s.innerType, r, t);
|
|
1080
1080
|
const o = r.seen.get(e);
|
|
1081
1081
|
o.ref = s.innerType;
|
|
1082
1082
|
let a;
|
|
@@ -1086,29 +1086,29 @@ const tn = (e, r = {}) => (n) => {
|
|
|
1086
1086
|
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
1087
1087
|
}
|
|
1088
1088
|
n.default = a;
|
|
1089
|
-
},
|
|
1089
|
+
}, gn = (e, r, n, t) => {
|
|
1090
1090
|
const s = e._zod.def, o = r.io === "input" ? s.in._zod.def.type === "transform" ? s.out : s.in : s.out;
|
|
1091
|
-
|
|
1091
|
+
Z(o, r, t);
|
|
1092
1092
|
const a = r.seen.get(e);
|
|
1093
1093
|
a.ref = o;
|
|
1094
|
-
},
|
|
1094
|
+
}, vn = (e, r, n, t) => {
|
|
1095
1095
|
const s = e._zod.def;
|
|
1096
|
-
|
|
1096
|
+
Z(s.innerType, r, t);
|
|
1097
1097
|
const o = r.seen.get(e);
|
|
1098
1098
|
o.ref = s.innerType, n.readOnly = !0;
|
|
1099
|
-
},
|
|
1099
|
+
}, Fr = (e, r, n, t) => {
|
|
1100
1100
|
const s = e._zod.def;
|
|
1101
|
-
|
|
1101
|
+
Z(s.innerType, r, t);
|
|
1102
1102
|
const o = r.seen.get(e);
|
|
1103
1103
|
o.ref = s.innerType;
|
|
1104
1104
|
}, yn = (e, r) => {
|
|
1105
|
-
|
|
1105
|
+
kr.init(e, r), e.name = "ZodError", Object.defineProperties(e, {
|
|
1106
1106
|
format: {
|
|
1107
|
-
value: (n) =>
|
|
1107
|
+
value: (n) => vt(e, n)
|
|
1108
1108
|
// enumerable: false,
|
|
1109
1109
|
},
|
|
1110
1110
|
flatten: {
|
|
1111
|
-
value: (n) =>
|
|
1111
|
+
value: (n) => gt(e, n)
|
|
1112
1112
|
// enumerable: false,
|
|
1113
1113
|
},
|
|
1114
1114
|
addIssue: {
|
|
@@ -1130,21 +1130,21 @@ const tn = (e, r = {}) => (n) => {
|
|
|
1130
1130
|
// enumerable: false,
|
|
1131
1131
|
}
|
|
1132
1132
|
});
|
|
1133
|
-
},
|
|
1133
|
+
}, K = O("ZodError", yn, {
|
|
1134
1134
|
Parent: Error
|
|
1135
|
-
}),
|
|
1135
|
+
}), bn = /* @__PURE__ */ Le(K), Nn = /* @__PURE__ */ Me(K), _n = /* @__PURE__ */ $e(K), xn = /* @__PURE__ */ ke(K), wn = /* @__PURE__ */ Nt(K), Cn = /* @__PURE__ */ _t(K), zn = /* @__PURE__ */ xt(K), En = /* @__PURE__ */ wt(K), Sn = /* @__PURE__ */ Ct(K), On = /* @__PURE__ */ zt(K), Tn = /* @__PURE__ */ Et(K), $n = /* @__PURE__ */ St(K), M = /* @__PURE__ */ O("ZodType", (e, r) => (L.init(e, r), Object.assign(e["~standard"], {
|
|
1136
1136
|
jsonSchema: {
|
|
1137
1137
|
input: Oe(e, "input"),
|
|
1138
1138
|
output: Oe(e, "output")
|
|
1139
1139
|
}
|
|
1140
|
-
}), e.toJSONSchema =
|
|
1140
|
+
}), e.toJSONSchema = nn(e, {}), e.def = r, e.type = r.type, Object.defineProperty(e, "_def", { value: r }), e.check = (...n) => e.clone(mt(r, {
|
|
1141
1141
|
checks: [
|
|
1142
1142
|
...r.checks ?? [],
|
|
1143
1143
|
...n.map((t) => typeof t == "function" ? { _zod: { check: t, def: { check: "custom" }, onattach: [] } } : t)
|
|
1144
1144
|
]
|
|
1145
1145
|
}), {
|
|
1146
1146
|
parent: !0
|
|
1147
|
-
}), e.with = e.check, e.clone = (n, t) =>
|
|
1147
|
+
}), e.with = e.check, e.clone = (n, t) => pt(e, n, t), e.brand = () => e, e.register = (n, t) => (n.add(e, t), e), e.parse = (n, t) => bn(e, n, t, { callee: e.parse }), e.safeParse = (n, t) => _n(e, n, t), e.parseAsync = async (n, t) => Nn(e, n, t, { callee: e.parseAsync }), e.safeParseAsync = async (n, t) => xn(e, n, t), e.spa = e.safeParseAsync, e.encode = (n, t) => wn(e, n, t), e.decode = (n, t) => Cn(e, n, t), e.encodeAsync = async (n, t) => zn(e, n, t), e.decodeAsync = async (n, t) => En(e, n, t), e.safeEncode = (n, t) => Sn(e, n, t), e.safeDecode = (n, t) => On(e, n, t), e.safeEncodeAsync = async (n, t) => Tn(e, n, t), e.safeDecodeAsync = async (n, t) => $n(e, n, t), e.refine = (n, t) => e.check(ns(n, t)), e.superRefine = (n) => e.check(ss(n)), e.overwrite = (n) => e.check(/* @__PURE__ */ Yt(n)), e.optional = () => ar(e), e.exactOptional = () => Jn(e), e.nullable = () => ir(e), e.nullish = () => ar(ir(e)), e.nonoptional = (n) => qn(e, n), e.array = () => An(e), e.or = (n) => Rn([e, n]), e.and = (n) => jn(e, n), e.transform = (n) => cr(e, Ln(n)), e.default = (n) => Xn(e, n), e.prefault = (n) => Kn(e, n), e.catch = (n) => Yn(e, n), e.pipe = (n) => cr(e, n), e.readonly = () => rs(e), e.describe = (n) => {
|
|
1148
1148
|
const t = e.clone();
|
|
1149
1149
|
return he.add(t, { description: n }), t;
|
|
1150
1150
|
}, Object.defineProperty(e, "description", {
|
|
@@ -1158,42 +1158,42 @@ const tn = (e, r = {}) => (n) => {
|
|
|
1158
1158
|
return he.get(e);
|
|
1159
1159
|
const t = e.clone();
|
|
1160
1160
|
return he.add(t, n[0]), t;
|
|
1161
|
-
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e.apply = (n) => n(e), e)),
|
|
1162
|
-
|
|
1161
|
+
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e.apply = (n) => n(e), e)), kn = /* @__PURE__ */ O("ZodUnknown", (e, r) => {
|
|
1162
|
+
Dt.init(e, r), M.init(e, r), e._zod.processJSONSchema = (n, t, s) => sn();
|
|
1163
1163
|
});
|
|
1164
|
-
function
|
|
1165
|
-
return /* @__PURE__ */
|
|
1164
|
+
function Pn() {
|
|
1165
|
+
return /* @__PURE__ */ Wt(kn);
|
|
1166
1166
|
}
|
|
1167
|
-
const
|
|
1168
|
-
|
|
1167
|
+
const Dn = /* @__PURE__ */ O("ZodArray", (e, r) => {
|
|
1168
|
+
At.init(e, r), M.init(e, r), e._zod.processJSONSchema = (n, t, s) => cn(e, n, t, s), e.element = r.element, e.min = (n, t) => e.check(/* @__PURE__ */ or(n, t)), e.nonempty = (n) => e.check(/* @__PURE__ */ or(1, n)), e.max = (n, t) => e.check(/* @__PURE__ */ qt(n, t)), e.length = (n, t) => e.check(/* @__PURE__ */ Gt(n, t)), e.unwrap = () => e.element;
|
|
1169
1169
|
});
|
|
1170
|
-
function
|
|
1171
|
-
return /* @__PURE__ */
|
|
1170
|
+
function An(e, r) {
|
|
1171
|
+
return /* @__PURE__ */ Qt(Dn, e, r);
|
|
1172
1172
|
}
|
|
1173
|
-
const
|
|
1174
|
-
|
|
1173
|
+
const In = /* @__PURE__ */ O("ZodUnion", (e, r) => {
|
|
1174
|
+
It.init(e, r), M.init(e, r), e._zod.processJSONSchema = (n, t, s) => ln(e, n, t, s), e.options = r.options;
|
|
1175
1175
|
});
|
|
1176
|
-
function
|
|
1177
|
-
return new
|
|
1176
|
+
function Rn(e, r) {
|
|
1177
|
+
return new In({
|
|
1178
1178
|
type: "union",
|
|
1179
1179
|
options: e,
|
|
1180
1180
|
...ae(r)
|
|
1181
1181
|
});
|
|
1182
1182
|
}
|
|
1183
|
-
const
|
|
1184
|
-
|
|
1183
|
+
const Fn = /* @__PURE__ */ O("ZodIntersection", (e, r) => {
|
|
1184
|
+
Rt.init(e, r), M.init(e, r), e._zod.processJSONSchema = (n, t, s) => dn(e, n, t, s);
|
|
1185
1185
|
});
|
|
1186
|
-
function
|
|
1187
|
-
return new
|
|
1186
|
+
function jn(e, r) {
|
|
1187
|
+
return new Fn({
|
|
1188
1188
|
type: "intersection",
|
|
1189
1189
|
left: e,
|
|
1190
1190
|
right: r
|
|
1191
1191
|
});
|
|
1192
1192
|
}
|
|
1193
|
-
const
|
|
1194
|
-
|
|
1193
|
+
const Zn = /* @__PURE__ */ O("ZodTransform", (e, r) => {
|
|
1194
|
+
Ft.init(e, r), M.init(e, r), e._zod.processJSONSchema = (n, t, s) => an(e, n), e._zod.parse = (n, t) => {
|
|
1195
1195
|
if (t.direction === "backward")
|
|
1196
|
-
throw new
|
|
1196
|
+
throw new Sr(e.constructor.name);
|
|
1197
1197
|
n.addIssue = (o) => {
|
|
1198
1198
|
if (typeof o == "string")
|
|
1199
1199
|
n.issues.push(ge(o, n.value, r));
|
|
@@ -1206,113 +1206,113 @@ const jn = /* @__PURE__ */ S("ZodTransform", (e, r) => {
|
|
|
1206
1206
|
return s instanceof Promise ? s.then((o) => (n.value = o, n)) : (n.value = s, n);
|
|
1207
1207
|
};
|
|
1208
1208
|
});
|
|
1209
|
-
function
|
|
1210
|
-
return new
|
|
1209
|
+
function Ln(e) {
|
|
1210
|
+
return new Zn({
|
|
1211
1211
|
type: "transform",
|
|
1212
1212
|
transform: e
|
|
1213
1213
|
});
|
|
1214
1214
|
}
|
|
1215
|
-
const
|
|
1216
|
-
|
|
1215
|
+
const Mn = /* @__PURE__ */ O("ZodOptional", (e, r) => {
|
|
1216
|
+
Dr.init(e, r), M.init(e, r), e._zod.processJSONSchema = (n, t, s) => Fr(e, n, t, s), e.unwrap = () => e._zod.def.innerType;
|
|
1217
1217
|
});
|
|
1218
1218
|
function ar(e) {
|
|
1219
|
-
return new
|
|
1219
|
+
return new Mn({
|
|
1220
1220
|
type: "optional",
|
|
1221
1221
|
innerType: e
|
|
1222
1222
|
});
|
|
1223
1223
|
}
|
|
1224
|
-
const
|
|
1225
|
-
|
|
1224
|
+
const Vn = /* @__PURE__ */ O("ZodExactOptional", (e, r) => {
|
|
1225
|
+
jt.init(e, r), M.init(e, r), e._zod.processJSONSchema = (n, t, s) => Fr(e, n, t, s), e.unwrap = () => e._zod.def.innerType;
|
|
1226
1226
|
});
|
|
1227
|
-
function
|
|
1228
|
-
return new
|
|
1227
|
+
function Jn(e) {
|
|
1228
|
+
return new Vn({
|
|
1229
1229
|
type: "optional",
|
|
1230
1230
|
innerType: e
|
|
1231
1231
|
});
|
|
1232
1232
|
}
|
|
1233
|
-
const
|
|
1234
|
-
|
|
1233
|
+
const Bn = /* @__PURE__ */ O("ZodNullable", (e, r) => {
|
|
1234
|
+
Zt.init(e, r), M.init(e, r), e._zod.processJSONSchema = (n, t, s) => un(e, n, t, s), e.unwrap = () => e._zod.def.innerType;
|
|
1235
1235
|
});
|
|
1236
1236
|
function ir(e) {
|
|
1237
|
-
return new
|
|
1237
|
+
return new Bn({
|
|
1238
1238
|
type: "nullable",
|
|
1239
1239
|
innerType: e
|
|
1240
1240
|
});
|
|
1241
1241
|
}
|
|
1242
|
-
const
|
|
1243
|
-
|
|
1242
|
+
const Un = /* @__PURE__ */ O("ZodDefault", (e, r) => {
|
|
1243
|
+
Lt.init(e, r), M.init(e, r), e._zod.processJSONSchema = (n, t, s) => mn(e, n, t, s), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
|
|
1244
1244
|
});
|
|
1245
|
-
function
|
|
1246
|
-
return new
|
|
1245
|
+
function Xn(e, r) {
|
|
1246
|
+
return new Un({
|
|
1247
1247
|
type: "default",
|
|
1248
1248
|
innerType: e,
|
|
1249
1249
|
get defaultValue() {
|
|
1250
|
-
return typeof r == "function" ? r() :
|
|
1250
|
+
return typeof r == "function" ? r() : Tr(r);
|
|
1251
1251
|
}
|
|
1252
1252
|
});
|
|
1253
1253
|
}
|
|
1254
|
-
const
|
|
1255
|
-
|
|
1254
|
+
const Hn = /* @__PURE__ */ O("ZodPrefault", (e, r) => {
|
|
1255
|
+
Mt.init(e, r), M.init(e, r), e._zod.processJSONSchema = (n, t, s) => pn(e, n, t, s), e.unwrap = () => e._zod.def.innerType;
|
|
1256
1256
|
});
|
|
1257
|
-
function
|
|
1258
|
-
return new
|
|
1257
|
+
function Kn(e, r) {
|
|
1258
|
+
return new Hn({
|
|
1259
1259
|
type: "prefault",
|
|
1260
1260
|
innerType: e,
|
|
1261
1261
|
get defaultValue() {
|
|
1262
|
-
return typeof r == "function" ? r() :
|
|
1262
|
+
return typeof r == "function" ? r() : Tr(r);
|
|
1263
1263
|
}
|
|
1264
1264
|
});
|
|
1265
1265
|
}
|
|
1266
|
-
const
|
|
1267
|
-
|
|
1266
|
+
const Wn = /* @__PURE__ */ O("ZodNonOptional", (e, r) => {
|
|
1267
|
+
Vt.init(e, r), M.init(e, r), e._zod.processJSONSchema = (n, t, s) => fn(e, n, t, s), e.unwrap = () => e._zod.def.innerType;
|
|
1268
1268
|
});
|
|
1269
|
-
function
|
|
1270
|
-
return new
|
|
1269
|
+
function qn(e, r) {
|
|
1270
|
+
return new Wn({
|
|
1271
1271
|
type: "nonoptional",
|
|
1272
1272
|
innerType: e,
|
|
1273
1273
|
...ae(r)
|
|
1274
1274
|
});
|
|
1275
1275
|
}
|
|
1276
|
-
const Gn = /* @__PURE__ */
|
|
1277
|
-
|
|
1276
|
+
const Gn = /* @__PURE__ */ O("ZodCatch", (e, r) => {
|
|
1277
|
+
Jt.init(e, r), M.init(e, r), e._zod.processJSONSchema = (n, t, s) => hn(e, n, t, s), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
|
|
1278
1278
|
});
|
|
1279
|
-
function
|
|
1279
|
+
function Yn(e, r) {
|
|
1280
1280
|
return new Gn({
|
|
1281
1281
|
type: "catch",
|
|
1282
1282
|
innerType: e,
|
|
1283
1283
|
catchValue: typeof r == "function" ? r : () => r
|
|
1284
1284
|
});
|
|
1285
1285
|
}
|
|
1286
|
-
const
|
|
1287
|
-
|
|
1286
|
+
const Qn = /* @__PURE__ */ O("ZodPipe", (e, r) => {
|
|
1287
|
+
Bt.init(e, r), M.init(e, r), e._zod.processJSONSchema = (n, t, s) => gn(e, n, t, s), e.in = r.in, e.out = r.out;
|
|
1288
1288
|
});
|
|
1289
1289
|
function cr(e, r) {
|
|
1290
|
-
return new
|
|
1290
|
+
return new Qn({
|
|
1291
1291
|
type: "pipe",
|
|
1292
1292
|
in: e,
|
|
1293
1293
|
out: r
|
|
1294
1294
|
// ...util.normalizeParams(params),
|
|
1295
1295
|
});
|
|
1296
1296
|
}
|
|
1297
|
-
const
|
|
1298
|
-
|
|
1297
|
+
const es = /* @__PURE__ */ O("ZodReadonly", (e, r) => {
|
|
1298
|
+
Ut.init(e, r), M.init(e, r), e._zod.processJSONSchema = (n, t, s) => vn(e, n, t, s), e.unwrap = () => e._zod.def.innerType;
|
|
1299
1299
|
});
|
|
1300
|
-
function
|
|
1301
|
-
return new
|
|
1300
|
+
function rs(e) {
|
|
1301
|
+
return new es({
|
|
1302
1302
|
type: "readonly",
|
|
1303
1303
|
innerType: e
|
|
1304
1304
|
});
|
|
1305
1305
|
}
|
|
1306
|
-
const
|
|
1307
|
-
|
|
1306
|
+
const ts = /* @__PURE__ */ O("ZodCustom", (e, r) => {
|
|
1307
|
+
Xt.init(e, r), M.init(e, r), e._zod.processJSONSchema = (n, t, s) => on(e, n);
|
|
1308
1308
|
});
|
|
1309
|
-
function
|
|
1310
|
-
return /* @__PURE__ */
|
|
1309
|
+
function ns(e, r = {}) {
|
|
1310
|
+
return /* @__PURE__ */ en(ts, e, r);
|
|
1311
1311
|
}
|
|
1312
|
-
function
|
|
1313
|
-
return /* @__PURE__ */
|
|
1312
|
+
function ss(e) {
|
|
1313
|
+
return /* @__PURE__ */ rn(e);
|
|
1314
1314
|
}
|
|
1315
|
-
const
|
|
1315
|
+
const os = {
|
|
1316
1316
|
custom: "custom"
|
|
1317
1317
|
}, ee = (e, r, n = {}) => {
|
|
1318
1318
|
if (!e) return !0;
|
|
@@ -1345,7 +1345,7 @@ const ss = {
|
|
|
1345
1345
|
default:
|
|
1346
1346
|
return !0;
|
|
1347
1347
|
}
|
|
1348
|
-
},
|
|
1348
|
+
}, as = /^\d{3}\.?\d{3}\.?\d{3}-?\d{2}$/, is = /^\(?\d{2}\)?\s?\d{4,5}-?\d{4}$/, cs = /^\d{5}-?\d{3}$/, ls = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, Pe = (e, r, n = {}) => {
|
|
1349
1349
|
const t = e.validacao;
|
|
1350
1350
|
if (e.tipo === h.CHECKBOX || e.tipo === h.SWITCH)
|
|
1351
1351
|
return e.obrigatorio && !r ? "Campo obrigatório" : void 0;
|
|
@@ -1386,10 +1386,10 @@ const ss = {
|
|
|
1386
1386
|
const s = r != null ? String(r) : "";
|
|
1387
1387
|
if (e.obrigatorio && !s.trim()) return "Campo obrigatório";
|
|
1388
1388
|
if (s) {
|
|
1389
|
-
if (e.tipo === h.EMAIL && !
|
|
1390
|
-
if (e.tipo === h.CPF && !
|
|
1391
|
-
if (e.tipo === h.TELEFONE && !
|
|
1392
|
-
if (e.tipo === h.CEP && !
|
|
1389
|
+
if (e.tipo === h.EMAIL && !ls.test(s)) return "E-mail inválido";
|
|
1390
|
+
if (e.tipo === h.CPF && !as.test(s)) return "CPF inválido";
|
|
1391
|
+
if (e.tipo === h.TELEFONE && !is.test(s)) return "Telefone inválido";
|
|
1392
|
+
if (e.tipo === h.CEP && !cs.test(s)) return "CEP inválido";
|
|
1393
1393
|
if (t != null && t.minLength && s.length < t.minLength) return `Mínimo ${t.minLength} caracteres`;
|
|
1394
1394
|
if (t != null && t.maxLength && s.length > t.maxLength) return `Máximo ${t.maxLength} caracteres`;
|
|
1395
1395
|
if ((e.tipo === h.DATE || e.tipo === h.DATETIME) && s) {
|
|
@@ -1419,9 +1419,9 @@ const ss = {
|
|
|
1419
1419
|
(s[a] == null || typeof s[a] != "object") && (s[a] = {}), s = s[a];
|
|
1420
1420
|
}
|
|
1421
1421
|
s[t[t.length - 1]] = n;
|
|
1422
|
-
},
|
|
1422
|
+
}, ds = (e) => [...e.containers].sort((r, n) => r.ordem - n.ordem).filter((r) => !r.repeatable).flatMap((r) => [...r.campos].sort((n, t) => n.ordem - t.ordem)), us = (e, r = {}, n = {}) => async (t) => {
|
|
1423
1423
|
var l, d, f;
|
|
1424
|
-
const s =
|
|
1424
|
+
const s = ds(e), o = {};
|
|
1425
1425
|
for (const u of s) {
|
|
1426
1426
|
if (!ee(u.condicional, t, r) || u.tipo === h.HIDDEN) continue;
|
|
1427
1427
|
if (u.tipo === h.FIELD_ARRAY) {
|
|
@@ -1431,26 +1431,26 @@ const ss = {
|
|
|
1431
1431
|
message: `Mínimo de ${u.minItems} item${u.minItems !== 1 ? "s" : ""}`
|
|
1432
1432
|
});
|
|
1433
1433
|
for (let b = 0; b < N.length; b++) {
|
|
1434
|
-
const
|
|
1435
|
-
for (const
|
|
1436
|
-
const g = Pe(
|
|
1434
|
+
const w = N[b];
|
|
1435
|
+
for (const E of u.subFields ?? []) {
|
|
1436
|
+
const g = Pe(E, w[E.nome], r);
|
|
1437
1437
|
if (g) {
|
|
1438
|
-
Ce(o, `${u.nome}.${b}.${
|
|
1438
|
+
Ce(o, `${u.nome}.${b}.${E.nome}`, {
|
|
1439
1439
|
type: "custom",
|
|
1440
1440
|
message: g
|
|
1441
1441
|
});
|
|
1442
1442
|
continue;
|
|
1443
1443
|
}
|
|
1444
|
-
if ((l =
|
|
1444
|
+
if ((l = E.validate) != null && l.length) {
|
|
1445
1445
|
const p = await Se(
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1446
|
+
E.validate,
|
|
1447
|
+
E.nome,
|
|
1448
|
+
w[E.nome],
|
|
1449
|
+
w,
|
|
1450
1450
|
r,
|
|
1451
1451
|
n
|
|
1452
1452
|
);
|
|
1453
|
-
p && Ce(o, `${u.nome}.${b}.${
|
|
1453
|
+
p && Ce(o, `${u.nome}.${b}.${E.nome}`, {
|
|
1454
1454
|
type: "custom",
|
|
1455
1455
|
message: p
|
|
1456
1456
|
});
|
|
@@ -1459,8 +1459,8 @@ const ss = {
|
|
|
1459
1459
|
}
|
|
1460
1460
|
continue;
|
|
1461
1461
|
}
|
|
1462
|
-
const
|
|
1463
|
-
if (
|
|
1462
|
+
const y = Pe(u, t[u.nome], r);
|
|
1463
|
+
if (y && (o[u.nome] = { type: "custom", message: y }), !o[u.nome] && ((d = u.validate) != null && d.length)) {
|
|
1464
1464
|
const N = await Se(
|
|
1465
1465
|
u.validate,
|
|
1466
1466
|
u.nome,
|
|
@@ -1476,16 +1476,16 @@ const ss = {
|
|
|
1476
1476
|
(u) => u.repeatable && u.nome
|
|
1477
1477
|
);
|
|
1478
1478
|
for (const u of a) {
|
|
1479
|
-
const
|
|
1480
|
-
for (let
|
|
1481
|
-
const N = y
|
|
1479
|
+
const v = Array.isArray(t[u.nome]) ? t[u.nome] : [];
|
|
1480
|
+
for (let y = 0; y < v.length; y++) {
|
|
1481
|
+
const N = v[y];
|
|
1482
1482
|
for (const b of u.campos) {
|
|
1483
1483
|
if (!ee(b.condicional, N, r) || b.tipo === h.HIDDEN) continue;
|
|
1484
|
-
const
|
|
1485
|
-
if (
|
|
1486
|
-
Ce(o, `${u.nome}.${
|
|
1484
|
+
const E = Pe(b, N[b.nome], r);
|
|
1485
|
+
if (E) {
|
|
1486
|
+
Ce(o, `${u.nome}.${y}.${b.nome}`, {
|
|
1487
1487
|
type: "custom",
|
|
1488
|
-
message:
|
|
1488
|
+
message: E
|
|
1489
1489
|
});
|
|
1490
1490
|
continue;
|
|
1491
1491
|
}
|
|
@@ -1498,7 +1498,7 @@ const ss = {
|
|
|
1498
1498
|
r,
|
|
1499
1499
|
n
|
|
1500
1500
|
);
|
|
1501
|
-
g && Ce(o, `${u.nome}.${
|
|
1501
|
+
g && Ce(o, `${u.nome}.${y}.${b.nome}`, {
|
|
1502
1502
|
type: "custom",
|
|
1503
1503
|
message: g
|
|
1504
1504
|
});
|
|
@@ -1510,23 +1510,23 @@ const ss = {
|
|
|
1510
1510
|
return { values: c ? {} : t, errors: c ? o : {} };
|
|
1511
1511
|
}, Se = async (e, r, n, t, s, o) => {
|
|
1512
1512
|
var l;
|
|
1513
|
-
let a =
|
|
1513
|
+
let a = Pn();
|
|
1514
1514
|
for (const d of e) {
|
|
1515
1515
|
const f = o[d.type];
|
|
1516
1516
|
if (!f) continue;
|
|
1517
|
-
const u = f,
|
|
1518
|
-
a = a.superRefine(async (
|
|
1519
|
-
const b = await u(
|
|
1517
|
+
const u = f, v = d;
|
|
1518
|
+
a = a.superRefine(async (y, N) => {
|
|
1519
|
+
const b = await u(y, t, v, s);
|
|
1520
1520
|
b && N.addIssue({
|
|
1521
|
-
code:
|
|
1522
|
-
message:
|
|
1521
|
+
code: os.custom,
|
|
1522
|
+
message: v.message ?? b
|
|
1523
1523
|
});
|
|
1524
1524
|
});
|
|
1525
1525
|
}
|
|
1526
1526
|
const c = await a.safeParseAsync(n);
|
|
1527
1527
|
if (!c.success)
|
|
1528
1528
|
return (l = c.error.issues[0]) == null ? void 0 : l.message;
|
|
1529
|
-
},
|
|
1529
|
+
}, fs = (e, r = {}, n = {}) => async (t) => {
|
|
1530
1530
|
var a;
|
|
1531
1531
|
const s = {}, o = [...e.containers].sort((c, l) => c.ordem - l.ordem).flatMap((c) => [...c.campos].sort((l, d) => l.ordem - d.ordem));
|
|
1532
1532
|
for (const c of o) {
|
|
@@ -1542,10 +1542,10 @@ const ss = {
|
|
|
1542
1542
|
d && (s[c.nome] = d);
|
|
1543
1543
|
}
|
|
1544
1544
|
return s;
|
|
1545
|
-
},
|
|
1545
|
+
}, ms = /\{\{\s*(?:event|evento)\.([a-zA-Z0-9_.]+)\s*\}\}/g, Y = (e, r) => e ? e.replace(ms, (n, t) => r[`evento.${t}`] ?? r[t] ?? n) : e ?? "", ps = (e, r) => ({
|
|
1546
1546
|
...e,
|
|
1547
1547
|
label: Y(e.label, r)
|
|
1548
|
-
}),
|
|
1548
|
+
}), hs = (e, r) => {
|
|
1549
1549
|
var n;
|
|
1550
1550
|
return {
|
|
1551
1551
|
...e,
|
|
@@ -1553,19 +1553,19 @@ const ss = {
|
|
|
1553
1553
|
placeholder: Y(e.placeholder, r),
|
|
1554
1554
|
hint: Y(e.hint, r),
|
|
1555
1555
|
defaultValue: typeof e.defaultValue == "string" ? Y(e.defaultValue, r) : e.defaultValue,
|
|
1556
|
-
opcoes: (n = e.opcoes) == null ? void 0 : n.map((t) =>
|
|
1556
|
+
opcoes: (n = e.opcoes) == null ? void 0 : n.map((t) => ps(t, r))
|
|
1557
1557
|
};
|
|
1558
1558
|
}, Ve = (e, r) => ({
|
|
1559
1559
|
...e,
|
|
1560
1560
|
titulo: Y(e.titulo, r),
|
|
1561
1561
|
descricao: Y(e.descricao, r),
|
|
1562
|
-
campos: e.campos.map((n) =>
|
|
1563
|
-
}),
|
|
1562
|
+
campos: e.campos.map((n) => hs(n, r))
|
|
1563
|
+
}), gs = (e, r) => ({
|
|
1564
1564
|
...e,
|
|
1565
1565
|
titulo: Y(e.titulo, r),
|
|
1566
1566
|
descricao: Y(e.descricao, r),
|
|
1567
1567
|
containers: e.containers.map((n) => Ve(n, r))
|
|
1568
|
-
}),
|
|
1568
|
+
}), jr = gr({}), ne = () => ye(jr), H = ({
|
|
1569
1569
|
name: e,
|
|
1570
1570
|
control: r,
|
|
1571
1571
|
placeholder: n,
|
|
@@ -1675,7 +1675,7 @@ const ss = {
|
|
|
1675
1675
|
] }),
|
|
1676
1676
|
((c = a.error) == null ? void 0 : c.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: a.error.message })
|
|
1677
1677
|
] });
|
|
1678
|
-
},
|
|
1678
|
+
}, Zr = ({
|
|
1679
1679
|
name: e,
|
|
1680
1680
|
control: r,
|
|
1681
1681
|
options: n,
|
|
@@ -1702,7 +1702,7 @@ const ss = {
|
|
|
1702
1702
|
] }, d.valor)) }),
|
|
1703
1703
|
((l = o.error) == null ? void 0 : l.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: o.error.message })
|
|
1704
1704
|
] });
|
|
1705
|
-
},
|
|
1705
|
+
}, Lr = ({
|
|
1706
1706
|
name: e,
|
|
1707
1707
|
control: r,
|
|
1708
1708
|
options: n,
|
|
@@ -1752,13 +1752,13 @@ const ss = {
|
|
|
1752
1752
|
),
|
|
1753
1753
|
((l = a.error) == null ? void 0 : l.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: a.error.message })
|
|
1754
1754
|
] });
|
|
1755
|
-
},
|
|
1755
|
+
}, vs = (e) => {
|
|
1756
1756
|
const r = /* @__PURE__ */ new Date();
|
|
1757
1757
|
return r.setFullYear(r.getFullYear() - e), r.toISOString().split("T")[0];
|
|
1758
1758
|
}, ys = (e) => {
|
|
1759
1759
|
const r = /* @__PURE__ */ new Date();
|
|
1760
1760
|
return r.setFullYear(r.getFullYear() - e), r.toISOString().split("T")[0];
|
|
1761
|
-
},
|
|
1761
|
+
}, ve = ({
|
|
1762
1762
|
name: e,
|
|
1763
1763
|
control: r,
|
|
1764
1764
|
isDatetime: n,
|
|
@@ -1766,8 +1766,8 @@ const ss = {
|
|
|
1766
1766
|
readOnly: s,
|
|
1767
1767
|
validacao: o
|
|
1768
1768
|
}) => {
|
|
1769
|
-
var
|
|
1770
|
-
const { field: a, fieldState: c } = P({ name: e, control: r }), l = n ? "datetime-local" : "date", d = (
|
|
1769
|
+
var v;
|
|
1770
|
+
const { field: a, fieldState: c } = P({ name: e, control: r }), l = n ? "datetime-local" : "date", d = (y) => n ? y + "T00:00" : y, f = (o == null ? void 0 : o.minAge) != null ? d(vs(o.minAge)) : (o == null ? void 0 : o.maxDate) != null ? d(o.maxDate) : void 0, u = (o == null ? void 0 : o.maxAge) != null ? d(ys(o.maxAge)) : (o == null ? void 0 : o.minDate) != null ? d(o.minDate) : void 0;
|
|
1771
1771
|
return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
|
|
1772
1772
|
/* @__PURE__ */ i(
|
|
1773
1773
|
"input",
|
|
@@ -1785,9 +1785,9 @@ const ss = {
|
|
|
1785
1785
|
"data-sfr-field": "date"
|
|
1786
1786
|
}
|
|
1787
1787
|
),
|
|
1788
|
-
((
|
|
1788
|
+
((v = c.error) == null ? void 0 : v.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: c.error.message })
|
|
1789
1789
|
] });
|
|
1790
|
-
},
|
|
1790
|
+
}, lr = (e) => e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`, Mr = ({
|
|
1791
1791
|
name: e,
|
|
1792
1792
|
control: r,
|
|
1793
1793
|
disabled: n,
|
|
@@ -1795,16 +1795,16 @@ const ss = {
|
|
|
1795
1795
|
fileTypes: s,
|
|
1796
1796
|
maxFileSize: o
|
|
1797
1797
|
}) => {
|
|
1798
|
-
var
|
|
1799
|
-
const { field: a, fieldState: c } = P({ name: e, control: r }), { uploadFile: l } = ne(), [d, f] =
|
|
1798
|
+
var T;
|
|
1799
|
+
const { field: a, fieldState: c } = P({ name: e, control: r }), { uploadFile: l } = ne(), [d, f] = R({
|
|
1800
1800
|
status: "idle"
|
|
1801
|
-
}), u = te(null), y = typeof a.value == "string" && a.value ? a.value : null,
|
|
1802
|
-
async (
|
|
1803
|
-
var
|
|
1801
|
+
}), u = te(null), [v, y] = R(!1), N = typeof a.value == "string" && a.value ? a.value : null, b = oe(
|
|
1802
|
+
async (_) => {
|
|
1803
|
+
var x;
|
|
1804
1804
|
if (s && s.length > 0) {
|
|
1805
|
-
const
|
|
1805
|
+
const S = ((x = _.name.split(".").pop()) == null ? void 0 : x.toLowerCase()) ?? "", z = _.type.toLowerCase();
|
|
1806
1806
|
if (!s.some(
|
|
1807
|
-
(
|
|
1807
|
+
(D) => D.toLowerCase() === S || D.toLowerCase() === z
|
|
1808
1808
|
)) {
|
|
1809
1809
|
f({
|
|
1810
1810
|
status: "error",
|
|
@@ -1813,10 +1813,10 @@ const ss = {
|
|
|
1813
1813
|
return;
|
|
1814
1814
|
}
|
|
1815
1815
|
}
|
|
1816
|
-
if (o &&
|
|
1816
|
+
if (o && _.size > o) {
|
|
1817
1817
|
f({
|
|
1818
1818
|
status: "error",
|
|
1819
|
-
message: `Arquivo muito grande. Tamanho máximo: ${
|
|
1819
|
+
message: `Arquivo muito grande. Tamanho máximo: ${lr(o)}`
|
|
1820
1820
|
});
|
|
1821
1821
|
return;
|
|
1822
1822
|
}
|
|
@@ -1827,14 +1827,19 @@ const ss = {
|
|
|
1827
1827
|
});
|
|
1828
1828
|
return;
|
|
1829
1829
|
}
|
|
1830
|
-
f({ status: "uploading", fileName:
|
|
1830
|
+
f({ status: "uploading", fileName: _.name, progress: 0 });
|
|
1831
1831
|
try {
|
|
1832
|
-
const
|
|
1832
|
+
const S = await l(_, t ?? e, (z) => {
|
|
1833
1833
|
f(
|
|
1834
|
-
(
|
|
1834
|
+
(I) => I.status === "uploading" ? { ...I, progress: Math.min(100, z) } : I
|
|
1835
1835
|
);
|
|
1836
1836
|
});
|
|
1837
|
-
a.onChange(
|
|
1837
|
+
a.onChange(S), f({
|
|
1838
|
+
status: "done",
|
|
1839
|
+
uploadId: S,
|
|
1840
|
+
fileName: _.name,
|
|
1841
|
+
size: _.size
|
|
1842
|
+
});
|
|
1838
1843
|
} catch {
|
|
1839
1844
|
f({
|
|
1840
1845
|
status: "error",
|
|
@@ -1843,16 +1848,69 @@ const ss = {
|
|
|
1843
1848
|
}
|
|
1844
1849
|
},
|
|
1845
1850
|
[l, t, e, a, s, o]
|
|
1846
|
-
),
|
|
1847
|
-
(
|
|
1848
|
-
var
|
|
1849
|
-
const
|
|
1850
|
-
|
|
1851
|
+
), w = oe(
|
|
1852
|
+
(_) => {
|
|
1853
|
+
var S;
|
|
1854
|
+
const x = (S = _.target.files) == null ? void 0 : S[0];
|
|
1855
|
+
x && b(x), _.target.value = "";
|
|
1851
1856
|
},
|
|
1852
|
-
[
|
|
1853
|
-
),
|
|
1857
|
+
[b]
|
|
1858
|
+
), E = oe(() => {
|
|
1854
1859
|
a.onChange(""), f({ status: "idle" }), u.current && (u.current.value = "");
|
|
1855
1860
|
}, [a]);
|
|
1861
|
+
if (d.status === "done" || d.status === "idle" && !!N) {
|
|
1862
|
+
const _ = d.status === "done" ? d.fileName : "Arquivo enviado", x = d.status === "done" ? d.size : null;
|
|
1863
|
+
return /* @__PURE__ */ m(
|
|
1864
|
+
"div",
|
|
1865
|
+
{
|
|
1866
|
+
className: "sfr-file-upload sfr-file-done",
|
|
1867
|
+
"data-sfr-field": "file",
|
|
1868
|
+
"data-status": "done",
|
|
1869
|
+
children: [
|
|
1870
|
+
/* @__PURE__ */ i("span", { className: "sfr-file-name", children: _ }),
|
|
1871
|
+
x !== null && /* @__PURE__ */ i("span", { className: "sfr-file-size", children: lr(x) }),
|
|
1872
|
+
!n && /* @__PURE__ */ i(
|
|
1873
|
+
"button",
|
|
1874
|
+
{
|
|
1875
|
+
type: "button",
|
|
1876
|
+
onClick: E,
|
|
1877
|
+
className: "sfr-file-remove",
|
|
1878
|
+
"aria-label": "Remover arquivo",
|
|
1879
|
+
children: "✕"
|
|
1880
|
+
}
|
|
1881
|
+
)
|
|
1882
|
+
]
|
|
1883
|
+
}
|
|
1884
|
+
);
|
|
1885
|
+
}
|
|
1886
|
+
if (d.status === "uploading") {
|
|
1887
|
+
const { fileName: _, progress: x } = d;
|
|
1888
|
+
return /* @__PURE__ */ m(
|
|
1889
|
+
"div",
|
|
1890
|
+
{
|
|
1891
|
+
className: "sfr-file-upload sfr-file-uploading",
|
|
1892
|
+
"data-sfr-field": "file",
|
|
1893
|
+
"data-status": "uploading",
|
|
1894
|
+
children: [
|
|
1895
|
+
/* @__PURE__ */ m("div", { className: "sfr-file-uploading__info", children: [
|
|
1896
|
+
/* @__PURE__ */ i("span", { className: "sfr-file-name", children: _ }),
|
|
1897
|
+
/* @__PURE__ */ m("span", { className: "sfr-file-progress-pct", children: [
|
|
1898
|
+
x,
|
|
1899
|
+
"%"
|
|
1900
|
+
] })
|
|
1901
|
+
] }),
|
|
1902
|
+
/* @__PURE__ */ i("div", { className: "sfr-file-progress-track", children: /* @__PURE__ */ i(
|
|
1903
|
+
"div",
|
|
1904
|
+
{
|
|
1905
|
+
className: "sfr-file-progress-bar",
|
|
1906
|
+
style: { width: `${x}%` }
|
|
1907
|
+
}
|
|
1908
|
+
) })
|
|
1909
|
+
]
|
|
1910
|
+
}
|
|
1911
|
+
);
|
|
1912
|
+
}
|
|
1913
|
+
const p = d.status === "error";
|
|
1856
1914
|
return /* @__PURE__ */ m(
|
|
1857
1915
|
"div",
|
|
1858
1916
|
{
|
|
@@ -1860,33 +1918,65 @@ const ss = {
|
|
|
1860
1918
|
"data-sfr-field": "file",
|
|
1861
1919
|
"data-status": d.status,
|
|
1862
1920
|
children: [
|
|
1863
|
-
|
|
1921
|
+
/* @__PURE__ */ m(
|
|
1922
|
+
"div",
|
|
1923
|
+
{
|
|
1924
|
+
role: "button",
|
|
1925
|
+
tabIndex: n ? -1 : 0,
|
|
1926
|
+
"aria-label": "Selecionar arquivo",
|
|
1927
|
+
"data-dragging": v || void 0,
|
|
1928
|
+
"data-error": p || void 0,
|
|
1929
|
+
"data-field-error": !!c.error || void 0,
|
|
1930
|
+
"data-disabled": n || void 0,
|
|
1931
|
+
className: "sfr-file-drop",
|
|
1932
|
+
onClick: () => {
|
|
1933
|
+
var _;
|
|
1934
|
+
return !n && ((_ = u.current) == null ? void 0 : _.click());
|
|
1935
|
+
},
|
|
1936
|
+
onKeyDown: (_) => {
|
|
1937
|
+
var x;
|
|
1938
|
+
(_.key === "Enter" || _.key === " ") && ((x = u.current) == null || x.click());
|
|
1939
|
+
},
|
|
1940
|
+
onDragOver: (_) => {
|
|
1941
|
+
_.preventDefault(), n || y(!0);
|
|
1942
|
+
},
|
|
1943
|
+
onDragLeave: () => y(!1),
|
|
1944
|
+
onDrop: n ? void 0 : (_) => {
|
|
1945
|
+
var S;
|
|
1946
|
+
_.preventDefault(), y(!1);
|
|
1947
|
+
const x = (S = _.dataTransfer.files) == null ? void 0 : S[0];
|
|
1948
|
+
x && b(x);
|
|
1949
|
+
},
|
|
1950
|
+
onBlur: a.onBlur,
|
|
1951
|
+
children: [
|
|
1952
|
+
/* @__PURE__ */ i(
|
|
1953
|
+
"input",
|
|
1954
|
+
{
|
|
1955
|
+
ref: u,
|
|
1956
|
+
type: "file",
|
|
1957
|
+
onChange: w,
|
|
1958
|
+
disabled: n,
|
|
1959
|
+
className: "sfr-file-input"
|
|
1960
|
+
}
|
|
1961
|
+
),
|
|
1962
|
+
/* @__PURE__ */ i("span", { className: "sfr-file-label", children: v ? "Solte o arquivo aqui" : "Clique ou arraste um arquivo" })
|
|
1963
|
+
]
|
|
1964
|
+
}
|
|
1965
|
+
),
|
|
1966
|
+
p && /* @__PURE__ */ m("p", { className: "sfr-error", children: [
|
|
1967
|
+
d.message,
|
|
1968
|
+
" · ",
|
|
1864
1969
|
/* @__PURE__ */ i(
|
|
1865
|
-
"input",
|
|
1866
|
-
{
|
|
1867
|
-
ref: u,
|
|
1868
|
-
type: "file",
|
|
1869
|
-
onChange: N,
|
|
1870
|
-
disabled: n || d.status === "uploading",
|
|
1871
|
-
className: "sfr-file-input"
|
|
1872
|
-
}
|
|
1873
|
-
),
|
|
1874
|
-
/* @__PURE__ */ i("span", { className: "sfr-file-label", children: d.status === "uploading" ? `Enviando ${d.fileName}…` : "Clique ou arraste o arquivo" })
|
|
1875
|
-
] }),
|
|
1876
|
-
(y || d.status === "done") && /* @__PURE__ */ m("div", { className: "sfr-file-done", children: [
|
|
1877
|
-
/* @__PURE__ */ i("span", { className: "sfr-file-name", children: d.status === "done" ? d.fileName : "Arquivo enviado" }),
|
|
1878
|
-
!n && /* @__PURE__ */ i(
|
|
1879
1970
|
"button",
|
|
1880
1971
|
{
|
|
1881
1972
|
type: "button",
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
children: "
|
|
1973
|
+
className: "sfr-error-retry",
|
|
1974
|
+
onClick: () => f({ status: "idle" }),
|
|
1975
|
+
children: "Tentar novamente"
|
|
1885
1976
|
}
|
|
1886
1977
|
)
|
|
1887
1978
|
] }),
|
|
1888
|
-
|
|
1889
|
-
((_ = c.error) == null ? void 0 : _.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: c.error.message })
|
|
1979
|
+
!p && ((T = c.error) == null ? void 0 : T.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: c.error.message })
|
|
1890
1980
|
]
|
|
1891
1981
|
}
|
|
1892
1982
|
);
|
|
@@ -1932,14 +2022,14 @@ const ss = {
|
|
|
1932
2022
|
}, Xe = ({ name: e, control: r }) => {
|
|
1933
2023
|
const { field: n } = P({ name: e, control: r });
|
|
1934
2024
|
return /* @__PURE__ */ i("input", { type: "hidden", ...n, value: n.value ?? "" });
|
|
1935
|
-
},
|
|
1936
|
-
const r =
|
|
2025
|
+
}, Vr = (e) => e.replace(/\D/g, ""), Ns = (e) => {
|
|
2026
|
+
const r = Vr(e).slice(0, 8);
|
|
1937
2027
|
return r.length <= 5 ? r : `${r.slice(0, 5)}-${r.slice(5)}`;
|
|
1938
2028
|
}, _s = async (e, r) => {
|
|
1939
2029
|
const n = await fetch(`https://viacep.com.br/ws/${e}/json/`, { signal: r });
|
|
1940
2030
|
if (!n.ok) throw new Error("Falha ao consultar CEP");
|
|
1941
2031
|
return n.json();
|
|
1942
|
-
},
|
|
2032
|
+
}, Jr = ({
|
|
1943
2033
|
name: e,
|
|
1944
2034
|
control: r,
|
|
1945
2035
|
placeholder: n = "00000-000",
|
|
@@ -1947,9 +2037,9 @@ const ss = {
|
|
|
1947
2037
|
readOnly: s,
|
|
1948
2038
|
cepFillMap: o
|
|
1949
2039
|
}) => {
|
|
1950
|
-
var
|
|
1951
|
-
const { field: a, fieldState: c } = P({ name: e, control: r }), { setValue: l } = be(), { cepLookup: d } = ne(), [f, u] =
|
|
1952
|
-
|
|
2040
|
+
var E, g;
|
|
2041
|
+
const { field: a, fieldState: c } = P({ name: e, control: r }), { setValue: l } = be(), { cepLookup: d } = ne(), [f, u] = R("idle"), [v, y] = R(null), N = te(null);
|
|
2042
|
+
G(
|
|
1953
2043
|
() => () => {
|
|
1954
2044
|
var p;
|
|
1955
2045
|
(p = N.current) == null || p.abort();
|
|
@@ -1957,45 +2047,45 @@ const ss = {
|
|
|
1957
2047
|
[]
|
|
1958
2048
|
);
|
|
1959
2049
|
const b = oe(async () => {
|
|
1960
|
-
var
|
|
2050
|
+
var T;
|
|
1961
2051
|
a.onBlur();
|
|
1962
|
-
const p =
|
|
2052
|
+
const p = Vr(a.value ?? "");
|
|
1963
2053
|
if (p.length === 8) {
|
|
1964
|
-
(
|
|
2054
|
+
(T = N.current) == null || T.abort(), N.current = new AbortController(), u("loading"), y(null);
|
|
1965
2055
|
try {
|
|
1966
|
-
let
|
|
2056
|
+
let _;
|
|
1967
2057
|
if (d) {
|
|
1968
|
-
const
|
|
1969
|
-
if (
|
|
2058
|
+
const z = N.current;
|
|
2059
|
+
if (_ = await d(p), z.signal.aborted) return;
|
|
1970
2060
|
} else {
|
|
1971
|
-
const
|
|
1972
|
-
if (
|
|
1973
|
-
u("error"),
|
|
2061
|
+
const z = await _s(p, N.current.signal);
|
|
2062
|
+
if (z.erro) {
|
|
2063
|
+
u("error"), y("CEP não encontrado");
|
|
1974
2064
|
return;
|
|
1975
2065
|
}
|
|
1976
|
-
|
|
1977
|
-
logradouro:
|
|
1978
|
-
bairro:
|
|
1979
|
-
cidade:
|
|
1980
|
-
estado:
|
|
2066
|
+
_ = {
|
|
2067
|
+
logradouro: z.logradouro,
|
|
2068
|
+
bairro: z.bairro,
|
|
2069
|
+
cidade: z.localidade,
|
|
2070
|
+
estado: z.uf
|
|
1981
2071
|
};
|
|
1982
2072
|
}
|
|
1983
|
-
if (
|
|
1984
|
-
u("error"),
|
|
2073
|
+
if (_.erro) {
|
|
2074
|
+
u("error"), y("CEP não encontrado");
|
|
1985
2075
|
return;
|
|
1986
2076
|
}
|
|
1987
|
-
const
|
|
1988
|
-
if (!
|
|
1989
|
-
const
|
|
1990
|
-
l(
|
|
2077
|
+
const x = e.includes(".") ? `${e.substring(0, e.lastIndexOf("."))}.` : "", S = (z, I, D) => {
|
|
2078
|
+
if (!D) return;
|
|
2079
|
+
const V = o != null && o[z] ? `${x}${o[z]}` : `${x}${I}`;
|
|
2080
|
+
l(V, D);
|
|
1991
2081
|
};
|
|
1992
|
-
|
|
1993
|
-
} catch (
|
|
1994
|
-
if (
|
|
1995
|
-
u("error"),
|
|
2082
|
+
S("logradouro", "_address_logradouro", _.logradouro), S("bairro", "_address_bairro", _.bairro), S("cidade", "_address_cidade", _.cidade), S("estado", "_address_estado", _.estado), u("success");
|
|
2083
|
+
} catch (_) {
|
|
2084
|
+
if (_ instanceof Error && _.name === "AbortError") return;
|
|
2085
|
+
u("error"), y("Erro ao buscar CEP");
|
|
1996
2086
|
}
|
|
1997
2087
|
}
|
|
1998
|
-
}, [a, d, l, e, o]),
|
|
2088
|
+
}, [a, d, l, e, o]), w = oe(
|
|
1999
2089
|
(p) => {
|
|
2000
2090
|
a.onChange(Ns(p.target.value));
|
|
2001
2091
|
},
|
|
@@ -2014,7 +2104,7 @@ const ss = {
|
|
|
2014
2104
|
{
|
|
2015
2105
|
name: a.name,
|
|
2016
2106
|
value: a.value || "",
|
|
2017
|
-
onChange:
|
|
2107
|
+
onChange: w,
|
|
2018
2108
|
onBlur: b,
|
|
2019
2109
|
placeholder: n,
|
|
2020
2110
|
disabled: t,
|
|
@@ -2028,7 +2118,7 @@ const ss = {
|
|
|
2028
2118
|
]
|
|
2029
2119
|
}
|
|
2030
2120
|
),
|
|
2031
|
-
(((
|
|
2121
|
+
(((E = c.error) == null ? void 0 : E.message) || v) && /* @__PURE__ */ i("p", { className: "sfr-error", children: ((g = c.error) == null ? void 0 : g.message) || v })
|
|
2032
2122
|
] });
|
|
2033
2123
|
}, xs = ({
|
|
2034
2124
|
field: e,
|
|
@@ -2042,34 +2132,34 @@ const ss = {
|
|
|
2042
2132
|
};
|
|
2043
2133
|
switch (e.tipo) {
|
|
2044
2134
|
case h.TEXTO:
|
|
2045
|
-
return /* @__PURE__ */ i(
|
|
2135
|
+
return /* @__PURE__ */ i(H, { ...t, type: "text" });
|
|
2046
2136
|
case h.EMAIL:
|
|
2047
|
-
return /* @__PURE__ */ i(
|
|
2137
|
+
return /* @__PURE__ */ i(H, { ...t, type: "email" });
|
|
2048
2138
|
case h.NUMBER:
|
|
2049
|
-
return /* @__PURE__ */ i(
|
|
2139
|
+
return /* @__PURE__ */ i(H, { ...t, type: "number" });
|
|
2050
2140
|
case h.TEXTAREA:
|
|
2051
2141
|
return /* @__PURE__ */ i(Je, { ...t });
|
|
2052
2142
|
case h.SELECT:
|
|
2053
2143
|
return /* @__PURE__ */ i(Be, { ...t, options: e.opcoes ?? [] });
|
|
2054
2144
|
case h.RADIO:
|
|
2055
|
-
return /* @__PURE__ */ i(
|
|
2145
|
+
return /* @__PURE__ */ i(Lr, { ...t, options: e.opcoes ?? [] });
|
|
2056
2146
|
case h.CHECKBOX:
|
|
2057
2147
|
return /* @__PURE__ */ i(Ue, { name: n, control: r, label: e.label });
|
|
2058
2148
|
case h.CHECKBOX_GROUP:
|
|
2059
|
-
return /* @__PURE__ */ i(
|
|
2149
|
+
return /* @__PURE__ */ i(Zr, { ...t, options: e.opcoes ?? [] });
|
|
2060
2150
|
case h.DATE:
|
|
2061
|
-
return /* @__PURE__ */ i(
|
|
2151
|
+
return /* @__PURE__ */ i(ve, { ...t, validacao: e.validacao });
|
|
2062
2152
|
case h.DATETIME:
|
|
2063
|
-
return /* @__PURE__ */ i(
|
|
2153
|
+
return /* @__PURE__ */ i(ve, { ...t, isDatetime: !0, validacao: e.validacao });
|
|
2064
2154
|
case h.FILE:
|
|
2065
|
-
return /* @__PURE__ */ i(
|
|
2155
|
+
return /* @__PURE__ */ i(Mr, { name: n, control: r });
|
|
2066
2156
|
case h.TELEFONE:
|
|
2067
2157
|
return /* @__PURE__ */ i(ie, { ...t, maskType: "telefone" });
|
|
2068
2158
|
case h.CPF:
|
|
2069
2159
|
return /* @__PURE__ */ i(ie, { ...t, maskType: "cpf" });
|
|
2070
2160
|
case h.CEP:
|
|
2071
2161
|
return /* @__PURE__ */ i(
|
|
2072
|
-
|
|
2162
|
+
Jr,
|
|
2073
2163
|
{
|
|
2074
2164
|
name: n,
|
|
2075
2165
|
control: r,
|
|
@@ -2079,7 +2169,7 @@ const ss = {
|
|
|
2079
2169
|
case h.HIDDEN:
|
|
2080
2170
|
return /* @__PURE__ */ i(Xe, { name: n, control: r });
|
|
2081
2171
|
default:
|
|
2082
|
-
return /* @__PURE__ */ i(
|
|
2172
|
+
return /* @__PURE__ */ i(H, { ...t, type: "text" });
|
|
2083
2173
|
}
|
|
2084
2174
|
}, ws = ({
|
|
2085
2175
|
name: e,
|
|
@@ -2091,44 +2181,44 @@ const ss = {
|
|
|
2091
2181
|
addLabel: a
|
|
2092
2182
|
}) => {
|
|
2093
2183
|
var b;
|
|
2094
|
-
const { fields: c, append: l, remove: d } =
|
|
2184
|
+
const { fields: c, append: l, remove: d } = vr({
|
|
2095
2185
|
control: r,
|
|
2096
2186
|
name: e
|
|
2097
|
-
}), { errors: f } =
|
|
2098
|
-
|
|
2187
|
+
}), { errors: f } = Wr({ control: r }), u = (b = f[e]) == null ? void 0 : b.message;
|
|
2188
|
+
G(() => {
|
|
2099
2189
|
if (c.length < t)
|
|
2100
|
-
for (let
|
|
2190
|
+
for (let w = c.length; w < t; w++)
|
|
2101
2191
|
l({});
|
|
2102
2192
|
}, []);
|
|
2103
|
-
const
|
|
2193
|
+
const v = [...n].sort((w, E) => w.ordem - E.ordem), y = !s || c.length < s, N = a ?? `Adicionar ${o.toLowerCase()}`;
|
|
2104
2194
|
return /* @__PURE__ */ m("div", { className: "sfr-field-array space-y-3", children: [
|
|
2105
|
-
c.map((
|
|
2195
|
+
c.map((w, E) => /* @__PURE__ */ m(
|
|
2106
2196
|
"div",
|
|
2107
2197
|
{
|
|
2108
2198
|
className: "sfr-field-array__item border rounded-lg p-4",
|
|
2109
2199
|
children: [
|
|
2110
2200
|
/* @__PURE__ */ m("div", { className: "sfr-field-array__item-header flex items-center justify-between mb-4", children: [
|
|
2111
2201
|
/* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
|
|
2112
|
-
/* @__PURE__ */ i("div", { className: "sfr-field-array__counter w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0", children:
|
|
2202
|
+
/* @__PURE__ */ i("div", { className: "sfr-field-array__counter w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0", children: E + 1 }),
|
|
2113
2203
|
/* @__PURE__ */ m("span", { className: "text-sm font-semibold", children: [
|
|
2114
2204
|
o,
|
|
2115
2205
|
" ",
|
|
2116
|
-
|
|
2206
|
+
E + 1
|
|
2117
2207
|
] })
|
|
2118
2208
|
] }),
|
|
2119
2209
|
c.length > t && /* @__PURE__ */ i(
|
|
2120
2210
|
"button",
|
|
2121
2211
|
{
|
|
2122
2212
|
type: "button",
|
|
2123
|
-
onClick: () => d(
|
|
2213
|
+
onClick: () => d(E),
|
|
2124
2214
|
className: "sfr-field-array__remove",
|
|
2125
|
-
"aria-label": `Remover ${o.toLowerCase()} ${
|
|
2215
|
+
"aria-label": `Remover ${o.toLowerCase()} ${E + 1}`,
|
|
2126
2216
|
children: /* @__PURE__ */ i(yr, { className: "w-4 h-4" })
|
|
2127
2217
|
}
|
|
2128
2218
|
)
|
|
2129
2219
|
] }),
|
|
2130
|
-
/* @__PURE__ */ i("div", { className: "grid grid-cols-12 gap-4", children:
|
|
2131
|
-
const p = `${e}.${
|
|
2220
|
+
/* @__PURE__ */ i("div", { className: "grid grid-cols-12 gap-4", children: v.map((g) => {
|
|
2221
|
+
const p = `${e}.${E}.${g.nome}`, _ = `span ${g.tamanho ?? 12}`, x = /* @__PURE__ */ i(
|
|
2132
2222
|
xs,
|
|
2133
2223
|
{
|
|
2134
2224
|
field: g,
|
|
@@ -2140,21 +2230,21 @@ const ss = {
|
|
|
2140
2230
|
"div",
|
|
2141
2231
|
{
|
|
2142
2232
|
className: "max-sm:!col-span-12",
|
|
2143
|
-
style: { gridColumn:
|
|
2144
|
-
children:
|
|
2233
|
+
style: { gridColumn: _ },
|
|
2234
|
+
children: x
|
|
2145
2235
|
},
|
|
2146
2236
|
g.id
|
|
2147
2237
|
) : /* @__PURE__ */ m(
|
|
2148
2238
|
"div",
|
|
2149
2239
|
{
|
|
2150
2240
|
className: "max-sm:!col-span-12 space-y-2",
|
|
2151
|
-
style: { gridColumn:
|
|
2241
|
+
style: { gridColumn: _ },
|
|
2152
2242
|
children: [
|
|
2153
2243
|
/* @__PURE__ */ m("label", { className: "sfr-label font-medium flex items-center gap-1 text-sm", children: [
|
|
2154
2244
|
g.label,
|
|
2155
2245
|
g.obrigatorio && /* @__PURE__ */ i("span", { className: "sfr-required", children: "*" })
|
|
2156
2246
|
] }),
|
|
2157
|
-
|
|
2247
|
+
x,
|
|
2158
2248
|
g.hint && /* @__PURE__ */ i("p", { className: "sfr-hint text-xs", children: g.hint })
|
|
2159
2249
|
]
|
|
2160
2250
|
},
|
|
@@ -2163,16 +2253,16 @@ const ss = {
|
|
|
2163
2253
|
}) })
|
|
2164
2254
|
]
|
|
2165
2255
|
},
|
|
2166
|
-
|
|
2256
|
+
w.id
|
|
2167
2257
|
)),
|
|
2168
|
-
|
|
2258
|
+
y && /* @__PURE__ */ m(
|
|
2169
2259
|
"button",
|
|
2170
2260
|
{
|
|
2171
2261
|
type: "button",
|
|
2172
2262
|
className: "sfr-btn sfr-btn--outline w-full flex items-center justify-center gap-2 py-2 px-4 border rounded-lg text-sm",
|
|
2173
2263
|
onClick: () => l({}),
|
|
2174
2264
|
children: [
|
|
2175
|
-
/* @__PURE__ */ i(
|
|
2265
|
+
/* @__PURE__ */ i(br, { className: "w-4 h-4" }),
|
|
2176
2266
|
N
|
|
2177
2267
|
]
|
|
2178
2268
|
}
|
|
@@ -2185,11 +2275,11 @@ const ss = {
|
|
|
2185
2275
|
s > 1 ? "s" : ""
|
|
2186
2276
|
] }),
|
|
2187
2277
|
u && /* @__PURE__ */ m("p", { className: "sfr-error text-sm flex items-center gap-1", children: [
|
|
2188
|
-
/* @__PURE__ */ i(
|
|
2278
|
+
/* @__PURE__ */ i(Nr, { className: "w-4 h-4 shrink-0" }),
|
|
2189
2279
|
u
|
|
2190
2280
|
] })
|
|
2191
2281
|
] });
|
|
2192
|
-
},
|
|
2282
|
+
}, dr = (e) => `R$ ${(e / 100).toFixed(2).replace(".", ",")}`, Cs = (e, r) => {
|
|
2193
2283
|
const n = /* @__PURE__ */ new Date(e.slice(0, 10) + "T00:00:00Z"), t = /* @__PURE__ */ new Date(r.slice(0, 10) + "T00:00:00Z");
|
|
2194
2284
|
return Math.round((t.getTime() - n.getTime()) / 864e5) + 1;
|
|
2195
2285
|
}, zs = (e, r) => {
|
|
@@ -2212,39 +2302,39 @@ const ss = {
|
|
|
2212
2302
|
return `${n(e)} a ${n(r)}`;
|
|
2213
2303
|
}, Os = ({ name: e, control: r }) => {
|
|
2214
2304
|
var ue;
|
|
2215
|
-
const { field: n, fieldState: t } = P({ name: e, control: r }), { externalData: s = {} } = ne(), o = n.value ?? null, a = (ue = t.error) == null ? void 0 : ue.message, c = (
|
|
2216
|
-
|
|
2217
|
-
const
|
|
2218
|
-
|
|
2219
|
-
var
|
|
2220
|
-
|
|
2221
|
-
tipo: ((
|
|
2222
|
-
data: ((
|
|
2223
|
-
genero:
|
|
2305
|
+
const { field: n, fieldState: t } = P({ name: e, control: r }), { externalData: s = {} } = ne(), o = n.value ?? null, a = (ue = t.error) == null ? void 0 : ue.message, c = (C) => s[`evento.${C}`] ?? s[C], l = c("dataInicioEvento") ?? "", d = c("dataFimEvento") ?? "", f = Number(c("valor") ?? 0), u = Number(c("valorPorDia") ?? 0), v = c("vagasTotal"), y = c("vagasPorDia"), N = c("vagasMasculinas"), b = c("vagasFemininas"), w = v != null ? Number(v) : null, E = y != null ? Number(y) : null, g = N != null ? Number(N) : null, p = b != null ? Number(b) : null, T = l && d ? zs(l, d) : [], x = (l && d ? Cs(l, d) : 0) > 1, S = g != null && g > 0 && p != null && p > 0, z = g != null && p == null ? "masculino" : p != null && g == null ? "feminino" : null, I = (o == null ? void 0 : o.tipo) ?? null, D = (o == null ? void 0 : o.data) ?? null, V = (o == null ? void 0 : o.genero) ?? null, B = te(o);
|
|
2306
|
+
B.current = o;
|
|
2307
|
+
const U = te(n.onChange);
|
|
2308
|
+
U.current = n.onChange, G(() => {
|
|
2309
|
+
var C, A, q;
|
|
2310
|
+
z && ((C = B.current) == null ? void 0 : C.genero) !== z && U.current({
|
|
2311
|
+
tipo: ((A = B.current) == null ? void 0 : A.tipo) ?? null,
|
|
2312
|
+
data: ((q = B.current) == null ? void 0 : q.data) ?? null,
|
|
2313
|
+
genero: z
|
|
2224
2314
|
});
|
|
2225
|
-
}, [
|
|
2226
|
-
const re = (
|
|
2227
|
-
const
|
|
2228
|
-
(
|
|
2229
|
-
},
|
|
2230
|
-
const
|
|
2231
|
-
(
|
|
2232
|
-
}, Q = (
|
|
2233
|
-
n.onChange({ tipo:
|
|
2234
|
-
}, W = (
|
|
2315
|
+
}, [z]);
|
|
2316
|
+
const re = (C) => {
|
|
2317
|
+
const A = { tipo: C, data: null };
|
|
2318
|
+
(S || z) && (A.genero = V ?? z ?? void 0), n.onChange(A);
|
|
2319
|
+
}, J = (C) => {
|
|
2320
|
+
const A = { tipo: "por_dia", data: C };
|
|
2321
|
+
(S || z) && (A.genero = V ?? z ?? void 0), n.onChange(A);
|
|
2322
|
+
}, Q = (C) => {
|
|
2323
|
+
n.onChange({ tipo: I, data: D, genero: C });
|
|
2324
|
+
}, W = (C) => I === C;
|
|
2235
2325
|
return /* @__PURE__ */ m("div", { className: "sfr-participation-type space-y-3", children: [
|
|
2236
|
-
|
|
2326
|
+
S && /* @__PURE__ */ m("div", { className: "flex items-center gap-2 px-1", children: [
|
|
2237
2327
|
/* @__PURE__ */ i("span", { className: "text-xs sfr-text-muted shrink-0", children: "Você é:" }),
|
|
2238
|
-
/* @__PURE__ */ i("div", { className: "flex gap-2", children: ["masculino", "feminino"].map((
|
|
2328
|
+
/* @__PURE__ */ i("div", { className: "flex gap-2", children: ["masculino", "feminino"].map((C) => /* @__PURE__ */ i(
|
|
2239
2329
|
"button",
|
|
2240
2330
|
{
|
|
2241
2331
|
type: "button",
|
|
2242
|
-
onClick: () => Q(
|
|
2332
|
+
onClick: () => Q(C),
|
|
2243
2333
|
className: "sfr-participation-type__gender-btn px-3 py-1 rounded-full text-xs font-medium border transition-all",
|
|
2244
|
-
"data-selected":
|
|
2245
|
-
children:
|
|
2334
|
+
"data-selected": V === C ? "true" : void 0,
|
|
2335
|
+
children: C === "masculino" ? "Masculino" : "Feminino"
|
|
2246
2336
|
},
|
|
2247
|
-
|
|
2337
|
+
C
|
|
2248
2338
|
)) })
|
|
2249
2339
|
] }),
|
|
2250
2340
|
/* @__PURE__ */ m(
|
|
@@ -2260,7 +2350,7 @@ const ss = {
|
|
|
2260
2350
|
{
|
|
2261
2351
|
className: "sfr-participation-type__card-icon mt-0.5 p-2 rounded-lg shrink-0",
|
|
2262
2352
|
"data-selected": W("todos_os_dias") ? "true" : void 0,
|
|
2263
|
-
children: /* @__PURE__ */ i(
|
|
2353
|
+
children: /* @__PURE__ */ i(rt, { className: "w-4 h-4" })
|
|
2264
2354
|
}
|
|
2265
2355
|
),
|
|
2266
2356
|
/* @__PURE__ */ m("div", { className: "flex-1 min-w-0", children: [
|
|
@@ -2273,19 +2363,19 @@ const ss = {
|
|
|
2273
2363
|
{
|
|
2274
2364
|
className: "font-bold text-sm sfr-participation-type__price",
|
|
2275
2365
|
"data-selected": W("todos_os_dias") ? "true" : void 0,
|
|
2276
|
-
children:
|
|
2366
|
+
children: dr(f)
|
|
2277
2367
|
}
|
|
2278
2368
|
),
|
|
2279
|
-
|
|
2280
|
-
/* @__PURE__ */ i(
|
|
2281
|
-
|
|
2369
|
+
w != null && w > 0 && /* @__PURE__ */ m("p", { className: "text-xs flex items-center justify-end gap-1 sfr-participation-type__vagas", children: [
|
|
2370
|
+
/* @__PURE__ */ i(tt, { className: "w-3 h-3" }),
|
|
2371
|
+
w,
|
|
2282
2372
|
" vagas disponíveis"
|
|
2283
2373
|
] })
|
|
2284
2374
|
] })
|
|
2285
2375
|
]
|
|
2286
2376
|
}
|
|
2287
2377
|
),
|
|
2288
|
-
|
|
2378
|
+
x ? /* @__PURE__ */ m(
|
|
2289
2379
|
"button",
|
|
2290
2380
|
{
|
|
2291
2381
|
type: "button",
|
|
@@ -2298,7 +2388,7 @@ const ss = {
|
|
|
2298
2388
|
{
|
|
2299
2389
|
className: "sfr-participation-type__card-icon mt-0.5 p-2 rounded-lg shrink-0",
|
|
2300
2390
|
"data-selected": W("por_dia") ? "true" : void 0,
|
|
2301
|
-
children: /* @__PURE__ */ i(
|
|
2391
|
+
children: /* @__PURE__ */ i(nt, { className: "w-4 h-4" })
|
|
2302
2392
|
}
|
|
2303
2393
|
),
|
|
2304
2394
|
/* @__PURE__ */ m("div", { className: "flex-1 min-w-0", children: [
|
|
@@ -2311,7 +2401,7 @@ const ss = {
|
|
|
2311
2401
|
{
|
|
2312
2402
|
className: "font-bold text-sm sfr-participation-type__price",
|
|
2313
2403
|
"data-selected": W("por_dia") ? "true" : void 0,
|
|
2314
|
-
children:
|
|
2404
|
+
children: dr(u)
|
|
2315
2405
|
}
|
|
2316
2406
|
),
|
|
2317
2407
|
/* @__PURE__ */ i("p", { className: "text-xs sfr-text-muted", children: "por dia" })
|
|
@@ -2319,42 +2409,42 @@ const ss = {
|
|
|
2319
2409
|
]
|
|
2320
2410
|
}
|
|
2321
2411
|
) : l ? /* @__PURE__ */ m("div", { className: "flex items-start gap-2 px-3 py-2.5 rounded-lg border sfr-participation-type__notice", children: [
|
|
2322
|
-
/* @__PURE__ */ i(
|
|
2412
|
+
/* @__PURE__ */ i(_r, { className: "w-3.5 h-3.5 mt-0.5 shrink-0 sfr-text-muted" }),
|
|
2323
2413
|
/* @__PURE__ */ i("p", { className: "text-xs sfr-text-muted", children: 'Este evento ocorre em apenas 1 dia — a opção "Participar um dia" não é necessária.' })
|
|
2324
2414
|
] }) : null,
|
|
2325
|
-
|
|
2415
|
+
I === "por_dia" && /* @__PURE__ */ m("div", { className: "pl-2 space-y-2 sfr-participation-type__days", children: [
|
|
2326
2416
|
/* @__PURE__ */ i("p", { className: "text-xs font-semibold uppercase tracking-wide sfr-primary-text", children: "Selecione o dia:" }),
|
|
2327
|
-
|
|
2417
|
+
T.length === 0 ? /* @__PURE__ */ i("p", { className: "text-xs sfr-text-muted italic", children: "Nenhuma data configurada no evento" }) : T.map((C) => /* @__PURE__ */ m(
|
|
2328
2418
|
"button",
|
|
2329
2419
|
{
|
|
2330
2420
|
type: "button",
|
|
2331
|
-
onClick: () =>
|
|
2421
|
+
onClick: () => J(C),
|
|
2332
2422
|
className: "sfr-participation-type__day-btn w-full text-left flex items-center justify-between px-4 py-3 rounded-lg border transition-all",
|
|
2333
|
-
"data-selected":
|
|
2423
|
+
"data-selected": D === C ? "true" : void 0,
|
|
2334
2424
|
children: [
|
|
2335
2425
|
/* @__PURE__ */ m("div", { className: "flex items-center gap-3", children: [
|
|
2336
2426
|
/* @__PURE__ */ i(
|
|
2337
2427
|
"span",
|
|
2338
2428
|
{
|
|
2339
2429
|
className: "w-4 h-4 rounded-full border-2 shrink-0 flex items-center justify-center sfr-participation-type__day-radio",
|
|
2340
|
-
"data-selected":
|
|
2341
|
-
children:
|
|
2430
|
+
"data-selected": D === C ? "true" : void 0,
|
|
2431
|
+
children: D === C && /* @__PURE__ */ i("span", { className: "w-2 h-2 rounded-full bg-white" })
|
|
2342
2432
|
}
|
|
2343
2433
|
),
|
|
2344
|
-
/* @__PURE__ */ i("span", { className: "text-sm", children: Es(
|
|
2434
|
+
/* @__PURE__ */ i("span", { className: "text-sm", children: Es(C) })
|
|
2345
2435
|
] }),
|
|
2346
|
-
|
|
2347
|
-
|
|
2436
|
+
E != null && /* @__PURE__ */ m("span", { className: "text-xs sfr-participation-type__vagas", children: [
|
|
2437
|
+
E,
|
|
2348
2438
|
" vagas"
|
|
2349
2439
|
] })
|
|
2350
2440
|
]
|
|
2351
2441
|
},
|
|
2352
|
-
|
|
2442
|
+
C
|
|
2353
2443
|
))
|
|
2354
2444
|
] }),
|
|
2355
2445
|
a && /* @__PURE__ */ i("p", { className: "text-sm sfr-error", children: a })
|
|
2356
2446
|
] });
|
|
2357
|
-
},
|
|
2447
|
+
}, ur = 0.0315, fr = 0.124, mr = 7, pr = 12, Ts = [
|
|
2358
2448
|
{
|
|
2359
2449
|
id: "pix",
|
|
2360
2450
|
label: "PIX",
|
|
@@ -2366,16 +2456,16 @@ const ss = {
|
|
|
2366
2456
|
id: "dinheiro",
|
|
2367
2457
|
label: "Dinheiro",
|
|
2368
2458
|
description: "Pagamento em espécie",
|
|
2369
|
-
Icon:
|
|
2459
|
+
Icon: xr,
|
|
2370
2460
|
taxa: 0
|
|
2371
2461
|
},
|
|
2372
2462
|
{
|
|
2373
2463
|
id: "cartao",
|
|
2374
2464
|
label: "Cartão de Crédito",
|
|
2375
2465
|
description: "Débito ou crédito na maquininha",
|
|
2376
|
-
Icon:
|
|
2377
|
-
taxa:
|
|
2378
|
-
taxaLabel: `Taxa: ${(
|
|
2466
|
+
Icon: wr,
|
|
2467
|
+
taxa: ur,
|
|
2468
|
+
taxaLabel: `Taxa: ${(ur * 100).toFixed(2).replace(".", ",")}%`
|
|
2379
2469
|
}
|
|
2380
2470
|
], $s = [
|
|
2381
2471
|
{
|
|
@@ -2388,47 +2478,47 @@ const ss = {
|
|
|
2388
2478
|
{
|
|
2389
2479
|
id: "pix_parcelado",
|
|
2390
2480
|
label: "PIX Parcelado",
|
|
2391
|
-
description: `Parcelado em até ${
|
|
2481
|
+
description: `Parcelado em até ${mr}x sem juros`,
|
|
2392
2482
|
Icon: De,
|
|
2393
2483
|
taxa: 0,
|
|
2394
|
-
parcelas:
|
|
2484
|
+
parcelas: mr
|
|
2395
2485
|
},
|
|
2396
2486
|
{
|
|
2397
2487
|
id: "cartao",
|
|
2398
2488
|
label: "Cartão de Crédito",
|
|
2399
|
-
description: `Parcelado em até ${
|
|
2400
|
-
Icon:
|
|
2401
|
-
taxa:
|
|
2402
|
-
parcelas:
|
|
2403
|
-
taxaLabel: `Taxa: ${(
|
|
2489
|
+
description: `Parcelado em até ${pr}x`,
|
|
2490
|
+
Icon: wr,
|
|
2491
|
+
taxa: fr,
|
|
2492
|
+
parcelas: pr,
|
|
2493
|
+
taxaLabel: `Taxa: ${(fr * 100).toFixed(2).replace(".", ",")}%`
|
|
2404
2494
|
},
|
|
2405
2495
|
{
|
|
2406
2496
|
id: "dinheiro",
|
|
2407
2497
|
label: "Dinheiro",
|
|
2408
2498
|
description: "Pagamento em espécie",
|
|
2409
|
-
Icon:
|
|
2499
|
+
Icon: xr,
|
|
2410
2500
|
taxa: 0
|
|
2411
2501
|
}
|
|
2412
|
-
], ze = (e) => `R$ ${(e / 100).toFixed(2).replace(".", ",")}`,
|
|
2502
|
+
], ze = (e) => `R$ ${(e / 100).toFixed(2).replace(".", ",")}`, hr = (e, r) => Math.round(e * (1 + r) * 100) / 100, ks = (e, r) => Math.round(e / r * 100) / 100, Ps = ({
|
|
2413
2503
|
name: e,
|
|
2414
2504
|
control: r,
|
|
2415
2505
|
relatedFieldName: n = "tipo_participacao"
|
|
2416
2506
|
}) => {
|
|
2417
2507
|
var g;
|
|
2418
|
-
const { field: t, fieldState: s } = P({ name: e, control: r }), { externalData: o = {}, paymentMethodOptions: a } = ne(), c = t.value ?? null, l = (g = s.error) == null ? void 0 : g.message, d = de({ control: r, name: n }), f = (d == null ? void 0 : d.tipo) ?? null, u = (p) => o[`evento.${p}`] ?? o[p],
|
|
2508
|
+
const { field: t, fieldState: s } = P({ name: e, control: r }), { externalData: o = {}, paymentMethodOptions: a } = ne(), c = t.value ?? null, l = (g = s.error) == null ? void 0 : g.message, d = de({ control: r, name: n }), f = (d == null ? void 0 : d.tipo) ?? null, u = (p) => o[`evento.${p}`] ?? o[p], v = Number(u("valor") ?? 0), y = Number(u("valorPorDia") ?? 0), N = f === "por_dia" && y > 0 ? y : v, b = f === "por_dia" ? (a == null ? void 0 : a.porDia) ?? Ts : (a == null ? void 0 : a.todosOsDias) ?? $s, w = f === "por_dia" ? (() => {
|
|
2419
2509
|
if (!(d != null && d.data)) return "Um dia";
|
|
2420
|
-
const [p,
|
|
2421
|
-
return `${
|
|
2422
|
-
})() : "Todos os dias",
|
|
2510
|
+
const [p, T, _] = d.data.split("-");
|
|
2511
|
+
return `${_}/${T}/${p}`;
|
|
2512
|
+
})() : "Todos os dias", E = (p) => {
|
|
2423
2513
|
if (p.disabled) return;
|
|
2424
|
-
const
|
|
2425
|
-
p.parcelas && (
|
|
2514
|
+
const T = hr(N, p.taxa), _ = { metodo: p.id, valorTotal: T };
|
|
2515
|
+
p.parcelas && (_.parcelas = p.parcelas), t.onChange(_);
|
|
2426
2516
|
};
|
|
2427
2517
|
return /* @__PURE__ */ m("div", { className: "sfr-payment-method space-y-4", children: [
|
|
2428
2518
|
/* @__PURE__ */ m("div", { className: "sfr-payment-method__summary flex items-center justify-between rounded-xl border px-4 py-3", children: [
|
|
2429
2519
|
/* @__PURE__ */ m("div", { children: [
|
|
2430
2520
|
/* @__PURE__ */ i("p", { className: "text-xs sfr-text-muted", children: "Tipo de participação" }),
|
|
2431
|
-
/* @__PURE__ */ i("p", { className: "font-semibold", children:
|
|
2521
|
+
/* @__PURE__ */ i("p", { className: "font-semibold", children: w })
|
|
2432
2522
|
] }),
|
|
2433
2523
|
/* @__PURE__ */ m("div", { className: "text-right", children: [
|
|
2434
2524
|
/* @__PURE__ */ i("p", { className: "text-xs sfr-text-muted", children: "Valor base" }),
|
|
@@ -2436,7 +2526,7 @@ const ss = {
|
|
|
2436
2526
|
] })
|
|
2437
2527
|
] }),
|
|
2438
2528
|
/* @__PURE__ */ m("div", { className: "sfr-payment-method__notice flex items-start gap-2 rounded-lg border px-3 py-2.5", children: [
|
|
2439
|
-
/* @__PURE__ */ i(
|
|
2529
|
+
/* @__PURE__ */ i(_r, { className: "h-4 w-4 mt-0.5 shrink-0" }),
|
|
2440
2530
|
/* @__PURE__ */ m("p", { className: "text-xs", children: [
|
|
2441
2531
|
/* @__PURE__ */ i("span", { className: "font-bold", children: "Importante:" }),
|
|
2442
2532
|
" Para validar a inscrição e garantir sua vaga, o pagamento deve ser realizado no ato da inscrição."
|
|
@@ -2444,23 +2534,23 @@ const ss = {
|
|
|
2444
2534
|
] }),
|
|
2445
2535
|
/* @__PURE__ */ i("p", { className: "text-sm font-semibold sfr-primary-text", children: "Selecione a forma de pagamento:" }),
|
|
2446
2536
|
/* @__PURE__ */ i("div", { className: "space-y-3", children: b.map((p) => {
|
|
2447
|
-
const { Icon:
|
|
2537
|
+
const { Icon: T } = p, _ = (c == null ? void 0 : c.metodo) === p.id, x = hr(N, p.taxa), S = !!p.parcelas && p.parcelas > 1, z = S ? ks(x, p.parcelas) : null;
|
|
2448
2538
|
return /* @__PURE__ */ m(
|
|
2449
2539
|
"button",
|
|
2450
2540
|
{
|
|
2451
2541
|
type: "button",
|
|
2452
2542
|
disabled: p.disabled,
|
|
2453
|
-
onClick: () =>
|
|
2543
|
+
onClick: () => E(p),
|
|
2454
2544
|
className: "sfr-payment-method__card w-full text-left flex items-center gap-4 px-4 py-3 rounded-xl border-2 transition-all",
|
|
2455
|
-
"data-selected":
|
|
2545
|
+
"data-selected": _ ? "true" : void 0,
|
|
2456
2546
|
"data-disabled": p.disabled ? "true" : void 0,
|
|
2457
2547
|
children: [
|
|
2458
2548
|
/* @__PURE__ */ i(
|
|
2459
2549
|
"div",
|
|
2460
2550
|
{
|
|
2461
2551
|
className: "sfr-payment-method__card-icon flex items-center justify-center w-10 h-10 rounded-lg shrink-0",
|
|
2462
|
-
"data-selected":
|
|
2463
|
-
children: /* @__PURE__ */ i(
|
|
2552
|
+
"data-selected": _ ? "true" : void 0,
|
|
2553
|
+
children: /* @__PURE__ */ i(T, { className: "h-5 w-5" })
|
|
2464
2554
|
}
|
|
2465
2555
|
),
|
|
2466
2556
|
/* @__PURE__ */ m("div", { className: "flex-1 min-w-0", children: [
|
|
@@ -2472,16 +2562,16 @@ const ss = {
|
|
|
2472
2562
|
] }),
|
|
2473
2563
|
p.taxa > 0 && /* @__PURE__ */ m("p", { className: "text-xs sfr-text-muted", children: [
|
|
2474
2564
|
"Total com taxa: ",
|
|
2475
|
-
ze(
|
|
2565
|
+
ze(x)
|
|
2476
2566
|
] })
|
|
2477
2567
|
] }),
|
|
2478
|
-
/* @__PURE__ */ i("div", { className: "text-right shrink-0", children:
|
|
2568
|
+
/* @__PURE__ */ i("div", { className: "text-right shrink-0", children: S ? /* @__PURE__ */ m(Ee, { children: [
|
|
2479
2569
|
/* @__PURE__ */ m("p", { className: "text-xs sfr-text-muted", children: [
|
|
2480
2570
|
p.parcelas,
|
|
2481
2571
|
"x de"
|
|
2482
2572
|
] }),
|
|
2483
|
-
/* @__PURE__ */ i("p", { className: "text-base font-bold sfr-primary-text", children: ze(
|
|
2484
|
-
] }) : /* @__PURE__ */ i("p", { className: "text-base font-bold sfr-primary-text", children: ze(
|
|
2573
|
+
/* @__PURE__ */ i("p", { className: "text-base font-bold sfr-primary-text", children: ze(z) })
|
|
2574
|
+
] }) : /* @__PURE__ */ i("p", { className: "text-base font-bold sfr-primary-text", children: ze(x) }) })
|
|
2485
2575
|
]
|
|
2486
2576
|
},
|
|
2487
2577
|
p.id
|
|
@@ -2497,22 +2587,22 @@ const ss = {
|
|
|
2497
2587
|
termoPdfUrl: s,
|
|
2498
2588
|
termoPdfUploadId: o
|
|
2499
2589
|
}) => {
|
|
2500
|
-
var
|
|
2501
|
-
const { field: a, fieldState: c } = P({ name: e, control: r }), { resolveTermsUploadUrl: l } = ne(), d = !!c.error, f = (
|
|
2502
|
-
|
|
2590
|
+
var S;
|
|
2591
|
+
const { field: a, fieldState: c } = P({ name: e, control: r }), { resolveTermsUploadUrl: l } = ne(), d = !!c.error, f = (S = c.error) == null ? void 0 : S.message, [u, v] = R(null), [y, N] = R(!1), [b, w] = R(!1);
|
|
2592
|
+
G(() => {
|
|
2503
2593
|
if (!o || !l) {
|
|
2504
|
-
|
|
2594
|
+
v(null);
|
|
2505
2595
|
return;
|
|
2506
2596
|
}
|
|
2507
|
-
N(!0), l(o).then((
|
|
2597
|
+
N(!0), l(o).then((z) => v(z)).catch(() => v(null)).finally(() => N(!1));
|
|
2508
2598
|
}, [o, l]);
|
|
2509
|
-
const
|
|
2599
|
+
const E = a.value === "accepted", g = u || s || null, p = !!(t || g || o), T = !!g;
|
|
2510
2600
|
return /* @__PURE__ */ m("div", { className: "sfr-terms space-y-2", children: [
|
|
2511
2601
|
/* @__PURE__ */ m(
|
|
2512
2602
|
"div",
|
|
2513
2603
|
{
|
|
2514
2604
|
className: "sfr-terms__box rounded-lg border p-4 space-y-4",
|
|
2515
|
-
style: { borderColor: d ? "var(--sfr-error, #ef4444)" :
|
|
2605
|
+
style: { borderColor: d ? "var(--sfr-error, #ef4444)" : E ? "var(--sfr-success, #22c55e)" : "var(--sfr-border, #e2e8f0)", background: d ? "color-mix(in srgb, var(--sfr-error, #ef4444) 5%, transparent)" : E ? "color-mix(in srgb, var(--sfr-success, #22c55e) 5%, transparent)" : "transparent" },
|
|
2516
2606
|
children: [
|
|
2517
2607
|
/* @__PURE__ */ m("div", { className: "flex items-center justify-between gap-2", children: [
|
|
2518
2608
|
/* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
|
|
@@ -2524,14 +2614,14 @@ const ss = {
|
|
|
2524
2614
|
{
|
|
2525
2615
|
type: "button",
|
|
2526
2616
|
className: "sfr-btn sfr-btn--outline flex items-center gap-1.5 text-xs h-7 px-2 border rounded",
|
|
2527
|
-
disabled:
|
|
2528
|
-
onClick: () =>
|
|
2617
|
+
disabled: y,
|
|
2618
|
+
onClick: () => w(!0),
|
|
2529
2619
|
children: [
|
|
2530
|
-
|
|
2620
|
+
y ? /* @__PURE__ */ i(Cr, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ i(st, { className: "h-3 w-3" }),
|
|
2531
2621
|
"Ler termos"
|
|
2532
2622
|
]
|
|
2533
2623
|
}
|
|
2534
|
-
) : /* @__PURE__ */ i("span", { className: "text-xs sfr-text-muted italic", children: o &&
|
|
2624
|
+
) : /* @__PURE__ */ i("span", { className: "text-xs sfr-text-muted italic", children: o && y ? "Carregando PDF..." : "Conteúdo não configurado" })
|
|
2535
2625
|
] }),
|
|
2536
2626
|
/* @__PURE__ */ m("label", { className: "flex items-start gap-3 cursor-pointer select-none", children: [
|
|
2537
2627
|
/* @__PURE__ */ i(
|
|
@@ -2539,8 +2629,8 @@ const ss = {
|
|
|
2539
2629
|
{
|
|
2540
2630
|
type: "checkbox",
|
|
2541
2631
|
className: "sfr-checkbox mt-0.5",
|
|
2542
|
-
checked:
|
|
2543
|
-
onChange: (
|
|
2632
|
+
checked: E,
|
|
2633
|
+
onChange: (z) => a.onChange(z.target.checked ? "accepted" : ""),
|
|
2544
2634
|
style: d ? { outline: "1px solid var(--sfr-error, #ef4444)" } : {}
|
|
2545
2635
|
}
|
|
2546
2636
|
),
|
|
@@ -2548,13 +2638,13 @@ const ss = {
|
|
|
2548
2638
|
"Li e aceito ",
|
|
2549
2639
|
n ? `"${n}"` : "os termos e condições"
|
|
2550
2640
|
] }),
|
|
2551
|
-
|
|
2641
|
+
E && /* @__PURE__ */ i(ot, { className: "h-4 w-4 sfr-terms__check shrink-0 mt-0.5" })
|
|
2552
2642
|
] })
|
|
2553
2643
|
]
|
|
2554
2644
|
}
|
|
2555
2645
|
),
|
|
2556
2646
|
d && /* @__PURE__ */ m("div", { className: "flex items-center gap-1.5 text-xs sfr-error", children: [
|
|
2557
|
-
/* @__PURE__ */ i(
|
|
2647
|
+
/* @__PURE__ */ i(Nr, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
2558
2648
|
f || "Você precisa aceitar os termos para continuar"
|
|
2559
2649
|
] }),
|
|
2560
2650
|
b && /* @__PURE__ */ i(
|
|
@@ -2562,13 +2652,13 @@ const ss = {
|
|
|
2562
2652
|
{
|
|
2563
2653
|
className: "sfr-modal-backdrop fixed inset-0 z-50 flex items-center justify-center p-4",
|
|
2564
2654
|
style: { background: "rgba(0,0,0,0.6)" },
|
|
2565
|
-
onClick: () =>
|
|
2655
|
+
onClick: () => w(!1),
|
|
2566
2656
|
children: /* @__PURE__ */ m(
|
|
2567
2657
|
"div",
|
|
2568
2658
|
{
|
|
2569
2659
|
className: "sfr-modal relative w-full max-w-2xl max-h-[90vh] rounded-xl overflow-hidden flex flex-col",
|
|
2570
2660
|
style: { background: "var(--sfr-surface, #ffffff)" },
|
|
2571
|
-
onClick: (
|
|
2661
|
+
onClick: (z) => z.stopPropagation(),
|
|
2572
2662
|
children: [
|
|
2573
2663
|
/* @__PURE__ */ m("div", { className: "flex items-center justify-between px-6 py-4 border-b sfr-modal__header", children: [
|
|
2574
2664
|
/* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
|
|
@@ -2580,12 +2670,12 @@ const ss = {
|
|
|
2580
2670
|
{
|
|
2581
2671
|
type: "button",
|
|
2582
2672
|
className: "sfr-btn sfr-btn--ghost",
|
|
2583
|
-
onClick: () =>
|
|
2584
|
-
children: /* @__PURE__ */ i(
|
|
2673
|
+
onClick: () => w(!1),
|
|
2674
|
+
children: /* @__PURE__ */ i(zr, { className: "h-4 w-4" })
|
|
2585
2675
|
}
|
|
2586
2676
|
)
|
|
2587
2677
|
] }),
|
|
2588
|
-
/* @__PURE__ */ i("div", { className: "flex-1 overflow-auto p-4", children:
|
|
2678
|
+
/* @__PURE__ */ i("div", { className: "flex-1 overflow-auto p-4", children: T ? /* @__PURE__ */ i(
|
|
2589
2679
|
"iframe",
|
|
2590
2680
|
{
|
|
2591
2681
|
src: g,
|
|
@@ -2609,7 +2699,7 @@ const ss = {
|
|
|
2609
2699
|
readOnly: s
|
|
2610
2700
|
}) => {
|
|
2611
2701
|
var f;
|
|
2612
|
-
const { field: o, fieldState: a } = P({ name: e, control: r }), [c, l] =
|
|
2702
|
+
const { field: o, fieldState: a } = P({ name: e, control: r }), [c, l] = R(!1), d = !!a.error;
|
|
2613
2703
|
return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
|
|
2614
2704
|
/* @__PURE__ */ m("div", { className: "relative", children: [
|
|
2615
2705
|
/* @__PURE__ */ i(
|
|
@@ -2633,13 +2723,13 @@ const ss = {
|
|
|
2633
2723
|
onClick: () => l((u) => !u),
|
|
2634
2724
|
className: "absolute right-3 top-1/2 -translate-y-1/2 text-[var(--t-text-muted)] hover:text-[var(--t-text)] transition-colors",
|
|
2635
2725
|
"aria-label": c ? "Ocultar senha" : "Mostrar senha",
|
|
2636
|
-
children: c ? /* @__PURE__ */ i(
|
|
2726
|
+
children: c ? /* @__PURE__ */ i(at, { size: 16 }) : /* @__PURE__ */ i(it, { size: 16 })
|
|
2637
2727
|
}
|
|
2638
2728
|
)
|
|
2639
2729
|
] }),
|
|
2640
2730
|
((f = a.error) == null ? void 0 : f.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: a.error.message })
|
|
2641
2731
|
] });
|
|
2642
|
-
},
|
|
2732
|
+
}, Br = ({
|
|
2643
2733
|
name: e,
|
|
2644
2734
|
control: r,
|
|
2645
2735
|
label: n,
|
|
@@ -2687,7 +2777,7 @@ const ss = {
|
|
|
2687
2777
|
disabled: o,
|
|
2688
2778
|
readOnly: a
|
|
2689
2779
|
}) => {
|
|
2690
|
-
var
|
|
2780
|
+
var v;
|
|
2691
2781
|
const { field: c, fieldState: l } = P({ name: e, control: r }), d = c.value ?? n, f = t - n, u = f > 0 ? (d - n) / f * 100 : 0;
|
|
2692
2782
|
return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
|
|
2693
2783
|
/* @__PURE__ */ m("div", { className: "flex items-center gap-3", children: [
|
|
@@ -2700,7 +2790,7 @@ const ss = {
|
|
|
2700
2790
|
step: s,
|
|
2701
2791
|
value: d,
|
|
2702
2792
|
disabled: o || a,
|
|
2703
|
-
onChange: (
|
|
2793
|
+
onChange: (y) => c.onChange(Number(y.target.value)),
|
|
2704
2794
|
className: "sfr-slider w-full",
|
|
2705
2795
|
style: {
|
|
2706
2796
|
"--slider-pct": `${u}%`
|
|
@@ -2727,7 +2817,7 @@ const ss = {
|
|
|
2727
2817
|
]
|
|
2728
2818
|
}
|
|
2729
2819
|
),
|
|
2730
|
-
((
|
|
2820
|
+
((v = l.error) == null ? void 0 : v.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: l.error.message })
|
|
2731
2821
|
] });
|
|
2732
2822
|
}, Rs = ({
|
|
2733
2823
|
name: e,
|
|
@@ -2777,28 +2867,28 @@ const ss = {
|
|
|
2777
2867
|
disabled: s,
|
|
2778
2868
|
readOnly: o
|
|
2779
2869
|
}) => {
|
|
2780
|
-
var
|
|
2781
|
-
const { field: a, fieldState: c } = P({ name: e, control: r }), [l, d] =
|
|
2870
|
+
var E, g;
|
|
2871
|
+
const { field: a, fieldState: c } = P({ name: e, control: r }), [l, d] = R(""), [f, u] = R(!1), v = te(null), y = ((E = n.find((p) => p.valor === a.value)) == null ? void 0 : E.label) ?? "", N = l.length > 0 ? n.filter(
|
|
2782
2872
|
(p) => p.label.toLowerCase().includes(l.toLowerCase())
|
|
2783
2873
|
) : n;
|
|
2784
|
-
|
|
2785
|
-
const p = (
|
|
2786
|
-
|
|
2874
|
+
G(() => {
|
|
2875
|
+
const p = (T) => {
|
|
2876
|
+
v.current && !v.current.contains(T.target) && (u(!1), d(""));
|
|
2787
2877
|
};
|
|
2788
2878
|
return document.addEventListener("mousedown", p), () => document.removeEventListener("mousedown", p);
|
|
2789
2879
|
}, []);
|
|
2790
2880
|
const b = (p) => {
|
|
2791
2881
|
p.disabled || (a.onChange(p.valor), u(!1), d(""));
|
|
2792
|
-
},
|
|
2882
|
+
}, w = () => {
|
|
2793
2883
|
a.onChange(""), d("");
|
|
2794
2884
|
};
|
|
2795
|
-
return /* @__PURE__ */ m("div", { className: "space-y-1", ref:
|
|
2885
|
+
return /* @__PURE__ */ m("div", { className: "space-y-1", ref: v, children: [
|
|
2796
2886
|
/* @__PURE__ */ m("div", { className: "relative", children: [
|
|
2797
2887
|
/* @__PURE__ */ i(
|
|
2798
2888
|
"input",
|
|
2799
2889
|
{
|
|
2800
2890
|
type: "text",
|
|
2801
|
-
value: f ? l :
|
|
2891
|
+
value: f ? l : y,
|
|
2802
2892
|
placeholder: t ?? "Buscar...",
|
|
2803
2893
|
disabled: s,
|
|
2804
2894
|
readOnly: o,
|
|
@@ -2815,13 +2905,13 @@ const ss = {
|
|
|
2815
2905
|
"button",
|
|
2816
2906
|
{
|
|
2817
2907
|
type: "button",
|
|
2818
|
-
onClick:
|
|
2908
|
+
onClick: w,
|
|
2819
2909
|
className: "text-[var(--t-text-muted)] hover:text-[var(--t-text)]",
|
|
2820
2910
|
tabIndex: -1,
|
|
2821
|
-
children: /* @__PURE__ */ i(
|
|
2911
|
+
children: /* @__PURE__ */ i(zr, { size: 14 })
|
|
2822
2912
|
}
|
|
2823
2913
|
) : /* @__PURE__ */ i(
|
|
2824
|
-
|
|
2914
|
+
ct,
|
|
2825
2915
|
{
|
|
2826
2916
|
size: 16,
|
|
2827
2917
|
className: "text-[var(--t-text-muted)] pointer-events-none"
|
|
@@ -2843,7 +2933,7 @@ const ss = {
|
|
|
2843
2933
|
] }),
|
|
2844
2934
|
((g = c.error) == null ? void 0 : g.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: c.error.message })
|
|
2845
2935
|
] });
|
|
2846
|
-
},
|
|
2936
|
+
}, Ur = ({
|
|
2847
2937
|
name: e,
|
|
2848
2938
|
control: r,
|
|
2849
2939
|
placeholder: n,
|
|
@@ -2877,8 +2967,8 @@ const ss = {
|
|
|
2877
2967
|
readOnly: o
|
|
2878
2968
|
}) => {
|
|
2879
2969
|
var u;
|
|
2880
|
-
const { field: a, fieldState: c } = P({ name: e, control: r }), l = a.value ?? {}, d = (
|
|
2881
|
-
a.onChange({ ...l, [
|
|
2970
|
+
const { field: a, fieldState: c } = P({ name: e, control: r }), l = a.value ?? {}, d = (v, y) => {
|
|
2971
|
+
a.onChange({ ...l, [v]: y });
|
|
2882
2972
|
}, f = !!c.error;
|
|
2883
2973
|
return /* @__PURE__ */ m("div", { className: "space-y-2", children: [
|
|
2884
2974
|
/* @__PURE__ */ m("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
@@ -2891,7 +2981,7 @@ const ss = {
|
|
|
2891
2981
|
value: l.start ?? "",
|
|
2892
2982
|
disabled: s,
|
|
2893
2983
|
readOnly: o,
|
|
2894
|
-
onChange: (
|
|
2984
|
+
onChange: (v) => d("start", v.target.value),
|
|
2895
2985
|
max: l.end ?? void 0,
|
|
2896
2986
|
className: `sfr-input${f ? " sfr-input--error" : ""}`,
|
|
2897
2987
|
"data-sfr-field": "date-range-start"
|
|
@@ -2907,7 +2997,7 @@ const ss = {
|
|
|
2907
2997
|
value: l.end ?? "",
|
|
2908
2998
|
disabled: s,
|
|
2909
2999
|
readOnly: o,
|
|
2910
|
-
onChange: (
|
|
3000
|
+
onChange: (v) => d("end", v.target.value),
|
|
2911
3001
|
min: l.start ?? void 0,
|
|
2912
3002
|
className: `sfr-input${f ? " sfr-input--error" : ""}`,
|
|
2913
3003
|
"data-sfr-field": "date-range-end"
|
|
@@ -2937,7 +3027,7 @@ const ss = {
|
|
|
2937
3027
|
className: "transition-transform hover:scale-110 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--t-primary)] rounded",
|
|
2938
3028
|
"aria-label": `${f} estrela${f > 1 ? "s" : ""}`,
|
|
2939
3029
|
children: /* @__PURE__ */ i(
|
|
2940
|
-
|
|
3030
|
+
lt,
|
|
2941
3031
|
{
|
|
2942
3032
|
size: 24,
|
|
2943
3033
|
className: "transition-colors",
|
|
@@ -2974,7 +3064,7 @@ const ss = {
|
|
|
2974
3064
|
switch (e.tipo) {
|
|
2975
3065
|
case h.EMAIL:
|
|
2976
3066
|
return /* @__PURE__ */ i(
|
|
2977
|
-
|
|
3067
|
+
H,
|
|
2978
3068
|
{
|
|
2979
3069
|
name: r,
|
|
2980
3070
|
control: n,
|
|
@@ -2986,7 +3076,7 @@ const ss = {
|
|
|
2986
3076
|
);
|
|
2987
3077
|
case h.NUMBER:
|
|
2988
3078
|
return /* @__PURE__ */ i(
|
|
2989
|
-
|
|
3079
|
+
H,
|
|
2990
3080
|
{
|
|
2991
3081
|
name: r,
|
|
2992
3082
|
control: n,
|
|
@@ -2998,7 +3088,7 @@ const ss = {
|
|
|
2998
3088
|
);
|
|
2999
3089
|
case h.PASSWORD:
|
|
3000
3090
|
return /* @__PURE__ */ i(
|
|
3001
|
-
|
|
3091
|
+
H,
|
|
3002
3092
|
{
|
|
3003
3093
|
name: r,
|
|
3004
3094
|
control: n,
|
|
@@ -3080,7 +3170,7 @@ const ss = {
|
|
|
3080
3170
|
);
|
|
3081
3171
|
case h.SWITCH:
|
|
3082
3172
|
return /* @__PURE__ */ i(
|
|
3083
|
-
|
|
3173
|
+
Br,
|
|
3084
3174
|
{
|
|
3085
3175
|
name: r,
|
|
3086
3176
|
control: n,
|
|
@@ -3091,7 +3181,7 @@ const ss = {
|
|
|
3091
3181
|
);
|
|
3092
3182
|
case h.DATE:
|
|
3093
3183
|
return /* @__PURE__ */ i(
|
|
3094
|
-
|
|
3184
|
+
ve,
|
|
3095
3185
|
{
|
|
3096
3186
|
name: r,
|
|
3097
3187
|
control: n,
|
|
@@ -3101,7 +3191,7 @@ const ss = {
|
|
|
3101
3191
|
);
|
|
3102
3192
|
case h.TIME:
|
|
3103
3193
|
return /* @__PURE__ */ i(
|
|
3104
|
-
|
|
3194
|
+
Ur,
|
|
3105
3195
|
{
|
|
3106
3196
|
name: r,
|
|
3107
3197
|
control: n,
|
|
@@ -3113,7 +3203,7 @@ const ss = {
|
|
|
3113
3203
|
return /* @__PURE__ */ i(Xe, { name: r, control: n });
|
|
3114
3204
|
default:
|
|
3115
3205
|
return /* @__PURE__ */ i(
|
|
3116
|
-
|
|
3206
|
+
H,
|
|
3117
3207
|
{
|
|
3118
3208
|
name: r,
|
|
3119
3209
|
control: n,
|
|
@@ -3172,7 +3262,7 @@ const ss = {
|
|
|
3172
3262
|
]
|
|
3173
3263
|
}
|
|
3174
3264
|
);
|
|
3175
|
-
},
|
|
3265
|
+
}, Xr = ({
|
|
3176
3266
|
field: e,
|
|
3177
3267
|
control: r,
|
|
3178
3268
|
nameOverride: n
|
|
@@ -3190,11 +3280,11 @@ const ss = {
|
|
|
3190
3280
|
};
|
|
3191
3281
|
switch (e.tipo) {
|
|
3192
3282
|
case h.TEXTO:
|
|
3193
|
-
return /* @__PURE__ */ i(
|
|
3283
|
+
return /* @__PURE__ */ i(H, { ...a, type: "text" });
|
|
3194
3284
|
case h.EMAIL:
|
|
3195
|
-
return /* @__PURE__ */ i(
|
|
3285
|
+
return /* @__PURE__ */ i(H, { ...a, type: "email" });
|
|
3196
3286
|
case h.NUMBER:
|
|
3197
|
-
return /* @__PURE__ */ i(
|
|
3287
|
+
return /* @__PURE__ */ i(H, { ...a, type: "number" });
|
|
3198
3288
|
case h.PASSWORD:
|
|
3199
3289
|
return /* @__PURE__ */ i(As, { ...a });
|
|
3200
3290
|
case h.TEXTAREA:
|
|
@@ -3205,7 +3295,7 @@ const ss = {
|
|
|
3205
3295
|
return /* @__PURE__ */ i(Fs, { ...a, options: e.opcoes ?? [] });
|
|
3206
3296
|
case h.SWITCH:
|
|
3207
3297
|
return /* @__PURE__ */ i(
|
|
3208
|
-
|
|
3298
|
+
Br,
|
|
3209
3299
|
{
|
|
3210
3300
|
name: t,
|
|
3211
3301
|
control: r,
|
|
@@ -3249,7 +3339,7 @@ const ss = {
|
|
|
3249
3339
|
}
|
|
3250
3340
|
);
|
|
3251
3341
|
case h.TIME:
|
|
3252
|
-
return /* @__PURE__ */ i(
|
|
3342
|
+
return /* @__PURE__ */ i(Ur, { ...a });
|
|
3253
3343
|
case h.DATE_RANGE:
|
|
3254
3344
|
return /* @__PURE__ */ i(
|
|
3255
3345
|
js,
|
|
@@ -3263,7 +3353,7 @@ const ss = {
|
|
|
3263
3353
|
}
|
|
3264
3354
|
);
|
|
3265
3355
|
case h.RADIO:
|
|
3266
|
-
return /* @__PURE__ */ i(
|
|
3356
|
+
return /* @__PURE__ */ i(Lr, { ...a, options: e.opcoes ?? [] });
|
|
3267
3357
|
case h.CHECKBOX:
|
|
3268
3358
|
return /* @__PURE__ */ i(
|
|
3269
3359
|
Ue,
|
|
@@ -3276,10 +3366,10 @@ const ss = {
|
|
|
3276
3366
|
}
|
|
3277
3367
|
);
|
|
3278
3368
|
case h.CHECKBOX_GROUP:
|
|
3279
|
-
return /* @__PURE__ */ i(
|
|
3369
|
+
return /* @__PURE__ */ i(Zr, { ...a, options: e.opcoes ?? [] });
|
|
3280
3370
|
case h.DATE:
|
|
3281
3371
|
return /* @__PURE__ */ i(
|
|
3282
|
-
|
|
3372
|
+
ve,
|
|
3283
3373
|
{
|
|
3284
3374
|
name: t,
|
|
3285
3375
|
control: r,
|
|
@@ -3290,7 +3380,7 @@ const ss = {
|
|
|
3290
3380
|
);
|
|
3291
3381
|
case h.DATETIME:
|
|
3292
3382
|
return /* @__PURE__ */ i(
|
|
3293
|
-
|
|
3383
|
+
ve,
|
|
3294
3384
|
{
|
|
3295
3385
|
name: t,
|
|
3296
3386
|
control: r,
|
|
@@ -3302,7 +3392,7 @@ const ss = {
|
|
|
3302
3392
|
);
|
|
3303
3393
|
case h.FILE:
|
|
3304
3394
|
return /* @__PURE__ */ i(
|
|
3305
|
-
|
|
3395
|
+
Mr,
|
|
3306
3396
|
{
|
|
3307
3397
|
name: t,
|
|
3308
3398
|
control: r,
|
|
@@ -3317,7 +3407,7 @@ const ss = {
|
|
|
3317
3407
|
return /* @__PURE__ */ i(ie, { ...a, maskType: "cpf" });
|
|
3318
3408
|
case h.CEP:
|
|
3319
3409
|
return /* @__PURE__ */ i(
|
|
3320
|
-
|
|
3410
|
+
Jr,
|
|
3321
3411
|
{
|
|
3322
3412
|
name: t,
|
|
3323
3413
|
control: r,
|
|
@@ -3377,10 +3467,10 @@ const ss = {
|
|
|
3377
3467
|
}
|
|
3378
3468
|
);
|
|
3379
3469
|
default:
|
|
3380
|
-
return /* @__PURE__ */ i(
|
|
3470
|
+
return /* @__PURE__ */ i(H, { ...a, type: "text" });
|
|
3381
3471
|
}
|
|
3382
|
-
},
|
|
3383
|
-
const e =
|
|
3472
|
+
}, Hr = () => {
|
|
3473
|
+
const e = Yr(), r = e.layout.containerStyle, t = [
|
|
3384
3474
|
"sfr-container overflow-hidden",
|
|
3385
3475
|
e.layout.roundness ?? "rounded-xl",
|
|
3386
3476
|
r === "card" ? "sfr-container--card border" : "",
|
|
@@ -3401,49 +3491,49 @@ const ss = {
|
|
|
3401
3491
|
control: r
|
|
3402
3492
|
}) => {
|
|
3403
3493
|
var b;
|
|
3404
|
-
const { externalData: n = {} } = ne(), t = e.icone ? Te[e.icone] : void 0, s = n, o =
|
|
3494
|
+
const { externalData: n = {} } = ne(), t = e.icone ? Te[e.icone] : void 0, s = n, o = j(
|
|
3405
3495
|
() => Ve(e, s),
|
|
3406
3496
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3407
3497
|
[e, JSON.stringify(s)]
|
|
3408
|
-
), a =
|
|
3409
|
-
() => [...o.campos].sort((
|
|
3498
|
+
), a = j(
|
|
3499
|
+
() => [...o.campos].sort((w, E) => w.ordem - E.ordem),
|
|
3410
3500
|
[o.campos]
|
|
3411
|
-
), c = de({ control: r }), { fieldResolvers: l } = ne(), { wrapperClass: d, wrapperStyle: f, headerClass: u, headerStyle:
|
|
3501
|
+
), c = de({ control: r }), { fieldResolvers: l } = ne(), { wrapperClass: d, wrapperStyle: f, headerClass: u, headerStyle: v, tmpl: y } = Hr(), N = (w) => {
|
|
3412
3502
|
if (!ee(
|
|
3413
|
-
|
|
3503
|
+
w.condicional,
|
|
3414
3504
|
c,
|
|
3415
3505
|
n
|
|
3416
3506
|
)) return null;
|
|
3417
|
-
let g =
|
|
3418
|
-
if (
|
|
3419
|
-
const
|
|
3420
|
-
|
|
3507
|
+
let g = w;
|
|
3508
|
+
if (w.resolvePropsKey && (l != null && l[w.resolvePropsKey])) {
|
|
3509
|
+
const S = l[w.resolvePropsKey](
|
|
3510
|
+
w,
|
|
3421
3511
|
c,
|
|
3422
3512
|
n
|
|
3423
3513
|
);
|
|
3424
|
-
g = { ...
|
|
3514
|
+
g = { ...w, ...S };
|
|
3425
3515
|
}
|
|
3426
3516
|
if (g.opcoesFromVar) {
|
|
3427
|
-
const
|
|
3428
|
-
Array.isArray(
|
|
3517
|
+
const S = n[g.opcoesFromVar];
|
|
3518
|
+
Array.isArray(S) && (g = {
|
|
3429
3519
|
...g,
|
|
3430
|
-
opcoes:
|
|
3520
|
+
opcoes: S.map((z) => typeof z == "string" ? { valor: z, label: z } : z && typeof z == "object" && "valor" in z && "label" in z ? z : { valor: String(z), label: String(z) })
|
|
3431
3521
|
});
|
|
3432
3522
|
}
|
|
3433
|
-
const p = g.tamanho ?? 12,
|
|
3523
|
+
const p = g.tamanho ?? 12, T = g.inicioColuna, _ = T ? `${T} / span ${p}` : `span ${p}`, x = /* @__PURE__ */ i(Xr, { field: g, control: r });
|
|
3434
3524
|
return g.tipo === h.CHECKBOX || g.tipo === h.HIDDEN || g.tipo === h.SWITCH ? /* @__PURE__ */ i(
|
|
3435
3525
|
"div",
|
|
3436
3526
|
{
|
|
3437
3527
|
className: "max-sm:!col-span-12",
|
|
3438
|
-
style: { gridColumn:
|
|
3439
|
-
children:
|
|
3528
|
+
style: { gridColumn: _ },
|
|
3529
|
+
children: x
|
|
3440
3530
|
},
|
|
3441
3531
|
g.id
|
|
3442
3532
|
) : /* @__PURE__ */ m(
|
|
3443
3533
|
"div",
|
|
3444
3534
|
{
|
|
3445
3535
|
className: "max-sm:!col-span-12 space-y-2",
|
|
3446
|
-
style: { gridColumn:
|
|
3536
|
+
style: { gridColumn: _ },
|
|
3447
3537
|
children: [
|
|
3448
3538
|
/* @__PURE__ */ m(
|
|
3449
3539
|
"label",
|
|
@@ -3456,7 +3546,7 @@ const ss = {
|
|
|
3456
3546
|
]
|
|
3457
3547
|
}
|
|
3458
3548
|
),
|
|
3459
|
-
|
|
3549
|
+
x,
|
|
3460
3550
|
g.hint && /* @__PURE__ */ i(
|
|
3461
3551
|
"p",
|
|
3462
3552
|
{
|
|
@@ -3471,7 +3561,7 @@ const ss = {
|
|
|
3471
3561
|
);
|
|
3472
3562
|
};
|
|
3473
3563
|
return /* @__PURE__ */ m("div", { className: d, style: f, children: [
|
|
3474
|
-
(o.titulo || t) && /* @__PURE__ */ i("div", { className: u, style:
|
|
3564
|
+
(o.titulo || t) && /* @__PURE__ */ i("div", { className: u, style: v, children: /* @__PURE__ */ m("div", { className: "flex items-center gap-3", children: [
|
|
3475
3565
|
t && /* @__PURE__ */ i(
|
|
3476
3566
|
"div",
|
|
3477
3567
|
{
|
|
@@ -3492,7 +3582,7 @@ const ss = {
|
|
|
3492
3582
|
/* @__PURE__ */ i(
|
|
3493
3583
|
"h3",
|
|
3494
3584
|
{
|
|
3495
|
-
className: ((b =
|
|
3585
|
+
className: ((b = y.typography) == null ? void 0 : b.stepTitleClass) ?? "text-lg font-semibold",
|
|
3496
3586
|
style: { color: "var(--t-text)" },
|
|
3497
3587
|
children: o.titulo
|
|
3498
3588
|
}
|
|
@@ -3506,50 +3596,50 @@ const ss = {
|
|
|
3506
3596
|
container: e,
|
|
3507
3597
|
control: r
|
|
3508
3598
|
}) => {
|
|
3509
|
-
var
|
|
3510
|
-
const { externalData: n = {} } = ne(), t = e.nome, s = e.minItems ?? 1, o = e.maxItems, a = e.itemLabel ?? "Item", { fields: c, append: l, remove: d } =
|
|
3599
|
+
var _;
|
|
3600
|
+
const { externalData: n = {} } = ne(), t = e.nome, s = e.minItems ?? 1, o = e.maxItems, a = e.itemLabel ?? "Item", { fields: c, append: l, remove: d } = vr({
|
|
3511
3601
|
control: r,
|
|
3512
3602
|
name: t
|
|
3513
3603
|
});
|
|
3514
|
-
|
|
3604
|
+
G(() => {
|
|
3515
3605
|
if (c.length < s)
|
|
3516
|
-
for (let
|
|
3606
|
+
for (let x = c.length; x < s; x++)
|
|
3517
3607
|
l({});
|
|
3518
3608
|
}, []);
|
|
3519
|
-
const f = e.icone ? Te[e.icone] : void 0, u = n,
|
|
3609
|
+
const f = e.icone ? Te[e.icone] : void 0, u = n, v = j(
|
|
3520
3610
|
() => Ve(e, u),
|
|
3521
3611
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3522
3612
|
[e, JSON.stringify(u)]
|
|
3523
|
-
),
|
|
3524
|
-
() => [...
|
|
3525
|
-
[
|
|
3526
|
-
), N = de({ control: r }), { wrapperClass: b, wrapperStyle:
|
|
3613
|
+
), y = j(
|
|
3614
|
+
() => [...v.campos].sort((x, S) => x.ordem - S.ordem),
|
|
3615
|
+
[v.campos]
|
|
3616
|
+
), N = de({ control: r }), { wrapperClass: b, wrapperStyle: w, headerClass: E, headerStyle: g, tmpl: p } = Hr(), T = (x, S) => {
|
|
3527
3617
|
if (!ee(
|
|
3528
|
-
|
|
3618
|
+
x.condicional,
|
|
3529
3619
|
N,
|
|
3530
3620
|
n
|
|
3531
3621
|
)) return null;
|
|
3532
|
-
const
|
|
3533
|
-
|
|
3622
|
+
const I = `${t}.${S}.${x.nome}`, D = x.tamanho ?? 12, V = x.inicioColuna, B = V ? `${V} / span ${D}` : `span ${D}`, U = /* @__PURE__ */ i(
|
|
3623
|
+
Xr,
|
|
3534
3624
|
{
|
|
3535
|
-
field:
|
|
3625
|
+
field: x,
|
|
3536
3626
|
control: r,
|
|
3537
|
-
nameOverride:
|
|
3627
|
+
nameOverride: I
|
|
3538
3628
|
}
|
|
3539
3629
|
);
|
|
3540
|
-
return
|
|
3630
|
+
return x.tipo === h.CHECKBOX || x.tipo === h.HIDDEN ? /* @__PURE__ */ i(
|
|
3541
3631
|
"div",
|
|
3542
3632
|
{
|
|
3543
3633
|
className: "max-sm:!col-span-12",
|
|
3544
|
-
style: { gridColumn:
|
|
3545
|
-
children:
|
|
3634
|
+
style: { gridColumn: B },
|
|
3635
|
+
children: U
|
|
3546
3636
|
},
|
|
3547
|
-
`${
|
|
3637
|
+
`${x.id}-${S}`
|
|
3548
3638
|
) : /* @__PURE__ */ m(
|
|
3549
3639
|
"div",
|
|
3550
3640
|
{
|
|
3551
3641
|
className: "max-sm:!col-span-12 space-y-2",
|
|
3552
|
-
style: { gridColumn:
|
|
3642
|
+
style: { gridColumn: B },
|
|
3553
3643
|
children: [
|
|
3554
3644
|
/* @__PURE__ */ m(
|
|
3555
3645
|
"label",
|
|
@@ -3557,27 +3647,27 @@ const ss = {
|
|
|
3557
3647
|
className: "sfr-label font-medium flex items-center gap-1",
|
|
3558
3648
|
style: { color: "var(--t-text)" },
|
|
3559
3649
|
children: [
|
|
3560
|
-
|
|
3561
|
-
|
|
3650
|
+
x.label,
|
|
3651
|
+
x.obrigatorio && /* @__PURE__ */ i("span", { className: "sfr-required", children: "*" })
|
|
3562
3652
|
]
|
|
3563
3653
|
}
|
|
3564
3654
|
),
|
|
3565
|
-
|
|
3566
|
-
|
|
3655
|
+
U,
|
|
3656
|
+
x.hint && /* @__PURE__ */ i(
|
|
3567
3657
|
"p",
|
|
3568
3658
|
{
|
|
3569
3659
|
className: "sfr-hint text-xs",
|
|
3570
3660
|
style: { color: "var(--t-text-muted)" },
|
|
3571
|
-
children:
|
|
3661
|
+
children: x.hint
|
|
3572
3662
|
}
|
|
3573
3663
|
)
|
|
3574
3664
|
]
|
|
3575
3665
|
},
|
|
3576
|
-
`${
|
|
3666
|
+
`${x.id}-${S}`
|
|
3577
3667
|
);
|
|
3578
3668
|
};
|
|
3579
|
-
return /* @__PURE__ */ m("div", { className: b, style:
|
|
3580
|
-
(
|
|
3669
|
+
return /* @__PURE__ */ m("div", { className: b, style: w, children: [
|
|
3670
|
+
(v.titulo || f) && /* @__PURE__ */ i("div", { className: E, style: g, children: /* @__PURE__ */ m("div", { className: "flex items-center gap-3", children: [
|
|
3581
3671
|
f && /* @__PURE__ */ i(
|
|
3582
3672
|
"div",
|
|
3583
3673
|
{
|
|
@@ -3598,16 +3688,16 @@ const ss = {
|
|
|
3598
3688
|
/* @__PURE__ */ i(
|
|
3599
3689
|
"h3",
|
|
3600
3690
|
{
|
|
3601
|
-
className: ((
|
|
3691
|
+
className: ((_ = p.typography) == null ? void 0 : _.stepTitleClass) ?? "text-lg font-semibold",
|
|
3602
3692
|
style: { color: "var(--t-text)" },
|
|
3603
|
-
children:
|
|
3693
|
+
children: v.titulo
|
|
3604
3694
|
}
|
|
3605
3695
|
),
|
|
3606
|
-
|
|
3696
|
+
v.descricao && /* @__PURE__ */ i("p", { className: "text-sm", style: { color: "var(--t-text-muted)" }, children: v.descricao })
|
|
3607
3697
|
] })
|
|
3608
3698
|
] }) }),
|
|
3609
3699
|
/* @__PURE__ */ m("div", { className: "p-6 space-y-4", children: [
|
|
3610
|
-
c.map((
|
|
3700
|
+
c.map((x, S) => /* @__PURE__ */ m(
|
|
3611
3701
|
"div",
|
|
3612
3702
|
{
|
|
3613
3703
|
className: "sfr-container__repeat-item border rounded-lg p-4",
|
|
@@ -3623,7 +3713,7 @@ const ss = {
|
|
|
3623
3713
|
{
|
|
3624
3714
|
className: "w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0",
|
|
3625
3715
|
style: { background: "var(--t-primary)", color: "#fff" },
|
|
3626
|
-
children:
|
|
3716
|
+
children: S + 1
|
|
3627
3717
|
}
|
|
3628
3718
|
),
|
|
3629
3719
|
/* @__PURE__ */ m(
|
|
@@ -3634,7 +3724,7 @@ const ss = {
|
|
|
3634
3724
|
children: [
|
|
3635
3725
|
a,
|
|
3636
3726
|
" ",
|
|
3637
|
-
|
|
3727
|
+
S + 1
|
|
3638
3728
|
]
|
|
3639
3729
|
}
|
|
3640
3730
|
)
|
|
@@ -3643,17 +3733,17 @@ const ss = {
|
|
|
3643
3733
|
"button",
|
|
3644
3734
|
{
|
|
3645
3735
|
type: "button",
|
|
3646
|
-
onClick: () => d(
|
|
3736
|
+
onClick: () => d(S),
|
|
3647
3737
|
className: "sfr-btn sfr-btn--ghost sfr-error",
|
|
3648
3738
|
"aria-label": "Remover item",
|
|
3649
3739
|
children: /* @__PURE__ */ i(yr, { className: "w-4 h-4" })
|
|
3650
3740
|
}
|
|
3651
3741
|
)
|
|
3652
3742
|
] }),
|
|
3653
|
-
/* @__PURE__ */ i("div", { className: "grid grid-cols-12 gap-4", children:
|
|
3743
|
+
/* @__PURE__ */ i("div", { className: "grid grid-cols-12 gap-4", children: y.map((z) => T(z, S)) })
|
|
3654
3744
|
]
|
|
3655
3745
|
},
|
|
3656
|
-
|
|
3746
|
+
x.id
|
|
3657
3747
|
)),
|
|
3658
3748
|
(!o || c.length < o) && /* @__PURE__ */ m(
|
|
3659
3749
|
"button",
|
|
@@ -3662,7 +3752,7 @@ const ss = {
|
|
|
3662
3752
|
className: "sfr-btn sfr-btn--outline w-full flex items-center justify-center gap-2 py-2 px-4 border rounded-lg text-sm",
|
|
3663
3753
|
onClick: () => l({}),
|
|
3664
3754
|
children: [
|
|
3665
|
-
/* @__PURE__ */ i(
|
|
3755
|
+
/* @__PURE__ */ i(br, { className: "w-4 h-4" }),
|
|
3666
3756
|
"Adicionar ",
|
|
3667
3757
|
a.toLowerCase()
|
|
3668
3758
|
]
|
|
@@ -3682,7 +3772,7 @@ const ss = {
|
|
|
3682
3772
|
control: r,
|
|
3683
3773
|
externalData: n = {}
|
|
3684
3774
|
}) => {
|
|
3685
|
-
const t =
|
|
3775
|
+
const t = j(
|
|
3686
3776
|
() => [...e.containers].sort((o, a) => o.ordem - a.ordem),
|
|
3687
3777
|
[e.containers]
|
|
3688
3778
|
), s = de({ control: r });
|
|
@@ -3704,13 +3794,13 @@ const ss = {
|
|
|
3704
3794
|
o.id
|
|
3705
3795
|
);
|
|
3706
3796
|
}) });
|
|
3707
|
-
}, Ne =
|
|
3797
|
+
}, Ne = gr({
|
|
3708
3798
|
submitting: !1,
|
|
3709
3799
|
warnings: {},
|
|
3710
3800
|
requestSubmit: () => {
|
|
3711
3801
|
}
|
|
3712
3802
|
}), Xs = Ne.Provider, no = () => {
|
|
3713
|
-
const e = be(), r =
|
|
3803
|
+
const e = be(), r = ye(Ne);
|
|
3714
3804
|
return {
|
|
3715
3805
|
change: (n, t) => e.setValue(n, t, {
|
|
3716
3806
|
shouldValidate: !0,
|
|
@@ -3736,7 +3826,7 @@ const ss = {
|
|
|
3736
3826
|
}
|
|
3737
3827
|
};
|
|
3738
3828
|
}, Hs = () => {
|
|
3739
|
-
const e = be(), r =
|
|
3829
|
+
const e = be(), r = ye(Ne), n = de({ control: e.control }), { errors: t, isDirty: s, isValid: o } = e.formState;
|
|
3740
3830
|
return {
|
|
3741
3831
|
values: n,
|
|
3742
3832
|
errors: Object.fromEntries(
|
|
@@ -3752,7 +3842,7 @@ const ss = {
|
|
|
3752
3842
|
};
|
|
3753
3843
|
}, so = (e) => {
|
|
3754
3844
|
var o;
|
|
3755
|
-
const r = be(), { warnings: n } =
|
|
3845
|
+
const r = be(), { warnings: n } = ye(Ne), t = de({ control: r.control, name: e }), s = r.getFieldState(e, r.formState);
|
|
3756
3846
|
return {
|
|
3757
3847
|
value: t,
|
|
3758
3848
|
error: (o = s.error) == null ? void 0 : o.message,
|
|
@@ -3763,7 +3853,7 @@ const ss = {
|
|
|
3763
3853
|
};
|
|
3764
3854
|
}, oo = (e) => {
|
|
3765
3855
|
var o;
|
|
3766
|
-
const { control: r } = be(), { warnings: n } =
|
|
3856
|
+
const { control: r } = be(), { warnings: n } = ye(Ne), { field: t, fieldState: s } = P({ name: e, control: r });
|
|
3767
3857
|
return {
|
|
3768
3858
|
input: {
|
|
3769
3859
|
name: t.name,
|
|
@@ -3797,7 +3887,7 @@ const ss = {
|
|
|
3797
3887
|
"data-active": a ? "true" : void 0,
|
|
3798
3888
|
"data-done": o ? "true" : void 0,
|
|
3799
3889
|
title: t.label,
|
|
3800
|
-
children: o ? /* @__PURE__ */ i(
|
|
3890
|
+
children: o ? /* @__PURE__ */ i(Er, { className: "w-4 h-4" }) : c ? /* @__PURE__ */ i(c, { className: "w-4 h-4" }) : s + 1
|
|
3801
3891
|
}
|
|
3802
3892
|
),
|
|
3803
3893
|
t.label && /* @__PURE__ */ i(
|
|
@@ -3829,113 +3919,113 @@ const ss = {
|
|
|
3829
3919
|
onWarningsChange: d,
|
|
3830
3920
|
onValuesChange: f,
|
|
3831
3921
|
onSubmit: u,
|
|
3832
|
-
onBack:
|
|
3922
|
+
onBack: v
|
|
3833
3923
|
}) => {
|
|
3834
|
-
const
|
|
3835
|
-
() =>
|
|
3924
|
+
const y = e === r - 1, N = j(
|
|
3925
|
+
() => us(n, s, l),
|
|
3836
3926
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3837
3927
|
[n.id]
|
|
3838
|
-
), b =
|
|
3839
|
-
() =>
|
|
3928
|
+
), b = j(
|
|
3929
|
+
() => fs(n, s, l),
|
|
3840
3930
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3841
3931
|
[n.id]
|
|
3842
|
-
), [
|
|
3932
|
+
), [w, E] = R(
|
|
3843
3933
|
{}
|
|
3844
3934
|
), g = te(d);
|
|
3845
3935
|
g.current = d;
|
|
3846
|
-
const p = s,
|
|
3847
|
-
() =>
|
|
3936
|
+
const p = s, T = j(
|
|
3937
|
+
() => gs(n, p),
|
|
3848
3938
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3849
3939
|
[n, JSON.stringify(p)]
|
|
3850
|
-
),
|
|
3940
|
+
), _ = qr({
|
|
3851
3941
|
resolver: N,
|
|
3852
3942
|
defaultValues: t,
|
|
3853
3943
|
mode: "onTouched"
|
|
3854
|
-
}), { control:
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
for (const [
|
|
3858
|
-
|
|
3859
|
-
}, [o,
|
|
3860
|
-
const
|
|
3861
|
-
() => n.containers.flatMap((
|
|
3944
|
+
}), { control: x, watch: S, setValue: z, handleSubmit: I, setError: D, clearErrors: V } = _;
|
|
3945
|
+
G(() => {
|
|
3946
|
+
V();
|
|
3947
|
+
for (const [C, A] of Object.entries(o))
|
|
3948
|
+
D(C, { type: "server", message: A });
|
|
3949
|
+
}, [o, D, V]);
|
|
3950
|
+
const B = j(
|
|
3951
|
+
() => n.containers.flatMap((C) => C.campos).filter((C) => C.condicional && C.clearedValue !== void 0),
|
|
3862
3952
|
[n.containers]
|
|
3863
|
-
),
|
|
3864
|
-
() => n.containers.flatMap((
|
|
3865
|
-
var
|
|
3866
|
-
return
|
|
3953
|
+
), U = j(
|
|
3954
|
+
() => n.containers.flatMap((C) => C.campos).filter((C) => {
|
|
3955
|
+
var A;
|
|
3956
|
+
return C.condicional && ((A = C.setValues) == null ? void 0 : A.length);
|
|
3867
3957
|
}),
|
|
3868
3958
|
[n.containers]
|
|
3869
|
-
), re = te({}),
|
|
3870
|
-
Q.current = f,
|
|
3871
|
-
var
|
|
3872
|
-
(
|
|
3873
|
-
}, [
|
|
3874
|
-
let
|
|
3875
|
-
return b(
|
|
3959
|
+
), re = te({}), J = de({ control: x }), Q = te(f);
|
|
3960
|
+
Q.current = f, G(() => {
|
|
3961
|
+
var C;
|
|
3962
|
+
(C = Q.current) == null || C.call(Q, J);
|
|
3963
|
+
}, [J]), G(() => {
|
|
3964
|
+
let C = !1;
|
|
3965
|
+
return b(J).then((q) => {
|
|
3876
3966
|
var k;
|
|
3877
|
-
|
|
3967
|
+
C || (E(q), (k = g.current) == null || k.call(g, q));
|
|
3878
3968
|
}), () => {
|
|
3879
|
-
|
|
3969
|
+
C = !0;
|
|
3880
3970
|
};
|
|
3881
|
-
}, [
|
|
3882
|
-
var
|
|
3883
|
-
if (!
|
|
3884
|
-
const
|
|
3885
|
-
for (const k of
|
|
3971
|
+
}, [J, b]), G(() => {
|
|
3972
|
+
var q;
|
|
3973
|
+
if (!B.length && !U.length) return;
|
|
3974
|
+
const C = J, A = s;
|
|
3975
|
+
for (const k of B)
|
|
3886
3976
|
if (!ee(
|
|
3887
3977
|
k.condicional,
|
|
3888
|
-
|
|
3978
|
+
C,
|
|
3889
3979
|
s
|
|
3890
3980
|
)) {
|
|
3891
3981
|
const se = k.clearedValue ?? "";
|
|
3892
|
-
|
|
3982
|
+
C[k.nome] !== se && z(k.nome, se, { shouldValidate: !1 });
|
|
3893
3983
|
}
|
|
3894
|
-
for (const k of
|
|
3895
|
-
const
|
|
3984
|
+
for (const k of U) {
|
|
3985
|
+
const X = ee(
|
|
3896
3986
|
k.condicional,
|
|
3897
|
-
|
|
3987
|
+
C,
|
|
3898
3988
|
s
|
|
3899
3989
|
), se = re.current[k.nome] ?? !1;
|
|
3900
|
-
if (
|
|
3990
|
+
if (X && !se && ((q = k.setValues) != null && q.length))
|
|
3901
3991
|
for (const _e of k.setValues) {
|
|
3902
|
-
const
|
|
3903
|
-
|
|
3992
|
+
const Kr = typeof _e.valor == "string" ? Y(_e.valor, A) : _e.valor;
|
|
3993
|
+
z(_e.campo, Kr, { shouldValidate: !1 });
|
|
3904
3994
|
}
|
|
3905
|
-
re.current[k.nome] =
|
|
3995
|
+
re.current[k.nome] = X;
|
|
3906
3996
|
}
|
|
3907
3997
|
}, [
|
|
3908
|
-
V,
|
|
3909
3998
|
J,
|
|
3910
3999
|
B,
|
|
4000
|
+
U,
|
|
3911
4001
|
s,
|
|
3912
|
-
|
|
4002
|
+
z
|
|
3913
4003
|
]);
|
|
3914
|
-
const W =
|
|
4004
|
+
const W = T.icone ? Te[T.icone] : void 0, ue = j(
|
|
3915
4005
|
() => () => {
|
|
3916
|
-
|
|
4006
|
+
_.handleSubmit(u)();
|
|
3917
4007
|
},
|
|
3918
4008
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3919
4009
|
[u]
|
|
3920
4010
|
);
|
|
3921
|
-
return /* @__PURE__ */ i(Gr, { ...
|
|
4011
|
+
return /* @__PURE__ */ i(Gr, { ..._, children: /* @__PURE__ */ i(
|
|
3922
4012
|
Xs,
|
|
3923
4013
|
{
|
|
3924
4014
|
value: {
|
|
3925
4015
|
submitting: a,
|
|
3926
|
-
warnings:
|
|
4016
|
+
warnings: w,
|
|
3927
4017
|
requestSubmit: ue
|
|
3928
4018
|
},
|
|
3929
4019
|
children: /* @__PURE__ */ i(
|
|
3930
4020
|
"form",
|
|
3931
4021
|
{
|
|
3932
|
-
onSubmit:
|
|
4022
|
+
onSubmit: I(u),
|
|
3933
4023
|
noValidate: !0,
|
|
3934
|
-
onKeyDown: (
|
|
3935
|
-
|
|
4024
|
+
onKeyDown: (C) => {
|
|
4025
|
+
C.key === "Enter" && C.target.tagName === "INPUT" && C.preventDefault();
|
|
3936
4026
|
},
|
|
3937
4027
|
children: /* @__PURE__ */ m("div", { className: "space-y-6", children: [
|
|
3938
|
-
|
|
4028
|
+
T.showLabel !== !1 && /* @__PURE__ */ m("div", { className: "text-center space-y-2", children: [
|
|
3939
4029
|
W && /* @__PURE__ */ i(
|
|
3940
4030
|
"div",
|
|
3941
4031
|
{
|
|
@@ -3957,23 +4047,23 @@ const ss = {
|
|
|
3957
4047
|
{
|
|
3958
4048
|
className: "sfr-step__title text-2xl font-bold",
|
|
3959
4049
|
style: { color: "var(--t-text)" },
|
|
3960
|
-
children:
|
|
4050
|
+
children: T.titulo
|
|
3961
4051
|
}
|
|
3962
4052
|
),
|
|
3963
|
-
|
|
4053
|
+
T.descricao && /* @__PURE__ */ i(
|
|
3964
4054
|
"p",
|
|
3965
4055
|
{
|
|
3966
4056
|
className: "sfr-step__desc text-sm",
|
|
3967
4057
|
style: { color: "var(--t-text-muted)" },
|
|
3968
|
-
children:
|
|
4058
|
+
children: T.descricao
|
|
3969
4059
|
}
|
|
3970
4060
|
)
|
|
3971
4061
|
] }),
|
|
3972
4062
|
/* @__PURE__ */ i(
|
|
3973
4063
|
Us,
|
|
3974
4064
|
{
|
|
3975
|
-
step:
|
|
3976
|
-
control:
|
|
4065
|
+
step: T,
|
|
4066
|
+
control: x,
|
|
3977
4067
|
externalData: s
|
|
3978
4068
|
}
|
|
3979
4069
|
),
|
|
@@ -3983,14 +4073,14 @@ const ss = {
|
|
|
3983
4073
|
{
|
|
3984
4074
|
type: "button",
|
|
3985
4075
|
className: "sfr-btn sfr-btn--outline flex items-center gap-1 px-4 py-2 border rounded-lg text-sm",
|
|
3986
|
-
onClick:
|
|
4076
|
+
onClick: v,
|
|
3987
4077
|
disabled: e === 0,
|
|
3988
4078
|
style: e > 0 ? {
|
|
3989
4079
|
borderColor: "color-mix(in srgb, var(--t-primary) 40%, transparent)",
|
|
3990
4080
|
color: "var(--t-primary)"
|
|
3991
4081
|
} : {},
|
|
3992
4082
|
children: [
|
|
3993
|
-
/* @__PURE__ */ i(
|
|
4083
|
+
/* @__PURE__ */ i(dt, { className: "w-4 h-4" }),
|
|
3994
4084
|
/* @__PURE__ */ i("span", { className: "hidden sm:inline", children: "Anterior" })
|
|
3995
4085
|
]
|
|
3996
4086
|
}
|
|
@@ -4015,8 +4105,8 @@ const ss = {
|
|
|
4015
4105
|
disabled: a,
|
|
4016
4106
|
style: { background: "var(--t-primary)", color: "#ffffff" },
|
|
4017
4107
|
children: [
|
|
4018
|
-
a ? /* @__PURE__ */ i(
|
|
4019
|
-
/* @__PURE__ */ i("span", { className: "hidden sm:inline", children:
|
|
4108
|
+
a ? /* @__PURE__ */ i(Cr, { className: "w-4 h-4 animate-spin" }) : y ? /* @__PURE__ */ i(Er, { className: "w-4 h-4" }) : /* @__PURE__ */ i(ut, { className: "w-4 h-4" }),
|
|
4109
|
+
/* @__PURE__ */ i("span", { className: "hidden sm:inline", children: y ? "Finalizar" : "Próximo" })
|
|
4020
4110
|
]
|
|
4021
4111
|
}
|
|
4022
4112
|
)
|
|
@@ -4027,7 +4117,7 @@ const ss = {
|
|
|
4027
4117
|
)
|
|
4028
4118
|
}
|
|
4029
4119
|
) });
|
|
4030
|
-
},
|
|
4120
|
+
}, qs = (e, r, n) => {
|
|
4031
4121
|
const t = { ...r }, s = n;
|
|
4032
4122
|
for (const o of e.containers)
|
|
4033
4123
|
for (const a of o.campos)
|
|
@@ -4046,34 +4136,34 @@ const ss = {
|
|
|
4046
4136
|
uploadFile: d,
|
|
4047
4137
|
cepLookup: f,
|
|
4048
4138
|
resolveTermsUploadUrl: u,
|
|
4049
|
-
fieldResolvers:
|
|
4050
|
-
validatorMapper:
|
|
4139
|
+
fieldResolvers: v,
|
|
4140
|
+
validatorMapper: y,
|
|
4051
4141
|
componentMapper: N,
|
|
4052
4142
|
paymentMethodOptions: b,
|
|
4053
|
-
onValuesChange:
|
|
4054
|
-
className:
|
|
4143
|
+
onValuesChange: w,
|
|
4144
|
+
className: E,
|
|
4055
4145
|
StepIndicator: g = Ks
|
|
4056
4146
|
}) => {
|
|
4057
|
-
const [p,
|
|
4147
|
+
const [p, T] = R(() => n), [_, x] = R({
|
|
4058
4148
|
...r
|
|
4059
|
-
}), [
|
|
4149
|
+
}), [S, z] = R(!1), [I, D] = R(null), [V, B] = R(
|
|
4060
4150
|
{}
|
|
4061
|
-
),
|
|
4062
|
-
() => [...e.steps].sort((k,
|
|
4151
|
+
), U = j(() => Qr(o), [o]), re = j(
|
|
4152
|
+
() => [...e.steps].sort((k, X) => k.ordem - X.ordem),
|
|
4063
4153
|
[e.steps]
|
|
4064
|
-
),
|
|
4065
|
-
() =>
|
|
4154
|
+
), J = re.length, Q = re[Math.min(p, J - 1)], W = j(
|
|
4155
|
+
() => qs(Q, _, c),
|
|
4066
4156
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4067
|
-
[Q,
|
|
4068
|
-
), ue =
|
|
4157
|
+
[Q, _, JSON.stringify(c)]
|
|
4158
|
+
), ue = j(
|
|
4069
4159
|
() => ({
|
|
4070
4160
|
uploadFile: d,
|
|
4071
4161
|
cepLookup: f,
|
|
4072
4162
|
resolveTermsUploadUrl: u,
|
|
4073
4163
|
externalData: c,
|
|
4074
|
-
fieldResolvers:
|
|
4075
|
-
validatorMapper:
|
|
4076
|
-
fieldWarnings:
|
|
4164
|
+
fieldResolvers: v,
|
|
4165
|
+
validatorMapper: y,
|
|
4166
|
+
fieldWarnings: V,
|
|
4077
4167
|
componentMapper: N,
|
|
4078
4168
|
paymentMethodOptions: b
|
|
4079
4169
|
}),
|
|
@@ -4082,39 +4172,39 @@ const ss = {
|
|
|
4082
4172
|
d,
|
|
4083
4173
|
f,
|
|
4084
4174
|
u,
|
|
4085
|
-
y,
|
|
4086
4175
|
v,
|
|
4087
|
-
|
|
4176
|
+
y,
|
|
4177
|
+
V,
|
|
4088
4178
|
N,
|
|
4089
4179
|
b,
|
|
4090
4180
|
JSON.stringify(c)
|
|
4091
4181
|
]
|
|
4092
|
-
),
|
|
4182
|
+
), C = oe(
|
|
4093
4183
|
async (k) => {
|
|
4094
|
-
|
|
4184
|
+
z(!0), D(null);
|
|
4095
4185
|
try {
|
|
4096
|
-
const
|
|
4097
|
-
|
|
4098
|
-
} catch (
|
|
4099
|
-
console.error("[FormRenderer] Submit error:",
|
|
4100
|
-
const se =
|
|
4101
|
-
|
|
4186
|
+
const X = { ..._, ...k };
|
|
4187
|
+
x(X), t && await t(p, k), p === J - 1 ? s && await s(X) : T((se) => se + 1);
|
|
4188
|
+
} catch (X) {
|
|
4189
|
+
console.error("[FormRenderer] Submit error:", X);
|
|
4190
|
+
const se = X instanceof Error ? X.message : "Ocorreu um erro. Tente novamente.";
|
|
4191
|
+
D(se);
|
|
4102
4192
|
} finally {
|
|
4103
|
-
|
|
4193
|
+
z(!1);
|
|
4104
4194
|
}
|
|
4105
4195
|
},
|
|
4106
|
-
[p,
|
|
4107
|
-
),
|
|
4108
|
-
p > 0 &&
|
|
4109
|
-
}, [p]),
|
|
4110
|
-
return /* @__PURE__ */ i(
|
|
4111
|
-
|
|
4196
|
+
[p, _, J, t, s]
|
|
4197
|
+
), A = oe(() => {
|
|
4198
|
+
p > 0 && T((k) => k - 1);
|
|
4199
|
+
}, [p]), q = U.layout.eventTitleStyle ?? "bar";
|
|
4200
|
+
return /* @__PURE__ */ i(jr.Provider, { value: ue, children: /* @__PURE__ */ i(
|
|
4201
|
+
et,
|
|
4112
4202
|
{
|
|
4113
|
-
config:
|
|
4114
|
-
className: `sfr-root min-h-dvh ${
|
|
4203
|
+
config: U,
|
|
4204
|
+
className: `sfr-root min-h-dvh ${U.wrapperClass ?? ""} ${E ?? ""}`,
|
|
4115
4205
|
renderWrapper: !0,
|
|
4116
4206
|
children: /* @__PURE__ */ m("div", { className: "sfr-form w-full max-w-4xl mx-auto px-4 py-6 sm:px-6", children: [
|
|
4117
|
-
a &&
|
|
4207
|
+
a && q === "bar" && /* @__PURE__ */ i(
|
|
4118
4208
|
"div",
|
|
4119
4209
|
{
|
|
4120
4210
|
className: "sfr-form__title w-full text-center text-sm font-medium py-2.5 px-4 mb-6 rounded-lg border",
|
|
@@ -4126,7 +4216,7 @@ const ss = {
|
|
|
4126
4216
|
children: a
|
|
4127
4217
|
}
|
|
4128
4218
|
),
|
|
4129
|
-
a &&
|
|
4219
|
+
a && q === "inline" && /* @__PURE__ */ m("div", { className: "text-center mb-6", children: [
|
|
4130
4220
|
/* @__PURE__ */ i(
|
|
4131
4221
|
"p",
|
|
4132
4222
|
{
|
|
@@ -4151,7 +4241,7 @@ const ss = {
|
|
|
4151
4241
|
}
|
|
4152
4242
|
)
|
|
4153
4243
|
] }),
|
|
4154
|
-
|
|
4244
|
+
J > 1 && /* @__PURE__ */ i("div", { className: "mb-8", children: /* @__PURE__ */ i(
|
|
4155
4245
|
g,
|
|
4156
4246
|
{
|
|
4157
4247
|
steps: re.map((k) => ({
|
|
@@ -4160,25 +4250,25 @@ const ss = {
|
|
|
4160
4250
|
icone: k.icone
|
|
4161
4251
|
})),
|
|
4162
4252
|
currentStep: p,
|
|
4163
|
-
onStepClick:
|
|
4253
|
+
onStepClick: T
|
|
4164
4254
|
}
|
|
4165
4255
|
) }),
|
|
4166
4256
|
/* @__PURE__ */ i(
|
|
4167
4257
|
Ws,
|
|
4168
4258
|
{
|
|
4169
4259
|
stepIndex: p,
|
|
4170
|
-
totalSteps:
|
|
4260
|
+
totalSteps: J,
|
|
4171
4261
|
step: Q,
|
|
4172
4262
|
defaultValues: W,
|
|
4173
4263
|
externalData: c,
|
|
4174
4264
|
fieldErrors: l,
|
|
4175
|
-
isSubmitting:
|
|
4176
|
-
submitError:
|
|
4177
|
-
validatorMapper:
|
|
4178
|
-
onWarningsChange:
|
|
4179
|
-
onValuesChange:
|
|
4180
|
-
onSubmit:
|
|
4181
|
-
onBack:
|
|
4265
|
+
isSubmitting: S,
|
|
4266
|
+
submitError: I,
|
|
4267
|
+
validatorMapper: y,
|
|
4268
|
+
onWarningsChange: B,
|
|
4269
|
+
onValuesChange: w,
|
|
4270
|
+
onSubmit: C,
|
|
4271
|
+
onBack: A
|
|
4182
4272
|
},
|
|
4183
4273
|
p
|
|
4184
4274
|
)
|
|
@@ -4191,7 +4281,7 @@ const ss = {
|
|
|
4191
4281
|
onChange: n
|
|
4192
4282
|
}) => {
|
|
4193
4283
|
const t = Hs(), s = te(n);
|
|
4194
|
-
return s.current = n,
|
|
4284
|
+
return s.current = n, G(() => {
|
|
4195
4285
|
var o;
|
|
4196
4286
|
(o = s.current) == null || o.call(s, t);
|
|
4197
4287
|
}, [
|
|
@@ -4208,34 +4298,34 @@ const ss = {
|
|
|
4208
4298
|
};
|
|
4209
4299
|
export {
|
|
4210
4300
|
Bs as ContainerRenderer,
|
|
4211
|
-
|
|
4301
|
+
Jr as DFCepField,
|
|
4212
4302
|
Ue as DFCheckbox,
|
|
4213
|
-
|
|
4214
|
-
|
|
4303
|
+
Zr as DFCheckboxGroup,
|
|
4304
|
+
ve as DFDateField,
|
|
4215
4305
|
ws as DFFieldArray,
|
|
4216
|
-
|
|
4306
|
+
Mr as DFFileUpload,
|
|
4217
4307
|
Xe as DFHidden,
|
|
4218
4308
|
ie as DFMaskedInput,
|
|
4219
4309
|
Os as DFParticipationType,
|
|
4220
4310
|
Ps as DFPaymentMethod,
|
|
4221
|
-
|
|
4311
|
+
Lr as DFRadioGroup,
|
|
4222
4312
|
Be as DFSelect,
|
|
4223
4313
|
Ds as DFTerms,
|
|
4224
|
-
|
|
4314
|
+
H as DFTextField,
|
|
4225
4315
|
Je as DFTextarea,
|
|
4226
4316
|
ao as FormRenderer,
|
|
4227
4317
|
io as FormSpy,
|
|
4228
4318
|
Ts as OPCOES_POR_DIA,
|
|
4229
4319
|
$s as OPCOES_TODOS_OS_DIAS,
|
|
4230
|
-
|
|
4320
|
+
jr as RendererContext,
|
|
4231
4321
|
Us as StepRenderer,
|
|
4232
4322
|
ee as evaluateFieldCondition,
|
|
4233
4323
|
Y as interpolate,
|
|
4234
4324
|
Ve as interpolateContainer,
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4325
|
+
hs as interpolateField,
|
|
4326
|
+
gs as interpolateStep,
|
|
4327
|
+
us as makeStepResolver,
|
|
4328
|
+
fs as makeStepWarnComputer,
|
|
4239
4329
|
so as useField,
|
|
4240
4330
|
oo as useFieldApi,
|
|
4241
4331
|
no as useFormApi,
|