@getflip/swirl-components 0.12.0 → 0.13.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 (392) hide show
  1. package/components.json +425 -84
  2. package/dist/cjs/balancetext-7a0bdee3.js +763 -0
  3. package/dist/cjs/{floating-ui.dom.esm-75453e4e.js → floating-ui.dom.esm-35943202.js} +0 -0
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/swirl-action-list-item.cjs.entry.js +1 -1
  6. package/dist/cjs/swirl-action-list.cjs.entry.js +1 -1
  7. package/dist/cjs/swirl-app-layout_5.cjs.entry.js +1 -1
  8. package/dist/cjs/swirl-autocomplete.cjs.entry.js +3 -3
  9. package/dist/cjs/swirl-banner.cjs.entry.js +1 -1
  10. package/dist/cjs/swirl-button.cjs.entry.js +1 -1
  11. package/dist/cjs/swirl-chip.cjs.entry.js +1 -1
  12. package/dist/cjs/swirl-components.cjs.js +1 -1
  13. package/dist/cjs/swirl-console-layout.cjs.entry.js +1 -1
  14. package/dist/cjs/swirl-date-input.cjs.entry.js +9 -3
  15. package/dist/cjs/swirl-date-picker_2.cjs.entry.js +14 -81
  16. package/dist/cjs/swirl-file-viewer_7.cjs.entry.js +1 -1
  17. package/dist/cjs/swirl-form-control.cjs.entry.js +15 -1
  18. package/dist/cjs/swirl-heading.cjs.entry.js +15 -1
  19. package/dist/cjs/swirl-icon-check-small_4.cjs.entry.js +3440 -0
  20. package/dist/cjs/swirl-icon-error_3.cjs.entry.js +1 -1
  21. package/dist/cjs/swirl-lightbox.cjs.entry.js +1 -1
  22. package/dist/cjs/swirl-pdf-reader.cjs.entry.js +1 -1
  23. package/dist/cjs/swirl-popover.cjs.entry.js +2 -2
  24. package/dist/cjs/swirl-resource-list-file-item.cjs.entry.js +1 -1
  25. package/dist/cjs/swirl-search.cjs.entry.js +1 -1
  26. package/dist/cjs/swirl-select.cjs.entry.js +3 -2
  27. package/dist/cjs/swirl-table.cjs.entry.js +1 -1
  28. package/dist/cjs/swirl-text-input.cjs.entry.js +3 -2
  29. package/dist/cjs/swirl-text.cjs.entry.js +16 -2
  30. package/dist/cjs/swirl-toast.cjs.entry.js +1 -1
  31. package/dist/cjs/swirl-tooltip.cjs.entry.js +1 -1
  32. package/dist/cjs/{utils-9c9476b4.js → utils-a07ee0db.js} +18 -0
  33. package/dist/cjs/wc-datepicker.cjs.entry.js +471 -0
  34. package/dist/collection/collection-manifest.json +9 -1
  35. package/dist/collection/components/swirl-autocomplete/swirl-autocomplete.js +35 -18
  36. package/dist/collection/components/swirl-date-input/swirl-date-input.css +11 -0
  37. package/dist/collection/components/swirl-date-input/swirl-date-input.js +77 -21
  38. package/dist/collection/components/swirl-date-picker/swirl-date-picker.css +168 -121
  39. package/dist/collection/components/swirl-date-picker/swirl-date-picker.js +28 -104
  40. package/dist/collection/components/swirl-date-picker/swirl-date-picker.stories.js +0 -5
  41. package/dist/collection/components/swirl-form-control/swirl-form-control.css +22 -0
  42. package/dist/collection/components/swirl-form-control/swirl-form-control.js +33 -0
  43. package/dist/collection/components/swirl-heading/swirl-heading.js +41 -2
  44. package/dist/collection/components/swirl-heading/swirl-heading.stories.js +6 -1
  45. package/dist/collection/components/swirl-icon/icons/swirl-icon-drag-handle.js +67 -0
  46. package/dist/collection/components/swirl-option-list/swirl-option-list.js +236 -13
  47. package/dist/collection/components/swirl-option-list/swirl-option-list.stories.js +6 -8
  48. package/dist/collection/components/swirl-option-list-item/swirl-option-list-item.css +64 -1
  49. package/dist/collection/components/swirl-option-list-item/swirl-option-list-item.js +106 -3
  50. package/dist/collection/components/swirl-option-list-item/swirl-option-list-item.stories.js +8 -0
  51. package/dist/collection/components/swirl-select/swirl-select.css +4 -0
  52. package/dist/collection/components/swirl-select/swirl-select.js +23 -5
  53. package/dist/collection/components/swirl-table/swirl-table.js +0 -1
  54. package/dist/collection/components/swirl-text/swirl-text.js +41 -3
  55. package/dist/collection/components/swirl-text/swirl-text.stories.js +5 -0
  56. package/dist/collection/components/swirl-text-input/swirl-text-input.css +21 -0
  57. package/dist/collection/components/swirl-text-input/swirl-text-input.js +18 -0
  58. package/dist/collection/utils.js +17 -0
  59. package/dist/components/balancetext.js +761 -0
  60. package/dist/components/file-manager.js +34 -28
  61. package/dist/components/index.d.ts +1 -0
  62. package/dist/components/index.js +2 -0
  63. package/dist/components/index2.js +35 -2
  64. package/dist/components/swirl-autocomplete.js +15 -8
  65. package/dist/components/swirl-date-input.js +25 -11
  66. package/dist/components/swirl-date-picker2.js +22 -85
  67. package/dist/components/swirl-file-viewer-csv2.js +1 -1
  68. package/dist/components/swirl-file-viewer-pdf2.js +1 -1
  69. package/dist/components/swirl-file-viewer2.js +1 -1
  70. package/dist/components/swirl-form-control.js +16 -1
  71. package/dist/components/swirl-heading2.js +17 -2
  72. package/dist/components/swirl-icon-drag-handle.d.ts +11 -0
  73. package/dist/components/swirl-icon-drag-handle.js +6 -0
  74. package/dist/components/swirl-icon-drag-handle2.js +37 -0
  75. package/dist/components/swirl-option-list-item2.js +30 -9
  76. package/dist/components/swirl-option-list2.js +3177 -15
  77. package/dist/components/swirl-select.js +18 -10
  78. package/dist/components/swirl-text-input2.js +3 -1
  79. package/dist/components/swirl-text2.js +19 -5
  80. package/dist/components/utils.js +18 -1
  81. package/dist/components/wc-datepicker.js +6 -0
  82. package/dist/components/wc-datepicker2.js +505 -0
  83. package/dist/esm/{_commonjsHelpers-44457d8d.js → _commonjsHelpers-10467d11.js} +1 -1
  84. package/dist/esm/balancetext-31f1ec68.js +761 -0
  85. package/dist/esm/{floating-ui.dom.esm-1a4e8b8a.js → floating-ui.dom.esm-b9f28f6d.js} +0 -0
  86. package/dist/esm/{index-c3028f7d.js → index-47862d62.js} +1 -1
  87. package/dist/esm/loader.js +1 -1
  88. package/dist/esm/swirl-action-list-item.entry.js +3 -3
  89. package/dist/esm/swirl-action-list.entry.js +1 -1
  90. package/dist/esm/swirl-app-layout_5.entry.js +3 -3
  91. package/dist/esm/swirl-autocomplete.entry.js +5 -5
  92. package/dist/esm/swirl-avatar-group.entry.js +2 -2
  93. package/dist/esm/swirl-avatar.entry.js +2 -2
  94. package/dist/esm/swirl-badge.entry.js +2 -2
  95. package/dist/esm/swirl-banner.entry.js +3 -3
  96. package/dist/esm/swirl-button-group.entry.js +2 -2
  97. package/dist/esm/swirl-button.entry.js +3 -3
  98. package/dist/esm/swirl-card.entry.js +2 -2
  99. package/dist/esm/swirl-checkbox.entry.js +2 -2
  100. package/dist/esm/swirl-chip.entry.js +3 -3
  101. package/dist/esm/swirl-components.js +1 -1
  102. package/dist/esm/swirl-console-layout.entry.js +3 -3
  103. package/dist/esm/swirl-date-input.entry.js +10 -4
  104. package/dist/esm/swirl-date-picker_2.entry.js +16 -83
  105. package/dist/esm/swirl-dialog.entry.js +2 -2
  106. package/dist/esm/swirl-file-uploader.entry.js +2 -2
  107. package/dist/esm/swirl-file-viewer_7.entry.js +2 -2
  108. package/dist/esm/swirl-form-control.entry.js +17 -3
  109. package/dist/esm/swirl-form-group.entry.js +2 -2
  110. package/dist/esm/swirl-heading.entry.js +17 -3
  111. package/dist/esm/swirl-icon-add-photo.entry.js +2 -2
  112. package/dist/esm/swirl-icon-add_4.entry.js +2 -2
  113. package/dist/esm/swirl-icon-admin-panel-settings.entry.js +2 -2
  114. package/dist/esm/swirl-icon-arrow-back.entry.js +2 -2
  115. package/dist/esm/swirl-icon-arrow-downward_2.entry.js +2 -2
  116. package/dist/esm/swirl-icon-arrow-forward.entry.js +2 -2
  117. package/dist/esm/swirl-icon-arrow-left_3.entry.js +2 -2
  118. package/dist/esm/swirl-icon-arrow-right-small.entry.js +2 -2
  119. package/dist/esm/swirl-icon-attachment.entry.js +2 -2
  120. package/dist/esm/swirl-icon-block.entry.js +2 -2
  121. package/dist/esm/swirl-icon-cancel_4.entry.js +2 -2
  122. package/dist/esm/swirl-icon-chat-bubble.entry.js +2 -2
  123. package/dist/esm/swirl-icon-chats-filled.entry.js +2 -2
  124. package/dist/esm/swirl-icon-chats-outlined.entry.js +2 -2
  125. package/dist/esm/swirl-icon-check-circle.entry.js +2 -2
  126. package/dist/esm/swirl-icon-check-small_4.entry.js +3433 -0
  127. package/dist/esm/swirl-icon-check-strong.entry.js +2 -2
  128. package/dist/esm/swirl-icon-check.entry.js +2 -2
  129. package/dist/esm/swirl-icon-chevron-left.entry.js +2 -2
  130. package/dist/esm/swirl-icon-chevron-right.entry.js +2 -2
  131. package/dist/esm/swirl-icon-close-small.entry.js +2 -2
  132. package/dist/esm/swirl-icon-close.entry.js +2 -2
  133. package/dist/esm/swirl-icon-cloud-upload.entry.js +2 -2
  134. package/dist/esm/swirl-icon-column.entry.js +2 -2
  135. package/dist/esm/swirl-icon-comment.entry.js +2 -2
  136. package/dist/esm/swirl-icon-copy.entry.js +2 -2
  137. package/dist/esm/swirl-icon-date-range.entry.js +2 -2
  138. package/dist/esm/swirl-icon-delete.entry.js +2 -2
  139. package/dist/esm/swirl-icon-description.entry.js +2 -2
  140. package/dist/esm/swirl-icon-edit.entry.js +2 -2
  141. package/dist/esm/swirl-icon-emoji-mood.entry.js +2 -2
  142. package/dist/esm/swirl-icon-emoji-satisfied.entry.js +2 -2
  143. package/dist/esm/swirl-icon-error_3.entry.js +3 -3
  144. package/dist/esm/swirl-icon-expand-more.entry.js +2 -2
  145. package/dist/esm/swirl-icon-file.entry.js +2 -2
  146. package/dist/esm/swirl-icon-filter.entry.js +2 -2
  147. package/dist/esm/swirl-icon-folder-shared.entry.js +2 -2
  148. package/dist/esm/swirl-icon-group-assign.entry.js +2 -2
  149. package/dist/esm/swirl-icon-groups-custom.entry.js +2 -2
  150. package/dist/esm/swirl-icon-groups-filled.entry.js +2 -2
  151. package/dist/esm/swirl-icon-groups-outlined.entry.js +2 -2
  152. package/dist/esm/swirl-icon-groups.entry.js +2 -2
  153. package/dist/esm/swirl-icon-help.entry.js +2 -2
  154. package/dist/esm/swirl-icon-image.entry.js +2 -2
  155. package/dist/esm/swirl-icon-info.entry.js +2 -2
  156. package/dist/esm/swirl-icon-inventory.entry.js +2 -2
  157. package/dist/esm/swirl-icon-like.entry.js +2 -2
  158. package/dist/esm/swirl-icon-link.entry.js +2 -2
  159. package/dist/esm/swirl-icon-lock.entry.js +2 -2
  160. package/dist/esm/swirl-icon-logout.entry.js +2 -2
  161. package/dist/esm/swirl-icon-mail.entry.js +2 -2
  162. package/dist/esm/swirl-icon-manage-accounts.entry.js +2 -2
  163. package/dist/esm/swirl-icon-mention.entry.js +2 -2
  164. package/dist/esm/swirl-icon-menu-filled.entry.js +2 -2
  165. package/dist/esm/swirl-icon-menu-outlined.entry.js +2 -2
  166. package/dist/esm/swirl-icon-menu.entry.js +2 -2
  167. package/dist/esm/swirl-icon-message.entry.js +2 -2
  168. package/dist/esm/swirl-icon-more-horizontal.entry.js +2 -2
  169. package/dist/esm/swirl-icon-more-vertikal.entry.js +2 -2
  170. package/dist/esm/swirl-icon-news-filled.entry.js +2 -2
  171. package/dist/esm/swirl-icon-news-outlined.entry.js +2 -2
  172. package/dist/esm/swirl-icon-notifications-active.entry.js +2 -2
  173. package/dist/esm/swirl-icon-notifications-off.entry.js +2 -2
  174. package/dist/esm/swirl-icon-notifications.entry.js +2 -2
  175. package/dist/esm/swirl-icon-open-in-new.entry.js +2 -2
  176. package/dist/esm/swirl-icon-people-alt.entry.js +2 -2
  177. package/dist/esm/swirl-icon-person-off.entry.js +2 -2
  178. package/dist/esm/swirl-icon-person.entry.js +2 -2
  179. package/dist/esm/swirl-icon-phone.entry.js +2 -2
  180. package/dist/esm/swirl-icon-poll.entry.js +2 -2
  181. package/dist/esm/swirl-icon-print.entry.js +2 -2
  182. package/dist/esm/swirl-icon-recieved.entry.js +2 -2
  183. package/dist/esm/swirl-icon-search-strong.entry.js +2 -2
  184. package/dist/esm/swirl-icon-search.entry.js +2 -2
  185. package/dist/esm/swirl-icon-send.entry.js +2 -2
  186. package/dist/esm/swirl-icon-settings.entry.js +2 -2
  187. package/dist/esm/swirl-icon-sync.entry.js +2 -2
  188. package/dist/esm/swirl-icon-tasks-filled.entry.js +2 -2
  189. package/dist/esm/swirl-icon-tasks-outlined.entry.js +2 -2
  190. package/dist/esm/swirl-icon-time-filled.entry.js +2 -2
  191. package/dist/esm/swirl-icon-time-outlined.entry.js +2 -2
  192. package/dist/esm/swirl-icon-user-assign.entry.js +2 -2
  193. package/dist/esm/swirl-icon-video-camera.entry.js +2 -2
  194. package/dist/esm/swirl-icon-warning.entry.js +2 -2
  195. package/dist/esm/swirl-lightbox.entry.js +3 -3
  196. package/dist/esm/swirl-modal.entry.js +2 -2
  197. package/dist/esm/swirl-pagination.entry.js +2 -2
  198. package/dist/esm/swirl-pdf-reader.entry.js +3 -3
  199. package/dist/esm/swirl-popover.entry.js +4 -4
  200. package/dist/esm/swirl-progress-indicator.entry.js +2 -2
  201. package/dist/esm/swirl-radio.entry.js +2 -2
  202. package/dist/esm/swirl-resource-list-file-item.entry.js +3 -3
  203. package/dist/esm/swirl-search.entry.js +3 -3
  204. package/dist/esm/swirl-select.entry.js +5 -4
  205. package/dist/esm/swirl-stack.entry.js +2 -2
  206. package/dist/esm/swirl-switch.entry.js +2 -2
  207. package/dist/esm/swirl-tab.entry.js +2 -2
  208. package/dist/esm/swirl-table-row.entry.js +2 -2
  209. package/dist/esm/swirl-table.entry.js +1 -1
  210. package/dist/esm/swirl-tabs.entry.js +2 -2
  211. package/dist/esm/swirl-tag.entry.js +2 -2
  212. package/dist/esm/swirl-text-input.entry.js +5 -4
  213. package/dist/esm/swirl-text.entry.js +19 -5
  214. package/dist/esm/swirl-thumbnail.entry.js +2 -2
  215. package/dist/esm/swirl-toast.entry.js +3 -3
  216. package/dist/esm/swirl-tooltip.entry.js +1 -1
  217. package/dist/esm/swirl-tree-navigation-item.entry.js +2 -2
  218. package/dist/esm/{utils-7efaa1c6.js → utils-33d31b58.js} +18 -1
  219. package/dist/esm/wc-datepicker.entry.js +467 -0
  220. package/dist/swirl-components/{p-17e7ea80.entry.js → p-02266563.entry.js} +1 -1
  221. package/dist/swirl-components/{p-31943bc0.entry.js → p-02781ffc.entry.js} +1 -1
  222. package/dist/swirl-components/{p-33e363ed.entry.js → p-033168e0.entry.js} +1 -1
  223. package/dist/swirl-components/{p-968adc69.entry.js → p-0385eb63.entry.js} +1 -1
  224. package/dist/swirl-components/{p-ebc078da.entry.js → p-07c4ec61.entry.js} +1 -1
  225. package/dist/swirl-components/{p-98827f45.entry.js → p-07e6bd5a.entry.js} +1 -1
  226. package/dist/swirl-components/{p-7c514ca1.entry.js → p-0855060e.entry.js} +1 -1
  227. package/dist/swirl-components/p-085518e9.entry.js +7 -0
  228. package/dist/swirl-components/{p-6043df71.entry.js → p-08a271c1.entry.js} +1 -1
  229. package/dist/swirl-components/{p-0924336d.entry.js → p-0ed20748.entry.js} +1 -1
  230. package/dist/swirl-components/p-0f33e5f9.entry.js +1 -0
  231. package/dist/swirl-components/p-1009db9b.entry.js +1 -0
  232. package/dist/swirl-components/{p-a76e4ffc.entry.js → p-1028d75e.entry.js} +1 -1
  233. package/dist/swirl-components/{p-ab7a08a6.entry.js → p-1586b6d7.entry.js} +1 -1
  234. package/dist/swirl-components/{p-67626481.entry.js → p-165b789f.entry.js} +1 -1
  235. package/dist/swirl-components/{p-86bd3473.js → p-16e63a98.js} +1 -1
  236. package/dist/swirl-components/{p-d16f5f72.entry.js → p-17df9c65.entry.js} +1 -1
  237. package/dist/swirl-components/{p-8cabe3e0.entry.js → p-191c1d21.entry.js} +1 -1
  238. package/dist/swirl-components/{p-c63c0897.entry.js → p-19def4b3.entry.js} +1 -1
  239. package/dist/swirl-components/{p-29e918f4.entry.js → p-1a89f98d.entry.js} +1 -1
  240. package/dist/swirl-components/p-1de6c923.entry.js +1 -0
  241. package/dist/swirl-components/p-1fa4cad9.entry.js +1 -0
  242. package/dist/swirl-components/{p-3991c596.entry.js → p-22eb8331.entry.js} +1 -1
  243. package/dist/swirl-components/{p-d46f437e.entry.js → p-252067c8.entry.js} +1 -1
  244. package/dist/swirl-components/{p-ffe7373d.entry.js → p-2667afa2.entry.js} +1 -1
  245. package/dist/swirl-components/{p-6c620f94.entry.js → p-26db1190.entry.js} +1 -1
  246. package/dist/swirl-components/{p-8f3d1f73.entry.js → p-26f538a6.entry.js} +1 -1
  247. package/dist/swirl-components/{p-659b4fcb.entry.js → p-2a973f5c.entry.js} +1 -1
  248. package/dist/swirl-components/{p-297800ad.entry.js → p-2ab5a45c.entry.js} +1 -1
  249. package/dist/swirl-components/{p-1bff5707.entry.js → p-2ce152e6.entry.js} +1 -1
  250. package/dist/swirl-components/{p-898341d1.entry.js → p-2e34f705.entry.js} +1 -1
  251. package/dist/swirl-components/{p-a61783f1.entry.js → p-30a6b367.entry.js} +1 -1
  252. package/dist/swirl-components/{p-409900a9.entry.js → p-322f0adb.entry.js} +1 -1
  253. package/dist/swirl-components/{p-f17a9780.entry.js → p-33f36ef4.entry.js} +1 -1
  254. package/dist/swirl-components/{p-634e09ad.entry.js → p-35cafad6.entry.js} +1 -1
  255. package/dist/swirl-components/{p-21267175.entry.js → p-3817b462.entry.js} +1 -1
  256. package/dist/swirl-components/{p-745ae10f.entry.js → p-3884afc6.entry.js} +1 -1
  257. package/dist/swirl-components/{p-fb50f7b6.entry.js → p-3918570b.entry.js} +1 -1
  258. package/dist/swirl-components/{p-f8b0f92a.entry.js → p-3f536626.entry.js} +1 -1
  259. package/dist/swirl-components/{p-91039432.entry.js → p-3fb70da1.entry.js} +1 -1
  260. package/dist/swirl-components/{p-96ac53d5.entry.js → p-4054dc61.entry.js} +1 -1
  261. package/dist/swirl-components/{p-5e45f6dc.entry.js → p-40ee5d5c.entry.js} +1 -1
  262. package/dist/swirl-components/p-40ef764d.entry.js +1 -0
  263. package/dist/swirl-components/p-4114d875.entry.js +1 -0
  264. package/dist/swirl-components/{p-733abfbd.entry.js → p-413371ca.entry.js} +1 -1
  265. package/dist/swirl-components/{p-ed56aa85.entry.js → p-465934b5.entry.js} +1 -1
  266. package/dist/swirl-components/{p-294983c3.entry.js → p-48d6ac1d.entry.js} +1 -1
  267. package/dist/swirl-components/{p-4268041a.entry.js → p-4ba456d3.entry.js} +1 -1
  268. package/dist/swirl-components/p-4ef99de5.js +1 -0
  269. package/dist/swirl-components/{p-f09a3f4e.entry.js → p-50b406ed.entry.js} +1 -1
  270. package/dist/swirl-components/{p-8157c96f.entry.js → p-51f56295.entry.js} +1 -1
  271. package/dist/swirl-components/{p-5612f03c.entry.js → p-5b0671a7.entry.js} +1 -1
  272. package/dist/swirl-components/{p-d15994cb.entry.js → p-5bea4bb0.entry.js} +1 -1
  273. package/dist/swirl-components/{p-4f04a176.entry.js → p-5df552ca.entry.js} +1 -1
  274. package/dist/swirl-components/{p-0ed40682.entry.js → p-5e639fbe.entry.js} +1 -1
  275. package/dist/swirl-components/{p-4a16e7e1.entry.js → p-5e7a16ad.entry.js} +1 -1
  276. package/dist/swirl-components/p-627c1474.entry.js +1 -0
  277. package/dist/swirl-components/{p-4e08d391.entry.js → p-64889756.entry.js} +1 -1
  278. package/dist/swirl-components/{p-e8bb09e8.js → p-6526bf3e.js} +0 -0
  279. package/dist/swirl-components/{p-4d7dcfee.entry.js → p-6542ad23.entry.js} +1 -1
  280. package/dist/swirl-components/{p-0d66f638.entry.js → p-68ae564c.entry.js} +1 -1
  281. package/dist/swirl-components/{p-027eabd9.entry.js → p-68ebab79.entry.js} +1 -1
  282. package/dist/swirl-components/{p-d69a0a99.entry.js → p-6a3e0ea9.entry.js} +1 -1
  283. package/dist/swirl-components/{p-170a2b48.entry.js → p-6e6e8e46.entry.js} +1 -1
  284. package/dist/swirl-components/{p-1391e221.entry.js → p-6ed9ab51.entry.js} +1 -1
  285. package/dist/swirl-components/{p-38d67d0e.entry.js → p-6ef0d4f9.entry.js} +1 -1
  286. package/dist/swirl-components/{p-3335383c.entry.js → p-714ad338.entry.js} +1 -1
  287. package/dist/swirl-components/{p-8ee094ca.entry.js → p-71732b9a.entry.js} +1 -1
  288. package/dist/swirl-components/{p-acd8fa1d.entry.js → p-766a7c18.entry.js} +1 -1
  289. package/dist/swirl-components/{p-88abc2db.entry.js → p-76b6b5e3.entry.js} +1 -1
  290. package/dist/swirl-components/{p-a2a3e866.entry.js → p-7825d1c5.entry.js} +1 -1
  291. package/dist/swirl-components/{p-70805149.entry.js → p-78e68acc.entry.js} +1 -1
  292. package/dist/swirl-components/{p-e8618da9.entry.js → p-7a240cf1.entry.js} +1 -1
  293. package/dist/swirl-components/p-7b0adf16.js +7 -0
  294. package/dist/swirl-components/{p-0dd24ec2.entry.js → p-7be538a8.entry.js} +1 -1
  295. package/dist/swirl-components/{p-d2311589.entry.js → p-7f4b8227.entry.js} +1 -1
  296. package/dist/swirl-components/{p-d9760e10.entry.js → p-7fa60f01.entry.js} +1 -1
  297. package/dist/swirl-components/{p-5af19090.entry.js → p-825c1a14.entry.js} +1 -1
  298. package/dist/swirl-components/{p-6e4135eb.entry.js → p-85bb5e81.entry.js} +1 -1
  299. package/dist/swirl-components/{p-c45a50a2.entry.js → p-86183269.entry.js} +1 -1
  300. package/dist/swirl-components/{p-5d0acbf4.entry.js → p-891371a2.entry.js} +1 -1
  301. package/dist/swirl-components/{p-708ea5cf.entry.js → p-89c23241.entry.js} +1 -1
  302. package/dist/swirl-components/{p-d78eb6d8.entry.js → p-89fde1cc.entry.js} +1 -1
  303. package/dist/swirl-components/{p-9f45803b.entry.js → p-8a590a8c.entry.js} +1 -1
  304. package/dist/swirl-components/{p-7a1181b5.entry.js → p-8c7bb6bc.entry.js} +1 -1
  305. package/dist/swirl-components/{p-0206d806.entry.js → p-8e61ba5c.entry.js} +1 -1
  306. package/dist/swirl-components/{p-2aaeb1e6.entry.js → p-8f9b3dda.entry.js} +1 -1
  307. package/dist/swirl-components/p-9142e03b.js +1 -0
  308. package/dist/swirl-components/{p-7602ab40.entry.js → p-920803e1.entry.js} +1 -1
  309. package/dist/swirl-components/p-9bf40265.entry.js +8 -0
  310. package/dist/swirl-components/{p-dbd1b662.entry.js → p-9c691a7b.entry.js} +1 -1
  311. package/dist/swirl-components/{p-32c2d812.entry.js → p-9d9088b6.entry.js} +1 -1
  312. package/dist/swirl-components/{p-49abf88c.entry.js → p-9e963d88.entry.js} +1 -1
  313. package/dist/swirl-components/{p-e7c325b7.entry.js → p-a2da04e6.entry.js} +1 -1
  314. package/dist/swirl-components/{p-96ee66e7.entry.js → p-a452a75d.entry.js} +1 -1
  315. package/dist/swirl-components/{p-e419a9cb.entry.js → p-a80a32e8.entry.js} +1 -1
  316. package/dist/swirl-components/{p-1253d22b.entry.js → p-aa7ea196.entry.js} +1 -1
  317. package/dist/swirl-components/{p-cd8446b2.entry.js → p-abc8f079.entry.js} +1 -1
  318. package/dist/swirl-components/p-af1ffdfc.entry.js +1 -0
  319. package/dist/swirl-components/{p-6baff764.entry.js → p-b0625526.entry.js} +1 -1
  320. package/dist/swirl-components/{p-20ac0472.entry.js → p-b1956111.entry.js} +1 -1
  321. package/dist/swirl-components/{p-e3293a79.entry.js → p-b590bcba.entry.js} +1 -1
  322. package/dist/swirl-components/{p-2bcb979a.entry.js → p-bdfb7b88.entry.js} +1 -1
  323. package/dist/swirl-components/{p-8d998974.entry.js → p-c34e0d50.entry.js} +1 -1
  324. package/dist/swirl-components/{p-043d093e.entry.js → p-c3a7a4bc.entry.js} +1 -1
  325. package/dist/swirl-components/{p-582364ee.entry.js → p-c467d912.entry.js} +1 -1
  326. package/dist/swirl-components/{p-5028921b.entry.js → p-c6578cd1.entry.js} +1 -1
  327. package/dist/swirl-components/{p-d730ab29.entry.js → p-cfb78d4d.entry.js} +1 -1
  328. package/dist/swirl-components/p-d1315bab.entry.js +1 -0
  329. package/dist/swirl-components/{p-c6b1fe02.entry.js → p-d30b3b0a.entry.js} +1 -1
  330. package/dist/swirl-components/{p-a0a3e5d3.entry.js → p-d31e7e68.entry.js} +1 -1
  331. package/dist/swirl-components/{p-a5497705.entry.js → p-d370621c.entry.js} +1 -1
  332. package/dist/swirl-components/{p-99244721.entry.js → p-d3bae550.entry.js} +1 -1
  333. package/dist/swirl-components/{p-0cb291d0.entry.js → p-d6de86fd.entry.js} +1 -1
  334. package/dist/swirl-components/{p-f06a85d3.entry.js → p-d86dbbfc.entry.js} +1 -1
  335. package/dist/swirl-components/{p-90559cbf.entry.js → p-df0c1b6d.entry.js} +1 -1
  336. package/dist/swirl-components/{p-4307ddfe.entry.js → p-e1d74bed.entry.js} +1 -1
  337. package/dist/swirl-components/{p-2fa4c633.entry.js → p-e43e9dc9.entry.js} +1 -1
  338. package/dist/swirl-components/{p-474f4c76.entry.js → p-e66cfaa4.entry.js} +1 -1
  339. package/dist/swirl-components/{p-692e4e5c.entry.js → p-e9c0e313.entry.js} +1 -1
  340. package/dist/swirl-components/{p-15b398b3.entry.js → p-eea09884.entry.js} +1 -1
  341. package/dist/swirl-components/{p-c9307120.entry.js → p-f18a29cb.entry.js} +1 -1
  342. package/dist/swirl-components/{p-c215db6a.entry.js → p-f2683c24.entry.js} +1 -1
  343. package/dist/swirl-components/{p-0a5d1a8f.entry.js → p-f286106d.entry.js} +1 -1
  344. package/dist/swirl-components/{p-13295f24.entry.js → p-f300c8c0.entry.js} +1 -1
  345. package/dist/swirl-components/{p-eac6d46d.entry.js → p-f575ce1b.entry.js} +1 -1
  346. package/dist/swirl-components/{p-06e76536.entry.js → p-f62b9110.entry.js} +1 -1
  347. package/dist/swirl-components/{p-92709d5b.entry.js → p-f88bf73d.entry.js} +1 -1
  348. package/dist/swirl-components/{p-5f461f84.entry.js → p-f8ebfb67.entry.js} +1 -1
  349. package/dist/swirl-components/{p-4181aa7a.entry.js → p-f95cc7e0.entry.js} +1 -1
  350. package/dist/swirl-components/{p-38d22e69.entry.js → p-f9f776e3.entry.js} +1 -1
  351. package/dist/swirl-components/{p-941e7960.entry.js → p-fa26ba4a.entry.js} +1 -1
  352. package/dist/swirl-components/{p-6f039422.entry.js → p-fbc2a9eb.entry.js} +1 -1
  353. package/dist/swirl-components/{p-1339648a.entry.js → p-fc578f42.entry.js} +1 -1
  354. package/dist/swirl-components/{p-f2763bd6.entry.js → p-fed1e05b.entry.js} +1 -1
  355. package/dist/swirl-components/swirl-components.css +1 -1
  356. package/dist/swirl-components/swirl-components.esm.js +1 -1
  357. package/dist/types/components/swirl-autocomplete/swirl-autocomplete.d.ts +2 -1
  358. package/dist/types/components/swirl-date-input/swirl-date-input.d.ts +6 -3
  359. package/dist/types/components/swirl-date-picker/swirl-date-picker.d.ts +6 -10
  360. package/dist/types/components/swirl-date-picker/swirl-date-picker.stories.d.ts +0 -7
  361. package/dist/types/components/swirl-form-control/swirl-form-control.d.ts +2 -0
  362. package/dist/types/components/swirl-heading/swirl-heading.d.ts +5 -0
  363. package/dist/types/components/swirl-heading/swirl-heading.stories.d.ts +5 -0
  364. package/dist/types/components/swirl-icon/icons/swirl-icon-drag-handle.d.ts +5 -0
  365. package/dist/types/components/swirl-option-list/swirl-option-list.d.ts +21 -0
  366. package/dist/types/components/swirl-option-list-item/swirl-option-list-item.d.ts +8 -0
  367. package/dist/types/components/swirl-option-list-item/swirl-option-list-item.stories.d.ts +8 -0
  368. package/dist/types/components/swirl-select/swirl-select.d.ts +2 -1
  369. package/dist/types/components/swirl-text/swirl-text.d.ts +6 -0
  370. package/dist/types/components/swirl-text/swirl-text.stories.d.ts +5 -0
  371. package/dist/types/components/swirl-text-input/swirl-text-input.d.ts +1 -0
  372. package/dist/types/components.d.ts +62 -9
  373. package/dist/types/index.d.ts +2 -0
  374. package/dist/types/utils.d.ts +1 -0
  375. package/dist/typings.d.ts +1 -0
  376. package/package.json +23 -14
  377. package/vscode-data.json +85 -0
  378. package/dist/cjs/swirl-icon-check-small_3.cjs.entry.js +0 -261
  379. package/dist/components/_commonjsHelpers.js +0 -36
  380. package/dist/esm/swirl-icon-check-small_3.entry.js +0 -255
  381. package/dist/swirl-components/p-0dcba8b2.entry.js +0 -1
  382. package/dist/swirl-components/p-36573727.entry.js +0 -1
  383. package/dist/swirl-components/p-51097641.entry.js +0 -1
  384. package/dist/swirl-components/p-6272f11a.entry.js +0 -1
  385. package/dist/swirl-components/p-76e4350f.entry.js +0 -1
  386. package/dist/swirl-components/p-9a74850d.entry.js +0 -1
  387. package/dist/swirl-components/p-cbd8f173.entry.js +0 -1
  388. package/dist/swirl-components/p-d09dc70d.entry.js +0 -7
  389. package/dist/swirl-components/p-d3d722dc.js +0 -7
  390. package/dist/swirl-components/p-d97d183f.js +0 -1
  391. package/dist/swirl-components/p-e0aca739.entry.js +0 -1
  392. package/dist/swirl-components/p-ea5e12d7.entry.js +0 -1
