@tempots/beatui 0.19.1 → 0.21.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 (130) hide show
  1. package/dist/{2019-CfIF9XVA.cjs → 2019-2VJkiLfN.cjs} +1 -1
  2. package/dist/{2019-D0n7sHsB.js → 2019-5KfqWnec.js} +2 -2
  3. package/dist/{2020-D1ziwonq.cjs → 2020-B8Q7fWlH.cjs} +1 -1
  4. package/dist/{2020-BkXWq9F8.js → 2020-DgsRREzV.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-BXJtZL3s.cjs +8 -0
  29. package/dist/{index-Dben4dbo.js → index-BX_AooS9.js} +2 -2
  30. package/dist/{index-CRfUh74G.cjs → index-Blq-MoAk.cjs} +1 -1
  31. package/dist/{index-rWglN8IQ.js → index-BnaafQ9o.js} +1 -1
  32. package/dist/{index-BJfVmi_X.js → index-BnbEC2zq.js} +2 -2
  33. package/dist/{index-CHgx0rFt.js → index-C4jYy0NW.js} +2 -2
  34. package/dist/{index-B-d5blto.js → index-C4xio93t.js} +3 -3
  35. package/dist/{index-CFo2nnaI.js → index-C5l1mFuD.js} +2 -2
  36. package/dist/{index-BYk56bqR.cjs → index-CDYYXcsk.cjs} +2 -2
  37. package/dist/{index-CIfx_bs7.cjs → index-CJM_lW9n.cjs} +1 -1
  38. package/dist/{index-BirEb-BA.js → index-CZaadFtU.js} +2178 -2193
  39. package/dist/{index-D0-d-xdJ.js → index-CaNnYmEs.js} +6 -6
  40. package/dist/{index-BZHMnjr6.cjs → index-CaOzAsWD.cjs} +1 -1
  41. package/dist/{index-BF4pXHo-.js → index-CdvplJG6.js} +4 -4
  42. package/dist/{index-CUs1c8a9.js → index-ClvbjqJL.js} +8 -8
  43. package/dist/{index-DgUJYXoy.cjs → index-CpB78PPQ.cjs} +1 -1
  44. package/dist/{index-B16dbwxM.cjs → index-CpKAa22o.cjs} +1 -1
  45. package/dist/{index-DJ-avKHU.js → index-CpMCZBAl.js} +2 -2
  46. package/dist/{index-DxG_avr8.cjs → index-CvRJPSEv.cjs} +1 -1
  47. package/dist/{index-DD-MOsCa.js → index-D5nWhHZv.js} +2 -2
  48. package/dist/{index-Cohec4rB.cjs → index-D7o5LhMm.cjs} +1 -1
  49. package/dist/{index-DYIv5X6N.js → index-DC5Cn-TM.js} +2 -2
  50. package/dist/{index-CKRuo2DB.js → index-DCpnqWRN.js} +3 -3
  51. package/dist/{index-kk6qFeC5.cjs → index-DOyppfix.cjs} +1 -1
  52. package/dist/{index-C9XAXTDx.cjs → index-DXFCOeK6.cjs} +1 -1
  53. package/dist/{index-DjNMMz5-.cjs → index-DXUQTPON.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-dsitEt8M.cjs → index-Jt6D3QJ7.cjs} +1 -1
  59. package/dist/{index-85k3bgcY.cjs → index-KcBlGDqr.cjs} +1 -1
  60. package/dist/{index-dV4F3c70.js → index-MyVoESdk.js} +3 -3
  61. package/dist/{index-DC4nzG_w.js → index-NysVuvZA.js} +5 -5
  62. package/dist/{index-D-Rzl363.cjs → index-RGCDszX8.cjs} +1 -1
  63. package/dist/{index-2DKUYRWr.js → index-VAdTFk7m.js} +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 +2321 -2292
  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-DvzonVEo.cjs +1 -0
  91. package/dist/notice-tCSEbjFE.js +2413 -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/types/components/navigation/flyout.d.ts +2 -0
  107. package/dist/types/components/navigation/link/button-link.d.ts +6 -2
  108. package/dist/types/components/navigation/link/link.d.ts +6 -2
  109. package/dist/types/components/navigation/link/navigation-link.d.ts +5 -5
  110. package/dist/types/components/navigation/link/navigation-options.d.ts +5 -0
  111. package/dist/types/components/navigation/sidebar/sidebar-link.d.ts +5 -0
  112. package/dist/{ur-kkik6-_r.cjs → ur-B4b39hNV.cjs} +1 -1
  113. package/dist/{ur-CdQA0epV.js → ur-CGTjSoJt.js} +1 -1
  114. package/dist/{vi-A8UmZU3L.js → vi-BF3HTFU9.js} +1 -1
  115. package/dist/{vi-1xtFXJc0.cjs → vi-CSpW181L.cjs} +1 -1
  116. package/dist/{zh-D0nnvX8T.js → zh-BreM8U2w.js} +1 -1
  117. package/dist/{zh-DC_SsXdk.cjs → zh-PeL8FN2c.cjs} +1 -1
  118. package/package.json +5 -5
  119. package/dist/index-B66rNs5i.cjs +0 -2
  120. package/dist/index-DXFKCiah.cjs +0 -8
  121. package/dist/index.esm-8xolKogd.cjs +0 -1
  122. package/dist/milkdown-input-C-Muq7PQ.cjs +0 -941
  123. package/dist/modal-nbZW44XS.js +0 -614
  124. package/dist/modal-wbG_oGOr.cjs +0 -1
  125. package/dist/notice-CIPcSfD5.js +0 -2432
  126. package/dist/notice-Cq02YHoN.cjs +0 -1
  127. package/dist/timer-CcMCjYrq.cjs +0 -1
  128. package/dist/timer-CkgWORR9.js +0 -42
  129. package/dist/translations-DBtfTNnM.js +0 -2005
  130. package/dist/translations-EQ1qPZ0_.cjs +0 -2
@@ -0,0 +1,1969 @@
1
+ import { makeProviderMark as Y, localStorageProp as W, computedOf as I, Use as O, html as p, attr as c, When as T, Fragment as M, aria as k, coalesce as G, style as j, prop as _, on as y, OnDispose as Z, Value as P, WithElement as ue, Empty as v, dataAttr as U, input as X, emitValue as $, emitValueAsNumber as de } from "@tempots/dom";
2
+ import { WhenInViewport as he, Query as pe, ElementRect as fe } from "@tempots/ui";
3
+ function K(e, {
4
+ units: t = ["B", "KB", "MB", "GB", "TB"],
5
+ decimalPlaces: s = 0,
6
+ locale: n
7
+ } = {}) {
8
+ if (e === 0 || e === 0n)
9
+ return new Intl.NumberFormat(n, {
10
+ style: "unit",
11
+ unit: "byte",
12
+ unitDisplay: "short",
13
+ maximumFractionDigits: 0
14
+ }).format(0).replace("byte", t[0]);
15
+ let r, a;
16
+ if (typeof e == "bigint") {
17
+ let l = e < 0n ? -e : e;
18
+ for (r = 0; l >= 1024n && r < t.length - 1; )
19
+ l = l / 1024n, r++;
20
+ a = Number(e) / Math.pow(1024, r);
21
+ } else
22
+ r = Math.floor(Math.log(Math.abs(e)) / Math.log(1024)), r = Math.min(r, t.length - 1), a = e / Math.pow(1024, r);
23
+ return new Intl.NumberFormat(n, {
24
+ style: "unit",
25
+ unit: "byte",
26
+ unitDisplay: "short",
27
+ minimumFractionDigits: r === 0 ? 0 : s,
28
+ maximumFractionDigits: r === 0 ? 0 : s
29
+ }).format(a).replace("byte", t[r]);
30
+ }
31
+ const J = /* @__PURE__ */ new Map();
32
+ function ee(e) {
33
+ const t = J.get(e) ?? 0;
34
+ return J.set(e, t + 1), `${e}-${t}`;
35
+ }
36
+ const w = {
37
+ /**
38
+ * Creates a loading state.
39
+ * @param previousValue - The previous value.
40
+ * @returns A loading state.
41
+ * @public
42
+ */
43
+ notAsked: { type: "NotAsked" },
44
+ /**
45
+ * Creates a loading state.
46
+ * @param previousValue - The previous value.
47
+ * @returns A loading state.
48
+ * @public
49
+ */
50
+ loading(e = void 0) {
51
+ return { type: "Loading", previousValue: e };
52
+ },
53
+ /**
54
+ * Creates a successful state.
55
+ * @param value - The value.
56
+ * @returns A successful state.
57
+ * @public
58
+ */
59
+ success(e) {
60
+ return { type: "AsyncSuccess", value: e };
61
+ },
62
+ /**
63
+ * Creates a failure state.
64
+ * @param error - The error.
65
+ * @returns A failure state.
66
+ * @public
67
+ */
68
+ failure(e) {
69
+ return { type: "AsyncFailure", error: e };
70
+ },
71
+ /**
72
+ * Checks if the result is a success.
73
+ * @param r - The result.
74
+ * @returns `true` if the result is a success; otherwise, `false`.
75
+ * @public
76
+ */
77
+ isSuccess(e) {
78
+ return e.type === "AsyncSuccess";
79
+ },
80
+ /**
81
+ * Checks if the result is a failure.
82
+ * @param r - The result.
83
+ * @returns `true` if the result is a failure; otherwise, `false`.
84
+ * @public
85
+ */
86
+ isFailure(e) {
87
+ return e.type === "AsyncFailure";
88
+ },
89
+ /**
90
+ * Checks if the result is a not-asked.
91
+ * @param r - The result.
92
+ * @returns `true` if the result is not-asked; otherwise, `false`.
93
+ * @public
94
+ */
95
+ isNotAsked(e) {
96
+ return e.type === "NotAsked";
97
+ },
98
+ /**
99
+ * Checks if the result is a loading.
100
+ * @param r - The result.
101
+ * @returns `true` if the result is loading; otherwise, `false`.
102
+ * @public
103
+ */
104
+ isLoading(e) {
105
+ return e.type === "Loading";
106
+ },
107
+ /**
108
+ * Gets the value if the result is a success; otherwise, returns the alternative value.
109
+ * @param r - The result.
110
+ * @param alt - The alternative value.
111
+ * @returns The value if the result is a success; otherwise, the alternative value.
112
+ * @public
113
+ */
114
+ getOrElse(e, t) {
115
+ return w.isSuccess(e) ? e.value : t;
116
+ },
117
+ /**
118
+ * Gets the value if the result is a success; otherwise, returns the value from the alternative function.
119
+ * @param r - The result.
120
+ * @param altf - The alternative function.
121
+ * @returns The value if the result is a success; otherwise, the value from the alternative
122
+ * @public
123
+ * function.
124
+ */
125
+ getOrElseLazy(e, t) {
126
+ return w.isSuccess(e) ? e.value : t();
127
+ },
128
+ /**
129
+ * Gets the value if the result is a success; otherwise, returns `null`.
130
+ * @param r - The result.
131
+ * @returns The value if the result is a success; otherwise, `null`.
132
+ * @public
133
+ */
134
+ getOrNull(e) {
135
+ return w.isSuccess(e) ? e.value : null;
136
+ },
137
+ /**
138
+ * Gets the value if the result is a success; otherwise, returns `undefined`.
139
+ * @param r - The result.
140
+ * @returns The value if the result is a success; otherwise, `undefined`.
141
+ * @public
142
+ */
143
+ getOrUndefined(e) {
144
+ return w.isSuccess(e) ? e.value : void 0;
145
+ },
146
+ /**
147
+ * Gets the value of a `AsyncResult` if it is a `Success`, otherwise it throws the error contained in the `Failure`.
148
+ * @param r - The `AsyncResult` to get the value from.
149
+ * @returns The value of the `AsyncResult` if it is a `Success`.
150
+ */
151
+ getUnsafe: (e) => {
152
+ if (w.isSuccess(e))
153
+ return e.value;
154
+ throw w.isFailure(e) ? e.error : new Error("Cannot get value from a not-asked or loading result");
155
+ },
156
+ /**
157
+ * Based on the state of the result, it picks the appropriate function to call and returns the result.
158
+ * @param success - The function to call if the result is a success.
159
+ * @param failure - The function to call if the result is a failure.
160
+ * @param loading - The function to call if the result is loading.
161
+ * @param notAsked - The function to call if the result is not-asked.
162
+ * @returns The result of calling the appropriate function based on the state of the result.
163
+ * @public
164
+ */
165
+ match: (e, {
166
+ success: t,
167
+ failure: s,
168
+ loading: n,
169
+ notAsked: r = n
170
+ }) => w.isSuccess(e) ? t(e.value) : w.isFailure(e) ? s(e.error) : w.isNotAsked(e) ? r() : n(e.previousValue),
171
+ /**
172
+ * When the result is a success, it applies the function to the value.
173
+ *
174
+ * @param r - The result.
175
+ * @param apply - The function to apply.
176
+ * @returns The result that was passed in.
177
+ * @public
178
+ */
179
+ whenSuccess: (e, t) => (w.isSuccess(e) && t(e.value), e),
180
+ /**
181
+ * When the result is a failure, it applies the function to the error.
182
+ *
183
+ * @param r - The result.
184
+ * @param apply - The function to apply.
185
+ * @returns The result that was passed in.
186
+ * @public
187
+ */
188
+ whenFailure: (e, t) => (w.isFailure(e) && t(e.error), e),
189
+ /**
190
+ * Compares two results for equality.
191
+ * @param r1 - The first result.
192
+ * @param r2 - The second result.
193
+ * @param options - The options to use for comparison. By default, uses strict equality.
194
+ * @returns `true` if the results are equal, `false` otherwise.
195
+ */
196
+ equals: (e, t, s = {
197
+ valueEquals: (n, r) => n === r,
198
+ errorEquals: (n, r) => n === r
199
+ }) => e.type === "AsyncSuccess" && t.type === "AsyncSuccess" ? s.valueEquals(e.value, t.value) : e.type === "AsyncFailure" && t.type === "AsyncFailure" ? s.errorEquals(e.error, t.error) : e.type === "Loading" && t.type === "Loading" ? s.valueEquals(e.previousValue, t.previousValue) : e.type === "NotAsked" && t.type === "NotAsked",
200
+ /**
201
+ * Combines multiple results into a single result.
202
+ * @param results - The results to combine.
203
+ * @returns A single result that is a success if all the input results are successes, otherwise a failure.
204
+ */
205
+ all: (e) => {
206
+ const t = [];
207
+ for (const s of e)
208
+ if (w.isSuccess(s))
209
+ t.push(s.value);
210
+ else
211
+ return s;
212
+ return w.success(t);
213
+ },
214
+ /**
215
+ * Converts a Promise to an AsyncResult.
216
+ * @param p - The Promise to convert.
217
+ * @returns A Promise that resolves to an AsyncResult.
218
+ */
219
+ ofPromise: async (e) => {
220
+ try {
221
+ const t = await e;
222
+ return w.success(t);
223
+ } catch (t) {
224
+ return w.failure(t instanceof Error ? t : new Error(String(t)));
225
+ }
226
+ }
227
+ }, L = (e, t) => e === t || e !== e && t !== t, D = {
228
+ /**
229
+ * Creates a valid `Validation`.
230
+ * @returns A `Validation` that is `Valid`.
231
+ */
232
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
233
+ valid: { type: "valid" },
234
+ /**
235
+ * Creates an invalid `Validation`.
236
+ * @param error - The error associated with the invalid value.
237
+ * @returns A `Validation` that is `Invalid`.
238
+ */
239
+ invalid(e) {
240
+ return { type: "invalid", error: e };
241
+ },
242
+ /**
243
+ * Checks if a `Validation` is `Valid`.
244
+ * @param r - The `Validation` to check.
245
+ * @returns `true` if the `Validation` is `Valid`, otherwise `false`.
246
+ */
247
+ isValid(e) {
248
+ return e.type === "valid";
249
+ },
250
+ /**
251
+ * Checks if a `Validation` is `Invalid`.
252
+ * @param r - The `Validation` to check.
253
+ * @returns `true` if the `Validation` is `Invalid`, otherwise `false`.
254
+ */
255
+ isInvalid(e) {
256
+ return e.type === "invalid";
257
+ },
258
+ /**
259
+ * Maps the value of a `Validation` to a new value.
260
+ * @param r - The `Validation` to map.
261
+ * @param valid - The mapping function for a valid value.
262
+ * @param invalid - The mapping function for an invalid value.
263
+ * @returns The mapped value.
264
+ */
265
+ match: (e, t, s) => D.isValid(e) ? t() : s(e.error),
266
+ /**
267
+ * Maps the value of a `Validation` to a new `Validation`.
268
+ * @param validation - The `Validation` to map.
269
+ * @param value - The value to map.
270
+ * @returns A new `Validation` with the mapped value.
271
+ */
272
+ toResult: (e, t) => D.match(
273
+ e,
274
+ () => f.success(t),
275
+ (s) => f.failure(s)
276
+ ),
277
+ /**
278
+ * Execute a function when the `Validation` is valid.
279
+ *
280
+ * @param r - The `Validation` to check.
281
+ * @param apply - The function to execute when the `Validation` is valid.
282
+ * @returns The `Validation` object.
283
+ */
284
+ whenValid: (e, t) => (D.isValid(e) && t(), e),
285
+ /**
286
+ * Execute a function when the `Validation` is invalid.
287
+ *
288
+ * @param r - The `Validation` to check.
289
+ * @param apply - The function to execute when the `Validation` is invalid.
290
+ * @returns The `Validation` object.
291
+ */
292
+ whenInvalid: (e, t) => (D.isInvalid(e) && t(e.error), e)
293
+ }, f = {
294
+ /**
295
+ * Creates a successful `Result`.
296
+ * @param value - The value to wrap in a `Success` type.
297
+ * @returns A `Result` that is a `Success`.
298
+ * @public
299
+ */
300
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
301
+ success(e) {
302
+ return { type: "Success", value: e };
303
+ },
304
+ /**
305
+ * Creates a failure `Result`.
306
+ * @param error - The error to wrap in a `Failure` type.
307
+ * @returns A `Result` that is a `Failure`.
308
+ * @public
309
+ */
310
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
311
+ failure(e) {
312
+ return { type: "Failure", error: e };
313
+ },
314
+ /**
315
+ * Maps the value of a `Result` to a new value.
316
+ * @param r - The `Result` to map.
317
+ * @param f - The mapping function.
318
+ * @returns A new `Result` with the mapped value.
319
+ * @public
320
+ */
321
+ map: (e, t) => e.type === "Success" ? f.success(t(e.value)) : e,
322
+ /**
323
+ * Maps the value of a `Result` to a new `Result`.
324
+ * @param r - The `Result` to map.
325
+ * @param f - The mapping function.
326
+ * @returns A new `Result` with the mapped value.
327
+ * @public
328
+ */
329
+ flatMap: (e, t) => e.type === "Success" ? t(e.value) : e,
330
+ /**
331
+ * Converts a `Result` to an `AsyncResult`.
332
+ * @param r - The `Result` to convert.
333
+ * @returns An `AsyncResult` that is equivalent to the input `Result`.
334
+ * @public
335
+ */
336
+ toAsync(e) {
337
+ return f.match(
338
+ e,
339
+ (t) => w.success(t),
340
+ (t) => w.failure(t)
341
+ );
342
+ },
343
+ /**
344
+ * Converts a `Result` to a `Validation`.
345
+ * @param r - The `Result` to convert.
346
+ * @returns A `Validation` that is equivalent to the input `Result`.
347
+ * @public
348
+ */
349
+ toValidation(e) {
350
+ return f.match(
351
+ e,
352
+ () => D.valid,
353
+ (t) => D.invalid(t)
354
+ );
355
+ },
356
+ /**
357
+ * Checks if a `Result` is a success.
358
+ * @param r - The `Result` to check.
359
+ * @returns `true` if the `Result` is a `Success`, `false` otherwise.
360
+ * @public
361
+ */
362
+ isSuccess(e) {
363
+ return e.type === "Success";
364
+ },
365
+ /**
366
+ * Checks if a `Result` is a failure.
367
+ * @param r - The `Result` to check.
368
+ * @returns `true` if the `Result` is a `Failure`, `false` otherwise.
369
+ * @public
370
+ */
371
+ isFailure(e) {
372
+ return e.type === "Failure";
373
+ },
374
+ /**
375
+ * Gets the value of a `Result` if it is a `Success`, otherwise returns the provided default value.
376
+ * @param r - The `Result` to get the value from.
377
+ * @param alt - The default value to return if the `Result` is a `Failure`.
378
+ * @returns The value of the `Result` if it is a `Success`, otherwise the default value.
379
+ * @public
380
+ */
381
+ getOrElse(e, t) {
382
+ return f.isSuccess(e) ? e.value : t;
383
+ },
384
+ /**
385
+ * Gets the value of a `Result` if it is a `Success`, otherwise returns the result of the provided function.
386
+ * @param r - The `Result` to get the value from.
387
+ * @param altf - The function to call if the `Result` is a `Failure`.
388
+ * @returns The value of the `Result` if it is a `Success`, otherwise the result of the function.
389
+ * @public
390
+ */
391
+ getOrElseLazy(e, t) {
392
+ return f.isSuccess(e) ? e.value : t();
393
+ },
394
+ /**
395
+ * Gets the value of a `Result` if it is a `Success`, otherwise returns `null`.
396
+ * @param r - The `Result` to get the value from.
397
+ * @returns The value of the `Result` if it is a `Success`, otherwise `null`.
398
+ * @public
399
+ */
400
+ getOrNull(e) {
401
+ return f.isSuccess(e) ? e.value : null;
402
+ },
403
+ /**
404
+ * Gets the value of a `Result` if it is a `Success`, otherwise returns `undefined`.
405
+ * @param r - The `Result` to get the value from.
406
+ * @returns The value of the `Result` if it is a `Success`, otherwise `undefined`.
407
+ * @public
408
+ */
409
+ getOrUndefined(e) {
410
+ return f.isSuccess(e) ? e.value : void 0;
411
+ },
412
+ /**
413
+ * Gets the value of a `Result` if it is a `Success`, otherwise it throws the error contained in the `Failure`.
414
+ * @param r - The `Result` to get the value from.
415
+ * @returns The value of the `Result` if it is a `Success`.
416
+ */
417
+ getUnsafe: (e) => {
418
+ if (f.isSuccess(e))
419
+ return e.value;
420
+ throw e.error;
421
+ },
422
+ /**
423
+ * Based on the state of the result, it picks the appropriate function to call and returns the result.
424
+ * @param success - The function to call if the result is a success.
425
+ * @param failure - The function to call if the result is a failure.
426
+ * @returns The result of calling the appropriate function based on the state of the result.
427
+ * @public
428
+ */
429
+ match: (e, t, s) => f.isSuccess(e) ? t(e.value) : s(e.error),
430
+ /**
431
+ * Calls the provided function if the result is a success.
432
+ * @param apply - The function to call if the result is a success.
433
+ * @returns A function that takes a `Result` and calls the provided function if the result is a success.
434
+ * @public
435
+ */
436
+ whenSuccess: (e, t) => (f.isSuccess(e) && t(e.value), e),
437
+ whenFailure: (e, t) => (f.isFailure(e) && t(e.error), e),
438
+ /**
439
+ * Combines two results into a single result.
440
+ * @param r1 - The first result.
441
+ * @param r2 - The second result.
442
+ * @param combineV - The function to combine two values.
443
+ * @param combineE - The function to combine two errors.
444
+ * @returns The combined result.
445
+ * @public
446
+ */
447
+ combine: (e, t, s, n) => f.match(
448
+ e,
449
+ (r) => f.match(
450
+ t,
451
+ (a) => f.success(s(r, a)),
452
+ (a) => f.failure(a)
453
+ ),
454
+ (r) => f.match(
455
+ t,
456
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
457
+ (a) => f.failure(r),
458
+ (a) => f.failure(n(r, a))
459
+ )
460
+ ),
461
+ /**
462
+ * Compares two results for equality.
463
+ * @param r1 - The first result.
464
+ * @param r2 - The second result.
465
+ * @param options - The options to use for comparison. By default, uses strict equality.
466
+ * @returns `true` if the results are equal, `false` otherwise.
467
+ */
468
+ equals: (e, t, s = {
469
+ valueEquals: (n, r) => n === r,
470
+ errorEquals: (n, r) => n === r
471
+ }) => e.type === "Success" && t.type === "Success" ? s.valueEquals(e.value, t.value) : e.type === "Failure" && t.type === "Failure" ? s.errorEquals(e.error, t.error) : !1,
472
+ /**
473
+ * Combines multiple results into a single result.
474
+ * @param results - The results to combine.
475
+ * @returns A single result that is a success if all the input results are successes, otherwise a failure.
476
+ */
477
+ all: (e) => {
478
+ const t = [];
479
+ for (const s of e)
480
+ if (f.isSuccess(s))
481
+ t.push(s.value);
482
+ else
483
+ return s;
484
+ return f.success(t);
485
+ }
486
+ }, te = {
487
+ loadingExtended: "Loading, please wait",
488
+ loadingShort: "Loading...",
489
+ locale: "Locale",
490
+ iconDescription: "Icon",
491
+ loadingIcon: "Loading icon",
492
+ failedToLoadIcon: "Failed to load icon",
493
+ editLabel: "Edit",
494
+ selectOne: "Select one",
495
+ selectMany: "Select many",
496
+ noResults: "No results",
497
+ passwordPlaceholderText: "Secret Password",
498
+ togglePasswordVisibility: "Toggle password visibility",
499
+ toggleMenu: "Toggle menu",
500
+ toggleAside: "Toggle aside",
501
+ mainNavigation: "Main navigation",
502
+ sidebar: "Sidebar",
503
+ closeDrawer: "Close drawer",
504
+ closeModal: "Close modal",
505
+ confirm: "Confirm",
506
+ cancel: "Cancel",
507
+ addLabel: "Add",
508
+ removeItem: "Remove item",
509
+ // languages
510
+ currentLocale: "English",
511
+ ar: "Arabic",
512
+ de: "German",
513
+ en: "English",
514
+ es: "Spanish",
515
+ fr: "French",
516
+ hi: "Hindi",
517
+ it: "Italian",
518
+ ja: "Japanese",
519
+ ko: "Korean",
520
+ nl: "Dutch",
521
+ pl: "Polish",
522
+ pt: "Portuguese",
523
+ ru: "Russian",
524
+ tr: "Turkish",
525
+ vi: "Vietnamese",
526
+ zh: "Chinese",
527
+ he: "Hebrew",
528
+ fa: "Persian",
529
+ ur: "Urdu",
530
+ // input
531
+ emailPlaceholderText: "Enter your email",
532
+ incrementValue: "Increment value",
533
+ decrementValue: "Decrement value",
534
+ // drop zone
535
+ dropZoneInstructions: (e) => e ? "Click to choose or drag files here, or press Enter or Space to open file selector" : "Drag files here",
536
+ // size
537
+ fileSizeUnits: ["Bytes", "KB", "MB", "GB", "TB"],
538
+ // file input
539
+ removeFile: "Remove file",
540
+ clearAllFiles: "Clear all files",
541
+ // inputs reset
542
+ clearValue: "Reset",
543
+ unknownType: "Unknown type",
544
+ filesInputInstructions: (e, t, s) => {
545
+ let n = e == null || e > 1 ? "Click to choose or drag files here" : "Click to choose or drag a file here";
546
+ if (e || t) {
547
+ const r = [];
548
+ if (e != null && e > 1 && r.push(`up to ${e} files`), t && s) {
549
+ const a = K(t, {
550
+ units: s
551
+ });
552
+ r.push(`max ${a} each`);
553
+ }
554
+ r.length > 0 && (n += ` (${r.join(", ")})`);
555
+ } else if (t && s) {
556
+ const r = K(t, {
557
+ units: s
558
+ });
559
+ n += ` (max ${r})`;
560
+ }
561
+ return n;
562
+ }
563
+ }, me = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
564
+ __proto__: null,
565
+ default: te
566
+ }, Symbol.toStringTag, { value: "Module" })), be = te, ge = "en", ve = (e, t, s) => {
567
+ const n = e[t];
568
+ return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((r, a) => {
569
+ (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(a.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + t + (t.split("/").length !== s ? ". Note that variables only represent file names one level deep." : ""))));
570
+ });
571
+ }, ye = /* @__PURE__ */ new Set([
572
+ "ar",
573
+ // Arabic
574
+ "he",
575
+ // Hebrew
576
+ "fa",
577
+ // Persian/Farsi
578
+ "ur",
579
+ // Urdu
580
+ "ps",
581
+ // Pashto
582
+ "sd",
583
+ // Sindhi
584
+ "ku",
585
+ // Kurdish
586
+ "dv",
587
+ // Divehi/Maldivian
588
+ "yi",
589
+ // Yiddish
590
+ "ji",
591
+ // Yiddish (alternative code)
592
+ "iw",
593
+ // Hebrew (deprecated, but still used)
594
+ "in"
595
+ // Indonesian (deprecated, but sometimes confused)
596
+ ]);
597
+ function se(e) {
598
+ if (!e) return "ltr";
599
+ const t = e.split(/[-_]/)[0].toLowerCase();
600
+ return ye.has(t) ? "rtl" : "ltr";
601
+ }
602
+ function we(e, t) {
603
+ return e === "auto" ? se(t) : e;
604
+ }
605
+ function Xe(e) {
606
+ return `b-${e}`;
607
+ }
608
+ function et(e) {
609
+ return se(e) === "rtl";
610
+ }
611
+ function tt(e) {
612
+ return e === "ltr" ? "rtl" : "ltr";
613
+ }
614
+ const ke = {
615
+ ltr: {
616
+ "inline-start": "left",
617
+ "inline-end": "right",
618
+ "block-start": "top",
619
+ "block-end": "bottom"
620
+ },
621
+ rtl: {
622
+ "inline-start": "right",
623
+ "inline-end": "left",
624
+ "block-start": "top",
625
+ "block-end": "bottom"
626
+ }
627
+ };
628
+ function st(e, t) {
629
+ return ke[t][e];
630
+ }
631
+ const Se = {
632
+ mark: Y("Locale"),
633
+ create: (e) => {
634
+ const t = W({
635
+ defaultValue: navigator.language ?? "en-US",
636
+ key: "beatui-locale"
637
+ }), s = W({
638
+ defaultValue: "auto",
639
+ key: "beatui-direction-preference"
640
+ }), n = I(
641
+ t,
642
+ s
643
+ )(
644
+ (a, i) => we(i, a)
645
+ );
646
+ return {
647
+ value: {
648
+ locale: t,
649
+ setLocale: (a) => t.set(a),
650
+ direction: n,
651
+ directionPreference: s,
652
+ setDirectionPreference: (a) => s.set(a)
653
+ },
654
+ dispose: () => {
655
+ t.dispose(), s.dispose(), n.dispose();
656
+ }
657
+ };
658
+ }
659
+ }, Ie = "bui-icons", N = /* @__PURE__ */ new Map(), ne = (() => {
660
+ try {
661
+ return typeof indexedDB < "u" && indexedDB !== null;
662
+ } catch {
663
+ return !1;
664
+ }
665
+ })();
666
+ function De() {
667
+ return ne ? new Promise((e, t) => {
668
+ const s = indexedDB.open(Ie, 1);
669
+ s.onupgradeneeded = function(n) {
670
+ const r = n.target.result;
671
+ r.objectStoreNames.contains("icons") || r.createObjectStore("icons");
672
+ }, s.onsuccess = function() {
673
+ e(s.result);
674
+ }, s.onerror = function() {
675
+ t(s.error);
676
+ };
677
+ }) : Promise.reject(new Error("IndexedDB not available"));
678
+ }
679
+ const F = ne ? De() : null;
680
+ function _e(e, t) {
681
+ return new Promise(async (s, n) => {
682
+ try {
683
+ if (F) {
684
+ const a = (await F).transaction("icons", "readwrite");
685
+ a.objectStore("icons").put(t, e), a.oncomplete = s, a.onerror = n;
686
+ } else
687
+ N.set(e, t), s(void 0);
688
+ } catch {
689
+ N.set(e, t), s(void 0);
690
+ }
691
+ });
692
+ }
693
+ function Ce(e) {
694
+ return new Promise(async (t, s) => {
695
+ try {
696
+ if (F) {
697
+ const i = (await F).transaction("icons", "readonly").objectStore("icons").get(e);
698
+ i.onsuccess = function() {
699
+ t(i.result);
700
+ }, i.onerror = s;
701
+ } else
702
+ t(N.get(e) || null);
703
+ } catch {
704
+ t(N.get(e) || null);
705
+ }
706
+ });
707
+ }
708
+ async function Ee(e) {
709
+ const t = `https://api.iconify.design/${e}.svg`;
710
+ return fetch(t).then((s) => {
711
+ if (s.status === 200)
712
+ return s.text();
713
+ throw new Error(`Failed to load icon: ${e}`);
714
+ });
715
+ }
716
+ async function Te(e) {
717
+ const t = e.replace(":", "/"), s = await Ce(t);
718
+ if (s)
719
+ return s;
720
+ const n = await Ee(t);
721
+ return await _e(t, n), n;
722
+ }
723
+ function Me(e, t) {
724
+ const s = ["bc-icon", `bc-icon--${e}`];
725
+ return t && s.push(`bu-fg-${t}`), s.join(" ");
726
+ }
727
+ function B({ icon: e, size: t = "md", color: s, title: n, accessibility: r = "auto" }, ...a) {
728
+ const i = I(
729
+ r,
730
+ n
731
+ )((o, l) => o === "decorative" ? !1 : o === "informative" ? !0 : l != null && l !== "");
732
+ return O(
733
+ V,
734
+ (o) => p.span(
735
+ c.class("bu-content-box"),
736
+ c.class(
737
+ I(
738
+ t,
739
+ s
740
+ )((l, h) => Me(l ?? "md", h))
741
+ ),
742
+ // Add accessibility attributes based on icon type
743
+ T(
744
+ i,
745
+ () => M(
746
+ c.role("img"),
747
+ k.label(G(n, o.$.iconDescription))
748
+ ),
749
+ () => k.hidden(!0)
750
+ ),
751
+ he(
752
+ { once: !0 },
753
+ () => pe({
754
+ request: e,
755
+ load: ({ request: l }) => Te(l),
756
+ convertError: String,
757
+ success: ({ value: l }) => p.span(
758
+ j.width("100%"),
759
+ j.height("100%"),
760
+ c.innerHTML(l)
761
+ ),
762
+ pending: () => p.span(
763
+ c.class("animate-spin"),
764
+ // Loading state accessibility
765
+ T(
766
+ i,
767
+ () => M(c.role("img"), k.label(o.$.loadingIcon)),
768
+ () => k.hidden(!0)
769
+ ),
770
+ "↻"
771
+ ),
772
+ failure: ({ error: l }) => p.span(
773
+ c.title(l),
774
+ c.class("text-red-500"),
775
+ // Error state accessibility
776
+ T(
777
+ i,
778
+ () => M(c.role("img"), k.label(o.$.failedToLoadIcon)),
779
+ () => k.hidden(!0)
780
+ ),
781
+ "🚫"
782
+ )
783
+ })
784
+ ),
785
+ ...a
786
+ )
787
+ );
788
+ }
789
+ function Pe(e, t, s, n, r, a) {
790
+ const i = [
791
+ "bc-button",
792
+ `bu-text-${t}`,
793
+ `bc-control--padding-${t}`,
794
+ `bu-rounded-${n}`
795
+ ];
796
+ switch (a && i.push("bc-button--loading"), e) {
797
+ case "filled":
798
+ i.push(`bu-bg-${s}`), r || i.push(`hover:bu-bg-${s}`);
799
+ break;
800
+ case "light":
801
+ i.push(`bu-bg-light-${s}`), r || i.push(`hover:bu-bg-light-${s}`);
802
+ break;
803
+ case "outline":
804
+ i.push(`bu-border--${s}`), r || i.push(`hover:bu-bg-light-${s}`);
805
+ break;
806
+ case "default":
807
+ i.push("bu-bg-light-neutral"), i.push(`bu-text-${s}`), r || i.push("hover:bu-bg-light-base");
808
+ break;
809
+ case "text":
810
+ i.push("bu-bg-inherit"), i.push(`bu-text-${s}`), r || i.push("hover:bu-underline");
811
+ break;
812
+ }
813
+ return i.join(" ");
814
+ }
815
+ function $e({
816
+ type: e = "button",
817
+ disabled: t,
818
+ loading: s,
819
+ variant: n = "filled",
820
+ size: r = "md",
821
+ color: a = "base",
822
+ roundedness: i = "sm",
823
+ onClick: o = () => {
824
+ }
825
+ }, ...l) {
826
+ const h = _(null);
827
+ return O(
828
+ V,
829
+ (d) => p.button(
830
+ c.type(e),
831
+ c.disabled(
832
+ I(
833
+ t,
834
+ s
835
+ )((u, b) => u || b)
836
+ ),
837
+ // Add ARIA attributes for accessibility
838
+ k.busy(s ?? !1),
839
+ T(s ?? !1, () => k.label(d.$.loadingExtended)),
840
+ c.class(
841
+ I(
842
+ n,
843
+ r,
844
+ a,
845
+ i,
846
+ t,
847
+ s
848
+ )(
849
+ (u, b, g, S, m, C) => Pe(
850
+ u ?? "filled",
851
+ b ?? "md",
852
+ g ?? "base",
853
+ S ?? "sm",
854
+ m,
855
+ C
856
+ )
857
+ )
858
+ ),
859
+ T(
860
+ s ?? !1,
861
+ () => M(
862
+ j.width(
863
+ h.map((u) => u == null ? "" : `${u.width}px`)
864
+ ),
865
+ j.height(
866
+ h.map((u) => u == null ? "" : `${u.height}px`)
867
+ ),
868
+ B({ icon: "line-md:loading-twotone-loop", size: r ?? "md" }),
869
+ // Hidden live region for screen reader announcements
870
+ p.span(
871
+ c.class("sr-only"),
872
+ k.live("polite"),
873
+ d.$.loadingExtended
874
+ )
875
+ ),
876
+ () => M(y.click(o), ...l)
877
+ ),
878
+ T(
879
+ s != null,
880
+ () => fe(
881
+ (u) => Z(
882
+ u.on((b) => {
883
+ P.get(s ?? !1) || h.set(b);
884
+ })
885
+ )
886
+ )
887
+ )
888
+ )
889
+ );
890
+ }
891
+ function nt({
892
+ size: e = "sm",
893
+ icon: t = "line-md:close",
894
+ disabled: s,
895
+ roundedness: n = "full",
896
+ color: r = "base",
897
+ onClick: a,
898
+ label: i
899
+ }, ...o) {
900
+ return O(V, (l) => {
901
+ const h = G(i, l.$.closeModal);
902
+ return $e(
903
+ {
904
+ variant: "text",
905
+ size: e,
906
+ roundedness: n,
907
+ disabled: s,
908
+ color: r,
909
+ onClick: a
910
+ },
911
+ c.title(h),
912
+ k.label(h),
913
+ ...o,
914
+ B({ icon: t, size: e ?? "sm" })
915
+ );
916
+ });
917
+ }
918
+ function Ae(e, t, s) {
919
+ const n = [
920
+ e ? "bc-base-input-container" : "bc-input-container"
921
+ ];
922
+ return t ? n.push(
923
+ e ? "bc-base-input-container--disabled" : "bc-input-container--disabled"
924
+ ) : n.push(
925
+ e ? "bc-base-input-container--default" : "bc-input-container--default"
926
+ ), s && n.push("bc-input-container--error"), n.join(" ");
927
+ }
928
+ const R = ({
929
+ baseContainer: e,
930
+ disabled: t,
931
+ input: s,
932
+ before: n,
933
+ after: r,
934
+ hasError: a,
935
+ focusableSelector: i = "input, select, textarea",
936
+ growInput: o = !0
937
+ }, ...l) => {
938
+ const h = P.map(t ?? !1, (d) => d);
939
+ return p.div(
940
+ ue((d) => {
941
+ const u = () => {
942
+ d.querySelector(i)?.focus();
943
+ };
944
+ return d.addEventListener("click", u), Z(() => d.removeEventListener("click", u));
945
+ }),
946
+ c.class(
947
+ I(
948
+ e,
949
+ h,
950
+ a ?? !1
951
+ )(
952
+ (d, u, b) => Ae(
953
+ d ?? !1,
954
+ u ?? !1,
955
+ b ?? !1
956
+ )
957
+ )
958
+ ),
959
+ n != null ? p.span(c.class("bc-input-container__before"), n) : null,
960
+ p.div(
961
+ c.class("bc-input-container__input"),
962
+ c.class(
963
+ P.map(
964
+ o,
965
+ (d) => d ? "bc-input-container__input--grow" : ""
966
+ )
967
+ ),
968
+ s
969
+ ),
970
+ r != null ? p.span(c.class("bc-input-container__after"), r) : null,
971
+ ...l
972
+ );
973
+ };
974
+ function H(e) {
975
+ return `bc-label bc-label--${e}`;
976
+ }
977
+ const rt = (...e) => p.span(c.class(H("emphasis")), ...e), xe = (...e) => p.span(c.class(H("default")), ...e), Le = (...e) => p.span(c.class(H("muted")), ...e), at = (...e) => p.span(c.class(H("error")), ...e), it = (e) => {
978
+ const { value: t, onBlur: s, onChange: n, placeholder: r, disabled: a, id: i } = e, o = i ?? ee("checkbox"), l = `${o}-label`, h = () => {
979
+ if (P.get(a ?? !1)) return;
980
+ const u = P.get(t);
981
+ n?.(!u);
982
+ }, d = (u) => {
983
+ P.get(a ?? !1) || (u.key === " " || u.key === "Enter") && (u.preventDefault(), h());
984
+ };
985
+ return R(
986
+ {
987
+ baseContainer: !0,
988
+ growInput: !1,
989
+ ...e,
990
+ input: p.span(
991
+ c.class("bc-checkbox-input"),
992
+ p.span(
993
+ c.class("bc-checkbox-input__checkbox"),
994
+ c.class(
995
+ P.map(
996
+ t,
997
+ (u) => u ? "bc-checkbox-input__checkbox--checked" : ""
998
+ )
999
+ ),
1000
+ c.class(
1001
+ P.map(
1002
+ a ?? !1,
1003
+ (u) => u ? "bc-checkbox-input__checkbox--disabled" : ""
1004
+ )
1005
+ ),
1006
+ c.id(o),
1007
+ c.role("checkbox"),
1008
+ c.tabindex(
1009
+ P.map(
1010
+ a ?? !1,
1011
+ (u) => u ? -1 : 0
1012
+ )
1013
+ ),
1014
+ k.checked(t),
1015
+ k.disabled(a),
1016
+ r != null ? k.labelledby(l) : v,
1017
+ y.keydown(d),
1018
+ s != null ? y.blur(s) : v
1019
+ ),
1020
+ r != null ? p.label(
1021
+ c.class("bc-checkbox-input__label"),
1022
+ c.id(l),
1023
+ c.for(o),
1024
+ Le(r)
1025
+ ) : v
1026
+ )
1027
+ },
1028
+ y.click(h)
1029
+ );
1030
+ }, z = ({
1031
+ autocomplete: e,
1032
+ autofocus: t,
1033
+ class: s,
1034
+ disabled: n,
1035
+ name: r,
1036
+ placeholder: a,
1037
+ id: i,
1038
+ required: o,
1039
+ hasError: l
1040
+ }) => M(
1041
+ c.autocomplete(e),
1042
+ c.autofocus(t),
1043
+ c.class(s),
1044
+ c.disabled(n),
1045
+ c.name(r ?? i),
1046
+ c.placeholder(a),
1047
+ c.id(i),
1048
+ k.required(o),
1049
+ l != null ? k.invalid(
1050
+ l ?? !1
1051
+ ) : null
1052
+ ), Be = p.span(
1053
+ c.class("bc-input-wrapper__required"),
1054
+ " *"
1055
+ );
1056
+ function Oe(e) {
1057
+ const t = ["bc-input-wrapper"];
1058
+ return e && t.push("bc-input-wrapper--horizontal"), t.join(" ");
1059
+ }
1060
+ function Ve(e, t) {
1061
+ const s = ["bc-input-wrapper__label-text"];
1062
+ return e ? s.push("bc-input-wrapper__label-text--error") : t ? s.push("bc-input-wrapper__label-text--disabled") : s.push("bc-input-wrapper__label-text--default"), s.join(" ");
1063
+ }
1064
+ const re = ({
1065
+ required: e,
1066
+ label: t,
1067
+ context: s,
1068
+ description: n,
1069
+ content: r,
1070
+ error: a,
1071
+ labelFor: i,
1072
+ hasError: o,
1073
+ disabled: l,
1074
+ horizontal: h
1075
+ }, ...d) => {
1076
+ const u = o ?? a != null, b = l ?? !1, g = h ?? !1, S = ee("input-wrapper"), m = n ? `${S}-description` : void 0, C = a != null ? `${S}-error` : void 0;
1077
+ return p.div(
1078
+ c.class(
1079
+ P.map(g, (E) => Oe(E))
1080
+ ),
1081
+ t != null || s != null ? p.div(
1082
+ c.class("bc-input-wrapper__header"),
1083
+ p.div(
1084
+ c.class("bc-input-wrapper__label-section"),
1085
+ p.label(
1086
+ c.class("bc-input-wrapper__label"),
1087
+ i != null ? c.for(i) : v,
1088
+ p.span(
1089
+ c.class(
1090
+ I(
1091
+ u,
1092
+ b
1093
+ )(
1094
+ (E, A) => Ve(
1095
+ E ?? !1,
1096
+ A ?? !1
1097
+ )
1098
+ )
1099
+ ),
1100
+ t
1101
+ ),
1102
+ t != null && e ? Be : v
1103
+ ),
1104
+ // Show description under label when horizontal
1105
+ T(
1106
+ I(
1107
+ g,
1108
+ n
1109
+ )((E, A) => E && A != null),
1110
+ () => p.div(
1111
+ c.class(
1112
+ "bc-input-wrapper__description bc-input-wrapper__description--under-label"
1113
+ ),
1114
+ c.id(m),
1115
+ n
1116
+ )
1117
+ )
1118
+ ),
1119
+ s != null ? xe(s) : v
1120
+ ) : v,
1121
+ p.div(
1122
+ c.class("bc-input-wrapper__content"),
1123
+ // Add data attributes to help inputs inherit accessibility information
1124
+ [m, C].filter(Boolean).length > 0 ? U.describedby(
1125
+ [m, C].filter(Boolean).join(" ")
1126
+ ) : v,
1127
+ e ? U.required("true") : v,
1128
+ T(u, () => U.invalid("true")),
1129
+ r
1130
+ ),
1131
+ // Show description at bottom only when not horizontal
1132
+ T(
1133
+ I(
1134
+ g,
1135
+ n
1136
+ )((E, A) => !E && A != null),
1137
+ () => p.div(
1138
+ c.class("bc-input-wrapper__description"),
1139
+ c.id(m),
1140
+ n
1141
+ )
1142
+ ),
1143
+ a != null ? T(
1144
+ u,
1145
+ () => p.div(
1146
+ c.class("bc-input-wrapper__error"),
1147
+ c.id(C),
1148
+ k.live("polite"),
1149
+ // Announce errors to screen readers
1150
+ c.role("alert"),
1151
+ // Mark as alert for immediate attention
1152
+ a
1153
+ )
1154
+ ) : null,
1155
+ ...d
1156
+ );
1157
+ };
1158
+ function ot(...e) {
1159
+ return p.div(c.class("bc-group"), ...e);
1160
+ }
1161
+ function lt(...e) {
1162
+ return p.div(c.class("bc-stack"), ...e);
1163
+ }
1164
+ const ct = (e) => {
1165
+ const t = {
1166
+ name: "email",
1167
+ autocomplete: "email",
1168
+ ...e
1169
+ }, {
1170
+ value: s,
1171
+ before: n,
1172
+ onBlur: r,
1173
+ onChange: a,
1174
+ onInput: i,
1175
+ placeholder: o
1176
+ } = t, l = n ?? B({
1177
+ icon: "line-md:email",
1178
+ size: "sm",
1179
+ color: "neutral"
1180
+ });
1181
+ return O(
1182
+ V,
1183
+ (h) => R({
1184
+ ...e,
1185
+ before: l,
1186
+ input: X.email(
1187
+ z(t),
1188
+ c.placeholder(G(o, h.$.emailPlaceholderText)),
1189
+ c.value(s),
1190
+ c.class("bc-input"),
1191
+ r != null ? y.blur($(r)) : v,
1192
+ a != null ? y.change($(a)) : v,
1193
+ i != null ? y.input($(i)) : v
1194
+ )
1195
+ })
1196
+ );
1197
+ }, ut = (e) => {
1198
+ const { value: t, onBlur: s, onChange: n, onInput: r } = e;
1199
+ return R({
1200
+ ...e,
1201
+ input: X.text(
1202
+ z(e),
1203
+ c.value(t),
1204
+ c.class("bc-input"),
1205
+ s != null ? y.blur($(s)) : v,
1206
+ n != null ? y.change($(n)) : v,
1207
+ r != null ? y.input($(r)) : v
1208
+ )
1209
+ });
1210
+ }, dt = (e) => {
1211
+ const {
1212
+ value: t,
1213
+ onBlur: s,
1214
+ onChange: n,
1215
+ onInput: r,
1216
+ before: a,
1217
+ after: i,
1218
+ hasError: o,
1219
+ disabled: l,
1220
+ autocomplete: h,
1221
+ placeholder: d,
1222
+ ...u
1223
+ } = e, b = {
1224
+ name: "password",
1225
+ disabled: l,
1226
+ ...u
1227
+ }, g = _(!0), S = I(
1228
+ g,
1229
+ h
1230
+ )((m, C) => m ? C ?? "current-password" : "off");
1231
+ return O(V, (m) => {
1232
+ const C = I(
1233
+ m.$.passwordPlaceholderText,
1234
+ g,
1235
+ d
1236
+ )((A, le, ce) => le ? "•••••••••••••••" : ce ?? A), E = p.button(
1237
+ c.class("bc-input-container__password-toggle bu-text-light-gray"),
1238
+ k.label(m.$.togglePasswordVisibility),
1239
+ y.click(() => g.update((A) => !A)),
1240
+ T(
1241
+ g,
1242
+ () => B({ icon: "line-md:watch" }),
1243
+ () => B({ icon: "line-md:watch-off" })
1244
+ )
1245
+ );
1246
+ return R({
1247
+ before: a,
1248
+ disabled: l,
1249
+ hasError: o,
1250
+ input: p.input(
1251
+ z({
1252
+ ...b,
1253
+ autocomplete: S,
1254
+ placeholder: C
1255
+ }),
1256
+ T(
1257
+ g,
1258
+ () => M(c.type("password")),
1259
+ () => M(c.type("text"))
1260
+ ),
1261
+ c.class("bc-input"),
1262
+ c.value(t),
1263
+ s != null ? y.blur($(s)) : v,
1264
+ n != null ? y.change($(n)) : v,
1265
+ r != null ? y.input($(r)) : v
1266
+ ),
1267
+ after: i != null ? M(E, i) : E
1268
+ });
1269
+ });
1270
+ }, je = (
1271
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1272
+ (e, t) => () => {
1273
+ e.markTouched(), t?.();
1274
+ }
1275
+ ), Ne = (e, t) => (s) => {
1276
+ e.change(s), t?.(s);
1277
+ };
1278
+ function ae(e, t) {
1279
+ const { controller: s, onBlur: n, onChange: r, ...a } = t;
1280
+ return e({
1281
+ id: s.name,
1282
+ disabled: s.disabled,
1283
+ value: s.value,
1284
+ hasError: s.errorVisible,
1285
+ ...a,
1286
+ onChange: Ne(s, r),
1287
+ onBlur: je(s, n)
1288
+ });
1289
+ }
1290
+ function ht(e, t, ...s) {
1291
+ return re(
1292
+ {
1293
+ ...t,
1294
+ content: ae(
1295
+ e,
1296
+ t
1297
+ )
1298
+ },
1299
+ ...s
1300
+ );
1301
+ }
1302
+ function Fe(e, t) {
1303
+ const { toInput: s, fromInput: n, controller: r, ...a } = t, i = r.transform(s, n);
1304
+ return ae(e, {
1305
+ ...a,
1306
+ controller: i
1307
+ });
1308
+ }
1309
+ function pt(e, t, ...s) {
1310
+ return re(
1311
+ {
1312
+ ...t,
1313
+ content: Fe(e, t)
1314
+ },
1315
+ ...s
1316
+ );
1317
+ }
1318
+ function ft(e) {
1319
+ return e.split(".").map((s) => {
1320
+ const n = s.match(/^\[(\d+)\]$/);
1321
+ return n ? Number(n[1]) : s;
1322
+ });
1323
+ }
1324
+ function qe(e) {
1325
+ return typeof e == "number" ? `[${e}]` : `.${e}`;
1326
+ }
1327
+ function Re(e) {
1328
+ if (e.length === 0) return "";
1329
+ const [t, ...s] = e;
1330
+ return [
1331
+ typeof t == "number" ? `[${t}]` : t,
1332
+ ...s.map(qe)
1333
+ ].join("");
1334
+ }
1335
+ function q(e) {
1336
+ return function(s) {
1337
+ if (s.type === "valid") return s;
1338
+ let n = s.error;
1339
+ for (const r of e)
1340
+ if (n = n?.dependencies?.[r], n == null) return D.valid;
1341
+ return D.invalid(n);
1342
+ };
1343
+ }
1344
+ class x {
1345
+ path;
1346
+ change;
1347
+ value;
1348
+ status;
1349
+ error;
1350
+ hasError;
1351
+ touched;
1352
+ errorVisible;
1353
+ dirty;
1354
+ dependencyErrors;
1355
+ #e = {
1356
+ disabled: _(!1),
1357
+ touched: _(!1)
1358
+ };
1359
+ #s;
1360
+ #t = _(void 0);
1361
+ parent;
1362
+ disabled;
1363
+ #n = [];
1364
+ disabledOrHasErrors;
1365
+ constructor(t, s, n, r, a, i = L) {
1366
+ this.path = t, this.change = s, this.value = n, this.status = r, this.#s = i, this.#t.set(n.value), this.error = r.map(
1367
+ (o) => o?.type === "invalid" ? o.error?.message : void 0
1368
+ ), this.hasError = this.error.map((o) => o != null), this.touched = this.#e.touched, a.validationMode ? this.errorVisible = I(
1369
+ this.hasError,
1370
+ this.touched,
1371
+ a.validationMode
1372
+ )((o, l, h) => h === "continuous" ? !!o : !!o && !!l) : this.errorVisible = I(
1373
+ this.hasError,
1374
+ this.touched
1375
+ )((o, l) => !!o && !!l), this.dirty = I(
1376
+ this.value,
1377
+ this.#t
1378
+ )((o, l) => !this.#s(o, l)), this.dependencyErrors = r.map(
1379
+ (o) => o?.type === "invalid" ? o.error?.dependencies : void 0
1380
+ ), this.parent = a, this.disabled = I(
1381
+ this.#e.disabled,
1382
+ a.disabled
1383
+ )((o, l) => o || l), this.disabledOrHasErrors = I(
1384
+ this.disabled,
1385
+ this.hasError
1386
+ )((o, l) => o || l), this.onDispose(() => {
1387
+ this.#e.disabled.dispose(), this.#e.touched.dispose(), this.disabled.dispose(), this.error.dispose(), this.errorVisible.dispose(), this.dirty.dispose(), this.#t.dispose(), this.dependencyErrors.dispose(), this.disabledOrHasErrors.dispose();
1388
+ });
1389
+ }
1390
+ get name() {
1391
+ return Re(this.path);
1392
+ }
1393
+ onDispose = (t) => {
1394
+ this.#n.push(t);
1395
+ };
1396
+ dispose = () => {
1397
+ for (const t of this.#n)
1398
+ try {
1399
+ t();
1400
+ } catch (s) {
1401
+ console.error("Error in dispose callback:", s);
1402
+ }
1403
+ this.#n.length = 0;
1404
+ };
1405
+ setDisabled = (t) => {
1406
+ this.#e.disabled.set(t);
1407
+ };
1408
+ disable = () => this.setDisabled(!0);
1409
+ enable = () => this.setDisabled(!1);
1410
+ markTouched = () => {
1411
+ this.#e.touched.set(!0);
1412
+ };
1413
+ resetTouched = () => {
1414
+ this.#e.touched.set(!1);
1415
+ };
1416
+ markPristine = () => {
1417
+ this.#t.set(this.value.value);
1418
+ };
1419
+ reset = () => {
1420
+ this.change(this.#t.value);
1421
+ };
1422
+ array = (t = L) => new Ue(
1423
+ this.path,
1424
+ this.change,
1425
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1426
+ this.value,
1427
+ this.status,
1428
+ this.parent,
1429
+ t
1430
+ );
1431
+ object = (t = L) => new He(
1432
+ this.path,
1433
+ this.change,
1434
+ this.value,
1435
+ this.status,
1436
+ this.parent,
1437
+ t
1438
+ );
1439
+ transform = (t, s, n = [], r = L) => new x(
1440
+ [...this.path, ...n],
1441
+ (a) => this.change(s(a)),
1442
+ this.value.map(t, r),
1443
+ this.status.map(q(n)),
1444
+ this.parent,
1445
+ r
1446
+ );
1447
+ asyncTransform = (t, s, n, r = [], a = L) => new x(
1448
+ [...this.path, ...r],
1449
+ (i) => {
1450
+ s(i).then((o) => this.change(o));
1451
+ },
1452
+ this.value.mapAsync(t, n, void 0, a),
1453
+ this.status.map(q(r)),
1454
+ this.parent,
1455
+ a
1456
+ );
1457
+ }
1458
+ class He extends x {
1459
+ #e = /* @__PURE__ */ new Map();
1460
+ #s = /* @__PURE__ */ new Map();
1461
+ #t = /* @__PURE__ */ new Map();
1462
+ #n = _(!1);
1463
+ touchedDeep = this.#n;
1464
+ #a = /* @__PURE__ */ new Map();
1465
+ #r = /* @__PURE__ */ new Map();
1466
+ #o = _(!1);
1467
+ dirtyDeep = this.#o;
1468
+ #c;
1469
+ #u;
1470
+ #l = () => {
1471
+ let t = !1;
1472
+ for (const s of this.#s.values())
1473
+ if (s) {
1474
+ t = !0;
1475
+ break;
1476
+ }
1477
+ this.#n.set(this.touched.value || t);
1478
+ };
1479
+ constructor(t, s, n, r, a, i) {
1480
+ super(
1481
+ t,
1482
+ s,
1483
+ n.map((l) => l ?? {}, i),
1484
+ r,
1485
+ a,
1486
+ i
1487
+ ), this.#c = this.touched.on(() => {
1488
+ this.#l();
1489
+ }), this.#u = this.dirty.on(() => {
1490
+ this.#i();
1491
+ });
1492
+ const o = this.value.on(() => this.#i());
1493
+ this.onDispose(() => {
1494
+ for (const l of this.#e.values())
1495
+ l.dispose();
1496
+ this.#e.clear();
1497
+ for (const l of this.#t.values()) l();
1498
+ this.#t.clear(), this.#s.clear(), this.#n.dispose();
1499
+ for (const l of this.#r.values()) l();
1500
+ this.#r.clear(), this.#a.clear(), this.#o.dispose(), this.#c(), this.#u(), o();
1501
+ });
1502
+ }
1503
+ field = (t) => {
1504
+ if (this.#e.has(t))
1505
+ return this.#e.get(t);
1506
+ const s = async (i) => {
1507
+ this.change({
1508
+ ...this.value.value,
1509
+ [t]: i
1510
+ });
1511
+ }, n = new x(
1512
+ [...this.path, t],
1513
+ s,
1514
+ this.value.map((i) => i[t]),
1515
+ this.status.map(q([t])),
1516
+ {
1517
+ disabled: this.disabled,
1518
+ // propagate validationMode to children if present
1519
+ validationMode: this.parent.validationMode
1520
+ }
1521
+ );
1522
+ this.#e.set(t, n);
1523
+ const r = n.touched.on((i) => {
1524
+ this.#s.set(t, i), this.#l();
1525
+ });
1526
+ this.#t.set(t, r);
1527
+ const a = n.dirty.on((i) => {
1528
+ this.#a.set(t, i), this.#i();
1529
+ });
1530
+ return this.#r.set(t, a), n;
1531
+ };
1532
+ markAllTouched = () => {
1533
+ this.markTouched();
1534
+ const t = this.value.value;
1535
+ for (const s of Object.keys(t))
1536
+ this.field(s).markTouched();
1537
+ for (const s of this.#e.values())
1538
+ s.markTouched();
1539
+ };
1540
+ markAllPristine = () => {
1541
+ this.markPristine();
1542
+ const t = this.value.value;
1543
+ for (const s of Object.keys(t))
1544
+ this.field(s).markPristine?.();
1545
+ for (const s of this.#e.values())
1546
+ s.markPristine?.();
1547
+ };
1548
+ #i = () => {
1549
+ let t = !1;
1550
+ for (const s of this.#a.values())
1551
+ if (s) {
1552
+ t = !0;
1553
+ break;
1554
+ }
1555
+ this.#o.set(this.dirty.value || t);
1556
+ };
1557
+ }
1558
+ class Ue extends x {
1559
+ #e = new Array();
1560
+ length;
1561
+ #s = /* @__PURE__ */ new Map();
1562
+ #t = /* @__PURE__ */ new Map();
1563
+ #n = _(!1);
1564
+ touchedDeep = this.#n;
1565
+ #a = /* @__PURE__ */ new Map();
1566
+ #r = /* @__PURE__ */ new Map();
1567
+ #o = _(!1);
1568
+ dirtyDeep = this.#o;
1569
+ #c;
1570
+ #u;
1571
+ #l = () => {
1572
+ let t = !1;
1573
+ for (const s of this.#s.values())
1574
+ if (s) {
1575
+ t = !0;
1576
+ break;
1577
+ }
1578
+ this.#n.set(this.touched.value || t);
1579
+ };
1580
+ constructor(t, s, n, r, a, i) {
1581
+ const o = n.map((d) => d ?? [], i);
1582
+ super(t, s, o, r, a, i);
1583
+ const l = o.on((d) => {
1584
+ const u = this.#e.length - d.length;
1585
+ u > 0 && (this.#e.splice(d.length, u).forEach((b, g) => {
1586
+ const S = d.length + g;
1587
+ b.dispose(), this.#t.get(S)?.(), this.#t.delete(S), this.#s.delete(S), this.#r.get(S)?.(), this.#r.delete(S), this.#a.delete(S);
1588
+ }), this.#l(), this.#i());
1589
+ });
1590
+ this.length = o.map((d) => d.length), this.#c = this.touched.on(() => {
1591
+ this.#l();
1592
+ }), this.#u = this.dirty.on(() => {
1593
+ this.#i();
1594
+ });
1595
+ const h = this.value.on(() => this.#i());
1596
+ this.onDispose(() => {
1597
+ for (const d of this.#e)
1598
+ d.dispose();
1599
+ this.length.dispose(), this.#e.length = 0, l(), o.dispose();
1600
+ for (const d of this.#t.values()) d();
1601
+ this.#t.clear(), this.#s.clear(), this.#n.dispose();
1602
+ for (const d of this.#r.values()) d();
1603
+ this.#r.clear(), this.#a.clear(), this.#o.dispose(), this.#c(), this.#u(), h();
1604
+ });
1605
+ }
1606
+ item = (t) => {
1607
+ if (this.#e[t])
1608
+ return this.#e[t];
1609
+ const s = async (i) => {
1610
+ const o = this.value.value.slice();
1611
+ o[t] = i, this.change(o);
1612
+ }, n = new x(
1613
+ [...this.path, t],
1614
+ s,
1615
+ this.value.map((i) => i[t]),
1616
+ this.status.map(q([t])),
1617
+ {
1618
+ disabled: this.disabled,
1619
+ validationMode: this.parent.validationMode
1620
+ }
1621
+ );
1622
+ this.#e[t] = n;
1623
+ const r = n.touched.on((i) => {
1624
+ this.#s.set(t, i), this.#l();
1625
+ });
1626
+ this.#t.set(t, r);
1627
+ const a = n.dirty.on((i) => {
1628
+ this.#a.set(t, i), this.#i();
1629
+ });
1630
+ return this.#r.set(t, a), n;
1631
+ };
1632
+ push = (...t) => {
1633
+ this.change([...this.value.value, ...t]);
1634
+ };
1635
+ pop = () => {
1636
+ this.splice(this.value.value.length - 1, 1);
1637
+ };
1638
+ shift = () => {
1639
+ this.splice(0, 1);
1640
+ };
1641
+ unshift = (...t) => {
1642
+ this.change([...t, ...this.value.value]);
1643
+ };
1644
+ removeAt = (t) => {
1645
+ this.splice(t, 1);
1646
+ };
1647
+ splice = (t, s) => {
1648
+ const n = this.value.value.slice();
1649
+ n.splice(t, s), this.change(n);
1650
+ };
1651
+ move = (t, s, n = 1) => {
1652
+ if (n < 1 || t === s) return;
1653
+ const r = this.value.value.slice(), a = r.splice(t, n);
1654
+ r.splice(s, 0, ...a), this.change(r);
1655
+ };
1656
+ markAllTouched = () => {
1657
+ this.markTouched();
1658
+ const t = this.value.value.length;
1659
+ for (let s = 0; s < t; s++)
1660
+ this.item(s).markTouched();
1661
+ };
1662
+ markAllPristine = () => {
1663
+ this.markPristine();
1664
+ const t = this.value.value.length;
1665
+ for (let s = 0; s < t; s++)
1666
+ this.item(s).markPristine?.();
1667
+ };
1668
+ #i = () => {
1669
+ let t = !1;
1670
+ for (const s of this.#a.values())
1671
+ if (s) {
1672
+ t = !0;
1673
+ break;
1674
+ }
1675
+ this.#o.set(this.dirty.value || t);
1676
+ };
1677
+ }
1678
+ function Ge(e) {
1679
+ function t(s) {
1680
+ return typeof s == "number" ? s : s.toString();
1681
+ }
1682
+ return e.map(
1683
+ (s) => typeof s == "object" && s.key != null ? t(s.key) : t(s)
1684
+ );
1685
+ }
1686
+ function ze(e) {
1687
+ const t = e.filter((r) => r.path == null || r.path.length === 0).map((r) => r.message), s = e.filter((r) => r.path != null && r.path.length > 0).reduce((r, a) => {
1688
+ const i = Ge(a.path), o = i.pop();
1689
+ let l = r;
1690
+ for (const h of i)
1691
+ l.dependencies == null && (l.dependencies = {}), l.dependencies[h] == null && (l.dependencies[h] = {}), l = l.dependencies[h];
1692
+ return l.dependencies == null && (l.dependencies = {}), l.dependencies[o] = { message: a.message }, r;
1693
+ }, {}), n = t.join(`
1694
+ `);
1695
+ return {
1696
+ ...s,
1697
+ message: n != "" ? n : void 0
1698
+ };
1699
+ }
1700
+ function We({
1701
+ initialValue: e,
1702
+ onChange: t,
1703
+ validate: s,
1704
+ equals: n,
1705
+ validationMode: r,
1706
+ validateDebounceMs: a
1707
+ }) {
1708
+ const i = P.deriveProp(e), o = _(D.valid), l = _(!1), h = _(r ?? "touchedOrSubmit"), d = (m) => {
1709
+ o.set(m);
1710
+ };
1711
+ let u;
1712
+ const b = async (m) => {
1713
+ if (s != null) {
1714
+ const C = await s(m);
1715
+ d(C);
1716
+ }
1717
+ }, g = async (m) => {
1718
+ i.set(m), t?.(m);
1719
+ const C = h.value;
1720
+ if (s != null) {
1721
+ if (C === "onSubmit")
1722
+ return;
1723
+ const E = a ?? 0;
1724
+ E > 0 ? (u && clearTimeout(u), u = setTimeout(() => {
1725
+ b(m);
1726
+ }, E)) : await b(m);
1727
+ }
1728
+ }, S = new x(
1729
+ [],
1730
+ g,
1731
+ i,
1732
+ o,
1733
+ {
1734
+ disabled: l,
1735
+ validationMode: h
1736
+ },
1737
+ n ?? L
1738
+ );
1739
+ return S.onDispose(() => {
1740
+ l.dispose(), i.dispose(), o.dispose(), h.dispose(), u && clearTimeout(u);
1741
+ }), { controller: S, setStatus: d };
1742
+ }
1743
+ function ie(e) {
1744
+ return M(c.disabled(e.disabled), c.name(e.name));
1745
+ }
1746
+ function mt(e, {
1747
+ triggerOn: t = "change"
1748
+ } = {}) {
1749
+ return M(
1750
+ ie(e),
1751
+ c.value(e.value),
1752
+ (t === "input" ? y.input : y.change)($(e.change))
1753
+ );
1754
+ }
1755
+ function bt(e, {
1756
+ triggerOn: t = "change"
1757
+ } = {}) {
1758
+ return M(
1759
+ ie(e),
1760
+ c.valueAsNumber(e.value),
1761
+ (t === "input" ? y.input : y.change)(
1762
+ de(e.change)
1763
+ )
1764
+ );
1765
+ }
1766
+ function Q(e) {
1767
+ return e.issues != null ? D.invalid(ze(e.issues)) : D.valid;
1768
+ }
1769
+ async function gt({
1770
+ task: e,
1771
+ errorMessage: t,
1772
+ errorPath: s = ["root"],
1773
+ validation: n
1774
+ }) {
1775
+ try {
1776
+ const r = await e();
1777
+ return n != null ? n(r) : D.valid;
1778
+ } catch (r) {
1779
+ const a = t ?? (r instanceof Error ? r.message : "Operation failed");
1780
+ return s.length === 1 && s[0] === "root" ? D.invalid({
1781
+ message: a
1782
+ }) : D.invalid({
1783
+ dependencies: oe(s, a)
1784
+ });
1785
+ }
1786
+ }
1787
+ function oe(e, t) {
1788
+ if (e.length === 1)
1789
+ return {
1790
+ [e[0]]: { message: t }
1791
+ };
1792
+ const [s, ...n] = e;
1793
+ return {
1794
+ [s]: {
1795
+ dependencies: oe(n, t)
1796
+ }
1797
+ };
1798
+ }
1799
+ function vt({
1800
+ initialValue: e = {},
1801
+ schema: t,
1802
+ submit: s = async () => D.valid,
1803
+ validationMode: n,
1804
+ validateDebounceMs: r
1805
+ }) {
1806
+ const { controller: a, setStatus: i } = We({
1807
+ initialValue: e,
1808
+ validationMode: n ?? "touchedOrSubmit",
1809
+ validateDebounceMs: r,
1810
+ validate: (n ?? "touchedOrSubmit") === "onSubmit" ? void 0 : async (d) => Q(
1811
+ await t["~standard"].validate(d)
1812
+ )
1813
+ }), o = _(!1), l = a.object();
1814
+ return l.onDispose(o.dispose), {
1815
+ controller: l,
1816
+ setStatus: i,
1817
+ onSubmit: async (d) => {
1818
+ if (o.set(!0), d.preventDefault(), l.markAllTouched(), (n ?? "touchedOrSubmit") === "onSubmit") {
1819
+ const b = l.value.value, g = Q(
1820
+ await t["~standard"].validate(b)
1821
+ );
1822
+ if (i(g), g.type === "invalid") {
1823
+ o.set(!1);
1824
+ return;
1825
+ }
1826
+ }
1827
+ const u = await s(l.value.value);
1828
+ o.set(!1), u.type === "invalid" && i(u);
1829
+ },
1830
+ submitting: o
1831
+ };
1832
+ }
1833
+ function Ke(e) {
1834
+ const t = e.split("-"), s = [e];
1835
+ return t.length > 1 && s.push(t[0]), s;
1836
+ }
1837
+ function Je({
1838
+ locale: e,
1839
+ defaultLocale: t = "en-US",
1840
+ defaultMessages: s,
1841
+ localeLoader: n
1842
+ }) {
1843
+ const r = _(t), a = _(s), i = e.on(async (o) => {
1844
+ if (o === r.value) return;
1845
+ r.set(o);
1846
+ const l = Ke(o);
1847
+ for (const h of l)
1848
+ try {
1849
+ const d = await n(h);
1850
+ if (
1851
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1852
+ typeof d.default == "object" && Object.keys(d).length === 1
1853
+ ) {
1854
+ console.error(
1855
+ "It appears that you are trying to load a translation module without referencing the default export. Please use `(await import(...)).default` in your loader function."
1856
+ );
1857
+ return;
1858
+ }
1859
+ if (o === r.value) {
1860
+ a.set(d);
1861
+ return;
1862
+ }
1863
+ } catch {
1864
+ continue;
1865
+ }
1866
+ console.warn(`No locale found for "'${e}", using fallback`), o === r.value && a.set(s);
1867
+ });
1868
+ return {
1869
+ /** Clean up all resources and event listeners */
1870
+ dispose: () => {
1871
+ i(), r.dispose(), a.dispose();
1872
+ },
1873
+ /** Translation functions that return reactive signals */
1874
+ t: a
1875
+ };
1876
+ }
1877
+ function Qe({
1878
+ defaultLocale: e,
1879
+ defaultMessages: t,
1880
+ localeLoader: s,
1881
+ providerName: n = "I18nProvider"
1882
+ }) {
1883
+ return {
1884
+ mark: Y(n),
1885
+ create: (r, a) => {
1886
+ const {
1887
+ value: { locale: i }
1888
+ } = a.getProvider(Se.mark), { t: o, dispose: l } = Je({
1889
+ locale: i,
1890
+ defaultMessages: t,
1891
+ defaultLocale: e,
1892
+ localeLoader: s
1893
+ });
1894
+ return {
1895
+ value: o,
1896
+ dispose: l
1897
+ };
1898
+ }
1899
+ };
1900
+ }
1901
+ const V = Qe({
1902
+ defaultLocale: ge,
1903
+ defaultMessages: be,
1904
+ localeLoader: async (e) => (await ve(/* @__PURE__ */ Object.assign({ "./locales/ar.ts": () => import("./ar-RkpJ2n6w.js"), "./locales/de.ts": () => import("./de-BdSVR4Zm.js"), "./locales/en.ts": () => Promise.resolve().then(() => me), "./locales/es.ts": () => import("./es-B_Qn5EUy.js"), "./locales/fa.ts": () => import("./fa-jBaLjqfG.js"), "./locales/fr.ts": () => import("./fr-B0KaMM2j.js"), "./locales/he.ts": () => import("./he-DjeYjcW7.js"), "./locales/hi.ts": () => import("./hi-DxBQV0uz.js"), "./locales/it.ts": () => import("./it-B4qZsicu.js"), "./locales/ja.ts": () => import("./ja-BnCSmhkg.js"), "./locales/ko.ts": () => import("./ko-D_gGkjrC.js"), "./locales/nl.ts": () => import("./nl-CsLCWUFF.js"), "./locales/pl.ts": () => import("./pl-Bsmj1KbZ.js"), "./locales/pt.ts": () => import("./pt-BR_NuRJS.js"), "./locales/ru.ts": () => import("./ru-CiQ_qKD_.js"), "./locales/tr.ts": () => import("./tr-Q9xP1nE4.js"), "./locales/ur.ts": () => import("./ur-CGTjSoJt.js"), "./locales/vi.ts": () => import("./vi-BF3HTFU9.js"), "./locales/zh.ts": () => import("./zh-BreM8U2w.js") }), `./locales/${e}.ts`, 3)).default,
1905
+ providerName: "BeatUII18n"
1906
+ });
1907
+ export {
1908
+ Je as $,
1909
+ qe as A,
1910
+ V as B,
1911
+ nt as C,
1912
+ Re as D,
1913
+ ct as E,
1914
+ He as F,
1915
+ ot as G,
1916
+ Ue as H,
1917
+ B as I,
1918
+ Ge as J,
1919
+ ze as K,
1920
+ xe as L,
1921
+ pt as M,
1922
+ We as N,
1923
+ L as O,
1924
+ dt as P,
1925
+ ie as Q,
1926
+ Be as R,
1927
+ lt as S,
1928
+ ut as T,
1929
+ mt as U,
1930
+ bt as V,
1931
+ Q as W,
1932
+ rt as X,
1933
+ Le as Y,
1934
+ at as Z,
1935
+ ve as _,
1936
+ $e as a,
1937
+ se as a0,
1938
+ we as a1,
1939
+ Xe as a2,
1940
+ et as a3,
1941
+ tt as a4,
1942
+ ke as a5,
1943
+ st as a6,
1944
+ D as b,
1945
+ it as c,
1946
+ ht as d,
1947
+ R as e,
1948
+ K as f,
1949
+ z as g,
1950
+ je as h,
1951
+ Ne as i,
1952
+ re as j,
1953
+ be as k,
1954
+ Se as l,
1955
+ Qe as m,
1956
+ x as n,
1957
+ q as o,
1958
+ ae as p,
1959
+ Pe as q,
1960
+ ge as r,
1961
+ ee as s,
1962
+ gt as t,
1963
+ vt as u,
1964
+ ne as v,
1965
+ _e as w,
1966
+ Ce as x,
1967
+ Fe as y,
1968
+ ft as z
1969
+ };