@editora/ui-core 0.1.19 → 0.1.20

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 (299) hide show
  1. package/dist/{ElementBase-1b301e7f.js → ElementBase-EV6mVBUV.js} +1 -1
  2. package/dist/{ElementBase-909688f3.mjs → ElementBase-YlTLMsGk.mjs} +3 -3
  3. package/dist/accordion.cjs.js +3 -3
  4. package/dist/accordion.esm.js +39 -62
  5. package/dist/alert-dialog.cjs.js +19 -19
  6. package/dist/alert-dialog.esm.js +69 -87
  7. package/dist/alert.cjs.js +1 -1
  8. package/dist/alert.esm.js +4 -7
  9. package/dist/anchor.cjs.js +2 -2
  10. package/dist/anchor.esm.js +3 -3
  11. package/dist/animated-beam.cjs.js +83 -83
  12. package/dist/animated-beam.esm.js +250 -277
  13. package/dist/animated-list.cjs.js +4 -4
  14. package/dist/animated-list.esm.js +47 -61
  15. package/dist/animated-text.cjs.js +2 -2
  16. package/dist/animated-text.esm.js +13 -24
  17. package/dist/app-header.cjs.js +3 -3
  18. package/dist/app-header.esm.js +11 -13
  19. package/dist/aspect-ratio.cjs.js +1 -1
  20. package/dist/aspect-ratio.esm.js +4 -7
  21. package/dist/avatar.cjs.js +1 -1
  22. package/dist/avatar.esm.js +7 -13
  23. package/dist/badge.cjs.js +1 -1
  24. package/dist/badge.esm.js +4 -7
  25. package/dist/block-controls.cjs.js +2 -2
  26. package/dist/block-controls.esm.js +19 -35
  27. package/dist/box.cjs.js +1 -1
  28. package/dist/box.esm.js +8 -15
  29. package/dist/breadcrumb.cjs.js +2 -2
  30. package/dist/breadcrumb.esm.js +20 -37
  31. package/dist/button.cjs.js +1 -521
  32. package/dist/button.esm.js +2 -671
  33. package/dist/{calendar-2c11b824.mjs → calendar-DLY4acgn.mjs} +293 -342
  34. package/dist/{calendar-a8735e40.js → calendar-Dkof-FTK.js} +25 -25
  35. package/dist/calendar.cjs.js +1 -1
  36. package/dist/calendar.esm.js +8 -9
  37. package/dist/card.cjs.js +4 -4
  38. package/dist/card.esm.js +13 -19
  39. package/dist/chart.cjs.js +64 -64
  40. package/dist/chart.esm.js +223 -254
  41. package/dist/checkbox.cjs.js +1 -1
  42. package/dist/checkbox.esm.js +2 -3
  43. package/dist/collapsible.cjs.js +1 -1
  44. package/dist/collapsible.esm.js +5 -9
  45. package/dist/{collection-a1aac0c6.mjs → collection-C7URGjEI.mjs} +8 -14
  46. package/dist/collection.cjs.js +1 -1
  47. package/dist/collection.esm.js +4 -7
  48. package/dist/color-picker.cjs.js +9 -9
  49. package/dist/color-picker.esm.js +189 -252
  50. package/dist/combobox.cjs.js +13 -13
  51. package/dist/combobox.esm.js +93 -126
  52. package/dist/command-palette.cjs.js +3 -3
  53. package/dist/command-palette.esm.js +19 -30
  54. package/dist/command.cjs.js +4 -4
  55. package/dist/command.esm.js +41 -53
  56. package/dist/components/ui-orbiter.d.ts.map +1 -1
  57. package/dist/components/ui-skeleton.d.ts.map +1 -1
  58. package/dist/components/ui-split-button.d.ts +1 -0
  59. package/dist/components/ui-split-button.d.ts.map +1 -1
  60. package/dist/components/ui-time-picker.d.ts.map +1 -1
  61. package/dist/container.cjs.js +2 -2
  62. package/dist/container.esm.js +2 -3
  63. package/dist/context-menu.cjs.js +8 -8
  64. package/dist/context-menu.esm.js +157 -219
  65. package/dist/control-group.cjs.js +1 -1
  66. package/dist/control-group.esm.js +2 -3
  67. package/dist/data-table.cjs.js +4 -4
  68. package/dist/data-table.esm.js +299 -381
  69. package/dist/date-field.cjs.js +3 -3
  70. package/dist/date-field.esm.js +68 -80
  71. package/dist/date-picker.cjs.js +9 -9
  72. package/dist/date-picker.esm.js +69 -97
  73. package/dist/date-range-picker.cjs.js +3 -3
  74. package/dist/date-range-picker.esm.js +32 -56
  75. package/dist/date-range-time-picker.cjs.js +9 -9
  76. package/dist/date-range-time-picker.esm.js +111 -140
  77. package/dist/date-time-picker.cjs.js +4 -4
  78. package/dist/date-time-picker.esm.js +112 -144
  79. package/dist/date-time-utils-Dmost5Ee.js +1 -0
  80. package/dist/date-time-utils-y1N2gvG2.mjs +268 -0
  81. package/dist/description.cjs.js +1 -1
  82. package/dist/description.esm.js +3 -5
  83. package/dist/dialog.cjs.js +12 -12
  84. package/dist/dialog.esm.js +44 -63
  85. package/dist/direction-provider.cjs.js +1 -1
  86. package/dist/direction-provider.esm.js +2 -3
  87. package/dist/{dismissable-layer-9c7e6b58.mjs → dismissable-layer-BmPIoK80.mjs} +29 -33
  88. package/dist/dismissable-layer-DNfrKA20.js +1 -0
  89. package/dist/dismissable-layer.cjs.js +2 -2
  90. package/dist/dismissable-layer.esm.js +4 -6
  91. package/dist/dock.cjs.js +5 -5
  92. package/dist/dock.esm.js +134 -155
  93. package/dist/drawer.cjs.js +2 -2
  94. package/dist/drawer.esm.js +18 -35
  95. package/dist/dropdown.cjs.js +2 -2
  96. package/dist/dropdown.esm.js +119 -149
  97. package/dist/dropzone.cjs.js +1 -1
  98. package/dist/dropzone.esm.js +0 -1
  99. package/dist/empty-state.cjs.js +1 -1
  100. package/dist/empty-state.esm.js +1 -1
  101. package/dist/field-error.cjs.js +1 -1
  102. package/dist/field-error.esm.js +3 -5
  103. package/dist/field.cjs.js +5 -5
  104. package/dist/field.esm.js +27 -34
  105. package/dist/fieldset.cjs.js +4 -4
  106. package/dist/fieldset.esm.js +19 -24
  107. package/dist/file-upload.cjs.js +4 -4
  108. package/dist/file-upload.esm.js +69 -93
  109. package/dist/flex.cjs.js +1 -1
  110. package/dist/flex.esm.js +5 -9
  111. package/dist/floating-toolbar.cjs.js +4 -4
  112. package/dist/floating-toolbar.esm.js +60 -85
  113. package/dist/focus-scope-Bwug2gDv.js +1 -0
  114. package/dist/{focus-scope-103833ee.mjs → focus-scope-CmEsG5UZ.mjs} +39 -48
  115. package/dist/focus-scope.cjs.js +2 -2
  116. package/dist/focus-scope.esm.js +15 -20
  117. package/dist/form.cjs.js +2 -2
  118. package/dist/form.esm.js +26 -53
  119. package/dist/gantt.cjs.js +43 -43
  120. package/dist/gantt.esm.js +295 -322
  121. package/dist/grid.cjs.js +1 -1
  122. package/dist/grid.esm.js +5 -9
  123. package/dist/hover-card.cjs.js +4 -4
  124. package/dist/hover-card.esm.js +22 -28
  125. package/dist/icon-cloud.cjs.js +7 -7
  126. package/dist/icon-cloud.esm.js +48 -62
  127. package/dist/icon.cjs.js +1 -1
  128. package/dist/icon.esm.js +2 -4
  129. package/dist/index.cjs.js +1 -1
  130. package/dist/index.esm.js +378 -390
  131. package/dist/inline-edit.cjs.js +11 -11
  132. package/dist/inline-edit.esm.js +32 -36
  133. package/dist/input.cjs.js +17 -17
  134. package/dist/input.esm.js +50 -63
  135. package/dist/label.cjs.js +2 -2
  136. package/dist/label.esm.js +8 -17
  137. package/dist/layout.cjs.js +2 -2
  138. package/dist/layout.esm.js +20 -26
  139. package/dist/listbox-B6QgECax.js +46 -0
  140. package/dist/listbox-DJamVeFj.mjs +200 -0
  141. package/dist/listbox.cjs.js +1 -1
  142. package/dist/listbox.esm.js +2 -4
  143. package/dist/marquee.cjs.js +5 -5
  144. package/dist/marquee.esm.js +33 -50
  145. package/dist/masonry-grid.cjs.js +1 -1
  146. package/dist/masonry-grid.esm.js +5 -9
  147. package/dist/menu.cjs.js +3 -3
  148. package/dist/menu.esm.js +106 -126
  149. package/dist/menubar.cjs.js +5 -5
  150. package/dist/menubar.esm.js +118 -164
  151. package/dist/meter.cjs.js +2 -2
  152. package/dist/meter.esm.js +4 -4
  153. package/dist/multi-select.cjs.js +4 -4
  154. package/dist/multi-select.esm.js +120 -140
  155. package/dist/navigation-menu.cjs.js +4 -4
  156. package/dist/navigation-menu.esm.js +44 -55
  157. package/dist/number-field.cjs.js +2 -2
  158. package/dist/number-field.esm.js +73 -98
  159. package/dist/number-ticker.cjs.js +3 -3
  160. package/dist/number-ticker.esm.js +22 -43
  161. package/dist/odometer.cjs.js +1 -1
  162. package/dist/odometer.esm.js +5 -9
  163. package/dist/orbiter.cjs.js +13 -13
  164. package/dist/orbiter.esm.js +79 -90
  165. package/dist/{overlayManager-5bbd4dc3.mjs → overlayManager-BJjU1VA8.mjs} +4 -5
  166. package/dist/{overlayManager-0eda4e08.js → overlayManager-CSy3fJmJ.js} +1 -1
  167. package/dist/pagination.cjs.js +2 -2
  168. package/dist/pagination.esm.js +14 -18
  169. package/dist/{panel-group-a376cc5e.mjs → panel-group-8sVNnGxg.mjs} +24 -46
  170. package/dist/panel-group-CaD0_KQf.js +36 -0
  171. package/dist/panel-group.cjs.js +1 -1
  172. package/dist/panel-group.esm.js +2 -5
  173. package/dist/panel.cjs.js +4 -4
  174. package/dist/panel.esm.js +8 -10
  175. package/dist/password-field.cjs.js +9 -9
  176. package/dist/password-field.esm.js +62 -82
  177. package/dist/pin-input.cjs.js +3 -3
  178. package/dist/pin-input.esm.js +33 -39
  179. package/dist/placement-grid.cjs.js +4 -4
  180. package/dist/placement-grid.esm.js +108 -131
  181. package/dist/plugin-panel.cjs.js +7 -7
  182. package/dist/plugin-panel.esm.js +13 -15
  183. package/dist/popover.cjs.js +2 -2
  184. package/dist/popover.esm.js +21 -31
  185. package/dist/portal-DgpQ3Jo1.js +1 -0
  186. package/dist/{portal-fe73e5cc.mjs → portal-bR42gHvG.mjs} +43 -48
  187. package/dist/portal.cjs.js +2 -2
  188. package/dist/portal.esm.js +10 -19
  189. package/dist/{positioner-e9770c66.mjs → positioner-D0VGxtYU.mjs} +189 -209
  190. package/dist/positioner-D_fqyx_j.js +1 -0
  191. package/dist/positioner.cjs.js +2 -2
  192. package/dist/positioner.esm.js +11 -18
  193. package/dist/presence.cjs.js +1 -1
  194. package/dist/presence.esm.js +7 -13
  195. package/dist/progress.cjs.js +1 -1
  196. package/dist/progress.esm.js +5 -9
  197. package/dist/quick-actions.cjs.js +6 -6
  198. package/dist/quick-actions.esm.js +52 -62
  199. package/dist/radio-group.cjs.js +13 -13
  200. package/dist/radio-group.esm.js +39 -51
  201. package/dist/radio.cjs.js +1 -1
  202. package/dist/radio.esm.js +5 -9
  203. package/dist/rating.cjs.js +1 -1
  204. package/dist/rating.esm.js +12 -23
  205. package/dist/{roving-focus-group-4350c9a7.mjs → roving-focus-group-Dbm1Jko_.mjs} +3 -6
  206. package/dist/roving-focus-group.cjs.js +1 -1
  207. package/dist/roving-focus-group.esm.js +3 -5
  208. package/dist/runtime-CTaOSmBj.js +1 -0
  209. package/dist/{runtime-161f68a2.mjs → runtime-D1gFh1fS.mjs} +338 -366
  210. package/dist/runtime.cjs.js +1 -1
  211. package/dist/runtime.esm.js +6 -6
  212. package/dist/scroll-area.cjs.js +3 -3
  213. package/dist/scroll-area.esm.js +38 -46
  214. package/dist/{scroll-lock-31da444f.mjs → scroll-lock-LfqXXqsu.mjs} +5 -9
  215. package/dist/section.cjs.js +1 -1
  216. package/dist/section.esm.js +1 -1
  217. package/dist/select.cjs.js +7 -7
  218. package/dist/select.esm.js +67 -97
  219. package/dist/selection-popup.cjs.js +1 -1
  220. package/dist/selection-popup.esm.js +8 -15
  221. package/dist/separator.cjs.js +1 -1
  222. package/dist/separator.esm.js +1 -1
  223. package/dist/sidebar.cjs.js +18 -18
  224. package/dist/sidebar.esm.js +117 -139
  225. package/dist/skeleton.cjs.js +11 -11
  226. package/dist/skeleton.esm.js +27 -24
  227. package/dist/slider.cjs.js +1 -1
  228. package/dist/slider.esm.js +6 -11
  229. package/dist/slot.cjs.js +4 -4
  230. package/dist/slot.esm.js +16 -19
  231. package/dist/sortable.cjs.js +45 -45
  232. package/dist/sortable.esm.js +421 -524
  233. package/dist/spinning-text.cjs.js +12 -12
  234. package/dist/spinning-text.esm.js +80 -92
  235. package/dist/split-button.cjs.js +4 -4
  236. package/dist/split-button.esm.js +77 -62
  237. package/dist/splitter.cjs.js +1 -1
  238. package/dist/splitter.esm.js +1 -1
  239. package/dist/stepper.cjs.js +8 -8
  240. package/dist/stepper.esm.js +32 -52
  241. package/dist/switch.cjs.js +7 -7
  242. package/dist/switch.esm.js +23 -31
  243. package/dist/table.cjs.js +2 -2
  244. package/dist/table.esm.js +46 -56
  245. package/dist/tabs.cjs.js +3 -3
  246. package/dist/tabs.esm.js +35 -55
  247. package/dist/tags-input.cjs.js +4 -4
  248. package/dist/tags-input.esm.js +45 -62
  249. package/dist/textarea.cjs.js +6 -6
  250. package/dist/textarea.esm.js +32 -41
  251. package/dist/time-field.cjs.js +4 -4
  252. package/dist/time-field.esm.js +70 -84
  253. package/dist/time-picker.cjs.js +22 -22
  254. package/dist/time-picker.esm.js +88 -110
  255. package/dist/timeline.cjs.js +1 -1
  256. package/dist/timeline.esm.js +3 -5
  257. package/dist/toast.cjs.js +2 -2
  258. package/dist/toast.esm.js +33 -47
  259. package/dist/toggle-group.cjs.js +6 -6
  260. package/dist/toggle-group.esm.js +85 -105
  261. package/dist/toggle.cjs.js +1 -1
  262. package/dist/toggle.esm.js +3 -5
  263. package/dist/toolbar.cjs.js +1 -1
  264. package/dist/toolbar.esm.js +13 -24
  265. package/dist/tooltip.cjs.js +2 -2
  266. package/dist/tooltip.esm.js +31 -42
  267. package/dist/transfer-list.cjs.js +19 -19
  268. package/dist/transfer-list.esm.js +98 -111
  269. package/dist/{tree-dcd74a4a.mjs → tree-B3kE8ESs.mjs} +55 -62
  270. package/dist/tree-Dx_kv_ih.js +39 -0
  271. package/dist/tree-item.cjs.js +2 -2
  272. package/dist/tree-item.esm.js +2 -3
  273. package/dist/tree.cjs.js +1 -1
  274. package/dist/tree.esm.js +2 -5
  275. package/dist/ui-button-Q0GNNWKC.mjs +665 -0
  276. package/dist/ui-button-rXQOS9QJ.js +521 -0
  277. package/dist/{icon-9e9da03b.js → ui-icon-BzVNC_lr.js} +4 -4
  278. package/dist/{icon-e2a85cc1.mjs → ui-icon-YI6lyuqU.mjs} +58 -65
  279. package/dist/visually-hidden.cjs.js +1 -1
  280. package/dist/visually-hidden.esm.js +1 -1
  281. package/dist/wizard.cjs.js +14 -14
  282. package/dist/wizard.esm.js +85 -105
  283. package/package.json +2 -2
  284. package/dist/date-time-utils-66480de4.js +0 -1
  285. package/dist/date-time-utils-a2c7af25.mjs +0 -307
  286. package/dist/dismissable-layer-193e3bed.js +0 -1
  287. package/dist/focus-scope-2b12b4e7.js +0 -1
  288. package/dist/listbox-308789a0.mjs +0 -210
  289. package/dist/listbox-ef2f708e.js +0 -46
  290. package/dist/panel-group-40254cdd.js +0 -36
  291. package/dist/portal-c69756c0.js +0 -1
  292. package/dist/positioner-33529bb8.js +0 -1
  293. package/dist/runtime-3f13807b.js +0 -1
  294. package/dist/tree-0a7a8d05.js +0 -39
  295. /package/dist/{collection-a2969ad2.js → collection-qv8A8rq4.js} +0 -0
  296. /package/dist/{menu-item-styles-27fdbac4.mjs → menu-item-styles-CZiPwPwl.mjs} +0 -0
  297. /package/dist/{menu-item-styles-83ad1e22.js → menu-item-styles-CbNUEwP2.js} +0 -0
  298. /package/dist/{roving-focus-group-5c059bf9.js → roving-focus-group-BdJ_4Njm.js} +0 -0
  299. /package/dist/{scroll-lock-d7b0df21.js → scroll-lock-BX6e3Ced.js} +0 -0
