@tempots/beatui 0.53.0 → 0.54.1
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/{2019-BiSy3dQP.cjs → 2019-5RIscTOv.cjs} +1 -1
- package/dist/{2019-Djx2f_nO.js → 2019-i1LHsYdK.js} +2 -2
- package/dist/{2020-BgJxYgaO.cjs → 2020-DeCezjWf.cjs} +1 -1
- package/dist/{2020-C1wOj1GM.js → 2020-S7qY95wq.js} +2 -2
- package/dist/{ar-BEbbig_x.cjs → ar-BqnDsD9v.cjs} +1 -1
- package/dist/{ar-Djuleurf.js → ar-DrBp_VwJ.js} +7 -12
- package/dist/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +353 -360
- package/dist/{de-E8u7Hbc0.js → de-B5oZoraI.js} +5 -10
- package/dist/{de-Br3MCGtv.cjs → de-C_N0wtxQ.cjs} +1 -1
- package/dist/{es-BN0iaBgJ.js → es-DRc5dc_G.js} +1 -6
- package/dist/{es-CAwGEj_N.cjs → es-JnLMDtzg.cjs} +1 -1
- package/dist/{fa-3Qfo8ZXh.js → fa-B0VDVs5B.js} +6 -11
- package/dist/{fa-CEz8tGnY.cjs → fa-BC16IdRL.cjs} +1 -1
- package/dist/{fr-Dbn62iEL.cjs → fr-BupZ6YnU.cjs} +1 -1
- package/dist/{fr-D1ndk0A5.js → fr-DXlfWwI6.js} +8 -13
- package/dist/{he-CIV7rntE.js → he-BX-Az8As.js} +8 -13
- package/dist/{he-OtaTg9wg.cjs → he-C-aQ2yoO.cjs} +1 -1
- package/dist/{hi-CnbarThz.cjs → hi-L3y3Aedb.cjs} +1 -1
- package/dist/{hi-tzWREPMb.js → hi-w4uL7LN1.js} +8 -13
- package/dist/{index-nRXzduHm.cjs → index-B7gVxeO9.cjs} +1 -1
- package/dist/{index-CBT2SLat.js → index-BI5w0jSz.js} +223 -224
- package/dist/{index-B9y4N11q.js → index-BnQvOXw8.js} +3019 -3004
- package/dist/{index-ClFVnBUS.cjs → index-Bv2gn_kV.cjs} +3 -3
- package/dist/{index-BjQW8AsK.cjs → index-CFOxIBGJ.cjs} +12 -12
- package/dist/{index-KPHFBjQB.cjs → index-CKyH3jwP.cjs} +1 -1
- package/dist/{index-TiMfhF1U.cjs → index-C_71zSeN.cjs} +1 -1
- package/dist/index-CkNcU-jd.cjs +8 -0
- package/dist/{index-qWS4IYZX.js → index-CyoxPiTg.js} +1 -1
- package/dist/{index-UMbs0jPr.js → index-DKwuTFYj.js} +377 -378
- package/dist/{index-DDhLWdaz.js → index-DNUXf4K4.js} +1 -1
- package/dist/{index-CAeOFdez.js → index-DjShJtXp.js} +1 -1
- package/dist/index.cjs.js +4 -4
- package/dist/index.es.js +2413 -2522
- package/dist/{it-1Hy_Ay2j.js → it-BCKQ5Tu8.js} +6 -11
- package/dist/{it-FOaX_rku.cjs → it-CnHaoq-X.cjs} +1 -1
- package/dist/{ja-C7_PK2VE.js → ja-DC47Nkza.js} +13 -18
- package/dist/{ja-DW4_3EWp.cjs → ja-DpDF4IgX.cjs} +1 -1
- package/dist/json-schema/index.cjs.js +1 -1
- package/dist/json-schema/index.es.js +1 -1
- package/dist/{ko-C-jXKweM.cjs → ko-BMmVJHzm.cjs} +1 -1
- package/dist/{ko-BDOp6dFE.js → ko-ejUHA0Sw.js} +8 -13
- package/dist/markdown/index.cjs.js +1 -1
- package/dist/markdown/index.es.js +1 -1
- package/dist/{modal-BBaPJhi-.js → modal-CKyUdeEz.js} +54 -58
- package/dist/modal-rou7pM0r.cjs +1 -0
- package/dist/{nl-CF5W2Rt4.js → nl-WjgpPUel.js} +6 -11
- package/dist/{nl-Ui8TT45t.cjs → nl-viDlnQWK.cjs} +1 -1
- package/dist/{notice-DTTyRbwh.js → notice-BS0d903Q.js} +385 -387
- package/dist/notice-MF7whf3_.cjs +2 -0
- package/dist/{pl-oLzT5Ole.js → pl-Cw4CYjK_.js} +3 -8
- package/dist/{pl-8PM7rn2L.cjs → pl-Vrfv_fGt.cjs} +1 -1
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +1 -1
- package/dist/{pt-Bb0T3Cx1.js → pt-B4Rh_ZBF.js} +10 -15
- package/dist/{pt-kRRsG9-4.cjs → pt-CxQV74vS.cjs} +1 -1
- package/dist/{ru-C5AMF9a6.cjs → ru-BB3GRr_J.cjs} +1 -1
- package/dist/{ru-DwLv1myc.js → ru-DFHsLJ9b.js} +14 -19
- package/dist/{toolbar-D_LSJCtv.js → toolbar-D2J_NkKD.js} +1 -1
- package/dist/{toolbar-D6_MB1QI.cjs → toolbar-DRdm9W7H.cjs} +1 -1
- package/dist/{tr-DBQNjaPN.js → tr-Dbktyawl.js} +7 -12
- package/dist/{tr-BwgU2BAj.cjs → tr-mBiHcEl1.cjs} +1 -1
- package/dist/{translations-CG5-f9U8.js → translations-CaTkLRHu.js} +85 -93
- package/dist/{translations-t57jdjWu.js → translations-CpTeFtvW.js} +1 -1
- package/dist/{translations-D77sU1Wl.cjs → translations-ggnrzaCG.cjs} +1 -1
- package/dist/translations-h_OJS1Ut.cjs +1 -0
- package/dist/types/components/data/icon.d.ts +1 -1
- package/dist/types/components/data/page-drop-zone.d.ts +1 -1
- package/dist/types/components/data/unstyled-drop-zone.d.ts +1 -1
- package/dist/types/components/form/input/create-nullable-string-input.d.ts +24 -0
- package/dist/types/components/form/input/create-temporal-input.d.ts +54 -0
- package/dist/types/components/form/input/nullable-email-input.d.ts +1 -2
- package/dist/types/components/form/input/nullable-password-input.d.ts +1 -2
- package/dist/types/components/form/input/nullable-plain-date-input.d.ts +19 -3
- package/dist/types/components/form/input/nullable-plain-date-time-input.d.ts +19 -3
- package/dist/types/components/form/input/nullable-plain-time-input.d.ts +19 -3
- package/dist/types/components/form/input/nullable-plain-year-month-input.d.ts +19 -3
- package/dist/types/components/form/input/nullable-text-area.d.ts +6 -4
- package/dist/types/components/form/input/nullable-text-input.d.ts +3 -4
- package/dist/types/components/form/input/nullable-url-input.d.ts +1 -2
- package/dist/types/components/form/input/nullable-uuid-input.d.ts +1 -2
- package/dist/types/components/form/input/plain-date-input.d.ts +19 -3
- package/dist/types/components/form/input/plain-date-time-input.d.ts +19 -3
- package/dist/types/components/form/input/plain-time-input.d.ts +19 -3
- package/dist/types/components/form/input/plain-year-month-input.d.ts +19 -3
- package/dist/types/components/json-schema/controls/shared-utils.d.ts +8 -0
- package/dist/types/components/json-schema/schema-conditionals.d.ts +26 -0
- package/dist/types/components/json-schema/schema-context.d.ts +4 -107
- package/dist/types/components/json-schema/schema-merge.d.ts +9 -0
- package/dist/types/components/json-schema/schema-types.d.ts +85 -0
- package/dist/{ur-s32jv4mP.cjs → ur-CZ5sgUP1.cjs} +1 -1
- package/dist/{ur-BmK_ieRn.js → ur-Cqh7AYnd.js} +9 -14
- package/dist/utils-U1aNOU3o.cjs +1 -0
- package/dist/utils-w_vUChhV.js +2454 -0
- package/dist/{vi-DK0Fj95H.js → vi-CLBp2oaY.js} +11 -16
- package/dist/{vi-B4qRKlRd.cjs → vi-Ki_Urj_E.cjs} +1 -1
- package/dist/{zh-CUEpc9yf.cjs → zh-C78OkbS0.cjs} +1 -1
- package/dist/{zh-Db8COSme.js → zh-CT4aGkgD.js} +8 -13
- package/package.json +5 -4
- package/dist/index-ClqyVDXY.cjs +0 -8
- package/dist/modal-O7QoP7Zv.cjs +0 -1
- package/dist/notice-DLDzwKkw.cjs +0 -2
- package/dist/translations-BAk3j4bi.cjs +0 -1
- package/dist/utils-CYMdxKSM.js +0 -2516
- package/dist/utils-DI_H4_Gm.cjs +0 -1
|
@@ -0,0 +1,2454 @@
|
|
|
1
|
+
import { Use as H, Value as p, prop as tt, html as I, attr as l, on as C, WithElement as it, Empty as T, aria as z, bind as _t, OnDispose as Z, computedOf as V, style as ft, When as E, NotEmpty as Qt, Fragment as L, ForEach as dt, svg as Tt, svgAttr as ht, emitValue as P, coalesce as Jt, Ensure as Kt, OneOfType as te, Repeat as Pt, signal as Ft, input as Q, emitValueAsNullableDate as ee, emitValueAsNullableDateTime as ne, emitValueAsNumber as X, emit as se, Task as At } from "@tempots/dom";
|
|
2
|
+
import { f as re } from "./colors-BW19rWA1.js";
|
|
3
|
+
import { g as ae } from "./timer-DzWb416P.js";
|
|
4
|
+
import { ElementRect as jt, AutoSelect as le } from "@tempots/ui";
|
|
5
|
+
import { a as W, b as O, f as oe, I as N, C as j, c as ce, d as $t, T as ie, g as ue, L as pe, e as Vt, h as fe, B as gt } from "./translations-CaTkLRHu.js";
|
|
6
|
+
import { C as yt, m as de, d as me, I as Ht, E as he, P as ge, S as ot, s as be, e as bt, O as rt, f as Bt } from "./notice-BS0d903Q.js";
|
|
7
|
+
function Wt(t) {
|
|
8
|
+
if (typeof t != "string") return !1;
|
|
9
|
+
const e = t.startsWith("#") ? t.slice(1) : t;
|
|
10
|
+
return /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(e);
|
|
11
|
+
}
|
|
12
|
+
function xe(t) {
|
|
13
|
+
if (typeof t != "string") return !1;
|
|
14
|
+
const e = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i, s = t.match(e);
|
|
15
|
+
if (!s) return !1;
|
|
16
|
+
const [, n, r, c] = s, a = parseInt(n, 10), i = parseInt(r, 10), o = parseInt(c, 10);
|
|
17
|
+
return a >= 0 && a <= 255 && i >= 0 && i <= 255 && o >= 0 && o <= 255;
|
|
18
|
+
}
|
|
19
|
+
function ve(t) {
|
|
20
|
+
if (typeof t != "string") return !1;
|
|
21
|
+
const e = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i, s = t.match(e);
|
|
22
|
+
if (!s) return !1;
|
|
23
|
+
const [, n, r, c, a] = s, i = parseInt(n, 10), o = parseInt(r, 10), u = parseInt(c, 10), f = parseFloat(a);
|
|
24
|
+
return i >= 0 && i <= 255 && o >= 0 && o <= 255 && u >= 0 && u <= 255 && f >= 0 && f <= 1;
|
|
25
|
+
}
|
|
26
|
+
function we(t) {
|
|
27
|
+
if (typeof t != "string") return !1;
|
|
28
|
+
const e = /^hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)$/i, s = t.match(e);
|
|
29
|
+
if (!s) return !1;
|
|
30
|
+
const [, n, r, c] = s, a = parseInt(n, 10), i = parseInt(r, 10), o = parseInt(c, 10);
|
|
31
|
+
return a >= 0 && a <= 360 && i >= 0 && i <= 100 && o >= 0 && o <= 100;
|
|
32
|
+
}
|
|
33
|
+
function xn(t) {
|
|
34
|
+
return Wt(t) || xe(t) || ve(t) || we(t);
|
|
35
|
+
}
|
|
36
|
+
function _e(t) {
|
|
37
|
+
if (!Wt(t)) return null;
|
|
38
|
+
let e = t.startsWith("#") ? t.slice(1) : t;
|
|
39
|
+
return e.length === 3 && (e = e.split("").map((s) => s + s).join("")), `#${e.toLowerCase()}`;
|
|
40
|
+
}
|
|
41
|
+
function kt(t, e, s) {
|
|
42
|
+
const n = (r) => {
|
|
43
|
+
const c = Math.round(Math.max(0, Math.min(255, r))).toString(16);
|
|
44
|
+
return c.length === 1 ? "0" + c : c;
|
|
45
|
+
};
|
|
46
|
+
return `#${n(t)}${n(e)}${n(s)}`;
|
|
47
|
+
}
|
|
48
|
+
function ct(t) {
|
|
49
|
+
const e = _e(t);
|
|
50
|
+
if (!e) return null;
|
|
51
|
+
const s = /^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
|
|
52
|
+
return s ? {
|
|
53
|
+
r: parseInt(s[1], 16),
|
|
54
|
+
g: parseInt(s[2], 16),
|
|
55
|
+
b: parseInt(s[3], 16)
|
|
56
|
+
} : null;
|
|
57
|
+
}
|
|
58
|
+
function vn(t, e) {
|
|
59
|
+
const s = ct(t), n = ct(e);
|
|
60
|
+
if (!s || !n) return null;
|
|
61
|
+
const r = (u, f, g) => {
|
|
62
|
+
const [h, d, x] = [u, f, g].map((w) => (w = w / 255, w <= 0.03928 ? w / 12.92 : Math.pow((w + 0.055) / 1.055, 2.4)));
|
|
63
|
+
return 0.2126 * h + 0.7152 * d + 0.0722 * x;
|
|
64
|
+
}, c = r(s.r, s.g, s.b), a = r(n.r, n.g, n.b), i = Math.max(c, a), o = Math.min(c, a);
|
|
65
|
+
return (i + 0.05) / (o + 0.05);
|
|
66
|
+
}
|
|
67
|
+
function $e(t) {
|
|
68
|
+
if (!t) return [0, 0, 0, 1];
|
|
69
|
+
const s = t.trim().match(
|
|
70
|
+
/^#?([a-fA-F0-9]{3,4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$/
|
|
71
|
+
);
|
|
72
|
+
if (s) {
|
|
73
|
+
const u = s[1];
|
|
74
|
+
if (u.length === 8) {
|
|
75
|
+
const f = parseInt(u.slice(0, 2), 16), g = parseInt(u.slice(2, 4), 16), h = parseInt(u.slice(4, 6), 16), d = parseInt(u.slice(6, 8), 16) / 255;
|
|
76
|
+
return [f, g, h, d];
|
|
77
|
+
}
|
|
78
|
+
if (u.length === 6)
|
|
79
|
+
return [
|
|
80
|
+
parseInt(u.slice(0, 2), 16),
|
|
81
|
+
parseInt(u.slice(2, 4), 16),
|
|
82
|
+
parseInt(u.slice(4, 6), 16),
|
|
83
|
+
1
|
|
84
|
+
];
|
|
85
|
+
if (u.length === 4) {
|
|
86
|
+
const f = parseInt(u[0] + u[0], 16), g = parseInt(u[1] + u[1], 16), h = parseInt(u[2] + u[2], 16), d = parseInt(u[3] + u[3], 16) / 255;
|
|
87
|
+
return [f, g, h, d];
|
|
88
|
+
}
|
|
89
|
+
if (u.length === 3) {
|
|
90
|
+
const f = parseInt(u[0] + u[0], 16), g = parseInt(u[1] + u[1], 16), h = parseInt(u[2] + u[2], 16);
|
|
91
|
+
return [f, g, h, 1];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const n = t.match(
|
|
95
|
+
/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i
|
|
96
|
+
);
|
|
97
|
+
if (n)
|
|
98
|
+
return [
|
|
99
|
+
parseInt(n[1], 10),
|
|
100
|
+
parseInt(n[2], 10),
|
|
101
|
+
parseInt(n[3], 10),
|
|
102
|
+
parseFloat(n[4])
|
|
103
|
+
];
|
|
104
|
+
const r = t.match(
|
|
105
|
+
/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i
|
|
106
|
+
);
|
|
107
|
+
if (r)
|
|
108
|
+
return [parseInt(r[1], 10), parseInt(r[2], 10), parseInt(r[3], 10), 1];
|
|
109
|
+
const c = t.match(
|
|
110
|
+
/^hsla?\(\s*([+-]?[\d.]+)(?:deg)?\s*[ ,]?\s*([\d.]+)%\s*[ ,]?\s*([\d.]+)%\s*(?:[/,]\s*(\d?(?:\.\d+)?))?\s*\)$/i
|
|
111
|
+
);
|
|
112
|
+
if (c) {
|
|
113
|
+
const u = parseFloat(c[1]), f = parseFloat(c[2]), g = parseFloat(c[3]), h = c[4] != null ? parseFloat(c[4]) : 1, [d, x, w] = Zt(u, f / 100, g / 100);
|
|
114
|
+
return [d, x, w, h];
|
|
115
|
+
}
|
|
116
|
+
const a = t.match(
|
|
117
|
+
/^hwb\(\s*([+-]?[\d.]+)(?:deg)?\s*[, ]\s*([\d.]+)%\s*[, ]\s*([\d.]+)%\s*(?:[/]\s*(\d?(?:\.\d+)?))?\s*\)$/i
|
|
118
|
+
);
|
|
119
|
+
if (a) {
|
|
120
|
+
const u = parseFloat(a[1]), f = parseFloat(a[2]) / 100, g = parseFloat(a[3]) / 100, h = a[4] != null ? parseFloat(a[4]) : 1, [d, x, w] = Ie(u, f, g);
|
|
121
|
+
return [d, x, w, h];
|
|
122
|
+
}
|
|
123
|
+
const i = t.match(
|
|
124
|
+
/^oklch\(\s*([+-]?[\d.]+%?)\s+([\d.]+)\s+([+-]?[\d.]+)(?:deg)?(?:\s*\/\s*(\d?(?:\.\d+)?))?\s*\)$/i
|
|
125
|
+
);
|
|
126
|
+
if (i) {
|
|
127
|
+
const u = i[1], f = parseFloat(i[2]), g = parseFloat(i[3]), h = i[4] != null ? parseFloat(i[4]) : 1, d = u.endsWith("%") ? Math.max(0, Math.min(1, parseFloat(u) / 100)) : Math.max(0, Math.min(1, parseFloat(u))), [x, w, _] = Me(d, f, g);
|
|
128
|
+
return [x, w, _, h];
|
|
129
|
+
}
|
|
130
|
+
const o = ct(t);
|
|
131
|
+
return o ? [o.r, o.g, o.b, 1] : [0, 0, 0, 1];
|
|
132
|
+
}
|
|
133
|
+
function ye(t, e, s, n) {
|
|
134
|
+
return `rgba(${Math.round(t)}, ${Math.round(e)}, ${Math.round(s)}, ${Math.max(
|
|
135
|
+
0,
|
|
136
|
+
Math.min(1, Math.round(n * 100) / 100)
|
|
137
|
+
)})`;
|
|
138
|
+
}
|
|
139
|
+
function ke(t) {
|
|
140
|
+
let e = t + 1831565813;
|
|
141
|
+
return function() {
|
|
142
|
+
return e = Math.imul(e ^ e >>> 15, e | 1), e ^= e + Math.imul(e ^ e >>> 7, e | 61), ((e ^ e >>> 14) >>> 0) / 4294967296;
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function Zt(t, e, s) {
|
|
146
|
+
t = (t % 360 + 360) % 360;
|
|
147
|
+
const n = (1 - Math.abs(2 * s - 1)) * e, r = n * (1 - Math.abs(t / 60 % 2 - 1)), c = s - n / 2;
|
|
148
|
+
let a = 0, i = 0, o = 0;
|
|
149
|
+
return 0 <= t && t < 60 ? [a, i, o] = [n, r, 0] : 60 <= t && t < 120 ? [a, i, o] = [r, n, 0] : 120 <= t && t < 180 ? [a, i, o] = [0, n, r] : 180 <= t && t < 240 ? [a, i, o] = [0, r, n] : 240 <= t && t < 300 ? [a, i, o] = [r, 0, n] : [a, i, o] = [n, 0, r], [
|
|
150
|
+
Math.round((a + c) * 255),
|
|
151
|
+
Math.round((i + c) * 255),
|
|
152
|
+
Math.round((o + c) * 255)
|
|
153
|
+
];
|
|
154
|
+
}
|
|
155
|
+
function Ie(t, e, s) {
|
|
156
|
+
t = (t % 360 + 360) % 360;
|
|
157
|
+
const n = e + s;
|
|
158
|
+
n > 1 && (e /= n, s /= n);
|
|
159
|
+
const [r, c, a] = Zt(t, 1, 0.5).map((g) => g / 255), i = 1 - e - s, o = r * i + e, u = c * i + e, f = a * i + e;
|
|
160
|
+
return [Math.round(o * 255), Math.round(u * 255), Math.round(f * 255)];
|
|
161
|
+
}
|
|
162
|
+
function It(t, e, s) {
|
|
163
|
+
t /= 255, e /= 255, s /= 255;
|
|
164
|
+
const n = Math.max(t, e, s), r = Math.min(t, e, s);
|
|
165
|
+
let c = 0, a = 0;
|
|
166
|
+
const i = (n + r) / 2, o = n - r;
|
|
167
|
+
if (o !== 0) {
|
|
168
|
+
switch (a = i > 0.5 ? o / (2 - n - r) : o / (n + r), n) {
|
|
169
|
+
case t:
|
|
170
|
+
c = (e - s) / o + (e < s ? 6 : 0);
|
|
171
|
+
break;
|
|
172
|
+
case e:
|
|
173
|
+
c = (s - t) / o + 2;
|
|
174
|
+
break;
|
|
175
|
+
default:
|
|
176
|
+
c = (t - e) / o + 4;
|
|
177
|
+
}
|
|
178
|
+
c *= 60;
|
|
179
|
+
}
|
|
180
|
+
return [Math.round(c), Math.round(a * 100), Math.round(i * 100)];
|
|
181
|
+
}
|
|
182
|
+
function Ce(t, e, s) {
|
|
183
|
+
const [n] = It(t, e, s), r = t / 255, c = e / 255, a = s / 255, i = Math.min(r, c, a), o = 1 - Math.max(r, c, a);
|
|
184
|
+
return [n, Math.round(i * 100), Math.round(o * 100)];
|
|
185
|
+
}
|
|
186
|
+
function xt(t) {
|
|
187
|
+
const e = t / 255;
|
|
188
|
+
return e <= 0.04045 ? e / 12.92 : Math.pow((e + 0.055) / 1.055, 2.4);
|
|
189
|
+
}
|
|
190
|
+
function vt(t) {
|
|
191
|
+
const e = t <= 31308e-7 ? 12.92 * t : 1.055 * Math.pow(t, 0.4166666666666667) - 0.055;
|
|
192
|
+
return Math.round(Math.max(0, Math.min(1, e)) * 255);
|
|
193
|
+
}
|
|
194
|
+
function Me(t, e, s) {
|
|
195
|
+
const n = s * Math.PI / 180, r = Math.cos(n) * e, c = Math.sin(n) * e, a = t + 0.3963377774 * r + 0.2158037573 * c, i = t - 0.1055613458 * r - 0.0638541728 * c, o = t - 0.0894841775 * r - 1.291485548 * c, u = a * a * a, f = i * i * i, g = o * o * o, h = 4.0767416621 * u - 3.3077115913 * f + 0.2309699292 * g, d = -1.2684380046 * u + 2.6097574011 * f - 0.3413193965 * g, x = -0.0041960863 * u - 0.7034186147 * f + 1.707614701 * g;
|
|
196
|
+
return [vt(h), vt(d), vt(x)];
|
|
197
|
+
}
|
|
198
|
+
function De(t, e, s) {
|
|
199
|
+
const n = xt(t), r = xt(e), c = xt(s), a = 0.4122214708 * n + 0.5363325363 * r + 0.0514459929 * c, i = 0.2119034982 * n + 0.6806995451 * r + 0.1073969566 * c, o = 0.0883024619 * n + 0.2817188376 * r + 0.6299787005 * c, u = Math.cbrt(a), f = Math.cbrt(i), g = Math.cbrt(o), h = 0.2104542553 * u + 0.793617785 * f - 0.0040720468 * g, d = 1.9779984951 * u - 2.428592205 * f + 0.4505937099 * g, x = 0.0259040371 * u + 0.7827717662 * f - 0.808675766 * g, w = Math.sqrt(d * d + x * x);
|
|
200
|
+
let _ = Math.atan2(x, d) * 180 / Math.PI;
|
|
201
|
+
return _ < 0 && (_ += 360), [h, w, _];
|
|
202
|
+
}
|
|
203
|
+
function at(t, e, s, n, r, c) {
|
|
204
|
+
switch (r) {
|
|
205
|
+
case "hex":
|
|
206
|
+
if (c) {
|
|
207
|
+
const a = (o) => o.toString(16).padStart(2, "0"), i = Math.max(0, Math.min(255, Math.round(n * 255)));
|
|
208
|
+
return `#${a(t)}${a(e)}${a(s)}${a(i)}`;
|
|
209
|
+
}
|
|
210
|
+
return kt(t, e, s);
|
|
211
|
+
case "rgb":
|
|
212
|
+
return `rgb(${t}, ${e}, ${s})`;
|
|
213
|
+
case "rgba":
|
|
214
|
+
return `rgba(${t}, ${e}, ${s}, ${Math.round(n * 100) / 100})`;
|
|
215
|
+
case "hsl": {
|
|
216
|
+
const [a, i, o] = It(t, e, s);
|
|
217
|
+
return `hsl(${a}, ${i}%, ${o}%)`;
|
|
218
|
+
}
|
|
219
|
+
case "hsla": {
|
|
220
|
+
const [a, i, o] = It(t, e, s);
|
|
221
|
+
return `hsla(${a}, ${i}%, ${o}%, ${Math.round(n * 100) / 100})`;
|
|
222
|
+
}
|
|
223
|
+
case "hwb": {
|
|
224
|
+
const [a, i, o] = Ce(t, e, s);
|
|
225
|
+
return n < 1 ? `hwb(${a} ${i}% ${o}% / ${Math.round(n * 100) / 100})` : `hwb(${a} ${i}% ${o}%)`;
|
|
226
|
+
}
|
|
227
|
+
case "oklch": {
|
|
228
|
+
const [a, i, o] = De(t, e, s), u = (Math.round(a * 1e3) / 1e3).toFixed(3), f = (Math.round(i * 1e3) / 1e3).toFixed(3), g = (Math.round(o * 10) / 10).toFixed(1), h = Math.round(n * 100) / 100;
|
|
229
|
+
return c || n < 1 ? `oklch(${u} ${f} ${g} / ${h})` : `oklch(${u} ${f} ${g})`;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function lt(t, e) {
|
|
234
|
+
return e ? t === "rgb" ? "rgba" : t === "hsl" ? "hsla" : t : t === "rgba" ? "rgb" : t === "hsla" ? "hsl" : t;
|
|
235
|
+
}
|
|
236
|
+
class Se extends Error {
|
|
237
|
+
constructor(e = "Missing implementation") {
|
|
238
|
+
super(e), this.name = "MissingImplementationError";
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
const wn = (t) => Te(t).split("_").join(" "), Te = (t) => (t = t.replace(/::/g, "/"), t = t.replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2"), t = t.replace(/([a-z\d])([A-Z])/g, "$1_$2"), t = t.replace(/-/g, "_"), t.toLowerCase()), _n = (t) => t.substring(0, 1).toUpperCase() + t.substring(1), Fe = (t) => {
|
|
242
|
+
if (typeof Buffer < "u")
|
|
243
|
+
return Buffer.from(t, "base64").toString("utf8");
|
|
244
|
+
if (typeof atob < "u")
|
|
245
|
+
return atob(t);
|
|
246
|
+
throw new Se(
|
|
247
|
+
"No implementation found for base64 decoding"
|
|
248
|
+
);
|
|
249
|
+
};
|
|
250
|
+
function Lt({
|
|
251
|
+
onChange: t,
|
|
252
|
+
value: e,
|
|
253
|
+
accept: s = "*/*",
|
|
254
|
+
enableClick: n = !0,
|
|
255
|
+
content: r,
|
|
256
|
+
disabled: c = !1,
|
|
257
|
+
allowMultiple: a
|
|
258
|
+
}) {
|
|
259
|
+
return H(W, (i) => {
|
|
260
|
+
const o = p.deriveProp(e ?? []), u = tt(!1), f = (b) => {
|
|
261
|
+
b.preventDefault(), b.stopPropagation(), u.value = !0;
|
|
262
|
+
}, g = (b) => {
|
|
263
|
+
b.preventDefault(), b.stopPropagation(), (!b.currentTarget || !b.currentTarget.contains(b.relatedTarget)) && (u.value = !1);
|
|
264
|
+
}, h = (b) => {
|
|
265
|
+
b.preventDefault(), b.stopPropagation(), u.value = !1;
|
|
266
|
+
const m = Array.from(b.dataTransfer?.files || []);
|
|
267
|
+
m.length > 0 && (o.value = m, t(m, "dragdrop"));
|
|
268
|
+
}, d = (b) => {
|
|
269
|
+
p.get(n) && b.currentTarget.querySelector(
|
|
270
|
+
'input[type="file"]'
|
|
271
|
+
)?.click();
|
|
272
|
+
};
|
|
273
|
+
let x = null;
|
|
274
|
+
const w = () => {
|
|
275
|
+
if (x == null) return;
|
|
276
|
+
const b = Array.from(x.files ?? []);
|
|
277
|
+
b.length > 0 && (o.value = b, t(b, "click")), x.value = "";
|
|
278
|
+
}, _ = (b) => {
|
|
279
|
+
p.get(n) && (b.key === "Enter" || b.key === " ") && (b.preventDefault(), d(b));
|
|
280
|
+
};
|
|
281
|
+
return I.div(
|
|
282
|
+
l.role("button"),
|
|
283
|
+
l.tabindex(
|
|
284
|
+
p.map(n, (b) => b ? 0 : -1)
|
|
285
|
+
),
|
|
286
|
+
l.style("position: relative;"),
|
|
287
|
+
C.dragover(f),
|
|
288
|
+
C.dragleave(g),
|
|
289
|
+
C.drop(h),
|
|
290
|
+
C.click(d),
|
|
291
|
+
C.keydown(_),
|
|
292
|
+
// Hidden file input
|
|
293
|
+
I.input(
|
|
294
|
+
l.type("file"),
|
|
295
|
+
l.disabled(c),
|
|
296
|
+
l.accept(s),
|
|
297
|
+
l.multiple(a),
|
|
298
|
+
l.style(
|
|
299
|
+
"position: absolute; left: -9999px; opacity: 0; pointer-events: none;"
|
|
300
|
+
),
|
|
301
|
+
C.change(w),
|
|
302
|
+
it((b) => (x = b, o.on((m) => {
|
|
303
|
+
const M = globalThis.DataTransfer;
|
|
304
|
+
if (M != null) {
|
|
305
|
+
const k = new M();
|
|
306
|
+
m.forEach(($) => k.items.add($)), b.files = k.files;
|
|
307
|
+
}
|
|
308
|
+
}), T))
|
|
309
|
+
),
|
|
310
|
+
// Screen reader instructions
|
|
311
|
+
z.label(_t(i.$.dropZoneInstructions)(n)),
|
|
312
|
+
// Content
|
|
313
|
+
r({ files: o, clear: () => o.value = [], change: o.set })
|
|
314
|
+
);
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
function Ae(t, e) {
|
|
318
|
+
return t.length === e.length && t.every((s, n) => s === e[n]);
|
|
319
|
+
}
|
|
320
|
+
function Ve(t, e) {
|
|
321
|
+
const s = ["bc-segmented-control", `bc-segmented-control--size-${t}`];
|
|
322
|
+
return e && s.push("bc-segmented-control--disabled"), s.join(" ");
|
|
323
|
+
}
|
|
324
|
+
function $n({
|
|
325
|
+
options: t,
|
|
326
|
+
value: e,
|
|
327
|
+
onChange: s,
|
|
328
|
+
size: n = "md",
|
|
329
|
+
disabled: r = !1
|
|
330
|
+
}, ...c) {
|
|
331
|
+
const a = re(t).map(([i, o]) => ({
|
|
332
|
+
key: i,
|
|
333
|
+
label: o
|
|
334
|
+
}));
|
|
335
|
+
return it(() => {
|
|
336
|
+
const i = Object.fromEntries(
|
|
337
|
+
a.map((u, f) => [u.key, f])
|
|
338
|
+
), o = tt(
|
|
339
|
+
a.map(() => ({ left: 0, width: 0 })),
|
|
340
|
+
Ae
|
|
341
|
+
);
|
|
342
|
+
return I.div(
|
|
343
|
+
Z(o),
|
|
344
|
+
l.class(
|
|
345
|
+
V(
|
|
346
|
+
n,
|
|
347
|
+
r
|
|
348
|
+
)(
|
|
349
|
+
(u, f) => Ve(u ?? "md", f ?? !1)
|
|
350
|
+
)
|
|
351
|
+
),
|
|
352
|
+
I.div(
|
|
353
|
+
l.class("bc-segmented-control__container"),
|
|
354
|
+
I.div(
|
|
355
|
+
l.class("bc-segmented-control__indicator"),
|
|
356
|
+
ft.width(
|
|
357
|
+
V(
|
|
358
|
+
e,
|
|
359
|
+
o
|
|
360
|
+
)((u, f) => {
|
|
361
|
+
const { width: g } = f[i[u] ?? 0];
|
|
362
|
+
return `${g}px`;
|
|
363
|
+
})
|
|
364
|
+
),
|
|
365
|
+
ft.left(
|
|
366
|
+
V(
|
|
367
|
+
e,
|
|
368
|
+
o
|
|
369
|
+
)((u, f) => {
|
|
370
|
+
const { left: g } = f[i[u] ?? 0];
|
|
371
|
+
return `${g}px`;
|
|
372
|
+
})
|
|
373
|
+
)
|
|
374
|
+
),
|
|
375
|
+
// clickable buttons
|
|
376
|
+
a.map(({ label: u, key: f }, g) => I.button(
|
|
377
|
+
l.type("button"),
|
|
378
|
+
C.click((h) => {
|
|
379
|
+
h.preventDefault(), p.get(r) || s?.(f);
|
|
380
|
+
}),
|
|
381
|
+
l.disabled(r),
|
|
382
|
+
l.class("bc-segmented-control__segment"),
|
|
383
|
+
l.class(
|
|
384
|
+
p.map(e, (h) => h === f ? "bc-segmented-control__segment--active" : "bc-segmented-control__segment--inactive")
|
|
385
|
+
),
|
|
386
|
+
jt((h) => {
|
|
387
|
+
function d() {
|
|
388
|
+
o.update((w) => {
|
|
389
|
+
const _ = [...w];
|
|
390
|
+
return _[g] = {
|
|
391
|
+
width: h.value.width,
|
|
392
|
+
left: h.value.localLeft
|
|
393
|
+
}, _;
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
const x = ae(d);
|
|
397
|
+
return Z(x, h.on(d));
|
|
398
|
+
}),
|
|
399
|
+
u
|
|
400
|
+
))
|
|
401
|
+
),
|
|
402
|
+
...c
|
|
403
|
+
);
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
function Be(t) {
|
|
407
|
+
const e = t.type.toLowerCase();
|
|
408
|
+
return e.startsWith("image/") && (e.includes("jpeg") || e.includes("jpg") || e.includes("png") || e.includes("gif") || e.includes("webp") || e.includes("svg"));
|
|
409
|
+
}
|
|
410
|
+
function Le(t) {
|
|
411
|
+
const e = t.type.toLowerCase();
|
|
412
|
+
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";
|
|
413
|
+
}
|
|
414
|
+
function Et(t) {
|
|
415
|
+
return E(
|
|
416
|
+
t.map(Be),
|
|
417
|
+
() => {
|
|
418
|
+
const e = tt(null);
|
|
419
|
+
return t.on((s) => {
|
|
420
|
+
e.value && URL.revokeObjectURL(e.value);
|
|
421
|
+
const n = URL.createObjectURL(s);
|
|
422
|
+
e.value = n;
|
|
423
|
+
}), I.div(
|
|
424
|
+
Z(() => {
|
|
425
|
+
e.value && URL.revokeObjectURL(e.value);
|
|
426
|
+
}),
|
|
427
|
+
l.class("bc-file-input__thumbnail-container"),
|
|
428
|
+
I.img(
|
|
429
|
+
l.src(e),
|
|
430
|
+
l.alt(t.map((s) => s.name)),
|
|
431
|
+
l.class("bc-file-input__thumbnail")
|
|
432
|
+
)
|
|
433
|
+
);
|
|
434
|
+
},
|
|
435
|
+
() => N({ icon: t.map(Le) })
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
const Ee = (t, ...e) => {
|
|
439
|
+
const {
|
|
440
|
+
value: s = tt([]),
|
|
441
|
+
accept: n = "*/*",
|
|
442
|
+
maxFiles: r,
|
|
443
|
+
maxFileSize: c,
|
|
444
|
+
onChange: a,
|
|
445
|
+
onBlur: i,
|
|
446
|
+
disabled: o,
|
|
447
|
+
hasError: u,
|
|
448
|
+
mode: f = "default",
|
|
449
|
+
showFileList: g = !0,
|
|
450
|
+
...h
|
|
451
|
+
} = t, d = s, x = p.map(f, (k) => k === "compact"), w = (k) => {
|
|
452
|
+
let $ = k;
|
|
453
|
+
if (r != null) {
|
|
454
|
+
const v = p.get(r);
|
|
455
|
+
$ = $.slice(0, v);
|
|
456
|
+
}
|
|
457
|
+
if (c) {
|
|
458
|
+
const v = p.get(c);
|
|
459
|
+
$ = $.filter((y) => y.size <= v);
|
|
460
|
+
}
|
|
461
|
+
a?.($);
|
|
462
|
+
}, _ = (k) => {
|
|
463
|
+
const v = d.value.filter((y, D) => D !== k);
|
|
464
|
+
a?.(v);
|
|
465
|
+
}, b = () => {
|
|
466
|
+
a?.([]);
|
|
467
|
+
}, m = ({
|
|
468
|
+
files: k,
|
|
469
|
+
clear: $,
|
|
470
|
+
change: v
|
|
471
|
+
}) => H(
|
|
472
|
+
W,
|
|
473
|
+
(y) => I.div(
|
|
474
|
+
l.class("bc-file-input__drop-zone"),
|
|
475
|
+
I.div(
|
|
476
|
+
l.class(
|
|
477
|
+
"bc-file-input__drop-zone-content bc-file-input__drop-zone-content--empty"
|
|
478
|
+
),
|
|
479
|
+
N({ icon: "mdi:cloud-upload-outline", size: "xl" }),
|
|
480
|
+
I.div(
|
|
481
|
+
l.class("bc-file-input__drop-zone-text"),
|
|
482
|
+
_t(y.$.filesInputInstructions)(
|
|
483
|
+
r,
|
|
484
|
+
c,
|
|
485
|
+
y.$.fileSizeUnits.value
|
|
486
|
+
)
|
|
487
|
+
)
|
|
488
|
+
)
|
|
489
|
+
)
|
|
490
|
+
), M = ({
|
|
491
|
+
files: k
|
|
492
|
+
}) => H(
|
|
493
|
+
W,
|
|
494
|
+
($) => I.div(
|
|
495
|
+
l.class("bc-file-input__compact-input"),
|
|
496
|
+
E(
|
|
497
|
+
k.map((v) => v.length > 0),
|
|
498
|
+
() => I.span(
|
|
499
|
+
l.class("bc-file-input__compact-value"),
|
|
500
|
+
dt(
|
|
501
|
+
k,
|
|
502
|
+
(v) => I.span(
|
|
503
|
+
l.class("bc-file-input__compact-value-item"),
|
|
504
|
+
Et(v),
|
|
505
|
+
I.span(
|
|
506
|
+
l.class("bc-file-input__compact-value-item-name"),
|
|
507
|
+
v.$.name
|
|
508
|
+
)
|
|
509
|
+
)
|
|
510
|
+
)
|
|
511
|
+
),
|
|
512
|
+
() => I.span(
|
|
513
|
+
l.class("bc-file-input__compact-placeholder"),
|
|
514
|
+
N({ icon: "mdi:cloud-upload-outline", size: "md" }),
|
|
515
|
+
" ",
|
|
516
|
+
_t($.$.filesInputInstructions)(
|
|
517
|
+
r,
|
|
518
|
+
c,
|
|
519
|
+
$.$.fileSizeUnits.value
|
|
520
|
+
)
|
|
521
|
+
)
|
|
522
|
+
)
|
|
523
|
+
)
|
|
524
|
+
);
|
|
525
|
+
return H(
|
|
526
|
+
W,
|
|
527
|
+
(k) => O(
|
|
528
|
+
{
|
|
529
|
+
baseContainer: p.map(x, ($) => !$),
|
|
530
|
+
disabled: o,
|
|
531
|
+
hasError: u,
|
|
532
|
+
after: E(
|
|
533
|
+
x,
|
|
534
|
+
() => E(
|
|
535
|
+
d.map(({ length: $ }) => $ > 0),
|
|
536
|
+
() => yt(
|
|
537
|
+
{
|
|
538
|
+
size: "sm",
|
|
539
|
+
label: k.$.clearAllFiles,
|
|
540
|
+
disabled: o,
|
|
541
|
+
onClick: b
|
|
542
|
+
},
|
|
543
|
+
l.class("bc-file-input__compact-clear")
|
|
544
|
+
)
|
|
545
|
+
)
|
|
546
|
+
),
|
|
547
|
+
...h,
|
|
548
|
+
input: E(
|
|
549
|
+
x,
|
|
550
|
+
() => I.div(
|
|
551
|
+
l.class("bc-file-input bc-file-input--compact"),
|
|
552
|
+
Lt({
|
|
553
|
+
value: d,
|
|
554
|
+
accept: n,
|
|
555
|
+
enableClick: !0,
|
|
556
|
+
allowMultiple: p.map(r ?? 1 / 0, ($) => $ > 1),
|
|
557
|
+
disabled: o,
|
|
558
|
+
onChange: w,
|
|
559
|
+
content: M
|
|
560
|
+
})
|
|
561
|
+
),
|
|
562
|
+
() => I.div(
|
|
563
|
+
l.class("bc-file-input"),
|
|
564
|
+
Lt({
|
|
565
|
+
value: d,
|
|
566
|
+
accept: n,
|
|
567
|
+
enableClick: !0,
|
|
568
|
+
allowMultiple: p.map(r ?? 1 / 0, ($) => $ > 1),
|
|
569
|
+
disabled: o,
|
|
570
|
+
onChange: w,
|
|
571
|
+
content: m
|
|
572
|
+
}),
|
|
573
|
+
E(
|
|
574
|
+
g,
|
|
575
|
+
() => Qt(
|
|
576
|
+
d,
|
|
577
|
+
() => L(
|
|
578
|
+
I.div(
|
|
579
|
+
l.class("bc-file-input__file-list"),
|
|
580
|
+
dt(d, ($, v) => {
|
|
581
|
+
const y = v.index;
|
|
582
|
+
return I.div(
|
|
583
|
+
l.class("bc-file-input__file-item"),
|
|
584
|
+
I.div(
|
|
585
|
+
l.class("bc-file-input__file-icon"),
|
|
586
|
+
Et($)
|
|
587
|
+
),
|
|
588
|
+
I.div(
|
|
589
|
+
l.class("bc-file-input__file-info"),
|
|
590
|
+
I.div(
|
|
591
|
+
l.class("bc-file-input__file-name"),
|
|
592
|
+
l.title($.$.name),
|
|
593
|
+
$.$.name
|
|
594
|
+
),
|
|
595
|
+
I.div(
|
|
596
|
+
l.class("bc-file-input__file-meta"),
|
|
597
|
+
V(
|
|
598
|
+
$.$.size,
|
|
599
|
+
k.$.fileSizeUnits
|
|
600
|
+
)(
|
|
601
|
+
(D, F) => oe(D, { units: F })
|
|
602
|
+
),
|
|
603
|
+
" • ",
|
|
604
|
+
V(
|
|
605
|
+
$.$.type,
|
|
606
|
+
k.$.unknownType
|
|
607
|
+
)((D, F) => D || F)
|
|
608
|
+
)
|
|
609
|
+
),
|
|
610
|
+
yt(
|
|
611
|
+
{
|
|
612
|
+
size: "sm",
|
|
613
|
+
label: k.$.removeFile,
|
|
614
|
+
disabled: o,
|
|
615
|
+
onClick: () => _(y)
|
|
616
|
+
},
|
|
617
|
+
l.class("bc-file-input__remove-button")
|
|
618
|
+
)
|
|
619
|
+
);
|
|
620
|
+
})
|
|
621
|
+
),
|
|
622
|
+
E(
|
|
623
|
+
d.map(({ length: $ }) => $ > 1),
|
|
624
|
+
() => I.div(
|
|
625
|
+
l.class(
|
|
626
|
+
"bc-file-input__clear-all-button-container"
|
|
627
|
+
),
|
|
628
|
+
I.button(
|
|
629
|
+
l.type("button"),
|
|
630
|
+
l.class("bc-file-input__clear-all-button"),
|
|
631
|
+
l.disabled(o),
|
|
632
|
+
k.$.clearAllFiles,
|
|
633
|
+
C.click(($) => {
|
|
634
|
+
$.preventDefault(), $.stopPropagation(), b();
|
|
635
|
+
})
|
|
636
|
+
)
|
|
637
|
+
)
|
|
638
|
+
)
|
|
639
|
+
)
|
|
640
|
+
)
|
|
641
|
+
)
|
|
642
|
+
)
|
|
643
|
+
)
|
|
644
|
+
},
|
|
645
|
+
...e
|
|
646
|
+
)
|
|
647
|
+
);
|
|
648
|
+
};
|
|
649
|
+
async function Re(t) {
|
|
650
|
+
return new Promise((e, s) => {
|
|
651
|
+
const n = new FileReader();
|
|
652
|
+
n.readAsDataURL(t), n.onload = () => {
|
|
653
|
+
const r = n.result;
|
|
654
|
+
e(r.split(",")[1]);
|
|
655
|
+
}, n.onerror = (r) => s(r);
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
function ze(t) {
|
|
659
|
+
return Promise.all(t.map(Re));
|
|
660
|
+
}
|
|
661
|
+
function Ue(t) {
|
|
662
|
+
if (t.length >= 4) {
|
|
663
|
+
if (t[0] === 137 && t[1] === 80 && t[2] === 78 && t[3] === 71)
|
|
664
|
+
return "image/png";
|
|
665
|
+
if (t[0] === 255 && t[1] === 216) return "image/jpeg";
|
|
666
|
+
if (t[0] === 71 && t[1] === 73 && t[2] === 70)
|
|
667
|
+
return "image/gif";
|
|
668
|
+
if (t[0] === 82 && t[1] === 73 && t[2] === 70 && t[3] === 70 && t.length >= 12 && t[8] === 87 && t[9] === 69 && t[10] === 66 && t[11] === 80)
|
|
669
|
+
return "image/webp";
|
|
670
|
+
}
|
|
671
|
+
try {
|
|
672
|
+
if (new TextDecoder("utf-8").decode(t.slice(0, 256)).includes("<svg")) return "image/svg+xml";
|
|
673
|
+
} catch {
|
|
674
|
+
}
|
|
675
|
+
return "application/octet-stream";
|
|
676
|
+
}
|
|
677
|
+
function Ne(t) {
|
|
678
|
+
const e = Fe(t ?? ""), s = e.length, n = new Uint8Array(s);
|
|
679
|
+
for (let r = 0; r < s; r++) n[r] = e.charCodeAt(r);
|
|
680
|
+
return n;
|
|
681
|
+
}
|
|
682
|
+
function Oe(t) {
|
|
683
|
+
const {
|
|
684
|
+
value: e,
|
|
685
|
+
onChange: s,
|
|
686
|
+
onInput: n,
|
|
687
|
+
...r
|
|
688
|
+
} = t, c = /* @__PURE__ */ new Map(), a = p.toSignal(e).map((f) => f.map((g, h) => {
|
|
689
|
+
const d = c.get(g), x = Ne(g ?? ""), w = d?.type || Ue(x), _ = d?.name ?? `file-${h}`, b = x.buffer.slice(
|
|
690
|
+
x.byteOffset,
|
|
691
|
+
x.byteOffset + x.byteLength
|
|
692
|
+
), m = new Blob([b], { type: w });
|
|
693
|
+
return new File([m], _, { type: w });
|
|
694
|
+
})), i = (f) => (g) => {
|
|
695
|
+
f && ze(g).then((h) => {
|
|
696
|
+
for (const [d, x] of h.entries())
|
|
697
|
+
c.set(x, { name: g[d].name, type: g[d].type });
|
|
698
|
+
f(h);
|
|
699
|
+
});
|
|
700
|
+
}, o = i(s), u = i(n);
|
|
701
|
+
return Ee({
|
|
702
|
+
...r,
|
|
703
|
+
value: a,
|
|
704
|
+
onChange: o,
|
|
705
|
+
onInput: u
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
function yn(t) {
|
|
709
|
+
const {
|
|
710
|
+
value: e,
|
|
711
|
+
onInput: s,
|
|
712
|
+
onChange: n,
|
|
713
|
+
...r
|
|
714
|
+
} = t;
|
|
715
|
+
return Oe({
|
|
716
|
+
...r,
|
|
717
|
+
maxFiles: 1,
|
|
718
|
+
value: p.map(e, (c) => c == null ? [] : [c]),
|
|
719
|
+
onChange: (c) => {
|
|
720
|
+
n?.(c[0]);
|
|
721
|
+
},
|
|
722
|
+
onInput: (c) => {
|
|
723
|
+
s?.(c[0]);
|
|
724
|
+
}
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
function Pe(t, e) {
|
|
728
|
+
const [s, n, r] = t, c = s << 16 ^ n << 8 ^ r, a = ke(c), i = 6 + Math.floor(a() * 5), o = 0.18 + a() * 0.06, u = [];
|
|
729
|
+
for (let d = 0; d < i; d++) {
|
|
730
|
+
const x = d / i * Math.PI * 2, w = e * (1 + (a() * 2 - 1) * o), _ = Math.cos(x) * w, b = Math.sin(x) * w;
|
|
731
|
+
u.push({ x: _, y: b });
|
|
732
|
+
}
|
|
733
|
+
const f = (u[0].x + u[i - 1].x) / 2, g = (u[0].y + u[i - 1].y) / 2;
|
|
734
|
+
let h = `M ${f.toFixed(3)} ${g.toFixed(3)}`;
|
|
735
|
+
for (let d = 0; d < i; d++) {
|
|
736
|
+
const x = u[d], w = u[(d + 1) % i], _ = (x.x + w.x) / 2, b = (x.y + w.y) / 2;
|
|
737
|
+
h += ` Q ${x.x.toFixed(3)} ${x.y.toFixed(3)} ${_.toFixed(3)} ${b.toFixed(3)}`;
|
|
738
|
+
}
|
|
739
|
+
return h += " Z", h;
|
|
740
|
+
}
|
|
741
|
+
const kn = (t) => {
|
|
742
|
+
const { value: e, onBlur: s, onChange: n, onInput: r, displayValue: c, size: a, withAlpha: i } = t, o = p.map(a ?? 32, (v) => v), u = p.map(e, (v) => $e(v ?? "#000000")), f = p.map(
|
|
743
|
+
u,
|
|
744
|
+
([v, y, D]) => [v, y, D]
|
|
745
|
+
), g = p.map(u, ([, , , v]) => v), h = tt(p.get(g) ?? 1), d = p.map(i ?? !1, (v) => v), x = p.map(
|
|
746
|
+
t.colorTextFormat ?? "rgb",
|
|
747
|
+
(v) => v
|
|
748
|
+
), w = V(
|
|
749
|
+
f,
|
|
750
|
+
h,
|
|
751
|
+
x,
|
|
752
|
+
d
|
|
753
|
+
)(
|
|
754
|
+
([v, y, D], F, A, S) => at(v, y, D, F ?? 1, lt(A, S), S)
|
|
755
|
+
), _ = p.map(
|
|
756
|
+
t.colorTextFormat ?? "hex",
|
|
757
|
+
(v) => v
|
|
758
|
+
), b = p.map(o, (v) => `${-v / 2} ${-v / 2} ${v} ${v}`), m = V(
|
|
759
|
+
f,
|
|
760
|
+
o
|
|
761
|
+
)((v, y) => Pe(v, y / 2)), M = V(
|
|
762
|
+
f,
|
|
763
|
+
h,
|
|
764
|
+
d
|
|
765
|
+
)(
|
|
766
|
+
([v, y, D], F, A) => A || F < 1 ? ye(v, y, D, F) : kt(v, y, D)
|
|
767
|
+
), k = I.div(
|
|
768
|
+
l.class("bc-color-swatch-input__control"),
|
|
769
|
+
l.class(
|
|
770
|
+
p.map(
|
|
771
|
+
d,
|
|
772
|
+
(v) => v ? "bc-color-swatch-input__control--alpha" : ""
|
|
773
|
+
)
|
|
774
|
+
),
|
|
775
|
+
l.style(
|
|
776
|
+
V(o)((v) => `min-width:${v + 2}px;height:${v + 2}px`)
|
|
777
|
+
),
|
|
778
|
+
// The SVG blob preview
|
|
779
|
+
Tt.svg(
|
|
780
|
+
l.class("bc-color-swatch-input__svg"),
|
|
781
|
+
ht.viewBox(b),
|
|
782
|
+
Tt.path(ht.d(m), ht.fill(M))
|
|
783
|
+
),
|
|
784
|
+
// Invisible native input overlays the blob for picker and accessibility
|
|
785
|
+
I.input(
|
|
786
|
+
l.type("color"),
|
|
787
|
+
j(t),
|
|
788
|
+
// Native color input needs hex without alpha
|
|
789
|
+
l.value(p.map(f, ([v, y, D]) => kt(v, y, D))),
|
|
790
|
+
l.class(
|
|
791
|
+
"bc-input bc-color-swatch-input bc-color-swatch-input__native"
|
|
792
|
+
),
|
|
793
|
+
s != null ? C.blur(s) : T,
|
|
794
|
+
n != null ? C.change((v) => {
|
|
795
|
+
const y = v.target.value;
|
|
796
|
+
if (!n) return;
|
|
797
|
+
const { r: D, g: F, b: A } = ct(y) ?? { r: 0, g: 0, b: 0 }, S = p.get(h) ?? 1, B = lt(
|
|
798
|
+
p.get(_),
|
|
799
|
+
p.get(d)
|
|
800
|
+
), U = at(D, F, A, S, B, p.get(d));
|
|
801
|
+
n(U);
|
|
802
|
+
}) : T,
|
|
803
|
+
r != null ? C.input((v) => {
|
|
804
|
+
const y = v.target.value;
|
|
805
|
+
if (!r) return;
|
|
806
|
+
const { r: D, g: F, b: A } = ct(y) ?? { r: 0, g: 0, b: 0 }, S = p.get(h) ?? 1, B = lt(
|
|
807
|
+
p.get(_),
|
|
808
|
+
p.get(d)
|
|
809
|
+
), U = at(D, F, A, S, B, p.get(d));
|
|
810
|
+
r(U);
|
|
811
|
+
}) : T
|
|
812
|
+
)
|
|
813
|
+
), $ = E(
|
|
814
|
+
d,
|
|
815
|
+
() => I.input(
|
|
816
|
+
l.type("range"),
|
|
817
|
+
l.class("bc-color-swatch-input__alpha"),
|
|
818
|
+
l.min(0),
|
|
819
|
+
l.max(1),
|
|
820
|
+
l.step(0.01),
|
|
821
|
+
l.value(p.map(h, (v) => String(v ?? 1))),
|
|
822
|
+
l.disabled(t.disabled),
|
|
823
|
+
C.input((v) => {
|
|
824
|
+
const y = parseFloat(v.target.value);
|
|
825
|
+
h.set(y);
|
|
826
|
+
const [D, F, A] = p.get(f), S = lt(
|
|
827
|
+
p.get(_),
|
|
828
|
+
p.get(d)
|
|
829
|
+
), B = at(D, F, A, y, S, p.get(d));
|
|
830
|
+
r?.(B);
|
|
831
|
+
}),
|
|
832
|
+
C.change((v) => {
|
|
833
|
+
const y = parseFloat(v.target.value);
|
|
834
|
+
h.set(y);
|
|
835
|
+
const [D, F, A] = p.get(f), S = lt(
|
|
836
|
+
p.get(_),
|
|
837
|
+
p.get(d)
|
|
838
|
+
), B = at(D, F, A, y, S, p.get(d));
|
|
839
|
+
n?.(B);
|
|
840
|
+
})
|
|
841
|
+
)
|
|
842
|
+
);
|
|
843
|
+
return O({
|
|
844
|
+
baseContainer: !0,
|
|
845
|
+
...t,
|
|
846
|
+
// ensure our control does not try to grow
|
|
847
|
+
growInput: !1,
|
|
848
|
+
input: k,
|
|
849
|
+
// If caller provided an `after`, append RGB before it
|
|
850
|
+
after: L(
|
|
851
|
+
E(
|
|
852
|
+
c ?? !1,
|
|
853
|
+
() => I.span(l.class("bc-color-swatch-input__rgb"), w)
|
|
854
|
+
),
|
|
855
|
+
$,
|
|
856
|
+
t.after
|
|
857
|
+
)
|
|
858
|
+
});
|
|
859
|
+
}, Mt = "$$tts-exp-", je = (t, e) => it((s) => {
|
|
860
|
+
const n = `${Mt}${t}`;
|
|
861
|
+
return Z(p.on(e, (r) => Reflect.set(s, n, r)));
|
|
862
|
+
}), In = (t, e) => {
|
|
863
|
+
const s = `${Mt}${t}`;
|
|
864
|
+
return (n) => {
|
|
865
|
+
e(Reflect.get(n.target, s));
|
|
866
|
+
};
|
|
867
|
+
}, He = (t, e) => {
|
|
868
|
+
const s = `${Mt}${t}`;
|
|
869
|
+
return (n) => {
|
|
870
|
+
const r = n.target, c = r.selectedIndex, a = r.options[c];
|
|
871
|
+
e(Reflect.get(a, s));
|
|
872
|
+
};
|
|
873
|
+
};
|
|
874
|
+
function We(t, e, s) {
|
|
875
|
+
const n = ["bc-card"];
|
|
876
|
+
return t !== "default" && n.push(`bc-card--${t}`), e !== "md" && n.push(`bc-card--padding-${e}`), s !== "lg" && n.push(`bc-card--rounded-${s}`), n.join(" ");
|
|
877
|
+
}
|
|
878
|
+
function Cn({ variant: t = "default", size: e = "md", roundedness: s = "lg" } = {}, ...n) {
|
|
879
|
+
return I.div(
|
|
880
|
+
l.class(
|
|
881
|
+
V(
|
|
882
|
+
t,
|
|
883
|
+
e,
|
|
884
|
+
s
|
|
885
|
+
)(
|
|
886
|
+
(r, c, a) => We(
|
|
887
|
+
r ?? "default",
|
|
888
|
+
c ?? "md",
|
|
889
|
+
a ?? "lg"
|
|
890
|
+
)
|
|
891
|
+
)
|
|
892
|
+
),
|
|
893
|
+
...n
|
|
894
|
+
);
|
|
895
|
+
}
|
|
896
|
+
function pt(...t) {
|
|
897
|
+
return I.div(l.class("bc-group"), ...t);
|
|
898
|
+
}
|
|
899
|
+
const Mn = ({
|
|
900
|
+
startEditing: t,
|
|
901
|
+
value: e,
|
|
902
|
+
onChange: s,
|
|
903
|
+
placeholder: n,
|
|
904
|
+
disabled: r
|
|
905
|
+
}) => {
|
|
906
|
+
const c = p.deriveProp(t ?? !1), a = tt(!1), i = p.map(r ?? !1, (o) => o);
|
|
907
|
+
return I.div(
|
|
908
|
+
l.class("bc-editable-text"),
|
|
909
|
+
l.class(
|
|
910
|
+
p.map(
|
|
911
|
+
i,
|
|
912
|
+
(o) => o ? "bc-editable-text--disabled" : ""
|
|
913
|
+
)
|
|
914
|
+
),
|
|
915
|
+
z.disabled(i),
|
|
916
|
+
E(
|
|
917
|
+
c,
|
|
918
|
+
() => I.input(
|
|
919
|
+
l.placeholder(n),
|
|
920
|
+
l.value(e),
|
|
921
|
+
l.class("bc-editable-text__input"),
|
|
922
|
+
le(),
|
|
923
|
+
C.keydown((o) => {
|
|
924
|
+
o.key === "Enter" ? c.set(!1) : o.key === "Escape" && (a.set(!0), c.set(!1));
|
|
925
|
+
}),
|
|
926
|
+
C.blur(
|
|
927
|
+
P((o) => {
|
|
928
|
+
if (c.set(!1), a.value) {
|
|
929
|
+
a.set(!1);
|
|
930
|
+
return;
|
|
931
|
+
}
|
|
932
|
+
s(o);
|
|
933
|
+
})
|
|
934
|
+
)
|
|
935
|
+
),
|
|
936
|
+
() => I.span(
|
|
937
|
+
C.click(() => {
|
|
938
|
+
p.get(i) || c.set(!0);
|
|
939
|
+
}),
|
|
940
|
+
l.class("bc-editable-text__display"),
|
|
941
|
+
E(
|
|
942
|
+
p.map(e, (o) => o != null && o.trim() !== ""),
|
|
943
|
+
() => I.span(l.class("bc-editable-text__text"), e),
|
|
944
|
+
() => I.span(
|
|
945
|
+
l.class("bc-editable-text__placeholder"),
|
|
946
|
+
n
|
|
947
|
+
)
|
|
948
|
+
),
|
|
949
|
+
E(
|
|
950
|
+
p.map(i, (o) => !o),
|
|
951
|
+
() => I.button(
|
|
952
|
+
l.type("button"),
|
|
953
|
+
l.class("bc-editable-text__edit-button"),
|
|
954
|
+
H(W, (o) => z.label(o.$.editLabel)),
|
|
955
|
+
C.click(() => c.set(!0)),
|
|
956
|
+
N({ icon: "line-md/pencil", color: "neutral" })
|
|
957
|
+
)
|
|
958
|
+
)
|
|
959
|
+
)
|
|
960
|
+
)
|
|
961
|
+
);
|
|
962
|
+
}, Yt = (t, e, s) => Kt(
|
|
963
|
+
t,
|
|
964
|
+
(n) => te(n, {
|
|
965
|
+
value: (r) => {
|
|
966
|
+
const c = V(
|
|
967
|
+
r,
|
|
968
|
+
s
|
|
969
|
+
)((a, i) => e(a.value, i));
|
|
970
|
+
return I.option(
|
|
971
|
+
l.selected(c),
|
|
972
|
+
je("value", r.$.value),
|
|
973
|
+
r.$.label
|
|
974
|
+
);
|
|
975
|
+
},
|
|
976
|
+
group: (r) => I.optgroup(
|
|
977
|
+
l.label(r.$.group),
|
|
978
|
+
dt(
|
|
979
|
+
r.$.options,
|
|
980
|
+
(c) => Yt(
|
|
981
|
+
c,
|
|
982
|
+
e,
|
|
983
|
+
s
|
|
984
|
+
)
|
|
985
|
+
)
|
|
986
|
+
),
|
|
987
|
+
break: () => I.hr()
|
|
988
|
+
})
|
|
989
|
+
), Ze = (t) => {
|
|
990
|
+
const {
|
|
991
|
+
value: e,
|
|
992
|
+
onBlur: s,
|
|
993
|
+
onChange: n,
|
|
994
|
+
options: r,
|
|
995
|
+
unselectedLabel: c,
|
|
996
|
+
equality: a = (u, f) => u === f,
|
|
997
|
+
after: i
|
|
998
|
+
} = t;
|
|
999
|
+
let o;
|
|
1000
|
+
return O(
|
|
1001
|
+
{
|
|
1002
|
+
...t,
|
|
1003
|
+
after: L(
|
|
1004
|
+
ce({
|
|
1005
|
+
icon: "ph:caret-down-bold",
|
|
1006
|
+
color: "neutral",
|
|
1007
|
+
size: "sm"
|
|
1008
|
+
}),
|
|
1009
|
+
i
|
|
1010
|
+
),
|
|
1011
|
+
input: I.select(
|
|
1012
|
+
it((u) => {
|
|
1013
|
+
o = u;
|
|
1014
|
+
const f = new MutationObserver((g) => {
|
|
1015
|
+
const { removedNodes: h } = g[0];
|
|
1016
|
+
h.length > 0 && (o.selectedIndex = 0);
|
|
1017
|
+
});
|
|
1018
|
+
return f.observe(u, { childList: !0 }), Z(() => f.disconnect());
|
|
1019
|
+
}),
|
|
1020
|
+
j(t),
|
|
1021
|
+
l.class("bc-native-select bc-input"),
|
|
1022
|
+
H(
|
|
1023
|
+
W,
|
|
1024
|
+
(u) => I.option(
|
|
1025
|
+
l.hidden("hidden"),
|
|
1026
|
+
Jt(c, u.$.selectOne)
|
|
1027
|
+
)
|
|
1028
|
+
),
|
|
1029
|
+
dt(r, (u) => Yt(u, a, e)),
|
|
1030
|
+
s != null ? C.blur(s) : T,
|
|
1031
|
+
n != null ? C.change(He("value", (u) => n(u))) : T
|
|
1032
|
+
)
|
|
1033
|
+
},
|
|
1034
|
+
C.click(() => {
|
|
1035
|
+
o?.focus(), typeof o?.showPicker == "function" && o.showPicker();
|
|
1036
|
+
})
|
|
1037
|
+
);
|
|
1038
|
+
};
|
|
1039
|
+
function Ye(t) {
|
|
1040
|
+
const { controller: e, onChange: s, onBlur: n, ...r } = t;
|
|
1041
|
+
return Ze({
|
|
1042
|
+
...r,
|
|
1043
|
+
value: e.signal,
|
|
1044
|
+
onChange: me(e, s),
|
|
1045
|
+
onBlur: de(e, n)
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1048
|
+
function Dn(t) {
|
|
1049
|
+
return Ht({
|
|
1050
|
+
...t,
|
|
1051
|
+
content: Ye(t)
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
function Xe(t, e, s) {
|
|
1055
|
+
const n = t.length.map((r) => r);
|
|
1056
|
+
return L(
|
|
1057
|
+
Pt(
|
|
1058
|
+
n,
|
|
1059
|
+
(r) => {
|
|
1060
|
+
const c = t.item(r.index), a = [];
|
|
1061
|
+
return L(
|
|
1062
|
+
Z(() => {
|
|
1063
|
+
a.forEach((i) => i());
|
|
1064
|
+
}),
|
|
1065
|
+
e({
|
|
1066
|
+
list: t,
|
|
1067
|
+
item: c,
|
|
1068
|
+
position: r,
|
|
1069
|
+
remove: () => t.removeAt(r.index),
|
|
1070
|
+
move: (i) => {
|
|
1071
|
+
switch (i) {
|
|
1072
|
+
case "up":
|
|
1073
|
+
if (r.index === 0) return;
|
|
1074
|
+
t.move(r.index, r.index - 1);
|
|
1075
|
+
break;
|
|
1076
|
+
case "down":
|
|
1077
|
+
if (r.index === t.length.value - 1) return;
|
|
1078
|
+
t.move(r.index, r.index + 1);
|
|
1079
|
+
break;
|
|
1080
|
+
case "first":
|
|
1081
|
+
t.move(r.index, 0);
|
|
1082
|
+
break;
|
|
1083
|
+
case "last":
|
|
1084
|
+
t.move(r.index, t.length.value - 1);
|
|
1085
|
+
}
|
|
1086
|
+
},
|
|
1087
|
+
canMove: (i) => {
|
|
1088
|
+
const o = (() => {
|
|
1089
|
+
switch (i) {
|
|
1090
|
+
case "up":
|
|
1091
|
+
return Ft(r.index > 0);
|
|
1092
|
+
case "down":
|
|
1093
|
+
return t.length.map((u) => r.index < u - 1);
|
|
1094
|
+
}
|
|
1095
|
+
})();
|
|
1096
|
+
return a.push(() => o.dispose()), o;
|
|
1097
|
+
},
|
|
1098
|
+
cannotMove: (i) => {
|
|
1099
|
+
const o = (() => {
|
|
1100
|
+
switch (i) {
|
|
1101
|
+
case "up":
|
|
1102
|
+
return Ft(r.index === 0);
|
|
1103
|
+
case "down":
|
|
1104
|
+
return t.length.map((u) => r.index === u - 1);
|
|
1105
|
+
}
|
|
1106
|
+
})();
|
|
1107
|
+
return a.push(() => o.dispose()), o;
|
|
1108
|
+
}
|
|
1109
|
+
})
|
|
1110
|
+
);
|
|
1111
|
+
},
|
|
1112
|
+
s
|
|
1113
|
+
)
|
|
1114
|
+
);
|
|
1115
|
+
}
|
|
1116
|
+
const Rt = {
|
|
1117
|
+
9: { pattern: /^[0-9]$/ },
|
|
1118
|
+
A: { pattern: /^[A-Za-z]$/, transform: (t) => t.toUpperCase() },
|
|
1119
|
+
"*": { pattern: /^.$/ }
|
|
1120
|
+
}, qe = (t) => t instanceof RegExp;
|
|
1121
|
+
function Xt(t, e, s) {
|
|
1122
|
+
if (t == null) return [];
|
|
1123
|
+
const n = s ? { ...Rt, ...e } : e ?? Rt, r = (a, i) => {
|
|
1124
|
+
const o = n[i];
|
|
1125
|
+
o ? a.push({ type: "pattern", name: i, ...o }) : a.push({ type: "literal", char: i });
|
|
1126
|
+
}, c = [];
|
|
1127
|
+
if (typeof t == "string") {
|
|
1128
|
+
for (const a of t) r(c, a);
|
|
1129
|
+
return c;
|
|
1130
|
+
}
|
|
1131
|
+
for (const a of t)
|
|
1132
|
+
if (typeof a == "string")
|
|
1133
|
+
if (a.length <= 1) r(c, a);
|
|
1134
|
+
else for (const i of a) r(c, i);
|
|
1135
|
+
else qe(a) ? c.push({ type: "pattern", pattern: a }) : typeof a == "object" && a && c.push(a);
|
|
1136
|
+
return c;
|
|
1137
|
+
}
|
|
1138
|
+
function Ge(t, e) {
|
|
1139
|
+
return (s) => {
|
|
1140
|
+
switch (t) {
|
|
1141
|
+
case "digits":
|
|
1142
|
+
return /[0-9]/.test(s);
|
|
1143
|
+
case "letters":
|
|
1144
|
+
return /[A-Za-z]/.test(s);
|
|
1145
|
+
case "alphanumeric":
|
|
1146
|
+
return /[A-Za-z0-9]/.test(s);
|
|
1147
|
+
case "custom":
|
|
1148
|
+
return e?.(s) ?? !0;
|
|
1149
|
+
default:
|
|
1150
|
+
return !0;
|
|
1151
|
+
}
|
|
1152
|
+
};
|
|
1153
|
+
}
|
|
1154
|
+
function zt(t, e, s, n, r, c) {
|
|
1155
|
+
const a = {
|
|
1156
|
+
raw: t,
|
|
1157
|
+
previousConformed: e,
|
|
1158
|
+
cursor: r ?? t.length,
|
|
1159
|
+
completed: !1
|
|
1160
|
+
}, i = n.definitions ?? {}, o = typeof s == "function" ? s(t, a) : s, u = Xt(
|
|
1161
|
+
o,
|
|
1162
|
+
i,
|
|
1163
|
+
n.useDefaultDefinitions ?? !0
|
|
1164
|
+
), f = Ge(n.allowMode, n.allow), g = /* @__PURE__ */ new Set();
|
|
1165
|
+
for (const S of u) S.type === "literal" && g.add(S.char);
|
|
1166
|
+
if (n.prefix) for (const S of n.prefix) g.add(S);
|
|
1167
|
+
if (n.suffix) for (const S of n.suffix) g.add(S);
|
|
1168
|
+
const h = Array.from(t).filter((S) => f(S) && !g.has(S));
|
|
1169
|
+
if (h.length === 0) return { value: "", cursor: 0, completed: !1 };
|
|
1170
|
+
const d = [], x = [];
|
|
1171
|
+
let w = 0, _ = 0, b = 0, m = -1;
|
|
1172
|
+
for (const S of u) {
|
|
1173
|
+
if (S.type === "literal") {
|
|
1174
|
+
d.push(S.char), x.push({ kind: "literal", filled: !0 });
|
|
1175
|
+
continue;
|
|
1176
|
+
}
|
|
1177
|
+
_ += S.optional ? 0 : 1;
|
|
1178
|
+
const B = h[w];
|
|
1179
|
+
if (B == null)
|
|
1180
|
+
break;
|
|
1181
|
+
if (S.type === "any") {
|
|
1182
|
+
b++, d.push(S.transform ? S.transform(B) : B), x.push({ kind: "slot", filled: !0 }), m = x.length - 1, w++;
|
|
1183
|
+
continue;
|
|
1184
|
+
}
|
|
1185
|
+
if (S.type === "pattern")
|
|
1186
|
+
if (S.pattern.test(B)) {
|
|
1187
|
+
b++;
|
|
1188
|
+
const U = S.transform ? S.transform(B) : B;
|
|
1189
|
+
d.push(U), x.push({ kind: "slot", filled: !0 }), m = x.length - 1, w++;
|
|
1190
|
+
} else {
|
|
1191
|
+
w++;
|
|
1192
|
+
continue;
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
const M = d.join(""), k = (n.prefix ?? "") + M + (n.suffix ?? "");
|
|
1196
|
+
let v = (n.prefix ?? "").length;
|
|
1197
|
+
if (m >= 0) {
|
|
1198
|
+
let S = m + 1;
|
|
1199
|
+
if ((c?.policy ?? "smart") !== "sticky")
|
|
1200
|
+
for (; S < x.length && x[S].kind === "literal"; ) S++;
|
|
1201
|
+
v += S;
|
|
1202
|
+
}
|
|
1203
|
+
const y = n.completion?.mode === "min" ? (n.completion.minChars ?? 0) <= b : n.completion?.mode === "custom" ? !!n.completion.isComplete?.(k) : _ > 0 && b >= _, D = n.pipe?.(k, { ...a, completed: y });
|
|
1204
|
+
let F, A = v;
|
|
1205
|
+
return D === !1 ? (F = e, A = e.length) : typeof D == "string" ? (F = D, A = D.length) : typeof D == "object" && D ? (F = D.value, A = D.cursor ?? D.value.length) : F = k, { value: F, cursor: A, completed: y };
|
|
1206
|
+
}
|
|
1207
|
+
function Qe(t, e) {
|
|
1208
|
+
const s = e?.strategy ?? "none";
|
|
1209
|
+
return s === "custom" && e?.unmask ? e.unmask(t) : s === "strip" ? t.replace(/[^A-Za-z0-9]/g, "") : t;
|
|
1210
|
+
}
|
|
1211
|
+
const qt = (t) => {
|
|
1212
|
+
const {
|
|
1213
|
+
value: e,
|
|
1214
|
+
onBlur: s,
|
|
1215
|
+
onChange: n,
|
|
1216
|
+
onInput: r,
|
|
1217
|
+
onAccept: c,
|
|
1218
|
+
onComplete: a,
|
|
1219
|
+
mask: i,
|
|
1220
|
+
definitions: o,
|
|
1221
|
+
useDefaultDefinitions: u,
|
|
1222
|
+
extraLiterals: f,
|
|
1223
|
+
prefix: g,
|
|
1224
|
+
suffix: h,
|
|
1225
|
+
autofix: d,
|
|
1226
|
+
pipe: x,
|
|
1227
|
+
completion: w,
|
|
1228
|
+
unmask: _,
|
|
1229
|
+
allowMode: b,
|
|
1230
|
+
allow: m,
|
|
1231
|
+
placeholder: M,
|
|
1232
|
+
placeholderOptions: k
|
|
1233
|
+
} = t, $ = V(
|
|
1234
|
+
e,
|
|
1235
|
+
i,
|
|
1236
|
+
o,
|
|
1237
|
+
u,
|
|
1238
|
+
f,
|
|
1239
|
+
g,
|
|
1240
|
+
h,
|
|
1241
|
+
d,
|
|
1242
|
+
w,
|
|
1243
|
+
_,
|
|
1244
|
+
b,
|
|
1245
|
+
M,
|
|
1246
|
+
k
|
|
1247
|
+
)((y, D, F, A, S, B, U, nt, st, K, q, ut, Y) => D ? zt(y ?? "", "", D, {
|
|
1248
|
+
definitions: F ?? {},
|
|
1249
|
+
useDefaultDefinitions: A ?? !0,
|
|
1250
|
+
extraLiterals: S ?? [],
|
|
1251
|
+
autofix: nt ?? "none",
|
|
1252
|
+
completion: st ?? { mode: "mask" },
|
|
1253
|
+
pipe: x ?? ((R) => R),
|
|
1254
|
+
unmask: K ?? { strategy: "none" },
|
|
1255
|
+
allowMode: q ?? "all",
|
|
1256
|
+
allow: m,
|
|
1257
|
+
prefix: B,
|
|
1258
|
+
suffix: U
|
|
1259
|
+
}).value : y ?? ""), v = (y, D) => {
|
|
1260
|
+
const F = y.value ?? "", A = p.get(e) ?? "", S = i != null ? p.get(i) : null, B = o != null ? p.get(o) : void 0, U = u != null ? p.get(u) : void 0, nt = f != null ? p.get(f) : void 0, st = d != null ? p.get(d) : void 0, K = w != null ? p.get(w) : void 0, q = _ != null ? p.get(_) : void 0, ut = b != null ? p.get(b) : void 0, Y = g != null ? p.get(g) : void 0, R = h != null ? p.get(h) : void 0, {
|
|
1261
|
+
value: G,
|
|
1262
|
+
cursor: mt,
|
|
1263
|
+
completed: Dt
|
|
1264
|
+
} = S ? zt(
|
|
1265
|
+
F,
|
|
1266
|
+
A,
|
|
1267
|
+
S,
|
|
1268
|
+
{
|
|
1269
|
+
definitions: B ?? {},
|
|
1270
|
+
useDefaultDefinitions: U ?? !0,
|
|
1271
|
+
extraLiterals: nt ?? [],
|
|
1272
|
+
autofix: st ?? "none",
|
|
1273
|
+
completion: K ?? { mode: "mask" },
|
|
1274
|
+
pipe: x ?? ((Gt) => Gt),
|
|
1275
|
+
unmask: q ?? { strategy: "none" },
|
|
1276
|
+
allowMode: ut ?? "all",
|
|
1277
|
+
allow: m,
|
|
1278
|
+
prefix: Y,
|
|
1279
|
+
suffix: R
|
|
1280
|
+
},
|
|
1281
|
+
y.selectionStart ?? F.length,
|
|
1282
|
+
t.cursor ? p.get(t.cursor) : void 0
|
|
1283
|
+
) : { value: F, cursor: F.length, completed: !0 };
|
|
1284
|
+
if (G !== F) {
|
|
1285
|
+
y.value = G;
|
|
1286
|
+
try {
|
|
1287
|
+
y.setSelectionRange(mt, mt);
|
|
1288
|
+
} catch {
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
const St = Qe(G, q);
|
|
1292
|
+
c?.({
|
|
1293
|
+
raw: St,
|
|
1294
|
+
conformed: G,
|
|
1295
|
+
completed: Dt,
|
|
1296
|
+
cursor: mt
|
|
1297
|
+
}), D === "input" ? r?.(G) : (n?.(G), Dt && a?.({ raw: St, conformed: G }));
|
|
1298
|
+
};
|
|
1299
|
+
return L(
|
|
1300
|
+
O({
|
|
1301
|
+
...t,
|
|
1302
|
+
input: Q.text(
|
|
1303
|
+
j(t),
|
|
1304
|
+
l.value($),
|
|
1305
|
+
l.class("bc-input"),
|
|
1306
|
+
s != null ? C.blur(s) : T,
|
|
1307
|
+
it(
|
|
1308
|
+
(y) => y instanceof HTMLInputElement ? L(
|
|
1309
|
+
C.input(() => v(y, "input")),
|
|
1310
|
+
C.change(() => v(y, "change")),
|
|
1311
|
+
C.keydown((D) => {
|
|
1312
|
+
if (D.key !== "Backspace" || !(t.cursor ? p.get(t.cursor)?.backspaceRubberBand ?? !0 : !0)) return;
|
|
1313
|
+
const A = y.selectionStart ?? 0, S = y.selectionEnd ?? A;
|
|
1314
|
+
if (A !== S || A <= 0) return;
|
|
1315
|
+
const B = y.value ?? "", U = i != null ? p.get(i) : null;
|
|
1316
|
+
if (!U) return;
|
|
1317
|
+
const nt = o != null ? p.get(o) : void 0, st = u != null ? p.get(u) : !0, K = g != null ? p.get(g) : void 0, q = h != null ? p.get(h) : void 0, ut = Xt(
|
|
1318
|
+
typeof U == "function" ? U(B, {
|
|
1319
|
+
raw: B,
|
|
1320
|
+
previousConformed: B,
|
|
1321
|
+
cursor: A,
|
|
1322
|
+
completed: !1
|
|
1323
|
+
}) : U,
|
|
1324
|
+
nt ?? {},
|
|
1325
|
+
st ?? !0
|
|
1326
|
+
), Y = /* @__PURE__ */ new Set();
|
|
1327
|
+
for (const R of ut)
|
|
1328
|
+
R.type === "literal" && Y.add(R.char);
|
|
1329
|
+
if (K) for (const R of K) Y.add(R);
|
|
1330
|
+
if (q) for (const R of q) Y.add(R);
|
|
1331
|
+
if (Y.has(B[A - 1])) {
|
|
1332
|
+
let R = A - 1;
|
|
1333
|
+
for (; R >= 0 && Y.has(B[R]); ) R--;
|
|
1334
|
+
R >= 0 && (D.preventDefault(), D.stopPropagation(), y.value = B.slice(0, R) + B.slice(R + 1), v(y, "input"));
|
|
1335
|
+
}
|
|
1336
|
+
})
|
|
1337
|
+
) : T
|
|
1338
|
+
)
|
|
1339
|
+
)
|
|
1340
|
+
})
|
|
1341
|
+
);
|
|
1342
|
+
};
|
|
1343
|
+
function J(t, e, s) {
|
|
1344
|
+
const n = p.map(t, (c) => c != null), r = $t.clearValue;
|
|
1345
|
+
return L(
|
|
1346
|
+
Z(() => p.dispose(n)),
|
|
1347
|
+
E(
|
|
1348
|
+
n,
|
|
1349
|
+
() => I.button(
|
|
1350
|
+
l.type("button"),
|
|
1351
|
+
l.class("bc-input-container__reset"),
|
|
1352
|
+
z.label(r),
|
|
1353
|
+
l.title(r),
|
|
1354
|
+
l.disabled(e ?? !1),
|
|
1355
|
+
N({ icon: "mdi:close", size: "sm" }),
|
|
1356
|
+
C.click((c) => {
|
|
1357
|
+
c.preventDefault(), c.stopPropagation(), s?.(null);
|
|
1358
|
+
})
|
|
1359
|
+
)
|
|
1360
|
+
)
|
|
1361
|
+
);
|
|
1362
|
+
}
|
|
1363
|
+
const Sn = (t) => {
|
|
1364
|
+
const { value: e, onBlur: s, onChange: n, after: r, disabled: c } = t, a = J(e, c, n);
|
|
1365
|
+
return O({
|
|
1366
|
+
...t,
|
|
1367
|
+
input: Q.date(
|
|
1368
|
+
j(t),
|
|
1369
|
+
l.valueAsDate(e),
|
|
1370
|
+
l.class("bc-input"),
|
|
1371
|
+
s != null ? C.blur(P(s)) : T,
|
|
1372
|
+
n != null ? C.change(ee(n)) : T
|
|
1373
|
+
),
|
|
1374
|
+
after: r != null ? L(a, r) : a
|
|
1375
|
+
});
|
|
1376
|
+
}, Je = (t) => {
|
|
1377
|
+
const e = t.getFullYear(), s = t.getMonth() + 1, n = t.getDate(), r = t.getHours(), c = t.getMinutes(), a = t.getSeconds();
|
|
1378
|
+
return `${e}-${s.toString().padStart(2, "0")}-${n.toString().padStart(2, "0")}T${r.toString().padStart(2, "0")}:${c.toString().padStart(2, "0")}:${a.toString().padStart(2, "0")}`;
|
|
1379
|
+
}, Tn = (t) => {
|
|
1380
|
+
const { value: e, onBlur: s, onChange: n, after: r, disabled: c } = t, a = p.map(e, (o) => o != null ? Je(o) : null), i = J(e, c, n);
|
|
1381
|
+
return O({
|
|
1382
|
+
...t,
|
|
1383
|
+
input: Q["datetime-local"](
|
|
1384
|
+
j(t),
|
|
1385
|
+
l.value(p.map(a, (o) => o ?? null)),
|
|
1386
|
+
l.class("bc-input"),
|
|
1387
|
+
s != null ? C.blur(P(s)) : T,
|
|
1388
|
+
n != null ? C.change(ne(n)) : T
|
|
1389
|
+
),
|
|
1390
|
+
after: r != null ? L(i, r) : i
|
|
1391
|
+
});
|
|
1392
|
+
}, Ut = (t) => typeof t == "string" && t.trim() === "" ? null : t, Ke = (t) => t ?? "";
|
|
1393
|
+
function et(t) {
|
|
1394
|
+
return (e) => {
|
|
1395
|
+
const { value: s, onBlur: n, onChange: r, onInput: c, after: a, disabled: i, ...o } = e, u = J(s, i, r);
|
|
1396
|
+
return t({
|
|
1397
|
+
...o,
|
|
1398
|
+
disabled: i,
|
|
1399
|
+
value: p.map(s, Ke),
|
|
1400
|
+
onChange: r != null ? (f) => r(Ut(f)) : void 0,
|
|
1401
|
+
onInput: c != null ? (f) => c(Ut(f)) : void 0,
|
|
1402
|
+
onBlur: n,
|
|
1403
|
+
after: a != null ? L(u, a) : u
|
|
1404
|
+
});
|
|
1405
|
+
};
|
|
1406
|
+
}
|
|
1407
|
+
const Fn = et(he), An = et(ie), Vn = et(ge), tn = (t) => {
|
|
1408
|
+
const { value: e, onBlur: s, onChange: n, onInput: r, rows: c } = t;
|
|
1409
|
+
return O({
|
|
1410
|
+
baseContainer: !0,
|
|
1411
|
+
...t,
|
|
1412
|
+
input: I.textarea(
|
|
1413
|
+
l.class(
|
|
1414
|
+
V(t.size ?? "md")(
|
|
1415
|
+
(a) => ue(
|
|
1416
|
+
!1,
|
|
1417
|
+
a ?? "md"
|
|
1418
|
+
)
|
|
1419
|
+
)
|
|
1420
|
+
),
|
|
1421
|
+
j(t),
|
|
1422
|
+
l.rows(c ?? 3),
|
|
1423
|
+
l.value(e),
|
|
1424
|
+
l.class("bc-input"),
|
|
1425
|
+
s != null ? C.blur(P(s)) : T,
|
|
1426
|
+
n != null ? C.change(P(n)) : T,
|
|
1427
|
+
r != null ? C.input(P(r)) : T
|
|
1428
|
+
)
|
|
1429
|
+
});
|
|
1430
|
+
}, Bn = et(
|
|
1431
|
+
tn
|
|
1432
|
+
), Ln = (t) => {
|
|
1433
|
+
const { value: e, step: s, min: n, max: r, onBlur: c, onChange: a, onInput: i, after: o } = t, u = (h) => {
|
|
1434
|
+
const d = n != null ? p.get(n) : void 0, x = r != null ? p.get(r) : void 0;
|
|
1435
|
+
return d != null && h < d ? d : x != null && h > x ? x : h;
|
|
1436
|
+
}, f = s != null ? H(W, (h) => {
|
|
1437
|
+
const d = V(
|
|
1438
|
+
e,
|
|
1439
|
+
n
|
|
1440
|
+
)((b, m) => m == null ? !0 : (b ?? 0) > m), x = V(
|
|
1441
|
+
e,
|
|
1442
|
+
r
|
|
1443
|
+
)((b, m) => m == null ? !0 : (b ?? 0) < m), w = (b) => {
|
|
1444
|
+
const m = p.get(e) ?? 0, M = p.get(s), k = b?.shiftKey ? 10 : 1, $ = m - M * k, v = n != null ? p.get(n) : void 0;
|
|
1445
|
+
if (v != null && $ < v)
|
|
1446
|
+
return;
|
|
1447
|
+
const y = u($);
|
|
1448
|
+
y !== m && a && a(y);
|
|
1449
|
+
}, _ = (b) => {
|
|
1450
|
+
const m = p.get(e) ?? 0, M = p.get(s), k = b?.shiftKey ? 10 : 1, $ = m + M * k, v = r != null ? p.get(r) : void 0;
|
|
1451
|
+
if (v != null && $ > v)
|
|
1452
|
+
return;
|
|
1453
|
+
const y = u($);
|
|
1454
|
+
y !== m && a && a(y);
|
|
1455
|
+
};
|
|
1456
|
+
return ot(
|
|
1457
|
+
l.class("bc-number-input-steppers"),
|
|
1458
|
+
// Increment second
|
|
1459
|
+
I.button(
|
|
1460
|
+
l.type("button"),
|
|
1461
|
+
l.class(
|
|
1462
|
+
"bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"
|
|
1463
|
+
),
|
|
1464
|
+
l.disabled(
|
|
1465
|
+
V(
|
|
1466
|
+
x,
|
|
1467
|
+
t.disabled ?? !1
|
|
1468
|
+
)((b, m) => !b || m)
|
|
1469
|
+
),
|
|
1470
|
+
C.click((b) => _(b)),
|
|
1471
|
+
z.label(h.$.incrementValue),
|
|
1472
|
+
N({ icon: "line-md:plus", size: "xs" })
|
|
1473
|
+
),
|
|
1474
|
+
// Decrement first (matches tests expecting first button to be decrement)
|
|
1475
|
+
I.button(
|
|
1476
|
+
l.type("button"),
|
|
1477
|
+
l.class(
|
|
1478
|
+
"bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"
|
|
1479
|
+
),
|
|
1480
|
+
l.disabled(
|
|
1481
|
+
V(
|
|
1482
|
+
d,
|
|
1483
|
+
t.disabled ?? !1
|
|
1484
|
+
)((b, m) => !b || m)
|
|
1485
|
+
),
|
|
1486
|
+
C.click((b) => w(b)),
|
|
1487
|
+
z.label(h.$.decrementValue),
|
|
1488
|
+
N({ icon: "line-md:minus", size: "xs" })
|
|
1489
|
+
)
|
|
1490
|
+
);
|
|
1491
|
+
}) : null, g = o != null && f != null ? L(f, o) : o ?? f;
|
|
1492
|
+
return O({
|
|
1493
|
+
...t,
|
|
1494
|
+
input: Q.number(
|
|
1495
|
+
n != null ? L(
|
|
1496
|
+
l.min(n),
|
|
1497
|
+
Z(
|
|
1498
|
+
p.on(n, (h) => {
|
|
1499
|
+
h < p.get(e);
|
|
1500
|
+
})
|
|
1501
|
+
)
|
|
1502
|
+
) : T,
|
|
1503
|
+
r != null ? L(
|
|
1504
|
+
l.max(r),
|
|
1505
|
+
Z(
|
|
1506
|
+
p.on(r, (h) => {
|
|
1507
|
+
h > p.get(e);
|
|
1508
|
+
})
|
|
1509
|
+
)
|
|
1510
|
+
) : T,
|
|
1511
|
+
j(t),
|
|
1512
|
+
l.valueAsNumber(e),
|
|
1513
|
+
l.step(s),
|
|
1514
|
+
l.class("bc-input bc-number-input"),
|
|
1515
|
+
c != null ? C.blur(P(c)) : T,
|
|
1516
|
+
a != null ? C.change(X(a)) : T,
|
|
1517
|
+
i != null ? C.input(X(i)) : T,
|
|
1518
|
+
// Add wheel event support when step is defined
|
|
1519
|
+
s != null ? C.wheel((h) => {
|
|
1520
|
+
h.preventDefault();
|
|
1521
|
+
const d = p.get(e) ?? 0, x = p.get(s), w = h.shiftKey ? 10 : 1, _ = h.deltaY < 0 ? x * w : -x * w, b = u(d + _);
|
|
1522
|
+
b !== d && a && a(b);
|
|
1523
|
+
}) : T
|
|
1524
|
+
),
|
|
1525
|
+
after: g
|
|
1526
|
+
});
|
|
1527
|
+
}, Nt = (t) => {
|
|
1528
|
+
if (t == null || t === "") return null;
|
|
1529
|
+
const e = Number(t);
|
|
1530
|
+
return Number.isNaN(e) ? null : e;
|
|
1531
|
+
}, En = (t) => {
|
|
1532
|
+
const { value: e, step: s, min: n, max: r, onBlur: c, onChange: a, onInput: i, after: o } = t, u = (d) => {
|
|
1533
|
+
const x = n != null ? p.get(n) : void 0, w = r != null ? p.get(r) : void 0;
|
|
1534
|
+
return x != null && d < x ? x : w != null && d > w ? w : d;
|
|
1535
|
+
}, f = (() => {
|
|
1536
|
+
if (s == null) return null;
|
|
1537
|
+
const d = V(
|
|
1538
|
+
e,
|
|
1539
|
+
n
|
|
1540
|
+
)((m, M) => {
|
|
1541
|
+
const k = m ?? 0;
|
|
1542
|
+
return M == null ? !0 : k > M;
|
|
1543
|
+
}), x = V(
|
|
1544
|
+
e,
|
|
1545
|
+
r
|
|
1546
|
+
)((m, M) => {
|
|
1547
|
+
const k = m ?? 0;
|
|
1548
|
+
return M == null ? !0 : k < M;
|
|
1549
|
+
}), w = (m) => {
|
|
1550
|
+
const M = p.get(e) ?? 0, k = p.get(s), $ = m?.shiftKey ? 10 : 1, v = M - k * $, y = n != null ? p.get(n) : void 0;
|
|
1551
|
+
if (y != null && v < y) return;
|
|
1552
|
+
const D = u(v);
|
|
1553
|
+
D !== M && a && a(D);
|
|
1554
|
+
}, _ = (m) => {
|
|
1555
|
+
const M = p.get(e) ?? 0, k = p.get(s), $ = m?.shiftKey ? 10 : 1, v = M + k * $, y = r != null ? p.get(r) : void 0;
|
|
1556
|
+
if (y != null && v > y) return;
|
|
1557
|
+
const D = u(v);
|
|
1558
|
+
D !== M && a && a(D);
|
|
1559
|
+
};
|
|
1560
|
+
return ((m, M) => ot(
|
|
1561
|
+
l.class("bc-number-input-steppers"),
|
|
1562
|
+
I.button(
|
|
1563
|
+
l.type("button"),
|
|
1564
|
+
l.class(
|
|
1565
|
+
"bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"
|
|
1566
|
+
),
|
|
1567
|
+
l.disabled(
|
|
1568
|
+
V(
|
|
1569
|
+
x,
|
|
1570
|
+
t.disabled ?? !1
|
|
1571
|
+
)((k, $) => !k || $)
|
|
1572
|
+
),
|
|
1573
|
+
C.click((k) => _(k)),
|
|
1574
|
+
z.label(m),
|
|
1575
|
+
N({ icon: "line-md:plus", size: "xs" })
|
|
1576
|
+
),
|
|
1577
|
+
I.button(
|
|
1578
|
+
l.type("button"),
|
|
1579
|
+
l.class(
|
|
1580
|
+
"bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"
|
|
1581
|
+
),
|
|
1582
|
+
l.disabled(
|
|
1583
|
+
V(
|
|
1584
|
+
d,
|
|
1585
|
+
t.disabled ?? !1
|
|
1586
|
+
)((k, $) => !k || $)
|
|
1587
|
+
),
|
|
1588
|
+
C.click((k) => w(k)),
|
|
1589
|
+
z.label(M),
|
|
1590
|
+
N({ icon: "line-md:minus", size: "xs" })
|
|
1591
|
+
)
|
|
1592
|
+
))(
|
|
1593
|
+
$t.incrementValue,
|
|
1594
|
+
$t.decrementValue
|
|
1595
|
+
);
|
|
1596
|
+
})(), g = J(e, t.disabled, a), h = o != null && f != null ? L(f, g, o) : o != null ? L(g, o) : f != null ? L(f, g) : g;
|
|
1597
|
+
return O({
|
|
1598
|
+
...t,
|
|
1599
|
+
input: Q.number(
|
|
1600
|
+
// min/max attributes and reactive watchers (no forced correction)
|
|
1601
|
+
n != null ? l.min(n) : T,
|
|
1602
|
+
r != null ? l.max(r) : T,
|
|
1603
|
+
j(t),
|
|
1604
|
+
// Represent null as empty string so the field can be cleared
|
|
1605
|
+
l.value(p.map(e, (d) => d == null ? "" : String(d))),
|
|
1606
|
+
l.step(s),
|
|
1607
|
+
l.class("bc-input bc-number-input"),
|
|
1608
|
+
c != null ? C.blur(P(c)) : T,
|
|
1609
|
+
a != null ? C.change(
|
|
1610
|
+
P((d) => {
|
|
1611
|
+
const x = Nt(d);
|
|
1612
|
+
a(x);
|
|
1613
|
+
})
|
|
1614
|
+
) : T,
|
|
1615
|
+
i != null ? C.input(
|
|
1616
|
+
P((d) => {
|
|
1617
|
+
const x = Nt(d);
|
|
1618
|
+
i(x);
|
|
1619
|
+
})
|
|
1620
|
+
) : T,
|
|
1621
|
+
// Wheel support when step is defined
|
|
1622
|
+
s != null ? C.wheel((d) => {
|
|
1623
|
+
d.preventDefault();
|
|
1624
|
+
const x = p.get(e) ?? 0, w = p.get(s), _ = d.shiftKey ? 10 : 1, b = d.deltaY < 0 ? w * _ : -w * _, m = u(x + b);
|
|
1625
|
+
m !== x && a && a(m);
|
|
1626
|
+
}) : T
|
|
1627
|
+
),
|
|
1628
|
+
after: h
|
|
1629
|
+
});
|
|
1630
|
+
}, Rn = ({
|
|
1631
|
+
value: t,
|
|
1632
|
+
onChange: e,
|
|
1633
|
+
onInput: s,
|
|
1634
|
+
onBlur: n,
|
|
1635
|
+
offLabel: r,
|
|
1636
|
+
onLabel: c,
|
|
1637
|
+
disabled: a = !1,
|
|
1638
|
+
size: i = "md",
|
|
1639
|
+
id: o,
|
|
1640
|
+
color: u = "primary",
|
|
1641
|
+
tabIndex: f = 0
|
|
1642
|
+
}) => {
|
|
1643
|
+
const g = o ?? be("switch");
|
|
1644
|
+
function h(_, b) {
|
|
1645
|
+
const m = [
|
|
1646
|
+
"bc-switch",
|
|
1647
|
+
`bc-switch--size-${b}`,
|
|
1648
|
+
`bc-switch--${b}`
|
|
1649
|
+
];
|
|
1650
|
+
return _ && m.push("bc-switch--disabled"), m.join(" ");
|
|
1651
|
+
}
|
|
1652
|
+
function d(_) {
|
|
1653
|
+
const b = _ ?? "primary", m = /* @__PURE__ */ new Map(), M = Vt(b, "solid", "light"), k = Vt(b, "solid", "dark");
|
|
1654
|
+
return m.set("--switch-track-on-bg", M.backgroundColor), m.set("--switch-track-on-label", M.textColor), m.set("--switch-track-on-bg-dark", k.backgroundColor), m.set("--switch-track-on-label-dark", k.textColor), m.set(
|
|
1655
|
+
"--switch-track-on-border-dark",
|
|
1656
|
+
fe(b, "dark")
|
|
1657
|
+
), Array.from(m.entries()).map(([$, v]) => `${$}: ${v}`).join("; ");
|
|
1658
|
+
}
|
|
1659
|
+
const x = () => {
|
|
1660
|
+
p.get(a) || (e?.(!p.get(t)), s?.(!p.get(t)));
|
|
1661
|
+
}, w = (_) => {
|
|
1662
|
+
p.get(a) || (_.key === " " || _.key === "Enter") && (_.preventDefault(), x());
|
|
1663
|
+
};
|
|
1664
|
+
return I.div(
|
|
1665
|
+
l.class(
|
|
1666
|
+
V(
|
|
1667
|
+
a ?? !1,
|
|
1668
|
+
i
|
|
1669
|
+
)(
|
|
1670
|
+
(_, b) => h(_ ?? !1, b ?? "md")
|
|
1671
|
+
)
|
|
1672
|
+
),
|
|
1673
|
+
l.style(
|
|
1674
|
+
V(u)(
|
|
1675
|
+
(_) => d(_)
|
|
1676
|
+
)
|
|
1677
|
+
),
|
|
1678
|
+
l.id(g),
|
|
1679
|
+
l.role("switch"),
|
|
1680
|
+
l.tabindex(
|
|
1681
|
+
V(
|
|
1682
|
+
a ?? !1,
|
|
1683
|
+
f
|
|
1684
|
+
)((_, b) => _ ? -1 : b ?? 0)
|
|
1685
|
+
),
|
|
1686
|
+
z.checked(t),
|
|
1687
|
+
z.disabled(a),
|
|
1688
|
+
C.click(x),
|
|
1689
|
+
C.keydown(w),
|
|
1690
|
+
n != null ? C.blur(n) : null,
|
|
1691
|
+
I.div(
|
|
1692
|
+
l.class("bc-switch__track"),
|
|
1693
|
+
l.class(
|
|
1694
|
+
p.map(
|
|
1695
|
+
t,
|
|
1696
|
+
(_) => _ ? "bc-switch__track--on" : "bc-switch__track--off"
|
|
1697
|
+
)
|
|
1698
|
+
),
|
|
1699
|
+
r != null ? I.div(
|
|
1700
|
+
z.hidden(!0),
|
|
1701
|
+
l.class("bc-switch__track-label bc-switch__track-label--off"),
|
|
1702
|
+
l.class(
|
|
1703
|
+
p.map(
|
|
1704
|
+
t,
|
|
1705
|
+
(_) => _ ? "bc-switch__track-label--hidden" : "bc-switch__track-label--visible"
|
|
1706
|
+
)
|
|
1707
|
+
),
|
|
1708
|
+
r
|
|
1709
|
+
) : null,
|
|
1710
|
+
c != null ? I.div(
|
|
1711
|
+
l.class("bc-switch__track-label bc-switch__track-label--on"),
|
|
1712
|
+
l.class(
|
|
1713
|
+
p.map(
|
|
1714
|
+
t,
|
|
1715
|
+
(_) => _ ? "bc-switch__track-label--visible" : "bc-switch__track-label--hidden"
|
|
1716
|
+
)
|
|
1717
|
+
),
|
|
1718
|
+
c
|
|
1719
|
+
) : null,
|
|
1720
|
+
jt(
|
|
1721
|
+
(_) => H(
|
|
1722
|
+
pe,
|
|
1723
|
+
({ direction: b }) => I.div(
|
|
1724
|
+
l.class("bc-switch__thumb"),
|
|
1725
|
+
l.class(
|
|
1726
|
+
p.map(
|
|
1727
|
+
t,
|
|
1728
|
+
(m) => m ? "bc-switch__thumb--on" : "bc-switch__thumb--off"
|
|
1729
|
+
)
|
|
1730
|
+
),
|
|
1731
|
+
ft.transform(
|
|
1732
|
+
V(
|
|
1733
|
+
t,
|
|
1734
|
+
_,
|
|
1735
|
+
i,
|
|
1736
|
+
b
|
|
1737
|
+
)((m, { width: M }, k, $) => {
|
|
1738
|
+
const v = (() => {
|
|
1739
|
+
switch (k) {
|
|
1740
|
+
case "xs":
|
|
1741
|
+
return 5;
|
|
1742
|
+
case "sm":
|
|
1743
|
+
return 5.5;
|
|
1744
|
+
case "md":
|
|
1745
|
+
return 6;
|
|
1746
|
+
case "lg":
|
|
1747
|
+
return 7;
|
|
1748
|
+
case "xl":
|
|
1749
|
+
return 8;
|
|
1750
|
+
}
|
|
1751
|
+
})(), y = $ === "rtl" ? `calc((var(--spacing-base) * ${v}) - ${M}px)` : `calc(${M}px - (var(--spacing-base) * ${v}))`;
|
|
1752
|
+
return m ? `translateX(${y})` : "translateX(0)";
|
|
1753
|
+
})
|
|
1754
|
+
)
|
|
1755
|
+
)
|
|
1756
|
+
)
|
|
1757
|
+
)
|
|
1758
|
+
)
|
|
1759
|
+
);
|
|
1760
|
+
}, en = (t) => {
|
|
1761
|
+
const e = {
|
|
1762
|
+
type: "pattern",
|
|
1763
|
+
pattern: /[0-9A-Fa-f]/,
|
|
1764
|
+
transform: (n) => n.toLowerCase()
|
|
1765
|
+
};
|
|
1766
|
+
return qt({
|
|
1767
|
+
...t,
|
|
1768
|
+
mask: [
|
|
1769
|
+
e,
|
|
1770
|
+
e,
|
|
1771
|
+
e,
|
|
1772
|
+
e,
|
|
1773
|
+
e,
|
|
1774
|
+
e,
|
|
1775
|
+
e,
|
|
1776
|
+
e,
|
|
1777
|
+
"-",
|
|
1778
|
+
e,
|
|
1779
|
+
e,
|
|
1780
|
+
e,
|
|
1781
|
+
e,
|
|
1782
|
+
"-",
|
|
1783
|
+
e,
|
|
1784
|
+
e,
|
|
1785
|
+
e,
|
|
1786
|
+
e,
|
|
1787
|
+
"-",
|
|
1788
|
+
e,
|
|
1789
|
+
e,
|
|
1790
|
+
e,
|
|
1791
|
+
e,
|
|
1792
|
+
"-",
|
|
1793
|
+
e,
|
|
1794
|
+
e,
|
|
1795
|
+
e,
|
|
1796
|
+
e,
|
|
1797
|
+
e,
|
|
1798
|
+
e,
|
|
1799
|
+
e,
|
|
1800
|
+
e,
|
|
1801
|
+
e,
|
|
1802
|
+
e,
|
|
1803
|
+
e,
|
|
1804
|
+
e
|
|
1805
|
+
],
|
|
1806
|
+
// Sensible default placeholder; can be overridden via options.placeholder
|
|
1807
|
+
placeholder: t.placeholder ?? "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
1808
|
+
});
|
|
1809
|
+
}, zn = et(en), nn = "line-md:star-alt-filled", sn = "line-md:star-alt", rn = (t) => {
|
|
1810
|
+
const {
|
|
1811
|
+
value: e,
|
|
1812
|
+
onChange: s,
|
|
1813
|
+
disabled: n,
|
|
1814
|
+
max: r = 5,
|
|
1815
|
+
fullColor: c = "yellow",
|
|
1816
|
+
emptyColor: a = "neutral",
|
|
1817
|
+
fullIcon: i = nn,
|
|
1818
|
+
emptyIcon: o = sn,
|
|
1819
|
+
size: u = "md",
|
|
1820
|
+
onBlur: f,
|
|
1821
|
+
rounding: g = 1
|
|
1822
|
+
} = t, h = () => {
|
|
1823
|
+
const m = p.get(g);
|
|
1824
|
+
return m > 0 ? m : 1;
|
|
1825
|
+
}, d = (m) => Math.min(Math.max(m, 0), p.get(r)), x = (m, M) => {
|
|
1826
|
+
if (p.get(n ?? !1)) return;
|
|
1827
|
+
const $ = m.currentTarget.getBoundingClientRect(), v = (m.clientX - $.left) / $.width, y = M - 1 + v, D = h(), F = Math.ceil(y / D) * D, A = d(F);
|
|
1828
|
+
s?.(A);
|
|
1829
|
+
}, w = (m) => {
|
|
1830
|
+
if (p.get(n ?? !1)) return;
|
|
1831
|
+
const M = h(), k = p.get(e) ?? 0;
|
|
1832
|
+
let $;
|
|
1833
|
+
switch (m.key) {
|
|
1834
|
+
case "ArrowRight":
|
|
1835
|
+
case "ArrowUp":
|
|
1836
|
+
$ = d(k + M);
|
|
1837
|
+
break;
|
|
1838
|
+
case "ArrowLeft":
|
|
1839
|
+
case "ArrowDown":
|
|
1840
|
+
$ = d(k - M);
|
|
1841
|
+
break;
|
|
1842
|
+
case "Home":
|
|
1843
|
+
$ = 0;
|
|
1844
|
+
break;
|
|
1845
|
+
case "End":
|
|
1846
|
+
$ = p.get(r);
|
|
1847
|
+
break;
|
|
1848
|
+
default:
|
|
1849
|
+
return;
|
|
1850
|
+
}
|
|
1851
|
+
m.preventDefault(), s?.($);
|
|
1852
|
+
}, _ = p.map(u, (m) => `bc-icon--${m}`), b = ({ index: m, counter: M }) => I.span(
|
|
1853
|
+
l.class("bc-rating-input__icon-container"),
|
|
1854
|
+
l.class(_),
|
|
1855
|
+
N(
|
|
1856
|
+
{ icon: o, size: u, color: a, tone: "soft" },
|
|
1857
|
+
l.class("bc-rating-input__icon-empty")
|
|
1858
|
+
),
|
|
1859
|
+
I.span(
|
|
1860
|
+
l.class("bc-rating-input__icon-clipper"),
|
|
1861
|
+
l.class(_),
|
|
1862
|
+
ft.width(
|
|
1863
|
+
p.map(e, (k) => {
|
|
1864
|
+
const $ = Math.floor(k);
|
|
1865
|
+
return $ > m ? "100%" : $ < m ? "0%" : `${(k - m) * 100}%`;
|
|
1866
|
+
})
|
|
1867
|
+
),
|
|
1868
|
+
N(
|
|
1869
|
+
{ icon: i, size: u, color: c, tone: "soft" },
|
|
1870
|
+
l.class("bc-rating-input__icon-full")
|
|
1871
|
+
)
|
|
1872
|
+
),
|
|
1873
|
+
C.click(
|
|
1874
|
+
se((k) => x(k, M), {
|
|
1875
|
+
preventDefault: !0,
|
|
1876
|
+
stopPropagation: !0
|
|
1877
|
+
})
|
|
1878
|
+
)
|
|
1879
|
+
);
|
|
1880
|
+
return O({
|
|
1881
|
+
baseContainer: !0,
|
|
1882
|
+
growInput: !1,
|
|
1883
|
+
focusableSelector: '[role="slider"]',
|
|
1884
|
+
...t,
|
|
1885
|
+
input: I.div(
|
|
1886
|
+
// Common input attributes (id, required, invalid, custom classes, etc.)
|
|
1887
|
+
j(t),
|
|
1888
|
+
l.class("bc-rating-input"),
|
|
1889
|
+
// ARIA slider semantics
|
|
1890
|
+
l.role("slider"),
|
|
1891
|
+
l.tabindex(p.map(n ?? !1, (m) => m ? -1 : 0)),
|
|
1892
|
+
z.disabled(n ?? !1),
|
|
1893
|
+
z.valuemin(0),
|
|
1894
|
+
z.valuemax(p.map(r, (m) => m ?? 0)),
|
|
1895
|
+
z.valuenow(p.map(e, (m) => m ?? 0)),
|
|
1896
|
+
z.valuetext(
|
|
1897
|
+
V(
|
|
1898
|
+
e,
|
|
1899
|
+
r
|
|
1900
|
+
)((m, M) => {
|
|
1901
|
+
const k = m ?? 0, $ = M ?? 0;
|
|
1902
|
+
return `${String(k)} / ${String($)}`;
|
|
1903
|
+
})
|
|
1904
|
+
),
|
|
1905
|
+
// Keyboard & focus handlers
|
|
1906
|
+
C.keydown(w),
|
|
1907
|
+
f != null ? C.blur(f) : null,
|
|
1908
|
+
Pt(r, b)
|
|
1909
|
+
)
|
|
1910
|
+
});
|
|
1911
|
+
}, Un = (t) => {
|
|
1912
|
+
const { value: e, onChange: s, onBlur: n, after: r, disabled: c, ...a } = t, i = J(e, c, s);
|
|
1913
|
+
return rn({
|
|
1914
|
+
...a,
|
|
1915
|
+
// Map null -> 0 for display so the control shows as empty when null
|
|
1916
|
+
value: p.map(e, (o) => o ?? 0),
|
|
1917
|
+
// Pass through numeric changes; clear button will call onChange(null)
|
|
1918
|
+
onChange: s,
|
|
1919
|
+
onBlur: n,
|
|
1920
|
+
after: r != null ? L(i, r) : i
|
|
1921
|
+
});
|
|
1922
|
+
}, Nn = (t) => {
|
|
1923
|
+
const { value: e, step: s, min: n, max: r, onBlur: c, onChange: a, onInput: i } = t;
|
|
1924
|
+
return O({
|
|
1925
|
+
...t,
|
|
1926
|
+
// Make sure clicks anywhere focus the range input
|
|
1927
|
+
focusableSelector: 'input[type="range"]',
|
|
1928
|
+
input: I.input(
|
|
1929
|
+
l.type("range"),
|
|
1930
|
+
j(t),
|
|
1931
|
+
l.min(n),
|
|
1932
|
+
l.max(r),
|
|
1933
|
+
l.step(s),
|
|
1934
|
+
// Using value as number to keep it in sync
|
|
1935
|
+
l.valueAsNumber(e),
|
|
1936
|
+
l.class("bc-input bc-slider-input"),
|
|
1937
|
+
c != null ? C.blur(X(c)) : T,
|
|
1938
|
+
a != null ? C.change(X(a)) : T,
|
|
1939
|
+
i != null ? C.input(X(i)) : T
|
|
1940
|
+
)
|
|
1941
|
+
});
|
|
1942
|
+
}, On = (t) => {
|
|
1943
|
+
const { value: e, step: s, min: n, max: r, onBlur: c, onChange: a, onInput: i } = t, o = p.map(e, (f) => {
|
|
1944
|
+
if (f != null) return f;
|
|
1945
|
+
const g = n != null ? p.get(n) : void 0;
|
|
1946
|
+
return typeof g == "number" ? g : 0;
|
|
1947
|
+
}), u = J(e, t.disabled, (f) => {
|
|
1948
|
+
a?.(f);
|
|
1949
|
+
});
|
|
1950
|
+
return O(
|
|
1951
|
+
{
|
|
1952
|
+
...t,
|
|
1953
|
+
focusableSelector: 'input[type="range"]',
|
|
1954
|
+
after: u,
|
|
1955
|
+
input: I.input(
|
|
1956
|
+
l.type("range"),
|
|
1957
|
+
j(t),
|
|
1958
|
+
l.min(n),
|
|
1959
|
+
l.max(r),
|
|
1960
|
+
l.step(s),
|
|
1961
|
+
l.valueAsNumber(o),
|
|
1962
|
+
l.class("bc-input bc-slider-input"),
|
|
1963
|
+
c != null ? C.blur(X(c)) : T,
|
|
1964
|
+
a != null ? C.change(
|
|
1965
|
+
X((f) => {
|
|
1966
|
+
a(f);
|
|
1967
|
+
})
|
|
1968
|
+
) : T,
|
|
1969
|
+
i != null ? C.input(
|
|
1970
|
+
X((f) => {
|
|
1971
|
+
i(f);
|
|
1972
|
+
})
|
|
1973
|
+
) : T
|
|
1974
|
+
)
|
|
1975
|
+
},
|
|
1976
|
+
// Ensure container grows input naturally
|
|
1977
|
+
L()
|
|
1978
|
+
);
|
|
1979
|
+
};
|
|
1980
|
+
let wt = null;
|
|
1981
|
+
async function Ct() {
|
|
1982
|
+
const t = globalThis;
|
|
1983
|
+
return t.Temporal ? t.Temporal : (wt || (wt = import("./index.esm-DPNh6inz.js").then((e) => {
|
|
1984
|
+
const s = e.Temporal;
|
|
1985
|
+
return t.Temporal || (t.Temporal = s), s;
|
|
1986
|
+
})), wt);
|
|
1987
|
+
}
|
|
1988
|
+
const an = (t, e) => e ? At(Ct, {
|
|
1989
|
+
then: t,
|
|
1990
|
+
pending: e.pending,
|
|
1991
|
+
error: e.error
|
|
1992
|
+
}) : At(Ct, t), ln = /^P(\d+([YMWD]|$)){0,4}(T(\d+([HMS]|$)){0,3})?$/i, on = /^P(?:(\d+Y)?(\d+M)?(\d+W)?(\d+D)?)(T(\d+H)?(\d+M)?(\d+S)?)?$/i;
|
|
1993
|
+
function cn(t) {
|
|
1994
|
+
return {
|
|
1995
|
+
mask: null,
|
|
1996
|
+
allowMode: "custom",
|
|
1997
|
+
allow: (e) => /[0-9ptwdhms]/i.test(e),
|
|
1998
|
+
pipe: (e) => {
|
|
1999
|
+
const s = e.toUpperCase();
|
|
2000
|
+
return s.length === 0 ? s : !s.startsWith("P") || !ln.test(s) ? !1 : s;
|
|
2001
|
+
},
|
|
2002
|
+
completion: {
|
|
2003
|
+
mode: "custom",
|
|
2004
|
+
isComplete: (e) => {
|
|
2005
|
+
const s = e.toUpperCase();
|
|
2006
|
+
if (!on.test(s)) return !1;
|
|
2007
|
+
try {
|
|
2008
|
+
return t(s), !0;
|
|
2009
|
+
} catch {
|
|
2010
|
+
return !1;
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
2014
|
+
};
|
|
2015
|
+
}
|
|
2016
|
+
const Ot = (t, e) => {
|
|
2017
|
+
if (t == null) return null;
|
|
2018
|
+
try {
|
|
2019
|
+
return t.Duration.from(e);
|
|
2020
|
+
} catch {
|
|
2021
|
+
return null;
|
|
2022
|
+
}
|
|
2023
|
+
}, Pn = (t) => {
|
|
2024
|
+
const { value: e, onChange: s, after: n, disabled: r, onBlur: c } = t, a = () => {
|
|
2025
|
+
const u = J(e, r, s);
|
|
2026
|
+
return n != null ? L(u, n) : u;
|
|
2027
|
+
}, i = t.placeholder != null ? T : l.placeholder("P0DT0H0M0S");
|
|
2028
|
+
return an(
|
|
2029
|
+
(u) => qt({
|
|
2030
|
+
...t,
|
|
2031
|
+
value: p.map(e, (f) => f?.toString() ?? ""),
|
|
2032
|
+
onChange: s ? (f) => s(f === "" ? null : u.Duration.from(f)) : void 0,
|
|
2033
|
+
onInput: void 0,
|
|
2034
|
+
...cn(u.Duration.from),
|
|
2035
|
+
placeholder: "P0DT0H0M0S",
|
|
2036
|
+
after: a()
|
|
2037
|
+
}),
|
|
2038
|
+
{ pending: () => O({
|
|
2039
|
+
...t,
|
|
2040
|
+
input: Q.text(
|
|
2041
|
+
j(t),
|
|
2042
|
+
l.value(p.map(e, (u) => u?.toString() ?? "")),
|
|
2043
|
+
l.class("bc-input"),
|
|
2044
|
+
i,
|
|
2045
|
+
c != null ? C.blur(() => c()) : T,
|
|
2046
|
+
s != null ? C.change((u) => {
|
|
2047
|
+
const g = u.currentTarget?.value ?? "";
|
|
2048
|
+
if (g === "") {
|
|
2049
|
+
s(null);
|
|
2050
|
+
return;
|
|
2051
|
+
}
|
|
2052
|
+
const h = globalThis.Temporal, d = Ot(h, g);
|
|
2053
|
+
if (d != null) {
|
|
2054
|
+
s(d);
|
|
2055
|
+
return;
|
|
2056
|
+
}
|
|
2057
|
+
Ct().then((x) => {
|
|
2058
|
+
const w = Ot(x, g);
|
|
2059
|
+
w != null && s(w);
|
|
2060
|
+
}).catch(() => {
|
|
2061
|
+
});
|
|
2062
|
+
}) : T
|
|
2063
|
+
),
|
|
2064
|
+
after: a()
|
|
2065
|
+
}) }
|
|
2066
|
+
);
|
|
2067
|
+
}, un = (t) => {
|
|
2068
|
+
const { value: e, onBlur: s, onChange: n, onInput: r } = t;
|
|
2069
|
+
return O({
|
|
2070
|
+
...t,
|
|
2071
|
+
input: Q.url(
|
|
2072
|
+
j(t),
|
|
2073
|
+
l.value(e),
|
|
2074
|
+
l.class("bc-input"),
|
|
2075
|
+
s != null ? C.blur(P(s)) : T,
|
|
2076
|
+
n != null ? C.change(P(n)) : T,
|
|
2077
|
+
r != null ? C.input(P(r)) : T
|
|
2078
|
+
)
|
|
2079
|
+
});
|
|
2080
|
+
}, jn = et(un), pn = (t) => {
|
|
2081
|
+
const {
|
|
2082
|
+
controller: e,
|
|
2083
|
+
element: s,
|
|
2084
|
+
separator: n,
|
|
2085
|
+
showMove: r = !0,
|
|
2086
|
+
showRemove: c = !0,
|
|
2087
|
+
showAdd: a = !0,
|
|
2088
|
+
createItem: i,
|
|
2089
|
+
addLabel: o,
|
|
2090
|
+
controlsLayout: u = "aside",
|
|
2091
|
+
removeDisabled: f,
|
|
2092
|
+
addDisabled: g
|
|
2093
|
+
} = t, h = p.toSignal(u).map((w) => w === "aside"), d = (w) => {
|
|
2094
|
+
const _ = E(
|
|
2095
|
+
r ?? !1,
|
|
2096
|
+
() => I.div(
|
|
2097
|
+
l.class("bc-group--align-center"),
|
|
2098
|
+
l.class(
|
|
2099
|
+
h.map(
|
|
2100
|
+
(m) => m ? "bc-group--direction-column bc-group--gap-1" : "bc-group--direction-row bc-group--gap-1"
|
|
2101
|
+
)
|
|
2102
|
+
),
|
|
2103
|
+
gt(
|
|
2104
|
+
{
|
|
2105
|
+
size: "xs",
|
|
2106
|
+
roundedness: "full",
|
|
2107
|
+
variant: "text",
|
|
2108
|
+
onClick: () => w.move("up"),
|
|
2109
|
+
disabled: w.cannotMove("up")
|
|
2110
|
+
},
|
|
2111
|
+
H(
|
|
2112
|
+
W,
|
|
2113
|
+
(m) => N({
|
|
2114
|
+
size: "xs",
|
|
2115
|
+
icon: "line-md:arrow-up",
|
|
2116
|
+
title: m.$.incrementValue
|
|
2117
|
+
})
|
|
2118
|
+
)
|
|
2119
|
+
),
|
|
2120
|
+
gt(
|
|
2121
|
+
{
|
|
2122
|
+
size: "xs",
|
|
2123
|
+
roundedness: "full",
|
|
2124
|
+
variant: "text",
|
|
2125
|
+
onClick: () => w.move("down"),
|
|
2126
|
+
disabled: w.cannotMove("down")
|
|
2127
|
+
},
|
|
2128
|
+
H(
|
|
2129
|
+
W,
|
|
2130
|
+
(m) => N({
|
|
2131
|
+
size: "xs",
|
|
2132
|
+
icon: "line-md:arrow-down",
|
|
2133
|
+
title: m.$.decrementValue
|
|
2134
|
+
})
|
|
2135
|
+
)
|
|
2136
|
+
)
|
|
2137
|
+
)
|
|
2138
|
+
), b = E(
|
|
2139
|
+
c,
|
|
2140
|
+
() => H(
|
|
2141
|
+
W,
|
|
2142
|
+
(m) => yt({
|
|
2143
|
+
size: "xs",
|
|
2144
|
+
// Use a lowercase label to satisfy tests that query with [aria-label*="remove"]
|
|
2145
|
+
label: p.map(m.$.removeItem, (M) => M.toLowerCase()),
|
|
2146
|
+
color: "danger",
|
|
2147
|
+
disabled: f,
|
|
2148
|
+
onClick: w.remove
|
|
2149
|
+
})
|
|
2150
|
+
)
|
|
2151
|
+
);
|
|
2152
|
+
return (m) => E(
|
|
2153
|
+
h,
|
|
2154
|
+
() => pt(
|
|
2155
|
+
l.class("bc-group--gap-1 bc-group--align-center"),
|
|
2156
|
+
ot(l.class("bc-stack--grow"), m),
|
|
2157
|
+
ot(
|
|
2158
|
+
l.class("bc-stack--align-center"),
|
|
2159
|
+
E(
|
|
2160
|
+
e.signal.map((M) => M.length > 1),
|
|
2161
|
+
() => _
|
|
2162
|
+
),
|
|
2163
|
+
b
|
|
2164
|
+
)
|
|
2165
|
+
),
|
|
2166
|
+
() => ot(
|
|
2167
|
+
l.class("bc-stack--gap-2"),
|
|
2168
|
+
m,
|
|
2169
|
+
pt(
|
|
2170
|
+
l.class("bc-group--gap-2 bc-group--justify-between"),
|
|
2171
|
+
E(
|
|
2172
|
+
e.signal.map((M) => M.length > 1),
|
|
2173
|
+
() => _,
|
|
2174
|
+
() => I.div()
|
|
2175
|
+
),
|
|
2176
|
+
b
|
|
2177
|
+
)
|
|
2178
|
+
)
|
|
2179
|
+
);
|
|
2180
|
+
}, x = E(
|
|
2181
|
+
V(a, i)((w, _) => w && _ != null),
|
|
2182
|
+
() => pt(
|
|
2183
|
+
l.class(
|
|
2184
|
+
"bc-group--gap-2 bc-group--align-center bc-group--justify-center"
|
|
2185
|
+
),
|
|
2186
|
+
gt(
|
|
2187
|
+
{
|
|
2188
|
+
size: "sm",
|
|
2189
|
+
variant: "filled",
|
|
2190
|
+
onClick: () => e.push(i()),
|
|
2191
|
+
disabled: V(
|
|
2192
|
+
e.disabled,
|
|
2193
|
+
g ?? !1
|
|
2194
|
+
)(
|
|
2195
|
+
(w, _) => w || _
|
|
2196
|
+
)
|
|
2197
|
+
},
|
|
2198
|
+
H(
|
|
2199
|
+
W,
|
|
2200
|
+
(w) => pt(
|
|
2201
|
+
l.class("bc-group--gap-2"),
|
|
2202
|
+
N({ icon: "line-md:plus" }),
|
|
2203
|
+
o ?? w.$.addLabel
|
|
2204
|
+
)
|
|
2205
|
+
)
|
|
2206
|
+
)
|
|
2207
|
+
)
|
|
2208
|
+
);
|
|
2209
|
+
return L(
|
|
2210
|
+
Xe(
|
|
2211
|
+
e,
|
|
2212
|
+
(w) => d(w)(s(w)),
|
|
2213
|
+
n
|
|
2214
|
+
),
|
|
2215
|
+
x
|
|
2216
|
+
);
|
|
2217
|
+
}, Hn = (t, ...e) => {
|
|
2218
|
+
const {
|
|
2219
|
+
controller: s,
|
|
2220
|
+
element: n,
|
|
2221
|
+
separator: r,
|
|
2222
|
+
showMove: c,
|
|
2223
|
+
showRemove: a,
|
|
2224
|
+
showAdd: i,
|
|
2225
|
+
createItem: o,
|
|
2226
|
+
addLabel: u,
|
|
2227
|
+
controlsLayout: f,
|
|
2228
|
+
removeDisabled: g,
|
|
2229
|
+
addDisabled: h,
|
|
2230
|
+
...d
|
|
2231
|
+
} = t;
|
|
2232
|
+
return Ht(
|
|
2233
|
+
{
|
|
2234
|
+
...d,
|
|
2235
|
+
content: pn({
|
|
2236
|
+
controller: s,
|
|
2237
|
+
element: n,
|
|
2238
|
+
separator: r,
|
|
2239
|
+
showMove: c,
|
|
2240
|
+
showRemove: a,
|
|
2241
|
+
showAdd: i,
|
|
2242
|
+
createItem: o,
|
|
2243
|
+
addLabel: u,
|
|
2244
|
+
controlsLayout: f,
|
|
2245
|
+
removeDisabled: g,
|
|
2246
|
+
addDisabled: h
|
|
2247
|
+
})
|
|
2248
|
+
},
|
|
2249
|
+
...e
|
|
2250
|
+
);
|
|
2251
|
+
};
|
|
2252
|
+
class Wn extends bt {
|
|
2253
|
+
branches;
|
|
2254
|
+
activeBranch;
|
|
2255
|
+
#e;
|
|
2256
|
+
#t = /* @__PURE__ */ new Map();
|
|
2257
|
+
constructor(e, s, n, r, c, a, i = rt) {
|
|
2258
|
+
super(e, s, n, r, c, i), this.branches = a;
|
|
2259
|
+
const o = (f) => {
|
|
2260
|
+
for (const g of a)
|
|
2261
|
+
if (g.detect(f))
|
|
2262
|
+
return g.key;
|
|
2263
|
+
return a[0]?.key ?? "unknown";
|
|
2264
|
+
};
|
|
2265
|
+
this.activeBranch = n.map(o, rt);
|
|
2266
|
+
const u = (f) => {
|
|
2267
|
+
if (this.#t.has(f))
|
|
2268
|
+
return this.#t.get(f);
|
|
2269
|
+
const g = a.find((d) => d.key === f);
|
|
2270
|
+
if (!g)
|
|
2271
|
+
throw new Error(`Unknown branch: ${f}`);
|
|
2272
|
+
const h = new bt(
|
|
2273
|
+
[...e, f],
|
|
2274
|
+
(d) => {
|
|
2275
|
+
this.change(d);
|
|
2276
|
+
},
|
|
2277
|
+
this.signal.map(
|
|
2278
|
+
(d) => g.detect(d) ? d : g.defaultValue(),
|
|
2279
|
+
i
|
|
2280
|
+
),
|
|
2281
|
+
r.map(Bt([f])),
|
|
2282
|
+
{
|
|
2283
|
+
disabled: this.disabled,
|
|
2284
|
+
validationMode: this.parent.validationMode
|
|
2285
|
+
},
|
|
2286
|
+
i
|
|
2287
|
+
);
|
|
2288
|
+
return this.#t.set(f, h), h;
|
|
2289
|
+
};
|
|
2290
|
+
this.#e = this.activeBranch.map(
|
|
2291
|
+
(f) => u(f),
|
|
2292
|
+
rt
|
|
2293
|
+
), this.onDispose(() => {
|
|
2294
|
+
for (const f of this.#t.values())
|
|
2295
|
+
f.dispose();
|
|
2296
|
+
this.#t.clear(), this.activeBranch.dispose(), this.#e.dispose();
|
|
2297
|
+
});
|
|
2298
|
+
}
|
|
2299
|
+
/**
|
|
2300
|
+
* Get the controller for the currently active branch
|
|
2301
|
+
*/
|
|
2302
|
+
get activeController() {
|
|
2303
|
+
return p.get(this.#e);
|
|
2304
|
+
}
|
|
2305
|
+
/**
|
|
2306
|
+
* Get a controller for a specific branch
|
|
2307
|
+
*/
|
|
2308
|
+
getBranchController(e) {
|
|
2309
|
+
const s = this.branches.find((r) => r.key === e);
|
|
2310
|
+
if (!s)
|
|
2311
|
+
throw new Error(`Unknown branch: ${e}`);
|
|
2312
|
+
if (this.#t.has(e))
|
|
2313
|
+
return this.#t.get(e);
|
|
2314
|
+
const n = new bt(
|
|
2315
|
+
[...this.path, e],
|
|
2316
|
+
(r) => {
|
|
2317
|
+
this.change(r);
|
|
2318
|
+
},
|
|
2319
|
+
this.signal.map(
|
|
2320
|
+
(r) => s.detect(r) ? r : s.defaultValue(),
|
|
2321
|
+
rt
|
|
2322
|
+
),
|
|
2323
|
+
this.status.map(Bt([e])),
|
|
2324
|
+
{
|
|
2325
|
+
disabled: this.disabled,
|
|
2326
|
+
validationMode: this.parent.validationMode
|
|
2327
|
+
},
|
|
2328
|
+
rt
|
|
2329
|
+
);
|
|
2330
|
+
return this.#t.set(e, n), n;
|
|
2331
|
+
}
|
|
2332
|
+
/**
|
|
2333
|
+
* Switch to a different branch
|
|
2334
|
+
*/
|
|
2335
|
+
switchToBranch(e, s = !1) {
|
|
2336
|
+
const n = this.branches.find((a) => a.key === e);
|
|
2337
|
+
if (!n)
|
|
2338
|
+
throw new Error(`Unknown branch: ${e}`);
|
|
2339
|
+
const r = p.get(this.signal);
|
|
2340
|
+
if (n.detect(r))
|
|
2341
|
+
return !0;
|
|
2342
|
+
if (n.convert) {
|
|
2343
|
+
const a = n.convert(r);
|
|
2344
|
+
if (a.ok)
|
|
2345
|
+
return this.change(a.value), !0;
|
|
2346
|
+
}
|
|
2347
|
+
if (s && typeof window == "object" && typeof window.confirm == "function" && !window.confirm(
|
|
2348
|
+
"Changing type will clear the current value. Continue?"
|
|
2349
|
+
))
|
|
2350
|
+
return !1;
|
|
2351
|
+
const c = n.defaultValue();
|
|
2352
|
+
return this.change(c), !0;
|
|
2353
|
+
}
|
|
2354
|
+
/**
|
|
2355
|
+
* Get the current active branch definition
|
|
2356
|
+
*/
|
|
2357
|
+
get activeBranchDefinition() {
|
|
2358
|
+
const e = p.get(this.activeBranch);
|
|
2359
|
+
return this.branches.find((s) => s.key === e);
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
function Zn(t) {
|
|
2363
|
+
return t.transform(
|
|
2364
|
+
(e) => e ?? null,
|
|
2365
|
+
(e) => e ?? void 0
|
|
2366
|
+
);
|
|
2367
|
+
}
|
|
2368
|
+
function Yn(t) {
|
|
2369
|
+
return t.transform(
|
|
2370
|
+
(e) => e ?? "",
|
|
2371
|
+
(e) => e === "" ? void 0 : e
|
|
2372
|
+
);
|
|
2373
|
+
}
|
|
2374
|
+
function Xn(t) {
|
|
2375
|
+
return t.transform(
|
|
2376
|
+
(e) => e ?? void 0,
|
|
2377
|
+
(e) => e ?? null
|
|
2378
|
+
);
|
|
2379
|
+
}
|
|
2380
|
+
export {
|
|
2381
|
+
we as $,
|
|
2382
|
+
Rn as A,
|
|
2383
|
+
pn as B,
|
|
2384
|
+
kn as C,
|
|
2385
|
+
en as D,
|
|
2386
|
+
je as E,
|
|
2387
|
+
Ee as F,
|
|
2388
|
+
pt as G,
|
|
2389
|
+
zn as H,
|
|
2390
|
+
Un as I,
|
|
2391
|
+
Nn as J,
|
|
2392
|
+
On as K,
|
|
2393
|
+
Hn as L,
|
|
2394
|
+
qt as M,
|
|
2395
|
+
Ze as N,
|
|
2396
|
+
Pn as O,
|
|
2397
|
+
un as P,
|
|
2398
|
+
jn as Q,
|
|
2399
|
+
rn as R,
|
|
2400
|
+
$n as S,
|
|
2401
|
+
tn as T,
|
|
2402
|
+
Lt as U,
|
|
2403
|
+
Cn as V,
|
|
2404
|
+
an as W,
|
|
2405
|
+
In as X,
|
|
2406
|
+
He as Y,
|
|
2407
|
+
xe as Z,
|
|
2408
|
+
ve as _,
|
|
2409
|
+
J as a,
|
|
2410
|
+
kt as a0,
|
|
2411
|
+
ct as a1,
|
|
2412
|
+
vn as a2,
|
|
2413
|
+
$e as a3,
|
|
2414
|
+
ye as a4,
|
|
2415
|
+
ke as a5,
|
|
2416
|
+
Zt as a6,
|
|
2417
|
+
Ie as a7,
|
|
2418
|
+
It as a8,
|
|
2419
|
+
Ce as a9,
|
|
2420
|
+
xt as aa,
|
|
2421
|
+
vt as ab,
|
|
2422
|
+
Me as ac,
|
|
2423
|
+
De as ad,
|
|
2424
|
+
at as ae,
|
|
2425
|
+
lt as af,
|
|
2426
|
+
Ct as ag,
|
|
2427
|
+
_n as ah,
|
|
2428
|
+
wn as ai,
|
|
2429
|
+
Wt as b,
|
|
2430
|
+
_e as c,
|
|
2431
|
+
cn as d,
|
|
2432
|
+
Ut as e,
|
|
2433
|
+
Wn as f,
|
|
2434
|
+
Yn as g,
|
|
2435
|
+
Xn as h,
|
|
2436
|
+
xn as i,
|
|
2437
|
+
yn as j,
|
|
2438
|
+
Re as k,
|
|
2439
|
+
Oe as l,
|
|
2440
|
+
Mn as m,
|
|
2441
|
+
Ke as n,
|
|
2442
|
+
Xe as o,
|
|
2443
|
+
Ye as p,
|
|
2444
|
+
Dn as q,
|
|
2445
|
+
Sn as r,
|
|
2446
|
+
Tn as s,
|
|
2447
|
+
Zn as t,
|
|
2448
|
+
Fn as u,
|
|
2449
|
+
Vn as v,
|
|
2450
|
+
Bn as w,
|
|
2451
|
+
An as x,
|
|
2452
|
+
Ln as y,
|
|
2453
|
+
En as z
|
|
2454
|
+
};
|