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