@editora/ui-core 0.1.19 → 0.1.21

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 (313) 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 +30 -29
  48. package/dist/color-picker.cjs.js +10 -10
  49. package/dist/color-picker.esm.js +190 -253
  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-collection.d.ts.map +1 -1
  57. package/dist/components/ui-multi-select.d.ts.map +1 -1
  58. package/dist/components/ui-orbiter.d.ts.map +1 -1
  59. package/dist/components/ui-portal.d.ts.map +1 -1
  60. package/dist/components/ui-positioner.d.ts.map +1 -1
  61. package/dist/components/ui-skeleton.d.ts.map +1 -1
  62. package/dist/components/ui-sortable.d.ts +8 -0
  63. package/dist/components/ui-sortable.d.ts.map +1 -1
  64. package/dist/components/ui-split-button.d.ts +1 -0
  65. package/dist/components/ui-split-button.d.ts.map +1 -1
  66. package/dist/components/ui-tabs.d.ts.map +1 -1
  67. package/dist/components/ui-textarea.d.ts.map +1 -1
  68. package/dist/components/ui-time-picker.d.ts.map +1 -1
  69. package/dist/container.cjs.js +2 -2
  70. package/dist/container.esm.js +2 -3
  71. package/dist/context-menu.cjs.js +8 -8
  72. package/dist/context-menu.esm.js +157 -219
  73. package/dist/control-group.cjs.js +1 -1
  74. package/dist/control-group.esm.js +2 -3
  75. package/dist/data-table.cjs.js +4 -4
  76. package/dist/data-table.esm.js +299 -381
  77. package/dist/date-field.cjs.js +3 -3
  78. package/dist/date-field.esm.js +68 -80
  79. package/dist/date-picker.cjs.js +9 -9
  80. package/dist/date-picker.esm.js +69 -97
  81. package/dist/date-range-picker.cjs.js +3 -3
  82. package/dist/date-range-picker.esm.js +32 -56
  83. package/dist/date-range-time-picker.cjs.js +9 -9
  84. package/dist/date-range-time-picker.esm.js +111 -140
  85. package/dist/date-time-picker.cjs.js +7 -7
  86. package/dist/date-time-picker.esm.js +115 -147
  87. package/dist/date-time-utils-Dmost5Ee.js +1 -0
  88. package/dist/date-time-utils-y1N2gvG2.mjs +268 -0
  89. package/dist/description.cjs.js +1 -1
  90. package/dist/description.esm.js +3 -5
  91. package/dist/dialog.cjs.js +12 -12
  92. package/dist/dialog.esm.js +44 -63
  93. package/dist/direction-provider.cjs.js +1 -1
  94. package/dist/direction-provider.esm.js +2 -3
  95. package/dist/{dismissable-layer-9c7e6b58.mjs → dismissable-layer-BmPIoK80.mjs} +29 -33
  96. package/dist/dismissable-layer-DNfrKA20.js +1 -0
  97. package/dist/dismissable-layer.cjs.js +2 -2
  98. package/dist/dismissable-layer.esm.js +4 -6
  99. package/dist/dock.cjs.js +5 -5
  100. package/dist/dock.esm.js +134 -155
  101. package/dist/drawer.cjs.js +2 -2
  102. package/dist/drawer.esm.js +18 -35
  103. package/dist/dropdown.cjs.js +2 -2
  104. package/dist/dropdown.esm.js +119 -149
  105. package/dist/dropzone.cjs.js +1 -1
  106. package/dist/dropzone.esm.js +0 -1
  107. package/dist/empty-state.cjs.js +1 -1
  108. package/dist/empty-state.esm.js +1 -1
  109. package/dist/field-error.cjs.js +1 -1
  110. package/dist/field-error.esm.js +3 -5
  111. package/dist/field.cjs.js +5 -5
  112. package/dist/field.esm.js +27 -34
  113. package/dist/fieldset.cjs.js +4 -4
  114. package/dist/fieldset.esm.js +19 -24
  115. package/dist/file-upload.cjs.js +4 -4
  116. package/dist/file-upload.esm.js +69 -93
  117. package/dist/flex.cjs.js +1 -1
  118. package/dist/flex.esm.js +5 -9
  119. package/dist/floating-toolbar.cjs.js +4 -4
  120. package/dist/floating-toolbar.esm.js +60 -85
  121. package/dist/focus-scope-Bwug2gDv.js +1 -0
  122. package/dist/{focus-scope-103833ee.mjs → focus-scope-CmEsG5UZ.mjs} +39 -48
  123. package/dist/focus-scope.cjs.js +2 -2
  124. package/dist/focus-scope.esm.js +15 -20
  125. package/dist/form.cjs.js +2 -2
  126. package/dist/form.esm.js +26 -53
  127. package/dist/gantt.cjs.js +43 -43
  128. package/dist/gantt.esm.js +295 -322
  129. package/dist/grid.cjs.js +1 -1
  130. package/dist/grid.esm.js +5 -9
  131. package/dist/hover-card.cjs.js +4 -4
  132. package/dist/hover-card.esm.js +22 -28
  133. package/dist/icon-cloud.cjs.js +7 -7
  134. package/dist/icon-cloud.esm.js +48 -62
  135. package/dist/icon.cjs.js +1 -1
  136. package/dist/icon.esm.js +2 -4
  137. package/dist/index.cjs.js +1 -1
  138. package/dist/index.esm.js +378 -390
  139. package/dist/inline-edit.cjs.js +11 -11
  140. package/dist/inline-edit.esm.js +32 -36
  141. package/dist/input.cjs.js +17 -17
  142. package/dist/input.esm.js +50 -63
  143. package/dist/label.cjs.js +2 -2
  144. package/dist/label.esm.js +8 -17
  145. package/dist/layout.cjs.js +2 -2
  146. package/dist/layout.esm.js +20 -26
  147. package/dist/listbox-B6QgECax.js +46 -0
  148. package/dist/listbox-DJamVeFj.mjs +200 -0
  149. package/dist/listbox.cjs.js +1 -1
  150. package/dist/listbox.esm.js +2 -4
  151. package/dist/marquee.cjs.js +5 -5
  152. package/dist/marquee.esm.js +33 -50
  153. package/dist/masonry-grid.cjs.js +1 -1
  154. package/dist/masonry-grid.esm.js +5 -9
  155. package/dist/menu.cjs.js +3 -3
  156. package/dist/menu.esm.js +106 -126
  157. package/dist/menubar.cjs.js +5 -5
  158. package/dist/menubar.esm.js +118 -164
  159. package/dist/meter.cjs.js +2 -2
  160. package/dist/meter.esm.js +4 -4
  161. package/dist/multi-select.cjs.js +5 -5
  162. package/dist/multi-select.esm.js +125 -137
  163. package/dist/navigation-menu.cjs.js +4 -4
  164. package/dist/navigation-menu.esm.js +44 -55
  165. package/dist/number-field.cjs.js +2 -2
  166. package/dist/number-field.esm.js +73 -98
  167. package/dist/number-ticker.cjs.js +3 -3
  168. package/dist/number-ticker.esm.js +22 -43
  169. package/dist/odometer.cjs.js +1 -1
  170. package/dist/odometer.esm.js +5 -9
  171. package/dist/orbiter.cjs.js +13 -13
  172. package/dist/orbiter.esm.js +79 -90
  173. package/dist/{overlayManager-5bbd4dc3.mjs → overlayManager-BJjU1VA8.mjs} +4 -5
  174. package/dist/{overlayManager-0eda4e08.js → overlayManager-CSy3fJmJ.js} +1 -1
  175. package/dist/pagination.cjs.js +2 -2
  176. package/dist/pagination.esm.js +14 -18
  177. package/dist/{panel-group-a376cc5e.mjs → panel-group-8sVNnGxg.mjs} +24 -46
  178. package/dist/panel-group-CaD0_KQf.js +36 -0
  179. package/dist/panel-group.cjs.js +1 -1
  180. package/dist/panel-group.esm.js +2 -5
  181. package/dist/panel.cjs.js +4 -4
  182. package/dist/panel.esm.js +8 -10
  183. package/dist/password-field.cjs.js +9 -9
  184. package/dist/password-field.esm.js +62 -82
  185. package/dist/pin-input.cjs.js +3 -3
  186. package/dist/pin-input.esm.js +33 -39
  187. package/dist/placement-grid.cjs.js +4 -4
  188. package/dist/placement-grid.esm.js +108 -131
  189. package/dist/plugin-panel.cjs.js +7 -7
  190. package/dist/plugin-panel.esm.js +13 -15
  191. package/dist/popover.cjs.js +2 -2
  192. package/dist/popover.esm.js +21 -31
  193. package/dist/portal-DgpQ3Jo1.js +1 -0
  194. package/dist/{portal-fe73e5cc.mjs → portal-bR42gHvG.mjs} +43 -48
  195. package/dist/portal.cjs.js +3 -3
  196. package/dist/portal.esm.js +20 -28
  197. package/dist/{positioner-e9770c66.mjs → positioner-D0VGxtYU.mjs} +189 -209
  198. package/dist/positioner-D_fqyx_j.js +1 -0
  199. package/dist/positioner.cjs.js +2 -2
  200. package/dist/positioner.esm.js +22 -28
  201. package/dist/presence.cjs.js +1 -1
  202. package/dist/presence.esm.js +7 -13
  203. package/dist/primitives/auto-scroll.d.ts +9 -0
  204. package/dist/primitives/auto-scroll.d.ts.map +1 -0
  205. package/dist/primitives/selector.d.ts +4 -0
  206. package/dist/primitives/selector.d.ts.map +1 -0
  207. package/dist/progress.cjs.js +1 -1
  208. package/dist/progress.esm.js +5 -9
  209. package/dist/quick-actions.cjs.js +6 -6
  210. package/dist/quick-actions.esm.js +52 -62
  211. package/dist/radio-group.cjs.js +13 -13
  212. package/dist/radio-group.esm.js +39 -51
  213. package/dist/radio.cjs.js +1 -1
  214. package/dist/radio.esm.js +5 -9
  215. package/dist/rating.cjs.js +1 -1
  216. package/dist/rating.esm.js +12 -23
  217. package/dist/{roving-focus-group-4350c9a7.mjs → roving-focus-group-Dbm1Jko_.mjs} +3 -6
  218. package/dist/roving-focus-group.cjs.js +1 -1
  219. package/dist/roving-focus-group.esm.js +3 -5
  220. package/dist/runtime-CTaOSmBj.js +1 -0
  221. package/dist/{runtime-161f68a2.mjs → runtime-D1gFh1fS.mjs} +338 -366
  222. package/dist/runtime.cjs.js +1 -1
  223. package/dist/runtime.esm.js +6 -6
  224. package/dist/scroll-area.cjs.js +3 -3
  225. package/dist/scroll-area.esm.js +38 -46
  226. package/dist/{scroll-lock-31da444f.mjs → scroll-lock-LfqXXqsu.mjs} +5 -9
  227. package/dist/section.cjs.js +1 -1
  228. package/dist/section.esm.js +1 -1
  229. package/dist/select.cjs.js +7 -7
  230. package/dist/select.esm.js +67 -97
  231. package/dist/selection-popup.cjs.js +1 -1
  232. package/dist/selection-popup.esm.js +8 -15
  233. package/dist/selector-BvAh35ve.js +1 -0
  234. package/dist/selector-WI8pD7YO.mjs +18 -0
  235. package/dist/separator.cjs.js +1 -1
  236. package/dist/separator.esm.js +1 -1
  237. package/dist/sidebar.cjs.js +18 -18
  238. package/dist/sidebar.esm.js +117 -139
  239. package/dist/skeleton.cjs.js +11 -11
  240. package/dist/skeleton.esm.js +27 -24
  241. package/dist/slider.cjs.js +1 -1
  242. package/dist/slider.esm.js +6 -11
  243. package/dist/slot.cjs.js +4 -4
  244. package/dist/slot.esm.js +16 -19
  245. package/dist/sortable.cjs.js +79 -65
  246. package/dist/sortable.esm.js +714 -734
  247. package/dist/spinning-text.cjs.js +12 -12
  248. package/dist/spinning-text.esm.js +80 -92
  249. package/dist/split-button.cjs.js +4 -4
  250. package/dist/split-button.esm.js +77 -62
  251. package/dist/splitter.cjs.js +1 -1
  252. package/dist/splitter.esm.js +1 -1
  253. package/dist/stepper.cjs.js +8 -8
  254. package/dist/stepper.esm.js +32 -52
  255. package/dist/switch.cjs.js +7 -7
  256. package/dist/switch.esm.js +23 -31
  257. package/dist/table.cjs.js +2 -2
  258. package/dist/table.esm.js +46 -56
  259. package/dist/tabs.cjs.js +8 -8
  260. package/dist/tabs.esm.js +89 -109
  261. package/dist/tags-input.cjs.js +4 -4
  262. package/dist/tags-input.esm.js +45 -62
  263. package/dist/textarea.cjs.js +10 -10
  264. package/dist/textarea.esm.js +49 -52
  265. package/dist/time-field.cjs.js +4 -4
  266. package/dist/time-field.esm.js +70 -84
  267. package/dist/time-picker.cjs.js +22 -22
  268. package/dist/time-picker.esm.js +88 -110
  269. package/dist/timeline.cjs.js +1 -1
  270. package/dist/timeline.esm.js +3 -5
  271. package/dist/toast.cjs.js +2 -2
  272. package/dist/toast.esm.js +33 -47
  273. package/dist/toggle-group.cjs.js +6 -6
  274. package/dist/toggle-group.esm.js +85 -105
  275. package/dist/toggle.cjs.js +1 -1
  276. package/dist/toggle.esm.js +3 -5
  277. package/dist/toolbar.cjs.js +1 -1
  278. package/dist/toolbar.esm.js +13 -24
  279. package/dist/tooltip.cjs.js +2 -2
  280. package/dist/tooltip.esm.js +31 -42
  281. package/dist/transfer-list.cjs.js +31 -31
  282. package/dist/transfer-list.esm.js +114 -127
  283. package/dist/{tree-dcd74a4a.mjs → tree-B3kE8ESs.mjs} +55 -62
  284. package/dist/tree-Dx_kv_ih.js +39 -0
  285. package/dist/tree-item.cjs.js +2 -2
  286. package/dist/tree-item.esm.js +2 -3
  287. package/dist/tree.cjs.js +1 -1
  288. package/dist/tree.esm.js +2 -5
  289. package/dist/ui-button-Q0GNNWKC.mjs +665 -0
  290. package/dist/ui-button-rXQOS9QJ.js +521 -0
  291. package/dist/{icon-9e9da03b.js → ui-icon-BzVNC_lr.js} +4 -4
  292. package/dist/{icon-e2a85cc1.mjs → ui-icon-YI6lyuqU.mjs} +58 -65
  293. package/dist/visually-hidden.cjs.js +1 -1
  294. package/dist/visually-hidden.esm.js +1 -1
  295. package/dist/wizard.cjs.js +14 -14
  296. package/dist/wizard.esm.js +85 -105
  297. package/package.json +2 -2
  298. package/dist/date-time-utils-66480de4.js +0 -1
  299. package/dist/date-time-utils-a2c7af25.mjs +0 -307
  300. package/dist/dismissable-layer-193e3bed.js +0 -1
  301. package/dist/focus-scope-2b12b4e7.js +0 -1
  302. package/dist/listbox-308789a0.mjs +0 -210
  303. package/dist/listbox-ef2f708e.js +0 -46
  304. package/dist/panel-group-40254cdd.js +0 -36
  305. package/dist/portal-c69756c0.js +0 -1
  306. package/dist/positioner-33529bb8.js +0 -1
  307. package/dist/runtime-3f13807b.js +0 -1
  308. package/dist/tree-0a7a8d05.js +0 -39
  309. /package/dist/{collection-a2969ad2.js → collection-qv8A8rq4.js} +0 -0
  310. /package/dist/{menu-item-styles-27fdbac4.mjs → menu-item-styles-CZiPwPwl.mjs} +0 -0
  311. /package/dist/{menu-item-styles-83ad1e22.js → menu-item-styles-CbNUEwP2.js} +0 -0
  312. /package/dist/{roving-focus-group-5c059bf9.js → roving-focus-group-BdJ_4Njm.js} +0 -0
  313. /package/dist/{scroll-lock-d7b0df21.js → scroll-lock-BX6e3Ced.js} +0 -0
