dgz-ui-shared
Version:
Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript, dgz-ui library
1,193 lines • 106 kB
JavaScript
import I, { useState as Re, useRef as le, useEffect as Te, useSyncExternalStore as Ut, useLayoutEffect as pt, isValidElement as Ce, cloneElement as Fe, useMemo as Ft } from "react";
import { jsxs as F, jsx as M } from "react/jsx-runtime";
import { AlertDialog as gt, AlertDialogTrigger as yt, AlertDialogContent as vt, AlertDialogHeader as _t, AlertDialogTitle as bt, AlertDialogDescription as Wt, AlertDialogFooter as xt, AlertDialogCancel as kt, AlertDialogAction as wt } from "dgz-ui/alert-dialog";
import { useTranslation as Tt } from "react-i18next";
import { get as je, set as Ie, appendErrors as Ct, useForm as qt } from "react-hook-form";
import { Form as Ht } from "dgz-ui/form";
import { M as Xt } from "./MyInput-ByJ5vTAN.es.js";
function Et(t) {
var e, r, n = "";
if (typeof t == "string" || typeof t == "number") n += t;
else if (typeof t == "object") if (Array.isArray(t)) {
var s = t.length;
for (e = 0; e < s; e++) t[e] && (r = Et(t[e])) && (n && (n += " "), n += r);
} else for (r in t) t[r] && (n && (n += " "), n += r);
return n;
}
function ee() {
for (var t, e, r = 0, n = "", s = arguments.length; r < s; r++) (t = arguments[r]) && (e = Et(t)) && (n && (n += " "), n += e);
return n;
}
var me = (t) => typeof t == "number" && !isNaN(t), te = (t) => typeof t == "string", W = (t) => typeof t == "function", Yt = (t) => te(t) || me(t), Ze = (t) => te(t) || W(t) ? t : null, Jt = (t, e) => t === !1 || me(t) && t > 0 ? t : e, $e = (t) => Ce(t) || te(t) || W(t) || me(t);
function Qt(t, e, r = 300) {
let { scrollHeight: n, style: s } = t;
requestAnimationFrame(() => {
s.minHeight = "initial", s.height = n + "px", s.transition = `all ${r}ms`, requestAnimationFrame(() => {
s.height = "0", s.padding = "0", s.margin = "0", setTimeout(e, r);
});
});
}
function Gt({ enter: t, exit: e, appendPosition: r = !1, collapse: n = !0, collapseDuration: s = 300 }) {
return function({ children: a, position: i, preventExitTransition: o, done: c, nodeRef: l, isIn: u, playToast: C }) {
let j = r ? `${t}--${i}` : t, Z = r ? `${e}--${i}` : e, P = le(0);
return pt(() => {
let N = l.current, E = j.split(" "), T = (p) => {
p.target === l.current && (C(), N.removeEventListener("animationend", T), N.removeEventListener("animationcancel", T), P.current === 0 && p.type !== "animationcancel" && N.classList.remove(...E));
};
N.classList.add(...E), N.addEventListener("animationend", T), N.addEventListener("animationcancel", T);
}, []), Te(() => {
let N = l.current, E = () => {
N.removeEventListener("animationend", E), n ? Qt(N, c, s) : c();
};
u || (o ? E() : (P.current = 1, N.className += ` ${Z}`, N.addEventListener("animationend", E)));
}, [u]), I.createElement(I.Fragment, null, a);
};
}
function Xe(t, e) {
return { content: At(t.content, t.props), containerId: t.props.containerId, id: t.props.toastId, theme: t.props.theme, type: t.props.type, data: t.props.data || {}, isLoading: t.props.isLoading, icon: t.props.icon, reason: t.removalReason, status: e };
}
function At(t, e, r = !1) {
return Ce(t) && !te(t.type) ? Fe(t, { closeToast: e.closeToast, toastProps: e, data: e.data, isPaused: r }) : W(t) ? t({ closeToast: e.closeToast, toastProps: e, data: e.data, isPaused: r }) : t;
}
function Kt({ closeToast: t, theme: e, ariaLabel: r = "close" }) {
return I.createElement("button", { className: `Toastify__close-button Toastify__close-button--${e}`, type: "button", onClick: (n) => {
n.stopPropagation(), t(!0);
}, "aria-label": r }, I.createElement("svg", { "aria-hidden": "true", viewBox: "0 0 14 16" }, I.createElement("path", { fillRule: "evenodd", d: "M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z" })));
}
function er({ delay: t, isRunning: e, closeToast: r, type: n = "default", hide: s, className: a, controlledProgress: i, progress: o, rtl: c, isIn: l, theme: u }) {
let C = s || i && o === 0, j = { animationDuration: `${t}ms`, animationPlayState: e ? "running" : "paused" };
i && (j.transform = `scaleX(${o})`);
let Z = ee("Toastify__progress-bar", i ? "Toastify__progress-bar--controlled" : "Toastify__progress-bar--animated", `Toastify__progress-bar-theme--${u}`, `Toastify__progress-bar--${n}`, { "Toastify__progress-bar--rtl": c }), P = W(a) ? a({ rtl: c, type: n, defaultClassName: Z }) : ee(Z, a), N = { [i && o >= 1 ? "onTransitionEnd" : "onAnimationEnd"]: i && o < 1 ? null : () => {
l && r();
} };
return I.createElement("div", { className: "Toastify__progress-bar--wrp", "data-hidden": C }, I.createElement("div", { className: `Toastify__progress-bar--bg Toastify__progress-bar-theme--${u} Toastify__progress-bar--${n}` }), I.createElement("div", { role: "progressbar", "aria-hidden": C ? "true" : "false", "aria-label": "notification timer", className: P, style: j, ...N }));
}
var tr = 1, Ot = () => `${tr++}`;
function rr(t, e, r) {
let n = 1, s = 0, a = [], i = [], o = e, c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Set(), u = (p) => (l.add(p), () => l.delete(p)), C = () => {
i = Array.from(c.values()), l.forEach((p) => p());
}, j = ({ containerId: p, toastId: g, updateId: b }) => {
let R = p ? p !== t : t !== 1, L = c.has(g) && b == null;
return R || L;
}, Z = (p, g) => {
c.forEach((b) => {
var R;
(g == null || g === b.props.toastId) && ((R = b.toggle) == null || R.call(b, p));
});
}, P = (p) => {
var g, b;
(b = (g = p.props) == null ? void 0 : g.onClose) == null || b.call(g, p.removalReason), p.isActive = !1;
}, N = (p) => {
if (p == null) c.forEach(P);
else {
let g = c.get(p);
g && P(g);
}
C();
}, E = () => {
s -= a.length, a = [];
}, T = (p) => {
var g, b;
let { toastId: R, updateId: L } = p.props, w = L == null;
p.staleId && c.delete(p.staleId), p.isActive = !0, c.set(R, p), C(), r(Xe(p, w ? "added" : "updated")), w && ((b = (g = p.props).onOpen) == null || b.call(g));
};
return { id: t, props: o, observe: u, toggle: Z, removeToast: N, toasts: c, clearQueue: E, buildToast: (p, g) => {
if (j(g)) return;
let { toastId: b, updateId: R, data: L, staleId: w, delay: O } = g, V = R == null;
V && s++;
let H = { ...o, style: o.toastStyle, key: n++, ...Object.fromEntries(Object.entries(g).filter(([K, ge]) => ge != null)), toastId: b, updateId: R, data: L, isIn: !1, className: Ze(g.className || o.toastClassName), progressClassName: Ze(g.progressClassName || o.progressClassName), autoClose: g.isLoading ? !1 : Jt(g.autoClose, o.autoClose), closeToast(K) {
c.get(b).removalReason = K, N(b);
}, deleteToast() {
let K = c.get(b);
if (K != null) {
if (r(Xe(K, "removed")), c.delete(b), s--, s < 0 && (s = 0), a.length > 0) {
T(a.shift());
return;
}
C();
}
} };
H.closeButton = o.closeButton, g.closeButton === !1 || $e(g.closeButton) ? H.closeButton = g.closeButton : g.closeButton === !0 && (H.closeButton = $e(o.closeButton) ? o.closeButton : !0);
let U = { content: p, props: H, staleId: w };
o.limit && o.limit > 0 && s > o.limit && V ? a.push(U) : me(O) ? setTimeout(() => {
T(U);
}, O) : T(U);
}, setProps(p) {
o = p;
}, setToggle: (p, g) => {
let b = c.get(p);
b && (b.toggle = g);
}, isToastActive: (p) => {
var g;
return (g = c.get(p)) == null ? void 0 : g.isActive;
}, getSnapshot: () => i };
}
var $ = /* @__PURE__ */ new Map(), de = [], Pe = /* @__PURE__ */ new Set(), nr = (t) => Pe.forEach((e) => e(t)), Nt = () => $.size > 0;
function sr() {
de.forEach((t) => St(t.content, t.options)), de = [];
}
var ar = (t, { containerId: e }) => {
var r;
return (r = $.get(e || 1)) == null ? void 0 : r.toasts.get(t);
};
function It(t, e) {
var r;
if (e) return !!((r = $.get(e)) != null && r.isToastActive(t));
let n = !1;
return $.forEach((s) => {
s.isToastActive(t) && (n = !0);
}), n;
}
function ir(t) {
if (!Nt()) {
de = de.filter((e) => t != null && e.options.toastId !== t);
return;
}
if (t == null || Yt(t)) $.forEach((e) => {
e.removeToast(t);
});
else if (t && ("containerId" in t || "id" in t)) {
let e = $.get(t.containerId);
e ? e.removeToast(t.id) : $.forEach((r) => {
r.removeToast(t.id);
});
}
}
var or = (t = {}) => {
$.forEach((e) => {
e.props.limit && (!t.containerId || e.id === t.containerId) && e.clearQueue();
});
};
function St(t, e) {
$e(t) && (Nt() || de.push({ content: t, options: e }), $.forEach((r) => {
r.buildToast(t, e);
}));
}
function cr(t) {
var e;
(e = $.get(t.containerId || 1)) == null || e.setToggle(t.id, t.fn);
}
function Rt(t, e) {
$.forEach((r) => {
(e == null || !(e != null && e.containerId) || (e == null ? void 0 : e.containerId) === r.id) && r.toggle(t, e == null ? void 0 : e.id);
});
}
function lr(t) {
let e = t.containerId || 1;
return { subscribe(r) {
let n = rr(e, t, nr);
$.set(e, n);
let s = n.observe(r);
return sr(), () => {
s(), $.delete(e);
};
}, setProps(r) {
var n;
(n = $.get(e)) == null || n.setProps(r);
}, getSnapshot() {
var r;
return (r = $.get(e)) == null ? void 0 : r.getSnapshot();
} };
}
function dr(t) {
return Pe.add(t), () => {
Pe.delete(t);
};
}
function ur(t) {
return t && (te(t.toastId) || me(t.toastId)) ? t.toastId : Ot();
}
function pe(t, e) {
return St(t, e), e.toastId;
}
function Ee(t, e) {
return { ...e, type: e && e.type || t, toastId: ur(e) };
}
function Ae(t) {
return (e, r) => pe(e, Ee(t, r));
}
function A(t, e) {
return pe(t, Ee("default", e));
}
A.loading = (t, e) => pe(t, Ee("default", { isLoading: !0, autoClose: !1, closeOnClick: !1, closeButton: !1, draggable: !1, ...e }));
function fr(t, { pending: e, error: r, success: n }, s) {
let a;
e && (a = te(e) ? A.loading(e, s) : A.loading(e.render, { ...s, ...e }));
let i = { isLoading: null, autoClose: null, closeOnClick: null, closeButton: null, draggable: null }, o = (l, u, C) => {
if (u == null) {
A.dismiss(a);
return;
}
let j = { type: l, ...i, ...s, data: C }, Z = te(u) ? { render: u } : u;
return a ? A.update(a, { ...j, ...Z }) : A(Z.render, { ...j, ...Z }), C;
}, c = W(t) ? t() : t;
return c.then((l) => o("success", n, l)).catch((l) => o("error", r, l)), c;
}
A.promise = fr;
A.success = Ae("success");
A.info = Ae("info");
A.error = Ae("error");
A.warning = Ae("warning");
A.warn = A.warning;
A.dark = (t, e) => pe(t, Ee("default", { theme: "dark", ...e }));
function hr(t) {
ir(t);
}
A.dismiss = hr;
A.clearWaitingQueue = or;
A.isActive = It;
A.update = (t, e = {}) => {
let r = ar(t, e);
if (r) {
let { props: n, content: s } = r, a = { delay: 100, ...n, ...e, toastId: e.toastId || t, updateId: Ot() };
a.toastId !== t && (a.staleId = t);
let i = a.render || s;
delete a.render, pe(i, a);
}
};
A.done = (t) => {
A.update(t, { progress: 1 });
};
A.onChange = dr;
A.play = (t) => Rt(!0, t);
A.pause = (t) => Rt(!1, t);
function mr(t) {
var e;
let { subscribe: r, getSnapshot: n, setProps: s } = le(lr(t)).current;
s(t);
let a = (e = Ut(r, n, n)) == null ? void 0 : e.slice();
function i(o) {
if (!a) return [];
let c = /* @__PURE__ */ new Map();
return t.newestOnTop && a.reverse(), a.forEach((l) => {
let { position: u } = l.props;
c.has(u) || c.set(u, []), c.get(u).push(l);
}), Array.from(c, (l) => o(l[0], l[1]));
}
return { getToastToRender: i, isToastActive: It, count: a == null ? void 0 : a.length };
}
function pr(t) {
let [e, r] = Re(!1), [n, s] = Re(!1), a = le(null), i = le({ start: 0, delta: 0, removalDistance: 0, canCloseOnClick: !0, canDrag: !1, didMove: !1 }).current, { autoClose: o, pauseOnHover: c, closeToast: l, onClick: u, closeOnClick: C } = t;
cr({ id: t.toastId, containerId: t.containerId, fn: r }), Te(() => {
if (t.pauseOnFocusLoss) return j(), () => {
Z();
};
}, [t.pauseOnFocusLoss]);
function j() {
document.hasFocus() || T(), window.addEventListener("focus", E), window.addEventListener("blur", T);
}
function Z() {
window.removeEventListener("focus", E), window.removeEventListener("blur", T);
}
function P(w) {
if (t.draggable === !0 || t.draggable === w.pointerType) {
p();
let O = a.current;
i.canCloseOnClick = !0, i.canDrag = !0, O.style.transition = "none", t.draggableDirection === "x" ? (i.start = w.clientX, i.removalDistance = O.offsetWidth * (t.draggablePercent / 100)) : (i.start = w.clientY, i.removalDistance = O.offsetHeight * (t.draggablePercent === 80 ? t.draggablePercent * 1.5 : t.draggablePercent) / 100);
}
}
function N(w) {
let { top: O, bottom: V, left: H, right: U } = a.current.getBoundingClientRect();
w.nativeEvent.type !== "touchend" && t.pauseOnHover && w.clientX >= H && w.clientX <= U && w.clientY >= O && w.clientY <= V ? T() : E();
}
function E() {
r(!0);
}
function T() {
r(!1);
}
function p() {
i.didMove = !1, document.addEventListener("pointermove", b), document.addEventListener("pointerup", R);
}
function g() {
document.removeEventListener("pointermove", b), document.removeEventListener("pointerup", R);
}
function b(w) {
let O = a.current;
if (i.canDrag && O) {
i.didMove = !0, e && T(), t.draggableDirection === "x" ? i.delta = w.clientX - i.start : i.delta = w.clientY - i.start, i.start !== w.clientX && (i.canCloseOnClick = !1);
let V = t.draggableDirection === "x" ? `${i.delta}px, var(--y)` : `0, calc(${i.delta}px + var(--y))`;
O.style.transform = `translate3d(${V},0)`, O.style.opacity = `${1 - Math.abs(i.delta / i.removalDistance)}`;
}
}
function R() {
g();
let w = a.current;
if (i.canDrag && i.didMove && w) {
if (i.canDrag = !1, Math.abs(i.delta) > i.removalDistance) {
s(!0), t.closeToast(!0), t.collapseAll();
return;
}
w.style.transition = "transform 0.2s, opacity 0.2s", w.style.removeProperty("transform"), w.style.removeProperty("opacity");
}
}
let L = { onPointerDown: P, onPointerUp: N };
return o && c && (L.onMouseEnter = T, t.stacked || (L.onMouseLeave = E)), C && (L.onClick = (w) => {
u && u(w), i.canCloseOnClick && l(!0);
}), { playToast: E, pauseToast: T, isRunning: e, preventExitTransition: n, toastRef: a, eventHandlers: L };
}
var gr = typeof window < "u" ? pt : Te, Oe = ({ theme: t, type: e, isLoading: r, ...n }) => I.createElement("svg", { viewBox: "0 0 24 24", width: "100%", height: "100%", fill: t === "colored" ? "currentColor" : `var(--toastify-icon-color-${e})`, ...n });
function yr(t) {
return I.createElement(Oe, { ...t }, I.createElement("path", { d: "M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z" }));
}
function vr(t) {
return I.createElement(Oe, { ...t }, I.createElement("path", { d: "M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z" }));
}
function _r(t) {
return I.createElement(Oe, { ...t }, I.createElement("path", { d: "M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z" }));
}
function br(t) {
return I.createElement(Oe, { ...t }, I.createElement("path", { d: "M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z" }));
}
function xr() {
return I.createElement("div", { className: "Toastify__spinner" });
}
var Le = { info: vr, warning: yr, success: _r, error: br, spinner: xr }, kr = (t) => t in Le;
function wr({ theme: t, type: e, isLoading: r, icon: n }) {
let s = null, a = { theme: t, type: e };
return n === !1 || (W(n) ? s = n({ ...a, isLoading: r }) : Ce(n) ? s = Fe(n, a) : r ? s = Le.spinner() : kr(e) && (s = Le[e](a))), s;
}
var Tr = (t) => {
let { isRunning: e, preventExitTransition: r, toastRef: n, eventHandlers: s, playToast: a } = pr(t), { closeButton: i, children: o, autoClose: c, onClick: l, type: u, hideProgressBar: C, closeToast: j, transition: Z, position: P, className: N, style: E, progressClassName: T, updateId: p, role: g, progress: b, rtl: R, toastId: L, deleteToast: w, isIn: O, isLoading: V, closeOnClick: H, theme: U, ariaLabel: K } = t, ge = ee("Toastify__toast", `Toastify__toast-theme--${U}`, `Toastify__toast--${u}`, { "Toastify__toast--rtl": R }, { "Toastify__toast--close-on-click": H }), Bt = W(N) ? N({ rtl: R, position: P, type: u, defaultClassName: ge }) : ee(ge, N), qe = wr(t), He = !!b || !c, Ne = { closeToast: j, type: u, theme: U }, ye = null;
return i === !1 || (W(i) ? ye = i(Ne) : Ce(i) ? ye = Fe(i, Ne) : ye = Kt(Ne)), I.createElement(Z, { isIn: O, done: w, position: P, preventExitTransition: r, nodeRef: n, playToast: a }, I.createElement("div", { id: L, tabIndex: 0, onClick: l, "data-in": O, className: Bt, ...s, style: E, ref: n, ...O && { role: g, "aria-label": K } }, qe != null && I.createElement("div", { className: ee("Toastify__toast-icon", { "Toastify--animate-icon Toastify__zoom-enter": !V }) }, qe), At(o, t, !e), ye, !t.customProgressBar && I.createElement(er, { ...p && !He ? { key: `p-${p}` } : {}, rtl: R, theme: U, delay: c, isRunning: e, isIn: O, closeToast: j, hide: C, type: u, className: T, controlledProgress: He, progress: b || 0 })));
}, Cr = (t, e = !1) => ({ enter: `Toastify--animate Toastify__${t}-enter`, exit: `Toastify--animate Toastify__${t}-exit`, appendPosition: e }), Er = Gt(Cr("bounce", !0)), Ar = { position: "top-right", transition: Er, autoClose: 5e3, closeButton: !0, pauseOnHover: !0, pauseOnFocusLoss: !0, draggable: "touch", draggablePercent: 80, draggableDirection: "x", role: "alert", theme: "light", "aria-label": "Notifications Alt+T", hotKeys: (t) => t.altKey && t.code === "KeyT" };
function wn(t) {
let e = { ...Ar, ...t }, r = t.stacked, [n, s] = Re(!0), a = le(null), { getToastToRender: i, isToastActive: o, count: c } = mr(e), { className: l, style: u, rtl: C, containerId: j, hotKeys: Z } = e;
function P(E) {
let T = ee("Toastify__toast-container", `Toastify__toast-container--${E}`, { "Toastify__toast-container--rtl": C });
return W(l) ? l({ position: E, rtl: C, defaultClassName: T }) : ee(T, Ze(l));
}
function N() {
r && (s(!0), A.play());
}
return gr(() => {
var E;
if (r) {
let T = a.current.querySelectorAll('[data-in="true"]'), p = 12, g = (E = e.position) == null ? void 0 : E.includes("top"), b = 0, R = 0;
Array.from(T).reverse().forEach((L, w) => {
let O = L;
O.classList.add("Toastify__toast--stacked"), w > 0 && (O.dataset.collapsed = `${n}`), O.dataset.pos || (O.dataset.pos = g ? "top" : "bot");
let V = b * (n ? 0.2 : 1) + (n ? 0 : p * w);
O.style.setProperty("--y", `${g ? V : V * -1}px`), O.style.setProperty("--g", `${p}`), O.style.setProperty("--s", `${1 - (n ? R : 0)}`), b += O.offsetHeight, R += 0.025;
});
}
}, [n, c, r]), Te(() => {
function E(T) {
var p;
let g = a.current;
Z(T) && ((p = g.querySelector('[tabIndex="0"]')) == null || p.focus(), s(!1), A.pause()), T.key === "Escape" && (document.activeElement === g || g != null && g.contains(document.activeElement)) && (s(!0), A.play());
}
return document.addEventListener("keydown", E), () => {
document.removeEventListener("keydown", E);
};
}, [Z]), I.createElement("section", { ref: a, className: "Toastify", id: j, onMouseEnter: () => {
r && (s(!1), A.pause());
}, onMouseLeave: N, "aria-live": "polite", "aria-atomic": "false", "aria-relevant": "additions text", "aria-label": e["aria-label"] }, i((E, T) => {
let p = T.length ? { ...u } : { ...u, pointerEvents: "none" };
return I.createElement("div", { tabIndex: -1, className: P(E), "data-stacked": r, style: p, key: `c-${E}` }, T.map(({ content: g, props: b }) => I.createElement(Tr, { ...b, stacked: r, collapseAll: N, isIn: o(b.toastId, b.containerId), key: `t-${b.key}` }, g)));
}));
}
const Tn = ({
title: t,
description: e,
children: r,
onConfirm: n,
...s
}) => {
const { t: a } = Tt();
return /* @__PURE__ */ F(gt, { ...s, children: [
r && /* @__PURE__ */ M(yt, { children: r }),
/* @__PURE__ */ F(vt, { children: [
/* @__PURE__ */ F(_t, { children: [
/* @__PURE__ */ M(bt, { children: t || a("Are you absolutely sure?") }),
/* @__PURE__ */ M(Wt, { children: e || a(
"This action cannot be undone. This will permanently delete your data from our servers."
) })
] }),
/* @__PURE__ */ F(xt, { children: [
/* @__PURE__ */ M(kt, { className: "mt-0", children: a("Cancel") }),
/* @__PURE__ */ M(wt, { onClick: n, children: a("Confirm") })
] })
] })
] });
}, Ye = (t, e, r) => {
if (t && "reportValidity" in t) {
const n = je(r, e);
t.setCustomValidity(n && n.message || ""), t.reportValidity();
}
}, ze = (t, e) => {
for (const r in e.fields) {
const n = e.fields[r];
n && n.ref && "reportValidity" in n.ref ? Ye(n.ref, r, t) : n && n.refs && n.refs.forEach((s) => Ye(s, r, t));
}
}, Je = (t, e) => {
e.shouldUseNativeValidation && ze(t, e);
const r = {};
for (const n in t) {
const s = je(e.fields, n), a = Object.assign(t[n] || {}, { ref: s && s.ref });
if (Or(e.names || Object.keys(t), n)) {
const i = Object.assign({}, je(r, n));
Ie(i, "root", a), Ie(r, n, i);
} else Ie(r, n, a);
}
return r;
}, Or = (t, e) => {
const r = Qe(e);
return t.some((n) => Qe(n).match(`^${r}\\.\\d+`));
};
function Qe(t) {
return t.replace(/\]|\[/g, "");
}
function jt(t, e, r) {
function n(o, c) {
var l;
Object.defineProperty(o, "_zod", {
value: o._zod ?? {},
enumerable: !1
}), (l = o._zod).traits ?? (l.traits = /* @__PURE__ */ new Set()), o._zod.traits.add(t), e(o, c);
for (const u in i.prototype)
u in o || Object.defineProperty(o, u, { value: i.prototype[u].bind(o) });
o._zod.constr = i, o._zod.def = c;
}
const s = (r == null ? void 0 : r.Parent) ?? Object;
class a extends s {
}
Object.defineProperty(a, "name", { value: t });
function i(o) {
var c;
const l = r != null && r.Parent ? new a() : this;
n(l, o), (c = l._zod).deferred ?? (c.deferred = []);
for (const u of l._zod.deferred)
u();
return l;
}
return Object.defineProperty(i, "init", { value: n }), Object.defineProperty(i, Symbol.hasInstance, {
value: (o) => {
var c, l;
return r != null && r.Parent && o instanceof r.Parent ? !0 : (l = (c = o == null ? void 0 : o._zod) == null ? void 0 : c.traits) == null ? void 0 : l.has(t);
}
}), Object.defineProperty(i, "name", { value: t }), i;
}
class Nr extends Error {
constructor() {
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
}
}
const Ir = {};
function Zt(t) {
return Ir;
}
function Sr(t, e) {
return typeof e == "bigint" ? e.toString() : e;
}
const $t = Error.captureStackTrace ? Error.captureStackTrace : (...t) => {
};
function ve(t) {
return typeof t == "string" ? t : t == null ? void 0 : t.message;
}
function Pt(t, e, r) {
var s, a, i, o, c, l;
const n = { ...t, path: t.path ?? [] };
if (!t.message) {
const u = ve((i = (a = (s = t.inst) == null ? void 0 : s._zod.def) == null ? void 0 : a.error) == null ? void 0 : i.call(a, t)) ?? ve((o = e == null ? void 0 : e.error) == null ? void 0 : o.call(e, t)) ?? ve((c = r.customError) == null ? void 0 : c.call(r, t)) ?? ve((l = r.localeError) == null ? void 0 : l.call(r, t)) ?? "Invalid input";
n.message = u;
}
return delete n.inst, delete n.continue, e != null && e.reportInput || delete n.input, n;
}
const Lt = (t, e) => {
t.name = "$ZodError", Object.defineProperty(t, "_zod", {
value: t._zod,
enumerable: !1
}), Object.defineProperty(t, "issues", {
value: e,
enumerable: !1
}), Object.defineProperty(t, "message", {
get() {
return JSON.stringify(e, Sr, 2);
},
enumerable: !0
// configurable: false,
}), Object.defineProperty(t, "toString", {
value: () => t.message,
enumerable: !1
});
}, Rr = jt("$ZodError", Lt), zt = jt("$ZodError", Lt, { Parent: Error }), jr = (t) => (e, r, n, s) => {
const a = n ? Object.assign(n, { async: !1 }) : { async: !1 }, i = e._zod.run({ value: r, issues: [] }, a);
if (i instanceof Promise)
throw new Nr();
if (i.issues.length) {
const o = new ((s == null ? void 0 : s.Err) ?? t)(i.issues.map((c) => Pt(c, a, Zt())));
throw $t(o, s == null ? void 0 : s.callee), o;
}
return i.value;
}, Zr = /* @__PURE__ */ jr(zt), $r = (t) => async (e, r, n, s) => {
const a = n ? Object.assign(n, { async: !0 }) : { async: !0 };
let i = e._zod.run({ value: r, issues: [] }, a);
if (i instanceof Promise && (i = await i), i.issues.length) {
const o = new ((s == null ? void 0 : s.Err) ?? t)(i.issues.map((c) => Pt(c, a, Zt())));
throw $t(o, s == null ? void 0 : s.callee), o;
}
return i.value;
}, Pr = /* @__PURE__ */ $r(zt);
function Ge(t, e) {
try {
var r = t();
} catch (n) {
return e(n);
}
return r && r.then ? r.then(void 0, e) : r;
}
function Lr(t, e) {
for (var r = {}; t.length; ) {
var n = t[0], s = n.code, a = n.message, i = n.path.join(".");
if (!r[i]) if ("unionErrors" in n) {
var o = n.unionErrors[0].errors[0];
r[i] = { message: o.message, type: o.code };
} else r[i] = { message: a, type: s };
if ("unionErrors" in n && n.unionErrors.forEach(function(u) {
return u.errors.forEach(function(C) {
return t.push(C);
});
}), e) {
var c = r[i].types, l = c && c[n.code];
r[i] = Ct(i, e, r, s, l ? [].concat(l, n.message) : n.message);
}
t.shift();
}
return r;
}
function zr(t, e) {
for (var r = {}; t.length; ) {
var n = t[0], s = n.code, a = n.message, i = n.path.join(".");
if (!r[i]) if (n.code === "invalid_union" && n.errors.length > 0) {
var o = n.errors[0][0];
r[i] = { message: o.message, type: o.code };
} else r[i] = { message: a, type: s };
if (n.code === "invalid_union" && n.errors.forEach(function(u) {
return u.forEach(function(C) {
return t.push(C);
});
}), e) {
var c = r[i].types, l = c && c[n.code];
r[i] = Ct(i, e, r, s, l ? [].concat(l, n.message) : n.message);
}
t.shift();
}
return r;
}
function Mr(t, e, r) {
if (r === void 0 && (r = {}), (function(n) {
return "_def" in n && typeof n._def == "object" && "typeName" in n._def;
})(t)) return function(n, s, a) {
try {
return Promise.resolve(Ge(function() {
return Promise.resolve(t[r.mode === "sync" ? "parse" : "parseAsync"](n, e)).then(function(i) {
return a.shouldUseNativeValidation && ze({}, a), { errors: {}, values: r.raw ? Object.assign({}, n) : i };
});
}, function(i) {
if ((function(o) {
return Array.isArray(o == null ? void 0 : o.issues);
})(i)) return { values: {}, errors: Je(Lr(i.errors, !a.shouldUseNativeValidation && a.criteriaMode === "all"), a) };
throw i;
}));
} catch (i) {
return Promise.reject(i);
}
};
if ((function(n) {
return "_zod" in n && typeof n._zod == "object";
})(t)) return function(n, s, a) {
try {
return Promise.resolve(Ge(function() {
return Promise.resolve((r.mode === "sync" ? Zr : Pr)(t, n, e)).then(function(i) {
return a.shouldUseNativeValidation && ze({}, a), { errors: {}, values: r.raw ? Object.assign({}, n) : i };
});
}, function(i) {
if ((function(o) {
return o instanceof Rr;
})(i)) return { values: {}, errors: Je(zr(i.issues, !a.shouldUseNativeValidation && a.criteriaMode === "all"), a) };
throw i;
}));
} catch (i) {
return Promise.reject(i);
}
};
throw new Error("Invalid input: not a Zod schema");
}
var k;
(function(t) {
t.assertEqual = (s) => {
};
function e(s) {
}
t.assertIs = e;
function r(s) {
throw new Error();
}
t.assertNever = r, t.arrayToEnum = (s) => {
const a = {};
for (const i of s)
a[i] = i;
return a;
}, t.getValidEnumValues = (s) => {
const a = t.objectKeys(s).filter((o) => typeof s[s[o]] != "number"), i = {};
for (const o of a)
i[o] = s[o];
return t.objectValues(i);
}, t.objectValues = (s) => t.objectKeys(s).map(function(a) {
return s[a];
}), t.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
const a = [];
for (const i in s)
Object.prototype.hasOwnProperty.call(s, i) && a.push(i);
return a;
}, t.find = (s, a) => {
for (const i of s)
if (a(i))
return i;
}, t.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && Number.isFinite(s) && Math.floor(s) === s;
function n(s, a = " | ") {
return s.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
}
t.joinValues = n, t.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
})(k || (k = {}));
var Ke;
(function(t) {
t.mergeShapes = (e, r) => ({
...e,
...r
// second overwrites first
});
})(Ke || (Ke = {}));
const h = k.arrayToEnum([
"string",
"nan",
"number",
"integer",
"float",
"boolean",
"date",
"bigint",
"symbol",
"function",
"undefined",
"null",
"array",
"object",
"unknown",
"promise",
"void",
"never",
"map",
"set"
]), X = (t) => {
switch (typeof t) {
case "undefined":
return h.undefined;
case "string":
return h.string;
case "number":
return Number.isNaN(t) ? h.nan : h.number;
case "boolean":
return h.boolean;
case "function":
return h.function;
case "bigint":
return h.bigint;
case "symbol":
return h.symbol;
case "object":
return Array.isArray(t) ? h.array : t === null ? h.null : t.then && typeof t.then == "function" && t.catch && typeof t.catch == "function" ? h.promise : typeof Map < "u" && t instanceof Map ? h.map : typeof Set < "u" && t instanceof Set ? h.set : typeof Date < "u" && t instanceof Date ? h.date : h.object;
default:
return h.unknown;
}
}, d = k.arrayToEnum([
"invalid_type",
"invalid_literal",
"custom",
"invalid_union",
"invalid_union_discriminator",
"invalid_enum_value",
"unrecognized_keys",
"invalid_arguments",
"invalid_return_type",
"invalid_date",
"invalid_string",
"too_small",
"too_big",
"invalid_intersection_types",
"not_multiple_of",
"not_finite"
]);
class q extends Error {
get errors() {
return this.issues;
}
constructor(e) {
super(), this.issues = [], this.addIssue = (n) => {
this.issues = [...this.issues, n];
}, this.addIssues = (n = []) => {
this.issues = [...this.issues, ...n];
};
const r = new.target.prototype;
Object.setPrototypeOf ? Object.setPrototypeOf(this, r) : this.__proto__ = r, this.name = "ZodError", this.issues = e;
}
format(e) {
const r = e || function(a) {
return a.message;
}, n = { _errors: [] }, s = (a) => {
for (const i of a.issues)
if (i.code === "invalid_union")
i.unionErrors.map(s);
else if (i.code === "invalid_return_type")
s(i.returnTypeError);
else if (i.code === "invalid_arguments")
s(i.argumentsError);
else if (i.path.length === 0)
n._errors.push(r(i));
else {
let o = n, c = 0;
for (; c < i.path.length; ) {
const l = i.path[c];
c === i.path.length - 1 ? (o[l] = o[l] || { _errors: [] }, o[l]._errors.push(r(i))) : o[l] = o[l] || { _errors: [] }, o = o[l], c++;
}
}
};
return s(this), n;
}
static assert(e) {
if (!(e instanceof q))
throw new Error(`Not a ZodError: ${e}`);
}
toString() {
return this.message;
}
get message() {
return JSON.stringify(this.issues, k.jsonStringifyReplacer, 2);
}
get isEmpty() {
return this.issues.length === 0;
}
flatten(e = (r) => r.message) {
const r = {}, n = [];
for (const s of this.issues)
if (s.path.length > 0) {
const a = s.path[0];
r[a] = r[a] || [], r[a].push(e(s));
} else
n.push(e(s));
return { formErrors: n, fieldErrors: r };
}
get formErrors() {
return this.flatten();
}
}
q.create = (t) => new q(t);
const Me = (t, e) => {
let r;
switch (t.code) {
case d.invalid_type:
t.received === h.undefined ? r = "Required" : r = `Expected ${t.expected}, received ${t.received}`;
break;
case d.invalid_literal:
r = `Invalid literal value, expected ${JSON.stringify(t.expected, k.jsonStringifyReplacer)}`;
break;
case d.unrecognized_keys:
r = `Unrecognized key(s) in object: ${k.joinValues(t.keys, ", ")}`;
break;
case d.invalid_union:
r = "Invalid input";
break;
case d.invalid_union_discriminator:
r = `Invalid discriminator value. Expected ${k.joinValues(t.options)}`;
break;
case d.invalid_enum_value:
r = `Invalid enum value. Expected ${k.joinValues(t.options)}, received '${t.received}'`;
break;
case d.invalid_arguments:
r = "Invalid function arguments";
break;
case d.invalid_return_type:
r = "Invalid function return type";
break;
case d.invalid_date:
r = "Invalid date";
break;
case d.invalid_string:
typeof t.validation == "object" ? "includes" in t.validation ? (r = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (r = `${r} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? r = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? r = `Invalid input: must end with "${t.validation.endsWith}"` : k.assertNever(t.validation) : t.validation !== "regex" ? r = `Invalid ${t.validation}` : r = "Invalid";
break;
case d.too_small:
t.type === "array" ? r = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` : t.type === "string" ? r = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` : t.type === "number" ? r = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "bigint" ? r = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "date" ? r = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(t.minimum))}` : r = "Invalid input";
break;
case d.too_big:
t.type === "array" ? r = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "less than"} ${t.maximum} element(s)` : t.type === "string" ? r = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "under"} ${t.maximum} character(s)` : t.type === "number" ? r = `Number must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "bigint" ? r = `BigInt must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "date" ? r = `Date must be ${t.exact ? "exactly" : t.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(t.maximum))}` : r = "Invalid input";
break;
case d.custom:
r = "Invalid input";
break;
case d.invalid_intersection_types:
r = "Intersection results could not be merged";
break;
case d.not_multiple_of:
r = `Number must be a multiple of ${t.multipleOf}`;
break;
case d.not_finite:
r = "Number must be finite";
break;
default:
r = e.defaultError, k.assertNever(t);
}
return { message: r };
};
let Dr = Me;
function Vr() {
return Dr;
}
const Br = (t) => {
const { data: e, path: r, errorMaps: n, issueData: s } = t, a = [...r, ...s.path || []], i = {
...s,
path: a
};
if (s.message !== void 0)
return {
...s,
path: a,
message: s.message
};
let o = "";
const c = n.filter((l) => !!l).slice().reverse();
for (const l of c)
o = l(i, { data: e, defaultError: o }).message;
return {
...s,
path: a,
message: o
};
};
function f(t, e) {
const r = Vr(), n = Br({
issueData: e,
data: t.data,
path: t.path,
errorMaps: [
t.common.contextualErrorMap,
// contextual error map is first priority
t.schemaErrorMap,
// then schema-bound map if available
r,
// then global override map
r === Me ? void 0 : Me
// then global default map
].filter((s) => !!s)
});
t.common.issues.push(n);
}
class z {
constructor() {
this.value = "valid";
}
dirty() {
this.value === "valid" && (this.value = "dirty");
}
abort() {
this.value !== "aborted" && (this.value = "aborted");
}
static mergeArray(e, r) {
const n = [];
for (const s of r) {
if (s.status === "aborted")
return y;
s.status === "dirty" && e.dirty(), n.push(s.value);
}
return { status: e.value, value: n };
}
static async mergeObjectAsync(e, r) {
const n = [];
for (const s of r) {
const a = await s.key, i = await s.value;
n.push({
key: a,
value: i
});
}
return z.mergeObjectSync(e, n);
}
static mergeObjectSync(e, r) {
const n = {};
for (const s of r) {
const { key: a, value: i } = s;
if (a.status === "aborted" || i.status === "aborted")
return y;
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || s.alwaysSet) && (n[a.value] = i.value);
}
return { status: e.value, value: n };
}
}
const y = Object.freeze({
status: "aborted"
}), ce = (t) => ({ status: "dirty", value: t }), D = (t) => ({ status: "valid", value: t }), et = (t) => t.status === "aborted", tt = (t) => t.status === "dirty", se = (t) => t.status === "valid", _e = (t) => typeof Promise < "u" && t instanceof Promise;
var m;
(function(t) {
t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
})(m || (m = {}));
class Q {
constructor(e, r, n, s) {
this._cachedPath = [], this.parent = e, this.data = r, this._path = n, this._key = s;
}
get path() {
return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
}
}
const rt = (t, e) => {
if (se(e))
return { success: !0, data: e.value };
if (!t.common.issues.length)
throw new Error("Validation failed but no issues detected.");
return {
success: !1,
get error() {
if (this._error)
return this._error;
const r = new q(t.common.issues);
return this._error = r, this._error;
}
};
};
function _(t) {
if (!t)
return {};
const { errorMap: e, invalid_type_error: r, required_error: n, description: s } = t;
if (e && (r || n))
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
return e ? { errorMap: e, description: s } : { errorMap: (i, o) => {
const { message: c } = t;
return i.code === "invalid_enum_value" ? { message: c ?? o.defaultError } : typeof o.data > "u" ? { message: c ?? n ?? o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: c ?? r ?? o.defaultError };
}, description: s };
}
class x {
get description() {
return this._def.description;
}
_getType(e) {
return X(e.data);
}
_getOrReturnCtx(e, r) {
return r || {
common: e.parent.common,
data: e.data,
parsedType: X(e.data),
schemaErrorMap: this._def.errorMap,
path: e.path,
parent: e.parent
};
}
_processInputParams(e) {
return {
status: new z(),
ctx: {
common: e.parent.common,
data: e.data,
parsedType: X(e.data),
schemaErrorMap: this._def.errorMap,
path: e.path,
parent: e.parent
}
};
}
_parseSync(e) {
const r = this._parse(e);
if (_e(r))
throw new Error("Synchronous parse encountered promise.");
return r;
}
_parseAsync(e) {
const r = this._parse(e);
return Promise.resolve(r);
}
parse(e, r) {
const n = this.safeParse(e, r);
if (n.success)
return n.data;
throw n.error;
}
safeParse(e, r) {
const n = {
common: {
issues: [],
async: (r == null ? void 0 : r.async) ?? !1,
contextualErrorMap: r == null ? void 0 : r.errorMap
},
path: (r == null ? void 0 : r.path) || [],
schemaErrorMap: this._def.errorMap,
parent: null,
data: e,
parsedType: X(e)
}, s = this._parseSync({ data: e, path: n.path, parent: n });
return rt(n, s);
}
"~validate"(e) {
var n, s;
const r = {
common: {
issues: [],
async: !!this["~standard"].async
},
path: [],
schemaErrorMap: this._def.errorMap,
parent: null,
data: e,
parsedType: X(e)
};
if (!this["~standard"].async)
try {
const a = this._parseSync({ data: e, path: [], parent: r });
return se(a) ? {
value: a.value
} : {
issues: r.common.issues
};
} catch (a) {
(s = (n = a == null ? void 0 : a.message) == null ? void 0 : n.toLowerCase()) != null && s.includes("encountered") && (this["~standard"].async = !0), r.common = {
issues: [],
async: !0
};
}
return this._parseAsync({ data: e, path: [], parent: r }).then((a) => se(a) ? {
value: a.value
} : {
issues: r.common.issues
});
}
async parseAsync(e, r) {
const n = await this.safeParseAsync(e, r);
if (n.success)
return n.data;
throw n.error;
}
async safeParseAsync(e, r) {
const n = {
common: {
issues: [],
contextualErrorMap: r == null ? void 0 : r.errorMap,
async: !0
},
path: (r == null ? void 0 : r.path) || [],
schemaErrorMap: this._def.errorMap,
parent: null,
data: e,
parsedType: X(e)
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (_e(s) ? s : Promise.resolve(s));
return rt(n, a);
}
refine(e, r) {
const n = (s) => typeof r == "string" || typeof r > "u" ? { message: r } : typeof r == "function" ? r(s) : r;
return this._refinement((s, a) => {
const i = e(s), o = () => a.addIssue({
code: d.custom,
...n(s)
});
return typeof Promise < "u" && i instanceof Promise ? i.then((c) => c ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
});
}
refinement(e, r) {
return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof r == "function" ? r(n, s) : r), !1));
}
_refinement(e) {
return new ie({
schema: this,
typeName: v.ZodEffects,
effect: { type: "refinement", refinement: e }
});
}
superRefine(e) {
return this._refinement(e);
}
constructor(e) {
this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
version: 1,
vendor: "zod",
validate: (r) => this["~validate"](r)
};
}
optional() {
return J.create(this, this._def);
}
nullable() {
return oe.create(this, this._def);
}
nullish() {
return this.nullable().optional();
}
array() {
return B.create(this);
}
promise() {
return we.create(this, this._def);
}
or(e) {
return xe.create([this, e], this._def);
}
and(e) {
return ke.create(this, e, this._def);
}
transform(e) {
return new ie({
..._(this._def),
schema: this,
typeName: v.ZodEffects,
effect: { type: "transform", transform: e }
});
}
default(e) {
const r = typeof e == "function" ? e : () => e;
return new Ve({
..._(this._def),
innerType: this,
defaultValue: r,
typeName: v.ZodDefault
});
}
brand() {
return new fn({
typeName: v.ZodBranded,
type: this,
..._(this._def)
});
}
catch(e) {
const r = typeof e == "function" ? e : () => e;
return new Be({
..._(this._def),
innerType: this,
catchValue: r,
typeName: v.ZodCatch
});
}
describe(e) {
const r = this.constructor;
return new r({
...this._def,
description: e
});
}
pipe(e) {
return We.create(this, e);
}
readonly() {
return Ue.create(this);
}
isOptional() {
return this.safeParse(void 0).success;
}
isNullable() {
return this.safeParse(null).success;
}
}
const Ur = /^c[^\s-]{8,}$/i, Fr = /^[0-9a-z]+$/, Wr = /^[0-9A-HJKMNP-TV-Z]{26}$/i, qr = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Hr = /^[a-z0-9_-]{21}$/i, Xr = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Yr = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Jr = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Qr = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
let Se;
const Gr = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Kr = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, en = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, tn = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, rn = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, nn = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Mt = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", sn = new RegExp(`^${Mt}$`);
function Dt(t) {
let e = "[0-5]\\d";
t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`);
const r = t.precision ? "+" : "?";
return `([01]\\d|2[0-3]):[0-5