@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
@@ -1,4 +1,4 @@
1
- import { E as z } from "./ElementBase-909688f3.mjs";
1
+ import { E as z } from "./ElementBase-YlTLMsGk.mjs";
2
2
  const q = `
3
3
  <svg viewBox="0 0 20 20" aria-hidden="true" focusable="false">
4
4
  <path d="m6 6 8 8M14 6l-8 8" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
@@ -603,31 +603,26 @@ const q = `
603
603
  "description",
604
604
  "data-error"
605
605
  ];
606
- function d(a) {
607
- return a.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
606
+ function l(o) {
607
+ return o.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
608
608
  }
609
- function g(a) {
610
- if (!a)
611
- return !1;
612
- const t = a.assignedNodes({ flatten: !0 });
613
- return t.length ? t.some((e) => {
614
- var i;
615
- return e.nodeType === Node.TEXT_NODE ? !!((i = e.textContent) != null && i.trim()) : e.nodeType === Node.ELEMENT_NODE;
616
- }) : !1;
609
+ function p(o) {
610
+ if (!o) return !1;
611
+ const t = o.assignedNodes({ flatten: !0 });
612
+ return t.length ? t.some((e) => e.nodeType === Node.TEXT_NODE ? !!e.textContent?.trim() : e.nodeType === Node.ELEMENT_NODE) : !1;
617
613
  }
618
- function p(a, t) {
619
- const e = a.getAttribute(t);
620
- if (e == null)
621
- return !1;
614
+ function u(o, t) {
615
+ const e = o.getAttribute(t);
616
+ if (e == null) return !1;
622
617
  const i = String(e).trim().toLowerCase();
623
618
  return i !== "false" && i !== "0";
624
619
  }
625
- function M(a) {
626
- return a === "none" || a === "large" || a === "full";
620
+ function M(o) {
621
+ return o === "none" || o === "large" || o === "full";
627
622
  }
628
- function I(a) {
623
+ function I(o) {
629
624
  let t = 0;
630
- switch (a.length >= 8 && (t += 1), /[a-z]/.test(a) && /[A-Z]/.test(a) && (t += 1), /\d/.test(a) && (t += 1), (/[^A-Za-z0-9]/.test(a) || a.length >= 14) && (t += 1), Math.max(1, Math.min(4, t || 1))) {
625
+ switch (o.length >= 8 && (t += 1), /[a-z]/.test(o) && /[A-Z]/.test(o) && (t += 1), /\d/.test(o) && (t += 1), (/[^A-Za-z0-9]/.test(o) || o.length >= 14) && (t += 1), Math.max(1, Math.min(4, t || 1))) {
631
626
  case 1:
632
627
  return { score: 1, label: "Weak", caption: "Use more characters and mix case, numbers, or symbols." };
633
628
  case 2:
@@ -667,12 +662,11 @@ class L extends z {
667
662
  return;
668
663
  }
669
664
  this._syncUi(), t === "autofocus" && this.hasAttribute("autofocus") && !this._autofocusApplied && (this._autofocusApplied = !0, queueMicrotask(() => {
670
- var r, n;
671
665
  if (this.isConnected)
672
666
  try {
673
- (r = this._input) == null || r.focus({ preventScroll: !0 });
667
+ this._input?.focus({ preventScroll: !0 });
674
668
  } catch {
675
- (n = this._input) == null || n.focus();
669
+ this._input?.focus();
676
670
  }
677
671
  }));
678
672
  }
@@ -688,21 +682,16 @@ class L extends z {
688
682
  super.focus(t);
689
683
  }
690
684
  blur() {
691
- var t;
692
- (t = this._input) == null || t.blur();
685
+ this._input?.blur();
693
686
  }
694
687
  select() {
695
- var t;
696
- (t = this._input) == null || t.select();
688
+ this._input?.select();
697
689
  }
698
690
  toggleVisibility(t) {
699
- var n, s;
700
- if (p(this, "disabled") || this.hasAttribute("readonly") || this.getAttribute("revealable") === "false")
701
- return;
691
+ if (u(this, "disabled") || this.hasAttribute("readonly") || this.getAttribute("revealable") === "false") return;
702
692
  const e = typeof t == "boolean" ? t : !this._revealed;
703
- if (e === this._revealed)
704
- return;
705
- const i = ((n = this._input) == null ? void 0 : n.selectionStart) ?? null, r = ((s = this._input) == null ? void 0 : s.selectionEnd) ?? null;
693
+ if (e === this._revealed) return;
694
+ const i = this._input?.selectionStart ?? null, r = this._input?.selectionEnd ?? null;
706
695
  this._revealed = e, this._syncToggleUi(), this.dispatchEvent(
707
696
  new CustomEvent("visibility-change", {
708
697
  detail: { revealed: this._revealed },
@@ -710,34 +699,33 @@ class L extends z {
710
699
  composed: !0
711
700
  })
712
701
  ), queueMicrotask(() => {
713
- const o = this._input;
714
- if (o) {
702
+ const n = this._input;
703
+ if (n) {
715
704
  try {
716
- o.focus({ preventScroll: !0 });
705
+ n.focus({ preventScroll: !0 });
717
706
  } catch {
718
- o.focus();
707
+ n.focus();
719
708
  }
720
- if (i != null && r != null && typeof o.setSelectionRange == "function")
709
+ if (i != null && r != null && typeof n.setSelectionRange == "function")
721
710
  try {
722
- o.setSelectionRange(i, r);
711
+ n.setSelectionRange(i, r);
723
712
  } catch {
724
713
  }
725
714
  }
726
715
  });
727
716
  }
728
717
  render() {
729
- var l, u, c, h;
730
- const t = this.value, e = this.getAttribute("label") || "", i = this.getAttribute("description") || "", r = this.getAttribute("data-error") || "", n = this.getAttribute("placeholder") || "", s = this.hasAttribute("required") ? '<span class="required" aria-hidden="true">*</span>' : "", o = this.hasAttribute("floating-label");
718
+ const t = this.value, e = this.getAttribute("label") || "", i = this.getAttribute("description") || "", r = this.getAttribute("data-error") || "", n = this.getAttribute("placeholder") || "", s = this.hasAttribute("required") ? '<span class="required" aria-hidden="true">*</span>' : "", a = this.hasAttribute("floating-label");
731
719
  this.setContent(`
732
720
  <style>${B}</style>
733
721
  <div class="root" part="root">
734
722
  <div class="meta" part="meta">
735
723
  <label class="label" id="${this._uid}-label" part="label">
736
- <slot name="label">${d(e)}</slot>
724
+ <slot name="label">${l(e)}</slot>
737
725
  ${s}
738
726
  </label>
739
727
  <p class="description" id="${this._uid}-description" part="description">
740
- <slot name="description">${d(i)}</slot>
728
+ <slot name="description">${l(i)}</slot>
741
729
  </p>
742
730
  </div>
743
731
 
@@ -748,10 +736,10 @@ class L extends z {
748
736
  <input
749
737
  part="input"
750
738
  type="password"
751
- value="${d(t)}"
752
- placeholder="${d(n)}"
739
+ value="${l(t)}"
740
+ placeholder="${l(n)}"
753
741
  />
754
- ${o ? `<span class="floating-label" part="floating-label">${d(e || n || "Password")}</span>` : ""}
742
+ ${a ? `<span class="floating-label" part="floating-label">${l(e || n || "Password")}</span>` : ""}
755
743
  </div>
756
744
 
757
745
  <div class="actions" part="actions">
@@ -763,7 +751,7 @@ class L extends z {
763
751
 
764
752
  <div class="footer" part="footer">
765
753
  <p class="error" id="${this._uid}-error" part="error" aria-live="polite">
766
- <slot name="error">${d(r)}</slot>
754
+ <slot name="error">${l(r)}</slot>
767
755
  </p>
768
756
  <p class="counter" part="counter"></p>
769
757
  </div>
@@ -778,11 +766,10 @@ class L extends z {
778
766
  </div>
779
767
  </div>
780
768
  </div>
781
- `), this._detachListeners(), this._input = this.root.querySelector("input"), this._clearBtn = this.root.querySelector(".clear-btn"), this._toggleBtn = this.root.querySelector(".toggle-btn"), (l = this._input) == null || l.addEventListener("input", this._onNativeInput), (u = this._input) == null || u.addEventListener("change", this._onNativeChange), (c = this._clearBtn) == null || c.addEventListener("click", this._onClearClick), (h = this._toggleBtn) == null || h.addEventListener("click", this._onToggleClick), this._syncUi();
769
+ `), this._detachListeners(), this._input = this.root.querySelector("input"), this._clearBtn = this.root.querySelector(".clear-btn"), this._toggleBtn = this.root.querySelector(".toggle-btn"), this._input?.addEventListener("input", this._onNativeInput), this._input?.addEventListener("change", this._onNativeChange), this._clearBtn?.addEventListener("click", this._onClearClick), this._toggleBtn?.addEventListener("click", this._onToggleClick), this._syncUi();
782
770
  }
783
771
  _detachListeners() {
784
- var t, e, i, r;
785
- (t = this._input) == null || t.removeEventListener("input", this._onNativeInput), (e = this._input) == null || e.removeEventListener("change", this._onNativeChange), (i = this._clearBtn) == null || i.removeEventListener("click", this._onClearClick), (r = this._toggleBtn) == null || r.removeEventListener("click", this._onToggleClick), this._clearBtn = null, this._toggleBtn = null;
772
+ this._input?.removeEventListener("input", this._onNativeInput), this._input?.removeEventListener("change", this._onNativeChange), this._clearBtn?.removeEventListener("click", this._onClearClick), this._toggleBtn?.removeEventListener("click", this._onToggleClick), this._clearBtn = null, this._toggleBtn = null;
786
773
  }
787
774
  _syncHostTokens() {
788
775
  const t = this.getAttribute("color");
@@ -791,35 +778,31 @@ class L extends z {
791
778
  e && !M(e) ? this.style.setProperty("--ui-input-border-radius", e) : this.style.removeProperty("--ui-input-border-radius");
792
779
  }
793
780
  _syncControlAttrs() {
794
- if (this._syncHostTokens(), !this._input)
795
- return;
796
- const t = p(this, "disabled"), e = this.hasAttribute("required"), i = this.hasAttribute("readonly"), r = this.getAttribute("maxlength") || "", n = this.getAttribute("minlength") || "", s = this.getAttribute("pattern") || "", o = this.getAttribute("autocomplete") || "current-password", l = this.getAttribute("spellcheck") || "", u = this.getAttribute("placeholder") || "", c = this.getAttribute("name") || "";
797
- this._input.disabled = t, this._input.required = e, this._input.readOnly = i, this._input.placeholder = u, this._input.name = c, this._input.type = this._revealed ? "text" : "password", o ? this._input.setAttribute("autocomplete", o) : this._input.removeAttribute("autocomplete"), s ? this._input.setAttribute("pattern", s) : this._input.removeAttribute("pattern"), l ? this._input.setAttribute("spellcheck", l) : this._input.removeAttribute("spellcheck"), r && Number.isFinite(Number(r)) ? this._input.setAttribute("maxlength", r) : this._input.removeAttribute("maxlength"), n && Number.isFinite(Number(n)) ? this._input.setAttribute("minlength", n) : this._input.removeAttribute("minlength");
781
+ if (this._syncHostTokens(), !this._input) return;
782
+ const t = u(this, "disabled"), e = this.hasAttribute("required"), i = this.hasAttribute("readonly"), r = this.getAttribute("maxlength") || "", n = this.getAttribute("minlength") || "", s = this.getAttribute("pattern") || "", a = this.getAttribute("autocomplete") || "current-password", c = this.getAttribute("spellcheck") || "", h = this.getAttribute("placeholder") || "", d = this.getAttribute("name") || "";
783
+ this._input.disabled = t, this._input.required = e, this._input.readOnly = i, this._input.placeholder = h, this._input.name = d, this._input.type = this._revealed ? "text" : "password", this._input.setAttribute("autocomplete", a), s ? this._input.setAttribute("pattern", s) : this._input.removeAttribute("pattern"), c ? this._input.setAttribute("spellcheck", c) : this._input.removeAttribute("spellcheck"), r && Number.isFinite(Number(r)) ? this._input.setAttribute("maxlength", r) : this._input.removeAttribute("maxlength"), n && Number.isFinite(Number(n)) ? this._input.setAttribute("minlength", n) : this._input.removeAttribute("minlength");
798
784
  }
799
785
  _syncInputValue(t) {
800
786
  this._input && this._input.value !== t && (this._input.value = t);
801
787
  const e = this.root.querySelector(".shell");
802
- e && e.setAttribute("data-has-value", t ? "true" : "false"), this._clearBtn && (p(this, "clearable") && t.length > 0 && !p(this, "disabled") && !this.hasAttribute("readonly") ? this._clearBtn.removeAttribute("hidden") : this._clearBtn.setAttribute("hidden", ""));
788
+ e && e.setAttribute("data-has-value", t ? "true" : "false"), this._clearBtn && (u(this, "clearable") && t.length > 0 && !u(this, "disabled") && !this.hasAttribute("readonly") ? this._clearBtn.removeAttribute("hidden") : this._clearBtn.setAttribute("hidden", ""));
803
789
  const i = this.root.querySelector(".counter");
804
790
  if (i && this.hasAttribute("counter")) {
805
791
  const r = this.getAttribute("maxlength");
806
792
  i.textContent = r ? `${t.length}/${r}` : String(t.length);
807
- } else
808
- i && (i.textContent = "");
793
+ } else i && (i.textContent = "");
809
794
  }
810
795
  _syncToggleUi() {
811
- if (!this._toggleBtn || !this._input)
812
- return;
796
+ if (!this._toggleBtn || !this._input) return;
813
797
  this._input.type = this._revealed ? "text" : "password";
814
- const t = this.getAttribute("revealable") !== "false", e = p(this, "disabled") || this.hasAttribute("readonly");
798
+ const t = this.getAttribute("revealable") !== "false", e = u(this, "disabled") || this.hasAttribute("readonly");
815
799
  this._toggleBtn.hidden = !t, this._toggleBtn.disabled = e, this._toggleBtn.setAttribute("aria-pressed", this._revealed ? "true" : "false"), this._toggleBtn.setAttribute("aria-label", this._revealed ? "Hide password" : "Show password");
816
800
  const i = this._revealed ? "revealed" : "hidden";
817
801
  this._toggleBtn.dataset.iconState !== i && (this._toggleBtn.dataset.iconState = i, this._toggleBtn.innerHTML = this._revealed ? T : C);
818
802
  }
819
803
  _syncStrengthUi() {
820
804
  const t = this.root.querySelector(".strength"), e = this.root.querySelector(".strength-label"), i = this.root.querySelector(".strength-caption");
821
- if (!t || !e || !i)
822
- return;
805
+ if (!t || !e || !i) return;
823
806
  const r = this.value, n = this.hasAttribute("show-strength") && r.length > 0;
824
807
  if (t.hidden = !n, !n) {
825
808
  delete t.dataset.score, e.textContent = "", i.textContent = "", this._lastStrengthKey = "";
@@ -827,8 +810,8 @@ class L extends z {
827
810
  }
828
811
  const s = (this.strengthEvaluator || I)(r);
829
812
  t.dataset.score = String(s.score), e.textContent = s.label, i.textContent = s.caption;
830
- const o = `${r}|${s.score}|${s.label}|${s.caption}`;
831
- o !== this._lastStrengthKey && (this._lastStrengthKey = o, this.dispatchEvent(
813
+ const a = `${r}|${s.score}|${s.label}|${s.caption}`;
814
+ a !== this._lastStrengthKey && (this._lastStrengthKey = a, this.dispatchEvent(
832
815
  new CustomEvent("strength-change", {
833
816
  detail: {
834
817
  value: r,
@@ -842,23 +825,21 @@ class L extends z {
842
825
  ));
843
826
  }
844
827
  _syncDerivedState() {
845
- const t = this.root.querySelector('slot[name="label"]'), e = this.root.querySelector('slot[name="description"]'), i = this.root.querySelector('slot[name="error"]'), r = this.root.querySelector('slot[name="prefix"]'), n = this.root.querySelector('slot[name="suffix"]'), s = (this.getAttribute("label") || "").trim(), o = (this.getAttribute("description") || "").trim(), l = (this.getAttribute("data-error") || "").trim(), u = !!s || g(t), c = !!o || g(e), h = !!l || g(i), S = g(r), E = g(n), f = this.root.querySelector(".label"), v = this.root.querySelector(".description"), m = this.root.querySelector(".prefix"), _ = this.root.querySelector(".suffix-slot"), x = this.root.querySelector(".meta"), y = this.root.querySelector(".footer"), A = this.root.querySelector(".error"), w = this.root.querySelector(".counter");
846
- f && f.toggleAttribute("hidden", !u), v && v.toggleAttribute("hidden", !c), m && m.toggleAttribute("hidden", !S), _ && _.toggleAttribute("hidden", !E), x && x.toggleAttribute("hidden", !u && !c);
828
+ const t = this.root.querySelector('slot[name="label"]'), e = this.root.querySelector('slot[name="description"]'), i = this.root.querySelector('slot[name="error"]'), r = this.root.querySelector('slot[name="prefix"]'), n = this.root.querySelector('slot[name="suffix"]'), s = (this.getAttribute("label") || "").trim(), a = (this.getAttribute("description") || "").trim(), c = (this.getAttribute("data-error") || "").trim(), h = !!s || p(t), d = !!a || p(e), b = !!c || p(i), S = p(r), E = p(n), f = this.root.querySelector(".label"), v = this.root.querySelector(".description"), m = this.root.querySelector(".prefix"), _ = this.root.querySelector(".suffix-slot"), x = this.root.querySelector(".meta"), y = this.root.querySelector(".footer"), A = this.root.querySelector(".error"), w = this.root.querySelector(".counter");
829
+ f && f.toggleAttribute("hidden", !h), v && v.toggleAttribute("hidden", !d), m && m.toggleAttribute("hidden", !S), _ && _.toggleAttribute("hidden", !E), x && x.toggleAttribute("hidden", !h && !d);
847
830
  const k = this.hasAttribute("counter");
848
- if (w && w.toggleAttribute("hidden", !k), A && A.toggleAttribute("hidden", !h), y && y.toggleAttribute("hidden", !h && !k), !this._input)
849
- return;
850
- u ? this._input.setAttribute("aria-labelledby", `${this._uid}-label`) : this._input.removeAttribute("aria-labelledby");
851
- const b = [];
852
- c && b.push(`${this._uid}-description`), h && b.push(`${this._uid}-error`), b.length ? this._input.setAttribute("aria-describedby", b.join(" ")) : this._input.removeAttribute("aria-describedby"), this.getAttribute("validation") === "error" || !!l ? this._input.setAttribute("aria-invalid", "true") : this._input.removeAttribute("aria-invalid"), this.hasAttribute("required") ? this._input.setAttribute("aria-required", "true") : this._input.removeAttribute("aria-required");
831
+ if (w && w.toggleAttribute("hidden", !k), A && A.toggleAttribute("hidden", !b), y && y.toggleAttribute("hidden", !b && !k), !this._input) return;
832
+ h ? this._input.setAttribute("aria-labelledby", `${this._uid}-label`) : this._input.removeAttribute("aria-labelledby");
833
+ const g = [];
834
+ d && g.push(`${this._uid}-description`), b && g.push(`${this._uid}-error`), g.length ? this._input.setAttribute("aria-describedby", g.join(" ")) : this._input.removeAttribute("aria-describedby"), this.getAttribute("validation") === "error" || !!c ? this._input.setAttribute("aria-invalid", "true") : this._input.removeAttribute("aria-invalid"), this.hasAttribute("required") ? this._input.setAttribute("aria-required", "true") : this._input.removeAttribute("aria-required");
853
835
  }
854
836
  _syncUi() {
855
837
  this._syncControlAttrs(), this._syncInputValue(this.value), this._syncDerivedState(), this._syncToggleUi(), this._syncStrengthUi(), this.hasAttribute("autofocus") && !this._autofocusApplied && (this._autofocusApplied = !0, queueMicrotask(() => {
856
- var t, e;
857
838
  if (this.isConnected)
858
839
  try {
859
- (t = this._input) == null || t.focus({ preventScroll: !0 });
840
+ this._input?.focus({ preventScroll: !0 });
860
841
  } catch {
861
- (e = this._input) == null || e.focus();
842
+ this._input?.focus();
862
843
  }
863
844
  }));
864
845
  }
@@ -872,19 +853,18 @@ class L extends z {
872
853
  );
873
854
  }
874
855
  _registerWithForm() {
875
- var t;
876
856
  this._formUnregister && (this._formUnregister(), this._formUnregister = null);
877
857
  try {
878
- const i = this.getRootNode().host, n = ((t = i == null ? void 0 : i.closest) == null ? void 0 : t.call(i, "ui-form")) || null || this.closest("ui-form"), s = this.getAttribute("name");
879
- n && typeof n.registerField == "function" && s && (this._formUnregister = n.registerField(s, {
880
- name: s,
858
+ const r = this.getRootNode().host?.closest?.("ui-form") || null || this.closest("ui-form"), n = this.getAttribute("name");
859
+ r && typeof r.registerField == "function" && n && (this._formUnregister = r.registerField(n, {
860
+ name: n,
881
861
  getValue: () => this.value,
882
- setValue: (o) => {
883
- this.value = String(o ?? "");
862
+ setValue: (s) => {
863
+ this.value = String(s ?? "");
884
864
  },
885
865
  validate: async () => this._input ? { valid: this._input.checkValidity(), message: this._input.validationMessage || void 0 } : { valid: !0 },
886
- setError: (o) => {
887
- o ? (this.setAttribute("validation", "error"), this.setAttribute("data-error", o)) : (this.removeAttribute("validation"), this.removeAttribute("data-error")), this._syncUi();
866
+ setError: (s) => {
867
+ s ? (this.setAttribute("validation", "error"), this.setAttribute("data-error", s)) : (this.removeAttribute("validation"), this.removeAttribute("data-error")), this._syncUi();
888
868
  }
889
869
  }));
890
870
  } catch {
@@ -906,7 +886,7 @@ class L extends z {
906
886
  this._emitValueEvent("change", e);
907
887
  }
908
888
  _onClearClick(t) {
909
- if (t.preventDefault(), !(p(this, "disabled") || this.hasAttribute("readonly")) && this._input) {
889
+ if (t.preventDefault(), !(u(this, "disabled") || this.hasAttribute("readonly")) && this._input) {
910
890
  this.value = "", this._input.value = "", this._input.dispatchEvent(new Event("input", { bubbles: !0, composed: !0 })), this._input.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("clear", { bubbles: !0, composed: !0 }));
911
891
  try {
912
892
  this._input.focus({ preventScroll: !0 });
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const x=require("./ElementBase-1b301e7f.js"),A=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const x=require("./ElementBase-EV6mVBUV.js"),A=`
2
2
  :host {
3
3
  --ui-pin-gap: 10px;
4
4
  --ui-pin-slot-width: 48px;
@@ -170,7 +170,7 @@
170
170
  box-shadow: none;
171
171
  }
172
172
  }
173
- `;function E(n){return Number.isFinite(n)?Math.max(1,Math.min(12,Math.floor(n))):6}function u(n){return E(Number(n.getAttribute("length")||6))}function d(n,t){return n.id||(n.id=`${t}-${Math.random().toString(36).slice(2,9)}`),n.id}function I(n,t){const i=n.trim();if(!i)return"";const e=i.slice(-1);return t==="numeric"?/^[0-9]$/.test(e)?e:"":t==="alpha"?/^[a-z]$/i.test(e)?e.toUpperCase():"":/^[a-z0-9]$/i.test(e)?e.toUpperCase():""}function b(n,t){return Array.from(n).map(i=>I(i,t)).filter(Boolean)}class p extends x.ElementBase{constructor(){super(...arguments),this._value="",this._suppressValueAttr=!1,this._formUnregister=null,this._rootEl=null,this._metaEl=null,this._labelEl=null,this._descriptionEl=null,this._groupEl=null,this._errorEl=null,this._inputs=[],this._onFocus=t=>{const i=t.currentTarget;try{i.select()}catch{}},this._onInput=t=>{if(this._disabled()||this._readOnly())return;const i=t.currentTarget,e=Number(i.getAttribute("data-index")||0);this._fillFromIndex(e,i.value,"input")},this._onPaste=t=>{var s;if(this._disabled()||this._readOnly())return;const i=t.currentTarget,e=Number(i.getAttribute("data-index")||0),r=((s=t.clipboardData)==null?void 0:s.getData("text"))||"";r&&(t.preventDefault(),this._fillFromIndex(e,r,"paste"))},this._onKeyDown=t=>{const i=t.currentTarget,e=Number(i.getAttribute("data-index")||0),r=Array.from({length:u(this)},(s,a)=>this._value[a]||"");if(t.key==="ArrowLeft"){t.preventDefault(),this.focusIndex(e-1);return}if(t.key==="ArrowRight"){t.preventDefault(),this.focusIndex(e+1);return}if(t.key==="Home"){t.preventDefault(),this.focusIndex(0);return}if(t.key==="End"){t.preventDefault(),this.focusIndex(this._inputs.length-1);return}if(t.key==="Backspace"){if(t.preventDefault(),r[e]){r[e]="",this._applyValue(r.join(""),"keyboard",!0),this.focusIndex(e);return}e>0&&(r[e-1]="",this._applyValue(r.join(""),"keyboard",!0),this.focusIndex(e-1));return}if(t.key==="Delete"){t.preventDefault(),r[e]="",this._applyValue(r.join(""),"keyboard",!0),this.focusIndex(e);return}}}static get observedAttributes(){return["value","length","name","label","description","error","disabled","readonly","required","mask","placeholder-char","mode","size","density","shape","invalid"]}get value(){return this._value}set value(t){this._applyValue(String(t??""),"api",!1)}clear(){this._applyValue("","clear",!0),this.focusIndex(0)}focusIndex(t=0){const i=this._inputs[Math.max(0,Math.min(t,this._inputs.length-1))];if(i)try{i.focus({preventScroll:!0}),i.select()}catch{i.focus(),i.select()}}focusFirst(){this.focusIndex(0)}connectedCallback(){super.connectedCallback(),this._registerWithForm()}disconnectedCallback(){this._formUnregister&&(this._formUnregister(),this._formUnregister=null),super.disconnectedCallback()}attributeChangedCallback(t,i,e){if(i!==e){if(t==="name"&&this.isConnected&&this._registerWithForm(),t==="value"&&!this._suppressValueAttr&&(this._value=this._sanitizeValue(e||"")),t==="length"&&this.isConnected){this.invalidateContentCache(),this.requestRender();return}this._rootEl&&this._syncUi()}}shouldRenderOnAttributeChange(t){return t==="length"}render(){const t=u(this),i=Array.from({length:t},(e,r)=>{const s=this.hasAttribute("mask")?"password":"text",a=r===0?"one-time-code":"off",l=this._mode()==="numeric"?"numeric":"text";return`<input class="slot" part="slot" data-index="${r}" type="${s}" inputmode="${l}" autocomplete="${a}" maxlength="1" />`}).join("");this.setContent(`
173
+ `;function E(a){return Number.isFinite(a)?Math.max(1,Math.min(12,Math.floor(a))):6}function u(a){return E(Number(a.getAttribute("length")||6))}function d(a,t){return a.id||(a.id=`${t}-${Math.random().toString(36).slice(2,9)}`),a.id}function I(a,t){const i=a.trim();if(!i)return"";const e=i.slice(-1);return t==="numeric"?/^[0-9]$/.test(e)?e:"":t==="alpha"?/^[a-z]$/i.test(e)?e.toUpperCase():"":/^[a-z0-9]$/i.test(e)?e.toUpperCase():""}function b(a,t){return Array.from(a).map(i=>I(i,t)).filter(Boolean)}class p extends x.ElementBase{constructor(){super(...arguments),this._value="",this._suppressValueAttr=!1,this._formUnregister=null,this._rootEl=null,this._metaEl=null,this._labelEl=null,this._descriptionEl=null,this._groupEl=null,this._errorEl=null,this._inputs=[],this._onFocus=t=>{const i=t.currentTarget;try{i.select()}catch{}},this._onInput=t=>{if(this._disabled()||this._readOnly())return;const i=t.currentTarget,e=Number(i.getAttribute("data-index")||0);this._fillFromIndex(e,i.value,"input")},this._onPaste=t=>{if(this._disabled()||this._readOnly())return;const i=t.currentTarget,e=Number(i.getAttribute("data-index")||0),r=t.clipboardData?.getData("text")||"";r&&(t.preventDefault(),this._fillFromIndex(e,r,"paste"))},this._onKeyDown=t=>{const i=t.currentTarget,e=Number(i.getAttribute("data-index")||0),r=Array.from({length:u(this)},(s,o)=>this._value[o]||"");if(t.key==="ArrowLeft"){t.preventDefault(),this.focusIndex(e-1);return}if(t.key==="ArrowRight"){t.preventDefault(),this.focusIndex(e+1);return}if(t.key==="Home"){t.preventDefault(),this.focusIndex(0);return}if(t.key==="End"){t.preventDefault(),this.focusIndex(this._inputs.length-1);return}if(t.key==="Backspace"){if(t.preventDefault(),r[e]){r[e]="",this._applyValue(r.join(""),"keyboard",!0),this.focusIndex(e);return}e>0&&(r[e-1]="",this._applyValue(r.join(""),"keyboard",!0),this.focusIndex(e-1));return}if(t.key==="Delete"){t.preventDefault(),r[e]="",this._applyValue(r.join(""),"keyboard",!0),this.focusIndex(e);return}}}static get observedAttributes(){return["value","length","name","label","description","error","disabled","readonly","required","mask","placeholder-char","mode","size","density","shape","invalid"]}get value(){return this._value}set value(t){this._applyValue(String(t??""),"api",!1)}clear(){this._applyValue("","clear",!0),this.focusIndex(0)}focusIndex(t=0){const i=this._inputs[Math.max(0,Math.min(t,this._inputs.length-1))];if(i)try{i.focus({preventScroll:!0}),i.select()}catch{i.focus(),i.select()}}focusFirst(){this.focusIndex(0)}connectedCallback(){super.connectedCallback(),this._registerWithForm()}disconnectedCallback(){this._formUnregister&&(this._formUnregister(),this._formUnregister=null),super.disconnectedCallback()}attributeChangedCallback(t,i,e){if(i!==e){if(t==="name"&&this.isConnected&&this._registerWithForm(),t==="value"&&!this._suppressValueAttr&&(this._value=this._sanitizeValue(e||"")),t==="length"&&this.isConnected){this.invalidateContentCache(),this.requestRender();return}this._rootEl&&this._syncUi()}}shouldRenderOnAttributeChange(t){return t==="length"}render(){const t=u(this),i=Array.from({length:t},(e,r)=>{const s=this.hasAttribute("mask")?"password":"text",o=r===0?"one-time-code":"off",l=this._mode()==="numeric"?"numeric":"text";return`<input class="slot" part="slot" data-index="${r}" type="${s}" inputmode="${l}" autocomplete="${o}" maxlength="1" />`}).join("");this.setContent(`
174
174
  <style>${A}</style>
175
175
  <div class="root">
176
176
  <div class="meta" hidden>
@@ -182,4 +182,4 @@
182
182
  <div class="error" hidden></div>
183
183
  </div>
184
184
  </div>
185
- `),this._rootEl=this.root.querySelector(".root"),this._metaEl=this.root.querySelector(".meta"),this._labelEl=this.root.querySelector(".label"),this._descriptionEl=this.root.querySelector(".description"),this._groupEl=this.root.querySelector(".group"),this._errorEl=this.root.querySelector(".error"),this._inputs=Array.from(this.root.querySelectorAll(".slot")),this._inputs.forEach(e=>{e.addEventListener("input",this._onInput),e.addEventListener("keydown",this._onKeyDown),e.addEventListener("paste",this._onPaste),e.addEventListener("focus",this._onFocus)}),this._value=this._sanitizeValue(this.getAttribute("value")||this._value),this._syncUi()}_mode(){const t=(this.getAttribute("mode")||"numeric").toLowerCase();return t==="alpha"?"alpha":t==="alphanumeric"?"alphanumeric":"numeric"}_disabled(){return this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false"}_readOnly(){return this.hasAttribute("readonly")}_placeholderChar(){const t=this.getAttribute("placeholder-char");return t&&t.length?t[0]:""}_sanitizeValue(t){const i=u(this);return b(t,this._mode()).join("").slice(0,i)}_setValueAttr(t){this._suppressValueAttr=!0;try{t?this.getAttribute("value")!==t&&this.setAttribute("value",t):this.removeAttribute("value")}finally{this._suppressValueAttr=!1}}_emit(t,i){this.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:!0,composed:!0}))}_applyValue(t,i,e){const r=this._sanitizeValue(t),s=this._value;if(r===s){this._syncUi();return}this._value=r,this._setValueAttr(r),this._syncUi(),e&&(this._emit("input",{value:r,previousValue:s,source:i}),this._emit("change",{value:r,previousValue:s,source:i}),r.length===u(this)&&this._emit("complete",{value:r,length:r.length,source:i}))}_fillFromIndex(t,i,e){const r=b(i,this._mode());if(!r.length){this._syncUi();return}const s=Array.from({length:u(this)},(l,h)=>this._value[h]||"");let a=Math.max(0,Math.min(t,s.length-1));r.forEach(l=>{a>=s.length||(s[a]=l,a+=1)}),this._applyValue(s.join(""),e,!0),this.focusIndex(Math.min(a,s.length-1))}_syncUi(){if(!this._groupEl||!this._labelEl||!this._descriptionEl||!this._errorEl||!this._metaEl)return;const t=Array.from({length:u(this)},(o,c)=>this._value[c]||""),i=this._placeholderChar(),e=this.getAttribute("label")||"",r=this.getAttribute("description")||"",s=this.getAttribute("error")||"",a=this.hasAttribute("required"),l=this._labelEl.querySelector(".label-text"),h=this._labelEl.querySelector(".required");l&&(l.textContent=e),h&&h.toggleAttribute("hidden",!a),this._labelEl.toggleAttribute("hidden",!e),this._descriptionEl.textContent=r,this._descriptionEl.toggleAttribute("hidden",!r),this._errorEl.textContent=s,this._errorEl.toggleAttribute("hidden",!s),this._metaEl.toggleAttribute("hidden",!e&&!r);const f=e?d(this._labelEl,"ui-pin-label"):"",v=r?d(this._descriptionEl,"ui-pin-description"):"",y=s?d(this._errorEl,"ui-pin-error"):"",m=[v,y].filter(Boolean).join(" ");this._inputs.forEach((o,c)=>{const g=t[c]||"";o.value=g,o.setAttribute("data-filled",g?"true":"false"),o.placeholder=i,o.disabled=this._disabled(),o.readOnly=this._readOnly(),o.setAttribute("aria-label",`Digit ${c+1} of ${t.length}`),f?o.setAttribute("aria-labelledby",f):o.removeAttribute("aria-labelledby"),m?o.setAttribute("aria-describedby",m):o.removeAttribute("aria-describedby"),s||this.hasAttribute("invalid")?o.setAttribute("aria-invalid","true"):o.removeAttribute("aria-invalid"),o.inputMode=this._mode()==="numeric"?"numeric":"text",o.pattern=this._mode()==="numeric"?"[0-9]*":this._mode()==="alpha"?"[A-Za-z]*":"[A-Za-z0-9]*"})}_registerWithForm(){var t;this._formUnregister&&(this._formUnregister(),this._formUnregister=null);try{const e=this.getRootNode().host,s=((t=e==null?void 0:e.closest)==null?void 0:t.call(e,"ui-form"))||null||this.closest("ui-form"),a=this.getAttribute("name");s&&typeof s.registerField=="function"&&a&&(this._formUnregister=s.registerField(a,{name:a,getValue:()=>this.value,setValue:l=>{l==null||l===""?this.removeAttribute("value"):this.setAttribute("value",String(l))},validate:async()=>this.hasAttribute("required")&&this.value.length<u(this)?{valid:!1,message:"Enter the full verification code."}:{valid:!0,message:void 0},setError:l=>{l?(this.setAttribute("error",l),this.toggleAttribute("invalid",!0)):(this.removeAttribute("error"),this.removeAttribute("invalid")),this._syncUi()}}))}catch{}}}class _ extends p{}typeof customElements<"u"&&!customElements.get("ui-pin-input")&&customElements.define("ui-pin-input",p);typeof customElements<"u"&&!customElements.get("ui-otp-input")&&customElements.define("ui-otp-input",_);exports.UIOtpInput=_;exports.UIPinInput=p;
185
+ `),this._rootEl=this.root.querySelector(".root"),this._metaEl=this.root.querySelector(".meta"),this._labelEl=this.root.querySelector(".label"),this._descriptionEl=this.root.querySelector(".description"),this._groupEl=this.root.querySelector(".group"),this._errorEl=this.root.querySelector(".error"),this._inputs=Array.from(this.root.querySelectorAll(".slot")),this._inputs.forEach(e=>{e.addEventListener("input",this._onInput),e.addEventListener("keydown",this._onKeyDown),e.addEventListener("paste",this._onPaste),e.addEventListener("focus",this._onFocus)}),this._value=this._sanitizeValue(this.getAttribute("value")||this._value),this._syncUi()}_mode(){const t=(this.getAttribute("mode")||"numeric").toLowerCase();return t==="alpha"?"alpha":t==="alphanumeric"?"alphanumeric":"numeric"}_disabled(){return this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false"}_readOnly(){return this.hasAttribute("readonly")}_placeholderChar(){const t=this.getAttribute("placeholder-char");return t&&t.length?t[0]:""}_sanitizeValue(t){const i=u(this);return b(t,this._mode()).join("").slice(0,i)}_setValueAttr(t){this._suppressValueAttr=!0;try{t?this.getAttribute("value")!==t&&this.setAttribute("value",t):this.removeAttribute("value")}finally{this._suppressValueAttr=!1}}_emit(t,i){this.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:!0,composed:!0}))}_applyValue(t,i,e){const r=this._sanitizeValue(t),s=this._value;if(r===s){this._syncUi();return}this._value=r,this._setValueAttr(r),this._syncUi(),e&&(this._emit("input",{value:r,previousValue:s,source:i}),this._emit("change",{value:r,previousValue:s,source:i}),r.length===u(this)&&this._emit("complete",{value:r,length:r.length,source:i}))}_fillFromIndex(t,i,e){const r=b(i,this._mode());if(!r.length){this._syncUi();return}const s=Array.from({length:u(this)},(l,h)=>this._value[h]||"");let o=Math.max(0,Math.min(t,s.length-1));r.forEach(l=>{o>=s.length||(s[o]=l,o+=1)}),this._applyValue(s.join(""),e,!0),this.focusIndex(Math.min(o,s.length-1))}_syncUi(){if(!this._groupEl||!this._labelEl||!this._descriptionEl||!this._errorEl||!this._metaEl)return;const t=Array.from({length:u(this)},(n,c)=>this._value[c]||""),i=this._placeholderChar(),e=this.getAttribute("label")||"",r=this.getAttribute("description")||"",s=this.getAttribute("error")||"",o=this.hasAttribute("required"),l=this._labelEl.querySelector(".label-text"),h=this._labelEl.querySelector(".required");l&&(l.textContent=e),h&&h.toggleAttribute("hidden",!o),this._labelEl.toggleAttribute("hidden",!e),this._descriptionEl.textContent=r,this._descriptionEl.toggleAttribute("hidden",!r),this._errorEl.textContent=s,this._errorEl.toggleAttribute("hidden",!s),this._metaEl.toggleAttribute("hidden",!e&&!r);const f=e?d(this._labelEl,"ui-pin-label"):"",v=r?d(this._descriptionEl,"ui-pin-description"):"",y=s?d(this._errorEl,"ui-pin-error"):"",m=[v,y].filter(Boolean).join(" ");this._inputs.forEach((n,c)=>{const g=t[c]||"";n.value=g,n.setAttribute("data-filled",g?"true":"false"),n.placeholder=i,n.disabled=this._disabled(),n.readOnly=this._readOnly(),n.setAttribute("aria-label",`Digit ${c+1} of ${t.length}`),f?n.setAttribute("aria-labelledby",f):n.removeAttribute("aria-labelledby"),m?n.setAttribute("aria-describedby",m):n.removeAttribute("aria-describedby"),s||this.hasAttribute("invalid")?n.setAttribute("aria-invalid","true"):n.removeAttribute("aria-invalid"),n.inputMode=this._mode()==="numeric"?"numeric":"text",n.pattern=this._mode()==="numeric"?"[0-9]*":this._mode()==="alpha"?"[A-Za-z]*":"[A-Za-z0-9]*"})}_registerWithForm(){this._formUnregister&&(this._formUnregister(),this._formUnregister=null);try{const r=this.getRootNode().host?.closest?.("ui-form")||null||this.closest("ui-form"),s=this.getAttribute("name");r&&typeof r.registerField=="function"&&s&&(this._formUnregister=r.registerField(s,{name:s,getValue:()=>this.value,setValue:o=>{o==null||o===""?this.removeAttribute("value"):this.setAttribute("value",String(o))},validate:async()=>this.hasAttribute("required")&&this.value.length<u(this)?{valid:!1,message:"Enter the full verification code."}:{valid:!0,message:void 0},setError:o=>{o?(this.setAttribute("error",o),this.toggleAttribute("invalid",!0)):(this.removeAttribute("error"),this.removeAttribute("invalid")),this._syncUi()}}))}catch{}}}class _ extends p{}typeof customElements<"u"&&!customElements.get("ui-pin-input")&&customElements.define("ui-pin-input",p);typeof customElements<"u"&&!customElements.get("ui-otp-input")&&customElements.define("ui-otp-input",_);exports.UIOtpInput=_;exports.UIPinInput=p;
@@ -1,4 +1,4 @@
1
- import { E as x } from "./ElementBase-909688f3.mjs";
1
+ import { E as x } from "./ElementBase-YlTLMsGk.mjs";
2
2
  const y = `
3
3
  :host {
4
4
  --ui-pin-gap: 10px;
@@ -172,24 +172,23 @@ const y = `
172
172
  }
173
173
  }
174
174
  `;
175
- function A(n) {
176
- return Number.isFinite(n) ? Math.max(1, Math.min(12, Math.floor(n))) : 6;
175
+ function A(a) {
176
+ return Number.isFinite(a) ? Math.max(1, Math.min(12, Math.floor(a))) : 6;
177
177
  }
178
- function u(n) {
179
- return A(Number(n.getAttribute("length") || 6));
178
+ function u(a) {
179
+ return A(Number(a.getAttribute("length") || 6));
180
180
  }
181
- function d(n, t) {
182
- return n.id || (n.id = `${t}-${Math.random().toString(36).slice(2, 9)}`), n.id;
181
+ function d(a, t) {
182
+ return a.id || (a.id = `${t}-${Math.random().toString(36).slice(2, 9)}`), a.id;
183
183
  }
184
- function E(n, t) {
185
- const i = n.trim();
186
- if (!i)
187
- return "";
184
+ function E(a, t) {
185
+ const i = a.trim();
186
+ if (!i) return "";
188
187
  const e = i.slice(-1);
189
188
  return t === "numeric" ? /^[0-9]$/.test(e) ? e : "" : t === "alpha" ? /^[a-z]$/i.test(e) ? e.toUpperCase() : "" : /^[a-z0-9]$/i.test(e) ? e.toUpperCase() : "";
190
189
  }
191
- function g(n, t) {
192
- return Array.from(n).map((i) => E(i, t)).filter(Boolean);
190
+ function g(a, t) {
191
+ return Array.from(a).map((i) => E(i, t)).filter(Boolean);
193
192
  }
194
193
  class b extends x {
195
194
  constructor() {
@@ -200,18 +199,15 @@ class b extends x {
200
199
  } catch {
201
200
  }
202
201
  }, this._onInput = (t) => {
203
- if (this._disabled() || this._readOnly())
204
- return;
202
+ if (this._disabled() || this._readOnly()) return;
205
203
  const i = t.currentTarget, e = Number(i.getAttribute("data-index") || 0);
206
204
  this._fillFromIndex(e, i.value, "input");
207
205
  }, this._onPaste = (t) => {
208
- var s;
209
- if (this._disabled() || this._readOnly())
210
- return;
211
- const i = t.currentTarget, e = Number(i.getAttribute("data-index") || 0), r = ((s = t.clipboardData) == null ? void 0 : s.getData("text")) || "";
206
+ if (this._disabled() || this._readOnly()) return;
207
+ const i = t.currentTarget, e = Number(i.getAttribute("data-index") || 0), r = t.clipboardData?.getData("text") || "";
212
208
  r && (t.preventDefault(), this._fillFromIndex(e, r, "paste"));
213
209
  }, this._onKeyDown = (t) => {
214
- const i = t.currentTarget, e = Number(i.getAttribute("data-index") || 0), r = Array.from({ length: u(this) }, (s, a) => this._value[a] || "");
210
+ const i = t.currentTarget, e = Number(i.getAttribute("data-index") || 0), r = Array.from({ length: u(this) }, (s, o) => this._value[o] || "");
215
211
  if (t.key === "ArrowLeft") {
216
212
  t.preventDefault(), this.focusIndex(e - 1);
217
213
  return;
@@ -303,8 +299,8 @@ class b extends x {
303
299
  }
304
300
  render() {
305
301
  const t = u(this), i = Array.from({ length: t }, (e, r) => {
306
- const s = this.hasAttribute("mask") ? "password" : "text", a = r === 0 ? "one-time-code" : "off", l = this._mode() === "numeric" ? "numeric" : "text";
307
- return `<input class="slot" part="slot" data-index="${r}" type="${s}" inputmode="${l}" autocomplete="${a}" maxlength="1" />`;
302
+ const s = this.hasAttribute("mask") ? "password" : "text", o = r === 0 ? "one-time-code" : "off", l = this._mode() === "numeric" ? "numeric" : "text";
303
+ return `<input class="slot" part="slot" data-index="${r}" type="${s}" inputmode="${l}" autocomplete="${o}" maxlength="1" />`;
308
304
  }).join("");
309
305
  this.setContent(`
310
306
  <style>${y}</style>
@@ -366,36 +362,34 @@ class b extends x {
366
362
  return;
367
363
  }
368
364
  const s = Array.from({ length: u(this) }, (l, h) => this._value[h] || "");
369
- let a = Math.max(0, Math.min(t, s.length - 1));
365
+ let o = Math.max(0, Math.min(t, s.length - 1));
370
366
  r.forEach((l) => {
371
- a >= s.length || (s[a] = l, a += 1);
372
- }), this._applyValue(s.join(""), e, !0), this.focusIndex(Math.min(a, s.length - 1));
367
+ o >= s.length || (s[o] = l, o += 1);
368
+ }), this._applyValue(s.join(""), e, !0), this.focusIndex(Math.min(o, s.length - 1));
373
369
  }
374
370
  _syncUi() {
375
- if (!this._groupEl || !this._labelEl || !this._descriptionEl || !this._errorEl || !this._metaEl)
376
- return;
377
- const t = Array.from({ length: u(this) }, (o, c) => this._value[c] || ""), i = this._placeholderChar(), e = this.getAttribute("label") || "", r = this.getAttribute("description") || "", s = this.getAttribute("error") || "", a = this.hasAttribute("required"), l = this._labelEl.querySelector(".label-text"), h = this._labelEl.querySelector(".required");
378
- l && (l.textContent = e), h && h.toggleAttribute("hidden", !a), this._labelEl.toggleAttribute("hidden", !e), this._descriptionEl.textContent = r, this._descriptionEl.toggleAttribute("hidden", !r), this._errorEl.textContent = s, this._errorEl.toggleAttribute("hidden", !s), this._metaEl.toggleAttribute("hidden", !e && !r);
371
+ if (!this._groupEl || !this._labelEl || !this._descriptionEl || !this._errorEl || !this._metaEl) return;
372
+ const t = Array.from({ length: u(this) }, (n, c) => this._value[c] || ""), i = this._placeholderChar(), e = this.getAttribute("label") || "", r = this.getAttribute("description") || "", s = this.getAttribute("error") || "", o = this.hasAttribute("required"), l = this._labelEl.querySelector(".label-text"), h = this._labelEl.querySelector(".required");
373
+ l && (l.textContent = e), h && h.toggleAttribute("hidden", !o), this._labelEl.toggleAttribute("hidden", !e), this._descriptionEl.textContent = r, this._descriptionEl.toggleAttribute("hidden", !r), this._errorEl.textContent = s, this._errorEl.toggleAttribute("hidden", !s), this._metaEl.toggleAttribute("hidden", !e && !r);
379
374
  const p = e ? d(this._labelEl, "ui-pin-label") : "", _ = r ? d(this._descriptionEl, "ui-pin-description") : "", v = s ? d(this._errorEl, "ui-pin-error") : "", f = [_, v].filter(Boolean).join(" ");
380
- this._inputs.forEach((o, c) => {
375
+ this._inputs.forEach((n, c) => {
381
376
  const m = t[c] || "";
382
- o.value = m, o.setAttribute("data-filled", m ? "true" : "false"), o.placeholder = i, o.disabled = this._disabled(), o.readOnly = this._readOnly(), o.setAttribute("aria-label", `Digit ${c + 1} of ${t.length}`), p ? o.setAttribute("aria-labelledby", p) : o.removeAttribute("aria-labelledby"), f ? o.setAttribute("aria-describedby", f) : o.removeAttribute("aria-describedby"), s || this.hasAttribute("invalid") ? o.setAttribute("aria-invalid", "true") : o.removeAttribute("aria-invalid"), o.inputMode = this._mode() === "numeric" ? "numeric" : "text", o.pattern = this._mode() === "numeric" ? "[0-9]*" : this._mode() === "alpha" ? "[A-Za-z]*" : "[A-Za-z0-9]*";
377
+ n.value = m, n.setAttribute("data-filled", m ? "true" : "false"), n.placeholder = i, n.disabled = this._disabled(), n.readOnly = this._readOnly(), n.setAttribute("aria-label", `Digit ${c + 1} of ${t.length}`), p ? n.setAttribute("aria-labelledby", p) : n.removeAttribute("aria-labelledby"), f ? n.setAttribute("aria-describedby", f) : n.removeAttribute("aria-describedby"), s || this.hasAttribute("invalid") ? n.setAttribute("aria-invalid", "true") : n.removeAttribute("aria-invalid"), n.inputMode = this._mode() === "numeric" ? "numeric" : "text", n.pattern = this._mode() === "numeric" ? "[0-9]*" : this._mode() === "alpha" ? "[A-Za-z]*" : "[A-Za-z0-9]*";
383
378
  });
384
379
  }
385
380
  _registerWithForm() {
386
- var t;
387
381
  this._formUnregister && (this._formUnregister(), this._formUnregister = null);
388
382
  try {
389
- const e = this.getRootNode().host, s = ((t = e == null ? void 0 : e.closest) == null ? void 0 : t.call(e, "ui-form")) || null || this.closest("ui-form"), a = this.getAttribute("name");
390
- s && typeof s.registerField == "function" && a && (this._formUnregister = s.registerField(a, {
391
- name: a,
383
+ const r = this.getRootNode().host?.closest?.("ui-form") || null || this.closest("ui-form"), s = this.getAttribute("name");
384
+ r && typeof r.registerField == "function" && s && (this._formUnregister = r.registerField(s, {
385
+ name: s,
392
386
  getValue: () => this.value,
393
- setValue: (l) => {
394
- l == null || l === "" ? this.removeAttribute("value") : this.setAttribute("value", String(l));
387
+ setValue: (o) => {
388
+ o == null || o === "" ? this.removeAttribute("value") : this.setAttribute("value", String(o));
395
389
  },
396
390
  validate: async () => this.hasAttribute("required") && this.value.length < u(this) ? { valid: !1, message: "Enter the full verification code." } : { valid: !0, message: void 0 },
397
- setError: (l) => {
398
- l ? (this.setAttribute("error", l), this.toggleAttribute("invalid", !0)) : (this.removeAttribute("error"), this.removeAttribute("invalid")), this._syncUi();
391
+ setError: (o) => {
392
+ o ? (this.setAttribute("error", o), this.toggleAttribute("invalid", !0)) : (this.removeAttribute("error"), this.removeAttribute("invalid")), this._syncUi();
399
393
  }
400
394
  }));
401
395
  } catch {
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const w=require("./ElementBase-1b301e7f.js"),A={sm:"var(--ui-breakpoint-sm, 640px)",md:"var(--ui-breakpoint-md, 768px)",lg:"var(--ui-breakpoint-lg, 1024px)",xl:"var(--ui-breakpoint-xl, 1280px)"},p=["display","columns","rows","gap","rowgap","columngap","autoflow","autorows","autocolumns","align","justify","place","aligncontent","justifycontent","placecontent"],I={xs:"var(--ui-space-xs, 4px)",sm:"var(--ui-space-sm, 8px)",md:"var(--ui-space-md, 12px)",lg:"var(--ui-space-lg, 20px)",xl:"var(--ui-space-xl, 28px)"},y=["data-row","data-column","data-row-span","data-column-span","data-value","data-selected","data-disabled","hidden"],x=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const _=require("./ElementBase-EV6mVBUV.js"),v={sm:"var(--ui-breakpoint-sm, 640px)",md:"var(--ui-breakpoint-md, 768px)",lg:"var(--ui-breakpoint-lg, 1024px)",xl:"var(--ui-breakpoint-xl, 1280px)"},p=["display","columns","rows","gap","rowgap","columngap","autoflow","autorows","autocolumns","align","justify","place","aligncontent","justifycontent","placecontent"],w={xs:"var(--ui-space-xs, 4px)",sm:"var(--ui-space-sm, 8px)",md:"var(--ui-space-md, 12px)",lg:"var(--ui-space-lg, 20px)",xl:"var(--ui-space-xl, 28px)"},A=["data-row","data-column","data-row-span","data-column-span","data-value","data-selected","data-disabled","hidden"],I=`
2
2
  :host {
3
3
  --ui-placement-display: grid;
4
4
  --ui-placement-columns: 1fr;
@@ -94,6 +94,6 @@
94
94
  --ui-placement-focus-ring: Highlight;
95
95
  }
96
96
  }
97
- `;function b(c){if(!c)return null;const t=c.trim();if(!t.startsWith("{"))return null;try{const e=JSON.parse(t);return!e||typeof e!="object"?null:e}catch{return null}}function h(c){return I[c]||c}function d(c){if(!c)return null;const t=Number.parseInt(c,10);return!Number.isFinite(t)||t<1?null:t}function _(c,t){switch(c){case"display":return{"--ui-placement-display":t};case"columns":return{"--ui-placement-columns":t};case"rows":return{"--ui-placement-rows":t};case"gap":return{"--ui-placement-gap":h(t)};case"rowgap":return{"--ui-placement-row-gap":h(t)};case"columngap":return{"--ui-placement-column-gap":h(t)};case"autoflow":return{"--ui-placement-auto-flow":t};case"autorows":return{"--ui-placement-auto-rows":t};case"autocolumns":return{"--ui-placement-auto-columns":t};case"align":return{"--ui-placement-align-items":t};case"justify":return{"--ui-placement-justify-items":t};case"place":return{"--ui-placement-place-items":t};case"aligncontent":return{"--ui-placement-align-content":t};case"justifycontent":return{"--ui-placement-justify-content":t};case"placecontent":return{"--ui-placement-place-content":t};default:return{}}}class v extends w.ElementBase{constructor(){super(...arguments),this._lastClassname="",this._appliedInlineProps=new Set,this._mutationObserver=null,this._suppressMutations=!1,this._focusedValue=null,this._dragItem=null,this._dragOverItem=null,this._onKeyDownBound=t=>this._onKeyDown(t),this._onClickBound=t=>this._onClick(t),this._onDragStartBound=t=>this._onDragStart(t),this._onDragOverBound=t=>this._onDragOver(t),this._onDropBound=t=>this._onDrop(t),this._onDragEndBound=()=>this._clearDragState()}static get observedAttributes(){return["classname","headless","interactive","draggable","order",...p]}connectedCallback(){super.connectedCallback(),this._observeMutations(),this.addEventListener("keydown",this._onKeyDownBound),this.addEventListener("click",this._onClickBound),this.addEventListener("dragstart",this._onDragStartBound),this.addEventListener("dragover",this._onDragOverBound),this.addEventListener("drop",this._onDropBound),this.addEventListener("dragend",this._onDragEndBound)}disconnectedCallback(){var t;this.removeEventListener("keydown",this._onKeyDownBound),this.removeEventListener("click",this._onClickBound),this.removeEventListener("dragstart",this._onDragStartBound),this.removeEventListener("dragover",this._onDragOverBound),this.removeEventListener("drop",this._onDropBound),this.removeEventListener("dragend",this._onDragEndBound),(t=this._mutationObserver)==null||t.disconnect(),this._mutationObserver=null,this._clearDragState(),super.disconnectedCallback()}refresh(){this.requestRender()}focusItem(t){const e=this._resolveItem(t);e&&this._setFocusedItem(e,!0)}moveItem(t,e,s){const a=this._resolveItem(t);a&&this._moveItemTo(a,Math.max(1,e),Math.max(1,s),"api")}_observeMutations(){this._mutationObserver||(this._mutationObserver=new MutationObserver(()=>{this._suppressMutations||this.requestRender()}),this._mutationObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[...y]}))}_syncLegacyClassname(){const t=this.getAttribute("classname")||"";t!==this._lastClassname&&(this._lastClassname&&this._lastClassname.split(/\s+/).forEach(e=>{e&&this.classList.remove(e)}),t&&t.split(/\s+/).forEach(e=>{e&&this.classList.add(e)}),this._lastClassname=t)}_applyInlineStyles(){this._appliedInlineProps.forEach(t=>this.style.removeProperty(t)),this._appliedInlineProps.clear(),p.forEach(t=>{const e=this.getAttribute(t);if(!e||b(e))return;const s=_(t,e);Object.entries(s).forEach(([a,n])=>{this.style.setProperty(a,n),this._appliedInlineProps.add(a)})})}_buildResponsiveCss(){const t={},e={sm:{},md:{},lg:{},xl:{}};p.forEach(r=>{const l=this.getAttribute(r),i=b(l);if(!i)return;const o=(u,m)=>{Object.assign(u,_(r,m))};typeof i.initial=="string"&&o(t,i.initial),typeof i.sm=="string"&&o(e.sm,i.sm),typeof i.md=="string"&&o(e.md,i.md),typeof i.lg=="string"&&o(e.lg,i.lg),typeof i.xl=="string"&&o(e.xl,i.xl)});const s=(r,l)=>{const i=Object.entries(l);return i.length?`${r} { ${i.map(([o,u])=>`${o}: ${u};`).join(" ")} }`:""},a=[],n=s(":host",t);return n&&a.push(n),Object.keys(e).forEach(r=>{const l=s(":host",e[r]);l&&a.push(`@media (min-width: ${A[r]}) { ${l} }`)}),a.join(`
98
- `)}_items(){return Array.from(this.children).filter(t=>t instanceof HTMLElement&&t.hasAttribute("data-ui-placement-item"))}_resolveItem(t){const e=this._items();return typeof t=="number"?e[t]||null:e.find(s=>(s.getAttribute("data-value")||s.id||"")===t)||null}_fallbackColumnCount(){return d(this.getAttribute("columns"))||1}_computeItems(){const t=this._fallbackColumnCount();let e=0;return this._items().map((s,a)=>{let n=d(s.getAttribute("data-row")),r=d(s.getAttribute("data-column"));const l=d(s.getAttribute("data-row-span"))||1,i=d(s.getAttribute("data-column-span"))||1;if(n==null||r==null){const o=e++,u=Math.floor(o/t)+1,m=o%t+1;n==null&&(n=u),r==null&&(r=m)}return{el:s,index:a,row:n,column:r,rowSpan:l,columnSpan:i,value:s.getAttribute("data-value")||s.id||String(a),disabled:s.hasAttribute("disabled")||s.hasAttribute("data-disabled"),selected:s.hasAttribute("data-selected")}})}_order(){return this.getAttribute("order")==="row-major"?"row-major":"dom"}_isInteractive(){return this.hasAttribute("interactive")||this.hasAttribute("draggable")}_isDraggable(){return this.hasAttribute("draggable")}_sortMeta(t){return[...t].sort((e,s)=>e.row!==s.row?e.row-s.row:e.column!==s.column?e.column-s.column:e.index-s.index)}_syncHostSemantics(t){this._isInteractive()?(this.hasAttribute("role")||(this.setAttribute("role","grid"),this.setAttribute("data-ui-placement-role","")),this.setAttribute("aria-rowcount",String(t.reduce((e,s)=>Math.max(e,s.row+s.rowSpan-1),0))),this.setAttribute("aria-colcount",String(t.reduce((e,s)=>Math.max(e,s.column+s.columnSpan-1),this._fallbackColumnCount())))):this.hasAttribute("data-ui-placement-role")&&(this.removeAttribute("role"),this.removeAttribute("data-ui-placement-role"),this.removeAttribute("aria-rowcount"),this.removeAttribute("aria-colcount"))}_setFocusedItem(t,e=!1){const s=this._items(),a=t||s[0]||null;this._focusedValue=a&&(a.getAttribute("data-value")||a.id)||null,s.forEach(n=>{this._isInteractive()?n.tabIndex=n===a?0:-1:n.removeAttribute("tabindex")}),e&&a&&a.focus({preventScroll:!0})}_syncItems(){var s,a;const t=this._computeItems(),e=this._order()==="row-major"?this._sortMeta(t):t;this._suppressMutations=!0;try{this._order()==="row-major"&&e.forEach(r=>this.appendChild(r.el)),this._syncHostSemantics(e);const n=((s=e.find(r=>r.value===this._focusedValue))==null?void 0:s.el)||((a=e[0])==null?void 0:a.el)||null;e.forEach(r=>{r.el.style.gridColumn=`${r.column} / span ${r.columnSpan}`,r.el.style.gridRow=`${r.row} / span ${r.rowSpan}`,r.el.style.minInlineSize="0",r.el.style.boxSizing="border-box",this._isInteractive()?(r.el.hasAttribute("role")||r.el.setAttribute("role","gridcell"),r.el.setAttribute("aria-rowindex",String(r.row)),r.el.setAttribute("aria-colindex",String(r.column)),r.columnSpan>1?r.el.setAttribute("aria-colspan",String(r.columnSpan)):r.el.removeAttribute("aria-colspan"),r.rowSpan>1?r.el.setAttribute("aria-rowspan",String(r.rowSpan)):r.el.removeAttribute("aria-rowspan"),r.selected?r.el.setAttribute("aria-selected","true"):r.el.removeAttribute("aria-selected"),r.disabled?r.el.setAttribute("aria-disabled","true"):r.el.removeAttribute("aria-disabled")):(r.el.removeAttribute("aria-rowindex"),r.el.removeAttribute("aria-colindex"),r.el.removeAttribute("aria-rowspan"),r.el.removeAttribute("aria-colspan"),r.el.removeAttribute("aria-selected"),r.el.removeAttribute("aria-disabled")),this._isDraggable()&&!r.disabled?(r.el.setAttribute("data-draggable",""),r.el.setAttribute("draggable","true")):(r.el.removeAttribute("data-draggable"),r.el.removeAttribute("draggable"))}),this._setFocusedItem(n,!1)}finally{this._suppressMutations=!1}}_findItemFromTarget(t){if(!(t instanceof Element))return null;const e=t.closest("[data-ui-placement-item]");return e instanceof HTMLElement&&this.contains(e)?e:null}_metaForItem(t){return this._computeItems().find(e=>e.el===t)||null}_intervalsOverlap(t,e,s,a){const n=t+e-1,r=s+a-1;return t<=r&&s<=n}_findNeighbor(t,e){var r,l;const s=this._computeItems().filter(i=>!i.disabled&&i.el!==t.el);if(!s.length)return null;const a=s.filter(i=>e==="left"||e==="right"?this._intervalsOverlap(t.row,t.rowSpan,i.row,i.rowSpan)?e==="left"?i.column<t.column:i.column>t.column:!1:this._intervalsOverlap(t.column,t.columnSpan,i.column,i.columnSpan)?e==="up"?i.row<t.row:i.row>t.row:!1);if(!a.length){const i=this._order()==="row-major"?this._sortMeta(this._computeItems()):this._computeItems(),o=i.findIndex(m=>m.el===t.el);return((r=i[o+(e==="left"||e==="up"?-1:1)])==null?void 0:r.el)||null}return((l=a.sort((i,o)=>{if(e==="left"||e==="right"){const g=Math.abs(i.column-t.column),f=Math.abs(o.column-t.column);return g!==f?g-f:Math.abs(i.row-t.row)-Math.abs(o.row-t.row)}const u=Math.abs(i.row-t.row),m=Math.abs(o.row-t.row);return u!==m?u-m:Math.abs(i.column-t.column)-Math.abs(o.column-t.column)})[0])==null?void 0:l.el)||null}_moveItemTo(t,e,s,a){const n=this._metaForItem(t);!n||n.disabled||(t.setAttribute("data-row",String(e)),t.setAttribute("data-column",String(s)),this.dispatchEvent(new CustomEvent("itemmove",{bubbles:!0,composed:!0,detail:{value:n.value,reason:a,from:{row:n.row,column:n.column},to:{row:e,column:s}}})),this.requestRender())}_swapItems(t,e,s){const a=this._metaForItem(t),n=this._metaForItem(e);!a||!n||(t.setAttribute("data-row",String(n.row)),t.setAttribute("data-column",String(n.column)),e.setAttribute("data-row",String(a.row)),e.setAttribute("data-column",String(a.column)),this.dispatchEvent(new CustomEvent("itemmove",{bubbles:!0,composed:!0,detail:{value:a.value,targetValue:n.value,reason:s,from:{row:a.row,column:a.column},to:{row:n.row,column:n.column}}})),this.requestRender())}_onClick(t){if(!this._isInteractive())return;const e=this._findItemFromTarget(t.target);e&&this._setFocusedItem(e,!1)}_onKeyDown(t){var l,i;if(!this._isInteractive())return;const e=this._findItemFromTarget(t.target);if(!e)return;const s=this._metaForItem(e);if(!s||s.disabled)return;const a=t.key,n=a==="ArrowLeft"||a==="ArrowRight"||a==="ArrowUp"||a==="ArrowDown";if(t.altKey&&this._isDraggable()&&n){t.preventDefault();const o=a==="ArrowDown"?1:a==="ArrowUp"?-1:0,u=a==="ArrowRight"?1:a==="ArrowLeft"?-1:0;this._moveItemTo(e,Math.max(1,s.row+o),Math.max(1,s.column+u),"keyboard"),this._setFocusedItem(e,!0);return}let r=null;if(a==="ArrowLeft")r=this._findNeighbor(s,"left");else if(a==="ArrowRight")r=this._findNeighbor(s,"right");else if(a==="ArrowUp")r=this._findNeighbor(s,"up");else if(a==="ArrowDown")r=this._findNeighbor(s,"down");else if(a==="Home")r=((l=(this._order()==="row-major"?this._sortMeta(this._computeItems()):this._computeItems())[0])==null?void 0:l.el)||null;else if(a==="End"){const o=this._order()==="row-major"?this._sortMeta(this._computeItems()):this._computeItems();r=((i=o[o.length-1])==null?void 0:i.el)||null}r&&(t.preventDefault(),this._setFocusedItem(r,!0))}_onDragStart(t){if(!this._isDraggable())return;const e=this._findItemFromTarget(t.target);!e||e.hasAttribute("data-disabled")||(this._dragItem=e,e.setAttribute("data-dragging",""),t.dataTransfer&&(t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",e.getAttribute("data-value")||e.id||"")))}_onDragOver(t){if(!this._dragItem)return;const e=this._findItemFromTarget(t.target);!e||e===this._dragItem||(t.preventDefault(),this._dragOverItem&&this._dragOverItem!==e&&this._dragOverItem.removeAttribute("data-drag-over"),this._dragOverItem=e,e.setAttribute("data-drag-over",""))}_onDrop(t){if(!this._dragItem)return;const e=this._findItemFromTarget(t.target);t.preventDefault(),e&&e!==this._dragItem&&(this._swapItems(this._dragItem,e,"pointer"),this._setFocusedItem(this._dragItem,!1)),this._clearDragState()}_clearDragState(){this._dragItem&&this._dragItem.removeAttribute("data-dragging"),this._dragOverItem&&this._dragOverItem.removeAttribute("data-drag-over"),this._dragItem=null,this._dragOverItem=null}render(){this._syncLegacyClassname(),this._applyInlineStyles(),this._syncItems();const t=this._buildResponsiveCss();this.setContent(`<style>${x}${t?`
99
- ${t}`:""}</style><slot></slot>`)}shouldRenderOnAttributeChange(t,e,s){return!0}}typeof customElements<"u"&&!customElements.get("ui-placement-grid")&&customElements.define("ui-placement-grid",v);exports.UIPlacementGrid=v;
97
+ `;function g(u){if(!u)return null;const t=u.trim();if(!t.startsWith("{"))return null;try{const e=JSON.parse(t);return!e||typeof e!="object"?null:e}catch{return null}}function h(u){return w[u]||u}function d(u){if(!u)return null;const t=Number.parseInt(u,10);return!Number.isFinite(t)||t<1?null:t}function f(u,t){switch(u){case"display":return{"--ui-placement-display":t};case"columns":return{"--ui-placement-columns":t};case"rows":return{"--ui-placement-rows":t};case"gap":return{"--ui-placement-gap":h(t)};case"rowgap":return{"--ui-placement-row-gap":h(t)};case"columngap":return{"--ui-placement-column-gap":h(t)};case"autoflow":return{"--ui-placement-auto-flow":t};case"autorows":return{"--ui-placement-auto-rows":t};case"autocolumns":return{"--ui-placement-auto-columns":t};case"align":return{"--ui-placement-align-items":t};case"justify":return{"--ui-placement-justify-items":t};case"place":return{"--ui-placement-place-items":t};case"aligncontent":return{"--ui-placement-align-content":t};case"justifycontent":return{"--ui-placement-justify-content":t};case"placecontent":return{"--ui-placement-place-content":t};default:return{}}}class b extends _.ElementBase{constructor(){super(...arguments),this._lastClassname="",this._appliedInlineProps=new Set,this._mutationObserver=null,this._suppressMutations=!1,this._focusedValue=null,this._dragItem=null,this._dragOverItem=null,this._onKeyDownBound=t=>this._onKeyDown(t),this._onClickBound=t=>this._onClick(t),this._onDragStartBound=t=>this._onDragStart(t),this._onDragOverBound=t=>this._onDragOver(t),this._onDropBound=t=>this._onDrop(t),this._onDragEndBound=()=>this._clearDragState()}static get observedAttributes(){return["classname","headless","interactive","draggable","order",...p]}connectedCallback(){super.connectedCallback(),this._observeMutations(),this.addEventListener("keydown",this._onKeyDownBound),this.addEventListener("click",this._onClickBound),this.addEventListener("dragstart",this._onDragStartBound),this.addEventListener("dragover",this._onDragOverBound),this.addEventListener("drop",this._onDropBound),this.addEventListener("dragend",this._onDragEndBound)}disconnectedCallback(){this.removeEventListener("keydown",this._onKeyDownBound),this.removeEventListener("click",this._onClickBound),this.removeEventListener("dragstart",this._onDragStartBound),this.removeEventListener("dragover",this._onDragOverBound),this.removeEventListener("drop",this._onDropBound),this.removeEventListener("dragend",this._onDragEndBound),this._mutationObserver?.disconnect(),this._mutationObserver=null,this._clearDragState(),super.disconnectedCallback()}refresh(){this.requestRender()}focusItem(t){const e=this._resolveItem(t);e&&this._setFocusedItem(e,!0)}moveItem(t,e,s){const r=this._resolveItem(t);r&&this._moveItemTo(r,Math.max(1,e),Math.max(1,s),"api")}_observeMutations(){this._mutationObserver||(this._mutationObserver=new MutationObserver(()=>{this._suppressMutations||this.requestRender()}),this._mutationObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[...A]}))}_syncLegacyClassname(){const t=this.getAttribute("classname")||"";t!==this._lastClassname&&(this._lastClassname&&this._lastClassname.split(/\s+/).forEach(e=>{e&&this.classList.remove(e)}),t&&t.split(/\s+/).forEach(e=>{e&&this.classList.add(e)}),this._lastClassname=t)}_applyInlineStyles(){this._appliedInlineProps.forEach(t=>this.style.removeProperty(t)),this._appliedInlineProps.clear(),p.forEach(t=>{const e=this.getAttribute(t);if(!e||g(e))return;const s=f(t,e);Object.entries(s).forEach(([r,i])=>{this.style.setProperty(r,i),this._appliedInlineProps.add(r)})})}_buildResponsiveCss(){const t={},e={sm:{},md:{},lg:{},xl:{}};p.forEach(a=>{const o=this.getAttribute(a),n=g(o);if(!n)return;const l=(c,m)=>{Object.assign(c,f(a,m))};typeof n.initial=="string"&&l(t,n.initial),typeof n.sm=="string"&&l(e.sm,n.sm),typeof n.md=="string"&&l(e.md,n.md),typeof n.lg=="string"&&l(e.lg,n.lg),typeof n.xl=="string"&&l(e.xl,n.xl)});const s=(a,o)=>{const n=Object.entries(o);return n.length?`${a} { ${n.map(([l,c])=>`${l}: ${c};`).join(" ")} }`:""},r=[],i=s(":host",t);return i&&r.push(i),Object.keys(e).forEach(a=>{const o=s(":host",e[a]);o&&r.push(`@media (min-width: ${v[a]}) { ${o} }`)}),r.join(`
98
+ `)}_items(){return Array.from(this.children).filter(t=>t instanceof HTMLElement&&t.hasAttribute("data-ui-placement-item"))}_resolveItem(t){const e=this._items();return typeof t=="number"?e[t]||null:e.find(s=>(s.getAttribute("data-value")||s.id||"")===t)||null}_fallbackColumnCount(){return d(this.getAttribute("columns"))||1}_computeItems(){const t=this._fallbackColumnCount();let e=0;return this._items().map((s,r)=>{let i=d(s.getAttribute("data-row")),a=d(s.getAttribute("data-column"));const o=d(s.getAttribute("data-row-span"))||1,n=d(s.getAttribute("data-column-span"))||1;if(i==null||a==null){const l=e++,c=Math.floor(l/t)+1,m=l%t+1;i==null&&(i=c),a==null&&(a=m)}return{el:s,index:r,row:i,column:a,rowSpan:o,columnSpan:n,value:s.getAttribute("data-value")||s.id||String(r),disabled:s.hasAttribute("disabled")||s.hasAttribute("data-disabled"),selected:s.hasAttribute("data-selected")}})}_order(){return this.getAttribute("order")==="row-major"?"row-major":"dom"}_isInteractive(){return this.hasAttribute("interactive")||this.hasAttribute("draggable")}_isDraggable(){return this.hasAttribute("draggable")}_sortMeta(t){return[...t].sort((e,s)=>e.row!==s.row?e.row-s.row:e.column!==s.column?e.column-s.column:e.index-s.index)}_syncHostSemantics(t){this._isInteractive()?(this.hasAttribute("role")||(this.setAttribute("role","grid"),this.setAttribute("data-ui-placement-role","")),this.setAttribute("aria-rowcount",String(t.reduce((e,s)=>Math.max(e,s.row+s.rowSpan-1),0))),this.setAttribute("aria-colcount",String(t.reduce((e,s)=>Math.max(e,s.column+s.columnSpan-1),this._fallbackColumnCount())))):this.hasAttribute("data-ui-placement-role")&&(this.removeAttribute("role"),this.removeAttribute("data-ui-placement-role"),this.removeAttribute("aria-rowcount"),this.removeAttribute("aria-colcount"))}_setFocusedItem(t,e=!1){const s=this._items(),r=t||s[0]||null;this._focusedValue=r&&(r.getAttribute("data-value")||r.id)||null,s.forEach(i=>{this._isInteractive()?i.tabIndex=i===r?0:-1:i.removeAttribute("tabindex")}),e&&r&&r.focus({preventScroll:!0})}_syncItems(){const t=this._computeItems(),e=this._order()==="row-major"?this._sortMeta(t):t;this._suppressMutations=!0;try{this._order()==="row-major"&&e.forEach(r=>this.appendChild(r.el)),this._syncHostSemantics(e);const s=e.find(r=>r.value===this._focusedValue)?.el||e[0]?.el||null;e.forEach(r=>{r.el.style.gridColumn=`${r.column} / span ${r.columnSpan}`,r.el.style.gridRow=`${r.row} / span ${r.rowSpan}`,r.el.style.minInlineSize="0",r.el.style.boxSizing="border-box",this._isInteractive()?(r.el.hasAttribute("role")||r.el.setAttribute("role","gridcell"),r.el.setAttribute("aria-rowindex",String(r.row)),r.el.setAttribute("aria-colindex",String(r.column)),r.columnSpan>1?r.el.setAttribute("aria-colspan",String(r.columnSpan)):r.el.removeAttribute("aria-colspan"),r.rowSpan>1?r.el.setAttribute("aria-rowspan",String(r.rowSpan)):r.el.removeAttribute("aria-rowspan"),r.selected?r.el.setAttribute("aria-selected","true"):r.el.removeAttribute("aria-selected"),r.disabled?r.el.setAttribute("aria-disabled","true"):r.el.removeAttribute("aria-disabled")):(r.el.removeAttribute("aria-rowindex"),r.el.removeAttribute("aria-colindex"),r.el.removeAttribute("aria-rowspan"),r.el.removeAttribute("aria-colspan"),r.el.removeAttribute("aria-selected"),r.el.removeAttribute("aria-disabled")),this._isDraggable()&&!r.disabled?(r.el.setAttribute("data-draggable",""),r.el.setAttribute("draggable","true")):(r.el.removeAttribute("data-draggable"),r.el.removeAttribute("draggable"))}),this._setFocusedItem(s,!1)}finally{this._suppressMutations=!1}}_findItemFromTarget(t){if(!(t instanceof Element))return null;const e=t.closest("[data-ui-placement-item]");return e instanceof HTMLElement&&this.contains(e)?e:null}_metaForItem(t){return this._computeItems().find(e=>e.el===t)||null}_intervalsOverlap(t,e,s,r){const i=t+e-1,a=s+r-1;return t<=a&&s<=i}_findNeighbor(t,e){const s=this._computeItems().filter(a=>!a.disabled&&a.el!==t.el);if(!s.length)return null;const r=s.filter(a=>e==="left"||e==="right"?this._intervalsOverlap(t.row,t.rowSpan,a.row,a.rowSpan)?e==="left"?a.column<t.column:a.column>t.column:!1:this._intervalsOverlap(t.column,t.columnSpan,a.column,a.columnSpan)?e==="up"?a.row<t.row:a.row>t.row:!1);if(!r.length){const a=this._order()==="row-major"?this._sortMeta(this._computeItems()):this._computeItems(),o=a.findIndex(l=>l.el===t.el);return a[o+(e==="left"||e==="up"?-1:1)]?.el||null}return r.sort((a,o)=>{if(e==="left"||e==="right"){const c=Math.abs(a.column-t.column),m=Math.abs(o.column-t.column);return c!==m?c-m:Math.abs(a.row-t.row)-Math.abs(o.row-t.row)}const n=Math.abs(a.row-t.row),l=Math.abs(o.row-t.row);return n!==l?n-l:Math.abs(a.column-t.column)-Math.abs(o.column-t.column)})[0]?.el||null}_moveItemTo(t,e,s,r){const i=this._metaForItem(t);!i||i.disabled||(t.setAttribute("data-row",String(e)),t.setAttribute("data-column",String(s)),this.dispatchEvent(new CustomEvent("itemmove",{bubbles:!0,composed:!0,detail:{value:i.value,reason:r,from:{row:i.row,column:i.column},to:{row:e,column:s}}})),this.requestRender())}_swapItems(t,e,s){const r=this._metaForItem(t),i=this._metaForItem(e);!r||!i||(t.setAttribute("data-row",String(i.row)),t.setAttribute("data-column",String(i.column)),e.setAttribute("data-row",String(r.row)),e.setAttribute("data-column",String(r.column)),this.dispatchEvent(new CustomEvent("itemmove",{bubbles:!0,composed:!0,detail:{value:r.value,targetValue:i.value,reason:s,from:{row:r.row,column:r.column},to:{row:i.row,column:i.column}}})),this.requestRender())}_onClick(t){if(!this._isInteractive())return;const e=this._findItemFromTarget(t.target);e&&this._setFocusedItem(e,!1)}_onKeyDown(t){if(!this._isInteractive())return;const e=this._findItemFromTarget(t.target);if(!e)return;const s=this._metaForItem(e);if(!s||s.disabled)return;const r=t.key,i=r==="ArrowLeft"||r==="ArrowRight"||r==="ArrowUp"||r==="ArrowDown";if(t.altKey&&this._isDraggable()&&i){t.preventDefault();const o=r==="ArrowDown"?1:r==="ArrowUp"?-1:0,n=r==="ArrowRight"?1:r==="ArrowLeft"?-1:0;this._moveItemTo(e,Math.max(1,s.row+o),Math.max(1,s.column+n),"keyboard"),this._setFocusedItem(e,!0);return}let a=null;if(r==="ArrowLeft")a=this._findNeighbor(s,"left");else if(r==="ArrowRight")a=this._findNeighbor(s,"right");else if(r==="ArrowUp")a=this._findNeighbor(s,"up");else if(r==="ArrowDown")a=this._findNeighbor(s,"down");else if(r==="Home")a=(this._order()==="row-major"?this._sortMeta(this._computeItems()):this._computeItems())[0]?.el||null;else if(r==="End"){const o=this._order()==="row-major"?this._sortMeta(this._computeItems()):this._computeItems();a=o[o.length-1]?.el||null}a&&(t.preventDefault(),this._setFocusedItem(a,!0))}_onDragStart(t){if(!this._isDraggable())return;const e=this._findItemFromTarget(t.target);!e||e.hasAttribute("data-disabled")||(this._dragItem=e,e.setAttribute("data-dragging",""),t.dataTransfer&&(t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",e.getAttribute("data-value")||e.id||"")))}_onDragOver(t){if(!this._dragItem)return;const e=this._findItemFromTarget(t.target);!e||e===this._dragItem||(t.preventDefault(),this._dragOverItem&&this._dragOverItem!==e&&this._dragOverItem.removeAttribute("data-drag-over"),this._dragOverItem=e,e.setAttribute("data-drag-over",""))}_onDrop(t){if(!this._dragItem)return;const e=this._findItemFromTarget(t.target);t.preventDefault(),e&&e!==this._dragItem&&(this._swapItems(this._dragItem,e,"pointer"),this._setFocusedItem(this._dragItem,!1)),this._clearDragState()}_clearDragState(){this._dragItem&&this._dragItem.removeAttribute("data-dragging"),this._dragOverItem&&this._dragOverItem.removeAttribute("data-drag-over"),this._dragItem=null,this._dragOverItem=null}render(){this._syncLegacyClassname(),this._applyInlineStyles(),this._syncItems();const t=this._buildResponsiveCss();this.setContent(`<style>${I}${t?`
99
+ ${t}`:""}</style><slot></slot>`)}shouldRenderOnAttributeChange(t,e,s){return!0}}typeof customElements<"u"&&!customElements.get("ui-placement-grid")&&customElements.define("ui-placement-grid",b);exports.UIPlacementGrid=b;