@tempots/beatui 1.7.4 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ar-Wr6gMs-M.cjs → ar-CEzAem0F.cjs} +1 -1
- package/dist/{ar-fdUqbCvM.js → ar-CQieaqsq.js} +1 -1
- package/dist/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +1 -1
- package/dist/auth-divider-B8yr-E_b.cjs +1 -0
- package/dist/{auth-divider-D9KnNeyF.js → auth-divider-Byh5BWLc.js} +91 -88
- package/dist/beatui.css +1 -0
- package/dist/beatui.tailwind.css +1 -0
- package/dist/better-auth/index.cjs.js +1 -1
- package/dist/better-auth/index.es.js +27 -26
- package/dist/card-BkA7Wvbh.cjs +1 -0
- package/dist/card-DX1DwGbL.js +62 -0
- package/dist/{colors-C2sgnzFH.js → colors-CyMhfbJi.js} +64 -58
- package/dist/{colors-DPCHjRMj.cjs → colors-IXZF9U-s.cjs} +1 -1
- package/dist/control-hqEuMzyI.js +343 -0
- package/dist/control-muup9GF1.cjs +1 -0
- package/dist/custom-validation-BA9iJWl_.cjs +1 -0
- package/dist/custom-validation-BOBoUwHY.js +181 -0
- package/dist/{de-C5-k5Eov.js → de-CBIwvkAH.js} +1 -1
- package/dist/{de-DZqdSEta.cjs → de-DdfxrlT3.cjs} +1 -1
- package/dist/deep-merge-8fwp1z4X.js +1346 -0
- package/dist/deep-merge-VDGE_HQD.cjs +1 -0
- package/dist/duration-input-DmsljXl3.cjs +1 -0
- package/dist/{duration-input-D4V_PHIg.js → duration-input-ZQlcqdXU.js} +32 -31
- package/dist/{editor-toolbar-group-FpOHrmtx.js → editor-toolbar-group-BNTBMJCe.js} +2 -2
- package/dist/{editor-toolbar-group-C_ft_T8D.cjs → editor-toolbar-group-DiMzqYgz.cjs} +1 -1
- package/dist/{es-h6jmoF4X.js → es--9HaEj2D.js} +1 -1
- package/dist/{es-CJgYfRap.cjs → es-DSdljxFJ.cjs} +1 -1
- package/dist/{fa-BuxK837l.js → fa-1Z-akcW7.js} +1 -1
- package/dist/{fa-BQ5PzwNY.cjs → fa-BolmeWRT.cjs} +1 -1
- package/dist/flyout-CuKFh_T7.js +151 -0
- package/dist/flyout-DC_tKaTG.cjs +1 -0
- package/dist/{fr-Bv3TG44U.cjs → fr-CODgUuoZ.cjs} +1 -1
- package/dist/{fr-BwILQ9G2.js → fr-DhHM9rou.js} +1 -1
- package/dist/{he-yC9Sc7JD.js → he-CBamXbGJ.js} +1 -1
- package/dist/{he-5LbvgMCC.cjs → he-Juw-dr28.cjs} +1 -1
- package/dist/{hi-Da7rcCpP.js → hi-DvvcX-Ra.js} +1 -1
- package/dist/{hi-YWhWcG_L.cjs → hi-R749jeg-.cjs} +1 -1
- package/dist/{index-CvU9E9wd.js → index-BfQaT5Jy.js} +104 -104
- package/dist/{index-XogEKwdt.cjs → index-Dv7nPuwA.cjs} +1 -1
- package/dist/index.cjs.js +4 -4
- package/dist/index.es.js +6713 -9831
- package/dist/{input-container-CyOgiiQD.cjs → input-container-BaWQLWB6.cjs} +1 -1
- package/dist/{input-container-8JFB11xN.js → input-container-DCS5oJ4S.js} +4 -4
- package/dist/{it-BxOIJE45.cjs → it-DT5oRZDH.cjs} +1 -1
- package/dist/{it-Yeklau78.js → it-aV6i8Qxz.js} +1 -1
- package/dist/{ja-Dxj9Q5Yd.js → ja-CuLhGnJX.js} +1 -1
- package/dist/{ja-CNhjK06P.cjs → ja-CwKaCYLB.cjs} +1 -1
- package/dist/json-schema/index.cjs.js +1 -1
- package/dist/json-schema/index.es.js +83 -79
- package/dist/json-schema-display/index.cjs.js +1 -1
- package/dist/json-schema-display/index.es.js +2 -2
- package/dist/json-structure/index.cjs.js +1 -1
- package/dist/json-structure/index.es.js +74 -72
- package/dist/{ko-DgkqcXTs.cjs → ko-Bucro9ID.cjs} +1 -1
- package/dist/{ko-gn_MsegK.js → ko-D-66BsEX.js} +1 -1
- package/dist/lexical/index.cjs.js +1 -1
- package/dist/lexical/index.es.js +5 -5
- package/dist/menu-BFLFKceF.cjs +1 -0
- package/dist/menu-BO6zqyfq.js +220 -0
- package/dist/modal-6Mq3vS5r.js +309 -0
- package/dist/modal-d77-TMc4.cjs +1 -0
- package/dist/{nl-vHNFtXXb.js → nl-CAny6wvm.js} +1 -1
- package/dist/{nl-Dy9lmbBO.cjs → nl-D7vHpehb.cjs} +1 -1
- package/dist/notice-BNGx86Yg.js +110 -0
- package/dist/notice-iF6zBMq9.cjs +1 -0
- package/dist/{oneof-branch-detection-Q_jxvJIA.js → oneof-branch-detection-Bm17RhC2.js} +27 -26
- package/dist/oneof-branch-detection-DZ4MrfBp.cjs +1 -0
- package/dist/openui/index.cjs.js +9 -0
- package/dist/openui/index.es.js +2174 -0
- package/dist/password-input-Bipt7Wsu.cjs +1 -0
- package/dist/password-input-mkRmrEPq.js +105 -0
- package/dist/{pl-BtYbtsmG.cjs → pl-CSiXoOKT.cjs} +1 -1
- package/dist/{pl-C0UdHla0.js → pl-rmZLgQ_V.js} +1 -1
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +4 -4
- package/dist/{pt-CtNmqQ1X.cjs → pt-CJT-iq4y.cjs} +1 -1
- package/dist/{pt-DGKtfN0d.js → pt-DHnajqAi.js} +1 -1
- package/dist/{ru-CpXYLt-v.js → ru-C_E8OZNE.js} +1 -1
- package/dist/{ru-BaL_NPRU.cjs → ru-G3sr_ctV.cjs} +1 -1
- package/dist/slider-input-SLguFA0d.cjs +1 -0
- package/dist/slider-input-VYAMm7pE.js +285 -0
- package/dist/stepper-24p16Zsv.cjs +1 -0
- package/dist/stepper-TlzbfYWa.js +3222 -0
- package/dist/tailwind/preset.cjs.js +1 -1
- package/dist/tailwind/preset.es.js +38 -40
- package/dist/tailwind/vite-plugin.cjs.js +14 -12
- package/dist/tailwind/vite-plugin.es.js +317 -246
- package/dist/text-area-BdemKQ_w.cjs +1 -0
- package/dist/text-area-Br83-_PQ.js +431 -0
- package/dist/{text-input-NJypZSnE.js → text-input-ByuxdX8w.js} +5 -5
- package/dist/{text-input-DS5zlXb2.cjs → text-input-MjlUC_9u.cjs} +1 -1
- package/dist/{toolbar-BF2L6WKC.js → toolbar-CEBTTjHh.js} +1 -1
- package/dist/{toolbar-BBwfe8U9.cjs → toolbar-DWawYFFX.cjs} +1 -1
- package/dist/{tr-DwOd87oB.cjs → tr-DcxLHHTC.cjs} +1 -1
- package/dist/{tr-DIFZDFW_.js → tr-bVXwloKC.js} +1 -1
- package/dist/{translations-EwEmHe3v.cjs → translations-D3xqZUTA.cjs} +1 -1
- package/dist/{translations-BCMP-h52.js → translations-DU9wTV1y.js} +20 -19
- package/dist/{translations-5cXBrENb.js → translations-RT_UN8ny.js} +1 -1
- package/dist/{translations-BqWc0ZHz.cjs → translations-qljG2Chq.cjs} +1 -1
- package/dist/types/components/navigation/stepper.d.ts +4 -4
- package/dist/types/openui/index.d.ts +28 -0
- package/dist/types/openui/library/define-component.d.ts +15 -0
- package/dist/types/openui/library/library.d.ts +7 -0
- package/dist/types/openui/library/prompt-generator.d.ts +5 -0
- package/dist/types/openui/library/types.d.ts +33 -0
- package/dist/types/openui/parser/parser.d.ts +8 -0
- package/dist/types/openui/parser/streaming-parser.d.ts +14 -0
- package/dist/types/openui/parser/tokenizer.d.ts +9 -0
- package/dist/types/openui/parser/types.d.ts +46 -0
- package/dist/types/openui/registry/button.d.ts +148 -0
- package/dist/types/openui/registry/data.d.ts +177 -0
- package/dist/types/openui/registry/form.d.ts +65 -0
- package/dist/types/openui/registry/format.d.ts +67 -0
- package/dist/types/openui/registry/index.d.ts +9 -0
- package/dist/types/openui/registry/layout.d.ts +45 -0
- package/dist/types/openui/registry/navigation.d.ts +149 -0
- package/dist/types/openui/registry/overlay.d.ts +56 -0
- package/dist/types/openui/registry/typography.d.ts +17 -0
- package/dist/types/openui/renderer/action-context.d.ts +24 -0
- package/dist/types/openui/renderer/node-resolver.d.ts +9 -0
- package/dist/types/openui/renderer/openui-renderer.d.ts +32 -0
- package/dist/types/openui/renderer/skeleton.d.ts +2 -0
- package/dist/types/openui/streaming/from-fetch.d.ts +7 -0
- package/dist/types/openui/streaming/from-sse.d.ts +7 -0
- package/dist/types/openui/streaming/from-websocket.d.ts +10 -0
- package/dist/types/openui/streaming/types.d.ts +5 -0
- package/dist/types/tailwind/preset.d.ts +25 -4
- package/dist/types/tailwind/vite-plugin.d.ts +17 -5
- package/dist/types/tokens/colors.d.ts +87 -9
- package/dist/types/tokens/index.d.ts +7 -6
- package/dist/{ur-DBst-TXc.js → ur-Dls2qb4V.js} +1 -1
- package/dist/{ur-D9nLchps.cjs → ur-IRQoHh1E.cjs} +1 -1
- package/dist/use-form-BZ8vDYOv.cjs +2 -0
- package/dist/use-form-DsCzINfm.js +750 -0
- package/dist/utils-D3-NApSw.cjs +1 -0
- package/dist/utils-Nbh7yQ73.js +105 -0
- package/dist/{vi-Dg1aiMr5.cjs → vi-Bi9SvVCP.cjs} +1 -1
- package/dist/{vi-DQOJp32U.js → vi-C3mTzj50.js} +1 -1
- package/dist/widget-customization-BV6XB2v_.cjs +1 -0
- package/dist/widget-customization-Bso45ONQ.js +1198 -0
- package/dist/{zh-DPK4HXl2.js → zh-B4JRJBt2.js} +1 -1
- package/dist/{zh-tbwSTbmn.cjs → zh-BMU5rYu1.cjs} +1 -1
- package/package.json +31 -20
- package/dist/auth-divider-CjcrgXmq.cjs +0 -1
- package/dist/custom-validation-7por5nJN.js +0 -488
- package/dist/custom-validation-CLscGHY4.cjs +0 -1
- package/dist/deep-merge-D90SW1Ci.cjs +0 -1
- package/dist/deep-merge-DT2H9AGq.js +0 -1765
- package/dist/duration-input-4AQnQpyo.cjs +0 -1
- package/dist/menu-B60Q9j3-.cjs +0 -1
- package/dist/menu-BkqFGcXg.js +0 -366
- package/dist/notice-CQGJyZ8o.js +0 -211
- package/dist/notice-p2IqXS5-.cjs +0 -1
- package/dist/oneof-branch-detection-xDDDdYRk.cjs +0 -1
- package/dist/use-form-8NnZ-KHk.js +0 -1090
- package/dist/use-form-Dcra7GeE.cjs +0 -2
- package/dist/utils-DmEuG3Np.cjs +0 -1
- package/dist/utils-vUtP6iPG.js +0 -165
- package/dist/widget-customization-BIBva3f-.js +0 -1458
- package/dist/widget-customization-pqmtsraC.cjs +0 -1
|
@@ -1,488 +0,0 @@
|
|
|
1
|
-
import { WithElement as q, OnDispose as W, WithBrowserCtx as z, Value as j, render as R, html as E, dataAttr as F, attr as f, computedOf as A, Use as _, prop as U, aria as B, on as H, When as O, Fragment as K, coalesce as S } from "@tempots/dom";
|
|
2
|
-
import { u as G } from "./use-animated-toggle-C3asw_Sg.js";
|
|
3
|
-
import { delayedAnimationFrame as J } from "@tempots/std";
|
|
4
|
-
import { s as N } from "./session-id-3KiilioY.js";
|
|
5
|
-
import { B as P } from "./translations-BCMP-h52.js";
|
|
6
|
-
import { C as Q } from "./use-form-8NnZ-KHk.js";
|
|
7
|
-
import { B as D } from "./input-container-8JFB11xN.js";
|
|
8
|
-
const X = [
|
|
9
|
-
"a[href]",
|
|
10
|
-
"button:not([disabled])",
|
|
11
|
-
"input:not([disabled])",
|
|
12
|
-
"select:not([disabled])",
|
|
13
|
-
"textarea:not([disabled])",
|
|
14
|
-
'[tabindex]:not([tabindex="-1"])',
|
|
15
|
-
'[contenteditable="true"]',
|
|
16
|
-
"audio[controls]",
|
|
17
|
-
"video[controls]",
|
|
18
|
-
"details > summary:first-of-type",
|
|
19
|
-
"details[open]"
|
|
20
|
-
].join(", ");
|
|
21
|
-
function Y(c) {
|
|
22
|
-
return Array.from(c.querySelectorAll(X)).filter(
|
|
23
|
-
(e) => {
|
|
24
|
-
const s = e;
|
|
25
|
-
return s.offsetWidth > 0 && s.offsetHeight > 0 && !s.hasAttribute("inert") && window.getComputedStyle(s).visibility !== "hidden";
|
|
26
|
-
}
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
function $(c = {}) {
|
|
30
|
-
const {
|
|
31
|
-
active: e = !0,
|
|
32
|
-
escapeDeactivates: s = !0,
|
|
33
|
-
onEscape: t,
|
|
34
|
-
initialFocus: n,
|
|
35
|
-
returnFocus: r,
|
|
36
|
-
clickOutsideDeactivates: l = !1,
|
|
37
|
-
onClickOutside: u
|
|
38
|
-
} = c;
|
|
39
|
-
return q((g) => {
|
|
40
|
-
let h = e, m = null, i = [], b = null, p = null, d = null;
|
|
41
|
-
typeof document < "u" && (m = document.activeElement);
|
|
42
|
-
const y = () => {
|
|
43
|
-
i = Y(g);
|
|
44
|
-
}, x = (a) => {
|
|
45
|
-
if (h) {
|
|
46
|
-
if (s && a.key === "Escape") {
|
|
47
|
-
a.preventDefault(), t?.();
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
if (a.key === "Tab") {
|
|
51
|
-
if (y(), i.length === 0) {
|
|
52
|
-
a.preventDefault();
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
const o = i.indexOf(
|
|
56
|
-
document.activeElement
|
|
57
|
-
);
|
|
58
|
-
a.shiftKey ? o <= 0 && (a.preventDefault(), i[i.length - 1]?.focus()) : o >= i.length - 1 && (a.preventDefault(), i[0]?.focus());
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}, v = (a) => {
|
|
62
|
-
if (!h || !l) return;
|
|
63
|
-
const o = a.target;
|
|
64
|
-
g.contains(o) || u?.();
|
|
65
|
-
}, k = () => {
|
|
66
|
-
if (!h) return;
|
|
67
|
-
y();
|
|
68
|
-
let a = null;
|
|
69
|
-
typeof n == "function" ? a = n() : n ? a = n : i.length > 0 && (a = i[0]), a && (p = setTimeout(() => {
|
|
70
|
-
p = null, a?.focus();
|
|
71
|
-
}, 50)), document.addEventListener("keydown", x, !0), l && document.addEventListener("click", v, !0);
|
|
72
|
-
}, w = () => {
|
|
73
|
-
h = !1, document.removeEventListener("keydown", x, !0), document.removeEventListener("click", v, !0);
|
|
74
|
-
let a = null;
|
|
75
|
-
typeof r == "function" ? a = r() : r ? a = r : m && (a = m), a && document.body.contains(a) && (d = setTimeout(() => {
|
|
76
|
-
d = null, a?.focus();
|
|
77
|
-
}, 0));
|
|
78
|
-
};
|
|
79
|
-
return b = setTimeout(() => {
|
|
80
|
-
b = null, k();
|
|
81
|
-
}, 0), W(() => {
|
|
82
|
-
b != null && clearTimeout(b), p != null && clearTimeout(p), d != null && clearTimeout(d), w();
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
function de(c = {}) {
|
|
87
|
-
return {
|
|
88
|
-
activate: () => $({ ...c, active: !0 }),
|
|
89
|
-
deactivate: () => $({ ...c, active: !1 })
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
function Z(c) {
|
|
93
|
-
return z((e) => {
|
|
94
|
-
const s = [], t = () => s.forEach((r) => r());
|
|
95
|
-
return c(({
|
|
96
|
-
effect: r = "opaque",
|
|
97
|
-
mode: l = "capturing",
|
|
98
|
-
onClickOutside: u,
|
|
99
|
-
onEscape: g,
|
|
100
|
-
content: h,
|
|
101
|
-
container: m = "body"
|
|
102
|
-
}) => {
|
|
103
|
-
m === "body" && (e = e.makePortal("body"));
|
|
104
|
-
const i = G();
|
|
105
|
-
i.listenOnClosed(t);
|
|
106
|
-
let b = () => {
|
|
107
|
-
}, p = () => {
|
|
108
|
-
};
|
|
109
|
-
const d = (a) => {
|
|
110
|
-
a.key === "Escape" && (g?.(), i.close());
|
|
111
|
-
}, y = () => {
|
|
112
|
-
u?.(), i.close();
|
|
113
|
-
}, x = (a) => {
|
|
114
|
-
b(), p(), a === "capturing" ? (document.addEventListener("keydown", d), b = () => document.removeEventListener("keydown", d), e.element.addEventListener("mousedown", y), p = () => e.element.removeEventListener("mousedown", y)) : (b = () => {
|
|
115
|
-
}, p = () => {
|
|
116
|
-
});
|
|
117
|
-
}, v = j.on(l, x);
|
|
118
|
-
s.push(v), s.push(() => {
|
|
119
|
-
i.dispose(), b(), p();
|
|
120
|
-
});
|
|
121
|
-
const w = R((() => {
|
|
122
|
-
const a = /* @__PURE__ */ new Set();
|
|
123
|
-
for (const o of e.element.querySelectorAll(
|
|
124
|
-
":scope > :not([data-overlay])"
|
|
125
|
-
))
|
|
126
|
-
o.hasAttribute("inert") ? a.add(o) : o.setAttribute("inert", "");
|
|
127
|
-
return s.push(() => {
|
|
128
|
-
for (const o of e.element.querySelectorAll(
|
|
129
|
-
":scope > :not([data-overlay])"
|
|
130
|
-
))
|
|
131
|
-
a.has(o) || o.removeAttribute("inert");
|
|
132
|
-
a.clear();
|
|
133
|
-
}), document.activeElement?.blur?.(), E.div(
|
|
134
|
-
q((o) => i.setElement(o)),
|
|
135
|
-
F("status", i.status.map(String)),
|
|
136
|
-
F("overlay", "true"),
|
|
137
|
-
f.class(
|
|
138
|
-
A(
|
|
139
|
-
r ?? "opaque",
|
|
140
|
-
l
|
|
141
|
-
)(
|
|
142
|
-
(o, L) => `bc-overlay bc-overlay--container-${m} bc-overlay--effect-${o} bc-overlay--mode-${L}`
|
|
143
|
-
)
|
|
144
|
-
),
|
|
145
|
-
h
|
|
146
|
-
);
|
|
147
|
-
})(), e.element, {
|
|
148
|
-
disposeWithParent: !0,
|
|
149
|
-
clear: !1,
|
|
150
|
-
providers: e.providers
|
|
151
|
-
});
|
|
152
|
-
s.push(w), J(() => i.open());
|
|
153
|
-
}, t);
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
function ee(c, e) {
|
|
157
|
-
const {
|
|
158
|
-
size: s = "md",
|
|
159
|
-
dismissable: t = !0,
|
|
160
|
-
showCloseButton: n = !0,
|
|
161
|
-
onClose: r,
|
|
162
|
-
overlayEffect: l = "opaque",
|
|
163
|
-
container: u = "body",
|
|
164
|
-
position: g = "center"
|
|
165
|
-
} = c;
|
|
166
|
-
return Z((h, m) => {
|
|
167
|
-
let i = () => {
|
|
168
|
-
};
|
|
169
|
-
return e((d) => {
|
|
170
|
-
i = m;
|
|
171
|
-
const y = U("capturing");
|
|
172
|
-
j.on(t, (o) => {
|
|
173
|
-
y.set(o ? "capturing" : "non-capturing");
|
|
174
|
-
});
|
|
175
|
-
const x = A(
|
|
176
|
-
d.header != null,
|
|
177
|
-
n
|
|
178
|
-
)((o, L) => o || L), v = N("modal"), k = `${v}-header`, w = `${v}-body`, a = E.div(
|
|
179
|
-
f.class(
|
|
180
|
-
A(
|
|
181
|
-
s,
|
|
182
|
-
g
|
|
183
|
-
)(
|
|
184
|
-
(o, L) => `bc-modal bc-modal--size-${o} bc-modal--container-${u} bc-modal--position-${L}`
|
|
185
|
-
)
|
|
186
|
-
),
|
|
187
|
-
// Essential ARIA attributes for modal dialog
|
|
188
|
-
f.role("dialog"),
|
|
189
|
-
B.modal(!0),
|
|
190
|
-
...d.header ? [B.labelledby(k)] : [],
|
|
191
|
-
B.describedby(w),
|
|
192
|
-
f.tabindex(-1),
|
|
193
|
-
// Make modal focusable for initial focus
|
|
194
|
-
f.id(v),
|
|
195
|
-
F("focus-trap", "true"),
|
|
196
|
-
// Mark as focus trap container
|
|
197
|
-
H.mousedown((o) => o.stopPropagation()),
|
|
198
|
-
// Prevent overlay click-outside when clicking modal content
|
|
199
|
-
// Focus trap implementation
|
|
200
|
-
$({
|
|
201
|
-
escapeDeactivates: !1,
|
|
202
|
-
// Let Overlay handle escape key
|
|
203
|
-
initialFocus: () => {
|
|
204
|
-
const o = document.getElementById(v);
|
|
205
|
-
if (!o) return null;
|
|
206
|
-
const L = o.querySelector(
|
|
207
|
-
'[aria-label="Close modal"]'
|
|
208
|
-
);
|
|
209
|
-
if (L) return L;
|
|
210
|
-
const M = o.querySelector(
|
|
211
|
-
'button, input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
212
|
-
);
|
|
213
|
-
return M || o;
|
|
214
|
-
}
|
|
215
|
-
}),
|
|
216
|
-
// Modal content container
|
|
217
|
-
E.div(
|
|
218
|
-
f.class("bc-modal__content"),
|
|
219
|
-
// Header section
|
|
220
|
-
O(
|
|
221
|
-
x,
|
|
222
|
-
() => E.div(
|
|
223
|
-
f.class("bc-modal__header"),
|
|
224
|
-
E.div(
|
|
225
|
-
f.class("bc-modal__title"),
|
|
226
|
-
...d.header ? [f.id(k)] : [],
|
|
227
|
-
d.header
|
|
228
|
-
),
|
|
229
|
-
O(
|
|
230
|
-
n,
|
|
231
|
-
() => _(
|
|
232
|
-
P,
|
|
233
|
-
(o) => Q({
|
|
234
|
-
size: "sm",
|
|
235
|
-
label: o.$.closeModal,
|
|
236
|
-
onClick: () => {
|
|
237
|
-
i(), m();
|
|
238
|
-
}
|
|
239
|
-
})
|
|
240
|
-
)
|
|
241
|
-
)
|
|
242
|
-
)
|
|
243
|
-
),
|
|
244
|
-
// Body section
|
|
245
|
-
E.div(f.class("bc-modal__body"), f.id(w), d.body),
|
|
246
|
-
// Footer section
|
|
247
|
-
d.footer && E.div(f.class("bc-modal__footer"), d.footer)
|
|
248
|
-
)
|
|
249
|
-
);
|
|
250
|
-
h({
|
|
251
|
-
mode: y,
|
|
252
|
-
effect: l ?? "opaque",
|
|
253
|
-
container: u,
|
|
254
|
-
content: a,
|
|
255
|
-
onClickOutside: () => {
|
|
256
|
-
r?.(), m();
|
|
257
|
-
},
|
|
258
|
-
onEscape: () => {
|
|
259
|
-
r?.(), m();
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
}, () => {
|
|
263
|
-
i(), m();
|
|
264
|
-
});
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
function me(c, e) {
|
|
268
|
-
const { confirmText: s, cancelText: t, onConfirm: n, onCancel: r, ...l } = c;
|
|
269
|
-
return _(
|
|
270
|
-
P,
|
|
271
|
-
(u) => ee({ showCloseButton: !1, ...l }, (g, h) => {
|
|
272
|
-
const m = () => {
|
|
273
|
-
n?.(), h();
|
|
274
|
-
}, i = () => {
|
|
275
|
-
r?.(), h();
|
|
276
|
-
};
|
|
277
|
-
return e((p) => {
|
|
278
|
-
g({
|
|
279
|
-
body: p,
|
|
280
|
-
footer: K(
|
|
281
|
-
f.class("bc-modal__actions"),
|
|
282
|
-
D(
|
|
283
|
-
{
|
|
284
|
-
variant: "outline",
|
|
285
|
-
onClick: i
|
|
286
|
-
},
|
|
287
|
-
S(t, u.$.cancel)
|
|
288
|
-
),
|
|
289
|
-
D(
|
|
290
|
-
{
|
|
291
|
-
color: "primary",
|
|
292
|
-
variant: "filled",
|
|
293
|
-
onClick: m
|
|
294
|
-
},
|
|
295
|
-
S(s, u.$.confirm)
|
|
296
|
-
)
|
|
297
|
-
)
|
|
298
|
-
});
|
|
299
|
-
}, h);
|
|
300
|
-
})
|
|
301
|
-
);
|
|
302
|
-
}
|
|
303
|
-
function te(c) {
|
|
304
|
-
return {
|
|
305
|
-
"~standard": {
|
|
306
|
-
version: 1,
|
|
307
|
-
vendor: "beatui-custom",
|
|
308
|
-
validate: (s) => {
|
|
309
|
-
const t = c.validate(s);
|
|
310
|
-
return t.success ? { value: t.data } : {
|
|
311
|
-
issues: t.errors.map((n) => ({
|
|
312
|
-
message: n.message,
|
|
313
|
-
path: n.path
|
|
314
|
-
}))
|
|
315
|
-
};
|
|
316
|
-
},
|
|
317
|
-
types: void 0
|
|
318
|
-
},
|
|
319
|
-
safeParse: (s) => {
|
|
320
|
-
const t = c.validate(s);
|
|
321
|
-
return t.success ? { success: !0, data: t.data } : {
|
|
322
|
-
success: !1,
|
|
323
|
-
error: {
|
|
324
|
-
errors: t.errors.map((n) => ({
|
|
325
|
-
message: n.message,
|
|
326
|
-
path: n.path?.map(
|
|
327
|
-
(r) => typeof r == "object" && "key" in r ? r.key.toString() : r.toString()
|
|
328
|
-
) || []
|
|
329
|
-
}))
|
|
330
|
-
}
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
};
|
|
334
|
-
}
|
|
335
|
-
class T {
|
|
336
|
-
optional() {
|
|
337
|
-
return new se(this);
|
|
338
|
-
}
|
|
339
|
-
default(e) {
|
|
340
|
-
return new ne(this, e);
|
|
341
|
-
}
|
|
342
|
-
schema() {
|
|
343
|
-
return te(this);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
class C extends T {
|
|
347
|
-
minLength;
|
|
348
|
-
maxLength;
|
|
349
|
-
pattern;
|
|
350
|
-
customValidations = [];
|
|
351
|
-
validate(e) {
|
|
352
|
-
if (typeof e != "string")
|
|
353
|
-
return { success: !1, errors: [{ message: "Expected string" }] };
|
|
354
|
-
const s = [];
|
|
355
|
-
this.minLength !== void 0 && e.length < this.minLength && s.push({ message: `Must be at least ${this.minLength} characters` }), this.maxLength !== void 0 && e.length > this.maxLength && s.push({ message: `Must be at most ${this.maxLength} characters` }), this.pattern && !this.pattern.test(e) && s.push({ message: "Invalid format" });
|
|
356
|
-
for (const t of this.customValidations) {
|
|
357
|
-
const n = t(e);
|
|
358
|
-
n && s.push({ message: n });
|
|
359
|
-
}
|
|
360
|
-
return s.length > 0 ? { success: !1, errors: s } : { success: !0, data: e };
|
|
361
|
-
}
|
|
362
|
-
min(e, s) {
|
|
363
|
-
const t = new C();
|
|
364
|
-
return t.minLength = e, t.maxLength = this.maxLength, t.pattern = this.pattern, t.customValidations = [...this.customValidations], s && t.customValidations.push(
|
|
365
|
-
(n) => n.length < e ? s : null
|
|
366
|
-
), t;
|
|
367
|
-
}
|
|
368
|
-
max(e, s) {
|
|
369
|
-
const t = new C();
|
|
370
|
-
return t.minLength = this.minLength, t.maxLength = e, t.pattern = this.pattern, t.customValidations = [...this.customValidations], s && t.customValidations.push(
|
|
371
|
-
(n) => n.length > e ? s : null
|
|
372
|
-
), t;
|
|
373
|
-
}
|
|
374
|
-
regex(e, s) {
|
|
375
|
-
const t = new C();
|
|
376
|
-
return t.minLength = this.minLength, t.maxLength = this.maxLength, t.pattern = e, t.customValidations = [...this.customValidations], s && t.customValidations.push(
|
|
377
|
-
(n) => e.test(n) ? null : s
|
|
378
|
-
), t;
|
|
379
|
-
}
|
|
380
|
-
email(e = "Please enter a valid email address") {
|
|
381
|
-
const s = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, t = new C();
|
|
382
|
-
return t.minLength = this.minLength, t.maxLength = this.maxLength, t.pattern = this.pattern, t.customValidations = [
|
|
383
|
-
...this.customValidations,
|
|
384
|
-
(n) => s.test(n) ? null : e
|
|
385
|
-
], t;
|
|
386
|
-
}
|
|
387
|
-
refine(e) {
|
|
388
|
-
const s = new C();
|
|
389
|
-
return s.minLength = this.minLength, s.maxLength = this.maxLength, s.pattern = this.pattern, s.customValidations = [...this.customValidations, e], s;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
class V extends T {
|
|
393
|
-
mustBeTrue = !1;
|
|
394
|
-
trueMessage;
|
|
395
|
-
validate(e) {
|
|
396
|
-
return typeof e != "boolean" ? { success: !1, errors: [{ message: "Expected boolean" }] } : this.mustBeTrue && e !== !0 ? {
|
|
397
|
-
success: !1,
|
|
398
|
-
errors: [{ message: this.trueMessage || "Must be true" }]
|
|
399
|
-
} : { success: !0, data: e };
|
|
400
|
-
}
|
|
401
|
-
refine(e, s) {
|
|
402
|
-
const t = new V();
|
|
403
|
-
t.mustBeTrue = this.mustBeTrue, t.trueMessage = this.trueMessage;
|
|
404
|
-
const n = t.validate.bind(t);
|
|
405
|
-
return t.validate = (r) => {
|
|
406
|
-
const l = n(r);
|
|
407
|
-
return l.success ? e(l.data) ? l : { success: !1, errors: [{ message: s }] } : l;
|
|
408
|
-
}, t;
|
|
409
|
-
}
|
|
410
|
-
literal(e, s) {
|
|
411
|
-
const t = new V();
|
|
412
|
-
return t.mustBeTrue = !0, t.trueMessage = s, t;
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
class se extends T {
|
|
416
|
-
constructor(e) {
|
|
417
|
-
super(), this.inner = e;
|
|
418
|
-
}
|
|
419
|
-
validate(e) {
|
|
420
|
-
if (e === void 0)
|
|
421
|
-
return { success: !0, data: void 0 };
|
|
422
|
-
const s = this.inner.validate(e);
|
|
423
|
-
return s.success ? { success: !0, data: s.data } : { success: !1, errors: s.errors };
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
class ne extends T {
|
|
427
|
-
constructor(e, s) {
|
|
428
|
-
super(), this.inner = e, this.defaultValue = s;
|
|
429
|
-
}
|
|
430
|
-
validate(e) {
|
|
431
|
-
return e === void 0 ? { success: !0, data: this.defaultValue } : this.inner.validate(e);
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
class I extends T {
|
|
435
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
436
|
-
constructor(e) {
|
|
437
|
-
super(), this.shape = e;
|
|
438
|
-
}
|
|
439
|
-
validate(e) {
|
|
440
|
-
if (typeof e != "object" || e === null || Array.isArray(e))
|
|
441
|
-
return { success: !1, errors: [{ message: "Expected object" }] };
|
|
442
|
-
const s = e, t = {}, n = [];
|
|
443
|
-
for (const [r, l] of Object.entries(this.shape)) {
|
|
444
|
-
const u = l.validate(s[r]);
|
|
445
|
-
if (u.success)
|
|
446
|
-
t[r] = u.data;
|
|
447
|
-
else
|
|
448
|
-
for (const g of u.errors)
|
|
449
|
-
n.push({
|
|
450
|
-
message: g.message,
|
|
451
|
-
path: [r, ...g.path || []]
|
|
452
|
-
});
|
|
453
|
-
}
|
|
454
|
-
return n.length > 0 ? { success: !1, errors: n } : { success: !0, data: t };
|
|
455
|
-
}
|
|
456
|
-
refine(e, s) {
|
|
457
|
-
const t = new I(this.shape), n = t.validate.bind(t);
|
|
458
|
-
return t.validate = (r) => {
|
|
459
|
-
const l = n(r);
|
|
460
|
-
if (!l.success) return l;
|
|
461
|
-
const u = e(l.data);
|
|
462
|
-
return u ? {
|
|
463
|
-
success: !1,
|
|
464
|
-
errors: [
|
|
465
|
-
{
|
|
466
|
-
message: u,
|
|
467
|
-
path: s?.path
|
|
468
|
-
}
|
|
469
|
-
]
|
|
470
|
-
} : { success: !0, data: l.data };
|
|
471
|
-
}, t;
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
const fe = () => new C(), he = () => new V(), pe = (c) => new I(c);
|
|
475
|
-
export {
|
|
476
|
-
V as B,
|
|
477
|
-
me as C,
|
|
478
|
-
$ as F,
|
|
479
|
-
ee as M,
|
|
480
|
-
Z as O,
|
|
481
|
-
C as S,
|
|
482
|
-
I as a,
|
|
483
|
-
he as b,
|
|
484
|
-
te as c,
|
|
485
|
-
pe as o,
|
|
486
|
-
fe as s,
|
|
487
|
-
de as u
|
|
488
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const n=require("@tempots/dom"),M=require("./use-animated-toggle-cKcuItmz.cjs"),S=require("@tempots/std"),D=require("./session-id-B5lJMzbB.cjs"),q=require("./translations-EwEmHe3v.cjs"),j=require("./use-form-Dcra7GeE.cjs"),B=require("./input-container-CyOgiiQD.cjs"),W=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]',"audio[controls]","video[controls]","details > summary:first-of-type","details[open]"].join(", ");function _(u){return Array.from(u.querySelectorAll(W)).filter(e=>{const s=e;return s.offsetWidth>0&&s.offsetHeight>0&&!s.hasAttribute("inert")&&window.getComputedStyle(s).visibility!=="hidden"})}function V(u={}){const{active:e=!0,escapeDeactivates:s=!0,onEscape:t,initialFocus:a,returnFocus:i,clickOutsideDeactivates:c=!1,onClickOutside:d}=u;return n.WithElement(g=>{let h=e,f=null,l=[],b=null,p=null,m=null;typeof document<"u"&&(f=document.activeElement);const y=()=>{l=_(g)},C=r=>{if(h){if(s&&r.key==="Escape"){r.preventDefault(),t?.();return}if(r.key==="Tab"){if(y(),l.length===0){r.preventDefault();return}const o=l.indexOf(document.activeElement);r.shiftKey?o<=0&&(r.preventDefault(),l[l.length-1]?.focus()):o>=l.length-1&&(r.preventDefault(),l[0]?.focus())}}},v=r=>{if(!h||!c)return;const o=r.target;g.contains(o)||d?.()},x=()=>{if(!h)return;y();let r=null;typeof a=="function"?r=a():a?r=a:l.length>0&&(r=l[0]),r&&(p=setTimeout(()=>{p=null,r?.focus()},50)),document.addEventListener("keydown",C,!0),c&&document.addEventListener("click",v,!0)},w=()=>{h=!1,document.removeEventListener("keydown",C,!0),document.removeEventListener("click",v,!0);let r=null;typeof i=="function"?r=i():i?r=i:f&&(r=f),r&&document.body.contains(r)&&(m=setTimeout(()=>{m=null,r?.focus()},0))};return b=setTimeout(()=>{b=null,x()},0),n.OnDispose(()=>{b!=null&&clearTimeout(b),p!=null&&clearTimeout(p),m!=null&&clearTimeout(m),w()})})}function P(u={}){return{activate:()=>V({...u,active:!0}),deactivate:()=>V({...u,active:!1})}}function I(u){return n.WithBrowserCtx(e=>{const s=[],t=()=>s.forEach(i=>i());return u(({effect:i="opaque",mode:c="capturing",onClickOutside:d,onEscape:g,content:h,container:f="body"})=>{f==="body"&&(e=e.makePortal("body"));const l=M.useAnimatedElementToggle();l.listenOnClosed(t);let b=()=>{},p=()=>{};const m=r=>{r.key==="Escape"&&(g?.(),l.close())},y=()=>{d?.(),l.close()},C=r=>{b(),p(),r==="capturing"?(document.addEventListener("keydown",m),b=()=>document.removeEventListener("keydown",m),e.element.addEventListener("mousedown",y),p=()=>e.element.removeEventListener("mousedown",y)):(b=()=>{},p=()=>{})},v=n.Value.on(c,C);s.push(v),s.push(()=>{l.dispose(),b(),p()});const x=()=>{const r=new Set;for(const o of e.element.querySelectorAll(":scope > :not([data-overlay])"))o.hasAttribute("inert")?r.add(o):o.setAttribute("inert","");return s.push(()=>{for(const o of e.element.querySelectorAll(":scope > :not([data-overlay])"))r.has(o)||o.removeAttribute("inert");r.clear()}),document.activeElement?.blur?.(),n.html.div(n.WithElement(o=>l.setElement(o)),n.dataAttr("status",l.status.map(String)),n.dataAttr("overlay","true"),n.attr.class(n.computedOf(i??"opaque",c)((o,L)=>`bc-overlay bc-overlay--container-${f} bc-overlay--effect-${o} bc-overlay--mode-${L}`)),h)},w=n.render(x(),e.element,{disposeWithParent:!0,clear:!1,providers:e.providers});s.push(w),S.delayedAnimationFrame(()=>l.open())},t)})}function O(u,e){const{size:s="md",dismissable:t=!0,showCloseButton:a=!0,onClose:i,overlayEffect:c="opaque",container:d="body",position:g="center"}=u;return I((h,f)=>{let l=()=>{};return e(m=>{l=f;const y=n.prop("capturing");n.Value.on(t,o=>{y.set(o?"capturing":"non-capturing")});const C=n.computedOf(m.header!=null,a)((o,L)=>o||L),v=D.sessionId("modal"),x=`${v}-header`,w=`${v}-body`,r=n.html.div(n.attr.class(n.computedOf(s,g)((o,L)=>`bc-modal bc-modal--size-${o} bc-modal--container-${d} bc-modal--position-${L}`)),n.attr.role("dialog"),n.aria.modal(!0),...m.header?[n.aria.labelledby(x)]:[],n.aria.describedby(w),n.attr.tabindex(-1),n.attr.id(v),n.dataAttr("focus-trap","true"),n.on.mousedown(o=>o.stopPropagation()),V({escapeDeactivates:!1,initialFocus:()=>{const o=document.getElementById(v);if(!o)return null;const L=o.querySelector('[aria-label="Close modal"]');if(L)return L;const A=o.querySelector('button, input, select, textarea, [tabindex]:not([tabindex="-1"])');return A||o}}),n.html.div(n.attr.class("bc-modal__content"),n.When(C,()=>n.html.div(n.attr.class("bc-modal__header"),n.html.div(n.attr.class("bc-modal__title"),...m.header?[n.attr.id(x)]:[],m.header),n.When(a,()=>n.Use(q.BeatUII18n,o=>j.CloseButton({size:"sm",label:o.$.closeModal,onClick:()=>{l(),f()}}))))),n.html.div(n.attr.class("bc-modal__body"),n.attr.id(w),m.body),m.footer&&n.html.div(n.attr.class("bc-modal__footer"),m.footer)));h({mode:y,effect:c??"opaque",container:d,content:r,onClickOutside:()=>{i?.(),f()},onEscape:()=>{i?.(),f()}})},()=>{l(),f()})})}function U(u,e){const{confirmText:s,cancelText:t,onConfirm:a,onCancel:i,...c}=u;return n.Use(q.BeatUII18n,d=>O({showCloseButton:!1,...c},(g,h)=>{const f=()=>{a?.(),h()},l=()=>{i?.(),h()};return e(p=>{g({body:p,footer:n.Fragment(n.attr.class("bc-modal__actions"),B.Button({variant:"outline",onClick:l},n.coalesce(t,d.$.cancel)),B.Button({color:"primary",variant:"filled",onClick:f},n.coalesce(s,d.$.confirm)))})},h)}))}function $(u){return{"~standard":{version:1,vendor:"beatui-custom",validate:s=>{const t=u.validate(s);return t.success?{value:t.data}:{issues:t.errors.map(a=>({message:a.message,path:a.path}))}},types:void 0},safeParse:s=>{const t=u.validate(s);return t.success?{success:!0,data:t.data}:{success:!1,error:{errors:t.errors.map(a=>({message:a.message,path:a.path?.map(i=>typeof i=="object"&&"key"in i?i.key.toString():i.toString())||[]}))}}}}}class k{optional(){return new z(this)}default(e){return new R(this,e)}schema(){return $(this)}}class E extends k{minLength;maxLength;pattern;customValidations=[];validate(e){if(typeof e!="string")return{success:!1,errors:[{message:"Expected string"}]};const s=[];this.minLength!==void 0&&e.length<this.minLength&&s.push({message:`Must be at least ${this.minLength} characters`}),this.maxLength!==void 0&&e.length>this.maxLength&&s.push({message:`Must be at most ${this.maxLength} characters`}),this.pattern&&!this.pattern.test(e)&&s.push({message:"Invalid format"});for(const t of this.customValidations){const a=t(e);a&&s.push({message:a})}return s.length>0?{success:!1,errors:s}:{success:!0,data:e}}min(e,s){const t=new E;return t.minLength=e,t.maxLength=this.maxLength,t.pattern=this.pattern,t.customValidations=[...this.customValidations],s&&t.customValidations.push(a=>a.length<e?s:null),t}max(e,s){const t=new E;return t.minLength=this.minLength,t.maxLength=e,t.pattern=this.pattern,t.customValidations=[...this.customValidations],s&&t.customValidations.push(a=>a.length>e?s:null),t}regex(e,s){const t=new E;return t.minLength=this.minLength,t.maxLength=this.maxLength,t.pattern=e,t.customValidations=[...this.customValidations],s&&t.customValidations.push(a=>e.test(a)?null:s),t}email(e="Please enter a valid email address"){const s=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,t=new E;return t.minLength=this.minLength,t.maxLength=this.maxLength,t.pattern=this.pattern,t.customValidations=[...this.customValidations,a=>s.test(a)?null:e],t}refine(e){const s=new E;return s.minLength=this.minLength,s.maxLength=this.maxLength,s.pattern=this.pattern,s.customValidations=[...this.customValidations,e],s}}class T extends k{mustBeTrue=!1;trueMessage;validate(e){return typeof e!="boolean"?{success:!1,errors:[{message:"Expected boolean"}]}:this.mustBeTrue&&e!==!0?{success:!1,errors:[{message:this.trueMessage||"Must be true"}]}:{success:!0,data:e}}refine(e,s){const t=new T;t.mustBeTrue=this.mustBeTrue,t.trueMessage=this.trueMessage;const a=t.validate.bind(t);return t.validate=i=>{const c=a(i);return c.success?e(c.data)?c:{success:!1,errors:[{message:s}]}:c},t}literal(e,s){const t=new T;return t.mustBeTrue=!0,t.trueMessage=s,t}}class z extends k{constructor(e){super(),this.inner=e}validate(e){if(e===void 0)return{success:!0,data:void 0};const s=this.inner.validate(e);return s.success?{success:!0,data:s.data}:{success:!1,errors:s.errors}}}class R extends k{constructor(e,s){super(),this.inner=e,this.defaultValue=s}validate(e){return e===void 0?{success:!0,data:this.defaultValue}:this.inner.validate(e)}}class F extends k{constructor(e){super(),this.shape=e}validate(e){if(typeof e!="object"||e===null||Array.isArray(e))return{success:!1,errors:[{message:"Expected object"}]};const s=e,t={},a=[];for(const[i,c]of Object.entries(this.shape)){const d=c.validate(s[i]);if(d.success)t[i]=d.data;else for(const g of d.errors)a.push({message:g.message,path:[i,...g.path||[]]})}return a.length>0?{success:!1,errors:a}:{success:!0,data:t}}refine(e,s){const t=new F(this.shape),a=t.validate.bind(t);return t.validate=i=>{const c=a(i);if(!c.success)return c;const d=e(c.data);return d?{success:!1,errors:[{message:d,path:s?.path}]}:{success:!0,data:c.data}},t}}const H=()=>new E,K=()=>new T,G=u=>new F(u);exports.BooleanValidator=T;exports.ConfirmModal=U;exports.FocusTrap=V;exports.Modal=O;exports.ObjectValidator=F;exports.Overlay=I;exports.StringValidator=E;exports.boolean=K;exports.createStandardSchema=$;exports.object=G;exports.string=H;exports.useFocusTrap=P;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("@tempots/dom"),B=require("./input-container-CyOgiiQD.cjs"),z=require("./text-input-DS5zlXb2.cjs"),F=require("./use-form-Dcra7GeE.cjs"),E=require("./translations-EwEmHe3v.cjs"),ut=require("./stack-dwLevGa2.cjs"),R=require("@tempots/std"),Vt=require("@tempots/ui");let G=null;async function H(){const n=globalThis;return n.Temporal?n.Temporal:(G||(G=Promise.resolve().then(()=>require("./index.esm-C6lZ02yY.cjs")).then(e=>{const l=e.Temporal;return n.Temporal||(n.Temporal=l),l})),G)}const ct=(n,e)=>e?t.Task(H,{then:n,pending:e.pending,error:e.error}):t.Task(H,n);function Z({onChange:n,value:e,accept:l="*/*",enableClick:r=!0,content:o,disabled:h=!1,allowMultiple:a}){return t.Use(E.BeatUII18n,f=>{const g=t.Value.deriveProp(e??[]),v=t.prop(!1),c=p=>{p.preventDefault(),p.stopPropagation(),v.value=!0},b=p=>{p.preventDefault(),p.stopPropagation(),(!p.currentTarget||!p.currentTarget.contains(p.relatedTarget))&&(v.value=!1)},I=p=>{p.preventDefault(),p.stopPropagation(),v.value=!1;const V=Array.from(p.dataTransfer?.files||[]);V.length>0&&(g.value=V,n(V,"dragdrop"))},s=p=>{t.Value.get(r)&&p.currentTarget.querySelector('input[type="file"]')?.click()};let u=null;const w=()=>{if(u==null)return;const p=Array.from(u.files??[]);p.length>0&&(g.value=p,n(p,"click")),u.value=""},C=p=>{t.Value.get(r)&&(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),s(p))};return t.html.div(t.attr.role("button"),t.attr.tabindex(t.Value.map(r,p=>p?0:-1)),t.attr.style("position: relative;"),t.on.dragover(c),t.on.dragleave(b),t.on.drop(I),t.on.click(s),t.on.keydown(C),t.html.input(t.attr.type("file"),t.attr.disabled(h),t.attr.accept(l),t.attr.multiple(a),t.attr.style("position: absolute; left: -9999px; opacity: 0; pointer-events: none;"),t.on.change(w),t.WithElement(p=>(u=p,g.on(V=>{const O=globalThis.DataTransfer;if(O!=null){const _=new O;V.forEach(D=>_.items.add(D)),p.files=_.files}}),t.Empty))),t.aria.label(t.bind(f.$.dropZoneInstructions)(r)),o({files:g,clear:()=>g.value=[],change:p=>g.set(p)}))})}const K="$$tts-exp-",pt=(n,e)=>t.WithElement(l=>{const r=`${K}${n}`;return t.OnDispose(t.Value.on(e,o=>Reflect.set(l,r,o)))}),wt=(n,e)=>{const l=`${K}${n}`;return r=>{e(Reflect.get(r.target,l))}},X=(n,e)=>{const l=`${K}${n}`;return r=>{const o=r.target,h=o.selectedIndex,a=o.options[h];e(Reflect.get(a,l))}},ft=(n,e,l)=>t.Ensure(n,r=>t.OneOfType(r,{value:o=>{const h=t.computedOf(o,l)((a,f)=>e(a.value,f));return t.html.option(t.attr.selected(h),pt("value",o.$.value),o.$.label)},group:o=>t.html.optgroup(t.attr.label(o.$.group),t.ForEach(o.$.options,h=>ft(h,e,l))),break:()=>t.html.hr()})),dt=n=>{const{value:e,onBlur:l,onChange:r,onInput:o,options:h,unselectedLabel:a,equality:f=(c,b)=>c===b,after:g}=n;let v;return B.InputContainer({...n,after:t.Fragment(B.InputIcon({icon:"ph:caret-up-down-bold",color:"neutral",size:"sm"}),g),input:t.html.select(t.WithElement(c=>{v=c;const b=new MutationObserver(I=>{const{removedNodes:s}=I[0];s.length>0&&(v.selectedIndex=0)});return b.observe(c,{childList:!0}),t.OnDispose(()=>b.disconnect())}),z.CommonInputAttributes(n),t.attr.class("bc-native-select bc-input"),t.Use(E.BeatUII18n,c=>t.html.option(t.attr.hidden("hidden"),t.coalesce(a,c.$.selectOne))),t.ForEach(h,c=>ft(c,f,e)),l!=null?t.on.blur(l):t.Empty,r!=null?t.on.change(X("value",c=>r(c))):t.Empty,o!=null?t.on.input(X("value",c=>o(c))):t.Empty)},t.on.click(()=>{if(v?.focus(),typeof v?.showPicker=="function")try{v.showPicker()}catch{}}))};function mt(n){const{controller:e,onChange:l,onBlur:r,...o}=n;return dt({...o,value:e.signal,onChange:F.makeOnChangeHandler(e,l),onBlur:F.makeOnBlurHandler(e,r)})}function Ct(n){return F.Field({...n,content:mt(n)})}function tt(n,e,l){const r=t.Value.map(n,a=>a!=null),o=t.computedOf(r,e??!1)((a,f)=>!a||f),h=E.defaultMessages.clearValue;return t.html.button(t.attr.type("button"),t.attr.class("bc-input-container__reset"),t.aria.label(h),t.attr.title(h),t.attr.disabled(o),E.Icon({icon:"mdi:close",size:"sm"}),t.on.click(a=>{a.stopPropagation(),l?.(null)}))}function Q(...n){return t.html.div(t.attr.class("bc-group"),...n)}function _t(n){const e=String(n),l=e.indexOf(".");return l===-1?0:e.length-l-1}function P(n,e){const l=_t(e);if(l===0)return Math.round(n);const r=Math.pow(10,l);return Math.round(n*r)/r}function kt(n){if(n>=1)return 0;const e=n.toString(),l=e.indexOf(".");return l===-1?0:e.length-l-1}const Et=n=>{const{value:e,step:l,min:r,max:o,onBlur:h,onChange:a,onInput:f,after:g,unit:v,formatted:c}=n,b=D=>{const x=r!=null?t.Value.get(r):void 0,i=o!=null?t.Value.get(o):void 0;return x!=null&&D<x?x:i!=null&&D>i?i:D},I=l!=null?t.Use(E.BeatUII18n,D=>{const x=t.computedOf(e,r)((y,m)=>m==null?!0:(y??0)>m),i=t.computedOf(e,o)((y,m)=>m==null?!0:(y??0)<m),d=y=>{const m=t.Value.get(e)??0,U=t.Value.get(l),$=y?.shiftKey?10:1,T=P(m-U*$,U),A=r!=null?t.Value.get(r):void 0;if(A!=null&&T<A)return;const S=b(T);S!==m&&(a?.(S),f?.(S))},k=y=>{const m=t.Value.get(e)??0,U=t.Value.get(l),$=y?.shiftKey?10:1,T=P(m+U*$,U),A=o!=null?t.Value.get(o):void 0;if(A!=null&&T>A)return;const S=b(T);S!==m&&(a?.(S),f?.(S))};return ut.Stack(t.attr.class("bc-number-input-steppers"),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"),t.attr.disabled(t.computedOf(i,n.disabled??!1)((y,m)=>!y||m)),t.on.click(y=>k(y)),t.aria.label(D.$.incrementValue),E.Icon({icon:"line-md:plus",size:"xs"})),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"),t.attr.disabled(t.computedOf(x,n.disabled??!1)((y,m)=>!y||m)),t.on.click(y=>d(y)),t.aria.label(D.$.decrementValue),E.Icon({icon:"line-md:minus",size:"xs"})))}):null,u=[v!=null?t.html.span(t.attr.class("bc-number-input-unit"),v):null,I,g].filter(D=>D!=null),w=u.length>1?t.Fragment(...u):u.length===1?u[0]:void 0,p=c!=null&&t.Value.get(c)?t.prop(!1):null,V=t.input.number(r!=null?t.attr.min(r):t.Empty,o!=null?t.attr.max(o):t.Empty,z.CommonInputAttributes(n),t.attr.valueAsNumber(e),t.attr.step(l),t.attr.class("bc-input bc-number-input"),p!=null?t.attr.class(t.computedOf(p,c??!1)((D,x)=>x&&!D?"bc-number-input--hidden":"")):t.Empty,t.on.focus(()=>p?.set(!0)),t.on.blur(()=>{p?.set(!1),h?.()}),h!=null&&p==null?t.on.blur(t.emitValue(h)):t.Empty,a!=null?t.on.change(t.emitValueAsNumber(a)):t.Empty,f!=null?t.on.input(t.emitValueAsNumber(f)):t.Empty,l!=null?t.on.wheel(D=>{D.preventDefault();const x=t.Value.get(e)??0,i=t.Value.get(l),d=D.shiftKey?10:1,k=D.deltaY<0?i*d:-i*d,y=b(P(x+k,i));y!==x&&(a?.(y),f?.(y))}):t.Empty),O=p!=null?t.Use(E.Locale,({locale:D})=>{const x=t.computedOf(p,c??!1)((d,k)=>k&&!d),i=t.computedOf(e,D,l)((d,k,y)=>{if(d==null||isNaN(d))return"";const m=y!=null?kt(y):void 0;try{return new Intl.NumberFormat(k,{minimumFractionDigits:m,maximumFractionDigits:m}).format(d)}catch{return String(d)}});return t.When(x,()=>t.html.span(t.attr.class("bc-number-input-formatted"),i))}):null,_=O!=null?t.Fragment(V,O):V;return B.InputContainer({...n,input:_,after:w})};function Dt(n,e){return n.length===e.length&&n.every((l,r)=>l===e[r])}function Ut(n,e,l){const r=["bc-segmented-input",`bc-segmented-input--size-${n}`];return l==="squared"&&r.push("bc-segmented-input--squared"),e&&r.push("bc-segmented-input--disabled"),r.join(" ")}function Ot(n){if(n==null)return"";const e=new Map,l=E.backgroundValue(n,"solid","light"),r=E.backgroundValue(n,"solid","dark");return e.set("--si-indicator-bg",l.backgroundColor),e.set("--si-active-text",l.textColor),e.set("--si-indicator-bg-dark",r.backgroundColor),e.set("--si-active-text-dark",r.textColor),Array.from(e.entries()).map(([o,h])=>`${o}: ${h}`).join("; ")}function Mt({options:n,value:e,onChange:l,size:r="md",disabled:o=!1,variant:h="pill",color:a,subset:f},...g){const v=R.objectEntries(n).map(([b,I])=>({key:b,label:I})),c=f||v.map(b=>b.key);return t.WithElement(()=>{const b=Object.fromEntries(v.map((s,u)=>[s.key,u])),I=t.prop(v.map(()=>({left:0,width:0})),Dt);return t.html.div(t.attr.class(t.computedOf(r,o,h)((s,u,w)=>Ut(s??"md",u??!1,w??"pill"))),t.attr.style(a!=null?t.Value.map(a,s=>Ot(s)):""),t.html.div(t.attr.class("bc-segmented-input__container"),t.html.div(t.attr.class("bc-segmented-input__indicator"),t.style.width(t.computedOf(e,I)((s,u)=>{const{width:w}=u[b[s]??0];return`${w}px`})),t.style.left(t.computedOf(e,I)((s,u)=>{const{left:w}=u[b[s]??0];return`${w}px`}))),t.ForEach(c,(s,{index:u})=>{const w=s.map(C=>v.find(p=>p.key===C)?.label);return t.html.button(t.attr.type("button"),t.on.click(C=>{C.preventDefault(),t.Value.get(o)||l?.(s.value)}),t.attr.disabled(o),t.attr.class("bc-segmented-input__segment"),t.attr.class(t.computedOf(e,s)((C,p)=>C===p?"bc-segmented-input__segment--active":"bc-segmented-input__segment--inactive")),Vt.ElementRect(C=>{function p(){I.update(O=>{const _=[...O];return _[u]={width:C.value.width,left:C.value.localLeft},_})}const V=R.delayedAnimationFrame(p);return t.OnDispose(V,C.on(p))}),t.MapSignal(w,C=>C))})),...g)})}function $t(n){const e=n.type.toLowerCase();return e.startsWith("image/")&&(e.includes("jpeg")||e.includes("jpg")||e.includes("png")||e.includes("gif")||e.includes("webp")||e.includes("svg"))}function St(n){const e=n.type.toLowerCase();return e.startsWith("image/")?"vscode-icons:file-type-image":e.startsWith("video/")?"vscode-icons:file-type-video":e.startsWith("audio/")?"vscode-icons:file-type-audio":e.includes("pdf")?"vscode-icons:file-type-pdf2":e.includes("word")||e.includes("document")?"vscode-icons:file-type-word":e.includes("excel")||e.includes("spreadsheet")?"vscode-icons:file-type-excel":e.includes("powerpoint")||e.includes("presentation")?"vscode-icons:file-type-powerpoint":e.includes("zip")||e.includes("archive")?"vscode-icons:file-type-zip":e.includes("text")?"vscode-icons:file-type-text":e.includes("json")?"vscode-icons:file-type-json-official":e.includes("csv")?"vscode-icons:file-type-csv":e.includes("xml")?"vscode-icons:file-type-xml":e.includes("yaml")?"vscode-icons:file-type-yaml-official":"vscode-icons:file-type-binary"}function J(n){return t.When(n.map($t),()=>{const e=t.prop(null);return n.on(l=>{e.value&&URL.revokeObjectURL(e.value);const r=URL.createObjectURL(l);e.value=r}),t.html.div(t.OnDispose(()=>{e.value&&URL.revokeObjectURL(e.value)}),t.attr.class("bc-file-input__thumbnail-container"),t.html.img(t.attr.src(e),t.attr.alt(n.map(l=>l.name)),t.attr.class("bc-file-input__thumbnail")))},()=>E.Icon({icon:n.map(St)}))}const Ft=(n,...e)=>{const{value:l=t.prop([]),accept:r="*/*",maxFiles:o,maxFileSize:h,onChange:a,onBlur:f,disabled:g,hasError:v,mode:c="default",showFileList:b=!0,...I}=n,s=l,u=t.Value.map(c,x=>x==="input"),w=t.Value.map(c,x=>x==="compact"),C=x=>{let i=x;if(o!=null){const d=t.Value.get(o);i=i.slice(0,d)}if(h){const d=t.Value.get(h);i=i.filter(k=>k.size<=d)}a?.(i)},p=x=>{const d=s.value.filter((k,y)=>y!==x);a?.(d)},V=()=>{a?.([])},O=({files:x,clear:i,change:d})=>t.Use(E.BeatUII18n,k=>t.html.div(t.attr.class("bc-file-input__drop-zone"),t.html.div(t.attr.class("bc-file-input__drop-zone-content bc-file-input__drop-zone-content--empty"),E.Icon({icon:"mdi:cloud-upload-outline",size:"xl"}),t.html.div(t.attr.class("bc-file-input__drop-zone-text"),t.bind(k.$.filesInputInstructions)(o,h,k.$.fileSizeUnits.value))))),_=({files:x})=>t.Use(E.BeatUII18n,i=>t.html.div(t.attr.class("bc-file-input__compact-drop-zone"),t.When(x.map(d=>d.length>0),()=>t.html.div(t.attr.class("bc-file-input__compact-file-list"),t.ForEach(x,(d,k)=>{const y=k.index;return t.html.div(t.attr.class("bc-file-input__compact-file-item"),t.html.div(t.attr.class("bc-file-input__compact-file-icon"),J(d)),t.html.div(t.attr.class("bc-file-input__compact-file-info"),t.html.div(t.attr.class("bc-file-input__compact-file-name"),t.attr.title(d.$.name),d.$.name),t.html.div(t.attr.class("bc-file-input__compact-file-meta"),t.computedOf(d.$.size,i.$.fileSizeUnits)((m,U)=>E.formatFileSize(m,{units:U}))," • ",t.computedOf(d.$.type,i.$.unknownType)((m,U)=>m||U))),F.CloseButton({size:"sm",label:i.$.removeFile,disabled:g,onClick:()=>p(y)},t.attr.class("bc-file-input__compact-remove-button")))})),()=>t.html.div(t.attr.class("bc-file-input__compact-placeholder"),E.Icon({icon:"mdi:cloud-upload-outline",size:"lg"}),t.html.div(t.attr.class("bc-file-input__compact-placeholder-text"),t.bind(i.$.filesInputInstructions)(o,h,i.$.fileSizeUnits.value)))))),D=({files:x})=>t.Use(E.BeatUII18n,i=>t.html.div(t.attr.class("bc-file-input__compact-input"),t.When(x.map(d=>d.length>0),()=>t.html.span(t.attr.class("bc-file-input__compact-value"),t.ForEach(x,d=>t.html.span(t.attr.class("bc-file-input__compact-value-item"),J(d),t.html.span(t.attr.class("bc-file-input__compact-value-item-name"),d.$.name)))),()=>t.html.span(t.attr.class("bc-file-input__compact-placeholder"),E.Icon({icon:"mdi:cloud-upload-outline",size:"md"})," ",t.bind(i.$.filesInputInstructions)(o,h,i.$.fileSizeUnits.value)))));return t.Use(E.BeatUII18n,x=>B.InputContainer({baseContainer:t.Value.map(u,i=>!i),disabled:g,hasError:v,after:t.When(u,()=>t.When(s.map(({length:i})=>i>0),()=>F.CloseButton({size:"sm",label:x.$.clearAllFiles,disabled:g,onClick:V},t.attr.class("bc-file-input__compact-clear")))),...I,input:t.When(u,()=>t.html.div(t.attr.class("bc-file-input bc-file-input--input"),Z({value:s,accept:r,enableClick:!0,allowMultiple:t.Value.map(o??1/0,i=>i>1),disabled:g,onChange:C,content:D})),()=>t.When(w,()=>t.html.div(t.attr.class("bc-file-input bc-file-input--compact"),Z({value:s,accept:r,enableClick:!0,allowMultiple:t.Value.map(o??1/0,i=>i>1),disabled:g,onChange:C,content:_})),()=>t.html.div(t.attr.class("bc-file-input"),Z({value:s,accept:r,enableClick:!0,allowMultiple:t.Value.map(o??1/0,i=>i>1),disabled:g,onChange:C,content:O}),t.When(b,()=>t.NotEmpty(s,()=>t.Fragment(t.html.div(t.attr.class("bc-file-input__file-list"),t.ForEach(s,(i,d)=>{const k=d.index;return t.html.div(t.attr.class("bc-file-input__file-item"),t.html.div(t.attr.class("bc-file-input__file-icon"),J(i)),t.html.div(t.attr.class("bc-file-input__file-info"),t.html.div(t.attr.class("bc-file-input__file-name"),t.attr.title(i.$.name),i.$.name),t.html.div(t.attr.class("bc-file-input__file-meta"),t.computedOf(i.$.size,x.$.fileSizeUnits)((y,m)=>E.formatFileSize(y,{units:m}))," • ",t.computedOf(i.$.type,x.$.unknownType)((y,m)=>y||m))),F.CloseButton({size:"sm",label:x.$.removeFile,disabled:g,onClick:()=>p(k)},t.attr.class("bc-file-input__remove-button")))})),t.When(s.map(({length:i})=>i>1),()=>t.html.div(t.attr.class("bc-file-input__clear-all-button-container"),t.html.button(t.attr.type("button"),t.attr.class("bc-file-input__clear-all-button"),t.attr.disabled(g),x.$.clearAllFiles,t.on.click(i=>{i.preventDefault(),i.stopPropagation(),V()}))))))))))},...e))};function ht(n,e,l){const r=n.length.map(o=>o);return t.Repeat(r,o=>{const h=n.item(o.index),a=[];return t.Fragment(t.OnDispose(()=>{a.forEach(f=>f())}),e({list:n,item:h,position:o,remove:()=>n.removeAt(o.index),move:f=>{switch(f){case"up":if(o.index===0)return;n.move(o.index,o.index-1);break;case"down":if(o.index===n.length.value-1)return;n.move(o.index,o.index+1);break;case"first":n.move(o.index,0);break;case"last":n.move(o.index,n.length.value-1)}},canMove:f=>{const g=(()=>{switch(f){case"up":return t.signal(o.index>0);case"down":return n.length.map(v=>o.index<v-1)}})();return a.push(()=>g.dispose()),g},cannotMove:f=>{const g=(()=>{switch(f){case"up":return t.signal(o.index===0);case"down":return n.length.map(v=>o.index===v-1)}})();return a.push(()=>g.dispose()),g}}))},l)}const rt={9:{pattern:/^[0-9]$/},A:{pattern:/^[A-Za-z]$/,transform:n=>n.toUpperCase()},"*":{pattern:/^.$/}},Bt=n=>n instanceof RegExp;function bt(n,e,l){if(n==null)return[];const r=l?{...rt,...e}:e??rt,o=(a,f)=>{const g=r[f];g?a.push({type:"pattern",name:f,...g}):a.push({type:"literal",char:f})},h=[];if(typeof n=="string"){for(const a of n)o(h,a);return h}for(const a of n)if(typeof a=="string")if(a.length<=1)o(h,a);else for(const f of a)o(h,f);else Bt(a)?h.push({type:"pattern",pattern:a}):typeof a=="object"&&a&&h.push(a);return h}function Tt(n,e){return l=>{switch(n){case"digits":return/[0-9]/.test(l);case"letters":return/[A-Za-z]/.test(l);case"alphanumeric":return/[A-Za-z0-9]/.test(l);case"custom":return e?.(l)??!0;default:return!0}}}function ot(n,e,l,r,o,h){const a={raw:n,previousConformed:e,cursor:o??n.length,completed:!1},f=r.definitions??{},g=typeof l=="function"?l(n,a):l,v=bt(g,f,r.useDefaultDefinitions??!0),c=Tt(r.allowMode,r.allow),b=new Set;for(const m of v)m.type==="literal"&&b.add(m.char);if(r.prefix)for(const m of r.prefix)b.add(m);if(r.suffix)for(const m of r.suffix)b.add(m);const I=Array.from(n).filter(m=>c(m)&&!b.has(m));if(I.length===0)return{value:"",cursor:0,completed:!1};const s=[],u=[];let w=0,C=0,p=0,V=-1;for(const m of v){if(m.type==="literal"){s.push(m.char),u.push({kind:"literal",filled:!0});continue}C+=m.optional?0:1;const U=I[w];if(U==null)break;if(m.type==="any"){p++,s.push(m.transform?m.transform(U):U),u.push({kind:"slot",filled:!0}),V=u.length-1,w++;continue}if(m.type==="pattern")if(m.pattern.test(U)){p++;const $=m.transform?m.transform(U):U;s.push($),u.push({kind:"slot",filled:!0}),V=u.length-1,w++}else{w++;continue}}const O=s.join(""),_=(r.prefix??"")+O+(r.suffix??"");let x=(r.prefix??"").length;if(V>=0){let m=V+1;if((h?.policy??"smart")!=="sticky")for(;m<u.length&&u[m].kind==="literal";)m++;x+=m}const i=r.completion?.mode==="min"?(r.completion.minChars??0)<=p:r.completion?.mode==="custom"?!!r.completion.isComplete?.(_):C>0&&p>=C,d=r.pipe?.(_,{...a,completed:i});let k,y=x;return d===!1?(k=e,y=e.length):typeof d=="string"?(k=d,y=d.length):typeof d=="object"&&d?(k=d.value,y=d.cursor??d.value.length):k=_,{value:k,cursor:y,completed:i}}function At(n,e){const l=e?.strategy??"none";return l==="custom"&&e?.unmask?e.unmask(n):l==="strip"?n.replace(/[^A-Za-z0-9]/g,""):n}const et=n=>{const{value:e,onBlur:l,onChange:r,onInput:o,onAccept:h,onComplete:a,mask:f,definitions:g,useDefaultDefinitions:v,extraLiterals:c,prefix:b,suffix:I,autofix:s,pipe:u,completion:w,unmask:C,allowMode:p,allow:V,placeholder:O,placeholderOptions:_}=n,D=t.computedOf(e,f,g,v,c,b,I,s,w,C,p,O,_)((i,d,k,y,m,U,$,T,A,S,N,j,L)=>d?ot(i??"","",d,{definitions:k??{},useDefaultDefinitions:y??!0,extraLiterals:m??[],autofix:T??"none",completion:A??{mode:"mask"},pipe:u??(M=>M),unmask:S??{strategy:"none"},allowMode:N??"all",allow:V,prefix:U,suffix:$}).value:i??""),x=(i,d)=>{const k=i.value??"",y=t.Value.get(e)??"",m=f!=null?t.Value.get(f):null,U=g!=null?t.Value.get(g):void 0,$=v!=null?t.Value.get(v):void 0,T=c!=null?t.Value.get(c):void 0,A=s!=null?t.Value.get(s):void 0,S=w!=null?t.Value.get(w):void 0,N=C!=null?t.Value.get(C):void 0,j=p!=null?t.Value.get(p):void 0,L=b!=null?t.Value.get(b):void 0,M=I!=null?t.Value.get(I):void 0,{value:W,cursor:Y,completed:nt}=m?ot(k,y,m,{definitions:U??{},useDefaultDefinitions:$??!0,extraLiterals:T??[],autofix:A??"none",completion:S??{mode:"mask"},pipe:u??(It=>It),unmask:N??{strategy:"none"},allowMode:j??"all",allow:V,prefix:L,suffix:M},i.selectionStart??k.length,n.cursor?t.Value.get(n.cursor):void 0):{value:k,cursor:k.length,completed:!0};if(W!==k){i.value=W;try{i.setSelectionRange(Y,Y)}catch{}}const lt=At(W,N);h?.({raw:lt,conformed:W,completed:nt,cursor:Y}),d==="input"?o?.(W):(r?.(W),nt&&a?.({raw:lt,conformed:W}))};return B.InputContainer({...n,input:t.input.text(z.CommonInputAttributes(n),t.attr.value(D),t.attr.class("bc-input"),l!=null?t.on.blur(l):t.Empty,t.WithElement(i=>i instanceof HTMLInputElement?t.Fragment(t.on.input(()=>x(i,"input")),t.on.change(()=>x(i,"change")),t.on.keydown(d=>{if(d.key!=="Backspace"||!(n.cursor?t.Value.get(n.cursor)?.backspaceRubberBand??!0:!0))return;const y=i.selectionStart??0,m=i.selectionEnd??y;if(y!==m||y<=0)return;const U=i.value??"",$=f!=null?t.Value.get(f):null;if(!$)return;const T=g!=null?t.Value.get(g):void 0,A=v!=null?t.Value.get(v):!0,S=b!=null?t.Value.get(b):void 0,N=I!=null?t.Value.get(I):void 0,j=bt(typeof $=="function"?$(U,{raw:U,previousConformed:U,cursor:y,completed:!1}):$,T??{},A??!0),L=new Set;for(const M of j)M.type==="literal"&&L.add(M.char);if(S)for(const M of S)L.add(M);if(N)for(const M of N)L.add(M);if(L.has(U[y-1])){let M=y-1;for(;M>=0&&L.has(U[M]);)M--;M>=0&&(d.preventDefault(),d.stopPropagation(),i.value=U.slice(0,M)+U.slice(M+1),x(i,"input"))}})):t.Empty))})},Lt=n=>{const{value:e,onBlur:l,onChange:r,onInput:o,rows:h}=n;return B.InputContainer({...n,input:t.html.textarea(z.CommonInputAttributes(n),t.attr.rows(h??3),t.attr.value(e),t.attr.class("bc-input"),l!=null?t.on.blur(t.emitValue(l)):t.Empty,r!=null?t.on.change(t.emitValue(r)):t.Empty,o!=null?t.on.input(t.emitValue(o)):t.Empty)})},st=n=>{if(n==null||n==="")return null;const e=Number(n);return Number.isNaN(e)?null:e},zt=n=>{const{value:e,step:l,min:r,max:o,onBlur:h,onChange:a,onInput:f,after:g}=n,v=s=>{const u=r!=null?t.Value.get(r):void 0,w=o!=null?t.Value.get(o):void 0;return u!=null&&s<u?u:w!=null&&s>w?w:s},c=(()=>{if(l==null)return null;const s=t.computedOf(e,r)((V,O)=>{const _=V??0;return O==null?!0:_>O}),u=t.computedOf(e,o)((V,O)=>{const _=V??0;return O==null?!0:_<O}),w=V=>{const O=t.Value.get(e)??0,_=t.Value.get(l),D=V?.shiftKey?10:1,x=P(O-_*D,_),i=r!=null?t.Value.get(r):void 0;if(i!=null&&x<i)return;const d=v(x);d!==O&&(a?.(d),f?.(d))},C=V=>{const O=t.Value.get(e)??0,_=t.Value.get(l),D=V?.shiftKey?10:1,x=P(O+_*D,_),i=o!=null?t.Value.get(o):void 0;if(i!=null&&x>i)return;const d=v(x);d!==O&&(a?.(d),f?.(d))};return((V,O)=>ut.Stack(t.attr.class("bc-number-input-steppers"),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"),t.attr.disabled(t.computedOf(u,n.disabled??!1)((_,D)=>!_||D)),t.on.click(_=>C(_)),t.aria.label(V),E.Icon({icon:"line-md:plus",size:"xs"})),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"),t.attr.disabled(t.computedOf(s,n.disabled??!1)((_,D)=>!_||D)),t.on.click(_=>w(_)),t.aria.label(O),E.Icon({icon:"line-md:minus",size:"xs"}))))(E.defaultMessages.incrementValue,E.defaultMessages.decrementValue)})(),b=tt(e,n.disabled,a??f),I=g!=null&&c!=null?t.Fragment(c,b,g):g!=null?t.Fragment(b,g):c!=null?t.Fragment(c,b):b;return B.InputContainer({...n,input:t.input.number(r!=null?t.attr.min(r):t.Empty,o!=null?t.attr.max(o):t.Empty,z.CommonInputAttributes(n),t.attr.value(t.Value.map(e,s=>s==null?"":String(s))),t.attr.step(l),t.attr.class("bc-input bc-number-input"),h!=null?t.on.blur(t.emitValue(h)):t.Empty,a!=null?t.on.change(t.emitValue(s=>{const u=st(s);a(u)})):t.Empty,f!=null?t.on.input(t.emitValue(s=>{const u=st(s);f(u)})):t.Empty,l!=null?t.on.wheel(s=>{s.preventDefault();const u=t.Value.get(e)??0,w=t.Value.get(l),C=s.shiftKey?10:1,p=s.deltaY<0?w*C:-w*C,V=v(P(u+p,w));V!==u&&(a?.(V),f?.(V))}):t.Empty),after:I})},Nt=n=>{const e={type:"pattern",pattern:/[0-9A-Fa-f]/,transform:o=>o.toLowerCase()},l=[e,e,e,e,e,e,e,e,"-",e,e,e,e,"-",e,e,e,e,"-",e,e,e,e,"-",e,e,e,e,e,e,e,e,e,e,e,e],r=n.class?t.Value.map(n.class,o=>`bc-uuid-input ${o}`):"bc-uuid-input";return et({...n,class:r,mask:l,placeholder:n.placeholder??"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"})},Wt=/^P(\d+([YMWD]|$)){0,4}(T(\d+([HMS]|$)){0,3})?$/i,Rt=/^P(?:(\d+Y)?(\d+M)?(\d+W)?(\d+D)?)(T(\d+H)?(\d+M)?(\d+S)?)?$/i;function gt(n){return{mask:null,allowMode:"custom",allow:e=>/[0-9ptwdhms]/i.test(e),pipe:e=>{const l=e.toUpperCase();return l.length===0?l:!l.startsWith("P")||!Wt.test(l)?!1:l},completion:{mode:"custom",isComplete:e=>{const l=e.toUpperCase();if(!Rt.test(l))return!1;try{return n(l),!0}catch{return!1}}}}}const at=(n,e)=>{if(n==null)return null;try{return n.Duration.from(e)}catch{return null}},Pt=n=>{const{value:e,onChange:l,onInput:r,after:o,disabled:h,onBlur:a}=n,f=()=>{const c=tt(e,h,l??r);return o!=null?t.Fragment(c,o):c},g=n.placeholder!=null?t.Empty:t.attr.placeholder("P0DT0H0M0S");return ct(c=>{const b=z.mapInputOptions(n,I=>I?.toString()??"",I=>I===""?null:c.Duration.from(I));return et({...b,onInput:void 0,...gt(c.Duration.from),placeholder:"P0DT0H0M0S",after:f()})},{pending:()=>{const c=b=>I=>{const u=I.currentTarget?.value??"";if(u===""){b(null);return}const w=globalThis.Temporal,C=at(w,u);if(C!=null){b(C);return}H().then(p=>{const V=at(p,u);V!=null&&b(V)}).catch(()=>{})};return B.InputContainer({...n,input:t.input.text(z.CommonInputAttributes(n),t.attr.value(t.Value.map(e,b=>b?.toString()??"")),t.attr.class("bc-input"),g,a!=null?t.on.blur(()=>a()):t.Empty,l!=null?t.on.change(c(l)):t.Empty,r!=null?t.on.input(c(r)):t.Empty),after:f()})}})},jt=n=>{const{value:e,onBlur:l,onChange:r,onInput:o}=n;return B.InputContainer({...n,input:t.input.url(z.CommonInputAttributes(n),t.attr.value(e),t.attr.class("bc-input"),l!=null?t.on.blur(t.emitValue(l)):t.Empty,r!=null?t.on.change(t.emitValue(r)):t.Empty,o!=null?t.on.input(t.emitValue(o)):t.Empty)})};function vt(n,e){const{onMove:l,cannotMoveUp:r,cannotMoveDown:o,onRemove:h,showMove:a=!0,showRemove:f=!0,removeDisabled:g,showMoveButtons:v=!0,layout:c="aside"}=n,b=t.Value.toSignal(c).map(u=>u==="aside"),I=t.When(a,()=>t.html.div(t.attr.class("bc-list-item-controls__move"),B.Button({size:"xs",roundedness:"full",variant:"text",onClick:()=>l("up"),disabled:r},t.Use(E.BeatUII18n,u=>E.Icon({size:"xs",icon:"line-md:arrow-up",title:u.$.incrementValue}))),B.Button({size:"xs",roundedness:"full",variant:"text",onClick:()=>l("down"),disabled:o},t.Use(E.BeatUII18n,u=>E.Icon({size:"xs",icon:"line-md:arrow-down",title:u.$.decrementValue}))))),s=t.When(f,()=>t.Use(E.BeatUII18n,u=>F.CloseButton({size:"xs",label:t.Value.map(u.$.removeItem,w=>w.toLowerCase()),color:"danger",disabled:g,onClick:h})));return t.When(b,()=>t.html.div(t.attr.class("bc-list-item-controls bc-list-item-controls--aside"),t.html.div(t.attr.class("bc-list-item-controls__content"),e),t.html.div(t.attr.class("bc-list-item-controls__actions"),t.When(v,()=>I),s)),()=>t.html.div(t.attr.class("bc-list-item-controls bc-list-item-controls--below"),t.html.div(t.attr.class("bc-list-item-controls__content"),e),t.html.div(t.attr.class("bc-list-item-controls__actions"),t.When(v,()=>I,()=>t.html.div()),s)))}const xt=n=>{const{controller:e,element:l,separator:r,showMove:o=!0,showRemove:h=!0,showAdd:a=!0,createItem:f,addLabel:g,controlsLayout:v="aside",removeDisabled:c,addDisabled:b}=n,I=t.When(t.computedOf(a,f)((s,u)=>s&&u!=null),()=>Q(t.attr.class("bc-group--gap-2 bc-group--align-center bc-group--justify-center"),B.Button({size:"sm",variant:"filled",onClick:()=>e.push(f()),disabled:t.computedOf(e.disabled,b??!1)((s,u)=>s||u)},t.Use(E.BeatUII18n,s=>Q(t.attr.class("bc-group--gap-2"),E.Icon({icon:"line-md:plus"}),g??s.$.addLabel)))));return t.Fragment(ht(e,s=>vt({onMove:s.move,cannotMoveUp:s.cannotMove("up"),cannotMoveDown:s.cannotMove("down"),onRemove:s.remove,showMove:o,showRemove:h,removeDisabled:c,showMoveButtons:e.signal.map(u=>u.length>1),layout:v},l(s)),r),I)},qt=(n,...e)=>{const{controller:l,element:r,separator:o,showMove:h,showRemove:a,showAdd:f,createItem:g,addLabel:v,controlsLayout:c,removeDisabled:b,addDisabled:I,...s}=n;return F.Field({...s,content:xt({controller:l,element:r,separator:o,showMove:h,showRemove:a,showAdd:f,createItem:g,addLabel:v,controlsLayout:c,removeDisabled:b,addDisabled:I})},...e)};class Zt extends F.Controller{branches;activeBranch;#e;#t=new Map;constructor(e,l,r,o,h,a,f=R.strictEqual){super(e,l,r,o,h,f),this.branches=a;const g=c=>{for(const b of a)if(b.detect(c))return b.key;return a[0]?.key??"unknown"};this.activeBranch=r.map(g,R.strictEqual);const v=c=>{if(this.#t.has(c))return this.#t.get(c);const b=a.find(s=>s.key===c);if(!b)throw new Error(`Unknown branch: ${c}`);const I=new F.Controller([...e,c],s=>{this.change(s)},this.signal.map(s=>b.detect(s)?s:b.defaultValue(),f),o.map(F.makeMapValidation([c])),{disabled:this.disabled,validationMode:this.parent.validationMode},f);return this.#t.set(c,I),I};this.#e=this.activeBranch.map(c=>v(c),R.strictEqual),this.onDispose(()=>{for(const c of this.#t.values())c.dispose();this.#t.clear(),this.activeBranch.dispose(),this.#e.dispose()})}get activeController(){return t.Value.get(this.#e)}getBranchController(e){const l=this.branches.find(o=>o.key===e);if(!l)throw new Error(`Unknown branch: ${e}`);if(this.#t.has(e))return this.#t.get(e);const r=new F.Controller([...this.path,e],o=>{this.change(o)},this.signal.map(o=>l.detect(o)?o:l.defaultValue(),R.strictEqual),this.status.map(F.makeMapValidation([e])),{disabled:this.disabled,validationMode:this.parent.validationMode},R.strictEqual);return this.#t.set(e,r),r}switchToBranch(e,l=!1){const r=this.branches.find(a=>a.key===e);if(!r)throw new Error(`Unknown branch: ${e}`);const o=t.Value.get(this.signal);if(r.detect(o))return!0;if(r.convert){const a=r.convert(o);if(a.ok)return this.change(a.value),!0}if(l&&typeof window=="object"&&typeof window.confirm=="function"&&!window.confirm(E.defaultMessages.changeTypeConfirmation))return!1;const h=r.defaultValue();return this.change(h),!0}get activeBranchDefinition(){const e=t.Value.get(this.activeBranch);return this.branches.find(l=>l.key===e)}}function Ht(n){return n.transform(e=>e??null,e=>e??void 0)}function Yt(n){return n.transform(e=>e??"",e=>e===""?void 0:e)}function Gt(n){return n.transform(e=>e??void 0,e=>e??null)}function q(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)&&Object.prototype.toString.call(n)==="[object Object]"}function yt(n,e){if(e==null)return it(n);if(n==null)return e;if(q(n)&&q(e)){const l={...e};for(const r of Object.keys(n))l[r]===void 0?l[r]=it(n[r]):q(n[r])&&q(l[r])&&(l[r]=yt(n[r],l[r]));return l}return e}function it(n){return typeof structuredClone=="function"?structuredClone(n):JSON.parse(JSON.stringify(n))}exports.BaseListControl=xt;exports.BaseNativeSelectControl=mt;exports.Expando=pt;exports.FilesInput=Ft;exports.Group=Q;exports.ListControl=qt;exports.ListInput=ht;exports.ListItemControls=vt;exports.MaskInput=et;exports.NativeSelect=dt;exports.NativeSelectControl=Ct;exports.NullableDurationInput=Pt;exports.NullableNumberInput=zt;exports.NullableResetAfter=tt;exports.NumberInput=Et;exports.SegmentedInput=Mt;exports.TextArea=Lt;exports.UnionController=Zt;exports.UnstyledDropZone=Z;exports.UrlInput=jt;exports.UuidInput=Nt;exports.WithTemporal=ct;exports.deepMergeDefaults=yt;exports.durationMaskConfig=gt;exports.emitExpando=wt;exports.emitOptionExpando=X;exports.ensureTemporal=H;exports.roundToStep=P;exports.transformEmptyStringToUndefined=Yt;exports.transformNullToUndefined=Ht;exports.transformUndefinedToNull=Gt;
|