@editora/ui-core 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (365) hide show
  1. package/dist/{ElementBase-DxbvhLJs.js → ElementBase-CbUsP3D6.js} +1 -1
  2. package/dist/{ElementBase-BeZT54Hj.mjs → ElementBase-D5QsC5Vw.mjs} +10 -1
  3. package/dist/ElementBase.d.ts +7 -0
  4. package/dist/ElementBase.d.ts.map +1 -1
  5. package/dist/accordion.cjs.js +1 -1
  6. package/dist/accordion.esm.js +1 -1
  7. package/dist/add-icons-CVeHOsWl.js +1 -0
  8. package/dist/add-icons-DBUZJ0g7.mjs +14 -0
  9. package/dist/add-icons.cjs.js +1 -0
  10. package/dist/add-icons.d.ts +16 -0
  11. package/dist/add-icons.d.ts.map +1 -0
  12. package/dist/add-icons.esm.js +4 -0
  13. package/dist/alert-dialog.cjs.js +24 -24
  14. package/dist/alert-dialog.esm.js +112 -107
  15. package/dist/alert.cjs.js +8 -8
  16. package/dist/alert.esm.js +22 -22
  17. package/dist/animated-beam.cjs.js +1 -1
  18. package/dist/animated-beam.esm.js +1 -1
  19. package/dist/animated-list.cjs.js +1 -1
  20. package/dist/animated-list.esm.js +1 -1
  21. package/dist/animated-text.cjs.js +1 -1
  22. package/dist/animated-text.esm.js +1 -1
  23. package/dist/app-header.cjs.js +15 -3
  24. package/dist/app-header.esm.js +31 -4
  25. package/dist/aspect-ratio.cjs.js +1 -1
  26. package/dist/aspect-ratio.esm.js +1 -1
  27. package/dist/avatar.cjs.js +1 -1
  28. package/dist/avatar.esm.js +1 -1
  29. package/dist/badge.cjs.js +1 -1
  30. package/dist/badge.esm.js +1 -1
  31. package/dist/block-controls.cjs.js +1 -1
  32. package/dist/block-controls.esm.js +1 -1
  33. package/dist/box.cjs.js +1 -1
  34. package/dist/box.esm.js +1 -1
  35. package/dist/breadcrumb.cjs.js +4 -4
  36. package/dist/breadcrumb.esm.js +93 -84
  37. package/dist/button.cjs.js +520 -1
  38. package/dist/button.esm.js +682 -2
  39. package/dist/{calendar-CzpWDxLc.js → calendar-BsVqtpjM.js} +6 -6
  40. package/dist/{calendar-DkSDFg33.mjs → calendar-CFafqZVA.mjs} +6 -6
  41. package/dist/calendar.cjs.js +1 -1
  42. package/dist/calendar.esm.js +1 -1
  43. package/dist/card.cjs.js +6 -5
  44. package/dist/card.esm.js +52 -39
  45. package/dist/chart.cjs.js +2 -2
  46. package/dist/chart.esm.js +2 -2
  47. package/dist/checkbox.cjs.js +4 -4
  48. package/dist/checkbox.esm.js +36 -15
  49. package/dist/clone-source-BxK2pEVw.mjs +11 -0
  50. package/dist/clone-source-C7E_ri5f.js +1 -0
  51. package/dist/collapsible.cjs.js +1 -1
  52. package/dist/collapsible.esm.js +1 -1
  53. package/dist/color-picker.cjs.js +2 -2
  54. package/dist/color-picker.esm.js +3 -3
  55. package/dist/combobox.cjs.js +4 -4
  56. package/dist/combobox.esm.js +22 -19
  57. package/dist/command-palette.cjs.js +1 -1
  58. package/dist/command-palette.esm.js +1 -1
  59. package/dist/command.cjs.js +1 -1
  60. package/dist/command.esm.js +1 -1
  61. package/dist/components/ui-alert-dialog.d.ts.map +1 -1
  62. package/dist/components/ui-alert.d.ts.map +1 -1
  63. package/dist/components/ui-app-header.d.ts +1 -0
  64. package/dist/components/ui-app-header.d.ts.map +1 -1
  65. package/dist/components/ui-breadcrumb.d.ts.map +1 -1
  66. package/dist/components/ui-card.d.ts +7 -0
  67. package/dist/components/ui-card.d.ts.map +1 -1
  68. package/dist/components/ui-checkbox.d.ts +6 -0
  69. package/dist/components/ui-checkbox.d.ts.map +1 -1
  70. package/dist/components/ui-combobox.d.ts.map +1 -1
  71. package/dist/components/ui-date-time-picker.d.ts.map +1 -1
  72. package/dist/components/ui-dialog.d.ts +1 -0
  73. package/dist/components/ui-dialog.d.ts.map +1 -1
  74. package/dist/components/ui-drawer.d.ts.map +1 -1
  75. package/dist/components/ui-dropdown.d.ts.map +1 -1
  76. package/dist/components/ui-empty-state.d.ts.map +1 -1
  77. package/dist/components/ui-hover-card.d.ts.map +1 -1
  78. package/dist/components/ui-icon.d.ts +1 -0
  79. package/dist/components/ui-icon.d.ts.map +1 -1
  80. package/dist/components/ui-input.d.ts +16 -0
  81. package/dist/components/ui-input.d.ts.map +1 -1
  82. package/dist/components/ui-layout.d.ts +20 -0
  83. package/dist/components/ui-layout.d.ts.map +1 -1
  84. package/dist/components/ui-menu.d.ts +1 -0
  85. package/dist/components/ui-menu.d.ts.map +1 -1
  86. package/dist/components/ui-menubar.d.ts.map +1 -1
  87. package/dist/components/ui-multi-select.d.ts +6 -0
  88. package/dist/components/ui-multi-select.d.ts.map +1 -1
  89. package/dist/components/ui-number-field.d.ts +6 -0
  90. package/dist/components/ui-number-field.d.ts.map +1 -1
  91. package/dist/components/ui-pagination.d.ts.map +1 -1
  92. package/dist/components/ui-password-field.d.ts +11 -0
  93. package/dist/components/ui-password-field.d.ts.map +1 -1
  94. package/dist/components/ui-popover.d.ts.map +1 -1
  95. package/dist/components/ui-positioner.d.ts.map +1 -1
  96. package/dist/components/ui-radio-group.d.ts +6 -0
  97. package/dist/components/ui-radio-group.d.ts.map +1 -1
  98. package/dist/components/ui-rating.d.ts +1 -0
  99. package/dist/components/ui-rating.d.ts.map +1 -1
  100. package/dist/components/ui-select.d.ts +7 -0
  101. package/dist/components/ui-select.d.ts.map +1 -1
  102. package/dist/components/ui-sidebar.d.ts +1 -0
  103. package/dist/components/ui-sidebar.d.ts.map +1 -1
  104. package/dist/components/ui-slider.d.ts +6 -0
  105. package/dist/components/ui-slider.d.ts.map +1 -1
  106. package/dist/components/ui-sortable.d.ts +1 -0
  107. package/dist/components/ui-sortable.d.ts.map +1 -1
  108. package/dist/components/ui-switch.d.ts +6 -0
  109. package/dist/components/ui-switch.d.ts.map +1 -1
  110. package/dist/components/ui-tabs.d.ts +2 -0
  111. package/dist/components/ui-tabs.d.ts.map +1 -1
  112. package/dist/components/ui-textarea.d.ts +6 -0
  113. package/dist/components/ui-textarea.d.ts.map +1 -1
  114. package/dist/components/ui-toast.d.ts.map +1 -1
  115. package/dist/components/ui-tooltip.d.ts.map +1 -1
  116. package/dist/container.cjs.js +1 -1
  117. package/dist/container.esm.js +1 -1
  118. package/dist/context-menu.cjs.js +2 -2
  119. package/dist/context-menu.esm.js +2 -2
  120. package/dist/control-group.cjs.js +1 -1
  121. package/dist/control-group.esm.js +1 -1
  122. package/dist/data-table.cjs.js +5 -5
  123. package/dist/data-table.esm.js +7 -7
  124. package/dist/date-field.cjs.js +1 -1
  125. package/dist/date-field.esm.js +3 -3
  126. package/dist/date-picker.cjs.js +2 -2
  127. package/dist/date-picker.esm.js +17 -17
  128. package/dist/date-range-picker.cjs.js +2 -2
  129. package/dist/date-range-picker.esm.js +4 -4
  130. package/dist/date-range-time-picker.cjs.js +3 -3
  131. package/dist/date-range-time-picker.esm.js +16 -16
  132. package/dist/date-time-picker.cjs.js +26 -23
  133. package/dist/date-time-picker.esm.js +49 -46
  134. package/dist/{date-time-utils-zAx4ghvC.mjs → date-time-utils-CJUksWj3.mjs} +1 -1
  135. package/dist/{date-time-utils-C-4eHTyy.js → date-time-utils-D3hQQ5Om.js} +1 -1
  136. package/dist/description.cjs.js +1 -1
  137. package/dist/description.esm.js +1 -1
  138. package/dist/dialog.cjs.js +7 -7
  139. package/dist/dialog.esm.js +51 -47
  140. package/dist/direction-provider.cjs.js +1 -1
  141. package/dist/direction-provider.esm.js +1 -1
  142. package/dist/dismissable-layer.cjs.js +1 -1
  143. package/dist/dismissable-layer.esm.js +1 -1
  144. package/dist/dock.cjs.js +1 -1
  145. package/dist/dock.esm.js +1 -1
  146. package/dist/drawer.cjs.js +5 -5
  147. package/dist/drawer.esm.js +18 -17
  148. package/dist/dropdown.cjs.js +7 -7
  149. package/dist/dropdown.esm.js +39 -38
  150. package/dist/empty-state.cjs.js +12 -2
  151. package/dist/empty-state.esm.js +17 -7
  152. package/dist/field-error.cjs.js +1 -1
  153. package/dist/field-error.esm.js +1 -1
  154. package/dist/field.cjs.js +2 -2
  155. package/dist/field.esm.js +2 -2
  156. package/dist/fieldset.cjs.js +1 -1
  157. package/dist/fieldset.esm.js +1 -1
  158. package/dist/file-upload.cjs.js +1 -1
  159. package/dist/file-upload.esm.js +1 -1
  160. package/dist/flex.cjs.js +1 -1
  161. package/dist/flex.esm.js +1 -1
  162. package/dist/floating-toolbar.cjs.js +2 -2
  163. package/dist/floating-toolbar.esm.js +2 -2
  164. package/dist/focus-scope-Dl0qk5GP.mjs +177 -0
  165. package/dist/focus-scope-Doz0bnE1.js +1 -0
  166. package/dist/focus-scope.cjs.js +1 -1
  167. package/dist/focus-scope.esm.js +2 -2
  168. package/dist/form-control-B90_3kYN.js +1 -0
  169. package/dist/form-control-D9wWUMBl.mjs +86 -0
  170. package/dist/form.cjs.js +2 -2
  171. package/dist/form.esm.js +2 -2
  172. package/dist/gantt.cjs.js +2 -2
  173. package/dist/gantt.esm.js +2 -2
  174. package/dist/grid.cjs.js +1 -1
  175. package/dist/grid.esm.js +1 -1
  176. package/dist/hover-card.cjs.js +5 -5
  177. package/dist/hover-card.esm.js +19 -18
  178. package/dist/icon-cloud.cjs.js +1 -1
  179. package/dist/icon-cloud.esm.js +1 -1
  180. package/dist/icon.cjs.js +207 -1
  181. package/dist/icon.esm.js +294 -2
  182. package/dist/icons-CpCpPXV5.js +1 -0
  183. package/dist/icons-DWYbbhb0.mjs +115 -0
  184. package/dist/icons.d.ts +11 -1
  185. package/dist/icons.d.ts.map +1 -1
  186. package/dist/implicit-submit-B6M5Uc56.js +1 -0
  187. package/dist/implicit-submit-Lr0-q2LR.mjs +44 -0
  188. package/dist/index.cjs.js +1 -1
  189. package/dist/index.d.ts +1 -0
  190. package/dist/index.d.ts.map +1 -1
  191. package/dist/index.esm.js +309 -299
  192. package/dist/inline-edit.cjs.js +1 -1
  193. package/dist/inline-edit.esm.js +1 -1
  194. package/dist/input.cjs.js +62 -20
  195. package/dist/input.esm.js +164 -58
  196. package/dist/label.cjs.js +1 -1
  197. package/dist/label.esm.js +1 -1
  198. package/dist/layout.cjs.js +145 -4
  199. package/dist/layout.esm.js +278 -40
  200. package/dist/marquee.cjs.js +1 -1
  201. package/dist/marquee.esm.js +1 -1
  202. package/dist/masonry-grid.cjs.js +1 -1
  203. package/dist/masonry-grid.esm.js +1 -1
  204. package/dist/menu.cjs.js +8 -8
  205. package/dist/menu.esm.js +51 -47
  206. package/dist/menubar.cjs.js +9 -9
  207. package/dist/menubar.esm.js +41 -40
  208. package/dist/meter.cjs.js +1 -1
  209. package/dist/meter.esm.js +1 -1
  210. package/dist/multi-select.cjs.js +7 -7
  211. package/dist/multi-select.esm.js +55 -34
  212. package/dist/navigate-CXebafwF.mjs +18 -0
  213. package/dist/navigate-ChJVIIuS.js +1 -0
  214. package/dist/navigation-menu.cjs.js +1 -1
  215. package/dist/navigation-menu.esm.js +1 -1
  216. package/dist/number-attribute-BAF07JrU.mjs +8 -0
  217. package/dist/number-attribute-C4Rrl7d3.js +1 -0
  218. package/dist/number-field.cjs.js +8 -8
  219. package/dist/number-field.esm.js +90 -69
  220. package/dist/number-ticker.cjs.js +1 -1
  221. package/dist/number-ticker.esm.js +1 -1
  222. package/dist/odometer.cjs.js +1 -1
  223. package/dist/odometer.esm.js +1 -1
  224. package/dist/orbiter.cjs.js +1 -1
  225. package/dist/orbiter.esm.js +1 -1
  226. package/dist/pagination.cjs.js +24 -23
  227. package/dist/pagination.esm.js +61 -46
  228. package/dist/{panel-group-BVHJEdfx.js → panel-group-BIzzpQ5i.js} +1 -1
  229. package/dist/{panel-group-BxO_eNW6.mjs → panel-group-CFLjzRWI.mjs} +1 -1
  230. package/dist/panel-group.cjs.js +1 -1
  231. package/dist/panel-group.esm.js +1 -1
  232. package/dist/panel.cjs.js +1 -1
  233. package/dist/panel.esm.js +1 -1
  234. package/dist/password-field.cjs.js +36 -16
  235. package/dist/password-field.esm.js +113 -44
  236. package/dist/pin-input.cjs.js +1 -1
  237. package/dist/pin-input.esm.js +1 -1
  238. package/dist/placement-grid.cjs.js +1 -1
  239. package/dist/placement-grid.esm.js +1 -1
  240. package/dist/plugin-panel.cjs.js +1 -1
  241. package/dist/plugin-panel.esm.js +1 -1
  242. package/dist/popover.cjs.js +2 -2
  243. package/dist/popover.esm.js +28 -26
  244. package/dist/portal.cjs.js +1 -1
  245. package/dist/portal.esm.js +1 -1
  246. package/dist/positioner.cjs.js +2 -2
  247. package/dist/positioner.esm.js +35 -38
  248. package/dist/preload.cjs.js +221 -0
  249. package/dist/preload.css +220 -0
  250. package/dist/preload.d.ts +17 -0
  251. package/dist/preload.d.ts.map +1 -0
  252. package/dist/preload.esm.js +224 -0
  253. package/dist/presence.cjs.js +1 -1
  254. package/dist/presence.esm.js +1 -1
  255. package/dist/primitives/clone-source.d.ts +3 -0
  256. package/dist/primitives/clone-source.d.ts.map +1 -0
  257. package/dist/primitives/focus-scope.d.ts +6 -0
  258. package/dist/primitives/focus-scope.d.ts.map +1 -1
  259. package/dist/primitives/form-control.d.ts +68 -0
  260. package/dist/primitives/form-control.d.ts.map +1 -0
  261. package/dist/primitives/implicit-submit.d.ts +17 -0
  262. package/dist/primitives/implicit-submit.d.ts.map +1 -0
  263. package/dist/primitives/navigate.d.ts +27 -0
  264. package/dist/primitives/navigate.d.ts.map +1 -0
  265. package/dist/primitives/number-attribute.d.ts +7 -0
  266. package/dist/primitives/number-attribute.d.ts.map +1 -0
  267. package/dist/primitives/slotted-input.d.ts +19 -0
  268. package/dist/primitives/slotted-input.d.ts.map +1 -0
  269. package/dist/progress.cjs.js +3 -3
  270. package/dist/progress.esm.js +3 -3
  271. package/dist/quick-actions.cjs.js +5 -5
  272. package/dist/quick-actions.esm.js +3 -3
  273. package/dist/radio-group.cjs.js +9 -9
  274. package/dist/radio-group.esm.js +47 -24
  275. package/dist/radio.cjs.js +1 -1
  276. package/dist/radio.esm.js +1 -1
  277. package/dist/rating.cjs.js +6 -6
  278. package/dist/rating.esm.js +21 -10
  279. package/dist/{runtime-CJzoaC8Z.mjs → runtime-CORXjP7e.mjs} +366 -352
  280. package/dist/runtime-uCly3ECd.js +5 -0
  281. package/dist/runtime.cjs.js +1 -1
  282. package/dist/runtime.esm.js +1 -1
  283. package/dist/scroll-area.cjs.js +1 -1
  284. package/dist/scroll-area.esm.js +1 -1
  285. package/dist/section.cjs.js +1 -1
  286. package/dist/section.esm.js +1 -1
  287. package/dist/select.cjs.js +21 -21
  288. package/dist/select.esm.js +111 -71
  289. package/dist/selection-popup.cjs.js +2 -2
  290. package/dist/selection-popup.esm.js +2 -2
  291. package/dist/semantic-tokens.d.ts.map +1 -1
  292. package/dist/separator.cjs.js +1 -1
  293. package/dist/separator.esm.js +1 -1
  294. package/dist/sidebar.cjs.js +15 -15
  295. package/dist/sidebar.esm.js +48 -42
  296. package/dist/skeleton.cjs.js +1 -1
  297. package/dist/skeleton.esm.js +1 -1
  298. package/dist/slider.cjs.js +11 -11
  299. package/dist/slider.esm.js +40 -23
  300. package/dist/slot.cjs.js +1 -1
  301. package/dist/slot.esm.js +1 -1
  302. package/dist/slotted-input-BVq2QQg2.js +1 -0
  303. package/dist/slotted-input-atWznLfm.mjs +13 -0
  304. package/dist/sortable.cjs.js +25 -25
  305. package/dist/sortable.esm.js +29 -21
  306. package/dist/spinning-text.cjs.js +1 -1
  307. package/dist/spinning-text.esm.js +1 -1
  308. package/dist/split-button.cjs.js +1 -1
  309. package/dist/split-button.esm.js +1 -1
  310. package/dist/splitter.cjs.js +1 -1
  311. package/dist/splitter.esm.js +1 -1
  312. package/dist/standalone/add-icons.d.ts +2 -0
  313. package/dist/standalone/add-icons.d.ts.map +1 -0
  314. package/dist/standalone/preload.d.ts +2 -0
  315. package/dist/standalone/preload.d.ts.map +1 -0
  316. package/dist/stepper.cjs.js +3 -3
  317. package/dist/stepper.esm.js +3 -3
  318. package/dist/switch.cjs.js +9 -9
  319. package/dist/switch.esm.js +56 -35
  320. package/dist/table.cjs.js +1 -1
  321. package/dist/table.esm.js +1 -1
  322. package/dist/tabs.cjs.js +14 -14
  323. package/dist/tabs.esm.js +129 -115
  324. package/dist/tags-input.cjs.js +1 -1
  325. package/dist/tags-input.esm.js +1 -1
  326. package/dist/textarea.cjs.js +33 -11
  327. package/dist/textarea.esm.js +74 -35
  328. package/dist/theme.d.ts +6 -0
  329. package/dist/theme.d.ts.map +1 -1
  330. package/dist/time-field.cjs.js +1 -1
  331. package/dist/time-field.esm.js +2 -2
  332. package/dist/time-picker.cjs.js +1 -1
  333. package/dist/time-picker.esm.js +3 -3
  334. package/dist/timeline.cjs.js +2 -2
  335. package/dist/timeline.esm.js +2 -2
  336. package/dist/toast.cjs.js +4 -4
  337. package/dist/toast.esm.js +17 -16
  338. package/dist/toggle-group.cjs.js +1 -1
  339. package/dist/toggle-group.esm.js +1 -1
  340. package/dist/toggle.cjs.js +3 -3
  341. package/dist/toggle.esm.js +9 -9
  342. package/dist/toolbar.cjs.js +1 -1
  343. package/dist/toolbar.esm.js +1 -1
  344. package/dist/tooltip.cjs.js +2 -2
  345. package/dist/tooltip.esm.js +12 -14
  346. package/dist/transfer-list.cjs.js +1 -1
  347. package/dist/transfer-list.esm.js +1 -1
  348. package/dist/{tree-33fVNnaf.mjs → tree-CD2k2lIC.mjs} +1 -1
  349. package/dist/{tree-Dc02MChE.js → tree-ChQfhxya.js} +1 -1
  350. package/dist/tree-item.cjs.js +1 -1
  351. package/dist/tree-item.esm.js +1 -1
  352. package/dist/tree.cjs.js +1 -1
  353. package/dist/tree.esm.js +1 -1
  354. package/dist/visually-hidden.cjs.js +1 -1
  355. package/dist/visually-hidden.esm.js +1 -1
  356. package/dist/wizard.cjs.js +4 -4
  357. package/dist/wizard.esm.js +4 -4
  358. package/package.json +3 -2
  359. package/dist/focus-scope-Bwug2gDv.js +0 -1
  360. package/dist/focus-scope-CmEsG5UZ.mjs +0 -138
  361. package/dist/runtime-DYSIU3sR.js +0 -5
  362. package/dist/ui-button-C3OmI7Sn.mjs +0 -684
  363. package/dist/ui-button-CnLwXBnx.js +0 -520
  364. package/dist/ui-icon-D3avtxX_.js +0 -207
  365. package/dist/ui-icon-DLhB08Fo.mjs +0 -361
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const de=require("./ElementBase-DxbvhLJs.js");function V(u,e,t,i=56,r=18){if(!Number.isFinite(u)||!(t>e))return 0;const s=Math.min(i,(t-e)/2);return s<=0?0:u<e+s?-Math.ceil(r*Math.min(1,(e+s-u)/s)):u>t-s?Math.ceil(r*Math.min(1,(u-(t-s))/s)):0}const ce=new Set(["auto","scroll","overlay"]);function ue(u){let e=u;for(;e;){if(e=e.parentNode instanceof ShadowRoot?e.parentNode.host:e.parentNode,!(e instanceof HTMLElement))continue;if(e===e.ownerDocument.body||e===e.ownerDocument.documentElement)return null;const{overflowY:t}=e.ownerDocument.defaultView?.getComputedStyle(e)??{overflowY:""};if(ce.has(t)&&e.scrollHeight>e.clientHeight)return e}return null}const he=1,X={hintHandle:"Use the handle to drag, or press Space on a focused item to start keyboard reordering.",hintItem:"Drag from anywhere on an item, or press Space on a focused item to start keyboard reordering.",hintCustom:"Use your custom drag handle element, or press Space on a focused item to start keyboard reordering.",hintKeyboard:"Keyboard drag active. Use arrow keys to choose a drop target, Space or Enter to drop, and Escape to cancel.",hintNestGutter:"To nest an item, hold Alt or drop it on the far side of another.",hintNestModifier:"To nest an item, hold Alt while you drop it on another.",hintNestArea:"To nest an item, drop it on the middle of another.",hintPausedSort:"Dragging is paused while alphabetical sorting is active.",hintPausedFilter:"Dragging is paused while the list is filtered.",hintDisabled:"Dragging is currently disabled.",selectedOne:"item selected",selectedMany:"items selected",listReadOnly:"This list is read-only.",listClone:"Dragging from this list creates a copy.",listAccepts:"Accepts drops from: {lists}",listFull:"This list is full ({max} items).",emptyList:"Drop items here.",dropHere:"Drop here",nestHere:"Nest here",badgeSelected:"Selected",badgeClone:"Clone on drag",badgePinned:"Pinned",dropPreview:"Drop preview",copyPreview:"Copy preview",releaseMove:"Release to place this item here.",releaseMoveMany:"Release to place this selection here.",releaseCopy:"Release to add a copy here.",movingOne:"Moving item",movingMany:"Moving {count} items",copyingOne:"Copying item",copyingMany:"Copying {count} items",announceSelectedMany:"{count} items selected.",announceDragDisabled:"Dragging is disabled right now.",announceDragging:"Dragging {label}.",announceDraggingMany:"Dragging {count} items.",announceDraggingCopy:"Dragging {label} as a copy.",announceDraggingCopyMany:"Dragging {count} items as a copy.",announceCancelled:"Drag cancelled.",announceRejected:"That move is not allowed.",announceLifted:"Lifted {label}.",announceLiftedMany:"Lifted {count} items.",announceLiftedHelp:"Use arrow keys to choose a destination.",announceCopiedOne:"Item copied into {list}.",announceCopiedMany:"{count} items copied into {list}.",announceNestedOne:"Item nested in {list}.",announceNestedMany:"{count} items nested in {list}.",announceMovedOne:"Item moved to {list}.",announceMovedMany:"{count} items moved to {list}.",announceReorderedOne:"Item reordered in {list}.",announceReorderedMany:"{count} items reordered in {list}.",targetBefore:"Before {label}",targetInside:"Nest inside {label}",targetEnd:"End of {list}",targetAfterChildren:"After children"},W=44,Q=72,Z=350,pe=10,ge=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const dt=require("./ElementBase-CbUsP3D6.js");function V(u,t,e,i=56,r=18){if(!Number.isFinite(u)||!(e>t))return 0;const s=Math.min(i,(e-t)/2);return s<=0?0:u<t+s?-Math.ceil(r*Math.min(1,(t+s-u)/s)):u>e-s?Math.ceil(r*Math.min(1,(u-(e-s))/s)):0}const ct=new Set(["auto","scroll","overlay"]);function ut(u){let t=u;for(;t;){if(t=t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode,!(t instanceof HTMLElement))continue;if(t===t.ownerDocument.body||t===t.ownerDocument.documentElement)return null;const{overflowY:e}=t.ownerDocument.defaultView?.getComputedStyle(t)??{overflowY:""};if(ct.has(e)&&t.scrollHeight>t.clientHeight)return t}return null}const ht=1,X={hintHandle:"Use the handle to drag, or press Space on a focused item to start keyboard reordering.",hintItem:"Drag from anywhere on an item, or press Space on a focused item to start keyboard reordering.",hintCustom:"Use your custom drag handle element, or press Space on a focused item to start keyboard reordering.",hintKeyboard:"Keyboard drag active. Use arrow keys to choose a drop target, Space or Enter to drop, and Escape to cancel.",hintNestGutter:"To nest an item, hold Alt or drop it on the far side of another.",hintNestModifier:"To nest an item, hold Alt while you drop it on another.",hintNestArea:"To nest an item, drop it on the middle of another.",hintPausedSort:"Dragging is paused while alphabetical sorting is active.",hintPausedFilter:"Dragging is paused while the list is filtered.",hintDisabled:"Dragging is currently disabled.",selectedOne:"item selected",selectedMany:"items selected",listReadOnly:"This list is read-only.",listClone:"Dragging from this list creates a copy.",listAccepts:"Accepts drops from: {lists}",listFull:"This list is full ({max} items).",emptyList:"Drop items here.",dropHere:"Drop here",nestHere:"Nest here",badgeSelected:"Selected",badgeClone:"Clone on drag",badgePinned:"Pinned",dropPreview:"Drop preview",copyPreview:"Copy preview",releaseMove:"Release to place this item here.",releaseMoveMany:"Release to place this selection here.",releaseCopy:"Release to add a copy here.",movingOne:"Moving item",movingMany:"Moving {count} items",copyingOne:"Copying item",copyingMany:"Copying {count} items",announceSelectedMany:"{count} items selected.",announceDragDisabled:"Dragging is disabled right now.",announceDragging:"Dragging {label}.",announceDraggingMany:"Dragging {count} items.",announceDraggingCopy:"Dragging {label} as a copy.",announceDraggingCopyMany:"Dragging {count} items as a copy.",announceCancelled:"Drag cancelled.",announceRejected:"That move is not allowed.",announceLifted:"Lifted {label}.",announceLiftedMany:"Lifted {count} items.",announceLiftedHelp:"Use arrow keys to choose a destination.",announceCopiedOne:"Item copied into {list}.",announceCopiedMany:"{count} items copied into {list}.",announceNestedOne:"Item nested in {list}.",announceNestedMany:"{count} items nested in {list}.",announceMovedOne:"Item moved to {list}.",announceMovedMany:"{count} items moved to {list}.",announceReorderedOne:"Item reordered in {list}.",announceReorderedMany:"{count} items reordered in {list}.",targetBefore:"Before {label}",targetInside:"Nest inside {label}",targetEnd:"End of {list}",targetAfterChildren:"After children"},W=44,Q=72,Z=350,pt=10,gt=`
2
2
  :host {
3
3
  --ui-sortable-accent: var(--ui-color-primary, #2563eb);
4
4
  --ui-sortable-surface: var(--ui-color-surface, #ffffff);
@@ -871,8 +871,8 @@
871
871
  box-shadow: none;
872
872
  }
873
873
  }
874
- `;function j(u){if(!u)return[];try{const e=JSON.parse(u);return Array.isArray(e)?e:[]}catch{return[]}}function ee(u){if(u===void 0)return"";let e;try{e=JSON.stringify(u)??""}catch{return""}let t=5381;for(let i=0;i<e.length;i+=1)t=(t<<5)+t+e.charCodeAt(i)|0;return(t>>>0).toString(36)}function me(u){if(!u)return{};try{const e=JSON.parse(u);if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};return Object.keys(X).forEach(i=>{typeof e[i]=="string"&&(t[i]=e[i])}),t}catch{return{}}}function oe(u){if(typeof u=="number")return Number.isFinite(u)&&u>0?`${u}px`:void 0;if(typeof u!="string")return;const e=u.trim();return/^(?:\d+\.?\d*|\.\d+)(?:px|rem|em|ch|vh|svh|dvh|vw|%)$/.test(e)?e:void 0}function v(u){return u.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function w(u,e){return`${u}::${e??"__root__"}`}function te(u){return u?[u.listId,u.parentId??"",u.beforeId??"",u.mode].join("::"):""}function H(u,e){return te(u)===te(e)}function fe(u){return u==="item"?"item":"handle"}function A(u){return{...u}}function B(u){if(u==null||typeof u!="object")return u;try{return JSON.parse(JSON.stringify(u))}catch{return u}}function q(u){const e={...u};return u.data!==void 0&&(e.data=B(u.data)),e}function G(u){const e={...u};return u.data!==void 0&&(e.data=B(u.data)),e}function U(u,e,t,i,r,s){const n=T(u),a=M(u),d=new Set,o=[],c=m=>{const S=n.get(m);!S||d.has(m)||(d.add(m),o.push(m),(a.get(w(S.listId,m))||[]).forEach(c))};i.forEach(c);const l=u.map(A),p=l.filter(m=>d.has(m.id)),g=r?l.map(A):l.filter(m=>!d.has(m.id)),b=r?p.map(m=>s(m,o)):p.map(A),y=new Map,h=new Map;r&&p.forEach((m,S)=>{y.set(m.id,b[S].id),h.set(b[S].id,m.id)}),b.forEach(m=>{const S=r?h.get(m.id):m.id,L=S?n.get(S):null;L&&(r&&(m.parentId=L.parentId&&y.has(L.parentId)&&y.get(L.parentId)||null),m.listId=t.listId)});const f=i.map(m=>y.get(m)||m),x=[...g,...b],D=M(g),C=w(t.listId,t.parentId),z=[...D.get(C)||[]],E=t.beforeId?z.indexOf(t.beforeId):z.length,F=E>=0?E:z.length;z.splice(F,0,...f),D.set(C,z),M(b).forEach((m,S)=>{const[,L]=S.split("::");(L||"")!=="__root__"&&D.set(S,[...m])});const I=T(x);f.forEach(m=>{const S=I.get(m);S&&(S.parentId=t.parentId,S.listId=t.listId)});const P=[],k=new Set,R=(m,S)=>{(D.get(w(m,S))||[]).forEach((N,le)=>{const O=I.get(N);!O||k.has(N)||(k.add(N),O.listId=m,O.parentId=S,O.order=le,P.push(O),R(m,N))})};return e.forEach(m=>R(m.id,null)),x.forEach(m=>{k.has(m.id)||(m.parentId=null,P.push(m))}),{items:P.map(A),insertedRootIds:f}}function M(u){const e=new Map;return u.forEach(t=>{const i=w(t.listId,t.parentId),r=e.get(i);r?r.push(t.id):e.set(i,[t.id])}),e}function T(u){return new Map(u.map(e=>[e.id,e]))}function ie(u){const e=new Set,t=[];return u.forEach((i,r)=>{const s=typeof i?.id=="string"&&i.id.trim()?i.id.trim():`list-${r+1}`;e.has(s)||(e.add(s),t.push({id:s,label:typeof i?.label=="string"&&i.label.trim()?i.label.trim():`List ${r+1}`,description:typeof i?.description=="string"?i.description:"",emptyLabel:typeof i?.emptyLabel=="string"&&i.emptyLabel.trim()?i.emptyLabel.trim():"",orientation:i?.orientation==="horizontal"?"horizontal":"vertical",disabled:!!i?.disabled,cloneOnDrag:!!i?.cloneOnDrag,accepts:Array.isArray(i?.accepts)?i.accepts.filter(n=>typeof n=="string"&&n.trim().length>0):void 0,maxItems:Number.isFinite(i?.maxItems)&&Number(i.maxItems)>=0?Math.floor(Number(i.maxItems)):void 0,maxHeight:oe(i?.maxHeight),...i?.data!==void 0?{data:i.data}:{}}))}),t.length?t:[{id:"default",label:"Items",description:"",emptyLabel:"",orientation:"vertical",disabled:!1,cloneOnDrag:!1}]}function J(u,e){const t=new Set(u.map(o=>o.id)),i=[];e.forEach((o,c)=>{const l=typeof o?.id=="string"&&o.id.trim()?o.id.trim():"",p=typeof o?.label=="string"&&o.label.trim()?o.label.trim():"";if(!l||!p)return;const g=typeof o?.listId=="string"&&t.has(o.listId)?o.listId:u[0].id;i.push({id:l,label:p,listId:g,parentId:typeof o?.parentId=="string"&&o.parentId.trim()?o.parentId.trim():null,description:typeof o?.description=="string"?o.description:"",order:Number.isFinite(o?.order)?Number(o.order):c,disabled:!!o?.disabled,dragDisabled:!!o?.dragDisabled,cloneOnDrag:!!o?.cloneOnDrag,hidden:!!o?.hidden,...o?.data!==void 0?{data:o.data}:{}})});const r=new Map(i.map(o=>[o.id,o]));i.forEach(o=>{if(!o.parentId)return;const c=r.get(o.parentId);(!c||c.id===o.id||c.listId!==o.listId)&&(o.parentId=null)});const s=new Map;i.forEach(o=>{const c=w(o.listId,o.parentId),l=s.get(c);l?l.push(o):s.set(c,[o])}),s.forEach(o=>o.sort((c,l)=>c.order-l.order||c.label.localeCompare(l.label)));const n=[],a=new Set,d=(o,c)=>{(s.get(w(o,c))||[]).forEach((p,g)=>{a.has(p.id)||(a.add(p.id),p.order=g,n.push(p),d(o,p.id))})};return u.forEach(o=>d(o.id,null)),i.forEach(o=>{a.has(o.id)||(o.parentId=null,n.push(o))}),n.map(A)}function be(u){return JSON.stringify(u.map(e=>({id:e.id,label:e.label,listId:e.listId,parentId:e.parentId,description:e.description,order:e.order,disabled:e.disabled,dragDisabled:e.dragDisabled,cloneOnDrag:e.cloneOnDrag,hidden:e.hidden,data:e.data})))}function _e(u){return JSON.stringify(u.map(e=>({id:e.id,label:e.label,description:e.description,emptyLabel:e.emptyLabel,orientation:e.orientation,disabled:e.disabled,cloneOnDrag:e.cloneOnDrag,accepts:e.accepts,maxItems:e.maxItems,maxHeight:e.maxHeight,data:e.data})))}function re(u){return JSON.stringify(u)}function Y(u){const e=new Map,t=u.map(i=>{const r=w(i.listId,i.parentId),s=e.get(r)??0;return e.set(r,s+1),{id:i.id,listId:i.listId,parentId:i.parentId,index:s}});return{version:he,records:t}}function se(u){return/class="item[\s"]/.test(u)}function ae(u,e){return e?`${u.label} ${u.description}`.toLowerCase().includes(e.toLowerCase()):!0}function ne(u,e,t,i,r){const s=T(u),n=M(u),a=new Map,d=(l,p)=>{const g=[...n.get(w(l,p))||[]];return r==="label"&&g.sort((b,y)=>{const h=s.get(b),f=s.get(y);return!h||!f?0:h.label.localeCompare(f.label)}),g},o=(l,p,g)=>{const b=[];return d(l,p).forEach(y=>{const h=s.get(y);if(!h||h.hidden)return;const f=o(l,h.id);!ae(h,i)&&f.length===0||(b.push({id:h.id,disabled:h.disabled}),f.length&&b.push(...f))}),b};return Array.from(new Set(u.map(l=>l.listId))).forEach(l=>{a.set(l,o(l,null))}),a}const $=class $ extends de.ElementBase{constructor(){super(),this._lists=ie([]),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._lastLabelsAttr=null,this._canDropCallback=null,this._renderItemFn=null,this._renderListHeaderFn=null,this._renderEmptyStateFn=null,this._labels={},this._hydratedPersistKey=null,this._cloneSeed=1,this._dragImage=null,this._dragImageOffset={x:-14,y:-14},this._pendingFocusId=null,this._pointerGesture=null,this._pendingDropTarget=null,this._pendingTimer=null,this._focusWasInside=!1,this._revealPending=!1,this._externalTarget=null,this._nestModifier=!1,this._lastPointer=null,this._suppressAttributeRender=!1,this._autoScrollFrame=0,this._autoScrollPoint=null,this._autoScrollTick=()=>{this._autoScrollFrame=0;const e=this._autoScrollPoint;if(!e||!this._dragState||this._dragState.keyboard)return;const t=this.ownerDocument?.defaultView;let i=this._scrollOwn(e.x,e.y);const r=this._peerUnder(e.x,e.y);r&&r._scrollOwn(e.x,e.y)&&(i=!0);const s=ue(this),n=s?s.getBoundingClientRect():null,a=Math.max(0,n?n.top:0),d=Math.min(t?.innerHeight??0,n?n.bottom:1/0),o=V(e.y,a,d);o&&(s?s.scrollTop+=o:t?.scrollBy(0,o),i=!0),i&&(this._retarget(e.x,e.y,{timestamp:performance.now()}),this._autoScrollFrame=requestAnimationFrame(this._autoScrollTick))},this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onDragStart=this._onDragStart.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._onTouchMove=this._onTouchMove.bind(this),this._onContextMenu=this._onContextMenu.bind(this),this._onDocumentKeyDown=this._onDocumentKeyDown.bind(this),this._onDocumentKeyUp=this._onDocumentKeyUp.bind(this)}static get observedAttributes(){return["lists","items","selection","filter-query","sort","persist-key","allow-filtered-drag","allow-nesting","drop-indicator-visibility","dropzone-style","drag-preview-size","drag-handle-mode","drag-handle-selector","custom-item-rendering","show-selection-badge","nest-trigger","touch-hold-delay","list-max-height","group","labels","hide-toolbar","disabled"]}shouldRenderOnAttributeChange(e,t,i){return this._suppressAttributeRender?!["lists","items","selection"].includes(e):!0}attributeChangedCallback(e,t,i){if(t!==i&&this.isConnected){if(e==="selection"&&!this._suppressAttributeRender&&this._canSyncInteractiveStateInPlace()){this._syncSelectionFromAttribute(i??null),this._syncSelectionVisualState();return}if(e==="show-selection-badge"&&this._canSyncInteractiveStateInPlace()){this._syncSelectionVisualState();return}super.attributeChangedCallback(e,t,i)}}connectedCallback(){super.connectedCallback(),$._instances.add(this),this.root.addEventListener("click",this._onClick),this.root.addEventListener("keydown",this._onKeyDown),this.root.addEventListener("dragstart",this._onDragStart),this.root.addEventListener("pointerdown",this._onPointerDown),this.root.addEventListener("focusin",this._onFocusIn),this.root.addEventListener("touchmove",this._onTouchMove,{passive:!1}),this.root.addEventListener("contextmenu",this._onContextMenu),this.ownerDocument?.addEventListener("keydown",this._onDocumentKeyDown,!0),this.ownerDocument?.addEventListener("keyup",this._onDocumentKeyUp,!0),this.ownerDocument?.addEventListener("pointermove",this._onPointerMove,!0),this.ownerDocument?.addEventListener("pointerup",this._onPointerUp,!0),this.ownerDocument?.addEventListener("pointercancel",this._onPointerCancel,!0)}disconnectedCallback(){this.root.removeEventListener("click",this._onClick),this.root.removeEventListener("keydown",this._onKeyDown),this.root.removeEventListener("dragstart",this._onDragStart),this.root.removeEventListener("pointerdown",this._onPointerDown),this.root.removeEventListener("focusin",this._onFocusIn),this.root.removeEventListener("touchmove",this._onTouchMove),this.root.removeEventListener("contextmenu",this._onContextMenu),this._clearHoldTimer(),this.ownerDocument?.removeEventListener("keydown",this._onDocumentKeyDown,!0),this.ownerDocument?.removeEventListener("keyup",this._onDocumentKeyUp,!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._removeDragImage(),this._pendingTimer&&clearTimeout(this._pendingTimer),this._pendingTimer=null,$._instances.delete(this),this._setExternal(null),this._showExternalTarget(null),super.disconnectedCallback()}get lists(){return this._lists.map(G)}set lists(e){this.setAttribute("lists",JSON.stringify(e??[]))}get items(){return this._items.map(q)}set items(e){this.setAttribute("items",JSON.stringify(e??[]))}get canDrop(){return this._canDropCallback}set canDrop(e){this._canDropCallback=typeof e=="function"?e:null}get renderItem(){return this._renderItemFn}set renderItem(e){this._renderItemFn=typeof e=="function"?e:null,this.requestRender()}get renderListHeader(){return this._renderListHeaderFn}set renderListHeader(e){this._renderListHeaderFn=typeof e=="function"?e:null,this.requestRender()}get renderEmptyState(){return this._renderEmptyStateFn}set renderEmptyState(e){this._renderEmptyStateFn=typeof e=="function"?e:null,this.requestRender()}get group(){return this._group()}set group(e){e?this.setAttribute("group",e):this.removeAttribute("group")}_group(){return this.getAttribute("group")?.trim()||""}get labels(){return{...X,...this._labels}}set labels(e){!e||!Object.keys(e).length?this.removeAttribute("labels"):this.setAttribute("labels",JSON.stringify(e))}_t(e,t){return(this._labels[e]??X[e]).replace(/\{(\w+)\}/g,(r,s)=>String(t?.[s]??""))}get selection(){return[...this._selection]}set selection(e){this.setAttribute("selection",JSON.stringify(e??[]))}get sort(){return this.getAttribute("sort")==="label"?"label":"manual"}set sort(e){!e||e==="manual"?this.removeAttribute("sort"):this.setAttribute("sort",e)}get filterQuery(){return this.getAttribute("filter-query")||""}set filterQuery(e){e?this.setAttribute("filter-query",e):this.removeAttribute("filter-query")}select(e){this._setSelection(e,"api")}clearSelection(){this._setSelection([],"api")}cancelDrag(){this._cancelDrag(!0)}focusItem(e){this._items.some(t=>t.id===e)&&(this._focusedId=e,this._pendingFocusId=e,this._revealPending=!0,!this._applyInteractiveStateInPlace({restoreFocus:!0})&&this.requestRender())}moveSelection(e){this._syncSelectionFromAttribute(this.getAttribute("selection"));const t=this._selectedRootIds();return t.length?this._commitMove({listId:e.targetListId,parentId:e.parentId??null,beforeId:e.beforeId??null,mode:e.mode??(e.parentId?"inside":"before")},t,!!e.clone,e.source??"api"):!1}moveSelectionTo(e,t){if(!e||!(e instanceof $))return!1;if(e===this)return this.moveSelection(t);this._syncSelectionFromAttribute(this.getAttribute("selection"));const i=this._selectedRootIds();return i.length?this._transferTo(e,{listId:t.targetListId,parentId:t.parentId??null,beforeId:t.beforeId??null,mode:t.mode??(t.parentId?"inside":"before")},i,!!t.clone,t.source??"api"):!1}getPersistenceSnapshot(){return Y(this._items)}render(){this._syncStateFromAttributes();const e=this._measureItemShellRects(),t=new Set(this._draggingIds()),i=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=ne(n,i,t,this.filterQuery,this.sort),c=this._resolvedFocusedId(o),l=this._isDragLocked(),p=this._selection.length,g=this.getAttribute("allow-nesting")!=="false",b=this.getAttribute("drop-indicator-visibility")==="always"?"always":"active",y=this._dropzoneStyle(),h=this.getAttribute("show-selection-badge")!=="false",f=this._dragHandleMode(),x=this._usesCustomHandleSelector(),D=l?this.sort==="label"?this._t("hintPausedSort"):this.filterQuery&&!this.hasAttribute("allow-filtered-drag")?this._t("hintPausedFilter"):this._t("hintDisabled"):this._dragState?.keyboard?this._t("hintKeyboard"):f==="item"?this._t("hintItem"):x?this._t("hintCustom"):this._t("hintHandle"),C=this.hasAttribute("hide-toolbar"),z=g&&!l&&!this._dragState?.keyboard?this._t(this._nestTrigger()==="area"?"hintNestArea":this._nestTrigger()==="modifier"?"hintNestModifier":"hintNestGutter"):"",E=`
875
- <style>${ge}</style>
874
+ `;function j(u){if(!u)return[];try{const t=JSON.parse(u);return Array.isArray(t)?t:[]}catch{return[]}}function tt(u){if(u===void 0)return"";let t;try{t=JSON.stringify(u)??""}catch{return""}let e=5381;for(let i=0;i<t.length;i+=1)e=(e<<5)+e+t.charCodeAt(i)|0;return(e>>>0).toString(36)}function mt(u){if(!u)return{};try{const t=JSON.parse(u);if(!t||typeof t!="object"||Array.isArray(t))return{};const e={};return Object.keys(X).forEach(i=>{typeof t[i]=="string"&&(e[i]=t[i])}),e}catch{return{}}}function ot(u){if(typeof u=="number")return Number.isFinite(u)&&u>0?`${u}px`:void 0;if(typeof u!="string")return;const t=u.trim();return/^(?:\d+\.?\d*|\.\d+)(?:px|rem|em|ch|vh|svh|dvh|vw|%)$/.test(t)?t:void 0}function v(u){return u.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function w(u,t){return`${u}::${t??"__root__"}`}function et(u){return u?[u.listId,u.parentId??"",u.beforeId??"",u.mode].join("::"):""}function H(u,t){return et(u)===et(t)}function ft(u){return u==="item"?"item":"handle"}function z(u){return{...u}}function B(u){if(u==null||typeof u!="object")return u;try{return JSON.parse(JSON.stringify(u))}catch{return u}}function q(u){const t={...u};return u.data!==void 0&&(t.data=B(u.data)),t}function G(u){const t={...u};return u.data!==void 0&&(t.data=B(u.data)),t}function U(u,t,e,i,r,s){const n=T(u),a=M(u),d=new Set,o=[],c=m=>{const S=n.get(m);!S||d.has(m)||(d.add(m),o.push(m),(a.get(w(S.listId,m))||[]).forEach(c))};i.forEach(c);const l=u.map(z),p=l.filter(m=>d.has(m.id)),g=r?l.map(z):l.filter(m=>!d.has(m.id)),b=r?p.map(m=>s(m,o)):p.map(z),y=new Map,h=new Map;r&&p.forEach((m,S)=>{y.set(m.id,b[S].id),h.set(b[S].id,m.id)}),b.forEach(m=>{const S=r?h.get(m.id):m.id,L=S?n.get(S):null;L&&(r&&(m.parentId=L.parentId&&y.has(L.parentId)&&y.get(L.parentId)||null),m.listId=e.listId)});const f=i.map(m=>y.get(m)||m),x=[...g,...b],D=M(g),C=w(e.listId,e.parentId),A=[...D.get(C)||[]],E=e.beforeId?A.indexOf(e.beforeId):A.length,F=E>=0?E:A.length;A.splice(F,0,...f),D.set(C,A),M(b).forEach((m,S)=>{const[,L]=S.split("::");(L||"")!=="__root__"&&D.set(S,[...m])});const I=T(x);f.forEach(m=>{const S=I.get(m);S&&(S.parentId=e.parentId,S.listId=e.listId)});const P=[],k=new Set,R=(m,S)=>{(D.get(w(m,S))||[]).forEach((N,lt)=>{const O=I.get(N);!O||k.has(N)||(k.add(N),O.listId=m,O.parentId=S,O.order=lt,P.push(O),R(m,N))})};return t.forEach(m=>R(m.id,null)),x.forEach(m=>{k.has(m.id)||(m.parentId=null,P.push(m))}),{items:P.map(z),insertedRootIds:f}}function M(u){const t=new Map;return u.forEach(e=>{const i=w(e.listId,e.parentId),r=t.get(i);r?r.push(e.id):t.set(i,[e.id])}),t}function T(u){return new Map(u.map(t=>[t.id,t]))}function it(u){const t=new Set,e=[];return u.forEach((i,r)=>{const s=typeof i?.id=="string"&&i.id.trim()?i.id.trim():`list-${r+1}`;t.has(s)||(t.add(s),e.push({id:s,label:typeof i?.label=="string"&&i.label.trim()?i.label.trim():`List ${r+1}`,description:typeof i?.description=="string"?i.description:"",emptyLabel:typeof i?.emptyLabel=="string"&&i.emptyLabel.trim()?i.emptyLabel.trim():"",orientation:i?.orientation==="horizontal"?"horizontal":"vertical",disabled:!!i?.disabled,cloneOnDrag:!!i?.cloneOnDrag,accepts:Array.isArray(i?.accepts)?i.accepts.filter(n=>typeof n=="string"&&n.trim().length>0):void 0,maxItems:Number.isFinite(i?.maxItems)&&Number(i.maxItems)>=0?Math.floor(Number(i.maxItems)):void 0,maxHeight:ot(i?.maxHeight),...i?.data!==void 0?{data:i.data}:{}}))}),e.length?e:[{id:"default",label:"Items",description:"",emptyLabel:"",orientation:"vertical",disabled:!1,cloneOnDrag:!1}]}function J(u,t){const e=new Set(u.map(o=>o.id)),i=[];t.forEach((o,c)=>{const l=typeof o?.id=="string"&&o.id.trim()?o.id.trim():"",p=typeof o?.label=="string"&&o.label.trim()?o.label.trim():"";if(!l||!p)return;const g=typeof o?.listId=="string"&&e.has(o.listId)?o.listId:u[0].id;i.push({id:l,label:p,listId:g,parentId:typeof o?.parentId=="string"&&o.parentId.trim()?o.parentId.trim():null,description:typeof o?.description=="string"?o.description:"",order:Number.isFinite(o?.order)?Number(o.order):c,disabled:!!o?.disabled,dragDisabled:!!o?.dragDisabled,cloneOnDrag:!!o?.cloneOnDrag,hidden:!!o?.hidden,...o?.data!==void 0?{data:o.data}:{}})});const r=new Map(i.map(o=>[o.id,o]));i.forEach(o=>{if(!o.parentId)return;const c=r.get(o.parentId);(!c||c.id===o.id||c.listId!==o.listId)&&(o.parentId=null)});const s=new Map;i.forEach(o=>{const c=w(o.listId,o.parentId),l=s.get(c);l?l.push(o):s.set(c,[o])}),s.forEach(o=>o.sort((c,l)=>c.order-l.order||c.label.localeCompare(l.label)));const n=[],a=new Set,d=(o,c)=>{(s.get(w(o,c))||[]).forEach((p,g)=>{a.has(p.id)||(a.add(p.id),p.order=g,n.push(p),d(o,p.id))})};return u.forEach(o=>d(o.id,null)),i.forEach(o=>{a.has(o.id)||(o.parentId=null,n.push(o))}),n.map(z)}function bt(u){return JSON.stringify(u.map(t=>({id:t.id,label:t.label,listId:t.listId,parentId:t.parentId,description:t.description,order:t.order,disabled:t.disabled,dragDisabled:t.dragDisabled,cloneOnDrag:t.cloneOnDrag,hidden:t.hidden,data:t.data})))}function _t(u){return JSON.stringify(u.map(t=>({id:t.id,label:t.label,description:t.description,emptyLabel:t.emptyLabel,orientation:t.orientation,disabled:t.disabled,cloneOnDrag:t.cloneOnDrag,accepts:t.accepts,maxItems:t.maxItems,maxHeight:t.maxHeight,data:t.data})))}function rt(u){return JSON.stringify(u)}function Y(u){const t=new Map,e=u.map(i=>{const r=w(i.listId,i.parentId),s=t.get(r)??0;return t.set(r,s+1),{id:i.id,listId:i.listId,parentId:i.parentId,index:s}});return{version:ht,records:e}}function st(u){return/class="item[\s"]/.test(u)}function at(u,t){return t?`${u.label} ${u.description}`.toLowerCase().includes(t.toLowerCase()):!0}function nt(u,t,e,i,r){const s=T(u),n=M(u),a=new Map,d=(l,p)=>{const g=[...n.get(w(l,p))||[]];return r==="label"&&g.sort((b,y)=>{const h=s.get(b),f=s.get(y);return!h||!f?0:h.label.localeCompare(f.label)}),g},o=(l,p,g)=>{const b=[];return d(l,p).forEach(y=>{const h=s.get(y);if(!h||h.hidden)return;const f=o(l,h.id);!at(h,i)&&f.length===0||(b.push({id:h.id,disabled:h.disabled}),f.length&&b.push(...f))}),b};return Array.from(new Set(u.map(l=>l.listId))).forEach(l=>{a.set(l,o(l,null))}),a}const $=class $ extends dt.ElementBase{constructor(){super(),this._lists=it([]),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._lastLabelsAttr=null,this._canDropCallback=null,this._renderItemFn=null,this._renderListHeaderFn=null,this._renderEmptyStateFn=null,this._labels={},this._hydratedPersistKey=null,this._cloneSeed=1,this._dragImage=null,this._dragImageOffset={x:-14,y:-14},this._pendingFocusId=null,this._pointerGesture=null,this._pendingDropTarget=null,this._pendingTimer=null,this._focusWasInside=!1,this._revealPending=!1,this._externalTarget=null,this._nestModifier=!1,this._lastPointer=null,this._suppressAttributeRender=!1,this._autoScrollFrame=0,this._autoScrollPoint=null,this._autoScrollTick=()=>{this._autoScrollFrame=0;const t=this._autoScrollPoint;if(!t||!this._dragState||this._dragState.keyboard)return;const e=this.ownerDocument?.defaultView;let i=this._scrollOwn(t.x,t.y);const r=this._peerUnder(t.x,t.y);r&&r._scrollOwn(t.x,t.y)&&(i=!0);const s=ut(this),n=s?s.getBoundingClientRect():null,a=Math.max(0,n?n.top:0),d=Math.min(e?.innerHeight??0,n?n.bottom:1/0),o=V(t.y,a,d);o&&(s?s.scrollTop+=o:e?.scrollBy(0,o),i=!0),i&&(this._retarget(t.x,t.y,{timestamp:performance.now()}),this._autoScrollFrame=requestAnimationFrame(this._autoScrollTick))},this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onDragStart=this._onDragStart.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._onTouchMove=this._onTouchMove.bind(this),this._onContextMenu=this._onContextMenu.bind(this),this._onDocumentKeyDown=this._onDocumentKeyDown.bind(this),this._onDocumentKeyUp=this._onDocumentKeyUp.bind(this)}static get observedAttributes(){return["lists","items","selection","filter-query","sort","persist-key","allow-filtered-drag","allow-nesting","drop-indicator-visibility","dropzone-style","drag-preview-size","drag-handle-mode","drag-handle-selector","custom-item-rendering","show-selection-badge","nest-trigger","touch-hold-delay","list-max-height","group","labels","hide-toolbar","disabled"]}shouldRenderOnAttributeChange(t,e,i){return this._suppressAttributeRender?!["lists","items","selection"].includes(t):!0}attributeChangedCallback(t,e,i){if(e!==i&&this.isConnected){if(t==="selection"&&!this._suppressAttributeRender&&this._canSyncInteractiveStateInPlace()){this._syncSelectionFromAttribute(i??null),this._syncSelectionVisualState();return}if(t==="show-selection-badge"&&this._canSyncInteractiveStateInPlace()){this._syncSelectionVisualState();return}super.attributeChangedCallback(t,e,i)}}connectedCallback(){super.connectedCallback(),$._instances.add(this),this.root.addEventListener("click",this._onClick),this.root.addEventListener("keydown",this._onKeyDown),this.root.addEventListener("dragstart",this._onDragStart),this.root.addEventListener("pointerdown",this._onPointerDown),this.root.addEventListener("focusin",this._onFocusIn),this.root.addEventListener("touchmove",this._onTouchMove,{passive:!1}),this.root.addEventListener("contextmenu",this._onContextMenu),this.ownerDocument?.addEventListener("keydown",this._onDocumentKeyDown,!0),this.ownerDocument?.addEventListener("keyup",this._onDocumentKeyUp,!0),this.ownerDocument?.addEventListener("pointermove",this._onPointerMove,!0),this.ownerDocument?.addEventListener("pointerup",this._onPointerUp,!0),this.ownerDocument?.addEventListener("pointercancel",this._onPointerCancel,!0)}disconnectedCallback(){this.root.removeEventListener("click",this._onClick),this.root.removeEventListener("keydown",this._onKeyDown),this.root.removeEventListener("dragstart",this._onDragStart),this.root.removeEventListener("pointerdown",this._onPointerDown),this.root.removeEventListener("focusin",this._onFocusIn),this.root.removeEventListener("touchmove",this._onTouchMove),this.root.removeEventListener("contextmenu",this._onContextMenu),this._clearHoldTimer(),this.ownerDocument?.removeEventListener("keydown",this._onDocumentKeyDown,!0),this.ownerDocument?.removeEventListener("keyup",this._onDocumentKeyUp,!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._removeDragImage(),this._pendingTimer&&clearTimeout(this._pendingTimer),this._pendingTimer=null,$._instances.delete(this),this._setExternal(null),this._showExternalTarget(null),super.disconnectedCallback()}get lists(){return this._lists.map(G)}set lists(t){this.setAttribute("lists",JSON.stringify(t??[]))}get items(){return this._items.map(q)}set items(t){this.setAttribute("items",JSON.stringify(t??[]))}get canDrop(){return this._canDropCallback}set canDrop(t){this._canDropCallback=typeof t=="function"?t:null}get renderItem(){return this._renderItemFn}set renderItem(t){this._renderItemFn=typeof t=="function"?t:null,this.requestRender()}get renderListHeader(){return this._renderListHeaderFn}set renderListHeader(t){this._renderListHeaderFn=typeof t=="function"?t:null,this.requestRender()}get renderEmptyState(){return this._renderEmptyStateFn}set renderEmptyState(t){this._renderEmptyStateFn=typeof t=="function"?t:null,this.requestRender()}get group(){return this._group()}set group(t){t?this.setAttribute("group",t):this.removeAttribute("group")}_group(){return this.getAttribute("group")?.trim()||""}get labels(){return{...X,...this._labels}}set labels(t){!t||!Object.keys(t).length?this.removeAttribute("labels"):this.setAttribute("labels",JSON.stringify(t))}_t(t,e){return(this._labels[t]??X[t]).replace(/\{(\w+)\}/g,(r,s)=>String(e?.[s]??""))}get selection(){return[...this._selection]}set selection(t){this.setAttribute("selection",JSON.stringify(t??[]))}get sort(){return this.getAttribute("sort")==="label"?"label":"manual"}set sort(t){!t||t==="manual"?this.removeAttribute("sort"):this.setAttribute("sort",t)}get filterQuery(){return this.getAttribute("filter-query")||""}set filterQuery(t){t?this.setAttribute("filter-query",t):this.removeAttribute("filter-query")}select(t){this._setSelection(t,"api")}clearSelection(){this._setSelection([],"api")}cancelDrag(){this._cancelDrag(!0)}focusItem(t){this._items.some(e=>e.id===t)&&(this._focusedId=t,this._pendingFocusId=t,this._revealPending=!0,!this._applyInteractiveStateInPlace({restoreFocus:!0})&&this.requestRender())}moveSelection(t){this._syncSelectionFromAttribute(this.getAttribute("selection"));const e=this._selectedRootIds();return e.length?this._commitMove({listId:t.targetListId,parentId:t.parentId??null,beforeId:t.beforeId??null,mode:t.mode??(t.parentId?"inside":"before")},e,!!t.clone,t.source??"api"):!1}moveSelectionTo(t,e){if(!t||!(t instanceof $))return!1;if(t===this)return this.moveSelection(e);this._syncSelectionFromAttribute(this.getAttribute("selection"));const i=this._selectedRootIds();return i.length?this._transferTo(t,{listId:e.targetListId,parentId:e.parentId??null,beforeId:e.beforeId??null,mode:e.mode??(e.parentId?"inside":"before")},i,!!e.clone,e.source??"api"):!1}getPersistenceSnapshot(){return Y(this._items)}render(){this._syncStateFromAttributes();const t=this._measureItemShellRects(),e=new Set(this._draggingIds()),i=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=nt(n,i,e,this.filterQuery,this.sort),c=this._resolvedFocusedId(o),l=this._isDragLocked(),p=this._selection.length,g=this.getAttribute("allow-nesting")!=="false",b=this.getAttribute("drop-indicator-visibility")==="always"?"always":"active",y=this._dropzoneStyle(),h=this.getAttribute("show-selection-badge")!=="false",f=this._dragHandleMode(),x=this._usesCustomHandleSelector(),D=l?this.sort==="label"?this._t("hintPausedSort"):this.filterQuery&&!this.hasAttribute("allow-filtered-drag")?this._t("hintPausedFilter"):this._t("hintDisabled"):this._dragState?.keyboard?this._t("hintKeyboard"):f==="item"?this._t("hintItem"):x?this._t("hintCustom"):this._t("hintHandle"),C=this.hasAttribute("hide-toolbar"),A=g&&!l&&!this._dragState?.keyboard?this._t(this._nestTrigger()==="area"?"hintNestArea":this._nestTrigger()==="modifier"?"hintNestModifier":"hintNestGutter"):"",E=`
875
+ <style>${gt}</style>
876
876
  <div
877
877
  class="root"
878
878
  part="root"
@@ -882,14 +882,14 @@
882
882
  data-dropzone-style="${y}"
883
883
  >
884
884
  <div class="toolbar" part="toolbar"${C?' data-hidden="true"':""}>
885
- <div class="helper" id="ui-sortable-helper">${v(z?`${D} ${z}`:D)}</div>
885
+ <div class="helper" id="ui-sortable-helper">${v(A?`${D} ${A}`:D)}</div>
886
886
  <div class="helper selection-summary" data-count="${p}">
887
887
  <span class="selection-pill" part="selection-count">${p}</span>
888
888
  <span class="selection-text">${v(p===1?this._t("selectedOne"):this._t("selectedMany"))}</span>
889
889
  </div>
890
890
  </div>
891
891
  <div class="lists" part="lists">
892
- ${this._lists.map(_=>{const I=o.get(_.id)||[],P=I.length?this._renderListTree(n,_,c,t,g,a,h):"",k=_.orientation==="horizontal"?void 0:_.maxHeight??oe(this.getAttribute("list-max-height")),R=this._items.filter(L=>L.listId===_.id).length,m=_.maxItems!==void 0&&R>=_.maxItems,S=_.disabled?this._t("listReadOnly"):m?this._t("listFull",{max:_.maxItems??0}):_.cloneOnDrag?this._t("listClone"):_.accepts?.length?this._t("listAccepts",{lists:_.accepts.join(", ")}):"";return`
892
+ ${this._lists.map(_=>{const I=o.get(_.id)||[],P=I.length?this._renderListTree(n,_,c,e,g,a,h):"",k=_.orientation==="horizontal"?void 0:_.maxHeight??ot(this.getAttribute("list-max-height")),R=this._items.filter(L=>L.listId===_.id).length,m=_.maxItems!==void 0&&R>=_.maxItems,S=_.disabled?this._t("listReadOnly"):m?this._t("listFull",{max:_.maxItems??0}):_.cloneOnDrag?this._t("listClone"):_.accepts?.length?this._t("listAccepts",{lists:_.accepts.join(", ")}):"";return`
893
893
  <section
894
894
  class="list"
895
895
  part="list"
@@ -897,7 +897,7 @@
897
897
  data-orientation="${_.orientation}"
898
898
  data-disabled="${_.disabled}"
899
899
  data-full="${m}"
900
- ${this._renderListHeaderFn||this._renderEmptyStateFn?`data-rev="${ee(_.data)}"`:""}
900
+ ${this._renderListHeaderFn||this._renderEmptyStateFn?`data-rev="${tt(_.data)}"`:""}
901
901
  aria-label="${v(_.label)}"
902
902
  >
903
903
  <header class="list-header">
@@ -919,30 +919,30 @@
919
919
  </div>
920
920
  <div class="sr-only" aria-live="polite" aria-atomic="true">${v(this._liveMessage)}</div>
921
921
  </div>
922
- `,F=this._captureScroll();this._focusWasInside=!!this.root.activeElement,this.setContent(E),this._restoreScroll(F),this._fillCustomTargets(),queueMicrotask(()=>{this._restorePendingFocus(),this._dragState?.keyboard&&this.root.querySelector(".item-placeholder")?.scrollIntoView?.({block:"nearest",inline:"nearest"}),this._applyCurrentDropTargetVisualState(),this._applyLiveMessage(),this._animateItemShellReflow(e)})}_syncStateFromAttributes(){const e=this.getAttribute("lists");e!==this._lastListsAttr&&(this._lastListsAttr=e,this._lists=ie(j(e)));const t=this.getAttribute("items");if(t!==this._lastItemsAttr){this._lastItemsAttr=t,this._items=J(this._lists,j(t)),this._lastSelectionAttr=null;const s=this.getAttribute("persist-key");s&&this._hydratedPersistKey!==s&&(this._items=this._restorePersistedItems(s,this._items),this._hydratedPersistKey=s)}const i=this.getAttribute("selection");i!==this._lastSelectionAttr&&this._syncSelectionFromAttribute(i);const r=this.getAttribute("labels");r!==this._lastLabelsAttr&&(this._lastLabelsAttr=r,this._labels=me(r)),this._focusedId||(this._focusedId=this._items.find(s=>!s.hidden)?.id||null)}_restorePersistedItems(e,t){try{const i=window.localStorage.getItem(e);if(!i)return t;const r=JSON.parse(i);if(!r||typeof r!="object"||!Array.isArray(r.records))return t;const s=new Map(r.records.map(a=>[a.id,a])),n=t.map((a,d)=>{const o=s.get(a.id);return o?{...a,listId:this._lists.some(c=>c.id===o.listId)?o.listId:a.listId,parentId:typeof o.parentId=="string"?o.parentId:null,order:Number.isFinite(o.index)?o.index:d}:{...a,order:d}});return J(this._lists,n)}catch{return t}}_resolvedFocusedId(e){const t=new Set(Array.from(e.values()).flat().map(r=>r.id));return this._focusedId&&t.has(this._focusedId)?this._focusedId:Array.from(e.values()).flat().find(r=>!r.disabled)?.id||null}_restorePendingFocus(){const e=this._pendingFocusId||(this._focusWasInside?this._focusedId:null);if(this._focusWasInside=!1,!e)return;const t=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/"/g,'\\"'),i=this.root.querySelector(`.item[data-id="${t}"]`);i&&(document.activeElement!==i&&i.focus({preventScroll:!0}),this._revealPending?(this._revealPending=!1,i.scrollIntoView?.({block:"nearest",inline:"nearest"})):this._revealInBoard(i),this._pendingFocusId=null)}_captureScroll(){const e=this.root.querySelector(".lists");if(!e)return null;const t=new Map;return this.root.querySelectorAll(".list[data-list-id]").forEach(i=>{const r=i.querySelector(".items"),s=i.getAttribute("data-list-id");r&&s&&(r.scrollLeft||r.scrollTop)&&t.set(s,{left:r.scrollLeft,top:r.scrollTop})}),{board:e.scrollLeft,lists:t}}_restoreScroll(e){if(!e)return;const t=this.root.querySelector(".lists");t&&e.board&&(t.scrollLeft=e.board),e.lists.size&&this.root.querySelectorAll(".list[data-list-id]").forEach(i=>{const r=e.lists.get(i.getAttribute("data-list-id")||""),s=i.querySelector(".items");!r||!s||(s.scrollLeft=r.left,s.scrollTop=r.top)})}_revealInBoard(e){const t=this.root.querySelector(".lists"),i=e.closest(".list");if(!t||!i||t.scrollWidth<=t.clientWidth+1)return;const r=t.getBoundingClientRect(),s=i.getBoundingClientRect();s.left<r.left?t.scrollLeft-=r.left-s.left+4:s.right>r.right&&(t.scrollLeft+=Math.min(s.right-r.right+4,s.left-r.left))}_escapeSelectorValue(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/"/g,'\\"')}_findDropzone(e){const t=this._escapeSelectorValue(e.listId),i=this._escapeSelectorValue(e.parentId??""),r=this._escapeSelectorValue(e.beforeId??""),s=this._escapeSelectorValue(e.mode);return this.root.querySelector(`.dropzone[data-list-id="${t}"][data-parent-id="${i}"][data-before-id="${r}"][data-mode="${s}"]`)}_findItemElement(e){const t=this._escapeSelectorValue(e);return this.root.querySelector(`.item[data-id="${t}"]`)}_dragHandleMode(){return fe(this.getAttribute("drag-handle-mode"))}_nestTrigger(){const e=this.getAttribute("nest-trigger");return e==="modifier"||e==="area"?e:"gutter"}_dropzoneStyle(){return this.getAttribute("dropzone-style")==="container"?"container":"indicator"}_usesCustomHandleSelector(){return!!this.getAttribute("drag-handle-selector")?.trim()}_dragActivatorFromPath(e){const t=e.find(n=>n instanceof HTMLElement&&!!n.getAttribute("data-drag-trigger"));if(!t)return null;const i=t.getAttribute("data-drag-trigger"),r=i==="item"?"item":i==="custom"?"custom":"handle",s=t.getAttribute("data-id")||t.closest(".item[data-id]")?.getAttribute("data-id");return s?{element:t,id:s,kind:r}:null}_setDropTargetVisualState(e,t){if(!e)return;const i=this._findDropzone(e);i&&(i.setAttribute("data-active",t?"true":"false"),t?this._syncDropzoneContainerSize(i,e):this._clearDropzoneContainerSize(i)),e.mode==="inside"&&e.parentId&&this._findItemElement(e.parentId)?.setAttribute("data-drop-inside-active",t?"true":"false")}_applyCurrentDropTargetVisualState(e){this._setDropTargetVisualState(e??null,!1),this._setDropTargetVisualState(this._dragState?.dropTarget??null,!0)}_applyLiveMessage(){const e=this.root.querySelector(".sr-only[aria-live]");e&&(e.textContent=this._liveMessage)}_canSyncInteractiveStateInPlace(){return!!this.root.querySelector(".root")&&!this._dragState}_applyInteractiveStateInPlace(e){return this._canSyncInteractiveStateInPlace()?(this._syncSelectionVisualState(),e?.restoreFocus&&this._restorePendingFocus(),this._applyLiveMessage(),!0):!1}_fillCustomTargets(e){if(!this._renderItemFn&&!this._renderListHeaderFn&&!this._renderEmptyStateFn)return;const t=this._isDragLocked(),i=new Map(this._lists.map(d=>[d.id,d])),r=(d,o)=>{let c;try{c=o()}catch(l){console.error("ui-sortable: a render function threw; the built-in markup is shown.",l);return}typeof c=="string"?d.innerHTML=c:c&&typeof c.nodeType=="number"&&d.replaceChildren(c)},s=this._renderItemFn;if(s){const d=new Map(this._items.map(l=>[l.id,l])),o=new Set(this._selection),c=this.getAttribute("drag-handle-selector")?.trim()||"";this.root.querySelectorAll(".item-custom-content[data-item-content-target]").forEach(l=>{const p=l.getAttribute("data-item-content-target")||"";if(e?!e.itemIds.has(p):l.hasChildNodes())return;const g=d.get(p);if(!g)return;e&&l.replaceChildren();const b=i.get(g.listId);r(l,()=>s(q(g),{selected:o.has(p),disabled:g.disabled,dragDisabled:g.dragDisabled,cloneOnDrag:g.cloneOnDrag||!!b?.cloneOnDrag,list:b?G(b):void 0})),c&&this._markCustomHandles(l,p,c)})}if(e)return;const n=this._renderListHeaderFn;n&&this.root.querySelectorAll(".list-custom-header[data-list-header-target]").forEach(d=>{if(d.hasChildNodes())return;const o=i.get(d.getAttribute("data-list-header-target")||"");if(!o)return;const c=this._items.filter(l=>l.listId===o.id).length;r(d,()=>n(G(o),{itemCount:c,dragLocked:t}))});const a=this._renderEmptyStateFn;a&&this.root.querySelectorAll(".list-custom-empty[data-list-empty-target]").forEach(d=>{if(d.hasChildNodes())return;const o=i.get(d.getAttribute("data-list-empty-target")||"");if(!o)return;const c=this._items.filter(l=>l.listId===o.id).length;r(d,()=>a(G(o),{itemCount:c,dragLocked:t,filterQuery:this.filterQuery}))})}_markCustomHandles(e,t,i){let r;try{r=e.querySelectorAll(i)}catch{return}r.forEach(s=>{s.setAttribute("data-sortable-custom-handle",""),s.setAttribute("data-drag-trigger","custom"),s.setAttribute("data-id",t),s.hasAttribute("tabindex")||s.setAttribute("tabindex","-1")})}_hasCustomItemRendering(){return this.hasAttribute("custom-item-rendering")||!!this._renderItemFn}_syncSelectionFromAttribute(e){this._lastSelectionAttr=e;const t=new Set(this._items.map(i=>i.id));this._selection=j(e).filter(i=>t.has(i)),!this._selection.length&&this._focusedId&&!t.has(this._focusedId)&&(this._focusedId=null)}_syncSelectionVisualState(){const e=new Set(this._selection),t=this.getAttribute("show-selection-badge")!=="false",i=new Set;this.root.querySelectorAll(".item[data-id]").forEach(n=>{const a=n.getAttribute("data-id");if(!a)return;const d=e.has(a);n.getAttribute("data-selected")==="true"!==d&&i.add(a);const o=this._focusedId===a;n.setAttribute("data-selected",d?"true":"false"),n.setAttribute("aria-selected",d?"true":"false"),n.setAttribute("data-focused",o?"true":"false"),n.setAttribute("tabindex",o?"0":"-1");const c=n.querySelector('[data-selection-badge="true"]');if(c){const l=d&&t;c.hidden=!l,c.textContent=l?this._t("badgeSelected"):""}}),i.size&&this._renderItemFn&&this._fillCustomTargets({itemIds:i}),this.root.querySelector(".selection-summary")?.setAttribute("data-count",String(this._selection.length));const r=this.root.querySelector(".selection-pill");r&&(r.textContent=String(this._selection.length));const s=this.root.querySelector(".selection-text");s&&(s.textContent=this._selection.length===1?this._t("selectedOne"):this._t("selectedMany"))}_clearDropzoneContainerSize(e){e.style.removeProperty("--ui-sortable-dropzone-match-block-size"),e.style.removeProperty("--ui-sortable-dropzone-match-inline-size")}_dropzoneReferenceElement(e,t){if(e.mode==="inside"&&e.parentId)return this._findItemElement(e.parentId);let i=t.nextElementSibling;for(;i;){if(i instanceof HTMLElement&&i.classList.contains("item-shell"))return i.querySelector(".item[data-id]");i=i.nextElementSibling}let r=t.previousElementSibling;for(;r;){if(r instanceof HTMLElement&&r.classList.contains("item-shell"))return r.querySelector(".item[data-id]");r=r.previousElementSibling}const s=this._escapeSelectorValue(e.listId),n=this.root.querySelector(`.list[data-list-id="${s}"] .items`),a=n?.querySelector(".item[data-id]");return a||n||null}_syncDropzoneContainerSize(e,t){if(this._clearDropzoneContainerSize(e),this._dropzoneStyle()!=="container")return;const i=this._dropzoneReferenceElement(t,e);if(!i)return;const r=i.getBoundingClientRect();e.style.setProperty("--ui-sortable-dropzone-match-block-size",`${Math.max(76,Math.round(r.height))}px`),e.style.setProperty("--ui-sortable-dropzone-match-inline-size",`${Math.max(180,Math.round(r.width))}px`)}_clearPointerDragPreview(){const e=this.root.querySelector(".root");e&&!this._dragState?.keyboard&&e.setAttribute("data-drag-preview","false")}_setDraggingVisualState(e,t){t&&this._dragState?.clone&&!this._dragState.keyboard||e.forEach(i=>{const r=this._findItemElement(i);r&&(r.setAttribute("data-dragging",t?"true":"false"),t&&r.getBoundingClientRect())})}_setDropTarget(e,t){const i=this._dragState?.dropTarget??null;if(!(!this._dragState||H(i,e))){if(this._pendingDropTarget=null,this._dragState.dropTarget=e,this._applyCurrentDropTargetVisualState(i),t?.announceLabel&&this._announce(t.announceLabel),this._dragState.keyboard){this.requestRender();return}this.root.querySelector(".root")?.setAttribute("data-drag-preview",e?"true":"false")}}_queueDropTarget(e,t,i){if(!this._dragState)return;const r=this._dragState.dropTarget??null;if(H(r,e)){this._pendingDropTarget=null;return}if(!r&&e){this._setDropTarget(e,i);return}const s=typeof t=="number"&&Number.isFinite(t)?t:performance.now(),n=this._pendingDropTarget;if(n&&H(n.target,e)){const a=e?W:Q;s-n.startedAt>=a&&this._setDropTarget(e,n.announceLabel?{announceLabel:n.announceLabel}:i);return}this._pendingDropTarget={target:e,startedAt:s,announceLabel:i?.announceLabel},this._schedulePendingFlush(e?W:Q)}_schedulePendingFlush(e){this._pendingTimer&&clearTimeout(this._pendingTimer),this._pendingTimer=setTimeout(()=>{this._pendingTimer=null;const t=this._pendingDropTarget;!t||!this._dragState||this._dragState.committed||this._dragState.keyboard||this._setDropTarget(t.target,t.announceLabel?{announceLabel:t.announceLabel}:void 0)},e+8)}_releaseDropTarget(e,t){if(!this._dragState)return null;if(Number.isFinite(e)&&Number.isFinite(t)){const n=this._dropTargetFromPoint(e,t);if(n&&this._canDrop(n,this._dragState.movedRootIds))return this._pendingDropTarget=null,n}const i=this._pendingDropTarget?.target??null;this._pendingDropTarget=null;const r=n=>this._pointerIsOverList(n.listId,e,t);if(i&&this._canDrop(i,this._dragState.movedRootIds)&&r(i))return i;const s=this._dragState.dropTarget??null;return s&&this._canDrop(s,this._dragState.movedRootIds)&&r(s)?s:null}_pointerIsOverList(e,t,i){if(!Number.isFinite(t)||!Number.isFinite(i))return!0;const s=Array.from(this.root.querySelectorAll(".list[data-list-id]")).find(a=>a.getAttribute("data-list-id")===e);if(!s)return!0;const n=s.getBoundingClientRect();return t>=n.left&&t<=n.right&&i>=n.top&&i<=n.bottom}_pathFromPoint(e,t){const i=[],r=this.root;let s=typeof r.elementFromPoint=="function"?r.elementFromPoint(e,t):this.ownerDocument?.elementFromPoint?.(e,t)??null;for(;s&&(s instanceof HTMLElement&&i.push(s),s!==this);){if(s instanceof ShadowRoot){s=s.host;continue}s=s.parentNode,!s&&i[i.length-1]?.getRootNode()instanceof ShadowRoot&&(s=i[i.length-1].getRootNode().host)}return i}_measureItemShellRects(){const e=new Map;return this.root.querySelectorAll(".item-shell[data-item-shell]").forEach(t=>{const i=t.getAttribute("data-item-shell");if(!i)return;const r=t.getBoundingClientRect();e.set(i,{top:r.top,left:r.left})}),e}_animateItemShellReflow(e){if(!e.size)return;const t=new Set(this._draggingIds());this.root.querySelectorAll(".item-shell[data-item-shell]").forEach(i=>{const r=i.getAttribute("data-item-shell");if(!r||t.has(r))return;const s=e.get(r);if(!s)return;const n=i.getBoundingClientRect(),a=s.left-n.left,d=s.top-n.top;Math.abs(a)<.5&&Math.abs(d)<.5||(i.style.transition="none",i.style.transform=`translate(${a}px, ${d}px)`,i.style.willChange="transform",i.getBoundingClientRect(),requestAnimationFrame(()=>{i.style.transition="transform 180ms ease",i.style.transform="";const o=()=>{i.style.transition="",i.style.willChange="",i.removeEventListener("transitionend",o)};i.addEventListener("transitionend",o),window.setTimeout(o,220)}))})}_previewCloneSubtreeItem(e,t){const i=e.id.includes("--copy-")?e.id.split("--copy-")[0]:e.id;return{...e,id:`${i}--preview`,label:t[0]===e.id?`${e.label} copy`:e.label}}_projectedMoveResult(){return!this._dragState?.dropTarget||!this._canDrop(this._dragState.dropTarget,this._dragState.movedRootIds)?null:U(this._items,this._lists,this._dragState.dropTarget,this._dragState.movedRootIds,this._dragState.clone,(e,t)=>this._previewCloneSubtreeItem(e,t))}_renderListTree(e,t,i,r,s,n,a){const d=T(e),o=M(e),c=l=>{const p=o.get(w(t.id,l))||[],g=this.sort==="label"?[...p].sort((y,h)=>{const f=d.get(y),x=d.get(h);return!f||!x?0:f.label.localeCompare(x.label)}):p;let b="";return g.forEach(y=>{const h=d.get(y);if(!h||h.hidden)return;const f=this._renderChildBranch(h,i,r,c,s,n,a);!ae(h,this.filterQuery)&&!se(f)||(b+=this._renderDropzone({listId:t.id,parentId:l,beforeId:y,mode:"before"},this._t("dropHere")),b+=f)}),b+=this._renderDropzone({listId:t.id,parentId:l,beforeId:null,mode:"before"},this._t("dropHere")),b};return`<div class="tree">${c(null)}</div>`}_renderChildBranch(e,t,i,r,s,n,a){const d=v(e.id),o=n.has(e.id),c=o?"":r(e.id),l=se(c),p=o?!1:this._selection.includes(e.id),g=o?!1:i.has(e.id),b=e.disabled,y=b||e.dragDisabled||this._isDragLocked(),h=this._dragState?.dropTarget?.mode==="inside"&&this._dragState.dropTarget.parentId===e.id,f=this._t(this._dragState?.clone?"copyPreview":"dropPreview"),x=this._t(this._dragState?.clone?"releaseCopy":this._dragState&&this._dragState.movedRootIds.length>1?"releaseMoveMany":"releaseMove"),D=this._dragHandleMode(),C=this._usesCustomHandleSelector(),z=C?"custom":D,E=!C&&D==="handle";return`
922
+ `,F=this._captureScroll();this._focusWasInside=!!this.root.activeElement,this.setContent(E),this._restoreScroll(F),this._fillCustomTargets(),queueMicrotask(()=>{this._restorePendingFocus(),this._dragState?.keyboard&&this.root.querySelector(".item-placeholder")?.scrollIntoView?.({block:"nearest",inline:"nearest"}),this._applyCurrentDropTargetVisualState(),this._applyLiveMessage(),this._animateItemShellReflow(t)}),this._syncScrollTabStops()}_syncStateFromAttributes(){const t=this.getAttribute("lists");t!==this._lastListsAttr&&(this._lastListsAttr=t,this._lists=it(j(t)));const e=this.getAttribute("items");if(e!==this._lastItemsAttr){this._lastItemsAttr=e,this._items=J(this._lists,j(e)),this._lastSelectionAttr=null;const s=this.getAttribute("persist-key");s&&this._hydratedPersistKey!==s&&(this._items=this._restorePersistedItems(s,this._items),this._hydratedPersistKey=s)}const i=this.getAttribute("selection");i!==this._lastSelectionAttr&&this._syncSelectionFromAttribute(i);const r=this.getAttribute("labels");r!==this._lastLabelsAttr&&(this._lastLabelsAttr=r,this._labels=mt(r)),this._focusedId||(this._focusedId=this._items.find(s=>!s.hidden)?.id||null)}_restorePersistedItems(t,e){try{const i=window.localStorage.getItem(t);if(!i)return e;const r=JSON.parse(i);if(!r||typeof r!="object"||!Array.isArray(r.records))return e;const s=new Map(r.records.map(a=>[a.id,a])),n=e.map((a,d)=>{const o=s.get(a.id);return o?{...a,listId:this._lists.some(c=>c.id===o.listId)?o.listId:a.listId,parentId:typeof o.parentId=="string"?o.parentId:null,order:Number.isFinite(o.index)?o.index:d}:{...a,order:d}});return J(this._lists,n)}catch{return e}}_resolvedFocusedId(t){const e=new Set(Array.from(t.values()).flat().map(r=>r.id));return this._focusedId&&e.has(this._focusedId)?this._focusedId:Array.from(t.values()).flat().find(r=>!r.disabled)?.id||null}_restorePendingFocus(){const t=this._pendingFocusId||(this._focusWasInside?this._focusedId:null);if(this._focusWasInside=!1,!t)return;const e=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(t):t.replace(/"/g,'\\"'),i=this.root.querySelector(`.item[data-id="${e}"]`);i&&(document.activeElement!==i&&i.focus({preventScroll:!0}),this._revealPending?(this._revealPending=!1,i.scrollIntoView?.({block:"nearest",inline:"nearest"})):this._revealInBoard(i),this._pendingFocusId=null)}_captureScroll(){const t=this.root.querySelector(".lists");if(!t)return null;const e=new Map;return this.root.querySelectorAll(".list[data-list-id]").forEach(i=>{const r=i.querySelector(".items"),s=i.getAttribute("data-list-id");r&&s&&(r.scrollLeft||r.scrollTop)&&e.set(s,{left:r.scrollLeft,top:r.scrollTop})}),{board:t.scrollLeft,lists:e}}_restoreScroll(t){if(!t)return;const e=this.root.querySelector(".lists");e&&t.board&&(e.scrollLeft=t.board),t.lists.size&&this.root.querySelectorAll(".list[data-list-id]").forEach(i=>{const r=t.lists.get(i.getAttribute("data-list-id")||""),s=i.querySelector(".items");!r||!s||(s.scrollLeft=r.left,s.scrollTop=r.top)})}_revealInBoard(t){const e=this.root.querySelector(".lists"),i=t.closest(".list");if(!e||!i||e.scrollWidth<=e.clientWidth+1)return;const r=e.getBoundingClientRect(),s=i.getBoundingClientRect();s.left<r.left?e.scrollLeft-=r.left-s.left+4:s.right>r.right&&(e.scrollLeft+=Math.min(s.right-r.right+4,s.left-r.left))}_escapeSelectorValue(t){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(t):t.replace(/"/g,'\\"')}_findDropzone(t){const e=this._escapeSelectorValue(t.listId),i=this._escapeSelectorValue(t.parentId??""),r=this._escapeSelectorValue(t.beforeId??""),s=this._escapeSelectorValue(t.mode);return this.root.querySelector(`.dropzone[data-list-id="${e}"][data-parent-id="${i}"][data-before-id="${r}"][data-mode="${s}"]`)}_findItemElement(t){const e=this._escapeSelectorValue(t);return this.root.querySelector(`.item[data-id="${e}"]`)}_dragHandleMode(){return ft(this.getAttribute("drag-handle-mode"))}_nestTrigger(){const t=this.getAttribute("nest-trigger");return t==="modifier"||t==="area"?t:"gutter"}_dropzoneStyle(){return this.getAttribute("dropzone-style")==="container"?"container":"indicator"}_usesCustomHandleSelector(){return!!this.getAttribute("drag-handle-selector")?.trim()}_dragActivatorFromPath(t){const e=t.find(n=>n instanceof HTMLElement&&!!n.getAttribute("data-drag-trigger"));if(!e)return null;const i=e.getAttribute("data-drag-trigger"),r=i==="item"?"item":i==="custom"?"custom":"handle",s=e.getAttribute("data-id")||e.closest(".item[data-id]")?.getAttribute("data-id");return s?{element:e,id:s,kind:r}:null}_setDropTargetVisualState(t,e){if(!t)return;const i=this._findDropzone(t);i&&(i.setAttribute("data-active",e?"true":"false"),e?this._syncDropzoneContainerSize(i,t):this._clearDropzoneContainerSize(i)),t.mode==="inside"&&t.parentId&&this._findItemElement(t.parentId)?.setAttribute("data-drop-inside-active",e?"true":"false")}_applyCurrentDropTargetVisualState(t){this._setDropTargetVisualState(t??null,!1),this._setDropTargetVisualState(this._dragState?.dropTarget??null,!0)}_applyLiveMessage(){const t=this.root.querySelector(".sr-only[aria-live]");t&&(t.textContent=this._liveMessage)}_canSyncInteractiveStateInPlace(){return!!this.root.querySelector(".root")&&!this._dragState}_applyInteractiveStateInPlace(t){return this._canSyncInteractiveStateInPlace()?(this._syncSelectionVisualState(),t?.restoreFocus&&this._restorePendingFocus(),this._applyLiveMessage(),!0):!1}_fillCustomTargets(t){if(!this._renderItemFn&&!this._renderListHeaderFn&&!this._renderEmptyStateFn)return;const e=this._isDragLocked(),i=new Map(this._lists.map(d=>[d.id,d])),r=(d,o)=>{let c;try{c=o()}catch(l){console.error("ui-sortable: a render function threw; the built-in markup is shown.",l);return}typeof c=="string"?d.innerHTML=c:c&&typeof c.nodeType=="number"&&d.replaceChildren(c)},s=this._renderItemFn;if(s){const d=new Map(this._items.map(l=>[l.id,l])),o=new Set(this._selection),c=this.getAttribute("drag-handle-selector")?.trim()||"";this.root.querySelectorAll(".item-custom-content[data-item-content-target]").forEach(l=>{const p=l.getAttribute("data-item-content-target")||"";if(t?!t.itemIds.has(p):l.hasChildNodes())return;const g=d.get(p);if(!g)return;t&&l.replaceChildren();const b=i.get(g.listId);r(l,()=>s(q(g),{selected:o.has(p),disabled:g.disabled,dragDisabled:g.dragDisabled,cloneOnDrag:g.cloneOnDrag||!!b?.cloneOnDrag,list:b?G(b):void 0})),c&&this._markCustomHandles(l,p,c)})}if(t)return;const n=this._renderListHeaderFn;n&&this.root.querySelectorAll(".list-custom-header[data-list-header-target]").forEach(d=>{if(d.hasChildNodes())return;const o=i.get(d.getAttribute("data-list-header-target")||"");if(!o)return;const c=this._items.filter(l=>l.listId===o.id).length;r(d,()=>n(G(o),{itemCount:c,dragLocked:e}))});const a=this._renderEmptyStateFn;a&&this.root.querySelectorAll(".list-custom-empty[data-list-empty-target]").forEach(d=>{if(d.hasChildNodes())return;const o=i.get(d.getAttribute("data-list-empty-target")||"");if(!o)return;const c=this._items.filter(l=>l.listId===o.id).length;r(d,()=>a(G(o),{itemCount:c,dragLocked:e,filterQuery:this.filterQuery}))})}_markCustomHandles(t,e,i){let r;try{r=t.querySelectorAll(i)}catch{return}r.forEach(s=>{s.setAttribute("data-sortable-custom-handle",""),s.setAttribute("data-drag-trigger","custom"),s.setAttribute("data-id",e),s.hasAttribute("tabindex")||s.setAttribute("tabindex","-1")})}_hasCustomItemRendering(){return this.hasAttribute("custom-item-rendering")||!!this._renderItemFn}_syncSelectionFromAttribute(t){this._lastSelectionAttr=t;const e=new Set(this._items.map(i=>i.id));this._selection=j(t).filter(i=>e.has(i)),!this._selection.length&&this._focusedId&&!e.has(this._focusedId)&&(this._focusedId=null)}_syncScrollTabStops(){this.root.querySelectorAll('.items[data-scroll="true"]').forEach(t=>{t.querySelector('.item[tabindex="0"]')?t.removeAttribute("tabindex"):t.setAttribute("tabindex","0")})}_syncSelectionVisualState(){const t=new Set(this._selection),e=this.getAttribute("show-selection-badge")!=="false",i=new Set;this.root.querySelectorAll(".item[data-id]").forEach(n=>{const a=n.getAttribute("data-id");if(!a)return;const d=t.has(a);n.getAttribute("data-selected")==="true"!==d&&i.add(a);const o=this._focusedId===a;n.setAttribute("data-selected",d?"true":"false"),n.setAttribute("aria-selected",d?"true":"false"),n.setAttribute("data-focused",o?"true":"false"),n.setAttribute("tabindex",o?"0":"-1");const c=n.querySelector('[data-selection-badge="true"]');if(c){const l=d&&e;c.hidden=!l,c.textContent=l?this._t("badgeSelected"):""}}),this._syncScrollTabStops(),i.size&&this._renderItemFn&&this._fillCustomTargets({itemIds:i}),this.root.querySelector(".selection-summary")?.setAttribute("data-count",String(this._selection.length));const r=this.root.querySelector(".selection-pill");r&&(r.textContent=String(this._selection.length));const s=this.root.querySelector(".selection-text");s&&(s.textContent=this._selection.length===1?this._t("selectedOne"):this._t("selectedMany"))}_clearDropzoneContainerSize(t){t.style.removeProperty("--ui-sortable-dropzone-match-block-size"),t.style.removeProperty("--ui-sortable-dropzone-match-inline-size")}_dropzoneReferenceElement(t,e){if(t.mode==="inside"&&t.parentId)return this._findItemElement(t.parentId);let i=e.nextElementSibling;for(;i;){if(i instanceof HTMLElement&&i.classList.contains("item-shell"))return i.querySelector(".item[data-id]");i=i.nextElementSibling}let r=e.previousElementSibling;for(;r;){if(r instanceof HTMLElement&&r.classList.contains("item-shell"))return r.querySelector(".item[data-id]");r=r.previousElementSibling}const s=this._escapeSelectorValue(t.listId),n=this.root.querySelector(`.list[data-list-id="${s}"] .items`),a=n?.querySelector(".item[data-id]");return a||n||null}_syncDropzoneContainerSize(t,e){if(this._clearDropzoneContainerSize(t),this._dropzoneStyle()!=="container")return;const i=this._dropzoneReferenceElement(e,t);if(!i)return;const r=i.getBoundingClientRect();t.style.setProperty("--ui-sortable-dropzone-match-block-size",`${Math.max(76,Math.round(r.height))}px`),t.style.setProperty("--ui-sortable-dropzone-match-inline-size",`${Math.max(180,Math.round(r.width))}px`)}_clearPointerDragPreview(){const t=this.root.querySelector(".root");t&&!this._dragState?.keyboard&&t.setAttribute("data-drag-preview","false")}_setDraggingVisualState(t,e){e&&this._dragState?.clone&&!this._dragState.keyboard||t.forEach(i=>{const r=this._findItemElement(i);r&&(r.setAttribute("data-dragging",e?"true":"false"),e&&r.getBoundingClientRect())})}_setDropTarget(t,e){const i=this._dragState?.dropTarget??null;if(!(!this._dragState||H(i,t))){if(this._pendingDropTarget=null,this._dragState.dropTarget=t,this._applyCurrentDropTargetVisualState(i),e?.announceLabel&&this._announce(e.announceLabel),this._dragState.keyboard){this.requestRender();return}this.root.querySelector(".root")?.setAttribute("data-drag-preview",t?"true":"false")}}_queueDropTarget(t,e,i){if(!this._dragState)return;const r=this._dragState.dropTarget??null;if(H(r,t)){this._pendingDropTarget=null;return}if(!r&&t){this._setDropTarget(t,i);return}const s=typeof e=="number"&&Number.isFinite(e)?e:performance.now(),n=this._pendingDropTarget;if(n&&H(n.target,t)){const a=t?W:Q;s-n.startedAt>=a&&this._setDropTarget(t,n.announceLabel?{announceLabel:n.announceLabel}:i);return}this._pendingDropTarget={target:t,startedAt:s,announceLabel:i?.announceLabel},this._schedulePendingFlush(t?W:Q)}_schedulePendingFlush(t){this._pendingTimer&&clearTimeout(this._pendingTimer),this._pendingTimer=setTimeout(()=>{this._pendingTimer=null;const e=this._pendingDropTarget;!e||!this._dragState||this._dragState.committed||this._dragState.keyboard||this._setDropTarget(e.target,e.announceLabel?{announceLabel:e.announceLabel}:void 0)},t+8)}_releaseDropTarget(t,e){if(!this._dragState)return null;if(Number.isFinite(t)&&Number.isFinite(e)){const n=this._dropTargetFromPoint(t,e);if(n&&this._canDrop(n,this._dragState.movedRootIds))return this._pendingDropTarget=null,n}const i=this._pendingDropTarget?.target??null;this._pendingDropTarget=null;const r=n=>this._pointerIsOverList(n.listId,t,e);if(i&&this._canDrop(i,this._dragState.movedRootIds)&&r(i))return i;const s=this._dragState.dropTarget??null;return s&&this._canDrop(s,this._dragState.movedRootIds)&&r(s)?s:null}_pointerIsOverList(t,e,i){if(!Number.isFinite(e)||!Number.isFinite(i))return!0;const s=Array.from(this.root.querySelectorAll(".list[data-list-id]")).find(a=>a.getAttribute("data-list-id")===t);if(!s)return!0;const n=s.getBoundingClientRect();return e>=n.left&&e<=n.right&&i>=n.top&&i<=n.bottom}_pathFromPoint(t,e){const i=[],r=this.root;let s=typeof r.elementFromPoint=="function"?r.elementFromPoint(t,e):this.ownerDocument?.elementFromPoint?.(t,e)??null;for(;s&&(s instanceof HTMLElement&&i.push(s),s!==this);){if(s instanceof ShadowRoot){s=s.host;continue}s=s.parentNode,!s&&i[i.length-1]?.getRootNode()instanceof ShadowRoot&&(s=i[i.length-1].getRootNode().host)}return i}_measureItemShellRects(){const t=new Map;return this.root.querySelectorAll(".item-shell[data-item-shell]").forEach(e=>{const i=e.getAttribute("data-item-shell");if(!i)return;const r=e.getBoundingClientRect();t.set(i,{top:r.top,left:r.left})}),t}_animateItemShellReflow(t){if(!t.size)return;const e=new Set(this._draggingIds());this.root.querySelectorAll(".item-shell[data-item-shell]").forEach(i=>{const r=i.getAttribute("data-item-shell");if(!r||e.has(r))return;const s=t.get(r);if(!s)return;const n=i.getBoundingClientRect(),a=s.left-n.left,d=s.top-n.top;Math.abs(a)<.5&&Math.abs(d)<.5||(i.style.transition="none",i.style.transform=`translate(${a}px, ${d}px)`,i.style.willChange="transform",i.getBoundingClientRect(),requestAnimationFrame(()=>{i.style.transition="transform 180ms ease",i.style.transform="";const o=()=>{i.style.transition="",i.style.willChange="",i.removeEventListener("transitionend",o)};i.addEventListener("transitionend",o),window.setTimeout(o,220)}))})}_previewCloneSubtreeItem(t,e){const i=t.id.includes("--copy-")?t.id.split("--copy-")[0]:t.id;return{...t,id:`${i}--preview`,label:e[0]===t.id?`${t.label} copy`:t.label}}_projectedMoveResult(){return!this._dragState?.dropTarget||!this._canDrop(this._dragState.dropTarget,this._dragState.movedRootIds)?null:U(this._items,this._lists,this._dragState.dropTarget,this._dragState.movedRootIds,this._dragState.clone,(t,e)=>this._previewCloneSubtreeItem(t,e))}_renderListTree(t,e,i,r,s,n,a){const d=T(t),o=M(t),c=l=>{const p=o.get(w(e.id,l))||[],g=this.sort==="label"?[...p].sort((y,h)=>{const f=d.get(y),x=d.get(h);return!f||!x?0:f.label.localeCompare(x.label)}):p;let b="";return g.forEach(y=>{const h=d.get(y);if(!h||h.hidden)return;const f=this._renderChildBranch(h,i,r,c,s,n,a);!at(h,this.filterQuery)&&!st(f)||(b+=this._renderDropzone({listId:e.id,parentId:l,beforeId:y,mode:"before"},this._t("dropHere")),b+=f)}),b+=this._renderDropzone({listId:e.id,parentId:l,beforeId:null,mode:"before"},this._t("dropHere")),b};return`<div class="tree">${c(null)}</div>`}_renderChildBranch(t,e,i,r,s,n,a){const d=v(t.id),o=n.has(t.id),c=o?"":r(t.id),l=st(c),p=o?!1:this._selection.includes(t.id),g=o?!1:i.has(t.id),b=t.disabled,y=b||t.dragDisabled||this._isDragLocked(),h=this._dragState?.dropTarget?.mode==="inside"&&this._dragState.dropTarget.parentId===t.id,f=this._t(this._dragState?.clone?"copyPreview":"dropPreview"),x=this._t(this._dragState?.clone?"releaseCopy":this._dragState&&this._dragState.movedRootIds.length>1?"releaseMoveMany":"releaseMove"),D=this._dragHandleMode(),C=this._usesCustomHandleSelector(),A=C?"custom":D,E=!C&&D==="handle";return`
923
923
  <div class="item-shell" data-item-shell="${d}">
924
924
  <div
925
925
  class="item${o?" item-placeholder":""}"
926
926
  part="item"
927
927
  data-id="${d}"
928
- data-drag-handle-mode="${z}"
929
- ${!o&&z==="item"?'data-drag-trigger="item"':""}
928
+ data-drag-handle-mode="${A}"
929
+ ${!o&&A==="item"?'data-drag-trigger="item"':""}
930
930
  data-selected="${p}"
931
- data-focused="${o?"false":t===e.id}"
931
+ data-focused="${o?"false":e===t.id}"
932
932
  data-dragging="${g}"
933
933
  data-disabled="${b}"
934
934
  data-drop-inside-active="${h?"true":"false"}"
935
- ${this._renderItemFn&&!o?`data-rev="${ee(e.data)}"`:""}
935
+ ${this._renderItemFn&&!o?`data-rev="${tt(t.data)}"`:""}
936
936
  role="${o?"presentation":"option"}"
937
937
  aria-selected="${o?"false":p}"
938
938
  aria-disabled="${b}"
939
939
  aria-hidden="${o?"true":"false"}"
940
- tabindex="${o?"-1":t===e.id?"0":"-1"}"
940
+ tabindex="${o?"-1":e===t.id?"0":"-1"}"
941
941
  >
942
942
  ${o?`
943
943
  <div class="placeholder-content">
944
944
  <div class="placeholder-kicker">${v(f)}</div>
945
- <div class="placeholder-title">${v(e.label)}</div>
945
+ <div class="placeholder-title">${v(t.label)}</div>
946
946
  <div class="placeholder-description">${v(x)}</div>
947
947
  </div>
948
948
  `:`
@@ -971,32 +971,32 @@
971
971
  <div class="item-content" data-action="select" data-id="${d}">
972
972
  <div class="item-custom-content" part="item-custom-content" data-item-content-target="${d}"></div>
973
973
  <div class="item-default-content">
974
- <div class="item-title">${v(e.label)}</div>
975
- ${e.description?`<div class="item-description">${v(e.description)}</div>`:""}
974
+ <div class="item-title">${v(t.label)}</div>
975
+ ${t.description?`<div class="item-description">${v(t.description)}</div>`:""}
976
976
  <div class="item-meta">
977
977
  <span class="item-badge selection-badge" data-selection-badge="true" ${p&&a?"":"hidden"}>${p&&a?v(this._t("badgeSelected")):""}</span>
978
- ${e.cloneOnDrag?`<span class="item-badge">${v(this._t("badgeClone"))}</span>`:""}
979
- ${e.dragDisabled?`<span class="item-badge">${v(this._t("badgePinned"))}</span>`:""}
978
+ ${t.cloneOnDrag?`<span class="item-badge">${v(this._t("badgeClone"))}</span>`:""}
979
+ ${t.dragDisabled?`<span class="item-badge">${v(this._t("badgePinned"))}</span>`:""}
980
980
  ${s?`<span class="item-badge drop-badge">${v(this._t("nestHere"))}</span>`:""}
981
981
  </div>
982
982
  </div>
983
983
  </div>
984
984
  `}
985
985
  </div>
986
- ${s&&!o?this._renderDropzone({listId:e.listId,parentId:e.id,beforeId:null,mode:"inside"},this._t("nestHere")):""}
986
+ ${s&&!o?this._renderDropzone({listId:t.listId,parentId:t.id,beforeId:null,mode:"inside"},this._t("nestHere")):""}
987
987
  ${l?`<div class="children">${c}</div>`:""}
988
988
  </div>
989
- `}_renderDropzone(e,t){const i=this._dragState?.dropTarget??this._externalTarget,r=i&&i.listId===e.listId&&i.parentId===e.parentId&&i.beforeId===e.beforeId&&i.mode===e.mode;return`
989
+ `}_renderDropzone(t,e){const i=this._dragState?.dropTarget??this._externalTarget,r=i&&i.listId===t.listId&&i.parentId===t.parentId&&i.beforeId===t.beforeId&&i.mode===t.mode;return`
990
990
  <div
991
991
  class="dropzone"
992
992
  part="dropzone"
993
- data-list-id="${v(e.listId)}"
994
- data-parent-id="${v(e.parentId??"")}"
995
- data-before-id="${v(e.beforeId??"")}"
996
- data-mode="${e.mode}"
993
+ data-list-id="${v(t.listId)}"
994
+ data-parent-id="${v(t.parentId??"")}"
995
+ data-before-id="${v(t.beforeId??"")}"
996
+ data-mode="${t.mode}"
997
997
  data-active="${r?"true":"false"}"
998
998
  aria-hidden="true"
999
999
  >
1000
- <span class="dropzone-label">${v(t)}</span>
1000
+ <span class="dropzone-label">${v(e)}</span>
1001
1001
  </div>
1002
- `}_onClick(e){const t=e.composedPath(),i=t.find(o=>o instanceof HTMLElement&&o.classList?.contains("toolbar")),r=this._dragActivatorFromPath(t),s=t.find(o=>o instanceof HTMLElement&&o.classList.contains("item"));if(r&&r.kind!=="item")return;if(!s)return i&&!(e.target instanceof HTMLButtonElement),void 0;const n=s.getAttribute("data-id");if(!n)return;const a=this._items.find(o=>o.id===n);if(!a||a.disabled)return;const d=e;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()){this._syncSelectionVisualState(),this._restorePendingFocus();return}this.requestRender()}_onFocusIn(e){const i=e.composedPath().find(r=>r instanceof HTMLElement&&r.classList.contains("item"))?.getAttribute("data-id");i&&(this._focusedId=i,this._syncSelectionVisualState())}_isForeignControl(e){const t=e.composedPath()[0];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"]')}_onKeyDown(e){if(this._isForeignControl(e))return;const t=this._visibleItemIds();if(!t.length)return;const i=this._focusedId&&t.includes(this._focusedId)?this._focusedId:t[0],r=t.indexOf(i),s=this._items.find(l=>l.id===i),a=(s?this._lists.find(l=>l.id===s.listId):null)?.orientation==="horizontal",d=this._isRtl(),o=a?d?"ArrowLeft":"ArrowRight":"ArrowDown",c=a?d?"ArrowRight":"ArrowLeft":"ArrowUp";if(!this._dragState?.keyboard){if(e.key===o){e.preventDefault(),this._moveFocusBy(t,r,1);return}if(e.key===c){e.preventDefault(),this._moveFocusBy(t,r,-1);return}if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()==="a"){e.preventDefault(),this._setSelection(t,"keyboard"),this._announce(this._t("announceSelectedMany",{count:t.length}));return}if(e.key==="Enter"){e.preventDefault(),this._setSelection([i],"keyboard");return}if(e.key===" "||e.code==="Space"){if(e.preventDefault(),this._isDragLocked()){this._announce(this._t("announceDragDisabled"));return}const l=this._selectedRootIds(i);if(!l.length)return;const p=this._itemClonesOnDrag(i);this._dragState={snapshot:this._items.map(A),movedRootIds:l,originId:i,clone:p,keyboard:!0,dropTarget:this._initialKeyboardDropTarget(i),committed:!1};const g=l.length===1?this._t("announceLifted",{label:s?.label||"item"}):this._t("announceLiftedMany",{count:l.length});this._announce(`${g} ${this._t("announceLiftedHelp")}`),this.requestRender();return}if(e.key==="Escape"){this._setSelection([],"keyboard");return}return}if(e.key==="Escape"){e.preventDefault(),this._cancelDrag(!0);return}if(e.key==="Enter"||e.key===" "||e.code==="Space"){e.preventDefault();const l=this._dragState.dropTarget;if(!l)return;this._commitMove(l,this._dragState.movedRootIds,this._dragState.clone,"keyboard");return}if(["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"].includes(e.key)){e.preventDefault();const l=d?"ArrowLeft":"ArrowRight",p=e.key==="ArrowDown"||e.key===l?1:-1;this._moveKeyboardDropTarget(p)}}_isRtl(){const e=this.ownerDocument?.defaultView?.getComputedStyle(this).direction;return e?e==="rtl":this.closest("[dir]")?.getAttribute("dir")==="rtl"}_moveFocusBy(e,t,i){const r=Math.max(0,Math.min(e.length-1,t+i)),s=e[r];this._focusedId=s,this._pendingFocusId=s,this._revealPending=!0,!this._applyInteractiveStateInPlace({restoreFocus:!0})&&this.requestRender()}_onDragStart(e){(this._pointerGesture||this._dragState&&!this._dragState.keyboard)&&e.preventDefault()}_onDocumentKeyDown(e){if(e.key==="Alt"){this._setNestModifier(!0);return}e.key==="Escape"&&(!this._dragState||this._dragState.keyboard||(e.preventDefault(),this._cancelDrag(!0)))}_onDocumentKeyUp(e){e.key==="Alt"&&this._setNestModifier(!1)}_setNestModifier(e){this._nestModifier!==e&&(this._nestModifier=e,!(!this._dragState||this._dragState.keyboard||this._dragState.committed||!this._lastPointer)&&this._retarget(this._lastPointer.x,this._lastPointer.y,{immediate:!0}))}_retarget(e,t,i){const r=this._dragState;if(!r||r.keyboard||r.committed)return;const s=this._externalAt(e,t);if(s){r.dropTarget&&this._setDropTarget(null),this._pendingDropTarget=null,this._noteRefusal(!!s.target&&!s.usable),this._setExternal(s.usable&&s.target?{peer:s.peer,target:s.target}:null);return}this._setExternal(null);const n=this._dropTargetFromPoint(e,t),a=n&&this._canDrop(n,r.movedRootIds)?n:null;this._noteRefusal(!!n&&!a),i.immediate?this._setDropTarget(a):this._queueDropTarget(a,i.timestamp??performance.now())}_peerUnder(e,t){const i=this._group();if(!i)return null;const r=s=>{const n=s.getBoundingClientRect();return e>=n.left&&e<=n.right&&t>=n.top&&t<=n.bottom&&n.width>0&&n.height>0};if(r(this))return null;for(const s of $._instances)if(!(s===this||s._group()!==i||!s.isConnected||s.ownerDocument!==this.ownerDocument)&&r(s))return s;return null}_externalAt(e,t){if(!this._dragState||this._dragState.keyboard)return null;const i=this._peerUnder(e,t);if(!i)return null;const r=this._sessionFor(this._dragState.movedRootIds,this._dragState.clone);i._nestModifier=this._nestModifier;const s=i._dropTargetFromPoint(e,t),n=!!s&&i._canDrop(s,r.rootIds,r.clone,r);return{peer:i,target:s,usable:n}}_setExternal(e){const t=this._dragState;if(!t)return;const i=t.external??null;if(!(i&&e&&i.peer===e.peer&&H(i.target,e.target))){if(!i&&!e){t.external=null;return}i?.peer._showExternalTarget(null),t.external=e,e?.peer._showExternalTarget(e.target)}}_showExternalTarget(e){H(this._externalTarget,e)||(this._setDropTargetVisualState(this._externalTarget,!1),this._externalTarget=e,this._setDropTargetVisualState(e,!0))}_sessionFor(e,t){const i=this._dragState?.session;if(i&&i.clone===t&&i.rootIds.join()===e.join())return i;const r=T(this._items),s=M(this._items),n=new Set,a=[],d=c=>{const l=r.get(c);!l||n.has(c)||(n.add(c),a.push(A(l)),(s.get(w(l.listId,c))||[]).forEach(d))};e.forEach(d);const o={source:this,rootIds:[...e],items:a,clone:t,sourceListIds:Array.from(new Set(e.map(c=>r.get(c)?.listId).filter(c=>!!c)))};return this._dragState&&(this._dragState.session=o),o}_transferTo(e,t,i,r,s){const n=()=>(this._dragState&&this._cancelDrag(!1),this._announce(this._t("announceRejected")),!1),a=this._sessionFor(i,r);if(!e._canDrop(t,a.rootIds,a.clone,a))return n();const d=new Set(e._items.map(h=>h.id)),o=new Map;a.items.forEach(h=>{if(!r){o.set(h.id,h.id);return}const f=h.id.includes("--copy-")?h.id.split("--copy-")[0]:h.id;let x="";do x=`${f}--copy-${this._cloneSeed++}`;while(d.has(x));d.add(x),o.set(h.id,x)});const c=a.items.map(h=>{const f=a.rootIds.indexOf(h.id);return{...A(h),id:o.get(h.id)||h.id,parentId:h.parentId&&o.has(h.parentId)&&o.get(h.parentId)||null,listId:t.listId,label:r&&f===0?`${h.label} copy`:h.label,...h.data!==void 0?{data:B(h.data)}:{}}}),l=a.rootIds.map(h=>o.get(h)||h),p=U([...e._items,...c],e._lists,t,l,!1,h=>h),g=e._lists.find(h=>h.id===t.listId),b={items:p.items,movedIds:l,nextSelection:[...l],operation:r?"clone":t.mode==="inside"?"nest":"transfer",target:t,clone:r,source:s,external:{direction:"in",peer:this}};let y=null;if(!r){const h=new Set(a.items.map(f=>f.id));y={items:J(this._lists,this._items.filter(f=>!h.has(f.id)).map(A)),movedIds:[...a.rootIds],nextSelection:this._selection.filter(f=>!h.has(f)),operation:"transfer",target:t,clone:!1,source:s,external:{direction:"out",peer:e},destination:g?.label||t.listId}}return!e._askBeforeChange(b)||y&&!this._askBeforeChange(y)?n():(this._setExternal(null),e._showExternalTarget(null),y?this._applyPlan(y):(this._dragState&&(this._dragState.committed=!0),this._stopAutoScroll(),this._clearPointerDragPreview(),this._dragState=null,this._removeDragImage(),this.requestRender()),e._applyPlan(b),!0)}_noteRefusal(e){this._dragImage?.toggleAttribute&&this._dragImage.toggleAttribute("data-refused",e)}_dropTargetFromPath(e,t,i){const r=e.find(I=>I instanceof HTMLElement&&I.classList.contains("dropzone"));if(r){const I={listId:r.getAttribute("data-list-id")||"",parentId:r.getAttribute("data-parent-id")||null,beforeId:r.getAttribute("data-before-id")||null,mode:r.getAttribute("data-mode")==="inside"?"inside":"before"};if(I.listId)return I}const s=e.find(I=>I instanceof HTMLElement&&I.classList.contains("item"));if(!s){const P=e.find(k=>k instanceof HTMLElement&&k.classList.contains("list")&&k.hasAttribute("data-list-id"))?.getAttribute("data-list-id");return P?{listId:P,parentId:null,beforeId:null,mode:"before"}:null}const n=s.getAttribute("data-id");if(!n)return null;const a=this._items.find(I=>I.id===n);if(!a)return null;const d=this._lists.find(I=>I.id===a.listId),o=s.getBoundingClientRect(),c=d?.orientation==="horizontal",l=c?o.left:o.top,p=c?o.right:o.bottom,g=c?t:i,b=Math.max(1,p-l),y=(g-l)/b,h=c&&this._isRtl()?1-y:y,f=this.getAttribute("allow-nesting")!=="false"&&!a.disabled,x=this._nestTrigger(),D=f&&(x==="area"?h>.34&&h<=.74:h>=.25&&h<=.75&&(this._nestModifier||x==="gutter"&&this._inNestGutter(o,t,i,c))),C=x==="area"?h<=.34:h<.5;if(D)return{listId:a.listId,parentId:a.id,beforeId:null,mode:"inside"};if(C)return{listId:a.listId,parentId:a.parentId,beforeId:a.id,mode:"before"};const E=M(this._items).get(w(a.listId,a.parentId))||[],F=E.indexOf(a.id),_=F>=0&&E[F+1]||null;return{listId:a.listId,parentId:a.parentId,beforeId:_,mode:"before"}}_inNestGutter(e,t,i,r){if(r){const a=e.bottom-e.top;return i>=e.bottom-Math.max(24,Math.min(70,a*.3))}const s=e.right-e.left,n=Math.max(48,Math.min(140,s*.3));return this._isRtl()?t<=e.left+n:t>=e.right-n}_dropTargetFromPoint(e,t){return this._dropTargetFromPath(this._pathFromPoint(e,t),e,t)}_beginPointerDrag(e,t){if(!this._pointerGesture||this._dragState)return;const i=this._items.find(r=>r.id===this._pointerGesture?.originId);i&&(this._dragState={snapshot:this._items.map(A),movedRootIds:[...this._pointerGesture.movedRootIds],originId:this._pointerGesture.originId,clone:this._pointerGesture.clone,keyboard:!1,dropTarget:null,committed:!1},this._pendingDropTarget=null,this._applyPointerPreview(e,t,this._dragState.movedRootIds.length,this._dragState.clone,{x:this._pointerGesture.startX,y:this._pointerGesture.startY}),this._setDraggingVisualState(this._draggingIds(),!0),this._announceDragging(i.label,this._dragState.movedRootIds.length,this._dragState.clone))}_onPointerDown(e){const t=this._dragActivatorFromPath(e.composedPath()),i=t?.id;if(!t||!i)return;if(this._isDragLocked()){e.preventDefault(),this._announce(this._t("announceDragDisabled"));return}const r=this._items.find(a=>a.id===i);if(!r||r.disabled||r.dragDisabled){e.preventDefault();return}const s=e.pointerType==="touch"&&t.kind!=="handle"&&this._touchHoldDelay()>0;s||e.preventDefault();try{t.element.setPointerCapture?.(e.pointerId)}catch{}this._clearHoldTimer();const n=this._selection.includes(i)?this._selectedRootIds(i):[i];if(this._pointerGesture={pointerId:e.pointerId,pointerType:e.pointerType,originId:i,movedRootIds:n,clone:this._itemClonesOnDrag(i),startX:e.clientX,startY:e.clientY,moved:!1,captureTarget:t.element,hold:s,holdTimer:null},s){const a=this._pointerGesture;a.holdTimer=setTimeout(()=>{if(a.holdTimer=null,!(this._pointerGesture!==a||a.moved)){a.hold=!1,a.moved=!0,this._beginPointerDrag(a.startX,a.startY),this._lastPointer={x:a.startX,y:a.startY};try{this.ownerDocument?.defaultView?.navigator?.vibrate?.(8)}catch{}}},this._touchHoldDelay())}}_touchHoldDelay(){const e=this.getAttribute("touch-hold-delay");if(e===null||e.trim()==="")return Z;const t=Number(e);return Number.isFinite(t)?Math.min(2e3,Math.max(0,t)):Z}_clearHoldTimer(){this._pointerGesture?.holdTimer&&clearTimeout(this._pointerGesture.holdTimer),this._pointerGesture&&(this._pointerGesture.holdTimer=null)}_onTouchMove(e){this._dragState&&!this._dragState.keyboard&&e.cancelable&&e.preventDefault()}_onContextMenu(e){(this._pointerGesture?.pointerType==="touch"||this._dragState&&!this._dragState.keyboard)&&e.preventDefault()}_onPointerMove(e){if(!(!this._pointerGesture||e.pointerId!==this._pointerGesture.pointerId)){if(this._pointerGesture.hold){Math.hypot(e.clientX-this._pointerGesture.startX,e.clientY-this._pointerGesture.startY)>pe&&(this._clearHoldTimer(),this._pointerGesture=null);return}if(e.preventDefault(),!this._pointerGesture.moved){if(Math.hypot(e.clientX-this._pointerGesture.startX,e.clientY-this._pointerGesture.startY)<6)return;this._pointerGesture.moved=!0,this._beginPointerDrag(e.clientX,e.clientY)}!this._dragState||this._dragState.keyboard||(this._nestModifier=!!e.altKey,this._lastPointer={x:e.clientX,y:e.clientY},this._movePointerPreview(e.clientX,e.clientY),this._updateAutoScroll(e.clientX,e.clientY),this._retarget(e.clientX,e.clientY,{timestamp:e.timeStamp}))}}_updateAutoScroll(e,t){this._autoScrollPoint={x:e,y:t},!this._autoScrollFrame&&typeof requestAnimationFrame=="function"&&(this._autoScrollFrame=requestAnimationFrame(this._autoScrollTick))}_stopAutoScroll(){this._autoScrollFrame&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this._autoScrollFrame),this._autoScrollFrame=0,this._autoScrollPoint=null}_scrollOwn(e,t){const i=this.ownerDocument?.defaultView;let r=!1;const s=this.root.querySelector(".lists");if(s&&s.scrollWidth>s.clientWidth+1){const a=s.getBoundingClientRect(),d=V(e,Math.max(0,a.left),Math.min(i?.innerWidth??1/0,a.right));d&&(s.scrollLeft+=d,r=!0)}const n=this._pathFromPoint(e,t).find(a=>a.classList?.contains("items"));if(n&&n.scrollHeight>n.clientHeight+1&&i?.getComputedStyle(n).overflowY!=="visible"){const a=n.getBoundingClientRect(),d=V(t,a.top,a.bottom);d&&(n.scrollTop+=d,r=!0)}return r}_onPointerUp(e){if(!this._pointerGesture||e.pointerId!==this._pointerGesture.pointerId)return;e.preventDefault();try{this._pointerGesture.captureTarget?.releasePointerCapture?.(e.pointerId)}catch{}const t=this._pointerGesture;if(this._clearHoldTimer(),this._pointerGesture=null,this._stopAutoScroll(),!this._dragState||this._dragState.keyboard)return;this._nestModifier=!!e.altKey;const i=t.moved?this._externalAt(e.clientX,e.clientY):null;if(i){i.usable&&i.target?this._transferTo(i.peer,i.target,this._dragState.movedRootIds,this._dragState.clone,"pointer"):this._cancelDrag(!0);return}const r=t.moved?this._releaseDropTarget(e.clientX,e.clientY):null;if(t.moved&&r){this._commitMove(r,this._dragState.movedRootIds,this._dragState.clone,"pointer");return}t.moved?this._cancelDrag(!0):(this._setDropTargetVisualState(this._dragState.dropTarget,!1),this._clearPointerDragPreview(),this._dragState=null,this._removeDragImage(),this.requestRender())}_onPointerCancel(e){!this._pointerGesture||e.pointerId!==this._pointerGesture.pointerId||(this._clearHoldTimer(),this._pointerGesture=null,this._stopAutoScroll(),this._dragState&&this._cancelDrag(!0))}_setSelection(e,t){const i=new Set(this._items.map(a=>a.id)),r=Array.from(new Set(e.filter(a=>i.has(a)))),s=[...this._selection];this._selection=r,this._rangeAnchorId=r[r.length-1]||null,this._focusedId=r[r.length-1]||this._focusedId;const n=re(r);if(this.getAttribute("selection")!==n){this._lastSelectionAttr=n,this._suppressAttributeRender=!0;try{r.length?this.setAttribute("selection",n):this.removeAttribute("selection")}finally{this._suppressAttributeRender=!1}}if(this.dispatchEvent(new CustomEvent("selection-change",{detail:{selection:[...r],previousSelection:s},bubbles:!0,composed:!0})),t!=="restore"){if(this._applyInteractiveStateInPlace({restoreFocus:!0}))return;this.requestRender()}}_toggleSelection(e){const t=this._selection.includes(e)?this._selection.filter(i=>i!==e):[...this._selection,e];this._setSelection(t,"pointer"),this._announce(this._t("announceSelectedMany",{count:t.length}))}_selectRangeTo(e){const t=this._visibleItemIds(),i=this._rangeAnchorId||this._focusedId||e,r=t.indexOf(i),s=t.indexOf(e);if(r<0||s<0){this._setSelection([e],"pointer");return}const[n,a]=r<=s?[r,s]:[s,r];this._setSelection(t.slice(n,a+1),"pointer"),this._announce(this._t("announceSelectedMany",{count:a-n+1}))}_visibleItemIds(){const e=ne(this._items,new Set(this._selection),new Set(this._draggingIds()),this.filterQuery,this.sort);return Array.from(e.values()).flat().filter(t=>!t.disabled).map(t=>t.id)}_selectedRootIds(e){const t=this._selection.length?[...this._selection]:e?[e]:[],i=T(this._items),r=new Set(t);return t.filter(s=>{const n=i.get(s);if(!n)return!1;let a=n.parentId;for(;a;){if(r.has(a))return!1;a=i.get(a)?.parentId??null}return!n.disabled})}_draggingIds(){if(!this._dragState)return[];const e=T(this._items),t=M(this._items),i=[],r=s=>{i.push(s);const n=e.get(s);if(!n)return;(t.get(w(n.listId,s))||[]).forEach(r)};return this._dragState.movedRootIds.forEach(r),i}_itemClonesOnDrag(e){const t=this._items.find(r=>r.id===e);return t?t.cloneOnDrag?!0:!!this._lists.find(r=>r.id===t.listId)?.cloneOnDrag:!1}_isDragLocked(){return!!(this.hasAttribute("disabled")||this.sort!=="manual"||this.filterQuery&&!this.hasAttribute("allow-filtered-drag"))}_canDrop(e,t,i=this._dragState?.clone??!1,r){if(this._isDragLocked())return!1;const s=this._lists.find(l=>l.id===e.listId);if(!s||s.disabled)return!1;const n=T(this._items),a=new Set,d=M(this._items);if(r)r.items.forEach(l=>a.add(l.id));else{const l=p=>{a.add(p);const g=n.get(p);g&&(d.get(w(g.listId,p))||[]).forEach(l)};if(t.forEach(l),e.parentId&&a.has(e.parentId)||e.beforeId&&a.has(e.beforeId))return!1}if(r&&!r.clone&&r.items.some(l=>n.has(l.id)))return!1;const o=r?r.sourceListIds:Array.from(new Set(t.map(l=>n.get(l)?.listId).filter(Boolean)));if(s.accepts?.length&&o.some(l=>!s.accepts?.includes(l))||e.mode==="inside"&&this.getAttribute("allow-nesting")==="false")return!1;if(s.maxItems!==void 0){const l=this._items.filter(g=>g.listId===e.listId),p=r?r.items.length:i?a.size:Array.from(a).filter(g=>n.get(g)?.listId!==e.listId).length;if(p>0&&l.length+p>s.maxItems)return!1}const c=this._canDropCallback;if(c)try{const l=r?r.items.filter(g=>r.rootIds.includes(g.id)):t.map(g=>n.get(g)).filter(g=>!!g);if(!c({items:l.map(q),movedIds:[...t],targetListId:e.listId,parentId:e.parentId,beforeId:e.beforeId,mode:e.mode,clone:i,...r?{from:r.source}:{}}))return!1}catch(l){return console.error("ui-sortable: canDrop threw; the drop is refused.",l),!1}return!0}_commitMove(e,t,i,r){if(!this._canDrop(e,t,i))return!1;const s=T(this._items),n=U(this._items,this._lists,e,t,i,(c,l)=>this._cloneSubtreeItem(c,l)),a=t.map(c=>s.get(c)).filter(c=>!!c),d=i?"clone":e.mode==="inside"?"nest":a.some(c=>c.listId!==e.listId)?"transfer":"reorder",o={items:n.items,movedIds:n.insertedRootIds,nextSelection:[...n.insertedRootIds],operation:d,target:e,clone:i,source:r};return this._askBeforeChange(o)?(this._applyPlan(o),!0):(this._dragState&&this._cancelDrag(!1),this._announce(this._t("announceRejected")),!1)}_askBeforeChange(e){return this.dispatchEvent(new CustomEvent("before-change",{detail:{items:e.items.map(q),lists:this.lists,selection:[...e.nextSelection],previousSelection:[...this._selection],movedIds:[...e.movedIds],source:e.source,operation:e.operation,persistence:Y(e.items),target:{listId:e.target.listId,parentId:e.target.parentId,beforeId:e.target.beforeId,mode:e.target.mode},clone:e.clone,...e.external?{external:e.external}:{}},bubbles:!0,composed:!0,cancelable:!0}))}_applyPlan(e){const t=[...this._selection];this._dragState&&(this._dragState.committed=!0),this._items=e.items.map(A),this._clearPointerDragPreview(),this._dragState=null,this._removeDragImage(),this._selection=[...e.nextSelection],this._focusedId=e.nextSelection[0]||null,this._pendingFocusId=this._focusedId,this._syncAttributesFromState();const i=Y(this._items);this._persistSnapshot(i);const r={items:this.items,lists:this.lists,selection:[...e.nextSelection],previousSelection:t,movedIds:[...e.movedIds],source:e.source,operation:e.operation,persistence:i,...e.external?{external:e.external}:{}};this.dispatchEvent(new CustomEvent("change",{detail:r,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("persist-request",{detail:r,bubbles:!0,composed:!0})),this._announce(this._messageForMove(e.operation,e.movedIds.length,e.target,e.destination)),this.requestRender()}_syncAttributesFromState(){const e=_e(this._lists),t=be(this._items),i=re(this._selection);this._lastListsAttr=e,this._lastItemsAttr=t,this._lastSelectionAttr=i,this._suppressAttributeRender=!0;try{this.setAttribute("lists",e),this.setAttribute("items",t),this._selection.length?this.setAttribute("selection",i):this.removeAttribute("selection")}finally{this._suppressAttributeRender=!1}}_cloneSubtreeItem(e,t){const r=`copy-${this._cloneSeed++}`,n=`${e.id.includes("--copy-")?e.id.split("--copy-")[0]:e.id}--${r}`;return{...e,id:n,label:t[0]===e.id?`${e.label} copy`:e.label,data:B(e.data)}}_messageForMove(e,t,i,r){const s=this._lists.find(d=>d.id===i.listId),n=r||s?.label||i.listId,a={count:t,list:n};return e==="clone"?this._t(t===1?"announceCopiedOne":"announceCopiedMany",a):e==="nest"?this._t(t===1?"announceNestedOne":"announceNestedMany",a):e==="transfer"?this._t(t===1?"announceMovedOne":"announceMovedMany",a):this._t(t===1?"announceReorderedOne":"announceReorderedMany",a)}_announceDragging(e,t,i){t===1?this._announce(this._t(i?"announceDraggingCopy":"announceDragging",{label:e})):this._announce(this._t(i?"announceDraggingCopyMany":"announceDraggingMany",{count:t}))}_persistSnapshot(e){const t=this.getAttribute("persist-key");if(t)try{window.localStorage.setItem(t,JSON.stringify(e))}catch{}}_announce(e){this._liveMessage=e,this._applyLiveMessage()}_cancelDrag(e){this._stopAutoScroll(),this._dragState&&(this._setDraggingVisualState(this._draggingIds(),!1),this._pendingDropTarget=null,this._setExternal(null),this._setDropTargetVisualState(this._dragState.dropTarget,!1),this._clearPointerDragPreview(),this._items=this._dragState.snapshot.map(A),this._dragState=null,this._clearHoldTimer(),this._pointerGesture=null,this._removeDragImage(),e&&this._announce(this._t("announceCancelled")),this._syncAttributesFromState(),this.requestRender())}_removeDragImage(){this._dragImage?.remove(),this._dragImage=null}_applyPointerPreview(e,t,i,r,s){this._removeDragImage();const n=this._dragState?this._findItemElement(this._dragState.originId):null,a=n?this._buildDragGhost(n,i,r,s):null;if(a)this.root.appendChild(a),this._dragImage=a;else{const d=document.createElement("div");d.className="drag-pill",d.textContent=r?i===1?this._t("copyingOne"):this._t("copyingMany",{count:i}):i===1?this._t("movingOne"):this._t("movingMany",{count:i}),this.root.appendChild(d),this._dragImage=d,this._dragImageOffset={x:-14,y:-14}}this._movePointerPreview(e,t)}_buildDragGhost(e,t,i,r){const s=e.getBoundingClientRect(),n=e.cloneNode(!0);if(n.classList.add("item-ghost"),["id","data-id","data-drag-trigger","tabindex","role","aria-selected","aria-disabled"].forEach(c=>{n.removeAttribute(c)}),n.querySelectorAll("[id], [data-id], [data-drag-trigger], [tabindex]").forEach(c=>{["id","data-id","data-drag-trigger","tabindex"].forEach(l=>c.removeAttribute(l))}),n.setAttribute("part","drag-ghost"),n.setAttribute("aria-hidden","true"),n.setAttribute("inert",""),n.setAttribute("data-dragging","false"),n.setAttribute("data-focused","false"),n.setAttribute("data-drop-inside-active","false"),t>1&&n.setAttribute("data-count","stack"),t>1||i){const c=document.createElement("span");c.className="ghost-badge",c.textContent=t>1?String(t):"+",n.appendChild(c)}const a=this.getAttribute("drag-preview-size")==="compact";a&&n.setAttribute("data-compact","true");const d=a?Math.min(s.width,240):s.width;n.style.inlineSize=`${Math.round(d)}px`;const o=!!r&&Number.isFinite(r.x)&&Number.isFinite(r.y);return this._dragImageOffset={x:o?Math.min(Math.max(r.x-s.left,0),d):d/2,y:o?Math.min(Math.max(r.y-s.top,0),s.height):s.height/2},n}_movePointerPreview(e,t){const i=this._dragImage;i&&(i.isConnected||this.root.appendChild(i),i.style.transform=`translate(${Math.round(e-this._dragImageOffset.x)}px, ${Math.round(t-this._dragImageOffset.y)}px)`)}_keyboardDropTargets(){const e=T(this._items),t=M(this._items),i=[],r=this.getAttribute("allow-nesting")!=="false",s=(n,a)=>{const d=t.get(w(n,a))||[];d.forEach(o=>{const c=e.get(o);!c||c.hidden||(i.push({listId:n,parentId:a,beforeId:o,mode:"before",label:this._t("targetBefore",{label:c.label})}),r&&i.push({listId:n,parentId:o,beforeId:null,mode:"inside",label:this._t("targetInside",{label:c.label})}),s(n,o))}),a?r&&d.length>0&&i.push({listId:n,parentId:a,beforeId:null,mode:"before",label:this._t("targetAfterChildren")}):i.push({listId:n,parentId:a,beforeId:null,mode:"before",label:this._t("targetEnd",{list:this._lists.find(o=>o.id===n)?.label||n})})};return this._lists.forEach(n=>s(n.id,null)),i.filter(n=>this._canDrop(n,this._dragState?.movedRootIds||[]))}_initialKeyboardDropTarget(e){const t=this._items.find(i=>i.id===e);return t?{listId:t.listId,parentId:t.parentId,beforeId:e,mode:"before"}:null}_moveKeyboardDropTarget(e){if(!this._dragState)return;const t=this._keyboardDropTargets();if(!t.length)return;const i=Math.max(0,t.findIndex(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)),r=Math.max(0,Math.min(t.length-1,i+e));this._setDropTarget(t[r],{announceLabel:t[r].label})}};$._instances=new Set;let K=$;typeof customElements<"u"&&!customElements.get("ui-sortable")&&customElements.define("ui-sortable",K);exports.UISortable=K;
1002
+ `}_onClick(t){const e=t.composedPath(),i=e.find(o=>o instanceof HTMLElement&&o.classList?.contains("toolbar")),r=this._dragActivatorFromPath(e),s=e.find(o=>o instanceof HTMLElement&&o.classList.contains("item"));if(r&&r.kind!=="item")return;if(!s)return i&&!(t.target instanceof HTMLButtonElement),void 0;const n=s.getAttribute("data-id");if(!n)return;const a=this._items.find(o=>o.id===n);if(!a||a.disabled)return;const d=t;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()){this._syncSelectionVisualState(),this._restorePendingFocus();return}this.requestRender()}_onFocusIn(t){const i=t.composedPath().find(r=>r instanceof HTMLElement&&r.classList.contains("item"))?.getAttribute("data-id");i&&(this._focusedId=i,this._syncSelectionVisualState())}_isForeignControl(t){const e=t.composedPath()[0];return!(e instanceof HTMLElement)||e.classList.contains("handle")||e.classList.contains("item")?!1:e.isContentEditable||e.matches('input, textarea, select, button, summary, a[href], [role="button"], [role="textbox"], [role="combobox"]')}_onKeyDown(t){if(this._isForeignControl(t))return;const e=this._visibleItemIds();if(!e.length)return;const i=this._focusedId&&e.includes(this._focusedId)?this._focusedId:e[0],r=e.indexOf(i),s=this._items.find(l=>l.id===i),a=(s?this._lists.find(l=>l.id===s.listId):null)?.orientation==="horizontal",d=this._isRtl(),o=a?d?"ArrowLeft":"ArrowRight":"ArrowDown",c=a?d?"ArrowRight":"ArrowLeft":"ArrowUp";if(!this._dragState?.keyboard){if(t.key===o){t.preventDefault(),this._moveFocusBy(e,r,1);return}if(t.key===c){t.preventDefault(),this._moveFocusBy(e,r,-1);return}if((t.ctrlKey||t.metaKey)&&t.key.toLowerCase()==="a"){t.preventDefault(),this._setSelection(e,"keyboard"),this._announce(this._t("announceSelectedMany",{count:e.length}));return}if(t.key==="Enter"){t.preventDefault(),this._setSelection([i],"keyboard");return}if(t.key===" "||t.code==="Space"){if(t.preventDefault(),this._isDragLocked()){this._announce(this._t("announceDragDisabled"));return}const l=this._selectedRootIds(i);if(!l.length)return;const p=this._itemClonesOnDrag(i);this._dragState={snapshot:this._items.map(z),movedRootIds:l,originId:i,clone:p,keyboard:!0,dropTarget:this._initialKeyboardDropTarget(i),committed:!1};const g=l.length===1?this._t("announceLifted",{label:s?.label||"item"}):this._t("announceLiftedMany",{count:l.length});this._announce(`${g} ${this._t("announceLiftedHelp")}`),this.requestRender();return}if(t.key==="Escape"){this._setSelection([],"keyboard");return}return}if(t.key==="Escape"){t.preventDefault(),this._cancelDrag(!0);return}if(t.key==="Enter"||t.key===" "||t.code==="Space"){t.preventDefault();const l=this._dragState.dropTarget;if(!l)return;this._commitMove(l,this._dragState.movedRootIds,this._dragState.clone,"keyboard");return}if(["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"].includes(t.key)){t.preventDefault();const l=d?"ArrowLeft":"ArrowRight",p=t.key==="ArrowDown"||t.key===l?1:-1;this._moveKeyboardDropTarget(p)}}_isRtl(){const t=this.ownerDocument?.defaultView?.getComputedStyle(this).direction;return t?t==="rtl":this.closest("[dir]")?.getAttribute("dir")==="rtl"}_moveFocusBy(t,e,i){const r=Math.max(0,Math.min(t.length-1,e+i)),s=t[r];this._focusedId=s,this._pendingFocusId=s,this._revealPending=!0,!this._applyInteractiveStateInPlace({restoreFocus:!0})&&this.requestRender()}_onDragStart(t){(this._pointerGesture||this._dragState&&!this._dragState.keyboard)&&t.preventDefault()}_onDocumentKeyDown(t){if(t.key==="Alt"){this._setNestModifier(!0);return}t.key==="Escape"&&(!this._dragState||this._dragState.keyboard||(t.preventDefault(),this._cancelDrag(!0)))}_onDocumentKeyUp(t){t.key==="Alt"&&this._setNestModifier(!1)}_setNestModifier(t){this._nestModifier!==t&&(this._nestModifier=t,!(!this._dragState||this._dragState.keyboard||this._dragState.committed||!this._lastPointer)&&this._retarget(this._lastPointer.x,this._lastPointer.y,{immediate:!0}))}_retarget(t,e,i){const r=this._dragState;if(!r||r.keyboard||r.committed)return;const s=this._externalAt(t,e);if(s){r.dropTarget&&this._setDropTarget(null),this._pendingDropTarget=null,this._noteRefusal(!!s.target&&!s.usable),this._setExternal(s.usable&&s.target?{peer:s.peer,target:s.target}:null);return}this._setExternal(null);const n=this._dropTargetFromPoint(t,e),a=n&&this._canDrop(n,r.movedRootIds)?n:null;this._noteRefusal(!!n&&!a),i.immediate?this._setDropTarget(a):this._queueDropTarget(a,i.timestamp??performance.now())}_peerUnder(t,e){const i=this._group();if(!i)return null;const r=s=>{const n=s.getBoundingClientRect();return t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom&&n.width>0&&n.height>0};if(r(this))return null;for(const s of $._instances)if(!(s===this||s._group()!==i||!s.isConnected||s.ownerDocument!==this.ownerDocument)&&r(s))return s;return null}_externalAt(t,e){if(!this._dragState||this._dragState.keyboard)return null;const i=this._peerUnder(t,e);if(!i)return null;const r=this._sessionFor(this._dragState.movedRootIds,this._dragState.clone);i._nestModifier=this._nestModifier;const s=i._dropTargetFromPoint(t,e),n=!!s&&i._canDrop(s,r.rootIds,r.clone,r);return{peer:i,target:s,usable:n}}_setExternal(t){const e=this._dragState;if(!e)return;const i=e.external??null;if(!(i&&t&&i.peer===t.peer&&H(i.target,t.target))){if(!i&&!t){e.external=null;return}i?.peer._showExternalTarget(null),e.external=t,t?.peer._showExternalTarget(t.target)}}_showExternalTarget(t){H(this._externalTarget,t)||(this._setDropTargetVisualState(this._externalTarget,!1),this._externalTarget=t,this._setDropTargetVisualState(t,!0))}_sessionFor(t,e){const i=this._dragState?.session;if(i&&i.clone===e&&i.rootIds.join()===t.join())return i;const r=T(this._items),s=M(this._items),n=new Set,a=[],d=c=>{const l=r.get(c);!l||n.has(c)||(n.add(c),a.push(z(l)),(s.get(w(l.listId,c))||[]).forEach(d))};t.forEach(d);const o={source:this,rootIds:[...t],items:a,clone:e,sourceListIds:Array.from(new Set(t.map(c=>r.get(c)?.listId).filter(c=>!!c)))};return this._dragState&&(this._dragState.session=o),o}_transferTo(t,e,i,r,s){const n=()=>(this._dragState&&this._cancelDrag(!1),this._announce(this._t("announceRejected")),!1),a=this._sessionFor(i,r);if(!t._canDrop(e,a.rootIds,a.clone,a))return n();const d=new Set(t._items.map(h=>h.id)),o=new Map;a.items.forEach(h=>{if(!r){o.set(h.id,h.id);return}const f=h.id.includes("--copy-")?h.id.split("--copy-")[0]:h.id;let x="";do x=`${f}--copy-${this._cloneSeed++}`;while(d.has(x));d.add(x),o.set(h.id,x)});const c=a.items.map(h=>{const f=a.rootIds.indexOf(h.id);return{...z(h),id:o.get(h.id)||h.id,parentId:h.parentId&&o.has(h.parentId)&&o.get(h.parentId)||null,listId:e.listId,label:r&&f===0?`${h.label} copy`:h.label,...h.data!==void 0?{data:B(h.data)}:{}}}),l=a.rootIds.map(h=>o.get(h)||h),p=U([...t._items,...c],t._lists,e,l,!1,h=>h),g=t._lists.find(h=>h.id===e.listId),b={items:p.items,movedIds:l,nextSelection:[...l],operation:r?"clone":e.mode==="inside"?"nest":"transfer",target:e,clone:r,source:s,external:{direction:"in",peer:this}};let y=null;if(!r){const h=new Set(a.items.map(f=>f.id));y={items:J(this._lists,this._items.filter(f=>!h.has(f.id)).map(z)),movedIds:[...a.rootIds],nextSelection:this._selection.filter(f=>!h.has(f)),operation:"transfer",target:e,clone:!1,source:s,external:{direction:"out",peer:t},destination:g?.label||e.listId}}return!t._askBeforeChange(b)||y&&!this._askBeforeChange(y)?n():(this._setExternal(null),t._showExternalTarget(null),y?this._applyPlan(y):(this._dragState&&(this._dragState.committed=!0),this._stopAutoScroll(),this._clearPointerDragPreview(),this._dragState=null,this._removeDragImage(),this.requestRender()),t._applyPlan(b),!0)}_noteRefusal(t){this._dragImage?.toggleAttribute&&this._dragImage.toggleAttribute("data-refused",t)}_dropTargetFromPath(t,e,i){const r=t.find(I=>I instanceof HTMLElement&&I.classList.contains("dropzone"));if(r){const I={listId:r.getAttribute("data-list-id")||"",parentId:r.getAttribute("data-parent-id")||null,beforeId:r.getAttribute("data-before-id")||null,mode:r.getAttribute("data-mode")==="inside"?"inside":"before"};if(I.listId)return I}const s=t.find(I=>I instanceof HTMLElement&&I.classList.contains("item"));if(!s){const P=t.find(k=>k instanceof HTMLElement&&k.classList.contains("list")&&k.hasAttribute("data-list-id"))?.getAttribute("data-list-id");return P?{listId:P,parentId:null,beforeId:null,mode:"before"}:null}const n=s.getAttribute("data-id");if(!n)return null;const a=this._items.find(I=>I.id===n);if(!a)return null;const d=this._lists.find(I=>I.id===a.listId),o=s.getBoundingClientRect(),c=d?.orientation==="horizontal",l=c?o.left:o.top,p=c?o.right:o.bottom,g=c?e:i,b=Math.max(1,p-l),y=(g-l)/b,h=c&&this._isRtl()?1-y:y,f=this.getAttribute("allow-nesting")!=="false"&&!a.disabled,x=this._nestTrigger(),D=f&&(x==="area"?h>.34&&h<=.74:h>=.25&&h<=.75&&(this._nestModifier||x==="gutter"&&this._inNestGutter(o,e,i,c))),C=x==="area"?h<=.34:h<.5;if(D)return{listId:a.listId,parentId:a.id,beforeId:null,mode:"inside"};if(C)return{listId:a.listId,parentId:a.parentId,beforeId:a.id,mode:"before"};const E=M(this._items).get(w(a.listId,a.parentId))||[],F=E.indexOf(a.id),_=F>=0&&E[F+1]||null;return{listId:a.listId,parentId:a.parentId,beforeId:_,mode:"before"}}_inNestGutter(t,e,i,r){if(r){const a=t.bottom-t.top;return i>=t.bottom-Math.max(24,Math.min(70,a*.3))}const s=t.right-t.left,n=Math.max(48,Math.min(140,s*.3));return this._isRtl()?e<=t.left+n:e>=t.right-n}_dropTargetFromPoint(t,e){return this._dropTargetFromPath(this._pathFromPoint(t,e),t,e)}_beginPointerDrag(t,e){if(!this._pointerGesture||this._dragState)return;const i=this._items.find(r=>r.id===this._pointerGesture?.originId);i&&(this._dragState={snapshot:this._items.map(z),movedRootIds:[...this._pointerGesture.movedRootIds],originId:this._pointerGesture.originId,clone:this._pointerGesture.clone,keyboard:!1,dropTarget:null,committed:!1},this._pendingDropTarget=null,this._applyPointerPreview(t,e,this._dragState.movedRootIds.length,this._dragState.clone,{x:this._pointerGesture.startX,y:this._pointerGesture.startY}),this._setDraggingVisualState(this._draggingIds(),!0),this._announceDragging(i.label,this._dragState.movedRootIds.length,this._dragState.clone))}_onPointerDown(t){const e=this._dragActivatorFromPath(t.composedPath()),i=e?.id;if(!e||!i)return;if(this._isDragLocked()){t.preventDefault(),this._announce(this._t("announceDragDisabled"));return}const r=this._items.find(a=>a.id===i);if(!r||r.disabled||r.dragDisabled){t.preventDefault();return}const s=t.pointerType==="touch"&&e.kind!=="handle"&&this._touchHoldDelay()>0;s||t.preventDefault();try{e.element.setPointerCapture?.(t.pointerId)}catch{}this._clearHoldTimer();const n=this._selection.includes(i)?this._selectedRootIds(i):[i];if(this._pointerGesture={pointerId:t.pointerId,pointerType:t.pointerType,originId:i,movedRootIds:n,clone:this._itemClonesOnDrag(i),startX:t.clientX,startY:t.clientY,moved:!1,captureTarget:e.element,hold:s,holdTimer:null},s){const a=this._pointerGesture;a.holdTimer=setTimeout(()=>{if(a.holdTimer=null,!(this._pointerGesture!==a||a.moved)){a.hold=!1,a.moved=!0,this._beginPointerDrag(a.startX,a.startY),this._lastPointer={x:a.startX,y:a.startY};try{this.ownerDocument?.defaultView?.navigator?.vibrate?.(8)}catch{}}},this._touchHoldDelay())}}_touchHoldDelay(){const t=this.getAttribute("touch-hold-delay");if(t===null||t.trim()==="")return Z;const e=Number(t);return Number.isFinite(e)?Math.min(2e3,Math.max(0,e)):Z}_clearHoldTimer(){this._pointerGesture?.holdTimer&&clearTimeout(this._pointerGesture.holdTimer),this._pointerGesture&&(this._pointerGesture.holdTimer=null)}_onTouchMove(t){this._dragState&&!this._dragState.keyboard&&t.cancelable&&t.preventDefault()}_onContextMenu(t){(this._pointerGesture?.pointerType==="touch"||this._dragState&&!this._dragState.keyboard)&&t.preventDefault()}_onPointerMove(t){if(!(!this._pointerGesture||t.pointerId!==this._pointerGesture.pointerId)){if(this._pointerGesture.hold){Math.hypot(t.clientX-this._pointerGesture.startX,t.clientY-this._pointerGesture.startY)>pt&&(this._clearHoldTimer(),this._pointerGesture=null);return}if(t.preventDefault(),!this._pointerGesture.moved){if(Math.hypot(t.clientX-this._pointerGesture.startX,t.clientY-this._pointerGesture.startY)<6)return;this._pointerGesture.moved=!0,this._beginPointerDrag(t.clientX,t.clientY)}!this._dragState||this._dragState.keyboard||(this._nestModifier=!!t.altKey,this._lastPointer={x:t.clientX,y:t.clientY},this._movePointerPreview(t.clientX,t.clientY),this._updateAutoScroll(t.clientX,t.clientY),this._retarget(t.clientX,t.clientY,{timestamp:t.timeStamp}))}}_updateAutoScroll(t,e){this._autoScrollPoint={x:t,y:e},!this._autoScrollFrame&&typeof requestAnimationFrame=="function"&&(this._autoScrollFrame=requestAnimationFrame(this._autoScrollTick))}_stopAutoScroll(){this._autoScrollFrame&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this._autoScrollFrame),this._autoScrollFrame=0,this._autoScrollPoint=null}_scrollOwn(t,e){const i=this.ownerDocument?.defaultView;let r=!1;const s=this.root.querySelector(".lists");if(s&&s.scrollWidth>s.clientWidth+1){const a=s.getBoundingClientRect(),d=V(t,Math.max(0,a.left),Math.min(i?.innerWidth??1/0,a.right));d&&(s.scrollLeft+=d,r=!0)}const n=this._pathFromPoint(t,e).find(a=>a.classList?.contains("items"));if(n&&n.scrollHeight>n.clientHeight+1&&i?.getComputedStyle(n).overflowY!=="visible"){const a=n.getBoundingClientRect(),d=V(e,a.top,a.bottom);d&&(n.scrollTop+=d,r=!0)}return r}_onPointerUp(t){if(!this._pointerGesture||t.pointerId!==this._pointerGesture.pointerId)return;t.preventDefault();try{this._pointerGesture.captureTarget?.releasePointerCapture?.(t.pointerId)}catch{}const e=this._pointerGesture;if(this._clearHoldTimer(),this._pointerGesture=null,this._stopAutoScroll(),!this._dragState||this._dragState.keyboard)return;this._nestModifier=!!t.altKey;const i=e.moved?this._externalAt(t.clientX,t.clientY):null;if(i){i.usable&&i.target?this._transferTo(i.peer,i.target,this._dragState.movedRootIds,this._dragState.clone,"pointer"):this._cancelDrag(!0);return}const r=e.moved?this._releaseDropTarget(t.clientX,t.clientY):null;if(e.moved&&r){this._commitMove(r,this._dragState.movedRootIds,this._dragState.clone,"pointer");return}e.moved?this._cancelDrag(!0):(this._setDropTargetVisualState(this._dragState.dropTarget,!1),this._clearPointerDragPreview(),this._dragState=null,this._removeDragImage(),this.requestRender())}_onPointerCancel(t){!this._pointerGesture||t.pointerId!==this._pointerGesture.pointerId||(this._clearHoldTimer(),this._pointerGesture=null,this._stopAutoScroll(),this._dragState&&this._cancelDrag(!0))}_setSelection(t,e){const i=new Set(this._items.map(a=>a.id)),r=Array.from(new Set(t.filter(a=>i.has(a)))),s=[...this._selection];this._selection=r,this._rangeAnchorId=r[r.length-1]||null,this._focusedId=r[r.length-1]||this._focusedId;const n=rt(r);if(this.getAttribute("selection")!==n){this._lastSelectionAttr=n,this._suppressAttributeRender=!0;try{r.length?this.setAttribute("selection",n):this.removeAttribute("selection")}finally{this._suppressAttributeRender=!1}}if(this.dispatchEvent(new CustomEvent("selection-change",{detail:{selection:[...r],previousSelection:s},bubbles:!0,composed:!0})),e!=="restore"){if(this._applyInteractiveStateInPlace({restoreFocus:!0}))return;this.requestRender()}}_toggleSelection(t){const e=this._selection.includes(t)?this._selection.filter(i=>i!==t):[...this._selection,t];this._setSelection(e,"pointer"),this._announce(this._t("announceSelectedMany",{count:e.length}))}_selectRangeTo(t){const e=this._visibleItemIds(),i=this._rangeAnchorId||this._focusedId||t,r=e.indexOf(i),s=e.indexOf(t);if(r<0||s<0){this._setSelection([t],"pointer");return}const[n,a]=r<=s?[r,s]:[s,r];this._setSelection(e.slice(n,a+1),"pointer"),this._announce(this._t("announceSelectedMany",{count:a-n+1}))}_visibleItemIds(){const t=nt(this._items,new Set(this._selection),new Set(this._draggingIds()),this.filterQuery,this.sort);return Array.from(t.values()).flat().filter(e=>!e.disabled).map(e=>e.id)}_selectedRootIds(t){const e=this._selection.length?[...this._selection]:t?[t]:[],i=T(this._items),r=new Set(e);return e.filter(s=>{const n=i.get(s);if(!n)return!1;let a=n.parentId;for(;a;){if(r.has(a))return!1;a=i.get(a)?.parentId??null}return!n.disabled})}_draggingIds(){if(!this._dragState)return[];const t=T(this._items),e=M(this._items),i=[],r=s=>{i.push(s);const n=t.get(s);if(!n)return;(e.get(w(n.listId,s))||[]).forEach(r)};return this._dragState.movedRootIds.forEach(r),i}_itemClonesOnDrag(t){const e=this._items.find(r=>r.id===t);return e?e.cloneOnDrag?!0:!!this._lists.find(r=>r.id===e.listId)?.cloneOnDrag:!1}_isDragLocked(){return!!(this.hasAttribute("disabled")||this.sort!=="manual"||this.filterQuery&&!this.hasAttribute("allow-filtered-drag"))}_canDrop(t,e,i=this._dragState?.clone??!1,r){if(this._isDragLocked())return!1;const s=this._lists.find(l=>l.id===t.listId);if(!s||s.disabled)return!1;const n=T(this._items),a=new Set,d=M(this._items);if(r)r.items.forEach(l=>a.add(l.id));else{const l=p=>{a.add(p);const g=n.get(p);g&&(d.get(w(g.listId,p))||[]).forEach(l)};if(e.forEach(l),t.parentId&&a.has(t.parentId)||t.beforeId&&a.has(t.beforeId))return!1}if(r&&!r.clone&&r.items.some(l=>n.has(l.id)))return!1;const o=r?r.sourceListIds:Array.from(new Set(e.map(l=>n.get(l)?.listId).filter(Boolean)));if(s.accepts?.length&&o.some(l=>!s.accepts?.includes(l))||t.mode==="inside"&&this.getAttribute("allow-nesting")==="false")return!1;if(s.maxItems!==void 0){const l=this._items.filter(g=>g.listId===t.listId),p=r?r.items.length:i?a.size:Array.from(a).filter(g=>n.get(g)?.listId!==t.listId).length;if(p>0&&l.length+p>s.maxItems)return!1}const c=this._canDropCallback;if(c)try{const l=r?r.items.filter(g=>r.rootIds.includes(g.id)):e.map(g=>n.get(g)).filter(g=>!!g);if(!c({items:l.map(q),movedIds:[...e],targetListId:t.listId,parentId:t.parentId,beforeId:t.beforeId,mode:t.mode,clone:i,...r?{from:r.source}:{}}))return!1}catch(l){return console.error("ui-sortable: canDrop threw; the drop is refused.",l),!1}return!0}_commitMove(t,e,i,r){if(!this._canDrop(t,e,i))return!1;const s=T(this._items),n=U(this._items,this._lists,t,e,i,(c,l)=>this._cloneSubtreeItem(c,l)),a=e.map(c=>s.get(c)).filter(c=>!!c),d=i?"clone":t.mode==="inside"?"nest":a.some(c=>c.listId!==t.listId)?"transfer":"reorder",o={items:n.items,movedIds:n.insertedRootIds,nextSelection:[...n.insertedRootIds],operation:d,target:t,clone:i,source:r};return this._askBeforeChange(o)?(this._applyPlan(o),!0):(this._dragState&&this._cancelDrag(!1),this._announce(this._t("announceRejected")),!1)}_askBeforeChange(t){return this.dispatchEvent(new CustomEvent("before-change",{detail:{items:t.items.map(q),lists:this.lists,selection:[...t.nextSelection],previousSelection:[...this._selection],movedIds:[...t.movedIds],source:t.source,operation:t.operation,persistence:Y(t.items),target:{listId:t.target.listId,parentId:t.target.parentId,beforeId:t.target.beforeId,mode:t.target.mode},clone:t.clone,...t.external?{external:t.external}:{}},bubbles:!0,composed:!0,cancelable:!0}))}_applyPlan(t){const e=[...this._selection];this._dragState&&(this._dragState.committed=!0),this._items=t.items.map(z),this._clearPointerDragPreview(),this._dragState=null,this._removeDragImage(),this._selection=[...t.nextSelection],this._focusedId=t.nextSelection[0]||null,this._pendingFocusId=this._focusedId,this._syncAttributesFromState();const i=Y(this._items);this._persistSnapshot(i);const r={items:this.items,lists:this.lists,selection:[...t.nextSelection],previousSelection:e,movedIds:[...t.movedIds],source:t.source,operation:t.operation,persistence:i,...t.external?{external:t.external}:{}};this.dispatchEvent(new CustomEvent("change",{detail:r,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("persist-request",{detail:r,bubbles:!0,composed:!0})),this._announce(this._messageForMove(t.operation,t.movedIds.length,t.target,t.destination)),this.requestRender()}_syncAttributesFromState(){const t=_t(this._lists),e=bt(this._items),i=rt(this._selection);this._lastListsAttr=t,this._lastItemsAttr=e,this._lastSelectionAttr=i,this._suppressAttributeRender=!0;try{this.setAttribute("lists",t),this.setAttribute("items",e),this._selection.length?this.setAttribute("selection",i):this.removeAttribute("selection")}finally{this._suppressAttributeRender=!1}}_cloneSubtreeItem(t,e){const r=`copy-${this._cloneSeed++}`,n=`${t.id.includes("--copy-")?t.id.split("--copy-")[0]:t.id}--${r}`;return{...t,id:n,label:e[0]===t.id?`${t.label} copy`:t.label,data:B(t.data)}}_messageForMove(t,e,i,r){const s=this._lists.find(d=>d.id===i.listId),n=r||s?.label||i.listId,a={count:e,list:n};return t==="clone"?this._t(e===1?"announceCopiedOne":"announceCopiedMany",a):t==="nest"?this._t(e===1?"announceNestedOne":"announceNestedMany",a):t==="transfer"?this._t(e===1?"announceMovedOne":"announceMovedMany",a):this._t(e===1?"announceReorderedOne":"announceReorderedMany",a)}_announceDragging(t,e,i){e===1?this._announce(this._t(i?"announceDraggingCopy":"announceDragging",{label:t})):this._announce(this._t(i?"announceDraggingCopyMany":"announceDraggingMany",{count:e}))}_persistSnapshot(t){const e=this.getAttribute("persist-key");if(e)try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}}_announce(t){this._liveMessage=t,this._applyLiveMessage()}_cancelDrag(t){this._stopAutoScroll(),this._dragState&&(this._setDraggingVisualState(this._draggingIds(),!1),this._pendingDropTarget=null,this._setExternal(null),this._setDropTargetVisualState(this._dragState.dropTarget,!1),this._clearPointerDragPreview(),this._items=this._dragState.snapshot.map(z),this._dragState=null,this._clearHoldTimer(),this._pointerGesture=null,this._removeDragImage(),t&&this._announce(this._t("announceCancelled")),this._syncAttributesFromState(),this.requestRender())}_removeDragImage(){this._dragImage?.remove(),this._dragImage=null}_applyPointerPreview(t,e,i,r,s){this._removeDragImage();const n=this._dragState?this._findItemElement(this._dragState.originId):null,a=n?this._buildDragGhost(n,i,r,s):null;if(a)this.root.appendChild(a),this._dragImage=a;else{const d=document.createElement("div");d.className="drag-pill",d.textContent=r?i===1?this._t("copyingOne"):this._t("copyingMany",{count:i}):i===1?this._t("movingOne"):this._t("movingMany",{count:i}),this.root.appendChild(d),this._dragImage=d,this._dragImageOffset={x:-14,y:-14}}this._movePointerPreview(t,e)}_buildDragGhost(t,e,i,r){const s=t.getBoundingClientRect(),n=t.cloneNode(!0);if(n.classList.add("item-ghost"),["id","data-id","data-drag-trigger","tabindex","role","aria-selected","aria-disabled"].forEach(c=>{n.removeAttribute(c)}),n.querySelectorAll("[id], [data-id], [data-drag-trigger], [tabindex]").forEach(c=>{["id","data-id","data-drag-trigger","tabindex"].forEach(l=>c.removeAttribute(l))}),n.setAttribute("part","drag-ghost"),n.setAttribute("aria-hidden","true"),n.setAttribute("inert",""),n.setAttribute("data-dragging","false"),n.setAttribute("data-focused","false"),n.setAttribute("data-drop-inside-active","false"),e>1&&n.setAttribute("data-count","stack"),e>1||i){const c=document.createElement("span");c.className="ghost-badge",c.textContent=e>1?String(e):"+",n.appendChild(c)}const a=this.getAttribute("drag-preview-size")==="compact";a&&n.setAttribute("data-compact","true");const d=a?Math.min(s.width,240):s.width;n.style.inlineSize=`${Math.round(d)}px`;const o=!!r&&Number.isFinite(r.x)&&Number.isFinite(r.y);return this._dragImageOffset={x:o?Math.min(Math.max(r.x-s.left,0),d):d/2,y:o?Math.min(Math.max(r.y-s.top,0),s.height):s.height/2},n}_movePointerPreview(t,e){const i=this._dragImage;i&&(i.isConnected||this.root.appendChild(i),i.style.transform=`translate(${Math.round(t-this._dragImageOffset.x)}px, ${Math.round(e-this._dragImageOffset.y)}px)`)}_keyboardDropTargets(){const t=T(this._items),e=M(this._items),i=[],r=this.getAttribute("allow-nesting")!=="false",s=(n,a)=>{const d=e.get(w(n,a))||[];d.forEach(o=>{const c=t.get(o);!c||c.hidden||(i.push({listId:n,parentId:a,beforeId:o,mode:"before",label:this._t("targetBefore",{label:c.label})}),r&&i.push({listId:n,parentId:o,beforeId:null,mode:"inside",label:this._t("targetInside",{label:c.label})}),s(n,o))}),a?r&&d.length>0&&i.push({listId:n,parentId:a,beforeId:null,mode:"before",label:this._t("targetAfterChildren")}):i.push({listId:n,parentId:a,beforeId:null,mode:"before",label:this._t("targetEnd",{list:this._lists.find(o=>o.id===n)?.label||n})})};return this._lists.forEach(n=>s(n.id,null)),i.filter(n=>this._canDrop(n,this._dragState?.movedRootIds||[]))}_initialKeyboardDropTarget(t){const e=this._items.find(i=>i.id===t);return e?{listId:e.listId,parentId:e.parentId,beforeId:t,mode:"before"}:null}_moveKeyboardDropTarget(t){if(!this._dragState)return;const e=this._keyboardDropTargets();if(!e.length)return;const i=Math.max(0,e.findIndex(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)),r=Math.max(0,Math.min(e.length-1,i+t));this._setDropTarget(e[r],{announceLabel:e[r].label})}};$._instances=new Set;let K=$;typeof customElements<"u"&&!customElements.get("ui-sortable")&&customElements.define("ui-sortable",K);exports.UISortable=K;