@@ -0,0 +1,268 @@
1
+ import { p as T, c as b, a as N, s as v, e as F } from "./calendar-DLY4acgn.mjs";
2
+ import { a as L } from "./scroll-lock-LfqXXqsu.mjs";
3
+ import { c as U } from "./positioner-D0VGxtYU.mjs";
4
+ const C = /* @__PURE__ */ new Map(), I = 24;
5
+ function D(t, n, e) {
6
+ return Math.max(n, Math.min(e, t));
7
+ }
8
+ function u(t) {
9
+ return String(t).padStart(2, "0");
10
+ }
11
+ function $(t) {
12
+ if (!/^-?\d+$/.test(t)) return null;
13
+ const n = Number(t);
14
+ return Number.isFinite(n) ? Math.trunc(n) : null;
15
+ }
16
+ function O(t) {
17
+ return t.replace(/[.\-]/g, "/").replace(/\s+/g, " ").trim();
18
+ }
19
+ function P(t) {
20
+ const n = [];
21
+ for (let e = 0; e < 12; e += 1)
22
+ n.push(
23
+ new Intl.DateTimeFormat(t, {
24
+ month: "short",
25
+ timeZone: "UTC"
26
+ }).format(new Date(Date.UTC(2024, e, 1)))
27
+ );
28
+ return n;
29
+ }
30
+ function A(t) {
31
+ const n = [];
32
+ for (let e = 0; e < 12; e += 1)
33
+ n.push(
34
+ new Intl.DateTimeFormat(t, {
35
+ month: "long",
36
+ timeZone: "UTC"
37
+ }).format(new Date(Date.UTC(2024, e, 1)))
38
+ );
39
+ return n;
40
+ }
41
+ function B(t, n = !1) {
42
+ if (t == null) return n;
43
+ const e = t.trim().toLowerCase();
44
+ return e ? e !== "false" && e !== "0" && e !== "off" && e !== "no" : !0;
45
+ }
46
+ function H(t, n) {
47
+ const e = typeof t.composedPath == "function" ? t.composedPath() : [];
48
+ for (const o of n)
49
+ if (o && e.includes(o)) return !0;
50
+ const r = t.target;
51
+ if (!(r instanceof Node)) return !1;
52
+ for (const o of n)
53
+ if (o instanceof Node && o.contains(r)) return !0;
54
+ return !1;
55
+ }
56
+ function q(t) {
57
+ const n = (t || "").trim();
58
+ return n || (typeof navigator < "u" && navigator.language ? navigator.language : "en-US");
59
+ }
60
+ function m(t) {
61
+ if (!t) return null;
62
+ const n = T(t);
63
+ return n ? `${n.y}-${u(n.m)}-${u(n.d)}` : null;
64
+ }
65
+ function y(t) {
66
+ if (!t) return null;
67
+ const n = /^(\d{4}-\d{2}-\d{2})[T ](\d{1,2}:\d{2}(?::\d{2})?)$/.exec(t.trim());
68
+ if (!n) return null;
69
+ const e = m(n[1]);
70
+ if (!e) return null;
71
+ const r = h(n[2]);
72
+ if (!r) return null;
73
+ const o = n[2].split(":").length === 3;
74
+ return { date: e, time: w(r, o) };
75
+ }
76
+ function E(t, n) {
77
+ if (!t || !n) return null;
78
+ const e = m(t), r = h(n);
79
+ return !e || !r ? null : `${e}T${w(r, n.split(":").length >= 3)}`;
80
+ }
81
+ function Z(t) {
82
+ if (!t) return null;
83
+ const n = m(t);
84
+ return n || y(t)?.date || null;
85
+ }
86
+ function _(t) {
87
+ if (!t) return null;
88
+ const n = y(t);
89
+ if (n) return n;
90
+ const e = m(t);
91
+ return e ? { date: e, time: "00:00" } : null;
92
+ }
93
+ function z(t, n, e) {
94
+ const r = T(t);
95
+ if (!r) return t;
96
+ const o = `${n}::${JSON.stringify({})}`;
97
+ let s = C.get(o);
98
+ return s || (s = new Intl.DateTimeFormat(n, {
99
+ year: "numeric",
100
+ month: "short",
101
+ day: "2-digit",
102
+ timeZone: "UTC"
103
+ }), C.set(o, s)), s.format(new Date(Date.UTC(r.y, r.m - 1, r.d)));
104
+ }
105
+ function W(t, n, e, r) {
106
+ if (!t) return "";
107
+ if (e === "iso") return t;
108
+ if (e === "custom" && r) {
109
+ const o = T(t);
110
+ if (!o) return t;
111
+ const s = P(n), i = A(n);
112
+ return r.replace(/YYYY/g, String(o.y)).replace(/MMM/g, s[o.m - 1] || "").replace(/MMMM/g, i[o.m - 1] || "").replace(/MM/g, u(o.m)).replace(/DD/g, u(o.d));
113
+ }
114
+ return z(t, n);
115
+ }
116
+ function j(t, n) {
117
+ const e = m(t.trim());
118
+ if (e) return e;
119
+ const r = O(t);
120
+ if (!r) return null;
121
+ const o = m(r);
122
+ if (o) return o;
123
+ const s = r.split("/").map((M) => M.trim()).filter(Boolean);
124
+ if (s.length !== 3) return null;
125
+ const i = $(s[0]), a = $(s[1]), p = $(s[2]);
126
+ if (i == null || a == null || p == null) return null;
127
+ let f = p;
128
+ f < 100 && (f += f >= 70 ? 1900 : 2e3);
129
+ const l = n.toLowerCase().startsWith("en-us"), c = l ? i : a, d = l ? a : i;
130
+ if (f < 1e3 || c < 1 || c > 12 || d < 1 || d > 31) return null;
131
+ const g = `${f}-${u(c)}-${u(d)}`;
132
+ return m(g);
133
+ }
134
+ function h(t, n) {
135
+ const e = t.trim().toLowerCase();
136
+ if (!e) return null;
137
+ const r = /^(\d{1,2})(?::|\.|h)?(\d{1,2})?(?::|\.|m)?(\d{1,2})?\s*(am|pm)?$/.exec(e);
138
+ if (!r) return null;
139
+ let o = Number(r[1]);
140
+ const s = Number(r[2] ?? "0"), i = Number(r[3] ?? "0");
141
+ if (!Number.isFinite(o) || !Number.isFinite(s) || !Number.isFinite(i) || s < 0 || s > 59 || i < 0 || i > 59) return null;
142
+ const a = r[4];
143
+ if (a) {
144
+ if (o < 1 || o > 12) return null;
145
+ a === "pm" && o < 12 && (o += 12), a === "am" && o === 12 && (o = 0);
146
+ }
147
+ return o < 0 || o > 23 ? null : { hours: o, minutes: s, seconds: i };
148
+ }
149
+ function w(t, n = !1) {
150
+ if (!t) return "";
151
+ const e = u(D(t.hours, 0, 23)), r = u(D(t.minutes, 0, 59));
152
+ if (!n) return `${e}:${r}`;
153
+ const o = u(D(t.seconds, 0, 59));
154
+ return `${e}:${r}:${o}`;
155
+ }
156
+ function G(t, n) {
157
+ const e = h(t);
158
+ if (!e) return t;
159
+ const r = /* @__PURE__ */ new Date();
160
+ return r.setHours(e.hours, e.minutes, e.seconds, 0), new Intl.DateTimeFormat(n, {
161
+ hour: "numeric",
162
+ minute: "2-digit",
163
+ second: t.split(":").length > 2 ? "2-digit" : void 0,
164
+ hour12: !0
165
+ }).format(r);
166
+ }
167
+ function S(t, n) {
168
+ const e = h(t), r = h(n);
169
+ if (!e || !r) return t.localeCompare(n);
170
+ const o = e.hours * 3600 + e.minutes * 60 + e.seconds, s = r.hours * 3600 + r.minutes * 60 + r.seconds;
171
+ return o - s;
172
+ }
173
+ function J(t, n, e) {
174
+ const r = h(t);
175
+ if (!r) return t;
176
+ let o = w(r, t.split(":").length >= 3);
177
+ return n && S(o, n) < 0 && (o = n), e && S(o, e) > 0 && (o = e), o;
178
+ }
179
+ function K(t, n, e) {
180
+ let r = t;
181
+ return n && b(r, n) < 0 && (r = n), e && b(r, e) > 0 && (r = e), r;
182
+ }
183
+ function V(t, n) {
184
+ const e = y(t), r = y(n);
185
+ if (!e || !r) return t.localeCompare(n);
186
+ const o = b(e.date, r.date);
187
+ return o !== 0 ? o : S(e.time, r.time);
188
+ }
189
+ function Q(t) {
190
+ const n = T(t);
191
+ if (!n) return { start: t, end: t };
192
+ const e = v(n.y, n.m), r = F(n.y, n.m);
193
+ return {
194
+ start: `${e.y}-${u(e.m)}-${u(e.d)}`,
195
+ end: `${r.y}-${u(r.m)}-${u(r.d)}`
196
+ };
197
+ }
198
+ function R(t, n) {
199
+ const e = D(n, 1, 366);
200
+ return {
201
+ start: N(t, -(e - 1)),
202
+ end: t
203
+ };
204
+ }
205
+ function X(t, n, e = 8, r = 8, o = null) {
206
+ const i = (typeof window < "u" ? window.innerHeight : 800) - t.bottom - r - e, a = t.top - r - e, p = i >= n.height, f = a >= n.height, l = o === "top" ? "top" : "bottom";
207
+ let c;
208
+ if (p && !f)
209
+ c = "bottom";
210
+ else if (f && !p)
211
+ c = "top";
212
+ else if (f && p)
213
+ c = l;
214
+ else {
215
+ const g = l === "bottom" ? i : a, M = l === "bottom" ? a : i;
216
+ g > 0 && M <= g + I ? c = l : c = i >= a ? "bottom" : "top";
217
+ }
218
+ const d = U(t, n, {
219
+ placement: `${c}-start`,
220
+ strategy: "fixed",
221
+ offset: r,
222
+ shift: !1,
223
+ flip: !1,
224
+ boundaryPadding: e
225
+ });
226
+ return { top: Math.round(d.y), left: Math.round(d.x), placement: c };
227
+ }
228
+ function tt(t) {
229
+ let n = 0;
230
+ return { run: () => {
231
+ n || (n = requestAnimationFrame(() => {
232
+ n = 0, t();
233
+ }));
234
+ }, cancel: () => {
235
+ n && (cancelAnimationFrame(n), n = 0);
236
+ } };
237
+ }
238
+ function nt(t) {
239
+ return (t || "popover") === "inline" || typeof window > "u" || typeof window.matchMedia != "function" ? !1 : window.matchMedia("(max-width: 639px)").matches;
240
+ }
241
+ function et() {
242
+ return L();
243
+ }
244
+ export {
245
+ K as a,
246
+ q as b,
247
+ X as c,
248
+ j as d,
249
+ H as e,
250
+ W as f,
251
+ R as g,
252
+ Q as h,
253
+ B as i,
254
+ E as j,
255
+ y as k,
256
+ et as l,
257
+ V as m,
258
+ m as n,
259
+ _ as o,
260
+ Z as p,
261
+ h as q,
262
+ tt as r,
263
+ nt as s,
264
+ G as t,
265
+ w as u,
266
+ J as v,
267
+ S as w
268
+ };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("./ElementBase-1b301e7f.js"),u=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("./ElementBase-EV6mVBUV.js"),u=`
2
2
  :host {
3
3
  --ui-description-color: var(--ui-color-muted, var(--ui-muted, #64748b));
4
4
  --ui-description-size: 12px;
@@ -1,4 +1,4 @@
1
- import { E as d } from "./ElementBase-909688f3.mjs";
1
+ import { E as d } from "./ElementBase-YlTLMsGk.mjs";
2
2
  const a = `