@@ -0,0 +1,3440 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index$1 = require('./index-72831c5f.js');
6
+ const index$2 = require('./index-e038b0f7.js');
7
+ const utils = require('./utils-a07ee0db.js');
8
+ require('./_commonjsHelpers-a5111d61.js');
9
+
10
+ const swirlIconCss$1 = ":host{display:inline-flex}";
11
+
12
+ const SwirlIconCheckSmall = class {
13
+ constructor(hostRef) {
14
+ index$1.registerInstance(this, hostRef);
15
+ this.size = 24;
16
+ }
17
+ render() {
18
+ const viewBoxSize = this.size === 20 ? 24 : this.size;
19
+ const className = index$2.classnames("swirl-icon", `swirl-icon--size-${this.size}`);
20
+ return (index$1.h("svg", { class: className, fill: "none", height: this.size, part: "icon", viewBox: `0 0 ${viewBoxSize} ${viewBoxSize}`, width: this.size, xmlns: "http://www.w3.org/2000/svg" }, this.size === 16 && (index$1.h(index$1.Fragment, null, index$1.h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M12.4142 4.91924C12.8047 5.30976 12.8047 5.94293 12.4142 6.33345L7.08086 11.6667C6.69033 12.0572 6.05717 12.0572 5.66664 11.6667L3.70711 9.70707C3.31658 9.31655 3.31658 8.68338 3.70711 8.29286C4.09763 7.90233 4.7308 7.90233 5.12132 8.29286L6.37375 9.54539L11 4.91924C11.3905 4.52871 12.0237 4.52871 12.4142 4.91924Z", fill: "currentColor" }))), (this.size === 20 || this.size === 24) && (index$1.h(index$1.Fragment, null, index$1.h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M18.6213 7.37879C19.2071 7.96458 19.2071 8.91433 18.6213 9.50011L10.6213 17.5C10.0355 18.0858 9.08577 18.0858 8.49998 17.5L5.56068 14.5605C4.97489 13.9748 4.97489 13.025 5.56068 12.4392C6.14646 11.8534 7.09621 11.8534 7.682 12.4392L9.56064 14.318L16.5 7.37879C17.0858 6.79301 18.0355 6.79301 18.6213 7.37879Z", fill: "currentColor" }))), this.size === 28 && (index$1.h(index$1.Fragment, null, index$1.h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M21.7248 8.60863C22.4083 9.29205 22.4083 10.4001 21.7248 11.0835L12.3915 20.4167C11.7081 21.1001 10.6001 21.1001 9.91663 20.4167L6.48744 16.9873C5.80403 16.3039 5.80403 15.1959 6.48744 14.5125C7.17086 13.8291 8.2789 13.8291 8.96232 14.5125L11.1541 16.7044L19.25 8.60863C19.9334 7.92521 21.0414 7.92521 21.7248 8.60863Z", fill: "currentColor" })))));
21
+ }
22
+ };
23
+ SwirlIconCheckSmall.style = swirlIconCss$1;
24
+
25
+ const swirlIconCss = ":host{display:inline-flex}";
26
+
27
+ const SwirlIconDragHandle = class {
28
+ constructor(hostRef) {
29
+ index$1.registerInstance(this, hostRef);
30
+ this.size = 24;
31
+ }
32
+ render() {
33
+ const viewBoxSize = this.size === 20 ? 24 : this.size;
34
+ const className = index$2.classnames("swirl-icon", `swirl-icon--size-${this.size}`);
35
+ return (index$1.h("svg", { class: className, fill: "none", height: this.size, part: "icon", viewBox: `0 0 ${viewBoxSize} ${viewBoxSize}`, width: this.size, xmlns: "http://www.w3.org/2000/svg" }, this.size === 16 && (index$1.h(index$1.Fragment, null, index$1.h("rect", { x: "9", y: "3", width: "2", height: "2", rx: "1", fill: "currentColor" }), index$1.h("rect", { x: "9", y: "7", width: "2", height: "2", rx: "1", fill: "currentColor" }), index$1.h("rect", { x: "9", y: "11", width: "2", height: "2", rx: "1", fill: "currentColor" }), index$1.h("rect", { x: "5", y: "3", width: "2", height: "2", rx: "1", fill: "currentColor" }), index$1.h("rect", { x: "5", y: "7", width: "2", height: "2", rx: "1", fill: "currentColor" }), index$1.h("rect", { x: "5", y: "11", width: "2", height: "2", rx: "1", fill: "currentColor" }))), (this.size === 20 || this.size === 24) && (index$1.h(index$1.Fragment, null, index$1.h("rect", { x: "13.5", y: "4.5", width: "3", height: "3", rx: "1.5", fill: "currentColor" }), index$1.h("rect", { x: "13.5", y: "10.5", width: "3", height: "3", rx: "1.5", fill: "currentColor" }), index$1.h("rect", { x: "13.5", y: "16.5", width: "3", height: "3", rx: "1.5", fill: "currentColor" }), index$1.h("rect", { x: "7.5", y: "4.5", width: "3", height: "3", rx: "1.5", fill: "currentColor" }), index$1.h("rect", { x: "7.5", y: "10.5", width: "3", height: "3", rx: "1.5", fill: "currentColor" }), index$1.h("rect", { x: "7.5", y: "16.5", width: "3", height: "3", rx: "1.5", fill: "currentColor" }))), this.size === 28 && (index$1.h(index$1.Fragment, null, index$1.h("rect", { x: "15.75", y: "5.25", width: "3.5", height: "3.5", rx: "1.75", fill: "currentColor" }), index$1.h("rect", { x: "15.75", y: "12.25", width: "3.5", height: "3.5", rx: "1.75", fill: "currentColor" }), index$1.h("rect", { x: "15.75", y: "19.25", width: "3.5", height: "3.5", rx: "1.75", fill: "currentColor" }), index$1.h("rect", { x: "8.75", y: "5.25", width: "3.5", height: "3.5", rx: "1.75", fill: "currentColor" }), index$1.h("rect", { x: "8.75", y: "12.25", width: "3.5", height: "3.5", rx: "1.75", fill: "currentColor" }), index$1.h("rect", { x: "8.75", y: "19.25", width: "3.5", height: "3.5", rx: "1.75", fill: "currentColor" })))));
36
+ }
37
+ };
38
+ SwirlIconDragHandle.style = swirlIconCss;
39
+
40
+ /**!
41
+ * Sortable 1.15.0
42
+ * @author RubaXa <trash@rubaxa.org>
43
+ * @author owenm <owen23355@gmail.com>
44
+ * @license MIT
45
+ */
46
+ function ownKeys(object, enumerableOnly) {
47
+ var keys = Object.keys(object);
48
+
49
+ if (Object.getOwnPropertySymbols) {
50
+ var symbols = Object.getOwnPropertySymbols(object);
51
+
52
+ if (enumerableOnly) {
53
+ symbols = symbols.filter(function (sym) {
54
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
55
+ });
56
+ }
57
+
58
+ keys.push.apply(keys, symbols);
59
+ }
60
+
61
+ return keys;
62
+ }
63
+
64
+ function _objectSpread2(target) {
65
+ for (var i = 1; i < arguments.length; i++) {
66
+ var source = arguments[i] != null ? arguments[i] : {};
67
+
68
+ if (i % 2) {
69
+ ownKeys(Object(source), true).forEach(function (key) {
70
+ _defineProperty(target, key, source[key]);
71
+ });
72
+ } else if (Object.getOwnPropertyDescriptors) {
73
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
74
+ } else {
75
+ ownKeys(Object(source)).forEach(function (key) {
76
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
77
+ });
78
+ }
79
+ }
80
+
81
+ return target;
82
+ }
83
+
84
+ function _typeof(obj) {
85
+ "@babel/helpers - typeof";
86
+
87
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
88
+ _typeof = function (obj) {
89
+ return typeof obj;
90
+ };
91
+ } else {
92
+ _typeof = function (obj) {
93
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
94
+ };
95
+ }
96
+
97
+ return _typeof(obj);
98
+ }
99
+
100
+ function _defineProperty(obj, key, value) {
101
+ if (key in obj) {
102
+ Object.defineProperty(obj, key, {
103
+ value: value,
104
+ enumerable: true,
105
+ configurable: true,
106
+ writable: true
107
+ });
108
+ } else {
109
+ obj[key] = value;
110
+ }
111
+
112
+ return obj;
113
+ }
114
+
115
+ function _extends() {
116
+ _extends = Object.assign || function (target) {
117
+ for (var i = 1; i < arguments.length; i++) {
118
+ var source = arguments[i];
119
+
120
+ for (var key in source) {
121
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
122
+ target[key] = source[key];
123
+ }
124
+ }
125
+ }
126
+
127
+ return target;
128
+ };
129
+
130
+ return _extends.apply(this, arguments);
131
+ }
132
+
133
+ function _objectWithoutPropertiesLoose(source, excluded) {
134
+ if (source == null) return {};
135
+ var target = {};
136
+ var sourceKeys = Object.keys(source);
137
+ var key, i;
138
+
139
+ for (i = 0; i < sourceKeys.length; i++) {
140
+ key = sourceKeys[i];
141
+ if (excluded.indexOf(key) >= 0) continue;
142
+ target[key] = source[key];
143
+ }
144
+
145
+ return target;
146
+ }
147
+
148
+ function _objectWithoutProperties(source, excluded) {
149
+ if (source == null) return {};
150
+
151
+ var target = _objectWithoutPropertiesLoose(source, excluded);
152
+
153
+ var key, i;
154
+
155
+ if (Object.getOwnPropertySymbols) {
156
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
157
+
158
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
159
+ key = sourceSymbolKeys[i];
160
+ if (excluded.indexOf(key) >= 0) continue;
161
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
162
+ target[key] = source[key];
163
+ }
164
+ }
165
+
166
+ return target;
167
+ }
168
+
169
+ var version = "1.15.0";
170
+
171
+ function userAgent(pattern) {
172
+ if (typeof window !== 'undefined' && window.navigator) {
173
+ return !! /*@__PURE__*/navigator.userAgent.match(pattern);
174
+ }
175
+ }
176
+
177
+ var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);
178
+ var Edge = userAgent(/Edge/i);
179
+ var FireFox = userAgent(/firefox/i);
180
+ var Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i);
181
+ var IOS = userAgent(/iP(ad|od|hone)/i);
182
+ var ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i);
183
+
184
+ var captureMode = {
185
+ capture: false,
186
+ passive: false
187
+ };
188
+
189
+ function on(el, event, fn) {
190
+ el.addEventListener(event, fn, !IE11OrLess && captureMode);
191
+ }
192
+
193
+ function off(el, event, fn) {
194
+ el.removeEventListener(event, fn, !IE11OrLess && captureMode);
195
+ }
196
+
197
+ function matches(
198
+ /**HTMLElement*/
199
+ el,
200
+ /**String*/
201
+ selector) {
202
+ if (!selector) return;
203
+ selector[0] === '>' && (selector = selector.substring(1));
204
+
205
+ if (el) {
206
+ try {
207
+ if (el.matches) {
208
+ return el.matches(selector);
209
+ } else if (el.msMatchesSelector) {
210
+ return el.msMatchesSelector(selector);
211
+ } else if (el.webkitMatchesSelector) {
212
+ return el.webkitMatchesSelector(selector);
213
+ }
214
+ } catch (_) {
215
+ return false;
216
+ }
217
+ }
218
+
219
+ return false;
220
+ }
221
+
222
+ function getParentOrHost(el) {
223
+ return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;
224
+ }
225
+
226
+ function closest(
227
+ /**HTMLElement*/
228
+ el,
229
+ /**String*/
230
+ selector,
231
+ /**HTMLElement*/
232
+ ctx, includeCTX) {
233
+ if (el) {
234
+ ctx = ctx || document;
235
+
236
+ do {
237
+ if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {
238
+ return el;
239
+ }
240
+
241
+ if (el === ctx) break;
242
+ /* jshint boss:true */
243
+ } while (el = getParentOrHost(el));
244
+ }
245
+
246
+ return null;
247
+ }
248
+
249
+ var R_SPACE = /\s+/g;
250
+
251
+ function toggleClass(el, name, state) {
252
+ if (el && name) {
253
+ if (el.classList) {
254
+ el.classList[state ? 'add' : 'remove'](name);
255
+ } else {
256
+ var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
257
+ el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
258
+ }
259
+ }
260
+ }
261
+
262
+ function css(el, prop, val) {
263
+ var style = el && el.style;
264
+
265
+ if (style) {
266
+ if (val === void 0) {
267
+ if (document.defaultView && document.defaultView.getComputedStyle) {
268
+ val = document.defaultView.getComputedStyle(el, '');
269
+ } else if (el.currentStyle) {
270
+ val = el.currentStyle;
271
+ }
272
+
273
+ return prop === void 0 ? val : val[prop];
274
+ } else {
275
+ if (!(prop in style) && prop.indexOf('webkit') === -1) {
276
+ prop = '-webkit-' + prop;
277
+ }
278
+
279
+ style[prop] = val + (typeof val === 'string' ? '' : 'px');
280
+ }
281
+ }
282
+ }
283
+
284
+ function matrix(el, selfOnly) {
285
+ var appliedTransforms = '';
286
+
287
+ if (typeof el === 'string') {
288
+ appliedTransforms = el;
289
+ } else {
290
+ do {
291
+ var transform = css(el, 'transform');
292
+
293
+ if (transform && transform !== 'none') {
294
+ appliedTransforms = transform + ' ' + appliedTransforms;
295
+ }
296
+ /* jshint boss:true */
297
+
298
+ } while (!selfOnly && (el = el.parentNode));
299
+ }
300
+
301
+ var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
302
+ /*jshint -W056 */
303
+
304
+ return matrixFn && new matrixFn(appliedTransforms);
305
+ }
306
+
307
+ function find(ctx, tagName, iterator) {
308
+ if (ctx) {
309
+ var list = ctx.getElementsByTagName(tagName),
310
+ i = 0,
311
+ n = list.length;
312
+
313
+ if (iterator) {
314
+ for (; i < n; i++) {
315
+ iterator(list[i], i);
316
+ }
317
+ }
318
+
319
+ return list;
320
+ }
321
+
322
+ return [];
323
+ }
324
+
325
+ function getWindowScrollingElement() {
326
+ var scrollingElement = document.scrollingElement;
327
+
328
+ if (scrollingElement) {
329
+ return scrollingElement;
330
+ } else {
331
+ return document.documentElement;
332
+ }
333
+ }
334
+ /**
335
+ * Returns the "bounding client rect" of given element
336
+ * @param {HTMLElement} el The element whose boundingClientRect is wanted
337
+ * @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container
338
+ * @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr
339
+ * @param {[Boolean]} undoScale Whether the container's scale() should be undone
340
+ * @param {[HTMLElement]} container The parent the element will be placed in
341
+ * @return {Object} The boundingClientRect of el, with specified adjustments
342
+ */
343
+
344
+
345
+ function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {
346
+ if (!el.getBoundingClientRect && el !== window) return;
347
+ var elRect, top, left, bottom, right, height, width;
348
+
349
+ if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {
350
+ elRect = el.getBoundingClientRect();
351
+ top = elRect.top;
352
+ left = elRect.left;
353
+ bottom = elRect.bottom;
354
+ right = elRect.right;
355
+ height = elRect.height;
356
+ width = elRect.width;
357
+ } else {
358
+ top = 0;
359
+ left = 0;
360
+ bottom = window.innerHeight;
361
+ right = window.innerWidth;
362
+ height = window.innerHeight;
363
+ width = window.innerWidth;
364
+ }
365
+
366
+ if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {
367
+ // Adjust for translate()
368
+ container = container || el.parentNode; // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312)
369
+ // Not needed on <= IE11
370
+
371
+ if (!IE11OrLess) {
372
+ do {
373
+ if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) {
374
+ var containerRect = container.getBoundingClientRect(); // Set relative to edges of padding box of container
375
+
376
+ top -= containerRect.top + parseInt(css(container, 'border-top-width'));
377
+ left -= containerRect.left + parseInt(css(container, 'border-left-width'));
378
+ bottom = top + elRect.height;
379
+ right = left + elRect.width;
380
+ break;
381
+ }
382
+ /* jshint boss:true */
383
+
384
+ } while (container = container.parentNode);
385
+ }
386
+ }
387
+
388
+ if (undoScale && el !== window) {
389
+ // Adjust for scale()
390
+ var elMatrix = matrix(container || el),
391
+ scaleX = elMatrix && elMatrix.a,
392
+ scaleY = elMatrix && elMatrix.d;
393
+
394
+ if (elMatrix) {
395
+ top /= scaleY;
396
+ left /= scaleX;
397
+ width /= scaleX;
398
+ height /= scaleY;
399
+ bottom = top + height;
400
+ right = left + width;
401
+ }
402
+ }
403
+
404
+ return {
405
+ top: top,
406
+ left: left,
407
+ bottom: bottom,
408
+ right: right,
409
+ width: width,
410
+ height: height
411
+ };
412
+ }
413
+ /**
414
+ * Checks if a side of an element is scrolled past a side of its parents
415
+ * @param {HTMLElement} el The element who's side being scrolled out of view is in question
416
+ * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')
417
+ * @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')
418
+ * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element
419
+ */
420
+
421
+
422
+ function isScrolledPast(el, elSide, parentSide) {
423
+ var parent = getParentAutoScrollElement(el, true),
424
+ elSideVal = getRect(el)[elSide];
425
+ /* jshint boss:true */
426
+
427
+ while (parent) {
428
+ var parentSideVal = getRect(parent)[parentSide],
429
+ visible = void 0;
430
+
431
+ if (parentSide === 'top' || parentSide === 'left') {
432
+ visible = elSideVal >= parentSideVal;
433
+ } else {
434
+ visible = elSideVal <= parentSideVal;
435
+ }
436
+
437
+ if (!visible) return parent;
438
+ if (parent === getWindowScrollingElement()) break;
439
+ parent = getParentAutoScrollElement(parent, false);
440
+ }
441
+
442
+ return false;
443
+ }
444
+ /**
445
+ * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)
446
+ * and non-draggable elements
447
+ * @param {HTMLElement} el The parent element
448
+ * @param {Number} childNum The index of the child
449
+ * @param {Object} options Parent Sortable's options
450
+ * @return {HTMLElement} The child at index childNum, or null if not found
451
+ */
452
+
453
+
454
+ function getChild(el, childNum, options, includeDragEl) {
455
+ var currentChild = 0,
456
+ i = 0,
457
+ children = el.children;
458
+
459
+ while (i < children.length) {
460
+ if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) {
461
+ if (currentChild === childNum) {
462
+ return children[i];
463
+ }
464
+
465
+ currentChild++;
466
+ }
467
+
468
+ i++;
469
+ }
470
+
471
+ return null;
472
+ }
473
+ /**
474
+ * Gets the last child in the el, ignoring ghostEl or invisible elements (clones)
475
+ * @param {HTMLElement} el Parent element
476
+ * @param {selector} selector Any other elements that should be ignored
477
+ * @return {HTMLElement} The last child, ignoring ghostEl
478
+ */
479
+
480
+
481
+ function lastChild(el, selector) {
482
+ var last = el.lastElementChild;
483
+
484
+ while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) {
485
+ last = last.previousElementSibling;
486
+ }
487
+
488
+ return last || null;
489
+ }
490
+ /**
491
+ * Returns the index of an element within its parent for a selected set of
492
+ * elements
493
+ * @param {HTMLElement} el
494
+ * @param {selector} selector
495
+ * @return {number}
496
+ */
497
+
498
+
499
+ function index(el, selector) {
500
+ var index = 0;
501
+
502
+ if (!el || !el.parentNode) {
503
+ return -1;
504
+ }
505
+ /* jshint boss:true */
506
+
507
+
508
+ while (el = el.previousElementSibling) {
509
+ if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) {
510
+ index++;
511
+ }
512
+ }
513
+
514
+ return index;
515
+ }
516
+ /**
517
+ * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.
518
+ * The value is returned in real pixels.
519
+ * @param {HTMLElement} el
520
+ * @return {Array} Offsets in the format of [left, top]
521
+ */
522
+
523
+
524
+ function getRelativeScrollOffset(el) {
525
+ var offsetLeft = 0,
526
+ offsetTop = 0,
527
+ winScroller = getWindowScrollingElement();
528
+
529
+ if (el) {
530
+ do {
531
+ var elMatrix = matrix(el),
532
+ scaleX = elMatrix.a,
533
+ scaleY = elMatrix.d;
534
+ offsetLeft += el.scrollLeft * scaleX;
535
+ offsetTop += el.scrollTop * scaleY;
536
+ } while (el !== winScroller && (el = el.parentNode));
537
+ }
538
+
539
+ return [offsetLeft, offsetTop];
540
+ }
541
+ /**
542
+ * Returns the index of the object within the given array
543
+ * @param {Array} arr Array that may or may not hold the object
544
+ * @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find
545
+ * @return {Number} The index of the object in the array, or -1
546
+ */
547
+
548
+
549
+ function indexOfObject(arr, obj) {
550
+ for (var i in arr) {
551
+ if (!arr.hasOwnProperty(i)) continue;
552
+
553
+ for (var key in obj) {
554
+ if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);
555
+ }
556
+ }
557
+
558
+ return -1;
559
+ }
560
+
561
+ function getParentAutoScrollElement(el, includeSelf) {
562
+ // skip to window
563
+ if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();
564
+ var elem = el;
565
+ var gotSelf = false;
566
+
567
+ do {
568
+ // we don't need to get elem css if it isn't even overflowing in the first place (performance)
569
+ if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {
570
+ var elemCSS = css(elem);
571
+
572
+ if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) {
573
+ if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();
574
+ if (gotSelf || includeSelf) return elem;
575
+ gotSelf = true;
576
+ }
577
+ }
578
+ /* jshint boss:true */
579
+
580
+ } while (elem = elem.parentNode);
581
+
582
+ return getWindowScrollingElement();
583
+ }
584
+
585
+ function extend(dst, src) {
586
+ if (dst && src) {
587
+ for (var key in src) {
588
+ if (src.hasOwnProperty(key)) {
589
+ dst[key] = src[key];
590
+ }
591
+ }
592
+ }
593
+
594
+ return dst;
595
+ }
596
+
597
+ function isRectEqual(rect1, rect2) {
598
+ return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width);
599
+ }
600
+
601
+ var _throttleTimeout;
602
+
603
+ function throttle(callback, ms) {
604
+ return function () {
605
+ if (!_throttleTimeout) {
606
+ var args = arguments,
607
+ _this = this;
608
+
609
+ if (args.length === 1) {
610
+ callback.call(_this, args[0]);
611
+ } else {
612
+ callback.apply(_this, args);
613
+ }
614
+
615
+ _throttleTimeout = setTimeout(function () {
616
+ _throttleTimeout = void 0;
617
+ }, ms);
618
+ }
619
+ };
620
+ }
621
+
622
+ function cancelThrottle() {
623
+ clearTimeout(_throttleTimeout);
624
+ _throttleTimeout = void 0;
625
+ }
626
+
627
+ function scrollBy(el, x, y) {
628
+ el.scrollLeft += x;
629
+ el.scrollTop += y;
630
+ }
631
+
632
+ function clone(el) {
633
+ var Polymer = window.Polymer;
634
+ var $ = window.jQuery || window.Zepto;
635
+
636
+ if (Polymer && Polymer.dom) {
637
+ return Polymer.dom(el).cloneNode(true);
638
+ } else if ($) {
639
+ return $(el).clone(true)[0];
640
+ } else {
641
+ return el.cloneNode(true);
642
+ }
643
+ }
644
+
645
+ var expando = 'Sortable' + new Date().getTime();
646
+
647
+ function AnimationStateManager() {
648
+ var animationStates = [],
649
+ animationCallbackId;
650
+ return {
651
+ captureAnimationState: function captureAnimationState() {
652
+ animationStates = [];
653
+ if (!this.options.animation) return;
654
+ var children = [].slice.call(this.el.children);
655
+ children.forEach(function (child) {
656
+ if (css(child, 'display') === 'none' || child === Sortable.ghost) return;
657
+ animationStates.push({
658
+ target: child,
659
+ rect: getRect(child)
660
+ });
661
+
662
+ var fromRect = _objectSpread2({}, animationStates[animationStates.length - 1].rect); // If animating: compensate for current animation
663
+
664
+
665
+ if (child.thisAnimationDuration) {
666
+ var childMatrix = matrix(child, true);
667
+
668
+ if (childMatrix) {
669
+ fromRect.top -= childMatrix.f;
670
+ fromRect.left -= childMatrix.e;
671
+ }
672
+ }
673
+
674
+ child.fromRect = fromRect;
675
+ });
676
+ },
677
+ addAnimationState: function addAnimationState(state) {
678
+ animationStates.push(state);
679
+ },
680
+ removeAnimationState: function removeAnimationState(target) {
681
+ animationStates.splice(indexOfObject(animationStates, {
682
+ target: target
683
+ }), 1);
684
+ },
685
+ animateAll: function animateAll(callback) {
686
+ var _this = this;
687
+
688
+ if (!this.options.animation) {
689
+ clearTimeout(animationCallbackId);
690
+ if (typeof callback === 'function') callback();
691
+ return;
692
+ }
693
+
694
+ var animating = false,
695
+ animationTime = 0;
696
+ animationStates.forEach(function (state) {
697
+ var time = 0,
698
+ target = state.target,
699
+ fromRect = target.fromRect,
700
+ toRect = getRect(target),
701
+ prevFromRect = target.prevFromRect,
702
+ prevToRect = target.prevToRect,
703
+ animatingRect = state.rect,
704
+ targetMatrix = matrix(target, true);
705
+
706
+ if (targetMatrix) {
707
+ // Compensate for current animation
708
+ toRect.top -= targetMatrix.f;
709
+ toRect.left -= targetMatrix.e;
710
+ }
711
+
712
+ target.toRect = toRect;
713
+
714
+ if (target.thisAnimationDuration) {
715
+ // Could also check if animatingRect is between fromRect and toRect
716
+ if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) && // Make sure animatingRect is on line between toRect & fromRect
717
+ (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {
718
+ // If returning to same place as started from animation and on same axis
719
+ time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);
720
+ }
721
+ } // if fromRect != toRect: animate
722
+
723
+
724
+ if (!isRectEqual(toRect, fromRect)) {
725
+ target.prevFromRect = fromRect;
726
+ target.prevToRect = toRect;
727
+
728
+ if (!time) {
729
+ time = _this.options.animation;
730
+ }
731
+
732
+ _this.animate(target, animatingRect, toRect, time);
733
+ }
734
+
735
+ if (time) {
736
+ animating = true;
737
+ animationTime = Math.max(animationTime, time);
738
+ clearTimeout(target.animationResetTimer);
739
+ target.animationResetTimer = setTimeout(function () {
740
+ target.animationTime = 0;
741
+ target.prevFromRect = null;
742
+ target.fromRect = null;
743
+ target.prevToRect = null;
744
+ target.thisAnimationDuration = null;
745
+ }, time);
746
+ target.thisAnimationDuration = time;
747
+ }
748
+ });
749
+ clearTimeout(animationCallbackId);
750
+
751
+ if (!animating) {
752
+ if (typeof callback === 'function') callback();
753
+ } else {
754
+ animationCallbackId = setTimeout(function () {
755
+ if (typeof callback === 'function') callback();
756
+ }, animationTime);
757
+ }
758
+
759
+ animationStates = [];
760
+ },
761
+ animate: function animate(target, currentRect, toRect, duration) {
762
+ if (duration) {
763
+ css(target, 'transition', '');
764
+ css(target, 'transform', '');
765
+ var elMatrix = matrix(this.el),
766
+ scaleX = elMatrix && elMatrix.a,
767
+ scaleY = elMatrix && elMatrix.d,
768
+ translateX = (currentRect.left - toRect.left) / (scaleX || 1),
769
+ translateY = (currentRect.top - toRect.top) / (scaleY || 1);
770
+ target.animatingX = !!translateX;
771
+ target.animatingY = !!translateY;
772
+ css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');
773
+ this.forRepaintDummy = repaint(target); // repaint
774
+
775
+ css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));
776
+ css(target, 'transform', 'translate3d(0,0,0)');
777
+ typeof target.animated === 'number' && clearTimeout(target.animated);
778
+ target.animated = setTimeout(function () {
779
+ css(target, 'transition', '');
780
+ css(target, 'transform', '');
781
+ target.animated = false;
782
+ target.animatingX = false;
783
+ target.animatingY = false;
784
+ }, duration);
785
+ }
786
+ }
787
+ };
788
+ }
789
+
790
+ function repaint(target) {
791
+ return target.offsetWidth;
792
+ }
793
+
794
+ function calculateRealTime(animatingRect, fromRect, toRect, options) {
795
+ return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation;
796
+ }
797
+
798
+ var plugins = [];
799
+ var defaults = {
800
+ initializeByDefault: true
801
+ };
802
+ var PluginManager = {
803
+ mount: function mount(plugin) {
804
+ // Set default static properties
805
+ for (var option in defaults) {
806
+ if (defaults.hasOwnProperty(option) && !(option in plugin)) {
807
+ plugin[option] = defaults[option];
808
+ }
809
+ }
810
+
811
+ plugins.forEach(function (p) {
812
+ if (p.pluginName === plugin.pluginName) {
813
+ throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once");
814
+ }
815
+ });
816
+ plugins.push(plugin);
817
+ },
818
+ pluginEvent: function pluginEvent(eventName, sortable, evt) {
819
+ var _this = this;
820
+
821
+ this.eventCanceled = false;
822
+
823
+ evt.cancel = function () {
824
+ _this.eventCanceled = true;
825
+ };
826
+
827
+ var eventNameGlobal = eventName + 'Global';
828
+ plugins.forEach(function (plugin) {
829
+ if (!sortable[plugin.pluginName]) return; // Fire global events if it exists in this sortable
830
+
831
+ if (sortable[plugin.pluginName][eventNameGlobal]) {
832
+ sortable[plugin.pluginName][eventNameGlobal](_objectSpread2({
833
+ sortable: sortable
834
+ }, evt));
835
+ } // Only fire plugin event if plugin is enabled in this sortable,
836
+ // and plugin has event defined
837
+
838
+
839
+ if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {
840
+ sortable[plugin.pluginName][eventName](_objectSpread2({
841
+ sortable: sortable
842
+ }, evt));
843
+ }
844
+ });
845
+ },
846
+ initializePlugins: function initializePlugins(sortable, el, defaults, options) {
847
+ plugins.forEach(function (plugin) {
848
+ var pluginName = plugin.pluginName;
849
+ if (!sortable.options[pluginName] && !plugin.initializeByDefault) return;
850
+ var initialized = new plugin(sortable, el, sortable.options);
851
+ initialized.sortable = sortable;
852
+ initialized.options = sortable.options;
853
+ sortable[pluginName] = initialized; // Add default options from plugin
854
+
855
+ _extends(defaults, initialized.defaults);
856
+ });
857
+
858
+ for (var option in sortable.options) {
859
+ if (!sortable.options.hasOwnProperty(option)) continue;
860
+ var modified = this.modifyOption(sortable, option, sortable.options[option]);
861
+
862
+ if (typeof modified !== 'undefined') {
863
+ sortable.options[option] = modified;
864
+ }
865
+ }
866
+ },
867
+ getEventProperties: function getEventProperties(name, sortable) {
868
+ var eventProperties = {};
869
+ plugins.forEach(function (plugin) {
870
+ if (typeof plugin.eventProperties !== 'function') return;
871
+
872
+ _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));
873
+ });
874
+ return eventProperties;
875
+ },
876
+ modifyOption: function modifyOption(sortable, name, value) {
877
+ var modifiedValue;
878
+ plugins.forEach(function (plugin) {
879
+ // Plugin must exist on the Sortable
880
+ if (!sortable[plugin.pluginName]) return; // If static option listener exists for this option, call in the context of the Sortable's instance of this plugin
881
+
882
+ if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') {
883
+ modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);
884
+ }
885
+ });
886
+ return modifiedValue;
887
+ }
888
+ };
889
+
890
+ function dispatchEvent(_ref) {
891
+ var sortable = _ref.sortable,
892
+ rootEl = _ref.rootEl,
893
+ name = _ref.name,
894
+ targetEl = _ref.targetEl,
895
+ cloneEl = _ref.cloneEl,
896
+ toEl = _ref.toEl,
897
+ fromEl = _ref.fromEl,
898
+ oldIndex = _ref.oldIndex,
899
+ newIndex = _ref.newIndex,
900
+ oldDraggableIndex = _ref.oldDraggableIndex,
901
+ newDraggableIndex = _ref.newDraggableIndex,
902
+ originalEvent = _ref.originalEvent,
903
+ putSortable = _ref.putSortable,
904
+ extraEventProperties = _ref.extraEventProperties;
905
+ sortable = sortable || rootEl && rootEl[expando];
906
+ if (!sortable) return;
907
+ var evt,
908
+ options = sortable.options,
909
+ onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1); // Support for new CustomEvent feature
910
+
911
+ if (window.CustomEvent && !IE11OrLess && !Edge) {
912
+ evt = new CustomEvent(name, {
913
+ bubbles: true,
914
+ cancelable: true
915
+ });
916
+ } else {
917
+ evt = document.createEvent('Event');
918
+ evt.initEvent(name, true, true);
919
+ }
920
+
921
+ evt.to = toEl || rootEl;
922
+ evt.from = fromEl || rootEl;
923
+ evt.item = targetEl || rootEl;
924
+ evt.clone = cloneEl;
925
+ evt.oldIndex = oldIndex;
926
+ evt.newIndex = newIndex;
927
+ evt.oldDraggableIndex = oldDraggableIndex;
928
+ evt.newDraggableIndex = newDraggableIndex;
929
+ evt.originalEvent = originalEvent;
930
+ evt.pullMode = putSortable ? putSortable.lastPutMode : undefined;
931
+
932
+ var allEventProperties = _objectSpread2(_objectSpread2({}, extraEventProperties), PluginManager.getEventProperties(name, sortable));
933
+
934
+ for (var option in allEventProperties) {
935
+ evt[option] = allEventProperties[option];
936
+ }
937
+
938
+ if (rootEl) {
939
+ rootEl.dispatchEvent(evt);
940
+ }
941
+
942
+ if (options[onName]) {
943
+ options[onName].call(sortable, evt);
944
+ }
945
+ }
946
+
947
+ var _excluded = ["evt"];
948
+
949
+ var pluginEvent = function pluginEvent(eventName, sortable) {
950
+ var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
951
+ originalEvent = _ref.evt,
952
+ data = _objectWithoutProperties(_ref, _excluded);
953
+
954
+ PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2({
955
+ dragEl: dragEl,
956
+ parentEl: parentEl,
957
+ ghostEl: ghostEl,
958
+ rootEl: rootEl,
959
+ nextEl: nextEl,
960
+ lastDownEl: lastDownEl,
961
+ cloneEl: cloneEl,
962
+ cloneHidden: cloneHidden,
963
+ dragStarted: moved,
964
+ putSortable: putSortable,
965
+ activeSortable: Sortable.active,
966
+ originalEvent: originalEvent,
967
+ oldIndex: oldIndex,
968
+ oldDraggableIndex: oldDraggableIndex,
969
+ newIndex: newIndex,
970
+ newDraggableIndex: newDraggableIndex,
971
+ hideGhostForTarget: _hideGhostForTarget,
972
+ unhideGhostForTarget: _unhideGhostForTarget,
973
+ cloneNowHidden: function cloneNowHidden() {
974
+ cloneHidden = true;
975
+ },
976
+ cloneNowShown: function cloneNowShown() {
977
+ cloneHidden = false;
978
+ },
979
+ dispatchSortableEvent: function dispatchSortableEvent(name) {
980
+ _dispatchEvent({
981
+ sortable: sortable,
982
+ name: name,
983
+ originalEvent: originalEvent
984
+ });
985
+ }
986
+ }, data));
987
+ };
988
+
989
+ function _dispatchEvent(info) {
990
+ dispatchEvent(_objectSpread2({
991
+ putSortable: putSortable,
992
+ cloneEl: cloneEl,
993
+ targetEl: dragEl,
994
+ rootEl: rootEl,
995
+ oldIndex: oldIndex,
996
+ oldDraggableIndex: oldDraggableIndex,
997
+ newIndex: newIndex,
998
+ newDraggableIndex: newDraggableIndex
999
+ }, info));
1000
+ }
1001
+
1002
+ var dragEl,
1003
+ parentEl,
1004
+ ghostEl,
1005
+ rootEl,
1006
+ nextEl,
1007
+ lastDownEl,
1008
+ cloneEl,
1009
+ cloneHidden,
1010
+ oldIndex,
1011
+ newIndex,
1012
+ oldDraggableIndex,
1013
+ newDraggableIndex,
1014
+ activeGroup,
1015
+ putSortable,
1016
+ awaitingDragStarted = false,
1017
+ ignoreNextClick = false,
1018
+ sortables = [],
1019
+ tapEvt,
1020
+ touchEvt,
1021
+ lastDx,
1022
+ lastDy,
1023
+ tapDistanceLeft,
1024
+ tapDistanceTop,
1025
+ moved,
1026
+ lastTarget,
1027
+ lastDirection,
1028
+ pastFirstInvertThresh = false,
1029
+ isCircumstantialInvert = false,
1030
+ targetMoveDistance,
1031
+ // For positioning ghost absolutely
1032
+ ghostRelativeParent,
1033
+ ghostRelativeParentInitialScroll = [],
1034
+ // (left, top)
1035
+ _silent = false,
1036
+ savedInputChecked = [];
1037
+ /** @const */
1038
+
1039
+ var documentExists = typeof document !== 'undefined',
1040
+ PositionGhostAbsolutely = IOS,
1041
+ CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',
1042
+ // This will not pass for IE9, because IE9 DnD only works on anchors
1043
+ supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),
1044
+ supportCssPointerEvents = function () {
1045
+ if (!documentExists) return; // false when <= IE11
1046
+
1047
+ if (IE11OrLess) {
1048
+ return false;
1049
+ }
1050
+
1051
+ var el = document.createElement('x');
1052
+ el.style.cssText = 'pointer-events:auto';
1053
+ return el.style.pointerEvents === 'auto';
1054
+ }(),
1055
+ _detectDirection = function _detectDirection(el, options) {
1056
+ var elCSS = css(el),
1057
+ elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth),
1058
+ child1 = getChild(el, 0, options),
1059
+ child2 = getChild(el, 1, options),
1060
+ firstChildCSS = child1 && css(child1),
1061
+ secondChildCSS = child2 && css(child2),
1062
+ firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width,
1063
+ secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;
1064
+
1065
+ if (elCSS.display === 'flex') {
1066
+ return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal';
1067
+ }
1068
+
1069
+ if (elCSS.display === 'grid') {
1070
+ return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal';
1071
+ }
1072
+
1073
+ if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== 'none') {
1074
+ var touchingSideChild2 = firstChildCSS["float"] === 'left' ? 'left' : 'right';
1075
+ return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal';
1076
+ }
1077
+
1078
+ return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal';
1079
+ },
1080
+ _dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {
1081
+ var dragElS1Opp = vertical ? dragRect.left : dragRect.top,
1082
+ dragElS2Opp = vertical ? dragRect.right : dragRect.bottom,
1083
+ dragElOppLength = vertical ? dragRect.width : dragRect.height,
1084
+ targetS1Opp = vertical ? targetRect.left : targetRect.top,
1085
+ targetS2Opp = vertical ? targetRect.right : targetRect.bottom,
1086
+ targetOppLength = vertical ? targetRect.width : targetRect.height;
1087
+ return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;
1088
+ },
1089
+
1090
+ /**
1091
+ * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.
1092
+ * @param {Number} x X position
1093
+ * @param {Number} y Y position
1094
+ * @return {HTMLElement} Element of the first found nearest Sortable
1095
+ */
1096
+ _detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
1097
+ var ret;
1098
+ sortables.some(function (sortable) {
1099
+ var threshold = sortable[expando].options.emptyInsertThreshold;
1100
+ if (!threshold || lastChild(sortable)) return;
1101
+ var rect = getRect(sortable),
1102
+ insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold,
1103
+ insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;
1104
+
1105
+ if (insideHorizontally && insideVertically) {
1106
+ return ret = sortable;
1107
+ }
1108
+ });
1109
+ return ret;
1110
+ },
1111
+ _prepareGroup = function _prepareGroup(options) {
1112
+ function toFn(value, pull) {
1113
+ return function (to, from, dragEl, evt) {
1114
+ var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;
1115
+
1116
+ if (value == null && (pull || sameGroup)) {
1117
+ // Default pull value
1118
+ // Default pull and put value if same group
1119
+ return true;
1120
+ } else if (value == null || value === false) {
1121
+ return false;
1122
+ } else if (pull && value === 'clone') {
1123
+ return value;
1124
+ } else if (typeof value === 'function') {
1125
+ return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);
1126
+ } else {
1127
+ var otherGroup = (pull ? to : from).options.group.name;
1128
+ return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;
1129
+ }
1130
+ };
1131
+ }
1132
+
1133
+ var group = {};
1134
+ var originalGroup = options.group;
1135
+
1136
+ if (!originalGroup || _typeof(originalGroup) != 'object') {
1137
+ originalGroup = {
1138
+ name: originalGroup
1139
+ };
1140
+ }
1141
+
1142
+ group.name = originalGroup.name;
1143
+ group.checkPull = toFn(originalGroup.pull, true);
1144
+ group.checkPut = toFn(originalGroup.put);
1145
+ group.revertClone = originalGroup.revertClone;
1146
+ options.group = group;
1147
+ },
1148
+ _hideGhostForTarget = function _hideGhostForTarget() {
1149
+ if (!supportCssPointerEvents && ghostEl) {
1150
+ css(ghostEl, 'display', 'none');
1151
+ }
1152
+ },
1153
+ _unhideGhostForTarget = function _unhideGhostForTarget() {
1154
+ if (!supportCssPointerEvents && ghostEl) {
1155
+ css(ghostEl, 'display', '');
1156
+ }
1157
+ }; // #1184 fix - Prevent click event on fallback if dragged but item not changed position
1158
+
1159
+
1160
+ if (documentExists && !ChromeForAndroid) {
1161
+ document.addEventListener('click', function (evt) {
1162
+ if (ignoreNextClick) {
1163
+ evt.preventDefault();
1164
+ evt.stopPropagation && evt.stopPropagation();
1165
+ evt.stopImmediatePropagation && evt.stopImmediatePropagation();
1166
+ ignoreNextClick = false;
1167
+ return false;
1168
+ }
1169
+ }, true);
1170
+ }
1171
+
1172
+ var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {
1173
+ if (dragEl) {
1174
+ evt = evt.touches ? evt.touches[0] : evt;
1175
+
1176
+ var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);
1177
+
1178
+ if (nearest) {
1179
+ // Create imitation event
1180
+ var event = {};
1181
+
1182
+ for (var i in evt) {
1183
+ if (evt.hasOwnProperty(i)) {
1184
+ event[i] = evt[i];
1185
+ }
1186
+ }
1187
+
1188
+ event.target = event.rootEl = nearest;
1189
+ event.preventDefault = void 0;
1190
+ event.stopPropagation = void 0;
1191
+
1192
+ nearest[expando]._onDragOver(event);
1193
+ }
1194
+ }
1195
+ };
1196
+
1197
+ var _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {
1198
+ if (dragEl) {
1199
+ dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
1200
+ }
1201
+ };
1202
+ /**
1203
+ * @class Sortable
1204
+ * @param {HTMLElement} el
1205
+ * @param {Object} [options]
1206
+ */
1207
+
1208
+
1209
+ function Sortable(el, options) {
1210
+ if (!(el && el.nodeType && el.nodeType === 1)) {
1211
+ throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el));
1212
+ }
1213
+
1214
+ this.el = el; // root element
1215
+
1216
+ this.options = options = _extends({}, options); // Export instance
1217
+
1218
+ el[expando] = this;
1219
+ var defaults = {
1220
+ group: null,
1221
+ sort: true,
1222
+ disabled: false,
1223
+ store: null,
1224
+ handle: null,
1225
+ draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*',
1226
+ swapThreshold: 1,
1227
+ // percentage; 0 <= x <= 1
1228
+ invertSwap: false,
1229
+ // invert always
1230
+ invertedSwapThreshold: null,
1231
+ // will be set to same as swapThreshold if default
1232
+ removeCloneOnHide: true,
1233
+ direction: function direction() {
1234
+ return _detectDirection(el, this.options);
1235
+ },
1236
+ ghostClass: 'sortable-ghost',
1237
+ chosenClass: 'sortable-chosen',
1238
+ dragClass: 'sortable-drag',
1239
+ ignore: 'a, img',
1240
+ filter: null,
1241
+ preventOnFilter: true,
1242
+ animation: 0,
1243
+ easing: null,
1244
+ setData: function setData(dataTransfer, dragEl) {
1245
+ dataTransfer.setData('Text', dragEl.textContent);
1246
+ },
1247
+ dropBubble: false,
1248
+ dragoverBubble: false,
1249
+ dataIdAttr: 'data-id',
1250
+ delay: 0,
1251
+ delayOnTouchOnly: false,
1252
+ touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
1253
+ forceFallback: false,
1254
+ fallbackClass: 'sortable-fallback',
1255
+ fallbackOnBody: false,
1256
+ fallbackTolerance: 0,
1257
+ fallbackOffset: {
1258
+ x: 0,
1259
+ y: 0
1260
+ },
1261
+ supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && !Safari,
1262
+ emptyInsertThreshold: 5
1263
+ };
1264
+ PluginManager.initializePlugins(this, el, defaults); // Set default options
1265
+
1266
+ for (var name in defaults) {
1267
+ !(name in options) && (options[name] = defaults[name]);
1268
+ }
1269
+
1270
+ _prepareGroup(options); // Bind all private methods
1271
+
1272
+
1273
+ for (var fn in this) {
1274
+ if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
1275
+ this[fn] = this[fn].bind(this);
1276
+ }
1277
+ } // Setup drag mode
1278
+
1279
+
1280
+ this.nativeDraggable = options.forceFallback ? false : supportDraggable;
1281
+
1282
+ if (this.nativeDraggable) {
1283
+ // Touch start threshold cannot be greater than the native dragstart threshold
1284
+ this.options.touchStartThreshold = 1;
1285
+ } // Bind events
1286
+
1287
+
1288
+ if (options.supportPointer) {
1289
+ on(el, 'pointerdown', this._onTapStart);
1290
+ } else {
1291
+ on(el, 'mousedown', this._onTapStart);
1292
+ on(el, 'touchstart', this._onTapStart);
1293
+ }
1294
+
1295
+ if (this.nativeDraggable) {
1296
+ on(el, 'dragover', this);
1297
+ on(el, 'dragenter', this);
1298
+ }
1299
+
1300
+ sortables.push(this.el); // Restore sorting
1301
+
1302
+ options.store && options.store.get && this.sort(options.store.get(this) || []); // Add animation state manager
1303
+
1304
+ _extends(this, AnimationStateManager());
1305
+ }
1306
+
1307
+ Sortable.prototype =
1308
+ /** @lends Sortable.prototype */
1309
+ {
1310
+ constructor: Sortable,
1311
+ _isOutsideThisEl: function _isOutsideThisEl(target) {
1312
+ if (!this.el.contains(target) && target !== this.el) {
1313
+ lastTarget = null;
1314
+ }
1315
+ },
1316
+ _getDirection: function _getDirection(evt, target) {
1317
+ return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;
1318
+ },
1319
+ _onTapStart: function _onTapStart(
1320
+ /** Event|TouchEvent */
1321
+ evt) {
1322
+ if (!evt.cancelable) return;
1323
+
1324
+ var _this = this,
1325
+ el = this.el,
1326
+ options = this.options,
1327
+ preventOnFilter = options.preventOnFilter,
1328
+ type = evt.type,
1329
+ touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt,
1330
+ target = (touch || evt).target,
1331
+ originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target,
1332
+ filter = options.filter;
1333
+
1334
+ _saveInputCheckedState(el); // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
1335
+
1336
+
1337
+ if (dragEl) {
1338
+ return;
1339
+ }
1340
+
1341
+ if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
1342
+ return; // only left button and enabled
1343
+ } // cancel dnd if original target is content editable
1344
+
1345
+
1346
+ if (originalTarget.isContentEditable) {
1347
+ return;
1348
+ } // Safari ignores further event handling after mousedown
1349
+
1350
+
1351
+ if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {
1352
+ return;
1353
+ }
1354
+
1355
+ target = closest(target, options.draggable, el, false);
1356
+
1357
+ if (target && target.animated) {
1358
+ return;
1359
+ }
1360
+
1361
+ if (lastDownEl === target) {
1362
+ // Ignoring duplicate `down`
1363
+ return;
1364
+ } // Get the index of the dragged element within its parent
1365
+
1366
+
1367
+ oldIndex = index(target);
1368
+ oldDraggableIndex = index(target, options.draggable); // Check filter
1369
+
1370
+ if (typeof filter === 'function') {
1371
+ if (filter.call(this, evt, target, this)) {
1372
+ _dispatchEvent({
1373
+ sortable: _this,
1374
+ rootEl: originalTarget,
1375
+ name: 'filter',
1376
+ targetEl: target,
1377
+ toEl: el,
1378
+ fromEl: el
1379
+ });
1380
+
1381
+ pluginEvent('filter', _this, {
1382
+ evt: evt
1383
+ });
1384
+ preventOnFilter && evt.cancelable && evt.preventDefault();
1385
+ return; // cancel dnd
1386
+ }
1387
+ } else if (filter) {
1388
+ filter = filter.split(',').some(function (criteria) {
1389
+ criteria = closest(originalTarget, criteria.trim(), el, false);
1390
+
1391
+ if (criteria) {
1392
+ _dispatchEvent({
1393
+ sortable: _this,
1394
+ rootEl: criteria,
1395
+ name: 'filter',
1396
+ targetEl: target,
1397
+ fromEl: el,
1398
+ toEl: el
1399
+ });
1400
+
1401
+ pluginEvent('filter', _this, {
1402
+ evt: evt
1403
+ });
1404
+ return true;
1405
+ }
1406
+ });
1407
+
1408
+ if (filter) {
1409
+ preventOnFilter && evt.cancelable && evt.preventDefault();
1410
+ return; // cancel dnd
1411
+ }
1412
+ }
1413
+
1414
+ if (options.handle && !closest(originalTarget, options.handle, el, false)) {
1415
+ return;
1416
+ } // Prepare `dragstart`
1417
+
1418
+
1419
+ this._prepareDragStart(evt, touch, target);
1420
+ },
1421
+ _prepareDragStart: function _prepareDragStart(
1422
+ /** Event */
1423
+ evt,
1424
+ /** Touch */
1425
+ touch,
1426
+ /** HTMLElement */
1427
+ target) {
1428
+ var _this = this,
1429
+ el = _this.el,
1430
+ options = _this.options,
1431
+ ownerDocument = el.ownerDocument,
1432
+ dragStartFn;
1433
+
1434
+ if (target && !dragEl && target.parentNode === el) {
1435
+ var dragRect = getRect(target);
1436
+ rootEl = el;
1437
+ dragEl = target;
1438
+ parentEl = dragEl.parentNode;
1439
+ nextEl = dragEl.nextSibling;
1440
+ lastDownEl = target;
1441
+ activeGroup = options.group;
1442
+ Sortable.dragged = dragEl;
1443
+ tapEvt = {
1444
+ target: dragEl,
1445
+ clientX: (touch || evt).clientX,
1446
+ clientY: (touch || evt).clientY
1447
+ };
1448
+ tapDistanceLeft = tapEvt.clientX - dragRect.left;
1449
+ tapDistanceTop = tapEvt.clientY - dragRect.top;
1450
+ this._lastX = (touch || evt).clientX;
1451
+ this._lastY = (touch || evt).clientY;
1452
+ dragEl.style['will-change'] = 'all';
1453
+
1454
+ dragStartFn = function dragStartFn() {
1455
+ pluginEvent('delayEnded', _this, {
1456
+ evt: evt
1457
+ });
1458
+
1459
+ if (Sortable.eventCanceled) {
1460
+ _this._onDrop();
1461
+
1462
+ return;
1463
+ } // Delayed drag has been triggered
1464
+ // we can re-enable the events: touchmove/mousemove
1465
+
1466
+
1467
+ _this._disableDelayedDragEvents();
1468
+
1469
+ if (!FireFox && _this.nativeDraggable) {
1470
+ dragEl.draggable = true;
1471
+ } // Bind the events: dragstart/dragend
1472
+
1473
+
1474
+ _this._triggerDragStart(evt, touch); // Drag start event
1475
+
1476
+
1477
+ _dispatchEvent({
1478
+ sortable: _this,
1479
+ name: 'choose',
1480
+ originalEvent: evt
1481
+ }); // Chosen item
1482
+
1483
+
1484
+ toggleClass(dragEl, options.chosenClass, true);
1485
+ }; // Disable "draggable"
1486
+
1487
+
1488
+ options.ignore.split(',').forEach(function (criteria) {
1489
+ find(dragEl, criteria.trim(), _disableDraggable);
1490
+ });
1491
+ on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);
1492
+ on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);
1493
+ on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);
1494
+ on(ownerDocument, 'mouseup', _this._onDrop);
1495
+ on(ownerDocument, 'touchend', _this._onDrop);
1496
+ on(ownerDocument, 'touchcancel', _this._onDrop); // Make dragEl draggable (must be before delay for FireFox)
1497
+
1498
+ if (FireFox && this.nativeDraggable) {
1499
+ this.options.touchStartThreshold = 4;
1500
+ dragEl.draggable = true;
1501
+ }
1502
+
1503
+ pluginEvent('delayStart', this, {
1504
+ evt: evt
1505
+ }); // Delay is impossible for native DnD in Edge or IE
1506
+
1507
+ if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {
1508
+ if (Sortable.eventCanceled) {
1509
+ this._onDrop();
1510
+
1511
+ return;
1512
+ } // If the user moves the pointer or let go the click or touch
1513
+ // before the delay has been reached:
1514
+ // disable the delayed drag
1515
+
1516
+
1517
+ on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
1518
+ on(ownerDocument, 'touchend', _this._disableDelayedDrag);
1519
+ on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
1520
+ on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);
1521
+ on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);
1522
+ options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);
1523
+ _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
1524
+ } else {
1525
+ dragStartFn();
1526
+ }
1527
+ }
1528
+ },
1529
+ _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(
1530
+ /** TouchEvent|PointerEvent **/
1531
+ e) {
1532
+ var touch = e.touches ? e.touches[0] : e;
1533
+
1534
+ if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) {
1535
+ this._disableDelayedDrag();
1536
+ }
1537
+ },
1538
+ _disableDelayedDrag: function _disableDelayedDrag() {
1539
+ dragEl && _disableDraggable(dragEl);
1540
+ clearTimeout(this._dragStartTimer);
1541
+
1542
+ this._disableDelayedDragEvents();
1543
+ },
1544
+ _disableDelayedDragEvents: function _disableDelayedDragEvents() {
1545
+ var ownerDocument = this.el.ownerDocument;
1546
+ off(ownerDocument, 'mouseup', this._disableDelayedDrag);
1547
+ off(ownerDocument, 'touchend', this._disableDelayedDrag);
1548
+ off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
1549
+ off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);
1550
+ off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);
1551
+ off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);
1552
+ },
1553
+ _triggerDragStart: function _triggerDragStart(
1554
+ /** Event */
1555
+ evt,
1556
+ /** Touch */
1557
+ touch) {
1558
+ touch = touch || evt.pointerType == 'touch' && evt;
1559
+
1560
+ if (!this.nativeDraggable || touch) {
1561
+ if (this.options.supportPointer) {
1562
+ on(document, 'pointermove', this._onTouchMove);
1563
+ } else if (touch) {
1564
+ on(document, 'touchmove', this._onTouchMove);
1565
+ } else {
1566
+ on(document, 'mousemove', this._onTouchMove);
1567
+ }
1568
+ } else {
1569
+ on(dragEl, 'dragend', this);
1570
+ on(rootEl, 'dragstart', this._onDragStart);
1571
+ }
1572
+
1573
+ try {
1574
+ if (document.selection) {
1575
+ // Timeout neccessary for IE9
1576
+ _nextTick(function () {
1577
+ document.selection.empty();
1578
+ });
1579
+ } else {
1580
+ window.getSelection().removeAllRanges();
1581
+ }
1582
+ } catch (err) {}
1583
+ },
1584
+ _dragStarted: function _dragStarted(fallback, evt) {
1585
+
1586
+ awaitingDragStarted = false;
1587
+
1588
+ if (rootEl && dragEl) {
1589
+ pluginEvent('dragStarted', this, {
1590
+ evt: evt
1591
+ });
1592
+
1593
+ if (this.nativeDraggable) {
1594
+ on(document, 'dragover', _checkOutsideTargetEl);
1595
+ }
1596
+
1597
+ var options = this.options; // Apply effect
1598
+
1599
+ !fallback && toggleClass(dragEl, options.dragClass, false);
1600
+ toggleClass(dragEl, options.ghostClass, true);
1601
+ Sortable.active = this;
1602
+ fallback && this._appendGhost(); // Drag start event
1603
+
1604
+ _dispatchEvent({
1605
+ sortable: this,
1606
+ name: 'start',
1607
+ originalEvent: evt
1608
+ });
1609
+ } else {
1610
+ this._nulling();
1611
+ }
1612
+ },
1613
+ _emulateDragOver: function _emulateDragOver() {
1614
+ if (touchEvt) {
1615
+ this._lastX = touchEvt.clientX;
1616
+ this._lastY = touchEvt.clientY;
1617
+
1618
+ _hideGhostForTarget();
1619
+
1620
+ var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
1621
+ var parent = target;
1622
+
1623
+ while (target && target.shadowRoot) {
1624
+ target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
1625
+ if (target === parent) break;
1626
+ parent = target;
1627
+ }
1628
+
1629
+ dragEl.parentNode[expando]._isOutsideThisEl(target);
1630
+
1631
+ if (parent) {
1632
+ do {
1633
+ if (parent[expando]) {
1634
+ var inserted = void 0;
1635
+ inserted = parent[expando]._onDragOver({
1636
+ clientX: touchEvt.clientX,
1637
+ clientY: touchEvt.clientY,
1638
+ target: target,
1639
+ rootEl: parent
1640
+ });
1641
+
1642
+ if (inserted && !this.options.dragoverBubble) {
1643
+ break;
1644
+ }
1645
+ }
1646
+
1647
+ target = parent; // store last element
1648
+ }
1649
+ /* jshint boss:true */
1650
+ while (parent = parent.parentNode);
1651
+ }
1652
+
1653
+ _unhideGhostForTarget();
1654
+ }
1655
+ },
1656
+ _onTouchMove: function _onTouchMove(
1657
+ /**TouchEvent*/
1658
+ evt) {
1659
+ if (tapEvt) {
1660
+ var options = this.options,
1661
+ fallbackTolerance = options.fallbackTolerance,
1662
+ fallbackOffset = options.fallbackOffset,
1663
+ touch = evt.touches ? evt.touches[0] : evt,
1664
+ ghostMatrix = ghostEl && matrix(ghostEl, true),
1665
+ scaleX = ghostEl && ghostMatrix && ghostMatrix.a,
1666
+ scaleY = ghostEl && ghostMatrix && ghostMatrix.d,
1667
+ relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent),
1668
+ dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1),
1669
+ dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1); // only set the status to dragging, when we are actually dragging
1670
+
1671
+ if (!Sortable.active && !awaitingDragStarted) {
1672
+ if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {
1673
+ return;
1674
+ }
1675
+
1676
+ this._onDragStart(evt, true);
1677
+ }
1678
+
1679
+ if (ghostEl) {
1680
+ if (ghostMatrix) {
1681
+ ghostMatrix.e += dx - (lastDx || 0);
1682
+ ghostMatrix.f += dy - (lastDy || 0);
1683
+ } else {
1684
+ ghostMatrix = {
1685
+ a: 1,
1686
+ b: 0,
1687
+ c: 0,
1688
+ d: 1,
1689
+ e: dx,
1690
+ f: dy
1691
+ };
1692
+ }
1693
+
1694
+ var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")");
1695
+ css(ghostEl, 'webkitTransform', cssMatrix);
1696
+ css(ghostEl, 'mozTransform', cssMatrix);
1697
+ css(ghostEl, 'msTransform', cssMatrix);
1698
+ css(ghostEl, 'transform', cssMatrix);
1699
+ lastDx = dx;
1700
+ lastDy = dy;
1701
+ touchEvt = touch;
1702
+ }
1703
+
1704
+ evt.cancelable && evt.preventDefault();
1705
+ }
1706
+ },
1707
+ _appendGhost: function _appendGhost() {
1708
+ // Bug if using scale(): https://stackoverflow.com/questions/2637058
1709
+ // Not being adjusted for
1710
+ if (!ghostEl) {
1711
+ var container = this.options.fallbackOnBody ? document.body : rootEl,
1712
+ rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container),
1713
+ options = this.options; // Position absolutely
1714
+
1715
+ if (PositionGhostAbsolutely) {
1716
+ // Get relatively positioned parent
1717
+ ghostRelativeParent = container;
1718
+
1719
+ while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) {
1720
+ ghostRelativeParent = ghostRelativeParent.parentNode;
1721
+ }
1722
+
1723
+ if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {
1724
+ if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement();
1725
+ rect.top += ghostRelativeParent.scrollTop;
1726
+ rect.left += ghostRelativeParent.scrollLeft;
1727
+ } else {
1728
+ ghostRelativeParent = getWindowScrollingElement();
1729
+ }
1730
+
1731
+ ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);
1732
+ }
1733
+
1734
+ ghostEl = dragEl.cloneNode(true);
1735
+ toggleClass(ghostEl, options.ghostClass, false);
1736
+ toggleClass(ghostEl, options.fallbackClass, true);
1737
+ toggleClass(ghostEl, options.dragClass, true);
1738
+ css(ghostEl, 'transition', '');
1739
+ css(ghostEl, 'transform', '');
1740
+ css(ghostEl, 'box-sizing', 'border-box');
1741
+ css(ghostEl, 'margin', 0);
1742
+ css(ghostEl, 'top', rect.top);
1743
+ css(ghostEl, 'left', rect.left);
1744
+ css(ghostEl, 'width', rect.width);
1745
+ css(ghostEl, 'height', rect.height);
1746
+ css(ghostEl, 'opacity', '0.8');
1747
+ css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed');
1748
+ css(ghostEl, 'zIndex', '100000');
1749
+ css(ghostEl, 'pointerEvents', 'none');
1750
+ Sortable.ghost = ghostEl;
1751
+ container.appendChild(ghostEl); // Set transform-origin
1752
+
1753
+ css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%');
1754
+ }
1755
+ },
1756
+ _onDragStart: function _onDragStart(
1757
+ /**Event*/
1758
+ evt,
1759
+ /**boolean*/
1760
+ fallback) {
1761
+ var _this = this;
1762
+
1763
+ var dataTransfer = evt.dataTransfer;
1764
+ var options = _this.options;
1765
+ pluginEvent('dragStart', this, {
1766
+ evt: evt
1767
+ });
1768
+
1769
+ if (Sortable.eventCanceled) {
1770
+ this._onDrop();
1771
+
1772
+ return;
1773
+ }
1774
+
1775
+ pluginEvent('setupClone', this);
1776
+
1777
+ if (!Sortable.eventCanceled) {
1778
+ cloneEl = clone(dragEl);
1779
+ cloneEl.removeAttribute("id");
1780
+ cloneEl.draggable = false;
1781
+ cloneEl.style['will-change'] = '';
1782
+
1783
+ this._hideClone();
1784
+
1785
+ toggleClass(cloneEl, this.options.chosenClass, false);
1786
+ Sortable.clone = cloneEl;
1787
+ } // #1143: IFrame support workaround
1788
+
1789
+
1790
+ _this.cloneId = _nextTick(function () {
1791
+ pluginEvent('clone', _this);
1792
+ if (Sortable.eventCanceled) return;
1793
+
1794
+ if (!_this.options.removeCloneOnHide) {
1795
+ rootEl.insertBefore(cloneEl, dragEl);
1796
+ }
1797
+
1798
+ _this._hideClone();
1799
+
1800
+ _dispatchEvent({
1801
+ sortable: _this,
1802
+ name: 'clone'
1803
+ });
1804
+ });
1805
+ !fallback && toggleClass(dragEl, options.dragClass, true); // Set proper drop events
1806
+
1807
+ if (fallback) {
1808
+ ignoreNextClick = true;
1809
+ _this._loopId = setInterval(_this._emulateDragOver, 50);
1810
+ } else {
1811
+ // Undo what was set in _prepareDragStart before drag started
1812
+ off(document, 'mouseup', _this._onDrop);
1813
+ off(document, 'touchend', _this._onDrop);
1814
+ off(document, 'touchcancel', _this._onDrop);
1815
+
1816
+ if (dataTransfer) {
1817
+ dataTransfer.effectAllowed = 'move';
1818
+ options.setData && options.setData.call(_this, dataTransfer, dragEl);
1819
+ }
1820
+
1821
+ on(document, 'drop', _this); // #1276 fix:
1822
+
1823
+ css(dragEl, 'transform', 'translateZ(0)');
1824
+ }
1825
+
1826
+ awaitingDragStarted = true;
1827
+ _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));
1828
+ on(document, 'selectstart', _this);
1829
+ moved = true;
1830
+
1831
+ if (Safari) {
1832
+ css(document.body, 'user-select', 'none');
1833
+ }
1834
+ },
1835
+ // Returns true - if no further action is needed (either inserted or another condition)
1836
+ _onDragOver: function _onDragOver(
1837
+ /**Event*/
1838
+ evt) {
1839
+ var el = this.el,
1840
+ target = evt.target,
1841
+ dragRect,
1842
+ targetRect,
1843
+ revert,
1844
+ options = this.options,
1845
+ group = options.group,
1846
+ activeSortable = Sortable.active,
1847
+ isOwner = activeGroup === group,
1848
+ canSort = options.sort,
1849
+ fromSortable = putSortable || activeSortable,
1850
+ vertical,
1851
+ _this = this,
1852
+ completedFired = false;
1853
+
1854
+ if (_silent) return;
1855
+
1856
+ function dragOverEvent(name, extra) {
1857
+ pluginEvent(name, _this, _objectSpread2({
1858
+ evt: evt,
1859
+ isOwner: isOwner,
1860
+ axis: vertical ? 'vertical' : 'horizontal',
1861
+ revert: revert,
1862
+ dragRect: dragRect,
1863
+ targetRect: targetRect,
1864
+ canSort: canSort,
1865
+ fromSortable: fromSortable,
1866
+ target: target,
1867
+ completed: completed,
1868
+ onMove: function onMove(target, after) {
1869
+ return _onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after);
1870
+ },
1871
+ changed: changed
1872
+ }, extra));
1873
+ } // Capture animation state
1874
+
1875
+
1876
+ function capture() {
1877
+ dragOverEvent('dragOverAnimationCapture');
1878
+
1879
+ _this.captureAnimationState();
1880
+
1881
+ if (_this !== fromSortable) {
1882
+ fromSortable.captureAnimationState();
1883
+ }
1884
+ } // Return invocation when dragEl is inserted (or completed)
1885
+
1886
+
1887
+ function completed(insertion) {
1888
+ dragOverEvent('dragOverCompleted', {
1889
+ insertion: insertion
1890
+ });
1891
+
1892
+ if (insertion) {
1893
+ // Clones must be hidden before folding animation to capture dragRectAbsolute properly
1894
+ if (isOwner) {
1895
+ activeSortable._hideClone();
1896
+ } else {
1897
+ activeSortable._showClone(_this);
1898
+ }
1899
+
1900
+ if (_this !== fromSortable) {
1901
+ // Set ghost class to new sortable's ghost class
1902
+ toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);
1903
+ toggleClass(dragEl, options.ghostClass, true);
1904
+ }
1905
+
1906
+ if (putSortable !== _this && _this !== Sortable.active) {
1907
+ putSortable = _this;
1908
+ } else if (_this === Sortable.active && putSortable) {
1909
+ putSortable = null;
1910
+ } // Animation
1911
+
1912
+
1913
+ if (fromSortable === _this) {
1914
+ _this._ignoreWhileAnimating = target;
1915
+ }
1916
+
1917
+ _this.animateAll(function () {
1918
+ dragOverEvent('dragOverAnimationComplete');
1919
+ _this._ignoreWhileAnimating = null;
1920
+ });
1921
+
1922
+ if (_this !== fromSortable) {
1923
+ fromSortable.animateAll();
1924
+ fromSortable._ignoreWhileAnimating = null;
1925
+ }
1926
+ } // Null lastTarget if it is not inside a previously swapped element
1927
+
1928
+
1929
+ if (target === dragEl && !dragEl.animated || target === el && !target.animated) {
1930
+ lastTarget = null;
1931
+ } // no bubbling and not fallback
1932
+
1933
+
1934
+ if (!options.dragoverBubble && !evt.rootEl && target !== document) {
1935
+ dragEl.parentNode[expando]._isOutsideThisEl(evt.target); // Do not detect for empty insert if already inserted
1936
+
1937
+
1938
+ !insertion && nearestEmptyInsertDetectEvent(evt);
1939
+ }
1940
+
1941
+ !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();
1942
+ return completedFired = true;
1943
+ } // Call when dragEl has been inserted
1944
+
1945
+
1946
+ function changed() {
1947
+ newIndex = index(dragEl);
1948
+ newDraggableIndex = index(dragEl, options.draggable);
1949
+
1950
+ _dispatchEvent({
1951
+ sortable: _this,
1952
+ name: 'change',
1953
+ toEl: el,
1954
+ newIndex: newIndex,
1955
+ newDraggableIndex: newDraggableIndex,
1956
+ originalEvent: evt
1957
+ });
1958
+ }
1959
+
1960
+ if (evt.preventDefault !== void 0) {
1961
+ evt.cancelable && evt.preventDefault();
1962
+ }
1963
+
1964
+ target = closest(target, options.draggable, el, true);
1965
+ dragOverEvent('dragOver');
1966
+ if (Sortable.eventCanceled) return completedFired;
1967
+
1968
+ if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {
1969
+ return completed(false);
1970
+ }
1971
+
1972
+ ignoreNextClick = false;
1973
+
1974
+ if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) // Reverting item into the original list
1975
+ : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {
1976
+ vertical = this._getDirection(evt, target) === 'vertical';
1977
+ dragRect = getRect(dragEl);
1978
+ dragOverEvent('dragOverValid');
1979
+ if (Sortable.eventCanceled) return completedFired;
1980
+
1981
+ if (revert) {
1982
+ parentEl = rootEl; // actualization
1983
+
1984
+ capture();
1985
+
1986
+ this._hideClone();
1987
+
1988
+ dragOverEvent('revert');
1989
+
1990
+ if (!Sortable.eventCanceled) {
1991
+ if (nextEl) {
1992
+ rootEl.insertBefore(dragEl, nextEl);
1993
+ } else {
1994
+ rootEl.appendChild(dragEl);
1995
+ }
1996
+ }
1997
+
1998
+ return completed(true);
1999
+ }
2000
+
2001
+ var elLastChild = lastChild(el, options.draggable);
2002
+
2003
+ if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {
2004
+ // Insert to end of list
2005
+ // If already at end of list: Do not insert
2006
+ if (elLastChild === dragEl) {
2007
+ return completed(false);
2008
+ } // if there is a last element, it is the target
2009
+
2010
+
2011
+ if (elLastChild && el === evt.target) {
2012
+ target = elLastChild;
2013
+ }
2014
+
2015
+ if (target) {
2016
+ targetRect = getRect(target);
2017
+ }
2018
+
2019
+ if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
2020
+ capture();
2021
+
2022
+ if (elLastChild && elLastChild.nextSibling) {
2023
+ // the last draggable element is not the last node
2024
+ el.insertBefore(dragEl, elLastChild.nextSibling);
2025
+ } else {
2026
+ el.appendChild(dragEl);
2027
+ }
2028
+
2029
+ parentEl = el; // actualization
2030
+
2031
+ changed();
2032
+ return completed(true);
2033
+ }
2034
+ } else if (elLastChild && _ghostIsFirst(evt, vertical, this)) {
2035
+ // Insert to start of list
2036
+ var firstChild = getChild(el, 0, options, true);
2037
+
2038
+ if (firstChild === dragEl) {
2039
+ return completed(false);
2040
+ }
2041
+
2042
+ target = firstChild;
2043
+ targetRect = getRect(target);
2044
+
2045
+ if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) {
2046
+ capture();
2047
+ el.insertBefore(dragEl, firstChild);
2048
+ parentEl = el; // actualization
2049
+
2050
+ changed();
2051
+ return completed(true);
2052
+ }
2053
+ } else if (target.parentNode === el) {
2054
+ targetRect = getRect(target);
2055
+ var direction = 0,
2056
+ targetBeforeFirstSwap,
2057
+ differentLevel = dragEl.parentNode !== el,
2058
+ differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical),
2059
+ side1 = vertical ? 'top' : 'left',
2060
+ scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'),
2061
+ scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;
2062
+
2063
+ if (lastTarget !== target) {
2064
+ targetBeforeFirstSwap = targetRect[side1];
2065
+ pastFirstInvertThresh = false;
2066
+ isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;
2067
+ }
2068
+
2069
+ direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);
2070
+ var sibling;
2071
+
2072
+ if (direction !== 0) {
2073
+ // Check if target is beside dragEl in respective direction (ignoring hidden elements)
2074
+ var dragIndex = index(dragEl);
2075
+
2076
+ do {
2077
+ dragIndex -= direction;
2078
+ sibling = parentEl.children[dragIndex];
2079
+ } while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl));
2080
+ } // If dragEl is already beside target: Do not insert
2081
+
2082
+
2083
+ if (direction === 0 || sibling === target) {
2084
+ return completed(false);
2085
+ }
2086
+
2087
+ lastTarget = target;
2088
+ lastDirection = direction;
2089
+ var nextSibling = target.nextElementSibling,
2090
+ after = false;
2091
+ after = direction === 1;
2092
+
2093
+ var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
2094
+
2095
+ if (moveVector !== false) {
2096
+ if (moveVector === 1 || moveVector === -1) {
2097
+ after = moveVector === 1;
2098
+ }
2099
+
2100
+ _silent = true;
2101
+ setTimeout(_unsilent, 30);
2102
+ capture();
2103
+
2104
+ if (after && !nextSibling) {
2105
+ el.appendChild(dragEl);
2106
+ } else {
2107
+ target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
2108
+ } // Undo chrome's scroll adjustment (has no effect on other browsers)
2109
+
2110
+
2111
+ if (scrolledPastTop) {
2112
+ scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);
2113
+ }
2114
+
2115
+ parentEl = dragEl.parentNode; // actualization
2116
+ // must be done before animation
2117
+
2118
+ if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) {
2119
+ targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);
2120
+ }
2121
+
2122
+ changed();
2123
+ return completed(true);
2124
+ }
2125
+ }
2126
+
2127
+ if (el.contains(dragEl)) {
2128
+ return completed(false);
2129
+ }
2130
+ }
2131
+
2132
+ return false;
2133
+ },
2134
+ _ignoreWhileAnimating: null,
2135
+ _offMoveEvents: function _offMoveEvents() {
2136
+ off(document, 'mousemove', this._onTouchMove);
2137
+ off(document, 'touchmove', this._onTouchMove);
2138
+ off(document, 'pointermove', this._onTouchMove);
2139
+ off(document, 'dragover', nearestEmptyInsertDetectEvent);
2140
+ off(document, 'mousemove', nearestEmptyInsertDetectEvent);
2141
+ off(document, 'touchmove', nearestEmptyInsertDetectEvent);
2142
+ },
2143
+ _offUpEvents: function _offUpEvents() {
2144
+ var ownerDocument = this.el.ownerDocument;
2145
+ off(ownerDocument, 'mouseup', this._onDrop);
2146
+ off(ownerDocument, 'touchend', this._onDrop);
2147
+ off(ownerDocument, 'pointerup', this._onDrop);
2148
+ off(ownerDocument, 'touchcancel', this._onDrop);
2149
+ off(document, 'selectstart', this);
2150
+ },
2151
+ _onDrop: function _onDrop(
2152
+ /**Event*/
2153
+ evt) {
2154
+ var el = this.el,
2155
+ options = this.options; // Get the index of the dragged element within its parent
2156
+
2157
+ newIndex = index(dragEl);
2158
+ newDraggableIndex = index(dragEl, options.draggable);
2159
+ pluginEvent('drop', this, {
2160
+ evt: evt
2161
+ });
2162
+ parentEl = dragEl && dragEl.parentNode; // Get again after plugin event
2163
+
2164
+ newIndex = index(dragEl);
2165
+ newDraggableIndex = index(dragEl, options.draggable);
2166
+
2167
+ if (Sortable.eventCanceled) {
2168
+ this._nulling();
2169
+
2170
+ return;
2171
+ }
2172
+
2173
+ awaitingDragStarted = false;
2174
+ isCircumstantialInvert = false;
2175
+ pastFirstInvertThresh = false;
2176
+ clearInterval(this._loopId);
2177
+ clearTimeout(this._dragStartTimer);
2178
+
2179
+ _cancelNextTick(this.cloneId);
2180
+
2181
+ _cancelNextTick(this._dragStartId); // Unbind events
2182
+
2183
+
2184
+ if (this.nativeDraggable) {
2185
+ off(document, 'drop', this);
2186
+ off(el, 'dragstart', this._onDragStart);
2187
+ }
2188
+
2189
+ this._offMoveEvents();
2190
+
2191
+ this._offUpEvents();
2192
+
2193
+ if (Safari) {
2194
+ css(document.body, 'user-select', '');
2195
+ }
2196
+
2197
+ css(dragEl, 'transform', '');
2198
+
2199
+ if (evt) {
2200
+ if (moved) {
2201
+ evt.cancelable && evt.preventDefault();
2202
+ !options.dropBubble && evt.stopPropagation();
2203
+ }
2204
+
2205
+ ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
2206
+
2207
+ if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {
2208
+ // Remove clone(s)
2209
+ cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
2210
+ }
2211
+
2212
+ if (dragEl) {
2213
+ if (this.nativeDraggable) {
2214
+ off(dragEl, 'dragend', this);
2215
+ }
2216
+
2217
+ _disableDraggable(dragEl);
2218
+
2219
+ dragEl.style['will-change'] = ''; // Remove classes
2220
+ // ghostClass is added in dragStarted
2221
+
2222
+ if (moved && !awaitingDragStarted) {
2223
+ toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);
2224
+ }
2225
+
2226
+ toggleClass(dragEl, this.options.chosenClass, false); // Drag stop event
2227
+
2228
+ _dispatchEvent({
2229
+ sortable: this,
2230
+ name: 'unchoose',
2231
+ toEl: parentEl,
2232
+ newIndex: null,
2233
+ newDraggableIndex: null,
2234
+ originalEvent: evt
2235
+ });
2236
+
2237
+ if (rootEl !== parentEl) {
2238
+ if (newIndex >= 0) {
2239
+ // Add event
2240
+ _dispatchEvent({
2241
+ rootEl: parentEl,
2242
+ name: 'add',
2243
+ toEl: parentEl,
2244
+ fromEl: rootEl,
2245
+ originalEvent: evt
2246
+ }); // Remove event
2247
+
2248
+
2249
+ _dispatchEvent({
2250
+ sortable: this,
2251
+ name: 'remove',
2252
+ toEl: parentEl,
2253
+ originalEvent: evt
2254
+ }); // drag from one list and drop into another
2255
+
2256
+
2257
+ _dispatchEvent({
2258
+ rootEl: parentEl,
2259
+ name: 'sort',
2260
+ toEl: parentEl,
2261
+ fromEl: rootEl,
2262
+ originalEvent: evt
2263
+ });
2264
+
2265
+ _dispatchEvent({
2266
+ sortable: this,
2267
+ name: 'sort',
2268
+ toEl: parentEl,
2269
+ originalEvent: evt
2270
+ });
2271
+ }
2272
+
2273
+ putSortable && putSortable.save();
2274
+ } else {
2275
+ if (newIndex !== oldIndex) {
2276
+ if (newIndex >= 0) {
2277
+ // drag & drop within the same list
2278
+ _dispatchEvent({
2279
+ sortable: this,
2280
+ name: 'update',
2281
+ toEl: parentEl,
2282
+ originalEvent: evt
2283
+ });
2284
+
2285
+ _dispatchEvent({
2286
+ sortable: this,
2287
+ name: 'sort',
2288
+ toEl: parentEl,
2289
+ originalEvent: evt
2290
+ });
2291
+ }
2292
+ }
2293
+ }
2294
+
2295
+ if (Sortable.active) {
2296
+ /* jshint eqnull:true */
2297
+ if (newIndex == null || newIndex === -1) {
2298
+ newIndex = oldIndex;
2299
+ newDraggableIndex = oldDraggableIndex;
2300
+ }
2301
+
2302
+ _dispatchEvent({
2303
+ sortable: this,
2304
+ name: 'end',
2305
+ toEl: parentEl,
2306
+ originalEvent: evt
2307
+ }); // Save sorting
2308
+
2309
+
2310
+ this.save();
2311
+ }
2312
+ }
2313
+ }
2314
+
2315
+ this._nulling();
2316
+ },
2317
+ _nulling: function _nulling() {
2318
+ pluginEvent('nulling', this);
2319
+ rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null;
2320
+ savedInputChecked.forEach(function (el) {
2321
+ el.checked = true;
2322
+ });
2323
+ savedInputChecked.length = lastDx = lastDy = 0;
2324
+ },
2325
+ handleEvent: function handleEvent(
2326
+ /**Event*/
2327
+ evt) {
2328
+ switch (evt.type) {
2329
+ case 'drop':
2330
+ case 'dragend':
2331
+ this._onDrop(evt);
2332
+
2333
+ break;
2334
+
2335
+ case 'dragenter':
2336
+ case 'dragover':
2337
+ if (dragEl) {
2338
+ this._onDragOver(evt);
2339
+
2340
+ _globalDragOver(evt);
2341
+ }
2342
+
2343
+ break;
2344
+
2345
+ case 'selectstart':
2346
+ evt.preventDefault();
2347
+ break;
2348
+ }
2349
+ },
2350
+
2351
+ /**
2352
+ * Serializes the item into an array of string.
2353
+ * @returns {String[]}
2354
+ */
2355
+ toArray: function toArray() {
2356
+ var order = [],
2357
+ el,
2358
+ children = this.el.children,
2359
+ i = 0,
2360
+ n = children.length,
2361
+ options = this.options;
2362
+
2363
+ for (; i < n; i++) {
2364
+ el = children[i];
2365
+
2366
+ if (closest(el, options.draggable, this.el, false)) {
2367
+ order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
2368
+ }
2369
+ }
2370
+
2371
+ return order;
2372
+ },
2373
+
2374
+ /**
2375
+ * Sorts the elements according to the array.
2376
+ * @param {String[]} order order of the items
2377
+ */
2378
+ sort: function sort(order, useAnimation) {
2379
+ var items = {},
2380
+ rootEl = this.el;
2381
+ this.toArray().forEach(function (id, i) {
2382
+ var el = rootEl.children[i];
2383
+
2384
+ if (closest(el, this.options.draggable, rootEl, false)) {
2385
+ items[id] = el;
2386
+ }
2387
+ }, this);
2388
+ useAnimation && this.captureAnimationState();
2389
+ order.forEach(function (id) {
2390
+ if (items[id]) {
2391
+ rootEl.removeChild(items[id]);
2392
+ rootEl.appendChild(items[id]);
2393
+ }
2394
+ });
2395
+ useAnimation && this.animateAll();
2396
+ },
2397
+
2398
+ /**
2399
+ * Save the current sorting
2400
+ */
2401
+ save: function save() {
2402
+ var store = this.options.store;
2403
+ store && store.set && store.set(this);
2404
+ },
2405
+
2406
+ /**
2407
+ * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
2408
+ * @param {HTMLElement} el
2409
+ * @param {String} [selector] default: `options.draggable`
2410
+ * @returns {HTMLElement|null}
2411
+ */
2412
+ closest: function closest$1(el, selector) {
2413
+ return closest(el, selector || this.options.draggable, this.el, false);
2414
+ },
2415
+
2416
+ /**
2417
+ * Set/get option
2418
+ * @param {string} name
2419
+ * @param {*} [value]
2420
+ * @returns {*}
2421
+ */
2422
+ option: function option(name, value) {
2423
+ var options = this.options;
2424
+
2425
+ if (value === void 0) {
2426
+ return options[name];
2427
+ } else {
2428
+ var modifiedValue = PluginManager.modifyOption(this, name, value);
2429
+
2430
+ if (typeof modifiedValue !== 'undefined') {
2431
+ options[name] = modifiedValue;
2432
+ } else {
2433
+ options[name] = value;
2434
+ }
2435
+
2436
+ if (name === 'group') {
2437
+ _prepareGroup(options);
2438
+ }
2439
+ }
2440
+ },
2441
+
2442
+ /**
2443
+ * Destroy
2444
+ */
2445
+ destroy: function destroy() {
2446
+ pluginEvent('destroy', this);
2447
+ var el = this.el;
2448
+ el[expando] = null;
2449
+ off(el, 'mousedown', this._onTapStart);
2450
+ off(el, 'touchstart', this._onTapStart);
2451
+ off(el, 'pointerdown', this._onTapStart);
2452
+
2453
+ if (this.nativeDraggable) {
2454
+ off(el, 'dragover', this);
2455
+ off(el, 'dragenter', this);
2456
+ } // Remove draggable attributes
2457
+
2458
+
2459
+ Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
2460
+ el.removeAttribute('draggable');
2461
+ });
2462
+
2463
+ this._onDrop();
2464
+
2465
+ this._disableDelayedDragEvents();
2466
+
2467
+ sortables.splice(sortables.indexOf(this.el), 1);
2468
+ this.el = el = null;
2469
+ },
2470
+ _hideClone: function _hideClone() {
2471
+ if (!cloneHidden) {
2472
+ pluginEvent('hideClone', this);
2473
+ if (Sortable.eventCanceled) return;
2474
+ css(cloneEl, 'display', 'none');
2475
+
2476
+ if (this.options.removeCloneOnHide && cloneEl.parentNode) {
2477
+ cloneEl.parentNode.removeChild(cloneEl);
2478
+ }
2479
+
2480
+ cloneHidden = true;
2481
+ }
2482
+ },
2483
+ _showClone: function _showClone(putSortable) {
2484
+ if (putSortable.lastPutMode !== 'clone') {
2485
+ this._hideClone();
2486
+
2487
+ return;
2488
+ }
2489
+
2490
+ if (cloneHidden) {
2491
+ pluginEvent('showClone', this);
2492
+ if (Sortable.eventCanceled) return; // show clone at dragEl or original position
2493
+
2494
+ if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
2495
+ rootEl.insertBefore(cloneEl, dragEl);
2496
+ } else if (nextEl) {
2497
+ rootEl.insertBefore(cloneEl, nextEl);
2498
+ } else {
2499
+ rootEl.appendChild(cloneEl);
2500
+ }
2501
+
2502
+ if (this.options.group.revertClone) {
2503
+ this.animate(dragEl, cloneEl);
2504
+ }
2505
+
2506
+ css(cloneEl, 'display', '');
2507
+ cloneHidden = false;
2508
+ }
2509
+ }
2510
+ };
2511
+
2512
+ function _globalDragOver(
2513
+ /**Event*/
2514
+ evt) {
2515
+ if (evt.dataTransfer) {
2516
+ evt.dataTransfer.dropEffect = 'move';
2517
+ }
2518
+
2519
+ evt.cancelable && evt.preventDefault();
2520
+ }
2521
+
2522
+ function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {
2523
+ var evt,
2524
+ sortable = fromEl[expando],
2525
+ onMoveFn = sortable.options.onMove,
2526
+ retVal; // Support for new CustomEvent feature
2527
+
2528
+ if (window.CustomEvent && !IE11OrLess && !Edge) {
2529
+ evt = new CustomEvent('move', {
2530
+ bubbles: true,
2531
+ cancelable: true
2532
+ });
2533
+ } else {
2534
+ evt = document.createEvent('Event');
2535
+ evt.initEvent('move', true, true);
2536
+ }
2537
+
2538
+ evt.to = toEl;
2539
+ evt.from = fromEl;
2540
+ evt.dragged = dragEl;
2541
+ evt.draggedRect = dragRect;
2542
+ evt.related = targetEl || toEl;
2543
+ evt.relatedRect = targetRect || getRect(toEl);
2544
+ evt.willInsertAfter = willInsertAfter;
2545
+ evt.originalEvent = originalEvent;
2546
+ fromEl.dispatchEvent(evt);
2547
+
2548
+ if (onMoveFn) {
2549
+ retVal = onMoveFn.call(sortable, evt, originalEvent);
2550
+ }
2551
+
2552
+ return retVal;
2553
+ }
2554
+
2555
+ function _disableDraggable(el) {
2556
+ el.draggable = false;
2557
+ }
2558
+
2559
+ function _unsilent() {
2560
+ _silent = false;
2561
+ }
2562
+
2563
+ function _ghostIsFirst(evt, vertical, sortable) {
2564
+ var rect = getRect(getChild(sortable.el, 0, sortable.options, true));
2565
+ var spacer = 10;
2566
+ return vertical ? evt.clientX < rect.left - spacer || evt.clientY < rect.top && evt.clientX < rect.right : evt.clientY < rect.top - spacer || evt.clientY < rect.bottom && evt.clientX < rect.left;
2567
+ }
2568
+
2569
+ function _ghostIsLast(evt, vertical, sortable) {
2570
+ var rect = getRect(lastChild(sortable.el, sortable.options.draggable));
2571
+ var spacer = 10;
2572
+ return vertical ? evt.clientX > rect.right + spacer || evt.clientX <= rect.right && evt.clientY > rect.bottom && evt.clientX >= rect.left : evt.clientX > rect.right && evt.clientY > rect.top || evt.clientX <= rect.right && evt.clientY > rect.bottom + spacer;
2573
+ }
2574
+
2575
+ function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
2576
+ var mouseOnAxis = vertical ? evt.clientY : evt.clientX,
2577
+ targetLength = vertical ? targetRect.height : targetRect.width,
2578
+ targetS1 = vertical ? targetRect.top : targetRect.left,
2579
+ targetS2 = vertical ? targetRect.bottom : targetRect.right,
2580
+ invert = false;
2581
+
2582
+ if (!invertSwap) {
2583
+ // Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold
2584
+ if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {
2585
+ // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2
2586
+ // check if past first invert threshold on side opposite of lastDirection
2587
+ if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) {
2588
+ // past first invert threshold, do not restrict inverted threshold to dragEl shadow
2589
+ pastFirstInvertThresh = true;
2590
+ }
2591
+
2592
+ if (!pastFirstInvertThresh) {
2593
+ // dragEl shadow (target move distance shadow)
2594
+ if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow
2595
+ : mouseOnAxis > targetS2 - targetMoveDistance) {
2596
+ return -lastDirection;
2597
+ }
2598
+ } else {
2599
+ invert = true;
2600
+ }
2601
+ } else {
2602
+ // Regular
2603
+ if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) {
2604
+ return _getInsertDirection(target);
2605
+ }
2606
+ }
2607
+ }
2608
+
2609
+ invert = invert || invertSwap;
2610
+
2611
+ if (invert) {
2612
+ // Invert of regular
2613
+ if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {
2614
+ return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;
2615
+ }
2616
+ }
2617
+
2618
+ return 0;
2619
+ }
2620
+ /**
2621
+ * Gets the direction dragEl must be swapped relative to target in order to make it
2622
+ * seem that dragEl has been "inserted" into that element's position
2623
+ * @param {HTMLElement} target The target whose position dragEl is being inserted at
2624
+ * @return {Number} Direction dragEl must be swapped
2625
+ */
2626
+
2627
+
2628
+ function _getInsertDirection(target) {
2629
+ if (index(dragEl) < index(target)) {
2630
+ return 1;
2631
+ } else {
2632
+ return -1;
2633
+ }
2634
+ }
2635
+ /**
2636
+ * Generate id
2637
+ * @param {HTMLElement} el
2638
+ * @returns {String}
2639
+ * @private
2640
+ */
2641
+
2642
+
2643
+ function _generateId(el) {
2644
+ var str = el.tagName + el.className + el.src + el.href + el.textContent,
2645
+ i = str.length,
2646
+ sum = 0;
2647
+
2648
+ while (i--) {
2649
+ sum += str.charCodeAt(i);
2650
+ }
2651
+
2652
+ return sum.toString(36);
2653
+ }
2654
+
2655
+ function _saveInputCheckedState(root) {
2656
+ savedInputChecked.length = 0;
2657
+ var inputs = root.getElementsByTagName('input');
2658
+ var idx = inputs.length;
2659
+
2660
+ while (idx--) {
2661
+ var el = inputs[idx];
2662
+ el.checked && savedInputChecked.push(el);
2663
+ }
2664
+ }
2665
+
2666
+ function _nextTick(fn) {
2667
+ return setTimeout(fn, 0);
2668
+ }
2669
+
2670
+ function _cancelNextTick(id) {
2671
+ return clearTimeout(id);
2672
+ } // Fixed #973:
2673
+
2674
+
2675
+ if (documentExists) {
2676
+ on(document, 'touchmove', function (evt) {
2677
+ if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {
2678
+ evt.preventDefault();
2679
+ }
2680
+ });
2681
+ } // Export utils
2682
+
2683
+
2684
+ Sortable.utils = {
2685
+ on: on,
2686
+ off: off,
2687
+ css: css,
2688
+ find: find,
2689
+ is: function is(el, selector) {
2690
+ return !!closest(el, selector, el, false);
2691
+ },
2692
+ extend: extend,
2693
+ throttle: throttle,
2694
+ closest: closest,
2695
+ toggleClass: toggleClass,
2696
+ clone: clone,
2697
+ index: index,
2698
+ nextTick: _nextTick,
2699
+ cancelNextTick: _cancelNextTick,
2700
+ detectDirection: _detectDirection,
2701
+ getChild: getChild
2702
+ };
2703
+ /**
2704
+ * Get the Sortable instance of an element
2705
+ * @param {HTMLElement} element The element
2706
+ * @return {Sortable|undefined} The instance of Sortable
2707
+ */
2708
+
2709
+ Sortable.get = function (element) {
2710
+ return element[expando];
2711
+ };
2712
+ /**
2713
+ * Mount a plugin to Sortable
2714
+ * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted
2715
+ */
2716
+
2717
+
2718
+ Sortable.mount = function () {
2719
+ for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {
2720
+ plugins[_key] = arguments[_key];
2721
+ }
2722
+
2723
+ if (plugins[0].constructor === Array) plugins = plugins[0];
2724
+ plugins.forEach(function (plugin) {
2725
+ if (!plugin.prototype || !plugin.prototype.constructor) {
2726
+ throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin));
2727
+ }
2728
+
2729
+ if (plugin.utils) Sortable.utils = _objectSpread2(_objectSpread2({}, Sortable.utils), plugin.utils);
2730
+ PluginManager.mount(plugin);
2731
+ });
2732
+ };
2733
+ /**
2734
+ * Create sortable instance
2735
+ * @param {HTMLElement} el
2736
+ * @param {Object} [options]
2737
+ */
2738
+
2739
+
2740
+ Sortable.create = function (el, options) {
2741
+ return new Sortable(el, options);
2742
+ }; // Export
2743
+
2744
+
2745
+ Sortable.version = version;
2746
+
2747
+ var autoScrolls = [],
2748
+ scrollEl,
2749
+ scrollRootEl,
2750
+ scrolling = false,
2751
+ lastAutoScrollX,
2752
+ lastAutoScrollY,
2753
+ touchEvt$1,
2754
+ pointerElemChangedInterval;
2755
+
2756
+ function AutoScrollPlugin() {
2757
+ function AutoScroll() {
2758
+ this.defaults = {
2759
+ scroll: true,
2760
+ forceAutoScrollFallback: false,
2761
+ scrollSensitivity: 30,
2762
+ scrollSpeed: 10,
2763
+ bubbleScroll: true
2764
+ }; // Bind all private methods
2765
+
2766
+ for (var fn in this) {
2767
+ if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
2768
+ this[fn] = this[fn].bind(this);
2769
+ }
2770
+ }
2771
+ }
2772
+
2773
+ AutoScroll.prototype = {
2774
+ dragStarted: function dragStarted(_ref) {
2775
+ var originalEvent = _ref.originalEvent;
2776
+
2777
+ if (this.sortable.nativeDraggable) {
2778
+ on(document, 'dragover', this._handleAutoScroll);
2779
+ } else {
2780
+ if (this.options.supportPointer) {
2781
+ on(document, 'pointermove', this._handleFallbackAutoScroll);
2782
+ } else if (originalEvent.touches) {
2783
+ on(document, 'touchmove', this._handleFallbackAutoScroll);
2784
+ } else {
2785
+ on(document, 'mousemove', this._handleFallbackAutoScroll);
2786
+ }
2787
+ }
2788
+ },
2789
+ dragOverCompleted: function dragOverCompleted(_ref2) {
2790
+ var originalEvent = _ref2.originalEvent;
2791
+
2792
+ // For when bubbling is canceled and using fallback (fallback 'touchmove' always reached)
2793
+ if (!this.options.dragOverBubble && !originalEvent.rootEl) {
2794
+ this._handleAutoScroll(originalEvent);
2795
+ }
2796
+ },
2797
+ drop: function drop() {
2798
+ if (this.sortable.nativeDraggable) {
2799
+ off(document, 'dragover', this._handleAutoScroll);
2800
+ } else {
2801
+ off(document, 'pointermove', this._handleFallbackAutoScroll);
2802
+ off(document, 'touchmove', this._handleFallbackAutoScroll);
2803
+ off(document, 'mousemove', this._handleFallbackAutoScroll);
2804
+ }
2805
+
2806
+ clearPointerElemChangedInterval();
2807
+ clearAutoScrolls();
2808
+ cancelThrottle();
2809
+ },
2810
+ nulling: function nulling() {
2811
+ touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null;
2812
+ autoScrolls.length = 0;
2813
+ },
2814
+ _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) {
2815
+ this._handleAutoScroll(evt, true);
2816
+ },
2817
+ _handleAutoScroll: function _handleAutoScroll(evt, fallback) {
2818
+ var _this = this;
2819
+
2820
+ var x = (evt.touches ? evt.touches[0] : evt).clientX,
2821
+ y = (evt.touches ? evt.touches[0] : evt).clientY,
2822
+ elem = document.elementFromPoint(x, y);
2823
+ touchEvt$1 = evt; // IE does not seem to have native autoscroll,
2824
+ // Edge's autoscroll seems too conditional,
2825
+ // MACOS Safari does not have autoscroll,
2826
+ // Firefox and Chrome are good
2827
+
2828
+ if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) {
2829
+ autoScroll(evt, this.options, elem, fallback); // Listener for pointer element change
2830
+
2831
+ var ogElemScroller = getParentAutoScrollElement(elem, true);
2832
+
2833
+ if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {
2834
+ pointerElemChangedInterval && clearPointerElemChangedInterval(); // Detect for pointer elem change, emulating native DnD behaviour
2835
+
2836
+ pointerElemChangedInterval = setInterval(function () {
2837
+ var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);
2838
+
2839
+ if (newElem !== ogElemScroller) {
2840
+ ogElemScroller = newElem;
2841
+ clearAutoScrolls();
2842
+ }
2843
+
2844
+ autoScroll(evt, _this.options, newElem, fallback);
2845
+ }, 10);
2846
+ lastAutoScrollX = x;
2847
+ lastAutoScrollY = y;
2848
+ }
2849
+ } else {
2850
+ // if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll
2851
+ if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) {
2852
+ clearAutoScrolls();
2853
+ return;
2854
+ }
2855
+
2856
+ autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);
2857
+ }
2858
+ }
2859
+ };
2860
+ return _extends(AutoScroll, {
2861
+ pluginName: 'scroll',
2862
+ initializeByDefault: true
2863
+ });
2864
+ }
2865
+
2866
+ function clearAutoScrolls() {
2867
+ autoScrolls.forEach(function (autoScroll) {
2868
+ clearInterval(autoScroll.pid);
2869
+ });
2870
+ autoScrolls = [];
2871
+ }
2872
+
2873
+ function clearPointerElemChangedInterval() {
2874
+ clearInterval(pointerElemChangedInterval);
2875
+ }
2876
+
2877
+ var autoScroll = throttle(function (evt, options, rootEl, isFallback) {
2878
+ // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
2879
+ if (!options.scroll) return;
2880
+ var x = (evt.touches ? evt.touches[0] : evt).clientX,
2881
+ y = (evt.touches ? evt.touches[0] : evt).clientY,
2882
+ sens = options.scrollSensitivity,
2883
+ speed = options.scrollSpeed,
2884
+ winScroller = getWindowScrollingElement();
2885
+ var scrollThisInstance = false,
2886
+ scrollCustomFn; // New scroll root, set scrollEl
2887
+
2888
+ if (scrollRootEl !== rootEl) {
2889
+ scrollRootEl = rootEl;
2890
+ clearAutoScrolls();
2891
+ scrollEl = options.scroll;
2892
+ scrollCustomFn = options.scrollFn;
2893
+
2894
+ if (scrollEl === true) {
2895
+ scrollEl = getParentAutoScrollElement(rootEl, true);
2896
+ }
2897
+ }
2898
+
2899
+ var layersOut = 0;
2900
+ var currentParent = scrollEl;
2901
+
2902
+ do {
2903
+ var el = currentParent,
2904
+ rect = getRect(el),
2905
+ top = rect.top,
2906
+ bottom = rect.bottom,
2907
+ left = rect.left,
2908
+ right = rect.right,
2909
+ width = rect.width,
2910
+ height = rect.height,
2911
+ canScrollX = void 0,
2912
+ canScrollY = void 0,
2913
+ scrollWidth = el.scrollWidth,
2914
+ scrollHeight = el.scrollHeight,
2915
+ elCSS = css(el),
2916
+ scrollPosX = el.scrollLeft,
2917
+ scrollPosY = el.scrollTop;
2918
+
2919
+ if (el === winScroller) {
2920
+ canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible');
2921
+ canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible');
2922
+ } else {
2923
+ canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll');
2924
+ canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll');
2925
+ }
2926
+
2927
+ var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);
2928
+ var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);
2929
+
2930
+ if (!autoScrolls[layersOut]) {
2931
+ for (var i = 0; i <= layersOut; i++) {
2932
+ if (!autoScrolls[i]) {
2933
+ autoScrolls[i] = {};
2934
+ }
2935
+ }
2936
+ }
2937
+
2938
+ if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {
2939
+ autoScrolls[layersOut].el = el;
2940
+ autoScrolls[layersOut].vx = vx;
2941
+ autoScrolls[layersOut].vy = vy;
2942
+ clearInterval(autoScrolls[layersOut].pid);
2943
+
2944
+ if (vx != 0 || vy != 0) {
2945
+ scrollThisInstance = true;
2946
+ /* jshint loopfunc:true */
2947
+
2948
+ autoScrolls[layersOut].pid = setInterval(function () {
2949
+ // emulate drag over during autoscroll (fallback), emulating native DnD behaviour
2950
+ if (isFallback && this.layer === 0) {
2951
+ Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely
2952
+
2953
+ }
2954
+
2955
+ var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;
2956
+ var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;
2957
+
2958
+ if (typeof scrollCustomFn === 'function') {
2959
+ if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') {
2960
+ return;
2961
+ }
2962
+ }
2963
+
2964
+ scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);
2965
+ }.bind({
2966
+ layer: layersOut
2967
+ }), 24);
2968
+ }
2969
+ }
2970
+
2971
+ layersOut++;
2972
+ } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));
2973
+
2974
+ scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not
2975
+ }, 30);
2976
+
2977
+ var drop = function drop(_ref) {
2978
+ var originalEvent = _ref.originalEvent,
2979
+ putSortable = _ref.putSortable,
2980
+ dragEl = _ref.dragEl,
2981
+ activeSortable = _ref.activeSortable,
2982
+ dispatchSortableEvent = _ref.dispatchSortableEvent,
2983
+ hideGhostForTarget = _ref.hideGhostForTarget,
2984
+ unhideGhostForTarget = _ref.unhideGhostForTarget;
2985
+ if (!originalEvent) return;
2986
+ var toSortable = putSortable || activeSortable;
2987
+ hideGhostForTarget();
2988
+ var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;
2989
+ var target = document.elementFromPoint(touch.clientX, touch.clientY);
2990
+ unhideGhostForTarget();
2991
+
2992
+ if (toSortable && !toSortable.el.contains(target)) {
2993
+ dispatchSortableEvent('spill');
2994
+ this.onSpill({
2995
+ dragEl: dragEl,
2996
+ putSortable: putSortable
2997
+ });
2998
+ }
2999
+ };
3000
+
3001
+ function Revert() {}
3002
+
3003
+ Revert.prototype = {
3004
+ startIndex: null,
3005
+ dragStart: function dragStart(_ref2) {
3006
+ var oldDraggableIndex = _ref2.oldDraggableIndex;
3007
+ this.startIndex = oldDraggableIndex;
3008
+ },
3009
+ onSpill: function onSpill(_ref3) {
3010
+ var dragEl = _ref3.dragEl,
3011
+ putSortable = _ref3.putSortable;
3012
+ this.sortable.captureAnimationState();
3013
+
3014
+ if (putSortable) {
3015
+ putSortable.captureAnimationState();
3016
+ }
3017
+
3018
+ var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);
3019
+
3020
+ if (nextSibling) {
3021
+ this.sortable.el.insertBefore(dragEl, nextSibling);
3022
+ } else {
3023
+ this.sortable.el.appendChild(dragEl);
3024
+ }
3025
+
3026
+ this.sortable.animateAll();
3027
+
3028
+ if (putSortable) {
3029
+ putSortable.animateAll();
3030
+ }
3031
+ },
3032
+ drop: drop
3033
+ };
3034
+
3035
+ _extends(Revert, {
3036
+ pluginName: 'revertOnSpill'
3037
+ });
3038
+
3039
+ function Remove() {}
3040
+
3041
+ Remove.prototype = {
3042
+ onSpill: function onSpill(_ref4) {
3043
+ var dragEl = _ref4.dragEl,
3044
+ putSortable = _ref4.putSortable;
3045
+ var parentSortable = putSortable || this.sortable;
3046
+ parentSortable.captureAnimationState();
3047
+ dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);
3048
+ parentSortable.animateAll();
3049
+ },
3050
+ drop: drop
3051
+ };
3052
+
3053
+ _extends(Remove, {
3054
+ pluginName: 'removeOnSpill'
3055
+ });
3056
+
3057
+ Sortable.mount(new AutoScrollPlugin());
3058
+ Sortable.mount(Remove, Revert);
3059
+
3060
+ const swirlOptionListCss = ".sc-swirl-option-list-h{display:block}.sc-swirl-option-list-h *.sc-swirl-option-list{box-sizing:border-box}";
3061
+
3062
+ const SwirlOptionList = class {
3063
+ constructor(hostRef) {
3064
+ index$1.registerInstance(this, hostRef);
3065
+ this.itemDrop = index$1.createEvent(this, "itemDrop", 7);
3066
+ this.valueChange = index$1.createEvent(this, "valueChange", 7);
3067
+ this.assistiveTextItemGrabbed = "Item grabbed. Use arrow keys to move item up or down. Use spacebar to save position.";
3068
+ this.assistiveTextItemMoving = "Current position:";
3069
+ this.assistiveTextItemMoved = "Item moved. New position:";
3070
+ this.value = [];
3071
+ this.onFocus = async () => {
3072
+ // prevent focus from canceling the drag event in Safari
3073
+ await new Promise((resolve) => setTimeout(resolve));
3074
+ if (Boolean(this.focusedItem)) {
3075
+ this.focusItem(this.getActiveItemIndex());
3076
+ }
3077
+ else {
3078
+ this.focusItem(0);
3079
+ }
3080
+ };
3081
+ this.onClick = (event) => {
3082
+ event.preventDefault();
3083
+ const target = event.target;
3084
+ const item = target === null || target === void 0 ? void 0 : target.closest("swirl-option-list-item");
3085
+ const composedTarget = event.composedPath()[0];
3086
+ const clickedOption = Boolean(utils.closestPassShadow(composedTarget, '[role="option"]'));
3087
+ if (!Boolean(item) || !clickedOption) {
3088
+ event.preventDefault();
3089
+ return;
3090
+ }
3091
+ this.selectItem(this.items.findIndex((i) => i.value === item.value));
3092
+ };
3093
+ this.onKeyDown = (event) => {
3094
+ if (event.code === "ArrowDown") {
3095
+ event.preventDefault();
3096
+ if (!Boolean(this.dragging)) {
3097
+ this.focusNextItem();
3098
+ }
3099
+ else {
3100
+ this.moveDraggedItemDown();
3101
+ }
3102
+ }
3103
+ else if (event.code === "ArrowUp") {
3104
+ event.preventDefault();
3105
+ if (!Boolean(this.dragging)) {
3106
+ this.focusPreviousItem();
3107
+ }
3108
+ else {
3109
+ this.moveDraggedItemUp();
3110
+ }
3111
+ }
3112
+ else if (event.code === "Space" || event.code === "Enter") {
3113
+ const target = event.composedPath()[0];
3114
+ const optionFocused = Boolean(utils.closestPassShadow(target, '[role="option"]'));
3115
+ if (!optionFocused) {
3116
+ return;
3117
+ }
3118
+ event.preventDefault();
3119
+ if (Boolean(this.dragging)) {
3120
+ this.stopDrag(this.dragging);
3121
+ }
3122
+ else {
3123
+ this.selectFocusedItem();
3124
+ }
3125
+ }
3126
+ else if (event.code === "Home") {
3127
+ event.preventDefault();
3128
+ this.focusItem(0);
3129
+ }
3130
+ else if (event.code === "End") {
3131
+ event.preventDefault();
3132
+ this.focusItem(this.items.length - 1);
3133
+ }
3134
+ else if (event.code === "KeyA" &&
3135
+ (event.metaKey || event.ctrlKey) &&
3136
+ this.multiSelect) {
3137
+ event.preventDefault();
3138
+ this.selectAllItems();
3139
+ }
3140
+ else if (event.code === "Tab") {
3141
+ if (Boolean(this.dragging)) {
3142
+ event.preventDefault();
3143
+ }
3144
+ }
3145
+ };
3146
+ this.toggleDrag = (event) => {
3147
+ const item = event.detail;
3148
+ if (Boolean(this.dragging)) {
3149
+ this.stopDrag(item);
3150
+ }
3151
+ else {
3152
+ this.startDrag(item);
3153
+ }
3154
+ };
3155
+ this.startDrag = (item) => {
3156
+ this.dragging = item;
3157
+ this.draggingStartIndex = this.getItemIndex(this.dragging);
3158
+ item.setAttribute("dragging", "true");
3159
+ const index = this.getItemIndex(this.dragging);
3160
+ this.focusItem(index);
3161
+ this.assistiveText = this.assistiveTextItemGrabbed;
3162
+ };
3163
+ this.stopDrag = (item) => {
3164
+ this.dragging = undefined;
3165
+ item.removeAttribute("dragging");
3166
+ const newIndex = this.getActiveItemIndex();
3167
+ this.assistiveText = `${this.assistiveTextItemMoved} ${newIndex + 1}`;
3168
+ this.itemDrop.emit({ oldIndex: this.draggingStartIndex, newIndex });
3169
+ this.draggingStartIndex = undefined;
3170
+ };
3171
+ }
3172
+ componentDidLoad() {
3173
+ this.updateItems();
3174
+ this.observeSlotChanges();
3175
+ this.setItemAllowDragState();
3176
+ this.setItemDisabledState();
3177
+ this.setItemContext();
3178
+ this.syncItemsWithValue();
3179
+ this.setupDragDrop();
3180
+ }
3181
+ disconnectedCallback() {
3182
+ var _a, _b;
3183
+ (_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
3184
+ (_b = this.sortable) === null || _b === void 0 ? void 0 : _b.destroy();
3185
+ }
3186
+ watchAllowDrag() {
3187
+ this.setItemAllowDragState();
3188
+ this.setupDragDrop();
3189
+ }
3190
+ watchDisabled() {
3191
+ this.setItemDisabledState();
3192
+ }
3193
+ watchMultiSelect() {
3194
+ this.setItemContext();
3195
+ }
3196
+ watchValue() {
3197
+ this.syncItemsWithValue();
3198
+ }
3199
+ observeSlotChanges() {
3200
+ this.observer = new MutationObserver(() => {
3201
+ this.updateItems();
3202
+ });
3203
+ this.observer.observe(this.listboxEl, { childList: true });
3204
+ }
3205
+ updateItems() {
3206
+ this.items = utils.querySelectorAllDeep(this.el, "swirl-option-list-item");
3207
+ }
3208
+ setItemDisabledState() {
3209
+ this.items.forEach((item) => (item.disabled = this.disabled));
3210
+ }
3211
+ setItemContext() {
3212
+ if (this.multiSelect) {
3213
+ this.items.forEach((item) => (item.context = "multi-select"));
3214
+ }
3215
+ else {
3216
+ this.items.forEach((item) => (item.context = "single-select"));
3217
+ if (this.value.length > 1) {
3218
+ this.updateValue([this.value[0]]);
3219
+ }
3220
+ }
3221
+ }
3222
+ setupDragDrop() {
3223
+ if (Boolean(this.sortable)) {
3224
+ this.sortable.destroy();
3225
+ }
3226
+ if (!this.allowDrag) {
3227
+ return;
3228
+ }
3229
+ this.sortable = Sortable.create(this.listboxEl, {
3230
+ animation: 150,
3231
+ draggable: "swirl-option-list-item",
3232
+ handle: ".option-list-item__drag-handle",
3233
+ onEnd: (event) => {
3234
+ this.itemDrop.emit({
3235
+ oldIndex: event.oldIndex,
3236
+ newIndex: event.newIndex,
3237
+ });
3238
+ },
3239
+ });
3240
+ }
3241
+ setItemAllowDragState() {
3242
+ if (this.allowDrag && !this.multiSelect) {
3243
+ console.error("[SwirlOptionList] Drag can only be allowed for multi select lists.");
3244
+ return;
3245
+ }
3246
+ const sections = utils.querySelectorAllDeep(this.el, "swirl-option-list-section");
3247
+ if (this.allowDrag && sections.length > 0) {
3248
+ console.error("[SwirlOptionList] Drag can only be allowed for lists without sections.");
3249
+ return;
3250
+ }
3251
+ if (this.allowDrag) {
3252
+ this.items.forEach((item) => {
3253
+ item.setAttribute("allow-drag", "true");
3254
+ item.addEventListener("toggleDrag", this.toggleDrag);
3255
+ });
3256
+ }
3257
+ else {
3258
+ this.items.forEach((item) => {
3259
+ item.removeAttribute("allow-drag");
3260
+ item.removeEventListener("toggleDrag", this.toggleDrag);
3261
+ });
3262
+ }
3263
+ }
3264
+ selectItem(index) {
3265
+ if (this.disabled) {
3266
+ return;
3267
+ }
3268
+ const item = this.items[index];
3269
+ if (item.disabled) {
3270
+ return;
3271
+ }
3272
+ const itemIsAlreadySelected = this.value.includes(item.value);
3273
+ if (!this.multiSelect) {
3274
+ this.value = [];
3275
+ }
3276
+ if (!itemIsAlreadySelected) {
3277
+ this.updateValue([...this.value, item.value]);
3278
+ }
3279
+ else {
3280
+ this.updateValue(this.value.filter((v) => v !== item.value));
3281
+ }
3282
+ }
3283
+ updateValue(value) {
3284
+ this.value = value;
3285
+ this.valueChange.emit(this.value);
3286
+ }
3287
+ selectFocusedItem() {
3288
+ if (this.disabled || this.getActiveItemIndex() === -1) {
3289
+ return;
3290
+ }
3291
+ this.selectItem(this.getActiveItemIndex());
3292
+ }
3293
+ selectAllItems() {
3294
+ if (this.disabled) {
3295
+ return;
3296
+ }
3297
+ const alreadySelected = this.items.every((item) => this.value.includes(item.value));
3298
+ if (alreadySelected) {
3299
+ this.updateValue([]);
3300
+ }
3301
+ else {
3302
+ this.updateValue(this.items.map((item) => item.value));
3303
+ }
3304
+ }
3305
+ syncItemsWithValue() {
3306
+ this.items.forEach((item) => (item.selected = this.value.includes(item.value)));
3307
+ }
3308
+ focusItem(index) {
3309
+ var _a;
3310
+ if (this.disabled) {
3311
+ return;
3312
+ }
3313
+ this.items.forEach((item) => item.querySelector('[role="option"]').removeAttribute("tabIndex"));
3314
+ const item = (_a = this.items[index]) === null || _a === void 0 ? void 0 : _a.querySelector('[role="option"]');
3315
+ if (!Boolean(item)) {
3316
+ return;
3317
+ }
3318
+ item.setAttribute("tabIndex", "0");
3319
+ item.focus();
3320
+ this.focusedItem = item;
3321
+ }
3322
+ focusNextItem() {
3323
+ if (this.disabled) {
3324
+ return;
3325
+ }
3326
+ const activeItemIndex = this.getActiveItemIndex();
3327
+ const newIndex = Math.min(activeItemIndex + 1, this.items.length - 1);
3328
+ this.focusItem(newIndex);
3329
+ }
3330
+ focusPreviousItem() {
3331
+ const activeItemIndex = this.getActiveItemIndex();
3332
+ const newIndex = Math.max(activeItemIndex - 1, 0);
3333
+ this.focusItem(newIndex);
3334
+ }
3335
+ getActiveItemIndex() {
3336
+ return this.items
3337
+ .map((item) => item.querySelector('[role="option"]'))
3338
+ .findIndex((item) => item === this.focusedItem);
3339
+ }
3340
+ getItemIndex(item) {
3341
+ return this.items.map((i) => i).findIndex((i) => i === item);
3342
+ }
3343
+ moveDraggedItemDown() {
3344
+ const nextSibling = this.dragging.nextElementSibling;
3345
+ if (!Boolean(nextSibling)) {
3346
+ return;
3347
+ }
3348
+ nextSibling.after(this.dragging);
3349
+ this.updateItems();
3350
+ this.listboxEl.focus();
3351
+ this.assistiveText = `${this.assistiveTextItemMoving} ${this.getActiveItemIndex() + 1}`;
3352
+ }
3353
+ moveDraggedItemUp() {
3354
+ const prevSibling = this.dragging.previousElementSibling;
3355
+ if (!Boolean(prevSibling)) {
3356
+ return;
3357
+ }
3358
+ prevSibling.before(this.dragging);
3359
+ this.updateItems();
3360
+ this.listboxEl.focus();
3361
+ this.assistiveText = `${this.assistiveTextItemMoving} ${this.getItemIndex(this.dragging) + 1}`;
3362
+ }
3363
+ render() {
3364
+ const ariaMultiselectable = this.multiSelect ? "true" : undefined;
3365
+ const tabIndex = this.disabled ? -1 : 0;
3366
+ return (index$1.h(index$1.Host, null, index$1.h("swirl-visually-hidden", { role: "alert" }, this.assistiveText), index$1.h("div", { "aria-label": this.label, "aria-multiselectable": ariaMultiselectable, class: "option-list", id: this.optionListId, onClick: this.onClick, onFocus: this.onFocus, onKeyDown: this.onKeyDown, ref: (el) => (this.listboxEl = el), role: "listbox", tabIndex: tabIndex }, index$1.h("slot", null))));
3367
+ }
3368
+ get el() { return index$1.getElement(this); }
3369
+ static get watchers() { return {
3370
+ "allowDrag": ["watchAllowDrag"],
3371
+ "disabled": ["watchDisabled"],
3372
+ "multiSelect": ["watchMultiSelect"],
3373
+ "value": ["watchValue"]
3374
+ }; }
3375
+ };
3376
+ SwirlOptionList.style = swirlOptionListCss;
3377
+
3378
+ const swirlOptionListItemCss = ".sc-swirl-option-list-item-h{position:relative;display:inline-flex;width:100%}.sc-swirl-option-list-item-h *.sc-swirl-option-list-item{box-sizing:border-box}.option-list-item.sc-swirl-option-list-item{display:inline-flex;width:100%;min-height:3rem;padding:var(--s-space-12) var(--s-space-16);align-items:center;background-color:var(--s-surface-overlay-default);cursor:pointer;gap:var(--s-space-12)}.option-list-item.sc-swirl-option-list-item:hover:not(.option-list-item--disabled){background-color:var(--s-surface-overlay-hovered)}.option-list-item.sc-swirl-option-list-item:active:not(.option-list-item--disabled){background-color:var(--s-surface-overlay-pressed)}.option-list-item.sc-swirl-option-list-item:focus{outline:none}.option-list-item.sc-swirl-option-list-item:focus-visible{background-color:var(--s-surface-overlay-hovered)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.option-list-item.sc-swirl-option-list-item{min-height:0;padding:var(--s-space-12);gap:var(--s-space-8)}}.option-list-item--draggable.sc-swirl-option-list-item .option-list-item__label.sc-swirl-option-list-item{padding-right:calc(var(--s-space-16) + 1.5rem)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.option-list-item--draggable.sc-swirl-option-list-item .option-list-item__label.sc-swirl-option-list-item{padding-right:calc(var(--s-space-16) + 1rem)}}.option-list-item--dragging.sc-swirl-option-list-item{z-index:1;border-radius:var(--s-border-radius-s);background-color:var(--s-surface-overlay-pressed);box-shadow:0 0.0625rem 0.125rem rgba(25, 26, 28, 0.08),\n 0 0.25rem 2rem rgba(25, 26, 28, 0.16)}.option-list-item--dragging.sc-swirl-option-list-item:hover:not(.option-list-item--disabled){background-color:var(--s-surface-overlay-pressed)}.option-list-item--selected.sc-swirl-option-list-item .option-list-item__label.sc-swirl-option-list-item{color:var(--s-text-highlight)}.option-list-item--selected.sc-swirl-option-list-item .option-list-item__icon.sc-swirl-option-list-item{color:var(--s-icon-highlight)}.option-list-item--selected.sc-swirl-option-list-item .option-list-item__checkbox-box.sc-swirl-option-list-item{border-color:var(--s-icon-highlight);color:var(--s-text-on-status);background-color:var(--s-icon-highlight)}.option-list-item--disabled.sc-swirl-option-list-item{cursor:default}.option-list-item--disabled.option-list-item--selected.sc-swirl-option-list-item .option-list-item__checkbox-box.sc-swirl-option-list-item{background-color:var(--s-icon-disabled)}.option-list-item--disabled.option-list-item--selected.sc-swirl-option-list-item .option-list-item__checkbox-icon.sc-swirl-option-list-item{color:var(--s-text-on-status)}.option-list-item--disabled.sc-swirl-option-list-item .option-list-item__label.sc-swirl-option-list-item{color:var(--s-text-disabled)}.option-list-item--disabled.sc-swirl-option-list-item .option-list-item__icon.sc-swirl-option-list-item,.option-list-item--disabled.sc-swirl-option-list-item .option-list-item__selection-icon.sc-swirl-option-list-item,.option-list-item--disabled.sc-swirl-option-list-item .option-list-item__checkbox-icon.sc-swirl-option-list-item{color:var(--s-icon-disabled)}.option-list-item--disabled.sc-swirl-option-list-item .option-list-item__checkbox-box.sc-swirl-option-list-item{border-color:var(--s-icon-disabled);background-color:var(--s-surface-overlay-default)}.option-list-item__label.sc-swirl-option-list-item{flex-grow:1;color:var(--s-text-default);font-size:var(--s-font-size-base);font-weight:var(--s-font-weight-medium);line-height:var(--s-line-height-base);text-align:left}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.option-list-item__label.sc-swirl-option-list-item{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.option-list-item__icon.sc-swirl-option-list-item{display:inline-flex;flex-shrink:0;color:var(--s-icon-default)}.option-list-item__selection-icon.sc-swirl-option-list-item{display:inline-flex;flex-shrink:0;color:var(--s-icon-highlight)}.option-list-item__checkbox.sc-swirl-option-list-item{display:inline-flex;width:1.5rem;height:1.5rem;padding:var(--s-space-2)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.option-list-item__checkbox.sc-swirl-option-list-item{width:1.375rem;height:1.375rem}}.option-list-item__checkbox-box.sc-swirl-option-list-item{display:inline-flex;width:100%;height:100%;justify-content:center;align-items:center;border:0.125rem solid var(--s-icon-default);border-radius:var(--s-border-radius-s)}.option-list-item__checkbox-icon.sc-swirl-option-list-item{display:inline-flex}.option-list-item__drag-handle.sc-swirl-option-list-item{position:absolute;z-index:1;top:50%;right:var(--s-space-4);display:inline-flex;margin:0;padding:0;padding:var(--s-space-8);flex-shrink:0;border:none;color:var(--s-icon-default);background-color:transparent;cursor:-webkit-grab;cursor:grab;transform:translateY(-50%)}.option-list-item__drag-handle.sc-swirl-option-list-item:active{cursor:-webkit-grabbing;cursor:grabbing}.option-list-item__drag-handle.sc-swirl-option-list-item:focus:not(:focus-visible){outline:none}.option-list-item__drag-handle.sc-swirl-option-list-item:focus-visible{outline-color:var(--s-focus-default)}";
3379
+
3380
+ const SwirlOptionListItem = class {
3381
+ constructor(hostRef) {
3382
+ index$1.registerInstance(this, hostRef);
3383
+ this.toggleDrag = index$1.createEvent(this, "toggleDrag", 7);
3384
+ this.context = "single-select";
3385
+ this.dragHandleDescription = "Press spacebar to toggle grab";
3386
+ this.dragHandleLabel = "Move option";
3387
+ this.selected = false;
3388
+ this.iconSize = 24;
3389
+ this.desktopMediaQuery = utils.getDesktopMediaQuery();
3390
+ this.desktopMediaQueryHandler = (event) => {
3391
+ this.forceIconProps(event.matches);
3392
+ this.updateIconSize(event.matches);
3393
+ };
3394
+ this.onDragHandleKeyDown = (event) => {
3395
+ if (event.code === "Space" || event.code === "Enter") {
3396
+ event.preventDefault();
3397
+ this.toggleDrag.emit(this.el);
3398
+ }
3399
+ };
3400
+ }
3401
+ componentDidLoad() {
3402
+ var _a, _b;
3403
+ this.forceIconProps(this.desktopMediaQuery.matches);
3404
+ this.updateIconSize(this.desktopMediaQuery.matches);
3405
+ (_b = (_a = this.desktopMediaQuery).addEventListener) === null || _b === void 0 ? void 0 : _b.call(_a, "change", this.desktopMediaQueryHandler);
3406
+ }
3407
+ disconnectedCallback() {
3408
+ var _a, _b;
3409
+ (_b = (_a = this.desktopMediaQuery).removeEventListener) === null || _b === void 0 ? void 0 : _b.call(_a, "change", this.desktopMediaQueryHandler);
3410
+ }
3411
+ forceIconProps(smallIcon) {
3412
+ var _a;
3413
+ const icon = (_a = this.iconEl) === null || _a === void 0 ? void 0 : _a.children[0];
3414
+ icon === null || icon === void 0 ? void 0 : icon.setAttribute("size", smallIcon ? "20" : "24");
3415
+ }
3416
+ updateIconSize(smallIcon) {
3417
+ this.iconSize = smallIcon ? 20 : 24;
3418
+ }
3419
+ render() {
3420
+ const ariaDisabled = this.disabled ? "true" : undefined;
3421
+ const ariaSelected = String(this.selected);
3422
+ const showCheckbox = this.context === "multi-select";
3423
+ const showIcon = Boolean(this.icon) && this.context === "single-select";
3424
+ const showSelectionIcon = this.selected && this.context === "single-select";
3425
+ const className = index$2.classnames("option-list-item", `option-list-item--context-${this.context}`, {
3426
+ "option-list-item--disabled": this.disabled,
3427
+ "option-list-item--draggable": this.allowDrag,
3428
+ "option-list-item--dragging": this.dragging,
3429
+ "option-list-item--selected": this.selected,
3430
+ });
3431
+ return (index$1.h(index$1.Host, null, index$1.h("div", { "aria-disabled": ariaDisabled, "aria-selected": ariaSelected, class: className, part: "option-list-item", role: "option" }, showIcon && (index$1.h("span", { class: "option-list-item__icon", innerHTML: this.icon, ref: (el) => (this.iconEl = el) })), showCheckbox && (index$1.h("span", { class: "option-list-item__checkbox" }, index$1.h("span", { class: "option-list-item__checkbox-box" }, this.selected && (index$1.h("swirl-icon-check-strong", { class: "option-list-item__checkbox-icon", size: 16 }))))), index$1.h("span", { class: "option-list-item__label", part: "option-list-item__label" }, this.label), showSelectionIcon && (index$1.h("span", { class: "option-list-item__selection-icon" }, index$1.h("swirl-icon-check-small", { size: this.iconSize })))), this.allowDrag && (index$1.h("button", { "aria-describedby": this.dragHandleDescription, "aria-label": `${this.dragHandleLabel} "${this.label}"`, class: "option-list-item__drag-handle", onKeyDown: this.onDragHandleKeyDown, type: "button" }, index$1.h("swirl-icon-drag-handle", { size: this.iconSize })))));
3432
+ }
3433
+ get el() { return index$1.getElement(this); }
3434
+ };
3435
+ SwirlOptionListItem.style = swirlOptionListItemCss;
3436
+
3437
+ exports.swirl_icon_check_small = SwirlIconCheckSmall;
3438
+ exports.swirl_icon_drag_handle = SwirlIconDragHandle;
3439
+ exports.swirl_option_list = SwirlOptionList;
3440
+ exports.swirl_option_list_item = SwirlOptionListItem;