@@ -1,5 +1,21 @@
1
- import { E as ee } from "./ElementBase-909688f3.mjs";
2
- const te = 1, re = 44, ie = 72, se = `
1
+ import { E as ee } from "./ElementBase-YlTLMsGk.mjs";
2
+ function te(l, e, t, r = 56, i = 18) {
3
+ if (!Number.isFinite(l) || !(t > e)) return 0;
4
+ const s = Math.min(r, (t - e) / 2);
5
+ return s <= 0 ? 0 : l < e + s ? -Math.ceil(i * Math.min(1, (e + s - l) / s)) : l > t - s ? Math.ceil(i * Math.min(1, (l - (t - s)) / s)) : 0;
6
+ }
7
+ const re = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]);
8
+ function ie(l) {
9
+ let e = l;
10
+ for (; e; ) {
11
+ if (e = e.parentNode instanceof ShadowRoot ? e.parentNode.host : e.parentNode, !(e instanceof HTMLElement)) continue;
12
+ if (e === e.ownerDocument.body || e === e.ownerDocument.documentElement) return null;
13
+ const { overflowY: t } = e.ownerDocument.defaultView?.getComputedStyle(e) ?? { overflowY: "" };
14
+ if (re.has(t) && e.scrollHeight > e.clientHeight) return e;
15
+ }
16
+ return null;
17
+ }
18
+ const se = 1, oe = 44, ne = 72, ae = `
3
19
  :host {
4
20
  --ui-sortable-accent: var(--ui-color-primary, #2563eb);
5
21
  --ui-sortable-surface: var(--ui-color-surface, #ffffff);
@@ -103,6 +119,20 @@ const te = 1, re = 44, ie = 72, se = `
103
119
  align-items: stretch;
104
120
  }
105
121
 
122
+ /* The cards live inside one root .tree wrapper, which is a vertical grid. Without this the
123
+ lane was a flex row holding a single column, so a "horizontal" list rendered vertically. */
124
+ .list[data-orientation="horizontal"] .items > .tree {
125
+ display: flex;
126
+ flex-wrap: nowrap;
127
+ align-items: stretch;
128
+ min-inline-size: min-content;
129
+ }
130
+
131
+ .list[data-orientation="horizontal"] .items > .tree > .item-shell {
132
+ flex: 0 0 auto;
133
+ min-inline-size: min(220px, 70vw);
134
+ }
135
+
106
136
  .list[data-disabled="true"] {
107
137
  opacity: 0.68;
108
138
  }
@@ -722,120 +752,119 @@ const te = 1, re = 44, ie = 72, se = `
722
752
  }
723
753
  }
724
754
  `;
725
- function V(u) {
726
- if (!u)
727
- return [];
755
+ function K(l) {
756
+ if (!l) return [];
728
757
  try {
729
- const e = JSON.parse(u);
758
+ const e = JSON.parse(l);
730
759
  return Array.isArray(e) ? e : [];
731
760
  } catch {
732
761
  return [];
733
762
  }
734
763
  }
735
- function I(u) {
736
- return u.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
764
+ function y(l) {
765
+ return l.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
737
766
  }
738
- function z(u, e) {
739
- return `${u}::${e ?? "__root__"}`;
767
+ function k(l, e) {
768
+ return `${l}::${e ?? "__root__"}`;
740
769
  }
741
- function X(u) {
742
- return u ? [u.listId, u.parentId ?? "", u.beforeId ?? "", u.mode].join("::") : "";
770
+ function j(l) {
771
+ return l ? [l.listId, l.parentId ?? "", l.beforeId ?? "", l.mode].join("::") : "";
743
772
  }
744
- function B(u, e) {
745
- return X(u) === X(e);
773
+ function B(l, e) {
774
+ return j(l) === j(e);
746
775
  }
747
- function ne(u) {
748
- if (!u || u === "none")
776
+ function le(l) {
777
+ if (!l || l === "none")
749
778
  return { x: 1, y: 1 };
750
- const e = u.match(/^matrix3d\((.+)\)$/);
779
+ const e = l.match(/^matrix3d\((.+)\)$/);
751
780
  if (e) {
752
- const t = e[1].split(",").map((i) => Number.parseFloat(i.trim()));
753
- if (t.length === 16 && t.every((i) => Number.isFinite(i)))
781
+ const r = e[1].split(",").map((i) => Number.parseFloat(i.trim()));
782
+ if (r.length === 16 && r.every((i) => Number.isFinite(i)))
754
783
  return {
755
- x: t[0] || 1,
756
- y: t[5] || 1
784
+ x: r[0] || 1,
785
+ y: r[5] || 1
757
786
  };
758
787
  }
759
- const r = u.match(/^matrix\((.+)\)$/);
760
- if (r) {
761
- const t = r[1].split(",").map((i) => Number.parseFloat(i.trim()));
762
- if (t.length === 6 && t.every((i) => Number.isFinite(i))) {
763
- const [i, s, o, a] = t;
788
+ const t = l.match(/^matrix\((.+)\)$/);
789
+ if (t) {
790
+ const r = t[1].split(",").map((i) => Number.parseFloat(i.trim()));
791
+ if (r.length === 6 && r.every((i) => Number.isFinite(i))) {
792
+ const [i, s, n, a] = r;
764
793
  return {
765
794
  x: Math.sqrt(i * i + s * s) || 1,
766
- y: Math.sqrt(o * o + a * a) || 1
795
+ y: Math.sqrt(n * n + a * a) || 1
767
796
  };
768
797
  }
769
798
  }
770
799
  return { x: 1, y: 1 };
771
800
  }
772
- function oe(u) {
773
- return u === "item" ? "item" : "handle";
801
+ function de(l) {
802
+ return l === "item" ? "item" : "handle";
774
803
  }
775
- function P(u) {
776
- return { ...u };
804
+ function P(l) {
805
+ return { ...l };
777
806
  }
778
- function ae(u, e, r, t, i, s) {
779
- const o = M(u), a = E(u), l = /* @__PURE__ */ new Set(), n = [], d = (h) => {
780
- const x = o.get(h);
781
- !x || l.has(h) || (l.add(h), n.push(h), (a.get(z(x.listId, h)) || []).forEach(d));
807
+ function ce(l, e, t, r, i, s) {
808
+ const n = T(l), a = E(l), d = /* @__PURE__ */ new Set(), o = [], u = (g) => {
809
+ const x = n.get(g);
810
+ !x || d.has(g) || (d.add(g), o.push(g), (a.get(k(x.listId, g)) || []).forEach(u));
782
811
  };
783
- t.forEach(d);
784
- const c = u.map(P), g = c.filter((h) => l.has(h.id)), m = i ? c.map(P) : c.filter((h) => !l.has(h.id)), f = i ? g.map((h) => s(h, n)) : g.map(P), v = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map();
785
- i && g.forEach((h, x) => {
786
- v.set(h.id, f[x].id), b.set(f[x].id, h.id);
787
- }), f.forEach((h) => {
788
- const x = i ? b.get(h.id) : h.id, F = x ? o.get(x) : null;
789
- F && (i && (h.parentId = F.parentId && v.has(F.parentId) && v.get(F.parentId) || null), h.listId = r.listId);
812
+ r.forEach(u);
813
+ const c = l.map(P), h = c.filter((g) => d.has(g.id)), f = i ? c.map(P) : c.filter((g) => !d.has(g.id)), _ = i ? h.map((g) => s(g, o)) : h.map(P), I = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
814
+ i && h.forEach((g, x) => {
815
+ I.set(g.id, _[x].id), m.set(_[x].id, g.id);
816
+ }), _.forEach((g) => {
817
+ const x = i ? m.get(g.id) : g.id, M = x ? n.get(x) : null;
818
+ M && (i && (g.parentId = M.parentId && I.has(M.parentId) && I.get(M.parentId) || null), g.listId = t.listId);
790
819
  });
791
- const y = t.map((h) => v.get(h) || h), w = [...m, ...f], k = E(m), A = z(r.listId, r.parentId), _ = [...k.get(A) || []], R = r.beforeId ? _.indexOf(r.beforeId) : _.length, S = R >= 0 ? R : _.length;
792
- _.splice(S, 0, ...y), k.set(A, _), E(f).forEach((h, x) => {
793
- const [, F] = x.split("::");
794
- (F || "") !== "__root__" && k.set(x, [...h]);
820
+ const v = r.map((g) => I.get(g) || g), D = [...f, ..._], A = E(f), z = k(t.listId, t.parentId), b = [...A.get(z) || []], S = t.beforeId ? b.indexOf(t.beforeId) : b.length, R = S >= 0 ? S : b.length;
821
+ b.splice(R, 0, ...v), A.set(z, b), E(_).forEach((g, x) => {
822
+ const [, M] = x.split("::");
823
+ (M || "") !== "__root__" && A.set(x, [...g]);
795
824
  });
796
- const T = M(w);
797
- y.forEach((h) => {
798
- const x = T.get(h);
799
- x && (x.parentId = r.parentId, x.listId = r.listId);
825
+ const O = T(D);
826
+ v.forEach((g) => {
827
+ const x = O.get(g);
828
+ x && (x.parentId = t.parentId, x.listId = t.listId);
800
829
  });
801
- const $ = [], L = /* @__PURE__ */ new Set(), G = (h, x) => {
802
- (k.get(z(h, x)) || []).forEach((O, K) => {
803
- const p = T.get(O);
804
- !p || L.has(O) || (L.add(O), p.listId = h, p.parentId = x, p.order = K, $.push(p), G(h, O));
830
+ const L = [], q = /* @__PURE__ */ new Set(), H = (g, x) => {
831
+ (A.get(k(g, x)) || []).forEach((C, G) => {
832
+ const p = O.get(C);
833
+ !p || q.has(C) || (q.add(C), p.listId = g, p.parentId = x, p.order = G, L.push(p), H(g, C));
805
834
  });
806
835
  };
807
- return e.forEach((h) => G(h.id, null)), w.forEach((h) => {
808
- L.has(h.id) || (h.parentId = null, $.push(h));
836
+ return e.forEach((g) => H(g.id, null)), D.forEach((g) => {
837
+ q.has(g.id) || (g.parentId = null, L.push(g));
809
838
  }), {
810
- items: $.map(P),
811
- insertedRootIds: y
839
+ items: L.map(P),
840
+ insertedRootIds: v
812
841
  };
813
842
  }
814
- function E(u) {
843
+ function E(l) {
815
844
  const e = /* @__PURE__ */ new Map();
816
- return u.forEach((r) => {
817
- const t = z(r.listId, r.parentId), i = e.get(t);
818
- i ? i.push(r.id) : e.set(t, [r.id]);
845
+ return l.forEach((t) => {
846
+ const r = k(t.listId, t.parentId), i = e.get(r);
847
+ i ? i.push(t.id) : e.set(r, [t.id]);
819
848
  }), e;
820
849
  }
821
- function M(u) {
822
- return new Map(u.map((e) => [e.id, e]));
850
+ function T(l) {
851
+ return new Map(l.map((e) => [e.id, e]));
823
852
  }
824
- function Y(u) {
825
- const e = /* @__PURE__ */ new Set(), r = [];
826
- return u.forEach((t, i) => {
827
- const s = typeof (t == null ? void 0 : t.id) == "string" && t.id.trim() ? t.id.trim() : `list-${i + 1}`;
828
- e.has(s) || (e.add(s), r.push({
853
+ function Y(l) {
854
+ const e = /* @__PURE__ */ new Set(), t = [];
855
+ return l.forEach((r, i) => {
856
+ const s = typeof r?.id == "string" && r.id.trim() ? r.id.trim() : `list-${i + 1}`;
857
+ e.has(s) || (e.add(s), t.push({
829
858
  id: s,
830
- label: typeof (t == null ? void 0 : t.label) == "string" && t.label.trim() ? t.label.trim() : `List ${i + 1}`,
831
- description: typeof (t == null ? void 0 : t.description) == "string" ? t.description : "",
832
- emptyLabel: typeof (t == null ? void 0 : t.emptyLabel) == "string" && t.emptyLabel.trim() ? t.emptyLabel.trim() : "Drop items here.",
833
- orientation: (t == null ? void 0 : t.orientation) === "horizontal" ? "horizontal" : "vertical",
834
- disabled: !!(t != null && t.disabled),
835
- cloneOnDrag: !!(t != null && t.cloneOnDrag),
836
- accepts: Array.isArray(t == null ? void 0 : t.accepts) ? t.accepts.filter((o) => typeof o == "string" && o.trim().length > 0) : void 0
859
+ label: typeof r?.label == "string" && r.label.trim() ? r.label.trim() : `List ${i + 1}`,
860
+ description: typeof r?.description == "string" ? r.description : "",
861
+ emptyLabel: typeof r?.emptyLabel == "string" && r.emptyLabel.trim() ? r.emptyLabel.trim() : "Drop items here.",
862
+ orientation: r?.orientation === "horizontal" ? "horizontal" : "vertical",
863
+ disabled: !!r?.disabled,
864
+ cloneOnDrag: !!r?.cloneOnDrag,
865
+ accepts: Array.isArray(r?.accepts) ? r.accepts.filter((n) => typeof n == "string" && n.trim().length > 0) : void 0
837
866
  }));
838
- }), r.length ? r : [{
867
+ }), t.length ? t : [{
839
868
  id: "default",
840
869
  label: "Items",
841
870
  description: "",
@@ -845,49 +874,47 @@ function Y(u) {
845
874
  cloneOnDrag: !1
846
875
  }];
847
876
  }
848
- function U(u, e) {
849
- const r = new Set(u.map((n) => n.id)), t = [];
850
- e.forEach((n, d) => {
851
- const c = typeof (n == null ? void 0 : n.id) == "string" && n.id.trim() ? n.id.trim() : "", g = typeof (n == null ? void 0 : n.label) == "string" && n.label.trim() ? n.label.trim() : "";
852
- if (!c || !g)
853
- return;
854
- const m = typeof (n == null ? void 0 : n.listId) == "string" && r.has(n.listId) ? n.listId : u[0].id;
855
- t.push({
877
+ function U(l, e) {
878
+ const t = new Set(l.map((o) => o.id)), r = [];
879
+ e.forEach((o, u) => {
880
+ const c = typeof o?.id == "string" && o.id.trim() ? o.id.trim() : "", h = typeof o?.label == "string" && o.label.trim() ? o.label.trim() : "";
881
+ if (!c || !h) return;
882
+ const f = typeof o?.listId == "string" && t.has(o.listId) ? o.listId : l[0].id;
883
+ r.push({
856
884
  id: c,
857
- label: g,
858
- listId: m,
859
- parentId: typeof (n == null ? void 0 : n.parentId) == "string" && n.parentId.trim() ? n.parentId.trim() : null,
860
- description: typeof (n == null ? void 0 : n.description) == "string" ? n.description : "",
861
- order: Number.isFinite(n == null ? void 0 : n.order) ? Number(n.order) : d,
862
- disabled: !!(n != null && n.disabled),
863
- dragDisabled: !!(n != null && n.dragDisabled),
864
- cloneOnDrag: !!(n != null && n.cloneOnDrag),
865
- hidden: !!(n != null && n.hidden)
885
+ label: h,
886
+ listId: f,
887
+ parentId: typeof o?.parentId == "string" && o.parentId.trim() ? o.parentId.trim() : null,
888
+ description: typeof o?.description == "string" ? o.description : "",
889
+ order: Number.isFinite(o?.order) ? Number(o.order) : u,
890
+ disabled: !!o?.disabled,
891
+ dragDisabled: !!o?.dragDisabled,
892
+ cloneOnDrag: !!o?.cloneOnDrag,
893
+ hidden: !!o?.hidden
866
894
  });
867
895
  });
868
- const i = new Map(t.map((n) => [n.id, n]));
869
- t.forEach((n) => {
870
- if (!n.parentId)
871
- return;
872
- const d = i.get(n.parentId);
873
- (!d || d.id === n.id || d.listId !== n.listId) && (n.parentId = null);
896
+ const i = new Map(r.map((o) => [o.id, o]));
897
+ r.forEach((o) => {
898
+ if (!o.parentId) return;
899
+ const u = i.get(o.parentId);
900
+ (!u || u.id === o.id || u.listId !== o.listId) && (o.parentId = null);
874
901
  });
875
902
  const s = /* @__PURE__ */ new Map();
876
- t.forEach((n) => {
877
- const d = z(n.listId, n.parentId), c = s.get(d);
878
- c ? c.push(n) : s.set(d, [n]);
879
- }), s.forEach((n) => n.sort((d, c) => d.order - c.order || d.label.localeCompare(c.label)));
880
- const o = [], a = /* @__PURE__ */ new Set(), l = (n, d) => {
881
- (s.get(z(n, d)) || []).forEach((g, m) => {
882
- a.has(g.id) || (a.add(g.id), g.order = m, o.push(g), l(n, g.id));
903
+ r.forEach((o) => {
904
+ const u = k(o.listId, o.parentId), c = s.get(u);
905
+ c ? c.push(o) : s.set(u, [o]);
906
+ }), s.forEach((o) => o.sort((u, c) => u.order - c.order || u.label.localeCompare(c.label)));
907
+ const n = [], a = /* @__PURE__ */ new Set(), d = (o, u) => {
908
+ (s.get(k(o, u)) || []).forEach((h, f) => {
909
+ a.has(h.id) || (a.add(h.id), h.order = f, n.push(h), d(o, h.id));
883
910
  });
884
911
  };
885
- return u.forEach((n) => l(n.id, null)), t.forEach((n) => {
886
- a.has(n.id) || (n.parentId = null, o.push(n));
887
- }), o.map(P);
912
+ return l.forEach((o) => d(o.id, null)), r.forEach((o) => {
913
+ a.has(o.id) || (o.parentId = null, n.push(o));
914
+ }), n.map(P);
888
915
  }
889
- function de(u) {
890
- return JSON.stringify(u.map((e) => ({
916
+ function ue(l) {
917
+ return JSON.stringify(l.map((e) => ({
891
918
  id: e.id,
892
919
  label: e.label,
893
920
  listId: e.listId,
@@ -900,8 +927,8 @@ function de(u) {
900
927
  hidden: e.hidden
901
928
  })));
902
929
  }
903
- function le(u) {
904
- return JSON.stringify(u.map((e) => ({
930
+ function pe(l) {
931
+ return JSON.stringify(l.map((e) => ({
905
932
  id: e.id,
906
933
  label: e.label,
907
934
  description: e.description,
@@ -912,54 +939,65 @@ function le(u) {
912
939
  accepts: e.accepts
913
940
  })));
914
941
  }
915
- function j(u) {
916
- return JSON.stringify(u);
942
+ function X(l) {
943
+ return JSON.stringify(l);
917
944
  }
918
- function J(u) {
919
- const e = /* @__PURE__ */ new Map(), r = u.map((t) => {
920
- const i = z(t.listId, t.parentId), s = e.get(i) ?? 0;
945
+ function J(l) {
946
+ const e = /* @__PURE__ */ new Map(), t = l.map((r) => {
947
+ const i = k(r.listId, r.parentId), s = e.get(i) ?? 0;
921
948
  return e.set(i, s + 1), {
922
- id: t.id,
923
- listId: t.listId,
924
- parentId: t.parentId,
949
+ id: r.id,
950
+ listId: r.listId,
951
+ parentId: r.parentId,
925
952
  index: s
926
953
  };
927
954
  });
928
955
  return {
929
- version: te,
930
- records: r
956
+ version: se,
957
+ records: t
931
958
  };
932
959
  }
933
- function W(u, e) {
934
- return e ? `${u.label} ${u.description}`.toLowerCase().includes(e.toLowerCase()) : !0;
960
+ function W(l, e) {
961
+ return e ? `${l.label} ${l.description}`.toLowerCase().includes(e.toLowerCase()) : !0;
935
962
  }
936
- function Q(u, e, r, t, i) {
937
- const s = M(u), o = E(u), a = /* @__PURE__ */ new Map(), l = (c, g) => {
938
- const m = [...o.get(z(c, g)) || []];
939
- return i === "label" && m.sort((f, v) => {
940
- const b = s.get(f), y = s.get(v);
941
- return !b || !y ? 0 : b.label.localeCompare(y.label);
942
- }), m;
943
- }, n = (c, g, m) => {
944
- const f = [];
945
- return l(c, g).forEach((v) => {
946
- const b = s.get(v);
947
- if (!b || b.hidden)
948
- return;
949
- const y = n(c, b.id);
950
- !W(b, t) && y.length === 0 || (f.push({
951
- id: b.id,
952
- disabled: b.disabled
953
- }), y.length && f.push(...y));
963
+ function Q(l, e, t, r, i) {
964
+ const s = T(l), n = E(l), a = /* @__PURE__ */ new Map(), d = (c, h) => {
965
+ const f = [...n.get(k(c, h)) || []];
966
+ return i === "label" && f.sort((_, I) => {
967
+ const m = s.get(_), v = s.get(I);
968
+ return !m || !v ? 0 : m.label.localeCompare(v.label);
954
969
  }), f;
970
+ }, o = (c, h, f) => {
971
+ const _ = [];
972
+ return d(c, h).forEach((I) => {
973
+ const m = s.get(I);
974
+ if (!m || m.hidden) return;
975
+ const v = o(c, m.id);
976
+ !W(m, r) && v.length === 0 || (_.push({
977
+ id: m.id,
978
+ disabled: m.disabled
979
+ }), v.length && _.push(...v));
980
+ }), _;
955
981
  };
956
- return Array.from(new Set(u.map((c) => c.listId))).forEach((c) => {
957
- a.set(c, n(c, null));
982
+ return Array.from(new Set(l.map((c) => c.listId))).forEach((c) => {
983
+ a.set(c, o(c, null));
958
984
  }), a;
959
985
  }
960
- class ce extends ee {
986
+ class he extends ee {
961
987
  constructor() {
962
- super(), this._lists = Y([]), this._items = [], this._selection = [], this._focusedId = null, this._rangeAnchorId = null, this._dragState = null, this._liveMessage = "Sortable list ready.", this._lastListsAttr = null, this._lastItemsAttr = null, this._lastSelectionAttr = null, this._hydratedPersistKey = null, this._cloneSeed = 1, this._dragImage = null, this._dragPreviewOverlay = null, this._pendingFocusId = null, this._pointerGesture = null, this._pendingDropTarget = null, this._suppressAttributeRender = !1, this._onClick = this._onClick.bind(this), this._onKeyDown = this._onKeyDown.bind(this), this._onDragStart = this._onDragStart.bind(this), this._onDragOver = this._onDragOver.bind(this), this._onDrop = this._onDrop.bind(this), this._onDragEnd = this._onDragEnd.bind(this), this._onPointerDown = this._onPointerDown.bind(this), this._onPointerMove = this._onPointerMove.bind(this), this._onPointerUp = this._onPointerUp.bind(this), this._onPointerCancel = this._onPointerCancel.bind(this), this._onFocusIn = this._onFocusIn.bind(this), this._onDocumentKeyDown = this._onDocumentKeyDown.bind(this);
988
+ super(), this._lists = Y([]), this._items = [], this._selection = [], this._focusedId = null, this._rangeAnchorId = null, this._dragState = null, this._liveMessage = "Sortable list ready.", this._lastListsAttr = null, this._lastItemsAttr = null, this._lastSelectionAttr = null, this._hydratedPersistKey = null, this._cloneSeed = 1, this._dragImage = null, this._dragPreviewOverlay = null, this._pendingFocusId = null, this._pointerGesture = null, this._pendingDropTarget = null, this._suppressAttributeRender = !1, this._autoScrollFrame = 0, this._autoScrollPoint = null, this._autoScrollTick = () => {
989
+ this._autoScrollFrame = 0;
990
+ const e = this._autoScrollPoint;
991
+ if (!e || !this._dragState || this._dragState.keyboard) return;
992
+ const t = this.ownerDocument?.defaultView, r = ie(this), i = r ? r.getBoundingClientRect() : null, s = Math.max(0, i ? i.top : 0), n = Math.min(t?.innerHeight ?? 0, i ? i.bottom : 1 / 0), a = te(e.y, s, n);
993
+ if (a) {
994
+ if (r ? r.scrollTop += a : t?.scrollBy(0, a), !this._dragState.committed) {
995
+ const d = this._dropTargetFromPoint(e.x, e.y), o = d && this._canDrop(d, this._dragState.movedRootIds) ? d : null;
996
+ this._queueDropTarget(o, performance.now());
997
+ }
998
+ this._autoScrollFrame = requestAnimationFrame(this._autoScrollTick);
999
+ }
1000
+ }, this._onClick = this._onClick.bind(this), this._onKeyDown = this._onKeyDown.bind(this), this._onDragStart = this._onDragStart.bind(this), this._onDragOver = this._onDragOver.bind(this), this._onDrop = this._onDrop.bind(this), this._onDragEnd = this._onDragEnd.bind(this), this._onPointerDown = this._onPointerDown.bind(this), this._onPointerMove = this._onPointerMove.bind(this), this._onPointerUp = this._onPointerUp.bind(this), this._onPointerCancel = this._onPointerCancel.bind(this), this._onFocusIn = this._onFocusIn.bind(this), this._onDocumentKeyDown = this._onDocumentKeyDown.bind(this);
963
1001
  }
964
1002
  static get observedAttributes() {
965
1003
  return [
@@ -981,29 +1019,27 @@ class ce extends ee {
981
1019
  "disabled"
982
1020
  ];
983
1021
  }
984
- shouldRenderOnAttributeChange(e, r, t) {
1022
+ shouldRenderOnAttributeChange(e, t, r) {
985
1023
  return this._suppressAttributeRender ? !["lists", "items", "selection"].includes(e) : !0;
986
1024
  }
987
- attributeChangedCallback(e, r, t) {
988
- if (r !== t && this.isConnected) {
1025
+ attributeChangedCallback(e, t, r) {
1026
+ if (t !== r && this.isConnected) {
989
1027
  if (e === "selection" && !this._suppressAttributeRender && this._canSyncInteractiveStateInPlace()) {
990
- this._syncSelectionFromAttribute(t ?? null), this._syncSelectionVisualState();
1028
+ this._syncSelectionFromAttribute(r ?? null), this._syncSelectionVisualState();
991
1029
  return;
992
1030
  }
993
1031
  if (e === "show-selection-badge" && this._canSyncInteractiveStateInPlace()) {
994
1032
  this._syncSelectionVisualState();
995
1033
  return;
996
1034
  }
997
- super.attributeChangedCallback(e, r, t);
1035
+ super.attributeChangedCallback(e, t, r);
998
1036
  }
999
1037
  }
1000
1038
  connectedCallback() {
1001
- var e, r, t, i;
1002
- super.connectedCallback(), this.root.addEventListener("click", this._onClick), this.root.addEventListener("keydown", this._onKeyDown), this.root.addEventListener("dragstart", this._onDragStart), this.root.addEventListener("dragover", this._onDragOver), this.root.addEventListener("drop", this._onDrop), this.root.addEventListener("dragend", this._onDragEnd), this.root.addEventListener("pointerdown", this._onPointerDown), this.root.addEventListener("focusin", this._onFocusIn), (e = this.ownerDocument) == null || e.addEventListener("keydown", this._onDocumentKeyDown, !0), (r = this.ownerDocument) == null || r.addEventListener("pointermove", this._onPointerMove, !0), (t = this.ownerDocument) == null || t.addEventListener("pointerup", this._onPointerUp, !0), (i = this.ownerDocument) == null || i.addEventListener("pointercancel", this._onPointerCancel, !0);
1039
+ super.connectedCallback(), this.root.addEventListener("click", this._onClick), this.root.addEventListener("keydown", this._onKeyDown), this.root.addEventListener("dragstart", this._onDragStart), this.root.addEventListener("dragover", this._onDragOver), this.root.addEventListener("drop", this._onDrop), this.root.addEventListener("dragend", this._onDragEnd), this.root.addEventListener("pointerdown", this._onPointerDown), this.root.addEventListener("focusin", this._onFocusIn), this.ownerDocument?.addEventListener("keydown", this._onDocumentKeyDown, !0), this.ownerDocument?.addEventListener("pointermove", this._onPointerMove, !0), this.ownerDocument?.addEventListener("pointerup", this._onPointerUp, !0), this.ownerDocument?.addEventListener("pointercancel", this._onPointerCancel, !0);
1003
1040
  }
1004
1041
  disconnectedCallback() {
1005
- var e, r, t, i;
1006
- this.root.removeEventListener("click", this._onClick), this.root.removeEventListener("keydown", this._onKeyDown), this.root.removeEventListener("dragstart", this._onDragStart), this.root.removeEventListener("dragover", this._onDragOver), this.root.removeEventListener("drop", this._onDrop), this.root.removeEventListener("dragend", this._onDragEnd), this.root.removeEventListener("pointerdown", this._onPointerDown), this.root.removeEventListener("focusin", this._onFocusIn), (e = this.ownerDocument) == null || e.removeEventListener("keydown", this._onDocumentKeyDown, !0), (r = this.ownerDocument) == null || r.removeEventListener("pointermove", this._onPointerMove, !0), (t = this.ownerDocument) == null || t.removeEventListener("pointerup", this._onPointerUp, !0), (i = this.ownerDocument) == null || i.removeEventListener("pointercancel", this._onPointerCancel, !0), this._removeDragPreviewOverlay(), this._removeDragImage(), super.disconnectedCallback();
1042
+ this.root.removeEventListener("click", this._onClick), this.root.removeEventListener("keydown", this._onKeyDown), this.root.removeEventListener("dragstart", this._onDragStart), this.root.removeEventListener("dragover", this._onDragOver), this.root.removeEventListener("drop", this._onDrop), this.root.removeEventListener("dragend", this._onDragEnd), this.root.removeEventListener("pointerdown", this._onPointerDown), this.root.removeEventListener("focusin", this._onFocusIn), this.ownerDocument?.removeEventListener("keydown", this._onDocumentKeyDown, !0), this.ownerDocument?.removeEventListener("pointermove", this._onPointerMove, !0), this.ownerDocument?.removeEventListener("pointerup", this._onPointerUp, !0), this.ownerDocument?.removeEventListener("pointercancel", this._onPointerCancel, !0), this._stopAutoScroll(), this._removeDragPreviewOverlay(), this._removeDragImage(), super.disconnectedCallback();
1007
1043
  }
1008
1044
  get lists() {
1009
1045
  return this._lists.map((e) => ({ ...e }));
@@ -1045,68 +1081,66 @@ class ce extends ee {
1045
1081
  this._cancelDrag(!0);
1046
1082
  }
1047
1083
  focusItem(e) {
1048
- this._items.some((r) => r.id === e) && (this._focusedId = e, this._pendingFocusId = e, !this._applyInteractiveStateInPlace({ restoreFocus: !0 }) && this.requestRender());
1084
+ this._items.some((t) => t.id === e) && (this._focusedId = e, this._pendingFocusId = e, !this._applyInteractiveStateInPlace({ restoreFocus: !0 }) && this.requestRender());
1049
1085
  }
1050
1086
  moveSelection(e) {
1051
1087
  this._syncSelectionFromAttribute(this.getAttribute("selection"));
1052
- const r = this._selectedRootIds();
1053
- r.length && this._commitMove({
1088
+ const t = this._selectedRootIds();
1089
+ t.length && this._commitMove({
1054
1090
  listId: e.targetListId,
1055
1091
  parentId: e.parentId ?? null,
1056
1092
  beforeId: e.beforeId ?? null,
1057
1093
  mode: e.mode ?? (e.parentId ? "inside" : "before")
1058
- }, r, !!e.clone, e.source ?? "api");
1094
+ }, t, !!e.clone, e.source ?? "api");
1059
1095
  }
1060
1096
  getPersistenceSnapshot() {
1061
1097
  return J(this._items);
1062
1098
  }
1063
1099
  render() {
1064
- var _, R;
1065
1100
  this._syncStateFromAttributes();
1066
- const e = this._measureItemShellRects(), r = new Set(this._draggingIds()), t = new Set(this._selection), s = !!((_ = this._dragState) != null && _.keyboard) ? this._projectedMoveResult() : null, o = (s == null ? void 0 : s.items) || this._items, a = new Set((s == null ? void 0 : s.insertedRootIds) || []), l = !!this._dragState && !this._dragState.keyboard && !!this._dragState.dropTarget, n = Q(o, t, r, this.filterQuery, this.sort), d = this._resolvedFocusedId(n), c = this._isDragLocked(), g = this._selection.length, m = this.getAttribute("allow-nesting") !== "false", f = this.getAttribute("drop-indicator-visibility") === "always" ? "always" : "active", v = this._dropzoneStyle(), b = this.getAttribute("show-selection-badge") !== "false", y = this._dragHandleMode(), w = this._usesCustomHandleSelector(), k = c ? this.sort === "label" ? "Dragging is paused while alphabetical sorting is active." : this.filterQuery && !this.hasAttribute("allow-filtered-drag") ? "Dragging is paused while the list is filtered." : "Dragging is currently disabled." : (R = this._dragState) != null && R.keyboard ? "Keyboard drag active. Use arrow keys to choose a drop target, Space or Enter to drop, and Escape to cancel." : y === "item" ? "Drag from anywhere on an item, or press Space on a focused item to start keyboard reordering." : w ? "Use your custom drag handle element, or press Space on a focused item to start keyboard reordering." : "Use the handle to drag, or press Space on a focused item to start keyboard reordering.", A = `
1067
- <style>${se}</style>
1101
+ const e = this._measureItemShellRects(), t = new Set(this._draggingIds()), r = new Set(this._selection), s = !!this._dragState?.keyboard ? this._projectedMoveResult() : null, n = s?.items || this._items, a = new Set(s?.insertedRootIds || []), d = !!this._dragState && !this._dragState.keyboard && !!this._dragState.dropTarget, o = Q(n, r, t, this.filterQuery, this.sort), u = this._resolvedFocusedId(o), c = this._isDragLocked(), h = this._selection.length, f = this.getAttribute("allow-nesting") !== "false", _ = this.getAttribute("drop-indicator-visibility") === "always" ? "always" : "active", I = this._dropzoneStyle(), m = this.getAttribute("show-selection-badge") !== "false", v = this._dragHandleMode(), D = this._usesCustomHandleSelector(), A = c ? this.sort === "label" ? "Dragging is paused while alphabetical sorting is active." : this.filterQuery && !this.hasAttribute("allow-filtered-drag") ? "Dragging is paused while the list is filtered." : "Dragging is currently disabled." : this._dragState?.keyboard ? "Keyboard drag active. Use arrow keys to choose a drop target, Space or Enter to drop, and Escape to cancel." : v === "item" ? "Drag from anywhere on an item, or press Space on a focused item to start keyboard reordering." : D ? "Use your custom drag handle element, or press Space on a focused item to start keyboard reordering." : "Use the handle to drag, or press Space on a focused item to start keyboard reordering.", z = `
1102
+ <style>${ae}</style>
1068
1103
  <div
1069
1104
  class="root"
1070
1105
  part="root"
1071
1106
  data-drag-locked="${c}"
1072
- data-drag-preview="${a.size || l ? "true" : "false"}"
1073
- data-drop-indicator-visibility="${f}"
1074
- data-dropzone-style="${v}"
1107
+ data-drag-preview="${a.size || d ? "true" : "false"}"
1108
+ data-drop-indicator-visibility="${_}"
1109
+ data-dropzone-style="${I}"
1075
1110
  >
1076
1111
  <div class="toolbar" part="toolbar">
1077
- <div class="helper">${I(k)}</div>
1112
+ <div class="helper">${y(A)}</div>
1078
1113
  <div class="helper selection-summary">
1079
- <span class="selection-pill" part="selection-count">${g}</span>
1080
- <span class="selection-text">${g === 1 ? "item selected" : "items selected"}</span>
1114
+ <span class="selection-pill" part="selection-count">${h}</span>
1115
+ <span class="selection-text">${h === 1 ? "item selected" : "items selected"}</span>
1081
1116
  </div>
1082
1117
  </div>
1083
1118
  <div class="lists" part="lists">
1084
- ${this._lists.map((S) => {
1085
- var L;
1086
- const C = n.get(S.id) || [], T = C.length ? this._renderListTree(o, S, d, r, m, a, b) : "", $ = S.disabled ? "This list is read-only." : S.cloneOnDrag ? "Dragging from this list creates a copy." : (L = S.accepts) != null && L.length ? `Accepts drops from: ${S.accepts.join(", ")}` : "";
1119
+ ${this._lists.map((b) => {
1120
+ const S = o.get(b.id) || [], R = S.length ? this._renderListTree(n, b, u, t, f, a, m) : "", $ = b.disabled ? "This list is read-only." : b.cloneOnDrag ? "Dragging from this list creates a copy." : b.accepts?.length ? `Accepts drops from: ${b.accepts.join(", ")}` : "";
1087
1121
  return `
1088
1122
  <section
1089
1123
  class="list"
1090
1124
  part="list"
1091
- data-list-id="${I(S.id)}"
1092
- data-orientation="${S.orientation}"
1093
- data-disabled="${S.disabled}"
1094
- aria-label="${I(S.label)}"
1125
+ data-list-id="${y(b.id)}"
1126
+ data-orientation="${b.orientation}"
1127
+ data-disabled="${b.disabled}"
1128
+ aria-label="${y(b.label)}"
1095
1129
  >
1096
1130
  <header class="list-header">
1097
- <div class="list-custom-header" part="list-custom-header" data-list-header-target="${I(S.id)}"></div>
1131
+ <div class="list-custom-header" part="list-custom-header" data-list-header-target="${y(b.id)}"></div>
1098
1132
  <div class="list-default-header">
1099
1133
  <div class="list-topline">
1100
- <div class="list-label">${I(S.label)}</div>
1101
- <span class="list-count">${C.length}</span>
1134
+ <div class="list-label">${y(b.label)}</div>
1135
+ <span class="list-count">${S.length}</span>
1102
1136
  </div>
1103
- ${S.description ? `<div class="list-description">${I(S.description)}</div>` : ""}
1104
- ${$ ? `<div class="list-helper">${I($)}</div>` : ""}
1137
+ ${b.description ? `<div class="list-description">${y(b.description)}</div>` : ""}
1138
+ ${$ ? `<div class="list-helper">${y($)}</div>` : ""}
1105
1139
  </div>
1106
1140
  </header>
1107
- <div class="items" role="listbox" aria-multiselectable="true">
1108
- ${T || `<div class="list-custom-empty" part="list-custom-empty" data-list-empty-target="${I(S.id)}"></div><div class="empty">${I(S.emptyLabel)}</div>${this._renderDropzone({
1109
- listId: S.id,
1141
+ <div class="items" role="listbox" aria-multiselectable="true" aria-label="${y(b.label)}">
1142
+ ${R || `<div class="list-custom-empty" part="list-custom-empty" data-list-empty-target="${y(b.id)}"></div><div class="empty">${y(b.emptyLabel)}</div>${this._renderDropzone({
1143
+ listId: b.id,
1110
1144
  parentId: null,
1111
1145
  beforeId: null,
1112
1146
  mode: "before"
@@ -1116,103 +1150,90 @@ class ce extends ee {
1116
1150
  `;
1117
1151
  }).join("")}
1118
1152
  </div>
1119
- <div class="sr-only" aria-live="polite" aria-atomic="true">${I(this._liveMessage)}</div>
1153
+ <div class="sr-only" aria-live="polite" aria-atomic="true">${y(this._liveMessage)}</div>
1120
1154
  </div>
1121
1155
  `;
1122
- this.setContent(A), queueMicrotask(() => {
1156
+ this.setContent(z), queueMicrotask(() => {
1123
1157
  this._restorePendingFocus(), this._applyCurrentDropTargetVisualState(), this._applyLiveMessage(), this._updatePointerDragPreview(), this._animateItemShellReflow(e);
1124
1158
  });
1125
1159
  }
1126
1160
  _syncStateFromAttributes() {
1127
- var i;
1128
1161
  const e = this.getAttribute("lists");
1129
- e !== this._lastListsAttr && (this._lastListsAttr = e, this._lists = Y(V(e)));
1130
- const r = this.getAttribute("items");
1131
- if (r !== this._lastItemsAttr) {
1132
- this._lastItemsAttr = r, this._items = U(this._lists, V(r));
1133
- const s = this.getAttribute("persist-key");
1134
- s && this._hydratedPersistKey !== s && (this._items = this._restorePersistedItems(s, this._items), this._hydratedPersistKey = s);
1162
+ e !== this._lastListsAttr && (this._lastListsAttr = e, this._lists = Y(K(e)));
1163
+ const t = this.getAttribute("items");
1164
+ if (t !== this._lastItemsAttr) {
1165
+ this._lastItemsAttr = t, this._items = U(this._lists, K(t));
1166
+ const i = this.getAttribute("persist-key");
1167
+ i && this._hydratedPersistKey !== i && (this._items = this._restorePersistedItems(i, this._items), this._hydratedPersistKey = i);
1135
1168
  }
1136
- const t = this.getAttribute("selection");
1137
- t !== this._lastSelectionAttr && this._syncSelectionFromAttribute(t), this._focusedId || (this._focusedId = ((i = this._items.find((s) => !s.hidden)) == null ? void 0 : i.id) || null);
1169
+ const r = this.getAttribute("selection");
1170
+ r !== this._lastSelectionAttr && this._syncSelectionFromAttribute(r), this._focusedId || (this._focusedId = this._items.find((i) => !i.hidden)?.id || null);
1138
1171
  }
1139
- _restorePersistedItems(e, r) {
1172
+ _restorePersistedItems(e, t) {
1140
1173
  try {
1141
- const t = window.localStorage.getItem(e);
1142
- if (!t)
1143
- return r;
1144
- const i = JSON.parse(t);
1145
- if (!i || typeof i != "object" || !Array.isArray(i.records))
1146
- return r;
1147
- const s = new Map(i.records.map((a) => [a.id, a])), o = r.map((a, l) => {
1148
- const n = s.get(a.id);
1149
- return n ? {
1174
+ const r = window.localStorage.getItem(e);
1175
+ if (!r) return t;
1176
+ const i = JSON.parse(r);
1177
+ if (!i || typeof i != "object" || !Array.isArray(i.records)) return t;
1178
+ const s = new Map(i.records.map((a) => [a.id, a])), n = t.map((a, d) => {
1179
+ const o = s.get(a.id);
1180
+ return o ? {
1150
1181
  ...a,
1151
- listId: this._lists.some((d) => d.id === n.listId) ? n.listId : a.listId,
1152
- parentId: typeof n.parentId == "string" ? n.parentId : null,
1153
- order: Number.isFinite(n.index) ? n.index : l
1154
- } : { ...a, order: l };
1182
+ listId: this._lists.some((u) => u.id === o.listId) ? o.listId : a.listId,
1183
+ parentId: typeof o.parentId == "string" ? o.parentId : null,
1184
+ order: Number.isFinite(o.index) ? o.index : d
1185
+ } : { ...a, order: d };
1155
1186
  });
1156
- return U(this._lists, o);
1187
+ return U(this._lists, n);
1157
1188
  } catch {
1158
- return r;
1189
+ return t;
1159
1190
  }
1160
1191
  }
1161
1192
  _resolvedFocusedId(e) {
1162
- const r = new Set(Array.from(e.values()).flat().map((i) => i.id));
1163
- if (this._focusedId && r.has(this._focusedId))
1164
- return this._focusedId;
1165
- const t = Array.from(e.values()).flat().find((i) => !i.disabled);
1166
- return (t == null ? void 0 : t.id) || null;
1193
+ const t = new Set(Array.from(e.values()).flat().map((i) => i.id));
1194
+ return this._focusedId && t.has(this._focusedId) ? this._focusedId : Array.from(e.values()).flat().find((i) => !i.disabled)?.id || null;
1167
1195
  }
1168
1196
  _restorePendingFocus() {
1169
1197
  const e = this._pendingFocusId || this._focusedId;
1170
- if (!e)
1171
- return;
1172
- const r = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/"/g, '\\"'), t = this.root.querySelector(`.item[data-id="${r}"]`);
1173
- t && (document.activeElement !== t && t.focus({ preventScroll: !0 }), this._pendingFocusId = null);
1198
+ if (!e) return;
1199
+ const t = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/"/g, '\\"'), r = this.root.querySelector(`.item[data-id="${t}"]`);
1200
+ r && (document.activeElement !== r && r.focus({ preventScroll: !0 }), this._pendingFocusId = null);
1174
1201
  }
1175
1202
  _escapeSelectorValue(e) {
1176
1203
  return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/"/g, '\\"');
1177
1204
  }
1178
1205
  _findDropzone(e) {
1179
- const r = this._escapeSelectorValue(e.listId), t = this._escapeSelectorValue(e.parentId ?? ""), i = this._escapeSelectorValue(e.beforeId ?? ""), s = this._escapeSelectorValue(e.mode);
1206
+ const t = this._escapeSelectorValue(e.listId), r = this._escapeSelectorValue(e.parentId ?? ""), i = this._escapeSelectorValue(e.beforeId ?? ""), s = this._escapeSelectorValue(e.mode);
1180
1207
  return this.root.querySelector(
1181
- `.dropzone[data-list-id="${r}"][data-parent-id="${t}"][data-before-id="${i}"][data-mode="${s}"]`
1208
+ `.dropzone[data-list-id="${t}"][data-parent-id="${r}"][data-before-id="${i}"][data-mode="${s}"]`
1182
1209
  );
1183
1210
  }
1184
1211
  _findItemElement(e) {
1185
- const r = this._escapeSelectorValue(e);
1186
- return this.root.querySelector(`.item[data-id="${r}"]`);
1212
+ const t = this._escapeSelectorValue(e);
1213
+ return this.root.querySelector(`.item[data-id="${t}"]`);
1187
1214
  }
1188
1215
  _dragHandleMode() {
1189
- return oe(this.getAttribute("drag-handle-mode"));
1216
+ return de(this.getAttribute("drag-handle-mode"));
1190
1217
  }
1191
1218
  _dropzoneStyle() {
1192
1219
  return this.getAttribute("dropzone-style") === "container" ? "container" : "indicator";
1193
1220
  }
1194
1221
  _usesCustomHandleSelector() {
1195
- var e;
1196
- return !!((e = this.getAttribute("drag-handle-selector")) != null && e.trim());
1222
+ return !!this.getAttribute("drag-handle-selector")?.trim();
1197
1223
  }
1198
1224
  _dragActivatorFromPath(e) {
1199
- var o;
1200
- const r = e.find((a) => a instanceof HTMLElement && !!a.getAttribute("data-drag-trigger"));
1201
- if (!r)
1202
- return null;
1203
- const t = r.getAttribute("data-drag-trigger"), i = t === "item" ? "item" : t === "custom" ? "custom" : "handle", s = r.getAttribute("data-id") || ((o = r.closest(".item[data-id]")) == null ? void 0 : o.getAttribute("data-id"));
1204
- return s ? { element: r, id: s, kind: i } : null;
1205
- }
1206
- _setDropTargetVisualState(e, r) {
1207
- var i;
1208
- if (!e)
1209
- return;
1210
- const t = this._findDropzone(e);
1211
- t && (t.setAttribute("data-active", r ? "true" : "false"), r ? this._syncDropzoneContainerSize(t, e) : this._clearDropzoneContainerSize(t)), e.mode === "inside" && e.parentId && ((i = this._findItemElement(e.parentId)) == null || i.setAttribute("data-drop-inside-active", r ? "true" : "false"));
1225
+ const t = e.find((n) => n instanceof HTMLElement && !!n.getAttribute("data-drag-trigger"));
1226
+ if (!t) return null;
1227
+ const r = t.getAttribute("data-drag-trigger"), i = r === "item" ? "item" : r === "custom" ? "custom" : "handle", s = t.getAttribute("data-id") || t.closest(".item[data-id]")?.getAttribute("data-id");
1228
+ return s ? { element: t, id: s, kind: i } : null;
1229
+ }
1230
+ _setDropTargetVisualState(e, t) {
1231
+ if (!e) return;
1232
+ const r = this._findDropzone(e);
1233
+ r && (r.setAttribute("data-active", t ? "true" : "false"), t ? this._syncDropzoneContainerSize(r, e) : this._clearDropzoneContainerSize(r)), e.mode === "inside" && e.parentId && this._findItemElement(e.parentId)?.setAttribute("data-drop-inside-active", t ? "true" : "false");
1212
1234
  }
1213
1235
  _applyCurrentDropTargetVisualState(e) {
1214
- var r;
1215
- this._setDropTargetVisualState(e ?? null, !1), this._setDropTargetVisualState(((r = this._dragState) == null ? void 0 : r.dropTarget) ?? null, !0);
1236
+ this._setDropTargetVisualState(e ?? null, !1), this._setDropTargetVisualState(this._dragState?.dropTarget ?? null, !0);
1216
1237
  }
1217
1238
  _applyLiveMessage() {
1218
1239
  const e = this.root.querySelector(".sr-only[aria-live]");
@@ -1222,97 +1243,88 @@ class ce extends ee {
1222
1243
  return !!this.root.querySelector(".root") && !this._dragState;
1223
1244
  }
1224
1245
  _applyInteractiveStateInPlace(e) {
1225
- return this._canSyncInteractiveStateInPlace() ? (this._syncSelectionVisualState(), e != null && e.restoreFocus && this._restorePendingFocus(), this._applyLiveMessage(), !0) : !1;
1246
+ return this._canSyncInteractiveStateInPlace() ? (this._syncSelectionVisualState(), e?.restoreFocus && this._restorePendingFocus(), this._applyLiveMessage(), !0) : !1;
1226
1247
  }
1227
1248
  _hasCustomItemRendering() {
1228
1249
  return this.hasAttribute("custom-item-rendering");
1229
1250
  }
1230
1251
  _syncSelectionFromAttribute(e) {
1231
1252
  this._lastSelectionAttr = e;
1232
- const r = new Set(this._items.map((t) => t.id));
1233
- this._selection = V(e).filter((t) => r.has(t)), !this._selection.length && this._focusedId && !r.has(this._focusedId) && (this._focusedId = null);
1253
+ const t = new Set(this._items.map((r) => r.id));
1254
+ this._selection = K(e).filter((r) => t.has(r)), !this._selection.length && this._focusedId && !t.has(this._focusedId) && (this._focusedId = null);
1234
1255
  }
1235
1256
  _syncSelectionVisualState() {
1236
- const e = new Set(this._selection), r = this.getAttribute("show-selection-badge") !== "false";
1257
+ const e = new Set(this._selection), t = this.getAttribute("show-selection-badge") !== "false";
1237
1258
  this.root.querySelectorAll(".item[data-id]").forEach((s) => {
1238
- const o = s.getAttribute("data-id");
1239
- if (!o)
1240
- return;
1241
- const a = e.has(o), l = this._focusedId === o;
1242
- s.setAttribute("data-selected", a ? "true" : "false"), s.setAttribute("aria-selected", a ? "true" : "false"), s.setAttribute("data-focused", l ? "true" : "false"), s.setAttribute("tabindex", l ? "0" : "-1");
1243
- const n = s.querySelector('[data-selection-badge="true"]');
1244
- if (n) {
1245
- const d = a && r;
1246
- n.hidden = !d, n.textContent = d ? "Selected" : "";
1259
+ const n = s.getAttribute("data-id");
1260
+ if (!n) return;
1261
+ const a = e.has(n), d = this._focusedId === n;
1262
+ s.setAttribute("data-selected", a ? "true" : "false"), s.setAttribute("aria-selected", a ? "true" : "false"), s.setAttribute("data-focused", d ? "true" : "false"), s.setAttribute("tabindex", d ? "0" : "-1");
1263
+ const o = s.querySelector('[data-selection-badge="true"]');
1264
+ if (o) {
1265
+ const u = a && t;
1266
+ o.hidden = !u, o.textContent = u ? "Selected" : "";
1247
1267
  }
1248
1268
  });
1249
- const t = this.root.querySelector(".selection-pill");
1250
- t && (t.textContent = String(this._selection.length));
1269
+ const r = this.root.querySelector(".selection-pill");
1270
+ r && (r.textContent = String(this._selection.length));
1251
1271
  const i = this.root.querySelector(".selection-text");
1252
1272
  i && (i.textContent = this._selection.length === 1 ? "item selected" : "items selected");
1253
1273
  }
1254
1274
  _clearDropzoneContainerSize(e) {
1255
1275
  e.style.removeProperty("--ui-sortable-dropzone-match-block-size"), e.style.removeProperty("--ui-sortable-dropzone-match-inline-size");
1256
1276
  }
1257
- _dropzoneReferenceElement(e, r) {
1258
- if (e.mode === "inside" && e.parentId)
1259
- return this._findItemElement(e.parentId);
1260
- let t = r.nextElementSibling;
1261
- for (; t; ) {
1262
- if (t instanceof HTMLElement && t.classList.contains("item-shell"))
1263
- return t.querySelector(".item[data-id]");
1264
- t = t.nextElementSibling;
1277
+ _dropzoneReferenceElement(e, t) {
1278
+ if (e.mode === "inside" && e.parentId) return this._findItemElement(e.parentId);
1279
+ let r = t.nextElementSibling;
1280
+ for (; r; ) {
1281
+ if (r instanceof HTMLElement && r.classList.contains("item-shell"))
1282
+ return r.querySelector(".item[data-id]");
1283
+ r = r.nextElementSibling;
1265
1284
  }
1266
- let i = r.previousElementSibling;
1285
+ let i = t.previousElementSibling;
1267
1286
  for (; i; ) {
1268
1287
  if (i instanceof HTMLElement && i.classList.contains("item-shell"))
1269
1288
  return i.querySelector(".item[data-id]");
1270
1289
  i = i.previousElementSibling;
1271
1290
  }
1272
- const s = this._escapeSelectorValue(e.listId), o = this.root.querySelector(`.list[data-list-id="${s}"] .items`), a = o == null ? void 0 : o.querySelector(".item[data-id]");
1273
- return a || o || null;
1274
- }
1275
- _syncDropzoneContainerSize(e, r) {
1276
- if (this._clearDropzoneContainerSize(e), this._dropzoneStyle() !== "container")
1277
- return;
1278
- const t = this._dropzoneReferenceElement(r, e);
1279
- if (!t)
1280
- return;
1281
- const i = t.getBoundingClientRect();
1291
+ const s = this._escapeSelectorValue(e.listId), n = this.root.querySelector(`.list[data-list-id="${s}"] .items`), a = n?.querySelector(".item[data-id]");
1292
+ return a || n || null;
1293
+ }
1294
+ _syncDropzoneContainerSize(e, t) {
1295
+ if (this._clearDropzoneContainerSize(e), this._dropzoneStyle() !== "container") return;
1296
+ const r = this._dropzoneReferenceElement(t, e);
1297
+ if (!r) return;
1298
+ const i = r.getBoundingClientRect();
1282
1299
  e.style.setProperty("--ui-sortable-dropzone-match-block-size", `${Math.max(76, Math.round(i.height))}px`), e.style.setProperty("--ui-sortable-dropzone-match-inline-size", `${Math.max(180, Math.round(i.width))}px`);
1283
1300
  }
1284
1301
  _ensureDragPreviewOverlay() {
1285
- if (this._dragPreviewOverlay && this._dragPreviewOverlay.isConnected)
1286
- return this._dragPreviewOverlay;
1302
+ if (this._dragPreviewOverlay && this._dragPreviewOverlay.isConnected) return this._dragPreviewOverlay;
1287
1303
  const e = document.createElement("div");
1288
1304
  return e.className = "drag-preview-overlay", e.setAttribute("data-visible", "false"), this.root.appendChild(e), this._dragPreviewOverlay = e, e;
1289
1305
  }
1290
1306
  _clearPointerDragPreview() {
1291
- var r, t, i, s;
1292
- (r = this._dragPreviewOverlay) == null || r.setAttribute("data-visible", "false"), (t = this._dragPreviewOverlay) == null || t.style.setProperty("left", "-9999px"), (i = this._dragPreviewOverlay) == null || i.style.setProperty("top", "-9999px");
1307
+ this._dragPreviewOverlay?.setAttribute("data-visible", "false"), this._dragPreviewOverlay?.style.setProperty("left", "-9999px"), this._dragPreviewOverlay?.style.setProperty("top", "-9999px");
1293
1308
  const e = this.root.querySelector(".root");
1294
- e && !((s = this._dragState) != null && s.keyboard) && e.setAttribute("data-drag-preview", "false");
1309
+ e && !this._dragState?.keyboard && e.setAttribute("data-drag-preview", "false");
1295
1310
  }
1296
1311
  _pointerPreviewContent() {
1297
- if (!this._dragState || this._dragState.keyboard)
1298
- return null;
1299
- const e = this._dragState.movedRootIds[0], r = this._items.find((t) => t.id === e);
1300
- return r ? {
1312
+ if (!this._dragState || this._dragState.keyboard) return null;
1313
+ const e = this._dragState.movedRootIds[0], t = this._items.find((r) => r.id === e);
1314
+ return t ? {
1301
1315
  kicker: this._dragState.clone ? "Copy preview" : "Drop preview",
1302
- title: this._dragState.clone ? `${r.label} copy` : r.label,
1316
+ title: this._dragState.clone ? `${t.label} copy` : t.label,
1303
1317
  description: this._dragState.clone ? "Release to add a copy here." : this._dragState.movedRootIds.length > 1 ? "Release to place this selection here." : "Release to place this item here."
1304
1318
  } : null;
1305
1319
  }
1306
1320
  _pointerPreviewSize() {
1307
- if (this.getAttribute("drag-preview-size") === "compact" || !this._dragState || this._dragState.keyboard)
1308
- return null;
1309
- const e = this._dragState.movedRootIds[0], r = e ? this._findItemElement(e) : null;
1310
- if (!r)
1311
- return null;
1312
- const t = window.getComputedStyle(r), i = ne(t.transform);
1321
+ if (this.getAttribute("drag-preview-size") === "compact" || !this._dragState || this._dragState.keyboard) return null;
1322
+ const e = this._dragState.movedRootIds[0], t = e ? this._findItemElement(e) : null;
1323
+ if (!t) return null;
1324
+ const r = window.getComputedStyle(t), i = le(r.transform);
1313
1325
  return {
1314
- width: r.offsetWidth * i.x,
1315
- height: r.offsetHeight * i.y
1326
+ width: t.offsetWidth * i.x,
1327
+ height: t.offsetHeight * i.y
1316
1328
  };
1317
1329
  }
1318
1330
  _updatePointerDragPreview() {
@@ -1325,230 +1337,226 @@ class ce extends ee {
1325
1337
  this._clearPointerDragPreview();
1326
1338
  return;
1327
1339
  }
1328
- const r = this.root.querySelector(".root"), t = this._dragPreviewOverlay, i = (t == null ? void 0 : t.getAttribute("data-visible")) === "true", s = this._pointerPreviewSize();
1340
+ const t = this.root.querySelector(".root"), i = this._dragPreviewOverlay?.getAttribute("data-visible") === "true", s = this._pointerPreviewSize();
1329
1341
  if (!this._dragState.dropTarget) {
1330
- i && r && r.setAttribute("data-drag-preview", "true");
1342
+ i && t && t.setAttribute("data-drag-preview", "true");
1331
1343
  return;
1332
1344
  }
1333
- const o = this._findDropzone(this._dragState.dropTarget);
1334
- if (!o) {
1335
- i && r && r.setAttribute("data-drag-preview", "true");
1345
+ const n = this._findDropzone(this._dragState.dropTarget);
1346
+ if (!n) {
1347
+ i && t && t.setAttribute("data-drag-preview", "true");
1336
1348
  return;
1337
1349
  }
1338
1350
  const a = this._ensureDragPreviewOverlay();
1339
1351
  a.innerHTML = `
1340
1352
  <div class="placeholder-content">
1341
- <div class="placeholder-kicker">${I(e.kicker)}</div>
1342
- <div class="placeholder-title">${I(e.title)}</div>
1343
- <div class="placeholder-description">${I(e.description)}</div>
1353
+ <div class="placeholder-kicker">${y(e.kicker)}</div>
1354
+ <div class="placeholder-title">${y(e.title)}</div>
1355
+ <div class="placeholder-description">${y(e.description)}</div>
1344
1356
  </div>
1345
1357
  `;
1346
- const l = o.getBoundingClientRect();
1347
- r && r.setAttribute("data-drag-preview", "true"), a.style.setProperty("left", "-9999px"), a.style.setProperty("top", "-9999px"), s ? (a.style.setProperty("inline-size", `${s.width}px`), a.style.setProperty("block-size", `${s.height}px`)) : (a.style.removeProperty("inline-size"), a.style.removeProperty("block-size")), a.setAttribute("data-visible", "true");
1348
- const n = a.getBoundingClientRect(), d = (s == null ? void 0 : s.width) ?? n.width, c = (s == null ? void 0 : s.height) ?? n.height, g = Math.max(16, Math.min(l.left, window.innerWidth - d - 16)), m = Math.max(
1358
+ const d = n.getBoundingClientRect();
1359
+ t && t.setAttribute("data-drag-preview", "true"), a.style.setProperty("left", "-9999px"), a.style.setProperty("top", "-9999px"), s ? (a.style.setProperty("inline-size", `${s.width}px`), a.style.setProperty("block-size", `${s.height}px`)) : (a.style.removeProperty("inline-size"), a.style.removeProperty("block-size")), a.setAttribute("data-visible", "true");
1360
+ const o = a.getBoundingClientRect(), u = s?.width ?? o.width, c = s?.height ?? o.height, h = Math.max(16, Math.min(d.left, window.innerWidth - u - 16)), f = Math.max(
1349
1361
  16,
1350
1362
  Math.min(
1351
- l.top + (l.height - c) / 2,
1363
+ d.top + (d.height - c) / 2,
1352
1364
  window.innerHeight - c - 16
1353
1365
  )
1354
1366
  );
1355
- a.style.setProperty("left", `${Math.round(g)}px`), a.style.setProperty("top", `${Math.round(m)}px`);
1367
+ a.style.setProperty("left", `${Math.round(h)}px`), a.style.setProperty("top", `${Math.round(f)}px`);
1356
1368
  }
1357
- _setDraggingVisualState(e, r) {
1358
- e.forEach((t) => {
1359
- const i = this._findItemElement(t);
1360
- i && (i.setAttribute("data-dragging", r ? "true" : "false"), i.setAttribute("aria-grabbed", r ? "true" : "false"), r && i.getBoundingClientRect());
1369
+ _setDraggingVisualState(e, t) {
1370
+ e.forEach((r) => {
1371
+ const i = this._findItemElement(r);
1372
+ i && (i.setAttribute("data-dragging", t ? "true" : "false"), i.setAttribute("aria-grabbed", t ? "true" : "false"), t && i.getBoundingClientRect());
1361
1373
  });
1362
1374
  }
1363
- _setDropTarget(e, r) {
1364
- var i;
1365
- const t = ((i = this._dragState) == null ? void 0 : i.dropTarget) ?? null;
1366
- if (!(!this._dragState || B(t, e))) {
1367
- if (this._pendingDropTarget = null, this._dragState.dropTarget = e, this._applyCurrentDropTargetVisualState(t), r != null && r.announceLabel && this._announce(r.announceLabel), this._dragState.keyboard) {
1375
+ _setDropTarget(e, t) {
1376
+ const r = this._dragState?.dropTarget ?? null;
1377
+ if (!(!this._dragState || B(r, e))) {
1378
+ if (this._pendingDropTarget = null, this._dragState.dropTarget = e, this._applyCurrentDropTargetVisualState(r), t?.announceLabel && this._announce(t.announceLabel), this._dragState.keyboard) {
1368
1379
  this.requestRender();
1369
1380
  return;
1370
1381
  }
1371
1382
  this._updatePointerDragPreview();
1372
1383
  }
1373
1384
  }
1374
- _queueDropTarget(e, r, t) {
1375
- if (!this._dragState)
1376
- return;
1385
+ _queueDropTarget(e, t, r) {
1386
+ if (!this._dragState) return;
1377
1387
  const i = this._dragState.dropTarget ?? null;
1378
1388
  if (B(i, e)) {
1379
1389
  this._pendingDropTarget = null;
1380
1390
  return;
1381
1391
  }
1382
1392
  if (!i && e) {
1383
- this._setDropTarget(e, t);
1393
+ this._setDropTarget(e, r);
1384
1394
  return;
1385
1395
  }
1386
- const s = typeof r == "number" && Number.isFinite(r) ? r : performance.now(), o = this._pendingDropTarget;
1387
- if (o && B(o.target, e)) {
1388
- const a = e ? re : ie;
1389
- s - o.startedAt >= a && this._setDropTarget(e, o.announceLabel ? { announceLabel: o.announceLabel } : t);
1396
+ const s = typeof t == "number" && Number.isFinite(t) ? t : performance.now(), n = this._pendingDropTarget;
1397
+ if (n && B(n.target, e)) {
1398
+ const a = e ? oe : ne;
1399
+ s - n.startedAt >= a && this._setDropTarget(e, n.announceLabel ? { announceLabel: n.announceLabel } : r);
1390
1400
  return;
1391
1401
  }
1392
1402
  this._pendingDropTarget = {
1393
1403
  target: e,
1394
1404
  startedAt: s,
1395
- announceLabel: t == null ? void 0 : t.announceLabel
1405
+ announceLabel: r?.announceLabel
1396
1406
  };
1397
1407
  }
1398
- _releaseDropTarget(e, r) {
1399
- var s;
1400
- if (!this._dragState)
1401
- return null;
1402
- if (Number.isFinite(e) && Number.isFinite(r)) {
1403
- const o = this._dropTargetFromPoint(e, r);
1404
- if (o && this._canDrop(o, this._dragState.movedRootIds))
1405
- return this._pendingDropTarget = null, o;
1408
+ _releaseDropTarget(e, t) {
1409
+ if (!this._dragState) return null;
1410
+ if (Number.isFinite(e) && Number.isFinite(t)) {
1411
+ const n = this._dropTargetFromPoint(e, t);
1412
+ if (n && this._canDrop(n, this._dragState.movedRootIds))
1413
+ return this._pendingDropTarget = null, n;
1406
1414
  }
1407
- const t = ((s = this._pendingDropTarget) == null ? void 0 : s.target) ?? null;
1408
- if (this._pendingDropTarget = null, t && this._canDrop(t, this._dragState.movedRootIds))
1409
- return t;
1410
- const i = this._dragState.dropTarget ?? null;
1411
- return i && this._canDrop(i, this._dragState.movedRootIds) ? i : null;
1412
- }
1413
- _pathFromPoint(e, r) {
1414
- var o, a;
1415
- const t = [], i = this.root;
1416
- let s = typeof i.elementFromPoint == "function" ? i.elementFromPoint(e, r) : ((o = this.ownerDocument) == null ? void 0 : o.elementFromPoint(e, r)) ?? null;
1417
- for (; s && (s instanceof HTMLElement && t.push(s), s !== this); ) {
1415
+ const r = this._pendingDropTarget?.target ?? null;
1416
+ this._pendingDropTarget = null;
1417
+ const i = (n) => this._pointerIsOverList(n.listId, e, t);
1418
+ if (r && this._canDrop(r, this._dragState.movedRootIds) && i(r)) return r;
1419
+ const s = this._dragState.dropTarget ?? null;
1420
+ return s && this._canDrop(s, this._dragState.movedRootIds) && i(s) ? s : null;
1421
+ }
1422
+ _pointerIsOverList(e, t, r) {
1423
+ if (!Number.isFinite(t) || !Number.isFinite(r)) return !0;
1424
+ const s = Array.from(this.root.querySelectorAll(".list[data-list-id]")).find((a) => a.getAttribute("data-list-id") === e);
1425
+ if (!s) return !0;
1426
+ const n = s.getBoundingClientRect();
1427
+ return t >= n.left && t <= n.right && r >= n.top && r <= n.bottom;
1428
+ }
1429
+ _pathFromPoint(e, t) {
1430
+ const r = [], i = this.root;
1431
+ let s = typeof i.elementFromPoint == "function" ? i.elementFromPoint(e, t) : this.ownerDocument?.elementFromPoint(e, t) ?? null;
1432
+ for (; s && (s instanceof HTMLElement && r.push(s), s !== this); ) {
1418
1433
  if (s instanceof ShadowRoot) {
1419
1434
  s = s.host;
1420
1435
  continue;
1421
1436
  }
1422
- s = s.parentNode, !s && ((a = t[t.length - 1]) == null ? void 0 : a.getRootNode()) instanceof ShadowRoot && (s = t[t.length - 1].getRootNode().host);
1437
+ s = s.parentNode, !s && r[r.length - 1]?.getRootNode() instanceof ShadowRoot && (s = r[r.length - 1].getRootNode().host);
1423
1438
  }
1424
- return t;
1439
+ return r;
1425
1440
  }
1426
1441
  _measureItemShellRects() {
1427
1442
  const e = /* @__PURE__ */ new Map();
1428
- return this.root.querySelectorAll(".item-shell[data-item-shell]").forEach((r) => {
1429
- const t = r.getAttribute("data-item-shell");
1430
- if (!t)
1431
- return;
1432
- const i = r.getBoundingClientRect();
1433
- e.set(t, { top: i.top, left: i.left });
1443
+ return this.root.querySelectorAll(".item-shell[data-item-shell]").forEach((t) => {
1444
+ const r = t.getAttribute("data-item-shell");
1445
+ if (!r) return;
1446
+ const i = t.getBoundingClientRect();
1447
+ e.set(r, { top: i.top, left: i.left });
1434
1448
  }), e;
1435
1449
  }
1436
1450
  _animateItemShellReflow(e) {
1437
- if (!e.size)
1438
- return;
1439
- const r = new Set(this._draggingIds());
1440
- this.root.querySelectorAll(".item-shell[data-item-shell]").forEach((t) => {
1441
- const i = t.getAttribute("data-item-shell");
1442
- if (!i || r.has(i))
1443
- return;
1451
+ if (!e.size) return;
1452
+ const t = new Set(this._draggingIds());
1453
+ this.root.querySelectorAll(".item-shell[data-item-shell]").forEach((r) => {
1454
+ const i = r.getAttribute("data-item-shell");
1455
+ if (!i || t.has(i)) return;
1444
1456
  const s = e.get(i);
1445
- if (!s)
1446
- return;
1447
- const o = t.getBoundingClientRect(), a = s.left - o.left, l = s.top - o.top;
1448
- Math.abs(a) < 0.5 && Math.abs(l) < 0.5 || (t.style.transition = "none", t.style.transform = `translate(${a}px, ${l}px)`, t.style.willChange = "transform", t.getBoundingClientRect(), requestAnimationFrame(() => {
1449
- t.style.transition = "transform 180ms ease", t.style.transform = "";
1450
- const n = () => {
1451
- t.style.transition = "", t.style.willChange = "", t.removeEventListener("transitionend", n);
1457
+ if (!s) return;
1458
+ const n = r.getBoundingClientRect(), a = s.left - n.left, d = s.top - n.top;
1459
+ Math.abs(a) < 0.5 && Math.abs(d) < 0.5 || (r.style.transition = "none", r.style.transform = `translate(${a}px, ${d}px)`, r.style.willChange = "transform", r.getBoundingClientRect(), requestAnimationFrame(() => {
1460
+ r.style.transition = "transform 180ms ease", r.style.transform = "";
1461
+ const o = () => {
1462
+ r.style.transition = "", r.style.willChange = "", r.removeEventListener("transitionend", o);
1452
1463
  };
1453
- t.addEventListener("transitionend", n), window.setTimeout(n, 220);
1464
+ r.addEventListener("transitionend", o), window.setTimeout(o, 220);
1454
1465
  }));
1455
1466
  });
1456
1467
  }
1457
- _previewCloneSubtreeItem(e, r) {
1458
- const t = e.id.includes("--copy-") ? e.id.split("--copy-")[0] : e.id;
1468
+ _previewCloneSubtreeItem(e, t) {
1469
+ const r = e.id.includes("--copy-") ? e.id.split("--copy-")[0] : e.id;
1459
1470
  return {
1460
1471
  ...e,
1461
- id: `${t}--preview`,
1462
- label: r[0] === e.id ? `${e.label} copy` : e.label
1472
+ id: `${r}--preview`,
1473
+ label: t[0] === e.id ? `${e.label} copy` : e.label
1463
1474
  };
1464
1475
  }
1465
1476
  _projectedMoveResult() {
1466
- var e;
1467
- return !((e = this._dragState) != null && e.dropTarget) || !this._canDrop(this._dragState.dropTarget, this._dragState.movedRootIds) ? null : ae(
1477
+ return !this._dragState?.dropTarget || !this._canDrop(this._dragState.dropTarget, this._dragState.movedRootIds) ? null : ce(
1468
1478
  this._items,
1469
1479
  this._lists,
1470
1480
  this._dragState.dropTarget,
1471
1481
  this._dragState.movedRootIds,
1472
1482
  this._dragState.clone,
1473
- (r, t) => this._previewCloneSubtreeItem(r, t)
1483
+ (e, t) => this._previewCloneSubtreeItem(e, t)
1474
1484
  );
1475
1485
  }
1476
- _renderListTree(e, r, t, i, s, o, a) {
1477
- const l = M(e), n = E(e), d = (c) => {
1478
- const g = n.get(z(r.id, c)) || [], m = this.sort === "label" ? [...g].sort((v, b) => {
1479
- const y = l.get(v), w = l.get(b);
1480
- return !y || !w ? 0 : y.label.localeCompare(w.label);
1481
- }) : g;
1482
- let f = "";
1483
- return m.forEach((v) => {
1484
- const b = l.get(v);
1485
- if (!b || b.hidden)
1486
- return;
1487
- const y = this._renderChildBranch(
1488
- b,
1489
- t,
1486
+ _renderListTree(e, t, r, i, s, n, a) {
1487
+ const d = T(e), o = E(e), u = (c) => {
1488
+ const h = o.get(k(t.id, c)) || [], f = this.sort === "label" ? [...h].sort((I, m) => {
1489
+ const v = d.get(I), D = d.get(m);
1490
+ return !v || !D ? 0 : v.label.localeCompare(D.label);
1491
+ }) : h;
1492
+ let _ = "";
1493
+ return f.forEach((I) => {
1494
+ const m = d.get(I);
1495
+ if (!m || m.hidden) return;
1496
+ const v = this._renderChildBranch(
1497
+ m,
1498
+ r,
1490
1499
  i,
1491
- d,
1500
+ u,
1492
1501
  s,
1493
- o,
1502
+ n,
1494
1503
  a
1495
1504
  );
1496
- !W(b, this.filterQuery) && !y.includes('class="item"') || (f += this._renderDropzone({
1497
- listId: r.id,
1505
+ !W(m, this.filterQuery) && !v.includes('class="item"') || (_ += this._renderDropzone({
1506
+ listId: t.id,
1498
1507
  parentId: c,
1499
- beforeId: v,
1508
+ beforeId: I,
1500
1509
  mode: "before"
1501
- }, "Drop here"), f += y);
1502
- }), f += this._renderDropzone({
1503
- listId: r.id,
1510
+ }, "Drop here"), _ += v);
1511
+ }), _ += this._renderDropzone({
1512
+ listId: t.id,
1504
1513
  parentId: c,
1505
1514
  beforeId: null,
1506
1515
  mode: "before"
1507
- }, "Drop here"), f;
1516
+ }, "Drop here"), _;
1508
1517
  };
1509
- return `<div class="tree">${d(null)}</div>`;
1518
+ return `<div class="tree">${u(null)}</div>`;
1510
1519
  }
1511
- _renderChildBranch(e, r, t, i, s, o, a) {
1512
- var S, C, T, $;
1513
- const l = I(e.id), n = o.has(e.id), d = n ? "" : i(e.id), c = d.includes('class="item"'), g = n ? !1 : this._selection.includes(e.id), m = n ? !1 : t.has(e.id), f = e.disabled, v = f || e.dragDisabled || this._isDragLocked(), b = ((C = (S = this._dragState) == null ? void 0 : S.dropTarget) == null ? void 0 : C.mode) === "inside" && this._dragState.dropTarget.parentId === e.id, y = (T = this._dragState) != null && T.clone ? "Copy preview" : "Drop preview", w = ($ = this._dragState) != null && $.clone ? "Release to add a copy here." : this._dragState && this._dragState.movedRootIds.length > 1 ? "Release to place this selection here." : "Release to place this item here.", k = this._dragHandleMode(), A = this._usesCustomHandleSelector(), _ = A ? "custom" : k, R = !A && k === "handle";
1520
+ _renderChildBranch(e, t, r, i, s, n, a) {
1521
+ const d = y(e.id), o = n.has(e.id), u = o ? "" : i(e.id), c = u.includes('class="item"'), h = o ? !1 : this._selection.includes(e.id), f = o ? !1 : r.has(e.id), _ = e.disabled, I = _ || e.dragDisabled || this._isDragLocked(), m = this._dragState?.dropTarget?.mode === "inside" && this._dragState.dropTarget.parentId === e.id, v = this._dragState?.clone ? "Copy preview" : "Drop preview", D = this._dragState?.clone ? "Release to add a copy here." : this._dragState && this._dragState.movedRootIds.length > 1 ? "Release to place this selection here." : "Release to place this item here.", A = this._dragHandleMode(), z = this._usesCustomHandleSelector(), b = z ? "custom" : A, S = !z && A === "handle";
1514
1522
  return `
1515
- <div class="item-shell" data-item-shell="${l}">
1523
+ <div class="item-shell" data-item-shell="${d}">
1516
1524
  <article
1517
- class="item${n ? " item-placeholder" : ""}"
1525
+ class="item${o ? " item-placeholder" : ""}"
1518
1526
  part="item"
1519
- data-id="${l}"
1520
- data-drag-handle-mode="${_}"
1521
- ${!n && _ === "item" ? 'data-drag-trigger="item"' : ""}
1522
- data-selected="${g}"
1523
- data-focused="${n ? "false" : r === e.id}"
1524
- data-dragging="${m}"
1525
- data-disabled="${f}"
1526
- data-drop-inside-active="${b ? "true" : "false"}"
1527
- role="${n ? "presentation" : "option"}"
1528
- aria-selected="${n ? "false" : g}"
1529
- aria-disabled="${f}"
1530
- aria-grabbed="${n ? "false" : m}"
1531
- aria-hidden="${n ? "true" : "false"}"
1532
- tabindex="${n ? "-1" : r === e.id ? "0" : "-1"}"
1527
+ data-id="${d}"
1528
+ data-drag-handle-mode="${b}"
1529
+ ${!o && b === "item" ? 'data-drag-trigger="item"' : ""}
1530
+ data-selected="${h}"
1531
+ data-focused="${o ? "false" : t === e.id}"
1532
+ data-dragging="${f}"
1533
+ data-disabled="${_}"
1534
+ data-drop-inside-active="${m ? "true" : "false"}"
1535
+ role="${o ? "presentation" : "option"}"
1536
+ aria-selected="${o ? "false" : h}"
1537
+ aria-disabled="${_}"
1538
+ aria-grabbed="${o ? "false" : f}"
1539
+ aria-hidden="${o ? "true" : "false"}"
1540
+ tabindex="${o ? "-1" : t === e.id ? "0" : "-1"}"
1533
1541
  >
1534
- ${n ? `
1542
+ ${o ? `
1535
1543
  <div class="placeholder-content">
1536
- <div class="placeholder-kicker">${I(y)}</div>
1537
- <div class="placeholder-title">${I(e.label)}</div>
1538
- <div class="placeholder-description">${I(w)}</div>
1544
+ <div class="placeholder-kicker">${y(v)}</div>
1545
+ <div class="placeholder-title">${y(e.label)}</div>
1546
+ <div class="placeholder-description">${y(D)}</div>
1539
1547
  </div>
1540
1548
  ` : `
1541
- ${R ? `
1549
+ ${S ? `
1542
1550
  <button
1543
1551
  class="handle"
1544
1552
  part="handle"
1545
1553
  type="button"
1546
1554
  data-action="handle"
1547
1555
  data-drag-trigger="handle"
1548
- data-id="${l}"
1556
+ data-id="${d}"
1549
1557
  draggable="false"
1550
- ${v ? "disabled" : ""}
1551
- aria-label="Drag ${I(e.label)}"
1558
+ ${I ? "disabled" : ""}
1559
+ aria-label="Drag ${y(e.label)}"
1552
1560
  >
1553
1561
  <svg viewBox="0 0 16 16" aria-hidden="true" focusable="false">
1554
1562
  <circle cx="5" cy="4" r="1.25"></circle>
@@ -1560,13 +1568,13 @@ class ce extends ee {
1560
1568
  </svg>
1561
1569
  </button>
1562
1570
  ` : ""}
1563
- <div class="item-content" data-action="select" data-id="${l}">
1564
- <div class="item-custom-content" part="item-custom-content" data-item-content-target="${l}"></div>
1571
+ <div class="item-content" data-action="select" data-id="${d}">
1572
+ <div class="item-custom-content" part="item-custom-content" data-item-content-target="${d}"></div>
1565
1573
  <div class="item-default-content">
1566
- <div class="item-title">${I(e.label)}</div>
1567
- ${e.description ? `<div class="item-description">${I(e.description)}</div>` : ""}
1574
+ <div class="item-title">${y(e.label)}</div>
1575
+ ${e.description ? `<div class="item-description">${y(e.description)}</div>` : ""}
1568
1576
  <div class="item-meta">
1569
- <span class="item-badge selection-badge" data-selection-badge="true" ${g && a ? "" : "hidden"}>${g && a ? "Selected" : ""}</span>
1577
+ <span class="item-badge selection-badge" data-selection-badge="true" ${h && a ? "" : "hidden"}>${h && a ? "Selected" : ""}</span>
1570
1578
  ${e.cloneOnDrag ? '<span class="item-badge">Clone on drag</span>' : ""}
1571
1579
  ${e.dragDisabled ? '<span class="item-badge">Pinned</span>' : ""}
1572
1580
  ${s ? '<span class="item-badge drop-badge">Nest here</span>' : ""}
@@ -1575,81 +1583,80 @@ class ce extends ee {
1575
1583
  </div>
1576
1584
  `}
1577
1585
  </article>
1578
- ${s && !n ? this._renderDropzone({
1586
+ ${s && !o ? this._renderDropzone({
1579
1587
  listId: e.listId,
1580
1588
  parentId: e.id,
1581
1589
  beforeId: null,
1582
1590
  mode: "inside"
1583
1591
  }, "Nest here") : ""}
1584
- ${c ? `<div class="children">${d}</div>` : ""}
1592
+ ${c ? `<div class="children">${u}</div>` : ""}
1585
1593
  </div>
1586
1594
  `;
1587
1595
  }
1588
- _renderDropzone(e, r) {
1589
- var i;
1590
- const t = ((i = this._dragState) == null ? void 0 : i.dropTarget) && this._dragState.dropTarget.listId === e.listId && this._dragState.dropTarget.parentId === e.parentId && this._dragState.dropTarget.beforeId === e.beforeId && this._dragState.dropTarget.mode === e.mode;
1596
+ _renderDropzone(e, t) {
1597
+ const r = this._dragState?.dropTarget && this._dragState.dropTarget.listId === e.listId && this._dragState.dropTarget.parentId === e.parentId && this._dragState.dropTarget.beforeId === e.beforeId && this._dragState.dropTarget.mode === e.mode;
1591
1598
  return `
1592
1599
  <div
1593
1600
  class="dropzone"
1594
1601
  part="dropzone"
1595
- data-list-id="${I(e.listId)}"
1596
- data-parent-id="${I(e.parentId ?? "")}"
1597
- data-before-id="${I(e.beforeId ?? "")}"
1602
+ data-list-id="${y(e.listId)}"
1603
+ data-parent-id="${y(e.parentId ?? "")}"
1604
+ data-before-id="${y(e.beforeId ?? "")}"
1598
1605
  data-mode="${e.mode}"
1599
- data-active="${t ? "true" : "false"}"
1606
+ data-active="${r ? "true" : "false"}"
1600
1607
  aria-hidden="true"
1601
1608
  >
1602
- <span class="dropzone-label">${I(r)}</span>
1609
+ <span class="dropzone-label">${y(t)}</span>
1603
1610
  </div>
1604
1611
  `;
1605
1612
  }
1606
1613
  _onClick(e) {
1607
- const r = e.composedPath(), t = r.find((n) => {
1608
- var d;
1609
- return n instanceof HTMLElement && ((d = n.classList) == null ? void 0 : d.contains("toolbar"));
1610
- }), i = this._dragActivatorFromPath(r), s = r.find((n) => n instanceof HTMLElement && n.classList.contains("item"));
1611
- if (i && i.kind !== "item")
1612
- return;
1614
+ const t = e.composedPath(), r = t.find((o) => o instanceof HTMLElement && o.classList?.contains("toolbar")), i = this._dragActivatorFromPath(t), s = t.find((o) => o instanceof HTMLElement && o.classList.contains("item"));
1615
+ if (i && i.kind !== "item") return;
1613
1616
  if (!s)
1614
- return t && !(e.target instanceof HTMLButtonElement), void 0;
1615
- const o = s.getAttribute("data-id");
1616
- if (!o)
1617
- return;
1618
- const a = this._items.find((n) => n.id === o);
1619
- if (!a || a.disabled)
1620
- return;
1621
- const l = e;
1622
- if (l.shiftKey ? this._selectRangeTo(o) : l.metaKey || l.ctrlKey ? this._toggleSelection(o) : this._setSelection([o], "pointer"), this._focusedId = o, this._rangeAnchorId = o, this._pendingFocusId = o, this._hasCustomItemRendering()) {
1617
+ return r && !(e.target instanceof HTMLButtonElement), void 0;
1618
+ const n = s.getAttribute("data-id");
1619
+ if (!n) return;
1620
+ const a = this._items.find((o) => o.id === n);
1621
+ if (!a || a.disabled) return;
1622
+ const d = e;
1623
+ if (d.shiftKey ? this._selectRangeTo(n) : d.metaKey || d.ctrlKey ? this._toggleSelection(n) : this._setSelection([n], "pointer"), this._focusedId = n, this._rangeAnchorId = n, this._pendingFocusId = n, this._hasCustomItemRendering()) {
1623
1624
  this._syncSelectionVisualState(), this._restorePendingFocus();
1624
1625
  return;
1625
1626
  }
1626
1627
  this.requestRender();
1627
1628
  }
1628
1629
  _onFocusIn(e) {
1629
- const r = e.composedPath().find((i) => i instanceof HTMLElement && i.classList.contains("item")), t = r == null ? void 0 : r.getAttribute("data-id");
1630
- t && (this._focusedId = t, this._syncSelectionVisualState());
1630
+ const r = e.composedPath().find((i) => i instanceof HTMLElement && i.classList.contains("item"))?.getAttribute("data-id");
1631
+ r && (this._focusedId = r, this._syncSelectionVisualState());
1632
+ }
1633
+ // Keys typed into a control that lives inside an item (an <input> or <button> in a custom card)
1634
+ // belong to that control: swallowing Space/Enter/arrows there made it impossible to type a space
1635
+ // or press the button from the keyboard. The drag handle is part of the item, not a foreign control.
1636
+ _isForeignControl(e) {
1637
+ const t = e.composedPath()[0];
1638
+ return !(t instanceof HTMLElement) || t.classList.contains("handle") || t.classList.contains("item") ? !1 : t.isContentEditable || t.matches('input, textarea, select, button, summary, a[href], [role="button"], [role="textbox"], [role="combobox"]');
1631
1639
  }
1632
1640
  _onKeyDown(e) {
1633
- var l;
1634
- const r = this._visibleItemIds();
1635
- if (!r.length)
1636
- return;
1637
- const t = this._focusedId && r.includes(this._focusedId) ? this._focusedId : r[0], i = r.indexOf(t), s = this._items.find((n) => n.id === t), o = s ? this._lists.find((n) => n.id === s.listId) : null, a = (o == null ? void 0 : o.orientation) === "horizontal";
1638
- if (!((l = this._dragState) != null && l.keyboard)) {
1639
- if (e.key === "ArrowDown" && !a || e.key === "ArrowRight" && a) {
1640
- e.preventDefault(), this._moveFocusBy(r, i, 1);
1641
+ if (this._isForeignControl(e)) return;
1642
+ const t = this._visibleItemIds();
1643
+ if (!t.length) return;
1644
+ const r = this._focusedId && t.includes(this._focusedId) ? this._focusedId : t[0], i = t.indexOf(r), s = this._items.find((c) => c.id === r), a = (s ? this._lists.find((c) => c.id === s.listId) : null)?.orientation === "horizontal", d = this._isRtl(), o = a ? d ? "ArrowLeft" : "ArrowRight" : "ArrowDown", u = a ? d ? "ArrowRight" : "ArrowLeft" : "ArrowUp";
1645
+ if (!this._dragState?.keyboard) {
1646
+ if (e.key === o) {
1647
+ e.preventDefault(), this._moveFocusBy(t, i, 1);
1641
1648
  return;
1642
1649
  }
1643
- if (e.key === "ArrowUp" && !a || e.key === "ArrowLeft" && a) {
1644
- e.preventDefault(), this._moveFocusBy(r, i, -1);
1650
+ if (e.key === u) {
1651
+ e.preventDefault(), this._moveFocusBy(t, i, -1);
1645
1652
  return;
1646
1653
  }
1647
1654
  if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "a") {
1648
- e.preventDefault(), this._setSelection(r, "keyboard"), this._announce(`${r.length} items selected.`);
1655
+ e.preventDefault(), this._setSelection(t, "keyboard"), this._announce(`${t.length} items selected.`);
1649
1656
  return;
1650
1657
  }
1651
1658
  if (e.key === "Enter") {
1652
- e.preventDefault(), this._setSelection([t], "keyboard");
1659
+ e.preventDefault(), this._setSelection([r], "keyboard");
1653
1660
  return;
1654
1661
  }
1655
1662
  if (e.key === " " || e.code === "Space") {
@@ -1657,21 +1664,20 @@ class ce extends ee {
1657
1664
  this._announce("Dragging is disabled right now.");
1658
1665
  return;
1659
1666
  }
1660
- const n = this._selectedRootIds(t);
1661
- if (!n.length)
1662
- return;
1663
- const d = this._itemClonesOnDrag(t);
1667
+ const c = this._selectedRootIds(r);
1668
+ if (!c.length) return;
1669
+ const h = this._itemClonesOnDrag(r);
1664
1670
  this._dragState = {
1665
1671
  snapshot: this._items.map(P),
1666
- movedRootIds: n,
1667
- originId: t,
1668
- clone: d,
1672
+ movedRootIds: c,
1673
+ originId: r,
1674
+ clone: h,
1669
1675
  keyboard: !0,
1670
- dropTarget: this._initialKeyboardDropTarget(t),
1676
+ dropTarget: this._initialKeyboardDropTarget(r),
1671
1677
  committed: !1
1672
1678
  };
1673
- const c = n.length === 1 ? `Lifted ${(s == null ? void 0 : s.label) || "item"}.` : `Lifted ${n.length} items.`;
1674
- this._announce(`${c} Use arrow keys to choose a destination.`), this.requestRender();
1679
+ const f = c.length === 1 ? `Lifted ${s?.label || "item"}.` : `Lifted ${c.length} items.`;
1680
+ this._announce(`${f} Use arrow keys to choose a destination.`), this.requestRender();
1675
1681
  return;
1676
1682
  }
1677
1683
  if (e.key === "Escape") {
@@ -1686,25 +1692,28 @@ class ce extends ee {
1686
1692
  }
1687
1693
  if (e.key === "Enter" || e.key === " " || e.code === "Space") {
1688
1694
  e.preventDefault();
1689
- const n = this._dragState.dropTarget;
1690
- if (!n)
1691
- return;
1692
- this._commitMove(n, this._dragState.movedRootIds, this._dragState.clone, "keyboard");
1695
+ const c = this._dragState.dropTarget;
1696
+ if (!c) return;
1697
+ this._commitMove(c, this._dragState.movedRootIds, this._dragState.clone, "keyboard");
1693
1698
  return;
1694
1699
  }
1695
1700
  if (["ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight"].includes(e.key)) {
1696
1701
  e.preventDefault();
1697
- const n = e.key === "ArrowDown" || e.key === "ArrowRight" ? 1 : -1;
1698
- this._moveKeyboardDropTarget(n);
1702
+ const c = d ? "ArrowLeft" : "ArrowRight", h = e.key === "ArrowDown" || e.key === c ? 1 : -1;
1703
+ this._moveKeyboardDropTarget(h);
1699
1704
  }
1700
1705
  }
1701
- _moveFocusBy(e, r, t) {
1702
- const i = Math.max(0, Math.min(e.length - 1, r + t)), s = e[i];
1706
+ _isRtl() {
1707
+ const e = this.ownerDocument?.defaultView?.getComputedStyle(this).direction;
1708
+ return e ? e === "rtl" : this.closest("[dir]")?.getAttribute("dir") === "rtl";
1709
+ }
1710
+ _moveFocusBy(e, t, r) {
1711
+ const i = Math.max(0, Math.min(e.length - 1, t + r)), s = e[i];
1703
1712
  this._focusedId = s, this._pendingFocusId = s, !this._applyInteractiveStateInPlace({ restoreFocus: !0 }) && this.requestRender();
1704
1713
  }
1705
1714
  _onDragStart(e) {
1706
- const r = this._dragActivatorFromPath(e.composedPath()), t = r == null ? void 0 : r.id;
1707
- if (!r || !t) {
1715
+ const t = this._dragActivatorFromPath(e.composedPath()), r = t?.id;
1716
+ if (!t || !r) {
1708
1717
  e.preventDefault();
1709
1718
  return;
1710
1719
  }
@@ -1712,106 +1721,101 @@ class ce extends ee {
1712
1721
  e.preventDefault(), this._announce("Dragging is disabled right now.");
1713
1722
  return;
1714
1723
  }
1715
- const i = this._items.find((a) => a.id === t);
1724
+ const i = this._items.find((a) => a.id === r);
1716
1725
  if (!i || i.disabled || i.dragDisabled) {
1717
1726
  e.preventDefault();
1718
1727
  return;
1719
1728
  }
1720
- const s = this._selection.includes(t) ? this._selectedRootIds(t) : [t];
1721
- this._selection.includes(t) || this._setSelection([t], "pointer");
1722
- const o = this._itemClonesOnDrag(t);
1729
+ const s = this._selection.includes(r) ? this._selectedRootIds(r) : [r];
1730
+ this._selection.includes(r) || this._setSelection([r], "pointer");
1731
+ const n = this._itemClonesOnDrag(r);
1723
1732
  this._dragState = {
1724
1733
  snapshot: this._items.map(P),
1725
1734
  movedRootIds: s,
1726
- originId: t,
1727
- clone: o,
1735
+ originId: r,
1736
+ clone: n,
1728
1737
  keyboard: !1,
1729
1738
  dropTarget: null,
1730
1739
  committed: !1
1731
- }, e.dataTransfer && (e.dataTransfer.effectAllowed = o ? "copyMove" : "move", e.dataTransfer.setData("text/plain", s.join(",")), this._applyDragImage(e.dataTransfer, s.length)), this._announce(
1732
- o ? `Dragging ${s.length === 1 ? i.label : `${s.length} items`} as a copy.` : `Dragging ${s.length === 1 ? i.label : `${s.length} items`}.`
1740
+ }, e.dataTransfer && (e.dataTransfer.effectAllowed = n ? "copyMove" : "move", e.dataTransfer.setData("text/plain", s.join(",")), this._applyDragImage(e.dataTransfer, s.length)), this._announce(
1741
+ n ? `Dragging ${s.length === 1 ? i.label : `${s.length} items`} as a copy.` : `Dragging ${s.length === 1 ? i.label : `${s.length} items`}.`
1733
1742
  ), this.requestRender();
1734
1743
  }
1735
1744
  _onDragOver(e) {
1736
- if (!this._dragState || this._dragState.keyboard)
1737
- return;
1738
- const r = this._dropTargetFromEvent(e);
1739
- if (!r || !this._canDrop(r, this._dragState.movedRootIds)) {
1745
+ if (!this._dragState || this._dragState.keyboard) return;
1746
+ const t = this._dropTargetFromEvent(e);
1747
+ if (!t || !this._canDrop(t, this._dragState.movedRootIds)) {
1740
1748
  this._queueDropTarget(null, e.timeStamp);
1741
1749
  return;
1742
1750
  }
1743
- e.preventDefault(), this._queueDropTarget(r, e.timeStamp), e.dataTransfer && (e.dataTransfer.dropEffect = this._dragState.clone ? "copy" : "move");
1751
+ e.preventDefault(), this._queueDropTarget(t, e.timeStamp), e.dataTransfer && (e.dataTransfer.dropEffect = this._dragState.clone ? "copy" : "move");
1744
1752
  }
1745
1753
  _onDrop(e) {
1746
- if (!this._dragState || this._dragState.keyboard)
1747
- return;
1748
- const r = this._dropTargetFromEvent(e);
1749
- !r || !this._canDrop(r, this._dragState.movedRootIds) || (e.preventDefault(), this._commitMove(r, this._dragState.movedRootIds, this._dragState.clone, "pointer"));
1754
+ if (!this._dragState || this._dragState.keyboard) return;
1755
+ const t = this._dropTargetFromEvent(e);
1756
+ !t || !this._canDrop(t, this._dragState.movedRootIds) || (e.preventDefault(), this._commitMove(t, this._dragState.movedRootIds, this._dragState.clone, "pointer"));
1750
1757
  }
1751
1758
  _onDocumentKeyDown(e) {
1752
1759
  e.key === "Escape" && (!this._dragState || this._dragState.keyboard || (e.preventDefault(), this._cancelDrag(!0)));
1753
1760
  }
1754
1761
  _onDragEnd() {
1755
- !this._dragState || this._dragState.keyboard || this._dragState.committed || (this._pendingDropTarget = null, this._setDropTargetVisualState(this._dragState.dropTarget, !1), this._clearPointerDragPreview(), this._dragState = null, this._removeDragImage(), this._announce("Drag cancelled."), this.requestRender());
1762
+ !this._dragState || this._dragState.keyboard || this._dragState.committed || (this._setDraggingVisualState(this._draggingIds(), !1), this._pendingDropTarget = null, this._setDropTargetVisualState(this._dragState.dropTarget, !1), this._clearPointerDragPreview(), this._dragState = null, this._removeDragImage(), this._announce("Drag cancelled."), this.requestRender());
1756
1763
  }
1757
1764
  _dropTargetFromEvent(e) {
1758
1765
  return this._dropTargetFromPath(e.composedPath(), e.clientX, e.clientY);
1759
1766
  }
1760
- _dropTargetFromPath(e, r, t) {
1761
- const i = e.find((_) => _ instanceof HTMLElement && _.classList.contains("dropzone"));
1767
+ _dropTargetFromPath(e, t, r) {
1768
+ const i = e.find((S) => S instanceof HTMLElement && S.classList.contains("dropzone"));
1762
1769
  if (i) {
1763
- const _ = {
1770
+ const S = {
1764
1771
  listId: i.getAttribute("data-list-id") || "",
1765
1772
  parentId: i.getAttribute("data-parent-id") || null,
1766
1773
  beforeId: i.getAttribute("data-before-id") || null,
1767
1774
  mode: i.getAttribute("data-mode") === "inside" ? "inside" : "before"
1768
1775
  };
1769
- if (_.listId)
1770
- return _;
1776
+ if (S.listId) return S;
1771
1777
  }
1772
- const s = e.find((_) => _ instanceof HTMLElement && _.classList.contains("item"));
1773
- if (!s)
1774
- return null;
1775
- const o = s.getAttribute("data-id");
1776
- if (!o)
1777
- return null;
1778
- const a = this._items.find((_) => _.id === o);
1779
- if (!a)
1780
- return null;
1781
- const l = this._lists.find((_) => _.id === a.listId), n = s.getBoundingClientRect(), d = (l == null ? void 0 : l.orientation) === "horizontal", c = d ? n.left : n.top, g = d ? n.right : n.bottom, m = d ? r : t, f = Math.max(1, g - c), v = (m - c) / f, b = this.getAttribute("allow-nesting") !== "false" && !a.disabled;
1782
- if (v <= 0.34)
1778
+ const s = e.find((S) => S instanceof HTMLElement && S.classList.contains("item"));
1779
+ if (!s) {
1780
+ const R = e.find(
1781
+ ($) => $ instanceof HTMLElement && $.classList.contains("list") && $.hasAttribute("data-list-id")
1782
+ )?.getAttribute("data-list-id");
1783
+ return R ? { listId: R, parentId: null, beforeId: null, mode: "before" } : null;
1784
+ }
1785
+ const n = s.getAttribute("data-id");
1786
+ if (!n) return null;
1787
+ const a = this._items.find((S) => S.id === n);
1788
+ if (!a) return null;
1789
+ const d = this._lists.find((S) => S.id === a.listId), o = s.getBoundingClientRect(), u = d?.orientation === "horizontal", c = u ? o.left : o.top, h = u ? o.right : o.bottom, f = u ? t : r, _ = Math.max(1, h - c), I = (f - c) / _, m = u && this._isRtl() ? 1 - I : I, v = this.getAttribute("allow-nesting") !== "false" && !a.disabled;
1790
+ if (m <= 0.34)
1783
1791
  return {
1784
1792
  listId: a.listId,
1785
1793
  parentId: a.parentId,
1786
1794
  beforeId: a.id,
1787
1795
  mode: "before"
1788
1796
  };
1789
- if (b && v >= 0.34 && v <= 0.74)
1797
+ if (v && m >= 0.34 && m <= 0.74)
1790
1798
  return {
1791
1799
  listId: a.listId,
1792
1800
  parentId: a.id,
1793
1801
  beforeId: null,
1794
1802
  mode: "inside"
1795
1803
  };
1796
- const w = E(this._items).get(z(a.listId, a.parentId)) || [], k = w.indexOf(a.id), A = k >= 0 && w[k + 1] || null;
1804
+ const A = E(this._items).get(k(a.listId, a.parentId)) || [], z = A.indexOf(a.id), b = z >= 0 && A[z + 1] || null;
1797
1805
  return {
1798
1806
  listId: a.listId,
1799
1807
  parentId: a.parentId,
1800
- beforeId: A,
1808
+ beforeId: b,
1801
1809
  mode: "before"
1802
1810
  };
1803
1811
  }
1804
- _dropTargetFromPoint(e, r) {
1805
- return this._dropTargetFromPath(this._pathFromPoint(e, r), e, r);
1812
+ _dropTargetFromPoint(e, t) {
1813
+ return this._dropTargetFromPath(this._pathFromPoint(e, t), e, t);
1806
1814
  }
1807
- _beginPointerDrag(e, r) {
1808
- if (!this._pointerGesture || this._dragState)
1809
- return;
1810
- const t = this._items.find((i) => {
1811
- var s;
1812
- return i.id === ((s = this._pointerGesture) == null ? void 0 : s.originId);
1813
- });
1814
- t && (this._dragState = {
1815
+ _beginPointerDrag(e, t) {
1816
+ if (!this._pointerGesture || this._dragState) return;
1817
+ const r = this._items.find((i) => i.id === this._pointerGesture?.originId);
1818
+ r && (this._dragState = {
1815
1819
  snapshot: this._items.map(P),
1816
1820
  movedRootIds: [...this._pointerGesture.movedRootIds],
1817
1821
  originId: this._pointerGesture.originId,
@@ -1821,92 +1825,94 @@ class ce extends ee {
1821
1825
  committed: !1
1822
1826
  }, this._pendingDropTarget = null, this._applyPointerPreview(
1823
1827
  e,
1824
- r,
1828
+ t,
1825
1829
  this._dragState.movedRootIds.length,
1826
1830
  this._dragState.clone
1827
1831
  ), this._setDraggingVisualState(this._draggingIds(), !0), this._announce(
1828
- this._dragState.clone ? `Dragging ${this._dragState.movedRootIds.length === 1 ? t.label : `${this._dragState.movedRootIds.length} items`} as a copy.` : `Dragging ${this._dragState.movedRootIds.length === 1 ? t.label : `${this._dragState.movedRootIds.length} items`}.`
1832
+ this._dragState.clone ? `Dragging ${this._dragState.movedRootIds.length === 1 ? r.label : `${this._dragState.movedRootIds.length} items`} as a copy.` : `Dragging ${this._dragState.movedRootIds.length === 1 ? r.label : `${this._dragState.movedRootIds.length} items`}.`
1829
1833
  ));
1830
1834
  }
1831
1835
  _onPointerDown(e) {
1832
- var o, a;
1833
- const r = this._dragActivatorFromPath(e.composedPath()), t = r == null ? void 0 : r.id;
1834
- if (!r || !t)
1835
- return;
1836
+ const t = this._dragActivatorFromPath(e.composedPath()), r = t?.id;
1837
+ if (!t || !r) return;
1836
1838
  if (this._isDragLocked()) {
1837
1839
  e.preventDefault(), this._announce("Dragging is disabled right now.");
1838
1840
  return;
1839
1841
  }
1840
- const i = this._items.find((l) => l.id === t);
1842
+ const i = this._items.find((n) => n.id === r);
1841
1843
  if (!i || i.disabled || i.dragDisabled) {
1842
1844
  e.preventDefault();
1843
1845
  return;
1844
1846
  }
1845
1847
  e.preventDefault();
1846
1848
  try {
1847
- (a = (o = r.element).setPointerCapture) == null || a.call(o, e.pointerId);
1849
+ t.element.setPointerCapture?.(e.pointerId);
1848
1850
  } catch {
1849
1851
  }
1850
- const s = this._selection.includes(t) ? this._selectedRootIds(t) : [t];
1852
+ const s = this._selection.includes(r) ? this._selectedRootIds(r) : [r];
1851
1853
  this._pointerGesture = {
1852
1854
  pointerId: e.pointerId,
1853
1855
  pointerType: e.pointerType,
1854
- originId: t,
1856
+ originId: r,
1855
1857
  movedRootIds: s,
1856
- clone: this._itemClonesOnDrag(t),
1858
+ clone: this._itemClonesOnDrag(r),
1857
1859
  startX: e.clientX,
1858
1860
  startY: e.clientY,
1859
1861
  moved: !1,
1860
- captureTarget: r.element
1862
+ captureTarget: t.element
1861
1863
  };
1862
1864
  }
1863
1865
  _onPointerMove(e) {
1864
1866
  if (!(!this._pointerGesture || e.pointerId !== this._pointerGesture.pointerId)) {
1865
1867
  if (e.preventDefault(), !this._pointerGesture.moved) {
1866
- if (Math.hypot(e.clientX - this._pointerGesture.startX, e.clientY - this._pointerGesture.startY) < 6)
1867
- return;
1868
+ if (Math.hypot(e.clientX - this._pointerGesture.startX, e.clientY - this._pointerGesture.startY) < 6) return;
1868
1869
  this._pointerGesture.moved = !0, this._beginPointerDrag(e.clientX, e.clientY);
1869
1870
  }
1870
- if (!(!this._dragState || this._dragState.keyboard) && (this._movePointerPreview(e.clientX, e.clientY), !this._dragState.committed)) {
1871
- const r = this._dropTargetFromPoint(e.clientX, e.clientY);
1872
- if (!r || !this._canDrop(r, this._dragState.movedRootIds)) {
1871
+ if (!(!this._dragState || this._dragState.keyboard) && (this._movePointerPreview(e.clientX, e.clientY), this._updateAutoScroll(e.clientX, e.clientY), !this._dragState.committed)) {
1872
+ const t = this._dropTargetFromPoint(e.clientX, e.clientY);
1873
+ if (!t || !this._canDrop(t, this._dragState.movedRootIds)) {
1873
1874
  this._queueDropTarget(null, e.timeStamp);
1874
1875
  return;
1875
1876
  }
1876
- this._queueDropTarget(r, e.timeStamp);
1877
+ this._queueDropTarget(t, e.timeStamp);
1877
1878
  }
1878
1879
  }
1879
1880
  }
1881
+ // Holding a dragged card near the top or bottom edge scrolls the page (or the nearest scrolling
1882
+ // container), so lists and positions that are off screen can be reached with the pointer.
1883
+ _updateAutoScroll(e, t) {
1884
+ this._autoScrollPoint = { x: e, y: t }, !this._autoScrollFrame && typeof requestAnimationFrame == "function" && (this._autoScrollFrame = requestAnimationFrame(this._autoScrollTick));
1885
+ }
1886
+ _stopAutoScroll() {
1887
+ this._autoScrollFrame && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(this._autoScrollFrame), this._autoScrollFrame = 0, this._autoScrollPoint = null;
1888
+ }
1880
1889
  _onPointerUp(e) {
1881
- var i, s;
1882
- if (!this._pointerGesture || e.pointerId !== this._pointerGesture.pointerId)
1883
- return;
1890
+ if (!this._pointerGesture || e.pointerId !== this._pointerGesture.pointerId) return;
1884
1891
  e.preventDefault();
1885
1892
  try {
1886
- (s = (i = this._pointerGesture.captureTarget) == null ? void 0 : i.releasePointerCapture) == null || s.call(i, e.pointerId);
1893
+ this._pointerGesture.captureTarget?.releasePointerCapture?.(e.pointerId);
1887
1894
  } catch {
1888
1895
  }
1889
- const r = this._pointerGesture;
1890
- if (this._pointerGesture = null, !this._dragState || this._dragState.keyboard)
1891
- return;
1892
- const t = r.moved ? this._releaseDropTarget(e.clientX, e.clientY) : null;
1893
- if (r.moved && t) {
1894
- this._commitMove(t, this._dragState.movedRootIds, this._dragState.clone, "pointer");
1896
+ const t = this._pointerGesture;
1897
+ if (this._pointerGesture = null, this._stopAutoScroll(), !this._dragState || this._dragState.keyboard) return;
1898
+ const r = t.moved ? this._releaseDropTarget(e.clientX, e.clientY) : null;
1899
+ if (t.moved && r) {
1900
+ this._commitMove(r, this._dragState.movedRootIds, this._dragState.clone, "pointer");
1895
1901
  return;
1896
1902
  }
1897
- r.moved ? this._cancelDrag(!0) : (this._setDropTargetVisualState(this._dragState.dropTarget, !1), this._clearPointerDragPreview(), this._dragState = null, this._removeDragImage(), this.requestRender());
1903
+ t.moved ? this._cancelDrag(!0) : (this._setDropTargetVisualState(this._dragState.dropTarget, !1), this._clearPointerDragPreview(), this._dragState = null, this._removeDragImage(), this.requestRender());
1898
1904
  }
1899
1905
  _onPointerCancel(e) {
1900
- !this._pointerGesture || e.pointerId !== this._pointerGesture.pointerId || (this._pointerGesture = null, this._dragState && this._cancelDrag(!0));
1906
+ !this._pointerGesture || e.pointerId !== this._pointerGesture.pointerId || (this._pointerGesture = null, this._stopAutoScroll(), this._dragState && this._cancelDrag(!0));
1901
1907
  }
1902
- _setSelection(e, r) {
1903
- const t = new Set(this._items.map((a) => a.id)), i = Array.from(new Set(e.filter((a) => t.has(a)))), s = [...this._selection];
1908
+ _setSelection(e, t) {
1909
+ const r = new Set(this._items.map((a) => a.id)), i = Array.from(new Set(e.filter((a) => r.has(a)))), s = [...this._selection];
1904
1910
  this._selection = i, this._rangeAnchorId = i[i.length - 1] || null, this._focusedId = i[i.length - 1] || this._focusedId;
1905
- const o = j(i);
1906
- if (this.getAttribute("selection") !== o) {
1907
- this._lastSelectionAttr = o, this._suppressAttributeRender = !0;
1911
+ const n = X(i);
1912
+ if (this.getAttribute("selection") !== n) {
1913
+ this._lastSelectionAttr = n, this._suppressAttributeRender = !0;
1908
1914
  try {
1909
- i.length ? this.setAttribute("selection", o) : this.removeAttribute("selection");
1915
+ i.length ? this.setAttribute("selection", n) : this.removeAttribute("selection");
1910
1916
  } finally {
1911
1917
  this._suppressAttributeRender = !1;
1912
1918
  }
@@ -1918,176 +1924,154 @@ class ce extends ee {
1918
1924
  },
1919
1925
  bubbles: !0,
1920
1926
  composed: !0
1921
- })), r !== "restore") {
1922
- if (this._applyInteractiveStateInPlace({ restoreFocus: !0 }))
1923
- return;
1927
+ })), t !== "restore") {
1928
+ if (this._applyInteractiveStateInPlace({ restoreFocus: !0 })) return;
1924
1929
  this.requestRender();
1925
1930
  }
1926
1931
  }
1927
1932
  _toggleSelection(e) {
1928
- const r = this._selection.includes(e) ? this._selection.filter((t) => t !== e) : [...this._selection, e];
1929
- this._setSelection(r, "pointer"), this._announce(`${r.length} items selected.`);
1933
+ const t = this._selection.includes(e) ? this._selection.filter((r) => r !== e) : [...this._selection, e];
1934
+ this._setSelection(t, "pointer"), this._announce(`${t.length} items selected.`);
1930
1935
  }
1931
1936
  _selectRangeTo(e) {
1932
- const r = this._visibleItemIds(), t = this._rangeAnchorId || this._focusedId || e, i = r.indexOf(t), s = r.indexOf(e);
1937
+ const t = this._visibleItemIds(), r = this._rangeAnchorId || this._focusedId || e, i = t.indexOf(r), s = t.indexOf(e);
1933
1938
  if (i < 0 || s < 0) {
1934
1939
  this._setSelection([e], "pointer");
1935
1940
  return;
1936
1941
  }
1937
- const [o, a] = i <= s ? [i, s] : [s, i];
1938
- this._setSelection(r.slice(o, a + 1), "pointer"), this._announce(`${a - o + 1} items selected.`);
1942
+ const [n, a] = i <= s ? [i, s] : [s, i];
1943
+ this._setSelection(t.slice(n, a + 1), "pointer"), this._announce(`${a - n + 1} items selected.`);
1939
1944
  }
1940
1945
  _visibleItemIds() {
1941
1946
  const e = Q(this._items, new Set(this._selection), new Set(this._draggingIds()), this.filterQuery, this.sort);
1942
- return Array.from(e.values()).flat().filter((r) => !r.disabled).map((r) => r.id);
1947
+ return Array.from(e.values()).flat().filter((t) => !t.disabled).map((t) => t.id);
1943
1948
  }
1944
1949
  _selectedRootIds(e) {
1945
- const r = this._selection.length ? [...this._selection] : e ? [e] : [], t = M(this._items), i = new Set(r);
1946
- return r.filter((s) => {
1947
- var l;
1948
- const o = t.get(s);
1949
- if (!o)
1950
- return !1;
1951
- let a = o.parentId;
1950
+ const t = this._selection.length ? [...this._selection] : e ? [e] : [], r = T(this._items), i = new Set(t);
1951
+ return t.filter((s) => {
1952
+ const n = r.get(s);
1953
+ if (!n) return !1;
1954
+ let a = n.parentId;
1952
1955
  for (; a; ) {
1953
- if (i.has(a))
1954
- return !1;
1955
- a = ((l = t.get(a)) == null ? void 0 : l.parentId) ?? null;
1956
+ if (i.has(a)) return !1;
1957
+ a = r.get(a)?.parentId ?? null;
1956
1958
  }
1957
- return !o.disabled;
1959
+ return !n.disabled;
1958
1960
  });
1959
1961
  }
1960
1962
  _draggingIds() {
1961
- if (!this._dragState)
1962
- return [];
1963
- const e = M(this._items), r = E(this._items), t = [], i = (s) => {
1964
- t.push(s);
1965
- const o = e.get(s);
1966
- if (!o)
1967
- return;
1968
- (r.get(z(o.listId, s)) || []).forEach(i);
1963
+ if (!this._dragState) return [];
1964
+ const e = T(this._items), t = E(this._items), r = [], i = (s) => {
1965
+ r.push(s);
1966
+ const n = e.get(s);
1967
+ if (!n) return;
1968
+ (t.get(k(n.listId, s)) || []).forEach(i);
1969
1969
  };
1970
- return this._dragState.movedRootIds.forEach(i), t;
1970
+ return this._dragState.movedRootIds.forEach(i), r;
1971
1971
  }
1972
1972
  _itemClonesOnDrag(e) {
1973
- const r = this._items.find((i) => i.id === e);
1974
- if (!r)
1975
- return !1;
1976
- if (r.cloneOnDrag)
1977
- return !0;
1978
- const t = this._lists.find((i) => i.id === r.listId);
1979
- return !!(t != null && t.cloneOnDrag);
1973
+ const t = this._items.find((i) => i.id === e);
1974
+ return t ? t.cloneOnDrag ? !0 : !!this._lists.find((i) => i.id === t.listId)?.cloneOnDrag : !1;
1980
1975
  }
1981
1976
  _isDragLocked() {
1982
1977
  return !!(this.hasAttribute("disabled") || this.sort !== "manual" || this.filterQuery && !this.hasAttribute("allow-filtered-drag"));
1983
1978
  }
1984
- _canDrop(e, r) {
1985
- var n;
1986
- if (this._isDragLocked())
1987
- return !1;
1988
- const t = this._lists.find((d) => d.id === e.listId);
1989
- if (!t || t.disabled)
1990
- return !1;
1991
- const i = M(this._items), s = /* @__PURE__ */ new Set(), o = E(this._items), a = (d) => {
1992
- s.add(d);
1993
- const c = i.get(d);
1994
- c && (o.get(z(c.listId, d)) || []).forEach(a);
1979
+ _canDrop(e, t) {
1980
+ if (this._isDragLocked()) return !1;
1981
+ const r = this._lists.find((o) => o.id === e.listId);
1982
+ if (!r || r.disabled) return !1;
1983
+ const i = T(this._items), s = /* @__PURE__ */ new Set(), n = E(this._items), a = (o) => {
1984
+ s.add(o);
1985
+ const u = i.get(o);
1986
+ u && (n.get(k(u.listId, o)) || []).forEach(a);
1995
1987
  };
1996
- if (r.forEach(a), e.parentId && s.has(e.parentId) || e.beforeId && s.has(e.beforeId))
1997
- return !1;
1998
- const l = Array.from(new Set(r.map((d) => {
1999
- var c;
2000
- return (c = i.get(d)) == null ? void 0 : c.listId;
2001
- }).filter(Boolean)));
2002
- return !((n = t.accepts) != null && n.length && l.some((d) => {
2003
- var c;
2004
- return !((c = t.accepts) != null && c.includes(d));
2005
- }) || e.mode === "inside" && this.getAttribute("allow-nesting") === "false");
2006
- }
2007
- _commitMove(e, r, t, i) {
2008
- if (!this._canDrop(e, r))
2009
- return;
2010
- const s = M(this._items), o = E(this._items), a = /* @__PURE__ */ new Set(), l = [], n = (p) => {
2011
- const D = s.get(p);
2012
- !D || a.has(p) || (a.add(p), l.push(p), (o.get(z(D.listId, p)) || []).forEach(n));
1988
+ if (t.forEach(a), e.parentId && s.has(e.parentId) || e.beforeId && s.has(e.beforeId)) return !1;
1989
+ const d = Array.from(new Set(t.map((o) => i.get(o)?.listId).filter(Boolean)));
1990
+ return !(r.accepts?.length && d.some((o) => !r.accepts?.includes(o)) || e.mode === "inside" && this.getAttribute("allow-nesting") === "false");
1991
+ }
1992
+ _commitMove(e, t, r, i) {
1993
+ if (!this._canDrop(e, t)) return;
1994
+ const s = T(this._items), n = E(this._items), a = /* @__PURE__ */ new Set(), d = [], o = (p) => {
1995
+ const w = s.get(p);
1996
+ !w || a.has(p) || (a.add(p), d.push(p), (n.get(k(w.listId, p)) || []).forEach(o));
2013
1997
  };
2014
- r.forEach(n);
2015
- const d = this._items.map(P), c = d.filter((p) => a.has(p.id)), g = t ? d.map(P) : d.filter((p) => !a.has(p.id)), m = t ? c.map((p) => this._cloneSubtreeItem(p, l)) : c.map(P), f = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map();
2016
- t && c.forEach((p, D) => {
2017
- f.set(p.id, m[D].id), v.set(m[D].id, p.id);
2018
- }), m.forEach((p) => {
2019
- const D = t ? v.get(p.id) : p.id, q = D ? s.get(D) : null;
2020
- q && (t && (p.parentId = q.parentId && f.has(q.parentId) && f.get(q.parentId) || null), p.listId = e.listId);
1998
+ t.forEach(o);
1999
+ const u = this._items.map(P), c = u.filter((p) => a.has(p.id)), h = r ? u.map(P) : u.filter((p) => !a.has(p.id)), f = r ? c.map((p) => this._cloneSubtreeItem(p, d)) : c.map(P), _ = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map();
2000
+ r && c.forEach((p, w) => {
2001
+ _.set(p.id, f[w].id), I.set(f[w].id, p.id);
2002
+ }), f.forEach((p) => {
2003
+ const w = r ? I.get(p.id) : p.id, F = w ? s.get(w) : null;
2004
+ F && (r && (p.parentId = F.parentId && _.has(F.parentId) && _.get(F.parentId) || null), p.listId = e.listId);
2021
2005
  });
2022
- const b = r.map((p) => f.get(p) || p), y = [...g, ...m], w = E(g), k = z(e.listId, e.parentId), A = [...w.get(k) || []], _ = e.beforeId ? A.indexOf(e.beforeId) : A.length, R = _ >= 0 ? _ : A.length;
2023
- A.splice(R, 0, ...b), w.set(k, A), E(m).forEach((p, D) => {
2024
- const [, q] = D.split("::");
2025
- (q || "") !== "__root__" && w.set(D, [...p]);
2006
+ const m = t.map((p) => _.get(p) || p), v = [...h, ...f], D = E(h), A = k(e.listId, e.parentId), z = [...D.get(A) || []], b = e.beforeId ? z.indexOf(e.beforeId) : z.length, S = b >= 0 ? b : z.length;
2007
+ z.splice(S, 0, ...m), D.set(A, z), E(f).forEach((p, w) => {
2008
+ const [, F] = w.split("::");
2009
+ (F || "") !== "__root__" && D.set(w, [...p]);
2026
2010
  });
2027
- const C = M(y);
2028
- b.forEach((p) => {
2029
- const D = C.get(p);
2030
- D && (D.parentId = e.parentId, D.listId = e.listId);
2011
+ const $ = T(v);
2012
+ m.forEach((p) => {
2013
+ const w = $.get(p);
2014
+ w && (w.parentId = e.parentId, w.listId = e.listId);
2031
2015
  });
2032
- const T = [], $ = /* @__PURE__ */ new Set(), L = (p, D) => {
2033
- (w.get(z(p, D)) || []).forEach((N, Z) => {
2034
- const H = C.get(N);
2035
- !H || $.has(N) || ($.add(N), H.listId = p, H.parentId = D, H.order = Z, T.push(H), L(p, N));
2016
+ const O = [], L = /* @__PURE__ */ new Set(), q = (p, w) => {
2017
+ (D.get(k(p, w)) || []).forEach((V, Z) => {
2018
+ const N = $.get(V);
2019
+ !N || L.has(V) || (L.add(V), N.listId = p, N.parentId = w, N.order = Z, O.push(N), q(p, V));
2036
2020
  });
2037
2021
  };
2038
- this._lists.forEach((p) => L(p.id, null)), y.forEach((p) => {
2039
- $.has(p.id) || (p.parentId = null, T.push(p));
2040
- }), this._dragState && (this._dragState.committed = !0), this._items = T.map(P), this._clearPointerDragPreview(), this._dragState = null, this._removeDragImage();
2041
- const G = [...b], h = [...this._selection];
2042
- this._selection = G, this._focusedId = G[0] || null, this._pendingFocusId = this._focusedId, this._syncAttributesFromState();
2022
+ this._lists.forEach((p) => q(p.id, null)), v.forEach((p) => {
2023
+ L.has(p.id) || (p.parentId = null, O.push(p));
2024
+ }), this._dragState && (this._dragState.committed = !0), this._items = O.map(P), this._clearPointerDragPreview(), this._dragState = null, this._removeDragImage();
2025
+ const H = [...m], g = [...this._selection];
2026
+ this._selection = H, this._focusedId = H[0] || null, this._pendingFocusId = this._focusedId, this._syncAttributesFromState();
2043
2027
  const x = J(this._items);
2044
2028
  this._persistSnapshot(x);
2045
- const F = r.map((p) => s.get(p)).filter((p) => !!p), O = t ? "clone" : e.mode === "inside" ? "nest" : F.some((p) => p.listId !== e.listId) ? "transfer" : "reorder", K = {
2029
+ const M = t.map((p) => s.get(p)).filter((p) => !!p), C = r ? "clone" : e.mode === "inside" ? "nest" : M.some((p) => p.listId !== e.listId) ? "transfer" : "reorder", G = {
2046
2030
  items: this.items,
2047
2031
  lists: this.lists,
2048
- selection: [...G],
2049
- previousSelection: h,
2050
- movedIds: [...b],
2032
+ selection: [...H],
2033
+ previousSelection: g,
2034
+ movedIds: [...m],
2051
2035
  source: i,
2052
- operation: O,
2036
+ operation: C,
2053
2037
  persistence: x
2054
2038
  };
2055
2039
  this.dispatchEvent(new CustomEvent("change", {
2056
- detail: K,
2040
+ detail: G,
2057
2041
  bubbles: !0,
2058
2042
  composed: !0
2059
2043
  })), this.dispatchEvent(new CustomEvent("persist-request", {
2060
- detail: K,
2044
+ detail: G,
2061
2045
  bubbles: !0,
2062
2046
  composed: !0
2063
- })), this._announce(this._messageForMove(O, b.length, e)), this.requestRender();
2047
+ })), this._announce(this._messageForMove(C, m.length, e)), this.requestRender();
2064
2048
  }
2065
2049
  _syncAttributesFromState() {
2066
- const e = le(this._lists), r = de(this._items), t = j(this._selection);
2067
- this._lastListsAttr = e, this._lastItemsAttr = r, this._lastSelectionAttr = t, this._suppressAttributeRender = !0;
2050
+ const e = pe(this._lists), t = ue(this._items), r = X(this._selection);
2051
+ this._lastListsAttr = e, this._lastItemsAttr = t, this._lastSelectionAttr = r, this._suppressAttributeRender = !0;
2068
2052
  try {
2069
- this.setAttribute("lists", e), this.setAttribute("items", r), this._selection.length ? this.setAttribute("selection", t) : this.removeAttribute("selection");
2053
+ this.setAttribute("lists", e), this.setAttribute("items", t), this._selection.length ? this.setAttribute("selection", r) : this.removeAttribute("selection");
2070
2054
  } finally {
2071
2055
  this._suppressAttributeRender = !1;
2072
2056
  }
2073
2057
  }
2074
- _cloneSubtreeItem(e, r) {
2075
- const i = `copy-${this._cloneSeed++}`, o = `${e.id.includes("--copy-") ? e.id.split("--copy-")[0] : e.id}--${i}`;
2058
+ _cloneSubtreeItem(e, t) {
2059
+ const i = `copy-${this._cloneSeed++}`, n = `${e.id.includes("--copy-") ? e.id.split("--copy-")[0] : e.id}--${i}`;
2076
2060
  return {
2077
2061
  ...e,
2078
- id: o,
2079
- label: r[0] === e.id ? `${e.label} copy` : e.label
2062
+ id: n,
2063
+ label: t[0] === e.id ? `${e.label} copy` : e.label
2080
2064
  };
2081
2065
  }
2082
- _messageForMove(e, r, t) {
2083
- const i = this._lists.find((o) => o.id === t.listId), s = (i == null ? void 0 : i.label) || t.listId;
2084
- return e === "clone" ? `${r === 1 ? "Item copied" : `${r} items copied`} into ${s}.` : e === "nest" ? `${r === 1 ? "Item nested" : `${r} items nested`} in ${s}.` : e === "transfer" ? `${r === 1 ? "Item moved" : `${r} items moved`} to ${s}.` : `${r === 1 ? "Item reordered" : `${r} items reordered`} in ${s}.`;
2066
+ _messageForMove(e, t, r) {
2067
+ const s = this._lists.find((n) => n.id === r.listId)?.label || r.listId;
2068
+ return e === "clone" ? `${t === 1 ? "Item copied" : `${t} items copied`} into ${s}.` : e === "nest" ? `${t === 1 ? "Item nested" : `${t} items nested`} in ${s}.` : e === "transfer" ? `${t === 1 ? "Item moved" : `${t} items moved`} to ${s}.` : `${t === 1 ? "Item reordered" : `${t} items reordered`} in ${s}.`;
2085
2069
  }
2086
2070
  _persistSnapshot(e) {
2087
- const r = this.getAttribute("persist-key");
2088
- if (r)
2071
+ const t = this.getAttribute("persist-key");
2072
+ if (t)
2089
2073
  try {
2090
- window.localStorage.setItem(r, JSON.stringify(e));
2074
+ window.localStorage.setItem(t, JSON.stringify(e));
2091
2075
  } catch {
2092
2076
  }
2093
2077
  }
@@ -2095,85 +2079,81 @@ class ce extends ee {
2095
2079
  this._liveMessage = e, this._applyLiveMessage();
2096
2080
  }
2097
2081
  _cancelDrag(e) {
2098
- this._dragState && (this._pendingDropTarget = null, this._setDropTargetVisualState(this._dragState.dropTarget, !1), this._clearPointerDragPreview(), this._items = this._dragState.snapshot.map(P), this._dragState = null, this._pointerGesture = null, this._removeDragImage(), e && this._announce("Drag cancelled."), this._syncAttributesFromState(), this.requestRender());
2082
+ this._stopAutoScroll(), this._dragState && (this._setDraggingVisualState(this._draggingIds(), !1), this._pendingDropTarget = null, this._setDropTargetVisualState(this._dragState.dropTarget, !1), this._clearPointerDragPreview(), this._items = this._dragState.snapshot.map(P), this._dragState = null, this._pointerGesture = null, this._removeDragImage(), e && this._announce("Drag cancelled."), this._syncAttributesFromState(), this.requestRender());
2099
2083
  }
2100
- _applyDragImage(e, r) {
2084
+ _applyDragImage(e, t) {
2101
2085
  this._removeDragImage();
2102
- const t = document.createElement("div");
2103
- t.textContent = r === 1 ? "Dragging item" : `Dragging ${r} items`, t.style.position = "fixed", t.style.top = "-999px", t.style.left = "-999px", t.style.padding = "8px 12px", t.style.borderRadius = "999px", t.style.background = "rgba(15, 23, 42, 0.92)", t.style.color = "#f8fafc", t.style.font = "600 12px/1 Inter, sans-serif", t.style.pointerEvents = "none", document.body.appendChild(t), e.setDragImage(t, 12, 12), this._dragImage = t;
2086
+ const r = document.createElement("div");
2087
+ r.textContent = t === 1 ? "Dragging item" : `Dragging ${t} items`, r.style.position = "fixed", r.style.top = "-999px", r.style.left = "-999px", r.style.padding = "8px 12px", r.style.borderRadius = "999px", r.style.background = "rgba(15, 23, 42, 0.92)", r.style.color = "#f8fafc", r.style.font = "600 12px/1 Inter, sans-serif", r.style.pointerEvents = "none", document.body.appendChild(r), e.setDragImage(r, 12, 12), this._dragImage = r;
2104
2088
  }
2105
2089
  _removeDragImage() {
2106
- var e;
2107
- (e = this._dragImage) == null || e.remove(), this._dragImage = null;
2090
+ this._dragImage?.remove(), this._dragImage = null;
2108
2091
  }
2109
2092
  _removeDragPreviewOverlay() {
2110
- var e;
2111
- (e = this._dragPreviewOverlay) == null || e.remove(), this._dragPreviewOverlay = null;
2093
+ this._dragPreviewOverlay?.remove(), this._dragPreviewOverlay = null;
2112
2094
  }
2113
- _applyPointerPreview(e, r, t, i) {
2095
+ _applyPointerPreview(e, t, r, i) {
2114
2096
  this._removeDragImage();
2115
2097
  const s = document.createElement("div");
2116
- s.textContent = i ? t === 1 ? "Copying item" : `Copying ${t} items` : t === 1 ? "Moving item" : `Moving ${t} items`, s.style.position = "fixed", s.style.top = "0", s.style.left = "0", s.style.zIndex = "2147483647", s.style.padding = "8px 12px", s.style.borderRadius = "999px", s.style.background = "rgba(15, 23, 42, 0.92)", s.style.color = "#f8fafc", s.style.font = "600 12px/1 Inter, sans-serif", s.style.pointerEvents = "none", s.style.boxShadow = "0 12px 28px rgba(15, 23, 42, 0.22)", document.body.appendChild(s), this._dragImage = s, this._movePointerPreview(e, r);
2098
+ s.textContent = i ? r === 1 ? "Copying item" : `Copying ${r} items` : r === 1 ? "Moving item" : `Moving ${r} items`, s.style.position = "fixed", s.style.top = "0", s.style.left = "0", s.style.zIndex = "2147483647", s.style.padding = "8px 12px", s.style.borderRadius = "999px", s.style.background = "rgba(15, 23, 42, 0.92)", s.style.color = "#f8fafc", s.style.font = "600 12px/1 Inter, sans-serif", s.style.pointerEvents = "none", s.style.boxShadow = "0 12px 28px rgba(15, 23, 42, 0.22)", document.body.appendChild(s), this._dragImage = s, this._movePointerPreview(e, t);
2117
2099
  }
2118
- _movePointerPreview(e, r) {
2119
- this._dragImage && (this._dragImage.style.transform = `translate(${Math.round(e + 14)}px, ${Math.round(r + 14)}px)`);
2100
+ _movePointerPreview(e, t) {
2101
+ this._dragImage && (this._dragImage.style.transform = `translate(${Math.round(e + 14)}px, ${Math.round(t + 14)}px)`);
2120
2102
  }
2121
2103
  _keyboardDropTargets() {
2122
- const e = M(this._items), r = E(this._items), t = [], i = (s, o) => {
2123
- var l;
2124
- (r.get(z(s, o)) || []).forEach((n) => {
2125
- const d = e.get(n);
2126
- !d || d.hidden || (t.push({
2127
- listId: s,
2128
- parentId: o,
2129
- beforeId: n,
2104
+ const e = T(this._items), t = E(this._items), r = [], i = this.getAttribute("allow-nesting") !== "false", s = (n, a) => {
2105
+ const d = t.get(k(n, a)) || [];
2106
+ d.forEach((o) => {
2107
+ const u = e.get(o);
2108
+ !u || u.hidden || (r.push({
2109
+ listId: n,
2110
+ parentId: a,
2111
+ beforeId: o,
2130
2112
  mode: "before",
2131
- label: `Before ${d.label}`
2132
- }), this.getAttribute("allow-nesting") !== "false" && t.push({
2133
- listId: s,
2134
- parentId: n,
2113
+ label: `Before ${u.label}`
2114
+ }), i && r.push({
2115
+ listId: n,
2116
+ parentId: o,
2135
2117
  beforeId: null,
2136
2118
  mode: "inside",
2137
- label: `Nest inside ${d.label}`
2138
- }), i(s, n));
2139
- }), t.push({
2140
- listId: s,
2141
- parentId: o,
2119
+ label: `Nest inside ${u.label}`
2120
+ }), s(n, o));
2121
+ }), a ? i && d.length > 0 && r.push({
2122
+ listId: n,
2123
+ parentId: a,
2124
+ beforeId: null,
2125
+ mode: "before",
2126
+ label: "After children"
2127
+ }) : r.push({
2128
+ listId: n,
2129
+ parentId: a,
2142
2130
  beforeId: null,
2143
2131
  mode: "before",
2144
- label: o ? "After children" : `End of ${((l = this._lists.find((n) => n.id === s)) == null ? void 0 : l.label) || s}`
2132
+ label: `End of ${this._lists.find((o) => o.id === n)?.label || n}`
2145
2133
  });
2146
2134
  };
2147
- return this._lists.forEach((s) => i(s.id, null)), t.filter((s) => {
2148
- var o;
2149
- return this._canDrop(s, ((o = this._dragState) == null ? void 0 : o.movedRootIds) || []);
2150
- });
2135
+ return this._lists.forEach((n) => s(n.id, null)), r.filter((n) => this._canDrop(n, this._dragState?.movedRootIds || []));
2151
2136
  }
2152
2137
  _initialKeyboardDropTarget(e) {
2153
- const r = this._items.find((t) => t.id === e);
2154
- return r ? {
2155
- listId: r.listId,
2156
- parentId: r.parentId,
2138
+ const t = this._items.find((r) => r.id === e);
2139
+ return t ? {
2140
+ listId: t.listId,
2141
+ parentId: t.parentId,
2157
2142
  beforeId: e,
2158
2143
  mode: "before"
2159
2144
  } : null;
2160
2145
  }
2161
2146
  _moveKeyboardDropTarget(e) {
2162
- if (!this._dragState)
2163
- return;
2164
- const r = this._keyboardDropTargets();
2165
- if (!r.length)
2166
- return;
2167
- const t = Math.max(0, r.findIndex(
2168
- (s) => {
2169
- var o, a, l, n, d, c, g, m;
2170
- return s.listId === ((a = (o = this._dragState) == null ? void 0 : o.dropTarget) == null ? void 0 : a.listId) && s.parentId === ((n = (l = this._dragState) == null ? void 0 : l.dropTarget) == null ? void 0 : n.parentId) && s.beforeId === ((c = (d = this._dragState) == null ? void 0 : d.dropTarget) == null ? void 0 : c.beforeId) && s.mode === ((m = (g = this._dragState) == null ? void 0 : g.dropTarget) == null ? void 0 : m.mode);
2171
- }
2172
- )), i = Math.max(0, Math.min(r.length - 1, t + e));
2173
- this._setDropTarget(r[i], { announceLabel: r[i].label });
2147
+ if (!this._dragState) return;
2148
+ const t = this._keyboardDropTargets();
2149
+ if (!t.length) return;
2150
+ const r = Math.max(0, t.findIndex(
2151
+ (s) => s.listId === this._dragState?.dropTarget?.listId && s.parentId === this._dragState?.dropTarget?.parentId && s.beforeId === this._dragState?.dropTarget?.beforeId && s.mode === this._dragState?.dropTarget?.mode
2152
+ )), i = Math.max(0, Math.min(t.length - 1, r + e));
2153
+ this._setDropTarget(t[i], { announceLabel: t[i].label });
2174
2154
  }
2175
2155
  }
2176
- typeof customElements < "u" && !customElements.get("ui-sortable") && customElements.define("ui-sortable", ce);
2156
+ typeof customElements < "u" && !customElements.get("ui-sortable") && customElements.define("ui-sortable", he);
2177
2157
  export {
2178
- ce as UISortable
2158
+ he as UISortable
2179
2159
  };