3
3
  :host {
4
4
  --ui-description-color: var(--ui-color-muted, var(--ui-muted, #64748b));
@@ -115,8 +115,7 @@ class p extends d {
115
115
  }
116
116
  _resolveTarget() {
117
117
  const i = this.getAttribute("for");
118
- if (!i)
119
- return null;
118
+ if (!i) return null;
120
119
  const r = this.getRootNode();
121
120
  return r instanceof Document || r instanceof ShadowRoot ? r.getElementById(i) : document.getElementById(i);
122
121
  }
@@ -124,8 +123,7 @@ class p extends d {
124
123
  this._target && this._descriptionId && n(this._target, "aria-describedby", this._descriptionId, !1), this._target = null;
125
124
  }
126
125
  _syncAssociation() {
127
- if (this._clearAssociation(), this.hasAttribute("hidden"))
128
- return;
126
+ if (this._clearAssociation(), this.hasAttribute("hidden")) return;
129
127
  const i = this._resolveTarget();
130
128
  i && (this._descriptionId = u(this, "desc"), this._target = i, n(i, "aria-describedby", this._descriptionId, !0));
131
129
  }
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const z=require("./ElementBase-1b301e7f.js"),F=require("./scroll-lock-d7b0df21.js"),M=require("./dismissable-layer-193e3bed.js"),R=require("./focus-scope-2b12b4e7.js"),P=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const z=require("./ElementBase-EV6mVBUV.js"),S=require("./scroll-lock-BX6e3Ced.js"),M=require("./dismissable-layer-DNfrKA20.js"),I=require("./focus-scope-Bwug2gDv.js"),R=`
2
2
  :host {
3
3
  position: fixed;
4
4
  inset: 0;
@@ -372,21 +372,21 @@
372
372
  box-shadow: none;
373
373
  }
374
374
  }
375
- `,W='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function g(a,t){if(a==null)return t;const i=a.trim().toLowerCase();return i!=="false"&&i!=="0"&&i!=="off"}function n(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function S(){return typeof window<"u"&&typeof document<"u"}function C(a){return window.setTimeout(a,16)}function p(a){a&&window.clearTimeout(a)}const E=class l extends z.ElementBase{constructor(){super(),this._isActive=!1,this._uid=Math.random().toString(36).slice(2,10),this._dialogId=this._uid,this._lastFocused=null,this._terminalEmitted=!1,this._closeMeta=null,this._runtimeError="",this._config={},this._dismissableLayer=null,this._focusScope=null,this._disconnectCleanupFrame=0,this._restoreFocusFrame=0,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onFocusIn=this._onFocusIn.bind(this),this._onSubmit=this._onSubmit.bind(this)}static get observedAttributes(){return["open","headless","title","description","closable","dismissible","close-on-overlay","close-on-backdrop","close-on-esc","lock-while-loading","size","state","role","initial-focus","submit-text","cancel-text","loading-text","error-message","aria-label","aria-labelledby","aria-describedby"]}connectedCallback(){this._disconnectCleanupFrame&&(p(this._disconnectCleanupFrame),this._disconnectCleanupFrame=0),super.connectedCallback(),this.root.addEventListener("click",this._onClick),this.root.addEventListener("keydown",this._onKeyDown),this.addEventListener("submit",this._onSubmit),this._syncFromAttributes(),this._syncOpenState()}disconnectedCallback(){this.root.removeEventListener("click",this._onClick),this.root.removeEventListener("keydown",this._onKeyDown),this.removeEventListener("submit",this._onSubmit),this._disconnectCleanupFrame&&p(this._disconnectCleanupFrame),this._restoreFocusFrame&&(p(this._restoreFocusFrame),this._restoreFocusFrame=0),this._disconnectCleanupFrame=C(()=>{this._disconnectCleanupFrame=0,!this.isConnected&&(this._isActive&&!this._terminalEmitted?this.close("dismiss","unmount"):(this._destroyRuntimeControllers(),this._deactivate()),super.disconnectedCallback())})}attributeChangedCallback(t,i,e){if(i!==e){if(t==="open"){this._syncOpenState();return}t==="state"&&e!=="error"&&(this._runtimeError=""),this._syncFromAttributes(),this.isConnected&&this.requestRender()}}get open(){return this.hasAttribute("open")}set open(t){t?this.setAttribute("open",""):this.close("dismiss","programmatic")}get dismissible(){return g(this.getAttribute("dismissible")??this.getAttribute("closable"),!0)}set dismissible(t){this.setAttribute("dismissible",String(t)),this.setAttribute("closable",String(t))}get closeOnOverlay(){return g(this.getAttribute("close-on-overlay")??this.getAttribute("close-on-backdrop"),!0)}set closeOnOverlay(t){this.setAttribute("close-on-overlay",String(t)),this.setAttribute("close-on-backdrop",String(t))}get closeOnEsc(){return g(this.getAttribute("close-on-esc"),!0)}set closeOnEsc(t){this.setAttribute("close-on-esc",String(t))}get lockWhileLoading(){return g(this.getAttribute("lock-while-loading"),!0)}set lockWhileLoading(t){this.setAttribute("lock-while-loading",String(t))}get state(){const t=this.getAttribute("state");return t==="loading"||t==="error"||t==="success"?t:"idle"}set state(t){if(t==="idle"){this.removeAttribute("state");return}this.setAttribute("state",t)}get dialogId(){return this._dialogId}set dialogId(t){this._dialogId=t||this._uid,this.requestRender()}get config(){return this._config}set config(t){this._config=t||{},this._config.id&&(this._dialogId=this._config.id),this._config.dismissible!=null&&(this.dismissible=!!this._config.dismissible),this._config.closeOnOverlay!=null&&(this.closeOnOverlay=!!this._config.closeOnOverlay),this._config.closeOnEsc!=null&&(this.closeOnEsc=!!this._config.closeOnEsc),this._config.lockWhileLoading!=null&&(this.lockWhileLoading=!!this._config.lockWhileLoading),this._config.size&&this.setAttribute("size",this._config.size),this._config.role&&this.setAttribute("role",this._config.role),this._config.initialFocus&&this.setAttribute("initial-focus",this._config.initialFocus),this._config.ariaLabel&&this.setAttribute("aria-label",this._config.ariaLabel),this._config.ariaLabelledby&&this.setAttribute("aria-labelledby",this._config.ariaLabelledby),this._config.ariaDescribedby&&this.setAttribute("aria-describedby",this._config.ariaDescribedby),this._config.errorMessage&&(this._runtimeError=this._config.errorMessage),this.requestRender()}openDialog(){this.setAttribute("open","")}closeDialog(t="programmatic"){if(!this.hasAttribute("open"))return;const i=new CustomEvent("request-close",{detail:{reason:t},bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(i);const e=new CustomEvent("ui-request-close",{detail:{id:this.dialogId||this._uid,reason:t},bubbles:!0,cancelable:!0,composed:!0});if(this.dispatchEvent(e),!(i.defaultPrevented||e.defaultPrevented)){if(t==="submit"){this.close("submit");return}if(t==="cancel"){this.close("cancel");return}if(t==="overlay"){this.close("dismiss","overlay");return}if(t==="escape"){this.close("dismiss","esc");return}if(t==="button"){this.close("dismiss","close-icon");return}this.close("dismiss","programmatic")}}close(t="dismiss",i,e){this._terminalEmitted||(this._closeMeta={action:t,source:i,reason:e},this.hasAttribute("open")&&this.removeAttribute("open"),this._syncOpenState())}setError(t){this._runtimeError=t,this.state=t?"error":"idle",this.requestRender()}clearError(){this._runtimeError="",this.state==="error"&&(this.state="idle"),this.requestRender()}_syncFromAttributes(){!this.hasAttribute("dismissible")&&this.hasAttribute("closable")&&this.setAttribute("dismissible",this.getAttribute("closable")||"true"),!this.hasAttribute("closable")&&this.hasAttribute("dismissible")&&this.setAttribute("closable",this.getAttribute("dismissible")||"true"),!this.hasAttribute("close-on-overlay")&&this.hasAttribute("close-on-backdrop")&&this.setAttribute("close-on-overlay",this.getAttribute("close-on-backdrop")||"true"),!this.hasAttribute("close-on-backdrop")&&this.hasAttribute("close-on-overlay")&&this.setAttribute("close-on-backdrop",this.getAttribute("close-on-overlay")||"true"),this.hasAttribute("role")||this.setAttribute("role","dialog")}_syncOpenState(){const t=this.hasAttribute("open");t&&!this._isActive?this._activate():!t&&this._isActive&&this._deactivate(),this._syncOpenUi()}_activate(){this._isActive=!0,this._terminalEmitted=!1,this._closeMeta=null,l._openStack.includes(this)||l._openStack.push(this),this._lastFocused=document.activeElement||null,F.acquireBodyScrollLock();const t=this.dialogId||this._uid;this._dispatchWithLegacy("ui-open","open",{id:t}),this.dispatchEvent(new CustomEvent("show",{bubbles:!0,composed:!0})),this._syncOpenUi(),this._syncRuntimeControllers()}_deactivate(){if(!this._isActive)return;this._isActive=!1,this._destroyRuntimeControllers();const t=l._openStack.lastIndexOf(this);if(t>=0&&l._openStack.splice(t,1),F.releaseBodyScrollLock(),!this._terminalEmitted){const e=this._closeMeta||{action:"dismiss",source:"abort"},o=this.dialogId||this._uid;e.action==="cancel"?this._dispatchWithLegacy("ui-cancel","cancel",{id:o}):this._dispatchWithLegacy("ui-dismiss","dismiss",{id:o,source:e.source||"abort",reason:e.reason}),this._dispatchWithLegacy("ui-close","close",{id:o,action:e.action,source:e.source,reason:e.reason}),this.dispatchEvent(new CustomEvent("hide",{bubbles:!0,composed:!0})),this._terminalEmitted=!0,this._closeMeta=null}const i=this._lastFocused;this._lastFocused=null,i&&this._canRestoreFocus(i)&&(this._restoreFocusFrame&&p(this._restoreFocusFrame),this._restoreFocusFrame=C(()=>{this._restoreFocusFrame=0;try{this._canRestoreFocus(i)&&i.focus()}catch{}})),this._syncOpenUi()}_dispatchWithLegacy(t,i,e,o=!1){const s=new CustomEvent(t,{detail:e,bubbles:!0,composed:!0,cancelable:o});this.dispatchEvent(s);const r=new CustomEvent(i,{detail:e,bubbles:!0,composed:!0,cancelable:o});return this.dispatchEvent(r),s}_isTopMost(){if(!this._isActive)return!1;const t=l._openStack;return t.length>0&&t[t.length-1]===this}_queryPanel(){return this.root.querySelector(".panel")}_canRestoreFocus(t){if(!t||!t.isConnected||t.disabled||t.getAttribute("aria-hidden")==="true")return!1;if(!S())return!0;const i=window.getComputedStyle(t);return i.display!=="none"&&i.visibility!=="hidden"}_collectFocusable(t){return Array.from(t.querySelectorAll(W)).filter(i=>{if(i.disabled||i.getAttribute("aria-hidden")==="true")return!1;const o=S()?window.getComputedStyle(i):null;return!(o&&(o.display==="none"||o.visibility==="hidden"))})}_focusInitial(){if(!this.open)return;const t=this._queryPanel();if(!t)return;const i=this.getAttribute("initial-focus")||this._config.initialFocus||"";if(i){const r=t.querySelector(i);if(r&&typeof r.focus=="function"){r.focus();return}}const e=this._collectFocusable(t),s=e.find(r=>r.hasAttribute("autofocus"))||e[0]||t;!s.hasAttribute("tabindex")&&s===t&&s.setAttribute("tabindex","-1");try{s.focus()}catch{}}_onFocusIn(t){!this.open||this._isTopMost()}_handleTab(t){t.key}_destroyRuntimeControllers(){var t,i;(t=this._dismissableLayer)==null||t.destroy(),this._dismissableLayer=null,(i=this._focusScope)==null||i.destroy(),this._focusScope=null}_syncOpenUi(){const t=this.root.querySelector(".overlay"),i=this._queryPanel(),e=this.open;!t||!i||(t.hidden=!e,t.setAttribute("data-open",String(e)),t.setAttribute("aria-hidden",e?"false":"true"),i.setAttribute("aria-hidden",e?"false":"true"))}_syncRuntimeControllers(){if(this._destroyRuntimeControllers(),!this.open||!this._isTopMost())return;const t=this._queryPanel();t&&(this._dismissableLayer=M.createDismissableLayer({node:t,closeOnEscape:this.closeOnEsc,closeOnPointerOutside:this.closeOnOverlay,closeOnFocusOutside:!1,onBeforeDismiss:(i,e)=>this._isInteractionLocked()?!1:i==="escape-key"?(this.closeDialog("escape"),!1):(i==="outside-pointer"&&this.closeDialog("overlay"),!1)}),this._focusScope=R.createFocusScope({node:t,trapped:!0,loop:!0,restoreFocus:!1,autoFocus:"first",initialFocus:()=>{const i=this.getAttribute("initial-focus")||this._config.initialFocus||"";return i?t.querySelector(i):null}}))}_collectFormData(t){const i=this._queryPanel(),e=t||this.querySelector("form")||(i==null?void 0:i.querySelector("form"))||null;if(!(e instanceof HTMLFormElement)||typeof FormData>"u")return;const o=new FormData(e),s={};for(const[r,h]of o.entries()){const c=String(h);if(s[r]==null){s[r]=c;continue}const d=s[r];Array.isArray(d)?d.push(c):s[r]=[d,c]}return Object.keys(s).length?s:void 0}_resolveSubmitForm(t){var o;if(t){const s=t.closest("form");if(s instanceof HTMLFormElement&&this.contains(s))return s}const i=this.querySelector("form");if(i instanceof HTMLFormElement)return i;const e=(o=this._queryPanel())==null?void 0:o.querySelector("form");return e instanceof HTMLFormElement?e:null}_isInteractionLocked(){return this.state==="loading"&&this.lockWhileLoading}_requestDismiss(t,i){if(!this._isInteractionLocked()){if(t==="overlay"){this.closeDialog("overlay");return}if(t==="esc"){this.closeDialog("escape");return}if(t==="close-icon"){this.closeDialog("button");return}this.close("dismiss",t,i)}}_handleSubmit(t){if(this._isInteractionLocked())return;const i=t??this._resolveSubmitForm();if(i&&typeof i.reportValidity=="function"&&!i.reportValidity())return;const e={id:this.dialogId||this._uid,formData:this._collectFormData(i)};this._dispatchWithLegacy("ui-submit","submit",e,!0).defaultPrevented||this.closeDialog("submit")}_handleCancel(){this._isInteractionLocked()||this.closeDialog("cancel")}_onClick(t){if(!this.open||!this._isTopMost())return;const i=t.target;if(i){if(!i.closest(".panel")&&i.closest(".overlay")&&this.closeOnOverlay){this._requestDismiss("overlay");return}if(i.closest(".close")){this._requestDismiss("close-icon");return}if(i.closest(".btn-submit")){this._handleSubmit();return}i.closest(".btn-cancel")&&this._handleCancel()}}_onSubmit(t){if(!this.open||!this._isTopMost())return;const i=t.target;i&&i!==this&&this.contains(i)&&(t.preventDefault(),t.stopPropagation(),this._handleSubmit(i))}_onKeyDown(t){if(!(!this.open||!this._isTopMost())&&t.key==="Escape"){if(!this.closeOnEsc)return;t.preventDefault(),t.stopPropagation(),this._requestDismiss("esc");return}}render(){const t=this._config.title??this.getAttribute("title")??"",i=this._config.description??this.getAttribute("description")??"",e=this._config.submitText??this.getAttribute("submit-text")??"Submit",o=this._config.cancelText??this.getAttribute("cancel-text")??"Cancel",s=this._config.loadingText??this.getAttribute("loading-text")??"Working...",r=t.trim(),h=i.trim(),c=!!this.querySelector('[slot="title"]'),d=!!this.querySelector('[slot="description"]'),f=!!(r||c),m=!!(h||d),O=!!this.querySelector('[slot="content"]'),D=!!this.querySelector('[slot="footer"]'),q=this._config.showCancel??!0,$=this._config.showClose??this.dismissible,v=this._runtimeError||this._config.errorMessage||this.getAttribute("error-message")||"",b=this.state==="loading",y=`ui-dialog-title-${this._uid}`,x=`ui-dialog-description-${this._uid}`,A=`ui-dialog-error-${this._uid}`,T=this.getAttribute("aria-label")||"",I=this.getAttribute("aria-labelledby")||"",k=this.getAttribute("aria-describedby")||"",_=I||(f?y:""),w=T||(_?"":"Dialog"),u=[];k?u.push(k):(m&&u.push(x),v&&u.push(A));const B=f||m?`
375
+ `,P='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function g(a,t){if(a==null)return t;const i=a.trim().toLowerCase();return i!=="false"&&i!=="0"&&i!=="off"}function n(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function C(){return typeof window<"u"&&typeof document<"u"}function E(a){return window.setTimeout(a,16)}function p(a){a&&window.clearTimeout(a)}const l=class l extends z.ElementBase{constructor(){super(),this._isActive=!1,this._uid=Math.random().toString(36).slice(2,10),this._dialogId=this._uid,this._lastFocused=null,this._terminalEmitted=!1,this._closeMeta=null,this._runtimeError="",this._config={},this._dismissableLayer=null,this._focusScope=null,this._disconnectCleanupFrame=0,this._restoreFocusFrame=0,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onFocusIn=this._onFocusIn.bind(this),this._onSubmit=this._onSubmit.bind(this)}static get observedAttributes(){return["open","headless","title","description","closable","dismissible","close-on-overlay","close-on-backdrop","close-on-esc","lock-while-loading","size","state","role","initial-focus","submit-text","cancel-text","loading-text","error-message","aria-label","aria-labelledby","aria-describedby"]}connectedCallback(){this._disconnectCleanupFrame&&(p(this._disconnectCleanupFrame),this._disconnectCleanupFrame=0),super.connectedCallback(),this.root.addEventListener("click",this._onClick),this.root.addEventListener("keydown",this._onKeyDown),this.addEventListener("submit",this._onSubmit),this._syncFromAttributes(),this._syncOpenState()}disconnectedCallback(){this.root.removeEventListener("click",this._onClick),this.root.removeEventListener("keydown",this._onKeyDown),this.removeEventListener("submit",this._onSubmit),this._disconnectCleanupFrame&&p(this._disconnectCleanupFrame),this._restoreFocusFrame&&(p(this._restoreFocusFrame),this._restoreFocusFrame=0),this._disconnectCleanupFrame=E(()=>{this._disconnectCleanupFrame=0,!this.isConnected&&(this._isActive&&!this._terminalEmitted?this.close("dismiss","unmount"):(this._destroyRuntimeControllers(),this._deactivate()),super.disconnectedCallback())})}attributeChangedCallback(t,i,e){if(i!==e){if(t==="open"){this._syncOpenState();return}t==="state"&&e!=="error"&&(this._runtimeError=""),this._syncFromAttributes(),this.isConnected&&this.requestRender()}}get open(){return this.hasAttribute("open")}set open(t){t?this.setAttribute("open",""):this.close("dismiss","programmatic")}get dismissible(){return g(this.getAttribute("dismissible")??this.getAttribute("closable"),!0)}set dismissible(t){this.setAttribute("dismissible",String(t)),this.setAttribute("closable",String(t))}get closeOnOverlay(){return g(this.getAttribute("close-on-overlay")??this.getAttribute("close-on-backdrop"),!0)}set closeOnOverlay(t){this.setAttribute("close-on-overlay",String(t)),this.setAttribute("close-on-backdrop",String(t))}get closeOnEsc(){return g(this.getAttribute("close-on-esc"),!0)}set closeOnEsc(t){this.setAttribute("close-on-esc",String(t))}get lockWhileLoading(){return g(this.getAttribute("lock-while-loading"),!0)}set lockWhileLoading(t){this.setAttribute("lock-while-loading",String(t))}get state(){const t=this.getAttribute("state");return t==="loading"||t==="error"||t==="success"?t:"idle"}set state(t){if(t==="idle"){this.removeAttribute("state");return}this.setAttribute("state",t)}get dialogId(){return this._dialogId}set dialogId(t){this._dialogId=t||this._uid,this.requestRender()}get config(){return this._config}set config(t){this._config=t||{},this._config.id&&(this._dialogId=this._config.id),this._config.dismissible!=null&&(this.dismissible=!!this._config.dismissible),this._config.closeOnOverlay!=null&&(this.closeOnOverlay=!!this._config.closeOnOverlay),this._config.closeOnEsc!=null&&(this.closeOnEsc=!!this._config.closeOnEsc),this._config.lockWhileLoading!=null&&(this.lockWhileLoading=!!this._config.lockWhileLoading),this._config.size&&this.setAttribute("size",this._config.size),this._config.role&&this.setAttribute("role",this._config.role),this._config.initialFocus&&this.setAttribute("initial-focus",this._config.initialFocus),this._config.ariaLabel&&this.setAttribute("aria-label",this._config.ariaLabel),this._config.ariaLabelledby&&this.setAttribute("aria-labelledby",this._config.ariaLabelledby),this._config.ariaDescribedby&&this.setAttribute("aria-describedby",this._config.ariaDescribedby),this._config.errorMessage&&(this._runtimeError=this._config.errorMessage),this.requestRender()}openDialog(){this.setAttribute("open","")}closeDialog(t="programmatic"){if(!this.hasAttribute("open"))return;const i=new CustomEvent("request-close",{detail:{reason:t},bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(i);const e=new CustomEvent("ui-request-close",{detail:{id:this.dialogId||this._uid,reason:t},bubbles:!0,cancelable:!0,composed:!0});if(this.dispatchEvent(e),!(i.defaultPrevented||e.defaultPrevented)){if(t==="submit"){this.close("submit");return}if(t==="cancel"){this.close("cancel");return}if(t==="overlay"){this.close("dismiss","overlay");return}if(t==="escape"){this.close("dismiss","esc");return}if(t==="button"){this.close("dismiss","close-icon");return}this.close("dismiss","programmatic")}}close(t="dismiss",i,e){this._terminalEmitted||(this._closeMeta={action:t,source:i,reason:e},this.hasAttribute("open")&&this.removeAttribute("open"),this._syncOpenState())}setError(t){this._runtimeError=t,this.state=t?"error":"idle",this.requestRender()}clearError(){this._runtimeError="",this.state==="error"&&(this.state="idle"),this.requestRender()}_syncFromAttributes(){!this.hasAttribute("dismissible")&&this.hasAttribute("closable")&&this.setAttribute("dismissible",this.getAttribute("closable")||"true"),!this.hasAttribute("closable")&&this.hasAttribute("dismissible")&&this.setAttribute("closable",this.getAttribute("dismissible")||"true"),!this.hasAttribute("close-on-overlay")&&this.hasAttribute("close-on-backdrop")&&this.setAttribute("close-on-overlay",this.getAttribute("close-on-backdrop")||"true"),!this.hasAttribute("close-on-backdrop")&&this.hasAttribute("close-on-overlay")&&this.setAttribute("close-on-backdrop",this.getAttribute("close-on-overlay")||"true"),this.hasAttribute("role")||this.setAttribute("role","dialog")}_syncOpenState(){const t=this.hasAttribute("open");t&&!this._isActive?this._activate():!t&&this._isActive&&this._deactivate(),this._syncOpenUi()}_activate(){this._isActive=!0,this._terminalEmitted=!1,this._closeMeta=null,l._openStack.includes(this)||l._openStack.push(this),this._lastFocused=document.activeElement||null,S.acquireBodyScrollLock();const t=this.dialogId||this._uid;this._dispatchWithLegacy("ui-open","open",{id:t}),this.dispatchEvent(new CustomEvent("show",{bubbles:!0,composed:!0})),this._syncOpenUi(),this._syncRuntimeControllers()}_deactivate(){if(!this._isActive)return;this._isActive=!1,this._destroyRuntimeControllers();const t=l._openStack.lastIndexOf(this);if(t>=0&&l._openStack.splice(t,1),S.releaseBodyScrollLock(),!this._terminalEmitted){const e=this._closeMeta||{action:"dismiss",source:"abort"},s=this.dialogId||this._uid;e.action==="cancel"?this._dispatchWithLegacy("ui-cancel","cancel",{id:s}):this._dispatchWithLegacy("ui-dismiss","dismiss",{id:s,source:e.source||"abort",reason:e.reason}),this._dispatchWithLegacy("ui-close","close",{id:s,action:e.action,source:e.source,reason:e.reason}),this.dispatchEvent(new CustomEvent("hide",{bubbles:!0,composed:!0})),this._terminalEmitted=!0,this._closeMeta=null}const i=this._lastFocused;this._lastFocused=null,i&&this._canRestoreFocus(i)&&(this._restoreFocusFrame&&p(this._restoreFocusFrame),this._restoreFocusFrame=E(()=>{this._restoreFocusFrame=0;try{this._canRestoreFocus(i)&&i.focus()}catch{}})),this._syncOpenUi()}_dispatchWithLegacy(t,i,e,s=!1){const o=new CustomEvent(t,{detail:e,bubbles:!0,composed:!0,cancelable:s});this.dispatchEvent(o);const r=new CustomEvent(i,{detail:e,bubbles:!0,composed:!0,cancelable:s});return this.dispatchEvent(r),o}_isTopMost(){if(!this._isActive)return!1;const t=l._openStack;return t.length>0&&t[t.length-1]===this}_queryPanel(){return this.root.querySelector(".panel")}_canRestoreFocus(t){if(!t||!t.isConnected||t.disabled||t.getAttribute("aria-hidden")==="true")return!1;if(!C())return!0;const i=window.getComputedStyle(t);return i.display!=="none"&&i.visibility!=="hidden"}_collectFocusable(t){return Array.from(t.querySelectorAll(P)).filter(i=>{if(i.disabled||i.getAttribute("aria-hidden")==="true")return!1;const s=C()?window.getComputedStyle(i):null;return!(s&&(s.display==="none"||s.visibility==="hidden"))})}_focusInitial(){if(!this.open)return;const t=this._queryPanel();if(!t)return;const i=this.getAttribute("initial-focus")||this._config.initialFocus||"";if(i){const r=t.querySelector(i);if(r&&typeof r.focus=="function"){r.focus();return}}const e=this._collectFocusable(t),o=e.find(r=>r.hasAttribute("autofocus"))||e[0]||t;!o.hasAttribute("tabindex")&&o===t&&o.setAttribute("tabindex","-1");try{o.focus()}catch{}}_onFocusIn(t){!this.open||this._isTopMost()}_handleTab(t){t.key}_destroyRuntimeControllers(){this._dismissableLayer?.destroy(),this._dismissableLayer=null,this._focusScope?.destroy(),this._focusScope=null}_syncOpenUi(){const t=this.root.querySelector(".overlay"),i=this._queryPanel(),e=this.open;!t||!i||(t.hidden=!e,t.setAttribute("data-open",String(e)),t.setAttribute("aria-hidden",e?"false":"true"),i.setAttribute("aria-hidden",e?"false":"true"))}_syncRuntimeControllers(){if(this._destroyRuntimeControllers(),!this.open||!this._isTopMost())return;const t=this._queryPanel();t&&(this._dismissableLayer=M.createDismissableLayer({node:t,closeOnEscape:this.closeOnEsc,closeOnPointerOutside:this.closeOnOverlay,closeOnFocusOutside:!1,onBeforeDismiss:(i,e)=>this._isInteractionLocked()?!1:i==="escape-key"?(this.closeDialog("escape"),!1):(i==="outside-pointer"&&this.closeDialog("overlay"),!1)}),this._focusScope=I.createFocusScope({node:t,trapped:!0,loop:!0,restoreFocus:!1,autoFocus:"first",initialFocus:()=>{const i=this.getAttribute("initial-focus")||this._config.initialFocus||"";return i?t.querySelector(i):null}}))}_collectFormData(t){const i=this._queryPanel(),e=t||this.querySelector("form")||i?.querySelector("form")||null;if(!(e instanceof HTMLFormElement)||typeof FormData>"u")return;const s=new FormData(e),o={};for(const[r,h]of s.entries()){const c=String(h);if(o[r]==null){o[r]=c;continue}const d=o[r];Array.isArray(d)?d.push(c):o[r]=[d,c]}return Object.keys(o).length?o:void 0}_resolveSubmitForm(t){if(t){const s=t.closest("form");if(s instanceof HTMLFormElement&&this.contains(s))return s}const i=this.querySelector("form");if(i instanceof HTMLFormElement)return i;const e=this._queryPanel()?.querySelector("form");return e instanceof HTMLFormElement?e:null}_isInteractionLocked(){return this.state==="loading"&&this.lockWhileLoading}_requestDismiss(t,i){if(!this._isInteractionLocked()){if(t==="overlay"){this.closeDialog("overlay");return}if(t==="esc"){this.closeDialog("escape");return}if(t==="close-icon"){this.closeDialog("button");return}this.close("dismiss",t,i)}}_handleSubmit(t){if(this._isInteractionLocked())return;const i=t??this._resolveSubmitForm();if(i&&typeof i.reportValidity=="function"&&!i.reportValidity())return;const e={id:this.dialogId||this._uid,formData:this._collectFormData(i)};this._dispatchWithLegacy("ui-submit","submit",e,!0).defaultPrevented||this.closeDialog("submit")}_handleCancel(){this._isInteractionLocked()||this.closeDialog("cancel")}_onClick(t){if(!this.open||!this._isTopMost())return;const i=t.target;if(i){if(!i.closest(".panel")&&i.closest(".overlay")&&this.closeOnOverlay){this._requestDismiss("overlay");return}if(i.closest(".close")){this._requestDismiss("close-icon");return}if(i.closest(".btn-submit")){this._handleSubmit();return}i.closest(".btn-cancel")&&this._handleCancel()}}_onSubmit(t){if(!this.open||!this._isTopMost())return;const i=t.target;i&&i!==this&&this.contains(i)&&(t.preventDefault(),t.stopPropagation(),this._handleSubmit(i))}_onKeyDown(t){if(!(!this.open||!this._isTopMost())&&t.key==="Escape"){if(!this.closeOnEsc)return;t.preventDefault(),t.stopPropagation(),this._requestDismiss("esc");return}}render(){const t=this._config.title??this.getAttribute("title")??"",i=this._config.description??this.getAttribute("description")??"",e=this._config.submitText??this.getAttribute("submit-text")??"Submit",s=this._config.cancelText??this.getAttribute("cancel-text")??"Cancel",o=this._config.loadingText??this.getAttribute("loading-text")??"Working...",r=t.trim(),h=i.trim(),c=!!this.querySelector('[slot="title"]'),d=!!this.querySelector('[slot="description"]'),m=!!(r||c),v=!!(h||d),L=!!this.querySelector('[slot="content"]'),O=!!this.querySelector('[slot="footer"]'),q=this._config.showCancel??!0,$=this._config.showClose??this.dismissible,_=this._runtimeError||this._config.errorMessage||this.getAttribute("error-message")||"",b=this.state==="loading",x=`ui-dialog-title-${this._uid}`,A=`ui-dialog-description-${this._uid}`,k=`ui-dialog-error-${this._uid}`,D=this.getAttribute("aria-label")||"",T=this.getAttribute("aria-labelledby")||"",w=this.getAttribute("aria-describedby")||"",y=T||(m?x:""),F=D||(y?"":"Dialog"),u=[];w?u.push(w):(v&&u.push(A),_&&u.push(k));const B=m||v?`
376
376
  <header class="header" part="header">
377
- ${f?`<h2 id="${y}" class="title" part="title"><slot name="title">${n(r)}</slot></h2>`:""}
378
- ${m?`<p id="${x}" class="description" part="description"><slot name="description">${n(h)}</slot></p>`:""}
377
+ ${m?`<h2 id="${x}" class="title" part="title"><slot name="title">${n(r)}</slot></h2>`:""}
378
+ ${v?`<p id="${A}" class="description" part="description"><slot name="description">${n(h)}</slot></p>`:""}
379
379
  </header>
380
380
  `:"";this._destroyRuntimeControllers(),this.setContent(`
381
- ${this.hasAttribute("headless")?"":`<style>${P}</style>`}
381
+ ${this.hasAttribute("headless")?"":`<style>${R}</style>`}
382
382
  <div class="overlay" part="overlay" data-open="${String(this.open)}" ${this.open?"":"hidden"} aria-hidden="${this.open?"false":"true"}">
383
383
  <section
384
384
  class="panel"
385
385
  part="panel"
386
386
  role="${n(this.getAttribute("role")||"dialog")}"
387
387
  aria-modal="true"
388
- ${w?`aria-label="${n(w)}"`:""}
389
- ${_?`aria-labelledby="${n(_)}"`:""}
388
+ ${F?`aria-label="${n(F)}"`:""}
389
+ ${y?`aria-labelledby="${n(y)}"`:""}
390
390
  ${u.length?`aria-describedby="${n(u.join(" "))}"`:""}
391
391
  aria-hidden="${this.open?"false":"true"}"
392
392
  tabindex="-1"
@@ -399,17 +399,17 @@
399
399
  </button>`:""}
400
400
  ${B}
401
401
  <div class="body" part="body">
402
- ${O?'<slot name="content"></slot>':"<slot></slot>"}
402
+ ${L?'<slot name="content"></slot>':"<slot></slot>"}
403
403
  </div>
404
404
 
405
- <div class="error" id="${A}" part="error" aria-live="polite" data-empty="${String(!v)}">${n(v)}</div>
405
+ <div class="error" id="${k}" part="error" aria-live="polite" data-empty="${String(!_)}">${n(_)}</div>
406
406
 
407
407
  <footer class="footer" part="footer">
408
- ${b?`<span class="loading" part="loading"><span class="spinner" aria-hidden="true"></span><span>${n(s)}</span></span>`:'<span aria-hidden="true"></span>'}
408
+ ${b?`<span class="loading" part="loading"><span class="spinner" aria-hidden="true"></span><span>${n(o)}</span></span>`:'<span aria-hidden="true"></span>'}
409
409
 
410
- ${D?'<slot name="footer"></slot>':`${q?`<button class="btn btn-cancel" part="cancel" type="button" ${b?"disabled":""}>${n(o)}</button>`:""}
410
+ ${O?'<slot name="footer"></slot>':`${q?`<button class="btn btn-cancel" part="cancel" type="button" ${b?"disabled":""}>${n(s)}</button>`:""}
411
411
  <button class="btn btn-submit" part="submit" type="button" ${b?"disabled":""}>${n(e)}</button>`}
412
412
  </footer>
413
413
  </section>
414
414
  </div>
415
- `),this._syncOpenUi(),this.open?this._syncRuntimeControllers():this._destroyRuntimeControllers()}};E._openStack=[];let L=E;typeof customElements<"u"&&!customElements.get("ui-dialog")&&customElements.define("ui-dialog",L);exports.UIDialog=L;
415
+ `),this._syncOpenUi(),this.open?this._syncRuntimeControllers():this._destroyRuntimeControllers()}};l._openStack=[];let f=l;typeof customElements<"u"&&!customElements.get("ui-dialog")&&customElements.define("ui-dialog",f);exports.UIDialog=f;